repo_name
stringlengths
6
101
path
stringlengths
4
300
text
stringlengths
7
1.31M
LiFantastic/LeetCode
#046.cpp
<filename>#046.cpp /*============================================================ Problem: Permutations ============================================================== Given a collection of numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1]. ============================================================*/ class Solution { private: vector<vector<int> > res; vector<int> tmp; vector<bool> notused; void dfs(vector<int>& nums) { if (tmp.size() == nums.size()) { res.push_back(tmp); return; } for (int i=0; i<nums.size(); i++) { if (notused[i]) { notused[i] = false; tmp.push_back(nums[i]); dfs(nums); notused[i] = true; tmp.pop_back(); } } } public: vector<vector<int>> permute(vector<int> &nums) { notused = vector<bool>(nums.size(), true); dfs(nums); return res; } };
dp50mm/hyperobjects-language
src/geometry/Line.js
import Geometry from './Geometry' import PathFunctions from './path/PathFunctions' import PathBooleans from './path/PathBooleans' import Point from './Point' import { LINE } from "./types" import _ from "lodash" function line_intersect(x1, y1, x2, y2, x3, y3, x4, y4) { var ua, ub, denom = (y4 - y3)*(x2 - x1) - (x4 - x3)*(y2 - y1); if (denom == 0) { return null; } ua = ((x4 - x3)*(y1 - y3) - (y4 - y3)*(x1 - x3))/denom; ub = ((x2 - x1)*(y1 - y3) - (y2 - y1)*(x1 - x3))/denom; return { x: x1 + ua * (x2 - x1), y: y1 + ua * (y2 - y1), seg1: ua >= 0 && ua <= 1, seg2: ub >= 0 && ub <= 1 }; } function Line(points, name, attributes) { Geometry.call(this, points, name, attributes) PathFunctions.call(this) PathBooleans.call(this) this.type = LINE if(this.points.length > 2) { this.points = this.points.slice(0, 2) } this._showExtend = true this.showExtend = function(_showExtend) { this._showExtend = _showExtend return this } // returns the points for a line within the bounds this.extendToBounds = function(bounds) { const p1 = _.get(this, "points[0]", false) const p2 = _.get(this, "points[1]", false) if(!_.every([p1, p2])) { return [new Point({x: 0, y: 0}), new Point({x: 0, y: 0})] } return [ new Point({x: p1.x - 10000, y: p1.y}).rotate(-p1.getAngle(p2) + Math.PI * 0.5, p1) ,new Point({x: p1.x + 10000, y: p1.y}).rotate(-p1.getAngle(p2) + Math.PI * 0.5, p1) ] } this.lineIntersect = function(secondLine) { return line_intersect( this.points[0].x, this.points[0].y, this.points[1].x, this.points[1].y, secondLine.points[0].x, secondLine.points[0].y, secondLine.points[1].x, secondLine.points[1].y, ) } this.angleToLine = function(secondLine) { if(this.points.length !== 2) { return 0 } if(secondLine.points.length !== 2) { return 0 } const A1x = this.points[0].x const A1y = this.points[0].y const A2x = this.points[1].x const A2y = this.points[1].y const B1x = secondLine.points[0].x const B1y = secondLine.points[0].y const B2x = secondLine.points[1].x const B2y = secondLine.points[1].y const dAx = A2x - A1x; const dAy = A2y - A1y; const dBx = B2x - B1x; const dBy = B2y - B1y; var angle = Math.atan2(dAx * dBy - dAy * dBx, dAx * dBx + dAy * dBy); if(angle < 0) {angle = angle * -1;} return angle } } export default Line
mvachhani/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/dataset/BaseDatasetDescriptor.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.gobblin.service.modules.dataset; import java.io.IOException; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; import org.apache.gobblin.service.modules.flowgraph.DatasetDescriptorConfigKeys; import org.apache.gobblin.util.ConfigUtils; @EqualsAndHashCode (exclude = {"description", "rawConfig"}) @ToString (exclude = {"description", "rawConfig"}) public abstract class BaseDatasetDescriptor implements DatasetDescriptor { @Getter private final String platform; @Getter private final FormatConfig formatConfig; @Getter private final boolean isRetentionApplied; @Getter private final String description; @Getter private final Config rawConfig; private static final Config DEFAULT_FALLBACK = ConfigFactory.parseMap(ImmutableMap.<String, Object>builder() .put(DatasetDescriptorConfigKeys.PATH_KEY, DatasetDescriptorConfigKeys.DATASET_DESCRIPTOR_CONFIG_ANY) .put(DatasetDescriptorConfigKeys.IS_RETENTION_APPLIED_KEY, false) .build()); public BaseDatasetDescriptor(Config config) throws IOException { Preconditions.checkArgument(config.hasPath(DatasetDescriptorConfigKeys.PLATFORM_KEY), "Dataset descriptor config must specify platform"); this.platform = config.getString(DatasetDescriptorConfigKeys.PLATFORM_KEY).toLowerCase(); this.formatConfig = new FormatConfig(config); this.isRetentionApplied = ConfigUtils.getBoolean(config, DatasetDescriptorConfigKeys.IS_RETENTION_APPLIED_KEY, false); this.description = ConfigUtils.getString(config, DatasetDescriptorConfigKeys.DESCRIPTION_KEY, ""); this.rawConfig = config.withFallback(this.formatConfig.getRawConfig()).withFallback(DEFAULT_FALLBACK); } /** * {@inheritDoc} */ protected abstract boolean isPathContaining(String otherPath); /** * @return true if this {@link DatasetDescriptor} contains the other {@link DatasetDescriptor} i.e. the * datasets described by this {@link DatasetDescriptor} is a subset of the datasets described by the other * {@link DatasetDescriptor}. This operation is non-commutative. * @param other */ @Override public boolean contains(DatasetDescriptor other) { if (this == other) { return true; } if (other == null || !getClass().equals(other.getClass())) { return false; } if (this.getPlatform() == null || !this.getPlatform().equalsIgnoreCase(other.getPlatform())) { return false; } if ((this.isRetentionApplied() != other.isRetentionApplied())) { return false; } return isPathContaining(other.getPath()) && getFormatConfig().contains(other.getFormatConfig()); } }
TheChosenEvilOne/MindustryFork
core/src/io/anuke/mindustry/ui/fragments/HudFragment.java
<reponame>TheChosenEvilOne/MindustryFork package io.anuke.mindustry.ui.fragments; import static io.anuke.mindustry.Vars.*; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import io.anuke.mindustry.Mindustry; import io.anuke.mindustry.Vars; import io.anuke.mindustry.core.GameState; import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.GameMode; import io.anuke.ucore.core.Core; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Settings; import io.anuke.ucore.scene.actions.Actions; import io.anuke.ucore.scene.builders.imagebutton; import io.anuke.ucore.scene.builders.label; import io.anuke.ucore.scene.builders.table; import io.anuke.ucore.scene.event.Touchable; import io.anuke.ucore.scene.ui.Image; import io.anuke.ucore.scene.ui.Label; import io.anuke.ucore.scene.ui.layout.Cell; import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Unit; public class HudFragment implements Fragment{ private Table itemtable, respawntable; private Cell<Table> itemcell; public void build(){ //menu at top left new table(){{ atop(); aleft(); new table(){{ left(); defaults().size(68).units(Unit.dp).left(); float isize = Unit.dp.inPixels(40); new imagebutton("icon-menu", isize, ()->{ ui.showMenu(); }); new imagebutton("icon-settings", isize, ()->{ ui.showPrefs(); }); new imagebutton("icon-pause", isize, ()->{ GameState.set(GameState.is(State.paused) ? State.playing : State.paused); }){{ get().update(()->{ get().getStyle().imageUp = Core.skin.getDrawable(GameState.is(State.paused) ? "icon-play" : "icon-pause"); }); }}; }}.end(); row(); new table(){{ get().setTouchable(Touchable.enabled); addWaveTable(); }}.fillX().end(); row(); itemtable = new table("button").end().top().left().fillX().size(-1).get(); itemtable.setTouchable(Touchable.enabled); itemtable.setVisible(()-> control.getMode() != GameMode.sandbox); itemcell = get().getCell(itemtable); get().setVisible(()->!GameState.is(State.menu)); Label fps = new Label(()->(Settings.getBool("fps") ? (Gdx.graphics.getFramesPerSecond() + " FPS") : "")); row(); add(fps).size(-1); }}.end(); //ui table new table(){{ control.getTutorial().buildUI(this); visible(()->control.getTutorial().active()); }}.end(); //paused table new table(){{ visible(()->GameState.is(State.paused)); atop(); new table("pane"){{ new label("[orange]< paused >").scale(Unit.dp.inPixels(0.75f)).pad(6).units(Unit.dp); }}.end(); }}.end(); //wave table... new table(){{ if(!Vars.android){ atop(); aright(); }else{ abottom(); aleft(); } //addWaveTable(); visible(()->!GameState.is(State.menu)); }}.end(); //respawn background table new table("white"){{ respawntable = get(); respawntable.setColor(Color.CLEAR); }}.end(); //respawn table new table(){{ new table("pane"){{ new label(()->"[orange]Respawning in " + (int)(control.getRespawnTime()/60)).scale(0.75f).pad(10); visible(()->control.getRespawnTime() > 0 && !GameState.is(State.menu)); }}.end(); }}.end(); //profiling table if(debug){ new table(){{ abottom(); aleft(); new label(()->"[purple]tiles: " + Vars.control.tileGroup.amount()).left(); row(); new label(()->"[purple]enemies: " + Vars.control.enemyGroup.amount()).left(); row(); new label(()->"[orange]noclip: " + Vars.noclip).left(); row(); new label("[red]DEBUG MODE").scale(0.5f).left(); }}.end(); } } private String printEnemiesRemaining() { if(control.getEnemiesRemaining() == 1) { return " enemy left"; } else return " enemies left"; } private void addWaveTable(){ float uheight = 66f; new table("button"){{ aleft(); new table(){{ aleft(); new label(()->"[orange]Wave " + control.getWave()).scale(fontscale*1.5f).left(); row(); new label(()-> control.getEnemiesRemaining() > 0 ? control.getEnemiesRemaining() + printEnemiesRemaining() : (control.getTutorial().active() || Vars.control.getMode() == GameMode.sandbox) ? "waiting..." : "Wave in " + (int) (control.getWaveCountdown() / 60f)) .minWidth(140).units(Unit.dp).left(); get().pad(Unit.dp.inPixels(12)); get().padLeft(6); }}.left().end(); playButton(uheight); }}.height(uheight).units(Unit.dp).fillX().expandX().end(); } private void playButton(float uheight){ new imagebutton("icon-play", Unit.dp.inPixels(30f), ()->{ Vars.control.runWave(); }).height(uheight).fillX().right().padTop(-8f).padBottom(-12f).padRight(-36) .padLeft(-10f).width(40f).units(Unit.dp).update(l->{ boolean vis = Vars.control.getMode() == GameMode.sandbox && Vars.control.getEnemiesRemaining() <= 0; boolean paused = GameState.is(State.paused) || !vis; l.setVisible(vis); l.getStyle().imageUp = Core.skin.getDrawable(vis ? "icon-play" : "clear"); l.setTouchable(!paused ? Touchable.enabled : Touchable.disabled); }); } public void updateItems(){ itemtable.clear(); itemtable.left(); if(control.getMode() == GameMode.sandbox){ return; } Item[] items = Item.values(); for(int i = 0; i < control.getItems().length; i ++){ int amount = control.getItems()[i]; if(amount == 0) continue; String formatted = Mindustry.formatter.format(amount); if(amount > 99999999){ formatted = "inf"; } Image image = new Image(Draw.region("icon-" + items[i])); Label label = new Label(formatted); label.setFontScale(fontscale*1.5f); itemtable.add(image).size(8*3).units(Unit.dp); itemtable.add(label).left(); itemtable.row(); } } public void fadeRespawn(boolean in){ respawntable.addAction(Actions.color(in ? new Color(0, 0, 0, 0.3f) : Color.CLEAR, 0.3f)); } }
aliyun/aliyun-openapi-cpp-sdk
companyreg/src/model/GetTaxInfoRequest.cc
<gh_stars>10-100 /* * Copyright 2009-2017 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/companyreg/model/GetTaxInfoRequest.h> using AlibabaCloud::Companyreg::Model::GetTaxInfoRequest; GetTaxInfoRequest::GetTaxInfoRequest() : RpcServiceRequest("companyreg", "2020-10-22", "GetTaxInfo") { setMethod(HttpRequest::Method::Get); } GetTaxInfoRequest::~GetTaxInfoRequest() {} std::string GetTaxInfoRequest::getCityArea()const { return cityArea_; } void GetTaxInfoRequest::setCityArea(const std::string& cityArea) { cityArea_ = cityArea; setParameter("CityArea", cityArea); } std::string GetTaxInfoRequest::getBizId()const { return bizId_; } void GetTaxInfoRequest::setBizId(const std::string& bizId) { bizId_ = bizId; setParameter("BizId", bizId); } std::string GetTaxInfoRequest::getPeriods()const { return periods_; } void GetTaxInfoRequest::setPeriods(const std::string& periods) { periods_ = periods; setParameter("Periods", periods); }
danielkolesnik/java-api-base-ui
src/reducers/app.js
<reponame>danielkolesnik/java-api-base-ui import { APP } from '../actions/types'; const initial = { health: false, auth: false, ready: false, user: null, }; export default function (state = initial, action) { const { type, ...options } = action; switch (type) { default: break; case APP.INIT.FINISH: state = { ...state, ...options, ready: true }; break; case APP.SIGN_IN.SUCCESS: console.log(options.user); state = { ...state, ...options, auth: true }; break; case APP.SIGN_OUT.FINISH: case APP.GET_SELF.ERROR: case APP.SIGN_IN.ERROR: state = { ...state, ...options, user: null, auth: false }; break; case APP.HEALTH.SUCCESS: state = { ...state, ...options, health: true }; break; case APP.HEALTH.ERROR: state = { ...state, ...initial, health: false }; break; } // /@app/.test(type) // &&console.log(`%c REDUCER ${action.type} `, 'color: #fff; background: #232323; font-size: 18px;' // , '\n state:', state // , '\n action:', action // // ,'\n arguments:', arguments // ); return state; }
uikino/UDRefl-xmake-fork
src/test/ext/00_bootstrap/main.cpp
#include <UDRefl/UDRefl.hpp> #include <UDRefl_ext/Bootstrap.h> #include <iostream> using namespace Ubpa; using namespace Ubpa::UDRefl; struct A { float data; }; int main() { Mngr.RegisterType<A>(); Mngr.AddField<&A::data>("data"); Ubpa_UDRefl_ext_Bootstrap(); A a; ObjectView{ a }.Var("data") = 3; std::cout << a.data << std::endl; auto data = MngrView.Invoke<ObjectView>("Var", TempArgsView{ a, Name{ "data" } }); data = 4; std::cout << a.data << std::endl; return 0; }
gb-archive/really-old-stuff
megadrive/genesisrpgcreator_0.05_alpha_src/editor/GenesisRPGCreator/tiled/mapeditor/widget/IntegerSpinner.java
/* * Tiled Map Editor, (c) 2004 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * <NAME> <<EMAIL>> * <NAME> <<EMAIL>> */ package tiled.mapeditor.widget; import java.awt.Dimension; import javax.swing.JSpinner; import javax.swing.SpinnerNumberModel; /** * The integer spinner is a variation on the JSpinner that is only to be used * for plain integer inputs. It offers some convenience constructors and * methods. */ public class IntegerSpinner extends JSpinner { public IntegerSpinner() { super(new SpinnerNumberModel()); setPreferredSize(new Dimension(60, getPreferredSize().height)); } public IntegerSpinner(int val, int min, int max) { super(new SpinnerNumberModel(val, min, max, 1)); setPreferredSize(new Dimension(60, getPreferredSize().height)); } public IntegerSpinner(int val, int min) { this(val, min, Integer.MAX_VALUE); } public void setValue(int value) { setValue(new Integer(value)); } public int intValue() { return ((Number)getValue()).intValue(); } }
pkavumba/arxiv-vanity-restful-api
arxiv_vanity/settings.py
""" For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os from django.core.exceptions import ImproperlyConfigured import environ import logging import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration env = environ.Env() # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = env("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.bool("DEBUG", default=False) ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["localhost", "web"]) # Application definition INSTALLED_APPS = [ "whitenoise.runserver_nostatic", "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.sitemaps", "django.contrib.staticfiles", "django.contrib.humanize", "django_rangepaginator", "arxiv_vanity.feedback", "arxiv_vanity.papers", "arxiv_vanity.scraper", "rest_framework", "rest_framework_api_key", "corsheaders", ] MIDDLEWARE = [ "corsheaders.middleware.CorsMiddleware", "django.middleware.security.SecurityMiddleware", "whitenoise.middleware.WhiteNoiseMiddleware", #  after SecurityMiddleware "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", ] ROOT_URLCONF = "arxiv_vanity.urls" APPEND_SLASH = True CORS_ALLOW_CREDENTIALS = True CORS_ORIGIN_ALLOW_ALL = True TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", "DIRS": [os.path.join(BASE_DIR, "arxiv_vanity/templates")], "APP_DIRS": True, "OPTIONS": { "context_processors": [ "django.template.context_processors.debug", "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", "arxiv_vanity.context_processors.extra_settings", ] }, } ] WSGI_APPLICATION = "arxiv_vanity.wsgi.application" # Database # https://docs.djangoproject.com/en/1.9/ref/settings/#databases DATABASES = { "default": env.db("DATABASE_URL", default="psql://postgres@db:5432/postgres") } DATABASES["default"].update( { "ENGINE": "django_db_geventpool.backends.postgresql_psycopg2", "ATOMIC_REQUESTS": False, "CONN_MAX_AGE": 0, "OPTIONS": {"MAX_CONNS": env.int("DATABASE_MAX_CONNS", default=4)}, } ) # Password validation # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators # AUTH_PASSWORD_VALIDATORS = [ { "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator" }, {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"}, {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"}, {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"}, ] AUTHENTICATION_BACKENDS = ("django.contrib.auth.backends.ModelBackend",) LOGIN_REDIRECT_URL = "/" # LOGIN_URL = '/login/' # Internationalization # https://docs.djangoproject.com/en/1.9/topics/i18n/ LANGUAGE_CODE = "en-us" TIME_ZONE = "UTC" USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.9/howto/static-files/ # STATIC_URL = "/static/" if not DEBUG: STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" STATICFILES_DIRS = [os.path.join(BASE_DIR, "arxiv_vanity/static")] STATIC_ROOT = os.path.join(BASE_DIR, "arxiv_vanity/static_root") # Uploaded files, including paper source and rendered articles MEDIA_USE_S3 = env.bool("MEDIA_USE_S3", default=False) if MEDIA_USE_S3: DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" AWS_ACCESS_KEY_ID = env("AWS_ACCESS_KEY_ID") AWS_SECRET_ACCESS_KEY = env("AWS_SECRET_ACCESS_KEY") AWS_STORAGE_BUCKET_NAME = env("AWS_STORAGE_BUCKET_NAME") AWS_S3_REGION_NAME = env("AWS_S3_REGION_NAME") AWS_DEFAULT_ACL = "public-read" AWS_BUCKET_ACL = "public-read" MEDIA_URL = env( "MEDIA_URL", default=f"https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/" ) else: MEDIA_ROOT = os.path.join(BASE_DIR, "media") MEDIA_URL = "/media/" # Log everything to the console, including tracebacks LOGGING = { "version": 1, "disable_existing_loggers": False, "root": {"handlers": ["console"], "level": "DEBUG"}, "handlers": { "console": { "level": os.getenv("DJANGO_LOG_LEVEL", "INFO"), "class": "logging.StreamHandler", "formatter": "simple", } }, "formatters": { "verbose": { "format": "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", "datefmt": "%d/%b/%Y %H:%M:%S", }, "simple": {"format": "%(levelname)s %(message)s"}, }, } # Suppress "Starting new HTTPS connection" messages logging.getLogger("requests.packages.urllib3.connectionpool").setLevel(logging.ERROR) SENTRY_DSN = env("SENTRY_DSN", default="") if SENTRY_DSN: sentry_sdk.init(dsn=SENTRY_DSN, integrations=[DjangoIntegration()]) # SSL ENABLE_SSL = env.bool("ENABLE_SSL", default=False) SESSION_COOKIE_SECURE = ENABLE_SSL CSRF_COOKIE_SECURE = ENABLE_SSL # SECURE_SSL_REDIRECT = ENABLE_SSL if ENABLE_SSL: SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") # Paper rendering # HACK: If image is set to blank string in environment, resolve default. # django-environ's defaults only work if envvar is actually unset ENGRAFO_IMAGE = env("ENGRAFO_IMAGE", default="") or "arxivvanity/engrafo:latest" # The prefix to use for Engrafo webhooks ENGRAFO_WEBHOOK_URL_PREFIX = env( "ENGRAFO_WEBHOOK_URL_PREFIX", default="http://web:8000" ) BIBLIO_GLUTTON_URL = env("BIBLIO_GLUTTON_URL", default="") GROBID_URL = env("GROBID_URL", default="") ENGRAFO_SENTRY_DSN = env("ENGRAFO_SENTRY_DSN", default="") # Analytics GOOGLE_ANALYTICS_PROPERTY_ID = env("GOOGLE_ANALYTICS_PROPERTY_ID", default="") MIXPANEL_TOKEN = env("MIXPANEL_TOKEN", default="") # Paper feedback GITHUB_ACCESS_TOKEN = env("GITHUB_ACCESS_TOKEN", default="") FEEDBACK_REPO_NAME = env("FEEDBACK_REPO_NAME", default="arxiv-vanity/engrafo-issues") FEEDBACK_PROJECT_ID = env.int("FEEDBACK_PROJECT_ID", default=808447) FEEDBACK_COLUMN_ID = env.int("FEEDBACK_COLUMN_ID", default=1339203) # Papers PAPERS_MACHINE_LEARNING_CATEGORIES = [ "cs.CV", "cs.AI", "cs.LG", "cs.CL", "cs.NE", "stat.ML", ] # Number of days after which to re-render papers PAPERS_EXPIRED_DAYS = env.int("PAPERS_EXPIRED_DAYS", default=7) # Caching PAPER_CACHE_SECONDS = env.int("PAPER_CACHE_SECONDS", default=60) ROOT_URL = env("ROOT_URL", default="http://localhost:8000") RANGE_PAGINATOR_TEMPLATE = "django_rangepaginator/bootstrap4.html" # Max number of renders to run in parallel PAPERS_MAX_RENDERS_RUNNING = env.int("PAPERS_MAX_RENDERS_RUNNING", default=100) # Max time a render can run in mins PAPERS_MAX_RENDER_TIME_MINS = env.int("PAPERS_MAX_RENDER_TIME_MINS", default=10) SITEMAP_LIMIT = env.int("SITEMAP_LIMIT", default=45000) REST_FRAMEWORK = { # Use Django's standard `django.contrib.auth` permissions, # or allow read-only access for unauthenticated users. "DEFAULT_AUTHENTICATION_CLASSES": ( "rest_framework.authentication.TokenAuthentication", "rest_framework.authentication.BasicAuthentication", "rest_framework.authentication.SessionAuthentication", ), "DEFAULT_PERMISSION_CLASSES": [ "rest_framework_api_key.permissions.HasAPIKey", "rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly", ], "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination", "PAGE_SIZE": 10, "DEFAULT_FILTER_BACKENDS": ("django_filters.rest_framework.DjangoFilterBackend",), } MANAGERS = env.list("ADMINS", default=[("admin", "")])
ws1993/licia
src/PriorityQueue.js
<gh_stars>1000+ /* Priority queue implementation. * * ### size * * Queue size. * * ### constructor * * |Name |Desc | * |-----|----------| * |cmp |Comparator| * * ### clear * * Clear the queue. * * ### enqueue * * Add an item to the queue. * * |Name |Desc | * |------|------------| * |item |Item to add | * |return|Current size| * * ### dequeue * * Retrieve and remove the highest priority item of the queue. * * ### peek * * Same as dequeue, but does not remove the item. */ /* example * const queue = new PriorityQueue(function(a, b) { * if (a.priority > b.priority) return 1; * if (a.priority === b.priority) return -1; * return 0; * }); * queue.enqueue({ * priority: 1000, * value: 'apple' * }); * queue.enqueue({ * priority: 500, * value: 'orange' * }); * queue.dequeue(); // -> { priority: 1000, value: 'apple' } */ /* module * env: all * since: 1.11.0 */ /* typescript * export declare class PriorityQueue { * size: number; * constructor(cmp?: types.AnyFn); * clear(): void; * enqueue(item: any): number; * dequeue(): any; * peek(): any; * } */ _('Class Heap isSorted wrap types'); exports = Class({ initialize: function PriorityQueue(cmp = isSorted.defComparator) { this._heap = new Heap(wrap(cmp, (fn, a, b) => fn(a, b) * -1)); this.size = 0; }, clear() { this._heap.clear(); this.size = 0; }, enqueue(item) { this._heap.add(item); this.size++; return this.size; }, dequeue() { const item = this._heap.poll(); if (item) { this.size--; return item; } }, peek() { return this._heap.peek(); } });
JeromeDuboisPro/framework
arcane/src/arcane/ServiceFinder2.h
<reponame>JeromeDuboisPro/framework // -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*- //----------------------------------------------------------------------------- // Copyright 2000-2021 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com) // See the top-level COPYRIGHT file for details. // SPDX-License-Identifier: Apache-2.0 //----------------------------------------------------------------------------- /*---------------------------------------------------------------------------*/ /* ServiceFinder2.h (C) 2000-2019 */ /* */ /* Classe pour trouver un service donné. */ /*---------------------------------------------------------------------------*/ #ifndef ARCANE_SERVICEFINDER2_H #define ARCANE_SERVICEFINDER2_H /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #include "arcane/utils/String.h" #include "arcane/utils/Array.h" #include "arcane/utils/Collection.h" #include "arcane/utils/Enumerator.h" #include "arcane/IServiceInfo.h" #include "arcane/IFactoryService.h" #include "arcane/IApplication.h" #include "arcane/IServiceFactory.h" #include "arcane/IServiceMng.h" #include "arcane/ServiceBuildInfo.h" #include "arcane/ServiceInstance.h" #include <set> /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ namespace Arcane { namespace Internal { /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /*! * \internal * \brief Classe utilitaire pour retrouver un ou plusieurs services * implémentant l'interface \a InterfaceType. */ template<typename InterfaceType> class ServiceFinderBase2T { public: typedef IServiceFactory2T<InterfaceType> FactoryType; public: ServiceFinderBase2T(IApplication* app,const ServiceBuildInfoBase& sbi) : m_application(app), m_service_build_info_base(sbi) { } virtual ~ServiceFinderBase2T(){} public: /*! * \brief Créé une instance du service \a name. * * Retourne nul si aucun service de ce nom n'existe. * * \deprecated Utiliser createReference() à la place. */ ARCCORE_DEPRECATED_2019("Use createReference() instead") virtual InterfaceType* create(const String& name) { return _create(name,m_service_build_info_base); } /*! * \brief Créé une instance du service \a name. * * Retourne une référence nulle si aucun service de ce nom n'existe. */ virtual Ref<InterfaceType> createReference(const String& name) { return _createReference(name,m_service_build_info_base); } /*! * \brief Créé une instance du service \a name pour le maillage \a mesh. * * Cela n'est valide que pour les services de sous-domaine. Pour les autres, * cela est sans effet. * L'appelant doit détruire ces services. * Retourne nul si aucun service de ce nom n'existe. * * \deprecated Utiliser createReference() à la place. */ ARCCORE_DEPRECATED_2019("Use createReference() instead") virtual InterfaceType* create(const String& name,IMesh* mesh) { ISubDomain* sd = m_service_build_info_base.subDomain(); if (!sd) return {}; if (mesh) return _create(name,ServiceBuildInfoBase(sd,mesh)); return _create(name,ServiceBuildInfoBase(sd)); } /*! * \brief Créé une instance du service \a name pour le maillage \a mesh. * * Cela n'est valide que pour les services de sous-domaine. Pour les autres, * cela est sans effet. * L'appelant doit détruire ces services. * Retourne nul si aucun service de ce nom n'existe. */ virtual Ref<InterfaceType> createReference(const String& name,IMesh* mesh) { ISubDomain* sd = m_service_build_info_base.subDomain(); if (!sd) return {}; if (mesh) return _createReference(name,ServiceBuildInfoBase(sd,mesh)); return _createReference(name,ServiceBuildInfoBase(sd)); } /*! * \brief Instance singleton du service ayant pour interface \a InterfaceType. * * Retourne nul si aucun service n'est trouvé */ virtual InterfaceType* getSingleton() { IServiceMng* sm = m_service_build_info_base.serviceParent()->serviceMng(); SingletonServiceInstanceCollection singleton_services = sm->singletonServices(); for( typename SingletonServiceInstanceCollection::Enumerator i(singleton_services); ++i; ){ ISingletonServiceInstance* ssi = (*i).get(); if (ssi){ for( typename ServiceInstanceCollection::Enumerator k(ssi->interfaceInstances()); ++k; ){ IServiceInstance* sub_isi = (*k).get(); auto m = dynamic_cast< IServiceInstanceT<InterfaceType>* >(sub_isi); if (m) return m->instance().get(); } } } return nullptr; } /*! * \brief Créé une instance de chaque service qui implémente \a InterfaceType. * * L'appelant doit détruire ces services via l'appel à 'operator delete'. * * \deprecated Utilise ls surcharge prenant en argument un tableau de références. */ ARCCORE_DEPRECATED_2019("Use createAll(Array<ServiceRef<InterfaceType>>&) instead") virtual void createAll(Array<InterfaceType*>& instances) { _createAll(instances,m_service_build_info_base); } /*! * \brief Créé une instance de chaque service qui implémente \a InterfaceType. */ virtual UniqueArray<Ref<InterfaceType>> createAll() { return _createAll(m_service_build_info_base); } public: SharedArray<FactoryType*> factories() { SharedArray<FactoryType*> m_factories; for( typename ServiceFactory2Collection::Enumerator j(this->m_application->serviceFactories2()); ++j; ){ IServiceFactory2* sf2 = *j; IServiceFactory2T<InterfaceType>* m = dynamic_cast< IServiceFactory2T<InterfaceType>* >(sf2); //m_application->traceMng()->info() << " FOUND sf2=" << sf2 << " M=" << m; if (m){ m_factories.add(m); } } return m_factories.constView(); } void getServicesNames(Array<String>& names) const { for( typename ServiceFactory2Collection::Enumerator j(this->m_application->serviceFactories2()); ++j; ){ IServiceFactory2* sf2 = *j; IServiceFactory2T<InterfaceType>* true_factory = dynamic_cast< IServiceFactory2T<InterfaceType>* >(sf2); if (true_factory){ IServiceInfo* si = sf2->serviceInfo(); names.add(si->localName()); } } } protected: InterfaceType* _create(const String& name,const ServiceBuildInfoBase& sbib) { return _createReference(name,sbib)._release(); } Ref<InterfaceType> _createReference(const String& name,const ServiceBuildInfoBase& sbib) { for( typename ServiceFactory2Collection::Enumerator j(this->m_application->serviceFactories2()); ++j; ){ Internal::IServiceFactory2* sf2 = *j; IServiceInfo* s = sf2->serviceInfo(); if (s->localName()!=name) continue; IServiceFactory2T<InterfaceType>* m = dynamic_cast< IServiceFactory2T<InterfaceType>* >(sf2); //m_application->traceMng()->info() << " FOUND sf2=" << sf2 << " M=" << m; if (m){ Ref<InterfaceType> tt = m->createServiceReference(sbib); if (!tt.isNull()) return tt; } } return {}; } void _createAll(Array<InterfaceType*>& instances,const ServiceBuildInfoBase& sbib) { UniqueArray<Ref<InterfaceType>> ref_instances = _createAll(sbib); for( auto& x : ref_instances ) instances.add(x._release()); } UniqueArray<Ref<InterfaceType>> _createAll(const ServiceBuildInfoBase& sbib) { UniqueArray<Ref<InterfaceType>> instances; for( typename ServiceFactory2Collection::Enumerator j(this->m_application->serviceFactories2()); ++j; ){ Internal::IServiceFactory2* sf2 = *j; IServiceFactory2T<InterfaceType>* m = dynamic_cast< IServiceFactory2T<InterfaceType>* >(sf2); if (m){ Ref<InterfaceType> tt = m->createServiceReference(sbib); if (tt.get()){ instances.add(tt); } } } return instances; } protected: IApplication* m_application; ServiceBuildInfoBase m_service_build_info_base; }; /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ } // End namespace Internal /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /*! * \brief Classe utilitaire pour retrouver un ou plusieurs services * implémentant l'interface \a InterfaceType. * \deprecated Cette classe ne doit plus être utilisée directement. * Il faut utiliser à la place ServiceBuilder. */ template<typename InterfaceType,typename ParentType> class ServiceFinder2T : public Internal::ServiceFinderBase2T<InterfaceType> { public: ServiceFinder2T(IApplication* app,ParentType* parent) : Internal::ServiceFinderBase2T<InterfaceType>(app,ServiceBuildInfoBase(parent)) { } ~ServiceFinder2T(){} public: }; /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ } // End namespace Arcane /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #endif
zipated/src
components/offline_pages/core/offline_page_feature.h
<reponame>zipated/src // Copyright 2015 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. #ifndef COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_FEATURE_H_ #define COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_FEATURE_H_ #include "base/feature_list.h" #include "build/build_config.h" namespace offline_pages { extern const base::Feature kOfflineBookmarksFeature; extern const base::Feature kOffliningRecentPagesFeature; extern const base::Feature kOfflinePagesSvelteConcurrentLoadingFeature; extern const base::Feature kOfflinePagesCTFeature; extern const base::Feature kOfflinePagesSharingFeature; extern const base::Feature kBackgroundLoaderForDownloadsFeature; extern const base::Feature kPrefetchingOfflinePagesFeature; extern const base::Feature kOfflinePagesLoadSignalCollectingFeature; extern const base::Feature kOfflinePagesCTV2Feature; extern const base::Feature kOfflinePagesRenovationsFeature; extern const base::Feature kOfflinePagesResourceBasedSnapshotFeature; extern const base::Feature kOfflinePagesPrefetchingUIFeature; extern const base::Feature kOfflinePagesLimitlessPrefetchingFeature; extern const base::Feature kOfflinePagesDescriptivePendingStatusFeature; extern const base::Feature kOfflinePagesInDownloadHomeOpenInCctFeature; extern const base::Feature kOfflinePagesDescriptiveFailStatusFeature; extern const base::Feature kOfflinePagesCTSuppressNotificationsFeature; extern const base::Feature kOfflinePagesShowAlternateDinoPageFeature; // The parameter name used to find the experiment tag for prefetching offline // pages. extern const char kPrefetchingOfflinePagesExperimentsOption[]; // Returns true if saving bookmarked pages for offline viewing is enabled. bool IsOfflineBookmarksEnabled(); // Returns true if offlining of recent pages (aka 'Last N pages') is enabled. bool IsOffliningRecentPagesEnabled(); // Returns true if offline CT features are enabled. See crbug.com/620421. bool IsOfflinePagesCTEnabled(); // Returns true if offline page sharing is enabled. bool IsOfflinePagesSharingEnabled(); // Returns true if saving a foreground tab that is taking too long using the // background scheduler is enabled. bool IsBackgroundLoaderForDownloadsEnabled(); // Returns true if concurrent background loading is enabled for svelte. bool IsOfflinePagesSvelteConcurrentLoadingEnabled(); // Returns true if prefetching offline pages is enabled. bool IsPrefetchingOfflinePagesEnabled(); // Returns true if we should show UI for prefetched pages. bool IsOfflinePagesPrefetchingUIEnabled(); // Returns true if prefetching offline pages should ignore its normal resource // usage limits. bool IsLimitlessPrefetchingEnabled(); // Returns true if we enable load timing signals to be collected. bool IsOfflinePagesLoadSignalCollectingEnabled(); // Returns true if we should use the "page renovation" framework in // the BackgroundLoaderOffliner. bool IsOfflinePagesRenovationsEnabled(); // Returns true if we should use the "Resource percentage signal" for taking // snapshots instead of a time delay after the document is loaded in the main // frame. bool IsOfflinePagesResourceBasedSnapshotEnabled(); // Returns true if a command line for test has been set that shortens the // snapshot delay. bool ShouldUseTestingSnapshotDelay(); // Returns true if we should record request origin as part of custom tabs V2. bool IsOfflinePagesCTV2Enabled(); // Returns true if descriptive failed download status texts should be used in // notifications and Downloads Home. bool IsOfflinePagesDescriptiveFailStatusEnabled(); // Returns true if descriptive pending download status texts should be used in // notifications and Downloads Home. bool IsOfflinePagesDescriptivePendingStatusEnabled(); // Controls whether offline pages opened from the Downloads Home should be // opened in CCTs instead of new tabs. bool ShouldOfflinePagesInDownloadHomeOpenInCct(); // Returns true if we should suppress completed notifications for certain custom // tabs downloads. bool IsOfflinePagesSuppressNotificationsEnabled(); // Controls whether we should show a dinosaur page with alternate UI. bool ShouldShowAlternateDinoPage(); // Returns an experiment tag provided by the field trial. This experiment tag // will be included in a custom header in all requests sent to Offline Prefetch // Server. The server will use this this optional tag to decide how to process // the request. std::string GetPrefetchingOfflinePagesExperimentTag(); } // namespace offline_pages #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_FEATURE_H_
cacao-soft/RMVX
Shadow.rb
#============================================================================= # [RGSS2] 自動影機能の回避 - v1.0.2 # --------------------------------------------------------------------------- # Copyright (c) 2021 CACAO # Released under the MIT License. # https://opensource.org/licenses/mit-license.php # --------------------------------------------------------------------------- # [Twitter] https://twitter.com/cacao_soft/ # [GitHub] https://github.com/cacao-soft/ #============================================================================= =begin -- 概 要 ---------------------------------------------------------------- 影が自動で追加されるのを回避します。 -- 注意事項 ---------------------------------------------------------------- ※ 再定義を行っております。なるべく上の方に設置してください。 -- 使用方法 ---------------------------------------------------------------- ★ 影を描画しない マップ名の先頭に "$" を記述する。 もしくは、マップ名に "<%no_shadow>" か "<%無影>" を記述する。 =end module CAO module SD #============================================================================== # ◆ ユーザー設定 #============================================================================== # 影を自動で表示する DISPLAY = true #/////////////////////////////////////////////////////////////////////////////# # # # 下記のスクリプトを変更する必要はありません。 # # # #/////////////////////////////////////////////////////////////////////////////# $data_mapinfos = load_data("Data/MapInfos.rvdata") if $data_mapinfos.nil? def self.map_data return Cache.map_data unless CAO::SD::DISPLAY name = $data_mapinfos[$game_map.map_id].name return Cache.map_data if /(?:^\$|<%(?:no_shadow|無影)>)/ =~ name return $game_map.data end end end module Cache #-------------------------------------------------------------------------- # ◎ タイルマップの保存 #-------------------------------------------------------------------------- def self.map_data @map_data = {} if @map_data.nil? unless @map_data.include?($game_map.map_id) map_data = $game_map.data for x in 0...map_data.xsize for y in 0...map_data.ysize if (4352..8191) === map_data[x, y, 0] map_data[x, y, 1] = map_data[x, y, 0] map_data[x, y, 0] = 0 end end end @map_data[$game_map.map_id] = map_data end return @map_data[$game_map.map_id] end end class Spriteset_Map #-------------------------------------------------------------------------- # ○ タイルマップの作成 #-------------------------------------------------------------------------- def create_tilemap @tilemap = Tilemap.new(@viewport1) @tilemap.bitmaps[0] = Cache.system("TileA1") @tilemap.bitmaps[1] = Cache.system("TileA2") @tilemap.bitmaps[2] = Cache.system("TileA3") @tilemap.bitmaps[3] = Cache.system("TileA4") @tilemap.bitmaps[4] = Cache.system("TileA5") @tilemap.bitmaps[5] = Cache.system("TileB") @tilemap.bitmaps[6] = Cache.system("TileC") @tilemap.bitmaps[7] = Cache.system("TileD") @tilemap.bitmaps[8] = Cache.system("TileE") @tilemap.map_data = CAO::SD.map_data @tilemap.passages = $game_map.passages end end
Darlingnotin/Antisocial_VR
libraries/script-engine/src/DataViewPrototype.h
// // DataViewPrototype.h // // // Created by Clement on 7/8/14. // Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #ifndef hifi_DataViewPrototype_h #define hifi_DataViewPrototype_h #include <QtCore/QObject> #include <QtScript/QScriptable> class DataViewPrototype : public QObject, public QScriptable { Q_OBJECT public: DataViewPrototype(QObject* parent = NULL); public slots: // Gets the value of the given type at the specified byte offset // from the start of the view. There is no alignment constraint; // multi-byte values may be fetched from any offset. // // For multi-byte values, the optional littleEndian argument // indicates whether a big-endian or little-endian value should be // read. If false or undefined, a big-endian value is read. // // These methods raise an exception if they would read // beyond the end of the view. qint32 getInt8(qint32 byteOffset); quint32 getUint8(qint32 byteOffset); qint32 getInt16(qint32 byteOffset, bool littleEndian = false); quint32 getUint16(qint32 byteOffset, bool littleEndian = false); qint32 getInt32(qint32 byteOffset, bool littleEndian = false); quint32 getUint32(qint32 byteOffset, bool littleEndian = false); QScriptValue getFloat32(qint32 byteOffset, bool littleEndian = false); QScriptValue getFloat64(qint32 byteOffset, bool littleEndian = false); // Stores a value of the given type at the specified byte offset // from the start of the view. There is no alignment constraint; // multi-byte values may be stored at any offset. // // For multi-byte values, the optional littleEndian argument // indicates whether the value should be stored in big-endian or // little-endian byte order. If false or undefined, the value is // stored in big-endian byte order. // // These methods raise an exception if they would write // beyond the end of the view. void setInt8(qint32 byteOffset, qint32 value); void setUint8(qint32 byteOffset, quint32 value); void setInt16(qint32 byteOffset, qint32 value, bool littleEndian = false); void setUint16(qint32 byteOffset, quint32 value, bool littleEndian = false); void setInt32(qint32 byteOffset, qint32 value, bool littleEndian = false); void setUint32(qint32 byteOffset, quint32 value, bool littleEndian = false); void setFloat32(qint32 byteOffset, float value, bool littleEndian = false); void setFloat64(qint32 byteOffset, double value, bool littleEndian = false); private: QByteArray* thisArrayBuffer() const; bool realOffset(qint32& offset, size_t size) const; }; #endif // hifi_DataViewPrototype_h
cliff363825/TwentyFour
01_Language/03_Java/j2ee/src/test/java/com/onevgo/bookstore/TradeDAOTest.java
<filename>01_Language/03_Java/j2ee/src/test/java/com/onevgo/bookstore/TradeDAOTest.java<gh_stars>1-10 package com.onevgo.bookstore; import com.onevgo.bookstore.dao.TradeDAO; import com.onevgo.bookstore.dao.impl.TradeDAOImpl; import com.onevgo.bookstore.domain.Trade; import org.junit.Test; import java.sql.Date; import java.util.Set; public class TradeDAOTest { private TradeDAO tradeDAO = new TradeDAOImpl(); @Test public void testInsertTrade() { Trade trade = new Trade(); trade.setUserId(3); trade.setTradeTime(new Date(new java.util.Date().getTime())); tradeDAO.insert(trade); } @Test public void testGetTradesWithUserId() { Set<Trade> trades = tradeDAO.getTradesWithUserId(2); System.out.println(trades); } }
ACPK/atc
scheduler/scheduler.go
package scheduler import ( "sync" "time" "github.com/pivotal-golang/lager" "github.com/concourse/atc" "github.com/concourse/atc/config" "github.com/concourse/atc/db" "github.com/concourse/atc/db/algorithm" "github.com/concourse/atc/engine" ) //go:generate counterfeiter . PipelineDB type PipelineDB interface { CreateJobBuild(job string) (db.Build, error) CreateJobBuildForCandidateInputs(job string) (db.Build, bool, error) ScheduleBuild(buildID int, jobConfig atc.JobConfig) (bool, error) GetJobBuildForInputs(job string, inputs []db.BuildInput) (db.Build, bool, error) GetNextPendingBuild(job string) (db.Build, bool, error) LoadVersionsDB() (*algorithm.VersionsDB, error) GetLatestInputVersions(versions *algorithm.VersionsDB, job string, inputs []config.JobInput) ([]db.BuildInput, bool, error) SaveResourceVersions(atc.ResourceConfig, []atc.Version) error UseInputsForBuild(buildID int, inputs []db.BuildInput) error } //go:generate counterfeiter . BuildsDB type BuildsDB interface { LeaseBuildScheduling(buildID int, interval time.Duration) (db.Lease, bool, error) GetAllStartedBuilds() ([]db.Build, error) ErrorBuild(buildID int, err error) error } //go:generate counterfeiter . BuildFactory type BuildFactory interface { Create(atc.JobConfig, atc.ResourceConfigs, []db.BuildInput) atc.Plan } type Waiter interface { Wait() } //go:generate counterfeiter . Scanner type Scanner interface { Scan(lager.Logger, string) error } type Scheduler struct { PipelineDB PipelineDB BuildsDB BuildsDB Factory BuildFactory Engine engine.Engine Scanner Scanner } func (s *Scheduler) BuildLatestInputs(logger lager.Logger, versions *algorithm.VersionsDB, job atc.JobConfig, resources atc.ResourceConfigs) error { logger = logger.Session("build-latest") inputs := config.JobInputs(job) if len(inputs) == 0 { // no inputs; no-op return nil } latestInputs, found, err := s.PipelineDB.GetLatestInputVersions(versions, job.Name, inputs) if err != nil { logger.Error("failed-to-get-latest-input-versions", err) return err } if !found { logger.Debug("no-input-versions-available") return nil } checkInputs := []db.BuildInput{} for _, input := range latestInputs { for _, ji := range inputs { if ji.Name == input.Name { if ji.Trigger { checkInputs = append(checkInputs, input) } break } } } if len(checkInputs) == 0 { logger.Debug("no-triggered-input-versions") return nil } existingBuild, found, err := s.PipelineDB.GetJobBuildForInputs(job.Name, checkInputs) if err != nil { logger.Error("could-not-determine-if-inputs-are-already-used", err) return err } if found { logger.Debug("build-already-exists-for-inputs", lager.Data{ "existing-build": existingBuild.ID, }) return nil } build, created, err := s.PipelineDB.CreateJobBuildForCandidateInputs(job.Name) if err != nil { logger.Error("failed-to-create-build", err) return err } if !created { logger.Debug("waiting-for-existing-build-to-determine-inputs", lager.Data{ "existing-build": build.ID, }) return nil } logger.Debug("created-build", lager.Data{"build": build.ID}) // NOTE: this is intentionally serial within a scheduler tick, so that // multiple ATCs don't do redundant work to determine a build's inputs. s.scheduleAndResumePendingBuild(logger, versions, build, job, resources) return nil } func (s *Scheduler) TryNextPendingBuild(logger lager.Logger, versions *algorithm.VersionsDB, job atc.JobConfig, resources atc.ResourceConfigs) Waiter { logger = logger.Session("try-next-pending") wg := new(sync.WaitGroup) wg.Add(1) go func() { defer wg.Done() build, found, err := s.PipelineDB.GetNextPendingBuild(job.Name) if err != nil { logger.Error("failed-to-get-next-pending-build", err) return } if !found { return } s.scheduleAndResumePendingBuild(logger, versions, build, job, resources) }() return wg } func (s *Scheduler) TriggerImmediately(logger lager.Logger, job atc.JobConfig, resources atc.ResourceConfigs) (db.Build, Waiter, error) { logger = logger.Session("trigger-immediately") build, err := s.PipelineDB.CreateJobBuild(job.Name) if err != nil { logger.Error("failed-to-create-build", err) return db.Build{}, nil, err } wg := new(sync.WaitGroup) wg.Add(1) // do not block request on scanning input versions go func() { defer wg.Done() s.scheduleAndResumePendingBuild(logger, nil, build, job, resources) }() return build, wg, nil } func (s *Scheduler) scheduleAndResumePendingBuild(logger lager.Logger, versions *algorithm.VersionsDB, build db.Build, job atc.JobConfig, resources atc.ResourceConfigs) engine.Build { lease, acquired, err := s.BuildsDB.LeaseBuildScheduling(build.ID, 10*time.Second) if err != nil { logger.Error("failed-to-get-lease", err) return nil } if !acquired { return nil } defer lease.Break() logger = logger.WithData(lager.Data{"build": build.ID}) scheduled, err := s.PipelineDB.ScheduleBuild(build.ID, job) if err != nil { logger.Error("failed-to-schedule-build", err) return nil } if !scheduled { logger.Debug("build-could-not-be-scheduled") return nil } buildInputs := config.JobInputs(job) if versions == nil { for _, input := range buildInputs { scanLog := logger.Session("scan", lager.Data{ "input": input.Name, "resource": input.Resource, }) err := s.Scanner.Scan(scanLog, input.Resource) if err != nil { scanLog.Error("failed-to-scan", err) err := s.BuildsDB.ErrorBuild(build.ID, err) if err != nil { logger.Error("failed-to-mark-build-as-errored", err) } return nil } scanLog.Info("done") } loadStart := time.Now() vLog := logger.Session("loading-versions") vLog.Info("start") versions, err = s.PipelineDB.LoadVersionsDB() if err != nil { vLog.Error("failed", err) return nil } vLog.Info("done", lager.Data{"took": time.Since(loadStart).String()}) } inputs, found, err := s.PipelineDB.GetLatestInputVersions(versions, job.Name, buildInputs) if err != nil { logger.Error("failed-to-get-latest-input-versions", err) return nil } if !found { logger.Debug("no-input-versions-available") return nil } err = s.PipelineDB.UseInputsForBuild(build.ID, inputs) if err != nil { logger.Error("failed-to-use-inputs-for-build", err) return nil } plan := s.Factory.Create(job, resources, inputs) createdBuild, err := s.Engine.CreateBuild(logger, build, plan) if err != nil { logger.Error("failed-to-create-build", err) return nil } if createdBuild != nil { logger.Info("building") go createdBuild.Resume(logger) } return createdBuild }
yuil-intern/Object_Oriented_Programming_C_Plus_Plus
Lesson 2 - C++ Basic IO/013 - print all natural numbers upto 10 (using for loop)/main.cpp
<reponame>yuil-intern/Object_Oriented_Programming_C_Plus_Plus #include <iostream> using namespace std; main() { int i; for ( i = 1; i <= 10; i++) { cout << i << endl; } }
kikislater/OTB
Modules/Filtering/Path/test/otbPolyLineImageConstIterator.cxx
<filename>Modules/Filtering/Path/test/otbPolyLineImageConstIterator.cxx /* * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) * * This file is part of Orfeo Toolbox * * https://www.orfeo-toolbox.org/ * * 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. */ #include "itkMacro.h" #include "otbPolyLineImageIterator.h" #include "itkPolyLineParametricPath.h" #include "otbImage.h" #include <fstream> int otbPolyLineImageConstIterator(int argc, char * argv[]) { if (argc != 5) { std::cout << "Usgage: " << argv[0] << " sizex sizey nbpoints outfname" << std::endl; return EXIT_SUCCESS; } const unsigned int sizex = atoi(argv[1]); const unsigned int sizey = atoi(argv[2]); const unsigned int nbpoints = atoi(argv[3]); const char * outfname = argv[4]; const unsigned int Dimension = 2; typedef unsigned char PixelType; typedef otb::Image<PixelType, Dimension> ImageType; typedef itk::PolyLineParametricPath<Dimension> PathType; typedef PathType::VertexType VertexType; typedef otb::PolyLineImageConstIterator<ImageType, PathType> ConstIteratorType; ImageType::SizeType size; size[0] = sizex; size[1] = sizey; ImageType::IndexType index; index.Fill(0); ImageType::RegionType region; region.SetSize(size); region.SetIndex(index); ImageType::Pointer image = ImageType::New(); image->SetRegions(region); image->Allocate(); image->FillBuffer(255); PathType::Pointer path = PathType::New(); for (unsigned int i = 1; i < nbpoints; ++i) { VertexType vertex1, vertex2; vertex1[0] = 0; vertex1[1] = i * sizey / nbpoints; vertex2[0] = i * sizex / nbpoints; vertex2[1] = 0; path->AddVertex(vertex1); path->AddVertex(vertex2); } for (unsigned int i = 1; i < nbpoints; ++i) { VertexType vertex1, vertex2; vertex1[0] = i * sizex / nbpoints; vertex1[1] = sizey - 1; vertex2[0] = sizex - 1; vertex2[1] = i * sizey / nbpoints; path->AddVertex(vertex1); path->AddVertex(vertex2); } image->Update(); ConstIteratorType cit((const ImageType*) image, (const PathType*) path); std::ofstream flux(outfname); for (cit.GoToBegin(); !cit.IsAtEnd(); ++cit) { flux << cit.GetIndex() << std::endl; } flux.close(); return EXIT_SUCCESS; }
VTUZ-12IE1bzud/TruckMonitor-Backend
model/vehicle.go
package model type ( // Вид ТС VehicleType struct { Id int Name string } // Марка ТС VehicleBrand struct { Id int TypeId int Name string } // Марка ТС VehicleModel struct { Id int BrandId int Name string CapacityMax float32 } // ТС Vehicle struct { Id int ModelId int Vin string LicencePlate string RegionNumber int } )
stackrox/stackrox
central/nodecomponent/datastore/store/postgres/store_test.go
// Code generated by pg-bindings generator. DO NOT EDIT. //go:build sql_integration package postgres import ( "context" "testing" "github.com/jackc/pgx/v4/pgxpool" "github.com/stackrox/rox/generated/storage" "github.com/stackrox/rox/pkg/features" "github.com/stackrox/rox/pkg/postgres/pgtest" "github.com/stackrox/rox/pkg/sac" "github.com/stackrox/rox/pkg/testutils" "github.com/stackrox/rox/pkg/testutils/envisolator" "github.com/stretchr/testify/suite" ) type NodeComponentsStoreSuite struct { suite.Suite envIsolator *envisolator.EnvIsolator store Store pool *pgxpool.Pool } func TestNodeComponentsStore(t *testing.T) { suite.Run(t, new(NodeComponentsStoreSuite)) } func (s *NodeComponentsStoreSuite) SetupSuite() { s.envIsolator = envisolator.NewEnvIsolator(s.T()) s.envIsolator.Setenv(features.PostgresDatastore.EnvVar(), "true") if !features.PostgresDatastore.Enabled() { s.T().Skip("Skip postgres store tests") s.T().SkipNow() } ctx := sac.WithAllAccess(context.Background()) source := pgtest.GetConnectionString(s.T()) config, err := pgxpool.ParseConfig(source) s.Require().NoError(err) pool, err := pgxpool.ConnectConfig(ctx, config) s.Require().NoError(err) Destroy(ctx, pool) s.pool = pool gormDB := pgtest.OpenGormDB(s.T(), source) defer pgtest.CloseGormDB(s.T(), gormDB) s.store = CreateTableAndNewStore(ctx, pool, gormDB) } func (s *NodeComponentsStoreSuite) SetupTest() { ctx := sac.WithAllAccess(context.Background()) tag, err := s.pool.Exec(ctx, "TRUNCATE node_components CASCADE") s.T().Log("node_components", tag) s.NoError(err) } func (s *NodeComponentsStoreSuite) TearDownSuite() { if s.pool != nil { s.pool.Close() } s.envIsolator.RestoreAll() } func (s *NodeComponentsStoreSuite) TestStore() { ctx := sac.WithAllAccess(context.Background()) store := s.store nodeComponent := &storage.NodeComponent{} s.NoError(testutils.FullInit(nodeComponent, testutils.SimpleInitializer(), testutils.JSONFieldsFilter)) foundNodeComponent, exists, err := store.Get(ctx, nodeComponent.GetId()) s.NoError(err) s.False(exists) s.Nil(foundNodeComponent) s.NoError(store.Upsert(ctx, nodeComponent)) foundNodeComponent, exists, err = store.Get(ctx, nodeComponent.GetId()) s.NoError(err) s.True(exists) s.Equal(nodeComponent, foundNodeComponent) nodeComponentCount, err := store.Count(ctx) s.NoError(err) s.Equal(1, nodeComponentCount) nodeComponentExists, err := store.Exists(ctx, nodeComponent.GetId()) s.NoError(err) s.True(nodeComponentExists) s.NoError(store.Upsert(ctx, nodeComponent)) foundNodeComponent, exists, err = store.Get(ctx, nodeComponent.GetId()) s.NoError(err) s.True(exists) s.Equal(nodeComponent, foundNodeComponent) s.NoError(store.Delete(ctx, nodeComponent.GetId())) foundNodeComponent, exists, err = store.Get(ctx, nodeComponent.GetId()) s.NoError(err) s.False(exists) s.Nil(foundNodeComponent) var nodeComponents []*storage.NodeComponent for i := 0; i < 200; i++ { nodeComponent := &storage.NodeComponent{} s.NoError(testutils.FullInit(nodeComponent, testutils.UniqueInitializer(), testutils.JSONFieldsFilter)) nodeComponents = append(nodeComponents, nodeComponent) } s.NoError(store.UpsertMany(ctx, nodeComponents)) nodeComponentCount, err = store.Count(ctx) s.NoError(err) s.Equal(200, nodeComponentCount) }
uncodecn/SmartEngine
core/src/main/java/com/alibaba/smart/framework/engine/bpmn/assembly/expression/parser/ConditionExpressionParser.java
package com.alibaba.smart.framework.engine.bpmn.assembly.expression.parser; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import com.alibaba.smart.framework.engine.bpmn.assembly.expression.ConditionExpressionImpl; import com.alibaba.smart.framework.engine.exception.EngineException; import com.alibaba.smart.framework.engine.extension.annoation.ExtensionBinding; import com.alibaba.smart.framework.engine.extension.constant.ExtensionConstant; import com.alibaba.smart.framework.engine.xml.parser.AbstractElementParser; import com.alibaba.smart.framework.engine.xml.parser.ParseContext; import com.alibaba.smart.framework.engine.xml.util.XmlParseUtil; @ExtensionBinding(group = ExtensionConstant.ELEMENT_PARSER, bindKey = ConditionExpressionImpl.class) public class ConditionExpressionParser extends AbstractElementParser<ConditionExpressionImpl> { @Override public QName getQname() { return ConditionExpressionImpl.type; } @Override public Class<ConditionExpressionImpl> getModelType() { return ConditionExpressionImpl.class; } @Override public ConditionExpressionImpl parseElement(XMLStreamReader reader, ParseContext context) throws XMLStreamException { ConditionExpressionImpl conditionExpression = new ConditionExpressionImpl(); String type = XmlParseUtil.getString(reader, "group"); String type0 = reader.getAttributeValue("xsi", "group"); String type1 = reader.getAttributeValue(null, "group"); String type2 = reader.getAttributeValue(0); String content = reader.getElementText(); conditionExpression.setExpressionContent(content); // XML 解析有bug,这里兼容下。 if(null != type){ conditionExpression.setExpressionType(type); }else if(null != type0){ conditionExpression.setExpressionType(type0); }else if(null != type1){ conditionExpression.setExpressionType(type1); }else if(null != type2){ conditionExpression.setExpressionType(type2); } String finalExpressionType = conditionExpression.getExpressionType(); if(null == finalExpressionType){ throw new EngineException("group should not be empty for expression content:"+ finalExpressionType); } // Script script = new Script(); // script.setType(group); // script.setContent(content); // conditionExpression.setHandler(script); // this.skipToEndElement(reader); return conditionExpression; } }
SPECURE/ont-controlserver-core
src/test/java/com/specure/core/enums/PackageTypeTest.java
package com.specure.core.enums; import com.specure.core.exception.PackageTypeException; import com.specure.core.TestConstants; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.junit4.SpringRunner; import static junit.framework.TestCase.assertEquals; @RunWith(SpringRunner.class) public class PackageTypeTest { @Test(expected = PackageTypeException.class) public void whenFromString_getWrongPackageType_ExpectExpectation() { PackageType.fromString("wrong"); } @Test public void whenFromString_getProperPackageType_ExpectPackageType() { PackageType packageType = PackageType.fromString(TestConstants.DEFAULT_PACKAGE_TYPE_STRING); assertEquals(PackageType.MOBILE_PREPAID, packageType); } }
mustard93/Medical-system
src/angular/modules/project-dt/controllers-businessScopeEditCtrl.js
define('project-dt/controllers-businessScopeEditCtrl', ['project-dt/init'], function() { /** * [businessScopeEditCtrl 首营各模块公用控制器] * @method businessScopeEditCtrl * @param {[type]} $scope [description] * @param {[type]} watchFormChange [description] * @param {[type]} requestData [description] * @param {[type]} utils [description] * @param {[type]} alertError [description] * @param {[type]} alertWarn [description] */ function businessScopeEditCtrl ($scope, watchFormChange, requestData, utils, alertError, alertWarn) { // 经营方式查询调用的方法 $scope.filterName=function(q){ var url='rest/authen/businessScope/query?pageSize=999&q='+q; var data= {}; requestData(url,data, 'get') .then(function (results) { $scope.scopeData= results[1].data; }) .catch(function (error) { alertError(error || '出错'); }); }; // 之前选中的选项,再次选的时候。自动勾选上。 $scope.reCheck=function(businessScope,scopeData){ if (businessScope.length&&scopeData.length) { // 对比之前选过的,和现在所有可以选的。如果已经选过,则标志上已选 for (var i = 0; i < businessScope.length; i++) { for (var j = 0; j < scopeData.length; j++) { if (businessScope[i].code==scopeData[j].code) { scopeData[j].checked=true; } } } // 最后检查是否全部都被选中,如果是,则选中全选的框,只要有一个没有被选中,全选的框也是不勾选状态。 if (scopeData.every(function(item){ return item.checked==true;})) { $scope.scopeData.checked=true; }else { $scope.scopeData.checked=false; } } } // 全选调用的方法,把所有的都传入,然后一一选中,放入businessScope中。 $scope.selectAll=function(checked,scopeData){ console.log(checked); if (scopeData) { if (checked) { for (var i = 0; i < scopeData.length; i++) { // 全部勾选 scopeData[i].checked=true; } }else { for (var i = 0; i < scopeData.length; i++) { // 全部不勾选 scopeData[i].checked=false; } } } } // 选择经营方式以后,调用的方法。 $scope.submitbusinessScope=function(_data,businessScope){ var _businessScopeArr=[]; if (_data) { for (var i = 0; i < _data.length; i++) { if (_data[i].checked) { var _businessScope={}; _businessScope.name=_data[i].name; _businessScope.code=_data[i].code; // 如果没值,说明是第一次选择。就直接push _businessScopeArr.push(_businessScope) if (businessScope.length) { for (var j = 0; j < businessScope.length; j++) { // 判断是否是没有选过的项,如果不是,就不push进去。 if (businessScope[j].code==_businessScope.code) { $scope.formData.businessScope.pop(_businessScope); } } } } } $scope.formData.businessScope=_businessScopeArr; } } } angular.module('manageApp.project-dt') .controller('businessScopeEditCtrl', ['$scope',"watchFormChange",'requestData',"utils", "alertError", "alertWarn", businessScopeEditCtrl]); });
Ziang-Lu/Design-Patterns
2-Creational Patterns/1-Factory Method Pattern & Abstract Factory Pattern/DocumentCreator-Letter-Resume Example/Java/product_document/ModernResume.java
<reponame>Ziang-Lu/Design-Patterns package product_document; /** * Concrete product ModernResume class. * * @author <NAME> */ public class ModernResume implements Resume { @Override public String toString() { return "This is a MODERN RESUME."; } }
y836097668/springboot2-learning
event/src/main/java/com/sherlocky/springboot2/applicationevent/Springboot2EventApplication.java
package com.sherlocky.springboot2.applicationevent; import com.sherlocky.springboot2.applicationevent.event.MyBlogEvent; import com.sherlocky.springboot2.applicationevent.listener.MyListener1ByManual; import com.sherlocky.springboot2.applicationevent.listener.MyListener3ByEventListenerAnnotation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @EnableAsync @SpringBootApplication public class Springboot2EventApplication { Logger logger = LoggerFactory.getLogger(MyListener3ByEventListenerAnnotation.class); public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(Springboot2EventApplication.class, args); /********************* 装载监听事件 *********************/ // 方式1:手动装载监听 context.addApplicationListener(new MyListener1ByManual()); // 方式2:无需手动装载监听,@Component自动注入 // 方式3:无需实现 ApplicationListener 接口,使用 @EventListener 方法注解 /********************* 发布事件 *****************/ context.publishEvent(new MyBlogEvent("测试博文事件~")); } // 自定义线程池(异步事件监听会用到) @Bean public ThreadPoolTaskExecutor myExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(2); executor.setMaxPoolSize(5); logger.error("$$$$ myExecutor ~~~~~"); return executor; } } /** SpringBoot 3种事件的实现方式监听是有序的 com.sherlocky.springboot2.applicationevent.listeners.MyListener3ByEventListenerAnnotation监听到事件源:测试博文事件~. com.sherlocky.springboot2.applicationevent.listeners.MyListener2ByComponentAnnotation监听到事件源:测试博文事件~. com.sherlocky.springboot2.applicationevent.listeners.MyListener1ByManual监听到事件源:测试博文事件~. */
jkdubr/Proj4
Pod/Classes/Projection/MOBProjectionEPSG5777.h
<reponame>jkdubr/Proj4 #import "MOBProjection.h" @interface MOBProjectionEPSG5777 : MOBProjection @end
khrushjing/node-gdal-async
deps/libgeos/geos/src/triangulate/tri/Tri.cpp
/********************************************************************** * * GEOS - Geometry Engine Open Source * http://geos.osgeo.org * * Copyright (C) 2020 <NAME> <<EMAIL>> * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published * by the Free Software Foundation. * See the COPYING file for more information. * **********************************************************************/ #include <geos/algorithm/Orientation.h> #include <geos/algorithm/LineIntersector.h> #include <geos/geom/CoordinateSequence.h> #include <geos/geom/CoordinateSequenceFactory.h> #include <geos/geom/Geometry.h> #include <geos/geom/GeometryFactory.h> #include <geos/geom/LinearRing.h> #include <geos/geom/Polygon.h> #include <geos/triangulate/tri/Tri.h> #include <geos/util/IllegalArgumentException.h> using geos::util::IllegalArgumentException; using geos::algorithm::Orientation; namespace geos { // geos namespace triangulate { // geos.triangulate namespace tri { // geos.triangulate.tri /* public */ void Tri::setAdjacent(Tri* p_tri0, Tri* p_tri1, Tri* p_tri2) { tri0 = p_tri0; tri1 = p_tri1; tri2 = p_tri2; } /* public */ void Tri::setTri(TriIndex edgeIndex, Tri* tri) { switch (edgeIndex) { case 0: tri0 = tri; return; case 1: tri1 = tri; return; case 2: tri2 = tri; return; } assert(false); // never reach here } /* private */ void Tri::setCoordinates(const Coordinate& np0, const Coordinate& np1, const Coordinate& np2) { p0 = np0; p1 = np1; p2 = np2; } /* public */ void Tri::setAdjacent(const Coordinate& pt, Tri* tri) { TriIndex index = getIndex(pt); setTri(index, tri); // TODO: validate that tri is adjacent at the edge specified } /** * Replace triOld with triNew * * @param triOld * @param triNew */ /* private */ void Tri::replace(Tri* triOld, Tri* triNew) { if ( tri0 != nullptr && tri0 == triOld ) { tri0 = triNew; } else if ( tri1 != nullptr && tri1 == triOld ) { tri1 = triNew; } else if ( tri2 != nullptr && tri2 == triOld ) { tri2 = triNew; } } /* public */ void Tri::flip(TriIndex index) { Tri* tri = getAdjacent(index); TriIndex index1 = tri->getIndex(this); Coordinate adj0 = getCoordinate(index); Coordinate adj1 = getCoordinate(next(index)); Coordinate opp0 = getCoordinate(oppVertex(index)); Coordinate opp1 = tri->getCoordinate(oppVertex(index1)); flip(tri, index, index1, adj0, adj1, opp0, opp1); } /* private */ void Tri::flip(Tri* tri, TriIndex index0, TriIndex index1, const Coordinate& adj0, const Coordinate& adj1, const Coordinate& opp0, const Coordinate& opp1) { //System.out.println("Flipping: " + this + " -> " + tri); //validate(); //tri.validate(); setCoordinates(opp1, opp0, adj0); tri->setCoordinates(opp0, opp1, adj1); /** * Order: 0: opp0-adj0 edge, 1: opp0-adj1 edge, * 2: opp1-adj0 edge, 3: opp1-adj1 edge */ std::vector<Tri*> adjacent = getAdjacentTris(tri, index0, index1); setAdjacent(tri, adjacent[0], adjacent[2]); //--- update the adjacent triangles with new adjacency if ( adjacent[2] != nullptr ) { adjacent[2]->replace(tri, this); } tri->setAdjacent(this, adjacent[3], adjacent[1]); if ( adjacent[1] != nullptr ) { adjacent[1]->replace(this, tri); } //validate(); //tri.validate(); } /** * * Order: 0: opp0-adj0 edge, 1: opp0-adj1 edge, * 2: opp1-adj0 edge, 3: opp1-adj1 edge * * @param tri * @param index0 * @param index1 * @return */ /* private */ std::vector<Tri*> Tri::getAdjacentTris(Tri* triAdj, TriIndex index, TriIndex indexAdj) { std::vector<Tri*> adj(4); adj[0] = getAdjacent(prev(index)); adj[1] = getAdjacent(next(index)); adj[2] = triAdj->getAdjacent(next(indexAdj)); adj[3] = triAdj->getAdjacent(prev(indexAdj)); return adj; } /* public */ void Tri::validate() { if ( Orientation::CLOCKWISE != Orientation::index(p0, p1, p2) ) { throw IllegalArgumentException("Tri is not oriented correctly"); } validateAdjacent(0); validateAdjacent(1); validateAdjacent(2); } /* public */ void Tri::validateAdjacent(TriIndex index) { Tri* tri = getAdjacent(index); if (tri == nullptr) return; assert(isAdjacent(tri)); assert(tri->isAdjacent(this)); // const Coordinate& e0 = getCoordinate(index); // const Coordinate& e1 = getCoordinate(next(index)); // TriIndex indexNeighbor = tri->getIndex(this); // const Coordinate& n0 = tri->getCoordinate(indexNeighbor); // const Coordinate& n1 = tri->getCoordinate(next(indexNeighbor)); // assert(e0.equals2D(n1)); // Edge coord not equal // assert(e1.equals2D(n0)); // Edge coord not equal //--- check that no edges cross algorithm::LineIntersector li; for (TriIndex i = 0; i < 3; i++) { for (TriIndex j = 0; j < 3; j++) { const Coordinate& p00 = getCoordinate(i); const Coordinate& p01 = getCoordinate(next(i)); const Coordinate& p10 = tri->getCoordinate(j); const Coordinate& p11 = tri->getCoordinate(next(j)); li.computeIntersection(p00, p01, p10, p11); assert(!li.isProper()); } } } /* public */ std::pair<const Coordinate&, const Coordinate&> Tri::getEdge(Tri* neighbor) const { TriIndex index = getIndex(neighbor); TriIndex nextTri = next(index); // const Coordinate& e0 = getCoordinate(index); // const Coordinate& e1 = getCoordinate(nextTri); // assert (neighbor->hasCoordinate(e0)); // assert (neighbor->hasCoordinate(e1)); // TriIndex iN = neighbor->getIndex(e0); // TriIndex iNPrev = prev(iN); // assert (neighbor->getIndex(e1) == iNPrev); std::pair<const Coordinate&, const Coordinate&> edge(getCoordinate(index), getCoordinate(nextTri)); return edge; } /* public */ const Coordinate& Tri::getEdgeStart(TriIndex i) const { return getCoordinate(i); } /* public */ const Coordinate& Tri::getEdgeEnd(TriIndex i) const { return getCoordinate(next(i)); } /* public */ bool Tri::hasCoordinate(const Coordinate& v) const { if ( p0.equals(v) || p1.equals(v) || p2.equals(v) ) { return true; } return false; } /* public */ const Coordinate& Tri::getCoordinate(TriIndex i) const { if ( i == 0 ) { return p0; } if ( i == 1 ) { return p1; } return p2; } /* public */ TriIndex Tri::getIndex(const Coordinate& p) const { if ( p0.equals2D(p) ) return 0; if ( p1.equals2D(p) ) return 1; if ( p2.equals2D(p) ) return 2; return -1; } /* public */ TriIndex Tri::getIndex(Tri* tri) const { if ( tri0 == tri ) return 0; if ( tri1 == tri ) return 1; if ( tri2 == tri ) return 2; return -1; } /* public */ Tri* Tri::getAdjacent(TriIndex i) const { switch(i) { case 0: return tri0; case 1: return tri1; case 2: return tri2; } assert(false); // Never get here return nullptr; } /* public */ bool Tri::hasAdjacent(TriIndex i) const { return nullptr != getAdjacent(i); } /* public */ bool Tri::isAdjacent(Tri* tri) const { return getIndex(tri) >= 0; } /* public */ int Tri::numAdjacent() const { int num = 0; if ( tri0 != nullptr ) num++; if ( tri1 != nullptr ) num++; if ( tri2 != nullptr ) num++; return num; } /* public static */ TriIndex Tri::next(TriIndex i) { switch (i) { case 0: return 1; case 1: return 2; case 2: return 0; } return -1; } /* public static */ TriIndex Tri::prev(TriIndex i) { switch (i) { case 0: return 2; case 1: return 0; case 2: return 1; } return -1; } /* public static */ TriIndex Tri::oppVertex(TriIndex edgeIndex) { return prev(edgeIndex); } /* public static */ TriIndex Tri::oppEdge(TriIndex vertexIndex) { return next(vertexIndex); } /* public */ Coordinate Tri::midpoint(TriIndex edgeIndex) const { const Coordinate& np0 = getCoordinate(edgeIndex); const Coordinate& np1 = getCoordinate(next(edgeIndex)); double midX = (np0.x + np1.x) / 2; double midY = (np0.y + np1.y) / 2; return Coordinate(midX, midY); } /* public */ std::unique_ptr<geom::Polygon> Tri::toPolygon(const geom::GeometryFactory* gf) const { std::vector<Coordinate> coords(4); coords[0] = p0; coords[1] = p1; coords[2] = p2; coords[3] = p0; return gf->createPolygon(std::move(coords)); } std::ostream& operator<<(std::ostream& os, const Tri& tri) { os << "POLYGON (("; os << tri.p0 << ", "; os << tri.p1 << ", "; os << tri.p2 << ", "; os << tri.p0 << "))"; return os; } } // namespace geos.triangulate.tri } // namespace geos.triangulate } // namespace geos
si9ma/KillOJ-backend
api/user.go
<reponame>si9ma/KillOJ-backend<gh_stars>0 package api import ( "net/http" "github.com/si9ma/KillOJ-backend/wrap" "github.com/si9ma/KillOJ-backend/middleware" "github.com/si9ma/KillOJ-backend/auth" "github.com/jinzhu/gorm" "github.com/si9ma/KillOJ-common/utils" "github.com/si9ma/KillOJ-common/mysql" "github.com/si9ma/KillOJ-common/tip" "github.com/si9ma/KillOJ-backend/kerror" "github.com/si9ma/KillOJ-backend/gbl" "github.com/si9ma/KillOJ-common/log" "go.uber.org/zap" otgrom "github.com/smacker/opentracing-gorm" "gopkg.in/hlandau/passlib.v1" "github.com/gin-gonic/gin" "github.com/si9ma/KillOJ-common/model" ) // login and auth const ( SignUpPath = "/signup" ProfilePath = "/profile" ) func SetupUser(r *gin.Engine) { r.POST(SignUpPath, UserInfoEdit) // should auth auth.AuthGroup.PUT(ProfilePath, UserInfoEdit) auth.AuthGroup.GET(ProfilePath, GetUserInfo) auth.AuthGroup.GET("/user/:id", GetOtherUserInfo) auth.AuthGroup.GET("/users", middleware.AuthorizateFunc(GetAllUsers, model.Administrator)) auth.AuthGroup.PUT("/admin/maintainers/:id", middleware.AuthorizateFunc(UpdateMaintainer, model.Administrator)) auth.AuthGroup.GET("/admin/maintainers", middleware.AuthorizateFunc(GetAllMaintainers, model.Administrator)) } func extractUser(c *gin.Context) (*model.User, bool) { ctx := c.Request.Context() user := model.User{} if !wrap.ShouldBind(c, &user, false) { return nil, false } // validate argument password, // password should't empty when sign up if c.Request.RequestURI == SignUpPath { if user.Password == "" { log.For(ctx).Error("password shouldn't empty when signup") // set error fields := map[string]string{ "password": tip.MustNotEmptyTip.String(), } _ = c.Error(kerror.EmptyError).SetType(gin.ErrorTypePublic).SetMeta(kerror.ErrArgValidateFail.With(fields)) return nil, false } } // validate argument organization if user.NoInOrganization != "" && user.Organization == "" { log.For(ctx).Error("organization should not nil when no_in_organization is not nil", zap.String("NoInOrganization", user.NoInOrganization)) // set error fields := map[string]string{ "no_in_organization": tip.OrgShouldExistWhenNoExistTip.String(), } _ = c.Error(kerror.EmptyError).SetType(gin.ErrorTypePublic).SetMeta(kerror.ErrArgValidateFail.With(fields)) return nil, false } // validate argument github if !utils.BothZeroOrNot(user.GithubName, user.GithubUserID) { log.For(ctx).Error("github_name and github_user_id should both exist or both not exist", zap.String("github_name", user.GithubName), zap.String("github_user_id", user.GithubUserID)) _ = c.Error(kerror.EmptyError).SetType(gin.ErrorTypePublic). SetMeta(kerror.ErrShouldBothExistOrNot.WithArgs("github_name", "github_user_id")) return nil, false } return &user, true } func UserInfoEdit(c *gin.Context) { var err error ctx := c.Request.Context() db := otgrom.SetSpanToGorm(ctx, gbl.DB) newUser, ok := extractUser(c) if !ok { return } oldUser := model.User{} // when update user info if c.Request.RequestURI == ProfilePath { userID := auth.GetUserFromJWT(c).ID // get ID from jwt err := db.First(&oldUser, userID).Error if mysql.ErrorHandleAndLog(c, err, true, "query user", userID) != mysql.Success { return } } // unique check // new value -- old value uniqueCheckList := []map[string]mysql.ValuePair{ { "organization": mysql.ValuePair{ NewVal: newUser.Organization, OldVal: oldUser.Organization, }, "no_in_organization": mysql.ValuePair{ NewVal: newUser.NoInOrganization, OldVal: oldUser.NoInOrganization, }, }, { "email": mysql.ValuePair{ NewVal: newUser.Email, OldVal: oldUser.Email, }, }, { "name": mysql.ValuePair{ NewVal: newUser.Name, OldVal: oldUser.Name, }, }, { "github_user_id": mysql.ValuePair{ NewVal: newUser.GithubUserID, OldVal: oldUser.GithubUserID, }, }, { "github_name": mysql.ValuePair{ NewVal: newUser.GithubName, OldVal: oldUser.GithubName, }, }, } // check for _, checkMap := range uniqueCheckList { if !mysql.ShouldUnique(c, ctx, db, checkMap, func(db *gorm.DB) error { return db.First(&model.User{}).Error }) { return } } // encrypt password, // only when password not empty if newUser.Password != "" { if newUser.EncryptedPasswd, err = passlib.Hash(newUser.Password); err != nil { log.For(ctx).Error("encrypt password fail", zap.Error(err)) _ = c.Error(err).SetType(gin.ErrorTypePrivate) c.Status(http.StatusInternalServerError) return } log.For(ctx).Info("encrypt password success") } switch c.Request.RequestURI { // update newUser info case ProfilePath: // these field shouldn't update newUser.ID = oldUser.ID newUser.GithubName = oldUser.GithubName newUser.GithubUserID = oldUser.GithubUserID // update err := db.Model(&oldUser).Updates(newUser).Error if mysql.ErrorHandleAndLog(c, err, true, "update user", newUser.ID) != mysql.Success { return } log.For(ctx).Info("update newUser success", zap.Int("userId", newUser.ID)) // sign up newUser case SignUpPath: newUser.Role = int(model.Normal) // default user role is normal // save if err := db.Create(&newUser).Error; err != nil { log.For(ctx).Error("create newUser fail", zap.Error(err)) _ = c.Error(err).SetType(gin.ErrorTypePublic) c.Status(http.StatusInternalServerError) return } log.For(ctx).Info("create newUser success", zap.Int("userId", newUser.ID)) } c.JSON(http.StatusOK, newUser) } func GetUserInfo(c *gin.Context) { ctx := c.Request.Context() db := otgrom.SetSpanToGorm(ctx, gbl.DB) userID := auth.GetUserFromJWT(c).ID user := model.User{} err := db.Preload("Theme").First(&user, userID).Error if mysql.ErrorHandleAndLog(c, err, true, "get user info", userID) != mysql.Success { return } log.For(ctx).Info("get user info success", zap.Int("userId", user.ID)) c.JSON(http.StatusOK, user) } func GetOtherUserInfo(c *gin.Context) { ctx := c.Request.Context() arg := QueryArg{} db := otgrom.SetSpanToGorm(ctx, gbl.DB) // bind uri if !wrap.ShouldBind(c, &arg, true) { return } user := model.User{} err := db.First(&user, arg.ID).Error if mysql.ErrorHandleAndLog(c, err, true, "get user info", arg.ID) != mysql.Success { return } log.For(ctx).Info("get user info success", zap.Int("userId", user.ID)) c.JSON(http.StatusOK, user) } type updateMaintainerArg struct { Role int `json:"role" binding:"exists,oneof=1 2"` } func UpdateMaintainer(c *gin.Context) { var err error ctx := c.Request.Context() db := otgrom.SetSpanToGorm(ctx, gbl.DB) arg := updateMaintainerArg{} uriArg := QueryArg{} // bind url argument if !wrap.ShouldBind(c, &uriArg, true) { return } // bind other argument if !wrap.ShouldBind(c, &arg, false) { return } // can't change your self role, // because you are administrator if uriArg.ID == auth.GetUserFromJWT(c).ID { log.For(ctx).Error("you can't change your self role", zap.Int("userId", uriArg.ID)) _ = c.Error(kerror.EmptyError).SetType(gin.ErrorTypePublic). SetMeta(kerror.ErrShouldNotUpdateSelf.WithArgs("role")) return } // if user not exist, return err = db.First(&model.User{}).Error if mysql.ErrorHandleAndLog(c, err, true, "get user", uriArg.ID) != mysql.Success { return } user := model.User{ID: uriArg.ID} err = db.Model(&user).Update("role", arg.Role).Error if res := mysql.ErrorHandleAndLog(c, err, false, "update maintainer role", uriArg.ID); res == mysql.NotFound { log.For(ctx).Error("user not exist", zap.Error(err), zap.Int("userId", uriArg.ID)) _ = c.Error(err).SetType(gin.ErrorTypePublic). SetMeta(kerror.ErrNotFound.WithArgs(uriArg.ID)) return } else if res != mysql.Success { return } log.For(ctx).Info("update maintainer role success", zap.Int("userId", user.ID)) } func GetAllMaintainers(c *gin.Context) { var err error ctx := c.Request.Context() db := otgrom.SetSpanToGorm(ctx, gbl.DB) arg := PageArg{} // bind if !wrap.ShouldBind(c, &arg, false) { return } offset := (arg.Page - 1) * arg.PageSize var users []model.User if arg.Order != "" { err = db.Where("role = ?", model.Maintainer).Order(arg.Order).Offset(offset).Limit(arg.PageSize).Find(&users).Error } else { err = db.Where("role = ?", model.Maintainer).Offset(offset).Limit(arg.PageSize).Find(&users).Error } if mysql.ErrorHandleAndLog(c, err, true, "get maintainers", nil) != mysql.Success { return } log.For(ctx).Info("success get maintainers") c.JSON(http.StatusOK, users) } func GetAllUsers(c *gin.Context) { var err error ctx := c.Request.Context() db := otgrom.SetSpanToGorm(ctx, gbl.DB) arg := PageArg{} // bind if !wrap.ShouldBind(c, &arg, false) { return } offset := (arg.Page - 1) * arg.PageSize var users []model.User if arg.Order != "" { err = db.Order(arg.Order).Offset(offset).Limit(arg.PageSize).Find(&users).Error } else { err = db.Offset(offset).Limit(arg.PageSize).Find(&users).Error } if mysql.ErrorHandleAndLog(c, err, true, "get users", nil) != mysql.Success { return } log.For(ctx).Info("success get users") c.JSON(http.StatusOK, users) }
github188/WirelessGPSTracker
mtk/inc/C_H/Unicodexdcl.h
<gh_stars>1-10 /***************************************************************************** * Copyright Statement: * -------------------- * This software is protected by Copyright and the information contained * herein is confidential. The software may not be copied and the information * contained herein may not be used or disclosed except with the written * permission of MediaTek Inc. (C) 2005 * * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. * * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). * *****************************************************************************/ /******************************************************************************* * Filename: * --------- * Unicodexdcl.h * * Project: * -------- * MAUI * * Description: * ------------ * * * Author: * ------- * * *============================================================================== * HISTORY * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! *------------------------------------------------------------------------------ * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * *------------------------------------------------------------------------------ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! *============================================================================== *******************************************************************************/ /** * Copyright Notice * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W., * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved. * (It is illegal to remove this copyright notice from this software or any * portion of it) */ /************************************************************** FILENAME : Unicodexdcl.h PURPOSE : Gives the current build settings. REMARKS : Manish AUTHOR : <NAME> DATE : . **************************************************************/ #ifndef _UNICODEXDCL_H_ #define _UNICODEXDCL_H_ #include "MMIDataType.h" #include "kal_non_specific_general_types.h" /* the application include this header to get related API */ /* DOM-NOT_FOR_SDK-BEGIN */ /***************************************************************************** * FUNCTION * mmi_wc_to_ucs2 * DESCRIPTION * convert unicode to UCS2 encoding * PARAMETERS * unicode : [IN] Value to be encoded * charLength : [OUT] The length of the character * arrOut : [OUT] The output character * RETURNS * U8 -> Status, 0 is failed, 1 is success. *****************************************************************************/ extern U8 mmi_wc_to_ucs2(U16 unicode, U8 *charLength, U8 *arrOut); /***************************************************************************** * FUNCTION * mmi_ucs2_to_wc * DESCRIPTION * convert UCS2 encoded scheme to unicode * PARAMETERS * pUnicode : [IN] array containing UCS2 encoded characters * arr : [IN] unicode equivalent * RETURNS * U8 -> Status, 0 is failed, 1 is success. *****************************************************************************/ extern U8 mmi_ucs2_to_wc(PU16 pUnicode, PU8 arrOut); /***************************************************************************** * FUNCTION * mmi_ucs2strlen * DESCRIPTION * Gives the length of UCS2 encoded string * PARAMETERS * arrOut : [IN] array containing UCS2 encoded characters * RETURNS * S32-> Status *****************************************************************************/ extern S32 mmi_ucs2strlen(const CHAR *arrOut); /***************************************************************************** * FUNCTION * mmi_ucs2cmp * DESCRIPTION * compares two strings * PARAMETERS * string1 : [IN] String1 * string2 : [OUT] String2 * RETURNS * <0 - string1 less than string2 * 0 - string1 identical to string2 * >0 - string1 greater than string2 *****************************************************************************/ extern S32 mmi_ucs2cmp(const CHAR *string1, const CHAR *string2); /***************************************************************************** * FUNCTION * mmi_ucs2cpy * DESCRIPTION * copies the one UCS2 encoded string to other * PARAMETERS * strDestination : [OUT] Destination string * strSource : [IN] source string * RETURNS * CHAR * -> pointer to destination string or NULL *****************************************************************************/ extern CHAR *mmi_ucs2cpy(CHAR *strDestination, const CHAR *strSource); /***************************************************************************** * FUNCTION * mmi_ucs2ncmp * DESCRIPTION * The function is used for compare UCS2 characters of two strings. Size is * the character number not the byte numbers. * PARAMETERS * string1 : [IN] UCS2 string1 * string2 : [IN] UCS2 string2 * count : [IN] Number in character (not byte) * RETURNS * <0 - string1 less than string2 * 0 - string1 identical to string2 * >0 - string1 greater than string2 *****************************************************************************/ extern S32 mmi_ucs2ncmp(const CHAR *string1, const CHAR *string2, U32 count); /***************************************************************************** * FUNCTION * mmi_ucs2ncpy * DESCRIPTION * The function is used for copy UCS2 characters of one string to another. * If size is less than the length of strSource, a null character is still * appended automatically to strDestination. If size is greater than the * length of strSource, strDestination is padding with null characters up * to length size. The function behavior is a little bit different from strncpy. * PARAMETERS * strDestination : [OUT] StrDest-> Destination string * strSource : [IN] Source string * size : [IN] The size that needs to copy. * RETURNS * CHAR * -> pointer to destination string or NULL *****************************************************************************/ extern CHAR *mmi_ucs2ncpy(CHAR *strDestination, const CHAR *strSource, U32 size); /***************************************************************************** * FUNCTION * mmi_ucs2cat * DESCRIPTION * The function is used for append strSource to strDestination and terminate * the resulting string with a null character. * PARAMETERS * strDestination : [OUT] Destination string * strSource : [IN] Source string * RETURNS * Return the destination string *****************************************************************************/ extern CHAR *mmi_ucs2cat(CHAR *strDestination, const CHAR *strSource); /***************************************************************************** * FUNCTION * mmi_ucs2ncat * DESCRIPTION * The function is used for append the first size characters of strSource * to strDestination and terminate the resulting string with a null character. * PARAMETERS * strDestination : [OUT] UCS2 destination string * strSource : [IN] UCS2 source string * size : [IN] Size in character (not byte) * RETURNS * Return the destination string *****************************************************************************/ extern CHAR *mmi_ucs2ncat(CHAR *strDestination, const CHAR *strSource, U32 size); /***************************************************************************** * FUNCTION * mmi_ucs2trim_left * DESCRIPTION * Skip over the TrimChars from the begin character. * PARAMETERS * strSrc : [IN] The source string. * TrimChars : [IN] The trim chars. * RETURNS * Return the result string. *****************************************************************************/ extern CHAR *mmi_ucs2trim_left(const CHAR *strSrc, const CHAR *TrimChars); /***************************************************************************** * FUNCTION * mmi_ucs2find * DESCRIPTION * Search for the break_chars and store how many chars have been read over to reach * the desired break_char in read_length. * PARAMETERS * strSrc : [IN] The source string. * break_chars : [IN] The break_chars. * read_length : [OUT] The number of chars to reach the break_char. * direction : [IN] 1: sesarch forward ; -1: search backward. * RETURNS * 1: found the break_chars ; -1: searched over the whole strSrc and do not fing the break_chars *****************************************************************************/ extern S32 mmi_ucs2find(const CHAR *strSrc, const CHAR *break_chars, S32 *read_length, S16 direction); /***************************************************************************** * FUNCTION * mmi_ucs2toi * DESCRIPTION * to parse over a int number, including positive and negative signs (+,-). * PARAMETERS * strSrc : [IN] The source string. * out_num : [OUT] The ourput number. * read_length : [OUT] The read string length. * RETURNS * 1: parse successfully ; -1: parse number fail. *****************************************************************************/ extern S32 mmi_ucs2toi(const CHAR *strSrc, S32 *out_num, S32 *read_length); /***************************************************************************** * FUNCTION * mmi_asc_to_ucs2 * DESCRIPTION * The function is used for convert ANSII string to UCS2 string. The caller * need to make sure the pOutBuffer size must have enough space or the function * causes the memory corruption. The function will add the terminated character * at the end of pOutBuffer array. The byte order of UCS2 character(output param) * is little endian. * PARAMETERS * pOutBuffer : [OUT] The output buffer. * pInBuffer : [IN] The input buffer. * RETURNS * Return the bytes to convert. *****************************************************************************/ extern U16 mmi_asc_to_ucs2(CHAR *pOutBuffer, CHAR *pInBuffer); /***************************************************************************** * FUNCTION * mmi_asc_n_to_ucs2 * DESCRIPTION * The function is used for convert the characters of ANSII string to UCS2 * string. The caller need to make sure the pOutBuffer size is greater than * len and the function doesn't add the terminated character at the end of * the pOutBuffer array. The byte order of UCS2 character(output param) is * little endian. * PARAMETERS * pOutBuffer : [OUT] UCS2 destination string. * pInBuffer : [IN] ANSII source string * len : [IN] Length in bytes * RETURNS * Return the bytes to convert. *****************************************************************************/ extern U16 mmi_asc_n_to_ucs2(CHAR *pOutBuffer, CHAR *pInBuffer, U32 len); /***************************************************************************** * FUNCTION * mmi_asc_to_ucs2_ex * DESCRIPTION * The function is used for convert ANSII string to UCS2 string. The caller * need to make sure the pOutBuffer size must have enough space or the function * causes the memory corruption. The function will add the terminated character * at the end of pOutBuffer array. The byte order of UCS2 character(output param) * is little endian. * Unlike mmi_asc_to_ucs2, it will ignore the controls in ANSII string. * PARAMETERS * pOutBuffer : [OUT] UCS2 destination string * pInBuffer : [IN] ANSII source string * RETURNS * Return the bytes to convert. *****************************************************************************/ extern U16 mmi_asc_to_ucs2_ex(CHAR *pOutBuffer, CHAR *pInBuffer); /***************************************************************************** * FUNCTION * mmi_asc_n_to_ucs2_Ex * DESCRIPTION * The function is used for convert the characters of ANSII string to UCS2 * string. The caller need to make sure the pOutBuffer size is greater than * len and the function doesn't add the terminated character at the end of * the pOutBuffer array. The byte order of UCS2 character(output param) is * little endian. * Unlike mmi_asc_n_to_ucs2, it will ignore the controls in ANSII string. * PARAMETERS * pOutBuffer : [OUT] UCS2 destination string. * pInBuffer : [IN] ANSII source string * len : [IN] size in bytes * RETURNS * Return the bytes to convert. *****************************************************************************/ extern U16 mmi_asc_n_to_ucs2_ex(CHAR *pOutBuffer, CHAR *pInBuffer, U32 len); /***************************************************************************** * FUNCTION * mmi_ucs2_to_asc * DESCRIPTION * The function is used for convert UCS2 string to ANSII string. * The caller need to make sure the pOutBuffer size must have enough space * or the function causes the memory corruption. The function will add the * terminated character at the end of pOutBuffer array. The byte order of * UCS2 character(input param) is little endian. * PARAMETERS * pOutBuffer : [OUT] The output Buffer. * pInBuffer : [IN] The input Buffer * RETURNS * U16 *****************************************************************************/ extern U16 mmi_ucs2_to_asc(CHAR *pOutBuffer, CHAR *pInBuffer); /***************************************************************************** * FUNCTION * mmi_ucs2_n_to_asc * DESCRIPTION * The function is used for convert the characters of UCS2 string to ANSII * string. The caller need to make sure the pOutBuffer size is greater than * len and the function doesn't add the terminated character at the end of * the pOutBuffer array. The byte order of UCS2 character(input param) is little endian. * PARAMETERS * pOutBuffer : [OUT] ANSII destination string. * pInBuffer : [IN] UCS2 source string. * len : [IN] Length in bytes. * RETURNS * U16 *****************************************************************************/ extern U16 mmi_ucs2_n_to_asc(CHAR *pOutBuffer, CHAR *pInBuffer, U32 len); /***************************************************************************** * FUNCTION * mmi_ucs2str * DESCRIPTION * Finds the first occurrence of string2 in string1 * PARAMETERS * str1 : [IN] string to search in. * str2 : [IN] string to search for. * RETURNS * returns a pointer to the first occurrence of string2 in * string1, or NULL if string2 does not occur in string1 *****************************************************************************/ extern CHAR *mmi_ucs2str(const CHAR *str1, const CHAR *str2); /***************************************************************************** * FUNCTION * mmi_ucs2chr * DESCRIPTION * Searches a UCS2 encoded string for a given wide-character, * which may be the null character L'\0'. * PARAMETERS * strSrc : [IN] UCS2 encoded string to search in. * c : [IN] UCS2 encoded wide-character to search for. * RETURNS * returns pointer to the first occurrence of ch in string * returns NULL if ch does not occur in string *****************************************************************************/ extern CHAR *mmi_ucs2chr(const CHAR *string, WCHAR ch); /***************************************************************************** * FUNCTION * mmi_ucs2rchr * DESCRIPTION * Scan a UCS2 encoded string for the last occurrence of a character. * PARAMETERS * string : [IN] UCS2 encoded string to search in. * ch : [IN] UCS2 encoded wide-character to search for. * RETURNS * returns pointer to the last occurrence of ch in string * returns NULL if ch does not occur in string *****************************************************************************/ extern CHAR *mmi_ucs2rchr(const CHAR * string, WCHAR ch); /***************************************************************************** * FUNCTION * mmi_ucs2upr * DESCRIPTION * mmi_ucs2upr converts upper-case characters in a null-terminated * UCS2 encoded string their upper-case equivalents. * PARAMETERS * string : [IN] UCS2 encoded string to change to upper case. * RETURNS * returns a pointer to the converted string. Because the modification is * done in place, the pointer returned is the same as the pointer passed * as the input argument. *****************************************************************************/ extern CHAR *mmi_ucs2upr(CHAR *string); /***************************************************************************** * FUNCTION * mmi_ucs2lwr * DESCRIPTION * mmi_ucs2lwr converts lower-case characters in a null-terminated * UCS2 encoded string their lower-case equivalents. * PARAMETERS * string : [IN] UCS2 encoded string to change to upper case. * RETURNS * returns a pointer to the converted string. Because the modification is * done in place, the pointer returned is the same as the pointer passed * as the input argument. *****************************************************************************/ extern CHAR *mmi_ucs2lwr(CHAR *string); /***************************************************************************** * FUNCTION * mmi_ucs2icmp * DESCRIPTION * mmi_ucs2icmp perform a case-insensitive UCS2 encoded string * (wide-character) comparison. * PARAMETERS * str_src : [IN] UCS2 encoded destination string for * left-hand side of comparison. * str_dst : [IN] UCS2 encoded source string for right-hand * side of comparison. * RETURNS * returns -1 if str_src < str_dst * returns 0 if str_src == str_dst * returns +1 if str_src > str_dst *****************************************************************************/ extern S32 mmi_ucs2icmp(const CHAR *str_src, const CHAR *str_dst); /***************************************************************************** * FUNCTION * mmi_ucs2nicmp * DESCRIPTION * Compares two UCS2 encoded strings for lexical order without regard to case. * The comparison stops after: * (1) a difference between the strings is found; * (2) the end of the strings is reached; * (3) count characters have been compared. * PARAMETERS * str_src : [IN] UCS2 encoded destination string for * left-hand side of comparison. * str_dst : [IN] UCS2 encoded source string for right-hand * side of comparison. * count : [IN] Number of characters to compare. * RETURNS * returns -1 if str_src < str_dst * returns 0 if str_src == str_dst * returns +1 if str_src > str_dst *****************************************************************************/ extern S32 mmi_ucs2nicmp(const CHAR *str_src, const CHAR *str_dst, U32 count); /***************************************************************************** * FUNCTION * mmi_tolower * DESCRIPTION * Convert character to lowercase. * PARAMETERS * c : [IN] Character to convert. * RETURNS * return the point to the converted character. *****************************************************************************/ extern CHAR* mmi_tolower(CHAR *c); /***************************************************************************** * FUNCTION * mmi_toupper * DESCRIPTION * Convert character to uppercase. * PARAMETERS * c : [IN] Character to convert. * RETURNS * return the point to the converted character. *****************************************************************************/ extern CHAR* mmi_toupper(CHAR *c); /* DOM-NOT_FOR_SDK-END */ /***************************************************************************** * FUNCTION * mmi_asc_to_wcs * DESCRIPTION * The function is used for convert ANSII string to UCS2 string. The caller * need to make sure the pOutBuffer size must have enough space or the function * causes the memory corruption. The function will add the terminated character * at the end of pOutBuffer array. The byte order of UCS2 character(output param) * is little endian. * PARAMETERS * pOutBuffer : [OUT] UCS2 destination string * pInBuffer : [IN] ANSII source string * RETURNS * Return the bytes to convert. *****************************************************************************/ extern U16 mmi_asc_to_wcs(WCHAR *pOutBuffer, CHAR *pInBuffer); /***************************************************************************** * FUNCTION * mmi_asc_n_to_wcs * DESCRIPTION * The function is used for convert the characters of ANSII string to UCS2 * string. The caller need to make sure the pOutBuffer size is greater than * len and the function doesn't add the terminated character at the end of * the pOutBuffer array. The byte order of UCS2 character(output param) is * little endian. * PARAMETERS * pOutBuffer : [OUT] UCS2 destination string. * pInBuffer : [IN] ANSII source string * len : [IN] size in bytes * RETURNS * Return the bytes to convert. *****************************************************************************/ extern U16 mmi_asc_n_to_wcs(WCHAR *pOutBuffer, CHAR *pInBuffer, U32 len); /***************************************************************************** * FUNCTION * mmi_wcs_to_asc * DESCRIPTION * The function is used for convert UCS2 string to ANSII string. * The caller need to make sure the pOutBuffer size must have enough space * or the function causes the memory corruption. The function will add the * terminated character at the end of pOutBuffer array. * PARAMETERS * pOutBuffer : [OUT] ANSII destination string * pInBuffer : [IN] UCS2 source string * RETURNS * Return the bytes to convert. *****************************************************************************/ extern U16 mmi_wcs_to_asc(CHAR *pOutBuffer, WCHAR *pInBuffer); /***************************************************************************** * FUNCTION * mmi_wcs_n_to_asc * DESCRIPTION * The function is used for convert the characters of UCS2 string to ANSII * string. The caller need to make sure the pOutBuffer size is greater than * len and the function doesn't add the terminated character at the end of * the pOutBuffer array. The byte order of UCS2 character(input param) is * little endian. * PARAMETERS * pOutBuffer : [OUT] ANSII destination string. * pInBuffer : [IN] UCS2 source string. * len : [IN] Length in bytes. * RETURNS * Return the bytes to convert. *****************************************************************************/ extern U16 mmi_wcs_n_to_asc(CHAR *pOutBuffer, WCHAR *pInBuffer, U32 len); /* DOM-NOT_FOR_SDK-BEGIN */ /***************************************************************************** * FUNCTION * mmi_asc_to_wcs_ex * DESCRIPTION * The function is used for convert ANSII string to UCS2 string. The caller * need to make sure the dest size must have enough space or the function * causes the memory corruption. The function will add the terminated character * at the end of dest array. The byte order of UCS2 character(output param) * is little endian. * PARAMETERS * dest : [OUT] UCS2 destination string. * src : [IN] ANSII source string. * src_end_pos : [OUT] The point to the end of converted sub-string at the input string. * RETURNS * Return the bytes to convert. *****************************************************************************/ extern U16 mmi_asc_to_wcs_ex(WCHAR *dest, CHAR *src, U32 *src_end_pos); /***************************************************************************** * FUNCTION * mmi_asc_n_to_wcs_ex * DESCRIPTION * The function is used for convert the characters of ANSII string to UCS2 * string. The caller need to make sure the dest size must have enough space * or the function causes the memory corruption. The function will add the * terminated character at the end of dest array. The byte order of UCS2 * character(output param) is little endian. * PARAMETERS * dest : [OUT] UCS2 destination string. * src : [IN] ANSII source string. * len : [IN] Size in bytes * src_end_pos : [OUT] The point to the end of converted sub-string at the input string. * RETURNS * Return the bytes to convert. *****************************************************************************/\ extern U16 mmi_asc_n_to_wcs_ex(WCHAR *dest, CHAR *src, U32 len, U32 *src_end_pos); /* DOM-NOT_FOR_SDK-END */ /***************************************************************************** * FUNCTION * mmi_wcslen * DESCRIPTION * Gets the number of characters of the given UCS2 encoded string(wide-character), * not including the final null wide-characters. * PARAMETERS * string : [IN] UCS2 encoded string(wide-character) which length is to * be computed. * RETURNS * The number of characters of a wide-character string. *****************************************************************************/ extern S32 mmi_wcslen(const WCHAR *string); /***************************************************************************** * FUNCTION * mmi_wcscmp * DESCRIPTION * Compares two UCS2 encoded strings(wide-character) and returns an integer to * indicate whether the destination string is less than the source string, * the two are equal, or whether the destination string is greater than the * source string. * PARAMETERS * str_src : [IN] UCS2 encoded destination string(wide-character) for * left-hand side of comparison. * str_dst : [IN] UCS2 encoded source string(wide-character) for right-hand * side of comparison. * RETURNS * returns <0 if str_src < str_dst * returns 0 if str_src == str_dst * returns >0 if str_src > str_dst *****************************************************************************/ extern S32 mmi_wcscmp(const WCHAR *str_src, const WCHAR *str_dst); /***************************************************************************** * FUNCTION * mmi_wcsncmp * DESCRIPTION * Compares two UCS2 encoded strings(wide-character) for lexical order. * The comparison stops after: * (1) a difference between the strings is found; * (2) the end of the strings is reached; * (3) count characters have been compared (wide-character strings). * PARAMETERS * str_src : [IN] UCS2 encoded destination string(wide-character) for * left-hand side of comparison. * str_dst : [IN] UCS2 encoded source string(wide-character) for right-hand * side of comparison. * count : [IN] Number of characters to compare. * RETURNS * returns -1 if str_src < str_dst * returns 0 if str_src == str_dst * returns +1 if str_src > str_dst *****************************************************************************/ extern S32 mmi_wcsncmp(const WCHAR *str_src, const WCHAR *str_dst, U32 count); /***************************************************************************** * FUNCTION * mmi_wcscpy * DESCRIPTION * Copies the UCS2 encoded source string(wide-character) into the destination * string; Assumes enough space in the destination string. * PARAMETERS * str_dst : [OUT] UCS2 encoded destination string(wide-character) over which * the source string is to be copied. * str_src : [IN] UCS2 encoded source string(wide-character) to be copied * over the destination string. * RETURNS * A pointer to the destination string. *****************************************************************************/ extern WCHAR *mmi_wcscpy(WCHAR *str_dst, const WCHAR *str_src); /***************************************************************************** * FUNCTION * mmi_wcsncpy * DESCRIPTION * Copies count characters from the source string to the destination string. * Note: * Unlike ANSI C standard library function wcsncpy. If count is less than the * length of source, NULL wide-characters also is put onto the end of the * copied string. But if count is greater than the length of sources, str_dst * is not padded with null characters to length count (wide-characters). * PARAMETERS * str_dst : [OUT] UCS2 encoded destination string(wide-character) over which * the source string is to be copied. * str_src : [IN] UCS2 encoded source string(wide-character) to be copied * over the destination string. * count : [IN] max number of characters to copy. * RETURNS * A pointer to the destination string. *****************************************************************************/ extern WCHAR *mmi_wcsncpy(WCHAR *str_dst, const WCHAR *str_src, U32 count); /***************************************************************************** * FUNCTION * mmi_wcscat * DESCRIPTION * Concatenates the source string onto the end of the destination string. * Assumes enough space in the destination string. * PARAMETERS * str_dst : [OUT] UCS2 encoded destination string(wide-character) over which * "str_src" is to be copied. * str_src : [IN] UCS2 encoded source string(wide-character) to be copied * over "str_dst". * RETURNS * A pointer to the destination string. *****************************************************************************/ extern WCHAR *mmi_wcscat(WCHAR *str_dst, const WCHAR *str_src); /***************************************************************************** * FUNCTION * mmi_wcsncat * DESCRIPTION * Appends at most count characters of the source string onto the * end of destination string, and ALWAYS terminates with a null character. * If count is greater than the length of source string, the length of source * string is used instead. (Like app_ucs2_wcsncpy, this routine does not pad out * to count characters). * PARAMETERS * str_dst : [OUT] UCS2 encoded destination string(wide-character) to be appended. * str_src : [IN] UCS2 encoded source string(wide-character) to be appended * to the end of destination string. * count : [IN] Number of characters to append. * RETURNS * A pointer to the destination string. *****************************************************************************/ extern WCHAR *mmi_wcsncat(WCHAR *str_dst, const WCHAR *str_src, U32 count); /***************************************************************************** * FUNCTION * mmi_wcsstr * DESCRIPTION * Find a substring. * PARAMETERS * string : [IN] UCS2 encoded string(wide-character) to search. * str_char_set : [IN] UCS2 encoded string(wide-character) to search for. * RETURNS * Returns a pointer to the first occurrence of str_char_set in string, or * NULL if str_char_set does not appear in string. If str_char_set points to * a string of zero length, the function returns string. *****************************************************************************/ extern WCHAR *mmi_wcsstr(WCHAR *string, const WCHAR *str_char_set); /***************************************************************************** * FUNCTION * mmi_wcschr * DESCRIPTION * Searches a UCS2 encoded string(wide-character) for a given wide-character, * which may be the null character L'\0'. * PARAMETERS * string : [IN] UCS2 encoded string(wide-character) to search in. * ch : [IN] UCS2 encoded wide-character to search for. * RETURNS * returns pointer to the first occurrence of ch in string * returns NULL if ch does not occur in string *****************************************************************************/ extern WCHAR *mmi_wcschr(const WCHAR *string, WCHAR ch); /***************************************************************************** * FUNCTION * mmi_wcsrchr * DESCRIPTION * Scan a UCS2 encoded string(wide-character) for the last occurrence of a * character. * PARAMETERS * string : [IN] UCS2 encoded string(wide-character) to search in. * ch : [IN] UCS2 encoded wide-character to search for. * RETURNS * returns pointer to the last occurrence of ch in string * returns NULL if ch does not occur in string *****************************************************************************/ extern WCHAR *mmi_wcsrchr(const WCHAR * string, WCHAR ch); /***************************************************************************** * FUNCTION * mmi_wcslwr * DESCRIPTION * mmi_wcslwr converts upper-case characters in a null-terminated * UCS2 encoded string(wide-character) to their lower-case equivalents. * PARAMETERS * string : [IN] UCS2 encoded string(wide-character) to change to lower * case. * RETURNS * returns a pointer to the converted string. Because the modification is * done in place, the pointer returned is the same as the pointer passed * as the input argument. *****************************************************************************/ extern WCHAR *mmi_wcslwr(WCHAR *string); /***************************************************************************** * FUNCTION * mmi_wcslwr * DESCRIPTION * mmi_wcslwr converts upper-case characters in a null-terminated * UCS2 encoded string(wide-character) to their lower-case equivalents. * PARAMETERS * string : [IN] UCS2 encoded string(wide-character) to change to lower * case. * RETURNS * returns a pointer to the converted string. Because the modification is * done in place, the pointer returned is the same as the pointer passed * as the input argument. *****************************************************************************/ extern WCHAR *mmi_wcsupr(WCHAR *string); /***************************************************************************** * FUNCTION * mmi_wcsicmp * DESCRIPTION * mmi_wcsicmp perform a case-insensitive wchar_t UCS2 encoded * string(wide-character) comparison. * PARAMETERS * str_src : [IN] UCS2 encoded destination string(wide-character) for * left-hand side of comparison. * str_dst : [IN] UCS2 encoded source string(wide-character) for right-hand * side of comparison. * RETURNS * returns <0 if str_src < str_dst * returns 0 if str_src == str_dst * returns >0 if str_src > str_dst *****************************************************************************/ extern S32 mmi_wcsicmp(const WCHAR *str_src, const WCHAR *str_dst); /***************************************************************************** * FUNCTION * mmi_wcsnicmp * DESCRIPTION * Compares two UCS2 encoded strings(wide-character) for lexical order * without regard to case. * The comparison stops after: * (1) a difference between the strings is found; * (2) the end of the strings is reached; * (3) count characters have been compared (wide-character strings). * PARAMETERS * str_src : [IN] UCS2 encoded destination string(wide-character) for * left-hand side of comparison. * str_dst : [IN] UCS2 encoded source string(wide-character) for right-hand * side of comparison. * count : [IN] Number of characters to compare. * RETURNS * returns -1 if str_src < str_dst * returns 0 if str_src == str_dst * returns +1 if str_src > str_dst *****************************************************************************/ extern S32 mmi_wcsnicmp(const WCHAR *str_src, const WCHAR *str_dst, U32 count); /***************************************************************************** * FUNCTION * mmi_towlower * DESCRIPTION * Convert character to lowercase. * PARAMETERS * wc : [IN] Character to convert. * RETURNS * Each of these routines converts a copy of wc, if possible, and returns the * result. ****************************************************************************/ extern WCHAR mmi_towlower(WCHAR wc); /***************************************************************************** * FUNCTION * mmi_towupper * DESCRIPTION * Convert character to uppercase. * PARAMETERS * wc : [IN] Character to convert. * RETURNS * Each of these routines converts a copy of wc, if possible, and returns the * result. *****************************************************************************/ extern WCHAR mmi_towupper(WCHAR wc); /***************************************************************************** * FUNCTION * mmi_wcs_wtoi * DESCRIPTION * Convert string to integer. * PARAMETERS * pInbuf : [IN] input string * RETURNS * returns a pointer to string. *****************************************************************************/ extern S32 mmi_wcs_wtoi(WCHAR *pInbuf); /***************************************************************************** * FUNCTION * mmi_wcs_itow * DESCRIPTION * Convert an integer to a string. * PARAMETERS * value : [IN] Number to be converted. * pOutbuf : [OUT] String result. * radix : [IN] Base of value; must be in the range 2 – 36. * RETURNS * returns a pointer to string. *****************************************************************************/ extern WCHAR *mmi_wcs_itow(S32 value, WCHAR *pOutbuf, U32 radix); #endif /* _UNICODEXDCL_H_ */
tnakaicode/ChargedPaticle-LowEnergy
src/ef/util/subclasses.py
def get_all_subclasses(cls): subclasses = set() todo = [cls] while todo: parent = todo.pop() for child in parent.__subclasses__(): if child not in subclasses: subclasses.add(child) todo.append(child) return subclasses
Fefe-Hern/SAIN-Report
src/window/sainReport/SainViewMajorsWindow.java
<filename>src/window/sainReport/SainViewMajorsWindow.java package window.sainReport; import window.admin.*; import controller.AccountController; import controller.MajorController; import controller.Serializer; import javafx.application.Application; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.control.RadioButton; import javafx.scene.control.TextField; import javafx.scene.control.Toggle; import javafx.scene.control.ToggleGroup; import javafx.scene.layout.BorderPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.Priority; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.stage.Stage; /** * * @author Fefe-Hern <https://github.com/Fefe-Hern> */ public class SainViewMajorsWindow { static ListView<String> majorList = new ListView<>(); static ObservableList<String> data; static Button selectMajorButton; static Button cancelButton; static final Label MAJORNAMELABEL = new Label(); static String userAccountName; /** * * @param userName * @return */ public static Scene createScene(String userName) { userAccountName = userName; createListView(); addFields(); VBox box = new VBox(); box.getChildren().addAll(majorList, MAJORNAMELABEL, selectMajorButton, cancelButton); VBox.setVgrow(majorList, Priority.ALWAYS); StackPane root = new StackPane(); root.getChildren().add(box); Scene scene = new Scene(root, 300, 250); return scene; } private static void addFields() { selectMajorButton = new Button("Select Major"); selectMajorButton.setOnAction((ActionEvent event) -> { Stage stage = new Stage(); stage.setScene(SainReportWindow.createScene(userAccountName, majorList.getSelectionModel().getSelectedItem())); stage.show(); }); cancelButton = new Button("Save and Quit"); cancelButton.setOnAction((ActionEvent event) -> { Serializer.saveFiles(); Stage stage = (Stage) cancelButton.getScene().getWindow(); stage.close(); }); } private static void createListView() { data = FXCollections.observableArrayList(); MajorController.loadMajorsToData("SAIN"); majorList.setItems(data); majorList.getSelectionModel().selectedItemProperty().addListener((ObservableValue<? extends String> ov, String old_val, String new_val) -> { MAJORNAMELABEL.setText(new_val); }); } /** * */ public static void refreshListView() { createListView(); } /** * * @param name */ public static void addMajorToData(String name) { data.add(name); } }
defaultbranch/RxJavaRiddles
src/main/java/com/vanniktech/rxriddles/operators/multiplestreams/Riddle5.java
<reponame>defaultbranch/RxJavaRiddles package com.vanniktech.rxriddles.operators.multiplestreams; import io.reactivex.rxjava3.core.Observable; class Riddle5 { /** * Sum up the latest values of [first] and [second] whenever one of the Observables emits a new value. * <p> * Use case: Two input fields in a calculator that need to be summed up and the result should be updated every time one of the inputs change. */ public static Observable<Integer> solve(Observable<Integer> first, Observable<Integer> second) { //TODO() return null; } }
monkeybars/monkeybars-core
lib/monkeybars/validated_hash.rb
<reponame>monkeybars/monkeybars-core<filename>lib/monkeybars/validated_hash.rb class InvalidHashKeyError < Exception; end module ValidatedHash # Raises an exception if a key in the hash does not exist in the list of valid keys def validate_only *keys self.keys.each {|key| raise InvalidHashKeyError.new("#{key} is not a valid key for this hash") unless keys.member?(key)} end # Raises an exception if any of the keys provided are not found in the hash def validate_all *keys keys.each {|key| raise InvalidHashKeyError.new("#{key} is required for this hash") unless self.keys.member?(key)} end # Raises an exception if any of the keys provided are found in the hash def validate_none *keys keys.each {|key| raise InvalidHashKeyError.new("#{key} is not allowed for this hash") if self.keys.member?(key)} end end class Hash include ValidatedHash end
wl-online-payments-direct/sdk-ruby
lib/onlinepayments/sdk/domain/personal_name.rb
<gh_stars>0 # # This class was auto-generated. # require 'onlinepayments/sdk/data_object' module OnlinePayments::SDK module Domain # @attr [String] first_name # @attr [String] surname # @attr [String] title class PersonalName < OnlinePayments::SDK::DataObject attr_accessor :first_name attr_accessor :surname attr_accessor :title # @return (Hash) def to_h hash = super hash['firstName'] = @first_name unless @first_name.nil? hash['surname'] = @surname unless @surname.nil? hash['title'] = @title unless @title.nil? hash end def from_hash(hash) super @first_name = hash['firstName'] if hash.key? 'firstName' @surname = hash['surname'] if hash.key? 'surname' @title = hash['title'] if hash.key? 'title' end end end end
VSecLab/XMLtoDB
src/main/java/com/unicampania/xmltodb/processor/parasequence_processor/ProcessorXref.java
package com.unicampania.xmltodb.processor.parasequence_processor; import com.unicampania.xmltodb.model.parasequence.Url; import com.unicampania.xmltodb.model.parasequence.Xref; import org.springframework.batch.item.ItemProcessor; public class ProcessorXref implements ItemProcessor<Xref, Xref> { @Override public Xref process(Xref xref) throws Exception { return xref; } }
anton23/gpanalyser
src-probes/uk/ac/imperial/doc/gpa/probes/AbstractProbeRunner.java
<reponame>anton23/gpanalyser package uk.ac.imperial.doc.gpa.probes; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import uk.ac.imperial.doc.gpa.pctmc.GPEPAToPCTMC; import uk.ac.imperial.doc.gpepa.representation.components.AbstractPrefix; import uk.ac.imperial.doc.gpepa.representation.components.ComponentId; import uk.ac.imperial.doc.gpepa.representation.components.PEPAComponentDefinitions; import uk.ac.imperial.doc.gpepa.representation.components.Prefix; import uk.ac.imperial.doc.gpepa.representation.group.GroupComponentPair; import uk.ac.imperial.doc.gpepa.representation.model.GroupedModel; import uk.ac.imperial.doc.gpepa.states.GPEPAActionCount; import uk.ac.imperial.doc.gpepa.states.GPEPAState; import uk.ac.imperial.doc.igpepa.representation.components.iPEPAPrefix; import uk.ac.imperial.doc.jexpressions.constants.Constants; import uk.ac.imperial.doc.jexpressions.expressions.AbstractExpression; import uk.ac.imperial.doc.jexpressions.expressions.DivExpression; import uk.ac.imperial.doc.jexpressions.expressions.DoubleExpression; import uk.ac.imperial.doc.jexpressions.expressions.ProductExpression; import uk.ac.imperial.doc.jexpressions.expressions.SumExpression; import uk.ac.imperial.doc.jexpressions.variables.ExpressionVariable; import uk.ac.imperial.doc.pctmc.analysis.AbstractPCTMCAnalysis; import uk.ac.imperial.doc.pctmc.expressions.CombinedPopulationProduct; import uk.ac.imperial.doc.pctmc.expressions.CombinedProductExpression; import uk.ac.imperial.doc.pctmc.expressions.PopulationProduct; import uk.ac.imperial.doc.pctmc.postprocessors.numerical.NumericalPostprocessor; import uk.ac.imperial.doc.pctmc.representation.PCTMC; import uk.ac.imperial.doc.pctmc.representation.State; import uk.ac.imperial.doc.pctmc.utils.PCTMCLogging; import uk.ac.imperial.doc.pctmc.utils.PCTMCOptions; import com.google.common.collect.HashMultiset; import com.google.common.collect.Multiset; public abstract class AbstractProbeRunner { private static ProbeGraph graph; protected Class<? extends AbstractPCTMCAnalysis> analysisType; protected Class<? extends NumericalPostprocessor> postprocessorType; protected static final String BEGIN_SIGNAL = "begin"; protected final Constants constants; private final Map<ExpressionVariable, AbstractExpression> unfoldedVariables; public AbstractProbeRunner (Constants constants, Map<ExpressionVariable, AbstractExpression> unfoldedVariables) { this.constants = constants; this.unfoldedVariables = unfoldedVariables; } protected abstract CDF steadyIndividual (List<AbstractExpression> statesCountExpressions, Map<String, Integer> mapping, GroupedModel model, Set<GPEPAState> stateObservers, PEPAComponentDefinitions mainDef, PEPAComponentDefinitions altDef, Map<PEPAComponentDefinitions, Set<ComponentId>> definitionsMap, Set<ComponentId> accepting, AbstractPCTMCAnalysis analysis, NumericalPostprocessor postprocessor, double steadyStateTime, String name); protected abstract CDF transientIndividual (List<AbstractExpression> statesCountExpressions, Map<String, Integer> mapping, GroupedModel model, Set<GPEPAState> stateObservers, PEPAComponentDefinitions mainDef, Map<PEPAComponentDefinitions, Set<ComponentId>> definitionsMap, Set<ComponentId> accepting, AbstractPCTMCAnalysis analysis, NumericalPostprocessor postprocessor, double steadyStateTime, String name); protected abstract CDF globalPassages (GlobalProbe gprobe, GroupedModel model, Set<GPEPAState> stateObservers, List<AbstractExpression> statesCountExpressions, Map<String, Integer> mapping, Set<String> countActions, Set<ComponentId> accepting, PEPAComponentDefinitions mainDef, AbstractPCTMCAnalysis analysis, NumericalPostprocessor postprocessor); public CDF executeProbedModel (GlobalProbe gprobe, GroupedModel model, Set<GPEPAState> stateObservers, PEPAComponentDefinitions mainDef, PEPAComponentDefinitions altDef, Map<PEPAComponentDefinitions, Set<ComponentId>> definitionsMap, Set<ComponentId> accepting, AbstractPCTMCAnalysis analysis, NumericalPostprocessor postprocessor, Set<String> alphabet, int mode, double modePar) { List<AbstractExpression> statesCountExpressions = new LinkedList<AbstractExpression> (); Map<String, Integer> mapping = new HashMap<String, Integer> (); CDF cdf = dispatchEvaluation (gprobe, model, stateObservers, statesCountExpressions, mapping, alphabet, mainDef, altDef, definitionsMap, accepting, analysis, postprocessor, mode, modePar); if (PCTMCOptions.gui) { plotGraph (gprobe.getName (), cdf, postprocessor.getStepSize()); } return cdf; } private CDF dispatchEvaluation (GlobalProbe gprobe, GroupedModel model, Set<GPEPAState> stateObservers, List<AbstractExpression> statesCountExpressions, Map<String, Integer> mapping, Set<String> countActions, PEPAComponentDefinitions mainDef, PEPAComponentDefinitions altDef, Map<PEPAComponentDefinitions, Set<ComponentId>> definitionsMap, Set<ComponentId> accepting, AbstractPCTMCAnalysis analysis, NumericalPostprocessor postprocessor, int mode, double modePar) { switch (mode) { case 1: return steadyIndividual (statesCountExpressions, mapping, model, stateObservers, mainDef, altDef, definitionsMap, accepting, analysis, postprocessor, modePar, gprobe.getName ()); case 2: return transientIndividual (statesCountExpressions, mapping, model, stateObservers, mainDef, definitionsMap, accepting, analysis, postprocessor, modePar, gprobe.getName ()); case 3: return globalPassages (gprobe, model, stateObservers, statesCountExpressions, mapping, countActions, accepting, mainDef, analysis, postprocessor); default: return null; } } protected double[] passageTimeCDF (double[][] obtainedMeasurements, Set<GroupComponentPair> pairs, Set<ComponentId> accepting, Map<String, Integer> mapping) { double[] cdf = new double[obtainedMeasurements.length]; for (ComponentId absorbingState : accepting) { for (GroupComponentPair gp : pairs) { if (gp.getComponent ().containsComponent (absorbingState)) { for (int i = 0; i < obtainedMeasurements.length; ++i) { cdf[i] += obtainedMeasurements[i] [mapping.get (gp.toString ())]; } } } } return cdf; } private void plotGraph (String name, CDF cdf, double stepSize) { if (graph == null) { graph = new ProbeGraph (); } graph.renderData (cdf, name, stepSize); } protected void getProbabilitiesAfterBegin (GroupedModel model, PEPAComponentDefinitions definitions, LinkedHashMap<GroupComponentPair, AbstractExpression> result) { Set<GroupComponentPair> pairs = model.getGroupComponentPairs (definitions); // total expected rate of all transitions firing begin signals Collection<AbstractExpression> summands = new ArrayList<AbstractExpression> (); for (GroupComponentPair hc : pairs) { Collection<String> actions = hc.getComponent () .getActions(definitions); Collection<AbstractPrefix> prefices = hc.getComponent ().getPrefixes (definitions); for (String action : actions) { for (AbstractPrefix prefix : prefices) { if (prefix.getAction ().equals (action) && (((iPEPAPrefix) prefix).getImmediates () .contains (BEGIN_SIGNAL) || (prefix.getAction ().equals (BEGIN_SIGNAL) && prefix instanceof Prefix))) { AbstractExpression arate = definitions.getApparentRateExpression (action, hc.getComponent ()); AbstractExpression crate = model.getComponentRateExpression (action, definitions, hc); summands.add (ProductExpression.create (prefix.getRate(), DivExpression.create(crate, arate))); } } } } AbstractExpression totalBeginRate = SumExpression.create (summands); // probability for each Q for (GroupComponentPair q : pairs) { if (totalBeginRate.equals (DoubleExpression.ZERO)) { result.put (q, DoubleExpression.ZERO); } else { summands = new ArrayList<AbstractExpression> (); for (GroupComponentPair hc : pairs) { Collection<String> actions = hc.getComponent ().getActions (definitions); Collection<AbstractPrefix> prefices = hc.getComponent ().getPrefixes (definitions); for (String action : actions) { for (AbstractPrefix prefix : prefices) { if (prefix.getAction ().equals (action) && prefix.getContinuation () .equals (q.getComponent ()) && (((iPEPAPrefix) prefix).getImmediates () .contains (BEGIN_SIGNAL) || (action.equals (BEGIN_SIGNAL) && prefix instanceof Prefix))) { AbstractExpression arate = definitions.getApparentRateExpression (action, hc.getComponent ()); AbstractExpression crate = model.getComponentRateExpression (action, definitions, hc); summands.add (ProductExpression.create (prefix.getRate (), DivExpression .create (crate, arate))); } } } } result.put (q, DivExpression.create (SumExpression.create(summands), totalBeginRate)); } } } protected void outputInfo (int i, int repetitions, String message) { if (i > 0 && i % (repetitions / 5 > 0 ? repetitions / 5 : 1) == 0) { PCTMCLogging.setVisible (true); PCTMCLogging.info ("Ran " + i + " " + message + "."); PCTMCLogging.setVisible (false); } } protected NumericalPostprocessor runTheProbedSystem (GroupedModel model, PEPAComponentDefinitions definitions, Constants constants, Set<String> countActionsSet, Collection<GPEPAState> stateObservers, List<AbstractExpression> statesCountExpressions, Map<String, Integer> stateCombPopMapping, AbstractPCTMCAnalysis templateAnalysis, NumericalPostprocessor templatePostprocessor, PCTMC[] pctmcs) { List<CombinedPopulationProduct> moments = new ArrayList<CombinedPopulationProduct> (); int index = 0; for (GPEPAState state : stateObservers) { Multiset<State> states = HashMultiset.create (); setStateObserver (states, state, state.toString (), moments, statesCountExpressions, stateCombPopMapping, index); ++index; } Set<String> initActions = countActionsSet; if (countActionsSet != null) { for (String action : countActionsSet) { GPEPAActionCount gpepaAction = new GPEPAActionCount (action); Multiset<State> cooperationActions = HashMultiset.create (); setStateObserver (cooperationActions, gpepaAction, action, moments, statesCountExpressions, stateCombPopMapping, index); ++index; } } else { initActions = new HashSet<String> (); } pctmcs[0] = GPEPAToPCTMC.getPCTMC (definitions, model, initActions, unfoldedVariables); //System.out.println (pctmcs[0]); AbstractPCTMCAnalysis analysis = getPreparedAnalysis(templateAnalysis, pctmcs[0], moments, constants); NumericalPostprocessor postprocessor = (NumericalPostprocessor) templatePostprocessor.regenerate(); return runPostProcessor (analysis, postprocessor, constants); } protected NumericalPostprocessor runPostProcessor (AbstractPCTMCAnalysis analysis, NumericalPostprocessor postprocessor, Constants constants) { postprocessor.prepare (analysis, constants); postprocessor.calculateDataPoints (constants); return postprocessor; } private void setStateObserver (Multiset<State> statesSet, State state, String mappingString, List<CombinedPopulationProduct> moments, List<AbstractExpression> statesCountExpressions, Map<String, Integer> stateCombPopMapping, int index) { statesSet.add (state); CombinedPopulationProduct combinedPopulation = new CombinedPopulationProduct (new PopulationProduct (statesSet)); moments.add (combinedPopulation); AbstractExpression combProd = CombinedProductExpression.create (combinedPopulation); statesCountExpressions.add (combProd); stateCombPopMapping.put (mappingString, index); } protected AbstractPCTMCAnalysis getPreparedAnalysis (AbstractPCTMCAnalysis template, PCTMC pctmc, List<CombinedPopulationProduct> moments, Constants constants) { AbstractPCTMCAnalysis analysis = template.regenerate(pctmc); analysis.setUsedMoments (moments); analysis.prepare (constants); return analysis; } }
rusucosmin/Cplusplus
easygraph/easygraph.cpp
<reponame>rusucosmin/Cplusplus #include <iostream> #include <fstream> #include <vector> #include <bitset> #include <set> using namespace std; const int maxn = 15005; const long long oo = (1LL << 60); set <int> g[maxn]; int n, m; int v[maxn]; long long dp[maxn], ans; bitset <maxn> used; void dfs(int node) { used[node] = 1; dp[node] = v[node]; for(auto it : g[node]) { if(!used[it]) dfs(it); dp[node] = max(dp[node], dp[it] + v[node]); } ans = max(ans, dp[node]); } int main() { ifstream fin("easygraph.in"); ofstream fout("easygraph.out"); int t; fin >> t; while(t --) { fin >> n >> m; for(int i = 1; i <= n; ++ i) fin >> v[i]; while(m --) { int x, y; fin >> x >> y; g[x].insert(y); } used.reset(); ans = -oo; for(int i = 1; i <= n; ++ i) if(!used[i]) dfs(i); fout << ans << '\n'; for(int i = 1; i <= n; ++ i) set <int> ().swap(g[i]); } }
zhuangli1987/LeetCode-1
0710-Random Pick with Blacklist/0710-Random Pick with Blacklist.cpp
class Solution { public: Solution(int N, vector<int> blacklist) { wlen = N - blacklist.size(); for (int b : blacklist) { table[b] = -1; } int mapped = N - 1; for (int b : blacklist) { if (b < wlen) { while (table.count(mapped)) { --mapped; } table[b] = mapped--; } } } int pick() { int index = rand() % wlen; return table.count(index) ? table[index] : index; } private: unordered_map<int, int> table; int wlen; }; /** * Your Solution object will be instantiated and called as such: * Solution obj = new Solution(N, blacklist); * int param_1 = obj.pick(); */
huseinzol05/Gather-Tensorflow-Serving
simple-backend/13.flask-gunicorn-haproxy/app.py
from flask import Flask, request, jsonify from textblob import TextBlob from ekphrasis.classes.preprocessor import TextPreProcessor from ekphrasis.classes.tokenizer import SocialTokenizer from ekphrasis.dicts.emoticons import emoticons from ekphrasis.classes.spellcorrect import SpellCorrector text_processor = TextPreProcessor( normalize = [ 'url', 'email', 'percent', 'money', 'phone', 'user', 'time', 'url', 'date', 'number', ], annotate = { 'hashtag', 'allcaps', 'elongated', 'repeated', 'emphasis', 'censored', }, fix_html = True, segmenter = 'twitter', corrector = 'twitter', unpack_hashtags = True, unpack_contractions = True, spell_correct_elong = False, tokenizer = SocialTokenizer(lowercase = True).tokenize, dicts = [emoticons], ) sp = SpellCorrector(corpus = 'english') app = Flask(__name__) def process_text(string): return ' '.join( [ sp.correct(c) for c in text_processor.pre_process_doc(string) if '<' not in c and '>' not in c and c not in ',!;:{}\'"!@#$%^&*(01234567890?/|\\' ] ) @app.route('/', methods = ['GET']) def hello(): return 'Hello!' @app.route('/classify', methods = ['GET']) def classify(): text = request.args.get('text') result = TextBlob(process_text(text)) return jsonify( { 'polarity': result.sentiment.polarity, 'subjectivity': result.sentiment.subjectivity, } ) application = app
jkuester/ccl-testing
jsch-util/src/main/java/com/cerner/ftp/jsch/impl/CachedConnection.java
<filename>jsch-util/src/main/java/com/cerner/ftp/jsch/impl/CachedConnection.java package com.cerner.ftp.jsch.impl; import java.net.URI; import java.util.HashSet; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.cerner.ftp.jsch.Connection; import com.cerner.ftp.jsch.impl.DefaultConnectionPool.ConnectionLibrarian; import com.jcraft.jsch.Channel; import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.ChannelShell; import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSchException; import com.jcraft.jsch.Session; import com.jcraft.jsch.UserInfo; /** * Implementation of {@link Connection}. * * @author <NAME> * */ public class CachedConnection implements Connection { private final Set<Channel> channels = new HashSet<Channel>(); private final Session session; private final ConnectionLibrarian<CachedConnection> librarian; private boolean closed; private static final Logger LOGGER = LoggerFactory.getLogger(CachedConnection.class); /** * Create a connection that uses a username/password form of authentication. * * @param username * The username. * @param password * The password. * @param serverAddress * A {@link URI} object representing the server address. * @param librarian * The {@link ConnectionLibrarian} that manages this connection. */ public CachedConnection(final String username, final String password, final URI serverAddress, final ConnectionLibrarian<CachedConnection> librarian) { this.librarian = librarian; this.session = createSession(username, password, serverAddress); } /** * Create a connection that uses a username/private key form of authentication. * * @param username * The username. * @param salt * The salt used to create private key. * @param privateKeyLocation * The location of the private key. * @param serverAddress * The address of the server. * @param librarian * The {@link ConnectionLibrarian} that manages this connection. */ public CachedConnection(final String username, final String salt, final URI privateKeyLocation, final URI serverAddress, final ConnectionLibrarian<CachedConnection> librarian) { this.librarian = librarian; this.session = createSession(username, salt, privateKeyLocation, serverAddress); } @Override public void close() { closed = true; for (final Channel channel : channels) { if (!channel.isClosed()) { channel.disconnect(); } } channels.clear(); librarian.checkIn(this); } /** * Physically close the connection wrapped by this object. */ public void closePhysical() { closed = true; if (session != null) { session.disconnect(); } } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final CachedConnection other = (CachedConnection) obj; if (session == null) { if (other.session != null) { return false; } } else if (!session.equals(other.session)) { return false; } return true; } @Override public ChannelSftp getSFtp() { if (isClosed()) { throw new IllegalStateException("Connection is closed."); } try { final ChannelSftp sftp = (ChannelSftp) session.openChannel("sftp"); channels.add(sftp); return sftp; } catch (final JSchException e) { throw new RuntimeException("Failed to open SFTP channel.", e); } } @Override public ChannelShell getShell() { if (isClosed()) { throw new IllegalStateException("Connection is closed."); } try { final ChannelShell shell = (ChannelShell) session.openChannel("shell"); channels.add(shell); return shell; } catch (final JSchException e) { throw new RuntimeException("Failed to open shell channel.", e); } } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((session == null) ? 0 : session.hashCode()); return result; } @Override public boolean isClosed() { return closed; } /** * JSch Logger * * @author <NAME> * */ public static class JschLogger implements com.jcraft.jsch.Logger { static java.util.Hashtable<Integer, String> name = new java.util.Hashtable<Integer, String>(); static { name.put(Integer.valueOf(DEBUG), "DEBUG: "); name.put(Integer.valueOf(INFO), "INFO: "); name.put(Integer.valueOf(WARN), "WARN: "); name.put(Integer.valueOf(ERROR), "ERROR: "); name.put(Integer.valueOf(FATAL), "FATAL: "); } /** * {@inheritDoc} */ @SuppressWarnings("synthetic-access") @Override public boolean isEnabled(final int level) { switch (level) { case DEBUG: return LOGGER.isDebugEnabled(); case INFO: return LOGGER.isInfoEnabled(); case WARN: return LOGGER.isWarnEnabled(); case ERROR: case FATAL: return LOGGER.isErrorEnabled(); default: return false; } } /** * {@inheritDoc} */ @SuppressWarnings("synthetic-access") @Override public void log(final int level, final String message) { switch (level) { case DEBUG: LOGGER.debug(message); break; case INFO: LOGGER.info(message); break; case WARN: LOGGER.warn(message); break; case ERROR: case FATAL: LOGGER.error(message); break; default: break; } } } /** * Create a session using username/password authentication. * * @param username * The username. * @param password * The password. * @param serverAddress * A {@link URI} object representing the location of the remote server. * @return A {@link Session} object representing a connection to the remote server. */ private Session createSession(final String username, final String password, final URI serverAddress) { JSch.setLogger(new JschLogger()); final JSch jsch = new JSch(); try { JSch.setConfig("PreferredAuthentications", "password"); final Session session = jsch.getSession(username, serverAddress.getPath(), 22); session.setUserInfo(new SimpleUserInfo(password, null)); session.connect(); return session; } catch (final JSchException e) { throw new RuntimeException("Failed to establish connection with username/password authentication.", e); } } /** * Create a session using username/private key authentication. * * @param username * The username. * @param salt * The salt used to create the private key. * @param privateKeyLocation * A {@link URI} object representing the location of the private key. * @param serverAddress * A {@link URI} object representing the location of the remote server. * @return A {@link Session} object representing a connnection to the remote server. */ private Session createSession(final String username, final String salt, final URI privateKeyLocation, final URI serverAddress) { final JSch jsch = new JSch(); try { JSch.setConfig("PreferredAuthentications", "publickey"); jsch.addIdentity(privateKeyLocation.toString()); final Session session = jsch.getSession(username, serverAddress.getPath(), 22); session.setUserInfo(new SimpleUserInfo(null, salt)); session.connect(); return session; } catch (final JSchException e) { throw new RuntimeException("Failed to establish connection with private key authentication.", e); } } /** * Mark the connection as opened. * * @throws IllegalStateException * If the connection wrapped by this object is either absent or has been physically closed. */ void open() { if (session == null || !session.isConnected()) { throw new IllegalStateException("Connection is either unavailable or physically closed."); } closed = false; } /** * Simple implementation of {@link UserInfo}. * * @author <NAME> * */ private static class SimpleUserInfo implements UserInfo { private final String password; private final String salt; /** * Create a user info object. * * @param password * The password. * @param salt * The salt. */ public SimpleUserInfo(final String password, final String salt) { this.password = password; this.salt = salt; } @Override public String getPassphrase() { return salt; } @Override public String getPassword() { return password; } @Override public boolean promptPassphrase(final String message) { return true; } @Override public boolean promptPassword(final String message) { return true; } @Override public boolean promptYesNo(final String message) { return true; } @Override public void showMessage(final String message) { } } }
afloarea/UniLab-2021
lab05/loto-api/src/main/java/ro/unibuc/lab05/loto/api/services/LotoService.java
package ro.unibuc.lab05.loto.api.services; import ro.unibuc.lab05.loto.api.controllers.ExtractionResult; import ro.unibuc.lab05.loto.api.dto.LotoRegistration; public interface LotoService { void registerTicket(LotoRegistration ticket); ExtractionResult extractWinners(double cheatChance, int[] cheatValues); }
myderam68/spring-boot-demo
shiro_jwt/src/main/java/com/springboot/demo/shiro_jwt/shiro/JwtRealm.java
<reponame>myderam68/spring-boot-demo package com.springboot.demo.shiro_jwt.shiro; import java.util.Set; import com.springboot.demo.shiro_jwt.domain.UserEntity; import com.springboot.demo.shiro_jwt.jwt.JwtToken; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AccountException; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authc.LockedAccountException; import org.apache.shiro.authc.SimpleAuthenticationInfo; import org.apache.shiro.authc.UnknownAccountException; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; /** * @Author: zjhan * @Date: 2021/5/26 17:27 * @Description: JwtRealm 只负责校验 JwtToken **/ public class JwtRealm extends AuthorizingRealm { /** * 限定这个 Realm 只处理我们自定义的 JwtToken */ @Override public boolean supports(AuthenticationToken token) { return token instanceof JwtToken; } /** * 此处的 SimpleAuthenticationInfo 可返回任意值,密码校验时不会用到它 */ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException { JwtToken jwtToken = (JwtToken) authcToken; if (jwtToken.getPrincipal() == null) { throw new AccountException("JWT token参数异常!"); } // 从 JwtToken 中获取当前用户 String username = jwtToken.getPrincipal().toString(); // 查询数据库获取用户信息,此处使用 Map 来模拟数据库 UserEntity user = ShiroRealm.userMap.get(username); // 用户不存在 if (user == null) { throw new UnknownAccountException("用户不存在!"); } // 用户被锁定 if (user.getLocked()) { throw new LockedAccountException("该用户已被锁定,暂时无法登录!"); } SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, username, getName()); return info; } @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { // 获取当前用户 UserEntity currentUser = (UserEntity) SecurityUtils.getSubject().getPrincipal(); // UserEntity currentUser = (UserEntity) principals.getPrimaryPrincipal(); // 查询数据库,获取用户的角色信息 Set<String> roles = ShiroRealm.roleMap.get(currentUser.getName()); // 查询数据库,获取用户的权限信息 Set<String> perms = ShiroRealm.permMap.get(currentUser.getName()); SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); info.setRoles(roles); info.setStringPermissions(perms); return info; } }
raptoravis/cr19
spu/tilesort/tilesortspu_lists_gen.c
<reponame>raptoravis/cr19<gh_stars>0 /* Copyright (c) 2001, Stanford University All rights reserved. See the file LICENSE.txt for information on redistributing this software. */ /* DO NOT EDIT - GENERATED by tilesort_lists.py SCRIPT */ #include <stdio.h> #include "cr_spu.h" #include "tilesortspu.h" #include "tilesortspu_proto.h" #include "cr_packfunctions.h" #include "cr_glstate.h" static int TILESORTSPU_APIENTRY tilesortspu_nop(void) { return 0; } #define CHANGE( name, func ) crSPUChangeInterface( (void *)&(tilesort_spu.self), (void *)tilesort_spu.self.name, (void *)((SPUGenericFunction) func) ) #define CHANGESWAP( name, swapfunc, regfunc ) crSPUChangeInterface( (void *)&(tilesort_spu.self), (void *)tilesort_spu.self.name, (void *)((SPUGenericFunction) (tilesort_spu.swap ? swapfunc: regfunc )) ) /* This function is called to install the dispatch table used during * display list compilation. */ void tilesortspuLoadListTable(void) { CHANGESWAP( Accum, crPackAccumSWAP, crPackAccum ); CHANGESWAP( ActiveTextureARB, crPackActiveTextureARBSWAP, crPackActiveTextureARB ); CHANGESWAP( AlphaFunc, crPackAlphaFuncSWAP, crPackAlphaFunc ); CHANGESWAP( AreProgramsResidentNV, crPackAreProgramsResidentNVSWAP, crPackAreProgramsResidentNV ); CHANGESWAP( AreTexturesResident, crPackAreTexturesResidentSWAP, crPackAreTexturesResident ); CHANGESWAP( BarrierCreateCR, crPackBarrierCreateCRSWAP, crPackBarrierCreateCR ); CHANGESWAP( BarrierDestroyCR, crPackBarrierDestroyCRSWAP, crPackBarrierDestroyCR ); CHANGESWAP( BarrierExecCR, crPackBarrierExecCRSWAP, crPackBarrierExecCR ); CHANGESWAP( Begin, crPackBeginSWAP, crPackBegin ); CHANGESWAP( BeginQueryARB, crPackBeginQueryARBSWAP, crPackBeginQueryARB ); CHANGESWAP( BindBufferARB, crPackBindBufferARBSWAP, crPackBindBufferARB ); CHANGESWAP( BindProgramARB, crPackBindProgramARBSWAP, crPackBindProgramARB ); CHANGESWAP( BindProgramNV, crPackBindProgramNVSWAP, crPackBindProgramNV ); CHANGESWAP( BindTexture, crPackBindTextureSWAP, crPackBindTexture ); CHANGESWAP( BlendColorEXT, crPackBlendColorEXTSWAP, crPackBlendColorEXT ); CHANGESWAP( BlendEquationEXT, crPackBlendEquationEXTSWAP, crPackBlendEquationEXT ); CHANGESWAP( BlendFunc, crPackBlendFuncSWAP, crPackBlendFunc ); CHANGESWAP( BlendFuncSeparateEXT, crPackBlendFuncSeparateEXTSWAP, crPackBlendFuncSeparateEXT ); CHANGESWAP( BufferDataARB, crPackBufferDataARBSWAP, crPackBufferDataARB ); CHANGESWAP( BufferSubDataARB, crPackBufferSubDataARBSWAP, crPackBufferSubDataARB ); CHANGESWAP( CallList, crPackCallListSWAP, crPackCallList ); CHANGESWAP( CallLists, crPackCallListsSWAP, crPackCallLists ); CHANGESWAP( ChromiumParameterfCR, crPackChromiumParameterfCRSWAP, crPackChromiumParameterfCR ); CHANGESWAP( ChromiumParameteriCR, crPackChromiumParameteriCRSWAP, crPackChromiumParameteriCR ); CHANGESWAP( ChromiumParametervCR, crPackChromiumParametervCRSWAP, crPackChromiumParametervCR ); CHANGESWAP( Clear, crPackClearSWAP, crPackClear ); CHANGESWAP( ClearAccum, crPackClearAccumSWAP, crPackClearAccum ); CHANGESWAP( ClearColor, crPackClearColorSWAP, crPackClearColor ); CHANGESWAP( ClearDepth, crPackClearDepthSWAP, crPackClearDepth ); CHANGESWAP( ClearIndex, crPackClearIndexSWAP, crPackClearIndex ); CHANGESWAP( ClearStencil, crPackClearStencilSWAP, crPackClearStencil ); CHANGESWAP( ClientActiveTextureARB, crPackClientActiveTextureARBSWAP, crPackClientActiveTextureARB ); CHANGESWAP( ClipPlane, crPackClipPlaneSWAP, crPackClipPlane ); CHANGESWAP( Color3b, crPackColor3bSWAP, crPackColor3b ); CHANGESWAP( Color3bv, crPackColor3bvSWAP, crPackColor3bv ); CHANGESWAP( Color3d, crPackColor3dSWAP, crPackColor3d ); CHANGESWAP( Color3dv, crPackColor3dvSWAP, crPackColor3dv ); CHANGESWAP( Color3f, crPackColor3fSWAP, crPackColor3f ); CHANGESWAP( Color3fv, crPackColor3fvSWAP, crPackColor3fv ); CHANGESWAP( Color3i, crPackColor3iSWAP, crPackColor3i ); CHANGESWAP( Color3iv, crPackColor3ivSWAP, crPackColor3iv ); CHANGESWAP( Color3s, crPackColor3sSWAP, crPackColor3s ); CHANGESWAP( Color3sv, crPackColor3svSWAP, crPackColor3sv ); CHANGESWAP( Color3ub, crPackColor3ubSWAP, crPackColor3ub ); CHANGESWAP( Color3ubv, crPackColor3ubvSWAP, crPackColor3ubv ); CHANGESWAP( Color3ui, crPackColor3uiSWAP, crPackColor3ui ); CHANGESWAP( Color3uiv, crPackColor3uivSWAP, crPackColor3uiv ); CHANGESWAP( Color3us, crPackColor3usSWAP, crPackColor3us ); CHANGESWAP( Color3usv, crPackColor3usvSWAP, crPackColor3usv ); CHANGESWAP( Color4b, crPackColor4bSWAP, crPackColor4b ); CHANGESWAP( Color4bv, crPackColor4bvSWAP, crPackColor4bv ); CHANGESWAP( Color4d, crPackColor4dSWAP, crPackColor4d ); CHANGESWAP( Color4dv, crPackColor4dvSWAP, crPackColor4dv ); CHANGESWAP( Color4f, crPackColor4fSWAP, crPackColor4f ); CHANGESWAP( Color4fv, crPackColor4fvSWAP, crPackColor4fv ); CHANGESWAP( Color4i, crPackColor4iSWAP, crPackColor4i ); CHANGESWAP( Color4iv, crPackColor4ivSWAP, crPackColor4iv ); CHANGESWAP( Color4s, crPackColor4sSWAP, crPackColor4s ); CHANGESWAP( Color4sv, crPackColor4svSWAP, crPackColor4sv ); CHANGESWAP( Color4ub, crPackColor4ubSWAP, crPackColor4ub ); CHANGESWAP( Color4ubv, crPackColor4ubvSWAP, crPackColor4ubv ); CHANGESWAP( Color4ui, crPackColor4uiSWAP, crPackColor4ui ); CHANGESWAP( Color4uiv, crPackColor4uivSWAP, crPackColor4uiv ); CHANGESWAP( Color4us, crPackColor4usSWAP, crPackColor4us ); CHANGESWAP( Color4usv, crPackColor4usvSWAP, crPackColor4usv ); CHANGESWAP( ColorMask, crPackColorMaskSWAP, crPackColorMask ); CHANGESWAP( ColorMaterial, crPackColorMaterialSWAP, crPackColorMaterial ); CHANGESWAP( ColorPointer, crPackColorPointerSWAP, crPackColorPointer ); CHANGESWAP( CombinerInputNV, crPackCombinerInputNVSWAP, crPackCombinerInputNV ); CHANGESWAP( CombinerOutputNV, crPackCombinerOutputNVSWAP, crPackCombinerOutputNV ); CHANGESWAP( CombinerParameterfNV, crPackCombinerParameterfNVSWAP, crPackCombinerParameterfNV ); CHANGESWAP( CombinerParameterfvNV, crPackCombinerParameterfvNVSWAP, crPackCombinerParameterfvNV ); CHANGESWAP( CombinerParameteriNV, crPackCombinerParameteriNVSWAP, crPackCombinerParameteriNV ); CHANGESWAP( CombinerParameterivNV, crPackCombinerParameterivNVSWAP, crPackCombinerParameterivNV ); CHANGESWAP( CombinerStageParameterfvNV, crPackCombinerStageParameterfvNVSWAP, crPackCombinerStageParameterfvNV ); CHANGESWAP( CompressedTexImage1DARB, crPackCompressedTexImage1DARBSWAP, crPackCompressedTexImage1DARB ); CHANGESWAP( CompressedTexImage2DARB, crPackCompressedTexImage2DARBSWAP, crPackCompressedTexImage2DARB ); CHANGESWAP( CompressedTexImage3DARB, crPackCompressedTexImage3DARBSWAP, crPackCompressedTexImage3DARB ); CHANGESWAP( CompressedTexSubImage1DARB, crPackCompressedTexSubImage1DARBSWAP, crPackCompressedTexSubImage1DARB ); CHANGESWAP( CompressedTexSubImage2DARB, crPackCompressedTexSubImage2DARBSWAP, crPackCompressedTexSubImage2DARB ); CHANGESWAP( CompressedTexSubImage3DARB, crPackCompressedTexSubImage3DARBSWAP, crPackCompressedTexSubImage3DARB ); CHANGESWAP( CopyPixels, crPackCopyPixelsSWAP, crPackCopyPixels ); CHANGESWAP( CopyTexImage1D, crPackCopyTexImage1DSWAP, crPackCopyTexImage1D ); CHANGESWAP( CopyTexImage2D, crPackCopyTexImage2DSWAP, crPackCopyTexImage2D ); CHANGESWAP( CopyTexSubImage1D, crPackCopyTexSubImage1DSWAP, crPackCopyTexSubImage1D ); CHANGESWAP( CopyTexSubImage2D, crPackCopyTexSubImage2DSWAP, crPackCopyTexSubImage2D ); CHANGESWAP( CopyTexSubImage3D, crPackCopyTexSubImage3DSWAP, crPackCopyTexSubImage3D ); CHANGESWAP( CreateContext, crPackCreateContextSWAP, crPackCreateContext ); CHANGESWAP( CullFace, crPackCullFaceSWAP, crPackCullFace ); CHANGESWAP( DeleteBuffersARB, crPackDeleteBuffersARBSWAP, crPackDeleteBuffersARB ); CHANGESWAP( DeleteFencesNV, crPackDeleteFencesNVSWAP, crPackDeleteFencesNV ); CHANGESWAP( DeleteProgramsARB, crPackDeleteProgramsARBSWAP, crPackDeleteProgramsARB ); CHANGESWAP( DeleteQueriesARB, crPackDeleteQueriesARBSWAP, crPackDeleteQueriesARB ); CHANGESWAP( DeleteTextures, crPackDeleteTexturesSWAP, crPackDeleteTextures ); CHANGESWAP( DepthFunc, crPackDepthFuncSWAP, crPackDepthFunc ); CHANGESWAP( DepthMask, crPackDepthMaskSWAP, crPackDepthMask ); CHANGESWAP( DepthRange, crPackDepthRangeSWAP, crPackDepthRange ); CHANGESWAP( DestroyContext, crPackDestroyContextSWAP, crPackDestroyContext ); CHANGESWAP( Disable, crPackDisableSWAP, crPackDisable ); CHANGESWAP( DisableClientState, crPackDisableClientStateSWAP, crPackDisableClientState ); CHANGESWAP( DisableVertexAttribArrayARB, crPackDisableVertexAttribArrayARBSWAP, crPackDisableVertexAttribArrayARB ); CHANGESWAP( DrawBuffer, crPackDrawBufferSWAP, crPackDrawBuffer ); CHANGESWAP( EdgeFlag, crPackEdgeFlagSWAP, crPackEdgeFlag ); CHANGESWAP( EdgeFlagPointer, crPackEdgeFlagPointerSWAP, crPackEdgeFlagPointer ); CHANGESWAP( EdgeFlagv, crPackEdgeFlagvSWAP, crPackEdgeFlagv ); CHANGESWAP( Enable, crPackEnableSWAP, crPackEnable ); CHANGESWAP( EnableClientState, crPackEnableClientStateSWAP, crPackEnableClientState ); CHANGESWAP( EnableVertexAttribArrayARB, crPackEnableVertexAttribArrayARBSWAP, crPackEnableVertexAttribArrayARB ); CHANGESWAP( End, crPackEndSWAP, crPackEnd ); CHANGESWAP( EndQueryARB, crPackEndQueryARBSWAP, crPackEndQueryARB ); CHANGESWAP( EvalCoord1d, crPackEvalCoord1dSWAP, crPackEvalCoord1d ); CHANGESWAP( EvalCoord1dv, crPackEvalCoord1dvSWAP, crPackEvalCoord1dv ); CHANGESWAP( EvalCoord1f, crPackEvalCoord1fSWAP, crPackEvalCoord1f ); CHANGESWAP( EvalCoord1fv, crPackEvalCoord1fvSWAP, crPackEvalCoord1fv ); CHANGESWAP( EvalCoord2d, crPackEvalCoord2dSWAP, crPackEvalCoord2d ); CHANGESWAP( EvalCoord2dv, crPackEvalCoord2dvSWAP, crPackEvalCoord2dv ); CHANGESWAP( EvalCoord2f, crPackEvalCoord2fSWAP, crPackEvalCoord2f ); CHANGESWAP( EvalCoord2fv, crPackEvalCoord2fvSWAP, crPackEvalCoord2fv ); CHANGESWAP( EvalMesh1, crPackEvalMesh1SWAP, crPackEvalMesh1 ); CHANGESWAP( EvalMesh2, crPackEvalMesh2SWAP, crPackEvalMesh2 ); CHANGESWAP( EvalPoint1, crPackEvalPoint1SWAP, crPackEvalPoint1 ); CHANGESWAP( EvalPoint2, crPackEvalPoint2SWAP, crPackEvalPoint2 ); CHANGESWAP( ExecuteProgramNV, crPackExecuteProgramNVSWAP, crPackExecuteProgramNV ); CHANGESWAP( FinalCombinerInputNV, crPackFinalCombinerInputNVSWAP, crPackFinalCombinerInputNV ); CHANGESWAP( FinishFenceNV, crPackFinishFenceNVSWAP, crPackFinishFenceNV ); CHANGESWAP( FlushVertexArrayRangeNV, crPackFlushVertexArrayRangeNVSWAP, crPackFlushVertexArrayRangeNV ); CHANGESWAP( FogCoordPointerEXT, crPackFogCoordPointerEXTSWAP, crPackFogCoordPointerEXT ); CHANGESWAP( FogCoorddEXT, crPackFogCoorddEXTSWAP, crPackFogCoorddEXT ); CHANGESWAP( FogCoorddvEXT, crPackFogCoorddvEXTSWAP, crPackFogCoorddvEXT ); CHANGESWAP( FogCoordfEXT, crPackFogCoordfEXTSWAP, crPackFogCoordfEXT ); CHANGESWAP( FogCoordfvEXT, crPackFogCoordfvEXTSWAP, crPackFogCoordfvEXT ); CHANGESWAP( Fogf, crPackFogfSWAP, crPackFogf ); CHANGESWAP( Fogfv, crPackFogfvSWAP, crPackFogfv ); CHANGESWAP( Fogi, crPackFogiSWAP, crPackFogi ); CHANGESWAP( Fogiv, crPackFogivSWAP, crPackFogiv ); CHANGESWAP( FrontFace, crPackFrontFaceSWAP, crPackFrontFace ); CHANGESWAP( Frustum, crPackFrustumSWAP, crPackFrustum ); CHANGESWAP( GenBuffersARB, crPackGenBuffersARBSWAP, crPackGenBuffersARB ); CHANGESWAP( GenFencesNV, crPackGenFencesNVSWAP, crPackGenFencesNV ); CHANGESWAP( GenProgramsARB, crPackGenProgramsARBSWAP, crPackGenProgramsARB ); CHANGESWAP( GenProgramsNV, crPackGenProgramsNVSWAP, crPackGenProgramsNV ); CHANGESWAP( GenQueriesARB, crPackGenQueriesARBSWAP, crPackGenQueriesARB ); CHANGESWAP( GenTextures, crPackGenTexturesSWAP, crPackGenTextures ); CHANGESWAP( GetBufferParameterivARB, crPackGetBufferParameterivARBSWAP, crPackGetBufferParameterivARB ); CHANGESWAP( GetBufferSubDataARB, crPackGetBufferSubDataARBSWAP, crPackGetBufferSubDataARB ); CHANGESWAP( GetChromiumParametervCR, crPackGetChromiumParametervCRSWAP, crPackGetChromiumParametervCR ); CHANGESWAP( GetCombinerInputParameterfvNV, crPackGetCombinerInputParameterfvNVSWAP, crPackGetCombinerInputParameterfvNV ); CHANGESWAP( GetCombinerInputParameterivNV, crPackGetCombinerInputParameterivNVSWAP, crPackGetCombinerInputParameterivNV ); CHANGESWAP( GetCombinerOutputParameterfvNV, crPackGetCombinerOutputParameterfvNVSWAP, crPackGetCombinerOutputParameterfvNV ); CHANGESWAP( GetCombinerOutputParameterivNV, crPackGetCombinerOutputParameterivNVSWAP, crPackGetCombinerOutputParameterivNV ); CHANGESWAP( GetCompressedTexImageARB, crPackGetCompressedTexImageARBSWAP, crPackGetCompressedTexImageARB ); CHANGESWAP( GetFenceivNV, crPackGetFenceivNVSWAP, crPackGetFenceivNV ); CHANGESWAP( GetFinalCombinerInputParameterfvNV, crPackGetFinalCombinerInputParameterfvNVSWAP, crPackGetFinalCombinerInputParameterfvNV ); CHANGESWAP( GetFinalCombinerInputParameterivNV, crPackGetFinalCombinerInputParameterivNVSWAP, crPackGetFinalCombinerInputParameterivNV ); CHANGESWAP( GetProgramEnvParameterdvARB, crPackGetProgramEnvParameterdvARBSWAP, crPackGetProgramEnvParameterdvARB ); CHANGESWAP( GetProgramEnvParameterfvARB, crPackGetProgramEnvParameterfvARBSWAP, crPackGetProgramEnvParameterfvARB ); CHANGESWAP( GetProgramLocalParameterdvARB, crPackGetProgramLocalParameterdvARBSWAP, crPackGetProgramLocalParameterdvARB ); CHANGESWAP( GetProgramLocalParameterfvARB, crPackGetProgramLocalParameterfvARBSWAP, crPackGetProgramLocalParameterfvARB ); CHANGESWAP( GetProgramNamedParameterdvNV, crPackGetProgramNamedParameterdvNVSWAP, crPackGetProgramNamedParameterdvNV ); CHANGESWAP( GetProgramNamedParameterfvNV, crPackGetProgramNamedParameterfvNVSWAP, crPackGetProgramNamedParameterfvNV ); CHANGESWAP( GetProgramParameterdvNV, crPackGetProgramParameterdvNVSWAP, crPackGetProgramParameterdvNV ); CHANGESWAP( GetProgramParameterfvNV, crPackGetProgramParameterfvNVSWAP, crPackGetProgramParameterfvNV ); CHANGESWAP( GetProgramStringARB, crPackGetProgramStringARBSWAP, crPackGetProgramStringARB ); CHANGESWAP( GetProgramStringNV, crPackGetProgramStringNVSWAP, crPackGetProgramStringNV ); CHANGESWAP( GetProgramivARB, crPackGetProgramivARBSWAP, crPackGetProgramivARB ); CHANGESWAP( GetProgramivNV, crPackGetProgramivNVSWAP, crPackGetProgramivNV ); CHANGESWAP( GetQueryObjectivARB, crPackGetQueryObjectivARBSWAP, crPackGetQueryObjectivARB ); CHANGESWAP( GetQueryObjectuivARB, crPackGetQueryObjectuivARBSWAP, crPackGetQueryObjectuivARB ); CHANGESWAP( GetQueryivARB, crPackGetQueryivARBSWAP, crPackGetQueryivARB ); CHANGESWAP( GetTrackMatrixivNV, crPackGetTrackMatrixivNVSWAP, crPackGetTrackMatrixivNV ); CHANGESWAP( GetVertexAttribPointervARB, crPackGetVertexAttribPointervARBSWAP, crPackGetVertexAttribPointervARB ); CHANGESWAP( GetVertexAttribPointervNV, crPackGetVertexAttribPointervNVSWAP, crPackGetVertexAttribPointervNV ); CHANGESWAP( GetVertexAttribdvARB, crPackGetVertexAttribdvARBSWAP, crPackGetVertexAttribdvARB ); CHANGESWAP( GetVertexAttribdvNV, crPackGetVertexAttribdvNVSWAP, crPackGetVertexAttribdvNV ); CHANGESWAP( GetVertexAttribfvARB, crPackGetVertexAttribfvARBSWAP, crPackGetVertexAttribfvARB ); CHANGESWAP( GetVertexAttribfvNV, crPackGetVertexAttribfvNVSWAP, crPackGetVertexAttribfvNV ); CHANGESWAP( GetVertexAttribivARB, crPackGetVertexAttribivARBSWAP, crPackGetVertexAttribivARB ); CHANGESWAP( GetVertexAttribivNV, crPackGetVertexAttribivNVSWAP, crPackGetVertexAttribivNV ); CHANGESWAP( Hint, crPackHintSWAP, crPackHint ); CHANGESWAP( IndexMask, crPackIndexMaskSWAP, crPackIndexMask ); CHANGESWAP( IndexPointer, crPackIndexPointerSWAP, crPackIndexPointer ); CHANGESWAP( Indexd, crPackIndexdSWAP, crPackIndexd ); CHANGESWAP( Indexdv, crPackIndexdvSWAP, crPackIndexdv ); CHANGESWAP( Indexf, crPackIndexfSWAP, crPackIndexf ); CHANGESWAP( Indexfv, crPackIndexfvSWAP, crPackIndexfv ); CHANGESWAP( Indexi, crPackIndexiSWAP, crPackIndexi ); CHANGESWAP( Indexiv, crPackIndexivSWAP, crPackIndexiv ); CHANGESWAP( Indexs, crPackIndexsSWAP, crPackIndexs ); CHANGESWAP( Indexsv, crPackIndexsvSWAP, crPackIndexsv ); CHANGESWAP( Indexub, crPackIndexubSWAP, crPackIndexub ); CHANGESWAP( Indexubv, crPackIndexubvSWAP, crPackIndexubv ); CHANGESWAP( InterleavedArrays, crPackInterleavedArraysSWAP, crPackInterleavedArrays ); CHANGESWAP( IsBufferARB, crPackIsBufferARBSWAP, crPackIsBufferARB ); CHANGESWAP( IsFenceNV, crPackIsFenceNVSWAP, crPackIsFenceNV ); CHANGESWAP( IsProgramARB, crPackIsProgramARBSWAP, crPackIsProgramARB ); CHANGESWAP( IsQueryARB, crPackIsQueryARBSWAP, crPackIsQueryARB ); CHANGESWAP( LightModelf, crPackLightModelfSWAP, crPackLightModelf ); CHANGESWAP( LightModelfv, crPackLightModelfvSWAP, crPackLightModelfv ); CHANGESWAP( LightModeli, crPackLightModeliSWAP, crPackLightModeli ); CHANGESWAP( LightModeliv, crPackLightModelivSWAP, crPackLightModeliv ); CHANGESWAP( Lightf, crPackLightfSWAP, crPackLightf ); CHANGESWAP( Lightfv, crPackLightfvSWAP, crPackLightfv ); CHANGESWAP( Lighti, crPackLightiSWAP, crPackLighti ); CHANGESWAP( Lightiv, crPackLightivSWAP, crPackLightiv ); CHANGESWAP( LineStipple, crPackLineStippleSWAP, crPackLineStipple ); CHANGESWAP( LineWidth, crPackLineWidthSWAP, crPackLineWidth ); CHANGESWAP( ListBase, crPackListBaseSWAP, crPackListBase ); CHANGESWAP( LoadIdentity, crPackLoadIdentitySWAP, crPackLoadIdentity ); CHANGESWAP( LoadMatrixd, crPackLoadMatrixdSWAP, crPackLoadMatrixd ); CHANGESWAP( LoadMatrixf, crPackLoadMatrixfSWAP, crPackLoadMatrixf ); CHANGESWAP( LoadProgramNV, crPackLoadProgramNVSWAP, crPackLoadProgramNV ); CHANGESWAP( LoadTransposeMatrixdARB, crPackLoadTransposeMatrixdARBSWAP, crPackLoadTransposeMatrixdARB ); CHANGESWAP( LoadTransposeMatrixfARB, crPackLoadTransposeMatrixfARBSWAP, crPackLoadTransposeMatrixfARB ); CHANGESWAP( LogicOp, crPackLogicOpSWAP, crPackLogicOp ); CHANGESWAP( MakeCurrent, crPackMakeCurrentSWAP, crPackMakeCurrent ); CHANGESWAP( Map1d, crPackMap1dSWAP, crPackMap1d ); CHANGESWAP( Map1f, crPackMap1fSWAP, crPackMap1f ); CHANGESWAP( Map2d, crPackMap2dSWAP, crPackMap2d ); CHANGESWAP( Map2f, crPackMap2fSWAP, crPackMap2f ); CHANGESWAP( MapBufferARB, crPackMapBufferARBSWAP, crPackMapBufferARB ); CHANGESWAP( MapGrid1d, crPackMapGrid1dSWAP, crPackMapGrid1d ); CHANGESWAP( MapGrid1f, crPackMapGrid1fSWAP, crPackMapGrid1f ); CHANGESWAP( MapGrid2d, crPackMapGrid2dSWAP, crPackMapGrid2d ); CHANGESWAP( MapGrid2f, crPackMapGrid2fSWAP, crPackMapGrid2f ); CHANGESWAP( Materialf, crPackMaterialfSWAP, crPackMaterialf ); CHANGESWAP( Materialfv, crPackMaterialfvSWAP, crPackMaterialfv ); CHANGESWAP( Materiali, crPackMaterialiSWAP, crPackMateriali ); CHANGESWAP( Materialiv, crPackMaterialivSWAP, crPackMaterialiv ); CHANGESWAP( MatrixMode, crPackMatrixModeSWAP, crPackMatrixMode ); CHANGESWAP( MultMatrixd, crPackMultMatrixdSWAP, crPackMultMatrixd ); CHANGESWAP( MultMatrixf, crPackMultMatrixfSWAP, crPackMultMatrixf ); CHANGESWAP( MultTransposeMatrixdARB, crPackMultTransposeMatrixdARBSWAP, crPackMultTransposeMatrixdARB ); CHANGESWAP( MultTransposeMatrixfARB, crPackMultTransposeMatrixfARBSWAP, crPackMultTransposeMatrixfARB ); CHANGESWAP( MultiDrawArraysEXT, crPackMultiDrawArraysEXTSWAP, crPackMultiDrawArraysEXT ); CHANGESWAP( MultiDrawElementsEXT, crPackMultiDrawElementsEXTSWAP, crPackMultiDrawElementsEXT ); CHANGESWAP( MultiTexCoord1dARB, crPackMultiTexCoord1dARBSWAP, crPackMultiTexCoord1dARB ); CHANGESWAP( MultiTexCoord1dvARB, crPackMultiTexCoord1dvARBSWAP, crPackMultiTexCoord1dvARB ); CHANGESWAP( MultiTexCoord1fARB, crPackMultiTexCoord1fARBSWAP, crPackMultiTexCoord1fARB ); CHANGESWAP( MultiTexCoord1fvARB, crPackMultiTexCoord1fvARBSWAP, crPackMultiTexCoord1fvARB ); CHANGESWAP( MultiTexCoord1iARB, crPackMultiTexCoord1iARBSWAP, crPackMultiTexCoord1iARB ); CHANGESWAP( MultiTexCoord1ivARB, crPackMultiTexCoord1ivARBSWAP, crPackMultiTexCoord1ivARB ); CHANGESWAP( MultiTexCoord1sARB, crPackMultiTexCoord1sARBSWAP, crPackMultiTexCoord1sARB ); CHANGESWAP( MultiTexCoord1svARB, crPackMultiTexCoord1svARBSWAP, crPackMultiTexCoord1svARB ); CHANGESWAP( MultiTexCoord2dARB, crPackMultiTexCoord2dARBSWAP, crPackMultiTexCoord2dARB ); CHANGESWAP( MultiTexCoord2dvARB, crPackMultiTexCoord2dvARBSWAP, crPackMultiTexCoord2dvARB ); CHANGESWAP( MultiTexCoord2fARB, crPackMultiTexCoord2fARBSWAP, crPackMultiTexCoord2fARB ); CHANGESWAP( MultiTexCoord2fvARB, crPackMultiTexCoord2fvARBSWAP, crPackMultiTexCoord2fvARB ); CHANGESWAP( MultiTexCoord2iARB, crPackMultiTexCoord2iARBSWAP, crPackMultiTexCoord2iARB ); CHANGESWAP( MultiTexCoord2ivARB, crPackMultiTexCoord2ivARBSWAP, crPackMultiTexCoord2ivARB ); CHANGESWAP( MultiTexCoord2sARB, crPackMultiTexCoord2sARBSWAP, crPackMultiTexCoord2sARB ); CHANGESWAP( MultiTexCoord2svARB, crPackMultiTexCoord2svARBSWAP, crPackMultiTexCoord2svARB ); CHANGESWAP( MultiTexCoord3dARB, crPackMultiTexCoord3dARBSWAP, crPackMultiTexCoord3dARB ); CHANGESWAP( MultiTexCoord3dvARB, crPackMultiTexCoord3dvARBSWAP, crPackMultiTexCoord3dvARB ); CHANGESWAP( MultiTexCoord3fARB, crPackMultiTexCoord3fARBSWAP, crPackMultiTexCoord3fARB ); CHANGESWAP( MultiTexCoord3fvARB, crPackMultiTexCoord3fvARBSWAP, crPackMultiTexCoord3fvARB ); CHANGESWAP( MultiTexCoord3iARB, crPackMultiTexCoord3iARBSWAP, crPackMultiTexCoord3iARB ); CHANGESWAP( MultiTexCoord3ivARB, crPackMultiTexCoord3ivARBSWAP, crPackMultiTexCoord3ivARB ); CHANGESWAP( MultiTexCoord3sARB, crPackMultiTexCoord3sARBSWAP, crPackMultiTexCoord3sARB ); CHANGESWAP( MultiTexCoord3svARB, crPackMultiTexCoord3svARBSWAP, crPackMultiTexCoord3svARB ); CHANGESWAP( MultiTexCoord4dARB, crPackMultiTexCoord4dARBSWAP, crPackMultiTexCoord4dARB ); CHANGESWAP( MultiTexCoord4dvARB, crPackMultiTexCoord4dvARBSWAP, crPackMultiTexCoord4dvARB ); CHANGESWAP( MultiTexCoord4fARB, crPackMultiTexCoord4fARBSWAP, crPackMultiTexCoord4fARB ); CHANGESWAP( MultiTexCoord4fvARB, crPackMultiTexCoord4fvARBSWAP, crPackMultiTexCoord4fvARB ); CHANGESWAP( MultiTexCoord4iARB, crPackMultiTexCoord4iARBSWAP, crPackMultiTexCoord4iARB ); CHANGESWAP( MultiTexCoord4ivARB, crPackMultiTexCoord4ivARBSWAP, crPackMultiTexCoord4ivARB ); CHANGESWAP( MultiTexCoord4sARB, crPackMultiTexCoord4sARBSWAP, crPackMultiTexCoord4sARB ); CHANGESWAP( MultiTexCoord4svARB, crPackMultiTexCoord4svARBSWAP, crPackMultiTexCoord4svARB ); CHANGESWAP( Normal3b, crPackNormal3bSWAP, crPackNormal3b ); CHANGESWAP( Normal3bv, crPackNormal3bvSWAP, crPackNormal3bv ); CHANGESWAP( Normal3d, crPackNormal3dSWAP, crPackNormal3d ); CHANGESWAP( Normal3dv, crPackNormal3dvSWAP, crPackNormal3dv ); CHANGESWAP( Normal3f, crPackNormal3fSWAP, crPackNormal3f ); CHANGESWAP( Normal3fv, crPackNormal3fvSWAP, crPackNormal3fv ); CHANGESWAP( Normal3i, crPackNormal3iSWAP, crPackNormal3i ); CHANGESWAP( Normal3iv, crPackNormal3ivSWAP, crPackNormal3iv ); CHANGESWAP( Normal3s, crPackNormal3sSWAP, crPackNormal3s ); CHANGESWAP( Normal3sv, crPackNormal3svSWAP, crPackNormal3sv ); CHANGESWAP( NormalPointer, crPackNormalPointerSWAP, crPackNormalPointer ); CHANGESWAP( Ortho, crPackOrthoSWAP, crPackOrtho ); CHANGESWAP( PixelMapfv, crPackPixelMapfvSWAP, crPackPixelMapfv ); CHANGESWAP( PixelMapuiv, crPackPixelMapuivSWAP, crPackPixelMapuiv ); CHANGESWAP( PixelMapusv, crPackPixelMapusvSWAP, crPackPixelMapusv ); CHANGESWAP( PixelStoref, crPackPixelStorefSWAP, crPackPixelStoref ); CHANGESWAP( PixelStorei, crPackPixelStoreiSWAP, crPackPixelStorei ); CHANGESWAP( PixelTransferf, crPackPixelTransferfSWAP, crPackPixelTransferf ); CHANGESWAP( PixelTransferi, crPackPixelTransferiSWAP, crPackPixelTransferi ); CHANGESWAP( PixelZoom, crPackPixelZoomSWAP, crPackPixelZoom ); CHANGESWAP( PointParameterfARB, crPackPointParameterfARBSWAP, crPackPointParameterfARB ); CHANGESWAP( PointParameterfvARB, crPackPointParameterfvARBSWAP, crPackPointParameterfvARB ); CHANGESWAP( PointParameteri, crPackPointParameteriSWAP, crPackPointParameteri ); CHANGESWAP( PointParameteriv, crPackPointParameterivSWAP, crPackPointParameteriv ); CHANGESWAP( PointSize, crPackPointSizeSWAP, crPackPointSize ); CHANGESWAP( PolygonMode, crPackPolygonModeSWAP, crPackPolygonMode ); CHANGESWAP( PolygonOffset, crPackPolygonOffsetSWAP, crPackPolygonOffset ); CHANGESWAP( PolygonStipple, crPackPolygonStippleSWAP, crPackPolygonStipple ); CHANGESWAP( PopAttrib, crPackPopAttribSWAP, crPackPopAttrib ); CHANGESWAP( PopMatrix, crPackPopMatrixSWAP, crPackPopMatrix ); CHANGESWAP( PrioritizeTextures, crPackPrioritizeTexturesSWAP, crPackPrioritizeTextures ); CHANGESWAP( ProgramEnvParameter4dARB, crPackProgramEnvParameter4dARBSWAP, crPackProgramEnvParameter4dARB ); CHANGESWAP( ProgramEnvParameter4dvARB, crPackProgramEnvParameter4dvARBSWAP, crPackProgramEnvParameter4dvARB ); CHANGESWAP( ProgramEnvParameter4fARB, crPackProgramEnvParameter4fARBSWAP, crPackProgramEnvParameter4fARB ); CHANGESWAP( ProgramEnvParameter4fvARB, crPackProgramEnvParameter4fvARBSWAP, crPackProgramEnvParameter4fvARB ); CHANGESWAP( ProgramLocalParameter4dARB, crPackProgramLocalParameter4dARBSWAP, crPackProgramLocalParameter4dARB ); CHANGESWAP( ProgramLocalParameter4dvARB, crPackProgramLocalParameter4dvARBSWAP, crPackProgramLocalParameter4dvARB ); CHANGESWAP( ProgramLocalParameter4fARB, crPackProgramLocalParameter4fARBSWAP, crPackProgramLocalParameter4fARB ); CHANGESWAP( ProgramLocalParameter4fvARB, crPackProgramLocalParameter4fvARBSWAP, crPackProgramLocalParameter4fvARB ); CHANGESWAP( ProgramNamedParameter4dNV, crPackProgramNamedParameter4dNVSWAP, crPackProgramNamedParameter4dNV ); CHANGESWAP( ProgramNamedParameter4dvNV, crPackProgramNamedParameter4dvNVSWAP, crPackProgramNamedParameter4dvNV ); CHANGESWAP( ProgramNamedParameter4fNV, crPackProgramNamedParameter4fNVSWAP, crPackProgramNamedParameter4fNV ); CHANGESWAP( ProgramNamedParameter4fvNV, crPackProgramNamedParameter4fvNVSWAP, crPackProgramNamedParameter4fvNV ); CHANGESWAP( ProgramParameter4dNV, crPackProgramParameter4dNVSWAP, crPackProgramParameter4dNV ); CHANGESWAP( ProgramParameter4dvNV, crPackProgramParameter4dvNVSWAP, crPackProgramParameter4dvNV ); CHANGESWAP( ProgramParameter4fNV, crPackProgramParameter4fNVSWAP, crPackProgramParameter4fNV ); CHANGESWAP( ProgramParameter4fvNV, crPackProgramParameter4fvNVSWAP, crPackProgramParameter4fvNV ); CHANGESWAP( ProgramParameters4dvNV, crPackProgramParameters4dvNVSWAP, crPackProgramParameters4dvNV ); CHANGESWAP( ProgramParameters4fvNV, crPackProgramParameters4fvNVSWAP, crPackProgramParameters4fvNV ); CHANGESWAP( ProgramStringARB, crPackProgramStringARBSWAP, crPackProgramStringARB ); CHANGESWAP( PushAttrib, crPackPushAttribSWAP, crPackPushAttrib ); CHANGESWAP( PushMatrix, crPackPushMatrixSWAP, crPackPushMatrix ); CHANGESWAP( RasterPos2d, crPackRasterPos2dSWAP, crPackRasterPos2d ); CHANGESWAP( RasterPos2dv, crPackRasterPos2dvSWAP, crPackRasterPos2dv ); CHANGESWAP( RasterPos2f, crPackRasterPos2fSWAP, crPackRasterPos2f ); CHANGESWAP( RasterPos2fv, crPackRasterPos2fvSWAP, crPackRasterPos2fv ); CHANGESWAP( RasterPos2i, crPackRasterPos2iSWAP, crPackRasterPos2i ); CHANGESWAP( RasterPos2iv, crPackRasterPos2ivSWAP, crPackRasterPos2iv ); CHANGESWAP( RasterPos2s, crPackRasterPos2sSWAP, crPackRasterPos2s ); CHANGESWAP( RasterPos2sv, crPackRasterPos2svSWAP, crPackRasterPos2sv ); CHANGESWAP( RasterPos3d, crPackRasterPos3dSWAP, crPackRasterPos3d ); CHANGESWAP( RasterPos3dv, crPackRasterPos3dvSWAP, crPackRasterPos3dv ); CHANGESWAP( RasterPos3f, crPackRasterPos3fSWAP, crPackRasterPos3f ); CHANGESWAP( RasterPos3fv, crPackRasterPos3fvSWAP, crPackRasterPos3fv ); CHANGESWAP( RasterPos3i, crPackRasterPos3iSWAP, crPackRasterPos3i ); CHANGESWAP( RasterPos3iv, crPackRasterPos3ivSWAP, crPackRasterPos3iv ); CHANGESWAP( RasterPos3s, crPackRasterPos3sSWAP, crPackRasterPos3s ); CHANGESWAP( RasterPos3sv, crPackRasterPos3svSWAP, crPackRasterPos3sv ); CHANGESWAP( RasterPos4d, crPackRasterPos4dSWAP, crPackRasterPos4d ); CHANGESWAP( RasterPos4dv, crPackRasterPos4dvSWAP, crPackRasterPos4dv ); CHANGESWAP( RasterPos4f, crPackRasterPos4fSWAP, crPackRasterPos4f ); CHANGESWAP( RasterPos4fv, crPackRasterPos4fvSWAP, crPackRasterPos4fv ); CHANGESWAP( RasterPos4i, crPackRasterPos4iSWAP, crPackRasterPos4i ); CHANGESWAP( RasterPos4iv, crPackRasterPos4ivSWAP, crPackRasterPos4iv ); CHANGESWAP( RasterPos4s, crPackRasterPos4sSWAP, crPackRasterPos4s ); CHANGESWAP( RasterPos4sv, crPackRasterPos4svSWAP, crPackRasterPos4sv ); CHANGESWAP( ReadBuffer, crPackReadBufferSWAP, crPackReadBuffer ); CHANGESWAP( Rectd, crPackRectdSWAP, crPackRectd ); CHANGESWAP( Rectdv, crPackRectdvSWAP, crPackRectdv ); CHANGESWAP( Rectf, crPackRectfSWAP, crPackRectf ); CHANGESWAP( Rectfv, crPackRectfvSWAP, crPackRectfv ); CHANGESWAP( Recti, crPackRectiSWAP, crPackRecti ); CHANGESWAP( Rectiv, crPackRectivSWAP, crPackRectiv ); CHANGESWAP( Rects, crPackRectsSWAP, crPackRects ); CHANGESWAP( Rectsv, crPackRectsvSWAP, crPackRectsv ); CHANGESWAP( RequestResidentProgramsNV, crPackRequestResidentProgramsNVSWAP, crPackRequestResidentProgramsNV ); CHANGESWAP( Rotated, crPackRotatedSWAP, crPackRotated ); CHANGESWAP( Rotatef, crPackRotatefSWAP, crPackRotatef ); CHANGESWAP( SampleCoverageARB, crPackSampleCoverageARBSWAP, crPackSampleCoverageARB ); CHANGESWAP( Scaled, crPackScaledSWAP, crPackScaled ); CHANGESWAP( Scalef, crPackScalefSWAP, crPackScalef ); CHANGESWAP( Scissor, crPackScissorSWAP, crPackScissor ); CHANGESWAP( SecondaryColor3bEXT, crPackSecondaryColor3bEXTSWAP, crPackSecondaryColor3bEXT ); CHANGESWAP( SecondaryColor3bvEXT, crPackSecondaryColor3bvEXTSWAP, crPackSecondaryColor3bvEXT ); CHANGESWAP( SecondaryColor3dEXT, crPackSecondaryColor3dEXTSWAP, crPackSecondaryColor3dEXT ); CHANGESWAP( SecondaryColor3dvEXT, crPackSecondaryColor3dvEXTSWAP, crPackSecondaryColor3dvEXT ); CHANGESWAP( SecondaryColor3fEXT, crPackSecondaryColor3fEXTSWAP, crPackSecondaryColor3fEXT ); CHANGESWAP( SecondaryColor3fvEXT, crPackSecondaryColor3fvEXTSWAP, crPackSecondaryColor3fvEXT ); CHANGESWAP( SecondaryColor3iEXT, crPackSecondaryColor3iEXTSWAP, crPackSecondaryColor3iEXT ); CHANGESWAP( SecondaryColor3ivEXT, crPackSecondaryColor3ivEXTSWAP, crPackSecondaryColor3ivEXT ); CHANGESWAP( SecondaryColor3sEXT, crPackSecondaryColor3sEXTSWAP, crPackSecondaryColor3sEXT ); CHANGESWAP( SecondaryColor3svEXT, crPackSecondaryColor3svEXTSWAP, crPackSecondaryColor3svEXT ); CHANGESWAP( SecondaryColor3ubEXT, crPackSecondaryColor3ubEXTSWAP, crPackSecondaryColor3ubEXT ); CHANGESWAP( SecondaryColor3ubvEXT, crPackSecondaryColor3ubvEXTSWAP, crPackSecondaryColor3ubvEXT ); CHANGESWAP( SecondaryColor3uiEXT, crPackSecondaryColor3uiEXTSWAP, crPackSecondaryColor3uiEXT ); CHANGESWAP( SecondaryColor3uivEXT, crPackSecondaryColor3uivEXTSWAP, crPackSecondaryColor3uivEXT ); CHANGESWAP( SecondaryColor3usEXT, crPackSecondaryColor3usEXTSWAP, crPackSecondaryColor3usEXT ); CHANGESWAP( SecondaryColor3usvEXT, crPackSecondaryColor3usvEXTSWAP, crPackSecondaryColor3usvEXT ); CHANGESWAP( SecondaryColorPointerEXT, crPackSecondaryColorPointerEXTSWAP, crPackSecondaryColorPointerEXT ); CHANGESWAP( SemaphoreCreateCR, crPackSemaphoreCreateCRSWAP, crPackSemaphoreCreateCR ); CHANGESWAP( SemaphoreDestroyCR, crPackSemaphoreDestroyCRSWAP, crPackSemaphoreDestroyCR ); CHANGESWAP( SemaphorePCR, crPackSemaphorePCRSWAP, crPackSemaphorePCR ); CHANGESWAP( SemaphoreVCR, crPackSemaphoreVCRSWAP, crPackSemaphoreVCR ); CHANGESWAP( SetFenceNV, crPackSetFenceNVSWAP, crPackSetFenceNV ); CHANGESWAP( ShadeModel, crPackShadeModelSWAP, crPackShadeModel ); CHANGESWAP( StencilFunc, crPackStencilFuncSWAP, crPackStencilFunc ); CHANGESWAP( StencilMask, crPackStencilMaskSWAP, crPackStencilMask ); CHANGESWAP( StencilOp, crPackStencilOpSWAP, crPackStencilOp ); CHANGESWAP( SwapBuffers, crPackSwapBuffersSWAP, crPackSwapBuffers ); CHANGESWAP( TestFenceNV, crPackTestFenceNVSWAP, crPackTestFenceNV ); CHANGESWAP( TexCoord1d, crPackTexCoord1dSWAP, crPackTexCoord1d ); CHANGESWAP( TexCoord1dv, crPackTexCoord1dvSWAP, crPackTexCoord1dv ); CHANGESWAP( TexCoord1f, crPackTexCoord1fSWAP, crPackTexCoord1f ); CHANGESWAP( TexCoord1fv, crPackTexCoord1fvSWAP, crPackTexCoord1fv ); CHANGESWAP( TexCoord1i, crPackTexCoord1iSWAP, crPackTexCoord1i ); CHANGESWAP( TexCoord1iv, crPackTexCoord1ivSWAP, crPackTexCoord1iv ); CHANGESWAP( TexCoord1s, crPackTexCoord1sSWAP, crPackTexCoord1s ); CHANGESWAP( TexCoord1sv, crPackTexCoord1svSWAP, crPackTexCoord1sv ); CHANGESWAP( TexCoord2d, crPackTexCoord2dSWAP, crPackTexCoord2d ); CHANGESWAP( TexCoord2dv, crPackTexCoord2dvSWAP, crPackTexCoord2dv ); CHANGESWAP( TexCoord2f, crPackTexCoord2fSWAP, crPackTexCoord2f ); CHANGESWAP( TexCoord2fv, crPackTexCoord2fvSWAP, crPackTexCoord2fv ); CHANGESWAP( TexCoord2i, crPackTexCoord2iSWAP, crPackTexCoord2i ); CHANGESWAP( TexCoord2iv, crPackTexCoord2ivSWAP, crPackTexCoord2iv ); CHANGESWAP( TexCoord2s, crPackTexCoord2sSWAP, crPackTexCoord2s ); CHANGESWAP( TexCoord2sv, crPackTexCoord2svSWAP, crPackTexCoord2sv ); CHANGESWAP( TexCoord3d, crPackTexCoord3dSWAP, crPackTexCoord3d ); CHANGESWAP( TexCoord3dv, crPackTexCoord3dvSWAP, crPackTexCoord3dv ); CHANGESWAP( TexCoord3f, crPackTexCoord3fSWAP, crPackTexCoord3f ); CHANGESWAP( TexCoord3fv, crPackTexCoord3fvSWAP, crPackTexCoord3fv ); CHANGESWAP( TexCoord3i, crPackTexCoord3iSWAP, crPackTexCoord3i ); CHANGESWAP( TexCoord3iv, crPackTexCoord3ivSWAP, crPackTexCoord3iv ); CHANGESWAP( TexCoord3s, crPackTexCoord3sSWAP, crPackTexCoord3s ); CHANGESWAP( TexCoord3sv, crPackTexCoord3svSWAP, crPackTexCoord3sv ); CHANGESWAP( TexCoord4d, crPackTexCoord4dSWAP, crPackTexCoord4d ); CHANGESWAP( TexCoord4dv, crPackTexCoord4dvSWAP, crPackTexCoord4dv ); CHANGESWAP( TexCoord4f, crPackTexCoord4fSWAP, crPackTexCoord4f ); CHANGESWAP( TexCoord4fv, crPackTexCoord4fvSWAP, crPackTexCoord4fv ); CHANGESWAP( TexCoord4i, crPackTexCoord4iSWAP, crPackTexCoord4i ); CHANGESWAP( TexCoord4iv, crPackTexCoord4ivSWAP, crPackTexCoord4iv ); CHANGESWAP( TexCoord4s, crPackTexCoord4sSWAP, crPackTexCoord4s ); CHANGESWAP( TexCoord4sv, crPackTexCoord4svSWAP, crPackTexCoord4sv ); CHANGESWAP( TexCoordPointer, crPackTexCoordPointerSWAP, crPackTexCoordPointer ); CHANGESWAP( TexEnvf, crPackTexEnvfSWAP, crPackTexEnvf ); CHANGESWAP( TexEnvfv, crPackTexEnvfvSWAP, crPackTexEnvfv ); CHANGESWAP( TexEnvi, crPackTexEnviSWAP, crPackTexEnvi ); CHANGESWAP( TexEnviv, crPackTexEnvivSWAP, crPackTexEnviv ); CHANGESWAP( TexGend, crPackTexGendSWAP, crPackTexGend ); CHANGESWAP( TexGendv, crPackTexGendvSWAP, crPackTexGendv ); CHANGESWAP( TexGenf, crPackTexGenfSWAP, crPackTexGenf ); CHANGESWAP( TexGenfv, crPackTexGenfvSWAP, crPackTexGenfv ); CHANGESWAP( TexGeni, crPackTexGeniSWAP, crPackTexGeni ); CHANGESWAP( TexGeniv, crPackTexGenivSWAP, crPackTexGeniv ); CHANGESWAP( TexImage1D, crPackTexImage1DSWAP, crPackTexImage1D ); CHANGESWAP( TexImage2D, crPackTexImage2DSWAP, crPackTexImage2D ); CHANGESWAP( TexImage3D, crPackTexImage3DSWAP, crPackTexImage3D ); CHANGESWAP( TexImage3DEXT, crPackTexImage3DEXTSWAP, crPackTexImage3DEXT ); CHANGESWAP( TexParameterf, crPackTexParameterfSWAP, crPackTexParameterf ); CHANGESWAP( TexParameterfv, crPackTexParameterfvSWAP, crPackTexParameterfv ); CHANGESWAP( TexParameteri, crPackTexParameteriSWAP, crPackTexParameteri ); CHANGESWAP( TexParameteriv, crPackTexParameterivSWAP, crPackTexParameteriv ); CHANGESWAP( TexSubImage1D, crPackTexSubImage1DSWAP, crPackTexSubImage1D ); CHANGESWAP( TexSubImage2D, crPackTexSubImage2DSWAP, crPackTexSubImage2D ); CHANGESWAP( TexSubImage3D, crPackTexSubImage3DSWAP, crPackTexSubImage3D ); CHANGESWAP( TrackMatrixNV, crPackTrackMatrixNVSWAP, crPackTrackMatrixNV ); CHANGESWAP( Translated, crPackTranslatedSWAP, crPackTranslated ); CHANGESWAP( Translatef, crPackTranslatefSWAP, crPackTranslatef ); CHANGESWAP( UnmapBufferARB, crPackUnmapBufferARBSWAP, crPackUnmapBufferARB ); CHANGESWAP( Vertex2d, crPackVertex2dBBOX_COUNTSWAP, crPackVertex2dBBOX_COUNT ); CHANGESWAP( Vertex2dv, crPackVertex2dvBBOX_COUNTSWAP, crPackVertex2dvBBOX_COUNT ); CHANGESWAP( Vertex2f, crPackVertex2fBBOX_COUNTSWAP, crPackVertex2fBBOX_COUNT ); CHANGESWAP( Vertex2fv, crPackVertex2fvBBOX_COUNTSWAP, crPackVertex2fvBBOX_COUNT ); CHANGESWAP( Vertex2i, crPackVertex2iBBOX_COUNTSWAP, crPackVertex2iBBOX_COUNT ); CHANGESWAP( Vertex2iv, crPackVertex2ivBBOX_COUNTSWAP, crPackVertex2ivBBOX_COUNT ); CHANGESWAP( Vertex2s, crPackVertex2sBBOX_COUNTSWAP, crPackVertex2sBBOX_COUNT ); CHANGESWAP( Vertex2sv, crPackVertex2svBBOX_COUNTSWAP, crPackVertex2svBBOX_COUNT ); CHANGESWAP( Vertex3d, crPackVertex3dBBOX_COUNTSWAP, crPackVertex3dBBOX_COUNT ); CHANGESWAP( Vertex3dv, crPackVertex3dvBBOX_COUNTSWAP, crPackVertex3dvBBOX_COUNT ); CHANGESWAP( Vertex3f, crPackVertex3fBBOX_COUNTSWAP, crPackVertex3fBBOX_COUNT ); CHANGESWAP( Vertex3fv, crPackVertex3fvBBOX_COUNTSWAP, crPackVertex3fvBBOX_COUNT ); CHANGESWAP( Vertex3i, crPackVertex3iBBOX_COUNTSWAP, crPackVertex3iBBOX_COUNT ); CHANGESWAP( Vertex3iv, crPackVertex3ivBBOX_COUNTSWAP, crPackVertex3ivBBOX_COUNT ); CHANGESWAP( Vertex3s, crPackVertex3sBBOX_COUNTSWAP, crPackVertex3sBBOX_COUNT ); CHANGESWAP( Vertex3sv, crPackVertex3svBBOX_COUNTSWAP, crPackVertex3svBBOX_COUNT ); CHANGESWAP( Vertex4d, crPackVertex4dBBOX_COUNTSWAP, crPackVertex4dBBOX_COUNT ); CHANGESWAP( Vertex4dv, crPackVertex4dvBBOX_COUNTSWAP, crPackVertex4dvBBOX_COUNT ); CHANGESWAP( Vertex4f, crPackVertex4fBBOX_COUNTSWAP, crPackVertex4fBBOX_COUNT ); CHANGESWAP( Vertex4fv, crPackVertex4fvBBOX_COUNTSWAP, crPackVertex4fvBBOX_COUNT ); CHANGESWAP( Vertex4i, crPackVertex4iBBOX_COUNTSWAP, crPackVertex4iBBOX_COUNT ); CHANGESWAP( Vertex4iv, crPackVertex4ivBBOX_COUNTSWAP, crPackVertex4ivBBOX_COUNT ); CHANGESWAP( Vertex4s, crPackVertex4sBBOX_COUNTSWAP, crPackVertex4sBBOX_COUNT ); CHANGESWAP( Vertex4sv, crPackVertex4svBBOX_COUNTSWAP, crPackVertex4svBBOX_COUNT ); CHANGESWAP( VertexArrayRangeNV, crPackVertexArrayRangeNVSWAP, crPackVertexArrayRangeNV ); CHANGESWAP( VertexAttrib1dARB, crPackVertexAttrib1dARBBBOX_COUNTSWAP, crPackVertexAttrib1dARBBBOX_COUNT ); CHANGESWAP( VertexAttrib1dvARB, crPackVertexAttrib1dvARBBBOX_COUNTSWAP, crPackVertexAttrib1dvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib1fARB, crPackVertexAttrib1fARBBBOX_COUNTSWAP, crPackVertexAttrib1fARBBBOX_COUNT ); CHANGESWAP( VertexAttrib1fvARB, crPackVertexAttrib1fvARBBBOX_COUNTSWAP, crPackVertexAttrib1fvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib1sARB, crPackVertexAttrib1sARBBBOX_COUNTSWAP, crPackVertexAttrib1sARBBBOX_COUNT ); CHANGESWAP( VertexAttrib1svARB, crPackVertexAttrib1svARBBBOX_COUNTSWAP, crPackVertexAttrib1svARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2dARB, crPackVertexAttrib2dARBBBOX_COUNTSWAP, crPackVertexAttrib2dARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2dvARB, crPackVertexAttrib2dvARBBBOX_COUNTSWAP, crPackVertexAttrib2dvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2fARB, crPackVertexAttrib2fARBBBOX_COUNTSWAP, crPackVertexAttrib2fARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2fvARB, crPackVertexAttrib2fvARBBBOX_COUNTSWAP, crPackVertexAttrib2fvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2sARB, crPackVertexAttrib2sARBBBOX_COUNTSWAP, crPackVertexAttrib2sARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2svARB, crPackVertexAttrib2svARBBBOX_COUNTSWAP, crPackVertexAttrib2svARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3dARB, crPackVertexAttrib3dARBBBOX_COUNTSWAP, crPackVertexAttrib3dARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3dvARB, crPackVertexAttrib3dvARBBBOX_COUNTSWAP, crPackVertexAttrib3dvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3fARB, crPackVertexAttrib3fARBBBOX_COUNTSWAP, crPackVertexAttrib3fARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3fvARB, crPackVertexAttrib3fvARBBBOX_COUNTSWAP, crPackVertexAttrib3fvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3sARB, crPackVertexAttrib3sARBBBOX_COUNTSWAP, crPackVertexAttrib3sARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3svARB, crPackVertexAttrib3svARBBBOX_COUNTSWAP, crPackVertexAttrib3svARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NbvARB, crPackVertexAttrib4NbvARBBBOX_COUNTSWAP, crPackVertexAttrib4NbvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NivARB, crPackVertexAttrib4NivARBBBOX_COUNTSWAP, crPackVertexAttrib4NivARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NsvARB, crPackVertexAttrib4NsvARBBBOX_COUNTSWAP, crPackVertexAttrib4NsvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NubARB, crPackVertexAttrib4NubARBBBOX_COUNTSWAP, crPackVertexAttrib4NubARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NubvARB, crPackVertexAttrib4NubvARBBBOX_COUNTSWAP, crPackVertexAttrib4NubvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NuivARB, crPackVertexAttrib4NuivARBBBOX_COUNTSWAP, crPackVertexAttrib4NuivARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NusvARB, crPackVertexAttrib4NusvARBBBOX_COUNTSWAP, crPackVertexAttrib4NusvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4bvARB, crPackVertexAttrib4bvARBBBOX_COUNTSWAP, crPackVertexAttrib4bvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4dARB, crPackVertexAttrib4dARBBBOX_COUNTSWAP, crPackVertexAttrib4dARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4dvARB, crPackVertexAttrib4dvARBBBOX_COUNTSWAP, crPackVertexAttrib4dvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4fARB, crPackVertexAttrib4fARBBBOX_COUNTSWAP, crPackVertexAttrib4fARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4fvARB, crPackVertexAttrib4fvARBBBOX_COUNTSWAP, crPackVertexAttrib4fvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4ivARB, crPackVertexAttrib4ivARBBBOX_COUNTSWAP, crPackVertexAttrib4ivARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4sARB, crPackVertexAttrib4sARBBBOX_COUNTSWAP, crPackVertexAttrib4sARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4svARB, crPackVertexAttrib4svARBBBOX_COUNTSWAP, crPackVertexAttrib4svARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4ubvARB, crPackVertexAttrib4ubvARBBBOX_COUNTSWAP, crPackVertexAttrib4ubvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4uivARB, crPackVertexAttrib4uivARBBBOX_COUNTSWAP, crPackVertexAttrib4uivARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4usvARB, crPackVertexAttrib4usvARBBBOX_COUNTSWAP, crPackVertexAttrib4usvARBBBOX_COUNT ); CHANGESWAP( VertexAttribPointerARB, crPackVertexAttribPointerARBSWAP, crPackVertexAttribPointerARB ); CHANGESWAP( VertexAttribPointerNV, crPackVertexAttribPointerNVSWAP, crPackVertexAttribPointerNV ); CHANGESWAP( VertexAttribs1dvNV, crPackVertexAttribs1dvNVSWAP, crPackVertexAttribs1dvNV ); CHANGESWAP( VertexAttribs1fvNV, crPackVertexAttribs1fvNVSWAP, crPackVertexAttribs1fvNV ); CHANGESWAP( VertexAttribs1svNV, crPackVertexAttribs1svNVSWAP, crPackVertexAttribs1svNV ); CHANGESWAP( VertexAttribs2dvNV, crPackVertexAttribs2dvNVSWAP, crPackVertexAttribs2dvNV ); CHANGESWAP( VertexAttribs2fvNV, crPackVertexAttribs2fvNVSWAP, crPackVertexAttribs2fvNV ); CHANGESWAP( VertexAttribs2svNV, crPackVertexAttribs2svNVSWAP, crPackVertexAttribs2svNV ); CHANGESWAP( VertexAttribs3dvNV, crPackVertexAttribs3dvNVSWAP, crPackVertexAttribs3dvNV ); CHANGESWAP( VertexAttribs3fvNV, crPackVertexAttribs3fvNVSWAP, crPackVertexAttribs3fvNV ); CHANGESWAP( VertexAttribs3svNV, crPackVertexAttribs3svNVSWAP, crPackVertexAttribs3svNV ); CHANGESWAP( VertexAttribs4dvNV, crPackVertexAttribs4dvNVSWAP, crPackVertexAttribs4dvNV ); CHANGESWAP( VertexAttribs4fvNV, crPackVertexAttribs4fvNVSWAP, crPackVertexAttribs4fvNV ); CHANGESWAP( VertexAttribs4svNV, crPackVertexAttribs4svNVSWAP, crPackVertexAttribs4svNV ); CHANGESWAP( VertexAttribs4ubvNV, crPackVertexAttribs4ubvNVSWAP, crPackVertexAttribs4ubvNV ); CHANGESWAP( VertexPointer, crPackVertexPointerSWAP, crPackVertexPointer ); CHANGESWAP( Viewport, crPackViewportSWAP, crPackViewport ); CHANGESWAP( WindowCreate, crPackWindowCreateSWAP, crPackWindowCreate ); CHANGESWAP( WindowDestroy, crPackWindowDestroySWAP, crPackWindowDestroy ); CHANGESWAP( WindowPos2dARB, crPackWindowPos2dARBSWAP, crPackWindowPos2dARB ); CHANGESWAP( WindowPos2dvARB, crPackWindowPos2dvARBSWAP, crPackWindowPos2dvARB ); CHANGESWAP( WindowPos2fARB, crPackWindowPos2fARBSWAP, crPackWindowPos2fARB ); CHANGESWAP( WindowPos2fvARB, crPackWindowPos2fvARBSWAP, crPackWindowPos2fvARB ); CHANGESWAP( WindowPos2iARB, crPackWindowPos2iARBSWAP, crPackWindowPos2iARB ); CHANGESWAP( WindowPos2ivARB, crPackWindowPos2ivARBSWAP, crPackWindowPos2ivARB ); CHANGESWAP( WindowPos2sARB, crPackWindowPos2sARBSWAP, crPackWindowPos2sARB ); CHANGESWAP( WindowPos2svARB, crPackWindowPos2svARBSWAP, crPackWindowPos2svARB ); CHANGESWAP( WindowPos3dARB, crPackWindowPos3dARBSWAP, crPackWindowPos3dARB ); CHANGESWAP( WindowPos3dvARB, crPackWindowPos3dvARBSWAP, crPackWindowPos3dvARB ); CHANGESWAP( WindowPos3fARB, crPackWindowPos3fARBSWAP, crPackWindowPos3fARB ); CHANGESWAP( WindowPos3fvARB, crPackWindowPos3fvARBSWAP, crPackWindowPos3fvARB ); CHANGESWAP( WindowPos3iARB, crPackWindowPos3iARBSWAP, crPackWindowPos3iARB ); CHANGESWAP( WindowPos3ivARB, crPackWindowPos3ivARBSWAP, crPackWindowPos3ivARB ); CHANGESWAP( WindowPos3sARB, crPackWindowPos3sARBSWAP, crPackWindowPos3sARB ); CHANGESWAP( WindowPos3svARB, crPackWindowPos3svARBSWAP, crPackWindowPos3svARB ); CHANGESWAP( WindowPosition, crPackWindowPositionSWAP, crPackWindowPosition ); CHANGESWAP( WindowShow, crPackWindowShowSWAP, crPackWindowShow ); CHANGESWAP( WindowSize, crPackWindowSizeSWAP, crPackWindowSize ); CHANGESWAP( Writeback, crPackWritebackSWAP, crPackWriteback ); } void tilesortspuLoadSortTable(void) { CHANGE( Accum, tilesortspu_Accum ); CHANGE( ActiveTextureARB, crStateActiveTextureARB ); CHANGE( AlphaFunc, crStateAlphaFunc ); CHANGE( AreProgramsResidentNV, crStateAreProgramsResidentNV ); CHANGE( AreTexturesResident, crStateAreTexturesResident ); CHANGE( BarrierCreateCR, tilesortspu_BarrierCreateCR ); CHANGE( BarrierDestroyCR, tilesortspu_BarrierDestroyCR ); CHANGE( BarrierExecCR, tilesortspu_BarrierExecCR ); CHANGE( Begin, tilesortspu_Begin ); CHANGE( BeginQueryARB, tilesortspu_BeginQueryARB ); CHANGE( BindBufferARB, crStateBindBufferARB ); CHANGE( BindProgramARB, crStateBindProgramARB ); CHANGE( BindProgramNV, crStateBindProgramNV ); CHANGE( BindTexture, crStateBindTexture ); CHANGESWAP( BlendColorEXT, crPackBlendColorEXTSWAP, crPackBlendColorEXT ); CHANGE( BlendEquationEXT, crStateBlendEquationEXT ); CHANGE( BlendFunc, crStateBlendFunc ); CHANGE( BlendFuncSeparateEXT, crStateBlendFuncSeparateEXT ); CHANGE( BoundsInfoCR, tilesortspu_BoundsInfoCR ); CHANGE( BufferDataARB, tilesortspu_BufferDataARB ); CHANGE( BufferSubDataARB, tilesortspu_BufferSubDataARB ); CHANGE( CallList, tilesortspu_CallList ); CHANGE( CallLists, tilesortspu_CallLists ); CHANGE( ChromiumParameterfCR, tilesortspu_ChromiumParameterfCR ); CHANGE( ChromiumParameteriCR, tilesortspu_ChromiumParameteriCR ); CHANGE( ChromiumParametervCR, tilesortspu_ChromiumParametervCR ); CHANGE( Clear, tilesortspu_Clear ); CHANGE( ClearAccum, crStateClearAccum ); CHANGE( ClearColor, crStateClearColor ); CHANGE( ClearDepth, crStateClearDepth ); CHANGE( ClearIndex, crStateClearIndex ); CHANGE( ClearStencil, crStateClearStencil ); CHANGE( ClientActiveTextureARB, crStateClientActiveTextureARB ); CHANGE( ClipPlane, crStateClipPlane ); CHANGESWAP( Color3b, crPackColor3bSWAP, crPackColor3b ); CHANGESWAP( Color3bv, crPackColor3bvSWAP, crPackColor3bv ); CHANGESWAP( Color3d, crPackColor3dSWAP, crPackColor3d ); CHANGESWAP( Color3dv, crPackColor3dvSWAP, crPackColor3dv ); CHANGESWAP( Color3f, crPackColor3fSWAP, crPackColor3f ); CHANGESWAP( Color3fv, crPackColor3fvSWAP, crPackColor3fv ); CHANGESWAP( Color3i, crPackColor3iSWAP, crPackColor3i ); CHANGESWAP( Color3iv, crPackColor3ivSWAP, crPackColor3iv ); CHANGESWAP( Color3s, crPackColor3sSWAP, crPackColor3s ); CHANGESWAP( Color3sv, crPackColor3svSWAP, crPackColor3sv ); CHANGESWAP( Color3ub, crPackColor3ubSWAP, crPackColor3ub ); CHANGESWAP( Color3ubv, crPackColor3ubvSWAP, crPackColor3ubv ); CHANGESWAP( Color3ui, crPackColor3uiSWAP, crPackColor3ui ); CHANGESWAP( Color3uiv, crPackColor3uivSWAP, crPackColor3uiv ); CHANGESWAP( Color3us, crPackColor3usSWAP, crPackColor3us ); CHANGESWAP( Color3usv, crPackColor3usvSWAP, crPackColor3usv ); CHANGESWAP( Color4b, crPackColor4bSWAP, crPackColor4b ); CHANGESWAP( Color4bv, crPackColor4bvSWAP, crPackColor4bv ); CHANGESWAP( Color4d, crPackColor4dSWAP, crPackColor4d ); CHANGESWAP( Color4dv, crPackColor4dvSWAP, crPackColor4dv ); CHANGESWAP( Color4f, crPackColor4fSWAP, crPackColor4f ); CHANGESWAP( Color4fv, crPackColor4fvSWAP, crPackColor4fv ); CHANGESWAP( Color4i, crPackColor4iSWAP, crPackColor4i ); CHANGESWAP( Color4iv, crPackColor4ivSWAP, crPackColor4iv ); CHANGESWAP( Color4s, crPackColor4sSWAP, crPackColor4s ); CHANGESWAP( Color4sv, crPackColor4svSWAP, crPackColor4sv ); CHANGESWAP( Color4ub, crPackColor4ubSWAP, crPackColor4ub ); CHANGESWAP( Color4ubv, crPackColor4ubvSWAP, crPackColor4ubv ); CHANGESWAP( Color4ui, crPackColor4uiSWAP, crPackColor4ui ); CHANGESWAP( Color4uiv, crPackColor4uivSWAP, crPackColor4uiv ); CHANGESWAP( Color4us, crPackColor4usSWAP, crPackColor4us ); CHANGESWAP( Color4usv, crPackColor4usvSWAP, crPackColor4usv ); CHANGE( ColorMask, crStateColorMask ); CHANGE( ColorMaterial, crStateColorMaterial ); CHANGE( ColorPointer, crStateColorPointer ); CHANGE( CombinerInputNV, crStateCombinerInputNV ); CHANGE( CombinerOutputNV, crStateCombinerOutputNV ); CHANGE( CombinerParameterfNV, crStateCombinerParameterfNV ); CHANGE( CombinerParameterfvNV, crStateCombinerParameterfvNV ); CHANGE( CombinerParameteriNV, crStateCombinerParameteriNV ); CHANGE( CombinerParameterivNV, crStateCombinerParameterivNV ); CHANGE( CombinerStageParameterfvNV, crStateCombinerStageParameterfvNV ); CHANGESWAP( CompressedTexImage1DARB, crPackCompressedTexImage1DARBSWAP, crPackCompressedTexImage1DARB ); CHANGESWAP( CompressedTexImage2DARB, crPackCompressedTexImage2DARBSWAP, crPackCompressedTexImage2DARB ); CHANGESWAP( CompressedTexImage3DARB, crPackCompressedTexImage3DARBSWAP, crPackCompressedTexImage3DARB ); CHANGESWAP( CompressedTexSubImage1DARB, crPackCompressedTexSubImage1DARBSWAP, crPackCompressedTexSubImage1DARB ); CHANGESWAP( CompressedTexSubImage2DARB, crPackCompressedTexSubImage2DARBSWAP, crPackCompressedTexSubImage2DARB ); CHANGESWAP( CompressedTexSubImage3DARB, crPackCompressedTexSubImage3DARBSWAP, crPackCompressedTexSubImage3DARB ); CHANGE( CopyPixels, tilesortspu_CopyPixels ); CHANGE( CopyTexImage1D, tilesortspu_CopyTexImage1D ); CHANGE( CopyTexImage2D, tilesortspu_CopyTexImage2D ); CHANGE( CopyTexSubImage1D, tilesortspu_CopyTexSubImage1D ); CHANGE( CopyTexSubImage2D, tilesortspu_CopyTexSubImage2D ); CHANGE( CopyTexSubImage3D, tilesortspu_CopyTexSubImage3D ); CHANGE( CreateContext, tilesortspu_CreateContext ); CHANGE( CullFace, crStateCullFace ); CHANGE( DeleteBuffersARB, tilesortspu_DeleteBuffersARB ); CHANGE( DeleteFencesNV, crStateDeleteFencesNV ); CHANGE( DeleteProgramsARB, tilesortspu_DeleteProgramsARB ); CHANGESWAP( DeleteQueriesARB, crPackDeleteQueriesARBSWAP, crPackDeleteQueriesARB ); CHANGE( DeleteTextures, tilesortspu_DeleteTextures ); CHANGE( DepthFunc, crStateDepthFunc ); CHANGE( DepthMask, crStateDepthMask ); CHANGE( DepthRange, crStateDepthRange ); CHANGE( DestroyContext, tilesortspu_DestroyContext ); CHANGE( Disable, crStateDisable ); CHANGE( DisableClientState, crStateDisableClientState ); CHANGESWAP( DisableVertexAttribArrayARB, crPackDisableVertexAttribArrayARBSWAP, crPackDisableVertexAttribArrayARB ); CHANGE( DrawBuffer, tilesortspu_DrawBuffer ); CHANGESWAP( EdgeFlag, crPackEdgeFlagSWAP, crPackEdgeFlag ); CHANGE( EdgeFlagPointer, crStateEdgeFlagPointer ); CHANGESWAP( EdgeFlagv, crPackEdgeFlagvSWAP, crPackEdgeFlagv ); CHANGE( Enable, crStateEnable ); CHANGE( EnableClientState, crStateEnableClientState ); CHANGESWAP( EnableVertexAttribArrayARB, crPackEnableVertexAttribArrayARBSWAP, crPackEnableVertexAttribArrayARB ); CHANGE( End, tilesortspu_End ); CHANGE( EndQueryARB, tilesortspu_EndQueryARB ); CHANGE( EvalCoord1d, tilesortspu_EvalCoord1d ); CHANGE( EvalCoord1dv, tilesortspu_EvalCoord1dv ); CHANGE( EvalCoord1f, tilesortspu_EvalCoord1f ); CHANGE( EvalCoord1fv, tilesortspu_EvalCoord1fv ); CHANGE( EvalCoord2d, tilesortspu_EvalCoord2d ); CHANGE( EvalCoord2dv, tilesortspu_EvalCoord2dv ); CHANGE( EvalCoord2f, tilesortspu_EvalCoord2f ); CHANGE( EvalCoord2fv, tilesortspu_EvalCoord2fv ); CHANGE( EvalMesh1, tilesortspu_EvalMesh1 ); CHANGE( EvalMesh2, tilesortspu_EvalMesh2 ); CHANGE( EvalPoint1, tilesortspu_EvalPoint1 ); CHANGE( EvalPoint2, tilesortspu_EvalPoint2 ); CHANGESWAP( ExecuteProgramNV, crPackExecuteProgramNVSWAP, crPackExecuteProgramNV ); CHANGE( FinalCombinerInputNV, crStateFinalCombinerInputNV ); CHANGESWAP( FinishFenceNV, crPackFinishFenceNVSWAP, crPackFinishFenceNV ); CHANGESWAP( FlushVertexArrayRangeNV, crPackFlushVertexArrayRangeNVSWAP, crPackFlushVertexArrayRangeNV ); CHANGESWAP( FogCoordPointerEXT, crPackFogCoordPointerEXTSWAP, crPackFogCoordPointerEXT ); CHANGESWAP( FogCoorddEXT, crPackFogCoorddEXTSWAP, crPackFogCoorddEXT ); CHANGESWAP( FogCoorddvEXT, crPackFogCoorddvEXTSWAP, crPackFogCoorddvEXT ); CHANGESWAP( FogCoordfEXT, crPackFogCoordfEXTSWAP, crPackFogCoordfEXT ); CHANGESWAP( FogCoordfvEXT, crPackFogCoordfvEXTSWAP, crPackFogCoordfvEXT ); CHANGE( Fogf, crStateFogf ); CHANGE( Fogfv, crStateFogfv ); CHANGE( Fogi, crStateFogi ); CHANGE( Fogiv, crStateFogiv ); CHANGE( FrontFace, crStateFrontFace ); CHANGE( Frustum, crStateFrustum ); CHANGE( GenBuffersARB, crStateGenBuffersARB ); CHANGE( GenFencesNV, crStateGenFencesNV ); CHANGE( GenProgramsARB, crStateGenProgramsARB ); CHANGE( GenProgramsNV, crStateGenProgramsNV ); CHANGE( GenQueriesARB, crStateGenQueriesARB ); CHANGE( GenTextures, crStateGenTextures ); CHANGE( GetBufferParameterivARB, crStateGetBufferParameterivARB ); CHANGE( GetBufferSubDataARB, tilesortspu_GetBufferSubDataARB ); CHANGE( GetChromiumParametervCR, tilesortspu_GetChromiumParametervCR ); CHANGE( GetCombinerInputParameterfvNV, crStateGetCombinerInputParameterfvNV ); CHANGE( GetCombinerInputParameterivNV, crStateGetCombinerInputParameterivNV ); CHANGE( GetCombinerOutputParameterfvNV, crStateGetCombinerOutputParameterfvNV ); CHANGE( GetCombinerOutputParameterivNV, crStateGetCombinerOutputParameterivNV ); CHANGESWAP( GetCompressedTexImageARB, crPackGetCompressedTexImageARBSWAP, crPackGetCompressedTexImageARB ); CHANGE( GetFenceivNV, crStateGetFenceivNV ); CHANGE( GetFinalCombinerInputParameterfvNV, crStateGetFinalCombinerInputParameterfvNV ); CHANGE( GetFinalCombinerInputParameterivNV, crStateGetFinalCombinerInputParameterivNV ); CHANGE( GetProgramEnvParameterdvARB, crStateGetProgramEnvParameterdvARB ); CHANGE( GetProgramEnvParameterfvARB, crStateGetProgramEnvParameterfvARB ); CHANGE( GetProgramLocalParameterdvARB, crStateGetProgramLocalParameterdvARB ); CHANGE( GetProgramLocalParameterfvARB, crStateGetProgramLocalParameterfvARB ); CHANGE( GetProgramNamedParameterdvNV, crStateGetProgramNamedParameterdvNV ); CHANGE( GetProgramNamedParameterfvNV, crStateGetProgramNamedParameterfvNV ); CHANGE( GetProgramParameterdvNV, crStateGetProgramParameterdvNV ); CHANGE( GetProgramParameterfvNV, crStateGetProgramParameterfvNV ); CHANGE( GetProgramStringARB, crStateGetProgramStringARB ); CHANGE( GetProgramStringNV, crStateGetProgramStringNV ); CHANGE( GetProgramivARB, crStateGetProgramivARB ); CHANGE( GetProgramivNV, crStateGetProgramivNV ); CHANGE( GetQueryObjectivARB, tilesortspu_GetQueryObjectivARB ); CHANGE( GetQueryObjectuivARB, tilesortspu_GetQueryObjectuivARB ); CHANGE( GetQueryivARB, crStateGetQueryivARB ); CHANGE( GetTrackMatrixivNV, crStateGetTrackMatrixivNV ); CHANGE( GetVertexAttribPointervARB, crStateGetVertexAttribPointervARB ); CHANGE( GetVertexAttribPointervNV, crStateGetVertexAttribPointervNV ); CHANGE( GetVertexAttribdvARB, crStateGetVertexAttribdvARB ); CHANGE( GetVertexAttribdvNV, crStateGetVertexAttribdvNV ); CHANGE( GetVertexAttribfvARB, crStateGetVertexAttribfvARB ); CHANGE( GetVertexAttribfvNV, crStateGetVertexAttribfvNV ); CHANGE( GetVertexAttribivARB, crStateGetVertexAttribivARB ); CHANGE( GetVertexAttribivNV, crStateGetVertexAttribivNV ); CHANGE( Hint, crStateHint ); CHANGE( IndexMask, crStateIndexMask ); CHANGE( IndexPointer, crStateIndexPointer ); CHANGESWAP( Indexd, crPackIndexdSWAP, crPackIndexd ); CHANGESWAP( Indexdv, crPackIndexdvSWAP, crPackIndexdv ); CHANGESWAP( Indexf, crPackIndexfSWAP, crPackIndexf ); CHANGESWAP( Indexfv, crPackIndexfvSWAP, crPackIndexfv ); CHANGESWAP( Indexi, crPackIndexiSWAP, crPackIndexi ); CHANGESWAP( Indexiv, crPackIndexivSWAP, crPackIndexiv ); CHANGESWAP( Indexs, crPackIndexsSWAP, crPackIndexs ); CHANGESWAP( Indexsv, crPackIndexsvSWAP, crPackIndexsv ); CHANGESWAP( Indexub, crPackIndexubSWAP, crPackIndexub ); CHANGESWAP( Indexubv, crPackIndexubvSWAP, crPackIndexubv ); CHANGE( InitNames, tilesortspu_InitNames ); CHANGE( InterleavedArrays, crStateInterleavedArrays ); CHANGESWAP( IsBufferARB, crPackIsBufferARBSWAP, crPackIsBufferARB ); CHANGE( IsFenceNV, crStateIsFenceNV ); CHANGE( IsProgramARB, crStateIsProgramARB ); CHANGE( IsQueryARB, crStateIsQueryARB ); CHANGE( LightModelf, crStateLightModelf ); CHANGE( LightModelfv, crStateLightModelfv ); CHANGE( LightModeli, crStateLightModeli ); CHANGE( LightModeliv, crStateLightModeliv ); CHANGE( Lightf, crStateLightf ); CHANGE( Lightfv, crStateLightfv ); CHANGE( Lighti, crStateLighti ); CHANGE( Lightiv, crStateLightiv ); CHANGE( LineStipple, crStateLineStipple ); CHANGE( LineWidth, crStateLineWidth ); CHANGE( ListBase, tilesortspu_ListBase ); CHANGE( LoadIdentity, crStateLoadIdentity ); CHANGE( LoadMatrixd, crStateLoadMatrixd ); CHANGE( LoadMatrixf, crStateLoadMatrixf ); CHANGE( LoadName, tilesortspu_LoadName ); CHANGE( LoadProgramNV, crStateLoadProgramNV ); CHANGE( LoadTransposeMatrixdARB, crStateLoadTransposeMatrixdARB ); CHANGE( LoadTransposeMatrixfARB, crStateLoadTransposeMatrixfARB ); CHANGE( LogicOp, crStateLogicOp ); CHANGE( MakeCurrent, tilesortspu_MakeCurrent ); CHANGE( Map1d, crStateMap1d ); CHANGE( Map1f, crStateMap1f ); CHANGE( Map2d, crStateMap2d ); CHANGE( Map2f, crStateMap2f ); CHANGE( MapBufferARB, tilesortspu_MapBufferARB ); CHANGE( MapGrid1d, crStateMapGrid1d ); CHANGE( MapGrid1f, crStateMapGrid1f ); CHANGE( MapGrid2d, crStateMapGrid2d ); CHANGE( MapGrid2f, crStateMapGrid2f ); CHANGE( Materialf, tilesortspu_Materialf ); CHANGE( Materialfv, tilesortspu_Materialfv ); CHANGE( Materiali, tilesortspu_Materiali ); CHANGE( Materialiv, tilesortspu_Materialiv ); CHANGE( MatrixMode, crStateMatrixMode ); CHANGE( MultMatrixd, crStateMultMatrixd ); CHANGE( MultMatrixf, crStateMultMatrixf ); CHANGE( MultTransposeMatrixdARB, crStateMultTransposeMatrixdARB ); CHANGE( MultTransposeMatrixfARB, crStateMultTransposeMatrixfARB ); CHANGE( MultiDrawArraysEXT, tilesortspu_MultiDrawArraysEXT ); CHANGE( MultiDrawElementsEXT, tilesortspu_MultiDrawElementsEXT ); CHANGESWAP( MultiTexCoord1dARB, crPackMultiTexCoord1dARBSWAP, crPackMultiTexCoord1dARB ); CHANGESWAP( MultiTexCoord1dvARB, crPackMultiTexCoord1dvARBSWAP, crPackMultiTexCoord1dvARB ); CHANGESWAP( MultiTexCoord1fARB, crPackMultiTexCoord1fARBSWAP, crPackMultiTexCoord1fARB ); CHANGESWAP( MultiTexCoord1fvARB, crPackMultiTexCoord1fvARBSWAP, crPackMultiTexCoord1fvARB ); CHANGESWAP( MultiTexCoord1iARB, crPackMultiTexCoord1iARBSWAP, crPackMultiTexCoord1iARB ); CHANGESWAP( MultiTexCoord1ivARB, crPackMultiTexCoord1ivARBSWAP, crPackMultiTexCoord1ivARB ); CHANGESWAP( MultiTexCoord1sARB, crPackMultiTexCoord1sARBSWAP, crPackMultiTexCoord1sARB ); CHANGESWAP( MultiTexCoord1svARB, crPackMultiTexCoord1svARBSWAP, crPackMultiTexCoord1svARB ); CHANGESWAP( MultiTexCoord2dARB, crPackMultiTexCoord2dARBSWAP, crPackMultiTexCoord2dARB ); CHANGESWAP( MultiTexCoord2dvARB, crPackMultiTexCoord2dvARBSWAP, crPackMultiTexCoord2dvARB ); CHANGESWAP( MultiTexCoord2fARB, crPackMultiTexCoord2fARBSWAP, crPackMultiTexCoord2fARB ); CHANGESWAP( MultiTexCoord2fvARB, crPackMultiTexCoord2fvARBSWAP, crPackMultiTexCoord2fvARB ); CHANGESWAP( MultiTexCoord2iARB, crPackMultiTexCoord2iARBSWAP, crPackMultiTexCoord2iARB ); CHANGESWAP( MultiTexCoord2ivARB, crPackMultiTexCoord2ivARBSWAP, crPackMultiTexCoord2ivARB ); CHANGESWAP( MultiTexCoord2sARB, crPackMultiTexCoord2sARBSWAP, crPackMultiTexCoord2sARB ); CHANGESWAP( MultiTexCoord2svARB, crPackMultiTexCoord2svARBSWAP, crPackMultiTexCoord2svARB ); CHANGESWAP( MultiTexCoord3dARB, crPackMultiTexCoord3dARBSWAP, crPackMultiTexCoord3dARB ); CHANGESWAP( MultiTexCoord3dvARB, crPackMultiTexCoord3dvARBSWAP, crPackMultiTexCoord3dvARB ); CHANGESWAP( MultiTexCoord3fARB, crPackMultiTexCoord3fARBSWAP, crPackMultiTexCoord3fARB ); CHANGESWAP( MultiTexCoord3fvARB, crPackMultiTexCoord3fvARBSWAP, crPackMultiTexCoord3fvARB ); CHANGESWAP( MultiTexCoord3iARB, crPackMultiTexCoord3iARBSWAP, crPackMultiTexCoord3iARB ); CHANGESWAP( MultiTexCoord3ivARB, crPackMultiTexCoord3ivARBSWAP, crPackMultiTexCoord3ivARB ); CHANGESWAP( MultiTexCoord3sARB, crPackMultiTexCoord3sARBSWAP, crPackMultiTexCoord3sARB ); CHANGESWAP( MultiTexCoord3svARB, crPackMultiTexCoord3svARBSWAP, crPackMultiTexCoord3svARB ); CHANGESWAP( MultiTexCoord4dARB, crPackMultiTexCoord4dARBSWAP, crPackMultiTexCoord4dARB ); CHANGESWAP( MultiTexCoord4dvARB, crPackMultiTexCoord4dvARBSWAP, crPackMultiTexCoord4dvARB ); CHANGESWAP( MultiTexCoord4fARB, crPackMultiTexCoord4fARBSWAP, crPackMultiTexCoord4fARB ); CHANGESWAP( MultiTexCoord4fvARB, crPackMultiTexCoord4fvARBSWAP, crPackMultiTexCoord4fvARB ); CHANGESWAP( MultiTexCoord4iARB, crPackMultiTexCoord4iARBSWAP, crPackMultiTexCoord4iARB ); CHANGESWAP( MultiTexCoord4ivARB, crPackMultiTexCoord4ivARBSWAP, crPackMultiTexCoord4ivARB ); CHANGESWAP( MultiTexCoord4sARB, crPackMultiTexCoord4sARBSWAP, crPackMultiTexCoord4sARB ); CHANGESWAP( MultiTexCoord4svARB, crPackMultiTexCoord4svARBSWAP, crPackMultiTexCoord4svARB ); CHANGESWAP( Normal3b, crPackNormal3bSWAP, crPackNormal3b ); CHANGESWAP( Normal3bv, crPackNormal3bvSWAP, crPackNormal3bv ); CHANGESWAP( Normal3d, crPackNormal3dSWAP, crPackNormal3d ); CHANGESWAP( Normal3dv, crPackNormal3dvSWAP, crPackNormal3dv ); CHANGESWAP( Normal3f, crPackNormal3fSWAP, crPackNormal3f ); CHANGESWAP( Normal3fv, crPackNormal3fvSWAP, crPackNormal3fv ); CHANGESWAP( Normal3i, crPackNormal3iSWAP, crPackNormal3i ); CHANGESWAP( Normal3iv, crPackNormal3ivSWAP, crPackNormal3iv ); CHANGESWAP( Normal3s, crPackNormal3sSWAP, crPackNormal3s ); CHANGESWAP( Normal3sv, crPackNormal3svSWAP, crPackNormal3sv ); CHANGE( NormalPointer, crStateNormalPointer ); CHANGE( Ortho, crStateOrtho ); CHANGE( PassThrough, tilesortspu_PassThrough ); CHANGE( PixelMapfv, tilesortspu_PixelMapfv ); CHANGE( PixelMapuiv, tilesortspu_PixelMapuiv ); CHANGE( PixelMapusv, tilesortspu_PixelMapusv ); CHANGE( PixelStoref, crStatePixelStoref ); CHANGE( PixelStorei, crStatePixelStorei ); CHANGE( PixelTransferf, tilesortspu_PixelTransferf ); CHANGE( PixelTransferi, tilesortspu_PixelTransferi ); CHANGE( PixelZoom, crStatePixelZoom ); CHANGE( PointParameterfARB, crStatePointParameterfARB ); CHANGE( PointParameterfvARB, crStatePointParameterfvARB ); CHANGE( PointParameteri, crStatePointParameteri ); CHANGE( PointParameteriv, crStatePointParameteriv ); CHANGE( PointSize, crStatePointSize ); CHANGE( PolygonMode, crStatePolygonMode ); CHANGE( PolygonOffset, crStatePolygonOffset ); CHANGE( PolygonStipple, crStatePolygonStipple ); CHANGE( PopAttrib, tilesortspu_PopAttrib ); CHANGE( PopMatrix, crStatePopMatrix ); CHANGE( PopName, tilesortspu_PopName ); CHANGE( PrioritizeTextures, crStatePrioritizeTextures ); CHANGE( ProgramEnvParameter4dARB, crStateProgramEnvParameter4dARB ); CHANGE( ProgramEnvParameter4dvARB, crStateProgramEnvParameter4dvARB ); CHANGE( ProgramEnvParameter4fARB, crStateProgramEnvParameter4fARB ); CHANGE( ProgramEnvParameter4fvARB, crStateProgramEnvParameter4fvARB ); CHANGE( ProgramLocalParameter4dARB, crStateProgramLocalParameter4dARB ); CHANGE( ProgramLocalParameter4dvARB, crStateProgramLocalParameter4dvARB ); CHANGE( ProgramLocalParameter4fARB, crStateProgramLocalParameter4fARB ); CHANGE( ProgramLocalParameter4fvARB, crStateProgramLocalParameter4fvARB ); CHANGE( ProgramNamedParameter4dNV, crStateProgramNamedParameter4dNV ); CHANGE( ProgramNamedParameter4dvNV, crStateProgramNamedParameter4dvNV ); CHANGE( ProgramNamedParameter4fNV, crStateProgramNamedParameter4fNV ); CHANGE( ProgramNamedParameter4fvNV, crStateProgramNamedParameter4fvNV ); CHANGE( ProgramParameter4dNV, crStateProgramParameter4dNV ); CHANGE( ProgramParameter4dvNV, crStateProgramParameter4dvNV ); CHANGE( ProgramParameter4fNV, crStateProgramParameter4fNV ); CHANGE( ProgramParameter4fvNV, crStateProgramParameter4fvNV ); CHANGESWAP( ProgramParameters4dvNV, crPackProgramParameters4dvNVSWAP, crPackProgramParameters4dvNV ); CHANGESWAP( ProgramParameters4fvNV, crPackProgramParameters4fvNVSWAP, crPackProgramParameters4fvNV ); CHANGE( ProgramStringARB, crStateProgramStringARB ); CHANGE( PushAttrib, crStatePushAttrib ); CHANGE( PushMatrix, crStatePushMatrix ); CHANGE( PushName, tilesortspu_PushName ); CHANGE( RasterPos2d, tilesortspu_RasterPos2d ); CHANGE( RasterPos2dv, tilesortspu_RasterPos2dv ); CHANGE( RasterPos2f, tilesortspu_RasterPos2f ); CHANGE( RasterPos2fv, tilesortspu_RasterPos2fv ); CHANGE( RasterPos2i, tilesortspu_RasterPos2i ); CHANGE( RasterPos2iv, tilesortspu_RasterPos2iv ); CHANGE( RasterPos2s, tilesortspu_RasterPos2s ); CHANGE( RasterPos2sv, tilesortspu_RasterPos2sv ); CHANGE( RasterPos3d, tilesortspu_RasterPos3d ); CHANGE( RasterPos3dv, tilesortspu_RasterPos3dv ); CHANGE( RasterPos3f, tilesortspu_RasterPos3f ); CHANGE( RasterPos3fv, tilesortspu_RasterPos3fv ); CHANGE( RasterPos3i, tilesortspu_RasterPos3i ); CHANGE( RasterPos3iv, tilesortspu_RasterPos3iv ); CHANGE( RasterPos3s, tilesortspu_RasterPos3s ); CHANGE( RasterPos3sv, tilesortspu_RasterPos3sv ); CHANGE( RasterPos4d, tilesortspu_RasterPos4d ); CHANGE( RasterPos4dv, tilesortspu_RasterPos4dv ); CHANGE( RasterPos4f, tilesortspu_RasterPos4f ); CHANGE( RasterPos4fv, tilesortspu_RasterPos4fv ); CHANGE( RasterPos4i, tilesortspu_RasterPos4i ); CHANGE( RasterPos4iv, tilesortspu_RasterPos4iv ); CHANGE( RasterPos4s, tilesortspu_RasterPos4s ); CHANGE( RasterPos4sv, tilesortspu_RasterPos4sv ); CHANGE( ReadBuffer, crStateReadBuffer ); CHANGE( Rectd, tilesortspu_Rectd ); CHANGE( Rectdv, tilesortspu_Rectdv ); CHANGE( Rectf, tilesortspu_Rectf ); CHANGE( Rectfv, tilesortspu_Rectfv ); CHANGE( Recti, tilesortspu_Recti ); CHANGE( Rectiv, tilesortspu_Rectiv ); CHANGE( Rects, tilesortspu_Rects ); CHANGE( Rectsv, tilesortspu_Rectsv ); CHANGESWAP( RequestResidentProgramsNV, crPackRequestResidentProgramsNVSWAP, crPackRequestResidentProgramsNV ); CHANGE( Rotated, crStateRotated ); CHANGE( Rotatef, crStateRotatef ); CHANGESWAP( SampleCoverageARB, crPackSampleCoverageARBSWAP, crPackSampleCoverageARB ); CHANGE( Scaled, crStateScaled ); CHANGE( Scalef, crStateScalef ); CHANGE( Scissor, tilesortspu_Scissor ); CHANGESWAP( SecondaryColor3bEXT, crPackSecondaryColor3bEXTSWAP, crPackSecondaryColor3bEXT ); CHANGESWAP( SecondaryColor3bvEXT, crPackSecondaryColor3bvEXTSWAP, crPackSecondaryColor3bvEXT ); CHANGESWAP( SecondaryColor3dEXT, crPackSecondaryColor3dEXTSWAP, crPackSecondaryColor3dEXT ); CHANGESWAP( SecondaryColor3dvEXT, crPackSecondaryColor3dvEXTSWAP, crPackSecondaryColor3dvEXT ); CHANGESWAP( SecondaryColor3fEXT, crPackSecondaryColor3fEXTSWAP, crPackSecondaryColor3fEXT ); CHANGESWAP( SecondaryColor3fvEXT, crPackSecondaryColor3fvEXTSWAP, crPackSecondaryColor3fvEXT ); CHANGESWAP( SecondaryColor3iEXT, crPackSecondaryColor3iEXTSWAP, crPackSecondaryColor3iEXT ); CHANGESWAP( SecondaryColor3ivEXT, crPackSecondaryColor3ivEXTSWAP, crPackSecondaryColor3ivEXT ); CHANGESWAP( SecondaryColor3sEXT, crPackSecondaryColor3sEXTSWAP, crPackSecondaryColor3sEXT ); CHANGESWAP( SecondaryColor3svEXT, crPackSecondaryColor3svEXTSWAP, crPackSecondaryColor3svEXT ); CHANGESWAP( SecondaryColor3ubEXT, crPackSecondaryColor3ubEXTSWAP, crPackSecondaryColor3ubEXT ); CHANGESWAP( SecondaryColor3ubvEXT, crPackSecondaryColor3ubvEXTSWAP, crPackSecondaryColor3ubvEXT ); CHANGESWAP( SecondaryColor3uiEXT, crPackSecondaryColor3uiEXTSWAP, crPackSecondaryColor3uiEXT ); CHANGESWAP( SecondaryColor3uivEXT, crPackSecondaryColor3uivEXTSWAP, crPackSecondaryColor3uivEXT ); CHANGESWAP( SecondaryColor3usEXT, crPackSecondaryColor3usEXTSWAP, crPackSecondaryColor3usEXT ); CHANGESWAP( SecondaryColor3usvEXT, crPackSecondaryColor3usvEXTSWAP, crPackSecondaryColor3usvEXT ); CHANGE( SecondaryColorPointerEXT, crStateSecondaryColorPointerEXT ); CHANGE( SemaphoreCreateCR, tilesortspu_SemaphoreCreateCR ); CHANGE( SemaphoreDestroyCR, tilesortspu_SemaphoreDestroyCR ); CHANGE( SemaphorePCR, tilesortspu_SemaphorePCR ); CHANGE( SemaphoreVCR, tilesortspu_SemaphoreVCR ); CHANGESWAP( SetFenceNV, crPackSetFenceNVSWAP, crPackSetFenceNV ); CHANGE( ShadeModel, crStateShadeModel ); CHANGE( StencilFunc, crStateStencilFunc ); CHANGE( StencilMask, crStateStencilMask ); CHANGE( StencilOp, crStateStencilOp ); CHANGE( SwapBuffers, tilesortspu_SwapBuffers ); CHANGE( TestFenceNV, crStateTestFenceNV ); CHANGESWAP( TexCoord1d, crPackTexCoord1dSWAP, crPackTexCoord1d ); CHANGESWAP( TexCoord1dv, crPackTexCoord1dvSWAP, crPackTexCoord1dv ); CHANGESWAP( TexCoord1f, crPackTexCoord1fSWAP, crPackTexCoord1f ); CHANGESWAP( TexCoord1fv, crPackTexCoord1fvSWAP, crPackTexCoord1fv ); CHANGESWAP( TexCoord1i, crPackTexCoord1iSWAP, crPackTexCoord1i ); CHANGESWAP( TexCoord1iv, crPackTexCoord1ivSWAP, crPackTexCoord1iv ); CHANGESWAP( TexCoord1s, crPackTexCoord1sSWAP, crPackTexCoord1s ); CHANGESWAP( TexCoord1sv, crPackTexCoord1svSWAP, crPackTexCoord1sv ); CHANGESWAP( TexCoord2d, crPackTexCoord2dSWAP, crPackTexCoord2d ); CHANGESWAP( TexCoord2dv, crPackTexCoord2dvSWAP, crPackTexCoord2dv ); CHANGESWAP( TexCoord2f, crPackTexCoord2fSWAP, crPackTexCoord2f ); CHANGESWAP( TexCoord2fv, crPackTexCoord2fvSWAP, crPackTexCoord2fv ); CHANGESWAP( TexCoord2i, crPackTexCoord2iSWAP, crPackTexCoord2i ); CHANGESWAP( TexCoord2iv, crPackTexCoord2ivSWAP, crPackTexCoord2iv ); CHANGESWAP( TexCoord2s, crPackTexCoord2sSWAP, crPackTexCoord2s ); CHANGESWAP( TexCoord2sv, crPackTexCoord2svSWAP, crPackTexCoord2sv ); CHANGESWAP( TexCoord3d, crPackTexCoord3dSWAP, crPackTexCoord3d ); CHANGESWAP( TexCoord3dv, crPackTexCoord3dvSWAP, crPackTexCoord3dv ); CHANGESWAP( TexCoord3f, crPackTexCoord3fSWAP, crPackTexCoord3f ); CHANGESWAP( TexCoord3fv, crPackTexCoord3fvSWAP, crPackTexCoord3fv ); CHANGESWAP( TexCoord3i, crPackTexCoord3iSWAP, crPackTexCoord3i ); CHANGESWAP( TexCoord3iv, crPackTexCoord3ivSWAP, crPackTexCoord3iv ); CHANGESWAP( TexCoord3s, crPackTexCoord3sSWAP, crPackTexCoord3s ); CHANGESWAP( TexCoord3sv, crPackTexCoord3svSWAP, crPackTexCoord3sv ); CHANGESWAP( TexCoord4d, crPackTexCoord4dSWAP, crPackTexCoord4d ); CHANGESWAP( TexCoord4dv, crPackTexCoord4dvSWAP, crPackTexCoord4dv ); CHANGESWAP( TexCoord4f, crPackTexCoord4fSWAP, crPackTexCoord4f ); CHANGESWAP( TexCoord4fv, crPackTexCoord4fvSWAP, crPackTexCoord4fv ); CHANGESWAP( TexCoord4i, crPackTexCoord4iSWAP, crPackTexCoord4i ); CHANGESWAP( TexCoord4iv, crPackTexCoord4ivSWAP, crPackTexCoord4iv ); CHANGESWAP( TexCoord4s, crPackTexCoord4sSWAP, crPackTexCoord4s ); CHANGESWAP( TexCoord4sv, crPackTexCoord4svSWAP, crPackTexCoord4sv ); CHANGE( TexCoordPointer, crStateTexCoordPointer ); CHANGE( TexEnvf, crStateTexEnvf ); CHANGE( TexEnvfv, crStateTexEnvfv ); CHANGE( TexEnvi, crStateTexEnvi ); CHANGE( TexEnviv, crStateTexEnviv ); CHANGE( TexGend, crStateTexGend ); CHANGE( TexGendv, crStateTexGendv ); CHANGE( TexGenf, crStateTexGenf ); CHANGE( TexGenfv, crStateTexGenfv ); CHANGE( TexGeni, crStateTexGeni ); CHANGE( TexGeniv, crStateTexGeniv ); CHANGE( TexImage1D, crStateTexImage1D ); CHANGE( TexImage2D, crStateTexImage2D ); CHANGE( TexImage3D, crStateTexImage3D ); CHANGE( TexImage3DEXT, crStateTexImage3DEXT ); CHANGE( TexParameterf, crStateTexParameterf ); CHANGE( TexParameterfv, crStateTexParameterfv ); CHANGE( TexParameteri, crStateTexParameteri ); CHANGE( TexParameteriv, crStateTexParameteriv ); CHANGE( TexSubImage1D, crStateTexSubImage1D ); CHANGE( TexSubImage2D, crStateTexSubImage2D ); CHANGE( TexSubImage3D, crStateTexSubImage3D ); CHANGESWAP( TrackMatrixNV, crPackTrackMatrixNVSWAP, crPackTrackMatrixNV ); CHANGE( Translated, crStateTranslated ); CHANGE( Translatef, crStateTranslatef ); CHANGE( UnmapBufferARB, tilesortspu_UnmapBufferARB ); CHANGESWAP( Vertex2d, crPackVertex2dBBOX_COUNTSWAP, crPackVertex2dBBOX_COUNT ); CHANGESWAP( Vertex2dv, crPackVertex2dvBBOX_COUNTSWAP, crPackVertex2dvBBOX_COUNT ); CHANGESWAP( Vertex2f, crPackVertex2fBBOX_COUNTSWAP, crPackVertex2fBBOX_COUNT ); CHANGESWAP( Vertex2fv, crPackVertex2fvBBOX_COUNTSWAP, crPackVertex2fvBBOX_COUNT ); CHANGESWAP( Vertex2i, crPackVertex2iBBOX_COUNTSWAP, crPackVertex2iBBOX_COUNT ); CHANGESWAP( Vertex2iv, crPackVertex2ivBBOX_COUNTSWAP, crPackVertex2ivBBOX_COUNT ); CHANGESWAP( Vertex2s, crPackVertex2sBBOX_COUNTSWAP, crPackVertex2sBBOX_COUNT ); CHANGESWAP( Vertex2sv, crPackVertex2svBBOX_COUNTSWAP, crPackVertex2svBBOX_COUNT ); CHANGESWAP( Vertex3d, crPackVertex3dBBOX_COUNTSWAP, crPackVertex3dBBOX_COUNT ); CHANGESWAP( Vertex3dv, crPackVertex3dvBBOX_COUNTSWAP, crPackVertex3dvBBOX_COUNT ); CHANGESWAP( Vertex3f, crPackVertex3fBBOX_COUNTSWAP, crPackVertex3fBBOX_COUNT ); CHANGESWAP( Vertex3fv, crPackVertex3fvBBOX_COUNTSWAP, crPackVertex3fvBBOX_COUNT ); CHANGESWAP( Vertex3i, crPackVertex3iBBOX_COUNTSWAP, crPackVertex3iBBOX_COUNT ); CHANGESWAP( Vertex3iv, crPackVertex3ivBBOX_COUNTSWAP, crPackVertex3ivBBOX_COUNT ); CHANGESWAP( Vertex3s, crPackVertex3sBBOX_COUNTSWAP, crPackVertex3sBBOX_COUNT ); CHANGESWAP( Vertex3sv, crPackVertex3svBBOX_COUNTSWAP, crPackVertex3svBBOX_COUNT ); CHANGESWAP( Vertex4d, crPackVertex4dBBOX_COUNTSWAP, crPackVertex4dBBOX_COUNT ); CHANGESWAP( Vertex4dv, crPackVertex4dvBBOX_COUNTSWAP, crPackVertex4dvBBOX_COUNT ); CHANGESWAP( Vertex4f, crPackVertex4fBBOX_COUNTSWAP, crPackVertex4fBBOX_COUNT ); CHANGESWAP( Vertex4fv, crPackVertex4fvBBOX_COUNTSWAP, crPackVertex4fvBBOX_COUNT ); CHANGESWAP( Vertex4i, crPackVertex4iBBOX_COUNTSWAP, crPackVertex4iBBOX_COUNT ); CHANGESWAP( Vertex4iv, crPackVertex4ivBBOX_COUNTSWAP, crPackVertex4ivBBOX_COUNT ); CHANGESWAP( Vertex4s, crPackVertex4sBBOX_COUNTSWAP, crPackVertex4sBBOX_COUNT ); CHANGESWAP( Vertex4sv, crPackVertex4svBBOX_COUNTSWAP, crPackVertex4svBBOX_COUNT ); CHANGESWAP( VertexArrayRangeNV, crPackVertexArrayRangeNVSWAP, crPackVertexArrayRangeNV ); CHANGESWAP( VertexAttrib1dARB, crPackVertexAttrib1dARBBBOX_COUNTSWAP, crPackVertexAttrib1dARBBBOX_COUNT ); CHANGESWAP( VertexAttrib1dvARB, crPackVertexAttrib1dvARBBBOX_COUNTSWAP, crPackVertexAttrib1dvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib1fARB, crPackVertexAttrib1fARBBBOX_COUNTSWAP, crPackVertexAttrib1fARBBBOX_COUNT ); CHANGESWAP( VertexAttrib1fvARB, crPackVertexAttrib1fvARBBBOX_COUNTSWAP, crPackVertexAttrib1fvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib1sARB, crPackVertexAttrib1sARBBBOX_COUNTSWAP, crPackVertexAttrib1sARBBBOX_COUNT ); CHANGESWAP( VertexAttrib1svARB, crPackVertexAttrib1svARBBBOX_COUNTSWAP, crPackVertexAttrib1svARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2dARB, crPackVertexAttrib2dARBBBOX_COUNTSWAP, crPackVertexAttrib2dARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2dvARB, crPackVertexAttrib2dvARBBBOX_COUNTSWAP, crPackVertexAttrib2dvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2fARB, crPackVertexAttrib2fARBBBOX_COUNTSWAP, crPackVertexAttrib2fARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2fvARB, crPackVertexAttrib2fvARBBBOX_COUNTSWAP, crPackVertexAttrib2fvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2sARB, crPackVertexAttrib2sARBBBOX_COUNTSWAP, crPackVertexAttrib2sARBBBOX_COUNT ); CHANGESWAP( VertexAttrib2svARB, crPackVertexAttrib2svARBBBOX_COUNTSWAP, crPackVertexAttrib2svARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3dARB, crPackVertexAttrib3dARBBBOX_COUNTSWAP, crPackVertexAttrib3dARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3dvARB, crPackVertexAttrib3dvARBBBOX_COUNTSWAP, crPackVertexAttrib3dvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3fARB, crPackVertexAttrib3fARBBBOX_COUNTSWAP, crPackVertexAttrib3fARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3fvARB, crPackVertexAttrib3fvARBBBOX_COUNTSWAP, crPackVertexAttrib3fvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3sARB, crPackVertexAttrib3sARBBBOX_COUNTSWAP, crPackVertexAttrib3sARBBBOX_COUNT ); CHANGESWAP( VertexAttrib3svARB, crPackVertexAttrib3svARBBBOX_COUNTSWAP, crPackVertexAttrib3svARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NbvARB, crPackVertexAttrib4NbvARBBBOX_COUNTSWAP, crPackVertexAttrib4NbvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NivARB, crPackVertexAttrib4NivARBBBOX_COUNTSWAP, crPackVertexAttrib4NivARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NsvARB, crPackVertexAttrib4NsvARBBBOX_COUNTSWAP, crPackVertexAttrib4NsvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NubARB, crPackVertexAttrib4NubARBBBOX_COUNTSWAP, crPackVertexAttrib4NubARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NubvARB, crPackVertexAttrib4NubvARBBBOX_COUNTSWAP, crPackVertexAttrib4NubvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NuivARB, crPackVertexAttrib4NuivARBBBOX_COUNTSWAP, crPackVertexAttrib4NuivARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4NusvARB, crPackVertexAttrib4NusvARBBBOX_COUNTSWAP, crPackVertexAttrib4NusvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4bvARB, crPackVertexAttrib4bvARBBBOX_COUNTSWAP, crPackVertexAttrib4bvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4dARB, crPackVertexAttrib4dARBBBOX_COUNTSWAP, crPackVertexAttrib4dARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4dvARB, crPackVertexAttrib4dvARBBBOX_COUNTSWAP, crPackVertexAttrib4dvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4fARB, crPackVertexAttrib4fARBBBOX_COUNTSWAP, crPackVertexAttrib4fARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4fvARB, crPackVertexAttrib4fvARBBBOX_COUNTSWAP, crPackVertexAttrib4fvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4ivARB, crPackVertexAttrib4ivARBBBOX_COUNTSWAP, crPackVertexAttrib4ivARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4sARB, crPackVertexAttrib4sARBBBOX_COUNTSWAP, crPackVertexAttrib4sARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4svARB, crPackVertexAttrib4svARBBBOX_COUNTSWAP, crPackVertexAttrib4svARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4ubvARB, crPackVertexAttrib4ubvARBBBOX_COUNTSWAP, crPackVertexAttrib4ubvARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4uivARB, crPackVertexAttrib4uivARBBBOX_COUNTSWAP, crPackVertexAttrib4uivARBBBOX_COUNT ); CHANGESWAP( VertexAttrib4usvARB, crPackVertexAttrib4usvARBBBOX_COUNTSWAP, crPackVertexAttrib4usvARBBBOX_COUNT ); CHANGESWAP( VertexAttribPointerARB, crPackVertexAttribPointerARBSWAP, crPackVertexAttribPointerARB ); CHANGESWAP( VertexAttribPointerNV, crPackVertexAttribPointerNVSWAP, crPackVertexAttribPointerNV ); CHANGESWAP( VertexAttribs1dvNV, crPackVertexAttribs1dvNVSWAP, crPackVertexAttribs1dvNV ); CHANGESWAP( VertexAttribs1fvNV, crPackVertexAttribs1fvNVSWAP, crPackVertexAttribs1fvNV ); CHANGESWAP( VertexAttribs1svNV, crPackVertexAttribs1svNVSWAP, crPackVertexAttribs1svNV ); CHANGESWAP( VertexAttribs2dvNV, crPackVertexAttribs2dvNVSWAP, crPackVertexAttribs2dvNV ); CHANGESWAP( VertexAttribs2fvNV, crPackVertexAttribs2fvNVSWAP, crPackVertexAttribs2fvNV ); CHANGESWAP( VertexAttribs2svNV, crPackVertexAttribs2svNVSWAP, crPackVertexAttribs2svNV ); CHANGESWAP( VertexAttribs3dvNV, crPackVertexAttribs3dvNVSWAP, crPackVertexAttribs3dvNV ); CHANGESWAP( VertexAttribs3fvNV, crPackVertexAttribs3fvNVSWAP, crPackVertexAttribs3fvNV ); CHANGESWAP( VertexAttribs3svNV, crPackVertexAttribs3svNVSWAP, crPackVertexAttribs3svNV ); CHANGESWAP( VertexAttribs4dvNV, crPackVertexAttribs4dvNVSWAP, crPackVertexAttribs4dvNV ); CHANGESWAP( VertexAttribs4fvNV, crPackVertexAttribs4fvNVSWAP, crPackVertexAttribs4fvNV ); CHANGESWAP( VertexAttribs4svNV, crPackVertexAttribs4svNVSWAP, crPackVertexAttribs4svNV ); CHANGESWAP( VertexAttribs4ubvNV, crPackVertexAttribs4ubvNVSWAP, crPackVertexAttribs4ubvNV ); CHANGE( VertexPointer, crStateVertexPointer ); CHANGE( Viewport, tilesortspu_Viewport ); CHANGE( WindowCreate, tilesortspu_WindowCreate ); CHANGE( WindowDestroy, tilesortspu_WindowDestroy ); CHANGE( WindowPos2dARB, crStateWindowPos2dARB ); CHANGE( WindowPos2dvARB, crStateWindowPos2dvARB ); CHANGE( WindowPos2fARB, crStateWindowPos2fARB ); CHANGE( WindowPos2fvARB, crStateWindowPos2fvARB ); CHANGE( WindowPos2iARB, crStateWindowPos2iARB ); CHANGE( WindowPos2ivARB, crStateWindowPos2ivARB ); CHANGE( WindowPos2sARB, crStateWindowPos2sARB ); CHANGE( WindowPos2svARB, crStateWindowPos2svARB ); CHANGE( WindowPos3dARB, crStateWindowPos3dARB ); CHANGE( WindowPos3dvARB, crStateWindowPos3dvARB ); CHANGE( WindowPos3fARB, crStateWindowPos3fARB ); CHANGE( WindowPos3fvARB, crStateWindowPos3fvARB ); CHANGE( WindowPos3iARB, crStateWindowPos3iARB ); CHANGE( WindowPos3ivARB, crStateWindowPos3ivARB ); CHANGE( WindowPos3sARB, crStateWindowPos3sARB ); CHANGE( WindowPos3svARB, crStateWindowPos3svARB ); CHANGE( WindowPosition, tilesortspu_WindowPosition ); CHANGESWAP( WindowShow, crPackWindowShowSWAP, crPackWindowShow ); CHANGE( WindowSize, tilesortspu_WindowSize ); CHANGESWAP( Writeback, crPackWritebackSWAP, crPackWriteback ); } /* Used when playing back display lists locally to update state */ void tilesortspuLoadStateTable(SPUDispatchTable *t) { t->Accum = (AccumFunc_t) tilesortspu_nop; t->ActiveTextureARB = crStateActiveTextureARB; t->AlphaFunc = crStateAlphaFunc; t->ArrayElement = (ArrayElementFunc_t) tilesortspu_nop; t->Begin = (BeginFunc_t) tilesortspu_nop; t->BeginQueryARB = (BeginQueryARBFunc_t) tilesortspu_nop; t->BindProgramARB = crStateBindProgramARB; t->BindProgramNV = crStateBindProgramNV; t->BindTexture = crStateBindTexture; t->Bitmap = crStateBitmap; t->BlendColorEXT = (BlendColorEXTFunc_t) tilesortspu_nop; t->BlendEquationEXT = crStateBlendEquationEXT; t->BlendFunc = crStateBlendFunc; t->BlendFuncSeparateEXT = crStateBlendFuncSeparateEXT; t->CallList = tilesortspuStateCallList; t->CallLists = tilesortspuStateCallLists; t->Clear = (ClearFunc_t) tilesortspu_nop; t->ClearAccum = crStateClearAccum; t->ClearColor = crStateClearColor; t->ClearDepth = crStateClearDepth; t->ClearIndex = crStateClearIndex; t->ClearStencil = crStateClearStencil; t->ClientActiveTextureARB = crStateClientActiveTextureARB; t->ClipPlane = crStateClipPlane; t->Color3b = (Color3bFunc_t) tilesortspu_nop; t->Color3bv = (Color3bvFunc_t) tilesortspu_nop; t->Color3d = (Color3dFunc_t) tilesortspu_nop; t->Color3dv = (Color3dvFunc_t) tilesortspu_nop; t->Color3f = (Color3fFunc_t) tilesortspu_nop; t->Color3fv = (Color3fvFunc_t) tilesortspu_nop; t->Color3i = (Color3iFunc_t) tilesortspu_nop; t->Color3iv = (Color3ivFunc_t) tilesortspu_nop; t->Color3s = (Color3sFunc_t) tilesortspu_nop; t->Color3sv = (Color3svFunc_t) tilesortspu_nop; t->Color3ub = (Color3ubFunc_t) tilesortspu_nop; t->Color3ubv = (Color3ubvFunc_t) tilesortspu_nop; t->Color3ui = (Color3uiFunc_t) tilesortspu_nop; t->Color3uiv = (Color3uivFunc_t) tilesortspu_nop; t->Color3us = (Color3usFunc_t) tilesortspu_nop; t->Color3usv = (Color3usvFunc_t) tilesortspu_nop; t->Color4b = (Color4bFunc_t) tilesortspu_nop; t->Color4bv = (Color4bvFunc_t) tilesortspu_nop; t->Color4d = (Color4dFunc_t) tilesortspu_nop; t->Color4dv = (Color4dvFunc_t) tilesortspu_nop; t->Color4f = (Color4fFunc_t) tilesortspu_nop; t->Color4fv = (Color4fvFunc_t) tilesortspu_nop; t->Color4i = (Color4iFunc_t) tilesortspu_nop; t->Color4iv = (Color4ivFunc_t) tilesortspu_nop; t->Color4s = (Color4sFunc_t) tilesortspu_nop; t->Color4sv = (Color4svFunc_t) tilesortspu_nop; t->Color4ub = (Color4ubFunc_t) tilesortspu_nop; t->Color4ubv = (Color4ubvFunc_t) tilesortspu_nop; t->Color4ui = (Color4uiFunc_t) tilesortspu_nop; t->Color4uiv = (Color4uivFunc_t) tilesortspu_nop; t->Color4us = (Color4usFunc_t) tilesortspu_nop; t->Color4usv = (Color4usvFunc_t) tilesortspu_nop; t->ColorMask = crStateColorMask; t->ColorMaterial = crStateColorMaterial; t->ColorPointer = crStateColorPointer; t->CombinerInputNV = crStateCombinerInputNV; t->CombinerOutputNV = crStateCombinerOutputNV; t->CombinerParameterfNV = crStateCombinerParameterfNV; t->CombinerParameterfvNV = crStateCombinerParameterfvNV; t->CombinerParameteriNV = crStateCombinerParameteriNV; t->CombinerParameterivNV = crStateCombinerParameterivNV; t->CombinerStageParameterfvNV = crStateCombinerStageParameterfvNV; t->CompressedTexImage1DARB = (CompressedTexImage1DARBFunc_t) tilesortspu_nop; t->CompressedTexImage2DARB = (CompressedTexImage2DARBFunc_t) tilesortspu_nop; t->CompressedTexImage3DARB = (CompressedTexImage3DARBFunc_t) tilesortspu_nop; t->CompressedTexSubImage1DARB = (CompressedTexSubImage1DARBFunc_t) tilesortspu_nop; t->CompressedTexSubImage2DARB = (CompressedTexSubImage2DARBFunc_t) tilesortspu_nop; t->CompressedTexSubImage3DARB = (CompressedTexSubImage3DARBFunc_t) tilesortspu_nop; t->CopyPixels = (CopyPixelsFunc_t) tilesortspu_nop; t->CopyTexImage1D = (CopyTexImage1DFunc_t) tilesortspu_nop; t->CopyTexImage2D = (CopyTexImage2DFunc_t) tilesortspu_nop; t->CopyTexSubImage1D = (CopyTexSubImage1DFunc_t) tilesortspu_nop; t->CopyTexSubImage2D = (CopyTexSubImage2DFunc_t) tilesortspu_nop; t->CopyTexSubImage3D = (CopyTexSubImage3DFunc_t) tilesortspu_nop; t->CullFace = crStateCullFace; t->DepthFunc = crStateDepthFunc; t->DepthMask = crStateDepthMask; t->DepthRange = crStateDepthRange; t->Disable = crStateDisable; t->DisableClientState = crStateDisableClientState; t->DisableVertexAttribArrayARB = (DisableVertexAttribArrayARBFunc_t) tilesortspu_nop; t->DrawArrays = (DrawArraysFunc_t) tilesortspu_nop; t->DrawBuffer = (DrawBufferFunc_t) tilesortspu_nop; t->DrawElements = (DrawElementsFunc_t) tilesortspu_nop; t->DrawPixels = (DrawPixelsFunc_t) tilesortspu_nop; t->DrawRangeElements = (DrawRangeElementsFunc_t) tilesortspu_nop; t->EdgeFlag = (EdgeFlagFunc_t) tilesortspu_nop; t->EdgeFlagPointer = crStateEdgeFlagPointer; t->EdgeFlagv = (EdgeFlagvFunc_t) tilesortspu_nop; t->Enable = crStateEnable; t->EnableClientState = crStateEnableClientState; t->EnableVertexAttribArrayARB = (EnableVertexAttribArrayARBFunc_t) tilesortspu_nop; t->End = (EndFunc_t) tilesortspu_nop; t->EndList = tilesortspuStateEndList; t->EndQueryARB = (EndQueryARBFunc_t) tilesortspu_nop; t->EvalCoord1d = (EvalCoord1dFunc_t) tilesortspu_nop; t->EvalCoord1dv = (EvalCoord1dvFunc_t) tilesortspu_nop; t->EvalCoord1f = (EvalCoord1fFunc_t) tilesortspu_nop; t->EvalCoord1fv = (EvalCoord1fvFunc_t) tilesortspu_nop; t->EvalCoord2d = (EvalCoord2dFunc_t) tilesortspu_nop; t->EvalCoord2dv = (EvalCoord2dvFunc_t) tilesortspu_nop; t->EvalCoord2f = (EvalCoord2fFunc_t) tilesortspu_nop; t->EvalCoord2fv = (EvalCoord2fvFunc_t) tilesortspu_nop; t->EvalMesh1 = (EvalMesh1Func_t) tilesortspu_nop; t->EvalMesh2 = (EvalMesh2Func_t) tilesortspu_nop; t->EvalPoint1 = (EvalPoint1Func_t) tilesortspu_nop; t->EvalPoint2 = (EvalPoint2Func_t) tilesortspu_nop; t->ExecuteProgramNV = (ExecuteProgramNVFunc_t) tilesortspu_nop; t->FinalCombinerInputNV = crStateFinalCombinerInputNV; t->FinishFenceNV = (FinishFenceNVFunc_t) tilesortspu_nop; t->FlushVertexArrayRangeNV = (FlushVertexArrayRangeNVFunc_t) tilesortspu_nop; t->FogCoordPointerEXT = (FogCoordPointerEXTFunc_t) tilesortspu_nop; t->FogCoorddEXT = (FogCoorddEXTFunc_t) tilesortspu_nop; t->FogCoorddvEXT = (FogCoorddvEXTFunc_t) tilesortspu_nop; t->FogCoordfEXT = (FogCoordfEXTFunc_t) tilesortspu_nop; t->FogCoordfvEXT = (FogCoordfvEXTFunc_t) tilesortspu_nop; t->Fogf = crStateFogf; t->Fogfv = crStateFogfv; t->Fogi = crStateFogi; t->Fogiv = crStateFogiv; t->FrontFace = crStateFrontFace; t->Frustum = crStateFrustum; t->Hint = crStateHint; t->IndexMask = crStateIndexMask; t->IndexPointer = crStateIndexPointer; t->Indexd = (IndexdFunc_t) tilesortspu_nop; t->Indexdv = (IndexdvFunc_t) tilesortspu_nop; t->Indexf = (IndexfFunc_t) tilesortspu_nop; t->Indexfv = (IndexfvFunc_t) tilesortspu_nop; t->Indexi = (IndexiFunc_t) tilesortspu_nop; t->Indexiv = (IndexivFunc_t) tilesortspu_nop; t->Indexs = (IndexsFunc_t) tilesortspu_nop; t->Indexsv = (IndexsvFunc_t) tilesortspu_nop; t->Indexub = (IndexubFunc_t) tilesortspu_nop; t->Indexubv = (IndexubvFunc_t) tilesortspu_nop; t->InitNames = (InitNamesFunc_t) tilesortspu_nop; t->InterleavedArrays = crStateInterleavedArrays; t->LightModelf = crStateLightModelf; t->LightModelfv = crStateLightModelfv; t->LightModeli = crStateLightModeli; t->LightModeliv = crStateLightModeliv; t->Lightf = crStateLightf; t->Lightfv = crStateLightfv; t->Lighti = crStateLighti; t->Lightiv = crStateLightiv; t->LineStipple = crStateLineStipple; t->LineWidth = crStateLineWidth; t->ListBase = (ListBaseFunc_t) tilesortspu_nop; t->LoadIdentity = crStateLoadIdentity; t->LoadMatrixd = crStateLoadMatrixd; t->LoadMatrixf = crStateLoadMatrixf; t->LoadName = (LoadNameFunc_t) tilesortspu_nop; t->LoadProgramNV = crStateLoadProgramNV; t->LoadTransposeMatrixdARB = crStateLoadTransposeMatrixdARB; t->LoadTransposeMatrixfARB = crStateLoadTransposeMatrixfARB; t->LogicOp = crStateLogicOp; t->Map1d = crStateMap1d; t->Map1f = crStateMap1f; t->Map2d = crStateMap2d; t->Map2f = crStateMap2f; t->MapGrid1d = crStateMapGrid1d; t->MapGrid1f = crStateMapGrid1f; t->MapGrid2d = crStateMapGrid2d; t->MapGrid2f = crStateMapGrid2f; t->Materialf = (MaterialfFunc_t) tilesortspu_nop; t->Materialfv = (MaterialfvFunc_t) tilesortspu_nop; t->Materiali = (MaterialiFunc_t) tilesortspu_nop; t->Materialiv = (MaterialivFunc_t) tilesortspu_nop; t->MatrixMode = crStateMatrixMode; t->MultMatrixd = crStateMultMatrixd; t->MultMatrixf = crStateMultMatrixf; t->MultTransposeMatrixdARB = crStateMultTransposeMatrixdARB; t->MultTransposeMatrixfARB = crStateMultTransposeMatrixfARB; t->MultiDrawArraysEXT = (MultiDrawArraysEXTFunc_t) tilesortspu_nop; t->MultiDrawElementsEXT = (MultiDrawElementsEXTFunc_t) tilesortspu_nop; t->MultiTexCoord1dARB = (MultiTexCoord1dARBFunc_t) tilesortspu_nop; t->MultiTexCoord1dvARB = (MultiTexCoord1dvARBFunc_t) tilesortspu_nop; t->MultiTexCoord1fARB = (MultiTexCoord1fARBFunc_t) tilesortspu_nop; t->MultiTexCoord1fvARB = (MultiTexCoord1fvARBFunc_t) tilesortspu_nop; t->MultiTexCoord1iARB = (MultiTexCoord1iARBFunc_t) tilesortspu_nop; t->MultiTexCoord1ivARB = (MultiTexCoord1ivARBFunc_t) tilesortspu_nop; t->MultiTexCoord1sARB = (MultiTexCoord1sARBFunc_t) tilesortspu_nop; t->MultiTexCoord1svARB = (MultiTexCoord1svARBFunc_t) tilesortspu_nop; t->MultiTexCoord2dARB = (MultiTexCoord2dARBFunc_t) tilesortspu_nop; t->MultiTexCoord2dvARB = (MultiTexCoord2dvARBFunc_t) tilesortspu_nop; t->MultiTexCoord2fARB = (MultiTexCoord2fARBFunc_t) tilesortspu_nop; t->MultiTexCoord2fvARB = (MultiTexCoord2fvARBFunc_t) tilesortspu_nop; t->MultiTexCoord2iARB = (MultiTexCoord2iARBFunc_t) tilesortspu_nop; t->MultiTexCoord2ivARB = (MultiTexCoord2ivARBFunc_t) tilesortspu_nop; t->MultiTexCoord2sARB = (MultiTexCoord2sARBFunc_t) tilesortspu_nop; t->MultiTexCoord2svARB = (MultiTexCoord2svARBFunc_t) tilesortspu_nop; t->MultiTexCoord3dARB = (MultiTexCoord3dARBFunc_t) tilesortspu_nop; t->MultiTexCoord3dvARB = (MultiTexCoord3dvARBFunc_t) tilesortspu_nop; t->MultiTexCoord3fARB = (MultiTexCoord3fARBFunc_t) tilesortspu_nop; t->MultiTexCoord3fvARB = (MultiTexCoord3fvARBFunc_t) tilesortspu_nop; t->MultiTexCoord3iARB = (MultiTexCoord3iARBFunc_t) tilesortspu_nop; t->MultiTexCoord3ivARB = (MultiTexCoord3ivARBFunc_t) tilesortspu_nop; t->MultiTexCoord3sARB = (MultiTexCoord3sARBFunc_t) tilesortspu_nop; t->MultiTexCoord3svARB = (MultiTexCoord3svARBFunc_t) tilesortspu_nop; t->MultiTexCoord4dARB = (MultiTexCoord4dARBFunc_t) tilesortspu_nop; t->MultiTexCoord4dvARB = (MultiTexCoord4dvARBFunc_t) tilesortspu_nop; t->MultiTexCoord4fARB = (MultiTexCoord4fARBFunc_t) tilesortspu_nop; t->MultiTexCoord4fvARB = (MultiTexCoord4fvARBFunc_t) tilesortspu_nop; t->MultiTexCoord4iARB = (MultiTexCoord4iARBFunc_t) tilesortspu_nop; t->MultiTexCoord4ivARB = (MultiTexCoord4ivARBFunc_t) tilesortspu_nop; t->MultiTexCoord4sARB = (MultiTexCoord4sARBFunc_t) tilesortspu_nop; t->MultiTexCoord4svARB = (MultiTexCoord4svARBFunc_t) tilesortspu_nop; t->NewList = tilesortspuStateNewList; t->Normal3b = (Normal3bFunc_t) tilesortspu_nop; t->Normal3bv = (Normal3bvFunc_t) tilesortspu_nop; t->Normal3d = (Normal3dFunc_t) tilesortspu_nop; t->Normal3dv = (Normal3dvFunc_t) tilesortspu_nop; t->Normal3f = (Normal3fFunc_t) tilesortspu_nop; t->Normal3fv = (Normal3fvFunc_t) tilesortspu_nop; t->Normal3i = (Normal3iFunc_t) tilesortspu_nop; t->Normal3iv = (Normal3ivFunc_t) tilesortspu_nop; t->Normal3s = (Normal3sFunc_t) tilesortspu_nop; t->Normal3sv = (Normal3svFunc_t) tilesortspu_nop; t->NormalPointer = crStateNormalPointer; t->Ortho = crStateOrtho; t->PassThrough = (PassThroughFunc_t) tilesortspu_nop; t->PixelMapfv = (PixelMapfvFunc_t) tilesortspu_nop; t->PixelMapuiv = (PixelMapuivFunc_t) tilesortspu_nop; t->PixelMapusv = (PixelMapusvFunc_t) tilesortspu_nop; t->PixelStoref = crStatePixelStoref; t->PixelStorei = crStatePixelStorei; t->PixelTransferf = (PixelTransferfFunc_t) tilesortspu_nop; t->PixelTransferi = (PixelTransferiFunc_t) tilesortspu_nop; t->PixelZoom = crStatePixelZoom; t->PointParameterfARB = crStatePointParameterfARB; t->PointParameterfvARB = crStatePointParameterfvARB; t->PointParameteri = crStatePointParameteri; t->PointParameteriv = crStatePointParameteriv; t->PointSize = crStatePointSize; t->PolygonMode = crStatePolygonMode; t->PolygonOffset = crStatePolygonOffset; t->PolygonStipple = crStatePolygonStipple; t->PopAttrib = tilesortspu_PopAttrib; t->PopClientAttrib = crStatePopClientAttrib; t->PopMatrix = crStatePopMatrix; t->PopName = (PopNameFunc_t) tilesortspu_nop; t->PrioritizeTextures = crStatePrioritizeTextures; t->ProgramEnvParameter4dARB = crStateProgramEnvParameter4dARB; t->ProgramEnvParameter4dvARB = crStateProgramEnvParameter4dvARB; t->ProgramEnvParameter4fARB = crStateProgramEnvParameter4fARB; t->ProgramEnvParameter4fvARB = crStateProgramEnvParameter4fvARB; t->ProgramLocalParameter4dARB = crStateProgramLocalParameter4dARB; t->ProgramLocalParameter4dvARB = crStateProgramLocalParameter4dvARB; t->ProgramLocalParameter4fARB = crStateProgramLocalParameter4fARB; t->ProgramLocalParameter4fvARB = crStateProgramLocalParameter4fvARB; t->ProgramNamedParameter4dNV = crStateProgramNamedParameter4dNV; t->ProgramNamedParameter4dvNV = crStateProgramNamedParameter4dvNV; t->ProgramNamedParameter4fNV = crStateProgramNamedParameter4fNV; t->ProgramNamedParameter4fvNV = crStateProgramNamedParameter4fvNV; t->ProgramParameter4dNV = crStateProgramParameter4dNV; t->ProgramParameter4dvNV = crStateProgramParameter4dvNV; t->ProgramParameter4fNV = crStateProgramParameter4fNV; t->ProgramParameter4fvNV = crStateProgramParameter4fvNV; t->ProgramParameters4dvNV = (ProgramParameters4dvNVFunc_t) tilesortspu_nop; t->ProgramParameters4fvNV = (ProgramParameters4fvNVFunc_t) tilesortspu_nop; t->ProgramStringARB = crStateProgramStringARB; t->PushAttrib = crStatePushAttrib; t->PushClientAttrib = crStatePushClientAttrib; t->PushMatrix = crStatePushMatrix; t->PushName = (PushNameFunc_t) tilesortspu_nop; t->RasterPos2d = (RasterPos2dFunc_t) tilesortspu_nop; t->RasterPos2dv = (RasterPos2dvFunc_t) tilesortspu_nop; t->RasterPos2f = (RasterPos2fFunc_t) tilesortspu_nop; t->RasterPos2fv = (RasterPos2fvFunc_t) tilesortspu_nop; t->RasterPos2i = (RasterPos2iFunc_t) tilesortspu_nop; t->RasterPos2iv = (RasterPos2ivFunc_t) tilesortspu_nop; t->RasterPos2s = (RasterPos2sFunc_t) tilesortspu_nop; t->RasterPos2sv = (RasterPos2svFunc_t) tilesortspu_nop; t->RasterPos3d = (RasterPos3dFunc_t) tilesortspu_nop; t->RasterPos3dv = (RasterPos3dvFunc_t) tilesortspu_nop; t->RasterPos3f = (RasterPos3fFunc_t) tilesortspu_nop; t->RasterPos3fv = (RasterPos3fvFunc_t) tilesortspu_nop; t->RasterPos3i = (RasterPos3iFunc_t) tilesortspu_nop; t->RasterPos3iv = (RasterPos3ivFunc_t) tilesortspu_nop; t->RasterPos3s = (RasterPos3sFunc_t) tilesortspu_nop; t->RasterPos3sv = (RasterPos3svFunc_t) tilesortspu_nop; t->RasterPos4d = (RasterPos4dFunc_t) tilesortspu_nop; t->RasterPos4dv = (RasterPos4dvFunc_t) tilesortspu_nop; t->RasterPos4f = (RasterPos4fFunc_t) tilesortspu_nop; t->RasterPos4fv = (RasterPos4fvFunc_t) tilesortspu_nop; t->RasterPos4i = (RasterPos4iFunc_t) tilesortspu_nop; t->RasterPos4iv = (RasterPos4ivFunc_t) tilesortspu_nop; t->RasterPos4s = (RasterPos4sFunc_t) tilesortspu_nop; t->RasterPos4sv = (RasterPos4svFunc_t) tilesortspu_nop; t->ReadBuffer = crStateReadBuffer; t->Rectd = (RectdFunc_t) tilesortspu_nop; t->Rectdv = (RectdvFunc_t) tilesortspu_nop; t->Rectf = (RectfFunc_t) tilesortspu_nop; t->Rectfv = (RectfvFunc_t) tilesortspu_nop; t->Recti = (RectiFunc_t) tilesortspu_nop; t->Rectiv = (RectivFunc_t) tilesortspu_nop; t->Rects = (RectsFunc_t) tilesortspu_nop; t->Rectsv = (RectsvFunc_t) tilesortspu_nop; t->RequestResidentProgramsNV = (RequestResidentProgramsNVFunc_t) tilesortspu_nop; t->Rotated = crStateRotated; t->Rotatef = crStateRotatef; t->SampleCoverageARB = (SampleCoverageARBFunc_t) tilesortspu_nop; t->Scaled = crStateScaled; t->Scalef = crStateScalef; t->Scissor = (ScissorFunc_t) tilesortspu_nop; t->SecondaryColor3bEXT = (SecondaryColor3bEXTFunc_t) tilesortspu_nop; t->SecondaryColor3bvEXT = (SecondaryColor3bvEXTFunc_t) tilesortspu_nop; t->SecondaryColor3dEXT = (SecondaryColor3dEXTFunc_t) tilesortspu_nop; t->SecondaryColor3dvEXT = (SecondaryColor3dvEXTFunc_t) tilesortspu_nop; t->SecondaryColor3fEXT = (SecondaryColor3fEXTFunc_t) tilesortspu_nop; t->SecondaryColor3fvEXT = (SecondaryColor3fvEXTFunc_t) tilesortspu_nop; t->SecondaryColor3iEXT = (SecondaryColor3iEXTFunc_t) tilesortspu_nop; t->SecondaryColor3ivEXT = (SecondaryColor3ivEXTFunc_t) tilesortspu_nop; t->SecondaryColor3sEXT = (SecondaryColor3sEXTFunc_t) tilesortspu_nop; t->SecondaryColor3svEXT = (SecondaryColor3svEXTFunc_t) tilesortspu_nop; t->SecondaryColor3ubEXT = (SecondaryColor3ubEXTFunc_t) tilesortspu_nop; t->SecondaryColor3ubvEXT = (SecondaryColor3ubvEXTFunc_t) tilesortspu_nop; t->SecondaryColor3uiEXT = (SecondaryColor3uiEXTFunc_t) tilesortspu_nop; t->SecondaryColor3uivEXT = (SecondaryColor3uivEXTFunc_t) tilesortspu_nop; t->SecondaryColor3usEXT = (SecondaryColor3usEXTFunc_t) tilesortspu_nop; t->SecondaryColor3usvEXT = (SecondaryColor3usvEXTFunc_t) tilesortspu_nop; t->SecondaryColorPointerEXT = crStateSecondaryColorPointerEXT; t->SetFenceNV = (SetFenceNVFunc_t) tilesortspu_nop; t->ShadeModel = crStateShadeModel; t->StencilFunc = crStateStencilFunc; t->StencilMask = crStateStencilMask; t->StencilOp = crStateStencilOp; t->TexCoord1d = (TexCoord1dFunc_t) tilesortspu_nop; t->TexCoord1dv = (TexCoord1dvFunc_t) tilesortspu_nop; t->TexCoord1f = (TexCoord1fFunc_t) tilesortspu_nop; t->TexCoord1fv = (TexCoord1fvFunc_t) tilesortspu_nop; t->TexCoord1i = (TexCoord1iFunc_t) tilesortspu_nop; t->TexCoord1iv = (TexCoord1ivFunc_t) tilesortspu_nop; t->TexCoord1s = (TexCoord1sFunc_t) tilesortspu_nop; t->TexCoord1sv = (TexCoord1svFunc_t) tilesortspu_nop; t->TexCoord2d = (TexCoord2dFunc_t) tilesortspu_nop; t->TexCoord2dv = (TexCoord2dvFunc_t) tilesortspu_nop; t->TexCoord2f = (TexCoord2fFunc_t) tilesortspu_nop; t->TexCoord2fv = (TexCoord2fvFunc_t) tilesortspu_nop; t->TexCoord2i = (TexCoord2iFunc_t) tilesortspu_nop; t->TexCoord2iv = (TexCoord2ivFunc_t) tilesortspu_nop; t->TexCoord2s = (TexCoord2sFunc_t) tilesortspu_nop; t->TexCoord2sv = (TexCoord2svFunc_t) tilesortspu_nop; t->TexCoord3d = (TexCoord3dFunc_t) tilesortspu_nop; t->TexCoord3dv = (TexCoord3dvFunc_t) tilesortspu_nop; t->TexCoord3f = (TexCoord3fFunc_t) tilesortspu_nop; t->TexCoord3fv = (TexCoord3fvFunc_t) tilesortspu_nop; t->TexCoord3i = (TexCoord3iFunc_t) tilesortspu_nop; t->TexCoord3iv = (TexCoord3ivFunc_t) tilesortspu_nop; t->TexCoord3s = (TexCoord3sFunc_t) tilesortspu_nop; t->TexCoord3sv = (TexCoord3svFunc_t) tilesortspu_nop; t->TexCoord4d = (TexCoord4dFunc_t) tilesortspu_nop; t->TexCoord4dv = (TexCoord4dvFunc_t) tilesortspu_nop; t->TexCoord4f = (TexCoord4fFunc_t) tilesortspu_nop; t->TexCoord4fv = (TexCoord4fvFunc_t) tilesortspu_nop; t->TexCoord4i = (TexCoord4iFunc_t) tilesortspu_nop; t->TexCoord4iv = (TexCoord4ivFunc_t) tilesortspu_nop; t->TexCoord4s = (TexCoord4sFunc_t) tilesortspu_nop; t->TexCoord4sv = (TexCoord4svFunc_t) tilesortspu_nop; t->TexCoordPointer = crStateTexCoordPointer; t->TexEnvf = crStateTexEnvf; t->TexEnvfv = crStateTexEnvfv; t->TexEnvi = crStateTexEnvi; t->TexEnviv = crStateTexEnviv; t->TexGend = crStateTexGend; t->TexGendv = crStateTexGendv; t->TexGenf = crStateTexGenf; t->TexGenfv = crStateTexGenfv; t->TexGeni = crStateTexGeni; t->TexGeniv = crStateTexGeniv; t->TexImage1D = crStateTexImage1D; t->TexImage2D = crStateTexImage2D; t->TexImage3D = crStateTexImage3D; t->TexImage3DEXT = crStateTexImage3DEXT; t->TexParameterf = crStateTexParameterf; t->TexParameterfv = crStateTexParameterfv; t->TexParameteri = crStateTexParameteri; t->TexParameteriv = crStateTexParameteriv; t->TexSubImage1D = crStateTexSubImage1D; t->TexSubImage2D = crStateTexSubImage2D; t->TexSubImage3D = crStateTexSubImage3D; t->TrackMatrixNV = (TrackMatrixNVFunc_t) tilesortspu_nop; t->Translated = crStateTranslated; t->Translatef = crStateTranslatef; t->Vertex2d = (Vertex2dFunc_t) tilesortspu_nop; t->Vertex2dv = (Vertex2dvFunc_t) tilesortspu_nop; t->Vertex2f = (Vertex2fFunc_t) tilesortspu_nop; t->Vertex2fv = (Vertex2fvFunc_t) tilesortspu_nop; t->Vertex2i = (Vertex2iFunc_t) tilesortspu_nop; t->Vertex2iv = (Vertex2ivFunc_t) tilesortspu_nop; t->Vertex2s = (Vertex2sFunc_t) tilesortspu_nop; t->Vertex2sv = (Vertex2svFunc_t) tilesortspu_nop; t->Vertex3d = (Vertex3dFunc_t) tilesortspu_nop; t->Vertex3dv = (Vertex3dvFunc_t) tilesortspu_nop; t->Vertex3f = (Vertex3fFunc_t) tilesortspu_nop; t->Vertex3fv = (Vertex3fvFunc_t) tilesortspu_nop; t->Vertex3i = (Vertex3iFunc_t) tilesortspu_nop; t->Vertex3iv = (Vertex3ivFunc_t) tilesortspu_nop; t->Vertex3s = (Vertex3sFunc_t) tilesortspu_nop; t->Vertex3sv = (Vertex3svFunc_t) tilesortspu_nop; t->Vertex4d = (Vertex4dFunc_t) tilesortspu_nop; t->Vertex4dv = (Vertex4dvFunc_t) tilesortspu_nop; t->Vertex4f = (Vertex4fFunc_t) tilesortspu_nop; t->Vertex4fv = (Vertex4fvFunc_t) tilesortspu_nop; t->Vertex4i = (Vertex4iFunc_t) tilesortspu_nop; t->Vertex4iv = (Vertex4ivFunc_t) tilesortspu_nop; t->Vertex4s = (Vertex4sFunc_t) tilesortspu_nop; t->Vertex4sv = (Vertex4svFunc_t) tilesortspu_nop; t->VertexArrayRangeNV = (VertexArrayRangeNVFunc_t) tilesortspu_nop; t->VertexAttrib1dARB = (VertexAttrib1dARBFunc_t) tilesortspu_nop; t->VertexAttrib1dvARB = (VertexAttrib1dvARBFunc_t) tilesortspu_nop; t->VertexAttrib1fARB = (VertexAttrib1fARBFunc_t) tilesortspu_nop; t->VertexAttrib1fvARB = (VertexAttrib1fvARBFunc_t) tilesortspu_nop; t->VertexAttrib1sARB = (VertexAttrib1sARBFunc_t) tilesortspu_nop; t->VertexAttrib1svARB = (VertexAttrib1svARBFunc_t) tilesortspu_nop; t->VertexAttrib2dARB = (VertexAttrib2dARBFunc_t) tilesortspu_nop; t->VertexAttrib2dvARB = (VertexAttrib2dvARBFunc_t) tilesortspu_nop; t->VertexAttrib2fARB = (VertexAttrib2fARBFunc_t) tilesortspu_nop; t->VertexAttrib2fvARB = (VertexAttrib2fvARBFunc_t) tilesortspu_nop; t->VertexAttrib2sARB = (VertexAttrib2sARBFunc_t) tilesortspu_nop; t->VertexAttrib2svARB = (VertexAttrib2svARBFunc_t) tilesortspu_nop; t->VertexAttrib3dARB = (VertexAttrib3dARBFunc_t) tilesortspu_nop; t->VertexAttrib3dvARB = (VertexAttrib3dvARBFunc_t) tilesortspu_nop; t->VertexAttrib3fARB = (VertexAttrib3fARBFunc_t) tilesortspu_nop; t->VertexAttrib3fvARB = (VertexAttrib3fvARBFunc_t) tilesortspu_nop; t->VertexAttrib3sARB = (VertexAttrib3sARBFunc_t) tilesortspu_nop; t->VertexAttrib3svARB = (VertexAttrib3svARBFunc_t) tilesortspu_nop; t->VertexAttrib4NbvARB = (VertexAttrib4NbvARBFunc_t) tilesortspu_nop; t->VertexAttrib4NivARB = (VertexAttrib4NivARBFunc_t) tilesortspu_nop; t->VertexAttrib4NsvARB = (VertexAttrib4NsvARBFunc_t) tilesortspu_nop; t->VertexAttrib4NubARB = (VertexAttrib4NubARBFunc_t) tilesortspu_nop; t->VertexAttrib4NubvARB = (VertexAttrib4NubvARBFunc_t) tilesortspu_nop; t->VertexAttrib4NuivARB = (VertexAttrib4NuivARBFunc_t) tilesortspu_nop; t->VertexAttrib4NusvARB = (VertexAttrib4NusvARBFunc_t) tilesortspu_nop; t->VertexAttrib4bvARB = (VertexAttrib4bvARBFunc_t) tilesortspu_nop; t->VertexAttrib4dARB = (VertexAttrib4dARBFunc_t) tilesortspu_nop; t->VertexAttrib4dvARB = (VertexAttrib4dvARBFunc_t) tilesortspu_nop; t->VertexAttrib4fARB = (VertexAttrib4fARBFunc_t) tilesortspu_nop; t->VertexAttrib4fvARB = (VertexAttrib4fvARBFunc_t) tilesortspu_nop; t->VertexAttrib4ivARB = (VertexAttrib4ivARBFunc_t) tilesortspu_nop; t->VertexAttrib4sARB = (VertexAttrib4sARBFunc_t) tilesortspu_nop; t->VertexAttrib4svARB = (VertexAttrib4svARBFunc_t) tilesortspu_nop; t->VertexAttrib4ubvARB = (VertexAttrib4ubvARBFunc_t) tilesortspu_nop; t->VertexAttrib4uivARB = (VertexAttrib4uivARBFunc_t) tilesortspu_nop; t->VertexAttrib4usvARB = (VertexAttrib4usvARBFunc_t) tilesortspu_nop; t->VertexAttribPointerARB = (VertexAttribPointerARBFunc_t) tilesortspu_nop; t->VertexAttribPointerNV = (VertexAttribPointerNVFunc_t) tilesortspu_nop; t->VertexAttribs1dvNV = (VertexAttribs1dvNVFunc_t) tilesortspu_nop; t->VertexAttribs1fvNV = (VertexAttribs1fvNVFunc_t) tilesortspu_nop; t->VertexAttribs1svNV = (VertexAttribs1svNVFunc_t) tilesortspu_nop; t->VertexAttribs2dvNV = (VertexAttribs2dvNVFunc_t) tilesortspu_nop; t->VertexAttribs2fvNV = (VertexAttribs2fvNVFunc_t) tilesortspu_nop; t->VertexAttribs2svNV = (VertexAttribs2svNVFunc_t) tilesortspu_nop; t->VertexAttribs3dvNV = (VertexAttribs3dvNVFunc_t) tilesortspu_nop; t->VertexAttribs3fvNV = (VertexAttribs3fvNVFunc_t) tilesortspu_nop; t->VertexAttribs3svNV = (VertexAttribs3svNVFunc_t) tilesortspu_nop; t->VertexAttribs4dvNV = (VertexAttribs4dvNVFunc_t) tilesortspu_nop; t->VertexAttribs4fvNV = (VertexAttribs4fvNVFunc_t) tilesortspu_nop; t->VertexAttribs4svNV = (VertexAttribs4svNVFunc_t) tilesortspu_nop; t->VertexAttribs4ubvNV = (VertexAttribs4ubvNVFunc_t) tilesortspu_nop; t->VertexPointer = crStateVertexPointer; t->Viewport = (ViewportFunc_t) tilesortspu_nop; t->WindowPos2dARB = crStateWindowPos2dARB; t->WindowPos2dvARB = crStateWindowPos2dvARB; t->WindowPos2fARB = crStateWindowPos2fARB; t->WindowPos2fvARB = crStateWindowPos2fvARB; t->WindowPos2iARB = crStateWindowPos2iARB; t->WindowPos2ivARB = crStateWindowPos2ivARB; t->WindowPos2sARB = crStateWindowPos2sARB; t->WindowPos2svARB = crStateWindowPos2svARB; t->WindowPos3dARB = crStateWindowPos3dARB; t->WindowPos3dvARB = crStateWindowPos3dvARB; t->WindowPos3fARB = crStateWindowPos3fARB; t->WindowPos3fvARB = crStateWindowPos3fvARB; t->WindowPos3iARB = crStateWindowPos3iARB; t->WindowPos3ivARB = crStateWindowPos3ivARB; t->WindowPos3sARB = crStateWindowPos3sARB; t->WindowPos3svARB = crStateWindowPos3svARB; t->ZPixCR = (ZPixCRFunc_t) tilesortspu_nop; } /* Used to send display lists to servers */ void tilesortspuLoadPackTable( SPUDispatchTable *t ) { t->Accum = tilesort_spu.swap ? crPackAccumSWAP : crPackAccum; t->ActiveTextureARB = tilesort_spu.swap ? crPackActiveTextureARBSWAP : crPackActiveTextureARB; t->AlphaFunc = tilesort_spu.swap ? crPackAlphaFuncSWAP : crPackAlphaFunc; t->AreProgramsResidentNV = crStateAreProgramsResidentNV; t->AreTexturesResident = crStateAreTexturesResident; t->ArrayElement = tilesortspu_ArrayElement; t->BarrierCreateCR = tilesortspu_BarrierCreateCR; t->BarrierDestroyCR = tilesortspu_BarrierDestroyCR; t->BarrierExecCR = tilesortspu_BarrierExecCR; t->Begin = tilesort_spu.swap ? crPackBeginSWAP : crPackBegin; t->BeginQueryARB = tilesortspu_BeginQueryARB; t->BindBufferARB = (BindBufferARBFunc_t) tilesortspu_nop; t->BindProgramARB = tilesort_spu.swap ? crPackBindProgramARBSWAP : crPackBindProgramARB; t->BindProgramNV = tilesort_spu.swap ? crPackBindProgramNVSWAP : crPackBindProgramNV; t->BindTexture = tilesort_spu.swap ? crPackBindTextureSWAP : crPackBindTexture; t->Bitmap = tilesortspu_PackBitmap; t->BlendColorEXT = tilesort_spu.swap ? crPackBlendColorEXTSWAP : crPackBlendColorEXT; t->BlendEquationEXT = tilesort_spu.swap ? crPackBlendEquationEXTSWAP : crPackBlendEquationEXT; t->BlendFunc = tilesort_spu.swap ? crPackBlendFuncSWAP : crPackBlendFunc; t->BlendFuncSeparateEXT = tilesort_spu.swap ? crPackBlendFuncSeparateEXTSWAP : crPackBlendFuncSeparateEXT; t->BoundsInfoCR = tilesort_spu.swap ? crPackBoundsInfoCRSWAP : crPackBoundsInfoCR; t->BufferDataARB = tilesortspu_BufferDataARB; t->BufferSubDataARB = tilesortspu_BufferSubDataARB; t->CallList = tilesort_spu.swap ? crPackCallListSWAP : crPackCallList; t->CallLists = tilesort_spu.swap ? crPackCallListsSWAP : crPackCallLists; t->ChromiumParameterfCR = tilesortspu_ChromiumParameterfCR; t->ChromiumParameteriCR = tilesortspu_ChromiumParameteriCR; t->ChromiumParametervCR = tilesortspu_ChromiumParametervCR; t->Clear = tilesort_spu.swap ? crPackClearSWAP : crPackClear; t->ClearAccum = tilesort_spu.swap ? crPackClearAccumSWAP : crPackClearAccum; t->ClearColor = tilesort_spu.swap ? crPackClearColorSWAP : crPackClearColor; t->ClearDepth = tilesort_spu.swap ? crPackClearDepthSWAP : crPackClearDepth; t->ClearIndex = tilesort_spu.swap ? crPackClearIndexSWAP : crPackClearIndex; t->ClearStencil = tilesort_spu.swap ? crPackClearStencilSWAP : crPackClearStencil; t->ClientActiveTextureARB = crStateClientActiveTextureARB; t->ClipPlane = tilesort_spu.swap ? crPackClipPlaneSWAP : crPackClipPlane; t->Color3b = tilesort_spu.swap ? crPackColor3bSWAP : crPackColor3b; t->Color3bv = tilesort_spu.swap ? crPackColor3bvSWAP : crPackColor3bv; t->Color3d = tilesort_spu.swap ? crPackColor3dSWAP : crPackColor3d; t->Color3dv = tilesort_spu.swap ? crPackColor3dvSWAP : crPackColor3dv; t->Color3f = tilesort_spu.swap ? crPackColor3fSWAP : crPackColor3f; t->Color3fv = tilesort_spu.swap ? crPackColor3fvSWAP : crPackColor3fv; t->Color3i = tilesort_spu.swap ? crPackColor3iSWAP : crPackColor3i; t->Color3iv = tilesort_spu.swap ? crPackColor3ivSWAP : crPackColor3iv; t->Color3s = tilesort_spu.swap ? crPackColor3sSWAP : crPackColor3s; t->Color3sv = tilesort_spu.swap ? crPackColor3svSWAP : crPackColor3sv; t->Color3ub = tilesort_spu.swap ? crPackColor3ubSWAP : crPackColor3ub; t->Color3ubv = tilesort_spu.swap ? crPackColor3ubvSWAP : crPackColor3ubv; t->Color3ui = tilesort_spu.swap ? crPackColor3uiSWAP : crPackColor3ui; t->Color3uiv = tilesort_spu.swap ? crPackColor3uivSWAP : crPackColor3uiv; t->Color3us = tilesort_spu.swap ? crPackColor3usSWAP : crPackColor3us; t->Color3usv = tilesort_spu.swap ? crPackColor3usvSWAP : crPackColor3usv; t->Color4b = tilesort_spu.swap ? crPackColor4bSWAP : crPackColor4b; t->Color4bv = tilesort_spu.swap ? crPackColor4bvSWAP : crPackColor4bv; t->Color4d = tilesort_spu.swap ? crPackColor4dSWAP : crPackColor4d; t->Color4dv = tilesort_spu.swap ? crPackColor4dvSWAP : crPackColor4dv; t->Color4f = tilesort_spu.swap ? crPackColor4fSWAP : crPackColor4f; t->Color4fv = tilesort_spu.swap ? crPackColor4fvSWAP : crPackColor4fv; t->Color4i = tilesort_spu.swap ? crPackColor4iSWAP : crPackColor4i; t->Color4iv = tilesort_spu.swap ? crPackColor4ivSWAP : crPackColor4iv; t->Color4s = tilesort_spu.swap ? crPackColor4sSWAP : crPackColor4s; t->Color4sv = tilesort_spu.swap ? crPackColor4svSWAP : crPackColor4sv; t->Color4ub = tilesort_spu.swap ? crPackColor4ubSWAP : crPackColor4ub; t->Color4ubv = tilesort_spu.swap ? crPackColor4ubvSWAP : crPackColor4ubv; t->Color4ui = tilesort_spu.swap ? crPackColor4uiSWAP : crPackColor4ui; t->Color4uiv = tilesort_spu.swap ? crPackColor4uivSWAP : crPackColor4uiv; t->Color4us = tilesort_spu.swap ? crPackColor4usSWAP : crPackColor4us; t->Color4usv = tilesort_spu.swap ? crPackColor4usvSWAP : crPackColor4usv; t->ColorMask = tilesort_spu.swap ? crPackColorMaskSWAP : crPackColorMask; t->ColorMaterial = tilesort_spu.swap ? crPackColorMaterialSWAP : crPackColorMaterial; t->ColorPointer = crStateColorPointer; t->CombinerInputNV = tilesort_spu.swap ? crPackCombinerInputNVSWAP : crPackCombinerInputNV; t->CombinerOutputNV = tilesort_spu.swap ? crPackCombinerOutputNVSWAP : crPackCombinerOutputNV; t->CombinerParameterfNV = tilesort_spu.swap ? crPackCombinerParameterfNVSWAP : crPackCombinerParameterfNV; t->CombinerParameterfvNV = tilesort_spu.swap ? crPackCombinerParameterfvNVSWAP : crPackCombinerParameterfvNV; t->CombinerParameteriNV = tilesort_spu.swap ? crPackCombinerParameteriNVSWAP : crPackCombinerParameteriNV; t->CombinerParameterivNV = tilesort_spu.swap ? crPackCombinerParameterivNVSWAP : crPackCombinerParameterivNV; t->CombinerStageParameterfvNV = tilesort_spu.swap ? crPackCombinerStageParameterfvNVSWAP : crPackCombinerStageParameterfvNV; t->CompressedTexImage1DARB = tilesort_spu.swap ? crPackCompressedTexImage1DARBSWAP : crPackCompressedTexImage1DARB; t->CompressedTexImage2DARB = tilesort_spu.swap ? crPackCompressedTexImage2DARBSWAP : crPackCompressedTexImage2DARB; t->CompressedTexImage3DARB = tilesort_spu.swap ? crPackCompressedTexImage3DARBSWAP : crPackCompressedTexImage3DARB; t->CompressedTexSubImage1DARB = tilesort_spu.swap ? crPackCompressedTexSubImage1DARBSWAP : crPackCompressedTexSubImage1DARB; t->CompressedTexSubImage2DARB = tilesort_spu.swap ? crPackCompressedTexSubImage2DARBSWAP : crPackCompressedTexSubImage2DARB; t->CompressedTexSubImage3DARB = tilesort_spu.swap ? crPackCompressedTexSubImage3DARBSWAP : crPackCompressedTexSubImage3DARB; t->CopyPixels = tilesortspu_CopyPixels; t->CopyTexImage1D = tilesortspu_CopyTexImage1D; t->CopyTexImage2D = tilesortspu_CopyTexImage2D; t->CopyTexSubImage1D = tilesortspu_CopyTexSubImage1D; t->CopyTexSubImage2D = tilesortspu_CopyTexSubImage2D; t->CopyTexSubImage3D = tilesortspu_CopyTexSubImage3D; t->CreateContext = tilesortspu_CreateContext; t->CullFace = tilesort_spu.swap ? crPackCullFaceSWAP : crPackCullFace; t->DeleteBuffersARB = tilesortspu_DeleteBuffersARB; t->DeleteFencesNV = (DeleteFencesNVFunc_t) tilesortspu_nop; t->DeleteLists = tilesortspu_DeleteLists; t->DeleteProgramsARB = tilesortspu_DeleteProgramsARB; t->DeleteQueriesARB = (DeleteQueriesARBFunc_t) tilesortspu_nop; t->DeleteTextures = tilesortspu_DeleteTextures; t->DepthFunc = tilesort_spu.swap ? crPackDepthFuncSWAP : crPackDepthFunc; t->DepthMask = tilesort_spu.swap ? crPackDepthMaskSWAP : crPackDepthMask; t->DepthRange = tilesort_spu.swap ? crPackDepthRangeSWAP : crPackDepthRange; t->DestroyContext = tilesortspu_DestroyContext; t->Disable = tilesort_spu.swap ? crPackDisableSWAP : crPackDisable; t->DisableClientState = crStateDisableClientState; t->DisableVertexAttribArrayARB = crStateDisableVertexAttribArrayARB; t->DrawArrays = tilesortspu_DrawArrays; t->DrawBuffer = tilesortspu_DrawBuffer; t->DrawElements = tilesortspu_DrawElements; t->DrawPixels = tilesortspu_PackDrawPixels; t->DrawRangeElements = tilesortspu_DrawRangeElements; t->EdgeFlag = tilesort_spu.swap ? crPackEdgeFlagSWAP : crPackEdgeFlag; t->EdgeFlagPointer = crStateEdgeFlagPointer; t->EdgeFlagv = tilesort_spu.swap ? crPackEdgeFlagvSWAP : crPackEdgeFlagv; t->Enable = tilesort_spu.swap ? crPackEnableSWAP : crPackEnable; t->EnableClientState = crStateEnableClientState; t->EnableVertexAttribArrayARB = crStateEnableVertexAttribArrayARB; t->End = tilesort_spu.swap ? crPackEndSWAP : crPackEnd; t->EndList = tilesortspu_EndList; t->EndQueryARB = tilesortspu_EndQueryARB; t->EvalCoord1d = tilesortspu_EvalCoord1d; t->EvalCoord1dv = tilesortspu_EvalCoord1dv; t->EvalCoord1f = tilesortspu_EvalCoord1f; t->EvalCoord1fv = tilesortspu_EvalCoord1fv; t->EvalCoord2d = tilesortspu_EvalCoord2d; t->EvalCoord2dv = tilesortspu_EvalCoord2dv; t->EvalCoord2f = tilesortspu_EvalCoord2f; t->EvalCoord2fv = tilesortspu_EvalCoord2fv; t->EvalMesh1 = tilesortspu_EvalMesh1; t->EvalMesh2 = tilesortspu_EvalMesh2; t->EvalPoint1 = tilesortspu_EvalPoint1; t->EvalPoint2 = tilesortspu_EvalPoint2; t->ExecuteProgramNV = tilesort_spu.swap ? crPackExecuteProgramNVSWAP : crPackExecuteProgramNV; t->FeedbackBuffer = (FeedbackBufferFunc_t) tilesortspu_nop; t->FinalCombinerInputNV = tilesort_spu.swap ? crPackFinalCombinerInputNVSWAP : crPackFinalCombinerInputNV; t->Finish = tilesortspu_Finish; t->FinishFenceNV = tilesort_spu.swap ? crPackFinishFenceNVSWAP : crPackFinishFenceNV; t->Flush = tilesortspu_Flush; t->FlushVertexArrayRangeNV = crStateFlushVertexArrayRangeNV; t->FogCoordPointerEXT = crStateFogCoordPointerEXT; t->FogCoorddEXT = tilesort_spu.swap ? crPackFogCoorddEXTSWAP : crPackFogCoorddEXT; t->FogCoorddvEXT = tilesort_spu.swap ? crPackFogCoorddvEXTSWAP : crPackFogCoorddvEXT; t->FogCoordfEXT = tilesort_spu.swap ? crPackFogCoordfEXTSWAP : crPackFogCoordfEXT; t->FogCoordfvEXT = tilesort_spu.swap ? crPackFogCoordfvEXTSWAP : crPackFogCoordfvEXT; t->Fogf = tilesort_spu.swap ? crPackFogfSWAP : crPackFogf; t->Fogfv = tilesort_spu.swap ? crPackFogfvSWAP : crPackFogfv; t->Fogi = tilesort_spu.swap ? crPackFogiSWAP : crPackFogi; t->Fogiv = tilesort_spu.swap ? crPackFogivSWAP : crPackFogiv; t->FrontFace = tilesort_spu.swap ? crPackFrontFaceSWAP : crPackFrontFace; t->Frustum = tilesort_spu.swap ? crPackFrustumSWAP : crPackFrustum; t->GenBuffersARB = crStateGenBuffersARB; t->GenFencesNV = crStateGenFencesNV; t->GenLists = tilesortspu_GenLists; t->GenProgramsARB = crStateGenProgramsARB; t->GenProgramsNV = crStateGenProgramsNV; t->GenQueriesARB = crStateGenQueriesARB; t->GenTextures = crStateGenTextures; t->GetBooleanv = tilesortspu_GetBooleanv; t->GetBufferParameterivARB = crStateGetBufferParameterivARB; t->GetBufferPointervARB = crStateGetBufferPointervARB; t->GetBufferSubDataARB = tilesortspu_GetBufferSubDataARB; t->GetChromiumParametervCR = tilesortspu_GetChromiumParametervCR; t->GetClipPlane = crStateGetClipPlane; t->GetCombinerInputParameterfvNV = crStateGetCombinerInputParameterfvNV; t->GetCombinerInputParameterivNV = crStateGetCombinerInputParameterivNV; t->GetCombinerOutputParameterfvNV = crStateGetCombinerOutputParameterfvNV; t->GetCombinerOutputParameterivNV = crStateGetCombinerOutputParameterivNV; t->GetCombinerStageParameterfvNV = crStateGetCombinerStageParameterfvNV; t->GetCompressedTexImageARB = crStateGetCompressedTexImageARB; t->GetDoublev = tilesortspu_GetDoublev; t->GetError = crStateGetError; t->GetFenceivNV = crStateGetFenceivNV; t->GetFinalCombinerInputParameterfvNV = crStateGetFinalCombinerInputParameterfvNV; t->GetFinalCombinerInputParameterivNV = crStateGetFinalCombinerInputParameterivNV; t->GetFloatv = tilesortspu_GetFloatv; t->GetIntegerv = tilesortspu_GetIntegerv; t->GetLightfv = crStateGetLightfv; t->GetLightiv = crStateGetLightiv; t->GetMapdv = crStateGetMapdv; t->GetMapfv = crStateGetMapfv; t->GetMapiv = crStateGetMapiv; t->GetMaterialfv = crStateGetMaterialfv; t->GetMaterialiv = crStateGetMaterialiv; t->GetPixelMapfv = crStateGetPixelMapfv; t->GetPixelMapuiv = crStateGetPixelMapuiv; t->GetPixelMapusv = crStateGetPixelMapusv; t->GetPointerv = crStateGetPointerv; t->GetPolygonStipple = crStateGetPolygonStipple; t->GetProgramEnvParameterdvARB = crStateGetProgramEnvParameterdvARB; t->GetProgramEnvParameterfvARB = crStateGetProgramEnvParameterfvARB; t->GetProgramLocalParameterdvARB = crStateGetProgramLocalParameterdvARB; t->GetProgramLocalParameterfvARB = crStateGetProgramLocalParameterfvARB; t->GetProgramNamedParameterdvNV = crStateGetProgramNamedParameterdvNV; t->GetProgramNamedParameterfvNV = crStateGetProgramNamedParameterfvNV; t->GetProgramParameterdvNV = crStateGetProgramParameterdvNV; t->GetProgramParameterfvNV = crStateGetProgramParameterfvNV; t->GetProgramStringARB = crStateGetProgramStringARB; t->GetProgramStringNV = crStateGetProgramStringNV; t->GetProgramivARB = crStateGetProgramivARB; t->GetProgramivNV = crStateGetProgramivNV; t->GetQueryObjectivARB = tilesortspu_GetQueryObjectivARB; t->GetQueryObjectuivARB = tilesortspu_GetQueryObjectuivARB; t->GetQueryivARB = crStateGetQueryivARB; t->GetString = tilesortspu_GetString; t->GetTexEnvfv = crStateGetTexEnvfv; t->GetTexEnviv = crStateGetTexEnviv; t->GetTexGendv = crStateGetTexGendv; t->GetTexGenfv = crStateGetTexGenfv; t->GetTexGeniv = crStateGetTexGeniv; t->GetTexImage = crStateGetTexImage; t->GetTexLevelParameterfv = crStateGetTexLevelParameterfv; t->GetTexLevelParameteriv = crStateGetTexLevelParameteriv; t->GetTexParameterfv = crStateGetTexParameterfv; t->GetTexParameteriv = crStateGetTexParameteriv; t->GetTrackMatrixivNV = crStateGetTrackMatrixivNV; t->GetVertexAttribPointervARB = crStateGetVertexAttribPointervARB; t->GetVertexAttribPointervNV = crStateGetVertexAttribPointervNV; t->GetVertexAttribdvARB = crStateGetVertexAttribdvARB; t->GetVertexAttribdvNV = crStateGetVertexAttribdvNV; t->GetVertexAttribfvARB = crStateGetVertexAttribfvARB; t->GetVertexAttribfvNV = crStateGetVertexAttribfvNV; t->GetVertexAttribivARB = crStateGetVertexAttribivARB; t->GetVertexAttribivNV = crStateGetVertexAttribivNV; t->Hint = tilesort_spu.swap ? crPackHintSWAP : crPackHint; t->IndexMask = tilesort_spu.swap ? crPackIndexMaskSWAP : crPackIndexMask; t->IndexPointer = crStateIndexPointer; t->Indexd = tilesort_spu.swap ? crPackIndexdSWAP : crPackIndexd; t->Indexdv = tilesort_spu.swap ? crPackIndexdvSWAP : crPackIndexdv; t->Indexf = tilesort_spu.swap ? crPackIndexfSWAP : crPackIndexf; t->Indexfv = tilesort_spu.swap ? crPackIndexfvSWAP : crPackIndexfv; t->Indexi = tilesort_spu.swap ? crPackIndexiSWAP : crPackIndexi; t->Indexiv = tilesort_spu.swap ? crPackIndexivSWAP : crPackIndexiv; t->Indexs = tilesort_spu.swap ? crPackIndexsSWAP : crPackIndexs; t->Indexsv = tilesort_spu.swap ? crPackIndexsvSWAP : crPackIndexsv; t->Indexub = tilesort_spu.swap ? crPackIndexubSWAP : crPackIndexub; t->Indexubv = tilesort_spu.swap ? crPackIndexubvSWAP : crPackIndexubv; t->InitNames = tilesort_spu.swap ? crPackInitNamesSWAP : crPackInitNames; t->InterleavedArrays = crStateInterleavedArrays; t->IsBufferARB = crStateIsBufferARB; t->IsEnabled = crStateIsEnabled; t->IsFenceNV = crStateIsFenceNV; t->IsList = crStateIsList; t->IsProgramARB = crStateIsProgramARB; t->IsQueryARB = crStateIsQueryARB; t->IsTexture = crStateIsTexture; t->LightModelf = tilesort_spu.swap ? crPackLightModelfSWAP : crPackLightModelf; t->LightModelfv = tilesort_spu.swap ? crPackLightModelfvSWAP : crPackLightModelfv; t->LightModeli = tilesort_spu.swap ? crPackLightModeliSWAP : crPackLightModeli; t->LightModeliv = tilesort_spu.swap ? crPackLightModelivSWAP : crPackLightModeliv; t->Lightf = tilesort_spu.swap ? crPackLightfSWAP : crPackLightf; t->Lightfv = tilesort_spu.swap ? crPackLightfvSWAP : crPackLightfv; t->Lighti = tilesort_spu.swap ? crPackLightiSWAP : crPackLighti; t->Lightiv = tilesort_spu.swap ? crPackLightivSWAP : crPackLightiv; t->LineStipple = tilesort_spu.swap ? crPackLineStippleSWAP : crPackLineStipple; t->LineWidth = tilesort_spu.swap ? crPackLineWidthSWAP : crPackLineWidth; t->ListBase = tilesortspu_ListBase; t->LoadIdentity = tilesort_spu.swap ? crPackLoadIdentitySWAP : crPackLoadIdentity; t->LoadMatrixd = tilesort_spu.swap ? crPackLoadMatrixdSWAP : crPackLoadMatrixd; t->LoadMatrixf = tilesort_spu.swap ? crPackLoadMatrixfSWAP : crPackLoadMatrixf; t->LoadName = tilesort_spu.swap ? crPackLoadNameSWAP : crPackLoadName; t->LoadProgramNV = tilesort_spu.swap ? crPackLoadProgramNVSWAP : crPackLoadProgramNV; t->LoadTransposeMatrixdARB = tilesort_spu.swap ? crPackLoadTransposeMatrixdARBSWAP : crPackLoadTransposeMatrixdARB; t->LoadTransposeMatrixfARB = tilesort_spu.swap ? crPackLoadTransposeMatrixfARBSWAP : crPackLoadTransposeMatrixfARB; t->LogicOp = tilesort_spu.swap ? crPackLogicOpSWAP : crPackLogicOp; t->MakeCurrent = tilesortspu_MakeCurrent; t->Map1d = tilesort_spu.swap ? crPackMap1dSWAP : crPackMap1d; t->Map1f = tilesort_spu.swap ? crPackMap1fSWAP : crPackMap1f; t->Map2d = tilesort_spu.swap ? crPackMap2dSWAP : crPackMap2d; t->Map2f = tilesort_spu.swap ? crPackMap2fSWAP : crPackMap2f; t->MapBufferARB = tilesortspu_MapBufferARB; t->MapGrid1d = tilesort_spu.swap ? crPackMapGrid1dSWAP : crPackMapGrid1d; t->MapGrid1f = tilesort_spu.swap ? crPackMapGrid1fSWAP : crPackMapGrid1f; t->MapGrid2d = tilesort_spu.swap ? crPackMapGrid2dSWAP : crPackMapGrid2d; t->MapGrid2f = tilesort_spu.swap ? crPackMapGrid2fSWAP : crPackMapGrid2f; t->Materialf = tilesort_spu.swap ? crPackMaterialfSWAP : crPackMaterialf; t->Materialfv = tilesort_spu.swap ? crPackMaterialfvSWAP : crPackMaterialfv; t->Materiali = tilesort_spu.swap ? crPackMaterialiSWAP : crPackMateriali; t->Materialiv = tilesort_spu.swap ? crPackMaterialivSWAP : crPackMaterialiv; t->MatrixMode = tilesort_spu.swap ? crPackMatrixModeSWAP : crPackMatrixMode; t->MultMatrixd = tilesort_spu.swap ? crPackMultMatrixdSWAP : crPackMultMatrixd; t->MultMatrixf = tilesort_spu.swap ? crPackMultMatrixfSWAP : crPackMultMatrixf; t->MultTransposeMatrixdARB = tilesort_spu.swap ? crPackMultTransposeMatrixdARBSWAP : crPackMultTransposeMatrixdARB; t->MultTransposeMatrixfARB = tilesort_spu.swap ? crPackMultTransposeMatrixfARBSWAP : crPackMultTransposeMatrixfARB; t->MultiDrawArraysEXT = tilesortspu_MultiDrawArraysEXT; t->MultiDrawElementsEXT = tilesortspu_MultiDrawElementsEXT; t->MultiTexCoord1dARB = tilesort_spu.swap ? crPackMultiTexCoord1dARBSWAP : crPackMultiTexCoord1dARB; t->MultiTexCoord1dvARB = tilesort_spu.swap ? crPackMultiTexCoord1dvARBSWAP : crPackMultiTexCoord1dvARB; t->MultiTexCoord1fARB = tilesort_spu.swap ? crPackMultiTexCoord1fARBSWAP : crPackMultiTexCoord1fARB; t->MultiTexCoord1fvARB = tilesort_spu.swap ? crPackMultiTexCoord1fvARBSWAP : crPackMultiTexCoord1fvARB; t->MultiTexCoord1iARB = tilesort_spu.swap ? crPackMultiTexCoord1iARBSWAP : crPackMultiTexCoord1iARB; t->MultiTexCoord1ivARB = tilesort_spu.swap ? crPackMultiTexCoord1ivARBSWAP : crPackMultiTexCoord1ivARB; t->MultiTexCoord1sARB = tilesort_spu.swap ? crPackMultiTexCoord1sARBSWAP : crPackMultiTexCoord1sARB; t->MultiTexCoord1svARB = tilesort_spu.swap ? crPackMultiTexCoord1svARBSWAP : crPackMultiTexCoord1svARB; t->MultiTexCoord2dARB = tilesort_spu.swap ? crPackMultiTexCoord2dARBSWAP : crPackMultiTexCoord2dARB; t->MultiTexCoord2dvARB = tilesort_spu.swap ? crPackMultiTexCoord2dvARBSWAP : crPackMultiTexCoord2dvARB; t->MultiTexCoord2fARB = tilesort_spu.swap ? crPackMultiTexCoord2fARBSWAP : crPackMultiTexCoord2fARB; t->MultiTexCoord2fvARB = tilesort_spu.swap ? crPackMultiTexCoord2fvARBSWAP : crPackMultiTexCoord2fvARB; t->MultiTexCoord2iARB = tilesort_spu.swap ? crPackMultiTexCoord2iARBSWAP : crPackMultiTexCoord2iARB; t->MultiTexCoord2ivARB = tilesort_spu.swap ? crPackMultiTexCoord2ivARBSWAP : crPackMultiTexCoord2ivARB; t->MultiTexCoord2sARB = tilesort_spu.swap ? crPackMultiTexCoord2sARBSWAP : crPackMultiTexCoord2sARB; t->MultiTexCoord2svARB = tilesort_spu.swap ? crPackMultiTexCoord2svARBSWAP : crPackMultiTexCoord2svARB; t->MultiTexCoord3dARB = tilesort_spu.swap ? crPackMultiTexCoord3dARBSWAP : crPackMultiTexCoord3dARB; t->MultiTexCoord3dvARB = tilesort_spu.swap ? crPackMultiTexCoord3dvARBSWAP : crPackMultiTexCoord3dvARB; t->MultiTexCoord3fARB = tilesort_spu.swap ? crPackMultiTexCoord3fARBSWAP : crPackMultiTexCoord3fARB; t->MultiTexCoord3fvARB = tilesort_spu.swap ? crPackMultiTexCoord3fvARBSWAP : crPackMultiTexCoord3fvARB; t->MultiTexCoord3iARB = tilesort_spu.swap ? crPackMultiTexCoord3iARBSWAP : crPackMultiTexCoord3iARB; t->MultiTexCoord3ivARB = tilesort_spu.swap ? crPackMultiTexCoord3ivARBSWAP : crPackMultiTexCoord3ivARB; t->MultiTexCoord3sARB = tilesort_spu.swap ? crPackMultiTexCoord3sARBSWAP : crPackMultiTexCoord3sARB; t->MultiTexCoord3svARB = tilesort_spu.swap ? crPackMultiTexCoord3svARBSWAP : crPackMultiTexCoord3svARB; t->MultiTexCoord4dARB = tilesort_spu.swap ? crPackMultiTexCoord4dARBSWAP : crPackMultiTexCoord4dARB; t->MultiTexCoord4dvARB = tilesort_spu.swap ? crPackMultiTexCoord4dvARBSWAP : crPackMultiTexCoord4dvARB; t->MultiTexCoord4fARB = tilesort_spu.swap ? crPackMultiTexCoord4fARBSWAP : crPackMultiTexCoord4fARB; t->MultiTexCoord4fvARB = tilesort_spu.swap ? crPackMultiTexCoord4fvARBSWAP : crPackMultiTexCoord4fvARB; t->MultiTexCoord4iARB = tilesort_spu.swap ? crPackMultiTexCoord4iARBSWAP : crPackMultiTexCoord4iARB; t->MultiTexCoord4ivARB = tilesort_spu.swap ? crPackMultiTexCoord4ivARBSWAP : crPackMultiTexCoord4ivARB; t->MultiTexCoord4sARB = tilesort_spu.swap ? crPackMultiTexCoord4sARBSWAP : crPackMultiTexCoord4sARB; t->MultiTexCoord4svARB = tilesort_spu.swap ? crPackMultiTexCoord4svARBSWAP : crPackMultiTexCoord4svARB; t->NewList = tilesortspu_NewList; t->Normal3b = tilesort_spu.swap ? crPackNormal3bSWAP : crPackNormal3b; t->Normal3bv = tilesort_spu.swap ? crPackNormal3bvSWAP : crPackNormal3bv; t->Normal3d = tilesort_spu.swap ? crPackNormal3dSWAP : crPackNormal3d; t->Normal3dv = tilesort_spu.swap ? crPackNormal3dvSWAP : crPackNormal3dv; t->Normal3f = tilesort_spu.swap ? crPackNormal3fSWAP : crPackNormal3f; t->Normal3fv = tilesort_spu.swap ? crPackNormal3fvSWAP : crPackNormal3fv; t->Normal3i = tilesort_spu.swap ? crPackNormal3iSWAP : crPackNormal3i; t->Normal3iv = tilesort_spu.swap ? crPackNormal3ivSWAP : crPackNormal3iv; t->Normal3s = tilesort_spu.swap ? crPackNormal3sSWAP : crPackNormal3s; t->Normal3sv = tilesort_spu.swap ? crPackNormal3svSWAP : crPackNormal3sv; t->NormalPointer = crStateNormalPointer; t->Ortho = tilesort_spu.swap ? crPackOrthoSWAP : crPackOrtho; t->PassThrough = tilesort_spu.swap ? crPackPassThroughSWAP : crPackPassThrough; t->PixelMapfv = tilesortspu_PixelMapfv; t->PixelMapuiv = tilesortspu_PixelMapuiv; t->PixelMapusv = tilesortspu_PixelMapusv; t->PixelStoref = crStatePixelStoref; t->PixelStorei = crStatePixelStorei; t->PixelTransferf = tilesortspu_PixelTransferf; t->PixelTransferi = tilesortspu_PixelTransferi; t->PixelZoom = tilesort_spu.swap ? crPackPixelZoomSWAP : crPackPixelZoom; t->PointParameterfARB = tilesort_spu.swap ? crPackPointParameterfARBSWAP : crPackPointParameterfARB; t->PointParameterfvARB = tilesort_spu.swap ? crPackPointParameterfvARBSWAP : crPackPointParameterfvARB; t->PointParameteri = tilesort_spu.swap ? crPackPointParameteriSWAP : crPackPointParameteri; t->PointParameteriv = tilesort_spu.swap ? crPackPointParameterivSWAP : crPackPointParameteriv; t->PointSize = tilesort_spu.swap ? crPackPointSizeSWAP : crPackPointSize; t->PolygonMode = tilesort_spu.swap ? crPackPolygonModeSWAP : crPackPolygonMode; t->PolygonOffset = tilesort_spu.swap ? crPackPolygonOffsetSWAP : crPackPolygonOffset; t->PolygonStipple = tilesort_spu.swap ? crPackPolygonStippleSWAP : crPackPolygonStipple; t->PopAttrib = tilesort_spu.swap ? crPackPopAttribSWAP : crPackPopAttrib; t->PopClientAttrib = crStatePopClientAttrib; t->PopMatrix = tilesort_spu.swap ? crPackPopMatrixSWAP : crPackPopMatrix; t->PopName = tilesort_spu.swap ? crPackPopNameSWAP : crPackPopName; t->PrioritizeTextures = tilesort_spu.swap ? crPackPrioritizeTexturesSWAP : crPackPrioritizeTextures; t->ProgramEnvParameter4dARB = tilesort_spu.swap ? crPackProgramEnvParameter4dARBSWAP : crPackProgramEnvParameter4dARB; t->ProgramEnvParameter4dvARB = tilesort_spu.swap ? crPackProgramEnvParameter4dvARBSWAP : crPackProgramEnvParameter4dvARB; t->ProgramEnvParameter4fARB = tilesort_spu.swap ? crPackProgramEnvParameter4fARBSWAP : crPackProgramEnvParameter4fARB; t->ProgramEnvParameter4fvARB = tilesort_spu.swap ? crPackProgramEnvParameter4fvARBSWAP : crPackProgramEnvParameter4fvARB; t->ProgramLocalParameter4dARB = tilesort_spu.swap ? crPackProgramLocalParameter4dARBSWAP : crPackProgramLocalParameter4dARB; t->ProgramLocalParameter4dvARB = tilesort_spu.swap ? crPackProgramLocalParameter4dvARBSWAP : crPackProgramLocalParameter4dvARB; t->ProgramLocalParameter4fARB = tilesort_spu.swap ? crPackProgramLocalParameter4fARBSWAP : crPackProgramLocalParameter4fARB; t->ProgramLocalParameter4fvARB = tilesort_spu.swap ? crPackProgramLocalParameter4fvARBSWAP : crPackProgramLocalParameter4fvARB; t->ProgramNamedParameter4dNV = tilesort_spu.swap ? crPackProgramNamedParameter4dNVSWAP : crPackProgramNamedParameter4dNV; t->ProgramNamedParameter4dvNV = tilesort_spu.swap ? crPackProgramNamedParameter4dvNVSWAP : crPackProgramNamedParameter4dvNV; t->ProgramNamedParameter4fNV = tilesort_spu.swap ? crPackProgramNamedParameter4fNVSWAP : crPackProgramNamedParameter4fNV; t->ProgramNamedParameter4fvNV = tilesort_spu.swap ? crPackProgramNamedParameter4fvNVSWAP : crPackProgramNamedParameter4fvNV; t->ProgramParameter4dNV = tilesort_spu.swap ? crPackProgramParameter4dNVSWAP : crPackProgramParameter4dNV; t->ProgramParameter4dvNV = tilesort_spu.swap ? crPackProgramParameter4dvNVSWAP : crPackProgramParameter4dvNV; t->ProgramParameter4fNV = tilesort_spu.swap ? crPackProgramParameter4fNVSWAP : crPackProgramParameter4fNV; t->ProgramParameter4fvNV = tilesort_spu.swap ? crPackProgramParameter4fvNVSWAP : crPackProgramParameter4fvNV; t->ProgramParameters4dvNV = tilesort_spu.swap ? crPackProgramParameters4dvNVSWAP : crPackProgramParameters4dvNV; t->ProgramParameters4fvNV = tilesort_spu.swap ? crPackProgramParameters4fvNVSWAP : crPackProgramParameters4fvNV; t->ProgramStringARB = tilesort_spu.swap ? crPackProgramStringARBSWAP : crPackProgramStringARB; t->PushAttrib = tilesort_spu.swap ? crPackPushAttribSWAP : crPackPushAttrib; t->PushClientAttrib = crStatePushClientAttrib; t->PushMatrix = tilesort_spu.swap ? crPackPushMatrixSWAP : crPackPushMatrix; t->PushName = tilesort_spu.swap ? crPackPushNameSWAP : crPackPushName; t->RasterPos2d = tilesortspu_RasterPos2d; t->RasterPos2dv = tilesortspu_RasterPos2dv; t->RasterPos2f = tilesortspu_RasterPos2f; t->RasterPos2fv = tilesortspu_RasterPos2fv; t->RasterPos2i = tilesortspu_RasterPos2i; t->RasterPos2iv = tilesortspu_RasterPos2iv; t->RasterPos2s = tilesortspu_RasterPos2s; t->RasterPos2sv = tilesortspu_RasterPos2sv; t->RasterPos3d = tilesortspu_RasterPos3d; t->RasterPos3dv = tilesortspu_RasterPos3dv; t->RasterPos3f = tilesortspu_RasterPos3f; t->RasterPos3fv = tilesortspu_RasterPos3fv; t->RasterPos3i = tilesortspu_RasterPos3i; t->RasterPos3iv = tilesortspu_RasterPos3iv; t->RasterPos3s = tilesortspu_RasterPos3s; t->RasterPos3sv = tilesortspu_RasterPos3sv; t->RasterPos4d = tilesortspu_RasterPos4d; t->RasterPos4dv = tilesortspu_RasterPos4dv; t->RasterPos4f = tilesortspu_RasterPos4f; t->RasterPos4fv = tilesortspu_RasterPos4fv; t->RasterPos4i = tilesortspu_RasterPos4i; t->RasterPos4iv = tilesortspu_RasterPos4iv; t->RasterPos4s = tilesortspu_RasterPos4s; t->RasterPos4sv = tilesortspu_RasterPos4sv; t->ReadBuffer = tilesort_spu.swap ? crPackReadBufferSWAP : crPackReadBuffer; t->ReadPixels = tilesortspu_ReadPixels; t->Rectd = tilesortspu_Rectd; t->Rectdv = tilesortspu_Rectdv; t->Rectf = tilesortspu_Rectf; t->Rectfv = tilesortspu_Rectfv; t->Recti = tilesortspu_Recti; t->Rectiv = tilesortspu_Rectiv; t->Rects = tilesortspu_Rects; t->Rectsv = tilesortspu_Rectsv; t->RenderMode = (RenderModeFunc_t) tilesortspu_nop; t->RequestResidentProgramsNV = tilesort_spu.swap ? crPackRequestResidentProgramsNVSWAP : crPackRequestResidentProgramsNV; t->Rotated = tilesort_spu.swap ? crPackRotatedSWAP : crPackRotated; t->Rotatef = tilesort_spu.swap ? crPackRotatefSWAP : crPackRotatef; t->SampleCoverageARB = tilesort_spu.swap ? crPackSampleCoverageARBSWAP : crPackSampleCoverageARB; t->Scaled = tilesort_spu.swap ? crPackScaledSWAP : crPackScaled; t->Scalef = tilesort_spu.swap ? crPackScalefSWAP : crPackScalef; t->Scissor = tilesortspu_Scissor; t->SecondaryColor3bEXT = tilesort_spu.swap ? crPackSecondaryColor3bEXTSWAP : crPackSecondaryColor3bEXT; t->SecondaryColor3bvEXT = tilesort_spu.swap ? crPackSecondaryColor3bvEXTSWAP : crPackSecondaryColor3bvEXT; t->SecondaryColor3dEXT = tilesort_spu.swap ? crPackSecondaryColor3dEXTSWAP : crPackSecondaryColor3dEXT; t->SecondaryColor3dvEXT = tilesort_spu.swap ? crPackSecondaryColor3dvEXTSWAP : crPackSecondaryColor3dvEXT; t->SecondaryColor3fEXT = tilesort_spu.swap ? crPackSecondaryColor3fEXTSWAP : crPackSecondaryColor3fEXT; t->SecondaryColor3fvEXT = tilesort_spu.swap ? crPackSecondaryColor3fvEXTSWAP : crPackSecondaryColor3fvEXT; t->SecondaryColor3iEXT = tilesort_spu.swap ? crPackSecondaryColor3iEXTSWAP : crPackSecondaryColor3iEXT; t->SecondaryColor3ivEXT = tilesort_spu.swap ? crPackSecondaryColor3ivEXTSWAP : crPackSecondaryColor3ivEXT; t->SecondaryColor3sEXT = tilesort_spu.swap ? crPackSecondaryColor3sEXTSWAP : crPackSecondaryColor3sEXT; t->SecondaryColor3svEXT = tilesort_spu.swap ? crPackSecondaryColor3svEXTSWAP : crPackSecondaryColor3svEXT; t->SecondaryColor3ubEXT = tilesort_spu.swap ? crPackSecondaryColor3ubEXTSWAP : crPackSecondaryColor3ubEXT; t->SecondaryColor3ubvEXT = tilesort_spu.swap ? crPackSecondaryColor3ubvEXTSWAP : crPackSecondaryColor3ubvEXT; t->SecondaryColor3uiEXT = tilesort_spu.swap ? crPackSecondaryColor3uiEXTSWAP : crPackSecondaryColor3uiEXT; t->SecondaryColor3uivEXT = tilesort_spu.swap ? crPackSecondaryColor3uivEXTSWAP : crPackSecondaryColor3uivEXT; t->SecondaryColor3usEXT = tilesort_spu.swap ? crPackSecondaryColor3usEXTSWAP : crPackSecondaryColor3usEXT; t->SecondaryColor3usvEXT = tilesort_spu.swap ? crPackSecondaryColor3usvEXTSWAP : crPackSecondaryColor3usvEXT; t->SecondaryColorPointerEXT = crStateSecondaryColorPointerEXT; t->SelectBuffer = (SelectBufferFunc_t) tilesortspu_nop; t->SemaphoreCreateCR = tilesortspu_SemaphoreCreateCR; t->SemaphoreDestroyCR = tilesortspu_SemaphoreDestroyCR; t->SemaphorePCR = tilesortspu_SemaphorePCR; t->SemaphoreVCR = tilesortspu_SemaphoreVCR; t->SetFenceNV = tilesort_spu.swap ? crPackSetFenceNVSWAP : crPackSetFenceNV; t->ShadeModel = tilesort_spu.swap ? crPackShadeModelSWAP : crPackShadeModel; t->StencilFunc = tilesort_spu.swap ? crPackStencilFuncSWAP : crPackStencilFunc; t->StencilMask = tilesort_spu.swap ? crPackStencilMaskSWAP : crPackStencilMask; t->StencilOp = tilesort_spu.swap ? crPackStencilOpSWAP : crPackStencilOp; t->SwapBuffers = tilesortspu_SwapBuffers; t->TestFenceNV = crStateTestFenceNV; t->TexCoord1d = tilesort_spu.swap ? crPackTexCoord1dSWAP : crPackTexCoord1d; t->TexCoord1dv = tilesort_spu.swap ? crPackTexCoord1dvSWAP : crPackTexCoord1dv; t->TexCoord1f = tilesort_spu.swap ? crPackTexCoord1fSWAP : crPackTexCoord1f; t->TexCoord1fv = tilesort_spu.swap ? crPackTexCoord1fvSWAP : crPackTexCoord1fv; t->TexCoord1i = tilesort_spu.swap ? crPackTexCoord1iSWAP : crPackTexCoord1i; t->TexCoord1iv = tilesort_spu.swap ? crPackTexCoord1ivSWAP : crPackTexCoord1iv; t->TexCoord1s = tilesort_spu.swap ? crPackTexCoord1sSWAP : crPackTexCoord1s; t->TexCoord1sv = tilesort_spu.swap ? crPackTexCoord1svSWAP : crPackTexCoord1sv; t->TexCoord2d = tilesort_spu.swap ? crPackTexCoord2dSWAP : crPackTexCoord2d; t->TexCoord2dv = tilesort_spu.swap ? crPackTexCoord2dvSWAP : crPackTexCoord2dv; t->TexCoord2f = tilesort_spu.swap ? crPackTexCoord2fSWAP : crPackTexCoord2f; t->TexCoord2fv = tilesort_spu.swap ? crPackTexCoord2fvSWAP : crPackTexCoord2fv; t->TexCoord2i = tilesort_spu.swap ? crPackTexCoord2iSWAP : crPackTexCoord2i; t->TexCoord2iv = tilesort_spu.swap ? crPackTexCoord2ivSWAP : crPackTexCoord2iv; t->TexCoord2s = tilesort_spu.swap ? crPackTexCoord2sSWAP : crPackTexCoord2s; t->TexCoord2sv = tilesort_spu.swap ? crPackTexCoord2svSWAP : crPackTexCoord2sv; t->TexCoord3d = tilesort_spu.swap ? crPackTexCoord3dSWAP : crPackTexCoord3d; t->TexCoord3dv = tilesort_spu.swap ? crPackTexCoord3dvSWAP : crPackTexCoord3dv; t->TexCoord3f = tilesort_spu.swap ? crPackTexCoord3fSWAP : crPackTexCoord3f; t->TexCoord3fv = tilesort_spu.swap ? crPackTexCoord3fvSWAP : crPackTexCoord3fv; t->TexCoord3i = tilesort_spu.swap ? crPackTexCoord3iSWAP : crPackTexCoord3i; t->TexCoord3iv = tilesort_spu.swap ? crPackTexCoord3ivSWAP : crPackTexCoord3iv; t->TexCoord3s = tilesort_spu.swap ? crPackTexCoord3sSWAP : crPackTexCoord3s; t->TexCoord3sv = tilesort_spu.swap ? crPackTexCoord3svSWAP : crPackTexCoord3sv; t->TexCoord4d = tilesort_spu.swap ? crPackTexCoord4dSWAP : crPackTexCoord4d; t->TexCoord4dv = tilesort_spu.swap ? crPackTexCoord4dvSWAP : crPackTexCoord4dv; t->TexCoord4f = tilesort_spu.swap ? crPackTexCoord4fSWAP : crPackTexCoord4f; t->TexCoord4fv = tilesort_spu.swap ? crPackTexCoord4fvSWAP : crPackTexCoord4fv; t->TexCoord4i = tilesort_spu.swap ? crPackTexCoord4iSWAP : crPackTexCoord4i; t->TexCoord4iv = tilesort_spu.swap ? crPackTexCoord4ivSWAP : crPackTexCoord4iv; t->TexCoord4s = tilesort_spu.swap ? crPackTexCoord4sSWAP : crPackTexCoord4s; t->TexCoord4sv = tilesort_spu.swap ? crPackTexCoord4svSWAP : crPackTexCoord4sv; t->TexCoordPointer = crStateTexCoordPointer; t->TexEnvf = tilesort_spu.swap ? crPackTexEnvfSWAP : crPackTexEnvf; t->TexEnvfv = tilesort_spu.swap ? crPackTexEnvfvSWAP : crPackTexEnvfv; t->TexEnvi = tilesort_spu.swap ? crPackTexEnviSWAP : crPackTexEnvi; t->TexEnviv = tilesort_spu.swap ? crPackTexEnvivSWAP : crPackTexEnviv; t->TexGend = tilesort_spu.swap ? crPackTexGendSWAP : crPackTexGend; t->TexGendv = tilesort_spu.swap ? crPackTexGendvSWAP : crPackTexGendv; t->TexGenf = tilesort_spu.swap ? crPackTexGenfSWAP : crPackTexGenf; t->TexGenfv = tilesort_spu.swap ? crPackTexGenfvSWAP : crPackTexGenfv; t->TexGeni = tilesort_spu.swap ? crPackTexGeniSWAP : crPackTexGeni; t->TexGeniv = tilesort_spu.swap ? crPackTexGenivSWAP : crPackTexGeniv; t->TexImage1D = tilesortspu_PackTexImage1D; t->TexImage2D = tilesortspu_PackTexImage2D; t->TexImage3D = tilesortspu_PackTexImage3D; t->TexImage3DEXT = tilesortspu_PackTexImage3DEXT; t->TexParameterf = tilesort_spu.swap ? crPackTexParameterfSWAP : crPackTexParameterf; t->TexParameterfv = tilesort_spu.swap ? crPackTexParameterfvSWAP : crPackTexParameterfv; t->TexParameteri = tilesort_spu.swap ? crPackTexParameteriSWAP : crPackTexParameteri; t->TexParameteriv = tilesort_spu.swap ? crPackTexParameterivSWAP : crPackTexParameteriv; t->TexSubImage1D = tilesortspu_PackTexSubImage1D; t->TexSubImage2D = tilesortspu_PackTexSubImage2D; t->TexSubImage3D = tilesortspu_PackTexSubImage3D; t->TrackMatrixNV = tilesort_spu.swap ? crPackTrackMatrixNVSWAP : crPackTrackMatrixNV; t->Translated = tilesort_spu.swap ? crPackTranslatedSWAP : crPackTranslated; t->Translatef = tilesort_spu.swap ? crPackTranslatefSWAP : crPackTranslatef; t->UnmapBufferARB = tilesortspu_UnmapBufferARB; t->Vertex2d = tilesort_spu.swap ? crPackVertex2dSWAP : crPackVertex2d; t->Vertex2dv = tilesort_spu.swap ? crPackVertex2dvSWAP : crPackVertex2dv; t->Vertex2f = tilesort_spu.swap ? crPackVertex2fSWAP : crPackVertex2f; t->Vertex2fv = tilesort_spu.swap ? crPackVertex2fvSWAP : crPackVertex2fv; t->Vertex2i = tilesort_spu.swap ? crPackVertex2iSWAP : crPackVertex2i; t->Vertex2iv = tilesort_spu.swap ? crPackVertex2ivSWAP : crPackVertex2iv; t->Vertex2s = tilesort_spu.swap ? crPackVertex2sSWAP : crPackVertex2s; t->Vertex2sv = tilesort_spu.swap ? crPackVertex2svSWAP : crPackVertex2sv; t->Vertex3d = tilesort_spu.swap ? crPackVertex3dSWAP : crPackVertex3d; t->Vertex3dv = tilesort_spu.swap ? crPackVertex3dvSWAP : crPackVertex3dv; t->Vertex3f = tilesort_spu.swap ? crPackVertex3fSWAP : crPackVertex3f; t->Vertex3fv = tilesort_spu.swap ? crPackVertex3fvSWAP : crPackVertex3fv; t->Vertex3i = tilesort_spu.swap ? crPackVertex3iSWAP : crPackVertex3i; t->Vertex3iv = tilesort_spu.swap ? crPackVertex3ivSWAP : crPackVertex3iv; t->Vertex3s = tilesort_spu.swap ? crPackVertex3sSWAP : crPackVertex3s; t->Vertex3sv = tilesort_spu.swap ? crPackVertex3svSWAP : crPackVertex3sv; t->Vertex4d = tilesort_spu.swap ? crPackVertex4dSWAP : crPackVertex4d; t->Vertex4dv = tilesort_spu.swap ? crPackVertex4dvSWAP : crPackVertex4dv; t->Vertex4f = tilesort_spu.swap ? crPackVertex4fSWAP : crPackVertex4f; t->Vertex4fv = tilesort_spu.swap ? crPackVertex4fvSWAP : crPackVertex4fv; t->Vertex4i = tilesort_spu.swap ? crPackVertex4iSWAP : crPackVertex4i; t->Vertex4iv = tilesort_spu.swap ? crPackVertex4ivSWAP : crPackVertex4iv; t->Vertex4s = tilesort_spu.swap ? crPackVertex4sSWAP : crPackVertex4s; t->Vertex4sv = tilesort_spu.swap ? crPackVertex4svSWAP : crPackVertex4sv; t->VertexArrayRangeNV = crStateVertexArrayRangeNV; t->VertexAttrib1dARB = tilesort_spu.swap ? crPackVertexAttrib1dARBSWAP : crPackVertexAttrib1dARB; t->VertexAttrib1dvARB = tilesort_spu.swap ? crPackVertexAttrib1dvARBSWAP : crPackVertexAttrib1dvARB; t->VertexAttrib1fARB = tilesort_spu.swap ? crPackVertexAttrib1fARBSWAP : crPackVertexAttrib1fARB; t->VertexAttrib1fvARB = tilesort_spu.swap ? crPackVertexAttrib1fvARBSWAP : crPackVertexAttrib1fvARB; t->VertexAttrib1sARB = tilesort_spu.swap ? crPackVertexAttrib1sARBSWAP : crPackVertexAttrib1sARB; t->VertexAttrib1svARB = tilesort_spu.swap ? crPackVertexAttrib1svARBSWAP : crPackVertexAttrib1svARB; t->VertexAttrib2dARB = tilesort_spu.swap ? crPackVertexAttrib2dARBSWAP : crPackVertexAttrib2dARB; t->VertexAttrib2dvARB = tilesort_spu.swap ? crPackVertexAttrib2dvARBSWAP : crPackVertexAttrib2dvARB; t->VertexAttrib2fARB = tilesort_spu.swap ? crPackVertexAttrib2fARBSWAP : crPackVertexAttrib2fARB; t->VertexAttrib2fvARB = tilesort_spu.swap ? crPackVertexAttrib2fvARBSWAP : crPackVertexAttrib2fvARB; t->VertexAttrib2sARB = tilesort_spu.swap ? crPackVertexAttrib2sARBSWAP : crPackVertexAttrib2sARB; t->VertexAttrib2svARB = tilesort_spu.swap ? crPackVertexAttrib2svARBSWAP : crPackVertexAttrib2svARB; t->VertexAttrib3dARB = tilesort_spu.swap ? crPackVertexAttrib3dARBSWAP : crPackVertexAttrib3dARB; t->VertexAttrib3dvARB = tilesort_spu.swap ? crPackVertexAttrib3dvARBSWAP : crPackVertexAttrib3dvARB; t->VertexAttrib3fARB = tilesort_spu.swap ? crPackVertexAttrib3fARBSWAP : crPackVertexAttrib3fARB; t->VertexAttrib3fvARB = tilesort_spu.swap ? crPackVertexAttrib3fvARBSWAP : crPackVertexAttrib3fvARB; t->VertexAttrib3sARB = tilesort_spu.swap ? crPackVertexAttrib3sARBSWAP : crPackVertexAttrib3sARB; t->VertexAttrib3svARB = tilesort_spu.swap ? crPackVertexAttrib3svARBSWAP : crPackVertexAttrib3svARB; t->VertexAttrib4NbvARB = tilesort_spu.swap ? crPackVertexAttrib4NbvARBSWAP : crPackVertexAttrib4NbvARB; t->VertexAttrib4NivARB = tilesort_spu.swap ? crPackVertexAttrib4NivARBSWAP : crPackVertexAttrib4NivARB; t->VertexAttrib4NsvARB = tilesort_spu.swap ? crPackVertexAttrib4NsvARBSWAP : crPackVertexAttrib4NsvARB; t->VertexAttrib4NubARB = tilesort_spu.swap ? crPackVertexAttrib4NubARBSWAP : crPackVertexAttrib4NubARB; t->VertexAttrib4NubvARB = tilesort_spu.swap ? crPackVertexAttrib4NubvARBSWAP : crPackVertexAttrib4NubvARB; t->VertexAttrib4NuivARB = tilesort_spu.swap ? crPackVertexAttrib4NuivARBSWAP : crPackVertexAttrib4NuivARB; t->VertexAttrib4NusvARB = tilesort_spu.swap ? crPackVertexAttrib4NusvARBSWAP : crPackVertexAttrib4NusvARB; t->VertexAttrib4bvARB = tilesort_spu.swap ? crPackVertexAttrib4bvARBSWAP : crPackVertexAttrib4bvARB; t->VertexAttrib4dARB = tilesort_spu.swap ? crPackVertexAttrib4dARBSWAP : crPackVertexAttrib4dARB; t->VertexAttrib4dvARB = tilesort_spu.swap ? crPackVertexAttrib4dvARBSWAP : crPackVertexAttrib4dvARB; t->VertexAttrib4fARB = tilesort_spu.swap ? crPackVertexAttrib4fARBSWAP : crPackVertexAttrib4fARB; t->VertexAttrib4fvARB = tilesort_spu.swap ? crPackVertexAttrib4fvARBSWAP : crPackVertexAttrib4fvARB; t->VertexAttrib4ivARB = tilesort_spu.swap ? crPackVertexAttrib4ivARBSWAP : crPackVertexAttrib4ivARB; t->VertexAttrib4sARB = tilesort_spu.swap ? crPackVertexAttrib4sARBSWAP : crPackVertexAttrib4sARB; t->VertexAttrib4svARB = tilesort_spu.swap ? crPackVertexAttrib4svARBSWAP : crPackVertexAttrib4svARB; t->VertexAttrib4ubvARB = tilesort_spu.swap ? crPackVertexAttrib4ubvARBSWAP : crPackVertexAttrib4ubvARB; t->VertexAttrib4uivARB = tilesort_spu.swap ? crPackVertexAttrib4uivARBSWAP : crPackVertexAttrib4uivARB; t->VertexAttrib4usvARB = tilesort_spu.swap ? crPackVertexAttrib4usvARBSWAP : crPackVertexAttrib4usvARB; t->VertexAttribPointerARB = crStateVertexAttribPointerARB; t->VertexAttribPointerNV = crStateVertexAttribPointerNV; t->VertexAttribs1dvNV = tilesort_spu.swap ? crPackVertexAttribs1dvNVSWAP : crPackVertexAttribs1dvNV; t->VertexAttribs1fvNV = tilesort_spu.swap ? crPackVertexAttribs1fvNVSWAP : crPackVertexAttribs1fvNV; t->VertexAttribs1svNV = tilesort_spu.swap ? crPackVertexAttribs1svNVSWAP : crPackVertexAttribs1svNV; t->VertexAttribs2dvNV = tilesort_spu.swap ? crPackVertexAttribs2dvNVSWAP : crPackVertexAttribs2dvNV; t->VertexAttribs2fvNV = tilesort_spu.swap ? crPackVertexAttribs2fvNVSWAP : crPackVertexAttribs2fvNV; t->VertexAttribs2svNV = tilesort_spu.swap ? crPackVertexAttribs2svNVSWAP : crPackVertexAttribs2svNV; t->VertexAttribs3dvNV = tilesort_spu.swap ? crPackVertexAttribs3dvNVSWAP : crPackVertexAttribs3dvNV; t->VertexAttribs3fvNV = tilesort_spu.swap ? crPackVertexAttribs3fvNVSWAP : crPackVertexAttribs3fvNV; t->VertexAttribs3svNV = tilesort_spu.swap ? crPackVertexAttribs3svNVSWAP : crPackVertexAttribs3svNV; t->VertexAttribs4dvNV = tilesort_spu.swap ? crPackVertexAttribs4dvNVSWAP : crPackVertexAttribs4dvNV; t->VertexAttribs4fvNV = tilesort_spu.swap ? crPackVertexAttribs4fvNVSWAP : crPackVertexAttribs4fvNV; t->VertexAttribs4svNV = tilesort_spu.swap ? crPackVertexAttribs4svNVSWAP : crPackVertexAttribs4svNV; t->VertexAttribs4ubvNV = tilesort_spu.swap ? crPackVertexAttribs4ubvNVSWAP : crPackVertexAttribs4ubvNV; t->VertexPointer = crStateVertexPointer; t->Viewport = tilesortspu_Viewport; t->WindowCreate = tilesortspu_WindowCreate; t->WindowDestroy = tilesortspu_WindowDestroy; t->WindowPos2dARB = tilesort_spu.swap ? crPackWindowPos2dARBSWAP : crPackWindowPos2dARB; t->WindowPos2dvARB = tilesort_spu.swap ? crPackWindowPos2dvARBSWAP : crPackWindowPos2dvARB; t->WindowPos2fARB = tilesort_spu.swap ? crPackWindowPos2fARBSWAP : crPackWindowPos2fARB; t->WindowPos2fvARB = tilesort_spu.swap ? crPackWindowPos2fvARBSWAP : crPackWindowPos2fvARB; t->WindowPos2iARB = tilesort_spu.swap ? crPackWindowPos2iARBSWAP : crPackWindowPos2iARB; t->WindowPos2ivARB = tilesort_spu.swap ? crPackWindowPos2ivARBSWAP : crPackWindowPos2ivARB; t->WindowPos2sARB = tilesort_spu.swap ? crPackWindowPos2sARBSWAP : crPackWindowPos2sARB; t->WindowPos2svARB = tilesort_spu.swap ? crPackWindowPos2svARBSWAP : crPackWindowPos2svARB; t->WindowPos3dARB = tilesort_spu.swap ? crPackWindowPos3dARBSWAP : crPackWindowPos3dARB; t->WindowPos3dvARB = tilesort_spu.swap ? crPackWindowPos3dvARBSWAP : crPackWindowPos3dvARB; t->WindowPos3fARB = tilesort_spu.swap ? crPackWindowPos3fARBSWAP : crPackWindowPos3fARB; t->WindowPos3fvARB = tilesort_spu.swap ? crPackWindowPos3fvARBSWAP : crPackWindowPos3fvARB; t->WindowPos3iARB = tilesort_spu.swap ? crPackWindowPos3iARBSWAP : crPackWindowPos3iARB; t->WindowPos3ivARB = tilesort_spu.swap ? crPackWindowPos3ivARBSWAP : crPackWindowPos3ivARB; t->WindowPos3sARB = tilesort_spu.swap ? crPackWindowPos3sARBSWAP : crPackWindowPos3sARB; t->WindowPos3svARB = tilesort_spu.swap ? crPackWindowPos3svARBSWAP : crPackWindowPos3svARB; t->WindowPosition = tilesortspu_WindowPosition; t->WindowShow = (WindowShowFunc_t) tilesortspu_nop; t->WindowSize = tilesortspu_WindowSize; t->Writeback = (WritebackFunc_t) tilesortspu_nop; t->ZPixCR = tilesortspu_ZPixCR; }
vpachkov/MacaronOS
Kernel/Tasking/Thread.cpp
#include "Thread.hpp" namespace Kernel::Tasking { using namespace Memory; void Thread::setup(Thread::Privilege pr) { if (!m_kernel_stack) { m_kernel_stack = (uint32_t)malloc(KERNEL_STACK_SIZE); } m_user_stack = m_process->allocate_space(USER_STACK_SIZE, Flags::Write | Flags::User | Flags::Present, Region::Mapping::Anonimous).result(); reset_stack(); reset_flags(); set_privilege(pr); } Thread* Thread::TieNewTo(Process* proc) { auto thread = new Thread(proc); proc->add_thread(thread); proc->TS().push_back(thread); return thread; } }
interonet/mercury
src/main/java/org/interonet/mercury/domain/ldm/task/LDMStartTask.java
<reponame>interonet/mercury package org.interonet.mercury.domain.ldm.task; import org.interonet.mercury.domain.core.Slice; public class LDMStartTask extends LDMTask { public LDMStartTask(Slice slice) { super(slice); } }
fancylou/o2oa
x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/authentication/ActionCheckCredential.java
<reponame>fancylou/o2oa<filename>x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/authentication/ActionCheckCredential.java<gh_stars>1-10 package com.x.organization.assemble.authentication.jaxrs.authentication; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.http.ActionResult; import com.x.base.core.http.WrapOutBoolean; import com.x.base.core.logger.Logger; import com.x.base.core.logger.LoggerFactory; class ActionCheckCredential extends ActionBase { private static Logger logger = LoggerFactory.getLogger(ActionCheckCredential.class); ActionResult<WrapOutBoolean> execute(String credential) throws Exception { ActionResult<WrapOutBoolean> result = new ActionResult<>(); try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { WrapOutBoolean wrap = new WrapOutBoolean(); wrap.setValue(this.credentialExisted(emc, credential)); result.setData(wrap); return result; } } }
Reewr/master
src/3D/Cube.hpp
#pragma once #include "../Drawable/Drawable3D.hpp" #include "../Log.hpp" #include <memory> #include <mmm.hpp> class GLCube; class btRigidBody; class btCollisionShape; struct btDefaultMotionState; class Texture; class Program; /** * @brief * This represents a Cube with Physics in the world. It can be changed * to have a certain size and weight and can also be specified to be * at a specified position */ class Cube : public Drawable3D, public Logging::Log { public: // Creates a cube of a specific size in meters. If weight is -1, // it is assumed that the cube contains water, // i.e 1m^3 (1,1,1) cube weighs 1000kg // 8m^3 (2,2,2) cube weighs 8000kg // // The position is where the box will start at Cube(const mmm::vec3& size = mmm::vec3(1.0f, 1.0f, 1.0f), int weight = -1, const mmm::vec3& position = mmm::vec3(0, 20, 0)); ~Cube(); // Update the element, physics etc void update(float deltaTime); // Draw it. Keep it separate from update void draw(std::shared_ptr<Program>& program, bool bindTexture = false); void draw(std::shared_ptr<Program>& program, mmm::vec3 offset, bool bindTexture = false); // Input handler for cube void input(const Input::Event& event); private: GLCube* mCube; std::shared_ptr<Texture> mTexture; };
liangyongxiang/vsf-all-in-one
source/component/3rd-party/btstack/raw/port/arduino/btstack_config.h
<reponame>liangyongxiang/vsf-all-in-one // // btstack_config.h for Arduino port // #ifndef BTSTACK_CONFIG_H #define BTSTACK_CONFIG_H // Port related features #define HAVE_EMBEDDED_TIME_MS // BTstack features that can be enabled #define ENABLE_BLE #define ENABLE_LE_CENTRAL #define ENABLE_LE_PERIPHERAL #define ENABLE_LOG_ERROR #define ENABLE_LOG_INFO #define ENABLE_PRINTF_HEXDUMP // BTstack configuration. buffers, sizes, ... #define HCI_ACL_PAYLOAD_SIZE 200 #define MAX_ATT_DB_SIZE 200 #define MAX_NR_GATT_CLIENTS 1 #define MAX_NR_HCI_CONNECTIONS 1 #define MAX_NR_L2CAP_CHANNELS 0 #define MAX_NR_L2CAP_SERVICES 0 #define MAX_NR_LE_DEVICE_DB_ENTRIES 1 #define MAX_NR_SM_LOOKUP_ENTRIES 3 #define MAX_NR_WHITELIST_ENTRIES 1 #endif
drone001/interviews
LeetCode/remote/perfect_squares.rb
# Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. require 'test/unit' extend Test::Unit::Assertions class Fixnum def square_sum # 1 - [1] - 1 # 2 - [1, 1] - 2 # 3 - [1, 1, 1] - 3 # 4 - [4] - 1 # 5 - [1, 4] - 2 # 6 - [2, 4] - 2 # 7 - [1, 2, 4] - 3 # 8 - [4, 4] - 2 # 9 - [1, 4, 4] - 3 # 10 - [1, 9] - 2 # 11 - [1, 1, 9] - 3 # 12 - [4, 4, 4] - 3 # 13 - [4, 9] - 2 dp = [0] for i in 1..self squares = 2 ** 0.size * 8 1.upto(i ** 0.5).each { |j| squares = [squares, dp[i - j * j] + 1].min } dp[i] = squares end return dp[self] end end assert_equal(3, 12.square_sum) assert_equal(2, 13.square_sum)
faraz891/gitlabhq
app/assets/javascripts/mirrors/ssh_mirror.js
import $ from 'jquery'; import { escape } from 'lodash'; import { deprecatedCreateFlash as Flash } from '~/flash'; import axios from '~/lib/utils/axios_utils'; import { backOff } from '~/lib/utils/common_utils'; import { __ } from '~/locale'; import AUTH_METHOD from './constants'; export default class SSHMirror { constructor(formSelector) { this.backOffRequestCounter = 0; this.$form = $(formSelector); this.$repositoryUrl = this.$form.find('.js-repo-url'); this.$knownHosts = this.$form.find('.js-known-hosts'); this.$sectionSSHHostKeys = this.$form.find('.js-ssh-host-keys-section'); this.$hostKeysInformation = this.$form.find('.js-fingerprint-ssh-info'); this.$btnDetectHostKeys = this.$form.find('.js-detect-host-keys'); this.$btnSSHHostsShowAdvanced = this.$form.find('.btn-show-advanced'); this.$dropdownAuthType = this.$form.find('.js-mirror-auth-type'); this.$hiddenAuthType = this.$form.find('.js-hidden-mirror-auth-type'); this.$wellPasswordAuth = this.$form.find('.js-well-password-auth'); } init() { this.handleRepositoryUrlInput(true); this.$repositoryUrl.on('keyup', () => this.handleRepositoryUrlInput()); this.$knownHosts.on('keyup', (e) => this.handleSSHKnownHostsInput(e)); this.$dropdownAuthType.on('change', (e) => this.handleAuthTypeChange(e)); this.$btnDetectHostKeys.on('click', (e) => this.handleDetectHostKeys(e)); this.$btnSSHHostsShowAdvanced.on('click', (e) => this.handleSSHHostsAdvanced(e)); } /** * Method to monitor Git Repository URL input */ handleRepositoryUrlInput(forceMatch) { const protocol = this.$repositoryUrl.val().split('://')[0]; const protRegEx = /http|git/; // Validate URL and verify if it consists only supported protocols if (forceMatch || this.$form.get(0).checkValidity()) { const isSsh = protocol === 'ssh'; // Hide/Show SSH Host keys section only for SSH URLs this.$sectionSSHHostKeys.collapse(isSsh ? 'show' : 'hide'); this.$btnDetectHostKeys.enable(); // Verify if URL is http, https or git and hide/show Auth type dropdown // as we don't support auth type SSH for non-SSH URLs const matchesProtocol = protRegEx.test(protocol); this.$dropdownAuthType.attr('disabled', matchesProtocol); if (forceMatch && isSsh) { this.$dropdownAuthType.val(AUTH_METHOD.SSH); this.toggleAuthWell(AUTH_METHOD.SSH); } else { this.$dropdownAuthType.val(AUTH_METHOD.PASSWORD); this.toggleAuthWell(AUTH_METHOD.PASSWORD); } } } /** * Click event handler to detect SSH Host key and fingerprints from * provided Git Repository URL. */ handleDetectHostKeys() { const projectMirrorSSHEndpoint = this.$form.data('project-mirror-ssh-endpoint'); const repositoryUrl = this.$repositoryUrl.val(); const currentKnownHosts = this.$knownHosts.val(); const $btnLoadSpinner = this.$btnDetectHostKeys.find('.js-spinner'); // Disable button while we make request this.$btnDetectHostKeys.disable(); $btnLoadSpinner.removeClass('d-none'); // Make backOff polling to get data backOff((next, stop) => { axios .get( `${projectMirrorSSHEndpoint}?ssh_url=${repositoryUrl}&compare_host_keys=${encodeURIComponent( currentKnownHosts, )}`, ) .then(({ data, status }) => { if (status === 204) { this.backOffRequestCounter += 1; if (this.backOffRequestCounter < 3) { next(); } else { stop(data); } } else { stop(data); } }) .catch(stop); }) .then((res) => { $btnLoadSpinner.addClass('d-none'); // Once data is received, we show verification info along with Host keys and fingerprints this.$hostKeysInformation .find('.js-fingerprint-verification') .collapse(res.host_keys_changed ? 'hide' : 'show'); if (res.known_hosts && res.fingerprints) { this.showSSHInformation(res); } }) .catch(({ response }) => { // Show failure message when there's an error and re-enable Detect host keys button const failureMessage = response.data ? response.data.message : __('An error occurred while detecting host keys'); Flash(failureMessage); $btnLoadSpinner.addClass('hidden'); this.$btnDetectHostKeys.enable(); }); } /** * Method to monitor known hosts textarea input */ handleSSHKnownHostsInput() { // Strike-out fingerprints and remove verification info if `known hosts` value is altered this.$hostKeysInformation.find('.js-fingerprints-list').addClass('invalidate'); this.$hostKeysInformation.find('.js-fingerprint-verification').collapse('hide'); } /** * Click event handler for `Show advanced` button under SSH Host keys section */ handleSSHHostsAdvanced() { const $knownHost = this.$sectionSSHHostKeys.find('.js-ssh-known-hosts'); const toggleShowAdvanced = $knownHost.hasClass('show'); $knownHost.collapse('toggle'); this.$btnSSHHostsShowAdvanced.toggleClass('show-advanced', toggleShowAdvanced); } /** * Authentication method dropdown change event listener */ handleAuthTypeChange() { const selectedAuthType = this.$dropdownAuthType.val(); this.$wellPasswordAuth.collapse('hide'); this.updateHiddenAuthType(selectedAuthType); this.toggleAuthWell(selectedAuthType); } /** * Method to parse SSH Host keys data and render it * under SSH host keys section */ showSSHInformation(sshHostKeys) { const $fingerprintsList = this.$hostKeysInformation.find('.js-fingerprints-list'); let fingerprints = ''; sshHostKeys.fingerprints.forEach((fingerprint) => { const escFingerprints = escape(fingerprint.fingerprint); fingerprints += `<code>${escFingerprints}</code>`; }); this.$hostKeysInformation.collapse('show'); $fingerprintsList.removeClass('invalidate'); $fingerprintsList.html(fingerprints); this.$sectionSSHHostKeys.find('.js-known-hosts').val(sshHostKeys.known_hosts); } /** * Toggle Auth type information container based on provided `authType` */ toggleAuthWell(authType) { this.$wellPasswordAuth.collapse(authType === AUTH_METHOD.PASSWORD ? 'show' : 'hide'); this.updateHiddenAuthType(authType); } updateHiddenAuthType(authType) { this.$hiddenAuthType.val(authType); this.$hiddenAuthType.prop('disabled', authType === AUTH_METHOD.SSH); } destroy() { // eslint-disable-next-line @gitlab/no-global-event-off this.$repositoryUrl.off('keyup'); // eslint-disable-next-line @gitlab/no-global-event-off this.$form.find('.js-known-hosts').off('keyup'); // eslint-disable-next-line @gitlab/no-global-event-off this.$dropdownAuthType.off('change'); // eslint-disable-next-line @gitlab/no-global-event-off this.$btnDetectHostKeys.off('click'); // eslint-disable-next-line @gitlab/no-global-event-off this.$btnSSHHostsShowAdvanced.off('click'); } }
excess-project/concurrent-tree-library
common/bench.h
<filename>common/bench.h /* bench.h This is part of the tree library Copyright 2015 <NAME> (UiT the Arctic University of Norway) 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. */ #ifndef bench_h #define bench_h #ifdef SVEB //Static implicit veb #include "../SVEB/staticvebtree.h" #define data_t domain* #define BENCH_SEARCH(root, x) search_test(x) #define BENCH_DELETE(root, x) delete_node(x) #define BENCH_INSERT(root, x) insert(x) #endif #ifdef VEB //Static pointer veb #include "../VEB/veb.h" #define data_t struct node* #define BENCH_SEARCH(root, x) smart_it_search(root, x) #define BENCH_DELETE(root, x) smart_it_search(root, x) #define BENCH_INSERT(root, x) searchNode(root, x) #endif #ifdef BSTTK //Portably scalable tree (ASPLOS'15) #include "../BSTTK/bst_tk.h" #define data_t intset_t* #define BENCH_SEARCH(root, x) bst_tk_find(root, x) #define BENCH_DELETE(root, x) bst_tk_delete(root, x) #define BENCH_INSERT(root, x) bst_tk_insert(root, x, NULL) #endif #ifdef CBTREE //Concurrent B+tree (Blink) #include "../CBTree/common.h" #define data_t node** #define BENCH_SEARCH(root, x) search_par(*root, x) #define BENCH_DELETE(root, x) delete_par(*root, x) #define BENCH_INSERT(root, x) insert_par(root, x, 1) #endif #ifdef DTREE #include "../DeltaTree/dtree.h" #define data_t struct global* #define BENCH_SEARCH(root, x) deltatree_contains(root, x) #define BENCH_DELETE(root, x) deltatree_delete(root, x) #define BENCH_INSERT(root, x) deltatree_insert(root, x, NULL) #endif #ifdef GBST #include "../GreenBST/gbst.h" #define data_t struct global* #define BENCH_SEARCH(root, x) greenbst_contains(root, x) #define BENCH_DELETE(root, x) greenbst_delete(root, x) #define BENCH_INSERT(root, x) greenbst_insert(root, x, NULL) #endif #ifdef BBST #include "../BlueBST/tree.h" #define data_t struct global* #define BENCH_SEARCH(root, x) searchNode(root, x) #define BENCH_DELETE(root, x) deleteNode(root, x) #define BENCH_INSERT(root, x) insertNode(root, x) #endif #ifdef LFBST #include "../LFBST/wfrbt.h" #include "../LFBST/operations.h" #define data_t thread_data_t* #define BENCH_SEARCH(root, x) search(root, x) #define BENCH_DELETE(root, x) delete_node(root, x) #define BENCH_INSERT(root, x) insert(root, x) #endif #ifdef RCUT #include "../citrus/citrus.h" #include "../citrus/urcu.h" #define data_t node #define BENCH_SEARCH(root, x) contains(root, x) #define BENCH_DELETE(root, x) delete_node(root, x) #define BENCH_INSERT(root, x) insert(root, x, NULL) #endif void start_benchmark(data_t, int, int , int, int); void testseq(data_t, int); void testpar(data_t, int, int, int); #endif
SaladDais/LLUDP-Encryption
indra/llcommon/llmemory.cpp
<filename>indra/llcommon/llmemory.cpp<gh_stars>1-10 /** * @file llmemory.cpp * @brief Very special memory allocation/deallocation stuff here * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #include "linden_common.h" #include "llthread.h" #if defined(LL_WINDOWS) # include <psapi.h> #elif defined(LL_DARWIN) # include <sys/types.h> # include <mach/task.h> # include <mach/mach_init.h> #elif LL_LINUX || LL_SOLARIS # include <unistd.h> #endif #include "llmemory.h" #include "llsys.h" #include "llframetimer.h" #include "lltrace.h" #include "llerror.h" //---------------------------------------------------------------------------- //static U32Kilobytes LLMemory::sAvailPhysicalMemInKB(U32_MAX); U32Kilobytes LLMemory::sMaxPhysicalMemInKB(0); static LLTrace::SampleStatHandle<F64Megabytes> sAllocatedMem("allocated_mem", "active memory in use by application"); static LLTrace::SampleStatHandle<F64Megabytes> sVirtualMem("virtual_mem", "virtual memory assigned to application"); U32Kilobytes LLMemory::sAllocatedMemInKB(0); U32Kilobytes LLMemory::sAllocatedPageSizeInKB(0); U32Kilobytes LLMemory::sMaxHeapSizeInKB(U32_MAX); BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE; void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) { #if defined(LL_WINDOWS) && defined(LL_DEBUG_BUFFER_OVERRUN) //do not check return; #else #ifdef SHOW_ASSERT // Redundant, place to set breakpoints. if (ptr%alignment!=0) { LL_WARNS() << "alignment check failed" << LL_ENDL; } llassert(ptr%alignment==0); #endif #endif } //static void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure) { sMaxHeapSizeInKB = U32Kilobytes::convert(max_heap_size); sEnableMemoryFailurePrevention = prevent_heap_failure ; } //static void LLMemory::updateMemoryInfo() { #if LL_WINDOWS PROCESS_MEMORY_COUNTERS counters; if (!GetProcessMemoryInfo(GetCurrentProcess(), &counters, sizeof(counters))) { LL_WARNS() << "GetProcessMemoryInfo failed" << LL_ENDL; return ; } sAllocatedMemInKB = U32Kilobytes::convert(U64Bytes(counters.WorkingSetSize)); sample(sAllocatedMem, sAllocatedMemInKB); sAllocatedPageSizeInKB = U32Kilobytes::convert(U64Bytes(counters.PagefileUsage)); sample(sVirtualMem, sAllocatedPageSizeInKB); U32Kilobytes avail_phys, avail_virtual; LLMemoryInfo::getAvailableMemoryKB(avail_phys, avail_virtual) ; sMaxPhysicalMemInKB = llmin(avail_phys + sAllocatedMemInKB, sMaxHeapSizeInKB); if(sMaxPhysicalMemInKB > sAllocatedMemInKB) { sAvailPhysicalMemInKB = sMaxPhysicalMemInKB - sAllocatedMemInKB ; } else { sAvailPhysicalMemInKB = U32Kilobytes(0); } #else //not valid for other systems for now. sAllocatedMemInKB = U64Bytes(LLMemory::getCurrentRSS()); sMaxPhysicalMemInKB = U64Bytes(U32_MAX); sAvailPhysicalMemInKB = U64Bytes(U32_MAX); #endif return ; } // //this function is to test if there is enough space with the size in the virtual address space. //it does not do any real allocation //if success, it returns the address where the memory chunk can fit in; //otherwise it returns NULL. // //static void* LLMemory::tryToAlloc(void* address, U32 size) { #if LL_WINDOWS address = VirtualAlloc(address, size, MEM_RESERVE | MEM_TOP_DOWN, PAGE_NOACCESS) ; if(address) { if(!VirtualFree(address, 0, MEM_RELEASE)) { LL_ERRS() << "error happens when free some memory reservation." << LL_ENDL ; } } return address ; #else return (void*)0x01 ; //skip checking #endif } //static void LLMemory::logMemoryInfo(BOOL update) { if(update) { updateMemoryInfo() ; } LL_INFOS() << "Current allocated physical memory(KB): " << sAllocatedMemInKB << LL_ENDL ; LL_INFOS() << "Current allocated page size (KB): " << sAllocatedPageSizeInKB << LL_ENDL ; LL_INFOS() << "Current available physical memory(KB): " << sAvailPhysicalMemInKB << LL_ENDL ; LL_INFOS() << "Current max usable memory(KB): " << sMaxPhysicalMemInKB << LL_ENDL ; } //return 0: everything is normal; //return 1: the memory pool is low, but not in danger; //return -1: the memory pool is in danger, is about to crash. //static bool LLMemory::isMemoryPoolLow() { static const U32Megabytes LOW_MEMORY_POOL_THRESHOLD(64); const static U32Megabytes MAX_SIZE_CHECKED_MEMORY_BLOCK(64); static void* last_reserved_address = NULL ; if(!sEnableMemoryFailurePrevention) { return false ; //no memory failure prevention. } if(sAvailPhysicalMemInKB < (LOW_MEMORY_POOL_THRESHOLD / 4)) //out of physical memory { return true ; } if(sAllocatedPageSizeInKB + (LOW_MEMORY_POOL_THRESHOLD / 4) > sMaxHeapSizeInKB) //out of virtual address space. { return true ; } bool is_low = (S32)(sAvailPhysicalMemInKB < LOW_MEMORY_POOL_THRESHOLD || sAllocatedPageSizeInKB + LOW_MEMORY_POOL_THRESHOLD > sMaxHeapSizeInKB) ; //check the virtual address space fragmentation if(!is_low) { if(!last_reserved_address) { last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; } else { last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; if(!last_reserved_address) //failed, try once more { last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; } } is_low = !last_reserved_address ; //allocation failed } return is_low ; } //static U32Kilobytes LLMemory::getAvailableMemKB() { return sAvailPhysicalMemInKB ; } //static U32Kilobytes LLMemory::getMaxMemKB() { return sMaxPhysicalMemInKB ; } //static U32Kilobytes LLMemory::getAllocatedMemKB() { return sAllocatedMemInKB ; } //---------------------------------------------------------------------------- #if defined(LL_WINDOWS) //static U64 LLMemory::getCurrentRSS() { PROCESS_MEMORY_COUNTERS counters; if (!GetProcessMemoryInfo(GetCurrentProcess(), &counters, sizeof(counters))) { LL_WARNS() << "GetProcessMemoryInfo failed" << LL_ENDL; return 0; } return counters.WorkingSetSize; } #elif defined(LL_DARWIN) // if (sysctl(ctl, 2, &page_size, &size, NULL, 0) == -1) // { // LL_WARNS() << "Couldn't get page size" << LL_ENDL; // return 0; // } else { // return page_size; // } // } U64 LLMemory::getCurrentRSS() { U64 residentSize = 0; mach_task_basic_info_data_t basicInfo; mach_msg_type_number_t basicInfoCount = MACH_TASK_BASIC_INFO_COUNT; if (task_info(mach_task_self(), MACH_TASK_BASIC_INFO, (task_info_t)&basicInfo, &basicInfoCount) == KERN_SUCCESS) { // residentSize = basicInfo.resident_size; // Although this method is defined to return the "resident set size," // in fact what callers want from it is the total virtual memory // consumed by the application. residentSize = basicInfo.virtual_size; } else { LL_WARNS() << "task_info failed" << LL_ENDL; } return residentSize; } #elif defined(LL_LINUX) U64 LLMemory::getCurrentRSS() { static const char statPath[] = "/proc/self/stat"; LLFILE *fp = LLFile::fopen(statPath, "r"); U64 rss = 0; if (fp == NULL) { LL_WARNS() << "couldn't open " << statPath << LL_ENDL; return 0; } // Eee-yew! See Documentation/filesystems/proc.txt in your // nearest friendly kernel tree for details. { int ret = fscanf(fp, "%*d (%*[^)]) %*c %*d %*d %*d %*d %*d %*d %*d " "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %Lu", &rss); if (ret != 1) { LL_WARNS() << "couldn't parse contents of " << statPath << LL_ENDL; rss = 0; } } fclose(fp); return rss; } #elif LL_SOLARIS #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #define _STRUCTURED_PROC 1 #include <sys/procfs.h> U64 LLMemory::getCurrentRSS() { char path [LL_MAX_PATH]; /* Flawfinder: ignore */ sprintf(path, "/proc/%d/psinfo", (int)getpid()); int proc_fd = -1; if((proc_fd = open(path, O_RDONLY)) == -1){ LL_WARNS() << "LLmemory::getCurrentRSS() unable to open " << path << ". Returning 0 RSS!" << LL_ENDL; return 0; } psinfo_t proc_psinfo; if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ LL_WARNS() << "LLmemory::getCurrentRSS() Unable to read from " << path << ". Returning 0 RSS!" << LL_ENDL; close(proc_fd); return 0; } close(proc_fd); return((U64)proc_psinfo.pr_rssize * 1024); } #else U64 LLMemory::getCurrentRSS() { return 0; } #endif //-------------------------------------------------------------------- #if defined(LL_WINDOWS) && defined(LL_DEBUG_BUFFER_OVERRUN) #include <map> struct mem_info { std::map<void*, void*> memory_info; LLMutex mutex; static mem_info& get() { static mem_info instance; return instance; } private: mem_info(){} }; void* ll_aligned_malloc_fallback( size_t size, int align ) { SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); unsigned int for_alloc = (size/sysinfo.dwPageSize + !!(size%sysinfo.dwPageSize)) * sysinfo.dwPageSize; void *p = VirtualAlloc(NULL, for_alloc+sysinfo.dwPageSize, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); if(NULL == p) { // call debugger __asm int 3; } DWORD old; BOOL Res = VirtualProtect((void*)((char*)p + for_alloc), sysinfo.dwPageSize, PAGE_NOACCESS, &old); if(FALSE == Res) { // call debugger __asm int 3; } void* ret = (void*)((char*)p + for_alloc-size); { LLMutexLock lock(&mem_info::get().mutex); mem_info::get().memory_info.insert(std::pair<void*, void*>(ret, p)); } return ret; } void ll_aligned_free_fallback( void* ptr ) { LLMutexLock lock(&mem_info::get().mutex); VirtualFree(mem_info::get().memory_info.find(ptr)->second, 0, MEM_RELEASE); mem_info::get().memory_info.erase(ptr); } #endif
GwonsooLee/kubenx
pkg/utils/common.go
package utils import ( "fmt" "github.com/AlecAivazis/survey/v2" "github.com/fatih/color" "github.com/olekukonko/tablewriter" "os" "reflect" "strconv" "unsafe" ) var ( ALL_NAMESPACE = "" NO_STRING = "" DEFAULT_NODE_LABEL_FILTERS = []string{"app", "env"} //STATIS VALUE KUBENX_HOMEDIR = ".kubenx" SSH_DEFAULT_PATH = "ssh" TARGET_DEFAULT_PORT = "22" AWS_IAM_ANNOTATION = "eks.amazonaws.com/role-arn" AUTH_API_VERSION = "client.authentication.k8s.io/v1alpha1" AUTH_COMMAND = "aws" //Color Definition Red = color.New(color.FgRed).PrintlnFunc() Blue = color.New(color.FgBlue).PrintlnFunc() Green = color.New(color.FgGreen).PrintlnFunc() Yellow = color.New(color.FgYellow).PrintlnFunc() Cyan = color.New(color.FgCyan).PrintlnFunc() //OPEN_ID_CA_FINGERPRINT CA_FINGERPRINT = "9e99a48a9960b14926bb7f3b02e22da2b0ab7280" //Error Message NO_FILE_EXCEPTION = "No file exists... Please check the file path" ) //Figure out if string is in array func IsStringInArray(s string, arr []string) bool { for _, a := range arr { if a == s { return true } } return false } // Get Table func GetTableObject() *tablewriter.Table { table := tablewriter.NewWriter(os.Stdout) table.SetAutoWrapText(false) table.SetAutoFormatHeaders(true) table.SetHeaderAlignment(tablewriter.ALIGN_LEFT) table.SetAlignment(tablewriter.ALIGN_LEFT) table.SetCenterSeparator("") table.SetColumnSeparator("") table.SetRowSeparator("") table.SetHeaderLine(false) table.SetBorder(false) table.SetTablePadding("\t") return table } //Convert Int32 to String func _int32_to_string(num int32) string { return strconv.FormatInt(int64(num), 10) } //Convert int to string func StringToInt(s string) int { n, err := strconv.Atoi(s) if err != nil { Red(err) os.Exit(1) } return n } //Get only one input from user func GetSingleStringInput(message string) (string, error) { var ret string prompt := &survey.Input{ Message: fmt.Sprintf("%s:", message), } survey.AskOne(prompt, &ret) if ret == "" { return NO_STRING, fmt.Errorf("Choice has been canceled") } return ret, nil } func BytesToString(bytes []byte) (s string) { hdr := *(*reflect.SliceHeader)(unsafe.Pointer(&bytes)) return *(*string)(unsafe.Pointer(&reflect.StringHeader{ Data: hdr.Data, Len: hdr.Len, })) } func StringToBytes(str string) []byte { hdr := *(*reflect.StringHeader)(unsafe.Pointer(&str)) return *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ Data: hdr.Data, Len: hdr.Len, Cap: hdr.Len, })) }
google-ar/chromium
third_party/WebKit/Source/platform/exported/WebURLRequest.cpp
/* * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "public/platform/WebURLRequest.h" #include "platform/RuntimeEnabledFeatures.h" #include "platform/network/ResourceRequest.h" #include "public/platform/WebCachePolicy.h" #include "public/platform/WebHTTPBody.h" #include "public/platform/WebHTTPHeaderVisitor.h" #include "public/platform/WebSecurityOrigin.h" #include "public/platform/WebURL.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" #include "wtf/PtrUtil.h" #include <memory> namespace blink { namespace { class ExtraDataContainer : public ResourceRequest::ExtraData { public: static PassRefPtr<ExtraDataContainer> create( WebURLRequest::ExtraData* extraData) { return adoptRef(new ExtraDataContainer(extraData)); } ~ExtraDataContainer() override {} WebURLRequest::ExtraData* getExtraData() const { return m_extraData.get(); } private: explicit ExtraDataContainer(WebURLRequest::ExtraData* extraData) : m_extraData(WTF::wrapUnique(extraData)) {} std::unique_ptr<WebURLRequest::ExtraData> m_extraData; }; } // namespace // The purpose of this struct is to permit allocating a ResourceRequest on the // heap, which is otherwise disallowed by DISALLOW_NEW_EXCEPT_PLACEMENT_NEW // annotation on ResourceRequest. struct WebURLRequest::ResourceRequestContainer { ResourceRequestContainer() {} explicit ResourceRequestContainer(const ResourceRequest& r) : resourceRequest(r) {} ResourceRequest resourceRequest; }; WebURLRequest::~WebURLRequest() {} WebURLRequest::WebURLRequest() : m_ownedResourceRequest(new ResourceRequestContainer()), m_resourceRequest(&m_ownedResourceRequest->resourceRequest) {} WebURLRequest::WebURLRequest(const WebURLRequest& r) : m_ownedResourceRequest( new ResourceRequestContainer(*r.m_resourceRequest)), m_resourceRequest(&m_ownedResourceRequest->resourceRequest) {} WebURLRequest::WebURLRequest(const WebURL& url) : WebURLRequest() { setURL(url); } WebURLRequest& WebURLRequest::operator=(const WebURLRequest& r) { // Copying subclasses that have different m_resourceRequest ownership // semantics via this operator is just not supported. DCHECK(m_ownedResourceRequest); DCHECK(m_resourceRequest); if (&r != this) *m_resourceRequest = *r.m_resourceRequest; return *this; } bool WebURLRequest::isNull() const { return m_resourceRequest->isNull(); } WebURL WebURLRequest::url() const { return m_resourceRequest->url(); } void WebURLRequest::setURL(const WebURL& url) { m_resourceRequest->setURL(url); } WebURL WebURLRequest::firstPartyForCookies() const { return m_resourceRequest->firstPartyForCookies(); } void WebURLRequest::setFirstPartyForCookies( const WebURL& firstPartyForCookies) { m_resourceRequest->setFirstPartyForCookies(firstPartyForCookies); } WebSecurityOrigin WebURLRequest::requestorOrigin() const { return m_resourceRequest->requestorOrigin(); } void WebURLRequest::setRequestorOrigin( const WebSecurityOrigin& requestorOrigin) { m_resourceRequest->setRequestorOrigin(requestorOrigin); } bool WebURLRequest::allowStoredCredentials() const { return m_resourceRequest->allowStoredCredentials(); } void WebURLRequest::setAllowStoredCredentials(bool allowStoredCredentials) { m_resourceRequest->setAllowStoredCredentials(allowStoredCredentials); } WebCachePolicy WebURLRequest::getCachePolicy() const { return m_resourceRequest->getCachePolicy(); } void WebURLRequest::setCachePolicy(WebCachePolicy cachePolicy) { m_resourceRequest->setCachePolicy(cachePolicy); } WebString WebURLRequest::httpMethod() const { return m_resourceRequest->httpMethod(); } void WebURLRequest::setHTTPMethod(const WebString& httpMethod) { m_resourceRequest->setHTTPMethod(httpMethod); } WebString WebURLRequest::httpHeaderField(const WebString& name) const { return m_resourceRequest->httpHeaderField(name); } void WebURLRequest::setHTTPHeaderField(const WebString& name, const WebString& value) { RELEASE_ASSERT(!equalIgnoringCase(name, "referer")); m_resourceRequest->setHTTPHeaderField(name, value); } void WebURLRequest::setHTTPReferrer(const WebString& webReferrer, WebReferrerPolicy referrerPolicy) { // WebString doesn't have the distinction between empty and null. We use // the null WTFString for referrer. ASSERT(Referrer::noReferrer() == String()); String referrer = webReferrer.isEmpty() ? Referrer::noReferrer() : String(webReferrer); m_resourceRequest->setHTTPReferrer( Referrer(referrer, static_cast<ReferrerPolicy>(referrerPolicy))); } void WebURLRequest::addHTTPHeaderField(const WebString& name, const WebString& value) { m_resourceRequest->addHTTPHeaderField(name, value); } void WebURLRequest::clearHTTPHeaderField(const WebString& name) { m_resourceRequest->clearHTTPHeaderField(name); } void WebURLRequest::visitHTTPHeaderFields(WebHTTPHeaderVisitor* visitor) const { const HTTPHeaderMap& map = m_resourceRequest->httpHeaderFields(); for (HTTPHeaderMap::const_iterator it = map.begin(); it != map.end(); ++it) visitor->visitHeader(it->key, it->value); } WebHTTPBody WebURLRequest::httpBody() const { // TODO(mkwst): This is wrong, as it means that we're producing the body // before any ServiceWorker has a chance to operate, which means we're // revealing data to the SW that we ought to be hiding. Baby steps. // https://crbug.com/599597 if (m_resourceRequest->attachedCredential()) return WebHTTPBody(m_resourceRequest->attachedCredential()); return WebHTTPBody(m_resourceRequest->httpBody()); } void WebURLRequest::setHTTPBody(const WebHTTPBody& httpBody) { m_resourceRequest->setHTTPBody(httpBody); } WebHTTPBody WebURLRequest::attachedCredential() const { return WebHTTPBody(m_resourceRequest->attachedCredential()); } void WebURLRequest::setAttachedCredential( const WebHTTPBody& attachedCredential) { m_resourceRequest->setAttachedCredential(attachedCredential); } bool WebURLRequest::reportUploadProgress() const { return m_resourceRequest->reportUploadProgress(); } void WebURLRequest::setReportUploadProgress(bool reportUploadProgress) { m_resourceRequest->setReportUploadProgress(reportUploadProgress); } void WebURLRequest::setReportRawHeaders(bool reportRawHeaders) { m_resourceRequest->setReportRawHeaders(reportRawHeaders); } bool WebURLRequest::reportRawHeaders() const { return m_resourceRequest->reportRawHeaders(); } WebURLRequest::RequestContext WebURLRequest::getRequestContext() const { return m_resourceRequest->requestContext(); } WebURLRequest::FrameType WebURLRequest::getFrameType() const { return m_resourceRequest->frameType(); } WebReferrerPolicy WebURLRequest::getReferrerPolicy() const { return static_cast<WebReferrerPolicy>(m_resourceRequest->getReferrerPolicy()); } void WebURLRequest::addHTTPOriginIfNeeded(const WebSecurityOrigin& origin) { m_resourceRequest->addHTTPOriginIfNeeded(origin.get()); } bool WebURLRequest::hasUserGesture() const { return m_resourceRequest->hasUserGesture(); } void WebURLRequest::setHasUserGesture(bool hasUserGesture) { m_resourceRequest->setHasUserGesture(hasUserGesture); } void WebURLRequest::setRequestContext(RequestContext requestContext) { m_resourceRequest->setRequestContext(requestContext); } void WebURLRequest::setFrameType(FrameType frameType) { m_resourceRequest->setFrameType(frameType); } int WebURLRequest::requestorID() const { return m_resourceRequest->requestorID(); } void WebURLRequest::setRequestorID(int requestorID) { m_resourceRequest->setRequestorID(requestorID); } int WebURLRequest::requestorProcessID() const { return m_resourceRequest->requestorProcessID(); } void WebURLRequest::setRequestorProcessID(int requestorProcessID) { m_resourceRequest->setRequestorProcessID(requestorProcessID); } int WebURLRequest::appCacheHostID() const { return m_resourceRequest->appCacheHostID(); } void WebURLRequest::setAppCacheHostID(int appCacheHostID) { m_resourceRequest->setAppCacheHostID(appCacheHostID); } bool WebURLRequest::downloadToFile() const { return m_resourceRequest->downloadToFile(); } void WebURLRequest::setDownloadToFile(bool downloadToFile) { m_resourceRequest->setDownloadToFile(downloadToFile); } bool WebURLRequest::useStreamOnResponse() const { return m_resourceRequest->useStreamOnResponse(); } void WebURLRequest::setUseStreamOnResponse(bool useStreamOnResponse) { m_resourceRequest->setUseStreamOnResponse(useStreamOnResponse); } WebURLRequest::SkipServiceWorker WebURLRequest::skipServiceWorker() const { return m_resourceRequest->skipServiceWorker(); } void WebURLRequest::setSkipServiceWorker( WebURLRequest::SkipServiceWorker skipServiceWorker) { m_resourceRequest->setSkipServiceWorker(skipServiceWorker); } bool WebURLRequest::shouldResetAppCache() const { return m_resourceRequest->shouldResetAppCache(); } void WebURLRequest::setShouldResetAppCache(bool setShouldResetAppCache) { m_resourceRequest->setShouldResetAppCache(setShouldResetAppCache); } WebURLRequest::FetchRequestMode WebURLRequest::getFetchRequestMode() const { return m_resourceRequest->fetchRequestMode(); } void WebURLRequest::setFetchRequestMode(WebURLRequest::FetchRequestMode mode) { return m_resourceRequest->setFetchRequestMode(mode); } WebURLRequest::FetchCredentialsMode WebURLRequest::getFetchCredentialsMode() const { return m_resourceRequest->fetchCredentialsMode(); } void WebURLRequest::setFetchCredentialsMode( WebURLRequest::FetchCredentialsMode mode) { return m_resourceRequest->setFetchCredentialsMode(mode); } WebURLRequest::FetchRedirectMode WebURLRequest::getFetchRedirectMode() const { return m_resourceRequest->fetchRedirectMode(); } void WebURLRequest::setFetchRedirectMode( WebURLRequest::FetchRedirectMode redirect) { return m_resourceRequest->setFetchRedirectMode(redirect); } WebURLRequest::PreviewsState WebURLRequest::getPreviewsState() const { return m_resourceRequest->previewsState(); } void WebURLRequest::setPreviewsState( WebURLRequest::PreviewsState previewsState) { return m_resourceRequest->setPreviewsState(previewsState); } WebURLRequest::ExtraData* WebURLRequest::getExtraData() const { RefPtr<ResourceRequest::ExtraData> data = m_resourceRequest->getExtraData(); if (!data) return 0; return static_cast<ExtraDataContainer*>(data.get())->getExtraData(); } void WebURLRequest::setExtraData(WebURLRequest::ExtraData* extraData) { m_resourceRequest->setExtraData(ExtraDataContainer::create(extraData)); } ResourceRequest& WebURLRequest::toMutableResourceRequest() { DCHECK(m_resourceRequest); return *m_resourceRequest; } WebURLRequest::Priority WebURLRequest::getPriority() const { return static_cast<WebURLRequest::Priority>(m_resourceRequest->priority()); } void WebURLRequest::setPriority(WebURLRequest::Priority priority) { m_resourceRequest->setPriority(static_cast<ResourceLoadPriority>(priority)); } bool WebURLRequest::checkForBrowserSideNavigation() const { return m_resourceRequest->checkForBrowserSideNavigation(); } void WebURLRequest::setCheckForBrowserSideNavigation(bool check) { m_resourceRequest->setCheckForBrowserSideNavigation(check); } double WebURLRequest::uiStartTime() const { return m_resourceRequest->uiStartTime(); } void WebURLRequest::setUiStartTime(double timeSeconds) { m_resourceRequest->setUIStartTime(timeSeconds); } bool WebURLRequest::isExternalRequest() const { return m_resourceRequest->isExternalRequest(); } WebURLRequest::LoadingIPCType WebURLRequest::getLoadingIPCType() const { if (RuntimeEnabledFeatures::loadingWithMojoEnabled()) return WebURLRequest::LoadingIPCType::Mojo; return WebURLRequest::LoadingIPCType::ChromeIPC; } void WebURLRequest::setNavigationStartTime(double navigationStartSeconds) { m_resourceRequest->setNavigationStartTime(navigationStartSeconds); } WebURLRequest::InputToLoadPerfMetricReportPolicy WebURLRequest::inputPerfMetricReportPolicy() const { return static_cast<WebURLRequest::InputToLoadPerfMetricReportPolicy>( m_resourceRequest->inputPerfMetricReportPolicy()); } void WebURLRequest::setInputPerfMetricReportPolicy( WebURLRequest::InputToLoadPerfMetricReportPolicy policy) { m_resourceRequest->setInputPerfMetricReportPolicy( static_cast<blink::InputToLoadPerfMetricReportPolicy>(policy)); } const ResourceRequest& WebURLRequest::toResourceRequest() const { DCHECK(m_resourceRequest); return *m_resourceRequest; } WebURLRequest::WebURLRequest(ResourceRequest& r) : m_resourceRequest(&r) {} } // namespace blink
mingliangguo/citrus
core/citrus-base/src/test/java/com/consol/citrus/actions/TransformActionTest.java
/* * Copyright 2006-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.consol.citrus.actions; import org.testng.Assert; import org.testng.annotations.Test; import com.consol.citrus.testng.AbstractTestNGUnitTest; /** * @author <NAME> */ public class TransformActionTest extends AbstractTestNGUnitTest { @Test public void testTransform() { StringBuilder xsltDoc = new StringBuilder(); xsltDoc.append("<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n"); xsltDoc.append("<xsl:output method=\"text\"/>"); xsltDoc.append("<xsl:template match=\"/\">\n"); xsltDoc.append("Message: <xsl:value-of select=\"TestRequest/Message\"/>"); xsltDoc.append("</xsl:template>\n"); xsltDoc.append("</xsl:stylesheet>"); TransformAction transformAction = new TransformAction.Builder() .source("<TestRequest><Message>Hello World!</Message></TestRequest>") .xslt(xsltDoc.toString()) .result("var") .build(); transformAction.execute(context); Assert.assertEquals(context.getVariable("var").trim(), "Message: Hello World!"); } @Test public void testTransformResource() { TransformAction transformAction = new TransformAction.Builder() .sourceFile("classpath:com/consol/citrus/actions/test-request-payload.xml") .xsltFile("classpath:com/consol/citrus/actions/test-transform.xslt") .result("var") .build(); transformAction.execute(context); Assert.assertEquals(context.getVariable("var").trim(), "Message: Hello World!"); } }
alancnet/artifactory
web/application/src/main/java/org/artifactory/webapp/wicket/page/browse/home/ArtifactsHomePage.java
<reponame>alancnet/artifactory<filename>web/application/src/main/java/org/artifactory/webapp/wicket/page/browse/home/ArtifactsHomePage.java<gh_stars>1-10 /* * Artifactory is a binaries repository manager. * Copyright (C) 2012 JFrog Ltd. * * Artifactory is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Artifactory is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Artifactory. If not, see <http://www.gnu.org/licenses/>. */ package org.artifactory.webapp.wicket.page.browse.home; import org.apache.commons.lang.StringUtils; import org.apache.wicket.Page; import org.apache.wicket.request.handler.ComponentNotFoundException; import org.artifactory.common.wicket.util.CookieUtils; import org.artifactory.common.wicket.util.WicketUtils; import org.artifactory.util.HttpUtils; import org.artifactory.webapp.wicket.page.browse.treebrowser.BrowseRepoPage; /** * @author <NAME> */ public class ArtifactsHomePage extends Page { public ArtifactsHomePage() { setVersioned(false); setStatelessHint(true); } @Override public void renderPage() { String lastPage = CookieUtils.getCookie(RememberPageBehavior.COOKIE_NAME); if (StringUtils.isEmpty(lastPage)) { setResponsePage(BrowseRepoPage.class); } else { String serverUrl = HttpUtils.getServerUrl(WicketUtils.getHttpServletRequest()); try { WicketUtils.getWebResponse().sendRedirect(serverUrl + lastPage); } catch (ComponentNotFoundException e) { setResponsePage(BrowseRepoPage.class); } } } }
uk-gov-mirror/ministryofjustice.hmpps-book-secure-move-frontend
app/allocations/index.js
const router = require('express').Router() const { renderAsTable } = require('../../common/controllers/collection') const { redirectDefaultQuery, redirectView, setActions, setContext, setDatePagination, setDateRange, setPagination, } = require('../../common/middleware/collection') const { protectRoute } = require('../../common/middleware/permissions') const setLocation = require('../../common/middleware/set-location') const { ACTIONS, COLLECTION_PATH, DEFAULTS, FILTERS, MOUNTPATH, } = require('./constants') const { setBodyAllocations, setResultsAllocations, setFilterAllocations, } = require('./middleware') router.param('date', setDateRange) router.param('view', redirectDefaultQuery(DEFAULTS.QUERY)) router.param('locationId', setLocation) router.use(protectRoute('allocations:view')) router.get('/', (req, res) => res.redirect(`${MOUNTPATH}/outgoing`)) router.get('/:view(outgoing)', redirectView(DEFAULTS.TIME_PERIOD)) router.get( COLLECTION_PATH, setActions(ACTIONS), setContext('allocations'), setDatePagination(MOUNTPATH + COLLECTION_PATH), [ setBodyAllocations, setResultsAllocations, setFilterAllocations(FILTERS.outgoing), setPagination(MOUNTPATH + COLLECTION_PATH), ], renderAsTable ) module.exports = { router, mountpath: MOUNTPATH, }
todorm85/TelerikAcademy
Projects/HikingPlanAndRescueMobile/source/app/views/main-menu/main-menu.js
<gh_stars>0 var frameModule = require('ui/frame'); exports.pageLoaded = function(args) { var page = args.object; }; exports.myTrainings = function() { frameModule.topmost() .navigate("views/list/list"); }; exports.planTraining = function() { var topmost = frameModule.topmost(); topmost.navigate('views/prognose-training/prognose-training'); }; exports.statistics = function function_name() { var topmost = frameModule.topmost(); topmost.navigate('views/calories-statistics/calories-statistics'); };
heiseish/Competitive-Programming
kattis_done/ahocorasick.cpp
<reponame>heiseish/Competitive-Programming<filename>kattis_done/ahocorasick.cpp /** A detective who uses his deductive powers to corner a suspect, and then does nothing to stop them from committing suicide, is no better than the murderer himself. */ #include <bits/stdc++.h> #define forn(i, l, r) for(int i=l;i<=r;i++) #define all(v) v.begin(),v.end() #define pb push_back #define nd second #define st first #define debug(x) cout<<#x<<" -> "<<x<< endl #define kakimasu(x) cout << x << '\n' #define sz(x) (int)x.size() #define UNIQUE(v) (v).resize(unique(all(v)) - (v).begin()) //need to sort first b4 using unique using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<string> vs; typedef vector<double> vd; typedef vector<long long> vll; typedef vector<vector<int> > vvi; typedef vector<vll> vvll; typedef vector<pair<int, int> > vpi; typedef vector<vpi> vvpi; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<pll> vpll; const int INF = 1 << 30; /** Start coding from here */ const int K = 26; struct Vertex { int next[K]; bool leaf = false; int p = -1; char pch; int link = -1; int go[K]; Vertex(int p=-1, char ch='$') : p(p), pch(ch) { fill(begin(next), end(next), -1); fill(begin(go), end(go), -1); } }; vector<Vertex> t(1); void add_string(string const& s) { int v = 0; for (char ch : s) { int c = ch - 'a'; if (t[v].next[c] == -1) { t[v].next[c] = t.size(); t.emplace_back(v, ch); } v = t[v].next[c]; } t[v].leaf = true; } int go(int v, char ch); int get_link(int v) { if (t[v].link == -1) { if (v == 0 || t[v].p == 0) t[v].link = 0; else t[v].link = go(get_link(t[v].p), t[v].pch); } return t[v].link; } int go(int v, char ch) { int c = ch - 'a'; if (t[v].go[c] == -1) { if (t[v].next[c] != -1) t[v].go[c] = t[v].next[c]; else t[v].go[c] = v == 0 ? 0 : go(get_link(v), ch); } return t[v].go[c]; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); #ifdef LOCAL_PROJECT freopen("input.txt","r",stdin); #endif return 0; }
UKGovernmentBEIS/beis-report-overseas-development-assistance
app/services/import_forecasts.rb
<filename>app/services/import_forecasts.rb require "csv" require "set" class ImportForecasts Error = Struct.new(:row, :column, :value, :message) { def csv_row row + 2 end } RODA_ID_KEY = "Activity RODA Identifier" FORECAST_COLUMN_HEADER = /FC +(\d{4})\/\d{2} +FY +Q([1-4])/ FORECAST_QUARTERS = 20 COLUMN_HEADINGS = [ "Activity Name", "Activity Delivery Partner Identifier", RODA_ID_KEY ] class Generator def initialize(report) @report = report end def column_headings reportable_quarters = @report.own_financial_quarter.following(FORECAST_QUARTERS) quarter_headers = reportable_quarters.map { |quarter| year = quarter.financial_year.start_year "FC #{year}/#{(year + 1) % 100} FY Q#{quarter.quarter}" } COLUMN_HEADINGS + quarter_headers end def csv_row(activity) forecast_values = Array.new(FORECAST_QUARTERS, "") [ activity.title, activity.delivery_partner_identifier, activity.roda_identifier ] + forecast_values end end attr_reader :errors, :imported_forecasts def initialize(uploader: nil, report: nil) if uploader && report raise ArgumentError, "Importing forecasts for arbitrary users and reports is forbidden" end @uploader = uploader @report = report @errors = [] @warned_columns = Set.new @imported_forecasts = [] end def import(forecasts) latest_report = find_latest_report_in_selected_series ActiveRecord::Base.transaction do log_report_not_latest_error(latest_report) unless [nil, @report].include?(latest_report) forecasts.each_with_index do |row, index| @current_index = index import_row(row) end raise ActiveRecord::Rollback unless @errors.empty? end end private def find_latest_report_in_selected_series return nil unless @report Report .where(fund: @report.fund_id, organisation: @report.organisation_id) .in_historical_order .first end def import_row(row) roda_identifier = row[RODA_ID_KEY] activity = lookup_activity(roda_identifier) return unless activity row.each do |key, value| match = FORECAST_COLUMN_HEADER.match(key) if match year = match[1].to_i quarter = match[2].to_i imported_forecasts << import_forecast(activity, FinancialQuarter.new(year, quarter), value, header: key) elsif !COLUMN_HEADINGS.include?(key) && @warned_columns.add?(key) @errors << Error.new(-1, key, "", I18n.t("importer.errors.forecast.unrecognised_column")) end end end def import_forecast(activity, financial_quarter, value, header:) return if value.blank? history = ForecastHistory.new(activity, user: @uploader, report: @report, **financial_quarter) history.set_value(value) rescue ConvertFinancialValue::Error @errors << Error.new(@current_index, header, value, I18n.t("importer.errors.forecast.non_numeric_value")) rescue Encoding::CompatibilityError value.force_encoding(Encoding::UTF_8) @errors << Error.new(@current_index, header, value, I18n.t("importer.errors.forecast.invalid_characters")) rescue ForecastHistory::SequenceError @errors << Error.new(@current_index, header, header, I18n.t("importer.errors.forecast.in_the_past")) end def lookup_activity(roda_identifier) activity = Activity.by_roda_identifier(roda_identifier) if activity.nil? @errors << Error.new(@current_index, RODA_ID_KEY, roda_identifier, I18n.t("importer.errors.forecast.unknown_identifier")) nil elsif unauthorized_upload?(activity) @errors << Error.new(@current_index, RODA_ID_KEY, roda_identifier, I18n.t("importer.errors.forecast.unauthorised")) nil elsif activity_unrelated_to_report?(activity) @errors << Error.new(@current_index, RODA_ID_KEY, roda_identifier, "The activity is not related to the report, which belongs to #{report_fund} and #{report_organisation}.") nil else activity end end def unauthorized_upload?(activity) return false unless @uploader policy = ActivityPolicy.new(@uploader, activity) !policy.create? end def activity_unrelated_to_report?(activity) return false unless @report !Report.for_activity(activity).where(id: @report.id).exists? end def log_report_not_latest_error(latest_report) message = [ "The report #{@report.id} (#{report_organisation}, #{quarter @report} for #{report_fund},", "#{@report.state}) is not the latest for that organisation and fund.", "The latest is #{latest_report.id}, for #{quarter latest_report} (#{latest_report.state})." ] @errors << Error.new(nil, nil, nil, message.join(" ")) end def quarter(report) quarter = report.own_financial_quarter quarter ? quarter.to_s : "Historic Report" end def report_fund @report.fund.roda_identifier end def report_organisation @report.organisation.name end end
rog-works/lambda-fw
tests/unit/lf3py/lang/test_dsn.py
<gh_stars>0 from typing import List from unittest import TestCase from lf3py.lang.dsn import DSN from lf3py.test.helper import data_provider class TestDSN(TestCase): @data_provider([ (['event', 'on'], 'event.on'), (['event', 'off'], 'event.off'), ]) def test_format(self, elems: List[str], expected: str): self.assertEqual(DSN.format(*elems), expected) @data_provider([ ('event.on', 'event.(on|off)', True), ('event.off', 'event.(on|off)', True), ('event.invalid', 'event.(on|off)', False), ]) def test_like(self, dsn: str, spec: str, expected: bool): self.assertEqual(DSN(dsn).contains(spec), expected) @data_provider([ ('event.on', 'event.(?P<switch>(on|off))', {'switch': 'on'}), ('event.off', 'event.(?P<switch>(on|off))', {'switch': 'off'}), ]) def test_capture(self, dsn: str, spec: str, expected: bool): self.assertEqual(DSN(dsn).capture(spec), expected)
trydofor/pro.fessional.meepo
src/main/resources/pro/fessional/meepo/poof/impl/java/JavaName.java
<filename>src/main/resources/pro/fessional/meepo/poof/impl/java/JavaName.java<gh_stars>1-10 package pro.fessional.meepo.poof.impl.java; import org.jetbrains.annotations.NotNull; import pro.fessional.meepo.eval.JavaEval; import java.util.Map; // HI-MEEPO // RNA:USE #// *other-imports#import# // other-imports /** * @author trydofor * @since 2020-10-31 */ // RNA:USE #JavaName#class# public class JavaName implements JavaEval { @Override public Object eval(@NotNull Map<String, Object> ctx, Object obj, Object... arg) { // RNA:USE #return +null#method# // RNA:USE #;#colon# return null; } }
bitex-la/bitex-ruby
lib/bitex/base.rb
<gh_stars>1-10 module Bitex # Generic base resource for Bitex resources. class Base < JsonApiClient::Resource def self.find(*args) super(*args)[0] end end end
dileeshvar/deeplearning4j
deeplearning4j-nn/src/main/java/org/deeplearning4j/earlystopping/termination/MaxEpochsTerminationCondition.java
/*- * * * Copyright 2015 Skymind,Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * */ package org.deeplearning4j.earlystopping.termination; import lombok.NoArgsConstructor; import org.nd4j.shade.jackson.annotation.JsonCreator; import org.nd4j.shade.jackson.annotation.JsonProperty; /** Terminate training if the number of epochs exceeds the maximum number of epochs */ @NoArgsConstructor public class MaxEpochsTerminationCondition implements EpochTerminationCondition { @JsonProperty private int maxEpochs; @JsonCreator public MaxEpochsTerminationCondition(int maxEpochs) { if (maxEpochs <= 0) throw new IllegalArgumentException("Max number of epochs must be >= 1"); this.maxEpochs = maxEpochs; } @Override public void initialize() { //No op } @Override public boolean terminate(int epochNum, double score) { return epochNum + 1 >= maxEpochs; //epochNum starts at 0 } @Override public String toString() { return "MaxEpochsTerminationCondition(" + maxEpochs + ")"; } }
init-src/initsrc
initsrc-monitor/src/main/java/com/initsrc/dev/controller/MonitorController.java
package com.initsrc.dev.controller; import com.initsrc.common.base.Result; import com.initsrc.dev.service.SystemHardwareInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.data.redis.core.RedisCallback; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.*; /** * <p> * 服务监控-前端控制器 * </p> * * @author INITSRC * @since 2021-01-27 11:31:29 */ @RestController @RequestMapping("/devApi/monitor") @Api(tags = "服务监控模块") public class MonitorController { @Resource private RedisTemplate<String, String> redisTemplate; /** * 系统监控 * * @param * @return Result */ @GetMapping("/serverDetail") @ApiOperation(value = "系统监控", notes = "系统监控") @RequiresPermissions("p:dev:monitor:page") public Result<SystemHardwareInfo> serverDetail() throws Exception { SystemHardwareInfo systemHardwareInfo = new SystemHardwareInfo(); systemHardwareInfo.copyTo(); return Result.success(systemHardwareInfo); } /** * 缓存监控 * * @param * @return Result */ @GetMapping("/cacheDetail") @ApiOperation(value = "缓存监控", notes = "缓存监控") @RequiresPermissions("p:dev:monitor:cache") public Result<Map<String,Object>> cacheDetail() throws Exception { Map<String, Object> result = new HashMap<>(3); Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize()); result.put("info", info); result.put("dbSize", dbSize); Map<String, Object> pieList = new HashMap<>(2); List<Integer> data = new ArrayList<>(); List<String> label = new ArrayList<>(); commandStats.stringPropertyNames().forEach(key -> { String property = commandStats.getProperty(key); label.add(StringUtils.removeStart(key, "cmdstat_")); data.add(Integer.valueOf(StringUtils.substringBetween(property, "calls=", ",usec"))); }); pieList.put("label",label); pieList.put("data",data); result.put("commandStats", pieList); return Result.success(result); } }
mysociety/correspondence_tool_staff
spec/controllers/cases_controller/execute_request_amends_spec.rb
<gh_stars>0 require 'rails_helper' RSpec.describe CasesController, type: :controller do let(:pending_private_clearance_case) { create :pending_private_clearance_case } let(:private_officer) { find_or_create :private_officer } let(:service) { instance_double(CaseRequestAmendsService, call: true) } describe 'PATCH execute_request_amends' do context 'Full approval FOI' do before do sign_in private_officer allow(CaseRequestAmendsService).to receive(:new).and_return(service) end it 'authorizes' do expect { patch :execute_request_amends, params: { id: pending_private_clearance_case, case: {request_amends_comment: "Oh my!", draft_compliant: "no"} } } .to require_permission(:execute_request_amends?) .with_args(private_officer, pending_private_clearance_case) end it 'calls the case request amends service' do patch :execute_request_amends, params: { id: pending_private_clearance_case, case: {request_amends_comment: "Oh my!", draft_compliant: "no"} } expect(CaseRequestAmendsService) .to have_received(:new).with(user: private_officer, kase: pending_private_clearance_case, message: "Oh my!", is_compliant: false) expect(service).to have_received(:call) end it 'flashes a notification' do patch :execute_request_amends, params: { id: pending_private_clearance_case, case: {request_amends_comment: "Oh my!", compliance: "no"} } expect(flash[:notice]) .to eq 'You have requested amends to this case\'s response.' end it 'redirects to case detail page' do patch :execute_request_amends, params: { id: pending_private_clearance_case, case: {request_amends_comment: "Oh my!", compliance: "no"} } expect(response).to redirect_to(case_path(pending_private_clearance_case)) end end context 'trigger SAR' do let(:trigger_sar) { (create :pending_dacu_clearance_sar, approver: disclosure_specialist).decorate } let(:disclosure_specialist) { find_or_create :disclosure_specialist } before do sign_in disclosure_specialist allow(CaseRequestAmendsService).to receive(:new).and_return(service) end it 'calls the case request amends service with disclosure specialist' do patch :execute_request_amends, params: { id: trigger_sar, case: {request_amends_comment: "Sneaky puppies", draft_compliant: "yes"} } expect(CaseRequestAmendsService) .to have_received(:new).with(user: disclosure_specialist, kase: trigger_sar, message: "Sneaky puppies", is_compliant: true) expect(service).to have_received(:call) end it 'flashes a notification for SARs' do patch :execute_request_amends, params: { id: trigger_sar, case: {request_amends_comment: "Sneaky puppies", compliance: "no"} } expect(flash[:notice]) .to eq 'Information Officer has been notified a redraft is needed.' end end end end
secucard/secucard-connect-javascript-client-lib
dist/system/de.secucard.connect/product/loyalty/model/condition.js
<reponame>secucard/secucard-connect-javascript-client-lib System.register([], function (_export) { "use strict"; var Condition; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } return { setters: [], execute: function () { Condition = function Condition(start_value, curreny, bonus_type) { _classCallCheck(this, Condition); this.start_value = start_value; this.curreny = curreny; this.bonus_type = bonus_type; }; _export("Condition", Condition); } }; }); //# sourceMappingURL=data:application/json;charset=utf8;base64,<KEY>
rcukmuratom/transition
db/migrate/20140618145219_add_hit_count_to_mappings.rb
class AddHitCountToMappings < ActiveRecord::Migration[4.1] def change add_column :mappings, :hit_count, :integer add_index :mappings, :hit_count end end
rashmiChandy/hockey_simulation
src/main/java/dhl/businessLogic/aging/agingFactory/AgingAbstractFactory.java
<filename>src/main/java/dhl/businessLogic/aging/agingFactory/AgingAbstractFactory.java package dhl.businessLogic.aging.agingFactory; import dhl.businessLogic.aging.interfaceAging.IAging; import dhl.businessLogic.aging.interfaceAging.IInjury; import dhl.businessLogic.aging.interfaceAging.ILeagueSchedule; import dhl.businessLogic.aging.interfaceAging.IRetirement; import dhl.businessLogic.leagueModel.interfaceModel.IGameConfig; import dhl.businessLogic.leagueModel.interfaceModel.ILeagueObjectModel; import dhl.inputOutput.importJson.serializeDeserialize.interfaces.ISerializeLeagueObjectModel; public abstract class AgingAbstractFactory { private static AgingAbstractFactory uniqueInstance = null; protected AgingAbstractFactory() { } public static AgingAbstractFactory instance() { if (null == uniqueInstance) { uniqueInstance = new AgingFactory(); } return uniqueInstance; } public static void setFactory(AgingAbstractFactory f) { uniqueInstance = f; } public abstract IInjury createInjury(); public abstract IRetirement createRetirement(ISerializeLeagueObjectModel serializeModel); public abstract IAging createAging(IGameConfig gameConfig); public abstract ILeagueSchedule createLeagueSchedule(ILeagueObjectModel leagueObjectModel); }
yassermahmud/winsome-web
src/js/components/photogallery/photogalleryData.js
<filename>src/js/components/photogallery/photogalleryData.js const images = [ { path: '../images/Hero.jpg', caption: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit', key: 1 }, { path: '../images/IMG_0224.JPG', caption: 'sed do eiusmod tempor incididunt ut labore', key: 2 }, { path: '../images/IMG_0348.JPG', caption: 'quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo', key: 3 }, { path: '../images/IMG_9463.JPG', caption: 'deserunt mollit anim id est laborum.', key: 4 } ]; export default images;
gds-attic/finder-api
lib/tasks/email_subscriptions.rake
<reponame>gds-attic/finder-api namespace :email_subscriptions do desc "DEPRECATED: No longer required. Please remove from any deploy scripts" task :register_subscriptions do p "DEPRECATED: rake email_subscriptions:register_subscriptions is no longer required. Please remove from any deploy scripts" end end
GValiente/torrijas
torrijas/source/trjcolor.cpp
// // Copyright (c) 2015 <NAME> <EMAIL> // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // #include "trjcolor.h" #include "nanovg.h" #include "trjdebug.h" namespace trj { Color Color::createFromHSL(float hue, float saturation, float lightness) { TRJ_ASSERT(hue >= 0 && hue <= 1, "Invalid hue"); TRJ_ASSERT(saturation >= 0 && saturation <= 1, "Invalid saturation"); TRJ_ASSERT(lightness >= 0 && lightness <= 1, "Invalid lightness"); NVGcolor nvgColor = nvgHSL(hue, saturation, lightness); return Color(nvgColor.r, nvgColor.g, nvgColor.b); } Color Color::createFromHSL(float hue, float saturation, float lightness, float alpha) { TRJ_ASSERT(alpha >= 0 && alpha <= 1, "Invalid alpha"); Color color = createFromHSL(hue, saturation, lightness); color.mAlpha = alpha; return color; } Color Color::createFromChars(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha) noexcept { return Color(red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f); } std::pair<Color, float> Color::getBlendResult( const std::vector<std::pair<Color, float>>& blendColors) noexcept { std::pair<Color, float> result = std::make_pair(Color(), 0.0f); int numColors = blendColors.size(); if(numColors) { result = blendColors.front(); for(int index = 1; index < numColors; ++index) { const std::pair<Color, float>& blendColor = blendColors[index]; result.first = result.first.getBlendedColor(blendColor.first, blendColor.second); } } return result; } Color::Color(float red, float green, float blue, float alpha) noexcept : mRed(red), mGreen(green), mBlue(blue), mAlpha(alpha) { TRJ_ASSERT(red >= 0 && red <= 1, "Invalid red"); TRJ_ASSERT(green >= 0 && green <= 1, "Invalid green"); TRJ_ASSERT(blue >= 0 && blue <= 1, "Invalid blue"); TRJ_ASSERT(alpha >= 0 && alpha <= 1, "Invalid alpha"); } void Color::setRed(float red) noexcept { TRJ_ASSERT(red >= 0 && red <= 1, "Invalid red"); mRed = red; } void Color::setGreen(float green) noexcept { TRJ_ASSERT(green >= 0 && green <= 1, "Invalid green"); mGreen = green; } void Color::setBlue(float blue) noexcept { TRJ_ASSERT(blue >= 0 && blue <= 1, "Invalid blue"); mBlue = blue; } void Color::setAlpha(float alpha) noexcept { TRJ_ASSERT(alpha >= 0 && alpha <= 1, "Invalid alpha"); mAlpha = alpha; } Color Color::getBlendedColor(const Color& blendColor, float blendFactor) const noexcept { TRJ_ASSERT(blendFactor >= 0 && blendFactor <= 1, "Invalid blend factor"); float blendInverseFactor = 1 - blendFactor; float red = (mRed * blendInverseFactor) + (blendColor.mRed * blendFactor); float green = (mGreen * blendInverseFactor) + (blendColor.mGreen * blendFactor); float blue = (mBlue * blendInverseFactor) + (blendColor.mBlue * blendFactor); float alpha = (mAlpha * blendInverseFactor) + (blendColor.mAlpha * blendFactor); return Color(red, green, blue, alpha); } Color Color::getBlendedColor(const std::vector<std::pair<Color, float>>& blendColors) const noexcept { Color finalColor = *this; for(const std::pair<Color, float>& blendColor : blendColors) { finalColor = finalColor.getBlendedColor(blendColor.first, blendColor.second); } return finalColor; } }
duoduo369/parrot
src/test/java/com/reworkplan/resources/ArticlesResourceTest.java
package com.reworkplan.resources; public class ArticlesResourceTest{ public void test(){} }
Kirishikesan/haiku
src/apps/icon-o-matic/shape/commands/AddPointCommand.cpp
<reponame>Kirishikesan/haiku /* * Copyright 2006, Haiku. * Distributed under the terms of the MIT License. * * Authors: * <NAME> <<EMAIL>> */ #include "AddPointCommand.h" #include <stdio.h> #include <Catalog.h> #include <Locale.h> #include "VectorPath.h" #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "Icon-O-Matic-AddPointCmd" // constructor AddPointCommand::AddPointCommand(VectorPath* path, int32 index, const int32* selected, int32 count) : PathCommand(path), fIndex(index), fOldSelection(NULL), fOldSelectionCount(count) { if (fOldSelectionCount > 0 && selected) { fOldSelection = new int32[fOldSelectionCount]; memcpy(fOldSelection, selected, fOldSelectionCount * sizeof(int32)); } } // destructor AddPointCommand::~AddPointCommand() { delete[] fOldSelection; } // Perform status_t AddPointCommand::Perform() { status_t status = InitCheck(); if (status < B_OK) return status; // path point is already added, // but we don't know the parameters yet if (!fPath->GetPointsAt(fIndex, fPoint, fPointIn, fPointOut)) status = B_NO_INIT; return status; } // Undo status_t AddPointCommand::Undo() { status_t status = InitCheck(); if (status < B_OK) return status; // remove point if (fPath->RemovePoint(fIndex)) { // restore selection before adding point _Select(fOldSelection, fOldSelectionCount); } else { status = B_ERROR; } return status; } // Redo status_t AddPointCommand::Redo() { status_t status = InitCheck(); if (status < B_OK) return status; AutoNotificationSuspender _(fPath); // add point again if (fPath->AddPoint(fPoint, fIndex)) { fPath->SetPoint(fIndex, fPoint, fPointIn, fPointOut, true); // select added point _Select(&fIndex, 1); } else { status = B_ERROR; } return status; } // GetName void AddPointCommand::GetName(BString& name) { // name << _GetString(ADD_CONTROL_POINT, "Add Control Point"); name << B_TRANSLATE("Add Control Point"); }
schinmayee/nimbus
applications/physbam/physbam-lib/Public_Library/PhysBAM_Solids/PhysBAM_Deformables/Forces/DEFORMABLE_GRAVITY.cpp
<gh_stars>10-100 //##################################################################### // Copyright 2002-2008, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>. // This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt. //##################################################################### #include <PhysBAM_Tools/Log/DEBUG_UTILITIES.h> #include <PhysBAM_Tools/Polynomials/QUADRATIC.h> #include <PhysBAM_Solids/PhysBAM_Deformables/Forces/DEFORMABLE_GRAVITY.h> #include <PhysBAM_Solids/PhysBAM_Deformables/Particles/PARTICLES.h> using namespace PhysBAM; //##################################################################### // Function Add_Velocity_Independent_Forces //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Add_Velocity_Independent_Forces(ARRAY_VIEW<TV> F,const T time) const { if(!gravity) return; for(ELEMENT_ITERATOR iterator(force_particles);iterator.Valid();iterator.Next()){int p=iterator.Data();F(p)+=gravity*particles.mass(p)*downward_direction;} } //##################################################################### // Function Potential_Energy //##################################################################### template<class TV> typename TV::SCALAR DEFORMABLE_GRAVITY<TV>:: Potential_Energy(int p,const T time) const { TV acceleration=gravity*downward_direction; return -particles.mass(p)*TV::Dot_Product(particles.X(p),acceleration); } //##################################################################### // Function Potential_Energy //##################################################################### template<class TV> typename TV::SCALAR DEFORMABLE_GRAVITY<TV>:: Potential_Energy(const T time) const { T potential_energy=0; for(ELEMENT_ITERATOR iterator(force_particles);iterator.Valid();iterator.Next()){int p=iterator.Data(); potential_energy+=Potential_Energy(p,time);} return potential_energy; } //##################################################################### // Function Store_Potential_Energy //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Save_Potential_Energy(const T time) { potential_energy_save.Resize(particles.array_collection->Size()); for(ELEMENT_ITERATOR iterator(force_particles);iterator.Valid();iterator.Next()){int p=iterator.Data(); potential_energy_save(p)=Potential_Energy(p,time);} } //##################################################################### // Function Residual_Energy //##################################################################### template<class TV> typename TV::SCALAR DEFORMABLE_GRAVITY<TV>:: Residual_Energy(const T time) const { T residual_energy=0; if(residual_PE.m) for(ELEMENT_ITERATOR iterator(force_particles);iterator.Valid();iterator.Next()){int p=iterator.Data(); residual_energy+=residual_PE(p);} return residual_energy; } //##################################################################### // Function Setup_Set_Velocity_From_Positions //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Setup_Set_Velocity_From_Positions(const T time,const bool is_position_update,const bool reset_alphas) { if(!is_position_update) Update_Position_Based_State(time,is_position_update); force_estimates.Resize(particles.array_collection->Size()); incident_nodes.Resize(particles.array_collection->Size()); for(ELEMENT_ITERATOR iterator(force_particles);iterator.Valid();iterator.Next()){int p=iterator.Data(); incident_nodes(p).Remove_All(); incident_nodes(p).Append(p);} if(is_position_update){ if(reset_alphas) for(ELEMENT_ITERATOR iterator(force_particles);iterator.Valid();iterator.Next()){int s=iterator.Data();force_estimates(s)=0;} Save_Potential_Energy(time);} } //##################################################################### // Function Get_Element_Count //##################################################################### template<class TV> int DEFORMABLE_GRAVITY<TV>:: Get_Element_Count() { return particles.array_collection->Size(); } //##################################################################### // Function Get_Force_Elements //##################################################################### template<class TV> FORCE_ELEMENTS* DEFORMABLE_GRAVITY<TV>:: Get_Force_Elements() { return &force_particles; } //##################################################################### // Function Incident_Nodes //##################################################################### template<class TV> ARRAY<int>* DEFORMABLE_GRAVITY<TV>:: Incident_Nodes(const int force_element) { return &(incident_nodes(force_element)); } //##################################################################### // Function Get_Direction //##################################################################### template<class TV> TV DEFORMABLE_GRAVITY<TV>:: Get_Direction(const int force_element) { return downward_direction; } //##################################################################### // Function Get_Combined_One_Over_Mass //##################################################################### template<class TV> typename TV::SCALAR DEFORMABLE_GRAVITY<TV>:: Get_Combined_One_Over_Mass(const int force_element) { return particles.one_over_mass(force_element); } //##################################################################### // Function Incident_Force_Elements //##################################################################### template<class TV> ARRAY<int>* DEFORMABLE_GRAVITY<TV>:: Incident_Force_Elements(const int particle) { return &incident_elements(particle); } //##################################################################### // Function Choose_Solution //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Choose_Solution(const bool use_orig_force,const int force_element,const T dt,const T alpha1,const T alpha2,ARRAY<T>& v_n_hats) { T original_force=gravity*particles.mass(force_element); if(fabs(alpha1-original_force)<fabs(alpha2-original_force)) Set_Force(force_element,alpha1); else Set_Force(force_element,alpha2); } //##################################################################### // Function Get_Force //##################################################################### template<class TV> TV DEFORMABLE_GRAVITY<TV>:: Get_Force(const int force_element,const int particle,const bool use_original_force) { if(use_original_force) return gravity*particles.mass(particle)*downward_direction; else return force_estimates(force_element)*downward_direction; } //##################################################################### // Function Get_Force //##################################################################### template<class TV> typename TV::SCALAR DEFORMABLE_GRAVITY<TV>:: Get_Force(const int force_element) { return force_estimates(force_element); } //##################################################################### // Function Set_Force //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Set_Force(const int force_element,const T force) { force_estimates(force_element)=force; } //##################################################################### // Function Get_Damping_Force //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Get_Damping_Force(const int particle,TV& damping_force,const T dt,const bool use_coefficient) { } //##################################################################### // Function Update_Residual_Energy //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Update_Residual_Energy(const int force_element,const T residual_energy,const T time) { residual_PE(force_element)=residual_energy; } //##################################################################### // Function Get_Residual_Energy //##################################################################### template<class TV> typename TV::SCALAR DEFORMABLE_GRAVITY<TV>:: Get_Residual_Energy(const int force_element) { return residual_PE(force_element); } //##################################################################### // Function Compute_Quadratic_Contribution_For_Node //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Compute_Quadratic_Contribution_For_Force(T& A,T& a,T&c,const T dt,const int force_element,const T combined_one_over_mass,const bool ignore_PE_terms) { A=(T).5*dt*dt*combined_one_over_mass; } //##################################################################### // Function Compute_Quadratic_Contribution_For_Node //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Compute_Quadratic_Contribution_For_Node(T& B,T& C,T&b,const T dt,const int node,const int force_element,const T combined_one_over_mass,const T v_n_correction,const bool ignore_PE_terms) { T vu=TV::Dot_Product(particles.V(node),downward_direction); B+=dt*(vu+(T).5*v_n_correction); if(!ignore_PE_terms) C+=-(T)dt*(1/combined_one_over_mass)*gravity*(vu+(T).5*v_n_correction); } //##################################################################### // Function Compute_Quadratic_Contribution_For_Residual //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Compute_Quadratic_Contribution_For_Residual(T& B,T& C,T& a,T&b,T&c,const T dt,const T time,const int force_element,const bool ignore_PE_terms) { if(!ignore_PE_terms) B+=-(T).5*dt*dt*gravity; else C=delta_PE(force_element); C+=residual_PE(force_element); } //##################################################################### // Function Store_Delta_PE //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Store_Delta_PE(const T time) { delta_PE.Resize(potential_energy_save.m); T total_current_PE=0; for(ELEMENT_ITERATOR iterator(force_particles);iterator.Valid();iterator.Next()){int p=iterator.Data(); delta_PE(p)=Potential_Energy(p,time)-potential_energy_save(p); total_current_PE+=Potential_Energy(p,time);} total_delta_PE=total_current_PE-ARRAYS_COMPUTATIONS::Sum(potential_energy_save); } //##################################################################### // Function Get_Total_Delta_PE //##################################################################### template<class TV> typename TV::SCALAR DEFORMABLE_GRAVITY<TV>:: Get_Total_Delta_PE() { return total_delta_PE; } //##################################################################### // Function Save_And_Reset_Elastic_Coefficient //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Save_And_Reset_Elastic_Coefficient() { } //##################################################################### // Function Restore_Elastic_Coefficient //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Restore_Elastic_Coefficient() { } //##################################################################### // Function Update_Position_Based_State //##################################################################### template<class TV> void DEFORMABLE_GRAVITY<TV>:: Update_Position_Based_State(const T time,const bool is_position_update) { if(!residual_PE.m) residual_PE.Resize(particles.array_collection->Size()); if(!incident_elements.m){ incident_elements.Resize(particles.array_collection->Size()); for(int i=1;i<=force_particles.indices.m;i++) incident_elements(force_particles.indices(i)).Append(force_particles.indices(i));} } //##################################################################### template class DEFORMABLE_GRAVITY<VECTOR<float,1> >; template class DEFORMABLE_GRAVITY<VECTOR<float,2> >; template class DEFORMABLE_GRAVITY<VECTOR<float,3> >; #ifndef COMPILE_WITHOUT_DOUBLE_SUPPORT template class DEFORMABLE_GRAVITY<VECTOR<double,1> >; template class DEFORMABLE_GRAVITY<VECTOR<double,2> >; template class DEFORMABLE_GRAVITY<VECTOR<double,3> >; #endif
sunsiyue/ACMEDB_MAIN
java/engine/org/apache/derby/impl/store/raw/xact/XactContext.java
/* Derby - Class org.apache.derby.impl.store.raw.xact.XactContext Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.apache.derby.impl.store.raw.xact; import org.apache.derby.iapi.reference.SQLState; // This is the recommended super-class for all contexts. import org.apache.derby.iapi.services.context.ContextImpl; import org.apache.derby.iapi.services.context.ContextManager; import org.apache.derby.shared.common.sanity.SanityManager; import org.apache.derby.iapi.store.raw.RawStoreFactory; import org.apache.derby.iapi.store.raw.xact.RawTransaction; import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.error.ExceptionSeverity; /** The context associated with the transaction. This object stores the context associated with the raw store transaction on the stack. It stores info about the transaction opened within a context manager (ie. typically a single user) for a single RawStoreFactory. **/ final class XactContext extends ContextImpl { private RawTransaction xact; private RawStoreFactory factory; private boolean abortAll; // true if any exception causes this transaction to be aborted. XactContext(ContextManager cm, String name, Xact xact, boolean abortAll, RawStoreFactory factory) { super(cm, name); this.xact = xact; this.abortAll = abortAll; this.factory = factory; xact.xc = this; // double link between transaction and myself } /* ** Context methods (most are implemented by super-class) */ /** @exception StandardException Standard Derby error policy */ public void cleanupOnError(Throwable error) throws StandardException { if (SanityManager.DEBUG) { SanityManager.ASSERT(getContextManager() != null); } boolean throwAway = false; if (error instanceof StandardException) { StandardException se = (StandardException) error; if (abortAll) { // any error aborts an internal/nested xact and its transaction if (se.getSeverity() < ExceptionSeverity.TRANSACTION_SEVERITY) { throw StandardException.newException( SQLState.XACT_INTERNAL_TRANSACTION_EXCEPTION, error); } throwAway = true; } else { // If the severity is lower than a transaction error then do nothing. if (se.getSeverity() < ExceptionSeverity.TRANSACTION_SEVERITY) { return; } // If the session is going to disappear then we want to close this // transaction, not just abort it. if (se.getSeverity() >= ExceptionSeverity.SESSION_SEVERITY) throwAway = true; } } else { // some java* error, throw away the transaction. throwAway = true; } try { if (xact != null) { // abort the transaction xact.abort(); } } catch (StandardException se) { // if we get an error during abort then shut the system down throwAway = true; // if the system was being shut down anyway, do nothing if ((se.getSeverity() <= ExceptionSeverity.SESSION_SEVERITY) && (se.getSeverity() >= ((StandardException) error).getSeverity())) { throw factory.markCorrupt( StandardException.newException( SQLState.XACT_ABORT_EXCEPTION, se)); } } finally { if (throwAway) { // xact close will pop this context out of the context // stack xact.close(); xact = null; } } } RawTransaction getTransaction() { return xact; } RawStoreFactory getFactory() { return factory; } void substituteTransaction(Xact newTran) { // disengage old tran from this xact context Xact oldTran = (Xact)xact; if (oldTran.xc == this) oldTran.xc = null; // set up double link between new transaction and myself xact = newTran; ((Xact)xact).xc = this; } }
lw-lin/incubator-ranger
storm-agent/src/test/java/org/apache/ranger/authorization/storm/WordCounterBolt.java
<reponame>lw-lin/incubator-ranger<gh_stars>0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ranger.authorization.storm; import java.util.HashMap; import java.util.Map; import org.apache.storm.task.OutputCollector; import org.apache.storm.task.TopologyContext; import org.apache.storm.topology.OutputFieldsDeclarer; import org.apache.storm.topology.base.BaseRichBolt; import org.apache.storm.tuple.Fields; import org.apache.storm.tuple.Tuple; import org.apache.storm.tuple.Values; /** * A Storm Bolt which reads in a word and counts it + outputs the word + current count */ public class WordCounterBolt extends BaseRichBolt { private OutputCollector outputCollector; private Map<String, Integer> countMap = new HashMap<>(); @Override public void execute(Tuple tuple) { String word = tuple.getString(0); int count = 0; if (countMap.containsKey(word)) { count = countMap.get(word); count++; } count++; countMap.put(word, count); outputCollector.emit(new Values(word, count)); outputCollector.ack(tuple); } @Override public void prepare(Map arg0, TopologyContext arg1, OutputCollector outputCollector) { this.outputCollector = outputCollector; } @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declare(new Fields("word", "count")); } }
mulberry-mail/mulberry4-client
Win32/Sources/Support/Toolbars/CToolbar.cp
<filename>Win32/Sources/Support/Toolbars/CToolbar.cp /* Copyright (c) 2007-2009 <NAME>. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Source for CToolbar class #include "CToolbar.h" #include "CBaseView.h" #include "CCommander.h" #include "CDrawUtils.h" #include "CFilterManager.h" #include "CIconMenu.h" #include "CIconWnd.h" #include "CMailboxToolbarPopup.h" #include "CMulberryApp.h" #include "CMulberryCommon.h" #include "CPopupButton.h" #include "CPreferences.h" #include "CSelectPopup.h" #include "CServerViewPopup.h" #include "CSMTPAccountPopup.h" #include "CTextButton.h" #include "CToolbarButton.h" #include "CToolbarPopupButton.h" #include "CToolbarView.h" #include "CXstringResources.h" #include "StValueChanger.h" #include <algorithm> // Static members CToolbar::CToolbarList CToolbar::sToolbars; BEGIN_MESSAGE_MAP(CToolbar, CContainerWnd) ON_WM_CREATE() ON_WM_SIZE() ON_WM_KEYDOWN() ON_WM_LBUTTONDOWN() ON_WM_RBUTTONDOWN() ON_WM_CONTEXTMENU() ON_WM_MOUSEMOVE() ON_WM_PAINT() END_MESSAGE_MAP() const int cToolbarWidth = 128; const int cToolbarHeight = 45; const int cBtnStart = 8; const int cLargeIconBtnSize = 32; const int cSmallIconBtnSize = 20; const int cCaptionXtraBtnSize = 14; const int cClickAndPopupXtraBtnSize = 12; const int cPopupXtraBtnSize = 8; const int cTextBtnHeight = 18; const int cDropCursorWidth = 4; const int cSpaceWidth = 16; const int cExpandSpaceMinWidth = 4; const int cSeparatorWidth = 8; const int cPopupWidth = 200; const int cPopupTitleWidth = 64; enum { ePopup_RemoveButton = 0, ePopup_MoveButton, //ePopup_Separator1, ePopup_AddButton, //ePopup_Separator2, ePopup_ResetButtons }; // C O N S T R U C T I O N / D E S T R U C T I O N M E T H O D S // Default constructor CToolbar::CToolbar() { mIs3Pane = false; mShowIt = true; mSmallIcons = CPreferences::sPrefs->mToolbarSmallIcons.GetValue(); mShowIcons = CPreferences::sPrefs->mToolbarShowIcons.GetValue(); mShowCaptions = CPreferences::sPrefs->mToolbarShowCaptions.GetValue(); mLeftJustOffset = cBtnStart; mLastCommander = NULL; mDragIndex = 0xFFFFFFFF; sToolbars.push_back(this); } // Default destructor CToolbar::~CToolbar() { sToolbars.erase(remove(sToolbars.begin(), sToolbars.end(), this), sToolbars.end()); } // O T H E R M E T H O D S ____________________________________________________________________________ void CToolbar::PrefsChanged() { // Rebuild each toolbar for(CToolbarList::iterator iter = sToolbars.begin(); iter != sToolbars.end(); iter++) { (*iter)->ResetButtons(false); } } bool CToolbar::RulesChanged() { bool result = false; // Rebuild each toolbar for(CToolbarList::iterator iter = sToolbars.begin(); iter != sToolbars.end(); iter++) { result |= (*iter)->UpdateRulesButtons(); } return result; } void CToolbar::InitToolbar(bool is_3pane, CToolbarView* parent) { mIs3Pane = is_3pane; DWORD dwStyle = AFX_WS_DEFAULT_VIEW; dwStyle &= ~WS_BORDER; // Create this CRect rect(0, 0, cToolbarWidth, GetBtnSize().cy + 1); Create(NULL, NULL, dwStyle, rect, parent, IDC_STATIC); } int CToolbar::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CContainerWnd::OnCreate(lpCreateStruct) == -1) return -1; return 0; } void CToolbar::OnPaint() { // Fill the middle CPaintDC dc(this); CRect client; GetClientRect(client); dc.FillSolidRect(client, afxData.clrBtnFace); } void CToolbar::BuildToolbar() { // Get the toolbar items const CToolbarItem::CToolbarPtrItems& items = CToolbarManager::sToolbarManager.GetToolbarItems(GetType()); // Add each one UINT paneid = IDC_TOOLBAR_BTN1; // Double this for every button as click-and-popup buttons use up two message ids for(CToolbarItem::CToolbarPtrItems::const_iterator iter = items.begin(); iter != items.end(); iter++, paneid += 2) { // Double-check we have something valid if ((*iter).GetItem() == NULL) { // Force entire reset ResetButtons(true); return; }; // Separator is special cased as its not derived from toolbar button class if ((*iter).GetItem()->GetType() == CToolbarItem::eSeparator) { CRect rect1(0, 0, cSeparatorWidth, 44); CGrayBackground* sep_container = new CGrayBackground; sep_container->Create(_T(""), WS_CHILD | WS_VISIBLE, rect1, this, paneid); CRect rect2(cSeparatorWidth/2 - 2, 2, cSeparatorWidth/2, 40); CStatic* sep = new CStatic; sep->Create(_T(""), WS_CHILD | WS_VISIBLE | SS_ETCHEDVERT, rect2, sep_container, IDC_STATIC); sep_container->AddAlignment(new CWndAlignment(sep, CWndAlignment::eAlign_LeftHeight)); AddItem(sep_container, *iter); } else if (((*iter).GetItem()->GetType() == CToolbarItem::eSpace) || ((*iter).GetItem()->GetType() == CToolbarItem::eExpandSpace)) { CRect rect(0, 0, cSpaceWidth, 44); CStatic* sep = new CStatic; sep->Create(_T(""), WS_CHILD | WS_VISIBLE, rect, this, paneid); AddItem(sep, *iter); } // Popup menu is special cased as its not derived from toolbar button class else if ((*iter).GetItem()->GetType() == CToolbarItem::ePopupMenu) { CRect rect1(0, 10, cPopupWidth, 20); CGrayBackground* popup_container = new CGrayBackground; popup_container->Create(_T(""), WS_CHILD | WS_VISIBLE, rect1, this, paneid); CRect rect2(0, 0, cPopupTitleWidth, 2); CStatic* title = new CStatic; CString s = cdustring(CToolbarManager::sToolbarManager.GetTitle((*iter).GetItem()->GetTitleID())); title->Create(s, WS_CHILD | WS_VISIBLE, rect2, popup_container, IDC_STATIC); title->SetFont(CMulberryApp::sAppFont); CRect rect3(cPopupTitleWidth, 0, cPopupWidth - cPopupTitleWidth, 20); CPopupButton* popup = new CPopupButton; popup->Create(_T(""), rect3, popup_container, paneid, IDC_STATIC, IDI_POPUPBTN); popup->SetMenu((*iter).GetItem()->GetPopupMenu()); popup->SetFont(CMulberryApp::sAppFont); AddItem(popup, *iter); } // Popup menu is special cased as its not derived from toolbar button class else if ((*iter).GetItem()->GetType() == CToolbarItem::eSMTPAccountPopup) { const int small_offset = CMulberryApp::sLargeFont ? 4 : 0; CRect rect(0, 0, 212, 22 + small_offset); CString s = cdustring(CToolbarManager::sToolbarManager.GetTitle((*iter).GetItem()->GetTitleID())); CSMTPAccountPopup* popup = new CSMTPAccountPopup(paneid, s); popup->Create(_T(""), WS_CHILD | WS_VISIBLE, rect, this, paneid); AddItem(popup, *iter); } // Icon is special cased as its not derived from toolbar button class else if ((*iter).GetItem()->GetType() == CToolbarItem::eStaticIcon) { CRect rect(6, 0, 32, 32); CIconWnd* icon = new CIconWnd; icon->Create(NULL, WS_CHILD | WS_VISIBLE | SS_ICON, rect, this, paneid); icon->SetIconID((*iter).GetItem()->GetIconID()); AddItem(icon, *iter); } else { CRect rect(0, 0, 44, 44); CString title = cdustring(CToolbarManager::sToolbarManager.GetTitle((*iter).GetItem()->GetTitleID())); // Apply rules titles depend on the rule if ((*iter).GetItem()->GetTitleID() == CToolbarManager::eToolbar_ApplyRules) { // The name is actual the uid encoded as a string unsigned long uid = ::strtoul((*iter).GetExtraInfo(), NULL, 10); if (uid > 0) { const CFilterItem* filter = CPreferences::sPrefs->GetFilterManager()->GetManualFilter(uid); if (filter) title = filter->GetName(); } else title = rsrc::GetString("CToolbarManager::AllRules"); } CToolbarButton* tbtn = NULL; CToolbarPopupButton* ptbtn = NULL; switch((*iter).GetItem()->GetType()) { case CToolbarItem::ePushButton: case CToolbarItem::eToggleButton: tbtn = new CToolbarButton; break; case CToolbarItem::ePopupButton: case CToolbarItem::ePopupPushButton: case CToolbarItem::ePopupToggleButton: tbtn = ptbtn = new CToolbarPopupButton; break; case CToolbarItem::eCabinetButton: tbtn = new CServerViewPopup; break; case CToolbarItem::eCopyToButton: tbtn = new CMailboxToolbarPopup; static_cast<CMailboxToolbarPopup*>(tbtn)->SetClickAndPopup(true); static_cast<CMailboxToolbarPopup*>(tbtn)->SetCopyTo(true); break; case CToolbarItem::eSelectButton: tbtn = ptbtn = new CSelectPopup; break; } tbtn->Create(title, rect, this, paneid, IDC_STATIC, (*iter).GetItem()->GetIconID(), 0, (*iter).GetItem()->IsToggleIcon() ? (*iter).GetItem()->GetIconID() + 1 : 0, 0); if ((ptbtn != 0) && ((*iter).GetItem()->GetPopupMenu() != 0)) ptbtn->SetMenu((*iter).GetItem()->GetPopupMenu()); // Now add to the display AddButton(tbtn, *iter); } } // We have to reset the toolbar to get the expand item width calculated properly ResetLayout(); } // Resize sub-views void CToolbar::OnSize(UINT nType, int cx, int cy) { CContainerWnd::OnSize(nType, cx, cy); ResetLayout(); } unsigned long CToolbar::GetMinimumWidth() const { // Size of left area + size of right area plus some space between them return mLeftJustOffset; } unsigned long CToolbar::GetActualWidth() const { // Take into account collapsed state return GetMinimumWidth(); } CSize CToolbar::GetBtnSize(const CToolbarButton* tb) const { const int small_offset = CMulberryApp::sLargeFont ? 4 : 0; const int large_offset = CMulberryApp::sLargeFont ? 12 : 0; CSize result; // If captions visible, horizontal size is always full size if (mShowCaptions) result.cx = cLargeIconBtnSize + cCaptionXtraBtnSize + large_offset; else result.cx = mSmallIcons ? cSmallIconBtnSize : cLargeIconBtnSize; // No icons => use text button height if (!mShowIcons) result.cy = cTextBtnHeight; else { // Vertical size depends on icon result.cy = mSmallIcons ? cSmallIconBtnSize : cLargeIconBtnSize; // If caption visible, vertical size always contains caption extra space if (mShowCaptions) result.cy += cCaptionXtraBtnSize + small_offset; } // Special toolbar button sizes if (tb) { // Click-and-popup always has extra space if (tb->GetClickAndPopup()) result.cx += cClickAndPopupXtraBtnSize; // If popup without captions or icons add extra width for popup glyph else if ((!mShowCaptions || !mShowIcons) && tb->HasPopup()) result.cx += cPopupXtraBtnSize; } return result; } // Resize after change to buttons size/captions void CToolbar::Reset() { // First resize the toolbar itself CRect rect; GetWindowRect(rect); GetParent()->ScreenToClient(rect); rect.bottom = rect.top + GetBtnSize().cy + 1; MoveWindow(rect); } // Resize after change to buttons size/captions void CToolbar::ResetLayout() { CRect rect; GetWindowRect(rect); // Resize each button and accumulate total size (excluding additional expand item) unsigned long total_width = 0; // Loop over each item for(CItemArray::iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) { // Check for space if ((*iter).mWnd) { CRect btnrect; (*iter).mWnd->GetWindowRect(btnrect); switch((*iter).mDetails.GetItem()->GetType()) { case CToolbarItem::eSeparator: case CToolbarItem::eSpace: // Resize height - keep width the same btnrect.bottom = btnrect.top + GetBtnSize().cy; (*iter).mWnd->MoveWindow(btnrect); break; case CToolbarItem::eExpandSpace: // Resize height and width to standards - width will be adjusted to expanded size later btnrect.right = btnrect.left + cExpandSpaceMinWidth; btnrect.bottom = btnrect.top + GetBtnSize().cy; (*iter).mWnd->MoveWindow(btnrect); break; case CToolbarItem::ePushButton: case CToolbarItem::eToggleButton: case CToolbarItem::ePopupButton: case CToolbarItem::ePopupPushButton: case CToolbarItem::ePopupToggleButton: case CToolbarItem::eCabinetButton: case CToolbarItem::eCopyToButton: case CToolbarItem::eSelectButton: // These are all toolbar buttons { // See if it is a toolbar button CToolbarButton* btn = dynamic_cast<CToolbarButton*>((*iter).mWnd); if (btn) { // Set its size/caption visibility btn->SetSmallIcon(mSmallIcons); btn->SetShowIcon(mShowIcons); btn->SetShowCaption(mShowCaptions); btnrect.right = btnrect.left + GetBtnSize(btn).cx; btnrect.bottom = btnrect.top + GetBtnSize().cy; btn->MoveWindow(btnrect); } break; } default:; } // Accumalate size total_width += btnrect.Width(); } } // Now reposition each button from the start accounting for expansion mLeftJustOffset = cBtnStart; long expand_by = rect.Width() - 2 * cBtnStart - total_width; // Loop over each item for(CItemArray::iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) { // Check for space if ((*iter).mWnd) { // Get current item rect CRect btnrect; (*iter).mWnd->GetWindowRect(btnrect); switch((*iter).mDetails.GetItem()->GetType()) { case CToolbarItem::eExpandSpace: // Resize width by expand amount if positive if (expand_by > 0) { btnrect.right = btnrect.left + expand_by; (*iter).mWnd->MoveWindow(btnrect); } break; default:; } // Now reposition it btnrect.OffsetRect(-btnrect.left, -btnrect.top); PositionButton(btnrect); (*iter).mWnd->MoveWindow(btnrect); } } // Tell parent to adjust itself if we are visible if (IsVisible()) static_cast<CToolbarView*>(GetParent())->AdjustSize(); } void CToolbar::PositionButton(CRect& btnrect) { // Center vertically CRect client; GetClientRect(client); int top_offset = (client.Height() - btnrect.Height()) / 2; btnrect.OffsetRect(mLeftJustOffset, top_offset); mLeftJustOffset += btnrect.Width(); } void CToolbar::AddItem(CWnd* wnd, const CToolbarItem::CToolbarItemInfo& details) { // Position appropriately CRect btnrect; wnd->GetWindowRect(btnrect); btnrect.OffsetRect(-btnrect.left, -btnrect.top); PositionButton(btnrect); wnd->MoveWindow(btnrect); // Add item to list mItemList.push_back(SItemSpec(wnd, details)); } void CToolbar::AddButton(CIconButton* btn, const CToolbarItem::CToolbarItemInfo& details) { CRect btnrect; btn->GetWindowRect(btnrect); // Set up toolbar button styles CToolbarButton* tbtn = dynamic_cast<CToolbarButton*>(btn); if (tbtn) { tbtn->SetSmallIcon(mSmallIcons); tbtn->SetShowIcon(mShowIcons); tbtn->SetShowCaption(mShowCaptions); btnrect.right = btnrect.left + GetBtnSize(tbtn).cx; btnrect.bottom = btnrect.top + GetBtnSize().cy; } // Position appropriately btnrect.OffsetRect(-btnrect.left, -btnrect.top); PositionButton(btnrect); btn->MoveWindow(btnrect); // Add item to list mItemList.push_back(SItemSpec(btn, details)); } BOOL CToolbar::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { // Handle button message ourselves - we map it to the button's command if ((nCode == CN_COMMAND) && (nID >= IDC_TOOLBAR_BTN1) && (nID <= IDC_TOOLBAR_BTN1 + 100)) { // Find the button for this message for(CItemArray::iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) { if ((*iter).mWnd) { if ((*iter).mWnd->GetDlgCtrlID() == nID) { // Adjust pExtra to extra info if present if (!(*iter).mDetails.GetExtraInfo().empty()) pExtra = const_cast<char*>((*iter).mDetails.GetExtraInfo().c_str()); // Determine nature of command (ignore Alt key command - the handler will look for the key down // Let super commander handle the command if it wants to if (GetCommander() && GetCommander()->OnCmdMsg((*iter).mDetails.GetItem()->GetCommand(), nCode, pExtra, pHandlerInfo)) return true; } else if ((*iter).mWnd->GetDlgCtrlID() + 1 == nID) { // Adjust ioParam to extra info if present if (!(*iter).mDetails.GetExtraInfo().empty()) pExtra = const_cast<char*>((*iter).mDetails.GetExtraInfo().c_str()); // Determine nature of command (ignore Alt key command - the handler will look for the key down // Let super commander handle the command if it wants to if (GetCommander() && GetCommander()->OnCmdMsg((*iter).mDetails.GetItem()->GetMenuCommand(), nCode, pExtra, pHandlerInfo)) return true; } } } } // Let super commander handle the unmapped command if it wants to if (GetCommander() && GetCommander()->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) return true; // If the object(s) in the extended command route don't handle // the command, then let the base class OnCmdMsg handle it. BOOL result = CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); return result; } void CToolbar::ListenTo_Message(long msg, void* param) { switch(msg) { case CBaseView::eBroadcast_ViewActivate: // Broadcast activation to parent Broadcast_Message(eBroadcast_ToolbarActivate, this); // Always update state after activation - selection change may not be triggered UpdateToolbarState(); break; case CBaseView::eBroadcast_ViewDeactivate: // Broadcast activation to parent Broadcast_Message(eBroadcast_ToolbarDeactivate, this); break; case CBaseView::eBroadcast_ViewSelectionChanged: // Update state UpdateToolbarState(); break; } } // Set the commander to send commands to void CToolbar::SetCommander(CCommander* cmdr) { // Only if valid if (!cmdr) return; // See if already in the list CCommanderArray::const_iterator found = std::find(mCmdrs.begin(), mCmdrs.end(), cmdr); if (found == mCmdrs.end()) { // Erase all mCmdrs.clear(); mCmdrs.push_back(cmdr); // Update state if it changes UpdateToolbarState(); } } // Add a commander to send commands to void CToolbar::AddCommander(CCommander* cmdr) { // Only if valid if (!cmdr) return; // See if already in the list CCommanderArray::const_iterator found = std::find(mCmdrs.begin(), mCmdrs.end(), cmdr); if (found == mCmdrs.end()) { mCmdrs.push_back(cmdr); // Update state if it changes UpdateToolbarState(); } } // Remove a commander to send commands to void CToolbar::RemoveCommander(CCommander* cmdr) { // Only if valid if (!cmdr) return; // See if already in the list mCmdrs.erase(std::remove(mCmdrs.begin(), mCmdrs.end(), cmdr), mCmdrs.end()); // Update state if it changes UpdateToolbarState(); } CWnd* CToolbar::GetCommander() const { CCommander* found = NULL; for(CCommanderArray::const_iterator iter = mCmdrs.begin(); iter != mCmdrs.end(); iter++) { // Always use the one which is the current target if ((*iter)->IsTarget()) { found = *iter; break; } // Cache the one on duty and return that if none are targets // Also use the last one if that is found in the array if ((*iter)->IsOnDuty() || (*iter == mLastCommander)) found = *iter; } mLastCommander = found; return dynamic_cast<CWnd*>(found); } void CToolbar::UpdateControl(CWnd* ctrl, UINT cmd, bool enable, bool show) { CCmdUI cmdui; cmdui.m_pOther = ctrl; cmdui.m_nID = cmd; // Only if commander available CWnd* commander = GetCommander(); if (commander) // we recreate the CWnd as we got it from another thread cmdui.DoUpdate(CWnd::FromHandle(commander->GetSafeHwnd()), true); // Check for visibility change tied to enable state if (show) ctrl->ShowWindow(ctrl->IsWindowEnabled() ? SW_SHOW : SW_HIDE); } void CToolbar::UpdatePopupControl(CWnd* ctrl) { // Must be a toolbar popup button CToolbarPopupButton* popup = dynamic_cast<CToolbarPopupButton*>(ctrl); if (!popup) return; // Do command UI processing for each message in the menu for(UINT i = 0; i < popup->GetPopupMenu()->GetMenuItemCount(); i++) { UINT cmd = popup->GetPopupMenu()->GetMenuItemID(i); if ((cmd != 0) && (cmd != 0xFFFFFFFF)) { CCmdUI cmdui; cmdui.m_pOther = ctrl; cmdui.m_nID = cmd; cmdui.m_nIndex = i; cmdui.m_pMenu = popup->GetPopupMenu(); // Only if commander available if (GetCommander()) cmdui.DoUpdate(GetCommander(), true); } } } bool CToolbar::UpdateRulesButtons() { bool result = false; // Update each button for(CItemArray::const_iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) { CToolbarButton* tbtn = dynamic_cast<CToolbarButton*>((*iter).mWnd); if ((tbtn != NULL) && ((*iter).mDetails.GetItem()->GetTitleID() == CToolbarManager::eToolbar_ApplyRules)) { // Reset button title cdstring title; // The name is actual the uid encoded as a string unsigned long uid = ::strtoul((*iter).mDetails.GetExtraInfo(), NULL, 10); if (uid > 0) { const CFilterItem* filter = CPreferences::sPrefs->GetFilterManager()->GetManualFilter(uid); if (filter) title = filter->GetName(); } else title = rsrc::GetString("CToolbarManager::AllRules"); cdstring newtitle(title); cdstring oldtitle; tbtn->GetTitle(oldtitle); if (newtitle != oldtitle) { tbtn->SetTitle(newtitle); result = true; } } } return result; } // Display and track context menu void CToolbar::OnContextMenu(CWnd* wnd, CPoint point) { // Convert event point to a local point CPoint client_point(point); ScreenToClient(&client_point); // Find the item under the mouse CWnd* pane = ChildWindowFromPoint(client_point, CWP_ALL); if (pane == this) pane = NULL; // Always make sure fly-over acti vation is disabled when doing context if (pane != NULL) pane->SendMessage(WM_MOUSELEAVE); // Create popup menu CMenu popup; popup.LoadMenu(IDR_POPUP_CONTEXT_TOOLBAR); CMenu* pPopup = popup.GetSubMenu(0); // Fill add menu with items CIconMenu* submenu = new CIconMenu; submenu->CreatePopupMenu(); CString old_str; pPopup->GetMenuString(3, old_str, MF_BYPOSITION); pPopup->ModifyMenu(3, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT) submenu->m_hMenu, old_str); // Place holder for apply rules popup if present CIconMenu* apply_rules = NULL; // Get the allowed toolbar items const CToolbarItem::CToolbarPtrItems& items = CToolbarManager::sToolbarManager.GetAllowedToolbarItems(GetType()); // Add each one UINT pos = IDM_TOOLBAR_ADD_Start; unsigned long apply_rules_index = 0; for(CToolbarItem::CToolbarPtrItems::const_iterator iter = items.begin(); iter != items.end(); iter++, pos++) { // Insert menu item cdstring temp = CToolbarManager::sToolbarManager.GetDescriptor((*iter).GetItem()->GetTitleID()); // Look for apply rules sub menu and treat differently if ((*iter).GetItem()->GetTitleID() == CToolbarManager::eToolbar_ApplyRules) { apply_rules_index = pos; if (apply_rules == NULL) { apply_rules = new CIconMenu; apply_rules->CreatePopupMenu(); submenu->AppendMenu(MF_BYPOSITION | MF_POPUP | MF_OWNERDRAW, (UINT) apply_rules->m_hMenu, (const TCHAR*)submenu->AddData(new CIconMenu::SIconMenuData(temp, IDI_RULESICON))); } // Add All item apply_rules->AppendMenu(MF_BYPOSITION | MF_OWNERDRAW, IDM_TOOLBAR_RULES_All, (const TCHAR*)apply_rules->AddData(new CIconMenu::SIconMenuData(rsrc::GetString("CToolbarManager::AllRules"), IDI_RULESICON))); apply_rules->AppendMenu(MF_SEPARATOR, 0, (TCHAR*) NULL); // Disable All item if already in the toolbar cdstring temp(0UL); if (GetButton(CToolbarManager::eToolbar_ApplyRules, temp) != NULL) apply_rules->EnableMenuItem(IDM_TOOLBAR_RULES_All, MF_BYCOMMAND | MF_GRAYED); // Now fill the menu with apply rules items // Get all manual filters cdstrvect items; CPreferences::sPrefs->GetFilterManager()->GetManualFilters(items); // Add each one to menu UINT rules_pos = IDM_TOOLBAR_RULES_Start; for(cdstrvect::const_iterator iter2 = items.begin(); iter2 != items.end(); iter2++, rules_pos++) { apply_rules->AppendMenu(MF_BYPOSITION | MF_OWNERDRAW, rules_pos, (const TCHAR*)apply_rules->AddData(new CIconMenu::SIconMenuData(*iter2, IDI_RULESICON))); // Get filter UID for rule const CFilterItem* filter = CPreferences::sPrefs->GetFilterManager()->GetFilter(CFilterItem::eLocal, *iter2); if (filter != NULL) { cdstring temp(filter->GetUID()); // Disable ones already in the toolbar if (GetButton(CToolbarManager::eToolbar_ApplyRules, temp) != NULL) apply_rules->EnableMenuItem(rules_pos, MF_BYCOMMAND | MF_GRAYED); } } } else { submenu->AppendMenu(MF_STRING | MF_BYPOSITION | MF_OWNERDRAW, pos, (const TCHAR*)submenu->AddData(new CIconMenu::SIconMenuData(temp, (*iter).GetItem()->GetIconID()))); // See whether item is already present (allow multiple separators and ordinary space) if (((*iter).GetItem()->GetType() != CToolbarItem::eSeparator) && ((*iter).GetItem()->GetType() != CToolbarItem::eSpace) && (GetItem(static_cast<CToolbarManager::EToolbarItem>((*iter).GetItem()->GetTitleID())) != NULL)) submenu->EnableMenuItem(pos, MF_BYCOMMAND | MF_GRAYED); } } // Remove button specific items if not over a button CRect portRect; bool drawing = false; if (pane == NULL) { pPopup->DeleteMenu(0, MF_BYPOSITION); pPopup->DeleteMenu(0, MF_BYPOSITION); pPopup->DeleteMenu(0, MF_BYPOSITION); } else { // Adjust titles of menu items const CToolbarItem* details = mItemList.at(GetItemIndex(pane)).mDetails.GetItem(); cdstring btnname = CToolbarManager::sToolbarManager.GetTitle(details->GetTitleID()); { CString old_str; pPopup->GetMenuString(IDM_TOOLBAR_REMOVE, old_str, MF_BYCOMMAND); cdstring temp(old_str); temp.Substitute(btnname); pPopup->ModifyMenu(IDM_TOOLBAR_REMOVE, MF_BYCOMMAND | MF_STRING, IDM_TOOLBAR_REMOVE, temp.win_str()); } { CString old_str; pPopup->GetMenuString(IDM_TOOLBAR_MOVE, old_str, MF_BYCOMMAND); cdstring temp(old_str); temp.Substitute(btnname); pPopup->ModifyMenu(IDM_TOOLBAR_MOVE, MF_BYCOMMAND | MF_STRING, IDM_TOOLBAR_MOVE, temp.win_str()); } // Draw insert marker // Is click to left or right side of current item bool left = true; pane->GetWindowRect(portRect); left = (point.x < (portRect.left + portRect.right) / 2); if (left) { portRect.left -= cDropCursorWidth/2; portRect.right = portRect.left + cDropCursorWidth; } else { portRect.right += cDropCursorWidth/2; portRect.left = portRect.right - cDropCursorWidth; } ScreenToClient(portRect); CRect myPort; GetClientRect(myPort); portRect.top = myPort.top; portRect.bottom = myPort.bottom; // Now draw the rect CDC* pDC = GetDC(); StDCState save(pDC); CPen pen; pen.CreatePen(PS_SOLID | PS_INSIDEFRAME, 3, CDrawUtils::sDkGrayColor); // Hilite outline pDC->SelectObject(&pen); pDC->Rectangle(portRect); drawing = true; } // Do popup menu of suggestions UINT popup_result = pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, point.x, point.y, this); // Remove any drawn cursor if (drawing) { RedrawWindow(portRect); } if (popup_result != 0) { bool handled = false; switch(popup_result) { case IDM_TOOLBAR_REMOVE: RemoveButton(pane); break; case IDM_TOOLBAR_MOVE: MoveButton(pane); break; case IDM_TOOLBAR_RESET: ResetButtons(true); break; default: if ((popup_result >= IDM_TOOLBAR_ADD_Start) && (popup_result <= IDM_TOOLBAR_ADD_End)) { // Get the item CToolbarManager::sToolbarManager.AddItemAt(GetType(), popup_result - IDM_TOOLBAR_ADD_Start, GetItemIndex(pane)); // Rebuild the toolbar ResetButtons(false); } else if ((popup_result >= IDM_TOOLBAR_RULES_All) && (popup_result <= IDM_TOOLBAR_RULES_End)) { // Get uid for item unsigned long uid = (popup_result == IDM_TOOLBAR_RULES_All) ? 0 : CPreferences::sPrefs->GetFilterManager()->GetManualUID(popup_result - IDM_TOOLBAR_RULES_Start); cdstring uid_txt(uid); // Get the item CToolbarManager::sToolbarManager.AddItemAt(GetType(), apply_rules_index - IDM_TOOLBAR_ADD_Start, GetItemIndex(pane), uid_txt); // Rebuild the toolbar ResetButtons(false); } break; } } } CToolbarButton* CToolbar::GetButton(CToolbarManager::EToolbarItem item) const { // Find the button of this type for(CItemArray::const_iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) { CToolbarButton* tbtn = dynamic_cast<CToolbarButton*>((*iter).mWnd); if ((tbtn != NULL) && static_cast<CToolbarManager::EToolbarItem>((*iter).mDetails.GetItem()->GetTitleID()) == item) return tbtn; } return NULL; } CToolbarButton* CToolbar::GetButton(CToolbarManager::EToolbarItem item, const cdstring& extra) const { // Find the button of this type with the same extra data for(CItemArray::const_iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) { CToolbarButton* tbtn = dynamic_cast<CToolbarButton*>((*iter).mWnd); if ((tbtn != NULL) && (static_cast<CToolbarManager::EToolbarItem>((*iter).mDetails.GetItem()->GetTitleID()) == item) && ((*iter).mDetails.GetExtraInfo() == extra)) return tbtn; } return NULL; } CWnd* CToolbar::GetItem(CToolbarManager::EToolbarItem item) const { // Find the button for this message for(CItemArray::const_iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) { if (((*iter).mDetails.GetItem() != NULL) && (static_cast<CToolbarManager::EToolbarItem>((*iter).mDetails.GetItem()->GetTitleID()) == item)) return (*iter).mWnd; } return NULL; } unsigned long CToolbar::GetItemIndex(CWnd* item) const { // Find index of pane in item list unsigned long index = 0; for(CItemArray::const_iterator iter = mItemList.begin(); iter != mItemList.end(); iter++, index++) { if ((*iter).mWnd == item) { break; } } return index; } void CToolbar::RemoveButton(CWnd* pane) { // Find index of pane in item list unsigned long index = 0; for(CItemArray::iterator iter = mItemList.begin(); iter != mItemList.end(); iter++, index++) { if ((*iter).mWnd == pane) { // Remove from toolbar manager prefs CToolbarManager::sToolbarManager.RemoveItemAt(GetType(), index); // Delete the button object delete (*iter).mWnd; mItemList.erase(iter); // Reset the toolbar ResetLayout(); return; } } } void CToolbar::MoveButton(CWnd* pane) { TrackStart(pane); } void CToolbar::TrackStart(CWnd* pane) { mDragIndex = GetItemIndex(pane); SetCapture(); // Tell each control to be active for(CItemArray::const_iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) { if ((*iter).mWnd != NULL) { (*iter).mWnd->EnableWindow(true); CToolbarButton* tbtn = dynamic_cast<CToolbarButton*>((*iter).mWnd); if (tbtn != NULL) tbtn->SetDragMode(true); } } TrackHighlight(); } void CToolbar::TrackStop() { // Tell each control no longer dragging for(CItemArray::const_iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) { if ((*iter).mWnd != NULL) { CToolbarButton* tbtn = dynamic_cast<CToolbarButton*>((*iter).mWnd); if (tbtn != NULL) tbtn->SetDragMode(false); } } mDragIndex = 0xFFFFFFFF; // Always reset state UpdateToolbarState(); RedrawWindow(); ReleaseCapture(); } void CToolbar::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { if (mDragIndex != 0xFFFFFFFF) { TrackStop(); } else CContainerWnd::OnKeyDown(nChar, nRepCnt, nFlags); } void CToolbar::OnLButtonDown(UINT nFlags, CPoint point) { if (mDragIndex != 0xFFFFFFFF) { TrackStop(); } else CContainerWnd::OnLButtonDown(nFlags, point); } // Clicked somewhere void CToolbar::OnRButtonDown(UINT nFlags, CPoint point) { if (mDragIndex != 0xFFFFFFFF) { TrackStop(); } else { // Do context menu ClientToScreen(&point); OnContextMenu(NULL, point); } } void CToolbar::OnMouseMove(UINT nFlags, CPoint point) { if (mDragIndex != 0xFFFFFFFF) { TrackMouseMove(point); } else CContainerWnd::OnMouseMove(nFlags, point); } void CToolbar::TrackMouseMove(CPoint point) { // Find the item under the mouse unsigned long new_index = mDragIndex; CWnd* new_pane = ChildWindowFromPoint(point, CWP_ALL); if (new_pane != NULL) { new_index = GetItemIndex(new_pane); // Apply hysteresis to movement to ensure panes with different sizes do not cause // rapid switches if (new_index != mDragIndex) { CRect old_portRect; mItemList.at(mDragIndex).mWnd->GetWindowRect(old_portRect); ScreenToClient(old_portRect); CRect new_portRect; mItemList.at(new_index).mWnd->GetWindowRect(new_portRect); ScreenToClient(new_portRect); if (new_index < mDragIndex) { // Only use new index if the mouse is within the old button size of the left edge of the new button if (point.x >= new_portRect.left + (old_portRect.right - old_portRect.left)) new_index = mDragIndex; } else { // Only use new index if the mouse is within the old button size of the right edge of the new button if (point.x < new_portRect.right - (old_portRect.right - old_portRect.left)) new_index = mDragIndex; } } } if (new_index != mDragIndex) { // Determine index of start/end panes CToolbarManager::sToolbarManager.MoveItemAt(GetType(), mDragIndex, new_index); SItemSpec temp = mItemList.at(mDragIndex); mItemList.erase(mItemList.begin() + mDragIndex); mItemList.insert(mItemList.begin() + new_index, temp); ResetLayout(); RedrawWindow(); mDragIndex = new_index; } // Draw highlight around moved button TrackHighlight(); } void CToolbar::TrackHighlight() { CRect portRect; mItemList.at(mDragIndex).mWnd->GetWindowRect(portRect); ScreenToClient(portRect); // Now draw the rect CDC* pDC = GetDC(); StDCState save(pDC); // Hilite outline for(int i = 0; i < 4; i++) { pDC->FrameRect(portRect, &CDrawUtils::sDkGrayBrush); portRect.DeflateRect(1, 1); } } void CToolbar::ResetButtons(bool use_default) { // Remove all buttons for(CItemArray::iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) { // Delete the button object delete (*iter).mWnd; } mItemList.clear(); // Reset to default state if (use_default) CToolbarManager::sToolbarManager.ResetToolbar(GetType()); // Clear positions mLeftJustOffset = cBtnStart; // Rebuild the toolbar BuildToolbar(); UpdateToolbarState(); RedrawWindow(); } // Force update of state if items visible void CToolbar::UpdateToolbarState() { // Do actual update only if items are visible DoUpdateToolbarState(); } // Force update of state void CToolbar::DoUpdateToolbarState() { // Update each button for(CItemArray::const_iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) { CToolbarButton* tbtn = dynamic_cast<CToolbarButton*>((*iter).mWnd); if (tbtn) UpdateControlState(tbtn, (*iter).mDetails.GetItem()->GetCommand()); } } void CToolbar::ShowToolbar(bool show) { // Only do if different if (show ^ mShowIt) { mShowIt = show; ShowWindow(show ? SW_SHOW : SW_HIDE); } } void CToolbar::SmallIcons(bool small_icon) { if (mSmallIcons ^ small_icon) { mSmallIcons = small_icon; Reset(); } } void CToolbar::ShowIcons(bool show) { if (mShowIcons ^ show) { mShowIcons = show; Reset(); } } void CToolbar::ShowCaptions(bool show) { if (mShowCaptions ^ show) { mShowCaptions = show; Reset(); } }
y-polek/AppCompat-Extension-Library
appcompat-extension/src/main/java/com/tr4android/support/extension/drawable/PlaceholderDrawable.java
package com.tr4android.support.extension.drawable; import android.content.Context; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.support.annotation.ColorInt; import android.support.annotation.DrawableRes; import android.support.annotation.StringRes; import android.support.v4.content.ContextCompat; import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v7.widget.AppCompatDrawableManager; import com.tr4android.appcompat.extension.R; import com.tr4android.support.extension.utils.ThemeUtils; public class PlaceholderDrawable extends Drawable { // paint used for drawing the colored circle private Paint mPlaceholderCirclePaint; // paint used for drawing the placeholder text private Paint mPlaceholderTextPaint; // size of the placeholder icon private int mPlaceholderImageSize; // color of the placeholder icon private int mPlaceholderImageColor; // paint used for drawing the placeholder icon private Drawable mPlaceholderImage; // placeholder text (usually the first letter of a name) private String mPlaceholderText = ""; public PlaceholderDrawable(int placeholderTextSize, int placeholderTextColor, int placeholderImageSize, int placeholerImageColor) { mPlaceholderImageSize = placeholderImageSize; mPlaceholderImageColor = placeholerImageColor; mPlaceholderCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPlaceholderTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPlaceholderTextPaint.setTextAlign(Paint.Align.CENTER); mPlaceholderTextPaint.setTextSize(placeholderTextSize); mPlaceholderTextPaint.setColor(placeholderTextColor); } /** * Set a placeholder with a text and circle color. * <p/> * Note: This usually should be the first letter of a name. You can use the helper * {@link com.tr4android.support.extension.widget.CircleImageView#retrieveLetter(String)} * to extract the first letter of a given {@link String}. * * @param placeholderText Placeholder text to display in the middle of the circle * @param circleColor Color to use for the circle */ public void setPlaceholder(String placeholderText, @ColorInt int circleColor) { mPlaceholderImage = null; mPlaceholderText = placeholderText; mPlaceholderCirclePaint.setColor(circleColor); } /** * Set a placeholder with an image and circle color. * * @param drawable The placeholder drawable * @param circleColor Color to use for the circle */ public void setPlaceholder(Drawable drawable, @ColorInt int circleColor) { mPlaceholderImage = tintDrawable(drawable, mPlaceholderImageColor); mPlaceholderText = ""; mPlaceholderCirclePaint.setColor(circleColor); } @Override public void draw(Canvas canvas) { Rect bounds = getBounds(); // draw placeholder circle float radius = Math.min(bounds.width(), bounds.height()) / 2f; float xPos = bounds.left + (bounds.width() / 2f); canvas.drawCircle(xPos, bounds.top + bounds.height() / 2f, radius, mPlaceholderCirclePaint); if (mPlaceholderImage == null) { // draw placeholder text float yPos = (bounds.top + (bounds.height() / 2f) - ((mPlaceholderTextPaint.descent() + mPlaceholderTextPaint.ascent()) / 2f)); canvas.drawText(mPlaceholderText, xPos, yPos, mPlaceholderTextPaint); } else { // draw placeholder image int horizontalPadding = (bounds.width() - mPlaceholderImageSize) / 2; int verticalPadding = (bounds.height() - mPlaceholderImageSize) / 2; mPlaceholderImage.setBounds(bounds.left + horizontalPadding, bounds.top + verticalPadding, bounds.right - horizontalPadding, bounds.bottom - verticalPadding); mPlaceholderImage.draw(canvas); } } @Override public void setAlpha(int i) { mPlaceholderCirclePaint.setAlpha(i); } @Override public void setColorFilter(ColorFilter colorFilter) { mPlaceholderCirclePaint.setColorFilter(colorFilter); } @Override public int getOpacity() { return PixelFormat.TRANSLUCENT; } // Helper that wraps and tints a drawable private Drawable tintDrawable(Drawable drawable, @ColorInt int color) { final Drawable tintDrawable = DrawableCompat.wrap(drawable.mutate()); DrawableCompat.setTint(tintDrawable, color); return tintDrawable; } public static class Builder { Context mContext; int mPlaceholderTextSize; int mPlaceholderTextColor; int mPlaceholderImageSize; int mPlaceholderImageColor; int mPlaceholderCircleColor; String mPlaceholderString = ""; Drawable mPlaceholderDrawable = null; public Builder(Context context) { mContext = context; mPlaceholderTextSize = context.getResources() .getDimensionPixelSize(R.dimen.defaultPlaceholderTextSize); mPlaceholderTextColor = ThemeUtils.getThemeAttrColor(context, android.R.attr.textColorPrimaryInverse); mPlaceholderImageSize = context.getResources() .getDimensionPixelSize(R.dimen.defaultPlaceholderImageSize); mPlaceholderImageColor = ThemeUtils.getThemeAttrColor(context, android.R.attr.textColorPrimaryInverse); mPlaceholderCircleColor = ThemeUtils.getThemeAttrColor(context, R.attr.colorAccent); } public Builder setPlaceholderTextSize(int textSize) { mPlaceholderTextSize = textSize; return this; } public Builder setPlaceholderTextColor(@ColorInt int color) { mPlaceholderTextColor = color; return this; } public Builder setPlaceholderImageSize(int imageSize) { mPlaceholderImageSize = imageSize; return this; } public Builder setPlaceholderImageColor(@ColorInt int color) { mPlaceholderImageColor = color; return this; } public Builder setPlaceholderCircleColor(@ColorInt int color) { mPlaceholderCircleColor = color; return this; } public Builder setPlaceholderText(@StringRes int resid) { return setPlaceholderText(mContext.getResources().getString(resid)); } public Builder setPlaceholderText(String string) { mPlaceholderString = string; mPlaceholderDrawable = null; return this; } public Builder setPlaceholderImage(@DrawableRes int resId) { return setPlaceholderImage(AppCompatDrawableManager.get().getDrawable(mContext, resId)); } public Builder setPlaceholderImage(Drawable drawable) { mPlaceholderDrawable = drawable; mPlaceholderString = ""; return this; } public PlaceholderDrawable build() { PlaceholderDrawable drawable = new PlaceholderDrawable( mPlaceholderTextSize, mPlaceholderTextColor, mPlaceholderImageSize, mPlaceholderImageColor); if (mPlaceholderDrawable == null) { drawable.setPlaceholder(mPlaceholderString, mPlaceholderCircleColor); } else { drawable.setPlaceholder(mPlaceholderDrawable, mPlaceholderCircleColor); } return drawable; } } }
krico/trocado
src/main/java/to/cwa/trocado/expense/om/Expense.java
package to.cwa.trocado.expense.om; import com.google.appengine.api.datastore.Category; import com.googlecode.objectify.Ref; import com.googlecode.objectify.annotation.*; import to.cwa.trocado.account.om.Account; import to.cwa.trocado.om.HasId; import to.cwa.trocado.util.ObjectsUtil; import java.math.BigDecimal; import java.util.Date; /** * @author krico * @since 10/02/16. */ @Entity public class Expense implements HasId<Long> { @Id private Long id; /** * Creation date of this expense (first time it was saved) */ @Index private Date created; /** * Last time this expense was modified */ @Index private Date modified; /** * when this expense happened */ @Index private Date date; private String description; private BigDecimal amount; @Index private Category origin; /** * The account to which this expense belongs */ @Index @Load private Ref<Account> account; public Expense() { this(Origins.User); } protected Expense(Category origin, String description, BigDecimal amount, Date date) { this(origin); this.description = description; this.amount = amount; this.date = date; } protected Expense(Category origin) { this.origin = origin; } @SuppressWarnings("UnusedDeclaration") @OnSave void updateDates() { modified = new Date(); if (created == null) created = modified; if (date == null) date = created; } @Override public Long getId() { return id; } @Override public void setId(Long id) { this.id = id; } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created; } public Date getModified() { return modified; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public Category getOrigin() { return origin; } public Account getAccount() { return ObjectsUtil.get(account); } public void setAccount(Account account) { this.account = Ref.create(account); } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Expense)) return false; Expense expense = (Expense) o; if (id != null ? !id.equals(expense.id) : expense.id != null) return false; if (created != null ? !created.equals(expense.created) : expense.created != null) return false; if (modified != null ? !modified.equals(expense.modified) : expense.modified != null) return false; if (date != null ? !date.equals(expense.date) : expense.date != null) return false; if (description != null ? !description.equals(expense.description) : expense.description != null) return false; if (amount != null ? !amount.equals(expense.amount) : expense.amount != null) return false; return origin != null ? origin.equals(expense.origin) : expense.origin == null; } @Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (created != null ? created.hashCode() : 0); result = 31 * result + (modified != null ? modified.hashCode() : 0); result = 31 * result + (date != null ? date.hashCode() : 0); result = 31 * result + (description != null ? description.hashCode() : 0); result = 31 * result + (amount != null ? amount.hashCode() : 0); result = 31 * result + (origin != null ? origin.hashCode() : 0); return result; } @Override public String toString() { return "Expense{" + "id=" + id + ", created=" + created + ", modified=" + modified + ", date=" + date + ", description='" + description + '\'' + ", amount=" + amount + ", origin=" + ObjectsUtil.toString(origin) + '}'; } }
jsloop42/dreamlisp
DreamLisp/DLAlgorithm.h
<reponame>jsloop42/dreamlisp // // DLAlgorithm.h // DreamLisp // // Created by <NAME> on 07/07/19. // Copyright © 2019 <NAME>. All rights reserved. // #import <Foundation/Foundation.h> #import "DLTypes.h" NS_ASSUME_NONNULL_BEGIN #define DLAlgo DLAlgorithm @interface DLAlgorithm : NSObject #pragma mark Sort + (void)introSort:(NSMutableArray *)xs isAscending:(BOOL)isAscending; + (void)quickSort:(NSMutableArray *)xs isAscending:(BOOL)isAscending; + (void)heapSort:(NSMutableArray *)xs isAscending:(BOOL)isAscending; + (void)insertionSort:(NSMutableArray *)xs isAscending:(BOOL)isAscending; @end NS_ASSUME_NONNULL_END
alexlee-dev/grommet-patterns
src/components/Classification.js
import React from 'react' import PropTypes from 'prop-types' import { Box, Heading, Grid, ResponsiveContext } from 'grommet' const Classification = ({ children, index = 0, name }) => { return ( <ResponsiveContext.Consumer> {size => ( <Box pad={{ vertical: 'medium' }} animation={[ { type: 'zoomIn', duration: 500, delay: 100 + 100 * index }, { type: 'fadeIn', duration: 500, delay: 100 * index } ]} > <Heading level={2} margin={{ top: 'none', horizontal: 'small' }}> {name} </Heading> {Grid.available ? ( <Grid columns={{ count: 'fit', size: size === 'small' ? 'small' : 'medium' }} rows="small" gap={{ row: 'medium' }} > {children} </Grid> ) : ( <Box direction="row" wrap> {React.Children.map(children, child => ( <Box basis="small" pad="small"> <Box basis="small">{child}</Box> </Box> ))} </Box> )} </Box> )} </ResponsiveContext.Consumer> ) } Classification.propTypes = { name: PropTypes.string } export default Classification
otaviotech/insta-clone
src/presentation/controllers/profile/follow.test.js
<reponame>otaviotech/insta-clone import { jest } from '@jest/globals'; import { FollowController } from './follow'; import { ForbiddenError, ResourceNotFoundError } from '../../../domain/errors'; describe('FollowController', () => { const makeSut = () => { const followUseCaseStub = { follow: jest.fn(() => Promise.resolve({ status: 'PENDING' })), }; const followInputValidatorStub = { validate: jest.fn(() => Promise.resolve({ isValid: true, errors: [] })), }; const sut = new FollowController({ followInputValidator: followInputValidatorStub, followUseCase: followUseCaseStub, }); const validInput = { body: { followerProfileId: 2, }, params: { profileId: 1, }, user: { id: 1, }, }; const validUseCaseInput = { profileId: 1, followerProfileId: 2, followerUserId: 1, }; return { sut, followUseCaseStub, followInputValidatorStub, validInput, validUseCaseInput, }; }; it('it should call the Validator and the FollowUseCase', async () => { const { sut, followUseCaseStub, validInput, validUseCaseInput } = makeSut(); const result = await sut.handle(validInput); expect(result.statusCode).toBe(200); expect(result.data).toEqual({ status: 'PENDING' }); expect(followUseCaseStub.follow).toHaveBeenCalledWith(validUseCaseInput); expect(result.error).toBeUndefined(); }); const domainErrors = [ { DomainError: ResourceNotFoundError, name: ResourceNotFoundError.name, status: 404, }, { DomainError: ForbiddenError, name: ForbiddenError.name, status: 403, }, ]; it.each(domainErrors)( 'should return $status if the domain error ($name) is thrown', async ({ DomainError, status }) => { const { sut, validInput, followUseCaseStub } = makeSut(); const errorThrown = new DomainError(); jest.spyOn(followUseCaseStub, 'follow').mockImplementationOnce(() => { throw errorThrown; }); const httpResponse = await sut.handle(validInput); expect(httpResponse.statusCode).toBe(status); expect(httpResponse.error).toEqual(errorThrown); expect(httpResponse.data).toBeUndefined(); }, ); it('should throw if error is not a RequestValidationError nor a DomainError', async () => { const { sut, validInput, followUseCaseStub } = makeSut(); const errorThrown = new Error('Error thrown by FollowUseCase.follow'); jest.spyOn(followUseCaseStub, 'follow').mockImplementationOnce(() => { throw errorThrown; }); const promise = sut.handle(validInput); expect(promise).rejects.toThrow(errorThrown); }); });
benfromchina/jarvis-security
jarvis-security-social/src/main/java/com/stark/jarvis/security/social/client/userinfo/OAuth2UserRequestEntityConverterProviderManager.java
<gh_stars>1-10 /* * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.stark.jarvis.security.social.client.userinfo; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.convert.converter.Converter; import org.springframework.http.RequestEntity; import org.springframework.security.oauth2.client.userinfo.OAuth2UserRequest; import org.springframework.security.oauth2.client.userinfo.OAuth2UserRequestEntityConverter; import org.springframework.stereotype.Component; import com.nimbusds.oauth2.sdk.util.CollectionUtils; /** * A {@link Converter} that converts the provided {@link OAuth2UserRequest} * to a {@link RequestEntity} representation of a request for the UserInfo Endpoint. * * @author <NAME> * @since 5.1 * @see Converter * @see OAuth2UserRequest * @see RequestEntity */ @Component public class OAuth2UserRequestEntityConverterProviderManager implements Converter<OAuth2UserRequest, RequestEntity<?>> { @Autowired(required = false) private List<OAuth2UserRequestEntityConverterProvider> providers; private OAuth2UserRequestEntityConverter delegate = new OAuth2UserRequestEntityConverter(); /** * Returns the {@link RequestEntity} used for the UserInfo Request. * * @param userRequest the user request * @return the {@link RequestEntity} used for the UserInfo Request */ @Override public RequestEntity<?> convert(OAuth2UserRequest userRequest) { if (CollectionUtils.isNotEmpty(providers)) { for (OAuth2UserRequestEntityConverterProvider provider : providers) { if (provider.supports(userRequest.getClientRegistration())) { return provider.convert(userRequest); } } } return delegate.convert(userRequest); } }
iivanov03/Softuni-JS
Programming Basics/sumSecond.js
<gh_stars>0 function solve(firstTime, secondTime, thirdTime){ firstTime = Number(firstTime); secondTime = Number(secondTime); thirdTime = Number(thirdTime); let totalSecond = firstTime + secondTime + thirdTime; let minutes = Math.trunc(totalSecond / 60); let second = totalSecond % 60; if (second < 10){ console.log(`${minutes}:0${second}`); } else{ console.log(`${minutes}:${second}`); } } solve("35", "45", "44");
phatblat/macOSPrivateFrameworks
PrivateFrameworks/FinderKit/FI_TPathBarController.h
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // #import <FinderKit/FI_TViewController.h> #import "NSMenuDelegate.h" #import "TMarkTornDown.h" #import "TNodeObserverProtocol.h" #import "TPathControlDelegate.h" @class FI_TBrowserContainerController, FI_TPathControl, NSString; __attribute__((visibility("hidden"))) @interface FI_TPathBarController : FI_TViewController <TPathControlDelegate, TNodeObserverProtocol, NSMenuDelegate, TMarkTornDown> { FI_TPathControl *_pathControl; struct shared_ptr<TNodeObserverCocoaBridge> _nodeObserver; struct TNSWeakPtr<FI_TBrowserContainerController, void> _containerController; struct TFENodeVector _commonPathVector; struct TFENodeVector _observedSelection; struct TNotificationCenterObserver _backingPropertiesChangedObserver; struct TKeyValueObserver _effectiveAppearanceObserver; TNSWeakPtr_a131d41e _refreshToken; _Bool tornDown; } + (double)defaultPathBarHeight; @property(getter=isTornDown) _Bool tornDown; // @synthesize tornDown; - (id).cxx_construct; - (void).cxx_destruct; - (void)nodeObserver:(struct TNodeObserver *)arg1 nodeDeleted:(const struct TFENode *)arg2 fromObservedNode:(const struct TFENode *)arg3; - (void)nodeObserver:(struct TNodeObserver *)arg1 nodeChanged:(const struct TFENode *)arg2 inObservedNode:(const struct TFENode *)arg3 property:(unsigned int)arg4; - (void)scheduleUpdate; - (void)refresh; - (void)pathControlDoubleClick:(id)arg1; - (const struct TFENode *)nodeInPathBar:(id)arg1 forLocation:(struct CGPoint)arg2; - (const struct TFENode *)nodeForCell:(id)arg1; - (void)updateSelection:(const struct TFENodeVector *)arg1 forceUpdate:(_Bool)arg2; - (void)setTarget:(const struct TFENode *)arg1 selection:(const struct TFENodeVector *)arg2; - (_Bool)commonPathForNode:(const struct TFENode *)arg1 andSelection:(const struct TFENodeVector *)arg2; - (_Bool)preflightSelection:(const struct TFENodeVector *)arg1 commonParent:(struct TFENode *)arg2; - (void)updatePathComponents; - (void)clearCommonPathNodes; - (void)clearObservedSelection; @property(readonly) __weak FI_TBrowserContainerController *containerController; - (void)aboutToTearDown; - (void)viewLoaded; - (void)dealloc; - (void)initCommon; - (id)initWithContainerController:(id)arg1; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
moonreporter/GodSaveTheLPs
Docs/node_modules/@styled-icons/fa-solid/Ankh/Ankh.js
"use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.AnkhDimensions = exports.Ankh = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var React = _interopRequireWildcard(require("react")); var _styledIcon = require("@styled-icons/styled-icon"); var Ankh = /*#__PURE__*/React.forwardRef(function (props, ref) { var attrs = { "fill": "currentColor", "xmlns": "http://www.w3.org/2000/svg" }; return /*#__PURE__*/React.createElement(_styledIcon.StyledIconBase, (0, _extends2.default)({ iconAttrs: attrs, iconVerticalAlign: "middle", iconViewBox: "0 0 320 512" }, props, { ref: ref }), /*#__PURE__*/React.createElement("path", { fill: "currentColor", d: "M296 256h-44.62C272.46 222.01 288 181.65 288 144 288 55.63 230.69 0 160 0S32 55.63 32 144c0 37.65 15.54 78.01 36.62 112H24c-13.25 0-24 10.74-24 24v32c0 13.25 10.75 24 24 24h96v152c0 13.25 10.75 24 24 24h32c13.25 0 24-10.75 24-24V336h96c13.25 0 24-10.75 24-24v-32c0-13.26-10.75-24-24-24zM160 80c29.61 0 48 24.52 48 64 0 34.66-27.14 78.14-48 100.87-20.86-22.72-48-66.21-48-100.87 0-39.48 18.39-64 48-64z" })); }); exports.Ankh = Ankh; Ankh.displayName = 'Ankh'; var AnkhDimensions = { height: 512, width: 320 }; exports.AnkhDimensions = AnkhDimensions;
JustinGOSSES/pyrolite
pyrolite/plot/templates/__init__.py
<filename>pyrolite/plot/templates/__init__.py """ A utility submodule for standardised plot templates to be added to matplotlib axes. """ from .pearce import pearceThNbYb, pearceTiNbYb from .TAS import TAS __all__ = ["pearceThNbYb", "pearceTiNbYb", "TAS"]
Wlgen/force-riscv
py/riscv/GenSemaphoreRISCV.py
# # Copyright (C) [2020] Futurewei Technologies, Inc. # # FORCE-RISCV is 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 # # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES # OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO # NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. # See the License for the specific language governing permissions and # limitations under the License. # from base.GenSemaphore import GenSemaphore from riscv.Utils import LoadGPR64 class GenSemaphoreRISCV(GenSemaphore): def __init__(self, aGenThread, aName, aCounter, aSize): super().__init__(aGenThread, aName, aCounter, "", aSize=aSize) self._mCounterReg = None self._mStatusReg = None with self.threadLockingContext(): self.mAddrReg = self.getRandomGPR(exclude="0", no_skip=True) self.reserveRegister("x%d" % self.mAddrReg) self._reloadSemaphore() def __enter__(self): self._acquireSemaphore() return self def __exit__(self, *aUnused): self._releaseSemaphore() return False def cleanUp(self): with self.threadLockingContext(): self.unreserveRegister("x%d" % self.mAddrReg) def _acquireSemaphore(self): (self._mCounterReg, self._mStatusReg) = self.getRandomGPRs(2, exclude="0") block_id = self.beginLinearBlock() self.genInstruction( self._getLoadReservedInstruction(), { "rd": self._mCounterReg, "rs1": self.mAddrReg, "LSTarget": self.mSemaVA, "NoRestriction": 1, }, ) # Load the counter self.genInstruction( "BEQ##RISCV", { "rs1": self._mCounterReg, "rs2": 0, "simm12": (-2 & 0xFFF), "NoBnt": 1, "NoRestriction": 1, }, ) # Retry if the counter is 0 self.genInstruction( "ADDI##RISCV", { "rd": self._mCounterReg, "rs1": self._mCounterReg, "simm12": (-1 & 0xFFF), }, ) # Decrement the counter self.genInstruction( self._getStoreConditionalInstruction(), { "rd": self._mStatusReg, "rs1": self.mAddrReg, "rs2": self._mCounterReg, "LSTarget": self.mSemaVA, "NoRestriction": 1, }, ) # Store the counter self.genInstruction( "BNE##RISCV", { "rs1": self._mStatusReg, "rs2": 0, "simm12": (-8 & 0xFFF), "NoBnt": 1, "NoRestriction": 1, }, ) # Retry the whole sequence if the store fails # Set the maximum numer of instructions to re-execute such that the # whole sequence could be executed from the start no matter where in # the sequence the thread resumes execution; i.e. if the thread resumes # on the second instruction, it could execute until it loops back to # the start and then execute the entire sequence. self.endLinearBlock(block_id, max_re_execution_instructions=9) def _releaseSemaphore(self): block_id = self.beginLinearBlock() self.genInstruction( self._getLoadReservedInstruction(), { "rd": self._mCounterReg, "rs1": self.mAddrReg, "LSTarget": self.mSemaVA, "NoRestriction": 1, }, ) # Load the counter self.genInstruction( "ADDI##RISCV", {"rd": self._mCounterReg, "rs1": self._mCounterReg, "simm12": 1}, ) # Increment the counter self.genInstruction( self._getStoreConditionalInstruction(), { "rd": self._mStatusReg, "rs1": self.mAddrReg, "rs2": self._mCounterReg, "LSTarget": self.mSemaVA, "NoRestriction": 1, }, ) # Store the counter self.genInstruction( "BNE##RISCV", { "rs1": self._mStatusReg, "rs2": 0, "simm12": (-6 & 0xFFF), "NoBnt": 1, "NoRestriction": 1, }, ) # Retry the whole sequence if the store fails # Set the maximum numer of instructions to re-execute such that the # whole sequence could be executed from the start no matter where in # the sequence the thread resumes execution; i.e. if the thread resumes # on the second instruction, it could execute until it loops back to # the start and then execute the entire sequence. self.endLinearBlock(block_id, max_re_execution_instructions=7) self._mCounterReg = None self._mStatusReg = None def _loadAddressRegister(self): load_gpr64_seq = LoadGPR64(self.genThread) load_gpr64_seq.load(self.mAddrReg, self.mSemaVA) def _getLoadReservedInstruction(self): raise NotImplementedError def _getStoreConditionalInstruction(self): raise NotImplementedError class GenSemaphore32RISCV(GenSemaphoreRISCV): def __init__(self, aGenThread, aName, aCounter): super().__init__(aGenThread, aName, aCounter, 4) def _getLoadReservedInstruction(self): return "LR.W##RISCV" def _getStoreConditionalInstruction(self): return "SC.W##RISCV" class GenSemaphore64RISCV(GenSemaphoreRISCV): def __init__(self, aGenThread, aName, aCounter): super().__init__(aGenThread, aName, aCounter, 8) def _getLoadReservedInstruction(self): return "LR.D##RISCV" def _getStoreConditionalInstruction(self): return "SC.D##RISCV"
TranscendComputing/harp-runtime
lib/harp-runtime/version.rb
module Harp module Runtime VERSION = "0.1.0" end end
kattekrab/veyepar
setup/mkvhost.py
#!/usr/bin/python # makes an apache vhost config file based on settings.py import sys, os from distutils.sysconfig import get_python_lib sys.path.insert(0,'.') import settings # slug - the string used for user, database, config name, site name, etc. # slug = os.path.split(settings.PROJECT_ROOT)[-1] slug = settings.DATABASES['default']['NAME'] project_root = settings.PROJECT_ROOT static_root = settings.STATIC_ROOT static_url = settings.STATIC_URL site_packages = get_python_lib() vhost = """ # /etc/apache2/sites-available/%(slug)s.conf <VirtualHost *:80> ServerName %(slug)s ServerAlias www.%(slug)s.com %(slug)s.com ServerRoot /home/%(slug)s/ CustomLog %(slug)s_access.log common ErrorLog %(slug)s_error.log # WSGIDaemonProcess %(slug)s user=%(slug)s python-path=/home/%(slug)s/.local/lib/python2.5/site-packages/ WSGIDaemonProcess %(slug)s user=%(slug)s python-path=%(site_packages)s WSGIProcessGroup %(slug)s # Pinax 0.9a1 uses pinax.wsgi, a2 uses wsgi.py WSGIScriptAlias / %(project_root)s/deploy/pinax.wsgi # WSGIScriptAlias / %(project_root)s/deploy/wsgi.py Alias %(static_url)s %(static_root)s <Directory %(static_root)s> Order deny,allow Allow from all Options FollowSymLinks Indexes SymLinksIfOwnerMatch </Directory> </VirtualHost> """ print vhost % locals() # add this for debugging, not for production # http://httpd.apache.org/docs/current/mod/mod_info.html """ <Location /server-info> SetHandler server-info allow from all </Location> """
CEMES-CNRS/full_cost_git
full_cost/lab/admin.py
<gh_stars>0 from django.contrib import admin from simple_history.admin import SimpleHistoryAdmin # Register your models here. from .models import Group, Project, User, Price, Extraction, Gestionnaire admin.site.register(Price, SimpleHistoryAdmin) admin.site.register(Group, SimpleHistoryAdmin) admin.site.register(Project, SimpleHistoryAdmin) admin.site.register(User, SimpleHistoryAdmin) admin.site.register(Extraction, SimpleHistoryAdmin) admin.site.register(Gestionnaire, SimpleHistoryAdmin)
Chyroc/underscore
syncmap/map.go
package syncmap type Map interface { Delete(key interface{}) Range(f func(key, value interface{}) bool) Store(key, value interface{}) Load(key interface{}) (value interface{}, ok bool) LoadOrStore(key, value interface{}) (actual interface{}, loaded bool) }
JuliaComputing/arrayfire
examples/machine_learning/naive_bayes.cpp
/******************************************************* * Copyright (c) 2014, ArrayFire * All rights reserved. * * This file is distributed under 3-clause BSD license. * The complete license agreement can be obtained at: * http://arrayfire.com/licenses/BSD-3-Clause ********************************************************/ #include <arrayfire.h> #include <stdio.h> #include <vector> #include <string> #include <af/util.h> #include <math.h> #include "mnist_common.h" using namespace af; // Get accuracy of the predicted results float accuracy(const array& predicted, const array& target) { return 100 * count<float>(predicted == target) / target.elements(); } void naive_bayes_train(float *priors, array &mu, array &sig2, const array &train_feats, const array &train_classes, int num_classes) { const int feat_len = train_feats.dims(0); const int num_samples = train_classes.elements(); // Get mean and variance from trianing data mu = constant(0, feat_len, num_classes); sig2 = constant(0, feat_len, num_classes); for (int ii = 0; ii < num_classes; ii++) { array idx = where(train_classes == ii); array train_feats_ii = lookup(train_feats, idx, 1); mu(span, ii) = mean(train_feats_ii, 1); // Some pixels are always 0. Add a small variance. sig2(span,ii) = var(train_feats_ii, 0, 1) + 0.01; // Calculate priors priors[ii] = (float)idx.elements() / (float)num_samples; } mu.eval(); sig2.eval(); } array naive_bayes_predict(float *priors, const array &mu, const array &sig2, const array &test_feats, int num_classes) { int num_test = test_feats.dims(1); // Predict the probabilities for testing data // Using log of probabilities to reduce rounding errors array log_probs = constant(1, num_test, num_classes); for (int ii = 0; ii < num_classes; ii++) { // Tile the current mean and variance to the testing data size array Mu = tile(mu (span, ii), 1, num_test); array Sig2 = tile(sig2(span, ii), 1, num_test); // This is the same as log of the CDF of the normal distribution array Df = test_feats - Mu; array log_P = (-(Df * Df) / (2 * Sig2)) - log(sqrt(2 * af::Pi * Sig2)); // Accumulate the probabilities, multiply with priors (add log of priors) log_probs(span, ii) = log(priors[ii]) + sum(log_P).T(); } // Get the location of the maximum value array val, idx; max(val, idx, log_probs, 1); return idx; } void benchmark_nb(const array &train_feats, const array test_feats, const array &train_labels, int num_classes) { array mu, sig2; int iter = 25; float *priors = new float[num_classes]; timer::start(); for (int i = 0; i < iter; i++) { naive_bayes_train(priors, mu, sig2, train_feats, train_labels, num_classes); } af::sync(); printf("Training time: %4.4lf s\n", timer::stop() / iter); timer::start(); for (int i = 0; i < iter; i++) { naive_bayes_predict(priors, mu, sig2, test_feats, num_classes); } af::sync(); printf("Prediction time: %4.4lf s\n", timer::stop() / iter); delete[] priors; } void naive_bayes_demo(bool console, int perc) { array train_images, train_labels; array test_images, test_labels; int num_train, num_test, num_classes; // Load mnist data float frac = (float)(perc) / 100.0; setup_mnist<false>(&num_classes, &num_train, &num_test, train_images, test_images, train_labels, test_labels, frac); int feature_length = train_images.elements() / num_train; array train_feats = moddims(train_images, feature_length, num_train); array test_feats = moddims(test_images , feature_length, num_test ); // Get training parameters array mu, sig2; float *priors = new float[num_classes]; naive_bayes_train(priors, mu, sig2, train_feats, train_labels, num_classes); // Predict the classes array res_labels = naive_bayes_predict(priors, mu, sig2, test_feats, num_classes); delete[] priors; // Results printf("Trainng samples: %4d, Testing samples: %4d\n", num_train, num_test); printf("Accuracy on testing data: %2.2f\n", accuracy(res_labels , test_labels)); benchmark_nb(train_feats, test_feats, train_labels, num_classes); if (!console) { test_images = test_images.T(); test_labels = test_labels.T(); // FIXME: Crashing in mnist_common.h::classify //display_results<false>(test_images, res_labels, test_labels , 20); } } int main(int argc, char** argv) { int device = argc > 1 ? atoi(argv[1]) : 0; bool console = argc > 2 ? argv[2][0] == '-' : false; int perc = argc > 3 ? atoi(argv[3]) : 60; try { af::setDevice(device); af::info(); naive_bayes_demo(console, perc); } catch (af::exception &ae) { std::cerr << ae.what() << std::endl; } }
jnow-87/vimgdb
include/user_cmd/ui.h
#ifndef USER_UI_H #define USER_UI_H /* prototypes */ bool cmd_ui_exec(int argc, char **argv); void cmd_ui_help(int argc, char **argv); #endif // USER_UI_H
joshsoftware/peerly
go-backend/db/badge_test.go
<reponame>joshsoftware/peerly package db import ( "context" "github.com/DATA-DOG/go-sqlmock" "github.com/jmoiron/sqlx" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) type BadgeTestSuite struct { suite.Suite dbStore Storer db *sqlx.DB sqlmock sqlmock.Sqlmock } func (suite *BadgeTestSuite) SetupTest() { dbStore, dbConn, sqlmock := InitMockDB() suite.dbStore = dbStore suite.db = dbConn suite.sqlmock = sqlmock } func (suite *BadgeTestSuite) TearDownTest() { suite.db.Close() } func (suite *BadgeTestSuite) TestCreateBadgeSuccess() { badge := Badge{ ID: 1, Name: "<NAME>", OrganizationID: 1, Hi5CountRequired: 5, Hi5Frequency: "Monthly", } suite.sqlmock.ExpectBegin() suite.sqlmock.ExpectExec("INSERT INTO badge"). WithArgs(1, "Test badge", 1, 5, "Monthly"). WillReturnResult(sqlmock.NewResult(1, 1)) suite.sqlmock.ExpectCommit() CreatedBadge, err := suite.dbStore.CreateBadge(context.Background(), badge) assert.Nil(suite.T(), suite.sqlmock.ExpectationsWereMet()) assert.Equal(suite.T(), CreatedBadge, badge) assert.Nil(suite.T(), err) } func (suite *BadgeTestSuite) TestCreateBadgeFailure() { badge := Badge{ ID: 1, Name: "<NAME>", OrganizationID: 1, Hi5CountRequired: 5, Hi5Frequency: "Monthly", } suite.sqlmock.ExpectBegin() suite.sqlmock.ExpectExec("INSERT INTO badge"). WithArgs(1, "Test badge", 1, 5, "Monthly"). WillReturnResult(sqlmock.NewResult(1, 1)) suite.sqlmock.ExpectCommit() CreatedBadge, err := suite.dbStore.CreateBadge(context.Background(), badge) assert.NotEqual(suite.T(), badge, CreatedBadge) assert.NotNil(suite.T(), err) } func (suite *BadgeTestSuite) TestUpdateBadgeSuccess() { badge := Badge{ ID: 1, Name: "test badge", OrganizationID: 1, Hi5CountRequired: 5, Hi5Frequency: "Monthly", } suite.sqlmock.ExpectBegin() suite.sqlmock.ExpectExec("INSERT INTO users"). WithArgs(1, "test badge", 1, 5, "Monthly"). WillReturnResult(sqlmock.NewResult(1, 1)) suite.sqlmock.ExpectCommit() updatedBadge, err := suite.dbStore.UpdateBadge(context.Background(), badge) assert.Nil(suite.T(), suite.sqlmock.ExpectationsWereMet()) assert.Equal(suite.T(), updatedBadge, badge) assert.Nil(suite.T(), err) } func (suite *BadgeTestSuite) TestUpdateBadgeFailure() { badge := Badge{ ID: 1, Name: "test badge", OrganizationID: 1, Hi5CountRequired: 5, Hi5Frequency: "Monthly", } suite.sqlmock.ExpectBegin() suite.sqlmock.ExpectExec("INSERT INTO users"). WithArgs(1, "test badge", 1, 5, "Monthly"). WillReturnResult(sqlmock.NewResult(1, 1)) suite.sqlmock.ExpectCommit() updatedBadge, err := suite.dbStore.UpdateBadge(context.Background(), badge) assert.NotEqual(suite.T(), badge, updatedBadge) assert.NotNil(suite.T(), err) } func (suite *OrganizationTestSuite) TestDeleteBadgeSuccess() { suite.sqlmock.ExpectExec("DELETE"). WillReturnResult(sqlmock.NewResult(1, 1)) err := suite.dbStore.DeleteBadge(context.Background(), 1, 1) assert.Nil(suite.T(), err) }
mdsd-team-1/photos-metamodeling
co.edu.unal.mdd.photos.tests/src/PhotosMetaModel/tests/RequestTest.java
<reponame>mdsd-team-1/photos-metamodeling /** */ package PhotosMetaModel.tests; import PhotosMetaModel.PhotosMetaModelFactory; import PhotosMetaModel.Request; import junit.textui.TestRunner; /** * <!-- begin-user-doc --> * A test case for the model object '<em><b>Request</b></em>'. * <!-- end-user-doc --> * @generated */ public class RequestTest extends ActionsTest { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static void main(String[] args) { TestRunner.run(RequestTest.class); } /** * Constructs a new Request test case with the given name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RequestTest(String name) { super(name); } /** * Returns the fixture for this Request test case. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected Request getFixture() { return (Request)fixture; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see junit.framework.TestCase#setUp() * @generated */ @Override protected void setUp() throws Exception { setFixture(PhotosMetaModelFactory.eINSTANCE.createRequest()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see junit.framework.TestCase#tearDown() * @generated */ @Override protected void tearDown() throws Exception { setFixture(null); } } //RequestTest
Silthus/art-framework
api/src/main/java/io/artframework/ResolveContext.java
package io.artframework; import io.artframework.conf.KeyValuePair; import io.artframework.impl.DefaultResolveContext; import lombok.NonNull; import javax.annotation.Nullable; import java.util.List; import java.util.Optional; /** * The ResolutionContext holds additional information about the resolution of resolvers * and replacement of variables. * <p>Register your {@link Resolver} with the {@link ResolverProvider} and your {@link Replacement} * of variables with the {@link ReplacementProvider}. */ public interface ResolveContext extends Scoped { static ResolveContext of(@NonNull Scope scope, @NonNull ConfigMap configMap, @NonNull Class<?> type, @NonNull List<KeyValuePair> configValues, @Nullable Target<?> target, @Nullable ExecutionContext<?> executionContext) { return new DefaultResolveContext(scope, configMap, type, configValues, target, executionContext); } /** * The config map holds additional information about the configuration * of the resolver class and maps the {@link #configValues()} to their fields. * * @return the config map of the resolver */ ConfigMap configMap(); /** * @return the raw list of config key value pairs created by the parser */ List<KeyValuePair> configValues(); /** * @return the class of the type that is resolved by the resolver */ Class<?> type(); /** * @return the optional target that is available for the resolution */ Optional<Target<?>> target(); /** * @return the optional execution context that is available for the resolution */ Optional<ExecutionContext<?>> executionContext(); }
orionlibs/algos
src/algos/projecteuler/Problem7.java
package algos.projecteuler; import java.math.BigInteger; //10001st prime = https://projecteuler.net/problem=7 public class Problem7 { public static void main(String[] args) { System.out.println(solve()); } private static long solve() { long i = 2; long primeIndex = 0; while(true) { if(BigInteger.valueOf(i).isProbablePrime(50)) { ++primeIndex; if(primeIndex == 10001) { break; } } ++i; } return i; } }
nikosnikolaidis/sis
core/sis-utility/src/main/java/org/apache/sis/util/Debug.java
<filename>core/sis-utility/src/main/java/org/apache/sis/util/Debug.java /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.sis.util; import java.lang.annotation.Target; import java.lang.annotation.Retention; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.RetentionPolicy; /** * Annotates classes or methods that are provided mostly for debugging purpose. * This annotation is defined in order to make easier to find which debugging tools are available in case of problem. * See the <cite>"Use"</cite> javadoc link for a list of annotated classes and methods. * * <p>Unless specified otherwise in javadoc, {@link Object#toString()} method implementations in Apache SIS * are implicitly for debugging purpose. Those methods are usually <em>not</em> annotated with {@code @Debug} * in order to avoid polluting {@code @Debug} usage searches with long lists of {@code toString()} methods. * As an exception to this convention, a {@code toString()} method may be annotated with {@code @Debug} * in a few cases where we want to put emphasis on the method purpose as a debugging tools.</p> * * @author <NAME> (Geomatys) * @version 1.0 * @since 0.3 * @module */ @Documented @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.SOURCE) public @interface Debug { }