answer
stringlengths
15
1.25M
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http: <html xmlns="http: <head> <title>skip (EstraierPure::Condition)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> <pre><span class="ruby-comment cmt"># File estraierpure.rb, line 370</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">skip</span>() <span class="ruby-ivar">@skip</span> <span class="ruby-keyword kw">end</span></pre> </body> </html>
#ifndef <API key> #define <API key> #include "elf/elf_types.h" /* Auxialiary version information. */ struct elf32_verdaux { elf32_word vda_name; /* Version or dependency names */ elf32_word vda_next; /* Offset in bytes to next verdaux entry */ }; struct elf64_verdaux { elf64_word vda_name; /* Version or dependency names */ elf64_word vda_next; /* Offset in bytes to next verdaux entry */ }; #endif
#ifndef _S3C2410_UDC_H #define _S3C2410_UDC_H struct s3c2410_ep { struct list_head queue; unsigned long last_io; /* jiffies timestamp */ struct usb_gadget *gadget; struct s3c2410_udc *dev; const struct <API key> *desc; struct usb_ep ep; u8 num; unsigned short fifo_size; u8 bEndpointAddress; u8 bmAttributes; unsigned halted : 1; unsigned already_seen : 1; unsigned setup_stage : 1; }; /* Warning : ep0 has a fifo of 16 bytes */ /* Don't try to set 32 or 64 */ /* also testusb 14 fails wit 16 but is */ /* fine with 8 */ #define EP0_FIFO_SIZE 8 #define EP_FIFO_SIZE 64 #define DEFAULT_POWER_STATE 0x00 #define <API key> 128 static const char ep0name [] = "ep0"; static const char *const ep_name[] = { ep0name, /* everyone has ep0 */ /* s3c2410 four bidirectional bulk endpoints */ "ep1-bulk", "ep2-bulk", "ep3-bulk", "ep4-bulk", }; #define S3C2410_ENDPOINTS ARRAY_SIZE(ep_name) struct s3c2410_request { struct list_head queue; /* ep's requests */ struct usb_request req; }; enum ep0_state { EP0_IDLE, EP0_IN_DATA_PHASE, EP0_OUT_DATA_PHASE, EP0_END_XFER, EP0_STALL, }; static const char *ep0states[]= { "EP0_IDLE", "EP0_IN_DATA_PHASE", "EP0_OUT_DATA_PHASE", "EP0_END_XFER", "EP0_STALL", }; struct s3c2410_udc { spinlock_t lock; struct s3c2410_ep ep[S3C2410_ENDPOINTS]; int address; struct usb_gadget gadget; struct usb_gadget_driver *driver; struct s3c2410_request fifo_req; u8 fifo_buf[EP_FIFO_SIZE]; u16 devstatus; u32 port_status; int ep0state; unsigned got_irq : 1; unsigned req_std : 1; unsigned req_config : 1; unsigned req_pending : 1; u8 vbus; struct dentry *regs_info; }; #endif
package org.compiere.dbPort; import java.util.Collections; import java.util.List; /** * Native PostgreSQL (pass-through) implementation of {@link Convert} * * @author tsa * */ public final class <API key> extends Convert { @Override protected final List<String> convertStatement(final String sqlStatement) { return Collections.singletonList(sqlStatement); } }
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="es"> <head> <!-- Generated by javadoc (1.8.0_25) on Wed Feb 25 01:10:23 CET 2015 --> <title>Constant Field Values</title> <meta name="date" content="2015-02-25"> <link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> <script type="text/javascript" src="script.js"></script> </head> <body> <script type="text/javascript"><! try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Constant Field Values"; } } catch(err) { } </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="topNav"><a name="navbar.top"> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="overview-summary.html">Overview</a></li> <li>Package</li> <li>Class</li> <li>Use</li> <li><a href="overview-tree.html">Tree</a></li> <li><a href="deprecated-list.html">Deprecated</a></li> <li><a href="index-files/index-1.html">Index</a></li> <li><a href="help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="index.html?constant-values.html" target="_top">Frames</a></li> <li><a href="constant-values.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <a name="skip.navbar.top"> </a></div> <div class="header"> <h1 title="Constant Field Values" class="title">Constant Field Values</h1> <h2 title="Contents">Contents</h2> <ul> <li><a href="#com.darkorbit">com.darkorbit.*</a></li> </ul> </div> <div class="<API key>"><a name="com.darkorbit"> </a> <h2 title="com.darkorbit">com.darkorbit.*</h2> <ul class="blockList"> <li class="blockList"> <table class="constantsSummary" border="0" cellpadding="3" cellspacing="0" summary="Constant Field Values table, listing constant fields, and values"> <caption><span>com.darkorbit.packets.<a href="com/darkorbit/packets/Packet.html" title="class in com.darkorbit.packets">Packet</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th scope="col">Constant Field</th> <th class="colLast" scope="col">Value</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a name="com.darkorbit.packets.Packet.LOGIN"> </a><code>public&nbsp;static&nbsp;final&nbsp;java.lang.String</code></td> <td><code><a href="com/darkorbit/packets/Packet.html#LOGIN">LOGIN</a></code></td> <td class="colLast"><code>"LOGIN"</code></td> </tr> <tr class="rowColor"> <td class="colFirst"><a name="com.darkorbit.packets.Packet.POLICY"> </a><code>public&nbsp;static&nbsp;final&nbsp;java.lang.String</code></td> <td><code><a href="com/darkorbit/packets/Packet.html#POLICY">POLICY</a></code></td> <td class="colLast"><code>"&lt;policy-file-request/&gt;"</code></td> </tr> </tbody> </table> </li> </ul> </div> <div class="bottomNav"><a name="navbar.bottom"> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="overview-summary.html">Overview</a></li> <li>Package</li> <li>Class</li> <li>Use</li> <li><a href="overview-tree.html">Tree</a></li> <li><a href="deprecated-list.html">Deprecated</a></li> <li><a href="index-files/index-1.html">Index</a></li> <li><a href="help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="index.html?constant-values.html" target="_top">Frames</a></li> <li><a href="constant-values.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <a name="skip.navbar.bottom"> </a></div> </body> </html>
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MediaBrowser.Api.Reports { public class ReportRow { <summary> Initializes a new instance of the ReportRow class. </summary> public ReportRow() { Columns = new List<ReportItem>(); } <summary> Gets or sets the identifier. </summary> <value> The identifier. </value> public string Id { get; set; } <summary> Gets or sets a value indicating whether this object has backdrop image. </summary> <value> true if this object has backdrop image, false if not. </value> public bool <API key> { get; set; } <summary> Gets or sets a value indicating whether this object has image tags. </summary> <value> true if this object has image tags, false if not. </value> public bool HasImageTagsPrimary { get; set; } <summary> Gets or sets a value indicating whether this object has image tags logo. </summary> <value> true if this object has image tags logo, false if not. </value> public bool HasImageTagsLogo { get; set; } <summary> Gets or sets a value indicating whether this object has local trailer. </summary> <value> true if this object has local trailer, false if not. </value> public bool HasLocalTrailer { get; set; } <summary> Gets or sets a value indicating whether this object has lock data. </summary> <value> true if this object has lock data, false if not. </value> public bool HasLockData { get; set; } <summary> Gets or sets a value indicating whether this object has embedded image. </summary> <value> true if this object has embedded image, false if not. </value> public bool HasEmbeddedImage { get; set; } <summary> Gets or sets a value indicating whether this object has subtitles. </summary> <value> true if this object has subtitles, false if not. </value> public bool HasSubtitles { get; set; } <summary> Gets or sets a value indicating whether this object has specials. </summary> <value> true if this object has specials, false if not. </value> public bool HasSpecials { get; set; } <summary> Gets or sets a value indicating whether this object is unidentified. </summary> <value> true if this object is unidentified, false if not. </value> public bool IsUnidentified { get; set; } <summary> Gets or sets the columns. </summary> <value> The columns. </value> public List<ReportItem> Columns { get; set; } <summary> Gets or sets the type. </summary> <value> The type. </value> public <API key> RowType { get; set; } <summary> Gets or sets the identifier of the user. </summary> <value> The identifier of the user. </value> public string UserId { get; set; } } }
#ifndef _WINE_WININET_H_ #define _WINE_WININET_H_ #ifdef __cplusplus extern "C" { #endif #define INTERNETAPI #define BOOLAPI INTERNETAPI BOOL WINAPI typedef LPVOID HINTERNET; typedef HINTERNET * LPHINTERNET; typedef WORD INTERNET_PORT; typedef INTERNET_PORT * LPINTERNET_PORT; #define <API key> 0 #define <API key> 21 #define <API key> 70 #define <API key> 80 #define <API key> 443 #define <API key> 1080 #define <API key> 256 #define <API key> 128 #define <API key> 128 #define <API key> 5 #define <API key> 65535 #define <API key> 2048 #define <API key> 32 #define <API key> (<API key> + sizeof("://")+ <API key>) #define <API key> ((DWORD)-1) #define <API key> 1 #define <API key> 0 #define <API key> 0x00000001 #define <API key> 0x00000002 #define <API key> 0x00000004 #define <API key> 0x00000008 #define <API key> 0x00000010 #define <API key> 0x00000040 #define <API key> 0x80000000 #define <API key> 0x40000000 #define <API key> 0x20000000 #define INTERNET_FLAG_ASYNC 0x10000000 #define <API key> 0x08000000 #define <API key> 0x04000000 #define <API key> <API key> #define <API key> 0x02000000 #define <API key> 0x01000000 #define <API key> <API key> #define <API key> 0x00800000 #define <API key> 0x00400000 #define <API key> 0x00200000 #define <API key> 0x00100000 #define <API key> 0x00080000 #define <API key> 0x00040000 #define <API key> 0x00010000 #define <API key> 0x00008000 #define <API key> 0x00004000 #define <API key> 0x00002000 #define <API key> 0x00001000 #define <API key> 0x00000800 #define <API key> 0x00000400 #define INTERNET_FLAG_NO_UI 0x00000200 #define <API key> 0x00000100 #define <API key> 0x00000080 #define <API key> 0x00000040 #define <API key> 0x00000010 #define <API key> <API key> #define <API key> <API key> #define <API key> <API key> #define <API key> (<API key>|\ <API key>|\ <API key>|\ <API key>) #define INTERNET_FLAGS_MASK (<API key> \ | <API key> \ | <API key> \ | INTERNET_FLAG_ASYNC \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | INTERNET_FLAG_NO_UI \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ | <API key> \ ) #define <API key> 0x1 #define <API key> 0x2 #define <API key> 0x4 #define <API key> 0x8 #define <API key> (~INTERNET_FLAGS_MASK) #define <API key> 0x00000001 #define <API key> 0x00000004 #define <API key> 0x00000008 #define <API key> 0 typedef enum { <API key> = -2, <API key> = -1, <API key> = 0, INTERNET_SCHEME_FTP, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, INTERNET_SCHEME_RES, <API key> = INTERNET_SCHEME_FTP, <API key> = INTERNET_SCHEME_RES } INTERNET_SCHEME,* LPINTERNET_SCHEME; typedef struct { DWORD_PTR dwResult; DWORD dwError; } <API key>,* <API key>; typedef struct { DWORD dwAccessType; LPCSTR lpszProxy; LPCSTR lpszProxyBypass; } <API key>,* <API key>; typedef struct { DWORD dwAccessType; LPCWSTR lpszProxy; LPCWSTR lpszProxyBypass; } <API key>,* <API key>; <API key>(INTERNET_PROXY_INFO) <API key>(<API key>) typedef struct { DWORD dwMajorVersion; DWORD dwMinorVersion; } <API key>,* <API key>; typedef struct { DWORD dwMajorVersion; DWORD dwMinorVersion; } HTTP_VERSION_INFO,* LPHTTP_VERSION_INFO; typedef struct { DWORD dwConnectedState; DWORD dwFlags; } <API key>,* <API key>; #define <API key> 0x00000001 typedef struct { DWORD dwStructSize; LPSTR lpszScheme; DWORD dwSchemeLength; INTERNET_SCHEME nScheme; LPSTR lpszHostName; DWORD dwHostNameLength; INTERNET_PORT nPort; LPSTR lpszUserName; DWORD dwUserNameLength; LPSTR lpszPassword; DWORD dwPasswordLength; LPSTR lpszUrlPath; DWORD dwUrlPathLength; LPSTR lpszExtraInfo; DWORD dwExtraInfoLength; } URL_COMPONENTSA,* LPURL_COMPONENTSA; typedef struct { DWORD dwStructSize; LPWSTR lpszScheme; DWORD dwSchemeLength; INTERNET_SCHEME nScheme; LPWSTR lpszHostName; DWORD dwHostNameLength; INTERNET_PORT nPort; LPWSTR lpszUserName; DWORD dwUserNameLength; LPWSTR lpszPassword; DWORD dwPasswordLength; LPWSTR lpszUrlPath; DWORD dwUrlPathLength; LPWSTR lpszExtraInfo; DWORD dwExtraInfoLength; } URL_COMPONENTSW,* LPURL_COMPONENTSW; <API key>(URL_COMPONENTS) <API key>(LPURL_COMPONENTS) typedef struct { FILETIME ftExpiry; FILETIME ftStart; LPSTR lpszSubjectInfo; LPSTR lpszIssuerInfo; LPSTR lpszProtocolName; LPSTR <API key>; LPSTR <API key>; DWORD dwKeySize; } <API key>,* <API key>; typedef struct { FILETIME ftExpiry; FILETIME ftStart; LPWSTR lpszSubjectInfo; LPWSTR lpszIssuerInfo; LPWSTR lpszProtocolName; LPWSTR <API key>; LPWSTR <API key>; DWORD dwKeySize; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct _INTERNET_BUFFERSA { DWORD dwStructSize; struct _INTERNET_BUFFERSA * Next; LPCSTR lpcszHeader; DWORD dwHeadersLength; DWORD dwHeadersTotal; LPVOID lpvBuffer; DWORD dwBufferLength; DWORD dwBufferTotal; DWORD dwOffsetLow; DWORD dwOffsetHigh; } INTERNET_BUFFERSA,* LPINTERNET_BUFFERSA; typedef struct _INTERNET_BUFFERSW { DWORD dwStructSize; struct _INTERNET_BUFFERSW * Next; LPCWSTR lpcszHeader; DWORD dwHeadersLength; DWORD dwHeadersTotal; LPVOID lpvBuffer; DWORD dwBufferLength; DWORD dwBufferTotal; DWORD dwOffsetLow; DWORD dwOffsetHigh; } INTERNET_BUFFERSW,* LPINTERNET_BUFFERSW; <API key>(INTERNET_BUFFERS) <API key>(LPINTERNET_BUFFERS) #define <API key> 4 #define <API key> 120 typedef struct <API key> { DWORD dwGroupSize; DWORD dwGroupFlags; DWORD dwGroupType; DWORD dwDiskUsage; DWORD dwDiskQuota; DWORD dwOwnerStorage[<API key>]; CHAR szGroupName[<API key>]; } <API key>, * <API key>; typedef struct <API key> { DWORD dwGroupSize; DWORD dwGroupFlags; DWORD dwGroupType; DWORD dwDiskUsage; DWORD dwDiskQuota; DWORD dwOwnerStorage[<API key>]; WCHAR szGroupName[<API key>]; } <API key>, *<API key>; <API key>(<API key>) <API key>(<API key>) typedef struct <API key> { DWORD dwOption; union { DWORD dwValue; LPSTR pszValue; FILETIME ftValue; } Value; } <API key>, *<API key>; typedef struct <API key> { DWORD dwOption; union { DWORD dwValue; LPWSTR pszValue; FILETIME ftValue; } Value; } <API key>, *<API key>; <API key>(<API key>) <API key>(<API key>) #define <API key> 1 #define <API key> 2 #define <API key> 3 #define <API key> 4 #define <API key> 5 #define <API key> 6 #define <API key> 7 #define <API key> 8 #define <API key> 9 /* Values for <API key> */ #define PROXY_TYPE_DIRECT 0x00000001 #define PROXY_TYPE_PROXY 0x00000002 #define <API key> 0x00000004 #define <API key> 0x00000008 /* Values for <API key> */ #define <API key> 0x00000001 #define <API key> 0x00000002 #define <API key> 0x00000004 #define <API key> 0x00000008 #define <API key> 0x00000010 #define <API key> 0x00000020 #define <API key> 0x00000040 typedef struct <API key> { DWORD dwSize; LPSTR pszConnection; DWORD dwOptionCount; DWORD dwOptionError; <API key> pOptions; } <API key>, *<API key>; typedef struct <API key> { DWORD dwSize; LPWSTR pszConnection; DWORD dwOptionCount; DWORD dwOptionError; <API key> pOptions; } <API key>, *<API key>; <API key>(<API key>) <API key>(<API key>) typedef struct <API key> { DWORD_PTR Socket; DWORD SourcePort; DWORD DestPort; DWORD Flags; } <API key>, *<API key>; #define <API key> 0x00000001 #define IDSI_FLAG_SECURE 0x00000002 #define IDSI_FLAG_PROXY 0x00000004 #define IDSI_FLAG_TUNNEL 0x00000008 BOOLAPI <API key>(CONST SYSTEMTIME *,DWORD ,LPSTR ,DWORD); BOOLAPI <API key>(CONST SYSTEMTIME *,DWORD ,LPWSTR ,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) #define <API key> 0 #define <API key> 30 BOOLAPI <API key>(LPCSTR ,SYSTEMTIME *,DWORD); BOOLAPI <API key>(LPCWSTR ,SYSTEMTIME *,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI InternetCrackUrlA(LPCSTR ,DWORD ,DWORD ,LPURL_COMPONENTSA); BOOLAPI InternetCrackUrlW(LPCWSTR ,DWORD ,DWORD ,LPURL_COMPONENTSW); #define InternetCrackUrl WINELIB_NAME_AW(InternetCrackUrl) BOOLAPI InternetCreateUrlA(LPURL_COMPONENTSA ,DWORD ,LPSTR ,LPDWORD); BOOLAPI InternetCreateUrlW(LPURL_COMPONENTSW ,DWORD ,LPWSTR ,LPDWORD); #define InternetCreateUrl WINELIB_NAME_AW(InternetCreateUrl) BOOLAPI <API key>(LPCSTR ,LPSTR ,LPDWORD ,DWORD); BOOLAPI <API key>(LPCWSTR ,LPWSTR ,LPDWORD ,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI InternetCombineUrlA(LPCSTR ,LPCSTR ,LPSTR ,LPDWORD ,DWORD); BOOLAPI InternetCombineUrlW(LPCWSTR ,LPCWSTR ,LPWSTR ,LPDWORD ,DWORD); #define InternetCombineUrl WINELIB_NAME_AW(InternetCombineUrl) #define ICU_ESCAPE 0x80000000 #define ICU_USERNAME 0x40000000 #define ICU_NO_ENCODE 0x20000000 #define ICU_DECODE 0x10000000 #define ICU_NO_META 0x08000000 #define <API key> 0x04000000 #define ICU_BROWSER_MODE 0x02000000 INTERNETAPI HINTERNET WINAPI InternetOpenA(LPCSTR ,DWORD ,LPCSTR ,LPCSTR ,DWORD); INTERNETAPI HINTERNET WINAPI InternetOpenW(LPCWSTR ,DWORD ,LPCWSTR ,LPCWSTR ,DWORD); #define InternetOpen WINELIB_NAME_AW(InternetOpen) #define <API key> 0 #define <API key> 1 #define <API key> 3 #define <API key> 4 #define <API key> <API key> #define <API key> <API key> #define <API key> <API key> BOOLAPI InternetCloseHandle(HINTERNET); INTERNETAPI HINTERNET WINAPI InternetConnectA(HINTERNET ,LPCSTR ,INTERNET_PORT , LPCSTR ,LPCSTR ,DWORD ,DWORD ,DWORD_PTR ); INTERNETAPI HINTERNET WINAPI InternetConnectW(HINTERNET ,LPCWSTR ,INTERNET_PORT , LPCWSTR ,LPCWSTR ,DWORD ,DWORD ,DWORD_PTR ); #define InternetConnect WINELIB_NAME_AW(InternetConnect) #define <API key> 0 #define <API key> 1 #define <API key> 2 #define <API key> 3 #define InternetConnectUrl(hInternet,lpszUrl,dwFlags,dwContext) \ InternetConnect(hInternet,\ lpszUrl,\ <API key>,\ NULL,\ NULL,\ <API key>,\ dwFlags,\ dwContext \ ) INTERNETAPI HINTERNET WINAPI InternetOpenUrlA(HINTERNET ,LPCSTR ,LPCSTR ,DWORD ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI InternetOpenUrlW(HINTERNET ,LPCWSTR ,LPCWSTR ,DWORD ,DWORD ,DWORD_PTR); #define InternetOpenUrl WINELIB_NAME_AW(InternetOpenUrl) BOOLAPI InternetReadFile( HINTERNET ,LPVOID ,DWORD ,LPDWORD ); INTERNETAPI BOOL WINAPI InternetReadFileExA( HINTERNET ,LPINTERNET_BUFFERSA ,DWORD ,DWORD_PTR ); INTERNETAPI BOOL WINAPI InternetReadFileExW( HINTERNET ,LPINTERNET_BUFFERSW ,DWORD ,DWORD_PTR ); #define InternetReadFileEx WINELIB_NAME_AW(InternetReadFileEx) #define IRF_ASYNC <API key> #define IRF_SYNC <API key> #define IRF_USE_CONTEXT <API key> #define IRF_NO_WAIT 0x00000008 INTERNETAPI DWORD WINAPI <API key>(HINTERNET ,LONG ,PVOID ,DWORD ,DWORD_PTR); BOOLAPI InternetWriteFile(HINTERNET ,LPCVOID ,DWORD ,LPDWORD); BOOLAPI <API key>(HINTERNET ,LPDWORD ,DWORD ,DWORD_PTR); BOOLAPI <API key>(HINTERNET ,LPVOID); BOOLAPI <API key>(HINTERNET ,LPVOID); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI <API key>(HINTERNET ,DWORD ,LPVOID ,LPDWORD); BOOLAPI <API key>(HINTERNET ,DWORD ,LPVOID ,LPDWORD); #define InternetQueryOption WINELIB_NAME_AW(InternetQueryOption) BOOLAPI InternetSetOptionA(HINTERNET ,DWORD ,LPVOID ,DWORD); BOOLAPI InternetSetOptionW(HINTERNET ,DWORD ,LPVOID ,DWORD); #define InternetSetOption WINELIB_NAME_AW(InternetSetOption) BOOLAPI <API key>(HINTERNET ,DWORD ,LPVOID ,DWORD ,DWORD); BOOLAPI <API key>(HINTERNET ,DWORD ,LPVOID ,DWORD ,DWORD); #define InternetSetOptionEx WINELIB_NAME_AW(InternetSetOptionEx) BOOLAPI <API key>(HINTERNET ,HANDLE *); BOOLAPI <API key>(HANDLE); #define ISO_GLOBAL 0x00000001 #define ISO_REGISTRY 0x00000002 #define ISO_VALID_FLAGS (ISO_GLOBAL | ISO_REGISTRY) #define <API key> 1 #define <API key> 2 #define <API key> 3 #define <API key> 4 #define <API key> 5 #define <API key> <API key> #define <API key> 6 #define <API key> <API key> #define <API key> 7 #define <API key> 8 #define <API key> 9 #define <API key> 11 #define <API key> 12 #define <API key> 13 #define <API key> 15 #define <API key> 16 #define <API key> 21 #define <API key> 22 #define <API key> 23 #define <API key> 24 #define <API key> 26 #define <API key> 27 #define <API key> 28 #define <API key> 29 #define <API key> 30 #define <API key> 31 #define <API key> 32 #define <API key> 33 #define INTERNET_OPTION_URL 34 #define <API key> 35 #define <API key> 36 #define <API key> 37 #define <API key> 38 #define <API key> 39 #define <API key> 40 #define <API key> 41 #define <API key> 42 #define <API key> 43 #define <API key> 44 #define <API key> 45 #define <API key> 46 #define <API key> 47 #define <API key> 48 #define <API key> 49 #define <API key> 50 #define <API key> 51 #define <API key> 52 #define <API key> 53 #define <API key> 54 #define <API key> 55 #define <API key> 56 #define <API key> 57 #define <API key> 58 #define <API key> 59 #define <API key> 60 #define <API key> 62 #define <API key> 63 #define <API key> 64 #define <API key> 65 #define <API key> 67 #define <API key> 68 #define <API key> 69 #define <API key> 70 #define <API key> 73 #define <API key> 74 #define <API key> 75 #define <API key> 76 #define <API key> 77 #define <API key> 78 #define <API key> 79 #define <API key> 80 #define <API key> 81 #define <API key> 82 #define <API key> 83 #define <API key> 84 #define <API key> 85 #define <API key> 86 #define <API key> 87 #define <API key> 88 #define <API key> 89 #define <API key> 90 #define <API key> 91 #define <API key> 92 #define <API key> 93 #define <API key> 94 #define <API key> 95 #define <API key> 96 #define <API key> 100 #define <API key> 101 #define INTERNET_OPTION_IDN 102 #define <API key> 103 #define <API key> 104 #define <API key> 105 #define <API key> <API key> #define <API key> <API key> #define <API key> 1000 #define <API key> 1 #define <API key> 2 #define <API key> 3 #define <API key> 4 #define <API key> 5 #define <API key> 6 #define <API key> 7 #define <API key> 8 #define <API key> 9 #define <API key> 10 #define <API key> 11 #define <API key> 12 #define <API key> 13 #define <API key> 0x00000001 #define <API key> 0x10000000 #define <API key> 0x40000000 #define <API key> 0x20000000 #define <API key> 0x80000000 #define <API key> <API key> #define SECURITY_FLAG_SSL 0x00000002 #define SECURITY_FLAG_SSL3 0x00000004 #define SECURITY_FLAG_PCT 0x00000008 #define SECURITY_FLAG_PCT4 0x00000010 #define <API key> 0x00000020 #define SECURITY_FLAG_40BIT <API key> #define <API key> <API key> #define SECURITY_FLAG_56BIT <API key> #define <API key> 0x00000080 #define <API key> 0x00000100 #define <API key> 0x00000200 #define <API key> <API key> #define <API key> <API key> #define <API key> <API key> #define <API key> <API key> #define SECURITY_SET_MASK (<API key> |\ <API key> |\ <API key> |\ <API key> |\ <API key>) BOOLAPI <API key>(LPDWORD ,LPSTR ,LPDWORD); BOOLAPI <API key>(LPDWORD ,LPWSTR ,LPDWORD); #define <API key> WINELIB_NAME_AW(<API key>) typedef VOID (CALLBACK *<API key>)(HINTERNET ,DWORD_PTR ,DWORD , LPVOID ,DWORD); typedef <API key> * <API key>; INTERNETAPI <API key> WINAPI <API key>(HINTERNET ,<API key>); INTERNETAPI <API key> WINAPI <API key>(HINTERNET ,<API key>); #define <API key> WINELIB_NAME_AW(<API key>) #define <API key> 10 #define <API key> 11 #define <API key> 20 #define <API key> 21 #define <API key> 30 #define <API key> 31 #define <API key> 40 #define <API key> 41 #define <API key> 42 #define <API key> 43 #define <API key> 50 #define <API key> 51 #define <API key> 60 #define <API key> 70 #define <API key> 80 #define <API key> 100 #define <API key> 110 #define <API key> 120 #define <API key> 140 #define <API key> 200 #define <API key> 320 #define <API key> 321 #define <API key> 324 #define <API key> 325 #define <API key> 326 #define <API key> 327 #define <API key> 0x00000001 #define <API key> 0x00000002 #define <API key> 0x00000010 #define INTERNET_STATE_IDLE 0x00000100 #define INTERNET_STATE_BUSY 0x00000200 #define <API key> ((<API key>)(-1L)) #define <API key> 0x00000000 #define <API key> 0x00000001 #define <API key> 0x00000002 #define <API key> (<API key> | <API key>) BOOLAPI FtpCommandA(HINTERNET, BOOL, DWORD, LPCSTR, DWORD_PTR, HINTERNET *); BOOLAPI FtpCommandW(HINTERNET, BOOL, DWORD, LPCWSTR, DWORD_PTR, HINTERNET *); #define FtpCommand WINELIB_NAME_AW(FtpCommand) INTERNETAPI HINTERNET WINAPI FtpFindFirstFileA(HINTERNET ,LPCSTR , LPWIN32_FIND_DATAA ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI FtpFindFirstFileW(HINTERNET ,LPCWSTR , LPWIN32_FIND_DATAW ,DWORD ,DWORD_PTR); #define FtpFindFirstFile WINELIB_NAME_AW(FtpFindFirstFile) BOOLAPI FtpGetFileA(HINTERNET ,LPCSTR ,LPCSTR ,BOOL ,DWORD ,DWORD ,DWORD_PTR); BOOLAPI FtpGetFileW(HINTERNET ,LPCWSTR ,LPCWSTR ,BOOL ,DWORD ,DWORD ,DWORD_PTR); #define FtpGetFile WINELIB_NAME_AW(FtpGetFile) DWORD WINAPI FtpGetFileSize(HINTERNET, LPDWORD); BOOLAPI FtpPutFileA(HINTERNET ,LPCSTR ,LPCSTR ,DWORD ,DWORD_PTR); BOOLAPI FtpPutFileW(HINTERNET ,LPCWSTR ,LPCWSTR ,DWORD ,DWORD_PTR); #define FtpPutFile WINELIB_NAME_AW(FtpPutFile) BOOLAPI FtpDeleteFileA(HINTERNET ,LPCSTR); BOOLAPI FtpDeleteFileW(HINTERNET ,LPCWSTR); #define FtpDeleteFile WINELIB_NAME_AW(FtpDeleteFile) BOOLAPI FtpRenameFileA(HINTERNET ,LPCSTR ,LPCSTR); BOOLAPI FtpRenameFileW(HINTERNET ,LPCWSTR ,LPCWSTR); #define FtpRenameFile WINELIB_NAME_AW(FtpRenameFile) INTERNETAPI HINTERNET WINAPI FtpOpenFileA(HINTERNET ,LPCSTR ,DWORD ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI FtpOpenFileW(HINTERNET ,LPCWSTR ,DWORD ,DWORD ,DWORD_PTR); #define FtpOpenFile WINELIB_NAME_AW(FtpOpenFile) BOOLAPI FtpCreateDirectoryA(HINTERNET ,LPCSTR); BOOLAPI FtpCreateDirectoryW(HINTERNET ,LPCWSTR); #define FtpCreateDirectory WINELIB_NAME_AW(FtpCreateDirectory) BOOLAPI FtpRemoveDirectoryA(HINTERNET ,LPCSTR); BOOLAPI FtpRemoveDirectoryW(HINTERNET ,LPCWSTR); #define FtpRemoveDirectory WINELIB_NAME_AW(FtpRemoveDirectory) BOOLAPI <API key>(HINTERNET ,LPCSTR); BOOLAPI <API key>(HINTERNET ,LPCWSTR); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI <API key>(HINTERNET ,LPSTR ,LPDWORD); BOOLAPI <API key>(HINTERNET ,LPWSTR ,LPDWORD); #define <API key> WINELIB_NAME_AW(<API key>) #define <API key> 128 #define <API key> 256 #define <API key> <API key> #define <API key> (1 \ + <API key> \ + 1 \ + <API key> \ + 1 \ + <API key> \ + 1 \ + <API key> \ + 1 \ + 1 \ + 2 \ ) typedef struct { CHAR DisplayString[<API key> + 1]; DWORD GopherType; DWORD SizeLow; DWORD SizeHigh; FILETIME <API key>; CHAR Locator[<API key> + 1]; } GOPHER_FIND_DATAA,* LPGOPHER_FIND_DATAA; typedef struct { WCHAR DisplayString[<API key> + 1]; DWORD GopherType; DWORD SizeLow; DWORD SizeHigh; FILETIME <API key>; WCHAR Locator[<API key> + 1]; } GOPHER_FIND_DATAW,* LPGOPHER_FIND_DATAW; <API key>(GOPHER_FIND_DATA) <API key>(LPGOPHER_FIND_DATA) #define <API key> 0x00000001 #define <API key> 0x00000002 #define GOPHER_TYPE_CSO 0x00000004 #define GOPHER_TYPE_ERROR 0x00000008 #define <API key> 0x00000010 #define <API key> 0x00000020 #define <API key> 0x00000040 #define <API key> 0x00000080 #define GOPHER_TYPE_TELNET 0x00000100 #define GOPHER_TYPE_BINARY 0x00000200 #define <API key> 0x00000400 #define GOPHER_TYPE_TN3270 0x00000800 #define GOPHER_TYPE_GIF 0x00001000 #define GOPHER_TYPE_IMAGE 0x00002000 #define GOPHER_TYPE_BITMAP 0x00004000 #define GOPHER_TYPE_MOVIE 0x00008000 #define GOPHER_TYPE_SOUND 0x00010000 #define GOPHER_TYPE_HTML 0x00020000 #define GOPHER_TYPE_PDF 0x00040000 #define <API key> 0x00080000 #define GOPHER_TYPE_INLINE 0x00100000 #define GOPHER_TYPE_UNKNOWN 0x20000000 #define GOPHER_TYPE_ASK 0x40000000 #define <API key> 0x80000000 #define IS_GOPHER_FILE(type) (BOOL)(((type) & <API key>) ? TRUE : FALSE) #define IS_GOPHER_DIRECTORY(type) (BOOL)(((type) & <API key>) ? TRUE : FALSE) #define <API key>(type) (BOOL)(((type) & GOPHER_TYPE_CSO) ? TRUE : FALSE) #define IS_GOPHER_ERROR(type) (BOOL)(((type) & GOPHER_TYPE_ERROR) ? TRUE : FALSE) #define <API key>(type) (BOOL)(((type) & <API key>) ? TRUE : FALSE) #define <API key>(type) (BOOL)(((type) & GOPHER_TYPE_TELNET) ? TRUE : FALSE) #define <API key>(type) (BOOL)(((type) & <API key>) ? TRUE : FALSE) #define <API key>(type) (BOOL)(((type) & GOPHER_TYPE_TN3270) ? TRUE : FALSE) #define IS_GOPHER_ASK(type) (BOOL)(((type) & GOPHER_TYPE_ASK) ? TRUE : FALSE) #define IS_GOPHER_PLUS(type) (BOOL)(((type) & <API key>) ? TRUE : FALSE) #define <API key>(type) (BOOL)(((type) & GOPHER_TYPE_UNKNOWN) ? FALSE : TRUE) #define <API key> (<API key> \ | <API key> \ | <API key> \ | <API key> \ | GOPHER_TYPE_BINARY \ | GOPHER_TYPE_GIF \ | GOPHER_TYPE_IMAGE \ | GOPHER_TYPE_BITMAP \ | GOPHER_TYPE_MOVIE \ | GOPHER_TYPE_SOUND \ | GOPHER_TYPE_HTML \ | GOPHER_TYPE_PDF \ | <API key> \ | GOPHER_TYPE_INLINE \ ) typedef struct { LPCSTR Comment; LPCSTR EmailAddress; } <API key>,* <API key>; typedef struct { LPCWSTR Comment; LPCWSTR EmailAddress; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct { FILETIME DateAndTime; } <API key>,* <API key>; typedef struct { DWORD Ttl; } <API key>,* <API key>; typedef struct { INT Score; } <API key>,* <API key>; typedef struct { INT LowerBound; INT UpperBound; } <API key>,* <API key>; typedef struct { LPCSTR Site; } <API key>,* <API key>; typedef struct { LPCWSTR Site; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct { LPCSTR Organization; } <API key>,* <API key>; typedef struct { LPCWSTR Organization; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct { LPCSTR Location; } <API key>,* <API key>; typedef struct { LPCWSTR Location; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct { INT DegreesNorth; INT MinutesNorth; INT SecondsNorth; INT DegreesEast; INT MinutesEast; INT SecondsEast; } <API key>,* <API key>; typedef struct { INT Zone; } <API key>,* <API key>; typedef struct { LPCSTR Provider; } <API key>,* <API key>; typedef struct { LPCWSTR Provider; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct { LPCSTR Version; } <API key>,* <API key>; typedef struct { LPCWSTR Version; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct { LPCSTR ShortAbstract; LPCSTR AbstractFile; } <API key>,* <API key>; typedef struct { LPCWSTR ShortAbstract; LPCWSTR AbstractFile; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct { LPCSTR ContentType; LPCSTR Language; DWORD Size; } <API key>,* <API key>; typedef struct { LPCWSTR ContentType; LPCWSTR Language; DWORD Size; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct { BOOL TreeWalk; } <API key>,* <API key>; typedef struct { LPCSTR QuestionType; LPCSTR QuestionText; } <API key>,* <API key>; typedef struct { LPCWSTR QuestionType; LPCWSTR QuestionText; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct { LPCSTR Text; } <API key>,* <API key>; typedef struct { LPCWSTR Text; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct { DWORD CategoryId; DWORD AttributeId; union { <API key> Admin; <API key> ModDate; <API key> Ttl; <API key> Score; <API key> ScoreRange; <API key> Site; <API key> Organization; <API key> Location; <API key> <API key>; <API key> TimeZone; <API key> Provider; <API key> Version; <API key> Abstract; <API key> View; <API key> Veronica; <API key> Ask; <API key> Unknown; } AttributeType; } <API key>, *<API key>; typedef struct { DWORD CategoryId; DWORD AttributeId; union { <API key> Admin; <API key> ModDate; <API key> Ttl; <API key> Score; <API key> ScoreRange; <API key> Site; <API key> Organization; <API key> Location; <API key> <API key>; <API key> TimeZone; <API key> Provider; <API key> Version; <API key> Abstract; <API key> View; <API key> Veronica; <API key> Ask; <API key> Unknown; } AttributeType; } <API key>, *<API key>; <API key>(<API key>) <API key>(<API key>) #define <API key> 128 #define <API key> 128 #define <API key> 256 #define <API key> TEXT("+INFO") #define <API key> TEXT("+ADMIN") #define <API key> TEXT("+VIEWS") #define <API key> TEXT("+ABSTRACT") #define <API key> TEXT("+VERONICA") #define <API key> TEXT("Admin") #define <API key> TEXT("Mod-Date") #define <API key> TEXT("TTL") #define <API key> TEXT("Score") #define <API key> TEXT("Score-range") #define <API key> TEXT("Site") #define <API key> TEXT("Org") #define <API key> TEXT("Loc") #define <API key> TEXT("Geog") #define <API key> TEXT("TZ") #define <API key> TEXT("Provider") #define <API key> TEXT("Version") #define <API key> TEXT("Abstract") #define <API key> TEXT("View") #define <API key> TEXT("treewalk") #define <API key> 0xabcccc00 #define <API key> (<API key> + 1) #define <API key> (<API key> + 2) #define <API key> (<API key> + 3) #define <API key> (<API key> + 4) #define <API key> (<API key> + 5) #define <API key> (<API key> + 6) #define <API key> (<API key> + 7) #define <API key> (<API key> + 8) #define <API key> (<API key> + 9) #define <API key> (<API key> + 10) #define <API key> (<API key> + 11) #define <API key> (<API key> + 12) #define <API key> (<API key> + 13) #define <API key> (<API key> + 14) #define <API key> (<API key> + 15) #define <API key> (<API key> + 16) #define <API key> (<API key> + 17) #define <API key> (<API key> + 18) #define <API key> (<API key> + 19) #define <API key> (<API key> + 20) #define <API key> (<API key> + 21) #define <API key> (<API key> + 22) #define <API key> (<API key> + 23) #define <API key> (<API key> + 24) #define <API key> (<API key> + 25) BOOLAPI <API key>(LPCSTR ,INTERNET_PORT ,LPCSTR , LPCSTR ,DWORD ,LPSTR ,LPDWORD); BOOLAPI <API key>(LPCWSTR ,INTERNET_PORT ,LPCWSTR , LPCWSTR ,DWORD ,LPWSTR ,LPDWORD); #define GopherCreateLocator WINELIB_NAME_AW(GopherCreateLocator) BOOLAPI <API key>(LPCSTR ,LPDWORD); BOOLAPI <API key>(LPCWSTR ,LPDWORD); #define <API key> WINELIB_NAME_AW(<API key>) INTERNETAPI HINTERNET WINAPI <API key>(HINTERNET ,LPCSTR , LPCSTR ,LPGOPHER_FIND_DATAA ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI <API key>(HINTERNET ,LPCWSTR , LPCWSTR ,LPGOPHER_FIND_DATAW ,DWORD ,DWORD_PTR); #define GopherFindFirstFile WINELIB_NAME_AW(GopherFindFirstFile) INTERNETAPI HINTERNET WINAPI GopherOpenFileA(HINTERNET ,LPCSTR ,LPCSTR ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI GopherOpenFileW(HINTERNET ,LPCWSTR ,LPCWSTR ,DWORD ,DWORD_PTR); #define GopherOpenFile WINELIB_NAME_AW(GopherOpenFile) typedef BOOL (CALLBACK *<API key>)(<API key> ,DWORD); typedef BOOL (CALLBACK *<API key>)(<API key> ,DWORD); <API key>(<API key>) BOOLAPI GopherGetAttributeA(HINTERNET ,LPCSTR ,LPCSTR ,LPBYTE , DWORD ,LPDWORD ,<API key> ,DWORD_PTR); BOOLAPI GopherGetAttributeW(HINTERNET ,LPCWSTR ,LPCWSTR ,LPBYTE , DWORD ,LPDWORD ,<API key> ,DWORD_PTR); #define GopherGetAttribute WINELIB_NAME_AW(GopherGetAttribute) #define HTTP_MAJOR_VERSION 1 #define HTTP_MINOR_VERSION 0 #define HTTP_VERSION TEXT("HTTP/1.0") #define <API key> 0 #define <API key> 1 #define <API key> 2 #define <API key> 3 #define <API key> 4 #define <API key> 5 #define <API key> 6 #define HTTP_QUERY_ALLOW 7 #define HTTP_QUERY_PUBLIC 8 #define HTTP_QUERY_DATE 9 #define HTTP_QUERY_EXPIRES 10 #define <API key> 11 #define <API key> 12 #define HTTP_QUERY_URI 13 #define <API key> 14 #define HTTP_QUERY_COST 15 #define HTTP_QUERY_LINK 16 #define HTTP_QUERY_PRAGMA 17 #define HTTP_QUERY_VERSION 18 #define <API key> 19 #define <API key> 20 #define <API key> 21 #define <API key> 22 #define <API key> 23 #define HTTP_QUERY_ACCEPT 24 #define <API key> 25 #define <API key> 26 #define <API key> 27 #define <API key> 28 #define <API key> 29 #define <API key> 30 #define HTTP_QUERY_FROM 31 #define <API key> 32 #define HTTP_QUERY_LOCATION 33 #define HTTP_QUERY_ORIG_URI 34 #define HTTP_QUERY_REFERER 35 #define <API key> 36 #define HTTP_QUERY_SERVER 37 #define HTTP_QUERY_TITLE 38 #define <API key> 39 #define <API key> 40 #define <API key> 41 #define <API key> 42 #define <API key> 43 #define HTTP_QUERY_COOKIE 44 #define <API key> 45 #define HTTP_QUERY_REFRESH 46 #define <API key> 47 #define HTTP_QUERY_AGE 48 #define <API key> 49 #define <API key> 50 #define <API key> 51 #define <API key> 52 #define <API key> 53 #define HTTP_QUERY_ETAG 54 #define HTTP_QUERY_HOST 55 #define HTTP_QUERY_IF_MATCH 56 #define <API key> 57 #define HTTP_QUERY_IF_RANGE 58 #define <API key> 59 #define <API key> 60 #define <API key> 61 #define HTTP_QUERY_RANGE 62 #define <API key> 63 #define HTTP_QUERY_UPGRADE 64 #define HTTP_QUERY_VARY 65 #define HTTP_QUERY_VIA 66 #define HTTP_QUERY_WARNING 67 #define HTTP_QUERY_EXPECT 68 #define <API key> 69 #define <API key> 70 #define <API key> 71 #define <API key> 72 #define <API key> 73 #define <API key> 74 #define <API key> 75 #define <API key> 76 #define <API key> 77 #define <API key> 78 #define HTTP_QUERY_MAX 78 #define HTTP_QUERY_CUSTOM 65535 #define <API key> 0x80000000 #define <API key> 0x40000000 #define <API key> 0x20000000 #define <API key> 0x10000000 #define <API key> (<API key> \ | <API key> \ | <API key> \ | <API key> \ ) #define <API key> (~<API key>) #define <API key> 100 #define <API key> 101 #define HTTP_STATUS_OK 200 #define HTTP_STATUS_CREATED 201 #define <API key> 202 #define HTTP_STATUS_PARTIAL 203 #define <API key> 204 #define <API key> 205 #define <API key> 206 #define <API key> 300 #define HTTP_STATUS_MOVED 301 #define <API key> 302 #define <API key> 303 #define <API key> 304 #define <API key> 305 #define <API key> 307 #define <API key> 400 #define HTTP_STATUS_DENIED 401 #define <API key> 402 #define <API key> 403 #define <API key> 404 #define <API key> 405 #define <API key> 406 #define <API key> 407 #define <API key> 408 #define <API key> 409 #define HTTP_STATUS_GONE 410 #define <API key> 411 #define <API key> 412 #define <API key> 413 #define <API key> 414 #define <API key> 415 #define <API key> 500 #define <API key> 501 #define <API key> 502 #define <API key> 503 #define <API key> 504 #define <API key> 505 #define HTTP_STATUS_FIRST <API key> #define HTTP_STATUS_LAST <API key> INTERNETAPI HINTERNET WINAPI HttpOpenRequestA(HINTERNET ,LPCSTR ,LPCSTR ,LPCSTR , LPCSTR ,LPCSTR * ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI HttpOpenRequestW(HINTERNET ,LPCWSTR ,LPCWSTR ,LPCWSTR , LPCWSTR ,LPCWSTR * ,DWORD ,DWORD_PTR); #define HttpOpenRequest WINELIB_NAME_AW(HttpOpenRequest) BOOLAPI <API key>(HINTERNET ,LPCSTR ,DWORD ,DWORD); BOOLAPI <API key>(HINTERNET ,LPCWSTR ,DWORD ,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) #define <API key> 0x0000FFFF #define <API key> 0xFFFF0000 #define <API key> 0x10000000 #define <API key> 0x20000000 #define <API key> 0x40000000 #define <API key> 0x01000000 #define <API key> <API key> #define <API key> 0x80000000 BOOLAPI HttpSendRequestA(HINTERNET ,LPCSTR ,DWORD ,LPVOID ,DWORD); BOOLAPI HttpSendRequestW(HINTERNET ,LPCWSTR ,DWORD ,LPVOID ,DWORD); #define HttpSendRequest WINELIB_NAME_AW(HttpSendRequest) INTERNETAPI BOOL WINAPI HttpSendRequestExA(HINTERNET ,LPINTERNET_BUFFERSA , LPINTERNET_BUFFERSA ,DWORD ,DWORD_PTR); INTERNETAPI BOOL WINAPI HttpSendRequestExW(HINTERNET ,LPINTERNET_BUFFERSW , LPINTERNET_BUFFERSW ,DWORD ,DWORD_PTR); #define HttpSendRequestEx WINELIB_NAME_AW(HttpSendRequestEx) #define HSR_ASYNC <API key> #define HSR_SYNC <API key> #define HSR_USE_CONTEXT <API key> #define HSR_INITIATE 0x00000008 #define HSR_DOWNLOAD 0x00000010 #define HSR_CHUNKED 0x00000020 INTERNETAPI BOOL WINAPI HttpEndRequestA(HINTERNET ,LPINTERNET_BUFFERSA ,DWORD ,DWORD_PTR); INTERNETAPI BOOL WINAPI HttpEndRequestW(HINTERNET ,LPINTERNET_BUFFERSW ,DWORD ,DWORD_PTR); #define HttpEndRequest WINELIB_NAME_AW(HttpEndRequest) BOOLAPI HttpQueryInfoA(HINTERNET ,DWORD ,LPVOID ,LPDWORD ,LPDWORD); BOOLAPI HttpQueryInfoW(HINTERNET ,DWORD ,LPVOID ,LPDWORD ,LPDWORD); #define HttpQueryInfo WINELIB_NAME_AW(HttpQueryInfo) BOOLAPI <API key>(VOID); BOOLAPI <API key>(LPSTR,ULONG *,ULONG *,ULONG); BOOLAPI <API key>(LPWSTR,ULONG *,ULONG *,ULONG); #define <API key> WINELIB_NAME_AW(<API key>) #define <API key> 0x00000001 #define <API key> 0x00000002 #define <API key> 0x00000010 #define <API key> 0x00000020 #define <API key> 0x00000040 #define <API key> 0x00000080 #define <API key> 0x00000100 #define <API key> 0x00000200 #define INTERNET_COOKIE_IE6 0x00000400 #define <API key> 0x00000800 BOOLAPI <API key>(LPCSTR,LPCSTR,LPSTR,LPDWORD,DWORD,LPVOID); BOOLAPI <API key>(LPCWSTR,LPCWSTR,LPWSTR,LPDWORD,DWORD,LPVOID); #define InternetGetCookieEx WINELIB_NAME_AW(InternetGetCookieEx) DWORD WINAPI <API key>(LPCSTR,LPCSTR,LPCSTR,DWORD,DWORD_PTR); DWORD WINAPI <API key>(LPCWSTR,LPCWSTR,LPCWSTR,DWORD,DWORD_PTR); #define InternetSetCookieEx WINELIB_NAME_AW(InternetSetCookieEx) BOOLAPI <API key>(LPCSTR,ULONG *); BOOLAPI <API key>(LPCWSTR,ULONG *); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI <API key>(LPCSTR,DWORD); BOOLAPI <API key>(LPCWSTR,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI InternetSetCookieA(LPCSTR ,LPCSTR ,LPCSTR); BOOLAPI InternetSetCookieW(LPCWSTR ,LPCWSTR ,LPCWSTR); #define InternetSetCookie WINELIB_NAME_AW(InternetSetCookie) BOOLAPI InternetGetCookieA(LPCSTR ,LPCSTR ,LPSTR ,LPDWORD); BOOLAPI InternetGetCookieW(LPCWSTR ,LPCWSTR ,LPWSTR ,LPDWORD); #define InternetGetCookie WINELIB_NAME_AW(InternetGetCookie) INTERNETAPI DWORD WINAPI <API key>(DWORD); BOOLAPI <API key>(LPCSTR ,DWORD ,DWORD); BOOLAPI <API key>(LPCWSTR ,DWORD ,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) #define <API key> 0x00000001 #define <API key> 0x01 #define <API key> 0x02 #define <API key> 0x04 #define <API key> 0x08 #define <API key> 0x10 DWORD <API key> ( DWORD_PTR ,DWORD ,LPVOID ); typedef DWORD (CALLBACK *PFN_AUTH_NOTIFY) (DWORD_PTR,DWORD,LPVOID); typedef struct { DWORD cbStruct; DWORD dwOptions; PFN_AUTH_NOTIFY pfnNotify; DWORD_PTR dwContext; } <API key>; INTERNETAPI DWORD WINAPI InternetErrorDlg(HWND ,HINTERNET ,DWORD ,DWORD ,LPVOID *); INTERNETAPI DWORD WINAPI <API key>(HWND ,LPSTR ,LPSTR ,BOOL); INTERNETAPI DWORD WINAPI <API key>(HWND ,LPWSTR ,LPWSTR ,BOOL); #define <API key> WINELIB_NAME_AW(<API key>) #define <API key> 0 #define <API key> 1 #define <API key> 2 #define <API key> 3 #define <API key> 4 #define <API key> 5 #define <API key> 100 #define <API key> 101 #define <API key> <API key> #define <API key> 0 #define <API key> 1 INTERNETAPI DWORD WINAPI <API key>(DWORD,DWORD,DWORD,LPCWSTR); INTERNETAPI DWORD WINAPI <API key>(DWORD,DWORD,LPDWORD,LPWSTR,LPDWORD); #define INTERNET_ERROR_BASE 12000 #define <API key> (INTERNET_ERROR_BASE + 1) #define <API key> (INTERNET_ERROR_BASE + 2) #define <API key> (INTERNET_ERROR_BASE + 3) #define <API key> (INTERNET_ERROR_BASE + 4) #define <API key> (INTERNET_ERROR_BASE + 5) #define <API key> (INTERNET_ERROR_BASE + 6) #define <API key> (INTERNET_ERROR_BASE + 7) #define <API key> (INTERNET_ERROR_BASE + 8) #define <API key> (INTERNET_ERROR_BASE + 9) #define <API key> (INTERNET_ERROR_BASE + 10) #define <API key> (INTERNET_ERROR_BASE + 11) #define <API key> (INTERNET_ERROR_BASE + 12) #define <API key> (INTERNET_ERROR_BASE + 13) #define <API key> (INTERNET_ERROR_BASE + 14) #define <API key> (INTERNET_ERROR_BASE + 15) #define <API key> (INTERNET_ERROR_BASE + 16) #define <API key> (INTERNET_ERROR_BASE + 17) #define <API key> (INTERNET_ERROR_BASE + 18) #define <API key> (INTERNET_ERROR_BASE + 19) #define <API key> (INTERNET_ERROR_BASE + 20) #define <API key> (INTERNET_ERROR_BASE + 21) #define <API key> (INTERNET_ERROR_BASE + 22) #define <API key> (INTERNET_ERROR_BASE + 23) #define <API key> (INTERNET_ERROR_BASE + 24) #define <API key> (INTERNET_ERROR_BASE + 25) #define <API key> (INTERNET_ERROR_BASE + 26) #define <API key> (INTERNET_ERROR_BASE + 27) #define <API key> (INTERNET_ERROR_BASE + 28) #define <API key> (INTERNET_ERROR_BASE + 29) #define <API key> (INTERNET_ERROR_BASE + 30) #define <API key> (INTERNET_ERROR_BASE + 31) #define <API key> (INTERNET_ERROR_BASE + 32) #define <API key> (INTERNET_ERROR_BASE + 33) #define <API key> (INTERNET_ERROR_BASE + 34) #define <API key> (INTERNET_ERROR_BASE + 36) #define <API key> (INTERNET_ERROR_BASE + 37) #define <API key> (INTERNET_ERROR_BASE + 38) #define <API key> (INTERNET_ERROR_BASE + 39) #define <API key> (INTERNET_ERROR_BASE + 40) #define <API key> (INTERNET_ERROR_BASE + 41) #define <API key> (INTERNET_ERROR_BASE + 42) #define <API key> (INTERNET_ERROR_BASE + 43) #define <API key> (INTERNET_ERROR_BASE + 44) #define <API key> (INTERNET_ERROR_BASE + 45) #define <API key> (INTERNET_ERROR_BASE + 46) #define <API key> (INTERNET_ERROR_BASE + 47) #define <API key> (INTERNET_ERROR_BASE + 48) #define <API key> (INTERNET_ERROR_BASE + 49) #define <API key> (INTERNET_ERROR_BASE + 50) #define <API key> (INTERNET_ERROR_BASE + 52) #define <API key> (INTERNET_ERROR_BASE + 53) #define <API key> (INTERNET_ERROR_BASE + 54) #define <API key> (INTERNET_ERROR_BASE + 55) #define <API key> (INTERNET_ERROR_BASE + 56) #define <API key> (INTERNET_ERROR_BASE + 57) #define <API key> (INTERNET_ERROR_BASE + 110) #define ERROR_FTP_DROPPED (INTERNET_ERROR_BASE + 111) #define <API key> (INTERNET_ERROR_BASE + 112) #define <API key> (INTERNET_ERROR_BASE + 130) #define <API key> (INTERNET_ERROR_BASE + 131) #define <API key> (INTERNET_ERROR_BASE + 132) #define <API key> (INTERNET_ERROR_BASE + 133) #define <API key> (INTERNET_ERROR_BASE + 134) #define <API key> (INTERNET_ERROR_BASE + 135) #define <API key> (INTERNET_ERROR_BASE + 136) #define <API key> (INTERNET_ERROR_BASE + 137) #define <API key> (INTERNET_ERROR_BASE + 138) #define <API key> (INTERNET_ERROR_BASE + 150) #define <API key> (INTERNET_ERROR_BASE + 151) #define <API key> (INTERNET_ERROR_BASE + 152) #define <API key> (INTERNET_ERROR_BASE + 153) #define <API key> (INTERNET_ERROR_BASE + 154) #define <API key> (INTERNET_ERROR_BASE + 155) #define <API key> (INTERNET_ERROR_BASE + 156) #define <API key> (INTERNET_ERROR_BASE + 160) #define <API key> (INTERNET_ERROR_BASE + 161) #define <API key> (INTERNET_ERROR_BASE + 162) #define <API key> (INTERNET_ERROR_BASE + 168) #define <API key> (INTERNET_ERROR_BASE + 157) #define <API key> (INTERNET_ERROR_BASE + 158) #define <API key> (INTERNET_ERROR_BASE + 159) #define <API key> (INTERNET_ERROR_BASE + 163) #define <API key> (INTERNET_ERROR_BASE + 164) #define <API key> (INTERNET_ERROR_BASE + 165) #define <API key> (INTERNET_ERROR_BASE + 166) #define <API key> (INTERNET_ERROR_BASE + 167) #define <API key> (INTERNET_ERROR_BASE + 169) #define <API key> (INTERNET_ERROR_BASE + 170) #define <API key> (INTERNET_ERROR_BASE + 171) #define <API key> (INTERNET_ERROR_BASE + 172) #define <API key> (INTERNET_ERROR_BASE + 173) #define <API key> (INTERNET_ERROR_BASE + 174) #define <API key> (INTERNET_ERROR_BASE + 175) #define INTERNET_ERROR_LAST <API key> #define NORMAL_CACHE_ENTRY 0x00000001 #define STICKY_CACHE_ENTRY 0x00000004 #define EDITED_CACHE_ENTRY 0x00000008 #define COOKIE_CACHE_ENTRY 0x00100000 #define <API key> 0x00200000 #define <API key> 0x00000010 #define <API key> 0x00000020 #define SPARSE_CACHE_ENTRY 0x00010000 #define <API key> NORMAL_CACHE_ENTRY \ | COOKIE_CACHE_ENTRY \ | <API key> \ | <API key> \ | <API key> \ | STICKY_CACHE_ENTRY typedef struct <API key> { DWORD dwStructSize; LPSTR lpszSourceUrlName; LPSTR lpszLocalFileName; DWORD CacheEntryType; DWORD dwUseCount; DWORD dwHitRate; DWORD dwSizeLow; DWORD dwSizeHigh; FILETIME LastModifiedTime; FILETIME ExpireTime; FILETIME LastAccessTime; FILETIME LastSyncTime; LPBYTE lpHeaderInfo; DWORD dwHeaderInfoSize; LPSTR lpszFileExtension; union { DWORD dwReserved; DWORD dwExemptDelta; } DUMMYUNIONNAME; } <API key>,* <API key>; typedef struct <API key> { DWORD dwStructSize; LPWSTR lpszSourceUrlName; LPWSTR lpszLocalFileName; DWORD CacheEntryType; DWORD dwUseCount; DWORD dwHitRate; DWORD dwSizeLow; DWORD dwSizeHigh; FILETIME LastModifiedTime; FILETIME ExpireTime; FILETIME LastAccessTime; FILETIME LastSyncTime; LPBYTE lpHeaderInfo; DWORD dwHeaderInfoSize; LPWSTR lpszFileExtension; union { DWORD dwReserved; DWORD dwExemptDelta; } DUMMYUNIONNAME; } <API key>,* <API key>; <API key>(<API key>) <API key>(<API key>) typedef struct <API key> { FILETIME ftExpires; FILETIME ftLastModified; } <API key>, *<API key>; BOOLAPI <API key>(LPCSTR ,DWORD ,LPCSTR ,LPSTR ,DWORD); BOOLAPI <API key>(LPCWSTR ,DWORD ,LPCWSTR ,LPWSTR ,DWORD); #define CreateUrlCacheEntry WINELIB_NAME_AW(CreateUrlCacheEntry) BOOLAPI <API key>(LPCSTR,LPCSTR,FILETIME,FILETIME,DWORD,LPBYTE,DWORD,LPCSTR,LPCSTR); BOOLAPI <API key>(LPCWSTR,LPCWSTR,FILETIME,FILETIME,DWORD,LPWSTR,DWORD,LPCWSTR,LPCWSTR); #define CommitUrlCacheEntry WINELIB_NAME_AW(CommitUrlCacheEntry) BOOLAPI <API key>(HINTERNET, DWORD); BOOLAPI <API key>(LPCSTR ,<API key> ,LPDWORD ,DWORD); BOOLAPI <API key>(LPCWSTR ,<API key> ,LPDWORD ,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI <API key>(LPCSTR ,DWORD); BOOLAPI <API key>(LPCWSTR ,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) INTERNETAPI HANDLE WINAPI <API key>(LPCSTR , <API key> , LPDWORD ,BOOL ,DWORD); INTERNETAPI HANDLE WINAPI <API key>(LPCWSTR ,<API key> , LPDWORD ,BOOL ,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI <API key>( HANDLE ,DWORD ,LPVOID ,LPDWORD ,DWORD ); BOOLAPI <API key>( HANDLE ,DWORD ); BOOLAPI <API key>(LPCSTR ,<API key> ,LPDWORD); BOOLAPI <API key>(LPCWSTR ,<API key> ,LPDWORD); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI <API key>( LPCSTR ,<API key> ,LPDWORD ,LPSTR ,LPDWORD ,LPVOID ,DWORD); BOOLAPI <API key>( LPCWSTR ,<API key> ,LPDWORD ,LPWSTR ,LPDWORD ,LPVOID ,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) #define <API key> 0x00000004 #define <API key> 0x00000010 #define <API key> 0x00000040 #define <API key> 0x00000080 #define <API key> 0x00000100 #define <API key> 0x00000200 #define <API key> 0x00000400 #define <API key> 0x00000800 BOOLAPI <API key>(LPCSTR ,<API key> ,DWORD); BOOLAPI <API key>(LPCWSTR ,<API key> ,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) typedef LONGLONG GROUPID; INTERNETAPI GROUPID WINAPI CreateUrlCacheGroup(DWORD,LPVOID); BOOLAPI DeleteUrlCacheGroup(GROUPID ,DWORD ,LPVOID); INTERNETAPI HANDLE WINAPI <API key>(DWORD,DWORD,LPVOID,DWORD,GROUPID*,LPVOID); BOOLAPI <API key>(HANDLE,GROUPID*,LPVOID); BOOLAPI <API key>(GROUPID,DWORD,DWORD,<API key>,LPDWORD,LPVOID); BOOLAPI <API key>(GROUPID,DWORD,DWORD,<API key>,LPDWORD,LPVOID); #define <API key> WINELIB_NAME_AW(<API key>) #define <API key> 0 #define <API key> 1 BOOLAPI <API key>(LPCSTR,DWORD,GROUPID,LPBYTE,DWORD,LPVOID); BOOLAPI <API key>(LPCWSTR,DWORD,GROUPID,LPBYTE,DWORD,LPVOID); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI <API key>(GROUPID,DWORD,DWORD,<API key>,LPVOID); BOOLAPI <API key>(GROUPID,DWORD,DWORD,<API key>,LPVOID); #define <API key> WINELIB_NAME_AW(<API key>) INTERNETAPI HANDLE WINAPI <API key>( LPCSTR ,DWORD ,DWORD ,GROUPID ,<API key> ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID ); INTERNETAPI HANDLE WINAPI <API key>( LPCWSTR ,DWORD ,DWORD ,GROUPID ,<API key> ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID ); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI <API key>(HANDLE ,<API key> ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID); BOOLAPI <API key>(HANDLE ,<API key> ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID); #define <API key> WINELIB_NAME_AW(<API key>) INTERNETAPI HANDLE WINAPI <API key>(LPCSTR ,<API key> ,LPDWORD); INTERNETAPI HANDLE WINAPI <API key>(LPCWSTR ,<API key> ,LPDWORD); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI <API key>(HANDLE ,<API key> ,LPDWORD); BOOLAPI <API key>(HANDLE ,<API key> ,LPDWORD); #define <API key> WINELIB_NAME_AW(<API key>) BOOLAPI FindCloseUrlCache(HANDLE); BOOLAPI <API key>(LPCSTR); BOOLAPI <API key>(LPCWSTR); #define DeleteUrlCacheEntry WINELIB_NAME_AW(DeleteUrlCacheEntry) /* FCS_ flags and FreeUrlCacheSpace are no longer documented */ #define <API key> 0 /* guessed value */ #define <API key> 1 /* guessed value */ #define FCS_ABSOLUTE_SIZE 2 /* guessed value */ BOOLAPI FreeUrlCacheSpaceA(LPCSTR ,DWORD ,DWORD); BOOLAPI FreeUrlCacheSpaceW(LPCWSTR ,DWORD ,DWORD); #define FreeUrlCacheSpace WINELIB_NAME_AW(FreeUrlCacheSpace) INTERNETAPI DWORD WINAPI InternetDialA(HWND ,LPSTR ,DWORD ,DWORD_PTR* ,DWORD); INTERNETAPI DWORD WINAPI InternetDialW(HWND ,LPWSTR ,DWORD ,DWORD_PTR* ,DWORD); #define InternetDial WINELIB_NAME_AW(InternetDial) #define <API key> 0x8000 INTERNETAPI DWORD WINAPI InternetHangUp(DWORD_PTR ,DWORD); BOOLAPI CreateMD5SSOHash(PWSTR,PWSTR,PWSTR,PBYTE); #define <API key> 0x00000001 #define <API key> 0x00000001 INTERNETAPI BOOL WINAPI InternetGoOnlineA(LPSTR ,HWND ,DWORD); INTERNETAPI BOOL WINAPI InternetGoOnlineW(LPWSTR ,HWND ,DWORD); #define InternetGoOnline WINELIB_NAME_AW(InternetGoOnline) INTERNETAPI BOOL WINAPI InternetAutodial(DWORD,HWND); #define <API key> 1 #define <API key> 2 #define <API key> 4 #define <API key> (<API key> | <API key> | <API key>) INTERNETAPI BOOL WINAPI <API key>(DWORD); INTERNETAPI BOOL WINAPI <API key>(LPDWORD ,DWORD); #define <API key> 1 #define <API key> 2 #define <API key> 4 #define <API key> 8 typedef DWORD (CALLBACK *PFN_DIAL_HANDLER) (HWND,LPCSTR,DWORD,LPDWORD); #define <API key> 0 #define <API key> 1 #define <API key> 2 #define <API key> 4 #define <API key> 1 #define <API key> 2 #define <API key> 4 INTERNETAPI BOOL WINAPI <API key>(LPCSTR ,DWORD ,DWORD); INTERNETAPI BOOL WINAPI <API key>(LPCWSTR ,DWORD ,DWORD); #define <API key> WINELIB_NAME_AW(<API key>) #define <API key> 1 BOOL WINAPI <API key>(LPDWORD, LPSTR, DWORD, DWORD); BOOL WINAPI <API key>(LPDWORD, LPWSTR, DWORD, DWORD); #define <API key> WINELIB_NAME_AW(<API key>) BOOL WINAPI <API key>(DWORD); BOOL WINAPI DetectAutoProxyUrl(LPSTR, DWORD, DWORD); #ifdef __cplusplus } #endif #endif
#include <linux/module.h> #include <linux/version.h> #include <linux/interrupt.h> #include <linux/platform_device.h> #include <linux/delay.h> #include <linux/pm.h> #include <linux/dpm.h> #include <asm/irq.h> #include <asm/io.h> #include <asm/mach/irq.h> #include <asm/arch/pxa-regs.h> #include <asm/arch/pxa-pm_ll.h> #include <asm/arch/hx4700-gpio.h> #include <asm/arch/hx4700-asic.h> #include <asm/arch/hx4700-core.h> #include <linux/mfd/asic3_base.h> #include <asm/hardware/ipaq-asic3.h> #define EGPIO_OFFSET 0 #define EGPIO_BASE (PXA_CS5_PHYS+EGPIO_OFFSET) volatile u_int16_t *egpios; u_int16_t egpio_reg; static int htc_bootloader = 0; /* Is the stock HTC bootloader installed? */ static u32 save[4]; static u32 save2[13]; /* * may make sense to put egpios elsewhere, but they're here now * since they share some of the same address space with the TI WLAN * * EGPIO register is write-only */ void hx4700_egpio_enable( u_int16_t bits ) { unsigned long flags; local_irq_save(flags); egpio_reg |= bits; *egpios = egpio_reg; local_irq_restore(flags); } EXPORT_SYMBOL(hx4700_egpio_enable); void <API key>( u_int16_t bits ) { unsigned long flags; local_irq_save(flags); egpio_reg &= ~bits; *egpios = egpio_reg; local_irq_restore(flags); } EXPORT_SYMBOL(<API key>); #ifdef CONFIG_PM static int hx4700_suspend(struct platform_device *pdev, pm_message_t state) { /* Turn off external clocks here, because hx4700_power and asic3_mmc * scared to do so to not hurt each other. (-5 mA) */ #if 0 <API key>(&hx4700_asic3.dev, CLOCK_CDEX_EX0 | CLOCK_CDEX_EX1, 0 | 0); #endif /* 0x20c2 is HTC clock value * CLOCK_CDEX_SOURCE 2 * CLOCK_CDEX_SPI 0 * CLOCK_CDEX_OWM 0 * * CLOCK_CDEX_PWM0 0 * CLOCK_CDEX_PWM1 0 * CLOCK_CDEX_LED0 1 * CLOCK_CDEX_LED1 1 * * CLOCK_CDEX_LED2 0 * CLOCK_CDEX_SD_HOST 0 * CLOCK_CDEX_SD_BUS 0 * CLOCK_CDEX_SMBUS 0 * * <API key> 0 * CLOCK_CDEX_EX0 1 * CLOCK_CDEX_EX1 0 * */ <API key>(&hx4700_asic3.dev, 0xffff, 0x21c2); *egpios = 0; /* turn off all egpio power */ /* * Note that WEP1 wake up event is used by bootldr to set the * LEDS when power is applied/removed for charging. */ PWER = PWER_RTC | PWER_GPIO0 | PWER_GPIO1 | PWER_GPIO12 | PWER_WEP1; // rtc + power + reset + asic3 + wep1 PFER = PWER_GPIO1; // Falling Edge Detect PRER = PWER_GPIO0 | PWER_GPIO12; // Rising Edge Detect PGSR0 = 0x080DC01C; PGSR1 = 0x34CF0002; PGSR2 = 0x0123C18C; /* PGSR3 = 0x00104202; */ PGSR3 = 0x00100202; /* These next checks are specifically for charging. We want to enable * it if it is already enabled */ /* Check for charge enable, GPIO 72 */ if(GPLR2 & (1 << 8)) { /* Set it */ PGSR2 |= (1U << 8); } else { /* Clear it */ PGSR2 &= ~(1U << 8); } /* Check for USB_CHARGE_RATE, GPIO 96 */ if(GPLR3 & (1 << 0)) { /* Set it */ PGSR3 |= (1U << 0); } else { /* Clear it */ PGSR3 &= ~(1U << 0); } PCFR = PCFR_GPROD|PCFR_DC_EN|PCFR_GPR_EN|PCFR_OPDE |PCFR_FP|PCFR_PI2CEN; /* was 0x1091; */ /* The 2<<2 below turns on the Power Island state preservation * and counters. This allows us to wake up bootldr after a * period of time, and it can set the LEDs correctly based on * the power state. The bootldr turns it off when it's * charged. */ PSLR=0xc8000000 | (2 << 2); /* * If we're using bootldr and not the stock HTC bootloader, * we want to wake up periodically to see if the charge is full while * it is suspended. We do this with the OS timer 4 in the pxa270. */ if (!htc_bootloader) { OMCR4 = 0x4b; /* Periodic, self-resetting, 1-second timer */ OSMR4 = 5; /* Wake up bootldr after x seconds so it can figure out what to do with the LEDs. */ OIER |= 0x10; /* Enable interrupt source for Timer 4 */ OSCR4 = 0; /* This starts the timer */ } <API key>(&hx4700_asic3.dev, ASIC3_EXTCF_OWM_EN, 0); return 0; } static int hx4700_resume(struct platform_device *pdev) { hx4700_egpio_enable(0); return 0; } #else # define hx4700_suspend NULL # define hx4700_resume NULL #endif static void <API key>(unsigned long resume_addr) { int i; u32 csum, tmp, *p; /* Save the 13 words at 0xa0038000. */ for (p = phys_to_virt(0xa0038000), i = 0; i < 13; i++) save2[i] = p[i]; /* Save the first four words at 0xa0000000. */ for (p = phys_to_virt(0xa0000000), i = 0; i < 4; i++) save[i] = p[i]; /* Set the first four words at 0xa0000000 to: * resume address; MMU control; TLB base addr; domain id */ p[0] = resume_addr; asm( "mrc\tp15, 0, %0, c1, c0, 0" : "=r" (tmp) ); p[1] = tmp & ~(0x3987); /* mmu off */ asm( "mrc\tp15, 0, %0, c2, c0, 0" : "=r" (tmp) ); p[2] = tmp; /* Shouldn't matter, since MMU will be off. */ asm( "mrc\tp15, 0, %0, c3, c0, 0" : "=r" (tmp) ); p[3] = tmp; /* Shouldn't matter, since MMU will be off. */ /* Set PSPR to the checksum the HTC bootloader wants to see. */ for (csum = 0, i = 0; i < 52; i++) { tmp = p[i] & 0x1; tmp = tmp << 31; tmp |= tmp >> 1; csum += tmp; } PSPR = csum; } static void <API key>(void) { int i; u32 *p; /* Restore the first four words at 0xa0000000. */ for (p = phys_to_virt(0xa0000000), i = 0; i < 4; i++) p[i] = save[i]; /* Restore the 13 words at 0xa0038000. */ for (p = phys_to_virt(0xa0038000), i = 0; i < 13; i++) p[i] = save2[i]; /* XXX Do we need to flush the cache? */ } struct pxa_ll_pm_ops hx4700_ll_pm_ops = { .suspend = <API key>, .resume = <API key>, }; /* automatic backlight brightness control */ static ssize_t <API key>(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", GET_HX4700_GPIO(AUTO_SENSE) ? 1 : 0); } static ssize_t <API key>(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int auto_brightness = simple_strtoul(buf, NULL, 10) ? 1 : 0; SET_HX4700_GPIO(AUTO_SENSE, auto_brightness); return count; } static DEVICE_ATTR(auto_brightness, 0644, <API key>, <API key>); static int hx4700_core_probe( struct platform_device *pdev ) { u32 *bootldr; int i; int ret = 0; printk( KERN_NOTICE "hx4700 Core Hardware Driver\n" ); egpios = (volatile u_int16_t *)ioremap_nocache( EGPIO_BASE, sizeof *egpios ); if (!egpios) return -ENODEV; /* Is the stock HTC bootloader installed? */ bootldr = (u32 *) ioremap(PXA_CS0_PHYS, 1024 * 1024); /* Windows Mobile 2003 Second Edition v. 4.21.1088 Build 15045.2.6.0 * ROM date 4/13/05, rev 1.10.08 ENG, bootloader 1.01, * XIP v4.21.15045.0 */ i = 0x000414dc / 4; if (bootldr[i] == 0xe59f1360 && /* ldr r1, [pc, #864] ; power base */ bootldr[i+1] == 0xe5914008 && /* ldr r4, [r1, #8] ; PSPR */ bootldr[i+2] == 0xe1320004) { /* teq r2, r4 */ printk("Stock HTC WM2003 bootloader detected\n"); htc_bootloader = 1; pxa_pm_set_ll_ops(&hx4700_ll_pm_ops); } /* XXX Which version of WM2005 is this? */ i = 0x00041d68 / 4; if (bootldr[i] == 0xe59f1354 && /* ldr r1, [pc, #852] ; power base */ bootldr[i+1] == 0xe5914008 && /* ldr r4, [r1, #8] ; PSPR */ bootldr[i+2] == 0xe1320004) { /* teq r2, r4 */ printk("Stock HTC WM2005 bootloader detected\n"); htc_bootloader = 1; pxa_pm_set_ll_ops(&hx4700_ll_pm_ops); } /* WM 5.0 OS 5.1.70 Build 14406.1.1.1 */ i = 0x00041340 / 4; if (bootldr[i] == 0xe59f1354 && /* ldr r1, [pc, #852] ; power base */ bootldr[i+1] == 0xe5914008 && /* ldr r4, [r1, #8] ; PSPR */ bootldr[i+2] == 0xe1320004) { /* teq r2, r4 */ printk("Stock HTC WM2005 bootloader detected\n"); htc_bootloader = 1; pxa_pm_set_ll_ops(&hx4700_ll_pm_ops); } iounmap(bootldr); ret = device_create_file(&pdev->dev, &<API key>); if (ret) iounmap(egpios); return ret; } static int hx4700_core_remove( struct platform_device *pdev ) { struct hx4700_core_funcs *funcs = pdev->dev.platform_data; device_remove_file(&pdev->dev, &<API key>); if (egpios != NULL) iounmap( (void *)egpios ); funcs->udc_detect = NULL; return 0; } static struct platform_driver hx4700_core_driver = { .driver = { .name = "hx4700-core", }, .probe = hx4700_core_probe, .remove = hx4700_core_remove, .suspend = hx4700_suspend, .resume = hx4700_resume, }; static int __init hx4700_core_init( void ) { return <API key>( &hx4700_core_driver ); } static void __exit hx4700_core_exit( void ) { <API key>( &hx4700_core_driver ); } module_init( hx4700_core_init ); module_exit( hx4700_core_exit ); MODULE_AUTHOR("Todd Blumer, SDG Systems, LLC"); MODULE_DESCRIPTION("hx4700 Core Hardware Driver"); MODULE_LICENSE("GPL"); /* vim600: set noexpandtab sw=8 ts=8 :*/
<!DOCTYPE html PUBLIC "- <html xmlns="http: <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.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>CoreGTKGen: CGTKRevealer Class Reference</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="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.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 id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">CoreGTKGen &#160;<span id="projectnumber">3.22.0</span> </div> <div id="projectbrief">CoreGTKGen is a utility that generates Objective-C language bindings for CoreGTK using GObject Introspection</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="<API key>"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Instance Methods</a> &#124; <a href="<API key>.html">List of all members</a> </div> <div class="headertitle"> <div class="title">CGTKRevealer Class Reference</div> </div> </div><!--header <div class="contents"> <div class="dynheader"> Inheritance diagram for CGTKRevealer:</div> <div class="dyncontent"> <div class="center"> <img src="<API key>.png" usemap="#CGTKRevealer_map" alt=""/> <map id="CGTKRevealer_map" name="CGTKRevealer_map"> <area href="interfaceCGTKBin.html" alt="CGTKBin" shape="rect" coords="55,224,155,248"/> <area href="<API key>.html" alt="CGTKContainer" shape="rect" coords="55,168,155,192"/> <area href="interfaceCGTKWidget.html" alt="CGTKWidget" shape="rect" coords="55,112,155,136"/> <area href="interfaceCGTKBase.html" alt="CGTKBase" shape="rect" coords="55,56,155,80"/> </map> </div></div> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Instance Methods</h2></td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">(id)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">init</a></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">(GtkRevealer *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">REVEALER</a></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">getChildRevealed</a></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">getRevealChild</a></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">(guint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">(<API key>)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">getTransitionType</a></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">setRevealChild:</a></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>"><API key>:</a></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">setTransitionType:</a></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header <API key>"><td colspan="2" onclick="javascript:toggleInherit('<API key>')"><img src="closed.png" alt="-"/>&#160;Instance Methods inherited from <a class="el" href="interfaceCGTKBin.html">CGTKBin</a></td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkBin *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBin.html#<API key>">BIN</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBin.html#<API key>">getChild</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header <API key>"><td colspan="2" onclick="javascript:toggleInherit('<API key>')"><img src="closed.png" alt="-"/>&#160;Instance Methods inherited from <a class="el" href="<API key>.html">CGTKContainer</a></td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkContainer *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">CONTAINER</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a> (void)&#160;</td><td class="memItemRight" valign="bottom">- <b>addWidget:withProperties:</b></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">add:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">checkResize</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>"><API key>:andPropertyName:andValue:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>"><API key>:<API key>:andVarArgs:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>"><API key>:andChildProperty:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>"><API key>:andPspec:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>"><API key>:andPropertyName:andValue:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>"><API key>:<API key>:andVarArgs:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GType)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">childType</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">forallWithCallback:andCallbackData:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">foreachWithCallback:andCallbackData:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(guint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">getBorderWidth</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GList *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">getChildren</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">getFocusChain:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">getFocusChild</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkAdjustment *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">getFocusHadjustment</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkAdjustment *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">getFocusVadjustment</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkWidgetPath *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">getPathForChild:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkResizeMode)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">getResizeMode</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>"><API key>:andCr:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">remove:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">resizeChildren</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">setBorderWidth:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">setFocusChain:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">setFocusChild:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">setFocusHadjustment:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">setFocusVadjustment:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>"><API key>:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">setResizeMode:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="<API key>.html#<API key>">unsetFocusChain</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header <API key>"><td colspan="2" onclick="javascript:toggleInherit('<API key>')"><img src="closed.png" alt="-"/>&#160;Instance Methods inherited from <a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a></td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkWidget *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">WIDGET</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">activate</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andAccelGroup:andAccelKey:andAccelMods:andAccelFlags:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andEvents:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">addEvents:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">addMnemonicLabel:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(guint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andUserData:andNotify:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">canActivateAccel:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">childFocus:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">childNotify:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andPath:andPathReversed:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">computeExpand:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(PangoContext *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">createPangoContext</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(PangoLayout *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">createPangoLayout:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">destroy</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">destroyed:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">deviceIsShadowed:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkDragContext *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andActions:andButton:andEvent:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkDragContext *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andActions:andButton:andEvent:andX:andY:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andStartY:andCurrentX:andCurrentY:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkAtom)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andTargetList:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkTargetList *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andTargets:andNtargets:andActions:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andProtocol:andUseCoordinates:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">gtkDragDestUnset</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andTarget:andTime:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">gtkDragHighlight</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkTargetList *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andTargets:andNtargets:andActions:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">gtkDragSourceUnset</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">gtkDragUnhighlight</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">draw:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">ensureStyle</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">errorBell</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">event:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">freezeChildNotify</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(AtkObject *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getAccessible</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GActionGroup *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getActionGroup:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(int)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(int)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getAllocatedHeight</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andBaseline:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(int)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getAllocatedWidth</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getAllocation:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getAncestor:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getAppPaintable</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getCanDefault</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getCanFocus</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getChildRequisition:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getChildVisible</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getClip:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkClipboard *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getClipboard:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(NSString *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getCompositeName</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getDeviceEnabled:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkEventMask)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getDeviceEvents:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkTextDirection)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getDirection</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkDisplay *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getDisplay</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getDoubleBuffered</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getEvents</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getFocusOnClick</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(PangoFontMap *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getFontMap</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(const <API key> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getFontOptions</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkFrameClock *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getFrameClock</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkAlign)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getHalign</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getHasTooltip</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getHasWindow</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getHexpand</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getHexpandSet</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getMapped</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getMarginBottom</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getMarginEnd</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getMarginLeft</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getMarginRight</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getMarginStart</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getMarginTop</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkModifierType)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getModifierMask:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkRcStyle *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getModifierStyle</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(NSString *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getName</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getNoShowAll</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(double)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getOpacity</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(PangoContext *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getPangoContext</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getParent</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkWindow *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getParentWindow</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkWidgetPath *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getPath</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getPointerWithX:andY:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andNaturalHeight:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andMinimumHeight:andNaturalHeight:andMinimumBaseline:andNaturalBaseline:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andMinimumHeight:andNaturalHeight:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andNaturalSize:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andNaturalWidth:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andMinimumWidth:andNaturalWidth:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getRealized</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getReceivesDefault</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkSizeRequestMode)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getRequestMode</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getRequisition:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkWindow *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getRootWindow</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getScaleFactor</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkScreen *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getScreen</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getSensitive</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkSettings *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getSettings</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andHeight:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkStateType)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getState</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkStateFlags)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getStateFlags</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkStyle *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getStyle</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkStyleContext *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getStyleContext</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GObject *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andName:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(NSString *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getTooltipMarkup</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(NSString *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getTooltipText</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkWindow *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getTooltipWindow</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getToplevel</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkAlign)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getValign</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkAlign)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key></a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getVexpand</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getVexpandSet</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getVisible</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkVisual *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getVisual</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkWindow *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">getWindow</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">gtkGrabAdd</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">grabDefault</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">grabFocus</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">gtkGrabRemove</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">hasDefault</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">hasFocus</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">hasGrab</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">hasRcStyle</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">hasScreen</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">hasVisibleFocus</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">hide</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">hideOnDelete</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">inDestruction</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">initTemplate</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andGroup:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">intersectWithArea:andIntersection:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">isAncestor:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">isComposited</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">isDrawable</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">isFocus</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">isSensitive</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">isToplevel</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">isVisible</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">keynavFailed:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GList *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">listAccelClosures</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(const gchar **)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">listActionPrefixes</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GList *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">listMnemonicLabels</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">map</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">mnemonicActivate:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">modifyBaseWithState:andColor:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">modifyBgWithState:andColor:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andSecondary:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">modifyFgWithState:andColor:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">modifyFont:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">modifyStyle:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">modifyTextWithState:andColor:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andColor:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andColor:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andSecondaryCursor:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">overrideFont:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andColor:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">pathWithPathLength:andPath:andPathReversed:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">queueAllocate</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">queueComputeExpand</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">queueDraw</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">queueDrawAreaWithX:andY:andWidth:andHeight:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">queueDrawRegion:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">queueResize</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">queueResizeNoRedraw</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">realize</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(cairo_region_t *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">regionIntersect:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">registerWindow:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andAccelKey:andAccelMods:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">removeMnemonicLabel:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">removeTickCallback:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkPixbuf *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andSize:andDetail:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GdkPixbuf *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andSize:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">reparent:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">resetRcStyles</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">resetStyle</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">sendExpose:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">sendFocusChange:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andAccelGroup:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setAllocation:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setAppPaintable:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setCanDefault:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setCanFocus:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setChildVisible:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setClip:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setCompositeName:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andEnabled:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andEvents:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setDirection:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setDoubleBuffered:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setEvents:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setFocusOnClick:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setFontMap:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setFontOptions:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setHalign:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setHasTooltip:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setHasWindow:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setHexpand:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setHexpandSet:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setMapped:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setMarginBottom:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setMarginEnd:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setMarginLeft:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setMarginRight:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setMarginStart:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setMarginTop:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setName:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setNoShowAll:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setOpacity:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setParent:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setParentWindow:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setRealized:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setReceivesDefault:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setRedrawOnAllocate:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setSensitive:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andHeight:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setState:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andClear:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setStyle:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setTooltipMarkup:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setTooltipText:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setTooltipWindow:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setValign:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setVexpand:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setVexpandSet:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setVisible:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setVisual:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">setWindow:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">shapeCombineRegion:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">show</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">showAll</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">showNow</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">sizeAllocate:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andBaseline:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">sizeRequest:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">styleAttach</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andValue:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andVarArgs:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">thawChildNotify</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>"><API key>:andSrcX:andSrcY:andDestX:andDestY:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">triggerTooltipQuery</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">unmap</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">unparent</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">unrealize</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">unregisterWindow:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#<API key>">unsetStateFlags:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header <API key>"><td colspan="2" onclick="javascript:toggleInherit('<API key>')"><img src="closed.png" alt="-"/>&#160;Instance Methods inherited from <a class="el" href="interfaceCGTKBase.html">CGTKBase</a></td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(id)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#<API key>">initWithGObject:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#<API key>">setGObject:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GObject *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#<API key>">GOBJECT</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(id)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#<API key>">initWithGObject:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#<API key>">setGObject:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GObject *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#<API key>">GOBJECT</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a> Additional Inherited Members</h2></td></tr> <tr class="inherit_header <API key>"><td colspan="2" onclick="javascript:toggleInherit('<API key>')"><img src="closed.png" alt="-"/>&#160;Class Methods inherited from <a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a></td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(GtkTextDirection)&#160;</td><td class="memItemRight" valign="bottom">+ <a class="el" href="interfaceCGTKWidget.html#<API key>">getDefaultDirection</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a> (GtkStyle *)&#160;</td><td class="memItemRight" valign="bottom">+ <b>getDefaultStyle</b></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a> (void)&#160;</td><td class="memItemRight" valign="bottom">+ <b>popCompositeChild</b></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a> (void)&#160;</td><td class="memItemRight" valign="bottom">+ <b>pushCompositeChild</b></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a> (void)&#160;</td><td class="memItemRight" valign="bottom">+ <b>setDefaultDirection:</b></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header <API key>"><td colspan="2" onclick="javascript:toggleInherit('<API key>')"><img src="closed.png" alt="-"/>&#160;Class Methods inherited from <a class="el" href="interfaceCGTKBase.html">CGTKBase</a></td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKBase.html">CGTKBase</a> *)&#160;</td><td class="memItemRight" valign="bottom">+ <a class="el" href="interfaceCGTKBase.html#<API key>">withGObject:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKBase.html">CGTKBase</a> *)&#160;</td><td class="memItemRight" valign="bottom">+ <a class="el" href="interfaceCGTKBase.html#<API key>">withGObject:</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header <API key>"><td colspan="2" onclick="javascript:toggleInherit('<API key>')"><img src="closed.png" alt="-"/>&#160;Protected Attributes inherited from <a class="el" href="interfaceCGTKBase.html">CGTKBase</a></td></tr> <tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">GObject *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interfaceCGTKBase.html#<API key>">__gObject</a></td></tr> <tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <h2 class="groupheader">Method Documentation</h2> <a id="<API key>"></a> <h2 class="memtitle"><span class="permalink"><a href="#<API key>">&#9670;&nbsp;</a></span>getChildRevealed()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (BOOL) getChildRevealed </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(BOOL*)getChildRevealed;</p> <dl class="section return"><dt>Returns</dt><dd>BOOL </dd></dl> </div> </div> <a id="<API key>"></a> <h2 class="memtitle"><span class="permalink"><a href="#<API key>">&#9670;&nbsp;</a></span>getRevealChild()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (BOOL) getRevealChild </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(BOOL*)getRevealChild;</p> <dl class="section return"><dt>Returns</dt><dd>BOOL </dd></dl> </div> </div> <a id="<API key>"></a> <h2 class="memtitle"><span class="permalink"><a href="#<API key>">&#9670;&nbsp;</a></span><API key>()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (guint) <API key> </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(guint*)<API key>;</p> <dl class="section return"><dt>Returns</dt><dd>guint </dd></dl> </div> </div> <a id="<API key>"></a> <h2 class="memtitle"><span class="permalink"><a href="#<API key>">&#9670;&nbsp;</a></span>getTransitionType()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (<API key>) getTransitionType </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(<API key>*)getTransitionType;</p> <dl class="section return"><dt>Returns</dt><dd><API key> </dd></dl> </div> </div> <a id="<API key>"></a> <h2 class="memtitle"><span class="permalink"><a href="#<API key>">&#9670;&nbsp;</a></span>init()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (id) init </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Constructors </p> </div> </div> <a id="<API key>"></a> <h2 class="memtitle"><span class="permalink"><a href="#<API key>">&#9670;&nbsp;</a></span>REVEALER()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (GtkRevealer*) REVEALER </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Methods </p> </div> </div> <a id="<API key>"></a> <h2 class="memtitle"><span class="permalink"><a href="#<API key>">&#9670;&nbsp;</a></span>setRevealChild:()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (void) setRevealChild: </td> <td></td> <td class="paramtype">(BOOL)&#160;</td> <td class="paramname"><em>revealChild</em></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(void*)<a class="el" href="<API key>.html#<API key>">setRevealChild:</a> revealChild;</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">revealChild</td><td></td></tr> </table> </dd> </dl> </div> </div> <a id="<API key>"></a> <h2 class="memtitle"><span class="permalink"><a href="#<API key>">&#9670;&nbsp;</a></span><API key>:()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (void) <API key>: </td> <td></td> <td class="paramtype">(guint)&#160;</td> <td class="paramname"><em>duration</em></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(void*)<a class="el" href="<API key>.html#<API key>"><API key>:</a> duration;</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">duration</td><td></td></tr> </table> </dd> </dl> </div> </div> <a id="<API key>"></a> <h2 class="memtitle"><span class="permalink"><a href="#<API key>">&#9670;&nbsp;</a></span>setTransitionType:()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (void) setTransitionType: </td> <td></td> <td class="paramtype">(<API key>)&#160;</td> <td class="paramname"><em>transition</em></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(void*)<a class="el" href="<API key>.html#<API key>">setTransitionType:</a> transition;</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">transition</td><td></td></tr> </table> </dd> </dl> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="<API key>.html">CGTKRevealer.h</a></li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Sat Nov 4 2017 23:23:29 for CoreGTKGen by & <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>
#ifndef __RTW_LED_H_ #define __RTW_LED_H_ #include <drv_conf.h> #include <osdep_service.h> #include <drv_types.h> #define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) #define <API key> 100 #define <API key> 200 #define <API key> 400 #define <API key> 1000 #define <API key> 500 //500 #define <API key> 180 //150 #define <API key> 50 #define <API key> 5000 #define <API key> 100 #define <API key> 2000 #define <API key> 1000 #define <API key> 100 #define <API key> 30 // 060403, rcnjko: Customized for AzWave. #define <API key> 250 #define <API key> 4750 #define <API key> 500 //for QMI #define <API key> 3750 //for QMI // 080124, lanhsin: Customized for RunTop #define <API key> 300 // 060421, rcnjko: Customized for Sercomm Printer Server case. #define <API key> 1500 typedef enum _LED_CTL_MODE{ LED_CTL_POWER_ON = 1, LED_CTL_LINK = 2, LED_CTL_NO_LINK = 3, LED_CTL_TX = 4, LED_CTL_RX = 5, LED_CTL_SITE_SURVEY = 6, LED_CTL_POWER_OFF = 7, <API key> = 8, LED_CTL_START_WPS = 9, LED_CTL_STOP_WPS = 10, <API key> = 11, //added for runtop <API key> = 12, //added for ALPHA <API key> = 13, //added for BELKIN <API key> = 14, }LED_CTL_MODE; typedef enum _LED_STATE_871x{ LED_UNKNOWN = 0, RTW_LED_ON = 1, RTW_LED_OFF = 2, LED_BLINK_NORMAL = 3, LED_BLINK_SLOWLY = 4, LED_BLINK_POWER_ON = 5, LED_BLINK_SCAN = 6, // LED is blinking during scanning period, the # of times to blink is depend on time for scanning. LED_BLINK_NO_LINK = 7, // LED is blinking during no link state. <API key> = 8,// Customzied for Sercomm Printer Server case LED_BLINK_TXRX = 9, LED_BLINK_WPS = 10, // LED is blinkg during WPS communication LED_BLINK_WPS_STOP = 11, //for ALPHA <API key> = 12, //for BELKIN LED_BLINK_RUNTOP = 13, // Customized for RunTop LED_BLINK_CAMEO = 14, LED_BLINK_XAVI = 15, LED_BLINK_ALWAYS_ON = 16, }LED_STATE_871x; typedef enum _LED_PIN_871x{ LED_PIN_NULL = 0, LED_PIN_LED0 = 1, LED_PIN_LED1 = 2, LED_PIN_LED2 = 3, LED_PIN_GPIO0 = 4, }LED_PIN_871x; typedef struct _LED_871x{ struct rtw_adapter *padapter; LED_PIN_871x LedPin; // Identify how to implement this SW led. LED_STATE_871x CurrLedState; // Current LED state. LED_STATE_871x BlinkingLedState; // Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are. u8 bLedOn; // true if LED is ON, false if LED is OFF. u8 bLedBlinkInProgress; // true if it is blinking, false o.w.. u8 <API key>; u32 BlinkTimes; // Number of times to toggle led state for blinking. _timer BlinkTimer; // Timer object for led blinking. u8 bSWLedCtrl; // ALPHA, added by chiyoko, 20090106 u8 <API key>; u8 <API key>; u8 <API key>; u8 <API key>; struct work_struct BlinkWorkItem; // Workitem used by BlinkTimer to manipulate H/W to blink LED. } LED_871x, *PLED_871x; #define IS_LED_WPS_BLINKING(_LED_871x) (((PLED_871x)_LED_871x)->CurrLedState==LED_BLINK_WPS \ || ((PLED_871x)_LED_871x)->CurrLedState==LED_BLINK_WPS_STOP \ || ((PLED_871x)_LED_871x)-><API key>) #define IS_LED_BLINKING(_LED_871x) (((PLED_871x)_LED_871x)-><API key> \ ||((PLED_871x)_LED_871x)-><API key>) // LED customization. typedef enum _LED_STRATEGY_871x{ SW_LED_MODE0 = 0, // SW control 1 LED via GPIO0. It is default option. SW_LED_MODE1= 1, // 2 LEDs, through LED0 and LED1. For ALPHA. SW_LED_MODE2 = 2, // SW control 1 LED via GPIO0, customized for AzWave 8187 minicard. SW_LED_MODE3 = 3, // SW control 1 LED via GPIO0, customized for Sercomm Printer Server case. SW_LED_MODE4 = 4, //for Edimax / Belkin SW_LED_MODE5 = 5, //for Sercomm / Belkin SW_LED_MODE6 = 6, //for 88CU minicard, porting from ce SW_LED_MODE7 HW_LED = 50, // HW control 2 LEDs, LED0 and LED1 (there are 4 different control modes, see MAC.CONFIG1 for details.) LED_ST_NONE = 99, }LED_STRATEGY_871x, *PLED_STRATEGY_871x; void LedControl871x( struct rtw_adapter *padapter, LED_CTL_MODE LedAction ); struct led_priv{ /* add for led controll */ LED_871x SwLed0; LED_871x SwLed1; LED_STRATEGY_871x LedStrategy; u8 bRegUseLed; void (*LedControlHandler)(struct rtw_adapter *padapter, LED_CTL_MODE LedAction); /* add for led controll */ }; #ifdef CONFIG_SW_LED #define rtw_led_control(adapter, LedAction) \ do { \ if((adapter)->ledpriv.LedControlHandler) \ (adapter)->ledpriv.LedControlHandler((adapter), (LedAction)); \ } while(0) #else //CONFIG_SW_LED #define rtw_led_control(adapter, LedAction) #endif //CONFIG_SW_LED void BlinkTimerCallback(void *data); void <API key>(struct work_struct *work); void ResetLedStatus(PLED_871x pLed); void InitLed871x( struct rtw_adapter *padapter, PLED_871x pLed, LED_PIN_871x LedPin ); void DeInitLed871x( PLED_871x pLed ); //hal... extern void BlinkHandler(PLED_871x pLed); #endif //__RTW_LED_H_
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>ONIX Responsive Business &amp; Portfolio Template</title> <!-- Mobile Specific Metas --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <!-- CSS files begin--> <link href='http://fonts.googleapis.com/css?family=Oswald:400,300,700|Open+Sans+Condensed:700,300,300italic|Open+Sans:400,300italic,400italic,600,600italic,700,700italic,800,800italic|PT+Sans:400,400italic,700,700italic' rel='stylesheet' type='text/css'> <link href="assets/css/bootstrap.css" rel="stylesheet"> <link href="assets/css/<API key>.css" rel="stylesheet"> <link href="assets/css/docs.css" rel="stylesheet"> <link href="assets/js/<API key>/prettify.css" rel="stylesheet"> <link href="assets/css/responsiveslides.css" rel="stylesheet"> <link rel="stylesheet" href="assets/css/prettyPhoto.css" type='text/css'> <link rel="stylesheet" href="assets/build/mediaelementplayer.min.css" /> <link rel="stylesheet" type="text/css" media="screen" href="assets/css/slide-in.css" /> <!--[if lt IE 9]><link rel="stylesheet" type="text/css" media="screen" href="assets/css/slide-in.ie.css" /><![endif]--> <link href="assets/css/style.css" rel="stylesheet"> <!-- Color Style Setting CSS file--> <link href="assets/css/color-theme/color-sgrey.css" rel="stylesheet"> <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif] <!-- fav and touch icons --> <link rel="shortcut icon" href="assets/ico/favicon.ico"> <link rel="<API key>" sizes="144x144" href="assets/ico/<API key>.png"> <link rel="<API key>" sizes="114x114" href="assets/ico/<API key>.png"> <link rel="<API key>" sizes="72x72" href="assets/ico/<API key>.png"> <link rel="<API key>" href="assets/ico/<API key>.png"> </head> <body> <!-- Head =============================================== <div class="top-bar"> <div class="container"> <div class="row"> <div class="span6"> <!-- text widget begin here --> <ul class="info-text pull-left"> <li> <a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit Aenean commodo ligula eget.</a> </li> <li> <a href=" This informational text widget - Buy this theme now ! </a> </li> <li> <a href=" Lorem ipsum dolor sit </a> amet, consectetuer adipiscing elit. Aenean commodo ligula eget. </li> </ul> </div> <div class="span6"> <!-- social begin here --> <ul class="socicon right top-w"> <li> <a href="#" class="share-icon"> </a> </li> <li> <a href="#" class="google"> </a> </li> <li> <a href="#" class="facebook"> </a> </li> <li> <a href="#" class="twitter"> </a> </li> <li> <a href="#" class="flickr"> </a> </li> <li> <a href="#" class="dribbble"> </a> </li> <li> <a href="#" class="linkedin"> </a> </li> <li class="last"> <a href="#" class="vimeo"> </a> </li> </ul> <form class="navbar-search pull-right" action=""> <input class="search-query" type="text"> </form> </div> </div> </div> </div> <!-- Logo / Menu =============================================== <header class="header"> <div class="container strip-line"> <div class="row"> <div class="span4"> <a href="index.html" class="logo"> <img src="assets/img/logo.png" alt=""> </a> </div> <div class="span8"> <nav> <ul class="right"> <li> <a href="index.html"> home </a> <ul> <li> <a href="index_2.html"> home two </a> </li> </ul> </li> <li> <a href="about.html"> about </a> </li> <li> <a href="features.html"> features </a> </li> <li class="current"> <a href="portfolio.html"> portfolio </a> <ul> <li> <a href="portfolio-two.html"> portfolio two </a> </li> <li> <a href="portfolio-three.html"> portfolio three </a> </li> <li> <a href="portfolio-single.html"> single portfolio </a> </li> <li> <a href="portfolio-single-2.html"> single portfolio slider </a> </li> <li> <a href="portfolio-single-3.html"> single portfolio video </a> </li> </ul> </li> <li> <a href="blog.html"> blog </a> <ul> <li> <a href="blog_rs.html"> blog right sidebar </a> </li> <li> <a href="single-post.html"> single post </a> <ul> <li> <a href=" example level </a> </li> <li> <a href=" example level </a> </li> </ul> </li> </ul> </li> <li> <a href="contact.html"> contact </a> </li> </ul> </nav> </div> </div> </div> </header> <div class="slider-cont"> <div class="container"> <header id="pagehead"> <h1>Portfolio <small>&nbsp; &frasl; &nbsp;&nbsp;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. </small></h1> </header> </div> </div> <div class="container"> <!-- Portfolio filter =============================================== <section> <div class="row"> <ul id="portfolio-filter" class="span12"> <li> <a href="javascript:void(0)" title="" class="currents">All</a> </li> <li> <a href="javascript:void(0)" title="">Web</a> </li> <li> <a href="javascript:void(0)" title="">Video</a> </li> <li> <a href="javascript:void(0)" title="">Audio</a> </li> </ul> </div> <!-- Portfolio item =============================================== <ul class="thumbnails portfolio" id="<API key>"> <li class="span3 item-block web all"> <a href="assets/img/<API key>.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href="portfolio-single.html"> <img src="assets/img/example-sites/example1.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single-2.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block video all"> <iframe src="http://player.vimeo.com/video/28220269?title=0&amp;byline=0&amp;portrait=0" width="270" height="130" frameborder="0" <API key> mozallowfullscreen allowFullScreen></iframe> <div class="desc"> <a href="portfolio-single-3.html">Vimeo Video </a> <p> <em>Portfolio Item Vimeo</em> </p> </div> </li> <li class="span3 item-block web all"> <a href="assets/img/<API key>.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href=" <img src="assets/img/example-sites/example1.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block"> <a href="assets/img/<API key>.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href=" <img src="assets/img/example-sites/example2.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single-2.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block audio all"> <audio src="assets/media/<API key>.mp3" type="audio/mp3" controls="controls"></audio> <div class="desc"> <a href="portfolio-single.html">Local Audio </a> <p> <em>Portfolio Item Audio</em> </p> </div> </li> <li class="span3 item-block"> <a href="assets/img/<API key>.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href=" <img src="assets/img/example-sites/example2.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block"> <a href="assets/img/<API key>.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href=" <img src="assets/img/example-sites/example1.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block video all"> <div class="row"> <div class="span3"> <video src="assets/media/VH_videoAsset.flv" type="video/flv" controls="controls"></video> </div> </div> <div class="desc"> <a href="portfolio-single-3.html"> Local Video </a> <p> <em>Portfolio Item Local Video</em> </p> </div> </li> <li class="span3 item-block web all"> <a href="assets/img/<API key>.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href="portfolio-single.html"> <img src="assets/img/example-sites/example1.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single-2.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block video all"> <iframe src="http://player.vimeo.com/video/28220269?title=0&amp;byline=0&amp;portrait=0" width="270" height="130" frameborder="0" <API key> mozallowfullscreen allowFullScreen></iframe> <div class="desc"> <a href="portfolio-single-3.html">Vimeo Video </a> <p> <em>Portfolio Item Vimeo</em> </p> </div> </li> <li class="span3 item-block web all"> <a href="assets/img/<API key>.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href=" <img src="assets/img/example-sites/example1.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block"> <a href="assets/img/<API key>.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href=" <img src="assets/img/example-sites/example2.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single-2.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> </ul> </section> <div class="divider"></div> </div><!-- /container --> <!-- Footer =============================================== <footer> <div class="container"> <div class="row"> <div class="span4"> <h3>About</h3> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.</p> <h3>Connect With Us</h3> <!-- social begin here --> <ul class="socicon left"> <li> <a href="#" class="share-icon"> </a> </li> <li> <a href="#" class="google"> </a> </li> <li> <a href="#" class="facebook"> </a> </li> <li> <a href="#" class="twitter"> </a> </li> <li> <a href="#" class="flickr"> </a> </li> <li> <a href="#" class="dribbble"> </a> </li> <li> <a href="#" class="linkedin"> </a> </li> <li class="last"> <a href="#" class="vimeo"> </a> </li> </ul> </div> <!-- tweets begin here --> <div class="span4"> <h3>Latest Tweets</h3> <div class="tweets"> <p> Loading Tweets... </p> <ul id="tweet-list"> </ul> </div> </div> <div class="span4"> <!-- flickr begin here --> <h3>From Flickr</h3> <script type="text/javascript" src="http: </div> <div class="span12 copy"> &copy; 2012 NLINE. All Rights Reserved. </div> </div> </div> </footer> <!-- JavaScript files begin--> <!-- Placed at the end of the document so the pages load faster --> <script src="assets/js/jquery.js"></script> <script src="http://maps.google.com/maps/api/js?sensor=false"></script> <script src="assets/js/jquery.form.js"></script> <script src="assets/js/jquery.ufvalidator-1.0.5.js"></script> <script src="assets/js/jquery.easing.1.3.js"></script> <script src="assets/js/jquery.cycle.all.js"></script> <script src="assets/js/jquery.prettyPhoto.js"></script> <script src="assets/js/<API key>/prettify.js"></script> <script src="assets/js/bootstrap.min.js"></script> <script src="assets/js/application.js"></script> <script src="assets/js/responsiveslides.min.js"></script> <script src="assets/build/<API key>.min.js"></script> <script src="assets/js/gmap3.min.js"></script> <script src="assets/js/custom.js"></script> <script src="assets/js/jquery.ui.totop.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $().UItoTop({ easingType: 'easeOutQuart' }); }); </script> </body> </html>
<?php // | TOPThink [ WE CAN DO IT JUST THINK IT ] namespace Think\Db\Driver; use Think\Db; defined('THINK_PATH') or exit(); /** * Mongo MongoModel */ class Mongo extends Db{ protected $_mongo = null; // MongoDb Object protected $_collection = null; // MongoCollection Object protected $_dbName = ''; // dbName protected $_collectionName = ''; // collectionName protected $_cursor = null; // MongoCursor Object protected $comparison = array('neq'=>'ne','ne'=>'ne','gt'=>'gt','egt'=>'gte','gte'=>'gte','lt'=>'lt','elt'=>'lte','lte'=>'lte','in'=>'in','not in'=>'nin','nin'=>'nin'); /** * * @access public * @param array $config */ public function __construct($config=''){ if ( !class_exists('mongoClient') ) { throw_exception(L('_NOT_SUPPERT_').':mongoClient'); } if(!empty($config)) { $this->config = $config; if(empty($this->config['params'])) { $this->config['params'] = array(); } } } /** * * @access public */ public function connect($config='',$linkNum=0) { if ( !isset($this->linkID[$linkNum]) ) { if(empty($config)) $config = $this->config; $host = 'mongodb://'.($config['username']?"{$config['username']}":'').($config['password']?":{$config['password']}@":'').$config['hostname'].($config['hostport']?":{$config['hostport']}":'').'/'.($config['database']?"{$config['database']}":''); try{ $this->linkID[$linkNum] = new \mongoClient( $host,$config['params']); }catch (\<API key> $e){ throw_exception($e->getmessage()); } $this->connected = true; if(1 != C('DB_DEPLOY_TYPE')) unset($this->config); } return $this->linkID[$linkNum]; } /** * DbCollection * @access public * @param string $collection collection * @param string $db db * @param boolean $master * @return void */ public function switchCollection($collection,$db='',$master=true){ if ( !$this->_linkID ) $this->initConnect($master); try{ if(!empty($db)) { // MongoDb $this->_dbName = $db; $this->_mongo = $this->_linkID->selectDb($db); } // MongoCollection if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.getCollection('.$collection.')'; } if($this->_collectionName != $collection) { N('db_read',1); G('queryStartTime'); $this->_collection = $this->_mongo->selectCollection($collection); $this->debug(); $this->_collectionName = $collection; // Collection } }catch (MongoException $e){ throw_exception($e->getMessage()); } } /** * * @access public */ public function free() { $this->_cursor = null; } /** * * @access public * @param array $command * @return array */ public function command($command=array()) { N('db_write',1); $this->queryStr = 'command:'.json_encode($command); G('queryStartTime'); $result = $this->_mongo->command($command); $this->debug(); if(!$result['ok']) { throw_exception($result['errmsg']); } return $result; } /** * * @access public * @param string $code sql * @param array $args * @return mixed */ public function execute($code,$args=array()) { N('db_write',1); $this->queryStr = 'execute:'.$code; G('queryStartTime'); $result = $this->_mongo->execute($code,$args); $this->debug(); if($result['ok']) { return $result['retval']; }else{ throw_exception($result['errmsg']); } } /** * * @access public */ public function close() { if($this->_linkID) { $this->_linkID->close(); $this->_linkID = null; $this->_mongo = null; $this->_collection = null; $this->_cursor = null; } } /** * * @access public * @return string */ public function error() { $this->error = $this->_mongo->lastError(); trace($this->error,'','ERR'); return $this->error; } /** * * @access public * @param mixed $data * @param array $options * @param boolean $replace replace * @return false | integer */ public function insert($data,$options=array(),$replace=false) { if(isset($options['table'])) { $this->switchCollection($options['table']); } $this->model = $options['model']; N('db_write',1); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.insert('; $this->queryStr .= $data?json_encode($data):'{}'; $this->queryStr .= ')'; } try{ G('queryStartTime'); $result = $replace? $this->_collection->save($data): $this->_collection->insert($data); $this->debug(); if($result) { $_id = $data['_id']; if(is_object($_id)) { $_id = $_id->__toString(); } $this->lastInsID = $_id; } return $result; } catch (<API key> $e) { throw_exception($e->getMessage()); } } /** * * @access public * @param array $dataList * @param array $options * @return bool */ public function insertAll($dataList,$options=array()) { if(isset($options['table'])) { $this->switchCollection($options['table']); } $this->model = $options['model']; N('db_write',1); try{ G('queryStartTime'); $result = $this->_collection->batchInsert($dataList); $this->debug(); return $result; } catch (<API key> $e) { throw_exception($e->getMessage()); } } /** * ID MongoId * @access public * @param string $pk * @return integer */ public function mongo_next_id($pk) { N('db_read',1); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.find({},{'.$pk.':1}).sort({'.$pk.':-1}).limit(1)'; } try{ G('queryStartTime'); $result = $this->_collection->find(array(),array($pk=>1))->sort(array($pk=>-1))->limit(1); $this->debug(); } catch (<API key> $e) { throw_exception($e->getMessage()); } $data = $result->getNext(); return isset($data[$pk])?$data[$pk]+1:1; } /** * * @access public * @param mixed $data * @param array $options * @return bool */ public function update($data,$options) { if(isset($options['table'])) { $this->switchCollection($options['table']); } $this->model = $options['model']; N('db_write',1); $query = $this->parseWhere($options['where']); $set = $this->parseSet($data); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.update('; $this->queryStr .= $query?json_encode($query):'{}'; $this->queryStr .= ','.json_encode($set).')'; } try{ G('queryStartTime'); if(isset($options['limit']) && $options['limit'] == 1) { $multiple = array("multiple" => false); }else{ $multiple = array("multiple" => true); } $result = $this->_collection->update($query,$set,$multiple); $this->debug(); return $result; } catch (<API key> $e) { throw_exception($e->getMessage()); } } /** * * @access public * @param array $options * @return false | integer */ public function delete($options=array()) { if(isset($options['table'])) { $this->switchCollection($options['table']); } $query = $this->parseWhere($options['where']); $this->model = $options['model']; N('db_write',1); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.remove('.json_encode($query).')'; } try{ G('queryStartTime'); $result = $this->_collection->remove($query); $this->debug(); return $result; } catch (<API key> $e) { throw_exception($e->getMessage()); } } /** * * @access public * @param array $options * @return false | integer */ public function clear($options=array()){ if(isset($options['table'])) { $this->switchCollection($options['table']); } $this->model = $options['model']; N('db_write',1); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.remove({})'; } try{ G('queryStartTime'); $result = $this->_collection->drop(); $this->debug(); return $result; } catch (<API key> $e) { throw_exception($e->getMessage()); } } /** * * @access public * @param array $options * @return iterator */ public function select($options=array()) { if(isset($options['table'])) { $this->switchCollection($options['table'],'',false); } $cache = isset($options['cache'])?$options['cache']:false; if($cache) { $key = is_string($cache['key'])?$cache['key']:md5(serialize($options)); $value = S($key,'','',$cache['type']); if(false !== $value) { return $value; } } $this->model = $options['model']; N('db_query',1); $query = $this->parseWhere($options['where']); $field = $this->parseField($options['field']); try{ if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.find('; $this->queryStr .= $query? json_encode($query):'{}'; $this->queryStr .= $field? ','.json_encode($field):''; $this->queryStr .= ')'; } G('queryStartTime'); $_cursor = $this->_collection->find($query,$field); if($options['order']) { $order = $this->parseOrder($options['order']); if(C('DB_SQL_LOG')) { $this->queryStr .= '.sort('.json_encode($order).')'; } $_cursor = $_cursor->sort($order); } if(isset($options['page'])) { // limit if(strpos($options['page'],',')) { list($page,$length) = explode(',',$options['page']); }else{ $page = $options['page']; } $page = $page?$page:1; $length = isset($length)?$length:(is_numeric($options['limit'])?$options['limit']:20); $offset = $length*((int)$page-1); $options['limit'] = $offset.','.$length; } if(isset($options['limit'])) { list($offset,$length) = $this->parseLimit($options['limit']); if(!empty($offset)) { if(C('DB_SQL_LOG')) { $this->queryStr .= '.skip('.intval($offset).')'; } $_cursor = $_cursor->skip(intval($offset)); } if(C('DB_SQL_LOG')) { $this->queryStr .= '.limit('.intval($length).')'; } $_cursor = $_cursor->limit(intval($length)); } $this->debug(); $this->_cursor = $_cursor; $resultSet = iterator_to_array($_cursor); if($cache && $resultSet ) { S($key,$resultSet,$cache['expire'],$cache['type']); } return $resultSet; } catch (<API key> $e) { throw_exception($e->getMessage()); } } /** * * @access public * @param array $options * @return array */ public function find($options=array()){ if(isset($options['table'])) { $this->switchCollection($options['table'],'',false); } $cache = isset($options['cache'])?$options['cache']:false; if($cache) { $key = is_string($cache['key'])?$cache['key']:md5(serialize($options)); $value = S($key,'','',$cache['type']); if(false !== $value) { return $value; } } $this->model = $options['model']; N('db_query',1); $query = $this->parseWhere($options['where']); $fields = $this->parseField($options['field']); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.findOne('; $this->queryStr .= $query?json_encode($query):'{}'; $this->queryStr .= $fields?','.json_encode($fields):''; $this->queryStr .= ')'; } try{ G('queryStartTime'); $result = $this->_collection->findOne($query,$fields); $this->debug(); if($cache && $result ) { S($key,$result,$cache['expire'],$cache['type']); } return $result; } catch (<API key> $e) { throw_exception($e->getMessage()); } } /** * * @access public * @param array $options * @return iterator */ public function count($options=array()){ if(isset($options['table'])) { $this->switchCollection($options['table'],'',false); } $this->model = $options['model']; N('db_query',1); $query = $this->parseWhere($options['where']); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName; $this->queryStr .= $query?'.find('.json_encode($query).')':''; $this->queryStr .= '.count()'; } try{ G('queryStartTime'); $count = $this->_collection->count($query); $this->debug(); return $count; } catch (<API key> $e) { throw_exception($e->getMessage()); } } public function group($keys,$initial,$reduce,$options=array()){ $this->_collection->group($keys,$initial,$reduce,$options); } /** * * @access public * @return array */ public function getFields($collection=''){ if(!empty($collection) && $collection != $this->_collectionName) { $this->switchCollection($collection,'',false); } N('db_query',1); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.findOne()'; } try{ G('queryStartTime'); $result = $this->_collection->findOne(); $this->debug(); } catch (<API key> $e) { throw_exception($e->getMessage()); } if($result) { $info = array(); foreach ($result as $key=>$val){ $info[$key] = array( 'name'=>$key, 'type'=>getType($val), ); } return $info; } // false return false; } /** * collection * @access public */ public function getTables(){ if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.getCollenctionNames()'; } N('db_query',1); G('queryStartTime'); $list = $this->_mongo->listCollections(); $this->debug(); $info = array(); foreach ($list as $collection){ $info[] = $collection->getName(); } return $info; } /** * set * @access protected * @param array $data * @return string */ protected function parseSet($data) { $result = array(); foreach ($data as $key=>$val){ if(is_array($val)) { switch($val[0]) { case 'inc': $result['$inc'][$key] = (int)$val[1]; break; case 'set': case 'unset': case 'push': case 'pushall': case 'addtoset': case 'pop': case 'pull': case 'pullall': $result['$'.$val[0]][$key] = $val[1]; break; default: $result['$set'][$key] = $val; } }else{ $result['$set'][$key] = $val; } } return $result; } /** * order * @access protected * @param mixed $order * @return array */ protected function parseOrder($order) { if(is_string($order)) { $array = explode(',',$order); $order = array(); foreach ($array as $key=>$val){ $arr = explode(' ',trim($val)); if(isset($arr[1])) { $arr[1] = $arr[1]=='asc'?1:-1; }else{ $arr[1] = 1; } $order[$arr[0]] = $arr[1]; } } return $order; } /** * limit * @access protected * @param mixed $limit * @return array */ protected function parseLimit($limit) { if(strpos($limit,',')) { $array = explode(',',$limit); }else{ $array = array(0,$limit); } return $array; } /** * field * @access protected * @param mixed $fields * @return array */ public function parseField($fields){ if(empty($fields)) { $fields = array(); } if(is_string($fields)) { $fields = explode(',',$fields); } return $fields; } /** * where * @access protected * @param mixed $where * @return array */ public function parseWhere($where){ $query = array(); foreach ($where as $key=>$val){ if('_id' != $key && 0===strpos($key,'_')) { $query = $this->parseThinkWhere($key,$val); }else{ if(!preg_match('/^[A-Z_\|\&\-.a-z0-9]+$/',trim($key))){ throw_exception(L('_ERROR_QUERY_').':'.$key); } $key = trim($key); if(strpos($key,'|')) { $array = explode('|',$key); $str = array(); foreach ($array as $k){ $str[] = $this->parseWhereItem($k,$val); } $query['$or'] = $str; }elseif(strpos($key,'&')){ $array = explode('&',$key); $str = array(); foreach ($array as $k){ $str[] = $this->parseWhereItem($k,$val); } $query = array_merge($query,$str); }else{ $str = $this->parseWhereItem($key,$val); $query = array_merge($query,$str); } } } return $query; } /** * * @access protected * @param string $key * @param mixed $val * @return string */ protected function parseThinkWhere($key,$val) { $query = array(); switch($key) { case '_query': parse_str($val,$query); if(isset($query['_logic']) && strtolower($query['_logic']) == 'or' ) { unset($query['_logic']); $query['$or'] = $query; } break; case '_string':// MongoCode $query['$where'] = new MongoCode($val); break; } return $query; } /** * where * @access protected * @param string $key * @param mixed $val * @return array */ protected function parseWhereItem($key,$val) { $query = array(); if(is_array($val)) { if(is_string($val[0])) { $con = strtolower($val[0]); if(in_array($con,array('neq','ne','gt','egt','gte','lt','lte','elt'))) { $k = '$'.$this->comparison[$con]; $query[$key] = array($k=>$val[1]); }elseif('like'== $con){ $query[$key] = new MongoRegex("/".$val[1]."/"); }elseif('mod'==$con){ // mod $query[$key] = array('$mod'=>$val[1]); }elseif('regex'==$con){ $query[$key] = new MongoRegex($val[1]); }elseif(in_array($con,array('in','nin','not in'))){ // IN NIN $data = is_string($val[1])? explode(',',$val[1]):$val[1]; $k = '$'.$this->comparison[$con]; $query[$key] = array($k=>$data); }elseif('all'==$con){ $data = is_string($val[1])? explode(',',$val[1]):$val[1]; $query[$key] = array('$all'=>$data); }elseif('between'==$con){ // BETWEEN $data = is_string($val[1])? explode(',',$val[1]):$val[1]; $query[$key] = array('$gte'=>$data[0],'$lte'=>$data[1]); }elseif('not between'==$con){ $data = is_string($val[1])? explode(',',$val[1]):$val[1]; $query[$key] = array('$lt'=>$data[0],'$gt'=>$data[1]); }elseif('exp'==$con){ $query['$where'] = new MongoCode($val[1]); }elseif('exists'==$con){ $query[$key] =array('$exists'=>(bool)$val[1]); }elseif('size'==$con){ $query[$key] =array('$size'=>intval($val[1])); }elseif('type'==$con){ // 1 2 3 MongoDBRef 5 MongoBinData 7 MongoId 8 9 MongoDate 10 NULL 15 MongoCode 16 32 17 MongoTimestamp 18 MongoInt64 $query[$key] =array('$type'=>intval($val[1])); }else{ $query[$key] = $val; } return $query; } } $query[$key] = $val; return $query; } }
#include <stdio.h> #define NUM_ROWS_A 12 //rows of input [A] #define NUM_COLUMNS_A 12 //columns of input [A] #define NUM_ROWS_B 12 //rows of input [B] #define NUM_COLUMNS_B 12 //columns of input [B] #pragma xmp nodes p(*) #pragma xmp template t(0:11) #pragma xmp distribute t(block) onto p double a[NUM_ROWS_A][NUM_COLUMNS_A]; //declare input [A] double b[NUM_ROWS_B][NUM_COLUMNS_B]; double c[NUM_ROWS_A][NUM_COLUMNS_B]; #pragma xmp align b[i][*] with t(i) #pragma xmp align c[i][*] with t(i) int main(void){ int i; #pragma xmp loop on t(j) for (int j = 0; j < NUM_COLUMNS_B; j++) { for(int i= 0; i < NUM_ROWS_A; i++) { for(int k = 0; k < NUM_COLUMNS_A; k++) { c[j][i] = c[j][i] + a[k][i] * b[j][k]; printf("Process %d is computing c[%d][%d]\n", xmp_node_num(), j, i); } } } return 0; }
package mpicbg.spim.segmentation; import fiji.tool.SliceListener; import fiji.tool.SliceObserver; import ij.IJ; import ij.ImageJ; import ij.ImagePlus; import ij.ImageStack; import ij.WindowManager; import ij.gui.OvalRoi; import ij.gui.Overlay; import ij.gui.Roi; import ij.io.Opener; import ij.plugin.PlugIn; import ij.process.ByteProcessor; import ij.process.FloatProcessor; import ij.process.ImageProcessor; import ij.process.ShortProcessor; import java.awt.Button; import java.awt.Checkbox; import java.awt.Color; import java.awt.Font; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Label; import java.awt.Rectangle; import java.awt.Scrollbar; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; import java.util.List; import mpicbg.imglib.algorithm.gauss.<API key>; import mpicbg.imglib.algorithm.math.LocalizablePoint; import mpicbg.imglib.algorithm.scalespace.<API key>; import mpicbg.imglib.algorithm.scalespace.<API key>; import mpicbg.imglib.algorithm.scalespace.<API key>; import mpicbg.imglib.container.array.<API key>; import mpicbg.imglib.cursor.<API key>; import mpicbg.imglib.cursor.LocalizableCursor; import mpicbg.imglib.image.Image; import mpicbg.imglib.image.ImageFactory; import mpicbg.imglib.image.display.imagej.ImageJFunctions; import mpicbg.imglib.multithreading.<API key>; import mpicbg.imglib.outofbounds.<API key>; import mpicbg.imglib.outofbounds.<API key>; import mpicbg.imglib.type.numeric.real.FloatType; import mpicbg.imglib.util.Util; import mpicbg.spim.io.IOFunctions; import mpicbg.spim.registration.ViewStructure; import mpicbg.spim.registration.detection.<API key>; import net.imglib2.RandomAccess; import net.imglib2.exception.ImgLibException; import net.imglib2.img.ImagePlusAdapter; import net.imglib2.img.imageplus.FloatImagePlus; import net.imglib2.view.Views; import spim.process.fusion.FusionHelper; /** * An interactive tool for determining the required sigma and peak threshold * * @author Stephan Preibisch */ public class InteractiveDoG implements PlugIn { final int extraSize = 40; final int scrollbarSize = 1000; float sigma = 0.5f; float sigma2 = 0.5f; float threshold = 0.0001f; // steps per octave public static int standardSenstivity = 4; int sensitivity = standardSenstivity; float imageSigma = 0.5f; float sigmaMin = 0.5f; float sigmaMax = 10f; int sigmaInit = 300; float thresholdMin = 0.0001f; float thresholdMax = 1f; int thresholdInit = 500; double minIntensityImage = Double.NaN; double maxIntensityImage = Double.NaN; SliceObserver sliceObserver; RoiListener roiListener; ImagePlus imp; int channel = 0; Rectangle rectangle; Image<FloatType> img; FloatImagePlus< net.imglib2.type.numeric.real.FloatType > source; ArrayList<<API key><FloatType>> peaks; Color originalColor = new Color( 0.8f, 0.8f, 0.8f ); Color inactiveColor = new Color( 0.95f, 0.95f, 0.95f ); public Rectangle standardRectangle; boolean isComputing = false; boolean isStarted = false; boolean enableSigma2 = false; boolean sigma2IsAdjustable = true; boolean lookForMinima = false; boolean lookForMaxima = true; public static enum ValueChange { SIGMA, THRESHOLD, SLICE, ROI, MINMAX, ALL } boolean isFinished = false; boolean wasCanceled = false; public boolean isFinished() { return isFinished; } public boolean wasCanceled() { return wasCanceled; } public double getInitialSigma() { return sigma; } public void setInitialSigma( final float value ) { sigma = value; sigmaInit = <API key>( sigma, sigmaMin, sigmaMax, scrollbarSize ); } public double getSigma2() { return sigma2; } public double getThreshold() { return threshold; } public void setThreshold( final float value ) { threshold = value; final double log1001 = Math.log10( scrollbarSize + 1); thresholdInit = (int)Math.round( 1001-Math.pow(10, -(((threshold - thresholdMin)/(<API key>))*log1001) + log1001 ) ); } public boolean <API key>() { return enableSigma2; } public boolean getLookForMaxima() { return lookForMaxima; } public boolean getLookForMinima() { return lookForMinima; } public void setLookForMaxima( final boolean lookForMaxima ) { this.lookForMaxima = lookForMaxima; } public void setLookForMinima( final boolean lookForMinima ) { this.lookForMinima = lookForMinima; } public void setSigmaMax( final float sigmaMax ) { this.sigmaMax = sigmaMax; } public void <API key>( final boolean state ) { sigma2IsAdjustable = state; } // for the case that it is needed again, we can save one conversion public FloatImagePlus< net.imglib2.type.numeric.real.FloatType > getConvertedImage() { return source; } public InteractiveDoG( final ImagePlus imp, final int channel ) { this.imp = imp; this.channel = channel; } public InteractiveDoG( final ImagePlus imp ) { this.imp = imp; } public InteractiveDoG() {} public void <API key>( final double min ) { this.minIntensityImage = min; } public void <API key>( final double max ) { this.maxIntensityImage = max; } @Override public void run( String arg ) { if ( imp == null ) imp = WindowManager.getCurrentImage(); standardRectangle = new Rectangle( imp.getWidth()/4, imp.getHeight()/4, imp.getWidth()/2, imp.getHeight()/2 ); if ( imp.getType() == ImagePlus.COLOR_RGB || imp.getType() == ImagePlus.COLOR_256 ) { IJ.log( "Color images are not supported, please convert to 8, 16 or 32-bit grayscale" ); return; } Roi roi = imp.getRoi(); if ( roi == null ) { //IJ.log( "A rectangular ROI is required to define the area..." ); imp.setRoi( standardRectangle ); roi = imp.getRoi(); } if ( roi.getType() != Roi.RECTANGLE ) { IJ.log( "Only rectangular rois are supported..." ); return; } // copy the ImagePlus into an ArrayImage<FloatType> for faster access source = convertToFloat( imp, channel, 0, minIntensityImage, maxIntensityImage ); // show the interactive kit displaySliders(); // add listener to the imageplus slice slider sliceObserver = new SliceObserver( imp, new ImagePlusListener() ); // compute first version updatePreview( ValueChange.ALL ); isStarted = true; // check whenever roi is modified to update accordingly roiListener = new RoiListener(); imp.getCanvas().addMouseListener( roiListener ); } /** * Updates the Preview with the current parameters (sigma, threshold, roi, slicenumber) * * @param change - what did change */ protected void updatePreview( final ValueChange change ) { // check if Roi changed boolean roiChanged = false; Roi roi = imp.getRoi(); if ( roi == null || roi.getType() != Roi.RECTANGLE ) { imp.setRoi( new Rectangle( standardRectangle ) ); roi = imp.getRoi(); roiChanged = true; } final Rectangle rect = roi.getBounds(); if ( roiChanged || img == null || change == ValueChange.SLICE || rect.getMinX() != rectangle.getMinX() || rect.getMaxX() != rectangle.getMaxX() || rect.getMinY() != rectangle.getMinY() || rect.getMaxY() != rectangle.getMaxY() ) { rectangle = rect; img = extractImage( source, rectangle, extraSize ); roiChanged = true; } // if we got some mouse click but the ROI did not change we can return if ( !roiChanged && change == ValueChange.ROI ) { isComputing = false; return; } // compute the Difference Of Gaussian if necessary if ( peaks == null || roiChanged || change == ValueChange.SIGMA || change == ValueChange.SLICE || change == ValueChange.ALL ) { // Compute the Sigmas for the gaussian folding final float k, K_MIN1_INV; final float[] sigma, sigmaDiff; if ( enableSigma2 ) { sigma = new float[ 2 ]; sigma[ 0 ] = this.sigma; sigma[ 1 ] = this.sigma2; k = sigma[ 1 ] / sigma[ 0 ]; K_MIN1_INV = <API key>.computeKWeight( k ); sigmaDiff = <API key>.computeSigmaDiff( sigma, imageSigma ); } else { k = (float)<API key>.computeK( sensitivity ); K_MIN1_INV = <API key>.computeKWeight( k ); sigma = <API key>.computeSigma( k, this.sigma ); sigmaDiff = <API key>.computeSigmaDiff( sigma, imageSigma ); } // the upper boundary this.sigma2 = sigma[ 1 ]; final <API key><FloatType> dog = new <API key><FloatType>( img, new <API key><FloatType>(), sigmaDiff[ 0 ], sigmaDiff[ 1 ], thresholdMin/4, K_MIN1_INV ); dog.setKeepDoGImage( true ); dog.process(); final <API key><FloatType> subpixel = new <API key><FloatType>( dog.getDoGImage(), dog.getPeaks() ); subpixel.process(); peaks = dog.getPeaks(); } // extract peaks to show Overlay o = imp.getOverlay(); if ( o == null ) { o = new Overlay(); imp.setOverlay( o ); } o.clear(); for ( final <API key><FloatType> peak : peaks ) { if ( ( peak.isMax() && lookForMaxima ) || ( peak.isMin() && lookForMinima ) ) { final float x = peak.getPosition( 0 ); final float y = peak.getPosition( 1 ); if ( Math.abs( peak.getValue().get() ) > threshold && x >= extraSize/2 && y >= extraSize/2 && x < rect.width+extraSize/2 && y < rect.height+extraSize/2 ) { final OvalRoi or = new OvalRoi( Util.round( x - sigma ) + rect.x - extraSize/2, Util.round( y - sigma ) + rect.y - extraSize/2, Util.round( sigma+sigma2 ), Util.round( sigma+sigma2 ) ); if ( peak.isMax() ) or.setStrokeColor( Color.green ); else if ( peak.isMin() ) or.setStrokeColor( Color.red ); o.add( or ); } } } imp.updateAndDraw(); isComputing = false; } public static float computeSigma2( final float sigma1, final int sensitivity ) { final float k = (float)<API key>.computeK( sensitivity ); final float[] sigma = <API key>.computeSigma( k, sigma1 ); return sigma[ 1 ]; } /** * Extract the current 2d region of interest from the souce image * * @param source - the source image, a {@link Image} which is a copy of the {@link ImagePlus} * @param rectangle - the area of interest * @param extraSize - the extra size around so that detections at the border of the roi are not messed up * @return */ protected Image<FloatType> extractImage( final FloatImagePlus< net.imglib2.type.numeric.real.FloatType > source, final Rectangle rectangle, final int extraSize ) { final Image<FloatType> img = new ImageFactory<FloatType>( new FloatType(), new <API key>() ).createImage( new int[]{ rectangle.width+extraSize, rectangle.height+extraSize } ); final int offsetX = rectangle.x - extraSize/2; final int offsetY = rectangle.y - extraSize/2; final int[] location = new int[ source.numDimensions() ]; if ( location.length > 2 ) location[ 2 ] = (imp.getCurrentSlice()-1)/imp.getNChannels(); final LocalizableCursor<FloatType> cursor = img.<API key>(); final RandomAccess<net.imglib2.type.numeric.real.FloatType> positionable; if ( offsetX >= 0 && offsetY >= 0 && offsetX + img.getDimension( 0 ) < source.dimension( 0 ) && offsetY + img.getDimension( 1 ) < source.dimension( 1 ) ) { // it is completely inside so we need no outofbounds for copying positionable = source.randomAccess(); } else { positionable = Views.extendMirrorSingle( source ).randomAccess(); } while ( cursor.hasNext() ) { cursor.fwd(); cursor.getPosition( location ); location[ 0 ] += offsetX; location[ 1 ] += offsetY; positionable.setPosition( location ); cursor.getType().set( positionable.get().get() ); } return img; } /** * Normalize and make a copy of the {@link ImagePlus} into an {@link Image}&gt;FloatType&lt; for faster access when copying the slices * * @param imp - the {@link ImagePlus} input image * @return - the normalized copy [0...1] */ public static FloatImagePlus< net.imglib2.type.numeric.real.FloatType > convertToFloat( final ImagePlus imp, int channel, int timepoint ) { return convertToFloat( imp, channel, timepoint, Double.NaN, Double.NaN ); } public static FloatImagePlus< net.imglib2.type.numeric.real.FloatType > convertToFloat( final ImagePlus imp, int channel, int timepoint, final double min, final double max ) { // stupid 1-offset of imagej channel++; timepoint++; final int h = imp.getHeight(); final int w = imp.getWidth(); final ArrayList< float[] > img = new ArrayList< float[] >(); if ( imp.getProcessor() instanceof FloatProcessor ) { for ( int z = 0; z < imp.getNSlices(); ++z ) img.add( ( (float[])imp.getStack().getProcessor( imp.getStackIndex( channel, z + 1, timepoint ) ).getPixels() ).clone() ); } else if ( imp.getProcessor() instanceof ByteProcessor ) { for ( int z = 0; z < imp.getNSlices(); ++z ) { final byte[] pixels = (byte[])imp.getStack().getProcessor( imp.getStackIndex( channel, z + 1, timepoint ) ).getPixels(); final float[] pixelsF = new float[ pixels.length ]; for ( int i = 0; i < pixels.length; ++i ) pixelsF[ i ] = pixels[ i ] & 0xff; img.add( pixelsF ); } } else if ( imp.getProcessor() instanceof ShortProcessor ) { for ( int z = 0; z < imp.getNSlices(); ++z ) { final short[] pixels = (short[])imp.getStack().getProcessor( imp.getStackIndex( channel, z + 1, timepoint ) ).getPixels(); final float[] pixelsF = new float[ pixels.length ]; for ( int i = 0; i < pixels.length; ++i ) pixelsF[ i ] = pixels[ i ] & 0xffff; img.add( pixelsF ); } } else // some color stuff or so { for ( int z = 0; z < imp.getNSlices(); ++z ) { final ImageProcessor ip = imp.getStack().getProcessor( imp.getStackIndex( channel, z + 1, timepoint ) ); final float[] pixelsF = new float[ w * h ]; int i = 0; for ( int y = 0; y < h; ++y ) for ( int x = 0; x < w; ++x ) pixelsF[ i++ ] = ip.getPixelValue( x, y ); img.add( pixelsF ); } } final FloatImagePlus< net.imglib2.type.numeric.real.FloatType > i = createImgLib2( img, w, h ); if ( Double.isNaN( min ) || Double.isNaN( max ) || Double.isInfinite( min ) || Double.isInfinite( max ) || min == max ) FusionHelper.normalizeImage( i ); else FusionHelper.normalizeImage( i, (float)min, (float)max ); return i; } public static FloatImagePlus< net.imglib2.type.numeric.real.FloatType > createImgLib2( final List< float[] > img, final int w, final int h ) { final ImagePlus imp; if ( img.size() > 1 ) { final ImageStack stack = new ImageStack( w, h ); for ( int z = 0; z < img.size(); ++z ) stack.addSlice( new FloatProcessor( w, h, img.get( z ) ) ); imp = new ImagePlus( "ImgLib2 FloatImagePlus (3d)", stack ); } else { imp = new ImagePlus( "ImgLib2 FloatImagePlus (2d)", new FloatProcessor( w, h, img.get( 0 ) ) ); } return ImagePlusAdapter.wrapFloat( imp ); } /** * Instantiates the panel for adjusting the paramters */ protected void displaySliders() { final Frame frame = new Frame("Adjust <API key> Values"); frame.setSize( 400, 330 ); /* Instantiation */ final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints c = new GridBagConstraints(); final Scrollbar sigma1 = new Scrollbar ( Scrollbar.HORIZONTAL, sigmaInit, 10, 0, 10 + scrollbarSize ); this.sigma = <API key>( sigmaInit, sigmaMin, sigmaMax, scrollbarSize); final Scrollbar threshold = new Scrollbar ( Scrollbar.HORIZONTAL, thresholdInit, 10, 0, 10 + scrollbarSize ); final float log1001 = (float)Math.log10( scrollbarSize + 1); this.threshold = thresholdMin + ( (log1001 - (float)Math.log10(1001-thresholdInit))/log1001 ) * (<API key>); this.sigma2 = computeSigma2( this.sigma, this.sensitivity ); final int sigma2init = <API key>( this.sigma2, sigmaMin, sigmaMax, scrollbarSize ); final Scrollbar sigma2 = new Scrollbar ( Scrollbar.HORIZONTAL, sigma2init, 10, 0, 10 + scrollbarSize ); final Label sigmaText1 = new Label( "Sigma 1 = " + this.sigma, Label.CENTER ); final Label sigmaText2 = new Label( "Sigma 2 = " + this.sigma2, Label.CENTER ); final Label thresholdText = new Label( "Threshold = " + this.threshold, Label.CENTER ); final Button apply = new Button( "Apply to Stack (will take some time)" ); final Button button = new Button( "Done" ); final Button cancel = new Button( "Cancel" ); final Checkbox sigma2Enable = new Checkbox( "Enable Manual Adjustment of Sigma 2 ", enableSigma2 ); final Checkbox min = new Checkbox( "Look for Minima (red)", lookForMinima ); final Checkbox max = new Checkbox( "Look for Maxima (green)", lookForMaxima ); /* Location */ frame.setLayout( layout ); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.weightx = 1; frame.add ( sigma1, c ); ++c.gridy; frame.add( sigmaText1, c ); ++c.gridy; frame.add ( sigma2, c ); ++c.gridy; frame.add( sigmaText2, c ); ++c.gridy; c.insets = new Insets(0,65,0,65); frame.add( sigma2Enable, c ); ++c.gridy; c.insets = new Insets(10,0,0,0); frame.add ( threshold, c ); c.insets = new Insets(0,0,0,0); ++c.gridy; frame.add( thresholdText, c ); ++c.gridy; c.insets = new Insets(0,130,0,75); frame.add( min, c ); ++c.gridy; c.insets = new Insets(0,125,0,75); frame.add( max, c ); ++c.gridy; c.insets = new Insets(0,75,0,75); frame.add( apply, c ); ++c.gridy; c.insets = new Insets(10,150,0,150); frame.add( button, c ); ++c.gridy; c.insets = new Insets(10,150,0,150); frame.add( cancel, c ); /* Configuration */ sigma1.<API key>( new SigmaListener( sigmaText1, sigmaMin, sigmaMax, scrollbarSize, sigma1, sigma2, sigmaText2 ) ); sigma2.<API key>( new Sigma2Listener( sigmaMin, sigmaMax, scrollbarSize, sigma2, sigmaText2 ) ); threshold.<API key>( new ThresholdListener( thresholdText, thresholdMin, thresholdMax ) ); button.addActionListener( new <API key>( frame, false ) ); cancel.addActionListener( new <API key>( frame, true ) ); apply.addActionListener( new ApplyButtonListener() ); min.addItemListener( new MinListener() ); max.addItemListener( new MaxListener() ); sigma2Enable.addItemListener( new EnableListener( sigma2, sigmaText2 ) ); if ( !sigma2IsAdjustable ) sigma2Enable.setEnabled( false ); frame.addWindowListener( new FrameListener( frame ) ); frame.setVisible( true ); originalColor = sigma2.getBackground(); sigma2.setBackground( inactiveColor ); sigmaText1.setFont( sigmaText1.getFont().deriveFont( Font.BOLD ) ); thresholdText.setFont( thresholdText.getFont().deriveFont( Font.BOLD ) ); } protected class EnableListener implements ItemListener { final Scrollbar sigma2; final Label sigmaText2; public EnableListener( final Scrollbar sigma2, final Label sigmaText2 ) { this.sigmaText2 = sigmaText2; this.sigma2 = sigma2; } @Override public void itemStateChanged( final ItemEvent arg0 ) { if ( arg0.getStateChange() == ItemEvent.DESELECTED ) { sigmaText2.setFont( sigmaText2.getFont().deriveFont( Font.PLAIN ) ); sigma2.setBackground( inactiveColor ); enableSigma2 = false; } else if ( arg0.getStateChange() == ItemEvent.SELECTED ) { sigmaText2.setFont( sigmaText2.getFont().deriveFont( Font.BOLD ) ); sigma2.setBackground( originalColor ); enableSigma2 = true; } } } protected class MinListener implements ItemListener { @Override public void itemStateChanged( final ItemEvent arg0 ) { boolean oldState = lookForMinima; if ( arg0.getStateChange() == ItemEvent.DESELECTED ) lookForMinima = false; else if ( arg0.getStateChange() == ItemEvent.SELECTED ) lookForMinima = true; if ( lookForMinima != oldState ) { while ( isComputing ) <API key>.threadWait( 10 ); updatePreview( ValueChange.MINMAX ); } } } protected class MaxListener implements ItemListener { @Override public void itemStateChanged( final ItemEvent arg0 ) { boolean oldState = lookForMaxima; if ( arg0.getStateChange() == ItemEvent.DESELECTED ) lookForMaxima = false; else if ( arg0.getStateChange() == ItemEvent.SELECTED ) lookForMaxima = true; if ( lookForMaxima != oldState ) { while ( isComputing ) <API key>.threadWait( 10 ); updatePreview( ValueChange.MINMAX ); } } } /** * Tests whether the ROI was changed and will recompute the preview * * @author Stephan Preibisch */ protected class RoiListener implements MouseListener { @Override public void mouseClicked(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased( final MouseEvent e ) { // here the ROI might have been modified, let's test for that final Roi roi = imp.getRoi(); if ( roi == null || roi.getType() != Roi.RECTANGLE ) return; while ( isComputing ) <API key>.threadWait( 10 ); updatePreview( ValueChange.ROI ); } } protected class ApplyButtonListener implements ActionListener { @Override public void actionPerformed( final ActionEvent arg0 ) { ImagePlus imp; try { imp = source.getImagePlus(); } catch (ImgLibException e) { imp = null; e.printStackTrace(); } // convert ImgLib2 image to ImgLib1 image via the imageplus final Image< FloatType > source = ImageJFunctions.wrapFloat( imp ); IOFunctions.println( "Computing DoG ... " ); // test the parameters on the complete stack final ArrayList<<API key><FloatType>> peaks = <API key>.<API key>( source, new <API key><FloatType>(), imageSigma, sigma, sigma2, threshold, threshold/4, lookForMaxima, lookForMinima, ViewStructure.DEBUG_MAIN ); IOFunctions.println( "Drawing DoG result ... " ); // display as extra image Image<FloatType> detections = source.createNewImage(); final <API key><FloatType> c = detections.<API key>(); for ( final <API key><FloatType> peak : peaks ) { final LocalizablePoint p = new LocalizablePoint( new float[]{ peak.getSubPixelPosition( 0 ), peak.getSubPixelPosition( 1 ), peak.getSubPixelPosition( 2 ) } ); c.setPosition( p ); c.getType().set( 1 ); } IOFunctions.println( "Convolving DoG result ... " ); final <API key><FloatType> gauss = new <API key><FloatType>( detections, new <API key><FloatType>(), 2 ); gauss.process(); detections = gauss.getResult(); IOFunctions.println( "Showing DoG result ... " ); ImageJFunctions.show( detections ); } } protected class <API key> implements ActionListener { final Frame parent; final boolean cancel; public <API key>( Frame parent, final boolean cancel ) { this.parent = parent; this.cancel = cancel; } @Override public void actionPerformed( final ActionEvent arg0 ) { wasCanceled = cancel; close( parent, sliceObserver, imp, roiListener ); } } protected class FrameListener extends WindowAdapter { final Frame parent; public FrameListener( Frame parent ) { super(); this.parent = parent; } @Override public void windowClosing (WindowEvent e) { close( parent, sliceObserver, imp, roiListener ); } } protected final void close( final Frame parent, final SliceObserver sliceObserver, final ImagePlus imp, final RoiListener roiListener ) { if ( parent != null ) parent.dispose(); if ( sliceObserver != null ) sliceObserver.unregister(); if ( imp != null ) { if ( roiListener != null ) imp.getCanvas().removeMouseListener( roiListener ); imp.getOverlay().clear(); imp.updateAndDraw(); } isFinished = true; } protected class Sigma2Listener implements AdjustmentListener { final float min, max; final int scrollbarSize; final Scrollbar sigmaScrollbar2; final Label sigma2Label; public Sigma2Listener( final float min, final float max, final int scrollbarSize, final Scrollbar sigmaScrollbar2, final Label sigma2Label ) { this.min = min; this.max = max; this.scrollbarSize = scrollbarSize; this.sigmaScrollbar2 = sigmaScrollbar2; this.sigma2Label = sigma2Label; } @Override public void <API key>( final AdjustmentEvent event ) { if ( enableSigma2 ) { sigma2 = <API key>( event.getValue(), min, max, scrollbarSize ); if ( sigma2 < sigma ) { sigma2 = sigma + 0.001f; sigmaScrollbar2.setValue( <API key>( sigma2, min, max, scrollbarSize ) ); } sigma2Label.setText( "Sigma 2 = " + sigma2 ); if ( !event.getValueIsAdjusting() ) { while ( isComputing ) { <API key>.threadWait( 10 ); } updatePreview( ValueChange.SIGMA ); } } else { // if no manual adjustment simply reset it sigmaScrollbar2.setValue( <API key>( sigma2, min, max, scrollbarSize ) ); } } } protected class SigmaListener implements AdjustmentListener { final Label label; final float min, max; final int scrollbarSize; final Scrollbar sigmaScrollbar1; final Scrollbar sigmaScrollbar2; final Label sigmaText2; public SigmaListener( final Label label, final float min, final float max, final int scrollbarSize, final Scrollbar sigmaScrollbar1, final Scrollbar sigmaScrollbar2, final Label sigmaText2 ) { this.label = label; this.min = min; this.max = max; this.scrollbarSize = scrollbarSize; this.sigmaScrollbar1 = sigmaScrollbar1; this.sigmaScrollbar2 = sigmaScrollbar2; this.sigmaText2 = sigmaText2; } @Override public void <API key>( final AdjustmentEvent event ) { sigma = <API key>( event.getValue(), min, max, scrollbarSize ); if ( !enableSigma2 ) { sigma2 = computeSigma2( sigma, sensitivity ); sigmaText2.setText( "Sigma 2 = " + sigma2 ); sigmaScrollbar2.setValue( <API key>( sigma2, min, max, scrollbarSize ) ); } else if ( sigma > sigma2 ) { sigma = sigma2 - 0.001f; sigmaScrollbar1.setValue( <API key>( sigma, min, max, scrollbarSize ) ); } label.setText( "Sigma 1 = " + sigma ); if ( !event.getValueIsAdjusting() ) { while ( isComputing ) { <API key>.threadWait( 10 ); } updatePreview( ValueChange.SIGMA ); } } } protected static float <API key>( final int scrollbarPosition, final float min, final float max, final int scrollbarSize ) { return min + (scrollbarPosition/(float)scrollbarSize) * (max-min); } protected static int <API key>( final float sigma, final float min, final float max, final int scrollbarSize ) { return Util.round( ((sigma - min)/(max-min)) * scrollbarSize ); } protected class ThresholdListener implements AdjustmentListener { final Label label; final float min, max; final float log1001 = (float)Math.log10(1001); public ThresholdListener( final Label label, final float min, final float max ) { this.label = label; this.min = min; this.max = max; } @Override public void <API key>( final AdjustmentEvent event ) { threshold = min + ( (log1001 - (float)Math.log10(1001-event.getValue()))/log1001 ) * (max-min); label.setText( "Threshold = " + threshold ); if ( !isComputing ) { updatePreview( ValueChange.THRESHOLD ); } else if ( !event.getValueIsAdjusting() ) { while ( isComputing ) { <API key>.threadWait( 10 ); } updatePreview( ValueChange.THRESHOLD ); } } } protected class ImagePlusListener implements SliceListener { @Override public void sliceChanged(ImagePlus arg0) { if ( isStarted ) { while ( isComputing ) { <API key>.threadWait( 10 ); } updatePreview( ValueChange.SLICE ); } } } public static void main( String[] args ) { new ImageJ(); ImagePlus imp = new Opener().openImage( "/home/preibisch/Documents/Microscopy/SPIM/Harvard/f11e6/exp3/img_Ch0_Angle0.tif.zip" ); //ImagePlus imp = new Opener().openImage( "D:/Documents and Settings/Stephan/My Documents/Downloads/1-315--0.<API key>/1-315--0.<API key>.tif" ); imp.show(); imp.setSlice( 27 ); imp.setRoi( imp.getWidth()/4, imp.getHeight()/4, imp.getWidth()/2, imp.getHeight()/2 ); new InteractiveDoG().run( null ); } }
<?php $name='KievitCyr-ExtraBold'; $type='TTF'; $desc=array ( 'Ascent' => 872, 'Descent' => -250, 'CapHeight' => 872, 'Flags' => 262148, 'FontBBox' => '[-56 -250 1278 872]', 'ItalicAngle' => 0, 'StemV' => 165, 'MissingWidth' => 566, ); $up=-143; $ut=20; $ttffile='C:/wamp/www/alfakasko/mpdf/ttfonts/KvCyXb_.ttf'; $TTCfontID='0'; $originalsize=20632; $sip=false; $smp=false; $BMPselected=false; $fontkey='kievitB'; $panose=' 0 0 2 0 8 3 0 0 0 0 0 0'; $haskerninfo=false; $unAGlyphs=false; ?>
#ifndef <API key> #define <API key> #include "Event.h" namespace caret { class <API key> : public Event { public: <API key>(); virtual ~<API key>(); void addBrowserTabIndex(const int32_t browserTabIndex); std::vector<int32_t> <API key>() const; bool <API key>(const int32_t browserTabIndex); // <API key> private: <API key>(const <API key>&); <API key>& operator=(const <API key>&); std::vector<int32_t> m_browserTabIndices; // <API key> }; #ifdef <API key> // <PLACE DECLARATIONS OF STATIC MEMBERS HERE> #endif // <API key> } // namespace #endif //<API key>
/** * \file * \brief Common IPC interface. * \ingroup l4_api */ #ifndef <API key> #define <API key> #include <l4/sys/types.h> #include <l4/sys/utcb.h> #include <l4/sys/err.h> /** * \defgroup l4_ipc_api Object Invocation * \ingroup l4_api * \brief API for L4 object invocation. * * <c>\#include <l4/sys/ipc.h></c> * * General abstractions for L4 object invocation. The basic principle is that * all objects are denoted by a capability that is accessed via a capability * selector (see \link l4_cap_api Capabilities \endlink). * * This set of functions is common to all kinds of objects provided by the * L4 micro kernel. The concrete semantics of an invocation depends on the * object that shall be invoked. * * Objects may be invoked in various ways, the most common way is to use * a \em call operation (l4_ipc_call()). However, there are a lot more * flavours available that have a semantics depending on the object. * * \see \ref <API key> * */ /** * \defgroup l4_ipc_err_api Error Handling * \ingroup l4_ipc_api * \brief Error handling for L4 object invocation. * * <c>\#include <l4/sys/ipc.h></c> */ /** * \brief Error codes in the \em error TCR. * \ingroup l4_ipc_err_api * * The error codes are accessible via the \em error TCR, see * #l4_thread_regs_t.error. */ enum l4_ipc_tcr_error_t { L4_IPC_ERROR_MASK = 0x1F, /**< Mask for error bits. */ L4_IPC_SND_ERR_MASK = 0x01, /**< Send error mask. */ <API key> = 0x04, /**< Non-existing destination or source. ** \ingroup l4_ipc_api **/ L4_IPC_RETIMEOUT = 0x03, /**< Timeout during receive operation. ** \ingroup l4_ipc_api **/ L4_IPC_SETIMEOUT = 0x02, /**< Timeout during send operation. ** \ingroup l4_ipc_api **/ L4_IPC_RECANCELED = 0x07, /**< Receive operation canceled. ** \ingroup l4_ipc_api **/ L4_IPC_SECANCELED = 0x06, /**< Send operation canceled. ** \ingroup l4_ipc_api **/ L4_IPC_REMAPFAILED = 0x11, /**< Map flexpage failed in receive ** operation. ** \ingroup l4_ipc_api **/ L4_IPC_SEMAPFAILED = 0x10, /**< Map flexpage failed in send operation. ** \ingroup l4_ipc_api **/ L4_IPC_RESNDPFTO = 0x0b, /**< Send-pagefault timeout in receive ** operation. ** \ingroup l4_ipc_api **/ L4_IPC_SESNDPFTO = 0x0a, /**< Send-pagefault timeout in send ** operation. ** \ingroup l4_ipc_api **/ L4_IPC_RERCVPFTO = 0x0d, /**< Receive-pagefault timeout in receive ** operation. ** \ingroup l4_ipc_api **/ L4_IPC_SERCVPFTO = 0x0c, /**< Receive-pagefault timeout in send ** operation. ** \ingroup l4_ipc_api **/ L4_IPC_REABORTED = 0x0f, /**< Receive operation aborted. ** \ingroup l4_ipc_api **/ L4_IPC_SEABORTED = 0x0e, /**< Send operation aborted. ** \ingroup l4_ipc_api **/ L4_IPC_REMSGCUT = 0x09, /**< Cut receive message, due to ** message buffer is too small. ** \ingroup l4_ipc_api **/ L4_IPC_SEMSGCUT = 0x08, /**< Cut send message. due to ** message buffer is too small, ** \ingroup l4_ipc_api **/ }; /** * \brief Get the error code for an object invocation. * \ingroup l4_ipc_err_api * * \param tag Return value of the invocation. * \param utcb UTCB that was used for the invocation. * * \return 0 if no error condition is set, * error code otherwise (see #l4_ipc_tcr_error_t). */ L4_INLINE l4_umword_t l4_ipc_error(l4_msgtag_t tag, l4_utcb_t *utcb) L4_NOTHROW; /** * \brief Return error code of a system call return message tag. * \ingroup l4_ipc_err_api * \param tag System call return message type * \return 0 for no error, error number in case of error */ L4_INLINE long l4_error(l4_msgtag_t tag) L4_NOTHROW; L4_INLINE long l4_error_u(l4_msgtag_t tag, l4_utcb_t *utcb) L4_NOTHROW; /** * \brief Returns whether an error occurred in send phase of an invocation. * \ingroup l4_ipc_err_api * * \pre l4_msgtag_has_error(tag) == true * \param utcb UTCB to check. * * \return Boolean value. */ L4_INLINE int l4_ipc_is_snd_error(l4_utcb_t *utcb) L4_NOTHROW; /** * \brief Returns whether an error occurred in receive phase of an invocation. * \ingroup l4_ipc_err_api * * \pre l4_msgtag_has_error(tag) == true * \param utcb UTCB to check. * * \return Boolean value. */ L4_INLINE int l4_ipc_is_rcv_error(l4_utcb_t *utcb) L4_NOTHROW; /** * \brief Get the error condition of the last invocation from the TCR. * \ingroup l4_ipc_err_api * * \pre l4_msgtag_has_error(tag) == true * \param utcb UTCB to check. * * \return Error condition of type l4_ipc_tcr_error_t. */ L4_INLINE int l4_ipc_error_code(l4_utcb_t *utcb) L4_NOTHROW; /** * \brief Send a message to an object (do \b not wait for a reply). * \ingroup l4_ipc_api * * \param dest Capability selector for the destination object. * \param utcb UTCB of the caller. * \param tag Descriptor for the message to be sent. * \param timeout Timeout pair (see #l4_timeout_t) only send part is relevant. * * \return result tag * * A message is sent to the destination object. There is no receive phase * included. The invoker continues working after sending the message. * * \attention This is a special-purpose message transfer, objects usually * support only invocation via l4_ipc_call(). */ L4_INLINE l4_msgtag_t l4_ipc_send(l4_cap_idx_t dest, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Wait for an incoming message from any possible sender. * \ingroup l4_ipc_api * * \param utcb UTCB of the caller. * \retval label Label assigned to the source object (IPC gate or IRQ). * \param timeout Timeout pair (see #l4_timeout_t, only the receive part is * used). * * \return return tag * * This operation does an open wait, and therefore needs no capability to * denote the possible source of a message. This means the calling thread * waits for an incoming message from any possible source. * There is no send phase included in this operation. * * The usual usage of this function is to call that function when entering a * server loop in a user-level server that implements user-level objects, * see also #<API key>(). */ L4_INLINE l4_msgtag_t l4_ipc_wait(l4_utcb_t *utcb, l4_umword_t *label, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Wait for a message from a specific source. * \ingroup l4_ipc_api * * \param object Object to receive a message from. * \param timeout Timeout pair (see #l4_timeout_t, only the receive part * matters). * \param utcb UTCB of the caller. * * \return result tag. * * This operation waits for a message from the specified object. Messages from * other sources are not accepted by this operation. The operation does not * include a send phase, this means no message is sent to the object. * * \note This operation is usually used to receive messages from a specific IRQ * or thread. However, it is not common to use this operation for normal * applications. */ L4_INLINE l4_msgtag_t l4_ipc_receive(l4_cap_idx_t object, l4_utcb_t *utcb, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Object call (usual invocation). * \ingroup l4_ipc_api * * \param object Capability selector for the object to call. * \param utcb UTCB of the caller. * \param tag Message tag to describe the message to be sent. * \param timeout Timeout pair for send an receive phase (see #l4_timeout_t). * * \return result tag * * A message is sent to the object and the invoker waits for a * reply from the object. Messages from other sources are not accepted. * \note The send-to-receive transition needs no time, the object can reply * with a send timeout of zero. */ L4_INLINE l4_msgtag_t l4_ipc_call(l4_cap_idx_t object, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Reply and wait operation (uses the \em reply capability). * \ingroup l4_ipc_api * * \param tag Describes the message to be sent as reply. * \param utcb UTCB of the caller. * \retval label Label assigned to the source object of the received message. * \param timeout Timeout pair (see #l4_timeout_t). * \return result tag * * A message is sent to the previous caller using the implicit reply * capability. Afterwards the invoking thread waits for a message from any * source. * \note This is the standard server operation: it sends a reply to the actual * client and waits for the next incoming request, which may come from * any other client. */ L4_INLINE l4_msgtag_t <API key>(l4_utcb_t *utcb, l4_msgtag_t tag, l4_umword_t *label, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Send a message and do an open wait. * \ingroup l4_ipc_api * * \param dest Object to send a message to. * \param utcb UTCB of the caller. * \param tag Describes the message that shall be sent. * \retval label Label assigned to the source object of the receive phase. * \param timeout Timeout pair (see #l4_timeout_t). * \return result tag * * A message is sent to the destination object and the invoking thread waits * for a reply from any source. * * \note This is a special-purpose operation and shall not be used in general * applications. */ L4_INLINE l4_msgtag_t <API key>(l4_cap_idx_t dest, l4_utcb_t *utcb, l4_msgtag_t tag, l4_umword_t *label, l4_timeout_t timeout) L4_NOTHROW; /** * \defgroup l4_ipc_rt_api Realtime API * \ingroup l4_ipc_api * \internal */ #if 0 /** * Wait for next period. * \ingroup l4_ipc_rt_api * * \param utcb UTCB of the caller. * \param label Label * \param timeout IPC timeout (see #l4_ipc_timeout). * * \return result tag */ L4_INLINE l4_msgtag_t <API key>(l4_utcb_t *utcb, l4_umword_t *label, l4_timeout_t timeout); #endif /** * \brief Generic L4 object invocation. * \ingroup l4_ipc_api * * \param dest Destination object. * \param utcb UTCB of the caller. * \param flags Invocation flags (see #l4_syscall_flags_t). * \param slabel Send label if applicable (may be seen by the receiver). * \param tag Sending message tag. * \retval rlabel Receiving label. * \param timeout Timeout pair (see #l4_timeout_t). * * \return return tag */ L4_INLINE l4_msgtag_t l4_ipc(l4_cap_idx_t dest, l4_utcb_t *utcb, l4_umword_t flags, l4_umword_t slabel, l4_msgtag_t tag, l4_umword_t *rlabel, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Sleep for an amount of time. * \ingroup l4_ipc_api * * \param timeout Timeout pair (see #l4_timeout_t, the receive part matters). * * \return error code: * - #L4_IPC_RETIMEOUT: success * - #L4_IPC_RECANCELED woken up by a different thread * (l4_thread_ex_regs()). * * The invoking thread waits until the timeout * is expired or the wait was aborted by another thread by l4_thread_ex_regs(). */ L4_INLINE l4_msgtag_t l4_ipc_sleep(l4_timeout_t timeout) L4_NOTHROW; /** * \brief Add a flex-page to be sent to the UTCB * \ingroup l4_ipc_api * * \param snd_fpage Flex-page. * \param snd_base Send base. * \param tag Tag to be modified. * \retval tag Modified tag, the number of items will be increased, * all other values in the tag will be retained. * * \return 0 on success, negative error code otherwise */ L4_INLINE int l4_sndfpage_add(l4_fpage_t const snd_fpage, unsigned long snd_base, l4_msgtag_t *tag) L4_NOTHROW; /* * \internal * \ingroup l4_ipc_api */ L4_INLINE int l4_sndfpage_add_u(l4_fpage_t const snd_fpage, unsigned long snd_base, l4_msgtag_t *tag, l4_utcb_t *utcb) L4_NOTHROW; L4_INLINE l4_umword_t l4_ipc_error(l4_msgtag_t tag, l4_utcb_t *utcb) L4_NOTHROW { if (!l4_msgtag_has_error(tag)) return 0; return l4_utcb_tcr_u(utcb)->error & L4_IPC_ERROR_MASK; } L4_INLINE long l4_error_u(l4_msgtag_t tag, l4_utcb_t *u) L4_NOTHROW { if (l4_msgtag_has_error(tag)) return -(L4_EIPC_LO + (l4_utcb_tcr_u(u)->error & L4_IPC_ERROR_MASK)); return l4_msgtag_label(tag); } L4_INLINE long l4_error(l4_msgtag_t tag) L4_NOTHROW { return l4_error_u(tag, l4_utcb()); } L4_INLINE int l4_ipc_is_snd_error(l4_utcb_t *u) L4_NOTHROW { return !(l4_utcb_tcr_u(u)->error & 1) == 0; } L4_INLINE int l4_ipc_is_rcv_error(l4_utcb_t *u) L4_NOTHROW { return l4_utcb_tcr_u(u)->error & 1; } L4_INLINE int l4_ipc_error_code(l4_utcb_t *u) L4_NOTHROW { return l4_utcb_tcr_u(u)->error & L4_IPC_ERROR_MASK; } /* * \internal * \ingroup l4_ipc_api */ L4_INLINE int l4_sndfpage_add_u(l4_fpage_t const snd_fpage, unsigned long snd_base, l4_msgtag_t *tag, l4_utcb_t *utcb) L4_NOTHROW { l4_msg_regs_t *v = l4_utcb_mr_u(utcb); int i = l4_msgtag_words(*tag) + 2 * l4_msgtag_items(*tag); if (i >= <API key> - 1) return -L4_ENOMEM; v->mr[i] = snd_base | L4_ITEM_MAP | L4_ITEM_CONT; v->mr[i + 1] = snd_fpage.raw; *tag = l4_msgtag(l4_msgtag_label(*tag), l4_msgtag_words(*tag), l4_msgtag_items(*tag) + 1, l4_msgtag_flags(*tag)); return 0; } L4_INLINE int l4_sndfpage_add(l4_fpage_t const snd_fpage, unsigned long snd_base, l4_msgtag_t *tag) L4_NOTHROW { return l4_sndfpage_add_u(snd_fpage, snd_base, tag, l4_utcb()); } #endif /* ! <API key> */
#include "ftdefs.h" typedef struct st_ft_docstat { FT_WORD *list; uint uniq; double sum; } FT_DOCSTAT; typedef struct <API key> { TREE *wtree; MEM_ROOT *mem_root; } MY_FT_PARSER_PARAM; static int FT_WORD_cmp(CHARSET_INFO* cs, FT_WORD *w1, FT_WORD *w2) { return ha_compare_text(cs, (uchar*) w1->pos, w1->len, (uchar*) w2->pos, w2->len, 0); } static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat) { word->weight=LWS_IN_USE; docstat->sum+=word->weight; memcpy((docstat->list)++, word, sizeof(FT_WORD)); return 0; } /* transforms tree of words into the array, applying normalization */ FT_WORD * ft_linearize(TREE *wtree, MEM_ROOT *mem_root) { FT_WORD *wlist,*p; FT_DOCSTAT docstat; DBUG_ENTER("ft_linearize"); if ((wlist=(FT_WORD *) alloc_root(mem_root, sizeof(FT_WORD)* (1+wtree->elements_in_tree)))) { docstat.list=wlist; docstat.uniq=wtree->elements_in_tree; docstat.sum=0; tree_walk(wtree,(tree_walk_action)&walk_and_copy,&docstat,left_root_right); } delete_tree(wtree, 0); if (!wlist) DBUG_RETURN(NULL); docstat.list->pos=NULL; for (p=wlist;p->pos;p++) { p->weight=PRENORM_IN_USE; } for (p=wlist;p->pos;p++) { p->weight/=NORM_IN_USE; } DBUG_RETURN(wlist); } my_bool <API key>(const uchar *str) { uint i, j; if (!str || (strlen((char*) str)+1 != sizeof(DEFAULT_FTB_SYNTAX)) || (str[0] != ' ' && str[1] != ' ')) return 1; for (i=0; i<sizeof(DEFAULT_FTB_SYNTAX); i++) { /* limiting to 7-bit ascii only */ if ((unsigned char)(str[i]) > 127 || my_isalnum(<API key>, str[i])) return 1; for (j=0; j<i; j++) if (str[i] == str[j] && (i != 11 || j != 10)) return 1; } return 0; } /* RETURN VALUE 0 - eof 1 - word found 2 - left bracket 3 - right bracket 4 - stopword found */ uchar ft_get_word(CHARSET_INFO *cs, const uchar **start, const uchar *end, FT_WORD *word, <API key> *param) { const uchar *doc=*start; int ctype; uint mwc, length; int mbl; param->yesno=(FTB_YES==' ') ? 1 : (param->quot != 0); param->weight_adjust= param->wasign= 0; param->type= FT_TOKEN_EOF; while (doc<end) { for (; doc < end; doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) { mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); if (true_word_char(ctype, *doc)) break; if (*doc == FTB_RQUOT && param->quot) { *start=doc+1; param->type= <API key>; goto ret; } if (!param->quot) { if (*doc == FTB_LBR || *doc == FTB_RBR || *doc == FTB_LQUOT) { /* param->prev=' '; */ *start=doc+1; if (*doc == FTB_LQUOT) param->quot= (char*) 1; param->type= (*doc == FTB_RBR ? <API key> : FT_TOKEN_LEFT_PAREN); goto ret; } if (param->prev == ' ') { if (*doc == FTB_YES ) { param->yesno=+1; continue; } else if (*doc == FTB_EGAL) { param->yesno= 0; continue; } else if (*doc == FTB_NO ) { param->yesno=-1; continue; } else if (*doc == FTB_INC ) { param->weight_adjust++; continue; } else if (*doc == FTB_DEC ) { param->weight_adjust--; continue; } else if (*doc == FTB_NEG ) { param->wasign= !param->wasign; continue; } } } param->prev=*doc; param->yesno=(FTB_YES==' ') ? 1 : (param->quot != 0); param->weight_adjust= param->wasign= 0; } mwc=length=0; for (word->pos= doc; doc < end; length++, doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) { mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); if (true_word_char(ctype, *doc)) mwc=0; else if (!misc_word_char(*doc) || mwc) break; else mwc++; } param->prev='A'; /* be sure *prev is true_word_char */ word->len= (uint)(doc-word->pos) - mwc; if ((param->trunc=(doc<end && *doc == FTB_TRUNC))) doc++; if (((length >= ft_min_word_len && !is_stopword((char*) word->pos, word->len)) || param->trunc) && length < ft_max_word_len) { *start=doc; param->type= FT_TOKEN_WORD; goto ret; } else if (length) /* make sure length > 0 (if start contains spaces only) */ { *start= doc; param->type= FT_TOKEN_STOPWORD; goto ret; } } if (param->quot) { *start= doc; param->type= 3; /* FT_RBR */ goto ret; } ret: return param->type; } uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end, FT_WORD *word, my_bool skip_stopwords) { uchar *doc= *start; uint mwc, length; int mbl; int ctype; DBUG_ENTER("ft_simple_get_word"); do { for (;; doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) { if (doc >= end) DBUG_RETURN(0); mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); if (true_word_char(ctype, *doc)) break; } mwc= length= 0; for (word->pos= doc; doc < end; length++, doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) { mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); if (true_word_char(ctype, *doc)) mwc= 0; else if (!misc_word_char(*doc) || mwc) break; else mwc++; } word->len= (uint)(doc-word->pos) - mwc; if (skip_stopwords == FALSE || (length >= ft_min_word_len && length < ft_max_word_len && !is_stopword((char*) word->pos, word->len))) { *start= doc; DBUG_RETURN(1); } } while (doc < end); DBUG_RETURN(0); } void ft_parse_init(TREE *wtree, CHARSET_INFO *cs) { DBUG_ENTER("ft_parse_init"); if (!is_tree_inited(wtree)) init_tree(wtree, 0, 0, sizeof(FT_WORD), (qsort_cmp2)&FT_WORD_cmp, 0, (void*)cs, MYF(0)); DBUG_VOID_RETURN; } static int ft_add_word(<API key> *param, const char *word, int word_len, <API key> *boolean_info __attribute__((unused))) { TREE *wtree; FT_WORD w; MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam; DBUG_ENTER("ft_add_word"); wtree= ft_param->wtree; if (param->flags & <API key>) { uchar *ptr; DBUG_ASSERT(wtree->with_delete == 0); ptr= (uchar *)alloc_root(ft_param->mem_root, word_len); memcpy(ptr, word, word_len); w.pos= ptr; } else w.pos= (uchar*) word; w.len= word_len; if (!tree_insert(wtree, &w, 0, wtree->custom_arg)) { delete_tree(wtree, 0); DBUG_RETURN(1); } DBUG_RETURN(0); } static int ft_parse_internal(<API key> *param, const char *doc_arg, int doc_len) { uchar *doc= (uchar*) doc_arg; uchar *end= doc + doc_len; MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam; TREE *wtree= ft_param->wtree; FT_WORD w; DBUG_ENTER("ft_parse_internal"); while (ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE)) if (param->mysql_add_word(param, (char*) w.pos, w.len, 0)) DBUG_RETURN(1); DBUG_RETURN(0); } int ft_parse(TREE *wtree, uchar *doc, int doclen, struct st_mysql_ftparser *parser, <API key> *param, MEM_ROOT *mem_root) { MY_FT_PARSER_PARAM my_param; DBUG_ENTER("ft_parse"); DBUG_ASSERT(parser); my_param.wtree= wtree; my_param.mem_root= mem_root; param->mysql_parse= ft_parse_internal; param->mysql_add_word= ft_add_word; param->mysql_ftparam= &my_param; param->cs= wtree->custom_arg; param->doc= (char*) doc; param->length= doclen; param->mode= <API key>; DBUG_RETURN(parser->parse(param)); } #define MAX_PARAM_NR 2 <API key>* <API key>(MI_INFO *info) { if (!info->ftparser_param) { /* . info->ftparser_param can not be zero after the initialization, because it always includes built-in fulltext parser. And built-in parser can be called even if the table has no fulltext indexes and no varchar/text fields. ftb_find_relevance... parser (<API key>, <API key>) calls ftb_check_phrase... parser (<API key>, ftb_phrase_add_word). Thus MAX_PARAM_NR=2. */ info->ftparser_param= (<API key> *) my_malloc(MAX_PARAM_NR * sizeof(<API key>) * info->s->ftkeys, MYF(MY_WME | MY_ZEROFILL)); init_alloc_root(&info->ft_memroot, <API key>, 0, MYF(0)); } return info->ftparser_param; } <API key> *<API key>(MI_INFO *info, uint keynr, uint paramnr) { uint32 ftparser_nr; struct st_mysql_ftparser *parser; if (!<API key>(info)) return 0; if (keynr == NO_SUCH_KEY) { ftparser_nr= 0; parser= &ft_default_parser; } else { ftparser_nr= info->s->keyinfo[keynr].ftkey_nr; parser= info->s->keyinfo[keynr].parser; } DBUG_ASSERT(paramnr < MAX_PARAM_NR); ftparser_nr= ftparser_nr*MAX_PARAM_NR + paramnr; if (! info->ftparser_param[ftparser_nr].mysql_add_word) { /* Note, that mysql_add_word is used here as a flag: mysql_add_word == 0 - parser is not initialized mysql_add_word != 0 - parser is initialized, or no initialization needed. */ info->ftparser_param[ftparser_nr].mysql_add_word= (int (*)(struct <API key> *, const char *, int, <API key> *)) 1; if (parser->init && parser->init(&info->ftparser_param[ftparser_nr])) return 0; } return &info->ftparser_param[ftparser_nr]; } void <API key>(MI_INFO *info) { uint i, j, keys= info->s->state.header.keys; free_root(&info->ft_memroot, MYF(0)); if (! info->ftparser_param) return; for (i= 0; i < keys; i++) { MI_KEYDEF *keyinfo= &info->s->keyinfo[i]; for (j=0; j < MAX_PARAM_NR; j++) { <API key> *ftparser_param= &info->ftparser_param[keyinfo->ftkey_nr * MAX_PARAM_NR + j]; if (keyinfo->flag & HA_FULLTEXT && ftparser_param->mysql_add_word) { if (keyinfo->parser->deinit) keyinfo->parser->deinit(ftparser_param); ftparser_param->mysql_add_word= 0; } else break; } } }
<?php /** * ezcomNotification persistent object class definition * */ class ezcomNotification extends eZPersistentObject { /** * Construct, use {@link ezcomNotification::create()} to create new objects. * * @param array $row */ public function __construct( $row ) { parent::__construct( $row ); } /** * Fields definition * * @return array */ public static function definition() { static $def = array( 'fields' => array( 'id' => array( 'name' => 'ID', 'datatype' => 'integer', 'default' => 0, 'required' => true ), 'contentobject_id' => array( 'name' => 'ContentObjectID', 'datatype' => 'integer', 'default' => 0, 'required' => true ), 'language_id' => array( 'name' => 'LanguageID', 'datatype' => 'integer', 'default' => 0, 'required' => true ), 'send_time' => array( 'name' => 'SendTime', 'datatype' => 'integer', 'default' => 0, 'required' => true ), 'status' => array( 'name' => 'Status', 'datatype' => 'integer', 'default' => 1, 'required' => true ), 'comment_id' => array( 'name' => 'CommentID', 'datatype' => 'integer', 'default' => 0, 'required' => true ) ), 'keys' => array( 'id' ), 'function_attributes' => array(), 'increment_key' => 'id', 'class_name' => 'ezcomNotification', 'name' => '<API key>' ); return $def; } /** * Create new ezcomNotification object * * @static * @param array $row * @return ezcomNotification */ public static function create( $row = array() ) { $object = new self( $row ); return $object; } /** * Fetch notification by given id * * @param int $id * @return null|ezcomNotification */ static function fetch( $id ) { $cond = array( 'id' => $id ); $return = eZPersistentObject::fetchObject( self::definition(), null, $cond ); return $return; } /** * Fetch the list of notification * @param $length: count of the notification to be fetched * @param $status: the status of the notification * @param $offset: offset * @return notification list */ static function <API key>( $status = 1, $length = null, $offset = 0, $sorts = null ) { $cond = array(); if ( is_null( $status ) ) { $cond = null; } else { $cond['status'] = $status; } $limit = array(); if ( is_null( $length ) ) { $limit = null; } else { $limit['offset'] = $offset; $limit['length'] = $length; } return eZPersistentObject::fetchObjectList( self::definition(), null, $cond, $sorts, $limit ); } /** * clean up the notification quque * @param unknown_type $contentObjectID * @param unknown_type $languageID * @param unknown_type $commentID * @return unknown_type */ public static function cleanUpNotification( $contentObjectID, $language ) { //1. fetch the queue, judge if there is data } } ?>
#include <linux/time.h> #include <linux/fs.h> #include <linux/jbd2.h> #include <linux/stat.h> #include <linux/string.h> #include <linux/quotaops.h> #include <linux/buffer_head.h> #include <linux/random.h> #include <linux/bitops.h> #include <linux/blkdev.h> #include <asm/byteorder.h> #include "ext4.h" #include "ext4_jbd2.h" #include "xattr.h" #include "acl.h" #include <trace/events/ext4.h> /* * ialloc.c contains the inodes allocation and deallocation routines */ /* * The free inodes are managed by bitmaps. A file system contains several * blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap * block for inodes, N blocks for the inode table and data blocks. * * The file system contains group descriptors which are located after the * super block. Each descriptor contains the number of the bitmap block and * the free blocks count in the block. */ /* * To avoid calling the atomic setbit hundreds or thousands of times, we only * need to use it within a single byte (to ensure we get endianness right). * We can use memset for the rest of the bitmap as there are no other users. */ void <API key>(int start_bit, int end_bit, char *bitmap) { int i; if (start_bit >= end_bit) return; ext4_debug("mark end bits +%d through +%d used\n", start_bit, end_bit); for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++) ext4_set_bit(i, bitmap); if (i < end_bit) memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3); } /* Initializes an uninitialized inode bitmap */ static unsigned <API key>(struct super_block *sb, struct buffer_head *bh, ext4_group_t block_group, struct ext4_group_desc *gdp) { struct ext4_sb_info *sbi = EXT4_SB(sb); J_ASSERT_BH(bh, buffer_locked(bh)); /* If checksum is bad mark all blocks and inodes use to prevent * allocation, essentially implementing a per-group read-only flag. */ if (!<API key>(sbi, block_group, gdp)) { ext4_error(sb, "Checksum bad for group %u", block_group); <API key>(sb, gdp, 0); <API key>(sb, gdp, 0); <API key>(sb, gdp, 0); memset(bh->b_data, 0xff, sb->s_blocksize); return 0; } memset(bh->b_data, 0, (<API key>(sb) + 7) / 8); <API key>(<API key>(sb), sb->s_blocksize * 8, bh->b_data); return <API key>(sb); } void <API key>(struct buffer_head *bh, int uptodate) { if (uptodate) { set_buffer_uptodate(bh); set_bitmap_uptodate(bh); } unlock_buffer(bh); put_bh(bh); } /* * Read the inode allocation bitmap for a given block_group, reading * into the specified slot in the superblock's bitmap cache. * * Return buffer_head of bitmap on success or NULL. */ static struct buffer_head * <API key>(struct super_block *sb, ext4_group_t block_group) { struct ext4_group_desc *desc; struct buffer_head *bh = NULL; ext4_fsblk_t bitmap_blk; desc = ext4_get_group_desc(sb, block_group, NULL); if (!desc) return NULL; bitmap_blk = ext4_inode_bitmap(sb, desc); bh = sb_getblk(sb, bitmap_blk); if (unlikely(!bh)) { ext4_error(sb, "Cannot read inode bitmap - " "block_group = %u, inode_bitmap = %llu", block_group, bitmap_blk); return NULL; } if (bitmap_uptodate(bh)) return bh; lock_buffer(bh); if (bitmap_uptodate(bh)) { unlock_buffer(bh); return bh; } ext4_lock_group(sb, block_group); if (desc->bg_flags & cpu_to_le16(<API key>)) { <API key>(sb, bh, block_group, desc); set_bitmap_uptodate(bh); set_buffer_uptodate(bh); ext4_unlock_group(sb, block_group); unlock_buffer(bh); return bh; } ext4_unlock_group(sb, block_group); if (buffer_uptodate(bh)) { /* * if not uninit if bh is uptodate, * bitmap is also uptodate */ set_bitmap_uptodate(bh); unlock_buffer(bh); return bh; } /* * submit the buffer_head for reading */ <API key>(sb, block_group); bh->b_end_io = <API key>; get_bh(bh); submit_bh(READ, bh); wait_on_buffer(bh); if (!buffer_uptodate(bh)) { put_bh(bh); ext4_error(sb, "Cannot read inode bitmap - " "block_group = %u, inode_bitmap = %llu", block_group, bitmap_blk); return NULL; } return bh; } /* * NOTE! When we get the inode, we're the only people * that have access to it, and as such there are no * race conditions we have to worry about. The inode * is not on the hash-lists, and it cannot be reached * through the filesystem because the directory entry * has been deleted earlier. * * HOWEVER: we must make sure that we get no aliases, * which means that we have to call "clear_inode()" * _before_ we mark the inode not in use in the inode * bitmaps. Otherwise a newly created file might use * the same inode number (not actually the same pointer * though), and then we'd have two inodes sharing the * same inode number and space on the harddisk. */ void ext4_free_inode(handle_t *handle, struct inode *inode) { struct super_block *sb = inode->i_sb; int is_directory; unsigned long ino; struct buffer_head *bitmap_bh = NULL; struct buffer_head *bh2; ext4_group_t block_group; unsigned long bit; struct ext4_group_desc *gdp; struct ext4_super_block *es; struct ext4_sb_info *sbi; int fatal = 0, err, count, cleared; if (!sb) { printk(KERN_ERR "EXT4-fs: %s:%d: inode on " "nonexistent device\n", __func__, __LINE__); return; } if (atomic_read(&inode->i_count) > 1) { ext4_msg(sb, KERN_ERR, "%s:%d: inode #%lu: count=%d", __func__, __LINE__, inode->i_ino, atomic_read(&inode->i_count)); return; } if (inode->i_nlink) { ext4_msg(sb, KERN_ERR, "%s:%d: inode #%lu: nlink=%d\n", __func__, __LINE__, inode->i_ino, inode->i_nlink); return; } sbi = EXT4_SB(sb); ino = inode->i_ino; ext4_debug("freeing inode %lu\n", ino); <API key>(inode); /* * Note: we must free any quota before locking the superblock, * as writing the quota to disk may need the lock as well. */ dquot_initialize(inode); <API key>(handle, inode); dquot_free_inode(inode); dquot_drop(inode); is_directory = S_ISDIR(inode->i_mode); /* Do this BEFORE marking the inode not in use or returning an error */ ext4_clear_inode(inode); es = EXT4_SB(sb)->s_es; if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { ext4_error(sb, "reserved or nonexistent inode %lu", ino); goto error_return; } block_group = (ino - 1) / <API key>(sb); bit = (ino - 1) % <API key>(sb); bitmap_bh = <API key>(sb, block_group); if (!bitmap_bh) goto error_return; BUFFER_TRACE(bitmap_bh, "get_write_access"); fatal = <API key>(handle, bitmap_bh); if (fatal) goto error_return; fatal = -ESRCH; gdp = ext4_get_group_desc(sb, block_group, &bh2); if (gdp) { BUFFER_TRACE(bh2, "get_write_access"); fatal = <API key>(handle, bh2); } ext4_lock_group(sb, block_group); cleared = <API key>(bit, bitmap_bh->b_data); if (fatal || !cleared) { ext4_unlock_group(sb, block_group); goto out; } count = <API key>(sb, gdp) + 1; <API key>(sb, gdp, count); if (is_directory) { count = <API key>(sb, gdp) - 1; ext4_used_dirs_set(sb, gdp, count); percpu_counter_dec(&sbi->s_dirs_counter); } gdp->bg_checksum = <API key>(sbi, block_group, gdp); ext4_unlock_group(sb, block_group); percpu_counter_inc(&sbi-><API key>); if (sbi-><API key>) { ext4_group_t f = ext4_flex_group(sbi, block_group); atomic_inc(&sbi->s_flex_groups[f].free_inodes); if (is_directory) atomic_dec(&sbi->s_flex_groups[f].used_dirs); } BUFFER_TRACE(bh2, "call <API key>"); fatal = <API key>(handle, NULL, bh2); out: if (cleared) { BUFFER_TRACE(bitmap_bh, "call <API key>"); err = <API key>(handle, NULL, bitmap_bh); if (!fatal) fatal = err; <API key>(sb); } else { /* for debugging, sangwoo2.lee */ print_bh(sb, bitmap_bh, 0, EXT4_BLOCK_SIZE(sb)); /* for debugging */ ext4_error(sb, "bit already cleared for inode %lu", ino); } error_return: brelse(bitmap_bh); ext4_std_error(sb, fatal); } struct orlov_stats { __u64 free_clusters; __u32 free_inodes; __u32 used_dirs; }; /* * Helper function for Orlov's allocator; returns critical information * for a particular block group or flex_bg. If flex_size is 1, then g * is a block group number; otherwise it is flex_bg number. */ static void get_orlov_stats(struct super_block *sb, ext4_group_t g, int flex_size, struct orlov_stats *stats) { struct ext4_group_desc *desc; struct flex_groups *flex_group = EXT4_SB(sb)->s_flex_groups; if (flex_size > 1) { stats->free_inodes = atomic_read(&flex_group[g].free_inodes); stats->free_clusters = atomic64_read(&flex_group[g].free_clusters); stats->used_dirs = atomic_read(&flex_group[g].used_dirs); return; } desc = ext4_get_group_desc(sb, g, NULL); if (desc) { stats->free_inodes = <API key>(sb, desc); stats->free_clusters = <API key>(sb, desc); stats->used_dirs = <API key>(sb, desc); } else { stats->free_inodes = 0; stats->free_clusters = 0; stats->used_dirs = 0; } } /* * Orlov's allocator for directories. * * We always try to spread first-level directories. * * If there are blockgroups with both free inodes and free blocks counts * not worse than average we return one with smallest directory count. * Otherwise we simply return a random group. * * For the rest rules look so: * * It's OK to put directory into a group unless * it has too many directories already (max_dirs) or * it has too few free inodes left (min_inodes) or * it has too few free blocks left (min_blocks) or * Parent's group is preferred, if it doesn't satisfy these * conditions we search cyclically through the rest. If none * of the groups look good we just look for a group with more * free inodes than average (starting at parent's group). */ static int find_group_orlov(struct super_block *sb, struct inode *parent, ext4_group_t *group, umode_t mode, const struct qstr *qstr) { ext4_group_t parent_group = EXT4_I(parent)->i_block_group; struct ext4_sb_info *sbi = EXT4_SB(sb); ext4_group_t real_ngroups = <API key>(sb); int inodes_per_group = <API key>(sb); unsigned int freei, avefreei, grp_free; ext4_fsblk_t freeb, avefreec; unsigned int ndirs; int max_dirs, min_inodes; ext4_grpblk_t min_clusters; ext4_group_t i, grp, g, ngroups; struct ext4_group_desc *desc; struct orlov_stats stats; int flex_size = ext4_flex_bg_size(sbi); struct dx_hash_info hinfo; ngroups = real_ngroups; if (flex_size > 1) { ngroups = (real_ngroups + flex_size - 1) >> sbi-><API key>; parent_group >>= sbi-><API key>; } freei = <API key>(&sbi-><API key>); avefreei = freei / ngroups; freeb = EXT4_C2B(sbi, <API key>(&sbi-><API key>)); avefreec = freeb; do_div(avefreec, ngroups); ndirs = <API key>(&sbi->s_dirs_counter); if (S_ISDIR(mode) && ((parent == sb->s_root->d_inode) || (<API key>(parent, EXT4_INODE_TOPDIR)))) { int best_ndir = inodes_per_group; int ret = -1; if (qstr) { hinfo.hash_version = DX_HASH_HALF_MD4; hinfo.seed = sbi->s_hash_seed; ext4fs_dirhash(qstr->name, qstr->len, &hinfo); grp = hinfo.hash; } else get_random_bytes(&grp, sizeof(grp)); parent_group = (unsigned)grp % ngroups; for (i = 0; i < ngroups; i++) { g = (parent_group + i) % ngroups; get_orlov_stats(sb, g, flex_size, &stats); if (!stats.free_inodes) continue; if (stats.used_dirs >= best_ndir) continue; if (stats.free_inodes < avefreei) continue; if (stats.free_clusters < avefreec) continue; grp = g; ret = 0; best_ndir = stats.used_dirs; } if (ret) goto fallback; found_flex_bg: if (flex_size == 1) { *group = grp; return 0; } /* * We pack inodes at the beginning of the flexgroup's * inode tables. Block allocation decisions will do * something similar, although regular files will * start at 2nd block group of the flexgroup. See * ext4_ext_find_goal() and ext4_find_near(). */ grp *= flex_size; for (i = 0; i < flex_size; i++) { if (grp+i >= real_ngroups) break; desc = ext4_get_group_desc(sb, grp+i, NULL); if (desc && <API key>(sb, desc)) { *group = grp+i; return 0; } } goto fallback; } max_dirs = ndirs / ngroups + inodes_per_group / 16; min_inodes = avefreei - inodes_per_group*flex_size / 4; if (min_inodes < 1) min_inodes = 1; min_clusters = avefreec - <API key>(sb)*flex_size / 4; /* * Start looking in the flex group where we last allocated an * inode for this parent directory */ if (EXT4_I(parent)->i_last_alloc_group != ~0) { parent_group = EXT4_I(parent)->i_last_alloc_group; if (flex_size > 1) parent_group >>= sbi-><API key>; } for (i = 0; i < ngroups; i++) { grp = (parent_group + i) % ngroups; get_orlov_stats(sb, grp, flex_size, &stats); if (stats.used_dirs >= max_dirs) continue; if (stats.free_inodes < min_inodes) continue; if (stats.free_clusters < min_clusters) continue; goto found_flex_bg; } fallback: ngroups = real_ngroups; avefreei = freei / ngroups; fallback_retry: parent_group = EXT4_I(parent)->i_block_group; for (i = 0; i < ngroups; i++) { grp = (parent_group + i) % ngroups; desc = ext4_get_group_desc(sb, grp, NULL); if (desc) { grp_free = <API key>(sb, desc); if (grp_free && grp_free >= avefreei) { *group = grp; return 0; } } } if (avefreei) { /* * The free-inodes counter is approximate, and for really small * filesystems the above test can fail to find any blockgroups */ avefreei = 0; goto fallback_retry; } return -1; } static int find_group_other(struct super_block *sb, struct inode *parent, ext4_group_t *group, umode_t mode) { ext4_group_t parent_group = EXT4_I(parent)->i_block_group; ext4_group_t i, last, ngroups = <API key>(sb); struct ext4_group_desc *desc; int flex_size = ext4_flex_bg_size(EXT4_SB(sb)); /* * Try to place the inode is the same flex group as its * parent. If we can't find space, use the Orlov algorithm to * find another flex group, and store that information in the * parent directory's inode information so that use that flex * group for future allocations. */ if (flex_size > 1) { int retry = 0; try_again: parent_group &= ~(flex_size-1); last = parent_group + flex_size; if (last > ngroups) last = ngroups; for (i = parent_group; i < last; i++) { desc = ext4_get_group_desc(sb, i, NULL); if (desc && <API key>(sb, desc)) { *group = i; return 0; } } if (!retry && EXT4_I(parent)->i_last_alloc_group != ~0) { retry = 1; parent_group = EXT4_I(parent)->i_last_alloc_group; goto try_again; } /* * If this didn't work, use the Orlov search algorithm * to find a new flex group; we pass in the mode to * avoid the topdir algorithms. */ *group = parent_group + flex_size; if (*group > ngroups) *group = 0; return find_group_orlov(sb, parent, group, mode, NULL); } /* * Try to place the inode in its parent directory */ *group = parent_group; desc = ext4_get_group_desc(sb, *group, NULL); if (desc && <API key>(sb, desc) && <API key>(sb, desc)) return 0; /* * We're going to place this inode in a different blockgroup from its * parent. We want to cause files in a common directory to all land in * the same blockgroup. But we want files which are in a different * directory which shares a blockgroup with our parent to land in a * different blockgroup. * * So add our directory's i_ino into the starting point for the hash. */ *group = (*group + parent->i_ino) % ngroups; /* * Use a quadratic hash to find a group with a free inode and some free * blocks. */ for (i = 1; i < ngroups; i <<= 1) { *group += i; if (*group >= ngroups) *group -= ngroups; desc = ext4_get_group_desc(sb, *group, NULL); if (desc && <API key>(sb, desc) && <API key>(sb, desc)) return 0; } /* * That failed: try linear search for a free inode, even if that group * has no free blocks. */ *group = parent_group; for (i = 0; i < ngroups; i++) { if (++*group >= ngroups) *group = 0; desc = ext4_get_group_desc(sb, *group, NULL); if (desc && <API key>(sb, desc)) return 0; } return -1; } /* * There are two policies for allocating an inode. If the new inode is * a directory, then a forward search is made for a block group with both * free space and a low directory-to-inode ratio; if that fails, then of * the groups with above-average free space, that group with the fewest * directories already is chosen. * * For other inodes, search forward from the parent directory's block * group to find a free inode. */ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, umode_t mode, const struct qstr *qstr, __u32 goal, uid_t *owner, int nblocks) { struct super_block *sb; struct buffer_head *inode_bitmap_bh = NULL; struct buffer_head *group_desc_bh; ext4_group_t ngroups, group = 0; unsigned long ino = 0; struct inode *inode; struct ext4_group_desc *gdp = NULL; struct ext4_inode_info *ei; struct ext4_sb_info *sbi; int ret2, err = 0; struct inode *ret; ext4_group_t i; ext4_group_t flex_group; /* Cannot create files in a deleted directory */ if (!dir || !dir->i_nlink) return ERR_PTR(-EPERM); sb = dir->i_sb; ngroups = <API key>(sb); <API key>(dir, mode); inode = new_inode(sb); if (!inode) return ERR_PTR(-ENOMEM); ei = EXT4_I(inode); sbi = EXT4_SB(sb); if (!goal) goal = sbi->s_inode_goal; if (goal && goal <= le32_to_cpu(sbi->s_es->s_inodes_count)) { group = (goal - 1) / <API key>(sb); ino = (goal - 1) % <API key>(sb); ret2 = 0; goto got_group; } if (S_ISDIR(mode)) ret2 = find_group_orlov(sb, dir, &group, mode, qstr); else ret2 = find_group_other(sb, dir, &group, mode); got_group: EXT4_I(dir)->i_last_alloc_group = group; err = -ENOSPC; if (ret2 == -1) goto out; /* * Normally we will only go through one pass of this loop, * unless we get unlucky and it turns out the group we selected * had its last inode grabbed by someone else. */ for (i = 0; i < ngroups; i++, ino = 0) { err = -EIO; gdp = ext4_get_group_desc(sb, group, &group_desc_bh); if (!gdp) { ext4_debug("ext4_get_group_desc error: %d\n", group); print_bh(sb, group_desc_bh, 0, EXT4_BLOCK_SIZE(sb)); goto fail; } if (inode_bitmap_bh) { <API key>(handle, inode_bitmap_bh); brelse(inode_bitmap_bh); } inode_bitmap_bh = <API key>(sb, group); if (!inode_bitmap_bh) { ext4_debug("<API key> error: %d\n", group); goto fail; } <API key>: ino = <API key>((unsigned long *) inode_bitmap_bh->b_data, <API key>(sb), ino); if (ino >= <API key>(sb)) goto next_group; if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) { ext4_error(sb, "reserved inode found cleared - " "inode=%lu", ino + 1); continue; } if (!handle) { BUG_ON(nblocks <= 0); handle = <API key>(dir->i_sb, nblocks); if (IS_ERR(handle)) { err = PTR_ERR(handle); goto fail; } } BUFFER_TRACE(inode_bitmap_bh, "get_write_access"); err = <API key>(handle, inode_bitmap_bh); if (err) goto fail; ext4_lock_group(sb, group); ret2 = <API key>(ino, inode_bitmap_bh->b_data); ext4_unlock_group(sb, group); ino++; /* the inode bitmap is zero-based */ if (!ret2) goto got; /* we grabbed the inode! */ if (ino < <API key>(sb)) goto <API key>; next_group: if (++group == ngroups) group = 0; } <API key>(handle, inode_bitmap_bh); err = -ENOSPC; goto out; got: BUFFER_TRACE(inode_bitmap_bh, "call <API key>"); err = <API key>(handle, NULL, inode_bitmap_bh); if (err) { ext4_debug("<API key> error\n"); goto fail; } /* We may have to initialize the block bitmap if it isn't already */ if (<API key>(sb, <API key>) && gdp->bg_flags & cpu_to_le16(<API key>)) { struct buffer_head *block_bitmap_bh; block_bitmap_bh = <API key>(sb, group); if (!block_bitmap_bh) { err = -EIO; goto out; } BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); err = <API key>(handle, block_bitmap_bh); if (err) { brelse(block_bitmap_bh); ext4_debug("<API key> error\n"); goto fail; } BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap"); err = <API key>(handle, NULL, block_bitmap_bh); /* recheck and clear flag under lock if we still need to */ ext4_lock_group(sb, group); if (gdp->bg_flags & cpu_to_le16(<API key>)) { gdp->bg_flags &= cpu_to_le16(~<API key>); <API key>(sb, gdp, <API key>(sb, group, gdp)); gdp->bg_checksum = <API key>(sbi, group, gdp); } ext4_unlock_group(sb, group); brelse(block_bitmap_bh); if (err) { ext4_debug("<API key> error\n"); goto fail; } } BUFFER_TRACE(group_desc_bh, "get_write_access"); err = <API key>(handle, group_desc_bh); if (err) { ext4_debug("<API key> error\n"); goto fail; } /* Update the relevant bg descriptor fields */ if (<API key>(sb, <API key>)) { int free; struct ext4_group_info *grp = ext4_get_group_info(sb, group); down_read(&grp->alloc_sem); /* protect vs itable lazyinit */ ext4_lock_group(sb, group); /* while we modify the bg desc */ free = <API key>(sb) - <API key>(sb, gdp); if (gdp->bg_flags & cpu_to_le16(<API key>)) { gdp->bg_flags &= cpu_to_le16(~<API key>); free = 0; } /* * Check the relative inode number against the last used * relative inode number in this group. if it is greater * we need to update the bg_itable_unused count */ if (ino > free) <API key>(sb, gdp, (<API key>(sb) - ino)); up_read(&grp->alloc_sem); } else { ext4_lock_group(sb, group); } <API key>(sb, gdp, <API key>(sb, gdp) - 1); if (S_ISDIR(mode)) { ext4_used_dirs_set(sb, gdp, <API key>(sb, gdp) + 1); if (sbi-><API key>) { ext4_group_t f = ext4_flex_group(sbi, group); atomic_inc(&sbi->s_flex_groups[f].used_dirs); } } if (<API key>(sb, <API key>)) { gdp->bg_checksum = <API key>(sbi, group, gdp); } ext4_unlock_group(sb, group); BUFFER_TRACE(group_desc_bh, "call <API key>"); err = <API key>(handle, NULL, group_desc_bh); if (err) { ext4_debug("<API key> error\n"); goto fail; } percpu_counter_dec(&sbi-><API key>); if (S_ISDIR(mode)) percpu_counter_inc(&sbi->s_dirs_counter); <API key>(sb); if (sbi-><API key>) { flex_group = ext4_flex_group(sbi, group); atomic_dec(&sbi->s_flex_groups[flex_group].free_inodes); } if (owner) { inode->i_mode = mode; inode->i_uid = owner[0]; inode->i_gid = owner[1]; } else if (test_opt(sb, GRPID)) { inode->i_mode = mode; inode->i_uid = current_fsuid(); inode->i_gid = dir->i_gid; } else inode_init_owner(inode, dir, mode); inode->i_ino = ino + group * <API key>(sb); /* This is the optimal IO size (for stat), not the fs block size */ inode->i_blocks = 0; inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime = ext4_current_time(inode); memset(ei->i_data, 0, sizeof(ei->i_data)); ei->i_dir_start_lookup = 0; ei->i_disksize = 0; /* Don't inherit extent flag from directory, amongst others. */ ei->i_flags = ext4_mask_flags(mode, EXT4_I(dir)->i_flags & EXT4_FL_INHERITED); ei->i_file_acl = 0; ei->i_dtime = 0; ei->i_block_group = group; ei->i_last_alloc_group = ~0; <API key>(inode); if (IS_DIRSYNC(inode)) ext4_handle_sync(handle); if (insert_inode_locked(inode) < 0) { /* * Likely a bitmap corruption causing inode to be allocated * twice. */ ext4_debug("insert_inode_locked error\n"); if(inode_bitmap_bh) print_bh(sb, inode_bitmap_bh, 0, EXT4_BLOCK_SIZE(sb)); err = -EIO; goto fail; } spin_lock(&sbi->s_next_gen_lock); inode->i_generation = sbi->s_next_generation++; spin_unlock(&sbi->s_next_gen_lock); <API key>(ei); /* Only relevant on 32-bit archs */ <API key>(inode, EXT4_STATE_NEW); ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize; ret = inode; dquot_initialize(inode); err = dquot_alloc_inode(inode); if (err) goto fail_drop; err = ext4_init_acl(handle, inode, dir); if (err) goto fail_free_drop; err = ext4_init_security(handle, inode, dir, qstr); if (err) goto fail_free_drop; if (<API key>(sb, <API key>)) { /* set extent flag only for directory, file and normal symlink*/ if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) { ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS); ext4_ext_tree_init(handle, inode); } } if (ext4_handle_valid(handle)) { ei->i_sync_tid = handle->h_transaction->t_tid; ei->i_datasync_tid = handle->h_transaction->t_tid; } err = <API key>(handle, inode); if (err) { ext4_std_error(sb, err); goto fail_free_drop; } ext4_debug("allocating inode %lu\n", inode->i_ino); <API key>(inode, dir, mode); goto really_out; fail: ext4_std_error(sb, err); out: iput(inode); ret = ERR_PTR(err); really_out: brelse(inode_bitmap_bh); return ret; fail_free_drop: dquot_free_inode(inode); fail_drop: dquot_drop(inode); inode->i_flags |= S_NOQUOTA; clear_nlink(inode); unlock_new_inode(inode); iput(inode); brelse(inode_bitmap_bh); return ERR_PTR(err); } /* Verify that we are loading a valid orphan from disk */ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) { unsigned long max_ino = le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count); ext4_group_t block_group; int bit; struct buffer_head *bitmap_bh; struct inode *inode = NULL; long err = -EIO; /* Error cases - e2fsck has already cleaned up for us */ if (ino > max_ino) { ext4_warning(sb, "bad orphan ino %lu! e2fsck was run?", ino); goto error; } block_group = (ino - 1) / <API key>(sb); bit = (ino - 1) % <API key>(sb); bitmap_bh = <API key>(sb, block_group); if (!bitmap_bh) { ext4_warning(sb, "inode bitmap error for orphan %lu", ino); goto error; } /* Having the inode bit set should be a 100% indicator that this * is a valid orphan (no e2fsck run on fs). Orphans also include * inodes that were being truncated, so we can't check i_nlink==0. */ if (!ext4_test_bit(bit, bitmap_bh->b_data)) goto bad_orphan; inode = ext4_iget(sb, ino); if (IS_ERR(inode)) goto iget_failed; /* * If the orphans has i_nlinks > 0 then it should be able to be * truncated, otherwise it won't be removed from the orphan list * during processing and an infinite loop will result. */ if (inode->i_nlink && !ext4_can_truncate(inode)) goto bad_orphan; if (NEXT_ORPHAN(inode) > max_ino) goto bad_orphan; brelse(bitmap_bh); return inode; iget_failed: err = PTR_ERR(inode); inode = NULL; bad_orphan: ext4_warning(sb, "bad orphan inode %lu! e2fsck was run?", ino); printk(KERN_NOTICE "ext4_test_bit(bit=%d, block=%llu) = %d\n", bit, (unsigned long long)bitmap_bh->b_blocknr, ext4_test_bit(bit, bitmap_bh->b_data)); printk(KERN_NOTICE "inode=%p\n", inode); if (inode) { printk(KERN_NOTICE "is_bad_inode(inode)=%d\n", is_bad_inode(inode)); printk(KERN_NOTICE "NEXT_ORPHAN(inode)=%u\n", NEXT_ORPHAN(inode)); printk(KERN_NOTICE "max_ino=%lu\n", max_ino); printk(KERN_NOTICE "i_nlink=%u\n", inode->i_nlink); /* Avoid freeing blocks if we got a bad deleted inode */ if (inode->i_nlink == 0) inode->i_blocks = 0; iput(inode); } brelse(bitmap_bh); error: return ERR_PTR(err); } unsigned long <API key>(struct super_block *sb) { unsigned long desc_count; struct ext4_group_desc *gdp; ext4_group_t i, ngroups = <API key>(sb); #ifdef EXT4FS_DEBUG struct ext4_super_block *es; unsigned long bitmap_count, x; struct buffer_head *bitmap_bh = NULL; es = EXT4_SB(sb)->s_es; desc_count = 0; bitmap_count = 0; gdp = NULL; for (i = 0; i < ngroups; i++) { gdp = ext4_get_group_desc(sb, i, NULL); if (!gdp) continue; desc_count += <API key>(sb, gdp); brelse(bitmap_bh); bitmap_bh = <API key>(sb, i); if (!bitmap_bh) continue; x = ext4_count_free(bitmap_bh->b_data, <API key>(sb) / 8); printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n", (unsigned long) i, <API key>(sb, gdp), x); bitmap_count += x; } brelse(bitmap_bh); printk(KERN_DEBUG "<API key>: " "stored = %u, computed = %lu, %lu\n", le32_to_cpu(es->s_free_inodes_count), desc_count, bitmap_count); return desc_count; #else desc_count = 0; for (i = 0; i < ngroups; i++) { gdp = ext4_get_group_desc(sb, i, NULL); if (!gdp) continue; desc_count += <API key>(sb, gdp); cond_resched(); } return desc_count; #endif } /* Called at mount-time, super-block is locked */ unsigned long ext4_count_dirs(struct super_block * sb) { unsigned long count = 0; ext4_group_t i, ngroups = <API key>(sb); for (i = 0; i < ngroups; i++) { struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL); if (!gdp) continue; count += <API key>(sb, gdp); } return count; } /* * Zeroes not yet zeroed inode table - just write zeroes through the whole * inode table. Must be called without any spinlock held. The only place * where it is called from on active part of filesystem is ext4lazyinit * thread, so we do not need any special locks, however we have to prevent * inode allocation from the current group, so we take alloc_sem lock, to * block ext4_new_inode() until we are finished. */ int <API key>(struct super_block *sb, ext4_group_t group, int barrier) { struct ext4_group_info *grp = ext4_get_group_info(sb, group); struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_group_desc *gdp = NULL; struct buffer_head *group_desc_bh; handle_t *handle; ext4_fsblk_t blk; int num, ret = 0, used_blks = 0; /* This should not happen, but just to be sure check this */ if (sb->s_flags & MS_RDONLY) { ret = 1; goto out; } gdp = ext4_get_group_desc(sb, group, &group_desc_bh); if (!gdp) goto out; /* * We do not need to lock this, because we are the only one * handling this flag. */ if (gdp->bg_flags & cpu_to_le16(<API key>)) goto out; handle = <API key>(sb, 1); if (IS_ERR(handle)) { ret = PTR_ERR(handle); goto out; } down_write(&grp->alloc_sem); /* * If inode bitmap was already initialized there may be some * used inodes so we need to skip blocks with used inodes in * inode table. */ if (!(gdp->bg_flags & cpu_to_le16(<API key>))) used_blks = DIV_ROUND_UP((<API key>(sb) - <API key>(sb, gdp)), sbi->s_inodes_per_block); if ((used_blks < 0) || (used_blks > sbi->s_itb_per_group)) { ext4_error(sb, "Something is wrong with group %u: " "used itable blocks: %d; " "itable unused count: %u", group, used_blks, <API key>(sb, gdp)); ret = 1; goto err_out; } blk = ext4_inode_table(sb, gdp) + used_blks; num = sbi->s_itb_per_group - used_blks; BUFFER_TRACE(group_desc_bh, "get_write_access"); ret = <API key>(handle, group_desc_bh); if (ret) goto err_out; /* * Skip zeroout if the inode table is full. But we set the ZEROED * flag anyway, because obviously, when it is full it does not need * further zeroing. */ if (unlikely(num == 0)) goto skip_zeroout; ext4_debug("going to zero out inode table in group %d\n", group); ret = sb_issue_zeroout(sb, blk, num, GFP_NOFS); if (ret < 0) goto err_out; if (barrier) blkdev_issue_flush(sb->s_bdev, GFP_NOFS, NULL); skip_zeroout: ext4_lock_group(sb, group); gdp->bg_flags |= cpu_to_le16(<API key>); gdp->bg_checksum = <API key>(sbi, group, gdp); ext4_unlock_group(sb, group); BUFFER_TRACE(group_desc_bh, "call <API key>"); ret = <API key>(handle, NULL, group_desc_bh); err_out: up_write(&grp->alloc_sem); ext4_journal_stop(handle); out: return ret; }
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM e:/xr19rel/WINNT_5.2_Depend/mozilla/netwerk/socket/base/<API key>.idl */ #ifndef <API key> #define <API key> #ifndef <API key> #include "nsISupports.h" #endif /* For IDL files that don't want to include root IDL files. */ #ifndef NS_NO_VTABLE #define NS_NO_VTABLE #endif /* starting interface: <API key> */ #define <API key> "<API key>" #define <API key> \ {0x0d0a6b62, 0xd4a9, 0x402e, \ { 0xa1, 0x97, 0x6b, 0xc6, 0xe3, 0x58, 0xfe, 0xc9 }} class NS_NO_VTABLE NS_SCRIPTABLE <API key> : public nsISupports { public: <API key>(<API key>) /* readonly attribute unsigned long securityState; */ NS_SCRIPTABLE NS_IMETHOD GetSecurityState(PRUint32 *aSecurityState) = 0; /* readonly attribute wstring <API key>; */ NS_SCRIPTABLE NS_IMETHOD <API key>(PRUnichar * *<API key>) = 0; /* readonly attribute wstring errorMessage; */ NS_SCRIPTABLE NS_IMETHOD GetErrorMessage(PRUnichar * *aErrorMessage) = 0; }; <API key>(<API key>, <API key>) /* Use this macro when declaring classes that implement this interface. */ #define <API key> \ NS_SCRIPTABLE NS_IMETHOD GetSecurityState(PRUint32 *aSecurityState); \ NS_SCRIPTABLE NS_IMETHOD <API key>(PRUnichar * *<API key>); \ NS_SCRIPTABLE NS_IMETHOD GetErrorMessage(PRUnichar * *aErrorMessage); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define <API key>(_to) \ NS_SCRIPTABLE NS_IMETHOD GetSecurityState(PRUint32 *aSecurityState) { return _to GetSecurityState(aSecurityState); } \ NS_SCRIPTABLE NS_IMETHOD <API key>(PRUnichar * *<API key>) { return _to <API key>(<API key>); } \ NS_SCRIPTABLE NS_IMETHOD GetErrorMessage(PRUnichar * *aErrorMessage) { return _to GetErrorMessage(aErrorMessage); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define <API key>(_to) \ NS_SCRIPTABLE NS_IMETHOD GetSecurityState(PRUint32 *aSecurityState) { return !_to ? <API key> : _to->GetSecurityState(aSecurityState); } \ NS_SCRIPTABLE NS_IMETHOD <API key>(PRUnichar * *<API key>) { return !_to ? <API key> : _to-><API key>(<API key>); } \ NS_SCRIPTABLE NS_IMETHOD GetErrorMessage(PRUnichar * *aErrorMessage) { return !_to ? <API key> : _to->GetErrorMessage(aErrorMessage); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class <API key> : public <API key> { public: NS_DECL_ISUPPORTS <API key> <API key>(); private: ~<API key>(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(<API key>, <API key>) <API key>::<API key>() { /* member initializers and constructor code */ } <API key>::~<API key>() { /* destructor code */ } /* readonly attribute unsigned long securityState; */ NS_IMETHODIMP <API key>::GetSecurityState(PRUint32 *aSecurityState) { return <API key>; } /* readonly attribute wstring <API key>; */ NS_IMETHODIMP <API key>::<API key>(PRUnichar * *<API key>) { return <API key>; } /* readonly attribute wstring errorMessage; */ NS_IMETHODIMP <API key>::GetErrorMessage(PRUnichar * *aErrorMessage) { return <API key>; } /* End of implementation class template. */ #endif #endif /* <API key> */
<?php /* core/themes/stable/templates/navigation/menu--toolbar.html.twig */ class <API key> extends Twig_Template { public function __construct(Twig_Environment $env) { parent::__construct($env); $this->parent = false; $this->blocks = array( ); } protected function doDisplay(array $context, array $blocks = array()) { $tags = array("import" => 21, "macro" => 29, "if" => 31, "for" => 37, "set" => 39); $filters = array(); $functions = array("link" => 47); try { $this->env->getExtension('sandbox')->checkSecurity( array('import', 'macro', 'if', 'for', 'set'), array(), array('link') ); } catch (<API key> $e) { $e->setTemplateFile($this->getTemplateName()); if ($e instanceof <API key> && isset($tags[$e->getTagName()])) { $e->setTemplateLine($tags[$e->getTagName()]); } elseif ($e instanceof <API key> && isset($filters[$e->getFilterName()])) { $e->setTemplateLine($filters[$e->getFilterName()]); } elseif ($e instanceof <API key> && isset($functions[$e->getFunctionName()])) { $e->setTemplateLine($functions[$e->getFunctionName()]); } throw $e; } // line 21 $context["menus"] = $this; // line 22 echo " "; // line 27 echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->renderVar($context["menus"]->getmenu_links((isset($context["items"]) ? $context["items"] : null), (isset($context["attributes"]) ? $context["attributes"] : null), 0))); echo " "; } // line 29 public function getmenu_links($__items__ = null, $__attributes__ = null, $__menu_level__ = null, ...$__varargs__) { $context = $this->env->mergeGlobals(array( "items" => $__items__, "attributes" => $__attributes__, "menu_level" => $__menu_level__, "varargs" => $__varargs__, )); $blocks = array(); ob_start(); try { // line 30 echo " "; $context["menus"] = $this; // line 31 echo " "; if ((isset($context["items"]) ? $context["items"] : null)) { // line 32 echo " "; if (((isset($context["menu_level"]) ? $context["menu_level"] : null) == 0)) { // line 33 echo " <ul"; echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["attributes"]) ? $context["attributes"] : null), "addClass", array(0 => "toolbar-menu"), "method"), "html", null, true)); echo "> "; } else { // line 35 echo " <ul class=\"toolbar-menu\"> "; } // line 37 echo " "; $context['_parent'] = $context; $context['_seq'] = <API key>((isset($context["items"]) ? $context["items"] : null)); foreach ($context['_seq'] as $context["_key"] => $context["item"]) { // line 38 echo " "; // line 39 $context["classes"] = array(0 => "menu-item", 1 => (($this->getAttribute( // line 41 $context["item"], "is_expanded", array())) ? ("menu-item--expanded") : ("")), 2 => (($this->getAttribute( // line 42 $context["item"], "is_collapsed", array())) ? ("<API key>") : ("")), 3 => (($this->getAttribute( // line 43 $context["item"], "in_active_trail", array())) ? ("<API key>") : (""))); // line 46 echo " <li"; echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute($this->getAttribute($context["item"], "attributes", array()), "addClass", array(0 => (isset($context["classes"]) ? $context["classes"] : null)), "method"), "html", null, true)); echo "> "; // line 47 echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->env->getExtension('drupal_core')->getLink($this->getAttribute($context["item"], "title", array()), $this->getAttribute($context["item"], "url", array())), "html", null, true)); echo " "; // line 48 if ($this->getAttribute($context["item"], "below", array())) { // line 49 echo " "; echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->renderVar($context["menus"]->getmenu_links($this->getAttribute($context["item"], "below", array()), (isset($context["attributes"]) ? $context["attributes"] : null), ((isset($context["menu_level"]) ? $context["menu_level"] : null) + 1)))); echo " "; } // line 51 echo " </li> "; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['_key'], $context['item'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; // line 53 echo " </ul> "; } } catch (Exception $e) { ob_end_clean(); throw $e; } catch (Throwable $e) { ob_end_clean(); throw $e; } return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); } public function getTemplateName() { return "core/themes/stable/templates/navigation/menu--toolbar.html.twig"; } public function isTraitable() { return false; } public function getDebugInfo() { return array ( 124 => 53, 117 => 51, 111 => 49, 109 => 48, 105 => 47, 100 => 46, 98 => 43, 97 => 42, 96 => 41, 95 => 39, 93 => 38, 88 => 37, 84 => 35, 78 => 33, 75 => 32, 72 => 31, 69 => 30, 55 => 29, 48 => 27, 45 => 22, 43 => 21,); } public function getSource() { return "{ /** * @file * Theme override to display a toolbar menu. * * Available variables: * - menu_name: The machine name of the menu. * - items: A nested list of menu items. Each menu item contains: * - attributes: HTML attributes for the menu item. * - below: The menu item child items. * - title: The menu link title. * - url: The menu link url, instance of \\Drupal\\Core\\Url * - localized_options: Menu link localized options. * - is_expanded: TRUE if the link has visible children within the current * menu tree. * - is_collapsed: TRUE if the link has children within the current menu tree * that are not currently visible. * - in_active_trail: TRUE if the link is in the active trail. */ {% import _self as menus %} { We call a macro which calls itself to render the full tree. @see http://twig.sensiolabs.org/doc/tags/macro.html {{ menus.menu_links(items, attributes, 0) }} {% macro menu_links(items, attributes, menu_level) %} {% import _self as menus %} {% if items %} {% if menu_level == 0 %} <ul{{ attributes.addClass('toolbar-menu') }}> {% else %} <ul class=\"toolbar-menu\"> {% endif %} {% for item in items %} {% set classes = [ 'menu-item', item.is_expanded ? 'menu-item--expanded', item.is_collapsed ? '<API key>', item.in_active_trail ? '<API key>', ] %} <li{{ item.attributes.addClass(classes) }}> {{ link(item.title, item.url) }} {% if item.below %} {{ menus.menu_links(item.below, attributes, menu_level + 1) }} {% endif %} </li> {% endfor %} </ul> {% endif %} {% endmacro %} "; } }
<?php /** * Indonesia Provinces * */ global $pms_states; $pms_states['ID'] = array( 'AC' => __( 'Daerah Istimewa Aceh', '<API key>' ), 'SU' => __( 'Sumatera Utara', '<API key>' ), 'SB' => __( 'Sumatera Barat', '<API key>' ), 'RI' => __( 'Riau', '<API key>' ), 'KR' => __( 'Kepulauan Riau', '<API key>' ), 'JA' => __( 'Jambi', '<API key>' ), 'SS' => __( 'Sumatera Selatan', '<API key>' ), 'BB' => __( 'Bangka Belitung', '<API key>' ), 'BE' => __( 'Bengkulu', '<API key>' ), 'LA' => __( 'Lampung', '<API key>' ), 'JK' => __( 'DKI Jakarta', '<API key>' ), 'JB' => __( 'Jawa Barat', '<API key>' ), 'BT' => __( 'Banten', '<API key>' ), 'JT' => __( 'Jawa Tengah', '<API key>' ), 'JI' => __( 'Jawa Timur', '<API key>' ), 'YO' => __( 'Daerah Istimewa Yogyakarta', '<API key>' ), 'BA' => __( 'Bali', '<API key>' ), 'NB' => __( 'Nusa Tenggara Barat', '<API key>' ), 'NT' => __( 'Nusa Tenggara Timur', '<API key>' ), 'KB' => __( 'Kalimantan Barat', '<API key>' ), 'KT' => __( 'Kalimantan Tengah', '<API key>' ), 'KI' => __( 'Kalimantan Timur', '<API key>' ), 'KS' => __( 'Kalimantan Selatan', '<API key>' ), 'KU' => __( 'Kalimantan Utara', '<API key>' ), 'SA' => __( 'Sulawesi Utara', '<API key>' ), 'ST' => __( 'Sulawesi Tengah', '<API key>' ), 'SG' => __( 'Sulawesi Tenggara', '<API key>' ), 'SR' => __( 'Sulawesi Barat', '<API key>' ), 'SN' => __( 'Sulawesi Selatan', '<API key>' ), 'GO' => __( 'Gorontalo', '<API key>' ), 'MA' => __( 'Maluku', '<API key>' ), 'MU' => __( 'Maluku Utara', '<API key>' ), 'PA' => __( 'Papua', '<API key>' ), 'PB' => __( 'Papua Barat', '<API key>' ) );
package test.auctionportal; import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.<API key>; import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_SOURCE; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.math.BigInteger; import java.nio.file.Paths; import java.util.GregorianCalendar; import static javax.xml.XMLConstants.<API key>; import javax.xml.datatype.DatatypeConstants; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.<API key>; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import jaxp.library.<API key>; import static jaxp.library.JAXPTestUtilities.bomStream; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.w3c.dom.TypeInfo; import org.w3c.dom.bootstrap.<API key>; import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSSerializer; import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS; import static test.auctionportal.HiBidConstants.XML_DIR; /** * This is the user controller class for the Auction portal HiBid.com. */ public class AuctionController extends <API key> { /** * Check for DOMErrorHandler handling DOMError. Before fix of bug 4890927 * DOMConfiguration.setParameter("well-formed",true) throws an exception. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void <API key>() throws Exception { String xmlFile = XML_DIR + "novelsInvalid.xml"; Document document = <API key>.newInstance() .newDocumentBuilder().parse(xmlFile); document.getDomConfig().setParameter("well-formed", true); <API key> registry = <API key>.newInstance(); DOMImplementationLS impl = (DOMImplementationLS) registry.<API key>("LS"); MyDOMOutput domOutput = new MyDOMOutput(); domOutput.setByteStream(System.out); LSSerializer writer = impl.createLSSerializer(); writer.write(document, domOutput); } /** * Check for DOMErrorHandler handling DOMError. Before fix of bug 4896132 * test throws DOM Level 1 node error. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void <API key>() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; <API key> dbf = <API key>.newInstance(); dbf.setNamespaceAware(true); Document document = dbf.newDocumentBuilder().parse(xmlFile); DOMConfiguration domConfig = document.getDomConfig(); MyDOMErrorHandler errHandler = new MyDOMErrorHandler(); domConfig.setParameter("error-handler", errHandler); DOMImplementationLS impl = (DOMImplementationLS) <API key>.newInstance() .<API key>("LS"); LSSerializer writer = impl.createLSSerializer(); MyDOMOutput domoutput = new MyDOMOutput(); domoutput.setByteStream(System.out); writer.write(document, domoutput); document.normalizeDocument(); writer.write(document, domoutput); assertFalse(errHandler.isError()); } /** * Check if setting the attribute to be of type ID works. This will affect * the Attr.isID method according to the spec. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void testCreateID() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; <API key> dbf = <API key>.newInstance(); dbf.setNamespaceAware(true); Document document = dbf.newDocumentBuilder().parse(xmlFile); Element account = (Element)document .<API key>(PORTAL_ACCOUNT_NS, "Account").item(0); account.setIdAttributeNS(PORTAL_ACCOUNT_NS, "accountID", true); Attr aID = account.getAttributeNodeNS(PORTAL_ACCOUNT_NS, "accountID"); assertTrue(aID.isId()); } /** * Check the user data on the node. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void <API key>() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; <API key> dbf = <API key>.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); Document document = docBuilder.parse(xmlFile); Element account = (Element)document.<API key>(PORTAL_ACCOUNT_NS, "Account").item(0); assertEquals(account.getNodeName(), "acc:Account"); Element firstName = (Element) document.<API key>(PORTAL_ACCOUNT_NS, "FirstName").item(0); assertEquals(firstName.getNodeName(), "FirstName"); Document doc1 = docBuilder.newDocument(); Element someName = doc1.createElement("newelem"); someName.setUserData("mykey", "dd", (operation, key, data, src, dst) -> { System.err.println("In UserDataHandler" + key); System.out.println("In UserDataHandler"); }); Element impAccount = (Element)document.importNode(someName, true); assertEquals(impAccount.getNodeName(), "newelem"); document.normalizeDocument(); String data = (someName.getUserData("mykey")).toString(); assertEquals(data, "dd"); } /** * Check the UTF-16 XMLEncoding xml file. * * @throws Exception If any errors occur. * @see <a href="content/movies.xml">movies.xml</a> */ @Test(groups = {"readLocalFiles"}) public void <API key>() throws Exception { // Note since movies.xml is UTF-16 encoding. We're not using stanard XML // file suffix. String xmlFile = XML_DIR + "movies.xml.data"; try (InputStream source = bomStream("UTF-16", xmlFile)) { <API key> dbf = <API key>.newInstance(); dbf.setNamespaceAware(true); Document document = dbf.newDocumentBuilder().parse(source); assertEquals(document.getXmlEncoding(), "UTF-16"); assertEquals(document.getXmlStandalone(), true); } } /** * Check validation API features. A schema which is including in Bug 4909119 * used to be testing for the functionalities. * * @throws Exception If any errors occur. * @see <a href="content/userDetails.xsd">userDetails.xsd</a> */ @Test(groups = {"readLocalFiles"}) public void testGetOwnerInfo() throws Exception { String schemaFile = XML_DIR + "userDetails.xsd"; String xmlFile = XML_DIR + "userDetails.xml"; try(FileInputStream fis = new FileInputStream(xmlFile)) { <API key> dbf = <API key>.newInstance(); dbf.setNamespaceAware(true); dbf.setAttribute(<API key>, <API key>); SchemaFactory schemaFactory = SchemaFactory.newInstance(<API key>); Schema schema = schemaFactory.newSchema(Paths.get(schemaFile).toFile()); Validator validator = schema.newValidator(); MyErrorHandler eh = new MyErrorHandler(); validator.setErrorHandler(eh); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); docBuilder.setErrorHandler(eh); Document document = docBuilder.parse(fis); DOMResult dResult = new DOMResult(); DOMSource domSource = new DOMSource(document); validator.validate(domSource, dResult); assertFalse(eh.isAnyError()); } } /** * Check grammar caching with imported schemas. * * @throws Exception If any errors occur. * @see <a href="content/coins.xsd">coins.xsd</a> * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a> */ @Test(groups = {"readLocalFiles"}) public void <API key>() throws Exception { String xsdFile = XML_DIR + "coins.xsd"; String xmlFile = XML_DIR + "coins.xml"; try(FileInputStream fis = new FileInputStream(xmlFile)) { <API key> dbf = <API key>.newInstance(); dbf.setNamespaceAware(true); dbf.setAttribute(<API key>, <API key>); dbf.setValidating(false); SchemaFactory schemaFactory = SchemaFactory.newInstance(<API key>); Schema schema = schemaFactory.newSchema(new File(((xsdFile)))); MyErrorHandler eh = new MyErrorHandler(); Validator validator = schema.newValidator(); validator.setErrorHandler(eh); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); Document document = docBuilder.parse(fis); validator.validate(new DOMSource(document), new DOMResult()); assertFalse(eh.isAnyError()); } } /** * Check for the same imported schemas but will use SAXParserFactory and try * parsing using the SAXParser. SCHEMA_SOURCE attribute is using for this * test. * * @throws Exception If any errors occur. * @see <a href="content/coins.xsd">coins.xsd</a> * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a> */ @Test(groups = {"readLocalFiles"}) public void <API key>() throws Exception { String xsdFile = XML_DIR + "coins.xsd"; String xmlFile = XML_DIR + "coins.xml"; SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); spf.setValidating(true); SAXParser sp = spf.newSAXParser(); sp.setProperty(<API key>, <API key>); sp.setProperty(JAXP_SCHEMA_SOURCE, xsdFile); MyErrorHandler eh = new MyErrorHandler(); sp.parse(new File(xmlFile), eh); assertFalse(eh.isAnyError()); } /** * Check usage of javax.xml.datatype.Duration class. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void testGetItemDuration() throws Exception { String xmlFile = XML_DIR + "itemsDuration.xml"; <API key> dbf = <API key>.newInstance(); dbf.setNamespaceAware(true); Document document = dbf.newDocumentBuilder().parse(xmlFile); Element durationElement = (Element) document.<API key>("sellDuration").item(0); NodeList childList = durationElement.getChildNodes(); for (int i = 0; i < childList.getLength(); i++) { System.out.println("child " + i + childList.item(i)); } Duration duration = DatatypeFactory.newInstance().newDuration("P365D"); Duration sellDuration = DatatypeFactory.newInstance().newDuration(childList.item(0).getNodeValue()); assertFalse(sellDuration.isShorterThan(duration)); assertFalse(sellDuration.isLongerThan(duration)); assertEquals(sellDuration.getField(DatatypeConstants.DAYS), BigInteger.valueOf(365)); assertEquals(sellDuration.normalizeWith(new GregorianCalendar(1999, 2, 22)), duration); Duration myDuration = sellDuration.add(duration); assertEquals(myDuration.normalizeWith(new GregorianCalendar(2003, 2, 22)), DatatypeFactory.newInstance().newDuration("P730D")); } /** * Check usage of TypeInfo interface introduced in DOM L3. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void testGetTypeInfo() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; <API key> dbf = <API key>.newInstance(); dbf.setNamespaceAware(true); dbf.setValidating(true); dbf.setAttribute(<API key>, <API key>); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); docBuilder.setErrorHandler(new MyErrorHandler()); Document document = docBuilder.parse(xmlFile); Element userId = (Element)document.<API key>(PORTAL_ACCOUNT_NS, "UserID").item(0); TypeInfo typeInfo = userId.getSchemaTypeInfo(); assertTrue(typeInfo.getTypeName().equals("nonNegativeInteger")); assertTrue(typeInfo.getTypeNamespace().equals(<API key>)); Element role = (Element)document.<API key>(PORTAL_ACCOUNT_NS, "Role").item(0); TypeInfo roletypeInfo = role.getSchemaTypeInfo(); assertTrue(roletypeInfo.getTypeName().equals("BuyOrSell")); assertTrue(roletypeInfo.getTypeNamespace().equals(PORTAL_ACCOUNT_NS)); } }
<?php /** * Custom functions that act independently of the theme templates * * Eventually, some of the functionality here could be replaced by core features * * @package Decode */ /** * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. */ if ( ! function_exists( '<API key>' ) ) { function <API key>( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', '<API key>' ); } /** * Adds custom classes to the array of body classes. */ if ( ! function_exists( 'decode_body_classes' ) ) { function decode_body_classes( $classes ) { // Adds a class of group-blog to blogs with more than 1 published author if ( is_multi_author() ) { $classes[] = 'group-blog'; } return $classes; } } add_filter( 'body_class', 'decode_body_classes' ); /** * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages */ if ( ! function_exists( '<API key>' ) ) { function <API key>( $url, $id ) { if ( ! is_attachment() && ! <API key>( $id ) ) return $url; $image = get_post( $id ); if ( ! empty( $image->post_parent ) && $image->post_parent != $id ) $url .= '#main'; return $url; } } add_filter( 'attachment_link', '<API key>', 10, 2 ); /** * Highlight search terms in search results. */ function <API key>( $text ) { if ( is_search() ) { $sr = get_search_query(); $keys = implode( '|', explode( ' ', get_search_query() ) ); if ($keys != '') { // Check for empty search, and don't modify text if empty $text = preg_replace( '/(' . $keys .')/iu', '<mark class="search-highlight">\0</mark>', $text ); } } return $text; } add_filter( 'the_excerpt', '<API key>' ); add_filter( 'the_title', '<API key>' ); /** * Link to post in excerpt [...] links. */ if ( ! function_exists( 'link_ellipses' ) ) { function link_ellipses( $more ) { if ( ! is_search() ) { return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">[&hellip;]</a>'; } } } add_filter( 'excerpt_more', 'link_ellipses' ); if ( ! function_exists( '<API key>' ) ) : /** * Filters wp_title to print a neat <title> tag based on what is being viewed. * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string The filtered title. */ function decode_wp_title( $title, $sep ) { if ( is_feed() ) { return $title; } global $page, $paged; // Add the blog name $title .= get_bloginfo( 'name', 'display' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title .= " $sep $site_description"; } // Add a page number if necessary: if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { $title .= " $sep " . sprintf( __( 'Page %s', 'decode' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'decode_wp_title', 10, 2 ); endif; if ( ! function_exists( '<API key>' ) ) : function decode_render_title() { ?> <title><?php wp_title( '|', false, 'right' ); ?></title> <?php } add_action( 'wp_head', 'decode_render_title' ); endif; if ( ! function_exists( 'decode_setup_author' ) ) { function decode_setup_author() { global $wp_query; if ( $wp_query->is_author() && isset( $wp_query->post ) ) { $GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author ); } } } add_action( 'wp', 'decode_setup_author' );
package com.mobilerobots.Aria; public class ArUrg extends ArLaser { /* (begin code from javabody_derived typemap) */ private long swigCPtr; /* for internal use by swig only */ public ArUrg(long cPtr, boolean cMemoryOwn) { super(AriaJavaJNI.SWIGArUrgUpcast(cPtr), cMemoryOwn); swigCPtr = cPtr; } /* for internal use by swig only */ public static long getCPtr(ArUrg obj) { return (obj == null) ? 0 : obj.swigCPtr; } /* (end code from javabody_derived typemap) */ protected void finalize() { delete(); } public synchronized void delete() { if (swigCPtr != 0) { if (swigCMemOwn) { swigCMemOwn = false; AriaJavaJNI.delete_ArUrg(swigCPtr); } swigCPtr = 0; } super.delete(); } public ArUrg(int laserNumber, String name) { this(AriaJavaJNI.new_ArUrg__SWIG_0(laserNumber, name), true); } public ArUrg(int laserNumber) { this(AriaJavaJNI.new_ArUrg__SWIG_1(laserNumber), true); } public boolean blockingConnect() { return AriaJavaJNI.<API key>(swigCPtr, this); } public boolean asyncConnect() { return AriaJavaJNI.ArUrg_asyncConnect(swigCPtr, this); } public boolean disconnect() { return AriaJavaJNI.ArUrg_disconnect(swigCPtr, this); } public boolean isConnected() { return AriaJavaJNI.ArUrg_isConnected(swigCPtr, this); } public boolean isTryingToConnect() { return AriaJavaJNI.<API key>(swigCPtr, this); } public void log() { AriaJavaJNI.ArUrg_log(swigCPtr, this); } }
/* Definitions for bytecode */ #ifndef Py_COMPILE_H #define Py_COMPILE_H #ifdef __cplusplus extern "C" { #endif /* Bytecode object */ typedef struct { PyObject_HEAD int co_argcount; /* #arguments, except *args */ int co_nlocals; /* #local variables */ int co_stacksize; /* #entries needed for evaluation stack */ int co_flags; /* CO_..., see below */ PyObject *co_code; /* instruction opcodes */ PyObject *co_consts; /* list (constants used) */ PyObject *co_names; /* list of strings (names used) */ PyObject *co_varnames; /* tuple of strings (local variable names) */ PyObject *co_freevars; /* tuple of strings (free variable names) */ PyObject *co_cellvars; /* tuple of strings (cell variable names) */ /* The rest doesn't count for hash/cmp */ PyObject *co_filename; /* string (where it was loaded from) */ PyObject *co_name; /* string (name, for reference) */ int co_firstlineno; /* first source line number */ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */ } PyCodeObject; /* Masks for co_flags above */ #define CO_OPTIMIZED 0x0001 #define CO_NEWLOCALS 0x0002 #define CO_VARARGS 0x0004 #define CO_VARKEYWORDS 0x0008 #define CO_NESTED 0x0010 #define CO_GENERATOR 0x0020 /* The CO_NOFREE flag is set if there are no free or cell variables. This information is redundant, but it allows a single flag test to determine whether there is any extra work to be done when the call frame it setup. */ #define CO_NOFREE 0x0040 /* XXX Temporary hack. Until generators are a permanent part of the language, we need a way for a code object to record that generators were *possible* when it was compiled. This is so code dynamically compiled *by* a code object knows whether to allow yield stmts. In effect, this passes on the "from __future__ import generators" state in effect when the code block was compiled. */ #define <API key> 0x1000 /* no longer used in an essential way */ #define CO_FUTURE_DIVISION 0x2000 PyAPI_DATA(PyTypeObject) PyCode_Type; #define PyCode_Check(op) ((op)->ob_type == &PyCode_Type) #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) #define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ /* Public interface */ struct _node; /* Declare the existence of this type */ PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); PyAPI_FUNC(PyCodeObject *) PyCode_New( int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); /* same as struct above */ PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); /* Future feature support */ typedef struct { int ff_found_docstring; int ff_last_lineno; int ff_features; } PyFutureFeatures; PyAPI_FUNC(PyFutureFeatures *) PyNode_Future(struct _node *, const char *); PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, const char *, PyCompilerFlags *); #define <API key> "nested_scopes" #define FUTURE_GENERATORS "generators" #define FUTURE_DIVISION "division" /* for internal use only */ #define _PyCode_GETCODEPTR(co, pp) \ ((*(co)->co_code->ob_type->tp_as_buffer->bf_getreadbuffer) \ ((co)->co_code, 0, (void **)(pp))) #ifdef __cplusplus } #endif #endif /* !Py_COMPILE_H */
#include <Instrument.h> // the base class for this instrument #include <vector> using std::vector; class PHASER : public Instrument { public: PHASER(); virtual ~PHASER(); virtual int init(double *, int); virtual int configure(); virtual int run(); private: void doupdate(); float *_in; int _nargs, _inchan, _branch; float _amp, _wetdry, _pan, _lfofreq, _reverbtime; int _insamps; int _numfilters; Ooscili *lfo; Oallpassi *allpassptr; // temporary pointer to initialize vector vector<Oallpassi*> _filtervector; // array of allpass filters };
<HTML> <CENTER><A HREF = "http://lammps.sandia.gov">LAMMPS WWW Site</A> - <A HREF = "Manual.html">LAMMPS Documentation</A> - <A HREF = "Section_commands.html#comm">LAMMPS Commands</A> </CENTER> <HR> <H3>compute smd/ulsph_stress command </H3> <P><B>Syntax:</B> </P> <PRE>compute ID group-ID smd/ulsph_stress </PRE> <UL><LI>ID, group-ID are documented in <A HREF = "compute.html">compute</A> command <LI>smd/ulsph_stress = style name of this compute command </UL> <P><B>Examples:</B> </P> <PRE>compute 1 all smd/ulsph_stress </PRE> <P><B>Description:</B> </P> <P>Define a computation that outputs the Cauchy stress tensor. </P> <P>See <A HREF = "USER/smd/<API key>.pdf">this PDF guide</A> to using Smooth Mach Dynamics in LAMMPS. </P> <P><B>Output info:</B> </P> <P>This compute calculates a per-particle vector of vectors (tensors), which can be accessed by any command that uses per-particle values from a compute as input. See <A HREF = "Section_howto.html#howto_15">Section_howto 15</A> for an overview of LAMMPS output options. </P> <P>The values will be given in <A HREF = "units.html">units</A> of pressure. </P> <P>The per-particle vector has 7 entries. The first six entries correspond to the xx, yy, zz, xy, xz, yz components of the symmetric Cauchy stress tensor. The seventh entry is the second invariant of the stress tensor, i.e., the von Mises equivalent stress. </P> <P><B>Restrictions:</B> </P> <P>This compute is part of the USER-SMD package. It is only enabled if LAMMPS was built with that package. See the <A HREF = "Section_start.html#start_3">Making LAMMPS</A> section for more info. This compute can only be used for particles which interact with the updated Lagrangian SPH pair style. </P> <P><B>Related commands:</B> </P> <PRE><A HREF = "<API key>.html">smd/ulsph_strain</A>, <A HREF = "<API key>.html">smd/ulsph_strain_rate</A> <A HREF = "<API key>.html">smd/tlsph_stress</A> </PRE> <P><B>Default:</B> none </P> </HTML>
// This file is part of Olena. // Olena is free software: you can redistribute it and/or modify it under // Olena is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // As a special exception, you may use this file as part of a free // software project without restriction. Specifically, if other files // instantiate templates or use macros or inline functions from this // file, or you compile this file and link it with other files to produce // an executable, this file does not by itself cause the resulting // exception does not however invalidate any other reasons why the #include <mln/core/image/image2d.hh> #include <mln/core/image/dmorph/sub_image.hh> #include <mln/core/image/dmorph/image_if.hh> #include <mln/fun/p2b/chess.hh> #include <mln/border/get.hh> #include <mln/literal/origin.hh> struct f_box2d_t : mln::Function_v2b< f_box2d_t > { f_box2d_t(const mln::box2d& b) : b_(b) { } mln::box2d b_; bool operator()(const mln::point2d& p) const { return b_.has(p); } }; int main() { using namespace mln; typedef image2d<int> I; box2d b(literal::origin, point2d(1,1)); f_box2d_t f_b(b); I ima(3,3, 51); mln_assertion(border::get(ima) == 51); mln_assertion(ima.has(point2d(2,2)) == true); sub_image<I, box2d> sub(ima, b); mln_assertion(sub.has(point2d(2,2)) == false && sub.has(point2d(2,2)) == false); mln_assertion(border::get(sub) == 0); image_if<I, f_box2d_t> imaif(ima, f_b); mln_assertion(imaif.has(point2d(2,2)) == false && ima.has(point2d(2,2)) == true); mln_assertion(border::get(imaif) == 0); mln_assertion(border::get((ima | b) | f_b) == 0); }
<?php // error mode $error_mode = (isset($error_mode) AND in_array($error_mode, array("json", "moodle"))) ? $error_mode : "moodle"; // define constants if (!defined('ROOT')) { //define('ROOT', (realpath(dirname( __FILE__ )) . DIRECTORY_SEPARATOR)); define('ROOT', substr(realpath(dirname(__FILE__)), 0, stripos(realpath(dirname(__FILE__)), "blocks", 0)) . 'blocks/gismo/'); } //$path_base=substr(realpath(dirname( __FILE__ )),0,stripos(realpath(dirname( __FILE__ )),"blocks",0)).'blocks/gismo/'; if (!defined('LIB_DIR')) { define('LIB_DIR', ROOT . "lib" . DIRECTORY_SEPARATOR); //define('LIB_DIR', $path_base . "lib" . DIRECTORY_SEPARATOR); } // include moodle config file require_once realpath(ROOT . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "config.php"); $q = optional_param('q', '', PARAM_TEXT); $srv_data_encoded = required_param('srv_data',PARAM_RAW); // query filter between pages $query = (isset($q)) ? addslashes($q) : ''; // LIBRARIES MANAGEMENT // Please use this section to set server side and cliend side libraries to be included // server side: please note that '.php' extension will be automatically added $<API key> = array("third_parties" => array()); // client side: please note that '.js' extension will NOT be automatically added, in order to allow to create file thgat can be parsed by PHP $<API key> = array("gismo" => array("gismo.js.php", "top_menu.js.php", "left_menu.js.php", "time_line.js", "gismo_util.js"), "third_parties" => array("jquery/jquery-1.10.0.min.js", "jquery-ui-1.10.3/js/jquery-ui-1.10.3.custom.min.js", "jqplot.1.0.8r1250/jquery.jqplot.min.js", "jqplot.1.0.8r1250/plugins/jqplot.barRenderer.min.js", "jqplot.1.0.8r1250/plugins/jqplot.<API key>.min.js", "jqplot.1.0.8r1250/plugins/jqplot.<API key>.min.js", "jqplot.1.0.8r1250/plugins/jqplot.canvasTextRenderer.min.js", "jqplot.1.0.8r1250/plugins/jqplot.<API key>.min.js", "jqplot.1.0.8r1250/plugins/jqplot.dateAxisRenderer.min.js", "jqplot.1.0.8r1250/plugins/jqplot.highlighter.min.js", "jqplot.1.0.8r1250/plugins/jqplot.pointLabels.min.js", "simpleFadeSlideShow/fadeSlideShow.min.js" )); // include server-side libraries libraries if (is_array($<API key>) AND count($<API key>) > 0) { foreach ($<API key> as $key => $server_side_libs) { if (is_array($server_side_libs) AND count($server_side_libs) > 0) { foreach ($server_side_libs as $server_side_lib) { $lib_full_path = LIB_DIR . $key . DIRECTORY_SEPARATOR . "server_side" . DIRECTORY_SEPARATOR . $server_side_lib . ".php"; if (is_file($lib_full_path) AND is_readable($lib_full_path)) { require_once $lib_full_path; } } } } } // check input data if (!isset($srv_data_encoded)) { block_gismo\GISMOutil::gismo_error('<API key>', $error_mode); exit; } $srv_data = (object) unserialize(base64_decode(urldecode($srv_data_encoded))); // course id if (!property_exists($srv_data, "course_id")) { block_gismo\GISMOutil::gismo_error('err_course_not_set', $error_mode); exit; } // block instance id if (!property_exists($srv_data, "block_instance_id")) { block_gismo\GISMOutil::gismo_error('<API key>', $error_mode); exit; } // check authentication switch ($error_mode) { case "json": try { require_login($srv_data->course_id, false, NULL, true, true); } catch (Exception $e) { block_gismo\GISMOutil::gismo_error("err_authentication", $error_mode); exit; } break; case "moodle": default: require_login(); break; } // extract the course if (!$course = $DB->get_record("course", array("id" => intval($srv_data->course_id)))) { block_gismo\GISMOutil::gismo_error('err_course_not_set', $error_mode); exit; } // context $context_obj = context_block::instance(intval($srv_data->block_instance_id)); //Get block_gismo settings $gismoconfig = get_config('block_gismo'); if ($gismoconfig->student_reporting === "false") { // check authorization require_capability('block/gismo:view', $context_obj); } // get gismo settings $gismo_settings = $DB->get_field("block_instances", "configdata", array("id" => intval($srv_data->block_instance_id))); if (is_null($gismo_settings) OR $gismo_settings === "") { $gismo_settings = get_object_vars(block_gismo\GISMOutil::get_default_options()); } else { $gismo_settings = get_object_vars(unserialize(base64_decode($gismo_settings))); if (is_array($gismo_settings) AND count($gismo_settings) > 0) { foreach ($gismo_settings as $key => $value) { if (is_numeric($value)) { if (strval(intval($value)) === strval($value)) { $gismo_settings[$key] = intval($value); } else if (strval(floatval($value)) === strval($value)) { $gismo_settings[$key] = floatval($value); } } } } // <API key> if (!array_key_exists("<API key>", $gismo_settings)) { $gismo_settings["<API key>"] = 1; } } $block_gismo_config = json_encode($gismo_settings); // actor (teacher or student) $actor = "student"; if (has_capability("block/gismo:trackuser", $context_obj)) { $actor = "student"; } if (has_capability("block/gismo:trackteacher", $context_obj)) { $actor = "teacher"; } ?>
<?php /** * The following variables are available in this template: * - $this: the CrudCode object */ ?> <div id="mainPage" class="main"> <?php echo "<?php\n"; $nameColumn = $this->guessNameColumn($this->tableSchema->columns); $label = $this->pluralize($this->class2name($this->modelClass)); echo "\$this->breadcrumbs=array( '$label'=>array('index'), \$model->{$nameColumn}=>array('view','id'=>\$model->{$this->tableSchema->primaryKey}), 'Update', );\n"; ?> $title=Yii::t('default', 'Update <?php echo $this->modelClass ?>: '); $contextDesc = Yii::t('default', 'Available actions that may be taken on <?php echo $this->modelClass; ?>.'); $this->menu=array( array('label'=> Yii::t('default', 'Create a new <?php echo $this->modelClass; ?>'), 'url'=>array('create'),'description' => Yii::t('default', 'This action create a new <?php echo $this->modelClass; ?>')), array('label'=> Yii::t('default', 'List <?php echo $this->modelClass; ?>'), 'url'=>array('index'),'description' => Yii::t('default', 'This action list all <?php echo $this->pluralize($this->class2name($this->modelClass)) ?>, you can search, delete and update')), ); ?> <div class="twoColumn"> <div class="columnone" style="padding-right: 1em"> <?php echo "<?php echo \$this->renderPartial('_form', array('model'=>\$model,'title'=>\$title)); ?>"; ?> </div> <div class="columntwo"> <?php echo "<?php echo \$this->renderPartial('////common/defaultcontext', array('contextDesc'=>\$contextDesc)); ?>"; ?> </div> </div> </div>
#define _XOPEN_SOURCE 500 #include <assert.h> #include <locale.h> #include <stdlib.h> #include <string.h> #include "lilv_internal.h" static void <API key>(LilvNode* val) { char* locale; char* endptr; switch (val->type) { case LILV_VALUE_URI: case LILV_VALUE_BLANK: case LILV_VALUE_STRING: break; case LILV_VALUE_INT: // FIXME: locale kludge, need a locale independent strtol locale = lilv_strdup(setlocale(LC_NUMERIC, NULL)); setlocale(LC_NUMERIC, "POSIX"); val->val.int_val = strtol(val->str_val, &endptr, 10); setlocale(LC_NUMERIC, locale); free(locale); break; case LILV_VALUE_FLOAT: // FIXME: locale kludge, need a locale independent strtod locale = lilv_strdup(setlocale(LC_NUMERIC, NULL)); setlocale(LC_NUMERIC, "POSIX"); val->val.float_val = strtod(val->str_val, &endptr); setlocale(LC_NUMERIC, locale); free(locale); break; case LILV_VALUE_BOOL: val->val.bool_val = (!strcmp(val->str_val, "true")); break; } } /** Note that if @a type is numeric or boolean, the returned value is corrupt * until <API key> is called. It is not * automatically called from here to avoid overhead and imprecision when the * exact string value is known. */ LilvNode* lilv_node_new(LilvWorld* world, LilvNodeType type, const char* str) { LilvNode* val = malloc(sizeof(struct LilvNodeImpl)); val->world = world; val->type = type; switch (type) { case LILV_VALUE_URI: val->val.uri_val = sord_new_uri(world->world, (const uint8_t*)str); val->str_val = (char*)<API key>(val->val.uri_val); break; case LILV_VALUE_BLANK: val->val.uri_val = sord_new_blank(world->world, (const uint8_t*)str); val->str_val = (char*)<API key>(val->val.uri_val); case LILV_VALUE_STRING: case LILV_VALUE_INT: case LILV_VALUE_FLOAT: case LILV_VALUE_BOOL: val->str_val = lilv_strdup(str); break; } return val; } /** Create a new LilvNode from @a node, or return NULL if impossible */ LilvNode* <API key>(LilvWorld* world, const SordNode* node) { LilvNode* result = NULL; SordNode* datatype_uri = NULL; LilvNodeType type = LILV_VALUE_STRING; switch (sord_node_get_type(node)) { case SORD_URI: result = malloc(sizeof(struct LilvNodeImpl)); result->world = (LilvWorld*)world; result->type = LILV_VALUE_URI; result->val.uri_val = sord_node_copy(node); result->str_val = (char*)<API key>(result->val.uri_val); break; case SORD_BLANK: result = malloc(sizeof(struct LilvNodeImpl)); result->world = (LilvWorld*)world; result->type = LILV_VALUE_BLANK; result->val.uri_val = sord_node_copy(node); result->str_val = (char*)<API key>(result->val.uri_val); break; case SORD_LITERAL: datatype_uri = <API key>(node); if (datatype_uri) { if (sord_node_equals(datatype_uri, world->xsd_boolean_node)) type = LILV_VALUE_BOOL; else if (sord_node_equals(datatype_uri, world->xsd_decimal_node) || sord_node_equals(datatype_uri, world->xsd_double_node)) type = LILV_VALUE_FLOAT; else if (sord_node_equals(datatype_uri, world->xsd_integer_node)) type = LILV_VALUE_INT; else LILV_ERRORF("Unknown datatype `%s'\n", <API key>(datatype_uri)); } result = lilv_node_new(world, type, (const char*)<API key>(node)); switch (result->type) { case LILV_VALUE_INT: case LILV_VALUE_FLOAT: case LILV_VALUE_BOOL: <API key>(result); default: break; } break; default: assert(false); } return result; } LILV_API LilvNode* lilv_new_uri(LilvWorld* world, const char* uri) { return lilv_node_new(world, LILV_VALUE_URI, uri); } LILV_API LilvNode* lilv_new_string(LilvWorld* world, const char* str) { return lilv_node_new(world, LILV_VALUE_STRING, str); } LILV_API LilvNode* lilv_new_int(LilvWorld* world, int val) { char str[32]; snprintf(str, sizeof(str), "%d", val); LilvNode* ret = lilv_node_new(world, LILV_VALUE_INT, str); ret->val.int_val = val; return ret; } LILV_API LilvNode* lilv_new_float(LilvWorld* world, float val) { char str[32]; snprintf(str, sizeof(str), "%f", val); LilvNode* ret = lilv_node_new(world, LILV_VALUE_FLOAT, str); ret->val.float_val = val; return ret; } LILV_API LilvNode* lilv_new_bool(LilvWorld* world, bool val) { LilvNode* ret = lilv_node_new(world, LILV_VALUE_BOOL, val ? "true" : "false"); ret->val.bool_val = val; return ret; } LILV_API LilvNode* lilv_node_duplicate(const LilvNode* val) { if (val == NULL) return NULL; LilvNode* result = malloc(sizeof(struct LilvNodeImpl)); result->world = val->world; result->type = val->type; switch (val->type) { case LILV_VALUE_URI: case LILV_VALUE_BLANK: result->val.uri_val = sord_node_copy(val->val.uri_val); result->str_val = (char*)<API key>(result->val.uri_val); break; default: result->str_val = lilv_strdup(val->str_val); result->val = val->val; } return result; } LILV_API void lilv_node_free(LilvNode* val) { if (val) { switch (val->type) { case LILV_VALUE_URI: case LILV_VALUE_BLANK: sord_node_free(val->world->world, val->val.uri_val); break; default: free(val->str_val); } free(val); } } LILV_API bool lilv_node_equals(const LilvNode* value, const LilvNode* other) { if (value == NULL && other == NULL) return true; else if (value == NULL || other == NULL) return false; else if (value->type != other->type) return false; switch (value->type) { case LILV_VALUE_URI: return sord_node_equals(value->val.uri_val, other->val.uri_val); case LILV_VALUE_BLANK: case LILV_VALUE_STRING: return !strcmp(value->str_val, other->str_val); case LILV_VALUE_INT: return (value->val.int_val == other->val.int_val); case LILV_VALUE_FLOAT: return (value->val.float_val == other->val.float_val); case LILV_VALUE_BOOL: return (value->val.bool_val == other->val.bool_val); } return false; /* shouldn't get here */ } LILV_API char* <API key>(const LilvNode* value) { size_t len = 0; char* result = NULL; char* locale = NULL; switch (value->type) { case LILV_VALUE_URI: len = strlen(value->str_val) + 3; result = calloc(len, 1); snprintf(result, len, "<%s>", value->str_val); break; case LILV_VALUE_BLANK: len = strlen(value->str_val) + 3; result = calloc(len, 1); snprintf(result, len, "_:%s", value->str_val); break; case LILV_VALUE_STRING: case LILV_VALUE_BOOL: result = lilv_strdup(value->str_val); break; case LILV_VALUE_INT: // INT64_MAX is 9223372036854775807 (19 digits) + 1 for sign // FIXME: locale kludge, need a locale independent snprintf locale = lilv_strdup(setlocale(LC_NUMERIC, NULL)); len = 20; result = calloc(len, 1); setlocale(LC_NUMERIC, "POSIX"); snprintf(result, len, "%d", value->val.int_val); setlocale(LC_NUMERIC, locale); break; case LILV_VALUE_FLOAT: // FIXME: locale kludge, need a locale independent snprintf locale = lilv_strdup(setlocale(LC_NUMERIC, NULL)); len = 20; // FIXME: proper maximum value? result = calloc(len, 1); setlocale(LC_NUMERIC, "POSIX"); snprintf(result, len, "%f", value->val.float_val); setlocale(LC_NUMERIC, locale); break; } free(locale); return result; } LILV_API bool lilv_node_is_uri(const LilvNode* value) { return (value && value->type == LILV_VALUE_URI); } LILV_API const char* lilv_node_as_uri(const LilvNode* value) { assert(lilv_node_is_uri(value)); return value->str_val; } const SordNode* lilv_node_as_node(const LilvNode* value) { assert(lilv_node_is_uri(value)); return value->val.uri_val; } LILV_API bool lilv_node_is_blank(const LilvNode* value) { return (value && value->type == LILV_VALUE_BLANK); } LILV_API const char* lilv_node_as_blank(const LilvNode* value) { assert(lilv_node_is_blank(value)); return value->str_val; } LILV_API bool <API key>(const LilvNode* value) { if (!value) return false; switch (value->type) { case LILV_VALUE_STRING: case LILV_VALUE_INT: case LILV_VALUE_FLOAT: return true; default: return false; } } LILV_API bool lilv_node_is_string(const LilvNode* value) { return (value && value->type == LILV_VALUE_STRING); } LILV_API const char* lilv_node_as_string(const LilvNode* value) { return value->str_val; } LILV_API bool lilv_node_is_int(const LilvNode* value) { return (value && value->type == LILV_VALUE_INT); } LILV_API int lilv_node_as_int(const LilvNode* value) { assert(value); assert(lilv_node_is_int(value)); return value->val.int_val; } LILV_API bool lilv_node_is_float(const LilvNode* value) { return (value && value->type == LILV_VALUE_FLOAT); } LILV_API float lilv_node_as_float(const LilvNode* value) { assert(lilv_node_is_float(value) || lilv_node_is_int(value)); if (lilv_node_is_float(value)) return value->val.float_val; else // lilv_node_is_int(value) return (float)value->val.int_val; } LILV_API bool lilv_node_is_bool(const LilvNode* value) { return (value && value->type == LILV_VALUE_BOOL); } LILV_API bool lilv_node_as_bool(const LilvNode* value) { assert(value); assert(lilv_node_is_bool(value)); return value->val.bool_val; }
package loci.formats.codec; import java.io.IOException; import java.util.Vector; import loci.common.ByteArrayHandle; import loci.common.DataTools; import loci.common.<API key>; import loci.formats.FormatException; import loci.formats.<API key>; /** * Decompresses lossless JPEG images. * * @author Melissa Linkert melissa at glencoesoftware.com */ public class LosslessJPEGCodec extends BaseCodec { // -- Constants -- // Start of Frame markers - non-differential, Huffman coding private static final int SOF0 = 0xffc0; // baseline DCT private static final int SOF1 = 0xffc1; // extended sequential DCT private static final int SOF2 = 0xffc2; // progressive DCT private static final int SOF3 = 0xffc3; // lossless (sequential) // Start of Frame markers - differential, Huffman coding private static final int SOF5 = 0xffc5; // differential sequential DCT private static final int SOF6 = 0xffc6; // differential progressive DCT private static final int SOF7 = 0xffc7; // differential lossless (sequential) // Start of Frame markers - non-differential, arithmetic coding private static final int JPG = 0xffc8; // reserved for JPEG extensions private static final int SOF9 = 0xffc9; // extended sequential DCT private static final int SOF10 = 0xffca; // progressive DCT private static final int SOF11 = 0xffcb; // lossless (sequential) // Start of Frame markers - differential, arithmetic coding private static final int SOF13 = 0xffcd; // differential sequential DCT private static final int SOF14 = 0xffce; // differential progressive DCT private static final int SOF15 = 0xffcf; // differential lossless (sequential) private static final int DHT = 0xffc4; // define Huffman table(s) private static final int DAC = 0xffcc; // define arithmetic coding conditions // Restart interval termination private static final int RST_0 = 0xffd0; private static final int RST_1 = 0xffd1; private static final int RST_2 = 0xffd2; private static final int RST_3 = 0xffd3; private static final int RST_4 = 0xffd4; private static final int RST_5 = 0xffd5; private static final int RST_6 = 0xffd6; private static final int RST_7 = 0xffd7; private static final int SOI = 0xffd8; // start of image private static final int EOI = 0xffd9; // end of image private static final int SOS = 0xffda; // start of scan private static final int DQT = 0xffdb; // define quantization table(s) private static final int DNL = 0xffdc; // define number of lines private static final int DRI = 0xffdd; // define restart interval private static final int DHP = 0xffde; // define hierarchical progression private static final int EXP = 0xffdf; // expand reference components private static final int COM = 0xfffe; // comment // -- Codec API methods -- /* @see Codec#compress(byte[], CodecOptions) */ @Override public byte[] compress(byte[] data, CodecOptions options) throws FormatException { throw new <API key>( "Lossless JPEG compression not supported"); } /** * The CodecOptions parameter should have the following fields set: * {@link CodecOptions#interleaved interleaved} * {@link CodecOptions#littleEndian littleEndian} * * @see Codec#decompress(<API key>, CodecOptions) */ @Override public byte[] decompress(<API key> in, CodecOptions options) throws FormatException, IOException { if (in == null) throw new <API key>("No data to decompress."); if (options == null) options = CodecOptions.getDefaultOptions(); byte[] buf = new byte[0]; int width = 0, height = 0; int bitsPerSample = 0, nComponents = 0, bytesPerSample = 0; int[] horizontalSampling = null, verticalSampling = null; int[] quantizationTable = null; short[][] huffmanTables = null; int startPredictor = 0, endPredictor = 0; int pointTransform = 0; int[] dcTable = null, acTable = null; while (in.getFilePointer() < in.length() - 1) { int code = in.readShort() & 0xffff; int length = in.readShort() & 0xffff; long fp = in.getFilePointer(); if (length > 0xff00) { length = 0; in.seek(fp - 2); } else if (code == SOS) { nComponents = in.read(); dcTable = new int[nComponents]; acTable = new int[nComponents]; for (int i=0; i<nComponents; i++) { int componentSelector = in.read(); int tableSelector = in.read(); dcTable[i] = (tableSelector & 0xf0) >> 4; acTable[i] = tableSelector & 0xf; } startPredictor = in.read(); endPredictor = in.read(); pointTransform = in.read() & 0xf; // read image data byte[] toDecode = new byte[(int) (in.length() - in.getFilePointer())]; in.read(toDecode); // scrub out byte stuffing ByteVector b = new ByteVector(); for (int i=0; i<toDecode.length; i++) { byte val = toDecode[i]; if (val == (byte) 0xff) { if (toDecode[i + 1] == 0) b.add(val); i++; } else { b.add(val); } } toDecode = b.toByteArray(); <API key> bb = new <API key>( new ByteArrayHandle(toDecode)); HuffmanCodec huffman = new HuffmanCodec(); HuffmanCodecOptions huffmanOptions = new HuffmanCodecOptions(); huffmanOptions.bitsPerSample = bitsPerSample; huffmanOptions.maxBytes = buf.length / nComponents; int nextSample = 0; while (nextSample < buf.length / nComponents) { for (int i=0; i<nComponents; i++) { huffmanOptions.table = huffmanTables[dcTable[i]]; int v = 0; if (huffmanTables != null) { v = huffman.getSample(bb, huffmanOptions); if (nextSample == 0) { v += (int) Math.pow(2, bitsPerSample - 1); } } else { throw new <API key>( "Arithmetic coding not supported"); } // apply predictor to the sample int predictor = startPredictor; if (nextSample < width * bytesPerSample) predictor = 1; else if ((nextSample % (width * bytesPerSample)) == 0) { predictor = 2; } int componentOffset = i * (buf.length / nComponents); int indexA = nextSample - bytesPerSample + componentOffset; int indexB = nextSample - width * bytesPerSample + componentOffset; int indexC = nextSample - (width + 1) * bytesPerSample + componentOffset; int sampleA = indexA < 0 ? 0 : DataTools.bytesToInt(buf, indexA, bytesPerSample, false); int sampleB = indexB < 0 ? 0 : DataTools.bytesToInt(buf, indexB, bytesPerSample, false); int sampleC = indexC < 0 ? 0 : DataTools.bytesToInt(buf, indexC, bytesPerSample, false); if (nextSample > 0) { int pred = 0; switch (predictor) { case 1: pred = sampleA; break; case 2: pred = sampleB; break; case 3: pred = sampleC; break; case 4: pred = sampleA + sampleB + sampleC; break; case 5: pred = sampleA + ((sampleB - sampleC) / 2); break; case 6: pred = sampleB + ((sampleA - sampleC) / 2); break; case 7: pred = (sampleA + sampleB) / 2; break; } v += pred; } int offset = componentOffset + nextSample; DataTools.unpackBytes(v, buf, offset, bytesPerSample, false); } nextSample += bytesPerSample; } bb.close(); } else { length -= 2; // stored length includes length param if (length == 0) continue; if (code == EOI) { } else if (code == SOF3) { // lossless w/Huffman coding bitsPerSample = in.read(); height = in.readShort(); width = in.readShort(); nComponents = in.read(); horizontalSampling = new int[nComponents]; verticalSampling = new int[nComponents]; quantizationTable = new int[nComponents]; for (int i=0; i<nComponents; i++) { in.skipBytes(1); int s = in.read(); horizontalSampling[i] = (s & 0xf0) >> 4; verticalSampling[i] = s & 0x0f; quantizationTable[i] = in.read(); } bytesPerSample = bitsPerSample / 8; if ((bitsPerSample % 8) != 0) bytesPerSample++; buf = new byte[width * height * nComponents * bytesPerSample]; } else if (code == SOF11) { throw new <API key>( "Arithmetic coding is not yet supported"); } else if (code == DHT) { if (huffmanTables == null) { huffmanTables = new short[4][]; } int bytesRead = 0; while (bytesRead < length) { int s = in.read(); byte tableClass = (byte) ((s & 0xf0) >> 4); byte destination = (byte) (s & 0xf); int[] nCodes = new int[16]; Vector table = new Vector(); for (int i=0; i<nCodes.length; i++) { nCodes[i] = in.read(); table.add(new Short((short) nCodes[i])); } for (int i=0; i<nCodes.length; i++) { for (int j=0; j<nCodes[i]; j++) { table.add(new Short((short) (in.read() & 0xff))); } } huffmanTables[destination] = new short[table.size()]; for (int i=0; i<huffmanTables[destination].length; i++) { huffmanTables[destination][i] = ((Short) table.get(i)).shortValue(); } bytesRead += table.size() + 1; } } in.seek(fp + length); } } if (options.interleaved && nComponents > 1) { // data is stored in planar (RRR...GGG...BBB...) order byte[] newBuf = new byte[buf.length]; for (int i=0; i<buf.length; i+=nComponents*bytesPerSample) { for (int c=0; c<nComponents; c++) { int src = c * (buf.length / nComponents) + (i / nComponents); int dst = i + c * bytesPerSample; System.arraycopy(buf, src, newBuf, dst, bytesPerSample); } } buf = newBuf; } if (options.littleEndian && bytesPerSample > 1) { // data is stored in big endian order // reverse the bytes in each sample byte[] newBuf = new byte[buf.length]; for (int i=0; i<buf.length; i+=bytesPerSample) { for (int q=0; q<bytesPerSample; q++) { newBuf[i + bytesPerSample - q - 1] = buf[i + q]; } } buf = newBuf; } return buf; } }
<?php /** * The template for displaying all pages * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages and that * other 'pages' on your WordPress site will use a different template. * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ get_header(); ?> <div id="main-content" class="main-content"> <?php if (is_front_page() && <API key>()) { // Include the featured content template. get_template_part('featured-content'); } ?> <div id="primary" class="content-area"> <div id="content" class="site-content" role="main"> <?php // Start the Loop. while (have_posts()) : the_post(); // Include the page content template. get_template_part('content', 'page'); // If comments are open or we have at least one comment, load up the comment template. if (comments_open() || get_comments_number()) { comments_template(); } endwhile; ?> </div> <!-- #content --> </div> <!-- #primary --> <?php get_sidebar('content'); ?> </div><!-- #main-content --> <?php get_sidebar(); get_footer();
\par \chapter{{\tt DenseMtx}: Dense matrix object} \par The {\tt DenseMtx} object contains a dense matrix along with row and column indices. The entries in the matrix can be double precision real or double precision complex. It needs to be able to manage its own storage, much like the {\tt Chv} and {\tt SubMtx} objects that are used during the factor and solves, so we include this capability via a contained {\tt DV} object. A {\tt DenseMtx} object may also be found in a list, so there is a {\tt next} field that points to another {\tt DenseMtx} object. \par The {\tt DenseMtx} object also exists in an MPI environment, where it holds the solution and right hand side matrices. Since each of these two matrices is distributed, a processor {\it owns} only part of the global matrix, and so the need for row and column indices to specify which rows and columns are present on which processor.
# create TRD geometry from patch file SOURCE=<API key>.C TARGET=<API key>.C PATCH=p3etop1m.patch echo echo cp $SOURCE $TARGET echo patch $TARGET $PATCH echo root -l $TARGET echo cp $SOURCE $TARGET patch $TARGET $PATCH root -l $TARGET
#ifndef CGITCP_H #define CGITCP_H #include "httpd.h" int cgiTcp(HttpdConnData *connData); #endif
<?php namespace SJBR\StaticInfoTables\Domain\Model; class Country extends AbstractEntity { /** * The German short name * @var string */ protected $shortNameDe = ''; /** * Sets the German short name. * * @param string $shortNameDe * * @return void */ public function setShortNameDe($shortNameDe) { $this->shortNameDe = $shortNameDe; } /** * Gets the German short name. * * @return string */ public function getShortNameDe() { return $this->shortNameDe; } } ?>
using System; using System.Reflection; namespace OLPL_API_Server.Areas.HelpPage.ModelDescriptions { public interface <API key> { string GetDocumentation(MemberInfo member); string GetDocumentation(Type type); } }
#ifndef <API key> #define <API key> #include <QGraphicsItem> #include <memory> class TileManager; class <API key>; class WSITileGraphicsItem : public QGraphicsItem { public: // make sure to set `item` to NULL in the constructor WSITileGraphicsItem(QPixmap* item, unsigned int tileX, unsigned int tileY, unsigned int tileSize, unsigned int tileByteSize, unsigned int itemLevel, unsigned int lastRenderLevel, const std::vector<float>& imgDownsamples, TileManager* manager); ~WSITileGraphicsItem(); // you will need to add a destructor // (and probably a copy constructor and assignment operator) QRectF boundingRect() const; void paint(QPainter *painter, const <API key> *option, QWidget *widget); void debugPrint(); unsigned int getTileX() { return _tileX; } unsigned int getTileY() { return _tileY; } unsigned int getTileLevel() { return _itemLevel; } unsigned int getTileSize() { return _tileSize; } private: // you'll probably want to store information about where you're // going to load the pixmap from, too QPixmap *_item; float _physicalSize; float _upperLOD; float _lowerLOD; unsigned int _itemLevel; unsigned int _tileX; unsigned int _tileY; unsigned int _tileSize; unsigned int _tileByteSize; unsigned int _lastRenderLevel; QRectF _boundingRect; TileManager* _manager; }; #endif
#ifndef <API key> #define <API key> #include "kdevdeepcopy.h" #include <qevent.h> #include <qvaluelist.h> #if QT_VERSION < 0x030100 #include <kdevmutex.h> #else #include <qmutex.h> #endif enum { Event_FileParsed = QEvent::User + 1000 }; class FileParsedEvent: public QCustomEvent { public: FileParsedEvent( const QString& fileName, const QValueList<Problem>& problems, bool fromDisk = false ) : QCustomEvent( Event_FileParsed ), m_fileName( deepCopy( fileName ) ), m_fromDisk( fromDisk ) { // the members are deep copies <API key><Problem> it = problems.begin(); while ( it != problems.end() ) { Problem p = *it; m_problems.append( Problem( deepCopy( p.text() ), p.line(), p.column(), p.level() ) ); m_problems.back().setFileName( deepCopy( p.fileName() ) ); ++it; } } QString fileName() const { return m_fileName; } QValueList<Problem> problems() const { return m_problems; } bool fromDisk() { return m_fromDisk; } private: QString m_fileName; QValueList<Problem> m_problems; bool m_fromDisk; private: FileParsedEvent( const FileParsedEvent& source ); void operator = ( const FileParsedEvent& source ); }; #endif // <API key> // kate: indent-mode csands; tab-width 4;
import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.AffineTransform; import java.awt.geom.Path2D; import java.awt.image.BufferedImage; import java.awt.image.Raster; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; /** * Scaled Line Clipping rendering test */ public class ScaleClipTest { static final boolean SAVE_IMAGE = false; static final int SIZE = 50; enum SCALE_MODE { ORTHO, NON_ORTHO, COMPLEX }; public static void main(String[] args) { // First display which renderer is tested: // JDK9 only: System.setProperty("sun.java2d.renderer.verbose", "true"); System.out.println("Testing renderer: "); // Other JDK: String renderer = "undefined"; try { renderer = sun.java2d.pipe.RenderingEngine.getInstance().getClass().getName(); System.out.println(renderer); } catch (Throwable th) { // may fail with JDK9 jigsaw (jake) if (false) { System.err.println("Unable to get RenderingEngine.getInstance()"); th.printStackTrace(); } } System.out.println("ScaleClipTest: size = " + SIZE); final BufferedImage image = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_INT_ARGB); boolean fail = false; // testNegativeScale: for (SCALE_MODE mode : SCALE_MODE.values()) { try { testNegativeScale(image, mode); } catch (<API key> ise) { System.err.println("testNegativeScale[" + mode + "] failed:"); ise.printStackTrace(); fail = true; } } // testMarginScale: for (SCALE_MODE mode : SCALE_MODE.values()) { try { testMarginScale(image, mode); } catch (<API key> ise) { System.err.println("testMarginScale[" + mode + "] failed:"); ise.printStackTrace(); fail = true; } } // Fail at the end: if (fail) { throw new RuntimeException("ScaleClipTest has failures."); } } private static void testNegativeScale(final BufferedImage image, final SCALE_MODE mode) { final Graphics2D g2d = (Graphics2D) image.getGraphics(); try { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.<API key>); g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); g2d.setBackground(Color.WHITE); g2d.clearRect(0, 0, SIZE, SIZE); g2d.setColor(Color.BLACK); // Bug in <API key>.adjustClipScale() // non ortho scale only final double scale = -1.0; final AffineTransform at; switch (mode) { default: case ORTHO: at = AffineTransform.getScaleInstance(scale, scale); break; case NON_ORTHO: at = AffineTransform.getScaleInstance(scale, scale + 1e-5); break; case COMPLEX: at = AffineTransform.getScaleInstance(scale, scale); at.concatenate(AffineTransform.getShearInstance(1e-4, 1e-4)); break; } g2d.setTransform(at); // Set cap/join to reduce clip margin: g2d.setStroke(new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); final Path2D p = new Path2D.Double(); p.moveTo(scale * 10, scale * 10); p.lineTo(scale * (SIZE - 10), scale * (SIZE - 10)); g2d.draw(p); if (SAVE_IMAGE) { try { final File file = new File("<API key>-" + mode + ".png"); System.out.println("Writing file: " + file.getAbsolutePath()); ImageIO.write(image, "PNG", file); } catch (IOException ioe) { ioe.printStackTrace(); } } // Check image: // 25, 25 = black checkPixel(image.getData(), 25, 25, Color.BLACK.getRGB()); } finally { g2d.dispose(); } } private static void testMarginScale(final BufferedImage image, final SCALE_MODE mode) { final Graphics2D g2d = (Graphics2D) image.getGraphics(); try { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.<API key>); g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); g2d.setBackground(Color.WHITE); g2d.clearRect(0, 0, SIZE, SIZE); g2d.setColor(Color.BLACK); // Bug in Stroker.init() // ortho scale only: scale used twice ! final double scale = 1e-2; final AffineTransform at; switch (mode) { default: case ORTHO: at = AffineTransform.getScaleInstance(scale, scale); break; case NON_ORTHO: at = AffineTransform.getScaleInstance(scale, scale + 1e-5); break; case COMPLEX: at = AffineTransform.getScaleInstance(scale, scale); at.concatenate(AffineTransform.getShearInstance(1e-4, 1e-4)); break; } g2d.setTransform(at); final double invScale = 1.0 / scale; // Set cap/join to reduce clip margin: final float w = (float) (3.0 * invScale); g2d.setStroke(new BasicStroke(w, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); final Path2D p = new Path2D.Double(); p.moveTo(invScale * -0.5, invScale * 10); p.lineTo(invScale * -0.5, invScale * (SIZE - 10)); g2d.draw(p); if (SAVE_IMAGE) { try { final File file = new File("<API key>-" + mode + ".png"); System.out.println("Writing file: " + file.getAbsolutePath()); ImageIO.write(image, "PNG", file); } catch (IOException ioe) { ioe.printStackTrace(); } } // Check image: // 0, 25 = black checkPixel(image.getData(), 0, 25, Color.BLACK.getRGB()); } finally { g2d.dispose(); } } private static void checkPixel(final Raster raster, final int x, final int y, final int expected) { final int[] rgb = (int[]) raster.getDataElements(x, y, null); if (rgb[0] != expected) { throw new <API key>("bad pixel at (" + x + ", " + y + ") = " + rgb[0] + " expected: " + expected); } } }
<!-- Creator : groff version 1.21 --> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http: <html> <head> <meta name="generator" content="groff -Thtml, see www.gnu.org"> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta name="Content-Style" content="text/css"> <style type="text/css"> p { margin-top: 0; margin-bottom: 0; vertical-align: top } pre { margin-top: 0; margin-bottom: 0; vertical-align: top } table { margin-top: 0; margin-bottom: 0; vertical-align: top } h1 { text-align: center } </style> <title>NTFSDEBUG</title> </head> <body> <h1 align="center">NTFSDEBUG</h1> <a href="#NAME">NAME</a><br> <a href="#SYNOPSIS">SYNOPSIS</a><br> <a href="#DESCRIPTION">DESCRIPTION</a><br> <a href="#EXIT CODES">EXIT CODES</a><br> <a href="#EXAMPLES">EXAMPLES</a><br> <a href="#KNOWN ISSUES">KNOWN ISSUES</a><br> <a href="#AVAILABILITY">AVAILABILITY</a><br> <hr> <h2>NAME <a name="NAME"></a> </h2> <p style="margin-left:11%; margin-top: 1em">ntfsdebug &minus; Efficiently dump the metadata contents of an NTFS volume.</p> <h2>SYNOPSIS <a name="SYNOPSIS"></a> </h2> <p style="margin-left:11%; margin-top: 1em"><b>ntfsdebug</b> <i>device|image</i></p> <h2>DESCRIPTION <a name="DESCRIPTION"></a> </h2> <p style="margin-left:11%; margin-top: 1em"><i><b>ntfsdebug</b></i> will efficiently extract all relevant metadata from an NTFS volume and dump it to standard output. It works at disk sector level and copies only the used data. Unused disk space becomes zero. <b>ntfsdebug</b> can be useful to exact the metadata snapshot of an NTFS file system for developers to investigate and troubleshoot users&rsquo; issues using the clone without the risk of destroying the original file system.</p> <h2>EXIT CODES <a name="EXIT CODES"></a> </h2> <p style="margin-left:11%; margin-top: 1em">The exit code is 0 on success, non&minus;zero otherwise.</p> <h2>EXAMPLES <a name="EXAMPLES"></a> </h2> <p style="margin-left:11%; margin-top: 1em">Dump NTFS metadata on /dev/sda1 to a compressed metadata image:</p> <p style="margin-left:22%; margin-top: 1em"><b>ntfsdebug /dev/sda1 | bzip2 &gt; sda1.img.bz2</b></p> <p style="margin-left:11%; margin-top: 1em">Dump NTFS metadata to a remote host, using ssh. Please note that ssh may ask for a password.</p> <p style="margin-left:22%; margin-top: 1em"><b>ntfsdebug /dev/sda1 | bzip2 | ssh host &rsquo;cat &gt; sda1.img.bzip2&rsquo;</b></p> <h2>KNOWN ISSUES <a name="KNOWN ISSUES"></a> </h2> <p style="margin-left:11%; margin-top: 1em">If you find a problem then please send an email describing it to ntfs-support@tuxera.com.</p> <h2>AVAILABILITY <a name="AVAILABILITY"></a> </h2> <p style="margin-left:11%; margin-top: 1em"><b>ntfsdebug</b> is part of the <b>Tuxera NTFS</b> package.</p> <hr> </body> </html>
/* <API key>: GPL-2.0-only */ #ifndef <API key> #define <API key> #include <types.h> enum { /* Read and clear power state information */ KB_POWER_SMI = 0x04, /* Read but do not clear power state information */ KB_POWER_STATUS = 0x05, /* Inform the EC about the reason host is turning off */ KB_POWER_OFF = 0x08, /* Control wireless radios */ KB_RADIO_CONTROL = 0x2b, /* Save PS/2 data before S3 suspend */ KB_SAVE = 0x2f, /* Restore PS/2 data after S3 resume */ KB_RESTORE = 0x30, /* Manage the EC control of camera power */ KB_CAMERA = 0x33, /* Retrieve information about the EC */ KB_EC_INFO = 0x38, /* Set ACPI mode on or off */ KB_ACPI = 0x3a, /* Board ID */ KB_BOARD_ID = 0x3d, /* Change ACPI wake up source */ <API key> = 0x4a, /* Manage the EC power button passthru to the host */ <API key> = 0x3e, /* Manage the EC control of speaker mute */ KB_HW_MUTE_CONTROL = 0x60, /* Inform the EC that the host is about to enter S3 */ KB_SLP_EN = 0x64, /* Inform the EC about BIOS boot progress */ KB_BIOS_PROGRESS = 0xc2, /* Inform the EC that a fatal error occurred */ KB_ERR_CODE = 0x7b, /* Set CPU ID */ KB_CPU_ID = 0xbf, }; enum ec_ram_addr { /* Indicate if EC uses signed firmware */ EC_RAM_SIGNED_FW = 0x5c, /* Indicate support for S0ix */ EC_RAM_S0IX_SUPPORT = 0xb8, }; enum set_acpi_mode_cmd { ACPI_OFF = 0, ACPI_ON }; enum bios_progress_code { <API key> = 0x00, <API key> = 0x01, <API key> = 0x02, <API key> = 0x03, <API key> = 0x04, }; enum ec_audio_mute { AUDIO_MUTE = 0, /* Mute speakers immediately */ AUDIO_UNMUTE_125MS, /* Unmute in 125ms */ }; enum ec_radio { RADIO_WIFI = 0, RADIO_WWAN, RADIO_BT, }; enum ec_radio_action { RADIO_READ = 1, RADIO_WRITE, RADIO_TOGGLE, }; enum ec_camera { CAMERA_ON = 0, CAMERA_OFF }; enum ec_err_code { DLED_MEMORY = 0x03, DLED_PANEL = 0x10, DLED_ROM = 0x19, }; /** * <API key>() - Control wireless radios. * @ec_radio: Wireless radio type. * @state: Turn radio on or off. * Return: 0 if successful or negative error code on failure. */ int <API key>(enum ec_radio radio, uint8_t state); /* * EC Information */ enum get_ec_info_cmd { GET_EC_LABEL = 0, GET_EC_SVN_REV, GET_EC_MODEL_NO, GET_EC_BUILD_DATE }; #define EC_INFO_MAX_SIZE 9 struct <API key> { char data[EC_INFO_MAX_SIZE]; /* ASCII NUL terminated string */ }; /** * wilco_ec_get_info * * Read a specific information string from the EC and return it in * the caller-provided buffer of at least EC_INFO_MAX_SIZE bytes. * * @cmd: Information to retrieve * @info: Character array of EC_INFO_MAX_SIZE bytes * * Returns 0 if successful and resulting string is in 'info' * Returns -1 if the EC command fails */ int wilco_ec_get_info(enum get_ec_info_cmd cmd, char *info); /** * <API key> * * Retrieve and print all the information strings from the EC: * * GET_EC_LABEL * GET_EC_SVN_REV * GET_EC_MODEL_NO * GET_EC_BUILD_DATE */ void <API key>(void); /* * EC Power State */ enum ec_power_off_reason { EC_PWROFF_FLASH = 0x11, <API key> = 0x12, <API key> = 0x13, EC_PWROFF_LOBAT = 0x15, <API key> = 0x16, <API key> = 0x18, EC_PWROFF_WDT = 0x1b, <API key> = 0x22, EC_PWROFF_ERR_CODE = 0x23, <API key> = 0x27, EC_PWROFF_PAID_CPU = 0x28, EC_PWROFF_PAID_GFX = 0x29, EC_PWROFF_PAID_CLK = 0x2a, <API key> = 0x2b, <API key> = 0x2c, <API key> = 0x2d, EC_SWOFF_ACPI = 0x31, <API key> = 0x33, <API key> = 0x34, <API key> = 0x37, EC_SWOFF_HARD_RESET = 0x3b, EC_SWOFF_FSMI = 0x3f, EC_PWRLOG_THERMTRIP = 0x41, EC_PWRLOG_NO_S5 = 0x42, EC_PWROFF_4S_PWRB = 0x44, <API key> = 0x45, <API key> = 0x48, <API key> = 0x4b, }; /** * wilco_ec_power_off * * Tell the EC why the host is about to power off. */ void wilco_ec_power_off(enum ec_power_off_reason reason); /** * wilco_ec_slp_en * * Tell the EC that the host is entering a sleep state. */ void wilco_ec_slp_en(void); enum ec_pm1_state { EC_PM1_AC_AVAIL = BIT(0), /* AC available */ EC_PM1_BAT_AVAIL = BIT(1), /* Battery available */ EC_PM1_LO_BAT1 = BIT(2), /* Battery 1 low */ EC_PM1_LO_BAT2 = BIT(3), /* Battery 2 low */ EC_PM1_LID_OPEN = BIT(4), /* Lid is open */ EC_PM1_LCD_POWER = BIT(5), /* LCD is powered */ EC_PM1_OVER_TEMP = BIT(6), /* CPU is over temperature */ EC_PM1_DOCKED = BIT(7), /* System is docked */ }; enum ec_pm2_state { EC_PM2_SYS_MB_PCIE = BIT(0), /* MB has PCIe */ EC_PM2_SYS_MB_SATA = BIT(1), /* MB has SATA */ EC_PM2_PWRB_PRESSED = BIT(2), /* Power button is pressed */ EC_PM2_TURBO_MODE = BIT(3), /* Turbo mode */ }; enum ec_pm3_state { EC_PM3_BAT1_PRES = BIT(2), /* Battery 1 is present */ EC_PM3_BAT2_PRES = BIT(3), /* Battery 2 is present */ EC_PM3_LOWER_PSTATE = BIT(6), /* EC requests lower P-state */ EC_PM3_CPU_THROTTLE = BIT(7), /* EC requests CPU throttle */ }; enum ec_pm4_state { EC_PM4_BAT1_CHG = BIT(0), /* Battery 1 is being charged */ EC_PM4_BAT2_CHG = BIT(1), /* Battery 2 is being charged */ EC_PM4_BAT1_PWR = BIT(2), /* Battery 1 is powering the system */ EC_PM4_BAT2_PWR = BIT(3), /* Battery 2 is powering the system */ EC_PM4_PANEL_STATE = BIT(5), /* Panel power state */ }; enum ec_pm5_state { EC_PM5_INT_HD_SATA = BIT(7), /* Internal SATA HDD */ }; enum ec_pm6_state { EC_PM6_WLAN_SWITCH = BIT(0), /* Wireless switch */ EC_PM6_SYS_MB_MODEM = BIT(1), /* MB has modem */ EC_PM6_ETH_STATE = BIT(2), /* Ethernet cable state */ EC_PM6_AC_UPDATE = BIT(3), /* Update AC information */ }; enum ec_pm1_event { EC_EV1_PWRB_PRESSED = BIT(0), /* Power button was pressed */ <API key> = BIT(1), /* Hotkey was pressed */ <API key> = BIT(2), /* PMx state changed */ }; enum ec_pm2_event { <API key> = BIT(0), /* Monitor switch status */ }; struct ec_pm_event_state { uint8_t event[2]; /* ec_pm{1,2}_event */ uint8_t state[6]; /* ec_pm{1,2,3,4,5,6}_state */ uint8_t hotkey; /* Hotkey, if pressed */ uint16_t ac_type; /* AC adapter information */ }; /** * wilco_ec_get_pm * * Retrieve power and event information from the EC. * * @pm: Power event state structure to fill out * @clear: Clear EC event state after reading * * Returns 0 if EC command was successful * Returns -1 if EC command failed */ int wilco_ec_get_pm(struct ec_pm_event_state *pm, bool clear); /** * <API key> * * Retrieve the lid state without clearing it in the EC. * * Returns 1 if the lid is open, 0 if it is closed * Returns -1 if the EC command failed */ int <API key>(void); /** * <API key> * * Retrieve the board ID value from the EC. * @id: Pointer to variable to store the ID read from the EC. * * Returns number of bytes transferred from the EC * Returns -1 if the EC command failed */ int <API key>(uint8_t *id); enum ec_wake_change { WAKE_OFF = 0, WAKE_ON }; /** * <API key> * * Change acpi wake up source. * @source: Wake up source that can be enabled/disabled. * @ec_wake_change: On/off switch. * * Returns -1 if the EC command failed */ int <API key>(uint8_t source, enum ec_wake_change change); enum ec_acpi_wake_events { EC_ACPI_WAKE_PWRB = BIT(0), /* Wake up by power button */ EC_ACPI_WAKE_LID = BIT(1), /* Wake up by lid switch */ EC_ACPI_WAKE_RTC = BIT(5), /* Wake up by RTC */ }; /** * wilco_ec_signed_fw * * Indicate if the EC uses signed firmware. * * Returns 1 if EC uses signed firmware, otherwise returns 0 */ int wilco_ec_signed_fw(void); /** * <API key> * * Save this post code as the most recent progress step. If the boot fails * and calls die_notify() this post code will be used to send an error code * to the EC indicating the failure. * * @post_code: Post code to save */ void <API key>(uint8_t post_code); /** * wilco_ec_set_cpuid * * Set CPU ID to EC. * * @cpuid: read CPU ID from cpu_eax(1) * @cpu_cores: cores of CPU * @gpu_cores: cores of GPU * * Returns 0 if EC command was successful * Returns -1 if EC command failed */ int wilco_ec_set_cpuid(uint32_t cpuid, uint8_t cpu_cores, uint8_t gpu_cores); #endif /* <API key> */
# Twisted, the Framework of Your Internet # This library is free software; you can redistribute it and/or # modify it under the terms of version 2.1 of the GNU Lesser General Public # This library is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # You should have received a copy of the GNU Lesser General Public # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """Standard input/out/err support. API Stability: semi-stable Future Plans: support for stderr, perhaps Maintainer: U{Itamar Shtull-Trauring<mailto:twisted@itamarst.org>} """ # system imports import sys, os, select, errno # Sibling Imports import abstract, fdesc, protocol from main import CONNECTION_LOST _stdio_in_use = 0 class StandardIOWriter(abstract.FileDescriptor): connected = 1 ic = 0 def __init__(self): abstract.FileDescriptor.__init__(self) self.fileno = sys.__stdout__.fileno fdesc.setNonBlocking(self.fileno()) def writeSomeData(self, data): try: return os.write(self.fileno(), data) return rv except IOError, io: if io.args[0] == errno.EAGAIN: return 0 elif io.args[0] == errno.EPERM: return 0 return CONNECTION_LOST except OSError, ose: if ose.errno == errno.EPIPE: return CONNECTION_LOST if ose.errno == errno.EAGAIN: return 0 raise def connectionLost(self, reason): abstract.FileDescriptor.connectionLost(self, reason) os.close(self.fileno()) class StandardIO(abstract.FileDescriptor): """I can connect Standard IO to a twisted.protocol I act as a selectable for sys.stdin, and provide a write method that writes to stdout. """ def __init__(self, protocol): """Create me with a protocol. This will fail if a StandardIO has already been instantiated. """ abstract.FileDescriptor.__init__(self) global _stdio_in_use if _stdio_in_use: raise RuntimeError, "Standard IO already in use." _stdio_in_use = 1 self.fileno = sys.__stdin__.fileno fdesc.setNonBlocking(self.fileno()) self.protocol = protocol self.startReading() self.writer = StandardIOWriter() self.protocol.makeConnection(self) def write(self, data): """Write some data to standard output. """ self.writer.write(data) def doRead(self): """Some data's readable from standard input. """ return fdesc.readFromFD(self.fileno(), self.protocol.dataReceived) def closeStdin(self): """Close standard input. """ self.writer.loseConnection() def connectionLost(self, reason): """The connection was lost. """ self.protocol.connectionLost()
package br.ufpe.cin.amadeus.amadeus_mobile.util; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile; import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Forum; import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Game; import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.LearningObject; import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll; public class Conversor { /** * Method that converts AMADeUs Course object into Mobile Course object * @param curso - AMADeUs Course to be converted * @return - Converted Mobile Course object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile converterCurso(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Course curso){ br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile(); retorno.setId(curso.getId()); retorno.setName(curso.getName()); retorno.setContent(curso.getContent()); retorno.setObjectives(curso.getObjectives()); retorno.setModules(converterModulos(curso.getModules())); retorno.setKeywords(converterKeywords(curso.getKeywords())); ArrayList<String> nomes = new ArrayList<String>(); nomes.add(curso.getProfessor().getName()); retorno.setTeachers(nomes); retorno.setCount(0); retorno.<API key>(curso.<API key>()); retorno.setFinalCourseDate(curso.getFinalCourseDate()); retorno.<API key>(curso.<API key>()); return retorno; } /** * Method that converts a AMADeUs Course object list into Mobile Course object list * @param cursos - AMADeUs Course object list to be converted * @return - Converted Mobile Course object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile> converterCursos(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Course> cursos){ ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Course c : cursos){ retorno.add(Conversor.converterCurso(c)); } return retorno; } /** * Method that converts AMADeUs Module object into Mobile Module object * @param modulo - AMADeUs Module object to be converted * @return - Converted Mobile Module object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile converterModulo(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Module modulo){ br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile mod = new br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile(modulo.getId(), modulo.getName()); List<HomeworkMobile> listHomeworks = new ArrayList<HomeworkMobile>(); for (Poll poll : modulo.getPolls()) { listHomeworks.add( Conversor.<API key>(poll) ); } for (Forum forum : modulo.getForums()) { listHomeworks.add( Conversor.<API key>(forum) ); } for(Game game : modulo.getGames()){ listHomeworks.add( Conversor.<API key>(game) ); } for(LearningObject learning : modulo.getLearningObjects()){ listHomeworks.add( Conversor.<API key>(learning) ); } mod.setHomeworks(listHomeworks); mod.setMaterials(converterMaterials(modulo.getMaterials())); return mod; } /** * Mothod that converts a AMADeUs Module object list into Mobile Module object list * @param modulos - AMADeUs Module object list to be converted * @return - Converted Mobile Module object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile> converterModulos(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Module> modulos){ ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Module m : modulos){ retorno.add(Conversor.converterModulo(m)); } return retorno; } /** * Method that converts AMADeUs Homework object into Mobile Homework object * @param home - AMADeUs Homework object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterHomework(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Homework home){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(home.getId()); retorno.setName(home.getName()); retorno.setDescription(home.getDescription()); retorno.setInitDate(home.getInitDate()); retorno.setDeadline(home.getDeadline()); retorno.setAlowPostponing(home.getAllowPostponing()); retorno.setInfoExtra(""); retorno.setTypeActivity(HomeworkMobile.HOMEWORK); return retorno; } /** * Method that converts AMADeUs Game object into Mobile Homework object * @param game - AMADeUs Game object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile <API key>(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Game game){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(game.getId()); retorno.setName(game.getName()); retorno.setDescription(game.getDescription()); retorno.setInfoExtra(game.getUrl()); retorno.setTypeActivity(HomeworkMobile.GAME); return retorno; } /** * Method that converts AMADeUs Forum object into Mobile Homework object * @param forum - AMADeUs Forum object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile <API key>(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Forum forum){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(forum.getId()); retorno.setName(forum.getName()); retorno.setDescription(forum.getDescription()); retorno.setInitDate(forum.getCreationDate()); retorno.setInfoExtra(""); retorno.setTypeActivity(HomeworkMobile.FORUM); return retorno; } /** * Method that converts AMADeUs Poll object into Mobile Homework object * @param poll - AMADeUs Poll object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile <API key>(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll poll){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(poll.getId()); retorno.setName(poll.getName()); retorno.setDescription(poll.getQuestion()); retorno.setInitDate(poll.getCreationDate()); retorno.setDeadline(poll.getFinishDate()); retorno.setInfoExtra(""); retorno.setTypeActivity(HomeworkMobile.POLL); return retorno; } /** * Method that converts AMADeUs Multimedia object into Mobile Homework object * @param media - AMADeUs Multimedia object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile <API key>(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Multimedia media){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(media.getId()); retorno.setName(media.getName()); retorno.setDescription(media.getDescription()); retorno.setInfoExtra(media.getUrl()); retorno.setTypeActivity(HomeworkMobile.MULTIMEDIA); return retorno; } /** * Method that converts AMADeUs Video object into Mobile Homework object * @param video - AMADeUs Video object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile <API key>(br.ufpe.cin.amadeus.amadeus_sdmm.dao.Video video){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(video.getId()); retorno.setName(video.getName()); retorno.setDescription(video.getDescription()); retorno.setInitDate(video.getDateinsertion()); retorno.setInfoExtra(video.getTags()); retorno.setTypeActivity(HomeworkMobile.VIDEO); return retorno; } public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile <API key>( br.ufpe.cin.amadeus.amadeus_web.domain.content_management.LearningObject learning) { br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(learning.getId()); retorno.setName(learning.getName()); retorno.setUrl(learning.getUrl()); retorno.setDescription(learning.getDescription()); retorno.setDeadline(learning.getCreationDate()); retorno.setTypeActivity(HomeworkMobile.LEARNING_OBJECT); return retorno; } /** * Method that converts AMADeUs Homework object list into Mobile Homework object list * @param homes - AMADeUs Homework object list to be converted * @return - Converted Mobile Homework object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile> converterHomeworks(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Homework> homes){ ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Homework h : homes){ retorno.add(Conversor.converterHomework(h)); } return retorno; } /** * Method that converts AMADeUs Material object into Mobile Material object * @param mat - AMADeUs Material object to be converted * @return - Mobile Material object converted */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile converterMaterial(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Material mat){ br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile(); retorno.setId(mat.getId()); retorno.setName(mat.getArchiveName()); retorno.setAuthor(converterPerson(mat.getAuthor())); retorno.setPostDate(mat.getCreationDate()); return retorno; } /** * Method that converts AMADeUs Mobile Material object list into Mobile Material object list * @param mats - AMADeUs Material object list * @return - Mobile Material object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile> converterMaterials(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Material> mats){ ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Material mat : mats){ retorno.add(Conversor.converterMaterial(mat)); } return retorno; } /** * Method that converts AMADeUs Keyword object into Mobile Keyword object * @param key - AMADeUs Keyword object to be converted * @return - Converted Keywork object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile converterKeyword(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Keyword key){ br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile(); retorno.setId(key.getId()); retorno.setName(key.getName()); retorno.setPopularity(key.getPopularity()); return retorno; } /** * Method that converts AMADeUs Keyword object list into a Mobile Keyword HashSet object * @param keys - AMADeUs Keyword object list to be converted * @return - Mobile Keywork HashSet object list */ public static HashSet<br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile> converterKeywords(Set<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Keyword> keys){ HashSet<br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile> retorno = new HashSet<br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Keyword k : keys){ retorno.add(Conversor.converterKeyword(k)); } return retorno; } /** * Method that converts AMADeUs Choice object into Mobile Choice object * @param ch - AMADeUs Choice object to be converted * @return - Converted Mobile Choice object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile converterChoice(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice ch){ br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile(); retorno.setId(ch.getId()); retorno.setAlternative(ch.getAlternative()); retorno.setVotes(ch.getVotes()); retorno.setPercentage(ch.getPercentage()); return retorno; } /** * Method that converts AMADeUs Choice object list into Mobile Choice object list * @param chs - AMADeUs Choice object list to be converted * @return - Converted Mobile Choice object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile> converterChoices(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice> chs){ List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice c : chs){ retorno.add(Conversor.converterChoice(c)); } return retorno; } /** * Method that converts AMADeUs Poll object into Mobile Poll Object * @param p - AMADeUs Poll object to be converted * @return - Converted Mobile Poll object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile converterPool(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll p){ br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile(); retorno.setId(p.getId()); retorno.setName(p.getName()); retorno.setQuestion(p.getQuestion()); retorno.setInitDate(p.getCreationDate()); retorno.setFinishDate(p.getFinishDate()); retorno.setAnswered(false); retorno.setChoices(converterChoices(p.getChoices())); retorno.setAnsewered(converterAnswers(p.getAnswers())); return retorno; } public static br.ufpe.cin.amadeus.amadeus_mobile.basics.<API key> <API key> (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.LearningObject learning){ br.ufpe.cin.amadeus.amadeus_mobile.basics.<API key> retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.<API key>(); retorno.setId(learning.getId()); retorno.setName(learning.getName()); retorno.setDescription(learning.getDescription()); retorno.setDatePublication(learning.getCreationDate()); retorno.setUrl(learning.getUrl()); return retorno; } /** * Method that converts AMADeUs Poll object list into Mobile Poll object list * @param pls - AMADeUs Poll object list * @return - Converted Mobile object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile> converterPools(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll> pls){ List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll p : pls){ retorno.add(Conversor.converterPool(p)); } return retorno; } /** * Method that converts AMADeUs Answer object into Mobile Answer object * @param ans - AMADeUs Answer object to be converted * @return - Converted Mobile Answer object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile converterAnswer(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer ans){ br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile(); retorno.setId(ans.getId()); retorno.setAnswerDate(ans.getAnswerDate()); retorno.setPerson(converterPerson(ans.getPerson())); return retorno; } /** * Method that converts AMADeUs Answer object list into Mobile Answer object list * @param anss - AMADeUs Answer object list * @return - Converted Mobile object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile> converterAnswers(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer> anss){ List<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer an : anss){ retorno.add(Conversor.converterAnswer(an)); } return retorno; } /** * Method that converts AMADeUs Person object into Mobile Person object * @param p - AMADeUs Person object to be converted * @return - Converted Mobile Person object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile converterPerson(br.ufpe.cin.amadeus.amadeus_web.domain.register.Person p){ return new br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile(p.getId(), p.getAccessInfo().getLogin(), p.getPhoneNumber()); } /** * Method that converts AMADeUs Person object list into Mobile Person object list * @param persons - AMADeUs Person object list to be converted * @return - Converted Mobile Person object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile> converterPersons(List<br.ufpe.cin.amadeus.amadeus_web.domain.register.Person> persons){ List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.register.Person p : persons){ retorno.add(Conversor.converterPerson(p)); } return retorno; } /** * Method that converts Mobile Poll object into AMADeUs Poll Object * @param p - Mobile Poll object to be converted * @return - Converted AMADeUs Poll object */ public static br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll converterPool(br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile p){ br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll retorno = new br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll(); retorno.setId(p.getId()); retorno.setName(p.getName()); retorno.setQuestion(p.getQuestion()); retorno.setCreationDate(p.getInitDate()); retorno.setFinishDate(p.getFinishDate()); retorno.setChoices(converterChoices2(p.getChoices())); retorno.setAnswers(converterAnswers2(p.getAnsewered())); return retorno; } /** * Method that converts Mobile Choice object into AMADeUs Choice object * @param ch - Mobile Choice object to be converted * @return - Converted AMADeUs Choice object */ public static br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice converterChoice(br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile ch){ br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice retorno = new br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice(); retorno.setId(ch.getId()); retorno.setAlternative(ch.getAlternative()); retorno.setVotes(ch.getVotes()); retorno.setPercentage(ch.getPercentage()); return retorno; } /** * Method that converts Mobile Choiceobject list into AMADeUs Choice object list * @param chs - Mobile Choice object list to be converted * @return - Converted AMADeUs Choice object list */ public static List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice> converterChoices2(List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile> chs){ List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice>(); for (br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile c : chs){ retorno.add(Conversor.converterChoice(c)); } return retorno; } /** * Method that converts Mobile Answer object into AMADeUs Answer object * @param ans - Mobile Answer object to be converted * @return - Converted AMADeUs Answer object */ public static br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer converterAnswer(br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile ans){ br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer retorno = new br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer(); retorno.setId(ans.getId()); retorno.setAnswerDate(ans.getAnswerDate()); retorno.setPerson(converterPerson(ans.getPerson())); return retorno; } /** * Method that converts Mobile Answer object list into AMADeUs Answer object list * @param anss - Mobile Answer object list * @return - Converted AMADeUs Answer object list */ public static List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer> converterAnswers2(List<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile> anss){ List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer>(); for (br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile an : anss){ retorno.add(Conversor.converterAnswer(an)); } return retorno; } /** * Method that converts Mobile Person object into AMADeUs Person object * @param p - Mobile Person object to be converted * @return - Converted AMADeUs Person object */ public static br.ufpe.cin.amadeus.amadeus_web.domain.register.Person converterPerson(br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile p){ br.ufpe.cin.amadeus.amadeus_web.domain.register.Person p1 = new br.ufpe.cin.amadeus.amadeus_web.domain.register.Person(); p1.setId(p.getId()); p1.setName(p.getName()); p1.setPhoneNumber(p.getPhoneNumber()); return p1; } }
package net.sf.memoranda.ui.htmleditor; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Image; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import net.sf.memoranda.ui.htmleditor.util.Local; public class ImageDialog extends JDialog implements WindowListener { private static final long serialVersionUID = <API key>; JPanel headerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); JLabel header = new JLabel(); JPanel areaPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc; JLabel jLabel1 = new JLabel(); public JTextField fileField = new JTextField(); JButton browseB = new JButton(); JLabel jLabel2 = new JLabel(); public JTextField altField = new JTextField(); JLabel jLabel3 = new JLabel(); public JTextField widthField = new JTextField(); JLabel jLabel4 = new JLabel(); public JTextField heightField = new JTextField(); JLabel jLabel5 = new JLabel(); public JTextField hspaceField = new JTextField(); JLabel jLabel6 = new JLabel(); public JTextField vspaceField = new JTextField(); JLabel jLabel7 = new JLabel(); public JTextField borderField = new JTextField(); JLabel jLabel8 = new JLabel(); String[] aligns = {"left", "right", "top", "middle", "bottom", "absmiddle", "texttop", "baseline"}; // Note: align values are not localized because they are HTML keywords public JComboBox<String> alignCB = new JComboBox<String>(aligns); JLabel jLabel9 = new JLabel(); public JTextField urlField = new JTextField(); JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10)); JButton okB = new JButton(); JButton cancelB = new JButton(); public boolean CANCELLED = false; public ImageDialog(Frame frame) { super(frame, Local.getString("Image"), true); try { jbInit(); pack(); } catch (Exception ex) { ex.printStackTrace(); } super.addWindowListener(this); } public ImageDialog() { this(null); } void jbInit() throws Exception { this.setResizable(false); // three Panels, so used BorderLayout for this dialog. headerPanel.setBorder(new EmptyBorder(new Insets(0, 5, 0, 5))); headerPanel.setBackground(Color.WHITE); header.setFont(new java.awt.Font("Dialog", 0, 20)); header.setForeground(new Color(0, 0, 124)); header.setText(Local.getString("Image")); header.setIcon(new ImageIcon( net.sf.memoranda.ui.htmleditor.ImageDialog.class.getResource( "resources/icons/imgbig.png"))); headerPanel.add(header); this.getContentPane().add(headerPanel, BorderLayout.NORTH); areaPanel.setBorder(new EtchedBorder(Color.white, new Color(142, 142, 142))); jLabel1.setText(Local.getString("Image file")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.insets = new Insets(10, 10, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel1, gbc); fileField.setMinimumSize(new Dimension(200, 25)); fileField.setPreferredSize(new Dimension(285, 25)); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 5; gbc.insets = new Insets(10, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; areaPanel.add(fileField, gbc); browseB.setMinimumSize(new Dimension(25, 25)); browseB.setPreferredSize(new Dimension(25, 25)); browseB.setIcon(new ImageIcon( net.sf.memoranda.ui.htmleditor.ImageDialog.class.getResource( "resources/icons/fileopen16.png"))); browseB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { <API key>(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 6; gbc.gridy = 0; gbc.insets = new Insets(10, 5, 5, 10); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(browseB, gbc); jLabel2.setText(Local.getString("ALT text")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.insets = new Insets(5, 10, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel2, gbc); altField.setPreferredSize(new Dimension(315, 25)); altField.setMinimumSize(new Dimension(200, 25)); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 6; gbc.insets = new Insets(5, 5, 5, 10); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; areaPanel.add(altField, gbc); jLabel3.setText(Local.getString("Width")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.insets = new Insets(5, 10, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel3, gbc); widthField.setPreferredSize(new Dimension(30, 25)); widthField.setMinimumSize(new Dimension(30, 25)); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(widthField, gbc); jLabel4.setText(Local.getString("Height")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 2; gbc.insets = new Insets(5, 50, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel4, gbc); heightField.setMinimumSize(new Dimension(30, 25)); heightField.setPreferredSize(new Dimension(30, 25)); gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 2; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(heightField, gbc); jLabel5.setText(Local.getString("H. space")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.insets = new Insets(5, 10, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel5, gbc); hspaceField.setMinimumSize(new Dimension(30, 25)); hspaceField.setPreferredSize(new Dimension(30, 25)); hspaceField.setText("0"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(hspaceField, gbc); jLabel6.setText(Local.getString("V. space")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 3; gbc.insets = new Insets(5, 50, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel6, gbc); vspaceField.setMinimumSize(new Dimension(30, 25)); vspaceField.setPreferredSize(new Dimension(30, 25)); vspaceField.setText("0"); gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 3; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(vspaceField, gbc); jLabel7.setText(Local.getString("Border")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.insets = new Insets(5, 10, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel7, gbc); borderField.setMinimumSize(new Dimension(30, 25)); borderField.setPreferredSize(new Dimension(30, 25)); borderField.setText("0"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(borderField, gbc); jLabel8.setText(Local.getString("Align")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 4; gbc.insets = new Insets(5, 50, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel8, gbc); alignCB.setBackground(new Color(230, 230, 230)); alignCB.setFont(new java.awt.Font("Dialog", 1, 10)); alignCB.setPreferredSize(new Dimension(100, 25)); alignCB.setSelectedIndex(0); gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 4; gbc.gridwidth = 2; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(alignCB, gbc); jLabel9.setText(Local.getString("Hyperlink")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.insets = new Insets(5, 10, 10, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel9, gbc); urlField.setPreferredSize(new Dimension(315, 25)); urlField.setMinimumSize(new Dimension(200, 25)); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.gridwidth = 6; gbc.insets = new Insets(5, 5, 10, 10); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; areaPanel.add(urlField, gbc); this.getContentPane().add(areaPanel, BorderLayout.CENTER); okB.setMaximumSize(new Dimension(100, 26)); okB.setMinimumSize(new Dimension(100, 26)); okB.setPreferredSize(new Dimension(100, 26)); okB.setText(Local.getString("Ok")); okB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { okB_actionPerformed(e); } }); this.getRootPane().setDefaultButton(okB); cancelB.setMaximumSize(new Dimension(100, 26)); cancelB.setMinimumSize(new Dimension(100, 26)); cancelB.setPreferredSize(new Dimension(100, 26)); cancelB.setText(Local.getString("Cancel")); cancelB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { <API key>(e); } }); buttonsPanel.add(okB, null); buttonsPanel.add(cancelB, null); this.getContentPane().add(buttonsPanel, BorderLayout.SOUTH); } void okB_actionPerformed(ActionEvent e) { this.dispose(); } void <API key>(ActionEvent e) { CANCELLED = true; this.dispose(); } private ImageIcon getPreviewIcon(java.io.File file) { ImageIcon tmpIcon = new ImageIcon(file.getPath()); ImageIcon thmb = null; if (tmpIcon.getIconHeight() > 48) { thmb = new ImageIcon(tmpIcon.getImage() .getScaledInstance( -1, 48, Image.SCALE_DEFAULT)); } else { thmb = tmpIcon; } if (thmb.getIconWidth() > 350) { return new ImageIcon(thmb.getImage() .getScaledInstance(350, -1, Image.SCALE_DEFAULT)); } else { return thmb; } } public void updatePreview() { try { if (!(new java.net.URL(fileField.getText()).getPath()).equals("")) header.setIcon(getPreviewIcon(new java.io.File( new java.net.URL(fileField.getText()).getPath()))); } catch (Exception ex) { ex.printStackTrace(); } } public void windowOpened(WindowEvent e) { } public void windowClosing(WindowEvent e) { CANCELLED = true; this.dispose(); } public void windowClosed(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } void <API key>(ActionEvent e) { // Fix until Sun's JVM supports more locales... UIManager.put("FileChooser.lookInLabelText", Local .getString("Look in:")); UIManager.put("FileChooser.upFolderToolTipText", Local.getString( "Up One Level")); UIManager.put("FileChooser.<API key>", Local.getString( "Create New Folder")); UIManager.put("FileChooser.<API key>", Local .getString("List")); UIManager.put("FileChooser.<API key>", Local .getString("Details")); UIManager.put("FileChooser.fileNameLabelText", Local.getString( "File Name:")); UIManager.put("FileChooser.<API key>", Local.getString( "Files of Type:")); UIManager.put("FileChooser.openButtonText", Local.getString("Open")); UIManager.put("FileChooser.<API key>", Local.getString( "Open selected file")); UIManager .put("FileChooser.cancelButtonText", Local.getString("Cancel")); UIManager.put("FileChooser.<API key>", Local.getString( "Cancel")); JFileChooser chooser = new JFileChooser(); chooser.<API key>(false); chooser.setDialogTitle(Local.getString("Choose an image file")); chooser.<API key>(false); chooser.<API key>(JFileChooser.FILES_ONLY); chooser.<API key>( new net.sf.memoranda.ui.htmleditor.filechooser.ImageFilter()); chooser.setAccessory( new net.sf.memoranda.ui.htmleditor.filechooser.ImagePreview( chooser)); chooser.setPreferredSize(new Dimension(550, 375)); java.io.File lastSel = (java.io.File) Context.get( "<API key>"); if (lastSel != null) chooser.setCurrentDirectory(lastSel); if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { try { fileField.setText(chooser.getSelectedFile().toURI().toURL().toString()); header.setIcon(getPreviewIcon(chooser.getSelectedFile())); Context .put("<API key>", chooser .getSelectedFile()); } catch (Exception ex) { fileField.setText(chooser.getSelectedFile().getPath()); } try { ImageIcon img = new ImageIcon(chooser.getSelectedFile() .getPath()); widthField.setText(new Integer(img.getIconWidth()).toString()); heightField .setText(new Integer(img.getIconHeight()).toString()); } catch (Exception ex) { ex.printStackTrace(); } } } }
#ifndef OUTDOOR_PVP_TF_ #define OUTDOOR_PVP_TF_ #include "OutdoorPvP.h" const uint8 <API key> = 5; const uint32 <API key>[<API key>] = { 3519 /*Terokkar Forest*/, 3791 /*Sethekk Halls*/, 3789 /*Shadow Labyrinth*/, 3792 /*Mana-Tombs*/, 3790 /*Auchenai Crypts*/ }; // locked for 6 hours after capture const uint32 TF_LOCK_TIME = 3600 * 6 * 1000; // update lock timer every 1/4 minute (overkill, but this way it's sure the timer won't "jump" 2 minutes at once.) const uint32 TF_LOCK_TIME_UPDATE = 15000; // blessing of auchindoun #define TF_CAPTURE_BUFF 33377 const uint32 TF_ALLY_QUEST = 11505; const uint32 TF_HORDE_QUEST = 11506; enum <API key> { TF_TOWER_NW = 0, TF_TOWER_N, TF_TOWER_NE, TF_TOWER_SE, TF_TOWER_S, TF_TOWER_NUM }; const go_type TFCapturePoints[TF_TOWER_NUM] = { {183104, 530, -3081.65f, 5335.03f, 17.1853f, -2.14675f, 0.0f, 0.0f, 0.878817f, -0.477159f}, {183411, 530, -2939.9f, 4788.73f, 18.987f, 2.77507f, 0.0f, 0.0f, 0.983255f, 0.182236f}, {183412, 530, -3174.94f, 4440.97f, 16.2281f, 1.86750f, 0.0f, 0.0f, 0.803857f, 0.594823f}, {183413, 530, -3603.31f, 4529.15f, 20.9077f, 0.994838f, 0.0f, 0.0f, 0.477159f, 0.878817f}, {183414, 530, -3812.37f, 4899.3f, 17.7249f, 0.087266f, 0.0f, 0.0f, 0.043619f, 0.999048f} }; struct <API key> { uint32 n; uint32 h; uint32 a; }; const <API key> TFTowerWorldStates[TF_TOWER_NUM] = { {0xa79, 0xa7a, 0xa7b}, {0xa7e, 0xa7d, 0xa7c}, {0xa82, 0xa81, 0xa80}, {0xa88, 0xa87, 0xa86}, {0xa85, 0xa84, 0xa83} }; const uint32 <API key>[TF_TOWER_NUM] = { 12226, 12497, 12486, 12499, 12501 }; const uint32 <API key>[TF_TOWER_NUM] = { 12225, 12496, 12487, 12498, 12500 }; enum TFWorldStates { <API key> = 0xa41, <API key> = 0xa40, <API key> = 0xa3f, TF_UI_TOWER_COUNT_H = 0xa3e, TF_UI_TOWER_COUNT_A = 0xa3d, <API key> = 0xa3c, <API key> = 0x9d0, <API key> = 0x9ce, <API key> = 0x9cd, <API key> = 0x9cc, <API key> = 0xad0, <API key> = 0xacf }; enum TFTowerStates { TF_TOWERSTATE_N = 1, TF_TOWERSTATE_H = 2, TF_TOWERSTATE_A = 4 }; class OPvPCapturePointTF : public OPvPCapturePoint { public: OPvPCapturePointTF(OutdoorPvP* pvp, <API key> type); bool Update(uint32 diff); void ChangeState(); void SendChangePhase(); void <API key>(WorldPacket & data); // used when player is activated/inactivated in the area bool HandlePlayerEnter(Player* player); void HandlePlayerLeave(Player* player); void UpdateTowerState(); protected: <API key> m_TowerType; uint32 m_TowerState; }; class OutdoorPvPTF : public OutdoorPvP { public: OutdoorPvPTF(); bool SetupOutdoorPvP(); void <API key>(Player* player, uint32 zone); void <API key>(Player* player, uint32 zone); bool Update(uint32 diff); void <API key>(WorldPacket &data); void <API key>(Player* player); uint32 <API key>() const; void <API key>(uint32 count); uint32 <API key>() const; void <API key>(uint32 count); bool IsLocked() const; private: bool m_IsLocked; uint32 m_LockTimer; uint32 m_LockTimerUpdate; uint32 <API key>; uint32 <API key>; uint32 hours_left, second_digit, first_digit; }; #endif
#ifndef QEMU_AUDIO_H #define QEMU_AUDIO_H #include "qemu/queue.h" #include "qapi/qapi-types-audio.h" typedef void (*audio_callback_fn) (void *opaque, int avail); #ifdef <API key> #define <API key> 1 #else #define <API key> 0 #endif typedef struct audsettings { int freq; int nchannels; AudioFormat fmt; int endianness; } audsettings; audsettings <API key>(<API key> *pdo); int <API key>(AudioFormat fmt); int audio_buffer_frames(<API key> *pdo, audsettings *as, int def_usecs); int <API key>(<API key> *pdo, audsettings *as, int def_usecs); int audio_buffer_bytes(<API key> *pdo, audsettings *as, int def_usecs); typedef enum { AUD_CNOTIFY_ENABLE, AUD_CNOTIFY_DISABLE } audcnotification_e; struct audio_capture_ops { void (*notify) (void *opaque, audcnotification_e cmd); void (*capture) (void *opaque, void *buf, int size); void (*destroy) (void *opaque); }; struct capture_ops { void (*info) (void *opaque); void (*destroy) (void *opaque); }; typedef struct CaptureState { void *opaque; struct capture_ops ops; QLIST_ENTRY (CaptureState) entries; } CaptureState; typedef struct SWVoiceOut SWVoiceOut; typedef struct CaptureVoiceOut CaptureVoiceOut; typedef struct SWVoiceIn SWVoiceIn; typedef struct QEMUSoundCard { char *name; QLIST_ENTRY (QEMUSoundCard) entries; } QEMUSoundCard; typedef struct QEMUAudioTimeStamp { uint64_t old_ts; } QEMUAudioTimeStamp; void AUD_vlog (const char *cap, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); void AUD_log (const char *cap, const char *fmt, ...) GCC_FMT_ATTR(2, 3); void AUD_register_card (const char *name, QEMUSoundCard *card); void AUD_remove_card (QEMUSoundCard *card); CaptureVoiceOut *AUD_add_capture ( struct audsettings *as, struct audio_capture_ops *ops, void *opaque ); void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque); SWVoiceOut *AUD_open_out ( QEMUSoundCard *card, SWVoiceOut *sw, const char *name, void *callback_opaque, audio_callback_fn callback_fn, struct audsettings *settings ); void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw); int AUD_write (SWVoiceOut *sw, void *pcm_buf, int size); int <API key> (SWVoiceOut *sw); void AUD_set_active_out (SWVoiceOut *sw, int on); int AUD_is_active_out (SWVoiceOut *sw); void <API key> (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); uint64_t <API key> (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol); void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvol); SWVoiceIn *AUD_open_in ( QEMUSoundCard *card, SWVoiceIn *sw, const char *name, void *callback_opaque, audio_callback_fn callback_fn, struct audsettings *settings ); void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw); int AUD_read (SWVoiceIn *sw, void *pcm_buf, int size); void AUD_set_active_in (SWVoiceIn *sw, int on); int AUD_is_active_in (SWVoiceIn *sw); void <API key> (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); uint64_t <API key> (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); static inline void *advance (void *p, int incr) { uint8_t *d = p; return (d + incr); } #ifdef __GNUC__ #define audio_MIN(a, b) ( __extension__ ({ \ __typeof (a) ta = a; \ __typeof (b) tb = b; \ ((ta)>(tb)?(tb):(ta)); \ })) #define audio_MAX(a, b) ( __extension__ ({ \ __typeof (a) ta = a; \ __typeof (b) tb = b; \ ((ta)<(tb)?(tb):(ta)); \ })) #else #define audio_MIN(a, b) ((a)>(b)?(b):(a)) #define audio_MAX(a, b) ((a)<(b)?(b):(a)) #endif int wav_start_capture (CaptureState *s, const char *path, int freq, int bits, int nchannels); bool <API key>(void); void audio_cleanup(void); void <API key>(void *samples, int pos, uint64_t *left, uint64_t *right); void <API key>(void *samples, int pos, uint64_t left, uint64_t right); void audio_parse_option(const char *opt); void <API key>(void); void audio_legacy_help(void); #endif /* QEMU_AUDIO_H */
#include "party.hpp" #include "channel_server/channel_server.hpp" #include "channel_server/instance.hpp" #include "channel_server/map_packet.hpp" #include "channel_server/maps.hpp" #include "channel_server/party_packet.hpp" #include "channel_server/player.hpp" #include "channel_server/<API key>.hpp" #include "channel_server/player_packet.hpp" #include "channel_server/player_skills.hpp" #include "channel_server/world_server_packet.hpp" namespace vana { namespace channel_server { party::party(game_party_id party_id) : m_party_id{party_id} { } auto party::set_leader(game_player_id player_id, bool show_packet) -> void { m_leader_id = player_id; if (show_packet) { run_function([this, player_id](ref_ptr<player> player) { player->send(packets::party::set_leader(this, player_id)); }); } } namespace functors { struct join_party_update { auto operator()(ref_ptr<player> target) -> void { target->send(packets::party::join_party(target->get_map_id(), party, player)); } party *party; string player; }; } auto party::add_member(ref_ptr<player> player_value, bool first) -> void { m_members[player_value->get_id()] = player_value; player_value->set_party(this); show_hp_bar(player_value); receive_hp_bar(player_value); if (!first) { // This must be executed first in case the player has an open door already // The town position will need to change upon joining player_value->get_skills()->on_join_party(this, player_value); run_function([&](ref_ptr<player> party_member) { if (party_member != player_value) { party_member->get_skills()->on_join_party(this, player_value); } }); functors::join_party_update func = {this, player_value->get_name()}; run_function(func); } } auto party::add_member(game_player_id id, const string &name, bool first) -> void { m_members[id] = nullptr; if (!first) { functors::join_party_update func = {this, name}; run_function(func); } } auto party::set_member(game_player_id player_id, ref_ptr<player> player) -> void { m_members[player_id] = player; } namespace functors { struct leave_party_update { auto operator()(ref_ptr<player> target) -> void { target->send(packets::party::leave_party(target->get_map_id(), party, player_id, player, kicked)); } party *party; game_player_id player_id; string player; bool kicked; }; } auto party::delete_member(ref_ptr<player> player_value, bool kicked) -> void { player_value->get_skills()->on_leave_party(this, player_value, kicked); m_members.erase(player_value->get_id()); player_value->set_party(nullptr); if (instance *inst = get_instance()) { inst->remove_party_member(get_id(), player_value->get_id()); } run_function([&](ref_ptr<player> party_member) { if (party_member != player_value) { party_member->get_skills()->on_leave_party(this, player_value, kicked); } }); functors::leave_party_update func = {this, player_value->get_id(), player_value->get_name(), kicked}; func(player_value); run_function(func); } auto party::delete_member(game_player_id id, const string &name, bool kicked) -> void { if (instance *inst = get_instance()) { inst->remove_party_member(get_id(), id); } m_members.erase(id); functors::leave_party_update func = {this, id, name, kicked}; run_function(func); } auto party::disband() -> void { if (instance *inst = get_instance()) { inst->party_disband(get_id()); set_instance(nullptr); } run_function([&](ref_ptr<player> party_member) { party_member->get_skills()->on_party_disband(this); }); auto temp = m_members; for (const auto &kvp : temp) { if (auto player = kvp.second) { player->set_party(nullptr); player->send(packets::party::disband_party(this)); } m_members.erase(kvp.first); } } auto party::silent_update() -> void { run_function([this](ref_ptr<player> player) { player->send(packets::party::silent_update(player->get_map_id(), this)); }); } auto party::get_member_by_index(uint8_t one_based_index) -> ref_ptr<player> { ref_ptr<player> member = nullptr; if (one_based_index <= m_members.size()) { uint8_t f = 0; for (const auto &kvp : m_members) { f++; if (f == one_based_index) { member = kvp.second; break; } } } return member; } auto party::<API key>(ref_ptr<player> player) -> int8_t { int8_t index = 0; for (const auto &kvp : m_members) { if (kvp.second == player) { return index; } index++; } return -1; } auto party::run_function(function<void(ref_ptr<player>)> func) -> void { for (const auto &kvp : m_members) { if (auto player = kvp.second) { func(player); } } } auto party::get_all_player_ids() -> vector<game_player_id> { vector<game_player_id> player_ids; for (const auto &kvp : m_members) { player_ids.push_back(kvp.first); } return player_ids; } auto party::get_party_members(game_map_id map_id) -> vector<ref_ptr<player>> { vector<ref_ptr<player>> players; run_function([&players, &map_id](ref_ptr<player> player) { if (map_id == -1 || player->get_map_id() == map_id) { players.push_back(player); } }); return players; } auto party::show_hp_bar(ref_ptr<player> player_value) -> void { run_function([&player_value](ref_ptr<player> test_player) { if (test_player != player_value && test_player->get_map_id() == player_value->get_map_id()) { test_player->send(packets::player::show_hp_bar(player_value->get_id(), player_value->get_stats()->get_hp(), player_value->get_stats()->get_max_hp())); } }); } auto party::receive_hp_bar(ref_ptr<player> player_value) -> void { run_function([&player_value](ref_ptr<player> test_player) { if (test_player != player_value && test_player->get_map_id() == player_value->get_map_id()) { player_value->send(packets::player::show_hp_bar(test_player->get_id(), test_player->get_stats()->get_hp(), test_player->get_stats()->get_max_hp())); } }); } auto party::<API key>(game_map_id map_id) -> int8_t { int8_t count = 0; for (const auto &kvp : m_members) { if (auto test = kvp.second) { if (test->get_map_id() == map_id) { count++; } } } return count; } auto party::<API key>(game_player_level low_bound, game_player_level high_bound) -> bool { bool ret = true; for (const auto &kvp : m_members) { if (auto test = kvp.second) { if (test->get_stats()->get_level() < low_bound || test->get_stats()->get_level() > high_bound) { ret = false; break; } } } return ret; } auto party::warp_all_members(game_map_id map_id, const string &portal_name) -> void { if (map *destination = maps::get_map(map_id)) { const data::type::portal_info * const destination_portal = destination->query_portal_name(portal_name); run_function([&](ref_ptr<player> test) { test->set_map(map_id, destination_portal); }); } } auto party::check_footholds(int8_t member_count, const vector<vector<game_foothold_id>> &footholds) -> result { // Determines if the players are properly arranged (i.e. 5 people on 5 barrels in Kerning PQ) result winner = result::success; int8_t <API key> = 0; hash_set<size_t> <API key>; for (size_t group = 0; group < footholds.size(); group++) { const auto &group_footholds = footholds[group]; for (const auto &kvp : m_members) { if (auto test = kvp.second) { for (const auto &foothold : group_footholds) { if (test->get_foothold() == foothold) { if (<API key>.find(group) != std::end(<API key>)) { winner = result::failure; } else { <API key>.insert(group); <API key>++; } break; } } } if (winner == result::failure) { break; } } if (winner == result::failure) { break; } } if (winner == result::success && <API key> != member_count) { // Not all the foothold groups were indexed winner = result::failure; } return winner; } auto party::verify_footholds(const vector<vector<game_foothold_id>> &footholds) -> result { // Determines if the players match your selected footholds result winner = result::success; hash_set<size_t> <API key>; for (size_t group = 0; group < footholds.size(); group++) { const auto &group_footholds = footholds[group]; for (const auto &kvp : m_members) { if (auto test = kvp.second) { for (const auto &foothold : group_footholds) { if (test->get_foothold() == foothold) { if (<API key>.find(group) != std::end(<API key>)) { winner = result::failure; } else { <API key>.insert(group); } break; } } if (winner == result::failure) { break; } } } if (winner == result::failure) { break; } } if (winner == result::success) { winner = <API key>.size() == footholds.size() ? result::success : result::failure; } return winner; } } }
#ifndef CHANNEL_H #define CHANNEL_H #include <eq/eq.h> #include "pipe.h" #include <OgreMatrix4.h> namespace vr{ /* * Channel */ class Channel : public eq::Channel { public: Channel(eq::Window *parent); protected: virtual bool configInit(const eq::uint128_t &init_id); virtual void frameDraw(const eq::uint128_t &frame_id); Ogre::Matrix4 calcViewMatrix( Ogre::Vector3 eye, Ogre::Vector3 target, Ogre::Vector3 up ) const; }; } #endif // CHANNEL_H
<?php defined('_AKEEBA') or die(); class AModel { /** * Input variables, passed on from the controller, in an associative array * @var array */ protected $input = array(); /** * Should I save the model's state in the session? * @var bool */ protected $_savestate = true; /** * The model (base) name * * @var string */ protected $name; /** * The URL option for the component. * * @var string */ protected $option = null; /** * A state object * * @var string */ protected $state; /** * Are the state variables already set? * * @var bool */ protected $_state_set = false; /** * Returns a new model object. Unless overriden by the $config array, it will * try to automatically populate its state from the request variables. * * @param string $type * @param string $prefix * @param array $config * @return AModel */ public static function &getAnInstance( $type, $prefix = '', $config = array() ) { $type = preg_replace('/[^A-Z0-9_\.-]/i', '', $type); $modelClass = $prefix.ucfirst($type); $result = false; // Guess the component name and include path if (!empty($prefix)) { preg_match('/(.*)Model$/', $prefix, $m); $component = strtolower($m[1]); } else { $component = ''; } if (array_key_exists('input', $config)) { if (!($config['input'] instanceof AInput)) { if (!is_array($config['input'])) { $config['input'] = (array)$config['input']; } $config['input'] = array_merge($_REQUEST, $config['input']); $config['input'] = new AInput($config['input']); } } else { $config['input'] = new AInput(); } if (empty($component)) { $defaultApp = AApplication::getInstance()->getName(); $component = $config['input']->get('option', $defaultApp); } $config['option'] = $component; $needsAView = true; if(array_key_exists('view', $config)) { if (!empty($config['view'])) { $needsAView = false; } } if ($needsAView) { $config['view'] = strtolower($type); } $config['input']->set('option', $config['option']); $config['input']->set('view', $config['view']); // Try to load the requested model class if (!class_exists( $modelClass )) { $include_paths = array( APATH_INSTALLATION . '/' . $component . '/models', ); // Try to load the model file $path = AUtilsPath::find( $include_paths, self::createFileName( 'model', array( 'name' => $type)) ); if ($path) { require_once $path; } } // Fallback to the generic AModel model class if (!class_exists( $modelClass )) { $modelClass = 'AModel'; } $result = new $modelClass($config); return $result; } /** * Returns a new instance of a model, with the state reset to defaults * * @param string $type * @param string $prefix * @param array $config * * @return AModel */ public static function &getTmpInstance($type, $prefix = '', $config = array()) { $ret = self::getAnInstance($type, $prefix, $config) ->getClone() ->clearState() ->clearInput() ->savestate(0); return $ret; } /** * Public class constructor * * @param type $config */ public function __construct($config = array()) { // Get the input if (array_key_exists('input', $config)) { if($config['input'] instanceof AInput) { $this->input = $config['input']; } else { $this->input = new AInput($config['input']); } } else { $this->input = new AInput(); } // Set the $name variable $component = $this->input->getCmd('option','com_foobar'); if (array_key_exists('option', $config)) { $component = $config['option']; } $name = strtolower($component); if(array_key_exists('name', $config)) { $name = $config['name']; } $this->input->set('option', $component); $this->name = $name; $this->option = $component; // Get the view name $className = get_class($this); if ($className == 'AModel') { if (array_key_exists('view', $config)) { $view = $config['view']; } if (empty($view)) { $view = $this->input->getCmd('view', 'cpanel'); } } else { $eliminatePart = ucfirst($name).'Model'; $view = strtolower(str_replace($eliminatePart, '', $className)); } // Set the model state if (array_key_exists('state', $config)) { $this->state = $config['state']; } else { $this->state = new AObject; } // Set the internal state marker - used to ignore setting state from the request if (!empty($config['ignore_request'])) { $this->_state_set = true; } } /** * Create the filename for a resource * * @param string $type The resource type to create the filename for. * @param array $parts An associative array of filename information. * * @return string The filename */ protected static function createFileName($type, $parts = array()) { $filename = ''; switch ($type) { case 'model': $filename = strtolower($parts['name']) . '.php'; break; } return $filename; } /** * Method to get the model name * * The model name. By default parsed using the classname or it can be set * by passing a $config['name'] in the class constructor * * @return string The name of the model */ public function getName() { if (empty($this->name)) { $r = null; if (!preg_match('/Model(.*)/i', get_class($this), $r)) { JError::raiseError(500, AText::_('<API key>')); } $this->name = strtolower($r[1]); } return $this->name; } /** * Get a filtered state variable * @param string $key * @param mixed $default * @param string $filter_type * @return mixed */ public function getState($key = null, $default = null, $filter_type = 'raw') { if(empty($key)) { return $this->internal_getState(); } // Get the savestate status $value = $this->internal_getState($key); if(is_null($value)) { $value = $this-><API key>($key, $key, $value, 'none', $this->_savestate); if(is_null($value)) { return $default; } } if( strtoupper($filter_type) == 'RAW' ) { return $value; } else { $filter = new AFilterInput(); return $filter->clean($value, $filter_type); } } public function getHash() { static $hash = null; if(is_null($hash)) { $defaultApp = AApplication::getInstance()->getName(); $option = $this->input->getCmd('option', $defaultApp); $view = $this->input->getCmd('view', 'cpanel'); $hash = "$option.$view."; } return $hash; } /** * Gets the value of a user state variable. * * @access public * @param string The key of the user state variable. * @param string The name of the variable passed in a request. * @param string The default value for the variable if not found. Optional. * @param string Filter for the variable, for valid values see {@link JFilterInput::clean()}. Optional. * @param bool Should I save the variable in the user state? Default: true. Optional. * @return The request user state. */ protected function <API key>( $key, $request, $default = null, $type = 'none', $setUserState = true ) { $session = ASession::getInstance(); $hash = $this->getHash(); $old_state = $session->get($hash.$key, null); $cur_state = (!is_null($old_state)) ? $old_state : $default; $new_state = $this->input->get($request, null, $type); // Save the new value only if it was set in this request if($setUserState) { if ($new_state !== null) { $session->set($hash.$key, $new_state); } else { $new_state = $cur_state; } } elseif (is_null($new_state)) { $new_state = $cur_state; } return $new_state; } /** * Method to get model state variables * * @param string $property Optional parameter name * @param mixed $default Optional default value * * @return object The property where specified, the state object where omitted */ private function internal_getState($property = null, $default = null) { if (!$this->_state_set) { // Protected method to auto-populate the model state. $this->populateState(); // Set the model state set flag to true. $this->_state_set = true; } return $property === null ? $this->state : $this->state->get($property, $default); } /** * Method to auto-populate the model state. * * This method should only be called once per instantiation and is designed * to be called on the first call to the getState() method unless the model * configuration flag to ignore the request is set. * * @return void * * @note Calling getState in this method will result in recursion. */ protected function populateState() { } /** * Method to set model state variables * * @param string $property The name of the property. * @param mixed $value The value of the property to set or null. * * @return mixed The previous value of the property or null if not set. */ public function setState($property, $value = null) { return $this->state->set($property, $value); } /** * Clears the model state, but doesn't touch the internal lists of records, * record tables or record id variables. To clear these values, please use * reset(). * * @return AModel */ public function clearState() { $this->state = new AObject(); return $this; } /** * Clears the input array. * * @return AModel */ public function clearInput() { $this->input = new AInput(array()); return $this; } /** * Clones the model object and returns the clone * @return AModel */ public function &getClone() { $clone = clone($this); return $clone; } /** * Magic getter; allows to use the name of model state keys as properties * @param string $name * @return mixed */ public function __get($name) { return $this->getState($name); } /** * Magic setter; allows to use the name of model state keys as properties * @param string $name * @return mixed */ public function __set($name, $value) { return $this->setState($name, $value); } /** * Magic caller; allows to use the name of model state keys as methods to * set their values. * * @param string $name * @param mixed $arguments * @return AModel */ public function __call($name, $arguments) { $arg1 = array_shift($arguments); $this->setState($name, $arg1); return $this; } /** * Sets the model state auto-save status. By default the model is set up to * save its state to the session. * * @param bool $newState True to save the state, false to not save it. */ public function &savestate($newState) { $this->_savestate = $newState ? true : false; return $this; } public function populateSavesate() { if(is_null($this->_savestate)) { $savestate = $this->input->getInt('savestate', -999); if($savestate == -999) { $savestate = true; } $this->savestate($savestate); } } }
// <API key>: GPL-2.0 #include "color.h" #include <QMap> #include <array> // Note that std::array<QColor, 2> is in every respect equivalent to QColor[2], // but allows assignment, comparison, can be returned from functions, etc. static QMap<color_index_t, std::array<QColor, 2>> profile_color = { { SAC_1, {{ FUNGREEN1, BLACK1_LOW_TRANS }} }, { SAC_2, {{ APPLE1, BLACK1_LOW_TRANS }} }, { SAC_3, {{ ATLANTIS1, BLACK1_LOW_TRANS }} }, { SAC_4, {{ ATLANTIS2, BLACK1_LOW_TRANS }} }, { SAC_5, {{ EARLSGREEN1, BLACK1_LOW_TRANS }} }, { SAC_6, {{ HOKEYPOKEY1, BLACK1_LOW_TRANS }} }, { SAC_7, {{ TUSCANY1, BLACK1_LOW_TRANS }} }, { SAC_8, {{ CINNABAR1, BLACK1_LOW_TRANS }} }, { SAC_9, {{ REDORANGE1, BLACK1_LOW_TRANS }} }, { VELO_STABLE, {{ CAMARONE1, BLACK1_LOW_TRANS }} }, { VELO_SLOW, {{ LIMENADE1, BLACK1_LOW_TRANS }} }, { VELO_MODERATE, {{ RIOGRANDE1, BLACK1_LOW_TRANS }} }, { VELO_FAST, {{ PIRATEGOLD1, BLACK1_LOW_TRANS }} }, { VELO_CRAZY, {{ RED1, BLACK1_LOW_TRANS }} }, { PO2, {{ APPLE1, BLACK1_LOW_TRANS }} }, { PO2_ALERT, {{ RED1, BLACK1_LOW_TRANS }} }, { PN2, {{ BLACK1_LOW_TRANS, BLACK1_LOW_TRANS }} }, { PN2_ALERT, {{ RED1, BLACK1_LOW_TRANS }} }, { PHE, {{ PEANUT, BLACK1_LOW_TRANS }} }, { PHE_ALERT, {{ RED1, BLACK1_LOW_TRANS }} }, { O2SETPOINT, {{ <API key>, BLACK1_LOW_TRANS }} }, { CCRSENSOR1, {{ TUNDORA1_MED_TRANS, BLACK1_LOW_TRANS }} }, { CCRSENSOR2, {{ <API key>, BLACK1_LOW_TRANS }} }, { CCRSENSOR3, {{ PEANUT, BLACK1_LOW_TRANS }} }, { SCR_OCPO2, {{ <API key>, BLACK1_LOW_TRANS }} }, { PP_LINES, {{ BLACK1_HIGH_TRANS, BLACK1_LOW_TRANS }} }, { TEXT_BACKGROUND, {{ <API key>, WHITE1 }} }, { ALERT_BG, {{ BROOM1_LOWER_TRANS, BLACK1_LOW_TRANS }} }, { ALERT_FG, {{ BLACK1_LOW_TRANS, WHITE1 }} }, { EVENTS, {{ REDORANGE1, BLACK1_LOW_TRANS }} }, { SAMPLE_DEEP, {{ QColor(Qt::red).darker(), BLACK1 }} }, { SAMPLE_SHALLOW, {{ QColor(Qt::red).lighter(), BLACK1_LOW_TRANS }} }, { SMOOTHED, {{ <API key>, BLACK1_LOW_TRANS }} }, { MINUTE, {{ <API key>, BLACK1_LOW_TRANS }} }, { TIME_GRID, {{ WHITE1, BLACK1_HIGH_TRANS }} }, { TIME_TEXT, {{ FORESTGREEN1, BLACK1 }} }, { DEPTH_GRID, {{ WHITE1, BLACK1_HIGH_TRANS }} }, { MEAN_DEPTH, {{ <API key>, BLACK1_LOW_TRANS }} }, { HR_PLOT, {{ <API key>, BLACK1_LOW_TRANS }} }, { HR_TEXT, {{ <API key>, BLACK1_LOW_TRANS }} }, { HR_AXIS, {{ MED_GRAY_HIGH_TRANS, MED_GRAY_HIGH_TRANS }} }, { DEPTH_BOTTOM, {{ <API key>, BLACK1_HIGH_TRANS }} }, { DEPTH_TOP, {{ MERCURY1_MED_TRANS, WHITE1_MED_TRANS }} }, { TEMP_TEXT, {{ GOVERNORBAY2, BLACK1_LOW_TRANS }} }, { TEMP_PLOT, {{ <API key>, BLACK1_LOW_TRANS }} }, { SAC_DEFAULT, {{ WHITE1, BLACK1_LOW_TRANS }} }, { BOUNDING_BOX, {{ WHITE1, BLACK1_LOW_TRANS }} }, { PRESSURE_TEXT, {{ KILLARNEY1, BLACK1_LOW_TRANS }} }, { BACKGROUND, {{ SPRINGWOOD1, WHITE1 }} }, { BACKGROUND_TRANS, {{ <API key>, WHITE1_MED_TRANS }} }, { CEILING_SHALLOW, {{ <API key>, BLACK1_HIGH_TRANS }} }, { CEILING_DEEP, {{ RED1_MED_TRANS, BLACK1_HIGH_TRANS }} }, { <API key>, {{ <API key>, BLACK1_HIGH_TRANS }} }, { CALC_CEILING_DEEP, {{ APPLE1_HIGH_TRANS, BLACK1_HIGH_TRANS }} }, { TISSUE_PERCENTAGE, {{ GOVERNORBAY2, BLACK1_LOW_TRANS }} }, { DURATION_LINE, {{ BLACK1, BLACK1_LOW_TRANS }} } }; QColor getColor(const color_index_t i, bool isGrayscale) { if (profile_color.count() > i && i >= 0) return profile_color[i][isGrayscale ? 1 : 0]; return QColor(Qt::black); } QColor getSacColor(int sac, int avg_sac) { int sac_index = 0; int delta = sac - avg_sac + 7000; sac_index = delta / 2000; if (sac_index < 0) sac_index = 0; if (sac_index > SAC_COLORS - 1) sac_index = SAC_COLORS - 1; return getColor((color_index_t)(<API key> + sac_index), false); } QColor getPressureColor(double density) { QColor color; int h = ((int) (180.0 - 180.0 * density / 8.0)); while (h < 0) h += 360; color.setHsv(h , 255, 255); return color; }
/* In the static library, this is all handled by dl-support.c or by the vanilla definitions in the rest of the C library. */ #ifdef SHARED #include <hurd.h> #include <link.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <sys/mman.h> #include <ldsodefs.h> #include <sys/wait.h> #include <assert.h> #include <sysdep.h> #include <mach/mig_support.h> #include "hurdstartup.h" #include <hurd/lookup.h> #include <hurd/auth.h> #include <hurd/term.h> #include <stdarg.h> #include <ctype.h> #include <sys/stat.h> #include <sys/uio.h> #include <entry.h> #include <dl-machine.h> #include <dl-procinfo.h> extern void __mach_init (void); extern int _dl_argc; extern char **_dl_argv; extern char **_environ; int <API key> = 0; INTVARDEF(<API key>) int <API key> = 0; /* Defining this here avoids the inclusion of init-first. */ /* This variable contains the lowest stack address ever used. */ void *__libc_stack_end; #if HP_TIMING_AVAIL hp_timing_t _dl_cpuclock_offset; #endif /* TODO: this is never properly initialized in here. */ void *_dl_random attribute_relro = NULL; struct hurd_startup_data *_dl_hurd_data; #define FMH defined(__i386__) #if ! FMH # define fmh() ((void)0) # define unfmh() ((void)0) #else /* XXX loser kludge for vm_map kernel bug */ #undef <API key> #define <API key> 0 static vm_address_t fmha; static vm_size_t fmhs; static void unfmh(void){ __vm_deallocate(__mach_task_self(),fmha,fmhs);} static void fmh(void) { error_t err;int x;mach_port_t p; vm_address_t a=0x08000000U,max=VM_MAX_ADDRESS; while (!(err=__vm_region(__mach_task_self(),&a,&fmhs,&x,&x,&x,&x,&p,&x))){ <API key>(__mach_task_self(),p); if (a+fmhs>=0x80000000U){ max=a; break;} fmha=a+=fmhs;} if (err) assert(err==KERN_NO_SPACE); if (!fmha) fmhs=0; else while (1) { fmhs=max-fmha; if (fmhs == 0) break; err = __vm_map (__mach_task_self (), &fmha, fmhs, 0, 0, MACH_PORT_NULL, 0, 1, VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_COPY); if (!err) break; if (err != <API key> && err != KERN_NO_SPACE) assert_perror(err); vm_address_t new_max = (max - 1) & 0xf0000000U; if (new_max >= max) { fmhs = 0; fmha = 0; break; } max = new_max; } } /* XXX loser kludge for vm_map kernel bug */ #endif ElfW(Addr) _dl_sysdep_start (void **start_argptr, void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phent, ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv)) { void go (intptr_t *argdata) { char **p; /* Cache the information in various global variables. */ _dl_argc = *argdata; _dl_argv = 1 + (char **) argdata; _environ = &_dl_argv[_dl_argc + 1]; for (p = _environ; *p++;); /* Skip environ pointers and terminator. */ if ((void *) p == _dl_argv[0]) { static struct hurd_startup_data nodata; _dl_hurd_data = &nodata; nodata.user_entry = (vm_address_t) ENTRY_POINT; } else _dl_hurd_data = (void *) p; INTUSE(<API key>) = _dl_hurd_data->flags & EXEC_SECURE; if (_dl_hurd_data->flags & EXEC_STACK_ARGS && _dl_hurd_data->user_entry == 0) _dl_hurd_data->user_entry = (vm_address_t) ENTRY_POINT; unfmh(); /* XXX */ #if 0 /* XXX make this work for real someday... */ if (_dl_hurd_data->user_entry == (vm_address_t) ENTRY_POINT) /* We were invoked as a command, not as the program interpreter. The generic ld.so code supports this: it will parse the args as "ld.so PROGRAM [ARGS...]". For booting the Hurd, we support an additional special syntax: ld.so [-LIBS...] PROGRAM [ARGS...] Each LIBS word consists of "FILENAME=MEMOBJ"; for example "-/lib/libc.so=123" says that the contents of /lib/libc.so are found in a memory object whose port name in our task is 123. */ while (_dl_argc > 2 && _dl_argv[1][0] == '-' && _dl_argv[1][1] != '-') { char *lastslash, *memobjname, *p; struct link_map *l; mach_port_t memobj; error_t err; ++_dl_skip_args; --_dl_argc; p = _dl_argv++[1] + 1; memobjname = strchr (p, '='); if (! memobjname) _dl_sysdep_fatal ("Bogus library spec: ", p, "\n", NULL); *memobjname++ = '\0'; memobj = 0; while (*memobjname != '\0') memobj = (memobj * 10) + (*memobjname++ - '0'); /* Add a user reference on the memory object port, so we will still have one after <API key> calls our `close'. */ err = <API key> (__mach_task_self (), memobj, <API key>, +1); assert_perror (err); lastslash = strrchr (p, '/'); l = <API key> (lastslash ? lastslash + 1 : p, memobj, strdup (p), 0); /* Squirrel away the memory object port where it can be retrieved by the program later. */ l->l_info[DT_NULL] = (void *) memobj; } #endif /* Call elf/rtld.c's main program. It will set everything up and leave us to transfer control to USER_ENTRY. */ (*dl_main) ((const ElfW(Phdr) *) _dl_hurd_data->phdr, _dl_hurd_data->phdrsz / sizeof (ElfW(Phdr)), &_dl_hurd_data->user_entry, NULL); /* The call above might screw a few things up. First of all, if _dl_skip_args is nonzero, we are ignoring the first few arguments. However, if we have no Hurd startup data, it is the magical convention that ARGV[0] == P. The startup code in init-first.c will get confused if this is not the case, so we must rearrange things to make it so. We'll overwrite the origional ARGV[0] at P with ARGV[_dl_skip_args]. Secondly, if we need to be secure, it removes some dangerous environment variables. If we have no Hurd startup date this changes P (since that's the location after the terminating NULL in the list of environment variables). We do the same thing as in the first case but make sure we recalculate P. If we do have Hurd startup data, we have to move the data such that it starts just after the terminating NULL in the environment list. We use memmove, since the locations might overlap. */ if (INTUSE(<API key>) || _dl_skip_args) { char **newp; for (newp = _environ; *newp++;); if (_dl_argv[-_dl_skip_args] == (char *) p) { if ((char *) newp != _dl_argv[0]) { assert ((char *) newp < _dl_argv[0]); _dl_argv[0] = memmove ((char *) newp, _dl_argv[0], strlen (_dl_argv[0]) + 1); } } else { if ((void *) newp != _dl_hurd_data) memmove (newp, _dl_hurd_data, sizeof (*_dl_hurd_data)); } } { extern void _dl_start_user (void); /* Unwind the stack to ARGDATA and simulate a return from _dl_start to the RTLD_START code which will run the user's entry point. */ RETURN_TO (argdata, &_dl_start_user, _dl_hurd_data->user_entry); } } /* Set up so we can do RPCs. */ __mach_init (); /* Initialize frequently used global variable. */ GLRO(dl_pagesize) = __getpagesize (); #if HP_TIMING_AVAIL HP_TIMING_NOW (_dl_cpuclock_offset); #endif fmh(); /* XXX */ /* See hurd/hurdstartup.c; this deals with getting information from the exec server and slicing up the arguments. Then it will call `go', above. */ _hurd_startup (start_argptr, &go); LOSE; abort (); } void internal_function <API key> (void) { /* Deallocate the reply port and task port rights acquired by __mach_init. We are done with them now, and the user will reacquire them for himself when he wants them. */ <API key> (MACH_PORT_NULL); <API key> (__mach_task_self (), __mach_task_self_); } /* Minimal open/close/mmap implementation sufficient for initial loading of shared libraries. These are weak definitions so that when the dynamic linker re-relocates itself to be user-visible (for -ldl), it will get the user's definition (i.e. usually libc's). */ /* Open FILE_NAME and return a Hurd I/O for it in *PORT, or return an error. If STAT is non-zero, stat the file into that stat buffer. */ static error_t open_file (const char *file_name, int flags, mach_port_t *port, struct stat64 *stat) { enum retry_type doretry; char retryname[1024]; /* XXX string_t LOSES! */ file_t startdir; error_t err; error_t use_init_port (int which, error_t (*operate) (file_t)) { return (which < _dl_hurd_data->portarraysize ? ((*operate) (_dl_hurd_data->portarray[which])) : EGRATUITOUS); } file_t get_dtable_port (int fd) { if ((unsigned int) fd < _dl_hurd_data->dtablesize && _dl_hurd_data->dtable[fd] != MACH_PORT_NULL) { <API key> (__mach_task_self (), _dl_hurd_data->dtable[fd], <API key>, +1); return _dl_hurd_data->dtable[fd]; } errno = EBADF; return MACH_PORT_NULL; } assert (!(flags & ~(O_READ | O_CLOEXEC))); startdir = _dl_hurd_data->portarray[file_name[0] == '/' ? INIT_PORT_CRDIR : INIT_PORT_CWDIR]; while (file_name[0] == '/') file_name++; err = __dir_lookup (startdir, (char *)file_name, O_RDONLY, 0, &doretry, retryname, port); if (!err) err = <API key> (use_init_port, get_dtable_port, __dir_lookup, doretry, retryname, O_RDONLY, 0, port); if (!err && stat) { err = __io_stat (*port, stat); if (err) <API key> (__mach_task_self (), *port); } return err; } int weak_function __open (const char *file_name, int mode, ...) { mach_port_t port; error_t err = open_file (file_name, mode, &port, 0); if (err) return __hurd_fail (err); else return (int)port; } int weak_function __close (int fd) { if (fd != (int) MACH_PORT_NULL) <API key> (__mach_task_self (), (mach_port_t) fd); return 0; } __ssize_t weak_function __libc_read (int fd, void *buf, size_t nbytes) { error_t err; char *data; <API key> nread; data = buf; nread = nbytes; err = __io_read ((mach_port_t) fd, &data, &nread, -1, nbytes); if (err) return __hurd_fail (err); if (data != buf) { memcpy (buf, data, nread); __vm_deallocate (__mach_task_self (), (vm_address_t) data, nread); } return nread; } libc_hidden_weak (__libc_read) __ssize_t weak_function __libc_write (int fd, const void *buf, size_t nbytes) { error_t err; <API key> nwrote; assert (fd < <API key>); err = __io_write (_hurd_init_dtable[fd], buf, nbytes, -1, &nwrote); if (err) return __hurd_fail (err); return nwrote; } libc_hidden_weak (__libc_write) /* This is only used for printing messages (see dl-misc.c). */ __ssize_t weak_function __writev (int fd, const struct iovec *iov, int niov) { if (fd >= <API key>) { errno = EBADF; return -1; } int i; size_t total = 0; for (i = 0; i < niov; ++i) total += iov[i].iov_len; if (total != 0) { char buf[total], *bufp = buf; error_t err; <API key> nwrote; for (i = 0; i < niov; ++i) bufp = (memcpy (bufp, iov[i].iov_base, iov[i].iov_len) + iov[i].iov_len); err = __io_write (_hurd_init_dtable[fd], buf, total, -1, &nwrote); if (err) return __hurd_fail (err); return nwrote; } return 0; } off64_t weak_function __libc_lseek64 (int fd, off64_t offset, int whence) { error_t err; err = __io_seek ((mach_port_t) fd, offset, whence, &offset); if (err) return __hurd_fail (err); return offset; } __ptr_t weak_function __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) { error_t err; vm_prot_t vmprot; vm_address_t mapaddr; mach_port_t memobj_rd, memobj_wr; vmprot = VM_PROT_NONE; if (prot & PROT_READ) vmprot |= VM_PROT_READ; if (prot & PROT_WRITE) vmprot |= VM_PROT_WRITE; if (prot & PROT_EXEC) vmprot |= VM_PROT_EXECUTE; if (flags & MAP_ANON) memobj_rd = MACH_PORT_NULL; else { assert (!(flags & MAP_SHARED)); err = __io_map ((mach_port_t) fd, &memobj_rd, &memobj_wr); if (err) return __hurd_fail (err), MAP_FAILED; <API key> (__mach_task_self (), memobj_wr); } mapaddr = (vm_address_t) addr; err = __vm_map (__mach_task_self (), &mapaddr, (vm_size_t) len, <API key>, !(flags & MAP_FIXED), memobj_rd, (vm_offset_t) offset, flags & (MAP_COPY|MAP_PRIVATE), vmprot, VM_PROT_ALL, (flags & MAP_SHARED) ? VM_INHERIT_SHARE : VM_INHERIT_COPY); if (err == KERN_NO_SPACE && (flags & MAP_FIXED)) { /* XXX this is not atomic as it is in unix! */ /* The region is already allocated; deallocate it first. */ err = __vm_deallocate (__mach_task_self (), mapaddr, len); if (! err) err = __vm_map (__mach_task_self (), &mapaddr, (vm_size_t) len, <API key>, !(flags & MAP_FIXED), memobj_rd, (vm_offset_t) offset, flags & (MAP_COPY|MAP_PRIVATE), vmprot, VM_PROT_ALL, (flags & MAP_SHARED) ? VM_INHERIT_SHARE : VM_INHERIT_COPY); } if ((flags & MAP_ANON) == 0) <API key> (__mach_task_self (), memobj_rd); if (err) return __hurd_fail (err), MAP_FAILED; return (__ptr_t) mapaddr; } int weak_function __fxstat64 (int vers, int fd, struct stat64 *buf) { error_t err; assert (vers == _STAT_VER); err = __io_stat ((mach_port_t) fd, buf); if (err) return __hurd_fail (err); return 0; } libc_hidden_def (__fxstat64) int weak_function __xstat64 (int vers, const char *file, struct stat64 *buf) { error_t err; mach_port_t port; assert (vers == _STAT_VER); err = open_file (file, 0, &port, buf); if (err) return __hurd_fail (err); <API key> (__mach_task_self (), port); return 0; } libc_hidden_def (__xstat64) /* This function is called by the dynamic linker (rtld.c) to check whether debugging malloc is allowed even for SUID binaries. This stub will always fail, which means that malloc-debugging is always disabled for SUID binaries. */ int weak_function __access (const char *file, int type) { errno = ENOSYS; return -1; } pid_t weak_function __getpid (void) { pid_t pid, ppid; int orphaned; if (__proc_getpids (_dl_hurd_data->portarray[INIT_PORT_PROC], &pid, &ppid, &orphaned)) return -1; return pid; } /* This is called only in some strange cases trying to guess a value for $ORIGIN for the executable. The dynamic linker copes with getcwd failing (dl-object.c), and it's too much hassle to include the functionality here. (We could, it just requires duplicating or reusing getcwd.c's code but using our special lookup function as in `open', above.) */ char * weak_function __getcwd (char *buf, size_t size) { errno = ENOSYS; return NULL; } void weak_function attribute_hidden _exit (int status) { __proc_mark_exit (_dl_hurd_data->portarray[INIT_PORT_PROC], W_EXITCODE (status, 0), 0); while (__task_terminate (__mach_task_self ())) __mach_task_self_ = (__mach_task_self) (); } /* We need this alias to satisfy references from libc_pic.a objects that were affected by the libc_hidden_proto declaration for _exit. */ strong_alias (_exit, __GI__exit) /* Try to get a machine dependent instruction which will make the program crash. This is used in case everything else fails. */ #include <abort-instr.h> #ifndef ABORT_INSTRUCTION /* No such instruction is available. */ # define ABORT_INSTRUCTION #endif void weak_function abort (void) { /* Try to abort using the system specific command. */ ABORT_INSTRUCTION; /* If the abort instruction failed, exit. */ _exit (127); /* If even this fails, make sure we never return. */ while (1) /* Try for ever and ever. */ ABORT_INSTRUCTION; } /* We need this alias to satisfy references from libc_pic.a objects that were affected by the libc_hidden_proto declaration for abort. */ strong_alias (abort, __GI_abort) /* This function is called by interruptible RPC stubs. For initial dynamic linking, just use the normal mach_msg. Since this defn is weak, the real defn in libc.so will override it if we are linked into the user program (-ldl). */ error_t weak_function <API key> (mach_msg_header_t *msg, mach_msg_option_t option, mach_msg_size_t send_size, mach_msg_size_t rcv_size, mach_port_t rcv_name, mach_msg_timeout_t timeout, mach_port_t notify) { return __mach_msg (msg, option, send_size, rcv_size, rcv_name, timeout, notify); } void internal_function _dl_show_auxv (void) { /* There is nothing to print. Hurd has no auxiliary vector. */ } void weak_function _dl_init_first (int argc, ...) { /* This no-op definition only gets used if libc is not linked in. */ } #endif /* SHARED */
# Mustang Lite * **Theme URI:** http: * **Author:** WebMan * **Author URI:** http: * **License:** GNU General Public License v3 * **License URI:** http: ## Description Mustang Lite WordPress Theme lets you create beautiful, professional responsive and HiDPI (Retina) ready websites. With this theme you can create also a single one-page websites with ease! Mustang Lite is suitable for creative portfolio, business and corporate website projects, personal presentations and much more. You can set a custom design with background images and colors for every section of the theme. As the theme is translation ready and supports right-to-left languages as well, you can localize it for your multilingual website. By default you get the basic blog design which can be extended to full power of the theme with WebMan Amplifier plugin activation. This theme is a free, lite version of premium Mustang Multipurpose WordPress Theme by WebMan. The differences from paid version can be found at http: Follow WebMan on Twitter [https: Full theme demo website at [http://themedemos.webmandesign.eu/mustang/]. Theme user manual with demo data at [http: ## Demo http://themedemos.webmandesign.eu/mustang/ ## Changelog *See the `changelog.md` file.* ## Documentation User manual available at http: **Mustang Lite WordPress Theme** Copyright 2014 WebMan [http: Distributed under the terms of the GNU GPL **Animate.css** Copyright (c) 2014 Daniel Eden Licensed under the MIT license - http: http://daneden.me/animate **Normalize.css** Copyright (c) Nicolas Gallagher and Jonathan Neal Licensed under the MIT license - http: git.io/normalize **imagesLoaded** Copyright (c) 2014 Tomas Sardyha (@Darsain) and David DeSandro (@desandro) Licensed under the MIT license - http: https://github.com/desandro/imagesloaded **jquery.appear.js** Copyright (c) 2012 Andrey Sidorov Licensed under MIT https://github.com/morr/jquery.appear/ **jquery.prettyPhoto.js** Copyright, Stephane Caron Licensed under Creative Commons 2.5 [http: Please see assets/js/prettyphoto/README file for more info. http: **jquery.viewport.js** Copyright (c) 2008-2009 Mika Tuupola Licensed under the MIT license http: **Fontello font icons** Please see assets/font/basic-icons/LICENCE.txt file for more info.
/* <API key>: GPL-2.0+ */ #ifndef __SH7785LCR_H #define __SH7785LCR_H #define CONFIG_CPU_SH7785 1 #define <API key> \ "bootdevice=0:1\0" \ "usbload=usb reset;usbboot;usb stop;bootm\0" #define <API key> #undef <API key> /* MEMORY */ #if defined(CONFIG_SH_32BIT) /* 0x40000000 - 0x47FFFFFF does not use */ #define <API key> (0x8000000) #define <API key> (0x40000000 + <API key>) #define <API key> (0x80000000 + <API key>) #define <API key> (384 * 1024 * 1024) #define <API key> (0xa0000000) #define <API key> (64 * 1024 * 1024) #define SH7785LCR_USB_BASE (0xa6000000) #else #define <API key> (0x08000000) #define <API key> (128 * 1024 * 1024) #define <API key> (0xa0000000) #define <API key> (64 * 1024 * 1024) #define SH7785LCR_USB_BASE (0xb4000000) #endif #define CONFIG_SYS_PBSIZE 256 #define <API key> { 115200 } /* SCIF */ #define CONFIG_CONS_SCIF1 1 #define <API key> 1 #define <API key> (<API key>) #define <API key> (<API key> + \ (<API key>) - \ 4 * 1024 * 1024) #undef <API key> #undef <API key> #define <API key> (<API key>) #define <API key> (<API key>) #define <API key> (<API key> + 16 * 1024 * 1024) #define <API key> (<API key>) #define <API key> (512 * 1024) #define <API key> (512 * 1024) #define <API key> (8 * 1024 * 1024) /* FLASH */ #define <API key> #define <API key> #undef <API key> #define <API key> #define <API key> (<API key>) #define <API key> 512 #define <API key> 1 #define <API key> { <API key> + \ (0 * <API key>) } #define <API key> (3 * 1000) #define <API key> (3 * 1000) #define <API key> (3 * 1000) #define <API key> (3 * 1000) #undef <API key> #undef <API key> /* R8A66597 */ #define <API key> #define <API key> SH7785LCR_USB_BASE #define <API key> 0x0000 /* 12MHz */ #define <API key> 0x8000 /* 3.3V */ #define <API key> 0x0000 /* little */ /* PCI Controller */ #define CONFIG_SH4_PCI #define CONFIG_SH7780_PCI #if defined(CONFIG_SH_32BIT) #define <API key> 0x1ff00001 #define <API key> 0x5f000000 #define <API key> 0x5f000000 #else #define <API key> 0x07f00001 #define <API key> <API key> #define <API key> <API key> #endif #define <API key> 1 #define CONFIG_PCI_MEM_BUS 0xFD000000 /* Memory space base addr */ #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x01000000 /* Size of Memory window */ #define CONFIG_PCI_IO_BUS 0xFE200000 /* IO space base address */ #define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS #define CONFIG_PCI_IO_SIZE 0x00200000 /* Size of IO window */ #if defined(CONFIG_SH_32BIT) #define CONFIG_PCI_SYS_PHYS <API key> #else #define CONFIG_PCI_SYS_PHYS <API key> #endif #define CONFIG_PCI_SYS_BUS <API key> #define CONFIG_PCI_SYS_SIZE <API key> /* ENV setting */ #define <API key> 1 #define <API key> (256 * 1024) #define CONFIG_ENV_SIZE (<API key>) #define CONFIG_ENV_ADDR (<API key> + <API key>) #define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR - <API key>) #define <API key> (<API key>) /* Board Clock */ /* The SCIF used external clock. system clock only used timer. */ #define CONFIG_SYS_CLK_FREQ 50000000 #define <API key> CONFIG_SYS_CLK_FREQ #define <API key> CONFIG_SYS_CLK_FREQ #define <API key> 4 #endif /* __SH7785LCR_H */
// MuseScore // Music Composition & Notation // $Id: keyfinder.h 4515 2011-07-13 09:56:53Z wschweer $ // This program is free software; you can redistribute it and/or modify // as published by the Free Software Foundation and appearing in // the file LICENCE.GPL #ifndef __KEYFINDER_H__ #define __KEYFINDER_H__ class MidiTrack; namespace AL { class TimeSigMap; }; // extern int findKey(MidiTrack*, AL::TimeSigMap*); #endif
select#<API key>, label[for='parent'], select#parent.postform { display: none; } body table.wp-list-table.tags { table-layout: auto; } .<API key> .<API key> { margin: 0; } .<API key>#message { margin-left:0; } .<API key> .<API key> { width: 100%; } .<API key> tr.<API key> td, .<API key> tr.<API key> th { border-top: 1px solid #eee; } .<API key> .<API key> td, .<API key> .<API key> th { padding: 5px; padding-bottom: 20px; padding-top: 20px; line-height: 20px; vertical-align: top; text-align: left; font-size: 15px; } .<API key> .<API key> { cursor: help; vertical-align: middle; } .<API key> .<API key> th { width: 280px; } .<API key> .<API key> { } input[type="text"], .<API key> input[type="number"], .<API key> select { height: 30px; } .<API key> input[type="text"], .<API key> input[type="number"], .<API key> input[type="checkbox"], .<API key> select { background-color: #ffffff; border: 1px solid #cccccc; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; -moz-transition: border linear 0.2s, box-shadow linear 0.2s; -o-transition: border linear 0.2s, box-shadow linear 0.2s; transition: border linear 0.2s, box-shadow linear 0.2s; } input[type="text"]:focus, .<API key> input[type="number"]:focus, .<API key> input[type="checkbox"]:focus, .<API key> select:focus { border-color: rgba(82, 168, 236, 0.8); outline: 0; outline: thin dotted \9; /* IE6-9 */ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); } .<API key> .<API key> { display: inline-block; width: 26px; height: 24px !important; min-width: 16px; font-size: 14px; font-weight: normal; line-height: 22px; position:relative; right: 8px; padding:2px; top: 1px; text-align: center; text-shadow: 0 1px 0 #ffffff; background-color: #eeeeee; border: 1px solid #ccc; -<API key>: 5px; -<API key>: 5px; <API key>: 5px; -<API key>: 5px; -<API key>: 5px; <API key>: 5px; vertical-align: top; } .<API key> tr.<API key> th { text-align:left; background-color: #789bb3; padding: 10px; text-transform: uppercase; color: #ffffff; } a.<API key> { text-decoration: none; font-size: 26px; font-weight: bold; margin-left: 5px; vertical-align: middle; color: #ff5c5c; } a.<API key>:hover { color: #ff0000; } .<API key> .<API key> { display:none; } fieldset.<API key> table th { font-weight: normal; } .<API key> { } .<API key> .<API key> { float: right; } fieldset.<API key> { display: inline-block; border: 1px solid #eeeeee; padding: 20px; margin-bottom: 30px; margin-top:20px; min-width: 820px; padding-top: 25px; padding-bottom: 10px; background-color: #ffffff; } .<API key> h2 { font-size: 22px; font-weight: 400; padding: 9px 15px 4px 0; } fieldset.<API key> #<API key> tr, fieldset.<API key> #<API key> th, fieldset.<API key> #<API key> td { border: 0; padding: 5px; margin: 0; vertical-align: middle; } fieldset.<API key> #<API key> th { width:40%; } fieldset.<API key> #<API key> td label { margin-left: 20px; margin-right: 5px; } fieldset.<API key> #<API key> span { font-size: 15px; font-weight: normal; } fieldset.<API key> #<API key> td input { width: 75px; text-align: left; vertical-align: middle; } .<API key> { } .festi-content { display: inline-block; } fieldset.<API key> #<API key> td input, fieldset.<API key> #<API key> td select { height: 28px; } div#festi-import-report .<API key> { text-transform: uppercase; } .<API key> { } div#festi-import-report p.<API key> { font-weight: normal; } div#festi-import-report p.<API key> { margin-left: 20px; } .<API key> { position: relative; top: 0; left: -3px; width: 36px; height: 36px; } .<API key> div { position: relative; top: 4px; left: 4px; width: 28px; height: 28px; background: url(../../images/color_picker/select2.png) center; } div.colorpicker input { height: 15px !important; border: 0 !important; } body div.colorpicker { z-index: 10; } /*Import Page*/ .<API key> { width: 400px; }
#ifndef RBKIT_APPSTATE_H #define RBKIT_APPSTATE_H #include <QObject> #include <QMutex> #include <QHash> #include <QVariant> namespace RBKit { class AppState { QMutex mutex; QHash<QString, QVariant> appState; QHash<int, QString> snapshotNames; AppState(); static AppState *singleton; QString protocolVersion; public: const QVariant getState(const QString& ket); void setAppState(const QString key, const QVariant value); void setSnapshotName(int key, QString snapShotName); QString getSnapshotName(int key) const; void removeSnapshotName(int key); static AppState* getInstance(); QString getProtocolVersion() const; void setProtocolVersion(const QString &value); }; } // namespace RBKit #endif // RBKIT_APPSTATE_H
#include <sstream> #include <unordered_map> #include "Common/GL/GLInterfaceBase.h" #include "Common/GL/GLExtensions/GLExtensions.h" #include "Common/Logging/Log.h" #if defined(__linux__) || defined(__APPLE__) #include <dlfcn.h> #endif // gl_1_1 <API key> dolClearIndex; <API key> dolClearColor; PFNDOLCLEARPROC dolClear; PFNDOLINDEXMASKPROC dolIndexMask; PFNDOLCOLORMASKPROC dolColorMask; PFNDOLALPHAFUNCPROC dolAlphaFunc; PFNDOLBLENDFUNCPROC dolBlendFunc; PFNDOLLOGICOPPROC dolLogicOp; PFNDOLCULLFACEPROC dolCullFace; PFNDOLFRONTFACEPROC dolFrontFace; PFNDOLPOINTSIZEPROC dolPointSize; PFNDOLLINEWIDTHPROC dolLineWidth; <API key> dolLineStipple; <API key> dolPolygonMode; <API key> dolPolygonOffset; <API key> dolPolygonStipple; <API key> <API key>; PFNDOLEDGEFLAGPROC dolEdgeFlag; PFNDOLEDGEFLAGVPROC dolEdgeFlagv; PFNDOLSCISSORPROC dolScissor; PFNDOLCLIPPLANEPROC dolClipPlane; <API key> dolGetClipPlane; <API key> dolDrawBuffer; <API key> dolReadBuffer; PFNDOLENABLEPROC dolEnable; PFNDOLDISABLEPROC dolDisable; PFNDOLISENABLEDPROC dolIsEnabled; <API key> <API key>; <API key> <API key>; <API key> dolGetBooleanv; <API key> dolGetDoublev; PFNDOLGETFLOATVPROC dolGetFloatv; <API key> dolGetIntegerv; <API key> dolPushAttrib; PFNDOLPOPATTRIBPROC dolPopAttrib; <API key> dolPushClientAttrib; <API key> dolPopClientAttrib; <API key> dolRenderMode; PFNDOLGETERRORPROC dolGetError; PFNDOLGETSTRINGPROC dolGetString; PFNDOLFINISHPROC dolFinish; PFNDOLFLUSHPROC dolFlush; PFNDOLHINTPROC dolHint; <API key> dolClearDepth; PFNDOLDEPTHFUNCPROC dolDepthFunc; PFNDOLDEPTHMASKPROC dolDepthMask; <API key> dolDepthRange; <API key> dolClearAccum; PFNDOLACCUMPROC dolAccum; <API key> dolMatrixMode; PFNDOLORTHOPROC dolOrtho; PFNDOLFRUSTUMPROC dolFrustum; PFNDOLVIEWPORTPROC dolViewport; <API key> dolPushMatrix; PFNDOLPOPMATRIXPROC dolPopMatrix; <API key> dolLoadIdentity; <API key> dolLoadMatrixd; <API key> dolLoadMatrixf; <API key> dolMultMatrixd; <API key> dolMultMatrixf; PFNDOLROTATEDPROC dolRotated; PFNDOLROTATEFPROC dolRotatef; PFNDOLSCALEDPROC dolScaled; PFNDOLSCALEFPROC dolScalef; <API key> dolTranslated; <API key> dolTranslatef; PFNDOLISLISTPROC dolIsList; <API key> dolDeleteLists; PFNDOLGENLISTSPROC dolGenLists; PFNDOLNEWLISTPROC dolNewList; PFNDOLENDLISTPROC dolEndList; PFNDOLCALLLISTPROC dolCallList; PFNDOLCALLLISTSPROC dolCallLists; PFNDOLLISTBASEPROC dolListBase; PFNDOLBEGINPROC dolBegin; PFNDOLENDPROC dolEnd; PFNDOLVERTEX2DPROC dolVertex2d; PFNDOLVERTEX2FPROC dolVertex2f; PFNDOLVERTEX2IPROC dolVertex2i; PFNDOLVERTEX2SPROC dolVertex2s; PFNDOLVERTEX3DPROC dolVertex3d; PFNDOLVERTEX3FPROC dolVertex3f; PFNDOLVERTEX3IPROC dolVertex3i; PFNDOLVERTEX3SPROC dolVertex3s; PFNDOLVERTEX4DPROC dolVertex4d; PFNDOLVERTEX4FPROC dolVertex4f; PFNDOLVERTEX4IPROC dolVertex4i; PFNDOLVERTEX4SPROC dolVertex4s; PFNDOLVERTEX2DVPROC dolVertex2dv; PFNDOLVERTEX2FVPROC dolVertex2fv; PFNDOLVERTEX2IVPROC dolVertex2iv; PFNDOLVERTEX2SVPROC dolVertex2sv; PFNDOLVERTEX3DVPROC dolVertex3dv; PFNDOLVERTEX3FVPROC dolVertex3fv; PFNDOLVERTEX3IVPROC dolVertex3iv; PFNDOLVERTEX3SVPROC dolVertex3sv; PFNDOLVERTEX4DVPROC dolVertex4dv; PFNDOLVERTEX4FVPROC dolVertex4fv; PFNDOLVERTEX4IVPROC dolVertex4iv; PFNDOLVERTEX4SVPROC dolVertex4sv; PFNDOLNORMAL3BPROC dolNormal3b; PFNDOLNORMAL3DPROC dolNormal3d; PFNDOLNORMAL3FPROC dolNormal3f; PFNDOLNORMAL3IPROC dolNormal3i; PFNDOLNORMAL3SPROC dolNormal3s; PFNDOLNORMAL3BVPROC dolNormal3bv; PFNDOLNORMAL3DVPROC dolNormal3dv; PFNDOLNORMAL3FVPROC dolNormal3fv; PFNDOLNORMAL3IVPROC dolNormal3iv; PFNDOLNORMAL3SVPROC dolNormal3sv; PFNDOLINDEXDPROC dolIndexd; PFNDOLINDEXFPROC dolIndexf; PFNDOLINDEXIPROC dolIndexi; PFNDOLINDEXSPROC dolIndexs; PFNDOLINDEXUBPROC dolIndexub; PFNDOLINDEXDVPROC dolIndexdv; PFNDOLINDEXFVPROC dolIndexfv; PFNDOLINDEXIVPROC dolIndexiv; PFNDOLINDEXSVPROC dolIndexsv; PFNDOLINDEXUBVPROC dolIndexubv; PFNDOLCOLOR3BPROC dolColor3b; PFNDOLCOLOR3DPROC dolColor3d; PFNDOLCOLOR3FPROC dolColor3f; PFNDOLCOLOR3IPROC dolColor3i; PFNDOLCOLOR3SPROC dolColor3s; PFNDOLCOLOR3UBPROC dolColor3ub; PFNDOLCOLOR3UIPROC dolColor3ui; PFNDOLCOLOR3USPROC dolColor3us; PFNDOLCOLOR4BPROC dolColor4b; PFNDOLCOLOR4DPROC dolColor4d; PFNDOLCOLOR4FPROC dolColor4f; PFNDOLCOLOR4IPROC dolColor4i; PFNDOLCOLOR4SPROC dolColor4s; PFNDOLCOLOR4UBPROC dolColor4ub; PFNDOLCOLOR4UIPROC dolColor4ui; PFNDOLCOLOR4USPROC dolColor4us; PFNDOLCOLOR3BVPROC dolColor3bv; PFNDOLCOLOR3DVPROC dolColor3dv; PFNDOLCOLOR3FVPROC dolColor3fv; PFNDOLCOLOR3IVPROC dolColor3iv; PFNDOLCOLOR3SVPROC dolColor3sv; PFNDOLCOLOR3UBVPROC dolColor3ubv; PFNDOLCOLOR3UIVPROC dolColor3uiv; PFNDOLCOLOR3USVPROC dolColor3usv; PFNDOLCOLOR4BVPROC dolColor4bv; PFNDOLCOLOR4DVPROC dolColor4dv; PFNDOLCOLOR4FVPROC dolColor4fv; PFNDOLCOLOR4IVPROC dolColor4iv; PFNDOLCOLOR4SVPROC dolColor4sv; PFNDOLCOLOR4UBVPROC dolColor4ubv; PFNDOLCOLOR4UIVPROC dolColor4uiv; PFNDOLCOLOR4USVPROC dolColor4usv; <API key> dolTexCoord1d; <API key> dolTexCoord1f; <API key> dolTexCoord1i; <API key> dolTexCoord1s; <API key> dolTexCoord2d; <API key> dolTexCoord2f; <API key> dolTexCoord2i; <API key> dolTexCoord2s; <API key> dolTexCoord3d; <API key> dolTexCoord3f; <API key> dolTexCoord3i; <API key> dolTexCoord3s; <API key> dolTexCoord4d; <API key> dolTexCoord4f; <API key> dolTexCoord4i; <API key> dolTexCoord4s; <API key> dolTexCoord1dv; <API key> dolTexCoord1fv; <API key> dolTexCoord1iv; <API key> dolTexCoord1sv; <API key> dolTexCoord2dv; <API key> dolTexCoord2fv; <API key> dolTexCoord2iv; <API key> dolTexCoord2sv; <API key> dolTexCoord3dv; <API key> dolTexCoord3fv; <API key> dolTexCoord3iv; <API key> dolTexCoord3sv; <API key> dolTexCoord4dv; <API key> dolTexCoord4fv; <API key> dolTexCoord4iv; <API key> dolTexCoord4sv; <API key> dolRasterPos2d; <API key> dolRasterPos2f; <API key> dolRasterPos2i; <API key> dolRasterPos2s; <API key> dolRasterPos3d; <API key> dolRasterPos3f; <API key> dolRasterPos3i; <API key> dolRasterPos3s; <API key> dolRasterPos4d; <API key> dolRasterPos4f; <API key> dolRasterPos4i; <API key> dolRasterPos4s; <API key> dolRasterPos2dv; <API key> dolRasterPos2fv; <API key> dolRasterPos2iv; <API key> dolRasterPos2sv; <API key> dolRasterPos3dv; <API key> dolRasterPos3fv; <API key> dolRasterPos3iv; <API key> dolRasterPos3sv; <API key> dolRasterPos4dv; <API key> dolRasterPos4fv; <API key> dolRasterPos4iv; <API key> dolRasterPos4sv; PFNDOLRECTDPROC dolRectd; PFNDOLRECTFPROC dolRectf; PFNDOLRECTIPROC dolRecti; PFNDOLRECTSPROC dolRects; PFNDOLRECTDVPROC dolRectdv; PFNDOLRECTFVPROC dolRectfv; PFNDOLRECTIVPROC dolRectiv; PFNDOLRECTSVPROC dolRectsv; <API key> dolVertexPointer; <API key> dolNormalPointer; <API key> dolColorPointer; <API key> dolIndexPointer; <API key> dolTexCoordPointer; <API key> dolEdgeFlagPointer; <API key> dolGetPointerv; <API key> dolArrayElement; <API key> dolDrawArrays; <API key> dolDrawElements; <API key> <API key>; <API key> dolShadeModel; PFNDOLLIGHTFPROC dolLightf; PFNDOLLIGHTIPROC dolLighti; PFNDOLLIGHTFVPROC dolLightfv; PFNDOLLIGHTIVPROC dolLightiv; <API key> dolGetLightfv; <API key> dolGetLightiv; <API key> dolLightModelf; <API key> dolLightModeli; <API key> dolLightModelfv; <API key> dolLightModeliv; PFNDOLMATERIALFPROC dolMaterialf; PFNDOLMATERIALIPROC dolMateriali; <API key> dolMaterialfv; <API key> dolMaterialiv; <API key> dolGetMaterialfv; <API key> dolGetMaterialiv; <API key> dolColorMaterial; PFNDOLPIXELZOOMPROC dolPixelZoom; <API key> dolPixelStoref; <API key> dolPixelStorei; <API key> dolPixelTransferf; <API key> dolPixelTransferi; <API key> dolPixelMapfv; <API key> dolPixelMapuiv; <API key> dolPixelMapusv; <API key> dolGetPixelMapfv; <API key> dolGetPixelMapuiv; <API key> dolGetPixelMapusv; PFNDOLBITMAPPROC dolBitmap; <API key> dolReadPixels; <API key> dolDrawPixels; <API key> dolCopyPixels; <API key> dolStencilFunc; <API key> dolStencilMask; PFNDOLSTENCILOPPROC dolStencilOp; <API key> dolClearStencil; PFNDOLTEXGENDPROC dolTexGend; PFNDOLTEXGENFPROC dolTexGenf; PFNDOLTEXGENIPROC dolTexGeni; PFNDOLTEXGENDVPROC dolTexGendv; PFNDOLTEXGENFVPROC dolTexGenfv; PFNDOLTEXGENIVPROC dolTexGeniv; <API key> dolGetTexGendv; <API key> dolGetTexGenfv; <API key> dolGetTexGeniv; PFNDOLTEXENVFPROC dolTexEnvf; PFNDOLTEXENVIPROC dolTexEnvi; PFNDOLTEXENVFVPROC dolTexEnvfv; PFNDOLTEXENVIVPROC dolTexEnviv; <API key> dolGetTexEnvfv; <API key> dolGetTexEnviv; <API key> dolTexParameterf; <API key> dolTexParameteri; <API key> dolTexParameterfv; <API key> dolTexParameteriv; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolTexImage1D; <API key> dolTexImage2D; <API key> dolGetTexImage; <API key> dolGenTextures; <API key> dolDeleteTextures; <API key> dolBindTexture; <API key> <API key>; <API key> <API key>; PFNDOLISTEXTUREPROC dolIsTexture; <API key> dolTexSubImage1D; <API key> dolTexSubImage2D; <API key> dolCopyTexImage1D; <API key> dolCopyTexImage2D; <API key> <API key>; <API key> <API key>; PFNDOLMAP1DPROC dolMap1d; PFNDOLMAP1FPROC dolMap1f; PFNDOLMAP2DPROC dolMap2d; PFNDOLMAP2FPROC dolMap2f; PFNDOLGETMAPDVPROC dolGetMapdv; PFNDOLGETMAPFVPROC dolGetMapfv; PFNDOLGETMAPIVPROC dolGetMapiv; <API key> dolEvalCoord1d; <API key> dolEvalCoord1f; <API key> dolEvalCoord1dv; <API key> dolEvalCoord1fv; <API key> dolEvalCoord2d; <API key> dolEvalCoord2f; <API key> dolEvalCoord2dv; <API key> dolEvalCoord2fv; PFNDOLMAPGRID1DPROC dolMapGrid1d; PFNDOLMAPGRID1FPROC dolMapGrid1f; PFNDOLMAPGRID2DPROC dolMapGrid2d; PFNDOLMAPGRID2FPROC dolMapGrid2f; <API key> dolEvalPoint1; <API key> dolEvalPoint2; PFNDOLEVALMESH1PROC dolEvalMesh1; PFNDOLEVALMESH2PROC dolEvalMesh2; PFNDOLFOGFPROC dolFogf; PFNDOLFOGIPROC dolFogi; PFNDOLFOGFVPROC dolFogfv; PFNDOLFOGIVPROC dolFogiv; <API key> dolFeedbackBuffer; <API key> dolPassThrough; <API key> dolSelectBuffer; PFNDOLINITNAMESPROC dolInitNames; PFNDOLLOADNAMEPROC dolLoadName; PFNDOLPUSHNAMEPROC dolPushName; PFNDOLPOPNAMEPROC dolPopName; // gl_1_2 <API key> <API key>; <API key> <API key>; <API key> dolTexImage3D; <API key> dolTexSubImage3D; // gl_1_3 <API key> dolActiveTexture; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolMultiTexCoord1d; <API key> dolMultiTexCoord1dv; <API key> dolMultiTexCoord1f; <API key> dolMultiTexCoord1fv; <API key> dolMultiTexCoord1i; <API key> dolMultiTexCoord1iv; <API key> dolMultiTexCoord1s; <API key> dolMultiTexCoord1sv; <API key> dolMultiTexCoord2d; <API key> dolMultiTexCoord2dv; <API key> dolMultiTexCoord2f; <API key> dolMultiTexCoord2fv; <API key> dolMultiTexCoord2i; <API key> dolMultiTexCoord2iv; <API key> dolMultiTexCoord2s; <API key> dolMultiTexCoord2sv; <API key> dolMultiTexCoord3d; <API key> dolMultiTexCoord3dv; <API key> dolMultiTexCoord3f; <API key> dolMultiTexCoord3fv; <API key> dolMultiTexCoord3i; <API key> dolMultiTexCoord3iv; <API key> dolMultiTexCoord3s; <API key> dolMultiTexCoord3sv; <API key> dolMultiTexCoord4d; <API key> dolMultiTexCoord4dv; <API key> dolMultiTexCoord4f; <API key> dolMultiTexCoord4fv; <API key> dolMultiTexCoord4i; <API key> dolMultiTexCoord4iv; <API key> dolMultiTexCoord4s; <API key> dolMultiTexCoord4sv; <API key> dolSampleCoverage; // gl_1_4 <API key> dolBlendColor; <API key> dolBlendEquation; <API key> <API key>; <API key> dolFogCoordPointer; PFNDOLFOGCOORDDPROC dolFogCoordd; <API key> dolFogCoorddv; PFNDOLFOGCOORDFPROC dolFogCoordf; <API key> dolFogCoordfv; <API key> dolMultiDrawArrays; <API key> <API key>; <API key> dolPointParameterf; <API key> dolPointParameterfv; <API key> dolPointParameteri; <API key> dolPointParameteriv; <API key> dolSecondaryColor3b; <API key> <API key>; <API key> dolSecondaryColor3d; <API key> <API key>; <API key> dolSecondaryColor3f; <API key> <API key>; <API key> dolSecondaryColor3i; <API key> <API key>; <API key> dolSecondaryColor3s; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolWindowPos2d; <API key> dolWindowPos2dv; <API key> dolWindowPos2f; <API key> dolWindowPos2fv; <API key> dolWindowPos2i; <API key> dolWindowPos2iv; <API key> dolWindowPos2s; <API key> dolWindowPos2sv; <API key> dolWindowPos3d; <API key> dolWindowPos3dv; <API key> dolWindowPos3f; <API key> dolWindowPos3fv; <API key> dolWindowPos3i; <API key> dolWindowPos3iv; <API key> dolWindowPos3s; <API key> dolWindowPos3sv; // gl_1_5 <API key> dolBeginQuery; <API key> dolBindBuffer; <API key> dolBufferData; <API key> dolBufferSubData; <API key> dolDeleteBuffers; <API key> dolDeleteQueries; PFNDOLENDQUERYPROC dolEndQuery; <API key> dolGenBuffers; <API key> dolGenQueries; <API key> <API key>; <API key> <API key>; <API key> dolGetBufferSubData; <API key> dolGetQueryObjectiv; <API key> <API key>; <API key> dolGetQueryiv; PFNDOLISBUFFERPROC dolIsBuffer; PFNDOLISQUERYPROC dolIsQuery; PFNDOLMAPBUFFERPROC dolMapBuffer; <API key> dolUnmapBuffer; // gl_2_0 <API key> dolAttachShader; <API key> <API key>; <API key> <API key>; <API key> dolCompileShader; <API key> dolCreateProgram; <API key> dolCreateShader; <API key> dolDeleteProgram; <API key> dolDeleteShader; <API key> dolDetachShader; <API key> <API key>; <API key> dolDrawBuffers; <API key> <API key>; <API key> dolGetActiveAttrib; <API key> dolGetActiveUniform; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolGetProgramiv; <API key> dolGetShaderInfoLog; <API key> dolGetShaderSource; <API key> dolGetShaderiv; <API key> <API key>; <API key> dolGetUniformfv; <API key> dolGetUniformiv; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; PFNDOLISPROGRAMPROC dolIsProgram; PFNDOLISSHADERPROC dolIsShader; <API key> dolLinkProgram; <API key> dolShaderSource; <API key> <API key>; <API key> <API key>; <API key> <API key>; PFNDOLUNIFORM1FPROC dolUniform1f; <API key> dolUniform1fv; PFNDOLUNIFORM1IPROC dolUniform1i; <API key> dolUniform1iv; PFNDOLUNIFORM2FPROC dolUniform2f; <API key> dolUniform2fv; PFNDOLUNIFORM2IPROC dolUniform2i; <API key> dolUniform2iv; PFNDOLUNIFORM3FPROC dolUniform3f; <API key> dolUniform3fv; PFNDOLUNIFORM3IPROC dolUniform3i; <API key> dolUniform3iv; PFNDOLUNIFORM4FPROC dolUniform4f; <API key> dolUniform4fv; PFNDOLUNIFORM4IPROC dolUniform4i; <API key> dolUniform4iv; <API key> dolUniformMatrix2fv; <API key> dolUniformMatrix3fv; <API key> dolUniformMatrix4fv; <API key> dolUseProgram; <API key> dolValidateProgram; <API key> dolVertexAttrib1d; <API key> dolVertexAttrib1dv; <API key> dolVertexAttrib1f; <API key> dolVertexAttrib1fv; <API key> dolVertexAttrib1s; <API key> dolVertexAttrib1sv; <API key> dolVertexAttrib2d; <API key> dolVertexAttrib2dv; <API key> dolVertexAttrib2f; <API key> dolVertexAttrib2fv; <API key> dolVertexAttrib2s; <API key> dolVertexAttrib2sv; <API key> dolVertexAttrib3d; <API key> dolVertexAttrib3dv; <API key> dolVertexAttrib3f; <API key> dolVertexAttrib3fv; <API key> dolVertexAttrib3s; <API key> dolVertexAttrib3sv; <API key> dolVertexAttrib4Nbv; <API key> dolVertexAttrib4Niv; <API key> dolVertexAttrib4Nsv; <API key> dolVertexAttrib4Nub; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolVertexAttrib4bv; <API key> dolVertexAttrib4d; <API key> dolVertexAttrib4dv; <API key> dolVertexAttrib4f; <API key> dolVertexAttrib4fv; <API key> dolVertexAttrib4iv; <API key> dolVertexAttrib4s; <API key> dolVertexAttrib4sv; <API key> dolVertexAttrib4ubv; <API key> dolVertexAttrib4uiv; <API key> dolVertexAttrib4usv; <API key> <API key>; // gl_2_1 <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; // gl_3_0 <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolClampColor; <API key> dolClearBufferfi; <API key> dolClearBufferfv; <API key> dolClearBufferiv; <API key> dolClearBufferuiv; <API key> dolColorMaski; PFNDOLDISABLEIPROC dolDisablei; PFNDOLENABLEIPROC dolEnablei; <API key> <API key>; <API key> <API key>; <API key> dolGetBooleani_v; <API key> <API key>; <API key> dolGetStringi; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolGetUniformuiv; <API key> <API key>; <API key> <API key>; <API key> dolIsEnabledi; <API key> dolTexParameterIiv; <API key> dolTexParameterIuiv; <API key> <API key>; <API key> dolUniform1ui; <API key> dolUniform1uiv; <API key> dolUniform2ui; <API key> dolUniform2uiv; <API key> dolUniform3ui; <API key> dolUniform3uiv; <API key> dolUniform4ui; <API key> dolUniform4uiv; <API key> dolVertexAttribI1i; <API key> dolVertexAttribI1iv; <API key> dolVertexAttribI1ui; <API key> <API key>; <API key> dolVertexAttribI2i; <API key> dolVertexAttribI2iv; <API key> dolVertexAttribI2ui; <API key> <API key>; <API key> dolVertexAttribI3i; <API key> dolVertexAttribI3iv; <API key> dolVertexAttribI3ui; <API key> <API key>; <API key> dolVertexAttribI4bv; <API key> dolVertexAttribI4i; <API key> dolVertexAttribI4iv; <API key> dolVertexAttribI4sv; <API key> <API key>; <API key> dolVertexAttribI4ui; <API key> <API key>; <API key> <API key>; <API key> <API key>; // gl_3_1 <API key> <API key>; <API key> <API key>; <API key> <API key>; PFNDOLTEXBUFFERPROC dolTexBuffer; // gl_3_2 <API key> <API key>; <API key> <API key>; <API key> dolGetInteger64i_v; // gl 4_2 <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolBindImageTexture; <API key> dolMemoryBarrier; <API key> dolTexStorage1D; <API key> dolTexStorage2D; <API key> dolTexStorage3D; <API key> <API key>; <API key> <API key>; // gl_4_3 <API key> dolClearBufferData; <API key> <API key>; <API key> dolDispatchCompute; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolTexBufferRange; <API key> dolTextureView; <API key> dolBindVertexBuffer; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; // gl_4_4 <API key> dolClearTexImage; <API key> dolClearTexSubImage; <API key> dolBindBuffersBase; <API key> dolBindBuffersRange; <API key> dolBindTextures; <API key> dolBindSamplers; <API key> <API key>; <API key> <API key>; // gl_4_5 <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolCreateBuffers; <API key> <API key>; <API key> dolNamedBufferData; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolMapNamedBuffer; <API key> <API key>; <API key> dolUnmapNamedBuffer; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolCreateTextures; <API key> dolTextureBuffer; <API key> <API key>; <API key> dolTextureStorage1D; <API key> dolTextureStorage2D; <API key> dolTextureStorage3D; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolBindTextureUnit; <API key> dolGetTextureImage; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolGetVertexArrayiv; <API key> <API key>; <API key> <API key>; <API key> dolCreateSamplers; <API key> <API key>; <API key> dolCreateQueries; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolGetnTexImage; <API key> dolGetnUniformdv; <API key> dolGetnUniformfv; <API key> dolGetnUniformiv; <API key> dolGetnUniformuiv; <API key> dolReadnPixels; PFNDOLGETNMAPDVPROC dolGetnMapdv; PFNDOLGETNMAPFVPROC dolGetnMapfv; PFNDOLGETNMAPIVPROC dolGetnMapiv; <API key> dolGetnPixelMapfv; <API key> dolGetnPixelMapuiv; <API key> dolGetnPixelMapusv; <API key> <API key>; <API key> dolGetnColorTable; <API key> <API key>; <API key> <API key>; <API key> dolGetnHistogram; <API key> dolGetnMinmax; <API key> dolTextureBarrier; // <API key> <API key> dolBindBufferBase; <API key> dolBindBufferRange; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolGetIntegeri_v; <API key> <API key>; <API key> <API key>; <API key> <API key>; // ARB_sampler_objects <API key> dolBindSampler; <API key> dolDeleteSamplers; <API key> dolGenSamplers; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; PFNDOLISSAMPLERPROC dolIsSampler; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; // <API key> <API key> <API key>; <API key> dolMapBufferRange; // <API key> <API key> dolBindVertexArray; <API key> <API key>; <API key> dolGenVertexArrays; <API key> dolIsVertexArray; // <API key> <API key> dolBindFramebuffer; <API key> dolBindRenderbuffer; <API key> dolBlitFramebuffer; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolGenFramebuffers; <API key> dolGenRenderbuffers; <API key> dolGenerateMipmap; <API key> <API key>; <API key> <API key>; <API key> dolIsFramebuffer; <API key> dolIsRenderbuffer; <API key> <API key>; <API key> <API key>; // <API key> <API key> dolGetProgramBinary; <API key> dolProgramBinary; <API key> <API key>; // ARB_sync <API key> dolClientWaitSync; <API key> dolDeleteSync; PFNDOLFENCESYNCPROC dolFenceSync; <API key> dolGetInteger64v; PFNDOLGETSYNCIVPROC dolGetSynciv; PFNDOLISSYNCPROC dolIsSync; PFNDOLWAITSYNCPROC dolWaitSync; // <API key> <API key> <API key>; <API key> <API key>; <API key> dolGetMultisamplefv; <API key> dolSampleMaski; // <API key> <API key> <API key>; <API key> <API key>; // <API key> <API key> dolClearDepthf; <API key> dolDepthRangef; <API key> <API key>; <API key> <API key>; <API key> dolShaderBinary; // <API key> <API key> <API key>; <API key> <API key>; // <API key> <API key> <API key>; <API key> dolGetFragDataIndex; // ARB_viewport_array <API key> dolDepthRangeArrayv; <API key> <API key>; <API key> dolGetDoublei_v; <API key> dolGetFloati_v; <API key> dolScissorArrayv; <API key> dolScissorIndexed; <API key> dolScissorIndexedv; <API key> dolViewportArrayv; <API key> dolViewportIndexedf; <API key> <API key>; // <API key> <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; // ARB_sample_shading <API key> dolMinSampleShading; // ARB_debug_output <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; // KHR_debug <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> dolGetObjectLabel; <API key> <API key>; <API key> dolObjectLabel; <API key> dolObjectPtrLabel; <API key> dolPopDebugGroup; <API key> dolPushDebugGroup; // ARB_buffer_storage <API key> dolBufferStorage; // <API key> <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; <API key> <API key>; // ARB_clip_control <API key> dolClipControl; // ARB_copy_image <API key> dolCopyImageSubData; // <API key> <API key> <API key>; // Creates a GLFunc object that requires a feature #define GLFUNC_REQUIRES(x, y) { (void**)&x, #x, y } // Creates a GLFunc object with a different function suffix // For when we want to use the same function pointer, but different function name #define GLFUNC_SUFFIX(x, y, z) { (void**)&x, #x #y, z } // Creates a GLFunc object that should always be able to get grabbed // Used for Desktop OpenGL functions that should /always/ be provided. // aka GL 1.1/1.2/1.3/1.4 #define <API key>(x) { (void**)&x, #x, "VERSION_GL" } // Creates a GLFunc object that should be able to get grabbed // on both GL and ES #define <API key>(x) { (void**)&x, #x, "VERSION_GL |VERSION_GLES_2" } // Creates a GLFunc object that should be able to get grabbed // on both GL and ES 3.0 #define <API key>(x) { (void**)&x, #x, "VERSION_GL |VERSION_GLES_3" } // Creates a GLFunc object that should be able to get grabbed // on both GL and ES 3.2 #define <API key>(x) { (void**)&x, #x, "VERSION_GL |VERSION_GLES_3_2" } struct GLFunc { void** function_ptr; const std::string function_name; const std::string requirements; }; const GLFunc gl_function_array[] = { // gl_1_1 <API key>(glClearIndex), <API key>(glIndexMask), <API key>(glAlphaFunc), <API key>(glLogicOp), <API key>(glPointSize), <API key>(glLineStipple), <API key>(glPolygonMode), <API key>(glPolygonStipple), <API key>(glGetPolygonStipple), <API key>(glEdgeFlag), <API key>(glEdgeFlagv), <API key>(glClipPlane), <API key>(glGetClipPlane), <API key>(glDrawBuffer), <API key>(glEnableClientState), <API key>(<API key>), <API key>(glGetDoublev), <API key>(glPushAttrib), <API key>(glPopAttrib), <API key>(glPushClientAttrib), <API key>(glPopClientAttrib), <API key>(glRenderMode), <API key>(glClearDepth), <API key>(glDepthRange), <API key>(glClearAccum), <API key>(glAccum), <API key>(glMatrixMode), <API key>(glOrtho), <API key>(glFrustum), <API key>(glPushMatrix), <API key>(glPopMatrix), <API key>(glLoadIdentity), <API key>(glLoadMatrixd), <API key>(glLoadMatrixf), <API key>(glMultMatrixd), <API key>(glMultMatrixf), <API key>(glRotated), <API key>(glRotatef), <API key>(glScaled), <API key>(glScalef), <API key>(glTranslated), <API key>(glTranslatef), <API key>(glIsList), <API key>(glDeleteLists), <API key>(glGenLists), <API key>(glNewList), <API key>(glEndList), <API key>(glCallList), <API key>(glCallLists), <API key>(glListBase), <API key>(glBegin), <API key>(glEnd), <API key>(glVertex2d), <API key>(glVertex2f), <API key>(glVertex2i), <API key>(glVertex2s), <API key>(glVertex3d), <API key>(glVertex3f), <API key>(glVertex3i), <API key>(glVertex3s), <API key>(glVertex4d), <API key>(glVertex4f), <API key>(glVertex4i), <API key>(glVertex4s), <API key>(glVertex2dv), <API key>(glVertex2fv), <API key>(glVertex2iv), <API key>(glVertex2sv), <API key>(glVertex3dv), <API key>(glVertex3fv), <API key>(glVertex3iv), <API key>(glVertex3sv), <API key>(glVertex4dv), <API key>(glVertex4fv), <API key>(glVertex4iv), <API key>(glVertex4sv), <API key>(glNormal3b), <API key>(glNormal3d), <API key>(glNormal3f), <API key>(glNormal3i), <API key>(glNormal3s), <API key>(glNormal3bv), <API key>(glNormal3dv), <API key>(glNormal3fv), <API key>(glNormal3iv), <API key>(glNormal3sv), <API key>(glIndexd), <API key>(glIndexf), <API key>(glIndexi), <API key>(glIndexs), <API key>(glIndexub), <API key>(glIndexdv), <API key>(glIndexfv), <API key>(glIndexiv), <API key>(glIndexsv), <API key>(glIndexubv), <API key>(glColor3b), <API key>(glColor3d), <API key>(glColor3f), <API key>(glColor3i), <API key>(glColor3s), <API key>(glColor3ub), <API key>(glColor3ui), <API key>(glColor3us), <API key>(glColor4b), <API key>(glColor4d), <API key>(glColor4f), <API key>(glColor4i), <API key>(glColor4s), <API key>(glColor4ub), <API key>(glColor4ui), <API key>(glColor4us), <API key>(glColor3bv), <API key>(glColor3dv), <API key>(glColor3fv), <API key>(glColor3iv), <API key>(glColor3sv), <API key>(glColor3ubv), <API key>(glColor3uiv), <API key>(glColor3usv), <API key>(glColor4bv), <API key>(glColor4dv), <API key>(glColor4fv), <API key>(glColor4iv), <API key>(glColor4sv), <API key>(glColor4ubv), <API key>(glColor4uiv), <API key>(glColor4usv), <API key>(glTexCoord1d), <API key>(glTexCoord1f), <API key>(glTexCoord1i), <API key>(glTexCoord1s), <API key>(glTexCoord2d), <API key>(glTexCoord2f), <API key>(glTexCoord2i), <API key>(glTexCoord2s), <API key>(glTexCoord3d), <API key>(glTexCoord3f), <API key>(glTexCoord3i), <API key>(glTexCoord3s), <API key>(glTexCoord4d), <API key>(glTexCoord4f), <API key>(glTexCoord4i), <API key>(glTexCoord4s), <API key>(glTexCoord1dv), <API key>(glTexCoord1fv), <API key>(glTexCoord1iv), <API key>(glTexCoord1sv), <API key>(glTexCoord2dv), <API key>(glTexCoord2fv), <API key>(glTexCoord2iv), <API key>(glTexCoord2sv), <API key>(glTexCoord3dv), <API key>(glTexCoord3fv), <API key>(glTexCoord3iv), <API key>(glTexCoord3sv), <API key>(glTexCoord4dv), <API key>(glTexCoord4fv), <API key>(glTexCoord4iv), <API key>(glTexCoord4sv), <API key>(glRasterPos2d), <API key>(glRasterPos2f), <API key>(glRasterPos2i), <API key>(glRasterPos2s), <API key>(glRasterPos3d), <API key>(glRasterPos3f), <API key>(glRasterPos3i), <API key>(glRasterPos3s), <API key>(glRasterPos4d), <API key>(glRasterPos4f), <API key>(glRasterPos4i), <API key>(glRasterPos4s), <API key>(glRasterPos2dv), <API key>(glRasterPos2fv), <API key>(glRasterPos2iv), <API key>(glRasterPos2sv), <API key>(glRasterPos3dv), <API key>(glRasterPos3fv), <API key>(glRasterPos3iv), <API key>(glRasterPos3sv), <API key>(glRasterPos4dv), <API key>(glRasterPos4fv), <API key>(glRasterPos4iv), <API key>(glRasterPos4sv), <API key>(glRectd), <API key>(glRectf), <API key>(glRecti), <API key>(glRects), <API key>(glRectdv), <API key>(glRectfv), <API key>(glRectiv), <API key>(glRectsv), <API key>(glVertexPointer), <API key>(glNormalPointer), <API key>(glColorPointer), <API key>(glIndexPointer), <API key>(glTexCoordPointer), <API key>(glEdgeFlagPointer), <API key>(glArrayElement), <API key>(glInterleavedArrays), <API key>(glShadeModel), <API key>(glLightf), <API key>(glLighti), <API key>(glLightfv), <API key>(glLightiv), <API key>(glGetLightfv), <API key>(glGetLightiv), <API key>(glLightModelf), <API key>(glLightModeli), <API key>(glLightModelfv), <API key>(glLightModeliv), <API key>(glMaterialf), <API key>(glMateriali), <API key>(glMaterialfv), <API key>(glMaterialiv), <API key>(glGetMaterialfv), <API key>(glGetMaterialiv), <API key>(glColorMaterial), <API key>(glPixelZoom), <API key>(glPixelStoref), <API key>(glPixelTransferf), <API key>(glPixelTransferi), <API key>(glPixelMapfv), <API key>(glPixelMapuiv), <API key>(glPixelMapusv), <API key>(glGetPixelMapfv), <API key>(glGetPixelMapuiv), <API key>(glGetPixelMapusv), <API key>(glBitmap), <API key>(glDrawPixels), <API key>(glCopyPixels), <API key>(glTexGend), <API key>(glTexGenf), <API key>(glTexGeni), <API key>(glTexGendv), <API key>(glTexGenfv), <API key>(glTexGeniv), <API key>(glGetTexGendv), <API key>(glGetTexGenfv), <API key>(glGetTexGeniv), <API key>(glTexEnvf), <API key>(glTexEnvi), <API key>(glTexEnvfv), <API key>(glTexEnviv), <API key>(glGetTexEnvfv), <API key>(glGetTexEnviv), <API key>(<API key>), <API key>(<API key>), <API key>(glTexImage1D), <API key>(glGetTexImage), <API key>(<API key>), <API key>(<API key>), <API key>(glTexSubImage1D), <API key>(glCopyTexImage1D), <API key>(glCopyTexSubImage1D), <API key>(glMap1d), <API key>(glMap1f), <API key>(glMap2d), <API key>(glMap2f), <API key>(glGetMapdv), <API key>(glGetMapfv), <API key>(glGetMapiv), <API key>(glEvalCoord1d), <API key>(glEvalCoord1f), <API key>(glEvalCoord1dv), <API key>(glEvalCoord1fv), <API key>(glEvalCoord2d), <API key>(glEvalCoord2f), <API key>(glEvalCoord2dv), <API key>(glEvalCoord2fv), <API key>(glMapGrid1d), <API key>(glMapGrid1f), <API key>(glMapGrid2d), <API key>(glMapGrid2f), <API key>(glEvalPoint1), <API key>(glEvalPoint2), <API key>(glEvalMesh1), <API key>(glEvalMesh2), <API key>(glFogf), <API key>(glFogi), <API key>(glFogfv), <API key>(glFogiv), <API key>(glFeedbackBuffer), <API key>(glPassThrough), <API key>(glSelectBuffer), <API key>(glInitNames), <API key>(glLoadName), <API key>(glPushName), <API key>(glPopName), <API key>(glTexImage2D), <API key>(glClearColor), <API key>(glClear), <API key>(glColorMask), <API key>(glBlendFunc), <API key>(glCullFace), <API key>(glFrontFace), <API key>(glLineWidth), <API key>(glPolygonOffset), <API key>(glScissor), <API key>(glEnable), <API key>(glDisable), <API key>(glIsEnabled), <API key>(glGetBooleanv), <API key>(glGetFloatv), <API key>(glFinish), <API key>(glFlush), <API key>(glHint), <API key>(glDepthFunc), <API key>(glDepthMask), <API key>(glViewport), <API key>(glDrawArrays), <API key>(glDrawElements), <API key>(glPixelStorei), <API key>(glReadPixels), <API key>(glStencilFunc), <API key>(glStencilMask), <API key>(glStencilOp), <API key>(glClearStencil), <API key>(glTexParameterf), <API key>(glTexParameteri), <API key>(glTexParameterfv), <API key>(glTexParameteriv), <API key>(glGetTexParameterfv), <API key>(glGetTexParameteriv), <API key>(glGenTextures), <API key>(glDeleteTextures), <API key>(glBindTexture), <API key>(glIsTexture), <API key>(glTexSubImage2D), <API key>(glCopyTexImage2D), <API key>(glCopyTexSubImage2D), <API key>(glReadBuffer), <API key>(glGetPointerv), // gl_1_2 <API key>(glCopyTexSubImage3D), <API key>(glDrawRangeElements), <API key>(glTexImage3D), <API key>(glTexSubImage3D), // gl_1_3 <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), <API key>(glMultiTexCoord1d), <API key>(glMultiTexCoord1dv), <API key>(glMultiTexCoord1f), <API key>(glMultiTexCoord1fv), <API key>(glMultiTexCoord1i), <API key>(glMultiTexCoord1iv), <API key>(glMultiTexCoord1s), <API key>(glMultiTexCoord1sv), <API key>(glMultiTexCoord2d), <API key>(glMultiTexCoord2dv), <API key>(glMultiTexCoord2f), <API key>(glMultiTexCoord2fv), <API key>(glMultiTexCoord2i), <API key>(glMultiTexCoord2iv), <API key>(glMultiTexCoord2s), <API key>(glMultiTexCoord2sv), <API key>(glMultiTexCoord3d), <API key>(glMultiTexCoord3dv), <API key>(glMultiTexCoord3f), <API key>(glMultiTexCoord3fv), <API key>(glMultiTexCoord3i), <API key>(glMultiTexCoord3iv), <API key>(glMultiTexCoord3s), <API key>(glMultiTexCoord3sv), <API key>(glMultiTexCoord4d), <API key>(glMultiTexCoord4dv), <API key>(glMultiTexCoord4f), <API key>(glMultiTexCoord4fv), <API key>(glMultiTexCoord4i), <API key>(glMultiTexCoord4iv), <API key>(glMultiTexCoord4s), <API key>(glMultiTexCoord4sv), <API key>(glSampleCoverage), <API key>(glActiveTexture), <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), // gl_1_4 <API key>(glFogCoordPointer), <API key>(glFogCoordd), <API key>(glFogCoorddv), <API key>(glFogCoordf), <API key>(glFogCoordfv), <API key>(glMultiDrawArrays), <API key>(glMultiDrawElements), <API key>(glPointParameterf), <API key>(glPointParameterfv), <API key>(glPointParameteri), <API key>(glPointParameteriv), <API key>(glSecondaryColor3b), <API key>(glSecondaryColor3bv), <API key>(glSecondaryColor3d), <API key>(glSecondaryColor3dv), <API key>(glSecondaryColor3f), <API key>(glSecondaryColor3fv), <API key>(glSecondaryColor3i), <API key>(glSecondaryColor3iv), <API key>(glSecondaryColor3s), <API key>(glSecondaryColor3sv), <API key>(glSecondaryColor3ub), <API key>(<API key>), <API key>(glSecondaryColor3ui), <API key>(<API key>), <API key>(glSecondaryColor3us), <API key>(<API key>), <API key>(<API key>), <API key>(glWindowPos2d), <API key>(glWindowPos2dv), <API key>(glWindowPos2f), <API key>(glWindowPos2fv), <API key>(glWindowPos2i), <API key>(glWindowPos2iv), <API key>(glWindowPos2s), <API key>(glWindowPos2sv), <API key>(glWindowPos3d), <API key>(glWindowPos3dv), <API key>(glWindowPos3f), <API key>(glWindowPos3fv), <API key>(glWindowPos3i), <API key>(glWindowPos3iv), <API key>(glWindowPos3s), <API key>(glWindowPos3sv), <API key>(glBlendColor), <API key>(glBlendEquation), <API key>(glBlendFuncSeparate), // gl_1_5 <API key>(glGetBufferSubData), <API key>(glGetQueryObjectiv), <API key>(glMapBuffer), <API key>(glBindBuffer), <API key>(glBufferData), <API key>(glBufferSubData), <API key>(glDeleteBuffers), <API key>(glGenBuffers), <API key>(<API key>), <API key>(glIsBuffer), <API key>(glBeginQuery), <API key>(glDeleteQueries), <API key>(glEndQuery), <API key>(glGenQueries), <API key>(glIsQuery), <API key>(glGetQueryiv), <API key>(glGetQueryObjectuiv), <API key>(glGetBufferPointerv), <API key>(glUnmapBuffer), // gl_2_0 <API key>(glGetVertexAttribdv), <API key>(glVertexAttrib1d), <API key>(glVertexAttrib1dv), <API key>(glVertexAttrib1s), <API key>(glVertexAttrib1sv), <API key>(glVertexAttrib2d), <API key>(glVertexAttrib2dv), <API key>(glVertexAttrib2s), <API key>(glVertexAttrib2sv), <API key>(glVertexAttrib3d), <API key>(glVertexAttrib3dv), <API key>(glVertexAttrib3s), <API key>(glVertexAttrib3sv), <API key>(glVertexAttrib4Nbv), <API key>(glVertexAttrib4Niv), <API key>(glVertexAttrib4Nsv), <API key>(glVertexAttrib4Nub), <API key>(glVertexAttrib4Nubv), <API key>(glVertexAttrib4Nuiv), <API key>(glVertexAttrib4Nusv), <API key>(glVertexAttrib4bv), <API key>(glVertexAttrib4d), <API key>(glVertexAttrib4dv), <API key>(glVertexAttrib4iv), <API key>(glVertexAttrib4s), <API key>(glVertexAttrib4sv), <API key>(glVertexAttrib4ubv), <API key>(glVertexAttrib4uiv), <API key>(glVertexAttrib4usv), <API key>(glAttachShader), <API key>(<API key>), <API key>(<API key>), <API key>(glCompileShader), <API key>(glCreateProgram), <API key>(glCreateShader), <API key>(glDeleteProgram), <API key>(glDeleteShader), <API key>(glDetachShader), <API key>(<API key>), <API key>(<API key>), <API key>(glGetActiveAttrib), <API key>(glGetActiveUniform), <API key>(<API key>), <API key>(glGetAttribLocation), <API key>(glGetProgramInfoLog), <API key>(glGetProgramiv), <API key>(glGetShaderInfoLog), <API key>(glGetShaderSource), <API key>(glGetShaderiv), <API key>(<API key>), <API key>(glGetUniformfv), <API key>(glGetUniformiv), <API key>(<API key>), <API key>(glGetVertexAttribfv), <API key>(glGetVertexAttribiv), <API key>(glIsProgram), <API key>(glIsShader), <API key>(glLinkProgram), <API key>(glShaderSource), <API key>(<API key>), <API key>(<API key>), <API key>(glStencilOpSeparate), <API key>(glUniform1f), <API key>(glUniform1fv), <API key>(glUniform1i), <API key>(glUniform1iv), <API key>(glUniform2f), <API key>(glUniform2fv), <API key>(glUniform2i), <API key>(glUniform2iv), <API key>(glUniform3f), <API key>(glUniform3fv), <API key>(glUniform3i), <API key>(glUniform3iv), <API key>(glUniform4f), <API key>(glUniform4fv), <API key>(glUniform4i), <API key>(glUniform4iv), <API key>(glUniformMatrix2fv), <API key>(glUniformMatrix3fv), <API key>(glUniformMatrix4fv), <API key>(glUseProgram), <API key>(glValidateProgram), <API key>(glVertexAttrib1f), <API key>(glVertexAttrib1fv), <API key>(glVertexAttrib2f), <API key>(glVertexAttrib2fv), <API key>(glVertexAttrib3f), <API key>(glVertexAttrib3fv), <API key>(glVertexAttrib4f), <API key>(glVertexAttrib4fv), <API key>(<API key>), <API key>(glDrawBuffers), // gl_2_1 <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), <API key>(<API key>), // gl_3_0 GLFUNC_REQUIRES(<API key>, "VERSION_3_0"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0"), GLFUNC_REQUIRES(glClampColor, "VERSION_3_0"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0"), GLFUNC_REQUIRES(glGetBooleani_v, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI1i, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI1iv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI1ui, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI1uiv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI2i, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI2iv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI2ui, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI2uiv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI3i, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI3iv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI3ui, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI3uiv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI4bv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI4sv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI4ubv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI4usv, "VERSION_3_0"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glClearBufferfi, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glClearBufferfv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glClearBufferiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glClearBufferuiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetStringi, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetUniformuiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform1ui, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform1uiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform2ui, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform2uiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform3ui, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform3uiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform4ui, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform4uiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glVertexAttribI4i, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glVertexAttribI4iv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glVertexAttribI4ui, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glVertexAttribI4uiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glColorMaski, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glDisablei, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glEnablei, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(<API key>, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glIsEnabledi, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glTexParameterIiv, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glTexParameterIuiv, "VERSION_3_0 |VERSION_GLES_3_2"), // gl_3_1 GLFUNC_REQUIRES(<API key>, "VERSION_3_1"), GLFUNC_REQUIRES(<API key>, "VERSION_3_1 |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "VERSION_3_1 |VERSION_GLES_3"), GLFUNC_REQUIRES(glTexBuffer, "VERSION_3_1 |VERSION_GLES_3_2"), // gl_3_2 GLFUNC_REQUIRES(<API key>, "VERSION_3_2 |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetInteger64i_v, "VERSION_3_2 |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "VERSION_3_2 |VERSION_GLES_3_2"), // gl_4_2 GLFUNC_REQUIRES(<API key>, "VERSION_4_2"), GLFUNC_REQUIRES(<API key>, "VERSION_4_2"), GLFUNC_REQUIRES(<API key>, "VERSION_4_2"), GLFUNC_REQUIRES(<API key>, "VERSION_4_2"), GLFUNC_REQUIRES(<API key>, "VERSION_4_2"), GLFUNC_REQUIRES(glBindImageTexture, "VERSION_4_2"), GLFUNC_REQUIRES(glMemoryBarrier, "VERSION_4_2"), GLFUNC_REQUIRES(glTexStorage1D, "VERSION_4_2"), GLFUNC_REQUIRES(glTexStorage2D, "VERSION_4_2"), GLFUNC_REQUIRES(glTexStorage3D, "VERSION_4_2"), GLFUNC_REQUIRES(<API key>, "VERSION_4_2"), GLFUNC_REQUIRES(<API key>, "VERSION_4_2"), // gl_4_3 GLFUNC_REQUIRES(glClearBufferData, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(glDispatchCompute, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(glCopyImageSubData, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(glTexBufferRange, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(glTextureView, "VERSION_4_3"), GLFUNC_REQUIRES(glBindVertexBuffer, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(<API key>, "VERSION_4_3"), GLFUNC_REQUIRES(glPushDebugGroup, "VERSION_4_3"), GLFUNC_REQUIRES(glPopDebugGroup, "VERSION_4_3"), GLFUNC_REQUIRES(glObjectLabel, "VERSION_4_3"), GLFUNC_REQUIRES(glGetObjectLabel, "VERSION_4_3"), GLFUNC_REQUIRES(glObjectPtrLabel, "VERSION_4_3"), GLFUNC_REQUIRES(glGetObjectPtrLabel, "VERSION_4_3"), // gl_4_4 GLFUNC_REQUIRES(glBufferStorage, "VERSION_4_4"), GLFUNC_REQUIRES(glClearTexImage, "VERSION_4_4"), GLFUNC_REQUIRES(glClearTexSubImage, "VERSION_4_4"), GLFUNC_REQUIRES(glBindBuffersBase, "VERSION_4_4"), GLFUNC_REQUIRES(glBindBuffersRange, "VERSION_4_4"), GLFUNC_REQUIRES(glBindTextures, "VERSION_4_4"), GLFUNC_REQUIRES(glBindSamplers, "VERSION_4_4"), GLFUNC_REQUIRES(glBindImageTextures, "VERSION_4_4"), GLFUNC_REQUIRES(glBindVertexBuffers, "VERSION_4_4"), // gl_4_5 GLFUNC_REQUIRES(glClipControl, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateBuffers, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedBufferData, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glMapNamedBuffer, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glUnmapNamedBuffer, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateTextures, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureBuffer, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureStorage1D, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureStorage2D, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureStorage3D, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureSubImage1D, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureSubImage2D, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureSubImage3D, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureParameterf, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureParameteri, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glBindTextureUnit, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTextureImage, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glGetVertexArrayiv, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateSamplers, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateQueries, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), GLFUNC_REQUIRES(glReadnPixels, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureBarrier, "VERSION_4_5"), // AMD's video driver is trash and doesn't expose these function pointers // Remove them for now until they learn how to implement the spec properly. // GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnTexImage, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnUniformdv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnUniformfv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnUniformiv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnUniformuiv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnMapdv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnMapfv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnMapiv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnPixelMapfv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnPixelMapuiv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnPixelMapusv, "VERSION_4_5"), // GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnColorTable, "VERSION_4_5"), // GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), // GLFUNC_REQUIRES(<API key>, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnHistogram, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnMinmax, "VERSION_4_5"), // <API key> GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(glBindBufferBase, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glBindBufferRange, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetIntegeri_v, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetUniformIndices, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), // ARB_sampler_objects GLFUNC_REQUIRES(glBindSampler, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glDeleteSamplers, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glGenSamplers, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glIsSampler, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glSamplerParameterf, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glSamplerParameteri, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3_2"), // <API key> GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glMapBufferRange, "<API key> |VERSION_GLES_3"), // <API key> GLFUNC_REQUIRES(glBindVertexArray, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glGenVertexArrays, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glIsVertexArray, "<API key> |VERSION_GLES_3"), // <API key> GLFUNC_SUFFIX(glBindVertexArray, APPLE, "<API key> !<API key>"), GLFUNC_SUFFIX(<API key>, APPLE, "<API key> !<API key>"), GLFUNC_SUFFIX(glGenVertexArrays, APPLE, "<API key> !<API key>"), GLFUNC_SUFFIX(glIsVertexArray, APPLE, "<API key> !<API key>"), // <API key> GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(glBindFramebuffer, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(glBindRenderbuffer, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(glBlitFramebuffer, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glGenFramebuffers, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(glGenRenderbuffers, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(glGenerateMipmap, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(glIsFramebuffer, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(glIsRenderbuffer, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3"), // <API key> GLFUNC_REQUIRES(glGetProgramBinary, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glProgramBinary, "<API key> |VERSION_GLES_3"), GLFUNC_REQUIRES(glProgramParameteri, "<API key> |VERSION_GLES_3"), // ARB_sync GLFUNC_REQUIRES(glClientWaitSync, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glDeleteSync, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glFenceSync, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetInteger64v, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetSynciv, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glIsSync, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glWaitSync, "GL_ARB_sync |VERSION_GLES_3"), // <API key> GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(glGetMultisamplefv, "<API key>"), GLFUNC_REQUIRES(glSampleMaski, "<API key>"), // <API key> GLFUNC_REQUIRES(<API key>, "<API key> !VERSION_4_3 |VERSION_GLES_3_1"), GLFUNC_REQUIRES(<API key>, "<API key> !VERSION_4_3 |VERSION_GLES_3_2"), GLFUNC_SUFFIX(<API key>, OES, "<API key> !VERSION_GLES_3_2"), // <API key> GLFUNC_REQUIRES(glClearDepthf, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(glDepthRangef, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_2"), GLFUNC_REQUIRES(glShaderBinary, "<API key> |VERSION_GLES_2"), // <API key> GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(<API key>, "<API key>"), // <API key> GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(glGetFragDataIndex, "<API key>"), // ARB_viewport_array GLFUNC_REQUIRES(glDepthRangeArrayv, "<API key>"), GLFUNC_REQUIRES(glDepthRangeIndexed, "<API key>"), GLFUNC_REQUIRES(glGetDoublei_v, "<API key>"), GLFUNC_REQUIRES(glGetFloati_v, "<API key>"), GLFUNC_REQUIRES(glScissorArrayv, "<API key>"), GLFUNC_REQUIRES(glScissorIndexed, "<API key>"), GLFUNC_REQUIRES(glScissorIndexedv, "<API key>"), GLFUNC_REQUIRES(glViewportArrayv, "<API key>"), GLFUNC_REQUIRES(glViewportIndexedf, "<API key>"), GLFUNC_REQUIRES(glViewportIndexedfv, "<API key>"), // <API key> GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3_2"), GLFUNC_REQUIRES(<API key>, "<API key> |VERSION_GLES_3_2"), GLFUNC_REQUIRES(<API key>, "<API key>"), // <API key> GLFUNC_SUFFIX(<API key>, OES, "<API key> !VERSION_GLES_3_2"), GLFUNC_SUFFIX(<API key>, OES, "<API key> VERSION_GLES_3 !VERSION_GLES_3_2"), GLFUNC_SUFFIX(<API key>, OES, "<API key> VERSION_GLES_3 !VERSION_GLES_3_2"), GLFUNC_SUFFIX(<API key>, OES, "<API key> <API key>"), // <API key> GLFUNC_SUFFIX(<API key>, EXT, "<API key> !<API key> !VERSION_GLES_3_2"), GLFUNC_SUFFIX(<API key>, EXT, "<API key> VERSION_GLES_3 !<API key> !VERSION_GLES_3_2"), GLFUNC_SUFFIX(<API key>, EXT, "<API key> VERSION_GLES_3 !<API key> !VERSION_GLES_3_2"), GLFUNC_SUFFIX(<API key>, EXT, "<API key> <API key> !<API key> !VERSION_GLES_3_2"), // ARB_sample_shading GLFUNC_SUFFIX(glMinSampleShading, ARB, "<API key>"), // OES_sample_shading GLFUNC_SUFFIX(glMinSampleShading, OES, "<API key> !VERSION_GLES_3_2"), GLFUNC_REQUIRES(glMinSampleShading, "VERSION_GLES_3_2"), // ARB_debug_output GLFUNC_REQUIRES(<API key>, "GL_ARB_debug_output"), GLFUNC_REQUIRES(<API key>, "GL_ARB_debug_output"), GLFUNC_REQUIRES(<API key>, "GL_ARB_debug_output"), GLFUNC_REQUIRES(<API key>, "GL_ARB_debug_output"), // KHR_debug GLFUNC_SUFFIX(<API key>, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(<API key>, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(<API key>, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(<API key>, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glGetObjectLabel, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glGetObjectPtrLabel, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glObjectLabel, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glObjectPtrLabel, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glPopDebugGroup, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glPushDebugGroup, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_REQUIRES(<API key>, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(<API key>, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(<API key>, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(<API key>, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glGetObjectLabel, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glGetObjectPtrLabel, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glObjectLabel, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glObjectPtrLabel, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glPopDebugGroup, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glPushDebugGroup, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), // ARB_buffer_storage GLFUNC_REQUIRES(glBufferStorage, "<API key> !VERSION_4_4"), GLFUNC_SUFFIX(<API key>, EXT, "<API key> <API key> !VERSION_4_5"), // EXT_buffer_storage GLFUNC_SUFFIX(glBufferStorage, EXT, "<API key> !<API key> !VERSION_4_4"), // EXT_geometry_shader GLFUNC_SUFFIX(<API key>, EXT, "<API key> !VERSION_3_2"), // <API key> GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(<API key>, "<API key>"), GLFUNC_REQUIRES(<API key>, "<API key>"), // ARB_clip_control GLFUNC_REQUIRES(glClipControl, "GL_ARB_clip_control !VERSION_4_5"), // ARB_copy_image GLFUNC_REQUIRES(glCopyImageSubData, "GL_ARB_copy_image !VERSION_4_3 |VERSION_GLES_3_2"), // NV_copy_image GLFUNC_SUFFIX(glCopyImageSubData, NV, "GL_NV_copy_image !GL_ARB_copy_image !VERSION_GLES_3_2"), // OES_copy_image GLFUNC_SUFFIX(glCopyImageSubData, OES, "GL_OES_copy_image !VERSION_GLES_3_2"), // EXT_copy_image GLFUNC_SUFFIX(glCopyImageSubData, EXT, "GL_EXT_copy_image !GL_OES_copy_image !VERSION_GLES_3_2"), // EXT_texture_buffer GLFUNC_SUFFIX(glTexBuffer, OES, "<API key> !VERSION_GLES_3_2"), // EXT_texture_buffer GLFUNC_SUFFIX(glTexBuffer, EXT, "<API key> !<API key> !VERSION_GLES_3_2"), // <API key> GLFUNC_SUFFIX(<API key>, EXT, "<API key>"), GLFUNC_SUFFIX(glGetFragDataIndex, EXT, "<API key>"), // <API key> GLFUNC_REQUIRES(<API key>, "<API key> !VERSION_4_3"), }; namespace GLExtensions { // Private members and functions static bool _isES; static u32 _GLVersion; static std::unordered_map<std::string, bool> m_extension_list; // Private initialization functions bool <API key>(); // Initializes the extension list the old way static void InitExtensionList21() { const char* extensions = (const char*)glGetString(GL_EXTENSIONS); std::string tmp(extensions); std::istringstream buffer(tmp); while (buffer >> tmp) m_extension_list[tmp] = true; } static void InitExtensionList() { m_extension_list.clear(); if (_isES) { switch (_GLVersion) { default: case 320: m_extension_list["VERSION_GLES_3_2"] = true; case 310: m_extension_list["VERSION_GLES_3_1"] = true; case 300: m_extension_list["VERSION_GLES_3"] = true; break; } // We always have ES 2.0 m_extension_list["VERSION_GLES_2"] = true; } else { // Some OpenGL implementations chose to not expose core extensions as extensions // Let's add them to the list manually depending on which version of OpenGL we have // We need to be slightly careful here // When an extension got merged in to core, the naming may have changed // This has intentional fall through switch (_GLVersion) { default: case 450: { std::string gl450exts[] = { "<API key>", "GL_ARB_clip_control", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "GL_ARB_robustness", "<API key>", "<API key>", "VERSION_4_5", }; for (auto it : gl450exts) m_extension_list[it] = true; } case 440: { std::string gl440exts[] = { "<API key>", "<API key>", "<API key>", "GL_ARB_multi_bind", "<API key>", "<API key>", "<API key>", "<API key>", "VERSION_4_4", }; for (auto it : gl440exts) m_extension_list[it] = true; } case 430: { std::string gl430exts[] = { "<API key>", "<API key>", "<API key>", "<API key>", "GL_ARB_copy_image", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "GL_ARB_texture_view", "<API key>", "VERSION_4_3", }; for (auto it : gl430exts) m_extension_list[it] = true; } case 420: { std::string gl420exts[] = { "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "VERSION_4_2", }; for (auto it : gl420exts) m_extension_list[it] = true; } case 410: { std::string gl410exts[] = { "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "VERSION_4_1", }; for (auto it : gl410exts) m_extension_list[it] = true; } case 400: { std::string gl400exts[] = { "<API key>", "GL_ARB_gpu_shader5", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "VERSION_4_0", }; for (auto it : gl400exts) m_extension_list[it] = true; } case 330: { std::string gl330exts[] = { "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "GL_ARB_timer_query", "<API key>", "<API key>", "<API key>", "VERSION_3_3", }; for (auto it : gl330exts) m_extension_list[it] = true; } case 320: { std::string gl320exts[] = { "<API key>", "GL_ARB_sync", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "<API key>", "GL_ARB_depth_clamp", "VERSION_3_2", }; for (auto it : gl320exts) m_extension_list[it] = true; } case 310: { // Can't add <API key> since function name changed std::string gl310exts[] = { "<API key>", "GL_ARB_copy_buffer", "<API key>", "<API key>", "<API key>", //"<API key>", "VERSION_3_1", }; for (auto it : gl310exts) m_extension_list[it] = true; } case 300: { // Quite a lot of these had their names changed when merged in to core // Disable the ones that have std::string gl300exts[] = { "<API key>", //"GL_EXT_gpu_shader4", //"<API key>", "<API key>", //"<API key>", "<API key>", //"GL_EXT_packed_float", //"<API key>", "<API key>", //"GL_NV_half_float", "<API key>", //"<API key>", "<API key>", //"<API key>", //"<API key>", //"<API key>", //"<API key>", //"<API key>", //"<API key>", "<API key>", //"<API key>", "VERSION_3_0", }; for (auto it : gl300exts) m_extension_list[it] = true; } case 210: case 200: case 150: case 140: case 130: case 121: case 120: case 110: case 100: break; } // So we can easily determine if we are running dekstop GL m_extension_list["VERSION_GL"] = true; } if (_GLVersion < 300) { InitExtensionList21(); return; } GLint NumExtension = 0; glGetIntegerv(GL_NUM_EXTENSIONS, &NumExtension); for (GLint i = 0; i < NumExtension; ++i) m_extension_list[std::string((const char*)glGetStringi(GL_EXTENSIONS, i))] = true; } static void InitVersion() { GLint major, minor; glGetIntegerv(GL_MAJOR_VERSION, &major); glGetIntegerv(GL_MINOR_VERSION, &minor); if (glGetError() == GL_NO_ERROR) _GLVersion = major * 100 + minor * 10; else _GLVersion = 210; } static void* GetFuncAddress(const std::string& name, void **func) { *func = GLInterface->GetFuncAddress(name); if (*func == nullptr) { #if defined(__linux__) || defined(__APPLE__) // Give it a second try with dlsym *func = dlsym(RTLD_NEXT, name.c_str()); #endif if (*func == nullptr) ERROR_LOG(VIDEO, "Couldn't load function %s", name.c_str()); } return *func; } // Public members u32 Version() { return _GLVersion; } bool Supports(const std::string& name) { return m_extension_list[name]; } bool Init() { _isES = GLInterface->GetMode() != GLInterfaceMode::MODE_OPENGL; // Grab a few functions for initial checking // We need them to grab the extension list // Also to check if there is an error grabbing the version if (GetFuncAddress("glGetIntegerv", (void**)&glGetIntegerv) == nullptr) return false; if (GetFuncAddress("glGetString", (void**)&glGetString) == nullptr) return false; if (GetFuncAddress("glGetError", (void**)&glGetError) == nullptr) return false; InitVersion(); // We need to use glGetStringi to get the extension list // if we are using GLES3 or a GL version greater than 2.1 if (_GLVersion > 210 && GetFuncAddress("glGetStringi", (void**)&glGetStringi) == nullptr) return false; InitExtensionList(); return <API key>(); } // Private initialization functions static bool HasFeatures(const std::string& extensions) { bool result = true; std::string tmp; std::istringstream buffer(extensions); while (buffer >> tmp) { if (tmp[0] == '!') result &= !m_extension_list[tmp.erase(0, 1)]; else if (tmp[0] == '|') result |= m_extension_list[tmp.erase(0, 1)]; else result &= m_extension_list[tmp]; } return result; } bool <API key>() { bool result = true; for (const auto &it : gl_function_array) if (HasFeatures(it.requirements)) result &= !!GetFuncAddress(it.function_name, it.function_ptr); return result; } }
#include "lab/lab.h" #include "lab/anim.h" #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/intro.h" #include "lab/music.h" #include "lab/resource.h" #include "lab/utils.h" namespace Lab { Intro::Intro(LabEngine *vm) : _vm(vm) { _quitIntro = false; _introDoBlack = false; _font = _vm->_resource->getFont("F:Map.fon"); } Intro::~Intro() { _vm->_graphics->freeFont(&_font); } void Intro::introEatMessages() { while (1) { IntuiMessage *msg = _vm->_event->getMsg(); if (_vm->shouldQuit()) { _quitIntro = true; return; } if (!msg) return; if ((msg->_msgClass == kMessageRightClick) || ((msg->_msgClass == kMessageRawKey) && (msg->_code == Common::KEYCODE_ESCAPE))) _quitIntro = true; } } void Intro::doPictText(const Common::String filename, bool isScreen) { Common::String path = Common::String("Lab:rooms/Intro/") + filename; uint timeDelay = (isScreen) ? 35 : 7; _vm->updateEvents(); if (_quitIntro) return; uint32 lastMillis = 0; bool drawNextText = true; bool doneFl = false; bool begin = true; Common::File *textFile = _vm->_resource->openDataFile(path); char *textBuffer = new char[textFile->size()]; textFile->read(textBuffer, textFile->size()); delete textFile; const char *curText = textBuffer; while (1) { if (drawNextText) { if (begin) begin = false; else if (isScreen) _vm->_graphics->fade(false); if (isScreen) { _vm->_graphics->rectFillScaled(10, 10, 310, 190, 7); curText += _vm->_graphics->flowText(_font, _vm->_isHiRes ? 0 : -1, 5, 7, false, false, true, true, _vm->_utils->vgaRectScale(14, 11, 306, 189), curText); _vm->_graphics->fade(true); } else curText += _vm->_graphics->longDrawMessage(Common::String(curText), false); doneFl = (*curText == 0); drawNextText = false; introEatMessages(); if (_quitIntro) { if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } lastMillis = _vm->_system->getMillis(); } IntuiMessage *msg = _vm->_event->getMsg(); if (_vm->shouldQuit()) { _quitIntro = true; return; } if (!msg) { _vm->updateEvents(); _vm->_anim->diffNextFrame(); uint32 elapsedSeconds = (_vm->_system->getMillis() - lastMillis) / 1000; if (elapsedSeconds > timeDelay) { if (doneFl) { if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } else { drawNextText = true; } } _vm->waitTOF(); } else { uint32 msgClass = msg->_msgClass; uint16 code = msg->_code; if ((msgClass == kMessageRightClick) || ((msgClass == kMessageRawKey) && (code == Common::KEYCODE_ESCAPE))) { _quitIntro = true; if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } else if ((msgClass == kMessageLeftClick) || (msgClass == kMessageRightClick)) { if (msgClass == kMessageLeftClick) { if (doneFl) { if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } else drawNextText = true; } introEatMessages(); if (_quitIntro) { if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } } if (doneFl) { if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } else drawNextText = true; } } // while(1) } void Intro::musicDelay() { _vm->updateEvents(); if (_quitIntro) return; for (int i = 0; i < 20; i++) { _vm->updateEvents(); _vm->waitTOF(); _vm->waitTOF(); _vm->waitTOF(); } } void Intro::nReadPict(const Common::String filename, bool playOnce) { Common::String finalFileName = Common::String("P:Intro/") + filename; _vm->updateEvents(); introEatMessages(); if (_quitIntro) return; _vm->_anim->_doBlack = _introDoBlack; _vm->_anim->stopDiffEnd(); _vm->_graphics->readPict(finalFileName, playOnce); } void Intro::play() { uint16 palette[16] = { 0x0000, 0x0855, 0x0FF9, 0x0EE7, 0x0ED5, 0x0DB4, 0x0CA2, 0x0C91, 0x0B80, 0x0B80, 0x0B91, 0x0CA2, 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 }; _vm->_anim->_doBlack = true; if (_vm->getPlatform() == Common::kPlatformDOS) { nReadPict("EA0"); nReadPict("EA1"); nReadPict("EA2"); nReadPict("EA3"); } else if (_vm->getPlatform() == Common::kPlatformWindows) { nReadPict("WYRMKEEP"); // Wait 4 seconds (400 x 10ms) for (int i = 0; i < 400; i++) { introEatMessages(); if (_quitIntro) break; _vm->_system->delayMillis(10); } } _vm->_graphics->blackAllScreen(); if (_vm->getPlatform() != Common::kPlatformAmiga) _vm->_music->changeMusic("Music:BackGrou", false, false); else _vm->_music->changeMusic("Music:BackGround", false, false); _vm->_anim->_noPalChange = true; if (_vm->getPlatform() == Common::kPlatformDOS) nReadPict("TNDcycle.pic"); else nReadPict("TNDcycle2.pic"); _vm->_anim->_noPalChange = false; _vm->_graphics->_fadePalette = palette; for (int i = 0; i < 16; i++) { palette[i] = ((_vm->_anim->_diffPalette[i * 3] >> 2) << 8) + ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + (_vm->_anim->_diffPalette[i * 3 + 2] >> 2); } _vm->updateEvents(); if (!_quitIntro) _vm->_graphics->fade(true); for (int times = 0; times < 150; times++) { introEatMessages(); if (_quitIntro) break; _vm->updateEvents(); uint16 temp = palette[2]; for (int i = 2; i < 15; i++) palette[i] = palette[i + 1]; palette[15] = temp; _vm->_graphics->setAmigaPal(palette); _vm->waitTOF(); } if (!_quitIntro) { _vm->_graphics->fade(false); _vm->_graphics->blackAllScreen(); _vm->updateEvents(); } nReadPict("Title.A"); nReadPict("AB"); musicDelay(); nReadPict("BA"); nReadPict("AC"); musicDelay(); if (_vm->getPlatform() == Common::kPlatformWindows) musicDelay(); // more credits on this page now nReadPict("CA"); nReadPict("AD"); musicDelay(); if (_vm->getPlatform() == Common::kPlatformWindows) musicDelay(); // more credits on this page now nReadPict("DA"); musicDelay(); _vm->updateEvents(); _vm->_graphics->blackAllScreen(); _vm->updateEvents(); _vm->_anim->_noPalChange = true; nReadPict("Intro.1"); _vm->_anim->_noPalChange = false; for (int i = 0; i < 16; i++) { palette[i] = ((_vm->_anim->_diffPalette[i * 3] >> 2) << 8) + ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + (_vm->_anim->_diffPalette[i * 3 + 2] >> 2); } doPictText("i.1", true); if (_vm->getPlatform() == Common::kPlatformWindows) { doPictText("i.2A", true); doPictText("i.2B", true); } _vm->_graphics->blackAllScreen(); _vm->updateEvents(); _introDoBlack = true; nReadPict("Station1"); doPictText("i.3"); nReadPict("Station2"); doPictText("i.4"); nReadPict("Stiles4"); doPictText("i.5"); nReadPict("Stiles3"); doPictText("i.6"); if (_vm->getPlatform() == Common::kPlatformWindows) nReadPict("Platform2"); else nReadPict("Platform"); doPictText("i.7"); nReadPict("Subway.1"); doPictText("i.8"); nReadPict("Subway.2"); doPictText("i.9"); doPictText("i.10"); doPictText("i.11"); if (!_quitIntro) for (int i = 0; i < 50; i++) { for (int idx = (8 * 3); idx < (255 * 3); idx++) _vm->_anim->_diffPalette[idx] = 255 - _vm->_anim->_diffPalette[idx]; _vm->updateEvents(); _vm->waitTOF(); _vm->_graphics->setPalette(_vm->_anim->_diffPalette, 256); _vm->waitTOF(); _vm->waitTOF(); } doPictText("i.12"); doPictText("i.13"); _introDoBlack = false; nReadPict("Daed0"); doPictText("i.14"); nReadPict("Daed1"); doPictText("i.15"); nReadPict("Daed2"); doPictText("i.16"); doPictText("i.17"); doPictText("i.18"); nReadPict("Daed3"); doPictText("i.19"); doPictText("i.20"); nReadPict("Daed4"); doPictText("i.21"); nReadPict("Daed5"); doPictText("i.22"); doPictText("i.23"); doPictText("i.24"); nReadPict("Daed6"); doPictText("i.25"); doPictText("i.26"); nReadPict("Daed7", false); doPictText("i.27"); doPictText("i.28"); _vm->_anim->stopDiffEnd(); nReadPict("Daed8"); doPictText("i.29"); doPictText("i.30"); nReadPict("Daed9"); doPictText("i.31"); doPictText("i.32"); doPictText("i.33"); nReadPict("Daed9a"); nReadPict("Daed10"); doPictText("i.34"); doPictText("i.35"); doPictText("i.36"); nReadPict("SubX"); if (_quitIntro) { _vm->_graphics->rectFill(0, 0, _vm->_graphics->_screenWidth - 1, _vm->_graphics->_screenHeight - 1, 0); _vm->_anim->_doBlack = true; } } } // End of namespace Lab
#ifndef __FTPCONN_H__ #define __FTPCONN_H__ #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/stat.h> #define __need_error_t #include <errno.h> #ifndef __error_t_defined typedef int error_t; #define __error_t_defined #endif #ifndef FTP_CONN_EI # define FTP_CONN_EI extern inline #endif struct ftp_conn; struct ftp_conn_params; struct ftp_conn_stat; /* The type of the function called by ...get_stats to add each new stat. NAME is the file in question, STAT is stat info about it, and if NAME is a symlink, SYMLINK_TARGET is what it is linked to, or 0 if it's not a symlink. NAME and SYMLINK_TARGET should be copied if they are used outside of this function. HOOK is as passed into ...get_stats. */ typedef error_t (*<API key>) (const char *name, # if _FILE_OFFSET_BITS == 64 const struct stat *stat, # else const struct stat64 *stat, # endif const char *symlink_target, void *hook); /* Hooks that customize behavior for particular types of remote system. */ struct ftp_conn_syshooks { /* Should return in ADDR a malloced struct sockaddr containing the address of the host referenced by the PASV reply contained in TXT. */ error_t (*pasv_addr) (struct ftp_conn *conn, const char *txt, struct sockaddr **addr); /* Look at the error string in TXT, and try to guess an error code to return. If POSS_ERRS is non-zero, it contains a list of errors that are likely to occur with the previous command, terminated with 0. If no match is found and POSS_ERRS is non-zero, the first error in POSS_ERRS should be returned by default. */ error_t (*interp_err) (struct ftp_conn *conn, const char *txt, const error_t *poss_errs); /* Start an operation to get a list of file-stat structures for NAME (this is often similar to ftp_conn_start_dir, but with OS-specific flags), and return a file-descriptor for reading on, and a state structure in STATE suitable for passing to cont_get_stats. If CONTENTS is true, NAME must refer to a directory, and the contents will be returned, otherwise, the (single) result will refer to NAME. */ error_t (*start_get_stats) (struct ftp_conn *conn, const char *name, int contents, int *fd, void **state); /* Read stats information from FD, calling ADD_STAT for each new stat (HOOK is passed to ADD_STAT). FD and STATE should be returned from start_get_stats. If this function returns EAGAIN, then it should be called again to finish the job (possibly after calling select on FD); if it returns 0, then it is finishe,d and FD and STATE are deallocated. */ error_t (*cont_get_stats) (struct ftp_conn *conn, int fd, void *state, <API key> add_stat, void *hook); /* Give a name which refers to a directory file, and a name in that directory, this should return in COMPOSITE the composite name refering to that name in that directory, in malloced storage. */ error_t (*append_name) (struct ftp_conn *conn, const char *dir, const char *name, char **composite); /* If the name of a file *NAME is a composite name (containing both a filename and a directory name), this function should change *NAME to be the name component only; if the result is shorter than the original *NAME, the storage pointed to it may be modified, otherwise, *NAME should be changed to point to malloced storage holding the result, which will be freed by the caller. */ error_t (*basename) (struct ftp_conn *conn, char **name); }; /* Type parameter for the cntl_debug hook. */ #define <API key> 1 #define <API key> 2 /* Type parameter for the get_login_param hook. */ #define <API key> 1 #define <API key> 2 #define <API key> 3 /* General connection customization. */ struct ftp_conn_hooks { /* If non-zero, should look at the SYST reply in SYST, and fill in CONN's syshooks (with ftp_conn_set_hooks) appropriately; SYST may be zero if the remote system doesn't support that command. If zero, then the default <API key> is used. */ void (*choose_syshooks) (struct ftp_conn *conn, const char *syst); /* If non-zero, called during io on the ftp control connection -- TYPE is <API key> for commands, and <API key> for replies; TXT is the actual text. */ void (*cntl_debug) (struct ftp_conn *conn, int type, const char *txt); /* Called after CONN's connection the server has been opened (or reopened). */ void (*opened) (struct ftp_conn *conn); /* If the remote system requires some login parameter that isn't available, this hook is called to try and get it, returning a value in TXT. The return value should be in a malloced block of memory. The returned value will only be used once; if it's desired that it should `stick', the user may modify the value stored in CONN's params field, but that is an issue outside of the scope of this interface -- params are only read, never written. */ error_t (*get_login_param) (struct ftp_conn *conn, int type, char **txt); /* Called after CONN's connection the server has closed for some reason. */ void (*closed) (struct ftp_conn *conn); /* Called when CONN is initially created before any other hook calls. An error return causes the creation to fail with that error code. */ error_t (*init) (struct ftp_conn *conn); /* Called when CONN is about to be destroyed. No hook calls are ever made after this one. */ void (*fini) (struct ftp_conn *conn); /* This hook should return true if the current thread has been interrupted in some way, and EINTR (or a short count in some cases) should be returned from a blocking function. */ int (*interrupt_check) (struct ftp_conn *conn); }; /* A single ftp connection. */ struct ftp_conn { const struct ftp_conn_params *params; /* machine, user, &c */ const struct ftp_conn_hooks *hooks; /* Customization hooks. */ struct ftp_conn_syshooks syshooks; /* host-dependent hook functions */ int syshooks_valid : 1; /* True if the system type has been determined. */ int control; /* fd for ftp control connection */ char *line; /* buffer for reading control replies */ size_t line_sz; /* allocated size of LINE */ size_t line_offs; /* Start of unread input in LINE. */ size_t line_len; /* End of the contents in LINE. */ char *reply_txt; /* A buffer for the text of entire replies */ size_t reply_txt_sz; /* size of it */ char *cwd; /* Last know CWD, or 0 if unknown. */ const char *type; /* Connection type, or 0 if default. */ void *hook; /* Random user data. */ int use_passive : 1; /* If true, first try passive data conns. */ struct sockaddr *actv_data_addr;/* Address of port for active data conns. */ }; /* Parameters for an ftp connection; doesn't include any actual connection state. */ struct ftp_conn_params { void *addr; /* Address. */ size_t addr_len; /* Length in bytes of ADDR. */ int addr_type; /* Type of ADDR (AF_*). */ char *user, *pass, *acct; /* Parameters for logging into ftp. */ }; /* Unix hooks */ extern error_t <API key> (struct ftp_conn *conn, const char *txt, struct sockaddr **addr); extern error_t <API key> (struct ftp_conn *conn, const char *txt, const error_t *poss_errs); extern error_t <API key> (struct ftp_conn *conn, const char *name, int contents, int *fd, void **state); extern error_t <API key> (struct ftp_conn *conn, int fd, void *state, <API key> add_stat, void *hook); error_t <API key> (struct ftp_conn *conn, const char *dir, const char *name, char **composite); error_t <API key> (struct ftp_conn *conn, char **name); extern struct ftp_conn_syshooks <API key>; error_t <API key> (struct ftp_conn *conn, int *reply, const char **reply_txt); error_t ftp_conn_get_reply (struct ftp_conn *conn, int *reply, const char **reply_txt); error_t ftp_conn_cmd (struct ftp_conn *conn, const char *cmd, const char *arg, int *reply, const char **reply_txt); error_t ftp_conn_cmd_reopen (struct ftp_conn *conn, const char *cmd, const char *arg, int *reply, const char **reply_txt); void ftp_conn_abort (struct ftp_conn *conn); /* Sets CONN's syshooks to a copy of SYSHOOKS. */ void <API key> (struct ftp_conn *conn, struct ftp_conn_syshooks *syshooks); error_t ftp_conn_open (struct ftp_conn *conn); void ftp_conn_close (struct ftp_conn *conn); /* Makes sure that CONN's syshooks are set according to the remote system type. */ FTP_CONN_EI error_t <API key> (struct ftp_conn *conn) { if (conn->syshooks_valid) return 0; else /* Opening the connection should set the syshooks. */ return ftp_conn_open (conn); } /* Create a new ftp connection as specified by PARAMS, and return it in CONN; HOOKS contains customization hooks used by the connection. Neither PARAMS nor HOOKS is copied, so a copy of it should be made if necessary before calling this function; if it should be freed later, a FINI hook may be used to do so. */ error_t ftp_conn_create (const struct ftp_conn_params *params, const struct ftp_conn_hooks *hooks, struct ftp_conn **conn); /* Free the ftp connection CONN, closing it first, and freeing all resources it uses. */ void ftp_conn_free (struct ftp_conn *conn); /* Start a transfer command CMD (and optional args ...), returning a file descriptor in DATA. POSS_ERRS is a list of errnos to try matching against any resulting error text. */ error_t <API key> (struct ftp_conn *conn, const char *cmd, const char *arg, const error_t *poss_errs, int *data); /* Wait for the reply signalling the end of a data transfer. */ error_t <API key> (struct ftp_conn *conn); /* Start retreiving file NAME over CONN, returning a file descriptor in DATA over which the data can be read. */ error_t <API key> (struct ftp_conn *conn, const char *name, int *data); /* Start retreiving a list of files in NAME over CONN, returning a file descriptor in DATA over which the data can be read. */ error_t ftp_conn_start_list (struct ftp_conn *conn, const char *name, int *data); /* Start retreiving a directory listing of NAME over CONN, returning a file descriptor in DATA over which the data can be read. */ error_t ftp_conn_start_dir (struct ftp_conn *conn, const char *name, int *data); /* Start storing into file NAME over CONN, returning a file descriptor in DATA into which the data can be written. */ error_t <API key> (struct ftp_conn *conn, const char *name, int *data); /* Transfer the output of SRC_CMD/SRC_NAME on SRC_CONN to DST_NAME on DST_CONN, moving the data directly between servers. */ error_t <API key> (struct ftp_conn *src_conn, const char *src_cmd, const char *src_name, const int *src_poss_errs, struct ftp_conn *dst_conn, const char *dst_name); /* Copy the SRC_NAME on SRC_CONN to DST_NAME on DST_CONN, moving the data directly between servers. */ error_t ftp_conn_rmt_copy (struct ftp_conn *src_conn, const char *src_name, struct ftp_conn *dst_conn, const char *dst_name); /* Return a malloced string containing CONN's working directory in CWD. */ error_t ftp_conn_get_cwd (struct ftp_conn *conn, char **cwd); /* Return a malloced string containing CONN's working directory in CWD. */ error_t ftp_conn_cwd (struct ftp_conn *conn, const char *cwd); /* Return a malloced string containing CONN's working directory in CWD. */ error_t ftp_conn_cdup (struct ftp_conn *conn); /* Set the ftp connection type of CONN to TYPE, or return an error. */ error_t ftp_conn_set_type (struct ftp_conn *conn, const char *type); /* Start an operation to get a list of file-stat structures for NAME (this is often similar to ftp_conn_start_dir, but with OS-specific flags), and return a file-descriptor for reading on, and a state structure in STATE suitable for passing to cont_get_stats. If CONTENTS is true, NAME must refer to a directory, and the contents will be returned, otherwise, the (single) result will refer to NAME. */ error_t <API key> (struct ftp_conn *conn, const char *name, int contents, int *fd, void **state); /* Read stats information from FD, calling ADD_STAT for each new stat (HOOK is passed to ADD_STAT). FD and STATE should be returned from start_get_stats. If this function returns EAGAIN, then it should be called again to finish the job (possibly after calling select on FD); if it returns 0, then it is finishe,d and FD and STATE are deallocated. */ error_t <API key> (struct ftp_conn *conn, int fd, void *state, <API key> add_stat, void *hook); /* Get a list of file-stat structures for NAME, calling ADD_STAT for each one (HOOK is passed to ADD_STAT). If CONTENTS is true, NAME must refer to a directory, and the contents will be returned, otherwise, the (single) result will refer to NAME. This function may block. */ error_t ftp_conn_get_stats (struct ftp_conn *conn, const char *name, int contents, <API key> add_stat, void *hook); /* The type of the function called by ...get_names to add each new name. NAME is the name in question and HOOK is as passed into ...get_stats. */ typedef error_t (*<API key>) (const char *name, void *hook); /* Start an operation to get a list of filenames in the directory NAME, and return a file-descriptor for reading on, and a state structure in STATE suitable for passing to cont_get_names. */ error_t <API key> (struct ftp_conn *conn, const char *name, int *fd, void **state); /* Read filenames from FD, calling ADD_NAME for each new NAME (HOOK is passed to ADD_NAME). FD and STATE should be returned from start_get_stats. If this function returns EAGAIN, then it should be called again to finish the job (possibly after calling select on FD); if it returns 0, then it is finishe,d and FD and STATE are deallocated. */ error_t <API key> (struct ftp_conn *conn, int fd, void *state, <API key> add_name, void *hook); /* Get a list of names in the directory NAME, calling ADD_NAME for each one (HOOK is passed to ADD_NAME). This function may block. */ error_t ftp_conn_get_names (struct ftp_conn *conn, const char *name, <API key> add_name, void *hook); /* Give a name which refers to a directory file, and a name in that directory, this should return in COMPOSITE the composite name refering to that name in that directory, in malloced storage. */ error_t <API key> (struct ftp_conn *conn, const char *dir, const char *name, char **composite); /* If the name of a file COMPOSITE is a composite name (containing both a filename and a directory name), this function will return the name component only in BASE, in malloced storage, otherwise it simply returns a newly malloced copy of COMPOSITE in BASE. */ error_t ftp_conn_basename (struct ftp_conn *conn, const char *composite, char **base); #endif /* __FTPCONN_H__ */
#include <linux/moduleparam.h> #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/fs.h> #include <linux/slab.h> #include <linux/errno.h> #include <linux/hdreg.h> #include <linux/kdev_t.h> #include <linux/blkdev.h> #include <linux/mutex.h> #include <linux/scatterlist.h> #include <linux/string_helpers.h> #include <linux/delay.h> #include <linux/capability.h> #include <linux/compat.h> #include <linux/sysfs.h> #include <linux/mmc/ioctl.h> #include <linux/mmc/card.h> #include <linux/mmc/host.h> #include <linux/mmc/mmc.h> #include <linux/mmc/sd.h> #include <asm/uaccess.h> #include "queue.h" MODULE_ALIAS("mmc:block"); #if defined(CONFIG_MMC_CPRM) #include "cprmdrv_samsung.h" #include <linux/ioctl.h> #define MMC_IOCTL_BASE 0xB3 /* Same as MMC block device major number */ #define <API key> _IOR(MMC_IOCTL_BASE, 100, int) #define <API key> _IOR(MMC_IOCTL_BASE, 101, int) #define <API key> _IOR(MMC_IOCTL_BASE, 102, int) #define <API key> _IOR(MMC_IOCTL_BASE, 104, int) static int cprm_ake_retry_flag; #endif #ifdef MODULE_PARAM_PREFIX #undef MODULE_PARAM_PREFIX #endif #define MODULE_PARAM_PREFIX "mmcblk." #define <API key> 113 #define <API key> 0x00 #define <API key> 0x01 #define <API key> 0x80 #define <API key> 0x81 #define <API key> 0x88 #define MMC_BLK_TIMEOUT_MS (30 * 1000) /* 30 sec timeout */ #define <API key> 240000 /* msec */ #define mmc_req_rel_wr(req) (((req->cmd_flags & REQ_FUA) || \ (req->cmd_flags & REQ_META)) && \ (rq_data_dir(req) == WRITE)) #define PACKED_CMD_VER 0x01 #define PACKED_CMD_WR 0x02 #define <API key>(stats, reason) \ do { \ if (stats->enabled) \ stats->pack_stop_reason[reason]++; \ } while (0) static DEFINE_MUTEX(block_mutex); /* * The defaults come from config options but can be overriden by module * or bootarg options. */ static int perdev_minors = <API key>; /* * We've only got one major, so number of mmcblk devices is * limited to 256 / number of minors per device. */ static int max_devices; /* 256 minors, so at most 256 separate devices */ static DECLARE_BITMAP(dev_use, 256); static DECLARE_BITMAP(name_use, 256); /* * There is one mmc_blk_data per slot. */ struct mmc_blk_data { spinlock_t lock; struct gendisk *disk; struct mmc_queue queue; struct list_head part; unsigned int flags; #define MMC_BLK_CMD23 (1 << 0) /* Can do SET_BLOCK_COUNT for multiblock */ #define MMC_BLK_REL_WR (1 << 1) /* MMC Reliable write support */ unsigned int usage; unsigned int read_only; unsigned int part_type; unsigned int name_idx; unsigned int reset_done; #define MMC_BLK_READ BIT(0) #define MMC_BLK_WRITE BIT(1) #define MMC_BLK_DISCARD BIT(2) #define MMC_BLK_SECDISCARD BIT(3) /* * Only set in main mmc_blk_data associated * with mmc_card with mmc_set_drvdata, and keeps * track of the current selected device partition. */ unsigned int part_curr; struct device_attribute force_ro; struct device_attribute power_ro_lock; struct device_attribute <API key>; struct device_attribute <API key>; int area_type; }; static DEFINE_MUTEX(open_lock); enum { MMC_PACKED_N_IDX = -1, MMC_PACKED_N_ZERO, MMC_PACKED_N_SINGLE, }; module_param(perdev_minors, int, 0444); MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device"); static inline void <API key>(struct mmc_queue_req *mqrq) { mqrq->packed_cmd = MMC_PACKED_NONE; mqrq->packed_num = MMC_PACKED_N_ZERO; } static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) { struct mmc_blk_data *md; mutex_lock(&open_lock); md = disk->private_data; if (md && md->usage == 0) md = NULL; if (md) md->usage++; mutex_unlock(&open_lock); return md; } static inline int mmc_get_devidx(struct gendisk *disk) { int devidx = disk->first_minor / perdev_minors; return devidx; } static void mmc_blk_put(struct mmc_blk_data *md) { mutex_lock(&open_lock); md->usage if (md->usage == 0) { int devidx = mmc_get_devidx(md->disk); blk_cleanup_queue(md->queue.queue); __clear_bit(devidx, dev_use); put_disk(md->disk); kfree(md); } mutex_unlock(&open_lock); } static ssize_t power_ro_lock_show(struct device *dev, struct device_attribute *attr, char *buf) { int ret; struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); struct mmc_card *card = md->queue.card; int locked = 0; if (card->ext_csd.boot_ro_lock & <API key>) locked = 2; else if (card->ext_csd.boot_ro_lock & <API key>) locked = 1; ret = snprintf(buf, PAGE_SIZE, "%d\n", locked); return ret; } static ssize_t power_ro_lock_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int ret; struct mmc_blk_data *md, *part_md; struct mmc_card *card; unsigned long set; if (kstrtoul(buf, 0, &set)) return -EINVAL; if (set != 1) return count; md = mmc_blk_get(dev_to_disk(dev)); card = md->queue.card; mmc_claim_host(card->host); ret = mmc_switch(card, <API key>, EXT_CSD_BOOT_WP, card->ext_csd.boot_ro_lock | <API key>, card->ext_csd.part_time); if (ret) pr_err("%s: Locking boot partition ro until next power on failed: %d\n", md->disk->disk_name, ret); else card->ext_csd.boot_ro_lock |= <API key>; mmc_release_host(card->host); if (!ret) { pr_info("%s: Locking boot partition ro until next power on\n", md->disk->disk_name); set_disk_ro(md->disk, 1); list_for_each_entry(part_md, &md->part, part) if (part_md->area_type == <API key>) { pr_info("%s: Locking boot partition ro until next power on\n", part_md->disk->disk_name); set_disk_ro(part_md->disk, 1); } } mmc_blk_put(md); return count; } static ssize_t force_ro_show(struct device *dev, struct device_attribute *attr, char *buf) { int ret; struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); ret = snprintf(buf, PAGE_SIZE, "%d", get_disk_ro(dev_to_disk(dev)) ^ md->read_only); mmc_blk_put(md); return ret; } static ssize_t force_ro_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int ret; char *end; struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); unsigned long set = simple_strtoul(buf, &end, 0); if (end == buf) { ret = -EINVAL; goto out; } set_disk_ro(dev_to_disk(dev), set || md->read_only); ret = count; out: mmc_blk_put(md); return ret; } static ssize_t <API key>(struct device *dev, struct device_attribute *attr, char *buf) { struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); int <API key>; int ret; <API key> = md->queue.<API key>; ret = snprintf(buf, PAGE_SIZE, "%d\n", <API key>); mmc_blk_put(md); return ret; } static ssize_t <API key>(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int value; struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); sscanf(buf, "%d", &value); if (value >= 0) md->queue.<API key> = value; mmc_blk_put(md); return count; } static ssize_t <API key>(struct device *dev, struct device_attribute *attr, char *buf) { struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); struct mmc_card *card = md->queue.card; int ret; if (!card) ret = -EINVAL; else ret = snprintf(buf, PAGE_SIZE, "%d\n", card->bkops_info.<API key>); mmc_blk_put(md); return ret; } static ssize_t <API key>(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int value; struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); struct mmc_card *card = md->queue.card; unsigned int card_size; int ret = count; if (!card) { ret = -EINVAL; goto exit; } sscanf(buf, "%d", &value); if ((value <= 0) || (value >= 100)) { ret = -EINVAL; goto exit; } card_size = (unsigned int)get_capacity(md->disk); if (card_size <= 0) { ret = -EINVAL; goto exit; } card->bkops_info.<API key> = value; card->bkops_info.<API key> = (card_size * value) / 100; pr_debug("%s: size_percentage = %d, min_sectors = %d", mmc_hostname(card->host), card->bkops_info.<API key>, card->bkops_info.<API key>); exit: mmc_blk_put(md); return count; } static int mmc_blk_open(struct block_device *bdev, fmode_t mode) { struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk); int ret = -ENXIO; mutex_lock(&block_mutex); if (md) { if (md->usage == 2) check_disk_change(bdev); ret = 0; if ((mode & FMODE_WRITE) && md->read_only) { mmc_blk_put(md); ret = -EROFS; } } mutex_unlock(&block_mutex); return ret; } static int mmc_blk_release(struct gendisk *disk, fmode_t mode) { struct mmc_blk_data *md = disk->private_data; mutex_lock(&block_mutex); mmc_blk_put(md); mutex_unlock(&block_mutex); return 0; } static int mmc_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo) { geo->cylinders = get_capacity(bdev->bd_disk) / (4 * 16); geo->heads = 4; geo->sectors = 16; return 0; } struct mmc_blk_ioc_data { struct mmc_ioc_cmd ic; unsigned char *buf; u64 buf_bytes; }; static struct mmc_blk_ioc_data *<API key>( struct mmc_ioc_cmd __user *user) { struct mmc_blk_ioc_data *idata; int err; idata = kzalloc(sizeof(*idata), GFP_KERNEL); if (!idata) { err = -ENOMEM; goto out; } if (copy_from_user(&idata->ic, user, sizeof(idata->ic))) { err = -EFAULT; goto idata_err; } idata->buf_bytes = (u64) idata->ic.blksz * idata->ic.blocks; if (idata->buf_bytes > MMC_IOC_MAX_BYTES) { err = -EOVERFLOW; goto idata_err; } if (!idata->buf_bytes) return idata; idata->buf = kzalloc(idata->buf_bytes, GFP_KERNEL); if (!idata->buf) { err = -ENOMEM; goto idata_err; } if (copy_from_user(idata->buf, (void __user *)(unsigned long) idata->ic.data_ptr, idata->buf_bytes)) { err = -EFAULT; goto copy_err; } return idata; copy_err: kfree(idata->buf); idata_err: kfree(idata); out: return ERR_PTR(err); } struct scatterlist *mmc_blk_get_sg(struct mmc_card *card, unsigned char *buf, int *sg_len, int size) { struct scatterlist *sg; struct scatterlist *sl; int total_sec_cnt, sec_cnt; int max_seg_size, len; total_sec_cnt = size; max_seg_size = card->host->max_seg_size; len = (size - 1 + max_seg_size) / max_seg_size; sl = kmalloc(sizeof(struct scatterlist) * len, GFP_KERNEL); if (!sl) { return NULL; } sg = (struct scatterlist *)sl; sg_init_table(sg, len); while (total_sec_cnt) { if (total_sec_cnt < max_seg_size) sec_cnt = total_sec_cnt; else sec_cnt = max_seg_size; sg_set_page(sg, virt_to_page(buf), sec_cnt, offset_in_page(buf)); buf = buf + sec_cnt; total_sec_cnt = total_sec_cnt - sec_cnt; if (total_sec_cnt == 0) break; sg = sg_next(sg); } if (sg) sg_mark_end(sg); *sg_len = len; return sl; } static int mmc_blk_ioctl_cmd(struct block_device *bdev, struct mmc_ioc_cmd __user *ic_ptr) { struct mmc_blk_ioc_data *idata; struct mmc_blk_data *md; struct mmc_card *card; struct mmc_command cmd = {0}; struct mmc_data data = {0}; struct mmc_request mrq = {NULL}; struct scatterlist *sg = 0; int err=0; /* * The caller must have CAP_SYS_RAWIO, and must be calling this on the * whole block device, not on a partition. This prevents overspray * between sibling partitions. */ if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains)) return -EPERM; idata = <API key>(ic_ptr); if (IS_ERR(idata)) return PTR_ERR(idata); md = mmc_blk_get(bdev->bd_disk); if (!md) { err = -EINVAL; goto cmd_done; } card = md->queue.card; if (IS_ERR(card)) { err = PTR_ERR(card); goto cmd_done; } cmd.opcode = idata->ic.opcode; cmd.arg = idata->ic.arg; cmd.flags = idata->ic.flags; if (idata->buf_bytes) { int len; data.blksz = idata->ic.blksz; data.blocks = idata->ic.blocks; sg = mmc_blk_get_sg(card, idata->buf, &len, idata->buf_bytes); data.sg = sg; data.sg_len = len; if (idata->ic.write_flag) data.flags = MMC_DATA_WRITE; else data.flags = MMC_DATA_READ; /* data.flags must already be set before doing this. */ <API key>(&data, card); /* Allow overriding the timeout_ns for empirical tuning. */ if (idata->ic.data_timeout_ns) data.timeout_ns = idata->ic.data_timeout_ns; if ((cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) { /* * Pretend this is a data transfer and rely on the * host driver to compute timeout. When all host * drivers support cmd.cmd_timeout for R1B, this * can be changed to: * * mrq.data = NULL; * cmd.cmd_timeout = idata->ic.cmd_timeout_ms; */ data.timeout_ns = idata->ic.cmd_timeout_ms * 1000000; } mrq.data = &data; } mrq.cmd = &cmd; mmc_claim_host(card->host); if (idata->ic.is_acmd) { err = mmc_app_cmd(card->host, card); if (err) goto cmd_rel_host; } mmc_wait_for_req(card->host, &mrq); if (cmd.error) { dev_err(mmc_dev(card->host), "%s: cmd error %d\n", __func__, cmd.error); err = cmd.error; goto cmd_rel_host; } if (data.error) { dev_err(mmc_dev(card->host), "%s: data error %d\n", __func__, data.error); err = data.error; goto cmd_rel_host; } /* * According to the SD specs, some commands require a delay after * issuing the command. */ if (idata->ic.postsleep_min_us) usleep_range(idata->ic.postsleep_min_us, idata->ic.postsleep_max_us); if (copy_to_user(&(ic_ptr->response), cmd.resp, sizeof(cmd.resp))) { err = -EFAULT; goto cmd_rel_host; } if (!idata->ic.write_flag) { if (copy_to_user((void __user *)(unsigned long) idata->ic.data_ptr, idata->buf, idata->buf_bytes)) { err = -EFAULT; goto cmd_rel_host; } } cmd_rel_host: mmc_release_host(card->host); cmd_done: mmc_blk_put(md); if (sg) kfree(sg); kfree(idata->buf); kfree(idata); return err; } static int mmc_blk_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { #if defined(CONFIG_MMC_CPRM) struct mmc_blk_data *md = bdev->bd_disk->private_data; struct mmc_card *card = md->queue.card; static int i; static unsigned long temp_arg[16] = {0}; #endif int ret = -EINVAL; if (cmd == MMC_IOC_CMD) ret = mmc_blk_ioctl_cmd(bdev, (struct mmc_ioc_cmd __user *)arg); #if defined(CONFIG_MMC_CPRM) printk(KERN_DEBUG " %s ], %x ", __func__, cmd); switch (cmd) { case <API key>: cprm_ake_retry_flag = 1; ret = 0; break; case <API key>: { int size = 0; size = (int)get_capacity(md->disk) << 9; printk(KERN_DEBUG "[%s]:<API key> size = %d\n", __func__, size); return copy_to_user((void *)arg, &size, sizeof(u64)); } break; case ACMD13: case ACMD18: case ACMD25: case ACMD43: case ACMD44: case ACMD45: case ACMD46: case ACMD47: case ACMD48: { struct cprm_request *req = (struct cprm_request *)arg; printk(KERN_DEBUG "%s:cmd [%x]\n", __func__, cmd); if (cmd == ACMD43) { printk(KERN_DEBUG"storing acmd43 arg[%d] = %ul\n", i, (unsigned int)req->arg); temp_arg[i] = req->arg; i++; if (i >= 16) { printk(KERN_DEBUG"reset acmd43 i = %d\n", i); i = 0; } } if (cmd == ACMD45 && cprm_ake_retry_flag == 1) { cprm_ake_retry_flag = 0; printk(KERN_DEBUG"ACMD45.. I'll call ACMD43 and ACMD44 first\n"); for (i = 0; i < 16; i++) { printk(KERN_DEBUG"calling ACMD43 with arg[%d] = %ul\n", i, (unsigned int)temp_arg[i]); if (stub_sendcmd(card, ACMD43, temp_arg[i], 512, NULL) < 0) { printk(KERN_DEBUG"error ACMD43 %d\n", i); return -EINVAL; } } printk(KERN_DEBUG"calling ACMD44\n"); if (stub_sendcmd(card, ACMD44, 0, 8, NULL) < 0) { printk(KERN_DEBUG"error in ACMD44 %d\n", i); return -EINVAL; } } return stub_sendcmd(card, req->cmd, req->arg, req->len, req->buff); } break; default: printk(KERN_DEBUG"%s: Invalid ioctl command\n", __func__); break; } #endif return ret; } #ifdef CONFIG_COMPAT static int <API key>(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { return mmc_blk_ioctl(bdev, mode, cmd, (unsigned long) compat_ptr(arg)); } #endif static const struct <API key> mmc_bdops = { .open = mmc_blk_open, .release = mmc_blk_release, .getgeo = mmc_blk_getgeo, .owner = THIS_MODULE, .ioctl = mmc_blk_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = <API key>, #endif }; static inline int mmc_blk_part_switch(struct mmc_card *card, struct mmc_blk_data *md) { int ret; struct mmc_blk_data *main_md = mmc_get_drvdata(card); if (main_md->part_curr == md->part_type) return 0; if (mmc_card_mmc(card)) { u8 part_config = card->ext_csd.part_config; part_config &= ~<API key>; part_config |= md->part_type; ret = mmc_switch(card, <API key>, EXT_CSD_PART_CONFIG, part_config, card->ext_csd.part_time); if (ret) return ret; card->ext_csd.part_config = part_config; } main_md->part_curr = md->part_type; return 0; } static u32 <API key>(struct mmc_card *card) { int err; u32 result; __be32 *blocks; struct mmc_request mrq = {NULL}; struct mmc_command cmd = {0}; struct mmc_data data = {0}; struct scatterlist sg; cmd.opcode = MMC_APP_CMD; cmd.arg = card->rca << 16; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, 0); if (err) return (u32)-1; if (!mmc_host_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD)) return (u32)-1; memset(&cmd, 0, sizeof(struct mmc_command)); cmd.opcode = <API key>; cmd.arg = 0; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; data.blksz = 4; data.blocks = 1; data.flags = MMC_DATA_READ; data.sg = &sg; data.sg_len = 1; <API key>(&data, card); mrq.cmd = &cmd; mrq.data = &data; blocks = kmalloc(4, GFP_KERNEL); if (!blocks) return (u32)-1; sg_init_one(&sg, blocks, 4); mmc_wait_for_req(card->host, &mrq); result = ntohl(*blocks); kfree(blocks); if (cmd.error || data.error) result = (u32)-1; return result; } static int send_stop(struct mmc_card *card, u32 *status) { struct mmc_command cmd = {0}; int err; cmd.opcode = <API key>; cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, 5); if (err == 0) *status = cmd.resp[0]; return err; } static int get_card_status(struct mmc_card *card, u32 *status, int retries) { struct mmc_command cmd = {0}; int err; cmd.opcode = MMC_SEND_STATUS; if (!mmc_host_is_spi(card->host)) cmd.arg = card->rca << 16; cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, retries); if (err == 0) *status = cmd.resp[0]; return err; } #define ERR_NOMEDIUM 3 #define ERR_RETRY 2 #define ERR_ABORT 1 #define ERR_CONTINUE 0 static int mmc_blk_cmd_error(struct request *req, const char *name, int error, bool status_valid, u32 status) { switch (error) { case -EILSEQ: /* response crc error, retry the r/w cmd */ pr_err("%s: %s sending %s command, card status % req->rq_disk->disk_name, "response CRC error", name, status); return ERR_RETRY; case -ETIMEDOUT: pr_err("%s: %s sending %s command, card status % req->rq_disk->disk_name, "timed out", name, status); /* If the status cmd initially failed, retry the r/w cmd */ if (!status_valid) { pr_err("%s: status not valid, retrying timeout\n", req->rq_disk->disk_name); return ERR_RETRY; } if (status & (R1_COM_CRC_ERROR | R1_ILLEGAL_COMMAND)) { pr_err("%s: command error, retrying timeout\n", req->rq_disk->disk_name); return ERR_RETRY; } /* Otherwise abort the command */ pr_err("%s: not retrying timeout\n", req->rq_disk->disk_name); return ERR_ABORT; default: /* We don't understand the error code the driver gave us */ pr_err("%s: unknown error %d sending read/write command, card status % req->rq_disk->disk_name, error, status); return ERR_ABORT; } } static int <API key>(struct mmc_card *card, struct request *req, struct mmc_blk_request *brq, int *ecc_err, int *gen_err) { bool <API key> = true; u32 status, stop_status = 0; int err, retry; if (mmc_card_removed(card)) return ERR_NOMEDIUM; /* * Try to get card status which indicates both the card state * and why there was no response. If the first attempt fails, * we can't be sure the returned status is for the r/w command. */ for (retry = 2; retry >= 0; retry err = get_card_status(card, &status, 0); if (!err) break; <API key> = false; pr_err("%s: error %d sending status command, %sing\n", req->rq_disk->disk_name, err, retry ? "retry" : "abort"); } /* We couldn't get a response from the card. Give up. */ if (err) { /* Check if the card is removed */ if (<API key>(card->host)) return ERR_NOMEDIUM; return ERR_ABORT; } /* Flag ECC errors */ if ((status & R1_CARD_ECC_FAILED) || (brq->stop.resp[0] & R1_CARD_ECC_FAILED) || (brq->cmd.resp[0] & R1_CARD_ECC_FAILED)) *ecc_err = 1; /* Flag General errors */ if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) if ((status & R1_ERROR) || (brq->stop.resp[0] & R1_ERROR)) { pr_err("%s: %s: general error sending stop or status command, stop cmd response %#x, card status %#x\n", req->rq_disk->disk_name, __func__, brq->stop.resp[0], status); *gen_err = 1; } /* * Check the current card state. If it is in some data transfer * mode, tell it to stop (and hopefully transition back to TRAN.) */ if (R1_CURRENT_STATE(status) == R1_STATE_DATA || R1_CURRENT_STATE(status) == R1_STATE_RCV) { err = send_stop(card, &stop_status); if (err) pr_err("%s: error %d sending stop command\n", req->rq_disk->disk_name, err); /* * If the stop cmd also timed out, the card is probably * not present, so abort. Other errors are bad news too. */ if (err) return ERR_ABORT; if (stop_status & R1_CARD_ECC_FAILED) *ecc_err = 1; if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) if (stop_status & R1_ERROR) { pr_err("%s: %s: general error sending stop command, stop cmd response % req->rq_disk->disk_name, __func__, stop_status); *gen_err = 1; } } /* Check for set block count errors */ if (brq->sbc.error) return mmc_blk_cmd_error(req, "SET_BLOCK_COUNT", brq->sbc.error, <API key>, status); /* Check for r/w command errors */ if (brq->cmd.error) return mmc_blk_cmd_error(req, "r/w cmd", brq->cmd.error, <API key>, status); /* Data errors */ if (!brq->stop.error) return ERR_CONTINUE; /* Now for stop errors. These aren't fatal to the transfer. */ pr_err("%s: error %d sending stop command, original cmd response %#x, card status %#x\n", req->rq_disk->disk_name, brq->stop.error, brq->cmd.resp[0], status); /* * Subsitute in our own stop status as this will give the error * state which happened during the execution of the r/w command. */ if (stop_status) { brq->stop.resp[0] = stop_status; brq->stop.error = 0; } return ERR_CONTINUE; } static int mmc_blk_reset(struct mmc_blk_data *md, struct mmc_host *host, int type) { int err; if (md->reset_done & type) return -EEXIST; md->reset_done |= type; err = mmc_hw_reset(host); /* Ensure we switch back to the correct partition */ if (err != -EOPNOTSUPP) { struct mmc_blk_data *main_md = mmc_get_drvdata(host->card); int part_err; main_md->part_curr = main_md->part_type; part_err = mmc_blk_part_switch(host->card, md); if (part_err) { /* * We have failed to get back into the correct * partition, so we need to abort the whole request. */ return -ENODEV; } } return err; } static inline void <API key>(struct mmc_blk_data *md, int type) { md->reset_done &= ~type; } static int <API key>(struct mmc_queue *mq, struct request *req) { struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; unsigned int from, nr, arg; int err = 0, type = MMC_BLK_DISCARD; if (!mmc_can_erase(card)) { err = -EOPNOTSUPP; goto out; } from = blk_rq_pos(req); nr = blk_rq_sectors(req); if (card->ext_csd.bkops_en) card->bkops_info.sectors_changed += blk_rq_sectors(req); if (mmc_can_discard(card)) arg = MMC_DISCARD_ARG; else if (mmc_can_trim(card)) arg = MMC_TRIM_ARG; else arg = MMC_ERASE_ARG; retry: if (card->quirks & <API key>) { err = mmc_switch(card, <API key>, <API key>, arg == MMC_TRIM_ARG ? <API key> : <API key>, 0); if (err) goto out; } err = mmc_erase(card, from, nr, arg); out: if (err == -EIO && !mmc_blk_reset(md, card->host, type)) goto retry; if (!err) <API key>(md, type); blk_end_request(req, err, blk_rq_bytes(req)); return err ? 0 : 1; } static int <API key>(struct mmc_queue *mq, struct request *req) { struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; unsigned int from, nr, arg; int err = 0, type = MMC_BLK_SECDISCARD; if (!(<API key>(card))) { err = -EOPNOTSUPP; goto out; } from = blk_rq_pos(req); nr = blk_rq_sectors(req); if (mmc_can_trim(card) && !<API key>(card, from, nr)) arg = <API key>; else arg = <API key>; retry: if (card->quirks & <API key>) { err = mmc_switch(card, <API key>, <API key>, arg == <API key> ? <API key> : <API key>, 0); if (err) goto out_retry; } err = mmc_erase(card, from, nr, arg); if (err == -EIO) goto out_retry; if (err) goto out; if (arg == <API key>) { if (card->quirks & <API key>) { err = mmc_switch(card, <API key>, <API key>, <API key>, 0); if (err) goto out_retry; } err = mmc_erase(card, from, nr, <API key>); if (err == -EIO) goto out_retry; if (err) goto out; } if (mmc_can_sanitize(card) && (card->host->caps2 & MMC_CAP2_SANITIZE)) err = mmc_switch(card, <API key>, <API key>, 1, 0); out_retry: if (err && !mmc_blk_reset(md, card->host, type)) goto retry; if (!err) <API key>(md, type); out: blk_end_request(req, err, blk_rq_bytes(req)); return err ? 0 : 1; } static int <API key>(struct mmc_queue *mq, struct request *req) { struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; int err = 0; BUG_ON(!card); BUG_ON(!card->host); if (!(mmc_can_sanitize(card) && (card->host->caps2 & MMC_CAP2_SANITIZE))) { pr_warning("%s: %s - SANITIZE is not supported\n", mmc_hostname(card->host), __func__); err = -EOPNOTSUPP; goto out; } pr_debug("%s: %s - SANITIZE IN PROGRESS...\n", mmc_hostname(card->host), __func__); err = <API key>(card, <API key>, <API key>, 1, <API key>); if (err) pr_err("%s: %s - mmc_switch() with " "<API key> failed. err=%d\n", mmc_hostname(card->host), __func__, err); pr_debug("%s: %s - SANITIZE COMPLETED\n", mmc_hostname(card->host), __func__); out: blk_end_request(req, err, blk_rq_bytes(req)); return err ? 0 : 1; } static int mmc_blk_issue_flush(struct mmc_queue *mq, struct request *req) { struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; int ret = 0; ret = mmc_flush_cache(card); if (ret) ret = -EIO; blk_end_request_all(req, ret); return ret ? 0 : 1; } /* * Reformat current write as a reliable write, supporting * both legacy and the enhanced reliable write MMC cards. * In each transfer we'll handle only as much as a single * reliable write can handle, thus finish the request in * partial completions. */ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq, struct mmc_card *card, struct request *req) { if (!(card->ext_csd.rel_param & <API key>)) { /* Legacy mode imposes restrictions on transfers. */ if (!IS_ALIGNED(brq->cmd.arg, card->ext_csd.rel_sectors)) brq->data.blocks = 1; if (brq->data.blocks > card->ext_csd.rel_sectors) brq->data.blocks = card->ext_csd.rel_sectors; else if (brq->data.blocks < card->ext_csd.rel_sectors) brq->data.blocks = 1; } } #define CMD_ERRORS \ (R1_OUT_OF_RANGE | /* Command argument out of range */ \ R1_ADDRESS_ERROR | /* Misaligned address */ \ R1_BLOCK_LEN_ERROR | /* Transferred block length incorrect */\ R1_WP_VIOLATION | /* Tried to write to protected block */ \ R1_CC_ERROR | /* Card controller error */ \ R1_ERROR) /* General/unknown error */ static int mmc_blk_err_check(struct mmc_card *card, struct mmc_async_req *areq) { struct mmc_queue_req *mq_mrq = container_of(areq, struct mmc_queue_req, mmc_active); struct mmc_blk_request *brq = &mq_mrq->brq; struct request *req = mq_mrq->req; int ecc_err = 0, gen_err = 0; /* * sbc.error indicates a problem with the set block count * command. No data will have been transferred. * * cmd.error indicates a problem with the r/w command. No * data will have been transferred. * * stop.error indicates a problem with the stop command. Data * may have been transferred, or may still be transferring. */ if (brq->sbc.error || brq->cmd.error || brq->stop.error || brq->data.error) { switch (<API key>(card, req, brq, &ecc_err, &gen_err)) { case ERR_RETRY: return MMC_BLK_RETRY; case ERR_ABORT: return MMC_BLK_ABORT; case ERR_NOMEDIUM: return MMC_BLK_NOMEDIUM; case ERR_CONTINUE: break; } } /* * Check for errors relating to the execution of the * initial command - such as address errors. No data * has been transferred. */ if (brq->cmd.resp[0] & CMD_ERRORS) { pr_err("%s: r/w command failed, status = % req->rq_disk->disk_name, brq->cmd.resp[0]); return MMC_BLK_ABORT; } /* * Everything else is either success, or a data error of some * kind. If it was a write, we may have transitioned to * program mode, which we have to wait for it to complete. */ if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) { u32 status; unsigned long timeout; /* Check stop command response */ if (brq->stop.resp[0] & R1_ERROR) { pr_err("%s: %s: general error sending stop command, stop cmd response % req->rq_disk->disk_name, __func__, brq->stop.resp[0]); gen_err = 1; } timeout = jiffies + msecs_to_jiffies(MMC_BLK_TIMEOUT_MS); do { int err = get_card_status(card, &status, 5); if (err) { pr_err("%s: error %d requesting status\n", req->rq_disk->disk_name, err); return MMC_BLK_CMD_ERR; } /* Timeout if the device never becomes ready for data * and never leaves the program state. */ if (time_after(jiffies, timeout)) { pr_err("%s: Card stuck in programming state!"\ " %s %s\n", mmc_hostname(card->host), req->rq_disk->disk_name, __func__); return MMC_BLK_CMD_ERR; } if (status & R1_ERROR) { pr_err("%s: %s: general error sending status command, card status % req->rq_disk->disk_name, __func__, status); gen_err = 1; } /* * Some cards mishandle the status bits, * so make sure to check both the busy * indication and the card state. */ } while (!(status & R1_READY_FOR_DATA) || (R1_CURRENT_STATE(status) == R1_STATE_PRG)); } /* if general error occurs, retry the write operation. */ if (gen_err) { pr_warning("%s: retrying write for general error\n", req->rq_disk->disk_name); return MMC_BLK_RETRY; } if (brq->data.error) { pr_err("%s: error %d transferring data, sector %u, nr %u, cmd response %#x, card status %#x\n", req->rq_disk->disk_name, brq->data.error, (unsigned)blk_rq_pos(req), (unsigned)blk_rq_sectors(req), brq->cmd.resp[0], brq->stop.resp[0]); if (rq_data_dir(req) == READ) { if (ecc_err) return MMC_BLK_ECC_ERR; return MMC_BLK_DATA_ERR; } else { return MMC_BLK_CMD_ERR; } } if (!brq->data.bytes_xfered) return MMC_BLK_RETRY; if (mq_mrq->packed_cmd != MMC_PACKED_NONE) { if (unlikely(brq->data.blocks << 9 != brq->data.bytes_xfered)) return MMC_BLK_PARTIAL; else return MMC_BLK_SUCCESS; } if (blk_rq_bytes(req) != brq->data.bytes_xfered) return MMC_BLK_PARTIAL; return MMC_BLK_SUCCESS; } static int <API key>(struct mmc_card *card, struct mmc_async_req *areq) { struct mmc_queue_req *mq_rq = container_of(areq, struct mmc_queue_req, mmc_active); struct request *req = mq_rq->req; int err, check, status; u8 ext_csd[512]; mq_rq->packed_retries check = mmc_blk_err_check(card, areq); err = get_card_status(card, &status, 0); if (err) { pr_err("%s: error %d sending status command\n", req->rq_disk->disk_name, err); return MMC_BLK_ABORT; } if (status & R1_EXCEPTION_EVENT) { err = mmc_send_ext_csd(card, ext_csd); if (err) { pr_err("%s: error %d sending ext_csd\n", req->rq_disk->disk_name, err); return MMC_BLK_ABORT; } if ((ext_csd[<API key>] & <API key>) && (ext_csd[<API key>] & <API key>)) { if (ext_csd[<API key>] & <API key>) { mq_rq->packed_fail_idx = ext_csd[<API key>] - 1; return MMC_BLK_PARTIAL; } } } return check; } static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, struct mmc_card *card, int disable_multi, struct mmc_queue *mq) { u32 readcmd, writecmd; struct mmc_blk_request *brq = &mqrq->brq; struct request *req = mqrq->req; struct mmc_blk_data *md = mq->data; bool do_data_tag; /* * Reliable writes are used to implement Forced Unit Access and * REQ_META accesses, and are supported only on MMCs. * * XXX: this really needs a good explanation of why REQ_META * is treated special. */ bool do_rel_wr = ((req->cmd_flags & REQ_FUA) || (req->cmd_flags & REQ_META)) && (rq_data_dir(req) == WRITE) && (md->flags & MMC_BLK_REL_WR); memset(brq, 0, sizeof(struct mmc_blk_request)); brq->mrq.cmd = &brq->cmd; brq->mrq.data = &brq->data; brq->cmd.arg = blk_rq_pos(req); if (!mmc_card_blockaddr(card)) brq->cmd.arg <<= 9; brq->cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; brq->data.blksz = 512; brq->stop.opcode = <API key>; brq->stop.arg = 0; if (rq_data_dir(req) == WRITE) brq->stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; else brq->stop.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1B | MMC_CMD_AC; brq->data.blocks = blk_rq_sectors(req); brq->data.fault_injected = false; /* * The block layer doesn't support all sector count * restrictions, so we need to be prepared for too big * requests. */ if (brq->data.blocks > card->host->max_blk_count) brq->data.blocks = card->host->max_blk_count; if (brq->data.blocks > 1) { /* * After a read error, we redo the request one sector * at a time in order to accurately determine which * sectors can be read successfully. */ if (disable_multi) brq->data.blocks = 1; /* Some controllers can't do multiblock reads due to hw bugs */ if (card->host->caps2 & <API key> && rq_data_dir(req) == READ) brq->data.blocks = 1; } if (brq->data.blocks > 1 || do_rel_wr) { /* SPI multiblock writes terminate using a special * token, not a STOP_TRANSMISSION request. */ if (!mmc_host_is_spi(card->host) || rq_data_dir(req) == READ) brq->mrq.stop = &brq->stop; readcmd = <API key>; writecmd = <API key>; } else { brq->mrq.stop = NULL; readcmd = <API key>; writecmd = MMC_WRITE_BLOCK; } if (rq_data_dir(req) == READ) { brq->cmd.opcode = readcmd; brq->data.flags |= MMC_DATA_READ; } else { brq->cmd.opcode = writecmd; brq->data.flags |= MMC_DATA_WRITE; } if (do_rel_wr) mmc_apply_rel_rw(brq, card, req); /* * Data tag is used only during writing meta data to speed * up write and any subsequent read of this meta data */ do_data_tag = (card->ext_csd.data_tag_unit_size) && (req->cmd_flags & REQ_META) && (rq_data_dir(req) == WRITE) && ((brq->data.blocks * brq->data.blksz) >= card->ext_csd.data_tag_unit_size); /* * Pre-defined multi-block transfers are preferable to * open ended-ones (and necessary for reliable writes). * However, it is not sufficient to just send CMD23, * and avoid the final CMD12, as on an error condition * CMD12 (stop) needs to be sent anyway. This, coupled * with Auto-CMD23 enhancements provided by some * hosts, means that the complexity of dealing * with this is best left to the host. If CMD23 is * supported by card and host, we'll fill sbc in and let * the host deal with handling it correctly. This means * that for hosts that don't expose MMC_CAP_CMD23, no * change of behavior will be observed. * * N.B: Some MMC cards experience perf degradation. * We'll avoid using CMD23-bounded multiblock writes for * these, while retaining features like reliable writes. */ if ((md->flags & MMC_BLK_CMD23) && mmc_op_multi(brq->cmd.opcode) && (do_rel_wr || !(card->quirks & <API key>) || do_data_tag)) { brq->sbc.opcode = MMC_SET_BLOCK_COUNT; brq->sbc.arg = brq->data.blocks | (do_rel_wr ? (1 << 31) : 0) | (do_data_tag ? (1 << 29) : 0); brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC; brq->mrq.sbc = &brq->sbc; } <API key>(&brq->data, card); brq->data.sg = mqrq->sg; brq->data.sg_len = mmc_queue_map_sg(mq, mqrq); /* * Adjust the sg list so it is the same size as the * request. */ if (brq->data.blocks != blk_rq_sectors(req)) { int i, data_size = brq->data.blocks << 9; struct scatterlist *sg; for_each_sg(brq->data.sg, sg, brq->data.sg_len, i) { data_size -= sg->length; if (data_size <= 0) { sg->length += data_size; i++; break; } } brq->data.sg_len = i; } mqrq->mmc_active.mrq = &brq->mrq; mqrq->mmc_active.err_check = mmc_blk_err_check; <API key>(mqrq); } static void <API key>(struct mmc_queue *mq, struct request *req) { struct mmc_host *host = mq->card->host; int data_dir; if (!(host->caps2 & MMC_CAP2_PACKED_WR)) return; /* * In case the packing control is not supported by the host, it should * not have an effect on the write packing. Therefore we have to enable * the write packing */ if (!(host->caps2 & <API key>)) { mq->wr_packing_enabled = true; return; } if (!req || (req && (req->cmd_flags & REQ_FLUSH))) { if (mq-><API key> > mq-><API key>) mq->wr_packing_enabled = true; mq-><API key> = 0; return; } data_dir = rq_data_dir(req); if (data_dir == READ) { mq-><API key> = 0; mq->wr_packing_enabled = false; return; } else if (data_dir == WRITE) { mq-><API key>++; } if (mq-><API key> > mq-><API key>) mq->wr_packing_enabled = true; } struct mmc_wr_pack_stats *<API key>(struct mmc_card *card) { if (!card) return NULL; return &card->wr_pack_stats; } EXPORT_SYMBOL(<API key>); void <API key>(struct mmc_card *card) { int <API key> = 0; if (!card || !card->wr_pack_stats.packing_events) return; <API key> = card->ext_csd.max_packed_writes; spin_lock(&card->wr_pack_stats.lock); memset(card->wr_pack_stats.packing_events, 0, (<API key> + 1) * sizeof(*card->wr_pack_stats.packing_events)); memset(&card->wr_pack_stats.pack_stop_reason, 0, sizeof(card->wr_pack_stats.pack_stop_reason)); card->wr_pack_stats.enabled = true; spin_unlock(&card->wr_pack_stats.lock); } EXPORT_SYMBOL(<API key>); void <API key>(struct mmc_card *card) { int i; int <API key> = 0; if ((!card) || (!card->wr_pack_stats.packing_events)) return; <API key> = card->ext_csd.max_packed_writes; spin_lock(&card->wr_pack_stats.lock); pr_info("%s: write packing statistics:\n", mmc_hostname(card->host)); for (i = 1 ; i <= <API key> ; ++i) { if (card->wr_pack_stats.packing_events[i] != 0) pr_info("%s: Packed %d reqs - %d times\n", mmc_hostname(card->host), i, card->wr_pack_stats.packing_events[i]); } pr_info("%s: stopped packing due to the following reasons:\n", mmc_hostname(card->host)); if (card->wr_pack_stats.pack_stop_reason[EXCEEDS_SEGMENTS]) pr_info("%s: %d times: exceedmax num of segments\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[EXCEEDS_SEGMENTS]); if (card->wr_pack_stats.pack_stop_reason[EXCEEDS_SECTORS]) pr_info("%s: %d times: exceeding the max num of sectors\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[EXCEEDS_SECTORS]); if (card->wr_pack_stats.pack_stop_reason[WRONG_DATA_DIR]) pr_info("%s: %d times: wrong data direction\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[WRONG_DATA_DIR]); if (card->wr_pack_stats.pack_stop_reason[FLUSH_OR_DISCARD]) pr_info("%s: %d times: flush or discard\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[FLUSH_OR_DISCARD]); if (card->wr_pack_stats.pack_stop_reason[EMPTY_QUEUE]) pr_info("%s: %d times: empty queue\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[EMPTY_QUEUE]); if (card->wr_pack_stats.pack_stop_reason[REL_WRITE]) pr_info("%s: %d times: rel write\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[REL_WRITE]); if (card->wr_pack_stats.pack_stop_reason[THRESHOLD]) pr_info("%s: %d times: Threshold\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[THRESHOLD]); spin_unlock(&card->wr_pack_stats.lock); } EXPORT_SYMBOL(<API key>); static u8 <API key>(struct mmc_queue *mq, struct request *req) { struct request_queue *q = mq->queue; struct mmc_card *card = mq->card; struct request *cur = req, *next = NULL; struct mmc_blk_data *md = mq->data; bool en_rel_wr = card->ext_csd.rel_param & <API key>; unsigned int req_sectors = 0, phys_segments = 0; unsigned int max_blk_count, max_phys_segs; u8 put_back = 0; u8 max_packed_rw = 0; u8 reqs = 0; struct mmc_wr_pack_stats *stats = &card->wr_pack_stats; <API key>(mq->mqrq_cur); if (!(md->flags & MMC_BLK_CMD23) || !card->ext_csd.packed_event_en) goto no_packed; if (!mq->wr_packing_enabled) goto no_packed; if ((rq_data_dir(cur) == WRITE) && (card->host->caps2 & MMC_CAP2_PACKED_WR)) max_packed_rw = card->ext_csd.max_packed_writes; if (max_packed_rw == 0) goto no_packed; if (mmc_req_rel_wr(cur) && (md->flags & MMC_BLK_REL_WR) && !en_rel_wr) goto no_packed; if (mmc_large_sec(card) && !IS_ALIGNED(blk_rq_sectors(cur), 8)) goto no_packed; max_blk_count = min(card->host->max_blk_count, card->host->max_req_size >> 9); if (unlikely(max_blk_count > 0xffff)) max_blk_count = 0xffff; max_phys_segs = queue_max_segments(q); req_sectors += blk_rq_sectors(cur); phys_segments += cur->nr_phys_segments; if (rq_data_dir(cur) == WRITE) { req_sectors++; phys_segments++; } spin_lock(&stats->lock); while (reqs < max_packed_rw - 1) { /* We should stop no-more packing its nopacked_period */ if ((card->host->caps2 & <API key>) && <API key>(mq->nopacked_period)) break; spin_lock_irq(q->queue_lock); next = blk_fetch_request(q); spin_unlock_irq(q->queue_lock); if (!next) { <API key>(stats, EMPTY_QUEUE); break; } if (mmc_large_sec(card) && !IS_ALIGNED(blk_rq_sectors(next), 8)) { <API key>(stats, LARGE_SEC_ALIGN); put_back = 1; break; } if (next->cmd_flags & REQ_DISCARD || next->cmd_flags & REQ_FLUSH) { <API key>(stats, FLUSH_OR_DISCARD); put_back = 1; break; } if (rq_data_dir(cur) != rq_data_dir(next)) { <API key>(stats, WRONG_DATA_DIR); put_back = 1; break; } if (mmc_req_rel_wr(next) && (md->flags & MMC_BLK_REL_WR) && !en_rel_wr) { <API key>(stats, REL_WRITE); put_back = 1; break; } req_sectors += blk_rq_sectors(next); if (req_sectors > max_blk_count) { if (stats->enabled) stats->pack_stop_reason[EXCEEDS_SECTORS]++; put_back = 1; break; } phys_segments += next->nr_phys_segments; if (phys_segments > max_phys_segs) { <API key>(stats, EXCEEDS_SEGMENTS); put_back = 1; break; } if (rq_data_dir(next) == WRITE) { mq-><API key>++; if (card->ext_csd.bkops_en) card->bkops_info.sectors_changed += blk_rq_sectors(next); } list_add_tail(&next->queuelist, &mq->mqrq_cur->packed_list); cur = next; reqs++; } if (put_back) { spin_lock_irq(q->queue_lock); blk_requeue_request(q, next); spin_unlock_irq(q->queue_lock); } if (stats->enabled) { if (reqs + 1 <= card->ext_csd.max_packed_writes) stats->packing_events[reqs + 1]++; if (reqs + 1 == max_packed_rw) <API key>(stats, THRESHOLD); } spin_unlock(&stats->lock); /* if (stats->enabled) { if (reqs + 1 <= card->ext_csd.max_packed_writes) stats->packing_events[reqs + 1]++; if (reqs + 1 == max_packed_rw) <API key>(stats, THRESHOLD); } spin_unlock(&stats->lock); */ if (reqs > 0) { list_add(&req->queuelist, &mq->mqrq_cur->packed_list); mq->mqrq_cur->packed_num = ++reqs; mq->mqrq_cur->packed_retries = reqs; return reqs; } no_packed: <API key>(mq->mqrq_cur); return 0; } static void <API key>(struct mmc_queue_req *mqrq, struct mmc_card *card, struct mmc_queue *mq) { struct mmc_blk_request *brq = &mqrq->brq; struct request *req = mqrq->req; struct request *prq; struct mmc_blk_data *md = mq->data; bool do_rel_wr, do_data_tag; u32 *packed_cmd_hdr = mqrq->packed_cmd_hdr; u8 i = 1; mqrq->packed_cmd = MMC_PACKED_WRITE; mqrq->packed_blocks = 0; mqrq->packed_fail_idx = MMC_PACKED_N_IDX; memset(packed_cmd_hdr, 0, sizeof(mqrq->packed_cmd_hdr)); packed_cmd_hdr[0] = (mqrq->packed_num << 16) | (PACKED_CMD_WR << 8) | PACKED_CMD_VER; /* * Argument for each entry of packed group */ list_for_each_entry(prq, &mqrq->packed_list, queuelist) { do_rel_wr = mmc_req_rel_wr(prq) && (md->flags & MMC_BLK_REL_WR); do_data_tag = (card->ext_csd.data_tag_unit_size) && (prq->cmd_flags & REQ_META) && (rq_data_dir(prq) == WRITE) && ((brq->data.blocks * brq->data.blksz) >= card->ext_csd.data_tag_unit_size); /* Argument of CMD23 */ packed_cmd_hdr[(i * 2)] = (do_rel_wr ? <API key> : 0) | (do_data_tag ? <API key> : 0) | blk_rq_sectors(prq); /* Argument of CMD18 or CMD25 */ packed_cmd_hdr[((i * 2)) + 1] = mmc_card_blockaddr(card) ? blk_rq_pos(prq) : blk_rq_pos(prq) << 9; mqrq->packed_blocks += blk_rq_sectors(prq); i++; } memset(brq, 0, sizeof(struct mmc_blk_request)); brq->mrq.cmd = &brq->cmd; brq->mrq.data = &brq->data; brq->mrq.sbc = &brq->sbc; brq->mrq.stop = &brq->stop; brq->sbc.opcode = MMC_SET_BLOCK_COUNT; brq->sbc.arg = <API key> | (mqrq->packed_blocks + 1); brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC; brq->cmd.opcode = <API key>; brq->cmd.arg = blk_rq_pos(req); if (!mmc_card_blockaddr(card)) brq->cmd.arg <<= 9; brq->cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; brq->data.blksz = 512; brq->data.blocks = mqrq->packed_blocks + 1; brq->data.flags |= MMC_DATA_WRITE; brq->data.fault_injected = false; brq->stop.opcode = <API key>; brq->stop.arg = 0; brq->stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; <API key>(&brq->data, card); brq->data.sg = mqrq->sg; brq->data.sg_len = mmc_queue_map_sg(mq, mqrq); mqrq->mmc_active.mrq = &brq->mrq; /* * This is intended for packed commands tests usage - in case these * functions are not in use the respective pointers are NULL */ if (mq->err_check_fn) mqrq->mmc_active.err_check = mq->err_check_fn; else mqrq->mmc_active.err_check = <API key>; if (mq->packed_test_fn) mq->packed_test_fn(mq->queue, mqrq); <API key>(mqrq); } static int mmc_blk_cmd_err(struct mmc_blk_data *md, struct mmc_card *card, struct mmc_blk_request *brq, struct request *req, int ret) { struct mmc_queue_req *mq_rq; mq_rq = container_of(brq, struct mmc_queue_req, brq); /* * If this is an SD card and we're writing, we can first * mark the known good sectors as ok. * * If the card is not SD, we can still ok written sectors * as reported by the controller (which might be less than * the real number of written sectors, but never more). */ if (mmc_card_sd(card)) { u32 blocks; if (!brq->data.fault_injected) { blocks = <API key>(card); if (blocks != (u32)-1) ret = blk_end_request(req, 0, blocks << 9); } else ret = blk_end_request(req, 0, brq->data.bytes_xfered); } else { if (mq_rq->packed_cmd == MMC_PACKED_NONE) ret = blk_end_request(req, 0, brq->data.bytes_xfered); } return ret; } static int <API key>(struct mmc_queue_req *mq_rq) { struct request *prq; int idx = mq_rq->packed_fail_idx, i = 0; int ret = 0; while (!list_empty(&mq_rq->packed_list)) { prq = list_entry_rq(mq_rq->packed_list.next); if (idx == i) { /* retry from error index */ mq_rq->packed_num -= idx; mq_rq->req = prq; ret = 1; if (mq_rq->packed_num == MMC_PACKED_N_SINGLE) { list_del_init(&prq->queuelist); <API key>(mq_rq); } return ret; } list_del_init(&prq->queuelist); blk_end_request(prq, 0, blk_rq_bytes(prq)); i++; } <API key>(mq_rq); return ret; } static void <API key>(struct mmc_queue_req *mq_rq) { struct request *prq; while (!list_empty(&mq_rq->packed_list)) { prq = list_entry_rq(mq_rq->packed_list.next); list_del_init(&prq->queuelist); blk_end_request(prq, -EIO, blk_rq_bytes(prq)); } <API key>(mq_rq); } static void <API key>(struct mmc_queue *mq, struct mmc_queue_req *mq_rq) { struct request *prq; struct request_queue *q = mq->queue; while (!list_empty(&mq_rq->packed_list)) { prq = list_entry_rq(mq_rq->packed_list.prev); if (prq->queuelist.prev != &mq_rq->packed_list) { list_del_init(&prq->queuelist); spin_lock_irq(q->queue_lock); blk_requeue_request(mq->queue, prq); spin_unlock_irq(q->queue_lock); } else { list_del_init(&prq->queuelist); } } <API key>(mq_rq); } static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) { struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; struct mmc_blk_request *brq = &mq->mqrq_cur->brq; int ret = 1, disable_multi = 0, retry = 0, type; enum mmc_blk_status status; struct mmc_queue_req *mq_rq; struct request *req; struct mmc_async_req *areq; const u8 packed_num = 2; u8 reqs = 0; if (!rqc && !mq->mqrq_prev->req) return 0; if (rqc) { if ((card->ext_csd.bkops_en) && (rq_data_dir(rqc) == WRITE)) card->bkops_info.sectors_changed += blk_rq_sectors(rqc); reqs = <API key>(mq, rqc); } do { if (rqc) { if (reqs >= packed_num) <API key>(mq->mqrq_cur, card, mq); else mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq); areq = &mq->mqrq_cur->mmc_active; } else areq = NULL; areq = mmc_start_req(card->host, areq, (int *) &status); if (!areq) { if (status == MMC_BLK_NEW_REQUEST) mq->flags |= <API key>; return 0; } mq_rq = container_of(areq, struct mmc_queue_req, mmc_active); brq = &mq_rq->brq; req = mq_rq->req; type = rq_data_dir(req) == READ ? MMC_BLK_READ : MMC_BLK_WRITE; <API key>(mq_rq); switch (status) { case MMC_BLK_SUCCESS: case MMC_BLK_PARTIAL: /* * A block was successfully transferred. */ <API key>(md, type); if (mq_rq->packed_cmd != MMC_PACKED_NONE) { ret = <API key>(mq_rq); break; } else { ret = blk_end_request(req, 0, brq->data.bytes_xfered); } /* * If the blk_end_request function returns non-zero even * though all data has been transferred and no errors * were returned by the host controller, it's a bug. */ if (status == MMC_BLK_SUCCESS && ret) { pr_err("%s BUG rq_tot %d d_xfer %d\n", __func__, blk_rq_bytes(req), brq->data.bytes_xfered); rqc = NULL; goto cmd_abort; } break; case MMC_BLK_CMD_ERR: ret = mmc_blk_cmd_err(md, card, brq, req, ret); if (!mmc_blk_reset(md, card->host, type)) break; goto cmd_abort; case MMC_BLK_RETRY: if (retry++ < 5) break; /* Fall through */ case MMC_BLK_ABORT: if (!mmc_blk_reset(md, card->host, type)) break; goto cmd_abort; case MMC_BLK_DATA_ERR: { int err; err = mmc_blk_reset(md, card->host, type); if (!err) break; if (err == -ENODEV || mq_rq->packed_cmd != MMC_PACKED_NONE) goto cmd_abort; /* Fall through */ } case MMC_BLK_ECC_ERR: if (brq->data.blocks > 1) { /* Redo read one sector at a time */ pr_warning("%s: retrying using single block read\n", req->rq_disk->disk_name); disable_multi = 1; break; } /* * After an error, we redo I/O one sector at a * time, so we only reach here after trying to * read a single sector. */ ret = blk_end_request(req, -EIO, brq->data.blksz); if (!ret) goto start_new_req; break; case MMC_BLK_NOMEDIUM: goto cmd_abort; default: pr_err("%s: Unhandled return value (%d)", req->rq_disk->disk_name, status); goto cmd_abort; } if (ret) { if (mq_rq->packed_cmd == MMC_PACKED_NONE) { /* * In case of a incomplete request * prepare it again and resend. */ mmc_blk_rw_rq_prep(mq_rq, card, disable_multi, mq); mmc_start_req(card->host, &mq_rq->mmc_active, NULL); } else { if (!mq_rq->packed_retries) goto cmd_abort; <API key>(mq_rq, card, mq); mmc_start_req(card->host, &mq_rq->mmc_active, NULL); } } } while (ret); return 1; cmd_abort: if (mq_rq->packed_cmd == MMC_PACKED_NONE) { if (mmc_card_removed(card)) req->cmd_flags |= REQ_QUIET; while (ret) ret = blk_end_request(req, -EIO, blk_rq_cur_bytes(req)); } else { <API key>(mq_rq); } start_new_req: if (rqc) { /* * If current request is packed, it needs to put back. */ if (mq->mqrq_cur->packed_cmd != MMC_PACKED_NONE) <API key>(mq, mq->mqrq_cur); mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq); mmc_start_req(card->host, &mq->mqrq_cur->mmc_active, NULL); } return 0; } static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) { int ret; struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; struct mmc_host *host = card->host; unsigned long flags; #ifdef <API key> if (<API key>(card->host)) { mmc_resume_bus(card->host); mmc_blk_set_blksize(md, card); } #endif if (req && !mq->mqrq_prev->req) { /* claim host only for the first request */ mmc_claim_host(card->host); if (card->ext_csd.bkops_en) mmc_stop_bkops(card); } ret = mmc_blk_part_switch(card, md); if (ret) { if (req) { blk_end_request_all(req, -EIO); } ret = 0; goto out; } <API key>(mq, req); mq->flags &= ~<API key>; if (req && req->cmd_flags & REQ_SANITIZE) { /* complete ongoing async transfer before issuing sanitize */ if (card->host && card->host->areq) mmc_blk_issue_rw_rq(mq, NULL); ret = <API key>(mq, req); } else if (req && req->cmd_flags & REQ_DISCARD) { /* complete ongoing async transfer before issuing discard */ if (card->host->areq) mmc_blk_issue_rw_rq(mq, NULL); if (req->cmd_flags & REQ_SECURE && !(card->quirks & <API key>)) ret = <API key>(mq, req); else ret = <API key>(mq, req); } else if (req && req->cmd_flags & REQ_FLUSH) { /* complete ongoing async transfer before issuing flush */ if (card->host->areq) mmc_blk_issue_rw_rq(mq, NULL); ret = mmc_blk_issue_flush(mq, req); } else { if (!req && host->areq) { spin_lock_irqsave(&host->context_info.lock, flags); host->context_info.is_waiting_last_req = true; <API key>(&host->context_info.lock, flags); } ret = mmc_blk_issue_rw_rq(mq, req); } out: if (!req && !(mq->flags & <API key>)) /* release host only when there are no more requests */ mmc_release_host(card->host); return ret; } static inline int mmc_blk_readonly(struct mmc_card *card) { return mmc_card_readonly(card) || !(card->csd.cmdclass & CCC_BLOCK_WRITE); } static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, struct device *parent, sector_t size, bool default_ro, const char *subname, int area_type) { struct mmc_blk_data *md; int devidx, ret; unsigned int percentage = <API key>; devidx = find_first_zero_bit(dev_use, max_devices); if (devidx >= max_devices) return ERR_PTR(-ENOSPC); __set_bit(devidx, dev_use); md = kzalloc(sizeof(struct mmc_blk_data), GFP_KERNEL); if (!md) { ret = -ENOMEM; goto out; } /* * !subname implies we are creating main mmc_blk_data that will be * associated with mmc_card with mmc_set_drvdata. Due to device * partitions, devidx will not coincide with a per-physical card * index anymore so we keep track of a name index. */ if (!subname) { md->name_idx = find_first_zero_bit(name_use, max_devices); __set_bit(md->name_idx, name_use); } else md->name_idx = ((struct mmc_blk_data *) dev_to_disk(parent)->private_data)->name_idx; md->area_type = area_type; /* * Set the read-only status based on the supported commands * and the write protect switch. */ md->read_only = mmc_blk_readonly(card); md->disk = alloc_disk(perdev_minors); if (md->disk == NULL) { ret = -ENOMEM; goto err_kfree; } spin_lock_init(&md->lock); INIT_LIST_HEAD(&md->part); md->usage = 1; ret = mmc_init_queue(&md->queue, card, &md->lock, subname); if (ret) goto err_putdisk; md->queue.issue_fn = mmc_blk_issue_rq; md->queue.data = md; md->disk->major = MMC_BLOCK_MAJOR; md->disk->first_minor = devidx * perdev_minors; md->disk->fops = &mmc_bdops; md->disk->private_data = md; md->disk->queue = md->queue.queue; md->disk->driverfs_dev = parent; set_disk_ro(md->disk, md->read_only || default_ro); md->disk->flags = GENHD_FL_EXT_DEVT; /* * As discussed on lkml, GENHD_FL_REMOVABLE should: * * - be set for removable media with permanent block devices * - be unset for removable block devices with permanent media * * Since MMC block devices clearly fall under the second * case, we do not set GENHD_FL_REMOVABLE. Userspace * should use the block device creation/destruction hotplug * messages to tell when the card is present. */ snprintf(md->disk->disk_name, sizeof(md->disk->disk_name), "mmcblk%d%s", md->name_idx, subname ? subname : ""); <API key>(md->queue.queue, 512); set_capacity(md->disk, size); card->bkops_info.<API key> = percentage; card->bkops_info.<API key> = ((unsigned int)size * percentage) / 100; if (mmc_host_cmd23(card->host)) { if (mmc_card_mmc(card) || (mmc_card_sd(card) && card->scr.cmds & <API key> && mmc_sd_card_uhs(card))) md->flags |= MMC_BLK_CMD23; } if (mmc_card_mmc(card) && md->flags & MMC_BLK_CMD23 && ((card->ext_csd.rel_param & <API key>) || card->ext_csd.rel_sectors)) { md->flags |= MMC_BLK_REL_WR; blk_queue_flush(md->queue.queue, REQ_FLUSH | REQ_FUA); } return md; err_putdisk: put_disk(md->disk); err_kfree: kfree(md); out: return ERR_PTR(ret); } static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) { sector_t size; struct mmc_blk_data *md; if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { /* * The EXT_CSD sector count is in number or 512 byte * sectors. */ size = card->ext_csd.sectors; } else { /* * The CSD capacity field is in units of read_blkbits. * set_capacity takes units of 512 bytes. */ size = card->csd.capacity << (card->csd.read_blkbits - 9); } md = mmc_blk_alloc_req(card, &card->dev, size, false, NULL, <API key>); return md; } static int mmc_blk_alloc_part(struct mmc_card *card, struct mmc_blk_data *md, unsigned int part_type, sector_t size, bool default_ro, const char *subname, int area_type) { char cap_str[10]; struct mmc_blk_data *part_md; part_md = mmc_blk_alloc_req(card, disk_to_dev(md->disk), size, default_ro, subname, area_type); if (IS_ERR(part_md)) return PTR_ERR(part_md); part_md->part_type = part_type; list_add(&part_md->part, &md->part); string_get_size((u64)get_capacity(part_md->disk) << 9, STRING_UNITS_2, cap_str, sizeof(cap_str)); pr_info("%s: %s %s partition %u %s\n", part_md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), part_md->part_type, cap_str); return 0; } /* MMC Physical partitions consist of two boot partitions and * up to four general purpose partitions. * For each partition enabled in EXT_CSD a block device will be allocatedi * to provide access to the partition. */ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md) { int idx, ret = 0; if (!mmc_card_mmc(card)) return 0; for (idx = 0; idx < card->nr_parts; idx++) { if (card->part[idx].size) { ret = mmc_blk_alloc_part(card, md, card->part[idx].part_cfg, card->part[idx].size >> 9, card->part[idx].force_ro, card->part[idx].name, card->part[idx].area_type); if (ret) return ret; } } return ret; } static void mmc_blk_remove_req(struct mmc_blk_data *md) { struct mmc_card *card; if (md) { card = md->queue.card; device_remove_file(disk_to_dev(md->disk), &md-><API key>); if (md->disk->flags & GENHD_FL_UP) { device_remove_file(disk_to_dev(md->disk), &md->force_ro); if ((md->area_type & <API key>) && card->ext_csd.boot_ro_lockable) device_remove_file(disk_to_dev(md->disk), &md->power_ro_lock); /* Stop new requests from getting into the queue */ del_gendisk(md->disk); } /* Then flush out any already in there */ mmc_cleanup_queue(&md->queue); mmc_blk_put(md); } } static void <API key>(struct mmc_card *card, struct mmc_blk_data *md) { struct list_head *pos, *q; struct mmc_blk_data *part_md; __clear_bit(md->name_idx, name_use); list_for_each_safe(pos, q, &md->part) { part_md = list_entry(pos, struct mmc_blk_data, part); list_del(pos); mmc_blk_remove_req(part_md); } } static int mmc_add_disk(struct mmc_blk_data *md) { int ret; struct mmc_card *card = md->queue.card; add_disk(md->disk); md->force_ro.show = force_ro_show; md->force_ro.store = force_ro_store; sysfs_attr_init(&md->force_ro.attr); md->force_ro.attr.name = "force_ro"; md->force_ro.attr.mode = S_IRUGO | S_IWUSR; ret = device_create_file(disk_to_dev(md->disk), &md->force_ro); if (ret) goto force_ro_fail; if ((md->area_type & <API key>) && card->ext_csd.boot_ro_lockable) { umode_t mode; if (card->ext_csd.boot_ro_lock & <API key>) mode = S_IRUGO; else mode = S_IRUGO | S_IWUSR; md->power_ro_lock.show = power_ro_lock_show; md->power_ro_lock.store = power_ro_lock_store; sysfs_attr_init(&md->power_ro_lock.attr); md->power_ro_lock.attr.mode = mode; md->power_ro_lock.attr.name = "<API key>"; ret = device_create_file(disk_to_dev(md->disk), &md->power_ro_lock); if (ret) goto power_ro_lock_fail; } md-><API key>.show = <API key>; md-><API key>.store = <API key>; sysfs_attr_init(&md-><API key>.attr); md-><API key>.attr.name = "<API key>"; md-><API key>.attr.mode = S_IRUGO | S_IWUSR; ret = device_create_file(disk_to_dev(md->disk), &md-><API key>); if (ret) goto <API key>; md-><API key>.show = <API key>; md-><API key>.store = <API key>; sysfs_attr_init(&md-><API key>.attr); md-><API key>.attr.name = "<API key>"; md-><API key>.attr.mode = S_IRUGO | S_IWUSR; ret = device_create_file(disk_to_dev(md->disk), &md-><API key>); if (ret) goto <API key>; return ret; <API key>: device_remove_file(disk_to_dev(md->disk), &md-><API key>); <API key>: device_remove_file(disk_to_dev(md->disk), &md->power_ro_lock); power_ro_lock_fail: device_remove_file(disk_to_dev(md->disk), &md->force_ro); force_ro_fail: del_gendisk(md->disk); return ret; } #define CID_MANFID_SANDISK 0x2 #define CID_MANFID_TOSHIBA 0x11 #define CID_MANFID_MICRON 0x13 #define CID_MANFID_SAMSUNG 0x15 static const struct mmc_fixup blk_fixups[] = { MMC_FIXUP("SEM02G", CID_MANFID_SANDISK, 0x100, add_quirk, <API key>), MMC_FIXUP("SEM04G", CID_MANFID_SANDISK, 0x100, add_quirk, <API key>), MMC_FIXUP("SEM08G", CID_MANFID_SANDISK, 0x100, add_quirk, <API key>), MMC_FIXUP("SEM16G", CID_MANFID_SANDISK, 0x100, add_quirk, <API key>), MMC_FIXUP("SEM32G", CID_MANFID_SANDISK, 0x100, add_quirk, <API key>), /* * Some MMC cards experience performance degradation with CMD23 * instead of CMD12-bounded multiblock transfers. For now we'll * black list what's bad... * - Certain Toshiba cards. * * N.B. This doesn't affect SD cards. */ MMC_FIXUP("MMC08G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc, <API key>), MMC_FIXUP("MMC16G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc, <API key>), MMC_FIXUP("MMC32G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc, <API key>), /* * Some Micron MMC cards needs longer data read timeout than * indicated in CSD. */ MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc, <API key>), /* Some INAND MCP devices advertise incorrect timeout values */ MMC_FIXUP("SEM04G", 0x45, CID_OEMID_ANY, add_quirk_mmc, <API key>), /* * On these Samsung MoviNAND parts, performing secure erase or * secure trim can result in unrecoverable corruption due to a * firmware bug. */ MMC_FIXUP("M8G2FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, <API key>), MMC_FIXUP("MAG4FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, <API key>), MMC_FIXUP("MBG8FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, <API key>), MMC_FIXUP("MCGAFA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, <API key>), MMC_FIXUP("VAL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, <API key>), MMC_FIXUP("VYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, <API key>), MMC_FIXUP("KYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, <API key>), MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, <API key>), END_FIXUP }; #ifdef <API key> static ssize_t bkops_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { struct gendisk *disk; struct mmc_blk_data *md; struct mmc_card *card; disk = dev_to_disk(dev); if (disk) md = disk->private_data; else goto show_out; if (md) card = md->queue.card; else goto show_out; return snprintf(buf, PAGE_SIZE, "%u\n", card->bkops_enable); show_out: return snprintf(buf, PAGE_SIZE, "\n"); } static ssize_t bkops_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct gendisk *disk; struct mmc_blk_data *md; struct mmc_card *card; u8 value; int err = 0; disk = dev_to_disk(dev); if (disk) md = disk->private_data; else goto store_out; if (md) card = md->queue.card; else goto store_out; if (kstrtou8(buf, 0, &value)) goto store_out; err = mmc_bkops_enable(card->host, value); if (err) return err; return count; store_out: return -EINVAL; } static inline void <API key>(struct mmc_card *card) { struct mmc_blk_data *md = mmc_get_drvdata(card); card->bkops_attr.show = bkops_mode_show; card->bkops_attr.store = bkops_mode_store; sysfs_attr_init(&card->bkops_attr.attr); card->bkops_attr.attr.name = "bkops_en"; card->bkops_attr.attr.mode = S_IRUGO | S_IWUSR | S_IWGRP; if (device_create_file((disk_to_dev(md->disk)), &card->bkops_attr)) { pr_err("%s: Failed to create bkops_en sysfs entry\n", mmc_hostname(card->host)); #if defined(<API key>) || defined(<API key>) } else { int rc; struct device * dev; dev = disk_to_dev(md->disk); rc = sysfs_chown_file(&dev->kobj, &card->bkops_attr.attr, <API key>, <API key>); if (rc) pr_err("%s: Failed to change mode of sysfs entry\n", mmc_hostname(card->host)); #endif } } #else static inline void <API key>(struct mmc_card *card) { } #endif static int mmc_blk_probe(struct mmc_card *card) { struct mmc_blk_data *md, *part_md; char cap_str[10]; /* * Check that the card supports the command class(es) we need. */ if (!(card->csd.cmdclass & CCC_BLOCK_READ)) return -ENODEV; md = mmc_blk_alloc(card); if (IS_ERR(md)) return PTR_ERR(md); string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2, cap_str, sizeof(cap_str)); pr_info("%s: %s %s %s %s\n", md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), cap_str, md->read_only ? "(ro)" : ""); if (mmc_blk_alloc_parts(card, md)) goto out; mmc_set_drvdata(card, md); mmc_fixup_device(card, blk_fixups); #ifdef <API key> <API key>(card->host, 1); #endif if (mmc_add_disk(md)) goto out; list_for_each_entry(part_md, &md->part, part) { if (mmc_add_disk(part_md)) goto out; } /* init sysfs for bkops mode */ if (card && mmc_card_mmc(card)) { <API key>(card); spin_lock_init(&card->bkops_lock); } return 0; out: <API key>(card, md); mmc_blk_remove_req(md); return 0; } static void mmc_blk_remove(struct mmc_card *card) { struct mmc_blk_data *md = mmc_get_drvdata(card); <API key>(card, md); mmc_claim_host(card->host); mmc_blk_part_switch(card, md); mmc_release_host(card->host); mmc_blk_remove_req(md); mmc_set_drvdata(card, NULL); #ifdef <API key> <API key>(card->host, 0); #endif } #ifdef CONFIG_PM static int mmc_blk_suspend(struct mmc_card *card) { struct mmc_blk_data *part_md; struct mmc_blk_data *md = mmc_get_drvdata(card); int rc = 0; if (md) { rc = mmc_queue_suspend(&md->queue); if (rc) goto out; list_for_each_entry(part_md, &md->part, part) { rc = mmc_queue_suspend(&part_md->queue); if (rc) goto out_resume; } } goto out; out_resume: mmc_queue_resume(&md->queue); list_for_each_entry(part_md, &md->part, part) { mmc_queue_resume(&part_md->queue); } out: return rc; } static int mmc_blk_resume(struct mmc_card *card) { struct mmc_blk_data *part_md; struct mmc_blk_data *md = mmc_get_drvdata(card); if (md) { /* * Resume involves the card going into idle state, * so current partition is always the main one. */ md->part_curr = md->part_type; mmc_queue_resume(&md->queue); list_for_each_entry(part_md, &md->part, part) { mmc_queue_resume(&part_md->queue); } } return 0; } #else #define mmc_blk_suspend NULL #define mmc_blk_resume NULL #endif static struct mmc_driver mmc_driver = { .drv = { .name = "mmcblk", }, .probe = mmc_blk_probe, .remove = mmc_blk_remove, .suspend = mmc_blk_suspend, .resume = mmc_blk_resume, }; static int __init mmc_blk_init(void) { int res; if (perdev_minors != <API key>) pr_info("mmcblk: using %d minors per device\n", perdev_minors); max_devices = 256 / perdev_minors; res = register_blkdev(MMC_BLOCK_MAJOR, "mmc"); if (res) goto out; res = mmc_register_driver(&mmc_driver); if (res) goto out2; return 0; out2: unregister_blkdev(MMC_BLOCK_MAJOR, "mmc"); out: return res; } static void __exit mmc_blk_exit(void) { <API key>(&mmc_driver); unregister_blkdev(MMC_BLOCK_MAJOR, "mmc"); } module_init(mmc_blk_init); module_exit(mmc_blk_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
layout: post title: Air America Radio author: Chris Metcalf date: 2004/03/31 slug: air-america-radio category: tags: [ politics ] Apparently <a href="http: Somehow his days on Comedy Central don't really let me see him as a powerful political figure. If you've got to make Liberalism funny to get people to listen to it, you've got more things to worry about.
using System; using Server.Mobiles; using Server.Network; using Server.Targeting; namespace Server.Spells.First { public class HealSpell : MagerySpell { private static readonly SpellInfo m_Info = new SpellInfo( "Heal", "In Mani", 224, 9061, Reagent.Garlic, Reagent.Ginseng, Reagent.SpidersSilk); public HealSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info) { } public override SpellCircle Circle { get { return SpellCircle.First; } } public override bool CheckCast() { if (Engines.ConPVP.DuelContext.CheckSuddenDeath(this.Caster)) { this.Caster.SendMessage(0x22, "You cannot cast this spell when in sudden death."); return false; } return base.CheckCast(); } public override void OnCast() { this.Caster.Target = new InternalTarget(this); } public void Target(Mobile m) { if (!this.Caster.CanSee(m)) { this.Caster.<API key>(500237); // Target can not be seen. } else if (m.IsDeadBondedPet) { this.Caster.<API key>(1060177); // You cannot heal a creature that is already dead! } else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead) { this.Caster.<API key>(1061654); // You cannot heal that which is not alive. } else if (m is IRepairableMobile) { this.Caster.<API key>(MessageType.Regular, 0x3B2, 500951); // You cannot heal that. } else if (m.Poisoned || Server.Items.MortalStrike.IsWounded(m)) { this.Caster.<API key>(MessageType.Regular, 0x22, (this.Caster == m) ? 1005000 : 1010398); } else if (this.CheckBSequence(m)) { SpellHelper.Turn(this.Caster, m); int toHeal; if (Core.AOS) { toHeal = this.Caster.Skills.Magery.Fixed / 120; toHeal += Utility.RandomMinMax(1, 4); if (Core.SE && this.Caster != m) toHeal = (int)(toHeal * 1.5); } else { toHeal = (int)(this.Caster.Skills[SkillName.Magery].Value * 0.1); toHeal += Utility.Random(1, 5); } //m.Heal( toHeal, Caster ); SpellHelper.Heal(toHeal, m, this.Caster); m.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist); m.PlaySound(0x1F2); } this.FinishSequence(); } public class InternalTarget : Target { private readonly HealSpell m_Owner; public InternalTarget(HealSpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.Beneficial) { this.m_Owner = owner; } protected override void OnTarget(Mobile from, object o) { if (o is Mobile) { this.m_Owner.Target((Mobile)o); } } protected override void OnTargetFinish(Mobile from) { this.m_Owner.FinishSequence(); } } } }
id: 9987 title: date: 2009-02-17T17:48:00+00:00 author: jiang layout: post guid: http://li-and-jiang.com/blog/2009/02/17/%e6%85%88%e6%82%b2%e4%b8%ba%e6%80%80/ permalink: /2009/02/17/%e6%85%88%e6%82%b2%e4%b8%ba%e6%80%80/ categories: - [<img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height="64" alt="rak" src="http: Quote of the DayRandom Acts of Kindness Day<a href="http: > If you want others to be happy, practice compassion. If you want to be happy, practice compassion. >
#include <arch/acpi.h> #include <console/console.h> #include <device/device.h> #include <gpio.h> #include <stdlib.h> #include <string.h> #include <soc/nhlt.h> #include "ec.h" #include "gpio.h" static const char *oem_id_maxim = "INTEL"; static const char *oem_table_id_maxim = "SCRDMAX"; static void mainboard_init(device_t dev) { mainboard_ec_init(); } static uint8_t select_audio_codec(void) { int audio_db_sel = gpio_get(AUDIO_DB_ID); return audio_db_sel; } static unsigned long <API key>( device_t device, unsigned long current, acpi_rsdp_t *rsdp) { uintptr_t start_addr; uintptr_t end_addr; struct nhlt *nhlt; const char *oem_id = NULL; const char *oem_table_id = NULL; start_addr = current; nhlt = nhlt_init(); if (nhlt == NULL) return start_addr; /* 2 Channel DMIC array. */ if (<API key>(nhlt, 2)) printk(BIOS_ERR, "Couldn't add 2CH DMIC array.\n"); /* 4 Channel DMIC array. */ if (<API key>(nhlt, 4)) printk(BIOS_ERR, "Couldn't add 4CH DMIC arrays.\n"); if (select_audio_codec()) { /* ADI Smart Amps for left and right. */ if (<API key>(nhlt, AUDIO_LINK_SSP0)) printk(BIOS_ERR, "Couldn't add ssm4567.\n"); } else { /* MAXIM Smart Amps for left and right. */ if (<API key>(nhlt, AUDIO_LINK_SSP0)) printk(BIOS_ERR, "Couldn't add max98357.\n"); oem_id = oem_id_maxim; oem_table_id = oem_table_id_maxim; } /* NAU88l25 Headset codec. */ if (<API key>(nhlt, AUDIO_LINK_SSP1)) printk(BIOS_ERR, "Couldn't add headset codec.\n"); end_addr = <API key>(nhlt, start_addr, oem_id, oem_table_id); if (end_addr != start_addr) acpi_add_table(rsdp, (void *)start_addr); return end_addr; } /* * mainboard_enable is executed as first thing after * enumerate_buses(). */ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; dev->ops->write_acpi_tables = <API key>; } struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, };
{# This file was generated with the ext-templateevents:generate command. #} {%- if <API key>.enable -%} <a class="templateevents" title="3.1.0-a1& {%- endif -%}
#ifndef _INC_NLDEF #define _INC_NLDEF typedef enum _NL_ADDRESS_TYPE { NlatUnspecified, NlatUnicast, NlatAnycast, NlatMulticast, NlatBroadcast, NlatInvalid } NL_ADDRESS_TYPE, *PNL_ADDRESS_TYPE; typedef enum _NL_DAD_STATE { NldsInvalid = 0, NldsTentative, NldsDuplicate, NldsDeprecated, NldsPreferred, IpDadStateInvalid = 0, IpDadStateTentative, IpDadStateDuplicate, <API key>, IpDadStatePreferred } NL_DAD_STATE; typedef enum <API key> { LinkLocalAlwaysOff = 0, LinkLocalDelayed, LinkLocalAlwaysOn, LinkLocalUnchanged = -1 } <API key>; typedef enum _NL_NEIGHBOR_STATE { NlnsUnreachable, NlnsIncomplete, NlnsProbe, NlnsDelay, NlnsStale, NlnsReachable, NlnsPermanent, NlnsMaximum } NL_NEIGHBOR_STATE, *PNL_NEIGHBOR_STATE; typedef enum <API key> { IpPrefixOriginOther = 0, <API key>, <API key>, IpPrefixOriginDhcp, <API key>, <API key> = 1 << 4 } NL_PREFIX_ORIGIN; typedef enum _NL_ROUTE_ORIGIN { NlroManual, NlroWellKnown, NlroDHCP, <API key>, Nlro6to4 } NL_ROUTE_ORIGIN, *PNL_ROUTE_ORIGIN; typedef enum _NL_ROUTE_PROTOCOL { RouteProtocolOther = 1, RouteProtocolLocal, <API key>, RouteProtocolIcmp, RouteProtocolEgp, RouteProtocolGgp, RouteProtocolHello, RouteProtocolRip, RouteProtocolIsIs, RouteProtocolEsIs, RouteProtocolCisco, RouteProtocolBbn, RouteProtocolOspf, RouteProtocolBgp, MIB_IPPROTO_OTHER = 1, PROTO_IP_OTHER = 1, MIB_IPPROTO_LOCAL = 2, PROTO_IP_LOCAL = 2, MIB_IPPROTO_NETMGMT = 3, PROTO_IP_NETMGMT = 3, MIB_IPPROTO_ICMP = 4, PROTO_IP_ICMP = 4, MIB_IPPROTO_EGP = 5, PROTO_IP_EGP = 5, MIB_IPPROTO_GGP = 6, PROTO_IP_GGP = 6, MIB_IPPROTO_HELLO = 7, PROTO_IP_HELLO = 7, MIB_IPPROTO_RIP = 8, PROTO_IP_RIP = 8, MIB_IPPROTO_IS_IS = 9, PROTO_IP_IS_IS = 9, MIB_IPPROTO_ES_IS = 10, PROTO_IP_ES_IS = 10, MIB_IPPROTO_CISCO = 11, PROTO_IP_CISCO = 11, MIB_IPPROTO_BBN = 12, PROTO_IP_BBN = 12, MIB_IPPROTO_OSPF = 13, PROTO_IP_OSPF = 13, MIB_IPPROTO_BGP = 14, PROTO_IP_BGP = 14, <API key> = 10002, <API key> = 10002, <API key> = 10006, PROTO_IP_NT_STATIC = 10006, <API key> = 10007, <API key> = 10007 } NL_ROUTE_PROTOCOL, *PNL_ROUTE_PROTOCOL; typedef enum <API key> { <API key> = 0, <API key>, RouterDiscoveryDhcp, <API key> = -1 } <API key>; typedef enum <API key> { NlsoOther = 0, NlsoManual, NlsoWellKnown, NlsoDhcp, <API key>, NlsoRandom, IpSuffixOriginOther = 0, <API key>, <API key>, IpSuffixOriginDhcp, <API key>, <API key>, <API key> = 1 << 4 } NL_SUFFIX_ORIGIN; typedef struct <API key> { BOOLEAN NlChecksumSupported :1; BOOLEAN NlOptionsSupported :1; BOOLEAN <API key> :1; BOOLEAN <API key> :1; BOOLEAN <API key> :1; BOOLEAN FastPathCompatible : 1; BOOLEAN <API key> :1; BOOLEAN <API key> :1; } <API key>, *<API key>; #endif /*_INC_NLDEF*/
/** * @file * Fighting. */ #include "actions/attack.hpp" #include "actions/advancement.hpp" #include "actions/vision.hpp" #include "ai/lua/aspect_advancements.hpp" #include "formula/callable_objects.hpp" #include "formula/formula.hpp" #include "game_config.hpp" #include "game_data.hpp" #include "game_events/pump.hpp" #include "gettext.hpp" #include "log.hpp" #include "map/map.hpp" #include "mouse_handler_base.hpp" #include "play_controller.hpp" #include "preferences/game.hpp" #include "random.hpp" #include "replay.hpp" #include "resources.hpp" #include "statistics.hpp" #include "synced_checkup.hpp" #include "synced_user_choice.hpp" #include "team.hpp" #include "tod_manager.hpp" #include "units/abilities.hpp" #include "units/animation_component.hpp" #include "units/helper.hpp" #include "units/filter.hpp" #include "units/map.hpp" #include "units/udisplay.hpp" #include "units/unit.hpp" #include "whiteboard/manager.hpp" #include "wml_exception.hpp" static lg::log_domain log_engine("engine"); #define DBG_NG LOG_STREAM(debug, log_engine) #define LOG_NG LOG_STREAM(info, log_engine) #define WRN_NG LOG_STREAM(err, log_engine) #define ERR_NG LOG_STREAM(err, log_engine) static lg::log_domain log_attack("engine/attack"); #define DBG_AT LOG_STREAM(debug, log_attack) #define LOG_AT LOG_STREAM(info, log_attack) #define WRN_AT LOG_STREAM(err, log_attack) #define ERR_AT LOG_STREAM(err, log_attack) static lg::log_domain log_config("config"); #define LOG_CF LOG_STREAM(info, log_config) // BATTLE CONTEXT UNIT STATS <API key>::<API key>(const unit& u, const map_location& u_loc, int u_attack_num, bool attacking, const unit& opp, const map_location& opp_loc, const_attack_ptr opp_weapon, const unit_map& units) : weapon(nullptr) , attack_num(u_attack_num) , is_attacker(attacking) , is_poisoned(u.get_state(unit::STATE_POISONED)) , is_slowed(u.get_state(unit::STATE_SLOWED)) , slows(false) , drains(false) , petrifies(false) , plagues(false) , poisons(false) , backstab_pos(false) , swarm(false) , firststrike(false) , disable(false) , experience(u.experience()) , max_experience(u.max_experience()) , level(u.level()) , rounds(1) , hp(0) , max_hp(u.max_hitpoints()) , chance_to_hit(0) , damage(0) , slow_damage(0) , drain_percent(0) , drain_constant(0) , num_blows(0) , swarm_min(0) , swarm_max(0) , plague_type() { // Get the current state of the unit. if(attack_num >= 0) { weapon = u.attacks()[attack_num].shared_from_this(); } if(u.hitpoints() < 0) { LOG_CF << "Unit with " << u.hitpoints() << " hitpoints found, set to 0 for damage calculations\n"; hp = 0; } else if(u.hitpoints() > u.max_hitpoints()) { // If a unit has more hp than its maximum, the engine will fail with an // assertion failure due to accessing the prob_matrix out of bounds. hp = u.max_hitpoints(); } else { hp = u.hitpoints(); } // Exit if no weapon. if(!weapon) { return; } // Get the weapon characteristics as appropriate. auto ctx = weapon->specials_context(&u, &opp, u_loc, opp_loc, attacking, opp_weapon); boost::optional<decltype(ctx)> opp_ctx; if(opp_weapon) { opp_ctx.emplace(opp_weapon->specials_context(&opp, &u, opp_loc, u_loc, !attacking, weapon)); } slows = weapon->bool_ability("slow"); drains = !opp.get_state("undrainable") && weapon->bool_ability("drains"); petrifies = weapon->bool_ability("petrifies"); poisons = !opp.get_state("unpoisonable") && weapon->bool_ability("poison") && !opp.get_state(unit::STATE_POISONED); backstab_pos = is_attacker && backstab_check(u_loc, opp_loc, units, resources::gameboard->teams()); rounds = weapon->get_specials("berserk").highest("value", 1).first; if(weapon->combat_ability("berserk", 1).second) { rounds = weapon->combat_ability("berserk", 1).first; } firststrike = weapon->bool_ability("firststrike"); { const int distance = distance_between(u_loc, opp_loc); const bool out_of_range = distance > weapon->max_range() || distance < weapon->min_range(); disable = weapon->get_special_bool("disable") || out_of_range; } // Handle plague. unit_ability_list plague_specials = weapon->get_specials("plague"); plagues = !opp.get_state("unplagueable") && !plague_specials.empty() && opp.undead_variation() != "null" && !resources::gameboard->map().is_village(opp_loc); if(plagues) { plague_type = (*plague_specials.front().first)["type"].str(); if(plague_type.empty()) { plague_type = u.type().base_id(); } } // Compute chance to hit. signed int cth = opp.defense_modifier(resources::gameboard->map().get_terrain(opp_loc)) + weapon->accuracy() - (opp_weapon ? opp_weapon->parry() : 0); cth = utils::clamp(cth, 0, 100); unit_ability_list cth_specials = weapon->get_specials("chance_to_hit"); unit_abilities::effect cth_effects(cth_specials, cth, backstab_pos); cth = cth_effects.get_composite_value(); cth = utils::clamp(cth, 0, 100); cth = weapon->combat_ability("chance_to_hit", cth, backstab_pos).first; if(opp.get_state("invulnerable")) { cth = 0; } chance_to_hit = utils::clamp(cth, 0, 100); // Compute base damage done with the weapon. int base_damage = weapon->modified_damage(backstab_pos); // Get the damage multiplier applied to the base damage of the weapon. int damage_multiplier = 100; // Time of day bonus. damage_multiplier += combat_modifier( resources::gameboard->units(), resources::gameboard->map(), u_loc, u.alignment(), u.is_fearless()); // Leadership bonus. int leader_bonus = under_leadership(u, u_loc, weapon, opp_weapon); if(leader_bonus != 0) { damage_multiplier += leader_bonus; } // Resistance modifier. damage_multiplier *= opp.damage_from(*weapon, !attacking, opp_loc, opp_weapon); // Compute both the normal and slowed damage. damage = round_damage(base_damage, damage_multiplier, 10000); slow_damage = round_damage(base_damage, damage_multiplier, 20000); if(is_slowed) { damage = slow_damage; } // Compute drain amounts only if draining is possible. if(drains) { if (weapon->get_special_bool("drains")) { unit_ability_list drain_specials = weapon->get_specials("drains"); // Compute the drain percent (with 50% as the base for backward compatibility) unit_abilities::effect <API key>(drain_specials, 50, backstab_pos); drain_percent = <API key>.get_composite_value(); } if (weapon->combat_ability("drains", 50, backstab_pos).second) { drain_percent = weapon->combat_ability("drains", 50, backstab_pos).first; } } // Add heal_on_hit (the drain constant) unit_ability_list <API key> = weapon->get_specials("heal_on_hit"); unit_abilities::effect heal_on_hit_effects(<API key>, 0, backstab_pos); drain_constant += heal_on_hit_effects.get_composite_value(); drains = drain_constant || drain_percent; // Compute the number of blows and handle swarm. weapon->modified_attacks(backstab_pos, swarm_min, swarm_max); swarm = swarm_min != swarm_max; num_blows = calc_blows(hp); } <API key>::<API key>(const unit_type* u_type, const_attack_ptr att_weapon, bool attacking, const unit_type* opp_type, const_attack_ptr opp_weapon, unsigned int opp_terrain_defense, int lawful_bonus) : weapon(att_weapon) , attack_num(-2) // This is and stays invalid. Always use weapon when using this constructor. , is_attacker(attacking) , is_poisoned(false) , is_slowed(false) , slows(false) , drains(false) , petrifies(false) , plagues(false) , poisons(false) , backstab_pos(false) , swarm(false) , firststrike(false) , disable(false) , experience(0) , max_experience(0) , level(0) , rounds(1) , hp(0) , max_hp(0) , chance_to_hit(0) , damage(0) , slow_damage(0) , drain_percent(0) , drain_constant(0) , num_blows(0) , swarm_min(0) , swarm_max(0) , plague_type() { if(!u_type || !opp_type) { return; } // Get the current state of the unit. if(u_type->hitpoints() < 0) { hp = 0; } else { hp = u_type->hitpoints(); } max_experience = u_type->experience_needed(); level = (u_type->level()); max_hp = (u_type->hitpoints()); // Exit if no weapon. if(!weapon) { return; } // Get the weapon characteristics as appropriate. auto ctx = weapon->specials_context(*u_type, map_location::null_location(), attacking); boost::optional<decltype(ctx)> opp_ctx; if(opp_weapon) { opp_ctx.emplace(opp_weapon->specials_context(*opp_type, map_location::null_location(), !attacking)); } slows = weapon->get_special_bool("slow"); drains = !opp_type->musthave_status("undrainable") && weapon->get_special_bool("drains"); petrifies = weapon->get_special_bool("petrifies"); poisons = !opp_type->musthave_status("unpoisonable") && weapon->get_special_bool("poison"); rounds = weapon->get_specials("berserk").highest("value", 1).first; firststrike = weapon->get_special_bool("firststrike"); disable = weapon->get_special_bool("disable"); unit_ability_list plague_specials = weapon->get_specials("plague"); plagues = !opp_type->musthave_status("unplagueable") && !plague_specials.empty() && opp_type->undead_variation() != "null"; if(plagues) { plague_type = (*plague_specials.front().first)["type"].str(); if(plague_type.empty()) { plague_type = u_type->base_id(); } } signed int cth = 100 - opp_terrain_defense + weapon->accuracy() - (opp_weapon ? opp_weapon->parry() : 0); cth = utils::clamp(cth, 0, 100); unit_ability_list cth_specials = weapon->get_specials("chance_to_hit"); unit_abilities::effect cth_effects(cth_specials, cth, backstab_pos); cth = cth_effects.get_composite_value(); chance_to_hit = utils::clamp(cth, 0, 100); int base_damage = weapon->modified_damage(backstab_pos); int damage_multiplier = 100; damage_multiplier += <API key>(lawful_bonus, u_type->alignment(), u_type->musthave_status("fearless"), 0); damage_multiplier *= opp_type->resistance_against(weapon->type(), !attacking); damage = round_damage(base_damage, damage_multiplier, 10000); slow_damage = round_damage(base_damage, damage_multiplier, 20000); if(drains) { unit_ability_list drain_specials = weapon->get_specials("drains"); // Compute the drain percent (with 50% as the base for backward compatibility) unit_abilities::effect <API key>(drain_specials, 50, backstab_pos); drain_percent = <API key>.get_composite_value(); } // Add heal_on_hit (the drain constant) unit_ability_list <API key> = weapon->get_specials("heal_on_hit"); unit_abilities::effect heal_on_hit_effects(<API key>, 0, backstab_pos); drain_constant += heal_on_hit_effects.get_composite_value(); drains = drain_constant || drain_percent; // Compute the number of blows and handle swarm. weapon->modified_attacks(backstab_pos, swarm_min, swarm_max); swarm = swarm_min != swarm_max; num_blows = calc_blows(hp); } // BATTLE CONTEXT battle_context::battle_context( const unit& attacker, const map_location& a_loc, int a_wep_index, const unit& defender, const map_location& d_loc, int d_wep_index, const unit_map& units) : attacker_stats_() , defender_stats_() , attacker_combatant_() , defender_combatant_() { size_t a_wep_uindex = static_cast<size_t>(a_wep_index); size_t d_wep_uindex = static_cast<size_t>(d_wep_index); const_attack_ptr a_wep(a_wep_uindex < attacker.attacks().size() ? attacker.attacks()[a_wep_index].shared_from_this() : nullptr); const_attack_ptr d_wep(d_wep_uindex < defender.attacks().size() ? defender.attacks()[d_wep_index].shared_from_this() : nullptr); attacker_stats_.reset(new <API key>(attacker, a_loc, a_wep_index, true , defender, d_loc, d_wep, units)); defender_stats_.reset(new <API key>(defender, d_loc, d_wep_index, false, attacker, a_loc, a_wep, units)); } void battle_context::simulate(const combatant* prev_def) { assert((attacker_combatant_.get() != nullptr) == (defender_combatant_.get() != nullptr)); assert(attacker_stats_); assert(defender_stats_); if(!attacker_combatant_) { attacker_combatant_.reset(new combatant(*attacker_stats_)); defender_combatant_.reset(new combatant(*defender_stats_, prev_def)); attacker_combatant_->fight(*defender_combatant_); } } // more like a factory method than a constructor, always calls one of the other constructors. battle_context::battle_context(const unit_map& units, const map_location& attacker_loc, const map_location& defender_loc, int attacker_weapon, int defender_weapon, double aggression, const combatant* prev_def, const unit* attacker_ptr, const unit* defender_ptr) : attacker_stats_(nullptr) , defender_stats_(nullptr) , attacker_combatant_(nullptr) , defender_combatant_(nullptr) { //TODO: maybe check before dereferencing units.find(attacker_loc),units.find(defender_loc) ? const unit& attacker = attacker_ptr ? *attacker_ptr : *units.find(attacker_loc); const unit& defender = defender_ptr ? *defender_ptr : *units.find(defender_loc); const double harm_weight = 1.0 - aggression; if(attacker_weapon == -1) { *this = <API key>( attacker, defender, units, attacker_loc, defender_loc, harm_weight, prev_def ); } else if(defender_weapon == -1) { *this = <API key>( attacker, defender, attacker_weapon, units, attacker_loc, defender_loc, prev_def ); } else { *this = battle_context(attacker, attacker_loc, attacker_weapon, defender, defender_loc, defender_weapon, units); } assert(attacker_stats_); assert(defender_stats_); } battle_context::battle_context(const <API key>& att, const <API key>& def) : attacker_stats_(new <API key>(att)) , defender_stats_(new <API key>(def)) , attacker_combatant_(nullptr) , defender_combatant_(nullptr) { } /** @todo FIXME: better to initialize combatant initially (move into <API key>?), just do fight() when required. */ const combatant& battle_context::<API key>(const combatant* prev_def) { // We calculate this lazily, since AI doesn't always need it. simulate(prev_def); return *attacker_combatant_; } const combatant& battle_context::<API key>(const combatant* prev_def) { // We calculate this lazily, since AI doesn't always need it. simulate(prev_def); return *defender_combatant_; } // Given this harm_weight, are we better than that other context? bool battle_context::better_attack(class battle_context& that, double harm_weight) { return better_combat( <API key>(), <API key>(), that.<API key>(), that.<API key>(), harm_weight ); } // Given this harm_weight, are we better than that other context? bool battle_context::better_defense(class battle_context& that, double harm_weight) { return better_combat( <API key>(), <API key>(), that.<API key>(), that.<API key>(), harm_weight ); } // Does combat A give us a better result than combat B? bool battle_context::better_combat(const combatant& us_a, const combatant& them_a, const combatant& us_b, const combatant& them_b, double harm_weight) { double a, b; // Compare: P(we kill them) - P(they kill us). a = them_a.hp_dist[0] - us_a.hp_dist[0] * harm_weight; b = them_b.hp_dist[0] - us_b.hp_dist[0] * harm_weight; if(a - b < -0.01) { return false; } if(a - b > 0.01) { return true; } // Add poison to calculations double poison_a_us = (us_a.poisoned) * game_config::poison_amount; double poison_a_them = (them_a.poisoned) * game_config::poison_amount; double poison_b_us = (us_b.poisoned) * game_config::poison_amount; double poison_b_them = (them_b.poisoned) * game_config::poison_amount; // Compare: damage to them - damage to us (average_hp replaces -damage) a = (us_a.average_hp() - poison_a_us) * harm_weight - (them_a.average_hp() - poison_a_them); b = (us_b.average_hp() - poison_b_us) * harm_weight - (them_b.average_hp() - poison_b_them); if(a - b < -0.01) { return false; } if(a - b > 0.01) { return true; } // All else equal: go for most damage. return them_a.average_hp() < them_b.average_hp(); } battle_context battle_context::<API key>(const unit& attacker, const unit& defender, const unit_map& units, const map_location& attacker_loc, const map_location& defender_loc, double harm_weight, const combatant* prev_def) { log_scope2(log_attack, "<API key>"); std::vector<battle_context> choices; // What options does attacker have? for(size_t i = 0; i < attacker.attacks().size(); ++i) { const attack_type& att = attacker.attacks()[i]; if(att.attack_weight() <= 0) { continue; } battle_context bc = <API key>(attacker, defender, i, units, attacker_loc, defender_loc, prev_def); //<API key> will always choose the weapon that disabels the attackers weapon if possible. if(bc.attacker_stats_->disable) { continue; } choices.emplace_back(std::move(bc)); } if(choices.empty()) { return battle_context(attacker, attacker_loc, -1, defender, defender_loc, -1, units); } if(choices.size() == 1) { return std::move(choices[0]); } // Multiple options: simulate them, save best. battle_context* best_choice = nullptr; for(auto& choice : choices) { // If <API key> didn't simulate, do so now. choice.simulate(prev_def); if(!best_choice || choice.better_attack(*best_choice, harm_weight)) { best_choice = &choice; } } if(best_choice) { return std::move(*best_choice); } else { return battle_context(attacker, attacker_loc, -1, defender, defender_loc, -1, units); } } /** @todo FIXME: Hand previous defender unit in here. */ battle_context battle_context::<API key>(const unit& attacker, const unit& defender, unsigned attacker_weapon, const unit_map& units, const map_location& attacker_loc, const map_location& defender_loc, const combatant* prev_def) { log_scope2(log_attack, "<API key>"); VALIDATE(attacker_weapon < attacker.attacks().size(), _("An invalid attacker weapon got selected.")); const attack_type& att = attacker.attacks()[attacker_weapon]; auto no_weapon = [&]() { return battle_context(attacker, attacker_loc, attacker_weapon, defender, defender_loc, -1, units); }; std::vector<battle_context> choices; // What options does defender have? for(size_t i = 0; i < defender.attacks().size(); ++i) { const attack_type& def = defender.attacks()[i]; if(def.range() != att.range() || def.defense_weight() <= 0) { //no need to calculate the battle_context here. continue; } battle_context bc(attacker, attacker_loc, attacker_weapon, defender, defender_loc, i, units); if(bc.defender_stats_->disable) { continue; } if(bc.attacker_stats_->disable) { //the defenders attack disables the attakers attack: always choose this one. return bc; } choices.emplace_back(std::move(bc)); } if(choices.empty()) { return no_weapon(); } if(choices.size() == 1) { //only one usable weapon, don't simulate return std::move(choices[0]); } // Multiple options: // First pass : get the best weight and the minimum simple rating for this weight. // simple rating = number of blows * damage per blows (resistance taken in account) * cth * weight // Eligible attacks for defense should have a simple rating greater or equal to this weight. int min_rating = 0; { double max_weight = 0.0; for(const auto& choice : choices) { const attack_type& def = defender.attacks()[choice.defender_stats_->attack_num]; if(def.defense_weight() >= max_weight) { const <API key>& def_stats = *choice.defender_stats_; max_weight = def.defense_weight(); int rating = static_cast<int>( def_stats.num_blows * def_stats.damage * def_stats.chance_to_hit * def.defense_weight()); if(def.defense_weight() > max_weight || rating < min_rating) { min_rating = rating; } } } } battle_context* best_choice = nullptr; // Multiple options: simulate them, save best. for(auto& choice : choices) { const attack_type& def = defender.attacks()[choice.defender_stats_->attack_num]; choice.simulate(prev_def); int simple_rating = static_cast<int>( choice.defender_stats_->num_blows * choice.defender_stats_->damage * choice.defender_stats_->chance_to_hit * def.defense_weight()); //FIXME: make sure there is no mostake in the better_combat call- if(simple_rating >= min_rating && (!best_choice || choice.better_defense(*best_choice, 1.0))) { best_choice = &choice; } } return best_choice ? std::move(*best_choice) : no_weapon(); } // HELPERS namespace { void <API key>(int& weap_index, const std::string& weap_id, attack_itors attacks) { // No attacks to choose from. if(attacks.empty()) { weap_index = -1; return; } // The currently selected attack fits. if(weap_index >= 0 && weap_index < static_cast<int>(attacks.size()) && attacks[weap_index].id() == weap_id) { return; } // Look up the weapon by id. if(!weap_id.empty()) { for(int i = 0; i < static_cast<int>(attacks.size()); ++i) { if(attacks[i].id() == weap_id) { weap_index = i; return; } } } // Lookup has failed. weap_index = -1; return; } /** Helper class for performing an attack. */ class attack { public: attack(const map_location& attacker, const map_location& defender, int attack_with, int defend_with, bool update_display = true); void perform(); private: class <API key> { }; bool perform_hit(bool, statistics::attack_context&); void fire_event(const std::string& n); void refresh_bc(); /** Structure holding unit info used in the attack action. */ struct unit_info { const map_location loc_; int weapon_; unit_map& units_; std::size_t id_; /**< unit.underlying_id() */ std::string weap_id_; int orig_attacks_; int n_attacks_; /**< Number of attacks left. */ int cth_; int damage_; int xp_; unit_info(const map_location& loc, int weapon, unit_map& units); unit& get_unit(); bool valid(); std::string dump(); }; /** * Used in perform_hit to confirm a replay is in sync. * Check OOS_error_ after this method, true if error detected. */ void <API key>(bool&, int, int&, config, unit_info&); void unit_killed( unit_info&, unit_info&, const <API key>*&, const <API key>*&, bool); std::unique_ptr<battle_context> bc_; const <API key>* a_stats_; const <API key>* d_stats_; int abs_n_attack_, abs_n_defend_; // update_att_fog_ is not used, other than making some code simpler. bool update_att_fog_, update_def_fog_, update_minimap_; unit_info a_, d_; unit_map& units_; std::ostringstream errbuf_; bool update_display_; bool OOS_error_; bool use_prng_; std::vector<bool> prng_attacker_; std::vector<bool> prng_defender_; }; attack::unit_info::unit_info(const map_location& loc, int weapon, unit_map& units) : loc_(loc) , weapon_(weapon) , units_(units) , id_() , weap_id_() , orig_attacks_(0) , n_attacks_(0) , cth_(0) , damage_(0) , xp_(0) { unit_map::iterator i = units_.find(loc_); if(!i.valid()) { return; } id_ = i->underlying_id(); } unit& attack::unit_info::get_unit() { unit_map::iterator i = units_.find(loc_); assert(i.valid() && i->underlying_id() == id_); return *i; } bool attack::unit_info::valid() { unit_map::iterator i = units_.find(loc_); return i.valid() && i->underlying_id() == id_; } std::string attack::unit_info::dump() { std::stringstream s; s << get_unit().type_id() << " (" << loc_.wml_x() << ',' << loc_.wml_y() << ')'; return s.str(); } attack::attack(const map_location& attacker, const map_location& defender, int attack_with, int defend_with, bool update_display) : bc_(nullptr) , a_stats_(nullptr) , d_stats_(nullptr) , abs_n_attack_(0) , abs_n_defend_(0) , update_att_fog_(false) , update_def_fog_(false) , update_minimap_(false) , a_(attacker, attack_with, resources::gameboard->units()) , d_(defender, defend_with, resources::gameboard->units()) , units_(resources::gameboard->units()) , errbuf_() , update_display_(update_display) , OOS_error_(false) //new experimental prng mode. , use_prng_(preferences::get("use_prng") == "yes" && randomness::generator->is_networked() == false) { if(use_prng_) { std::cerr << "Using experimental PRNG for combat\n"; } } void attack::fire_event(const std::string& n) { LOG_NG << "attack: firing '" << n << "' event\n"; // prepare the event data for weapon filtering config ev_data; config& a_weapon_cfg = ev_data.add_child("first"); config& d_weapon_cfg = ev_data.add_child("second"); // Need these to ensure weapon filters work correctly boost::optional<attack_type::specials_context_t> a_ctx, d_ctx; if(a_stats_->weapon != nullptr && a_.valid()) { if(d_stats_->weapon != nullptr && d_.valid()) { a_ctx.emplace(a_stats_->weapon->specials_context(nullptr, nullptr, a_.loc_, d_.loc_, true, d_stats_->weapon)); } else { a_ctx.emplace(a_stats_->weapon->specials_context(nullptr, a_.loc_, true)); } a_stats_->weapon->write(a_weapon_cfg); } if(d_stats_->weapon != nullptr && d_.valid()) { if(a_stats_->weapon != nullptr && a_.valid()) { d_ctx.emplace(d_stats_->weapon->specials_context(nullptr, nullptr, d_.loc_, a_.loc_, false, a_stats_->weapon)); } else { d_ctx.emplace(d_stats_->weapon->specials_context(nullptr, d_.loc_, false)); } d_stats_->weapon->write(d_weapon_cfg); } if(a_weapon_cfg["name"].empty()) { a_weapon_cfg["name"] = "none"; } if(d_weapon_cfg["name"].empty()) { d_weapon_cfg["name"] = "none"; } if(n == "attack_end") { // We want to fire attack_end event in any case! Even if one of units was removed by WML. resources::game_events->pump().fire(n, a_.loc_, d_.loc_, ev_data); return; } // damage_inflicted is set in these two events. // TODO: should we set this value from unit_info::damage, or continue using the WML variable? if(n == "attacker_hits" || n == "defender_hits") { ev_data["damage_inflicted"] = resources::gamedata->get_variable("damage_inflicted"); } const int defender_side = d_.get_unit().side(); bool wml_aborted; std::tie(std::ignore, wml_aborted) = resources::game_events->pump().fire(n, game_events::entity_location(a_.loc_, a_.id_), game_events::entity_location(d_.loc_, d_.id_), ev_data); // The event could have killed either the attacker or // defender, so we have to make sure they still exist. refresh_bc(); if(wml_aborted || !a_.valid() || !d_.valid() || !resources::gameboard->get_team(a_.get_unit().side()).is_enemy(d_.get_unit().side()) ) { actions::recalculate_fog(defender_side); if(update_display_) { display::get_singleton()->redraw_minimap(); } fire_event("attack_end"); throw <API key>(); } } void attack::refresh_bc() { // Fix index of weapons. if(a_.valid()) { <API key>(a_.weapon_, a_.weap_id_, a_.get_unit().attacks()); } if(d_.valid()) { <API key>(d_.weapon_, d_.weap_id_, d_.get_unit().attacks()); } if(!a_.valid() || !d_.valid()) { // Fix pointer to weapons. const_cast<<API key>*>(a_stats_)->weapon = a_.valid() && a_.weapon_ >= 0 ? a_.get_unit().attacks()[a_.weapon_].shared_from_this() : nullptr; const_cast<<API key>*>(d_stats_)->weapon = d_.valid() && d_.weapon_ >= 0 ? d_.get_unit().attacks()[d_.weapon_].shared_from_this() : nullptr; return; } bc_.reset(new battle_context(units_, a_.loc_, d_.loc_, a_.weapon_, d_.weapon_)); a_stats_ = &bc_->get_attacker_stats(); d_stats_ = &bc_->get_defender_stats(); a_.cth_ = a_stats_->chance_to_hit; d_.cth_ = d_stats_->chance_to_hit; a_.damage_ = a_stats_->damage; d_.damage_ = d_stats_->damage; } bool attack::perform_hit(bool attacker_turn, statistics::attack_context& stats) { unit_info& attacker = attacker_turn ? a_ : d_; unit_info& defender = attacker_turn ? d_ : a_; // NOTE: we need to use a <API key> here so a_stats_ and d_stats_ can be // modified without. Using a pointer directly would render them invalid when that happened. const <API key>*& attacker_stats = attacker_turn ? a_stats_ : d_stats_; const <API key>*& defender_stats = attacker_turn ? d_stats_ : a_stats_; int& abs_n = attacker_turn ? abs_n_attack_ : abs_n_defend_; bool& update_fog = attacker_turn ? update_def_fog_ : update_att_fog_; int ran_num; if(use_prng_) { std::vector<bool>& prng_seq = attacker_turn ? prng_attacker_ : prng_defender_; if(prng_seq.empty()) { const int ntotal = attacker.cth_*attacker.n_attacks_; int num_hits = ntotal/100; const int <API key> = ntotal%100; if(<API key> > 0 && randomness::generator->get_random_int(0, 99) < <API key>) { ++num_hits; } std::vector<int> indexes; for(int i = 0; i != attacker.n_attacks_; ++i) { prng_seq.push_back(false); indexes.push_back(i); } for(int i = 0; i != num_hits; ++i) { int n = randomness::generator->get_random_int(0, static_cast<int>(indexes.size())-1); prng_seq[indexes[n]] = true; indexes.erase(indexes.begin() + n); } } bool does_hit = prng_seq.back(); prng_seq.pop_back(); ran_num = does_hit ? 0 : 99; } else { ran_num = randomness::generator->get_random_int(0, 99); } bool hits = (ran_num < attacker.cth_); int damage = 0; if(hits) { damage = attacker.damage_; resources::gamedata->get_variable("damage_inflicted") = damage; } // Make sure that if we're serializing a game here, // we got the same results as the game did originally. const config local_results {"chance", attacker.cth_, "hits", hits, "damage", damage}; config replay_results; bool equals_replay = checkup_instance->local_checkup(local_results, replay_results); if(!equals_replay) { <API key>(hits, ran_num, damage, replay_results, attacker); } // can do no more damage than the defender has hitpoints int damage_done = std::min<int>(defender.get_unit().hitpoints(), attacker.damage_); // expected damage = damage potential * chance to hit (as a percentage) double expected_damage = damage_done * attacker.cth_ * 0.01; if(attacker_turn) { stats.<API key>(expected_damage, 0); } else { stats.<API key>(0, expected_damage); } int drains_damage = 0; if(hits && attacker_stats->drains) { drains_damage = damage_done * attacker_stats->drain_percent / 100 + attacker_stats->drain_constant; // don't drain so much that the attacker gets more than his maximum hitpoints drains_damage = std::min<int>(drains_damage, attacker.get_unit().max_hitpoints() - attacker.get_unit().hitpoints()); // if drain is negative, don't allow drain to kill the attacker drains_damage = std::max<int>(drains_damage, 1 - attacker.get_unit().hitpoints()); } if(update_display_) { std::ostringstream float_text; std::vector<std::string> extra_hit_sounds; if(hits) { const unit& defender_unit = defender.get_unit(); if(attacker_stats->poisons && !defender_unit.get_state(unit::STATE_POISONED)) { float_text << (defender_unit.gender() == unit_race::FEMALE ? _("female^poisoned") : _("poisoned")) << '\n'; extra_hit_sounds.push_back(game_config::sounds::status::poisoned); } if(attacker_stats->slows && !defender_unit.get_state(unit::STATE_SLOWED)) { float_text << (defender_unit.gender() == unit_race::FEMALE ? _("female^slowed") : _("slowed")) << '\n'; extra_hit_sounds.push_back(game_config::sounds::status::slowed); } if(attacker_stats->petrifies) { float_text << (defender_unit.gender() == unit_race::FEMALE ? _("female^petrified") : _("petrified")) << '\n'; extra_hit_sounds.push_back(game_config::sounds::status::petrified); } } unit_display::unit_attack( game_display::get_singleton(), *resources::gameboard, attacker.loc_, defender.loc_, damage, *attacker_stats->weapon, defender_stats->weapon, abs_n, float_text.str(), drains_damage, "", &extra_hit_sounds ); } bool dies = defender.get_unit().take_hit(damage); LOG_NG << "defender took " << damage << (dies ? " and died\n" : "\n"); if(attacker_turn) { stats.attack_result(hits ? (dies ? statistics::attack_context::KILLS : statistics::attack_context::HITS) : statistics::attack_context::MISSES, attacker.cth_, damage_done, drains_damage ); } else { stats.defend_result(hits ? (dies ? statistics::attack_context::KILLS : statistics::attack_context::HITS) : statistics::attack_context::MISSES, attacker.cth_, damage_done, drains_damage ); } replay_results.clear(); // There was also a attribute cfg["unit_hit"] which was never used so i deleted. equals_replay = checkup_instance->local_checkup(config{"dies", dies}, replay_results); if(!equals_replay) { bool results_dies = replay_results["dies"].to_bool(); errbuf_ << "SYNC: In attack " << a_.dump() << " vs " << d_.dump() << ": the data source says the " << (attacker_turn ? "defender" : "attacker") << ' ' << (results_dies ? "perished" : "survived") << " while in-game calculations show it " << (dies ? "perished" : "survived") << " (over-riding game calculations with data source results)\n"; dies = results_dies; // Set hitpoints to 0 so later checks don't invalidate the death. if(results_dies) { defender.get_unit().set_hitpoints(0); } OOS_error_ = true; } if(hits) { try { fire_event(attacker_turn ? "attacker_hits" : "defender_hits"); } catch(const <API key>&) { refresh_bc(); return false; } } else { try { fire_event(attacker_turn ? "attacker_misses" : "defender_misses"); } catch(const <API key>&) { refresh_bc(); return false; } } refresh_bc(); bool attacker_dies = false; if(drains_damage > 0) { attacker.get_unit().heal(drains_damage); } else if(drains_damage < 0) { attacker_dies = attacker.get_unit().take_hit(-drains_damage); } if(dies) { unit_killed(attacker, defender, attacker_stats, defender_stats, false); update_fog = true; } if(attacker_dies) { unit_killed(defender, attacker, defender_stats, attacker_stats, true); (attacker_turn ? update_att_fog_ : update_def_fog_) = true; } if(dies) { update_minimap_ = true; return false; } if(hits) { unit& defender_unit = defender.get_unit(); if(attacker_stats->poisons && !defender_unit.get_state(unit::STATE_POISONED)) { defender_unit.set_state(unit::STATE_POISONED, true); LOG_NG << "defender poisoned\n"; } if(attacker_stats->slows && !defender_unit.get_state(unit::STATE_SLOWED)) { defender_unit.set_state(unit::STATE_SLOWED, true); update_fog = true; defender.damage_ = defender_stats->slow_damage; LOG_NG << "defender slowed\n"; } // If the defender is petrified, the fight stops immediately if(attacker_stats->petrifies) { defender_unit.set_state(unit::STATE_PETRIFIED, true); update_fog = true; attacker.n_attacks_ = 0; defender.n_attacks_ = -1; // Petrified. resources::game_events->pump().fire("petrified", defender.loc_, attacker.loc_); refresh_bc(); } } // Delay until here so that poison and slow go through if(attacker_dies) { update_minimap_ = true; return false; } --attacker.n_attacks_; return true; } void attack::unit_killed(unit_info& attacker, unit_info& defender, const <API key>*& attacker_stats, const <API key>*& defender_stats, bool drain_killed) { attacker.xp_ = game_config::kill_xp(defender.get_unit().level()); defender.xp_ = 0; display::get_singleton()->invalidate(attacker.loc_); game_events::entity_location death_loc(defender.loc_, defender.id_); game_events::entity_location attacker_loc(attacker.loc_, attacker.id_); std::string undead_variation = defender.get_unit().undead_variation(); fire_event("attack_end"); refresh_bc(); // Get weapon info for last_breath and die events. config dat; config a_weapon_cfg = attacker_stats->weapon && attacker.valid() ? attacker_stats->weapon->to_config() : config(); config d_weapon_cfg = defender_stats->weapon && defender.valid() ? defender_stats->weapon->to_config() : config(); if(a_weapon_cfg["name"].empty()) { a_weapon_cfg["name"] = "none"; } if(d_weapon_cfg["name"].empty()) { d_weapon_cfg["name"] = "none"; } dat.add_child("first", d_weapon_cfg); dat.add_child("second", a_weapon_cfg); resources::game_events->pump().fire("last_breath", death_loc, attacker_loc, dat); refresh_bc(); // WML has invalidated the dying unit, abort. if(!defender.valid() || defender.get_unit().hitpoints() > 0) { return; } if(!attacker.valid()) { unit_display::unit_die( defender.loc_, defender.get_unit(), nullptr, defender_stats->weapon ); } else { unit_display::unit_die( defender.loc_, defender.get_unit(), attacker_stats->weapon, defender_stats->weapon, attacker.loc_, &attacker.get_unit() ); } resources::game_events->pump().fire("die", death_loc, attacker_loc, dat); refresh_bc(); if(!defender.valid() || defender.get_unit().hitpoints() > 0) { // WML has invalidated the dying unit, abort return; } units_.erase(defender.loc_); resources::whiteboard->on_kill_unit(); // Plague units make new units on the target hex. if(attacker.valid() && attacker_stats->plagues && !drain_killed) { LOG_NG << "trying to reanimate " << attacker_stats->plague_type << '\n'; if(const unit_type* reanimator = unit_types.find(attacker_stats->plague_type)) { LOG_NG << "found unit type:" << reanimator->id() << '\n'; unit_ptr newunit = unit::create(*reanimator, attacker.get_unit().side(), true, unit_race::MALE); newunit->set_attacks(0); newunit->set_movement(0, true); newunit->set_facing(map_location::get_opposite_dir(attacker.get_unit().facing())); // Apply variation if(undead_variation != "null") { config mod; config& variation = mod.add_child("effect"); variation["apply_to"] = "variation"; variation["name"] = undead_variation; newunit->add_modification("variation", mod); newunit->heal_fully(); } newunit->set_location(death_loc); units_.insert(newunit); game_events::entity_location reanim_loc(defender.loc_, newunit->underlying_id()); resources::game_events->pump().fire("unit_placed", reanim_loc); preferences::encountered_units().insert(newunit->type_id()); if(update_display_) { display::get_singleton()->invalidate(death_loc); } } } else { LOG_NG << "unit not reanimated\n"; } } void attack::perform() { // Stop the user from issuing any commands while the units are fighting. const events::command_disabler disable_commands; if(!a_.valid() || !d_.valid()) { return; } // no attack weapon => stop here and don't attack if(a_.weapon_ < 0) { a_.get_unit().set_attacks(a_.get_unit().attacks_left() - 1); a_.get_unit().set_movement(-1, true); return; } if(a_.get_unit().attacks_left() <= 0) { LOG_NG << "attack::perform(): not enough ap.\n"; return; } a_.get_unit().set_facing(a_.loc_.get_relative_dir(d_.loc_)); d_.get_unit().set_facing(d_.loc_.get_relative_dir(a_.loc_)); a_.get_unit().set_attacks(a_.get_unit().attacks_left() - 1); VALIDATE(a_.weapon_ < static_cast<int>(a_.get_unit().attacks().size()), _("An invalid attacker weapon got selected.")); a_.get_unit().set_movement(a_.get_unit().movement_left() - a_.get_unit().attacks()[a_.weapon_].movement_used(), true); a_.get_unit().set_state(unit::STATE_NOT_MOVED, false); a_.get_unit().set_resting(false); d_.get_unit().set_resting(false); // If the attacker was invisible, she isn't anymore! a_.get_unit().set_state(unit::STATE_UNCOVERED, true); bc_.reset(new battle_context(units_, a_.loc_, d_.loc_, a_.weapon_, d_.weapon_)); a_stats_ = &bc_->get_attacker_stats(); d_stats_ = &bc_->get_defender_stats(); if(a_stats_->disable) { LOG_NG << "attack::perform(): tried to attack with a disabled attack.\n"; return; } if(a_stats_->weapon) { a_.weap_id_ = a_stats_->weapon->id(); } if(d_stats_->weapon) { d_.weap_id_ = d_stats_->weapon->id(); } try { fire_event("attack"); } catch(const <API key>&) { return; } refresh_bc(); DBG_NG << "getting attack statistics\n"; statistics::attack_context attack_stats( a_.get_unit(), d_.get_unit(), a_stats_->chance_to_hit, d_stats_->chance_to_hit); a_.orig_attacks_ = a_stats_->num_blows; d_.orig_attacks_ = d_stats_->num_blows; a_.n_attacks_ = a_.orig_attacks_; d_.n_attacks_ = d_.orig_attacks_; a_.xp_ = game_config::combat_xp(d_.get_unit().level()); d_.xp_ = game_config::combat_xp(a_.get_unit().level()); bool <API key> = (d_stats_->firststrike && !a_stats_->firststrike); unsigned int rounds = std::max<unsigned int>(a_stats_->rounds, d_stats_->rounds) - 1; const int defender_side = d_.get_unit().side(); LOG_NG << "Fight: (" << a_.loc_ << ") vs (" << d_.loc_ << ") ATT: " << a_stats_->weapon->name() << " " << a_stats_->damage << "-" << a_stats_->num_blows << "(" << a_stats_->chance_to_hit << "%) vs DEF: " << (d_stats_->weapon ? d_stats_->weapon->name() : "none") << " " << d_stats_->damage << "-" << d_stats_->num_blows << "(" << d_stats_->chance_to_hit << "%)" << (<API key> ? " defender first-strike" : "") << "\n"; // Play the pre-fight animation unit_display::unit_draw_weapon(a_.loc_, a_.get_unit(), a_stats_->weapon, d_stats_->weapon, d_.loc_, &d_.get_unit()); for(;;) { DBG_NG << "start of attack loop...\n"; ++abs_n_attack_; if(a_.n_attacks_ > 0 && !<API key>) { if(!perform_hit(true, attack_stats)) { DBG_NG << "broke from attack loop on attacker turn\n"; break; } } // If the defender got to strike first, they use it up here. <API key> = false; ++abs_n_defend_; if(d_.n_attacks_ > 0) { if(!perform_hit(false, attack_stats)) { DBG_NG << "broke from attack loop on defender turn\n"; break; } } // Continue the fight to death; if one of the units got petrified, // either n_attacks or n_defends is -1 if(rounds > 0 && d_.n_attacks_ == 0 && a_.n_attacks_ == 0) { a_.n_attacks_ = a_.orig_attacks_; d_.n_attacks_ = d_.orig_attacks_; --rounds; <API key> = (d_stats_->firststrike && !a_stats_->firststrike); } if(a_.n_attacks_ <= 0 && d_.n_attacks_ <= 0) { fire_event("attack_end"); refresh_bc(); break; } } // Set by attacker_hits and defender_hits events. resources::gamedata->clear_variable("damage_inflicted"); if(update_def_fog_) { actions::recalculate_fog(defender_side); } // TODO: if we knew the viewing team, we could skip this display update if(update_minimap_ && update_display_) { display::get_singleton()->redraw_minimap(); } if(a_.valid()) { unit& u = a_.get_unit(); u.anim_comp().set_standing(); u.set_experience(u.experience() + a_.xp_); } if(d_.valid()) { unit& u = d_.get_unit(); u.anim_comp().set_standing(); u.set_experience(u.experience() + d_.xp_); } unit_display::unit_sheath_weapon(a_.loc_, a_.valid() ? &a_.get_unit() : nullptr, a_stats_->weapon, d_stats_->weapon, d_.loc_, d_.valid() ? &d_.get_unit() : nullptr); if(update_display_) { game_display::get_singleton()->invalidate_unit(); display::get_singleton()->invalidate(a_.loc_); display::get_singleton()->invalidate(d_.loc_); } if(OOS_error_) { replay::process_error(errbuf_.str()); } } void attack::<API key>( bool& hits, int ran_num, int& damage, config replay_results, unit_info& attacker) { int results_chance = replay_results["chance"]; bool results_hits = replay_results["hits"].to_bool(); int results_damage = replay_results["damage"]; #if 0 errbuf_ << "SYNC: In attack " << a_.dump() << " vs " << d_.dump() << " replay data differs from local calculated data:" << " chance to hit in data source: " << results_chance << " chance to hit in calculated: " << attacker.cth_ << " chance to hit in data source: " << results_chance << " chance to hit in calculated: " << attacker.cth_ ; attacker.cth_ = results_chance; hits = results_hits; damage = results_damage; OOS_error_ = true; #endif if(results_chance != attacker.cth_) { errbuf_ << "SYNC: In attack " << a_.dump() << " vs " << d_.dump() << ": chance to hit is inconsistent. Data source: " << results_chance << "; Calculation: " << attacker.cth_ << " (over-riding game calculations with data source results)\n"; attacker.cth_ = results_chance; OOS_error_ = true; } if(results_hits != hits) { errbuf_ << "SYNC: In attack " << a_.dump() << " vs " << d_.dump() << ": the data source says the hit was " << (results_hits ? "successful" : "unsuccessful") << ", while in-game calculations say the hit was " << (hits ? "successful" : "unsuccessful") << " random number: " << ran_num << " = " << (ran_num % 100) << "/" << results_chance << " (over-riding game calculations with data source results)\n"; hits = results_hits; OOS_error_ = true; } if(results_damage != damage) { errbuf_ << "SYNC: In attack " << a_.dump() << " vs " << d_.dump() << ": the data source says the hit did " << results_damage << " damage, while in-game calculations show the hit doing " << damage << " damage (over-riding game calculations with data source results)\n"; damage = results_damage; OOS_error_ = true; } } } // end anonymous namespace // FREE-STANDING FUNCTIONS void attack_unit(const map_location& attacker, const map_location& defender, int attack_with, int defend_with, bool update_display) { attack dummy(attacker, defender, attack_with, defend_with, update_display); dummy.perform(); } void <API key>(const map_location& attacker, const map_location& defender, int attack_with, int defend_with, bool update_display, const ai::<API key>& ai_advancement) { attack_unit(attacker, defender, attack_with, defend_with, update_display); unit_map::const_iterator atku = resources::gameboard->units().find(attacker); if(atku != resources::gameboard->units().end()) { advance_unit_at(advance_unit_params(attacker).ai_advancements(ai_advancement)); } unit_map::const_iterator defu = resources::gameboard->units().find(defender); if(defu != resources::gameboard->units().end()) { advance_unit_at(advance_unit_params(defender).ai_advancements(ai_advancement)); } } int under_leadership(const unit &u, const map_location& loc, const_attack_ptr weapon, const_attack_ptr opp_weapon) { unit_ability_list abil = u.get_abilities("leadership", loc, weapon, opp_weapon); unit_abilities::effect leader_effect(abil, 0, false); return leader_effect.get_composite_value(); } //begin of weapon emulates function. bool unit::<API key>(const config& cfg, bool attacker, int res) const { if(!(cfg["active_on"].empty() || (attacker && cfg["active_on"] == "offense") || (!attacker && cfg["active_on"] == "defense"))) { return false; } if(!unit_abilities::filter_base_matches(cfg, res)) { return false; } return true; } //functions for emulate weapon specials. //filter opponent and affect self/opponent/both option. bool unit::<API key>(const std::string& ability, const std::string& filter_attacker , const config& cfg, const map_location& loc, const unit& u2) const { const config &filter = cfg.child(filter_attacker); if(!filter) { return true; } return unit_filter(vconfig(filter)).set_use_flat_tod(ability == "illuminates").matches(*this, loc, u2); } static bool <API key>(const unit_map::const_iterator un, const unit_map::const_iterator up, const std::string& ability, const config& cfg, const map_location& loc, const map_location& opp_loc, bool attacker ) { if(!up-><API key>(ability, "filter_opponent", cfg, opp_loc, *un)){ return true; } if(!un-><API key>(ability, "filter_student", cfg, loc, *up)){ return true; } if((attacker && !un-><API key>(ability, "filter_attacker", cfg, loc, *up)) || (!attacker && !up-><API key>(ability, "filter_attacker", cfg, opp_loc, *un))){ return true; } if((!attacker && !un-><API key>(ability, "filter_defender", cfg, loc, *up)) || (attacker && !up-><API key>(ability, "filter_defender", cfg, opp_loc, *un))){ return true; } return false; } bool <API key>(const std::string& ability,const unit_map& units, const map_location& loc, bool attacker, const_attack_ptr weapon,const_attack_ptr opp_weapon) { const unit_map::const_iterator un = units.find(loc); if(un == units.end()) { return false; } unit_ability_list abil = un->get_abilities(ability, weapon, opp_weapon); for(unit_ability_list::iterator i = abil.begin(); i != abil.end();) { const std::string& apply_to = (*i->first)["apply_to"]; if(apply_to.empty() || apply_to == "both" || apply_to == "self") { return true; } if(attacker && apply_to == "attacker") { return true; } if(!attacker && apply_to == "defender") { return true; } ++i; } return false; } bool <API key>(const std::string& ability,const unit_map& units, const map_location& loc, bool attacker, const_attack_ptr weapon,const_attack_ptr opp_weapon) { const unit_map::const_iterator un = units.find(loc); if(un == units.end()) { return false; } unit_ability_list abil = un->get_abilities(ability, weapon, opp_weapon); for(unit_ability_list::iterator i = abil.begin(); i != abil.end();) { const std::string& apply_to = (*i->first)["apply_to"]; if(apply_to == "both" || apply_to == "opponent") { return true; } if(attacker && apply_to == "defender") { return true; } if(!attacker && apply_to == "attacker") { return true; } ++i; } return false; } //sub function for emulate chance_to_hit,damage drains and attacks special. std::pair<int, bool> ability_leadership(const std::string& ability,const unit_map& units, const map_location& loc, const map_location& opp_loc, bool attacker, int abil_value, bool backstab_pos, const_attack_ptr weapon, const_attack_ptr opp_weapon) { const unit_map::const_iterator un = units.find(loc); const unit_map::const_iterator up = units.find(opp_loc); if(un == units.end()) { return {abil_value, false}; } unit_ability_list abil = un->get_abilities(ability, weapon, opp_weapon); for(unit_ability_list::iterator i = abil.begin(); i != abil.end();) { const config &filter = (*i->first).child("filter_opponent"); const config &filter_student = (*i->first).child("filter_student"); const config &filter_attacker = (*i->first).child("filter_attacker"); const config &filter_defender = (*i->first).child("filter_defender"); bool show_result = false; if(up == units.end() && !filter_student && !filter && !filter_attacker && !filter_defender) { show_result = un-><API key>(*i->first, attacker, abil_value); } else if(up == units.end() && (filter_student || filter || filter_attacker || filter_defender)) { return {abil_value, false}; } else { show_result = !(!un-><API key>(*i->first, attacker, abil_value) || <API key>(un, up, ability, *i->first, loc, opp_loc, attacker)); } if(!show_result) { i = abil.erase(i); } else { ++i; } } if(!abil.empty()) { unit_abilities::effect leader_effect(abil, abil_value, backstab_pos); return {leader_effect.get_composite_value(), true}; } return {abil_value, false}; } //sub function for wmulate boolean special(slow, poison...) bool bool_leadership(const std::string& ability,const unit_map& units, const map_location& loc, const map_location& opp_loc, bool attacker, const_attack_ptr weapon, const_attack_ptr opp_weapon) { const unit_map::const_iterator un = units.find(loc); const unit_map::const_iterator up = units.find(opp_loc); if(un == units.end() || up == units.end()) { return false; } unit_ability_list abil = un->get_abilities(ability, weapon, opp_weapon); for(unit_ability_list::iterator i = abil.begin(); i != abil.end();) { const std::string& active_on = (*i->first)["active_on"]; if(!(active_on.empty() || (attacker && active_on == "offense") || (!attacker && active_on == "defense")) || <API key>(un, up, ability, *i->first, loc, opp_loc, attacker)) { i = abil.erase(i); } else { ++i; } } if(!abil.empty()) { return true; } return false; } //emulate boolean special for self/adjacent and/or opponent. bool attack_type::bool_ability(const std::string& ability) const { bool abil_bool= get_special_bool(ability); const unit_map& units = display::get_singleton()->get_units(); if(<API key>(ability, units, self_loc_, is_attacker_, shared_from_this(), other_attack_)) { abil_bool = get_special_bool(ability) || bool_leadership(ability, units, self_loc_, other_loc_, is_attacker_, shared_from_this(), other_attack_); } if(<API key>(ability, units, other_loc_, !is_attacker_, other_attack_, shared_from_this())) { abil_bool = get_special_bool(ability) || bool_leadership(ability, units, other_loc_, self_loc_, !is_attacker_, other_attack_, shared_from_this()); } return abil_bool; } //emulate numerical special for self/adjacent and/or opponent. std::pair<int, bool> attack_type::combat_ability(const std::string& ability, int abil_value, bool backstab_pos) const { const unit_map& units = display::get_singleton()->get_units(); if(<API key>(ability, units, self_loc_, is_attacker_, shared_from_this(), other_attack_)) { return ability_leadership(ability, units, self_loc_, other_loc_, is_attacker_, abil_value, backstab_pos, shared_from_this(), other_attack_); } if(<API key>(ability, units, other_loc_, !is_attacker_, other_attack_, shared_from_this())) { return ability_leadership(ability, units, other_loc_,self_loc_, !is_attacker_, abil_value, backstab_pos, other_attack_, shared_from_this()); } return {abil_value, false}; } //end of emulate weapon special functions. int combat_modifier(const unit_map& units, const gamemap& map, const map_location& loc, unit_type::ALIGNMENT alignment, bool is_fearless) { const tod_manager& tod_m = *resources::tod_manager; const time_of_day& effective_tod = tod_m.<API key>(units, map, loc); return combat_modifier(effective_tod, alignment, is_fearless); } int combat_modifier(const time_of_day& effective_tod, unit_type::ALIGNMENT alignment, bool is_fearless) { const tod_manager& tod_m = *resources::tod_manager; const int lawful_bonus = effective_tod.lawful_bonus; return <API key>(lawful_bonus, alignment, is_fearless, tod_m.<API key>()); } int <API key>(int lawful_bonus, unit_type::ALIGNMENT alignment, bool is_fearless, int max_liminal_bonus) { int bonus; switch(alignment.v) { case unit_type::ALIGNMENT::LAWFUL: bonus = lawful_bonus; break; case unit_type::ALIGNMENT::NEUTRAL: bonus = 0; break; case unit_type::ALIGNMENT::CHAOTIC: bonus = -lawful_bonus; break; case unit_type::ALIGNMENT::LIMINAL: bonus = std::max(0, <API key>::abs(lawful_bonus)); break; default: bonus = 0; } if(is_fearless) { bonus = std::max<int>(bonus, 0); } return bonus; } bool backstab_check(const map_location& attacker_loc, const map_location& defender_loc, const unit_map& units, const std::vector<team>& teams) { const unit_map::const_iterator defender = units.find(defender_loc); if(defender == units.end()) { return false; // No defender } <API key> adj; get_adjacent_tiles(defender_loc, adj.data()); unsigned i; for(i = 0; i < adj.size(); ++i) { if(adj[i] == attacker_loc) { break; } } if(i >= 6) { return false; // Attack not from adjacent location } const unit_map::const_iterator opp = units.find(adj[(i + 3) % 6]); // No opposite unit. if(opp == units.end()) { return false; } if(opp->incapacitated()) { return false; } // If sides aren't valid teams, then they are enemies. if(std::size_t(defender->side() - 1) >= teams.size() || std::size_t(opp->side() - 1) >= teams.size()) { return true; } // Defender and opposite are enemies. if(teams[defender->side() - 1].is_enemy(opp->side())) { return true; } // Defender and opposite are friends. return false; }
#!/usr/bin/env python2 import copy import Queue import os import socket import struct import subprocess import sys import threading import time import unittest import dns import dns.message import libnacl import libnacl.utils class DNSDistTest(unittest.TestCase): """ Set up a dnsdist instance and responder threads. Queries sent to dnsdist are relayed to the responder threads, who reply with the response provided by the tests themselves on a queue. Responder threads also queue the queries received from dnsdist on a separate queue, allowing the tests to check that the queries sent from dnsdist were as expected. """ _dnsDistPort = 5340 <API key> = "127.0.0.1" _testServerPort = 5350 _toResponderQueue = Queue.Queue() _fromResponderQueue = Queue.Queue() _queueTimeout = 1 <API key> = 2.0 _dnsdist = None _responsesCounter = {} _shutUp = True _config_params = ['_testServerPort'] _acl = ['127.0.0.1/32'] _consolePort = 5199 _consoleKey = None @classmethod def startResponders(cls): print("Launching responders..") cls._UDPResponder = threading.Thread(name='UDP Responder', target=cls.UDPResponder, args=[cls._testServerPort]) cls._UDPResponder.setDaemon(True) cls._UDPResponder.start() cls._TCPResponder = threading.Thread(name='TCP Responder', target=cls.TCPResponder, args=[cls._testServerPort]) cls._TCPResponder.setDaemon(True) cls._TCPResponder.start() @classmethod def startDNSDist(cls, shutUp=True): print("Launching dnsdist..") conffile = 'dnsdist_test.conf' params = tuple([getattr(cls, param) for param in cls._config_params]) print(params) with open(conffile, 'w') as conf: conf.write("-- Autogenerated by dnsdisttests.py\n") conf.write(cls._config_template % params) dnsdistcmd = [os.environ['DNSDISTBIN'], '-C', conffile, '-l', '%s:%d' % (cls.<API key>, cls._dnsDistPort) ] for acl in cls._acl: dnsdistcmd.extend(['--acl', acl]) print(' '.join(dnsdistcmd)) if shutUp: with open(os.devnull, 'w') as fdDevNull: cls._dnsdist = subprocess.Popen(dnsdistcmd, close_fds=True, stdout=fdDevNull) else: cls._dnsdist = subprocess.Popen(dnsdistcmd, close_fds=True) if 'DNSDIST_FAST_TESTS' in os.environ: delay = 0.5 else: delay = cls.<API key> time.sleep(delay) if cls._dnsdist.poll() is not None: cls._dnsdist.kill() sys.exit(cls._dnsdist.returncode) @classmethod def setUpSockets(cls): print("Setting up UDP socket..") cls._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) cls._sock.settimeout(2.0) cls._sock.connect(("127.0.0.1", cls._dnsDistPort)) @classmethod def setUpClass(cls): cls.startResponders() cls.startDNSDist(cls._shutUp) cls.setUpSockets() print("Launching tests..") @classmethod def tearDownClass(cls): if 'DNSDIST_FAST_TESTS' in os.environ: delay = 0.1 else: delay = 1.0 if cls._dnsdist: cls._dnsdist.terminate() if cls._dnsdist.poll() is None: time.sleep(delay) if cls._dnsdist.poll() is None: cls._dnsdist.kill() cls._dnsdist.wait() @classmethod def <API key>(cls): if threading.currentThread().name in cls._responsesCounter: cls._responsesCounter[threading.currentThread().name] += 1 else: cls._responsesCounter[threading.currentThread().name] = 1 @classmethod def _getResponse(cls, request): response = None if len(request.question) != 1: print("Skipping query with question count %d" % (len(request.question))) return None healthcheck = not str(request.question[0].name).endswith('tests.powerdns.com.') if not healthcheck: cls.<API key>() if not cls._toResponderQueue.empty(): response = cls._toResponderQueue.get(True, cls._queueTimeout) if response: response = copy.copy(response) response.id = request.id cls._fromResponderQueue.put(request, True, cls._queueTimeout) if not response: # unexpected query, or health check response = dns.message.make_response(request) return response @classmethod def UDPResponder(cls, port, ignoreTrailing=False): sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) sock.bind(("127.0.0.1", port)) while True: data, addr = sock.recvfrom(4096) request = dns.message.from_wire(data, ignore_trailing=ignoreTrailing) response = cls._getResponse(request) if not response: continue sock.settimeout(2.0) sock.sendto(response.to_wire(), addr) sock.settimeout(None) sock.close() @classmethod def TCPResponder(cls, port, ignoreTrailing=False, multipleResponses=False): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) try: sock.bind(("127.0.0.1", port)) except socket.error as e: print("Error binding in the TCP responder: %s" % str(e)) sys.exit(1) sock.listen(100) while True: (conn, _) = sock.accept() conn.settimeout(2.0) data = conn.recv(2) (datalen,) = struct.unpack("!H", data) data = conn.recv(datalen) request = dns.message.from_wire(data, ignore_trailing=ignoreTrailing) response = cls._getResponse(request) if not response: conn.close() continue wire = response.to_wire() conn.send(struct.pack("!H", len(wire))) conn.send(wire) while multipleResponses: if cls._toResponderQueue.empty(): break response = cls._toResponderQueue.get(True, cls._queueTimeout) if not response: break response = copy.copy(response) response.id = request.id wire = response.to_wire() try: conn.send(struct.pack("!H", len(wire))) conn.send(wire) except socket.error as e: # some of the tests are going to close # the connection on us, just deal with it break conn.close() sock.close() @classmethod def sendUDPQuery(cls, query, response, useQueue=True, timeout=2.0, rawQuery=False): if useQueue: cls._toResponderQueue.put(response, True, timeout) if timeout: cls._sock.settimeout(timeout) try: if not rawQuery: query = query.to_wire() cls._sock.send(query) data = cls._sock.recv(4096) except socket.timeout: data = None finally: if timeout: cls._sock.settimeout(None) receivedQuery = None message = None if useQueue and not cls._fromResponderQueue.empty(): receivedQuery = cls._fromResponderQueue.get(True, timeout) if data: message = dns.message.from_wire(data) return (receivedQuery, message) @classmethod def openTCPConnection(cls, timeout=None): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if timeout: sock.settimeout(timeout) sock.connect(("127.0.0.1", cls._dnsDistPort)) return sock @classmethod def <API key>(cls, sock, query, rawQuery=False): if not rawQuery: wire = query.to_wire() else: wire = query sock.send(struct.pack("!H", len(wire))) sock.send(wire) @classmethod def <API key>(cls, sock): message = None data = sock.recv(2) if data: (datalen,) = struct.unpack("!H", data) data = sock.recv(datalen) if data: message = dns.message.from_wire(data) return message @classmethod def sendTCPQuery(cls, query, response, useQueue=True, timeout=2.0, rawQuery=False): message = None if useQueue: cls._toResponderQueue.put(response, True, timeout) sock = cls.openTCPConnection(timeout) try: cls.<API key>(sock, query, rawQuery) message = cls.<API key>(sock) except socket.timeout as e: print("Timeout: %s" % (str(e))) except socket.error as e: print("Network error: %s" % (str(e))) finally: sock.close() receivedQuery = None if useQueue and not cls._fromResponderQueue.empty(): receivedQuery = cls._fromResponderQueue.get(True, timeout) return (receivedQuery, message) @classmethod def <API key>(cls, query, responses, useQueue=True, timeout=2.0, rawQuery=False): if useQueue: for response in responses: cls._toResponderQueue.put(response, True, timeout) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if timeout: sock.settimeout(timeout) sock.connect(("127.0.0.1", cls._dnsDistPort)) messages = [] try: if not rawQuery: wire = query.to_wire() else: wire = query sock.send(struct.pack("!H", len(wire))) sock.send(wire) while True: data = sock.recv(2) if not data: break (datalen,) = struct.unpack("!H", data) data = sock.recv(datalen) messages.append(dns.message.from_wire(data)) except socket.timeout as e: print("Timeout: %s" % (str(e))) except socket.error as e: print("Network error: %s" % (str(e))) finally: sock.close() receivedQuery = None if useQueue and not cls._fromResponderQueue.empty(): receivedQuery = cls._fromResponderQueue.get(True, timeout) return (receivedQuery, messages) def setUp(self): # This function is called before every tests # Clear the responses counters for key in self._responsesCounter: self._responsesCounter[key] = 0 # Make sure the queues are empty, in case # a previous test failed while not self._toResponderQueue.empty(): self._toResponderQueue.get(False) while not self._fromResponderQueue.empty(): self._fromResponderQueue.get(False) @classmethod def <API key>(cls): while not cls._toResponderQueue.empty(): cls._toResponderQueue.get(False) @classmethod def <API key>(cls): while not cls._fromResponderQueue.empty(): cls._fromResponderQueue.get(False) @classmethod def <API key>(cls): cls.<API key>() cls.<API key>() @staticmethod def generateConsoleKey(): return libnacl.utils.salsa_key() @classmethod def _encryptConsole(cls, command, nonce): if cls._consoleKey is None: return command return libnacl.crypto_secretbox(command, nonce, cls._consoleKey) @classmethod def _decryptConsole(cls, command, nonce): if cls._consoleKey is None: return command return libnacl.<API key>(command, nonce, cls._consoleKey) @classmethod def sendConsoleCommand(cls, command, timeout=1.0): ourNonce = libnacl.utils.rand_nonce() theirNonce = None sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if timeout: sock.settimeout(timeout) sock.connect(("127.0.0.1", cls._consolePort)) sock.send(ourNonce) theirNonce = sock.recv(len(ourNonce)) halfNonceSize = len(ourNonce) / 2 readingNonce = ourNonce[0:halfNonceSize] + theirNonce[halfNonceSize:] writingNonce = theirNonce[0:halfNonceSize] + ourNonce[halfNonceSize:] msg = cls._encryptConsole(command, writingNonce) sock.send(struct.pack("!I", len(msg))) sock.send(msg) data = sock.recv(4) (responseLen,) = struct.unpack("!I", data) data = sock.recv(responseLen) response = cls._decryptConsole(data, readingNonce) return response
/** * @file mp3lameaudio.c * Interface to libmp3lame for mp3 encoding. */ #include "avcodec.h" #include "mpegaudio.h" #include <lame/lame.h> #define BUFFER_SIZE (7200 + MPA_FRAME_SIZE + MPA_FRAME_SIZE/4) typedef struct Mp3AudioContext { lame_global_flags *gfp; int stereo; uint8_t buffer[BUFFER_SIZE]; int buffer_index; } Mp3AudioContext; static av_cold int MP3lame_encode_init(AVCodecContext *avctx) { Mp3AudioContext *s = avctx->priv_data; if (avctx->channels > 2) return -1; s->stereo = avctx->channels > 1 ? 1 : 0; if ((s->gfp = lame_init()) == NULL) goto err; <API key>(s->gfp, avctx->sample_rate); <API key>(s->gfp, avctx->sample_rate); <API key>(s->gfp, avctx->channels); /* lame 3.91 dies on quality != 5 */ lame_set_quality(s->gfp, 5); /* lame 3.91 doesn't work in mono */ lame_set_mode(s->gfp, JOINT_STEREO); lame_set_brate(s->gfp, avctx->bit_rate/1000); if(avctx->flags & CODEC_FLAG_QSCALE) { lame_set_brate(s->gfp, 0); lame_set_VBR(s->gfp, vbr_default); lame_set_VBR_q(s->gfp, avctx->global_quality / (float)FF_QP2LAMBDA); } <API key>(s->gfp,0); <API key>(s->gfp, avctx->flags2 & <API key> ? 0 : 1); if (lame_init_params(s->gfp) < 0) goto err_close; avctx->frame_size = lame_get_framesize(s->gfp); avctx->coded_frame= avcodec_alloc_frame(); avctx->coded_frame->key_frame= 1; return 0; err_close: lame_close(s->gfp); err: return -1; } static const int sSampleRates[3] = { 44100, 48000, 32000 }; static const int sBitRates[2][3][15] = { { { 0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448}, { 0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384}, { 0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320} }, { { 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256}, { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160} }, }; static const int sSamplesPerFrame[2][3] = { { 384, 1152, 1152 }, { 384, 1152, 576 } }; static const int sBitsPerSlot[3] = { 32, 8, 8 }; static int mp3len(void *data, int *samplesPerFrame, int *sampleRate) { uint32_t header = AV_RB32(data); int layerID = 3 - ((header >> 17) & 0x03); int bitRateID = ((header >> 12) & 0x0f); int sampleRateID = ((header >> 10) & 0x03); int bitsPerSlot = sBitsPerSlot[layerID]; int isPadded = ((header >> 9) & 0x01); static int const mode_tab[4]= {2,3,1,0}; int mode= mode_tab[(header >> 19) & 0x03]; int mpeg_id= mode>0; int temp0, temp1, bitRate; if ( (( header >> 21 ) & 0x7ff) != 0x7ff || mode == 3 || layerID==3 || sampleRateID==3) { return -1; } if(!samplesPerFrame) samplesPerFrame= &temp0; if(!sampleRate ) sampleRate = &temp1; // *isMono = ((header >> 6) & 0x03) == 0x03; *sampleRate = sSampleRates[sampleRateID]>>mode; bitRate = sBitRates[mpeg_id][layerID][bitRateID] * 1000; *samplesPerFrame = sSamplesPerFrame[mpeg_id][layerID]; //av_log(NULL, AV_LOG_DEBUG, "sr:%d br:%d spf:%d l:%d m:%d\n", *sampleRate, bitRate, *samplesPerFrame, layerID, mode); return *samplesPerFrame * bitRate / (bitsPerSlot * *sampleRate) + isPadded; } static int <API key>(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data) { Mp3AudioContext *s = avctx->priv_data; int len; int lame_result; /* lame 3.91 dies on '1-channel interleaved' data */ if(data){ if (s->stereo) { lame_result = <API key>( s->gfp, data, avctx->frame_size, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } else { lame_result = lame_encode_buffer( s->gfp, data, data, avctx->frame_size, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } }else{ lame_result= lame_encode_flush( s->gfp, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } if(lame_result==-1) { /* output buffer too small */ av_log(avctx, AV_LOG_ERROR, "lame: output buffer too small (buffer index: %d, free bytes: %d)\n", s->buffer_index, BUFFER_SIZE - s->buffer_index); return 0; } s->buffer_index += lame_result; if(s->buffer_index<4) return 0; len= mp3len(s->buffer, NULL, NULL); //av_log(avctx, AV_LOG_DEBUG, "in:%d packet-len:%d index:%d\n", avctx->frame_size, len, s->buffer_index); if(len <= s->buffer_index){ memcpy(frame, s->buffer, len); s->buffer_index -= len; memmove(s->buffer, s->buffer+len, s->buffer_index); //FIXME fix the audio codec API, so we do not need the memcpy() /*for(i=0; i<len; i++){ av_log(avctx, AV_LOG_DEBUG, "%2X ", frame[i]); }*/ return len; }else return 0; } static av_cold int <API key>(AVCodecContext *avctx) { Mp3AudioContext *s = avctx->priv_data; av_freep(&avctx->coded_frame); lame_close(s->gfp); return 0; } AVCodec libmp3lame_encoder = { "libmp3lame", CODEC_TYPE_AUDIO, CODEC_ID_MP3, sizeof(Mp3AudioContext), MP3lame_encode_init, <API key>, <API key>, .capabilities= CODEC_CAP_DELAY, };
package org.pouyadr.ui; import android.animation.ObjectAnimator; import android.animation.StateListAnimator; import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Outline; import android.graphics.Typeface; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.text.Html; import android.text.InputType; import android.text.Spannable; import android.text.TextUtils; import android.text.method.LinkMovementMethod; import android.util.Base64; import android.util.Log; import android.util.TypedValue; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.view.ViewTreeObserver; import android.view.animation.<API key>; import android.view.animation.<API key>; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import org.pouyadr.PhoneFormat.PhoneFormat; import org.pouyadr.Pouya.Helper.GhostPorotocol; import org.pouyadr.Pouya.Helper.ThemeChanger; import org.pouyadr.Pouya.Setting.Setting; import org.pouyadr.finalsoft.FontActivity; import org.pouyadr.finalsoft.Fonts; import org.pouyadr.messenger.AndroidUtilities; import org.pouyadr.messenger.AnimationCompat.<API key>; import org.pouyadr.messenger.AnimationCompat.AnimatorSetProxy; import org.pouyadr.messenger.AnimationCompat.ObjectAnimatorProxy; import org.pouyadr.messenger.AnimationCompat.ViewProxy; import org.pouyadr.messenger.ApplicationLoader; import org.pouyadr.messenger.BuildVars; import org.pouyadr.messenger.FileLoader; import org.pouyadr.messenger.FileLog; import org.pouyadr.messenger.LocaleController; import org.pouyadr.messenger.MediaController; import org.pouyadr.messenger.MessageObject; import org.pouyadr.messenger.MessagesController; import org.pouyadr.messenger.MessagesStorage; import org.pouyadr.messenger.NotificationCenter; import org.pouyadr.messenger.R; import org.pouyadr.messenger.UserConfig; import org.pouyadr.messenger.UserObject; import org.pouyadr.messenger.browser.Browser; import org.pouyadr.tgnet.ConnectionsManager; import org.pouyadr.tgnet.RequestDelegate; import org.pouyadr.tgnet.SerializedData; import org.pouyadr.tgnet.TLObject; import org.pouyadr.tgnet.TLRPC; import org.pouyadr.ui.ActionBar.ActionBar; import org.pouyadr.ui.ActionBar.ActionBarMenu; import org.pouyadr.ui.ActionBar.ActionBarMenuItem; import org.pouyadr.ui.ActionBar.BaseFragment; import org.pouyadr.ui.ActionBar.BottomSheet; import org.pouyadr.ui.ActionBar.Theme; import org.pouyadr.ui.Adapters.BaseFragmentAdapter; import org.pouyadr.ui.Cells.CheckBoxCell; import org.pouyadr.ui.Cells.EmptyCell; import org.pouyadr.ui.Cells.HeaderCell; import org.pouyadr.ui.Cells.ShadowSectionCell; import org.pouyadr.ui.Cells.TextCheckCell; import org.pouyadr.ui.Cells.<API key>; import org.pouyadr.ui.Cells.TextInfoCell; import org.pouyadr.ui.Cells.TextSettingsCell; import org.pouyadr.ui.Components.AvatarDrawable; import org.pouyadr.ui.Components.AvatarUpdater; import org.pouyadr.ui.Components.BackupImageView; import org.pouyadr.ui.Components.LayoutHelper; import org.pouyadr.ui.Components.NumberPicker; import java.io.File; import java.util.ArrayList; import java.util.Locale; public class SettingsActivity extends BaseFragment implements NotificationCenter.<API key>, PhotoViewer.PhotoViewerProvider { private ListView listView; private ListAdapter listAdapter; private BackupImageView avatarImage; private TextView nameTextView; private TextView onlineTextView; private ImageView writeButton; private AnimatorSetProxy <API key>; private AvatarUpdater avatarUpdater = new AvatarUpdater(); private View extraHeightView; private View shadowView; private int extraHeight; private int overscrollRow; private int emptyRow; private int numberSectionRow; private int newgeramsectionrow; private int newgeramsectionrow2; private int ghostactivate; private int showdateshamsi; private int sendtyping; private int showtimeago; private int numberRow; private int usernameRow; private int settingsSectionRow; private int settingsSectionRow2; private int enableAnimationsRow; private int notificationRow; private int backgroundRow; private int languageRow; private int privacyRow; private int <API key>; private int <API key>; private int mobileDownloadRow; private int wifiDownloadRow; private int roamingDownloadRow; private int saveToGalleryRow; private int messagesSectionRow; private int messagesSectionRow2; private int customTabsRow; private int directShareRow; private int textSizeRow; private int fontType; private int stickersRow; private int cacheRow; private int raiseToSpeakRow; private int sendByEnterRow; private int supportSectionRow; private int supportSectionRow2; private int askQuestionRow; private int telegramFaqRow; private int privacyPolicyRow; private int sendLogsRow; private int clearLogsRow; private int <API key>; private int versionRow; private int contactsSectionRow; private int contactsReimportRow; private int contactsSortRow; private int autoplayGifsRow; private int rowCount; private final static int edit_name = 1; private final static int logout = 2; private int <API key>; private int answeringmachinerow; private int tabletforceoverride; private int <API key>; private int answermachinetext; private static class <API key> extends LinkMovementMethod { @Override public boolean onTouchEvent(@NonNull TextView widget, @NonNull Spannable buffer, @NonNull MotionEvent event) { try { return super.onTouchEvent(widget, buffer, event); } catch (Exception e) { FileLog.e("tmessages", e); } return false; } } @Override public boolean onFragmentCreate() { super.onFragmentCreate(); avatarUpdater.parentFragment = this; avatarUpdater.delegate = new AvatarUpdater.<API key>() { @Override public void didUploadedPhoto(TLRPC.InputFile file, TLRPC.PhotoSize small, TLRPC.PhotoSize big) { TLRPC.<API key> req = new TLRPC.<API key>(); req.caption = ""; req.crop = new TLRPC.<API key>(); req.file = file; req.geo_point = new TLRPC.<API key>(); ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { @Override public void run(TLObject response, TLRPC.TL_error error) { if (error == null) { TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); if (user == null) { user = UserConfig.getCurrentUser(); if (user == null) { return; } MessagesController.getInstance().putUser(user, false); } else { UserConfig.setCurrentUser(user); } TLRPC.TL_photos_photo photo = (TLRPC.TL_photos_photo) response; ArrayList<TLRPC.PhotoSize> sizes = photo.photo.sizes; TLRPC.PhotoSize smallSize = FileLoader.<API key>(sizes, 100); TLRPC.PhotoSize bigSize = FileLoader.<API key>(sizes, 1000); user.photo = new TLRPC.TL_userProfilePhoto(); user.photo.photo_id = photo.photo.id; if (smallSize != null) { user.photo.photo_small = smallSize.location; } if (bigSize != null) { user.photo.photo_big = bigSize.location; } else if (smallSize != null) { user.photo.photo_small = smallSize.location; } MessagesStorage.getInstance().clearUserPhotos(user.id); ArrayList<TLRPC.User> users = new ArrayList<>(); users.add(user); MessagesStorage.getInstance().putUsersAndChats(users, null, false, true); AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { NotificationCenter.getInstance().<API key>(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_ALL); NotificationCenter.getInstance().<API key>(NotificationCenter.mainUserInfoChanged); UserConfig.saveConfig(true); } }); } } }); } }; NotificationCenter.getInstance().addObserver(this, NotificationCenter.updateInterfaces); rowCount = 0; overscrollRow = rowCount++; emptyRow = rowCount++; numberSectionRow = rowCount++; numberRow = rowCount++; usernameRow = rowCount++; newgeramsectionrow = rowCount++; newgeramsectionrow2 = rowCount++; ghostactivate = rowCount++; sendtyping = rowCount++; showtimeago = rowCount++; showdateshamsi = rowCount++; tabletforceoverride = rowCount++; answeringmachinerow = rowCount++; <API key> = rowCount++; <API key> = rowCount++; answermachinetext = rowCount++; settingsSectionRow = rowCount++; settingsSectionRow2 = rowCount++; notificationRow = rowCount++; privacyRow = rowCount++; backgroundRow = rowCount++; languageRow = rowCount++; enableAnimationsRow = rowCount++; <API key> = rowCount++; <API key> = rowCount++; mobileDownloadRow = rowCount++; wifiDownloadRow = rowCount++; roamingDownloadRow = rowCount++; if (Build.VERSION.SDK_INT >= 11) { autoplayGifsRow = rowCount++; } saveToGalleryRow = rowCount++; messagesSectionRow = rowCount++; messagesSectionRow2 = rowCount++; customTabsRow = rowCount++; if (Build.VERSION.SDK_INT >= 23) { directShareRow = rowCount++; } textSizeRow = rowCount++; fontType = rowCount++; stickersRow = rowCount++; cacheRow = rowCount++; raiseToSpeakRow = rowCount++; sendByEnterRow = rowCount++; supportSectionRow = rowCount++; supportSectionRow2 = rowCount++; askQuestionRow = rowCount++; telegramFaqRow = rowCount++; privacyPolicyRow = rowCount++; if (BuildVars.DEBUG_VERSION) { sendLogsRow = rowCount++; clearLogsRow = rowCount++; <API key> = rowCount++; } versionRow = rowCount++; //contactsSectionRow = rowCount++; //contactsReimportRow = rowCount++; //contactsSortRow = rowCount++; MessagesController.getInstance().loadFullUser(UserConfig.getCurrentUser(), classGuid, true); return true; } @Override public void onFragmentDestroy() { super.onFragmentDestroy(); if (avatarImage != null) { avatarImage.setImageDrawable(null); } MessagesController.getInstance().cancelLoadFullUser(UserConfig.getClientUserId()); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.updateInterfaces); avatarUpdater.clear(); } @Override public View createView(final Context context) { actionBar.setBackgroundColor(ThemeChanger.getcurrent().getActionbarcolor()); actionBar.<API key>(ThemeChanger.getcurrent().getActionbarcolor()); actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAddToContainer(false); extraHeight = 88; if (AndroidUtilities.isTablet()) { actionBar.setOccupyStatusBar(false); } actionBar.<API key>(new ActionBar.<API key>() { @Override public void onItemClick(int id) { if (id == -1) { finishFragment(); } else if (id == edit_name) { presentFragment(new ChangeNameActivity()); } else if (id == logout) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setMessage(LocaleController.getString("AreYouSureLogout", R.string.AreYouSureLogout)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { MessagesController.getInstance().performLogout(true); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } } }); ActionBarMenu menu = actionBar.createMenu(); ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_other); item.addSubItem(edit_name, LocaleController.getString("EditName", R.string.EditName), 0); item.addSubItem(logout, LocaleController.getString("LogOut", R.string.LogOut), 0); listAdapter = new ListAdapter(context); fragmentView = new FrameLayout(context) { @Override protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) { if (child == listView) { boolean result = super.drawChild(canvas, child, drawingTime); if (parentLayout != null) { int actionBarHeight = 0; int childCount = getChildCount(); for (int a = 0; a < childCount; a++) { View view = getChildAt(a); if (view == child) { continue; } if (view instanceof ActionBar && view.getVisibility() == VISIBLE) { if (((ActionBar) view).getCastShadows()) { actionBarHeight = view.getMeasuredHeight(); } break; } } parentLayout.drawHeaderShadow(canvas, actionBarHeight); } return result; } else { return super.drawChild(canvas, child, drawingTime); } } }; FrameLayout frameLayout = (FrameLayout) fragmentView; listView = new ListView(context); listView.setDivider(null); listView.setDividerHeight(0); listView.<API key>(false); AndroidUtilities.<API key>(listView, AvatarDrawable.<API key>(5)); frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT)); listView.setAdapter(listAdapter); listView.<API key>(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) { if (i == textSizeRow) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("TextSize", R.string.TextSize)); final NumberPicker numberPicker = new NumberPicker(getParentActivity()); numberPicker.setMinValue(12); numberPicker.setMaxValue(30); numberPicker.setValue(MessagesController.getInstance().fontSize); builder.setView(numberPicker); builder.setNegativeButton(LocaleController.getString("Done", R.string.Done), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences preferences = ApplicationLoader.applicationContext.<API key>("mainconfig", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putInt("fons_size", numberPicker.getValue()); MessagesController.getInstance().fontSize = numberPicker.getValue(); editor.commit(); if (listView != null) { listView.invalidateViews(); } } }); showDialog(builder.create()); } else if (i == fontType) { // Toast.makeText(context, "ssssssssssss", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(context, FontActivity.class); context.startActivity(intent); } else if (i == enableAnimationsRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.<API key>("mainconfig", Activity.MODE_PRIVATE); boolean animations = preferences.getBoolean("view_animations", true); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("view_animations", !animations); editor.commit(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!animations); } } else if (i == notificationRow) { presentFragment(new <API key>()); } else if (i == answermachinetext) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(LocaleController.getString("<API key>", R.string.<API key>)); final EditText input = new EditText(context); input.setText(Setting.<API key>()); input.setInputType(InputType.TYPE_CLASS_TEXT); builder.setView(input); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Setting.<API key>(input.getText().toString()); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.show(); } else if (i == backgroundRow) { presentFragment(new WallpapersActivity()); } else if (i == askQuestionRow) { if (getParentActivity() == null) { return; } final TextView message = new TextView(getParentActivity()); message.setText(Html.fromHtml(LocaleController.getString("AskAQuestionInfo", R.string.AskAQuestionInfo))); message.setTextSize(18); message.setLinkTextColor(Theme.MSG_LINK_TEXT_COLOR); // message.setTypeface(AndroidUtilities.getTypeface(org.pouyadr.finalsoft.Fonts.CurrentFont())); message.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(5), AndroidUtilities.dp(8), AndroidUtilities.dp(6)); message.setMovementMethod(new <API key>()); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setView(message); builder.setPositiveButton(LocaleController.getString("AskButton", R.string.AskButton), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { performAskAQuestion(); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } else if (i == sendLogsRow) { sendLogs(); } else if (i == clearLogsRow) { FileLog.cleanupLogs(); } else if (i == sendByEnterRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.<API key>("mainconfig", Activity.MODE_PRIVATE); boolean send = preferences.getBoolean("send_by_enter", false); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("send_by_enter", !send); editor.commit(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == ghostactivate) { boolean send = Setting.getGhostMode(); GhostPorotocol.toggleGhostPortocol(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == sendtyping) { boolean send = Setting.getSendTyping(); Setting.setSendTyping(!send); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == <API key>) { boolean send = Setting.getAnsweringMachine(); Setting.setAnsweringMachine(!send); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == showtimeago) { boolean send = Setting.getShowTimeAgo(); Setting.setShowTimeAgo(!send); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == showdateshamsi) { boolean send = Setting.getDatePersian(); Setting.setDatePersian(!send); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == tabletforceoverride) { boolean send = Setting.getTabletMode(); Setting.setTabletMode(!send); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == raiseToSpeakRow) { MediaController.getInstance().toogleRaiseToSpeak(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canRaiseToSpeak()); } } else if (i == autoplayGifsRow) { MediaController.getInstance().toggleAutoplayGifs(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canAutoplayGifs()); } } else if (i == saveToGalleryRow) { MediaController.getInstance().toggleSaveToGallery(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canSaveToGallery()); } } else if (i == customTabsRow) { MediaController.getInstance().toggleCustomTabs(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canCustomTabs()); } } else if (i == directShareRow) { MediaController.getInstance().toggleDirectShare(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canDirectShare()); } } else if (i == privacyRow) { presentFragment(new <API key>()); } else if (i == languageRow) { presentFragment(new <API key>()); } else if (i == <API key>) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { ConnectionsManager.getInstance().switchBackend(); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } else if (i == telegramFaqRow) { Browser.openUrl(getParentActivity(), LocaleController.getString("TelegramFaqUrl", R.string.TelegramFaqUrl)); } else if (i == privacyPolicyRow) { Browser.openUrl(getParentActivity(), LocaleController.getString("PrivacyPolicyUrl", R.string.PrivacyPolicyUrl)); } else if (i == contactsReimportRow) { //not implemented } else if (i == contactsSortRow) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("SortBy", R.string.SortBy)); builder.setItems(new CharSequence[]{ LocaleController.getString("Default", R.string.Default), LocaleController.getString("SortFirstName", R.string.SortFirstName), LocaleController.getString("SortLastName", R.string.SortLastName) }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences preferences = ApplicationLoader.applicationContext.<API key>("mainconfig", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putInt("sortContactsBy", which); editor.commit(); if (listView != null) { listView.invalidateViews(); } } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } else if (i == wifiDownloadRow || i == mobileDownloadRow || i == roamingDownloadRow) { if (getParentActivity() == null) { return; } final boolean maskValues[] = new boolean[6]; BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity()); int mask = 0; if (i == mobileDownloadRow) { mask = MediaController.getInstance().<API key>; } else if (i == wifiDownloadRow) { mask = MediaController.getInstance().wifiDownloadMask; } else if (i == roamingDownloadRow) { mask = MediaController.getInstance().roamingDownloadMask; } builder.setApplyTopPadding(false); builder.<API key>(false); LinearLayout linearLayout = new LinearLayout(getParentActivity()); linearLayout.setOrientation(LinearLayout.VERTICAL); for (int a = 0; a < 6; a++) { String name = null; if (a == 0) { maskValues[a] = (mask & MediaController.<API key>) != 0; name = LocaleController.getString("AttachPhoto", R.string.AttachPhoto); } else if (a == 1) { maskValues[a] = (mask & MediaController.<API key>) != 0; name = LocaleController.getString("AttachAudio", R.string.AttachAudio); } else if (a == 2) { maskValues[a] = (mask & MediaController.<API key>) != 0; name = LocaleController.getString("AttachVideo", R.string.AttachVideo); } else if (a == 3) { maskValues[a] = (mask & MediaController.<API key>) != 0; name = LocaleController.getString("AttachDocument", R.string.AttachDocument); } else if (a == 4) { maskValues[a] = (mask & MediaController.<API key>) != 0; name = LocaleController.getString("AttachMusic", R.string.AttachMusic); } else if (a == 5) { if (Build.VERSION.SDK_INT >= 11) { maskValues[a] = (mask & MediaController.<API key>) != 0; name = LocaleController.getString("AttachGif", R.string.AttachGif); } else { continue; } } CheckBoxCell checkBoxCell = new CheckBoxCell(getParentActivity()); checkBoxCell.setTag(a); checkBoxCell.<API key>(R.drawable.list_selector); linearLayout.addView(checkBoxCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); checkBoxCell.setText(name, "", maskValues[a], true); checkBoxCell.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CheckBoxCell cell = (CheckBoxCell) v; int num = (Integer) cell.getTag(); maskValues[num] = !maskValues[num]; cell.setChecked(maskValues[num], true); } }); } BottomSheet.BottomSheetCell cell = new BottomSheet.BottomSheetCell(getParentActivity(), 1); cell.<API key>(R.drawable.list_selector); cell.setTextAndIcon(LocaleController.getString("Save", R.string.Save).toUpperCase(), 0); cell.setTextColor(Theme.<API key>); cell.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { if (visibleDialog != null) { visibleDialog.dismiss(); } } catch (Exception e) { FileLog.e("tmessages", e); } int newMask = 0; for (int a = 0; a < 6; a++) { if (maskValues[a]) { if (a == 0) { newMask |= MediaController.<API key>; } else if (a == 1) { newMask |= MediaController.<API key>; } else if (a == 2) { newMask |= MediaController.<API key>; } else if (a == 3) { newMask |= MediaController.<API key>; } else if (a == 4) { newMask |= MediaController.<API key>; } else if (a == 5) { newMask |= MediaController.<API key>; } } } SharedPreferences.Editor editor = ApplicationLoader.applicationContext.<API key>("mainconfig", Activity.MODE_PRIVATE).edit(); if (i == mobileDownloadRow) { editor.putInt("<API key>", newMask); MediaController.getInstance().<API key> = newMask; } else if (i == wifiDownloadRow) { editor.putInt("wifiDownloadMask", newMask); MediaController.getInstance().wifiDownloadMask = newMask; } else if (i == roamingDownloadRow) { editor.putInt("roamingDownloadMask", newMask); MediaController.getInstance().roamingDownloadMask = newMask; } editor.commit(); if (listView != null) { listView.invalidateViews(); } } }); linearLayout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); builder.setCustomView(linearLayout); showDialog(builder.create()); } else if (i == usernameRow) { presentFragment(new <API key>()); } else if (i == numberRow) { presentFragment(new <API key>()); } else if (i == stickersRow) { presentFragment(new StickersActivity()); } else if (i == cacheRow) { presentFragment(new <API key>()); } } }); frameLayout.addView(actionBar); extraHeightView = new View(context); ViewProxy.setPivotY(extraHeightView, 0); extraHeightView.setBackgroundColor(ThemeChanger.getcurrent().getActionbarcolor()); frameLayout.addView(extraHeightView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 88)); shadowView = new View(context); shadowView.<API key>(R.drawable.header_shadow); frameLayout.addView(shadowView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 3)); avatarImage = new BackupImageView(context); avatarImage.setRoundRadius(AndroidUtilities.dp(21)); ViewProxy.setPivotX(avatarImage, 0); ViewProxy.setPivotY(avatarImage, 0); frameLayout.addView(avatarImage, LayoutHelper.createFrame(42, 42, Gravity.TOP | Gravity.LEFT, 64, 0, 0, 0)); avatarImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); if (user != null && user.photo != null && user.photo.photo_big != null) { PhotoViewer.getInstance().setParentActivity(getParentActivity()); PhotoViewer.getInstance().openPhoto(user.photo.photo_big, SettingsActivity.this); } } }); nameTextView = new TextView(context); nameTextView.setTextColor(0xffffffff); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); nameTextView.setLines(1); nameTextView.setMaxLines(1); nameTextView.setSingleLine(true); nameTextView.setEllipsize(TextUtils.TruncateAt.END); nameTextView.setGravity(Gravity.LEFT); nameTextView.setTypeface(AndroidUtilities.getTypeface(org.pouyadr.finalsoft.Fonts.CurrentFont())); ViewProxy.setPivotX(nameTextView, 0); ViewProxy.setPivotY(nameTextView, 0); frameLayout.addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 48, 0)); onlineTextView = new TextView(context); onlineTextView.setTextColor(AvatarDrawable.<API key>(5)); onlineTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); onlineTextView.setLines(1); onlineTextView.setMaxLines(1); onlineTextView.setSingleLine(true); onlineTextView.setEllipsize(TextUtils.TruncateAt.END); onlineTextView.setGravity(Gravity.LEFT); frameLayout.addView(onlineTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 48, 0)); writeButton = new ImageView(context); writeButton.<API key>(R.drawable.<API key>); writeButton.setImageResource(R.drawable.floating_camera); writeButton.setScaleType(ImageView.ScaleType.CENTER); if (Build.VERSION.SDK_INT >= 21) { StateListAnimator animator = new StateListAnimator(); animator.addState(new int[]{android.R.attr.state_pressed}, ObjectAnimator.ofFloat(writeButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4)).setDuration(200)); animator.addState(new int[]{}, ObjectAnimator.ofFloat(writeButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2)).setDuration(200)); writeButton.<API key>(animator); writeButton.setOutlineProvider(new ViewOutlineProvider() { @SuppressLint("NewApi") @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56)); } }); } frameLayout.addView(writeButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT | Gravity.TOP, 0, 0, 16, 0)); writeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); CharSequence[] items; TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); if (user == null) { user = UserConfig.getCurrentUser(); } if (user == null) { return; } boolean fullMenu = false; if (user.photo != null && user.photo.photo_big != null && !(user.photo instanceof TLRPC.<API key>)) { items = new CharSequence[]{LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley), LocaleController.getString("DeletePhoto", R.string.DeletePhoto)}; fullMenu = true; } else { items = new CharSequence[]{LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley)}; } final boolean full = fullMenu; builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { avatarUpdater.openCamera(); } else if (i == 1) { avatarUpdater.openGallery(); } else if (i == 2) { MessagesController.getInstance().deleteUserPhoto(null); } } }); showDialog(builder.create()); } }); needLayout(); listView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void <API key>(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (totalItemCount == 0) { return; } int height = 0; View child = view.getChildAt(0); if (child != null) { if (firstVisibleItem == 0) { height = AndroidUtilities.dp(88) + (child.getTop() < 0 ? child.getTop() : 0); } if (extraHeight != height) { extraHeight = height; needLayout(); } } } }); return fragmentView; } @Override protected void onDialogDismiss(Dialog dialog) { MediaController.getInstance().<API key>(); } @Override public void updatePhotoAtIndex(int index) { } @Override public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { if (fileLocation == null) { return null; } TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); if (user != null && user.photo != null && user.photo.photo_big != null) { TLRPC.FileLocation photoBig = user.photo.photo_big; if (photoBig.local_id == fileLocation.local_id && photoBig.volume_id == fileLocation.volume_id && photoBig.dc_id == fileLocation.dc_id) { int coords[] = new int[2]; avatarImage.getLocationInWindow(coords); PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject(); object.viewX = coords[0]; object.viewY = coords[1] - AndroidUtilities.statusBarHeight; object.parentView = avatarImage; object.imageReceiver = avatarImage.getImageReceiver(); object.user_id = UserConfig.getClientUserId(); object.thumb = object.imageReceiver.getBitmap(); object.size = -1; object.radius = avatarImage.getImageReceiver().getRoundRadius(); object.scale = ViewProxy.getScaleX(avatarImage); return object; } } return null; } @Override public Bitmap getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { return null; } @Override public void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { } @Override public void willHidePhotoViewer() { avatarImage.getImageReceiver().setVisible(true, true); } @Override public boolean isPhotoChecked(int index) { return false; } @Override public void setPhotoChecked(int index) { } @Override public boolean cancelButtonPressed() { return true; } @Override public void sendButtonPressed(int index) { } @Override public int getSelectedCount() { return 0; } public void performAskAQuestion() { final SharedPreferences preferences = ApplicationLoader.applicationContext.<API key>("mainconfig", Activity.MODE_PRIVATE); int uid = preferences.getInt("support_id", 0); TLRPC.User supportUser = null; if (uid != 0) { supportUser = MessagesController.getInstance().getUser(uid); if (supportUser == null) { String userString = preferences.getString("support_user", null); if (userString != null) { try { byte[] datacentersBytes = Base64.decode(userString, Base64.DEFAULT); if (datacentersBytes != null) { SerializedData data = new SerializedData(datacentersBytes); supportUser = TLRPC.User.TLdeserialize(data, data.readInt32(false), false); if (supportUser != null && supportUser.id == 333000) { supportUser = null; } data.cleanup(); } } catch (Exception e) { FileLog.e("tmessages", e); supportUser = null; } } } } if (supportUser == null) { final ProgressDialog progressDialog = new ProgressDialog(getParentActivity()); progressDialog.setMessage(LocaleController.getString("Loading", R.string.Loading)); progressDialog.<API key>(false); progressDialog.setCancelable(false); progressDialog.show(); TLRPC.TL_help_getSupport req = new TLRPC.TL_help_getSupport(); ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { @Override public void run(TLObject response, TLRPC.TL_error error) { if (error == null) { final TLRPC.TL_help_support res = (TLRPC.TL_help_support) response; AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { SharedPreferences.Editor editor = preferences.edit(); editor.putInt("support_id", res.user.id); SerializedData data = new SerializedData(); res.user.serializeToStream(data); editor.putString("support_user", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT)); editor.commit(); data.cleanup(); try { progressDialog.dismiss(); } catch (Exception e) { FileLog.e("tmessages", e); } ArrayList<TLRPC.User> users = new ArrayList<>(); users.add(res.user); MessagesStorage.getInstance().putUsersAndChats(users, null, true, true); MessagesController.getInstance().putUser(res.user, false); Bundle args = new Bundle(); args.putInt("user_id", res.user.id); presentFragment(new ChatActivity(args)); } }); } else { AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { try { progressDialog.dismiss(); } catch (Exception e) { FileLog.e("tmessages", e); } } }); } } }); } else { MessagesController.getInstance().putUser(supportUser, true); Bundle args = new Bundle(); args.putInt("user_id", supportUser.id); presentFragment(new ChatActivity(args)); } } @Override public void <API key>(int requestCode, int resultCode, Intent data) { avatarUpdater.onActivityResult(requestCode, resultCode, data); } @Override public void saveSelfArgs(Bundle args) { if (avatarUpdater != null && avatarUpdater.currentPicturePath != null) { args.putString("path", avatarUpdater.currentPicturePath); } } @Override public void restoreSelfArgs(Bundle args) { if (avatarUpdater != null) { avatarUpdater.currentPicturePath = args.getString("path"); } } @Override public void <API key>(int id, Object... args) { if (id == NotificationCenter.updateInterfaces) { int mask = (Integer) args[0]; if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0) { updateUserData(); } } } @Override public void onResume() { super.onResume(); if (listAdapter != null) { listAdapter.<API key>(); } updateUserData(); fixLayout(); } @Override public void <API key>(Configuration newConfig) { super.<API key>(newConfig); fixLayout(); } private void needLayout() { FrameLayout.LayoutParams layoutParams; int newTop = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.<API key>(); if (listView != null) { layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); if (layoutParams.topMargin != newTop) { layoutParams.topMargin = newTop; listView.setLayoutParams(layoutParams); ViewProxy.setTranslationY(extraHeightView, newTop); } } if (avatarImage != null) { float diff = extraHeight / (float) AndroidUtilities.dp(88); ViewProxy.setScaleY(extraHeightView, diff); ViewProxy.setTranslationY(shadowView, newTop + extraHeight); if (Build.VERSION.SDK_INT < 11) { layoutParams = (FrameLayout.LayoutParams) writeButton.getLayoutParams(); layoutParams.topMargin = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.<API key>() + extraHeight - AndroidUtilities.dp(29.5f); writeButton.setLayoutParams(layoutParams); } else { ViewProxy.setTranslationY(writeButton, (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.<API key>() + extraHeight - AndroidUtilities.dp(29.5f)); } final boolean setVisible = diff > 0.2f; boolean currentVisible = writeButton.getTag() == null; if (setVisible != currentVisible) { if (setVisible) { writeButton.setTag(null); writeButton.setVisibility(View.VISIBLE); } else { writeButton.setTag(0); } if (<API key> != null) { AnimatorSetProxy old = <API key>; <API key> = null; old.cancel(); } <API key> = new AnimatorSetProxy(); if (setVisible) { <API key>.setInterpolator(new <API key>()); <API key>.playTogether( ObjectAnimatorProxy.ofFloat(writeButton, "scaleX", 1.0f), ObjectAnimatorProxy.ofFloat(writeButton, "scaleY", 1.0f), ObjectAnimatorProxy.ofFloat(writeButton, "alpha", 1.0f) ); } else { <API key>.setInterpolator(new <API key>()); <API key>.playTogether( ObjectAnimatorProxy.ofFloat(writeButton, "scaleX", 0.2f), ObjectAnimatorProxy.ofFloat(writeButton, "scaleY", 0.2f), ObjectAnimatorProxy.ofFloat(writeButton, "alpha", 0.0f) ); } <API key>.setDuration(150); <API key>.addListener(new <API key>() { @Override public void onAnimationEnd(Object animation) { if (<API key> != null && <API key>.equals(animation)) { writeButton.clearAnimation(); writeButton.setVisibility(setVisible ? View.VISIBLE : View.GONE); <API key> = null; } } }); <API key>.start(); } ViewProxy.setScaleX(avatarImage, (42 + 18 * diff) / 42.0f); ViewProxy.setScaleY(avatarImage, (42 + 18 * diff) / 42.0f); float avatarY = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.<API key>() / 2.0f * (1.0f + diff) - 21 * AndroidUtilities.density + 27 * AndroidUtilities.density * diff; ViewProxy.setTranslationX(avatarImage, -AndroidUtilities.dp(47) * diff); ViewProxy.setTranslationY(avatarImage, (float) Math.ceil(avatarY)); ViewProxy.setTranslationX(nameTextView, -21 * AndroidUtilities.density * diff); ViewProxy.setTranslationY(nameTextView, (float) Math.floor(avatarY) - (float) Math.ceil(AndroidUtilities.density) + (float) Math.floor(7 * AndroidUtilities.density * diff)); ViewProxy.setTranslationX(onlineTextView, -21 * AndroidUtilities.density * diff); ViewProxy.setTranslationY(onlineTextView, (float) Math.floor(avatarY) + AndroidUtilities.dp(22) + (float) Math.floor(11 * AndroidUtilities.density) * diff); ViewProxy.setScaleX(nameTextView, 1.0f + 0.12f * diff); ViewProxy.setScaleY(nameTextView, 1.0f + 0.12f * diff); } } private void fixLayout() { if (fragmentView == null) { return; } fragmentView.getViewTreeObserver().<API key>(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { if (fragmentView != null) { needLayout(); fragmentView.getViewTreeObserver().<API key>(this); } return true; } }); } private void updateUserData() { TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); TLRPC.FileLocation photo = null; TLRPC.FileLocation photoBig = null; if (user.photo != null) { photo = user.photo.photo_small; photoBig = user.photo.photo_big; } AvatarDrawable avatarDrawable = new AvatarDrawable(user, true); avatarDrawable.setColor(Theme.<API key>); if (avatarImage != null) { avatarImage.setImage(photo, "50_50", avatarDrawable); avatarImage.getImageReceiver().setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false); nameTextView.setText(UserObject.getUserName(user)); onlineTextView.setText(LocaleController.getString("Online", R.string.Online)); avatarImage.getImageReceiver().setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false); } } private void sendLogs() { try { ArrayList<Uri> uris = new ArrayList<>(); File sdCard = ApplicationLoader.applicationContext.getExternalFilesDir(null); File dir = new File(sdCard.getAbsolutePath() + "/logs"); File[] files = dir.listFiles(); for (File file : files) { uris.add(Uri.fromFile(file)); } if (uris.isEmpty()) { return; } Intent i = new Intent(Intent.<API key>); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, new String[]{BuildVars.SEND_LOGS_EMAIL}); i.putExtra(Intent.EXTRA_SUBJECT, "last logs"); i.<API key>(Intent.EXTRA_STREAM, uris); getParentActivity().<API key>(Intent.createChooser(i, "Select email application."), 500); } catch (Exception e) { e.printStackTrace(); } } private class ListAdapter extends BaseFragmentAdapter { private Context mContext; public ListAdapter(Context context) { mContext = context; } @Override public boolean areAllItemsEnabled() { return false; } @Override public boolean isEnabled(int i) { return i == textSizeRow || i == fontType || i == tabletforceoverride || i == <API key> || i == answermachinetext || i == sendtyping || i == showdateshamsi || i == showtimeago || i == ghostactivate || i == enableAnimationsRow || i == notificationRow || i == backgroundRow || i == numberRow || i == askQuestionRow || i == sendLogsRow || i == sendByEnterRow || i == autoplayGifsRow || i == privacyRow || i == wifiDownloadRow || i == mobileDownloadRow || i == clearLogsRow || i == roamingDownloadRow || i == languageRow || i == usernameRow || i == <API key> || i == telegramFaqRow || i == contactsSortRow || i == contactsReimportRow || i == saveToGalleryRow || i == stickersRow || i == cacheRow || i == raiseToSpeakRow || i == privacyPolicyRow || i == customTabsRow || i == directShareRow; } @Override public int getCount() { return rowCount; } @Override public Object getItem(int i) { return null; } @Override public long getItemId(int i) { return i; } @Override public boolean hasStableIds() { return false; } @Override public View getView(int i, View view, ViewGroup viewGroup) { int type = getItemViewType(i); if (type == 0) { if (view == null) { view = new EmptyCell(mContext); } if (i == overscrollRow) { ((EmptyCell) view).setHeight(AndroidUtilities.dp(88)); } else { ((EmptyCell) view).setHeight(AndroidUtilities.dp(16)); } } else if (type == 1) { if (view == null) { view = new ShadowSectionCell(mContext); } } else if (type == 2) { if (view == null) { view = new TextSettingsCell(mContext); } TextSettingsCell textCell = (TextSettingsCell) view; if (i == textSizeRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.<API key>("mainconfig", Activity.MODE_PRIVATE); int size = preferences.getInt("fons_size", AndroidUtilities.isTablet() ? 18 : 16); textCell.setTextAndValue(LocaleController.getString("TextSize", R.string.TextSize), String.format("%d", size), true); } else if (i == fontType) { textCell.setTextAndValue( "نوع خط نوشتاری", Fonts.CurrentFont().replace("fonts/","").replace(".ttf",""), true); } else if (i == languageRow) { textCell.setTextAndValue(LocaleController.getString("Language", R.string.Language), LocaleController.<API key>(), true); } else if (i == contactsSortRow) { String value; SharedPreferences preferences = ApplicationLoader.applicationContext.<API key>("mainconfig", Activity.MODE_PRIVATE); int sort = preferences.getInt("sortContactsBy", 0); if (sort == 0) { value = LocaleController.getString("Default", R.string.Default); } else if (sort == 1) { value = LocaleController.getString("FirstName", R.string.SortFirstName); } else { value = LocaleController.getString("LastName", R.string.SortLastName); } textCell.setTextAndValue(LocaleController.getString("SortBy", R.string.SortBy), value, true); } else if (i == notificationRow) { textCell.setText(LocaleController.getString("<API key>", R.string.<API key>), true); } else if (i == backgroundRow) { textCell.setText(LocaleController.getString("ChatBackground", R.string.ChatBackground), true); } else if (i == answermachinetext) { textCell.setTextAndValue(LocaleController.getString("<API key>", R.string.<API key>), Setting.<API key>(), true); } else if (i == sendLogsRow) { textCell.setText("Send Logs", true); } else if (i == clearLogsRow) { textCell.setText("Clear Logs", true); } else if (i == askQuestionRow) { textCell.setText(LocaleController.getString("AskAQuestion", R.string.AskAQuestion), true); } else if (i == privacyRow) { textCell.setText(LocaleController.getString("PrivacySettings", R.string.PrivacySettings), true); } else if (i == <API key>) { textCell.setText("Switch Backend", true); } else if (i == telegramFaqRow) { textCell.setText(LocaleController.getString("TelegramFAQ", R.string.TelegramFaq), true); } else if (i == contactsReimportRow) { textCell.setText(LocaleController.getString("ImportContacts", R.string.ImportContacts), true); } else if (i == stickersRow) { textCell.setText(LocaleController.getString("Stickers", R.string.Stickers), true); } else if (i == cacheRow) { textCell.setText(LocaleController.getString("CacheSettings", R.string.CacheSettings), true); } else if (i == privacyPolicyRow) { textCell.setText(LocaleController.getString("PrivacyPolicy", R.string.PrivacyPolicy), true); } } else if (type == 3) { if (view == null) { view = new TextCheckCell(mContext); } TextCheckCell textCell = (TextCheckCell) view; SharedPreferences preferences = ApplicationLoader.applicationContext.<API key>("mainconfig", Activity.MODE_PRIVATE); if (i == enableAnimationsRow) { textCell.setTextAndCheck(LocaleController.getString("EnableAnimations", R.string.EnableAnimations), preferences.getBoolean("view_animations", true), false); } else if (i == sendByEnterRow) { textCell.setTextAndCheck(LocaleController.getString("SendByEnter", R.string.SendByEnter), preferences.getBoolean("send_by_enter", false), false); } else if (i == ghostactivate) { textCell.<API key>(LocaleController.getString("GhostMode", R.string.GhostMode), LocaleController.getString("GhostModeInfo", R.string.GhostModeInfo), Setting.getGhostMode(), true, true); } else if (i == sendtyping) { textCell.<API key>(LocaleController.getString("HideTypingState", R.string.HideTypingState), LocaleController.getString("HideTypingStateinfo", R.string.HideTypingStateinfo), Setting.getSendTyping(), true, true); } else if (i == <API key>) { textCell.<API key>(LocaleController.getString("<API key>", R.string.<API key>), LocaleController.getString("<API key>", R.string.<API key>), Setting.getAnsweringMachine(), true, true); } else if (i == showtimeago) { textCell.<API key>(LocaleController.getString("showtimeago", R.string.showtimeago), LocaleController.getString("showtimeagoinfo", R.string.showtimeagoinfo), Setting.getShowTimeAgo(), true, true); } else if (i == showdateshamsi) { textCell.<API key>(LocaleController.getString("showshamsidate", R.string.Showshamsidate), LocaleController.getString("showshamsidateinfo", R.string.showshamsidateinfo), Setting.getDatePersian(), true, true); } else if (i == tabletforceoverride) { textCell.<API key>(LocaleController.getString("TabletMode", R.string.TabletMode), LocaleController.getString("tabletmodeinfo", R.string.tabletmodeinfo), Setting.getTabletMode(), true, true); } else if (i == saveToGalleryRow) { textCell.setTextAndCheck(LocaleController.getString("<API key>", R.string.<API key>), MediaController.getInstance().canSaveToGallery(), false); } else if (i == autoplayGifsRow) { textCell.setTextAndCheck(LocaleController.getString("AutoplayGifs", R.string.AutoplayGifs), MediaController.getInstance().canAutoplayGifs(), true); } else if (i == raiseToSpeakRow) { textCell.setTextAndCheck(LocaleController.getString("RaiseToSpeak", R.string.RaiseToSpeak), MediaController.getInstance().canRaiseToSpeak(), true); } else if (i == customTabsRow) { textCell.<API key>(LocaleController.getString("ChromeCustomTabs", R.string.ChromeCustomTabs), LocaleController.getString("<API key>", R.string.<API key>), MediaController.getInstance().canCustomTabs(), false, true); } else if (i == directShareRow) { textCell.<API key>(LocaleController.getString("DirectShare", R.string.DirectShare), LocaleController.getString("DirectShareInfo", R.string.DirectShareInfo), MediaController.getInstance().canDirectShare(), false, true); } } else if (type == 4) { if (view == null) { view = new HeaderCell(mContext); } if (i == <API key>) { ((HeaderCell) view).setText(LocaleController.getString("AnsweringMachin", R.string.answeringmachine)); } else if (i == settingsSectionRow2) { ((HeaderCell) view).setText(LocaleController.getString("SETTINGS", R.string.SETTINGS)); } else if (i == supportSectionRow2) { ((HeaderCell) view).setText(LocaleController.getString("Support", R.string.Support)); } else if (i == messagesSectionRow2) { ((HeaderCell) view).setText(LocaleController.getString("MessagesSettings", R.string.MessagesSettings)); } else if (i == <API key>) { ((HeaderCell) view).setText(LocaleController.getString("<API key>", R.string.<API key>)); } else if (i == numberSectionRow) { ((HeaderCell) view).setText(LocaleController.getString("Info", R.string.Info)); } else if (i == newgeramsectionrow2) { ((HeaderCell) view).setText(LocaleController.getString("NewGramSettings", R.string.newgeramsettings)); } } else if (type == 5) { if (view == null) { view = new TextInfoCell(mContext); try { PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0); int code = pInfo.versionCode / 10; String abi = ""; switch (pInfo.versionCode % 10) { case 0: abi = "arm"; break; case 1: abi = "arm-v7a"; break; case 2: abi = "x86"; break; case 3: abi = "universal"; break; } ((TextInfoCell) view).setText(String.format(Locale.US, "AriaGram for Android v%s (%d) %s", pInfo.versionName, code, abi)); } catch (Exception e) { FileLog.e("tmessages", e); } } } else if (type == 6) { if (view == null) { view = new <API key>(mContext); } <API key> textCell = (<API key>) view; if (i == mobileDownloadRow || i == wifiDownloadRow || i == roamingDownloadRow) { int mask; String value; SharedPreferences preferences = ApplicationLoader.applicationContext.<API key>("mainconfig", Activity.MODE_PRIVATE); if (i == mobileDownloadRow) { value = LocaleController.getString("WhenUsingMobileData", R.string.WhenUsingMobileData); mask = MediaController.getInstance().<API key>; } else if (i == wifiDownloadRow) { value = LocaleController.getString("WhenConnectedOnWiFi", R.string.WhenConnectedOnWiFi); mask = MediaController.getInstance().wifiDownloadMask; } else { value = LocaleController.getString("WhenRoaming", R.string.WhenRoaming); mask = MediaController.getInstance().roamingDownloadMask; } String text = ""; if ((mask & MediaController.<API key>) != 0) { text += LocaleController.getString("AttachPhoto", R.string.AttachPhoto); } if ((mask & MediaController.<API key>) != 0) { if (text.length() != 0) { text += ", "; } text += LocaleController.getString("AttachAudio", R.string.AttachAudio); } if ((mask & MediaController.<API key>) != 0) { if (text.length() != 0) { text += ", "; } text += LocaleController.getString("AttachVideo", R.string.AttachVideo); } if ((mask & MediaController.<API key>) != 0) { if (text.length() != 0) { text += ", "; } text += LocaleController.getString("AttachDocument", R.string.AttachDocument); } if ((mask & MediaController.<API key>) != 0) { if (text.length() != 0) { text += ", "; } text += LocaleController.getString("AttachMusic", R.string.AttachMusic); } if (Build.VERSION.SDK_INT >= 11) { if ((mask & MediaController.<API key>) != 0) { if (text.length() != 0) { text += ", "; } text += LocaleController.getString("AttachGif", R.string.AttachGif); } } if (text.length() == 0) { text = LocaleController.getString("NoMediaAutoDownload", R.string.NoMediaAutoDownload); } textCell.setTextAndValue(value, text, true); } else if (i == numberRow) { TLRPC.User user = UserConfig.getCurrentUser(); String value; if (user != null && user.phone != null && user.phone.length() != 0) { value = PhoneFormat.getInstance().format("+" + user.phone); } else { value = LocaleController.getString("NumberUnknown", R.string.NumberUnknown); } textCell.setTextAndValue(value, LocaleController.getString("Phone", R.string.Phone), true); } else if (i == usernameRow) { TLRPC.User user = UserConfig.getCurrentUser(); String value; if (user != null && user.username != null && user.username.length() != 0) { value = "@" + user.username; } else { value = LocaleController.getString("UsernameEmpty", R.string.UsernameEmpty); } // Log.i("username",""+ user.username); textCell.setTextAndValue(value, LocaleController.getString("Username", R.string.Username), false); } } return view; } @Override public int getItemViewType(int i) { if (i == emptyRow || i == overscrollRow) { return 0; } if (i == answeringmachinerow || i == settingsSectionRow || i == newgeramsectionrow || i == supportSectionRow || i == messagesSectionRow || i == <API key> || i == contactsSectionRow) { return 1; } else if (i == enableAnimationsRow || i == tabletforceoverride || i == showdateshamsi || i == showtimeago || i == <API key> || i == sendtyping || i == ghostactivate || i == sendByEnterRow || i == saveToGalleryRow || i == autoplayGifsRow || i == raiseToSpeakRow || i == customTabsRow || i == directShareRow) { return 3; } else if (i == notificationRow || i == answermachinetext || i == backgroundRow || i == askQuestionRow || i == sendLogsRow || i == privacyRow || i == clearLogsRow || i == <API key> || i == telegramFaqRow || i == contactsReimportRow || i == textSizeRow || i == fontType || i == languageRow || i == contactsSortRow || i == stickersRow || i == cacheRow || i == privacyPolicyRow) { return 2; } else if (i == versionRow) { return 5; } else if (i == wifiDownloadRow || i == mobileDownloadRow || i == roamingDownloadRow || i == numberRow || i == usernameRow) { return 6; } else if (i == settingsSectionRow2 || i == <API key> || i == newgeramsectionrow2 || i == messagesSectionRow2 || i == supportSectionRow2 || i == numberSectionRow || i == <API key>) { return 4; } else { return 2; } } @Override public int getViewTypeCount() { return 7; } @Override public boolean isEmpty() { return false; } } }
using test.Controls; namespace test { partial class TestTransform { <summary> Required designer variable. </summary> private System.ComponentModel.IContainer components = null; <summary> Clean up any resources being used. </summary> <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code <summary> Required method for Designer support - do not modify the contents of this method with the code editor. </summary> private void InitializeComponent() { this.bottomPanel = new System.Windows.Forms.FlowLayoutPanel(); this.cancelButton = new System.Windows.Forms.Button(); this.okButton = new System.Windows.Forms.Button(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.xNumeric = new System.Windows.Forms.NumericUpDown(); this.yNumeric = new System.Windows.Forms.NumericUpDown(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.wNumeric = new System.Windows.Forms.NumericUpDown(); this.hNumeric = new System.Windows.Forms.NumericUpDown(); this.positionLabel = new System.Windows.Forms.Label(); this.sizeLabel = new System.Windows.Forms.Label(); this.rotationLabel = new System.Windows.Forms.Label(); this.<API key> = new System.Windows.Forms.Label(); this.Alignment = new test.Controls.AlignmentBox(); this.Rotation = new test.Controls.RotationBox(); this.bottomPanel.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.xNumeric)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.yNumeric)).BeginInit(); this.flowLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.wNumeric)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.hNumeric)).BeginInit(); this.SuspendLayout(); // bottomPanel this.bottomPanel.AutoSize = true; this.bottomPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.bottomPanel.Controls.Add(this.cancelButton); this.bottomPanel.Controls.Add(this.okButton); this.bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom; this.bottomPanel.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; this.bottomPanel.Location = new System.Drawing.Point(0, 230); this.bottomPanel.Name = "bottomPanel"; this.bottomPanel.Size = new System.Drawing.Size(364, 29); this.bottomPanel.TabIndex = 0; // cancelButton this.cancelButton.Location = new System.Drawing.Point(286, 3); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(75, 23); this.cancelButton.TabIndex = 1; this.cancelButton.Text = "Cancel"; this.cancelButton.<API key> = true; // okButton this.okButton.Location = new System.Drawing.Point(205, 3); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 0; this.okButton.Text = "OK"; this.okButton.<API key> = true; // tableLayoutPanel1 this.tableLayoutPanel1.AutoSize = true; this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 1, 0); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 1, 1); this.tableLayoutPanel1.Controls.Add(this.positionLabel, 0, 0); this.tableLayoutPanel1.Controls.Add(this.sizeLabel, 0, 1); this.tableLayoutPanel1.Controls.Add(this.rotationLabel, 0, 2); this.tableLayoutPanel1.Controls.Add(this.<API key>, 0, 3); this.tableLayoutPanel1.Controls.Add(this.Alignment, 1, 3); this.tableLayoutPanel1.Controls.Add(this.Rotation, 1, 2); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 5; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(364, 230); this.tableLayoutPanel1.TabIndex = 0; // flowLayoutPanel2 this.flowLayoutPanel2.AutoSize = true; this.flowLayoutPanel2.Controls.Add(this.xNumeric); this.flowLayoutPanel2.Controls.Add(this.yNumeric); this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel2.Location = new System.Drawing.Point(107, 0); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Size = new System.Drawing.Size(257, 26); this.flowLayoutPanel2.TabIndex = 7; // xNumeric this.xNumeric.DecimalPlaces = 3; this.xNumeric.Location = new System.Drawing.Point(3, 3); this.xNumeric.Name = "xNumeric"; this.xNumeric.Size = new System.Drawing.Size(120, 20); this.xNumeric.TabIndex = 0; // yNumeric this.yNumeric.DecimalPlaces = 3; this.yNumeric.Location = new System.Drawing.Point(129, 3); this.yNumeric.Name = "yNumeric"; this.yNumeric.Size = new System.Drawing.Size(120, 20); this.yNumeric.TabIndex = 1; // flowLayoutPanel1 this.flowLayoutPanel1.AutoSize = true; this.flowLayoutPanel1.Controls.Add(this.wNumeric); this.flowLayoutPanel1.Controls.Add(this.hNumeric); this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel1.Location = new System.Drawing.Point(107, 26); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Size = new System.Drawing.Size(257, 26); this.flowLayoutPanel1.TabIndex = 1; // wNumeric this.wNumeric.DecimalPlaces = 3; this.wNumeric.Location = new System.Drawing.Point(3, 3); this.wNumeric.Name = "wNumeric"; this.wNumeric.Size = new System.Drawing.Size(120, 20); this.wNumeric.TabIndex = 1; // hNumeric this.hNumeric.DecimalPlaces = 3; this.hNumeric.Location = new System.Drawing.Point(129, 3); this.hNumeric.Name = "hNumeric"; this.hNumeric.Size = new System.Drawing.Size(120, 20); this.hNumeric.TabIndex = 0; // positionLabel this.positionLabel.AutoSize = true; this.positionLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.positionLabel.Location = new System.Drawing.Point(3, 0); this.positionLabel.Name = "positionLabel"; this.positionLabel.Size = new System.Drawing.Size(101, 26); this.positionLabel.TabIndex = 0; this.positionLabel.Text = "Position"; this.positionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // sizeLabel this.sizeLabel.AutoSize = true; this.sizeLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.sizeLabel.Location = new System.Drawing.Point(3, 26); this.sizeLabel.Name = "sizeLabel"; this.sizeLabel.Size = new System.Drawing.Size(101, 26); this.sizeLabel.TabIndex = 6; this.sizeLabel.Text = "Size"; this.sizeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // rotationLabel this.rotationLabel.AutoSize = true; this.rotationLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.rotationLabel.Location = new System.Drawing.Point(3, 52); this.rotationLabel.Name = "rotationLabel"; this.rotationLabel.Size = new System.Drawing.Size(101, 78); this.rotationLabel.TabIndex = 5; this.rotationLabel.Text = "Rotation"; this.rotationLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // <API key> this.<API key>.AutoSize = true; this.<API key>.Dock = System.Windows.Forms.DockStyle.Fill; this.<API key>.Location = new System.Drawing.Point(3, 130); this.<API key>.Name = "<API key>"; this.<API key>.Size = new System.Drawing.Size(101, 78); this.<API key>.TabIndex = 4; this.<API key>.Text = "Positional Alignment"; this.<API key>.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // Alignment this.Alignment.Alignment = OBS.ObsAlignment.Center; this.Alignment.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.Alignment.AutoSize = true; this.Alignment.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.Alignment.Location = new System.Drawing.Point(110, 133); this.Alignment.Name = "Alignment"; this.Alignment.Size = new System.Drawing.Size(72, 72); this.Alignment.TabIndex = 2; // Rotation this.Rotation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.Rotation.Debug = false; this.Rotation.Location = new System.Drawing.Point(110, 55); this.Rotation.MaximumSize = new System.Drawing.Size(400, 400); this.Rotation.MinimumSize = new System.Drawing.Size(50, 50); this.Rotation.Name = "Rotation"; this.Rotation.Rotation = 0; this.Rotation.Size = new System.Drawing.Size(72, 72); this.Rotation.SnapAngle = 45; this.Rotation.SnapToAngle = true; this.Rotation.SnapTolerance = 10; this.Rotation.TabIndex = 3; // TestTransform this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoSize = true; this.ClientSize = new System.Drawing.Size(364, 259); this.ControlBox = false; this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.bottomPanel); this.Name = "TestTransform"; this.ShowIcon = false; this.ShowInTaskbar = false; this.Text = "Edit Transform"; this.bottomPanel.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); this.flowLayoutPanel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.xNumeric)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.yNumeric)).EndInit(); this.flowLayoutPanel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.wNumeric)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.hNumeric)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.FlowLayoutPanel bottomPanel; private System.Windows.Forms.Button cancelButton; private System.Windows.Forms.Button okButton; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.NumericUpDown wNumeric; private System.Windows.Forms.NumericUpDown hNumeric; private System.Windows.Forms.Label positionLabel; private System.Windows.Forms.Label sizeLabel; private System.Windows.Forms.Label rotationLabel; private System.Windows.Forms.Label <API key>; private AlignmentBox Alignment; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; private System.Windows.Forms.NumericUpDown xNumeric; private System.Windows.Forms.NumericUpDown yNumeric; private RotationBox Rotation; } }
/* * all header files */ #ifndef __AUFS_H__ #define __AUFS_H__ #ifdef __KERNEL__ #define AuStub(type, name, body, ...) \ static inline type name(__VA_ARGS__) { body; } #define AuStubVoid(name, ...) \ AuStub(void, name, , __VA_ARGS__) #define AuStubInt0(name, ...) \ AuStub(int, name, return 0, __VA_ARGS__) #include "debug.h" #include "branch.h" #include "cpup.h" #include "dcsub.h" #include "dbgaufs.h" #include "dentry.h" #include "dir.h" #include "dynop.h" #include "file.h" #include "fstype.h" #include "inode.h" #include "loop.h" #include "module.h" #include "opts.h" #include "rwsem.h" #include "spl.h" #include "super.h" #include "sysaufs.h" #include "vfsub.h" #include "whout.h" #include "wkq.h" #endif /* __KERNEL__ */ #endif /* __AUFS_H__ */
package com.rapidminer.operator.similarity; import java.util.Iterator; import com.rapidminer.example.Attribute; import com.rapidminer.example.Attributes; import com.rapidminer.example.Example; import com.rapidminer.example.ExampleSet; import com.rapidminer.example.SimpleAttributes; import com.rapidminer.example.set.<API key>; import com.rapidminer.example.set.AbstractExampleSet; import com.rapidminer.example.set.MappedExampleSet; import com.rapidminer.example.table.AttributeFactory; import com.rapidminer.example.table.DoubleArrayDataRow; import com.rapidminer.example.table.ExampleTable; import com.rapidminer.example.table.NominalMapping; import com.rapidminer.tools.Ontology; import com.rapidminer.tools.math.similarity.DistanceMeasure; /** * This similarity based example set is used for the operator * {@link <API key>}. * * @author Ingo Mierswa * @version $Id: <API key>.java,v 1.1 2008/09/08 18:53:49 ingomierswa Exp $ */ public class <API key> extends AbstractExampleSet { private static final long serialVersionUID = <API key>; private static class IndexExampleReader extends <API key> { private int index = 0; private ExampleSet exampleSet; public IndexExampleReader(ExampleSet exampleSet) { this.exampleSet = exampleSet; } public boolean hasNext() { return index < exampleSet.size() - 1; } public Example next() { Example example = exampleSet.getExample(index); index++; return example; } } private ExampleSet parent; private Attribute parentIdAttribute; private Attributes attributes; private DistanceMeasure measure; public <API key>(ExampleSet parent, DistanceMeasure measure) { this.parent = parent; this.parentIdAttribute = parent.getAttributes().getId(); this.attributes = new SimpleAttributes(); Attribute firstIdAttribute = null; Attribute secondIdAttribute = null; if (parentIdAttribute.isNominal()) { firstIdAttribute = AttributeFactory.createAttribute("FIRST_ID", Ontology.NOMINAL); secondIdAttribute = AttributeFactory.createAttribute("SECOND_ID", Ontology.NOMINAL); } else { firstIdAttribute = AttributeFactory.createAttribute("FIRST_ID", Ontology.NUMERICAL); secondIdAttribute = AttributeFactory.createAttribute("SECOND_ID", Ontology.NUMERICAL); } this.attributes.addRegular(firstIdAttribute); this.attributes.addRegular(secondIdAttribute); firstIdAttribute.setTableIndex(0); secondIdAttribute.setTableIndex(1); // copying mapping of original id attribute if (parentIdAttribute.isNominal()) { NominalMapping mapping = parentIdAttribute.getMapping(); firstIdAttribute.setMapping(mapping); secondIdAttribute.setMapping(mapping); } String name = "SIMILARITY"; if (measure.isDistance()) { name = "DISTANCE"; } Attribute similarityAttribute = AttributeFactory.createAttribute(name, Ontology.REAL); this.attributes.addRegular(similarityAttribute); similarityAttribute.setTableIndex(2); this.measure = measure; } public boolean equals(Object o) { if (!super.equals(o)) return false; if (!(o instanceof MappedExampleSet)) return false; <API key> other = (<API key>)o; if (!this.measure.getClass().equals(other.measure.getClass())) return false; return true; } public int hashCode() { return super.hashCode() ^ this.measure.getClass().hashCode(); } public Attributes getAttributes() { return this.attributes; } public Example getExample(int index) { int firstIndex = index / this.parent.size(); int secondIndex = index % this.parent.size(); Example firstExample = this.parent.getExample(firstIndex); Example secondExample = this.parent.getExample(secondIndex); double[] data = new double[3]; data[0] = firstExample.getValue(parentIdAttribute); data[1] = secondExample.getValue(parentIdAttribute); if (measure.isDistance()) data[2] = measure.calculateDistance(firstExample, secondExample); else data[2] = measure.calculateSimilarity(firstExample, secondExample); return new Example(new DoubleArrayDataRow(data), this); } public Iterator<Example> iterator() { return new IndexExampleReader(this); } public ExampleTable getExampleTable() { return null;//this.parent.getExampleTable(); } public int size() { return this.parent.size() * this.parent.size(); } }
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ #ifndef <API key> #define <API key> #include <glib.h> #include <glib-object.h> #include <nm-connection.h> #include <<API key>.h> G_BEGIN_DECLS #define PLUGIN_PRINT(pname, fmt, args...) \ { g_message (" " pname ": " fmt, ##args); } #define PLUGIN_WARN(pname, fmt, args...) \ { g_warning (" " pname ": " fmt, ##args); } /* Plugin's factory function that returns a GObject that implements * <API key>. */ GObject * <API key> (void); #define <API key> (<API key> ()) #define <API key>(obj) (<API key> ((obj), <API key>, <API key>)) #define <API key>(obj) (<API key> ((obj), <API key>)) #define <API key>(obj) (<API key> ((obj), <API key>, <API key>)) #define <API key> "name" #define <API key> "info" #define <API key> "capabilities" #define <API key> "hostname" #define <API key> "<API key>" #define <API key> "<API key>" #define <API key> "connection-added" typedef enum { <API key> = 0x00000000, <API key> = 0x00000001, <API key> = 0x00000002 /* When adding more capabilities, be sure to update the "Capabilities" * property max value in <API key>.c. */ } <API key>; typedef enum { <API key> = 0x1000, <API key> = <API key>, <API key>, <API key>, <API key>, } <API key>; typedef struct <API key> <API key>; struct <API key> { GTypeInterface g_iface; /* Called when the plugin is loaded to initialize it */ void (*init) (<API key> *config); /* Returns a GSList of <API key> objects that represent * connections the plugin knows about. The returned list is freed by the * system settings service. */ GSList * (*get_connections) (<API key> *config); /* Requests that the plugin load/reload a single connection, if it * recognizes the filename. Returns success or failure. */ gboolean (*load_connection) (<API key> *config, const char *filename); /* Requests that the plugin reload all connection files from disk, * and emit signals reflecting new, changed, and removed connections. */ void (*reload_connections) (<API key> *config); /* * Return a string list of specifications of devices which NetworkManager * should not manage. Returned list will be freed by the system settings * service, and each element must be allocated using g_malloc() or its * variants (g_strdup, g_strdup_printf, etc). * * Each string in the list must be in one of the formats recognized by * <API key>(). */ GSList * (*get_unmanaged_specs) (<API key> *config); /* * Return a string list of specifications of devices for which at least * one <API key> configuration is defined. Returned list * will be freed by the system settings service, and each element must be * allocated using g_malloc() or its variants (g_strdup, g_strdup_printf, * etc). * * Each string in the list must be in one of the formats recognized by * <API key>(). */ GSList * (*<API key>) (<API key> *config); /* * Initialize the plugin-specific connection and return a new * <API key> subclass that contains the same settings as the * original connection. The connection should only be saved to backing * storage if @save_to_disk is TRUE. The returned object is owned by the * plugin and must be referenced by the owner if necessary. */ <API key> * (*add_connection) (<API key> *config, NMConnection *connection, gboolean save_to_disk, GError **error); /* Signals */ /* Emitted when a new connection has been found by the plugin */ void (*connection_added) (<API key> *config, <API key> *connection); /* Emitted when the list of unmanaged device specifications changes */ void (*<API key>) (<API key> *config); /* Emitted when the list of devices with unrecognized connections changes */ void (*<API key>) (<API key> *config); }; GType <API key> (void); void <API key> (<API key> *config, gpointer unused); GSList *<API key> (<API key> *config); gboolean <API key> (<API key> *config, const char *filename); void <API key> (<API key> *config); GSList *<API key> (<API key> *config); GSList *<API key> (<API key> *config); <API key> *<API key> (<API key> *config, NMConnection *connection, gboolean save_to_disk, GError **error); G_END_DECLS #endif /* <API key> */
#include "CoreAudioDevice.h" #include "CoreAudioAEHAL.h" #include "<API key>.h" #include "CoreAudioHardware.h" #include "utils/log.h" // CCoreAudioDevice CCoreAudioDevice::CCoreAudioDevice() : m_Started (false ), m_pSource (NULL ), m_DeviceId (0 ), m_MixerRestore (-1 ), m_IoProc (NULL ), <API key> (NULL ), m_SampleRateRestore (0.0f ), m_HogPid (-1 ), m_frameSize (0 ), m_OutputBufferIndex (0 ), m_BufferSizeRestore (0 ) { } CCoreAudioDevice::CCoreAudioDevice(AudioDeviceID deviceId) : m_Started (false ), m_pSource (NULL ), m_DeviceId (deviceId ), m_MixerRestore (-1 ), m_IoProc (NULL ), <API key> (NULL ), m_SampleRateRestore (0.0f ), m_HogPid (-1 ), m_frameSize (0 ), m_OutputBufferIndex (0 ), m_BufferSizeRestore (0 ) { } CCoreAudioDevice::~CCoreAudioDevice() { Close(); } bool CCoreAudioDevice::Open(AudioDeviceID deviceId) { m_DeviceId = deviceId; m_BufferSizeRestore = GetBufferSize(); return true; } void CCoreAudioDevice::Close() { if (!m_DeviceId) return; // Stop the device if it was started Stop(); // Unregister the IOProc if we have one if (m_IoProc) SetInputSource(NULL, 0, 0); SetHogStatus(false); CCoreAudioHardware::SetAutoHogMode(false); if (m_MixerRestore > -1) // We changed the mixer status SetMixingSupport((m_MixerRestore ? true : false)); m_MixerRestore = -1; if (m_SampleRateRestore != 0.0f) <API key>(m_SampleRateRestore); if (m_BufferSizeRestore && m_BufferSizeRestore != GetBufferSize()) { SetBufferSize(m_BufferSizeRestore); m_BufferSizeRestore = 0; } m_IoProc = NULL; m_pSource = NULL; m_DeviceId = 0; <API key> = NULL; } void CCoreAudioDevice::Start() { if (!m_DeviceId || m_Started) return; OSStatus ret = AudioDeviceStart(m_DeviceId, m_IoProc); if (ret) CLog::Log(LOGERROR, "CCoreAudioDevice::Start: " "Unable to start device. Error = %s", GetError(ret).c_str()); else m_Started = true; } void CCoreAudioDevice::Stop() { if (!m_DeviceId || !m_Started) return; OSStatus ret = AudioDeviceStop(m_DeviceId, m_IoProc); if (ret) CLog::Log(LOGERROR, "CCoreAudioDevice::Stop: " "Unable to stop device. Error = %s", GetError(ret).c_str()); m_Started = false; } void CCoreAudioDevice::<API key>(<API key> callback, void* pClientData) { if (!m_DeviceId) return; <API key> audioProperty; audioProperty.mSelector = <API key>; audioProperty.mScope = <API key>; audioProperty.mElement = <API key>; OSStatus ret = <API key>(m_DeviceId, &audioProperty, callback, pClientData); if (ret) { CLog::Log(LOGERROR, "CCoreAudioDevice::<API key>: " "Unable to set ObjectListener callback. Error = %s", GetError(ret).c_str()); } <API key> = NULL; } bool CCoreAudioDevice::<API key>(<API key> callback, void* pClientData) { // Allow only one ObjectListener at a time if (!m_DeviceId || <API key>) return false; <API key> audioProperty; audioProperty.mSelector = <API key>; audioProperty.mScope = <API key>; audioProperty.mElement = <API key>; OSStatus ret = <API key>(m_DeviceId, &audioProperty, callback, pClientData); if (ret) { CLog::Log(LOGERROR, "CCoreAudioDevice::<API key>: " "Unable to remove ObjectListener callback. Error = %s", GetError(ret).c_str()); return false; } <API key> = callback; return true; } bool CCoreAudioDevice::SetInputSource(ICoreAudioSource* pSource, unsigned int frameSize, unsigned int outputBufferIndex) { m_pSource = pSource; m_frameSize = frameSize; m_OutputBufferIndex = outputBufferIndex; if (pSource) return AddIOProc(); else return RemoveIOProc(); } bool CCoreAudioDevice::AddIOProc() { // Allow only one IOProc at a time if (!m_DeviceId || m_IoProc) return false; OSStatus ret = <API key>(m_DeviceId, <API key>, this, &m_IoProc); if (ret) { CLog::Log(LOGERROR, "CCoreAudioDevice::AddIOProc: " "Unable to add IOProc. Error = %s", GetError(ret).c_str()); m_IoProc = NULL; return false; } Start(); return true; } bool CCoreAudioDevice::RemoveIOProc() { if (!m_DeviceId || !m_IoProc) return false; Stop(); OSStatus ret = <API key>(m_DeviceId, m_IoProc); if (ret) CLog::Log(LOGERROR, "CCoreAudioDevice::RemoveIOProc: " "Unable to remove IOProc. Error = %s", GetError(ret).c_str()); m_IoProc = NULL; // Clear the reference no matter what m_pSource = NULL; Sleep(100); return true; } std::string CCoreAudioDevice::GetName() { if (!m_DeviceId) return NULL; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; UInt32 propertySize; OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &propertySize); if (ret != noErr) return NULL; std::string name = ""; char *buff = new char[propertySize + 1]; buff[propertySize] = 0x00; ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, buff); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::GetName: " "Unable to get device name - id: 0x%04x. Error = %s", (uint)m_DeviceId, GetError(ret).c_str()); } else { name = buff; } delete buff; return name; } UInt32 CCoreAudioDevice::<API key>() { UInt32 channels = 0; if (!m_DeviceId) return channels; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; UInt32 size = 0; OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &size); if (ret != noErr) return channels; AudioBufferList* pList = (AudioBufferList*)malloc(size); ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &size, pList); if (ret == noErr) { for(UInt32 buffer = 0; buffer < pList->mNumberBuffers; ++buffer) channels += pList->mBuffers[buffer].mNumberChannels; } else { CLog::Log(LOGERROR, "CCoreAudioDevice::<API key>: " "Unable to get total device output channels - id: 0x%04x. Error = %s", (uint)m_DeviceId, GetError(ret).c_str()); } free(pList); return channels; } bool CCoreAudioDevice::GetStreams(AudioStreamIdList* pList) { if (!pList || !m_DeviceId) return false; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; UInt32 propertySize = 0; OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &propertySize); if (ret != noErr) return false; UInt32 streamCount = propertySize / sizeof(AudioStreamID); AudioStreamID* pStreamList = new AudioStreamID[streamCount]; ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, pStreamList); if (ret == noErr) { for (UInt32 stream = 0; stream < streamCount; stream++) pList->push_back(pStreamList[stream]); } delete[] pStreamList; return ret == noErr; } bool CCoreAudioDevice::IsRunning() { <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; UInt32 isRunning = 0; UInt32 propertySize = sizeof(isRunning); OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, &isRunning); if (ret != noErr) return false; return isRunning != 0; } bool CCoreAudioDevice::SetHogStatus(bool hog) { // According to Jeff Moore (Core Audio, Apple), Setting <API key> // is a toggle and the only way to tell if you do get hog mode is to compare // the returned pid against getpid, if the match, you have hog mode, if not you don't. if (!m_DeviceId) return false; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; if (hog) { // Not already set if (m_HogPid == -1) { OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, sizeof(m_HogPid), &m_HogPid); // even if setting hogmode was successfull our PID might not get written // into m_HogPid (so it stays -1). Readback hogstatus for judging if we // had success on getting hog status m_HogPid = GetHogStatus(); if (ret || m_HogPid != getpid()) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetHogStatus: " "Unable to set 'hog' status. Error = %s", GetError(ret).c_str()); return false; } } } else { // Currently Set if (m_HogPid > -1) { pid_t hogPid = -1; OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, sizeof(hogPid), &hogPid); if (ret || hogPid == getpid()) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetHogStatus: " "Unable to release 'hog' status. Error = %s", GetError(ret).c_str()); return false; } // Reset internal state m_HogPid = hogPid; } } return true; } pid_t CCoreAudioDevice::GetHogStatus() { if (!m_DeviceId) return false; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; pid_t hogPid = -1; UInt32 size = sizeof(hogPid); <API key>(m_DeviceId, &propertyAddress, 0, NULL, &size, &hogPid); return hogPid; } bool CCoreAudioDevice::SetMixingSupport(UInt32 mix) { if (!m_DeviceId) return false; if (!GetMixingSupport()) return false; int restore = -1; if (m_MixerRestore == -1) { // This is our first change to this setting. Store the original setting for restore restore = (GetMixingSupport() ? 1 : 0); } <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; UInt32 mixEnable = mix ? 1 : 0; OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, sizeof(mixEnable), &mixEnable); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetMixingSupport: " "Unable to set MixingSupport to %s. Error = %s", mix ? "'On'" : "'Off'", GetError(ret).c_str()); return false; } if (m_MixerRestore == -1) m_MixerRestore = restore; return true; } bool CCoreAudioDevice::GetMixingSupport() { if (!m_DeviceId) return false; UInt32 size; UInt32 mix = 0; Boolean writable = false; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; if( <API key>( m_DeviceId, &propertyAddress ) ) { OSStatus ret = <API key>(m_DeviceId, &propertyAddress, &writable); if (ret) { CLog::Log(LOGERROR, "CCoreAudioDevice::SupportsMixing: " "Unable to get propertyinfo mixing support. Error = %s", GetError(ret).c_str()); writable = false; } if (writable) { size = sizeof(mix); ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &size, &mix); if (ret != noErr) mix = 0; } } CLog::Log(LOGERROR, "CCoreAudioDevice::SupportsMixing: " "Device mixing support : %s.", mix ? "'Yes'" : "'No'"); return (mix > 0); } bool CCoreAudioDevice::SetCurrentVolume(Float32 vol) { if (!m_DeviceId) return false; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, sizeof(Float32), &vol); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetCurrentVolume: " "Unable to set AudioUnit volume. Error = %s", GetError(ret).c_str()); return false; } return true; } bool CCoreAudioDevice::<API key>(<API key>& layout) { if (!m_DeviceId) return false; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; UInt32 propertySize = 0; OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &propertySize); if (ret) return false; void* pBuf = malloc(propertySize); ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, pBuf); if (ret != noErr) CLog::Log(LOGERROR, "CCoreAudioDevice::<API key>: " "Unable to retrieve preferred channel layout. Error = %s", GetError(ret).c_str()); else { // Copy the result into the caller's instance layout.CopyLayout(*((AudioChannelLayout*)pBuf)); } free(pBuf); return (ret == noErr); } bool CCoreAudioDevice::GetDataSources(<API key>* pList) { if (!pList || !m_DeviceId) return false; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; UInt32 propertySize = 0; OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &propertySize); if (ret != noErr) return false; UInt32 sources = propertySize / sizeof(UInt32); UInt32* pSources = new UInt32[sources]; ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, pSources); if (ret == noErr) { for (UInt32 i = 0; i < sources; i++) pList->push_back(pSources[i]); } delete[] pSources; return (!ret); } Float64 CCoreAudioDevice::<API key>() { if (!m_DeviceId) return 0.0f; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; Float64 sampleRate = 0.0f; UInt32 propertySize = sizeof(Float64); OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, &sampleRate); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::<API key>: " "Unable to retrieve current device sample rate. Error = %s", GetError(ret).c_str()); return 0.0f; } return sampleRate; } bool CCoreAudioDevice::<API key>(Float64 sampleRate) { if (!m_DeviceId || sampleRate == 0.0f) return false; Float64 currentRate = <API key>(); if (currentRate == sampleRate) return true; //No need to change <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, sizeof(Float64), &sampleRate); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::<API key>: " "Unable to set current device sample rate to %0.0f. Error = %s", (float)sampleRate, GetError(ret).c_str()); return false; } if (m_SampleRateRestore == 0.0f) m_SampleRateRestore = currentRate; return true; } UInt32 CCoreAudioDevice::GetNumLatencyFrames() { UInt32 num_latency_frames = 0; if (!m_DeviceId) return 0; // number of frames of latency in the AudioDevice <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; UInt32 i_param = 0; UInt32 i_param_size = sizeof(uint32_t); OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &i_param_size, &i_param); if (ret == noErr) num_latency_frames += i_param; // number of frames in the IO buffers propertyAddress.mSelector = <API key>; ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &i_param_size, &i_param); if (ret == noErr) num_latency_frames += i_param; // number for frames in ahead the current hardware position that is safe to do IO propertyAddress.mSelector = <API key>; ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &i_param_size, &i_param); if (ret == noErr) num_latency_frames += i_param; return (num_latency_frames); } UInt32 CCoreAudioDevice::GetBufferSize() { if (!m_DeviceId) return false; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; UInt32 size = 0; UInt32 propertySize = sizeof(size); OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, &size); if (ret != noErr) CLog::Log(LOGERROR, "CCoreAudioDevice::GetBufferSize: " "Unable to retrieve buffer size. Error = %s", GetError(ret).c_str()); return size; } bool CCoreAudioDevice::SetBufferSize(UInt32 size) { if (!m_DeviceId) return false; <API key> propertyAddress; propertyAddress.mScope = <API key>; propertyAddress.mElement = 0; propertyAddress.mSelector = <API key>; UInt32 propertySize = sizeof(size); OSStatus ret = <API key>(m_DeviceId, &propertyAddress, 0, NULL, propertySize, &size); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetBufferSize: " "Unable to set buffer size. Error = %s", GetError(ret).c_str()); } if (GetBufferSize() != size) CLog::Log(LOGERROR, "CCoreAudioDevice::SetBufferSize: Buffer size change not applied."); return (ret == noErr); } OSStatus CCoreAudioDevice::<API key>(AudioDeviceID inDevice, const AudioTimeStamp *inNow, const AudioBufferList *inInputData, const AudioTimeStamp *inInputTime, AudioBufferList *outOutputData, const AudioTimeStamp *inOutputTime, void *inClientData) { OSStatus ret = noErr; CCoreAudioDevice *audioDevice = (CCoreAudioDevice*)inClientData; if (audioDevice->m_pSource && audioDevice->m_frameSize) { UInt32 frames = outOutputData->mBuffers[audioDevice->m_OutputBufferIndex].mDataByteSize / audioDevice->m_frameSize; ret = audioDevice->m_pSource->Render(NULL, inInputTime, 0, frames, outOutputData); } else { outOutputData->mBuffers[audioDevice->m_OutputBufferIndex].mDataByteSize = 0; } return ret; }
<?php /** * Write users to file * @param string $filename * @param array $array_data * @return null */ // function insert($user,$config) function readUser($id, $config) { switch ($config['adapter']) { case 'txt': include_once('file/users.php'); $user=readUserFromFile($id, $config); return $users; break; case 'mysql': include_once('mysql/users.php'); $users = select($id,$config); return $users; break; case 'googledocs': include_once('googledocs/users.php'); $users = selectAll($config); return $users; break; } } function update($user, $id, $config) { switch ($config['adapter']) { case 'txt': include_once('file/users.php'); updateUserTofile($id, $user, $user['filename'], $config); return; break; case 'mysql': include_once('mysql/users.php'); $users = updateUser($id, $user, $config); return $users; break; case 'googledocs': include_once('googledocs/users.php'); $users = selectAll($config); return $users; break; } } // function select($id, $config) function readUsers($config) { switch ($config['adapter']) { case 'txt': include_once('file/users.php'); $users=readUsersFromFile($config); return $users; break; case 'mysql': include_once('mysql/users.php'); $users = selectAll($config); return $users; break; case 'googledocs': include_once('googledocs/users.php'); $users = selectAll($config); return $users; break; } } // function delete($id, $config)
ace_comment { color: #a86; } ace_keyword { line-height: 1em; font-weight: bold; color: blue; } ace_string { color: #a22; } ace_builtin { line-height: 1em; font-weight: bold; color: #077; } ace_special { line-height: 1em; font-weight: bold; color: #0aa; } ace_variable { color: black; } ace_number, ace_atom { color: #3a3; } ace_meta { color: #555; } ace_link { color: #3a3; } <API key> { background: #e8f2ff; } ace_matchingbracket { outline:1px solid grey; color:black !important; }
import Database.Messages.ProjectMetaData; import Database.Sensors.Sensor; import Errors.BackendError; import FrontendConnection.Backend; import FrontendConnection.Listeners.<API key>; import protobuf.Protocol; import java.util.ArrayList; import java.util.List; import java.util.Random; public class NewDebugger implements <API key> { private boolean projectListChanged; public NewDebugger(){ try{ Backend.createInstance(null); //args[0],Integer.parseInt(args[1]), Backend.getInstance().<API key>(this); Backend.getInstance().connectToServer("130.236.63.46",2001); } catch (BackendError b){ b.printStackTrace(); } projectListChanged = false; } private synchronized boolean readWriteBoolean(Boolean b){ if(b!=null) projectListChanged=b; return projectListChanged; } public void runPlayback() { try{ Thread.sleep(1000); //Backend.getInstance().<API key>(0); readWriteBoolean(false); Random r = new Random(); String[] strings = new String[]{"Name","Code","File","Today","Monday","Tuesday","Wednesday","Thursday","Friday","Gotta","Get","Out","It","S","Friday"}; String project = "projectName" +r.nextInt()%10000; String playbackProject = "realCollection"; Thread.sleep(1000); System.out.println("Setting active project to : " + playbackProject); Backend.getInstance().setActiveProject(playbackProject); ProjectMetaData d = new ProjectMetaData(); d.setTest_leader("ffu"); d.setDate(1l); List<String> s = new ArrayList<String>(); s.add("memer1"); d.setMember_names(s); d.setTags(s); d.setDescription("desc"); List l = d.getMember_names(); l.add(r.nextInt()+". name"); d.setMember_names(l); Backend.getInstance().sendProjectMetaData(d); System.out.println("starting data collection"); Thread.sleep(100); String experimentName = "smallrun"; //Backend.getInstance().setActiveProject(playbackProject); // projektnamn: Thread.sleep(3000); // Backend.getInstance().<API key>().getSensorId(); List<Protocol.SensorConfiguration> playbackConfig; playbackConfig = Backend.getInstance().<API key>(); List<Integer> listOfIds = new ArrayList<Integer>(); /* for (Protocol.SensorConfiguration aPlaybackConfig : playbackConfig) { listOfIds.add(aPlaybackConfig.getSensorId()); }*/ System.out.println("LIST OF IDS SENT TO SERVER System.out.println(listOfIds); System.out.println("LIST OF IDS END System.out.println("LIST OF IDS CURRENTLY IN DATABASE System.out.println(Backend.getInstance().getSensors()); System.out.println("LIST IN DATABASE END Backend.getInstance().<API key>(experimentName, listOfIds); //Thread.sleep(3000); //Backend.getInstance().stopConnection(); } catch (BackendError b){ b.printStackTrace(); } catch (<API key> ignore){ } } public void run(){ try{ Thread.sleep(1000); Backend.getInstance().<API key>(0); readWriteBoolean(false); Random r = new Random(); String[] strings = new String[]{"Name","Code","File","Today","Monday","Tuesday","Wednesday","Thursday","Friday","Gotta","Get","Out","It","S","Friday"}; String project = "projectName" +r.nextInt()%10000; String playbackProject = "realCollection"; for(int i = 0; i < 1000; i++){ // project+=strings[r.nextInt(strings.length)]; } //System.out.println(project); //if(r.nextInt()>0) return; Thread.sleep(1000); Backend.getInstance().<API key>(project);//"projectName"+ System.currentTimeMillis()); if(!readWriteBoolean(null)){ System.out.println("Waiting on projectListAgain"); while (!readWriteBoolean(null)); System.out.println("finished waiting"); } // = Backend.getInstance().<API key>().get()); System.out.println("Setting active project to : " + project); Backend.getInstance().setActiveProject(project); ProjectMetaData d = new ProjectMetaData(); //d.setEmail("NotMyEmail@gmail.com"); d.setTest_leader("ffu"); d.setDate(1l); List<String> s = new ArrayList<String>(); s.add("memer1"); d.setMember_names(s); d.setTags(s); d.setDescription("desc"); List l = d.getMember_names(); l.add(r.nextInt() + ". name"); d.setMember_names(l); Backend.getInstance().sendProjectMetaData(d); /* while(!readWriteBoolean(null) && readWriteBoolean(null)){ Backend.getInstance().sendProjectMetaData(d); List<String> f =d.getTags(); f.add(String.valueOf(System.currentTimeMillis())); d.setTags(f); } **/ System.out.println("starting data collection"); Thread.sleep(100); String experimentName = "experimentNam5"+System.currentTimeMillis(); //String experimentName = "smallrun"; // projektnamn: Backend.getInstance().startDataCollection(experimentName); Thread.sleep(3000); Backend.getInstance().stopDataCollection(); Thread.sleep(1); } catch (BackendError b){ b.printStackTrace(); } catch (<API key> ignore){ } System.out.println("Exiting"); } public void runTest(){ // try{ // Thread.sleep(1000); Backend.getInstance().<API key>(0); // Thread.sleep(1000); Backend.getInstance().<API key>("projectName"+ System.currentTimeMillis()); // //Backend.getInstance().startDataCollection("test1234"); // //Thread.sleep(5000); Backend.getInstance().stopDataCollection(); // Backend localInstance = Backend.getInstance(); // Sensor sensor = localInstance.getSensors().get(0); // for(int i = 0; i<sensor.getAttributeList(0).size();i++){ // System.out.print(String.format("%f", sensor.getAttributeList(0).get(i).floatValue()).replace(',', '.') + ","); // System.out.print(sensor.getId() + ","); // for (int j = 1; j < sensor.getAttributesName().length;j++){ // System.out.print(sensor.getAttributeList(j).get(i).floatValue() + " ,"); // System.out.println(); // } catch (BackendError b){ // b.printStackTrace(); // } catch (<API key> ignore){} } @Override public void <API key>(Protocol.<API key>.ResponseType responseType) { readWriteBoolean(true); } }
using System; using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; namespace CaptainPav.Testing.UI.CodedUI.PageModeling.Wpf { <summary> Default implementation of a Wpf page model </summary> public abstract class WpfPageModelBase<T> : PageModelBase<T> where T : WpfControl { protected readonly WpfWindow parent; protected WpfPageModelBase(WpfWindow bw) { if (null == bw) { throw new <API key>(nameof(bw)); } this.parent = bw; } protected WpfWindow DocumentWindow => this.parent; } }
/*! \example testRobotAfma6.cpp Example of a real robot control, the Afma6 robot (cartesian robot, with 6 degrees of freedom). */ #include <visp3/core/vpCameraParameters.h> #include <visp3/core/vpDebug.h> #include <visp3/robot/vpRobotAfma6.h> #include <iostream> #ifdef VISP_HAVE_AFMA6 int main() { try { std::cout << "a test for vpRobotAfma6 class..." << std::endl; vpRobotAfma6 afma6; vpCameraParameters cam; std::cout << " std::cout << afma6 << std::endl; afma6.getCameraParameters(cam, 640, 480); std::cout << cam << std::endl; std::cout << " afma6.init(vpAfma6::TOOL_CCMOP); std::cout << afma6 << std::endl; afma6.getCameraParameters(cam, 640, 480); std::cout << cam << std::endl; std::cout << " afma6.init(vpAfma6::TOOL_CCMOP, vpCameraParameters::<API key>); std::cout << afma6 << std::endl; afma6.getCameraParameters(cam, 640, 480); std::cout << cam << std::endl; std::cout << " afma6.init(vpAfma6::TOOL_GRIPPER); std::cout << afma6 << std::endl; afma6.getCameraParameters(cam, 640, 480); std::cout << cam << std::endl; std::cout << " afma6.init(vpAfma6::TOOL_GRIPPER, vpCameraParameters::<API key>); std::cout << afma6 << std::endl; afma6.getCameraParameters(cam, 640, 480); std::cout << cam << std::endl; } catch (const vpException &e) { std::cout << "Catch an exception: " << e << std::endl; } return 0; } #else int main() { std::cout << "The real Afma6 robot controller is not available." << std::endl; return 0; } #endif
{% extends 'application_portal/base.html' %} {% block title %}Contact Form{% endblock %} {% block content %} <div class="container-fluid"> <div class="row-fluid"> <div class="span3"> <div class="well sidebar-nav"> <li class="nav-header">Important links</li> <ul class="nav nav-list"> <li><a href="/ladm/search/">View Parcel map</a> </li> <li><a href="/ladm/apply/">Submit applications</a> </li> </ul> </div> </div> <div class="span9"> <h2>Contact Form</h2> <p>To send us a message fill out the below form.</p> {% if errors %} <ul> {% for error in errors %} <li>{{ error }}</li> {% endfor %} </ul> {% endif %} <form action="/ladm/contact/" method="post"> {% csrf_token %} <div class="fieldWrapper"> <label>Subject:</label> <input type="text" name="subject"> </div> <br> <div class="fieldWrapper"> <label>Your e-mail (optional):</label> <input type="text" name="email"> </div> <br> <div class="fieldWrapper"> <label>Message: </label> <textarea name="message" class="input-block-level" rows="10" cols="100"></textarea> </div> <br> <input type="submit" name="submit" class="btn btn-primary" value="Submit"> </form> </div> </div> </div> {% endblock %}
#include "act2000.h" #include "capi.h" static actcapi_msgdsc valid_msg[] = { {{ 0x86, 0x02}, "DATA_B3_IND"}, /* DATA_B3_IND/CONF must be first because of speed!!! */ {{ 0x86, 0x01}, "DATA_B3_CONF"}, {{ 0x02, 0x01}, "CONNECT_CONF"}, {{ 0x02, 0x02}, "CONNECT_IND"}, {{ 0x09, 0x01}, "CONNECT_INFO_CONF"}, {{ 0x03, 0x02}, "CONNECT_ACTIVE_IND"}, {{ 0x04, 0x01}, "DISCONNECT_CONF"}, {{ 0x04, 0x02}, "DISCONNECT_IND"}, {{ 0x05, 0x01}, "LISTEN_CONF"}, {{ 0x06, 0x01}, "GET_PARAMS_CONF"}, {{ 0x07, 0x01}, "INFO_CONF"}, {{ 0x07, 0x02}, "INFO_IND"}, {{ 0x08, 0x01}, "DATA_CONF"}, {{ 0x08, 0x02}, "DATA_IND"}, {{ 0x40, 0x01}, "<API key>"}, {{ 0x80, 0x01}, "<API key>"}, {{ 0x81, 0x01}, "LISTEN_B3_CONF"}, {{ 0x82, 0x01}, "CONNECT_B3_CONF"}, {{ 0x82, 0x02}, "CONNECT_B3_IND"}, {{ 0x83, 0x02}, "<API key>"}, {{ 0x84, 0x01}, "DISCONNECT_B3_CONF"}, {{ 0x84, 0x02}, "DISCONNECT_B3_IND"}, {{ 0x85, 0x01}, "GET_B3_PARAMS_CONF"}, {{ 0x01, 0x01}, "RESET_B3_CONF"}, {{ 0x01, 0x02}, "RESET_B3_IND"}, /* {{ 0x87, 0x02, "HANDSET_IND"}, not implemented */ {{ 0xff, 0x01}, "MANUFACTURER_CONF"}, {{ 0xff, 0x02}, "MANUFACTURER_IND"}, #ifdef DEBUG_MSG /* Requests */ {{ 0x01, 0x00}, "RESET_B3_REQ"}, {{ 0x02, 0x00}, "CONNECT_REQ"}, {{ 0x04, 0x00}, "DISCONNECT_REQ"}, {{ 0x05, 0x00}, "LISTEN_REQ"}, {{ 0x06, 0x00}, "GET_PARAMS_REQ"}, {{ 0x07, 0x00}, "INFO_REQ"}, {{ 0x08, 0x00}, "DATA_REQ"}, {{ 0x09, 0x00}, "CONNECT_INFO_REQ"}, {{ 0x40, 0x00}, "<API key>"}, {{ 0x80, 0x00}, "<API key>"}, {{ 0x81, 0x00}, "LISTEN_B3_REQ"}, {{ 0x82, 0x00}, "CONNECT_B3_REQ"}, {{ 0x84, 0x00}, "DISCONNECT_B3_REQ"}, {{ 0x85, 0x00}, "GET_B3_PARAMS_REQ"}, {{ 0x86, 0x00}, "DATA_B3_REQ"}, {{ 0xff, 0x00}, "MANUFACTURER_REQ"}, /* Responses */ {{ 0x01, 0x03}, "RESET_B3_RESP"}, {{ 0x02, 0x03}, "CONNECT_RESP"}, {{ 0x03, 0x03}, "CONNECT_ACTIVE_RESP"}, {{ 0x04, 0x03}, "DISCONNECT_RESP"}, {{ 0x07, 0x03}, "INFO_RESP"}, {{ 0x08, 0x03}, "DATA_RESP"}, {{ 0x82, 0x03}, "CONNECT_B3_RESP"}, {{ 0x83, 0x03}, "<API key>"}, {{ 0x84, 0x03}, "DISCONNECT_B3_RESP"}, {{ 0x86, 0x03}, "DATA_B3_RESP"}, {{ 0xff, 0x03}, "MANUFACTURER_RESP"}, #endif {{ 0x00, 0x00}, NULL}, }; #define num_valid_msg (sizeof(valid_msg)/sizeof(actcapi_msgdsc)) #define num_valid_imsg 27 /* MANUFACTURER_IND */ /* * Check for a valid incoming CAPI message. * Return: * 0 = Invalid message * 1 = Valid message, no B-Channel-data * 2 = Valid message, B-Channel-data */ int actcapi_chkhdr(act2000_card * card, actcapi_msghdr *hdr) { int i; if (hdr->applicationID != 1) return 0; if (hdr->len < 9) return 0; for (i = 0; i < num_valid_imsg; i++) if ((hdr->cmd.cmd == valid_msg[i].cmd.cmd) && (hdr->cmd.subcmd == valid_msg[i].cmd.subcmd)) { return (i?1:2); } return 0; } #define ACTCAPI_MKHDR(l, c, s) { \ skb = alloc_skb(l + 8, GFP_ATOMIC); \ if (skb) { \ m = (actcapi_msg *)skb_put(skb, l + 8); \ m->hdr.len = l + 8; \ m->hdr.applicationID = 1; \ m->hdr.cmd.cmd = c; \ m->hdr.cmd.subcmd = s; \ m->hdr.msgnum = actcapi_nextsmsg(card); \ } else m = NULL;\ } #define ACTCAPI_CHKSKB if (!skb) { \ printk(KERN_WARNING "actcapi: alloc_skb failed\n"); \ return; \ } #define ACTCAPI_QUEUE_TX { \ actcapi_debug_msg(skb, 1); \ skb_queue_tail(&card->sndq, skb); \ act2000_schedule_tx(card); \ } int actcapi_listen_req(act2000_card *card) { __u16 eazmask = 0; int i; actcapi_msg *m; struct sk_buff *skb; for (i = 0; i < ACT2000_BCH; i++) eazmask |= card->bch[i].eazmask; ACTCAPI_MKHDR(9, 0x05, 0x00); if (!skb) { printk(KERN_WARNING "actcapi: alloc_skb failed\n"); return -ENOMEM; } m->msg.listen_req.controller = 0; m->msg.listen_req.infomask = 0x3f; /* All information */ m->msg.listen_req.eazmask = eazmask; m->msg.listen_req.simask = (eazmask)?0x86:0; /* All SI's */ ACTCAPI_QUEUE_TX; return 0; } int actcapi_connect_req(act2000_card *card, act2000_chan *chan, char *phone, char eaz, int si1, int si2) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR((11 + strlen(phone)), 0x02, 0x00); if (!skb) { printk(KERN_WARNING "actcapi: alloc_skb failed\n"); chan->fsm_state = ACT2000_STATE_NULL; return -ENOMEM; } m->msg.connect_req.controller = 0; m->msg.connect_req.bchan = 0x83; m->msg.connect_req.infomask = 0x3f; m->msg.connect_req.si1 = si1; m->msg.connect_req.si2 = si2; m->msg.connect_req.eaz = eaz?eaz:'0'; m->msg.connect_req.addr.len = strlen(phone) + 1; m->msg.connect_req.addr.tnp = 0x81; memcpy(m->msg.connect_req.addr.num, phone, strlen(phone)); chan->callref = m->hdr.msgnum; ACTCAPI_QUEUE_TX; return 0; } static void <API key>(act2000_card *card, act2000_chan *chan) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(17, 0x82, 0x00); ACTCAPI_CHKSKB; m->msg.connect_b3_req.plci = chan->plci; memset(&m->msg.connect_b3_req.ncpi, 0, sizeof(m->msg.connect_b3_req.ncpi)); m->msg.connect_b3_req.ncpi.len = 13; m->msg.connect_b3_req.ncpi.modulo = 8; ACTCAPI_QUEUE_TX; } /* * Set net type (1TR6) or (EDSS1) */ int <API key>(act2000_card *card) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(5, 0xff, 0x00); if (!skb) { printk(KERN_WARNING "actcapi: alloc_skb failed\n"); return -ENOMEM; } m->msg.<API key>.manuf_msg = 0x11; m->msg.<API key>.controller = 1; m->msg.<API key>.nettype = (card->ptype == ISDN_PTYPE_EURO)?1:0; ACTCAPI_QUEUE_TX; printk(KERN_INFO "act2000 %s: D-channel protocol now %s\n", card->interface.id, (card->ptype == ISDN_PTYPE_EURO)?"euro":"1tr6"); card->interface.features &= ~(<API key> | ISDN_FEATURE_P_EURO | ISDN_FEATURE_P_1TR6); card->interface.features |= ((card->ptype == ISDN_PTYPE_EURO)?ISDN_FEATURE_P_EURO:ISDN_FEATURE_P_1TR6); return 0; } /* * Switch V.42 on or off */ #if 0 int <API key>(act2000_card *card, ulong arg) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(8, 0xff, 0x00); if (!skb) { printk(KERN_WARNING "actcapi: alloc_skb failed\n"); return -ENOMEM; } m->msg.<API key>.manuf_msg = 0x10; m->msg.<API key>.controller = 0; m->msg.<API key>.v42control = (arg?1:0); ACTCAPI_QUEUE_TX; return 0; } #endif /* * Set error-handler */ int <API key>(act2000_card *card) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(4, 0xff, 0x00); if (!skb) { printk(KERN_WARNING "actcapi: alloc_skb failed\n"); return -ENOMEM; } m->msg.<API key>.manuf_msg = 0x03; m->msg.<API key>.controller = 0; ACTCAPI_QUEUE_TX; return 0; } /* * Set MSN-Mapping. */ int <API key>(act2000_card *card) { msn_entry *p = card->msn_list; actcapi_msg *m; struct sk_buff *skb; int len; while (p) { int i; len = strlen(p->msn); for (i = 0; i < 2; i++) { ACTCAPI_MKHDR(6 + len, 0xff, 0x00); if (!skb) { printk(KERN_WARNING "actcapi: alloc_skb failed\n"); return -ENOMEM; } m->msg.<API key>.manuf_msg = 0x13 + i; m->msg.<API key>.controller = 0; m->msg.<API key>.msnmap.eaz = p->eaz; m->msg.<API key>.msnmap.len = len; memcpy(m->msg.<API key>.msnmap.msn, p->msn, len); ACTCAPI_QUEUE_TX; } p = p->next; } return 0; } void <API key>(act2000_card *card, act2000_chan *chan) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(10, 0x40, 0x00); ACTCAPI_CHKSKB; m->msg.<API key>.plci = chan->plci; memset(&m->msg.<API key>.dlpd, 0, sizeof(m->msg.<API key>.dlpd)); m->msg.<API key>.dlpd.len = 6; switch (chan->l2prot) { case ISDN_PROTO_L2_TRANS: m->msg.<API key>.protocol = 0x03; m->msg.<API key>.dlpd.dlen = 4000; break; case ISDN_PROTO_L2_HDLC: m->msg.<API key>.protocol = 0x02; m->msg.<API key>.dlpd.dlen = 4000; break; case ISDN_PROTO_L2_X75I: case ISDN_PROTO_L2_X75UI: case <API key>: m->msg.<API key>.protocol = 0x01; m->msg.<API key>.dlpd.dlen = 4000; m->msg.<API key>.dlpd.laa = 3; m->msg.<API key>.dlpd.lab = 1; m->msg.<API key>.dlpd.win = 7; m->msg.<API key>.dlpd.modulo = 8; break; } ACTCAPI_QUEUE_TX; } static void <API key>(act2000_card *card, act2000_chan *chan) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(17, 0x80, 0x00); ACTCAPI_CHKSKB; m->msg.<API key>.plci = chan->plci; memset(&m->msg.<API key>.ncpd, 0, sizeof(m->msg.<API key>.ncpd)); switch (chan->l3prot) { case ISDN_PROTO_L3_TRANS: m->msg.<API key>.protocol = 0x04; m->msg.<API key>.ncpd.len = 13; m->msg.<API key>.ncpd.modulo = 8; break; } ACTCAPI_QUEUE_TX; } static void <API key>(act2000_card *card, act2000_chan *chan) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(2, 0x81, 0x00); ACTCAPI_CHKSKB; m->msg.listen_b3_req.plci = chan->plci; ACTCAPI_QUEUE_TX; } static void <API key>(act2000_card *card, act2000_chan *chan) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(3, 0x04, 0x00); ACTCAPI_CHKSKB; m->msg.disconnect_req.plci = chan->plci; m->msg.disconnect_req.cause = 0; ACTCAPI_QUEUE_TX; } void <API key>(act2000_card *card, act2000_chan *chan) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(17, 0x84, 0x00); ACTCAPI_CHKSKB; m->msg.disconnect_b3_req.ncci = chan->ncci; memset(&m->msg.disconnect_b3_req.ncpi, 0, sizeof(m->msg.disconnect_b3_req.ncpi)); m->msg.disconnect_b3_req.ncpi.len = 13; m->msg.disconnect_b3_req.ncpi.modulo = 8; chan->fsm_state = <API key>; ACTCAPI_QUEUE_TX; } void <API key>(act2000_card *card, act2000_chan *chan, __u8 cause) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(3, 0x02, 0x03); ACTCAPI_CHKSKB; m->msg.connect_resp.plci = chan->plci; m->msg.connect_resp.rejectcause = cause; if (cause) { chan->fsm_state = ACT2000_STATE_NULL; chan->plci = 0x8000; } else chan->fsm_state = ACT2000_STATE_IWAIT; ACTCAPI_QUEUE_TX; } static void <API key>(act2000_card *card, act2000_chan *chan) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(2, 0x03, 0x03); ACTCAPI_CHKSKB; m->msg.connect_resp.plci = chan->plci; if (chan->fsm_state == ACT2000_STATE_IWAIT) chan->fsm_state = <API key>; ACTCAPI_QUEUE_TX; } static void <API key>(act2000_card *card, act2000_chan *chan, __u8 rejectcause) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR((rejectcause?3:17), 0x82, 0x03); ACTCAPI_CHKSKB; m->msg.connect_b3_resp.ncci = chan->ncci; m->msg.connect_b3_resp.rejectcause = rejectcause; if (!rejectcause) { memset(&m->msg.connect_b3_resp.ncpi, 0, sizeof(m->msg.connect_b3_resp.ncpi)); m->msg.connect_b3_resp.ncpi.len = 13; m->msg.connect_b3_resp.ncpi.modulo = 8; chan->fsm_state = ACT2000_STATE_BWAIT; } ACTCAPI_QUEUE_TX; } static void <API key>(act2000_card *card, act2000_chan *chan) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(2, 0x83, 0x03); ACTCAPI_CHKSKB; m->msg.<API key>.ncci = chan->ncci; chan->fsm_state = <API key>; ACTCAPI_QUEUE_TX; } static void actcapi_info_resp(act2000_card *card, act2000_chan *chan) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(2, 0x07, 0x03); ACTCAPI_CHKSKB; m->msg.info_resp.plci = chan->plci; ACTCAPI_QUEUE_TX; } static void <API key>(act2000_card *card, act2000_chan *chan) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(2, 0x84, 0x03); ACTCAPI_CHKSKB; m->msg.disconnect_b3_resp.ncci = chan->ncci; chan->ncci = 0x8000; chan->queued = 0; ACTCAPI_QUEUE_TX; } static void <API key>(act2000_card *card, act2000_chan *chan) { actcapi_msg *m; struct sk_buff *skb; ACTCAPI_MKHDR(2, 0x04, 0x03); ACTCAPI_CHKSKB; m->msg.disconnect_resp.plci = chan->plci; chan->plci = 0x8000; ACTCAPI_QUEUE_TX; } static int new_plci(act2000_card *card, __u16 plci) { int i; for (i = 0; i < ACT2000_BCH; i++) if (card->bch[i].plci == 0x8000) { card->bch[i].plci = plci; return i; } return -1; } static int find_plci(act2000_card *card, __u16 plci) { int i; for (i = 0; i < ACT2000_BCH; i++) if (card->bch[i].plci == plci) return i; return -1; } static int find_ncci(act2000_card *card, __u16 ncci) { int i; for (i = 0; i < ACT2000_BCH; i++) if (card->bch[i].ncci == ncci) return i; return -1; } static int find_dialing(act2000_card *card, __u16 callref) { int i; for (i = 0; i < ACT2000_BCH; i++) if ((card->bch[i].callref == callref) && (card->bch[i].fsm_state == ACT2000_STATE_OCALL)) return i; return -1; } static int actcapi_data_b3_ind(act2000_card *card, struct sk_buff *skb) { __u16 plci; __u16 ncci; __u16 controller; __u8 blocknr; int chan; actcapi_msg *msg = (actcapi_msg *)skb->data; EVAL_NCCI(msg->msg.data_b3_ind.fakencci, plci, controller, ncci); chan = find_ncci(card, ncci); if (chan < 0) return 0; if (card->bch[chan].fsm_state != <API key>) return 0; if (card->bch[chan].plci != plci) return 0; blocknr = msg->msg.data_b3_ind.blocknr; skb_pull(skb, 19); card->interface.rcvcallb_skb(card->myid, chan, skb); if (!(skb = alloc_skb(11, GFP_ATOMIC))) { printk(KERN_WARNING "actcapi: alloc_skb failed\n"); return 1; } msg = (actcapi_msg *)skb_put(skb, 11); msg->hdr.len = 11; msg->hdr.applicationID = 1; msg->hdr.cmd.cmd = 0x86; msg->hdr.cmd.subcmd = 0x03; msg->hdr.msgnum = actcapi_nextsmsg(card); msg->msg.data_b3_resp.ncci = ncci; msg->msg.data_b3_resp.blocknr = blocknr; ACTCAPI_QUEUE_TX; return 1; } /* * Walk over ackq, unlink DATA_B3_REQ from it, if * ncci and blocknr are matching. * Decrement queued-bytes counter. */ static int handle_ack(act2000_card *card, act2000_chan *chan, __u8 blocknr) { unsigned long flags; struct sk_buff *skb; struct sk_buff *tmp; struct actcapi_msg *m; int ret = 0; spin_lock_irqsave(&card->lock, flags); skb = skb_peek(&card->ackq); <API key>(&card->lock, flags); if (!skb) { printk(KERN_WARNING "act2000: handle_ack nothing found!\n"); return 0; } tmp = skb; while (1) { m = (actcapi_msg *)tmp->data; if ((((m->msg.data_b3_req.fakencci >> 8) & 0xff) == chan->ncci) && (m->msg.data_b3_req.blocknr == blocknr)) { /* found corresponding DATA_B3_REQ */ skb_unlink(tmp, &card->ackq); chan->queued -= m->msg.data_b3_req.datalen; if (m->msg.data_b3_req.flags) ret = m->msg.data_b3_req.datalen; dev_kfree_skb(tmp); if (chan->queued < 0) chan->queued = 0; return ret; } spin_lock_irqsave(&card->lock, flags); tmp = skb_peek((struct sk_buff_head *)tmp); <API key>(&card->lock, flags); if ((tmp == skb) || (tmp == NULL)) { /* reached end of queue */ printk(KERN_WARNING "act2000: handle_ack nothing found!\n"); return 0; } } } void actcapi_dispatch(struct work_struct *work) { struct act2000_card *card = container_of(work, struct act2000_card, rcv_tq); struct sk_buff *skb; actcapi_msg *msg; __u16 ccmd; int chan; int len; act2000_chan *ctmp; isdn_ctrl cmd; char tmp[170]; while ((skb = skb_dequeue(&card->rcvq))) { actcapi_debug_msg(skb, 0); msg = (actcapi_msg *)skb->data; ccmd = ((msg->hdr.cmd.cmd << 8) | msg->hdr.cmd.subcmd); switch (ccmd) { case 0x8602: /* DATA_B3_IND */ if (actcapi_data_b3_ind(card, skb)) return; break; case 0x8601: /* DATA_B3_CONF */ chan = find_ncci(card, msg->msg.data_b3_conf.ncci); if ((chan >= 0) && (card->bch[chan].fsm_state == <API key>)) { if (msg->msg.data_b3_conf.info != 0) printk(KERN_WARNING "act2000: DATA_B3_CONF: %04x\n", msg->msg.data_b3_conf.info); len = handle_ack(card, &card->bch[chan], msg->msg.data_b3_conf.blocknr); if (len) { cmd.driver = card->myid; cmd.command = ISDN_STAT_BSENT; cmd.arg = chan; cmd.parm.length = len; card->interface.statcallb(&cmd); } } break; case 0x0201: /* CONNECT_CONF */ chan = find_dialing(card, msg->hdr.msgnum); if (chan >= 0) { if (msg->msg.connect_conf.info) { card->bch[chan].fsm_state = ACT2000_STATE_NULL; cmd.driver = card->myid; cmd.command = ISDN_STAT_DHUP; cmd.arg = chan; card->interface.statcallb(&cmd); } else { card->bch[chan].fsm_state = ACT2000_STATE_OWAIT; card->bch[chan].plci = msg->msg.connect_conf.plci; } } break; case 0x0202: /* CONNECT_IND */ chan = new_plci(card, msg->msg.connect_ind.plci); if (chan < 0) { ctmp = (act2000_chan *)tmp; ctmp->plci = msg->msg.connect_ind.plci; <API key>(card, ctmp, 0x11); /* All Card-Cannels busy */ } else { card->bch[chan].fsm_state = ACT2000_STATE_ICALL; cmd.driver = card->myid; cmd.command = ISDN_STAT_ICALL; cmd.arg = chan; cmd.parm.setup.si1 = msg->msg.connect_ind.si1; cmd.parm.setup.si2 = msg->msg.connect_ind.si2; if (card->ptype == ISDN_PTYPE_EURO) strcpy(cmd.parm.setup.eazmsn, act2000_find_eaz(card, msg->msg.connect_ind.eaz)); else { cmd.parm.setup.eazmsn[0] = msg->msg.connect_ind.eaz; cmd.parm.setup.eazmsn[1] = 0; } memset(cmd.parm.setup.phone, 0, sizeof(cmd.parm.setup.phone)); memcpy(cmd.parm.setup.phone, msg->msg.connect_ind.addr.num, msg->msg.connect_ind.addr.len - 1); cmd.parm.setup.plan = msg->msg.connect_ind.addr.tnp; cmd.parm.setup.screen = 0; if (card->interface.statcallb(&cmd) == 2) <API key>(card, &card->bch[chan], 0x15); /* Reject Call */ } break; case 0x0302: /* CONNECT_ACTIVE_IND */ chan = find_plci(card, msg->msg.connect_active_ind.plci); if (chan >= 0) switch (card->bch[chan].fsm_state) { case ACT2000_STATE_IWAIT: <API key>(card, &card->bch[chan]); break; case ACT2000_STATE_OWAIT: <API key>(card, &card->bch[chan]); <API key>(card, &card->bch[chan]); break; } break; case 0x8202: /* CONNECT_B3_IND */ chan = find_plci(card, msg->msg.connect_b3_ind.plci); if ((chan >= 0) && (card->bch[chan].fsm_state == <API key>)) { card->bch[chan].ncci = msg->msg.connect_b3_ind.ncci; <API key>(card, &card->bch[chan], 0); } else { ctmp = (act2000_chan *)tmp; ctmp->ncci = msg->msg.connect_b3_ind.ncci; <API key>(card, ctmp, 0x11); /* All Card-Cannels busy */ } break; case 0x8302: /* <API key> */ chan = find_ncci(card, msg->msg.<API key>.ncci); if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_BWAIT)) { <API key>(card, &card->bch[chan]); cmd.driver = card->myid; cmd.command = ISDN_STAT_BCONN; cmd.arg = chan; card->interface.statcallb(&cmd); } break; case 0x8402: /* DISCONNECT_B3_IND */ chan = find_ncci(card, msg->msg.disconnect_b3_ind.ncci); if (chan >= 0) { ctmp = &card->bch[chan]; <API key>(card, ctmp); switch (ctmp->fsm_state) { case <API key>: ctmp->fsm_state = <API key>; cmd.driver = card->myid; cmd.command = ISDN_STAT_BHUP; cmd.arg = chan; card->interface.statcallb(&cmd); break; case <API key>: <API key>(card, ctmp); ctmp->fsm_state = <API key>; cmd.driver = card->myid; cmd.command = ISDN_STAT_BHUP; cmd.arg = chan; card->interface.statcallb(&cmd); break; } } break; case 0x0402: /* DISCONNECT_IND */ chan = find_plci(card, msg->msg.disconnect_ind.plci); if (chan >= 0) { ctmp = &card->bch[chan]; <API key>(card, ctmp); ctmp->fsm_state = ACT2000_STATE_NULL; cmd.driver = card->myid; cmd.command = ISDN_STAT_DHUP; cmd.arg = chan; card->interface.statcallb(&cmd); } else { ctmp = (act2000_chan *)tmp; ctmp->plci = msg->msg.disconnect_ind.plci; <API key>(card, ctmp); } break; case 0x4001: /* <API key> */ chan = find_plci(card, msg->msg.<API key>.plci); if (chan >= 0) switch (card->bch[chan].fsm_state) { case ACT2000_STATE_ICALL: case ACT2000_STATE_OWAIT: ctmp = &card->bch[chan]; if (msg->msg.<API key>.info == 0) <API key>(card, ctmp); else { ctmp->fsm_state = ACT2000_STATE_NULL; cmd.driver = card->myid; cmd.command = ISDN_STAT_DHUP; cmd.arg = chan; card->interface.statcallb(&cmd); } break; } break; case 0x8001: /* <API key> */ chan = find_plci(card, msg->msg.<API key>.plci); if (chan >= 0) switch (card->bch[chan].fsm_state) { case ACT2000_STATE_ICALL: case ACT2000_STATE_OWAIT: ctmp = &card->bch[chan]; if (msg->msg.<API key>.info == 0) <API key>(card, ctmp); else { ctmp->fsm_state = ACT2000_STATE_NULL; cmd.driver = card->myid; cmd.command = ISDN_STAT_DHUP; cmd.arg = chan; card->interface.statcallb(&cmd); } } break; case 0x8101: /* LISTEN_B3_CONF */ chan = find_plci(card, msg->msg.listen_b3_conf.plci); if (chan >= 0) switch (card->bch[chan].fsm_state) { case ACT2000_STATE_ICALL: ctmp = &card->bch[chan]; if (msg->msg.listen_b3_conf.info == 0) <API key>(card, ctmp, 0); else { ctmp->fsm_state = ACT2000_STATE_NULL; cmd.driver = card->myid; cmd.command = ISDN_STAT_DHUP; cmd.arg = chan; card->interface.statcallb(&cmd); } break; case ACT2000_STATE_OWAIT: ctmp = &card->bch[chan]; if (msg->msg.listen_b3_conf.info == 0) { <API key>(card, ctmp); ctmp->fsm_state = <API key>; cmd.driver = card->myid; cmd.command = ISDN_STAT_DCONN; cmd.arg = chan; card->interface.statcallb(&cmd); } else { ctmp->fsm_state = ACT2000_STATE_NULL; cmd.driver = card->myid; cmd.command = ISDN_STAT_DHUP; cmd.arg = chan; card->interface.statcallb(&cmd); } break; } break; case 0x8201: /* CONNECT_B3_CONF */ chan = find_plci(card, msg->msg.connect_b3_conf.plci); if ((chan >= 0) && (card->bch[chan].fsm_state == <API key>)) { ctmp = &card->bch[chan]; if (msg->msg.connect_b3_conf.info) { ctmp->fsm_state = ACT2000_STATE_NULL; cmd.driver = card->myid; cmd.command = ISDN_STAT_DHUP; cmd.arg = chan; card->interface.statcallb(&cmd); } else { ctmp->ncci = msg->msg.connect_b3_conf.ncci; ctmp->fsm_state = ACT2000_STATE_BWAIT; } } break; case 0x8401: /* DISCONNECT_B3_CONF */ chan = find_ncci(card, msg->msg.disconnect_b3_conf.ncci); if ((chan >= 0) && (card->bch[chan].fsm_state == <API key>)) card->bch[chan].fsm_state = <API key>; break; case 0x0702: /* INFO_IND */ chan = find_plci(card, msg->msg.info_ind.plci); if (chan >= 0) /* TODO: Eval Charging info / cause */ actcapi_info_resp(card, &card->bch[chan]); break; case 0x0401: /* LISTEN_CONF */ case 0x0501: /* LISTEN_CONF */ case 0xff01: /* MANUFACTURER_CONF */ break; case 0xff02: /* MANUFACTURER_IND */ if (msg->msg.manuf_msg == 3) { memset(tmp, 0, sizeof(tmp)); strncpy(tmp, &msg->msg.<API key>.errstring, msg->hdr.len - 16); if (msg->msg.<API key>.errcode) printk(KERN_WARNING "act2000: %s\n", tmp); else { printk(KERN_DEBUG "act2000: %s\n", tmp); if ((!strncmp(tmp, "INFO: Trace buffer con", 22)) || (!strncmp(tmp, "INFO: Compile Date/Tim", 22))) { card->flags |= <API key>; cmd.command = ISDN_STAT_RUN; cmd.driver = card->myid; cmd.arg = 0; <API key>(card); <API key>(card); actcapi_listen_req(card); card->interface.statcallb(&cmd); } } } break; default: printk(KERN_WARNING "act2000: UNHANDLED Message %04x\n", ccmd); break; } dev_kfree_skb(skb); } } #ifdef DEBUG_MSG static void actcapi_debug_caddr(actcapi_addr *addr) { char tmp[30]; printk(KERN_DEBUG " Alen = %d\n", addr->len); if (addr->len > 0) printk(KERN_DEBUG " Atnp = 0x%02x\n", addr->tnp); if (addr->len > 1) { memset(tmp, 0, 30); memcpy(tmp, addr->num, addr->len - 1); printk(KERN_DEBUG " Anum = '%s'\n", tmp); } } static void actcapi_debug_ncpi(actcapi_ncpi *ncpi) { printk(KERN_DEBUG " ncpi.len = %d\n", ncpi->len); if (ncpi->len >= 2) printk(KERN_DEBUG " ncpi.lic = 0x%04x\n", ncpi->lic); if (ncpi->len >= 4) printk(KERN_DEBUG " ncpi.hic = 0x%04x\n", ncpi->hic); if (ncpi->len >= 6) printk(KERN_DEBUG " ncpi.ltc = 0x%04x\n", ncpi->ltc); if (ncpi->len >= 8) printk(KERN_DEBUG " ncpi.htc = 0x%04x\n", ncpi->htc); if (ncpi->len >= 10) printk(KERN_DEBUG " ncpi.loc = 0x%04x\n", ncpi->loc); if (ncpi->len >= 12) printk(KERN_DEBUG " ncpi.hoc = 0x%04x\n", ncpi->hoc); if (ncpi->len >= 13) printk(KERN_DEBUG " ncpi.mod = %d\n", ncpi->modulo); } static void actcapi_debug_dlpd(actcapi_dlpd *dlpd) { printk(KERN_DEBUG " dlpd.len = %d\n", dlpd->len); if (dlpd->len >= 2) printk(KERN_DEBUG " dlpd.dlen = 0x%04x\n", dlpd->dlen); if (dlpd->len >= 3) printk(KERN_DEBUG " dlpd.laa = 0x%02x\n", dlpd->laa); if (dlpd->len >= 4) printk(KERN_DEBUG " dlpd.lab = 0x%02x\n", dlpd->lab); if (dlpd->len >= 5) printk(KERN_DEBUG " dlpd.modulo = %d\n", dlpd->modulo); if (dlpd->len >= 6) printk(KERN_DEBUG " dlpd.win = %d\n", dlpd->win); } #ifdef DEBUG_DUMP_SKB static void dump_skb(struct sk_buff *skb) { char tmp[80]; char *p = skb->data; char *t = tmp; int i; for (i = 0; i < skb->len; i++) { t += sprintf(t, "%02x ", *p++ & 0xff); if ((i & 0x0f) == 8) { printk(KERN_DEBUG "dump: %s\n", tmp); t = tmp; } } if (i & 0x07) printk(KERN_DEBUG "dump: %s\n", tmp); } #endif void actcapi_debug_msg(struct sk_buff *skb, int direction) { actcapi_msg *msg = (actcapi_msg *)skb->data; char *descr; int i; char tmp[170]; #ifndef DEBUG_DATA_MSG if (msg->hdr.cmd.cmd == 0x86) return; #endif descr = "INVALID"; #ifdef DEBUG_DUMP_SKB dump_skb(skb); #endif for (i = 0; i < num_valid_msg; i++) if ((msg->hdr.cmd.cmd == valid_msg[i].cmd.cmd) && (msg->hdr.cmd.subcmd == valid_msg[i].cmd.subcmd)) { descr = valid_msg[i].description; break; } printk(KERN_DEBUG "%s %s msg\n", direction?"Outgoing":"Incoming", descr); printk(KERN_DEBUG " ApplID = %d\n", msg->hdr.applicationID); printk(KERN_DEBUG " Len = %d\n", msg->hdr.len); printk(KERN_DEBUG " MsgNum = 0x%04x\n", msg->hdr.msgnum); printk(KERN_DEBUG " Cmd = 0x%02x\n", msg->hdr.cmd.cmd); printk(KERN_DEBUG " SubCmd = 0x%02x\n", msg->hdr.cmd.subcmd); switch (i) { case 0: /* DATA B3 IND */ printk(KERN_DEBUG " BLOCK = 0x%02x\n", msg->msg.data_b3_ind.blocknr); break; case 2: /* CONNECT CONF */ printk(KERN_DEBUG " PLCI = 0x%04x\n", msg->msg.connect_conf.plci); printk(KERN_DEBUG " Info = 0x%04x\n", msg->msg.connect_conf.info); break; case 3: /* CONNECT IND */ printk(KERN_DEBUG " PLCI = 0x%04x\n", msg->msg.connect_ind.plci); printk(KERN_DEBUG " Contr = %d\n", msg->msg.connect_ind.controller); printk(KERN_DEBUG " SI1 = %d\n", msg->msg.connect_ind.si1); printk(KERN_DEBUG " SI2 = %d\n", msg->msg.connect_ind.si2); printk(KERN_DEBUG " EAZ = '%c'\n", msg->msg.connect_ind.eaz); actcapi_debug_caddr(&msg->msg.connect_ind.addr); break; case 5: /* CONNECT ACTIVE IND */ printk(KERN_DEBUG " PLCI = 0x%04x\n", msg->msg.connect_active_ind.plci); actcapi_debug_caddr(&msg->msg.connect_active_ind.addr); break; case 8: /* LISTEN CONF */ printk(KERN_DEBUG " Contr = %d\n", msg->msg.listen_conf.controller); printk(KERN_DEBUG " Info = 0x%04x\n", msg->msg.listen_conf.info); break; case 11: /* INFO IND */ printk(KERN_DEBUG " PLCI = 0x%04x\n", msg->msg.info_ind.plci); printk(KERN_DEBUG " Imsk = 0x%04x\n", msg->msg.info_ind.nr.mask); if (msg->hdr.len > 12) { int l = msg->hdr.len - 12; int j; char *p = tmp; for (j = 0; j < l ; j++) p += sprintf(p, "%02x ", msg->msg.info_ind.el.display[j]); printk(KERN_DEBUG " D = '%s'\n", tmp); } break; case 14: /* SELECT B2 PROTOCOL CONF */ printk(KERN_DEBUG " PLCI = 0x%04x\n", msg->msg.<API key>.plci); printk(KERN_DEBUG " Info = 0x%04x\n", msg->msg.<API key>.info); break; case 15: /* SELECT B3 PROTOCOL CONF */ printk(KERN_DEBUG " PLCI = 0x%04x\n", msg->msg.<API key>.plci); printk(KERN_DEBUG " Info = 0x%04x\n", msg->msg.<API key>.info); break; case 16: /* LISTEN B3 CONF */ printk(KERN_DEBUG " PLCI = 0x%04x\n", msg->msg.listen_b3_conf.plci); printk(KERN_DEBUG " Info = 0x%04x\n", msg->msg.listen_b3_conf.info); break; case 18: /* CONNECT B3 IND */ printk(KERN_DEBUG " NCCI = 0x%04x\n", msg->msg.connect_b3_ind.ncci); printk(KERN_DEBUG " PLCI = 0x%04x\n", msg->msg.connect_b3_ind.plci); actcapi_debug_ncpi(&msg->msg.connect_b3_ind.ncpi); break; case 19: /* CONNECT B3 ACTIVE IND */ printk(KERN_DEBUG " NCCI = 0x%04x\n", msg->msg.<API key>.ncci); actcapi_debug_ncpi(&msg->msg.<API key>.ncpi); break; case 26: /* MANUFACTURER IND */ printk(KERN_DEBUG " Mmsg = 0x%02x\n", msg->msg.<API key>.manuf_msg); switch (msg->msg.<API key>.manuf_msg) { case 3: printk(KERN_DEBUG " Contr = %d\n", msg->msg.<API key>.controller); printk(KERN_DEBUG " Code = 0x%08x\n", msg->msg.<API key>.errcode); memset(tmp, 0, sizeof(tmp)); strncpy(tmp, &msg->msg.<API key>.errstring, msg->hdr.len - 16); printk(KERN_DEBUG " Emsg = '%s'\n", tmp); break; } break; case 30: /* LISTEN REQ */ printk(KERN_DEBUG " Imsk = 0x%08x\n", msg->msg.listen_req.infomask); printk(KERN_DEBUG " Emsk = 0x%04x\n", msg->msg.listen_req.eazmask); printk(KERN_DEBUG " Smsk = 0x%04x\n", msg->msg.listen_req.simask); break; case 35: /* <API key> */ printk(KERN_DEBUG " PLCI = 0x%04x\n", msg->msg.<API key>.plci); printk(KERN_DEBUG " prot = 0x%02x\n", msg->msg.<API key>.protocol); if (msg->hdr.len >= 11) printk(KERN_DEBUG "No dlpd\n"); else actcapi_debug_dlpd(&msg->msg.<API key>.dlpd); break; case 44: /* CONNECT RESP */ printk(KERN_DEBUG " PLCI = 0x%04x\n", msg->msg.connect_resp.plci); printk(KERN_DEBUG " CAUSE = 0x%02x\n", msg->msg.connect_resp.rejectcause); break; case 45: /* CONNECT ACTIVE RESP */ printk(KERN_DEBUG " PLCI = 0x%04x\n", msg->msg.connect_active_resp.plci); break; } } #endif
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> // System.Object struct Object_t; // System.Runtime.Remoting.Messaging.Header[] struct HeaderU5BU5D_t1378; // System.IAsyncResult struct IAsyncResult_t47; // System.AsyncCallback struct AsyncCallback_t48; #include "<API key>.h" // System.Runtime.Remoting.Messaging.HeaderHandler struct HeaderHandler_t1377 : public <API key> { };
# Opus/UrbanSim urban simulation software. from opus_core.variables.variable import Variable from variable_functions import my_attribute_label from urbansim.length_constants import UrbanSimLength, <API key> from numpy import array class is_near_arterial(Variable): """Boolean indicating if this gridcell is near an arterial, as specified by the arterial threshold (a constant). Distance is assumed to be measured from the "border" of the gridcell.""" <API key> = "<API key>" def dependencies(self): return [my_attribute_label(self.<API key>)] def compute(self, dataset_pool): return <API key>(self.get_dataset().get_attribute(self.<API key>), dataset_pool.get_dataset('urbansim_constant')) def post_check(self, values, dataset_pool): self.do_check("x == False or x == True", values) def <API key>(distance, urbansim_constant): length = UrbanSimLength(distance, urbansim_constant["gridcell_width"].units) return length.less_than(urbansim_constant["<API key>"]) from opus_core.tests import opus_unittest from opus_core.tests.utils.variable_tester import VariableTester from numpy import array class Tests(opus_unittest.OpusTestCase): def test_my_inputs( self ): # Assumes distance is measured from the gridcell border to the arterial. tester = VariableTester( __file__, package_order=['urbansim'], test_data={ 'gridcell':{ 'grid_id': array([1,2,3,4,5,6]), '<API key>': array([0.0, 50.0, 99.0, 100.0, 101.0, 200.0]), }, 'urbansim_constant':{ 'cell_size': array([150]), '<API key>': array([100]), 'units': array(['meters']), } } ) should_be = array( [True, True, True, False, False, False] ) tester.<API key>(self, should_be) if __name__=='__main__': opus_unittest.main()
<?php interface KObjectMixable { /** * Mixin an object * * When using mixin(), the calling object inherits the methods of the mixed in objects, in a LIFO order. * * @param mixed $identifier An KObjectIdentifier, identifier string or object implementing <API key> * @param array $config An optional associative array of configuration options * @return <API key> * @throws <API key> If the identifier is not valid * @throws <API key> If the mixin does not implement the <API key> */ public function mixin($identifier, $config = array()); /** * Checks if the object or one of it's mixin's inherits from a class. * * @param string|object $class The class to check * @return bool Returns TRUE if the object inherits from the class */ public function inherits($class); /** * Get a list of all the available methods * * This function returns an array of all the methods, both native and mixed in * * @return array An array */ public function getMethods(); }
#include <linux/earlysuspend.h> #include <linux/init.h> #include <linux/cpufreq.h> #include <linux/workqueue.h> #include <linux/completion.h> #include <linux/cpu.h> #include <linux/cpumask.h> #include <linux/sched.h> #include <linux/suspend.h> #include <mach/socinfo.h> #include "acpuclock.h" #ifdef CONFIG_SMP struct cpufreq_work_struct { struct work_struct work; struct cpufreq_policy *policy; struct completion complete; int frequency; int status; }; static DEFINE_PER_CPU(struct cpufreq_work_struct, cpufreq_work); static struct workqueue_struct *msm_cpufreq_wq; #endif struct cpufreq_suspend_t { struct mutex suspend_mutex; int device_suspended; }; static DEFINE_PER_CPU(struct cpufreq_suspend_t, cpufreq_suspend); static int override_cpu; static int set_cpu_freq(struct cpufreq_policy *policy, unsigned int new_freq) { int ret = 0; struct cpufreq_freqs freqs; freqs.old = policy->cur; if (override_cpu) { if (policy->cur == policy->max) return 0; else freqs.new = policy->max; } else freqs.new = new_freq; freqs.cpu = policy->cpu; <API key>(&freqs, CPUFREQ_PRECHANGE); ret = acpuclk_set_rate(policy->cpu, new_freq, SETRATE_CPUFREQ); if (!ret) <API key>(&freqs, CPUFREQ_POSTCHANGE); return ret; } #ifdef CONFIG_SMP static void set_cpu_work(struct work_struct *work) { struct cpufreq_work_struct *cpu_work = container_of(work, struct cpufreq_work_struct, work); cpu_work->status = set_cpu_freq(cpu_work->policy, cpu_work->frequency); complete(&cpu_work->complete); } #endif static int msm_cpufreq_target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation) { int ret = -EFAULT; int index; struct <API key> *table; #ifdef CONFIG_SMP struct cpufreq_work_struct *cpu_work = NULL; cpumask_var_t mask; if (!cpu_active(policy->cpu)) { pr_info("cpufreq: cpu %d is not active.\n", policy->cpu); return -ENODEV; } if (!alloc_cpumask_var(&mask, GFP_KERNEL)) return -ENOMEM; #endif mutex_lock(&per_cpu(cpufreq_suspend, policy->cpu).suspend_mutex); if (per_cpu(cpufreq_suspend, policy->cpu).device_suspended) { pr_debug("cpufreq: cpu%d scheduling frequency change " "in suspend.\n", policy->cpu); ret = -EFAULT; goto done; } table = <API key>(policy->cpu); if (<API key>(policy, table, target_freq, relation, &index)) { pr_err("cpufreq: invalid target_freq: %d\n", target_freq); ret = -EINVAL; goto done; } #ifdef <API key> pr_debug("CPU[%d] target %d relation %d (%d-%d) selected %d\n", policy->cpu, target_freq, relation, policy->min, policy->max, table[index].frequency); #endif #ifdef CONFIG_SMP cpu_work = &per_cpu(cpufreq_work, policy->cpu); cpu_work->policy = policy; cpu_work->frequency = table[index].frequency; cpu_work->status = -ENODEV; cpumask_clear(mask); cpumask_set_cpu(policy->cpu, mask); if (cpumask_equal(mask, &current->cpus_allowed)) { ret = set_cpu_freq(cpu_work->policy, cpu_work->frequency); goto done; } else { cancel_work_sync(&cpu_work->work); INIT_COMPLETION(cpu_work->complete); queue_work_on(policy->cpu, msm_cpufreq_wq, &cpu_work->work); wait_for_completion(&cpu_work->complete); } ret = cpu_work->status; #else ret = set_cpu_freq(policy, table[index].frequency); #endif done: #ifdef CONFIG_SMP free_cpumask_var(mask); #endif mutex_unlock(&per_cpu(cpufreq_suspend, policy->cpu).suspend_mutex); return ret; } static int msm_cpufreq_verify(struct cpufreq_policy *policy) { <API key>(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); return 0; } static int __cpuinit msm_cpufreq_init(struct cpufreq_policy *policy) { int cur_freq; int index; struct <API key> *table; #ifdef CONFIG_SMP struct cpufreq_work_struct *cpu_work = NULL; #endif if (cpu_is_apq8064()) return -ENODEV; table = <API key>(policy->cpu); if (<API key>(policy, table)) { #ifdef <API key> policy->cpuinfo.min_freq = <API key>; policy->cpuinfo.max_freq = <API key>; #endif } #ifdef <API key> policy->min = <API key>; policy->max = <API key>; #endif cur_freq = acpuclk_get_rate(policy->cpu); if (<API key>(policy, table, cur_freq, CPUFREQ_RELATION_H, &index) && <API key>(policy, table, cur_freq, CPUFREQ_RELATION_L, &index)) { pr_info("cpufreq: cpu%d at invalid freq: %d\n", policy->cpu, cur_freq); return -EINVAL; } if (cur_freq != table[index].frequency) { int ret = 0; ret = acpuclk_set_rate(policy->cpu, table[index].frequency, SETRATE_CPUFREQ); if (ret) return ret; pr_info("cpufreq: cpu%d init at %d switching to %d\n", policy->cpu, cur_freq, table[index].frequency); cur_freq = table[index].frequency; } policy->cur = cur_freq; policy->cpuinfo.transition_latency = <API key>() * NSEC_PER_USEC; #ifdef CONFIG_SMP cpu_work = &per_cpu(cpufreq_work, policy->cpu); INIT_WORK(&cpu_work->work, set_cpu_work); init_completion(&cpu_work->complete); #endif return 0; } static int msm_cpufreq_suspend(struct cpufreq_policy *policy) { int cpu; <API key>(cpu) { per_cpu(cpufreq_suspend, cpu).device_suspended = 1; } return 0; } static int msm_cpufreq_resume(struct cpufreq_policy *policy) { int cpu; <API key>(cpu) { per_cpu(cpufreq_suspend, cpu).device_suspended = 0; } return 0; } static ssize_t store_mfreq(struct sysdev_class *class, struct <API key> *attr, const char *buf, size_t count) { u64 val; if (strict_strtoull(buf, 0, &val) < 0) { pr_err("Invalid parameter to mfreq\n"); return 0; } if (val) override_cpu = 1; else override_cpu = 0; return count; } static SYSDEV_CLASS_ATTR(mfreq, 0200, NULL, store_mfreq); static struct freq_attr *msm_freq_attr[] = { &<API key>, NULL, }; static struct cpufreq_driver msm_cpufreq_driver = { /* lps calculations are handled here. */ .flags = CPUFREQ_STICKY | CPUFREQ_CONST_LOOPS, .init = msm_cpufreq_init, .verify = msm_cpufreq_verify, .target = msm_cpufreq_target, .suspend = msm_cpufreq_suspend, .resume = msm_cpufreq_resume, .name = "msm", .attr = msm_freq_attr, }; static int __init <API key>(void) { int cpu; int err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, &attr_mfreq.attr); if (err) pr_err("Failed to create sysfs mfreq\n"); <API key>(cpu) { mutex_init(&(per_cpu(cpufreq_suspend, cpu).suspend_mutex)); per_cpu(cpufreq_suspend, cpu).device_suspended = 0; } #ifdef CONFIG_SMP msm_cpufreq_wq = create_workqueue("msm-cpufreq"); #endif return <API key>(&msm_cpufreq_driver); } late_initcall(<API key>);
#include <stdio.h> #include <stdlib.h> #include <sbml/util/util.h> #include <sbml/SBMLTypes.h> #include "<API key>.h" static int noClusters = 0; FILE * fout; /** * @return the given formula AST as a directed graph. The caller * owns the returned string and is responsible for freeing it. */ char * SBML_formulaToDot (const ASTNode_t *tree) { StringBuffer_t *sb = StringBuffer_create(128); char *name; char *s; if (<API key>(tree) || ASTNode_isOperator(tree)) { <API key>(NULL, tree, sb); } else { name = <API key>(tree); StringBuffer_append(sb, name); } StringBuffer_append(sb, "}\n"); s = <API key>(sb); free(sb); return s; } /** * @return true (non-zero) if the given ASTNode is to formatted as a * function. */ int <API key> (const ASTNode_t *node) { return ASTNode_isFunction (node) || ASTNode_isLambda (node) || ASTNode_isLogical (node) || <API key>(node); } /** * Formats the given ASTNode as a directed graph token and returns the result as * a string. */ char * <API key> (const ASTNode_t *node) { StringBuffer_t *p = StringBuffer_create(128); char *s = NULL; if (ASTNode_isOperator(node)) { s = <API key>(node); } else if (ASTNode_isFunction(node)) { s = <API key>(node); } else if (ASTNode_isInteger(node)) { <API key>(p, ASTNode_getInteger(node)); s = <API key>(p); } else if (ASTNode_isRational(node)) { s = <API key>(node); } else if (ASTNode_isReal(node)) { s = <API key>(node); } else if ( !ASTNode_isUnknown(node) ) { if (ASTNode_getName(node) == NULL) { StringBuffer_append(p, "unknown"); } else { StringBuffer_append(p, ASTNode_getName(node)); } s = <API key>(p); } free(p); return s; } /** * Since graphviz will interpret identical names as referring to * the same node presentation-wise it is better if each function node * has a unique name. * * Returns the name with the name of the first child * prepended * * THIS COULD BE DONE BETTER */ char * <API key> (const ASTNode_t *node) { StringBuffer_t *p = StringBuffer_create(128); char *s = NULL; if (ASTNode_isOperator(node)) { s = <API key>(node); } else if (ASTNode_isFunction(node)) { s = <API key>(node); } else if (ASTNode_isInteger(node)) { <API key>(p, ASTNode_getInteger(node)); s = <API key>(p); } else if (ASTNode_isRational(node)) { s = <API key>(node); } else if (ASTNode_isReal(node)) { s = <API key>(node); } else if ( !ASTNode_isUnknown(node) ) { StringBuffer_append(p, ASTNode_getName(node)); s = <API key>(p); } free(p); return s; } /** * Formats the given ASTNode as a directed graph function name and returns the * result as a string. */ char * <API key> (const ASTNode_t *node) { char *s; StringBuffer_t *p = StringBuffer_create(128); ASTNodeType_t type = ASTNode_getType(node); switch (type) { case AST_FUNCTION_ARCCOS: s = "acos"; break; case AST_FUNCTION_ARCSIN: s = "asin"; break; case AST_FUNCTION_ARCTAN: s = "atan"; break; case <API key>: s = "ceil"; break; case AST_FUNCTION_LN: s = "log"; break; case AST_FUNCTION_POWER: s = "pow"; break; default: if (ASTNode_getName(node) == NULL) { StringBuffer_append(p, "unknown"); } else { StringBuffer_append(p, ASTNode_getName(node)); } s = <API key>(p); break; } free(p); return s; } /** * Since graphviz will interpret identical names as referring to * the same node presentation-wise it is better if each function node * has a unique name. * * Returns the name of the function with the name of the first child * prepended * * THIS COULD BE DONE BETTER */ char * <API key> (const ASTNode_t *node) { char *s; StringBuffer_t *p = StringBuffer_create(128); ASTNodeType_t type = ASTNode_getType(node); if (<API key>(node) != 0) { const char* name = ASTNode_getName(ASTNode_getChild(node,0)); if (name != NULL) StringBuffer_append(p, name); } else { StringBuffer_append(p, "unknown"); } switch (type) { case AST_FUNCTION_ARCCOS: StringBuffer_append(p, "acos"); break; case AST_FUNCTION_ARCSIN: StringBuffer_append(p, "asin"); break; case AST_FUNCTION_ARCTAN: StringBuffer_append(p, "atan"); break; case <API key>: StringBuffer_append(p, "ceil"); break; case AST_FUNCTION_LN: StringBuffer_append(p, "log"); break; case AST_FUNCTION_POWER: StringBuffer_append(p, "pow"); break; default: if (ASTNode_getName(node) != NULL) { StringBuffer_append(p, ASTNode_getName(node)); } break; } s = <API key>(p); free(p); return s; } /** * Formats the given ASTNode as a directed graph operator and returns the result * as a string. */ char * <API key> (const ASTNode_t *node) { char *s; ASTNodeType_t type = ASTNode_getType(node); StringBuffer_t *p = StringBuffer_create(128); switch (type) { case AST_TIMES: s = "times"; break; case AST_DIVIDE: s = "divide"; break; case AST_PLUS: s = "plus"; break; case AST_MINUS: s = "minus"; break; case AST_POWER: s = "power"; break; default: <API key>(p, <API key>(node)); s = <API key>(p); break; } free(p); return s; } /** * Since graphviz will interpret identical names as referring to * the same node presentation-wise it is better if each function node * has a unique name. * * Returns the name of the operator with the name of the first child * prepended * * THIS COULD BE DONE BETTER */ char * <API key> (const ASTNode_t *node) { char *s; char number[10]; StringBuffer_t *p = StringBuffer_create(128); ASTNodeType_t type = ASTNode_getType(node); if (<API key>(ASTNode_getChild(node,0)) || ASTNode_isOperator(ASTNode_getChild(node,0))) { StringBuffer_append(p, "func"); } else { if (ASTNode_isInteger(ASTNode_getChild(node, 0))) { sprintf(number, "%d", (int)ASTNode_getInteger(ASTNode_getChild(node, 0))); StringBuffer_append(p, number); } else if (ASTNode_isReal(ASTNode_getChild(node, 0))) { sprintf(number, "%ld", <API key>(ASTNode_getChild(node, 0))); StringBuffer_append(p, number); } else { StringBuffer_append(p, ASTNode_getName(ASTNode_getChild(node,0))); } } switch (type) { case AST_TIMES: StringBuffer_append(p, "times"); break; case AST_DIVIDE: StringBuffer_append(p, "divide"); break; case AST_PLUS: StringBuffer_append(p, "plus"); break; case AST_MINUS: StringBuffer_append(p, "minus"); break; case AST_POWER: StringBuffer_append(p, "power"); break; default: <API key>(p, <API key>(node)); break; } s = <API key>(p); free(p); return s; } /** * Formats the given ASTNode as a rational number and returns the result as * a string. This amounts to: * * "(numerator/denominator)" */ char * <API key> (const ASTNode_t *node) { char *s; StringBuffer_t *p = StringBuffer_create(128); <API key>( p, '('); <API key> ( p, <API key>(node) ); <API key>( p, '/'); <API key> ( p, <API key>(node) ); <API key>( p, ')'); s = <API key>(p); free(p); return s; } /** * Formats the given ASTNode as a real number and returns the result as * a string. */ char * <API key> (const ASTNode_t *node) { StringBuffer_t *p = StringBuffer_create(128); double value = ASTNode_getReal(node); int sign; char *s; if (util_isNaN(value)) { s = "NaN"; } else if ((sign = util_isInf(value)) != 0) { if (sign == -1) { s = "-INF"; } else { s = "INF"; } } else if (util_isNegZero(value)) { s = "-0"; } else { <API key>(p, value); s = <API key>(p); } free(p); return s; } /** * Visits the given ASTNode node. This function is really just a * dispatcher to either <API key>() or * <API key>(). */ void <API key> (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb ) { if (ASTNode_isLog10(node)) { <API key>(parent, node, sb); } else if (ASTNode_isSqrt(node)) { <API key>(parent, node, sb); } else if (<API key>(node)) { <API key>(parent, node, sb); } else if (ASTNode_isUMinus(node)) { <API key>(parent, node, sb); } else { <API key>(parent, node, sb); } } /** * Visits the given ASTNode as a function. For this node only the * traversal is preorder. * Writes the function as a directed graph and appends the result * to the StringBuffer. */ void <API key> (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb ) { unsigned int numChildren = <API key>(node); unsigned int n; char *name; char *uniqueName; uniqueName = <API key>(node); name = <API key>(node); StringBuffer_append(sb, uniqueName); StringBuffer_append(sb, " [shape=box, label="); StringBuffer_append(sb, name); StringBuffer_append(sb, "];\n"); if (parent != NULL) { name = <API key>(node); uniqueName = <API key>(parent); if(strcmp(name, uniqueName)) { StringBuffer_append(sb, uniqueName); StringBuffer_append(sb, " -> "); StringBuffer_append(sb, name); StringBuffer_append(sb, ";\n"); } } if (numChildren > 0) { <API key>( node, ASTNode_getChild(node, 0), sb ); } for (n = 1; n < numChildren; n++) { <API key>( node, ASTNode_getChild(node, n), sb ); } } /** * Visits the given ASTNode as the function "log(10, x)" and in doing so, * formats it as "log10(x)" (where x is any subexpression). * Writes the function as a directed graph and appends the result * to the StringBuffer. * * A seperate function may not be strictly speaking necessary for graphs */ void <API key> (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb ) { char *uniqueName = <API key>(node); char *name = <API key>(node); StringBuffer_append(sb, uniqueName); StringBuffer_append(sb, " [shape=box, label="); StringBuffer_append(sb, name); StringBuffer_append(sb, "];\n"); <API key>(node, ASTNode_getChild(node, 1), sb); } /** * Visits the given ASTNode as the function "root(2, x)" and in doing so, * formats it as "sqrt(x)" (where x is any subexpression). * Writes the function as a directed graph and appends the result * to the StringBuffer. * * A seperate function may not be strictly speaking necessary for graphs */ void <API key> (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb ) { char *uniqueName = <API key>(node); char *name = <API key>(node); StringBuffer_append(sb, uniqueName); StringBuffer_append(sb, " [shape=box, label="); StringBuffer_append(sb, name); StringBuffer_append(sb, "];\n"); <API key>(node, ASTNode_getChild(node, 1), sb); } /** * Visits the given ASTNode as a unary minus. For this node only the * traversal is preorder. * Writes the function as a directed graph and appends the result * to the StringBuffer. */ void <API key> (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb ) { char *uniqueName = <API key>(node); char *name = <API key>(node); StringBuffer_append(sb, uniqueName); StringBuffer_append(sb, " [shape=box, label="); StringBuffer_append(sb, name); StringBuffer_append(sb, "];\n"); if (parent != NULL) { uniqueName = <API key>(parent); name = <API key>(node); if(strcmp(name, uniqueName)) { StringBuffer_append(sb, uniqueName); StringBuffer_append(sb, " -> "); StringBuffer_append(sb, name); StringBuffer_append(sb, ";\n"); } } <API key> ( node, <API key>(node), sb ); } /** * Visits the given ASTNode and continues the inorder traversal. * Writes the function as a directed graph and appends the result * to the StringBuffer. */ void <API key> (const ASTNode_t *parent, const ASTNode_t *node, StringBuffer_t *sb ) { unsigned int numChildren = <API key>(node); char *name; char *uniqueName; if (numChildren > 0) { uniqueName = <API key>(node); name = <API key>(node); StringBuffer_append(sb, uniqueName); StringBuffer_append(sb, " [shape=box, label="); StringBuffer_append(sb, name); StringBuffer_append(sb, "];\n"); <API key>( node, <API key>(node), sb ); } if (parent != NULL) { name = <API key>(node); uniqueName = <API key>(parent); if(strcmp(name, uniqueName)) { StringBuffer_append(sb, uniqueName); StringBuffer_append(sb, " -> "); StringBuffer_append(sb, name); StringBuffer_append(sb, ";\n"); } } if (numChildren > 1) { <API key>( node, <API key>(node), sb ); } } void <API key> (unsigned int n, <API key> *fd) { const ASTNode_t *math; char *formula; if ( <API key>(fd) ) { math = <API key>(fd); /* Print function body. */ if (<API key>(math) == 0) { printf("(no body defined)"); } else { math = ASTNode_getChild(math, <API key>(math) - 1); formula = SBML_formulaToDot(math); fprintf(fout, "subgraph cluster%u {\n", noClusters); fprintf(fout, "label=\"FunctionDefinition: %s\";\n%s\n", <API key>(fd), formula); free(formula); noClusters++; } } } void printRuleMath (unsigned int n, Rule_t *r) { char *formula; if ( Rule_isSetMath(r) ) { formula = SBML_formulaToDot( Rule_getMath(r)); fprintf(fout, "subgraph cluster%u {\n", noClusters); fprintf(fout, "label=\"Rule: %u\";\n%s\n", n, formula); free(formula); noClusters++; } } void printReactionMath (unsigned int n, Reaction_t *r) { char *formula; KineticLaw_t *kl; if (<API key>(r)) { kl = <API key>(r); if ( <API key>(kl) ) { formula = SBML_formulaToDot( KineticLaw_getMath(kl) ); fprintf(fout, "subgraph cluster%u {\n", noClusters); fprintf(fout, "label=\"Reaction: %s\";\n%s\n", Reaction_getId(r), formula); free(formula); noClusters++; } } } void <API key> (unsigned int n, EventAssignment_t *ea) { const char *variable; char *formula; if ( <API key>(ea) ) { variable = <API key>(ea); formula = SBML_formulaToDot( <API key>(ea) ); fprintf(fout, "subgraph cluster%u {\n", noClusters); fprintf(fout, "label=\"EventAssignment: %u\";\n", n); fprintf(fout, "%s [shape=box];\n%s -> %s\n", variable, variable, formula); noClusters++; free(formula); } } void printEventMath (unsigned int n, Event_t *e) { char *formula; unsigned int i; if ( Event_isSetDelay(e) ) { formula = SBML_formulaToDot( Delay_getMath(Event_getDelay(e)) ); fprintf(fout, "subgraph cluster%u {\n", noClusters); fprintf(fout, "label=\"Event %s delay:\";\n%s\n", Event_getId(e), formula); free(formula); noClusters++; } if ( Event_isSetTrigger(e) ) { formula = SBML_formulaToDot( Trigger_getMath(Event_getTrigger(e)) ); fprintf(fout, "subgraph cluster%u {\n", noClusters); fprintf(fout, "label=\"Event %s trigger:\";\n%s\n", Event_getId(e), formula); noClusters++; free(formula); } for (i = 0; i < <API key>(e); ++i) { <API key>(i + 1, <API key>(e, i)); } } void printMath (Model_t *m) { unsigned int n; /* a digraph must have a name thus * need to check that Model_getId does not return NULL * and provide a name if it does */ if (Model_getId(m) != NULL) { fprintf(fout, "digraph %s {\n", Model_getId(m)); } else { fprintf(fout, "digraph example {\n"); } fprintf(fout, "compound=true;\n"); for (n = 0; n < <API key>(m); ++n) { <API key>(n + 1, <API key>(m, n)); } for (n = 0; n < Model_getNumRules(m); ++n) { printRuleMath(n + 1, Model_getRule(m, n)); } printf("\n"); for (n = 0; n < <API key>(m); ++n) { printReactionMath(n + 1, Model_getReaction(m, n)); } printf("\n"); for (n = 0; n < Model_getNumEvents(m); ++n) { printEventMath(n + 1, Model_getEvent(m, n)); } fprintf(fout, "}\n"); } int main (int argc, char *argv[]) { SBMLDocument_t *d; Model_t *m; if (argc != 3) { printf("\n usage: drawMath <sbml filename> <output dot filename>\n\n"); return 1; } d = readSBML(argv[1]); m = <API key>(d); <API key>(d, stdout); if ((fout = fopen( argv[2], "w" )) == NULL ) { printf( "The output file was not opened\n" ); } else { printMath(m); fclose(fout); } SBMLDocument_free(d); return 0; }
#include "config.h" #include "<API key>.h" #if HAVE(ACCESSIBILITY) #include "<API key>.h" #include "<API key>.h" #include "DumpRenderTree.h" #include <atk/atk.h> bool <API key> = false; <API key>::<API key>() : <API key>(nullptr) { } <API key>::~<API key>() { } <API key> <API key>::elementAtPoint(int x, int y) { // FIXME: implement return nullptr; } void <API key>::<API key>() { } void <API key>::setLogFocusEvents(bool) { } void <API key>::<API key>(bool) { } void <API key>::<API key>(bool) { } void <API key>::<API key>(bool <API key>) { if (<API key> == <API key>) return; if (!<API key>) { <API key> = false; <API key>(); return; } <API key>(); <API key> = true; } bool <API key>::<API key>(JSObjectRef functionCallback) { if (!functionCallback) return false; // Only one global notification listener. if (<API key>) return false; <API key> = <API key>::create(); <API key>-><API key>(functionCallback); return true; } void <API key>::<API key>() { // Programmers should not be trying to remove a listener that's already removed. ASSERT(<API key>); <API key> = nullptr; } JSRetainPtr<JSStringRef> <API key>::platformName() const { JSRetainPtr<JSStringRef> platformName(Adopt, <API key>("atk")); return platformName; } AtkObject* <API key>::childElementById(AtkObject* parent, const char* id) { if (!ATK_IS_OBJECT(parent)) return nullptr; bool parentFound = false; AtkAttributeSet* attributeSet(<API key>(parent)); for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); if (!strcmp(attribute->name, "html-id")) { if (!strcmp(attribute->value, id)) parentFound = true; break; } } <API key>(attributeSet); if (parentFound) return parent; int childCount = <API key>(parent); for (int i = 0; i < childCount; i++) { AtkObject* result = childElementById(<API key>(parent, i), id); if (ATK_IS_OBJECT(result)) return result; } return nullptr; } #endif
#include <linux/slab.h> #include <linux/kthread.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/uaccess.h> #include <linux/wait.h> #include <linux/mutex.h> #include <linux/msm_audio_ion.h> #include <asm/mach-types.h> #include <mach/qdsp6v2/rtac.h> #include <mach/socinfo.h> #include <mach/qdsp6v2/apr_tal.h> #include "sound/apr_audio-v2.h" #include "sound/q6afe-v2.h" #include "audio_acdb.h" #include "q6voice.h" #define TIMEOUT_MS 500 #define CMD_STATUS_SUCCESS 0 #define CMD_STATUS_FAIL 1 /* CVP CAL Size: 245760 = 240 * 1024 */ #define CVP_CAL_SIZE 245760 /* CVS CAL Size: 49152 = 48 * 1024 */ #define CVS_CAL_SIZE 49152 enum { VOC_TOKEN_NONE, VOIP_MEM_MAP_TOKEN, <API key>, }; static struct common_data common; static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v, uint32_t mem_handle); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(uint32_t session_id, uint32_t mode); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v); static int <API key>(struct voice_data *v, uint32_t rec_mode); static int <API key>(struct voice_data *v); static int32_t qdsp_mvm_callback(struct apr_client_data *data, void *priv); static int32_t qdsp_cvs_callback(struct apr_client_data *data, void *priv); static int32_t qdsp_cvp_callback(struct apr_client_data *data, void *priv); static int <API key>(struct voice_data *v, uint32_t module_id, int enable); static struct voice_data *<API key>(int idx); static u16 <API key>(struct voice_data *v) { if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return 0; } pr_debug("%s: mvm_handle %d\n", __func__, v->mvm_handle); return v->mvm_handle; } static void <API key>(struct voice_data *v, u16 mvm_handle) { pr_debug("%s: mvm_handle %d\n", __func__, mvm_handle); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return; } v->mvm_handle = mvm_handle; } static u16 <API key>(struct voice_data *v) { if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return 0; } pr_debug("%s: cvs_handle %d\n", __func__, v->cvs_handle); return v->cvs_handle; } static void <API key>(struct voice_data *v, u16 cvs_handle) { pr_debug("%s: cvs_handle %d\n", __func__, cvs_handle); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return; } v->cvs_handle = cvs_handle; } static u16 <API key>(struct voice_data *v) { if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return 0; } pr_debug("%s: cvp_handle %d\n", __func__, v->cvp_handle); return v->cvp_handle; } static void <API key>(struct voice_data *v, u16 cvp_handle) { pr_debug("%s: cvp_handle %d\n", __func__, cvp_handle); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return; } v->cvp_handle = cvp_handle; } char *<API key>(u32 session_id) { char *session_name = NULL; if (session_id == common.voice[VOC_PATH_PASSIVE].session_id) { session_name = VOICE_SESSION_NAME; } else if (session_id == common.voice[<API key>].session_id) { session_name = VOLTE_SESSION_NAME; } else if (session_id == common.voice[VOC_PATH_FULL].session_id) { session_name = VOIP_SESSION_NAME; } return session_name; } uint32_t voc_get_session_id(char *name) { u32 session_id = 0; if (name != NULL) { if (!strncmp(name, "Voice session", 13)) session_id = common.voice[VOC_PATH_PASSIVE].session_id; else if (!strncmp(name, "Voice2 session", 14)) session_id = common.voice[<API key>].session_id; else if (!strncmp(name, "VoLTE session", 13)) session_id = common.voice[<API key>].session_id; else session_id = common.voice[VOC_PATH_FULL].session_id; pr_debug("%s: %s has session id 0x%x\n", __func__, name, session_id); } return session_id; } static struct voice_data *voice_get_session(u32 session_id) { struct voice_data *v = NULL; switch (session_id) { case VOICE_SESSION_VSID: v = &common.voice[VOC_PATH_PASSIVE]; break; case VOICE2_SESSION_VSID: v = &common.voice[<API key>]; break; case VOLTE_SESSION_VSID: v = &common.voice[<API key>]; break; case VOIP_SESSION_VSID: v = &common.voice[VOC_PATH_FULL]; break; case ALL_SESSION_VSID: break; default: pr_err("%s: Invalid session_id : %x\n", __func__, session_id); break; } pr_debug("%s:session_id 0x%x session handle 0x%x\n", __func__, session_id, (unsigned int)v); return v; } int <API key>(u32 session_id) { int idx = 0; switch (session_id) { case VOICE_SESSION_VSID: idx = VOC_PATH_PASSIVE; break; case VOICE2_SESSION_VSID: idx = <API key>; break; case VOLTE_SESSION_VSID: idx = <API key>; break; case VOIP_SESSION_VSID: idx = VOC_PATH_FULL; break; case ALL_SESSION_VSID: idx = MAX_VOC_SESSIONS - 1; break; default: pr_err("%s: Invalid session_id : %x\n", __func__, session_id); break; } return idx; } static struct voice_data *<API key>(int idx) { return ((idx < 0 || idx >= MAX_VOC_SESSIONS) ? NULL : &common.voice[idx]); } static bool is_voice_session(u32 session_id) { return (session_id == common.voice[VOC_PATH_PASSIVE].session_id); } static bool is_voip_session(u32 session_id) { return (session_id == common.voice[VOC_PATH_FULL].session_id); } static bool is_volte_session(u32 session_id) { return (session_id == common.voice[<API key>].session_id); } static bool is_voice2_session(u32 session_id) { return (session_id == common.voice[<API key>].session_id); } static bool is_voc_state_active(int voc_state) { if ((voc_state == VOC_RUN) || (voc_state == VOC_CHANGE) || (voc_state == VOC_STANDBY)) return true; return false; } static void voc_set_error_state(uint16_t reset_proc) { struct voice_data *v = NULL; int i; for (i = 0; i < MAX_VOC_SESSIONS; i++) { if (reset_proc == APR_DEST_MODEM && i == VOC_PATH_FULL) continue; v = &common.voice[i]; if (v != NULL) v->voc_state = VOC_ERROR; } } static bool <API key>(u32 session_id) { int i; bool ret = false; /* Check if there is other active session except the input one */ for (i = 0; i < MAX_VOC_SESSIONS; i++) { if (common.voice[i].session_id == session_id) continue; if ((common.voice[i].voc_state == VOC_RUN) || (common.voice[i].voc_state == VOC_CHANGE) || (common.voice[i].voc_state == VOC_STANDBY)) { ret = true; break; } } pr_debug("%s: ret %d\n", __func__, ret); return ret; } static void init_session_id(void) { common.voice[VOC_PATH_PASSIVE].session_id = VOICE_SESSION_VSID; common.voice[<API key>].session_id = VOLTE_SESSION_VSID; common.voice[<API key>].session_id = VOICE2_SESSION_VSID; common.voice[VOC_PATH_FULL].session_id = VOIP_SESSION_VSID; } static int voice_apr_register(void) { void *modem_mvm, *modem_cvs, *modem_cvp; pr_debug("%s\n", __func__); mutex_lock(&common.common_lock); /* register callback to APR */ if (common.apr_q6_mvm == NULL) { pr_debug("%s: Start to register MVM callback\n", __func__); common.apr_q6_mvm = apr_register("ADSP", "MVM", qdsp_mvm_callback, 0xFFFFFFFF, &common); if (common.apr_q6_mvm == NULL) { pr_err("%s: Unable to register MVM\n", __func__); goto err; } /* * Register with modem for SSR callback. The APR handle * is not stored since it is used only to receive notifications * and not for communication */ modem_mvm = apr_register("MODEM", "MVM", qdsp_mvm_callback, 0xFFFFFFFF, &common); if (modem_mvm == NULL) pr_err("%s: Unable to register MVM for MODEM\n", __func__); } if (common.apr_q6_cvs == NULL) { pr_debug("%s: Start to register CVS callback\n", __func__); common.apr_q6_cvs = apr_register("ADSP", "CVS", qdsp_cvs_callback, 0xFFFFFFFF, &common); if (common.apr_q6_cvs == NULL) { pr_err("%s: Unable to register CVS\n", __func__); goto err; } <API key>(RTAC_CVS, common.apr_q6_cvs); /* * Register with modem for SSR callback. The APR handle * is not stored since it is used only to receive notifications * and not for communication */ modem_cvs = apr_register("MODEM", "CVS", qdsp_cvs_callback, 0xFFFFFFFF, &common); if (modem_cvs == NULL) pr_err("%s: Unable to register CVS for MODEM\n", __func__); } if (common.apr_q6_cvp == NULL) { pr_debug("%s: Start to register CVP callback\n", __func__); common.apr_q6_cvp = apr_register("ADSP", "CVP", qdsp_cvp_callback, 0xFFFFFFFF, &common); if (common.apr_q6_cvp == NULL) { pr_err("%s: Unable to register CVP\n", __func__); goto err; } <API key>(RTAC_CVP, common.apr_q6_cvp); /* * Register with modem for SSR callback. The APR handle * is not stored since it is used only to receive notifications * and not for communication */ modem_cvp = apr_register("MODEM", "CVP", qdsp_cvp_callback, 0xFFFFFFFF, &common); if (modem_cvp == NULL) pr_err("%s: Unable to register CVP for MODEM\n", __func__); } mutex_unlock(&common.common_lock); return 0; err: if (common.apr_q6_cvs != NULL) { apr_deregister(common.apr_q6_cvs); common.apr_q6_cvs = NULL; <API key>(RTAC_CVS, NULL); } if (common.apr_q6_mvm != NULL) { apr_deregister(common.apr_q6_mvm); common.apr_q6_mvm = NULL; } mutex_unlock(&common.common_lock); return -ENODEV; } static int <API key>(struct voice_data *v) { int ret = 0; struct <API key> mvm_voice_ctl_cmd; void *apr_mvm; u16 mvm_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; if (!apr_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); return -EINVAL; } pr_debug("%s: VoLTE command to MVM\n", __func__); if (is_volte_session(v->session_id) || is_voice_session(v->session_id) || is_voice2_session(v->session_id)) { mvm_handle = <API key>(v); mvm_voice_ctl_cmd.hdr.hdr_field = APR_HDR_FIELD( <API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_voice_ctl_cmd.hdr.pkt_size = APR_PKT_SIZE( APR_HDR_SIZE, sizeof(mvm_voice_ctl_cmd) - APR_HDR_SIZE); pr_debug("%s: send mvm Voice Ctl pkt size = %d\n", __func__, mvm_voice_ctl_cmd.hdr.pkt_size); mvm_voice_ctl_cmd.hdr.src_port = <API key>(v->session_id); mvm_voice_ctl_cmd.hdr.dest_port = mvm_handle; mvm_voice_ctl_cmd.hdr.token = 0; mvm_voice_ctl_cmd.hdr.opcode = <API key>; mvm_voice_ctl_cmd.voice_ctl.enable_flag = true; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mvm_voice_ctl_cmd); if (ret < 0) { pr_err("%s: Error sending MVM Voice CTL CMD\n", __func__); ret = -EINVAL; goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); ret = -EINVAL; goto fail; } } ret = 0; fail: return ret; } static int <API key>(struct voice_data *v) { int ret = 0; struct <API key> mvm_session_cmd; struct <API key> cvs_session_cmd; struct <API key> cvs_full_ctl_cmd; struct <API key> attach_stream_cmd; void *apr_mvm, *apr_cvs, *apr_cvp; u16 mvm_handle, cvs_handle, cvp_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; apr_cvs = common.apr_q6_cvs; apr_cvp = common.apr_q6_cvp; if (!apr_mvm || !apr_cvs || !apr_cvp) { pr_err("%s: apr_mvm or apr_cvs or apr_cvp is NULL\n", __func__); return -EINVAL; } mvm_handle = <API key>(v); cvs_handle = <API key>(v); cvp_handle = <API key>(v); pr_debug("%s: mvm_hdl=%d, cvs_hdl=%d\n", __func__, mvm_handle, cvs_handle); /* send cmd to create mvm session and wait for response */ if (!mvm_handle) { if (is_voice_session(v->session_id) || is_volte_session(v->session_id) || is_voice2_session(v->session_id)) { mvm_session_cmd.hdr.hdr_field = APR_HDR_FIELD( <API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_session_cmd.hdr.pkt_size = APR_PKT_SIZE( APR_HDR_SIZE, sizeof(mvm_session_cmd) - APR_HDR_SIZE); pr_debug("%s: send mvm create session pkt size = %d\n", __func__, mvm_session_cmd.hdr.pkt_size); mvm_session_cmd.hdr.src_port = <API key>(v->session_id); mvm_session_cmd.hdr.dest_port = 0; mvm_session_cmd.hdr.token = 0; mvm_session_cmd.hdr.opcode = <API key>; if (is_volte_session(v->session_id)) { strlcpy(mvm_session_cmd.mvm_session.name, "default volte voice", sizeof(mvm_session_cmd.mvm_session.name)); } else if (is_voice2_session(v->session_id)) { strlcpy(mvm_session_cmd.mvm_session.name, <API key>, sizeof(mvm_session_cmd.mvm_session.name)); } else { strlcpy(mvm_session_cmd.mvm_session.name, "default modem voice", sizeof(mvm_session_cmd.mvm_session.name)); } v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mvm_session_cmd); if (ret < 0) { pr_err("%s: Error sending MVM_CONTROL_SESSION\n", __func__); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } } else { pr_debug("%s: creating MVM full ctrl\n", __func__); mvm_session_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_session_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mvm_session_cmd) - APR_HDR_SIZE); mvm_session_cmd.hdr.src_port = <API key>(v->session_id); mvm_session_cmd.hdr.dest_port = 0; mvm_session_cmd.hdr.token = 0; mvm_session_cmd.hdr.opcode = <API key>; strlcpy(mvm_session_cmd.mvm_session.name, "default voip", sizeof(mvm_session_cmd.mvm_session.name)); v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mvm_session_cmd); if (ret < 0) { pr_err("Fail in sending MVM_CONTROL_SESSION\n"); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } } /* Get the created MVM handle. */ mvm_handle = <API key>(v); } /* send cmd to create cvs session */ if (!cvs_handle) { if (is_voice_session(v->session_id) || is_volte_session(v->session_id) || is_voice2_session(v->session_id)) { pr_debug("%s: creating CVS passive session\n", __func__); cvs_session_cmd.hdr.hdr_field = APR_HDR_FIELD( <API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_session_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_session_cmd) - APR_HDR_SIZE); cvs_session_cmd.hdr.src_port = <API key>(v->session_id); cvs_session_cmd.hdr.dest_port = 0; cvs_session_cmd.hdr.token = 0; cvs_session_cmd.hdr.opcode = <API key>; if (is_volte_session(v->session_id)) { strlcpy(cvs_session_cmd.cvs_session.name, "default volte voice", sizeof(cvs_session_cmd.cvs_session.name)); } else if (is_voice2_session(v->session_id)) { strlcpy(cvs_session_cmd.cvs_session.name, <API key>, sizeof(cvs_session_cmd.cvs_session.name)); } else { strlcpy(cvs_session_cmd.cvs_session.name, "default modem voice", sizeof(cvs_session_cmd.cvs_session.name)); } v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_session_cmd); if (ret < 0) { pr_err("Fail in sending <API key>\n"); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } /* Get the created CVS handle. */ cvs_handle = <API key>(v); } else { pr_debug("%s: creating CVS full session\n", __func__); cvs_full_ctl_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_full_ctl_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_full_ctl_cmd) - APR_HDR_SIZE); cvs_full_ctl_cmd.hdr.src_port = <API key>(v->session_id); cvs_full_ctl_cmd.hdr.dest_port = 0; cvs_full_ctl_cmd.hdr.token = 0; cvs_full_ctl_cmd.hdr.opcode = <API key>; cvs_full_ctl_cmd.cvs_session.direction = 2; cvs_full_ctl_cmd.cvs_session.enc_media_type = common.mvs_info.media_type; cvs_full_ctl_cmd.cvs_session.dec_media_type = common.mvs_info.media_type; cvs_full_ctl_cmd.cvs_session.network_id = common.mvs_info.network_type; strlcpy(cvs_full_ctl_cmd.cvs_session.name, "default q6 voice", sizeof(cvs_full_ctl_cmd.cvs_session.name)); v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_full_ctl_cmd); if (ret < 0) { pr_err("%s: Err %d sending CREATE_FULL_CTRL\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } /* Get the created CVS handle. */ cvs_handle = <API key>(v); /* Attach MVM to CVS. */ pr_debug("%s: Attach MVM to stream\n", __func__); attach_stream_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); attach_stream_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(attach_stream_cmd) - APR_HDR_SIZE); attach_stream_cmd.hdr.src_port = <API key>(v->session_id); attach_stream_cmd.hdr.dest_port = mvm_handle; attach_stream_cmd.hdr.token = 0; attach_stream_cmd.hdr.opcode = <API key>; attach_stream_cmd.attach_stream.handle = cvs_handle; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &attach_stream_cmd); if (ret < 0) { pr_err("%s: Error %d sending ATTACH_STREAM\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } } } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { int ret = 0; struct <API key> detach_stream; struct apr_hdr mvm_destroy; struct apr_hdr cvs_destroy; void *apr_mvm, *apr_cvs; u16 mvm_handle, cvs_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; apr_cvs = common.apr_q6_cvs; if (!apr_mvm || !apr_cvs) { pr_err("%s: apr_mvm or apr_cvs is NULL\n", __func__); return -EINVAL; } mvm_handle = <API key>(v); cvs_handle = <API key>(v); /* MVM, CVS sessions are destroyed only for Full control sessions. */ if (is_voip_session(v->session_id)) { pr_debug("%s: MVM detach stream, VOC_STATE: %d\n", __func__, v->voc_state); /* Detach voice stream. */ detach_stream.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); detach_stream.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(detach_stream) - APR_HDR_SIZE); detach_stream.hdr.src_port = <API key>(v->session_id); detach_stream.hdr.dest_port = mvm_handle; detach_stream.hdr.token = 0; detach_stream.hdr.opcode = <API key>; detach_stream.detach_stream.handle = cvs_handle; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &detach_stream); if (ret < 0) { pr_err("%s: Error %d sending DETACH_STREAM\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait event timeout\n", __func__); goto fail; } /* Unmap memory */ if (v->shmem_info.mem_handle != 0) { ret = <API key>(v, v->shmem_info.mem_handle); if (ret < 0) { pr_err("%s Memory_unmap for voip failed %d\n", __func__, ret); goto fail; } v->shmem_info.mem_handle = 0; } } if (is_voip_session(v->session_id) || v->voc_state == VOC_ERROR) { /* Destroy CVS. */ pr_debug("%s: CVS destroy session\n", __func__); cvs_destroy.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_destroy.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_destroy) - APR_HDR_SIZE); cvs_destroy.src_port = <API key>(v->session_id); cvs_destroy.dest_port = cvs_handle; cvs_destroy.token = 0; cvs_destroy.opcode = <API key>; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_destroy); if (ret < 0) { pr_err("%s: Error %d sending CVS DESTROY\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait event timeout\n", __func__); goto fail; } cvs_handle = 0; <API key>(v, cvs_handle); /* Unmap physical memory for calibration */ pr_debug("%s: cal_mem_handle %d\n", __func__, common.cal_mem_handle); if (!<API key>(v->session_id) && (common.cal_mem_handle != 0)) { ret = <API key>(v, common.cal_mem_handle); if (ret < 0) { pr_err("%s Fail at cal mem unmap %d\n", __func__, ret); goto fail; } common.cal_mem_handle = 0; } /* Destroy MVM. */ pr_debug("MVM destroy session\n"); mvm_destroy.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_destroy.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mvm_destroy) - APR_HDR_SIZE); mvm_destroy.src_port = <API key>(v->session_id); mvm_destroy.dest_port = mvm_handle; mvm_destroy.token = 0; mvm_destroy.opcode = <API key>; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mvm_destroy); if (ret < 0) { pr_err("%s: Error %d sending MVM DESTROY\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait event timeout\n", __func__); goto fail; } mvm_handle = 0; <API key>(v, mvm_handle); } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { int ret = 0; struct <API key> mvm_tty_mode_cmd; void *apr_mvm; u16 mvm_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; if (!apr_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); return -EINVAL; } mvm_handle = <API key>(v); if (v->tty_mode) { /* send tty mode cmd to mvm */ mvm_tty_mode_cmd.hdr.hdr_field = APR_HDR_FIELD( <API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_tty_mode_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mvm_tty_mode_cmd) - APR_HDR_SIZE); pr_debug("%s: pkt size = %d\n", __func__, mvm_tty_mode_cmd.hdr.pkt_size); mvm_tty_mode_cmd.hdr.src_port = <API key>(v->session_id); mvm_tty_mode_cmd.hdr.dest_port = mvm_handle; mvm_tty_mode_cmd.hdr.token = 0; mvm_tty_mode_cmd.hdr.opcode = <API key>; mvm_tty_mode_cmd.tty_mode.mode = v->tty_mode; pr_debug("tty mode =%d\n", mvm_tty_mode_cmd.tty_mode.mode); v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mvm_tty_mode_cmd); if (ret < 0) { pr_err("%s: Error %d sending SET_TTY_MODE\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v, uint32_t module_id, int enable) { struct <API key> cvs_set_pp_cmd; int ret = 0; void *apr_cvs; u16 cvs_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL.\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); cvs_set_pp_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_set_pp_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_set_pp_cmd) - APR_HDR_SIZE); cvs_set_pp_cmd.hdr.src_port = <API key>(v->session_id); cvs_set_pp_cmd.hdr.dest_port = cvs_handle; cvs_set_pp_cmd.hdr.token = 0; cvs_set_pp_cmd.hdr.opcode = <API key>; cvs_set_pp_cmd.vss_set_pp.module_id = module_id; cvs_set_pp_cmd.vss_set_pp.param_id = <API key>; cvs_set_pp_cmd.vss_set_pp.param_size = <API key>; cvs_set_pp_cmd.vss_set_pp.reserved = 0; cvs_set_pp_cmd.vss_set_pp.enable = enable; cvs_set_pp_cmd.vss_set_pp.reserved_field = 0; pr_debug("<API key>, module_id=%d, enable=%d\n", module_id, enable); v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_set_pp_cmd); if (ret < 0) { pr_err("Fail: sending cvs set pp enable,\n"); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int voice_set_dtx(struct voice_data *v) { int ret = 0; void *apr_cvs; u16 cvs_handle; struct <API key> cvs_set_dtx; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL.\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); /* Set DTX */ cvs_set_dtx.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_set_dtx.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_set_dtx) - APR_HDR_SIZE); cvs_set_dtx.hdr.src_port = <API key>(v->session_id); cvs_set_dtx.hdr.dest_port = cvs_handle; cvs_set_dtx.hdr.token = 0; cvs_set_dtx.hdr.opcode = <API key>; cvs_set_dtx.dtx_mode.enable = common.mvs_info.dtx_mode; pr_debug("%s: Setting DTX %d\n", __func__, common.mvs_info.dtx_mode); v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_set_dtx); if (ret < 0) { pr_err("%s: Error %d sending SET_DTX\n", __func__, ret); return -EINVAL; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); return -EINVAL; } return 0; } static int <API key>(struct voice_data *v) { struct <API key> <API key>; int ret = 0; void *apr_mvm; u16 mvm_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; if (!apr_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); return -EINVAL; } mvm_handle = <API key>(v); <API key>.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); <API key>.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(<API key>) - APR_HDR_SIZE); <API key>.hdr.src_port = <API key>(v->session_id); <API key>.hdr.dest_port = mvm_handle; <API key>.hdr.token = 0; <API key>.hdr.opcode = <API key>; <API key>.media_id = common.mvs_info.media_type; pr_debug("%s: setting media_id as %x\n", __func__ , <API key>.media_id); v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &<API key>); if (ret < 0) { pr_err("%s: Error %d sending media type\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout %d\n", __func__, ret); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v, uint32_t enable) { int ret = 0; void *apr_cvs; u16 cvs_handle; struct <API key> <API key>; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL.\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); /* Set <API key> */ <API key>.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); <API key>.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(<API key>) - APR_HDR_SIZE); <API key>.hdr.src_port = <API key>(v->session_id); <API key>.hdr.dest_port = cvs_handle; <API key>.hdr.token = 0; <API key>.hdr.opcode = <API key>; <API key>.cvs_dtmf_det.enable = enable; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &<API key>); if (ret < 0) { pr_err("%s: Error %d sending <API key>\n", __func__, ret); return -EINVAL; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); return -EINVAL; } return ret; } void <API key>(void) { struct voice_data *v = NULL; int i; for (i = 0; i < MAX_VOC_SESSIONS; i++) { v = &common.voice[i]; if ((v->dtmf_rx_detect_en) && ((v->voc_state == VOC_RUN) || (v->voc_state == VOC_CHANGE) || (v->voc_state == VOC_STANDBY))) { pr_debug("disable dtmf det on ses_id=%d\n", v->session_id); <API key>(v, 0); } } } int <API key>(uint32_t session_id, uint32_t enable) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); v->dtmf_rx_detect_en = enable; if ((v->voc_state == VOC_RUN) || (v->voc_state == VOC_CHANGE) || (v->voc_state == VOC_STANDBY)) ret = <API key>(v, v->dtmf_rx_detect_en); mutex_unlock(&v->lock); return ret; } static int <API key>(struct voice_data *v) { int ret = 0; void *apr_cvs; u16 cvs_handle; /* Set media type. */ struct <API key> cvs_set_media_cmd; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL.\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); cvs_set_media_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_set_media_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_set_media_cmd) - APR_HDR_SIZE); cvs_set_media_cmd.hdr.src_port = <API key>(v->session_id); cvs_set_media_cmd.hdr.dest_port = cvs_handle; cvs_set_media_cmd.hdr.token = 0; cvs_set_media_cmd.hdr.opcode = <API key>; cvs_set_media_cmd.media_type.tx_media_id = common.mvs_info.media_type; cvs_set_media_cmd.media_type.rx_media_id = common.mvs_info.media_type; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_set_media_cmd); if (ret < 0) { pr_err("%s: Error %d sending SET_MEDIA_TYPE\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } /* Set encoder properties. */ switch (common.mvs_info.media_type) { case <API key>: case <API key>: case <API key>: { struct <API key> cvs_set_cdma_rate; pr_debug("Setting EVRC min-max rate\n"); cvs_set_cdma_rate.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_set_cdma_rate.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_set_cdma_rate) - APR_HDR_SIZE); cvs_set_cdma_rate.hdr.src_port = <API key>(v->session_id); cvs_set_cdma_rate.hdr.dest_port = cvs_handle; cvs_set_cdma_rate.hdr.token = 0; cvs_set_cdma_rate.hdr.opcode = <API key>; cvs_set_cdma_rate.cdma_rate.min_rate = common.mvs_info.rate; cvs_set_cdma_rate.cdma_rate.max_rate = common.mvs_info.rate; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_set_cdma_rate); if (ret < 0) { pr_err("%s: Error %d sending <API key>\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } break; } case <API key>: { struct <API key> cvs_set_amr_rate; pr_debug("Setting AMR rate\n"); cvs_set_amr_rate.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_set_amr_rate.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_set_amr_rate) - APR_HDR_SIZE); cvs_set_amr_rate.hdr.src_port = <API key>(v->session_id); cvs_set_amr_rate.hdr.dest_port = cvs_handle; cvs_set_amr_rate.hdr.token = 0; cvs_set_amr_rate.hdr.opcode = <API key>; cvs_set_amr_rate.amr_rate.mode = common.mvs_info.rate; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_set_amr_rate); if (ret < 0) { pr_err("%s: Error %d sending SET_AMR_RATE\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } ret = voice_set_dtx(v); if (ret < 0) goto fail; break; } case <API key>: { struct <API key> cvs_set_amrwb_rate; pr_debug("Setting AMR WB rate\n"); cvs_set_amrwb_rate.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_set_amrwb_rate.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_set_amrwb_rate) - APR_HDR_SIZE); cvs_set_amrwb_rate.hdr.src_port = <API key>(v->session_id); cvs_set_amrwb_rate.hdr.dest_port = cvs_handle; cvs_set_amrwb_rate.hdr.token = 0; cvs_set_amrwb_rate.hdr.opcode = <API key>; cvs_set_amrwb_rate.amrwb_rate.mode = common.mvs_info.rate; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_set_amrwb_rate); if (ret < 0) { pr_err("%s: Error %d sending SET_AMRWB_RATE\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } ret = voice_set_dtx(v); if (ret < 0) goto fail; break; } case VSS_MEDIA_ID_G729: case <API key>: case <API key>: { ret = voice_set_dtx(v); break; } default: /* Do nothing. */ break; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct apr_hdr mvm_start_voice_cmd; int ret = 0; void *apr_mvm; u16 mvm_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; if (!apr_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); return -EINVAL; } mvm_handle = <API key>(v); mvm_start_voice_cmd.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_start_voice_cmd.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mvm_start_voice_cmd) - APR_HDR_SIZE); pr_debug("send mvm_start_voice_cmd pkt size = %d\n", mvm_start_voice_cmd.pkt_size); mvm_start_voice_cmd.src_port = <API key>(v->session_id); mvm_start_voice_cmd.dest_port = mvm_handle; mvm_start_voice_cmd.token = 0; mvm_start_voice_cmd.opcode = <API key>; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mvm_start_voice_cmd); if (ret < 0) { pr_err("Fail in sending <API key>\n"); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct apr_hdr cvp_disable_cmd; int ret = 0; void *apr_cvp; u16 cvp_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvp = common.apr_q6_cvp; if (!apr_cvp) { pr_err("%s: apr regist failed\n", __func__); return -EINVAL; } cvp_handle = <API key>(v); /* disable vocproc and wait for respose */ cvp_disable_cmd.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvp_disable_cmd.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvp_disable_cmd) - APR_HDR_SIZE); pr_debug("cvp_disable_cmd pkt size = %d, cvp_handle=%d\n", cvp_disable_cmd.pkt_size, cvp_handle); cvp_disable_cmd.src_port = <API key>(v->session_id); cvp_disable_cmd.dest_port = cvp_handle; cvp_disable_cmd.token = 0; cvp_disable_cmd.opcode = <API key>; v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvp, (uint32_t *) &cvp_disable_cmd); if (ret < 0) { pr_err("Fail in sending <API key>\n"); goto fail; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static void <API key>(struct voice_data *v, uint32_t *tx_topology_id, uint32_t *rx_topology_id) { uint32_t tx_id = 0; uint32_t rx_id = 0; if (v->lch_mode == VOICE_LCH_START) { pr_debug("%s: Setting TX and RX topology to NONE for LCH\n", __func__); tx_id = <API key>; rx_id = <API key>; } else { /* Use default topology if invalid value in ACDB */ tx_id = <API key>(); if (tx_id == 0) tx_id = <API key>; rx_id = <API key>(); if (rx_id == 0) rx_id = <API key>; } *tx_topology_id = tx_id; *rx_topology_id = rx_id; } static int <API key>(struct voice_data *v) { struct cvp_set_device_cmd cvp_setdev_cmd; int ret = 0; void *apr_cvp; u16 cvp_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvp = common.apr_q6_cvp; if (!apr_cvp) { pr_err("%s: apr_cvp is NULL.\n", __func__); return -EINVAL; } cvp_handle = <API key>(v); /* set device and wait for response */ cvp_setdev_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvp_setdev_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvp_setdev_cmd) - APR_HDR_SIZE); pr_debug(" send create cvp setdev, pkt size = %d\n", cvp_setdev_cmd.hdr.pkt_size); cvp_setdev_cmd.hdr.src_port = <API key>(v->session_id); cvp_setdev_cmd.hdr.dest_port = cvp_handle; cvp_setdev_cmd.hdr.token = 0; cvp_setdev_cmd.hdr.opcode = <API key>; <API key>(v, &cvp_setdev_cmd.cvp_set_device_v2.tx_topology_id, &cvp_setdev_cmd.cvp_set_device_v2.rx_topology_id); cvp_setdev_cmd.cvp_set_device_v2.tx_port_id = v->dev_tx.port_id; cvp_setdev_cmd.cvp_set_device_v2.rx_port_id = v->dev_rx.port_id; cvp_setdev_cmd.cvp_set_device_v2.vocproc_mode = <API key>; cvp_setdev_cmd.cvp_set_device_v2.ec_ref_port_id = <API key>; pr_debug("topology=%d , tx_port_id=%d, rx_port_id=%d\n", cvp_setdev_cmd.cvp_set_device_v2.tx_topology_id, cvp_setdev_cmd.cvp_set_device_v2.tx_port_id, cvp_setdev_cmd.cvp_set_device_v2.rx_port_id); v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvp, (uint32_t *) &cvp_setdev_cmd); if (ret < 0) { pr_err("Fail in sending <API key>\n"); goto fail; } pr_debug("wait for cvp create session event\n"); ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct apr_hdr mvm_stop_voice_cmd; int ret = 0; void *apr_mvm; u16 mvm_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; if (!apr_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); return -EINVAL; } mvm_handle = <API key>(v); mvm_stop_voice_cmd.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_stop_voice_cmd.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mvm_stop_voice_cmd) - APR_HDR_SIZE); pr_debug("send mvm_stop_voice_cmd pkt size = %d\n", mvm_stop_voice_cmd.pkt_size); mvm_stop_voice_cmd.src_port = <API key>(v->session_id); mvm_stop_voice_cmd.dest_port = mvm_handle; mvm_stop_voice_cmd.token = 0; mvm_stop_voice_cmd.opcode = <API key>; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mvm_stop_voice_cmd); if (ret < 0) { pr_err("Fail in sending <API key>\n"); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> cvs_reg_cal_cmd; struct acdb_cal_block cal_block; int ret = 0; memset(&cvs_reg_cal_cmd, 0, sizeof(cvs_reg_cal_cmd)); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); goto fail; } if (!common.apr_q6_cvs) { pr_err("%s: apr_cvs is NULL\n", __func__); goto fail; } if (!common.cal_mem_handle) { pr_err("%s: Cal mem handle is NULL\n", __func__); goto fail; } get_vocstrm_cal(&cal_block); if (cal_block.cal_size == 0) { pr_err("%s: CVS cal size is 0\n", __func__); goto fail; } cvs_reg_cal_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_reg_cal_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_reg_cal_cmd) - APR_HDR_SIZE); cvs_reg_cal_cmd.hdr.src_port = <API key>(v->session_id); cvs_reg_cal_cmd.hdr.dest_port = <API key>(v); cvs_reg_cal_cmd.hdr.token = 0; cvs_reg_cal_cmd.hdr.opcode = <API key>; cvs_reg_cal_cmd.cvs_cal_data.cal_mem_handle = common.cal_mem_handle; cvs_reg_cal_cmd.cvs_cal_data.cal_mem_address = cal_block.cal_paddr; cvs_reg_cal_cmd.cvs_cal_data.cal_mem_size = cal_block.cal_size; /* Get the column info corresponding to CVS cal from ACDB. */ get_voice_col_data(VOCSTRM_CAL, &cal_block); if (cal_block.cal_size == 0 || cal_block.cal_size > sizeof(cvs_reg_cal_cmd.cvs_cal_data.column_info)) { pr_err("%s: Invalid VOCSTRM_CAL size %d\n", __func__, cal_block.cal_size); goto fail; } memcpy(&cvs_reg_cal_cmd.cvs_cal_data.column_info[0], (void *) cal_block.cal_kvaddr, cal_block.cal_size); v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(common.apr_q6_cvs, (uint32_t *) &cvs_reg_cal_cmd); if (ret < 0) { pr_err("%s: Error %d registering CVS cal\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> cvs_dereg_cal_cmd; struct acdb_cal_block cal_block; int ret = 0; memset(&cvs_dereg_cal_cmd, 0, sizeof(cvs_dereg_cal_cmd)); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); goto fail; } if (!common.apr_q6_cvs) { pr_err("%s: apr_cvs is NULL\n", __func__); goto fail; } get_vocstrm_cal(&cal_block); if (cal_block.cal_size == 0) return 0; cvs_dereg_cal_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_dereg_cal_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_dereg_cal_cmd) - APR_HDR_SIZE); cvs_dereg_cal_cmd.hdr.src_port = <API key>(v->session_id); cvs_dereg_cal_cmd.hdr.dest_port = <API key>(v); cvs_dereg_cal_cmd.hdr.token = 0; cvs_dereg_cal_cmd.hdr.opcode = <API key>; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(common.apr_q6_cvs, (uint32_t *) &cvs_dereg_cal_cmd); if (ret < 0) { pr_err("%s: Error %d de-registering CVS cal\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> cvp_reg_dev_cfg_cmd; struct acdb_cal_block cal_block; int ret = 0; memset(&cvp_reg_dev_cfg_cmd, 0, sizeof(cvp_reg_dev_cfg_cmd)); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); goto fail; } if (!common.apr_q6_cvp) { pr_err("%s: apr_cvp is NULL\n", __func__); goto fail; } if (!common.cal_mem_handle) { pr_err("%s: Cal mem handle is NULL\n", __func__); goto fail; } <API key>(&cal_block); if (cal_block.cal_size == 0) { pr_err("%s: CVP cal size is 0\n", __func__); goto fail; } cvp_reg_dev_cfg_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvp_reg_dev_cfg_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvp_reg_dev_cfg_cmd) - APR_HDR_SIZE); cvp_reg_dev_cfg_cmd.hdr.src_port = <API key>(v->session_id); cvp_reg_dev_cfg_cmd.hdr.dest_port = <API key>(v); cvp_reg_dev_cfg_cmd.hdr.token = 0; cvp_reg_dev_cfg_cmd.hdr.opcode = <API key>; cvp_reg_dev_cfg_cmd.cvp_dev_cfg_data.mem_handle = common.cal_mem_handle; cvp_reg_dev_cfg_cmd.cvp_dev_cfg_data.mem_address = cal_block.cal_paddr; cvp_reg_dev_cfg_cmd.cvp_dev_cfg_data.mem_size = cal_block.cal_size; v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(common.apr_q6_cvp, (uint32_t *) &cvp_reg_dev_cfg_cmd); if (ret < 0) { pr_err("%s: Error %d registering CVP dev cfg cal\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> <API key>; struct acdb_cal_block cal_block; int ret = 0; memset(&<API key>, 0, sizeof(<API key>)); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); goto fail; } if (!common.apr_q6_cvp) { pr_err("%s: apr_cvp is NULL.\n", __func__); goto fail; } <API key>(&cal_block); if (cal_block.cal_size == 0) return 0; <API key>.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); <API key>.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(<API key>) - APR_HDR_SIZE); <API key>.hdr.src_port = <API key>(v->session_id); <API key>.hdr.dest_port = <API key>(v); <API key>.hdr.token = 0; <API key>.hdr.opcode = <API key>; v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(common.apr_q6_cvp, (uint32_t *) &<API key>); if (ret < 0) { pr_err("%s: Error %d de-registering CVP dev cfg cal\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> cvp_reg_cal_cmd; struct acdb_cal_block cal_block; int ret = 0; memset(&cvp_reg_cal_cmd, 0, sizeof(cvp_reg_cal_cmd)); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); goto fail; } if (!common.apr_q6_cvp) { pr_err("%s: apr_cvp is NULL\n", __func__); goto fail; } if (!common.cal_mem_handle) { pr_err("%s: Cal mem handle is NULL\n", __func__); goto fail; } get_vocproc_cal(&cal_block); if (cal_block.cal_size == 0) { pr_err("%s: CVP cal size is 0\n", __func__); goto fail; } cvp_reg_cal_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvp_reg_cal_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvp_reg_cal_cmd) - APR_HDR_SIZE); cvp_reg_cal_cmd.hdr.src_port = <API key>(v->session_id); cvp_reg_cal_cmd.hdr.dest_port = <API key>(v); cvp_reg_cal_cmd.hdr.token = 0; cvp_reg_cal_cmd.hdr.opcode = <API key>; cvp_reg_cal_cmd.cvp_cal_data.cal_mem_handle = common.cal_mem_handle; cvp_reg_cal_cmd.cvp_cal_data.cal_mem_address = cal_block.cal_paddr; cvp_reg_cal_cmd.cvp_cal_data.cal_mem_size = cal_block.cal_size; /* Get the column info corresponding to CVP cal from ACDB. */ get_voice_col_data(VOCPROC_CAL, &cal_block); if (cal_block.cal_size == 0 || cal_block.cal_size > sizeof(cvp_reg_cal_cmd.cvp_cal_data.column_info)) { pr_err("%s: Invalid VOCPROC_CAL size %d\n", __func__, cal_block.cal_size); goto fail; } memcpy(&cvp_reg_cal_cmd.cvp_cal_data.column_info[0], (void *) cal_block.cal_kvaddr, cal_block.cal_size); v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(common.apr_q6_cvp, (uint32_t *) &cvp_reg_cal_cmd); if (ret < 0) { pr_err("%s: Error %d registering CVP cal\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> cvp_dereg_cal_cmd; struct acdb_cal_block cal_block; int ret = 0; memset(&cvp_dereg_cal_cmd, 0, sizeof(cvp_dereg_cal_cmd)); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); goto fail; } if (!common.apr_q6_cvp) { pr_err("%s: apr_cvp is NULL.\n", __func__); goto fail; } get_vocproc_cal(&cal_block); if (cal_block.cal_size == 0) return 0; cvp_dereg_cal_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvp_dereg_cal_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvp_dereg_cal_cmd) - APR_HDR_SIZE); cvp_dereg_cal_cmd.hdr.src_port = <API key>(v->session_id); cvp_dereg_cal_cmd.hdr.dest_port = <API key>(v); cvp_dereg_cal_cmd.hdr.token = 0; cvp_dereg_cal_cmd.hdr.opcode = <API key>; v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(common.apr_q6_cvp, (uint32_t *) &cvp_dereg_cal_cmd); if (ret < 0) { pr_err("%s: Error %d de-registering CVP cal\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> cvp_reg_vol_cal_cmd; struct acdb_cal_block cal_block; int ret = 0; memset(&cvp_reg_vol_cal_cmd, 0, sizeof(cvp_reg_vol_cal_cmd)); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); goto fail; } if (!common.apr_q6_cvp) { pr_err("%s: apr_cvp is NULL.\n", __func__); goto fail; } if (!common.cal_mem_handle) { pr_err("%s: Cal mem handle is NULL\n", __func__); goto fail; } get_vocvol_cal(&cal_block); if (cal_block.cal_size == 0) { pr_err("%s: CVP vol cal size is 0\n", __func__); goto fail; } cvp_reg_vol_cal_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvp_reg_vol_cal_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvp_reg_vol_cal_cmd) - APR_HDR_SIZE); cvp_reg_vol_cal_cmd.hdr.src_port = <API key>(v->session_id); cvp_reg_vol_cal_cmd.hdr.dest_port = <API key>(v); cvp_reg_vol_cal_cmd.hdr.token = 0; cvp_reg_vol_cal_cmd.hdr.opcode = <API key>; cvp_reg_vol_cal_cmd.cvp_vol_cal_data.cal_mem_handle = common.cal_mem_handle; cvp_reg_vol_cal_cmd.cvp_vol_cal_data.cal_mem_address = cal_block.cal_paddr; cvp_reg_vol_cal_cmd.cvp_vol_cal_data.cal_mem_size = cal_block.cal_size; /* Get the column info corresponding to CVP volume cal from ACDB. */ get_voice_col_data(VOCVOL_CAL, &cal_block); if (cal_block.cal_size == 0 || cal_block.cal_size > sizeof(cvp_reg_vol_cal_cmd.cvp_vol_cal_data.column_info)) { pr_err("%s: Invalid VOCVOL_CAL size %d\n", __func__, cal_block.cal_size); goto fail; } memcpy(&cvp_reg_vol_cal_cmd.cvp_vol_cal_data.column_info[0], (void *) cal_block.cal_kvaddr, cal_block.cal_size); v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(common.apr_q6_cvp, (uint32_t *) &cvp_reg_vol_cal_cmd); if (ret < 0) { pr_err("%s: Error %d registering CVP vol cal\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> <API key>; struct acdb_cal_block cal_block; int ret = 0; memset(&<API key>, 0, sizeof(<API key>)); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); goto fail; } if (!common.apr_q6_cvp) { pr_err("%s: apr_cvp is NULL\n", __func__); goto fail; } get_vocvol_cal(&cal_block); if (cal_block.cal_size == 0) return 0; <API key>.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); <API key>.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(<API key>) - APR_HDR_SIZE); <API key>.hdr.src_port = <API key>(v->session_id); <API key>.hdr.dest_port = <API key>(v); <API key>.hdr.token = 0; <API key>.hdr.opcode = <API key>; v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(common.apr_q6_cvp, (uint32_t *) &<API key>); if (ret < 0) { pr_err("%s: Error %d de-registering CVP vol cal\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); goto fail; } fail: return ret; } static int <API key>(struct voice_data *v, struct mem_map_table *table_info, dma_addr_t phys, uint32_t size, uint32_t token) { struct <API key> mvm_map_phys_cmd; uint32_t *memtable; int ret = 0; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); goto fail; } if (!common.apr_q6_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); goto fail; } if (!table_info->data) { pr_err("%s: memory table is NULL.\n", __func__); goto fail; } memtable = (uint32_t *) table_info->data; /* * Store next table descriptor's address(64 bit) as NULL as there * is only one memory block */ memtable[0] = (uint32_t)NULL; memtable[1] = (uint32_t)NULL; /* Store next table descriptor's size */ memtable[2] = 0; /* Store shared mem add */ memtable[3] = phys; memtable[4] = 0; /* Store shared memory size */ memtable[5] = size; mvm_map_phys_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_map_phys_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mvm_map_phys_cmd) - APR_HDR_SIZE); mvm_map_phys_cmd.hdr.src_port = <API key>(v->session_id); mvm_map_phys_cmd.hdr.dest_port = <API key>(v); mvm_map_phys_cmd.hdr.token = token; mvm_map_phys_cmd.hdr.opcode = <API key>; mvm_map_phys_cmd.table_descriptor.mem_address = table_info->phys; mvm_map_phys_cmd.table_descriptor.mem_size = sizeof(struct vss_imemory_block_t) + sizeof(struct <API key>); mvm_map_phys_cmd.is_cached = true; mvm_map_phys_cmd.cache_line_size = 128; mvm_map_phys_cmd.access_mask = 3; mvm_map_phys_cmd.page_align = 4096; mvm_map_phys_cmd.min_data_width = 8; mvm_map_phys_cmd.max_data_width = 64; pr_debug("%s: next table desc: add: %lld, size: %d\n", __func__, *((uint64_t *) memtable), *(((uint32_t *) memtable) + 2)); pr_debug("%s: phy add of of mem being mapped 0x%x, size: %d\n", __func__, *(((uint32_t *) memtable) + 3), *(((uint32_t *) memtable) + 5)); v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(common.apr_q6_mvm, (uint32_t *) &mvm_map_phys_cmd); if (ret < 0) { pr_err("%s: Error %d sending mvm map phy cmd\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { int ret = 0; struct acdb_cal_block cal_block; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } if (common.cal_mem_handle != 0) { pr_debug("%s: Cal block already mem mapped\n", __func__); return ret; } /* Get the physical address of calibration memory block from ACDB. */ <API key>(&cal_block); if (!cal_block.cal_paddr) { pr_err("%s: Cal block not allocated\n", __func__); return -EINVAL; } ret = <API key>(v, &common.cal_mem_map_table, cal_block.cal_paddr, cal_block.cal_size, <API key>); return ret; } static int <API key>(struct voice_data *v) { struct apr_hdr mvm_pause_voice_cmd; void *apr_mvm; int ret = 0; pr_debug("%s\n", __func__); if (v == NULL) { pr_err("%s: Voice data is NULL\n", __func__); ret = -EINVAL; goto done; } apr_mvm = common.apr_q6_mvm; if (!apr_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); ret = -EINVAL; goto done; } mvm_pause_voice_cmd.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_pause_voice_cmd.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mvm_pause_voice_cmd) - APR_HDR_SIZE); mvm_pause_voice_cmd.src_port = <API key>(v->session_id); mvm_pause_voice_cmd.dest_port = <API key>(v); mvm_pause_voice_cmd.token = 0; mvm_pause_voice_cmd.opcode = <API key>; v->mvm_state = CMD_STATUS_FAIL; pr_debug("%s: send mvm_pause_voice_cmd pkt size = %d\n", __func__, mvm_pause_voice_cmd.pkt_size); ret = apr_send_pkt(apr_mvm, (uint32_t *)&mvm_pause_voice_cmd); if (ret < 0) { pr_err("Fail in sending <API key>\n"); ret = -EINVAL; goto done; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); ret = -EINVAL; goto done; } done: return ret; } int <API key>(void) { int result = 0; int result2 = 0; int i; struct voice_data *v = NULL; pr_debug("%s\n", __func__); mutex_lock(&common.common_lock); if (common.cal_mem_handle == 0) goto done; for (i = 0; i < MAX_VOC_SESSIONS; i++) { v = &common.voice[i]; mutex_lock(&v->lock); if (is_voc_state_active(v->voc_state)) { result2 = <API key>(v); if (result2 < 0) { pr_err("%s: <API key> failed for session 0x%x, err %d!\n", __func__, v->session_id, result2); result = result2; } <API key>(v); <API key>(v); <API key>(v); <API key>(v); result2 = <API key>(v); if (result2) { pr_err("%s: <API key> failed for session 0x%x, err %d!\n", __func__, v->session_id, result2); result = result2; } } if ((common.cal_mem_handle != 0) && (!<API key>(v->session_id))) { result2 = <API key>( v, common.cal_mem_handle); if (result2) { pr_err("%s: <API key> failed for session 0x%x, err %d!\n", __func__, v->session_id, result2); result = result2; } else { common.cal_mem_handle = 0; } } mutex_unlock(&v->lock); } done: mutex_unlock(&common.common_lock); return result; } static int voice_setup_vocproc(struct voice_data *v) { struct <API key> cvp_session_cmd; int ret = 0; void *apr_cvp; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvp = common.apr_q6_cvp; if (!apr_cvp) { pr_err("%s: apr_cvp is NULL.\n", __func__); return -EINVAL; } /* create cvp session and wait for response */ cvp_session_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvp_session_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvp_session_cmd) - APR_HDR_SIZE); pr_debug(" send create cvp session, pkt size = %d\n", cvp_session_cmd.hdr.pkt_size); cvp_session_cmd.hdr.src_port = <API key>(v->session_id); cvp_session_cmd.hdr.dest_port = 0; cvp_session_cmd.hdr.token = 0; cvp_session_cmd.hdr.opcode = <API key>; <API key>(v, &cvp_session_cmd.cvp_session.tx_topology_id, &cvp_session_cmd.cvp_session.rx_topology_id); cvp_session_cmd.cvp_session.direction = 2; /*tx and rx*/ cvp_session_cmd.cvp_session.tx_port_id = v->dev_tx.port_id; cvp_session_cmd.cvp_session.rx_port_id = v->dev_rx.port_id; cvp_session_cmd.cvp_session.profile_id = <API key>; cvp_session_cmd.cvp_session.vocproc_mode = <API key>; cvp_session_cmd.cvp_session.ec_ref_port_id = <API key>; pr_debug("tx_topology: %d tx_port_id=%d, rx_port_id=%d, mode: 0x%x\n", cvp_session_cmd.cvp_session.tx_topology_id, cvp_session_cmd.cvp_session.tx_port_id, cvp_session_cmd.cvp_session.rx_port_id, cvp_session_cmd.cvp_session.vocproc_mode); pr_debug("rx_topology: %d, profile_id: 0x%x, pkt_size: %d\n", cvp_session_cmd.cvp_session.rx_topology_id, cvp_session_cmd.cvp_session.profile_id, cvp_session_cmd.hdr.pkt_size); v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvp, (uint32_t *) &cvp_session_cmd); if (ret < 0) { pr_err("Fail in sending <API key>\n"); goto fail; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } <API key>(v); <API key>(v); <API key>(v); <API key>(v); /* enable vocproc */ ret = <API key>(v); if (ret < 0) goto fail; /* attach vocproc */ ret = <API key>(v); if (ret < 0) goto fail; /* send tty mode if tty device is used */ <API key>(v); if (is_voip_session(v->session_id)) { ret = <API key>(v); if (ret < 0) pr_err("%s: <API key>: %d\n", __func__, ret); ret = <API key>(v); if (ret < 0) pr_err("%s: <API key>: %d\n", __func__, ret); <API key>(v); } /* enable slowtalk if st_enable is set */ if (v->st_enable) <API key>(v, <API key>, v->st_enable); /* Start in-call music delivery if this feature is enabled */ if (v->music_info.play_enable) <API key>(v); /* Start in-call recording if this feature is enabled */ if (v->rec_info.rec_enable) <API key>(v, v->rec_info.rec_mode); if (v->dtmf_rx_detect_en) <API key>(v, v->dtmf_rx_detect_en); rtac_add_voice(<API key>(v), <API key>(v), v->dev_rx.port_id, v->dev_tx.port_id, v->session_id); return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { int ret = 0; struct apr_hdr cvp_enable_cmd; void *apr_cvp; u16 cvp_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvp = common.apr_q6_cvp; if (!apr_cvp) { pr_err("%s: apr_cvp is NULL.\n", __func__); return -EINVAL; } cvp_handle = <API key>(v); /* enable vocproc and wait for respose */ cvp_enable_cmd.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvp_enable_cmd.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvp_enable_cmd) - APR_HDR_SIZE); pr_debug("cvp_enable_cmd pkt size = %d, cvp_handle=%d\n", cvp_enable_cmd.pkt_size, cvp_handle); cvp_enable_cmd.src_port = <API key>(v->session_id); cvp_enable_cmd.dest_port = cvp_handle; cvp_enable_cmd.token = 0; cvp_enable_cmd.opcode = <API key>; v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvp, (uint32_t *) &cvp_enable_cmd); if (ret < 0) { pr_err("Fail in sending <API key>\n"); goto fail; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> mvm_set_cal_network; int ret = 0; void *apr_mvm; u16 mvm_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; if (!apr_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); return -EINVAL; } mvm_handle = <API key>(v); mvm_set_cal_network.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_set_cal_network.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mvm_set_cal_network) - APR_HDR_SIZE); mvm_set_cal_network.hdr.src_port = <API key>(v->session_id); mvm_set_cal_network.hdr.dest_port = mvm_handle; mvm_set_cal_network.hdr.token = 0; mvm_set_cal_network.hdr.opcode = <API key>; mvm_set_cal_network.network_id = <API key>; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mvm_set_cal_network); if (ret < 0) { pr_err("%s: Error %d sending SET_NETWORK\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout %d\n", __func__, ret); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { int ret = 0; void *apr_mvm; u16 mvm_handle; struct mvm_set_network_cmd mvm_set_network; struct <API key> <API key>; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; if (!apr_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); return -EINVAL; } mvm_handle = <API key>(v); ret = <API key>(v); if (ret < 0) { pr_err("%s: Error %d configuring CVS voc", __func__, ret); goto fail; } /* Set network ID. */ pr_debug("Setting network ID\n"); mvm_set_network.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_set_network.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mvm_set_network) - APR_HDR_SIZE); mvm_set_network.hdr.src_port = <API key>(v->session_id); mvm_set_network.hdr.dest_port = mvm_handle; mvm_set_network.hdr.token = 0; mvm_set_network.hdr.opcode = <API key>; mvm_set_network.network.network_id = common.mvs_info.network_type; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mvm_set_network); if (ret < 0) { pr_err("%s: Error %d sending SET_NETWORK\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } /* Set voice timing. */ pr_debug("Setting voice timing\n"); <API key>.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); <API key>.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(<API key>) - APR_HDR_SIZE); <API key>.hdr.src_port = <API key>(v->session_id); <API key>.hdr.dest_port = mvm_handle; <API key>.hdr.token = 0; <API key>.hdr.opcode = <API key>; <API key>.timing.mode = 0; <API key>.timing.enc_offset = 8000; <API key>.timing.dec_req_offset = 3300; <API key>.timing.dec_offset = 8300; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &<API key>); if (ret < 0) { pr_err("%s: Error %d sending SET_TIMING\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { int ret = 0; struct <API key> mvm_a_vocproc_cmd; void *apr_mvm; u16 mvm_handle, cvp_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; if (!apr_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); return -EINVAL; } mvm_handle = <API key>(v); cvp_handle = <API key>(v); /* attach vocproc and wait for response */ mvm_a_vocproc_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_a_vocproc_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mvm_a_vocproc_cmd) - APR_HDR_SIZE); pr_debug("send mvm_a_vocproc_cmd pkt size = %d\n", mvm_a_vocproc_cmd.hdr.pkt_size); mvm_a_vocproc_cmd.hdr.src_port = <API key>(v->session_id); mvm_a_vocproc_cmd.hdr.dest_port = mvm_handle; mvm_a_vocproc_cmd.hdr.token = 0; mvm_a_vocproc_cmd.hdr.opcode = <API key>; mvm_a_vocproc_cmd.<API key>.handle = cvp_handle; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mvm_a_vocproc_cmd); if (ret < 0) { pr_err("Fail in sending <API key>\n"); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> mvm_d_vocproc_cmd; struct apr_hdr <API key>; int ret = 0; void *apr_mvm, *apr_cvp; u16 mvm_handle, cvp_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; apr_cvp = common.apr_q6_cvp; if (!apr_mvm || !apr_cvp) { pr_err("%s: apr_mvm or apr_cvp is NULL.\n", __func__); return -EINVAL; } mvm_handle = <API key>(v); cvp_handle = <API key>(v); /* stop playback or recording */ v->music_info.force = 1; <API key>(v); <API key>(v); /* send stop voice cmd */ <API key>(v); /* send stop dtmf detecton cmd */ if (v->dtmf_rx_detect_en) <API key>(v, 0); /* reset LCH mode */ v->lch_mode = 0; /* clear mute setting */ v->dev_rx.dev_mute = common.default_mute_val; v->dev_tx.dev_mute = common.default_mute_val; v->stream_rx.stream_mute = common.default_mute_val; v->stream_tx.stream_mute = common.default_mute_val; /* detach VOCPROC and wait for response from mvm */ mvm_d_vocproc_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mvm_d_vocproc_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mvm_d_vocproc_cmd) - APR_HDR_SIZE); pr_debug("mvm_d_vocproc_cmd pkt size = %d\n", mvm_d_vocproc_cmd.hdr.pkt_size); mvm_d_vocproc_cmd.hdr.src_port = <API key>(v->session_id); mvm_d_vocproc_cmd.hdr.dest_port = mvm_handle; mvm_d_vocproc_cmd.hdr.token = 0; mvm_d_vocproc_cmd.hdr.opcode = <API key>; mvm_d_vocproc_cmd.<API key>.handle = cvp_handle; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mvm_d_vocproc_cmd); if (ret < 0) { pr_err("Fail in sending <API key>\n"); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } <API key>(v); <API key>(v); <API key>(v); <API key>(v); /* destrop cvp session */ <API key>.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); <API key>.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(<API key>) - APR_HDR_SIZE); pr_debug("<API key> pkt size = %d\n", <API key>.pkt_size); <API key>.src_port = <API key>(v->session_id); <API key>.dest_port = cvp_handle; <API key>.token = 0; <API key>.opcode = <API key>; v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvp, (uint32_t *) &<API key>); if (ret < 0) { pr_err("Fail in sending <API key>\n"); goto fail; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } rtac_remove_voice(<API key>(v)); cvp_handle = 0; <API key>(v, cvp_handle); return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v, uint32_t mem_handle) { struct <API key> mem_unmap; int ret = 0; void *apr_mvm; u16 mvm_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_mvm = common.apr_q6_mvm; if (!apr_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); return -EINVAL; } mvm_handle = <API key>(v); mem_unmap.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); mem_unmap.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(mem_unmap) - APR_HDR_SIZE); mem_unmap.hdr.src_port = <API key>(v->session_id); mem_unmap.hdr.dest_port = mvm_handle; mem_unmap.hdr.token = 0; mem_unmap.hdr.opcode = <API key>; mem_unmap.mem_handle = mem_handle; pr_debug("%s: mem_handle: ox%x\n", __func__, mem_unmap.mem_handle); v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *) &mem_unmap); if (ret < 0) { pr_err("mem_unmap op[0x%x]ret[%d]\n", mem_unmap.hdr.opcode, ret); goto fail; } ret = wait_event_timeout(v->mvm_wait, (v->mvm_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout %d\n", __func__, ret); goto fail; } return 0; fail: return ret; } static int <API key>(struct voice_data *v) { struct <API key> <API key>; int ret = 0; uint64_t *dec_buf; uint64_t *enc_buf; void *apr_cvs; u16 cvs_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } dec_buf = (uint64_t *)v->shmem_info.sh_buf.buf[0].phys; enc_buf = (uint64_t *)v->shmem_info.sh_buf.buf[1].phys; apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL.\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); <API key>.hdr.hdr_field = APR_HDR_FIELD( <API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); <API key>.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(<API key>) - APR_HDR_SIZE); <API key>.hdr.src_port = <API key>(v->session_id); <API key>.hdr.dest_port = cvs_handle; <API key>.hdr.token = 0; <API key>.hdr.opcode = <API key>; <API key>.mem_handle = v->shmem_info.mem_handle; <API key>.dec_buf_addr = (uint32_t)dec_buf; <API key>.dec_buf_size = 4096; <API key>.enc_buf_addr = (uint32_t)enc_buf; <API key>.enc_buf_size = 4096; pr_debug("%s: dec buf: add %p, size %d, enc buf: add %p, size %d\n", __func__, dec_buf, <API key>.dec_buf_size, enc_buf, <API key>.enc_buf_size); v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &<API key>); if (ret < 0) { pr_err("Failed to send packet exchange config cmd %d\n", ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) pr_err("%s: wait_event timeout %d\n", __func__, ret); return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> data_exchange_pkt; int ret = 0; void *apr_cvs; u16 cvs_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL.\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); data_exchange_pkt.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); data_exchange_pkt.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(data_exchange_pkt) - APR_HDR_SIZE); data_exchange_pkt.hdr.src_port = <API key>(v->session_id); data_exchange_pkt.hdr.dest_port = cvs_handle; data_exchange_pkt.hdr.token = 0; data_exchange_pkt.hdr.opcode = <API key>; data_exchange_pkt.mode = <API key>; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &data_exchange_pkt); if (ret < 0) { pr_err("Failed to send data exchange mode %d\n", ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) pr_err("%s: wait_event timeout %d\n", __func__, ret); return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct cvs_set_mute_cmd cvs_mute_cmd; int ret = 0; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); goto fail; } if (!common.apr_q6_cvs) { pr_err("%s: apr_cvs is NULL.\n", __func__); goto fail; } /* send mute/unmute to cvs */ cvs_mute_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_mute_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_mute_cmd) - APR_HDR_SIZE); cvs_mute_cmd.hdr.src_port = <API key>(v->session_id); cvs_mute_cmd.hdr.dest_port = <API key>(v); cvs_mute_cmd.hdr.token = 0; cvs_mute_cmd.hdr.opcode = <API key>; cvs_mute_cmd.cvs_set_mute.direction = <API key>; cvs_mute_cmd.cvs_set_mute.mute_flag = v->stream_tx.stream_mute; cvs_mute_cmd.cvs_set_mute.ramp_duration_ms = <API key>; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(common.apr_q6_cvs, (uint32_t *) &cvs_mute_cmd); if (ret < 0) { pr_err("%s: Error %d sending stream mute\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v, uint16_t direction, uint16_t mute_flag) { struct cvp_set_mute_cmd cvp_mute_cmd; int ret = 0; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); goto fail; } if (!common.apr_q6_cvp) { pr_err("%s: apr_cvp is NULL.\n", __func__); goto fail; } cvp_mute_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvp_mute_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvp_mute_cmd) - APR_HDR_SIZE); cvp_mute_cmd.hdr.src_port = <API key>(v->session_id); cvp_mute_cmd.hdr.dest_port = <API key>(v); cvp_mute_cmd.hdr.token = 0; cvp_mute_cmd.hdr.opcode = <API key>; cvp_mute_cmd.cvp_set_mute.direction = direction; cvp_mute_cmd.cvp_set_mute.mute_flag = mute_flag; cvp_mute_cmd.cvp_set_mute.ramp_duration_ms = <API key>; v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(common.apr_q6_cvp, (uint32_t *) &cvp_mute_cmd); if (ret < 0) { pr_err("%s: Error %d sending rx device cmd\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: Command timeout\n", __func__); goto fail; } return 0; fail: return -EINVAL; } static int <API key>(struct voice_data *v) { struct <API key> cvp_vol_cmd; int ret = 0; void *apr_cvp; u16 cvp_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvp = common.apr_q6_cvp; if (!apr_cvp) { pr_err("%s: apr_cvp is NULL.\n", __func__); return -EINVAL; } cvp_handle = <API key>(v); /* send volume index to cvp */ cvp_vol_cmd.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvp_vol_cmd.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvp_vol_cmd) - APR_HDR_SIZE); cvp_vol_cmd.hdr.src_port = <API key>(v->session_id); cvp_vol_cmd.hdr.dest_port = cvp_handle; cvp_vol_cmd.hdr.token = 0; cvp_vol_cmd.hdr.opcode = <API key>; cvp_vol_cmd.cvp_set_vol_idx.vol_index = v->dev_rx.volume; v->cvp_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvp, (uint32_t *) &cvp_vol_cmd); if (ret < 0) { pr_err("Fail in sending RX VOL INDEX\n"); return -EINVAL; } ret = wait_event_timeout(v->cvp_wait, (v->cvp_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); return -EINVAL; } return 0; } static int <API key>(struct voice_data *v, uint32_t rec_mode) { int ret = 0; void *apr_cvs; u16 cvs_handle; struct <API key> cvs_start_record; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL.\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); if (!v->rec_info.recording) { cvs_start_record.hdr.hdr_field = APR_HDR_FIELD( <API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_start_record.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_start_record) - APR_HDR_SIZE); cvs_start_record.hdr.src_port = <API key>(v->session_id); cvs_start_record.hdr.dest_port = cvs_handle; cvs_start_record.hdr.token = 0; cvs_start_record.hdr.opcode = <API key>; cvs_start_record.rec_mode.port_id = <API key>; if (rec_mode == VOC_REC_UPLINK) { cvs_start_record.rec_mode.rx_tap_point = <API key>; cvs_start_record.rec_mode.tx_tap_point = <API key>; } else if (rec_mode == VOC_REC_DOWNLINK) { cvs_start_record.rec_mode.rx_tap_point = <API key>; cvs_start_record.rec_mode.tx_tap_point = <API key>; } else if (rec_mode == VOC_REC_BOTH) { cvs_start_record.rec_mode.rx_tap_point = <API key>; cvs_start_record.rec_mode.tx_tap_point = <API key>; } else { pr_err("%s: Invalid in-call rec_mode %d\n", __func__, rec_mode); ret = -EINVAL; goto fail; } v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_start_record); if (ret < 0) { pr_err("%s: Error %d sending START_RECORD\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } v->rec_info.recording = 1; } else { pr_debug("%s: Start record already sent\n", __func__); } return 0; fail: return ret; } static int <API key>(struct voice_data *v) { int ret = 0; void *apr_cvs; u16 cvs_handle; struct apr_hdr cvs_stop_record; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL.\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); if (v->rec_info.recording) { cvs_stop_record.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_stop_record.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_stop_record) - APR_HDR_SIZE); cvs_stop_record.src_port = <API key>(v->session_id); cvs_stop_record.dest_port = cvs_handle; cvs_stop_record.token = 0; cvs_stop_record.opcode = <API key>; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_stop_record); if (ret < 0) { pr_err("%s: Error %d sending STOP_RECORD\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } v->rec_info.recording = 0; } else { pr_debug("%s: Stop record already sent\n", __func__); } return 0; fail: return ret; } int voc_start_record(uint32_t port_id, uint32_t set) { int ret = 0; int rec_mode = 0; u16 cvs_handle; int i, rec_set = 0; for (i = 0; i < MAX_VOC_SESSIONS; i++) { struct voice_data *v = &common.voice[i]; pr_debug("%s: i:%d port_id: %d, set: %d\n", __func__, i, port_id, set); mutex_lock(&v->lock); rec_mode = v->rec_info.rec_mode; rec_set = set; if (set) { if ((v->rec_route_state.ul_flag != 0) && (v->rec_route_state.dl_flag != 0)) { pr_debug("%s: i=%d, rec mode already set.\n", __func__, i); mutex_unlock(&v->lock); if (i < MAX_VOC_SESSIONS) continue; else return 0; } if (port_id == VOICE_RECORD_TX) { if ((v->rec_route_state.ul_flag == 0) && (v->rec_route_state.dl_flag == 0)) { rec_mode = VOC_REC_UPLINK; v->rec_route_state.ul_flag = 1; } else if ((v->rec_route_state.ul_flag == 0) && (v->rec_route_state.dl_flag != 0)) { <API key>(v); rec_mode = VOC_REC_BOTH; v->rec_route_state.ul_flag = 1; } } else if (port_id == VOICE_RECORD_RX) { if ((v->rec_route_state.ul_flag == 0) && (v->rec_route_state.dl_flag == 0)) { rec_mode = VOC_REC_DOWNLINK; v->rec_route_state.dl_flag = 1; } else if ((v->rec_route_state.ul_flag != 0) && (v->rec_route_state.dl_flag == 0)) { <API key>(v); rec_mode = VOC_REC_BOTH; v->rec_route_state.dl_flag = 1; } } rec_set = 1; } else { if ((v->rec_route_state.ul_flag == 0) && (v->rec_route_state.dl_flag == 0)) { pr_debug("%s: i=%d, rec already stops.\n", __func__, i); mutex_unlock(&v->lock); if (i < MAX_VOC_SESSIONS) continue; else return 0; } if (port_id == VOICE_RECORD_TX) { if ((v->rec_route_state.ul_flag != 0) && (v->rec_route_state.dl_flag == 0)) { v->rec_route_state.ul_flag = 0; rec_set = 0; } else if ((v->rec_route_state.ul_flag != 0) && (v->rec_route_state.dl_flag != 0)) { <API key>(v); v->rec_route_state.ul_flag = 0; rec_mode = VOC_REC_DOWNLINK; rec_set = 1; } } else if (port_id == VOICE_RECORD_RX) { if ((v->rec_route_state.ul_flag == 0) && (v->rec_route_state.dl_flag != 0)) { v->rec_route_state.dl_flag = 0; rec_set = 0; } else if ((v->rec_route_state.ul_flag != 0) && (v->rec_route_state.dl_flag != 0)) { <API key>(v); v->rec_route_state.dl_flag = 0; rec_mode = VOC_REC_UPLINK; rec_set = 1; } } } pr_debug("%s: i=%d, mode =%d, set =%d\n", __func__, i, rec_mode, rec_set); cvs_handle = <API key>(v); if (cvs_handle != 0) { if (rec_set) ret = <API key>(v, rec_mode); else ret = <API key>(v); } /* Cache the value */ v->rec_info.rec_enable = rec_set; v->rec_info.rec_mode = rec_mode; mutex_unlock(&v->lock); } return ret; } static int <API key>(struct voice_data *v) { int ret = 0; struct <API key> cvs_start_playback; void *apr_cvs; u16 cvs_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL.\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); if (!v->music_info.playing && v->music_info.count) { cvs_start_playback.hdr.hdr_field = APR_HDR_FIELD( <API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_start_playback.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_start_playback) - APR_HDR_SIZE); cvs_start_playback.hdr.src_port = <API key>(v->session_id); cvs_start_playback.hdr.dest_port = cvs_handle; cvs_start_playback.hdr.token = 0; cvs_start_playback.hdr.opcode = <API key>; cvs_start_playback.playback_mode.port_id = <API key>; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_start_playback); if (ret < 0) { pr_err("%s: Error %d sending START_PLAYBACK\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } v->music_info.playing = 1; } else { pr_debug("%s: Start playback already sent\n", __func__); } return 0; fail: return ret; } static int <API key>(struct voice_data *v) { int ret = 0; struct apr_hdr cvs_stop_playback; void *apr_cvs; u16 cvs_handle; if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL.\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); if (v->music_info.playing && ((!v->music_info.count) || (v->music_info.force))) { cvs_stop_playback.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); cvs_stop_playback.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(cvs_stop_playback) - APR_HDR_SIZE); cvs_stop_playback.src_port = <API key>(v->session_id); cvs_stop_playback.dest_port = cvs_handle; cvs_stop_playback.token = 0; cvs_stop_playback.opcode = <API key>; v->cvs_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_cvs, (uint32_t *) &cvs_stop_playback); if (ret < 0) { pr_err("%s: Error %d sending STOP_PLAYBACK\n", __func__, ret); goto fail; } ret = wait_event_timeout(v->cvs_wait, (v->cvs_state == CMD_STATUS_SUCCESS), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { pr_err("%s: wait_event timeout\n", __func__); goto fail; } v->music_info.playing = 0; v->music_info.force = 0; } else { pr_debug("%s: Stop playback already sent\n", __func__); } return 0; fail: return ret; } int voc_start_playback(uint32_t set) { int ret = 0; u16 cvs_handle; int i; for (i = 0; i < MAX_VOC_SESSIONS; i++) { struct voice_data *v = &common.voice[i]; mutex_lock(&v->lock); v->music_info.play_enable = set; if (set) v->music_info.count++; else v->music_info.count pr_debug("%s: music_info count =%d\n", __func__, v->music_info.count); cvs_handle = <API key>(v); if (cvs_handle != 0) { if (set) ret = <API key>(v); else ret = <API key>(v); } mutex_unlock(&v->lock); } return ret; } int voc_disable_cvp(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); if (v->voc_state == VOC_RUN) { rtac_remove_voice(<API key>(v)); /* send cmd to dsp to disable vocproc */ ret = <API key>(v); if (ret < 0) { pr_err("%s: disable vocproc failed\n", __func__); goto fail; } <API key>(v); <API key>(v); <API key>(v); v->voc_state = VOC_CHANGE; } fail: mutex_unlock(&v->lock); return ret; } int voc_enable_cvp(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: Invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); if (v->voc_state == VOC_CHANGE) { ret = <API key>(v); if (ret < 0) { pr_err("%s: Set device failed\n", __func__); goto fail; } <API key>(v); <API key>(v); <API key>(v); if (v->lch_mode == VOICE_LCH_START) { pr_debug("%s: TX and RX mute ON\n", __func__); <API key>(v, <API key>, VSS_IVOLUME_MUTE_ON); <API key>(v, <API key>, VSS_IVOLUME_MUTE_ON); } else if (v->lch_mode == VOICE_LCH_STOP) { pr_debug("%s: TX and RX mute OFF\n", __func__); <API key>(v, <API key>, <API key>); <API key>(v, <API key>, <API key>); /* Reset lch mode when VOICE_LCH_STOP is recieved */ v->lch_mode = 0; } else { pr_debug("%s: Mute commands not sent for lch_mode=%d\n", __func__, v->lch_mode); } ret = <API key>(v); if (ret < 0) { pr_err("%s: Enable vocproc failed %d\n", __func__, ret); goto fail; } /* Send tty mode if tty device is used */ <API key>(v); /* enable slowtalk */ if (v->st_enable) <API key>(v, <API key>, v->st_enable); rtac_add_voice(<API key>(v), <API key>(v), v->dev_rx.port_id, v->dev_tx.port_id, v->session_id); v->voc_state = VOC_RUN; } fail: mutex_unlock(&v->lock); return ret; } static int <API key>(uint32_t session_id, uint32_t mode) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } if (v->voc_state != VOC_RUN) ret = <API key>(v); if (ret) { pr_err("%s: Error <API key> %d\n", __func__, ret); goto fail; } ret = <API key>(v); if (ret) { pr_err("%s: Error: <API key> %d\n", __func__, ret); goto fail; } return ret; fail: return -EINVAL; } int voc_set_tx_mute(uint32_t session_id, uint32_t dir, uint32_t mute) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); v->stream_tx.stream_mute = mute; if ((v->voc_state == VOC_RUN) || (v->voc_state == VOC_CHANGE) || (v->voc_state == VOC_STANDBY)) ret = <API key>(v); mutex_unlock(&v->lock); return ret; } int <API key>(uint32_t session_id, uint32_t mute) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); v->dev_rx.dev_mute = mute; if (v->voc_state == VOC_RUN) ret = <API key>(v, <API key>, v->dev_rx.dev_mute); mutex_unlock(&v->lock); return ret; } int <API key>(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); ret = v->dev_rx.dev_mute; mutex_unlock(&v->lock); return ret; } int voc_set_tty_mode(uint32_t session_id, uint8_t tty_mode) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); v->tty_mode = tty_mode; mutex_unlock(&v->lock); return ret; } uint8_t voc_get_tty_mode(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); ret = v->tty_mode; mutex_unlock(&v->lock); return ret; } int voc_set_pp_enable(uint32_t session_id, uint32_t module_id, uint32_t enable) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); if (module_id == <API key>) v->st_enable = enable; if (v->voc_state == VOC_RUN) { if (module_id == <API key>) ret = <API key>(v, <API key>, enable); } mutex_unlock(&v->lock); return ret; } int voc_get_pp_enable(uint32_t session_id, uint32_t module_id) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); if (module_id == <API key>) ret = v->st_enable; mutex_unlock(&v->lock); return ret; } int <API key>(uint32_t session_id, uint32_t dir, uint32_t vol_idx) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); v->dev_rx.volume = vol_idx; if ((v->voc_state == VOC_RUN) || (v->voc_state == VOC_CHANGE) || (v->voc_state == VOC_STANDBY)) ret = <API key>(v); mutex_unlock(&v->lock); return ret; } int voc_set_rxtx_port(uint32_t session_id, uint32_t port_id, uint32_t dev_type) { struct voice_data *v = voice_get_session(session_id); if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } pr_debug("%s: port_id=%d, type=%d\n", __func__, port_id, dev_type); mutex_lock(&v->lock); if (dev_type == DEV_RX) v->dev_rx.port_id = q6audio_get_port_id(port_id); else v->dev_tx.port_id = q6audio_get_port_id(port_id); mutex_unlock(&v->lock); return 0; } int voc_set_route_flag(uint32_t session_id, uint8_t path_dir, uint8_t set) { struct voice_data *v = voice_get_session(session_id); if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } pr_debug("%s: path_dir=%d, set=%d\n", __func__, path_dir, set); mutex_lock(&v->lock); if (path_dir == RX_PATH) v->voc_route_state.rx_route_flag = set; else v->voc_route_state.tx_route_flag = set; mutex_unlock(&v->lock); return 0; } uint8_t voc_get_route_flag(uint32_t session_id, uint8_t path_dir) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return 0; } mutex_lock(&v->lock); if (path_dir == RX_PATH) ret = v->voc_route_state.rx_route_flag; else ret = v->voc_route_state.tx_route_flag; mutex_unlock(&v->lock); return ret; } int voc_end_voice_call(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); if (v->voc_state == VOC_RUN || v->voc_state == VOC_ERROR || v->voc_state == VOC_CHANGE || v->voc_state == VOC_STANDBY) { pr_debug("%s: VOC_STATE: %d\n", __func__, v->voc_state); ret = <API key>(v); if (ret < 0) pr_err("%s: destroy voice failed\n", __func__); <API key>(v); v->voc_state = VOC_RELEASE; } else { pr_err("%s: Error: End voice called in state %d\n", __func__, v->voc_state); ret = -EINVAL; } mutex_unlock(&v->lock); return ret; } int <API key>(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); struct apr_hdr <API key>; void *apr_mvm; u16 mvm_handle; int ret = 0; pr_debug("%s: voc state=%d", __func__, v->voc_state); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } if (v->voc_state == VOC_RUN) { apr_mvm = common.apr_q6_mvm; if (!apr_mvm) { pr_err("%s: apr_mvm is NULL.\n", __func__); ret = -EINVAL; goto fail; } mvm_handle = <API key>(v); <API key>.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); <API key>.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(<API key>) - APR_HDR_SIZE); pr_debug("send <API key> pkt size = %d\n", <API key>.pkt_size); <API key>.src_port = <API key>(v->session_id); <API key>.dest_port = mvm_handle; <API key>.token = 0; <API key>.opcode = <API key>; v->mvm_state = CMD_STATUS_FAIL; ret = apr_send_pkt(apr_mvm, (uint32_t *)&<API key>); if (ret < 0) { pr_err("Fail in sending <API key>\n"); ret = -EINVAL; goto fail; } v->voc_state = VOC_STANDBY; } fail: return ret; } int voc_set_lch(uint32_t session_id, enum voice_lch_mode lch_mode) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: Invalid session_id 0x%x\n", __func__, session_id); ret = -EINVAL; goto done; } mutex_lock(&v->lock); if (v->lch_mode == lch_mode) { pr_debug("%s: Session %d already in LCH mode %d\n", __func__, session_id, lch_mode); mutex_unlock(&v->lock); goto done; } v->lch_mode = lch_mode; mutex_unlock(&v->lock); ret = voc_disable_cvp(session_id); if (ret < 0) { pr_err("%s: voc_disable_cvp failed ret=%d\n", __func__, ret); goto done; } /* Mute and topology_none will be set as part of voc_enable_cvp() */ ret = voc_enable_cvp(session_id); if (ret < 0) { pr_err("%s: voc_enable_cvp failed ret=%d\n", __func__, ret); goto done; } done: return ret; } int <API key>(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); int ret = 0; ret = <API key>(v); if (ret < 0) { pr_err("Fail in sending START_VOICE\n"); goto fail; } v->voc_state = VOC_RUN; return 0; fail: return -EINVAL; } int <API key>(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); int ret = 0; if (v == NULL) { pr_err("%s: invalid session_id 0x%x\n", __func__, session_id); return -EINVAL; } mutex_lock(&v->lock); if (v->voc_state == VOC_ERROR) { pr_debug("%s: VOC in ERR state\n", __func__); <API key>(v); v->voc_state = VOC_INIT; } if ((v->voc_state == VOC_INIT) || (v->voc_state == VOC_RELEASE)) { ret = voice_apr_register(); if (ret < 0) { pr_err("%s: apr register failed\n", __func__); goto fail; } ret = <API key>(v); if (ret < 0) { pr_err("create mvm and cvs failed\n"); goto fail; } /* Memory map the calibration memory block. */ ret = <API key>(v); if (ret < 0) { pr_err("%s: Memory map of cal block failed %d\n", __func__, ret); /* Allow call to continue, call quality will be bad. */ } if (is_voip_session(session_id)) { ret = <API key>(v, &v->shmem_info.memtbl, v->shmem_info.sh_buf.buf[0].phys, v->shmem_info.sh_buf.buf[0].size * NUM_OF_BUFFERS, VOIP_MEM_MAP_TOKEN); if (ret) { pr_err("%s: mvm_map_memory_phy failed %d\n", __func__, ret); goto fail; } ret = <API key>( session_id, <API key>); if (ret) { pr_err("%s: Err: <API key> %d\n", __func__, ret); goto fail; } } ret = <API key>(v); if (ret < 0) { pr_err("Err Dual command failed\n"); goto fail; } ret = voice_setup_vocproc(v); if (ret < 0) { pr_err("setup voice failed\n"); goto fail; } ret = <API key>(v); if (ret < 0) pr_err("voice volume failed\n"); ret = <API key>(v); if (ret < 0) pr_err("voice mute failed\n"); ret = <API key>(v); if (ret < 0) { pr_err("start voice failed\n"); goto fail; } v->voc_state = VOC_RUN; } else { pr_err("%s: Error: Start voice called in state %d\n", __func__, v->voc_state); ret = -EINVAL; goto fail; } fail: mutex_unlock(&v->lock); return ret; } void voc_register_mvs_cb(ul_cb_fn ul_cb, dl_cb_fn dl_cb, void *private_data) { common.mvs_info.ul_cb = ul_cb; common.mvs_info.dl_cb = dl_cb; common.mvs_info.private_data = private_data; } void <API key>(dtmf_rx_det_cb_fn dtmf_rx_ul_cb, void *private_data) { common.dtmf_info.dtmf_rx_ul_cb = dtmf_rx_ul_cb; common.dtmf_info.private_data = private_data; } void voc_config_vocoder(uint32_t media_type, uint32_t rate, uint32_t network_type, uint32_t dtx_mode) { common.mvs_info.media_type = media_type; common.mvs_info.rate = rate; common.mvs_info.network_type = network_type; common.mvs_info.dtx_mode = dtx_mode; } static int32_t qdsp_mvm_callback(struct apr_client_data *data, void *priv) { uint32_t *ptr = NULL; struct common_data *c = NULL; struct voice_data *v = NULL; int i = 0; if ((data == NULL) || (priv == NULL)) { pr_err("%s: data or priv is NULL\n", __func__); return -EINVAL; } c = priv; pr_debug("%s: Payload Length = %d, opcode=%x\n", __func__, data->payload_size, data->opcode); if (data->opcode == RESET_EVENTS) { if (data->reset_proc == APR_DEST_MODEM) { pr_debug("%s: Received MODEM reset event\n", __func__); } else { pr_debug("%s: Reset event received in Voice service\n", __func__); apr_reset(c->apr_q6_mvm); c->apr_q6_mvm = NULL; /* clean up memory handle */ c->cal_mem_handle = 0; /* Sub-system restart is applicable to all sessions. */ for (i = 0; i < MAX_VOC_SESSIONS; i++) { c->voice[i].mvm_handle = 0; c->voice[i].shmem_info.mem_handle = 0; } } voc_set_error_state(data->reset_proc); return 0; } pr_debug("%s: session_id 0x%x\n", __func__, data->dest_port); v = <API key>(data->dest_port); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } if (data->opcode == <API key>) { if (data->payload_size) { ptr = data->payload; pr_debug("%x %x\n", ptr[0], ptr[1]); /* ping mvm service ACK */ switch (ptr[0]) { case <API key>: case <API key>: /* Passive session is used for CS call * Full session is used for VoIP call. */ pr_debug("%s: cmd = 0x%x\n", __func__, ptr[0]); if (!ptr[1]) { pr_debug("%s: MVM handle is %d\n", __func__, data->src_port); <API key>(v, data->src_port); } else pr_err("got NACK for sending MVM create session\n"); v->mvm_state = CMD_STATUS_SUCCESS; wake_up(&v->mvm_wait); break; case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: pr_debug("%s: cmd = 0x%x\n", __func__, ptr[0]); v->mvm_state = CMD_STATUS_SUCCESS; wake_up(&v->mvm_wait); break; default: pr_debug("%s: not match cmd = 0x%x\n", __func__, ptr[0]); break; } } } else if (data->opcode == VSS_IMEMORY_RSP_MAP) { pr_debug("%s, Revd VSS_IMEMORY_RSP_MAP response\n", __func__); if (data->payload_size && data-><API key>) { ptr = data->payload; if (ptr[0]) { v->shmem_info.mem_handle = ptr[0]; pr_debug("%s: shared mem_handle: 0x[%x]\n", __func__, v->shmem_info.mem_handle); v->mvm_state = CMD_STATUS_SUCCESS; wake_up(&v->mvm_wait); } } else if (data->payload_size && data-><API key>) { ptr = data->payload; if (ptr[0]) { c->cal_mem_handle = ptr[0]; pr_debug("%s: cal mem handle 0x%x\n", __func__, c->cal_mem_handle); v->mvm_state = CMD_STATUS_SUCCESS; wake_up(&v->mvm_wait); } } else { pr_err("%s: Unknown mem map token %d\n", __func__, data->token); } } return 0; } static int32_t qdsp_cvs_callback(struct apr_client_data *data, void *priv) { uint32_t *ptr = NULL; struct common_data *c = NULL; struct voice_data *v = NULL; int i = 0; if ((data == NULL) || (priv == NULL)) { pr_err("%s: data or priv is NULL\n", __func__); return -EINVAL; } c = priv; pr_debug("%s: session_id 0x%x\n", __func__, data->dest_port); pr_debug("%s: Payload Length = %d, opcode=%x\n", __func__, data->payload_size, data->opcode); if (data->opcode == RESET_EVENTS) { if (data->reset_proc == APR_DEST_MODEM) { pr_debug("%s: Received Modem reset event\n", __func__); } else { pr_debug("%s: Reset event received in Voice service\n", __func__); apr_reset(c->apr_q6_cvs); c->apr_q6_cvs = NULL; /* Sub-system restart is applicable to all sessions. */ for (i = 0; i < MAX_VOC_SESSIONS; i++) c->voice[i].cvs_handle = 0; } voc_set_error_state(data->reset_proc); return 0; } v = <API key>(data->dest_port); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } if (data->opcode == <API key>) { if (data->payload_size) { ptr = data->payload; pr_debug("%x %x\n", ptr[0], ptr[1]); if (ptr[1] != 0) { pr_err("%s: cmd = 0x%x returned error = 0x%x\n", __func__, ptr[0], ptr[1]); } /*response from CVS */ switch (ptr[0]) { case <API key>: case <API key>: if (!ptr[1]) { pr_debug("%s: CVS handle is %d\n", __func__, data->src_port); <API key>(v, data->src_port); } else pr_err("got NACK for sending CVS create session\n"); v->cvs_state = CMD_STATUS_SUCCESS; wake_up(&v->cvs_wait); break; case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: pr_debug("%s: cmd = 0x%x\n", __func__, ptr[0]); v->cvs_state = CMD_STATUS_SUCCESS; wake_up(&v->cvs_wait); break; case VOICE_CMD_SET_PARAM: pr_debug("%s: VOICE_CMD_SET_PARAM\n", __func__); <API key>(RTAC_CVS, ptr, data->payload_size); break; case VOICE_CMD_GET_PARAM: pr_debug("%s: VOICE_CMD_GET_PARAM\n", __func__); /* Should only come here if there is an APR */ /* error or malformed APR packet. Otherwise */ /* response will be returned as */ /* <API key> */ if (ptr[1] != 0) { pr_err("%s: CVP get param error = %d, resuming\n", __func__, ptr[1]); <API key>(RTAC_CVP, data->payload, data->payload_size); } break; default: pr_debug("%s: cmd = 0x%x\n", __func__, ptr[0]); break; } } } else if (data->opcode == <API key>) { int ret = 0; u16 cvs_handle; uint32_t *cvs_voc_pkt; struct <API key> <API key>; void *apr_cvs; pr_debug("Encoder buffer is ready\n"); apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); <API key>.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); <API key>.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(<API key>) - APR_HDR_SIZE); <API key>.hdr.src_port = <API key>(v->session_id); <API key>.hdr.dest_port = cvs_handle; <API key>.hdr.token = 0; <API key>.hdr.opcode = <API key>; cvs_voc_pkt = v->shmem_info.sh_buf.buf[1].data; if (cvs_voc_pkt != NULL && common.mvs_info.ul_cb != NULL) { common.mvs_info.ul_cb((uint8_t *)&cvs_voc_pkt[3], cvs_voc_pkt[2], common.mvs_info.private_data); } else pr_err("%s: cvs_voc_pkt or ul_cb is NULL\n", __func__); ret = apr_send_pkt(apr_cvs, (uint32_t *) &<API key>); if (ret < 0) { pr_err("%s: Err send <API key> %d\n", __func__, ret); goto fail; } } else if (data->opcode == <API key>) { pr_debug("Recd <API key>\n"); } else if (data->opcode == <API key>) { int ret = 0; u16 cvs_handle; uint32_t *cvs_voc_pkt; struct <API key> send_dec_buf; void *apr_cvs; apr_cvs = common.apr_q6_cvs; if (!apr_cvs) { pr_err("%s: apr_cvs is NULL\n", __func__); return -EINVAL; } cvs_handle = <API key>(v); send_dec_buf.hdr.hdr_field = APR_HDR_FIELD(<API key>, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); send_dec_buf.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(send_dec_buf) - APR_HDR_SIZE); send_dec_buf.hdr.src_port = <API key>(v->session_id); send_dec_buf.hdr.dest_port = cvs_handle; send_dec_buf.hdr.token = 0; send_dec_buf.hdr.opcode = <API key>; cvs_voc_pkt = (uint32_t *)(v->shmem_info.sh_buf.buf[0].data); if (cvs_voc_pkt != NULL && common.mvs_info.dl_cb != NULL) { /* Set timestamp to 0 and advance the pointer */ cvs_voc_pkt[0] = 0; /* Set media_type and advance the pointer */ cvs_voc_pkt[1] = common.mvs_info.media_type; common.mvs_info.dl_cb( (uint8_t *)&cvs_voc_pkt[2], common.mvs_info.private_data); ret = apr_send_pkt(apr_cvs, (uint32_t *) &send_dec_buf); if (ret < 0) { pr_err("%s: Err send <API key> %d\n", __func__, ret); goto fail; } } else { pr_debug("%s: voc_pkt or dl_cb is NULL\n", __func__); goto fail; } } else if (data->opcode == <API key>) { pr_debug("Recd <API key>\n"); } else if (data->opcode == <API key>) { pr_debug("Send dec buf resp\n"); } else if (data->opcode == APR_RSP_ACCEPTED) { ptr = data->payload; if (ptr[0]) pr_debug("%s: APR_RSP_ACCEPTED for 0x%x:\n", __func__, ptr[0]); } else if (data->opcode == <API key>) { pr_debug("Recd <API key>\n"); } else if (data->opcode == <API key>) { pr_debug("Recd <API key>\n"); } else if (data->opcode == <API key>) { pr_debug("%s: <API key>\n", __func__); ptr = data->payload; if (ptr[0] != 0) { pr_err("%s: <API key> returned error = 0x%x\n", __func__, ptr[0]); } <API key>(RTAC_CVS, data->payload, data->payload_size); } else if (data->opcode == <API key>) { struct <API key> *dtmf_rx_detected; uint32_t *voc_pkt = data->payload; uint32_t pkt_len = data->payload_size; if ((voc_pkt != NULL) && (pkt_len == sizeof(struct <API key>))) { dtmf_rx_detected = (struct <API key> *) voc_pkt; pr_debug("RX_DTMF_DETECTED low_freq=%d high_freq=%d\n", dtmf_rx_detected->low_freq, dtmf_rx_detected->high_freq); if (c->dtmf_info.dtmf_rx_ul_cb) c->dtmf_info.dtmf_rx_ul_cb((uint8_t *)voc_pkt, <API key>(v->session_id), c->dtmf_info.private_data); } else { pr_err("Invalid packet\n"); } } else pr_debug("Unknown opcode 0x%x\n", data->opcode); fail: return 0; } static int32_t qdsp_cvp_callback(struct apr_client_data *data, void *priv) { uint32_t *ptr = NULL; struct common_data *c = NULL; struct voice_data *v = NULL; int i = 0; if ((data == NULL) || (priv == NULL)) { pr_err("%s: data or priv is NULL\n", __func__); return -EINVAL; } c = priv; if (data->opcode == RESET_EVENTS) { if (data->reset_proc == APR_DEST_MODEM) { pr_debug("%s: Received Modem reset event\n", __func__); } else { pr_debug("%s: Reset event received in Voice service\n", __func__); apr_reset(c->apr_q6_cvp); c->apr_q6_cvp = NULL; /* Sub-system restart is applicable to all sessions. */ for (i = 0; i < MAX_VOC_SESSIONS; i++) c->voice[i].cvp_handle = 0; } voc_set_error_state(data->reset_proc); return 0; } v = <API key>(data->dest_port); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } if (data->opcode == <API key>) { if (data->payload_size) { ptr = data->payload; pr_debug("%x %x\n", ptr[0], ptr[1]); if (ptr[1] != 0) { pr_err("%s: cmd = 0x%x returned error = 0x%x\n", __func__, ptr[0], ptr[1]); } switch (ptr[0]) { case <API key>: /*response from CVP */ pr_debug("%s: cmd = 0x%x\n", __func__, ptr[0]); if (!ptr[1]) { <API key>(v, data->src_port); pr_debug("status: %d, cvphdl=%d\n", ptr[1], data->src_port); } else pr_err("got NACK from CVP create session response\n"); v->cvp_state = CMD_STATUS_SUCCESS; wake_up(&v->cvp_wait); break; case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: v->cvp_state = CMD_STATUS_SUCCESS; wake_up(&v->cvp_wait); break; case VOICE_CMD_SET_PARAM: pr_debug("%s: VOICE_CMD_SET_PARAM\n", __func__); <API key>(RTAC_CVP, ptr, data->payload_size); break; case VOICE_CMD_GET_PARAM: pr_debug("%s: VOICE_CMD_GET_PARAM\n", __func__); /* Should only come here if there is an APR */ /* error or malformed APR packet. Otherwise */ /* response will be returned as */ /* <API key> */ if (ptr[1] != 0) { pr_err("%s: CVP get param error = %d, resuming\n", __func__, ptr[1]); <API key>(RTAC_CVP, data->payload, data->payload_size); } break; default: pr_debug("%s: not match cmd = 0x%x\n", __func__, ptr[0]); break; } } } else if (data->opcode == <API key>) { pr_debug("%s: <API key>\n", __func__); ptr = data->payload; if (ptr[0] != 0) { pr_err("%s: <API key> returned error = 0x%x\n", __func__, ptr[0]); } <API key>(RTAC_CVP, data->payload, data->payload_size); } return 0; } static int <API key>(void) { int cnt = 0; int rc = 0; int len; void *mem_addr; dma_addr_t phys; int bufsz = BUFFER_BLOCK_SIZE; int bufcnt = NUM_OF_BUFFERS; struct voice_data *v = voice_get_session( common.voice[VOC_PATH_FULL].session_id); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } rc = msm_audio_ion_alloc("voip_client", &(v->shmem_info.sh_buf.client), &(v->shmem_info.sh_buf.handle), bufsz*bufcnt, (ion_phys_addr_t *)&phys, (size_t *)&len, &mem_addr); if (rc) { pr_err("%s: audio ION alloc failed, rc = %d\n", __func__, rc); return -EINVAL; } while (cnt < bufcnt) { v->shmem_info.sh_buf.buf[cnt].data = mem_addr + (cnt * bufsz); v->shmem_info.sh_buf.buf[cnt].phys = phys + (cnt * bufsz); v->shmem_info.sh_buf.buf[cnt].size = bufsz; cnt++; } pr_debug("%s buf[0].data:[%p], buf[0].phys:[%p], &buf[0].phys:[%p],\n", __func__, (void *)v->shmem_info.sh_buf.buf[0].data, (void *)v->shmem_info.sh_buf.buf[0].phys, (void *)&v->shmem_info.sh_buf.buf[0].phys); pr_debug("%s: buf[1].data:[%p], buf[1].phys[%p], &buf[1].phys[%p]\n", __func__, (void *)v->shmem_info.sh_buf.buf[1].data, (void *)v->shmem_info.sh_buf.buf[1].phys, (void *)&v->shmem_info.sh_buf.buf[1].phys); memset((void *)v->shmem_info.sh_buf.buf[0].data, 0, (bufsz * bufcnt)); return 0; } static int <API key>(void) { int rc = 0; int len; struct voice_data *v = voice_get_session( common.voice[VOC_PATH_FULL].session_id); if (v == NULL) { pr_err("%s: v is NULL\n", __func__); return -EINVAL; } rc = msm_audio_ion_alloc("voip_client", &(v->shmem_info.memtbl.client), &(v->shmem_info.memtbl.handle), sizeof(struct vss_imemory_table_t), (ion_phys_addr_t *)&v->shmem_info.memtbl.phys, (size_t *)&len, &(v->shmem_info.memtbl.data)); if (rc) { pr_err("%s: audio ION alloc failed, rc = %d\n", __func__, rc); return -EINVAL; } v->shmem_info.memtbl.size = sizeof(struct vss_imemory_table_t); pr_debug("%s data[%p]phys[%p][%p]\n", __func__, (void *)v->shmem_info.memtbl.data, (void *)v->shmem_info.memtbl.phys, (void *)&v->shmem_info.memtbl.phys); return 0; } static int <API key>(void) { int ret = 0; int len; ret = msm_audio_ion_alloc("voip_client", &(common.cal_mem_map_table.client), &(common.cal_mem_map_table.handle), sizeof(struct vss_imemory_table_t), (ion_phys_addr_t *)&common.cal_mem_map_table.phys, (size_t *) &len, &(common.cal_mem_map_table.data)); if (ret) { pr_err("%s: audio ION alloc failed, rc = %d\n", __func__, ret); return -EINVAL; } common.cal_mem_map_table.size = sizeof(struct vss_imemory_table_t); pr_debug("%s: data 0x%x phys 0x%x\n", __func__, (unsigned int) common.cal_mem_map_table.data, common.cal_mem_map_table.phys); return 0; } static int __init voice_init(void) { int rc = 0, i = 0; memset(&common, 0, sizeof(struct common_data)); /* set default value */ common.default_mute_val = 0; /* default is un-mute */ common.default_vol_val = 0; common.default_sample_val = 8000; /* Initialize MVS info. */ common.mvs_info.network_type = <API key>; mutex_init(&common.common_lock); /* Initialize session id with vsid */ init_session_id(); for (i = 0; i < MAX_VOC_SESSIONS; i++) { /* initialize dev_rx and dev_tx */ common.voice[i].dev_rx.volume = common.default_vol_val; common.voice[i].dev_rx.dev_mute = common.default_mute_val; common.voice[i].dev_tx.dev_mute = common.default_mute_val; common.voice[i].stream_rx.stream_mute = common.default_mute_val; common.voice[i].stream_tx.stream_mute = common.default_mute_val; common.voice[i].dev_tx.port_id = 0x100B; common.voice[i].dev_rx.port_id = 0x100A; common.voice[i].sidetone_gain = 0x512; common.voice[i].dtmf_rx_detect_en = 0; common.voice[i].lch_mode = 0; common.voice[i].voc_state = VOC_INIT; init_waitqueue_head(&common.voice[i].mvm_wait); init_waitqueue_head(&common.voice[i].cvs_wait); init_waitqueue_head(&common.voice[i].cvp_wait); mutex_init(&common.voice[i].lock); } /* Allocate shared memory for OOB Voip */ rc = <API key>(); if (rc < 0) pr_err("failed to alloc shared memory for OOB %d\n", rc); else { /* Allocate mem map table for OOB */ rc = <API key>(); if (rc < 0) pr_err("failed to alloc mem map talbe %d\n", rc); } /* Allocate memory for calibration memory map table. */ rc = <API key>(); return rc; } late_initcall(voice_init);
#include "sis_context.h" #include "sis_state.h" #include "sis_tris.h" #include "sis_lock.h" #include "sis_tex.h" #include "sis_reg.h" #include "context.h" #include "enums.h" #include "colormac.h" #include "swrast/swrast.h" #include "vbo/vbo.h" #include "tnl/tnl.h" #include "swrast_setup/swrast_setup.h" #include "tnl/t_pipeline.h" static void sis6326DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLubyte refbyte; __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; <API key>(refbyte, ref); current->hwAlpha = refbyte << 16; /* Alpha Test function */ switch (func) { case GL_NEVER: current->hwAlpha |= S_ASET_PASS_NEVER; break; case GL_LESS: current->hwAlpha |= S_ASET_PASS_LESS; break; case GL_EQUAL: current->hwAlpha |= S_ASET_PASS_EQUAL; break; case GL_LEQUAL: current->hwAlpha |= S_ASET_PASS_LEQUAL; break; case GL_GREATER: current->hwAlpha |= S_ASET_PASS_GREATER; break; case GL_NOTEQUAL: current->hwAlpha |= <API key>; break; case GL_GEQUAL: current->hwAlpha |= S_ASET_PASS_GEQUAL; break; case GL_ALWAYS: current->hwAlpha |= S_ASET_PASS_ALWAYS; break; } prev->hwAlpha = current->hwAlpha; smesa->GlobalFlag |= GFLAG_ALPHASETTING; } static void <API key>( GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; current->hwDstSrcBlend = 0; switch (dfactorRGB) { case GL_ZERO: current->hwDstSrcBlend |= S_DBLEND_ZERO; break; case GL_ONE: current->hwDstSrcBlend |= S_DBLEND_ONE; break; case GL_SRC_COLOR: current->hwDstSrcBlend |= S_DBLEND_SRC_COLOR; break; case <API key>: current->hwDstSrcBlend |= <API key>; break; case GL_SRC_ALPHA: current->hwDstSrcBlend |= S_DBLEND_SRC_ALPHA; break; case <API key>: current->hwDstSrcBlend |= <API key>; break; case GL_DST_ALPHA: current->hwDstSrcBlend |= S_DBLEND_DST_ALPHA; break; case <API key>: current->hwDstSrcBlend |= <API key>; break; } switch (sfactorRGB) { case GL_ZERO: current->hwDstSrcBlend |= S_SBLEND_ZERO; break; case GL_ONE: current->hwDstSrcBlend |= S_SBLEND_ONE; break; case GL_SRC_ALPHA: current->hwDstSrcBlend |= S_SBLEND_SRC_ALPHA; break; case <API key>: current->hwDstSrcBlend |= <API key>; break; case GL_DST_ALPHA: current->hwDstSrcBlend |= S_SBLEND_DST_ALPHA; break; case <API key>: current->hwDstSrcBlend |= <API key>; break; case GL_DST_COLOR: current->hwDstSrcBlend |= S_SBLEND_DST_COLOR; break; case <API key>: current->hwDstSrcBlend |= <API key>; break; case <API key>: current->hwDstSrcBlend |= <API key>; break; } if (current->hwDstSrcBlend != prev->hwDstSrcBlend) { prev->hwDstSrcBlend = current->hwDstSrcBlend; smesa->GlobalFlag |= GFLAG_DSTBLEND; } } static void sis6326DDDepthFunc( GLcontext *ctx, GLenum func ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; current->hwZ &= ~MASK_6326_ZTestMode; switch (func) { case GL_LESS: current->hwZ |= S_ZSET_PASS_LESS; break; case GL_GEQUAL: current->hwZ |= S_ZSET_PASS_GEQUAL; break; case GL_LEQUAL: current->hwZ |= S_ZSET_PASS_LEQUAL; break; case GL_GREATER: current->hwZ |= S_ZSET_PASS_GREATER; break; case GL_NOTEQUAL: current->hwZ |= <API key>; break; case GL_EQUAL: current->hwZ |= S_ZSET_PASS_EQUAL; break; case GL_ALWAYS: current->hwZ |= S_ZSET_PASS_ALWAYS; break; case GL_NEVER: current->hwZ |= S_ZSET_PASS_NEVER; break; } if (current->hwZ != prev->hwZ) { prev->hwZ = current->hwZ; smesa->GlobalFlag |= GFLAG_ZSETTING; } } static void sis6326DDDepthMask( GLcontext *ctx, GLboolean flag ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; if (ctx->Depth.Test) current->hwCapEnable |= S_ENABLE_ZWrite; else current->hwCapEnable &= ~S_ENABLE_ZWrite; } static void sis6326DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; __GLSiSHardware *prev = &smesa->prev; GLint fogColor; switch(pname) { case GL_FOG_COLOR: fogColor = FLOAT_TO_UBYTE( ctx->Fog.Color[0] ) << 16; fogColor |= FLOAT_TO_UBYTE( ctx->Fog.Color[1] ) << 8; fogColor |= FLOAT_TO_UBYTE( ctx->Fog.Color[2] ); current->hwFog = 0x01000000 | fogColor; if (current->hwFog != prev->hwFog) { prev->hwFog = current->hwFog; smesa->GlobalFlag |= GFLAG_FOGSETTING; } break; } } void <API key>(GLcontext *ctx) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; GLint x1, y1, x2, y2; x1 = 0; y1 = 0; x2 = smesa->width - 1; y2 = smesa->height - 1; if (ctx->Scissor.Enabled) { if (ctx->Scissor.X > x1) x1 = ctx->Scissor.X; if (ctx->Scissor.Y > y1) y1 = ctx->Scissor.Y; if (ctx->Scissor.X + ctx->Scissor.Width - 1 < x2) x2 = ctx->Scissor.X + ctx->Scissor.Width - 1; if (ctx->Scissor.Y + ctx->Scissor.Height - 1 < y2) y2 = ctx->Scissor.Y + ctx->Scissor.Height - 1; } y1 = Y_FLIP(y1); y2 = Y_FLIP(y2); current->clipLeftRight = (x1 << 13) | x2;*/ /* XXX */ static void sis6326UpdateCull( GLcontext *ctx ) { /* XXX culling */ } static void sis6326DDCullFace( GLcontext *ctx, GLenum mode ) { sis6326UpdateCull( ctx ); } static void sis6326DDFrontFace( GLcontext *ctx, GLenum mode ) { sis6326UpdateCull( ctx ); } static void sis6326DDColorMask( GLcontext *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { sisContextPtr smesa = SIS_CONTEXT(ctx); if (r && g && b && ((ctx->Visual.alphaBits == 0) || a)) { FALLBACK(smesa, <API key>, 0); } else { FALLBACK(smesa, <API key>, 1); } } static void <API key>(GLcontext *ctx) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; if (<API key>(ctx)) current->hwCapEnable |= S_ENABLE_Specular; else current->hwCapEnable &= ~S_ENABLE_Specular; } static void <API key>(GLcontext *ctx, GLenum pname, const GLfloat *param) { if (pname == <API key>) { <API key>(ctx); } } static void sis6326DDShadeModel( GLcontext *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); /* Signal to sisRasterPrimitive to recalculate dwPrimitiveSet */ smesa->hw_primitive = -1; } static void sis6326CalcViewport( GLcontext *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; GLfloat *m = smesa->hw_viewport; /* See also <API key>. */ m[MAT_SX] = v[MAT_SX]; m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X; m[MAT_SY] = - v[MAT_SY]; m[MAT_TY] = - v[MAT_TY] + smesa->driDrawable->h + SUBPIXEL_Y; m[MAT_SZ] = v[MAT_SZ] * smesa->depth_scale; m[MAT_TZ] = v[MAT_TZ] * smesa->depth_scale; } static void sis6326DDViewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { sis6326CalcViewport( ctx ); } static void sis6326DDDepthRange( GLcontext *ctx, GLclampd nearval, GLclampd farval ) { sis6326CalcViewport( ctx ); } static void <API key>( GLcontext *ctx, GLenum opcode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; if (!ctx->Color.ColorLogicOpEnabled) return; current->hwDstSet &= ~MASK_ROP2; switch (opcode) { case GL_CLEAR: current->hwDstSet |= LOP_CLEAR; break; case GL_SET: current->hwDstSet |= LOP_SET; break; case GL_COPY: current->hwDstSet |= LOP_COPY; break; case GL_COPY_INVERTED: current->hwDstSet |= LOP_COPY_INVERTED; break; case GL_NOOP: current->hwDstSet |= LOP_NOOP; break; case GL_INVERT: current->hwDstSet |= LOP_INVERT; break; case GL_AND: current->hwDstSet |= LOP_AND; break; case GL_NAND: current->hwDstSet |= LOP_NAND; break; case GL_OR: current->hwDstSet |= LOP_OR; break; case GL_NOR: current->hwDstSet |= LOP_NOR; break; case GL_XOR: current->hwDstSet |= LOP_XOR; break; case GL_EQUIV: current->hwDstSet |= LOP_EQUIV; break; case GL_AND_REVERSE: current->hwDstSet |= LOP_AND_REVERSE; break; case GL_AND_INVERTED: current->hwDstSet |= LOP_AND_INVERTED; break; case GL_OR_REVERSE: current->hwDstSet |= LOP_OR_REVERSE; break; case GL_OR_INVERTED: current->hwDstSet |= LOP_OR_INVERTED; break; } if (current->hwDstSet != prev->hwDstSet) { prev->hwDstSet = current->hwDstSet; smesa->GlobalFlag |= GFLAG_DESTSETTING; } } void sis6326DDDrawBuffer( GLcontext *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; if(getenv("SIS_DRAW_FRONT")) ctx->DrawBuffer-><API key>[0] = GL_FRONT_LEFT; /* * _DrawDestMask is easier to cope with than <mode>. */ current->hwDstSet &= ~MASK_DstBufferPitch; switch ( ctx->DrawBuffer-><API key>[0] ) { case <API key>: current->hwOffsetDest = smesa->front.offset; current->hwDstSet |= smesa->front.pitch; FALLBACK( smesa, <API key>, GL_FALSE ); break; case <API key>: current->hwOffsetDest = smesa->back.offset; current->hwDstSet |= smesa->back.pitch; FALLBACK( smesa, <API key>, GL_FALSE ); break; default: /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */ FALLBACK( smesa, <API key>, GL_TRUE ); return; } if (current->hwDstSet != prev->hwDstSet) { prev->hwDstSet = current->hwDstSet; smesa->GlobalFlag |= GFLAG_DESTSETTING; } if (current->hwOffsetDest != prev->hwOffsetDest) { prev->hwOffsetDest = current->hwOffsetDest; smesa->GlobalFlag |= GFLAG_DESTSETTING; } } static void sis6326DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; switch (cap) { case GL_ALPHA_TEST: if (state) current->hwCapEnable |= S_ENABLE_AlphaTest; else current->hwCapEnable &= ~S_ENABLE_AlphaTest; break; case GL_BLEND: /* TODO: */ if (state) /* if (state & !ctx->Color.ColorLogicOpEnabled) */ current->hwCapEnable |= S_ENABLE_Blend; else current->hwCapEnable &= ~S_ENABLE_Blend; break; case GL_CULL_FACE: /* XXX culling */ break; case GL_DEPTH_TEST: if (state && smesa->depth.offset != 0) current->hwCapEnable |= S_ENABLE_ZTest; else current->hwCapEnable &= ~S_ENABLE_ZTest; sis6326DDDepthMask( ctx, ctx->Depth.Mask ); break; case GL_DITHER: if (state) current->hwCapEnable |= S_ENABLE_Dither; else current->hwCapEnable &= ~S_ENABLE_Dither; break; case GL_FOG: if (state) current->hwCapEnable |= S_ENABLE_Fog; else current->hwCapEnable &= ~S_ENABLE_Fog; break; case GL_COLOR_LOGIC_OP: if (state) <API key>( ctx, ctx->Color.LogicOp ); else <API key>( ctx, GL_COPY ); break; case GL_SCISSOR_TEST: <API key>( ctx ); break; case GL_STENCIL_TEST: if (state) { FALLBACK(smesa, <API key>, 1); } else { FALLBACK(smesa, <API key>, 0); } break; case GL_LIGHTING: case GL_COLOR_SUM_EXT: <API key>(ctx); break; } } /* Called before beginning of rendering. */ void <API key>( GLcontext *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; if (smesa->NewGLState & _NEW_TEXTURE) <API key>( ctx ); if (current->hwCapEnable ^ prev->hwCapEnable) { prev->hwCapEnable = current->hwCapEnable; smesa->GlobalFlag |= GFLAG_ENABLESETTING; } if (smesa->GlobalFlag & GFLAG_RENDER_STATES) <API key>( smesa ); if (smesa->GlobalFlag & <API key>) <API key>( smesa ); } static void <API key>( GLcontext *ctx, GLuint new_state ) { sisContextPtr smesa = SIS_CONTEXT(ctx); <API key>( ctx, new_state ); <API key>( ctx, new_state ); <API key>( ctx, new_state ); <API key>( ctx, new_state ); smesa->NewGLState |= new_state; } /* Initialize the context's hardware state. */ void sis6326DDInitState( sisContextPtr smesa ) { __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; GLcontext *ctx = smesa->glCtx; /* add Texture Perspective Enable */ current->hwCapEnable = <API key> | <API key> | S_ENABLE_Dither; /* Z test mode is LESS */ current->hwZ = S_ZSET_PASS_LESS | S_ZSET_FORMAT_16; if (ctx->Visual.depthBits > 0) current->hwCapEnable |= S_ENABLE_ZWrite; /* Alpha test mode is ALWAYS, alpha ref value is 0 */ current->hwAlpha = S_ASET_PASS_ALWAYS; /* ROP2 is COPYPEN */ current->hwDstSet = LOP_COPY; /* LinePattern is 0, Repeat Factor is 0 */ current->hwLinePattern = 0x00008000; /* Src blend is BLEND_ONE, Dst blend is D3DBLEND_ZERO */ current->hwDstSrcBlend = S_SBLEND_ONE | S_DBLEND_ZERO; switch (smesa->bytesPerPixel) { case 2: current->hwDstSet |= DST_FORMAT_RGB_565; break; case 4: current->hwDstSet |= <API key>; break; } smesa->depth_scale = 1.0 / (GLfloat)0xffff; smesa->clearTexCache = GL_TRUE; smesa->clearColorPattern = 0; <API key>(smesa, 1.0); sis6326UpdateCull(ctx); /* Set initial fog settings. Start and end are the same case. */ sis6326DDFogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density ); sis6326DDFogfv( ctx, GL_FOG_END, &ctx->Fog.End ); sis6326DDFogfv( ctx, GL_FOG_MODE, NULL ); memcpy(prev, current, sizeof(__GLSiSHardware)); } /* Initialize the driver's state functions. */ void <API key>( GLcontext *ctx ) { ctx->Driver.UpdateState = <API key>; ctx->Driver.Clear = sis6326DDClear; ctx->Driver.ClearColor = sis6326DDClearColor; ctx->Driver.ClearDepth = sis6326DDClearDepth; ctx->Driver.AlphaFunc = sis6326DDAlphaFunc; ctx->Driver.BlendFuncSeparate = <API key>; ctx->Driver.ColorMask = sis6326DDColorMask; ctx->Driver.CullFace = sis6326DDCullFace; ctx->Driver.DepthMask = sis6326DDDepthMask; ctx->Driver.DepthFunc = sis6326DDDepthFunc; ctx->Driver.DepthRange = sis6326DDDepthRange; ctx->Driver.DrawBuffer = sis6326DDDrawBuffer; ctx->Driver.Enable = sis6326DDEnable; ctx->Driver.FrontFace = sis6326DDFrontFace; ctx->Driver.Fogfv = sis6326DDFogfv; ctx->Driver.LogicOpcode = <API key>; ctx->Driver.Scissor = sis6326DDScissor; ctx->Driver.ShadeModel = sis6326DDShadeModel; ctx->Driver.LightModelfv = <API key>; ctx->Driver.Viewport = sis6326DDViewport; }
<!DOCTYPE HTML PUBLIC "- <!--NewPage <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_31) on Wed May 15 10:56:37 EEST 2013 --> <TITLE> ITouchHandler (AChartEngine) </TITLE> <META NAME="date" CONTENT="2013-05-15"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="ITouchHandler (AChartEngine)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <A NAME="navbar_top"></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ITouchHandler.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../org/achartengine/GraphicalView.html" title="class in org.achartengine"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../org/achartengine/TouchHandler.html" title="class in org.achartengine"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?org/achartengine/ITouchHandler.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ITouchHandler.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <HR> <H2> <FONT SIZE="-1"> org.achartengine</FONT> <BR> Interface ITouchHandler</H2> <DL> <DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../org/achartengine/TouchHandler.html" title="class in org.achartengine">TouchHandler</A>, <A HREF="../../org/achartengine/TouchHandlerOld.html" title="class in org.achartengine">TouchHandlerOld</A></DD> </DL> <HR> <DL> <DT><PRE>public interface <B>ITouchHandler</B></DL> </PRE> <P> The interface to be implemented by the touch handlers. <P> <P> <HR> <P> <A NAME="method_summary"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../org/achartengine/ITouchHandler.html#addPanListener(org.achartengine.tools.PanListener)">addPanListener</A></B>(<A HREF="../../org/achartengine/tools/PanListener.html" title="interface in org.achartengine.tools">PanListener</A>&nbsp;listener)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a new pan listener.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../org/achartengine/ITouchHandler.html#addZoomListener(org.achartengine.tools.ZoomListener)">addZoomListener</A></B>(<A HREF="../../org/achartengine/tools/ZoomListener.html" title="interface in org.achartengine.tools">ZoomListener</A>&nbsp;listener)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a new zoom listener.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../org/achartengine/ITouchHandler.html#handleTouch(android.view.MotionEvent)">handleTouch</A></B>(android.view.MotionEvent&nbsp;event)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Handles the touch event.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../org/achartengine/ITouchHandler.html#removePanListener(org.achartengine.tools.PanListener)">removePanListener</A></B>(<A HREF="../../org/achartengine/tools/PanListener.html" title="interface in org.achartengine.tools">PanListener</A>&nbsp;listener)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Removes a pan listener.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../org/achartengine/ITouchHandler.html#removeZoomListener(org.achartengine.tools.ZoomListener)">removeZoomListener</A></B>(<A HREF="../../org/achartengine/tools/ZoomListener.html" title="interface in org.achartengine.tools">ZoomListener</A>&nbsp;listener)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Removes a zoom listener.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="method_detail"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="handleTouch(android.view.MotionEvent)"></A><H3> handleTouch</H3> <PRE> boolean <B>handleTouch</B>(android.view.MotionEvent&nbsp;event)</PRE> <DL> <DD>Handles the touch event. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>event</CODE> - the touch event <DT><B>Returns:</B><DD>true if the event was handled</DL> </DD> </DL> <HR> <A NAME="addZoomListener(org.achartengine.tools.ZoomListener)"></A><H3> addZoomListener</H3> <PRE> void <B>addZoomListener</B>(<A HREF="../../org/achartengine/tools/ZoomListener.html" title="interface in org.achartengine.tools">ZoomListener</A>&nbsp;listener)</PRE> <DL> <DD>Adds a new zoom listener. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>listener</CODE> - zoom listener</DL> </DD> </DL> <HR> <A NAME="removeZoomListener(org.achartengine.tools.ZoomListener)"></A><H3> removeZoomListener</H3> <PRE> void <B>removeZoomListener</B>(<A HREF="../../org/achartengine/tools/ZoomListener.html" title="interface in org.achartengine.tools">ZoomListener</A>&nbsp;listener)</PRE> <DL> <DD>Removes a zoom listener. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>listener</CODE> - zoom listener</DL> </DD> </DL> <HR> <A NAME="addPanListener(org.achartengine.tools.PanListener)"></A><H3> addPanListener</H3> <PRE> void <B>addPanListener</B>(<A HREF="../../org/achartengine/tools/PanListener.html" title="interface in org.achartengine.tools">PanListener</A>&nbsp;listener)</PRE> <DL> <DD>Adds a new pan listener. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>listener</CODE> - pan listener</DL> </DD> </DL> <HR> <A NAME="removePanListener(org.achartengine.tools.PanListener)"></A><H3> removePanListener</H3> <PRE> void <B>removePanListener</B>(<A HREF="../../org/achartengine/tools/PanListener.html" title="interface in org.achartengine.tools">PanListener</A>&nbsp;listener)</PRE> <DL> <DD>Removes a pan listener. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>listener</CODE> - pan listener</DL> </DD> </DL> <HR> <A NAME="navbar_bottom"></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="<API key>"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ITouchHandler.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../org/achartengine/GraphicalView.html" title="class in org.achartengine"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../org/achartengine/TouchHandler.html" title="class in org.achartengine"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?org/achartengine/ITouchHandler.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ITouchHandler.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <HR> <i>Copyright & </BODY> </HTML>
module Admin class JobsController < AdminController def initialize(repository = Delayed::Job) @repository = repository super() end def index @jobs = @repository.order(created_at: :desc) end def show @job = @repository.find(params[:id]) end def update @job = @repository.find(params[:id]) @job.invoke_job redirect_to admin_jobs_path end def destroy @job = @repository.find(params[:id]) @job.destroy redirect_to admin_jobs_path end end end
#ifndef _LINUX_DVS_SUITE_H #define _LINUX_DVS_SUITE_H #include <asm/current.h> /* For current macro */ #include <asm/div64.h> /* For division */ #include <linux/mm.h> #include <linux/vmalloc.h> #include <linux/spinlock.h> #include <linux/errno.h> /* For EAGAIN and EWOULDBLOCK */ #include <linux/kernel.h> /* For printk */ #include <linux/sched.h> /* For struct task_struct and wait_event* macros */ #include <linux/slab.h> /* For kmalloc and kfree */ #include <linux/string.h> /* To use string functions */ #include <linux/times.h> /* For struct timeval and do_gettimeofday */ #include <linux/cred.h> /* To get uid */ #include <linux/workqueue.h> #include <plat/omap_device.h> #include <plat/omap-pm.h> /* * Including resource34xx.h here causes build error. * This is the reason why we moved ds_update_cpu_op() from here to resource34xx.c. */ //#include "../../arch/arm/mach-omap2/resource34xx.h" /* For set_opp() */ //#include "../../../system/core/include/private/<API key>.h" /* For AID_* */ /* The 4 operating points (CPU_OP) supported by Hub (LU3000)'s OMAP3630 CPU_OP 0: (1000 MHz, 1.35V), Scaling factor 1 = 0x1000 in fixed point number CPU_OP 1: ( 800 MHz, 1.26V), Scaling factor 0.8 = 0xccc CPU_OP 2: ( 600 MHz, 1.10V), Scaling factor 0.6 = 0x999 CPU_OP 3: ( 300 MHz, 0.93V), Scaling factor 0.3 = 0x4cc set_opp(&vdd1_opp, VDD1_OPP4) set_opp(&vdd1_opp, VDD1_OPP3) set_opp(&vdd1_opp, VDD1_OPP2) set_opp(&vdd1_opp, VDD1_OPP1) */ /* The number of CPU_OPs to use */ #define DS_CPU_OP_LIMIT 4 /* To cope with touch and key inputs */ #define <API key> 7 /* The CPU_OP indices */ #define DS_CPU_OP_INDEX_0 1000000000 #define DS_CPU_OP_INDEX_1 800000000 #define DS_CPU_OP_INDEX_2 600000000 #define DS_CPU_OP_INDEX_3 300000000 #define DS_CPU_OP_INDEX_MAX DS_CPU_OP_INDEX_0 #define <API key> DS_CPU_OP_INDEX_1 #define <API key> DS_CPU_OP_INDEX_2 #define DS_CPU_OP_INDEX_MIN DS_CPU_OP_INDEX_3 /* The scaling factors */ #define DS_CPU_OP_SF_0 0x1000 #define DS_CPU_OP_SF_1 0xccc #define DS_CPU_OP_SF_2 0x999 #define DS_CPU_OP_SF_3 0x4cc /* The conversion macros between index and mhz/mv */ #if 0 // To do. The following is for Pentium M #define DS_MHZMV2INDEX(mhz, mv) ((((mhz)/100)<<8)|(((mv)-700)/16)) #endif /* WARNING! Not precise! */ #define DS_INDEX2MHZ(index) \ ((index)==1000000000 ? 1000 : \ ((index)==800000000 ? 800 : \ ((index)==600000000 ? 600 : 300))) #define DS_INDEX2MHZPRECISE(index) \ ((index)==1000000000 ? 1000 : \ ((index)==800000000 ? 800 : \ ((index)==600000000 ? 600 : 300))) #if 0 // To do. The following is for Pentium M #define DS_INDEX2MV(index) (((int)(index)&0xff)*16+700) #endif #define DS_INDEX2NR(index) \ ((index)==1000000000 ? 0 : \ ((index)==800000000 ? 1 : \ ((index)==600000000 ? 2 : 3))) #define DS_INDEX2SF(index) \ ((index)==1000000000 ? 0x1000 : \ ((index)==800000000 ? 0xccc : \ ((index)==600000000 ? 0x999 : 0x4cc))) /* For ds_status.cpu_mode */ #define DS_CPU_MODE_IDLE 0 #define DS_CPU_MODE_TASK 1 #define <API key> 2 #define <API key> 4 /* For ds_configuration.sched_scheme */ #define <API key> 0 #define DS_SCHED_GPSCHED 1 /* For ds_configuration.dvs_scheme */ // For now, dvs_scheme of Swift is fixed to DS_DVS_GPSCHEDVS. #define DS_DVS_NO_DVS 0 #define DS_DVS_MIN 1 #define DS_DVS_GPSCHEDVS 2 #define DS_DVS_MANUAL 99 /* For do_dvs_suite() */ #define <API key> 0 #define DS_ENTRY_SWITCH_TO 1 /* The macro to convert an unsigned long type to U(20,12) fixed point. Result is U(20,12) fixed point. */ #define DS_ULONG2FP12(x) ((x)<<12) /* The macro to extract the integer part of the given U(20,12) fixed point number. Result is unsigned long. */ #define DS_GETFP12INT(x) (((x)&0xfffff000)>>12) /* The macro to extract the fraction part of the given U(20,12) fixed point number. Result is U(20,12) fixed point. */ #define DS_GETFP12FRA(x) ((x)&0x00000fff) /* Definitions for compare44bits() */ #define DS_LARGER 1 #define DS_EQUAL 0 #define DS_SMALLER -1 /* A representative HRT task in a Smartphone is voice call. * To do. Implement it in the future. For this time, we ignore such a HRT task. */ #define <API key> 0 /* Process static priority */ #define <API key> 120 //#define DS_HRT_STATIC_PRIO 100 // 100 nice -20 #define DS_HRT_STATIC_PRIO 105 // 100 nice -15 #define <API key> 110 // 110 nice -10 #define <API key> 115 // 115 nice -5 #define DS_NRT_STATIC_PRIO 120 // 120 nice 0 #define DS_IDLE_PRIO 140 //#define DS_HRT_NICE -20 // -20 #define DS_HRT_NICE -15 #define DS_DBSRT_NICE -10 #define DS_RBSRT_NICE -5 #define DS_NRT_NICE 0 /* Process rt_priority. p->prio = p->normal_prio = 99 - p->rt_priority for SCHED_RR tasks. p->prio = p->normal_prio = p->static_prio for SCHED_NORMAL tasks. */ #define DS_HRT_RR_PRIO 29 // p->prio = 70 #define DS_DBSRT_RR_PRIO 19 // p->prio = 80 #define DS_RBSRT_RR_PRIO 9 // p->prio = 90 /* Scheduler type. */ #define DS_SCHED_NORMAL 0 #define DS_SCHED_RR 1 /* Process type. */ #define DS_HRT_TASK 1 // HRT #define <API key> 2 // DBSRT #define <API key> 3 // DBSRT #define <API key> 4 // RBSRT #define DS_SRT_DAEMON_TASK 5 // RBSRT #define DS_NRT_TASK 6 // NRT #define <API key> <API key> /* If a <API key> does not interact with <API key> * for over <API key>, we re-define its type. * The new type depends on conditions. */ #define DS_SRT_UI_IPC_NO 3 #define <API key> 500000 // 500 msec. It should not be larger than 1sec. #define DS_TOUCH_TIMEOUT 980000 // 980 msec. Don't touch this. LG standard. /* The maximum allowable number of PID. 0 ~ 32767. */ #define DS_PID_LIMIT 32768 /* Definitions for AIDVS */ /* <API key> and <API key> * should be less than 1000000 */ #define <API key> 3 #define <API key> 100 /* 100 intervals in an window */ #define <API key> 100000 /* 100 msec in fse */ #define <API key> 100000 /* 100 msec in fse */ /* Definitions for GPScheDVS */ /* Following THRESHOLD and INTERVAL values should be less than 1000000. */ #define <API key> 100 /* Max. intervals in an window */ #define <API key> 10000 /* 10 msec in elapsed */ #define <API key> 3000 /* 3 msec in fse */ #define <API key> 3000 /* 3 msec in fse */ #define <API key> 100 /* Max. intervals in an window */ #define <API key> 30000 /* 25 msec in elapsed */ #define <API key> 5000 /* 5 msec in fse */ #define <API key> 5000 /* 5 msec in fse */ #define <API key> 100 /* Max. intervals in an window */ #define <API key> 40000 /* 50 msec in elapsed */ #define <API key> 50000 /* 10 msec in fse */ #define <API key> 50000 /* 10 msec in fse */ #define <API key> 100 /* Max. intervals in an window */ #define <API key> 80000 /* 100 msec in elapsed */ #define <API key> 100000 /* 20 msec in fse */ #define <API key> 100000 /* 20 msec in fse */ #define <API key> 10000 /* 10 msec */ #define <API key> 10000 /* 10 msec */ #define DS_INIT_DELAY_SEC 20 /* 20 seconds */ #define <API key> 2000000 /* 2 seconds */ extern struct timeval ds_timeval; typedef struct <API key> DS_CONF; typedef struct dvs_suite_status DS_STAT; typedef struct dvs_suite_counter DS_COUNT; typedef struct dvs_suite_parameter DS_PARAM; typedef struct <API key> <API key>; typedef struct <API key> <API key>; typedef struct <API key> <API key>; typedef struct <API key> <API key>; typedef struct <API key> <API key>; typedef struct <API key> <API key>; typedef struct <API key> <API key>; /* The dvs_suite configuration structure. All the fields of this structure are adjusted by the Loadable Kernel Module (LKM) dvs_suite_mod. Field dvs_scheme tells the DVS scheme to force. Possible values are as follows: 0: Constantly forcing the maximum CPU_OP., i.e., CPU_OP0. 1: Constantly forcing the minimum CPU_OP., i.e., CPU_OP4 for Swift 2: AIDVS 3: GPScheDVS 99: MANUAL Field on_dvs tells whether to force the chosen DVS scheme or not. If on_dvs is set, the DVS scheme indicated by field dvs_scheme is forced. If on_dvs is reset, the maximum CPU_OP is forced as default. */ struct <API key> { /* For scheduling scheme */ int sched_scheme; /* For dvs_suite */ int dvs_scheme; int on_dvs; /* For DVS schemes */ /* GPSDVS and GPScheDVS strategies 0: System energy centric strategy. 1: CPU power centric strategy. */ int gpsdvs_strategy; int gpschedvs_strategy; int <API key>; unsigned long <API key>; unsigned long <API key>; }; extern DS_CONF ds_configuration; /* The current system status. Field ds_initialized indicates that whether dvs_suite is initialized or not. The initialization process sets ds_status.cpu_op_index to what the CPU is currently running at. Field <API key> indicates whether tv_usec_base were initialized or not. Field tv_usec_base holds the last read ds_timeval.tv_usec value. We use do_gettimeofday() to get the elapsed real time. Field cpu_op_index indicates the current CPU_OP index. Field cpu_op_index_sf indicates the current CPU_OP scalinf factor. Field cpu_op_index_nr indicates the integer number corresponding to the current CPU_OP index. They are 0 for CPU_OP_INDEX_0, 1 for CPU_OP_INDEX_1, and so forth. Field cpu_op_mhz indicates the MHz value in fixed point format corresponding to the current CPU_OP index. Field cpu_mode indicates the current cpu mode among that cpu is idle (0: DS_CPU_MODE_IDLE), cpu is busy while running a task (1: DS_CPU_MODE_TASK), cpu is busy while performing schedule() (2: <API key>), and cpu is busy while running dvs_suite related codes (4: <API key>). Fields current_dvs_scheme and dvs_is_on hold the current state of the corresponding fields in ds_configuration and are used to check if the corresponding feature should be initialized or not. Field <API key> indicates the fact that the current task just made an interaction with media server for a multimedia transaction. Field <API key> indicates the fact that the current task just made an interaction with system server for an user input event transaction. Field ms_pid is the pid of media server. Field ss_pid is the pid of system server. Field *pti[DS_PID_LIMIT] is the array holding the pointers to per task information data structures. The index for pti is the PID of tasks. This data structure is used to trace the type of tasks. */ struct dvs_suite_status { int flag_run_dvs; int ds_initialized; int <API key>; unsigned long tv_sec_curr; unsigned long tv_usec_curr; unsigned long tv_sec_base; unsigned long tv_usec_base; unsigned int cpu_op_index; unsigned int cpu_op_sf; int cpu_op_index_nr; int cpu_op_mhz; int cpu_mode; int flag_update_cpu_op; unsigned int target_cpu_op_index; unsigned long <API key>; unsigned long <API key>; int current_dvs_scheme; int scheduler[DS_PID_LIMIT]; int type[DS_PID_LIMIT]; int type_fixed[DS_PID_LIMIT]; int <API key>[DS_PID_LIMIT]; int tgid[DS_PID_LIMIT]; char tg_owner_comm[DS_PID_LIMIT][16]; int tgid_type_changed[DS_PID_LIMIT]; int <API key>[DS_PID_LIMIT]; unsigned long ipc_timeout_sec[DS_PID_LIMIT]; unsigned long ipc_timeout_usec[DS_PID_LIMIT]; int <API key>; unsigned long touch_timeout_sec; unsigned long touch_timeout_usec; int <API key>; int <API key>; int <API key>; int <API key>; unsigned long <API key>; unsigned long <API key>; int <API key>; unsigned long <API key>; unsigned long l3_min_freq_to_lock; unsigned long <API key>; }; extern DS_STAT ds_status; /* The data structure holding various counters. The first type of counters are time counters which holds the fractions of busy (= task + context switch + dvs suite, i.e. the overhead) and idle time at each CPU_OP. Additionally, the full speed equivalent sec and usec values are calculated and stored. fp12_*_fse_fraction holds the fraction smaller than 1 usec in U(20,12) fixed point format. elapsed_sec and elapsed_usec hold the total elapsed time (wall clock time) since the system was booted. The second type of counters hold the occurrence number of certain events such as CPU_OP transitions, schedules, and total number of system calls and interrupts. */ struct dvs_suite_counter { unsigned long elapsed_sec; unsigned long elapsed_usec; #if 0 unsigned long idle_sec[DS_CPU_OP_LIMIT]; unsigned long idle_usec[DS_CPU_OP_LIMIT]; unsigned long idle_total_sec; unsigned long idle_total_usec; unsigned long busy_sec[DS_CPU_OP_LIMIT]; unsigned long busy_usec[DS_CPU_OP_LIMIT]; #endif unsigned long busy_total_sec; unsigned long busy_total_usec; unsigned long busy_fse_sec; unsigned long busy_fse_usec; unsigned long <API key>; #if 0 unsigned long busy_task_sec[DS_CPU_OP_LIMIT]; unsigned long busy_task_usec[DS_CPU_OP_LIMIT]; unsigned long busy_task_total_sec; unsigned long <API key>; unsigned long busy_task_fse_sec; unsigned long busy_task_fse_usec; unsigned long <API key>; /* The busy time caused by HRT tasks */ unsigned long busy_hrt_task_sec; unsigned long busy_hrt_task_usec; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; /* The busy time caused by DBSRT tasks */ unsigned long busy_dbsrt_task_sec; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; /* The busy time caused by RBSRT tasks */ unsigned long busy_rbsrt_task_sec; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; /* The busy time caused by NRT tasks */ unsigned long busy_nrt_task_sec; unsigned long busy_nrt_task_usec; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long busy_schedule_sec[DS_CPU_OP_LIMIT]; unsigned long busy_schedule_usec[DS_CPU_OP_LIMIT]; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long busy_dvs_suite_sec[DS_CPU_OP_LIMIT]; unsigned long busy_dvs_suite_usec[DS_CPU_OP_LIMIT]; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long schedule_no; unsigned long <API key>; #endif }; extern DS_COUNT ds_counter; /* The parameters for do_dvs_suite(). Field entry_type indicates where do_dvs_suite() was called. entry_type <API key> indicates that do_dvs_suite() was called at the beginning of ENTRY(<API key>) defined in linux/arch/i386/kernel/entry.S. entry_type DS_ENTRY_SWITCH_TO indicates that do_dvs_suite() was called at the end of __switch_to() macro defined in linux/arch/i386/kernel/process.c. Fields prev_p and next_p are set only before calling do_dvs_suite() in __switch_to() macro. When calling do_dvs_suite() from ENTRY(<API key>), these fields should be ignored. */ struct dvs_suite_parameter { int entry_type; struct task_struct *prev_p; struct task_struct *next_p; }; extern DS_PARAM ds_parameter; /* * Variables for AIDVS. */ struct <API key> { unsigned long time_usec_interval; unsigned long time_usec_work_fse; unsigned long time_usec_work; // struct <API key> *next; }; struct <API key> { int base_initialized; int flag_in_busy_half; unsigned long time_usec_interval; unsigned long <API key>; unsigned long <API key>; unsigned long time_usec_work_fse; unsigned long <API key>; unsigned long <API key>; unsigned long time_usec_work; unsigned long <API key>; unsigned long <API key>; <API key> <API key>[<API key>]; int <API key>; // <API key> *<API key>; // <API key> *<API key>; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; int <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned long <API key>; unsigned int cpu_op_index; }; extern <API key> ds_aidvs_status; /* * Variables for GPScheDVS. */ struct <API key> { int current_strategy; /* Workload includes HRT + DBSRT + RBSRT + NRT tasks, i.e., all tasks. */ <API key> aidvs_l3_status; /* Workload includes HRT + DBSRT + RBSRT tasks */ <API key> aidvs_l2_status; /* Workload includes HRT + DBSRT tasks */ <API key> aidvs_l1_status; /* Workload includes HRT tasks */ <API key> aidvs_l0_status; }; extern <API key> ds_gpschedvs_status; /* * Other global vairables */ extern void ds_fpmul12(unsigned long, unsigned long, unsigned long *); extern void ds_fpdiv12(unsigned long, unsigned long, unsigned long *, unsigned long *); extern void ds_div32(unsigned long, unsigned long, unsigned long *, unsigned long *); extern int <API key>(unsigned long); extern int <API key>(unsigned long); extern int ds_compare45bits(int, unsigned long, unsigned long, int, unsigned long, unsigned long); extern int ds_shiftleft44bits(int, unsigned long, unsigned long, int, int *, unsigned long *, unsigned long *); extern int ds_subtract44bits(int, unsigned long, unsigned long, int, unsigned long, unsigned long, int *, unsigned long *, unsigned long *); extern int ds_fpmul(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long *, unsigned long *); extern int ds_fpdiv(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long *, unsigned long *); extern unsigned int <API key>(unsigned long, unsigned long); extern unsigned int <API key>(unsigned long, unsigned long); /* * The functions for each DVS scheme. */ /* AIDVS */ extern int ds_do_dvs_aidvs(unsigned int *, <API key> *, int, int, unsigned long, unsigned long, unsigned long); /* GPScheDVS */ extern int ds_do_dvs_gpschedvs(unsigned int *); /* * Wrappers to be used in the existing kernel codes * to call the main dvs suite function. */ extern asmlinkage void ld_update_cpu_op(void); extern int <API key>(int); extern int <API key>(void); extern int <API key>(struct task_struct *); extern void ld_do_dvs_suite(void); /* * The main dvs suite function. */ extern int <API key>(int); extern int <API key>(void); extern int <API key>(void); extern int <API key>(void); extern int <API key>(int); extern int <API key>(void); extern int <API key>(struct task_struct *); extern int <API key>(struct task_struct *); //extern void ds_update_cpu_op(void); extern asmlinkage void ds_update_cpu_op(void); extern int ds_detect_task_type(void); extern void do_dvs_suite(void); #endif /* !(_LINUX_DVS_SUITE_H) */
package pl.rcebula.code_generation.final_steps; import java.util.ArrayList; import java.util.List; import pl.rcebula.code_generation.intermediate.<API key>.IField; import pl.rcebula.code_generation.intermediate.<API key>.IntermediateCode; import pl.rcebula.code_generation.intermediate.<API key>.Line; import pl.rcebula.code_generation.intermediate.<API key>.StringField; /** * * @author robert */ public class <API key> { private final IntermediateCode ic; private final List<String> modulesName; public <API key>(IntermediateCode ic, List<String> modulesName) { this.ic = ic; this.modulesName = modulesName; analyse(); } private void analyse() { // tworzymy pola List<IField> fields = new ArrayList<>(); for (String m : modulesName) { IField f = new StringField(m); fields.add(f); } ic.insertLine(Line.<API key>(), 0); Line line = new Line(fields); ic.insertLine(line, 0); } }
/** @file dict/dict0load.c Loads to the memory cache database object definitions from dictionary tables Created 4/24/1996 Heikki Tuuri *******************************************************/ #include "dict0load.h" #include "mysql_version.h" #ifdef UNIV_NONINL #include "dict0load.ic" #endif #include "btr0pcur.h" #include "btr0btr.h" #include "page0page.h" #include "mach0data.h" #include "dict0dict.h" #include "dict0boot.h" #include "rem0cmp.h" #include "srv0start.h" #include "srv0srv.h" #include "ha_prototypes.h" /* innobase_casedn_str() */ /** Following are six InnoDB system tables */ static const char* SYSTEM_TABLE_NAME[] = { "SYS_TABLES", "SYS_INDEXES", "SYS_COLUMNS", "SYS_FIELDS", "SYS_FOREIGN", "SYS_FOREIGN_COLS" }; /** Compare the name of an index column. @return TRUE if the i'th column of index is 'name'. */ static ibool name_of_col_is( const dict_table_t* table, /*!< in: table */ const dict_index_t* index, /*!< in: index */ ulint i, /*!< in: index field offset */ const char* name) /*!< in: name to compare to */ { ulint tmp = dict_col_get_no(dict_field_get_col( <API key>( index, i))); return(strcmp(name, <API key>(table, tmp)) == 0); } /** Finds the first table name in the given database. @return own: table name, NULL if does not exist; the caller must free the memory in the string! */ UNIV_INTERN char* <API key>( const char* name) /*!< in: database name which ends in '/' */ { dict_table_t* sys_tables; btr_pcur_t pcur; dict_index_t* sys_index; dtuple_t* tuple; mem_heap_t* heap; dfield_t* dfield; const rec_t* rec; const byte* field; ulint len; mtr_t mtr; ut_ad(mutex_own(&(dict_sys->mutex))); heap = mem_heap_create(1000); mtr_start(&mtr); sys_tables = dict_table_get_low("SYS_TABLES"); sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); ut_a(!dict_table_is_comp(sys_tables)); tuple = dtuple_create(heap, 1); dfield = <API key>(tuple, 0); dfield_set_data(dfield, name, ut_strlen(name)); <API key>(tuple, sys_index, 1); <API key>(sys_index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); loop: rec = btr_pcur_get_rec(&pcur); if (!<API key>(&pcur)) { /* Not found */ btr_pcur_close(&pcur); mtr_commit(&mtr); mem_heap_free(heap); return(NULL); } field = <API key>(rec, 0, &len); if (len < strlen(name) || ut_memcmp(name, field, strlen(name)) != 0) { /* Not found */ btr_pcur_close(&pcur); mtr_commit(&mtr); mem_heap_free(heap); return(NULL); } if (!<API key>(rec, 0)) { /* We found one */ char* table_name = mem_strdupl((char*) field, len); btr_pcur_close(&pcur); mtr_commit(&mtr); mem_heap_free(heap); return(table_name); } <API key>(&pcur, &mtr); goto loop; } /** Prints to the standard output information on all tables found in the data dictionary system table. */ UNIV_INTERN void dict_print(void) { dict_table_t* table; btr_pcur_t pcur; const rec_t* rec; mem_heap_t* heap; mtr_t mtr; /* Enlarge the fatal semaphore wait timeout during the InnoDB table monitor printout */ mutex_enter(&kernel_mutex); <API key> += 7200; /* 2 hours */ mutex_exit(&kernel_mutex); heap = mem_heap_create(1000); mutex_enter(&(dict_sys->mutex)); mtr_start(&mtr); rec = <API key>(&pcur, &mtr, SYS_TABLES); while (rec) { const char* err_msg; err_msg = <API key>( heap, rec, &table, <API key> | <API key>); mtr_commit(&mtr); if (!err_msg) { <API key>(table); } else { ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: %s\n", err_msg); } mem_heap_empty(heap); mtr_start(&mtr); rec = dict_getnext_system(&pcur, &mtr); } mtr_commit(&mtr); mutex_exit(&(dict_sys->mutex)); mem_heap_free(heap); /* Restore the fatal semaphore wait timeout */ mutex_enter(&kernel_mutex); <API key> -= 7200; /* 2 hours */ mutex_exit(&kernel_mutex); } /** This function gets the next system table record as it scans the table. @return the next record if found, NULL if end of scan */ static const rec_t* <API key>( btr_pcur_t* pcur, /*!< in/out: persistent cursor to the record*/ mtr_t* mtr) /*!< in: the mini-transaction */ { rec_t* rec = NULL; while (!rec || <API key>(rec, 0)) { <API key>(pcur, mtr); rec = btr_pcur_get_rec(pcur); if (!<API key>(pcur)) { /* end of index */ btr_pcur_close(pcur); return(NULL); } } /* Get a record, let's save the position */ <API key>(pcur, mtr); return(rec); } /** This function opens a system table, and return the first record. @return first record of the system table */ UNIV_INTERN const rec_t* <API key>( btr_pcur_t* pcur, /*!< out: persistent cursor to the record */ mtr_t* mtr, /*!< in: the mini-transaction */ dict_system_id_t system_id) /*!< in: which system table to open */ { dict_table_t* system_table; dict_index_t* clust_index; const rec_t* rec; ut_a(system_id < <API key>); system_table = dict_table_get_low(SYSTEM_TABLE_NAME[system_id]); clust_index = UT_LIST_GET_FIRST(system_table->indexes); <API key>(TRUE, clust_index, BTR_SEARCH_LEAF, pcur, TRUE, mtr); rec = <API key>(pcur, mtr); return(rec); } /** This function gets the next system table record as it scans the table. @return the next record if found, NULL if end of scan */ UNIV_INTERN const rec_t* dict_getnext_system( btr_pcur_t* pcur, /*!< in/out: persistent cursor to the record */ mtr_t* mtr) /*!< in: the mini-transaction */ { const rec_t* rec; /* Restore the position */ <API key>(BTR_SEARCH_LEAF, pcur, mtr); /* Get the next record */ rec = <API key>(pcur, mtr); return(rec); } /** This function processes one SYS_TABLES record and populate the dict_table_t struct for the table. Extracted out of dict_print() to be used by both monitor table output and information schema innodb_sys_tables output. @return error message, or NULL on success */ UNIV_INTERN const char* <API key>( mem_heap_t* heap, /*!< in/out: temporary memory heap */ const rec_t* rec, /*!< in: SYS_TABLES record */ dict_table_t** table, /*!< out: dict_table_t to fill */ dict_table_info_t status) /*!< in: status bit controls options such as whether we shall look for dict_table_t from cache first */ { ulint len; const char* field; const char* err_msg = NULL; char* table_name; field = (const char*) <API key>(rec, 0, &len); ut_a(!<API key>(rec, 0)); /* Get the table name */ table_name = mem_heap_strdupl(heap, field, len); /* If <API key> is set, first check whether there is cached dict_table_t struct first */ if (status & <API key>) { *table = dict_table_get_low(table_name); if (!(*table)) { err_msg = "Table not found in cache"; } } else { err_msg = dict_load_table_low(table_name, rec, table); } if (err_msg) { return(err_msg); } if ((status & <API key>) && <API key>(*table)) { /* Update statistics if <API key> is set */ <API key>(*table, FALSE /* update even if initialized */); } return(NULL); } /** This function parses a SYS_INDEXES record and populate a dict_index_t structure with the information from the record. For detail information about SYS_INDEXES fields, please refer to dict_boot() function. @return error message, or NULL on success */ UNIV_INTERN const char* <API key>( mem_heap_t* heap, /*!< in/out: heap memory */ const rec_t* rec, /*!< in: current SYS_INDEXES rec */ dict_index_t* index, /*!< out: index to be filled */ table_id_t* table_id) /*!< out: index table id */ { const char* err_msg; byte* buf; buf = mem_heap_alloc(heap, 8); /* Parse the record, and get "dict_index_t" struct filled */ err_msg = dict_load_index_low(buf, NULL, heap, rec, FALSE, &index); *table_id = mach_read_from_8(buf); return(err_msg); } /** This function parses a SYS_COLUMNS record and populate a dict_column_t structure with the information from the record. @return error message, or NULL on success */ UNIV_INTERN const char* <API key>( mem_heap_t* heap, /*!< in/out: heap memory */ const rec_t* rec, /*!< in: current SYS_COLUMNS rec */ dict_col_t* column, /*!< out: dict_col_t to be filled */ table_id_t* table_id, /*!< out: table id */ const char** col_name) /*!< out: column name */ { const char* err_msg; /* Parse the record, and get "dict_col_t" struct filled */ err_msg = <API key>(NULL, heap, column, table_id, col_name, rec); return(err_msg); } /** This function parses a SYS_FIELDS record and populates a dict_field_t structure with the information from the record. @return error message, or NULL on success */ UNIV_INTERN const char* <API key>( mem_heap_t* heap, /*!< in/out: heap memory */ const rec_t* rec, /*!< in: current SYS_FIELDS rec */ dict_field_t* sys_field, /*!< out: dict_field_t to be filled */ ulint* pos, /*!< out: Field position */ index_id_t* index_id, /*!< out: current index id */ index_id_t last_id) /*!< in: previous index id */ { byte* buf; byte* last_index_id; const char* err_msg; buf = mem_heap_alloc(heap, 8); last_index_id = mem_heap_alloc(heap, 8); mach_write_to_8(last_index_id, last_id); err_msg = dict_load_field_low(buf, NULL, sys_field, pos, last_index_id, heap, rec, NULL, 0); *index_id = mach_read_from_8(buf); return(err_msg); } #ifdef FOREIGN_NOT_USED /** This function parses a SYS_FOREIGN record and populate a dict_foreign_t structure with the information from the record. For detail information about SYS_FOREIGN fields, please refer to dict_load_foreign() function. @return error message, or NULL on success */ UNIV_INTERN const char* <API key>( mem_heap_t* heap, /*!< in/out: heap memory */ const rec_t* rec, /*!< in: current SYS_FOREIGN rec */ dict_foreign_t* foreign) /*!< out: dict_foreign_t struct to be filled */ { ulint len; const byte* field; ulint n_fields_and_type; if (UNIV_UNLIKELY(<API key>(rec, 0))) { return("delete-marked record in SYS_FOREIGN"); } if (UNIV_UNLIKELY(<API key>(rec) != 6)) { return("wrong number of columns in SYS_FOREIGN record"); } field = <API key>(rec, 0, &len); if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) { err_len: return("incorrect column length in SYS_FOREIGN"); } /* This recieves a dict_foreign_t* that points to a stack variable. So mem_heap_free(foreign->heap) is not used as elsewhere. Since the heap used here is freed elsewhere, foreign->heap is not assigned. */ foreign->id = mem_heap_strdupl(heap, (const char*) field, len); <API key>(rec, 1/*DB_TRX_ID*/, &len); if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) { goto err_len; } <API key>(rec, 2/*DB_ROLL_PTR*/, &len); if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) { goto err_len; } /* The _lookup versions of the referenced and foreign table names are not assigned since they are not used in this dict_foreign_t */ field = <API key>(rec, 3/*FOR_NAME*/, &len); if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) { goto err_len; } foreign->foreign_table_name = mem_heap_strdupl( heap, (const char*) field, len); field = <API key>(rec, 4/*REF_NAME*/, &len); if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) { goto err_len; } foreign-><API key> = mem_heap_strdupl( heap, (const char*) field, len); field = <API key>(rec, 5/*N_COLS*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } n_fields_and_type = mach_read_from_4(field); foreign->type = (unsigned int) (n_fields_and_type >> 24); foreign->n_fields = (unsigned int) (n_fields_and_type & 0x3FFUL); return(NULL); } #endif /* FOREIGN_NOT_USED */ #ifdef FOREIGN_NOT_USED /** This function parses a SYS_FOREIGN_COLS record and extract necessary information from the record and return to caller. @return error message, or NULL on success */ UNIV_INTERN const char* <API key>( mem_heap_t* heap, /*!< in/out: heap memory */ const rec_t* rec, /*!< in: current SYS_FOREIGN_COLS rec */ const char** name, /*!< out: foreign key constraint name */ const char** for_col_name, /*!< out: referencing column name */ const char** ref_col_name, /*!< out: referenced column name in referenced table */ ulint* pos) /*!< out: column position */ { ulint len; const byte* field; if (UNIV_UNLIKELY(<API key>(rec, 0))) { return("delete-marked record in SYS_FOREIGN_COLS"); } if (UNIV_UNLIKELY(<API key>(rec) != 6)) { return("wrong number of columns in SYS_FOREIGN_COLS record"); } field = <API key>(rec, 0, &len); if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) { err_len: return("incorrect column length in SYS_FOREIGN_COLS"); } *name = mem_heap_strdupl(heap, (char*) field, len); field = <API key>(rec, 1/*POS*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } *pos = mach_read_from_4(field); <API key>(rec, 2/*DB_TRX_ID*/, &len); if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) { goto err_len; } <API key>(rec, 3/*DB_ROLL_PTR*/, &len); if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) { goto err_len; } field = <API key>(rec, 4/*FOR_COL_NAME*/, &len); if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) { goto err_len; } *for_col_name = mem_heap_strdupl(heap, (char*) field, len); field = <API key>(rec, 5/*REF_COL_NAME*/, &len); if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) { goto err_len; } *ref_col_name = mem_heap_strdupl(heap, (char*) field, len); return(NULL); } #endif /* FOREIGN_NOT_USED */ /** Determine the flags of a table described in SYS_TABLES. @return compressed page size in kilobytes; or 0 if the tablespace is uncompressed, ULINT_UNDEFINED on error */ static ulint <API key>( const rec_t* rec) /*!< in: a record of SYS_TABLES */ { const byte* field; ulint len; ulint n_cols; ulint flags; field = <API key>(rec, 5, &len); ut_a(len == 4); flags = mach_read_from_4(field); if (UNIV_LIKELY(flags == DICT_TABLE_ORDINARY)) { return(0); } field = <API key>(rec, 4/*N_COLS*/, &len); n_cols = mach_read_from_4(field); if (UNIV_UNLIKELY(!(n_cols & 0x80000000UL))) { /* New file formats require ROW_FORMAT=COMPACT. */ return(ULINT_UNDEFINED); } switch (flags & (DICT_TF_FORMAT_MASK | DICT_TF_COMPACT)) { default: case DICT_TF_FORMAT_51 << <API key>: case DICT_TF_FORMAT_51 << <API key> | DICT_TF_COMPACT: /* flags should be DICT_TABLE_ORDINARY, or DICT_TF_FORMAT_MASK should be nonzero. */ return(ULINT_UNDEFINED); case DICT_TF_FORMAT_ZIP << <API key> | DICT_TF_COMPACT: #if DICT_TF_FORMAT_MAX > DICT_TF_FORMAT_ZIP # error "missing case labels for DICT_TF_FORMAT_ZIP .. DICT_TF_FORMAT_MAX" #endif /* We support this format. */ break; } if (UNIV_UNLIKELY((flags & DICT_TF_ZSSIZE_MASK) > (DICT_TF_ZSSIZE_MAX << <API key>))) { /* Unsupported compressed page size. */ return(ULINT_UNDEFINED); } if (UNIV_UNLIKELY(flags & (~0 << DICT_TF_BITS))) { /* Some unused bits are set. */ return(ULINT_UNDEFINED); } return(flags); } /** In a crash recovery we already have all the tablespace objects created. This function compares the space id information in the InnoDB data dictionary to what we already read with <API key>(). In a normal startup, we create the tablespace objects for every table in InnoDB's data dictionary, if the corresponding .ibd file exists. We also scan the biggest space id, and store it to fil_system. */ UNIV_INTERN void <API key>( ibool in_crash_recovery) /*!< in: are we doing a crash recovery */ { dict_table_t* sys_tables; dict_index_t* sys_index; btr_pcur_t pcur; const rec_t* rec; ulint max_space_id; mtr_t mtr; mutex_enter(&(dict_sys->mutex)); mtr_start(&mtr); sys_tables = dict_table_get_low("SYS_TABLES"); sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); ut_a(!dict_table_is_comp(sys_tables)); max_space_id = mtr_read_ulint(dict_hdr_get(&mtr) + <API key>, MLOG_4BYTES, &mtr); <API key>(max_space_id); <API key>(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur, TRUE, &mtr); loop: <API key>(&pcur, &mtr); rec = btr_pcur_get_rec(&pcur); if (!<API key>(&pcur)) { /* end of index */ btr_pcur_close(&pcur); mtr_commit(&mtr); /* We must make the tablespace cache aware of the biggest known space id */ /* printf("Biggest space id in data dictionary %lu\n", max_space_id); */ <API key>(max_space_id); mutex_exit(&(dict_sys->mutex)); return; } if (!<API key>(rec, 0)) { /* We found one */ const byte* field; ulint len; ulint space_id; ulint flags; char* name; field = <API key>(rec, 0, &len); name = mem_strdupl((char*) field, len); flags = <API key>(rec); if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) { field = <API key>(rec, 5, &len); flags = mach_read_from_4(field); ut_print_timestamp(stderr); fputs(" InnoDB: Error: table ", stderr); ut_print_filename(stderr, name); fprintf(stderr, "\n" "InnoDB: in InnoDB data dictionary" " has unknown type %lx.\n", (ulong) flags); goto loop; } field = <API key>(rec, 9, &len); ut_a(len == 4); space_id = mach_read_from_4(field); <API key>(&pcur, &mtr); mtr_commit(&mtr); if (space_id == 0) { /* The system tablespace always exists. */ } else if (in_crash_recovery) { /* Check that the tablespace (the .ibd file) really exists; print a warning to the .err log if not. Do not print warnings for temporary tables. */ ibool is_temp; field = <API key>(rec, 4, &len); if (0x80000000UL & mach_read_from_4(field)) { /* ROW_FORMAT=COMPACT: read the is_temp flag from SYS_TABLES.MIX_LEN. */ field = <API key>(rec, 7, &len); is_temp = mach_read_from_4(field) & DICT_TF2_TEMPORARY; } else { /* For tables created with old versions of InnoDB, SYS_TABLES.MIX_LEN may contain garbage. Such tables would always be in ROW_FORMAT=REDUNDANT. Pretend that all such tables are non-temporary. That is, do not suppress error printouts about temporary tables not being found. */ is_temp = FALSE; } <API key>( space_id, name, is_temp, TRUE, !is_temp); } else { /* It is a normal database startup: create the space object and check that the .ibd file exists. */ <API key>(FALSE, space_id, flags, name); } mem_free(name); if (space_id > max_space_id) { max_space_id = space_id; } mtr_start(&mtr); <API key>(BTR_SEARCH_LEAF, &pcur, &mtr); } goto loop; } /** Loads a table column definition from a SYS_COLUMNS record to dict_table_t. @return error message, or NULL on success */ UNIV_INTERN const char* <API key>( dict_table_t* table, /*!< in/out: table, could be NULL if we just populate a dict_column_t struct with information from a SYS_COLUMNS record */ mem_heap_t* heap, /*!< in/out: memory heap for temporary storage */ dict_col_t* column, /*!< out: dict_column_t to fill, or NULL if table != NULL */ table_id_t* table_id, /*!< out: table id */ const char** col_name, /*!< out: column name */ const rec_t* rec) /*!< in: SYS_COLUMNS record */ { char* name; const byte* field; ulint len; ulint mtype; ulint prtype; ulint col_len; ulint pos; ut_ad(table || column); if (UNIV_UNLIKELY(<API key>(rec, 0))) { return("delete-marked record in SYS_COLUMNS"); } if (UNIV_UNLIKELY(<API key>(rec) != 9)) { return("wrong number of columns in SYS_COLUMNS record"); } field = <API key>(rec, 0/*TABLE_ID*/, &len); if (UNIV_UNLIKELY(len != 8)) { err_len: return("incorrect column length in SYS_COLUMNS"); } if (table_id) { *table_id = mach_read_from_8(field); } else if (UNIV_UNLIKELY(table->id != mach_read_from_8(field))) { return("SYS_COLUMNS.TABLE_ID mismatch"); } field = <API key>(rec, 1/*POS*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } pos = mach_read_from_4(field); if (UNIV_UNLIKELY(table && table->n_def != pos)) { return("SYS_COLUMNS.POS mismatch"); } <API key>(rec, 2/*DB_TRX_ID*/, &len); if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) { goto err_len; } <API key>(rec, 3/*DB_ROLL_PTR*/, &len); if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) { goto err_len; } field = <API key>(rec, 4/*NAME*/, &len); if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) { goto err_len; } name = mem_heap_strdupl(heap, (const char*) field, len); if (col_name) { *col_name = name; } field = <API key>(rec, 5/*MTYPE*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } mtype = mach_read_from_4(field); field = <API key>(rec, 6/*PRTYPE*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } prtype = mach_read_from_4(field); if (<API key>(prtype) == 0 && <API key>(mtype)) { /* The table was created with < 4.1.2. */ if (<API key>(mtype, prtype)) { /* Use the binary collation for string columns of binary type. */ prtype = dtype_form_prtype( prtype, <API key>); } else { /* Use the default charset for other than binary columns. */ prtype = dtype_form_prtype( prtype, <API key>); } } field = <API key>(rec, 7/*LEN*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } col_len = mach_read_from_4(field); field = <API key>(rec, 8/*PREC*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } if (!column) { <API key>(table, heap, name, mtype, prtype, col_len); } else { <API key>(column, pos, mtype, prtype, col_len); } return(NULL); } /** Loads definitions for table columns. */ static void dict_load_columns( dict_table_t* table, /*!< in/out: table */ mem_heap_t* heap) /*!< in/out: memory heap for temporary storage */ { dict_table_t* sys_columns; dict_index_t* sys_index; btr_pcur_t pcur; dtuple_t* tuple; dfield_t* dfield; const rec_t* rec; byte* buf; ulint i; mtr_t mtr; ut_ad(mutex_own(&(dict_sys->mutex))); mtr_start(&mtr); sys_columns = dict_table_get_low("SYS_COLUMNS"); sys_index = UT_LIST_GET_FIRST(sys_columns->indexes); ut_a(!dict_table_is_comp(sys_columns)); ut_a(name_of_col_is(sys_columns, sys_index, 4, "NAME")); ut_a(name_of_col_is(sys_columns, sys_index, 8, "PREC")); tuple = dtuple_create(heap, 1); dfield = <API key>(tuple, 0); buf = mem_heap_alloc(heap, 8); mach_write_to_8(buf, table->id); dfield_set_data(dfield, buf, 8); <API key>(tuple, sys_index, 1); <API key>(sys_index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); for (i = 0; i + DATA_N_SYS_COLS < (ulint) table->n_cols; i++) { const char* err_msg; rec = btr_pcur_get_rec(&pcur); ut_a(<API key>(&pcur)); err_msg = <API key>(table, heap, NULL, NULL, NULL, rec); if (err_msg) { fprintf(stderr, "InnoDB: %s\n", err_msg); ut_error; } <API key>(&pcur, &mtr); } btr_pcur_close(&pcur); mtr_commit(&mtr); } /** Error message for a delete-marked record in dict_load_field_low() */ static const char* dict_load_field_del = "delete-marked record in SYS_FIELDS"; static const char* <API key> = "column prefix exceeds maximum" " limit"; /** Loads an index field definition from a SYS_FIELDS record to dict_index_t. @return error message, or NULL on success */ UNIV_INTERN const char* dict_load_field_low( byte* index_id, /*!< in/out: index id (8 bytes) an "in" value if index != NULL and "out" if index == NULL */ dict_index_t* index, /*!< in/out: index, could be NULL if we just populate a dict_field_t struct with information from a SYS_FIELDSS record */ dict_field_t* sys_field, /*!< out: dict_field_t to be filled */ ulint* pos, /*!< out: Field position */ byte* last_index_id, /*!< in: last index id */ mem_heap_t* heap, /*!< in/out: memory heap for temporary storage */ const rec_t* rec, /*!< in: SYS_FIELDS record */ char* addition_err_str,/*!< out: additional error message that requires information to be filled, or NULL */ ulint err_str_len) /*!< in: length of addition_err_str in bytes */ { const byte* field; ulint len; ulint pos_and_prefix_len; ulint prefix_len; ibool first_field; ulint position; /* Either index or sys_field is supplied, not both */ ut_a((!index) || (!sys_field)); if (UNIV_UNLIKELY(<API key>(rec, 0))) { return(dict_load_field_del); } if (UNIV_UNLIKELY(<API key>(rec) != 5)) { return("wrong number of columns in SYS_FIELDS record"); } field = <API key>(rec, 0/*INDEX_ID*/, &len); if (UNIV_UNLIKELY(len != 8)) { err_len: return("incorrect column length in SYS_FIELDS"); } if (!index) { ut_a(last_index_id); memcpy(index_id, (const char*)field, 8); first_field = memcmp(index_id, last_index_id, 8); } else { first_field = (index->n_def == 0); if (memcmp(field, index_id, 8)) { return("SYS_FIELDS.INDEX_ID mismatch"); } } field = <API key>(rec, 1/*POS*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } <API key>(rec, 2/*DB_TRX_ID*/, &len); if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) { goto err_len; } <API key>(rec, 3/*DB_ROLL_PTR*/, &len); if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) { goto err_len; } /* The next field stores the field position in the index and a possible column prefix length if the index field does not contain the whole column. The storage format is like this: if there is at least one prefix field in the index, then the HIGH 2 bytes contain the field number (index->n_def) and the low 2 bytes the prefix length for the field. Otherwise the field number (index->n_def) is contained in the 2 LOW bytes. */ pos_and_prefix_len = mach_read_from_4(field); if (index && UNIV_UNLIKELY ((pos_and_prefix_len & 0xFFFFUL) != index->n_def && (pos_and_prefix_len >> 16 & 0xFFFF) != index->n_def)) { return("SYS_FIELDS.POS mismatch"); } if (first_field || pos_and_prefix_len > 0xFFFFUL) { prefix_len = pos_and_prefix_len & 0xFFFFUL; position = (pos_and_prefix_len & 0xFFFF0000UL) >> 16; } else { prefix_len = 0; position = pos_and_prefix_len & 0xFFFFUL; } field = <API key>(rec, 4, &len); if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) { goto err_len; } if (prefix_len > <API key>) { if (addition_err_str) { ut_snprintf(addition_err_str, err_str_len, "index field '%s' has a prefix length" " of %lu bytes", mem_heap_strdupl( heap, (const char*) field, len), (ulong) prefix_len); } return(<API key>); } if (index) { <API key>( index, mem_heap_strdupl(heap, (const char*) field, len), prefix_len); } else { ut_a(sys_field); ut_a(pos); sys_field->name = mem_heap_strdupl( heap, (const char*) field, len); sys_field->prefix_len = prefix_len; *pos = position; } return(NULL); } /** Loads definitions for index fields. @return DB_SUCCESS if ok, DB_CORRUPTION if corruption */ static ulint dict_load_fields( dict_index_t* index, /*!< in/out: index whose fields to load */ mem_heap_t* heap) /*!< in: memory heap for temporary storage */ { dict_table_t* sys_fields; dict_index_t* sys_index; btr_pcur_t pcur; dtuple_t* tuple; dfield_t* dfield; const rec_t* rec; byte* buf; ulint i; mtr_t mtr; ulint error; ut_ad(mutex_own(&(dict_sys->mutex))); mtr_start(&mtr); sys_fields = dict_table_get_low("SYS_FIELDS"); sys_index = UT_LIST_GET_FIRST(sys_fields->indexes); ut_a(!dict_table_is_comp(sys_fields)); ut_a(name_of_col_is(sys_fields, sys_index, 4, "COL_NAME")); tuple = dtuple_create(heap, 1); dfield = <API key>(tuple, 0); buf = mem_heap_alloc(heap, 8); mach_write_to_8(buf, index->id); dfield_set_data(dfield, buf, 8); <API key>(tuple, sys_index, 1); <API key>(sys_index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); for (i = 0; i < index->n_fields; i++) { const char* err_msg; char addition_err_str[1024]; rec = btr_pcur_get_rec(&pcur); ut_a(<API key>(&pcur)); err_msg = dict_load_field_low(buf, index, NULL, NULL, NULL, heap, rec, addition_err_str, sizeof(addition_err_str)); if (err_msg == dict_load_field_del) { /* There could be delete marked records in SYS_FIELDS because SYS_FIELDS.INDEX_ID can be updated by ALTER TABLE ADD INDEX. */ goto next_rec; } else if (err_msg) { if (err_msg == <API key>) { fprintf(stderr, "InnoDB: Error: load index" " '%s' failed.\n" "InnoDB: %s,\n" "InnoDB: which exceeds the" " maximum limit of %lu bytes.\n" "InnoDB: Please use server that" " supports long index prefix\n" "InnoDB: or turn on" " <API key> to load" " the table\n", index->name, addition_err_str, (ulong) (<API key>)); } else { fprintf(stderr, "InnoDB: %s\n", err_msg); } error = DB_CORRUPTION; goto func_exit; } next_rec: <API key>(&pcur, &mtr); } error = DB_SUCCESS; func_exit: btr_pcur_close(&pcur); mtr_commit(&mtr); return(error); } /** Error message for a delete-marked record in dict_load_index_low() */ static const char* dict_load_index_del = "delete-marked record in SYS_INDEXES"; /** Error message for table->id mismatch in dict_load_index_low() */ static const char* <API key> = "SYS_INDEXES.TABLE_ID mismatch"; /** Loads an index definition from a SYS_INDEXES record to dict_index_t. If allocate=TRUE, we will create a dict_index_t structure and fill it accordingly. If allocated=FALSE, the dict_index_t will be supplied by the caller and filled with information read from the record. @return error message, or NULL on success */ UNIV_INTERN const char* dict_load_index_low( byte* table_id, /*!< in/out: table id (8 bytes), an "in" value if allocate=TRUE and "out" when allocate=FALSE */ const char* table_name, /*!< in: table name */ mem_heap_t* heap, /*!< in/out: temporary memory heap */ const rec_t* rec, /*!< in: SYS_INDEXES record */ ibool allocate, /*!< in: TRUE=allocate *index, FALSE=fill in a pre-allocated *index */ dict_index_t** index) /*!< out,own: index, or NULL */ { const byte* field; ulint len; ulint name_len; char* name_buf; index_id_t id; ulint n_fields; ulint type; ulint space; if (allocate) { /* If allocate=TRUE, no dict_index_t will be supplied. Initialize "*index" to NULL */ *index = NULL; } if (UNIV_UNLIKELY(<API key>(rec, 0))) { return(dict_load_index_del); } if (UNIV_UNLIKELY(<API key>(rec) != 9)) { return("wrong number of columns in SYS_INDEXES record"); } field = <API key>(rec, 0/*TABLE_ID*/, &len); if (UNIV_UNLIKELY(len != 8)) { err_len: return("incorrect column length in SYS_INDEXES"); } if (!allocate) { /* We are reading a SYS_INDEXES record. Copy the table_id */ memcpy(table_id, (const char*)field, 8); } else if (memcmp(field, table_id, 8)) { /* Caller supplied table_id, verify it is the same id as on the index record */ return(<API key>); } field = <API key>(rec, 1, &len); if (UNIV_UNLIKELY(len != 8)) { goto err_len; } id = mach_read_from_8(field); <API key>(rec, 2/*DB_TRX_ID*/, &len); if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) { goto err_len; } <API key>(rec, 3/*DB_ROLL_PTR*/, &len); if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) { goto err_len; } field = <API key>(rec, 4/*NAME*/, &name_len); if (UNIV_UNLIKELY(name_len == UNIV_SQL_NULL)) { goto err_len; } name_buf = mem_heap_strdupl(heap, (const char*) field, name_len); field = <API key>(rec, 5/*N_FIELDS*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } n_fields = mach_read_from_4(field); field = <API key>(rec, 6/*TYPE*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } type = mach_read_from_4(field); field = <API key>(rec, 7/*SPACE*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } space = mach_read_from_4(field); field = <API key>(rec, 8/*PAGE_NO*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } if (allocate) { *index = <API key>(table_name, name_buf, space, type, n_fields); } else { ut_a(*index); <API key>(*index, NULL, NULL, name_buf, space, type, n_fields); } (*index)->id = id; (*index)->page = mach_read_from_4(field); ut_ad((*index)->page); return(NULL); } /** Loads definitions for table indexes. Adds them to the data dictionary cache. @return DB_SUCCESS if ok, DB_CORRUPTION if corruption of dictionary table or DB_UNSUPPORTED if table has unknown index type */ static ulint dict_load_indexes( dict_table_t* table, /*!< in/out: table */ mem_heap_t* heap, /*!< in: memory heap for temporary storage */ dict_err_ignore_t ignore_err) /*!< in: error to be ignored when loading the index definition */ { dict_table_t* sys_indexes; dict_index_t* sys_index; btr_pcur_t pcur; dtuple_t* tuple; dfield_t* dfield; const rec_t* rec; byte* buf; mtr_t mtr; ulint error = DB_SUCCESS; ut_ad(mutex_own(&(dict_sys->mutex))); mtr_start(&mtr); sys_indexes = dict_table_get_low("SYS_INDEXES"); sys_index = UT_LIST_GET_FIRST(sys_indexes->indexes); ut_a(!dict_table_is_comp(sys_indexes)); ut_a(name_of_col_is(sys_indexes, sys_index, 4, "NAME")); ut_a(name_of_col_is(sys_indexes, sys_index, 8, "PAGE_NO")); tuple = dtuple_create(heap, 1); dfield = <API key>(tuple, 0); buf = mem_heap_alloc(heap, 8); mach_write_to_8(buf, table->id); dfield_set_data(dfield, buf, 8); <API key>(tuple, sys_index, 1); <API key>(sys_index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); for (;;) { dict_index_t* index = NULL; const char* err_msg; if (!<API key>(&pcur)) { break; } rec = btr_pcur_get_rec(&pcur); err_msg = dict_load_index_low(buf, table->name, heap, rec, TRUE, &index); ut_ad((index == NULL) == (err_msg != NULL)); if (err_msg == <API key>) { /* TABLE_ID mismatch means that we have run out of index definitions for the table. */ break; } else if (err_msg == dict_load_index_del) { /* Skip delete-marked records. */ goto next_rec; } else if (err_msg) { fprintf(stderr, "InnoDB: %s\n", err_msg); error = DB_CORRUPTION; goto func_exit; } ut_ad(index); /* We check for unsupported types first, so that the subsequent checks are relevant for the supported types. */ if (index->type & ~(DICT_CLUSTERED | DICT_UNIQUE)) { fprintf(stderr, "InnoDB: Error: unknown type %lu" " of index %s of table %s\n", (ulong) index->type, index->name, table->name); error = DB_UNSUPPORTED; dict_mem_index_free(index); goto func_exit; } else if (index->page == FIL_NULL) { fprintf(stderr, "InnoDB: Error: trying to load index %s" " for table %s\n" "InnoDB: but the index tree has been freed!\n", index->name, table->name); if (ignore_err & <API key>) { /* If caller can tolerate this error, we will continue to load the index and let caller deal with this error. However mark the index and table corrupted */ index->corrupted = TRUE; table->corrupted = TRUE; fprintf(stderr, "InnoDB: Index is corrupt but forcing" " load into data dictionary\n"); } else { corrupted: dict_mem_index_free(index); error = DB_CORRUPTION; goto func_exit; } } else if (!dict_index_is_clust(index) && NULL == <API key>(table)) { fputs("InnoDB: Error: trying to load index ", stderr); ut_print_name(stderr, NULL, FALSE, index->name); fputs(" for table ", stderr); ut_print_name(stderr, NULL, TRUE, table->name); fputs("\nInnoDB: but the first index" " is not clustered!\n", stderr); goto corrupted; } else if (table->id < DICT_HDR_FIRST_ID && (dict_index_is_clust(index) || ((table == dict_sys->sys_tables) && !strcmp("ID_IND", index->name)))) { /* The index was created in memory already at booting of the database server */ dict_mem_index_free(index); } else { error = dict_load_fields(index, heap); if (error != DB_SUCCESS) { fprintf(stderr, "InnoDB: Error: load index '%s'" " for table '%s' failed\n", index->name, table->name); /* If the force recovery flag is set, and if the failed index is not the primary index, we will continue and open other indexes */ if (srv_force_recovery && !dict_index_is_clust(index)) { error = DB_SUCCESS; goto next_rec; } else { goto func_exit; } } error = <API key>(table, index, index->page, FALSE); /* The data dictionary tables should never contain invalid index definitions. If we ignored this error and simply did not load this index definition, the .frm file would disagree with the index definitions inside InnoDB. */ if (UNIV_UNLIKELY(error != DB_SUCCESS)) { goto func_exit; } } next_rec: <API key>(&pcur, &mtr); } func_exit: btr_pcur_close(&pcur); mtr_commit(&mtr); return(error); } /** Loads a table definition from a SYS_TABLES record to dict_table_t. Does not load any columns or indexes. @return error message, or NULL on success */ UNIV_INTERN const char* dict_load_table_low( const char* name, /*!< in: table name */ const rec_t* rec, /*!< in: SYS_TABLES record */ dict_table_t** table) /*!< out,own: table, or NULL */ { const byte* field; ulint len; ulint space; ulint n_cols; ulint flags; if (UNIV_UNLIKELY(<API key>(rec, 0))) { return("delete-marked record in SYS_TABLES"); } if (UNIV_UNLIKELY(<API key>(rec) != 10)) { return("wrong number of columns in SYS_TABLES record"); } <API key>(rec, 0/*NAME*/, &len); if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) { err_len: return("incorrect column length in SYS_TABLES"); } <API key>(rec, 1/*DB_TRX_ID*/, &len); if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) { goto err_len; } <API key>(rec, 2/*DB_ROLL_PTR*/, &len); if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) { goto err_len; } <API key>(rec, 3, &len); if (UNIV_UNLIKELY(len != 8)) { goto err_len; } field = <API key>(rec, 4/*N_COLS*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } n_cols = mach_read_from_4(field); <API key>(rec, 5/*TYPE*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } <API key>(rec, 6/*MIX_ID*/, &len); if (UNIV_UNLIKELY(len != 8)) { goto err_len; } <API key>(rec, 7/*MIX_LEN*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } <API key>(rec, 8/*CLUSTER_ID*/, &len); if (UNIV_UNLIKELY(len != UNIV_SQL_NULL)) { goto err_len; } field = <API key>(rec, 9/*SPACE*/, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } space = mach_read_from_4(field); /* Check if the tablespace exists and has the right name */ if (space != 0) { flags = <API key>(rec); if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) { field = <API key>(rec, 5/*TYPE*/, &len); ut_ad(len == 4); /* this was checked earlier */ flags = mach_read_from_4(field); ut_print_timestamp(stderr); fputs(" InnoDB: Error: table ", stderr); ut_print_filename(stderr, name); fprintf(stderr, "\n" "InnoDB: in InnoDB data dictionary" " has unknown type %lx.\n", (ulong) flags); return("incorrect flags in SYS_TABLES"); } } else { flags = 0; } /* The high-order bit of N_COLS is the "compact format" flag. For tables in that format, MIX_LEN may hold additional flags. */ if (n_cols & 0x80000000UL) { ulint flags2; flags |= DICT_TF_COMPACT; field = <API key>(rec, 7, &len); if (UNIV_UNLIKELY(len != 4)) { goto err_len; } flags2 = mach_read_from_4(field); if (flags2 & (~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT))) { ut_print_timestamp(stderr); fputs(" InnoDB: Warning: table ", stderr); ut_print_filename(stderr, name); fprintf(stderr, "\n" "InnoDB: in InnoDB data dictionary" " has unknown flags %lx.\n", (ulong) flags2); flags2 &= ~(~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT)); } flags |= flags2 << DICT_TF2_SHIFT; } /* See if the tablespace is available. */ *table = <API key>(name, space, n_cols & ~0x80000000UL, flags); field = <API key>(rec, 3, &len); ut_ad(len == 8); /* this was checked earlier */ (*table)->id = mach_read_from_8(field); (*table)->ibd_file_missing = FALSE; return(NULL); } /** Loads a table definition and also all its index definitions, and also the cluster definition if the table is a member in a cluster. Also loads all foreign key constraints where the foreign key is in the table or where a foreign key references columns in this table. Adds all these to the data dictionary cache. @return table, NULL if does not exist; if the table is stored in an .ibd file, but the file does not exist, then we set the ibd_file_missing flag TRUE in the table object we return */ UNIV_INTERN dict_table_t* dict_load_table( const char* name, /*!< in: table name in the databasename/tablename format */ ibool cached, /*!< in: TRUE=add to cache, FALSE=do not */ dict_err_ignore_t ignore_err) /*!< in: error to be ignored when loading table and its indexes' definition */ { dict_table_t* table; dict_table_t* sys_tables; btr_pcur_t pcur; dict_index_t* sys_index; dtuple_t* tuple; mem_heap_t* heap; dfield_t* dfield; const rec_t* rec; const byte* field; ulint len; ulint err; const char* err_msg; mtr_t mtr; ut_ad(mutex_own(&(dict_sys->mutex))); heap = mem_heap_create(32000); mtr_start(&mtr); sys_tables = dict_table_get_low("SYS_TABLES"); sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); ut_a(!dict_table_is_comp(sys_tables)); ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID")); ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS")); ut_a(name_of_col_is(sys_tables, sys_index, 5, "TYPE")); ut_a(name_of_col_is(sys_tables, sys_index, 7, "MIX_LEN")); ut_a(name_of_col_is(sys_tables, sys_index, 9, "SPACE")); tuple = dtuple_create(heap, 1); dfield = <API key>(tuple, 0); dfield_set_data(dfield, name, ut_strlen(name)); <API key>(tuple, sys_index, 1); <API key>(sys_index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); rec = btr_pcur_get_rec(&pcur); if (!<API key>(&pcur) || <API key>(rec, 0)) { /* Not found */ err_exit: btr_pcur_close(&pcur); mtr_commit(&mtr); mem_heap_free(heap); return(NULL); } field = <API key>(rec, 0, &len); /* Check if the table name in record is the searched one */ if (len != ut_strlen(name) || ut_memcmp(name, field, len) != 0) { goto err_exit; } err_msg = dict_load_table_low(name, rec, &table); if (err_msg) { ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: %s\n", err_msg); goto err_exit; } if (table->space == 0) { /* The system tablespace is always available. */ } else if (!<API key>( table->space, name, (table->flags >> DICT_TF2_SHIFT) & DICT_TF2_TEMPORARY, FALSE, FALSE)) { if (table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT)) { /* Do not bother to retry opening temporary tables. */ table->ibd_file_missing = TRUE; } else { ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: error: space object of table "); ut_print_filename(stderr, name); fprintf(stderr, ",\n" "InnoDB: space id %lu did not exist in memory." " Retrying an open.\n", (ulong) table->space); /* Try to open the tablespace */ if (!<API key>( TRUE, table->space, table->flags == DICT_TF_COMPACT ? 0 : table->flags & ~(~0 << DICT_TF_BITS), name)) { /* We failed to find a sensible tablespace file */ table->ibd_file_missing = TRUE; } } } btr_pcur_close(&pcur); mtr_commit(&mtr); dict_load_columns(table, heap); if (cached) { <API key>(table, heap); } else { <API key>(table, heap); } mem_heap_empty(heap); err = dict_load_indexes(table, heap, ignore_err); /* Initialize table foreign_child value. Its value could be changed when dict_load_foreigns() is called below */ table-><API key> = 0; /* If the force recovery flag is set, we open the table irrespective of the error condition, since the user may want to dump data from the clustered index. However we load the foreign key information only if all indexes were loaded. */ if (!cached) { } else if (err == DB_SUCCESS) { err = dict_load_foreigns(table->name, TRUE, TRUE); if (err != DB_SUCCESS) { <API key>(table); table = NULL; } else { table-><API key> = 0; } } else { dict_index_t* index; /* Make sure that at least the clustered index was loaded. Otherwise refuse to load the table */ index = <API key>(table); if (!srv_force_recovery || !index || !dict_index_is_clust(index)) { <API key>(table); table = NULL; } } #if 0 if (err != DB_SUCCESS && table != NULL) { mutex_enter(&<API key>); ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Error: could not make a foreign key" " definition to match\n" "InnoDB: the foreign key table" " or the referenced table!\n" "InnoDB: The data dictionary of InnoDB is corrupt." " You may need to drop\n" "InnoDB: and recreate the foreign key table" " or the referenced table.\n" "InnoDB: Submit a detailed bug report" " to http://bugs.mysql.com\n" "InnoDB: Latest foreign key error printout:\n%s\n", <API key>); mutex_exit(&<API key>); } #endif mem_heap_free(heap); return(table); } /** Loads a table object based on the table id. @return table; NULL if table does not exist */ UNIV_INTERN dict_table_t* <API key>( table_id_t table_id) /*!< in: table id */ { byte id_buf[8]; btr_pcur_t pcur; mem_heap_t* heap; dtuple_t* tuple; dfield_t* dfield; dict_index_t* sys_table_ids; dict_table_t* sys_tables; const rec_t* rec; const byte* field; ulint len; dict_table_t* table; mtr_t mtr; ut_ad(mutex_own(&(dict_sys->mutex))); table = NULL; /* NOTE that the operation of this function is protected by the dictionary mutex, and therefore no deadlocks can occur with other dictionary operations. */ mtr_start(&mtr); /* Get the secondary index based on ID for table SYS_TABLES */ sys_tables = dict_sys->sys_tables; sys_table_ids = <API key>( <API key>(sys_tables)); ut_a(!dict_table_is_comp(sys_tables)); heap = mem_heap_create(256); tuple = dtuple_create(heap, 1); dfield = <API key>(tuple, 0); /* Write the table id in byte format to id_buf */ mach_write_to_8(id_buf, table_id); dfield_set_data(dfield, id_buf, 8); <API key>(tuple, sys_table_ids, 1); <API key>(sys_table_ids, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); rec = btr_pcur_get_rec(&pcur); if (!<API key>(&pcur)) { /* Not found */ goto func_exit; } /* Find the first record that is not delete marked */ while (<API key>(rec, 0)) { if (!<API key>(&pcur, &mtr)) { goto func_exit; } rec = btr_pcur_get_rec(&pcur); } /* Now we have the record in the secondary index containing the table ID and NAME */ rec = btr_pcur_get_rec(&pcur); field = <API key>(rec, 0, &len); ut_ad(len == 8); /* Check if the table id in record is the one searched for */ if (table_id != mach_read_from_8(field)) { goto func_exit; } /* Now we get the table name from the record */ field = <API key>(rec, 1, &len); /* Load the table definition to memory */ table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len), TRUE, <API key>); func_exit: btr_pcur_close(&pcur); mtr_commit(&mtr); mem_heap_free(heap); return(table); } /** This function is called when the database is booted. Loads system table index definitions except for the clustered index which is added to the dictionary cache at booting before calling this function. */ UNIV_INTERN void dict_load_sys_table( dict_table_t* table) /*!< in: system table */ { mem_heap_t* heap; ut_ad(mutex_own(&(dict_sys->mutex))); heap = mem_heap_create(1000); dict_load_indexes(table, heap, <API key>); mem_heap_free(heap); } /** Loads foreign key constraint col names (also for the referenced table). */ static void <API key>( const char* id, /*!< in: foreign constraint id as a null-terminated string */ dict_foreign_t* foreign)/*!< in: foreign constraint object */ { dict_table_t* sys_foreign_cols; dict_index_t* sys_index; btr_pcur_t pcur; dtuple_t* tuple; dfield_t* dfield; const rec_t* rec; const byte* field; ulint len; ulint i; mtr_t mtr; ut_ad(mutex_own(&(dict_sys->mutex))); foreign->foreign_col_names = mem_heap_alloc( foreign->heap, foreign->n_fields * sizeof(void*)); foreign-><API key> = mem_heap_alloc( foreign->heap, foreign->n_fields * sizeof(void*)); mtr_start(&mtr); sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS"); sys_index = UT_LIST_GET_FIRST(sys_foreign_cols->indexes); ut_a(!dict_table_is_comp(sys_foreign_cols)); tuple = dtuple_create(foreign->heap, 1); dfield = <API key>(tuple, 0); dfield_set_data(dfield, id, ut_strlen(id)); <API key>(tuple, sys_index, 1); <API key>(sys_index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); for (i = 0; i < foreign->n_fields; i++) { rec = btr_pcur_get_rec(&pcur); ut_a(<API key>(&pcur)); ut_a(!<API key>(rec, 0)); field = <API key>(rec, 0, &len); ut_a(len == ut_strlen(id)); ut_a(ut_memcmp(id, field, len) == 0); field = <API key>(rec, 1, &len); ut_a(len == 4); ut_a(i == mach_read_from_4(field)); field = <API key>(rec, 4, &len); foreign->foreign_col_names[i] = mem_heap_strdupl( foreign->heap, (char*) field, len); field = <API key>(rec, 5, &len); foreign-><API key>[i] = mem_heap_strdupl( foreign->heap, (char*) field, len); <API key>(&pcur, &mtr); } btr_pcur_close(&pcur); mtr_commit(&mtr); } /** Loads a foreign key constraint to the dictionary cache. @return DB_SUCCESS or error code */ static ulint dict_load_foreign( const char* id, /*!< in: foreign constraint id as a null-terminated string */ ibool check_charsets, /*!< in: TRUE=check charset compatibility */ ibool check_recursive) /*!< in: Whether to record the foreign table parent count to avoid unlimited recursive load of chained foreign tables */ { dict_foreign_t* foreign; dict_table_t* sys_foreign; btr_pcur_t pcur; dict_index_t* sys_index; dtuple_t* tuple; mem_heap_t* heap2; dfield_t* dfield; const rec_t* rec; const byte* field; ulint len; ulint n_fields_and_type; mtr_t mtr; dict_table_t* for_table; dict_table_t* ref_table; ut_ad(mutex_own(&(dict_sys->mutex))); heap2 = mem_heap_create(1000); mtr_start(&mtr); sys_foreign = dict_table_get_low("SYS_FOREIGN"); sys_index = UT_LIST_GET_FIRST(sys_foreign->indexes); ut_a(!dict_table_is_comp(sys_foreign)); tuple = dtuple_create(heap2, 1); dfield = <API key>(tuple, 0); dfield_set_data(dfield, id, ut_strlen(id)); <API key>(tuple, sys_index, 1); <API key>(sys_index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); rec = btr_pcur_get_rec(&pcur); if (!<API key>(&pcur) || <API key>(rec, 0)) { /* Not found */ fprintf(stderr, "InnoDB: Error A: cannot load foreign constraint %s\n", id); btr_pcur_close(&pcur); mtr_commit(&mtr); mem_heap_free(heap2); return(DB_ERROR); } field = <API key>(rec, 0, &len); /* Check if the id in record is the searched one */ if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) { fprintf(stderr, "InnoDB: Error B: cannot load foreign constraint %s\n", id); btr_pcur_close(&pcur); mtr_commit(&mtr); mem_heap_free(heap2); return(DB_ERROR); } /* Read the table names and the number of columns associated with the constraint */ mem_heap_free(heap2); foreign = <API key>(); n_fields_and_type = mach_read_from_4( <API key>(rec, 5, &len)); ut_a(len == 4); /* We store the type in the bits 24..29 of n_fields_and_type. */ foreign->type = (unsigned int) (n_fields_and_type >> 24); foreign->n_fields = (unsigned int) (n_fields_and_type & 0x3FFUL); foreign->id = mem_heap_strdup(foreign->heap, id); field = <API key>(rec, 3, &len); foreign->foreign_table_name = mem_heap_strdupl( foreign->heap, (char*) field, len); <API key>(foreign, TRUE); field = <API key>(rec, 4, &len); foreign-><API key> = mem_heap_strdupl( foreign->heap, (char*) field, len); <API key>(foreign, TRUE); btr_pcur_close(&pcur); mtr_commit(&mtr); <API key>(id, foreign); ref_table = <API key>( foreign-><API key>); /* We could possibly wind up in a deep recursive calls if we call dict_table_get_low() again here if there is a chain of tables concatenated together with foreign constraints. In such case, each table is both a parent and child of the other tables, and act as a "link" in such table chains. To avoid such scenario, we would need to check the number of ancesters the current table has. If that exceeds <API key>, we will stop loading the child table. Foreign constraints are loaded in a Breath First fashion, that is, the index on FOR_NAME is scanned first, and then index on REF_NAME. So foreign constrains in which current table is a child (foreign table) are loaded first, and then those constraints where current table is a parent (referenced) table. Thus we could check the parent (ref_table) table's reference count (<API key>) to know how deep the recursive call is. If the parent table (ref_table) is already loaded, and its <API key> is larger than <API key>, we will stop the recursive loading by skipping loading the child table. It will not affect foreign constraint check for DMLs since child table will be loaded at that time for the constraint check. */ if (!ref_table || ref_table-><API key> < <API key>) { /* If the foreign table is not yet in the dictionary cache, we have to load it so that we are able to make type comparisons in the next function call. */ for_table = dict_table_get_low(foreign-><API key>); if (for_table && ref_table && check_recursive) { /* This is to record the longest chain of ancesters this table has, if the parent has more ancesters than this table has, record it after add 1 (for this parent */ if (ref_table-><API key> >= for_table-><API key>) { for_table-><API key> = ref_table-><API key> + 1; } } } /* Note that there may already be a foreign constraint object in the dictionary cache for this constraint: then the following call only sets the pointers in it to point to the appropriate table and index objects and frees the newly created object foreign. Adding to the cache should always succeed since we are not creating a new foreign key constraint but loading one from the data dictionary. */ return(<API key>(foreign, check_charsets)); } /** Loads foreign key constraints where the table is either the foreign key holder or where the table is referenced by a foreign key. Adds these constraints to the data dictionary. Note that we know that the dictionary cache already contains all constraints where the other relevant table is already in the dictionary cache. @return DB_SUCCESS or error code */ UNIV_INTERN ulint dict_load_foreigns( const char* table_name, /*!< in: table name */ ibool check_recursive,/*!< in: Whether to check recursive load of tables chained by FK */ ibool check_charsets) /*!< in: TRUE=check charset compatibility */ { btr_pcur_t pcur; mem_heap_t* heap; dtuple_t* tuple; dfield_t* dfield; dict_index_t* sec_index; dict_table_t* sys_foreign; const rec_t* rec; const byte* field; ulint len; char* id ; ulint err; mtr_t mtr; ut_ad(mutex_own(&(dict_sys->mutex))); sys_foreign = dict_table_get_low("SYS_FOREIGN"); if (sys_foreign == NULL) { /* No foreign keys defined yet in this database */ fprintf(stderr, "InnoDB: Error: no foreign key system tables" " in the database\n"); return(DB_ERROR); } ut_a(!dict_table_is_comp(sys_foreign)); mtr_start(&mtr); /* Get the secondary index based on FOR_NAME from table SYS_FOREIGN */ sec_index = <API key>( <API key>(sys_foreign)); start_load: heap = mem_heap_create(256); tuple = dtuple_create(heap, 1); dfield = <API key>(tuple, 0); dfield_set_data(dfield, table_name, ut_strlen(table_name)); <API key>(tuple, sec_index, 1); <API key>(sec_index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); loop: rec = btr_pcur_get_rec(&pcur); if (!<API key>(&pcur)) { /* End of index */ goto load_next_index; } /* Now we have the record in the secondary index containing a table name and a foreign constraint ID */ rec = btr_pcur_get_rec(&pcur); field = <API key>(rec, 0, &len); /* Check if the table name in the record is the one searched for; the following call does the comparison in the latin1_swedish_ci charset-collation, in a case-insensitive way. */ if (0 != cmp_data_data(dfield_get_type(dfield)->mtype, dfield_get_type(dfield)->prtype, dfield_get_data(dfield), dfield_get_len(dfield), field, len)) { goto load_next_index; } /* Since table names in SYS_FOREIGN are stored in a case-insensitive order, we have to check that the table name matches also in a binary string comparison. On Unix, MySQL allows table names that only differ in character case. If <API key>=2 then what is stored may not be the same case, but the previous comparison showed that they match with no-case. */ if ((<API key>() != 2) && (0 != ut_memcmp(field, table_name, len))) { goto next_rec; } if (<API key>(rec, 0)) { goto next_rec; } /* Now we get a foreign key constraint id */ field = <API key>(rec, 1, &len); id = mem_heap_strdupl(heap, (char*) field, len); <API key>(&pcur, &mtr); mtr_commit(&mtr); /* Load the foreign constraint definition to the dictionary cache */ err = dict_load_foreign(id, check_charsets, check_recursive); if (err != DB_SUCCESS) { btr_pcur_close(&pcur); mem_heap_free(heap); return(err); } mtr_start(&mtr); <API key>(BTR_SEARCH_LEAF, &pcur, &mtr); next_rec: <API key>(&pcur, &mtr); goto loop; load_next_index: btr_pcur_close(&pcur); mtr_commit(&mtr); mem_heap_free(heap); sec_index = <API key>(sec_index); if (sec_index != NULL) { mtr_start(&mtr); /* Switch to scan index on REF_NAME, <API key> already been updated when scanning FOR_NAME index, no need to update again */ check_recursive = FALSE; goto start_load; } return(DB_SUCCESS); }
<html> <head> <title>A3 ALiVE</title> </head> <body> <h1>A3 ALiVE News</h1> <p> </p> <p> <br />Unable to retrieve the latest News Online!<br /><br /> <br /><a href="http://alivemod.com">Full Details</a> <br /></br ><br /> </p> <p> <br /> <br /> </p> </body> </html>