text
stringlengths
2
1.04M
meta
dict
package com.example.weather.adapter; import java.util.List; import com.example.weather.R; import com.example.weather.utils.ViewHolder; import com.exmple.weather.entity.Weather; import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; public class FutureWeatherAdapter extends BaseAdapter { private Context context; private LayoutInflater infalter; private List<Weather> weatherList; public FutureWeatherAdapter(Context context,List<Weather> weatherList) { // TODO Auto-generated constructor stub this.context=context; this.weatherList=weatherList; infalter=LayoutInflater.from(context); } @Override public int getCount() { // TODO Auto-generated method stub return weatherList.size(); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return weatherList.get(position); } @Override public long getItemId(int position) { // TODO Auto-generated method stub return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub if(convertView==null){ convertView=infalter.inflate(R.layout.weather_list_item, null); } TextView date=ViewHolder.get(convertView,R.id.tv_date); TextView weather=ViewHolder.get(convertView,R.id.tv_weather); ImageView weather_pic=ViewHolder.get(convertView, R.id.iv_pic); date.setText(weatherList.get(position).getDate()); weather.setText(weatherList.get(position).getWeather()); weather_pic.setImageResource(weatherList.get(position).getWeather_pic()); return convertView; } }
{ "content_hash": "684926f16ecc4bdcc03da98aed35ab9e", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 78, "avg_line_length": 25.333333333333332, "alnum_prop": 0.7560307017543859, "repo_name": "rocrocflying/WeatherShow", "id": "6db00c891c7010bf132cb9a40006defe7d65bf2d", "size": "1824", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/com/example/weather/adapter/FutureWeatherAdapter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "40988" } ], "symlink_target": "" }
println("Running tests for Jags-j0.5-v1.0.2:") using Jags using Base.Test old = pwd() using Base.Test code_tests = ["test_cmd.jl";] println("Run execution_tests only if Jags is available") execution_tests = [ "test_line1.jl", "test_line2.jl", "test_rats.jl", "test_bones1.jl", "test_bones2.jl", "test_dyes.jl"; ] for my_test in code_tests println("\n * $(my_test) *") include(my_test) end if isdefined(Main, :JAGS_HOME) && length(JAGS_HOME) > 0 try for my_test in execution_tests println("\n * $(my_test) *") include(my_test) end println() catch e println("Is Jags properly installed?") println(e) println("No simulation runs have been performed.") end else println("\n\nJAGS_HOME not found. Skipping all tests that depend on the Jags executable!\n") end cd(old)
{ "content_hash": "29336ac23f172ae32c154a82e848d505", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 96, "avg_line_length": 19.386363636363637, "alnum_prop": 0.6330597889800703, "repo_name": "JuliaPackageMirrors/Jags.jl", "id": "04907c6cfec65fb039856283673ab29f29a49c9b", "size": "853", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/runtests.jl", "mode": "33188", "license": "mit", "language": [ { "name": "Julia", "bytes": "22090" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_92) on Mon Jul 05 14:32:28 BST 2021 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class com.github.rvesse.airline.DefaultCommandFactory (Airline - Library 2.8.2 API)</title> <meta name="date" content="2021-07-05"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class com.github.rvesse.airline.DefaultCommandFactory (Airline - Library 2.8.2 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../com/github/rvesse/airline/DefaultCommandFactory.html" title="class in com.github.rvesse.airline">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/github/rvesse/airline/class-use/DefaultCommandFactory.html" target="_top">Frames</a></li> <li><a href="DefaultCommandFactory.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class com.github.rvesse.airline.DefaultCommandFactory" class="title">Uses of Class<br>com.github.rvesse.airline.DefaultCommandFactory</h2> </div> <div class="classUseContainer">No usage of com.github.rvesse.airline.DefaultCommandFactory</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../com/github/rvesse/airline/DefaultCommandFactory.html" title="class in com.github.rvesse.airline">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/github/rvesse/airline/class-use/DefaultCommandFactory.html" target="_top">Frames</a></li> <li><a href="DefaultCommandFactory.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2012&#x2013;2021. All rights reserved.</small></p> </body> </html>
{ "content_hash": "ab2b72f6b317bc62fcedaeaea7cd4cd8", "timestamp": "", "source": "github", "line_count": 126, "max_line_length": 157, "avg_line_length": 37.30952380952381, "alnum_prop": 0.6234843650287173, "repo_name": "rvesse/airline", "id": "e86a9b7325c41b79cae0420ef1216e8340e88145", "size": "4701", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "docs/javadoc/2.8.2/airline/com/github/rvesse/airline/class-use/DefaultCommandFactory.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "91" }, { "name": "Java", "bytes": "2176058" }, { "name": "Shell", "bytes": "4550" } ], "symlink_target": "" }
var pkg = require("./package.json"); /* node modules */ var debug = require("debug"); var fs = require("fs"); var path = require("path"); var util = require("util"); /* imported modules */ var _ = require("lodash"); var async = require("async"); var Exif = require("exif").ExifImage; var GetOptions = require("node-getopt"); var log = require("custom-logger"); var moment = require("moment"); var multiline = require("multiline"); var readdirp = require("readdirp"); /* local variables */ var formatString = "YYYYMMDDHHmmss"; var jobState = { files: [], warnings: [], errors: [] }; var options = {}; _.templateSettings.interpolate = /{([\s\S]+?)}/g; init(); function init () { var cli = GetOptions.create([ ["s", "source=ARG", "Source folder (contains the photos to be processed)"], ["d", "destination=ARG", "Destination folder (where processed photos should be put)"], ["h", "help", "Get help on how to use this utility"] ]); var help = multiline.stripIndent(function () {/* River Birch v{version} Usage: node process-photos --source /path/to/photos/to/process --destination /path/to/put/processed/photos [[OPTIONS]] */}).replace("{version}", pkg.version); cli.setHelp(help); var args = cli.parseSystem(); if (args.options.help) { cli.showHelp(); } // Exit of a source directory is not specified if (!args.options.source || (args.options.source && args.options.source.length < 1)) { log.warn("A source directory must be specified"); process.exit(); } // Exit of a destination directory is not specified if (!args.options.destination || (args.options.destination && args.options.destination.length < 1)) { log.warn("A destination directory must be specified"); process.exit(); } // if we have both a source and a destination, we can proceed if ((args.options.source && args.options.source.length > 0) && (args.options.destination && args.options.destination.length > 0)) { options = { source: resolvePath(args.options.source), destination: resolvePath(args.options.destination) }; log.info(_.template("Processing photos in {source} and copying them to {destination}", options)); main(); } }; function resolvePath (path) { if (path.indexOf("~") > -1) { path = path.replace("~", process.env.HOME); } return path; }; function main () { async.series([ function (next) { fs.exists(options.source, function (exists) { if (exists) { fs.stat(options.source, function (err, stats) { if (stats && stats.isDirectory) { next(null, true) } else { next("Source is not a directory", false); } }); } else { next("Source directory does not exist", false); } }); }, function (next) { fs.exists(options.destination, function (exists) { if (exists) { fs.stat(options.destination, function (err, stats) { if (stats && stats.isDirectory) { next(null, true); } else { next("Destination is not a directory", false) } }) } else { fs.mkdir(options.destination, 0755, function (err) { if (!err) { next(null, true); } else { next("Error creating destination directory", false); } }); } }); } ], function (err, results) { if (_.all(results)) { // if all of the above functions completed successfully... processFiles(); } }); }; function processFiles () { /* Good reference: https://github.com/montanaflynn/photo-saver/blob/master/index.js */ readdirp({ root: options.source, fileFilter: ["*.jpg", "*.JPG", "*.mov", "*.MOV"] }) .on("data", onReaddirData) .on("warn", onReaddirWarning) .on("error", onReaddirError) .on("end", onReaddirComplete); }; function parseExifDate (exifDate) { var dateArray = exifDate.replace(" ", ":").split(/\s*:\s*/), month = (dateArray[1] - 1).toString(); dateArray[1] = month; return moment(dateArray); }; function onReaddirData (file) { jobState.files.push({ name: file.name, path: file.fullPath }); }; function onReaddirWarning (data) { log.warn(data); }; function onReaddirError (data) { log.error(data); }; function onReaddirComplete (data) { if (jobState.errors.length) { log.error("Errors reading file data:"); _.each(jobState.errors, function (error) { log.error("\t" + error); }); process.exit(); } else { if (jobState.warnings.length) { log.warn("Warnings:"); _.each(jobState.warnings, function (warning) { log.warn("\t" + warning); }); } copyFiles(); } }; function copyFiles () { // TODO: consider refactoring this to use async.parallel instead _.each(jobState.files, function (file) { copyFile(file, onCopyComplete); }); }; function copyFile (fileData, next) { new Exif({ image: fileData.path }, function (err, data) { if (err) { log.error("Is there some kinda error here?", err.message, fileData); jobState.errors.push(err); } else { var exif = data.exif, image = data.image, date = image.ModifyDate || exif.DateTimeOriginal || exif.CreateDate, timestamp = parseExifDate(date), newFileName = (timestamp.format(formatString) + path.extname(fileData.name)).toLowerCase(), newFilePath = path.join(options.destination, newFileName); var copied = false; var sourceFile = fs.createReadStream(fileData.path); var targetFile = fs.createWriteStream(newFilePath); sourceFile.on("error", function (err) { done(err); }); targetFile.on("error", function (err) { done(err); }); targetFile.on("close", function () { done(); }); sourceFile.pipe(targetFile); var done = function (err) { if (!copied) { next(err, _.extend(fileData, { newFile: newFilePath })); copied = true; } }; } }); }; function onCopyComplete (err, data) { if (!err) { log.info("File", data.path, "successfully copied to", data.newFile); } else { log.error("Error copying file:", err); } };
{ "content_hash": "c370f1f17b780407aeebbac50e239172", "timestamp": "", "source": "github", "line_count": 236, "max_line_length": 135, "avg_line_length": 30.084745762711865, "alnum_prop": 0.530281690140845, "repo_name": "ryexley/river-birch", "id": "09d54773f0379cc0386fcaf33d21e485bb7bca52", "size": "7100", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "process-photos.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "7100" } ], "symlink_target": "" }
FactoryGirl.define do factory :tweet do user_id 1 content "MyString" time "MyString" end end
{ "content_hash": "e212a7575e8dcbad4753286cacf77e6d", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 22, "avg_line_length": 15.571428571428571, "alnum_prop": 0.6697247706422018, "repo_name": "jbarrieault/swear-jar", "id": "5af471b560c0ba76745ff9e6b817783564b18a0a", "size": "179", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/factories/tweets.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "16434" }, { "name": "CoffeeScript", "bytes": "422" }, { "name": "JavaScript", "bytes": "124670" }, { "name": "Ruby", "bytes": "54015" } ], "symlink_target": "" }
class RelatedTaskSearchForm < Form field :from field :to field :projects field :payable field :developers end
{ "content_hash": "4f8ccfdae6045a56c0ff758138a998f1", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 34, "avg_line_length": 17, "alnum_prop": 0.7478991596638656, "repo_name": "RacoonsGroup/ttng", "id": "c61a603a06664320d75e0ce105739503ce9e042e", "size": "119", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/form/related_task_search_form.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "15629" }, { "name": "CoffeeScript", "bytes": "18356" }, { "name": "HTML", "bytes": "58603" }, { "name": "JavaScript", "bytes": "96009" }, { "name": "Ruby", "bytes": "225991" } ], "symlink_target": "" }
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // /*++ Module Name: init/pal.cpp Abstract: Implementation of PAL exported functions not part of the Win32 API. --*/ #include "pal/thread.hpp" #include "pal/synchobjects.hpp" #include "pal/procobj.hpp" #include "pal/cs.hpp" #include "pal/file.hpp" #include "pal/map.hpp" #include "../objmgr/shmobjectmanager.hpp" #include "pal/seh.hpp" #include "pal/palinternal.h" #include "pal/dbgmsg.h" #include "pal/shmemory.h" #include "pal/process.h" #include "../thread/procprivate.hpp" #include "pal/module.h" #include "pal/virtual.h" #include "pal/misc.h" #include "pal/utils.h" #include "pal/debug.h" #include "pal/locale.h" #include "pal/init.h" #if HAVE_MACH_EXCEPTIONS #include "../exception/machexception.h" #endif #include <stdlib.h> #include <unistd.h> #include <pwd.h> #include <errno.h> #include <sys/types.h> #include <sys/param.h> #include <sys/resource.h> #include <sys/stat.h> #include <limits.h> #include <string.h> #include <fcntl.h> #if HAVE_POLL #include <poll.h> #else #include "pal/fakepoll.h" #endif // HAVE_POLL #if defined(__APPLE__) #include <sys/sysctl.h> int CacheLineSize; #endif //__APPLE__ #ifdef __APPLE__ #include <mach-o/dyld.h> #endif // __APPLE__ using namespace CorUnix; // // $$TODO The C++ compiler doesn't like pal/cruntime.h so duplicate the // necessary prototype here // extern "C" BOOL CRTInitStdStreams( void ); SET_DEFAULT_DEBUG_CHANNEL(PAL); Volatile<INT> init_count = 0; Volatile<BOOL> shutdown_intent = 0; static BOOL g_fThreadDataAvailable = FALSE; static pthread_mutex_t init_critsec_mutex = PTHREAD_MUTEX_INITIALIZER; /* critical section to protect access to init_count. This is allocated on the very first PAL_Initialize call, and is freed afterward. */ static PCRITICAL_SECTION init_critsec = NULL; char g_szCoreCLRPath[MAX_PATH] = { 0 }; static int Initialize(int argc, const char *const argv[], DWORD flags); static BOOL INIT_IncreaseDescriptorLimit(void); static LPWSTR INIT_FormatCommandLine (CPalThread *pThread, int argc, const char * const *argv); static LPWSTR INIT_FindEXEPath(CPalThread *pThread, LPCSTR exe_name); #ifdef _DEBUG extern void PROCDumpThreadList(void); #endif char g_ExePath[MAX_PATH] = { 0 }; #if defined(__APPLE__) static bool RunningNatively() { int ret = 0; size_t sz = sizeof(ret); if (sysctlbyname("sysctl.proc_native", &ret, &sz, NULL, 0) != 0) { // if the sysctl failed, we'll assume this OS does not support // binary translation - so we must be running natively. return true; } return ret != 0; } #endif // __APPLE__ /*++ Function: PAL_Initialize Abstract: This function is the first function of the PAL to be called. Internal structure initialization is done here. It could be called several time by the same process, a reference count is kept. Return: 0 if successful -1 if it failed --*/ int PALAPI PAL_Initialize( int argc, const char *const argv[]) { return Initialize(argc, argv, PAL_INITIALIZE_ALL); } /*++ Function: PAL_InitializeDLL Abstract: Initializes the non-runtime DLLs/modules like the DAC and SOS. Return: 0 if successful -1 if it failed --*/ int PALAPI PAL_InitializeDLL() { return Initialize(0, NULL, PAL_INITIALIZE_DLL); } /*++ Function: Initialize Abstract: Common PAL initialization function. Return: 0 if successful -1 if it failed --*/ int Initialize( int argc, const char *const argv[], DWORD flags) { PAL_ERROR palError = ERROR_GEN_FAILURE; CPalThread *pThread = NULL; CSharedMemoryObjectManager *pshmom = NULL; LPWSTR command_line = NULL; LPWSTR exe_path = NULL; int retval = -1; bool fFirstTimeInit = false; /* the first ENTRY within the first call to PAL_Initialize is a special case, since debug channels are not initialized yet. So in that case the ENTRY will be called after the DBG channels initialization */ ENTRY_EXTERNAL("PAL_Initialize(argc = %d argv = %p)\n", argc, argv); /*Firstly initiate a lastError */ SetLastError(ERROR_GEN_FAILURE); #ifdef __APPLE__ if (!RunningNatively()) { SetLastError(ERROR_BAD_FORMAT); goto exit; } #endif // __APPLE__ CriticalSectionSubSysInitialize(); if(NULL == init_critsec) { pthread_mutex_lock(&init_critsec_mutex); // prevents race condition of two threads // initializing the critical section. if(NULL == init_critsec) { static CRITICAL_SECTION temp_critsec; // Want this critical section to NOT be internal to avoid the use of unsafe region markers. InternalInitializeCriticalSectionAndSpinCount(&temp_critsec, 0, false); if(NULL != InterlockedCompareExchangePointer(&init_critsec, &temp_critsec, NULL)) { // Another thread got in before us! shouldn't happen, if the PAL // isn't initialized there shouldn't be any other threads WARN("Another thread initialized the critical section\n"); InternalDeleteCriticalSection(&temp_critsec); } } pthread_mutex_unlock(&init_critsec_mutex); } InternalEnterCriticalSection(pThread, init_critsec); // here pThread is always NULL if(init_count==0) { // Set our pid. gPID = getpid(); fFirstTimeInit = true; // Initialize the TLS lookaside cache if (FALSE == TLSInitialize()) { goto done; } // Initialize the environment. if (FALSE == MiscInitialize()) { goto done; } // Initialize debug channel settings before anything else. // This depends on the environment, so it must come after // MiscInitialize. if (FALSE == DBG_init_channels()) { goto done; } #if _DEBUG // Verify that our page size is what we think it is. If it's // different, we can't run. if (VIRTUAL_PAGE_SIZE != getpagesize()) { ASSERT("VIRTUAL_PAGE_SIZE is incorrect for this system!\n" "Change include/pal/virtual.h and clr/src/inc/stdmacros.h " "to reflect the correct page size of %d.\n", getpagesize()); } #endif // _DEBUG if (!INIT_IncreaseDescriptorLimit()) { ERROR("Unable to increase the file descriptor limit!\n"); // We can continue if this fails; we'll just have problems if // we use large numbers of threads or have many open files. } #if !HAVE_COREFOUNDATION || ENABLE_DOWNLEVEL_FOR_NLS if( !CODEPAGEInit() ) { ERROR( "Unable to initialize the locks or the codepage.\n" ); goto done; } #endif // !HAVE_COREFOUNDATION || ENABLE_DOWNLEVEL_FOR_NLS /* initialize the shared memory infrastructure */ if(!SHMInitialize()) { ERROR("Shared memory initialization failed!\n"); goto CLEANUP0; } // // Initialize global process data // palError = InitializeProcessData(); if (NO_ERROR != palError) { ERROR("Unable to initialize process data\n"); goto CLEANUP1; } #if HAVE_MACH_EXCEPTIONS // Mach exception port needs to be set up before the thread // data or threads are set up. if (!SEHInitializeMachExceptions()) { ERROR("SEHInitializeMachExceptions failed!\n"); palError = ERROR_GEN_FAILURE; goto CLEANUP1; } #endif // HAVE_MACH_EXCEPTIONS // // Initialize global thread data // palError = InitializeGlobalThreadData(); if (NO_ERROR != palError) { ERROR("Unable to initialize thread data\n"); goto CLEANUP1; } // // Allocate the initial thread data // palError = CreateThreadData(&pThread); if (NO_ERROR != palError) { ERROR("Unable to create initial thread data\n"); goto CLEANUP1a; } PROCAddThread(pThread, pThread); // // Initialize mutex and condition variable used to synchronize the ending threads count // palError = InitializeEndingThreadsData(); if (NO_ERROR != palError) { ERROR("Unable to create ending threads data\n"); goto CLEANUP1b; } // // It's now safe to access our thread data // g_fThreadDataAvailable = TRUE; // // Initialize the object manager // pshmom = InternalNew<CSharedMemoryObjectManager>(pThread); if (NULL == pshmom) { ERROR("Unable to allocate new object manager\n"); palError = ERROR_OUTOFMEMORY; goto CLEANUP1b; } palError = pshmom->Initialize(); if (NO_ERROR != palError) { ERROR("object manager initialization failed!\n"); InternalDelete(pThread, pshmom); goto CLEANUP1b; } g_pObjectManager = pshmom; // // Initialize the synchronization manager // g_pSynchronizationManager = CPalSynchMgrController::CreatePalSynchronizationManager(pThread); palError = ERROR_GEN_FAILURE; if (NULL == g_pSynchronizationManager) { ERROR("Failure creating synchronization manager\n"); goto CLEANUP1c; } if (argc > 0 && argv != NULL) { /* build the command line */ command_line = INIT_FormatCommandLine(pThread, argc, argv); if (NULL == command_line) { ERROR("Error building command line\n"); goto CLEANUP1d; } /* find out the application's full path */ exe_path = INIT_FindEXEPath(pThread, argv[0]); if (NULL == exe_path) { ERROR("Unable to find exe path\n"); goto CLEANUP1e; } if (!WideCharToMultiByte(CP_ACP, 0, exe_path, -1, g_ExePath, sizeof(g_ExePath), NULL, NULL)) { ERROR("Failed to store process executable path\n"); goto CLEANUP2; } if (NULL == command_line || NULL == exe_path) { ERROR("Failed to process command-line parameters!\n"); goto CLEANUP2; } #ifdef PAL_PERF // Initialize the Profiling structure if(FALSE == PERFInitialize(command_line, exe_path)) { ERROR("Performance profiling initial failed\n"); goto done; } PERFAllocThreadInfo(); #endif } // // Create the initial process and thread objects // palError = CreateInitialProcessAndThreadObjects( pThread, command_line, exe_path ); if (NO_ERROR != palError) { ERROR("Unable to create initial process and thread objects\n"); goto CLEANUP4; } // CreateInitialProcessAndThreadObjects took ownership of this memory. command_line = NULL; if (flags & PAL_INITIALIZE_SYNC_THREAD) { // // Tell the synchronization manager to start its worker thread // palError = CPalSynchMgrController::StartWorker(pThread); if (NO_ERROR != palError) { ERROR("Synch manager failed to start worker thread\n"); goto CLEANUP5; } } palError = ERROR_GEN_FAILURE; /* initialize structured exception handling stuff (signals, etc) */ if (FALSE == SEHInitialize(pThread, flags)) { ERROR("Unable to initialize SEH support\n"); goto CLEANUP5; } /* Initialize the File mapping critical section. */ if (FALSE == MAPInitialize()) { ERROR("Unable to initialize file mapping support\n"); goto CLEANUP6; } /* initialize module manager */ if (FALSE == LOADInitializeModules(exe_path)) { ERROR("Unable to initialize module manager\n"); palError = GetLastError(); goto CLEANUP8; } /* Initialize the Virtual* functions. */ if (FALSE == VIRTUALInitialize()) { ERROR("Unable to initialize virtual memory support\n"); goto CLEANUP10; } /* create file objects for standard handles */ if(!FILEInitStdHandles()) { ERROR("Unable to initialize standard file handles\n"); goto CLEANUP13; } if (FALSE == CRTInitStdStreams()) { ERROR("Unable to initialize CRT standard streams\n"); goto CLEANUP15; } TRACE("First-time PAL initialization complete.\n"); init_count++; /* Set LastError to a non-good value - functions within the PAL startup may set lasterror to a nonzero value. */ SetLastError(NO_ERROR); retval = 0; } else { init_count++; // Behave the same wrt entering the PAL independent of whether this // is the first call to PAL_Initialize or not. The first call implied // PAL_Enter by virtue of creating the CPalThread for the current // thread, and its starting state is to be in the PAL. (void)PAL_Enter(PAL_BoundaryTop); TRACE("Initialization count increases to %d\n", init_count.Load()); SetLastError(NO_ERROR); retval = 0; } goto done; /* No cleanup required for CRTInitStdStreams */ CLEANUP15: FILECleanupStdHandles(); CLEANUP13: VIRTUALCleanup(); CLEANUP10: LOADFreeModules(TRUE); CLEANUP8: MAPCleanup(); CLEANUP6: SEHCleanup(flags); CLEANUP5: PROCCleanupInitialProcess(); CLEANUP4: FMTMSG_FormatMessageCleanUp(); CLEANUP2: InternalFree(pThread, exe_path); CLEANUP1e: if (command_line != NULL) { InternalFree(pThread, command_line); } CLEANUP1d: // Cleanup synchronization manager CLEANUP1c: // Cleanup object manager CLEANUP1b: // Cleanup initial thread data CLEANUP1a: // Cleanup global process data CLEANUP1: SHMCleanup(); CLEANUP0: #if !HAVE_COREFOUNDATION CODEPAGECleanup(); #endif // !HAVE_COREFOUNDATION ERROR("PAL_Initialize failed\n"); SetLastError(palError); done: #ifdef PAL_PERF if( retval == 0) { PERFEnableProcessProfile(); PERFEnableThreadProfile(FALSE); PERFCalibrate("Overhead of PERF entry/exit"); } #endif InternalLeaveCriticalSection(pThread, init_critsec); if (fFirstTimeInit && 0 == retval) { _ASSERTE(NULL != pThread); _ASSERTE(pThread->suspensionInfo.IsSuspensionStateSafe()); } if (retval != 0 && GetLastError() == ERROR_SUCCESS) { ASSERT("returning failure, but last error not set\n"); } #ifdef __APPLE__ exit : #endif // __APPLE__ LOGEXIT("PAL_Initialize returns int %d\n", retval); return retval; } /*++ Function: PAL_InitializeCoreCLR Abstract: A replacement for PAL_Initialize when loading CoreCLR. Instead of taking a command line (which CoreCLR instances aren't given anyway) the path into which the CoreCLR is installed is supplied instead. This is cached so that PAL_GetPALDirectoryW can return it later. This routine also makes sure the psuedo dynamic libraries PALRT and mscorwks have their initialization methods called. Which PAL (if any) we're executing in the context of is a function of the return code and the fStayInPAL argument. If an error is returned then the PAL context is that of the caller (i.e. this call doesn't switch into the context of the PAL being initialized). Otherwise (on success) the context is remains in that of the new PAL if and only if fStayInPAL is TRUE. Return: ERROR_SUCCESS if successful An error code, if it failed --*/ PAL_ERROR PALAPI PAL_InitializeCoreCLR( const char *szExePath, const char *szCoreCLRPath, BOOL fStayInPAL) { // Check for a repeated call (this is a no-op). if (g_szCoreCLRPath[0] != '\0') { if (fStayInPAL) { PAL_Enter(PAL_BoundaryTop); } return ERROR_SUCCESS; } // Make sure it's an absolute path. if (szCoreCLRPath[0] != '/') { return ERROR_INVALID_PARAMETER; } // Check we can handle the length of the installation directory. size_t cchCoreCLRPath = strlen(szCoreCLRPath); if (cchCoreCLRPath >= sizeof(g_szCoreCLRPath)) { ASSERT("CoreCLR installation path is too long"); return ERROR_BAD_PATHNAME; } // Stash a copy of the CoreCLR installation path in a global variable. // Make sure it's terminated with a slash. if (strcpy_s(g_szCoreCLRPath, sizeof(g_szCoreCLRPath), szCoreCLRPath) != SAFECRT_SUCCESS) { ASSERT("strcpy_s failed!"); return ERROR_FILENAME_EXCED_RANGE; } #ifdef __APPLE__ // Fake up a command line to call PAL_Initialize with. const char *argv[] = { "CoreCLR" }; int result = PAL_Initialize(1, argv); #else // __APPLE__ // Fake up a command line to call PAL_Initialize with. int result = PAL_Initialize(1, &szExePath); #endif // __APPLE__ if (result != 0) return GetLastError(); // Now that the PAL is initialized it's safe to call the initialization methods for the code that used to // be dynamically loaded libraries but is now statically linked into CoreCLR just like the PAL, i.e. the // PAL RT and mscorwks. if (!LOADInitCoreCLRModules()) { return ERROR_DLL_INIT_FAILED; } if (!fStayInPAL) { PAL_Leave(PAL_BoundaryTop); } return ERROR_SUCCESS; } /*++ Function: PAL_IsDebuggerPresent Abstract: This function should be used to determine if a debugger is attached to the process. --*/ PALIMPORT BOOL PALAPI PAL_IsDebuggerPresent() { #if defined(__LINUX__) BOOL debugger_present = FALSE; char buf[2048]; int status_fd = open("/proc/self/status", O_RDONLY); if (status_fd == -1) { return FALSE; } ssize_t num_read = read(status_fd, buf, sizeof(buf) - 1); if (num_read > 0) { static const char TracerPid[] = "TracerPid:"; char *tracer_pid; buf[num_read] = '\0'; tracer_pid = strstr(buf, TracerPid); if (tracer_pid) { debugger_present = !!atoi(tracer_pid + sizeof(TracerPid) - 1); } } return debugger_present; #elif defined(__APPLE__) struct kinfo_proc info = {}; size_t size = sizeof(info); int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() }; int ret = sysctl(mib, sizeof(mib)/sizeof(*mib), &info, &size, NULL, 0); if (ret == 0) return ((info.kp_proc.p_flag & P_TRACED) != 0); return FALSE; #else return FALSE; #endif } /*++ Function: PAL_EntryPoint Abstract: This function should be used to wrap code that uses PAL library on thread that was not created by PAL. --*/ PALIMPORT DWORD_PTR PALAPI PAL_EntryPoint( IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter) { CPalThread *pThread; DWORD_PTR retval = (DWORD) -1; ENTRY("PAL_EntryPoint(lpStartAddress=%p, lpParameter=%p)\n", lpStartAddress, lpParameter); pThread = InternalGetCurrentThread(); if (NULL == pThread) { /* This function works only for thread that called PAL_Initialize for now. */ ERROR( "Unable to get the thread object.\n" ); goto done; } retval = (*lpStartAddress)(lpParameter); done: LOGEXIT("PAL_EntryPoint returns int %d\n", retval); return retval; } /*++ Function: PALCommonCleanup Utility function to free any resource used by the PAL. Parameters : step: selects the desired cleanup step full_cleanup: FALSE: cleanup only what's needed and leave the rest to the OS process cleanup TRUE: full cleanup --*/ void PALCommonCleanup(PALCLEANUP_STEP step, BOOL full_cleanup) { CPalThread *pThread = InternalGetCurrentThread(); static int step_done[PALCLEANUP_STEP_INVALID] = { 0 }; switch (step) { case PALCLEANUP_ALL_STEPS: case PALCLEANUP_STEP_ONE: /* Note: in order to work correctly, this step should be executed with init_count > 0 */ if (!step_done[PALCLEANUP_STEP_ONE]) { step_done[PALCLEANUP_STEP_ONE] = 1; PALSetShutdownIntent(); // // Let the synchronization manager know we're about to shutdown // CPalSynchMgrController::PrepareForShutdown(); #ifdef _DEBUG PROCDumpThreadList(); #endif TRACE("About to suspend every other thread\n"); /* prevent other threads from acquiring signaled objects */ PROCCondemnOtherThreads(); /* prevent other threads from using services we're shutting down */ PROCSuspendOtherThreads(); TRACE("Every other thread suspended until exit\n"); } /* Fall down for PALCLEANUP_ALL_STEPS */ if (PALCLEANUP_ALL_STEPS != step) break; case PALCLEANUP_STEP_TWO: if (!step_done[PALCLEANUP_STEP_TWO]) { step_done[PALCLEANUP_STEP_TWO] = 1; /* LOADFreeeModules needs to be called before unitializing the rest of the PAL since it could result in calling DllMain for loaded libraries. For the user DllMain, all PAL APIs should still be functional. */ LOADFreeModules(FALSE); #ifdef PAL_PERF PERFDisableProcessProfile(); PERFDisableThreadProfile(FALSE); PERFTerminate(); #endif if (full_cleanup) { /* close primary handles of standard file objects */ FILECleanupStdHandles(); /* This unloads the palrt so, during its unloading, they can call any number of APIs, so we have to be active for it to work. */ FMTMSG_FormatMessageCleanUp(); VIRTUALCleanup(); /* SEH requires information from the process structure to work; LOADFreeModules requires SEH to be functional when calling DllMain. Therefore SEHCleanup must go between LOADFreeModules and PROCCleanupInitialProcess */ SEHCleanup(PAL_INITIALIZE_ALL); PROCCleanupInitialProcess(); } // Object manager shutdown may cause all CPalThread objects // to be deleted. Since the CPalThread of the shutdown thread // needs to be available for reference by the thread suspension unsafe // operations, the reference of CPalThread is incremented here // to keep it alive until PAL finishes cleanup. pThread->AddThreadReference(); // // Shutdown object manager -- this needs to happen before the // synch manager shutdown since it will call into the synch // manager to free object synch data // static_cast<CSharedMemoryObjectManager*>(g_pObjectManager)->Shutdown(pThread); // // Final synch manager shutdown // CPalSynchMgrController::Shutdown(pThread, full_cleanup); if (full_cleanup) { /* It needs to be done after stopping the handle manager, because the cleanup will delete the critical section which is used when closing the handle of a file mapping */ MAPCleanup(); // MutexCleanup(); MiscCleanup(); TIMECleanUpTransitionDates(); #if !HAVE_COREFOUNDATION CODEPAGECleanup(); #endif // !HAVE_COREFOUNDATION TLSCleanup(); } // The thread object will no longer be available after the shutdown thread // releases the thread reference. g_fThreadDataAvailable = FALSE; pThread->ReleaseThreadReference(); pthread_setspecific(thObjKey, NULL); // Make sure any TLS entry is removed. // Since thread object is no longer available here, // the code path from here should stop using any functions // that reference thread object. SHMCleanup(); TRACE("PAL Terminated.\n"); } break; default: ASSERT("Unknown final cleanup step %d", step); break; } } /*++ Function: PAL_Terminate Abstract: This function is the called when a thread has finished using the PAL library. It shuts down PAL and exits the current process. --*/ void PALAPI PAL_Terminate( void) { PAL_TerminateEx(0); } /*++ Function: PAL_TerminateEx Abstract: This function is the called when a thread has finished using the PAL library. It shuts down PAL and exits the current process with the specified exit code. --*/ void PALAPI PAL_TerminateEx(int exitCode) { ENTRY_EXTERNAL("PAL_TerminateEx()\n"); if (NULL == init_critsec) { /* note that these macros probably won't output anything, since the debug channels haven't been initialized yet */ ASSERT("PAL_Initialize has never been called!\n"); LOGEXIT("PAL_Terminate returns.\n"); } PALSetShutdownIntent(); LOGEXIT("PAL_TerminateEx is exiting the current process.\n"); exit(exitCode); } /*++ Function: PAL_InitializeDebug Abstract: This function is the called when cordbg attaches to the process. --*/ void PALAPI PAL_InitializeDebug( void) { PERF_ENTRY(PAL_InitializeDebug); ENTRY("PAL_InitializeDebug()\n"); #if HAVE_MACH_EXCEPTIONS MachExceptionInitializeDebug(); #endif LOGEXIT("PAL_InitializeDebug returns\n"); PERF_EXIT(PAL_InitializeDebug); } /*++ Function: PALIsThreadDataInitialized Returns TRUE if startup has reached a point where thread data is available --*/ BOOL PALIsThreadDataInitialized() { return g_fThreadDataAvailable; } /*++ Function: PALShutdown sets the PAL's initialization count to zero, so that PALIsInitialized will return FALSE. called by PROCCleanupProcess to tell some functions that the PAL isn't fully functional, and that they should use an alternate code path (no parameters, no retun vale) --*/ void PALShutdown( void) { init_count = 0; } BOOL PALIsShuttingDown() { /* ROTORTODO: This function may be used to provide a reader/writer-like mechanism (or a ref counting one) to prevent PAL APIs that need to access PAL runtime data, from working when PAL is shutting down. Each of those API should acquire a read access while executing. The shutting down code would acquire a write lock, i.e. suspending any new incoming reader, and waiting for the current readers to be done. That would allow us to get rid of the dangerous suspend-all-other-threads at shutdown time */ return shutdown_intent; } void PALSetShutdownIntent() { /* ROTORTODO: See comment in PALIsShuttingDown */ shutdown_intent = TRUE; } /*++ Function: PALInitLock Take the initializaiton critical section (init_critsec). necessary to serialize TerminateProcess along with PAL_Terminate and PAL_Initialize (no parameters) Return value : TRUE if critical section existed (and was acquired) FALSE if critical section doens't exist yet --*/ BOOL PALInitLock(void) { if(!init_critsec) { return FALSE; } CPalThread * pThread = (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : NULL); InternalEnterCriticalSection(pThread, init_critsec); return TRUE; } /*++ Function: PALInitUnlock Release the initialization critical section (init_critsec). (no parameters, no return value) --*/ void PALInitUnlock(void) { if(!init_critsec) { return; } CPalThread * pThread = (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : NULL); InternalLeaveCriticalSection(pThread, init_critsec); } /* Internal functions *********************************************************/ /*++ Function: INIT_IncreaseDescriptorLimit [internal] Abstract: Calls setrlimit(2) to increase the maximum number of file descriptors this process can open. Return value: TRUE if the call to setrlimit succeeded; FALSE otherwise. --*/ static BOOL INIT_IncreaseDescriptorLimit(void) { struct rlimit rlp; int result; result = getrlimit(RLIMIT_NOFILE, &rlp); if (result != 0) { return FALSE; } // Set our soft limit for file descriptors to be the same // as the max limit. rlp.rlim_cur = rlp.rlim_max; result = setrlimit(RLIMIT_NOFILE, &rlp); if (result != 0) { return FALSE; } return TRUE; } /*++ Function: INIT_FormatCommandLine [Internal] Abstract: This function converts an array of arguments (argv) into a Unicode command-line for use by GetCommandLineW Parameters : int argc : number of arguments in argv char **argv : argument list in an array of NULL-terminated strings Return value : pointer to Unicode command line. This is a buffer allocated with malloc; caller is responsible for freeing it with free() Note : not all peculiarities of Windows command-line processing are supported; -what is supported : -arguments with white-space must be double quoted (we'll just double-quote all arguments to simplify things) -some characters must be escaped with \ : particularly, the double-quote, to avoid confusion with the double-quotes at the start and end of arguments, and \ itself, to avoid confusion with escape sequences. -what is not supported: -under Windows, \\ is interpreted as an escaped \ ONLY if it's followed by an escaped double-quote \". \\\" is passed to argv as \", but \\a is passed to argv as \\a... there may be other similar cases -there may be other characters which must be escaped --*/ static LPWSTR INIT_FormatCommandLine (CPalThread *pThread, int argc, const char * const *argv) { LPWSTR retval; LPSTR command_line=NULL, command_ptr; LPCSTR arg_ptr; INT length, i,j; BOOL bQuoted = FALSE; /* list of characters that need no be escaped with \ when building the command line. currently " and \ */ LPCSTR ESCAPE_CHARS="\"\\"; /* allocate temporary memory for the string. Play it safe : double the length of each argument (in case they're composed exclusively of escaped characters), and add 3 (for the double-quotes and separating space). This is temporary anyway, we return a LPWSTR */ length=0; for(i=0; i<argc; i++) { TRACE("argument %d is %s\n", i, argv[i]); length+=3; length+=strlen(argv[i])*2; } command_line = reinterpret_cast<LPSTR>(InternalMalloc(pThread, length)); if(!command_line) { ERROR("couldn't allocate memory for command line!\n"); return NULL; } command_ptr=command_line; for(i=0; i<argc; i++) { /* double-quote at beginning of argument containing at leat one space */ for(j = 0; (argv[i][j] != 0) && (!isspace((unsigned char) argv[i][j])); j++); if (argv[i][j] != 0) { *command_ptr++='"'; bQuoted = TRUE; } /* process the argument one character at a time */ for(arg_ptr=argv[i]; *arg_ptr; arg_ptr++) { /* if character needs to be escaped, prepend a \ to it. */ if( strchr(ESCAPE_CHARS,*arg_ptr)) { *command_ptr++='\\'; } /* now we can copy the actual character over. */ *command_ptr++=*arg_ptr; } /* double-quote at end of argument; space to separate arguments */ if (bQuoted == TRUE) { *command_ptr++='"'; bQuoted = FALSE; } *command_ptr++=' '; } /* replace the last space with a NULL terminator */ command_ptr--; *command_ptr='\0'; /* convert to Unicode */ i = MultiByteToWideChar(CP_ACP, 0,command_line, -1, NULL, 0); if (i == 0) { ASSERT("MultiByteToWideChar failure\n"); InternalFree(pThread, command_line); return NULL; } retval = reinterpret_cast<LPWSTR>(InternalMalloc(pThread, (sizeof(WCHAR)*i))); if(retval == NULL) { ERROR("can't allocate memory for Unicode command line!\n"); InternalFree(pThread, command_line); return NULL; } if(!MultiByteToWideChar(CP_ACP, 0,command_line, i, retval, i)) { ASSERT("MultiByteToWideChar failure\n"); InternalFree(pThread, retval); retval = NULL; } else TRACE("Command line is %s\n", command_line); InternalFree(pThread, command_line); return retval; } /*++ Function: INIT_FindEXEPath Abstract: Determine the full, canonical path of the current executable by searching $PATH. Parameters: LPCSTR exe_name : file to search for Return: pointer to buffer containing the full path. This buffer must be released by the caller using free() Notes : this function assumes that "exe_name" is in Unix style (no \) Notes 2: This doesn't handle the case of directories with the desired name (and directories are usually executable...) --*/ static LPWSTR INIT_FindEXEPath(CPalThread *pThread, LPCSTR exe_name) { #ifndef __APPLE__ CHAR real_path[PATH_MAX+1]; LPSTR env_path; LPSTR path_ptr; LPSTR cur_dir; INT exe_name_length; BOOL need_slash; LPWSTR return_value; INT return_size; struct stat theStats; /* if a path is specified, only search there */ if(strchr(exe_name, '/')) { if ( -1 == stat( exe_name, &theStats ) ) { ERROR( "The file does not exist\n" ); return NULL; } if ( UTIL_IsExecuteBitsSet( &theStats ) ) { if(!realpath(exe_name, real_path)) { ERROR("realpath() failed!\n"); return NULL; } return_size=MultiByteToWideChar(CP_ACP,0,real_path,-1,NULL,0); if ( 0 == return_size ) { ASSERT("MultiByteToWideChar failure\n"); return NULL; } return_value = reinterpret_cast<LPWSTR>(InternalMalloc(pThread, (return_size*sizeof(WCHAR)))); if ( NULL == return_value ) { ERROR("Not enough memory to create full path\n"); return NULL; } else { if(!MultiByteToWideChar(CP_ACP, 0, real_path, -1, return_value, return_size)) { ASSERT("MultiByteToWideChar failure\n"); InternalFree(pThread, return_value); return_value = NULL; } else { TRACE("full path to executable is %s\n", real_path); } } return return_value; } } /* no path was specified : search $PATH */ env_path=MiscGetenv("PATH"); if(!env_path || *env_path=='\0') { WARN("$PATH isn't set.\n"); goto last_resort; } /* get our own copy of env_path so we can modify it */ env_path=InternalStrdup(pThread, env_path); if(!env_path) { ERROR("Not enough memory to copy $PATH!\n"); return NULL; } exe_name_length=strlen(exe_name); cur_dir=env_path; while(cur_dir) { LPSTR full_path; struct stat theStats; /* skip all leading ':' */ while(*cur_dir==':') { cur_dir++; } if(*cur_dir=='\0') { break; } /* cut string at next ':' */ path_ptr=strchr(cur_dir, ':'); if(path_ptr) { /* check if we need to add a '/' between the path and filename */ need_slash=(*(path_ptr-1))!='/'; /* NULL_terminate path element */ *path_ptr++='\0'; } else { /* check if we need to add a '/' between the path and filename */ need_slash=(cur_dir[strlen(cur_dir)-1])!='/'; } TRACE("looking for %s in %s\n", exe_name, cur_dir); /* build tentative full file name */ int iLength = (strlen(cur_dir)+exe_name_length+2); full_path = reinterpret_cast<LPSTR>(InternalMalloc(pThread, iLength)); if(!full_path) { ERROR("Not enough memory!\n"); break; } if (strcpy_s(full_path, iLength, cur_dir) != SAFECRT_SUCCESS) { ERROR("strcpy_s failed!\n"); InternalFree(pThread, full_path); InternalFree(pThread, env_path); return NULL; } if(need_slash) { if (strcat_s(full_path, iLength, "/") != SAFECRT_SUCCESS) { ERROR("strcat_s failed!\n"); InternalFree(pThread, full_path); InternalFree(pThread, env_path); return NULL; } } if (strcat_s(full_path, iLength, exe_name) != SAFECRT_SUCCESS) { ERROR("strcat_s failed!\n"); InternalFree(pThread, full_path); InternalFree(pThread, env_path); return NULL; } /* see if file exists AND is executable */ if ( -1 != stat( full_path, &theStats ) ) { if( UTIL_IsExecuteBitsSet( &theStats ) ) { /* generate canonical path */ if(!realpath(full_path, real_path)) { ERROR("realpath() failed!\n"); InternalFree(pThread, full_path); InternalFree(pThread, env_path); return NULL; } InternalFree(pThread, full_path); return_size = MultiByteToWideChar(CP_ACP,0,real_path,-1,NULL,0); if ( 0 == return_size ) { ASSERT("MultiByteToWideChar failure\n"); InternalFree(pThread, env_path); return NULL; } return_value = reinterpret_cast<LPWSTR>(InternalMalloc(pThread, (return_size*sizeof(WCHAR)))); if ( NULL == return_value ) { ERROR("Not enough memory to create full path\n"); InternalFree(pThread, env_path); return NULL; } if(!MultiByteToWideChar(CP_ACP, 0, real_path, -1, return_value, return_size)) { ASSERT("MultiByteToWideChar failure\n"); InternalFree(pThread, return_value); return_value = NULL; } else { TRACE("found %s in %s; real path is %s\n", exe_name, cur_dir,real_path); } InternalFree(pThread, env_path); return return_value; } } /* file doesn't exist : keep searching */ InternalFree(pThread, full_path); /* path_ptr is NULL if there's no ':' after this directory */ cur_dir=path_ptr; } InternalFree(pThread, env_path); TRACE("No %s found in $PATH (%s)\n", exe_name, MiscGetenv("PATH")); last_resort: /* last resort : see if the executable is in the current directory. This is possible if it comes from a exec*() call. */ if(0 == stat(exe_name,&theStats)) { if ( UTIL_IsExecuteBitsSet( &theStats ) ) { if(!realpath(exe_name, real_path)) { ERROR("realpath() failed!\n"); return NULL; } return_size = MultiByteToWideChar(CP_ACP,0,real_path,-1,NULL,0); if (0 == return_size) { ASSERT("MultiByteToWideChar failure\n"); return NULL; } return_value = reinterpret_cast<LPWSTR>(InternalMalloc(pThread, (return_size*sizeof(WCHAR)))); if (NULL == return_value) { ERROR("Not enough memory to create full path\n"); return NULL; } else { if(!MultiByteToWideChar(CP_ACP, 0, real_path, -1, return_value, return_size)) { ASSERT("MultiByteToWideChar failure\n"); InternalFree(pThread, return_value); return_value = NULL; } else { TRACE("full path to executable is %s\n", real_path); } } return return_value; } else { ERROR("found %s in current directory, but it isn't executable!\n", exe_name); } } else { TRACE("last resort failed : executable %s is not in the current " "directory\n",exe_name); } ERROR("executable %s not found anywhere!\n", exe_name); return NULL; #else // !__APPLE__ // On the Mac we can just directly ask the OS for the executable path. CHAR exec_path[PATH_MAX+1]; LPWSTR return_value; INT return_size; uint32_t bufsize = sizeof(exec_path); if (_NSGetExecutablePath(exec_path, &bufsize)) { ASSERT("_NSGetExecutablePath failure\n"); return NULL; } return_size = MultiByteToWideChar(CP_ACP,0,exec_path,-1,NULL,0); if (0 == return_size) { ASSERT("MultiByteToWideChar failure\n"); return NULL; } return_value = reinterpret_cast<LPWSTR>(InternalMalloc(pThread, (return_size*sizeof(WCHAR)))); if (NULL == return_value) { ERROR("Not enough memory to create full path\n"); return NULL; } else { if(!MultiByteToWideChar(CP_ACP, 0, exec_path, -1, return_value, return_size)) { ASSERT("MultiByteToWideChar failure\n"); InternalFree(pThread, return_value); return_value = NULL; } else { TRACE("full path to executable is %s\n", exec_path); } } return return_value; #endif // !__APPLE__ }
{ "content_hash": "0081e7f9e7be5ae755fe9ca2c1cd8562", "timestamp": "", "source": "github", "line_count": 1572, "max_line_length": 110, "avg_line_length": 27.770992366412212, "alnum_prop": 0.5818215136521898, "repo_name": "fieryorc/coreclr", "id": "e7bd4d3b48e09955349754ced3d1f3e4bb4c352d", "size": "43656", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/pal/src/init/pal.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "784163" }, { "name": "Awk", "bytes": "1864" }, { "name": "C", "bytes": "6284194" }, { "name": "C#", "bytes": "18365595" }, { "name": "C++", "bytes": "64874265" }, { "name": "CMake", "bytes": "481084" }, { "name": "Groff", "bytes": "510331" }, { "name": "Makefile", "bytes": "2314" }, { "name": "Objective-C", "bytes": "203438" }, { "name": "Perl", "bytes": "21087" }, { "name": "PowerShell", "bytes": "4332" }, { "name": "Python", "bytes": "8165" }, { "name": "Shell", "bytes": "44673" } ], "symlink_target": "" }
using System; using Elasticsearch.Net; using Nest; using Tests.Framework; using Tests.Framework.Integration; using Tests.Framework.ManagedElasticsearch.Clusters; using Tests.Framework.MockData; using Xunit; namespace Tests.Search.SearchShards { public class SearchShardsApiTests : ApiIntegrationTestBase<ReadOnlyCluster, ISearchShardsResponse, ISearchShardsRequest, SearchShardsDescriptor<Project>, SearchShardsRequest<Project>> { public SearchShardsApiTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { } protected override LazyResponses ClientUsage() => Calls( fluent: (c, f) => c.SearchShards(f), fluentAsync: (c, f) => c.SearchShardsAsync(f), request: (c, r) => c.SearchShards(r), requestAsync: (c, r) => c.SearchShardsAsync(r) ); protected override int ExpectStatusCode => 200; protected override bool ExpectIsValid => true; protected override HttpMethod HttpMethod => HttpMethod.POST; protected override string UrlPath => $"/_search_shards"; protected override SearchShardsDescriptor<Project> NewDescriptor() => new SearchShardsDescriptor<Project>(); protected override Func<SearchShardsDescriptor<Project>, ISearchShardsRequest> Fluent => s => s; protected override SearchShardsRequest<Project> Initializer => new SearchShardsRequest<Project>(); } }
{ "content_hash": "822e8e1b056ba4d2e59809599e7a4d83", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 184, "avg_line_length": 37.885714285714286, "alnum_prop": 0.7767722473604827, "repo_name": "adam-mccoy/elasticsearch-net", "id": "3c9cacdf3c0a56806dece0fe27ebef9e7871d5dd", "size": "1328", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/Tests/Search/SearchShards/SearchShardsApiTests.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "3205" }, { "name": "C#", "bytes": "7981621" }, { "name": "F#", "bytes": "44574" }, { "name": "HTML", "bytes": "295209" }, { "name": "Shell", "bytes": "1857" }, { "name": "Smalltalk", "bytes": "3426" } ], "symlink_target": "" }
/*** * Inferno Engine v4 2015-2017 * Written by Tomasz "Rex Dex" Jonarski * * [#filter: resource\serialization\metadata #] ***/ #include "base/serialization/include/rttiMetadata.h" namespace base { //------ // Defines loader that should be used for loading the object // NOTE: this is used only if the object is the root object of the serialization (e.g. a resource) class BASE_RESOURCES_API SerializationLoaderMetadata : public rtti::IMetadata { RTTI_DECLARE_VIRTUAL_CLASS(SerializationLoaderMetadata, rtti::IMetadata); public: SerializationLoaderMetadata(); ~SerializationLoaderMetadata(); template< typename T > FORCEINLINE SerializationLoaderMetadata& bind() { m_createLoader = []() { return CreateSharedPtr<T>(); }; return *this; } // create instance of the loader SharedPtr<stream::ILoader> createLoader() const; private: typedef std::function<SharedPtr<stream::ILoader>()> TCreateLoaderFunc; TCreateLoaderFunc m_createLoader; }; //------ // Defines saver that should be used for saving the object // NOTE: this is used only if the object is the root object of the serialization (e.g. a resource) class BASE_RESOURCES_API SerializationSaverMetadata : public rtti::IMetadata { RTTI_DECLARE_VIRTUAL_CLASS(SerializationSaverMetadata, rtti::IMetadata); public: SerializationSaverMetadata(); ~SerializationSaverMetadata(); template< typename T > FORCEINLINE SerializationSaverMetadata& bind() { m_createSaver = []() { return CreateSharedPtr<T>(); }; return *this; } // create instance of the saver SharedPtr<stream::ISaver> createSaver() const; private: typedef std::function<SharedPtr<stream::ISaver>()> TCreateSaverFunc; TCreateSaverFunc m_createSaver; }; //------ } // base
{ "content_hash": "a5564ab771059ecd962c1eac6b8d5359", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 102, "avg_line_length": 29.220588235294116, "alnum_prop": 0.6436839456467036, "repo_name": "InfernoEngine/engine", "id": "4245a2e6d24dcd877e623fe3281f224e4138936d", "size": "1987", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "dev/src/base/resources/include/resourceSerializationMetadata.h", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "2330" }, { "name": "C", "bytes": "3093219" }, { "name": "C++", "bytes": "16712786" }, { "name": "CSS", "bytes": "41369" }, { "name": "Lua", "bytes": "27464" }, { "name": "Shell", "bytes": "3813" }, { "name": "Yacc", "bytes": "72956" } ], "symlink_target": "" }
export {Component} from './decorators/component'; export {Input, InputString, Output, EventBinding, EventEmitter} from './decorators/binding'; export {Config} from './decorators/config'; export {Directive} from './decorators/directive'; export {Filter} from './decorators/filter'; export {Inject} from './decorators/inject'; export {MockModule} from './decorators/mock'; export {Module, AngularModule} from './decorators/module'; export {Run} from './decorators/run'; export {Service} from './decorators/service';
{ "content_hash": "52028d89ddaafb113eb01a534e41da13", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 92, "avg_line_length": 46.81818181818182, "alnum_prop": 0.7456310679611651, "repo_name": "interfacewerk/ng1-decorators", "id": "d135a446eae38b2eeddc124ae151ba896d3e136c", "size": "515", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/index.ts", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "1983" }, { "name": "TypeScript", "bytes": "13894" } ], "symlink_target": "" }
<?php namespace WL\AppBundle\Controller; use Nokaut\ApiKit\ClientApi\Rest\Exception\NotFoundException; use Nokaut\ApiKit\Collection\Products; use Nokaut\ApiKit\Entity\Category; use Nokaut\ApiKit\Ext\Data; use Nokaut\ApiKit\Repository\CategoriesRepository; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Response; use WL\AppBundle\Lib\Breadcrumbs\BreadcrumbsBuilder; use WL\AppBundle\Lib\CategoriesAllowed; use WL\AppBundle\Lib\Exception\CategoryNotAllowedException; use WL\AppBundle\Lib\Filter; use WL\AppBundle\Lib\Helper\Uri; use WL\AppBundle\Lib\Pagination\Pagination; use WL\AppBundle\Lib\Repository\ProductsAsyncRepository; use WL\AppBundle\Lib\Repository\ProductsRepository; use WL\AppBundle\Lib\Type\Breadcrumb; use WL\AppBundle\Lib\View\Data\Converter\Filters\Callback; class CategoryController extends Controller { public function indexAction($categoryUrlWithFilters) { try { $category = $this->fetchCategory($categoryUrlWithFilters); } catch (CategoryNotAllowedException $e) { return $this->redirect($this->generateUrl('wl_homepage'), 301); } /** @var ProductsAsyncRepository $productsAsyncRepo */ $productsAsyncRepo = $this->get('repo.products.async'); $productsFetch = $productsAsyncRepo->fetchProductsByUrl($categoryUrlWithFilters, $this->getProductFields(), 24); $productsAsyncRepo->fetchAllAsync(); /** @var Products $products */ $products = $productsFetch->getResult(); $this->filter($products); $this->filterCategory($category); $pagination = $this->preparePagination($products); $priceFilters = $this->getPriceFilters($products); $producersFilters = $this->getProducersFilters($products); $propertiesFilters = $this->getPropertiesFilters($products); $categoriesFilters = $this->getCategoriesFilters($category, $products); $selectedFilters = $this->getSelectedFilters($products); $breadcrumbs = $this->prepareBreadcrumbs($category, $selectedFilters); $responseStatus = null; if ($products->getMetadata()->getTotal() == 0) { return $this->render('WLAppBundle:Category:nonResult.html.twig', array( 'breadcrumbs' => $breadcrumbs, 'selectedFilters' => $selectedFilters, 'canonical' => $this->getCanonical($products), ), new Response('', 410)); } return $this->render('WLAppBundle:Category:index.html.twig', array( 'category' => $category, 'products' => $products, 'breadcrumbs' => $breadcrumbs, 'pagination' => $pagination, 'subcategories' => $categoriesFilters, 'priceFilters' => $priceFilters, 'producersFilters' => $producersFilters, 'propertiesFilters' => $propertiesFilters, 'selectedFilters' => $selectedFilters, 'sorts' => $products ? $products->getMetadata()->getSorts() : array(), 'canonical' => $this->getCanonical($products), 'h1' => $category->getTitle(), 'metadataTitle' => $this->prepareMetadataTitle($breadcrumbs, $selectedFilters, $pagination) )); } /** * filtering products and facets etc... * @param Products $products */ protected function filter($products) { if ($products === null) { return; } $filterUrl = new Filter\Controller\UrlCategoryFilter(); $filterUrl->filter($products); $filterProperties = new Filter\PropertiesFilter(); $filterProperties->filterProducts($products); $filterSort = new Filter\SortFilter(); $filterSort->filter($products); } /** * @param Category $category */ protected function filterCategory(Category $category) { $filterCategory = new Filter\UrlCategoryFilter(); $filterCategory->filter($category); } /** * @param Products $products * @return Pagination */ protected function preparePagination($products) { if (is_null($products)) { return new Pagination(); } $pagination = new Pagination(); $pagination->setTotal($products->getMetadata()->getPaging()->getTotal()); $pagination->setCurrentPage($products->getMetadata()->getPaging()->getCurrent()); $pagination->setUrlTemplate($products->getMetadata()->getPaging()->getUrlTemplate()); $pagination->setUrlTemplate( $this->get('router')->generate('category', array('categoryUrlWithFilters' => $products->getMetadata()->getPaging()->getUrlTemplate())) ); return $pagination; } /** * @param $categoryUrlWithFilters * @return Category * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException * @throws CategoryNotAllowedException */ protected function fetchCategory($categoryUrlWithFilters) { $path = explode('/', $categoryUrlWithFilters); $categoryUrl = $path[0]; /** @var CategoriesRepository $categoriesRepo */ $categoriesRepo = $this->get('repo.categories'); try { $category = $categoriesRepo->fetchByUrl($categoryUrl); if ($category) { /** @var CategoriesAllowed $categoriesAllowed */ $categoriesAllowed = $this->get('categories.allowed'); $categoriesAllowed->checkAllowedCategory($category); } return $category; } catch (NotFoundException $e) { throw $this->createNotFoundException("not found category " . $categoryUrl); } } /** * @param $category * @param Data\Collection\Filters\FiltersAbstract[] $filters * @return array */ protected function prepareBreadcrumbs($category, array $filters) { /** @var BreadcrumbsBuilder $breadcrumbsBuilder */ $breadcrumbsBuilder = $this->get('breadcrumb.builder'); $breadcrumbs = $breadcrumbsBuilder->prepareBreadcrumbs( $category, function ($url) { return $this->get('router')->generate('category', array('categoryUrlWithFilters' => Uri::prepareApiUrl($url))); } ); $breadcrumbsBuilder->appendFilter($breadcrumbs, $filters); return $breadcrumbs; } /** * @param Products $products * @return Data\Collection\Filters\FiltersAbstract[] */ protected function getSelectedFilters($products) { if (is_null($products)) { return array(); } $selectedFilters = array(); $priceSelectedFilters = $this->getPriceSelectedFilters($products); if ($priceSelectedFilters->count()) { $selectedFilters[] = $priceSelectedFilters; } $producersSelectedFilters = $this->getProducersSelectedFilters($products); if ($producersSelectedFilters->count()) { $selectedFilters[] = $producersSelectedFilters; } $propertiesSelectedFilters = $this->getPropertiesSelectedFilter($products); $selectedFilters = array_merge($selectedFilters, $propertiesSelectedFilters); return $selectedFilters; } /** * @return array */ protected function getProductFields() { $fieldsForList = ProductsRepository::$fieldsForList; $fieldsForList[] = '_categories.url_in'; return $fieldsForList; } /** * @param Products $products * @return Data\Collection\Filters\PriceRanges */ protected function getPriceSelectedFilters($products) { $converterSelectedFilter = new Data\Converter\Filters\Selected\PriceRangesConverter(); $priceRangesSelectedFilter = $converterSelectedFilter->convert($products, array( new Data\Converter\Filters\Callback\PriceRanges\SetIsNofollow(), new Callback\PriceRanges\SetName() )); return $priceRangesSelectedFilter; } /** * @param Products $products * @return Data\Collection\Filters\PriceRanges */ protected function getPriceFilters($products) { $converterFilter = new Data\Converter\Filters\PriceRangesConverter(); $priceRangesSelectedFilter = $converterFilter->convert($products, array( new Data\Converter\Filters\Callback\PriceRanges\SetIsNofollow(), )); return $priceRangesSelectedFilter; } /** * @param $products * @return Data\Collection\Filters\Producers */ protected function getProducersSelectedFilters($products) { $converterSelectedFilter = new Data\Converter\Filters\Selected\ProducersConverter(); $producersSelectedFilter = $converterSelectedFilter->convert($products, array( new Data\Converter\Filters\Callback\Producers\SetIsNofollow(), )); return $producersSelectedFilter; } /** * @param $products * @return Data\Collection\Filters\Producers */ protected function getProducersFilters($products) { $converterFilter = new Data\Converter\Filters\ProducersConverter(); $producersSelectedFilter = $converterFilter->convert($products, array( new Data\Converter\Filters\Callback\Producers\SetIsNofollow(), new Data\Converter\Filters\Callback\Producers\SetIsPopular(), new Data\Converter\Filters\Callback\Producers\SetIsActive(), new Data\Converter\Filters\Callback\Producers\SortByName(), )); return $producersSelectedFilter; } /** * @param Products $products * @return Data\Collection\Filters\PropertyAbstract[] */ protected function getPropertiesSelectedFilter($products) { $converterSelectedFilter = new Data\Converter\Filters\Selected\PropertiesConverter(); $propertiesFilter = $converterSelectedFilter->convert($products, array( new Data\Converter\Filters\Callback\Property\SetIsNofollow(), )); return $propertiesFilter; } /** * @param Products $products * @return Data\Collection\Filters\PropertyAbstract[] */ protected function getPropertiesFilters($products) { $converterFilter = new Data\Converter\Filters\PropertiesConverter(); $propertiesFilter = $converterFilter->convert($products, array( new Data\Converter\Filters\Callback\Property\SetIsActive(), new Data\Converter\Filters\Callback\Property\SetIsExcluded(), new Data\Converter\Filters\Callback\Property\SetIsNofollow(), new Data\Converter\Filters\Callback\Property\SortDefault(), )); return $propertiesFilter; } /** * @param Category $category * @param Products $products * @return Data\Collection\Filters\Categories */ protected function getCategoriesFilters($category, $products) { $converterFilter = new Data\Converter\Filters\CategoriesConverter(); $categoriesFilter = $converterFilter->convert($products, array( new Callback\Categories\ReduceIncorrectCategories(), new Data\Converter\Filters\Callback\Categories\SetIsExcluded(), new Data\Converter\Filters\Callback\Categories\SortByName(), new Callback\Categories\SetParentCategory($category, $this->get('categories.allowed')) )); return $categoriesFilter; } /** * @param Breadcrumb[] $breadcrumbs * @param array $selectedFilters * @param Pagination $pagination * @return string */ protected function prepareMetadataTitle($breadcrumbs, $selectedFilters, $pagination) { $title = ""; if (count($breadcrumbs)) { if ($selectedFilters && count($breadcrumbs) > 1) { $title .= $breadcrumbs[count($breadcrumbs) - 2]->getTitle(); } $title .= " " . $breadcrumbs[count($breadcrumbs) - 1]->getTitle(); } if ($pagination->getCurrentPage() > 1) { $title .= " (str. " . $pagination->getCurrentPage() . ")"; } return $title; } /** * @param Products $products * @return string */ protected function getCanonical($products) { return $products ? $products->getMetadata()->getCanonical() : ''; } }
{ "content_hash": "cfcd7f758f40a36aafdd64b2d0d4b2db", "timestamp": "", "source": "github", "line_count": 346, "max_line_length": 146, "avg_line_length": 35.97976878612717, "alnum_prop": 0.6384448550084344, "repo_name": "nokaut/white-label-demo", "id": "a0a7234c4ad9ed411b58b1905166dbc929c3d6b9", "size": "12449", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/WL/AppBundle/Controller/CategoryController.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "14725" }, { "name": "Dockerfile", "bytes": "324" }, { "name": "JavaScript", "bytes": "160227" }, { "name": "Less", "bytes": "245696" }, { "name": "PHP", "bytes": "187242" }, { "name": "Shell", "bytes": "364" }, { "name": "Twig", "bytes": "80077" } ], "symlink_target": "" }
package com.ztools.http; import java.util.Hashtable; import java.util.ResourceBundle; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; public abstract class HttpUtil { private static final String LSTRING_FILE = "javax.servlet.http.LocalStrings"; private static ResourceBundle lStrings; }
{ "content_hash": "a4c235ab845b056870c6f348aa1e62f1", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 79, "avg_line_length": 22.333333333333332, "alnum_prop": 0.8119402985074626, "repo_name": "wyelite/mtools", "id": "cc4c6acee2bc50461a82a5aa3c5fe2a77d942080", "size": "335", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "mtools/src/test/java/com/ztools/http/HttpUtil.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Groovy", "bytes": "246" }, { "name": "Java", "bytes": "675999" }, { "name": "PLSQL", "bytes": "316" } ], "symlink_target": "" }
/** * This code was auto-generated by a tool. * * Changes to this file may cause incorrect behavior and will be lost if * the code is regenerated. */ package com.mozu.test.framework.datafactory; import java.util.List; import java.util.ArrayList; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; import com.mozu.api.resources.commerce.catalog.admin.attributedefinition.producttypes.ProductTypePropertyResource; /** <summary> * Use the Properties subresource to define how property product attributes are used for a specific product type. Product attribute definitions are unique for each associated product type. * </summary> */ public class ProductTypePropertyFactory { public static List<com.mozu.api.contracts.productadmin.AttributeInProductType> getProperties(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, int expectedCode, int successCode) throws Exception { List<com.mozu.api.contracts.productadmin.AttributeInProductType> returnObj = new ArrayList<com.mozu.api.contracts.productadmin.AttributeInProductType>(); ProductTypePropertyResource resource = new ProductTypePropertyResource(apiContext, dataViewMode); try { returnObj = resource.getProperties( productTypeId); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); else return null; } if(expectedCode != successCode) throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); return returnObj; } public static com.mozu.api.contracts.productadmin.AttributeInProductType getProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception { return getProperty(apiContext, dataViewMode, productTypeId, attributeFQN, null, expectedCode, successCode ); } public static com.mozu.api.contracts.productadmin.AttributeInProductType getProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypePropertyResource resource = new ProductTypePropertyResource(apiContext, dataViewMode); try { returnObj = resource.getProperty( productTypeId, attributeFQN, responseFields); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); else return null; } if(expectedCode != successCode) throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); return returnObj; } public static com.mozu.api.contracts.productadmin.AttributeInProductType addProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, int expectedCode, int successCode) throws Exception { return addProperty(apiContext, dataViewMode, attributeInProductType, productTypeId, null, expectedCode, successCode ); } public static com.mozu.api.contracts.productadmin.AttributeInProductType addProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String responseFields, int expectedCode, int successCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypePropertyResource resource = new ProductTypePropertyResource(apiContext, dataViewMode); try { returnObj = resource.addProperty( attributeInProductType, productTypeId, responseFields); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); else return null; } if(expectedCode != successCode) throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); return returnObj; } public static com.mozu.api.contracts.productadmin.AttributeInProductType updateProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception { return updateProperty(apiContext, dataViewMode, attributeInProductType, productTypeId, attributeFQN, null, expectedCode, successCode ); } public static com.mozu.api.contracts.productadmin.AttributeInProductType updateProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypePropertyResource resource = new ProductTypePropertyResource(apiContext, dataViewMode); try { returnObj = resource.updateProperty( attributeInProductType, productTypeId, attributeFQN, responseFields); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); else return null; } if(expectedCode != successCode) throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); return returnObj; } public static void deleteProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception { ProductTypePropertyResource resource = new ProductTypePropertyResource(apiContext, dataViewMode); try { resource.deleteProperty( productTypeId, attributeFQN); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); else return; } if(expectedCode != successCode) throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); } }
{ "content_hash": "8677eec368e5af8e338039d8e1c536c7", "timestamp": "", "source": "github", "line_count": 139, "max_line_length": 353, "avg_line_length": 51.76258992805755, "alnum_prop": 0.7799861014593468, "repo_name": "eileenzhuang1/mozu-java", "id": "92691cc6a5abac7b32626602f3ea197580ee5c23", "size": "7195", "binary": false, "copies": "1", "ref": "refs/heads/Dev", "path": "mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypePropertyFactory.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "204" }, { "name": "CSS", "bytes": "23639" }, { "name": "HTML", "bytes": "6359" }, { "name": "Java", "bytes": "4693403" }, { "name": "JavaScript", "bytes": "88153" } ], "symlink_target": "" }
package org.apache.camel.util; import java.util.EventObject; import java.util.List; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Route; import org.apache.camel.StatefulService; import org.apache.camel.spi.EventFactory; import org.apache.camel.spi.EventNotifier; import org.apache.camel.spi.ManagementStrategy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Helper for easily sending event notifications in a single line of code * * @version */ public final class EventHelper { private static final Logger LOG = LoggerFactory.getLogger(EventHelper.class); private EventHelper() { } public static void notifyCamelContextStarting(CamelContext context) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreCamelContextEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createCamelContextStartingEvent(context); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyCamelContextStarted(CamelContext context) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreCamelContextEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createCamelContextStartedEvent(context); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyCamelContextStartupFailed(CamelContext context, Throwable cause) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreCamelContextEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createCamelContextStartupFailureEvent(context, cause); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyCamelContextStopping(CamelContext context) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreCamelContextEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createCamelContextStoppingEvent(context); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyCamelContextStopped(CamelContext context) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreCamelContextEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createCamelContextStoppedEvent(context); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyCamelContextStopFailed(CamelContext context, Throwable cause) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreCamelContextEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createCamelContextStopFailureEvent(context, cause); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyServiceStopFailure(CamelContext context, Object service, Throwable cause) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreServiceEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createServiceStopFailureEvent(context, service, cause); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyServiceStartupFailure(CamelContext context, Object service, Throwable cause) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreServiceEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createServiceStartupFailureEvent(context, service, cause); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyRouteStarted(CamelContext context, Route route) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreRouteEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createRouteStartedEvent(route); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyRouteStopped(CamelContext context, Route route) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreRouteEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createRouteStoppedEvent(route); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyRouteAdded(CamelContext context, Route route) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreRouteEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createRouteAddedEvent(route); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyRouteRemoved(CamelContext context, Route route) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreRouteEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createRouteRemovedEvent(route); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyExchangeCreated(CamelContext context, Exchange exchange) { if (exchange.getProperty(Exchange.NOTIFY_EVENT, false, Boolean.class)) { // do not generate events for an notify event return; } ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreExchangeEvents() || notifier.isIgnoreExchangeCreatedEvent()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createExchangeCreatedEvent(exchange); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyExchangeDone(CamelContext context, Exchange exchange) { if (exchange.getProperty(Exchange.NOTIFY_EVENT, false, Boolean.class)) { // do not generate events for an notify event return; } ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreExchangeEvents() || notifier.isIgnoreExchangeCompletedEvent()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createExchangeCompletedEvent(exchange); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyExchangeFailed(CamelContext context, Exchange exchange) { if (exchange.getProperty(Exchange.NOTIFY_EVENT, false, Boolean.class)) { // do not generate events for an notify event return; } ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreExchangeEvents() || notifier.isIgnoreExchangeFailedEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createExchangeFailedEvent(exchange); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyExchangeFailureHandled(CamelContext context, Exchange exchange, Processor failureHandler, boolean deadLetterChannel) { if (exchange.getProperty(Exchange.NOTIFY_EVENT, false, Boolean.class)) { // do not generate events for an notify event return; } ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreExchangeEvents() || notifier.isIgnoreExchangeFailedEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createExchangeFailureHandledEvent(exchange, failureHandler, deadLetterChannel); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyExchangeRedelivery(CamelContext context, Exchange exchange, int attempt) { if (exchange.getProperty(Exchange.NOTIFY_EVENT, false, Boolean.class)) { // do not generate events for an notify event return; } ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreExchangeEvents() || notifier.isIgnoreExchangeFailedEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createExchangeRedeliveryEvent(exchange, attempt); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyExchangeSending(CamelContext context, Exchange exchange, Endpoint endpoint) { if (exchange.getProperty(Exchange.NOTIFY_EVENT, false, Boolean.class)) { // do not generate events for an notify event return; } ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreExchangeEvents() || notifier.isIgnoreExchangeSentEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createExchangeSendingEvent(exchange, endpoint); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyExchangeSent(CamelContext context, Exchange exchange, Endpoint endpoint, long timeTaken) { if (exchange.getProperty(Exchange.NOTIFY_EVENT, false, Boolean.class)) { // do not generate events for an notify event return; } ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreExchangeEvents() || notifier.isIgnoreExchangeSentEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createExchangeSentEvent(exchange, endpoint, timeTaken); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyCamelContextSuspending(CamelContext context) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreCamelContextEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createCamelContextSuspendingEvent(context); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyCamelContextSuspended(CamelContext context) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreCamelContextEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createCamelContextSuspendedEvent(context); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyCamelContextResuming(CamelContext context) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreCamelContextEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createCamelContextResumingEvent(context); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyCamelContextResumed(CamelContext context) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreCamelContextEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createCamelContextResumedEvent(context); if (event == null) { return; } doNotifyEvent(notifier, event); } } public static void notifyCamelContextResumeFailed(CamelContext context, Throwable cause) { ManagementStrategy management = context.getManagementStrategy(); if (management == null) { return; } List<EventNotifier> notifiers = management.getEventNotifiers(); if (notifiers == null || notifiers.isEmpty()) { return; } for (EventNotifier notifier : notifiers) { if (notifier.isIgnoreCamelContextEvents()) { continue; } EventFactory factory = management.getEventFactory(); if (factory == null) { return; } EventObject event = factory.createCamelContextResumeFailureEvent(context, cause); if (event == null) { return; } doNotifyEvent(notifier, event); } } private static void doNotifyEvent(EventNotifier notifier, EventObject event) { // only notify if notifier is started boolean started = true; if (notifier instanceof StatefulService) { started = ((StatefulService) notifier).isStarted(); } if (!started) { LOG.debug("Ignoring notifying event {}. The EventNotifier has not been started yet: {}", event, notifier); return; } if (!notifier.isEnabled(event)) { LOG.trace("Notifier: {} is not enabled for the event: {}", notifier, event); return; } try { notifier.notify(event); } catch (Throwable e) { LOG.warn("Error notifying event " + event + ". This exception will be ignored. ", e); } } }
{ "content_hash": "55f9fbb310cf33b56d10224644e3999f", "timestamp": "", "source": "github", "line_count": 762, "max_line_length": 119, "avg_line_length": 32.034120734908136, "alnum_prop": 0.557476444080295, "repo_name": "logzio/camel", "id": "f80983abe916f2e5a2be012ad5588de9d4448b98", "size": "25213", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "camel-core/src/main/java/org/apache/camel/util/EventHelper.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ActionScript", "bytes": "20202" }, { "name": "Batchfile", "bytes": "106" }, { "name": "CSS", "bytes": "221391" }, { "name": "Eagle", "bytes": "2898" }, { "name": "Elm", "bytes": "5970" }, { "name": "FreeMarker", "bytes": "12394" }, { "name": "Groovy", "bytes": "23444" }, { "name": "HTML", "bytes": "406194" }, { "name": "Java", "bytes": "42719701" }, { "name": "JavaScript", "bytes": "3695475" }, { "name": "PHP", "bytes": "88860" }, { "name": "Protocol Buffer", "bytes": "578" }, { "name": "Python", "bytes": "36" }, { "name": "Ruby", "bytes": "4802" }, { "name": "Scala", "bytes": "299988" }, { "name": "Shell", "bytes": "9057" }, { "name": "Tcl", "bytes": "4974" }, { "name": "XQuery", "bytes": "546" }, { "name": "XSLT", "bytes": "284036" } ], "symlink_target": "" }
<?php namespace Doctrine\DBAL\Driver\SQLSrv; use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\SQLSrv\Exception\Error; use Doctrine\DBAL\Driver\Statement as StatementInterface; use Doctrine\DBAL\ParameterType; use Doctrine\Deprecations\Deprecation; use function assert; use function func_num_args; use function is_int; use function sqlsrv_execute; use function SQLSRV_PHPTYPE_STREAM; use function SQLSRV_PHPTYPE_STRING; use function sqlsrv_prepare; use function SQLSRV_SQLTYPE_VARBINARY; use function stripos; use const SQLSRV_ENC_BINARY; use const SQLSRV_ENC_CHAR; use const SQLSRV_PARAM_IN; final class Statement implements StatementInterface { /** * The SQLSRV Resource. * * @var resource */ private $conn; /** * The SQL statement to execute. */ private string $sql; /** * The SQLSRV statement resource. * * @var resource|null */ private $stmt; /** * References to the variables bound as statement parameters. * * @var array<int, mixed> */ private array $variables = []; /** * Bound parameter types. * * @var array<int, int> */ private array $types = []; /** * Append to any INSERT query to retrieve the last insert id. */ private const LAST_INSERT_ID_SQL = ';SELECT SCOPE_IDENTITY() AS LastInsertId;'; /** * @internal The statement can be only instantiated by its driver connection. * * @param resource $conn * @param string $sql */ public function __construct($conn, $sql) { $this->conn = $conn; $this->sql = $sql; if (stripos($sql, 'INSERT INTO ') !== 0) { return; } $this->sql .= self::LAST_INSERT_ID_SQL; } /** * {@inheritdoc} */ public function bindValue($param, $value, $type = ParameterType::STRING): bool { assert(is_int($param)); if (func_num_args() < 3) { Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindValue() is deprecated.' . ' Pass the type corresponding to the parameter being bound.', ); } $this->variables[$param] = $value; $this->types[$param] = $type; return true; } /** * {@inheritdoc} * * @deprecated Use {@see bindValue()} instead. */ public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool { Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5563', '%s is deprecated. Use bindValue() instead.', __METHOD__, ); assert(is_int($param)); if (func_num_args() < 3) { Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindParam() is deprecated.' . ' Pass the type corresponding to the parameter being bound.', ); } $this->variables[$param] =& $variable; $this->types[$param] = $type; // unset the statement resource if it exists as the new one will need to be bound to the new variable $this->stmt = null; return true; } /** * {@inheritdoc} */ public function execute($params = null): ResultInterface { if ($params !== null) { Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5556', 'Passing $params to Statement::execute() is deprecated. Bind parameters using' . ' Statement::bindParam() or Statement::bindValue() instead.', ); foreach ($params as $key => $val) { if (is_int($key)) { $this->bindValue($key + 1, $val, ParameterType::STRING); } else { $this->bindValue($key, $val, ParameterType::STRING); } } } $this->stmt ??= $this->prepare(); if (! sqlsrv_execute($this->stmt)) { throw Error::new(); } return new Result($this->stmt); } /** * Prepares SQL Server statement resource * * @return resource * * @throws Exception */ private function prepare() { $params = []; foreach ($this->variables as $column => &$variable) { switch ($this->types[$column]) { case ParameterType::LARGE_OBJECT: $params[$column - 1] = [ &$variable, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY), SQLSRV_SQLTYPE_VARBINARY('max'), ]; break; case ParameterType::BINARY: $params[$column - 1] = [ &$variable, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY), ]; break; case ParameterType::ASCII: $params[$column - 1] = [ &$variable, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), ]; break; default: $params[$column - 1] =& $variable; break; } } $stmt = sqlsrv_prepare($this->conn, $this->sql, $params); if ($stmt === false) { throw Error::new(); } return $stmt; } }
{ "content_hash": "37f6fe9c4d387ea273311bf4983b57bc", "timestamp": "", "source": "github", "line_count": 223, "max_line_length": 109, "avg_line_length": 26.72645739910314, "alnum_prop": 0.5067114093959731, "repo_name": "doctrine/dbal", "id": "1244ba51a4a272f6bbb94e8bd2d311ca8b466954", "size": "5960", "binary": false, "copies": "1", "ref": "refs/heads/3.5.x", "path": "src/Driver/SQLSrv/Statement.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "2404472" }, { "name": "Shell", "bytes": "735" } ], "symlink_target": "" }
// Copyright 2010 Google Inc. All Rights Reserved. package com.crawljax.core.exception; import com.crawljax.core.state.CrawlPath; /** * This exception wraps a CrawlPath into a Throwable. Basically providing a StackTrace of the Path * taken to reach an Exception point. * * @version $Id$ * @author [email protected] (Stefan Lenselink) */ public class CrawlPathToException extends Exception { /** * Generated serial version UID */ private static final long serialVersionUID = 5794807783433728198L; /** * Build a new {@link CrawlPathToException} given a path taken. * * @param message * the message to supply with this exception *@param path * the CrawlPath taken that causes this exception. * @param cause * the root cause of this exception. */ public CrawlPathToException(String message, CrawlPath path, Throwable cause) { super(message, cause); setStackTrace(path.asStackTrace()); } /** * Build a new {@link CrawlPathToException} given a path taken. * * @param message * the message to supply with this exception *@param path * the CrawlPath taken that causes this exception. */ public CrawlPathToException(String message, CrawlPath path) { this(message, path, null); } /** * Build a new {@link CrawlPathToException} given a path taken. * * @param path * the CrawlPath taken that causes this exception. * @param cause * the root cause of this exception. */ public CrawlPathToException(CrawlPath path, Throwable cause) { this(null, path, cause); } /** * Build a new {@link CrawlPathToException} given a path taken. * * @param path * the CrawlPath taken that causes this exception. */ public CrawlPathToException(CrawlPath path) { this(null, path, null); } }
{ "content_hash": "49d0c0758f0cd7579f7a96323596463c", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 98, "avg_line_length": 26.840579710144926, "alnum_prop": 0.6781857451403888, "repo_name": "shauvik/crawljax-old", "id": "c4d67092547668ffbcd76d8931dd6177d5141a80", "size": "1852", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/crawljax/core/exception/CrawlPathToException.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "597594" }, { "name": "JavaScript", "bytes": "5629" } ], "symlink_target": "" }
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Jury extends MY_Controller { //CONSTRUCT public function __construct() { parent::__construct(); } //VIEW MARATHON LIST public function Marathon() { if($this->process->CheckAdminUser()) { if(!$this->process->checkLock()) { //SET TITLE $this->layout->set_title('Judge' . $this->layout->title_separator . 'Marathon List'); //ADD CSS AND JS HEADER $this->layout->add_includes('css', 'assets/css/plugins/dataTables/dataTables.bootstrap.css','header',$prepend_base_url = TRUE); $this->layout->add_includes('css', 'assets/css/plugins/dataTables/dataTables.responsive.css','header',$prepend_base_url = TRUE); $this->layout->add_includes('css', 'assets/css/plugins/dataTables/dataTables.tableTools.min.css','header',$prepend_base_url = TRUE); $this->layout->add_includes('css', 'assets/css/plugins/dropzone/dropzone.css','header',$prepend_base_url = TRUE); //ADD JS FOOTER if($this->session->userdata('site_lang') == 'Spanish') $this->layout->add_includes('js', 'assets/js/plugins/validate/Spanish_messages.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/validate/jquery.validate.min.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/jquery.dataTables.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/dataTables.bootstrap.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/dataTables.responsive.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/dataTables.tableTools.min.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dropzone/dropzone.js', 'footer',$prepend_base_url = TRUE); //CONF $this->layout->add_includes('js', 'assets/js/conf/team/MarathonList.js', 'footer',$prepend_base_url = TRUE); if( isset($_POST['open'])) { $data['id'] = $this->security->xss_clean($this->input->post('open')); $data['idFlag'] = ( ( empty($data['id']) ) ? 1 : 0 ); if(! $data['idFlag'] ) { //CONF DROPZONE $this->layout->add_includes('js', 'assets/js/conf/jury/MarathonRepo.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('css', 'assets/css/plugins/switchery/switchery.css','header',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/switchery/switchery.js', 'footer',$prepend_base_url = TRUE); //GET PROBLEMS LIST $data['problems'] = $this->process->get_MarathonRepo($data); //GET PROBLEMS LIST $data['problem'] = $this->process->get_MarathonProblems($data); //GET TEAMS $data['teams'] = $this->process->get_MarathonTeam($data); //LOAD VIEW $this->layout->view('Jury/MarathonRepo', $data); } } else { if( isset($_POST['marathon'])) { $data['marathon'] = $this->security->xss_clean($this->input->post('marathon')); $data['all'] = $this->security->xss_clean($this->input->post('all')); $data['marathonFlag'] = ( ( empty($data['marathon']) ) ? 1 : 0 ); if(! $data['marathonFlag']) { //GET PROBLEMS LIST if($this->process->ReJudgeMarathon($data)) { $this->layout->add_includes('js', 'assets/js/conf/message/'.$this->session->userdata('site_lang').'/successReJudgeMarathon.js', 'footer',$prepend_base_url = TRUE); } else { $this->layout->add_includes('js', 'assets/js/conf/message/'.$this->session->userdata('site_lang').'/error.js', 'footer',$prepend_base_url = TRUE); } } //GET MARATHON LIST $data['marathon'] = $this->process->get_marathonJury(); //LOAD VIEW $this->layout->view('Jury/Marathon', $data); } else { //GET MARATHON LIST $data['marathon'] = $this->process->get_marathonJury(); //LOAD VIEW $this->layout->view('Jury/Marathon', $data); } } } else { $this->lock(); } } else { $this->logout(); } } //VIEW CLARIFICATION public function Clarification() { if($this->process->CheckAdminUser()) { if(!$this->process->checkLock()) { //SET TITLE $this->layout->set_title('Judge' . $this->layout->title_separator . 'Clarification'); //ADD CSS AND JS HEADER $this->layout->add_includes('css', 'assets/css/plugins/iCheck/custom.css','header',$prepend_base_url = TRUE); //ADD JS FOOTER $this->layout->add_includes('js', 'assets/js/plugins/iCheck/icheck.min.js', 'footer',$prepend_base_url = TRUE); //CONF $this->layout->add_includes('js', 'assets/js/conf/jury/Clarification.js', 'footer',$prepend_base_url = TRUE); if( isset($_POST['open'])) { $data['id'] = $this->security->xss_clean($this->input->post('open')); $data['idFlag'] = ( ( empty($data['id']) ) ? 1 : 0 ); if(! $data['idFlag'] ) { //GET PROBLEMS LIST $data['problems'] = $this->process->get_MarathonProblems($data); //GET TEAMS $data['teams'] = $this->process->get_MarathonTeam($data); //LOAD VIEW $this->layout->view('Jury/Clarification',$data); } } else { //LOAD VIEW $this->ListMarathon(); } } else { $this->lock(); } } else { $this->logout(); } } //FILL CLARIFICATION HISTORY public function FillClarification() { if($this->process->CheckAdminUser() && !$this->process->checkLock()) { $data['team'] = $this->security->xss_clean($this->input->post('team')); $data['teamFlag'] = ( ( empty($data['team']) ) ? 1 : 0 ); $data['marathon'] = $this->security->xss_clean($this->input->post('marathon')); $data['marathonFlag'] = ( ( empty($data['marathon']) ) ? 1 : 0 ); $html=''; if(! $data['marathonFlag']) { $query=$this->process->FillClarification($data); if($query->num_rows() > 0) { foreach ($query->result_array() as $row) { $html .='<div class="chat-message '.((($row['jury'])=='t') ? "right": "left").'" > <div class="message"> <a class="message-author" href="#">'.$row["name"].''.((($row["problems_id"])!= 0) ? " - ".$this->lang->line("Problem").": ".$row["problems_id"]: "").'</a> <span class="message-date">'.$row['time'].'</span> <span class="message-content">'.$row['text'].'</span> </div> </div>'; } } } echo $html; } else { echo 'logOut'; } } //SEND MESSAGE CLARIFICATION public function SendClarification() { if($this->process->CheckAdminUser() && !$this->process->checkLock()) { $data['team'] = $this->security->xss_clean($this->input->post('team')); $data['teamFlag'] = ( ( empty($data['team']) ) ? 1 : 0 ); $data['marathon'] = $this->security->xss_clean($this->input->post('marathon')); $data['marathonFlag'] = ( ( empty($data['marathon']) ) ? 1 : 0 ); $data['text'] = $this->security->xss_clean($this->input->post('text')); $data['textFlag'] = ( ( empty($data['text']) ) ? 1 : 0 ); $data['problem'] = $this->security->xss_clean($this->input->post('problem')); $data['problemFlag'] = ( ( empty($data['problem']) ) ? 1 : 0 ); echo $this->process->JuryClarification($data); } else { echo 'logOut'; } } //SEND MESSAGE CLARIFICATION public function SendUserClarification() { if($this->process->checkLoggedIn() && !$this->process->checkLock()) { $data['marathon'] = $this->security->xss_clean($this->input->post('marathon')); $data['marathonFlag'] = ( ( empty($data['marathon']) ) ? 1 : 0 ); $data['text'] = $this->security->xss_clean($this->input->post('text')); $data['textFlag'] = ( ( empty($data['text']) ) ? 1 : 0 ); $data['problem'] = $this->security->xss_clean($this->input->post('problem')); $data['problemFlag'] = ( ( empty($data['problem']) ) ? 1 : 0 ); if($this->process->get_MarathonStart($data)) { echo $this->process->UserClarification($data); } else echo ''; } else { echo 'logOut'; } } //FILL TEAM CLARIFICATION HISTORY public function FillTeamClarification() { if($this->process->checkLoggedIn() && !$this->process->checkLock()) { $data['problem'] = $this->security->xss_clean($this->input->post('problem')); $data['problemFlag'] = ( ( empty($data['problem']) ) ? 1 : 0 ); $data['marathon'] = $this->security->xss_clean($this->input->post('marathon')); $data['marathonFlag'] = ( ( empty($data['marathon']) ) ? 1 : 0 ); $html=''; if(! $data['marathonFlag'] ) { $query=$this->process->FillTeamClarification($data); if($query->num_rows() > 0) { foreach ($query->result_array() as $row) { $html .='<div class="chat-message '.((($row['jury'])=='t') ? "right": "left").'"> <div class="message"> <a class="message-author" href="#">'.$row['name'].'</a> <span class="message-date">'.$row['time'].'</span> <span class="message-content">'.$row['text'].'</span> </div> </div>'; } } } echo $html; } else { echo 'logOut'; } } //VIEW MARATHON LIST public function JudgeList() { if($this->process->CheckAdminUser()) { if(!$this->process->checkLock()) { //SET TITLE $this->layout->set_title('Judge' . $this->layout->title_separator . 'Judge List'); //ADD CSS AND JS HEADER $this->layout->add_includes('css', 'assets/css/plugins/dataTables/dataTables.bootstrap.css','header',$prepend_base_url = TRUE); $this->layout->add_includes('css', 'assets/css/plugins/dataTables/dataTables.responsive.css','header',$prepend_base_url = TRUE); $this->layout->add_includes('css', 'assets/css/plugins/dataTables/dataTables.tableTools.min.css','header',$prepend_base_url = TRUE); $this->layout->add_includes('css', 'assets/css/plugins/switchery/switchery.css','header',$prepend_base_url = TRUE); //ADD JS FOOTER if($this->session->userdata('site_lang') == 'Spanish') $this->layout->add_includes('js', 'assets/js/plugins/validate/Spanish_messages.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/validate/jquery.validate.min.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/jquery.dataTables.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/dataTables.bootstrap.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/dataTables.responsive.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/dataTables.tableTools.min.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/switchery/switchery.js', 'footer',$prepend_base_url = TRUE); //CONF MESSAGE $this->layout->add_includes('js', 'assets/js/conf/jury/JudgeCases.js', 'footer',$prepend_base_url = TRUE); if( isset($_POST['marathon']) && isset($_POST['problem']) && isset($_POST['all'])) { $data['marathon'] = $this->security->xss_clean($this->input->post('marathon')); $data['all'] = $this->security->xss_clean($this->input->post('all')); $data['problem'] = $this->security->xss_clean($this->input->post('problem')); $data['marathonFlag'] = ( ( empty($data['marathon']) ) ? 1 : 0 ); $data['problemFlag'] = ( ( empty($data['problem']) ) ? 1 : 0 ); if(! $data['marathonFlag'] || $data['problemFlag'] ) { //GET PROBLEMS LIST if($this->process->ReJudgeProblem($data)) { $this->layout->add_includes('js', 'assets/js/conf/message/'.$this->session->userdata('site_lang').'/successReJudgeProblem.js', 'footer',$prepend_base_url = TRUE); } else { $this->layout->add_includes('js', 'assets/js/conf/message/'.$this->session->userdata('site_lang').'/error.js', 'footer',$prepend_base_url = TRUE); } //GET MARATHON RECEIVED $data['received'] = $this->process->get_marathonReceived($data); //LOAD VIEW $this->layout->view('Jury/JudgeList', $data); } } else { if( isset($_POST['marathonJudge']) && isset($_POST['problemJudge'])) { $data['marathon'] = $this->security->xss_clean($this->input->post('marathonJudge')); $data['marathonFlag'] = ( ( empty($data['marathon']) ) ? 1 : 0 ); $data['problem'] = $this->security->xss_clean($this->input->post('problemJudge')); $data['problemFlag'] = ( ( empty($data['problem']) ) ? 1 : 0 ); if(! ($data['problemFlag'] || $data['marathonFlag'])) { //GET MARATHON RECEIVED $data['received'] = $this->process->get_marathonReceived($data); //LOAD VIEW $this->layout->view('Jury/JudgeList', $data); } } else { $this->ListMarathon(); } } } else { $this->lock(); } } else { $this->logout(); } } //VIEW MARATHON LIST public function JudgeProblem() { if($this->process->CheckAdminUser()) { if(!$this->process->checkLock()) { //SET TITLE $this->layout->set_title('Judge' . $this->layout->title_separator . 'Judge Problem'); //ADD CSS AND JS HEADER $this->layout->add_includes('css', 'assets/css/plugins/dataTables/dataTables.bootstrap.css','header',$prepend_base_url = TRUE); $this->layout->add_includes('css', 'assets/css/plugins/dataTables/dataTables.responsive.css','header',$prepend_base_url = TRUE); $this->layout->add_includes('css', 'assets/css/plugins/dataTables/dataTables.tableTools.min.css','header',$prepend_base_url = TRUE); $this->layout->add_includes('css', 'assets/css/plugins/switchery/switchery.css','header',$prepend_base_url = TRUE); //ADD JS FOOTER if($this->session->userdata('site_lang') == 'Spanish') $this->layout->add_includes('js', 'assets/js/plugins/validate/Spanish_messages.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/validate/jquery.validate.min.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/jquery.dataTables.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/dataTables.bootstrap.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/dataTables.responsive.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/dataTables/dataTables.tableTools.min.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/preetyTextDiff/jquery.pretty-text-diff.min.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/diff_match_patch/javascript/diff_match_patch.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/switchery/switchery.js', 'footer',$prepend_base_url = TRUE); $this->layout->add_includes('js', 'assets/js/plugins/autogrow/autogrow.js', 'footer',$prepend_base_url = TRUE); //CONF MESSAGE $this->layout->add_includes('js', 'assets/js/conf/jury/JudgeProblem.js', 'footer',$prepend_base_url = TRUE); if( isset($_POST['marathon']) && isset($_POST['received'])) { $data['marathon'] = $this->security->xss_clean($this->input->post('marathon')); $data['received'] = $this->security->xss_clean($this->input->post('received')); $data['marathonFlag'] = ( ( empty($data['marathon']) ) ? 1 : 0 ); $data['receivedFlag'] = ( ( empty($data['received']) ) ? 1 : 0 ); if(! $data['marathonFlag'] || $data['receivedFlag'] ) { //GET PROBLEMS LIST if($this->process->ReJudgeSubmission($data)) { $this->layout->add_includes('js', 'assets/js/conf/message/'.$this->session->userdata('site_lang').'/successReJudgeProblem.js', 'footer',$prepend_base_url = TRUE); } else { $this->layout->add_includes('js', 'assets/js/conf/message/'.$this->session->userdata('site_lang').'/error.js', 'footer',$prepend_base_url = TRUE); } $data['id'] = $data['received']; //GET MARATHON PROBLEM - TEAM FOR JUDGE $data['JudgeProblem'] = $this->process->get_JudgeProblem($data); //LOAD VIEW $this->layout->view('Jury/JudgeProblem', $data); } } else { if(isset($_POST['id'])) { $data['id'] = $this->security->xss_clean($this->input->post('id')); $data['idFlag'] = ( ( empty($data['id']) ) ? 1 : 0 ); if(! ($data['idFlag'] )) { //GET MARATHON PROBLEM - TEAM FOR JUDGE $data['JudgeProblem'] = $this->process->get_JudgeProblem($data); //LOAD VIEW $this->layout->view('Jury/JudgeProblem', $data); } else { $this->ListMarathon(); } } else { $this->ListMarathon(); } } } else { $this->lock(); } } else { $this->logout(); } } //VIEW MARATHON LIST public function GetCaseOutput() { if($this->process->CheckAdminUser()) { if(!$this->process->checkLock()) { $data['problem'] = $this->security->sanitize_filename($this->input->post('problem')); $data['problemFlag'] = ( ( empty($data['problem']) ) ? 1 : 0 ); $data['casename'] = $this->security->sanitize_filename($this->input->post('casename')); $data['casenameFlag'] = ( ( empty($data['casename']) ) ? 1 : 0 ); if(! ($data['problemFlag'] || $data['casenameFlag'])) { $path='./uploads/problem/testcases/'.$data['problem'].'/output/'.$data['casename']; echo $this->load->file($path, true); } } else { $this->lock(); } } else { $this->logout(); } } //VIEW MARATHON LIST public function GetTeamOutput() { if($this->process->CheckAdminUser()) { if(!$this->process->checkLock()) { $data['marathon'] = $this->security->sanitize_filename($this->input->post('marathon')); $data['marathonFlag'] = ( ( empty($data['marathon']) ) ? 1 : 0 ); $data['team'] = $this->security->sanitize_filename($this->input->post('team')); $data['teamFlag'] = ( ( empty($data['team']) ) ? 1 : 0 ); $data['problem'] = $this->security->sanitize_filename($this->input->post('problem')); $data['problemFlag'] = ( ( empty($data['problem']) ) ? 1 : 0 ); $data['casename'] = $this->security->sanitize_filename($this->input->post('casename')); $data['casenameFlag'] = ( ( empty($data['casename']) ) ? 1 : 0 ); if(! ($data['marathonFlag'] || $data['teamFlag'] || $data['problemFlag'] || $data['casenameFlag'])) { $path='./uploads/output/marathon/'.$data['marathon'].'/'.$data['team'].'/'.$data['problem'].'/'.$data['casename']; echo $this->load->file($path, true); } } else { $this->lock(); } } else { $this->logout(); } } //SET RECEIVED VERIFIED public function SetVerified() { if($this->process->CheckAdminUser()) { if(!$this->process->checkLock()) { $data['marathon'] = $this->security->xss_clean($this->input->post('marathon')); $data['marathonFlag'] = ( ( empty($data['marathon']) ) ? 1 : 0 ); $data['received'] = $this->security->xss_clean($this->input->post('received')); $data['receivedFlag'] = ( ( empty($data['received']) ) ? 1 : 0 ); $data['problem'] = $this->security->xss_clean($this->input->post('problem')); $data['problemFlag'] = ( ( empty($data['problem']) ) ? 1 : 0 ); $data['verified'] = $this->security->xss_clean($this->input->post('verified')); if(! ($data['marathonFlag'] || $data['receivedFlag'] || $data['problemFlag'] )) { //SET - UNSET VERIFIED echo $this->process->set_Verified($data); } } else { $this->lock(); } } else { $this->logout(); } } }
{ "content_hash": "188ce6816068300205d499d37f52e113", "timestamp": "", "source": "github", "line_count": 641, "max_line_length": 195, "avg_line_length": 42.458658346333856, "alnum_prop": 0.4383818342151676, "repo_name": "hecto932/OJplus", "id": "1578bfceac58e7d89d40e60882261a8e02f83de4", "size": "27216", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application/controllers/Jury.php", "mode": "33261", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1376" }, { "name": "C", "bytes": "50426" }, { "name": "C++", "bytes": "10458" }, { "name": "CSS", "bytes": "707470" }, { "name": "HTML", "bytes": "25932" }, { "name": "Java", "bytes": "712" }, { "name": "JavaScript", "bytes": "1566585" }, { "name": "Makefile", "bytes": "387" }, { "name": "Objective-C", "bytes": "968" }, { "name": "PHP", "bytes": "3177740" }, { "name": "Python", "bytes": "11167" }, { "name": "Shell", "bytes": "25200" } ], "symlink_target": "" }
package com.androidformenhancer.sample.demos; /** * @author Soichiro Kashima */ public class ResumeNextActivity extends DefaultFragmentActivity { }
{ "content_hash": "e2c28722aa671ec72428f093bad9e6cc", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 65, "avg_line_length": 15.4, "alnum_prop": 0.7792207792207793, "repo_name": "ksoichiro/AndroidFormEnhancer", "id": "008db59157d2c4175ae36152a7ca280cfc2806bb", "size": "753", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "androidformenhancer-samples/demos/src/main/java/com/androidformenhancer/sample/demos/ResumeNextActivity.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Groovy", "bytes": "4234" }, { "name": "Java", "bytes": "379195" }, { "name": "Shell", "bytes": "1126" } ], "symlink_target": "" }
This directory contains helper scripts for rendering runtime wiki pages as HTML. ```shell # Run webserver for development. $ runtime/tools/wiki/build/build.py # Build wiki for deployment $ runtime/tools/wiki/build/build.py --deploy ``` # Markdown extensions ## Asides Paragraphs wrapped into `<aside>...</aside>` will be rendered as a sidenote on margins of the page. ## Cross-references `@{ref|text}` Cross-references are rendered as links to GitHub at the current commit. * `@{file-path}` is just rendered a link to the given file; * `@{package:name/path.dart}` is rendered as a link to file `path.dart` within package `name` - actual path is resolved via root `.packages` file in the SDK root; * `@{c++-symbol}` is rendered as a link to the line in the file which defines the given C++ symbol. # Prerequisites 1. Install all Python dependencies. ```console $ pip3 install coloredlogs jinja2 markdown aiohttp watchdog pymdown-extensions pygments ``` 2. Install the custom pygments lexer we use for shell session examples: ``` $ cd runtime/tools/wiki/CustomShellSessionPygmentsLexer $ python3 setup.py develop ``` 3. Install SASS compiler (make sure that SASS binary is in your path). 4. Generate `xref.json` file following instructions in `xref_extractor/README.md`.
{ "content_hash": "0fecd25614d83ffead70e920d9ee63f4", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 91, "avg_line_length": 31.095238095238095, "alnum_prop": 0.7366003062787136, "repo_name": "dart-lang/sdk", "id": "2606ac8a4f2672efcdbf60f6bea0e70046398f59", "size": "1306", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "runtime/tools/wiki/README.md", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Assembly", "bytes": "7081" }, { "name": "Batchfile", "bytes": "4407" }, { "name": "C", "bytes": "1393784" }, { "name": "C++", "bytes": "22197561" }, { "name": "CMake", "bytes": "1598" }, { "name": "CSS", "bytes": "142589" }, { "name": "Dart", "bytes": "142185469" }, { "name": "Dockerfile", "bytes": "495" }, { "name": "GAP", "bytes": "43658" }, { "name": "HTML", "bytes": "746243" }, { "name": "Java", "bytes": "637086" }, { "name": "JavaScript", "bytes": "238808" }, { "name": "Makefile", "bytes": "9320" }, { "name": "Objective-C++", "bytes": "854" }, { "name": "Python", "bytes": "1227015" }, { "name": "SCSS", "bytes": "23561" }, { "name": "Shell", "bytes": "139201" }, { "name": "TeX", "bytes": "75730" } ], "symlink_target": "" }
const transitionEndEvent = 'webkitTransition' in document.head.style ? 'webkitTransitionEnd' : 'transitionend'; const supportTransition = 'webkitTransition' in document.head.style || 'transition' in document.head.style; const transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; const transitionProperty = 'webkitTransition' in document.head.style ? 'webkitTransitionProperty' : 'transitionProperty'; function getElementTransitionDuration(element) { const computedStyle = getComputedStyle(element); const propertyValue = computedStyle[transitionProperty]; const durationValue = computedStyle[transitionDuration]; const durationScale = durationValue.includes('ms') ? 1 : 1000; const duration = supportTransition && propertyValue && propertyValue !== 'none' ? parseFloat(durationValue) * durationScale : 0; return !Number.isNaN(duration) ? duration : 0; } function emulateTransitionEnd(element, handler) { let called = 0; const endEvent = new Event(transitionEndEvent); const duration = getElementTransitionDuration(element); if (duration) { element.addEventListener(transitionEndEvent, function transitionEndWrapper(e) { if (e.target === element) { handler.apply(element, [e]); element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + 17); } else { handler.apply(element, [endEvent]); } } function queryElement(selector, parent) { const lookUp = parent && parent instanceof Element ? parent : document; return selector instanceof Element ? selector : lookUp.querySelector(selector); } function hasClass(element, classNAME) { return element.classList.contains(classNAME); } function removeClass(element, classNAME) { element.classList.remove(classNAME); } const addEventListener = 'addEventListener'; const removeEventListener = 'removeEventListener'; const fadeClass = 'fade'; const showClass = 'show'; const dataBsDismiss = 'data-bs-dismiss'; function bootstrapCustomEvent(namespacedEventType, eventProperties) { const OriginalCustomEvent = new CustomEvent(namespacedEventType, { cancelable: true }); if (eventProperties instanceof Object) { Object.keys(eventProperties).forEach((key) => { Object.defineProperty(OriginalCustomEvent, key, { value: eventProperties[key], }); }); } return OriginalCustomEvent; } function normalizeValue(value) { if (value === 'true') { return true; } if (value === 'false') { return false; } if (!Number.isNaN(+value)) { return +value; } if (value === '' || value === 'null') { return null; } // string / function / Element / Object return value; } function normalizeOptions(element, defaultOps, inputOps, ns) { const normalOps = {}; const dataOps = {}; const data = { ...element.dataset }; Object.keys(data) .forEach((k) => { const key = k.includes(ns) ? k.replace(ns, '').replace(/[A-Z]/, (match) => match.toLowerCase()) : k; dataOps[key] = normalizeValue(data[k]); }); Object.keys(inputOps) .forEach((k) => { inputOps[k] = normalizeValue(inputOps[k]); }); Object.keys(defaultOps) .forEach((k) => { if (k in inputOps) { normalOps[k] = inputOps[k]; } else if (k in dataOps) { normalOps[k] = dataOps[k]; } else { normalOps[k] = defaultOps[k]; } }); return normalOps; } /* Native JavaScript for Bootstrap 5 | Base Component ----------------------------------------------------- */ class BaseComponent { constructor(name, target, defaults, config) { const self = this; const element = queryElement(target); if (element[name]) element[name].dispose(); self.element = element; if (defaults && Object.keys(defaults).length) { self.options = normalizeOptions(element, defaults, (config || {}), 'bs'); } element[name] = self; } dispose(name) { const self = this; self.element[name] = null; Object.keys(self).forEach((prop) => { self[prop] = null; }); } } /* Native JavaScript for Bootstrap 5 | Alert -------------------------------------------- */ // ALERT PRIVATE GC // ================ const alertString = 'alert'; const alertComponent = 'Alert'; const alertSelector = `.${alertString}`; const alertDismissSelector = `[${dataBsDismiss}="${alertString}"]`; // ALERT CUSTOM EVENTS // =================== const closeAlertEvent = bootstrapCustomEvent(`close.bs.${alertString}`); const closedAlertEvent = bootstrapCustomEvent(`closed.bs.${alertString}`); // ALERT EVENT HANDLERS // ==================== function alertTransitionEnd(self) { const { element, relatedTarget } = self; toggleAlertHandler(self); if (relatedTarget) closedAlertEvent.relatedTarget = relatedTarget; element.dispatchEvent(closedAlertEvent); self.dispose(); element.parentNode.removeChild(element); } // ALERT PRIVATE METHOD // ==================== function toggleAlertHandler(self, add) { const action = add ? addEventListener : removeEventListener; if (self.dismiss) self.dismiss[action]('click', self.close); } // ALERT DEFINITION // ================ class Alert extends BaseComponent { constructor(target) { super(alertComponent, target); // bind const self = this; // initialization element const { element } = self; // the dismiss button self.dismiss = queryElement(alertDismissSelector, element); self.relatedTarget = null; // add event listener toggleAlertHandler(self, 1); } // ALERT PUBLIC METHODS // ==================== close(e) { const target = e ? e.target : null; const self = e ? e.target.closest(alertSelector)[alertComponent] : this; const { element } = self; if (self && element && hasClass(element, showClass)) { if (target) { closeAlertEvent.relatedTarget = target; self.relatedTarget = target; } element.dispatchEvent(closeAlertEvent); if (closeAlertEvent.defaultPrevented) return; removeClass(element, showClass); if (hasClass(element, fadeClass)) { emulateTransitionEnd(element, () => alertTransitionEnd(self)); } else alertTransitionEnd(self); } } dispose() { toggleAlertHandler(this); super.dispose(alertComponent); } } Alert.init = { component: alertComponent, selector: alertSelector, constructor: Alert, }; function addClass(element, classNAME) { element.classList.add(classNAME); } const activeClass = 'active'; const dataBsToggle = 'data-bs-toggle'; /* Native JavaScript for Bootstrap 5 | Button ---------------------------------------------*/ // BUTTON PRIVATE GC // ================= const buttonString = 'button'; const buttonComponent = 'Button'; const buttonSelector = `[${dataBsToggle}="${buttonString}"]`; const ariaPressed = 'aria-pressed'; // BUTTON PRIVATE METHOD // ===================== function toggleButtonHandler(self, add) { const action = add ? addEventListener : removeEventListener; self.element[action]('click', self.toggle); } // BUTTON DEFINITION // ================= class Button extends BaseComponent { constructor(target) { super(buttonComponent, target); const self = this; // initialization element const { element } = self; // set initial state self.isActive = hasClass(element, activeClass); element.setAttribute(ariaPressed, !!self.isActive); // add event listener toggleButtonHandler(self, 1); } // BUTTON PUBLIC METHODS // ===================== toggle(e) { if (e) e.preventDefault(); const self = e ? this[buttonComponent] : this; const { element } = self; if (hasClass(element, 'disabled')) return; self.isActive = hasClass(element, activeClass); const { isActive } = self; const action = isActive ? removeClass : addClass; const ariaValue = isActive ? 'false' : 'true'; action(element, activeClass); element.setAttribute(ariaPressed, ariaValue); } dispose() { toggleButtonHandler(this); super.dispose(buttonComponent); } } Button.init = { component: buttonComponent, selector: buttonSelector, constructor: Button, }; const supportPassive = (() => { let result = false; try { const opts = Object.defineProperty({}, 'passive', { get() { result = true; return result; }, }); document[addEventListener]('DOMContentLoaded', function wrap() { document[removeEventListener]('DOMContentLoaded', wrap, opts); }, opts); } catch (e) { throw Error('Passive events are not supported'); } return result; })(); // general event options var passiveHandler = supportPassive ? { passive: true } : false; function reflow(element) { return element.offsetHeight; } function isElementInScrollRange(element) { const bcr = element.getBoundingClientRect(); const viewportHeight = window.innerHeight || document.documentElement.clientHeight; return bcr.top <= viewportHeight && bcr.bottom >= 0; // bottom && top } /* Native JavaScript for Bootstrap 5 | Carousel ----------------------------------------------- */ // CAROUSEL PRIVATE GC // =================== const carouselString = 'carousel'; const carouselComponent = 'Carousel'; const carouselSelector = `[data-bs-ride="${carouselString}"]`; const carouselControl = `${carouselString}-control`; const carouselItem = `${carouselString}-item`; const dataBsSlideTo = 'data-bs-slide-to'; const pausedClass = 'paused'; const defaultCarouselOptions = { pause: 'hover', // 'boolean|string' keyboard: false, // 'boolean' touch: true, // 'boolean' interval: 5000, // 'boolean|number' }; let startX = 0; let currentX = 0; let endX = 0; // CAROUSEL CUSTOM EVENTS // ====================== const carouselSlideEvent = bootstrapCustomEvent(`slide.bs.${carouselString}`); const carouselSlidEvent = bootstrapCustomEvent(`slid.bs.${carouselString}`); // CAROUSEL EVENT HANDLERS // ======================= function carouselTransitionEndHandler(self) { const { index, direction, element, slides, options, isAnimating, } = self; // discontinue disposed instances if (isAnimating && element[carouselComponent]) { const activeItem = getActiveIndex(self); const orientation = direction === 'left' ? 'next' : 'prev'; const directionClass = direction === 'left' ? 'start' : 'end'; self.isAnimating = false; addClass(slides[index], activeClass); removeClass(slides[activeItem], activeClass); removeClass(slides[index], `${carouselItem}-${orientation}`); removeClass(slides[index], `${carouselItem}-${directionClass}`); removeClass(slides[activeItem], `${carouselItem}-${directionClass}`); element.dispatchEvent(carouselSlidEvent); // check for element, might have been disposed if (!document.hidden && options.interval && !hasClass(element, pausedClass)) { self.cycle(); } } } function carouselPauseHandler(e) { const eventTarget = e.target; const self = eventTarget.closest(carouselSelector)[carouselComponent]; const { element, isAnimating } = self; if (!hasClass(element, pausedClass)) { addClass(element, pausedClass); if (!isAnimating) { clearInterval(self.timer); self.timer = null; } } } function carouselResumeHandler(e) { const eventTarget = e.target; const self = eventTarget.closest(carouselSelector)[carouselComponent]; const { isPaused, isAnimating, element } = self; if (!isPaused && hasClass(element, pausedClass)) { removeClass(element, pausedClass); if (!isAnimating) { clearInterval(self.timer); self.timer = null; self.cycle(); } } } function carouselIndicatorHandler(e) { e.preventDefault(); const { target } = e; const self = target.closest(carouselSelector)[carouselComponent]; if (self.isAnimating) return; const newIndex = target.getAttribute(dataBsSlideTo); if (target && !hasClass(target, activeClass) // event target is not active && newIndex) { // AND has the specific attribute self.to(+newIndex); // do the slide } } function carouselControlsHandler(e) { e.preventDefault(); const that = this; const self = that.closest(carouselSelector)[carouselComponent]; const { controls } = self; if (controls[1] && that === controls[1]) { self.next(); } else if (controls[1] && that === controls[0]) { self.prev(); } } function carouselKeyHandler({ which }) { const [element] = Array.from(document.querySelectorAll(carouselSelector)) .filter((x) => isElementInScrollRange(x)); if (!element) return; const self = element[carouselComponent]; switch (which) { case 39: self.next(); break; case 37: self.prev(); break; } } // CAROUSEL TOUCH HANDLERS // ======================= function carouselTouchDownHandler(e) { const element = this; const self = element[carouselComponent]; if (!self || self.isTouch) { return; } startX = e.changedTouches[0].pageX; if (element.contains(e.target)) { self.isTouch = true; toggleCarouselTouchHandlers(self, 1); } } function carouselTouchMoveHandler(e) { const { changedTouches, type } = e; const self = this[carouselComponent]; if (!self || !self.isTouch) { return; } currentX = changedTouches[0].pageX; // cancel touch if more than one changedTouches detected if (type === 'touchmove' && changedTouches.length > 1) { e.preventDefault(); } } function carouselTouchEndHandler(e) { const element = this; const self = element[carouselComponent]; if (!self || !self.isTouch) { return; } endX = currentX || e.changedTouches[0].pageX; if (self.isTouch) { // the event target is outside the carousel OR carousel doens't include the related target if ((!element.contains(e.target) || !element.contains(e.relatedTarget)) && Math.abs(startX - endX) < 75) { // AND swipe distance is less than 75px // when the above conditions are satisfied, no need to continue return; } // OR determine next index to slide to if (currentX < startX) { self.index += 1; } else if (currentX > startX) { self.index -= 1; } self.isTouch = false; self.to(self.index); // do the slide toggleCarouselTouchHandlers(self); // remove touch events handlers } } // CAROUSEL PRIVATE METHODS // ======================== function activateCarouselIndicator(self, pageIndex) { // indicators const { indicators } = self; Array.from(indicators).forEach((x) => removeClass(x, activeClass)); if (self.indicators[pageIndex]) addClass(indicators[pageIndex], activeClass); } function toggleCarouselTouchHandlers(self, add) { const { element } = self; const action = add ? addEventListener : removeEventListener; element[action]('touchmove', carouselTouchMoveHandler, passiveHandler); element[action]('touchend', carouselTouchEndHandler, passiveHandler); } function toggleCarouselHandlers(self, add) { const { element, options, slides, controls, indicator, } = self; const { touch, pause, interval, keyboard, } = options; const action = add ? addEventListener : removeEventListener; if (pause && interval) { element[action]('mouseenter', carouselPauseHandler); element[action]('mouseleave', carouselResumeHandler); element[action]('touchstart', carouselPauseHandler, passiveHandler); element[action]('touchend', carouselResumeHandler, passiveHandler); } if (touch && slides.length > 1) { element[action]('touchstart', carouselTouchDownHandler, passiveHandler); } controls.forEach((arrow) => { if (arrow) arrow[action]('click', carouselControlsHandler); }); if (indicator) indicator[action]('click', carouselIndicatorHandler); if (keyboard) window[action]('keydown', carouselKeyHandler); } function getActiveIndex(self) { const { slides, element } = self; return Array.from(slides) .indexOf(element.getElementsByClassName(`${carouselItem} ${activeClass}`)[0]) || 0; } // CAROUSEL DEFINITION // =================== class Carousel extends BaseComponent { constructor(target, config) { super(carouselComponent, target, defaultCarouselOptions, config); // bind const self = this; // additional properties self.timer = null; self.direction = 'left'; self.isPaused = false; self.isAnimating = false; self.index = 0; self.timer = null; self.isTouch = false; // initialization element const { element } = self; // carousel elements // a LIVE collection is prefferable self.slides = element.getElementsByClassName(carouselItem); const { slides } = self; // invalidate when not enough items // no need to go further if (slides.length < 2) { return; } self.controls = [ queryElement(`.${carouselControl}-prev`, element), queryElement(`.${carouselControl}-next`, element), ]; // a LIVE collection is prefferable self.indicator = queryElement('.carousel-indicators', element); self.indicators = (self.indicator && self.indicator.querySelectorAll(`[${dataBsSlideTo}]`)) || []; // set JavaScript and DATA API options const { options } = self; // don't use TRUE as interval, it's actually 0, use the default 5000ms better self.options.interval = options.interval === true ? defaultCarouselOptions.interval : options.interval; // set first slide active if none if (getActiveIndex(self) < 0) { if (slides.length) addClass(slides[0], activeClass); if (self.indicators.length) activateCarouselIndicator(self, 0); } // attach event handlers toggleCarouselHandlers(self, 1); // start to cycle if interval is set if (options.interval) self.cycle(); } // CAROUSEL PUBLIC METHODS // ======================= cycle() { const self = this; const { isPaused, element, options } = self; if (self.timer) { clearInterval(self.timer); self.timer = null; } if (isPaused) { removeClass(element, pausedClass); self.isPaused = !isPaused; } self.timer = setInterval(() => { if (isElementInScrollRange(element)) { self.index += 1; self.to(self.index); } }, options.interval); } pause() { const self = this; const { element, options, isPaused } = self; if (options.interval && !isPaused) { clearInterval(self.timer); self.timer = null; addClass(element, pausedClass); self.isPaused = !isPaused; } } next() { const self = this; if (!self.isAnimating) { self.index += 1; self.to(self.index); } } prev() { const self = this; if (!self.isAnimating) { self.index -= 1; self.to(self.index); } } to(idx) { const self = this; const { element, isAnimating, slides, options, } = self; const activeItem = getActiveIndex(self); let next = idx; // when controled via methods, make sure to check again // first return if we're on the same item #227 if (isAnimating || activeItem === next) return; // determine transition direction if ((activeItem < next) || (activeItem === 0 && next === slides.length - 1)) { self.direction = 'left'; // next } else if ((activeItem > next) || (activeItem === slides.length - 1 && next === 0)) { self.direction = 'right'; // prev } const { direction } = self; // find the right next index if (next < 0) { next = slides.length - 1; } else if (next >= slides.length) { next = 0; } // orientation, class name, eventProperties const orientation = direction === 'left' ? 'next' : 'prev'; const directionClass = direction === 'left' ? 'start' : 'end'; const eventProperties = { relatedTarget: slides[next], direction, from: activeItem, to: next, }; // update event properties Object.keys(eventProperties).forEach((k) => { carouselSlideEvent[k] = eventProperties[k]; carouselSlidEvent[k] = eventProperties[k]; }); // discontinue when prevented element.dispatchEvent(carouselSlideEvent); if (carouselSlideEvent.defaultPrevented) return; // update index self.index = next; clearInterval(self.timer); self.timer = null; self.isAnimating = true; activateCarouselIndicator(self, next); if (getElementTransitionDuration(slides[next]) && hasClass(element, 'slide')) { addClass(slides[next], `${carouselItem}-${orientation}`); reflow(slides[next]); addClass(slides[next], `${carouselItem}-${directionClass}`); addClass(slides[activeItem], `${carouselItem}-${directionClass}`); emulateTransitionEnd(slides[next], () => carouselTransitionEndHandler(self)); } else { addClass(slides[next], activeClass); removeClass(slides[activeItem], activeClass); setTimeout(() => { self.isAnimating = false; // check for element, might have been disposed if (element && options.interval && !hasClass(element, pausedClass)) { self.cycle(); } element.dispatchEvent(carouselSlidEvent); }, 100); } } dispose() { const self = this; const { slides } = self; const itemClasses = ['start', 'end', 'prev', 'next']; Array.from(slides).forEach((slide, idx) => { if (hasClass(slide, activeClass)) activateCarouselIndicator(self, idx); itemClasses.forEach((c) => removeClass(slide, `${carouselItem}-${c}`)); }); toggleCarouselHandlers(self); clearInterval(self.timer); super.dispose(carouselComponent); } } Carousel.init = { component: carouselComponent, selector: carouselSelector, constructor: Carousel, }; const ariaExpanded = 'aria-expanded'; // collapse / tab const collapsingClass = 'collapsing'; const dataBsTarget = 'data-bs-target'; const dataBsParent = 'data-bs-parent'; const dataBsContainer = 'data-bs-container'; function getTargetElement(element) { return queryElement(element.getAttribute(dataBsTarget) || element.getAttribute('href')) || element.closest(element.getAttribute(dataBsParent)) || queryElement(element.getAttribute(dataBsContainer)); } /* Native JavaScript for Bootstrap 5 | Collapse ----------------------------------------------- */ // COLLAPSE GC // =========== const collapseString = 'collapse'; const collapseComponent = 'Collapse'; const collapseSelector = `.${collapseString}`; const collapseToggleSelector = `[${dataBsToggle}="${collapseString}"]`; // COLLAPSE CUSTOM EVENTS // ====================== const showCollapseEvent = bootstrapCustomEvent(`show.bs.${collapseString}`); const shownCollapseEvent = bootstrapCustomEvent(`shown.bs.${collapseString}`); const hideCollapseEvent = bootstrapCustomEvent(`hide.bs.${collapseString}`); const hiddenCollapseEvent = bootstrapCustomEvent(`hidden.bs.${collapseString}`); // COLLAPSE PRIVATE METHODS // ======================== function expandCollapse(self) { const { element, parent, triggers, } = self; element.dispatchEvent(showCollapseEvent); if (showCollapseEvent.defaultPrevented) return; self.isAnimating = true; if (parent) parent.isAnimating = true; addClass(element, collapsingClass); removeClass(element, collapseString); element.style.height = `${element.scrollHeight}px`; emulateTransitionEnd(element, () => { self.isAnimating = false; if (parent) parent.isAnimating = false; triggers.forEach((btn) => btn.setAttribute(ariaExpanded, 'true')); removeClass(element, collapsingClass); addClass(element, collapseString); addClass(element, showClass); element.style.height = ''; element.dispatchEvent(shownCollapseEvent); }); } function collapseContent(self) { const { element, parent, triggers, } = self; element.dispatchEvent(hideCollapseEvent); if (hideCollapseEvent.defaultPrevented) return; self.isAnimating = true; if (parent) parent.isAnimating = true; element.style.height = `${element.scrollHeight}px`; removeClass(element, collapseString); removeClass(element, showClass); addClass(element, collapsingClass); reflow(element); element.style.height = '0px'; emulateTransitionEnd(element, () => { self.isAnimating = false; if (parent) parent.isAnimating = false; triggers.forEach((btn) => btn.setAttribute(ariaExpanded, 'false')); removeClass(element, collapsingClass); addClass(element, collapseString); element.style.height = ''; element.dispatchEvent(hiddenCollapseEvent); }); } function toggleCollapseHandler(self, add) { const action = add ? addEventListener : removeEventListener; const { triggers } = self; if (triggers.length) { triggers.forEach((btn) => btn[action]('click', collapseClickHandler)); } } // COLLAPSE EVENT HANDLER // ====================== function collapseClickHandler(e) { const { target } = e; const trigger = target.closest(collapseToggleSelector); const element = getTargetElement(trigger); const self = element && element[collapseComponent]; if (self) self.toggle(target); // event target is anchor link #398 if (trigger && trigger.tagName === 'A') e.preventDefault(); } // COLLAPSE DEFINITION // =================== class Collapse extends BaseComponent { constructor(target, config) { super(collapseComponent, target, { parent: null }, config); // bind const self = this; // initialization element const { element, options } = self; // set triggering elements self.triggers = Array.from(document.querySelectorAll(collapseToggleSelector)) .filter((btn) => getTargetElement(btn) === element); // set parent accordion self.parent = queryElement(options.parent); const { parent } = self; // set initial state self.isAnimating = false; if (parent) parent.isAnimating = false; // add event listeners toggleCollapseHandler(self, 1); } // COLLAPSE PUBLIC METHODS // ======================= toggle(related) { const self = this; if (!hasClass(self.element, showClass)) self.show(related); else self.hide(related); } hide() { const self = this; const { triggers, isAnimating } = self; if (isAnimating) return; collapseContent(self); if (triggers.length) { triggers.forEach((btn) => addClass(btn, `${collapseString}d`)); } } show() { const self = this; const { element, parent, triggers, isAnimating, } = self; let activeCollapse; let activeCollapseInstance; if (parent) { activeCollapse = Array.from(parent.querySelectorAll(`.${collapseString}.${showClass}`)) .find((i) => i[collapseComponent]); activeCollapseInstance = activeCollapse && activeCollapse[collapseComponent]; } if ((!parent || (parent && !parent.isAnimating)) && !isAnimating) { if (activeCollapseInstance && activeCollapse !== element) { collapseContent(activeCollapseInstance); activeCollapseInstance.triggers.forEach((btn) => { addClass(btn, `${collapseString}d`); }); } expandCollapse(self); if (triggers.length) { triggers.forEach((btn) => removeClass(btn, `${collapseString}d`)); } } } dispose() { const self = this; const { parent } = self; toggleCollapseHandler(self); if (parent) delete parent.isAnimating; super.dispose(collapseComponent); } } Collapse.init = { component: collapseComponent, selector: collapseSelector, constructor: Collapse, }; const dropdownMenuClasses = ['dropdown', 'dropup', 'dropstart', 'dropend']; const dropdownMenuClass = 'dropdown-menu'; function isEmptyAnchor(elem) { const parentAnchor = elem.closest('A'); // anchor href starts with # return elem && ((elem.href && elem.href.slice(-1) === '#') // OR a child of an anchor with href starts with # || (parentAnchor && parentAnchor.href && parentAnchor.href.slice(-1) === '#')); } function setFocus(element) { element.focus(); } /* Native JavaScript for Bootstrap 5 | Dropdown ----------------------------------------------- */ // DROPDOWN PRIVATE GC // =================== const [dropdownString] = dropdownMenuClasses; const dropdownComponent = 'Dropdown'; const dropdownSelector = `[${dataBsToggle}="${dropdownString}"]`; // DROPDOWN PRIVATE GC // =================== const dropupString = dropdownMenuClasses[1]; const dropstartString = dropdownMenuClasses[2]; const dropendString = dropdownMenuClasses[3]; const dropdownMenuEndClass = `${dropdownMenuClass}-end`; const hideMenuClass = ['d-block', 'invisible']; const verticalClass = [dropdownString, dropupString]; const horizontalClass = [dropstartString, dropendString]; const defaultDropdownOptions = { offset: 5, // [number] 5(px) display: 'dynamic', // [dynamic|static] }; // DROPDOWN CUSTOM EVENTS // ======================== const showDropdownEvent = bootstrapCustomEvent(`show.bs.${dropdownString}`); const shownDropdownEvent = bootstrapCustomEvent(`shown.bs.${dropdownString}`); const hideDropdownEvent = bootstrapCustomEvent(`hide.bs.${dropdownString}`); const hiddenDropdownEvent = bootstrapCustomEvent(`hidden.bs.${dropdownString}`); // DROPDOWN PRIVATE METHODS // ======================== function styleDropdown(self, show) { const { element, menu, originalClass, menuEnd, options, } = self; const { offset } = options; const parent = element.parentElement; // reset menu offset and position const resetProps = ['margin', 'top', 'bottom', 'left', 'right']; resetProps.forEach((p) => { menu.style[p] = ''; }); removeClass(parent, 'position-static'); if (!show) { const menuEndNow = hasClass(menu, dropdownMenuEndClass); parent.className = originalClass.join(' '); if (menuEndNow && !menuEnd) removeClass(menu, dropdownMenuEndClass); else if (!menuEndNow && menuEnd) addClass(menu, dropdownMenuEndClass); return; } // set initial position class // take into account .btn-group parent as .dropdown let positionClass = dropdownMenuClasses.find((c) => originalClass.includes(c)) || dropdownString; let dropdownMargin = { dropdown: [offset, 0, 0], dropup: [0, 0, offset], dropstart: [-1, offset, 0], dropend: [-1, 0, 0, offset], }; const dropdownPosition = { dropdown: { top: '100%' }, dropup: { top: 'auto', bottom: '100%' }, dropstart: { left: 'auto', right: '100%' }, dropend: { left: '100%', right: 'auto' }, menuEnd: { right: 0, left: 'auto' }, }; // force showing the menu to calculate its size hideMenuClass.forEach((c) => addClass(menu, c)); const dropdownRegex = new RegExp(`\\b(${dropdownString}|${dropupString}|${dropstartString}|${dropendString})+`); const elementDimensions = { w: element.offsetWidth, h: element.offsetHeight }; const menuDimensions = { w: menu.offsetWidth, h: menu.offsetHeight }; const HTML = document.documentElement; const BD = document.body; const windowWidth = (HTML.clientWidth || BD.clientWidth); const windowHeight = (HTML.clientHeight || BD.clientHeight); const targetBCR = element.getBoundingClientRect(); // dropdownMenuEnd && [ dropdown | dropup ] const leftExceed = targetBCR.left + elementDimensions.w - menuDimensions.w < 0; // dropstart const leftFullExceed = targetBCR.left - menuDimensions.w < 0; // !dropdownMenuEnd && [ dropdown | dropup ] const rightExceed = targetBCR.left + menuDimensions.w >= windowWidth; // dropend const rightFullExceed = targetBCR.left + menuDimensions.w + elementDimensions.w >= windowWidth; // dropstart | dropend const bottomExceed = targetBCR.top + menuDimensions.h >= windowHeight; // dropdown const bottomFullExceed = targetBCR.top + menuDimensions.h + elementDimensions.h >= windowHeight; // dropup const topExceed = targetBCR.top - menuDimensions.h < 0; // recompute position if (horizontalClass.includes(positionClass) && leftFullExceed && rightFullExceed) { positionClass = dropdownString; } if (horizontalClass.includes(positionClass) && bottomExceed) { positionClass = dropupString; } if (positionClass === dropstartString && leftFullExceed && !bottomExceed) { positionClass = dropendString; } if (positionClass === dropendString && rightFullExceed && !bottomExceed) { positionClass = dropstartString; } if (positionClass === dropupString && topExceed && !bottomFullExceed) { positionClass = dropdownString; } if (positionClass === dropdownString && bottomFullExceed && !topExceed) { positionClass = dropupString; } // set spacing dropdownMargin = dropdownMargin[positionClass]; menu.style.margin = `${dropdownMargin.map((x) => (x ? `${x}px` : x)).join(' ')}`; Object.keys(dropdownPosition[positionClass]).forEach((position) => { menu.style[position] = dropdownPosition[positionClass][position]; }); // update dropdown position class if (!hasClass(parent, positionClass)) { parent.className = parent.className.replace(dropdownRegex, positionClass); } // update dropdown / dropup to handle parent btn-group element // as well as the dropdown-menu-end utility class if (verticalClass.includes(positionClass)) { if (!menuEnd && rightExceed) addClass(menu, dropdownMenuEndClass); else if (menuEnd && leftExceed) removeClass(menu, dropdownMenuEndClass); if (hasClass(menu, dropdownMenuEndClass)) { Object.keys(dropdownPosition.menuEnd).forEach((p) => { menu.style[p] = dropdownPosition.menuEnd[p]; }); } } // remove util classes from the menu, we have its size hideMenuClass.forEach((c) => removeClass(menu, c)); } function toggleDropdownDismiss(self) { const action = self.open ? addEventListener : removeEventListener; document[action]('click', dropdownDismissHandler); document[action]('focus', dropdownDismissHandler); document[action]('keydown', dropdownPreventScroll); document[action]('keyup', dropdownKeyHandler); if (self.options.display === 'dynamic') { window[action]('scroll', dropdownLayoutHandler, passiveHandler); window[action]('resize', dropdownLayoutHandler, passiveHandler); } } function toggleDropdownHandler(self, add) { const action = add ? addEventListener : removeEventListener; self.element[action]('click', dropdownClickHandler); } function getCurrentOpenDropdown() { const currentParent = dropdownMenuClasses.concat('btn-group') .map((c) => document.getElementsByClassName(`${c} ${showClass}`)) .find((x) => x.length); if (currentParent && currentParent.length) { return Array.from(currentParent[0].children).find((x) => x.hasAttribute(dataBsToggle)); } return null; } // DROPDOWN EVENT HANDLERS // ======================= function dropdownDismissHandler(e) { const { target, type } = e; if (!target.closest) return; // some weird FF bug #409 const element = getCurrentOpenDropdown(); const parent = element && element.parentNode; const self = element && element[dropdownComponent]; const menu = self && self.menu; const hasData = target.closest(dropdownSelector) !== null; const isForm = parent && parent.contains(target) && (target.tagName === 'form' || target.closest('form') !== null); if (type === 'click' && isEmptyAnchor(target)) { e.preventDefault(); } if (type === 'focus' && (target === element || target === menu || menu.contains(target))) { return; } if (isForm || hasData) ; else if (self) { self.hide(element); } } function dropdownClickHandler(e) { const element = this; const self = element[dropdownComponent]; self.toggle(element); if (isEmptyAnchor(e.target)) e.preventDefault(); } function dropdownPreventScroll(e) { if (e.which === 38 || e.which === 40) e.preventDefault(); } function dropdownKeyHandler({ which }) { const element = getCurrentOpenDropdown(); const self = element[dropdownComponent]; const { menu, menuItems, open } = self; const activeItem = document.activeElement; const isSameElement = activeItem === element; const isInsideMenu = menu.contains(activeItem); const isMenuItem = activeItem.parentNode === menu || activeItem.parentNode.parentNode === menu; let idx = menuItems.indexOf(activeItem); if (isMenuItem) { // navigate up | down if (isSameElement) { idx = 0; } else if (which === 38) { idx = idx > 1 ? idx - 1 : 0; } else if (which === 40) { idx = idx < menuItems.length - 1 ? idx + 1 : idx; } if (menuItems[idx]) setFocus(menuItems[idx]); } if (((menuItems.length && isMenuItem) // menu has items || (!menuItems.length && (isInsideMenu || isSameElement)) // menu might be a form || !isInsideMenu) // or the focused element is not in the menu at all && open && which === 27 // menu must be open ) { self.toggle(); } } function dropdownLayoutHandler() { const element = getCurrentOpenDropdown(); const self = element && element[dropdownComponent]; if (self && self.open) styleDropdown(self, 1); } // DROPDOWN DEFINITION // =================== class Dropdown extends BaseComponent { constructor(target, config) { super(dropdownComponent, target, defaultDropdownOptions, config); // bind const self = this; // initialization element const { element } = self; // set targets const parent = element.parentElement; self.menu = queryElement(`.${dropdownMenuClass}`, parent); const { menu } = self; self.originalClass = Array.from(parent.classList); // set original position self.menuEnd = hasClass(menu, dropdownMenuEndClass); self.menuItems = []; Array.from(menu.children).forEach((child) => { if (child.children.length && (child.children[0].tagName === 'A')) self.menuItems.push(child.children[0]); if (child.tagName === 'A') self.menuItems.push(child); }); // set initial state to closed self.open = false; // add event listener toggleDropdownHandler(self, 1); } // DROPDOWN PUBLIC METHODS // ======================= toggle(related) { const self = this; const { open } = self; if (open) self.hide(related); else self.show(related); } show(related) { const self = this; const currentParent = queryElement(dropdownMenuClasses.concat('btn-group').map((c) => `.${c}.${showClass}`).join(',')); const currentElement = currentParent && queryElement(dropdownSelector, currentParent); if (currentElement) currentElement[dropdownComponent].hide(); const { element, menu, open } = self; const parent = element.parentNode; // update relatedTarget and dispatch showDropdownEvent.relatedTarget = related || null; parent.dispatchEvent(showDropdownEvent); if (showDropdownEvent.defaultPrevented) return; // change menu position styleDropdown(self, 1); addClass(menu, showClass); addClass(parent, showClass); element.setAttribute(ariaExpanded, true); self.open = !open; setTimeout(() => { setFocus(menu.getElementsByTagName('INPUT')[0] || element); // focus the first input item | element toggleDropdownDismiss(self); shownDropdownEvent.relatedTarget = related || null; parent.dispatchEvent(shownDropdownEvent); }, 1); } hide(related) { const self = this; const { element, menu, open } = self; const parent = element.parentNode; hideDropdownEvent.relatedTarget = related || null; parent.dispatchEvent(hideDropdownEvent); if (hideDropdownEvent.defaultPrevented) return; removeClass(menu, showClass); removeClass(parent, showClass); // revert to original position styleDropdown(self); element.setAttribute(ariaExpanded, false); self.open = !open; setFocus(element); // only re-attach handler if the instance is not disposed setTimeout(() => toggleDropdownDismiss(self), 1); // update relatedTarget and dispatch hiddenDropdownEvent.relatedTarget = related || null; parent.dispatchEvent(hiddenDropdownEvent); } dispose() { const self = this; const { element } = self; if (hasClass(element.parentNode, showClass) && self.open) self.hide(); toggleDropdownHandler(self); super.dispose(dropdownComponent); } } Dropdown.init = { component: dropdownComponent, selector: dropdownSelector, constructor: Dropdown, }; const ariaHidden = 'aria-hidden'; const ariaModal = 'aria-modal'; const fixedTopClass = 'fixed-top'; const fixedBottomClass = 'fixed-bottom'; const stickyTopClass = 'sticky-top'; const fixedItems = Array.from(document.getElementsByClassName(fixedTopClass)) .concat(Array.from(document.getElementsByClassName(fixedBottomClass))) .concat(Array.from(document.getElementsByClassName(stickyTopClass))) .concat(Array.from(document.getElementsByClassName('is-fixed'))); function resetScrollbar() { const bd = document.body; bd.style.paddingRight = ''; bd.style.overflow = ''; if (fixedItems.length) { fixedItems.forEach((fixed) => { fixed.style.paddingRight = ''; fixed.style.marginRight = ''; }); } } function measureScrollbar() { const windowWidth = document.documentElement.clientWidth; return Math.abs(window.innerWidth - windowWidth); } function setScrollbar(scrollbarWidth, overflow) { const bd = document.body; const bdStyle = getComputedStyle(bd); const bodyPad = parseInt(bdStyle.paddingRight, 10); const isOpen = bdStyle.overflow === 'hidden'; const sbWidth = isOpen && bodyPad ? 0 : scrollbarWidth; if (overflow) { bd.style.overflow = 'hidden'; bd.style.paddingRight = `${bodyPad + sbWidth}px`; if (fixedItems.length) { fixedItems.forEach((fixed) => { const isSticky = hasClass(fixed, stickyTopClass); const itemPadValue = getComputedStyle(fixed).paddingRight; fixed.style.paddingRight = `${parseInt(itemPadValue, 10) + sbWidth}px`; if (isSticky) { const itemMValue = getComputedStyle(fixed).marginRight; fixed.style.marginRight = `${parseInt(itemMValue, 10) - sbWidth}px`; } }); } } } const modalBackdropClass = 'modal-backdrop'; const offcanvasBackdropClass = 'offcanvas-backdrop'; const modalActiveSelector = `.modal.${showClass}`; const offcanvasActiveSelector = `.offcanvas.${showClass}`; const overlay = document.createElement('div'); function getCurrentOpen() { return queryElement(`${modalActiveSelector},${offcanvasActiveSelector}`); } function toggleOverlayType(isModal) { const targetClass = isModal ? modalBackdropClass : offcanvasBackdropClass; [modalBackdropClass, offcanvasBackdropClass].forEach((c) => { removeClass(overlay, c); }); addClass(overlay, targetClass); } function appendOverlay(hasFade, isModal) { toggleOverlayType(isModal); document.body.appendChild(overlay); if (hasFade) addClass(overlay, fadeClass); } function showOverlay() { addClass(overlay, showClass); reflow(overlay); } function hideOverlay() { removeClass(overlay, showClass); } function removeOverlay() { const bd = document.body; const currentOpen = getCurrentOpen(); if (!currentOpen) { removeClass(overlay, fadeClass); bd.removeChild(overlay); resetScrollbar(); } } function isVisible(element) { return getComputedStyle(element).visibility !== 'hidden' && element.offsetParent !== null; } /* Native JavaScript for Bootstrap 5 | Modal -------------------------------------------- */ // MODAL PRIVATE GC // ================ const modalString = 'modal'; const modalComponent = 'Modal'; const modalSelector = `.${modalString}`; const modalToggleSelector = `[${dataBsToggle}="${modalString}"]`; const modalDismissSelector = `[${dataBsDismiss}="${modalString}"]`; const modalStaticClass = `${modalString}-static`; const modalDefaultOptions = { backdrop: true, // boolean|string keyboard: true, // boolean }; // MODAL CUSTOM EVENTS // =================== const showModalEvent = bootstrapCustomEvent(`show.bs.${modalString}`); const shownModalEvent = bootstrapCustomEvent(`shown.bs.${modalString}`); const hideModalEvent = bootstrapCustomEvent(`hide.bs.${modalString}`); const hiddenModalEvent = bootstrapCustomEvent(`hidden.bs.${modalString}`); // MODAL PRIVATE METHODS // ===================== function setModalScrollbar(self) { const { element, scrollbarWidth } = self; const bd = document.body; const html = document.documentElement; const bodyOverflow = html.clientHeight !== html.scrollHeight || bd.clientHeight !== bd.scrollHeight; const modalOverflow = element.clientHeight !== element.scrollHeight; if (!modalOverflow && scrollbarWidth) { element.style.paddingRight = `${scrollbarWidth}px`; } setScrollbar(scrollbarWidth, (modalOverflow || bodyOverflow)); } function toggleModalDismiss(self, add) { const action = add ? addEventListener : removeEventListener; window[action]('resize', self.update, passiveHandler); self.element[action]('click', modalDismissHandler); document[action]('keydown', modalKeyHandler); } function toggleModalHandler(self, add) { const action = add ? addEventListener : removeEventListener; const { triggers } = self; if (triggers.length) { triggers.forEach((btn) => btn[action]('click', modalClickHandler)); } } function afterModalHide(self) { const { triggers, options } = self; if (!getCurrentOpen()) { if (options.backdrop) removeOverlay(); resetScrollbar(); } self.element.style.paddingRight = ''; self.isAnimating = false; if (triggers.length) { const visibleTrigger = triggers.find((x) => isVisible(x)); if (visibleTrigger) setFocus(visibleTrigger); } } function afterModalShow(self) { const { element, relatedTarget } = self; setFocus(element); self.isAnimating = false; toggleModalDismiss(self, 1); shownModalEvent.relatedTarget = relatedTarget; element.dispatchEvent(shownModalEvent); } function beforeModalShow(self) { const { element, hasFade } = self; element.style.display = 'block'; setModalScrollbar(self); if (!getCurrentOpen()) { document.body.style.overflow = 'hidden'; } addClass(element, showClass); element.removeAttribute(ariaHidden); element.setAttribute(ariaModal, true); if (hasFade) emulateTransitionEnd(element, () => afterModalShow(self)); else afterModalShow(self); } function beforeModalHide(self, force) { const { element, options, relatedTarget, hasFade, } = self; element.style.display = ''; // force can also be the transitionEvent object, we wanna make sure it's not // call is not forced and overlay is visible if (options.backdrop && !force && hasFade && hasClass(overlay, showClass) && !getCurrentOpen()) { // AND no modal is visible hideOverlay(); emulateTransitionEnd(overlay, () => afterModalHide(self)); } else { afterModalHide(self); } toggleModalDismiss(self); hiddenModalEvent.relatedTarget = relatedTarget; element.dispatchEvent(hiddenModalEvent); } // MODAL EVENT HANDLERS // ==================== function modalClickHandler(e) { const { target } = e; const trigger = target.closest(modalToggleSelector); const element = getTargetElement(trigger); const self = element && element[modalComponent]; if (trigger.tagName === 'A') e.preventDefault(); if (self.isAnimating) return; self.relatedTarget = trigger; self.toggle(); } function modalKeyHandler({ which }) { const element = queryElement(modalActiveSelector); const self = element[modalComponent]; const { options, isAnimating } = self; if (!isAnimating // modal has no animations running && options.keyboard && which === 27 // the keyboard option is enabled and the key is 27 && hasClass(element, showClass)) { // the modal is not visible self.relatedTarget = null; self.hide(); } } function modalDismissHandler(e) { const element = this; const self = element[modalComponent]; if (self.isAnimating) return; const { options, isStatic, modalDialog } = self; const { backdrop } = options; const { target } = e; const selectedText = document.getSelection().toString().length; const targetInsideDialog = modalDialog.contains(target); const dismiss = target.closest(modalDismissSelector); if (isStatic && !targetInsideDialog) { addClass(element, modalStaticClass); self.isAnimating = true; emulateTransitionEnd(modalDialog, () => staticTransitionEnd(self)); } else if (dismiss || (!selectedText && !isStatic && !targetInsideDialog && backdrop)) { self.relatedTarget = dismiss || null; self.hide(); e.preventDefault(); } } function staticTransitionEnd(self) { const duration = getElementTransitionDuration(self.modalDialog) + 17; removeClass(self.element, modalStaticClass); // user must wait for zoom out transition setTimeout(() => { self.isAnimating = false; }, duration); } // MODAL DEFINITION // ================ class Modal extends BaseComponent { constructor(target, config) { super(modalComponent, target, modalDefaultOptions, config); // bind const self = this; // the modal const { element } = self; // the modal-dialog self.modalDialog = queryElement(`.${modalString}-dialog`, element); // modal can have multiple triggering elements self.triggers = Array.from(document.querySelectorAll(modalToggleSelector)) .filter((btn) => getTargetElement(btn) === element); // additional internals self.isStatic = self.options.backdrop === 'static'; self.hasFade = hasClass(element, fadeClass); self.isAnimating = false; self.scrollbarWidth = measureScrollbar(); self.relatedTarget = null; // attach event listeners toggleModalHandler(self, 1); // bind self.update = self.update.bind(self); } // MODAL PUBLIC METHODS // ==================== toggle() { const self = this; if (hasClass(self.element, showClass)) self.hide(); else self.show(); } show() { const self = this; const { element, options, isAnimating, hasFade, relatedTarget, } = self; const { backdrop } = options; let overlayDelay = 0; if (hasClass(element, showClass) && !isAnimating) return; showModalEvent.relatedTarget = relatedTarget || null; element.dispatchEvent(showModalEvent); if (showModalEvent.defaultPrevented) return; // we elegantly hide any opened modal/offcanvas const currentOpen = getCurrentOpen(); if (currentOpen && currentOpen !== element) { const that = currentOpen[modalComponent] ? currentOpen[modalComponent] : currentOpen.Offcanvas; that.hide(); } self.isAnimating = true; if (backdrop) { if (!currentOpen && !hasClass(overlay, showClass)) { appendOverlay(hasFade, 1); } else { toggleOverlayType(1); } overlayDelay = getElementTransitionDuration(overlay); if (!hasClass(overlay, showClass)) showOverlay(); setTimeout(() => beforeModalShow(self), overlayDelay); } else { beforeModalShow(self); if (currentOpen && hasClass(overlay, showClass)) { hideOverlay(); } } } hide(force) { const self = this; const { element, isAnimating, hasFade, relatedTarget, } = self; if (!hasClass(element, showClass) && !isAnimating) return; hideModalEvent.relatedTarget = relatedTarget || null; element.dispatchEvent(hideModalEvent); if (hideModalEvent.defaultPrevented) return; self.isAnimating = true; removeClass(element, showClass); element.setAttribute(ariaHidden, true); element.removeAttribute(ariaModal); if (hasFade && force !== 1) { emulateTransitionEnd(element, () => beforeModalHide(self)); } else { beforeModalHide(self, force); } } update() { const self = this; if (hasClass(self.element, showClass)) setModalScrollbar(self); } dispose() { const self = this; self.hide(1); // forced call toggleModalHandler(self); super.dispose(modalComponent); } } Modal.init = { component: modalComponent, selector: modalSelector, constructor: Modal, }; /* Native JavaScript for Bootstrap 5 | OffCanvas ------------------------------------------------ */ // OFFCANVAS PRIVATE GC // ==================== const offcanvasString = 'offcanvas'; const offcanvasComponent = 'Offcanvas'; const OffcanvasSelector = `.${offcanvasString}`; const offcanvasToggleSelector = `[${dataBsToggle}="${offcanvasString}"]`; const offcanvasDismissSelector = `[${dataBsDismiss}="${offcanvasString}"]`; const offcanvasTogglingClass = `${offcanvasString}-toggling`; const offcanvasDefaultOptions = { backdrop: true, // boolean keyboard: true, // boolean scroll: false, // boolean }; // OFFCANVAS CUSTOM EVENTS // ======================= const showOffcanvasEvent = bootstrapCustomEvent(`show.bs.${offcanvasString}`); const shownOffcanvasEvent = bootstrapCustomEvent(`shown.bs.${offcanvasString}`); const hideOffcanvasEvent = bootstrapCustomEvent(`hide.bs.${offcanvasString}`); const hiddenOffcanvasEvent = bootstrapCustomEvent(`hidden.bs.${offcanvasString}`); // OFFCANVAS PRIVATE METHODS // ========================= function setOffCanvasScrollbar(self) { const bd = document.body; const html = document.documentElement; const bodyOverflow = html.clientHeight !== html.scrollHeight || bd.clientHeight !== bd.scrollHeight; setScrollbar(self.scrollbarWidth, bodyOverflow); } function toggleOffcanvasEvents(self, add) { const action = add ? addEventListener : removeEventListener; self.triggers.forEach((btn) => btn[action]('click', offcanvasTriggerHandler)); } function toggleOffCanvasDismiss(add) { const action = add ? addEventListener : removeEventListener; document[action]('keydown', offcanvasKeyDismissHandler); document[action]('click', offcanvasDismissHandler); } function beforeOffcanvasShow(self) { const { element, options } = self; if (!options.scroll) { document.body.style.overflow = 'hidden'; setOffCanvasScrollbar(self); } addClass(element, offcanvasTogglingClass); addClass(element, showClass); element.style.visibility = 'visible'; emulateTransitionEnd(element, () => showOffcanvasComplete(self)); } function beforeOffcanvasHide(self) { const { element, options } = self; const currentOpen = getCurrentOpen(); element.blur(); if (!currentOpen && options.backdrop && hasClass(overlay, showClass)) { hideOverlay(); emulateTransitionEnd(overlay, () => hideOffcanvasComplete(self)); } else hideOffcanvasComplete(self); } // OFFCANVAS EVENT HANDLERS // ======================== function offcanvasTriggerHandler(e) { const trigger = this.closest(offcanvasToggleSelector); const element = getTargetElement(trigger); const self = element && element[offcanvasComponent]; if (trigger.tagName === 'A') e.preventDefault(); if (self) { self.relatedTarget = trigger; self.toggle(); } } function offcanvasDismissHandler(e) { const element = queryElement(offcanvasActiveSelector); if (!element) return; const offCanvasDismiss = queryElement(offcanvasDismissSelector, element); const self = element[offcanvasComponent]; if (!self) return; const { options, triggers } = self; const { target } = e; const trigger = target.closest(offcanvasToggleSelector); if (trigger && trigger.tagName === 'A') e.preventDefault(); if ((!element.contains(target) && options.backdrop && (!trigger || (trigger && !triggers.includes(trigger)))) || offCanvasDismiss.contains(target)) { self.relatedTarget = target === offCanvasDismiss ? offCanvasDismiss : null; self.hide(); } } function offcanvasKeyDismissHandler({ which }) { const element = queryElement(offcanvasActiveSelector); if (!element) return; const self = element[offcanvasComponent]; if (self && self.options.keyboard && which === 27) { self.relatedTarget = null; self.hide(); } } function showOffcanvasComplete(self) { const { element, triggers, relatedTarget } = self; removeClass(element, offcanvasTogglingClass); element.removeAttribute(ariaHidden); element.setAttribute(ariaModal, true); element.setAttribute('role', 'dialog'); self.isAnimating = false; if (triggers.length) { triggers.forEach((btn) => btn.setAttribute(ariaExpanded, true)); } shownOffcanvasEvent.relatedTarget = relatedTarget || null; element.dispatchEvent(shownOffcanvasEvent); toggleOffCanvasDismiss(1); setFocus(element); } function hideOffcanvasComplete(self) { const { element, options, relatedTarget, triggers, } = self; const currentOpen = getCurrentOpen(); element.setAttribute(ariaHidden, true); element.removeAttribute(ariaModal); element.removeAttribute('role'); element.style.visibility = ''; self.isAnimating = false; if (triggers.length) { triggers.forEach((btn) => btn.setAttribute(ariaExpanded, false)); const visibleTrigger = triggers.find((x) => isVisible(x)); if (visibleTrigger) setFocus(visibleTrigger); } // handle new offcanvas showing up if (!currentOpen) { if (options.backdrop) removeOverlay(); if (!options.scroll) { resetScrollbar(); } } hiddenOffcanvasEvent.relatedTarget = relatedTarget || null; element.dispatchEvent(hiddenOffcanvasEvent); removeClass(element, offcanvasTogglingClass); toggleOffCanvasDismiss(); } // OFFCANVAS DEFINITION // ==================== class Offcanvas extends BaseComponent { constructor(target, config) { super(offcanvasComponent, target, offcanvasDefaultOptions, config); const self = this; // instance element const { element } = self; // all the triggering buttons self.triggers = Array.from(document.querySelectorAll(offcanvasToggleSelector)) .filter((btn) => getTargetElement(btn) === element); // additional instance property self.isAnimating = false; self.scrollbarWidth = measureScrollbar(); // attach event listeners toggleOffcanvasEvents(self, 1); } // OFFCANVAS PUBLIC METHODS // ======================== toggle() { const self = this; if (hasClass(self.element, showClass)) self.hide(); else self.show(); } show() { const self = this[offcanvasComponent] ? this[offcanvasComponent] : this; const { element, options, isAnimating, relatedTarget, } = self; let overlayDelay = 0; if (hasClass(element, showClass) || isAnimating) return; showOffcanvasEvent.relatedTarget = relatedTarget || null; element.dispatchEvent(showOffcanvasEvent); if (showOffcanvasEvent.defaultPrevented) return; // we elegantly hide any opened modal/offcanvas const currentOpen = getCurrentOpen(); if (currentOpen && currentOpen !== element) { const that = currentOpen[offcanvasComponent] ? currentOpen[offcanvasComponent] : currentOpen.Modal; that.hide(); } self.isAnimating = true; if (options.backdrop) { if (!currentOpen) { appendOverlay(1); } else { toggleOverlayType(); } overlayDelay = getElementTransitionDuration(overlay); if (!hasClass(overlay, showClass)) showOverlay(); setTimeout(() => beforeOffcanvasShow(self), overlayDelay); } else { beforeOffcanvasShow(self); if (currentOpen && hasClass(overlay, showClass)) { hideOverlay(); } } } hide(force) { const self = this; const { element, isAnimating, relatedTarget } = self; if (!hasClass(element, showClass) || isAnimating) return; hideOffcanvasEvent.relatedTarget = relatedTarget || null; element.dispatchEvent(hideOffcanvasEvent); if (hideOffcanvasEvent.defaultPrevented) return; self.isAnimating = true; addClass(element, offcanvasTogglingClass); removeClass(element, showClass); if (!force) { emulateTransitionEnd(element, () => beforeOffcanvasHide(self)); } else beforeOffcanvasHide(self); } dispose() { const self = this; self.hide(1); toggleOffcanvasEvents(self); super.dispose(offcanvasComponent); } } Offcanvas.init = { component: offcanvasComponent, selector: OffcanvasSelector, constructor: Offcanvas, }; const ariaDescribedBy = 'aria-describedby'; var tipClassPositions = { top: 'top', bottom: 'bottom', left: 'start', right: 'end', }; function isVisibleTip(tip, container) { return container.contains(tip); } function isMedia(element) { return [SVGElement, HTMLImageElement, HTMLVideoElement] .some((mediaType) => element instanceof mediaType); } function closestRelative(element) { let retval = null; let el = element; while (el !== document.body) { el = el.parentElement; if (getComputedStyle(el).position === 'relative') { retval = el; break; } } return retval; } // both popovers and tooltips (this, event) function styleTip(self, e) { const tipClasses = /\b(top|bottom|start|end)+/; const tip = self.tooltip || self.popover; // reset tip style tip.style.top = ''; tip.style.left = ''; tip.style.right = ''; // continue with metrics const isPopover = !!self.popover; let tipDimensions = { w: tip.offsetWidth, h: tip.offsetHeight }; const windowWidth = (document.documentElement.clientWidth || document.body.clientWidth); const windowHeight = (document.documentElement.clientHeight || document.body.clientHeight); const { element, options, arrow } = self; let { container, placement } = options; let parentIsBody = container === document.body; const targetPosition = getComputedStyle(element).position; const parentPosition = getComputedStyle(container).position; const staticParent = !parentIsBody && parentPosition === 'static'; let relativeParent = !parentIsBody && parentPosition === 'relative'; const relContainer = staticParent && closestRelative(container); // static containers should refer to another relative container or the body container = relContainer || container; relativeParent = staticParent && relContainer ? 1 : relativeParent; parentIsBody = container === document.body; const parentRect = container.getBoundingClientRect(); const leftBoundry = relativeParent ? parentRect.left : 0; const rightBoundry = relativeParent ? parentRect.right : windowWidth; // this case should not be possible // absoluteParent = !parentIsBody && parentPosition === 'absolute', // this case requires a container with placement: relative const absoluteTarget = targetPosition === 'absolute'; const targetRect = element.getBoundingClientRect(); const scroll = parentIsBody ? { x: window.pageXOffset, y: window.pageYOffset } : { x: container.scrollLeft, y: container.scrollTop }; const elemDimensions = { w: element.offsetWidth, h: element.offsetHeight }; const top = relativeParent ? element.offsetTop : targetRect.top; const left = relativeParent ? element.offsetLeft : targetRect.left; // reset arrow style arrow.style.top = ''; arrow.style.left = ''; arrow.style.right = ''; let topPosition; let leftPosition; let rightPosition; let arrowTop; let arrowLeft; let arrowRight; // check placement let topExceed = targetRect.top - tipDimensions.h < 0; let bottomExceed = targetRect.top + tipDimensions.h + elemDimensions.h >= windowHeight; let leftExceed = targetRect.left - tipDimensions.w < leftBoundry; let rightExceed = targetRect.left + tipDimensions.w + elemDimensions.w >= rightBoundry; topExceed = ['left', 'right'].includes(placement) ? targetRect.top + elemDimensions.h / 2 - tipDimensions.h / 2 < 0 : topExceed; bottomExceed = ['left', 'right'].includes(placement) ? targetRect.top + tipDimensions.h / 2 + elemDimensions.h / 2 >= windowHeight : bottomExceed; leftExceed = ['top', 'bottom'].includes(placement) ? targetRect.left + elemDimensions.w / 2 - tipDimensions.w / 2 < leftBoundry : leftExceed; rightExceed = ['top', 'bottom'].includes(placement) ? targetRect.left + tipDimensions.w / 2 + elemDimensions.w / 2 >= rightBoundry : rightExceed; // recompute placement // first, when both left and right limits are exceeded, we fall back to top|bottom placement = (['left', 'right'].includes(placement)) && leftExceed && rightExceed ? 'top' : placement; placement = placement === 'top' && topExceed ? 'bottom' : placement; placement = placement === 'bottom' && bottomExceed ? 'top' : placement; placement = placement === 'left' && leftExceed ? 'right' : placement; placement = placement === 'right' && rightExceed ? 'left' : placement; // update tooltip/popover class if (!tip.className.includes(placement)) { tip.className = tip.className.replace(tipClasses, tipClassPositions[placement]); } // if position has changed, update tip dimensions tipDimensions = { w: tip.offsetWidth, h: tip.offsetHeight }; // we check the computed width & height and update here const arrowWidth = arrow.offsetWidth || 0; const arrowHeight = arrow.offsetHeight || 0; const arrowAdjust = arrowWidth / 2; // compute tooltip / popover coordinates if (['left', 'right'].includes(placement)) { // secondary|side positions if (placement === 'left') { // LEFT leftPosition = left + scroll.x - tipDimensions.w - (isPopover ? arrowWidth : 0); } else { // RIGHT leftPosition = left + scroll.x + elemDimensions.w + (isPopover ? arrowWidth : 0); } // adjust top and arrow if (topExceed) { topPosition = top + scroll.y; arrowTop = elemDimensions.h / 2 - arrowWidth; } else if (bottomExceed) { topPosition = top + scroll.y - tipDimensions.h + elemDimensions.h; arrowTop = tipDimensions.h - elemDimensions.h / 2 - arrowWidth; } else { topPosition = top + scroll.y - tipDimensions.h / 2 + elemDimensions.h / 2; arrowTop = tipDimensions.h / 2 - arrowHeight / 2; } } else if (['top', 'bottom'].includes(placement)) { if (e && isMedia(element)) { const eX = !relativeParent ? e.pageX : e.layerX + (absoluteTarget ? element.offsetLeft : 0); const eY = !relativeParent ? e.pageY : e.layerY + (absoluteTarget ? element.offsetTop : 0); if (placement === 'top') { topPosition = eY - tipDimensions.h - (isPopover ? arrowWidth : arrowHeight); } else { topPosition = eY + arrowHeight; } // adjust left | right and also the arrow if (e.clientX - tipDimensions.w / 2 < leftBoundry) { // when exceeds left leftPosition = 0; arrowLeft = eX - arrowAdjust; } else if (e.clientX + tipDimensions.w * 0.51 >= rightBoundry) { // when exceeds right leftPosition = 'auto'; rightPosition = 0; arrowLeft = tipDimensions.w - (rightBoundry - eX) - arrowAdjust; } else { // normal top/bottom leftPosition = eX - tipDimensions.w / 2; arrowLeft = tipDimensions.w / 2 - arrowAdjust; } } else { if (placement === 'top') { topPosition = top + scroll.y - tipDimensions.h - (isPopover ? arrowHeight : 0); } else { // BOTTOM topPosition = top + scroll.y + elemDimensions.h + (isPopover ? arrowHeight : 0); } // adjust left | right and also the arrow if (leftExceed) { leftPosition = 0; arrowLeft = left + elemDimensions.w / 2 - arrowAdjust; } else if (rightExceed) { leftPosition = 'auto'; rightPosition = 0; arrowRight = elemDimensions.w / 2 + (parentRect.right - targetRect.right) - arrowAdjust; } else { leftPosition = left + scroll.x - tipDimensions.w / 2 + elemDimensions.w / 2; arrowLeft = tipDimensions.w / 2 - arrowAdjust; } } } // apply style to tooltip/popover and its arrow tip.style.top = `${topPosition}px`; tip.style.left = leftPosition === 'auto' ? leftPosition : `${leftPosition}px`; tip.style.right = rightPosition !== undefined ? `${rightPosition}px` : ''; // update arrow placement or clear side if (arrowTop !== undefined) { arrow.style.top = `${arrowTop}px`; } if (arrowLeft !== undefined) { arrow.style.left = `${arrowLeft}px`; } else if (arrowRight !== undefined) { arrow.style.right = `${arrowRight}px`; } } let bsnUID = 1; // popover, tooltip, scrollspy need a unique id function getUID(element, key) { bsnUID += 1; return element[key] || bsnUID; } function getTipContainer(element) { // maybe the element is inside a modal const modal = element.closest('.modal'); // OR maybe the element is inside a fixed navbar const navbarFixed = element.closest(`.${fixedTopClass},.${fixedBottomClass}`); // set default container option appropriate for the context return modal || navbarFixed || document.body; } /* Native JavaScript for Bootstrap 5 | Popover ---------------------------------------------- */ // POPOVER PRIVATE GC // ================== const popoverString = 'popover'; const popoverComponent = 'Popover'; const popoverSelector = `[${dataBsToggle}="${popoverString}"],[data-tip="${popoverString}"]`; const popoverDefaultOptions = { template: '<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>', // string title: null, // string content: null, // string sanitizeFn: null, // function customClass: null, // string dismissible: false, // boolean animation: true, // boolean trigger: 'hover', // string placement: 'top', // string delay: 200, // number }; // POPOVER PRIVATE GC // ================== const appleBrands = /(iPhone|iPod|iPad)/; const isIphone = navigator.userAgentData ? navigator.userAgentData.brands.some((x) => appleBrands.test(x.brand)) : appleBrands.test(navigator.userAgent); // popoverArrowClass = `${popoverString}-arrow`, const popoverHeaderClass = `${popoverString}-header`; const popoverBodyClass = `${popoverString}-body`; // close btn for dissmissible popover let popoverCloseButton = '<button type="button" class="btn-close"></button>'; // POPOVER CUSTOM EVENTS // ===================== const showPopoverEvent = bootstrapCustomEvent(`show.bs.${popoverString}`); const shownPopoverEvent = bootstrapCustomEvent(`shown.bs.${popoverString}`); const hidePopoverEvent = bootstrapCustomEvent(`hide.bs.${popoverString}`); const hiddenPopoverEvent = bootstrapCustomEvent(`hidden.bs.${popoverString}`); // POPOVER EVENT HANDLERS // ====================== function popoverForceFocus() { setFocus(this); } function popoverTouchHandler({ target }) { const self = this; const { popover, element } = self; if ((popover && popover.contains(target)) // popover includes touch target || target === element // OR touch target is element || element.contains(target)) ; else { self.hide(); } } // POPOVER PRIVATE METHODS // ======================= function createPopover(self) { const { id, options } = self; const { animation, customClass, sanitizeFn, placement, dismissible, } = options; let { title, content, template } = options; // set initial popover class const placementClass = `bs-${popoverString}-${tipClassPositions[placement]}`; // fixing #233 title = title ? title.trim() : null; content = content ? content.trim() : null; // sanitize title && content if (sanitizeFn) { title = title ? sanitizeFn(title) : null; content = content ? sanitizeFn(content) : null; template = template ? sanitizeFn(template) : null; popoverCloseButton = sanitizeFn(popoverCloseButton); } self.popover = document.createElement('div'); const { popover } = self; // set id and aria-describedby popover.setAttribute('id', id); popover.setAttribute('role', 'tooltip'); // load template const popoverTemplate = document.createElement('div'); popoverTemplate.innerHTML = template.trim(); popover.className = popoverTemplate.firstChild.className; popover.innerHTML = popoverTemplate.firstChild.innerHTML; const popoverHeader = queryElement(`.${popoverHeaderClass}`, popover); const popoverBody = queryElement(`.${popoverBodyClass}`, popover); // set arrow self.arrow = queryElement(`.${popoverString}-arrow`, popover); // set dismissible button if (dismissible) { title = title ? title + popoverCloseButton : title; content = title === null ? +popoverCloseButton : content; } // fill the template with content from data attributes if (title && popoverHeader) popoverHeader.innerHTML = title.trim(); if (content && popoverBody) popoverBody.innerHTML = content.trim(); // set popover animation and placement if (!hasClass(popover, popoverString)) addClass(popover, popoverString); if (animation && !hasClass(popover, fadeClass)) addClass(popover, fadeClass); if (customClass && !hasClass(popover, customClass)) { addClass(popover, customClass); } if (!hasClass(popover, placementClass)) addClass(popover, placementClass); } function removePopover(self) { const { element, popover, options } = self; element.removeAttribute(ariaDescribedBy); options.container.removeChild(popover); self.timer = null; } function togglePopoverHandlers(self, add) { const action = add ? addEventListener : removeEventListener; const { element, options } = self; const { trigger, dismissible } = options; self.enabled = !!add; if (trigger === 'hover') { element[action]('mousedown', self.show); element[action]('mouseenter', self.show); if (isMedia(element)) element[action]('mousemove', self.update, passiveHandler); if (!dismissible) element[action]('mouseleave', self.hide); } else if (trigger === 'click') { element[action](trigger, self.toggle); } else if (trigger === 'focus') { if (isIphone) element[action]('click', popoverForceFocus); element[action]('focusin', self.show); } } function dismissHandlerToggle(self, add) { const action = add ? addEventListener : removeEventListener; const { options, element, popover } = self; const { trigger, dismissible } = options; if (dismissible) { const [btnClose] = popover.getElementsByClassName('btn-close'); if (btnClose) btnClose[action]('click', self.hide); } else { if (trigger === 'focus') element[action]('focusout', self.hide); if (trigger === 'hover') document[action]('touchstart', popoverTouchHandler, passiveHandler); } if (!isMedia(element)) { window[action]('scroll', self.update, passiveHandler); window[action]('resize', self.update, passiveHandler); } } function popoverShowTrigger(self) { dismissHandlerToggle(self, 1); self.element.dispatchEvent(shownPopoverEvent); } function popoverHideTrigger(self) { dismissHandlerToggle(self); removePopover(self); self.element.dispatchEvent(hiddenPopoverEvent); } // POPOVER DEFINITION // ================== class Popover extends BaseComponent { constructor(target, config) { popoverDefaultOptions.container = getTipContainer(queryElement(target)); super(popoverComponent, target, popoverDefaultOptions, config); // bind const self = this; // initialization element const { element } = self; // additional instance properties self.timer = null; self.popover = null; self.arrow = null; self.enabled = false; // set unique ID for aria-describedby self.id = `${popoverString}-${getUID(element)}`; // set instance options const { options } = self; // media elements only work with body as a container self.options.container = isMedia(element) ? popoverDefaultOptions.container : queryElement(options.container); // reset default container popoverDefaultOptions.container = null; // invalidate when no content is set if (!options.content) return; // crate popover createPopover(self); // bind self.update = self.update.bind(self); // attach event listeners togglePopoverHandlers(self, 1); } update(e) { styleTip(this, e); } // POPOVER PUBLIC METHODS // ====================== toggle(e) { const self = e ? this[popoverComponent] : this; const { popover, options } = self; if (!isVisibleTip(popover, options.container)) self.show(); else self.hide(); } show(e) { const self = e ? this[popoverComponent] : this; const { element, popover, options, id, } = self; const { container } = options; clearTimeout(self.timer); self.timer = setTimeout(() => { if (!isVisibleTip(popover, container)) { element.dispatchEvent(showPopoverEvent); if (showPopoverEvent.defaultPrevented) return; // append to the container container.appendChild(popover); element.setAttribute(ariaDescribedBy, id); self.update(e); if (!hasClass(popover, showClass)) addClass(popover, showClass); if (options.animation) emulateTransitionEnd(popover, () => popoverShowTrigger(self)); else popoverShowTrigger(self); } }, 17); } hide(e) { let self; if (e && this[popoverComponent]) { self = this[popoverComponent]; } else if (e) { // dismissible popover const dPopover = this.closest(`.${popoverString}`); const dEl = dPopover && queryElement(`[${ariaDescribedBy}="${dPopover.id}"]`); self = dEl[popoverComponent]; } else { self = this; } const { element, popover, options } = self; clearTimeout(self.timer); self.timer = setTimeout(() => { if (isVisibleTip(popover, options.container)) { element.dispatchEvent(hidePopoverEvent); if (hidePopoverEvent.defaultPrevented) return; removeClass(popover, showClass); if (options.animation) emulateTransitionEnd(popover, () => popoverHideTrigger(self)); else popoverHideTrigger(self); } }, options.delay + 17); } enable() { const self = this; const { enabled } = self; if (!enabled) { togglePopoverHandlers(self, 1); self.enabled = !enabled; } } disable() { const self = this; const { enabled, popover, options } = self; if (enabled) { if (isVisibleTip(popover, options.container) && options.animation) { self.hide(); setTimeout( () => togglePopoverHandlers(self), getElementTransitionDuration(popover) + options.delay + 17, ); } else { togglePopoverHandlers(self); } self.enabled = !enabled; } } toggleEnabled() { const self = this; if (!self.enabled) self.enable(); else self.disable(); } dispose() { const self = this; const { popover, options } = self; const { container, animation } = options; if (animation && isVisibleTip(popover, container)) { options.delay = 0; // reset delay self.hide(); emulateTransitionEnd(popover, () => togglePopoverHandlers(self)); } else { togglePopoverHandlers(self); } super.dispose(popoverComponent); } } Popover.init = { component: popoverComponent, selector: popoverSelector, constructor: Popover, }; /* Native JavaScript for Bootstrap 5 | ScrollSpy ------------------------------------------------ */ // SCROLLSPY PRIVATE GC // ==================== const scrollspyString = 'scrollspy'; const scrollspyComponent = 'ScrollSpy'; const scrollspySelector = '[data-bs-spy="scroll"]'; const scrollSpyDefaultOptions = { offset: 10, target: null, }; // SCROLLSPY CUSTOM EVENT // ====================== const activateScrollSpy = bootstrapCustomEvent(`activate.bs.${scrollspyString}`); // SCROLLSPY PRIVATE METHODS // ========================= function updateSpyTargets(self) { const { target, scrollTarget, isWindow, options, itemsLength, scrollHeight, } = self; const { offset } = options; const links = target.getElementsByTagName('A'); self.scrollTop = isWindow ? scrollTarget.pageYOffset : scrollTarget.scrollTop; // only update items/offsets once or with each mutation if (itemsLength !== links.length || getScrollHeight(scrollTarget) !== scrollHeight) { let href; let targetItem; let rect; // reset arrays & update self.items = []; self.offsets = []; self.scrollHeight = getScrollHeight(scrollTarget); self.maxScroll = self.scrollHeight - getOffsetHeight(self); Array.from(links).forEach((link) => { href = link.getAttribute('href'); targetItem = href && href.charAt(0) === '#' && href.slice(-1) !== '#' && queryElement(href); if (targetItem) { self.items.push(link); rect = targetItem.getBoundingClientRect(); self.offsets.push((isWindow ? rect.top + self.scrollTop : targetItem.offsetTop) - offset); } }); self.itemsLength = self.items.length; } } function getScrollHeight(scrollTarget) { return scrollTarget.scrollHeight || Math.max( document.body.scrollHeight, document.documentElement.scrollHeight, ); } function getOffsetHeight({ element, isWindow }) { if (!isWindow) return element.getBoundingClientRect().height; return window.innerHeight; } function clear(target) { Array.from(target.getElementsByTagName('A')).forEach((item) => { if (hasClass(item, activeClass)) removeClass(item, activeClass); }); } function activate(self, item) { const { target, element } = self; clear(target); self.activeItem = item; addClass(item, activeClass); // activate all parents const parents = []; let parentItem = item; while (parentItem !== document.body) { parentItem = parentItem.parentNode; if (hasClass(parentItem, 'nav') || hasClass(parentItem, 'dropdown-menu')) parents.push(parentItem); } parents.forEach((menuItem) => { const parentLink = menuItem.previousElementSibling; if (parentLink && !hasClass(parentLink, activeClass)) { addClass(parentLink, activeClass); } }); // update relatedTarget and dispatch activateScrollSpy.relatedTarget = item; element.dispatchEvent(activateScrollSpy); } function toggleSpyHandlers(self, add) { const action = add ? addEventListener : removeEventListener; self.scrollTarget[action]('scroll', self.refresh, passiveHandler); } // SCROLLSPY DEFINITION // ==================== class ScrollSpy extends BaseComponent { constructor(target, config) { super(scrollspyComponent, target, scrollSpyDefaultOptions, config); // bind const self = this; // initialization element & options const { element, options } = self; // additional properties self.target = queryElement(options.target); // invalidate if (!self.target) return; // set initial state self.scrollTarget = element.clientHeight < element.scrollHeight ? element : window; self.isWindow = self.scrollTarget === window; self.scrollTop = 0; self.maxScroll = 0; self.scrollHeight = 0; self.activeItem = null; self.items = []; self.offsets = []; // bind events self.refresh = self.refresh.bind(self); // add event handlers toggleSpyHandlers(self, 1); self.refresh(); } // SCROLLSPY PUBLIC METHODS // ======================== refresh() { const self = this; const { target } = self; // check if target is visible and invalidate if (target.offsetHeight === 0) return; updateSpyTargets(self); const { scrollTop, maxScroll, itemsLength, items, activeItem, } = self; if (scrollTop >= maxScroll) { const newActiveItem = items[itemsLength - 1]; if (activeItem !== newActiveItem) { activate(self, newActiveItem); } return; } const { offsets } = self; if (activeItem && scrollTop < offsets[0] && offsets[0] > 0) { self.activeItem = null; clear(target); return; } items.forEach((item, i) => { if (activeItem !== item && scrollTop >= offsets[i] && (typeof offsets[i + 1] === 'undefined' || scrollTop < offsets[i + 1])) { activate(self, item); } }); } dispose() { toggleSpyHandlers(this); super.dispose(scrollspyComponent); } } ScrollSpy.init = { component: scrollspyComponent, selector: scrollspySelector, constructor: ScrollSpy, }; const ariaSelected = 'aria-selected'; /* Native JavaScript for Bootstrap 5 | Tab ------------------------------------------ */ // TAB PRIVATE GC // ================ const tabString = 'tab'; const tabComponent = 'Tab'; const tabSelector = `[${dataBsToggle}="${tabString}"]`; // TAB CUSTOM EVENTS // ================= const showTabEvent = bootstrapCustomEvent(`show.bs.${tabString}`); const shownTabEvent = bootstrapCustomEvent(`shown.bs.${tabString}`); const hideTabEvent = bootstrapCustomEvent(`hide.bs.${tabString}`); const hiddenTabEvent = bootstrapCustomEvent(`hidden.bs.${tabString}`); let nextTab; let nextTabContent; let nextTabHeight; let activeTab; let activeTabContent; let tabContainerHeight; let tabEqualContents; // TAB PRIVATE METHODS // =================== function triggerTabEnd(self) { const { tabContent, nav } = self; tabContent.style.height = ''; removeClass(tabContent, collapsingClass); nav.isAnimating = false; } function triggerTabShow(self) { const { tabContent, nav } = self; if (tabContent) { // height animation if (tabEqualContents) { triggerTabEnd(self); } else { setTimeout(() => { // enables height animation tabContent.style.height = `${nextTabHeight}px`; // height animation reflow(tabContent); emulateTransitionEnd(tabContent, () => triggerTabEnd(self)); }, 50); } } else { nav.isAnimating = false; } shownTabEvent.relatedTarget = activeTab; nextTab.dispatchEvent(shownTabEvent); } function triggerTabHide(self) { const { tabContent } = self; if (tabContent) { activeTabContent.style.float = 'left'; nextTabContent.style.float = 'left'; tabContainerHeight = activeTabContent.scrollHeight; } // update relatedTarget and dispatch event showTabEvent.relatedTarget = activeTab; hiddenTabEvent.relatedTarget = nextTab; nextTab.dispatchEvent(showTabEvent); if (showTabEvent.defaultPrevented) return; addClass(nextTabContent, activeClass); removeClass(activeTabContent, activeClass); if (tabContent) { nextTabHeight = nextTabContent.scrollHeight; tabEqualContents = nextTabHeight === tabContainerHeight; addClass(tabContent, collapsingClass); tabContent.style.height = `${tabContainerHeight}px`; // height animation reflow(tabContent); activeTabContent.style.float = ''; nextTabContent.style.float = ''; } if (hasClass(nextTabContent, fadeClass)) { setTimeout(() => { addClass(nextTabContent, showClass); emulateTransitionEnd(nextTabContent, () => { triggerTabShow(self); }); }, 20); } else { triggerTabShow(self); } activeTab.dispatchEvent(hiddenTabEvent); } function getActiveTab({ nav }) { const activeTabs = nav.getElementsByClassName(activeClass); if (activeTabs.length === 1 && !dropdownMenuClasses.some((c) => hasClass(activeTabs[0].parentNode, c))) { [activeTab] = activeTabs; } else if (activeTabs.length > 1) { activeTab = activeTabs[activeTabs.length - 1]; } return activeTab; } function getActiveTabContent(self) { return queryElement(getActiveTab(self).getAttribute('href')); } function toggleTabHandler(self, add) { const action = add ? addEventListener : removeEventListener; self.element[action]('click', tabClickHandler); } // TAB EVENT HANDLER // ================= function tabClickHandler(e) { const self = this[tabComponent]; e.preventDefault(); if (!self.nav.isAnimating) self.show(); } // TAB DEFINITION // ============== class Tab extends BaseComponent { constructor(target) { super(tabComponent, target); // bind const self = this; // initialization element const { element } = self; // event targets self.nav = element.closest('.nav'); const { nav } = self; self.dropdown = nav && queryElement(`.${dropdownMenuClasses[0]}-toggle`, nav); activeTabContent = getActiveTabContent(self); self.tabContent = supportTransition && activeTabContent.closest('.tab-content'); tabContainerHeight = activeTabContent.scrollHeight; // set default animation state nav.isAnimating = false; // add event listener toggleTabHandler(self, 1); } // TAB PUBLIC METHODS // ================== show() { // the tab we clicked is now the nextTab tab const self = this; const { element, nav, dropdown } = self; nextTab = element; if (!hasClass(nextTab, activeClass)) { // this is the actual object, the nextTab tab content to activate nextTabContent = queryElement(nextTab.getAttribute('href')); activeTab = getActiveTab({ nav }); activeTabContent = getActiveTabContent({ nav }); // update relatedTarget and dispatch hideTabEvent.relatedTarget = nextTab; activeTab.dispatchEvent(hideTabEvent); if (hideTabEvent.defaultPrevented) return; nav.isAnimating = true; removeClass(activeTab, activeClass); activeTab.setAttribute(ariaSelected, 'false'); addClass(nextTab, activeClass); nextTab.setAttribute(ariaSelected, 'true'); if (dropdown) { if (!hasClass(element.parentNode, dropdownMenuClass)) { if (hasClass(dropdown, activeClass)) removeClass(dropdown, activeClass); } else if (!hasClass(dropdown, activeClass)) addClass(dropdown, activeClass); } if (hasClass(activeTabContent, fadeClass)) { removeClass(activeTabContent, showClass); emulateTransitionEnd(activeTabContent, () => triggerTabHide(self)); } else { triggerTabHide(self); } } } dispose() { toggleTabHandler(this); super.dispose(tabComponent); } } Tab.init = { component: tabComponent, selector: tabSelector, constructor: Tab, }; /* Native JavaScript for Bootstrap 5 | Toast -------------------------------------------- */ // TOAST PRIVATE GC // ================ const toastString = 'toast'; const toastComponent = 'Toast'; const toastSelector = `.${toastString}`; const toastDismissSelector = `[${dataBsDismiss}="${toastString}"]`; const showingClass = 'showing'; const hideClass = 'hide'; const toastDefaultOptions = { animation: true, autohide: true, delay: 500, }; // TOAST CUSTOM EVENTS // =================== const showToastEvent = bootstrapCustomEvent(`show.bs.${toastString}`); const hideToastEvent = bootstrapCustomEvent(`hide.bs.${toastString}`); const shownToastEvent = bootstrapCustomEvent(`shown.bs.${toastString}`); const hiddenToastEvent = bootstrapCustomEvent(`hidden.bs.${toastString}`); // TOAST PRIVATE METHODS // ===================== function showToastComplete(self) { const { element, options } = self; if (!options.animation) { removeClass(element, showingClass); addClass(element, showClass); } element.dispatchEvent(shownToastEvent); if (options.autohide) self.hide(); } function hideToastComplete(self) { const { element } = self; addClass(element, hideClass); element.dispatchEvent(hiddenToastEvent); } function closeToast(self) { const { element, options } = self; removeClass(element, showClass); if (options.animation) { reflow(element); emulateTransitionEnd(element, () => hideToastComplete(self)); } else { hideToastComplete(self); } } function openToast(self) { const { element, options } = self; removeClass(element, hideClass); if (options.animation) { reflow(element); addClass(element, showingClass); addClass(element, showClass); emulateTransitionEnd(element, () => showToastComplete(self)); } else { showToastComplete(self); } } function toggleToastHandler(self, add) { const action = add ? addEventListener : removeEventListener; if (self.dismiss) { self.dismiss[action]('click', self.hide); } } // TOAST EVENT HANDLERS // ==================== function completeDisposeToast(self) { clearTimeout(self.timer); toggleToastHandler(self); } // TOAST DEFINITION // ================ class Toast extends BaseComponent { constructor(target, config) { super(toastComponent, target, toastDefaultOptions, config); // bind const self = this; // dismiss button self.dismiss = queryElement(toastDismissSelector, self.element); // bind self.show = self.show.bind(self); self.hide = self.hide.bind(self); // add event listener toggleToastHandler(self, 1); } // TOAST PUBLIC METHODS // ==================== show() { const self = this; const { element } = self; if (element && hasClass(element, hideClass)) { element.dispatchEvent(showToastEvent); if (showToastEvent.defaultPrevented) return; addClass(element, fadeClass); clearTimeout(self.timer); self.timer = setTimeout(() => openToast(self), 10); } } hide(noTimer) { const self = this; const { element, options } = self; if (element && hasClass(element, showClass)) { element.dispatchEvent(hideToastEvent); if (hideToastEvent.defaultPrevented) return; clearTimeout(self.timer); self.timer = setTimeout(() => closeToast(self), noTimer ? 10 : options.delay); } } dispose() { const self = this; const { element, options } = self; self.hide(); if (options.animation) emulateTransitionEnd(element, () => completeDisposeToast(self)); else completeDisposeToast(self); super.dispose(toastComponent); } } Toast.init = { component: toastComponent, selector: toastSelector, constructor: Toast, }; const dataOriginalTitle = 'data-original-title'; /* Native JavaScript for Bootstrap 5 | Tooltip ---------------------------------------------- */ // TOOLTIP PRIVATE GC // ================== const tooltipString = 'tooltip'; const tooltipComponent = 'Tooltip'; const tooltipSelector = `[${dataBsToggle}="${tooltipString}"],[data-tip="${tooltipString}"]`; const titleAttr = 'title'; const tooltipInnerClass = `${tooltipString}-inner`; const tooltipDefaultOptions = { title: null, template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', placement: 'top', animation: true, customClass: null, delay: 200, sanitizeFn: null, }; // TOOLTIP CUSTOM EVENTS // ===================== const showTooltipEvent = bootstrapCustomEvent(`show.bs.${tooltipString}`); const shownTooltipEvent = bootstrapCustomEvent(`shown.bs.${tooltipString}`); const hideTooltipEvent = bootstrapCustomEvent(`hide.bs.${tooltipString}`); const hiddenTooltipEvent = bootstrapCustomEvent(`hidden.bs.${tooltipString}`); // TOOLTIP PRIVATE METHODS // ======================= function createTooltip(self) { const { options, id } = self; const placementClass = `bs-${tooltipString}-${tipClassPositions[options.placement]}`; let titleString = options.title.trim(); // sanitize stuff if (options.sanitizeFn) { titleString = options.sanitizeFn(titleString); options.template = options.sanitizeFn(options.template); } if (!titleString) return; // create tooltip self.tooltip = document.createElement('div'); const { tooltip } = self; // set aria tooltip.setAttribute('id', id); // set markup const tooltipMarkup = document.createElement('div'); tooltipMarkup.innerHTML = options.template.trim(); tooltip.className = tooltipMarkup.firstChild.className; tooltip.innerHTML = tooltipMarkup.firstChild.innerHTML; queryElement(`.${tooltipInnerClass}`, tooltip).innerHTML = titleString; // set arrow self.arrow = queryElement(`.${tooltipString}-arrow`, tooltip); // set class and role attribute tooltip.setAttribute('role', tooltipString); // set classes if (!hasClass(tooltip, tooltipString)) addClass(tooltip, tooltipString); if (options.animation && !hasClass(tooltip, fadeClass)) addClass(tooltip, fadeClass); if (options.customClass && !hasClass(tooltip, options.customClass)) { addClass(tooltip, options.customClass); } if (!hasClass(tooltip, placementClass)) addClass(tooltip, placementClass); } function removeTooltip(self) { const { element, options, tooltip } = self; element.removeAttribute(ariaDescribedBy); options.container.removeChild(tooltip); self.timer = null; } function disposeTooltipComplete(self) { const { element } = self; toggleTooltipHandlers(self); if (element.hasAttribute(dataOriginalTitle)) toggleTooltipTitle(self); } function toggleTooltipAction(self, add) { const action = add ? addEventListener : removeEventListener; document[action]('touchstart', tooltipTouchHandler, passiveHandler); if (!isMedia(self.element)) { window[action]('scroll', self.update, passiveHandler); window[action]('resize', self.update, passiveHandler); } } function tooltipShownAction(self) { toggleTooltipAction(self, 1); self.element.dispatchEvent(shownTooltipEvent); } function tooltipHiddenAction(self) { toggleTooltipAction(self); removeTooltip(self); self.element.dispatchEvent(hiddenTooltipEvent); } function toggleTooltipHandlers(self, add) { const action = add ? addEventListener : removeEventListener; const { element } = self; if (isMedia(element)) element[action]('mousemove', self.update, passiveHandler); element[action]('mousedown', self.show); element[action]('mouseenter', self.show); element[action]('mouseleave', self.hide); } function toggleTooltipTitle(self, content) { // [0 - add, 1 - remove] | [0 - remove, 1 - add] const titleAtt = [dataOriginalTitle, titleAttr]; const { element } = self; element.setAttribute(titleAtt[content ? 0 : 1], (content || element.getAttribute(titleAtt[0]))); element.removeAttribute(titleAtt[content ? 1 : 0]); } // TOOLTIP EVENT HANDLERS // ====================== function tooltipTouchHandler({ target }) { const { tooltip, element } = this; if (tooltip.contains(target) || target === element || element.contains(target)) ; else { this.hide(); } } // TOOLTIP DEFINITION // ================== class Tooltip extends BaseComponent { constructor(target, config) { // initialization element const element = queryElement(target); tooltipDefaultOptions.title = element.getAttribute(titleAttr); tooltipDefaultOptions.container = getTipContainer(element); super(tooltipComponent, element, tooltipDefaultOptions, config); // bind const self = this; // additional properties self.tooltip = null; self.arrow = null; self.timer = null; self.enabled = false; // instance options const { options } = self; // media elements only work with body as a container self.options.container = isMedia(element) ? tooltipDefaultOptions.container : queryElement(options.container); // reset default options tooltipDefaultOptions.container = null; tooltipDefaultOptions[titleAttr] = null; // invalidate if (!options.title) return; // all functions bind tooltipTouchHandler.bind(self); self.update = self.update.bind(self); // set title attributes and add event listeners if (element.hasAttribute(titleAttr)) toggleTooltipTitle(self, options.title); // create tooltip here self.id = `${tooltipString}-${getUID(element)}`; createTooltip(self); // attach events toggleTooltipHandlers(self, 1); } // TOOLTIP PUBLIC METHODS // ====================== show(e) { const self = e ? this[tooltipComponent] : this; const { options, tooltip, element, id, } = self; clearTimeout(self.timer); self.timer = setTimeout(() => { if (!isVisibleTip(tooltip, options.container)) { element.dispatchEvent(showTooltipEvent); if (showTooltipEvent.defaultPrevented) return; // append to container options.container.appendChild(tooltip); element.setAttribute(ariaDescribedBy, id); self.update(e); if (!hasClass(tooltip, showClass)) addClass(tooltip, showClass); if (options.animation) emulateTransitionEnd(tooltip, () => tooltipShownAction(self)); else tooltipShownAction(self); } }, 20); } hide(e) { const self = e ? this[tooltipComponent] : this; const { options, tooltip, element } = self; clearTimeout(self.timer); self.timer = setTimeout(() => { if (isVisibleTip(tooltip, options.container)) { element.dispatchEvent(hideTooltipEvent); if (hideTooltipEvent.defaultPrevented) return; removeClass(tooltip, showClass); if (options.animation) emulateTransitionEnd(tooltip, () => tooltipHiddenAction(self)); else tooltipHiddenAction(self); } }, options.delay); } update(e) { styleTip(this, e); } toggle() { const self = this; const { tooltip, options } = self; if (!isVisibleTip(tooltip, options.container)) self.show(); else self.hide(); } enable() { const self = this; const { enabled } = self; if (!enabled) { toggleTooltipHandlers(self, 1); self.enabled = !enabled; } } disable() { const self = this; const { tooltip, options, enabled } = self; if (enabled) { if (!isVisibleTip(tooltip, options.container) && options.animation) { self.hide(); setTimeout( () => toggleTooltipHandlers(self), getElementTransitionDuration(tooltip) + options.delay + 17, ); } else { toggleTooltipHandlers(self); } self.enabled = !enabled; } } toggleEnabled() { const self = this; if (!self.enabled) self.enable(); else self.disable(); } dispose() { const self = this; const { tooltip, options } = self; if (options.animation && isVisibleTip(tooltip, options.container)) { options.delay = 0; // reset delay self.hide(); emulateTransitionEnd(tooltip, () => disposeTooltipComplete(self)); } else { disposeTooltipComplete(self); } super.dispose(tooltipComponent); } } Tooltip.init = { component: tooltipComponent, selector: tooltipSelector, constructor: Tooltip, }; var version = "4.0.6"; // import { alertInit } from '../components/alert-native.js'; // import { buttonInit } from '../components/button-native.js'; // import { carouselInit } from '../components/carousel-native.js'; // import { collapseInit } from '../components/collapse-native.js'; // import { dropdownInit } from '../components/dropdown-native.js'; // import { modalInit } from '../components/modal-native.js'; // import { offcanvasInit } from '../components/offcanvas-native.js'; // import { popoverInit } from '../components/popover-native.js'; // import { scrollSpyInit } from '../components/scrollspy-native.js'; // import { tabInit } from '../components/tab-native.js'; // import { toastInit } from '../components/toast-native.js'; // import { tooltipInit } from '../components/tooltip-native.js'; const componentsInit = { Alert: Alert.init, Button: Button.init, Carousel: Carousel.init, Collapse: Collapse.init, Dropdown: Dropdown.init, Modal: Modal.init, Offcanvas: Offcanvas.init, Popover: Popover.init, ScrollSpy: ScrollSpy.init, Tab: Tab.init, Toast: Toast.init, Tooltip: Tooltip.init, }; function initializeDataAPI(Konstructor, collection) { Array.from(collection).forEach((x) => new Konstructor(x)); } function initCallback(context) { const lookUp = context instanceof Element ? context : document; Object.keys(componentsInit).forEach((comp) => { const { constructor, selector } = componentsInit[comp]; initializeDataAPI(constructor, lookUp.querySelectorAll(selector)); }); } // bulk initialize all components if (document.body) initCallback(); else { document.addEventListener('DOMContentLoaded', () => initCallback(), { once: true }); } var index = { Alert, Button, Carousel, Collapse, Dropdown, Modal, Offcanvas, Popover, ScrollSpy, Tab, Toast, Tooltip, initCallback, Version: version, }; export { index as default };
{ "content_hash": "78195fe9fb19b590aef6cb624a79fb8b", "timestamp": "", "source": "github", "line_count": 3558, "max_line_length": 164, "avg_line_length": 29.297920179876336, "alnum_prop": 0.6666410851672071, "repo_name": "cdnjs/cdnjs", "id": "cad788b0da3ac9eacf0414cf0d403f81ecde18e4", "size": "104463", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ajax/libs/bootstrap.native/4.0.6/bootstrap-native.esm.js", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package org.duracloud.account.app.model; import java.util.Set; public class User implements Comparable<User> { public User( Long id, String username, String firstName, String lastName, String email, String allowableIPAddressRange, Set<Account> accounts, boolean root) { super(); this.id = id; this.username = username; this.firstName = firstName; this.lastName = lastName; this.email = email; this.allowableIPAddressRange = allowableIPAddressRange; this.accounts = accounts; this.root = root; } private Long id; private String username; private String firstName; private String lastName; private String email; private Set<Account> accounts; private String allowableIPAddressRange; private boolean root = false; public Long getId() { return id; } public boolean isRoot() { return root; } public String getUsername() { return username; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String getEmail() { return email; } public Set<Account> getAccounts() { return accounts; } @Override public int compareTo(User o) { return this.getUsername().compareTo(o.getUsername()); } public String getAllowableIPAddressRange() { return allowableIPAddressRange; } }
{ "content_hash": "5587aee0b6ed4c71e44d6ccbfec002ea", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 96, "avg_line_length": 22.52238805970149, "alnum_prop": 0.6262425447316103, "repo_name": "duracloud/management-console", "id": "e30cc92ec031d241c2f0b5a89a2d2610ecc95b3d", "size": "1727", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "account-management-app/src/main/java/org/duracloud/account/app/model/User.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "41522" }, { "name": "Java", "bytes": "639876" }, { "name": "JavaScript", "bytes": "29991" }, { "name": "Shell", "bytes": "2559" } ], "symlink_target": "" }
<html dir="LTR"> <head> <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" /> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" /> <title>log4net.Layout</title> <xml> </xml> <link rel="stylesheet" type="text/css" href="MSDN.css" /> </head> <body id="bodyID" class="dtBODY"> <div id="nsbanner"> <div id="bannerrow1"> <table class="bannerparthead" cellspacing="0"> <tr id="hdr"> <td class="runninghead">log4net SDK Documentation - Microsoft .NET Framework 4.0</td> <td class="product"> </td> </tr> </table> </div> <div id="TitleRow"> <h1 class="dtH1">log4net.Layout Namespace</h1> </div> </div> <div id="nstext"> <p> <a href="log4net.LayoutHierarchy.html">Namespace hierarchy</a> </p> <h3 class="dtH3">Classes</h3> <div class="tablediv"> <table class="dtTABLE" cellspacing="0"> <tr valign="top"> <th width="50%">Class</th> <th width="50%">Description</th> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.ExceptionLayout.html">ExceptionLayout</a> </td> <td width="50%"> A Layout that renders only the Exception text from the logging event </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.Layout2RawLayoutAdapter.html">Layout2RawLayoutAdapter</a> </td> <td width="50%"> Adapts any <a href="log4net.Layout.ILayout.html">ILayout</a> to a <a href="log4net.Layout.IRawLayout.html">IRawLayout</a> </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.LayoutSkeleton.html">LayoutSkeleton</a> </td> <td width="50%"> Extend this abstract class to create your own log layout format. </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.PatternLayout.html">PatternLayout</a> </td> <td width="50%"> A flexible layout configurable with pattern string. </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.RawLayoutConverter.html">RawLayoutConverter</a> </td> <td width="50%"> Type converter for the <a href="log4net.Layout.IRawLayout.html">IRawLayout</a> interface </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.RawPropertyLayout.html">RawPropertyLayout</a> </td> <td width="50%"> Extract the value of a property from the <a href="log4net.Core.LoggingEvent.html">LoggingEvent</a> </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.RawTimeStampLayout.html">RawTimeStampLayout</a> </td> <td width="50%"> Extract the date from the <a href="log4net.Core.LoggingEvent.html">LoggingEvent</a> </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.RawUtcTimeStampLayout.html">RawUtcTimeStampLayout</a> </td> <td width="50%"> Extract the date from the <a href="log4net.Core.LoggingEvent.html">LoggingEvent</a> </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.SimpleLayout.html">SimpleLayout</a> </td> <td width="50%"> A very simple layout </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.XmlLayout.html">XmlLayout</a> </td> <td width="50%"> Layout that formats the log events as XML elements. </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.XmlLayoutBase.html">XmlLayoutBase</a> </td> <td width="50%"> Layout that formats the log events as XML elements. </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.XmlLayoutSchemaLog4j.html">XmlLayoutSchemaLog4j</a> </td> <td width="50%"> Layout that formats the log events as XML elements compatible with the log4j schema </td> </tr> </table> </div> <h3 class="dtH3">Interfaces</h3> <div class="tablediv"> <table class="dtTABLE" cellspacing="0"> <tr valign="top"> <th width="50%">Interface</th> <th width="50%">Description</th> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.ILayout.html">ILayout</a> </td> <td width="50%"> Interface implemented by layout objects </td> </tr> <tr valign="top"> <td width="50%"> <a href="log4net.Layout.IRawLayout.html">IRawLayout</a> </td> <td width="50%"> Interface for raw layout objects </td> </tr> </table> </div> <hr /> <div id="footer"> <p> <a href="http://logging.apache.org/log4net">Copyright 2004-2011 The Apache Software Foundation.</a> </p> <p> </p> </div> </div> </body> </html>
{ "content_hash": "0cfd8a350392e4634c6ab56ba743629e", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 150, "avg_line_length": 38.42758620689655, "alnum_prop": 0.5148959081119885, "repo_name": "npruehs/slash-framework", "id": "b6b0ae7a04700d055269887c4e9180fe085280d6", "size": "5572", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Ext/log4net-1.2.11/doc/release/sdk/log4net.Layout.html", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "7145" }, { "name": "C#", "bytes": "4000351" }, { "name": "C++", "bytes": "28426" }, { "name": "CSS", "bytes": "21726" }, { "name": "GLSL", "bytes": "45378" }, { "name": "HTML", "bytes": "10267333" }, { "name": "JavaScript", "bytes": "7017" }, { "name": "Perl", "bytes": "15600" }, { "name": "Shell", "bytes": "24755" }, { "name": "Visual Basic", "bytes": "49736" }, { "name": "XSLT", "bytes": "3323" } ], "symlink_target": "" }
<?php @include_once 'menu.php'; //header('Content-type: text/html; charset=UTF-8'); if($_SESSION['materia']===1){ echo "<div style=\"width:100%;color:green;text-align:center;font-weight:bold;border-style:solid;border-width:2px;border-color:green;background-color:#81F79F;\">Modifica effettuata correttamente</div>"; $_SESSION['materia']=0; } ?> <html> <head> <?php @include_once 'shared/head_inclusions.php';?> </head> <body> <div id="testata"> <img src="img/logo.png"> </div> <div id="principale"> <div id="menu"> <!-- INIZIO CARICAMENTO MENU --> <?php menu(); ?> </div> <!-- FINE MENU --> <div id="contenuto"> <div id="benvenuto"> <b>Benvenuto <?php echo $utente->nome; ?>!</b> </div> <div id="avvisi"> <h1>Cambia docente alle materie</h1> <?php //qui estraggo le info riguardo il professore scelto e la sua materia/materie $idDocente=$_POST["nome-professore"]; $sqlNomeCognome="SELECT a.Nome, a.Cognome, d.Id_anagrafe FROM anagrafe AS a, docenti AS d WHERE d.Id_anagrafe=a.Id"; //$connessione->mysql_query("SET NAMES UTF8"); $res=$connessione->query($sqlNomeCognome); $resNomeCognome=$res->fetch_assoc(); ?> <p><b><a href="admin_cambia_materia_docenti.php">&lt;&lt; Torna indietro</a></b></p> <p>Ecco i dettagli del professor: <?php echo $resNomeCognome["Cognome"]." ".$resNomeCognome["Nome"] ?></p> <form method="post" action="admin_cambia_materia_query.php"> <table> <tr style="margin-top:20px;"> <td><!--label>ID Professore:</label--></td> <td><input type="text" value="<?php echo $resNomeCognome['Id_anagrafe'];?>" name="id-docente" hidden></input></td> </tr> <tr style="margin-top:20px; background-color:#efefef;"> <td style="width:16%;"><label>Materie:</label></td> <td> <select name="materia-da-modificare"> <?php $materiePresenti=0; //~ $sqlMateriaDocente="SELECT a.Nome, a.Cognome, d.Id_anagrafe, m.Id, m.Nome_materia, m.Anno //~ FROM anagrafe AS a, docenti AS d, materie AS m //~ WHERE m.Id_docente =".$resNomeCognome["Id_anagrafe"]." //~ AND a.Id =".$resNomeCognome["Id_anagrafe"]." //~ AND d.Id_anagrafe =".$resNomeCognome["Id_anagrafe"]; $sqlMateriaDocente="SELECT m.Id, m.Nome_materia FROM materie_anagrafica AS m"; $res=$connessione->query($sqlMateriaDocente); while($resMateriaDocente=$res->fetch_assoc()){ $materiePresenti=1;//per identificare se nella listbox deve comparire la frase "nessuna materia presente" echo '<option value="'.$resMateriaDocente["Id"].'">'.$resMateriaDocente["Nome_materia"]. /*' ('.$resMateriaDocente["Anno"].')'.*/'</option>'; } if($materiePresenti==0){ echo '<option value="nessuna-materia">Nessuna materia per questo prof.</option>'; } ?> </select> </td> <td></td> </tr> <!--tr style="margin-top:20px; background-color:#d0d0d0;"> <td><label>Cosa vuoi fare?</label></td> <td><input type="radio" name="opzioni-materia" value="sostituisci" checked>Sostituisci con un'altra materia:</td> <td> <select name="materia-sostitutiva"> <?php //elenco materie per menù $sqlMaterie="SELECT Id, Nome_materia, Anno FROM materie"; $res=$connessione->query($sqlMaterie); while($resMaterie=$res->fetch_assoc()){ echo '<option value="'.$resMaterie["Id"].'">'.$resMaterie["Nome_materia"].' ('.$resMaterie["Anno"].')'.'</option>'; } ?> </select> </td> </tr--> <tr style="margin-top:20px; background-color:#d0d0d0;"> <td></td> <td><input type="radio" name="opzioni-materia" value="aggiungi">Aggiungi una nuova materia:</td> <td> <select name="materia-aggiuntiva"> <?php //elenco materie per menù $sqlMaterie="SELECT Id, Nome_materia, Anno FROM materie ORDER BY Nome_materia"; $res=$connessione->query($sqlMaterie); while($resMaterie=$res->fetch_assoc()){ echo '<option value="'.$resMaterie["Id"].'">'.$resMaterie["Nome_materia"].' ('.$resMaterie["Anno"].')'.'</option>'; } ?> </select> </td> </tr> <tr style="margin-top:20px; background-color:#d0d0d0;"> <td></td> <td><input type="radio" name="opzioni-materia" value="elimina">Rimuovi materia</td><br> <td> <select name="materia-da-modificare"> <?php $materiePresenti=0; $sqlMateriaDocente="SELECT a.Nome, a.Cognome, d.Id_anagrafe, m.Id, m.Nome_materia, m.Anno FROM anagrafe AS a, docenti AS d, materie AS m WHERE m.Id_docente =".$resNomeCognome["Id_anagrafe"]." AND a.Id =".$resNomeCognome["Id_anagrafe"]." AND d.Id_anagrafe =".$resNomeCognome["Id_anagrafe"]." ORDER BY m.Nome_materia"; $res=$connessione->query($sqlMateriaDocente); while($resMateriaDocente=$res->fetch_assoc()){ $materiePresenti=1;//per identificare se nella listbox deve comparire la frase "nessuna materia presente" echo '<option value="'.$resMateriaDocente["Id"].'">'.$resMateriaDocente["Nome_materia"].' ('.$resMateriaDocente["Anno"].')'.'</option>'; } if($materiePresenti==0){ echo '<option value="nessuna-materia">Nessuna materia per questo prof.</option>'; } ?> </select> </td> </tr> <tr style="margin-top:20px; background-color:#efefef;"> <td></td> <td><input type="submit" value="Salva"></td> </tr> </table> </form> </div> </div> </div> <!-- INIZIO FOOTER --> <div id="footer" style="bottom:0px;left:0px;width:100%;background-color:black;color:white;height:40px;font-size:14px;float:left"> <p align="center"> Copyright © 2015 Accademia Di Belle Arti Kandinskij <a href="" rel="nofollow" target="_blank"></a> </p> </div> </body> </html>
{ "content_hash": "bcca5727b39d9a15678e37e2f831b24c", "timestamp": "", "source": "github", "line_count": 149, "max_line_length": 202, "avg_line_length": 41.852348993288594, "alnum_prop": 0.5750481077613855, "repo_name": "dynastes/progetto_accademia", "id": "577f131a68275edf3547e158db910ccc8ed6aa02", "size": "6239", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "admin_cambia_materia_docenti_dettagli.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "135444" }, { "name": "HTML", "bytes": "116643" }, { "name": "JavaScript", "bytes": "853745" }, { "name": "PHP", "bytes": "310245" }, { "name": "PowerShell", "bytes": "1016" } ], "symlink_target": "" }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package edu.pitt.apollo.brokerservicerestfrontend.methods; import edu.pitt.apollo.brokerservicerestfrontend.utils.ResponseMessageBuilder; import edu.pitt.apollo.data_service_types.v3_0_2.ContentIdAndDescription; import edu.pitt.apollo.exception.DataServiceException; import edu.pitt.apollo.exception.SerializationException; import edu.pitt.apollo.exception.UnsupportedSerializationFormatException; import edu.pitt.apollo.services_common.v3_0_2.FileAndURLDescription; import edu.pitt.apollo.services_common.v3_0_2.ObjectSerializationInformation; import edu.pitt.apollo.services_common.v3_0_2.SerializationFormat; import edu.pitt.apollo.utilities.Serializer; import org.springframework.http.HttpStatus; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * * @author nem41 */ public class GetListOfFilesForRunMethod extends BaseBrokerServiceAccessorMethod { public GetListOfFilesForRunMethod(String username, String password, SerializationFormat serializationFormat) throws UnsupportedSerializationFormatException { super(username, password, serializationFormat); } public String getListOfFilesForRun(BigInteger runId) throws UnsupportedSerializationFormatException, SerializationException { try { Map<BigInteger, FileAndURLDescription> files = impl.getListOfFilesForRunId(runId, authentication); List<String> serializedContents = new ArrayList<>(); for (BigInteger id : files.keySet()) { ContentIdAndDescription idAndDescription = new ContentIdAndDescription(); idAndDescription.setContentId(id); idAndDescription.setContentDescription(files.get(id)); String serializedObject = serializer.serializeObject(idAndDescription); serializedContents.add(serializedObject); } ObjectSerializationInformation objectSerializationInformation = new ObjectSerializationInformation(); objectSerializationInformation.setClassNameSpace(Serializer.APOLLO_NAMESPACE); objectSerializationInformation.setClassName(ContentIdAndDescription.class.getSimpleName()); objectSerializationInformation.setFormat(SerializationFormat.XML); responseBuilder.setStatus(HttpStatus.OK, ResponseMessageBuilder.DEFAULT_SUCCESS_MESSAGE) .setResponseBodySerializationInformation(objectSerializationInformation).addContentToBody(serializedContents).setIsBodySerialized(true); } catch (DataServiceException ex) { responseBuilder.setStatus(HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage()); } return serializer.serializeObject(responseBuilder.getResponse()); } }
{ "content_hash": "9a0e3a8492cfd88f44abc96861cb86ba", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 158, "avg_line_length": 41.59090909090909, "alnum_prop": 0.8258652094717669, "repo_name": "jvd10/apollo", "id": "776f6fdb7297f9e2ed09b3afb187ec63c596b3aa", "size": "2745", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "broker-service-rest-frontend/src/main/java/edu/pitt/apollo/brokerservicerestfrontend/methods/GetListOfFilesForRunMethod.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "20092" }, { "name": "Java", "bytes": "1389584" }, { "name": "JavaScript", "bytes": "64608" }, { "name": "PLpgSQL", "bytes": "4067" }, { "name": "Shell", "bytes": "5568" } ], "symlink_target": "" }
package com.commonsware.empublite; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.StrictMode; import android.support.v4.view.ViewPager; import android.view.Menu; import android.view.MenuItem; import android.view.View; import de.greenrobot.event.EventBus; public class EmPubLiteActivity extends Activity { private static final String MODEL="model"; private static final String PREF_LAST_POSITION="lastPosition"; private static final String PREF_SAVE_LAST_POSITION= "saveLastPosition"; private static final String PREF_KEEP_SCREEN_ON="keepScreenOn"; private ViewPager pager=null; private ContentsAdapter adapter=null; private ModelFragment mfrag=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setupStrictMode(); setContentView(R.layout.main); pager=(ViewPager)findViewById(R.id.pager); mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL); if (mfrag == null) { mfrag=new ModelFragment(); getFragmentManager().beginTransaction().add(mfrag, MODEL) .commit(); } else if (mfrag.getBook() != null) { setupPager(mfrag.getBook()); } getActionBar().setHomeButtonEnabled(true); } @Override public void onResume() { super.onResume(); EventBus.getDefault().register(this); if (mfrag.getPrefs() != null) { pager.setKeepScreenOn(mfrag.getPrefs() .getBoolean(PREF_KEEP_SCREEN_ON, false)); } } @Override public void onPause() { EventBus.getDefault().unregister(this); if (mfrag.getPrefs() != null) { int position=pager.getCurrentItem(); mfrag.getPrefs().edit().putInt(PREF_LAST_POSITION, position) .apply(); } super.onPause(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.options, menu); return(super.onCreateOptionsMenu(menu)); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: pager.setCurrentItem(0, false); return(true); case R.id.notes: Intent i=new Intent(this, NoteActivity.class); i.putExtra(NoteActivity.EXTRA_POSITION, pager.getCurrentItem()); startActivity(i); return(true); case R.id.about: i=new Intent(this, SimpleContentActivity.class); i.putExtra(SimpleContentActivity.EXTRA_FILE, "file:///android_asset/misc/about.html"); startActivity(i); return(true); case R.id.help: i=new Intent(this, SimpleContentActivity.class); i.putExtra(SimpleContentActivity.EXTRA_FILE, "file:///android_asset/misc/help.html"); startActivity(i); return(true); case R.id.settings: startActivity(new Intent(this, Preferences.class)); return(true); } return(super.onOptionsItemSelected(item)); } public void onEventMainThread(BookLoadedEvent event) { setupPager(event.getBook()); } private void setupPager(BookContents contents) { adapter=new ContentsAdapter(this, contents); pager.setAdapter(adapter); findViewById(R.id.progressBar1).setVisibility(View.GONE); findViewById(R.id.pager).setVisibility(View.VISIBLE); SharedPreferences prefs=mfrag.getPrefs(); if (prefs != null) { if (prefs.getBoolean(PREF_SAVE_LAST_POSITION, false)) { pager.setCurrentItem(prefs.getInt(PREF_LAST_POSITION, 0)); } pager.setKeepScreenOn(prefs.getBoolean(PREF_KEEP_SCREEN_ON, false)); } } private void setupStrictMode() { StrictMode.ThreadPolicy.Builder builder= new StrictMode.ThreadPolicy.Builder().detectDiskWrites() .detectNetwork(); if (BuildConfig.DEBUG) { builder.penaltyDeath(); } else { builder.penaltyLog(); } StrictMode.setThreadPolicy(builder.build()); } }
{ "content_hash": "0187c0c64dfed1c8196631ac1982c19d", "timestamp": "", "source": "github", "line_count": 157, "max_line_length": 74, "avg_line_length": 26.43312101910828, "alnum_prop": 0.6645783132530121, "repo_name": "0359xiaodong/cw-omnibus", "id": "dbf59c38b4945b05b63fa2c32d2f3c12dc436996", "size": "4150", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "EmPubLite/T15-Share/src/com/commonsware/empublite/EmPubLiteActivity.java", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ProjectModuleManager"> <modules> <module fileurl="file://$PROJECT_DIR$/LearnComponents.iml" filepath="$PROJECT_DIR$/LearnComponents.iml" /> <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> </modules> </component> </project>
{ "content_hash": "92cbd2b09602e92218baac4b5de6af5a", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 112, "avg_line_length": 40.77777777777778, "alnum_prop": 0.670299727520436, "repo_name": "whWZH/practice", "id": "6c2d8e21ae9d0005e79f4d36fb8269b1a8cbfa80", "size": "367", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "LearnComponents/.idea/modules.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "210575" } ], "symlink_target": "" }
<?php /* * Created on Setp 8, 2007 * */ // Page requirements define('LOGIN_REQUIRED', false); define('PAGE_ACCESS_LEVEL', 0); define('PAGE_TYPE', 'PUBLIC'); // Set for every page require ('engine/common.php'); $smarty->assign('page_name', 'Season Registrations'); setup_seasonregistrations_list(); // Build the page require ('global_begin.php'); $smarty->display('public/seasonregistrations.tpl'); require ('global_end.php'); /* * ******************************************************************************** * ******************************************************************************** * **************************L O C A L F U N C T I O N S************************** * ******************************************************************************** * ******************************************************************************** */ function setup_seasonregistrations_list() { global $smarty; global $SEASON; $smarty->assign('seasonName', get_season_name($SEASON)); global $Link; $selectColumns = 'fName,lName'; $registrationsSelect = 'SELECT ' . $selectColumns . ' FROM ' . REGISTRATION . ' WHERE seasonId=' . $SEASON . ' ORDER BY lName'; $registrationsResult = mysql_query($registrationsSelect, $Link); if ($registrationsResult && mysql_num_rows($registrationsResult) > 0) { $countPlayers = 0; $smarty->assign('countRegistrants', array()); $smarty->assign('registrantFName', array()); $smarty->assign('registrantLName', array()); while ($player = mysql_fetch_array($registrationsResult, MYSQL_ASSOC)) { $countPlayers++; $registrantFName = $player['fName']; $registrantLName = $player['lName']; $smarty->append('countRegistrants', $countPlayers); $smarty->append('registrantFName', $registrantFName); $smarty->append('registrantLName', $registrantLName); } $smarty->assign('countPlayers', $countPlayers); } } ?>
{ "content_hash": "cca69e4720119b46a4672d5834853008", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 131, "avg_line_length": 40.755102040816325, "alnum_prop": 0.514271407110666, "repo_name": "klangrud/tcshl", "id": "fd13e09c82d51308a2fcee78c755da76519eeeeb", "size": "1997", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "seasonregistrations.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "11611" }, { "name": "JavaScript", "bytes": "2903" }, { "name": "PHP", "bytes": "1003655" }, { "name": "Perl", "bytes": "20925" }, { "name": "SQLPL", "bytes": "2204" }, { "name": "Smarty", "bytes": "177623" } ], "symlink_target": "" }
package com.significantfiles.android.sqlite; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.net.Uri; import android.util.Log; import com.significantfiles.android.sqlite.query.QueryType; import com.significantfiles.android.sqlite.query.SQL; import com.significantfiles.mrcounter.db.UnknownQueryTypeException; public class DaoInvocationHandler implements InvocationHandler { private final DaoMethod daoMethodCall = new DaoMethod(); private final Class<?> daoType; private final SQLiteOpenHelper dbManager; public DaoInvocationHandler(final Class<?> daoType, final SQLiteOpenHelper dbManager) { this.daoType = daoType; this.dbManager = dbManager; } @Override public Object invoke(final Object proxy, final Method method, final Object[] arguments) throws Throwable { daoMethodCall.set(method); final QueryType queryType = daoMethodCall.queryType(); switch (queryType) { case SELECT: throw new UnsupportedOperationException(); case INSERT: return handleInsertSQL(arguments); default: handleUnknownQueryType(queryType); break; } // TODO Auto-generated method stub return null; } private Object handleInsertSQL(final Object[] arguments) { final String sql = daoMethodCall.buildSQL(); execQuery(sql, arguments); return null; } private void execQuery(final String sql, final Object[] arguments) { Log.i("sqleasy", "Execute sql [= " + sql + "] on SQLite-Database over DAO [= " + this.daoType.getName() + "]." ); final SQLiteDatabase db = this.dbManager.getWritableDatabase(); // db.beginTransaction(); // db.query("Credit", , selection, selectionArgs, groupBy, having, orderBy) // db.rawQuery( "SELECT * from sqlite_master WHERE", selectionArgs) // try { db.execSQL(sql, arguments); } catch (final Throwable e) { throw new InsertException(sql, arguments, e); } // db.endTransaction(); } private void handleUnknownQueryType(final QueryType queryType) { throw new UnknownQueryTypeException(queryType); } static class DaoMethod { private Method method; private SQL sql; public void set(final Method method) { this.method = method; this.sql = this.method.getAnnotation(SQL.class); } public String buildSQL() { return this.sql.query(); } private Uri buildURI() { throw new UnsupportedOperationException(); } public QueryType queryType() { return sql.type(); } } }
{ "content_hash": "3a2f27bda6c5764b1a5e6f3a94185b4f", "timestamp": "", "source": "github", "line_count": 104, "max_line_length": 115, "avg_line_length": 24.51923076923077, "alnum_prop": 0.735686274509804, "repo_name": "drdrej/android-webview-example", "id": "efa473c7e6bd20c1d4a23d42792f4012b921cccb", "size": "2550", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "android-webview-app/src/com/significantfiles/android/sqlite/DaoInvocationHandler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "57554" }, { "name": "JavaScript", "bytes": "26329" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Html; namespace wwtlib { public class Class1 { } }
{ "content_hash": "ea9978a478e78402c12208cf843aa73b", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 33, "avg_line_length": 11.454545454545455, "alnum_prop": 0.6904761904761905, "repo_name": "juoni/wwt-web-client", "id": "10af54ed5e309e075bd9befcbb3bf24ec6a77fdc", "size": "143", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "HTML5SDK/wwtlib/Class1.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "55893" }, { "name": "Batchfile", "bytes": "39" }, { "name": "C#", "bytes": "1972739" }, { "name": "CSS", "bytes": "257377" }, { "name": "HTML", "bytes": "34634" }, { "name": "JavaScript", "bytes": "13607698" }, { "name": "PowerShell", "bytes": "3208" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <title>Video</title> <script type="text/javascript" src="js/jquery-2.0.3.min.js"></script> </head> <body> <h3>Video</h3> <!--<input type="file" accept="video/*" capture="camera" id="camera">--> <video src="" width='400' height='300' autoplay id="camera"></video> <canvas id="camera_canvas "width='400' height='300'></canvas> <img src="" alt="" id="camera_image1"/> <img src="" alt="" id="camera_image2"/> <img src="" alt="" id="camera_image3"/> <input type="button" value="Go" id="Go"> <script type="text/javascript" src="js/stream01.js"></script> </body> </html>
{ "content_hash": "ca5c9240403d0f252fc0b02139ecd8d6", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 73, "avg_line_length": 30.476190476190474, "alnum_prop": 0.6296875, "repo_name": "taikiken/sankaku.js", "id": "a95622053d1d5b1bd5941f98276990dda3e226f6", "size": "640", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/roll/stream01.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "6260" }, { "name": "HTML", "bytes": "460129" }, { "name": "JavaScript", "bytes": "1111546" }, { "name": "Ruby", "bytes": "5262" } ], "symlink_target": "" }
<?php require_once('contacts.class.php'); $obj = new Contacts(); switch($_SERVER['REQUEST_METHOD']) { case 'POST': $d = json_decode(file_get_contents("php://input"), true); $result = $obj->send($d); echo json_encode($result); break; }; return;
{ "content_hash": "df52b15260517782d4b4176479067f77", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 65, "avg_line_length": 16.61111111111111, "alnum_prop": 0.5351170568561873, "repo_name": "Fabio-Gambacorta/aniem-abruzzo", "id": "262befcbf1e7ce6fdc3465c7e06557f42a424414", "size": "299", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/api/contacts/index.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1214" }, { "name": "CSS", "bytes": "148915" }, { "name": "HTML", "bytes": "82676" }, { "name": "JavaScript", "bytes": "130055" }, { "name": "Makefile", "bytes": "389" }, { "name": "PHP", "bytes": "282300" }, { "name": "Smarty", "bytes": "798" } ], "symlink_target": "" }
// // KFTicketHttpTool.h // SampleSDKApp // // Created by admin on 15/2/3. // Copyright (c) 2015年 admin. All rights reserved. // #import "KFBaseHttpTool.h" @class KFTicketHttpTool; @protocol KFTicketHttpToolDelegate <NSObject> @required /** * 请求成功的代理方法 */ - (void)ticketHttpTool:(KFTicketHttpTool *)ticketHttpTool successWithResult:(NSDictionary *)result; @optional /** * 请求失败的代理方法 */ - (void)ticketHttpTool:(KFTicketHttpTool *)ticketHttpTool failureWithError:(KFError *)error; @end @interface KFTicketHttpTool : NSObject /** * 代理对象 */ @property (nonatomic, weak) id<KFTicketHttpToolDelegate> delegate; #pragma mark - 对象方法 /** * 获取工单列表 * * @param pageSize 每页工单的数量 * @param page 当前请求第几页 */ - (NSURLSessionDataTask *)getTicketListWithPageSize:(NSString *)pageSize page:(NSString *)page; /** * 获取工单内容 * * @param ticket_id 工单的id * @param pageSize 每页工单的数量 * @param page 当前请求第几页 */ - (NSURLSessionDataTask *)getTicketWithTicket_id:(NSString *)ticket_id pageSize:(NSString *)pageSize page:(NSString *)page; /** * 获取工单详情 * * @param ticket_id 工单的id */ - (NSURLSessionDataTask *)getTicketDetailMessageWithTicket_id:(NSString *)ticket_id; /** * 回复工单 * * @param ticket_id 工单的id * @param content 回复内容 * @param imageTokens 附件图片token数组 */ - (NSURLSessionDataTask *)replyTicketWithTicket_id:(NSString *)ticket_id content:(NSString *)content imageTokens:(NSArray *)imageTokens; /** * 创建工单 * * @param title 工单标题 * @param content 回复内容 * @param imageTokens 附件图片token数组 * @param custom_fields 自定义字段,如@{@"field_123":@"手机端"}, 自定义字段的key需要使用获取自定义字段的接口获取 */ - (NSURLSessionDataTask *)createTicketWithTitle:(NSString *)title content:(NSString *)content imageTokens:(NSArray *)imageTokens custom_fields:(NSDictionary *)custom_fields; /** * 获取自定义字段 */ - (NSURLSessionDataTask *)getCustom_fields; #pragma mark - 类方法 /** * 获取工单列表 * * @param pageSize 每页工单的数量 * @param page 当前请求第几页 * @param successBlock 获取成功的回调 * @param failureBlock 获取失败的回调 */ + (NSURLSessionDataTask *)getTicketListWithPageSize:(NSString *)pageSize page:(NSString *)page successBlock:(KFAPISuccess)successBlock failureBlock:(KFAPIError)failureBlock; /** * 获取工单内容 * * @param ticket_id 工单的id * @param pageSize 每页工单的数量 * @param page 当前请求第几页 * @param successBlock 获取成功的回调 * @param failureBlock 获取失败的回调 */ + (NSURLSessionDataTask *)getTicketWithTicket_id:(NSString *)ticket_id pageSize:(NSString *)pageSize page:(NSString *)page successBlock:(KFAPISuccess)successBlock failureBlock:(KFAPIError)failureBlock; /** * 获取工单详情 * * @param ticket_id 工单的id * @param successBlock 获取成功的回调 * @param failureBlock 获取失败的回调 */ + (NSURLSessionDataTask *)getTicketDetailMessageWithTicket_id:(NSString *)ticket_id successBlock:(KFAPISuccess)successBlock failureBlock:(KFAPIError)failureBlock; /** * 回复工单 * * @param ticket_id 工单的id * @param content 回复内容 * @param imageTokens 附件图片token数组 * @param successBlock 回复成功的回调 * @param failureBlock 回复失败的回调 */ + (NSURLSessionDataTask *)replyTicketWithTicket_id:(NSString *)ticket_id content:(NSString *)content imageTokens:(NSArray *)imageTokens successBlock:(KFAPISuccess)successBlock failureBlock:(KFAPIError)failureBlock; /** * 创建工单 * * @param title 工单标题 * @param content 回复内容 * @param imageTokens 附件图片token数组 * @param custom_fields 自定义字段,如@{@"field_123":@"手机端"}, 自定义字段的key需要使用获取自定义字段的接口获取 * @param successBlock 回复成功的回调 * @param failureBlock 回复失败的回调 */ + (NSURLSessionDataTask *)createTicketWithTitle:(NSString *)title content:(NSString *)content imageTokens:(NSArray *)imageTokens custom_fields:(NSDictionary *)custom_fields successBlock:(KFAPISuccess)successBlock failureBlock:(KFAPIError)failureBlock; /** * 获取自定义字段 * * @param successBlock 获取成功的回调 * @param failureBlock 获取失败的回调 */ + (NSURLSessionDataTask *)getCustom_fieldsWithSuccessBlock:(KFAPISuccess)successBlock failureBlock:(KFAPIError)failureBlock; @end
{ "content_hash": "6cef8f034daa5af6d02ea0f4c15e1730", "timestamp": "", "source": "github", "line_count": 149, "max_line_length": 251, "avg_line_length": 27.610738255033556, "alnum_prop": 0.7034516285853184, "repo_name": "KF5/KF5SDK-iOS", "id": "6a2d3138afb286aeb14b59f2a96f6febcbf9a20f", "size": "4842", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "KF5SDK/KF5SDK.framework/Versions/A/Headers/KFTicketHttpTool.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "2519" }, { "name": "CSS", "bytes": "2019" }, { "name": "Objective-C", "bytes": "92496" }, { "name": "Ruby", "bytes": "1366" } ], "symlink_target": "" }
""" An extension of scipy.stats.stats to support masked arrays """ # Original author (2007): Pierre GF Gerard-Marchant # TODO : f_value_wilks_lambda looks botched... what are dfnum & dfden for ? # TODO : ttest_rel looks botched: what are x1,x2,v1,v2 for ? # TODO : reimplement ksonesamp __all__ = ['argstoarray', 'count_tied_groups', 'describe', 'f_oneway', 'find_repeats','friedmanchisquare', 'kendalltau','kendalltau_seasonal','kruskal','kruskalwallis', 'ks_twosamp','ks_2samp','kurtosis','kurtosistest', 'linregress', 'mannwhitneyu', 'meppf','mode','moment','mquantiles','msign', 'normaltest', 'obrientransform', 'pearsonr','plotting_positions','pointbiserialr', 'rankdata', 'scoreatpercentile','sem', 'sen_seasonal_slopes','skew','skewtest','spearmanr', 'siegelslopes', 'theilslopes', 'tmax','tmean','tmin','trim','trimboth', 'trimtail','trima','trimr','trimmed_mean','trimmed_std', 'trimmed_stde','trimmed_var','tsem','ttest_1samp','ttest_onesamp', 'ttest_ind','ttest_rel','tvar', 'variation', 'winsorize', 'brunnermunzel', ] import numpy as np from numpy import ndarray import numpy.ma as ma from numpy.ma import masked, nomask import itertools import warnings from collections import namedtuple from . import distributions import scipy.special as special from ._stats_mstats_common import ( _find_repeats, linregress as stats_linregress, theilslopes as stats_theilslopes, siegelslopes as stats_siegelslopes ) def _chk_asarray(a, axis): # Always returns a masked array, raveled for axis=None a = ma.asanyarray(a) if axis is None: a = ma.ravel(a) outaxis = 0 else: outaxis = axis return a, outaxis def _chk2_asarray(a, b, axis): a = ma.asanyarray(a) b = ma.asanyarray(b) if axis is None: a = ma.ravel(a) b = ma.ravel(b) outaxis = 0 else: outaxis = axis return a, b, outaxis def _chk_size(a, b): a = ma.asanyarray(a) b = ma.asanyarray(b) (na, nb) = (a.size, b.size) if na != nb: raise ValueError("The size of the input array should match!" " (%s <> %s)" % (na, nb)) return (a, b, na) def _contains_nan(a, nan_policy='propagate'): policies = ['propagate', 'raise', 'omit'] if nan_policy not in policies: raise ValueError("nan_policy must be one of {%s}" % ', '.join("'%s'" % s for s in policies)) try: # Calling np.sum to avoid creating a huge array into memory # e.g. np.isnan(a).any() with np.errstate(invalid='ignore'): contains_nan = np.isnan(np.sum(a)) except TypeError: # This can happen when attempting to sum things which are not # numbers (e.g. as in the function `mode`). Try an alternative method: try: contains_nan = np.nan in set(a.ravel()) except TypeError: # Don't know what to do. Fall back to omitting nan values and # issue a warning. contains_nan = False nan_policy = 'omit' warnings.warn("The input array could not be properly checked for nan " "values. nan values will be ignored.", RuntimeWarning) if contains_nan and nan_policy == 'raise': raise ValueError("The input contains nan values") return contains_nan, nan_policy def argstoarray(*args): """ Constructs a 2D array from a group of sequences. Sequences are filled with missing values to match the length of the longest sequence. Parameters ---------- args : sequences Group of sequences. Returns ------- argstoarray : MaskedArray A ( `m` x `n` ) masked array, where `m` is the number of arguments and `n` the length of the longest argument. Notes ----- `numpy.ma.row_stack` has identical behavior, but is called with a sequence of sequences. """ if len(args) == 1 and not isinstance(args[0], ndarray): output = ma.asarray(args[0]) if output.ndim != 2: raise ValueError("The input should be 2D") else: n = len(args) m = max([len(k) for k in args]) output = ma.array(np.empty((n,m), dtype=float), mask=True) for (k,v) in enumerate(args): output[k,:len(v)] = v output[np.logical_not(np.isfinite(output._data))] = masked return output def find_repeats(arr): """Find repeats in arr and return a tuple (repeats, repeat_count). The input is cast to float64. Masked values are discarded. Parameters ---------- arr : sequence Input array. The array is flattened if it is not 1D. Returns ------- repeats : ndarray Array of repeated values. counts : ndarray Array of counts. """ # Make sure we get a copy. ma.compressed promises a "new array", but can # actually return a reference. compr = np.asarray(ma.compressed(arr), dtype=np.float64) try: need_copy = np.may_share_memory(compr, arr) except AttributeError: # numpy < 1.8.2 bug: np.may_share_memory([], []) raises, # while in numpy 1.8.2 and above it just (correctly) returns False. need_copy = False if need_copy: compr = compr.copy() return _find_repeats(compr) def count_tied_groups(x, use_missing=False): """ Counts the number of tied values. Parameters ---------- x : sequence Sequence of data on which to counts the ties use_missing : bool, optional Whether to consider missing values as tied. Returns ------- count_tied_groups : dict Returns a dictionary (nb of ties: nb of groups). Examples -------- >>> from scipy.stats import mstats >>> z = [0, 0, 0, 2, 2, 2, 3, 3, 4, 5, 6] >>> mstats.count_tied_groups(z) {2: 1, 3: 2} In the above example, the ties were 0 (3x), 2 (3x) and 3 (2x). >>> z = np.ma.array([0, 0, 1, 2, 2, 2, 3, 3, 4, 5, 6]) >>> mstats.count_tied_groups(z) {2: 2, 3: 1} >>> z[[1,-1]] = np.ma.masked >>> mstats.count_tied_groups(z, use_missing=True) {2: 2, 3: 1} """ nmasked = ma.getmask(x).sum() # We need the copy as find_repeats will overwrite the initial data data = ma.compressed(x).copy() (ties, counts) = find_repeats(data) nties = {} if len(ties): nties = dict(zip(np.unique(counts), itertools.repeat(1))) nties.update(dict(zip(*find_repeats(counts)))) if nmasked and use_missing: try: nties[nmasked] += 1 except KeyError: nties[nmasked] = 1 return nties def rankdata(data, axis=None, use_missing=False): """Returns the rank (also known as order statistics) of each data point along the given axis. If some values are tied, their rank is averaged. If some values are masked, their rank is set to 0 if use_missing is False, or set to the average rank of the unmasked values if use_missing is True. Parameters ---------- data : sequence Input data. The data is transformed to a masked array axis : {None,int}, optional Axis along which to perform the ranking. If None, the array is first flattened. An exception is raised if the axis is specified for arrays with a dimension larger than 2 use_missing : bool, optional Whether the masked values have a rank of 0 (False) or equal to the average rank of the unmasked values (True). """ def _rank1d(data, use_missing=False): n = data.count() rk = np.empty(data.size, dtype=float) idx = data.argsort() rk[idx[:n]] = np.arange(1,n+1) if use_missing: rk[idx[n:]] = (n+1)/2. else: rk[idx[n:]] = 0 repeats = find_repeats(data.copy()) for r in repeats[0]: condition = (data == r).filled(False) rk[condition] = rk[condition].mean() return rk data = ma.array(data, copy=False) if axis is None: if data.ndim > 1: return _rank1d(data.ravel(), use_missing).reshape(data.shape) else: return _rank1d(data, use_missing) else: return ma.apply_along_axis(_rank1d,axis,data,use_missing).view(ndarray) ModeResult = namedtuple('ModeResult', ('mode', 'count')) def mode(a, axis=0): """ Returns an array of the modal (most common) value in the passed array. Parameters ---------- a : array_like n-dimensional array of which to find mode(s). axis : int or None, optional Axis along which to operate. Default is 0. If None, compute over the whole array `a`. Returns ------- mode : ndarray Array of modal values. count : ndarray Array of counts for each mode. Notes ----- For more details, see `stats.mode`. Examples -------- >>> from scipy import stats >>> from scipy.stats import mstats >>> m_arr = np.ma.array([1, 1, 0, 0, 0, 0], mask=[0, 0, 1, 1, 1, 0]) >>> stats.mode(m_arr) ModeResult(mode=array([0]), count=array([4])) >>> mstats.mode(m_arr) ModeResult(mode=array([1.]), count=array([2.])) """ a, axis = _chk_asarray(a, axis) def _mode1D(a): (rep,cnt) = find_repeats(a) if not cnt.ndim: return (0, 0) elif cnt.size: return (rep[cnt.argmax()], cnt.max()) else: return (a.min(), 1) if axis is None: output = _mode1D(ma.ravel(a)) output = (ma.array(output[0]), ma.array(output[1])) else: output = ma.apply_along_axis(_mode1D, axis, a) newshape = list(a.shape) newshape[axis] = 1 slices = [slice(None)] * output.ndim slices[axis] = 0 modes = output[tuple(slices)].reshape(newshape) slices[axis] = 1 counts = output[tuple(slices)].reshape(newshape) output = (modes, counts) return ModeResult(*output) def _betai(a, b, x): x = np.asanyarray(x) x = ma.where(x < 1.0, x, 1.0) # if x > 1 then return 1.0 return special.betainc(a, b, x) def msign(x): """Returns the sign of x, or 0 if x is masked.""" return ma.filled(np.sign(x), 0) def pearsonr(x,y): """ Calculates a Pearson correlation coefficient and the p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. Strictly speaking, Pearson's correlation requires that each dataset be normally distributed. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Correlations of -1 or +1 imply an exact linear relationship. Positive correlations imply that as `x` increases, so does `y`. Negative correlations imply that as `x` increases, `y` decreases. The p-value roughly indicates the probability of an uncorrelated system producing datasets that have a Pearson correlation at least as extreme as the one computed from these datasets. The p-values are not entirely reliable but are probably reasonable for datasets larger than 500 or so. Parameters ---------- x : 1-D array_like Input y : 1-D array_like Input Returns ------- pearsonr : float Pearson's correlation coefficient, 2-tailed p-value. References ---------- http://www.statsoft.com/textbook/glosp.html#Pearson%20Correlation """ (x, y, n) = _chk_size(x, y) (x, y) = (x.ravel(), y.ravel()) # Get the common mask and the total nb of unmasked elements m = ma.mask_or(ma.getmask(x), ma.getmask(y)) n -= m.sum() df = n-2 if df < 0: return (masked, masked) (mx, my) = (x.mean(), y.mean()) (xm, ym) = (x-mx, y-my) r_num = ma.add.reduce(xm*ym) r_den = ma.sqrt(ma.dot(xm,xm) * ma.dot(ym,ym)) r = r_num / r_den # Presumably, if r > 1, then it is only some small artifact of floating # point arithmetic. r = min(r, 1.0) r = max(r, -1.0) if r is masked or abs(r) == 1.0: prob = 0. else: t_squared = (df / ((1.0 - r) * (1.0 + r))) * r * r prob = _betai(0.5*df, 0.5, df/(df + t_squared)) return r, prob SpearmanrResult = namedtuple('SpearmanrResult', ('correlation', 'pvalue')) def spearmanr(x, y=None, use_ties=True, axis=None, nan_policy='propagate'): """ Calculates a Spearman rank-order correlation coefficient and the p-value to test for non-correlation. The Spearman correlation is a nonparametric measure of the linear relationship between two datasets. Unlike the Pearson correlation, the Spearman correlation does not assume that both datasets are normally distributed. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Correlations of -1 or +1 imply a monotonic relationship. Positive correlations imply that as `x` increases, so does `y`. Negative correlations imply that as `x` increases, `y` decreases. Missing values are discarded pair-wise: if a value is missing in `x`, the corresponding value in `y` is masked. The p-value roughly indicates the probability of an uncorrelated system producing datasets that have a Spearman correlation at least as extreme as the one computed from these datasets. The p-values are not entirely reliable but are probably reasonable for datasets larger than 500 or so. Parameters ---------- x, y : 1D or 2D array_like, y is optional One or two 1-D or 2-D arrays containing multiple variables and observations. When these are 1-D, each represents a vector of observations of a single variable. For the behavior in the 2-D case, see under ``axis``, below. use_ties : bool, optional DO NOT USE. Does not do anything, keyword is only left in place for backwards compatibility reasons. axis : int or None, optional If axis=0 (default), then each column represents a variable, with observations in the rows. If axis=1, the relationship is transposed: each row represents a variable, while the columns contain observations. If axis=None, then both arrays will be raveled. nan_policy : {'propagate', 'raise', 'omit'}, optional Defines how to handle when input contains nan. 'propagate' returns nan, 'raise' throws an error, 'omit' performs the calculations ignoring nan values. Default is 'propagate'. Returns ------- correlation : float Spearman correlation coefficient pvalue : float 2-tailed p-value. References ---------- [CRCProbStat2000] section 14.7 """ if not use_ties: raise ValueError("`use_ties=False` is not supported in SciPy >= 1.2.0") # Always returns a masked array, raveled if axis=None x, axisout = _chk_asarray(x, axis) if y is not None: # Deal only with 2-D `x` case. y, _ = _chk_asarray(y, axis) if axisout == 0: x = ma.column_stack((x, y)) else: x = ma.row_stack((x, y)) if axisout == 1: # To simplify the code that follow (always use `n_obs, n_vars` shape) x = x.T if nan_policy == 'omit': x = ma.masked_invalid(x) def _spearmanr_2cols(x): # Mask the same observations for all variables, and then drop those # observations (can't leave them masked, rankdata is weird). x = ma.mask_rowcols(x, axis=0) x = x[~x.mask.any(axis=1), :] m = ma.getmask(x) n_obs = x.shape[0] dof = n_obs - 2 - int(m.sum(axis=0)[0]) if dof < 0: raise ValueError("The input must have at least 3 entries!") # Gets the ranks and rank differences x_ranked = rankdata(x, axis=0) rs = ma.corrcoef(x_ranked, rowvar=False).data # rs can have elements equal to 1, so avoid zero division warnings olderr = np.seterr(divide='ignore') try: # clip the small negative values possibly caused by rounding # errors before taking the square root t = rs * np.sqrt((dof / ((rs+1.0) * (1.0-rs))).clip(0)) finally: np.seterr(**olderr) prob = 2 * distributions.t.sf(np.abs(t), dof) # For backwards compatibility, return scalars when comparing 2 columns if rs.shape == (2, 2): return SpearmanrResult(rs[1, 0], prob[1, 0]) else: return SpearmanrResult(rs, prob) # Need to do this per pair of variables, otherwise the dropped observations # in a third column mess up the result for a pair. n_vars = x.shape[1] if n_vars == 2: return _spearmanr_2cols(x) else: rs = np.ones((n_vars, n_vars), dtype=float) prob = np.zeros((n_vars, n_vars), dtype=float) for var1 in range(n_vars - 1): for var2 in range(var1+1, n_vars): result = _spearmanr_2cols(x[:, [var1, var2]]) rs[var1, var2] = result.correlation rs[var2, var1] = result.correlation prob[var1, var2] = result.pvalue prob[var2, var1] = result.pvalue return SpearmanrResult(rs, prob) KendalltauResult = namedtuple('KendalltauResult', ('correlation', 'pvalue')) def kendalltau(x, y, use_ties=True, use_missing=False, method='auto'): """ Computes Kendall's rank correlation tau on two variables *x* and *y*. Parameters ---------- x : sequence First data list (for example, time). y : sequence Second data list. use_ties : {True, False}, optional Whether ties correction should be performed. use_missing : {False, True}, optional Whether missing data should be allocated a rank of 0 (False) or the average rank (True) method: {'auto', 'asymptotic', 'exact'}, optional Defines which method is used to calculate the p-value [1]_. 'asymptotic' uses a normal approximation valid for large samples. 'exact' computes the exact p-value, but can only be used if no ties are present. 'auto' is the default and selects the appropriate method based on a trade-off between speed and accuracy. Returns ------- correlation : float Kendall tau pvalue : float Approximate 2-side p-value. References ---------- .. [1] Maurice G. Kendall, "Rank Correlation Methods" (4th Edition), Charles Griffin & Co., 1970. """ (x, y, n) = _chk_size(x, y) (x, y) = (x.flatten(), y.flatten()) m = ma.mask_or(ma.getmask(x), ma.getmask(y)) if m is not nomask: x = ma.array(x, mask=m, copy=True) y = ma.array(y, mask=m, copy=True) # need int() here, otherwise numpy defaults to 32 bit # integer on all Windows architectures, causing overflow. # int() will keep it infinite precision. n -= int(m.sum()) if n < 2: return KendalltauResult(np.nan, np.nan) rx = ma.masked_equal(rankdata(x, use_missing=use_missing), 0) ry = ma.masked_equal(rankdata(y, use_missing=use_missing), 0) idx = rx.argsort() (rx, ry) = (rx[idx], ry[idx]) C = np.sum([((ry[i+1:] > ry[i]) * (rx[i+1:] > rx[i])).filled(0).sum() for i in range(len(ry)-1)], dtype=float) D = np.sum([((ry[i+1:] < ry[i])*(rx[i+1:] > rx[i])).filled(0).sum() for i in range(len(ry)-1)], dtype=float) xties = count_tied_groups(x) yties = count_tied_groups(y) if use_ties: corr_x = np.sum([v*k*(k-1) for (k,v) in xties.items()], dtype=float) corr_y = np.sum([v*k*(k-1) for (k,v) in yties.items()], dtype=float) denom = ma.sqrt((n*(n-1)-corr_x)/2. * (n*(n-1)-corr_y)/2.) else: denom = n*(n-1)/2. tau = (C-D) / denom if method == 'exact' and (xties or yties): raise ValueError("Ties found, exact method cannot be used.") if method == 'auto': if (not xties and not yties) and (n <= 33 or min(C, n*(n-1)/2.0-C) <= 1): method = 'exact' else: method = 'asymptotic' if not xties and not yties and method == 'exact': # Exact p-value, see Maurice G. Kendall, "Rank Correlation Methods" (4th Edition), Charles Griffin & Co., 1970. c = int(min(C, (n*(n-1))/2-C)) if n <= 0: raise ValueError elif c < 0 or 2*c > n*(n-1): raise ValueError elif n == 1: prob = 1.0 elif n == 2: prob = 1.0 elif c == 0: prob = 2.0/np.math.factorial(n) elif c == 1: prob = 2.0/np.math.factorial(n-1) elif 2*c == (n*(n-1))//2: prob = 1.0 else: old = [0.0]*(c+1) new = [0.0]*(c+1) new[0] = 1.0 new[1] = 1.0 for j in range(3,n+1): old = new[:] for k in range(1,min(j,c+1)): new[k] += new[k-1] for k in range(j,c+1): new[k] += new[k-1] - old[k-j] prob = 2.0*sum(new)/np.math.factorial(n) elif method == 'asymptotic': var_s = n*(n-1)*(2*n+5) if use_ties: var_s -= np.sum([v*k*(k-1)*(2*k+5)*1. for (k,v) in xties.items()]) var_s -= np.sum([v*k*(k-1)*(2*k+5)*1. for (k,v) in yties.items()]) v1 = np.sum([v*k*(k-1) for (k, v) in xties.items()], dtype=float) *\ np.sum([v*k*(k-1) for (k, v) in yties.items()], dtype=float) v1 /= 2.*n*(n-1) if n > 2: v2 = np.sum([v*k*(k-1)*(k-2) for (k,v) in xties.items()], dtype=float) * \ np.sum([v*k*(k-1)*(k-2) for (k,v) in yties.items()], dtype=float) v2 /= 9.*n*(n-1)*(n-2) else: v2 = 0 else: v1 = v2 = 0 var_s /= 18. var_s += (v1 + v2) z = (C-D)/np.sqrt(var_s) prob = special.erfc(abs(z)/np.sqrt(2)) else: raise ValueError("Unknown method "+str(method)+" specified, please use auto, exact or asymptotic.") return KendalltauResult(tau, prob) def kendalltau_seasonal(x): """ Computes a multivariate Kendall's rank correlation tau, for seasonal data. Parameters ---------- x : 2-D ndarray Array of seasonal data, with seasons in columns. """ x = ma.array(x, subok=True, copy=False, ndmin=2) (n,m) = x.shape n_p = x.count(0) S_szn = sum(msign(x[i:]-x[i]).sum(0) for i in range(n)) S_tot = S_szn.sum() n_tot = x.count() ties = count_tied_groups(x.compressed()) corr_ties = sum(v*k*(k-1) for (k,v) in ties.items()) denom_tot = ma.sqrt(1.*n_tot*(n_tot-1)*(n_tot*(n_tot-1)-corr_ties))/2. R = rankdata(x, axis=0, use_missing=True) K = ma.empty((m,m), dtype=int) covmat = ma.empty((m,m), dtype=float) denom_szn = ma.empty(m, dtype=float) for j in range(m): ties_j = count_tied_groups(x[:,j].compressed()) corr_j = sum(v*k*(k-1) for (k,v) in ties_j.items()) cmb = n_p[j]*(n_p[j]-1) for k in range(j,m,1): K[j,k] = sum(msign((x[i:,j]-x[i,j])*(x[i:,k]-x[i,k])).sum() for i in range(n)) covmat[j,k] = (K[j,k] + 4*(R[:,j]*R[:,k]).sum() - n*(n_p[j]+1)*(n_p[k]+1))/3. K[k,j] = K[j,k] covmat[k,j] = covmat[j,k] denom_szn[j] = ma.sqrt(cmb*(cmb-corr_j)) / 2. var_szn = covmat.diagonal() z_szn = msign(S_szn) * (abs(S_szn)-1) / ma.sqrt(var_szn) z_tot_ind = msign(S_tot) * (abs(S_tot)-1) / ma.sqrt(var_szn.sum()) z_tot_dep = msign(S_tot) * (abs(S_tot)-1) / ma.sqrt(covmat.sum()) prob_szn = special.erfc(abs(z_szn)/np.sqrt(2)) prob_tot_ind = special.erfc(abs(z_tot_ind)/np.sqrt(2)) prob_tot_dep = special.erfc(abs(z_tot_dep)/np.sqrt(2)) chi2_tot = (z_szn*z_szn).sum() chi2_trd = m * z_szn.mean()**2 output = {'seasonal tau': S_szn/denom_szn, 'global tau': S_tot/denom_tot, 'global tau (alt)': S_tot/denom_szn.sum(), 'seasonal p-value': prob_szn, 'global p-value (indep)': prob_tot_ind, 'global p-value (dep)': prob_tot_dep, 'chi2 total': chi2_tot, 'chi2 trend': chi2_trd, } return output PointbiserialrResult = namedtuple('PointbiserialrResult', ('correlation', 'pvalue')) def pointbiserialr(x, y): """Calculates a point biserial correlation coefficient and its p-value. Parameters ---------- x : array_like of bools Input array. y : array_like Input array. Returns ------- correlation : float R value pvalue : float 2-tailed p-value Notes ----- Missing values are considered pair-wise: if a value is missing in x, the corresponding value in y is masked. For more details on `pointbiserialr`, see `stats.pointbiserialr`. """ x = ma.fix_invalid(x, copy=True).astype(bool) y = ma.fix_invalid(y, copy=True).astype(float) # Get rid of the missing data m = ma.mask_or(ma.getmask(x), ma.getmask(y)) if m is not nomask: unmask = np.logical_not(m) x = x[unmask] y = y[unmask] n = len(x) # phat is the fraction of x values that are True phat = x.sum() / float(n) y0 = y[~x] # y-values where x is False y1 = y[x] # y-values where x is True y0m = y0.mean() y1m = y1.mean() rpb = (y1m - y0m)*np.sqrt(phat * (1-phat)) / y.std() df = n-2 t = rpb*ma.sqrt(df/(1.0-rpb**2)) prob = _betai(0.5*df, 0.5, df/(df+t*t)) return PointbiserialrResult(rpb, prob) LinregressResult = namedtuple('LinregressResult', ('slope', 'intercept', 'rvalue', 'pvalue', 'stderr')) def linregress(x, y=None): """ Linear regression calculation Note that the non-masked version is used, and that this docstring is replaced by the non-masked docstring + some info on missing data. """ if y is None: x = ma.array(x) if x.shape[0] == 2: x, y = x elif x.shape[1] == 2: x, y = x.T else: msg = ("If only `x` is given as input, it has to be of shape " "(2, N) or (N, 2), provided shape was %s" % str(x.shape)) raise ValueError(msg) else: x = ma.array(x) y = ma.array(y) x = x.flatten() y = y.flatten() m = ma.mask_or(ma.getmask(x), ma.getmask(y), shrink=False) if m is not nomask: x = ma.array(x, mask=m) y = ma.array(y, mask=m) if np.any(~m): slope, intercept, r, prob, sterrest = stats_linregress(x.data[~m], y.data[~m]) else: # All data is masked return None, None, None, None, None else: slope, intercept, r, prob, sterrest = stats_linregress(x.data, y.data) return LinregressResult(slope, intercept, r, prob, sterrest) def theilslopes(y, x=None, alpha=0.95): r""" Computes the Theil-Sen estimator for a set of points (x, y). `theilslopes` implements a method for robust linear regression. It computes the slope as the median of all slopes between paired values. Parameters ---------- y : array_like Dependent variable. x : array_like or None, optional Independent variable. If None, use ``arange(len(y))`` instead. alpha : float, optional Confidence degree between 0 and 1. Default is 95% confidence. Note that `alpha` is symmetric around 0.5, i.e. both 0.1 and 0.9 are interpreted as "find the 90% confidence interval". Returns ------- medslope : float Theil slope. medintercept : float Intercept of the Theil line, as ``median(y) - medslope*median(x)``. lo_slope : float Lower bound of the confidence interval on `medslope`. up_slope : float Upper bound of the confidence interval on `medslope`. See also -------- siegelslopes : a similar technique with repeated medians Notes ----- For more details on `theilslopes`, see `stats.theilslopes`. """ y = ma.asarray(y).flatten() if x is None: x = ma.arange(len(y), dtype=float) else: x = ma.asarray(x).flatten() if len(x) != len(y): raise ValueError("Incompatible lengths ! (%s<>%s)" % (len(y),len(x))) m = ma.mask_or(ma.getmask(x), ma.getmask(y)) y._mask = x._mask = m # Disregard any masked elements of x or y y = y.compressed() x = x.compressed().astype(float) # We now have unmasked arrays so can use `stats.theilslopes` return stats_theilslopes(y, x, alpha=alpha) def siegelslopes(y, x=None, method="hierarchical"): r""" Computes the Siegel estimator for a set of points (x, y). `siegelslopes` implements a method for robust linear regression using repeated medians to fit a line to the points (x, y). The method is robust to outliers with an asymptotic breakdown point of 50%. Parameters ---------- y : array_like Dependent variable. x : array_like or None, optional Independent variable. If None, use ``arange(len(y))`` instead. method : {'hierarchical', 'separate'} If 'hierarchical', estimate the intercept using the estimated slope ``medslope`` (default option). If 'separate', estimate the intercept independent of the estimated slope. See Notes for details. Returns ------- medslope : float Estimate of the slope of the regression line. medintercept : float Estimate of the intercept of the regression line. See also -------- theilslopes : a similar technique without repeated medians Notes ----- For more details on `siegelslopes`, see `scipy.stats.siegelslopes`. """ y = ma.asarray(y).ravel() if x is None: x = ma.arange(len(y), dtype=float) else: x = ma.asarray(x).ravel() if len(x) != len(y): raise ValueError("Incompatible lengths ! (%s<>%s)" % (len(y), len(x))) m = ma.mask_or(ma.getmask(x), ma.getmask(y)) y._mask = x._mask = m # Disregard any masked elements of x or y y = y.compressed() x = x.compressed().astype(float) # We now have unmasked arrays so can use `stats.siegelslopes` return stats_siegelslopes(y, x) def sen_seasonal_slopes(x): x = ma.array(x, subok=True, copy=False, ndmin=2) (n,_) = x.shape # Get list of slopes per season szn_slopes = ma.vstack([(x[i+1:]-x[i])/np.arange(1,n-i)[:,None] for i in range(n)]) szn_medslopes = ma.median(szn_slopes, axis=0) medslope = ma.median(szn_slopes, axis=None) return szn_medslopes, medslope Ttest_1sampResult = namedtuple('Ttest_1sampResult', ('statistic', 'pvalue')) def ttest_1samp(a, popmean, axis=0): """ Calculates the T-test for the mean of ONE group of scores. Parameters ---------- a : array_like sample observation popmean : float or array_like expected value in null hypothesis, if array_like than it must have the same shape as `a` excluding the axis dimension axis : int or None, optional Axis along which to compute test. If None, compute over the whole array `a`. Returns ------- statistic : float or array t-statistic pvalue : float or array two-tailed p-value Notes ----- For more details on `ttest_1samp`, see `stats.ttest_1samp`. """ a, axis = _chk_asarray(a, axis) if a.size == 0: return (np.nan, np.nan) x = a.mean(axis=axis) v = a.var(axis=axis, ddof=1) n = a.count(axis=axis) # force df to be an array for masked division not to throw a warning df = ma.asanyarray(n - 1.0) svar = ((n - 1.0) * v) / df with np.errstate(divide='ignore', invalid='ignore'): t = (x - popmean) / ma.sqrt(svar / n) prob = special.betainc(0.5*df, 0.5, df/(df + t*t)) return Ttest_1sampResult(t, prob) ttest_onesamp = ttest_1samp Ttest_indResult = namedtuple('Ttest_indResult', ('statistic', 'pvalue')) def ttest_ind(a, b, axis=0, equal_var=True): """ Calculates the T-test for the means of TWO INDEPENDENT samples of scores. Parameters ---------- a, b : array_like The arrays must have the same shape, except in the dimension corresponding to `axis` (the first, by default). axis : int or None, optional Axis along which to compute test. If None, compute over the whole arrays, `a`, and `b`. equal_var : bool, optional If True, perform a standard independent 2 sample test that assumes equal population variances. If False, perform Welch's t-test, which does not assume equal population variance. .. versionadded:: 0.17.0 Returns ------- statistic : float or array The calculated t-statistic. pvalue : float or array The two-tailed p-value. Notes ----- For more details on `ttest_ind`, see `stats.ttest_ind`. """ a, b, axis = _chk2_asarray(a, b, axis) if a.size == 0 or b.size == 0: return Ttest_indResult(np.nan, np.nan) (x1, x2) = (a.mean(axis), b.mean(axis)) (v1, v2) = (a.var(axis=axis, ddof=1), b.var(axis=axis, ddof=1)) (n1, n2) = (a.count(axis), b.count(axis)) if equal_var: # force df to be an array for masked division not to throw a warning df = ma.asanyarray(n1 + n2 - 2.0) svar = ((n1-1)*v1+(n2-1)*v2) / df denom = ma.sqrt(svar*(1.0/n1 + 1.0/n2)) # n-D computation here! else: vn1 = v1/n1 vn2 = v2/n2 with np.errstate(divide='ignore', invalid='ignore'): df = (vn1 + vn2)**2 / (vn1**2 / (n1 - 1) + vn2**2 / (n2 - 1)) # If df is undefined, variances are zero. # It doesn't matter what df is as long as it is not NaN. df = np.where(np.isnan(df), 1, df) denom = ma.sqrt(vn1 + vn2) with np.errstate(divide='ignore', invalid='ignore'): t = (x1-x2) / denom probs = special.betainc(0.5*df, 0.5, df/(df + t*t)).reshape(t.shape) return Ttest_indResult(t, probs.squeeze()) Ttest_relResult = namedtuple('Ttest_relResult', ('statistic', 'pvalue')) def ttest_rel(a, b, axis=0): """ Calculates the T-test on TWO RELATED samples of scores, a and b. Parameters ---------- a, b : array_like The arrays must have the same shape. axis : int or None, optional Axis along which to compute test. If None, compute over the whole arrays, `a`, and `b`. Returns ------- statistic : float or array t-statistic pvalue : float or array two-tailed p-value Notes ----- For more details on `ttest_rel`, see `stats.ttest_rel`. """ a, b, axis = _chk2_asarray(a, b, axis) if len(a) != len(b): raise ValueError('unequal length arrays') if a.size == 0 or b.size == 0: return Ttest_relResult(np.nan, np.nan) n = a.count(axis) df = ma.asanyarray(n-1.0) d = (a-b).astype('d') dm = d.mean(axis) v = d.var(axis=axis, ddof=1) denom = ma.sqrt(v / n) with np.errstate(divide='ignore', invalid='ignore'): t = dm / denom probs = special.betainc(0.5*df, 0.5, df/(df + t*t)).reshape(t.shape).squeeze() return Ttest_relResult(t, probs) MannwhitneyuResult = namedtuple('MannwhitneyuResult', ('statistic', 'pvalue')) def mannwhitneyu(x,y, use_continuity=True): """ Computes the Mann-Whitney statistic Missing values in `x` and/or `y` are discarded. Parameters ---------- x : sequence Input y : sequence Input use_continuity : {True, False}, optional Whether a continuity correction (1/2.) should be taken into account. Returns ------- statistic : float The Mann-Whitney statistics pvalue : float Approximate p-value assuming a normal distribution. """ x = ma.asarray(x).compressed().view(ndarray) y = ma.asarray(y).compressed().view(ndarray) ranks = rankdata(np.concatenate([x,y])) (nx, ny) = (len(x), len(y)) nt = nx + ny U = ranks[:nx].sum() - nx*(nx+1)/2. U = max(U, nx*ny - U) u = nx*ny - U mu = (nx*ny)/2. sigsq = (nt**3 - nt)/12. ties = count_tied_groups(ranks) sigsq -= sum(v*(k**3-k) for (k,v) in ties.items())/12. sigsq *= nx*ny/float(nt*(nt-1)) if use_continuity: z = (U - 1/2. - mu) / ma.sqrt(sigsq) else: z = (U - mu) / ma.sqrt(sigsq) prob = special.erfc(abs(z)/np.sqrt(2)) return MannwhitneyuResult(u, prob) KruskalResult = namedtuple('KruskalResult', ('statistic', 'pvalue')) def kruskal(*args): """ Compute the Kruskal-Wallis H-test for independent samples Parameters ---------- sample1, sample2, ... : array_like Two or more arrays with the sample measurements can be given as arguments. Returns ------- statistic : float The Kruskal-Wallis H statistic, corrected for ties pvalue : float The p-value for the test using the assumption that H has a chi square distribution Notes ----- For more details on `kruskal`, see `stats.kruskal`. Examples -------- >>> from scipy.stats.mstats import kruskal Random samples from three different brands of batteries were tested to see how long the charge lasted. Results were as follows: >>> a = [6.3, 5.4, 5.7, 5.2, 5.0] >>> b = [6.9, 7.0, 6.1, 7.9] >>> c = [7.2, 6.9, 6.1, 6.5] Test the hypotesis that the distribution functions for all of the brands' durations are identical. Use 5% level of significance. >>> kruskal(a, b, c) KruskalResult(statistic=7.113812154696133, pvalue=0.028526948491942164) The null hypothesis is rejected at the 5% level of significance because the returned p-value is less than the critical value of 5%. """ output = argstoarray(*args) ranks = ma.masked_equal(rankdata(output, use_missing=False), 0) sumrk = ranks.sum(-1) ngrp = ranks.count(-1) ntot = ranks.count() H = 12./(ntot*(ntot+1)) * (sumrk**2/ngrp).sum() - 3*(ntot+1) # Tie correction ties = count_tied_groups(ranks) T = 1. - sum(v*(k**3-k) for (k,v) in ties.items())/float(ntot**3-ntot) if T == 0: raise ValueError('All numbers are identical in kruskal') H /= T df = len(output) - 1 prob = distributions.chi2.sf(H, df) return KruskalResult(H, prob) kruskalwallis = kruskal def ks_twosamp(data1, data2, alternative="two-sided"): """ Computes the Kolmogorov-Smirnov test on two samples. Missing values are discarded. Parameters ---------- data1 : array_like First data set data2 : array_like Second data set alternative : {'two-sided', 'less', 'greater'}, optional Indicates the alternative hypothesis. Default is 'two-sided'. Returns ------- d : float Value of the Kolmogorov Smirnov test p : float Corresponding p-value. """ (data1, data2) = (ma.asarray(data1), ma.asarray(data2)) (n1, n2) = (data1.count(), data2.count()) n = (n1*n2/float(n1+n2)) mix = ma.concatenate((data1.compressed(), data2.compressed())) mixsort = mix.argsort(kind='mergesort') csum = np.where(mixsort < n1, 1./n1, -1./n2).cumsum() # Check for ties if len(np.unique(mix)) < (n1+n2): csum = csum[np.r_[np.diff(mix[mixsort]).nonzero()[0],-1]] alternative = str(alternative).lower()[0] if alternative == 't': d = ma.abs(csum).max() prob = special.kolmogorov(np.sqrt(n)*d) elif alternative == 'l': d = -csum.min() prob = np.exp(-2*n*d**2) elif alternative == 'g': d = csum.max() prob = np.exp(-2*n*d**2) else: raise ValueError("Invalid value for the alternative hypothesis: " "should be in 'two-sided', 'less' or 'greater'") return (d, prob) ks_2samp = ks_twosamp def trima(a, limits=None, inclusive=(True,True)): """ Trims an array by masking the data outside some given limits. Returns a masked version of the input array. Parameters ---------- a : array_like Input array. limits : {None, tuple}, optional Tuple of (lower limit, upper limit) in absolute values. Values of the input array lower (greater) than the lower (upper) limit will be masked. A limit is None indicates an open interval. inclusive : (bool, bool) tuple, optional Tuple of (lower flag, upper flag), indicating whether values exactly equal to the lower (upper) limit are allowed. Examples -------- >>> from scipy.stats.mstats import trima >>> a = np.arange(10) The interval is left-closed and right-open, i.e., `[2, 8)`. Trim the array by keeping only values in the interval. >>> trima(a, limits=(2, 8), inclusive=(True, False)) masked_array(data=[--, --, 2, 3, 4, 5, 6, 7, --, --], mask=[ True, True, False, False, False, False, False, False, True, True], fill_value=999999) """ a = ma.asarray(a) a.unshare_mask() if (limits is None) or (limits == (None, None)): return a (lower_lim, upper_lim) = limits (lower_in, upper_in) = inclusive condition = False if lower_lim is not None: if lower_in: condition |= (a < lower_lim) else: condition |= (a <= lower_lim) if upper_lim is not None: if upper_in: condition |= (a > upper_lim) else: condition |= (a >= upper_lim) a[condition.filled(True)] = masked return a def trimr(a, limits=None, inclusive=(True, True), axis=None): """ Trims an array by masking some proportion of the data on each end. Returns a masked version of the input array. Parameters ---------- a : sequence Input array. limits : {None, tuple}, optional Tuple of the percentages to cut on each side of the array, with respect to the number of unmasked data, as floats between 0. and 1. Noting n the number of unmasked data before trimming, the (n*limits[0])th smallest data and the (n*limits[1])th largest data are masked, and the total number of unmasked data after trimming is n*(1.-sum(limits)). The value of one limit can be set to None to indicate an open interval. inclusive : {(True,True) tuple}, optional Tuple of flags indicating whether the number of data being masked on the left (right) end should be truncated (True) or rounded (False) to integers. axis : {None,int}, optional Axis along which to trim. If None, the whole array is trimmed, but its shape is maintained. """ def _trimr1D(a, low_limit, up_limit, low_inclusive, up_inclusive): n = a.count() idx = a.argsort() if low_limit: if low_inclusive: lowidx = int(low_limit*n) else: lowidx = int(np.round(low_limit*n)) a[idx[:lowidx]] = masked if up_limit is not None: if up_inclusive: upidx = n - int(n*up_limit) else: upidx = n - int(np.round(n*up_limit)) a[idx[upidx:]] = masked return a a = ma.asarray(a) a.unshare_mask() if limits is None: return a # Check the limits (lolim, uplim) = limits errmsg = "The proportion to cut from the %s should be between 0. and 1." if lolim is not None: if lolim > 1. or lolim < 0: raise ValueError(errmsg % 'beginning' + "(got %s)" % lolim) if uplim is not None: if uplim > 1. or uplim < 0: raise ValueError(errmsg % 'end' + "(got %s)" % uplim) (loinc, upinc) = inclusive if axis is None: shp = a.shape return _trimr1D(a.ravel(),lolim,uplim,loinc,upinc).reshape(shp) else: return ma.apply_along_axis(_trimr1D, axis, a, lolim,uplim,loinc,upinc) trimdoc = """ Parameters ---------- a : sequence Input array limits : {None, tuple}, optional If `relative` is False, tuple (lower limit, upper limit) in absolute values. Values of the input array lower (greater) than the lower (upper) limit are masked. If `relative` is True, tuple (lower percentage, upper percentage) to cut on each side of the array, with respect to the number of unmasked data. Noting n the number of unmasked data before trimming, the (n*limits[0])th smallest data and the (n*limits[1])th largest data are masked, and the total number of unmasked data after trimming is n*(1.-sum(limits)) In each case, the value of one limit can be set to None to indicate an open interval. If limits is None, no trimming is performed inclusive : {(bool, bool) tuple}, optional If `relative` is False, tuple indicating whether values exactly equal to the absolute limits are allowed. If `relative` is True, tuple indicating whether the number of data being masked on each side should be rounded (True) or truncated (False). relative : bool, optional Whether to consider the limits as absolute values (False) or proportions to cut (True). axis : int, optional Axis along which to trim. """ def trim(a, limits=None, inclusive=(True,True), relative=False, axis=None): """ Trims an array by masking the data outside some given limits. Returns a masked version of the input array. %s Examples -------- >>> from scipy.stats.mstats import trim >>> z = [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10] >>> print(trim(z,(3,8))) [-- -- 3 4 5 6 7 8 -- --] >>> print(trim(z,(0.1,0.2),relative=True)) [-- 2 3 4 5 6 7 8 -- --] """ if relative: return trimr(a, limits=limits, inclusive=inclusive, axis=axis) else: return trima(a, limits=limits, inclusive=inclusive) if trim.__doc__: trim.__doc__ = trim.__doc__ % trimdoc def trimboth(data, proportiontocut=0.2, inclusive=(True,True), axis=None): """ Trims the smallest and largest data values. Trims the `data` by masking the ``int(proportiontocut * n)`` smallest and ``int(proportiontocut * n)`` largest values of data along the given axis, where n is the number of unmasked values before trimming. Parameters ---------- data : ndarray Data to trim. proportiontocut : float, optional Percentage of trimming (as a float between 0 and 1). If n is the number of unmasked values before trimming, the number of values after trimming is ``(1 - 2*proportiontocut) * n``. Default is 0.2. inclusive : {(bool, bool) tuple}, optional Tuple indicating whether the number of data being masked on each side should be rounded (True) or truncated (False). axis : int, optional Axis along which to perform the trimming. If None, the input array is first flattened. """ return trimr(data, limits=(proportiontocut,proportiontocut), inclusive=inclusive, axis=axis) def trimtail(data, proportiontocut=0.2, tail='left', inclusive=(True,True), axis=None): """ Trims the data by masking values from one tail. Parameters ---------- data : array_like Data to trim. proportiontocut : float, optional Percentage of trimming. If n is the number of unmasked values before trimming, the number of values after trimming is ``(1 - proportiontocut) * n``. Default is 0.2. tail : {'left','right'}, optional If 'left' the `proportiontocut` lowest values will be masked. If 'right' the `proportiontocut` highest values will be masked. Default is 'left'. inclusive : {(bool, bool) tuple}, optional Tuple indicating whether the number of data being masked on each side should be rounded (True) or truncated (False). Default is (True, True). axis : int, optional Axis along which to perform the trimming. If None, the input array is first flattened. Default is None. Returns ------- trimtail : ndarray Returned array of same shape as `data` with masked tail values. """ tail = str(tail).lower()[0] if tail == 'l': limits = (proportiontocut,None) elif tail == 'r': limits = (None, proportiontocut) else: raise TypeError("The tail argument should be in ('left','right')") return trimr(data, limits=limits, axis=axis, inclusive=inclusive) trim1 = trimtail def trimmed_mean(a, limits=(0.1,0.1), inclusive=(1,1), relative=True, axis=None): """Returns the trimmed mean of the data along the given axis. %s """ if (not isinstance(limits,tuple)) and isinstance(limits,float): limits = (limits, limits) if relative: return trimr(a,limits=limits,inclusive=inclusive,axis=axis).mean(axis=axis) else: return trima(a,limits=limits,inclusive=inclusive).mean(axis=axis) if trimmed_mean.__doc__: trimmed_mean.__doc__ = trimmed_mean.__doc__ % trimdoc def trimmed_var(a, limits=(0.1,0.1), inclusive=(1,1), relative=True, axis=None, ddof=0): """Returns the trimmed variance of the data along the given axis. %s ddof : {0,integer}, optional Means Delta Degrees of Freedom. The denominator used during computations is (n-ddof). DDOF=0 corresponds to a biased estimate, DDOF=1 to an un- biased estimate of the variance. """ if (not isinstance(limits,tuple)) and isinstance(limits,float): limits = (limits, limits) if relative: out = trimr(a,limits=limits, inclusive=inclusive,axis=axis) else: out = trima(a,limits=limits,inclusive=inclusive) return out.var(axis=axis, ddof=ddof) if trimmed_var.__doc__: trimmed_var.__doc__ = trimmed_var.__doc__ % trimdoc def trimmed_std(a, limits=(0.1,0.1), inclusive=(1,1), relative=True, axis=None, ddof=0): """Returns the trimmed standard deviation of the data along the given axis. %s ddof : {0,integer}, optional Means Delta Degrees of Freedom. The denominator used during computations is (n-ddof). DDOF=0 corresponds to a biased estimate, DDOF=1 to an un- biased estimate of the variance. """ if (not isinstance(limits,tuple)) and isinstance(limits,float): limits = (limits, limits) if relative: out = trimr(a,limits=limits,inclusive=inclusive,axis=axis) else: out = trima(a,limits=limits,inclusive=inclusive) return out.std(axis=axis,ddof=ddof) if trimmed_std.__doc__: trimmed_std.__doc__ = trimmed_std.__doc__ % trimdoc def trimmed_stde(a, limits=(0.1,0.1), inclusive=(1,1), axis=None): """ Returns the standard error of the trimmed mean along the given axis. Parameters ---------- a : sequence Input array limits : {(0.1,0.1), tuple of float}, optional tuple (lower percentage, upper percentage) to cut on each side of the array, with respect to the number of unmasked data. If n is the number of unmasked data before trimming, the values smaller than ``n * limits[0]`` and the values larger than ``n * `limits[1]`` are masked, and the total number of unmasked data after trimming is ``n * (1.-sum(limits))``. In each case, the value of one limit can be set to None to indicate an open interval. If `limits` is None, no trimming is performed. inclusive : {(bool, bool) tuple} optional Tuple indicating whether the number of data being masked on each side should be rounded (True) or truncated (False). axis : int, optional Axis along which to trim. Returns ------- trimmed_stde : scalar or ndarray """ def _trimmed_stde_1D(a, low_limit, up_limit, low_inclusive, up_inclusive): "Returns the standard error of the trimmed mean for a 1D input data." n = a.count() idx = a.argsort() if low_limit: if low_inclusive: lowidx = int(low_limit*n) else: lowidx = np.round(low_limit*n) a[idx[:lowidx]] = masked if up_limit is not None: if up_inclusive: upidx = n - int(n*up_limit) else: upidx = n - np.round(n*up_limit) a[idx[upidx:]] = masked a[idx[:lowidx]] = a[idx[lowidx]] a[idx[upidx:]] = a[idx[upidx-1]] winstd = a.std(ddof=1) return winstd / ((1-low_limit-up_limit)*np.sqrt(len(a))) a = ma.array(a, copy=True, subok=True) a.unshare_mask() if limits is None: return a.std(axis=axis,ddof=1)/ma.sqrt(a.count(axis)) if (not isinstance(limits,tuple)) and isinstance(limits,float): limits = (limits, limits) # Check the limits (lolim, uplim) = limits errmsg = "The proportion to cut from the %s should be between 0. and 1." if lolim is not None: if lolim > 1. or lolim < 0: raise ValueError(errmsg % 'beginning' + "(got %s)" % lolim) if uplim is not None: if uplim > 1. or uplim < 0: raise ValueError(errmsg % 'end' + "(got %s)" % uplim) (loinc, upinc) = inclusive if (axis is None): return _trimmed_stde_1D(a.ravel(),lolim,uplim,loinc,upinc) else: if a.ndim > 2: raise ValueError("Array 'a' must be at most two dimensional, but got a.ndim = %d" % a.ndim) return ma.apply_along_axis(_trimmed_stde_1D, axis, a, lolim,uplim,loinc,upinc) def _mask_to_limits(a, limits, inclusive): """Mask an array for values outside of given limits. This is primarily a utility function. Parameters ---------- a : array limits : (float or None, float or None) A tuple consisting of the (lower limit, upper limit). Values in the input array less than the lower limit or greater than the upper limit will be masked out. None implies no limit. inclusive : (bool, bool) A tuple consisting of the (lower flag, upper flag). These flags determine whether values exactly equal to lower or upper are allowed. Returns ------- A MaskedArray. Raises ------ A ValueError if there are no values within the given limits. """ lower_limit, upper_limit = limits lower_include, upper_include = inclusive am = ma.MaskedArray(a) if lower_limit is not None: if lower_include: am = ma.masked_less(am, lower_limit) else: am = ma.masked_less_equal(am, lower_limit) if upper_limit is not None: if upper_include: am = ma.masked_greater(am, upper_limit) else: am = ma.masked_greater_equal(am, upper_limit) if am.count() == 0: raise ValueError("No array values within given limits") return am def tmean(a, limits=None, inclusive=(True, True), axis=None): """ Compute the trimmed mean. Parameters ---------- a : array_like Array of values. limits : None or (lower limit, upper limit), optional Values in the input array less than the lower limit or greater than the upper limit will be ignored. When limits is None (default), then all values are used. Either of the limit values in the tuple can also be None representing a half-open interval. inclusive : (bool, bool), optional A tuple consisting of the (lower flag, upper flag). These flags determine whether values exactly equal to the lower or upper limits are included. The default value is (True, True). axis : int or None, optional Axis along which to operate. If None, compute over the whole array. Default is None. Returns ------- tmean : float Notes ----- For more details on `tmean`, see `stats.tmean`. Examples -------- >>> from scipy.stats import mstats >>> a = np.array([[6, 8, 3, 0], ... [3, 9, 1, 2], ... [8, 7, 8, 2], ... [5, 6, 0, 2], ... [4, 5, 5, 2]]) ... ... >>> mstats.tmean(a, (2,5)) 3.3 >>> mstats.tmean(a, (2,5), axis=0) masked_array(data=[4.0, 5.0, 4.0, 2.0], mask=[False, False, False, False], fill_value=1e+20) """ return trima(a, limits=limits, inclusive=inclusive).mean(axis=axis) def tvar(a, limits=None, inclusive=(True, True), axis=0, ddof=1): """ Compute the trimmed variance This function computes the sample variance of an array of values, while ignoring values which are outside of given `limits`. Parameters ---------- a : array_like Array of values. limits : None or (lower limit, upper limit), optional Values in the input array less than the lower limit or greater than the upper limit will be ignored. When limits is None, then all values are used. Either of the limit values in the tuple can also be None representing a half-open interval. The default value is None. inclusive : (bool, bool), optional A tuple consisting of the (lower flag, upper flag). These flags determine whether values exactly equal to the lower or upper limits are included. The default value is (True, True). axis : int or None, optional Axis along which to operate. If None, compute over the whole array. Default is zero. ddof : int, optional Delta degrees of freedom. Default is 1. Returns ------- tvar : float Trimmed variance. Notes ----- For more details on `tvar`, see `stats.tvar`. """ a = a.astype(float).ravel() if limits is None: n = (~a.mask).sum() # todo: better way to do that? return np.ma.var(a) * n/(n-1.) am = _mask_to_limits(a, limits=limits, inclusive=inclusive) return np.ma.var(am, axis=axis, ddof=ddof) def tmin(a, lowerlimit=None, axis=0, inclusive=True): """ Compute the trimmed minimum Parameters ---------- a : array_like array of values lowerlimit : None or float, optional Values in the input array less than the given limit will be ignored. When lowerlimit is None, then all values are used. The default value is None. axis : int or None, optional Axis along which to operate. Default is 0. If None, compute over the whole array `a`. inclusive : {True, False}, optional This flag determines whether values exactly equal to the lower limit are included. The default value is True. Returns ------- tmin : float, int or ndarray Notes ----- For more details on `tmin`, see `stats.tmin`. Examples -------- >>> from scipy.stats import mstats >>> a = np.array([[6, 8, 3, 0], ... [3, 2, 1, 2], ... [8, 1, 8, 2], ... [5, 3, 0, 2], ... [4, 7, 5, 2]]) ... >>> mstats.tmin(a, 5) masked_array(data=[5, 7, 5, --], mask=[False, False, False, True], fill_value=999999) """ a, axis = _chk_asarray(a, axis) am = trima(a, (lowerlimit, None), (inclusive, False)) return ma.minimum.reduce(am, axis) def tmax(a, upperlimit=None, axis=0, inclusive=True): """ Compute the trimmed maximum This function computes the maximum value of an array along a given axis, while ignoring values larger than a specified upper limit. Parameters ---------- a : array_like array of values upperlimit : None or float, optional Values in the input array greater than the given limit will be ignored. When upperlimit is None, then all values are used. The default value is None. axis : int or None, optional Axis along which to operate. Default is 0. If None, compute over the whole array `a`. inclusive : {True, False}, optional This flag determines whether values exactly equal to the upper limit are included. The default value is True. Returns ------- tmax : float, int or ndarray Notes ----- For more details on `tmax`, see `stats.tmax`. Examples -------- >>> from scipy.stats import mstats >>> a = np.array([[6, 8, 3, 0], ... [3, 9, 1, 2], ... [8, 7, 8, 2], ... [5, 6, 0, 2], ... [4, 5, 5, 2]]) ... ... >>> mstats.tmax(a, 4) masked_array(data=[4, --, 3, 2], mask=[False, True, False, False], fill_value=999999) """ a, axis = _chk_asarray(a, axis) am = trima(a, (None, upperlimit), (False, inclusive)) return ma.maximum.reduce(am, axis) def tsem(a, limits=None, inclusive=(True, True), axis=0, ddof=1): """ Compute the trimmed standard error of the mean. This function finds the standard error of the mean for given values, ignoring values outside the given `limits`. Parameters ---------- a : array_like array of values limits : None or (lower limit, upper limit), optional Values in the input array less than the lower limit or greater than the upper limit will be ignored. When limits is None, then all values are used. Either of the limit values in the tuple can also be None representing a half-open interval. The default value is None. inclusive : (bool, bool), optional A tuple consisting of the (lower flag, upper flag). These flags determine whether values exactly equal to the lower or upper limits are included. The default value is (True, True). axis : int or None, optional Axis along which to operate. If None, compute over the whole array. Default is zero. ddof : int, optional Delta degrees of freedom. Default is 1. Returns ------- tsem : float Notes ----- For more details on `tsem`, see `stats.tsem`. """ a = ma.asarray(a).ravel() if limits is None: n = float(a.count()) return a.std(axis=axis, ddof=ddof)/ma.sqrt(n) am = trima(a.ravel(), limits, inclusive) sd = np.sqrt(am.var(axis=axis, ddof=ddof)) return sd / np.sqrt(am.count()) def winsorize(a, limits=None, inclusive=(True, True), inplace=False, axis=None, nan_policy='propagate'): """Returns a Winsorized version of the input array. The (limits[0])th lowest values are set to the (limits[0])th percentile, and the (limits[1])th highest values are set to the (1 - limits[1])th percentile. Masked values are skipped. Parameters ---------- a : sequence Input array. limits : {None, tuple of float}, optional Tuple of the percentages to cut on each side of the array, with respect to the number of unmasked data, as floats between 0. and 1. Noting n the number of unmasked data before trimming, the (n*limits[0])th smallest data and the (n*limits[1])th largest data are masked, and the total number of unmasked data after trimming is n*(1.-sum(limits)) The value of one limit can be set to None to indicate an open interval. inclusive : {(True, True) tuple}, optional Tuple indicating whether the number of data being masked on each side should be truncated (True) or rounded (False). inplace : {False, True}, optional Whether to winsorize in place (True) or to use a copy (False) axis : {None, int}, optional Axis along which to trim. If None, the whole array is trimmed, but its shape is maintained. nan_policy : {'propagate', 'raise', 'omit'}, optional Defines how to handle when input contains nan. The following options are available (default is 'propagate'): * 'propagate': allows nan values and may overwrite or propagate them * 'raise': throws an error * 'omit': performs the calculations ignoring nan values Notes ----- This function is applied to reduce the effect of possibly spurious outliers by limiting the extreme values. Examples -------- >>> from scipy.stats.mstats import winsorize A shuffled array contains integers from 1 to 10. >>> a = np.array([10, 4, 9, 8, 5, 3, 7, 2, 1, 6]) The 10% of the lowest value (i.e., `1`) and the 20% of the highest values (i.e., `9` and `10`) are replaced. >>> winsorize(a, limits=[0.1, 0.2]) masked_array(data=[8, 4, 8, 8, 5, 3, 7, 2, 2, 6], mask=False, fill_value=999999) """ def _winsorize1D(a, low_limit, up_limit, low_include, up_include, contains_nan, nan_policy): n = a.count() idx = a.argsort() if contains_nan: nan_count = np.count_nonzero(np.isnan(a)) if low_limit: if low_include: lowidx = int(low_limit * n) else: lowidx = np.round(low_limit * n).astype(int) if contains_nan and nan_policy == 'omit': lowidx = min(lowidx, n-nan_count-1) a[idx[:lowidx]] = a[idx[lowidx]] if up_limit is not None: if up_include: upidx = n - int(n * up_limit) else: upidx = n - np.round(n * up_limit).astype(int) if contains_nan and nan_policy == 'omit': a[idx[upidx:-nan_count]] = a[idx[upidx - 1]] else: a[idx[upidx:]] = a[idx[upidx - 1]] return a contains_nan, nan_policy = _contains_nan(a, nan_policy) # We are going to modify a: better make a copy a = ma.array(a, copy=np.logical_not(inplace)) if limits is None: return a if (not isinstance(limits, tuple)) and isinstance(limits, float): limits = (limits, limits) # Check the limits (lolim, uplim) = limits errmsg = "The proportion to cut from the %s should be between 0. and 1." if lolim is not None: if lolim > 1. or lolim < 0: raise ValueError(errmsg % 'beginning' + "(got %s)" % lolim) if uplim is not None: if uplim > 1. or uplim < 0: raise ValueError(errmsg % 'end' + "(got %s)" % uplim) (loinc, upinc) = inclusive if axis is None: shp = a.shape return _winsorize1D(a.ravel(), lolim, uplim, loinc, upinc, contains_nan, nan_policy).reshape(shp) else: return ma.apply_along_axis(_winsorize1D, axis, a, lolim, uplim, loinc, upinc, contains_nan, nan_policy) def moment(a, moment=1, axis=0): """ Calculates the nth moment about the mean for a sample. Parameters ---------- a : array_like data moment : int, optional order of central moment that is returned axis : int or None, optional Axis along which the central moment is computed. Default is 0. If None, compute over the whole array `a`. Returns ------- n-th central moment : ndarray or float The appropriate moment along the given axis or over all values if axis is None. The denominator for the moment calculation is the number of observations, no degrees of freedom correction is done. Notes ----- For more details about `moment`, see `stats.moment`. """ a, axis = _chk_asarray(a, axis) if moment == 1: # By definition the first moment about the mean is 0. shape = list(a.shape) del shape[axis] if shape: # return an actual array of the appropriate shape return np.zeros(shape, dtype=float) else: # the input was 1D, so return a scalar instead of a rank-0 array return np.float64(0.0) else: # Exponentiation by squares: form exponent sequence n_list = [moment] current_n = moment while current_n > 2: if current_n % 2: current_n = (current_n-1)/2 else: current_n /= 2 n_list.append(current_n) # Starting point for exponentiation by squares a_zero_mean = a - ma.expand_dims(a.mean(axis), axis) if n_list[-1] == 1: s = a_zero_mean.copy() else: s = a_zero_mean**2 # Perform multiplications for n in n_list[-2::-1]: s = s**2 if n % 2: s *= a_zero_mean return s.mean(axis) def variation(a, axis=0): """ Computes the coefficient of variation, the ratio of the biased standard deviation to the mean. Parameters ---------- a : array_like Input array. axis : int or None, optional Axis along which to calculate the coefficient of variation. Default is 0. If None, compute over the whole array `a`. Returns ------- variation : ndarray The calculated variation along the requested axis. Notes ----- For more details about `variation`, see `stats.variation`. Examples -------- >>> from scipy.stats.mstats import variation >>> a = np.array([2,8,4]) >>> variation(a) 0.5345224838248487 >>> b = np.array([2,8,3,4]) >>> c = np.ma.masked_array(b, mask=[0,0,1,0]) >>> variation(c) 0.5345224838248487 In the example above, it can be seen that this works the same as `stats.variation` except 'stats.mstats.variation' ignores masked array elements. """ a, axis = _chk_asarray(a, axis) return a.std(axis)/a.mean(axis) def skew(a, axis=0, bias=True): """ Computes the skewness of a data set. Parameters ---------- a : ndarray data axis : int or None, optional Axis along which skewness is calculated. Default is 0. If None, compute over the whole array `a`. bias : bool, optional If False, then the calculations are corrected for statistical bias. Returns ------- skewness : ndarray The skewness of values along an axis, returning 0 where all values are equal. Notes ----- For more details about `skew`, see `stats.skew`. """ a, axis = _chk_asarray(a,axis) n = a.count(axis) m2 = moment(a, 2, axis) m3 = moment(a, 3, axis) olderr = np.seterr(all='ignore') try: vals = ma.where(m2 == 0, 0, m3 / m2**1.5) finally: np.seterr(**olderr) if not bias: can_correct = (n > 2) & (m2 > 0) if can_correct.any(): m2 = np.extract(can_correct, m2) m3 = np.extract(can_correct, m3) nval = ma.sqrt((n-1.0)*n)/(n-2.0)*m3/m2**1.5 np.place(vals, can_correct, nval) return vals def kurtosis(a, axis=0, fisher=True, bias=True): """ Computes the kurtosis (Fisher or Pearson) of a dataset. Kurtosis is the fourth central moment divided by the square of the variance. If Fisher's definition is used, then 3.0 is subtracted from the result to give 0.0 for a normal distribution. If bias is False then the kurtosis is calculated using k statistics to eliminate bias coming from biased moment estimators Use `kurtosistest` to see if result is close enough to normal. Parameters ---------- a : array data for which the kurtosis is calculated axis : int or None, optional Axis along which the kurtosis is calculated. Default is 0. If None, compute over the whole array `a`. fisher : bool, optional If True, Fisher's definition is used (normal ==> 0.0). If False, Pearson's definition is used (normal ==> 3.0). bias : bool, optional If False, then the calculations are corrected for statistical bias. Returns ------- kurtosis : array The kurtosis of values along an axis. If all values are equal, return -3 for Fisher's definition and 0 for Pearson's definition. Notes ----- For more details about `kurtosis`, see `stats.kurtosis`. """ a, axis = _chk_asarray(a, axis) m2 = moment(a, 2, axis) m4 = moment(a, 4, axis) olderr = np.seterr(all='ignore') try: vals = ma.where(m2 == 0, 0, m4 / m2**2.0) finally: np.seterr(**olderr) if not bias: n = a.count(axis) can_correct = (n > 3) & (m2 is not ma.masked and m2 > 0) if can_correct.any(): n = np.extract(can_correct, n) m2 = np.extract(can_correct, m2) m4 = np.extract(can_correct, m4) nval = 1.0/(n-2)/(n-3)*((n*n-1.0)*m4/m2**2.0-3*(n-1)**2.0) np.place(vals, can_correct, nval+3.0) if fisher: return vals - 3 else: return vals DescribeResult = namedtuple('DescribeResult', ('nobs', 'minmax', 'mean', 'variance', 'skewness', 'kurtosis')) def describe(a, axis=0, ddof=0, bias=True): """ Computes several descriptive statistics of the passed array. Parameters ---------- a : array_like Data array axis : int or None, optional Axis along which to calculate statistics. Default 0. If None, compute over the whole array `a`. ddof : int, optional degree of freedom (default 0); note that default ddof is different from the same routine in stats.describe bias : bool, optional If False, then the skewness and kurtosis calculations are corrected for statistical bias. Returns ------- nobs : int (size of the data (discarding missing values) minmax : (int, int) min, max mean : float arithmetic mean variance : float unbiased variance skewness : float biased skewness kurtosis : float biased kurtosis Examples -------- >>> from scipy.stats.mstats import describe >>> ma = np.ma.array(range(6), mask=[0, 0, 0, 1, 1, 1]) >>> describe(ma) DescribeResult(nobs=3, minmax=(masked_array(data=0, mask=False, fill_value=999999), masked_array(data=2, mask=False, fill_value=999999)), mean=1.0, variance=0.6666666666666666, skewness=masked_array(data=0., mask=False, fill_value=1e+20), kurtosis=-1.5) """ a, axis = _chk_asarray(a, axis) n = a.count(axis) mm = (ma.minimum.reduce(a), ma.maximum.reduce(a)) m = a.mean(axis) v = a.var(axis, ddof=ddof) sk = skew(a, axis, bias=bias) kurt = kurtosis(a, axis, bias=bias) return DescribeResult(n, mm, m, v, sk, kurt) def stde_median(data, axis=None): """Returns the McKean-Schrader estimate of the standard error of the sample median along the given axis. masked values are discarded. Parameters ---------- data : ndarray Data to trim. axis : {None,int}, optional Axis along which to perform the trimming. If None, the input array is first flattened. """ def _stdemed_1D(data): data = np.sort(data.compressed()) n = len(data) z = 2.5758293035489004 k = int(np.round((n+1)/2. - z * np.sqrt(n/4.),0)) return ((data[n-k] - data[k-1])/(2.*z)) data = ma.array(data, copy=False, subok=True) if (axis is None): return _stdemed_1D(data) else: if data.ndim > 2: raise ValueError("Array 'data' must be at most two dimensional, " "but got data.ndim = %d" % data.ndim) return ma.apply_along_axis(_stdemed_1D, axis, data) SkewtestResult = namedtuple('SkewtestResult', ('statistic', 'pvalue')) def skewtest(a, axis=0): """ Tests whether the skew is different from the normal distribution. Parameters ---------- a : array The data to be tested axis : int or None, optional Axis along which statistics are calculated. Default is 0. If None, compute over the whole array `a`. Returns ------- statistic : float The computed z-score for this test. pvalue : float a 2-sided p-value for the hypothesis test Notes ----- For more details about `skewtest`, see `stats.skewtest`. """ a, axis = _chk_asarray(a, axis) if axis is None: a = a.ravel() axis = 0 b2 = skew(a,axis) n = a.count(axis) if np.min(n) < 8: raise ValueError( "skewtest is not valid with less than 8 samples; %i samples" " were given." % np.min(n)) y = b2 * ma.sqrt(((n+1)*(n+3)) / (6.0*(n-2))) beta2 = (3.0*(n*n+27*n-70)*(n+1)*(n+3)) / ((n-2.0)*(n+5)*(n+7)*(n+9)) W2 = -1 + ma.sqrt(2*(beta2-1)) delta = 1/ma.sqrt(0.5*ma.log(W2)) alpha = ma.sqrt(2.0/(W2-1)) y = ma.where(y == 0, 1, y) Z = delta*ma.log(y/alpha + ma.sqrt((y/alpha)**2+1)) return SkewtestResult(Z, 2 * distributions.norm.sf(np.abs(Z))) KurtosistestResult = namedtuple('KurtosistestResult', ('statistic', 'pvalue')) def kurtosistest(a, axis=0): """ Tests whether a dataset has normal kurtosis Parameters ---------- a : array array of the sample data axis : int or None, optional Axis along which to compute test. Default is 0. If None, compute over the whole array `a`. Returns ------- statistic : float The computed z-score for this test. pvalue : float The 2-sided p-value for the hypothesis test Notes ----- For more details about `kurtosistest`, see `stats.kurtosistest`. """ a, axis = _chk_asarray(a, axis) n = a.count(axis=axis) if np.min(n) < 5: raise ValueError( "kurtosistest requires at least 5 observations; %i observations" " were given." % np.min(n)) if np.min(n) < 20: warnings.warn( "kurtosistest only valid for n>=20 ... continuing anyway, n=%i" % np.min(n)) b2 = kurtosis(a, axis, fisher=False) E = 3.0*(n-1) / (n+1) varb2 = 24.0*n*(n-2.)*(n-3) / ((n+1)*(n+1.)*(n+3)*(n+5)) x = (b2-E)/ma.sqrt(varb2) sqrtbeta1 = 6.0*(n*n-5*n+2)/((n+7)*(n+9)) * np.sqrt((6.0*(n+3)*(n+5)) / (n*(n-2)*(n-3))) A = 6.0 + 8.0/sqrtbeta1 * (2.0/sqrtbeta1 + np.sqrt(1+4.0/(sqrtbeta1**2))) term1 = 1 - 2./(9.0*A) denom = 1 + x*ma.sqrt(2/(A-4.0)) if np.ma.isMaskedArray(denom): # For multi-dimensional array input denom[denom == 0.0] = masked elif denom == 0.0: denom = masked term2 = np.ma.where(denom > 0, ma.power((1-2.0/A)/denom, 1/3.0), -ma.power(-(1-2.0/A)/denom, 1/3.0)) Z = (term1 - term2) / np.sqrt(2/(9.0*A)) return KurtosistestResult(Z, 2 * distributions.norm.sf(np.abs(Z))) NormaltestResult = namedtuple('NormaltestResult', ('statistic', 'pvalue')) def normaltest(a, axis=0): """ Tests whether a sample differs from a normal distribution. Parameters ---------- a : array_like The array containing the data to be tested. axis : int or None, optional Axis along which to compute test. Default is 0. If None, compute over the whole array `a`. Returns ------- statistic : float or array ``s^2 + k^2``, where ``s`` is the z-score returned by `skewtest` and ``k`` is the z-score returned by `kurtosistest`. pvalue : float or array A 2-sided chi squared probability for the hypothesis test. Notes ----- For more details about `normaltest`, see `stats.normaltest`. """ a, axis = _chk_asarray(a, axis) s, _ = skewtest(a, axis) k, _ = kurtosistest(a, axis) k2 = s*s + k*k return NormaltestResult(k2, distributions.chi2.sf(k2, 2)) def mquantiles(a, prob=list([.25,.5,.75]), alphap=.4, betap=.4, axis=None, limit=()): """ Computes empirical quantiles for a data array. Samples quantile are defined by ``Q(p) = (1-gamma)*x[j] + gamma*x[j+1]``, where ``x[j]`` is the j-th order statistic, and gamma is a function of ``j = floor(n*p + m)``, ``m = alphap + p*(1 - alphap - betap)`` and ``g = n*p + m - j``. Reinterpreting the above equations to compare to **R** lead to the equation: ``p(k) = (k - alphap)/(n + 1 - alphap - betap)`` Typical values of (alphap,betap) are: - (0,1) : ``p(k) = k/n`` : linear interpolation of cdf (**R** type 4) - (.5,.5) : ``p(k) = (k - 1/2.)/n`` : piecewise linear function (**R** type 5) - (0,0) : ``p(k) = k/(n+1)`` : (**R** type 6) - (1,1) : ``p(k) = (k-1)/(n-1)``: p(k) = mode[F(x[k])]. (**R** type 7, **R** default) - (1/3,1/3): ``p(k) = (k-1/3)/(n+1/3)``: Then p(k) ~ median[F(x[k])]. The resulting quantile estimates are approximately median-unbiased regardless of the distribution of x. (**R** type 8) - (3/8,3/8): ``p(k) = (k-3/8)/(n+1/4)``: Blom. The resulting quantile estimates are approximately unbiased if x is normally distributed (**R** type 9) - (.4,.4) : approximately quantile unbiased (Cunnane) - (.35,.35): APL, used with PWM Parameters ---------- a : array_like Input data, as a sequence or array of dimension at most 2. prob : array_like, optional List of quantiles to compute. alphap : float, optional Plotting positions parameter, default is 0.4. betap : float, optional Plotting positions parameter, default is 0.4. axis : int, optional Axis along which to perform the trimming. If None (default), the input array is first flattened. limit : tuple, optional Tuple of (lower, upper) values. Values of `a` outside this open interval are ignored. Returns ------- mquantiles : MaskedArray An array containing the calculated quantiles. Notes ----- This formulation is very similar to **R** except the calculation of ``m`` from ``alphap`` and ``betap``, where in **R** ``m`` is defined with each type. References ---------- .. [1] *R* statistical software: https://www.r-project.org/ .. [2] *R* ``quantile`` function: http://stat.ethz.ch/R-manual/R-devel/library/stats/html/quantile.html Examples -------- >>> from scipy.stats.mstats import mquantiles >>> a = np.array([6., 47., 49., 15., 42., 41., 7., 39., 43., 40., 36.]) >>> mquantiles(a) array([ 19.2, 40. , 42.8]) Using a 2D array, specifying axis and limit. >>> data = np.array([[ 6., 7., 1.], ... [ 47., 15., 2.], ... [ 49., 36., 3.], ... [ 15., 39., 4.], ... [ 42., 40., -999.], ... [ 41., 41., -999.], ... [ 7., -999., -999.], ... [ 39., -999., -999.], ... [ 43., -999., -999.], ... [ 40., -999., -999.], ... [ 36., -999., -999.]]) >>> print(mquantiles(data, axis=0, limit=(0, 50))) [[19.2 14.6 1.45] [40. 37.5 2.5 ] [42.8 40.05 3.55]] >>> data[:, 2] = -999. >>> print(mquantiles(data, axis=0, limit=(0, 50))) [[19.200000000000003 14.6 --] [40.0 37.5 --] [42.800000000000004 40.05 --]] """ def _quantiles1D(data,m,p): x = np.sort(data.compressed()) n = len(x) if n == 0: return ma.array(np.empty(len(p), dtype=float), mask=True) elif n == 1: return ma.array(np.resize(x, p.shape), mask=nomask) aleph = (n*p + m) k = np.floor(aleph.clip(1, n-1)).astype(int) gamma = (aleph-k).clip(0,1) return (1.-gamma)*x[(k-1).tolist()] + gamma*x[k.tolist()] data = ma.array(a, copy=False) if data.ndim > 2: raise TypeError("Array should be 2D at most !") if limit: condition = (limit[0] < data) & (data < limit[1]) data[~condition.filled(True)] = masked p = np.array(prob, copy=False, ndmin=1) m = alphap + p*(1.-alphap-betap) # Computes quantiles along axis (or globally) if (axis is None): return _quantiles1D(data, m, p) return ma.apply_along_axis(_quantiles1D, axis, data, m, p) def scoreatpercentile(data, per, limit=(), alphap=.4, betap=.4): """Calculate the score at the given 'per' percentile of the sequence a. For example, the score at per=50 is the median. This function is a shortcut to mquantile """ if (per < 0) or (per > 100.): raise ValueError("The percentile should be between 0. and 100. !" " (got %s)" % per) return mquantiles(data, prob=[per/100.], alphap=alphap, betap=betap, limit=limit, axis=0).squeeze() def plotting_positions(data, alpha=0.4, beta=0.4): """ Returns plotting positions (or empirical percentile points) for the data. Plotting positions are defined as ``(i-alpha)/(n+1-alpha-beta)``, where: - i is the rank order statistics - n is the number of unmasked values along the given axis - `alpha` and `beta` are two parameters. Typical values for `alpha` and `beta` are: - (0,1) : ``p(k) = k/n``, linear interpolation of cdf (R, type 4) - (.5,.5) : ``p(k) = (k-1/2.)/n``, piecewise linear function (R, type 5) - (0,0) : ``p(k) = k/(n+1)``, Weibull (R type 6) - (1,1) : ``p(k) = (k-1)/(n-1)``, in this case, ``p(k) = mode[F(x[k])]``. That's R default (R type 7) - (1/3,1/3): ``p(k) = (k-1/3)/(n+1/3)``, then ``p(k) ~ median[F(x[k])]``. The resulting quantile estimates are approximately median-unbiased regardless of the distribution of x. (R type 8) - (3/8,3/8): ``p(k) = (k-3/8)/(n+1/4)``, Blom. The resulting quantile estimates are approximately unbiased if x is normally distributed (R type 9) - (.4,.4) : approximately quantile unbiased (Cunnane) - (.35,.35): APL, used with PWM - (.3175, .3175): used in scipy.stats.probplot Parameters ---------- data : array_like Input data, as a sequence or array of dimension at most 2. alpha : float, optional Plotting positions parameter. Default is 0.4. beta : float, optional Plotting positions parameter. Default is 0.4. Returns ------- positions : MaskedArray The calculated plotting positions. """ data = ma.array(data, copy=False).reshape(1,-1) n = data.count() plpos = np.empty(data.size, dtype=float) plpos[n:] = 0 plpos[data.argsort(axis=None)[:n]] = ((np.arange(1, n+1) - alpha) / (n + 1.0 - alpha - beta)) return ma.array(plpos, mask=data._mask) meppf = plotting_positions def obrientransform(*args): """ Computes a transform on input data (any number of columns). Used to test for homogeneity of variance prior to running one-way stats. Each array in ``*args`` is one level of a factor. If an `f_oneway()` run on the transformed data and found significant, variances are unequal. From Maxwell and Delaney, p.112. Returns: transformed data for use in an ANOVA """ data = argstoarray(*args).T v = data.var(axis=0,ddof=1) m = data.mean(0) n = data.count(0).astype(float) # result = ((N-1.5)*N*(a-m)**2 - 0.5*v*(n-1))/((n-1)*(n-2)) data -= m data **= 2 data *= (n-1.5)*n data -= 0.5*v*(n-1) data /= (n-1.)*(n-2.) if not ma.allclose(v,data.mean(0)): raise ValueError("Lack of convergence in obrientransform.") return data def sem(a, axis=0, ddof=1): """ Calculates the standard error of the mean of the input array. Also sometimes called standard error of measurement. Parameters ---------- a : array_like An array containing the values for which the standard error is returned. axis : int or None, optional If axis is None, ravel `a` first. If axis is an integer, this will be the axis over which to operate. Defaults to 0. ddof : int, optional Delta degrees-of-freedom. How many degrees of freedom to adjust for bias in limited samples relative to the population estimate of variance. Defaults to 1. Returns ------- s : ndarray or float The standard error of the mean in the sample(s), along the input axis. Notes ----- The default value for `ddof` changed in scipy 0.15.0 to be consistent with `stats.sem` as well as with the most common definition used (like in the R documentation). Examples -------- Find standard error along the first axis: >>> from scipy import stats >>> a = np.arange(20).reshape(5,4) >>> print(stats.mstats.sem(a)) [2.8284271247461903 2.8284271247461903 2.8284271247461903 2.8284271247461903] Find standard error across the whole array, using n degrees of freedom: >>> print(stats.mstats.sem(a, axis=None, ddof=0)) 1.2893796958227628 """ a, axis = _chk_asarray(a, axis) n = a.count(axis=axis) s = a.std(axis=axis, ddof=ddof) / ma.sqrt(n) return s F_onewayResult = namedtuple('F_onewayResult', ('statistic', 'pvalue')) def f_oneway(*args): """ Performs a 1-way ANOVA, returning an F-value and probability given any number of groups. From Heiman, pp.394-7. Usage: ``f_oneway(*args)``, where ``*args`` is 2 or more arrays, one per treatment group. Returns ------- statistic : float The computed F-value of the test. pvalue : float The associated p-value from the F-distribution. """ # Construct a single array of arguments: each row is a group data = argstoarray(*args) ngroups = len(data) ntot = data.count() sstot = (data**2).sum() - (data.sum())**2/float(ntot) ssbg = (data.count(-1) * (data.mean(-1)-data.mean())**2).sum() sswg = sstot-ssbg dfbg = ngroups-1 dfwg = ntot - ngroups msb = ssbg/float(dfbg) msw = sswg/float(dfwg) f = msb/msw prob = special.fdtrc(dfbg, dfwg, f) # equivalent to stats.f.sf return F_onewayResult(f, prob) FriedmanchisquareResult = namedtuple('FriedmanchisquareResult', ('statistic', 'pvalue')) def friedmanchisquare(*args): """Friedman Chi-Square is a non-parametric, one-way within-subjects ANOVA. This function calculates the Friedman Chi-square test for repeated measures and returns the result, along with the associated probability value. Each input is considered a given group. Ideally, the number of treatments among each group should be equal. If this is not the case, only the first n treatments are taken into account, where n is the number of treatments of the smallest group. If a group has some missing values, the corresponding treatments are masked in the other groups. The test statistic is corrected for ties. Masked values in one group are propagated to the other groups. Returns ------- statistic : float the test statistic. pvalue : float the associated p-value. """ data = argstoarray(*args).astype(float) k = len(data) if k < 3: raise ValueError("Less than 3 groups (%i): " % k + "the Friedman test is NOT appropriate.") ranked = ma.masked_values(rankdata(data, axis=0), 0) if ranked._mask is not nomask: ranked = ma.mask_cols(ranked) ranked = ranked.compressed().reshape(k,-1).view(ndarray) else: ranked = ranked._data (k,n) = ranked.shape # Ties correction repeats = [find_repeats(row) for row in ranked.T] ties = np.array([y for x, y in repeats if x.size > 0]) tie_correction = 1 - (ties**3-ties).sum()/float(n*(k**3-k)) ssbg = np.sum((ranked.sum(-1) - n*(k+1)/2.)**2) chisq = ssbg * 12./(n*k*(k+1)) * 1./tie_correction return FriedmanchisquareResult(chisq, distributions.chi2.sf(chisq, k-1)) BrunnerMunzelResult = namedtuple('BrunnerMunzelResult', ('statistic', 'pvalue')) def brunnermunzel(x, y, alternative="two-sided", distribution="t"): """ Computes the Brunner-Munzel test on samples x and y Missing values in `x` and/or `y` are discarded. Parameters ---------- x, y : array_like Array of samples, should be one-dimensional. alternative : 'less', 'two-sided', or 'greater', optional Whether to get the p-value for the one-sided hypothesis ('less' or 'greater') or for the two-sided hypothesis ('two-sided'). Defaults value is 'two-sided' . distribution: 't' or 'normal', optional Whether to get the p-value by t-distribution or by standard normal distribution. Defaults value is 't' . Returns ------- statistic : float The Brunner-Munzer W statistic. pvalue : float p-value assuming an t distribution. One-sided or two-sided, depending on the choice of `alternative` and `distribution`. See Also -------- mannwhitneyu : Mann-Whitney rank test on two samples. Notes ------- For more details on `brunnermunzel`, see `stats.brunnermunzel`. """ x = ma.asarray(x).compressed().view(ndarray) y = ma.asarray(y).compressed().view(ndarray) nx = len(x) ny = len(y) if nx == 0 or ny == 0: return BrunnerMunzelResult(np.nan, np.nan) rankc = rankdata(np.concatenate((x,y))) rankcx = rankc[0:nx] rankcy = rankc[nx:nx+ny] rankcx_mean = np.mean(rankcx) rankcy_mean = np.mean(rankcy) rankx = rankdata(x) ranky = rankdata(y) rankx_mean = np.mean(rankx) ranky_mean = np.mean(ranky) Sx = np.sum(np.power(rankcx - rankx - rankcx_mean + rankx_mean, 2.0)) Sx /= nx - 1 Sy = np.sum(np.power(rankcy - ranky - rankcy_mean + ranky_mean, 2.0)) Sy /= ny - 1 wbfn = nx * ny * (rankcy_mean - rankcx_mean) wbfn /= (nx + ny) * np.sqrt(nx * Sx + ny * Sy) if distribution == "t": df_numer = np.power(nx * Sx + ny * Sy, 2.0) df_denom = np.power(nx * Sx, 2.0) / (nx - 1) df_denom += np.power(ny * Sy, 2.0) / (ny - 1) df = df_numer / df_denom p = distributions.t.cdf(wbfn, df) elif distribution == "normal": p = distributions.norm.cdf(wbfn) else: raise ValueError( "distribution should be 't' or 'normal'") if alternative == "greater": pass elif alternative == "less": p = 1 - p elif alternative == "two-sided": p = 2 * np.min([p, 1-p]) else: raise ValueError( "alternative should be 'less', 'greater' or 'two-sided'") return BrunnerMunzelResult(wbfn, p)
{ "content_hash": "ef81b9031c0c864b0cdbf9e15012f3ab", "timestamp": "", "source": "github", "line_count": 3021, "max_line_length": 119, "avg_line_length": 32, "alnum_prop": 0.5779025984773254, "repo_name": "person142/scipy", "id": "e2f502590eda5d6b6c6199a68d41f1681d5d296d", "size": "96672", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "scipy/stats/mstats_basic.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "4399737" }, { "name": "C++", "bytes": "654192" }, { "name": "Dockerfile", "bytes": "1291" }, { "name": "Fortran", "bytes": "5368529" }, { "name": "MATLAB", "bytes": "4346" }, { "name": "Makefile", "bytes": "778" }, { "name": "Python", "bytes": "12769355" }, { "name": "Shell", "bytes": "538" }, { "name": "TeX", "bytes": "52106" } ], "symlink_target": "" }
def main(): from datetime import date thisyear = date.today().year print("Please provide your name and age you have turned in " + str(thisyear) + ".\n") name = input("name: ") age = input("age: ") print("Please enter another number. \n") secondnumber = input("number: ") year100 = thisyear + (100 - int(age)) i = 0 while i < int(secondnumber): if int(age) >= 100: print("Congrats, you are already 100 or older.\n") i = i + 1 else: print("Hello " + name + ", you will be 100 years old in: " + str(year100) + "\n") i = i + 1 if __name__ == '__main__': main()
{ "content_hash": "0759ee87c99e7471560b04eaa091b5ef", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 93, "avg_line_length": 25.846153846153847, "alnum_prop": 0.5238095238095238, "repo_name": "dmshelton/dmshelton", "id": "3c9a44fb673a883261fd63531136e0246f8fe39f", "size": "903", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "learningPython/practicePython-ex1.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Python", "bytes": "4773" } ], "symlink_target": "" }
import requests import json # Steps for Jokes Delivery # 1. Retrieve page access token from https://developers.facebook.com/tools/explorer/666615676843865?method=GET&path=667782319960906%2Fconversations%20&version=v2.9 # 2. Read all the conversations # 3. Register all conversations in database, # 4. If Jokes not delivered, deliver joke # Read all conversations # payload = { # "access_token":"EAAJeSI6et1kBAG0PhzkRHIh1Wk5VZBQbhWj2tFIatrzqnvPdXct1yYWfkgLOu66a9oerFcaZCrxqtbE5wLYKZCZBF5NbjKfkc3BfCvGSLnZCZAG1HiZCJzjhYR2UbwhlEm2KcxgHxbk2ZCNiagRoXOjTVv3TUvTr4CoZD" # } # response = requests.get( # "https://graph.facebook.com/v2.9/667782319960906/conversations?access_token=EAAJeSI6et1kBAG0PhzkRHIh1Wk5VZBQbhWj2tFIatrzqnvPdXct1yYWfkgLOu66a9oerFcaZCrxqtbE5wLYKZCZBF5NbjKfkc3BfCvGSLnZCZAG1HiZCJzjhYR2UbwhlEm2KcxgHxbk2ZCNiagRoXOjTVv3TUvTr4CoZD", # ) # print(response.json()) # Get Conversation ID, Send Message payload = { "message": "Hello Suman! Thank you for contating us. Please call 9840063224 for coupon delivery.", "access_token":"EAAJeSI6et1kBAG0PhzkRHIh1Wk5VZBQbhWj2tFIatrzqnvPdXct1yYWfkgLOu66a9oerFcaZCrxqtbE5wLYKZCZBF5NbjKfkc3BfCvGSLnZCZAG1HiZCJzjhYR2UbwhlEm2KcxgHxbk2ZCNiagRoXOjTVv3TUvTr4CoZD" } response = requests.post( "https://graph.facebook.com/v2.9/t_mid.$cAAIFrnoyzmViWhEOQVcKMvFJaCYe/messages", data=json.dumps(payload), headers = {"Content-Type": "application/json"} ) print(response.json())
{ "content_hash": "603326129d4ef0183f8f2827bb4a9345", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 248, "avg_line_length": 42.23529411764706, "alnum_prop": 0.8245125348189415, "repo_name": "bhanduroshan/fbstats-docker", "id": "efba69c9ce45de3992ddc760f6146a95108cd243", "size": "1436", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "message.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "125498" }, { "name": "HTML", "bytes": "52729" }, { "name": "JavaScript", "bytes": "1787" }, { "name": "Nginx", "bytes": "998" }, { "name": "Python", "bytes": "263690" }, { "name": "Shell", "bytes": "8068" } ], "symlink_target": "" }
using Microsoft.Build.Construction; using Microsoft.DotNet.Cli; using System; using System.Collections.Generic; using System.IO; using Microsoft.DotNet.ProjectJsonMigration; using Microsoft.Build.Evaluation; namespace Microsoft.DotNet.Tools.Migrate { internal class TemporaryDotnetNewTemplateProject { private const string c_temporaryDotnetNewMSBuildProjectName = "p"; private readonly string _projectDirectory; public ProjectRootElement MSBuildProject { get; } public string MSBuildProjectPath { get { return Path.Combine(_projectDirectory, c_temporaryDotnetNewMSBuildProjectName + ".csproj"); } } public TemporaryDotnetNewTemplateProject() { _projectDirectory = CreateDotnetNewMSBuild(c_temporaryDotnetNewMSBuildProjectName); MSBuildProject = GetMSBuildProject(); } public void Clean() { Directory.Delete(Path.Combine(_projectDirectory, ".."), true); } private string CreateDotnetNewMSBuild(string projectName) { var tempDir = Path.Combine( Path.GetTempPath(), this.GetType().Namespace, Path.GetRandomFileName(), c_temporaryDotnetNewMSBuildProjectName); if (Directory.Exists(tempDir)) { Directory.Delete(tempDir, true); } Directory.CreateDirectory(tempDir); RunCommand("new", new string[] {}, tempDir); return tempDir; } private ProjectRootElement GetMSBuildProject() { return ProjectRootElement.Open( MSBuildProjectPath, ProjectCollection.GlobalProjectCollection, preserveFormatting: true); } private void RunCommand(string commandToExecute, IEnumerable<string> args, string workingDirectory) { var command = new DotNetCommandFactory() .Create(commandToExecute, args) .WorkingDirectory(workingDirectory) .CaptureStdOut() .CaptureStdErr(); var commandResult = command.Execute(); if (commandResult.ExitCode != 0) { MigrationTrace.Instance.WriteLine(commandResult.StdOut); MigrationTrace.Instance.WriteLine(commandResult.StdErr); throw new Exception($"Failed to run {commandToExecute} in directory: {workingDirectory}"); } } } }
{ "content_hash": "228ebc5dec0dcc5608c08aef3a9cf801", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 107, "avg_line_length": 31.25, "alnum_prop": 0.5996190476190476, "repo_name": "weshaggard/cli", "id": "3c4b2d39a073e7337458efdaeeca9261ea195204", "size": "2627", "binary": false, "copies": "1", "ref": "refs/heads/rel/1.0.0", "path": "src/dotnet/commands/dotnet-migrate/TemporaryDotnetNewTemplateProject.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1825" }, { "name": "C#", "bytes": "1964538" }, { "name": "CSS", "bytes": "1534" }, { "name": "F#", "bytes": "1034" }, { "name": "Groovy", "bytes": "2391" }, { "name": "HTML", "bytes": "27944" }, { "name": "JavaScript", "bytes": "1556" }, { "name": "PowerShell", "bytes": "38559" }, { "name": "Python", "bytes": "9745" }, { "name": "Shell", "bytes": "49060" } ], "symlink_target": "" }
BOOST_AUTO_TEST_SUITE(FirstSuite) BOOST_AUTO_TEST_CASE( default_constructor ) { JPetTSlot test; BOOST_REQUIRE(test.size() == 0); BOOST_REQUIRE(test.getNumberOfSigCh() == 0); BOOST_REQUIRE(test.getSigChVect().size() == 0); } BOOST_AUTO_TEST_CASE( some_channels ) { JPetTSlot test; JPetSigCh ch_test(JPetSigCh::Trailing, 1.2), ch_test2(JPetSigCh::Leading, 1.5), ch_test3(JPetSigCh::Charge, 98); test.addCh(ch_test); test.addCh(ch_test2); test.addCh(ch_test3); BOOST_REQUIRE(test.size() == 3); BOOST_REQUIRE(test.getNumberOfSigCh() == 3); BOOST_REQUIRE(test.getSigChVect().size() == 3); double epsilon = 0.001; BOOST_REQUIRE_CLOSE(test[0].getValue(), 1.2, epsilon); BOOST_REQUIRE_CLOSE(test[1].getValue(), 1.5, epsilon); BOOST_REQUIRE_CLOSE(test[2].getValue(), 98, epsilon); std::vector<JPetSigCh*> array = test.getSigChVect(); BOOST_REQUIRE_CLOSE((array.at(0))->getValue(), 1.2, epsilon); BOOST_REQUIRE_CLOSE((array.at(1))->getValue(), 1.5, epsilon); BOOST_REQUIRE_CLOSE((array.at(2))->getValue(), 98, epsilon); } BOOST_AUTO_TEST_SUITE_END()
{ "content_hash": "480b1c53f7b8695e519702f0670ceda8", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 114, "avg_line_length": 31.057142857142857, "alnum_prop": 0.6826126954921803, "repo_name": "wictus/PhDFramework", "id": "3067ca5c8c78aaf26845e1d0ff5e86d29b3f2cde", "size": "1713", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "framework/tests/JPetTSlotTest/JPetTSlotTest.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "8269" }, { "name": "C++", "bytes": "883663" }, { "name": "Makefile", "bytes": "89939" }, { "name": "Objective-C", "bytes": "3141" }, { "name": "PLpgSQL", "bytes": "49229" }, { "name": "Perl", "bytes": "2916" }, { "name": "Python", "bytes": "4636" }, { "name": "Shell", "bytes": "8631" } ], "symlink_target": "" }
#ifndef _MYLIB #define _MYLIB #include <stdlib.h> #include <stdio.h> #define NUM_THREADS 8 // number of simultaneously executing threads you can have on // your machine (not the number of threads you can spawn). // Typically this equals the number of cores. #define M(x) x // parameter x is (M)odified by the routine, i.e. input & output #define O(x) x // parameter x is set by the routine, i.e. (O)utput only #define G(x) x // function is a (G)enerator. If function returns a bundle then all objects of // the bundle are generated (but not the bundle!) #define R(x) x // parameter x is the (R)eturn value #define I(x) x // parameter x has its reference count (I)ncremented #define C(x) x // a reference to parameter x is (C) consumed #define S(x) x // a reference to parameter x is (S) subsumed, i.e. made a (S)ub-object #define F(x) x // parameter x is (F)reed by the routine #define K(x) x // parameter x is (K)illed by the routine #define X(x) // comment on parameters or effect of routine #define DIMN_TYPE INT32_TYPE #define INDX_TYPE INT64_TYPE #define SIZE_TYPE INT64_TYPE #define OFFS_TYPE INT64_TYPE #define DIMN_SCALE 32 #define INDX_SCALE 64 #define SIZE_SCALE 64 #define OFFS_SCALE 64 namespace mylib { typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedef unsigned long long uint64; typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef signed long long int64; typedef float float32; typedef double float64; typedef char *string; // Used to emphasize '\0' terminated string typedef int boolean; // Used to emphasize == 0 is false, != 0 is on typedef int tristate; // Used to emphasize == 0, > 0, < 0 is what matters typedef int32 Dimn_Type; // Type of an array dimension typedef int64 Indx_Type; // Type of an index into the data space of an array typedef int64 Size_Type; // Type of the size of an array typedef int64 Offs_Type; // Type of an offset within an array typedef enum { UINT8_TYPE = 0, UINT16_TYPE = 1, UINT32_TYPE = 2, UINT64_TYPE = 3, INT8_TYPE = 4, INT16_TYPE = 5, INT32_TYPE = 6, INT64_TYPE = 7, FLOAT32_TYPE = 8, FLOAT64_TYPE = 9, UNKNOWN_TYPE = 20 } Value_Type; typedef enum // Operations on array elements { SET_OP = 0, // See Array_Op_Scalar and Array_Op_Array below ADD_OP = 1, SUB_OP = 2, MUL_OP = 3, DIV_OP = 4, POW_OP = 5, LSH_OP = 6, RSH_OP = 7, MIN_OP = 8, MAX_OP = 9 } Operator; typedef enum // Comparator ops for defining regions: see Draw_Floodfill in draw.h & { LE_COMP = 0, // Record_Region in region.h LT_COMP = 1, EQ_COMP = 2, NE_COMP = 3, GT_COMP = 4, GE_COMP = 5 } Comparator; typedef enum // The three possible "kinds" of types in a Value { UVAL = 0, IVAL = 1, FVAL = 2 } Value_Kind; void Use_Zero_Boundary(); void Use_Reflective_Boundary(); void Use_Wrap_Boundary(); void Use_Extend_Boundary(); void Use_Inversion_Boundary(); } typedef union { mylib::uint64 uval; // Use this variant for the 4 unsigned integers types mylib::int64 ival; // Use this variant for the 4 signed integer types mylib::float64 fval; // Use this variant for the 2 floating point number types } Value; inline Value VALU( mylib::uint64 u) { Value v; v.uval = u; return v; } inline Value VALI( mylib::int64 i) { Value v; v.ival = i; return v; } inline Value VALF(mylib::float64 f) { Value v; v.fval = f; return v; } #endif
{ "content_hash": "deee0628e02125659fae3317e50f2cac", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 98, "avg_line_length": 31.483606557377048, "alnum_prop": 0.617807862535798, "repo_name": "tingzhao/branchtest", "id": "8c219b0c8983d1bb744dc9076eba122f4fd5ecb5", "size": "4852", "binary": false, "copies": "1", "ref": "refs/heads/public", "path": "neurolabi/gui/mylib/mylib.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Awk", "bytes": "9874" }, { "name": "C", "bytes": "9108788" }, { "name": "C++", "bytes": "101792446" }, { "name": "CSS", "bytes": "3042" }, { "name": "D", "bytes": "0" }, { "name": "M", "bytes": "315" }, { "name": "Objective-C", "bytes": "40797" }, { "name": "OpenEdge ABL", "bytes": "499056" }, { "name": "Perl", "bytes": "355438" }, { "name": "Prolog", "bytes": "24474" }, { "name": "Python", "bytes": "200675" }, { "name": "Shell", "bytes": "467256" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "6b350bced7e346a14b94044d195683d1", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "ab6ede069ee0acdfaa4e902e51428b632f9a11eb", "size": "185", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Magnoliales/Annonaceae/Guatteria/Guatteria costata/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<!DOCTYPE html> <html lang="en" ng-app="simple"> <head> <meta charset="UTF-8"> <title>Reselect by alexcheuk</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="stylesheets/normalize.css" media="screen"> <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen"> <link rel="stylesheet" type="text/css" href="stylesheets/github-light.css" media="screen"> <script src="angular.min.js"></script> <script src="angular-sanitize.min.js"></script> <!-- <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.css"> --> <!-- ui-select files --> <script src="libs/reselect.js"></script> <link rel="stylesheet" href="libs/reselect.css"> <script src="simple.js"></script> </head> <body> <section class="header"> <h1 class="project-name">Reselect</h1> <h2 class="project-tagline"></h2> <a href="https://github.com/alexcheuk/Reselect" class="btn">View on GitHub</a> <a href="https://github.com/alexcheuk/Reselect/zipball/master" class="btn">Download .zip</a> <a href="https://github.com/alexcheuk/Reselect/tarball/master" class="btn">Download .tar.gz</a> </section> <section class="main-content"> <div ng-controller="SimpleCtrl"> <div ng-if="simple.ready"> <h2>Basic Example</h2> <div style="padding-bottom: 20px"> <h3>Array of Strings:</h3> <p><strong>Selected Value:</strong> <span ng-bind="simple.value"></span></p> <reselect placeholder="Custom placeholder" ng-model="simple.value"> <div reselect-choices options="option in simple.mocks.single"> <span ng-bind-html="option | rshighlight : $reselect.search_term"></span> </div> </reselect> <reselect allow-clear="true" ng-model="simple.value"> <div reselect-choice ng-click="simple.click()"> Static Option </div> <div reselect-choices options="option in simple.mocks.single"> <span ng-bind-html="option | rshighlight : $reselect.search_term"></span> </div> </reselect> <h3>Array of Objects:</h3> <p><strong>Selected Value:</strong> <span ng-bind="simple.objects1"></span></p> <reselect ng-model="simple.objects1"> <div reselect-selection> <span ng-bind="$choice.first_name"></span> </div> <div reselect-choices options="option.id as option in simple.mocks.objects|rsPropsFilter:{skill: $reselect.search_term } track by id"> <span ng-bind-html="option.first_name + ' ' + option.last_name + ' - ' + option.skill | rshighlight : $reselect.search_term"></span> </div reselect-choices> </reselect> <a ng-click="simple.objects1 = null">CLEAR</a> <p><strong>Selected Value:</strong> <small ng-bind="simple.objects2|json"></small></p> <reselect ng-model="simple.objects2"> <div reselect-selection> <span ng-bind="$choice.id"></span> - <span ng-bind="$selection.first_name"></span> </div> <div reselect-choices options="option in simple.mocks.objects"> <span ng-bind="option.first_name"></span> <span ng-bind="option.last_name"></span> - <span ng-bind="option.skill"></span> </div reselect-choices> </reselect> </div> <h3>Custom No Options</h3> <div style="padding-bottom: 20px"> <reselect ng-model="simple.objects3"> <div reselect-selection> <span ng-bind="$selection"></span> </div> <div reselect-choices options="option in []"> <span ng-bind="option.first_name"></span> <span ng-bind="option.last_name"></span> - <span ng-bind="option.skill"></span> </div reselect-choices> </reselect> <reselect ng-model="simple.objects3"> <div reselect-selection> <span ng-bind="$selection"></span> </div> <div reselect-choices no-options-text="SHOULD NOT SHOW" options="option in []"> <span ng-bind="option.first_name"></span> <span ng-bind="option.last_name"></span> - <span ng-bind="option.skill"></span> </div reselect-choices> <div reselect-no-choice> THIS SHOULD SHOW </div> </reselect> <reselect ng-model="simple.objects3"> <div reselect-selection> <span ng-bind="$selection"></span> </div> <div reselect-choices no-options-text="Custom text message" options="option in []"> <span ng-bind="option.first_name"></span> <span ng-bind="option.last_name"></span> - <span ng-bind="option.skill"></span> </div reselect-choices> <div reselect-no-choice> <div style="text-align:center; padding: 20px;"> <h4>There are no options</h4> <a href="javascript:;">click here</a> </div> </div> </reselect> <reselect ng-model="simple.objects3"> <div reselect-selection> <span ng-bind="$selection"></span> </div> <div reselect-choices no-options-text="Custom no options text" options="option in []"> </div reselect-choices> </reselect> </div> <!-- ALLOW INVALID --> <h3>Allow Invalid</h3> <p><strong>Selected Value:</strong> <small ng-bind="simple.invalidValue"></small></p> <div style="padding-bottom: 20px"> <p>Selected Value: <small ng-bind="simple.invalidValue"></small></p> <reselect reselect-options="{allowInvalid: true}" ng-model="simple.invalidValue"> <div reselect-selection> <span ng-bind="$selection"></span> </div> <div reselect-choices options="option in simple.mocks.single"> <span ng-bind="option"></span> </div reselect-choices> </reselect> </div> <div style="padding-bottom: 20px"> <p>Selected Value: <small ng-bind="simple.invalidValue2"></small></p> <reselect reselect-options="simple.invalidOptions2" ng-model="simple.invalidValue2"> <div reselect-selection> <span ng-bind="$selection"></span> </div> <div reselect-choices options="option in simple.mocks.single"> <span ng-bind="option"></span> </div reselect-choices> </reselect> </div> <div style="padding-bottom: 20px"> <p>Selected Value: <small ng-bind="simple.invalidValue3|json"></small></p> <reselect reselect-options="simple.invalidOptions3" ng-model="simple.invalidValue3"> <div reselect-selection> <span ng-bind="$choice.skill"></span> </div> <div reselect-choices options="option.skill as option in simple.mocks.objects"> <span ng-bind="option.skill"></span> </div reselect-choices> </reselect> </div> <!-- REMOTE FETCHING --> <h3>Remote Fetching</h3> <div style="padding-bottom: 20px"> <reselect ng-model="simple.value4"> <div reselect-placeholder> Custom </div> <div reselect-selection> <span ng-bind="$selection"></span> </div> <reselect-choice class="sticky-class" value="{data:{title:'Sticky Two'}}"> Sticky Two </reselect-choice> <div reselect-choices options="option.data.title as option in $remote" remote="simple.remoteOptions"> <span ng-bind="option.data.title"></span> </div> </reselect> </div> <!-- FORM VALIDATION --> <h3>Form Validation</h3> <div style="padding-bottom: 20px"> <form name="simple.form1" ng-submit="simple.submit(simple.form1)"> <reselect name="form_input1" ng-required="true" ng-model="simple.form_value"> <div reselect-selection> <span ng-bind="$selection"></span> </div> <div reselect-choices options="option.data.title as option in $remote" remote="simple.remoteOptions"> <span ng-bind="option.data.title"></span> </div> </reselect> <button type="submit" class="btn">SUBMIT</button> <table style="margin-top: 20px"> <tr> <td>required</td> <td>true</td> </tr> <tr> <td>$valid</td> <td><span ng-bind="simple.form1.form_input1.$valid"></span></td> </tr> <tr> <td>$pristine</td> <td><span ng-bind="simple.form1.form_input1.$pristine"></span></td> </tr> </table> {{simple.form1.$valid}} </form> </div> <div style="padding-bottom: 20px"> <form name="simple.form2" ng-submit="simple.submit()"> <reselect name="form_input2" ng-required="true" ng-disabled="true" ng-model="simple.form_value2"> <div reselect-selection> <span ng-bind="$selection"></span> </div> <div reselect-choices options="option.data.title as option in $remote" remote="simple.remoteOptions"> <span ng-bind="option.data.title"></span> </div> </reselect> <button type="submit" class="btn">SUBMIT</button> <table style="margin-top: 20px"> <tr> <td>disabled</td> <td>true</td> </tr> </table> </form> </div> </div> </div> <footer class="site-footer"> <span class="site-footer-owner"><a href="https://github.com/alexcheuk/Reselect">Reselect</a> is maintained by <a href="https://github.com/alexcheuk">alexcheuk</a>.</span> <span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the <a href="https://github.com/jasonlong/cayman-theme">Cayman theme</a> by <a href="https://twitter.com/jasonlong">Jason Long</a>.</span> </footer> </section> </body> </html>
{ "content_hash": "654bcd2fc61c18d8cdde3caeb7b3d2ed", "timestamp": "", "source": "github", "line_count": 291, "max_line_length": 273, "avg_line_length": 52.618556701030926, "alnum_prop": 0.38727795193312436, "repo_name": "alexcheuk/Reselect", "id": "0fcddb6e05db24110bf4a9aeb4e3ee9f7b0886f3", "size": "15312", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "6937" }, { "name": "HTML", "bytes": "4114" }, { "name": "JavaScript", "bytes": "97617" } ], "symlink_target": "" }
module Fluent class MqttInput < Input Plugin.register_input('mqtt', self) include Fluent::SetTagKeyMixin config_set_default :include_tag_key, false include Fluent::SetTimeKeyMixin config_set_default :include_time_key, true config_param :port, :integer, :default => 1883 config_param :bind, :string, :default => '127.0.0.1' config_param :topic, :string, :default => '#' config_param :username, :string, default: nil config_param :password, :string, default: nil require 'mqtt' def configure(conf) super @bind ||= conf['bind'] @topic ||= conf['topic'] @port ||= conf['port'] @username ||= conf['username'] @password ||= conf['password'] end def start $log.debug "start mqtt #{@bind}" @connect = MQTT::Client.connect({host: @bind, port: @port, username: @username, password: @password}) @connect.subscribe(@topic) @thread = Thread.new do @connect.get do |topic,message| topic.gsub!("/","\.") $log.debug "#{topic}: #{message}" emit topic, json_parse(message) end end end def emit topic, message , time = Fluent::Engine.now if message.class == Array message.each do |data| $log.debug "#{topic}: #{data}" Fluent::Engine.emit(topic , time , data) end else Fluent::Engine.emit(topic , time , message) end end def json_parse message begin y = Yajl::Parser.new y.parse(message) rescue $log.error "JSON parse error", :error => $!.to_s, :error_class => $!.class.to_s $log.warn_backtrace $!.backtrace end end def shutdown @thread.kill @connect.disconnect end end end
{ "content_hash": "d66e1dc4ea89a69f910e5ecf398c45da", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 107, "avg_line_length": 26.294117647058822, "alnum_prop": 0.5782997762863534, "repo_name": "tk-hamaguchi/fluent-plugin-mqtt", "id": "0ee75cd39bdbd44d1dc0e7020fef83cd8f958b2d", "size": "1788", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/fluent/plugin/in_mqtt.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "8124" } ], "symlink_target": "" }
class CNIControl { public: CNIControl(); virtual ~CNIControl(); public: int SetNIControl(); int StartControl(); int EndControl(); }; extern CNIControl g_NIControl; extern float g_SlavePos; #endif // !defined(AFX_NICONTROL_H__CC19FDE5_6F2C_49D3_A3DC_B13CE9889CB6__INCLUDED_)
{ "content_hash": "8fda3161f0a2af91bde52f46d8e59aef", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 84, "avg_line_length": 16.764705882352942, "alnum_prop": 0.7298245614035088, "repo_name": "tapomayukh/projects_in_c_cpp", "id": "ff7a488a50744d1fd020f953f4e001e177e24f91", "size": "740", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Passivity_Experiments/Program/v10/Passivity/header/NIControl.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "6216170" }, { "name": "C++", "bytes": "9040376" }, { "name": "Objective-C", "bytes": "43965" }, { "name": "Python", "bytes": "1880" }, { "name": "Visual Basic", "bytes": "109480" } ], "symlink_target": "" }
/* * This is the main execution point of the application. */ // Import all the other classes that have been created. var pCLI = require('./playercli'); var fCLI = require('./framecli'); var sBoard = require('./scoreboard'); // Constant defining how many frames there are in the application. var LAST_FRAME_NUMBER = 10; // Method that is executed when the program is started. function start() { // Get list of players from the CLI class. var players = pCLI.getPlayers(); // Start the game going through all the frames. for (var i = 0; i < LAST_FRAME_NUMBER; i++) { // Get the frame number that we are currently on. var frameNumber = i + 1; // Work through the players to give them there turns on the current frame. for (var playersName in players) { // Get the current player. var player = players[playersName]; // Get the info for the current frame the player is playing. var frame = fCLI.frameDialog(player.name, frameNumber); // Add that frame to the player so we can reference it later. player.addToFrames(frame); } } // Once the game is over we pass the info to the scoreboard class that prints the results. sBoard.print(players); } // Start the execution of the application. start();
{ "content_hash": "2826269f3465e4b3c9b5f8b6f95b00b8", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 91, "avg_line_length": 27.622222222222224, "alnum_prop": 0.6991150442477876, "repo_name": "XeTK/BBC-Bowling", "id": "7790665dfae834ac6bd363fd8540ac9f1b71a067", "size": "1243", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "index.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "23005" } ], "symlink_target": "" }
#ifndef CDLGCALIBWIZARDONLINE_H #define CDLGCALIBWIZARDONLINE_H //(*Headers(CDlgCalibWizardOnline) #include <mrpt/gui/WxUtils.h> #include <wx/button.h> #include <wx/checkbox.h> #include <wx/choice.h> #include <wx/dialog.h> #include <wx/radiobox.h> #include <wx/sizer.h> #include <wx/spinctrl.h> #include <wx/stattext.h> #include <wx/textctrl.h> #include <wx/timer.h> //*) #include <mrpt/gui/CMyRedirector.h> #include <mrpt/hwdrivers/CCameraSensor.h> #include <mrpt/vision/chessboard_camera_calib.h> class CDlgCalibWizardOnline : public wxDialog { public: CDlgCalibWizardOnline( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); ~CDlgCalibWizardOnline() override; std::unique_ptr<CMyRedirector> redire; //(*Declarations(CDlgCalibWizardOnline) wxStaticText* lbProgress; wxFlexGridSizer* FlexGridSizer1; wxTextCtrl* edLengthY; wxButton* btnClose; wxCheckBox* cbNormalize; wxRadioBox* rbMethod; mrpt::gui::wxMRPTImageControl* m_realtimeview; wxSpinCtrl* edSizeY; wxStaticText* StaticText1; mrpt::gui::CPanelCameraSelection* m_panelCamera; wxStaticText* StaticText3; wxButton* btnStop; wxTimer timCapture; wxSpinCtrl* edSizeX; wxTextCtrl* txtLog; wxStaticText* StaticText4; wxStaticText* StaticText5; wxStaticText* StaticText2; wxSpinCtrl* edNumCapture; wxStaticText* StaticText6; wxTextCtrl* edLengthX; wxButton* btnStart; wxChoice* pnpSelect; //*) protected: //(*Identifiers(CDlgCalibWizardOnline) static const long ID_CUSTOM2; static const long ID_STATICTEXT1; static const long ID_SPINCTRL1; static const long ID_STATICTEXT2; static const long ID_SPINCTRL2; static const long ID_RADIOBOX1; static const long ID_STATICTEXT3; static const long ID_TEXTCTRL1; static const long ID_STATICTEXT4; static const long ID_TEXTCTRL3; static const long ID_CHECKBOX1; static const long ID_STATICTEXT5; static const long ID_SPINCTRL3; static const long ID_STATICTEXT6; static const long ID_STATICTEXT7; static const long ID_TEXTCTRL2; static const long ID_BUTTON1; static const long ID_BUTTON2; static const long ID_BUTTON3; static const long ID_CUSTOM1; static const long ID_TIMER1; static const long ID_CHOICE1; //*) private: //(*Handlers(CDlgCalibWizardOnline) void OnbtnCloseClick(wxCommandEvent& event); void OnbtnStartClick(wxCommandEvent& event); void OnbtnStopClick(wxCommandEvent& event); void OntimCaptureTrigger(wxTimerEvent& event); //*) DECLARE_EVENT_TABLE() void threadProcessCorners(); /** The thread for corner detection. */ std::thread m_threadCorners; /** Input for the thread, null if nothing pending */ mrpt::obs::CObservationImage::Ptr m_threadImgToProcess; /** Close signal */ bool m_threadMustClose; /** The detected corners, if threadResultsComputed=true */ std::vector<mrpt::img::TPixelCoordf> m_threadResults; /** Put to true by the thread when done with an image */ bool m_threadResultsComputed; bool m_threadIsClosed; unsigned int m_check_size_x; unsigned int m_check_size_y; bool m_normalize_image; bool m_useScaramuzzaAlternativeDetector; mrpt::hwdrivers::CCameraSensor::Ptr m_video; public: /** The list of selected frames to use in camera calibration */ mrpt::vision::TCalibrationImageList m_calibFrames; }; #endif
{ "content_hash": "40bf5d06e052e9c8471acf2c38ae1e79", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 64, "avg_line_length": 26.943089430894307, "alnum_prop": 0.7658418829209415, "repo_name": "MRPT/mrpt", "id": "3b038526924001e4d4714890ab957d5c84386ef8", "size": "3940", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "apps/camera-calib/CDlgCalibWizardOnline.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "12930" }, { "name": "C", "bytes": "6718494" }, { "name": "C++", "bytes": "14447097" }, { "name": "CMake", "bytes": "555861" }, { "name": "GLSL", "bytes": "6522" }, { "name": "MATLAB", "bytes": "8401" }, { "name": "Makefile", "bytes": "517" }, { "name": "NSIS", "bytes": "1922" }, { "name": "Python", "bytes": "85724" }, { "name": "Shell", "bytes": "16350" } ], "symlink_target": "" }
package com.helger.scope.singleton; import javax.annotation.Nonnull; import com.helger.commons.annotation.UsedViaReflection; import com.helger.commons.hashcode.HashCodeGenerator; /** * Mock implementation of {@link AbstractSessionSingleton}. * * @author Philip Helger */ public final class MockSessionSingleton extends AbstractSessionSingleton { private int i = 0; @Deprecated @UsedViaReflection public MockSessionSingleton () {} @Nonnull public static MockSessionSingleton getInstance () { return getSessionSingleton (MockSessionSingleton.class); } public void inc () { i++; } public int get () { return i; } // For serialization testing! @Override public boolean equals (final Object o) { if (o == this) return true; if (o == null || !getClass ().equals (o.getClass ())) return false; return i == ((MockSessionSingleton) o).i; } @Override public int hashCode () { return new HashCodeGenerator (this).append (i).getHashCode (); } }
{ "content_hash": "6b6cf5eef5b05718a0d2fe947a487a2a", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 72, "avg_line_length": 18.818181818181817, "alnum_prop": 0.6830917874396135, "repo_name": "phax/ph-commons", "id": "8b07d63def9ad6fe34f186acd13ef17c50ff7758", "size": "1689", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ph-scopes/src/test/java/com/helger/scope/singleton/MockSessionSingleton.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "221283" }, { "name": "Java", "bytes": "11003809" }, { "name": "XSLT", "bytes": "3137" } ], "symlink_target": "" }
"use strict"; var React = require('react'); var Grid = require('react-bootstrap').Grid; var Col = require('react-bootstrap').Col; var Row = require('react-bootstrap').Row; var Modal = require('react-bootstrap').Modal; var Input = require('react-bootstrap').Input; var Button = require('react-bootstrap').Button; var Form = require('react-bootstrap').Form; var FormControl = require('react-bootstrap').FormControl; var FormGroup = require('react-bootstrap').FormGroup; var ControlLabel = require('react-bootstrap').ControlLabel; var Radio = require('react-bootstrap').Radio; var Switch = require('react-bootstrap-switch'); var Blink1SerialOption = require('./blink1SerialOption'); var MqttForm = React.createClass({ propTypes: { rule: React.PropTypes.object.isRequired, allowMultiBlink1: React.PropTypes.bool, patterns: React.PropTypes.array, onSave: React.PropTypes.func, onCancel: React.PropTypes.func, onDelete: React.PropTypes.func, onCopy: React.PropTypes.func }, getInitialState: function() { return {}; }, componentWillReceiveProps: function(nextProps) { var rule = nextProps.rule; this.setState({ type: 'mqtt', enabled: rule.enabled || false, name: rule.name || 'new rule', actionType: rule.actionType || 'parse-color', //patternId: rule.patternId || nextProps.patterns[0].id, blink1Id: rule.blink1Id || "0", topic: rule.topic || "", url: rule.url || "", username: rule.username || "", password: rule.password || "", }); // FIXME: why }, handleClose: function() { this.props.onSave(this.state); }, handleBlink1SerialChange: function(blink1Id) { this.setState({blink1Id: blink1Id}); }, handleActionType: function(e) { var actionType = e.target.value; this.setState({actionType:actionType}); }, handleInputChange: function(event) { var target = event.target; var value = target.type === 'checkbox' ? target.checked : target.value; var name = target.name; this.setState({ [name]: value }); }, render: function() { var self = this; var createPatternOption = function(item, idx) { return ( <option key={idx} value={item.id}>{item.name}</option> ); }; return ( <div> <Modal show={this.props.show} onHide={this.handleClose} > <Modal.Header> <Modal.Title>MQTT Settings</Modal.Title> </Modal.Header> <Modal.Body> <p style={{color: "#f00"}}>{this.state.errormsg}</p> <Form horizontal > <FormGroup controlId="formName" title="Name of the rule"> <Col sm={3} componentClass={ControlLabel}> Rule Name </Col> <Col sm={8}> <FormControl type="text" placeholder="Name of rule" name="name" value={this.state.name} onChange={this.handleInputChange} /> </Col> </FormGroup> <FormGroup controlId="formTopic"> <Col sm={3} componentClass={ControlLabel}> MQTT Topic </Col> <Col sm={8}> <FormControl type="text" placeholder="topic to subscribe to" name="topic" value={this.state.topic} onChange={this.handleInputChange} /> </Col> </FormGroup> <FormGroup controlId="formUrl"> <Col sm={3} componentClass={ControlLabel}> MQTT URL </Col> <Col sm={8}> <FormControl type="text" placeholder="e.g. mqtts://io.adafruit.com/" name="url" value={this.state.url} onChange={this.handleInputChange} /> </Col> </FormGroup> <FormGroup controlId="formUsername"> <Col sm={3} componentClass={ControlLabel}> MQTT username </Col> <Col sm={8}> <FormControl type="text" placeholder="e.g. mqtts://io.adafruit.com/" name="username" value={this.state.username} onChange={this.handleInputChange} /> </Col> </FormGroup> <FormGroup controlId="formPassword"> <Col sm={3} componentClass={ControlLabel}> MQTT password </Col> <Col sm={8}> <FormControl type="text" placeholder="" name="password" value={this.state.password} onChange={this.handleInputChange} /> </Col> </FormGroup> <Grid > <Row><Col xs={2}> <label> Parse output as </label> </Col><Col xs={4} > <FormGroup controlId="formActionType" > <Radio title="" value="parse-json" checked={this.state.actionType==='parse-json'} onChange={this.handleActionType}> Parse output as JSON (color or pattern) </Radio> <Radio title="" value="parse-pattern" checked={this.state.actionType==='parse-pattern'} onChange={this.handleActionType}> Parse output as pattern name </Radio> <Radio title="" value="parse-color" checked={this.state.actionType==='parse-color'} onChange={this.handleActionType}> Parse output as color </Radio> </FormGroup> </Col></Row> </Grid> {!this.props.allowMultiBlink1 ? null : <Blink1SerialOption label="blink(1) to use" defaultText="-use default-" labelClassName="col-xs-3" wrapperClassName="col-xs-4" serial={this.state.blink1Id} onChange={this.handleBlink1SerialChange}/>} </Form> </Modal.Body> <Modal.Footer> <Row> <Col xs={5}> <Button bsSize="small" bsStyle="danger" onClick={this.props.onDelete} style={{float:'left'}}>Delete</Button> <Button bsSize="small" onClick={this.props.onCopy} style={{float:'left'}}>Copy</Button> </Col> <Col xs={3}> <Switch bsSize="small" labelText="Enable" state={this.state.enabled} onChange={function(s){self.setState({enabled:s});}} /> </Col> <Col xs={4}> <Button bsSize="small" onClick={this.props.onCancel}>Cancel</Button> <Button bsSize="small" onClick={this.handleClose}>OK</Button> </Col> </Row> </Modal.Footer> </Modal> </div> ); } }); module.exports = MqttForm;
{ "content_hash": "713ba42aaca0fdce843938637fd5055f", "timestamp": "", "source": "github", "line_count": 177, "max_line_length": 140, "avg_line_length": 46.41242937853107, "alnum_prop": 0.45100426049908704, "repo_name": "todbot/Blink1Control2", "id": "c66e30a654a1946b2ab43b512dd4603a99771e75", "size": "8215", "binary": false, "copies": "1", "ref": "refs/heads/main-es5", "path": "app/components/gui/mqttForm.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "13571" }, { "name": "HTML", "bytes": "34676" }, { "name": "JavaScript", "bytes": "324241" } ], "symlink_target": "" }
<?php namespace SC\UsersBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\Loader; /** * This is the class that loads and manages your bundle configuration * * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} */ class SCUsersExtension extends Extension { /** * {@inheritDoc} */ public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.xml'); } }
{ "content_hash": "921ba267f5d49bbb6c83fc22710c7741", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 104, "avg_line_length": 31.142857142857142, "alnum_prop": 0.7247706422018348, "repo_name": "diegogd/fosuser-fpopenid", "id": "d1c3b5712686fa343c62bd61a004c6d5d7485c0a", "size": "872", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/SC/UsersBundle/DependencyInjection/SCUsersExtension.php", "mode": "33261", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "7918" }, { "name": "PHP", "bytes": "77310" } ], "symlink_target": "" }
old_string = "Ruby is cool" new_string = old_string.reverse.upcase #ß # RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If we try to run these files as a separate file per normal operation, the local variable checks will return nil. describe "old_string" do it 'is defined as a local variable' do expect(defined?(old_string)).to eq 'local-variable' end it "has the value 'Ruby is cool'" do expect(old_string).to eq "Ruby is cool" end end describe 'new_string' do it 'is defined as a local variable' do expect(defined?(new_string)).to eq 'local-variable' end it 'has the value "LOOC SI YBUR"' do expect(new_string).to eq "LOOC SI YBUR" end end
{ "content_hash": "1bd242f936ee8c9834784234f401e09b", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 236, "avg_line_length": 27.035714285714285, "alnum_prop": 0.714663143989432, "repo_name": "anfjord/phase-0", "id": "31ed4c7a637af470cda8071c7a2a333445ed8002", "size": "775", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "week-4/simple-string.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5012" }, { "name": "HTML", "bytes": "13491" }, { "name": "Ruby", "bytes": "67036" } ], "symlink_target": "" }
This folder has a bunch of different dependency management tools. You probably only want to include one of these.
{ "content_hash": "6875abf493d8e3e455f32740f179e094", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 58, "avg_line_length": 57.5, "alnum_prop": 0.808695652173913, "repo_name": "go-make/make", "id": "1208da7f99435266abed098562fd5adf71da228c", "size": "115", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "dep/README.md", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Dockerfile", "bytes": "704" }, { "name": "Go", "bytes": "31372" }, { "name": "Makefile", "bytes": "12705" }, { "name": "Smarty", "bytes": "11939" } ], "symlink_target": "" }
package ru.atott.combiq.data.commands; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.shell.core.CommandMarker; import org.springframework.shell.core.ExitShellRequest; import org.springframework.shell.core.JLineShellComponent; import org.springframework.shell.core.SimpleParser; import org.springframework.shell.core.annotation.CliCommand; import org.springframework.shell.core.annotation.CliOption; import org.springframework.stereotype.Component; @Component public class ShellCommands implements CommandMarker, ApplicationContextAware { private ApplicationContext ctx; @CliCommand(value = "help", help = "List all commands usage") public void obtainHelp( @CliOption(key = { "", "command" }, optionContext = "disable-string-converter availableCommands", help = "Command name to provide help for") String buffer) { JLineShellComponent shell = ctx.getBean("shell", JLineShellComponent.class); SimpleParser parser = shell.getSimpleParser(); parser.obtainHelp(buffer); } @CliCommand(value={"exit", "quit"}, help="Exits the shell") public ExitShellRequest quit() { return ExitShellRequest.NORMAL_EXIT; } @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.ctx = applicationContext; } }
{ "content_hash": "083c0927157f00ae9674507260770788", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 152, "avg_line_length": 40.432432432432435, "alnum_prop": 0.7640374331550802, "repo_name": "atott/combiq", "id": "19417a6db58012c10170d9484bc59c065e61f690", "size": "1496", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "data/src/main/java/ru/atott/combiq/data/commands/ShellCommands.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "329" }, { "name": "CSS", "bytes": "69971" }, { "name": "FreeMarker", "bytes": "102139" }, { "name": "HTML", "bytes": "11635" }, { "name": "Java", "bytes": "323985" }, { "name": "JavaScript", "bytes": "430271" }, { "name": "Shell", "bytes": "116" } ], "symlink_target": "" }
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include <stdio.h> #include <algorithm> #include <list> #include <map> #include <stack> #include <string> #include <vector> #include "base/at_exit.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/command_line.h" #include "base/float_util.h" #include "base/memory/scoped_ptr.h" #include "base/numerics/safe_math.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event_synthetic_delay.h" #include "build/build_config.h" #define GLES2_GPU_SERVICE 1 #include "gpu/command_buffer/common/debug_marker_manager.h" #include "gpu/command_buffer/common/gles2_cmd_format.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/common/id_allocator.h" #include "gpu/command_buffer/common/mailbox.h" #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" #include "gpu/command_buffer/service/async_pixel_transfer_manager.h" #include "gpu/command_buffer/service/buffer_manager.h" #include "gpu/command_buffer/service/cmd_buffer_engine.h" #include "gpu/command_buffer/service/context_group.h" #include "gpu/command_buffer/service/context_state.h" #include "gpu/command_buffer/service/error_state.h" #include "gpu/command_buffer/service/feature_info.h" #include "gpu/command_buffer/service/framebuffer_manager.h" #include "gpu/command_buffer/service/gl_utils.h" #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" #include "gpu/command_buffer/service/gles2_cmd_validation.h" #include "gpu/command_buffer/service/gpu_state_tracer.h" #include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/command_buffer/service/gpu_tracer.h" #include "gpu/command_buffer/service/image_manager.h" #include "gpu/command_buffer/service/mailbox_manager.h" #include "gpu/command_buffer/service/memory_tracking.h" #include "gpu/command_buffer/service/program_manager.h" #include "gpu/command_buffer/service/query_manager.h" #include "gpu/command_buffer/service/renderbuffer_manager.h" #include "gpu/command_buffer/service/shader_manager.h" #include "gpu/command_buffer/service/shader_translator.h" #include "gpu/command_buffer/service/shader_translator_cache.h" #include "gpu/command_buffer/service/texture_manager.h" #include "gpu/command_buffer/service/valuebuffer_manager.h" #include "gpu/command_buffer/service/vertex_array_manager.h" #include "gpu/command_buffer/service/vertex_attrib_manager.h" #include "third_party/smhasher/src/City.h" #include "ui/gl/gl_fence.h" #include "ui/gl/gl_image.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_surface.h" #if defined(OS_MACOSX) #include <IOSurface/IOSurfaceAPI.h> // Note that this must be included after gl_bindings.h to avoid conflicts. #include <OpenGL/CGLIOSurface.h> #endif #if defined(OS_WIN) #include "base/win/win_util.h" #endif namespace gpu { namespace gles2 { namespace { static const char kOESDerivativeExtension[] = "GL_OES_standard_derivatives"; static const char kEXTFragDepthExtension[] = "GL_EXT_frag_depth"; static const char kEXTDrawBuffersExtension[] = "GL_EXT_draw_buffers"; static const char kEXTShaderTextureLodExtension[] = "GL_EXT_shader_texture_lod"; static bool PrecisionMeetsSpecForHighpFloat(GLint rangeMin, GLint rangeMax, GLint precision) { return (rangeMin >= 62) && (rangeMax >= 62) && (precision >= 16); } static void GetShaderPrecisionFormatImpl(GLenum shader_type, GLenum precision_type, GLint *range, GLint *precision) { switch (precision_type) { case GL_LOW_INT: case GL_MEDIUM_INT: case GL_HIGH_INT: // These values are for a 32-bit twos-complement integer format. range[0] = 31; range[1] = 30; *precision = 0; break; case GL_LOW_FLOAT: case GL_MEDIUM_FLOAT: case GL_HIGH_FLOAT: // These values are for an IEEE single-precision floating-point format. range[0] = 127; range[1] = 127; *precision = 23; break; default: NOTREACHED(); break; } if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 && gfx::g_driver_gl.fn.glGetShaderPrecisionFormatFn) { // This function is sometimes defined even though it's really just // a stub, so we need to set range and precision as if it weren't // defined before calling it. // On Mac OS with some GPUs, calling this generates a // GL_INVALID_OPERATION error. Avoid calling it on non-GLES2 // platforms. glGetShaderPrecisionFormat(shader_type, precision_type, range, precision); // TODO(brianderson): Make the following official workarounds. // Some drivers have bugs where they report the ranges as a negative number. // Taking the absolute value here shouldn't hurt because negative numbers // aren't expected anyway. range[0] = abs(range[0]); range[1] = abs(range[1]); // If the driver reports a precision for highp float that isn't actually // highp, don't pretend like it's supported because shader compilation will // fail anyway. if (precision_type == GL_HIGH_FLOAT && !PrecisionMeetsSpecForHighpFloat(range[0], range[1], *precision)) { range[0] = 0; range[1] = 0; *precision = 0; } } } static gfx::OverlayTransform GetGFXOverlayTransform(GLenum plane_transform) { switch (plane_transform) { case GL_OVERLAY_TRANSFORM_NONE_CHROMIUM: return gfx::OVERLAY_TRANSFORM_NONE; case GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM: return gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL; case GL_OVERLAY_TRANSFORM_FLIP_VERTICAL_CHROMIUM: return gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL; case GL_OVERLAY_TRANSFORM_ROTATE_90_CHROMIUM: return gfx::OVERLAY_TRANSFORM_ROTATE_90; case GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM: return gfx::OVERLAY_TRANSFORM_ROTATE_180; case GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM: return gfx::OVERLAY_TRANSFORM_ROTATE_270; default: return gfx::OVERLAY_TRANSFORM_INVALID; } } } // namespace class GLES2DecoderImpl; // Local versions of the SET_GL_ERROR macros #define LOCAL_SET_GL_ERROR(error, function_name, msg) \ ERRORSTATE_SET_GL_ERROR(state_.GetErrorState(), error, function_name, msg) #define LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, value, label) \ ERRORSTATE_SET_GL_ERROR_INVALID_ENUM(state_.GetErrorState(), \ function_name, value, label) #define LOCAL_SET_GL_ERROR_INVALID_PARAM(error, function_name, pname) \ ERRORSTATE_SET_GL_ERROR_INVALID_PARAM(state_.GetErrorState(), error, \ function_name, pname) #define LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name) \ ERRORSTATE_COPY_REAL_GL_ERRORS_TO_WRAPPER(state_.GetErrorState(), \ function_name) #define LOCAL_PEEK_GL_ERROR(function_name) \ ERRORSTATE_PEEK_GL_ERROR(state_.GetErrorState(), function_name) #define LOCAL_CLEAR_REAL_GL_ERRORS(function_name) \ ERRORSTATE_CLEAR_REAL_GL_ERRORS(state_.GetErrorState(), function_name) #define LOCAL_PERFORMANCE_WARNING(msg) \ PerformanceWarning(__FILE__, __LINE__, msg) #define LOCAL_RENDER_WARNING(msg) \ RenderWarning(__FILE__, __LINE__, msg) // Check that certain assumptions the code makes are true. There are places in // the code where shared memory is passed direclty to GL. Example, glUniformiv, // glShaderSource. The command buffer code assumes GLint and GLsizei (and maybe // a few others) are 32bits. If they are not 32bits the code will have to change // to call those GL functions with service side memory and then copy the results // to shared memory, converting the sizes. static_assert(sizeof(GLint) == sizeof(uint32), // NOLINT "GLint should be the same size as uint32"); static_assert(sizeof(GLsizei) == sizeof(uint32), // NOLINT "GLsizei should be the same size as uint32"); static_assert(sizeof(GLfloat) == sizeof(float), // NOLINT "GLfloat should be the same size as float"); // TODO(kbr): the use of this anonymous namespace core dumps the // linker on Mac OS X 10.6 when the symbol ordering file is used // namespace { // Returns the address of the first byte after a struct. template <typename T> const void* AddressAfterStruct(const T& pod) { return reinterpret_cast<const uint8*>(&pod) + sizeof(pod); } // Returns the address of the frst byte after the struct or NULL if size > // immediate_data_size. template <typename RETURN_TYPE, typename COMMAND_TYPE> RETURN_TYPE GetImmediateDataAs(const COMMAND_TYPE& pod, uint32 size, uint32 immediate_data_size) { return (size <= immediate_data_size) ? static_cast<RETURN_TYPE>(const_cast<void*>(AddressAfterStruct(pod))) : NULL; } // Computes the data size for certain gl commands like glUniform. bool ComputeDataSize( GLuint count, size_t size, unsigned int elements_per_unit, uint32* dst) { uint32 value; if (!SafeMultiplyUint32(count, size, &value)) { return false; } if (!SafeMultiplyUint32(value, elements_per_unit, &value)) { return false; } *dst = value; return true; } // Return true if a character belongs to the ASCII subset as defined in // GLSL ES 1.0 spec section 3.1. static bool CharacterIsValidForGLES(unsigned char c) { // Printing characters are valid except " $ ` @ \ ' DEL. if (c >= 32 && c <= 126 && c != '"' && c != '$' && c != '`' && c != '@' && c != '\\' && c != '\'') { return true; } // Horizontal tab, line feed, vertical tab, form feed, carriage return // are also valid. if (c >= 9 && c <= 13) { return true; } return false; } static bool StringIsValidForGLES(const char* str) { for (; *str; ++str) { if (!CharacterIsValidForGLES(*str)) { return false; } } return true; } // This class prevents any GL errors that occur when it is in scope from // being reported to the client. class ScopedGLErrorSuppressor { public: explicit ScopedGLErrorSuppressor( const char* function_name, ErrorState* error_state); ~ScopedGLErrorSuppressor(); private: const char* function_name_; ErrorState* error_state_; DISALLOW_COPY_AND_ASSIGN(ScopedGLErrorSuppressor); }; // Temporarily changes a decoder's bound texture and restore it when this // object goes out of scope. Also temporarily switches to using active texture // unit zero in case the client has changed that to something invalid. class ScopedTextureBinder { public: explicit ScopedTextureBinder(ContextState* state, GLuint id, GLenum target); ~ScopedTextureBinder(); private: ContextState* state_; GLenum target_; DISALLOW_COPY_AND_ASSIGN(ScopedTextureBinder); }; // Temporarily changes a decoder's bound render buffer and restore it when this // object goes out of scope. class ScopedRenderBufferBinder { public: explicit ScopedRenderBufferBinder(ContextState* state, GLuint id); ~ScopedRenderBufferBinder(); private: ContextState* state_; DISALLOW_COPY_AND_ASSIGN(ScopedRenderBufferBinder); }; // Temporarily changes a decoder's bound frame buffer and restore it when this // object goes out of scope. class ScopedFrameBufferBinder { public: explicit ScopedFrameBufferBinder(GLES2DecoderImpl* decoder, GLuint id); ~ScopedFrameBufferBinder(); private: GLES2DecoderImpl* decoder_; DISALLOW_COPY_AND_ASSIGN(ScopedFrameBufferBinder); }; // Temporarily changes a decoder's bound frame buffer to a resolved version of // the multisampled offscreen render buffer if that buffer is multisampled, and, // if it is bound or enforce_internal_framebuffer is true. If internal is // true, the resolved framebuffer is not visible to the parent. class ScopedResolvedFrameBufferBinder { public: explicit ScopedResolvedFrameBufferBinder(GLES2DecoderImpl* decoder, bool enforce_internal_framebuffer, bool internal); ~ScopedResolvedFrameBufferBinder(); private: GLES2DecoderImpl* decoder_; bool resolve_and_bind_; DISALLOW_COPY_AND_ASSIGN(ScopedResolvedFrameBufferBinder); }; class ScopedModifyPixels { public: explicit ScopedModifyPixels(TextureRef* ref); ~ScopedModifyPixels(); private: TextureRef* ref_; }; ScopedModifyPixels::ScopedModifyPixels(TextureRef* ref) : ref_(ref) { if (ref_) ref_->texture()->OnWillModifyPixels(); } ScopedModifyPixels::~ScopedModifyPixels() { if (ref_) ref_->texture()->OnDidModifyPixels(); } class ScopedRenderTo { public: explicit ScopedRenderTo(Framebuffer* framebuffer); ~ScopedRenderTo(); private: const Framebuffer* framebuffer_; }; ScopedRenderTo::ScopedRenderTo(Framebuffer* framebuffer) : framebuffer_(framebuffer) { if (framebuffer) framebuffer_->OnWillRenderTo(); } ScopedRenderTo::~ScopedRenderTo() { if (framebuffer_) framebuffer_->OnDidRenderTo(); } // Encapsulates an OpenGL texture. class BackTexture { public: explicit BackTexture(MemoryTracker* memory_tracker, ContextState* state); ~BackTexture(); // Create a new render texture. void Create(); // Set the initial size and format of a render texture or resize it. bool AllocateStorage(const gfx::Size& size, GLenum format, bool zero); // Copy the contents of the currently bound frame buffer. void Copy(const gfx::Size& size, GLenum format); // Destroy the render texture. This must be explicitly called before // destroying this object. void Destroy(); // Invalidate the texture. This can be used when a context is lost and it is // not possible to make it current in order to free the resource. void Invalidate(); GLuint id() const { return id_; } gfx::Size size() const { return size_; } private: MemoryTypeTracker memory_tracker_; ContextState* state_; size_t bytes_allocated_; GLuint id_; gfx::Size size_; DISALLOW_COPY_AND_ASSIGN(BackTexture); }; // Encapsulates an OpenGL render buffer of any format. class BackRenderbuffer { public: explicit BackRenderbuffer( RenderbufferManager* renderbuffer_manager, MemoryTracker* memory_tracker, ContextState* state); ~BackRenderbuffer(); // Create a new render buffer. void Create(); // Set the initial size and format of a render buffer or resize it. bool AllocateStorage(const FeatureInfo* feature_info, const gfx::Size& size, GLenum format, GLsizei samples); // Destroy the render buffer. This must be explicitly called before destroying // this object. void Destroy(); // Invalidate the render buffer. This can be used when a context is lost and // it is not possible to make it current in order to free the resource. void Invalidate(); GLuint id() const { return id_; } private: RenderbufferManager* renderbuffer_manager_; MemoryTypeTracker memory_tracker_; ContextState* state_; size_t bytes_allocated_; GLuint id_; DISALLOW_COPY_AND_ASSIGN(BackRenderbuffer); }; // Encapsulates an OpenGL frame buffer. class BackFramebuffer { public: explicit BackFramebuffer(GLES2DecoderImpl* decoder); ~BackFramebuffer(); // Create a new frame buffer. void Create(); // Attach a color render buffer to a frame buffer. void AttachRenderTexture(BackTexture* texture); // Attach a render buffer to a frame buffer. Note that this unbinds any // currently bound frame buffer. void AttachRenderBuffer(GLenum target, BackRenderbuffer* render_buffer); // Destroy the frame buffer. This must be explicitly called before destroying // this object. void Destroy(); // Invalidate the frame buffer. This can be used when a context is lost and it // is not possible to make it current in order to free the resource. void Invalidate(); // See glCheckFramebufferStatusEXT. GLenum CheckStatus(); GLuint id() const { return id_; } private: GLES2DecoderImpl* decoder_; GLuint id_; DISALLOW_COPY_AND_ASSIGN(BackFramebuffer); }; struct FenceCallback { explicit FenceCallback() : fence(gfx::GLFence::Create()) { DCHECK(fence); } std::vector<base::Closure> callbacks; scoped_ptr<gfx::GLFence> fence; }; class AsyncUploadTokenCompletionObserver : public AsyncPixelTransferCompletionObserver { public: explicit AsyncUploadTokenCompletionObserver(uint32 async_upload_token) : async_upload_token_(async_upload_token) { } void DidComplete(const AsyncMemoryParams& mem_params) override { DCHECK(mem_params.buffer().get()); void* data = mem_params.GetDataAddress(); AsyncUploadSync* sync = static_cast<AsyncUploadSync*>(data); sync->SetAsyncUploadToken(async_upload_token_); } private: ~AsyncUploadTokenCompletionObserver() override {} uint32 async_upload_token_; DISALLOW_COPY_AND_ASSIGN(AsyncUploadTokenCompletionObserver); }; // } // anonymous namespace. // static const unsigned int GLES2Decoder::kDefaultStencilMask = static_cast<unsigned int>(-1); bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id, uint32* service_texture_id) { return false; } GLES2Decoder::GLES2Decoder() : initialized_(false), debug_(false), log_commands_(false), unsafe_es3_apis_enabled_(false) { } GLES2Decoder::~GLES2Decoder() { } void GLES2Decoder::BeginDecoding() {} void GLES2Decoder::EndDecoding() {} // This class implements GLES2Decoder so we don't have to expose all the GLES2 // cmd stuff to outside this class. class GLES2DecoderImpl : public GLES2Decoder, public FramebufferManager::TextureDetachObserver, public ErrorStateClient { public: explicit GLES2DecoderImpl(ContextGroup* group); ~GLES2DecoderImpl() override; // Overridden from AsyncAPIInterface. Error DoCommand(unsigned int command, unsigned int arg_count, const void* args) override; error::Error DoCommands(unsigned int num_commands, const void* buffer, int num_entries, int* entries_processed) override; template <bool DebugImpl> error::Error DoCommandsImpl(unsigned int num_commands, const void* buffer, int num_entries, int* entries_processed); // Overridden from AsyncAPIInterface. const char* GetCommandName(unsigned int command_id) const override; // Overridden from GLES2Decoder. bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, const scoped_refptr<gfx::GLContext>& context, bool offscreen, const gfx::Size& size, const DisallowedFeatures& disallowed_features, const std::vector<int32>& attribs) override; void Destroy(bool have_context) override; void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) override; void ProduceFrontBuffer(const Mailbox& mailbox) override; bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; void UpdateParentTextureInfo(); bool MakeCurrent() override; GLES2Util* GetGLES2Util() override { return &util_; } gfx::GLContext* GetGLContext() override { return context_.get(); } ContextGroup* GetContextGroup() override { return group_.get(); } Capabilities GetCapabilities() override; void RestoreState(const ContextState* prev_state) override; void RestoreActiveTexture() const override { state_.RestoreActiveTexture(); } void RestoreAllTextureUnitBindings( const ContextState* prev_state) const override { state_.RestoreAllTextureUnitBindings(prev_state); } void RestoreActiveTextureUnitBinding(unsigned int target) const override { state_.RestoreActiveTextureUnitBinding(target); } void RestoreBufferBindings() const override { state_.RestoreBufferBindings(); } void RestoreGlobalState() const override { state_.RestoreGlobalState(NULL); } void RestoreProgramBindings() const override { state_.RestoreProgramBindings(); } void RestoreTextureUnitBindings(unsigned unit) const override { state_.RestoreTextureUnitBindings(unit, NULL); } void RestoreFramebufferBindings() const override; void RestoreRenderbufferBindings() override; void RestoreTextureState(unsigned service_id) const override; void ClearAllAttributes() const override; void RestoreAllAttributes() const override; QueryManager* GetQueryManager() override { return query_manager_.get(); } VertexArrayManager* GetVertexArrayManager() override { return vertex_array_manager_.get(); } ImageManager* GetImageManager() override { return image_manager_.get(); } ValuebufferManager* GetValuebufferManager() override { return valuebuffer_manager(); } bool ProcessPendingQueries(bool did_finish) override; bool HasMoreIdleWork() override; void PerformIdleWork() override; void WaitForReadPixels(base::Closure callback) override; void SetResizeCallback( const base::Callback<void(gfx::Size, float)>& callback) override; Logger* GetLogger() override; void BeginDecoding() override; void EndDecoding() override; ErrorState* GetErrorState() override; const ContextState* GetContextState() override { return &state_; } void SetShaderCacheCallback(const ShaderCacheCallback& callback) override; void SetWaitSyncPointCallback(const WaitSyncPointCallback& callback) override; AsyncPixelTransferManager* GetAsyncPixelTransferManager() override; void ResetAsyncPixelTransferManagerForTest() override; void SetAsyncPixelTransferManagerForTest( AsyncPixelTransferManager* manager) override; void SetIgnoreCachedStateForTest(bool ignore) override; void ProcessFinishedAsyncTransfers(); bool GetServiceTextureId(uint32 client_texture_id, uint32* service_texture_id) override; uint32 GetTextureUploadCount() override; base::TimeDelta GetTotalTextureUploadTime() override; base::TimeDelta GetTotalProcessingCommandsTime() override; void AddProcessingCommandsTime(base::TimeDelta) override; // Restores the current state to the user's settings. void RestoreCurrentFramebufferBindings(); // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer. void ApplyDirtyState(); // These check the state of the currently bound framebuffer or the // backbuffer if no framebuffer is bound. // If all_draw_buffers is false, only check with COLOR_ATTACHMENT0, otherwise // check with all attached and enabled color attachments. bool BoundFramebufferHasColorAttachmentWithAlpha(bool all_draw_buffers); bool BoundFramebufferHasDepthAttachment(); bool BoundFramebufferHasStencilAttachment(); error::ContextLostReason GetContextLostReason() override; // Overridden from FramebufferManager::TextureDetachObserver: void OnTextureRefDetachedFromFramebuffer(TextureRef* texture) override; // Overriden from ErrorStateClient. void OnContextLostError() override; void OnOutOfMemoryError() override; // Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound. void EnsureRenderbufferBound(); // Helpers to facilitate calling into compatible extensions. static void RenderbufferStorageMultisampleHelper( const FeatureInfo* feature_info, GLenum target, GLsizei samples, GLenum internal_format, GLsizei width, GLsizei height); void BlitFramebufferHelper(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); private: friend class ScopedFrameBufferBinder; friend class ScopedResolvedFrameBufferBinder; friend class BackFramebuffer; // Initialize or re-initialize the shader translator. bool InitializeShaderTranslator(); void UpdateCapabilities(); // Helpers for the glGen and glDelete functions. bool GenTexturesHelper(GLsizei n, const GLuint* client_ids); void DeleteTexturesHelper(GLsizei n, const GLuint* client_ids); bool GenBuffersHelper(GLsizei n, const GLuint* client_ids); void DeleteBuffersHelper(GLsizei n, const GLuint* client_ids); bool GenFramebuffersHelper(GLsizei n, const GLuint* client_ids); void DeleteFramebuffersHelper(GLsizei n, const GLuint* client_ids); bool GenRenderbuffersHelper(GLsizei n, const GLuint* client_ids); void DeleteRenderbuffersHelper(GLsizei n, const GLuint* client_ids); bool GenValuebuffersCHROMIUMHelper(GLsizei n, const GLuint* client_ids); void DeleteValuebuffersCHROMIUMHelper(GLsizei n, const GLuint* client_ids); bool GenQueriesEXTHelper(GLsizei n, const GLuint* client_ids); void DeleteQueriesEXTHelper(GLsizei n, const GLuint* client_ids); bool GenVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); // Helper for async upload token completion notification callback. base::Closure AsyncUploadTokenCompletionClosure(uint32 async_upload_token, uint32 sync_data_shm_id, uint32 sync_data_shm_offset); // Workarounds void OnFboChanged() const; void OnUseFramebuffer() const; // TODO(gman): Cache these pointers? BufferManager* buffer_manager() { return group_->buffer_manager(); } RenderbufferManager* renderbuffer_manager() { return group_->renderbuffer_manager(); } FramebufferManager* framebuffer_manager() { return group_->framebuffer_manager(); } ValuebufferManager* valuebuffer_manager() { return group_->valuebuffer_manager(); } ProgramManager* program_manager() { return group_->program_manager(); } ShaderManager* shader_manager() { return group_->shader_manager(); } ShaderTranslatorCache* shader_translator_cache() { return group_->shader_translator_cache(); } const TextureManager* texture_manager() const { return group_->texture_manager(); } TextureManager* texture_manager() { return group_->texture_manager(); } MailboxManager* mailbox_manager() { return group_->mailbox_manager(); } ImageManager* image_manager() { return image_manager_.get(); } VertexArrayManager* vertex_array_manager() { return vertex_array_manager_.get(); } MemoryTracker* memory_tracker() { return group_->memory_tracker(); } bool EnsureGPUMemoryAvailable(size_t estimated_size) { MemoryTracker* tracker = memory_tracker(); if (tracker) { return tracker->EnsureGPUMemoryAvailable(estimated_size); } return true; } bool IsOffscreenBufferMultisampled() const { return offscreen_target_samples_ > 1; } // Creates a Texture for the given texture. TextureRef* CreateTexture( GLuint client_id, GLuint service_id) { return texture_manager()->CreateTexture(client_id, service_id); } // Gets the texture info for the given texture. Returns NULL if none exists. TextureRef* GetTexture(GLuint client_id) const { return texture_manager()->GetTexture(client_id); } // Deletes the texture info for the given texture. void RemoveTexture(GLuint client_id) { texture_manager()->RemoveTexture(client_id); } // Get the size (in pixels) of the currently bound frame buffer (either FBO // or regular back buffer). gfx::Size GetBoundReadFrameBufferSize(); // Get the format of the currently bound frame buffer (either FBO or regular // back buffer) GLenum GetBoundReadFrameBufferTextureType(); GLenum GetBoundReadFrameBufferInternalFormat(); GLenum GetBoundDrawFrameBufferInternalFormat(); // Wrapper for CompressedTexImage2D commands. error::Error DoCompressedTexImage2D( GLenum target, GLint level, GLenum internal_format, GLsizei width, GLsizei height, GLint border, GLsizei image_size, const void* data); // Wrapper for CompressedTexSubImage2D. void DoCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data); // Wrapper for CopyTexImage2D. void DoCopyTexImage2D( GLenum target, GLint level, GLenum internal_format, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); // Wrapper for SwapBuffers. void DoSwapBuffers(); // Wrapper for SwapInterval. void DoSwapInterval(int interval); // Wrapper for CopyTexSubImage2D. void DoCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); // Validation for TexSubImage2D. bool ValidateTexSubImage2D( error::Error* error, const char* function_name, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * data); // Wrapper for TexSubImage2D. error::Error DoTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * data); // Extra validation for async tex(Sub)Image2D. bool ValidateAsyncTransfer( const char* function_name, TextureRef* texture_ref, GLenum target, GLint level, const void * data); // Wrapper for TexImageIOSurface2DCHROMIUM. void DoTexImageIOSurface2DCHROMIUM( GLenum target, GLsizei width, GLsizei height, GLuint io_surface_id, GLuint plane); void DoCopyTextureCHROMIUM( GLenum target, GLuint source_id, GLuint target_id, GLint level, GLenum internal_format, GLenum dest_type); // Wrapper for TexStorage2DEXT. void DoTexStorage2DEXT( GLenum target, GLint levels, GLenum internal_format, GLsizei width, GLsizei height); void DoProduceTextureCHROMIUM(GLenum target, const GLbyte* key); void DoProduceTextureDirectCHROMIUM(GLuint texture, GLenum target, const GLbyte* key); void ProduceTextureRef(std::string func_name, TextureRef* texture_ref, GLenum target, const GLbyte* data); void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key); void DoCreateAndConsumeTextureCHROMIUM(GLenum target, const GLbyte* key, GLuint client_id); bool DoIsValuebufferCHROMIUM(GLuint client_id); void DoBindValueBufferCHROMIUM(GLenum target, GLuint valuebuffer); void DoSubscribeValueCHROMIUM(GLenum target, GLenum subscription); void DoPopulateSubscribedValuesCHROMIUM(GLenum target); void DoUniformValueBufferCHROMIUM(GLint location, GLenum target, GLenum subscription); void DoBindTexImage2DCHROMIUM( GLenum target, GLint image_id); void DoReleaseTexImage2DCHROMIUM( GLenum target, GLint image_id); void DoTraceEndCHROMIUM(void); void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs); void DoLoseContextCHROMIUM(GLenum current, GLenum other); void DoMatrixLoadfCHROMIUM(GLenum matrix_mode, const GLfloat* matrix); void DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode); // Creates a Program for the given program. Program* CreateProgram( GLuint client_id, GLuint service_id) { return program_manager()->CreateProgram(client_id, service_id); } // Gets the program info for the given program. Returns NULL if none exists. Program* GetProgram(GLuint client_id) { return program_manager()->GetProgram(client_id); } #if defined(NDEBUG) void LogClientServiceMapping( const char* /* function_name */, GLuint /* client_id */, GLuint /* service_id */) { } template<typename T> void LogClientServiceForInfo( T* /* info */, GLuint /* client_id */, const char* /* function_name */) { } #else void LogClientServiceMapping( const char* function_name, GLuint client_id, GLuint service_id) { if (service_logging_) { VLOG(1) << "[" << logger_.GetLogPrefix() << "] " << function_name << ": client_id = " << client_id << ", service_id = " << service_id; } } template<typename T> void LogClientServiceForInfo( T* info, GLuint client_id, const char* function_name) { if (info) { LogClientServiceMapping(function_name, client_id, info->service_id()); } } #endif // Gets the program info for the given program. If it's not a program // generates a GL error. Returns NULL if not program. Program* GetProgramInfoNotShader( GLuint client_id, const char* function_name) { Program* program = GetProgram(client_id); if (!program) { if (GetShader(client_id)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "shader passed for program"); } else { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown program"); } } LogClientServiceForInfo(program, client_id, function_name); return program; } // Creates a Shader for the given shader. Shader* CreateShader( GLuint client_id, GLuint service_id, GLenum shader_type) { return shader_manager()->CreateShader( client_id, service_id, shader_type); } // Gets the shader info for the given shader. Returns NULL if none exists. Shader* GetShader(GLuint client_id) { return shader_manager()->GetShader(client_id); } // Gets the shader info for the given shader. If it's not a shader generates a // GL error. Returns NULL if not shader. Shader* GetShaderInfoNotProgram( GLuint client_id, const char* function_name) { Shader* shader = GetShader(client_id); if (!shader) { if (GetProgram(client_id)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "program passed for shader"); } else { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, function_name, "unknown shader"); } } LogClientServiceForInfo(shader, client_id, function_name); return shader; } // Creates a buffer info for the given buffer. void CreateBuffer(GLuint client_id, GLuint service_id) { return buffer_manager()->CreateBuffer(client_id, service_id); } // Gets the buffer info for the given buffer. Buffer* GetBuffer(GLuint client_id) { Buffer* buffer = buffer_manager()->GetBuffer(client_id); return buffer; } // Removes any buffers in the VertexAtrribInfos and BufferInfos. This is used // on glDeleteBuffers so we can make sure the user does not try to render // with deleted buffers. void RemoveBuffer(GLuint client_id); // Creates a framebuffer info for the given framebuffer. void CreateFramebuffer(GLuint client_id, GLuint service_id) { return framebuffer_manager()->CreateFramebuffer(client_id, service_id); } // Gets the framebuffer info for the given framebuffer. Framebuffer* GetFramebuffer(GLuint client_id) { return framebuffer_manager()->GetFramebuffer(client_id); } // Removes the framebuffer info for the given framebuffer. void RemoveFramebuffer(GLuint client_id) { framebuffer_manager()->RemoveFramebuffer(client_id); } // Creates a renderbuffer info for the given renderbuffer. void CreateRenderbuffer(GLuint client_id, GLuint service_id) { return renderbuffer_manager()->CreateRenderbuffer( client_id, service_id); } // Gets the renderbuffer info for the given renderbuffer. Renderbuffer* GetRenderbuffer(GLuint client_id) { return renderbuffer_manager()->GetRenderbuffer(client_id); } // Removes the renderbuffer info for the given renderbuffer. void RemoveRenderbuffer(GLuint client_id) { renderbuffer_manager()->RemoveRenderbuffer(client_id); } // Creates a valuebuffer info for the given valuebuffer. void CreateValuebuffer(GLuint client_id) { return valuebuffer_manager()->CreateValuebuffer(client_id); } // Gets the valuebuffer info for a given valuebuffer. Valuebuffer* GetValuebuffer(GLuint client_id) { return valuebuffer_manager()->GetValuebuffer(client_id); } // Removes the valuebuffer info for the given valuebuffer. void RemoveValuebuffer(GLuint client_id) { valuebuffer_manager()->RemoveValuebuffer(client_id); } // Gets the vertex attrib manager for the given vertex array. VertexAttribManager* GetVertexAttribManager(GLuint client_id) { VertexAttribManager* info = vertex_array_manager()->GetVertexAttribManager(client_id); return info; } // Removes the vertex attrib manager for the given vertex array. void RemoveVertexAttribManager(GLuint client_id) { vertex_array_manager()->RemoveVertexAttribManager(client_id); } // Creates a vertex attrib manager for the given vertex array. scoped_refptr<VertexAttribManager> CreateVertexAttribManager( GLuint client_id, GLuint service_id, bool client_visible) { return vertex_array_manager()->CreateVertexAttribManager( client_id, service_id, group_->max_vertex_attribs(), client_visible); } void DoBindAttribLocation(GLuint client_id, GLuint index, const char* name); void DoBindUniformLocationCHROMIUM( GLuint client_id, GLint location, const char* name); error::Error GetAttribLocationHelper( GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, const std::string& name_str); error::Error GetUniformLocationHelper( GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, const std::string& name_str); error::Error GetFragDataLocationHelper( GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, const std::string& name_str); // Wrapper for glShaderSource. void DoShaderSource( GLuint client_id, GLsizei count, const char** data, const GLint* length); // Wrapper for glTransformFeedbackVaryings. void DoTransformFeedbackVaryings( GLuint client_program_id, GLsizei count, const char* const* varyings, GLenum buffer_mode); // Clear any textures used by the current program. bool ClearUnclearedTextures(); // Clears any uncleared attachments attached to the given frame buffer. // Returns false if there was a generated GL error. void ClearUnclearedAttachments(GLenum target, Framebuffer* framebuffer); // overridden from GLES2Decoder bool ClearLevel(Texture* texture, unsigned target, int level, unsigned internal_format, unsigned format, unsigned type, int width, int height, bool is_texture_immutable) override; // Restore all GL state that affects clearing. void RestoreClearState(); // Remembers the state of some capabilities. // Returns: true if glEnable/glDisable should actually be called. bool SetCapabilityState(GLenum cap, bool enabled); // Check that the currently bound framebuffers are valid. // Generates GL error if not. bool CheckBoundFramebuffersValid(const char* func_name); // Check that the currently bound read framebuffer has a color image // attached. Generates GL error if not. bool CheckBoundReadFramebufferColorAttachment(const char* func_name); // Check that the currently bound read framebuffer's color image // isn't the target texture of the glCopyTex{Sub}Image2D. bool FormsTextureCopyingFeedbackLoop(TextureRef* texture, GLint level); // Check if a framebuffer meets our requirements. bool CheckFramebufferValid( Framebuffer* framebuffer, GLenum target, const char* func_name); // Check if the current valuebuffer exists and is valid. If not generates // the appropriate GL error. Returns true if the current valuebuffer is in // a usable state. bool CheckCurrentValuebuffer(const char* function_name); // Check if the current valuebuffer exists and is valiud and that the // value buffer is actually subscribed to the given subscription bool CheckCurrentValuebufferForSubscription(GLenum subscription, const char* function_name); // Check if the location can be used for the given subscription target. If not // generates the appropriate GL error. Returns true if the location is usable bool CheckSubscriptionTarget(GLint location, GLenum subscription, const char* function_name); // Checks if the current program exists and is valid. If not generates the // appropriate GL error. Returns true if the current program is in a usable // state. bool CheckCurrentProgram(const char* function_name); // Checks if the current program exists and is valid and that location is not // -1. If the current program is not valid generates the appropriate GL // error. Returns true if the current program is in a usable state and // location is not -1. bool CheckCurrentProgramForUniform(GLint location, const char* function_name); // Checks if the current program samples a texture that is also the color // image of the current bound framebuffer, i.e., the source and destination // of the draw operation are the same. bool CheckDrawingFeedbackLoops(); // Checks if |api_type| is valid for the given uniform // If the api type is not valid generates the appropriate GL // error. Returns true if |api_type| is valid for the uniform bool CheckUniformForApiType(const Program::UniformInfo* info, const char* function_name, Program::UniformApiType api_type); // Gets the type of a uniform for a location in the current program. Sets GL // errors if the current program is not valid. Returns true if the current // program is valid and the location exists. Adjusts count so it // does not overflow the uniform. bool PrepForSetUniformByLocation(GLint fake_location, const char* function_name, Program::UniformApiType api_type, GLint* real_location, GLenum* type, GLsizei* count); // Gets the service id for any simulated backbuffer fbo. GLuint GetBackbufferServiceId() const; // Helper for glGetBooleanv, glGetFloatv and glGetIntegerv bool GetHelper(GLenum pname, GLint* params, GLsizei* num_written); // Helper for glGetVertexAttrib void GetVertexAttribHelper( const VertexAttrib* attrib, GLenum pname, GLint* param); // Wrapper for glActiveTexture void DoActiveTexture(GLenum texture_unit); // Wrapper for glAttachShader void DoAttachShader(GLuint client_program_id, GLint client_shader_id); // Wrapper for glBindBuffer since we need to track the current targets. void DoBindBuffer(GLenum target, GLuint buffer); // Wrapper for glBindFramebuffer since we need to track the current targets. void DoBindFramebuffer(GLenum target, GLuint framebuffer); // Wrapper for glBindRenderbuffer since we need to track the current targets. void DoBindRenderbuffer(GLenum target, GLuint renderbuffer); // Wrapper for glBindTexture since we need to track the current targets. void DoBindTexture(GLenum target, GLuint texture); // Wrapper for glBindVertexArrayOES void DoBindVertexArrayOES(GLuint array); void EmulateVertexArrayState(); // Wrapper for glBlitFramebufferCHROMIUM. void DoBlitFramebufferCHROMIUM( GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); // Wrapper for glBufferSubData. void DoBufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data); // Wrapper for glCheckFramebufferStatus GLenum DoCheckFramebufferStatus(GLenum target); // Wrapper for glClear error::Error DoClear(GLbitfield mask); // Wrappers for various state. void DoDepthRangef(GLclampf znear, GLclampf zfar); void DoSampleCoverage(GLclampf value, GLboolean invert); // Wrapper for glCompileShader. void DoCompileShader(GLuint shader); // Wrapper for glDetachShader void DoDetachShader(GLuint client_program_id, GLint client_shader_id); // Wrapper for glDisable void DoDisable(GLenum cap); // Wrapper for glDisableVertexAttribArray. void DoDisableVertexAttribArray(GLuint index); // Wrapper for glDiscardFramebufferEXT, since we need to track undefined // attachments. void DoDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments); // Wrapper for glEnable void DoEnable(GLenum cap); // Wrapper for glEnableVertexAttribArray. void DoEnableVertexAttribArray(GLuint index); // Wrapper for glFinish. void DoFinish(); // Wrapper for glFlush. void DoFlush(); // Wrapper for glFramebufferRenderbufffer. void DoFramebufferRenderbuffer( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); // Wrapper for glFramebufferTexture2D. void DoFramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); // Wrapper for glFramebufferTexture2DMultisampleEXT. void DoFramebufferTexture2DMultisample( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); // Common implementation for both DoFramebufferTexture2D wrappers. void DoFramebufferTexture2DCommon(const char* name, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); // Wrapper for glFramebufferTextureLayer. void DoFramebufferTextureLayer( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); // Wrapper for glGenerateMipmap void DoGenerateMipmap(GLenum target); // Helper for DoGetBooleanv, Floatv, and Intergerv to adjust pname // to account for different pname values defined in different extension // variants. GLenum AdjustGetPname(GLenum pname); // Wrapper for DoGetBooleanv. void DoGetBooleanv(GLenum pname, GLboolean* params); // Wrapper for DoGetFloatv. void DoGetFloatv(GLenum pname, GLfloat* params); // Wrapper for glGetFramebufferAttachmentParameteriv. void DoGetFramebufferAttachmentParameteriv( GLenum target, GLenum attachment, GLenum pname, GLint* params); // Wrapper for glGetIntegerv. void DoGetIntegerv(GLenum pname, GLint* params); // Gets the max value in a range in a buffer. GLuint DoGetMaxValueInBufferCHROMIUM( GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); // Wrapper for glGetBufferParameteriv. void DoGetBufferParameteriv( GLenum target, GLenum pname, GLint* params); // Wrapper for glGetProgramiv. void DoGetProgramiv( GLuint program_id, GLenum pname, GLint* params); // Wrapper for glRenderbufferParameteriv. void DoGetRenderbufferParameteriv( GLenum target, GLenum pname, GLint* params); // Wrapper for glGetShaderiv void DoGetShaderiv(GLuint shader, GLenum pname, GLint* params); // Wrappers for glGetTexParameter. void DoGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params); void DoGetTexParameteriv(GLenum target, GLenum pname, GLint* params); void InitTextureMaxAnisotropyIfNeeded(GLenum target, GLenum pname); // Wrappers for glGetVertexAttrib. void DoGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params); void DoGetVertexAttribiv(GLuint index, GLenum pname, GLint *params); // Wrappers for glIsXXX functions. bool DoIsEnabled(GLenum cap); bool DoIsBuffer(GLuint client_id); bool DoIsFramebuffer(GLuint client_id); bool DoIsProgram(GLuint client_id); bool DoIsRenderbuffer(GLuint client_id); bool DoIsShader(GLuint client_id); bool DoIsTexture(GLuint client_id); bool DoIsVertexArrayOES(GLuint client_id); // Wrapper for glLinkProgram void DoLinkProgram(GLuint program); // Wrapper for glRenderbufferStorage. void DoRenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, GLsizei height); // Handler for glRenderbufferStorageMultisampleCHROMIUM. void DoRenderbufferStorageMultisampleCHROMIUM( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); // Handler for glRenderbufferStorageMultisampleEXT // (multisampled_render_to_texture). void DoRenderbufferStorageMultisampleEXT( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); // Common validation for multisample extensions. bool ValidateRenderbufferStorageMultisample(GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); // Verifies that the currently bound multisample renderbuffer is valid // Very slow! Only done on platforms with driver bugs that return invalid // buffers under memory pressure bool VerifyMultisampleRenderbufferIntegrity( GLuint renderbuffer, GLenum format); // Wrapper for glReleaseShaderCompiler. void DoReleaseShaderCompiler() { } // Wrappers for glSamplerParameter*v functions. void DoSamplerParameterfv( GLuint sampler, GLenum pname, const GLfloat* params); void DoSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* params); // Wrappers for glTexParameter functions. void DoTexParameterf(GLenum target, GLenum pname, GLfloat param); void DoTexParameteri(GLenum target, GLenum pname, GLint param); void DoTexParameterfv(GLenum target, GLenum pname, const GLfloat* params); void DoTexParameteriv(GLenum target, GLenum pname, const GLint* params); // Wrappers for glUniform1i and glUniform1iv as according to the GLES2 // spec only these 2 functions can be used to set sampler uniforms. void DoUniform1i(GLint fake_location, GLint v0); void DoUniform1iv(GLint fake_location, GLsizei count, const GLint* value); void DoUniform2iv(GLint fake_location, GLsizei count, const GLint* value); void DoUniform3iv(GLint fake_location, GLsizei count, const GLint* value); void DoUniform4iv(GLint fake_location, GLsizei count, const GLint* value); // Wrappers for glUniformfv because some drivers don't correctly accept // bool uniforms. void DoUniform1fv(GLint fake_location, GLsizei count, const GLfloat* value); void DoUniform2fv(GLint fake_location, GLsizei count, const GLfloat* value); void DoUniform3fv(GLint fake_location, GLsizei count, const GLfloat* value); void DoUniform4fv(GLint fake_location, GLsizei count, const GLfloat* value); void DoUniformMatrix2fv( GLint fake_location, GLsizei count, GLboolean transpose, const GLfloat* value); void DoUniformMatrix3fv( GLint fake_location, GLsizei count, GLboolean transpose, const GLfloat* value); void DoUniformMatrix4fv( GLint fake_location, GLsizei count, GLboolean transpose, const GLfloat* value); bool SetVertexAttribValue( const char* function_name, GLuint index, const GLfloat* value); // Wrappers for glVertexAttrib?? void DoVertexAttrib1f(GLuint index, GLfloat v0); void DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1); void DoVertexAttrib3f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2); void DoVertexAttrib4f( GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); void DoVertexAttrib1fv(GLuint index, const GLfloat *v); void DoVertexAttrib2fv(GLuint index, const GLfloat *v); void DoVertexAttrib3fv(GLuint index, const GLfloat *v); void DoVertexAttrib4fv(GLuint index, const GLfloat *v); // Wrapper for glViewport void DoViewport(GLint x, GLint y, GLsizei width, GLsizei height); // Wrapper for glUseProgram void DoUseProgram(GLuint program); // Wrapper for glValidateProgram. void DoValidateProgram(GLuint program_client_id); void DoInsertEventMarkerEXT(GLsizei length, const GLchar* marker); void DoPushGroupMarkerEXT(GLsizei length, const GLchar* group); void DoPopGroupMarkerEXT(void); // Gets the number of values that will be returned by glGetXXX. Returns // false if pname is unknown. bool GetNumValuesReturnedForGLGet(GLenum pname, GLsizei* num_values); // Checks if the current program and vertex attributes are valid for drawing. bool IsDrawValid( const char* function_name, GLuint max_vertex_accessed, bool instanced, GLsizei primcount); // Returns true if successful, simulated will be true if attrib0 was // simulated. bool SimulateAttrib0( const char* function_name, GLuint max_vertex_accessed, bool* simulated); void RestoreStateForAttrib(GLuint attrib, bool restore_array_binding); // If an image is bound to texture, this will call Will/DidUseTexImage // if needed. void DoWillUseTexImageIfNeeded(Texture* texture, GLenum textarget); void DoDidUseTexImageIfNeeded(Texture* texture, GLenum textarget); // Returns false if textures were replaced. bool PrepareTexturesForRender(); void RestoreStateForTextures(); // Returns true if GL_FIXED attribs were simulated. bool SimulateFixedAttribs( const char* function_name, GLuint max_vertex_accessed, bool* simulated, GLsizei primcount); void RestoreStateForSimulatedFixedAttribs(); // Handle DrawArrays and DrawElements for both instanced and non-instanced // cases (primcount is always 1 for non-instanced). error::Error DoDrawArrays( const char* function_name, bool instanced, GLenum mode, GLint first, GLsizei count, GLsizei primcount); error::Error DoDrawElements( const char* function_name, bool instanced, GLenum mode, GLsizei count, GLenum type, int32 offset, GLsizei primcount); GLenum GetBindTargetForSamplerType(GLenum type) { DCHECK(type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES || type == GL_SAMPLER_2D_RECT_ARB); switch (type) { case GL_SAMPLER_2D: return GL_TEXTURE_2D; case GL_SAMPLER_CUBE: return GL_TEXTURE_CUBE_MAP; case GL_SAMPLER_EXTERNAL_OES: return GL_TEXTURE_EXTERNAL_OES; case GL_SAMPLER_2D_RECT_ARB: return GL_TEXTURE_RECTANGLE_ARB; } NOTREACHED(); return 0; } // Gets the framebuffer info for a particular target. Framebuffer* GetFramebufferInfoForTarget(GLenum target) { Framebuffer* framebuffer = NULL; switch (target) { case GL_FRAMEBUFFER: case GL_DRAW_FRAMEBUFFER_EXT: framebuffer = framebuffer_state_.bound_draw_framebuffer.get(); break; case GL_READ_FRAMEBUFFER_EXT: framebuffer = framebuffer_state_.bound_read_framebuffer.get(); break; default: NOTREACHED(); break; } return framebuffer; } Renderbuffer* GetRenderbufferInfoForTarget( GLenum target) { Renderbuffer* renderbuffer = NULL; switch (target) { case GL_RENDERBUFFER: renderbuffer = state_.bound_renderbuffer.get(); break; default: NOTREACHED(); break; } return renderbuffer; } // Validates the program and location for a glGetUniform call and returns // a SizeResult setup to receive the result. Returns true if glGetUniform // should be called. bool GetUniformSetup(GLuint program, GLint fake_location, uint32 shm_id, uint32 shm_offset, error::Error* error, GLint* real_location, GLuint* service_id, void** result, GLenum* result_type, GLsizei* result_size); void MaybeExitOnContextLost(); bool WasContextLost() override; bool WasContextLostByRobustnessExtension() override; void LoseContext(uint32 reset_status) override; #if defined(OS_MACOSX) void ReleaseIOSurfaceForTexture(GLuint texture_id); #endif bool ValidateCompressedTexDimensions( const char* function_name, GLint level, GLsizei width, GLsizei height, GLenum format); bool ValidateCompressedTexFuncData( const char* function_name, GLsizei width, GLsizei height, GLenum format, size_t size); bool ValidateCompressedTexSubDimensions( const char* function_name, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, Texture* texture); void RenderWarning(const char* filename, int line, const std::string& msg); void PerformanceWarning( const char* filename, int line, const std::string& msg); const FeatureInfo::FeatureFlags& features() const { return feature_info_->feature_flags(); } const FeatureInfo::Workarounds& workarounds() const { return feature_info_->workarounds(); } bool ShouldDeferDraws() { return !offscreen_target_frame_buffer_.get() && framebuffer_state_.bound_draw_framebuffer.get() == NULL && surface_->DeferDraws(); } bool ShouldDeferReads() { return !offscreen_target_frame_buffer_.get() && framebuffer_state_.bound_read_framebuffer.get() == NULL && surface_->DeferDraws(); } bool IsRobustnessSupported() { return has_robustness_extension_ && context_->WasAllocatedUsingRobustnessExtension(); } error::Error WillAccessBoundFramebufferForDraw() { if (ShouldDeferDraws()) return error::kDeferCommandUntilLater; if (!offscreen_target_frame_buffer_.get() && !framebuffer_state_.bound_draw_framebuffer.get() && !surface_->SetBackbufferAllocation(true)) return error::kLostContext; return error::kNoError; } error::Error WillAccessBoundFramebufferForRead() { if (ShouldDeferReads()) return error::kDeferCommandUntilLater; if (!offscreen_target_frame_buffer_.get() && !framebuffer_state_.bound_read_framebuffer.get() && !surface_->SetBackbufferAllocation(true)) return error::kLostContext; return error::kNoError; } // Set remaining commands to process to 0 to force DoCommands to return // and allow context preemption and GPU watchdog checks in GpuScheduler(). void ExitCommandProcessingEarly() { commands_to_process_ = 0; } void ProcessPendingReadPixels(); void FinishReadPixels(const cmds::ReadPixels& c, GLuint buffer); // Generate a member function prototype for each command in an automated and // typesafe way. #define GLES2_CMD_OP(name) \ Error Handle##name(uint32 immediate_data_size, const void* data); GLES2_COMMAND_LIST(GLES2_CMD_OP) #undef GLES2_CMD_OP // The GL context this decoder renders to on behalf of the client. scoped_refptr<gfx::GLSurface> surface_; scoped_refptr<gfx::GLContext> context_; // The ContextGroup for this decoder uses to track resources. scoped_refptr<ContextGroup> group_; DebugMarkerManager debug_marker_manager_; Logger logger_; // All the state for this context. ContextState state_; // Current width and height of the offscreen frame buffer. gfx::Size offscreen_size_; // Util to help with GL. GLES2Util util_; // unpack flip y as last set by glPixelStorei bool unpack_flip_y_; // unpack (un)premultiply alpha as last set by glPixelStorei bool unpack_premultiply_alpha_; bool unpack_unpremultiply_alpha_; // The buffer we bind to attrib 0 since OpenGL requires it (ES does not). GLuint attrib_0_buffer_id_; // The value currently in attrib_0. Vec4 attrib_0_value_; // Whether or not the attrib_0 buffer holds the attrib_0_value. bool attrib_0_buffer_matches_value_; // The size of attrib 0. GLsizei attrib_0_size_; // The buffer used to simulate GL_FIXED attribs. GLuint fixed_attrib_buffer_id_; // The size of fiixed attrib buffer. GLsizei fixed_attrib_buffer_size_; // The offscreen frame buffer that the client renders to. With EGL, the // depth and stencil buffers are separate. With regular GL there is a single // packed depth stencil buffer in offscreen_target_depth_render_buffer_. // offscreen_target_stencil_render_buffer_ is unused. scoped_ptr<BackFramebuffer> offscreen_target_frame_buffer_; scoped_ptr<BackTexture> offscreen_target_color_texture_; scoped_ptr<BackRenderbuffer> offscreen_target_color_render_buffer_; scoped_ptr<BackRenderbuffer> offscreen_target_depth_render_buffer_; scoped_ptr<BackRenderbuffer> offscreen_target_stencil_render_buffer_; GLenum offscreen_target_color_format_; GLenum offscreen_target_depth_format_; GLenum offscreen_target_stencil_format_; GLsizei offscreen_target_samples_; GLboolean offscreen_target_buffer_preserved_; // The copy that is saved when SwapBuffers is called. scoped_ptr<BackFramebuffer> offscreen_saved_frame_buffer_; scoped_ptr<BackTexture> offscreen_saved_color_texture_; scoped_refptr<TextureRef> offscreen_saved_color_texture_info_; // The copy that is used as the destination for multi-sample resolves. scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; scoped_ptr<BackTexture> offscreen_resolved_color_texture_; GLenum offscreen_saved_color_format_; scoped_ptr<QueryManager> query_manager_; scoped_ptr<VertexArrayManager> vertex_array_manager_; scoped_ptr<ImageManager> image_manager_; base::Callback<void(gfx::Size, float)> resize_callback_; WaitSyncPointCallback wait_sync_point_callback_; ShaderCacheCallback shader_cache_callback_; scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_; // The format of the back buffer_ GLenum back_buffer_color_format_; bool back_buffer_has_depth_; bool back_buffer_has_stencil_; bool surfaceless_; // Backbuffer attachments that are currently undefined. uint32 backbuffer_needs_clear_bits_; // The current decoder error communicates the decoder error through command // processing functions that do not return the error value. Should be set only // if not returning an error. error::Error current_decoder_error_; bool use_shader_translator_; scoped_refptr<ShaderTranslatorInterface> vertex_translator_; scoped_refptr<ShaderTranslatorInterface> fragment_translator_; DisallowedFeatures disallowed_features_; // Cached from ContextGroup const Validators* validators_; scoped_refptr<FeatureInfo> feature_info_; int frame_number_; // Number of commands remaining to be processed in DoCommands(). int commands_to_process_; bool has_robustness_extension_; GLenum reset_status_; bool reset_by_robustness_extension_; bool supports_post_sub_buffer_; // These flags are used to override the state of the shared feature_info_ // member. Because the same FeatureInfo instance may be shared among many // contexts, the assumptions on the availablity of extensions in WebGL // contexts may be broken. These flags override the shared state to preserve // WebGL semantics. bool force_webgl_glsl_validation_; bool derivatives_explicitly_enabled_; bool frag_depth_explicitly_enabled_; bool draw_buffers_explicitly_enabled_; bool shader_texture_lod_explicitly_enabled_; bool compile_shader_always_succeeds_; // An optional behaviour to lose the context and group when OOM. bool lose_context_when_out_of_memory_; // Log extra info. bool service_logging_; #if defined(OS_MACOSX) typedef std::map<GLuint, IOSurfaceRef> TextureToIOSurfaceMap; TextureToIOSurfaceMap texture_to_io_surface_map_; #endif scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; scoped_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; // Cached values of the currently assigned viewport dimensions. GLsizei viewport_max_width_; GLsizei viewport_max_height_; // Command buffer stats. base::TimeDelta total_processing_commands_time_; // States related to each manager. DecoderTextureState texture_state_; DecoderFramebufferState framebuffer_state_; scoped_ptr<GPUTracer> gpu_tracer_; scoped_ptr<GPUStateTracer> gpu_state_tracer_; const unsigned char* cb_command_trace_category_; const unsigned char* gpu_decoder_category_; int gpu_trace_level_; bool gpu_trace_commands_; bool gpu_debug_commands_; std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; // Used to validate multisample renderbuffers if needed GLuint validation_texture_; GLuint validation_fbo_multisample_; GLuint validation_fbo_; typedef gpu::gles2::GLES2Decoder::Error (GLES2DecoderImpl::*CmdHandler)( uint32 immediate_data_size, const void* data); // A struct to hold info about each command. struct CommandInfo { CmdHandler cmd_handler; uint8 arg_flags; // How to handle the arguments for this command uint8 cmd_flags; // How to handle this command uint16 arg_count; // How many arguments are expected for this command. }; // A table of CommandInfo for all the commands. static const CommandInfo command_info[kNumCommands - kStartPoint]; DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); }; const GLES2DecoderImpl::CommandInfo GLES2DecoderImpl::command_info[] = { #define GLES2_CMD_OP(name) \ { \ &GLES2DecoderImpl::Handle##name, cmds::name::kArgFlags, \ cmds::name::cmd_flags, \ sizeof(cmds::name) / sizeof(CommandBufferEntry) - 1, \ } \ , /* NOLINT */ GLES2_COMMAND_LIST(GLES2_CMD_OP) #undef GLES2_CMD_OP }; ScopedGLErrorSuppressor::ScopedGLErrorSuppressor( const char* function_name, ErrorState* error_state) : function_name_(function_name), error_state_(error_state) { ERRORSTATE_COPY_REAL_GL_ERRORS_TO_WRAPPER(error_state_, function_name_); } ScopedGLErrorSuppressor::~ScopedGLErrorSuppressor() { ERRORSTATE_CLEAR_REAL_GL_ERRORS(error_state_, function_name_); } static void RestoreCurrentTextureBindings(ContextState* state, GLenum target) { TextureUnit& info = state->texture_units[0]; GLuint last_id; scoped_refptr<TextureRef> texture_ref; switch (target) { case GL_TEXTURE_2D: texture_ref = info.bound_texture_2d; break; case GL_TEXTURE_CUBE_MAP: texture_ref = info.bound_texture_cube_map; break; case GL_TEXTURE_EXTERNAL_OES: texture_ref = info.bound_texture_external_oes; break; case GL_TEXTURE_RECTANGLE_ARB: texture_ref = info.bound_texture_rectangle_arb; break; default: NOTREACHED(); break; } if (texture_ref.get()) { last_id = texture_ref->service_id(); } else { last_id = 0; } glBindTexture(target, last_id); glActiveTexture(GL_TEXTURE0 + state->active_texture_unit); } ScopedTextureBinder::ScopedTextureBinder(ContextState* state, GLuint id, GLenum target) : state_(state), target_(target) { ScopedGLErrorSuppressor suppressor( "ScopedTextureBinder::ctor", state_->GetErrorState()); // TODO(apatrick): Check if there are any other states that need to be reset // before binding a new texture. glActiveTexture(GL_TEXTURE0); glBindTexture(target, id); } ScopedTextureBinder::~ScopedTextureBinder() { ScopedGLErrorSuppressor suppressor( "ScopedTextureBinder::dtor", state_->GetErrorState()); RestoreCurrentTextureBindings(state_, target_); } ScopedRenderBufferBinder::ScopedRenderBufferBinder(ContextState* state, GLuint id) : state_(state) { ScopedGLErrorSuppressor suppressor( "ScopedRenderBufferBinder::ctor", state_->GetErrorState()); glBindRenderbufferEXT(GL_RENDERBUFFER, id); } ScopedRenderBufferBinder::~ScopedRenderBufferBinder() { ScopedGLErrorSuppressor suppressor( "ScopedRenderBufferBinder::dtor", state_->GetErrorState()); state_->RestoreRenderbufferBindings(); } ScopedFrameBufferBinder::ScopedFrameBufferBinder(GLES2DecoderImpl* decoder, GLuint id) : decoder_(decoder) { ScopedGLErrorSuppressor suppressor( "ScopedFrameBufferBinder::ctor", decoder_->GetErrorState()); glBindFramebufferEXT(GL_FRAMEBUFFER, id); decoder->OnFboChanged(); } ScopedFrameBufferBinder::~ScopedFrameBufferBinder() { ScopedGLErrorSuppressor suppressor( "ScopedFrameBufferBinder::dtor", decoder_->GetErrorState()); decoder_->RestoreCurrentFramebufferBindings(); } ScopedResolvedFrameBufferBinder::ScopedResolvedFrameBufferBinder( GLES2DecoderImpl* decoder, bool enforce_internal_framebuffer, bool internal) : decoder_(decoder) { resolve_and_bind_ = ( decoder_->offscreen_target_frame_buffer_.get() && decoder_->IsOffscreenBufferMultisampled() && (!decoder_->framebuffer_state_.bound_read_framebuffer.get() || enforce_internal_framebuffer)); if (!resolve_and_bind_) return; ScopedGLErrorSuppressor suppressor( "ScopedResolvedFrameBufferBinder::ctor", decoder_->GetErrorState()); glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, decoder_->offscreen_target_frame_buffer_->id()); GLuint targetid; if (internal) { if (!decoder_->offscreen_resolved_frame_buffer_.get()) { decoder_->offscreen_resolved_frame_buffer_.reset( new BackFramebuffer(decoder_)); decoder_->offscreen_resolved_frame_buffer_->Create(); decoder_->offscreen_resolved_color_texture_.reset( new BackTexture(decoder->memory_tracker(), &decoder->state_)); decoder_->offscreen_resolved_color_texture_->Create(); DCHECK(decoder_->offscreen_saved_color_format_); decoder_->offscreen_resolved_color_texture_->AllocateStorage( decoder_->offscreen_size_, decoder_->offscreen_saved_color_format_, false); decoder_->offscreen_resolved_frame_buffer_->AttachRenderTexture( decoder_->offscreen_resolved_color_texture_.get()); if (decoder_->offscreen_resolved_frame_buffer_->CheckStatus() != GL_FRAMEBUFFER_COMPLETE) { LOG(ERROR) << "ScopedResolvedFrameBufferBinder failed " << "because offscreen resolved FBO was incomplete."; return; } } targetid = decoder_->offscreen_resolved_frame_buffer_->id(); } else { targetid = decoder_->offscreen_saved_frame_buffer_->id(); } glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, targetid); const int width = decoder_->offscreen_size_.width(); const int height = decoder_->offscreen_size_.height(); decoder->state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); decoder->BlitFramebufferHelper(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_NEAREST); glBindFramebufferEXT(GL_FRAMEBUFFER, targetid); } ScopedResolvedFrameBufferBinder::~ScopedResolvedFrameBufferBinder() { if (!resolve_and_bind_) return; ScopedGLErrorSuppressor suppressor( "ScopedResolvedFrameBufferBinder::dtor", decoder_->GetErrorState()); decoder_->RestoreCurrentFramebufferBindings(); if (decoder_->state_.enable_flags.scissor_test) { decoder_->state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, true); } } BackTexture::BackTexture( MemoryTracker* memory_tracker, ContextState* state) : memory_tracker_(memory_tracker, MemoryTracker::kUnmanaged), state_(state), bytes_allocated_(0), id_(0) { } BackTexture::~BackTexture() { // This does not destroy the render texture because that would require that // the associated GL context was current. Just check that it was explicitly // destroyed. DCHECK_EQ(id_, 0u); } void BackTexture::Create() { ScopedGLErrorSuppressor suppressor("BackTexture::Create", state_->GetErrorState()); Destroy(); glGenTextures(1, &id_); ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // TODO(apatrick): Attempt to diagnose crbug.com/97775. If SwapBuffers is // never called on an offscreen context, no data will ever be uploaded to the // saved offscreen color texture (it is deferred until to when SwapBuffers // is called). My idea is that some nvidia drivers might have a bug where // deleting a texture that has never been populated might cause a // crash. glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); bytes_allocated_ = 16u * 16u * 4u; memory_tracker_.TrackMemAlloc(bytes_allocated_); } bool BackTexture::AllocateStorage( const gfx::Size& size, GLenum format, bool zero) { DCHECK_NE(id_, 0u); ScopedGLErrorSuppressor suppressor("BackTexture::AllocateStorage", state_->GetErrorState()); ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); uint32 image_size = 0; GLES2Util::ComputeImageDataSizes( size.width(), size.height(), 1, format, GL_UNSIGNED_BYTE, 8, &image_size, NULL, NULL); if (!memory_tracker_.EnsureGPUMemoryAvailable(image_size)) { return false; } scoped_ptr<char[]> zero_data; if (zero) { zero_data.reset(new char[image_size]); memset(zero_data.get(), 0, image_size); } glTexImage2D(GL_TEXTURE_2D, 0, // mip level format, size.width(), size.height(), 0, // border format, GL_UNSIGNED_BYTE, zero_data.get()); size_ = size; bool success = glGetError() == GL_NO_ERROR; if (success) { memory_tracker_.TrackMemFree(bytes_allocated_); bytes_allocated_ = image_size; memory_tracker_.TrackMemAlloc(bytes_allocated_); } return success; } void BackTexture::Copy(const gfx::Size& size, GLenum format) { DCHECK_NE(id_, 0u); ScopedGLErrorSuppressor suppressor("BackTexture::Copy", state_->GetErrorState()); ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); glCopyTexImage2D(GL_TEXTURE_2D, 0, // level format, 0, 0, size.width(), size.height(), 0); // border } void BackTexture::Destroy() { if (id_ != 0) { ScopedGLErrorSuppressor suppressor("BackTexture::Destroy", state_->GetErrorState()); glDeleteTextures(1, &id_); id_ = 0; } memory_tracker_.TrackMemFree(bytes_allocated_); bytes_allocated_ = 0; } void BackTexture::Invalidate() { id_ = 0; } BackRenderbuffer::BackRenderbuffer( RenderbufferManager* renderbuffer_manager, MemoryTracker* memory_tracker, ContextState* state) : renderbuffer_manager_(renderbuffer_manager), memory_tracker_(memory_tracker, MemoryTracker::kUnmanaged), state_(state), bytes_allocated_(0), id_(0) { } BackRenderbuffer::~BackRenderbuffer() { // This does not destroy the render buffer because that would require that // the associated GL context was current. Just check that it was explicitly // destroyed. DCHECK_EQ(id_, 0u); } void BackRenderbuffer::Create() { ScopedGLErrorSuppressor suppressor("BackRenderbuffer::Create", state_->GetErrorState()); Destroy(); glGenRenderbuffersEXT(1, &id_); } bool BackRenderbuffer::AllocateStorage(const FeatureInfo* feature_info, const gfx::Size& size, GLenum format, GLsizei samples) { ScopedGLErrorSuppressor suppressor( "BackRenderbuffer::AllocateStorage", state_->GetErrorState()); ScopedRenderBufferBinder binder(state_, id_); uint32 estimated_size = 0; if (!renderbuffer_manager_->ComputeEstimatedRenderbufferSize( size.width(), size.height(), samples, format, &estimated_size)) { return false; } if (!memory_tracker_.EnsureGPUMemoryAvailable(estimated_size)) { return false; } if (samples <= 1) { glRenderbufferStorageEXT(GL_RENDERBUFFER, format, size.width(), size.height()); } else { GLES2DecoderImpl::RenderbufferStorageMultisampleHelper(feature_info, GL_RENDERBUFFER, samples, format, size.width(), size.height()); } bool success = glGetError() == GL_NO_ERROR; if (success) { // Mark the previously allocated bytes as free. memory_tracker_.TrackMemFree(bytes_allocated_); bytes_allocated_ = estimated_size; // Track the newly allocated bytes. memory_tracker_.TrackMemAlloc(bytes_allocated_); } return success; } void BackRenderbuffer::Destroy() { if (id_ != 0) { ScopedGLErrorSuppressor suppressor("BackRenderbuffer::Destroy", state_->GetErrorState()); glDeleteRenderbuffersEXT(1, &id_); id_ = 0; } memory_tracker_.TrackMemFree(bytes_allocated_); bytes_allocated_ = 0; } void BackRenderbuffer::Invalidate() { id_ = 0; } BackFramebuffer::BackFramebuffer(GLES2DecoderImpl* decoder) : decoder_(decoder), id_(0) { } BackFramebuffer::~BackFramebuffer() { // This does not destroy the frame buffer because that would require that // the associated GL context was current. Just check that it was explicitly // destroyed. DCHECK_EQ(id_, 0u); } void BackFramebuffer::Create() { ScopedGLErrorSuppressor suppressor("BackFramebuffer::Create", decoder_->GetErrorState()); Destroy(); glGenFramebuffersEXT(1, &id_); } void BackFramebuffer::AttachRenderTexture(BackTexture* texture) { DCHECK_NE(id_, 0u); ScopedGLErrorSuppressor suppressor( "BackFramebuffer::AttachRenderTexture", decoder_->GetErrorState()); ScopedFrameBufferBinder binder(decoder_, id_); GLuint attach_id = texture ? texture->id() : 0; glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, attach_id, 0); } void BackFramebuffer::AttachRenderBuffer(GLenum target, BackRenderbuffer* render_buffer) { DCHECK_NE(id_, 0u); ScopedGLErrorSuppressor suppressor( "BackFramebuffer::AttachRenderBuffer", decoder_->GetErrorState()); ScopedFrameBufferBinder binder(decoder_, id_); GLuint attach_id = render_buffer ? render_buffer->id() : 0; glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, target, GL_RENDERBUFFER, attach_id); } void BackFramebuffer::Destroy() { if (id_ != 0) { ScopedGLErrorSuppressor suppressor("BackFramebuffer::Destroy", decoder_->GetErrorState()); glDeleteFramebuffersEXT(1, &id_); id_ = 0; } } void BackFramebuffer::Invalidate() { id_ = 0; } GLenum BackFramebuffer::CheckStatus() { DCHECK_NE(id_, 0u); ScopedGLErrorSuppressor suppressor("BackFramebuffer::CheckStatus", decoder_->GetErrorState()); ScopedFrameBufferBinder binder(decoder_, id_); return glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); } GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { return new GLES2DecoderImpl(group); } GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) : GLES2Decoder(), group_(group), logger_(&debug_marker_manager_), state_(group_->feature_info(), this, &logger_), unpack_flip_y_(false), unpack_premultiply_alpha_(false), unpack_unpremultiply_alpha_(false), attrib_0_buffer_id_(0), attrib_0_buffer_matches_value_(true), attrib_0_size_(0), fixed_attrib_buffer_id_(0), fixed_attrib_buffer_size_(0), offscreen_target_color_format_(0), offscreen_target_depth_format_(0), offscreen_target_stencil_format_(0), offscreen_target_samples_(0), offscreen_target_buffer_preserved_(true), offscreen_saved_color_format_(0), back_buffer_color_format_(0), back_buffer_has_depth_(false), back_buffer_has_stencil_(false), surfaceless_(false), backbuffer_needs_clear_bits_(0), current_decoder_error_(error::kNoError), use_shader_translator_(true), validators_(group_->feature_info()->validators()), feature_info_(group_->feature_info()), frame_number_(0), has_robustness_extension_(false), reset_status_(GL_NO_ERROR), reset_by_robustness_extension_(false), supports_post_sub_buffer_(false), force_webgl_glsl_validation_(false), derivatives_explicitly_enabled_(false), frag_depth_explicitly_enabled_(false), draw_buffers_explicitly_enabled_(false), shader_texture_lod_explicitly_enabled_(false), compile_shader_always_succeeds_(false), lose_context_when_out_of_memory_(false), service_logging_(base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableGPUServiceLoggingGPU)), viewport_max_width_(0), viewport_max_height_(0), texture_state_(group_->feature_info() ->workarounds() .texsubimage2d_faster_than_teximage2d), cb_command_trace_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( TRACE_DISABLED_BY_DEFAULT("cb_command"))), gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))), gpu_trace_level_(2), gpu_trace_commands_(false), gpu_debug_commands_(false), validation_texture_(0), validation_fbo_multisample_(0), validation_fbo_(0) { DCHECK(group); attrib_0_value_.v[0] = 0.0f; attrib_0_value_.v[1] = 0.0f; attrib_0_value_.v[2] = 0.0f; attrib_0_value_.v[3] = 1.0f; // The shader translator is used for WebGL even when running on EGL // because additional restrictions are needed (like only enabling // GL_OES_standard_derivatives on demand). It is used for the unit // tests because GLES2DecoderWithShaderTest.GetShaderInfoLogValidArgs passes // the empty string to CompileShader and this is not a valid shader. if (gfx::GetGLImplementation() == gfx::kGLImplementationMockGL || base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableGLSLTranslator)) { use_shader_translator_ = false; } } GLES2DecoderImpl::~GLES2DecoderImpl() { } bool GLES2DecoderImpl::Initialize( const scoped_refptr<gfx::GLSurface>& surface, const scoped_refptr<gfx::GLContext>& context, bool offscreen, const gfx::Size& size, const DisallowedFeatures& disallowed_features, const std::vector<int32>& attribs) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); DCHECK(context->IsCurrent(surface.get())); DCHECK(!context_.get()); surfaceless_ = surface->IsSurfaceless() && !offscreen; set_initialized(); gpu_tracer_.reset(new GPUTracer(this)); gpu_state_tracer_ = GPUStateTracer::Create(&state_); if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableGPUDebugging)) { set_debug(true); } if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableGPUCommandLogging)) { set_log_commands(true); } if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableUnsafeES3APIs)) { set_unsafe_es3_apis_enabled(true); } compile_shader_always_succeeds_ = base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kCompileShaderAlwaysSucceeds); // Take ownership of the context and surface. The surface can be replaced with // SetSurface. context_ = context; surface_ = surface; ContextCreationAttribHelper attrib_parser; if (!attrib_parser.Parse(attribs)) return false; // Save the loseContextWhenOutOfMemory context creation attribute. lose_context_when_out_of_memory_ = attrib_parser.lose_context_when_out_of_memory; // If the failIfMajorPerformanceCaveat context creation attribute was true // and we are using a software renderer, fail. if (attrib_parser.fail_if_major_perf_caveat && feature_info_->feature_flags().is_swiftshader) { group_ = NULL; // Must not destroy ContextGroup if it is not initialized. Destroy(true); return false; } if (!group_->Initialize(this, disallowed_features)) { LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " << "failed to initialize."; group_ = NULL; // Must not destroy ContextGroup if it is not initialized. Destroy(true); return false; } CHECK_GL_ERROR(); disallowed_features_ = disallowed_features; state_.attrib_values.resize(group_->max_vertex_attribs()); vertex_array_manager_.reset(new VertexArrayManager()); GLuint default_vertex_attrib_service_id = 0; if (features().native_vertex_array_object) { glGenVertexArraysOES(1, &default_vertex_attrib_service_id); glBindVertexArrayOES(default_vertex_attrib_service_id); } state_.default_vertex_attrib_manager = CreateVertexAttribManager(0, default_vertex_attrib_service_id, false); state_.default_vertex_attrib_manager->Initialize( group_->max_vertex_attribs(), feature_info_->workarounds().init_vertex_attributes); // vertex_attrib_manager is set to default_vertex_attrib_manager by this call DoBindVertexArrayOES(0); query_manager_.reset(new QueryManager(this, feature_info_.get())); image_manager_.reset(new ImageManager); util_.set_num_compressed_texture_formats( validators_->compressed_texture_format.GetValues().size()); if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { // We have to enable vertex array 0 on OpenGL or it won't render. Note that // OpenGL ES 2.0 does not have this issue. glEnableVertexAttribArray(0); } glGenBuffersARB(1, &attrib_0_buffer_id_); glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL); glBindBuffer(GL_ARRAY_BUFFER, 0); glGenBuffersARB(1, &fixed_attrib_buffer_id_); state_.texture_units.resize(group_->max_texture_units()); for (uint32 tt = 0; tt < state_.texture_units.size(); ++tt) { glActiveTexture(GL_TEXTURE0 + tt); // We want the last bind to be 2D. TextureRef* ref; if (features().oes_egl_image_external) { ref = texture_manager()->GetDefaultTextureInfo( GL_TEXTURE_EXTERNAL_OES); state_.texture_units[tt].bound_texture_external_oes = ref; glBindTexture(GL_TEXTURE_EXTERNAL_OES, ref ? ref->service_id() : 0); } if (features().arb_texture_rectangle) { ref = texture_manager()->GetDefaultTextureInfo( GL_TEXTURE_RECTANGLE_ARB); state_.texture_units[tt].bound_texture_rectangle_arb = ref; glBindTexture(GL_TEXTURE_RECTANGLE_ARB, ref ? ref->service_id() : 0); } ref = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP); state_.texture_units[tt].bound_texture_cube_map = ref; glBindTexture(GL_TEXTURE_CUBE_MAP, ref ? ref->service_id() : 0); ref = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D); state_.texture_units[tt].bound_texture_2d = ref; glBindTexture(GL_TEXTURE_2D, ref ? ref->service_id() : 0); } glActiveTexture(GL_TEXTURE0); CHECK_GL_ERROR(); if (offscreen) { if (attrib_parser.samples > 0 && attrib_parser.sample_buffers > 0 && features().chromium_framebuffer_multisample) { // Per ext_framebuffer_multisample spec, need max bound on sample count. // max_sample_count must be initialized to a sane value. If // glGetIntegerv() throws a GL error, it leaves its argument unchanged. GLint max_sample_count = 1; glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count); offscreen_target_samples_ = std::min(attrib_parser.samples, max_sample_count); } else { offscreen_target_samples_ = 1; } offscreen_target_buffer_preserved_ = attrib_parser.buffer_preserved; if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) { const bool rgb8_supported = context_->HasExtension("GL_OES_rgb8_rgba8"); // The only available default render buffer formats in GLES2 have very // little precision. Don't enable multisampling unless 8-bit render // buffer formats are available--instead fall back to 8-bit textures. if (rgb8_supported && offscreen_target_samples_ > 1) { offscreen_target_color_format_ = attrib_parser.alpha_size > 0 ? GL_RGBA8 : GL_RGB8; } else { offscreen_target_samples_ = 1; offscreen_target_color_format_ = attrib_parser.alpha_size > 0 ? GL_RGBA : GL_RGB; } // ANGLE only supports packed depth/stencil formats, so use it if it is // available. const bool depth24_stencil8_supported = feature_info_->feature_flags().packed_depth24_stencil8; VLOG(1) << "GL_OES_packed_depth_stencil " << (depth24_stencil8_supported ? "" : "not ") << "supported."; if ((attrib_parser.depth_size > 0 || attrib_parser.stencil_size > 0) && depth24_stencil8_supported) { offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8; offscreen_target_stencil_format_ = 0; } else { // It may be the case that this depth/stencil combination is not // supported, but this will be checked later by CheckFramebufferStatus. offscreen_target_depth_format_ = attrib_parser.depth_size > 0 ? GL_DEPTH_COMPONENT16 : 0; offscreen_target_stencil_format_ = attrib_parser.stencil_size > 0 ? GL_STENCIL_INDEX8 : 0; } } else { offscreen_target_color_format_ = attrib_parser.alpha_size > 0 ? GL_RGBA : GL_RGB; // If depth is requested at all, use the packed depth stencil format if // it's available, as some desktop GL drivers don't support any non-packed // formats for depth attachments. const bool depth24_stencil8_supported = feature_info_->feature_flags().packed_depth24_stencil8; VLOG(1) << "GL_EXT_packed_depth_stencil " << (depth24_stencil8_supported ? "" : "not ") << "supported."; if ((attrib_parser.depth_size > 0 || attrib_parser.stencil_size > 0) && depth24_stencil8_supported) { offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8; offscreen_target_stencil_format_ = 0; } else { offscreen_target_depth_format_ = attrib_parser.depth_size > 0 ? GL_DEPTH_COMPONENT : 0; offscreen_target_stencil_format_ = attrib_parser.stencil_size > 0 ? GL_STENCIL_INDEX : 0; } } offscreen_saved_color_format_ = attrib_parser.alpha_size > 0 ? GL_RGBA : GL_RGB; // Create the target frame buffer. This is the one that the client renders // directly to. offscreen_target_frame_buffer_.reset(new BackFramebuffer(this)); offscreen_target_frame_buffer_->Create(); // Due to GLES2 format limitations, either the color texture (for // non-multisampling) or the color render buffer (for multisampling) will be // attached to the offscreen frame buffer. The render buffer has more // limited formats available to it, but the texture can't do multisampling. if (IsOffscreenBufferMultisampled()) { offscreen_target_color_render_buffer_.reset(new BackRenderbuffer( renderbuffer_manager(), memory_tracker(), &state_)); offscreen_target_color_render_buffer_->Create(); } else { offscreen_target_color_texture_.reset(new BackTexture( memory_tracker(), &state_)); offscreen_target_color_texture_->Create(); } offscreen_target_depth_render_buffer_.reset(new BackRenderbuffer( renderbuffer_manager(), memory_tracker(), &state_)); offscreen_target_depth_render_buffer_->Create(); offscreen_target_stencil_render_buffer_.reset(new BackRenderbuffer( renderbuffer_manager(), memory_tracker(), &state_)); offscreen_target_stencil_render_buffer_->Create(); // Create the saved offscreen texture. The target frame buffer is copied // here when SwapBuffers is called. offscreen_saved_frame_buffer_.reset(new BackFramebuffer(this)); offscreen_saved_frame_buffer_->Create(); // offscreen_saved_color_texture_.reset(new BackTexture( memory_tracker(), &state_)); offscreen_saved_color_texture_->Create(); // Allocate the render buffers at their initial size and check the status // of the frame buffers is okay. if (!ResizeOffscreenFrameBuffer(size)) { LOG(ERROR) << "Could not allocate offscreen buffer storage."; Destroy(true); return false; } // Allocate the offscreen saved color texture. DCHECK(offscreen_saved_color_format_); offscreen_saved_color_texture_->AllocateStorage( gfx::Size(1, 1), offscreen_saved_color_format_, true); offscreen_saved_frame_buffer_->AttachRenderTexture( offscreen_saved_color_texture_.get()); if (offscreen_saved_frame_buffer_->CheckStatus() != GL_FRAMEBUFFER_COMPLETE) { LOG(ERROR) << "Offscreen saved FBO was incomplete."; Destroy(true); return false; } // Bind to the new default frame buffer (the offscreen target frame buffer). // This should now be associated with ID zero. DoBindFramebuffer(GL_FRAMEBUFFER, 0); } else { glBindFramebufferEXT(GL_FRAMEBUFFER, GetBackbufferServiceId()); // These are NOT if the back buffer has these proprorties. They are // if we want the command buffer to enforce them regardless of what // the real backbuffer is assuming the real back buffer gives us more than // we ask for. In other words, if we ask for RGB and we get RGBA then we'll // make it appear RGB. If on the other hand we ask for RGBA nd get RGB we // can't do anything about that. if (!surfaceless_) { GLint v = 0; glGetIntegerv(GL_ALPHA_BITS, &v); // This checks if the user requested RGBA and we have RGBA then RGBA. If // the user requested RGB then RGB. If the user did not specify a // preference than use whatever we were given. Same for DEPTH and STENCIL. back_buffer_color_format_ = (attrib_parser.alpha_size != 0 && v > 0) ? GL_RGBA : GL_RGB; glGetIntegerv(GL_DEPTH_BITS, &v); back_buffer_has_depth_ = attrib_parser.depth_size != 0 && v > 0; glGetIntegerv(GL_STENCIL_BITS, &v); back_buffer_has_stencil_ = attrib_parser.stencil_size != 0 && v > 0; } } // OpenGL ES 2.0 implicitly enables the desktop GL capability // VERTEX_PROGRAM_POINT_SIZE and doesn't expose this enum. This fact // isn't well documented; it was discovered in the Khronos OpenGL ES // mailing list archives. It also implicitly enables the desktop GL // capability GL_POINT_SPRITE to provide access to the gl_PointCoord // variable in fragment shaders. if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); glEnable(GL_POINT_SPRITE); } has_robustness_extension_ = context->HasExtension("GL_ARB_robustness") || context->HasExtension("GL_KHR_robustness") || context->HasExtension("GL_EXT_robustness"); if (!InitializeShaderTranslator()) { return false; } state_.viewport_width = size.width(); state_.viewport_height = size.height(); GLint viewport_params[4] = { 0 }; glGetIntegerv(GL_MAX_VIEWPORT_DIMS, viewport_params); viewport_max_width_ = viewport_params[0]; viewport_max_height_ = viewport_params[1]; state_.scissor_width = state_.viewport_width; state_.scissor_height = state_.viewport_height; // Set all the default state because some GL drivers get it wrong. state_.InitCapabilities(NULL); state_.InitState(NULL); glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit); DoBindBuffer(GL_ARRAY_BUFFER, 0); DoBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); DoBindFramebuffer(GL_FRAMEBUFFER, 0); DoBindRenderbuffer(GL_RENDERBUFFER, 0); DoBindValueBufferCHROMIUM(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM, 0); bool call_gl_clear = !surfaceless_; #if defined(OS_ANDROID) // Temporary workaround for Android WebView because this clear ignores the // clip and corrupts that external UI of the App. Not calling glClear is ok // because the system already clears the buffer before each draw. Proper // fix might be setting the scissor clip properly before initialize. See // crbug.com/259023 for details. call_gl_clear = surface_->GetHandle(); #endif if (call_gl_clear) { // Clear the backbuffer. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } supports_post_sub_buffer_ = surface->SupportsPostSubBuffer(); if (feature_info_->workarounds() .disable_post_sub_buffers_for_onscreen_surfaces && !surface->IsOffscreen()) supports_post_sub_buffer_ = false; if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); } if (feature_info_->workarounds().unbind_fbo_on_context_switch) { context_->SetUnbindFboOnMakeCurrent(); } // Only compositor contexts are known to use only the subset of GL // that can be safely migrated between the iGPU and the dGPU. Mark // those contexts as safe to forcibly transition between the GPUs. // http://crbug.com/180876, http://crbug.com/227228 if (!offscreen) context_->SetSafeToForceGpuSwitch(); async_pixel_transfer_manager_.reset( AsyncPixelTransferManager::Create(context.get())); async_pixel_transfer_manager_->Initialize(texture_manager()); if (workarounds().gl_clear_broken) { DCHECK(!clear_framebuffer_blit_.get()); LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glClearWorkaroundInit"); clear_framebuffer_blit_.reset(new ClearFramebufferResourceManager(this)); if (LOCAL_PEEK_GL_ERROR("glClearWorkaroundInit") != GL_NO_ERROR) return false; } framebuffer_manager()->AddObserver(this); return true; } Capabilities GLES2DecoderImpl::GetCapabilities() { DCHECK(initialized()); Capabilities caps; caps.VisitPrecisions([](GLenum shader, GLenum type, Capabilities::ShaderPrecision* shader_precision) { GLint range[2] = {0, 0}; GLint precision = 0; GetShaderPrecisionFormatImpl(shader, type, range, &precision); shader_precision->min_range = range[0]; shader_precision->max_range = range[1]; shader_precision->precision = precision; }); DoGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &caps.max_combined_texture_image_units); DoGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &caps.max_cube_map_texture_size); DoGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &caps.max_fragment_uniform_vectors); DoGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &caps.max_renderbuffer_size); DoGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &caps.max_texture_image_units); DoGetIntegerv(GL_MAX_TEXTURE_SIZE, &caps.max_texture_size); DoGetIntegerv(GL_MAX_VARYING_VECTORS, &caps.max_varying_vectors); DoGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &caps.max_vertex_attribs); DoGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &caps.max_vertex_texture_image_units); DoGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &caps.max_vertex_uniform_vectors); DoGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &caps.num_compressed_texture_formats); DoGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &caps.num_shader_binary_formats); DoGetIntegerv(GL_BIND_GENERATES_RESOURCE_CHROMIUM, &caps.bind_generates_resource_chromium); if (unsafe_es3_apis_enabled()) { DoGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &caps.max_transform_feedback_separate_attribs); DoGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &caps.max_uniform_buffer_bindings); DoGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &caps.uniform_buffer_offset_alignment); } caps.egl_image_external = feature_info_->feature_flags().oes_egl_image_external; caps.texture_format_bgra8888 = feature_info_->feature_flags().ext_texture_format_bgra8888; caps.texture_format_etc1 = feature_info_->feature_flags().oes_compressed_etc1_rgb8_texture; caps.texture_format_etc1_npot = caps.texture_format_etc1 && !workarounds().etc1_power_of_two_only; caps.texture_rectangle = feature_info_->feature_flags().arb_texture_rectangle; caps.texture_usage = feature_info_->feature_flags().angle_texture_usage; caps.texture_storage = feature_info_->feature_flags().ext_texture_storage; caps.discard_framebuffer = feature_info_->feature_flags().ext_discard_framebuffer; caps.sync_query = feature_info_->feature_flags().chromium_sync_query; #if defined(OS_MACOSX) // This is unconditionally true on mac, no need to test for it at runtime. caps.iosurface = true; #endif caps.post_sub_buffer = supports_post_sub_buffer_; caps.image = true; caps.blend_equation_advanced = feature_info_->feature_flags().blend_equation_advanced; caps.blend_equation_advanced_coherent = feature_info_->feature_flags().blend_equation_advanced_coherent; caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; return caps; } void GLES2DecoderImpl::UpdateCapabilities() { util_.set_num_compressed_texture_formats( validators_->compressed_texture_format.GetValues().size()); util_.set_num_shader_binary_formats( validators_->shader_binary_format.GetValues().size()); } bool GLES2DecoderImpl::InitializeShaderTranslator() { TRACE_EVENT0("gpu", "GLES2DecoderImpl::InitializeShaderTranslator"); if (!use_shader_translator_) { return true; } ShBuiltInResources resources; ShInitBuiltInResources(&resources); resources.MaxVertexAttribs = group_->max_vertex_attribs(); resources.MaxVertexUniformVectors = group_->max_vertex_uniform_vectors(); resources.MaxVaryingVectors = group_->max_varying_vectors(); resources.MaxVertexTextureImageUnits = group_->max_vertex_texture_image_units(); resources.MaxCombinedTextureImageUnits = group_->max_texture_units(); resources.MaxTextureImageUnits = group_->max_texture_image_units(); resources.MaxFragmentUniformVectors = group_->max_fragment_uniform_vectors(); resources.MaxDrawBuffers = group_->max_draw_buffers(); resources.MaxExpressionComplexity = 256; resources.MaxCallStackDepth = 256; GLint range[2] = { 0, 0 }; GLint precision = 0; GetShaderPrecisionFormatImpl(GL_FRAGMENT_SHADER, GL_HIGH_FLOAT, range, &precision); resources.FragmentPrecisionHigh = PrecisionMeetsSpecForHighpFloat(range[0], range[1], precision); if (force_webgl_glsl_validation_) { resources.OES_standard_derivatives = derivatives_explicitly_enabled_; resources.EXT_frag_depth = frag_depth_explicitly_enabled_; resources.EXT_draw_buffers = draw_buffers_explicitly_enabled_; if (!draw_buffers_explicitly_enabled_) resources.MaxDrawBuffers = 1; resources.EXT_shader_texture_lod = shader_texture_lod_explicitly_enabled_; resources.NV_draw_buffers = draw_buffers_explicitly_enabled_ && features().nv_draw_buffers; } else { resources.OES_standard_derivatives = features().oes_standard_derivatives ? 1 : 0; resources.ARB_texture_rectangle = features().arb_texture_rectangle ? 1 : 0; resources.OES_EGL_image_external = features().oes_egl_image_external ? 1 : 0; resources.EXT_draw_buffers = features().ext_draw_buffers ? 1 : 0; resources.EXT_frag_depth = features().ext_frag_depth ? 1 : 0; resources.EXT_shader_texture_lod = features().ext_shader_texture_lod ? 1 : 0; resources.NV_draw_buffers = features().nv_draw_buffers ? 1 : 0; } ShShaderSpec shader_spec = force_webgl_glsl_validation_ ? SH_WEBGL_SPEC : SH_GLES2_SPEC; if (shader_spec == SH_WEBGL_SPEC && features().enable_shader_name_hashing) resources.HashFunction = &CityHash64; else resources.HashFunction = NULL; ShaderTranslatorInterface::GlslImplementationType implementation_type = gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 ? ShaderTranslatorInterface::kGlslES : ShaderTranslatorInterface::kGlsl; int driver_bug_workarounds = 0; if (workarounds().needs_glsl_built_in_function_emulation) driver_bug_workarounds |= SH_EMULATE_BUILT_IN_FUNCTIONS; if (workarounds().init_gl_position_in_vertex_shader) driver_bug_workarounds |= SH_INIT_GL_POSITION; if (workarounds().unfold_short_circuit_as_ternary_operation) driver_bug_workarounds |= SH_UNFOLD_SHORT_CIRCUIT; if (workarounds().init_varyings_without_static_use) driver_bug_workarounds |= SH_INIT_VARYINGS_WITHOUT_STATIC_USE; if (workarounds().unroll_for_loop_with_sampler_array_index) driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX; if (workarounds().scalarize_vec_and_mat_constructor_args) driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS; if (workarounds().regenerate_struct_names) driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES; if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEmulateShaderPrecision)) resources.WEBGL_debug_shader_precision = true; vertex_translator_ = shader_translator_cache()->GetTranslator( GL_VERTEX_SHADER, shader_spec, &resources, implementation_type, static_cast<ShCompileOptions>(driver_bug_workarounds)); if (!vertex_translator_.get()) { LOG(ERROR) << "Could not initialize vertex shader translator."; Destroy(true); return false; } fragment_translator_ = shader_translator_cache()->GetTranslator( GL_FRAGMENT_SHADER, shader_spec, &resources, implementation_type, static_cast<ShCompileOptions>(driver_bug_workarounds)); if (!fragment_translator_.get()) { LOG(ERROR) << "Could not initialize fragment shader translator."; Destroy(true); return false; } return true; } bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { if (GetBuffer(client_ids[ii])) { return false; } } scoped_ptr<GLuint[]> service_ids(new GLuint[n]); glGenBuffersARB(n, service_ids.get()); for (GLsizei ii = 0; ii < n; ++ii) { CreateBuffer(client_ids[ii], service_ids[ii]); } return true; } bool GLES2DecoderImpl::GenFramebuffersHelper( GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { if (GetFramebuffer(client_ids[ii])) { return false; } } scoped_ptr<GLuint[]> service_ids(new GLuint[n]); glGenFramebuffersEXT(n, service_ids.get()); for (GLsizei ii = 0; ii < n; ++ii) { CreateFramebuffer(client_ids[ii], service_ids[ii]); } return true; } bool GLES2DecoderImpl::GenRenderbuffersHelper( GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { if (GetRenderbuffer(client_ids[ii])) { return false; } } scoped_ptr<GLuint[]> service_ids(new GLuint[n]); glGenRenderbuffersEXT(n, service_ids.get()); for (GLsizei ii = 0; ii < n; ++ii) { CreateRenderbuffer(client_ids[ii], service_ids[ii]); } return true; } bool GLES2DecoderImpl::GenValuebuffersCHROMIUMHelper(GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { if (GetValuebuffer(client_ids[ii])) { return false; } } for (GLsizei ii = 0; ii < n; ++ii) { CreateValuebuffer(client_ids[ii]); } return true; } bool GLES2DecoderImpl::GenTexturesHelper(GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { if (GetTexture(client_ids[ii])) { return false; } } scoped_ptr<GLuint[]> service_ids(new GLuint[n]); glGenTextures(n, service_ids.get()); for (GLsizei ii = 0; ii < n; ++ii) { CreateTexture(client_ids[ii], service_ids[ii]); } return true; } void GLES2DecoderImpl::DeleteBuffersHelper( GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { Buffer* buffer = GetBuffer(client_ids[ii]); if (buffer && !buffer->IsDeleted()) { state_.vertex_attrib_manager->Unbind(buffer); if (state_.bound_array_buffer.get() == buffer) { state_.bound_array_buffer = NULL; } RemoveBuffer(client_ids[ii]); } } } void GLES2DecoderImpl::DeleteFramebuffersHelper( GLsizei n, const GLuint* client_ids) { bool supports_separate_framebuffer_binds = features().chromium_framebuffer_multisample; for (GLsizei ii = 0; ii < n; ++ii) { Framebuffer* framebuffer = GetFramebuffer(client_ids[ii]); if (framebuffer && !framebuffer->IsDeleted()) { if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { GLenum target = supports_separate_framebuffer_binds ? GL_DRAW_FRAMEBUFFER_EXT : GL_FRAMEBUFFER; // Unbind attachments on FBO before deletion. if (workarounds().unbind_attachments_on_bound_render_fbo_delete) framebuffer->DoUnbindGLAttachmentsForWorkaround(target); glBindFramebufferEXT(target, GetBackbufferServiceId()); framebuffer_state_.bound_draw_framebuffer = NULL; framebuffer_state_.clear_state_dirty = true; } if (framebuffer == framebuffer_state_.bound_read_framebuffer.get()) { framebuffer_state_.bound_read_framebuffer = NULL; GLenum target = supports_separate_framebuffer_binds ? GL_READ_FRAMEBUFFER_EXT : GL_FRAMEBUFFER; glBindFramebufferEXT(target, GetBackbufferServiceId()); } OnFboChanged(); RemoveFramebuffer(client_ids[ii]); } } } void GLES2DecoderImpl::DeleteRenderbuffersHelper( GLsizei n, const GLuint* client_ids) { bool supports_separate_framebuffer_binds = features().chromium_framebuffer_multisample; for (GLsizei ii = 0; ii < n; ++ii) { Renderbuffer* renderbuffer = GetRenderbuffer(client_ids[ii]); if (renderbuffer && !renderbuffer->IsDeleted()) { if (state_.bound_renderbuffer.get() == renderbuffer) { state_.bound_renderbuffer = NULL; } // Unbind from current framebuffers. if (supports_separate_framebuffer_binds) { if (framebuffer_state_.bound_read_framebuffer.get()) { framebuffer_state_.bound_read_framebuffer ->UnbindRenderbuffer(GL_READ_FRAMEBUFFER_EXT, renderbuffer); } if (framebuffer_state_.bound_draw_framebuffer.get()) { framebuffer_state_.bound_draw_framebuffer ->UnbindRenderbuffer(GL_DRAW_FRAMEBUFFER_EXT, renderbuffer); } } else { if (framebuffer_state_.bound_draw_framebuffer.get()) { framebuffer_state_.bound_draw_framebuffer ->UnbindRenderbuffer(GL_FRAMEBUFFER, renderbuffer); } } framebuffer_state_.clear_state_dirty = true; RemoveRenderbuffer(client_ids[ii]); } } } void GLES2DecoderImpl::DeleteValuebuffersCHROMIUMHelper( GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { Valuebuffer* valuebuffer = GetValuebuffer(client_ids[ii]); if (valuebuffer) { if (state_.bound_valuebuffer.get() == valuebuffer) { state_.bound_valuebuffer = NULL; } RemoveValuebuffer(client_ids[ii]); } } } void GLES2DecoderImpl::DeleteTexturesHelper( GLsizei n, const GLuint* client_ids) { bool supports_separate_framebuffer_binds = features().chromium_framebuffer_multisample; for (GLsizei ii = 0; ii < n; ++ii) { TextureRef* texture_ref = GetTexture(client_ids[ii]); if (texture_ref) { Texture* texture = texture_ref->texture(); if (texture->IsAttachedToFramebuffer()) { framebuffer_state_.clear_state_dirty = true; } // Unbind texture_ref from texture_ref units. for (size_t jj = 0; jj < state_.texture_units.size(); ++jj) { state_.texture_units[jj].Unbind(texture_ref); } // Unbind from current framebuffers. if (supports_separate_framebuffer_binds) { if (framebuffer_state_.bound_read_framebuffer.get()) { framebuffer_state_.bound_read_framebuffer ->UnbindTexture(GL_READ_FRAMEBUFFER_EXT, texture_ref); } if (framebuffer_state_.bound_draw_framebuffer.get()) { framebuffer_state_.bound_draw_framebuffer ->UnbindTexture(GL_DRAW_FRAMEBUFFER_EXT, texture_ref); } } else { if (framebuffer_state_.bound_draw_framebuffer.get()) { framebuffer_state_.bound_draw_framebuffer ->UnbindTexture(GL_FRAMEBUFFER, texture_ref); } } #if defined(OS_MACOSX) GLuint service_id = texture->service_id(); if (texture->target() == GL_TEXTURE_RECTANGLE_ARB) { ReleaseIOSurfaceForTexture(service_id); } #endif RemoveTexture(client_ids[ii]); } } } // } // anonymous namespace bool GLES2DecoderImpl::MakeCurrent() { if (!context_.get()) return false; if (!context_->MakeCurrent(surface_.get()) || WasContextLost()) { LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent."; MaybeExitOnContextLost(); return false; } ProcessFinishedAsyncTransfers(); // Rebind the FBO if it was unbound by the context. if (workarounds().unbind_fbo_on_context_switch) RestoreFramebufferBindings(); framebuffer_state_.clear_state_dirty = true; return true; } void GLES2DecoderImpl::ProcessFinishedAsyncTransfers() { ProcessPendingReadPixels(); if (engine() && query_manager_.get()) query_manager_->ProcessPendingTransferQueries(); // TODO(epenner): Is there a better place to do this? // This needs to occur before we execute any batch of commands // from the client, as the client may have recieved an async // completion while issuing those commands. // "DidFlushStart" would be ideal if we had such a callback. async_pixel_transfer_manager_->BindCompletedAsyncTransfers(); } static void RebindCurrentFramebuffer( GLenum target, Framebuffer* framebuffer, GLuint back_buffer_service_id) { GLuint framebuffer_id = framebuffer ? framebuffer->service_id() : 0; if (framebuffer_id == 0) { framebuffer_id = back_buffer_service_id; } glBindFramebufferEXT(target, framebuffer_id); } void GLES2DecoderImpl::RestoreCurrentFramebufferBindings() { framebuffer_state_.clear_state_dirty = true; if (!features().chromium_framebuffer_multisample) { RebindCurrentFramebuffer( GL_FRAMEBUFFER, framebuffer_state_.bound_draw_framebuffer.get(), GetBackbufferServiceId()); } else { RebindCurrentFramebuffer( GL_READ_FRAMEBUFFER_EXT, framebuffer_state_.bound_read_framebuffer.get(), GetBackbufferServiceId()); RebindCurrentFramebuffer( GL_DRAW_FRAMEBUFFER_EXT, framebuffer_state_.bound_draw_framebuffer.get(), GetBackbufferServiceId()); } OnFboChanged(); } bool GLES2DecoderImpl::CheckFramebufferValid( Framebuffer* framebuffer, GLenum target, const char* func_name) { if (!framebuffer) { if (surfaceless_) return false; if (backbuffer_needs_clear_bits_) { glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat( offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1.f); state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glClearStencil(0); state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask); state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask); glClearDepth(1.0f); state_.SetDeviceDepthMask(GL_TRUE); state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); bool reset_draw_buffer = false; if ((backbuffer_needs_clear_bits_ & GL_COLOR_BUFFER_BIT) != 0 && group_->draw_buffer() == GL_NONE) { reset_draw_buffer = true; GLenum buf = GL_BACK; if (GetBackbufferServiceId() != 0) // emulated backbuffer buf = GL_COLOR_ATTACHMENT0; glDrawBuffersARB(1, &buf); } glClear(backbuffer_needs_clear_bits_); if (reset_draw_buffer) { GLenum buf = GL_NONE; glDrawBuffersARB(1, &buf); } backbuffer_needs_clear_bits_ = 0; RestoreClearState(); } return true; } if (framebuffer_manager()->IsComplete(framebuffer)) { return true; } GLenum completeness = framebuffer->IsPossiblyComplete(); if (completeness != GL_FRAMEBUFFER_COMPLETE) { LOCAL_SET_GL_ERROR( GL_INVALID_FRAMEBUFFER_OPERATION, func_name, "framebuffer incomplete"); return false; } // Are all the attachments cleared? if (renderbuffer_manager()->HaveUnclearedRenderbuffers() || texture_manager()->HaveUnclearedMips()) { if (!framebuffer->IsCleared()) { // Can we clear them? if (framebuffer->GetStatus(texture_manager(), target) != GL_FRAMEBUFFER_COMPLETE) { LOCAL_SET_GL_ERROR( GL_INVALID_FRAMEBUFFER_OPERATION, func_name, "framebuffer incomplete (clear)"); return false; } ClearUnclearedAttachments(target, framebuffer); } } if (!framebuffer_manager()->IsComplete(framebuffer)) { if (framebuffer->GetStatus(texture_manager(), target) != GL_FRAMEBUFFER_COMPLETE) { LOCAL_SET_GL_ERROR( GL_INVALID_FRAMEBUFFER_OPERATION, func_name, "framebuffer incomplete (check)"); return false; } framebuffer_manager()->MarkAsComplete(framebuffer); } // NOTE: At this point we don't know if the framebuffer is complete but // we DO know that everything that needs to be cleared has been cleared. return true; } bool GLES2DecoderImpl::CheckBoundFramebuffersValid(const char* func_name) { if (!features().chromium_framebuffer_multisample) { bool valid = CheckFramebufferValid( framebuffer_state_.bound_draw_framebuffer.get(), GL_FRAMEBUFFER_EXT, func_name); if (valid) OnUseFramebuffer(); return valid; } return CheckFramebufferValid(framebuffer_state_.bound_draw_framebuffer.get(), GL_DRAW_FRAMEBUFFER_EXT, func_name) && CheckFramebufferValid(framebuffer_state_.bound_read_framebuffer.get(), GL_READ_FRAMEBUFFER_EXT, func_name); } bool GLES2DecoderImpl::CheckBoundReadFramebufferColorAttachment( const char* func_name) { Framebuffer* framebuffer = features().chromium_framebuffer_multisample ? framebuffer_state_.bound_read_framebuffer.get() : framebuffer_state_.bound_draw_framebuffer.get(); if (!framebuffer) return true; if (framebuffer->GetAttachment(GL_COLOR_ATTACHMENT0) == NULL) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, func_name, "no color image attached"); return false; } return true; } bool GLES2DecoderImpl::FormsTextureCopyingFeedbackLoop( TextureRef* texture, GLint level) { Framebuffer* framebuffer = features().chromium_framebuffer_multisample ? framebuffer_state_.bound_read_framebuffer.get() : framebuffer_state_.bound_draw_framebuffer.get(); if (!framebuffer) return false; const Framebuffer::Attachment* attachment = framebuffer->GetAttachment( GL_COLOR_ATTACHMENT0); if (!attachment) return false; return attachment->FormsFeedbackLoop(texture, level); } gfx::Size GLES2DecoderImpl::GetBoundReadFrameBufferSize() { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT); if (framebuffer != NULL) { const Framebuffer::Attachment* attachment = framebuffer->GetAttachment(GL_COLOR_ATTACHMENT0); if (attachment) { return gfx::Size(attachment->width(), attachment->height()); } return gfx::Size(0, 0); } else if (offscreen_target_frame_buffer_.get()) { return offscreen_size_; } else { return surface_->GetSize(); } } GLenum GLES2DecoderImpl::GetBoundReadFrameBufferTextureType() { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT); if (framebuffer != NULL) { return framebuffer->GetColorAttachmentTextureType(); } else { return GL_UNSIGNED_BYTE; } } GLenum GLES2DecoderImpl::GetBoundReadFrameBufferInternalFormat() { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT); if (framebuffer != NULL) { return framebuffer->GetColorAttachmentFormat(); } else if (offscreen_target_frame_buffer_.get()) { return offscreen_target_color_format_; } else { return back_buffer_color_format_; } } GLenum GLES2DecoderImpl::GetBoundDrawFrameBufferInternalFormat() { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); if (framebuffer != NULL) { return framebuffer->GetColorAttachmentFormat(); } else if (offscreen_target_frame_buffer_.get()) { return offscreen_target_color_format_; } else { return back_buffer_color_format_; } } void GLES2DecoderImpl::UpdateParentTextureInfo() { if (!offscreen_saved_color_texture_info_.get()) return; GLenum target = offscreen_saved_color_texture_info_->texture()->target(); glBindTexture(target, offscreen_saved_color_texture_info_->service_id()); texture_manager()->SetLevelInfo( offscreen_saved_color_texture_info_.get(), GL_TEXTURE_2D, 0, // level GL_RGBA, offscreen_size_.width(), offscreen_size_.height(), 1, // depth 0, // border GL_RGBA, GL_UNSIGNED_BYTE, true); texture_manager()->SetParameteri( "UpdateParentTextureInfo", GetErrorState(), offscreen_saved_color_texture_info_.get(), GL_TEXTURE_MAG_FILTER, GL_LINEAR); texture_manager()->SetParameteri( "UpdateParentTextureInfo", GetErrorState(), offscreen_saved_color_texture_info_.get(), GL_TEXTURE_MIN_FILTER, GL_LINEAR); texture_manager()->SetParameteri( "UpdateParentTextureInfo", GetErrorState(), offscreen_saved_color_texture_info_.get(), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); texture_manager()->SetParameteri( "UpdateParentTextureInfo", GetErrorState(), offscreen_saved_color_texture_info_.get(), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); glBindTexture(target, texture_ref ? texture_ref->service_id() : 0); } void GLES2DecoderImpl::SetResizeCallback( const base::Callback<void(gfx::Size, float)>& callback) { resize_callback_ = callback; } Logger* GLES2DecoderImpl::GetLogger() { return &logger_; } void GLES2DecoderImpl::BeginDecoding() { gpu_tracer_->BeginDecoding(); gpu_trace_commands_ = gpu_tracer_->IsTracing() && *gpu_decoder_category_; gpu_debug_commands_ = log_commands() || debug() || gpu_trace_commands_ || (*cb_command_trace_category_ != 0); } void GLES2DecoderImpl::EndDecoding() { gpu_tracer_->EndDecoding(); } ErrorState* GLES2DecoderImpl::GetErrorState() { return state_.GetErrorState(); } void GLES2DecoderImpl::SetShaderCacheCallback( const ShaderCacheCallback& callback) { shader_cache_callback_ = callback; } void GLES2DecoderImpl::SetWaitSyncPointCallback( const WaitSyncPointCallback& callback) { wait_sync_point_callback_ = callback; } AsyncPixelTransferManager* GLES2DecoderImpl::GetAsyncPixelTransferManager() { return async_pixel_transfer_manager_.get(); } void GLES2DecoderImpl::ResetAsyncPixelTransferManagerForTest() { async_pixel_transfer_manager_.reset(); } void GLES2DecoderImpl::SetAsyncPixelTransferManagerForTest( AsyncPixelTransferManager* manager) { async_pixel_transfer_manager_ = make_scoped_ptr(manager); } bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, uint32* service_texture_id) { TextureRef* texture_ref = texture_manager()->GetTexture(client_texture_id); if (texture_ref) { *service_texture_id = texture_ref->service_id(); return true; } return false; } uint32 GLES2DecoderImpl::GetTextureUploadCount() { return texture_state_.texture_upload_count + async_pixel_transfer_manager_->GetTextureUploadCount(); } base::TimeDelta GLES2DecoderImpl::GetTotalTextureUploadTime() { return texture_state_.total_texture_upload_time + async_pixel_transfer_manager_->GetTotalTextureUploadTime(); } base::TimeDelta GLES2DecoderImpl::GetTotalProcessingCommandsTime() { return total_processing_commands_time_; } void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) { total_processing_commands_time_ += time; } void GLES2DecoderImpl::Destroy(bool have_context) { if (!initialized()) return; DCHECK(!have_context || context_->IsCurrent(NULL)); // Unbind everything. state_.vertex_attrib_manager = NULL; state_.default_vertex_attrib_manager = NULL; state_.texture_units.clear(); state_.bound_array_buffer = NULL; state_.current_queries.clear(); framebuffer_state_.bound_read_framebuffer = NULL; framebuffer_state_.bound_draw_framebuffer = NULL; state_.bound_renderbuffer = NULL; state_.bound_valuebuffer = NULL; if (offscreen_saved_color_texture_info_.get()) { DCHECK(offscreen_target_color_texture_); DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), offscreen_saved_color_texture_->id()); offscreen_saved_color_texture_->Invalidate(); offscreen_saved_color_texture_info_ = NULL; } if (have_context) { if (copy_texture_CHROMIUM_.get()) { copy_texture_CHROMIUM_->Destroy(); copy_texture_CHROMIUM_.reset(); } clear_framebuffer_blit_.reset(); if (state_.current_program.get()) { program_manager()->UnuseProgram(shader_manager(), state_.current_program.get()); } if (attrib_0_buffer_id_) { glDeleteBuffersARB(1, &attrib_0_buffer_id_); } if (fixed_attrib_buffer_id_) { glDeleteBuffersARB(1, &fixed_attrib_buffer_id_); } if (validation_texture_) { glDeleteTextures(1, &validation_texture_); glDeleteFramebuffersEXT(1, &validation_fbo_multisample_); glDeleteFramebuffersEXT(1, &validation_fbo_); } if (offscreen_target_frame_buffer_.get()) offscreen_target_frame_buffer_->Destroy(); if (offscreen_target_color_texture_.get()) offscreen_target_color_texture_->Destroy(); if (offscreen_target_color_render_buffer_.get()) offscreen_target_color_render_buffer_->Destroy(); if (offscreen_target_depth_render_buffer_.get()) offscreen_target_depth_render_buffer_->Destroy(); if (offscreen_target_stencil_render_buffer_.get()) offscreen_target_stencil_render_buffer_->Destroy(); if (offscreen_saved_frame_buffer_.get()) offscreen_saved_frame_buffer_->Destroy(); if (offscreen_saved_color_texture_.get()) offscreen_saved_color_texture_->Destroy(); if (offscreen_resolved_frame_buffer_.get()) offscreen_resolved_frame_buffer_->Destroy(); if (offscreen_resolved_color_texture_.get()) offscreen_resolved_color_texture_->Destroy(); } else { if (offscreen_target_frame_buffer_.get()) offscreen_target_frame_buffer_->Invalidate(); if (offscreen_target_color_texture_.get()) offscreen_target_color_texture_->Invalidate(); if (offscreen_target_color_render_buffer_.get()) offscreen_target_color_render_buffer_->Invalidate(); if (offscreen_target_depth_render_buffer_.get()) offscreen_target_depth_render_buffer_->Invalidate(); if (offscreen_target_stencil_render_buffer_.get()) offscreen_target_stencil_render_buffer_->Invalidate(); if (offscreen_saved_frame_buffer_.get()) offscreen_saved_frame_buffer_->Invalidate(); if (offscreen_saved_color_texture_.get()) offscreen_saved_color_texture_->Invalidate(); if (offscreen_resolved_frame_buffer_.get()) offscreen_resolved_frame_buffer_->Invalidate(); if (offscreen_resolved_color_texture_.get()) offscreen_resolved_color_texture_->Invalidate(); } // Current program must be cleared after calling ProgramManager::UnuseProgram. // Otherwise, we can leak objects. http://crbug.com/258772. // state_.current_program must be reset before group_ is reset because // the later deletes the ProgramManager object that referred by // state_.current_program object. state_.current_program = NULL; copy_texture_CHROMIUM_.reset(); clear_framebuffer_blit_.reset(); if (query_manager_.get()) { query_manager_->Destroy(have_context); query_manager_.reset(); } if (vertex_array_manager_ .get()) { vertex_array_manager_->Destroy(have_context); vertex_array_manager_.reset(); } if (image_manager_.get()) { image_manager_->Destroy(have_context); image_manager_.reset(); } offscreen_target_frame_buffer_.reset(); offscreen_target_color_texture_.reset(); offscreen_target_color_render_buffer_.reset(); offscreen_target_depth_render_buffer_.reset(); offscreen_target_stencil_render_buffer_.reset(); offscreen_saved_frame_buffer_.reset(); offscreen_saved_color_texture_.reset(); offscreen_resolved_frame_buffer_.reset(); offscreen_resolved_color_texture_.reset(); // Need to release these before releasing |group_| which may own the // ShaderTranslatorCache. fragment_translator_ = NULL; vertex_translator_ = NULL; // Should destroy the transfer manager before the texture manager held // by the context group. async_pixel_transfer_manager_.reset(); if (group_.get()) { framebuffer_manager()->RemoveObserver(this); group_->Destroy(this, have_context); group_ = NULL; } if (context_.get()) { context_->ReleaseCurrent(NULL); context_ = NULL; } #if defined(OS_MACOSX) for (TextureToIOSurfaceMap::iterator it = texture_to_io_surface_map_.begin(); it != texture_to_io_surface_map_.end(); ++it) { CFRelease(it->second); } texture_to_io_surface_map_.clear(); #endif } void GLES2DecoderImpl::SetSurface( const scoped_refptr<gfx::GLSurface>& surface) { DCHECK(context_->IsCurrent(NULL)); DCHECK(surface_.get()); surface_ = surface; RestoreCurrentFramebufferBindings(); } void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) { if (!offscreen_saved_color_texture_.get()) { LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context"; return; } if (!offscreen_saved_color_texture_info_.get()) { GLuint service_id = offscreen_saved_color_texture_->id(); offscreen_saved_color_texture_info_ = TextureRef::Create( texture_manager(), 0, service_id); texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(), GL_TEXTURE_2D); UpdateParentTextureInfo(); } mailbox_manager()->ProduceTexture( mailbox, offscreen_saved_color_texture_info_->texture()); } bool GLES2DecoderImpl::ResizeOffscreenFrameBuffer(const gfx::Size& size) { bool is_offscreen = !!offscreen_target_frame_buffer_.get(); if (!is_offscreen) { LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer called " << " with an onscreen framebuffer."; return false; } if (offscreen_size_ == size) return true; offscreen_size_ = size; int w = offscreen_size_.width(); int h = offscreen_size_.height(); if (w < 0 || h < 0 || h >= (INT_MAX / 4) / (w ? w : 1)) { LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " << "to allocate storage due to excessive dimensions."; return false; } // Reallocate the offscreen target buffers. DCHECK(offscreen_target_color_format_); if (IsOffscreenBufferMultisampled()) { if (!offscreen_target_color_render_buffer_->AllocateStorage( feature_info_.get(), offscreen_size_, offscreen_target_color_format_, offscreen_target_samples_)) { LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " << "to allocate storage for offscreen target color buffer."; return false; } } else { if (!offscreen_target_color_texture_->AllocateStorage( offscreen_size_, offscreen_target_color_format_, false)) { LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " << "to allocate storage for offscreen target color texture."; return false; } } if (offscreen_target_depth_format_ && !offscreen_target_depth_render_buffer_->AllocateStorage( feature_info_.get(), offscreen_size_, offscreen_target_depth_format_, offscreen_target_samples_)) { LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " << "to allocate storage for offscreen target depth buffer."; return false; } if (offscreen_target_stencil_format_ && !offscreen_target_stencil_render_buffer_->AllocateStorage( feature_info_.get(), offscreen_size_, offscreen_target_stencil_format_, offscreen_target_samples_)) { LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " << "to allocate storage for offscreen target stencil buffer."; return false; } // Attach the offscreen target buffers to the target frame buffer. if (IsOffscreenBufferMultisampled()) { offscreen_target_frame_buffer_->AttachRenderBuffer( GL_COLOR_ATTACHMENT0, offscreen_target_color_render_buffer_.get()); } else { offscreen_target_frame_buffer_->AttachRenderTexture( offscreen_target_color_texture_.get()); } if (offscreen_target_depth_format_) { offscreen_target_frame_buffer_->AttachRenderBuffer( GL_DEPTH_ATTACHMENT, offscreen_target_depth_render_buffer_.get()); } const bool packed_depth_stencil = offscreen_target_depth_format_ == GL_DEPTH24_STENCIL8; if (packed_depth_stencil) { offscreen_target_frame_buffer_->AttachRenderBuffer( GL_STENCIL_ATTACHMENT, offscreen_target_depth_render_buffer_.get()); } else if (offscreen_target_stencil_format_) { offscreen_target_frame_buffer_->AttachRenderBuffer( GL_STENCIL_ATTACHMENT, offscreen_target_stencil_render_buffer_.get()); } if (offscreen_target_frame_buffer_->CheckStatus() != GL_FRAMEBUFFER_COMPLETE) { LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " << "because offscreen FBO was incomplete."; return false; } // Clear the target frame buffer. { ScopedFrameBufferBinder binder(this, offscreen_target_frame_buffer_->id()); glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat( offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1.f); state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glClearStencil(0); state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask); state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask); glClearDepth(0); state_.SetDeviceDepthMask(GL_TRUE); state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); RestoreClearState(); } // Destroy the offscreen resolved framebuffers. if (offscreen_resolved_frame_buffer_.get()) offscreen_resolved_frame_buffer_->Destroy(); if (offscreen_resolved_color_texture_.get()) offscreen_resolved_color_texture_->Destroy(); offscreen_resolved_color_texture_.reset(); offscreen_resolved_frame_buffer_.reset(); return true; } error::Error GLES2DecoderImpl::HandleResizeCHROMIUM(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::ResizeCHROMIUM& c = *static_cast<const gles2::cmds::ResizeCHROMIUM*>(cmd_data); if (!offscreen_target_frame_buffer_.get() && surface_->DeferDraws()) return error::kDeferCommandUntilLater; GLuint width = static_cast<GLuint>(c.width); GLuint height = static_cast<GLuint>(c.height); GLfloat scale_factor = c.scale_factor; TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); width = std::max(1U, width); height = std::max(1U, height); #if defined(OS_POSIX) && !defined(OS_MACOSX) && \ !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) // Make sure that we are done drawing to the back buffer before resizing. glFinish(); #endif bool is_offscreen = !!offscreen_target_frame_buffer_.get(); if (is_offscreen) { if (!ResizeOffscreenFrameBuffer(gfx::Size(width, height))) { LOG(ERROR) << "GLES2DecoderImpl: Context lost because " << "ResizeOffscreenFrameBuffer failed."; return error::kLostContext; } } if (!resize_callback_.is_null()) { resize_callback_.Run(gfx::Size(width, height), scale_factor); DCHECK(context_->IsCurrent(surface_.get())); if (!context_->IsCurrent(surface_.get())) { LOG(ERROR) << "GLES2DecoderImpl: Context lost because context no longer " << "current after resize callback."; return error::kLostContext; } } return error::kNoError; } const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { if (command_id > kStartPoint && command_id < kNumCommands) { return gles2::GetCommandName(static_cast<CommandId>(command_id)); } return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); } // Decode a command, and call the corresponding GL functions. // NOTE: DoCommand() is slower than calling DoCommands() on larger batches // of commands at once, and is now only used for tests that need to track // individual commands. error::Error GLES2DecoderImpl::DoCommand(unsigned int command, unsigned int arg_count, const void* cmd_data) { return DoCommands(1, cmd_data, arg_count + 1, 0); } // Decode multiple commands, and call the corresponding GL functions. // NOTE: 'buffer' is a pointer to the command buffer. As such, it could be // changed by a (malicious) client at any time, so if validation has to happen, // it should operate on a copy of them. // NOTE: This is duplicating code from AsyncAPIInterface::DoCommands() in the // interest of performance in this critical execution loop. template <bool DebugImpl> error::Error GLES2DecoderImpl::DoCommandsImpl(unsigned int num_commands, const void* buffer, int num_entries, int* entries_processed) { commands_to_process_ = num_commands; error::Error result = error::kNoError; const CommandBufferEntry* cmd_data = static_cast<const CommandBufferEntry*>(buffer); int process_pos = 0; unsigned int command = 0; while (process_pos < num_entries && result == error::kNoError && commands_to_process_--) { const unsigned int size = cmd_data->value_header.size; command = cmd_data->value_header.command; if (size == 0) { result = error::kInvalidSize; break; } if (static_cast<int>(size) + process_pos > num_entries) { result = error::kOutOfBounds; break; } if (DebugImpl) { TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("cb_command"), GetCommandName(command)); if (log_commands()) { LOG(ERROR) << "[" << logger_.GetLogPrefix() << "]" << "cmd: " << GetCommandName(command); } } const unsigned int arg_count = size - 1; unsigned int command_index = command - kStartPoint - 1; if (command_index < arraysize(command_info)) { const CommandInfo& info = command_info[command_index]; unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count); if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) || (info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) { bool doing_gpu_trace = false; if (DebugImpl && gpu_trace_commands_) { if (CMD_FLAG_GET_TRACE_LEVEL(info.cmd_flags) <= gpu_trace_level_) { doing_gpu_trace = true; gpu_tracer_->Begin(TRACE_DISABLED_BY_DEFAULT("gpu_decoder"), GetCommandName(command), kTraceDecoder); } } uint32 immediate_data_size = (arg_count - info_arg_count) * sizeof(CommandBufferEntry); // NOLINT result = (this->*info.cmd_handler)(immediate_data_size, cmd_data); if (DebugImpl && doing_gpu_trace) gpu_tracer_->End(kTraceDecoder); if (DebugImpl && debug()) { GLenum error; while ((error = glGetError()) != GL_NO_ERROR) { LOG(ERROR) << "[" << logger_.GetLogPrefix() << "] " << "GL ERROR: " << GLES2Util::GetStringEnum(error) << " : " << GetCommandName(command); LOCAL_SET_GL_ERROR(error, "DoCommand", "GL error from driver"); } } } else { result = error::kInvalidArguments; } } else { result = DoCommonCommand(command, arg_count, cmd_data); } if (DebugImpl) { TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("cb_command"), GetCommandName(command)); } if (result == error::kNoError && current_decoder_error_ != error::kNoError) { result = current_decoder_error_; current_decoder_error_ = error::kNoError; } if (result != error::kDeferCommandUntilLater) { process_pos += size; cmd_data += size; } } if (entries_processed) *entries_processed = process_pos; if (error::IsError(result)) { LOG(ERROR) << "Error: " << result << " for Command " << GetCommandName(command); } return result; } error::Error GLES2DecoderImpl::DoCommands(unsigned int num_commands, const void* buffer, int num_entries, int* entries_processed) { if (gpu_debug_commands_) { return DoCommandsImpl<true>( num_commands, buffer, num_entries, entries_processed); } else { return DoCommandsImpl<false>( num_commands, buffer, num_entries, entries_processed); } } void GLES2DecoderImpl::RemoveBuffer(GLuint client_id) { buffer_manager()->RemoveBuffer(client_id); } void GLES2DecoderImpl::DoFinish() { glFinish(); ProcessPendingReadPixels(); ProcessPendingQueries(true); } void GLES2DecoderImpl::DoFlush() { glFlush(); ProcessPendingQueries(false); } void GLES2DecoderImpl::DoActiveTexture(GLenum texture_unit) { GLuint texture_index = texture_unit - GL_TEXTURE0; if (texture_index >= state_.texture_units.size()) { LOCAL_SET_GL_ERROR_INVALID_ENUM( "glActiveTexture", texture_unit, "texture_unit"); return; } state_.active_texture_unit = texture_index; glActiveTexture(texture_unit); } void GLES2DecoderImpl::DoBindBuffer(GLenum target, GLuint client_id) { Buffer* buffer = NULL; GLuint service_id = 0; if (client_id != 0) { buffer = GetBuffer(client_id); if (!buffer) { if (!group_->bind_generates_resource()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBindBuffer", "id not generated by glGenBuffers"); return; } // It's a new id so make a buffer buffer for it. glGenBuffersARB(1, &service_id); CreateBuffer(client_id, service_id); buffer = GetBuffer(client_id); } } LogClientServiceForInfo(buffer, client_id, "glBindBuffer"); if (buffer) { if (!buffer_manager()->SetTarget(buffer, target)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glBindBuffer", "buffer bound to more than 1 target"); return; } service_id = buffer->service_id(); } switch (target) { case GL_ARRAY_BUFFER: state_.bound_array_buffer = buffer; break; case GL_ELEMENT_ARRAY_BUFFER: state_.vertex_attrib_manager->SetElementArrayBuffer(buffer); break; default: NOTREACHED(); // Validation should prevent us getting here. break; } glBindBuffer(target, service_id); } bool GLES2DecoderImpl::BoundFramebufferHasColorAttachmentWithAlpha( bool all_draw_buffers) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); if (!all_draw_buffers || !framebuffer) { return (GLES2Util::GetChannelsForFormat( GetBoundDrawFrameBufferInternalFormat()) & 0x0008) != 0; } return framebuffer->HasAlphaMRT(); } bool GLES2DecoderImpl::BoundFramebufferHasDepthAttachment() { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); if (framebuffer) { return framebuffer->HasDepthAttachment(); } if (offscreen_target_frame_buffer_.get()) { return offscreen_target_depth_format_ != 0; } return back_buffer_has_depth_; } bool GLES2DecoderImpl::BoundFramebufferHasStencilAttachment() { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); if (framebuffer) { return framebuffer->HasStencilAttachment(); } if (offscreen_target_frame_buffer_.get()) { return offscreen_target_stencil_format_ != 0 || offscreen_target_depth_format_ == GL_DEPTH24_STENCIL8; } return back_buffer_has_stencil_; } void GLES2DecoderImpl::ApplyDirtyState() { if (framebuffer_state_.clear_state_dirty) { bool have_alpha = BoundFramebufferHasColorAttachmentWithAlpha(true); state_.SetDeviceColorMask(state_.color_mask_red, state_.color_mask_green, state_.color_mask_blue, state_.color_mask_alpha && have_alpha); bool have_depth = BoundFramebufferHasDepthAttachment(); state_.SetDeviceDepthMask(state_.depth_mask && have_depth); bool have_stencil = BoundFramebufferHasStencilAttachment(); state_.SetDeviceStencilMaskSeparate( GL_FRONT, have_stencil ? state_.stencil_front_writemask : 0); state_.SetDeviceStencilMaskSeparate( GL_BACK, have_stencil ? state_.stencil_back_writemask : 0); state_.SetDeviceCapabilityState( GL_DEPTH_TEST, state_.enable_flags.depth_test && have_depth); state_.SetDeviceCapabilityState( GL_STENCIL_TEST, state_.enable_flags.stencil_test && have_stencil); framebuffer_state_.clear_state_dirty = false; } } GLuint GLES2DecoderImpl::GetBackbufferServiceId() const { return (offscreen_target_frame_buffer_.get()) ? offscreen_target_frame_buffer_->id() : (surface_.get() ? surface_->GetBackingFrameBufferObject() : 0); } void GLES2DecoderImpl::RestoreState(const ContextState* prev_state) { TRACE_EVENT1("gpu", "GLES2DecoderImpl::RestoreState", "context", logger_.GetLogPrefix()); // Restore the Framebuffer first because of bugs in Intel drivers. // Intel drivers incorrectly clip the viewport settings to // the size of the current framebuffer object. RestoreFramebufferBindings(); state_.RestoreState(prev_state); } void GLES2DecoderImpl::RestoreFramebufferBindings() const { GLuint service_id = framebuffer_state_.bound_draw_framebuffer.get() ? framebuffer_state_.bound_draw_framebuffer->service_id() : GetBackbufferServiceId(); if (!features().chromium_framebuffer_multisample) { glBindFramebufferEXT(GL_FRAMEBUFFER, service_id); } else { glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, service_id); service_id = framebuffer_state_.bound_read_framebuffer.get() ? framebuffer_state_.bound_read_framebuffer->service_id() : GetBackbufferServiceId(); glBindFramebufferEXT(GL_READ_FRAMEBUFFER, service_id); } OnFboChanged(); } void GLES2DecoderImpl::RestoreRenderbufferBindings() { state_.RestoreRenderbufferBindings(); } void GLES2DecoderImpl::RestoreTextureState(unsigned service_id) const { Texture* texture = texture_manager()->GetTextureForServiceId(service_id); if (texture) { GLenum target = texture->target(); glBindTexture(target, service_id); glTexParameteri( target, GL_TEXTURE_WRAP_S, texture->wrap_s()); glTexParameteri( target, GL_TEXTURE_WRAP_T, texture->wrap_t()); glTexParameteri( target, GL_TEXTURE_MIN_FILTER, texture->min_filter()); glTexParameteri( target, GL_TEXTURE_MAG_FILTER, texture->mag_filter()); RestoreTextureUnitBindings(state_.active_texture_unit); } } void GLES2DecoderImpl::ClearAllAttributes() const { // Must use native VAO 0, as RestoreAllAttributes can't fully restore // other VAOs. if (feature_info_->feature_flags().native_vertex_array_object) glBindVertexArrayOES(0); for (uint32 i = 0; i < group_->max_vertex_attribs(); ++i) { if (i != 0) // Never disable attribute 0 glDisableVertexAttribArray(i); if(features().angle_instanced_arrays) glVertexAttribDivisorANGLE(i, 0); } } void GLES2DecoderImpl::RestoreAllAttributes() const { state_.RestoreVertexAttribs(); } void GLES2DecoderImpl::SetIgnoreCachedStateForTest(bool ignore) { state_.SetIgnoreCachedStateForTest(ignore); } void GLES2DecoderImpl::OnFboChanged() const { if (workarounds().restore_scissor_on_fbo_change) state_.fbo_binding_for_scissor_workaround_dirty_ = true; if (workarounds().gl_begin_gl_end_on_fbo_change_to_backbuffer) { GLint bound_fbo_unsigned = -1; glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &bound_fbo_unsigned); GLuint bound_fbo = static_cast<GLuint>(bound_fbo_unsigned); if (surface_ && surface_->GetBackingFrameBufferObject() == bound_fbo) surface_->NotifyWasBound(); } } // Called after the FBO is checked for completeness. void GLES2DecoderImpl::OnUseFramebuffer() const { if (state_.fbo_binding_for_scissor_workaround_dirty_) { state_.fbo_binding_for_scissor_workaround_dirty_ = false; // The driver forgets the correct scissor when modifying the FBO binding. glScissor(state_.scissor_x, state_.scissor_y, state_.scissor_width, state_.scissor_height); // crbug.com/222018 - Also on QualComm, the flush here avoids flicker, // it's unclear how this bug works. glFlush(); } } void GLES2DecoderImpl::DoBindFramebuffer(GLenum target, GLuint client_id) { Framebuffer* framebuffer = NULL; GLuint service_id = 0; if (client_id != 0) { framebuffer = GetFramebuffer(client_id); if (!framebuffer) { if (!group_->bind_generates_resource()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBindFramebuffer", "id not generated by glGenFramebuffers"); return; } // It's a new id so make a framebuffer framebuffer for it. glGenFramebuffersEXT(1, &service_id); CreateFramebuffer(client_id, service_id); framebuffer = GetFramebuffer(client_id); } else { service_id = framebuffer->service_id(); } framebuffer->MarkAsValid(); } LogClientServiceForInfo(framebuffer, client_id, "glBindFramebuffer"); if (target == GL_FRAMEBUFFER || target == GL_DRAW_FRAMEBUFFER_EXT) { framebuffer_state_.bound_draw_framebuffer = framebuffer; } // vmiura: This looks like dup code if (target == GL_FRAMEBUFFER || target == GL_READ_FRAMEBUFFER_EXT) { framebuffer_state_.bound_read_framebuffer = framebuffer; } framebuffer_state_.clear_state_dirty = true; // If we are rendering to the backbuffer get the FBO id for any simulated // backbuffer. if (framebuffer == NULL) { service_id = GetBackbufferServiceId(); } glBindFramebufferEXT(target, service_id); OnFboChanged(); } void GLES2DecoderImpl::DoBindRenderbuffer(GLenum target, GLuint client_id) { Renderbuffer* renderbuffer = NULL; GLuint service_id = 0; if (client_id != 0) { renderbuffer = GetRenderbuffer(client_id); if (!renderbuffer) { if (!group_->bind_generates_resource()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBindRenderbuffer", "id not generated by glGenRenderbuffers"); return; } // It's a new id so make a renderbuffer for it. glGenRenderbuffersEXT(1, &service_id); CreateRenderbuffer(client_id, service_id); renderbuffer = GetRenderbuffer(client_id); } else { service_id = renderbuffer->service_id(); } renderbuffer->MarkAsValid(); } LogClientServiceForInfo(renderbuffer, client_id, "glBindRenderbuffer"); state_.bound_renderbuffer = renderbuffer; state_.bound_renderbuffer_valid = true; glBindRenderbufferEXT(GL_RENDERBUFFER, service_id); } void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) { TextureRef* texture_ref = NULL; GLuint service_id = 0; if (client_id != 0) { texture_ref = GetTexture(client_id); if (!texture_ref) { if (!group_->bind_generates_resource()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBindTexture", "id not generated by glGenTextures"); return; } // It's a new id so make a texture texture for it. glGenTextures(1, &service_id); DCHECK_NE(0u, service_id); CreateTexture(client_id, service_id); texture_ref = GetTexture(client_id); } } else { texture_ref = texture_manager()->GetDefaultTextureInfo(target); } // Check the texture exists if (texture_ref) { Texture* texture = texture_ref->texture(); // Check that we are not trying to bind it to a different target. if (texture->target() != 0 && texture->target() != target) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBindTexture", "texture bound to more than 1 target."); return; } LogClientServiceForInfo(texture, client_id, "glBindTexture"); if (texture->target() == 0) { texture_manager()->SetTarget(texture_ref, target); } glBindTexture(target, texture->service_id()); } else { glBindTexture(target, 0); } TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; unit.bind_target = target; switch (target) { case GL_TEXTURE_2D: unit.bound_texture_2d = texture_ref; break; case GL_TEXTURE_CUBE_MAP: unit.bound_texture_cube_map = texture_ref; break; case GL_TEXTURE_EXTERNAL_OES: unit.bound_texture_external_oes = texture_ref; break; case GL_TEXTURE_RECTANGLE_ARB: unit.bound_texture_rectangle_arb = texture_ref; break; default: NOTREACHED(); // Validation should prevent us getting here. break; } } void GLES2DecoderImpl::DoDisableVertexAttribArray(GLuint index) { if (state_.vertex_attrib_manager->Enable(index, false)) { if (index != 0 || gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) { glDisableVertexAttribArray(index); } } else { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glDisableVertexAttribArray", "index out of range"); } } void GLES2DecoderImpl::DoDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments) { if (workarounds().disable_fbo_invalidations) return; Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); // Validates the attachments. If one of them fails // the whole command fails. for (GLsizei i = 0; i < numAttachments; ++i) { if ((framebuffer && !validators_->attachment.IsValid(attachments[i])) || (!framebuffer && !validators_->backbuffer_attachment.IsValid(attachments[i]))) { LOCAL_SET_GL_ERROR_INVALID_ENUM( "glDiscardFramebufferEXT", attachments[i], "attachments"); return; } } // Marks each one of them as not cleared for (GLsizei i = 0; i < numAttachments; ++i) { if (framebuffer) { framebuffer->MarkAttachmentAsCleared(renderbuffer_manager(), texture_manager(), attachments[i], false); } else { switch (attachments[i]) { case GL_COLOR_EXT: backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT; break; case GL_DEPTH_EXT: backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT; case GL_STENCIL_EXT: backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT; break; default: NOTREACHED(); break; } } } // If the default framebuffer is bound but we are still rendering to an // FBO, translate attachment names that refer to default framebuffer // channels to corresponding framebuffer attachments. scoped_ptr<GLenum[]> translated_attachments(new GLenum[numAttachments]); for (GLsizei i = 0; i < numAttachments; ++i) { GLenum attachment = attachments[i]; if (!framebuffer && GetBackbufferServiceId()) { switch (attachment) { case GL_COLOR_EXT: attachment = GL_COLOR_ATTACHMENT0; break; case GL_DEPTH_EXT: attachment = GL_DEPTH_ATTACHMENT; break; case GL_STENCIL_EXT: attachment = GL_STENCIL_ATTACHMENT; break; default: NOTREACHED(); return; } } translated_attachments[i] = attachment; } ScopedRenderTo do_render(framebuffer); if (feature_info_->gl_version_info().is_es3) { glInvalidateFramebuffer( target, numAttachments, translated_attachments.get()); } else { glDiscardFramebufferEXT( target, numAttachments, translated_attachments.get()); } } void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) { if (state_.vertex_attrib_manager->Enable(index, true)) { glEnableVertexAttribArray(index); } else { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glEnableVertexAttribArray", "index out of range"); } } void GLES2DecoderImpl::DoGenerateMipmap(GLenum target) { TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref || !texture_manager()->CanGenerateMipmaps(texture_ref)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glGenerateMipmap", "Can not generate mips"); return; } if (target == GL_TEXTURE_CUBE_MAP) { for (int i = 0; i < 6; ++i) { GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i; if (!texture_manager()->ClearTextureLevel(this, texture_ref, face, 0)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glGenerateMipmap", "dimensions too big"); return; } } } else { if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, 0)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glGenerateMipmap", "dimensions too big"); return; } } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glGenerateMipmap"); // Workaround for Mac driver bug. In the large scheme of things setting // glTexParamter twice for glGenerateMipmap is probably not a lage performance // hit so there's probably no need to make this conditional. The bug appears // to be that if the filtering mode is set to something that doesn't require // mipmaps for rendering, or is never set to something other than the default, // then glGenerateMipmap misbehaves. if (workarounds().set_texture_filter_before_generating_mipmap) { glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); } glGenerateMipmapEXT(target); if (workarounds().set_texture_filter_before_generating_mipmap) { glTexParameteri(target, GL_TEXTURE_MIN_FILTER, texture_ref->texture()->min_filter()); } GLenum error = LOCAL_PEEK_GL_ERROR("glGenerateMipmap"); if (error == GL_NO_ERROR) { texture_manager()->MarkMipmapsGenerated(texture_ref); } } bool GLES2DecoderImpl::GetHelper( GLenum pname, GLint* params, GLsizei* num_written) { DCHECK(num_written); if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { switch (pname) { case GL_IMPLEMENTATION_COLOR_READ_FORMAT: *num_written = 1; // Return the GL implementation's preferred format and (see below type) // if we have the GL extension that exposes this. This allows the GPU // client to use the implementation's preferred format for glReadPixels // for optimisation. // // A conflicting extension (GL_ARB_ES2_compatibility) specifies an error // case when requested on integer/floating point buffers but which is // acceptable on GLES2 and with the GL_OES_read_format extension. // // Therefore if an error occurs we swallow the error and use the // internal implementation. if (params) { if (context_->HasExtension("GL_OES_read_format")) { ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", GetErrorState()); glGetIntegerv(pname, params); if (glGetError() == GL_NO_ERROR) return true; } *params = GLES2Util::GetPreferredGLReadPixelsFormat( GetBoundReadFrameBufferInternalFormat()); } return true; case GL_IMPLEMENTATION_COLOR_READ_TYPE: *num_written = 1; if (params) { if (context_->HasExtension("GL_OES_read_format")) { ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", GetErrorState()); glGetIntegerv(pname, params); if (glGetError() == GL_NO_ERROR) return true; } *params = GLES2Util::GetPreferredGLReadPixelsType( GetBoundReadFrameBufferInternalFormat(), GetBoundReadFrameBufferTextureType()); } return true; case GL_MAX_FRAGMENT_UNIFORM_VECTORS: *num_written = 1; if (params) { *params = group_->max_fragment_uniform_vectors(); } return true; case GL_MAX_VARYING_VECTORS: *num_written = 1; if (params) { *params = group_->max_varying_vectors(); } return true; case GL_MAX_VERTEX_UNIFORM_VECTORS: *num_written = 1; if (params) { *params = group_->max_vertex_uniform_vectors(); } return true; } } switch (pname) { case GL_MAX_VIEWPORT_DIMS: if (offscreen_target_frame_buffer_.get()) { *num_written = 2; if (params) { params[0] = renderbuffer_manager()->max_renderbuffer_size(); params[1] = renderbuffer_manager()->max_renderbuffer_size(); } return true; } return false; case GL_MAX_SAMPLES: *num_written = 1; if (params) { params[0] = renderbuffer_manager()->max_samples(); } return true; case GL_MAX_RENDERBUFFER_SIZE: *num_written = 1; if (params) { params[0] = renderbuffer_manager()->max_renderbuffer_size(); } return true; case GL_MAX_TEXTURE_SIZE: *num_written = 1; if (params) { params[0] = texture_manager()->MaxSizeForTarget(GL_TEXTURE_2D); } return true; case GL_MAX_CUBE_MAP_TEXTURE_SIZE: *num_written = 1; if (params) { params[0] = texture_manager()->MaxSizeForTarget(GL_TEXTURE_CUBE_MAP); } return true; case GL_MAX_COLOR_ATTACHMENTS_EXT: *num_written = 1; if (params) { params[0] = group_->max_color_attachments(); } return true; case GL_MAX_DRAW_BUFFERS_ARB: *num_written = 1; if (params) { params[0] = group_->max_draw_buffers(); } return true; case GL_ALPHA_BITS: *num_written = 1; if (params) { GLint v = 0; glGetIntegerv(GL_ALPHA_BITS, &v); params[0] = BoundFramebufferHasColorAttachmentWithAlpha(false) ? v : 0; } return true; case GL_DEPTH_BITS: *num_written = 1; if (params) { GLint v = 0; glGetIntegerv(GL_DEPTH_BITS, &v); params[0] = BoundFramebufferHasDepthAttachment() ? v : 0; } return true; case GL_STENCIL_BITS: *num_written = 1; if (params) { GLint v = 0; glGetIntegerv(GL_STENCIL_BITS, &v); params[0] = BoundFramebufferHasStencilAttachment() ? v : 0; } return true; case GL_COMPRESSED_TEXTURE_FORMATS: *num_written = validators_->compressed_texture_format.GetValues().size(); if (params) { for (GLint ii = 0; ii < *num_written; ++ii) { params[ii] = validators_->compressed_texture_format.GetValues()[ii]; } } return true; case GL_NUM_COMPRESSED_TEXTURE_FORMATS: *num_written = 1; if (params) { *params = validators_->compressed_texture_format.GetValues().size(); } return true; case GL_NUM_SHADER_BINARY_FORMATS: *num_written = 1; if (params) { *params = validators_->shader_binary_format.GetValues().size(); } return true; case GL_SHADER_BINARY_FORMATS: *num_written = validators_->shader_binary_format.GetValues().size(); if (params) { for (GLint ii = 0; ii < *num_written; ++ii) { params[ii] = validators_->shader_binary_format.GetValues()[ii]; } } return true; case GL_SHADER_COMPILER: *num_written = 1; if (params) { *params = GL_TRUE; } return true; case GL_ARRAY_BUFFER_BINDING: *num_written = 1; if (params) { if (state_.bound_array_buffer.get()) { GLuint client_id = 0; buffer_manager()->GetClientId(state_.bound_array_buffer->service_id(), &client_id); *params = client_id; } else { *params = 0; } } return true; case GL_ELEMENT_ARRAY_BUFFER_BINDING: *num_written = 1; if (params) { if (state_.vertex_attrib_manager->element_array_buffer()) { GLuint client_id = 0; buffer_manager()->GetClientId( state_.vertex_attrib_manager->element_array_buffer()-> service_id(), &client_id); *params = client_id; } else { *params = 0; } } return true; case GL_FRAMEBUFFER_BINDING: // case GL_DRAW_FRAMEBUFFER_BINDING_EXT: (same as GL_FRAMEBUFFER_BINDING) *num_written = 1; if (params) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); if (framebuffer) { GLuint client_id = 0; framebuffer_manager()->GetClientId( framebuffer->service_id(), &client_id); *params = client_id; } else { *params = 0; } } return true; case GL_READ_FRAMEBUFFER_BINDING_EXT: *num_written = 1; if (params) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT); if (framebuffer) { GLuint client_id = 0; framebuffer_manager()->GetClientId( framebuffer->service_id(), &client_id); *params = client_id; } else { *params = 0; } } return true; case GL_RENDERBUFFER_BINDING: *num_written = 1; if (params) { Renderbuffer* renderbuffer = GetRenderbufferInfoForTarget(GL_RENDERBUFFER); if (renderbuffer) { *params = renderbuffer->client_id(); } else { *params = 0; } } return true; case GL_CURRENT_PROGRAM: *num_written = 1; if (params) { if (state_.current_program.get()) { GLuint client_id = 0; program_manager()->GetClientId( state_.current_program->service_id(), &client_id); *params = client_id; } else { *params = 0; } } return true; case GL_VERTEX_ARRAY_BINDING_OES: *num_written = 1; if (params) { if (state_.vertex_attrib_manager.get() != state_.default_vertex_attrib_manager.get()) { GLuint client_id = 0; vertex_array_manager_->GetClientId( state_.vertex_attrib_manager->service_id(), &client_id); *params = client_id; } else { *params = 0; } } return true; case GL_TEXTURE_BINDING_2D: *num_written = 1; if (params) { TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; if (unit.bound_texture_2d.get()) { *params = unit.bound_texture_2d->client_id(); } else { *params = 0; } } return true; case GL_TEXTURE_BINDING_CUBE_MAP: *num_written = 1; if (params) { TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; if (unit.bound_texture_cube_map.get()) { *params = unit.bound_texture_cube_map->client_id(); } else { *params = 0; } } return true; case GL_TEXTURE_BINDING_EXTERNAL_OES: *num_written = 1; if (params) { TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; if (unit.bound_texture_external_oes.get()) { *params = unit.bound_texture_external_oes->client_id(); } else { *params = 0; } } return true; case GL_TEXTURE_BINDING_RECTANGLE_ARB: *num_written = 1; if (params) { TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; if (unit.bound_texture_rectangle_arb.get()) { *params = unit.bound_texture_rectangle_arb->client_id(); } else { *params = 0; } } return true; case GL_UNPACK_FLIP_Y_CHROMIUM: *num_written = 1; if (params) { params[0] = unpack_flip_y_; } return true; case GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM: *num_written = 1; if (params) { params[0] = unpack_premultiply_alpha_; } return true; case GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM: *num_written = 1; if (params) { params[0] = unpack_unpremultiply_alpha_; } return true; case GL_BIND_GENERATES_RESOURCE_CHROMIUM: *num_written = 1; if (params) { params[0] = group_->bind_generates_resource() ? 1 : 0; } return true; default: if (pname >= GL_DRAW_BUFFER0_ARB && pname < GL_DRAW_BUFFER0_ARB + group_->max_draw_buffers()) { *num_written = 1; if (params) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); if (framebuffer) { params[0] = framebuffer->GetDrawBuffer(pname); } else { // backbuffer if (pname == GL_DRAW_BUFFER0_ARB) params[0] = group_->draw_buffer(); else params[0] = GL_NONE; } } return true; } *num_written = util_.GLGetNumValuesReturned(pname); return false; } } bool GLES2DecoderImpl::GetNumValuesReturnedForGLGet( GLenum pname, GLsizei* num_values) { if (state_.GetStateAsGLint(pname, NULL, num_values)) { return true; } return GetHelper(pname, NULL, num_values); } GLenum GLES2DecoderImpl::AdjustGetPname(GLenum pname) { if (GL_MAX_SAMPLES == pname && features().use_img_for_multisampled_render_to_texture) { return GL_MAX_SAMPLES_IMG; } return pname; } void GLES2DecoderImpl::DoGetBooleanv(GLenum pname, GLboolean* params) { DCHECK(params); GLsizei num_written = 0; if (GetNumValuesReturnedForGLGet(pname, &num_written)) { scoped_ptr<GLint[]> values(new GLint[num_written]); if (!state_.GetStateAsGLint(pname, values.get(), &num_written)) { GetHelper(pname, values.get(), &num_written); } for (GLsizei ii = 0; ii < num_written; ++ii) { params[ii] = static_cast<GLboolean>(values[ii]); } } else { pname = AdjustGetPname(pname); glGetBooleanv(pname, params); } } void GLES2DecoderImpl::DoGetFloatv(GLenum pname, GLfloat* params) { DCHECK(params); GLsizei num_written = 0; if (!state_.GetStateAsGLfloat(pname, params, &num_written)) { if (GetHelper(pname, NULL, &num_written)) { scoped_ptr<GLint[]> values(new GLint[num_written]); GetHelper(pname, values.get(), &num_written); for (GLsizei ii = 0; ii < num_written; ++ii) { params[ii] = static_cast<GLfloat>(values[ii]); } } else { pname = AdjustGetPname(pname); glGetFloatv(pname, params); } } } void GLES2DecoderImpl::DoGetIntegerv(GLenum pname, GLint* params) { DCHECK(params); GLsizei num_written; if (!state_.GetStateAsGLint(pname, params, &num_written) && !GetHelper(pname, params, &num_written)) { pname = AdjustGetPname(pname); glGetIntegerv(pname, params); } } void GLES2DecoderImpl::DoGetProgramiv( GLuint program_id, GLenum pname, GLint* params) { Program* program = GetProgramInfoNotShader(program_id, "glGetProgramiv"); if (!program) { return; } program->GetProgramiv(pname, params); } void GLES2DecoderImpl::DoGetBufferParameteriv( GLenum target, GLenum pname, GLint* params) { // Just delegate it. Some validation is actually done before this. buffer_manager()->ValidateAndDoGetBufferParameteriv( &state_, target, pname, params); } void GLES2DecoderImpl::DoBindAttribLocation( GLuint program_id, GLuint index, const char* name) { if (!StringIsValidForGLES(name)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glBindAttribLocation", "Invalid character"); return; } if (ProgramManager::IsInvalidPrefix(name, strlen(name))) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glBindAttribLocation", "reserved prefix"); return; } if (index >= group_->max_vertex_attribs()) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glBindAttribLocation", "index out of range"); return; } Program* program = GetProgramInfoNotShader( program_id, "glBindAttribLocation"); if (!program) { return; } // At this point, the program's shaders may not be translated yet, // therefore, we may not find the hashed attribute name. // glBindAttribLocation call with original name is useless. // So instead, we should simply cache the binding, and then call // Program::ExecuteBindAttribLocationCalls() right before link. program->SetAttribLocationBinding(name, static_cast<GLint>(index)); // TODO(zmo): Get rid of the following glBindAttribLocation call. glBindAttribLocation(program->service_id(), index, name); } error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::BindAttribLocationBucket& c = *static_cast<const gles2::cmds::BindAttribLocationBucket*>(cmd_data); GLuint program = static_cast<GLuint>(c.program); GLuint index = static_cast<GLuint>(c.index); Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket || bucket->size() == 0) { return error::kInvalidArguments; } std::string name_str; if (!bucket->GetAsString(&name_str)) { return error::kInvalidArguments; } DoBindAttribLocation(program, index, name_str.c_str()); return error::kNoError; } void GLES2DecoderImpl::DoBindUniformLocationCHROMIUM( GLuint program_id, GLint location, const char* name) { if (!StringIsValidForGLES(name)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glBindUniformLocationCHROMIUM", "Invalid character"); return; } if (ProgramManager::IsInvalidPrefix(name, strlen(name))) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glBindUniformLocationCHROMIUM", "reserved prefix"); return; } if (location < 0 || static_cast<uint32>(location) >= (group_->max_fragment_uniform_vectors() + group_->max_vertex_uniform_vectors()) * 4) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glBindUniformLocationCHROMIUM", "location out of range"); return; } Program* program = GetProgramInfoNotShader( program_id, "glBindUniformLocationCHROMIUM"); if (!program) { return; } if (!program->SetUniformLocationBinding(name, location)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glBindUniformLocationCHROMIUM", "location out of range"); } } error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::BindUniformLocationCHROMIUMBucket& c = *static_cast<const gles2::cmds::BindUniformLocationCHROMIUMBucket*>( cmd_data); GLuint program = static_cast<GLuint>(c.program); GLint location = static_cast<GLint>(c.location); Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket || bucket->size() == 0) { return error::kInvalidArguments; } std::string name_str; if (!bucket->GetAsString(&name_str)) { return error::kInvalidArguments; } DoBindUniformLocationCHROMIUM(program, location, name_str.c_str()); return error::kNoError; } error::Error GLES2DecoderImpl::HandleDeleteShader(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::DeleteShader& c = *static_cast<const gles2::cmds::DeleteShader*>(cmd_data); GLuint client_id = c.shader; if (client_id) { Shader* shader = GetShader(client_id); if (shader) { if (!shader->IsDeleted()) { shader_manager()->Delete(shader); } } else { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glDeleteShader", "unknown shader"); } } return error::kNoError; } error::Error GLES2DecoderImpl::HandleDeleteProgram(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::DeleteProgram& c = *static_cast<const gles2::cmds::DeleteProgram*>(cmd_data); GLuint client_id = c.program; if (client_id) { Program* program = GetProgram(client_id); if (program) { if (!program->IsDeleted()) { program_manager()->MarkAsDeleted(shader_manager(), program); } } else { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glDeleteProgram", "unknown program"); } } return error::kNoError; } error::Error GLES2DecoderImpl::DoClear(GLbitfield mask) { DCHECK(!ShouldDeferDraws()); if (CheckBoundFramebuffersValid("glClear")) { ApplyDirtyState(); ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get()); if (workarounds().gl_clear_broken) { ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::ClearWorkaround", GetErrorState()); if (!BoundFramebufferHasDepthAttachment()) mask &= ~GL_DEPTH_BUFFER_BIT; if (!BoundFramebufferHasStencilAttachment()) mask &= ~GL_STENCIL_BUFFER_BIT; clear_framebuffer_blit_->ClearFramebuffer( this, GetBoundReadFrameBufferSize(), mask, state_.color_clear_red, state_.color_clear_green, state_.color_clear_blue, state_.color_clear_alpha, state_.depth_clear, state_.stencil_clear); return error::kNoError; } glClear(mask); } return error::kNoError; } void GLES2DecoderImpl::DoFramebufferRenderbuffer( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint client_renderbuffer_id) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); if (!framebuffer) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glFramebufferRenderbuffer", "no framebuffer bound"); return; } GLuint service_id = 0; Renderbuffer* renderbuffer = NULL; if (client_renderbuffer_id) { renderbuffer = GetRenderbuffer(client_renderbuffer_id); if (!renderbuffer) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glFramebufferRenderbuffer", "unknown renderbuffer"); return; } service_id = renderbuffer->service_id(); } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glFramebufferRenderbuffer"); glFramebufferRenderbufferEXT( target, attachment, renderbuffertarget, service_id); GLenum error = LOCAL_PEEK_GL_ERROR("glFramebufferRenderbuffer"); if (error == GL_NO_ERROR) { framebuffer->AttachRenderbuffer(attachment, renderbuffer); } if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { framebuffer_state_.clear_state_dirty = true; } OnFboChanged(); } void GLES2DecoderImpl::DoDisable(GLenum cap) { if (SetCapabilityState(cap, false)) { glDisable(cap); } } void GLES2DecoderImpl::DoEnable(GLenum cap) { if (SetCapabilityState(cap, true)) { glEnable(cap); } } void GLES2DecoderImpl::DoDepthRangef(GLclampf znear, GLclampf zfar) { state_.z_near = std::min(1.0f, std::max(0.0f, znear)); state_.z_far = std::min(1.0f, std::max(0.0f, zfar)); glDepthRange(znear, zfar); } void GLES2DecoderImpl::DoSampleCoverage(GLclampf value, GLboolean invert) { state_.sample_coverage_value = std::min(1.0f, std::max(0.0f, value)); state_.sample_coverage_invert = (invert != 0); glSampleCoverage(state_.sample_coverage_value, invert); } // Assumes framebuffer is complete. void GLES2DecoderImpl::ClearUnclearedAttachments( GLenum target, Framebuffer* framebuffer) { if (target == GL_READ_FRAMEBUFFER_EXT) { // bind this to the DRAW point, clear then bind back to READ // TODO(gman): I don't think there is any guarantee that an FBO that // is complete on the READ attachment will be complete as a DRAW // attachment. glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, framebuffer->service_id()); } GLbitfield clear_bits = 0; if (framebuffer->HasUnclearedColorAttachments()) { glClearColor( 0.0f, 0.0f, 0.0f, (GLES2Util::GetChannelsForFormat( framebuffer->GetColorAttachmentFormat()) & 0x0008) != 0 ? 0.0f : 1.0f); state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); clear_bits |= GL_COLOR_BUFFER_BIT; if (feature_info_->feature_flags().ext_draw_buffers) framebuffer->PrepareDrawBuffersForClear(); } if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) || framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { glClearStencil(0); state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask); state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask); clear_bits |= GL_STENCIL_BUFFER_BIT; } if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) || framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { glClearDepth(1.0f); state_.SetDeviceDepthMask(GL_TRUE); clear_bits |= GL_DEPTH_BUFFER_BIT; } state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); glClear(clear_bits); if ((clear_bits & GL_COLOR_BUFFER_BIT) != 0 && feature_info_->feature_flags().ext_draw_buffers) framebuffer->RestoreDrawBuffersAfterClear(); framebuffer_manager()->MarkAttachmentsAsCleared( framebuffer, renderbuffer_manager(), texture_manager()); RestoreClearState(); if (target == GL_READ_FRAMEBUFFER_EXT) { glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, framebuffer->service_id()); Framebuffer* draw_framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); GLuint service_id = draw_framebuffer ? draw_framebuffer->service_id() : GetBackbufferServiceId(); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, service_id); } } void GLES2DecoderImpl::RestoreClearState() { framebuffer_state_.clear_state_dirty = true; glClearColor( state_.color_clear_red, state_.color_clear_green, state_.color_clear_blue, state_.color_clear_alpha); glClearStencil(state_.stencil_clear); glClearDepth(state_.depth_clear); if (state_.enable_flags.scissor_test) { state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, true); } } GLenum GLES2DecoderImpl::DoCheckFramebufferStatus(GLenum target) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); if (!framebuffer) { return GL_FRAMEBUFFER_COMPLETE; } GLenum completeness = framebuffer->IsPossiblyComplete(); if (completeness != GL_FRAMEBUFFER_COMPLETE) { return completeness; } return framebuffer->GetStatus(texture_manager(), target); } void GLES2DecoderImpl::DoFramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint client_texture_id, GLint level) { DoFramebufferTexture2DCommon( "glFramebufferTexture2D", target, attachment, textarget, client_texture_id, level, 0); } void GLES2DecoderImpl::DoFramebufferTexture2DMultisample( GLenum target, GLenum attachment, GLenum textarget, GLuint client_texture_id, GLint level, GLsizei samples) { DoFramebufferTexture2DCommon( "glFramebufferTexture2DMultisample", target, attachment, textarget, client_texture_id, level, samples); } void GLES2DecoderImpl::DoFramebufferTexture2DCommon( const char* name, GLenum target, GLenum attachment, GLenum textarget, GLuint client_texture_id, GLint level, GLsizei samples) { if (samples > renderbuffer_manager()->max_samples()) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glFramebufferTexture2DMultisample", "samples too large"); return; } Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); if (!framebuffer) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, name, "no framebuffer bound."); return; } GLuint service_id = 0; TextureRef* texture_ref = NULL; if (client_texture_id) { texture_ref = GetTexture(client_texture_id); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, name, "unknown texture_ref"); return; } service_id = texture_ref->service_id(); } if (!texture_manager()->ValidForTarget(textarget, level, 0, 0, 1)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, name, "level out of range"); return; } if (texture_ref) DoWillUseTexImageIfNeeded(texture_ref->texture(), textarget); LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(name); if (0 == samples) { glFramebufferTexture2DEXT(target, attachment, textarget, service_id, level); } else { if (features().use_img_for_multisampled_render_to_texture) { glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, service_id, level, samples); } else { glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, service_id, level, samples); } } GLenum error = LOCAL_PEEK_GL_ERROR(name); if (error == GL_NO_ERROR) { framebuffer->AttachTexture(attachment, texture_ref, textarget, level, samples); } if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { framebuffer_state_.clear_state_dirty = true; } if (texture_ref) DoDidUseTexImageIfNeeded(texture_ref->texture(), textarget); OnFboChanged(); } void GLES2DecoderImpl::DoFramebufferTextureLayer( GLenum target, GLenum attachment, GLuint client_texture_id, GLint level, GLint layer) { // TODO(zmo): Unsafe ES3 API, missing states update. GLuint service_id = 0; TextureRef* texture_ref = NULL; if (client_texture_id) { texture_ref = GetTexture(client_texture_id); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glFramebufferTextureLayer", "unknown texture_ref"); return; } service_id = texture_ref->service_id(); } glFramebufferTextureLayer(target, attachment, service_id, level, layer); } void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv( GLenum target, GLenum attachment, GLenum pname, GLint* params) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); if (!framebuffer) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glGetFramebufferAttachmentParameteriv", "no framebuffer bound"); return; } if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) { const Framebuffer::Attachment* attachment_object = framebuffer->GetAttachment(attachment); *params = attachment_object ? attachment_object->object_name() : 0; } else { if (pname == GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT && features().use_img_for_multisampled_render_to_texture) { pname = GL_TEXTURE_SAMPLES_IMG; } glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params); } } void GLES2DecoderImpl::DoGetRenderbufferParameteriv( GLenum target, GLenum pname, GLint* params) { Renderbuffer* renderbuffer = GetRenderbufferInfoForTarget(GL_RENDERBUFFER); if (!renderbuffer) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glGetRenderbufferParameteriv", "no renderbuffer bound"); return; } EnsureRenderbufferBound(); switch (pname) { case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer->internal_format(); break; case GL_RENDERBUFFER_WIDTH: *params = renderbuffer->width(); break; case GL_RENDERBUFFER_HEIGHT: *params = renderbuffer->height(); break; case GL_RENDERBUFFER_SAMPLES_EXT: if (features().use_img_for_multisampled_render_to_texture) { glGetRenderbufferParameterivEXT(target, GL_RENDERBUFFER_SAMPLES_IMG, params); } else { glGetRenderbufferParameterivEXT(target, GL_RENDERBUFFER_SAMPLES_EXT, params); } default: glGetRenderbufferParameterivEXT(target, pname, params); break; } } void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM( GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { DCHECK(!ShouldDeferReads() && !ShouldDeferDraws()); if (!CheckBoundFramebuffersValid("glBlitFramebufferCHROMIUM")) { return; } state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get()); BlitFramebufferHelper( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, state_.enable_flags.scissor_test); } void GLES2DecoderImpl::EnsureRenderbufferBound() { if (!state_.bound_renderbuffer_valid) { state_.bound_renderbuffer_valid = true; glBindRenderbufferEXT(GL_RENDERBUFFER, state_.bound_renderbuffer.get() ? state_.bound_renderbuffer->service_id() : 0); } } void GLES2DecoderImpl::RenderbufferStorageMultisampleHelper( const FeatureInfo* feature_info, GLenum target, GLsizei samples, GLenum internal_format, GLsizei width, GLsizei height) { // TODO(sievers): This could be resolved at the GL binding level, but the // binding process is currently a bit too 'brute force'. if (feature_info->gl_version_info().is_angle) { glRenderbufferStorageMultisampleANGLE( target, samples, internal_format, width, height); } else if (feature_info->feature_flags().use_core_framebuffer_multisample) { glRenderbufferStorageMultisample( target, samples, internal_format, width, height); } else { glRenderbufferStorageMultisampleEXT( target, samples, internal_format, width, height); } } void GLES2DecoderImpl::BlitFramebufferHelper(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { // TODO(sievers): This could be resolved at the GL binding level, but the // binding process is currently a bit too 'brute force'. if (feature_info_->gl_version_info().is_angle) { glBlitFramebufferANGLE( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } else if (feature_info_->feature_flags().use_core_framebuffer_multisample) { glBlitFramebuffer( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } else { glBlitFramebufferEXT( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } } bool GLES2DecoderImpl::ValidateRenderbufferStorageMultisample( GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { if (samples > renderbuffer_manager()->max_samples()) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glRenderbufferStorageMultisample", "samples too large"); return false; } if (width > renderbuffer_manager()->max_renderbuffer_size() || height > renderbuffer_manager()->max_renderbuffer_size()) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glRenderbufferStorageMultisample", "dimensions too large"); return false; } uint32 estimated_size = 0; if (!renderbuffer_manager()->ComputeEstimatedRenderbufferSize( width, height, samples, internalformat, &estimated_size)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glRenderbufferStorageMultisample", "dimensions too large"); return false; } if (!EnsureGPUMemoryAvailable(estimated_size)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glRenderbufferStorageMultisample", "out of memory"); return false; } return true; } void GLES2DecoderImpl::DoRenderbufferStorageMultisampleCHROMIUM( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { Renderbuffer* renderbuffer = GetRenderbufferInfoForTarget(GL_RENDERBUFFER); if (!renderbuffer) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glRenderbufferStorageMultisampleCHROMIUM", "no renderbuffer bound"); return; } if (!ValidateRenderbufferStorageMultisample( samples, internalformat, width, height)) { return; } EnsureRenderbufferBound(); GLenum impl_format = renderbuffer_manager()->InternalRenderbufferFormatToImplFormat( internalformat); LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER( "glRenderbufferStorageMultisampleCHROMIUM"); RenderbufferStorageMultisampleHelper( feature_info_.get(), target, samples, impl_format, width, height); GLenum error = LOCAL_PEEK_GL_ERROR("glRenderbufferStorageMultisampleCHROMIUM"); if (error == GL_NO_ERROR) { if (workarounds().validate_multisample_buffer_allocation) { if (!VerifyMultisampleRenderbufferIntegrity( renderbuffer->service_id(), impl_format)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glRenderbufferStorageMultisampleCHROMIUM", "out of memory"); return; } } // TODO(gman): If renderbuffers tracked which framebuffers they were // attached to we could just mark those framebuffers as not complete. framebuffer_manager()->IncFramebufferStateChangeCount(); renderbuffer_manager()->SetInfo( renderbuffer, samples, internalformat, width, height); } } // This is the handler for multisampled_render_to_texture extensions. void GLES2DecoderImpl::DoRenderbufferStorageMultisampleEXT( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { Renderbuffer* renderbuffer = GetRenderbufferInfoForTarget(GL_RENDERBUFFER); if (!renderbuffer) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glRenderbufferStorageMultisampleEXT", "no renderbuffer bound"); return; } if (!ValidateRenderbufferStorageMultisample( samples, internalformat, width, height)) { return; } EnsureRenderbufferBound(); GLenum impl_format = renderbuffer_manager()->InternalRenderbufferFormatToImplFormat( internalformat); LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glRenderbufferStorageMultisampleEXT"); if (features().use_img_for_multisampled_render_to_texture) { glRenderbufferStorageMultisampleIMG( target, samples, impl_format, width, height); } else { glRenderbufferStorageMultisampleEXT( target, samples, impl_format, width, height); } GLenum error = LOCAL_PEEK_GL_ERROR("glRenderbufferStorageMultisampleEXT"); if (error == GL_NO_ERROR) { // TODO(gman): If renderbuffers tracked which framebuffers they were // attached to we could just mark those framebuffers as not complete. framebuffer_manager()->IncFramebufferStateChangeCount(); renderbuffer_manager()->SetInfo( renderbuffer, samples, internalformat, width, height); } } // This function validates the allocation of a multisampled renderbuffer // by clearing it to a key color, blitting the contents to a texture, and // reading back the color to ensure it matches the key. bool GLES2DecoderImpl::VerifyMultisampleRenderbufferIntegrity( GLuint renderbuffer, GLenum format) { // Only validate color buffers. // These formats have been selected because they are very common or are known // to be used by the WebGL backbuffer. If problems are observed with other // color formats they can be added here. switch(format) { case GL_RGB: case GL_RGB8: case GL_RGBA: case GL_RGBA8: break; default: return true; } GLint draw_framebuffer, read_framebuffer; // Cache framebuffer and texture bindings. glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_framebuffer); glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &read_framebuffer); if (!validation_texture_) { GLint bound_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); // Create additional resources needed for the verification. glGenTextures(1, &validation_texture_); glGenFramebuffersEXT(1, &validation_fbo_multisample_); glGenFramebuffersEXT(1, &validation_fbo_); // Texture only needs to be 1x1. glBindTexture(GL_TEXTURE_2D, validation_texture_); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); glBindFramebufferEXT(GL_FRAMEBUFFER, validation_fbo_); glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, validation_texture_, 0); glBindTexture(GL_TEXTURE_2D, bound_texture); } glBindFramebufferEXT(GL_FRAMEBUFFER, validation_fbo_multisample_); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbuffer); // Cache current state and reset it to the values we require. GLboolean scissor_enabled = false; glGetBooleanv(GL_SCISSOR_TEST, &scissor_enabled); if (scissor_enabled) state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); GLboolean color_mask[4] = {GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE}; glGetBooleanv(GL_COLOR_WRITEMASK, color_mask); state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); GLfloat clear_color[4] = {0.0f, 0.0f, 0.0f, 0.0f}; glGetFloatv(GL_COLOR_CLEAR_VALUE, clear_color); glClearColor(1.0f, 0.0f, 1.0f, 1.0f); // Clear the buffer to the desired key color. glClear(GL_COLOR_BUFFER_BIT); // Blit from the multisample buffer to a standard texture. glBindFramebufferEXT(GL_READ_FRAMEBUFFER, validation_fbo_multisample_); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, validation_fbo_); BlitFramebufferHelper( 0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_NEAREST); // Read a pixel from the buffer. glBindFramebufferEXT(GL_FRAMEBUFFER, validation_fbo_); unsigned char pixel[3] = {0, 0, 0}; glReadPixels(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pixel); // Detach the renderbuffer. glBindFramebufferEXT(GL_FRAMEBUFFER, validation_fbo_multisample_); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0); // Restore cached state. if (scissor_enabled) state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, true); state_.SetDeviceColorMask( color_mask[0], color_mask[1], color_mask[2], color_mask[3]); glClearColor(clear_color[0], clear_color[1], clear_color[2], clear_color[3]); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, draw_framebuffer); glBindFramebufferEXT(GL_READ_FRAMEBUFFER, read_framebuffer); // Return true if the pixel matched the desired key color. return (pixel[0] == 0xFF && pixel[1] == 0x00 && pixel[2] == 0xFF); } void GLES2DecoderImpl::DoRenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { Renderbuffer* renderbuffer = GetRenderbufferInfoForTarget(GL_RENDERBUFFER); if (!renderbuffer) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glRenderbufferStorage", "no renderbuffer bound"); return; } if (width > renderbuffer_manager()->max_renderbuffer_size() || height > renderbuffer_manager()->max_renderbuffer_size()) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glRenderbufferStorage", "dimensions too large"); return; } uint32 estimated_size = 0; if (!renderbuffer_manager()->ComputeEstimatedRenderbufferSize( width, height, 1, internalformat, &estimated_size)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glRenderbufferStorage", "dimensions too large"); return; } if (!EnsureGPUMemoryAvailable(estimated_size)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glRenderbufferStorage", "out of memory"); return; } EnsureRenderbufferBound(); LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glRenderbufferStorage"); glRenderbufferStorageEXT( target, renderbuffer_manager()->InternalRenderbufferFormatToImplFormat( internalformat), width, height); GLenum error = LOCAL_PEEK_GL_ERROR("glRenderbufferStorage"); if (error == GL_NO_ERROR) { // TODO(gman): If tetxures tracked which framebuffers they were attached to // we could just mark those framebuffers as not complete. framebuffer_manager()->IncFramebufferStateChangeCount(); renderbuffer_manager()->SetInfo( renderbuffer, 1, internalformat, width, height); } } void GLES2DecoderImpl::DoLinkProgram(GLuint program_id) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoLinkProgram"); Program* program = GetProgramInfoNotShader( program_id, "glLinkProgram"); if (!program) { return; } LogClientServiceForInfo(program, program_id, "glLinkProgram"); if (program->Link(shader_manager(), workarounds().count_all_in_varyings_packing ? Program::kCountAll : Program::kCountOnlyStaticallyUsed, shader_cache_callback_)) { if (program == state_.current_program.get()) { if (workarounds().use_current_program_after_successful_link) glUseProgram(program->service_id()); if (workarounds().clear_uniforms_before_first_program_use) program_manager()->ClearUniforms(program); } } // LinkProgram can be very slow. Exit command processing to allow for // context preemption and GPU watchdog checks. ExitCommandProcessingEarly(); }; void GLES2DecoderImpl::DoSamplerParameterfv( GLuint sampler, GLenum pname, const GLfloat* params) { DCHECK(params); glSamplerParameterf(sampler, pname, params[0]); } void GLES2DecoderImpl::DoSamplerParameteriv( GLuint sampler, GLenum pname, const GLint* params) { DCHECK(params); glSamplerParameteri(sampler, pname, params[0]); } void GLES2DecoderImpl::DoTexParameterf( GLenum target, GLenum pname, GLfloat param) { TextureRef* texture = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterf", "unknown texture"); return; } texture_manager()->SetParameterf( "glTexParameterf", GetErrorState(), texture, pname, param); } void GLES2DecoderImpl::DoTexParameteri( GLenum target, GLenum pname, GLint param) { TextureRef* texture = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameteri", "unknown texture"); return; } texture_manager()->SetParameteri( "glTexParameteri", GetErrorState(), texture, pname, param); } void GLES2DecoderImpl::DoTexParameterfv( GLenum target, GLenum pname, const GLfloat* params) { TextureRef* texture = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture"); return; } texture_manager()->SetParameterf( "glTexParameterfv", GetErrorState(), texture, pname, *params); } void GLES2DecoderImpl::DoTexParameteriv( GLenum target, GLenum pname, const GLint* params) { TextureRef* texture = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glTexParameteriv", "unknown texture"); return; } texture_manager()->SetParameteri( "glTexParameteriv", GetErrorState(), texture, pname, *params); } bool GLES2DecoderImpl::CheckCurrentValuebuffer(const char* function_name) { if (!state_.bound_valuebuffer.get()) { // There is no valuebuffer bound LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "no valuebuffer in use"); return false; } return true; } bool GLES2DecoderImpl::CheckCurrentValuebufferForSubscription( GLenum subscription, const char* function_name) { if (!CheckCurrentValuebuffer(function_name)) { return false; } if (!state_.bound_valuebuffer.get()->IsSubscribed(subscription)) { // The valuebuffer is not subscribed to the target LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "valuebuffer is not subscribed"); return false; } return true; } bool GLES2DecoderImpl::CheckSubscriptionTarget(GLint location, GLenum subscription, const char* function_name) { if (!CheckCurrentProgramForUniform(location, function_name)) { return false; } GLint real_location = -1; GLint array_index = -1; const Program::UniformInfo* info = state_.current_program->GetUniformInfoByFakeLocation( location, &real_location, &array_index); if (!info) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "unknown location"); return false; } if ((ValuebufferManager::ApiTypeForSubscriptionTarget(subscription) & info->accepts_api_type) == 0) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "wrong type for subscription"); return false; } return true; } bool GLES2DecoderImpl::CheckCurrentProgram(const char* function_name) { if (!state_.current_program.get()) { // The program does not exist. LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "no program in use"); return false; } if (!state_.current_program->InUse()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "program not linked"); return false; } return true; } bool GLES2DecoderImpl::CheckCurrentProgramForUniform( GLint location, const char* function_name) { if (!CheckCurrentProgram(function_name)) { return false; } return location != -1; } bool GLES2DecoderImpl::CheckDrawingFeedbackLoops() { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); if (!framebuffer) return false; const Framebuffer::Attachment* attachment = framebuffer->GetAttachment(GL_COLOR_ATTACHMENT0); if (!attachment) return false; DCHECK(state_.current_program.get()); const Program::SamplerIndices& sampler_indices = state_.current_program->sampler_indices(); for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { const Program::UniformInfo* uniform_info = state_.current_program->GetUniformInfo(sampler_indices[ii]); DCHECK(uniform_info); if (uniform_info->type != GL_SAMPLER_2D) continue; for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { GLuint texture_unit_index = uniform_info->texture_units[jj]; if (texture_unit_index >= state_.texture_units.size()) continue; TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; TextureRef* texture_ref = texture_unit.GetInfoForSamplerType(GL_SAMPLER_2D).get(); if (attachment->IsTexture(texture_ref)) return true; } } return false; } bool GLES2DecoderImpl::CheckUniformForApiType( const Program::UniformInfo* info, const char* function_name, Program::UniformApiType api_type) { DCHECK(info); if ((api_type & info->accepts_api_type) == 0) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "wrong uniform function for type"); return false; } return true; } bool GLES2DecoderImpl::PrepForSetUniformByLocation( GLint fake_location, const char* function_name, Program::UniformApiType api_type, GLint* real_location, GLenum* type, GLsizei* count) { DCHECK(type); DCHECK(count); DCHECK(real_location); if (!CheckCurrentProgramForUniform(fake_location, function_name)) { return false; } GLint array_index = -1; const Program::UniformInfo* info = state_.current_program->GetUniformInfoByFakeLocation( fake_location, real_location, &array_index); if (!info) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "unknown location"); return false; } if (!CheckUniformForApiType(info, function_name, api_type)) { return false; } if (*count > 1 && !info->is_array) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "count > 1 for non-array"); return false; } *count = std::min(info->size - array_index, *count); if (*count <= 0) { return false; } *type = info->type; return true; } void GLES2DecoderImpl::DoUniform1i(GLint fake_location, GLint v0) { GLenum type = 0; GLsizei count = 1; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform1i", Program::kUniform1i, &real_location, &type, &count)) { return; } if (!state_.current_program->SetSamplers( state_.texture_units.size(), fake_location, 1, &v0)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glUniform1i", "texture unit out of range"); return; } glUniform1i(real_location, v0); } void GLES2DecoderImpl::DoUniform1iv( GLint fake_location, GLsizei count, const GLint *value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform1iv", Program::kUniform1i, &real_location, &type, &count)) { return; } if (type == GL_SAMPLER_2D || type == GL_SAMPLER_2D_RECT_ARB || type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES) { if (!state_.current_program->SetSamplers( state_.texture_units.size(), fake_location, count, value)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glUniform1iv", "texture unit out of range"); return; } } glUniform1iv(real_location, count, value); } void GLES2DecoderImpl::DoUniform1fv( GLint fake_location, GLsizei count, const GLfloat* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform1fv", Program::kUniform1f, &real_location, &type, &count)) { return; } if (type == GL_BOOL) { scoped_ptr<GLint[]> temp(new GLint[count]); for (GLsizei ii = 0; ii < count; ++ii) { temp[ii] = static_cast<GLint>(value[ii] != 0.0f); } DoUniform1iv(real_location, count, temp.get()); } else { glUniform1fv(real_location, count, value); } } void GLES2DecoderImpl::DoUniform2fv( GLint fake_location, GLsizei count, const GLfloat* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform2fv", Program::kUniform2f, &real_location, &type, &count)) { return; } if (type == GL_BOOL_VEC2) { GLsizei num_values = count * 2; scoped_ptr<GLint[]> temp(new GLint[num_values]); for (GLsizei ii = 0; ii < num_values; ++ii) { temp[ii] = static_cast<GLint>(value[ii] != 0.0f); } glUniform2iv(real_location, count, temp.get()); } else { glUniform2fv(real_location, count, value); } } void GLES2DecoderImpl::DoUniform3fv( GLint fake_location, GLsizei count, const GLfloat* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform3fv", Program::kUniform3f, &real_location, &type, &count)) { return; } if (type == GL_BOOL_VEC3) { GLsizei num_values = count * 3; scoped_ptr<GLint[]> temp(new GLint[num_values]); for (GLsizei ii = 0; ii < num_values; ++ii) { temp[ii] = static_cast<GLint>(value[ii] != 0.0f); } glUniform3iv(real_location, count, temp.get()); } else { glUniform3fv(real_location, count, value); } } void GLES2DecoderImpl::DoUniform4fv( GLint fake_location, GLsizei count, const GLfloat* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform4fv", Program::kUniform4f, &real_location, &type, &count)) { return; } if (type == GL_BOOL_VEC4) { GLsizei num_values = count * 4; scoped_ptr<GLint[]> temp(new GLint[num_values]); for (GLsizei ii = 0; ii < num_values; ++ii) { temp[ii] = static_cast<GLint>(value[ii] != 0.0f); } glUniform4iv(real_location, count, temp.get()); } else { glUniform4fv(real_location, count, value); } } void GLES2DecoderImpl::DoUniform2iv( GLint fake_location, GLsizei count, const GLint* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform2iv", Program::kUniform2i, &real_location, &type, &count)) { return; } glUniform2iv(real_location, count, value); } void GLES2DecoderImpl::DoUniform3iv( GLint fake_location, GLsizei count, const GLint* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform3iv", Program::kUniform3i, &real_location, &type, &count)) { return; } glUniform3iv(real_location, count, value); } void GLES2DecoderImpl::DoUniform4iv( GLint fake_location, GLsizei count, const GLint* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform4iv", Program::kUniform4i, &real_location, &type, &count)) { return; } glUniform4iv(real_location, count, value); } void GLES2DecoderImpl::DoUniformMatrix2fv( GLint fake_location, GLsizei count, GLboolean transpose, const GLfloat* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix2fv", Program::kUniformMatrix2f, &real_location, &type, &count)) { return; } glUniformMatrix2fv(real_location, count, transpose, value); } void GLES2DecoderImpl::DoUniformMatrix3fv( GLint fake_location, GLsizei count, GLboolean transpose, const GLfloat* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix3fv", Program::kUniformMatrix3f, &real_location, &type, &count)) { return; } glUniformMatrix3fv(real_location, count, transpose, value); } void GLES2DecoderImpl::DoUniformMatrix4fv( GLint fake_location, GLsizei count, GLboolean transpose, const GLfloat* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix4fv", Program::kUniformMatrix4f, &real_location, &type, &count)) { return; } glUniformMatrix4fv(real_location, count, transpose, value); } void GLES2DecoderImpl::DoUseProgram(GLuint program_id) { GLuint service_id = 0; Program* program = NULL; if (program_id) { program = GetProgramInfoNotShader(program_id, "glUseProgram"); if (!program) { return; } if (!program->IsValid()) { // Program was not linked successfully. (ie, glLinkProgram) LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glUseProgram", "program not linked"); return; } service_id = program->service_id(); } if (state_.current_program.get()) { program_manager()->UnuseProgram(shader_manager(), state_.current_program.get()); } state_.current_program = program; LogClientServiceMapping("glUseProgram", program_id, service_id); glUseProgram(service_id); if (state_.current_program.get()) { program_manager()->UseProgram(state_.current_program.get()); if (workarounds().clear_uniforms_before_first_program_use) program_manager()->ClearUniforms(program); } } void GLES2DecoderImpl::RenderWarning( const char* filename, int line, const std::string& msg) { logger_.LogMessage(filename, line, std::string("RENDER WARNING: ") + msg); } void GLES2DecoderImpl::PerformanceWarning( const char* filename, int line, const std::string& msg) { logger_.LogMessage(filename, line, std::string("PERFORMANCE WARNING: ") + msg); } void GLES2DecoderImpl::DoWillUseTexImageIfNeeded( Texture* texture, GLenum textarget) { // Image is already in use if texture is attached to a framebuffer. if (texture && !texture->IsAttachedToFramebuffer()) { gfx::GLImage* image = texture->GetLevelImage(textarget, 0); if (image) { ScopedGLErrorSuppressor suppressor( "GLES2DecoderImpl::DoWillUseTexImageIfNeeded", GetErrorState()); glBindTexture(textarget, texture->service_id()); image->WillUseTexImage(); RestoreCurrentTextureBindings(&state_, textarget); } } } void GLES2DecoderImpl::DoDidUseTexImageIfNeeded( Texture* texture, GLenum textarget) { // Image is still in use if texture is attached to a framebuffer. if (texture && !texture->IsAttachedToFramebuffer()) { gfx::GLImage* image = texture->GetLevelImage(textarget, 0); if (image) { ScopedGLErrorSuppressor suppressor( "GLES2DecoderImpl::DoDidUseTexImageIfNeeded", GetErrorState()); glBindTexture(textarget, texture->service_id()); image->DidUseTexImage(); RestoreCurrentTextureBindings(&state_, textarget); } } } bool GLES2DecoderImpl::PrepareTexturesForRender() { DCHECK(state_.current_program.get()); if (!texture_manager()->HaveUnrenderableTextures() && !texture_manager()->HaveImages()) { return true; } bool textures_set = false; const Program::SamplerIndices& sampler_indices = state_.current_program->sampler_indices(); for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { const Program::UniformInfo* uniform_info = state_.current_program->GetUniformInfo(sampler_indices[ii]); DCHECK(uniform_info); for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { GLuint texture_unit_index = uniform_info->texture_units[jj]; if (texture_unit_index < state_.texture_units.size()) { TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; TextureRef* texture_ref = texture_unit.GetInfoForSamplerType(uniform_info->type).get(); GLenum textarget = GetBindTargetForSamplerType(uniform_info->type); if (!texture_ref || !texture_manager()->CanRender(texture_ref)) { textures_set = true; glActiveTexture(GL_TEXTURE0 + texture_unit_index); glBindTexture( textarget, texture_manager()->black_texture_id(uniform_info->type)); if (!texture_ref) { LOCAL_RENDER_WARNING( std::string("there is no texture bound to the unit ") + base::IntToString(texture_unit_index)); } else { LOCAL_RENDER_WARNING( std::string("texture bound to texture unit ") + base::IntToString(texture_unit_index) + " is not renderable. It maybe non-power-of-2 and have" " incompatible texture filtering."); } continue; } if (textarget != GL_TEXTURE_CUBE_MAP) { Texture* texture = texture_ref->texture(); gfx::GLImage* image = texture->GetLevelImage(textarget, 0); if (image && !texture->IsAttachedToFramebuffer()) { ScopedGLErrorSuppressor suppressor( "GLES2DecoderImpl::PrepareTexturesForRender", GetErrorState()); textures_set = true; glActiveTexture(GL_TEXTURE0 + texture_unit_index); image->WillUseTexImage(); continue; } } } // else: should this be an error? } } return !textures_set; } void GLES2DecoderImpl::RestoreStateForTextures() { DCHECK(state_.current_program.get()); const Program::SamplerIndices& sampler_indices = state_.current_program->sampler_indices(); for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { const Program::UniformInfo* uniform_info = state_.current_program->GetUniformInfo(sampler_indices[ii]); DCHECK(uniform_info); for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { GLuint texture_unit_index = uniform_info->texture_units[jj]; if (texture_unit_index < state_.texture_units.size()) { TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; TextureRef* texture_ref = texture_unit.GetInfoForSamplerType(uniform_info->type).get(); if (!texture_ref || !texture_manager()->CanRender(texture_ref)) { glActiveTexture(GL_TEXTURE0 + texture_unit_index); // Get the texture_ref info that was previously bound here. texture_ref = texture_unit.bind_target == GL_TEXTURE_2D ? texture_unit.bound_texture_2d.get() : texture_unit.bound_texture_cube_map.get(); glBindTexture(texture_unit.bind_target, texture_ref ? texture_ref->service_id() : 0); continue; } if (texture_unit.bind_target != GL_TEXTURE_CUBE_MAP) { Texture* texture = texture_ref->texture(); gfx::GLImage* image = texture->GetLevelImage(texture_unit.bind_target, 0); if (image && !texture->IsAttachedToFramebuffer()) { ScopedGLErrorSuppressor suppressor( "GLES2DecoderImpl::RestoreStateForTextures", GetErrorState()); glActiveTexture(GL_TEXTURE0 + texture_unit_index); image->DidUseTexImage(); continue; } } } } } // Set the active texture back to whatever the user had it as. glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit); } bool GLES2DecoderImpl::ClearUnclearedTextures() { // Only check if there are some uncleared textures. if (!texture_manager()->HaveUnsafeTextures()) { return true; } // 1: Check all textures we are about to render with. if (state_.current_program.get()) { const Program::SamplerIndices& sampler_indices = state_.current_program->sampler_indices(); for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { const Program::UniformInfo* uniform_info = state_.current_program->GetUniformInfo(sampler_indices[ii]); DCHECK(uniform_info); for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { GLuint texture_unit_index = uniform_info->texture_units[jj]; if (texture_unit_index < state_.texture_units.size()) { TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; TextureRef* texture_ref = texture_unit.GetInfoForSamplerType(uniform_info->type).get(); if (texture_ref && !texture_ref->texture()->SafeToRenderFrom()) { if (!texture_manager()->ClearRenderableLevels(this, texture_ref)) { return false; } } } } } } return true; } bool GLES2DecoderImpl::IsDrawValid( const char* function_name, GLuint max_vertex_accessed, bool instanced, GLsizei primcount) { DCHECK(instanced || primcount == 1); // NOTE: We specifically do not check current_program->IsValid() because // it could never be invalid since glUseProgram would have failed. While // glLinkProgram could later mark the program as invalid the previous // valid program will still function if it is still the current program. if (!state_.current_program.get()) { // The program does not exist. // But GL says no ERROR. LOCAL_RENDER_WARNING("Drawing with no current shader program."); return false; } if (CheckDrawingFeedbackLoops()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "Source and destination textures of the draw are the same."); return false; } return state_.vertex_attrib_manager ->ValidateBindings(function_name, this, feature_info_.get(), state_.current_program.get(), max_vertex_accessed, instanced, primcount); } bool GLES2DecoderImpl::SimulateAttrib0( const char* function_name, GLuint max_vertex_accessed, bool* simulated) { DCHECK(simulated); *simulated = false; if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) return true; const VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(0); // If it's enabled or it's not used then we don't need to do anything. bool attrib_0_used = state_.current_program->GetAttribInfoByLocation(0) != NULL; if (attrib->enabled() && attrib_0_used) { return true; } // Make a buffer with a single repeated vec4 value enough to // simulate the constant value that is supposed to be here. // This is required to emulate GLES2 on GL. GLuint num_vertices = max_vertex_accessed + 1; uint32 size_needed = 0; if (num_vertices == 0 || !SafeMultiplyUint32(num_vertices, sizeof(Vec4), &size_needed) || size_needed > 0x7FFFFFFFU) { LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); return false; } LOCAL_PERFORMANCE_WARNING( "Attribute 0 is disabled. This has signficant performance penalty"); LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); bool new_buffer = static_cast<GLsizei>(size_needed) > attrib_0_size_; if (new_buffer) { glBufferData(GL_ARRAY_BUFFER, size_needed, NULL, GL_DYNAMIC_DRAW); GLenum error = glGetError(); if (error != GL_NO_ERROR) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); return false; } } const Vec4& value = state_.attrib_values[0]; if (new_buffer || (attrib_0_used && (!attrib_0_buffer_matches_value_ || (value.v[0] != attrib_0_value_.v[0] || value.v[1] != attrib_0_value_.v[1] || value.v[2] != attrib_0_value_.v[2] || value.v[3] != attrib_0_value_.v[3])))) { std::vector<Vec4> temp(num_vertices, value); glBufferSubData(GL_ARRAY_BUFFER, 0, size_needed, &temp[0].v[0]); attrib_0_buffer_matches_value_ = true; attrib_0_value_ = value; attrib_0_size_ = size_needed; } glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL); if (attrib->divisor()) glVertexAttribDivisorANGLE(0, 0); *simulated = true; return true; } void GLES2DecoderImpl::RestoreStateForAttrib( GLuint attrib_index, bool restore_array_binding) { const VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(attrib_index); if (restore_array_binding) { const void* ptr = reinterpret_cast<const void*>(attrib->offset()); Buffer* buffer = attrib->buffer(); glBindBuffer(GL_ARRAY_BUFFER, buffer ? buffer->service_id() : 0); glVertexAttribPointer( attrib_index, attrib->size(), attrib->type(), attrib->normalized(), attrib->gl_stride(), ptr); } if (attrib->divisor()) glVertexAttribDivisorANGLE(attrib_index, attrib->divisor()); glBindBuffer( GL_ARRAY_BUFFER, state_.bound_array_buffer.get() ? state_.bound_array_buffer->service_id() : 0); // Never touch vertex attribute 0's state (in particular, never // disable it) when running on desktop GL because it will never be // re-enabled. if (attrib_index != 0 || gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) { if (attrib->enabled()) { glEnableVertexAttribArray(attrib_index); } else { glDisableVertexAttribArray(attrib_index); } } } bool GLES2DecoderImpl::SimulateFixedAttribs( const char* function_name, GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { DCHECK(simulated); *simulated = false; if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) return true; if (!state_.vertex_attrib_manager->HaveFixedAttribs()) { return true; } LOCAL_PERFORMANCE_WARNING( "GL_FIXED attributes have a signficant performance penalty"); // NOTE: we could be smart and try to check if a buffer is used // twice in 2 different attribs, find the overlapping parts and therefore // duplicate the minimum amount of data but this whole code path is not meant // to be used normally. It's just here to pass that OpenGL ES 2.0 conformance // tests so we just add to the buffer attrib used. GLuint elements_needed = 0; const VertexAttribManager::VertexAttribList& enabled_attribs = state_.vertex_attrib_manager->GetEnabledVertexAttribs(); for (VertexAttribManager::VertexAttribList::const_iterator it = enabled_attribs.begin(); it != enabled_attribs.end(); ++it) { const VertexAttrib* attrib = *it; const Program::VertexAttrib* attrib_info = state_.current_program->GetAttribInfoByLocation(attrib->index()); GLuint max_accessed = attrib->MaxVertexAccessed(primcount, max_vertex_accessed); GLuint num_vertices = max_accessed + 1; if (num_vertices == 0) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); return false; } if (attrib_info && attrib->CanAccess(max_accessed) && attrib->type() == GL_FIXED) { uint32 elements_used = 0; if (!SafeMultiplyUint32(num_vertices, attrib->size(), &elements_used) || !SafeAddUint32(elements_needed, elements_used, &elements_needed)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, "simulating GL_FIXED attribs"); return false; } } } const uint32 kSizeOfFloat = sizeof(float); // NOLINT uint32 size_needed = 0; if (!SafeMultiplyUint32(elements_needed, kSizeOfFloat, &size_needed) || size_needed > 0x7FFFFFFFU) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, "simulating GL_FIXED attribs"); return false; } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); glBindBuffer(GL_ARRAY_BUFFER, fixed_attrib_buffer_id_); if (static_cast<GLsizei>(size_needed) > fixed_attrib_buffer_size_) { glBufferData(GL_ARRAY_BUFFER, size_needed, NULL, GL_DYNAMIC_DRAW); GLenum error = glGetError(); if (error != GL_NO_ERROR) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, "simulating GL_FIXED attribs"); return false; } } // Copy the elements and convert to float GLintptr offset = 0; for (VertexAttribManager::VertexAttribList::const_iterator it = enabled_attribs.begin(); it != enabled_attribs.end(); ++it) { const VertexAttrib* attrib = *it; const Program::VertexAttrib* attrib_info = state_.current_program->GetAttribInfoByLocation(attrib->index()); GLuint max_accessed = attrib->MaxVertexAccessed(primcount, max_vertex_accessed); GLuint num_vertices = max_accessed + 1; if (num_vertices == 0) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); return false; } if (attrib_info && attrib->CanAccess(max_accessed) && attrib->type() == GL_FIXED) { int num_elements = attrib->size() * num_vertices; const int src_size = num_elements * sizeof(int32); const int dst_size = num_elements * sizeof(float); scoped_ptr<float[]> data(new float[num_elements]); const int32* src = reinterpret_cast<const int32 *>( attrib->buffer()->GetRange(attrib->offset(), src_size)); const int32* end = src + num_elements; float* dst = data.get(); while (src != end) { *dst++ = static_cast<float>(*src++) / 65536.0f; } glBufferSubData(GL_ARRAY_BUFFER, offset, dst_size, data.get()); glVertexAttribPointer( attrib->index(), attrib->size(), GL_FLOAT, false, 0, reinterpret_cast<GLvoid*>(offset)); offset += dst_size; } } *simulated = true; return true; } void GLES2DecoderImpl::RestoreStateForSimulatedFixedAttribs() { // There's no need to call glVertexAttribPointer because we shadow all the // settings and passing GL_FIXED to it will not work. glBindBuffer( GL_ARRAY_BUFFER, state_.bound_array_buffer.get() ? state_.bound_array_buffer->service_id() : 0); } error::Error GLES2DecoderImpl::DoDrawArrays( const char* function_name, bool instanced, GLenum mode, GLint first, GLsizei count, GLsizei primcount) { error::Error error = WillAccessBoundFramebufferForDraw(); if (error != error::kNoError) return error; if (!validators_->draw_mode.IsValid(mode)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, mode, "mode"); return error::kNoError; } if (count < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "count < 0"); return error::kNoError; } if (primcount < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); return error::kNoError; } if (!CheckBoundFramebuffersValid(function_name)) { return error::kNoError; } // We have to check this here because the prototype for glDrawArrays // is GLint not GLsizei. if (first < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "first < 0"); return error::kNoError; } if (count == 0 || primcount == 0) { LOCAL_RENDER_WARNING("Render count or primcount is 0."); return error::kNoError; } GLuint max_vertex_accessed = first + count - 1; if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) { if (!ClearUnclearedTextures()) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory"); return error::kNoError; } bool simulated_attrib_0 = false; if (!SimulateAttrib0( function_name, max_vertex_accessed, &simulated_attrib_0)) { return error::kNoError; } bool simulated_fixed_attribs = false; if (SimulateFixedAttribs( function_name, max_vertex_accessed, &simulated_fixed_attribs, primcount)) { bool textures_set = !PrepareTexturesForRender(); ApplyDirtyState(); ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get()); if (!instanced) { glDrawArrays(mode, first, count); } else { glDrawArraysInstancedANGLE(mode, first, count, primcount); } if (textures_set) { RestoreStateForTextures(); } if (simulated_fixed_attribs) { RestoreStateForSimulatedFixedAttribs(); } } if (simulated_attrib_0) { // We don't have to restore attrib 0 generic data at the end of this // function even if it is simulated. This is because we will simulate // it in each draw call, and attrib 0 generic data queries use cached // values instead of passing down to the underlying driver. RestoreStateForAttrib(0, false); } } return error::kNoError; } error::Error GLES2DecoderImpl::HandleDrawArrays(uint32 immediate_data_size, const void* cmd_data) { const cmds::DrawArrays& c = *static_cast<const cmds::DrawArrays*>(cmd_data); return DoDrawArrays("glDrawArrays", false, static_cast<GLenum>(c.mode), static_cast<GLint>(c.first), static_cast<GLsizei>(c.count), 1); } error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::DrawArraysInstancedANGLE& c = *static_cast<const gles2::cmds::DrawArraysInstancedANGLE*>(cmd_data); if (!features().angle_instanced_arrays) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glDrawArraysInstancedANGLE", "function not available"); return error::kNoError; } return DoDrawArrays("glDrawArraysIntancedANGLE", true, static_cast<GLenum>(c.mode), static_cast<GLint>(c.first), static_cast<GLsizei>(c.count), static_cast<GLsizei>(c.primcount)); } error::Error GLES2DecoderImpl::DoDrawElements( const char* function_name, bool instanced, GLenum mode, GLsizei count, GLenum type, int32 offset, GLsizei primcount) { error::Error error = WillAccessBoundFramebufferForDraw(); if (error != error::kNoError) return error; if (!state_.vertex_attrib_manager->element_array_buffer()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "No element array buffer bound"); return error::kNoError; } if (count < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "count < 0"); return error::kNoError; } if (offset < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "offset < 0"); return error::kNoError; } if (!validators_->draw_mode.IsValid(mode)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, mode, "mode"); return error::kNoError; } if (!validators_->index_type.IsValid(type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, type, "type"); return error::kNoError; } if (primcount < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); return error::kNoError; } if (!CheckBoundFramebuffersValid(function_name)) { return error::kNoError; } if (count == 0 || primcount == 0) { return error::kNoError; } GLuint max_vertex_accessed; Buffer* element_array_buffer = state_.vertex_attrib_manager->element_array_buffer(); if (!element_array_buffer->GetMaxValueForRange( offset, count, type, &max_vertex_accessed)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "range out of bounds for buffer"); return error::kNoError; } if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) { if (!ClearUnclearedTextures()) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory"); return error::kNoError; } bool simulated_attrib_0 = false; if (!SimulateAttrib0( function_name, max_vertex_accessed, &simulated_attrib_0)) { return error::kNoError; } bool simulated_fixed_attribs = false; if (SimulateFixedAttribs( function_name, max_vertex_accessed, &simulated_fixed_attribs, primcount)) { bool textures_set = !PrepareTexturesForRender(); ApplyDirtyState(); // TODO(gman): Refactor to hide these details in BufferManager or // VertexAttribManager. const GLvoid* indices = reinterpret_cast<const GLvoid*>(offset); bool used_client_side_array = false; if (element_array_buffer->IsClientSideArray()) { used_client_side_array = true; glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); indices = element_array_buffer->GetRange(offset, 0); } ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get()); if (!instanced) { glDrawElements(mode, count, type, indices); } else { glDrawElementsInstancedANGLE(mode, count, type, indices, primcount); } if (used_client_side_array) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, element_array_buffer->service_id()); } if (textures_set) { RestoreStateForTextures(); } if (simulated_fixed_attribs) { RestoreStateForSimulatedFixedAttribs(); } } if (simulated_attrib_0) { // We don't have to restore attrib 0 generic data at the end of this // function even if it is simulated. This is because we will simulate // it in each draw call, and attrib 0 generic data queries use cached // values instead of passing down to the underlying driver. RestoreStateForAttrib(0, false); } } return error::kNoError; } error::Error GLES2DecoderImpl::HandleDrawElements(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::DrawElements& c = *static_cast<const gles2::cmds::DrawElements*>(cmd_data); return DoDrawElements("glDrawElements", false, static_cast<GLenum>(c.mode), static_cast<GLsizei>(c.count), static_cast<GLenum>(c.type), static_cast<int32>(c.index_offset), 1); } error::Error GLES2DecoderImpl::HandleDrawElementsInstancedANGLE( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::DrawElementsInstancedANGLE& c = *static_cast<const gles2::cmds::DrawElementsInstancedANGLE*>(cmd_data); if (!features().angle_instanced_arrays) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glDrawElementsInstancedANGLE", "function not available"); return error::kNoError; } return DoDrawElements("glDrawElementsInstancedANGLE", true, static_cast<GLenum>(c.mode), static_cast<GLsizei>(c.count), static_cast<GLenum>(c.type), static_cast<int32>(c.index_offset), static_cast<GLsizei>(c.primcount)); } GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM( GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { GLuint max_vertex_accessed = 0; Buffer* buffer = GetBuffer(buffer_id); if (!buffer) { // TODO(gman): Should this be a GL error or a command buffer error? LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "GetMaxValueInBufferCHROMIUM", "unknown buffer"); } else { if (!buffer->GetMaxValueForRange( offset, count, type, &max_vertex_accessed)) { // TODO(gman): Should this be a GL error or a command buffer error? LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "GetMaxValueInBufferCHROMIUM", "range out of bounds for buffer"); } } return max_vertex_accessed; } void GLES2DecoderImpl::DoShaderSource( GLuint client_id, GLsizei count, const char** data, const GLint* length) { std::string str; for (GLsizei ii = 0; ii < count; ++ii) { if (length && length[ii] > 0) str.append(data[ii], length[ii]); else str.append(data[ii]); } Shader* shader = GetShaderInfoNotProgram(client_id, "glShaderSource"); if (!shader) { return; } // Note: We don't actually call glShaderSource here. We wait until // we actually compile the shader. shader->set_source(str); } void GLES2DecoderImpl::DoTransformFeedbackVaryings( GLuint client_program_id, GLsizei count, const char* const* varyings, GLenum buffer_mode) { Program* program = GetProgramInfoNotShader( client_program_id, "glTransformFeedbackVaryings"); if (!program) { return; } glTransformFeedbackVaryings( program->service_id(), count, varyings, buffer_mode); } void GLES2DecoderImpl::DoCompileShader(GLuint client_id) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompileShader"); Shader* shader = GetShaderInfoNotProgram(client_id, "glCompileShader"); if (!shader) { return; } scoped_refptr<ShaderTranslatorInterface> translator; if (use_shader_translator_) { translator = shader->shader_type() == GL_VERTEX_SHADER ? vertex_translator_ : fragment_translator_; } const Shader::TranslatedShaderSourceType source_type = feature_info_->feature_flags().angle_translated_shader_source ? Shader::kANGLE : Shader::kGL; shader->RequestCompile(translator, source_type); } void GLES2DecoderImpl::DoGetShaderiv( GLuint shader_id, GLenum pname, GLint* params) { Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderiv"); if (!shader) { return; } // Compile now for statuses that require it. switch (pname) { case GL_COMPILE_STATUS: case GL_INFO_LOG_LENGTH: case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: shader->DoCompile(); break; default: break; } switch (pname) { case GL_SHADER_SOURCE_LENGTH: *params = shader->source().size(); if (*params) ++(*params); return; case GL_COMPILE_STATUS: *params = compile_shader_always_succeeds_ ? true : shader->valid(); return; case GL_INFO_LOG_LENGTH: *params = shader->log_info().size(); if (*params) ++(*params); return; case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: *params = shader->translated_source().size(); if (*params) ++(*params); return; default: break; } glGetShaderiv(shader->service_id(), pname, params); } error::Error GLES2DecoderImpl::HandleGetShaderSource(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetShaderSource& c = *static_cast<const gles2::cmds::GetShaderSource*>(cmd_data); GLuint shader_id = c.shader; uint32 bucket_id = static_cast<uint32>(c.bucket_id); Bucket* bucket = CreateBucket(bucket_id); Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderSource"); if (!shader || shader->source().empty()) { bucket->SetSize(0); return error::kNoError; } bucket->SetFromString(shader->source().c_str()); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetTranslatedShaderSourceANGLE( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetTranslatedShaderSourceANGLE& c = *static_cast<const gles2::cmds::GetTranslatedShaderSourceANGLE*>( cmd_data); GLuint shader_id = c.shader; uint32 bucket_id = static_cast<uint32>(c.bucket_id); Bucket* bucket = CreateBucket(bucket_id); Shader* shader = GetShaderInfoNotProgram( shader_id, "glGetTranslatedShaderSourceANGLE"); if (!shader) { bucket->SetSize(0); return error::kNoError; } // Make sure translator has been utilized in compile. shader->DoCompile(); bucket->SetFromString(shader->translated_source().c_str()); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetProgramInfoLog& c = *static_cast<const gles2::cmds::GetProgramInfoLog*>(cmd_data); GLuint program_id = c.program; uint32 bucket_id = static_cast<uint32>(c.bucket_id); Bucket* bucket = CreateBucket(bucket_id); Program* program = GetProgramInfoNotShader( program_id, "glGetProgramInfoLog"); if (!program || !program->log_info()) { bucket->SetFromString(""); return error::kNoError; } bucket->SetFromString(program->log_info()->c_str()); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetShaderInfoLog( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetShaderInfoLog& c = *static_cast<const gles2::cmds::GetShaderInfoLog*>(cmd_data); GLuint shader_id = c.shader; uint32 bucket_id = static_cast<uint32>(c.bucket_id); Bucket* bucket = CreateBucket(bucket_id); Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderInfoLog"); if (!shader) { bucket->SetFromString(""); return error::kNoError; } // Shader must be compiled in order to get the info log. shader->DoCompile(); bucket->SetFromString(shader->log_info().c_str()); return error::kNoError; } bool GLES2DecoderImpl::DoIsEnabled(GLenum cap) { return state_.GetEnabled(cap); } bool GLES2DecoderImpl::DoIsBuffer(GLuint client_id) { const Buffer* buffer = GetBuffer(client_id); return buffer && buffer->IsValid() && !buffer->IsDeleted(); } bool GLES2DecoderImpl::DoIsFramebuffer(GLuint client_id) { const Framebuffer* framebuffer = GetFramebuffer(client_id); return framebuffer && framebuffer->IsValid() && !framebuffer->IsDeleted(); } bool GLES2DecoderImpl::DoIsProgram(GLuint client_id) { // IsProgram is true for programs as soon as they are created, until they are // deleted and no longer in use. const Program* program = GetProgram(client_id); return program != NULL && !program->IsDeleted(); } bool GLES2DecoderImpl::DoIsRenderbuffer(GLuint client_id) { const Renderbuffer* renderbuffer = GetRenderbuffer(client_id); return renderbuffer && renderbuffer->IsValid() && !renderbuffer->IsDeleted(); } bool GLES2DecoderImpl::DoIsShader(GLuint client_id) { // IsShader is true for shaders as soon as they are created, until they // are deleted and not attached to any programs. const Shader* shader = GetShader(client_id); return shader != NULL && !shader->IsDeleted(); } bool GLES2DecoderImpl::DoIsTexture(GLuint client_id) { const TextureRef* texture_ref = GetTexture(client_id); return texture_ref && texture_ref->texture()->IsValid(); } void GLES2DecoderImpl::DoAttachShader( GLuint program_client_id, GLint shader_client_id) { Program* program = GetProgramInfoNotShader( program_client_id, "glAttachShader"); if (!program) { return; } Shader* shader = GetShaderInfoNotProgram(shader_client_id, "glAttachShader"); if (!shader) { return; } if (!program->AttachShader(shader_manager(), shader)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glAttachShader", "can not attach more than one shader of the same type."); return; } glAttachShader(program->service_id(), shader->service_id()); } void GLES2DecoderImpl::DoDetachShader( GLuint program_client_id, GLint shader_client_id) { Program* program = GetProgramInfoNotShader( program_client_id, "glDetachShader"); if (!program) { return; } Shader* shader = GetShaderInfoNotProgram(shader_client_id, "glDetachShader"); if (!shader) { return; } if (!program->DetachShader(shader_manager(), shader)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glDetachShader", "shader not attached to program"); return; } glDetachShader(program->service_id(), shader->service_id()); } void GLES2DecoderImpl::DoValidateProgram(GLuint program_client_id) { Program* program = GetProgramInfoNotShader( program_client_id, "glValidateProgram"); if (!program) { return; } program->Validate(); } void GLES2DecoderImpl::GetVertexAttribHelper( const VertexAttrib* attrib, GLenum pname, GLint* params) { switch (pname) { case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: { Buffer* buffer = attrib->buffer(); if (buffer && !buffer->IsDeleted()) { GLuint client_id; buffer_manager()->GetClientId(buffer->service_id(), &client_id); *params = client_id; } break; } case GL_VERTEX_ATTRIB_ARRAY_ENABLED: *params = attrib->enabled(); break; case GL_VERTEX_ATTRIB_ARRAY_SIZE: *params = attrib->size(); break; case GL_VERTEX_ATTRIB_ARRAY_STRIDE: *params = attrib->gl_stride(); break; case GL_VERTEX_ATTRIB_ARRAY_TYPE: *params = attrib->type(); break; case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: *params = attrib->normalized(); break; case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: *params = attrib->divisor(); break; default: NOTREACHED(); break; } } void GLES2DecoderImpl::DoGetTexParameterfv( GLenum target, GLenum pname, GLfloat* params) { InitTextureMaxAnisotropyIfNeeded(target, pname); glGetTexParameterfv(target, pname, params); } void GLES2DecoderImpl::DoGetTexParameteriv( GLenum target, GLenum pname, GLint* params) { InitTextureMaxAnisotropyIfNeeded(target, pname); glGetTexParameteriv(target, pname, params); } void GLES2DecoderImpl::InitTextureMaxAnisotropyIfNeeded( GLenum target, GLenum pname) { if (!workarounds().init_texture_max_anisotropy) return; if (pname != GL_TEXTURE_MAX_ANISOTROPY_EXT || !validators_->texture_parameter.IsValid(pname)) { return; } TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glGetTexParamter{fi}v", "unknown texture for target"); return; } Texture* texture = texture_ref->texture(); texture->InitTextureMaxAnisotropyIfNeeded(target); } void GLES2DecoderImpl::DoGetVertexAttribfv( GLuint index, GLenum pname, GLfloat* params) { VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(index); if (!attrib) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glGetVertexAttribfv", "index out of range"); return; } switch (pname) { case GL_CURRENT_VERTEX_ATTRIB: { const Vec4& value = state_.attrib_values[index]; params[0] = value.v[0]; params[1] = value.v[1]; params[2] = value.v[2]; params[3] = value.v[3]; break; } default: { GLint value = 0; GetVertexAttribHelper(attrib, pname, &value); *params = static_cast<GLfloat>(value); break; } } } void GLES2DecoderImpl::DoGetVertexAttribiv( GLuint index, GLenum pname, GLint* params) { VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(index); if (!attrib) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glGetVertexAttribiv", "index out of range"); return; } switch (pname) { case GL_CURRENT_VERTEX_ATTRIB: { const Vec4& value = state_.attrib_values[index]; params[0] = static_cast<GLint>(value.v[0]); params[1] = static_cast<GLint>(value.v[1]); params[2] = static_cast<GLint>(value.v[2]); params[3] = static_cast<GLint>(value.v[3]); break; } default: GetVertexAttribHelper(attrib, pname, params); break; } } bool GLES2DecoderImpl::SetVertexAttribValue( const char* function_name, GLuint index, const GLfloat* value) { if (index >= state_.attrib_values.size()) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "index out of range"); return false; } Vec4& v = state_.attrib_values[index]; v.v[0] = value[0]; v.v[1] = value[1]; v.v[2] = value[2]; v.v[3] = value[3]; return true; } void GLES2DecoderImpl::DoVertexAttrib1f(GLuint index, GLfloat v0) { GLfloat v[4] = { v0, 0.0f, 0.0f, 1.0f, }; if (SetVertexAttribValue("glVertexAttrib1f", index, v)) { glVertexAttrib1f(index, v0); } } void GLES2DecoderImpl::DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1) { GLfloat v[4] = { v0, v1, 0.0f, 1.0f, }; if (SetVertexAttribValue("glVertexAttrib2f", index, v)) { glVertexAttrib2f(index, v0, v1); } } void GLES2DecoderImpl::DoVertexAttrib3f( GLuint index, GLfloat v0, GLfloat v1, GLfloat v2) { GLfloat v[4] = { v0, v1, v2, 1.0f, }; if (SetVertexAttribValue("glVertexAttrib3f", index, v)) { glVertexAttrib3f(index, v0, v1, v2); } } void GLES2DecoderImpl::DoVertexAttrib4f( GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { GLfloat v[4] = { v0, v1, v2, v3, }; if (SetVertexAttribValue("glVertexAttrib4f", index, v)) { glVertexAttrib4f(index, v0, v1, v2, v3); } } void GLES2DecoderImpl::DoVertexAttrib1fv(GLuint index, const GLfloat* v) { GLfloat t[4] = { v[0], 0.0f, 0.0f, 1.0f, }; if (SetVertexAttribValue("glVertexAttrib1fv", index, t)) { glVertexAttrib1fv(index, v); } } void GLES2DecoderImpl::DoVertexAttrib2fv(GLuint index, const GLfloat* v) { GLfloat t[4] = { v[0], v[1], 0.0f, 1.0f, }; if (SetVertexAttribValue("glVertexAttrib2fv", index, t)) { glVertexAttrib2fv(index, v); } } void GLES2DecoderImpl::DoVertexAttrib3fv(GLuint index, const GLfloat* v) { GLfloat t[4] = { v[0], v[1], v[2], 1.0f, }; if (SetVertexAttribValue("glVertexAttrib3fv", index, t)) { glVertexAttrib3fv(index, v); } } void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index, const GLfloat* v) { if (SetVertexAttribValue("glVertexAttrib4fv", index, v)) { glVertexAttrib4fv(index, v); } } error::Error GLES2DecoderImpl::HandleVertexAttribIPointer( uint32 immediate_data_size, const void* cmd_data) { // TODO(zmo): Unsafe ES3 API, missing states update. if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::VertexAttribIPointer& c = *static_cast<const gles2::cmds::VertexAttribIPointer*>(cmd_data); GLuint indx = c.indx; GLint size = c.size; GLenum type = c.type; GLsizei stride = c.stride; GLsizei offset = c.offset; const void* ptr = reinterpret_cast<const void*>(offset); glVertexAttribIPointer(indx, size, type, stride, ptr); return error::kNoError; } error::Error GLES2DecoderImpl::HandleVertexAttribPointer( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::VertexAttribPointer& c = *static_cast<const gles2::cmds::VertexAttribPointer*>(cmd_data); if (!state_.bound_array_buffer.get() || state_.bound_array_buffer->IsDeleted()) { if (state_.vertex_attrib_manager.get() == state_.default_vertex_attrib_manager.get()) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glVertexAttribPointer", "no array buffer bound"); return error::kNoError; } else if (c.offset != 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glVertexAttribPointer", "client side arrays are not allowed"); return error::kNoError; } } GLuint indx = c.indx; GLint size = c.size; GLenum type = c.type; GLboolean normalized = static_cast<GLboolean>(c.normalized); GLsizei stride = c.stride; GLsizei offset = c.offset; const void* ptr = reinterpret_cast<const void*>(offset); if (!validators_->vertex_attrib_type.IsValid(type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM("glVertexAttribPointer", type, "type"); return error::kNoError; } if (!validators_->vertex_attrib_size.IsValid(size)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glVertexAttribPointer", "size GL_INVALID_VALUE"); return error::kNoError; } if (indx >= group_->max_vertex_attribs()) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glVertexAttribPointer", "index out of range"); return error::kNoError; } if (stride < 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glVertexAttribPointer", "stride < 0"); return error::kNoError; } if (stride > 255) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glVertexAttribPointer", "stride > 255"); return error::kNoError; } if (offset < 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glVertexAttribPointer", "offset < 0"); return error::kNoError; } GLsizei component_size = GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type); // component_size must be a power of two to use & as optimized modulo. DCHECK(GLES2Util::IsPOT(component_size)); if (offset & (component_size - 1)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glVertexAttribPointer", "offset not valid for type"); return error::kNoError; } if (stride & (component_size - 1)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glVertexAttribPointer", "stride not valid for type"); return error::kNoError; } state_.vertex_attrib_manager ->SetAttribInfo(indx, state_.bound_array_buffer.get(), size, type, normalized, stride, stride != 0 ? stride : component_size * size, offset); if (type != GL_FIXED) { glVertexAttribPointer(indx, size, type, normalized, stride, ptr); } return error::kNoError; } void GLES2DecoderImpl::DoViewport(GLint x, GLint y, GLsizei width, GLsizei height) { state_.viewport_x = x; state_.viewport_y = y; state_.viewport_width = std::min(width, viewport_max_width_); state_.viewport_height = std::min(height, viewport_max_height_); glViewport(x, y, width, height); } error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::VertexAttribDivisorANGLE& c = *static_cast<const gles2::cmds::VertexAttribDivisorANGLE*>(cmd_data); if (!features().angle_instanced_arrays) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glVertexAttribDivisorANGLE", "function not available"); return error::kNoError; } GLuint index = c.index; GLuint divisor = c.divisor; if (index >= group_->max_vertex_attribs()) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glVertexAttribDivisorANGLE", "index out of range"); return error::kNoError; } state_.vertex_attrib_manager->SetDivisor( index, divisor); glVertexAttribDivisorANGLE(index, divisor); return error::kNoError; } template <typename pixel_data_type> static void WriteAlphaData( void *pixels, uint32 row_count, uint32 channel_count, uint32 alpha_channel_index, uint32 unpadded_row_size, uint32 padded_row_size, pixel_data_type alpha_value) { DCHECK_GT(channel_count, 0U); DCHECK_EQ(unpadded_row_size % sizeof(pixel_data_type), 0U); uint32 unpadded_row_size_in_elements = unpadded_row_size / sizeof(pixel_data_type); DCHECK_EQ(padded_row_size % sizeof(pixel_data_type), 0U); uint32 padded_row_size_in_elements = padded_row_size / sizeof(pixel_data_type); pixel_data_type* dst = static_cast<pixel_data_type*>(pixels) + alpha_channel_index; for (uint32 yy = 0; yy < row_count; ++yy) { pixel_data_type* end = dst + unpadded_row_size_in_elements; for (pixel_data_type* d = dst; d < end; d += channel_count) { *d = alpha_value; } dst += padded_row_size_in_elements; } } void GLES2DecoderImpl::FinishReadPixels( const cmds::ReadPixels& c, GLuint buffer) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::FinishReadPixels"); GLsizei width = c.width; GLsizei height = c.height; GLenum format = c.format; GLenum type = c.type; typedef cmds::ReadPixels::Result Result; uint32 pixels_size; Result* result = NULL; if (c.result_shm_id != 0) { result = GetSharedMemoryAs<Result*>( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { if (buffer != 0) { glDeleteBuffersARB(1, &buffer); } return; } } GLES2Util::ComputeImageDataSizes( width, height, 1, format, type, state_.pack_alignment, &pixels_size, NULL, NULL); void* pixels = GetSharedMemoryAs<void*>( c.pixels_shm_id, c.pixels_shm_offset, pixels_size); if (!pixels) { if (buffer != 0) { glDeleteBuffersARB(1, &buffer); } return; } if (buffer != 0) { glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer); void* data; if (features().map_buffer_range) { data = glMapBufferRange( GL_PIXEL_PACK_BUFFER_ARB, 0, pixels_size, GL_MAP_READ_BIT); } else { data = glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY); } if (!data) { LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glMapBuffer", "Unable to map memory for readback."); return; } memcpy(pixels, data, pixels_size); // GL_PIXEL_PACK_BUFFER_ARB is currently unused, so we don't // have to restore the state. glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB); glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 0); glDeleteBuffersARB(1, &buffer); } if (result != NULL) { *result = true; } GLenum read_format = GetBoundReadFrameBufferInternalFormat(); uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); if ((channels_exist & 0x0008) == 0 && workarounds().clear_alpha_in_readpixels) { // Set the alpha to 255 because some drivers are buggy in this regard. uint32 temp_size; uint32 unpadded_row_size; uint32 padded_row_size; if (!GLES2Util::ComputeImageDataSizes( width, 2, 1, format, type, state_.pack_alignment, &temp_size, &unpadded_row_size, &padded_row_size)) { return; } uint32 channel_count = 0; uint32 alpha_channel = 0; switch (format) { case GL_RGBA: case GL_BGRA_EXT: channel_count = 4; alpha_channel = 3; break; case GL_ALPHA: channel_count = 1; alpha_channel = 0; break; } if (channel_count > 0) { switch (type) { case GL_UNSIGNED_BYTE: WriteAlphaData<uint8>( pixels, height, channel_count, alpha_channel, unpadded_row_size, padded_row_size, 0xFF); break; case GL_FLOAT: WriteAlphaData<float>( pixels, height, channel_count, alpha_channel, unpadded_row_size, padded_row_size, 1.0f); break; case GL_HALF_FLOAT: WriteAlphaData<uint16>( pixels, height, channel_count, alpha_channel, unpadded_row_size, padded_row_size, 0x3C00); break; } } } } error::Error GLES2DecoderImpl::HandleReadPixels(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::ReadPixels& c = *static_cast<const gles2::cmds::ReadPixels*>(cmd_data); TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleReadPixels"); error::Error fbo_error = WillAccessBoundFramebufferForRead(); if (fbo_error != error::kNoError) return fbo_error; GLint x = c.x; GLint y = c.y; GLsizei width = c.width; GLsizei height = c.height; GLenum format = c.format; GLenum type = c.type; GLboolean async = static_cast<GLboolean>(c.async); if (width < 0 || height < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glReadPixels", "dimensions < 0"); return error::kNoError; } typedef cmds::ReadPixels::Result Result; uint32 pixels_size; if (!GLES2Util::ComputeImageDataSizes( width, height, 1, format, type, state_.pack_alignment, &pixels_size, NULL, NULL)) { return error::kOutOfBounds; } void* pixels = GetSharedMemoryAs<void*>( c.pixels_shm_id, c.pixels_shm_offset, pixels_size); if (!pixels) { return error::kOutOfBounds; } Result* result = NULL; if (c.result_shm_id != 0) { result = GetSharedMemoryAs<Result*>( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } } if (!validators_->read_pixel_format.IsValid(format)) { LOCAL_SET_GL_ERROR_INVALID_ENUM("glReadPixels", format, "format"); return error::kNoError; } if (!validators_->read_pixel_type.IsValid(type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM("glReadPixels", type, "type"); return error::kNoError; } if ((format != GL_RGBA && format != GL_BGRA_EXT && format != GL_RGB && format != GL_ALPHA) || type != GL_UNSIGNED_BYTE) { // format and type are acceptable enums but not guaranteed to be supported // for this framebuffer. Have to ask gl if they are valid. GLint preferred_format = 0; DoGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &preferred_format); GLint preferred_type = 0; DoGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &preferred_type); if (format != static_cast<GLenum>(preferred_format) || type != static_cast<GLenum>(preferred_type)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glReadPixels", "format and type incompatible " "with the current read framebuffer"); return error::kNoError; } } if (width == 0 || height == 0) { return error::kNoError; } // Get the size of the current fbo or backbuffer. gfx::Size max_size = GetBoundReadFrameBufferSize(); int32 max_x; int32 max_y; if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); return error::kNoError; } if (!CheckBoundReadFramebufferColorAttachment("glReadPixels")) { return error::kNoError; } if (!CheckBoundFramebuffersValid("glReadPixels")) { return error::kNoError; } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glReadPixels"); ScopedResolvedFrameBufferBinder binder(this, false, true); if (x < 0 || y < 0 || max_x > max_size.width() || max_y > max_size.height()) { // The user requested an out of range area. Get the results 1 line // at a time. uint32 temp_size; uint32 unpadded_row_size; uint32 padded_row_size; if (!GLES2Util::ComputeImageDataSizes( width, 2, 1, format, type, state_.pack_alignment, &temp_size, &unpadded_row_size, &padded_row_size)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); return error::kNoError; } GLint dest_x_offset = std::max(-x, 0); uint32 dest_row_offset; if (!GLES2Util::ComputeImageDataSizes( dest_x_offset, 1, 1, format, type, state_.pack_alignment, &dest_row_offset, NULL, NULL)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); return error::kNoError; } // Copy each row into the larger dest rect. int8* dst = static_cast<int8*>(pixels); GLint read_x = std::max(0, x); GLint read_end_x = std::max(0, std::min(max_size.width(), max_x)); GLint read_width = read_end_x - read_x; for (GLint yy = 0; yy < height; ++yy) { GLint ry = y + yy; // Clear the row. memset(dst, 0, unpadded_row_size); // If the row is in range, copy it. if (ry >= 0 && ry < max_size.height() && read_width > 0) { glReadPixels( read_x, ry, read_width, 1, format, type, dst + dest_row_offset); } dst += padded_row_size; } } else { if (async && features().use_async_readpixels) { GLuint buffer = 0; glGenBuffersARB(1, &buffer); glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer); // For ANGLE client version 2, GL_STREAM_READ is not available. const GLenum usage_hint = feature_info_->gl_version_info().is_angle ? GL_STATIC_DRAW : GL_STREAM_READ; glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, usage_hint); GLenum error = glGetError(); if (error == GL_NO_ERROR) { glReadPixels(x, y, width, height, format, type, 0); pending_readpixel_fences_.push(linked_ptr<FenceCallback>( new FenceCallback())); WaitForReadPixels(base::Bind( &GLES2DecoderImpl::FinishReadPixels, base::internal::SupportsWeakPtrBase::StaticAsWeakPtr <GLES2DecoderImpl>(this), c, buffer)); glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 0); return error::kNoError; } else { // On error, unbind pack buffer and fall through to sync readpixels glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 0); glDeleteBuffersARB(1, &buffer); } } glReadPixels(x, y, width, height, format, type, pixels); } GLenum error = LOCAL_PEEK_GL_ERROR("glReadPixels"); if (error == GL_NO_ERROR) { if (result != NULL) { *result = true; } FinishReadPixels(c, 0); } return error::kNoError; } error::Error GLES2DecoderImpl::HandlePixelStorei(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::PixelStorei& c = *static_cast<const gles2::cmds::PixelStorei*>(cmd_data); GLenum pname = c.pname; GLenum param = c.param; if (!validators_->pixel_store.IsValid(pname)) { LOCAL_SET_GL_ERROR_INVALID_ENUM("glPixelStorei", pname, "pname"); return error::kNoError; } switch (pname) { case GL_PACK_ALIGNMENT: case GL_UNPACK_ALIGNMENT: if (!validators_->pixel_store_alignment.IsValid(param)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glPixelStorei", "param GL_INVALID_VALUE"); return error::kNoError; } break; case GL_UNPACK_FLIP_Y_CHROMIUM: unpack_flip_y_ = (param != 0); return error::kNoError; case GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM: unpack_premultiply_alpha_ = (param != 0); return error::kNoError; case GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM: unpack_unpremultiply_alpha_ = (param != 0); return error::kNoError; default: break; } glPixelStorei(pname, param); switch (pname) { case GL_PACK_ALIGNMENT: state_.pack_alignment = param; break; case GL_PACK_REVERSE_ROW_ORDER_ANGLE: state_.pack_reverse_row_order = (param != 0); break; case GL_UNPACK_ALIGNMENT: state_.unpack_alignment = param; break; default: // Validation should have prevented us from getting here. NOTREACHED(); break; } return error::kNoError; } error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::PostSubBufferCHROMIUM& c = *static_cast<const gles2::cmds::PostSubBufferCHROMIUM*>(cmd_data); TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); { TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); } if (!supports_post_sub_buffer_) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glPostSubBufferCHROMIUM", "command not supported by surface"); return error::kNoError; } bool is_tracing; TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), &is_tracing); if (is_tracing) { bool is_offscreen = !!offscreen_target_frame_buffer_.get(); ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( is_offscreen ? offscreen_size_ : surface_->GetSize()); } if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) { return error::kNoError; } else { LOG(ERROR) << "Context lost because PostSubBuffer failed."; return error::kLostContext; } } error::Error GLES2DecoderImpl::HandleScheduleOverlayPlaneCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::ScheduleOverlayPlaneCHROMIUM& c = *static_cast<const gles2::cmds::ScheduleOverlayPlaneCHROMIUM*>(cmd_data); TextureRef* ref = texture_manager()->GetTexture(c.overlay_texture_id); if (!ref) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleOverlayPlaneCHROMIUM", "unknown texture"); return error::kNoError; } gfx::GLImage* image = ref->texture()->GetLevelImage(ref->texture()->target(), 0); if (!image) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleOverlayPlaneCHROMIUM", "unsupported texture format"); return error::kNoError; } gfx::OverlayTransform transform = GetGFXOverlayTransform(c.plane_transform); if (transform == gfx::OVERLAY_TRANSFORM_INVALID) { LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, "glScheduleOverlayPlaneCHROMIUM", "invalid transform enum"); return error::kNoError; } if (!surface_->ScheduleOverlayPlane( c.plane_z_order, transform, image, gfx::Rect(c.bounds_x, c.bounds_y, c.bounds_width, c.bounds_height), gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height))) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleOverlayPlaneCHROMIUM", "failed to schedule overlay"); } return error::kNoError; } error::Error GLES2DecoderImpl::GetAttribLocationHelper( GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, const std::string& name_str) { if (!StringIsValidForGLES(name_str.c_str())) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glGetAttribLocation", "Invalid character"); return error::kNoError; } Program* program = GetProgramInfoNotShader( client_id, "glGetAttribLocation"); if (!program) { return error::kNoError; } if (!program->IsValid()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glGetAttribLocation", "program not linked"); return error::kNoError; } GLint* location = GetSharedMemoryAs<GLint*>( location_shm_id, location_shm_offset, sizeof(GLint)); if (!location) { return error::kOutOfBounds; } // Require the client to init this incase the context is lost and we are no // longer executing commands. if (*location != -1) { return error::kGenericError; } *location = program->GetAttribLocation(name_str); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetAttribLocation( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetAttribLocation& c = *static_cast<const gles2::cmds::GetAttribLocation*>(cmd_data); Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket) { return error::kInvalidArguments; } std::string name_str; if (!bucket->GetAsString(&name_str)) { return error::kInvalidArguments; } return GetAttribLocationHelper( c.program, c.location_shm_id, c.location_shm_offset, name_str); } error::Error GLES2DecoderImpl::GetUniformLocationHelper( GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, const std::string& name_str) { if (!StringIsValidForGLES(name_str.c_str())) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glGetUniformLocation", "Invalid character"); return error::kNoError; } Program* program = GetProgramInfoNotShader( client_id, "glGetUniformLocation"); if (!program) { return error::kNoError; } if (!program->IsValid()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glGetUniformLocation", "program not linked"); return error::kNoError; } GLint* location = GetSharedMemoryAs<GLint*>( location_shm_id, location_shm_offset, sizeof(GLint)); if (!location) { return error::kOutOfBounds; } // Require the client to init this incase the context is lost an we are no // longer executing commands. if (*location != -1) { return error::kGenericError; } *location = program->GetUniformFakeLocation(name_str); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetUniformLocation( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetUniformLocation& c = *static_cast<const gles2::cmds::GetUniformLocation*>(cmd_data); Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket) { return error::kInvalidArguments; } std::string name_str; if (!bucket->GetAsString(&name_str)) { return error::kInvalidArguments; } return GetUniformLocationHelper( c.program, c.location_shm_id, c.location_shm_offset, name_str); } error::Error GLES2DecoderImpl::HandleGetUniformIndices( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetUniformIndices& c = *static_cast<const gles2::cmds::GetUniformIndices*>(cmd_data); Bucket* bucket = GetBucket(c.names_bucket_id); if (!bucket) { return error::kInvalidArguments; } GLsizei count = 0; std::vector<char*> names; std::vector<GLint> len; if (!bucket->GetAsStrings(&count, &names, &len) || count <= 0) { return error::kInvalidArguments; } typedef cmds::GetUniformIndices::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.indices_shm_id, c.indices_shm_offset, Result::ComputeSize(static_cast<size_t>(count))); GLuint* indices = result ? result->GetData() : NULL; if (indices == NULL) { return error::kOutOfBounds; } // Check that the client initialized the result. if (result->size != 0) { return error::kInvalidArguments; } Program* program = GetProgramInfoNotShader(c.program, "glGetUniformIndices"); if (!program) { return error::kNoError; } GLuint service_id = program->service_id(); GLint link_status = GL_FALSE; glGetProgramiv(service_id, GL_LINK_STATUS, &link_status); if (link_status != GL_TRUE) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetUniformIndices", "program not linked"); return error::kNoError; } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("GetUniformIndices"); glGetUniformIndices(service_id, count, &names[0], indices); GLenum error = glGetError(); if (error == GL_NO_ERROR) { result->SetNumResults(count); } else { LOCAL_SET_GL_ERROR(error, "GetUniformIndices", ""); } return error::kNoError; } error::Error GLES2DecoderImpl::GetFragDataLocationHelper( GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, const std::string& name_str) { GLint* location = GetSharedMemoryAs<GLint*>( location_shm_id, location_shm_offset, sizeof(GLint)); if (!location) { return error::kOutOfBounds; } // Require the client to init this incase the context is lost and we are no // longer executing commands. if (*location != -1) { return error::kGenericError; } Program* program = GetProgramInfoNotShader( client_id, "glGetFragDataLocation"); if (!program) { return error::kNoError; } *location = glGetFragDataLocation(program->service_id(), name_str.c_str()); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetFragDataLocation( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetFragDataLocation& c = *static_cast<const gles2::cmds::GetFragDataLocation*>(cmd_data); Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket) { return error::kInvalidArguments; } std::string name_str; if (!bucket->GetAsString(&name_str)) { return error::kInvalidArguments; } return GetFragDataLocationHelper( c.program, c.location_shm_id, c.location_shm_offset, name_str); } error::Error GLES2DecoderImpl::HandleGetUniformBlockIndex( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetUniformBlockIndex& c = *static_cast<const gles2::cmds::GetUniformBlockIndex*>(cmd_data); Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket) { return error::kInvalidArguments; } std::string name_str; if (!bucket->GetAsString(&name_str)) { return error::kInvalidArguments; } GLuint* index = GetSharedMemoryAs<GLuint*>( c.index_shm_id, c.index_shm_offset, sizeof(GLuint)); if (!index) { return error::kOutOfBounds; } // Require the client to init this in case the context is lost and we are no // longer executing commands. if (*index != GL_INVALID_INDEX) { return error::kGenericError; } Program* program = GetProgramInfoNotShader( c.program, "glGetUniformBlockIndex"); if (!program) { return error::kNoError; } *index = glGetUniformBlockIndex(program->service_id(), name_str.c_str()); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetString(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetString& c = *static_cast<const gles2::cmds::GetString*>(cmd_data); GLenum name = static_cast<GLenum>(c.name); if (!validators_->string_type.IsValid(name)) { LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name"); return error::kNoError; } const char* str = reinterpret_cast<const char*>(glGetString(name)); std::string extensions; switch (name) { case GL_VERSION: str = "OpenGL ES 2.0 Chromium"; break; case GL_SHADING_LANGUAGE_VERSION: str = "OpenGL ES GLSL ES 1.0 Chromium"; break; case GL_RENDERER: case GL_VENDOR: // Return the unmasked VENDOR/RENDERER string for WebGL contexts. // They are used by WEBGL_debug_renderer_info. if (!force_webgl_glsl_validation_) str = "Chromium"; break; case GL_EXTENSIONS: { // For WebGL contexts, strip out the OES derivatives and // EXT frag depth extensions if they have not been enabled. if (force_webgl_glsl_validation_) { extensions = feature_info_->extensions(); if (!derivatives_explicitly_enabled_) { size_t offset = extensions.find(kOESDerivativeExtension); if (std::string::npos != offset) { extensions.replace(offset, arraysize(kOESDerivativeExtension), std::string()); } } if (!frag_depth_explicitly_enabled_) { size_t offset = extensions.find(kEXTFragDepthExtension); if (std::string::npos != offset) { extensions.replace(offset, arraysize(kEXTFragDepthExtension), std::string()); } } if (!draw_buffers_explicitly_enabled_) { size_t offset = extensions.find(kEXTDrawBuffersExtension); if (std::string::npos != offset) { extensions.replace(offset, arraysize(kEXTDrawBuffersExtension), std::string()); } } if (!shader_texture_lod_explicitly_enabled_) { size_t offset = extensions.find(kEXTShaderTextureLodExtension); if (std::string::npos != offset) { extensions.replace(offset, arraysize(kEXTShaderTextureLodExtension), std::string()); } } } else { extensions = feature_info_->extensions().c_str(); } if (supports_post_sub_buffer_) extensions += " GL_CHROMIUM_post_sub_buffer"; str = extensions.c_str(); } break; default: break; } Bucket* bucket = CreateBucket(c.bucket_id); bucket->SetFromString(str); return error::kNoError; } error::Error GLES2DecoderImpl::HandleBufferData(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::BufferData& c = *static_cast<const gles2::cmds::BufferData*>(cmd_data); GLenum target = static_cast<GLenum>(c.target); GLsizeiptr size = static_cast<GLsizeiptr>(c.size); uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); GLenum usage = static_cast<GLenum>(c.usage); const void* data = NULL; if (data_shm_id != 0 || data_shm_offset != 0) { data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size); if (!data) { return error::kOutOfBounds; } } buffer_manager()->ValidateAndDoBufferData(&state_, target, size, data, usage); return error::kNoError; } void GLES2DecoderImpl::DoBufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data) { // Just delegate it. Some validation is actually done before this. buffer_manager()->ValidateAndDoBufferSubData( &state_, target, offset, size, data); } bool GLES2DecoderImpl::ClearLevel( Texture* texture, unsigned target, int level, unsigned internal_format, unsigned format, unsigned type, int width, int height, bool is_texture_immutable) { uint32 channels = GLES2Util::GetChannelsForFormat(format); if (feature_info_->feature_flags().angle_depth_texture && (channels & GLES2Util::kDepth) != 0) { // It's a depth format and ANGLE doesn't allow texImage2D or texSubImage2D // on depth formats. GLuint fb = 0; glGenFramebuffersEXT(1, &fb); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb); bool have_stencil = (channels & GLES2Util::kStencil) != 0; GLenum attachment = have_stencil ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT; glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, attachment, target, texture->service_id(), level); // ANGLE promises a depth only attachment ok. if (glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE) { return false; } glClearStencil(0); state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask); state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask); glClearDepth(1.0f); state_.SetDeviceDepthMask(GL_TRUE); state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); glClear(GL_DEPTH_BUFFER_BIT | (have_stencil ? GL_STENCIL_BUFFER_BIT : 0)); RestoreClearState(); glDeleteFramebuffersEXT(1, &fb); Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); GLuint fb_service_id = framebuffer ? framebuffer->service_id() : GetBackbufferServiceId(); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb_service_id); return true; } static const uint32 kMaxZeroSize = 1024 * 1024 * 4; uint32 size; uint32 padded_row_size; if (!GLES2Util::ComputeImageDataSizes( width, height, 1, format, type, state_.unpack_alignment, &size, NULL, &padded_row_size)) { return false; } TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearLevel", "size", size); int tile_height; if (size > kMaxZeroSize) { if (kMaxZeroSize < padded_row_size) { // That'd be an awfully large texture. return false; } // We should never have a large total size with a zero row size. DCHECK_GT(padded_row_size, 0U); tile_height = kMaxZeroSize / padded_row_size; if (!GLES2Util::ComputeImageDataSizes( width, tile_height, 1, format, type, state_.unpack_alignment, &size, NULL, NULL)) { return false; } } else { tile_height = height; } // Assumes the size has already been checked. scoped_ptr<char[]> zero(new char[size]); memset(zero.get(), 0, size); glBindTexture(texture->target(), texture->service_id()); bool has_images = texture->HasImages(); GLint y = 0; while (y < height) { GLint h = y + tile_height > height ? height - y : tile_height; if (is_texture_immutable || h != height || has_images) { glTexSubImage2D(target, level, 0, y, width, h, format, type, zero.get()); } else { glTexImage2D( target, level, internal_format, width, h, 0, format, type, zero.get()); } y += tile_height; } TextureRef* bound_texture = texture_manager()->GetTextureInfoForTarget(&state_, texture->target()); glBindTexture(texture->target(), bound_texture ? bound_texture->service_id() : 0); return true; } namespace { const int kS3TCBlockWidth = 4; const int kS3TCBlockHeight = 4; const int kS3TCDXT1BlockSize = 8; const int kS3TCDXT3AndDXT5BlockSize = 16; bool IsValidDXTSize(GLint level, GLsizei size) { return (size == 1) || (size == 2) || !(size % kS3TCBlockWidth); } bool IsValidPVRTCSize(GLint level, GLsizei size) { return GLES2Util::IsPOT(size); } } // anonymous namespace. bool GLES2DecoderImpl::ValidateCompressedTexFuncData( const char* function_name, GLsizei width, GLsizei height, GLenum format, size_t size) { unsigned int bytes_required = 0; switch (format) { case GL_ATC_RGB_AMD: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_ETC1_RGB8_OES: { int num_blocks_across = (width + kS3TCBlockWidth - 1) / kS3TCBlockWidth; int num_blocks_down = (height + kS3TCBlockHeight - 1) / kS3TCBlockHeight; int num_blocks = num_blocks_across * num_blocks_down; bytes_required = num_blocks * kS3TCDXT1BlockSize; break; } case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { int num_blocks_across = (width + kS3TCBlockWidth - 1) / kS3TCBlockWidth; int num_blocks_down = (height + kS3TCBlockHeight - 1) / kS3TCBlockHeight; int num_blocks = num_blocks_across * num_blocks_down; bytes_required = num_blocks * kS3TCDXT3AndDXT5BlockSize; break; } case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: { bytes_required = (std::max(width, 8) * std::max(height, 8) * 4 + 7)/8; break; } case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: { bytes_required = (std::max(width, 16) * std::max(height, 8) * 2 + 7)/8; break; } default: LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, format, "format"); return false; } if (size != bytes_required) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, function_name, "size is not correct for dimensions"); return false; } return true; } bool GLES2DecoderImpl::ValidateCompressedTexDimensions( const char* function_name, GLint level, GLsizei width, GLsizei height, GLenum format) { switch (format) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { if (!IsValidDXTSize(level, width) || !IsValidDXTSize(level, height)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "width or height invalid for level"); return false; } return true; } case GL_ATC_RGB_AMD: case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: case GL_ETC1_RGB8_OES: { if (width <= 0 || height <= 0) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "width or height invalid for level"); return false; } return true; } case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: { if (!IsValidPVRTCSize(level, width) || !IsValidPVRTCSize(level, height)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "width or height invalid for level"); return false; } return true; } default: return false; } } bool GLES2DecoderImpl::ValidateCompressedTexSubDimensions( const char* function_name, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, Texture* texture) { if (xoffset < 0 || yoffset < 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, function_name, "xoffset or yoffset < 0"); return false; } switch (format) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { const int kBlockWidth = 4; const int kBlockHeight = 4; if ((xoffset % kBlockWidth) || (yoffset % kBlockHeight)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "xoffset or yoffset not multiple of 4"); return false; } GLsizei tex_width = 0; GLsizei tex_height = 0; if (!texture->GetLevelSize(target, level, &tex_width, &tex_height) || width - xoffset > tex_width || height - yoffset > tex_height) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "dimensions out of range"); return false; } return ValidateCompressedTexDimensions( function_name, level, width, height, format); } case GL_ATC_RGB_AMD: case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "not supported for ATC textures"); return false; } case GL_ETC1_RGB8_OES: { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "not supported for ECT1_RGB8_OES textures"); return false; } case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: { if ((xoffset != 0) || (yoffset != 0)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "xoffset and yoffset must be zero"); return false; } GLsizei tex_width = 0; GLsizei tex_height = 0; if (!texture->GetLevelSize(target, level, &tex_width, &tex_height) || width != tex_width || height != tex_height) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "dimensions must match existing texture level dimensions"); return false; } return ValidateCompressedTexDimensions( function_name, level, width, height, format); } default: return false; } } error::Error GLES2DecoderImpl::DoCompressedTexImage2D( GLenum target, GLint level, GLenum internal_format, GLsizei width, GLsizei height, GLint border, GLsizei image_size, const void* data) { // TODO(gman): Validate image_size is correct for width, height and format. if (!validators_->texture_target.IsValid(target)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( "glCompressedTexImage2D", target, "target"); return error::kNoError; } if (!validators_->compressed_texture_format.IsValid( internal_format)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( "glCompressedTexImage2D", internal_format, "internal_format"); return error::kNoError; } if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || border != 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCompressedTexImage2D", "dimensions out of range"); return error::kNoError; } TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCompressedTexImage2D", "unknown texture target"); return error::kNoError; } Texture* texture = texture_ref->texture(); if (texture->IsImmutable()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCompressedTexImage2D", "texture is immutable"); return error::kNoError; } if (!ValidateCompressedTexDimensions( "glCompressedTexImage2D", level, width, height, internal_format) || !ValidateCompressedTexFuncData( "glCompressedTexImage2D", width, height, internal_format, image_size)) { return error::kNoError; } if (!EnsureGPUMemoryAvailable(image_size)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glCompressedTexImage2D", "out of memory"); return error::kNoError; } if (texture->IsAttachedToFramebuffer()) { framebuffer_state_.clear_state_dirty = true; } scoped_ptr<int8[]> zero; if (!data) { zero.reset(new int8[image_size]); memset(zero.get(), 0, image_size); data = zero.get(); } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage2D"); glCompressedTexImage2D( target, level, internal_format, width, height, border, image_size, data); GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D"); if (error == GL_NO_ERROR) { texture_manager()->SetLevelInfo( texture_ref, target, level, internal_format, width, height, 1, border, 0, 0, true); } // This may be a slow command. Exit command processing to allow for // context preemption and GPU watchdog checks. ExitCommandProcessingEarly(); return error::kNoError; } error::Error GLES2DecoderImpl::HandleCompressedTexImage2D( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::CompressedTexImage2D& c = *static_cast<const gles2::cmds::CompressedTexImage2D*>(cmd_data); GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLenum internal_format = static_cast<GLenum>(c.internalformat); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); GLint border = static_cast<GLint>(c.border); GLsizei image_size = static_cast<GLsizei>(c.imageSize); uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); const void* data = NULL; if (data_shm_id != 0 || data_shm_offset != 0) { data = GetSharedMemoryAs<const void*>( data_shm_id, data_shm_offset, image_size); if (!data) { return error::kOutOfBounds; } } return DoCompressedTexImage2D( target, level, internal_format, width, height, border, image_size, data); } error::Error GLES2DecoderImpl::HandleCompressedTexImage2DBucket( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::CompressedTexImage2DBucket& c = *static_cast<const gles2::cmds::CompressedTexImage2DBucket*>(cmd_data); GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLenum internal_format = static_cast<GLenum>(c.internalformat); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); GLint border = static_cast<GLint>(c.border); Bucket* bucket = GetBucket(c.bucket_id); if (!bucket) { return error::kInvalidArguments; } uint32 data_size = bucket->size(); GLsizei imageSize = data_size; const void* data = bucket->GetData(0, data_size); if (!data) { return error::kInvalidArguments; } return DoCompressedTexImage2D( target, level, internal_format, width, height, border, imageSize, data); } error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2DBucket( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::CompressedTexSubImage2DBucket& c = *static_cast<const gles2::cmds::CompressedTexSubImage2DBucket*>(cmd_data); GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLint xoffset = static_cast<GLint>(c.xoffset); GLint yoffset = static_cast<GLint>(c.yoffset); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); GLenum format = static_cast<GLenum>(c.format); Bucket* bucket = GetBucket(c.bucket_id); if (!bucket) { return error::kInvalidArguments; } uint32 data_size = bucket->size(); GLsizei imageSize = data_size; const void* data = bucket->GetData(0, data_size); if (!data) { return error::kInvalidArguments; } if (!validators_->texture_target.IsValid(target)) { LOCAL_SET_GL_ERROR( GL_INVALID_ENUM, "glCompressedTexSubImage2D", "target"); return error::kNoError; } if (!validators_->compressed_texture_format.IsValid(format)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( "glCompressedTexSubImage2D", format, "format"); return error::kNoError; } if (width < 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCompressedTexSubImage2D", "width < 0"); return error::kNoError; } if (height < 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCompressedTexSubImage2D", "height < 0"); return error::kNoError; } if (imageSize < 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCompressedTexSubImage2D", "imageSize < 0"); return error::kNoError; } DoCompressedTexSubImage2D( target, level, xoffset, yoffset, width, height, format, imageSize, data); return error::kNoError; } error::Error GLES2DecoderImpl::HandleTexImage2D(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::TexImage2D& c = *static_cast<const gles2::cmds::TexImage2D*>(cmd_data); TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D", "width", c.width, "height", c.height); // Set as failed for now, but if it successed, this will be set to not failed. texture_state_.tex_image_2d_failed = true; GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); // TODO(kloveless): Change TexImage2D command to use unsigned integer // for internalformat. GLenum internal_format = static_cast<GLenum>(c.internalformat); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); GLint border = static_cast<GLint>(c.border); GLenum format = static_cast<GLenum>(c.format); GLenum type = static_cast<GLenum>(c.type); uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); uint32 pixels_size; if (!GLES2Util::ComputeImageDataSizes( width, height, 1, format, type, state_.unpack_alignment, &pixels_size, NULL, NULL)) { return error::kOutOfBounds; } const void* pixels = NULL; if (pixels_shm_id != 0 || pixels_shm_offset != 0) { pixels = GetSharedMemoryAs<const void*>( pixels_shm_id, pixels_shm_offset, pixels_size); if (!pixels) { return error::kOutOfBounds; } } TextureManager::DoTextImage2DArguments args = { target, level, internal_format, width, height, border, format, type, pixels, pixels_size}; texture_manager()->ValidateAndDoTexImage2D( &texture_state_, &state_, &framebuffer_state_, args); // This may be a slow command. Exit command processing to allow for // context preemption and GPU watchdog checks. ExitCommandProcessingEarly(); return error::kNoError; } error::Error GLES2DecoderImpl::HandleTexImage3D(uint32 immediate_data_size, const void* cmd_data) { // TODO(zmo): Unsafe ES3 API. if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::TexImage3D& c = *static_cast<const gles2::cmds::TexImage3D*>(cmd_data); TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage3D", "widthXheight", c.width * c.height, "depth", c.depth); GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLenum internal_format = static_cast<GLenum>(c.internalformat); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); GLsizei depth = static_cast<GLsizei>(c.depth); GLint border = static_cast<GLint>(c.border); GLenum format = static_cast<GLenum>(c.format); GLenum type = static_cast<GLenum>(c.type); uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); uint32 pixels_size; if (!GLES2Util::ComputeImageDataSizes( width, height, depth, format, type, state_.unpack_alignment, &pixels_size, NULL, NULL)) { return error::kOutOfBounds; } const void* pixels = NULL; if (pixels_shm_id != 0 || pixels_shm_offset != 0) { pixels = GetSharedMemoryAs<const void*>( pixels_shm_id, pixels_shm_offset, pixels_size); if (!pixels) { return error::kOutOfBounds; } } glTexImage3D(target, level, internal_format, width, height, depth, border, format, type, pixels); // This may be a slow command. Exit command processing to allow for // context preemption and GPU watchdog checks. ExitCommandProcessingEarly(); return error::kNoError; } void GLES2DecoderImpl::DoCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei image_size, const void * data) { TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCompressedTexSubImage2D", "unknown texture for target"); return; } Texture* texture = texture_ref->texture(); GLenum type = 0; GLenum internal_format = 0; if (!texture->GetLevelType(target, level, &type, &internal_format)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCompressedTexSubImage2D", "level does not exist."); return; } if (internal_format != format) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCompressedTexSubImage2D", "format does not match internal format."); return; } if (!texture->ValidForTexture( target, level, xoffset, yoffset, width, height, type)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCompressedTexSubImage2D", "bad dimensions."); return; } if (!ValidateCompressedTexFuncData( "glCompressedTexSubImage2D", width, height, format, image_size) || !ValidateCompressedTexSubDimensions( "glCompressedTexSubImage2D", target, level, xoffset, yoffset, width, height, format, texture)) { return; } // Note: There is no need to deal with texture cleared tracking here // because the validation above means you can only get here if the level // is already a matching compressed format and in that case // CompressedTexImage2D already cleared the texture. glCompressedTexSubImage2D( target, level, xoffset, yoffset, width, height, format, image_size, data); // This may be a slow command. Exit command processing to allow for // context preemption and GPU watchdog checks. ExitCommandProcessingEarly(); } static void Clip( GLint start, GLint range, GLint sourceRange, GLint* out_start, GLint* out_range) { DCHECK(out_start); DCHECK(out_range); if (start < 0) { range += start; start = 0; } GLint end = start + range; if (end > sourceRange) { range -= end - sourceRange; } *out_start = start; *out_range = range; } void GLES2DecoderImpl::DoCopyTexImage2D( GLenum target, GLint level, GLenum internal_format, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { DCHECK(!ShouldDeferReads()); TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCopyTexImage2D", "unknown texture for target"); return; } Texture* texture = texture_ref->texture(); if (texture->IsImmutable()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCopyTexImage2D", "texture is immutable"); return; } if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || border != 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCopyTexImage2D", "dimensions out of range"); return; } if (!texture_manager()->ValidateFormatAndTypeCombination( state_.GetErrorState(), "glCopyTexImage2D", internal_format, GL_UNSIGNED_BYTE)) { return; } // Check we have compatible formats. GLenum read_format = GetBoundReadFrameBufferInternalFormat(); uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); uint32 channels_needed = GLES2Util::GetChannelsForFormat(internal_format); if ((channels_needed & channels_exist) != channels_needed) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCopyTexImage2D", "incompatible format"); return; } if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCopyTexImage2D", "can not be used with depth or stencil textures"); return; } uint32 estimated_size = 0; if (!GLES2Util::ComputeImageDataSizes( width, height, 1, internal_format, GL_UNSIGNED_BYTE, state_.unpack_alignment, &estimated_size, NULL, NULL)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glCopyTexImage2D", "dimensions too large"); return; } if (!EnsureGPUMemoryAvailable(estimated_size)) { LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopyTexImage2D", "out of memory"); return; } if (!CheckBoundReadFramebufferColorAttachment("glCopyTexImage2D")) { return; } if (FormsTextureCopyingFeedbackLoop(texture_ref, level)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCopyTexImage2D", "source and destination textures are the same"); return; } if (!CheckBoundFramebuffersValid("glCopyTexImage2D")) { return; } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTexImage2D"); ScopedResolvedFrameBufferBinder binder(this, false, true); gfx::Size size = GetBoundReadFrameBufferSize(); if (texture->IsAttachedToFramebuffer()) { framebuffer_state_.clear_state_dirty = true; } // Clip to size to source dimensions GLint copyX = 0; GLint copyY = 0; GLint copyWidth = 0; GLint copyHeight = 0; Clip(x, width, size.width(), &copyX, &copyWidth); Clip(y, height, size.height(), &copyY, &copyHeight); if (copyX != x || copyY != y || copyWidth != width || copyHeight != height) { // some part was clipped so clear the texture. if (!ClearLevel(texture, target, level, internal_format, internal_format, GL_UNSIGNED_BYTE, width, height, texture->IsImmutable())) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glCopyTexImage2D", "dimensions too big"); return; } if (copyHeight > 0 && copyWidth > 0) { GLint dx = copyX - x; GLint dy = copyY - y; GLint destX = dx; GLint destY = dy; ScopedModifyPixels modify(texture_ref); glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, copyHeight); } } else { ScopedModifyPixels modify(texture_ref); glCopyTexImage2D(target, level, internal_format, copyX, copyY, copyWidth, copyHeight, border); } GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTexImage2D"); if (error == GL_NO_ERROR) { texture_manager()->SetLevelInfo( texture_ref, target, level, internal_format, width, height, 1, border, internal_format, GL_UNSIGNED_BYTE, true); } // This may be a slow command. Exit command processing to allow for // context preemption and GPU watchdog checks. ExitCommandProcessingEarly(); } void GLES2DecoderImpl::DoCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { DCHECK(!ShouldDeferReads()); TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCopyTexSubImage2D", "unknown texture for target"); return; } Texture* texture = texture_ref->texture(); GLenum type = 0; GLenum format = 0; if (!texture->GetLevelType(target, level, &type, &format) || !texture->ValidForTexture( target, level, xoffset, yoffset, width, height, type)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCopyTexSubImage2D", "bad dimensions."); return; } if (async_pixel_transfer_manager_->AsyncTransferIsInProgress(texture_ref)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCopyTexSubImage2D", "async upload pending for texture"); return; } // Check we have compatible formats. GLenum read_format = GetBoundReadFrameBufferInternalFormat(); uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); uint32 channels_needed = GLES2Util::GetChannelsForFormat(format); if (!channels_needed || (channels_needed & channels_exist) != channels_needed) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCopyTexSubImage2D", "incompatible format"); return; } if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCopySubImage2D", "can not be used with depth or stencil textures"); return; } if (!CheckBoundReadFramebufferColorAttachment("glCopyTexSubImage2D")) { return; } if (FormsTextureCopyingFeedbackLoop(texture_ref, level)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCopyTexSubImage2D", "source and destination textures are the same"); return; } if (!CheckBoundFramebuffersValid("glCopyTexSubImage2D")) { return; } ScopedResolvedFrameBufferBinder binder(this, false, true); gfx::Size size = GetBoundReadFrameBufferSize(); GLint copyX = 0; GLint copyY = 0; GLint copyWidth = 0; GLint copyHeight = 0; Clip(x, width, size.width(), &copyX, &copyWidth); Clip(y, height, size.height(), &copyY, &copyHeight); if (xoffset != 0 || yoffset != 0 || width != size.width() || height != size.height()) { if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, level)) { LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopyTexSubImage2D", "dimensions too big"); return; } } else { // Write all pixels in below. texture_manager()->SetLevelCleared(texture_ref, target, level, true); } if (copyX != x || copyY != y || copyWidth != width || copyHeight != height) { // some part was clipped so clear the sub rect. uint32 pixels_size = 0; if (!GLES2Util::ComputeImageDataSizes( width, height, 1, format, type, state_.unpack_alignment, &pixels_size, NULL, NULL)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCopyTexSubImage2D", "dimensions too large"); return; } scoped_ptr<char[]> zero(new char[pixels_size]); memset(zero.get(), 0, pixels_size); ScopedModifyPixels modify(texture_ref); glTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, zero.get()); } if (copyHeight > 0 && copyWidth > 0) { GLint dx = copyX - x; GLint dy = copyY - y; GLint destX = xoffset + dx; GLint destY = yoffset + dy; ScopedModifyPixels modify(texture_ref); glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, copyHeight); } // This may be a slow command. Exit command processing to allow for // context preemption and GPU watchdog checks. ExitCommandProcessingEarly(); } bool GLES2DecoderImpl::ValidateTexSubImage2D( error::Error* error, const char* function_name, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * data) { (*error) = error::kNoError; if (!validators_->texture_target.IsValid(target)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target"); return false; } if (width < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "width < 0"); return false; } if (height < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "height < 0"); return false; } TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "unknown texture for target"); return false; } Texture* texture = texture_ref->texture(); GLenum current_type = 0; GLenum internal_format = 0; if (!texture->GetLevelType(target, level, &current_type, &internal_format)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "level does not exist."); return false; } if (!texture_manager()->ValidateTextureParameters(state_.GetErrorState(), function_name, format, type, internal_format, level)) { return false; } if (type != current_type) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "type does not match type of texture."); return false; } if (async_pixel_transfer_manager_->AsyncTransferIsInProgress(texture_ref)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "async upload pending for texture"); return false; } if (!texture->ValidForTexture( target, level, xoffset, yoffset, width, height, type)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "bad dimensions."); return false; } if ((GLES2Util::GetChannelsForFormat(format) & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "can not supply data for depth or stencil textures"); return false; } if (data == NULL) { (*error) = error::kOutOfBounds; return false; } return true; } error::Error GLES2DecoderImpl::DoTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * data) { error::Error error = error::kNoError; if (!ValidateTexSubImage2D(&error, "glTexSubImage2D", target, level, xoffset, yoffset, width, height, format, type, data)) { return error; } TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); Texture* texture = texture_ref->texture(); GLsizei tex_width = 0; GLsizei tex_height = 0; bool ok = texture->GetLevelSize(target, level, &tex_width, &tex_height); DCHECK(ok); if (xoffset != 0 || yoffset != 0 || width != tex_width || height != tex_height) { if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, level)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glTexSubImage2D", "dimensions too big"); return error::kNoError; } ScopedTextureUploadTimer timer(&texture_state_); glTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, data); return error::kNoError; } if (!texture_state_.texsubimage2d_faster_than_teximage2d && !texture->IsImmutable() && !texture->HasImages()) { ScopedTextureUploadTimer timer(&texture_state_); GLenum internal_format; GLenum tex_type; texture->GetLevelType(target, level, &tex_type, &internal_format); // NOTE: In OpenGL ES 2.0 border is always zero. If that changes we'll need // to look it up. glTexImage2D( target, level, internal_format, width, height, 0, format, type, data); } else { ScopedTextureUploadTimer timer(&texture_state_); glTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, data); } texture_manager()->SetLevelCleared(texture_ref, target, level, true); // This may be a slow command. Exit command processing to allow for // context preemption and GPU watchdog checks. ExitCommandProcessingEarly(); return error::kNoError; } error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::TexSubImage2D& c = *static_cast<const gles2::cmds::TexSubImage2D*>(cmd_data); TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage2D", "width", c.width, "height", c.height); GLboolean internal = static_cast<GLboolean>(c.internal); if (internal == GL_TRUE && texture_state_.tex_image_2d_failed) return error::kNoError; GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLint xoffset = static_cast<GLint>(c.xoffset); GLint yoffset = static_cast<GLint>(c.yoffset); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); GLenum format = static_cast<GLenum>(c.format); GLenum type = static_cast<GLenum>(c.type); uint32 data_size; if (!GLES2Util::ComputeImageDataSizes( width, height, 1, format, type, state_.unpack_alignment, &data_size, NULL, NULL)) { return error::kOutOfBounds; } const void* pixels = GetSharedMemoryAs<const void*>( c.pixels_shm_id, c.pixels_shm_offset, data_size); return DoTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels); } // TODO(zmo): Remove the below stub once we add the real function binding. // Currently it's missing due to a gmock limitation. static void glTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei height, GLsizei width, GLsizei depth, GLenum format, GLenum type, const void* pixels) { NOTIMPLEMENTED(); } error::Error GLES2DecoderImpl::HandleTexSubImage3D(uint32 immediate_data_size, const void* cmd_data) { // TODO(zmo): Unsafe ES3 API. if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::TexSubImage3D& c = *static_cast<const gles2::cmds::TexSubImage3D*>(cmd_data); TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage3D", "widthXheight", c.width * c.height, "depth", c.depth); GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLint xoffset = static_cast<GLint>(c.xoffset); GLint yoffset = static_cast<GLint>(c.yoffset); GLint zoffset = static_cast<GLint>(c.zoffset); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); GLsizei depth = static_cast<GLsizei>(c.depth); GLenum format = static_cast<GLenum>(c.format); GLenum type = static_cast<GLenum>(c.type); uint32 data_size; if (!GLES2Util::ComputeImageDataSizes( width, height, depth, format, type, state_.unpack_alignment, &data_size, NULL, NULL)) { return error::kOutOfBounds; } const void* pixels = GetSharedMemoryAs<const void*>( c.pixels_shm_id, c.pixels_shm_offset, data_size); glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetVertexAttribPointerv& c = *static_cast<const gles2::cmds::GetVertexAttribPointerv*>(cmd_data); GLuint index = static_cast<GLuint>(c.index); GLenum pname = static_cast<GLenum>(c.pname); typedef cmds::GetVertexAttribPointerv::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); if (!result) { return error::kOutOfBounds; } // Check that the client initialized the result. if (result->size != 0) { return error::kInvalidArguments; } if (!validators_->vertex_pointer.IsValid(pname)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( "glGetVertexAttribPointerv", pname, "pname"); return error::kNoError; } if (index >= group_->max_vertex_attribs()) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glGetVertexAttribPointerv", "index out of range."); return error::kNoError; } result->SetNumResults(1); *result->GetData() = state_.vertex_attrib_manager->GetVertexAttrib(index)->offset(); return error::kNoError; } bool GLES2DecoderImpl::GetUniformSetup(GLuint program_id, GLint fake_location, uint32 shm_id, uint32 shm_offset, error::Error* error, GLint* real_location, GLuint* service_id, void** result_pointer, GLenum* result_type, GLsizei* result_size) { DCHECK(error); DCHECK(service_id); DCHECK(result_pointer); DCHECK(result_type); DCHECK(real_location); *error = error::kNoError; // Make sure we have enough room for the result on failure. SizedResult<GLint>* result; result = GetSharedMemoryAs<SizedResult<GLint>*>( shm_id, shm_offset, SizedResult<GLint>::ComputeSize(0)); if (!result) { *error = error::kOutOfBounds; return false; } *result_pointer = result; // Set the result size to 0 so the client does not have to check for success. result->SetNumResults(0); Program* program = GetProgramInfoNotShader(program_id, "glGetUniform"); if (!program) { return false; } if (!program->IsValid()) { // Program was not linked successfully. (ie, glLinkProgram) LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glGetUniform", "program not linked"); return false; } *service_id = program->service_id(); GLint array_index = -1; const Program::UniformInfo* uniform_info = program->GetUniformInfoByFakeLocation( fake_location, real_location, &array_index); if (!uniform_info) { // No such location. LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glGetUniform", "unknown location"); return false; } GLenum type = uniform_info->type; GLsizei size = GLES2Util::GetGLDataTypeSizeForUniforms(type); if (size == 0) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetUniform", "unknown type"); return false; } result = GetSharedMemoryAs<SizedResult<GLint>*>( shm_id, shm_offset, SizedResult<GLint>::ComputeSizeFromBytes(size)); if (!result) { *error = error::kOutOfBounds; return false; } result->size = size; *result_size = size; *result_type = type; return true; } error::Error GLES2DecoderImpl::HandleGetUniformiv(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetUniformiv& c = *static_cast<const gles2::cmds::GetUniformiv*>(cmd_data); GLuint program = c.program; GLint fake_location = c.location; GLuint service_id; GLenum result_type; GLsizei result_size; GLint real_location = -1; Error error; void* result; if (GetUniformSetup(program, fake_location, c.params_shm_id, c.params_shm_offset, &error, &real_location, &service_id, &result, &result_type, &result_size)) { glGetUniformiv( service_id, real_location, static_cast<cmds::GetUniformiv::Result*>(result)->GetData()); } return error; } error::Error GLES2DecoderImpl::HandleGetUniformfv(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetUniformfv& c = *static_cast<const gles2::cmds::GetUniformfv*>(cmd_data); GLuint program = c.program; GLint fake_location = c.location; GLuint service_id; GLint real_location = -1; Error error; typedef cmds::GetUniformfv::Result Result; Result* result; GLenum result_type; GLsizei result_size; if (GetUniformSetup(program, fake_location, c.params_shm_id, c.params_shm_offset, &error, &real_location, &service_id, reinterpret_cast<void**>(&result), &result_type, &result_size)) { if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { GLsizei num_values = result_size / sizeof(Result::Type); scoped_ptr<GLint[]> temp(new GLint[num_values]); glGetUniformiv(service_id, real_location, temp.get()); GLfloat* dst = result->GetData(); for (GLsizei ii = 0; ii < num_values; ++ii) { dst[ii] = (temp[ii] != 0); } } else { glGetUniformfv(service_id, real_location, result->GetData()); } } return error; } error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetShaderPrecisionFormat& c = *static_cast<const gles2::cmds::GetShaderPrecisionFormat*>(cmd_data); GLenum shader_type = static_cast<GLenum>(c.shadertype); GLenum precision_type = static_cast<GLenum>(c.precisiontype); typedef cmds::GetShaderPrecisionFormat::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } // Check that the client initialized the result. if (result->success != 0) { return error::kInvalidArguments; } if (!validators_->shader_type.IsValid(shader_type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( "glGetShaderPrecisionFormat", shader_type, "shader_type"); return error::kNoError; } if (!validators_->shader_precision.IsValid(precision_type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( "glGetShaderPrecisionFormat", precision_type, "precision_type"); return error::kNoError; } result->success = 1; // true GLint range[2] = { 0, 0 }; GLint precision = 0; GetShaderPrecisionFormatImpl(shader_type, precision_type, range, &precision); result->min_range = range[0]; result->max_range = range[1]; result->precision = precision; return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetAttachedShaders( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetAttachedShaders& c = *static_cast<const gles2::cmds::GetAttachedShaders*>(cmd_data); uint32 result_size = c.result_size; GLuint program_id = static_cast<GLuint>(c.program); Program* program = GetProgramInfoNotShader( program_id, "glGetAttachedShaders"); if (!program) { return error::kNoError; } typedef cmds::GetAttachedShaders::Result Result; uint32 max_count = Result::ComputeMaxResults(result_size); Result* result = GetSharedMemoryAs<Result*>( c.result_shm_id, c.result_shm_offset, Result::ComputeSize(max_count)); if (!result) { return error::kOutOfBounds; } // Check that the client initialized the result. if (result->size != 0) { return error::kInvalidArguments; } GLsizei count = 0; glGetAttachedShaders( program->service_id(), max_count, &count, result->GetData()); for (GLsizei ii = 0; ii < count; ++ii) { if (!shader_manager()->GetClientId(result->GetData()[ii], &result->GetData()[ii])) { NOTREACHED(); return error::kGenericError; } } result->SetNumResults(count); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetActiveUniform( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetActiveUniform& c = *static_cast<const gles2::cmds::GetActiveUniform*>(cmd_data); GLuint program_id = c.program; GLuint index = c.index; uint32 name_bucket_id = c.name_bucket_id; typedef cmds::GetActiveUniform::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } // Check that the client initialized the result. if (result->success != 0) { return error::kInvalidArguments; } Program* program = GetProgramInfoNotShader( program_id, "glGetActiveUniform"); if (!program) { return error::kNoError; } const Program::UniformInfo* uniform_info = program->GetUniformInfo(index); if (!uniform_info) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glGetActiveUniform", "index out of range"); return error::kNoError; } result->success = 1; // true. result->size = uniform_info->size; result->type = uniform_info->type; Bucket* bucket = CreateBucket(name_bucket_id); bucket->SetFromString(uniform_info->name.c_str()); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockiv( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetActiveUniformBlockiv& c = *static_cast<const gles2::cmds::GetActiveUniformBlockiv*>(cmd_data); GLuint program_id = c.program; GLuint index = static_cast<GLuint>(c.index); GLenum pname = static_cast<GLenum>(c.pname); Program* program = GetProgramInfoNotShader( program_id, "glGetActiveUniformBlockiv"); if (!program) { return error::kNoError; } GLuint service_id = program->service_id(); GLint link_status = GL_FALSE; glGetProgramiv(service_id, GL_LINK_STATUS, &link_status); if (link_status != GL_TRUE) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetActiveActiveUniformBlockiv", "program not linked"); return error::kNoError; } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("GetActiveUniformBlockiv"); GLsizei num_values = 1; if (pname == GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) { GLint num = 0; glGetActiveUniformBlockiv( service_id, index, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &num); GLenum error = glGetError(); if (error != GL_NO_ERROR) { // Assume this will the same error if calling with pname. LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", ""); return error::kNoError; } num_values = static_cast<GLsizei>(num); } typedef cmds::GetActiveUniformBlockiv::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); GLint* params = result ? result->GetData() : NULL; if (params == NULL) { return error::kOutOfBounds; } // Check that the client initialized the result. if (result->size != 0) { return error::kInvalidArguments; } glGetActiveUniformBlockiv(service_id, index, pname, params); GLenum error = glGetError(); if (error == GL_NO_ERROR) { result->SetNumResults(num_values); } else { LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", ""); } return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockName( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetActiveUniformBlockName& c = *static_cast<const gles2::cmds::GetActiveUniformBlockName*>(cmd_data); GLuint program_id = c.program; GLuint index = c.index; uint32 name_bucket_id = c.name_bucket_id; typedef cmds::GetActiveUniformBlockName::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } // Check that the client initialized the result. if (*result != 0) { return error::kInvalidArguments; } Program* program = GetProgramInfoNotShader( program_id, "glGetActiveUniformBlockName"); if (!program) { return error::kNoError; } GLuint service_id = program->service_id(); GLint link_status = GL_FALSE; glGetProgramiv(service_id, GL_LINK_STATUS, &link_status); if (link_status != GL_TRUE) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetActiveActiveUniformBlockName", "program not linked"); return error::kNoError; } GLint max_length = 0; glGetProgramiv( service_id, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &max_length); // Increase one so &buffer[0] is always valid. GLsizei buf_size = static_cast<GLsizei>(max_length) + 1; std::vector<char> buffer(buf_size); GLsizei length = 0; glGetActiveUniformBlockName( service_id, index, buf_size, &length, &buffer[0]); if (length == 0) { *result = 0; return error::kNoError; } *result = 1; Bucket* bucket = CreateBucket(name_bucket_id); DCHECK_GT(buf_size, length); DCHECK_EQ(0, buffer[length]); bucket->SetFromString(&buffer[0]); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetActiveUniformsiv( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetActiveUniformsiv& c = *static_cast<const gles2::cmds::GetActiveUniformsiv*>(cmd_data); GLuint program_id = c.program; GLenum pname = static_cast<GLenum>(c.pname); Bucket* bucket = GetBucket(c.indices_bucket_id); if (!bucket) { return error::kInvalidArguments; } GLsizei count = static_cast<GLsizei>(bucket->size() / sizeof(GLuint)); const GLuint* indices = bucket->GetDataAs<const GLuint*>(0, bucket->size()); typedef cmds::GetActiveUniformsiv::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.params_shm_id, c.params_shm_offset, Result::ComputeSize(count)); GLint* params = result ? result->GetData() : NULL; if (params == NULL) { return error::kOutOfBounds; } // Check that the client initialized the result. if (result->size != 0) { return error::kInvalidArguments; } Program* program = GetProgramInfoNotShader( program_id, "glGetActiveUniformsiv"); if (!program) { return error::kNoError; } GLuint service_id = program->service_id(); GLint link_status = GL_FALSE; glGetProgramiv(service_id, GL_LINK_STATUS, &link_status); if (link_status != GL_TRUE) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetActiveUniformsiv", "program not linked"); return error::kNoError; } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("GetActiveUniformsiv"); glGetActiveUniformsiv(service_id, count, indices, pname, params); GLenum error = glGetError(); if (error == GL_NO_ERROR) { result->SetNumResults(count); } else { LOCAL_SET_GL_ERROR(error, "GetActiveUniformsiv", ""); } return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetActiveAttrib(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetActiveAttrib& c = *static_cast<const gles2::cmds::GetActiveAttrib*>(cmd_data); GLuint program_id = c.program; GLuint index = c.index; uint32 name_bucket_id = c.name_bucket_id; typedef cmds::GetActiveAttrib::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } // Check that the client initialized the result. if (result->success != 0) { return error::kInvalidArguments; } Program* program = GetProgramInfoNotShader( program_id, "glGetActiveAttrib"); if (!program) { return error::kNoError; } const Program::VertexAttrib* attrib_info = program->GetAttribInfo(index); if (!attrib_info) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glGetActiveAttrib", "index out of range"); return error::kNoError; } result->success = 1; // true. result->size = attrib_info->size; result->type = attrib_info->type; Bucket* bucket = CreateBucket(name_bucket_id); bucket->SetFromString(attrib_info->name.c_str()); return error::kNoError; } error::Error GLES2DecoderImpl::HandleShaderBinary(uint32 immediate_data_size, const void* cmd_data) { #if 1 // No binary shader support. LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glShaderBinary", "not supported"); return error::kNoError; #else GLsizei n = static_cast<GLsizei>(c.n); if (n < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "n < 0"); return error::kNoError; } GLsizei length = static_cast<GLsizei>(c.length); if (length < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "length < 0"); return error::kNoError; } uint32 data_size; if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { return error::kOutOfBounds; } const GLuint* shaders = GetSharedMemoryAs<const GLuint*>( c.shaders_shm_id, c.shaders_shm_offset, data_size); GLenum binaryformat = static_cast<GLenum>(c.binaryformat); const void* binary = GetSharedMemoryAs<const void*>( c.binary_shm_id, c.binary_shm_offset, length); if (shaders == NULL || binary == NULL) { return error::kOutOfBounds; } scoped_ptr<GLuint[]> service_ids(new GLuint[n]); for (GLsizei ii = 0; ii < n; ++ii) { Shader* shader = GetShader(shaders[ii]); if (!shader) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "unknown shader"); return error::kNoError; } service_ids[ii] = shader->service_id(); } // TODO(gman): call glShaderBinary return error::kNoError; #endif } void GLES2DecoderImpl::DoSwapBuffers() { bool is_offscreen = !!offscreen_target_frame_buffer_.get(); int this_frame_number = frame_number_++; // TRACE_EVENT for gpu tests: TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency", TRACE_EVENT_SCOPE_THREAD, "GLImpl", static_cast<int>(gfx::GetGLImplementation()), "width", (is_offscreen ? offscreen_size_.width() : surface_->GetSize().width())); TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", "offscreen", is_offscreen, "frame", this_frame_number); { TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); } ScopedGPUTrace scoped_gpu_trace(gpu_tracer_.get(), kTraceDecoder, "gpu_toplevel", "SwapBuffer"); bool is_tracing; TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), &is_tracing); if (is_tracing) { ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( is_offscreen ? offscreen_size_ : surface_->GetSize()); } // If offscreen then don't actually SwapBuffers to the display. Just copy // the rendered frame to another frame buffer. if (is_offscreen) { TRACE_EVENT2("gpu", "Offscreen", "width", offscreen_size_.width(), "height", offscreen_size_.height()); if (offscreen_size_ != offscreen_saved_color_texture_->size()) { // Workaround for NVIDIA driver bug on OS X; crbug.com/89557, // crbug.com/94163. TODO(kbr): figure out reproduction so Apple will // fix this. if (workarounds().needs_offscreen_buffer_workaround) { offscreen_saved_frame_buffer_->Create(); glFinish(); } // Allocate the offscreen saved color texture. DCHECK(offscreen_saved_color_format_); offscreen_saved_color_texture_->AllocateStorage( offscreen_size_, offscreen_saved_color_format_, false); offscreen_saved_frame_buffer_->AttachRenderTexture( offscreen_saved_color_texture_.get()); if (offscreen_size_.width() != 0 && offscreen_size_.height() != 0) { if (offscreen_saved_frame_buffer_->CheckStatus() != GL_FRAMEBUFFER_COMPLETE) { LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " << "because offscreen saved FBO was incomplete."; LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); return; } // Clear the offscreen color texture. // TODO(piman): Is this still necessary? { ScopedFrameBufferBinder binder(this, offscreen_saved_frame_buffer_->id()); glClearColor(0, 0, 0, 0); state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); glClear(GL_COLOR_BUFFER_BIT); RestoreClearState(); } } UpdateParentTextureInfo(); } if (offscreen_size_.width() == 0 || offscreen_size_.height() == 0) return; ScopedGLErrorSuppressor suppressor( "GLES2DecoderImpl::DoSwapBuffers", GetErrorState()); if (IsOffscreenBufferMultisampled()) { // For multisampled buffers, resolve the frame buffer. ScopedResolvedFrameBufferBinder binder(this, true, false); } else { ScopedFrameBufferBinder binder(this, offscreen_target_frame_buffer_->id()); if (offscreen_target_buffer_preserved_) { // Copy the target frame buffer to the saved offscreen texture. offscreen_saved_color_texture_->Copy( offscreen_saved_color_texture_->size(), offscreen_saved_color_format_); } else { // Flip the textures in the parent context via the texture manager. if (!!offscreen_saved_color_texture_info_.get()) offscreen_saved_color_texture_info_->texture()-> SetServiceId(offscreen_target_color_texture_->id()); offscreen_saved_color_texture_.swap(offscreen_target_color_texture_); offscreen_target_frame_buffer_->AttachRenderTexture( offscreen_target_color_texture_.get()); } // Ensure the side effects of the copy are visible to the parent // context. There is no need to do this for ANGLE because it uses a // single D3D device for all contexts. if (!feature_info_->gl_version_info().is_angle) glFlush(); } } else { if (!surface_->SwapBuffers()) { LOG(ERROR) << "Context lost because SwapBuffers failed."; LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); } } // This may be a slow command. Exit command processing to allow for // context preemption and GPU watchdog checks. ExitCommandProcessingEarly(); } void GLES2DecoderImpl::DoSwapInterval(int interval) { context_->SetSwapInterval(interval); } error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::EnableFeatureCHROMIUM& c = *static_cast<const gles2::cmds::EnableFeatureCHROMIUM*>(cmd_data); Bucket* bucket = GetBucket(c.bucket_id); if (!bucket || bucket->size() == 0) { return error::kInvalidArguments; } typedef cmds::EnableFeatureCHROMIUM::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } // Check that the client initialized the result. if (*result != 0) { return error::kInvalidArguments; } std::string feature_str; if (!bucket->GetAsString(&feature_str)) { return error::kInvalidArguments; } // TODO(gman): make this some kind of table to function pointer thingy. if (feature_str.compare("pepper3d_allow_buffers_on_multiple_targets") == 0) { buffer_manager()->set_allow_buffers_on_multiple_targets(true); } else if (feature_str.compare("pepper3d_support_fixed_attribs") == 0) { buffer_manager()->set_allow_fixed_attribs(true); // TODO(gman): decide how to remove the need for this const_cast. // I could make validators_ non const but that seems bad as this is the only // place it is needed. I could make some special friend class of validators // just to allow this to set them. That seems silly. I could refactor this // code to use the extension mechanism or the initialization attributes to // turn this feature on. Given that the only real point of this is to make // the conformance tests pass and given that there is lots of real work that // needs to be done it seems like refactoring for one to one of those // methods is a very low priority. const_cast<Validators*>(validators_)->vertex_attrib_type.AddValue(GL_FIXED); } else if (feature_str.compare("webgl_enable_glsl_webgl_validation") == 0) { force_webgl_glsl_validation_ = true; InitializeShaderTranslator(); } else { return error::kNoError; } *result = 1; // true. return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetRequestableExtensionsCHROMIUM& c = *static_cast<const gles2::cmds::GetRequestableExtensionsCHROMIUM*>( cmd_data); Bucket* bucket = CreateBucket(c.bucket_id); scoped_refptr<FeatureInfo> info(new FeatureInfo()); info->Initialize(disallowed_features_); bucket->SetFromString(info->extensions().c_str()); return error::kNoError; } error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::RequestExtensionCHROMIUM& c = *static_cast<const gles2::cmds::RequestExtensionCHROMIUM*>(cmd_data); Bucket* bucket = GetBucket(c.bucket_id); if (!bucket || bucket->size() == 0) { return error::kInvalidArguments; } std::string feature_str; if (!bucket->GetAsString(&feature_str)) { return error::kInvalidArguments; } bool desire_webgl_glsl_validation = feature_str.find("GL_CHROMIUM_webglsl") != std::string::npos; bool desire_standard_derivatives = false; bool desire_frag_depth = false; bool desire_draw_buffers = false; bool desire_shader_texture_lod = false; if (force_webgl_glsl_validation_) { desire_standard_derivatives = feature_str.find("GL_OES_standard_derivatives") != std::string::npos; desire_frag_depth = feature_str.find("GL_EXT_frag_depth") != std::string::npos; desire_draw_buffers = feature_str.find("GL_EXT_draw_buffers") != std::string::npos; desire_shader_texture_lod = feature_str.find("GL_EXT_shader_texture_lod") != std::string::npos; } if (desire_webgl_glsl_validation != force_webgl_glsl_validation_ || desire_standard_derivatives != derivatives_explicitly_enabled_ || desire_frag_depth != frag_depth_explicitly_enabled_ || desire_draw_buffers != draw_buffers_explicitly_enabled_) { force_webgl_glsl_validation_ |= desire_webgl_glsl_validation; derivatives_explicitly_enabled_ |= desire_standard_derivatives; frag_depth_explicitly_enabled_ |= desire_frag_depth; draw_buffers_explicitly_enabled_ |= desire_draw_buffers; shader_texture_lod_explicitly_enabled_ |= desire_shader_texture_lod; InitializeShaderTranslator(); } UpdateCapabilities(); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetProgramInfoCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetProgramInfoCHROMIUM& c = *static_cast<const gles2::cmds::GetProgramInfoCHROMIUM*>(cmd_data); GLuint program_id = static_cast<GLuint>(c.program); uint32 bucket_id = c.bucket_id; Bucket* bucket = CreateBucket(bucket_id); bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail. Program* program = NULL; program = GetProgram(program_id); if (!program || !program->IsValid()) { return error::kNoError; } program->GetProgramInfo(program_manager(), bucket); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetUniformBlocksCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetUniformBlocksCHROMIUM& c = *static_cast<const gles2::cmds::GetUniformBlocksCHROMIUM*>(cmd_data); GLuint program_id = static_cast<GLuint>(c.program); uint32 bucket_id = c.bucket_id; Bucket* bucket = CreateBucket(bucket_id); bucket->SetSize(sizeof(UniformBlocksHeader)); // in case we fail. Program* program = NULL; program = GetProgram(program_id); if (!program || !program->IsValid()) { return error::kNoError; } program->GetUniformBlocks(bucket); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetUniformsES3CHROMIUM( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetUniformsES3CHROMIUM& c = *static_cast<const gles2::cmds::GetUniformsES3CHROMIUM*>(cmd_data); GLuint program_id = static_cast<GLuint>(c.program); uint32 bucket_id = c.bucket_id; Bucket* bucket = CreateBucket(bucket_id); bucket->SetSize(sizeof(UniformsES3Header)); // in case we fail. Program* program = NULL; program = GetProgram(program_id); if (!program || !program->IsValid()) { return error::kNoError; } program->GetUniformsES3(bucket); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVarying( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetTransformFeedbackVarying& c = *static_cast<const gles2::cmds::GetTransformFeedbackVarying*>(cmd_data); GLuint program_id = c.program; GLuint index = c.index; uint32 name_bucket_id = c.name_bucket_id; typedef cmds::GetTransformFeedbackVarying::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } // Check that the client initialized the result. if (result->success != 0) { return error::kInvalidArguments; } Program* program = GetProgramInfoNotShader( program_id, "glGetTransformFeedbackVarying"); if (!program) { return error::kNoError; } GLuint service_id = program->service_id(); GLint link_status = GL_FALSE; glGetProgramiv(service_id, GL_LINK_STATUS, &link_status); if (link_status != GL_TRUE) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetTransformFeedbackVarying", "program not linked"); return error::kNoError; } GLint max_length = 0; glGetProgramiv( service_id, GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, &max_length); max_length = std::max(1, max_length); std::vector<char> buffer(max_length); GLsizei length = 0; GLsizei size = 0; GLenum type = 0; LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("GetTransformFeedbackVarying"); glGetTransformFeedbackVarying( service_id, index, max_length, &length, &size, &type, &buffer[0]); GLenum error = glGetError(); if (error != GL_NO_ERROR) { LOCAL_SET_GL_ERROR(error, "glGetTransformFeedbackVarying", ""); return error::kNoError; } result->success = 1; // true. result->size = static_cast<int32_t>(size); result->type = static_cast<uint32_t>(type); Bucket* bucket = CreateBucket(name_bucket_id); DCHECK(length >= 0 && length < max_length); buffer[length] = '\0'; // Just to be safe. bucket->SetFromString(&buffer[0]); return error::kNoError; } error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVaryingsCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM& c = *static_cast<const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM*>( cmd_data); GLuint program_id = static_cast<GLuint>(c.program); uint32 bucket_id = c.bucket_id; Bucket* bucket = CreateBucket(bucket_id); bucket->SetSize(sizeof(TransformFeedbackVaryingsHeader)); // in case we fail. Program* program = NULL; program = GetProgram(program_id); if (!program || !program->IsValid()) { return error::kNoError; } program->GetTransformFeedbackVaryings(bucket); return error::kNoError; } error::ContextLostReason GLES2DecoderImpl::GetContextLostReason() { switch (reset_status_) { case GL_NO_ERROR: // TODO(kbr): improve the precision of the error code in this case. // Consider delegating to context for error code if MakeCurrent fails. return error::kUnknown; case GL_GUILTY_CONTEXT_RESET_ARB: return error::kGuilty; case GL_INNOCENT_CONTEXT_RESET_ARB: return error::kInnocent; case GL_UNKNOWN_CONTEXT_RESET_ARB: return error::kUnknown; } NOTREACHED(); return error::kUnknown; } void GLES2DecoderImpl::MaybeExitOnContextLost() { // Some D3D drivers cannot recover from device lost in the GPU process // sandbox. Allow a new GPU process to launch. if (workarounds().exit_on_context_lost) { LOG(ERROR) << "Exiting GPU process because some drivers cannot reset" << " a D3D device in the Chrome GPU process sandbox."; #if defined(OS_WIN) base::win::SetShouldCrashOnProcessDetach(false); #endif exit(0); } } bool GLES2DecoderImpl::WasContextLost() { if (reset_status_ != GL_NO_ERROR) { MaybeExitOnContextLost(); return true; } if (IsRobustnessSupported()) { GLenum status = glGetGraphicsResetStatusARB(); if (status != GL_NO_ERROR) { // The graphics card was reset. Signal a lost context to the application. reset_status_ = status; reset_by_robustness_extension_ = true; LOG(ERROR) << (surface_->IsOffscreen() ? "Offscreen" : "Onscreen") << " context lost via ARB/EXT_robustness. Reset status = " << GLES2Util::GetStringEnum(status); MaybeExitOnContextLost(); return true; } } return false; } bool GLES2DecoderImpl::WasContextLostByRobustnessExtension() { return WasContextLost() && reset_by_robustness_extension_; } void GLES2DecoderImpl::LoseContext(uint32 reset_status) { // Only loses the context once. if (reset_status_ != GL_NO_ERROR) { return; } if (workarounds().use_virtualized_gl_contexts) { // If the context is virtual, the real context being guilty does not ensure // that the virtual context is guilty. if (reset_status == GL_GUILTY_CONTEXT_RESET_ARB) { reset_status = GL_UNKNOWN_CONTEXT_RESET_ARB; } } else if (reset_status == GL_UNKNOWN_CONTEXT_RESET_ARB && IsRobustnessSupported()) { // If the reason for the call was a GL error, we can try to determine the // reset status more accurately. GLenum driver_status = glGetGraphicsResetStatusARB(); if (driver_status == GL_GUILTY_CONTEXT_RESET_ARB || driver_status == GL_INNOCENT_CONTEXT_RESET_ARB) { reset_status = driver_status; } } // Marks this context as lost. reset_status_ = reset_status; current_decoder_error_ = error::kLostContext; } error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { return error::kUnknownCommand; } error::Error GLES2DecoderImpl::HandleWaitSyncPointCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::WaitSyncPointCHROMIUM& c = *static_cast<const gles2::cmds::WaitSyncPointCHROMIUM*>(cmd_data); uint32 sync_point = c.sync_point; if (wait_sync_point_callback_.is_null()) return error::kNoError; return wait_sync_point_callback_.Run(sync_point) ? error::kNoError : error::kDeferCommandUntilLater; } error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { if (surface_->DeferDraws()) return error::kDeferCommandUntilLater; if (!surface_->SetBackbufferAllocation(false)) return error::kLostContext; backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT; backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT; backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT; return error::kNoError; } bool GLES2DecoderImpl::GenQueriesEXTHelper( GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { if (query_manager_->GetQuery(client_ids[ii])) { return false; } } query_manager_->GenQueries(n, client_ids); return true; } void GLES2DecoderImpl::DeleteQueriesEXTHelper( GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { QueryManager::Query* query = query_manager_->GetQuery(client_ids[ii]); if (query && !query->IsDeleted()) { ContextState::QueryMap::iterator it = state_.current_queries.find(query->target()); if (it != state_.current_queries.end()) state_.current_queries.erase(it); query->Destroy(true); } query_manager_->RemoveQuery(client_ids[ii]); } } bool GLES2DecoderImpl::ProcessPendingQueries(bool did_finish) { if (query_manager_.get() == NULL) { return false; } if (!query_manager_->ProcessPendingQueries(did_finish)) { current_decoder_error_ = error::kOutOfBounds; } return query_manager_->HavePendingQueries(); } // Note that if there are no pending readpixels right now, // this function will call the callback immediately. void GLES2DecoderImpl::WaitForReadPixels(base::Closure callback) { if (features().use_async_readpixels && !pending_readpixel_fences_.empty()) { pending_readpixel_fences_.back()->callbacks.push_back(callback); } else { callback.Run(); } } void GLES2DecoderImpl::ProcessPendingReadPixels() { while (!pending_readpixel_fences_.empty() && pending_readpixel_fences_.front()->fence->HasCompleted()) { std::vector<base::Closure> callbacks = pending_readpixel_fences_.front()->callbacks; pending_readpixel_fences_.pop(); for (size_t i = 0; i < callbacks.size(); i++) { callbacks[i].Run(); } } } bool GLES2DecoderImpl::HasMoreIdleWork() { return !pending_readpixel_fences_.empty() || async_pixel_transfer_manager_->NeedsProcessMorePendingTransfers(); } void GLES2DecoderImpl::PerformIdleWork() { ProcessPendingReadPixels(); if (!async_pixel_transfer_manager_->NeedsProcessMorePendingTransfers()) return; async_pixel_transfer_manager_->ProcessMorePendingTransfers(); ProcessFinishedAsyncTransfers(); } error::Error GLES2DecoderImpl::HandleBeginQueryEXT(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::BeginQueryEXT& c = *static_cast<const gles2::cmds::BeginQueryEXT*>(cmd_data); GLenum target = static_cast<GLenum>(c.target); GLuint client_id = static_cast<GLuint>(c.id); int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); switch (target) { case GL_COMMANDS_ISSUED_CHROMIUM: case GL_LATENCY_QUERY_CHROMIUM: case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM: case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: case GL_GET_ERROR_QUERY_CHROMIUM: break; case GL_COMMANDS_COMPLETED_CHROMIUM: if (!features().chromium_sync_query) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glBeginQueryEXT", "not enabled for commands completed queries"); return error::kNoError; } break; default: if (!features().occlusion_query_boolean) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glBeginQueryEXT", "not enabled for occlusion queries"); return error::kNoError; } break; } if (state_.current_queries.find(target) != state_.current_queries.end()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress"); return error::kNoError; } if (client_id == 0) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBeginQueryEXT", "id is 0"); return error::kNoError; } QueryManager::Query* query = query_manager_->GetQuery(client_id); if (!query) { if (!query_manager_->IsValidQuery(client_id)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBeginQueryEXT", "id not made by glGenQueriesEXT"); return error::kNoError; } query = query_manager_->CreateQuery( target, client_id, sync_shm_id, sync_shm_offset); } if (query->target() != target) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glBeginQueryEXT", "target does not match"); return error::kNoError; } else if (query->shm_id() != sync_shm_id || query->shm_offset() != sync_shm_offset) { DLOG(ERROR) << "Shared memory used by query not the same as before"; return error::kInvalidArguments; } if (!query_manager_->BeginQuery(query)) { return error::kOutOfBounds; } state_.current_queries[target] = query; return error::kNoError; } error::Error GLES2DecoderImpl::HandleEndQueryEXT(uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::EndQueryEXT& c = *static_cast<const gles2::cmds::EndQueryEXT*>(cmd_data); GLenum target = static_cast<GLenum>(c.target); uint32 submit_count = static_cast<GLuint>(c.submit_count); ContextState::QueryMap::iterator it = state_.current_queries.find(target); if (it == state_.current_queries.end()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glEndQueryEXT", "No active query"); return error::kNoError; } QueryManager::Query* query = it->second.get(); if (!query_manager_->EndQuery(query, submit_count)) { return error::kOutOfBounds; } query_manager_->ProcessPendingTransferQueries(); state_.current_queries.erase(it); return error::kNoError; } bool GLES2DecoderImpl::GenVertexArraysOESHelper( GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { if (GetVertexAttribManager(client_ids[ii])) { return false; } } if (!features().native_vertex_array_object) { // Emulated VAO for (GLsizei ii = 0; ii < n; ++ii) { CreateVertexAttribManager(client_ids[ii], 0, true); } } else { scoped_ptr<GLuint[]> service_ids(new GLuint[n]); glGenVertexArraysOES(n, service_ids.get()); for (GLsizei ii = 0; ii < n; ++ii) { CreateVertexAttribManager(client_ids[ii], service_ids[ii], true); } } return true; } void GLES2DecoderImpl::DeleteVertexArraysOESHelper( GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { VertexAttribManager* vao = GetVertexAttribManager(client_ids[ii]); if (vao && !vao->IsDeleted()) { if (state_.vertex_attrib_manager.get() == vao) { DoBindVertexArrayOES(0); } RemoveVertexAttribManager(client_ids[ii]); } } } void GLES2DecoderImpl::DoBindVertexArrayOES(GLuint client_id) { VertexAttribManager* vao = NULL; if (client_id != 0) { vao = GetVertexAttribManager(client_id); if (!vao) { // Unlike most Bind* methods, the spec explicitly states that VertexArray // only allows names that have been previously generated. As such, we do // not generate new names here. LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glBindVertexArrayOES", "bad vertex array id."); current_decoder_error_ = error::kNoError; return; } } else { vao = state_.default_vertex_attrib_manager.get(); } // Only set the VAO state if it's changed if (state_.vertex_attrib_manager.get() != vao) { state_.vertex_attrib_manager = vao; if (!features().native_vertex_array_object) { EmulateVertexArrayState(); } else { GLuint service_id = vao->service_id(); glBindVertexArrayOES(service_id); } } } // Used when OES_vertex_array_object isn't natively supported void GLES2DecoderImpl::EmulateVertexArrayState() { // Setup the Vertex attribute state for (uint32 vv = 0; vv < group_->max_vertex_attribs(); ++vv) { RestoreStateForAttrib(vv, true); } // Setup the element buffer Buffer* element_array_buffer = state_.vertex_attrib_manager->element_array_buffer(); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, element_array_buffer ? element_array_buffer->service_id() : 0); } bool GLES2DecoderImpl::DoIsVertexArrayOES(GLuint client_id) { const VertexAttribManager* vao = GetVertexAttribManager(client_id); return vao && vao->IsValid() && !vao->IsDeleted(); } #if defined(OS_MACOSX) void GLES2DecoderImpl::ReleaseIOSurfaceForTexture(GLuint texture_id) { TextureToIOSurfaceMap::iterator it = texture_to_io_surface_map_.find( texture_id); if (it != texture_to_io_surface_map_.end()) { // Found a previous IOSurface bound to this texture; release it. IOSurfaceRef surface = it->second; CFRelease(surface); texture_to_io_surface_map_.erase(it); } } #endif void GLES2DecoderImpl::DoTexImageIOSurface2DCHROMIUM( GLenum target, GLsizei width, GLsizei height, GLuint io_surface_id, GLuint plane) { #if defined(OS_MACOSX) if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "only supported on desktop GL."); return; } if (target != GL_TEXTURE_RECTANGLE_ARB) { // This might be supported in the future, and if we could require // support for binding an IOSurface to a NPOT TEXTURE_2D texture, we // could delete a lot of code. For now, perform strict validation so we // know what's going on. LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "requires TEXTURE_RECTANGLE_ARB target"); return; } // Default target might be conceptually valid, but disallow it to avoid // accidents. TextureRef* texture_ref = texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "no rectangle texture bound"); return; } // Look up the new IOSurface. Note that because of asynchrony // between processes this might fail; during live resizing the // plugin process might allocate and release an IOSurface before // this process gets a chance to look it up. Hold on to any old // IOSurface in this case. IOSurfaceRef surface = IOSurfaceLookup(io_surface_id); if (!surface) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "no IOSurface with the given ID"); return; } // Release any IOSurface previously bound to this texture. ReleaseIOSurfaceForTexture(texture_ref->service_id()); // Make sure we release the IOSurface even if CGLTexImageIOSurface2D fails. texture_to_io_surface_map_.insert( std::make_pair(texture_ref->service_id(), surface)); CGLContextObj context = static_cast<CGLContextObj>(context_->GetHandle()); CGLError err = CGLTexImageIOSurface2D( context, target, GL_RGBA, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, surface, plane); if (err != kCGLNoError) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "error in CGLTexImageIOSurface2D"); return; } texture_manager()->SetLevelInfo( texture_ref, target, 0, GL_RGBA, width, height, 1, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, true); #else LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "not supported."); #endif } static GLenum ExtractFormatFromStorageFormat(GLenum internalformat) { switch (internalformat) { case GL_RGB565: return GL_RGB; case GL_RGBA4: return GL_RGBA; case GL_RGB5_A1: return GL_RGBA; case GL_RGB8_OES: return GL_RGB; case GL_RGBA8_OES: return GL_RGBA; case GL_LUMINANCE8_ALPHA8_EXT: return GL_LUMINANCE_ALPHA; case GL_LUMINANCE8_EXT: return GL_LUMINANCE; case GL_ALPHA8_EXT: return GL_ALPHA; case GL_RGBA32F_EXT: return GL_RGBA; case GL_RGB32F_EXT: return GL_RGB; case GL_ALPHA32F_EXT: return GL_ALPHA; case GL_LUMINANCE32F_EXT: return GL_LUMINANCE; case GL_LUMINANCE_ALPHA32F_EXT: return GL_LUMINANCE_ALPHA; case GL_RGBA16F_EXT: return GL_RGBA; case GL_RGB16F_EXT: return GL_RGB; case GL_ALPHA16F_EXT: return GL_ALPHA; case GL_LUMINANCE16F_EXT: return GL_LUMINANCE; case GL_LUMINANCE_ALPHA16F_EXT: return GL_LUMINANCE_ALPHA; case GL_BGRA8_EXT: return GL_BGRA_EXT; case GL_SRGB8_ALPHA8_EXT: return GL_SRGB_ALPHA_EXT; default: return GL_NONE; } } void GLES2DecoderImpl::DoCopyTextureCHROMIUM( GLenum target, GLuint source_id, GLuint dest_id, GLint level, GLenum internal_format, GLenum dest_type) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); TextureRef* dest_texture_ref = GetTexture(dest_id); TextureRef* source_texture_ref = GetTexture(source_id); if (!source_texture_ref || !dest_texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "unknown texture id"); return; } if (GL_TEXTURE_2D != target) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "invalid texture target"); return; } Texture* source_texture = source_texture_ref->texture(); Texture* dest_texture = dest_texture_ref->texture(); if (dest_texture->target() != GL_TEXTURE_2D || (source_texture->target() != GL_TEXTURE_2D && source_texture->target() != GL_TEXTURE_RECTANGLE_ARB && source_texture->target() != GL_TEXTURE_EXTERNAL_OES)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "invalid texture target binding"); return; } int source_width, source_height, dest_width, dest_height; gfx::GLImage* image = source_texture->GetLevelImage(source_texture->target(), 0); if (image) { gfx::Size size = image->GetSize(); source_width = size.width(); source_height = size.height(); if (source_width <= 0 || source_height <= 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCopyTextureChromium", "invalid image size"); return; } } else { if (!source_texture->GetLevelSize( source_texture->target(), 0, &source_width, &source_height)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopyTextureChromium", "source texture has no level 0"); return; } // Check that this type of texture is allowed. if (!texture_manager()->ValidForTarget( source_texture->target(), level, source_width, source_height, 1)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "Bad dimensions"); return; } } // Clear the source texture if necessary. if (!texture_manager()->ClearTextureLevel( this, source_texture_ref, source_texture->target(), 0)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glCopyTextureCHROMIUM", "dimensions too big"); return; } GLenum source_type = 0; GLenum source_internal_format = 0; source_texture->GetLevelType( source_texture->target(), 0, &source_type, &source_internal_format); // The destination format should be GL_RGB, or GL_RGBA. GL_ALPHA, // GL_LUMINANCE, and GL_LUMINANCE_ALPHA are not supported because they are not // renderable on some platforms. bool valid_dest_format = internal_format == GL_RGB || internal_format == GL_RGBA || internal_format == GL_BGRA_EXT; bool valid_source_format = source_internal_format == GL_ALPHA || source_internal_format == GL_RGB || source_internal_format == GL_RGBA || source_internal_format == GL_LUMINANCE || source_internal_format == GL_LUMINANCE_ALPHA || source_internal_format == GL_BGRA_EXT; if (!valid_source_format || !valid_dest_format) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopyTextureCHROMIUM", "invalid internal format"); return; } // Defer initializing the CopyTextureCHROMIUMResourceManager until it is // needed because it takes 10s of milliseconds to initialize. if (!copy_texture_CHROMIUM_.get()) { LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); copy_texture_CHROMIUM_->Initialize(this); RestoreCurrentFramebufferBindings(); if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR) return; } GLenum dest_type_previous = dest_type; GLenum dest_internal_format = internal_format; bool dest_level_defined = dest_texture->GetLevelSize( GL_TEXTURE_2D, level, &dest_width, &dest_height); if (dest_level_defined) { dest_texture->GetLevelType(GL_TEXTURE_2D, level, &dest_type_previous, &dest_internal_format); } // Resize the destination texture to the dimensions of the source texture. if (!dest_level_defined || dest_width != source_width || dest_height != source_height || dest_internal_format != internal_format || dest_type_previous != dest_type) { // Ensure that the glTexImage2D succeeds. LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); glTexImage2D( GL_TEXTURE_2D, level, internal_format, source_width, source_height, 0, internal_format, dest_type, NULL); GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM"); if (error != GL_NO_ERROR) { RestoreCurrentTextureBindings(&state_, GL_TEXTURE_2D); return; } texture_manager()->SetLevelInfo( dest_texture_ref, GL_TEXTURE_2D, level, internal_format, source_width, source_height, 1, 0, internal_format, dest_type, true); } else { texture_manager()->SetLevelCleared( dest_texture_ref, GL_TEXTURE_2D, level, true); } ScopedModifyPixels modify(dest_texture_ref); // Try using GLImage::CopyTexImage when possible. bool unpack_premultiply_alpha_change = unpack_premultiply_alpha_ ^ unpack_unpremultiply_alpha_; if (image && !unpack_flip_y_ && !unpack_premultiply_alpha_change && !level) { glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); if (image->CopyTexImage(GL_TEXTURE_2D)) return; } DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix // before presenting. if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { // TODO(hkuang): get the StreamTexture transform matrix in GPU process // instead of using default matrix crbug.com/226218. const static GLfloat default_matrix[16] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; copy_texture_CHROMIUM_->DoCopyTextureWithTransform( this, source_texture->target(), source_texture->service_id(), dest_texture->service_id(), level, source_width, source_height, unpack_flip_y_, unpack_premultiply_alpha_, unpack_unpremultiply_alpha_, default_matrix); } else { copy_texture_CHROMIUM_->DoCopyTexture(this, source_texture->target(), source_texture->service_id(), source_internal_format, dest_texture->service_id(), level, internal_format, source_width, source_height, unpack_flip_y_, unpack_premultiply_alpha_, unpack_unpremultiply_alpha_); } DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); } static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { switch (internalformat) { case GL_RGB565: return GL_UNSIGNED_SHORT_5_6_5; case GL_RGBA4: return GL_UNSIGNED_SHORT_4_4_4_4; case GL_RGB5_A1: return GL_UNSIGNED_SHORT_5_5_5_1; case GL_RGB8_OES: return GL_UNSIGNED_BYTE; case GL_RGBA8_OES: return GL_UNSIGNED_BYTE; case GL_LUMINANCE8_ALPHA8_EXT: return GL_UNSIGNED_BYTE; case GL_LUMINANCE8_EXT: return GL_UNSIGNED_BYTE; case GL_ALPHA8_EXT: return GL_UNSIGNED_BYTE; case GL_RGBA32F_EXT: return GL_FLOAT; case GL_RGB32F_EXT: return GL_FLOAT; case GL_ALPHA32F_EXT: return GL_FLOAT; case GL_LUMINANCE32F_EXT: return GL_FLOAT; case GL_LUMINANCE_ALPHA32F_EXT: return GL_FLOAT; case GL_RGBA16F_EXT: return GL_HALF_FLOAT_OES; case GL_RGB16F_EXT: return GL_HALF_FLOAT_OES; case GL_ALPHA16F_EXT: return GL_HALF_FLOAT_OES; case GL_LUMINANCE16F_EXT: return GL_HALF_FLOAT_OES; case GL_LUMINANCE_ALPHA16F_EXT: return GL_HALF_FLOAT_OES; case GL_BGRA8_EXT: return GL_UNSIGNED_BYTE; default: return GL_NONE; } } void GLES2DecoderImpl::DoTexStorage2DEXT( GLenum target, GLint levels, GLenum internal_format, GLsizei width, GLsizei height) { TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoTexStorage2DEXT", "width", width, "height", height); if (!texture_manager()->ValidForTarget(target, 0, width, height, 1) || TextureManager::ComputeMipMapCount(target, width, height, 1) < levels) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glTexStorage2DEXT", "dimensions out of range"); return; } TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glTexStorage2DEXT", "unknown texture for target"); return; } Texture* texture = texture_ref->texture(); if (texture->IsAttachedToFramebuffer()) { framebuffer_state_.clear_state_dirty = true; } if (texture->IsImmutable()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glTexStorage2DEXT", "texture is immutable"); return; } GLenum format = ExtractFormatFromStorageFormat(internal_format); GLenum type = ExtractTypeFromStorageFormat(internal_format); { GLsizei level_width = width; GLsizei level_height = height; uint32 estimated_size = 0; for (int ii = 0; ii < levels; ++ii) { uint32 level_size = 0; if (!GLES2Util::ComputeImageDataSizes( level_width, level_height, 1, format, type, state_.unpack_alignment, &estimated_size, NULL, NULL) || !SafeAddUint32(estimated_size, level_size, &estimated_size)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glTexStorage2DEXT", "dimensions too large"); return; } level_width = std::max(1, level_width >> 1); level_height = std::max(1, level_height >> 1); } if (!EnsureGPUMemoryAvailable(estimated_size)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glTexStorage2DEXT", "out of memory"); return; } } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glTexStorage2DEXT"); glTexStorage2DEXT(target, levels, internal_format, width, height); GLenum error = LOCAL_PEEK_GL_ERROR("glTexStorage2DEXT"); if (error == GL_NO_ERROR) { GLsizei level_width = width; GLsizei level_height = height; for (int ii = 0; ii < levels; ++ii) { texture_manager()->SetLevelInfo( texture_ref, target, ii, format, level_width, level_height, 1, 0, format, type, false); level_width = std::max(1, level_width >> 1); level_height = std::max(1, level_height >> 1); } texture->SetImmutable(true); } } error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { return error::kUnknownCommand; } void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, const GLbyte* data) { TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", "context", logger_.GetLogPrefix(), "mailbox[0]", static_cast<unsigned char>(data[0])); TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); ProduceTextureRef("glProduceTextureCHROMIUM", texture_ref, target, data); } void GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM(GLuint client_id, GLenum target, const GLbyte* data) { TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM", "context", logger_.GetLogPrefix(), "mailbox[0]", static_cast<unsigned char>(data[0])); ProduceTextureRef("glProduceTextureDirectCHROMIUM", GetTexture(client_id), target, data); } void GLES2DecoderImpl::ProduceTextureRef(std::string func_name, TextureRef* texture_ref, GLenum target, const GLbyte* data) { const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); DLOG_IF(ERROR, !mailbox.Verify()) << func_name << " was passed a " "mailbox that was not generated by " "GenMailboxCHROMIUM."; if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, func_name.c_str(), "unknown texture for target"); return; } Texture* produced = texture_manager()->Produce(texture_ref); if (!produced) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, func_name.c_str(), "invalid texture"); return; } if (produced->target() != target) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, func_name.c_str(), "invalid target"); return; } group_->mailbox_manager()->ProduceTexture(mailbox, produced); } void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* data) { TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM", "context", logger_.GetLogPrefix(), "mailbox[0]", static_cast<unsigned char>(data[0])); const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); DLOG_IF(ERROR, !mailbox.Verify()) << "ConsumeTextureCHROMIUM was passed a " "mailbox that was not generated by " "GenMailboxCHROMIUM."; scoped_refptr<TextureRef> texture_ref = texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); if (!texture_ref.get()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glConsumeTextureCHROMIUM", "unknown texture for target"); return; } GLuint client_id = texture_ref->client_id(); if (!client_id) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glConsumeTextureCHROMIUM", "unknown texture for target"); return; } Texture* texture = group_->mailbox_manager()->ConsumeTexture(mailbox); if (!texture) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glConsumeTextureCHROMIUM", "invalid mailbox name"); return; } if (texture->target() != target) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glConsumeTextureCHROMIUM", "invalid target"); return; } DeleteTexturesHelper(1, &client_id); texture_ref = texture_manager()->Consume(client_id, texture); glBindTexture(target, texture_ref->service_id()); TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; unit.bind_target = target; switch (target) { case GL_TEXTURE_2D: unit.bound_texture_2d = texture_ref; break; case GL_TEXTURE_CUBE_MAP: unit.bound_texture_cube_map = texture_ref; break; case GL_TEXTURE_EXTERNAL_OES: unit.bound_texture_external_oes = texture_ref; break; case GL_TEXTURE_RECTANGLE_ARB: unit.bound_texture_rectangle_arb = texture_ref; break; default: NOTREACHED(); // Validation should prevent us getting here. break; } } error::Error GLES2DecoderImpl::HandleCreateAndConsumeTextureCHROMIUMImmediate( uint32_t immediate_data_size, const void* cmd_data) { const gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate& c = *static_cast< const gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate*>( cmd_data); GLenum target = static_cast<GLenum>(c.target); uint32_t data_size; if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { return error::kOutOfBounds; } if (data_size > immediate_data_size) { return error::kOutOfBounds; } const GLbyte* mailbox = GetImmediateDataAs<const GLbyte*>(c, data_size, immediate_data_size); if (!validators_->texture_bind_target.IsValid(target)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( "glCreateAndConsumeTextureCHROMIUM", target, "target"); return error::kNoError; } if (mailbox == NULL) { return error::kOutOfBounds; } uint32_t client_id = c.client_id; DoCreateAndConsumeTextureCHROMIUM(target, mailbox, client_id); return error::kNoError; } void GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM(GLenum target, const GLbyte* data, GLuint client_id) { TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM", "context", logger_.GetLogPrefix(), "mailbox[0]", static_cast<unsigned char>(data[0])); const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); DLOG_IF(ERROR, !mailbox.Verify()) << "CreateAndConsumeTextureCHROMIUM was " "passed a mailbox that was not " "generated by GenMailboxCHROMIUM."; TextureRef* texture_ref = GetTexture(client_id); if (texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCreateAndConsumeTextureCHROMIUM", "client id already in use"); return; } Texture* texture = group_->mailbox_manager()->ConsumeTexture(mailbox); if (!texture) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCreateAndConsumeTextureCHROMIUM", "invalid mailbox name"); return; } if (texture->target() != target) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCreateAndConsumeTextureCHROMIUM", "invalid target"); return; } texture_ref = texture_manager()->Consume(client_id, texture); } bool GLES2DecoderImpl::DoIsValuebufferCHROMIUM(GLuint client_id) { const Valuebuffer* valuebuffer = GetValuebuffer(client_id); return valuebuffer && valuebuffer->IsValid(); } void GLES2DecoderImpl::DoBindValueBufferCHROMIUM(GLenum target, GLuint client_id) { Valuebuffer* valuebuffer = NULL; if (client_id != 0) { valuebuffer = GetValuebuffer(client_id); if (!valuebuffer) { if (!group_->bind_generates_resource()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBindValuebufferCHROMIUM", "id not generated by glBindValuebufferCHROMIUM"); return; } // It's a new id so make a valuebuffer for it. CreateValuebuffer(client_id); valuebuffer = GetValuebuffer(client_id); } valuebuffer->MarkAsValid(); } state_.bound_valuebuffer = valuebuffer; } void GLES2DecoderImpl::DoSubscribeValueCHROMIUM(GLenum target, GLenum subscription) { if (!CheckCurrentValuebuffer("glSubscribeValueCHROMIUM")) { return; } state_.bound_valuebuffer.get()->AddSubscription(subscription); } void GLES2DecoderImpl::DoPopulateSubscribedValuesCHROMIUM(GLenum target) { if (!CheckCurrentValuebuffer("glPopulateSubscribedValuesCHROMIUM")) { return; } valuebuffer_manager()->UpdateValuebufferState(state_.bound_valuebuffer.get()); } void GLES2DecoderImpl::DoUniformValueBufferCHROMIUM(GLint location, GLenum target, GLenum subscription) { if (!CheckCurrentValuebufferForSubscription( subscription, "glPopulateSubscribedValuesCHROMIUM")) { return; } if (!CheckSubscriptionTarget(location, subscription, "glPopulateSubscribedValuesCHROMIUM")) { return; } const ValueState* state = state_.bound_valuebuffer.get()->GetState(subscription); if (state) { switch (subscription) { case GL_MOUSE_POSITION_CHROMIUM: DoUniform2iv(location, 1, state->int_value); break; default: NOTREACHED() << "Unhandled uniform subscription target " << subscription; break; } } } void GLES2DecoderImpl::DoInsertEventMarkerEXT( GLsizei length, const GLchar* marker) { if (!marker) { marker = ""; } debug_marker_manager_.SetMarker( length ? std::string(marker, length) : std::string(marker)); } void GLES2DecoderImpl::DoPushGroupMarkerEXT( GLsizei length, const GLchar* marker) { if (!marker) { marker = ""; } std::string name = length ? std::string(marker, length) : std::string(marker); debug_marker_manager_.PushGroup(name); gpu_tracer_->Begin(TRACE_DISABLED_BY_DEFAULT("gpu_group_marker"), name, kTraceGroupMarker); } void GLES2DecoderImpl::DoPopGroupMarkerEXT(void) { debug_marker_manager_.PopGroup(); gpu_tracer_->End(kTraceGroupMarker); } void GLES2DecoderImpl::DoBindTexImage2DCHROMIUM( GLenum target, GLint image_id) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM"); if (target == GL_TEXTURE_CUBE_MAP) { LOCAL_SET_GL_ERROR( GL_INVALID_ENUM, "glBindTexImage2DCHROMIUM", "invalid target"); return; } // Default target might be conceptually valid, but disallow it to avoid // accidents. TextureRef* texture_ref = texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glBindTexImage2DCHROMIUM", "no texture bound"); return; } gfx::GLImage* gl_image = image_manager()->LookupImage(image_id); if (!gl_image) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glBindTexImage2DCHROMIUM", "no image found with the given ID"); return; } { ScopedGLErrorSuppressor suppressor( "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM", GetErrorState()); if (!gl_image->BindTexImage(target)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glBindTexImage2DCHROMIUM", "fail to bind image with the given ID"); return; } } gfx::Size size = gl_image->GetSize(); texture_manager()->SetLevelInfo( texture_ref, target, 0, GL_RGBA, size.width(), size.height(), 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, true); texture_manager()->SetLevelImage(texture_ref, target, 0, gl_image); } void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM( GLenum target, GLint image_id) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM"); // Default target might be conceptually valid, but disallow it to avoid // accidents. TextureRef* texture_ref = texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glReleaseTexImage2DCHROMIUM", "no texture bound"); return; } gfx::GLImage* gl_image = image_manager()->LookupImage(image_id); if (!gl_image) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glReleaseTexImage2DCHROMIUM", "no image found with the given ID"); return; } // Do nothing when image is not currently bound. if (texture_ref->texture()->GetLevelImage(target, 0) != gl_image) return; { ScopedGLErrorSuppressor suppressor( "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM", GetErrorState()); gl_image->ReleaseTexImage(target); } texture_manager()->SetLevelInfo( texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, false); } error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::TraceBeginCHROMIUM& c = *static_cast<const gles2::cmds::TraceBeginCHROMIUM*>(cmd_data); Bucket* category_bucket = GetBucket(c.category_bucket_id); Bucket* name_bucket = GetBucket(c.name_bucket_id); if (!category_bucket || category_bucket->size() == 0 || !name_bucket || name_bucket->size() == 0) { return error::kInvalidArguments; } std::string category_name; std::string trace_name; if (!category_bucket->GetAsString(&category_name) || !name_bucket->GetAsString(&trace_name)) { return error::kInvalidArguments; } if (!gpu_tracer_->Begin(category_name, trace_name, kTraceCHROMIUM)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glTraceBeginCHROMIUM", "unable to create begin trace"); return error::kNoError; } return error::kNoError; } void GLES2DecoderImpl::DoTraceEndCHROMIUM() { if (!gpu_tracer_->End(kTraceCHROMIUM)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glTraceEndCHROMIUM", "no trace begin found"); return; } } void GLES2DecoderImpl::DoDrawBuffersEXT( GLsizei count, const GLenum* bufs) { if (count > static_cast<GLsizei>(group_->max_draw_buffers())) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glDrawBuffersEXT", "greater than GL_MAX_DRAW_BUFFERS_EXT"); return; } Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); if (framebuffer) { for (GLsizei i = 0; i < count; ++i) { if (bufs[i] != static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + i) && bufs[i] != GL_NONE) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glDrawBuffersEXT", "bufs[i] not GL_NONE or GL_COLOR_ATTACHMENTi_EXT"); return; } } glDrawBuffersARB(count, bufs); framebuffer->SetDrawBuffers(count, bufs); } else { // backbuffer if (count > 1 || (bufs[0] != GL_BACK && bufs[0] != GL_NONE)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glDrawBuffersEXT", "more than one buffer or bufs not GL_NONE or GL_BACK"); return; } GLenum mapped_buf = bufs[0]; if (GetBackbufferServiceId() != 0 && // emulated backbuffer bufs[0] == GL_BACK) { mapped_buf = GL_COLOR_ATTACHMENT0; } glDrawBuffersARB(count, &mapped_buf); group_->set_draw_buffer(bufs[0]); } } void GLES2DecoderImpl::DoLoseContextCHROMIUM(GLenum current, GLenum other) { group_->LoseContexts(other); reset_status_ = current; current_decoder_error_ = error::kLostContext; } void GLES2DecoderImpl::DoMatrixLoadfCHROMIUM(GLenum matrix_mode, const GLfloat* matrix) { DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM || matrix_mode == GL_PATH_MODELVIEW_CHROMIUM); if (!features().chromium_path_rendering) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glMatrixLoadfCHROMIUM", "function not available"); return; } GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM ? state_.projection_matrix : state_.modelview_matrix; memcpy(target_matrix, matrix, sizeof(GLfloat) * 16); // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV // since the values of the _NV and _CHROMIUM tokens match. glMatrixLoadfEXT(matrix_mode, matrix); } void GLES2DecoderImpl::DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode) { DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM || matrix_mode == GL_PATH_MODELVIEW_CHROMIUM); if (!features().chromium_path_rendering) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glMatrixLoadIdentityCHROMIUM", "function not available"); return; } static GLfloat kIdentityMatrix[16] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM ? state_.projection_matrix : state_.modelview_matrix; memcpy(target_matrix, kIdentityMatrix, sizeof(kIdentityMatrix)); // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV // since the values of the _NV and _CHROMIUM tokens match. glMatrixLoadIdentityEXT(matrix_mode); } bool GLES2DecoderImpl::ValidateAsyncTransfer( const char* function_name, TextureRef* texture_ref, GLenum target, GLint level, const void * data) { // We only support async uploads to 2D textures for now. if (GL_TEXTURE_2D != target) { LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target"); return false; } // We only support uploads to level zero for now. if (level != 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "level != 0"); return false; } // A transfer buffer must be bound, even for asyncTexImage2D. if (data == NULL) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "buffer == 0"); return false; } // We only support one async transfer in progress. if (!texture_ref || async_pixel_transfer_manager_->AsyncTransferIsInProgress(texture_ref)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "transfer already in progress"); return false; } return true; } base::Closure GLES2DecoderImpl::AsyncUploadTokenCompletionClosure( uint32 async_upload_token, uint32 sync_data_shm_id, uint32 sync_data_shm_offset) { scoped_refptr<gpu::Buffer> buffer = GetSharedMemoryBuffer(sync_data_shm_id); if (!buffer.get() || !buffer->GetDataAddress(sync_data_shm_offset, sizeof(AsyncUploadSync))) return base::Closure(); AsyncMemoryParams mem_params(buffer, sync_data_shm_offset, sizeof(AsyncUploadSync)); scoped_refptr<AsyncUploadTokenCompletionObserver> observer( new AsyncUploadTokenCompletionObserver(async_upload_token)); return base::Bind( &AsyncPixelTransferManager::AsyncNotifyCompletion, base::Unretained(GetAsyncPixelTransferManager()), mem_params, observer); } error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::AsyncTexImage2DCHROMIUM& c = *static_cast<const gles2::cmds::AsyncTexImage2DCHROMIUM*>(cmd_data); TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM"); GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLenum internal_format = static_cast<GLenum>(c.internalformat); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); GLint border = static_cast<GLint>(c.border); GLenum format = static_cast<GLenum>(c.format); GLenum type = static_cast<GLenum>(c.type); uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); uint32 pixels_size; uint32 async_upload_token = static_cast<uint32>(c.async_upload_token); uint32 sync_data_shm_id = static_cast<uint32>(c.sync_data_shm_id); uint32 sync_data_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); base::ScopedClosureRunner scoped_completion_callback; if (async_upload_token) { base::Closure completion_closure = AsyncUploadTokenCompletionClosure(async_upload_token, sync_data_shm_id, sync_data_shm_offset); if (completion_closure.is_null()) return error::kInvalidArguments; scoped_completion_callback.Reset(completion_closure); } // TODO(epenner): Move this and copies of this memory validation // into ValidateTexImage2D step. if (!GLES2Util::ComputeImageDataSizes( width, height, 1, format, type, state_.unpack_alignment, &pixels_size, NULL, NULL)) { return error::kOutOfBounds; } const void* pixels = NULL; if (pixels_shm_id != 0 || pixels_shm_offset != 0) { pixels = GetSharedMemoryAs<const void*>( pixels_shm_id, pixels_shm_offset, pixels_size); if (!pixels) { return error::kOutOfBounds; } } TextureManager::DoTextImage2DArguments args = { target, level, internal_format, width, height, border, format, type, pixels, pixels_size}; TextureRef* texture_ref; // All the normal glTexSubImage2D validation. if (!texture_manager()->ValidateTexImage2D( &state_, "glAsyncTexImage2DCHROMIUM", args, &texture_ref)) { return error::kNoError; } // Extra async validation. Texture* texture = texture_ref->texture(); if (!ValidateAsyncTransfer( "glAsyncTexImage2DCHROMIUM", texture_ref, target, level, pixels)) return error::kNoError; // Don't allow async redefinition of a textures. if (texture->IsDefined()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glAsyncTexImage2DCHROMIUM", "already defined"); return error::kNoError; } if (!EnsureGPUMemoryAvailable(pixels_size)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glAsyncTexImage2DCHROMIUM", "out of memory"); return error::kNoError; } // Setup the parameters. AsyncTexImage2DParams tex_params = { target, level, static_cast<GLenum>(internal_format), width, height, border, format, type}; AsyncMemoryParams mem_params( GetSharedMemoryBuffer(c.pixels_shm_id), c.pixels_shm_offset, pixels_size); // Set up the async state if needed, and make the texture // immutable so the async state stays valid. The level info // is set up lazily when the transfer completes. AsyncPixelTransferDelegate* delegate = async_pixel_transfer_manager_->CreatePixelTransferDelegate(texture_ref, tex_params); texture->SetImmutable(true); delegate->AsyncTexImage2D( tex_params, mem_params, base::Bind(&TextureManager::SetLevelInfoFromParams, // The callback is only invoked if the transfer delegate still // exists, which implies through manager->texture_ref->state // ownership that both of these pointers are valid. base::Unretained(texture_manager()), base::Unretained(texture_ref), tex_params)); return error::kNoError; } error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::AsyncTexSubImage2DCHROMIUM& c = *static_cast<const gles2::cmds::AsyncTexSubImage2DCHROMIUM*>(cmd_data); TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM"); GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLint xoffset = static_cast<GLint>(c.xoffset); GLint yoffset = static_cast<GLint>(c.yoffset); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); GLenum format = static_cast<GLenum>(c.format); GLenum type = static_cast<GLenum>(c.type); uint32 async_upload_token = static_cast<uint32>(c.async_upload_token); uint32 sync_data_shm_id = static_cast<uint32>(c.sync_data_shm_id); uint32 sync_data_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); base::ScopedClosureRunner scoped_completion_callback; if (async_upload_token) { base::Closure completion_closure = AsyncUploadTokenCompletionClosure(async_upload_token, sync_data_shm_id, sync_data_shm_offset); if (completion_closure.is_null()) return error::kInvalidArguments; scoped_completion_callback.Reset(completion_closure); } // TODO(epenner): Move this and copies of this memory validation // into ValidateTexSubImage2D step. uint32 data_size; if (!GLES2Util::ComputeImageDataSizes( width, height, 1, format, type, state_.unpack_alignment, &data_size, NULL, NULL)) { return error::kOutOfBounds; } const void* pixels = GetSharedMemoryAs<const void*>( c.data_shm_id, c.data_shm_offset, data_size); // All the normal glTexSubImage2D validation. error::Error error = error::kNoError; if (!ValidateTexSubImage2D(&error, "glAsyncTexSubImage2DCHROMIUM", target, level, xoffset, yoffset, width, height, format, type, pixels)) { return error; } // Extra async validation. TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); Texture* texture = texture_ref->texture(); if (!ValidateAsyncTransfer( "glAsyncTexSubImage2DCHROMIUM", texture_ref, target, level, pixels)) return error::kNoError; // Guarantee async textures are always 'cleared' as follows: // - AsyncTexImage2D can not redefine an existing texture // - AsyncTexImage2D must initialize the entire image via non-null buffer. // - AsyncTexSubImage2D clears synchronously if not already cleared. // - Textures become immutable after an async call. // This way we know in all cases that an async texture is always clear. if (!texture->SafeToRenderFrom()) { if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, level)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glAsyncTexSubImage2DCHROMIUM", "dimensions too big"); return error::kNoError; } } // Setup the parameters. AsyncTexSubImage2DParams tex_params = {target, level, xoffset, yoffset, width, height, format, type}; AsyncMemoryParams mem_params( GetSharedMemoryBuffer(c.data_shm_id), c.data_shm_offset, data_size); AsyncPixelTransferDelegate* delegate = async_pixel_transfer_manager_->GetPixelTransferDelegate(texture_ref); if (!delegate) { // TODO(epenner): We may want to enforce exclusive use // of async APIs in which case this should become an error, // (the texture should have been async defined). AsyncTexImage2DParams define_params = {target, level, 0, 0, 0, 0, 0, 0}; texture->GetLevelSize(target, level, &define_params.width, &define_params.height); texture->GetLevelType(target, level, &define_params.type, &define_params.internal_format); // Set up the async state if needed, and make the texture // immutable so the async state stays valid. delegate = async_pixel_transfer_manager_->CreatePixelTransferDelegate( texture_ref, define_params); texture->SetImmutable(true); } delegate->AsyncTexSubImage2D(tex_params, mem_params); return error::kNoError; } error::Error GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::WaitAsyncTexImage2DCHROMIUM& c = *static_cast<const gles2::cmds::WaitAsyncTexImage2DCHROMIUM*>(cmd_data); TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM"); GLenum target = static_cast<GLenum>(c.target); if (GL_TEXTURE_2D != target) { LOCAL_SET_GL_ERROR( GL_INVALID_ENUM, "glWaitAsyncTexImage2DCHROMIUM", "target"); return error::kNoError; } TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glWaitAsyncTexImage2DCHROMIUM", "unknown texture"); return error::kNoError; } AsyncPixelTransferDelegate* delegate = async_pixel_transfer_manager_->GetPixelTransferDelegate(texture_ref); if (!delegate) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glWaitAsyncTexImage2DCHROMIUM", "No async transfer started"); return error::kNoError; } delegate->WaitForTransferCompletion(); ProcessFinishedAsyncTransfers(); return error::kNoError; } error::Error GLES2DecoderImpl::HandleWaitAllAsyncTexImage2DCHROMIUM( uint32 immediate_data_size, const void* data) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM"); GetAsyncPixelTransferManager()->WaitAllAsyncTexImage2D(); ProcessFinishedAsyncTransfers(); return error::kNoError; } error::Error GLES2DecoderImpl::HandleUniformBlockBinding( uint32_t immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::UniformBlockBinding& c = *static_cast<const gles2::cmds::UniformBlockBinding*>(cmd_data); GLuint client_id = c.program; GLuint index = static_cast<GLuint>(c.index); GLuint binding = static_cast<GLuint>(c.binding); Program* program = GetProgramInfoNotShader( client_id, "glUniformBlockBinding"); if (!program) { return error::kNoError; } GLuint service_id = program->service_id(); glUniformBlockBinding(service_id, index, binding); return error::kNoError; } error::Error GLES2DecoderImpl::HandleClientWaitSync( uint32_t immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::ClientWaitSync& c = *static_cast<const gles2::cmds::ClientWaitSync*>(cmd_data); GLuint sync = static_cast<GLuint>(c.sync); GLbitfield flags = static_cast<GLbitfield>(c.flags); GLuint64 timeout = GLES2Util::MapTwoUint32ToUint64(c.timeout_0, c.timeout_1); typedef cmds::ClientWaitSync::Result Result; Result* result_dst = GetSharedMemoryAs<Result*>( c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); if (!result_dst) { return error::kOutOfBounds; } if (*result_dst != GL_WAIT_FAILED) { return error::kInvalidArguments; } GLsync service_sync = 0; if (!group_->GetSyncServiceId(sync, &service_sync)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "ClientWaitSync", "invalid sync"); return error::kNoError; } *result_dst = glClientWaitSync(service_sync, flags, timeout); return error::kNoError; } error::Error GLES2DecoderImpl::HandleWaitSync( uint32_t immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::WaitSync& c = *static_cast<const gles2::cmds::WaitSync*>(cmd_data); GLuint sync = static_cast<GLuint>(c.sync); GLbitfield flags = static_cast<GLbitfield>(c.flags); GLuint64 timeout = GLES2Util::MapTwoUint32ToUint64(c.timeout_0, c.timeout_1); GLsync service_sync = 0; if (!group_->GetSyncServiceId(sync, &service_sync)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "WaitSync", "invalid sync"); return error::kNoError; } glWaitSync(service_sync, flags, timeout); return error::kNoError; } void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( TextureRef* texture_ref) { Texture* texture = texture_ref->texture(); DoDidUseTexImageIfNeeded(texture, texture->target()); } void GLES2DecoderImpl::OnContextLostError() { group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); } void GLES2DecoderImpl::OnOutOfMemoryError() { if (lose_context_when_out_of_memory_) { group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); } } // Include the auto-generated part of this file. We split this because it means // we can easily edit the non-auto generated parts right here in this file // instead of having to edit some template or the code generator. #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" } // namespace gles2 } // namespace gpu
{ "content_hash": "68dac2f0b133038e3b4a15b3d4268228", "timestamp": "", "source": "github", "line_count": 12144, "max_line_length": 80, "avg_line_length": 35.06464097496706, "alnum_prop": 0.6589725826337111, "repo_name": "CTSRD-SOAAP/chromium-42.0.2311.135", "id": "2fa44fba8c317d46fab5669737dde955284f7e6f", "size": "425825", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gpu/command_buffer/service/gles2_cmd_decoder.cc", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "AppleScript", "bytes": "8402" }, { "name": "Assembly", "bytes": "241154" }, { "name": "C", "bytes": "12370053" }, { "name": "C++", "bytes": "266788423" }, { "name": "CMake", "bytes": "27829" }, { "name": "CSS", "bytes": "813488" }, { "name": "Emacs Lisp", "bytes": "2360" }, { "name": "Go", "bytes": "13628" }, { "name": "Groff", "bytes": "5283" }, { "name": "HTML", "bytes": "20131029" }, { "name": "Java", "bytes": "8495790" }, { "name": "JavaScript", "bytes": "12980966" }, { "name": "LLVM", "bytes": "1169" }, { "name": "Logos", "bytes": "6893" }, { "name": "Lua", "bytes": "16189" }, { "name": "Makefile", "bytes": "208709" }, { "name": "Objective-C", "bytes": "1509363" }, { "name": "Objective-C++", "bytes": "7960581" }, { "name": "PLpgSQL", "bytes": "215882" }, { "name": "Perl", "bytes": "63937" }, { "name": "Protocol Buffer", "bytes": "432373" }, { "name": "Python", "bytes": "11147426" }, { "name": "Ragel in Ruby Host", "bytes": "104923" }, { "name": "Scheme", "bytes": "10604" }, { "name": "Shell", "bytes": "1207731" }, { "name": "Standard ML", "bytes": "4965" }, { "name": "VimL", "bytes": "4075" }, { "name": "nesC", "bytes": "18347" } ], "symlink_target": "" }
(function() { var module = QUnit.module; var test = QUnit.test; var Crafty2 = global.craftyFactory(); module("Instances"); test("Separate crafty instances do not share property", function(_) { Crafty2.__SOME_PROPERTY__ = '__SOME_PROPERTY__'; _.strictEqual(Crafty2.__SOME_PROPERTY__, '__SOME_PROPERTY__', "Property set on one instance"); _.notEqual(Crafty.__SOME_PROPERTY__, '__SOME_PROPERTY__', "Property not set on other instance"); }); test("Separate crafty instances consist of different subobjects", function(_) { _.notDeepEqual(Crafty2, Crafty, "Properties are different"); }); })();
{ "content_hash": "fa0fdfea7f77de618e91356ff01c3ba3", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 100, "avg_line_length": 32.89473684210526, "alnum_prop": 0.664, "repo_name": "mucaho/Crafty", "id": "fac211a6a92ec5d5f58b9fa54401b9ebb223370d", "size": "625", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "tests/unit/core/instances.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "7945" }, { "name": "CoffeeScript", "bytes": "10284" }, { "name": "GLSL", "bytes": "1987" }, { "name": "HTML", "bytes": "17800" }, { "name": "JavaScript", "bytes": "1170324" }, { "name": "Shell", "bytes": "906" } ], "symlink_target": "" }
title: Supported File Types nav_sort: 5 nav_groups: - primary nav_category: true ---
{ "content_hash": "2882d537401e08a1fd04c183c5a3ab9d", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 27, "avg_line_length": 14.5, "alnum_prop": 0.7126436781609196, "repo_name": "oysteinsigholt/docs-scaffold", "id": "fd028ab6c462b805436de0388ff48b43ce44efaf", "size": "91", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "docs/filetypes.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "12061" }, { "name": "HTML", "bytes": "8278" }, { "name": "JavaScript", "bytes": "32486" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <rootTag> <Award> <AwardTitle>Innovation in an Aging Society</AwardTitle> <AwardEffectiveDate>09/01/2013</AwardEffectiveDate> <AwardExpirationDate>08/31/2014</AwardExpirationDate> <AwardAmount>600000</AwardAmount> <AwardInstrument> <Value>Interagency Agreement</Value> </AwardInstrument> <Organization> <Code>04010000</Code> <Directorate> <LongName>Direct For Social, Behav &amp; Economic Scie</LongName> </Directorate> <Division> <LongName>SBE Off Of Multidisciplinary Activities</LongName> </Division> </Organization> <ProgramOfficer> <SignBlockName>Maryann Feldman</SignBlockName> </ProgramOfficer> <AbstractNarration/> <MinAmdLetterDate>08/30/2013</MinAmdLetterDate> <MaxAmdLetterDate>08/30/2013</MaxAmdLetterDate> <ARRAAmount/> <AwardID>1345577</AwardID> <Investigator> <FirstName>Bruce</FirstName> <LastName>Weinberg</LastName> <EmailAddress>[email protected]</EmailAddress> <StartDate>08/30/2013</StartDate> <EndDate/> <RoleCode>Principal Investigator</RoleCode> </Investigator> <Investigator> <FirstName>Gerald</FirstName> <LastName>Marschke</LastName> <EmailAddress>[email protected]</EmailAddress> <StartDate>08/30/2013</StartDate> <EndDate/> <RoleCode>Co-Principal Investigator</RoleCode> </Investigator> <Investigator> <FirstName>Subhra</FirstName> <LastName>Saha</LastName> <EmailAddress>[email protected]</EmailAddress> <StartDate>08/30/2013</StartDate> <EndDate/> <RoleCode>Co-Principal Investigator</RoleCode> </Investigator> <Institution> <Name>NATIONAL INSTITUTE OF HEALTH</Name> <CityName>BETHESDA</CityName> <ZipCode>208920000</ZipCode> <PhoneNumber/> <StreetAddress>2115 EAST JEFFERSON STREET</StreetAddress> <CountryName>United States</CountryName> <StateName>Maryland</StateName> <StateCode>MD</StateCode> </Institution> <ProgramElement> <Code>7626</Code> <Text>SCIENCE OF SCIENCE POLICY</Text> </ProgramElement> </Award> </rootTag>
{ "content_hash": "62b34b04cfeb9592fb0e25776c542a19", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 73, "avg_line_length": 32.911764705882355, "alnum_prop": 0.6747095621090259, "repo_name": "jallen2/Research-Trend", "id": "f44d6a4040583df926678ecb3e3aed1d751a77b1", "size": "2238", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "CU_Funding/2013/1345577.xml", "mode": "33261", "license": "mit", "language": [], "symlink_target": "" }
<?php class Google_Service_Apigee_GoogleCloudApigeeV1Properties extends Google_Collection { protected $collection_key = 'property'; protected $propertyType = 'Google_Service_Apigee_GoogleCloudApigeeV1Property'; protected $propertyDataType = 'array'; /** * @param Google_Service_Apigee_GoogleCloudApigeeV1Property */ public function setProperty($property) { $this->property = $property; } /** * @return Google_Service_Apigee_GoogleCloudApigeeV1Property */ public function getProperty() { return $this->property; } }
{ "content_hash": "2f185e6729b392cbe32230c267859704", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 83, "avg_line_length": 23.333333333333332, "alnum_prop": 0.7232142857142857, "repo_name": "phil-davis/core", "id": "eb8e8b75ef879fc0d58d32fbc10dc40027cb0b2e", "size": "1150", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "apps/files_external/3rdparty/google/apiclient-services/src/Google/Service/Apigee/GoogleCloudApigeeV1Properties.php", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "262" }, { "name": "Makefile", "bytes": "473" }, { "name": "Shell", "bytes": "8644" } ], "symlink_target": "" }
using System; using System.Threading.Tasks; using Newtonsoft.Json; using Windows.Web.Http; using Windows.Web.Http.Headers; namespace Template10.Services.Web { public class WebApiHelper { const string applicationJson = "application/json"; private HttpClient Client() { var http = new HttpClient(); var header = new HttpMediaTypeWithQualityHeaderValue(applicationJson); http.DefaultRequestHeaders.Accept.Add(header); return http; } public string Serialize<T>(T item) => JsonConvert.SerializeObject(item); public T Deserialize<T>(string json) => JsonConvert.DeserializeObject<T>(json); public async Task<string> GetAsync(Uri path) { using (var http = Client()) { var response = await http.GetAsync(path); if (response.StatusCode == HttpStatusCode.Ok) return await response.Content.ReadAsStringAsync(); else return string.Empty; } } public async Task<HttpResponseMessage> PutAsync<T>(Uri path, T payload) { using (var http = Client()) { var data = Serialize(payload); var content = new HttpStringContent(data, Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/json"); return await http.PutAsync(path, content); } } public async Task<HttpResponseMessage> PostAsync<T>(Uri path, T payload) { using (var http = Client()) { var data = Serialize(payload); var content = new HttpStringContent(data, Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/json"); return await http.PostAsync(path, content); } } public async Task<HttpResponseMessage> DeleteAsync(Uri path) { using (var http = Client()) { return await http.DeleteAsync(path); } } } }
{ "content_hash": "eee5d5f4e4a3d261030203566f558770", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 124, "avg_line_length": 32.43076923076923, "alnum_prop": 0.5692599620493358, "repo_name": "callummoffat/Template10", "id": "5a32d8a940b884ce87f4a33bdf41a456fbee051f", "size": "2110", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Services/Template10.Services.WebApiService/Service/WebApi/WebApiHelper.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "6766" }, { "name": "C#", "bytes": "754332" }, { "name": "CSS", "bytes": "1778" }, { "name": "HTML", "bytes": "572" }, { "name": "PowerShell", "bytes": "151" } ], "symlink_target": "" }
package org.intellij.lang.xpath.context; import com.intellij.openapi.util.Key; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.XmlElement; import org.intellij.lang.xpath.XPathFile; import org.intellij.lang.xpath.context.functions.DefaultFunctionContext; import org.intellij.lang.xpath.context.functions.Function; import org.intellij.lang.xpath.context.functions.FunctionContext; import org.intellij.lang.xpath.psi.*; import org.intellij.lang.xpath.validation.inspections.quickfix.XPathQuickFixFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.xml.namespace.QName; import java.util.Set; public abstract class ContextProvider { /** * ContextProvider instance, must be available (aka @NotNull) at every XPathFile instance by getCopyableUserData(). * It gets lost with putUserData()! */ private static final Key<ContextProvider> KEY = Key.create("CONTEXT_PROVIDER"); private DefaultFunctionContext myFunctionContext; protected ContextProvider() { } @NotNull public abstract ContextType getContextType(); @Nullable public abstract XmlElement getContextElement(); @Nullable public abstract NamespaceContext getNamespaceContext(); @Nullable public abstract VariableContext getVariableContext(); @NotNull public synchronized FunctionContext getFunctionContext() { if (myFunctionContext == null) { myFunctionContext = DefaultFunctionContext.getInstance(getContextType()); } return myFunctionContext; } @NotNull public XPathQuickFixFactory getQuickFixFactory() { return XPathQuickFixFactoryImpl.INSTANCE; } @Nullable public abstract Set<QName> getAttributes(boolean forValidation); @Nullable public abstract Set<QName> getElements(boolean forValidation); public void attachTo(PsiFile file) { assert file instanceof XPathFile; file.putCopyableUserData(KEY, this); } protected final void attachTo(XmlElement context) { context.putCopyableUserData(KEY, this); } @SuppressWarnings({ "ClassReferencesSubclass" }) public static void copy(@NotNull PsiFile file1, @NotNull XPathFile file2) { final ContextProvider contextProvider = getContextProvider(file1); if (!(contextProvider instanceof DefaultProvider)) { contextProvider.attachTo(file2); } } @NotNull public static ContextProvider getContextProvider(PsiFile psiFile) { ContextProvider provider = psiFile.getCopyableUserData(KEY); if (provider != null && provider.isValid()) { return provider; } final PsiElement context = psiFile.getContext(); if (context != null) { provider = context.getCopyableUserData(KEY); if (provider != null && provider.isValid()) { return provider; } } return getFromExtensionOrDefault(psiFile); } protected boolean isValid() { final XmlElement contextElement = getContextElement(); return contextElement != null && contextElement.isValid(); } @SuppressWarnings({ "ClassReferencesSubclass" }) private static ContextProvider getFromExtensionOrDefault(PsiFile psiFile) { if (psiFile instanceof XPathFile) { final ContextProvider instance = ContextProviderExtension.getInstance((XPathFile)psiFile); if (instance != null) { instance.attachTo(psiFile); return instance; } } return new DefaultProvider(PsiTreeUtil.getContextOfType(psiFile, XmlElement.class, true)); } @SuppressWarnings({ "ClassReferencesSubclass" }) @NotNull public static ContextProvider getContextProvider(PsiElement element) { return element instanceof XPathElement ? getContextProvider(element instanceof XPathFile ? (PsiFile)element : element.getContainingFile()) : new DefaultProvider(PsiTreeUtil.getParentOfType(element, XmlElement.class, false)); } @NotNull public XPathType getFunctionType(XPathFunctionCall call) { final XPathFunction f = call.resolve(); if (f == null) return XPathType.UNKNOWN; final Function function = f.getDeclaration(); return function != null ? function.returnType : XPathType.UNKNOWN; } public PsiFile[] getRelatedFiles(XPathFile file) { return PsiFile.EMPTY_ARRAY; } @NotNull public XPathType getExpectedType(XPathExpression expr) { return XPathType.UNKNOWN; } @Nullable public QName getQName(QNameElement element) { final PrefixedName qname = element.getQName(); return qname != null ? getQName(qname, element) : null; } @Nullable public QName getQName(@NotNull PrefixedName qName, XPathElement context) { final String prefix = qName.getPrefix(); final NamespaceContext namespaceContext = getNamespaceContext(); if (namespaceContext != null) { if (prefix != null) { final XmlElement element = PsiTreeUtil.getContextOfType(context, XmlElement.class, true); final String namespaceURI = namespaceContext.getNamespaceURI(prefix, element); return namespaceURI != null && namespaceURI.length() > 0 ? new QName(namespaceURI, qName.getLocalName(), prefix) : null; } else { return new QName(null, qName.getLocalName(), ""); } } else if (qName.getPrefix() == null) { return QName.valueOf(qName.getLocalName()); } else { return null; } } static class DefaultProvider extends ContextProvider { private final XmlElement myContextElement; DefaultProvider(XmlElement contextElement) { myContextElement = contextElement; } @NotNull public ContextType getContextType() { return ContextType.PLAIN; } @Nullable public XmlElement getContextElement() { return myContextElement; } @Nullable public NamespaceContext getNamespaceContext() { return null; } @Nullable public VariableContext getVariableContext() { return null; } @Nullable public Set<QName> getAttributes(boolean forValidation) { return null; } @Nullable public Set<QName> getElements(boolean forValidation) { return null; } } }
{ "content_hash": "f690992981ea5ec48efd92f9548b5dcb", "timestamp": "", "source": "github", "line_count": 203, "max_line_length": 136, "avg_line_length": 33.33990147783251, "alnum_prop": 0.6631205673758865, "repo_name": "joewalnes/idea-community", "id": "5bf774c000f6da8b6e2e8f75d477740a6ac7672e", "size": "7364", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/context/ContextProvider.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ActionScript", "bytes": "387" }, { "name": "C", "bytes": "136045" }, { "name": "C#", "bytes": "103" }, { "name": "C++", "bytes": "40449" }, { "name": "Emacs Lisp", "bytes": "2507" }, { "name": "Erlang", "bytes": "10" }, { "name": "Groovy", "bytes": "361320" }, { "name": "Java", "bytes": "89694599" }, { "name": "JavaScript", "bytes": "978" }, { "name": "Objective-C", "bytes": "1877" }, { "name": "PHP", "bytes": "145" }, { "name": "Perl", "bytes": "6523" }, { "name": "Python", "bytes": "1699274" }, { "name": "Shell", "bytes": "6965" }, { "name": "VimL", "bytes": "5950" } ], "symlink_target": "" }
<!DOCTYPE HTML> <html> <head> <title>Phaser - Bomber</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="chrome=1, IE=9"> <meta name="format-detection" content="telephone=no"> <meta name="HandheldFriendly" content="true" /> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="format-detection" content="telephone=no"> <meta name="HandheldFriendly" content="true" /> <meta name="robots" content="noindex,nofollow" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="apple-mobile-web-app-title" content="Bomber"> <meta name="viewport" content="initial-scale=1 maximum-scale=1 user-scalable=0 minimal-ui" /> <link rel="apple-touch-icon" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="57x57" href="icons/app_icon_57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="icons/app_icon_60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="icons/app_icon_72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="icons/app_icon_76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="icons/app_icon_114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="icons/app_icon_120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="icons/app_icon_144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="icons/app_icon_152x152.png"> <link rel="apple-touch-icon" sizes="256x256" href="icons/app_icon_256x256.png"> <link rel="apple-touch-icon" sizes="512x512" href="icons/app_icon_512x512.png"> <link rel="apple-touch-icon" sizes="1024x1024" href="icons/app_icon_1024x1024.png"> <link rel="stylesheet" href="css/stylesheet.css" type="text/css" charset="utf-8" /> <?php $path = '../../../phaser'; require('../../../phaser/build/config.php'); ?> <script src="src/Boot.js"></script> <script src="src/Preloader.js"></script> <script src="src/MainMenu.js"></script> <script src="src/City.js"></script> <script src="src/Game.js"></script> </head> <body> <div id="game"></div> <div id="orientation"></div> <script type="text/javascript"> (function () { var game = new Phaser.Game(512, 384, Phaser.CANVAS, 'game'); game.state.add('Boot', Bomber.Boot); game.state.add('Preloader', Bomber.Preloader); game.state.add('MainMenu', Bomber.MainMenu); game.state.add('Game', Bomber.Game); game.state.start('Boot'); })(); </script> </body> </html>
{ "content_hash": "f175bd7986621c81b8875383cd4f6699", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 97, "avg_line_length": 42.46031746031746, "alnum_prop": 0.6583177570093458, "repo_name": "gerardogrimaldi/gerardogrimaldi.github.io", "id": "cedd4ecd6b4906b5113e0cb41b8184c91d028960", "size": "2675", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "phaser-examples-master/projects/bomber/index.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "54787" }, { "name": "GLSL", "bytes": "2028" }, { "name": "HTML", "bytes": "85868" }, { "name": "JavaScript", "bytes": "11364753" }, { "name": "PHP", "bytes": "204019" } ], "symlink_target": "" }
package com.spotify.scio.io.dynamic.syntax import com.google.protobuf.Message import com.spotify.scio.io.{ClosedTap, EmptyTap} import com.spotify.scio.coders.{AvroBytesUtil, Coder, CoderMaterializer} import com.spotify.scio.util.{Functions, ProtobufUtil} import com.spotify.scio.values.SCollection import org.apache.avro.Schema import org.apache.avro.file.CodecFactory import org.apache.avro.generic.GenericRecord import org.apache.avro.specific.SpecificRecord import org.apache.beam.sdk.coders.StringUtf8Coder import org.apache.beam.sdk.io.AvroIO.RecordFormatter import org.apache.beam.sdk.io.{Compression, FileIO} import org.apache.beam.sdk.{io => beam} import scala.jdk.CollectionConverters._ import scala.reflect.ClassTag import java.util.{HashMap => JHashMap} object DynamicSCollectionOps { private[syntax] def writeDynamic[A]( path: String, numShards: Int, suffix: String, destinationFn: A => String ): FileIO.Write[String, A] = FileIO .writeDynamic[String, A]() .to(path) .withNumShards(numShards) .by(Functions.serializableFn(destinationFn)) .withDestinationCoder(StringUtf8Coder.of()) .withNaming(Functions.serializableFn { destination: String => FileIO.Write.defaultNaming(s"$destination/part", suffix) }) } final class DynamicSpecificRecordSCollectionOps[T <: SpecificRecord]( private val self: SCollection[T] ) extends AnyVal { import DynamicSCollectionOps.writeDynamic /** Save this SCollection as Avro files specified by the destination function. */ def saveAsDynamicAvroFile( path: String, numShards: Int = 0, suffix: String = ".avro", codec: CodecFactory = CodecFactory.deflateCodec(6), metadata: Map[String, AnyRef] = Map.empty )( destinationFn: T => String )(implicit ct: ClassTag[T]): ClosedTap[Nothing] = { if (self.context.isTest) { throw new NotImplementedError( "Avro file with dynamic destinations cannot be used in a test context" ) } else { val cls = ct.runtimeClass.asInstanceOf[Class[T]] val nm = new JHashMap[String, AnyRef]() nm.putAll(metadata.asJava) val sink = beam.AvroIO .sink(cls) .withCodec(codec) .withMetadata(nm) val write = writeDynamic(path, numShards, suffix, destinationFn) .via(sink) self.applyInternal(write) } ClosedTap[Nothing](EmptyTap) } } /** * Enhanced version of [[com.spotify.scio.values.SCollection SCollection]] with dynamic * destinations methods. */ final class DynamicGenericRecordSCollectionOps[T <: GenericRecord](private val self: SCollection[T]) extends AnyVal { import DynamicSCollectionOps.writeDynamic /** Save this SCollection as Avro files specified by the destination function. */ def saveAsDynamicAvroFile( path: String, schema: Schema, numShards: Int = 0, suffix: String = ".avro", codec: CodecFactory = CodecFactory.deflateCodec(6), metadata: Map[String, AnyRef] = Map.empty )( destinationFn: T => String ): ClosedTap[Nothing] = { if (self.context.isTest) { throw new NotImplementedError( "Avro file with dynamic destinations cannot be used in a test context" ) } else { val nm = new JHashMap[String, AnyRef]() nm.putAll(metadata.asJava) val sink = beam.AvroIO .sinkViaGenericRecords( schema, new RecordFormatter[T] { override def formatRecord(element: T, schema: Schema): GenericRecord = element } ) .withCodec(codec) .withMetadata(nm) val write = writeDynamic(path, numShards, suffix, destinationFn) .via(sink) self.applyInternal(write) } ClosedTap[Nothing](EmptyTap) } } /** * Enhanced version of [[com.spotify.scio.values.SCollection SCollection]] with dynamic * destinations methods. */ final class DynamicSCollectionOps[T](private val self: SCollection[T]) extends AnyVal { import DynamicSCollectionOps.writeDynamic /** Save this SCollection as text files specified by the destination function. */ def saveAsDynamicTextFile( path: String, numShards: Int = 0, suffix: String = ".txt", compression: Compression = Compression.UNCOMPRESSED )(destinationFn: String => String)(implicit ct: ClassTag[T]): ClosedTap[Nothing] = { val s = if (classOf[String] isAssignableFrom ct.runtimeClass) { self.asInstanceOf[SCollection[String]] } else { self.map(_.toString) } if (self.context.isTest) { throw new NotImplementedError( "Text file with dynamic destinations cannot be used in a test context" ) } else { val write = writeDynamic(path, numShards, suffix, destinationFn) .via(beam.TextIO.sink()) .withCompression(compression) s.applyInternal(write) } ClosedTap[Nothing](EmptyTap) } } final class DynamicProtobufSCollectionOps[T <: Message](private val self: SCollection[T]) extends AnyVal { import DynamicSCollectionOps.writeDynamic def saveAsDynamicProtobufFile( path: String, numShards: Int = 0, suffix: String = ".protobuf", codec: CodecFactory = CodecFactory.deflateCodec(6), metadata: Map[String, AnyRef] = Map.empty )(destinationFn: T => String)(implicit ct: ClassTag[T]): ClosedTap[Nothing] = { val protoCoder = Coder.protoMessageCoder[T] val elemCoder = CoderMaterializer.beam(self.context, protoCoder) val avroSchema = AvroBytesUtil.schema val nm = new JHashMap[String, AnyRef]() nm.putAll((metadata ++ ProtobufUtil.schemaMetadataOf(ct)).asJava) if (self.context.isTest) { throw new NotImplementedError( "Protobuf file with dynamic destinations cannot be used in a test context" ) } else { val sink = beam.AvroIO .sinkViaGenericRecords( avroSchema, new RecordFormatter[T] { override def formatRecord(element: T, schema: Schema): GenericRecord = AvroBytesUtil.encode(elemCoder, element) } ) .withCodec(codec) .withMetadata(nm) val write = writeDynamic(path, numShards, suffix, destinationFn) .via(sink) self.applyInternal(write) } ClosedTap[Nothing](EmptyTap) } } trait SCollectionSyntax { implicit def dynamicSpecificRecordSCollectionOps[T <: SpecificRecord]( sc: SCollection[T] ): DynamicSpecificRecordSCollectionOps[T] = new DynamicSpecificRecordSCollectionOps(sc) implicit def dynamicGenericRecordSCollectionOps[T <: GenericRecord]( sc: SCollection[T] ): DynamicGenericRecordSCollectionOps[T] = new DynamicGenericRecordSCollectionOps(sc) implicit def dynamicSCollectionOps[T](sc: SCollection[T]): DynamicSCollectionOps[T] = new DynamicSCollectionOps(sc) implicit def dynamicProtobufSCollectionOps[T <: Message]( sc: SCollection[T] ): DynamicProtobufSCollectionOps[T] = new DynamicProtobufSCollectionOps(sc) }
{ "content_hash": "8e84bdf91bf90a649ee7aa2cb11b07ed", "timestamp": "", "source": "github", "line_count": 220, "max_line_length": 100, "avg_line_length": 31.936363636363637, "alnum_prop": 0.6920011386279533, "repo_name": "regadas/scio", "id": "94411dc4fcefc4089335c5192ed16e96e0fb8639", "size": "7624", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "scio-core/src/main/scala/com/spotify/scio/io/dynamic/syntax/SCollecionSyntax.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C++", "bytes": "2556" }, { "name": "HTML", "bytes": "518" }, { "name": "Java", "bytes": "1045766" }, { "name": "Python", "bytes": "25090" }, { "name": "Scala", "bytes": "3284176" }, { "name": "Shell", "bytes": "4941" } ], "symlink_target": "" }
{% extends "base.html" %} {% block content %} {{content}} <div class="Posts Posts--index"> {% include "partials/nav_siblings.html" %} </div> {% endblock %}
{ "content_hash": "c4afd2f5db7b88ef2621b90f96af94e0", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 44, "avg_line_length": 18, "alnum_prop": 0.6049382716049383, "repo_name": "vieron/wwwrite", "id": "47e87bbe4c05cc8cce969ed8f4fcbd0253b5a757", "size": "162", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/fixtures/_wwwrite/views/post-index.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5241" }, { "name": "JavaScript", "bytes": "19893" } ], "symlink_target": "" }
<?php declare(strict_types=1); namespace Keystone\Multitenancy\Bundle\DependencyInjection; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\Extension; class KeystoneMultitenancyExtension extends Extension { /** * {@inheritdoc} */ public function load(array $configs, ContainerBuilder $container) { $config = $this->processConfiguration(new Configuration(), $configs); $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yml'); $requestListener = $container->getDefinition('keystone_multitenancy.event_listener.tenant_request'); $requestListener->replaceArgument(3, new Reference($config['tenant_repository_id'])); $requestListener->replaceArgument(4, $config['tenant_route_parameter']); $requestListener->replaceArgument(5, $config['tenant_filter_column']); $argumentResolver = $container->getDefinition('keystone_multitenancy.controller.argument_resolver.tenant_value'); $argumentResolver->replaceArgument(1, $config['tenant_entity']); } }
{ "content_hash": "54c979e015a33813357c3a826bec2c97", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 121, "avg_line_length": 40.39393939393939, "alnum_prop": 0.741185296324081, "repo_name": "keystonephp/multitenancy", "id": "bae3e8be4f852b7c1242af433f30a5caab99e0f0", "size": "1333", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Bundle/DependencyInjection/KeystoneMultitenancyExtension.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "29495" } ], "symlink_target": "" }
Developing, untested.
{ "content_hash": "b0564ad546726a40779122568908677f", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 21, "avg_line_length": 22, "alnum_prop": 0.8181818181818182, "repo_name": "ximsfei/Android-theme-support", "id": "c6b9b8f1e0157f6485accb9512b7eb409be791a7", "size": "47", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "296841" } ], "symlink_target": "" }
import { CategoricalColorNamespace } from '.'; import { FeatureFlag, isFeatureEnabled, makeSingleton } from '../utils'; import { getAnalogousColors } from './utils'; export class SharedLabelColor { sliceLabelColorMap: Record<number, Record<string, string | undefined>>; constructor() { // { sliceId1: { label1: color1 }, sliceId2: { label2: color2 } } this.sliceLabelColorMap = {}; } getColorMap( colorNamespace?: string, colorScheme?: string, updateColorScheme?: boolean, ) { if (colorScheme) { const categoricalNamespace = CategoricalColorNamespace.getNamespace(colorNamespace); const sharedLabels = this.getSharedLabels(); let generatedColors: string[] = []; let sharedLabelMap; if (sharedLabels.length) { const colorScale = categoricalNamespace.getScale(colorScheme); const colors = colorScale.range(); if (isFeatureEnabled(FeatureFlag.USE_ANALAGOUS_COLORS)) { const multiple = Math.ceil(sharedLabels.length / colors.length); generatedColors = getAnalogousColors(colors, multiple); sharedLabelMap = sharedLabels.reduce( (res, label, index) => ({ ...res, [label.toString()]: generatedColors[index], }), {}, ); } else { // reverse colors to reduce color conflicts colorScale.range(colors.reverse()); sharedLabelMap = sharedLabels.reduce( (res, label) => ({ ...res, [label.toString()]: colorScale(label), }), {}, ); } } const labelMap = Object.keys(this.sliceLabelColorMap).reduce( (res, sliceId) => { // get new color scale instance const colorScale = categoricalNamespace.getScale(colorScheme); return { ...res, ...Object.keys(this.sliceLabelColorMap[sliceId]).reduce( (res, label) => ({ ...res, [label]: updateColorScheme ? colorScale(label) : this.sliceLabelColorMap[sliceId][label], }), {}, ), }; }, {}, ); return { ...labelMap, ...sharedLabelMap, }; } return undefined; } addSlice(label: string, color: string, sliceId?: number) { if (!sliceId) return; this.sliceLabelColorMap[sliceId] = { ...this.sliceLabelColorMap[sliceId], [label]: color, }; } removeSlice(sliceId: number) { delete this.sliceLabelColorMap[sliceId]; } clear() { this.sliceLabelColorMap = {}; } getSharedLabels() { const tempLabels = new Set<string>(); const result = new Set<string>(); Object.keys(this.sliceLabelColorMap).forEach(sliceId => { const colorMap = this.sliceLabelColorMap[sliceId]; Object.keys(colorMap).forEach(label => { if (tempLabels.has(label) && !result.has(label)) { result.add(label); } else { tempLabels.add(label); } }); }); return [...result]; } } const getInstance = makeSingleton(SharedLabelColor); export default getInstance;
{ "content_hash": "aa1766a5a0553ca9505e018e8d7b8c95", "timestamp": "", "source": "github", "line_count": 116, "max_line_length": 74, "avg_line_length": 28.103448275862068, "alnum_prop": 0.5662576687116564, "repo_name": "zhouyao1994/incubator-superset", "id": "10a14df0759102353ab99d3031dee324b98839d1", "size": "4067", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "superset-frontend/packages/superset-ui-core/src/color/SharedLabelColorSingleton.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "4776" }, { "name": "Dockerfile", "bytes": "6940" }, { "name": "HTML", "bytes": "1243911" }, { "name": "JavaScript", "bytes": "2445349" }, { "name": "Jinja", "bytes": "5542" }, { "name": "Jupyter Notebook", "bytes": "1925627" }, { "name": "Less", "bytes": "106438" }, { "name": "Makefile", "bytes": "3946" }, { "name": "Mako", "bytes": "1197" }, { "name": "Pug", "bytes": "2969" }, { "name": "Python", "bytes": "6296253" }, { "name": "Shell", "bytes": "56211" }, { "name": "Smarty", "bytes": "4298" }, { "name": "TypeScript", "bytes": "6909337" } ], "symlink_target": "" }
<?php namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Tests\ORM\Functional\DatabaseDriverTestCase; use Doctrine\ORM\Mapping\ClassMetadataInfo; class DDC2387Test extends DatabaseDriverTestCase { /** * @group DDC-2387 */ public function testCompositeAssociationKeyDetection() { $product = new \Doctrine\DBAL\Schema\Table('ddc2387_product'); $product->addColumn('id', 'integer'); $product->setPrimaryKey(array('id')); $attributes = new \Doctrine\DBAL\Schema\Table('ddc2387_attributes'); $attributes->addColumn('product_id', 'integer'); $attributes->addColumn('attribute_name', 'string'); $attributes->setPrimaryKey(array('product_id', 'attribute_name')); $attributes->addForeignKeyConstraint('ddc2387_product', array('product_id'), array('product_id')); $metadata = $this->convertToClassMetadata(array($product, $attributes), array()); $this->assertEquals(ClassMetadataInfo::GENERATOR_TYPE_NONE, $metadata['Ddc2387Attributes']->generatorType); $this->assertEquals(ClassMetadataInfo::GENERATOR_TYPE_AUTO, $metadata['Ddc2387Product']->generatorType); } }
{ "content_hash": "9e708117876c34139c82cc967c44c001", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 115, "avg_line_length": 40.43333333333333, "alnum_prop": 0.6793075020610058, "repo_name": "javieralfaya/tuitty", "id": "c75ead31848d5eab0e3acbd2c17ca94a37fa058a", "size": "1213", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2387Test.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "18385" }, { "name": "PHP", "bytes": "108817" }, { "name": "Shell", "bytes": "188" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.github.vladimir-bukhtoyarov</groupId> <artifactId>bucket4j-parent</artifactId> <version>7.5.0</version> <relativePath>../bucket4j-parent</relativePath> </parent> <artifactId>bucket4j-caffeine</artifactId> <name>bucket4j-caffeine</name> <description>Bucket4j integration with Caffeine</description> <properties> <modular-name>caffeine</modular-name> </properties> <dependencies> <dependency> <groupId>com.github.vladimir-bukhtoyarov</groupId> <artifactId>bucket4j-core</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>com.github.vladimir-bukhtoyarov</groupId> <artifactId>bucket4j-core</artifactId> <version>${project.version}</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupId>com.github.ben-manes.caffeine</groupId> <artifactId>caffeine</artifactId> <version>${caffeine.version}</version> </dependency> </dependencies> </project>
{ "content_hash": "56180bcd53fe18f6d307eb034a338238", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 108, "avg_line_length": 35.54761904761905, "alnum_prop": 0.6208975217682519, "repo_name": "vladimir-bukhtoyarov/bucket4j", "id": "0f290bf46db2ee9e79546239e94dfec67451c24d", "size": "1493", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bucket4j-caffeine/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Groovy", "bytes": "242442" }, { "name": "HTML", "bytes": "467" }, { "name": "Java", "bytes": "1073059" }, { "name": "Kotlin", "bytes": "3128" }, { "name": "Lua", "bytes": "13534" }, { "name": "Shell", "bytes": "326" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <title>GPKGTileTable Class Reference</title> <link rel="stylesheet" type="text/css" href="../css/jazzy.css" /> <link rel="stylesheet" type="text/css" href="../css/highlight.css" /> <meta charset='utf-8'> <script src="../js/jquery.min.js" defer></script> <script src="../js/jazzy.js" defer></script> <script src="../js/lunr.min.js" defer></script> <script src="../js/typeahead.jquery.js" defer></script> <script src="../js/jazzy.search.js" defer></script> </head> <body> <a name="//apple_ref/objc/Class/GPKGTileTable" class="dashAnchor"></a> <a title="GPKGTileTable Class Reference"></a> <header> <div class="content-wrapper"> <p><a href="../index.html">geopackage-ios 7.3.0 Docs</a> (85% documented)</p> <p class="header-right"><a href="https://github.com/ngageoint/geopackage-ios"><img src="../img/gh.png" alt="GitHub"/>View on GitHub</a></p> <div class="header-right"> <form role="search" action="../search.json"> <input type="text" placeholder="Search documentation" data-typeahead> </form> </div> </div> </header> <div class="content-wrapper"> <p id="breadcrumbs"> <a href="../index.html">geopackage-ios Reference</a> <img id="carat" src="../img/carat.png" alt=""/> GPKGTileTable Class Reference </p> </div> <div class="content-wrapper"> <nav class="sidebar"> <ul class="nav-groups"> <li class="nav-group-name"> <a href="../Classes.html">Classes</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Classes/CLRColor.html">CLRColor</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSAbridgedCoordinateTransformation.html">CRSAbridgedCoordinateTransformation</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSAxis.html">CRSAxis</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSAxisDirectionTypes.html">CRSAxisDirectionTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSBoundCoordinateReferenceSystem.html">CRSBoundCoordinateReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSCategoryTypes.html">CRSCategoryTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSCommon.html">CRSCommon</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSCompoundCoordinateReferenceSystem.html">CRSCompoundCoordinateReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSConcatenatedOperation.html">CRSConcatenatedOperation</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSCoordinateMetadata.html">CRSCoordinateMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSCoordinateOperation.html">CRSCoordinateOperation</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSCoordinateReferenceSystem.html">CRSCoordinateReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSCoordinateSystem.html">CRSCoordinateSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSCoordinateSystemTypes.html">CRSCoordinateSystemTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSDateTime.html">CRSDateTime</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSDatumEnsemble.html">CRSDatumEnsemble</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSDatumEnsembleMember.html">CRSDatumEnsembleMember</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSDerivedCoordinateReferenceSystem.html">CRSDerivedCoordinateReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSDerivingConversion.html">CRSDerivingConversion</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSDynamic.html">CRSDynamic</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSEllipsoid.html">CRSEllipsoid</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSEllipsoidTypes.html">CRSEllipsoidTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSEllipsoids.html">CRSEllipsoids</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSEngineeringCoordinateReferenceSystem.html">CRSEngineeringCoordinateReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSEngineeringDatum.html">CRSEngineeringDatum</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSExtent.html">CRSExtent</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSGeoCoordinateReferenceSystem.html">CRSGeoCoordinateReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSGeoDatumEnsemble.html">CRSGeoDatumEnsemble</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSGeoDatums.html">CRSGeoDatums</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSGeoReferenceFrame.html">CRSGeoReferenceFrame</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSGeographicBoundingBox.html">CRSGeographicBoundingBox</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSIdentifier.html">CRSIdentifier</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSKeyword.html">CRSKeyword</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSMapProjection.html">CRSMapProjection</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSObject.html">CRSObject</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSOperation.html">CRSOperation</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSOperationMethod.html">CRSOperationMethod</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSOperationMethods.html">CRSOperationMethods</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSOperationParameter.html">CRSOperationParameter</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSOperationParameters.html">CRSOperationParameters</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSOperationTypes.html">CRSOperationTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSParametricCoordinateReferenceSystem.html">CRSParametricCoordinateReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSParametricDatum.html">CRSParametricDatum</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSPointMotionOperation.html">CRSPointMotionOperation</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSPrimeMeridian.html">CRSPrimeMeridian</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSPrimeMeridians.html">CRSPrimeMeridians</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)CRSProjConstants">CRSProjConstants</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSProjParams.html">CRSProjParams</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSProjParser.html">CRSProjParser</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSProjectedCoordinateReferenceSystem.html">CRSProjectedCoordinateReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSReader.html">CRSReader</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSReferenceFrame.html">CRSReferenceFrame</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSSimpleCoordinateReferenceSystem.html">CRSSimpleCoordinateReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSSimpleOperation.html">CRSSimpleOperation</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSTemporalCoordinateReferenceSystem.html">CRSTemporalCoordinateReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSTemporalDatum.html">CRSTemporalDatum</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSTemporalExtent.html">CRSTemporalExtent</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)CRSTextConstants">CRSTextConstants</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSTextReader.html">CRSTextReader</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSTextUtils.html">CRSTextUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSTriaxialEllipsoid.html">CRSTriaxialEllipsoid</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSTypes.html">CRSTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSUnit.html">CRSUnit</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSUnitTypes.html">CRSUnitTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSUnits.html">CRSUnits</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSUsage.html">CRSUsage</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSVerticalCoordinateReferenceSystem.html">CRSVerticalCoordinateReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSVerticalDatumEnsemble.html">CRSVerticalDatumEnsemble</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSVerticalExtent.html">CRSVerticalExtent</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSVerticalReferenceFrame.html">CRSVerticalReferenceFrame</a> </li> <li class="nav-group-task"> <a href="../Classes/CRSWriter.html">CRSWriter</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGAlterTable.html">GPKGAlterTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGAttributesColumn.html">GPKGAttributesColumn</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGAttributesColumns.html">GPKGAttributesColumns</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGAttributesDao.html">GPKGAttributesDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGAttributesRow.html">GPKGAttributesRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGAttributesTable.html">GPKGAttributesTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGAttributesTableMetadata.html">GPKGAttributesTableMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGAttributesTableReader.html">GPKGAttributesTableReader</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGBaseDao.html">GPKGBaseDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGBaseExtension.html">GPKGBaseExtension</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGBoundedOverlay.html">GPKGBoundedOverlay</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGBoundingBox.html">GPKGBoundingBox</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGColumnConstraints.html">GPKGColumnConstraints</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGColumnValue.html">GPKGColumnValue</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGColumnValues.html">GPKGColumnValues</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCompositeOverlay.html">GPKGCompositeOverlay</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCompressFormats.html">GPKGCompressFormats</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGConnection.html">GPKGConnection</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGConnectionFunction.html">GPKGConnectionFunction</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGConnectionPool.html">GPKGConnectionPool</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGConstraint.html">GPKGConstraint</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGConstraintParser.html">GPKGConstraintParser</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGConstraintTypes.html">GPKGConstraintTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGConstraints.html">GPKGConstraints</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGContentValues.html">GPKGContentValues</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGContents.html">GPKGContents</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGContentsDao.html">GPKGContentsDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGContentsDataTypes.html">GPKGContentsDataTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGContentsId.html">GPKGContentsId</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGContentsIdDao.html">GPKGContentsIdDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGContentsIdExtension.html">GPKGContentsIdExtension</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGContentsIdTableCreator.html">GPKGContentsIdTableCreator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCoverageData.html">GPKGCoverageData</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCoverageDataAlgorithms.html">GPKGCoverageDataAlgorithms</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCoverageDataPng.html">GPKGCoverageDataPng</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCoverageDataPngImage.html">GPKGCoverageDataPngImage</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCoverageDataRequest.html">GPKGCoverageDataRequest</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCoverageDataResults.html">GPKGCoverageDataResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCoverageDataSourcePixel.html">GPKGCoverageDataSourcePixel</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCoverageDataTiff.html">GPKGCoverageDataTiff</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCoverageDataTiffImage.html">GPKGCoverageDataTiffImage</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCoverageDataTileMatrixResults.html">GPKGCoverageDataTileMatrixResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGCrsWktExtension.html">GPKGCrsWktExtension</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGDataColumnConstraints.html">GPKGDataColumnConstraints</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGDataColumnConstraintsDao.html">GPKGDataColumnConstraintsDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGDataColumns.html">GPKGDataColumns</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGDataColumnsDao.html">GPKGDataColumnsDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGDataTypes.html">GPKGDataTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGDateTimeUtils.html">GPKGDateTimeUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGDbConnection.html">GPKGDbConnection</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGDublinCoreMetadata.html">GPKGDublinCoreMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGDublinCoreTypes.html">GPKGDublinCoreTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGExtendedRelation.html">GPKGExtendedRelation</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGExtendedRelationsDao.html">GPKGExtendedRelationsDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGExtensionManagement.html">GPKGExtensionManagement</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGExtensionManager.html">GPKGExtensionManager</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGExtensions.html">GPKGExtensions</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGExtensionsDao.html">GPKGExtensionsDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureCache.html">GPKGFeatureCache</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureCacheTables.html">GPKGFeatureCacheTables</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureColumn.html">GPKGFeatureColumn</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureColumns.html">GPKGFeatureColumns</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureDao.html">GPKGFeatureDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureGenerator.html">GPKGFeatureGenerator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexFeatureResults.html">GPKGFeatureIndexFeatureResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexGeoPackageResults.html">GPKGFeatureIndexGeoPackageResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexListResults.html">GPKGFeatureIndexListResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexLocation.html">GPKGFeatureIndexLocation</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexManager.html">GPKGFeatureIndexManager</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexMetadataResults.html">GPKGFeatureIndexMetadataResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexRTreeResults.html">GPKGFeatureIndexRTreeResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexResultSetResults.html">GPKGFeatureIndexResultSetResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexResults.html">GPKGFeatureIndexResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexTypes.html">GPKGFeatureIndexTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexer.html">GPKGFeatureIndexer</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexerIdQuery.html">GPKGFeatureIndexerIdQuery</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureIndexerIdResultSet.html">GPKGFeatureIndexerIdResultSet</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureInfoBuilder.html">GPKGFeatureInfoBuilder</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureOverlay.html">GPKGFeatureOverlay</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureOverlayQuery.html">GPKGFeatureOverlayQuery</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeaturePreview.html">GPKGFeaturePreview</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureRow.html">GPKGFeatureRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureRowData.html">GPKGFeatureRowData</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureShape.html">GPKGFeatureShape</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureShapes.html">GPKGFeatureShapes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureStyle.html">GPKGFeatureStyle</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureStyleExtension.html">GPKGFeatureStyleExtension</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureStyles.html">GPKGFeatureStyles</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTable.html">GPKGFeatureTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTableData.html">GPKGFeatureTableData</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTableIndex.html">GPKGFeatureTableIndex</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTableMetadata.html">GPKGFeatureTableMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTableReader.html">GPKGFeatureTableReader</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTableStyles.html">GPKGFeatureTableStyles</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTileContext.html">GPKGFeatureTileContext</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTileGenerator.html">GPKGFeatureTileGenerator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTileLink.html">GPKGFeatureTileLink</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTileLinkDao.html">GPKGFeatureTileLinkDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTileLinkTableCreator.html">GPKGFeatureTileLinkTableCreator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTilePointIcon.html">GPKGFeatureTilePointIcon</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTileTableLinker.html">GPKGFeatureTileTableLinker</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGFeatureTiles.html">GPKGFeatureTiles</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackage.html">GPKGGeoPackage</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackageCache.html">GPKGGeoPackageCache</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)GPKGGeoPackageConstants">GPKGGeoPackageConstants</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackageFactory.html">GPKGGeoPackageFactory</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackageManager.html">GPKGGeoPackageManager</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackageMetadata.html">GPKGGeoPackageMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackageMetadataDao.html">GPKGGeoPackageMetadataDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackageMetadataTableCreator.html">GPKGGeoPackageMetadataTableCreator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackageOverlay.html">GPKGGeoPackageOverlay</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackageTableCreator.html">GPKGGeoPackageTableCreator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackageTile.html">GPKGGeoPackageTile</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackageTileRetriever.html">GPKGGeoPackageTileRetriever</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeoPackageValidate.html">GPKGGeoPackageValidate</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeometryColumns.html">GPKGGeometryColumns</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeometryColumnsDao.html">GPKGGeometryColumnsDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeometryCrop.html">GPKGGeometryCrop</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeometryData.html">GPKGGeometryData</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeometryExtensions.html">GPKGGeometryExtensions</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeometryIndex.html">GPKGGeometryIndex</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeometryIndexDao.html">GPKGGeometryIndexDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeometryIndexTableCreator.html">GPKGGeometryIndexTableCreator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeometryMetadata.html">GPKGGeometryMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeometryMetadataDao.html">GPKGGeometryMetadataDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGeometryUtils.html">GPKGGeometryUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGriddedCoverage.html">GPKGGriddedCoverage</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGriddedCoverageDao.html">GPKGGriddedCoverageDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGriddedCoverageDataTypes.html">GPKGGriddedCoverageDataTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGriddedCoverageEncodingTypes.html">GPKGGriddedCoverageEncodingTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGriddedTile.html">GPKGGriddedTile</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGGriddedTileDao.html">GPKGGriddedTileDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGIOUtils.html">GPKGIOUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGIconCache.html">GPKGIconCache</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGIconDao.html">GPKGIconDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGIconRow.html">GPKGIconRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGIconTable.html">GPKGIconTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGIcons.html">GPKGIcons</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGImageConverter.html">GPKGImageConverter</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGLocationBoundingBox.html">GPKGLocationBoundingBox</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGManualFeatureQuery.html">GPKGManualFeatureQuery</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGManualFeatureQueryResults.html">GPKGManualFeatureQueryResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMapPoint.html">GPKGMapPoint</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMapPointOptions.html">GPKGMapPointOptions</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMapShape.html">GPKGMapShape</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMapShapeConverter.html">GPKGMapShapeConverter</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMapShapePoints.html">GPKGMapShapePoints</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMapShapeTypes.html">GPKGMapShapeTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMapTolerance.html">GPKGMapTolerance</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMapUtils.html">GPKGMapUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMappedColumn.html">GPKGMappedColumn</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMediaDao.html">GPKGMediaDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMediaRow.html">GPKGMediaRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMediaTable.html">GPKGMediaTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMediaTableMetadata.html">GPKGMediaTableMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMetadata.html">GPKGMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMetadataDao.html">GPKGMetadataDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMetadataDb.html">GPKGMetadataDb</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMetadataExtension.html">GPKGMetadataExtension</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMetadataReference.html">GPKGMetadataReference</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMetadataReferenceDao.html">GPKGMetadataReferenceDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMetadataScope.html">GPKGMetadataScope</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMultiPoint.html">GPKGMultiPoint</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMultiPolygon.html">GPKGMultiPolygon</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMultiPolygonPoints.html">GPKGMultiPolygonPoints</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMultiPolyline.html">GPKGMultiPolyline</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMultiPolylinePoints.html">GPKGMultiPolylinePoints</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGMultipleFeatureIndexResults.html">GPKGMultipleFeatureIndexResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGNGAExtensions.html">GPKGNGAExtensions</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)GPKGNGATableCreator">GPKGNGATableCreator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGNetworkUtils.html">GPKGNetworkUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGNumberFeaturesTile.html">GPKGNumberFeaturesTile</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGOAPIFeatureGenerator.html">GPKGOAPIFeatureGenerator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGObjectPaginatedResults.html">GPKGObjectPaginatedResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGObjectResultSet.html">GPKGObjectResultSet</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGOverlayFactory.html">GPKGOverlayFactory</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPaginatedResults.html">GPKGPaginatedResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPagination.html">GPKGPagination</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPixelBounds.html">GPKGPixelBounds</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPlatteCarreOptimize.html">GPKGPlatteCarreOptimize</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPolygon.html">GPKGPolygon</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPolygonHolePoints.html">GPKGPolygonHolePoints</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPolygonOptions.html">GPKGPolygonOptions</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)GPKGPolygonOrientations">GPKGPolygonOrientations</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPolygonPoints.html">GPKGPolygonPoints</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPolyline.html">GPKGPolyline</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPolylineOptions.html">GPKGPolylineOptions</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPolylinePoints.html">GPKGPolylinePoints</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGProperties.html">GPKGProperties</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPropertiesExtension.html">GPKGPropertiesExtension</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGPropertiesManager.html">GPKGPropertiesManager</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)GPKGPropertyConstants">GPKGPropertyConstants</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)GPKGPropertyNames">GPKGPropertyNames</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGRTreeIndexExtension.html">GPKGRTreeIndexExtension</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGRTreeIndexTableDao.html">GPKGRTreeIndexTableDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGRTreeIndexTableRow.html">GPKGRTreeIndexTableRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGRawConstraint.html">GPKGRawConstraint</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGRelatedTablesExtension.html">GPKGRelatedTablesExtension</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGRelationTypes.html">GPKGRelationTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGResultSet.html">GPKGResultSet</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGRow.html">GPKGRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGRowPaginatedResults.html">GPKGRowPaginatedResults</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGRowResultSet.html">GPKGRowResultSet</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSQLiteMaster.html">GPKGSQLiteMaster</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSQLiteMasterColumns.html">GPKGSQLiteMasterColumns</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSQLiteMasterQuery.html">GPKGSQLiteMasterQuery</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSQLiteMasterTypes.html">GPKGSQLiteMasterTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSchemaExtension.html">GPKGSchemaExtension</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSessionTaskData.html">GPKGSessionTaskData</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSimpleAttributesDao.html">GPKGSimpleAttributesDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSimpleAttributesRow.html">GPKGSimpleAttributesRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSimpleAttributesTable.html">GPKGSimpleAttributesTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSimpleAttributesTableMetadata.html">GPKGSimpleAttributesTableMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSpatialReferenceSystem.html">GPKGSpatialReferenceSystem</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSpatialReferenceSystemDao.html">GPKGSpatialReferenceSystemDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSqlLiteQueryBuilder.html">GPKGSqlLiteQueryBuilder</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSqlUtils.html">GPKGSqlUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGSqliteConnection.html">GPKGSqliteConnection</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGStyleCache.html">GPKGStyleCache</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGStyleDao.html">GPKGStyleDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGStyleMappingDao.html">GPKGStyleMappingDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGStyleMappingRow.html">GPKGStyleMappingRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGStyleMappingTable.html">GPKGStyleMappingTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGStyleRow.html">GPKGStyleRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGStyleTable.html">GPKGStyleTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGStyleUtils.html">GPKGStyleUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGStyles.html">GPKGStyles</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTableColumn.html">GPKGTableColumn</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTableConstraints.html">GPKGTableConstraints</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTableCreator.html">GPKGTableCreator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTableIndex.html">GPKGTableIndex</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTableIndexDao.html">GPKGTableIndexDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTableInfo.html">GPKGTableInfo</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTableMapping.html">GPKGTableMapping</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTableMetadata.html">GPKGTableMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTableMetadataDao.html">GPKGTableMetadataDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileBoundingBoxUtils.html">GPKGTileBoundingBoxUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileColumn.html">GPKGTileColumn</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileColumns.html">GPKGTileColumns</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileCreator.html">GPKGTileCreator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileDao.html">GPKGTileDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileDaoUtils.html">GPKGTileDaoUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileGenerator.html">GPKGTileGenerator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileGrid.html">GPKGTileGrid</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileMatrix.html">GPKGTileMatrix</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileMatrixDao.html">GPKGTileMatrixDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileMatrixSet.html">GPKGTileMatrixSet</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileMatrixSetDao.html">GPKGTileMatrixSetDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileReprojection.html">GPKGTileReprojection</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileReprojectionOptimize.html">GPKGTileReprojectionOptimize</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileReprojectionZoom.html">GPKGTileReprojectionZoom</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileRow.html">GPKGTileRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileScaling.html">GPKGTileScaling</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileScalingDao.html">GPKGTileScalingDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileScalingTableCreator.html">GPKGTileScalingTableCreator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileScalingTypes.html">GPKGTileScalingTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileTable.html">GPKGTileTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileTableMetadata.html">GPKGTileTableMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileTableReader.html">GPKGTileTableReader</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileTableScaling.html">GPKGTileTableScaling</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGTileUtils.html">GPKGTileUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUniqueConstraint.html">GPKGUniqueConstraint</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUrlTileGenerator.html">GPKGUrlTileGenerator</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserColumn.html">GPKGUserColumn</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserColumns.html">GPKGUserColumns</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserCustomColumn.html">GPKGUserCustomColumn</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserCustomColumns.html">GPKGUserCustomColumns</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserCustomDao.html">GPKGUserCustomDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserCustomRow.html">GPKGUserCustomRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserCustomTable.html">GPKGUserCustomTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserCustomTableReader.html">GPKGUserCustomTableReader</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserDao.html">GPKGUserDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserMappingDao.html">GPKGUserMappingDao</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserMappingRow.html">GPKGUserMappingRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserMappingTable.html">GPKGUserMappingTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserRelatedTable.html">GPKGUserRelatedTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserRow.html">GPKGUserRow</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserRowSync.html">GPKGUserRowSync</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserTable.html">GPKGUserTable</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserTableMetadata.html">GPKGUserTableMetadata</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUserTableReader.html">GPKGUserTableReader</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGUtils.html">GPKGUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGWebMercatorOptimize.html">GPKGWebMercatorOptimize</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGWebPExtension.html">GPKGWebPExtension</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGXYZOverlay.html">GPKGXYZOverlay</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGXYZTileRetriever.html">GPKGXYZTileRetriever</a> </li> <li class="nav-group-task"> <a href="../Classes/GPKGZoomOtherExtension.html">GPKGZoomOtherExtension</a> </li> <li class="nav-group-task"> <a href="../Classes/OAFCollection.html">OAFCollection</a> </li> <li class="nav-group-task"> <a href="../Classes/OAFCollections.html">OAFCollections</a> </li> <li class="nav-group-task"> <a href="../Classes/OAFCrs.html">OAFCrs</a> </li> <li class="nav-group-task"> <a href="../Classes/OAFExtent.html">OAFExtent</a> </li> <li class="nav-group-task"> <a href="../Classes/OAFFeatureCollection.html">OAFFeatureCollection</a> </li> <li class="nav-group-task"> <a href="../Classes/OAFFeaturesConverter.html">OAFFeaturesConverter</a> </li> <li class="nav-group-task"> <a href="../Classes/OAFFeaturesObject.html">OAFFeaturesObject</a> </li> <li class="nav-group-task"> <a href="../Classes/OAFLink.html">OAFLink</a> </li> <li class="nav-group-task"> <a href="../Classes/OAFSpatial.html">OAFSpatial</a> </li> <li class="nav-group-task"> <a href="../Classes/OAFTemporal.html">OAFTemporal</a> </li> <li class="nav-group-task"> <a href="../Classes/PROJAuthorityProjections.html">PROJAuthorityProjections</a> </li> <li class="nav-group-task"> <a href="../Classes/PROJCRSParser.html">PROJCRSParser</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)PROJConstants">PROJConstants</a> </li> <li class="nav-group-task"> <a href="../Classes/PROJIOUtils.html">PROJIOUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/PROJLocationCoordinate3D.html">PROJLocationCoordinate3D</a> </li> <li class="nav-group-task"> <a href="../Classes/PROJProjection.html">PROJProjection</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)PROJProjectionConstants">PROJProjectionConstants</a> </li> <li class="nav-group-task"> <a href="../Classes/PROJProjectionFactory.html">PROJProjectionFactory</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)PROJProjectionFactoryTypes">PROJProjectionFactoryTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/PROJProjectionRetriever.html">PROJProjectionRetriever</a> </li> <li class="nav-group-task"> <a href="../Classes/PROJProjectionTransform.html">PROJProjectionTransform</a> </li> <li class="nav-group-task"> <a href="../Classes/PROJProjections.html">PROJProjections</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)PROJUnits">PROJUnits</a> </li> <li class="nav-group-task"> <a href="../Classes/SFByteReader.html">SFByteReader</a> </li> <li class="nav-group-task"> <a href="../Classes/SFByteWriter.html">SFByteWriter</a> </li> <li class="nav-group-task"> <a href="../Classes/SFCentroidCurve.html">SFCentroidCurve</a> </li> <li class="nav-group-task"> <a href="../Classes/SFCentroidPoint.html">SFCentroidPoint</a> </li> <li class="nav-group-task"> <a href="../Classes/SFCentroidSurface.html">SFCentroidSurface</a> </li> <li class="nav-group-task"> <a href="../Classes/SFCircularString.html">SFCircularString</a> </li> <li class="nav-group-task"> <a href="../Classes/SFCompoundCurve.html">SFCompoundCurve</a> </li> <li class="nav-group-task"> <a href="../Classes/SFCurve.html">SFCurve</a> </li> <li class="nav-group-task"> <a href="../Classes/SFCurvePolygon.html">SFCurvePolygon</a> </li> <li class="nav-group-task"> <a href="../Classes/SFDegreesCentroid.html">SFDegreesCentroid</a> </li> <li class="nav-group-task"> <a href="../Classes/SFEvent.html">SFEvent</a> </li> <li class="nav-group-task"> <a href="../Classes/SFEventQueue.html">SFEventQueue</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)SFEventTypes">SFEventTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/SFExtendedGeometryCollection.html">SFExtendedGeometryCollection</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)SFFiniteFilterTypes">SFFiniteFilterTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGFeature.html">SFGFeature</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGFeatureCollection.html">SFGFeatureCollection</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGFeatureConverter.html">SFGFeatureConverter</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGGeoJSONObject.html">SFGGeoJSONObject</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGGeometry.html">SFGGeometry</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGGeometryCollection.html">SFGGeometryCollection</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGGeometryTypes.html">SFGGeometryTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGLineString.html">SFGLineString</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGMultiLineString.html">SFGMultiLineString</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGMultiPoint.html">SFGMultiPoint</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGMultiPolygon.html">SFGMultiPolygon</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGOrderedDictionary.html">SFGOrderedDictionary</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGPoint.html">SFGPoint</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGPolygon.html">SFGPolygon</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGPosition.html">SFGPosition</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGeometry.html">SFGeometry</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGeometryCollection.html">SFGeometryCollection</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)SFGeometryConstants">SFGeometryConstants</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGeometryEnvelope.html">SFGeometryEnvelope</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGeometryEnvelopeBuilder.html">SFGeometryEnvelopeBuilder</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGeometryPrinter.html">SFGeometryPrinter</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGeometryTypes.html">SFGeometryTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/SFGeometryUtils.html">SFGeometryUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/SFLine.html">SFLine</a> </li> <li class="nav-group-task"> <a href="../Classes/SFLineString.html">SFLineString</a> </li> <li class="nav-group-task"> <a href="../Classes/SFLinearRing.html">SFLinearRing</a> </li> <li class="nav-group-task"> <a href="../Classes/SFMultiCurve.html">SFMultiCurve</a> </li> <li class="nav-group-task"> <a href="../Classes/SFMultiLineString.html">SFMultiLineString</a> </li> <li class="nav-group-task"> <a href="../Classes/SFMultiPoint.html">SFMultiPoint</a> </li> <li class="nav-group-task"> <a href="../Classes/SFMultiPolygon.html">SFMultiPolygon</a> </li> <li class="nav-group-task"> <a href="../Classes/SFMultiSurface.html">SFMultiSurface</a> </li> <li class="nav-group-task"> <a href="../Classes/SFPGeometryTransform.html">SFPGeometryTransform</a> </li> <li class="nav-group-task"> <a href="../Classes/SFPoint.html">SFPoint</a> </li> <li class="nav-group-task"> <a href="../Classes/SFPointFiniteFilter.html">SFPointFiniteFilter</a> </li> <li class="nav-group-task"> <a href="../Classes/SFPolygon.html">SFPolygon</a> </li> <li class="nav-group-task"> <a href="../Classes/SFPolyhedralSurface.html">SFPolyhedralSurface</a> </li> <li class="nav-group-task"> <a href="../Classes/SFSegment.html">SFSegment</a> </li> <li class="nav-group-task"> <a href="../Classes/SFShamosHoey.html">SFShamosHoey</a> </li> <li class="nav-group-task"> <a href="../Classes/SFSurface.html">SFSurface</a> </li> <li class="nav-group-task"> <a href="../Classes/SFSweepLine.html">SFSweepLine</a> </li> <li class="nav-group-task"> <a href="../Classes/SFTIN.html">SFTIN</a> </li> <li class="nav-group-task"> <a href="../Classes/SFTextReader.html">SFTextReader</a> </li> <li class="nav-group-task"> <a href="../Classes/SFTriangle.html">SFTriangle</a> </li> <li class="nav-group-task"> <a href="../Classes/SFWBGeometryCodes.html">SFWBGeometryCodes</a> </li> <li class="nav-group-task"> <a href="../Classes/SFWBGeometryReader.html">SFWBGeometryReader</a> </li> <li class="nav-group-task"> <a href="../Classes/SFWBGeometryTypeInfo.html">SFWBGeometryTypeInfo</a> </li> <li class="nav-group-task"> <a href="../Classes/SFWBGeometryWriter.html">SFWBGeometryWriter</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFByteReader.html">TIFFByteReader</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFByteWriter.html">TIFFByteWriter</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)TIFFConstants">TIFFConstants</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)TIFFDeflateCompression">TIFFDeflateCompression</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFFieldTagTypes.html">TIFFFieldTagTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFFieldTypes.html">TIFFFieldTypes</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFFileDirectory.html">TIFFFileDirectory</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFFileDirectoryEntry.html">TIFFFileDirectoryEntry</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFIOUtils.html">TIFFIOUtils</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFImage.html">TIFFImage</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFImageWindow.html">TIFFImageWindow</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)TIFFLZWCompression">TIFFLZWCompression</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)TIFFPackbitsCompression">TIFFPackbitsCompression</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFPredictor.html">TIFFPredictor</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFRasters.html">TIFFRasters</a> </li> <li class="nav-group-task"> <a href="../Classes.html#/c:objc(cs)TIFFRawCompression">TIFFRawCompression</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFReader.html">TIFFReader</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFUnsupportedCompression.html">TIFFUnsupportedCompression</a> </li> <li class="nav-group-task"> <a href="../Classes/TIFFWriter.html">TIFFWriter</a> </li> </ul> </li> <li class="nav-group-name"> <a href="../Constants.html">Constants</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGUserColumn.h@AUTOINCREMENT_CONSTRAINT_ORDER">AUTOINCREMENT_CONSTRAINT_ORDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_AFT_NAME">CRS_AXIS_AFT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_AWAY_FROM_NAME">CRS_AXIS_AWAY_FROM_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_CLOCKWISE_NAME">CRS_AXIS_CLOCKWISE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_COLUMN_NEGATIVE_NAME">CRS_AXIS_COLUMN_NEGATIVE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_COLUMN_POSITIVE_NAME">CRS_AXIS_COLUMN_POSITIVE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_COUNTER_CLOCKWISE_NAME">CRS_AXIS_COUNTER_CLOCKWISE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_DISPLAY_DOWN_NAME">CRS_AXIS_DISPLAY_DOWN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_DISPLAY_LEFT_NAME">CRS_AXIS_DISPLAY_LEFT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_DISPLAY_RIGHT_NAME">CRS_AXIS_DISPLAY_RIGHT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_DISPLAY_UP_NAME">CRS_AXIS_DISPLAY_UP_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_DOWN_NAME">CRS_AXIS_DOWN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_EAST_NAME">CRS_AXIS_EAST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_EAST_NORTH_EAST_NAME">CRS_AXIS_EAST_NORTH_EAST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_EAST_SOUTH_EAST_NAME">CRS_AXIS_EAST_SOUTH_EAST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_FORWARD_NAME">CRS_AXIS_FORWARD_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_FUTURE_NAME">CRS_AXIS_FUTURE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_GEOCENTRIC_X_NAME">CRS_AXIS_GEOCENTRIC_X_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_GEOCENTRIC_Y_NAME">CRS_AXIS_GEOCENTRIC_Y_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_GEOCENTRIC_Z_NAME">CRS_AXIS_GEOCENTRIC_Z_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_NORTH_EAST_NAME">CRS_AXIS_NORTH_EAST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_NORTH_NAME">CRS_AXIS_NORTH_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_NORTH_NORTH_EAST_NAME">CRS_AXIS_NORTH_NORTH_EAST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_NORTH_NORTH_WEST_NAME">CRS_AXIS_NORTH_NORTH_WEST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_NORTH_WEST_NAME">CRS_AXIS_NORTH_WEST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_PAST_NAME">CRS_AXIS_PAST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_PORT_NAME">CRS_AXIS_PORT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_ROW_NEGATIVE_NAME">CRS_AXIS_ROW_NEGATIVE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_ROW_POSITIVE_NAME">CRS_AXIS_ROW_POSITIVE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_SOUTH_EAST_NAME">CRS_AXIS_SOUTH_EAST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_SOUTH_NAME">CRS_AXIS_SOUTH_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_SOUTH_SOUTH_EAST_NAME">CRS_AXIS_SOUTH_SOUTH_EAST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_SOUTH_SOUTH_WEST_NAME">CRS_AXIS_SOUTH_SOUTH_WEST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_SOUTH_WEST_NAME">CRS_AXIS_SOUTH_WEST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_STARBOARD_NAME">CRS_AXIS_STARBOARD_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_TOWARDS_NAME">CRS_AXIS_TOWARDS_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_UNSPECIFIED_NAME">CRS_AXIS_UNSPECIFIED_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_UP_NAME">CRS_AXIS_UP_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_WEST_NAME">CRS_AXIS_WEST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_WEST_NORTH_WEST_NAME">CRS_AXIS_WEST_NORTH_WEST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_AXIS_WEST_SOUTH_WEST_NAME">CRS_AXIS_WEST_SOUTH_WEST_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CATEGORY_CRS_NAME">CRS_CATEGORY_CRS_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CATEGORY_METADATA_NAME">CRS_CATEGORY_METADATA_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CATEGORY_OPERATION_NAME">CRS_CATEGORY_OPERATION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_AFFINE_NAME">CRS_CS_AFFINE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_CARTESIAN_NAME">CRS_CS_CARTESIAN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_CYLINDRICAL_NAME">CRS_CS_CYLINDRICAL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_ELLIPSOIDAL_NAME">CRS_CS_ELLIPSOIDAL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_LINEAR_NAME">CRS_CS_LINEAR_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_ORDINAL_NAME">CRS_CS_ORDINAL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_PARAMETRIC_NAME">CRS_CS_PARAMETRIC_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_POLAR_NAME">CRS_CS_POLAR_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_SPHERICAL_NAME">CRS_CS_SPHERICAL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_TEMPORAL_COUNT_NAME">CRS_CS_TEMPORAL_COUNT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_TEMPORAL_DATE_TIME_NAME">CRS_CS_TEMPORAL_DATE_TIME_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_TEMPORAL_MEASURE_NAME">CRS_CS_TEMPORAL_MEASURE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_CS_VERTICAL_NAME">CRS_CS_VERTICAL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_ELLIPSOID_OBLATE_NAME">CRS_ELLIPSOID_OBLATE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_ELLIPSOID_TRIAXIAL_NAME">CRS_ELLIPSOID_TRIAXIAL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_OPERATION_ABRIDGED_COORDINATE_TRANSFORMATION_NAME">CRS_OPERATION_ABRIDGED_COORDINATE_TRANSFORMATION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_OPERATION_COORDINATE_NAME">CRS_OPERATION_COORDINATE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_OPERATION_DERIVING_CONVERSION_NAME">CRS_OPERATION_DERIVING_CONVERSION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_OPERATION_MAP_PROJECTION_NAME">CRS_OPERATION_MAP_PROJECTION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_OPERATION_POINT_MOTION_NAME">CRS_OPERATION_POINT_MOTION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_AXIS_DOWN">CRS_PROJ_AXIS_DOWN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_AXIS_EAST">CRS_PROJ_AXIS_EAST</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_AXIS_NORTH">CRS_PROJ_AXIS_NORTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_AXIS_SOUTH">CRS_PROJ_AXIS_SOUTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_AXIS_UP">CRS_PROJ_AXIS_UP</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_AXIS_WEST">CRS_PROJ_AXIS_WEST</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_AXIS_WEST_SOUTH_UP">CRS_PROJ_AXIS_WEST_SOUTH_UP</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_AEA">CRS_PROJ_NAME_AEA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_CASS">CRS_PROJ_NAME_CASS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_CEA">CRS_PROJ_NAME_CEA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_EQC">CRS_PROJ_NAME_EQC</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_KROVAK">CRS_PROJ_NAME_KROVAK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_LAEA">CRS_PROJ_NAME_LAEA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_LCC">CRS_PROJ_NAME_LCC</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_LONGLAT">CRS_PROJ_NAME_LONGLAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_MERC">CRS_PROJ_NAME_MERC</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_NZMG">CRS_PROJ_NAME_NZMG</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_OMERC">CRS_PROJ_NAME_OMERC</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_POLY">CRS_PROJ_NAME_POLY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_SOMERC">CRS_PROJ_NAME_SOMERC</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_STERE">CRS_PROJ_NAME_STERE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_STEREA">CRS_PROJ_NAME_STEREA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_TMERC">CRS_PROJ_NAME_TMERC</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_NAME_UTM">CRS_PROJ_NAME_UTM</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_A">CRS_PROJ_PARAM_A</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_ALPHA">CRS_PROJ_PARAM_ALPHA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_AXIS">CRS_PROJ_PARAM_AXIS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_B">CRS_PROJ_PARAM_B</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_DATUM">CRS_PROJ_PARAM_DATUM</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_ELLPS">CRS_PROJ_PARAM_ELLPS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_GAMMA">CRS_PROJ_PARAM_GAMMA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_K_0">CRS_PROJ_PARAM_K_0</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_LAT_0">CRS_PROJ_PARAM_LAT_0</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_LAT_1">CRS_PROJ_PARAM_LAT_1</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_LAT_2">CRS_PROJ_PARAM_LAT_2</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_LAT_TS">CRS_PROJ_PARAM_LAT_TS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_LONC">CRS_PROJ_PARAM_LONC</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_LON_0">CRS_PROJ_PARAM_LON_0</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_NADGRIDS">CRS_PROJ_PARAM_NADGRIDS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_NO_DEFS">CRS_PROJ_PARAM_NO_DEFS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_NO_UOFF">CRS_PROJ_PARAM_NO_UOFF</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_PM">CRS_PROJ_PARAM_PM</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_PROJ">CRS_PROJ_PARAM_PROJ</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_SOUTH">CRS_PROJ_PARAM_SOUTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_TOWGS84">CRS_PROJ_PARAM_TOWGS84</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_TO_METER">CRS_PROJ_PARAM_TO_METER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_UNITS">CRS_PROJ_PARAM_UNITS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_WKTEXT">CRS_PROJ_PARAM_WKTEXT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_X_0">CRS_PROJ_PARAM_X_0</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_Y_0">CRS_PROJ_PARAM_Y_0</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PARAM_ZONE">CRS_PROJ_PARAM_ZONE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_PSEUDO_MERCATOR">CRS_PROJ_PSEUDO_MERCATOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_SWISS_OBLIQUE_MERCATOR">CRS_PROJ_SWISS_OBLIQUE_MERCATOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_SWISS_OBLIQUE_MERCATOR_COMPAT">CRS_PROJ_SWISS_OBLIQUE_MERCATOR_COMPAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_UNITS_DEGREE">CRS_PROJ_UNITS_DEGREE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_UNITS_FOOT">CRS_PROJ_UNITS_FOOT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_UNITS_METRE">CRS_PROJ_UNITS_METRE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_UNITS_US_SURVEY_FOOT">CRS_PROJ_UNITS_US_SURVEY_FOOT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_PROJ_UTM_ZONE">CRS_PROJ_UTM_ZONE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_BOUND_NAME">CRS_TYPE_BOUND_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_COMPOUND_NAME">CRS_TYPE_COMPOUND_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_CONCATENATED_OPERATION_NAME">CRS_TYPE_CONCATENATED_OPERATION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_COORDINATE_METADATA_NAME">CRS_TYPE_COORDINATE_METADATA_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_COORDINATE_OPERATION_NAME">CRS_TYPE_COORDINATE_OPERATION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_DERIVED_NAME">CRS_TYPE_DERIVED_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_ENGINEERING_NAME">CRS_TYPE_ENGINEERING_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_GEODETIC_NAME">CRS_TYPE_GEODETIC_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_GEOGRAPHIC_NAME">CRS_TYPE_GEOGRAPHIC_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_PARAMETRIC_NAME">CRS_TYPE_PARAMETRIC_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_POINT_MOTION_OPERATION_NAME">CRS_TYPE_POINT_MOTION_OPERATION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_PROJECTED_NAME">CRS_TYPE_PROJECTED_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_TEMPORAL_NAME">CRS_TYPE_TEMPORAL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_TYPE_VERTICAL_NAME">CRS_TYPE_VERTICAL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_ARC_MINUTE_NAME">CRS_UNITS_ARC_MINUTE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_ARC_SECOND_NAME">CRS_UNITS_ARC_SECOND_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_BIN_NAME">CRS_UNITS_BIN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_CALENDAR_MONTH_NAME">CRS_UNITS_CALENDAR_MONTH_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_CALENDAR_SECOND_NAME">CRS_UNITS_CALENDAR_SECOND_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_DAY_NAME">CRS_UNITS_DAY_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_DEGREE_NAME">CRS_UNITS_DEGREE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_FOOT_NAME">CRS_UNITS_FOOT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_GERMAN_LEGAL_METRE_NAME">CRS_UNITS_GERMAN_LEGAL_METRE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_GRAD_NAME">CRS_UNITS_GRAD_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_HECTOPASCAL_NAME">CRS_UNITS_HECTOPASCAL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_HOUR_NAME">CRS_UNITS_HOUR_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_KILOMETRE_NAME">CRS_UNITS_KILOMETRE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_METRE_NAME">CRS_UNITS_METRE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_MICROMETRE_NAME">CRS_UNITS_MICROMETRE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_MICRORADIAN_NAME">CRS_UNITS_MICRORADIAN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_MICROSECOND_NAME">CRS_UNITS_MICROSECOND_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_MILLIMETRE_NAME">CRS_UNITS_MILLIMETRE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_MILLIRADIAN_NAME">CRS_UNITS_MILLIRADIAN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_MILLISECOND_NAME">CRS_UNITS_MILLISECOND_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_MINUTE_NAME">CRS_UNITS_MINUTE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_PARTS_PER_MILLION_NAME">CRS_UNITS_PARTS_PER_MILLION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_PASCAL_NAME">CRS_UNITS_PASCAL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_RADIAN_NAME">CRS_UNITS_RADIAN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_SECOND_NAME">CRS_UNITS_SECOND_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_UNITY_NAME">CRS_UNITS_UNITY_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_US_SURVEY_FOOT_NAME">CRS_UNITS_US_SURVEY_FOOT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNITS_YEAR_NAME">CRS_UNITS_YEAR_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNIT_ANGLE_NAME">CRS_UNIT_ANGLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNIT_LENGTH_NAME">CRS_UNIT_LENGTH_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNIT_NAME">CRS_UNIT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNIT_PARAMETRIC_NAME">CRS_UNIT_PARAMETRIC_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNIT_SCALE_NAME">CRS_UNIT_SCALE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_UNIT_TIME_NAME">CRS_UNIT_TIME_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_AXIS_ABBREV_LEFT_DELIMITER">CRS_WKT_AXIS_ABBREV_LEFT_DELIMITER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_AXIS_ABBREV_RIGHT_DELIMITER">CRS_WKT_AXIS_ABBREV_RIGHT_DELIMITER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_AXIS_DIRECTION_OTHER">CRS_WKT_AXIS_DIRECTION_OTHER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_AXIS_NAME_LAT">CRS_WKT_AXIS_NAME_LAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_AXIS_NAME_LON">CRS_WKT_AXIS_NAME_LON</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_AXIS_NAME_X">CRS_WKT_AXIS_NAME_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_AXIS_NAME_Y">CRS_WKT_AXIS_NAME_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_AXIS_NAME_Z">CRS_WKT_AXIS_NAME_Z</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_DATUM_TYPE">CRS_WKT_DATUM_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_LEFT_DELIMITER">CRS_WKT_LEFT_DELIMITER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_LEFT_DELIMITER_COMPAT">CRS_WKT_LEFT_DELIMITER_COMPAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_RIGHT_DELIMITER">CRS_WKT_RIGHT_DELIMITER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_RIGHT_DELIMITER_COMPAT">CRS_WKT_RIGHT_DELIMITER_COMPAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@CRS_WKT_SEPARATOR">CRS_WKT_SEPARATOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGUserTable.h@DEFAULT_AUTOINCREMENT">DEFAULT_AUTOINCREMENT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGFeatureTiles.h@DEFAULT_BOUNDING_BOX_CACHE_SIZE">DEFAULT_BOUNDING_BOX_CACHE_SIZE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGFeatureCache.h@DEFAULT_FEATURE_CACHE_MAX_SIZE">DEFAULT_FEATURE_CACHE_MAX_SIZE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGIconCache.h@DEFAULT_ICON_CACHE_SIZE">DEFAULT_ICON_CACHE_SIZE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGFeatureTiles.h@DEFAULT_MAP_SHAPE_CACHE_SIZE">DEFAULT_MAP_SHAPE_CACHE_SIZE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGUserTable.h@DEFAULT_PK_NOT_NULL">DEFAULT_PK_NOT_NULL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:SFByteReader.h@DEFAULT_READ_BYTE_ORDER">DEFAULT_READ_BYTE_ORDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGUserColumn.h@DEFAULT_VALUE_CONSTRAINT_ORDER">DEFAULT_VALUE_CONSTRAINT_ORDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:SFByteWriter.h@DEFAULT_WRITE_BYTE_ORDER">DEFAULT_WRITE_BYTE_ORDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_APPLICATION_ID">GPKG_APPLICATION_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_BUNDLE_NAME">GPKG_BUNDLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDA_BICUBIC_NAME">GPKG_CDA_BICUBIC_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDA_BILINEAR_NAME">GPKG_CDA_BILINEAR_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDA_NEAREST_NEIGHBOR_NAME">GPKG_CDA_NEAREST_NEIGHBOR_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_DATATYPE">GPKG_CDGC_COLUMN_DATATYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_DATA_NULL">GPKG_CDGC_COLUMN_DATA_NULL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_FIELD_NAME">GPKG_CDGC_COLUMN_FIELD_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_GRID_CELL_ENCODING">GPKG_CDGC_COLUMN_GRID_CELL_ENCODING</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_ID">GPKG_CDGC_COLUMN_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_OFFSET">GPKG_CDGC_COLUMN_OFFSET</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_PK">GPKG_CDGC_COLUMN_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_PRECISION">GPKG_CDGC_COLUMN_PRECISION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_QUANTITY_DEFINITION">GPKG_CDGC_COLUMN_QUANTITY_DEFINITION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_SCALE">GPKG_CDGC_COLUMN_SCALE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_TILE_MATRIX_SET_NAME">GPKG_CDGC_COLUMN_TILE_MATRIX_SET_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_COLUMN_UOM">GPKG_CDGC_COLUMN_UOM</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGC_TABLE_NAME">GPKG_CDGC_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGT_COLUMN_ID">GPKG_CDGT_COLUMN_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGT_COLUMN_MAX">GPKG_CDGT_COLUMN_MAX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGT_COLUMN_MEAN">GPKG_CDGT_COLUMN_MEAN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGT_COLUMN_MIN">GPKG_CDGT_COLUMN_MIN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGT_COLUMN_OFFSET">GPKG_CDGT_COLUMN_OFFSET</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGT_COLUMN_PK">GPKG_CDGT_COLUMN_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGT_COLUMN_SCALE">GPKG_CDGT_COLUMN_SCALE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGT_COLUMN_STANDARD_DEVIATION">GPKG_CDGT_COLUMN_STANDARD_DEVIATION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGT_COLUMN_TABLE_ID">GPKG_CDGT_COLUMN_TABLE_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGT_COLUMN_TABLE_NAME">GPKG_CDGT_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDGT_TABLE_NAME">GPKG_CDGT_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDT_ATTRIBUTES_NAME">GPKG_CDT_ATTRIBUTES_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDT_FEATURES_NAME">GPKG_CDT_FEATURES_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CDT_TILES_NAME">GPKG_CDT_TILES_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CD_GRIDDED_COVERAGE">GPKG_CD_GRIDDED_COVERAGE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CF_JPEG_NAME">GPKG_CF_JPEG_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CF_NONE_NAME">GPKG_CF_NONE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CF_PNG_NAME">GPKG_CF_PNG_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CI_COLUMN_ID">GPKG_CI_COLUMN_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CI_COLUMN_PK">GPKG_CI_COLUMN_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CI_COLUMN_TABLE_NAME">GPKG_CI_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CI_TABLE_NAME">GPKG_CI_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CONSTRAINT">GPKG_CONSTRAINT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_COLUMN_DATA_TYPE">GPKG_CON_COLUMN_DATA_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_COLUMN_DESCRIPTION">GPKG_CON_COLUMN_DESCRIPTION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_COLUMN_IDENTIFIER">GPKG_CON_COLUMN_IDENTIFIER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_COLUMN_LAST_CHANGE">GPKG_CON_COLUMN_LAST_CHANGE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_COLUMN_MAX_X">GPKG_CON_COLUMN_MAX_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_COLUMN_MAX_Y">GPKG_CON_COLUMN_MAX_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_COLUMN_MIN_X">GPKG_CON_COLUMN_MIN_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_COLUMN_MIN_Y">GPKG_CON_COLUMN_MIN_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_COLUMN_PK">GPKG_CON_COLUMN_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_COLUMN_SRS_ID">GPKG_CON_COLUMN_SRS_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_COLUMN_TABLE_NAME">GPKG_CON_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CON_TABLE_NAME">GPKG_CON_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CRS_WKT_EXTENSION_NAME">GPKG_CRS_WKT_EXTENSION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CT_AUTOINCREMENT_NAME">GPKG_CT_AUTOINCREMENT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CT_CHECK_NAME">GPKG_CT_CHECK_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CT_COLLATE_NAME">GPKG_CT_COLLATE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CT_DEFAULT_NAME">GPKG_CT_DEFAULT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CT_FOREIGN_KEY_NAME">GPKG_CT_FOREIGN_KEY_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CT_NOT_NULL_NAME">GPKG_CT_NOT_NULL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CT_PRIMARY_KEY_NAME">GPKG_CT_PRIMARY_KEY_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_CT_UNIQUE_NAME">GPKG_CT_UNIQUE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCCT_ENUM_NAME">GPKG_DCCT_ENUM_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCCT_GLOB_NAME">GPKG_DCCT_GLOB_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCCT_RANGE_NAME">GPKG_DCCT_RANGE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCC_COLUMN_CONSTRAINT_NAME">GPKG_DCC_COLUMN_CONSTRAINT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCC_COLUMN_CONSTRAINT_TYPE">GPKG_DCC_COLUMN_CONSTRAINT_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCC_COLUMN_DESCRIPTION">GPKG_DCC_COLUMN_DESCRIPTION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCC_COLUMN_MAX">GPKG_DCC_COLUMN_MAX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCC_COLUMN_MAX_IS_INCLUSIVE">GPKG_DCC_COLUMN_MAX_IS_INCLUSIVE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCC_COLUMN_MIN">GPKG_DCC_COLUMN_MIN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCC_COLUMN_MIN_IS_INCLUSIVE">GPKG_DCC_COLUMN_MIN_IS_INCLUSIVE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCC_COLUMN_VALUE">GPKG_DCC_COLUMN_VALUE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCC_TABLE_NAME">GPKG_DCC_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCM_CONTENT_TYPE_NAME">GPKG_DCM_CONTENT_TYPE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCM_DATE_NAME">GPKG_DCM_DATE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCM_DESCRIPTION_NAME">GPKG_DCM_DESCRIPTION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCM_FORMAT_NAME">GPKG_DCM_FORMAT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCM_IDENTIFIER_NAME">GPKG_DCM_IDENTIFIER_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCM_ID_NAME">GPKG_DCM_ID_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCM_SOURCE_NAME">GPKG_DCM_SOURCE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DCM_TITLE_NAME">GPKG_DCM_TITLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DC_COLUMN_COLUMN_NAME">GPKG_DC_COLUMN_COLUMN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DC_COLUMN_CONSTRAINT_NAME">GPKG_DC_COLUMN_CONSTRAINT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DC_COLUMN_DESCRIPTION">GPKG_DC_COLUMN_DESCRIPTION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DC_COLUMN_MIME_TYPE">GPKG_DC_COLUMN_MIME_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DC_COLUMN_NAME">GPKG_DC_COLUMN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DC_COLUMN_PK1">GPKG_DC_COLUMN_PK1</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DC_COLUMN_PK2">GPKG_DC_COLUMN_PK2</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DC_COLUMN_TABLE_NAME">GPKG_DC_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DC_COLUMN_TITLE">GPKG_DC_COLUMN_TITLE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DC_TABLE_NAME">GPKG_DC_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DTU_DATETIME_FORMAT">GPKG_DTU_DATETIME_FORMAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DTU_DATETIME_FORMAT2">GPKG_DTU_DATETIME_FORMAT2</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DTU_DATE_FORMAT">GPKG_DTU_DATE_FORMAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DTU_DATE_FORMAT2">GPKG_DTU_DATE_FORMAT2</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DTU_FUNCTION_DATE">GPKG_DTU_FUNCTION_DATE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DTU_FUNCTION_DATETIME">GPKG_DTU_FUNCTION_DATETIME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DTU_FUNCTION_JULIANDAY">GPKG_DTU_FUNCTION_JULIANDAY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DTU_FUNCTION_STRFTIME">GPKG_DTU_FUNCTION_STRFTIME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DTU_FUNCTION_TIME">GPKG_DTU_FUNCTION_TIME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_BLOB_NAME">GPKG_DT_BLOB_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_BOOLEAN_NAME">GPKG_DT_BOOLEAN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_DATETIME_NAME">GPKG_DT_DATETIME_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_DATE_NAME">GPKG_DT_DATE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_DOUBLE_NAME">GPKG_DT_DOUBLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_FLOAT_NAME">GPKG_DT_FLOAT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_INTEGER_NAME">GPKG_DT_INTEGER_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_INT_NAME">GPKG_DT_INT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_MEDIUMINT_NAME">GPKG_DT_MEDIUMINT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_REAL_NAME">GPKG_DT_REAL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_SMALLINT_NAME">GPKG_DT_SMALLINT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_TEXT_NAME">GPKG_DT_TEXT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_DT_TINYINT_NAME">GPKG_DT_TINYINT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EARTH_RADIUS">GPKG_EARTH_RADIUS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ER_COLUMN_BASE_PRIMARY_COLUMN">GPKG_ER_COLUMN_BASE_PRIMARY_COLUMN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ER_COLUMN_BASE_TABLE_NAME">GPKG_ER_COLUMN_BASE_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ER_COLUMN_ID">GPKG_ER_COLUMN_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ER_COLUMN_MAPPING_TABLE_NAME">GPKG_ER_COLUMN_MAPPING_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ER_COLUMN_PK">GPKG_ER_COLUMN_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ER_COLUMN_RELATED_PRIMARY_COLUMN">GPKG_ER_COLUMN_RELATED_PRIMARY_COLUMN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ER_COLUMN_RELATED_TABLE_NAME">GPKG_ER_COLUMN_RELATED_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ER_COLUMN_RELATION_NAME">GPKG_ER_COLUMN_RELATION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ER_TABLE_NAME">GPKG_ER_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EST_READ_WRITE_NAME">GPKG_EST_READ_WRITE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EST_WRITE_ONLY_NAME">GPKG_EST_WRITE_ONLY_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENDED_EXTENSION">GPKG_EXTENDED_EXTENSION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION">GPKG_EXTENSION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION_AUTHOR">GPKG_EXTENSION_AUTHOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION_CONTENTS_ID_NAME_NO_AUTHOR">GPKG_EXTENSION_CONTENTS_ID_NAME_NO_AUTHOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION_FEATURE_STYLE_NAME_NO_AUTHOR">GPKG_EXTENSION_FEATURE_STYLE_NAME_NO_AUTHOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION_FEATURE_TILE_LINK_NAME_NO_AUTHOR">GPKG_EXTENSION_FEATURE_TILE_LINK_NAME_NO_AUTHOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION_GEOMETRY_INDEX_NAME_NO_AUTHOR">GPKG_EXTENSION_GEOMETRY_INDEX_NAME_NO_AUTHOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION_PROPERTIES_COLUMN_PROPERTY">GPKG_EXTENSION_PROPERTIES_COLUMN_PROPERTY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION_PROPERTIES_COLUMN_VALUE">GPKG_EXTENSION_PROPERTIES_COLUMN_VALUE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION_PROPERTIES_NAME_NO_AUTHOR">GPKG_EXTENSION_PROPERTIES_NAME_NO_AUTHOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION_PROPERTIES_TABLE_NAME">GPKG_EXTENSION_PROPERTIES_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION_RELATED_TABLES_NAME_NO_AUTHOR">GPKG_EXTENSION_RELATED_TABLES_NAME_NO_AUTHOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EXTENSION_TILE_SCALING_NAME_NO_AUTHOR">GPKG_EXTENSION_TILE_SCALING_NAME_NO_AUTHOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EX_COLUMN_COLUMN_NAME">GPKG_EX_COLUMN_COLUMN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EX_COLUMN_DEFINITION">GPKG_EX_COLUMN_DEFINITION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EX_COLUMN_EXTENSION_NAME">GPKG_EX_COLUMN_EXTENSION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EX_COLUMN_SCOPE">GPKG_EX_COLUMN_SCOPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EX_COLUMN_TABLE_NAME">GPKG_EX_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EX_EXTENSION_NAME_DIVIDER">GPKG_EX_EXTENSION_NAME_DIVIDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_EX_TABLE_NAME">GPKG_EX_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FIT_GEOPACKAGE_NAME">GPKG_FIT_GEOPACKAGE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FIT_METADATA_NAME">GPKG_FIT_METADATA_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FIT_NONE_NAME">GPKG_FIT_NONE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FIT_RTREE_NAME">GPKG_FIT_RTREE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FSE_TABLE_MAPPING_ICON">GPKG_FSE_TABLE_MAPPING_ICON</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FSE_TABLE_MAPPING_STYLE">GPKG_FSE_TABLE_MAPPING_STYLE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FSE_TABLE_MAPPING_TABLE_ICON">GPKG_FSE_TABLE_MAPPING_TABLE_ICON</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FSE_TABLE_MAPPING_TABLE_STYLE">GPKG_FSE_TABLE_MAPPING_TABLE_STYLE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FTL_COLUMN_FEATURE_TABLE_NAME">GPKG_FTL_COLUMN_FEATURE_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FTL_COLUMN_PK1">GPKG_FTL_COLUMN_PK1</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FTL_COLUMN_PK2">GPKG_FTL_COLUMN_PK2</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FTL_COLUMN_TILE_TABLE_NAME">GPKG_FTL_COLUMN_TILE_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_FTL_TABLE_NAME">GPKG_FTL_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GCDT_FLOAT_NAME">GPKG_GCDT_FLOAT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GCDT_INTEGER_NAME">GPKG_GCDT_INTEGER_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GCET_AREA_NAME">GPKG_GCET_AREA_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GCET_CENTER_NAME">GPKG_GCET_CENTER_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GCET_CORNER_NAME">GPKG_GCET_CORNER_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GC_COLUMN_COLUMN_NAME">GPKG_GC_COLUMN_COLUMN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GC_COLUMN_GEOMETRY_TYPE_NAME">GPKG_GC_COLUMN_GEOMETRY_TYPE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GC_COLUMN_M">GPKG_GC_COLUMN_M</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GC_COLUMN_PK1">GPKG_GC_COLUMN_PK1</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GC_COLUMN_PK2">GPKG_GC_COLUMN_PK2</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GC_COLUMN_SRS_ID">GPKG_GC_COLUMN_SRS_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GC_COLUMN_TABLE_NAME">GPKG_GC_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GC_COLUMN_Z">GPKG_GC_COLUMN_Z</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GC_TABLE_NAME">GPKG_GC_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GEOMETRY_EXTENSION_PREFIX">GPKG_GEOMETRY_EXTENSION_PREFIX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GEOMETRY_MAGIC_NUMBER">GPKG_GEOMETRY_MAGIC_NUMBER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GEOMETRY_VERSION_1">GPKG_GEOMETRY_VERSION_1</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_GEOM_ID">GPKG_GI_COLUMN_GEOM_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_MAX_M">GPKG_GI_COLUMN_MAX_M</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_MAX_X">GPKG_GI_COLUMN_MAX_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_MAX_Y">GPKG_GI_COLUMN_MAX_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_MAX_Z">GPKG_GI_COLUMN_MAX_Z</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_MIN_M">GPKG_GI_COLUMN_MIN_M</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_MIN_X">GPKG_GI_COLUMN_MIN_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_MIN_Y">GPKG_GI_COLUMN_MIN_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_MIN_Z">GPKG_GI_COLUMN_MIN_Z</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_PK1">GPKG_GI_COLUMN_PK1</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_PK2">GPKG_GI_COLUMN_PK2</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_COLUMN_TABLE_NAME">GPKG_GI_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GI_TABLE_NAME">GPKG_GI_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_GEOPACKAGE_ID">GPKG_GPGM_COLUMN_GEOPACKAGE_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_ID">GPKG_GPGM_COLUMN_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_MAX_M">GPKG_GPGM_COLUMN_MAX_M</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_MAX_X">GPKG_GPGM_COLUMN_MAX_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_MAX_Y">GPKG_GPGM_COLUMN_MAX_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_MAX_Z">GPKG_GPGM_COLUMN_MAX_Z</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_MIN_M">GPKG_GPGM_COLUMN_MIN_M</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_MIN_X">GPKG_GPGM_COLUMN_MIN_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_MIN_Y">GPKG_GPGM_COLUMN_MIN_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_MIN_Z">GPKG_GPGM_COLUMN_MIN_Z</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_PK1">GPKG_GPGM_COLUMN_PK1</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_PK2">GPKG_GPGM_COLUMN_PK2</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_PK3">GPKG_GPGM_COLUMN_PK3</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_COLUMN_TABLE_NAME">GPKG_GPGM_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPGM_TABLE_NAME">GPKG_GPGM_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPM_COLUMN_ID">GPKG_GPM_COLUMN_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPM_COLUMN_NAME">GPKG_GPM_COLUMN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPM_COLUMN_PATH">GPKG_GPM_COLUMN_PATH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPM_COLUMN_PK">GPKG_GPM_COLUMN_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPM_TABLE_NAME">GPKG_GPM_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPTM_COLUMN_GEOPACKAGE_ID">GPKG_GPTM_COLUMN_GEOPACKAGE_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPTM_COLUMN_LAST_INDEXED">GPKG_GPTM_COLUMN_LAST_INDEXED</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPTM_COLUMN_PK1">GPKG_GPTM_COLUMN_PK1</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPTM_COLUMN_PK2">GPKG_GPTM_COLUMN_PK2</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPTM_COLUMN_TABLE_NAME">GPKG_GPTM_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GPTM_TABLE_NAME">GPKG_GPTM_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_GRIDDED_COVERAGE_EXTENSION_NAME">GPKG_GRIDDED_COVERAGE_EXTENSION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_IT_COLUMN_ANCHOR_U">GPKG_IT_COLUMN_ANCHOR_U</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_IT_COLUMN_ANCHOR_V">GPKG_IT_COLUMN_ANCHOR_V</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_IT_COLUMN_DESCRIPTION">GPKG_IT_COLUMN_DESCRIPTION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_IT_COLUMN_HEIGHT">GPKG_IT_COLUMN_HEIGHT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_IT_COLUMN_NAME">GPKG_IT_COLUMN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_IT_COLUMN_WIDTH">GPKG_IT_COLUMN_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_IT_TABLE_NAME">GPKG_IT_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MEDIA_TYPE">GPKG_MEDIA_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_METADATA_APPLICATION_ID">GPKG_METADATA_APPLICATION_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_METADATA_EXTENSION_NAME">GPKG_METADATA_EXTENSION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_METADATA_TABLES">GPKG_METADATA_TABLES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MR_COLUMN_COLUMN_NAME">GPKG_MR_COLUMN_COLUMN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MR_COLUMN_FILE_ID">GPKG_MR_COLUMN_FILE_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MR_COLUMN_PARENT_ID">GPKG_MR_COLUMN_PARENT_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MR_COLUMN_REFERENCE_SCOPE">GPKG_MR_COLUMN_REFERENCE_SCOPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MR_COLUMN_ROW_ID_VALUE">GPKG_MR_COLUMN_ROW_ID_VALUE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MR_COLUMN_TABLE_NAME">GPKG_MR_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MR_COLUMN_TIMESTAMP">GPKG_MR_COLUMN_TIMESTAMP</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MR_TABLE_NAME">GPKG_MR_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_ATTRIBUTE_NAME">GPKG_MST_ATTRIBUTE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_ATTRIBUTE_TYPE_NAME">GPKG_MST_ATTRIBUTE_TYPE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_CATALOG_NAME">GPKG_MST_CATALOG_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_COLLECTION_HARDWARE_NAME">GPKG_MST_COLLECTION_HARDWARE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_COLLECTION_NAME">GPKG_MST_COLLECTION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_COLLECTION_SESSION_NAME">GPKG_MST_COLLECTION_SESSION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_DATASET_NAME">GPKG_MST_DATASET_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_DIMENSION_GROUP_NAME">GPKG_MST_DIMENSION_GROUP_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_FEATURE_NAME">GPKG_MST_FEATURE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_FEATURE_TYPE_NAME">GPKG_MST_FEATURE_TYPE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_FIELD_SESSION_NAME">GPKG_MST_FIELD_SESSION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_MODEL_NAME">GPKG_MST_MODEL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_MULTI_POINT_NAME">GPKG_MST_MULTI_POINT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_MULTI_POLYGON_NAME">GPKG_MST_MULTI_POLYGON_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_MULTI_POLYGON_POINTS_NAME">GPKG_MST_MULTI_POLYGON_POINTS_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_MULTI_POLYLINE_NAME">GPKG_MST_MULTI_POLYLINE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_MULTI_POLYLINE_POINTS_NAME">GPKG_MST_MULTI_POLYLINE_POINTS_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_NON_GEOGRAPHIC_DATASET_NAME">GPKG_MST_NON_GEOGRAPHIC_DATASET_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_POINT_NAME">GPKG_MST_POINT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_POLYGON_NAME">GPKG_MST_POLYGON_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_POLYGON_POINTS_NAME">GPKG_MST_POLYGON_POINTS_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_POLYLINE_NAME">GPKG_MST_POLYLINE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_POLYLINE_POINTS_NAME">GPKG_MST_POLYLINE_POINTS_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_SCHEMA_NAME">GPKG_MST_SCHEMA_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_SERIES_NAME">GPKG_MST_SERIES_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_SERVICE_NAME">GPKG_MST_SERVICE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_SOFTWARE_NAME">GPKG_MST_SOFTWARE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_STYLE_NAME">GPKG_MST_STYLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_TAXONOMY_NAME">GPKG_MST_TAXONOMY_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_TILE_NAME">GPKG_MST_TILE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_MST_UNDEFINED_NAME">GPKG_MST_UNDEFINED_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_M_COLUMN_ID">GPKG_M_COLUMN_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_M_COLUMN_METADATA">GPKG_M_COLUMN_METADATA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_M_COLUMN_MIME_TYPE">GPKG_M_COLUMN_MIME_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_M_COLUMN_PK">GPKG_M_COLUMN_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_M_COLUMN_SCOPE">GPKG_M_COLUMN_SCOPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_M_COLUMN_STANDARD_URI">GPKG_M_COLUMN_STANDARD_URI</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_M_TABLE_NAME">GPKG_M_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_NGA_EXTENSION_AUTHOR">GPKG_NGA_EXTENSION_AUTHOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_NGA_TABLES">GPKG_NGA_TABLES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_CONTRIBUTOR">GPKG_PE_CONTRIBUTOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_COVERAGE">GPKG_PE_COVERAGE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_CREATED">GPKG_PE_CREATED</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_CREATOR">GPKG_PE_CREATOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_DATE">GPKG_PE_DATE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_DESCRIPTION">GPKG_PE_DESCRIPTION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_IDENTIFIER">GPKG_PE_IDENTIFIER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_LICENSE">GPKG_PE_LICENSE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_MODIFIED">GPKG_PE_MODIFIED</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_PUBLISHER">GPKG_PE_PUBLISHER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_REFERENCES">GPKG_PE_REFERENCES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_RELATION">GPKG_PE_RELATION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_SOURCE">GPKG_PE_SOURCE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_SPATIAL">GPKG_PE_SPATIAL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_SUBJECT">GPKG_PE_SUBJECT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_TAG">GPKG_PE_TAG</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_TEMPORAL">GPKG_PE_TEMPORAL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_TITLE">GPKG_PE_TITLE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_TYPE">GPKG_PE_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_URI">GPKG_PE_URI</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_VALID">GPKG_PE_VALID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PE_VERSION">GPKG_PE_VERSION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROPERTY_LIST_TYPE">GPKG_PROPERTY_LIST_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_COLORS_ALPHA">GPKG_PROP_COLORS_ALPHA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_COLORS_BLUE">GPKG_PROP_COLORS_BLUE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_COLORS_GREEN">GPKG_PROP_COLORS_GREEN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_COLORS_RED">GPKG_PROP_COLORS_RED</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_COLORS_WHITE">GPKG_PROP_COLORS_WHITE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_CONNECTION_POOL">GPKG_PROP_CONNECTION_POOL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_CONNECTION_POOL_CHECK_CONNECTIONS">GPKG_PROP_CONNECTION_POOL_CHECK_CONNECTIONS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_CONNECTION_POOL_CHECK_CONNECTIONS_FREQUENCY">GPKG_PROP_CONNECTION_POOL_CHECK_CONNECTIONS_FREQUENCY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_CONNECTION_POOL_CHECK_CONNECTIONS_WARNING_TIME">GPKG_PROP_CONNECTION_POOL_CHECK_CONNECTIONS_WARNING_TIME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_CONNECTION_POOL_MAINTAIN_STACK_TRACES">GPKG_PROP_CONNECTION_POOL_MAINTAIN_STACK_TRACES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_CONNECTION_POOL_OPEN_CONNECTIONS_PER_POOL">GPKG_PROP_CONNECTION_POOL_OPEN_CONNECTIONS_PER_POOL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_CONTENTS_DATA_TYPE">GPKG_PROP_CONTENTS_DATA_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_DATETIME_FORMATS">GPKG_PROP_DATETIME_FORMATS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_DIR_DATABASE">GPKG_PROP_DIR_DATABASE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_DIR_GEOPACKAGE">GPKG_PROP_DIR_GEOPACKAGE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_DIR_METADATA">GPKG_PROP_DIR_METADATA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_DIR_METADATA_FILE_DB">GPKG_PROP_DIR_METADATA_FILE_DB</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_DIVIDER">GPKG_PROP_DIVIDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_EXTENSION_CONTENTS_ID_DEFINITION">GPKG_PROP_EXTENSION_CONTENTS_ID_DEFINITION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_EXTENSION_FEATURE_STYLE_DEFINITION">GPKG_PROP_EXTENSION_FEATURE_STYLE_DEFINITION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_EXTENSION_FEATURE_TILE_LINK_DEFINITION">GPKG_PROP_EXTENSION_FEATURE_TILE_LINK_DEFINITION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_EXTENSION_GEOMETRY_INDEX_DEFINITION">GPKG_PROP_EXTENSION_GEOMETRY_INDEX_DEFINITION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_EXTENSION_PROPERTIES_DEFINITION">GPKG_PROP_EXTENSION_PROPERTIES_DEFINITION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_EXTENSION_RELATED_TABLES_DEFINITION">GPKG_PROP_EXTENSION_RELATED_TABLES_DEFINITION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_EXTENSION_TILE_SCALING_DEFINITION">GPKG_PROP_EXTENSION_TILE_SCALING_DEFINITION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_GENERATOR">GPKG_PROP_FEATURE_GENERATOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_GENERATOR_DOWNLOAD_ATTEMPTS">GPKG_PROP_FEATURE_GENERATOR_DOWNLOAD_ATTEMPTS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_LINE_STROKE_WIDTH">GPKG_PROP_FEATURE_LINE_STROKE_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_OVERLAY_QUERY">GPKG_PROP_FEATURE_OVERLAY_QUERY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_POINT_RADIUS">GPKG_PROP_FEATURE_POINT_RADIUS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_POLYGON_FILL">GPKG_PROP_FEATURE_POLYGON_FILL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_POLYGON_STROKE_WIDTH">GPKG_PROP_FEATURE_POLYGON_STROKE_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_QUERY_DETAILED_INFO_PRINT_FEATURES">GPKG_PROP_FEATURE_QUERY_DETAILED_INFO_PRINT_FEATURES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_QUERY_DETAILED_INFO_PRINT_POINTS">GPKG_PROP_FEATURE_QUERY_DETAILED_INFO_PRINT_POINTS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_QUERY_FEATURES_INFO">GPKG_PROP_FEATURE_QUERY_FEATURES_INFO</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_QUERY_MAX_FEATURES_INFO">GPKG_PROP_FEATURE_QUERY_MAX_FEATURES_INFO</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_QUERY_MAX_FEATURE_DETAILED_INFO">GPKG_PROP_FEATURE_QUERY_MAX_FEATURE_DETAILED_INFO</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_QUERY_MAX_POINT_DETAILED_INFO">GPKG_PROP_FEATURE_QUERY_MAX_POINT_DETAILED_INFO</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_QUERY_SCREEN_CLICK_PERCENTAGE">GPKG_PROP_FEATURE_QUERY_SCREEN_CLICK_PERCENTAGE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_TILES">GPKG_PROP_FEATURE_TILES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_FEATURE_TILES_COMPRESS_FORMAT">GPKG_PROP_FEATURE_TILES_COMPRESS_FORMAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_MANAGER_VALIDATION">GPKG_PROP_MANAGER_VALIDATION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_MANAGER_VALIDATION_IMPORT_HEADER">GPKG_PROP_MANAGER_VALIDATION_IMPORT_HEADER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_MANAGER_VALIDATION_IMPORT_INTEGRITY">GPKG_PROP_MANAGER_VALIDATION_IMPORT_INTEGRITY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_MANAGER_VALIDATION_OPEN_HEADER">GPKG_PROP_MANAGER_VALIDATION_OPEN_HEADER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_MANAGER_VALIDATION_OPEN_INTEGRITY">GPKG_PROP_MANAGER_VALIDATION_OPEN_INTEGRITY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_MAX_ZOOM_LEVEL">GPKG_PROP_MAX_ZOOM_LEVEL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES">GPKG_PROP_NUMBER_FEATURE_TILES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_CIRCLE_COLOR">GPKG_PROP_NUMBER_FEATURE_TILES_CIRCLE_COLOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_CIRCLE_FILL_COLOR">GPKG_PROP_NUMBER_FEATURE_TILES_CIRCLE_FILL_COLOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_CIRCLE_PADDING_PERCENTAGE">GPKG_PROP_NUMBER_FEATURE_TILES_CIRCLE_PADDING_PERCENTAGE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_CIRCLE_STROKE_WIDTH">GPKG_PROP_NUMBER_FEATURE_TILES_CIRCLE_STROKE_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_DRAW_CIRCLE">GPKG_PROP_NUMBER_FEATURE_TILES_DRAW_CIRCLE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_DRAW_TILE_BORDER">GPKG_PROP_NUMBER_FEATURE_TILES_DRAW_TILE_BORDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_DRAW_UNINDEXED_TILES">GPKG_PROP_NUMBER_FEATURE_TILES_DRAW_UNINDEXED_TILES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_FILL_CIRCLE">GPKG_PROP_NUMBER_FEATURE_TILES_FILL_CIRCLE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_FILL_TILE">GPKG_PROP_NUMBER_FEATURE_TILES_FILL_TILE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_TEXT_COLOR">GPKG_PROP_NUMBER_FEATURE_TILES_TEXT_COLOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_TEXT_FONT">GPKG_PROP_NUMBER_FEATURE_TILES_TEXT_FONT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_TEXT_FONT_SIZE">GPKG_PROP_NUMBER_FEATURE_TILES_TEXT_FONT_SIZE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_TILE_BORDER_COLOR">GPKG_PROP_NUMBER_FEATURE_TILES_TILE_BORDER_COLOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_TILE_BORDER_STROKE_WIDTH">GPKG_PROP_NUMBER_FEATURE_TILES_TILE_BORDER_STROKE_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_TILE_FILL_COLOR">GPKG_PROP_NUMBER_FEATURE_TILES_TILE_FILL_COLOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_NUMBER_FEATURE_TILES_UNINDEXED_TEXT">GPKG_PROP_NUMBER_FEATURE_TILES_UNINDEXED_TEXT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_DEFINITION">GPKG_PROP_SRS_DEFINITION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_DEFINITION_12_063">GPKG_PROP_SRS_DEFINITION_12_063</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_DESCRIPTION">GPKG_PROP_SRS_DESCRIPTION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_ORGANIZATION">GPKG_PROP_SRS_ORGANIZATION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_ORGANIZATION_COORDSYS_ID">GPKG_PROP_SRS_ORGANIZATION_COORDSYS_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_SRS_ID">GPKG_PROP_SRS_SRS_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_SRS_NAME">GPKG_PROP_SRS_SRS_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_UNDEFINED_CARTESIAN">GPKG_PROP_SRS_UNDEFINED_CARTESIAN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_UNDEFINED_GEOGRAPHIC">GPKG_PROP_SRS_UNDEFINED_GEOGRAPHIC</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_WEB_MERCATOR">GPKG_PROP_SRS_WEB_MERCATOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_WGS_84">GPKG_PROP_SRS_WGS_84</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_SRS_WGS_84_3D">GPKG_PROP_SRS_WGS_84_3D</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_TILE_GENERATOR_VARIABLE">GPKG_PROP_TILE_GENERATOR_VARIABLE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_TILE_GENERATOR_VARIABLE_MAX_LAT">GPKG_PROP_TILE_GENERATOR_VARIABLE_MAX_LAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_TILE_GENERATOR_VARIABLE_MAX_LON">GPKG_PROP_TILE_GENERATOR_VARIABLE_MAX_LON</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_TILE_GENERATOR_VARIABLE_MIN_LAT">GPKG_PROP_TILE_GENERATOR_VARIABLE_MIN_LAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_TILE_GENERATOR_VARIABLE_MIN_LON">GPKG_PROP_TILE_GENERATOR_VARIABLE_MIN_LON</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_TILE_GENERATOR_VARIABLE_X">GPKG_PROP_TILE_GENERATOR_VARIABLE_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_TILE_GENERATOR_VARIABLE_Y">GPKG_PROP_TILE_GENERATOR_VARIABLE_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_PROP_TILE_GENERATOR_VARIABLE_Z">GPKG_PROP_TILE_GENERATOR_VARIABLE_Z</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RESOURCES_PROPERTIES">GPKG_RESOURCES_PROPERTIES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RESOURCES_TABLES">GPKG_RESOURCES_TABLES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RMT_COLUMN_CONTENT_TYPE">GPKG_RMT_COLUMN_CONTENT_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RMT_COLUMN_DATA">GPKG_RMT_COLUMN_DATA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RSAT_COLUMN_ID">GPKG_RSAT_COLUMN_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RST_COLUMN_NAME">GPKG_RST_COLUMN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RST_GEOPACKAGE_NAME">GPKG_RST_GEOPACKAGE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RST_ROW_COL_NAME">GPKG_RST_ROW_COL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RST_ROW_NAME">GPKG_RST_ROW_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RST_TABLE_NAME">GPKG_RST_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RTREE_INDEX_EXTENSION_COLUMN_ID">GPKG_RTREE_INDEX_EXTENSION_COLUMN_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RTREE_INDEX_EXTENSION_COLUMN_MAX_X">GPKG_RTREE_INDEX_EXTENSION_COLUMN_MAX_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RTREE_INDEX_EXTENSION_COLUMN_MAX_Y">GPKG_RTREE_INDEX_EXTENSION_COLUMN_MAX_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RTREE_INDEX_EXTENSION_COLUMN_MIN_X">GPKG_RTREE_INDEX_EXTENSION_COLUMN_MIN_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RTREE_INDEX_EXTENSION_COLUMN_MIN_Y">GPKG_RTREE_INDEX_EXTENSION_COLUMN_MIN_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RTREE_INDEX_EXTENSION_NAME">GPKG_RTREE_INDEX_EXTENSION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RTREE_INDEX_PREFIX">GPKG_RTREE_INDEX_PREFIX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RT_ATTRIBUTES_NAME">GPKG_RT_ATTRIBUTES_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RT_FEATURES_NAME">GPKG_RT_FEATURES_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RT_MEDIA_NAME">GPKG_RT_MEDIA_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RT_SIMPLE_ATTRIBUTES_NAME">GPKG_RT_SIMPLE_ATTRIBUTES_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_RT_TILES_NAME">GPKG_RT_TILES_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SCHEMA_EXTENSION_NAME">GPKG_SCHEMA_EXTENSION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SMC_NAME_NAME">GPKG_SMC_NAME_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SMC_ROOTPAGE_NAME">GPKG_SMC_ROOTPAGE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SMC_SQL_NAME">GPKG_SMC_SQL_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SMC_TBL_NAME_NAME">GPKG_SMC_TBL_NAME_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SMC_TYPE_NAME">GPKG_SMC_TYPE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SMT_COLUMN_GEOMETRY_TYPE_NAME">GPKG_SMT_COLUMN_GEOMETRY_TYPE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SMT_INDEX_NAME">GPKG_SMT_INDEX_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SMT_TABLE_NAME">GPKG_SMT_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SMT_TRIGGER_NAME">GPKG_SMT_TRIGGER_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SMT_VIEW_NAME">GPKG_SMT_VIEW_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SM_TABLE_NAME">GPKG_SM_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SQLITE_APPLICATION_ID">GPKG_SQLITE_APPLICATION_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SQLITE_HEADER_PREFIX">GPKG_SQLITE_HEADER_PREFIX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SRS_COLUMN_DEFINITION">GPKG_SRS_COLUMN_DEFINITION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SRS_COLUMN_DEFINITION_12_063">GPKG_SRS_COLUMN_DEFINITION_12_063</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SRS_COLUMN_DESCRIPTION">GPKG_SRS_COLUMN_DESCRIPTION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SRS_COLUMN_ORGANIZATION">GPKG_SRS_COLUMN_ORGANIZATION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SRS_COLUMN_ORGANIZATION_COORDSYS_ID">GPKG_SRS_COLUMN_ORGANIZATION_COORDSYS_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SRS_COLUMN_PK">GPKG_SRS_COLUMN_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SRS_COLUMN_SRS_ID">GPKG_SRS_COLUMN_SRS_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SRS_COLUMN_SRS_NAME">GPKG_SRS_COLUMN_SRS_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_SRS_TABLE_NAME">GPKG_SRS_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ST_COLUMN_COLOR">GPKG_ST_COLUMN_COLOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ST_COLUMN_DESCRIPTION">GPKG_ST_COLUMN_DESCRIPTION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ST_COLUMN_FILL_COLOR">GPKG_ST_COLUMN_FILL_COLOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ST_COLUMN_FILL_OPACITY">GPKG_ST_COLUMN_FILL_OPACITY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ST_COLUMN_ID">GPKG_ST_COLUMN_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ST_COLUMN_NAME">GPKG_ST_COLUMN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ST_COLUMN_OPACITY">GPKG_ST_COLUMN_OPACITY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ST_COLUMN_WIDTH">GPKG_ST_COLUMN_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ST_TABLE_NAME">GPKG_ST_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TC_COLUMN_ID">GPKG_TC_COLUMN_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TC_COLUMN_TILE_COLUMN">GPKG_TC_COLUMN_TILE_COLUMN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TC_COLUMN_TILE_DATA">GPKG_TC_COLUMN_TILE_DATA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TC_COLUMN_TILE_ROW">GPKG_TC_COLUMN_TILE_ROW</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TC_COLUMN_ZOOM_LEVEL">GPKG_TC_COLUMN_ZOOM_LEVEL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_CID">GPKG_TI_CID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_CID_INDEX">GPKG_TI_CID_INDEX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_COLUMN_LAST_INDEXED">GPKG_TI_COLUMN_LAST_INDEXED</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_COLUMN_PK">GPKG_TI_COLUMN_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_COLUMN_TABLE_NAME">GPKG_TI_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_DEFAULT_NULL">GPKG_TI_DEFAULT_NULL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_DFLT_VALUE">GPKG_TI_DFLT_VALUE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_DFLT_VALUE_INDEX">GPKG_TI_DFLT_VALUE_INDEX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_NAME">GPKG_TI_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_NAME_INDEX">GPKG_TI_NAME_INDEX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_NOT_NULL">GPKG_TI_NOT_NULL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_NOT_NULL_INDEX">GPKG_TI_NOT_NULL_INDEX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_PK">GPKG_TI_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_PK_INDEX">GPKG_TI_PK_INDEX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_TABLE_NAME">GPKG_TI_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_TYPE">GPKG_TI_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TI_TYPE_INDEX">GPKG_TI_TYPE_INDEX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TMS_COLUMN_MAX_X">GPKG_TMS_COLUMN_MAX_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TMS_COLUMN_MAX_Y">GPKG_TMS_COLUMN_MAX_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TMS_COLUMN_MIN_X">GPKG_TMS_COLUMN_MIN_X</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TMS_COLUMN_MIN_Y">GPKG_TMS_COLUMN_MIN_Y</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TMS_COLUMN_PK">GPKG_TMS_COLUMN_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TMS_COLUMN_SRS_ID">GPKG_TMS_COLUMN_SRS_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TMS_COLUMN_TABLE_NAME">GPKG_TMS_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TMS_TABLE_NAME">GPKG_TMS_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TM_COLUMN_MATRIX_HEIGHT">GPKG_TM_COLUMN_MATRIX_HEIGHT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TM_COLUMN_MATRIX_WIDTH">GPKG_TM_COLUMN_MATRIX_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TM_COLUMN_PIXEL_X_SIZE">GPKG_TM_COLUMN_PIXEL_X_SIZE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TM_COLUMN_PIXEL_Y_SIZE">GPKG_TM_COLUMN_PIXEL_Y_SIZE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TM_COLUMN_PK1">GPKG_TM_COLUMN_PK1</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TM_COLUMN_PK2">GPKG_TM_COLUMN_PK2</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TM_COLUMN_TABLE_NAME">GPKG_TM_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TM_COLUMN_TILE_HEIGHT">GPKG_TM_COLUMN_TILE_HEIGHT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TM_COLUMN_TILE_WIDTH">GPKG_TM_COLUMN_TILE_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TM_COLUMN_ZOOM_LEVEL">GPKG_TM_COLUMN_ZOOM_LEVEL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TM_TABLE_NAME">GPKG_TM_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TSC_CLOSEST_IN_OUT_NAME">GPKG_TSC_CLOSEST_IN_OUT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TSC_CLOSEST_OUT_IN_NAME">GPKG_TSC_CLOSEST_OUT_IN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TSC_IN_NAME">GPKG_TSC_IN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TSC_IN_OUT_NAME">GPKG_TSC_IN_OUT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TSC_OUT_IN_NAME">GPKG_TSC_OUT_IN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TSC_OUT_NAME">GPKG_TSC_OUT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TS_COLUMN_PK">GPKG_TS_COLUMN_PK</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TS_COLUMN_SCALING_TYPE">GPKG_TS_COLUMN_SCALING_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TS_COLUMN_TABLE_NAME">GPKG_TS_COLUMN_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TS_COLUMN_ZOOM_IN">GPKG_TS_COLUMN_ZOOM_IN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TS_COLUMN_ZOOM_OUT">GPKG_TS_COLUMN_ZOOM_OUT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TS_TABLE_NAME">GPKG_TS_TABLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TU_SCALE_FACTOR_DEFAULT">GPKG_TU_SCALE_FACTOR_DEFAULT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TU_TILE_DP">GPKG_TU_TILE_DP</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TU_TILE_PIXELS_DEFAULT">GPKG_TU_TILE_PIXELS_DEFAULT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_TU_TILE_PIXELS_HIGH">GPKG_TU_TILE_PIXELS_HIGH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_UMT_COLUMN_BASE_ID">GPKG_UMT_COLUMN_BASE_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_UMT_COLUMN_RELATED_ID">GPKG_UMT_COLUMN_RELATED_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_UNIQUE">GPKG_UNIQUE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_USER_VERSION">GPKG_USER_VERSION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_UTM_DEFAULT_ID_COLUMN_NAME">GPKG_UTM_DEFAULT_ID_COLUMN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_WEBP_EXTENSION_NAME">GPKG_WEBP_EXTENSION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@GPKG_ZOOM_OTHER_EXTENSION_NAME">GPKG_ZOOM_OTHER_EXTENSION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGUserColumn.h@NOT_NULL_CONSTRAINT_ORDER">NOT_NULL_CONSTRAINT_ORDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGUserColumn.h@NO_INDEX">NO_INDEX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_BBOX">OAF_BBOX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_COLLECTIONS">OAF_COLLECTIONS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_CRS">OAF_CRS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_CRS_BASE_URL">OAF_CRS_BASE_URL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_CRS_PATTERN">OAF_CRS_PATTERN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_CRS_PATTERN_AUTHORITY_GROUP">OAF_CRS_PATTERN_AUTHORITY_GROUP</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_CRS_PATTERN_CODE_GROUP">OAF_CRS_PATTERN_CODE_GROUP</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_CRS_PATTERN_VERSION_GROUP">OAF_CRS_PATTERN_VERSION_GROUP</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_DESCRIPTION">OAF_DESCRIPTION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_EXTENT">OAF_EXTENT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_HREF">OAF_HREF</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_HREFLANG">OAF_HREFLANG</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_ID">OAF_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_INTERVAL">OAF_INTERVAL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_ITEM_TYPE">OAF_ITEM_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_LENGTH">OAF_LENGTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_LIMIT_DEFAULT">OAF_LIMIT_DEFAULT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_LINKS">OAF_LINKS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_LINK_RELATION_NEXT">OAF_LINK_RELATION_NEXT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_NUMBER_MATCHED">OAF_NUMBER_MATCHED</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_NUMBER_RETURNED">OAF_NUMBER_RETURNED</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_REL">OAF_REL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_SPATIAL">OAF_SPATIAL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_TEMPORAL">OAF_TEMPORAL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_TIME_STAMP">OAF_TIME_STAMP</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_TITLE">OAF_TITLE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_TRS">OAF_TRS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@OAF_TYPE">OAF_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGUserColumn.h@PRIMARY_KEY_CONSTRAINT_ORDER">PRIMARY_KEY_CONSTRAINT_ORDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_AUTHORITY_EPSG">PROJ_AUTHORITY_EPSG</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_AUTHORITY_NONE">PROJ_AUTHORITY_NONE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_AUTHORITY_NSG">PROJ_AUTHORITY_NSG</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_AUTHORITY_OGC">PROJ_AUTHORITY_OGC</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_BUNDLE_NAME">PROJ_BUNDLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_EPSG_WEB_MERCATOR">PROJ_EPSG_WEB_MERCATOR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_EPSG_WORLD_GEODETIC_SYSTEM">PROJ_EPSG_WORLD_GEODETIC_SYSTEM</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D">PROJ_EPSG_WORLD_GEODETIC_SYSTEM_GEOGRAPHICAL_3D</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_MERCATOR_RADIUS">PROJ_MERCATOR_RADIUS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_OGC_CRS84">PROJ_OGC_CRS84</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_PROPERTIES">PROJ_PROPERTIES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_PROPERTY_LIST_TYPE">PROJ_PROPERTY_LIST_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_UNDEFINED_CARTESIAN">PROJ_UNDEFINED_CARTESIAN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_UNDEFINED_GEOGRAPHIC">PROJ_UNDEFINED_GEOGRAPHIC</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_WEB_MERCATOR_HALF_WORLD_WIDTH">PROJ_WEB_MERCATOR_HALF_WORLD_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_WEB_MERCATOR_MAX_LAT_RANGE">PROJ_WEB_MERCATOR_MAX_LAT_RANGE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_WEB_MERCATOR_MIN_LAT_RANGE">PROJ_WEB_MERCATOR_MIN_LAT_RANGE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_WGS84_HALF_WORLD_LAT_HEIGHT">PROJ_WGS84_HALF_WORLD_LAT_HEIGHT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@PROJ_WGS84_HALF_WORLD_LON_WIDTH">PROJ_WGS84_HALF_WORLD_LON_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SFG_MEMBER_BBOX">SFG_MEMBER_BBOX</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SFG_MEMBER_COORDINATES">SFG_MEMBER_COORDINATES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SFG_MEMBER_FEATURES">SFG_MEMBER_FEATURES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SFG_MEMBER_GEOMETRIES">SFG_MEMBER_GEOMETRIES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SFG_MEMBER_GEOMETRY">SFG_MEMBER_GEOMETRY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SFG_MEMBER_ID">SFG_MEMBER_ID</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SFG_MEMBER_PROPERTIES">SFG_MEMBER_PROPERTIES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SFG_MEMBER_TYPE">SFG_MEMBER_TYPE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SFG_TYPE_FEATURE">SFG_TYPE_FEATURE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SFG_TYPE_FEATURE_COLLECTION">SFG_TYPE_FEATURE_COLLECTION</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_BEARING_EAST">SF_BEARING_EAST</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_BEARING_NORTH">SF_BEARING_NORTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_BEARING_SOUTH">SF_BEARING_SOUTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_BEARING_WEST">SF_BEARING_WEST</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_CIRCULARSTRING_NAME">SF_CIRCULARSTRING_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_COMPOUNDCURVE_NAME">SF_COMPOUNDCURVE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_CURVEPOLYGON_NAME">SF_CURVEPOLYGON_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_CURVE_NAME">SF_CURVE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_DEFAULT_EQUAL_EPSILON">SF_DEFAULT_EQUAL_EPSILON</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_DEFAULT_LINE_EPSILON">SF_DEFAULT_LINE_EPSILON</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_DEGREES_TO_METERS_MIN_LAT">SF_DEGREES_TO_METERS_MIN_LAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_DEGREES_TO_RADIANS">SF_DEGREES_TO_RADIANS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_GEOMETRYCOLLECTION_NAME">SF_GEOMETRYCOLLECTION_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_GEOMETRY_NAME">SF_GEOMETRY_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_LINESTRING_NAME">SF_LINESTRING_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_MULTICURVE_NAME">SF_MULTICURVE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_MULTILINESTRING_NAME">SF_MULTILINESTRING_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_MULTIPOINT_NAME">SF_MULTIPOINT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_MULTIPOLYGON_NAME">SF_MULTIPOLYGON_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_MULTISURFACE_NAME">SF_MULTISURFACE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_NONE_NAME">SF_NONE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_POINT_NAME">SF_POINT_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_POLYGON_NAME">SF_POLYGON_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_POLYHEDRALSURFACE_NAME">SF_POLYHEDRALSURFACE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_RADIANS_TO_DEGREES">SF_RADIANS_TO_DEGREES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_SURFACE_NAME">SF_SURFACE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_TIN_NAME">SF_TIN_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_TRIANGLE_NAME">SF_TRIANGLE_NAME</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_WEB_MERCATOR_HALF_WORLD_WIDTH">SF_WEB_MERCATOR_HALF_WORLD_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_WEB_MERCATOR_MAX_LAT_RANGE">SF_WEB_MERCATOR_MAX_LAT_RANGE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_WEB_MERCATOR_MIN_LAT_RANGE">SF_WEB_MERCATOR_MIN_LAT_RANGE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_WGS84_HALF_WORLD_LAT_HEIGHT">SF_WGS84_HALF_WORLD_LAT_HEIGHT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@SF_WGS84_HALF_WORLD_LON_WIDTH">SF_WGS84_HALF_WORLD_LON_WIDTH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_BYTE_ORDER_BIG_ENDIAN">TIFF_BYTE_ORDER_BIG_ENDIAN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_BYTE_ORDER_LITTLE_ENDIAN">TIFF_BYTE_ORDER_LITTLE_ENDIAN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_COMPRESSION_CCITT_HUFFMAN">TIFF_COMPRESSION_CCITT_HUFFMAN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_COMPRESSION_DEFLATE">TIFF_COMPRESSION_DEFLATE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_COMPRESSION_JPEG_NEW">TIFF_COMPRESSION_JPEG_NEW</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_COMPRESSION_JPEG_OLD">TIFF_COMPRESSION_JPEG_OLD</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_COMPRESSION_LZW">TIFF_COMPRESSION_LZW</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_COMPRESSION_NO">TIFF_COMPRESSION_NO</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_COMPRESSION_PACKBITS">TIFF_COMPRESSION_PACKBITS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_COMPRESSION_PKZIP_DEFLATE">TIFF_COMPRESSION_PKZIP_DEFLATE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_COMPRESSION_T4">TIFF_COMPRESSION_T4</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_COMPRESSION_T6">TIFF_COMPRESSION_T6</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_DEFAULT_MAX_BYTES_PER_STRIP">TIFF_DEFAULT_MAX_BYTES_PER_STRIP</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_EXTRA_SAMPLES_ASSOCIATED_ALPHA">TIFF_EXTRA_SAMPLES_ASSOCIATED_ALPHA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_EXTRA_SAMPLES_UNASSOCIATED_ALPHA">TIFF_EXTRA_SAMPLES_UNASSOCIATED_ALPHA</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_EXTRA_SAMPLES_UNSPECIFIED">TIFF_EXTRA_SAMPLES_UNSPECIFIED</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_FILE_IDENTIFIER">TIFF_FILE_IDENTIFIER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_FILL_ORDER_LOWER_COLUMN_HIGHER_ORDER">TIFF_FILL_ORDER_LOWER_COLUMN_HIGHER_ORDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_FILL_ORDER_LOWER_COLUMN_LOWER_ORDER">TIFF_FILL_ORDER_LOWER_COLUMN_LOWER_ORDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_GRAY_RESPONSE_HUNDREDTHS">TIFF_GRAY_RESPONSE_HUNDREDTHS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_GRAY_RESPONSE_HUNDRED_THOUSANDTHS">TIFF_GRAY_RESPONSE_HUNDRED_THOUSANDTHS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_GRAY_RESPONSE_TENTHS">TIFF_GRAY_RESPONSE_TENTHS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_GRAY_RESPONSE_TEN_THOUSANDTHS">TIFF_GRAY_RESPONSE_TEN_THOUSANDTHS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_GRAY_RESPONSE_THOUSANDTHS">TIFF_GRAY_RESPONSE_THOUSANDTHS</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_HEADER_BYTES">TIFF_HEADER_BYTES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_IFD_ENTRY_BYTES">TIFF_IFD_ENTRY_BYTES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_IFD_HEADER_BYTES">TIFF_IFD_HEADER_BYTES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_IFD_OFFSET_BYTES">TIFF_IFD_OFFSET_BYTES</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_ORIENTATION_BOTTOM_ROW_LEFT_COLUMN">TIFF_ORIENTATION_BOTTOM_ROW_LEFT_COLUMN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_ORIENTATION_BOTTOM_ROW_RIGHT_COLUMN">TIFF_ORIENTATION_BOTTOM_ROW_RIGHT_COLUMN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_ORIENTATION_LEFT_ROW_BOTTOM_COLUMN">TIFF_ORIENTATION_LEFT_ROW_BOTTOM_COLUMN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_ORIENTATION_LEFT_ROW_TOP_COLUMN">TIFF_ORIENTATION_LEFT_ROW_TOP_COLUMN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_ORIENTATION_RIGHT_ROW_BOTTOM_COLUMN">TIFF_ORIENTATION_RIGHT_ROW_BOTTOM_COLUMN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_ORIENTATION_RIGHT_ROW_TOP_COLUMN">TIFF_ORIENTATION_RIGHT_ROW_TOP_COLUMN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_ORIENTATION_TOP_ROW_LEFT_COLUMN">TIFF_ORIENTATION_TOP_ROW_LEFT_COLUMN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_ORIENTATION_TOP_ROW_RIGHT_COLUMN">TIFF_ORIENTATION_TOP_ROW_RIGHT_COLUMN</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO">TIFF_PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_PHOTOMETRIC_INTERPRETATION_PALETTE">TIFF_PHOTOMETRIC_INTERPRETATION_PALETTE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_PHOTOMETRIC_INTERPRETATION_RGB">TIFF_PHOTOMETRIC_INTERPRETATION_RGB</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_PHOTOMETRIC_INTERPRETATION_TRANSPARENCY">TIFF_PHOTOMETRIC_INTERPRETATION_TRANSPARENCY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_PHOTOMETRIC_INTERPRETATION_WHITE_IS_ZERO">TIFF_PHOTOMETRIC_INTERPRETATION_WHITE_IS_ZERO</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_PLANAR_CONFIGURATION_CHUNKY">TIFF_PLANAR_CONFIGURATION_CHUNKY</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_PLANAR_CONFIGURATION_PLANAR">TIFF_PLANAR_CONFIGURATION_PLANAR</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_PREDICTOR_FLOATINGPOINT">TIFF_PREDICTOR_FLOATINGPOINT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_PREDICTOR_HORIZONTAL">TIFF_PREDICTOR_HORIZONTAL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_PREDICTOR_NO">TIFF_PREDICTOR_NO</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_RESOLUTION_UNIT_CENTIMETER">TIFF_RESOLUTION_UNIT_CENTIMETER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_RESOLUTION_UNIT_INCH">TIFF_RESOLUTION_UNIT_INCH</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_RESOLUTION_UNIT_NO">TIFF_RESOLUTION_UNIT_NO</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_SAMPLE_FORMAT_FLOAT">TIFF_SAMPLE_FORMAT_FLOAT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_SAMPLE_FORMAT_SIGNED_INT">TIFF_SAMPLE_FORMAT_SIGNED_INT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_SAMPLE_FORMAT_SINGLE_PAGE_MULTI_PAGE">TIFF_SAMPLE_FORMAT_SINGLE_PAGE_MULTI_PAGE</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_SAMPLE_FORMAT_UNDEFINED">TIFF_SAMPLE_FORMAT_UNDEFINED</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_SAMPLE_FORMAT_UNSIGNED_INT">TIFF_SAMPLE_FORMAT_UNSIGNED_INT</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_SUBFILE_TYPE_FULL">TIFF_SUBFILE_TYPE_FULL</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_SUBFILE_TYPE_REDUCED">TIFF_SUBFILE_TYPE_REDUCED</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_THRESHHOLDING_NO">TIFF_THRESHHOLDING_NO</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_THRESHHOLDING_ORDERED">TIFF_THRESHHOLDING_ORDERED</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@TIFF_THRESHHOLDING_RANDOM">TIFF_THRESHHOLDING_RANDOM</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGUserColumn.h@UNIQUE_CONSTRAINT_ORDER">UNIQUE_CONSTRAINT_ORDER</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@geopackage_iosVersionNumber">geopackage_iosVersionNumber</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@geopackage_iosVersionString">geopackage_iosVersionString</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:GPKGTileReprojection.h@pixelSizeDelta">pixelSizeDelta</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@pj_datums">pj_datums</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@pj_ellps">pj_ellps</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@pj_errno">pj_errno</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@pj_list">pj_list</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@pj_prime_meridians">pj_prime_meridians</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@pj_release">pj_release</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@pj_selftest_list">pj_selftest_list</a> </li> <li class="nav-group-task"> <a href="../Constants.html#/c:@pj_units">pj_units</a> </li> </ul> </li> <li class="nav-group-name"> <a href="../Enums.html">Enumerations</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Enums/CRSAxisDirectionType.html">CRSAxisDirectionType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSCategoryType.html">CRSCategoryType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSCoordinateSystemType.html">CRSCoordinateSystemType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSEllipsoidType.html">CRSEllipsoidType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSEllipsoidsType.html">CRSEllipsoidsType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSGeoDatumType.html">CRSGeoDatumType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSKeywordType.html">CRSKeywordType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSOperationMethodType.html">CRSOperationMethodType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSOperationParameterType.html">CRSOperationParameterType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSOperationType.html">CRSOperationType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSPrimeMeridianType.html">CRSPrimeMeridianType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSType.html">CRSType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSUnitType.html">CRSUnitType</a> </li> <li class="nav-group-task"> <a href="../Enums/CRSUnitsType.html">CRSUnitsType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGCompressFormat.html">GPKGCompressFormat</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGConstraintType.html">GPKGConstraintType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGContentsDataType.html">GPKGContentsDataType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGCoverageDataAlgorithm.html">GPKGCoverageDataAlgorithm</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGDataColumnConstraintType.html">GPKGDataColumnConstraintType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGDataType.html">GPKGDataType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGDublinCoreType.html">GPKGDublinCoreType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGExtensionScopeType.html">GPKGExtensionScopeType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGFeatureIndexType.html">GPKGFeatureIndexType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGGriddedCoverageDataType.html">GPKGGriddedCoverageDataType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGGriddedCoverageEncodingType.html">GPKGGriddedCoverageEncodingType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGMapShapeType.html">GPKGMapShapeType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGMetadataScopeType.html">GPKGMetadataScopeType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGPolygonOrientation.html">GPKGPolygonOrientation</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGReferenceScopeType.html">GPKGReferenceScopeType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGRelationType.html">GPKGRelationType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGSQLiteMasterColumn.html">GPKGSQLiteMasterColumn</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGSQLiteMasterType.html">GPKGSQLiteMasterType</a> </li> <li class="nav-group-task"> <a href="../Enums/GPKGTileScalingType.html">GPKGTileScalingType</a> </li> <li class="nav-group-task"> <a href="../Enums/PROJProjectionFactoryType.html">PROJProjectionFactoryType</a> </li> <li class="nav-group-task"> <a href="../Enums/PROJUnit.html">PROJUnit</a> </li> <li class="nav-group-task"> <a href="../Enums/SFEventType.html">SFEventType</a> </li> <li class="nav-group-task"> <a href="../Enums/SFFiniteFilterType.html">SFFiniteFilterType</a> </li> <li class="nav-group-task"> <a href="../Enums/SFGGeometryType.html">SFGGeometryType</a> </li> <li class="nav-group-task"> <a href="../Enums/SFGeometryType.html">SFGeometryType</a> </li> <li class="nav-group-task"> <a href="../Enums/TIFFFieldTagType.html">TIFFFieldTagType</a> </li> <li class="nav-group-task"> <a href="../Enums/TIFFFieldType.html">TIFFFieldType</a> </li> </ul> </li> <li class="nav-group-name"> <a href="../Protocols.html">Protocols</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Protocols/CRSCommonOperation.html">CRSCommonOperation</a> </li> <li class="nav-group-task"> <a href="../Protocols/CRSGeoDatum.html">CRSGeoDatum</a> </li> <li class="nav-group-task"> <a href="../Protocols/CRSIdentifiable.html">CRSIdentifiable</a> </li> <li class="nav-group-task"> <a href="../Protocols/CRSScopeExtentIdentifierRemark.html">CRSScopeExtentIdentifierRemark</a> </li> <li class="nav-group-task"> <a href="../Protocols/GPKGCoverageDataImage.html">GPKGCoverageDataImage</a> </li> <li class="nav-group-task"> <a href="../Protocols/GPKGCustomFeaturesTile.html">GPKGCustomFeaturesTile</a> </li> <li class="nav-group-task"> <a href="../Protocols/GPKGMapPointInitializer.html">GPKGMapPointInitializer</a> </li> <li class="nav-group-task"> <a href="../Protocols/GPKGProgress.html">GPKGProgress</a> </li> <li class="nav-group-task"> <a href="../Protocols/GPKGShapePoints.html">GPKGShapePoints</a> </li> <li class="nav-group-task"> <a href="../Protocols/GPKGShapeWithChildrenPoints.html">GPKGShapeWithChildrenPoints</a> </li> <li class="nav-group-task"> <a href="../Protocols/GPKGTileRetriever.html">GPKGTileRetriever</a> </li> <li class="nav-group-task"> <a href="../Protocols/SFGeometryFilter.html">SFGeometryFilter</a> </li> <li class="nav-group-task"> <a href="../Protocols/TIFFCompressionDecoder.html">TIFFCompressionDecoder</a> </li> <li class="nav-group-task"> <a href="../Protocols/TIFFCompressionEncoder.html">TIFFCompressionEncoder</a> </li> </ul> </li> <li class="nav-group-name"> <a href="../Type%20Definitions.html">Type Definitions</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Type%20Definitions/COMPLEX.html">COMPLEX</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/FLP.html">FLP</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/ILP.html">ILP</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions.html#/c:proj_api.h@T@PAFile">PAFile</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/PJ.html">PJ</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/PJ_GRIDINFO.html">PJ_GRIDINFO</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/PJ_GridCatalog.html">PJ_GridCatalog</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/PJ_GridCatalogEntry.html">PJ_GridCatalogEntry</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/PJ_Region.html">PJ_Region</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/PROJVALUE.html">PROJVALUE</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/Tseries.html">Tseries</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/paralist.html">paralist</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions.html#/c:proj_api.h@T@projCtx">projCtx</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/projCtx_t.html">projCtx_t</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/projFileAPI.html">projFileAPI</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions.html#/c:proj_api.h@T@projPJ">projPJ</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/projUV.html">projUV</a> </li> <li class="nav-group-task"> <a href="../Type%20Definitions/projUVW.html">projUVW</a> </li> </ul> </li> <li class="nav-group-name"> <a href="../Functions.html">Functions</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@aacos">aacos</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@aasin">aasin</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@aatan2">aatan2</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@adjlon">adjlon</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@asqrt">asqrt</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@bch2bps">bch2bps</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@bcheval">bcheval</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@bchgen">bchgen</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@biveval">biveval</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@bpseval">bpseval</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@dmstor">dmstor</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@dmstor_ctx">dmstor_ctx</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@freev2">freev2</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@hypot">hypot</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@mk_cheby">mk_cheby</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@nad_ctable2_init">nad_ctable2_init</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@nad_ctable2_load">nad_ctable2_load</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@nad_ctable_init">nad_ctable_init</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@nad_ctable_load">nad_ctable_load</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@nad_cvt">nad_cvt</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@nad_free">nad_free</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@nad_init">nad_init</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@nad_intr">nad_intr</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_acquire_lock">pj_acquire_lock</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_angular_units_set">pj_angular_units_set</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_apply_gridshift">pj_apply_gridshift</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_apply_gridshift_2">pj_apply_gridshift_2</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_apply_gridshift_3">pj_apply_gridshift_3</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_apply_vgridshift">pj_apply_vgridshift</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_atof">pj_atof</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_authlat">pj_authlat</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_authset">pj_authset</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_calloc">pj_calloc</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_cleanup_lock">pj_cleanup_lock</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_clear_initcache">pj_clear_initcache</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_clone_paralist">pj_clone_paralist</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_compare_datums">pj_compare_datums</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_alloc">pj_ctx_alloc</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_fclose">pj_ctx_fclose</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_fgets">pj_ctx_fgets</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_fopen">pj_ctx_fopen</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_fread">pj_ctx_fread</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_free">pj_ctx_free</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_fseek">pj_ctx_fseek</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_ftell">pj_ctx_ftell</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_get_app_data">pj_ctx_get_app_data</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_get_errno">pj_ctx_get_errno</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_get_fileapi">pj_ctx_get_fileapi</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_set_app_data">pj_ctx_set_app_data</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_set_debug">pj_ctx_set_debug</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_set_errno">pj_ctx_set_errno</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_set_fileapi">pj_ctx_set_fileapi</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ctx_set_logger">pj_ctx_set_logger</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_dalloc">pj_dalloc</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_datum_set">pj_datum_set</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_datum_transform">pj_datum_transform</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_dealloc">pj_dealloc</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_deallocate_grids">pj_deallocate_grids</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_deriv">pj_deriv</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_ell_set">pj_ell_set</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_enfn">pj_enfn</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_factors">pj_factors</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_free">pj_free</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_fwd">pj_fwd</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_fwd3d">pj_fwd3d</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gauss">pj_gauss</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gauss_ini">pj_gauss_ini</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gc_apply_gridshift">pj_gc_apply_gridshift</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gc_findcatalog">pj_gc_findcatalog</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gc_findgrid">pj_gc_findgrid</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gc_parsedate">pj_gc_parsedate</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gc_readcatalog">pj_gc_readcatalog</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gc_unloadall">pj_gc_unloadall</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_generic_selftest">pj_generic_selftest</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_geocentric_to_geodetic">pj_geocentric_to_geodetic</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_geodetic_to_geocentric">pj_geodetic_to_geocentric</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_ctx">pj_get_ctx</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_datums_ref">pj_get_datums_ref</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_def">pj_get_def</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_default_ctx">pj_get_default_ctx</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_default_fileapi">pj_get_default_fileapi</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_ellps_ref">pj_get_ellps_ref</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_errno_ref">pj_get_errno_ref</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_list_ref">pj_get_list_ref</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_prime_meridians_ref">pj_get_prime_meridians_ref</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_release">pj_get_release</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_selftest_list_ref">pj_get_selftest_list_ref</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_spheroid_defn">pj_get_spheroid_defn</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_get_units_ref">pj_get_units_ref</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gridinfo_free">pj_gridinfo_free</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gridinfo_init">pj_gridinfo_init</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gridinfo_load">pj_gridinfo_load</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_gridlist_from_nadgrids">pj_gridlist_from_nadgrids</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_init">pj_init</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_init_ctx">pj_init_ctx</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_init_plus">pj_init_plus</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_init_plus_ctx">pj_init_plus_ctx</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_insert_initcache">pj_insert_initcache</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_inv">pj_inv</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_inv3d">pj_inv3d</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_inv_gauss">pj_inv_gauss</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_inv_mlfn">pj_inv_mlfn</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_is_geocent">pj_is_geocent</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_is_latlong">pj_is_latlong</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_latlong_from_proj">pj_latlong_from_proj</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_log">pj_log</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_malloc">pj_malloc</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_mkparam">pj_mkparam</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_mlfn">pj_mlfn</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_msfn">pj_msfn</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_open_lib">pj_open_lib</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_param">pj_param</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_phi2">pj_phi2</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_pr_list">pj_pr_list</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_prepare">pj_prepare</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_prime_meridian_set">pj_prime_meridian_set</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_qsfn">pj_qsfn</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_qsfn_">pj_qsfn_</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_release_lock">pj_release_lock</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_run_selftests">pj_run_selftests</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_search_initcache">pj_search_initcache</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_set_ctx">pj_set_ctx</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_set_finder">pj_set_finder</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_set_searchpath">pj_set_searchpath</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_stderr_logger">pj_stderr_logger</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_strerrno">pj_strerrno</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_strtod">pj_strtod</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_transform">pj_transform</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_tsfn">pj_tsfn</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_zpoly1">pj_zpoly1</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@pj_zpolyd1">pj_zpolyd1</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@proj_inv_mdist">proj_inv_mdist</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@proj_mdist">proj_mdist</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@proj_mdist_ini">proj_mdist_ini</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@rtodms">rtodms</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@set_rtodms">set_rtodms</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@vector1">vector1</a> </li> <li class="nav-group-task"> <a href="../Functions.html#/c:@F@vector2">vector2</a> </li> </ul> </li> <li class="nav-group-name"> <a href="../Structs.html">Structures</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Structs/ARG_list.html">ARG_list</a> </li> <li class="nav-group-task"> <a href="../Structs/CTABLE.html">CTABLE</a> </li> <li class="nav-group-task"> <a href="../Structs/DERIVS.html">DERIVS</a> </li> <li class="nav-group-task"> <a href="../Structs/FACTORS.html">FACTORS</a> </li> <li class="nav-group-task"> <a href="../Structs/GPKGBoundingBoxSize.html">GPKGBoundingBoxSize</a> </li> <li class="nav-group-task"> <a href="../Structs/PJ_DATUMS.html">PJ_DATUMS</a> </li> <li class="nav-group-task"> <a href="../Structs/PJ_ELLPS.html">PJ_ELLPS</a> </li> <li class="nav-group-task"> <a href="../Structs/PJ_LIST.html">PJ_LIST</a> </li> <li class="nav-group-task"> <a href="../Structs/PJ_PRIME_MERIDIANS.html">PJ_PRIME_MERIDIANS</a> </li> <li class="nav-group-task"> <a href="../Structs/PJ_SELFTEST_LIST.html">PJ_SELFTEST_LIST</a> </li> <li class="nav-group-task"> <a href="../Structs/PJ_UNITS.html">PJ_UNITS</a> </li> <li class="nav-group-task"> <a href="../Structs/PJconsts.html">PJconsts</a> </li> <li class="nav-group-task"> <a href="../Structs/PW_COEF.html">PW_COEF</a> </li> <li class="nav-group-task"> <a href="../Structs/_PJ_GridCatalog.html">_PJ_GridCatalog</a> </li> <li class="nav-group-task"> <a href="../Structs/_pj_gi.html">_pj_gi</a> </li> <li class="nav-group-task"> <a href="../Structs/projFileAPI_t.html">projFileAPI_t</a> </li> </ul> </li> </ul> </nav> <article class="main-content"> <section> <section class="section"> <h1>GPKGTileTable</h1> <div class="declaration"> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">@interface</span> <span class="nc">GPKGTileTable</span> <span class="p">:</span> <span class="nc"><a href="../Classes/GPKGUserTable.html">GPKGUserTable</a></span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">class</span> <span class="kt">GPKGTileTable</span> <span class="p">:</span> <span class="kt"><a href="../Classes/GPKGUserTable.html">GPKGUserTable</a></span></code></pre> </div> </div> <p>Represents a user tile table</p> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L16-L138">Show on GitHub</a> </div> </section> <section class="section task-group-section"> <div class="task-group"> <ul> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(im)initWithTable:"></a> <a name="//apple_ref/objc/Method/-initWithTable:" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(im)initWithTable:">-initWithTable:<wbr></a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Initialize</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">instancetype</span><span class="p">)</span><span class="nf">initWithTable</span><span class="p">:(</span><span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">tableName</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="nf">init</span><span class="o">!</span><span class="p">(</span><span class="n">table</span> <span class="nv">tableName</span><span class="p">:</span> <span class="kt">String</span><span class="o">!</span><span class="p">)</span></code></pre> </div> </div> <div> <h4>Parameters</h4> <table class="graybox"> <tbody> <tr> <td> <code> <em>tableName</em> </code> </td> <td> <div> <p>table name</p> </div> </td> </tr> </tbody> </table> </div> <div> <h4>Return Value</h4> <p>new tile table</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L26">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(im)initWithTable:andColumns:"></a> <a name="//apple_ref/objc/Method/-initWithTable:andColumns:" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(im)initWithTable:andColumns:">-initWithTable:<wbr>andColumns:<wbr></a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Initialize</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">instancetype</span><span class="p">)</span><span class="nf">initWithTable</span><span class="p">:(</span><span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">tableName</span> <span class="nf">andColumns</span><span class="p">:(</span><span class="n">NSArray</span> <span class="o">*</span><span class="p">)</span><span class="nv">columns</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="nf">init</span><span class="o">!</span><span class="p">(</span><span class="n">table</span> <span class="nv">tableName</span><span class="p">:</span> <span class="kt">String</span><span class="o">!</span><span class="p">,</span> <span class="n">andColumns</span> <span class="nv">columns</span><span class="p">:</span> <span class="p">[</span><span class="kt">Any</span><span class="p">]</span><span class="o">!</span><span class="p">)</span></code></pre> </div> </div> <div> <h4>Parameters</h4> <table class="graybox"> <tbody> <tr> <td> <code> <em>tableName</em> </code> </td> <td> <div> <p>table name</p> </div> </td> </tr> <tr> <td> <code> <em>columns</em> </code> </td> <td> <div> <p>columns</p> </div> </td> </tr> </tbody> </table> </div> <div> <h4>Return Value</h4> <p>new tile table</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L36">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(im)zoomLevelIndex"></a> <a name="//apple_ref/objc/Method/-zoomLevelIndex" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(im)zoomLevelIndex">-zoomLevelIndex</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Get the zoom level column index</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">zoomLevelIndex</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">zoomLevelIndex</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">Int32</span></code></pre> </div> </div> <div> <h4>Return Value</h4> <p>zoom level index</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L43">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(im)zoomLevelColumn"></a> <a name="//apple_ref/objc/Method/-zoomLevelColumn" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(im)zoomLevelColumn">-zoomLevelColumn</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Get the zoom level column</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n"><a href="../Classes/GPKGTileColumn.html">GPKGTileColumn</a></span> <span class="o">*</span><span class="p">)</span><span class="n">zoomLevelColumn</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">zoomLevelColumn</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/GPKGTileColumn.html">GPKGTileColumn</a></span><span class="o">!</span></code></pre> </div> </div> <div> <h4>Return Value</h4> <p>zoom level tile column</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L50">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(im)tileColumnIndex"></a> <a name="//apple_ref/objc/Method/-tileColumnIndex" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(im)tileColumnIndex">-tileColumnIndex</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Get the tile column index</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">tileColumnIndex</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">tileColumnIndex</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">Int32</span></code></pre> </div> </div> <div> <h4>Return Value</h4> <p>tile column index</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L57">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(im)tileColumnColumn"></a> <a name="//apple_ref/objc/Method/-tileColumnColumn" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(im)tileColumnColumn">-tileColumnColumn</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Get the tile column column</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n"><a href="../Classes/GPKGTileColumn.html">GPKGTileColumn</a></span> <span class="o">*</span><span class="p">)</span><span class="n">tileColumnColumn</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">tileColumnColumn</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/GPKGTileColumn.html">GPKGTileColumn</a></span><span class="o">!</span></code></pre> </div> </div> <div> <h4>Return Value</h4> <p>tile column column</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L64">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(im)tileRowIndex"></a> <a name="//apple_ref/objc/Method/-tileRowIndex" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(im)tileRowIndex">-tileRowIndex</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Get the tile row index</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">tileRowIndex</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">tileRowIndex</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">Int32</span></code></pre> </div> </div> <div> <h4>Return Value</h4> <p>tile row index</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L71">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(im)tileRowColumn"></a> <a name="//apple_ref/objc/Method/-tileRowColumn" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(im)tileRowColumn">-tileRowColumn</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Get the tile row column</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n"><a href="../Classes/GPKGTileColumn.html">GPKGTileColumn</a></span> <span class="o">*</span><span class="p">)</span><span class="n">tileRowColumn</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">tileRowColumn</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/GPKGTileColumn.html">GPKGTileColumn</a></span><span class="o">!</span></code></pre> </div> </div> <div> <h4>Return Value</h4> <p>tile row column</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L78">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(im)tileDataIndex"></a> <a name="//apple_ref/objc/Method/-tileDataIndex" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(im)tileDataIndex">-tileDataIndex</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Get the tile data index</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">tileDataIndex</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">tileDataIndex</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">Int32</span></code></pre> </div> </div> <div> <h4>Return Value</h4> <p>tile data index</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L85">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(im)tileDataColumn"></a> <a name="//apple_ref/objc/Method/-tileDataColumn" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(im)tileDataColumn">-tileDataColumn</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Get the tile data column</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n"><a href="../Classes/GPKGTileColumn.html">GPKGTileColumn</a></span> <span class="o">*</span><span class="p">)</span><span class="n">tileDataColumn</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">tileDataColumn</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/GPKGTileColumn.html">GPKGTileColumn</a></span><span class="o">!</span></code></pre> </div> </div> <div> <h4>Return Value</h4> <p>tile data column</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L92">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(cm)createRequiredColumns"></a> <a name="//apple_ref/objc/Method/+createRequiredColumns" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(cm)createRequiredColumns">+createRequiredColumns</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Create the required table columns</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">+</span> <span class="p">(</span><span class="n">NSArray</span> <span class="o">*</span><span class="p">)</span><span class="n">createRequiredColumns</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">class</span> <span class="kd">func</span> <span class="nf">createRequiredColumns</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">Any</span><span class="p">]</span><span class="o">!</span></code></pre> </div> </div> <div> <h4>Return Value</h4> <p>columns</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L99">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(cm)createRequiredColumnsWithAutoincrement:"></a> <a name="//apple_ref/objc/Method/+createRequiredColumnsWithAutoincrement:" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(cm)createRequiredColumnsWithAutoincrement:">+createRequiredColumnsWithAutoincrement:<wbr></a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Create the required table columns</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">+</span> <span class="p">(</span><span class="n">NSArray</span> <span class="o">*</span><span class="p">)</span><span class="nf">createRequiredColumnsWithAutoincrement</span><span class="p">:(</span><span class="n">BOOL</span><span class="p">)</span><span class="nv">autoincrement</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">class</span> <span class="kd">func</span> <span class="nf">createRequiredColumns</span><span class="p">(</span><span class="n">withAutoincrement</span> <span class="nv">autoincrement</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">Any</span><span class="p">]</span><span class="o">!</span></code></pre> </div> </div> <div> <h4>Parameters</h4> <table class="graybox"> <tbody> <tr> <td> <code> <em>autoincrement</em> </code> </td> <td> <div> <p>autoincrement id values</p> </div> </td> </tr> </tbody> </table> </div> <div> <h4>Return Value</h4> <p>tile columns</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L109">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(cm)createRequiredColumnsWithStartingIndex:"></a> <a name="//apple_ref/objc/Method/+createRequiredColumnsWithStartingIndex:" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(cm)createRequiredColumnsWithStartingIndex:">+createRequiredColumnsWithStartingIndex:<wbr></a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Create the required table columns, starting at the provided index</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">+</span> <span class="p">(</span><span class="n">NSArray</span> <span class="o">*</span><span class="p">)</span><span class="nf">createRequiredColumnsWithStartingIndex</span><span class="p">:(</span><span class="kt">int</span><span class="p">)</span><span class="nv">startingIndex</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">class</span> <span class="kd">func</span> <span class="nf">createRequiredColumns</span><span class="p">(</span><span class="n">withStarting</span> <span class="nv">startingIndex</span><span class="p">:</span> <span class="kt">Int32</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">Any</span><span class="p">]</span><span class="o">!</span></code></pre> </div> </div> <div> <h4>Parameters</h4> <table class="graybox"> <tbody> <tr> <td> <code> <em>startingIndex</em> </code> </td> <td> <div> <p>starting column index</p> </div> </td> </tr> </tbody> </table> </div> <div> <h4>Return Value</h4> <p>columns</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L118">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(cm)createRequiredColumnsWithStartingIndex:andAutoincrement:"></a> <a name="//apple_ref/objc/Method/+createRequiredColumnsWithStartingIndex:andAutoincrement:" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(cm)createRequiredColumnsWithStartingIndex:andAutoincrement:">+createRequiredColumnsWithStartingIndex:<wbr>andAutoincrement:<wbr></a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Create the required table columns, starting at the provided index</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">+</span> <span class="p">(</span><span class="n">NSArray</span> <span class="o">*</span><span class="p">)</span><span class="nf">createRequiredColumnsWithStartingIndex</span><span class="p">:(</span><span class="kt">int</span><span class="p">)</span><span class="nv">startingIndex</span> <span class="nf">andAutoincrement</span><span class="p">:(</span><span class="n">BOOL</span><span class="p">)</span><span class="nv">autoincrement</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">class</span> <span class="kd">func</span> <span class="nf">createRequiredColumns</span><span class="p">(</span><span class="n">withStarting</span> <span class="nv">startingIndex</span><span class="p">:</span> <span class="kt">Int32</span><span class="p">,</span> <span class="n">andAutoincrement</span> <span class="nv">autoincrement</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">Any</span><span class="p">]</span><span class="o">!</span></code></pre> </div> </div> <div> <h4>Parameters</h4> <table class="graybox"> <tbody> <tr> <td> <code> <em>startingIndex</em> </code> </td> <td> <div> <p>starting index</p> </div> </td> </tr> <tr> <td> <code> <em>autoincrement</em> </code> </td> <td> <div> <p>autoincrement id values</p> </div> </td> </tr> </tbody> </table> </div> <div> <h4>Return Value</h4> <p>tile columns</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L129">Show on GitHub</a> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/c:objc(cs)GPKGTileTable(im)tileColumns"></a> <a name="//apple_ref/objc/Method/-tileColumns" class="dashAnchor"></a> <a class="token" href="#/c:objc(cs)GPKGTileTable(im)tileColumns">-tileColumns</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Get the tile columns</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Objective-C</p> <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n"><a href="../Classes/GPKGTileColumns.html">GPKGTileColumns</a></span> <span class="o">*</span><span class="p">)</span><span class="n">tileColumns</span><span class="p">;</span></code></pre> </div> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">tileColumns</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/GPKGTileColumns.html">GPKGTileColumns</a></span><span class="o">!</span></code></pre> </div> </div> <div> <h4>Return Value</h4> <p>columns</p> </div> <div class="slightly-smaller"> <a href="https://github.com/ngageoint/geopackage-ios/tree/7.3.0/geopackage-ios/tiles/user/GPKGTileTable.h#L136">Show on GitHub</a> </div> </section> </div> </li> </ul> </div> </section> </section> <section id="footer"> <p>&copy; 2022 <a class="link" href="https://www.nga.mil" target="_blank" rel="external noopener">NGA</a>. All rights reserved. (Last updated: 2022-09-08)</p> <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p> </section> </article> </div> </body> </html>
{ "content_hash": "d849d7391c7e2d93d4b3a7e343d619d2", "timestamp": "", "source": "github", "line_count": 5459, "max_line_length": 637, "avg_line_length": 52.40117237589302, "alnum_prop": 0.4880898279369918, "repo_name": "ngageoint/geopackage-ios", "id": "735af7931126ba9c51b61b87a3d83765d9c24cda", "size": "286062", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "docs/docs/api/Classes/GPKGTileTable.html", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "6395019" }, { "name": "Ruby", "bytes": "1469" }, { "name": "Swift", "bytes": "8139" } ], "symlink_target": "" }
package ez.dork.stock.domain; public class StockKey { /** * This field was generated by MyBatis Generator. This field corresponds to the database column stock.code * @mbggenerated Fri Dec 06 23:23:50 CST 2013 */ private String code; /** * This field was generated by MyBatis Generator. This field corresponds to the database column stock.date * @mbggenerated Fri Dec 06 23:23:50 CST 2013 */ private String date; /** * This method was generated by MyBatis Generator. This method returns the value of the database column stock.code * @return the value of stock.code * @mbggenerated Fri Dec 06 23:23:50 CST 2013 */ public String getCode() { return code; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column stock.code * @param code the value for stock.code * @mbggenerated Fri Dec 06 23:23:50 CST 2013 */ public void setCode(String code) { this.code = code; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column stock.date * @return the value of stock.date * @mbggenerated Fri Dec 06 23:23:50 CST 2013 */ public String getDate() { return date; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column stock.date * @param date the value for stock.date * @mbggenerated Fri Dec 06 23:23:50 CST 2013 */ public void setDate(String date) { this.date = date; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((code == null) ? 0 : code.hashCode()); result = prime * result + ((date == null) ? 0 : date.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; StockKey other = (StockKey) obj; if (code == null) { if (other.code != null) return false; } else if (!code.equals(other.code)) return false; if (date == null) { if (other.date != null) return false; } else if (!date.equals(other.date)) return false; return true; } @Override public String toString() { return "StockKey [code=" + code + ", date=" + date + "]"; } }
{ "content_hash": "2f084698019d98b098faf2025585d976", "timestamp": "", "source": "github", "line_count": 87, "max_line_length": 115, "avg_line_length": 26.551724137931036, "alnum_prop": 0.6666666666666666, "repo_name": "ezdork/a1-pom", "id": "6488feed58cad40d7b3824f8d29609647b2e02be", "size": "2310", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "a1-stock-server/src/main/java/ez/dork/stock/domain/StockKey.java", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Java", "bytes": "126487" }, { "name": "JavaScript", "bytes": "32458" } ], "symlink_target": "" }
""" ERP+ """ __author__ = 'António Anacleto' __credits__ = [] __version__ = "1.0" __maintainer__ = "António Anacleto" __status__ = "Development" __model_name__ = 'linha_anexo_cliente_dpr.LinhaAnexoClienteDPR' import auth, base_models from orm import * from form import * class LinhaAnexoClienteDPR(Model, View): def __init__(self, **kargs): Model.__init__(self, **kargs) self.__name__ = 'linha_anexo_cliente_dpr' self.__title__ = 'Linhas Anexo Cliente' self.__model_name__ = __model_name__ self.__list_edit_mode__ = 'inline' self.__get_options__ = ['designacao'] self.origem = string_field(view_order = 1, name = 'Origem',args = 'required, readonly', onlist=True) self.nif = string_field(view_order=2, name ='Nif Cliente', args = 'required, readonly', onlist=True) self.designacao = string_field(view_order=3, name ='Nome', size=45, args = 'required, readonly', onlist=True) self.tp_doc = string_field(view_order = 4, name = 'Tipo Doc',args = 'required, readonly', onlist=True) self.serie = string_field(view_order=5, name ='Serie.', args = 'required, readonly',size=20, onlist=True) self.num_doc = string_field(view_order=6, name ='Nº Doc.', onlist=True,args = 'required, readonly') self.dt_recibo = string_field(view_order=7, name ='Data Doc.', size=30, onlist=True,args = 'required, readonly') self.vl_recibo = string_field(view_order=8, name ='Valor', args = 'required, readonly', sum=True) self.tipologia = string_field(view_order=9, name ='Tipologia', args = 'required, readonly') self.tx_ret = string_field(view_order=10, name ='Taxa Retenção', args = 'required, readonly', size=20) self.ir_teu = string_field(view_order=11, name ='Valor Retido', args = 'required, readonly', size=20, sum=True) self.tp_oper = string_field(view_order=12, name ='Tipo Operação',args = 'required, readonly') self.anexo_cliente_dpr = parent_field(view_order = 13, name = 'Anexo Cliente DPR', hidden=True, model_name = 'anexo_cliente_dpr.AnexoClienteDPR',nolabel=True, onlist = False, column = 'id')
{ "content_hash": "77b0a085673cccbe048eef303e9c35b6", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 197, "avg_line_length": 45.59183673469388, "alnum_prop": 0.6186213070725156, "repo_name": "IdeaSolutionsOnline/ERP4R", "id": "1863c64de6e3c33c6090d527d6d86275821fcdff", "size": "2291", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "core/objs/linha_anexo_cliente_dpr.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "280709" }, { "name": "HTML", "bytes": "631043" }, { "name": "JavaScript", "bytes": "90675" }, { "name": "PHP", "bytes": "2199" }, { "name": "Python", "bytes": "1808337" }, { "name": "Smarty", "bytes": "523490" } ], "symlink_target": "" }
package com.glaf.ui.web.springmvc; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.glaf.core.base.TreeModel; import com.glaf.core.config.ViewProperties; import com.glaf.core.security.IdentityFactory; import com.glaf.core.security.LoginContext; import com.glaf.core.tree.helper.TreeHelper; import com.glaf.core.util.RequestUtils; import com.glaf.ui.model.Panel; import com.glaf.ui.model.PanelInstance; import com.glaf.ui.model.Skin; import com.glaf.ui.model.UserPanel; import com.glaf.ui.model.UserPortal; import com.glaf.ui.service.LayoutService; import com.glaf.ui.service.PanelService; import com.glaf.ui.service.SkinService; import com.glaf.ui.service.UserPortalService; @Controller("/console") @RequestMapping("/console") public class MxConsoleController { protected final static Log logger = LogFactory .getLog(MxConsoleController.class); protected SkinService skinService; protected PanelService panelService; protected LayoutService layoutService; protected UserPortalService userPortalService; @RequestMapping("/footer") public ModelAndView footer(ModelMap modelMap, HttpServletRequest request) { RequestUtils.setRequestParameterToAttribute(request); LoginContext loginContext = RequestUtils.getLoginContext(request); if (loginContext != null) { } String jx_view = request.getParameter("jx_view"); if (StringUtils.isNotEmpty(jx_view)) { return new ModelAndView(jx_view, modelMap); } String x_view = ViewProperties.getString("sys_console.footer"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/console/footer", modelMap); } @RequestMapping("/header") public ModelAndView header(ModelMap modelMap, HttpServletRequest request) { RequestUtils.setRequestParameterToAttribute(request); String jx_view = request.getParameter("jx_view"); if (StringUtils.isNotEmpty(jx_view)) { return new ModelAndView(jx_view, modelMap); } String x_view = ViewProperties.getString("sys_console.header"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/console/header", modelMap); } @javax.annotation.Resource public void setLayoutService(LayoutService layoutService) { this.layoutService = layoutService; } @javax.annotation.Resource public void setPanelService(PanelService panelService) { this.panelService = panelService; } @javax.annotation.Resource public void setSkinService(SkinService skinService) { this.skinService = skinService; } @javax.annotation.Resource public void setUserPortalService(UserPortalService userPortalService) { this.userPortalService = userPortalService; } @RequestMapping public ModelAndView main(ModelMap modelMap, HttpServletRequest request) { LoginContext loginContext = RequestUtils.getLoginContext(request); if (loginContext == null) { return new ModelAndView("/modules/login"); } RequestUtils.setRequestParameterToAttribute(request); String actorId = loginContext.getActorId(); Skin skin = skinService.getUserSkin(actorId); if (skin == null) { skin = skinService.getSkin("blue"); } String treeCode = request.getParameter("treeCode"); if (StringUtils.isEmpty(treeCode)) { if (loginContext.isSystemAdministrator()) { treeCode = "M_SYS"; } else { treeCode = "M_MY"; } } TreeModel root = IdentityFactory.getTreeModelByCode(treeCode); List<TreeModel> treeModels = IdentityFactory.getChildrenTreeModels(root .getId()); Collection<Long> roles = loginContext.getRoleIds(); List<Long> list = new java.util.ArrayList<Long>(); if (roles != null && !roles.isEmpty()) { for (Long r : roles) { list.add(r); } } UserPanel userPanel = panelService.getUserPanel(loginContext .getActorId()); if (userPanel == null) { userPanel = panelService.getUserPanel("system"); } Map<String, Integer> panelPxMap = new java.util.HashMap<String, Integer>(); Map<String, Integer> panelMap = new java.util.HashMap<String, Integer>(); if (userPanel != null && userPanel.getPanelInstances() != null) { String layoutName = userPanel.getLayoutName(); Set<PanelInstance> set = userPanel.getPanelInstances(); Iterator<PanelInstance> iter = set.iterator(); while (iter.hasNext()) { PanelInstance p = iter.next(); if (StringUtils.isNumeric(p.getName())) { int pos = Math.abs(Integer.parseInt(p.getName())); if (pos > 0) { panelPxMap.put(p.getPanelId(), pos); if ("P2".equals(layoutName)) { if (pos % 2 == 1) { panelMap.put(p.getPanelId(), 0); } else { panelMap.put(p.getPanelId(), 1); } } else if ("P3".equals(layoutName)) { if (pos % 3 == 1) { panelMap.put(p.getPanelId(), 0); } else if (pos % 3 == 2) { panelMap.put(p.getPanelId(), 1); } else if (pos % 3 == 0) { panelMap.put(p.getPanelId(), 2); } } else { panelMap.put(p.getPanelId(), 0); } } } } } List<UserPortal> userPortals = userPortalService .getUserPortals(loginContext.getActorId()); if (userPortals == null || userPortals.isEmpty()) { userPortals = userPortalService.getUserPortals("system"); if (userPortals == null || userPortals.isEmpty()) { List<Panel> panels = panelService.getPanels("system"); if (panels != null && !panels.isEmpty()) { int i = 100; for (Panel panel : panels) { UserPortal p = new UserPortal(); p.setActorId(loginContext.getActorId()); p.setPanelId(panel.getId()); if (panelMap.get(panel.getId()) != null) { p.setColumnIndex(panelMap.get(panel.getId())); } else { p.setColumnIndex(0); } if (panelPxMap.get(panel.getId()) != null) { p.setPosition(panelPxMap.get(panel.getId())); } else { p.setPosition(i++); } userPortals.add(p); } userPortalService.save(loginContext.getActorId(), userPortals); userPortals = userPortalService.getUserPortals(loginContext .getActorId()); } } } List<UserPortal> sysPortals = userPortalService .getUserPortals("system"); if (userPortals != null && !userPortals.isEmpty()) { if (sysPortals != null && !sysPortals.isEmpty()) { userPortals.addAll(sysPortals); } for (UserPortal p : userPortals) { String panelId = p.getPanelId(); p.setPanel(panelService.getPanel(panelId)); } } modelMap.put("userPanel", userPanel); modelMap.put("userPortals", userPortals); modelMap.put("root", root); modelMap.put("skin", skin); modelMap.put("treeNodes", treeModels); modelMap.put("treeModels", treeModels); logger.debug("#######################################################"); logger.debug("treeNodes:" + treeModels.size()); Collections.sort(treeModels); TreeHelper treeHelper = new TreeHelper(); JSONObject treeJson = treeHelper.getTreeJson(root, treeModels); modelMap.put("treeJson", treeJson); logger.debug(treeJson.toJSONString()); StringBuffer buffer = new StringBuffer(); String text = treeJson.getString("text"); if (text != null) { buffer.append("\n <li iconCls=\"icon-root\"><span>").append(text) .append("</span>"); JSONArray children = treeJson.getJSONArray("children"); if (children != null && !children.isEmpty()) { buffer.append("\n <ul>"); Iterator<Object> iterator = children.iterator(); while (iterator.hasNext()) { Object obj = iterator.next(); if (obj instanceof JSONObject) { JSONObject json = (JSONObject) obj; this.fill(json, buffer); } } buffer.append("\n </ul>"); } buffer.append("\n</li>"); } modelMap.put("json", buffer.toString()); logger.debug("#######################################"); logger.debug(loginContext.getRoleIds()); String jx_view = request.getParameter("jx_view"); if (StringUtils.isNotEmpty(jx_view)) { return new ModelAndView(jx_view, modelMap); } String x_view = ViewProperties.getString("sys_console.console"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/console/main", modelMap); } protected void fill(JSONObject jsonObject, StringBuffer buffer) { String text = jsonObject.getString("text"); if (text != null && jsonObject.getString("id") != null) { JSONArray children = jsonObject.getJSONArray("children"); if (children != null && !children.isEmpty()) { buffer.append("\n <li iconCls=\"icon-base\"><span>") .append(text).append("</span>"); buffer.append("\n <ul>"); Iterator<Object> iterator = children.iterator(); while (iterator.hasNext()) { Object obj = iterator.next(); if (obj instanceof JSONObject) { JSONObject json = (JSONObject) obj; this.fill(json, buffer); } } buffer.append("\n </ul>"); buffer.append("\n </li>"); } else { buffer.append("\n <li iconCls=\"icon-gears\"><a href=\"#\" ") .append(" onclick=\"openTabs('").append(text) .append("','").append(jsonObject.getString("id")) .append("');\">").append(text).append("</a>"); buffer.append("\n </li>"); } } } }
{ "content_hash": "3edacb77694f4f91ad961cb878a87961", "timestamp": "", "source": "github", "line_count": 331, "max_line_length": 77, "avg_line_length": 29.68580060422961, "alnum_prop": 0.6784042336657846, "repo_name": "jior/glaf", "id": "30110541677491dd6b2fe324e68760a0e8bfc2dc", "size": "10631", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "workspace/glaf-ui/src/main/java/com/glaf/ui/web/springmvc/MxConsoleController.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "953184" }, { "name": "HTML", "bytes": "101839" }, { "name": "Java", "bytes": "15039259" }, { "name": "JavaScript", "bytes": "1698821" }, { "name": "Perl", "bytes": "19688" }, { "name": "Python", "bytes": "6598" }, { "name": "Shell", "bytes": "173092" }, { "name": "XSLT", "bytes": "225698" } ], "symlink_target": "" }
#include "frequentlychangedmodel.h" FrequentlyChangedModel::FrequentlyChangedModel(QObject *parent) : FileListModel(parent) { readData("FrequentlyChanged"); }
{ "content_hash": "25f93a19de5a4d0e67f8556ccf2ac306", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 63, "avg_line_length": 18.88888888888889, "alnum_prop": 0.7705882352941177, "repo_name": "yatsek/silk", "id": "41a759e207f68c6cbecc7ac3077300b50997a49e", "size": "1718", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "demos/carpet/src/imports/Carpet/frequentlychangedmodel.cpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "1653" }, { "name": "C++", "bytes": "433092" }, { "name": "JavaScript", "bytes": "85530" }, { "name": "QML", "bytes": "881131" }, { "name": "QMake", "bytes": "24738" }, { "name": "Ruby", "bytes": "1747" } ], "symlink_target": "" }
module Presto class App # initializing new App # # app = Presto::App.new def initialize @partitions = Array.new end # mounting a namespace into a given root and optionally configure mounted partition. # nodes under given namespace will use here setup beside own internal setup. # @example # app = Presto::App.new # app.mount SomeNamespace do |partition| # # locking all nodes # partition.http.auth {|u,p| [u,p] == ['admin', 'ssp']} # # middleware to be used by all nodes # partition.http.use SomeMiddleware, 'with', 'some' => 'args' # # defining view root for all nodes # partition.view.root '/some/path' # # etc # end # # @param [Class, Module] namespace containing an arbitrary number of Presto nodes. # @param [String, Symbol] root on which the namespace will be mounted, defaulted to / if no path given. # @param [Proc] proc used to config mounted partition def mount namespace, root = nil, &proc @partitions << Presto::Partition.new(namespace, root, &proc) end def map if @partitions.size == 0 # if no partitions mounted, mounting all nodes that included Presto::Api @partitions = Presto.nodes.map { |n| n.node.partition } end # mounting singleton nodes Presto.singleton_nodes.each { |n| @partitions << n.node.partition } partitions, presto_middleware = @partitions.compact.uniq, Presto.middleware || Array.new if partitions.size == 0 puts puts '*'*50 puts ' ... No partitions nor nodes mounted, exiting ...' puts '*'*50 puts exit 1 end ::Rack::Builder.new do |builder| partitions.each do |partition| partition.nodes.select { |n| n.node.mounted? }.each do |node| node.node.map.each_pair do |action, map| map[:routes].each do |route| builder.map route do # middleware used by all nodes, unconditionally presto_middleware.each do |m| use m[:ware], *m[:args], &m[:block] end # middleware used by all partition's nodes node.node.partition.http.middleware.each do |m| use m[:ware], *m[:args], &m[:block] end # middleware used only by current node node.http.middleware.each do |m| use m[:ware], *m[:args], &m[:block] end run Presto::HTTP::Response.new(node, action) end end end end end end end # output the map of current app def show_map map if @partitions.size == 0 @partitions.each do |partition| partition.nodes.reject { |n| n.node.map.nil? }.each do |node| puts puts node node.node.map.each_pair do |action, map| puts ' - ' + action.to_s map[:routes].each { |r| puts "\t" + r } end end end end end end
{ "content_hash": "91ba8424a6e8f61ccd73b2a3df531a03", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 107, "avg_line_length": 31.435643564356436, "alnum_prop": 0.5464566929133858, "repo_name": "libin/presto", "id": "56f81ca60b621ab8723175b29ed0c50575404a88", "size": "3175", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/presto/app.rb", "mode": "33261", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package io; import genomicregions.CNV; import genomicregions.GenomicElement; import genomicregions.GenomicSet; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import org.apache.commons.lang3.StringUtils; import phenotypeontology.PhenotypeData; /** * Writes to tab separated output file. * * @author Jonas Ibn-Salem <[email protected]> * @param <T> Type parameter can be {@link GenomicElement} or a subclass of it like {@link CNV}. */ public class TabFileWriter<T extends GenomicElement> { /** Path to the output file */ private final Path path; // define charset for nio.Files.write function private final Charset charset = Charset.forName("utf-8"); /** * Construct a {@link TabFileWriter} object. * * @param outFile output file */ public TabFileWriter(File outFile){ this.path = outFile.toPath(); } /** * Construct a {@link TabFileWriter} object. * * @param path path to output file */ public TabFileWriter(String path){ this.path = Paths.get(path); } /** * * @param elements * @throws IOException */ public void write(GenomicSet<T> elements) throws IOException{ // convert elements to list of output lines List lines = new ArrayList<String>(); String headerLine = T.getOutputHeaderLine(); /* Construct header line. Note, that the function getOutputHeaderLine is a static memberfunction that is however specidfic for the type T (GenomicElement or one of its subclasses) */ // if (elements.isEmpty()){ // // if element set is empty, take generic header of a sample GenomicElement // headerLine = new GenomicElement("chrTmp", 0, 1, "tmp").getOutputHeaderLine(); // }else{ // T anyElement = elements.get(elements.keySet().toArray()[0]); // headerLine = anyElement.getOutputHeaderLine(); // } // add header to output lines: lines.add(headerLine); // iterate over each element and add a line for it to the output lines for ( T e : elements.values() ){ // call the memberfunction toOutputLine to convert each element to // one output line in the appropriate format. lines.add(e.toOutputLine()); } // wirte output lines to output file java.nio.file.Files.write(path, lines, charset); } /** * writes a collection of string as lines to the output file. * @param lines * @throws IOException */ public void writeLines(Collection<? extends String> lines) throws IOException{ // write all lines to the output file. java.nio.file.Files.write(path, lines, charset); } }
{ "content_hash": "a96761a8e7e5d8017d13290fdda68015", "timestamp": "", "source": "github", "line_count": 113, "max_line_length": 96, "avg_line_length": 29.256637168141594, "alnum_prop": 0.6228070175438597, "repo_name": "ibn-salem/position_effect", "id": "1cc2783b612d3787fb8c4168e6042e6fbe74f137", "size": "3306", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "phenomatch.core/src/main/java/io/TabFileWriter.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "211455" }, { "name": "Perl", "bytes": "14465" }, { "name": "R", "bytes": "5608" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.6.0_18) on Thu Dec 18 17:18:40 PST 2014 --> <title>Uses of Class javax.swing.DefaultRowSorter.ModelWrapper (Java Platform SE 7 )</title> <meta name="date" content="2014-12-18"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class javax.swing.DefaultRowSorter.ModelWrapper (Java Platform SE 7 )"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../javax/swing/DefaultRowSorter.ModelWrapper.html" title="class in javax.swing">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-files/index-1.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><em><strong>Java&trade;&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;7</strong></em></div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../index.html?javax/swing/class-use/DefaultRowSorter.ModelWrapper.html" target="_top">Frames</a></li> <li><a href="DefaultRowSorter.ModelWrapper.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class javax.swing.DefaultRowSorter.ModelWrapper" class="title">Uses of Class<br>javax.swing.DefaultRowSorter.ModelWrapper</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../javax/swing/DefaultRowSorter.ModelWrapper.html" title="class in javax.swing">DefaultRowSorter.ModelWrapper</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#javax.swing">javax.swing</a></td> <td class="colLast"> <div class="block">Provides a set of &quot;lightweight&quot; (all-Java language) components that, to the maximum degree possible, work the same on all platforms.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="javax.swing"> <!-- --> </a> <h3>Uses of <a href="../../../javax/swing/DefaultRowSorter.ModelWrapper.html" title="class in javax.swing">DefaultRowSorter.ModelWrapper</a> in <a href="../../../javax/swing/package-summary.html">javax.swing</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../javax/swing/package-summary.html">javax.swing</a> that return <a href="../../../javax/swing/DefaultRowSorter.ModelWrapper.html" title="class in javax.swing">DefaultRowSorter.ModelWrapper</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>protected <a href="../../../javax/swing/DefaultRowSorter.ModelWrapper.html" title="class in javax.swing">DefaultRowSorter.ModelWrapper</a>&lt;<a href="../../../javax/swing/DefaultRowSorter.html" title="type parameter in DefaultRowSorter">M</a>,<a href="../../../javax/swing/DefaultRowSorter.html" title="type parameter in DefaultRowSorter">I</a>&gt;</code></td> <td class="colLast"><span class="strong">DefaultRowSorter.</span><code><strong><a href="../../../javax/swing/DefaultRowSorter.html#getModelWrapper()">getModelWrapper</a></strong>()</code> <div class="block">Returns the model wrapper providing the data that is being sorted and filtered.</div> </td> </tr> </tbody> </table> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../javax/swing/package-summary.html">javax.swing</a> with parameters of type <a href="../../../javax/swing/DefaultRowSorter.ModelWrapper.html" title="class in javax.swing">DefaultRowSorter.ModelWrapper</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>protected void</code></td> <td class="colLast"><span class="strong">DefaultRowSorter.</span><code><strong><a href="../../../javax/swing/DefaultRowSorter.html#setModelWrapper(javax.swing.DefaultRowSorter.ModelWrapper)">setModelWrapper</a></strong>(<a href="../../../javax/swing/DefaultRowSorter.ModelWrapper.html" title="class in javax.swing">DefaultRowSorter.ModelWrapper</a>&lt;<a href="../../../javax/swing/DefaultRowSorter.html" title="type parameter in DefaultRowSorter">M</a>,<a href="../../../javax/swing/DefaultRowSorter.html" title="type parameter in DefaultRowSorter">I</a>&gt;&nbsp;modelWrapper)</code> <div class="block">Sets the model wrapper providing the data that is being sorted and filtered.</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../javax/swing/DefaultRowSorter.ModelWrapper.html" title="class in javax.swing">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-files/index-1.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><em><strong>Java&trade;&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;7</strong></em></div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../index.html?javax/swing/class-use/DefaultRowSorter.ModelWrapper.html" target="_top">Frames</a></li> <li><a href="DefaultRowSorter.ModelWrapper.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small><font size="-1"> <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a> <br>For further API reference and developer documentation, see <a href="http://docs.oracle.com/javase/7/docs/index.html" target="_blank">Java SE Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> <a href="../../../../legal/cpyr.html">Copyright</a> &#x00a9; 1993, 2015, Oracle and/or its affiliates. All rights reserved. </font></small></p> </body> </html>
{ "content_hash": "6287a6f40eeef746ed7cf1b7815b3c0a", "timestamp": "", "source": "github", "line_count": 181, "max_line_length": 596, "avg_line_length": 47.86187845303867, "alnum_prop": 0.6763245988687522, "repo_name": "fbiville/annotation-processing-ftw", "id": "b8ad8aabd3a665e2eba9d820d71f475d1d0e53b4", "size": "8663", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/java/jdk7/javax/swing/class-use/DefaultRowSorter.ModelWrapper.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "191178" }, { "name": "HTML", "bytes": "63904" }, { "name": "Java", "bytes": "107042" }, { "name": "JavaScript", "bytes": "246677" } ], "symlink_target": "" }
namespace MvcEssentials.Data.Migrations { using System; using System.Data.Entity.Migrations; public partial class SampleContent : DbMigration { public override void Up() { this.AddColumn("dbo.NewsArticles", "SampleContent", c => c.String(nullable: false, maxLength: 1000)); } public override void Down() { this.DropColumn("dbo.NewsArticles", "SampleContent"); } } }
{ "content_hash": "ce01c4d077a7488707efa8fc64f5038e", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 113, "avg_line_length": 25.61111111111111, "alnum_prop": 0.6052060737527115, "repo_name": "puhabg/EssentialNews", "id": "316d7e626c9deec43e056904cba6857d84614138", "size": "463", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "MvcEssentials/Data/MvcEssentials.Data/Migrations/201605020841507_SampleContent.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "108" }, { "name": "C#", "bytes": "158382" }, { "name": "CSS", "bytes": "87513" }, { "name": "HTML", "bytes": "207948" }, { "name": "JavaScript", "bytes": "16617" }, { "name": "PHP", "bytes": "2157" } ], "symlink_target": "" }
<component name="libraryTable"> <library name="avoid node_modules" type="javaScript"> <properties> <option name="frameworkName" value="node_modules" /> <sourceFilesUrls> <item url="file://$PROJECT_DIR$/node_modules" /> </sourceFilesUrls> </properties> <CLASSES> <root url="file://$PROJECT_DIR$/node_modules" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </component>
{ "content_hash": "bf0cf3e42e53bb8a05317a504ae3683f", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 58, "avg_line_length": 28.6, "alnum_prop": 0.6130536130536131, "repo_name": "sovaa/avoid", "id": "71b9f9e8abae5c34d1bf4808c8439ad349380fec", "size": "429", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": ".idea/libraries/avoid_node_modules.xml", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "112" }, { "name": "HTML", "bytes": "936" }, { "name": "JavaScript", "bytes": "28627" } ], "symlink_target": "" }
<?php include 'settings.php'; date_default_timezone_set($timezone); // Sets timezone here $team_key = "frc" . $team; function teamData(){ global $team_key; $data = api('https://www.thebluealliance.com/api/v3/team/' . $team_key); return $data; } $city = teamData()['city']; $state = teamData()['state_prov']; function api($url){ global $tba_api_key; $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"X-TBA-Auth-Key:" . $tba_api_key ) ); $context = stream_context_create($opts); // Open the file using the HTTP headers set above $file = file_get_contents($url, false, $context); return json_decode($file, true); } function events(){ global $team_key; $year = date('Y'); $data = api('https://www.thebluealliance.com/api/v3/team/' . $team_key . '/events/' . $year); return $data; } function eventData($key){ $data = api('https://www.thebluealliance.com/api/v3/event/' . $key); return $data; } function current_event(){ $data = events(); $key = ""; foreach($data as $event){ if(strtotime($event['start_date']) < time() && (strtotime($event['end_date'])+(60*60*24)) > time()){ $key = $event['key']; } } if(empty($key)){ return false; }else{ return $key; } //returns false if not during an active game, else event key } function weather($value){ $event = current_event(); if($event != false){ switch($value){ case 'zip': return eventData($event)['postal_code']; break; case 'city': return eventData($event)['city']; break; case 'state': return eventData($event)['state_prov']; break; } }else{ switch($value){ case 'zip': return teamData($event)['postal_code']; break; case 'city': return teamData($event)['city']; break; case 'state': return teamData($event)['state_prov']; break; } } }
{ "content_hash": "a818a2a621f74f68c04e2ea365bfaa95", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 108, "avg_line_length": 22.927835051546392, "alnum_prop": 0.5013489208633094, "repo_name": "PredatorsRobotics/MeetStatusScreen", "id": "8874fdcc93172ae6eae7cc2b5044c2eb7a64165a", "size": "2224", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "project/functions.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1385" }, { "name": "JavaScript", "bytes": "28773" }, { "name": "PHP", "bytes": "19738" } ], "symlink_target": "" }
/* utils.h ----- Role : Utility function */ #ifndef H_UTILS #define H_UTILS extern char hook[2]; extern char bracket[2]; /** * List of String */ struct Array { char* value; Array* next; }; void toInteger(char*, int&); int pow(int); char* addChar(char*, const char*); char* substr(char*, int, int); void trim(char*); Array* regex(char*, char*, int); Array* cut(char*, char*, char, int); Array* push_back(Array*, char*); int size(Array*); #endif
{ "content_hash": "a4ded4c63cfab2bd9c2a302e75c0f182", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 40, "avg_line_length": 13.885714285714286, "alnum_prop": 0.5987654320987654, "repo_name": "Farrael/Math_Solver", "id": "b02f133e8e248b5e2742f8fd775ded9249fed731", "size": "486", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/utils.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "631" }, { "name": "C++", "bytes": "20204" }, { "name": "Makefile", "bytes": "613" } ], "symlink_target": "" }
#include <kdb.hpp> #include <helper/keyhelper.hpp> #include <kdb.h> #include <kdbmodule.h> #include <kdbplugin.h> #include <kdbprivate.h> // currently needed for plugin handling (struct _Plugin) #include <plugindatabase.hpp> #include <algorithm> #include <set> #include <plugin.hpp> // for stdout #include <stdio.h> using namespace std; namespace kdb { namespace tools { Plugin::Plugin (PluginSpec const & spec_, KeySet & modules) : spec (spec_), firstRef (true) { Key errorKey; plugin = ckdb::elektraPluginOpen (spec.getName ().c_str (), modules.getKeySet (), spec.getConfig ().dup (), *errorKey); if (!plugin) { throw NoPlugin (errorKey); } // plugin->name might be different for default plugins: if (spec.getName () != plugin->name) { spec.setRefName (spec.getName ()); // save virtual name as refname spec.setName (plugin->name); // use actual name } } kdb::KeySet Plugin::getConfig () { return ksDup (elektraPluginGetConfig (plugin)); } Plugin::Plugin (Plugin const & other) : plugin (other.plugin), spec (other.spec), info (other.info), symbols (other.symbols), infos (other.infos), firstRef (other.firstRef) { ++plugin->refcounter; } Plugin & Plugin::operator= (Plugin const & other) { if (this == &other) return *this; uninit (); plugin = other.plugin; spec = other.spec; info = other.info; symbols = other.symbols; infos = other.infos; firstRef = other.firstRef; ++plugin->refcounter; return *this; } Plugin::~Plugin () { uninit (); } void Plugin::uninit () { /* ref counting will avoid closing */ Key errorKey; ckdb::elektraPluginClose (plugin, errorKey.getKey ()); } void Plugin::loadInfo () #if defined(__clang__) // We disable the undefined behavior sanitizer here, because otherwise the last line in this function produces the following error: // `runtime error: call to function (unknown) through pointer to incorrect function type`. // - See also: https://github.com/ElektraInitiative/libelektra/pull/1728 // - TODO: Fix the undefined behavior __attribute__ ((no_sanitize ("undefined"))) #endif { Key infoKey ("system/elektra/modules", KEY_END); infoKey.addBaseName (spec.getName ()); if (!plugin->kdbGet) { throw MissingSymbol ("kdbGet"); } plugin->kdbGet (plugin, info.getKeySet (), *infoKey); } void Plugin::parse () { Key root (std::string ("system/elektra/modules/") + spec.getName (), KEY_END); Key k = info.lookup (root); if (!k) { throw PluginNoContract (); } root.setName (std::string ("system/elektra/modules/") + spec.getName () + "/exports"); k = info.lookup (root); if (k) { while ((k = info.next ()) && k.isBelow (root)) { symbols[k.getBaseName ()] = (*k.getFunc ()); } } root.setName (std::string ("system/elektra/modules/") + spec.getName () + "/infos"); k = info.lookup (root); if (k) { while ((k = info.next ()) && k.isBelow (root)) { infos[k.getBaseName ()] = k.getString (); } } else { throw PluginNoInfo (); } } void Plugin::check (vector<string> & warnings) { if (infos.find ("version") == infos.end ()) warnings.push_back ("no version found"); else if (infos["version"] != PLUGINVERSION) throw VersionInfoMismatch (); if (infos.find ("licence") == infos.end ()) warnings.push_back ("no licence information found"); else if (infos["licence"] != "BSD") warnings.push_back ("the licence is not BSD, it might change the overall licence of your elektra installation"); if (infos.find ("status") == infos.end ()) warnings.push_back ("no status information found"); else { // check if status is correct std::string statusString = infos["status"]; std::istringstream ss (statusString); std::string status; while (ss >> status) { auto it = PluginDatabase::statusMap.find (status); if (it == PluginDatabase::statusMap.end ()) { char * endptr; const char * str = status.c_str (); errno = 0; long val = strtol (str, &endptr, 10); if (((errno == ERANGE && (val > INT_MAX || val < INT_MIN)) || (errno != 0 && val == 0)) || endptr == str) { throw WrongStatus (status); } } } } if (infos.find ("description") == infos.end ()) warnings.push_back ("no description of the plugin found"); if (infos.find ("provides") == infos.end ()) warnings.push_back ("no provides information found"); if (infos.find ("placements") == infos.end ()) { warnings.push_back ("no placements information found"); } else { std::string placements = infos["placements"]; if (placements.empty ()) { warnings.push_back ("placements are empty"); } std::vector<std::string> pp; pp.push_back ("prerollback"); pp.push_back ("rollback"); pp.push_back ("postrollback"); pp.push_back ("getresolver"); pp.push_back ("pregetcache"); pp.push_back ("pregetstorage"); pp.push_back ("getstorage"); pp.push_back ("procgetstorage"); pp.push_back ("postgetstorage"); pp.push_back ("postgetcache"); pp.push_back ("setresolver"); pp.push_back ("postgetcleanup"); pp.push_back ("presetstorage"); pp.push_back ("setstorage"); pp.push_back ("presetcleanup"); pp.push_back ("precommit"); pp.push_back ("commit"); pp.push_back ("postcommit"); istringstream is (placements); std::string placement; while (is >> placement) { if (std::find (pp.begin (), pp.end (), placement) == pp.end ()) { warnings.push_back ("not supported placement " + placement + " found"); } } } if (infos.find ("needs") == infos.end ()) warnings.push_back ("no needs information found"); if (infos.find ("author") == infos.end ()) { warnings.push_back ("no author found"); } else { std::string author = infos["author"]; size_t ppos = 0; ppos = author.find ('<', ppos); if (ppos == string::npos) warnings.push_back ("Could not find \"<\" for authors e-mail address"); size_t pos = 0; pos = author.find ('@', ppos); if (pos == string::npos) warnings.push_back ("Could not find \"@\" for authors e-mail address"); if (pos < ppos) warnings.push_back ("@ found before <"); size_t lpos = 0; lpos = author.find ('>', pos); if (lpos == string::npos) warnings.push_back ("Could not find \">\" for authors e-mail address"); if (lpos < pos) warnings.push_back ("> found before @"); } std::set<func_t> checkDups; std::pair<std::set<func_t>::iterator, bool> ret; if (plugin->kdbOpen) { if (symbols.find ("open") == symbols.end ()) warnings.push_back ("no open symbol exported"); else if (symbols["open"] != reinterpret_cast<func_t> (plugin->kdbOpen)) throw SymbolMismatch ("open"); ret = checkDups.insert (symbols["open"]); if (!ret.second) throw SymbolDuplicate ("open"); } if (plugin->kdbClose) { if (symbols.find ("close") == symbols.end ()) warnings.push_back ("no close symbol exported"); else if (symbols["close"] != reinterpret_cast<func_t> (plugin->kdbClose)) throw SymbolMismatch ("close"); ret = checkDups.insert (symbols["close"]); if (!ret.second) throw SymbolDuplicate ("close"); } if (plugin->kdbGet) { if (symbols.find ("get") == symbols.end ()) warnings.push_back ("no get symbol exported"); else if (symbols["get"] != reinterpret_cast<func_t> (plugin->kdbGet)) throw SymbolMismatch ("get"); ret = checkDups.insert (symbols["get"]); if (!ret.second) throw SymbolDuplicate ("get"); } if (plugin->kdbSet) { if (symbols.find ("set") == symbols.end ()) warnings.push_back ("no set symbol exported"); else if (symbols["set"] != reinterpret_cast<func_t> (plugin->kdbSet)) throw SymbolMismatch ("set"); ret = checkDups.insert (symbols["set"]); if (!ret.second) throw SymbolDuplicate ("set"); } if (plugin->kdbCommit) { if (symbols.find ("commit") == symbols.end ()) warnings.push_back ("no commit symbol exported"); else if (symbols["commit"] != reinterpret_cast<func_t> (plugin->kdbCommit)) throw SymbolMismatch ("commit"); ret = checkDups.insert (symbols["commit"]); if (!ret.second) throw SymbolDuplicate ("commit"); } if (plugin->kdbError) { if (symbols.find ("error") == symbols.end ()) warnings.push_back ("no error symbol exported"); else if (symbols["error"] != reinterpret_cast<func_t> (plugin->kdbError)) throw SymbolMismatch ("error"); ret = checkDups.insert (symbols["error"]); if (!ret.second) throw SymbolDuplicate ("error"); } if (symbols.find ("open") != symbols.end ()) { if (!plugin->kdbOpen) throw SymbolMismatch ("open"); } if (symbols.find ("close") != symbols.end ()) { if (!plugin->kdbClose) throw SymbolMismatch ("close"); } if (symbols.find ("get") != symbols.end ()) { if (!plugin->kdbGet) throw SymbolMismatch ("get"); } if (symbols.find ("set") != symbols.end ()) { if (!plugin->kdbSet) throw SymbolMismatch ("set"); } if (symbols.find ("commit") != symbols.end ()) { if (!plugin->kdbCommit) throw SymbolMismatch ("commit"); } if (symbols.find ("error") != symbols.end ()) { if (!plugin->kdbError) throw SymbolMismatch ("error"); } } ckdb::Plugin * Plugin::operator-> () { return plugin; } std::string Plugin::lookupInfo (std::string item, std::string section) { Key k ("system/elektra/modules", KEY_END); k.addBaseName (spec.getName ()); k.addBaseName (section); k.addBaseName (item); Key ret = info.lookup (k); if (!ret) return ""; /* TODO Lets say missing info is ok for now */ return ret.getString (); } bool Plugin::findInfo (std::string compare, std::string item, std::string section) { std::string str = lookupInfo (item, section); std::istringstream istr (str); std::string toCheck; while (istr >> toCheck) { if (toCheck == compare) return true; } return false; } kdb::KeySet Plugin::getNeededConfig () { Key neededConfigKey ("system/elektra/modules", KEY_END); neededConfigKey.addName (spec.getName ()); neededConfigKey.addName ("config/needs"); KeySet d (info.dup ()); KeySet config = d.cut (neededConfigKey); KeySet ret; Key oldParent = neededConfigKey; Key newParent ("system", KEY_END); for (KeySet::iterator i = config.begin (); i != config.end (); ++i) { Key k (i->dup ()); ret.append (kdb::tools::helper::rebaseKey (k, oldParent, newParent)); } return ret; } int Plugin::open (kdb::Key & errorKey) { if (!plugin->kdbOpen) { throw MissingSymbol ("kdbOpen"); } return plugin->kdbOpen (plugin, errorKey.getKey ()); } int Plugin::close (kdb::Key & errorKey) { if (!plugin->kdbClose) { throw MissingSymbol ("kdbClose"); } return plugin->kdbClose (plugin, errorKey.getKey ()); } int Plugin::get (kdb::KeySet & ks, kdb::Key & parentKey) #if defined(__clang__) // See `Plugin::loadInfo` __attribute__ ((no_sanitize ("undefined"))) #endif { if (!plugin->kdbGet) { throw MissingSymbol ("kdbGet"); } return plugin->kdbGet (plugin, ks.getKeySet (), parentKey.getKey ()); } int Plugin::set (kdb::KeySet & ks, kdb::Key & parentKey) #if defined(__clang__) // See `Plugin::loadInfo` __attribute__ ((no_sanitize ("undefined"))) #endif { if (!plugin->kdbSet) { throw MissingSymbol ("kdbSet"); } return plugin->kdbSet (plugin, ks.getKeySet (), parentKey.getKey ()); } int Plugin::commit (kdb::KeySet & ks, kdb::Key & parentKey) { if (!plugin->kdbCommit) { throw MissingSymbol ("kdbCommit"); } return plugin->kdbCommit (plugin, ks.getKeySet (), parentKey.getKey ()); } int Plugin::error (kdb::KeySet & ks, kdb::Key & parentKey) { if (!plugin->kdbError) { throw MissingSymbol ("kdbError"); } return plugin->kdbError (plugin, ks.getKeySet (), parentKey.getKey ()); } std::string Plugin::name () // TODO: rename + use internally { return spec.getName (); } std::string Plugin::getFullName () { return spec.getFullName (); } std::string Plugin::refname () { if (firstRef) { firstRef = false; return std::string ("#") + spec.getName () + "#" + spec.getRefName () + "#"; } else { return std::string ("#") + spec.getRefName (); } } } // namespace tools } // namespace kdb
{ "content_hash": "1a2b010ae389862f6b5b8a2a31e562a8", "timestamp": "", "source": "github", "line_count": 477, "max_line_length": 134, "avg_line_length": 24.945492662473793, "alnum_prop": 0.6469451214387764, "repo_name": "BernhardDenner/libelektra", "id": "6f118817c65a1bd2308d6303ef68c435c110dbef", "size": "12032", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/libs/tools/src/plugin.cpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ANTLR", "bytes": "606" }, { "name": "Awk", "bytes": "7511" }, { "name": "C", "bytes": "4367582" }, { "name": "C++", "bytes": "1992348" }, { "name": "CMake", "bytes": "394962" }, { "name": "CSS", "bytes": "20673" }, { "name": "Dockerfile", "bytes": "38984" }, { "name": "Groovy", "bytes": "51313" }, { "name": "HTML", "bytes": "145913" }, { "name": "Inform 7", "bytes": "394" }, { "name": "Java", "bytes": "98888" }, { "name": "JavaScript", "bytes": "323573" }, { "name": "Lua", "bytes": "13628" }, { "name": "Makefile", "bytes": "8214" }, { "name": "Objective-C", "bytes": "6323" }, { "name": "Python", "bytes": "59302" }, { "name": "QML", "bytes": "87333" }, { "name": "QMake", "bytes": "4256" }, { "name": "Roff", "bytes": "791" }, { "name": "Ruby", "bytes": "88712" }, { "name": "Rust", "bytes": "90027" }, { "name": "Shell", "bytes": "247321" }, { "name": "Smarty", "bytes": "1196" }, { "name": "Tcl", "bytes": "330" } ], "symlink_target": "" }
set(NEON_FLAGS) set(NEON_FOUND) set(DETECTED_NEON) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) execute_process(COMMAND ${CMAKE_CXX_COMPILER} "-dumpversion" OUTPUT_VARIABLE GCC_VERSION_STRING) if(GCC_VERSION_STRING VERSION_GREATER 4.2 AND NOT APPLE AND NOT CMAKE_CROSSCOMPILING) SET(NEON_FLAGS "${NEON_FLAGS} -march=native") message(STATUS "Using CPU native flags for NEON optimization: ${NEON_FLAGS}") endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_CROSSCOMPILING) SET(NEON_FLAGS "${NEON_FLAGS} -march=native") message(STATUS "Using CPU native flags for NEON optimization: ${NEON_FLAGS}") endif() include(CheckCXXSourceRuns) set(CMAKE_REQUIRED_FLAGS) #set(CMAKE_REQUIRED_INCLUDES arm_neon.h) # Check for NEON support. check_cxx_source_runs(" #include <arm_neon.h> int main() { float64_t a[2] = { 1., 2. }; float64_t b[2] = { -1., 3. }; float64_t c[2]; float64x2_t va = vld1q_f64(&a[0]); float64x2_t vb = vld1q_f64(&b[0]); float64x2_t vc = vaddq_f64(va, vb); vst1q_f64(&c[0], vc); if (c[0] == 0. && c[1] == 5.) return 0; else return 0; } " DETECTED_NEON) set(CMAKE_REQUIRED_FLAGS) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(DETECTED_NEON) SET(NEON_FLAGS "${NEON_FLAGS}") set(NEON_STR "2_0") SET(NEON_FOUND 1) else() # Setting -ffloat-store to alleviate 32bit vs 64bit discrepancies on non-SIMD platforms. set(NEON_FLAGS "-ffloat-store") endif() endif() if(NEON_FOUND) message(STATUS " Found NEON extensions, using flags: ${NEON_FLAGS}") else() message(STATUS " No NEON support found") set(NEON_FLAGS "") endif() set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${NEON_FLAGS}") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${NEON_FLAGS}") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${NEON_FLAGS}") return()
{ "content_hash": "5411f9702bb5a3b5c8a58a4af1815415", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 98, "avg_line_length": 29.846153846153847, "alnum_prop": 0.6850515463917526, "repo_name": "Milad-Rakhsha/chrono", "id": "19aae80ccb3126d493fa54b455382eee36b8dd71", "size": "2460", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "cmake/FindNEON.cmake", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "1834298" }, { "name": "C++", "bytes": "39649020" }, { "name": "CMake", "bytes": "254971" }, { "name": "CSS", "bytes": "9560" }, { "name": "Cuda", "bytes": "2979" }, { "name": "GLSL", "bytes": "4214" }, { "name": "HTML", "bytes": "2856" }, { "name": "Inno Setup", "bytes": "47881" }, { "name": "JavaScript", "bytes": "4942" }, { "name": "Logos", "bytes": "15488" }, { "name": "MATLAB", "bytes": "6957" }, { "name": "Makefile", "bytes": "2254" }, { "name": "Objective-C", "bytes": "40334" }, { "name": "Python", "bytes": "189183" } ], "symlink_target": "" }
""" ROS node which converts joel world model, osl_world_model, AcousticModemData msgs into the ones used for the Evologics modem driver Author: Gordon Frost; email: [email protected] date: 05/02/2015 """ # TODO: Add Radio Modem switch in here when vehicles known to be on surface import roslib;roslib.load_manifest("evologics_driver") import rospy from vehicle_interface.msg import AcousticModemData from vehicle_interface.msg import AcousticModemPayload global wm_incoming_pub, evologics_pub def wmOutgoingMsg(msg): """ method must convert from AcousticModemData uint8[]] to AcousticModemPayload string """ global evologics_pub rospy.loginfo("WM outgoing msg being converted and sent to Evologics driver") uint8_payload = msg.payload converted_payload = str(uint8_payload) # populate new msg and send to evologics modem driver converted_msg = AcousticModemPayload() converted_msg.address = 5 converted_msg.payload = converted_payload evologics_pub.publish(converted_msg) def wmIncomingMsg(msg): """ method must convert from AcousticModemPayload string to AcousticModemData uint8 """ global wm_incoming_pub rospy.loginfo("Msg received from Evologics driver, sending to WM") string_payload = msg.payload converted_payload = list(bytearray(string_payload)) # populate new msg and send to world model converted_msg = AcousticModemData() converted_msg.payload = converted_payload wm_incoming_pub.publish(converted_msg) if __name__ == '__main__': rospy.init_node("world_model_msg_translator") global wm_incoming_pub, evologics_pub # Topics for World model sending message to Evologics modem for transmission wm_outgoing_sub = rospy.Subscriber("/modem/outgoing", AcousticModemData, wmOutgoingMsg) evologics_pub = rospy.Publisher("/modem/burst/out", AcousticModemPayload) # Topics for incoming acoustic msgs being sent on to the World Model wm_incoming_pub = rospy.Publisher("/modem/incoming", AcousticModemData) evologics_sub = rospy.Subscriber("/modem/burst/in", AcousticModemPayload, wmIncomingMsg) rospy.spin()
{ "content_hash": "8ba6e2df0a1e684ee8f58ef5b023eb13", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 95, "avg_line_length": 37, "alnum_prop": 0.7324782409528172, "repo_name": "oceansystemslab/evologics_driver", "id": "88afdc8024491b18010962750f9e9121fb041770", "size": "2203", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/world_model_translator.py", "mode": "33261", "license": "bsd-3-clause", "language": [ { "name": "CMake", "bytes": "1203" }, { "name": "Python", "bytes": "71771" }, { "name": "Shell", "bytes": "1568" } ], "symlink_target": "" }
define(function(require) { 'use strict'; var rest = require('rest'); var defaultRequest = require('rest/interceptor/defaultRequest'); var mime = require('rest/interceptor/mime'); var errorCode = require('rest/interceptor/errorCode'); var baseRegistry = require('rest/mime/registry'); var registry = baseRegistry.child(); return rest .wrap(mime, { registry: registry }) .wrap(errorCode); });
{ "content_hash": "df56b9d2f4bb4de7d54946118540973b", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 68, "avg_line_length": 27.625, "alnum_prop": 0.6561085972850679, "repo_name": "awanrky/cinchring", "id": "9b1ed6e2c0862393a82018d1047149d4c44cee7c", "size": "443", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/resources/static/js/client.js", "mode": "33188", "license": "mit", "language": [ { "name": "Arduino", "bytes": "52010" }, { "name": "Batchfile", "bytes": "5006" }, { "name": "C", "bytes": "1972" }, { "name": "C++", "bytes": "96616" }, { "name": "CSS", "bytes": "123" }, { "name": "HTML", "bytes": "647" }, { "name": "Java", "bytes": "18330" }, { "name": "JavaScript", "bytes": "2666" }, { "name": "Processing", "bytes": "5039" }, { "name": "Shell", "bytes": "7058" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (C) 2013 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="bsp_done_label" msgid="7007948707597430919">"Xong"</string> <string name="bsp_hour_picker_description" msgid="7586639618712934060">"Thanh trượt giờ hình tròn"</string> <string name="bsp_minute_picker_description" msgid="6024811202872705251">"Thanh trượt phút hình tròn"</string> <string name="bsp_select_hours" msgid="7651068754188418859">"Chọn giờ"</string> <string name="bsp_select_minutes" msgid="8327182090226828481">"Chọn phút"</string> <string name="bsp_day_picker_description" msgid="3968620852217927702">"Lưới ngày theo tháng"</string> <string name="bsp_year_picker_description" msgid="6963340404644587098">"Danh sách năm"</string> <string name="bsp_select_day" msgid="3973338219107019769">"Chọn tháng và ngày"</string> <string name="bsp_select_year" msgid="2603330600102539372">"Chọn năm"</string> <string name="bsp_item_is_selected" msgid="2674929164900463786">"Đã chọn <xliff:g id="ITEM">%1$s</xliff:g>"</string> <string name="bsp_deleted_key" msgid="6908431551612331381">"Đã xóa <xliff:g id="KEY">%1$s</xliff:g>"</string> </resources>
{ "content_hash": "925dc3c6562d7c09074eb76138ea1e7a", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 120, "avg_line_length": 61.61290322580645, "alnum_prop": 0.7230366492146597, "repo_name": "philliphsu/BottomSheetPickers", "id": "beac99e54260125d2ba02d85b480e743c779fce1", "size": "1952", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bottomsheetpickers/src/main/res/values-vi/strings.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "407183" } ], "symlink_target": "" }
using Evol.Fx.EntityFramework.Repository; using System.Data.Entity; using Evol.Common.IoC; using System; namespace Evol.Fx.EntityFramework.Uow { public class EfDbContextProvider : IEfDbContextProvider { private IIoCManager _ioCManager; public EfDbContextProvider(IIoCManager ioCManager) { if (ioCManager == null) throw new ArgumentNullException(nameof(ioCManager)); _ioCManager = ioCManager; } public TDbContext Get<TDbContext>() where TDbContext : DbContext { var context = _ioCManager.GetService<TDbContext>(); return context; } } }
{ "content_hash": "83e6fb8f4ab3ad7a086cb5c7ee810c34", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 72, "avg_line_length": 26.84, "alnum_prop": 0.6408345752608048, "repo_name": "supernebula/evol-core", "id": "c1a4909f74c023587e3537f8e44aa5dea4da5557", "size": "673", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Infrastructure/Evol.Fx.EntityFramework/Uow/EfDbContextProvider.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "112" }, { "name": "C#", "bytes": "11926780" }, { "name": "CSS", "bytes": "349708" }, { "name": "PHP", "bytes": "7682" }, { "name": "Python", "bytes": "32324" }, { "name": "Vue", "bytes": "2051" } ], "symlink_target": "" }
package org.apache.ivyde.internal.eclipse.handlers; import org.apache.ivyde.eclipse.cp.IvyClasspathContainer; import org.eclipse.core.resources.IProject; public class ReloadSettingsHandler extends AbstractIvyDEHandler { public static final String COMMAND_ID = "org.apache.ivyde.commands.reloadsettings"; protected void handleContainer(IProject project, IvyClasspathContainer container) { container.reloadSettings(); } }
{ "content_hash": "0f52321c47f4912a4c0fa51cd82f40ca", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 87, "avg_line_length": 29.733333333333334, "alnum_prop": 0.7937219730941704, "repo_name": "apache/ant-ivyde", "id": "9db8f4be41cf727b9ccaf84c3f0d1d3655b559c5", "size": "1263", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "org.apache.ivyde.eclipse/src/java/org/apache/ivyde/internal/eclipse/handlers/ReloadSettingsHandler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1073" }, { "name": "Java", "bytes": "1010510" }, { "name": "Shell", "bytes": "2052" }, { "name": "XSLT", "bytes": "16897" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_27) on Wed Nov 21 16:03:56 EST 2012 --> <TITLE> Uses of Class org.pentaho.di.core.row.SpeedTest </TITLE> <META NAME="date" CONTENT="2012-11-21"> <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="Uses of Class org.pentaho.di.core.row.SpeedTest"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/pentaho/di/core/row/SpeedTest.html" title="class in org.pentaho.di.core.row"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&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-files/index-1.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;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/pentaho/di/core/row//class-useSpeedTest.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="SpeedTest.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> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>org.pentaho.di.core.row.SpeedTest</B></H2> </CENTER> No usage of org.pentaho.di.core.row.SpeedTest <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/pentaho/di/core/row/SpeedTest.html" title="class in org.pentaho.di.core.row"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&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-files/index-1.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;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/pentaho/di/core/row//class-useSpeedTest.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="SpeedTest.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> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
{ "content_hash": "b9534d4f47be2140f5240746c1717157", "timestamp": "", "source": "github", "line_count": 144, "max_line_length": 216, "avg_line_length": 41.145833333333336, "alnum_prop": 0.6047257383966245, "repo_name": "ColFusion/PentahoKettle", "id": "2b4ea252edf487caec890a11d242c5054369fe52", "size": "5925", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "kettle-data-integration/docs/api/org/pentaho/di/core/row/class-use/SpeedTest.html", "mode": "33188", "license": "mit", "language": [ { "name": "ActionScript", "bytes": "21071" }, { "name": "Batchfile", "bytes": "21366" }, { "name": "C", "bytes": "7006" }, { "name": "CSS", "bytes": "1952277" }, { "name": "Groff", "bytes": "684" }, { "name": "Groovy", "bytes": "33843" }, { "name": "HTML", "bytes": "197173221" }, { "name": "Java", "bytes": "3685348" }, { "name": "JavaScript", "bytes": "31972698" }, { "name": "PHP", "bytes": "224688" }, { "name": "Perl", "bytes": "6881" }, { "name": "PigLatin", "bytes": "7496" }, { "name": "Python", "bytes": "109487" }, { "name": "Shell", "bytes": "43881" }, { "name": "Smarty", "bytes": "2952" }, { "name": "XQuery", "bytes": "798" }, { "name": "XSLT", "bytes": "562453" } ], "symlink_target": "" }
<html> <body> The classes in this package represent the set of Validator objects the Business Layer makes available to the Presentation Layer. </body> </html>
{ "content_hash": "a6e06d76a6a9d701764fb60d27f1a0b3", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 67, "avg_line_length": 21.25, "alnum_prop": 0.7294117647058823, "repo_name": "Will1229/LearnSpring", "id": "90adeaca58945f89c2b32dc7e0ffe04db8744548", "size": "170", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "spring-framework-0.9.1/samples/petclinic/src/petclinic/validation/package.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "614" }, { "name": "CSS", "bytes": "11684" }, { "name": "HTML", "bytes": "12756484" }, { "name": "Java", "bytes": "1572315" }, { "name": "Shell", "bytes": "137" } ], "symlink_target": "" }
static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CSampleApp BEGIN_MESSAGE_MAP(CSampleApp, CWinApp) //{{AFX_MSG_MAP(CSampleApp) ON_COMMAND(ID_APP_ABOUT, OnAppAbout) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAP // Standard file based document commands ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) // Standard print setup command ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CSampleApp construction CSampleApp::CSampleApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only CSampleApp object CSampleApp theApp; ///////////////////////////////////////////////////////////////////////////// // CSampleApp initialization BOOL CSampleApp::InitInstance() { AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your company or organization. SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate( IDR_SAMPLETYPE, RUNTIME_CLASS(CSampleDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CSampleView)); AddDocTemplate(pDocTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; m_pMainWnd = pMainFrame; // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; // The main window has been initialized, so show and update it. pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) // No message handlers //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() // App command to run the dialog void CSampleApp::OnAppAbout() { CAboutDlg aboutDlg; aboutDlg.DoModal(); } ///////////////////////////////////////////////////////////////////////////// // CSampleApp message handlers
{ "content_hash": "265440b9d94f7852e88433ace708be76", "timestamp": "", "source": "github", "line_count": 154, "max_line_length": 77, "avg_line_length": 26.714285714285715, "alnum_prop": 0.6560525036460866, "repo_name": "sgh/vtk", "id": "1cde5cb79d1c4a9cb19b5403d4347cf9de8cc22c", "size": "4368", "binary": false, "copies": "1", "ref": "refs/heads/vtk-5.0.4_compilation_fixes", "path": "Examples/GUI/Win32/SampleMFC/Sample.cpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Assembly", "bytes": "9874" }, { "name": "C", "bytes": "12696174" }, { "name": "C++", "bytes": "23714469" }, { "name": "Java", "bytes": "60000" }, { "name": "Objective-C", "bytes": "269592" }, { "name": "Pascal", "bytes": "3255" }, { "name": "Perl", "bytes": "173644" }, { "name": "Python", "bytes": "660699" }, { "name": "Shell", "bytes": "1549" }, { "name": "Tcl", "bytes": "1703282" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>group-theory: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.12.1 / group-theory - 8.10.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> group-theory <small> 8.10.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-05-28 18:49:07 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-05-28 18:49:07 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.12.1 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.06.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.06.1 Official 4.06.1 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.3 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;[email protected]&quot; homepage: &quot;https://github.com/coq-contribs/group-theory&quot; license: &quot;Unknown&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/GroupTheory&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.10&quot; &amp; &lt; &quot;8.11~&quot;} ] tags: [ &quot;keyword: Group Theory&quot; &quot;category: Mathematics/Algebra&quot; ] authors: [ &quot;Gilles Kahn&quot; ] bug-reports: &quot;https://github.com/coq-contribs/group-theory/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/group-theory.git&quot; synopsis: &quot;Elements of Group Theory&quot; description: &quot;&quot;&quot; Group Theory following the book &quot;Group Theory&quot; from W.R. Scott.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/group-theory/archive/v8.10.0.tar.gz&quot; checksum: &quot;md5=7a6b3f6d72e08d6b3d4b88cf49cd0bf3&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-group-theory.8.10.0 coq.8.12.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.12.1). The following dependencies couldn&#39;t be met: - coq-group-theory -&gt; coq &lt; 8.11~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-group-theory.8.10.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "83712b14cc81baeeeac97b0107272bcd", "timestamp": "", "source": "github", "line_count": 168, "max_line_length": 159, "avg_line_length": 40.029761904761905, "alnum_prop": 0.537546468401487, "repo_name": "coq-bench/coq-bench.github.io", "id": "8c993b7507104243584faf231440399ce5db720f", "size": "6750", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.06.1-2.0.5/released/8.12.1/group-theory/8.10.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package com.qaprosoft.carina.demo.gui.components; import org.openqa.selenium.SearchContext; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.FindBy; import com.qaprosoft.carina.core.foundation.webdriver.decorator.ExtendedWebElement; import com.qaprosoft.carina.core.gui.AbstractUIObject; import com.qaprosoft.carina.demo.gui.pages.ModelInfoPage; public class ModelItem extends AbstractUIObject { @FindBy(xpath = ".//strong/span") private ExtendedWebElement modelLabel; @FindBy(xpath = ".//a") private ExtendedWebElement modelLink; public ModelItem(WebDriver driver, SearchContext searchContext) { super(driver, searchContext); } public String readModel() { return modelLabel.getText(); } public ModelInfoPage openModelPage() { modelLink.click(); return new ModelInfoPage(driver); } }
{ "content_hash": "30a212601e10a10294aab731bcf2f4d9", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 83, "avg_line_length": 28.64516129032258, "alnum_prop": 0.7421171171171171, "repo_name": "qaprosoft/carina-demo", "id": "27b7e8e36ba0afb91a80d5dea28e1cecb882affd", "size": "1506", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/qaprosoft/carina/demo/gui/components/ModelItem.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Gherkin", "bytes": "312" }, { "name": "Java", "bytes": "106391" } ], "symlink_target": "" }
<SkinFrame id="ListCell" skin="chat_liaotiankuang" x="188" y="463" width="497" height="100" alpha="1" enabled="true"> <Button id="Instante3" label="Button" skin="default_button1" x="12" y="37" width="100" height="50" enabled="true" alpha="1"/> <ImageButton id="Instante4" skin="close" x="447" y="11" enabled="true" alpha="1" toggle="false"/> <Label id="Instante5" color="16777215" label="label" fontSize="12" x="119" y="51" width="150" height="20" enabled="true" alpha="1" align="left"/> <SkinImage id="Instante6" skin="mail_lihe" x="348" y="26" alpha="1" enabled="true"/> </SkinFrame>
{ "content_hash": "3db0d96b40a0153047b0191c5010ea6b", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 147, "avg_line_length": 98.83333333333333, "alnum_prop": 0.6677908937605397, "repo_name": "GameRisker/RookieEditor", "id": "88b664ac7f510478c0802d961d1e201dc96b0891", "size": "593", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "RookieEditor/source/source/UIXML/ListCell.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ActionScript", "bytes": "183382" }, { "name": "CSS", "bytes": "833" } ], "symlink_target": "" }
{- NOTA BENE: Do NOT use ($) anywhere in this module! The type of ($) is slightly magical (it can return unlifted types), and it is wired in. But, it is also *defined* in this module, with a non-magical type. GHC gets terribly confused (and *hangs*) if you try to use ($) in this module, because it has different types in different scenarios. This is not a problem in general, because the type ($), being wired in, is not written out to the interface file, so importing files don't get confused. The problem is only if ($) is used here. So don't! --------------------------------------------- The overall structure of the GHC Prelude is a bit tricky. a) We want to avoid "orphan modules", i.e. ones with instance decls that don't belong either to a tycon or a class defined in the same module b) We want to avoid giant modules So the rough structure is as follows, in (linearised) dependency order GHC.Prim Has no implementation. It defines built-in things, and by importing it you bring them into scope. The source file is GHC.Prim.hi-boot, which is just copied to make GHC.Prim.hi GHC.Base Classes: Eq, Ord, Functor, Monad Types: list, (), Int, Bool, Ordering, Char, String Data.Tuple Types: tuples, plus instances for GHC.Base classes GHC.Show Class: Show, plus instances for GHC.Base/GHC.Tup types GHC.Enum Class: Enum, plus instances for GHC.Base/GHC.Tup types Data.Maybe Type: Maybe, plus instances for GHC.Base classes GHC.List List functions GHC.Num Class: Num, plus instances for Int Type: Integer, plus instances for all classes so far (Eq, Ord, Num, Show) Integer is needed here because it is mentioned in the signature of 'fromInteger' in class Num GHC.Real Classes: Real, Integral, Fractional, RealFrac plus instances for Int, Integer Types: Ratio, Rational plus intances for classes so far Rational is needed here because it is mentioned in the signature of 'toRational' in class Real GHC.ST The ST monad, instances and a few helper functions Ix Classes: Ix, plus instances for Int, Bool, Char, Integer, Ordering, tuples GHC.Arr Types: Array, MutableArray, MutableVar Arrays are used by a function in GHC.Float GHC.Float Classes: Floating, RealFloat Types: Float, Double, plus instances of all classes so far This module contains everything to do with floating point. It is a big module (900 lines) With a bit of luck, many modules can be compiled without ever reading GHC.Float.hi Other Prelude modules are much easier with fewer complex dependencies. -} {-# LANGUAGE Unsafe #-} {-# LANGUAGE CPP , NoImplicitPrelude , BangPatterns , ExplicitForAll , MagicHash , UnboxedTuples , ExistentialQuantification , RankNTypes #-} -- -Wno-orphans is needed for things like: -- Orphan rule: "x# -# x#" ALWAYS forall x# :: Int# -# x# x# = 0 {-# OPTIONS_GHC -Wno-orphans #-} {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- | -- Module : GHC.Base -- Copyright : (c) The University of Glasgow, 1992-2002 -- License : see libraries/base/LICENSE -- -- Maintainer : [email protected] -- Stability : internal -- Portability : non-portable (GHC extensions) -- -- Basic data types and classes. -- ----------------------------------------------------------------------------- #include "MachDeps.h" module GHC.Base ( module GHC.Base, module GHC.Classes, module GHC.CString, module GHC.Magic, module GHC.Types, module GHC.Prim, -- Re-export GHC.Prim and [boot] GHC.Err, -- to avoid lots of people having to module GHC.Err -- import it explicitly ) where import GHC.Types import GHC.Classes import GHC.CString import GHC.Magic import GHC.Prim import GHC.Err import {-# SOURCE #-} GHC.IO (failIO,mplusIO) import GHC.Tuple () -- Note [Depend on GHC.Tuple] import GHC.Integer () -- Note [Depend on GHC.Integer] --infixr 9 . --infixr 5 ++ --infixr 1 =<< --infixr 0 $, $! default () -- Double isn't available yet {- Note [Depend on GHC.Integer] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The Integer type is special because TidyPgm uses GHC.Integer.Type.mkInteger to construct Integer literal values Currently it reads the interface file whether or not the current module *has* any Integer literals, so it's important that GHC.Integer.Type (in package integer-gmp or integer-simple) is compiled before any other module. (There's a hack in GHC to disable this for packages ghc-prim, integer-gmp, integer-simple, which aren't allowed to contain any Integer literals.) Likewise we implicitly need Integer when deriving things like Eq instances. The danger is that if the build system doesn't know about the dependency on Integer, it'll compile some base module before GHC.Integer.Type, resulting in: Failed to load interface for ‘GHC.Integer.Type’ There are files missing in the ‘integer-gmp’ package, Bottom line: we make GHC.Base depend on GHC.Integer; and everything else either depends on GHC.Base, or does not have NoImplicitPrelude (and hence depends on Prelude). Note [Depend on GHC.Tuple] ~~~~~~~~~~~~~~~~~~~~~~~~~~ Similarly, tuple syntax (or ()) creates an implicit dependency on GHC.Tuple, so we use the same rule as for Integer --- see Note [Depend on GHC.Integer] --- to explain this to the build system. We make GHC.Base depend on GHC.Tuple, and everything else depends on GHC.Base or Prelude. -} #if 0 -- for use when compiling GHC.Base itself doesn't work data Bool = False | True data Ordering = LT | EQ | GT data Char = C# Char# type String = [Char] data Int = I# Int# data () = () data [] a = MkNil not True = False (&&) True True = True otherwise = True build = errorWithoutStackTrace "urk" foldr = errorWithoutStackTrace "urk" #endif -- | The 'Maybe' type encapsulates an optional value. A value of type -- @'Maybe' a@ either contains a value of type @a@ (represented as @'Just' a@), -- or it is empty (represented as 'Nothing'). Using 'Maybe' is a good way to -- deal with errors or exceptional cases without resorting to drastic -- measures such as 'error'. -- -- The 'Maybe' type is also a monad. It is a simple kind of error -- monad, where all errors are represented by 'Nothing'. A richer -- error monad can be built using the 'Data.Either.Either' type. -- data Maybe a = Nothing | Just a deriving (Eq, Ord) -- | The class of monoids (types with an associative binary operation that -- has an identity). Instances should satisfy the following laws: -- -- * @mappend mempty x = x@ -- -- * @mappend x mempty = x@ -- -- * @mappend x (mappend y z) = mappend (mappend x y) z@ -- -- * @mconcat = 'foldr' mappend mempty@ -- -- The method names refer to the monoid of lists under concatenation, -- but there are many other instances. -- -- Some types can be viewed as a monoid in more than one way, -- e.g. both addition and multiplication on numbers. -- In such cases we often define @newtype@s and make those instances -- of 'Monoid', e.g. 'Sum' and 'Product'. class Monoid a where mempty :: a -- ^ Identity of 'mappend' mappend :: a -> a -> a -- ^ An associative operation mconcat :: [a] -> a -- ^ Fold a list using the monoid. -- For most types, the default definition for 'mconcat' will be -- used, but the function is included in the class definition so -- that an optimized version can be provided for specific types. mconcat = foldr mappend mempty instance Monoid [a] where {-# INLINE mempty #-} mempty = [] {-# INLINE mappend #-} mappend = (++) {-# INLINE mconcat #-} mconcat xss = [x | xs <- xss, x <- xs] -- See Note: [List comprehensions and inlining] {- Note: [List comprehensions and inlining] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The list monad operations are traditionally described in terms of concatMap: xs >>= f = concatMap f xs Similarly, mconcat for lists is just concat. Here in Base, however, we don't have concatMap, and we'll refrain from adding it here so it won't have to be hidden in imports. Instead, we use GHC's list comprehension desugaring mechanism to define mconcat and the Applicative and Monad instances for lists. We mark them INLINE because the inliner is not generally too keen to inline build forms such as the ones these desugar to without our insistence. Defining these using list comprehensions instead of foldr has an additional potential benefit, as described in compiler/deSugar/DsListComp.lhs: if optimizations needed to make foldr/build forms efficient are turned off, we'll get reasonably efficient translations anyway. -} instance Monoid b => Monoid (a -> b) where mempty _ = mempty mappend f g x = f x `mappend` g x instance Monoid () where -- Should it be strict? mempty = () _ `mappend` _ = () mconcat _ = () instance (Monoid a, Monoid b) => Monoid (a,b) where mempty = (mempty, mempty) (a1,b1) `mappend` (a2,b2) = (a1 `mappend` a2, b1 `mappend` b2) instance (Monoid a, Monoid b, Monoid c) => Monoid (a,b,c) where mempty = (mempty, mempty, mempty) (a1,b1,c1) `mappend` (a2,b2,c2) = (a1 `mappend` a2, b1 `mappend` b2, c1 `mappend` c2) instance (Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a,b,c,d) where mempty = (mempty, mempty, mempty, mempty) (a1,b1,c1,d1) `mappend` (a2,b2,c2,d2) = (a1 `mappend` a2, b1 `mappend` b2, c1 `mappend` c2, d1 `mappend` d2) instance (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a,b,c,d,e) where mempty = (mempty, mempty, mempty, mempty, mempty) (a1,b1,c1,d1,e1) `mappend` (a2,b2,c2,d2,e2) = (a1 `mappend` a2, b1 `mappend` b2, c1 `mappend` c2, d1 `mappend` d2, e1 `mappend` e2) -- lexicographical ordering instance Monoid Ordering where mempty = EQ LT `mappend` _ = LT EQ `mappend` y = y GT `mappend` _ = GT -- | Lift a semigroup into 'Maybe' forming a 'Monoid' according to -- <http://en.wikipedia.org/wiki/Monoid>: \"Any semigroup @S@ may be -- turned into a monoid simply by adjoining an element @e@ not in @S@ -- and defining @e*e = e@ and @e*s = s = s*e@ for all @s ∈ S@.\" Since -- there is no \"Semigroup\" typeclass providing just 'mappend', we -- use 'Monoid' instead. instance Monoid a => Monoid (Maybe a) where mempty = Nothing Nothing `mappend` m = m m `mappend` Nothing = m Just m1 `mappend` Just m2 = Just (m1 `mappend` m2) instance Monoid a => Applicative ((,) a) where pure x = (mempty, x) (u, f) <*> (v, x) = (u `mappend` v, f x) instance Monoid a => Monad ((,) a) where (u, a) >>= k = case k a of (v, b) -> (u `mappend` v, b) instance Monoid a => Monoid (IO a) where mempty = pure mempty mappend = liftA2 mappend {- | The 'Functor' class is used for types that can be mapped over. Instances of 'Functor' should satisfy the following laws: > fmap id == id > fmap (f . g) == fmap f . fmap g The instances of 'Functor' for lists, 'Data.Maybe.Maybe' and 'System.IO.IO' satisfy these laws. -} class Functor f where fmap :: (a -> b) -> f a -> f b -- | Replace all locations in the input with the same value. -- The default definition is @'fmap' . 'const'@, but this may be -- overridden with a more efficient version. (<$) :: a -> f b -> f a (<$) = fmap . const --infixl 4 <$ -- | A functor with application, providing operations to -- -- * embed pure expressions ('pure'), and -- -- * sequence computations and combine their results ('<*>'). -- -- A minimal complete definition must include implementations of these -- functions satisfying the following laws: -- -- [/identity/] -- -- @'pure' 'id' '<*>' v = v@ -- -- [/composition/] -- -- @'pure' (.) '<*>' u '<*>' v '<*>' w = u '<*>' (v '<*>' w)@ -- -- [/homomorphism/] -- -- @'pure' f '<*>' 'pure' x = 'pure' (f x)@ -- -- [/interchange/] -- -- @u '<*>' 'pure' y = 'pure' ('$' y) '<*>' u@ -- -- The other methods have the following default definitions, which may -- be overridden with equivalent specialized implementations: -- -- * @u '*>' v = 'pure' ('const' 'id') '<*>' u '<*>' v@ -- -- * @u '<*' v = 'pure' 'const' '<*>' u '<*>' v@ -- -- As a consequence of these laws, the 'Functor' instance for @f@ will satisfy -- -- * @'fmap' f x = 'pure' f '<*>' x@ -- -- If @f@ is also a 'Monad', it should satisfy -- -- * @'pure' = 'return'@ -- -- * @('<*>') = 'ap'@ -- -- (which implies that 'pure' and '<*>' satisfy the applicative functor laws). class Functor f => Applicative f where -- | Lift a value. pure :: a -> f a -- | Sequential application. (<*>) :: f (a -> b) -> f a -> f b -- | Sequence actions, discarding the value of the first argument. (*>) :: f a -> f b -> f b a1 *> a2 = (id <$ a1) <*> a2 -- This is essentially the same as liftA2 (const id), but if the -- Functor instance has an optimized (<$), we want to use that instead. -- | Sequence actions, discarding the value of the second argument. (<*) :: f a -> f b -> f a (<*) = liftA2 const --infixl 4 <*>, <*, *> --infixl 4 <**> -- | A variant of '<*>' with the arguments reversed. (<**>) :: Applicative f => f a -> f (a -> b) -> f b (<**>) = liftA2 (flip ($)) -- | Lift a function to actions. -- This function may be used as a value for `fmap` in a `Functor` instance. liftA :: Applicative f => (a -> b) -> f a -> f b liftA f a = pure f <*> a -- Caution: since this may be used for `fmap`, we can't use the obvious -- definition of liftA = fmap. -- | Lift a binary function to actions. liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c liftA2 f a b = fmap f a <*> b -- | Lift a ternary function to actions. liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d liftA3 f a b c = fmap f a <*> b <*> c {-# INLINEABLE liftA #-} {-# SPECIALISE liftA :: (a1->r) -> IO a1 -> IO r #-} {-# SPECIALISE liftA :: (a1->r) -> Maybe a1 -> Maybe r #-} {-# INLINEABLE liftA2 #-} {-# SPECIALISE liftA2 :: (a1->a2->r) -> IO a1 -> IO a2 -> IO r #-} {-# SPECIALISE liftA2 :: (a1->a2->r) -> Maybe a1 -> Maybe a2 -> Maybe r #-} {-# INLINEABLE liftA3 #-} {-# SPECIALISE liftA3 :: (a1->a2->a3->r) -> IO a1 -> IO a2 -> IO a3 -> IO r #-} {-# SPECIALISE liftA3 :: (a1->a2->a3->r) -> Maybe a1 -> Maybe a2 -> Maybe a3 -> Maybe r #-} -- | The 'join' function is the conventional monad join operator. It -- is used to remove one level of monadic structure, projecting its -- bound argument into the outer level. join :: (Monad m) => m (m a) -> m a join x = x >>= id {- | The 'Monad' class defines the basic operations over a /monad/, a concept from a branch of mathematics known as /category theory/. From the perspective of a Haskell programmer, however, it is best to think of a monad as an /abstract datatype/ of actions. Haskell's @do@ expressions provide a convenient syntax for writing monadic expressions. Instances of 'Monad' should satisfy the following laws: * @'return' a '>>=' k = k a@ * @m '>>=' 'return' = m@ * @m '>>=' (\x -> k x '>>=' h) = (m '>>=' k) '>>=' h@ Furthermore, the 'Monad' and 'Applicative' operations should relate as follows: * @'pure' = 'return'@ * @('<*>') = 'ap'@ The above laws imply: * @'fmap' f xs = xs '>>=' 'return' . f@ * @('>>') = ('*>')@ and that 'pure' and ('<*>') satisfy the applicative functor laws. The instances of 'Monad' for lists, 'Data.Maybe.Maybe' and 'System.IO.IO' defined in the "Prelude" satisfy these laws. -} class Applicative m => Monad m where -- | Sequentially compose two actions, passing any value produced -- by the first as an argument to the second. (>>=) :: forall a b. m a -> (a -> m b) -> m b -- | Sequentially compose two actions, discarding any value produced -- by the first, like sequencing operators (such as the semicolon) -- in imperative languages. (>>) :: forall a b. m a -> m b -> m b m >> k = m >>= \_ -> k -- See Note [Recursive bindings for Applicative/Monad] {-# INLINE (>>) #-} -- | Inject a value into the monadic type. return :: a -> m a return = pure -- | Fail with a message. This operation is not part of the -- mathematical definition of a monad, but is invoked on pattern-match -- failure in a @do@ expression. -- -- As part of the MonadFail proposal (MFP), this function is moved -- to its own class 'MonadFail' (see "Control.Monad.Fail" for more -- details). The definition here will be removed in a future -- release. fail :: String -> m a fail s = errorWithoutStackTrace s --infixl 1 >>, >>= {- Note [Recursive bindings for Applicative/Monad] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The original Applicative/Monad proposal stated that after implementation, the designated implementation of (>>) would become (>>) :: forall a b. m a -> m b -> m b (>>) = (*>) by default. You might be inclined to change this to reflect the stated proposal, but you really shouldn't! Why? Because people tend to define such instances the /other/ way around: in particular, it is perfectly legitimate to define an instance of Applicative (*>) in terms of (>>), which would lead to an infinite loop for the default implementation of Monad! And people do this in the wild. This turned into a nasty bug that was tricky to track down, and rather than eliminate it everywhere upstream, it's easier to just retain the original default. -} -- | Same as '>>=', but with the arguments interchanged. {-# SPECIALISE (=<<) :: (a -> [b]) -> [a] -> [b] #-} (=<<) :: Monad m => (a -> m b) -> m a -> m b f =<< x = x >>= f -- | Conditional execution of 'Applicative' expressions. For example, -- -- > when debug (putStrLn "Debugging") -- -- will output the string @Debugging@ if the Boolean value @debug@ -- is 'True', and otherwise do nothing. when :: (Applicative f) => Bool -> f () -> f () {-# INLINEABLE when #-} {-# SPECIALISE when :: Bool -> IO () -> IO () #-} {-# SPECIALISE when :: Bool -> Maybe () -> Maybe () #-} when p s = if p then s else pure () -- | Evaluate each action in the sequence from left to right, -- and collect the results. sequence :: Monad m => [m a] -> m [a] {-# INLINE sequence #-} sequence = mapM id -- Note: [sequence and mapM] -- | @'mapM' f@ is equivalent to @'sequence' . 'map' f@. mapM :: Monad m => (a -> m b) -> [a] -> m [b] {-# INLINE mapM #-} mapM f as = foldr k (return []) as where k a r = do { x <- f a; xs <- r; return (x:xs) } {- Note: [sequence and mapM] ~~~~~~~~~~~~~~~~~~~~~~~~~ Originally, we defined mapM f = sequence . map f This relied on list fusion to produce efficient code for mapM, and led to excessive allocation in cryptarithm2. Defining sequence = mapM id relies only on inlining a tiny function (id) and beta reduction, which tends to be a more reliable aspect of simplification. Indeed, this does not lead to similar problems in nofib. -} -- | Promote a function to a monad. liftM :: (Monad m) => (a1 -> r) -> m a1 -> m r liftM f m1 = do { x1 <- m1; return (f x1) } -- | Promote a function to a monad, scanning the monadic arguments from -- left to right. For example, -- -- > liftM2 (+) [0,1] [0,2] = [0,2,1,3] -- > liftM2 (+) (Just 1) Nothing = Nothing -- liftM2 :: (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r liftM2 f m1 m2 = do { x1 <- m1; x2 <- m2; return (f x1 x2) } -- | Promote a function to a monad, scanning the monadic arguments from -- left to right (cf. 'liftM2'). liftM3 :: (Monad m) => (a1 -> a2 -> a3 -> r) -> m a1 -> m a2 -> m a3 -> m r liftM3 f m1 m2 m3 = do { x1 <- m1; x2 <- m2; x3 <- m3; return (f x1 x2 x3) } -- | Promote a function to a monad, scanning the monadic arguments from -- left to right (cf. 'liftM2'). liftM4 :: (Monad m) => (a1 -> a2 -> a3 -> a4 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m r liftM4 f m1 m2 m3 m4 = do { x1 <- m1; x2 <- m2; x3 <- m3; x4 <- m4; return (f x1 x2 x3 x4) } -- | Promote a function to a monad, scanning the monadic arguments from -- left to right (cf. 'liftM2'). liftM5 :: (Monad m) => (a1 -> a2 -> a3 -> a4 -> a5 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m a5 -> m r liftM5 f m1 m2 m3 m4 m5 = do { x1 <- m1; x2 <- m2; x3 <- m3; x4 <- m4; x5 <- m5; return (f x1 x2 x3 x4 x5) } {-# INLINEABLE liftM #-} {-# SPECIALISE liftM :: (a1->r) -> IO a1 -> IO r #-} {-# SPECIALISE liftM :: (a1->r) -> Maybe a1 -> Maybe r #-} {-# INLINEABLE liftM2 #-} {-# SPECIALISE liftM2 :: (a1->a2->r) -> IO a1 -> IO a2 -> IO r #-} {-# SPECIALISE liftM2 :: (a1->a2->r) -> Maybe a1 -> Maybe a2 -> Maybe r #-} {-# INLINEABLE liftM3 #-} {-# SPECIALISE liftM3 :: (a1->a2->a3->r) -> IO a1 -> IO a2 -> IO a3 -> IO r #-} {-# SPECIALISE liftM3 :: (a1->a2->a3->r) -> Maybe a1 -> Maybe a2 -> Maybe a3 -> Maybe r #-} {-# INLINEABLE liftM4 #-} {-# SPECIALISE liftM4 :: (a1->a2->a3->a4->r) -> IO a1 -> IO a2 -> IO a3 -> IO a4 -> IO r #-} {-# SPECIALISE liftM4 :: (a1->a2->a3->a4->r) -> Maybe a1 -> Maybe a2 -> Maybe a3 -> Maybe a4 -> Maybe r #-} {-# INLINEABLE liftM5 #-} {-# SPECIALISE liftM5 :: (a1->a2->a3->a4->a5->r) -> IO a1 -> IO a2 -> IO a3 -> IO a4 -> IO a5 -> IO r #-} {-# SPECIALISE liftM5 :: (a1->a2->a3->a4->a5->r) -> Maybe a1 -> Maybe a2 -> Maybe a3 -> Maybe a4 -> Maybe a5 -> Maybe r #-} {- | In many situations, the 'liftM' operations can be replaced by uses of 'ap', which promotes function application. > return f `ap` x1 `ap` ... `ap` xn is equivalent to > liftMn f x1 x2 ... xn -} ap :: (Monad m) => m (a -> b) -> m a -> m b ap m1 m2 = do { x1 <- m1; x2 <- m2; return (x1 x2) } -- Since many Applicative instances define (<*>) = ap, we -- cannot define ap = (<*>) {-# INLINEABLE ap #-} {-# SPECIALISE ap :: IO (a -> b) -> IO a -> IO b #-} {-# SPECIALISE ap :: Maybe (a -> b) -> Maybe a -> Maybe b #-} -- instances for Prelude types instance Functor ((->) r) where fmap = (.) instance Applicative ((->) a) where pure = const (<*>) f g x = f x (g x) instance Monad ((->) r) where f >>= k = \ r -> k (f r) r instance Functor ((,) a) where fmap f (x,y) = (x, f y) instance Functor Maybe where fmap _ Nothing = Nothing fmap f (Just a) = Just (f a) instance Applicative Maybe where pure = Just Just f <*> m = fmap f m Nothing <*> _m = Nothing Just _m1 *> m2 = m2 Nothing *> _m2 = Nothing instance Monad Maybe where (Just x) >>= k = k x Nothing >>= _ = Nothing (>>) = (*>) fail _ = Nothing -- ----------------------------------------------------------------------------- -- The Alternative class definition --infixl 3 <|> -- | A monoid on applicative functors. -- -- If defined, 'some' and 'many' should be the least solutions -- of the equations: -- -- * @some v = (:) '<$>' v '<*>' many v@ -- -- * @many v = some v '<|>' 'pure' []@ class Applicative f => Alternative f where -- | The identity of '<|>' empty :: f a -- | An associative binary operation (<|>) :: f a -> f a -> f a -- | One or more. some :: f a -> f [a] some v = some_v where many_v = some_v <|> pure [] some_v = (fmap (:) v) <*> many_v -- | Zero or more. many :: f a -> f [a] many v = many_v where many_v = some_v <|> pure [] some_v = (fmap (:) v) <*> many_v instance Alternative Maybe where empty = Nothing Nothing <|> r = r l <|> _ = l -- ----------------------------------------------------------------------------- -- The MonadPlus class definition -- | Monads that also support choice and failure. class (Alternative m, Monad m) => MonadPlus m where -- | the identity of 'mplus'. It should also satisfy the equations -- -- > mzero >>= f = mzero -- > v >> mzero = mzero -- mzero :: m a mzero = empty -- | an associative operation mplus :: m a -> m a -> m a mplus = (<|>) instance MonadPlus Maybe ---------------------------------------------- -- The list type instance Functor [] where {-# INLINE fmap #-} fmap = map -- See Note: [List comprehensions and inlining] instance Applicative [] where {-# INLINE pure #-} pure x = [x] {-# INLINE (<*>) #-} fs <*> xs = [f x | f <- fs, x <- xs] {-# INLINE (*>) #-} xs *> ys = [y | _ <- xs, y <- ys] -- See Note: [List comprehensions and inlining] instance Monad [] where {-# INLINE (>>=) #-} xs >>= f = [y | x <- xs, y <- f x] {-# INLINE (>>) #-} (>>) = (*>) {-# INLINE fail #-} fail _ = [] instance Alternative [] where empty = [] (<|>) = (++) instance MonadPlus [] {- A few list functions that appear here because they are used here. The rest of the prelude list functions are in GHC.List. -} ---------------------------------------------- -- foldr/build/augment ---------------------------------------------- -- | 'foldr', applied to a binary operator, a starting value (typically -- the right-identity of the operator), and a list, reduces the list -- using the binary operator, from right to left: -- -- > foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...) foldr :: (a -> b -> b) -> b -> [a] -> b -- foldr _ z [] = z -- foldr f z (x:xs) = f x (foldr f z xs) {-# INLINE [0] foldr #-} -- Inline only in the final stage, after the foldr/cons rule has had a chance -- Also note that we inline it when it has *two* parameters, which are the -- ones we are keen about specialising! foldr k z = go where go [] = z go (y:ys) = y `k` go ys -- | A list producer that can be fused with 'foldr'. -- This function is merely -- -- > build g = g (:) [] -- -- but GHC's simplifier will transform an expression of the form -- @'foldr' k z ('build' g)@, which may arise after inlining, to @g k z@, -- which avoids producing an intermediate list. build :: forall a. (forall b. (a -> b -> b) -> b -> b) -> [a] {-# INLINE [1] build #-} -- The INLINE is important, even though build is tiny, -- because it prevents [] getting inlined in the version that -- appears in the interface file. If [] *is* inlined, it -- won't match with [] appearing in rules in an importing module. -- -- The "1" says to inline in phase 1 build g = g (:) [] -- | A list producer that can be fused with 'foldr'. -- This function is merely -- -- > augment g xs = g (:) xs -- -- but GHC's simplifier will transform an expression of the form -- @'foldr' k z ('augment' g xs)@, which may arise after inlining, to -- @g k ('foldr' k z xs)@, which avoids producing an intermediate list. augment :: forall a. (forall b. (a->b->b) -> b -> b) -> [a] -> [a] {-# INLINE [1] augment #-} augment g xs = g (:) xs {-# RULES "fold/build" forall k z (g::forall b. (a->b->b) -> b -> b) . foldr k z (build g) = g k z "foldr/augment" forall k z xs (g::forall b. (a->b->b) -> b -> b) . foldr k z (augment g xs) = g k (foldr k z xs) "foldr/id" foldr (:) [] = \x -> x "foldr/app" [1] forall ys. foldr (:) ys = \xs -> xs ++ ys -- Only activate this from phase 1, because that's -- when we disable the rule that expands (++) into foldr -- The foldr/cons rule looks nice, but it can give disastrously -- bloated code when commpiling -- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ] -- i.e. when there are very very long literal lists -- So I've disabled it for now. We could have special cases -- for short lists, I suppose. -- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) "foldr/single" forall k z x. foldr k z [x] = k x z "foldr/nil" forall k z. foldr k z [] = z "foldr/cons/build" forall k z x (g::forall b. (a->b->b) -> b -> b) . foldr k z (x:build g) = k x (g k z) "augment/build" forall (g::forall b. (a->b->b) -> b -> b) (h::forall b. (a->b->b) -> b -> b) . augment g (build h) = build (\c n -> g c (h c n)) "augment/nil" forall (g::forall b. (a->b->b) -> b -> b) . augment g [] = build g #-} -- This rule is true, but not (I think) useful: -- augment g (augment h t) = augment (\cn -> g c (h c n)) t ---------------------------------------------- -- map ---------------------------------------------- -- | 'map' @f xs@ is the list obtained by applying @f@ to each element -- of @xs@, i.e., -- -- > map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] -- > map f [x1, x2, ...] == [f x1, f x2, ...] map :: (a -> b) -> [a] -> [b] {-# NOINLINE [0] map #-} -- We want the RULEs "map" and "map/coerce" to fire first. -- map is recursive, so won't inline anyway, -- but saying so is more explicit, and silences warnings map _ [] = [] map f (x:xs) = f x : map f xs -- Note eta expanded mapFB :: (elt -> lst -> lst) -> (a -> elt) -> a -> lst -> lst {-# INLINE [0] mapFB #-} mapFB c f = \x ys -> c (f x) ys -- The rules for map work like this. -- -- Up to (but not including) phase 1, we use the "map" rule to -- rewrite all saturated applications of map with its build/fold -- form, hoping for fusion to happen. -- In phase 1 and 0, we switch off that rule, inline build, and -- switch on the "mapList" rule, which rewrites the foldr/mapFB -- thing back into plain map. -- -- It's important that these two rules aren't both active at once -- (along with build's unfolding) else we'd get an infinite loop -- in the rules. Hence the activation control below. -- -- The "mapFB" rule optimises compositions of map. -- -- This same pattern is followed by many other functions: -- e.g. append, filter, iterate, repeat, etc. {-# RULES "map" [~1] forall f xs. map f xs = build (\c n -> foldr (mapFB c f) n xs) "mapList" [1] forall f. foldr (mapFB (:) f) [] = map f "mapFB" forall c f g. mapFB (mapFB c f) g = mapFB c (f.g) #-} -- See Breitner, Eisenberg, Peyton Jones, and Weirich, "Safe Zero-cost -- Coercions for Haskell", section 6.5: -- http://research.microsoft.com/en-us/um/people/simonpj/papers/ext-f/coercible.pdf {-# RULES "map/coerce" [1] map coerce = coerce #-} ---------------------------------------------- -- append ---------------------------------------------- -- | Append two lists, i.e., -- -- > [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn] -- > [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...] -- -- If the first list is not finite, the result is the first list. (++) :: [a] -> [a] -> [a] {-# NOINLINE [1] (++) #-} -- We want the RULE to fire first. -- It's recursive, so won't inline anyway, -- but saying so is more explicit (++) [] ys = ys (++) (x:xs) ys = x : xs ++ ys {-# RULES "++" [~1] forall xs ys. xs ++ ys = augment (\c n -> foldr c n xs) ys #-} -- |'otherwise' is defined as the value 'True'. It helps to make -- guards more readable. eg. -- -- > f x | x < 0 = ... -- > | otherwise = ... otherwise :: Bool otherwise = True ---------------------------------------------- -- Type Char and String ---------------------------------------------- -- | A 'String' is a list of characters. String constants in Haskell are values -- of type 'String'. -- type String = [Char] unsafeChr :: Int -> Char unsafeChr (I# i#) = C# (chr# i#) -- | The 'Prelude.fromEnum' method restricted to the type 'Data.Char.Char'. ord :: Char -> Int ord (C# c#) = I# (ord# c#) -- | This 'String' equality predicate is used when desugaring -- pattern-matches against strings. eqString :: String -> String -> Bool eqString [] [] = True eqString (c1:cs1) (c2:cs2) = c1 == c2 && cs1 `eqString` cs2 eqString _ _ = False {-# RULES "eqString" (==) = eqString #-} -- eqString also has a BuiltInRule in PrelRules.lhs: -- eqString (unpackCString# (Lit s1)) (unpackCString# (Lit s2)) = s1==s2 ---------------------------------------------- -- 'Int' related definitions ---------------------------------------------- maxInt, minInt :: Int {- Seems clumsy. Should perhaps put minInt and MaxInt directly into MachDeps.h -} #if WORD_SIZE_IN_BITS == 31 minInt = I# (-0x40000000#) maxInt = I# 0x3FFFFFFF# #elif WORD_SIZE_IN_BITS == 32 minInt = I# (-0x80000000#) maxInt = I# 0x7FFFFFFF# #else minInt = I# (-0x8000000000000000#) maxInt = I# 0x7FFFFFFFFFFFFFFF# #endif ---------------------------------------------- -- The function type ---------------------------------------------- -- | Identity function. id :: a -> a id x = x -- Assertion function. This simply ignores its boolean argument. -- The compiler may rewrite it to @('assertError' line)@. -- | If the first argument evaluates to 'True', then the result is the -- second argument. Otherwise an 'AssertionFailed' exception is raised, -- containing a 'String' with the source file and line number of the -- call to 'assert'. -- -- Assertions can normally be turned on or off with a compiler flag -- (for GHC, assertions are normally on unless optimisation is turned on -- with @-O@ or the @-fignore-asserts@ -- option is given). When assertions are turned off, the first -- argument to 'assert' is ignored, and the second argument is -- returned as the result. -- SLPJ: in 5.04 etc 'assert' is in GHC.Prim, -- but from Template Haskell onwards it's simply -- defined here in Base.lhs assert :: Bool -> a -> a assert _pred r = r breakpoint :: a -> a breakpoint r = r breakpointCond :: Bool -> a -> a breakpointCond _ r = r data Opaque = forall a. O a -- | @const x@ is a unary function which evaluates to @x@ for all inputs. -- -- For instance, -- -- >>> map (const 42) [0..3] -- [42,42,42,42] const :: a -> b -> a const x _ = x -- | Function composition. {-# INLINE (.) #-} -- Make sure it has TWO args only on the left, so that it inlines -- when applied to two functions, even if there is no final argument (.) :: (b -> c) -> (a -> b) -> a -> c (.) f g = \x -> f (g x) -- | @'flip' f@ takes its (first) two arguments in the reverse order of @f@. flip :: (a -> b -> c) -> b -> a -> c flip f x y = f y x -- | Application operator. This operator is redundant, since ordinary -- application @(f x)@ means the same as @(f '$' x)@. However, '$' has -- low, right-associative binding precedence, so it sometimes allows -- parentheses to be omitted; for example: -- -- > f $ g $ h x = f (g (h x)) -- -- It is also useful in higher-order situations, such as @'map' ('$' 0) xs@, -- or @'Data.List.zipWith' ('$') fs xs@. {-# INLINE ($) #-} ($) :: (a -> b) -> a -> b f $ x = f x -- | Strict (call-by-value) application operator. It takes a function and an -- argument, evaluates the argument to weak head normal form (WHNF), then calls -- the function with that value. ($!) :: (a -> b) -> a -> b f $! x = let !vx = x in f vx -- see #2273 -- | @'until' p f@ yields the result of applying @f@ until @p@ holds. until :: (a -> Bool) -> (a -> a) -> a -> a until p f = go where go x | p x = x | otherwise = go (f x) -- | 'asTypeOf' is a type-restricted version of 'const'. It is usually -- used as an --infix operator, and its typing forces its first argument -- (which is usually overloaded) to have the same type as the second. asTypeOf :: a -> a -> a asTypeOf = const ---------------------------------------------- -- Functor/Applicative/Monad instances for IO ---------------------------------------------- instance Functor IO where fmap f x = x >>= (pure . f) instance Applicative IO where {-# INLINE pure #-} {-# INLINE (*>) #-} pure = returnIO m *> k = m >>= \ _ -> k (<*>) = ap instance Monad IO where {-# INLINE (>>) #-} {-# INLINE (>>=) #-} (>>) = (*>) (>>=) = bindIO fail s = failIO s instance Alternative IO where empty = failIO "mzero" (<|>) = mplusIO instance MonadPlus IO returnIO :: a -> IO a returnIO x = undefined -- IO (\ s -> (# s, x #)) bindIO :: IO a -> (a -> IO b) -> IO b bindIO (IO m) k = undefined -- IO (\ s -> case m s of (# new_s, a #) -> unIO (k a) new_s) thenIO :: IO a -> IO b -> IO b thenIO (IO m) k = undefined -- IO (\ s -> case m s of (# new_s, _ #) -> unIO k new_s) -- unIO :: IO a -> (State# RealWorld -> (# State# RealWorld, a #)) -- unIO (IO a) = a {- | Returns the 'tag' of a constructor application; this function is used by the deriving code for Eq, Ord and Enum. The primitive dataToTag# requires an evaluated constructor application as its argument, so we provide getTag as a wrapper that performs the evaluation before calling dataToTag#. We could have dataToTag# evaluate its argument, but we prefer to do it this way because (a) dataToTag# can be an inline primop if it doesn't need to do any evaluation, and (b) we want to expose the evaluation to the simplifier, because it might be possible to eliminate the evaluation in the case when the argument is already known to be evaluated. -} {-# INLINE getTag #-} getTag :: a -> Int# getTag !x = dataToTag# x ---------------------------------------------- -- Numeric primops ---------------------------------------------- -- Definitions of the boxed PrimOps; these will be -- used in the case of partial applications, etc. {-# INLINE quotInt #-} {-# INLINE remInt #-} quotInt, remInt, divInt, modInt :: Int -> Int -> Int (I# x) `quotInt` (I# y) = I# (x `quotInt#` y) (I# x) `remInt` (I# y) = I# (x `remInt#` y) (I# x) `divInt` (I# y) = I# (x `divInt#` y) (I# x) `modInt` (I# y) = I# (x `modInt#` y) quotRemInt :: Int -> Int -> (Int, Int) (I# x) `quotRemInt` (I# y) = case x `quotRemInt#` y of (# q, r #) -> (I# q, I# r) divModInt :: Int -> Int -> (Int, Int) (I# x) `divModInt` (I# y) = case x `divModInt#` y of (# q, r #) -> (I# q, I# r) divModInt# :: Int# -> Int# -> (# Int#, Int# #) x# `divModInt#` y# | isTrue# (x# ># 0#) && isTrue# (y# <# 0#) = case (x# -# 1#) `quotRemInt#` y# of (# q, r #) -> (# q -# 1#, r +# y# +# 1# #) | isTrue# (x# <# 0#) && isTrue# (y# ># 0#) = case (x# +# 1#) `quotRemInt#` y# of (# q, r #) -> (# q -# 1#, r +# y# -# 1# #) | otherwise = x# `quotRemInt#` y# -- Wrappers for the shift operations. The uncheckedShift# family are -- undefined when the amount being shifted by is greater than the size -- in bits of Int#, so these wrappers perform a check and return -- either zero or -1 appropriately. -- -- Note that these wrappers still produce undefined results when the -- second argument (the shift amount) is negative. -- | Shift the argument left by the specified number of bits -- (which must be non-negative). shiftL# :: Word# -> Int# -> Word# a `shiftL#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0## | otherwise = a `uncheckedShiftL#` b -- | Shift the argument right by the specified number of bits -- (which must be non-negative). -- The "RL" means "right, logical" (as opposed to RA for arithmetic) -- (although an arithmetic right shift wouldn't make sense for Word#) shiftRL# :: Word# -> Int# -> Word# a `shiftRL#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0## | otherwise = a `uncheckedShiftRL#` b -- | Shift the argument left by the specified number of bits -- (which must be non-negative). iShiftL# :: Int# -> Int# -> Int# a `iShiftL#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0# | otherwise = a `uncheckedIShiftL#` b -- | Shift the argument right (signed) by the specified number of bits -- (which must be non-negative). -- The "RA" means "right, arithmetic" (as opposed to RL for logical) iShiftRA# :: Int# -> Int# -> Int# a `iShiftRA#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = if isTrue# (a <# 0#) then (-1#) else 0# | otherwise = a `uncheckedIShiftRA#` b -- | Shift the argument right (unsigned) by the specified number of bits -- (which must be non-negative). -- The "RL" means "right, logical" (as opposed to RA for arithmetic) iShiftRL# :: Int# -> Int# -> Int# a `iShiftRL#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0# | otherwise = a `uncheckedIShiftRL#` b -- Rules for C strings (the functions themselves are now in GHC.CString) {-# RULES "unpack" [~1] forall a . unpackCString# a = build (unpackFoldrCString# a) "unpack-list" [1] forall a . unpackFoldrCString# a (:) [] = unpackCString# a "unpack-append" forall a n . unpackFoldrCString# a (:) n = unpackAppendCString# a n -- There's a built-in rule (in PrelRules.lhs) for -- unpackFoldr "foo" c (unpackFoldr "baz" c n) = unpackFoldr "foobaz" c n #-}
{ "content_hash": "b85d272dda2640bef50bf0212e14eb90", "timestamp": "", "source": "github", "line_count": 1225, "max_line_length": 123, "avg_line_length": 34.53877551020408, "alnum_prop": 0.5639092413141101, "repo_name": "antalsz/hs-to-coq", "id": "12f7ea3cac9f04d00d161a8fec524c70bb0b6262", "size": "42320", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/resources/Base.hs", "mode": "33188", "license": "mit", "language": [ { "name": "Coq", "bytes": "848322" }, { "name": "Emacs Lisp", "bytes": "2094" }, { "name": "Haskell", "bytes": "550381" }, { "name": "Makefile", "bytes": "53665" }, { "name": "Nix", "bytes": "2110" }, { "name": "Perl", "bytes": "897" }, { "name": "Ruby", "bytes": "5098" }, { "name": "Yacc", "bytes": "24851" } ], "symlink_target": "" }
declare -A params=$6 # Create an associative array paramsTXT="" if [ -n "$6" ]; then for element in "${!params[@]}" do paramsTXT="${paramsTXT} SetEnv ${element} \"${params[$element]}\"" done fi export DEBIAN_FRONTEND=noninteractive sudo service nginx stop apt-get update apt-get install -y apache2 libapache2-mod-php"$5" sed -i "s/www-data/vagrant/" /etc/apache2/envvars block="<VirtualHost *:$3> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost ServerName $1 ServerAlias www.$1 DocumentRoot "$2" $paramsTXT <Directory "$2"> AllowOverride All Require all granted </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog \${APACHE_LOG_DIR}/$1-error.log CustomLog \${APACHE_LOG_DIR}/$1-access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet " echo "$block" > "/etc/apache2/sites-available/$1.conf" ln -fs "/etc/apache2/sites-available/$1.conf" "/etc/apache2/sites-enabled/$1.conf" blockssl="<IfModule mod_ssl.c> <VirtualHost *:$4> ServerAdmin webmaster@localhost ServerName $1 ServerAlias www.$1 DocumentRoot "$2" $paramsTXT <Directory "$2"> AllowOverride All Require all granted </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog \${APACHE_LOG_DIR}/$1-error.log CustomLog \${APACHE_LOG_DIR}/$1-access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # A self-signed (snakeoil) certificate can be created by installing # the ssl-cert package. See # /usr/share/doc/apache2/README.Debian.gz for more info. # If both key and certificate are stored in the same file, only the # SSLCertificateFile directive is needed. #SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem #SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key SSLCertificateFile /etc/nginx/ssl/$1.crt SSLCertificateKeyFile /etc/nginx/ssl/$1.key # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt # Certificate Authority (CA): # Set the CA certificate verification path where to find CA # certificates for client authentication or alternatively one # huge file containing all of them (file must be PEM encoded) # Note: Inside SSLCACertificatePath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCACertificatePath /etc/ssl/certs/ #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt # Certificate Revocation Lists (CRL): # Set the CA revocation path where to find CA CRLs for client # authentication or alternatively one huge file containing all # of them (file must be PEM encoded) # Note: Inside SSLCARevocationPath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCARevocationPath /etc/apache2/ssl.crl/ #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl #SSLVerifyClient require #SSLVerifyDepth 10 <FilesMatch \"\.(cgi|shtml|phtml|php)$\"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> BrowserMatch \"MSIE [2-6]\" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # MSIE 7 and newer should be able to use keepalive BrowserMatch \"MSIE [17-9]\" ssl-unclean-shutdown </VirtualHost> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet " echo "$blockssl" > "/etc/apache2/sites-available/$1-ssl.conf" ln -fs "/etc/apache2/sites-available/$1-ssl.conf" "/etc/apache2/sites-enabled/$1-ssl.conf" a2dissite 000-default ps auxw | grep apache2 | grep -v grep > /dev/null # Assume user wants mode_rewrite support sudo a2enmod rewrite # Turn on HTTPS support sudo a2enmod ssl service apache2 restart if [ $? == 0 ] then service apache2 reload fi
{ "content_hash": "b684b80f463f447d56322efbb60fa998", "timestamp": "", "source": "github", "line_count": 175, "max_line_length": 90, "avg_line_length": 36.85142857142857, "alnum_prop": 0.6653744766630485, "repo_name": "shadow-droid/laravel-homestead", "id": "71099314c7cdc202259da919e44924f3767d3499", "size": "6470", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "scripts/serve-apache.sh", "mode": "33261", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "265" }, { "name": "PHP", "bytes": "45128" }, { "name": "Ruby", "bytes": "15570" }, { "name": "Shell", "bytes": "29908" } ], "symlink_target": "" }
<?php namespace Application\Migrations; use Doctrine\DBAL\Migrations\AbstractMigration, Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your need! */ class Version20121120134630 extends AbstractMigration { public function up(Schema $schema) { // this up() migration is autogenerated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql"); $this->addSql("ALTER TABLE lecture ADD seo_title VARCHAR(255) DEFAULT NULL"); $this->addSql("ALTER TABLE lecture ADD seo_description TEXT DEFAULT NULL"); $this->addSql("ALTER TABLE lecture ADD seo_keywords TEXT DEFAULT NULL"); } public function down(Schema $schema) { // this down() migration is autogenerated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql"); $this->addSql("ALTER TABLE lecture DROP seo_title"); $this->addSql("ALTER TABLE lecture DROP seo_description"); $this->addSql("ALTER TABLE lecture DROP seo_keywords"); } }
{ "content_hash": "5f94ccab4340a9c484d8f776aa5e29e9", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 92, "avg_line_length": 36.28125, "alnum_prop": 0.6761412575366064, "repo_name": "damedia/culture.ru", "id": "aae1227b4add209654141fae5f70d3c18cc9cf98", "size": "1161", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/DoctrineMigrations/Version20121120134630.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1823103" }, { "name": "JavaScript", "bytes": "4818245" }, { "name": "PHP", "bytes": "2439432" }, { "name": "Perl", "bytes": "60" }, { "name": "Ruby", "bytes": "2913" }, { "name": "Shell", "bytes": "800" } ], "symlink_target": "" }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.appservice.fluent.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** * The IP Addresses and Ports that require inbound network access to and within the subnet of the App Service * Environment. */ @Fluent public final class InboundEnvironmentEndpointInner { /* * Short text describing the purpose of the network traffic. */ @JsonProperty(value = "description") private String description; /* * The IP addresses that network traffic will originate from in cidr * notation. */ @JsonProperty(value = "endpoints") private List<String> endpoints; /* * The ports that network traffic will arrive to the App Service * Environment at. */ @JsonProperty(value = "ports") private List<String> ports; /** * Get the description property: Short text describing the purpose of the network traffic. * * @return the description value. */ public String description() { return this.description; } /** * Set the description property: Short text describing the purpose of the network traffic. * * @param description the description value to set. * @return the InboundEnvironmentEndpointInner object itself. */ public InboundEnvironmentEndpointInner withDescription(String description) { this.description = description; return this; } /** * Get the endpoints property: The IP addresses that network traffic will originate from in cidr notation. * * @return the endpoints value. */ public List<String> endpoints() { return this.endpoints; } /** * Set the endpoints property: The IP addresses that network traffic will originate from in cidr notation. * * @param endpoints the endpoints value to set. * @return the InboundEnvironmentEndpointInner object itself. */ public InboundEnvironmentEndpointInner withEndpoints(List<String> endpoints) { this.endpoints = endpoints; return this; } /** * Get the ports property: The ports that network traffic will arrive to the App Service Environment at. * * @return the ports value. */ public List<String> ports() { return this.ports; } /** * Set the ports property: The ports that network traffic will arrive to the App Service Environment at. * * @param ports the ports value to set. * @return the InboundEnvironmentEndpointInner object itself. */ public InboundEnvironmentEndpointInner withPorts(List<String> ports) { this.ports = ports; return this; } /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } }
{ "content_hash": "9dbb2626a53b716a01ee42f5066e8f96", "timestamp": "", "source": "github", "line_count": 104, "max_line_length": 110, "avg_line_length": 29.60576923076923, "alnum_prop": 0.6716466385189996, "repo_name": "Azure/azure-sdk-for-java", "id": "bbce265c706e4f96b99b610854ee8307f084367f", "size": "3079", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "sdk/resourcemanager/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/fluent/models/InboundEnvironmentEndpointInner.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "8762" }, { "name": "Bicep", "bytes": "15055" }, { "name": "CSS", "bytes": "7676" }, { "name": "Dockerfile", "bytes": "2028" }, { "name": "Groovy", "bytes": "3237482" }, { "name": "HTML", "bytes": "42090" }, { "name": "Java", "bytes": "432409546" }, { "name": "JavaScript", "bytes": "36557" }, { "name": "Jupyter Notebook", "bytes": "95868" }, { "name": "PowerShell", "bytes": "737517" }, { "name": "Python", "bytes": "240542" }, { "name": "Scala", "bytes": "1143898" }, { "name": "Shell", "bytes": "18488" }, { "name": "XSLT", "bytes": "755" } ], "symlink_target": "" }
#include "zlib.h" extern int arm_cpu_enable_crc32; #if defined(STARBOARD) extern int arm_cpu_enable_neon; #endif extern int arm_cpu_enable_pmull; void arm_check_features(void);
{ "content_hash": "03888482aef508c4b01d12a78065595d", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 32, "avg_line_length": 16.454545454545453, "alnum_prop": 0.7513812154696132, "repo_name": "youtube/cobalt", "id": "d10047970a6f980c39bb086eb97886c5b81e4783", "size": "434", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "third_party/zlib/arm_features.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
require 'parchment/helpers' module Parchment # A "run" of text within a Paragraph. Each run may have its own style # attributes different from that of the Paragraph. These are iterated # through to generate a line of formatted output. # class TextRun include Parchment::Helpers # (Style) The primary Style for the TextRun. attr_reader :style def initialize(paragraph, document) raise MissingFormatterMethodError unless @node @content = @node.content @default_font_size = paragraph.font_size end # The font size of the TextRun. Will return the Paragraph's default # font size if not defined. # def font_size @style.font_size || @default_font_size end # This is a method constructor which creates Boolean methods (e.g. bold?, # italic?) based on the available formatting options defined in Style. # Parchment::Style::AVAILABLE_FORMATTING.each do |styling| define_method("#{styling}?") { style.public_send("#{styling}?") } end # Output the unformatted TextRun's content as a String. # def to_s @content end alias :text :to_s # Return a HTML element String with formatting based on the TextRun's # properties. # def to_html html = @content html = html_tag(:em, content: html) if italic? html = html_tag(:strong, content: html) if bold? styles = {} styles['text-decoration'] = 'underline' if underline? # No need to be granular with font size down to the span level if it doesn't vary. styles['font-size'] = "#{font_size}pt" if font_size != @default_font_size html = html_tag(:span, content: html, styles: styles) unless styles.empty? return html end end end
{ "content_hash": "ea8a2b324a365784c0773070f335cc79", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 88, "avg_line_length": 31.94736842105263, "alnum_prop": 0.6397583745194948, "repo_name": "apetlock/parchment", "id": "def04b4d7694fa64540195a5734108440226a5b0", "size": "1821", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/parchment/text_run.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "33360" } ], "symlink_target": "" }
namespace StevenVolckaert { using System; /// <summary> /// Converts a unit of measurement to an equivalent unit of measurement. /// </summary> public static class UnitConvert { private const double MillimetersPerInch = 25.4; private const double MillimetersPerFoot = MillimetersPerInch * 12; private const double MillimetersPerYard = MillimetersPerFoot * 3; /// <summary> /// The millimeters per DTP point. The DTP is defined as 1⁄72 of an international inch /// (exactly 25.4 mm). /// </summary> /// <remarks> /// See https://en.wikipedia.org/wiki/Point_(typography) for more information. /// </remarks> private const double MillimetersPerPoint = MillimetersPerInch / 72; private const double MetersPerFoot = MillimetersPerFoot / 1000; private const double MetersPerYard = MillimetersPerYard / 1000; /// <summary> /// Converts a value in degrees Celsius (°C) to its equivalent in degrees Fahrenheit (°F). /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in degrees Fahrenheit (°F).</returns> public static int FromCelsiusToFahrenheit(int value) { return FromCelsiusToFahrenheit((double)value); } /// <summary> /// Converts a value in degrees Celsius (°C) to its equivalent in degrees Fahrenheit (°F). /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in degrees Fahrenheit (°F).</returns> public static int FromCelsiusToFahrenheit(double value) { var calculatedValue = 9 / (decimal)5 * (decimal)value + 32; return Convert.ToInt32(Math.Round(calculatedValue)); } /// <summary> /// Converts a value in degrees Fahrenheit (°F) to its equivalent in degrees Celsius (°C). /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in degrees Celsius (°C)</returns> public static int FromFahrenheitToCelsius(int value) { return FromFahrenheitToCelsius((double)value); } /// <summary> /// Converts a value in degrees Fahrenheit (°F) to its equivalent in degrees Celsius (°C). /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in degrees Celsius (°C)</returns> public static int FromFahrenheitToCelsius(double value) { var calculatedValue = 5 / (decimal)9 * ((decimal)value - 32); return Convert.ToInt32(Math.Round(calculatedValue)); } /// <summary> /// Converts a value in feet to its equivalent in meters. /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in meters.</returns> public static double FromFeetToMeters(int value) { return FromFeetToMeters((double)value); } /// <summary> /// Converts a value in feet to its equivalent in meters. /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in meters.</returns> public static double FromFeetToMeters(double value) { return value * MetersPerFoot; } /// <summary> /// Converts a value in international inches to its equivalent in millimeters. /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in millimeters.</returns> public static double FromInchesToMillimeters(double value) { return value * MillimetersPerInch; } /// <summary> /// Converts a value in meters to its equivalent in feet. /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in feet.</returns> public static double FromMetersToFeet(int value) { return FromMetersToFeet((double)value); } /// <summary> /// Converts a value in meters to its equivalent in feet. /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in feet.</returns> public static double FromMetersToFeet(double value) { return value / MetersPerFoot; } /// <summary> /// Converts a value in millimeters to its equivalent in international inches. /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in international inches.</returns> public static double FromMillimetersToInches(double value) { return value / MillimetersPerInch; } /// <summary> /// Converts a value in millimeters to its equivalent in DTPs (Desktop Publishing Points). /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in DTPs (Desktop Publishing Points).</returns> public static double FromMillimetersToPoints(double value) { return value / MillimetersPerPoint; } /// <summary> /// Converts a value in DTPs (Desktop Publishing Points) to its equivalent in millimeters. /// </summary> /// <param name="value">The value to convert.</param> /// <returns>The value in millimeters.</returns> public static double FromPointsToMillimeters(double value) { return value * MillimetersPerPoint; } } }
{ "content_hash": "defb212f6683b89ea4c4ff901eb70880", "timestamp": "", "source": "github", "line_count": 148, "max_line_length": 102, "avg_line_length": 39.37837837837838, "alnum_prop": 0.5854495538778312, "repo_name": "stevenvolckaert/enterprise-library", "id": "1bad77d447c9970f13bb21d651d2dff76b9213e4", "size": "5844", "binary": false, "copies": "1", "ref": "refs/heads/feature/v1.3.0", "path": "src/StevenVolckaert.Core/UnitConvert.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "211669" } ], "symlink_target": "" }
<?php class Conekta_PlanTest extends UnitTestCase { public function testSuccesfulGetPlan() { setApiKey(); $plans = Conekta_Plan::where(); $p = $plans[0]; $plan = Conekta_Plan::find($p->id); $this->assertTrue(strpos(get_class($plan), "Conekta_Plan") !== false); } public function testSuccesfulWhere() { setApiKey(); $plans = Conekta_Plan::where(); $this->assertTrue(strpos(get_class($plans), "Conekta_Object") !== false); $this->assertTrue(strpos(get_class($plans[0]), "Conekta_Plan") !== false); } public function testSuccesfulPlanCreate() { setApiKey(); $plans = Conekta_Plan::where(); $plan = Conekta_Plan::create(array( 'id' => "gold-plan". substr( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ,mt_rand( 0 ,50 ) ,1 ) .substr( md5( time() ), 1), 'name' => "Gold Plan", 'amount' => 10000, 'currency' => "MXN", 'interval' => "month", 'frequency' => 10, 'trial_period_days' => 15, 'expiry_count' => 12 ) ); $this->assertTrue(strpos(get_class($plan), "Conekta_Plan") !== false); } public function testUpdatePlan() { setApiKey(); $plans = Conekta_Plan::where(); $plan = $plans[0]; $plan->update(array('name' => "Silver Plan")); $this->assertTrue(strpos($plan->name, "Silver Plan") !== false); } public function testDeletePlan() { setApiKey(); $plans = Conekta_Plan::where(); $plan = $plans[0]; $plan->delete(); $this->assertTrue($plan->deleted == true); } } ?>
{ "content_hash": "859560bad5ef90d83b4ff904755b2608", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 142, "avg_line_length": 27.462962962962962, "alnum_prop": 0.6163182737693864, "repo_name": "julianceballos/conekta-php", "id": "c83163609e873a2d8aea8de564829591ffef840f", "size": "1483", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "test/Conekta/PlanTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "40511" } ], "symlink_target": "" }
import os from distutils.core import setup from setuptools import find_packages def package_files(directory): paths = [] for (path, directories, filenames) in os.walk(directory): for filename in filenames: paths.append(os.path.join('..', path, filename)) return paths extra_files = package_files('minecraft_data/data/data') setup( name='minecraft_data', description='Provide easy access to minecraft data in python', license='MIT', long_description=open('README.rst').read(), version='2.89.2', maintainer='Vito Gamberini', maintainer_email='[email protected]', url='https://github.com/SpockBotMC/python-minecraft-data', packages=find_packages(), package_data={'minecraft_data': extra_files}, install_requires=[], keywords=['minecraft'], classifiers=[ 'License :: OSI Approved :: MIT License', ], )
{ "content_hash": "6fcf694580a94b681ca7060e0956f806", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 66, "avg_line_length": 26.58823529411765, "alnum_prop": 0.6670353982300885, "repo_name": "rom1504/python-minecraft-data", "id": "d3976de49fb85ade8e92ad46311ff7dbe73d21a5", "size": "904", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "setup.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "3694" } ], "symlink_target": "" }
<?php use kartik\select2\Select2; use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model app\models\Matapelajaran */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="matapelajaran-form"> <?php $form = ActiveForm::begin([ //'id' => 'search-form', 'method' => 'post', 'action' => $model->isNewRecord ? ['create'] : ['update', 'id' => $model->matapelajaran], //'action' => ['create'] ]);?> <div class="row"> <div class="col-sm-2"> <?php //$form->field($model, 'id_jurusan')->textInput() ?> <!-- ?= $form->field($model,'id_jurusan')->dropDownList( \app\models\Data::jurusan(), ['prompt'=>'Pilih Jurusan...'])->label('Jurusan'); ?> --> <?php // Normal select with ActiveForm & model echo $form->field($model, 'id_jurusan')->widget(Select2::classname(), [ 'data' => \app\models\Data::jurusan(), 'language' => 'en', 'options' => ['placeholder' => 'Pilih Jurusan...'], 'pluginOptions' => [ 'allowClear' => true, ], ])->label('Jurusan'); ?> </div> <div class="col-sm-2"> <?=$form->field($model, 'id_matapelajaran')->textInput()?> </div> <div class="col-sm-2"> <?=$form->field($model, 'matapelajaran')->textInput(['maxlength' => true])?> </div> </div> <div class="form-group"> <?=Html::submitButton($model->isNewRecord ? 'INPUT' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary'])?> </div> <?php ActiveForm::end();?> </div>
{ "content_hash": "69a658f0ef77c76efce48f0a38fee945", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 147, "avg_line_length": 32.18, "alnum_prop": 0.5357364822871349, "repo_name": "cakpepp/spk-penjurusan-ahp", "id": "b70044484e4a6ebc3b8bf6d0741587258c58a55a", "size": "1609", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "backend/views/matapelajaran/_form.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "1026" }, { "name": "CSS", "bytes": "2777" }, { "name": "PHP", "bytes": "356751" }, { "name": "PLpgSQL", "bytes": "65452" } ], "symlink_target": "" }