code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
#ifndef _STP_DEBUG_H_ #define _STP_DEBUG_H_ #include <linux/time.h> #include "osal.h" #define CONFIG_LOG_STP_INTERNAL #if 1//#ifndef CONFIG_LOG_STP_INTERNAL #define STP_PKT_SZ 16 #define STP_DMP_SZ 2048 #define STP_PKT_NO 2048 #define STP_DBG_LOG_ENTRY_NUM 2048 #define STP_DBG_LOG_ENTRY_SZ 2048 #else #define STP_PKT_SZ 16 #define STP_DMP_SZ 16 #define STP_PKT_NO 16 #define STP_DBG_LOG_ENTRY_NUM 28 #define STP_DBG_LOG_ENTRY_SZ 64 #endif typedef enum { STP_DBG_EN = 0, STP_DBG_PKT = 1, STP_DBG_DR = 2, STP_DBG_FW_ASSERT = 3, STP_DBG_FW_LOG = 4, STP_DBG_FW_DMP = 5, STP_DBG_MAX }STP_DBG_OP_T; typedef enum { STP_DBG_PKT_FIL_ALL = 0, STP_DBG_PKT_FIL_BT = 1, STP_DBG_PKT_FIL_GPS = 2, STP_DBG_PKT_FIL_FM = 3, STP_DBG_PKT_FIL_WMT = 4, STP_DBG_PKT_FIL_MAX } STP_DBG_PKT_FIL_T; static char * const gStpDbgType[9]={ "< BT>", "< FM>", "<GPS>", "<WiFi>", "<WMT>", "<STP>", "<DBG>", "<ANT>", "<UNKOWN>" }; typedef enum { STP_DBG_DR_MAX = 0, } STP_DBG_DR_FIL_T; typedef enum { STP_DBG_FW_MAX = 0, } STP_DBG_FW_FIL_T; typedef enum { PKT_DIR_RX = 0, PKT_DIR_TX } STP_DBG_PKT_DIR_T; /*simple log system ++*/ typedef struct { int id; /*type: 0. pkt trace 1. fw info 2. assert info 3. trace32 dump . -1. linked to the the previous*/ int len; char buffer[STP_DBG_LOG_ENTRY_SZ]; } MTKSTP_LOG_ENTRY_T; typedef struct log_sys { MTKSTP_LOG_ENTRY_T queue[STP_DBG_LOG_ENTRY_NUM]; unsigned int size; unsigned int in; unsigned int out; spinlock_t lock; } MTKSTP_LOG_SYS_T; /*--*/ typedef struct stp_dbg_pkt_hdr{ //packet information unsigned int sec; unsigned int usec; unsigned int dbg_type; unsigned int dmy; unsigned int no; unsigned int dir; //packet content unsigned int type; unsigned int len; unsigned int ack; unsigned int seq; unsigned int chs; unsigned int crc; }STP_DBG_HDR_T; typedef struct stp_dbg_pkt{ struct stp_dbg_pkt_hdr hdr; unsigned char raw[STP_DMP_SZ]; }STP_PACKET_T; typedef struct mtkstp_dbg_t{ /*log_sys*/ int pkt_trace_no; void *btm; int is_enable; MTKSTP_LOG_SYS_T *logsys; }MTKSTP_DBG_T; extern void aed_combo_exception(const int *, int, const int *, int, const char *); #define STP_CORE_DUMP_TIMEOUT 5*60*1000 // default 5minutes #define STP_OJB_NAME_SZ 20 #define STP_CORE_DUMP_INFO_SZ 500 typedef enum wcn_compress_algorithm_t { GZIP = 0, BZIP2 = 1, RAR = 2, LMA = 3, MAX }WCN_COMPRESS_ALG_T; typedef INT32 (*COMPRESS_HANDLER)(void *worker, UINT8 *in_buf, INT32 in_sz, UINT8 *out_buf, INT32 *out_sz, INT32 finish); typedef struct wcn_compressor_t { // current object name UINT8 name[STP_OJB_NAME_SZ + 1]; // buffer for raw data, named L1 PUINT8 L1_buf; INT32 L1_buf_sz; INT32 L1_pos; // target buffer, named L2 PUINT8 L2_buf; INT32 L2_buf_sz; INT32 L2_pos; // compress state UINT8 f_done; UINT16 reserved; UINT32 uncomp_size; UINT32 crc32; // compress algorithm UINT8 f_compress_en; WCN_COMPRESS_ALG_T compress_type; void *worker; COMPRESS_HANDLER handler; }WCN_COMPRESSOR_T, *P_WCN_COMPRESSOR_T; P_WCN_COMPRESSOR_T wcn_compressor_init(PUINT8 name, INT32 L1_buf_sz, INT32 L2_buf_sz); INT32 wcn_compressor_deinit(P_WCN_COMPRESSOR_T compressor); INT32 wcn_compressor_in(P_WCN_COMPRESSOR_T compressor, PUINT8 buf, INT32 len, INT32 finish); INT32 wcn_compressor_out(P_WCN_COMPRESSOR_T compressor, PUINT8 *pbuf, PINT32 len); INT32 wcn_compressor_reset(P_WCN_COMPRESSOR_T compressor, UINT8 enable, WCN_COMPRESS_ALG_T type); typedef enum core_dump_state_t { CORE_DUMP_INIT = 0, CORE_DUMP_DOING, CORE_DUMP_TIMEOUT, CORE_DUMP_DONE, CORE_DUMP_MAX }CORE_DUMP_STA; typedef struct core_dump_t { // compress dump data and buffered P_WCN_COMPRESSOR_T compressor; // timer for monitor timeout OSAL_TIMER dmp_timer; UINT32 timeout; OSAL_SLEEPABLE_LOCK dmp_lock; // state machine for core dump flow CORE_DUMP_STA sm; // dump info CHAR info[STP_CORE_DUMP_INFO_SZ + 1]; UCHAR *p_head; UINT32 head_len; } WCN_CORE_DUMP_T, *P_WCN_CORE_DUMP_T; typedef enum _ENUM_STP_FW_ISSUE_TYPE_ { STP_FW_ISSUE_TYPE_INVALID = 0x0, STP_FW_ASSERT_ISSUE = 0x1, STP_FW_NOACK_ISSUE = 0x2, STP_FW_WARM_RST_ISSUE = 0x3, STP_DBG_PROC_TEST = 0x4, STP_HOST_TRIGGER_FW_ASSERT = 0x5, STP_FW_ISSUE_TYPE_MAX } ENUM_STP_FW_ISSUE_TYPE, *P_ENUM_STP_FW_ISSUE_TYPE; #define STP_PATCH_TIME_SIZE 12 #define STP_DBG_CPUPCR_NUM 512 #define STP_PATCH_BRANCH_SZIE 8 #define STP_ASSERT_INFO_SIZE 64 #define STP_DBG_WIFI_VER_SIZE 8 #define STP_DBG_ROM_VER_SIZE 4 #define STP_ASSERT_TYPE_SIZE 32 typedef struct stp_dbg_host_assert_t{ UINT32 drv_type; UINT32 reason; UINT32 assert_from_host; }STP_DBG_HOST_ASSERT_T, *P_STP_DBG_HOST_ASSERT_T; typedef struct stp_dbg_cpupcr_t { UINT32 chipId; UINT8 romVer[STP_DBG_ROM_VER_SIZE]; UINT8 patchVer[STP_PATCH_TIME_SIZE]; UINT8 branchVer[STP_PATCH_BRANCH_SZIE]; UINT8 wifiVer[STP_DBG_WIFI_VER_SIZE]; UINT32 count; UINT32 stop_flag; UINT32 buffer[STP_DBG_CPUPCR_NUM]; UINT8 assert_info[STP_ASSERT_INFO_SIZE]; UINT32 fwTaskId; UINT32 fwRrq; UINT32 fwIsr; STP_DBG_HOST_ASSERT_T host_assert_info; UINT8 assert_type[STP_ASSERT_TYPE_SIZE]; ENUM_STP_FW_ISSUE_TYPE issue_type; OSAL_SLEEPABLE_LOCK lock; } STP_DBG_CPUPCR_T, *P_STP_DBG_CPUPCR_T; typedef enum _ENUM_ASSERT_INFO_PARSER_TYPE_ { STP_DBG_ASSERT_INFO = 0x0, STP_DBG_FW_TASK_ID = 0x1, STP_DBG_FW_ISR = 0x2, STP_DBG_FW_IRQ = 0x3, STP_DBG_ASSERT_TYPE = 0x4, STP_DBG_PARSER_TYPE_MAX } ENUM_ASSERT_INFO_PARSER_TYPE, *P_ENUM_ASSERT_INFO_PARSER_TYPE; P_WCN_CORE_DUMP_T wcn_core_dump_init(UINT32 timeout); INT32 wcn_core_dump_deinit(P_WCN_CORE_DUMP_T dmp); INT32 wcn_core_dump_in(P_WCN_CORE_DUMP_T dmp, PUINT8 buf, INT32 len); INT32 wcn_core_dump_out(P_WCN_CORE_DUMP_T dmp, PUINT8 *pbuf, PINT32 len); INT32 wcn_core_dump_reset(P_WCN_CORE_DUMP_T dmp, UINT32 timeout); extern INT32 wcn_core_dump_flush(INT32 rst); extern int stp_dbg_enable(MTKSTP_DBG_T *stp_dbg); extern int stp_dbg_disable(MTKSTP_DBG_T *stp_dbg); extern MTKSTP_DBG_T *stp_dbg_init(void *); extern int stp_dbg_deinit(MTKSTP_DBG_T *stp_dbg); extern int stp_dbg_dmp_out_ex (char *buf, int *len); extern int stp_dbg_dmp_out(MTKSTP_DBG_T *stp_dbg, char *buf, int *len); extern int stp_dbg_dmp_printk(MTKSTP_DBG_T *stp_dbg); extern char stp_dbg_nl_send( char * aucMsg, unsigned char cmd ); extern INT32 stp_dbg_aee_send(unsigned char *aucMsg, INT32 len, INT32 cmd); extern int stp_dbg_log_pkt ( MTKSTP_DBG_T *stp_dbg, int dbg_type, int type, int ack_no, int seq_no, int crc, int dir, int len, const unsigned char *body); extern int stp_dbg_log_ctrl (unsigned int on); extern INT32 stp_dbg_set_version_info(UINT32 chipid, UINT8 *pRomVer, UINT8 *wifiVer, UINT8 *pPatchVer, UINT8 *pPatchBrh); extern INT32 stp_dbg_cpupcr_infor_format(UINT8 **buf, UINT32 *len); extern INT32 stp_dbg_set_fw_info(UINT8 *assert_info, UINT32 len, ENUM_STP_FW_ISSUE_TYPE issue_type); extern INT32 stp_dbg_set_host_assert_info(UINT32 drv_type,UINT32 reason,UINT32 en); #endif /* end of _STP_DEBUG_H_ */
shlyakpavel/s720-KK-kernel
mediatek/kernel/drivers/combo/common/linux/include/stp_dbg.h
C
gpl-3.0
7,440
import wx from service.fit import Fit import gui.mainFrame from gui import globalEvents as GE from .calc.fitRemoveImplant import FitRemoveImplantCommand from .calc.fitAddImplant import FitAddImplantCommand from .calc.fitRemoveBooster import FitRemoveBoosterCommand from .calc.fitAddBooster import FitAddBoosterCommand from .calc.fitRemoveCargo import FitRemoveCargoCommand from .calc.fitAddCargo import FitAddCargoCommand from .calc.fitReplaceModule import FitReplaceModuleCommand from .calc.fitAddFighter import FitAddFighterCommand from .calc.fitRemoveFighter import FitRemoveFighterCommand from .calc.fitChangeDroneVariation import FitChangeDroneVariationCommand class GuiMetaSwapCommand(wx.Command): def __init__(self, fitID, context, itemID, selection: list): wx.Command.__init__(self, True, "Meta Swap") self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.sFit = Fit.getInstance() self.internal_history = wx.CommandProcessor() self.fitID = fitID self.itemID = itemID self.context = context self.data = [] fit = self.sFit.getFit(fitID) if context == 'fittingModule': for x in selection: self.data.append(((FitReplaceModuleCommand, fitID, fit.modules.index(x), itemID),),) elif context == 'implantItem': for x in selection: idx = fit.implants.index(x) self.data.append(((FitRemoveImplantCommand, fitID, idx), (FitAddImplantCommand, fitID, itemID))) elif context == 'boosterItem': for x in selection: idx = fit.boosters.index(x) self.data.append(((FitRemoveBoosterCommand, fitID, idx), (FitAddBoosterCommand, fitID, itemID))) elif context == 'cargoItem': for x in selection: self.data.append(((FitRemoveCargoCommand, fitID, x.itemID, 1, True), (FitAddCargoCommand, fitID, itemID, x.amount))) elif context == 'fighterItem': for x in selection: self.data.append(((FitRemoveFighterCommand, fitID, fit.fighters.index(x)), (FitAddFighterCommand, fitID, itemID))) elif context == 'droneItem': for x in selection: self.data.append(((FitChangeDroneVariationCommand, fitID, fit.drones.index(x), itemID),),) def Do(self): for cmds in self.data: for cmd in cmds: self.internal_history.Submit(cmd[0](*cmd[1:])) self.sFit.recalc(self.fitID) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID)) return True def Undo(self): for _ in self.internal_history.Commands: self.internal_history.Undo() self.sFit.recalc(self.fitID) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID)) return True
blitzmann/Pyfa
gui/fitCommands/guiMetaSwap.py
Python
gpl-3.0
2,845
// UpdateProduce.cpp #include "StdAfx.h" #include "UpdateProduce.h" using namespace NUpdateArchive; static const char * const kUpdateActionSetCollision = "Internal collision in update action set"; void UpdateProduce( const CRecordVector<CUpdatePair> &updatePairs, const CActionSet &actionSet, CRecordVector<CUpdatePair2> &operationChain, IUpdateProduceCallback *callback) { FOR_VECTOR (i, updatePairs) { const CUpdatePair &pair = updatePairs[i]; CUpdatePair2 up2; up2.DirIndex = pair.DirIndex; up2.ArcIndex = pair.ArcIndex; up2.NewData = up2.NewProps = true; up2.UseArcProps = false; switch (actionSet.StateActions[(unsigned)pair.State]) { case NPairAction::kIgnore: if (pair.ArcIndex >= 0 && callback) callback->ShowDeleteFile(pair.ArcIndex); continue; case NPairAction::kCopy: if (pair.State == NPairState::kOnlyOnDisk) throw kUpdateActionSetCollision; if (pair.State == NPairState::kOnlyInArchive) { if (pair.HostIndex >= 0) { /* ignore alt stream if 1) no such alt stream in Disk 2) there is Host file in disk */ if (updatePairs[pair.HostIndex].DirIndex >= 0) continue; } } up2.NewData = up2.NewProps = false; up2.UseArcProps = true; break; case NPairAction::kCompress: if (pair.State == NPairState::kOnlyInArchive || pair.State == NPairState::kNotMasked) throw kUpdateActionSetCollision; break; case NPairAction::kCompressAsAnti: up2.IsAnti = true; up2.UseArcProps = (pair.ArcIndex >= 0); break; } operationChain.Add(up2); } operationChain.ReserveDown(); }
endlessm/rufus
endless/src/7z/CPP/7zip/UI/Common/UpdateProduce.cpp
C++
gpl-3.0
1,860
<?php /** * Kunena Component * @package Kunena.Site * @subpackage Layout.Topic * * @copyright (C) 2008 - 2016 Kunena Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.kunena.org **/ defined('_JEXEC') or die; /** * KunenaLayoutTopicEditHistory * * @since K4.0 * */ class KunenaLayoutTopicEditHistory extends KunenaLayout { /** * Method to get the anker link with number * * @param int $mesid The Id of the messsage * @param int $replycnt The number of replies * * @return string */ public function getNumLink($mesid, $replycnt) { if ($this->config->ordering_system == 'replyid') { $this->numLink = $this->getSamePageAnkerLink($mesid, '#' . $replycnt); } else { $this->numLink = $this->getSamePageAnkerLink($mesid, '#' . $mesid); } return $this->numLink; } /** * Method to get anker link on the same page * * @param int $anker The anker number * @param string $name The name for the link * @param string $rel The rel attribute for the link * @param string $class The class attibute for the link * * @return string */ public function getSamePageAnkerLink($anker, $name, $rel = 'nofollow', $class = '') { return '<a ' . ($class ? 'class="' . $class . '" ' : '') . 'href="#' . $anker . '"' . ($rel ? ' rel="' . $rel . '"' : '') . '>' . $name . '</a>'; } }
fxstein/Kunena-Forum
components/com_kunena/site/layout/topic/edit/history.php
PHP
gpl-3.0
1,433
import logging from atracker.models import Event from atracker.util import create_event from django.conf.urls import url from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType from tastypie.authentication import ( MultiAuthentication, Authentication, SessionAuthentication, ApiKeyAuthentication, ) from tastypie.authorization import Authorization from tastypie.http import HttpUnauthorized from tastypie.resources import ModelResource from tastypie.utils import trailing_slash log = logging.getLogger(__name__) class EventResource(ModelResource): class Meta: queryset = Event.objects.all() list_allowed_methods = ["get"] detail_allowed_methods = ["get"] resource_name = "atracker/event" include_resource_uri = False # TODO: double-check for sensitive information fields = ["created"] authentication = MultiAuthentication( SessionAuthentication(), ApiKeyAuthentication(), Authentication() ) authorization = Authorization() always_return_data = True filtering = {} def dehydrate(self, bundle): return bundle def prepend_urls(self): return [ url( r"^(?P<resource_name>%s)/(?P<content_type>[\w.]+)/(?P<object_uuid>[\w.-]+)(?:/(?P<action>[\w-]+))?(?:/(?P<user_id>-?[0-9]+))?%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view("create_event_for_user"), name="atracker-create-event-for-user", ) ] # creante event in behalf of user """ call via curl curl -i \ -H "Accept: application/json" \ -H "Authorization: ApiKey remote:d65b075c593f27a42c26e65be74c047e5b50d215" \ http://local.openbroadcast.org:8080/api/v1/atracker/event/alibrary.media/4faa159c-87f4-43eb-b2b7-a4de124a05e5/stream/1/?format=json """ def create_event_for_user(self, request, **kwargs): self.method_check(request, allowed=["get"]) self.is_authenticated(request) self.throttle_check(request) object_uuid = kwargs.get("object_uuid", None) content_type = kwargs.get("content_type", None) orig_ct = content_type action = kwargs.get("action", None) user_id = kwargs.get("user_id", None) if user_id: user_id = int(user_id) log.debug( "create_event_for_user - content_type: %s - object_uuid: %s - action: %s - user_id: %s" % (content_type, object_uuid, action, user_id) ) if isinstance(content_type, basestring) and "." in content_type: app, modelname = content_type.split(".") content_type = ContentType.objects.get( app_label=app, model__iexact=modelname ) elif isinstance(content_type, basestring): content_type = ContentType.objects.get(id=int(content_type)) else: raise ValueError('content_type must a ct id or "app.modelname" string') if user_id: log.debug("creating event on _behalf_ of user with id: %s" % user_id) if request.user.has_perm("atracker.track_for_user"): user = get_user_model().objects.get(pk=user_id) log.info("voting for user by id: %s" % user.username) else: log.warning( "no permission for %s to vote in behalf of %s" % (request.user, user_id) ) user = None elif request.user and request.user.is_authenticated(): user = request.user log.info("creating event for user by request: %s" % user.username) else: log.debug("no authenticated user") user = None object = content_type.model_class().objects.get(uuid=object_uuid) if action: if not user: return HttpUnauthorized("No permission to update this resource.") create_event(user, object, None, action) bundle = { "object_id": object.id, "object_uuid": object.uuid, "ct": orig_ct, "action": action, } self.log_throttled_access(request) return self.create_response(request, bundle)
hzlf/openbroadcast.org
website/apps/atracker/api/event.py
Python
gpl-3.0
4,386
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>INSPINIA | Mailbox</title> <link href="../../static/INSPINIA-theme/css/bootstrap.min.css" rel="stylesheet"> <link href="../../static/INSPINIA-theme/font-awesome/css/font-awesome.css" rel="stylesheet"> <link href="../../static/INSPINIA-theme/css/plugins/iCheck/custom.css" rel="stylesheet"> <link href="../../static/INSPINIA-theme/css/plugins/summernote/summernote.css" rel="stylesheet"> <link href="../../static/INSPINIA-theme/css/plugins/summernote/summernote-bs3.css" rel="stylesheet"> <link href="../../static/INSPINIA-theme/css/animate.css" rel="stylesheet"> <link href="../../static/INSPINIA-theme/css/style.css" rel="stylesheet"> </head> <body> <div id="wrapper"> <nav class="navbar-default navbar-static-side" role="navigation"> <div class="sidebar-collapse"> <ul class="nav" id="side-menu"> <li class="nav-header"> <div class="dropdown profile-element"> <span> <img alt="image" class="img-circle" src="../../static/INSPINIA-theme/img/profile_small.jpg" /> </span> <a data-toggle="dropdown" class="dropdown-toggle" href="#"> <span class="clear"> <span class="block m-t-xs"> <strong class="font-bold">David Williams</strong> </span> <span class="text-muted text-xs block">Art Director <b class="caret"></b></span> </span> </a> <ul class="dropdown-menu animated fadeInRight m-t-xs"> <li><a href="profile.html">Profile</a></li> <li><a href="contacts.html">Contacts</a></li> <li><a href="mailbox.html">Mailbox</a></li> <li class="divider"></li> <li><a href="login.html">Logout</a></li> </ul> </div> <div class="logo-element"> IN+ </div> </li> <li> <a href="index.html"><i class="fa fa-th-large"></i> <span class="nav-label">Dashboards</span> <span class="fa arrow"></span></a> <ul class="nav nav-second-level"> <li><a href="index.html">Dashboard v.1</a></li> <li><a href="dashboard_2.html">Dashboard v.2</a></li> <li><a href="dashboard_3.html">Dashboard v.3</a></li> <li><a href="dashboard_4_1.html">Dashboard v.4</a></li> </ul> </li> <li> <a href="layouts.html"><i class="fa fa-diamond"></i> <span class="nav-label">Layouts</span> <span class="label label-primary pull-right">NEW</span></a> </li> <li> <a href="#"><i class="fa fa-bar-chart-o"></i> <span class="nav-label">Graphs</span><span class="fa arrow"></span></a> <ul class="nav nav-second-level"> <li><a href="graph_flot.html">Flot Charts</a></li> <li><a href="graph_morris.html">Morris.js Charts</a></li> <li><a href="graph_rickshaw.html">Rickshaw Charts</a></li> <li><a href="graph_chartjs.html">Chart.js</a></li> <li><a href="graph_peity.html">Peity Charts</a></li> <li><a href="graph_sparkline.html">Sparkline Charts</a></li> </ul> </li> <li class="active"> <a href="mailbox.html"><i class="fa fa-envelope"></i> <span class="nav-label">Mailbox </span><span class="label label-warning pull-right">16/24</span></a> <ul class="nav nav-second-level"> <li><a href="mailbox.html">Inbox</a></li> <li><a href="mail_detail.html">Email view</a></li> <li class="active"><a href="mail_compose.html">Compose email</a></li> <li><a href="email_template.html">Email templates</a></li> </ul> </li> <li> <a href="widgets.html"><i class="fa fa-flask"></i> <span class="nav-label">Widgets</span> </a> </li> <li> <a href="#"><i class="fa fa-edit"></i> <span class="nav-label">Forms</span><span class="fa arrow"></span></a> <ul class="nav nav-second-level"> <li><a href="form_basic.html">Basic form</a></li> <li><a href="form_advanced.html">Advanced Plugins</a></li> <li><a href="form_wizard.html">Wizard</a></li> <li><a href="form_file_upload.html">File Upload</a></li> <li><a href="form_editors.html">Text Editor</a></li> </ul> </li> <li> <a href="#"><i class="fa fa-desktop"></i> <span class="nav-label">App Views</span> <span class="pull-right label label-primary">SPECIAL</span></a> <ul class="nav nav-second-level"> <li><a href="contacts.html">Contacts</a></li> <li><a href="profile.html">Profile</a></li> <li><a href="projects.html">Projects</a></li> <li><a href="project_detail.html">Project detail</a></li> <li><a href="file_manager.html">File manager</a></li> <li><a href="calendar.html">Calendar</a></li> <li><a href="faq.html">FAQ</a></li> <li><a href="timeline.html">Timeline</a></li> <li><a href="pin_board.html">Pin board</a></li> </ul> </li> <li> <a href="#"><i class="fa fa-files-o"></i> <span class="nav-label">Other Pages</span><span class="fa arrow"></span></a> <ul class="nav nav-second-level"> <li><a href="search_results.html">Search results</a></li> <li><a href="lockscreen.html">Lockscreen</a></li> <li><a href="invoice.html">Invoice</a></li> <li><a href="login.html">Login</a></li> <li><a href="login_two_columns.html">Login v.2</a></li> <li><a href="register.html">Register</a></li> <li><a href="404.html">404 Page</a></li> <li><a href="500.html">500 Page</a></li> <li><a href="empty_page.html">Empty page</a></li> </ul> </li> <li> <a href="#"><i class="fa fa-globe"></i> <span class="nav-label">Miscellaneous</span><span class="label label-info pull-right">NEW</span></a> <ul class="nav nav-second-level"> <li><a href="toastr_notifications.html">Notification</a></li> <li><a href="nestable_list.html">Nestable list</a></li> <li><a href="timeline_2.html">Timeline v.2</a></li> <li><a href="forum_main.html">Forum view</a></li> <li><a href="google_maps.html">Google maps</a></li> <li><a href="code_editor.html">Code editor</a></li> <li><a href="modal_window.html">Modal window</a></li> <li><a href="validation.html">Validation</a></li> <li><a href="tree_view.html">Tree view</a></li> <li><a href="chat_view.html">Chat view</a></li> </ul> </li> <li> <a href="#"><i class="fa fa-flask"></i> <span class="nav-label">UI Elements</span><span class="fa arrow"></span></a> <ul class="nav nav-second-level"> <li><a href="typography.html">Typography</a></li> <li><a href="icons.html">Icons</a></li> <li><a href="draggable_panels.html">Draggable Panels</a></li> <li><a href="buttons.html">Buttons</a></li> <li><a href="video.html">Video</a></li> <li><a href="tabs_panels.html">Tabs & Panels</a></li> <li><a href="notifications.html">Notifications & Tooltips</a></li> <li><a href="badges_labels.html">Badges, Labels, Progress</a></li> </ul> </li> <li> <a href="grid_options.html"><i class="fa fa-laptop"></i> <span class="nav-label">Grid options</span></a> </li> <li> <a href="#"><i class="fa fa-table"></i> <span class="nav-label">Tables</span><span class="fa arrow"></span></a> <ul class="nav nav-second-level"> <li><a href="table_basic.html">Static Tables</a></li> <li><a href="table_data_tables.html">Data Tables</a></li> <li><a href="jq_grid.html">jqGrid</a></li> </ul> </li> <li> <a href="#"><i class="fa fa-picture-o"></i> <span class="nav-label">Gallery</span><span class="fa arrow"></span></a> <ul class="nav nav-second-level"> <li><a href="basic_gallery.html">Lightbox Gallery</a></li> <li><a href="carousel.html">Bootstrap Carusela</a></li> </ul> </li> <li> <a href="#"><i class="fa fa-sitemap"></i> <span class="nav-label">Menu Levels </span><span class="fa arrow"></span></a> <ul class="nav nav-second-level"> <li> <a href="#">Third Level <span class="fa arrow"></span></a> <ul class="nav nav-third-level"> <li> <a href="#">Third Level Item</a> </li> <li> <a href="#">Third Level Item</a> </li> <li> <a href="#">Third Level Item</a> </li> </ul> </li> <li><a href="#">Second Level Item</a></li> <li> <a href="#">Second Level Item</a></li> <li> <a href="#">Second Level Item</a></li> </ul> </li> <li> <a href="css_animation.html"><i class="fa fa-magic"></i> <span class="nav-label">CSS Animations </span><span class="label label-info pull-right">62</span></a> </li> <li class="landing_link"> <a target="_blank" href="Landing_page/index.html"><i class="fa fa-star"></i> <span class="nav-label">Landing Page</span> <span class="label label-warning pull-right">NEW</span></a> </li> <li class="special_link"> <a href="package.html"><i class="fa fa-database"></i> <span class="nav-label">Package</span></a> </li> </ul> </div> </nav> <div id="page-wrapper" class="gray-bg"> <div class="row border-bottom"> <nav class="navbar navbar-static-top white-bg" role="navigation" style="margin-bottom: 0"> <div class="navbar-header"> <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a> <form role="search" class="navbar-form-custom" method="post" action="search_results.html"> <div class="form-group"> <input type="text" placeholder="Search for something..." class="form-control" name="top-search" id="top-search"> </div> </form> </div> <ul class="nav navbar-top-links navbar-right"> <li> <span class="m-r-sm text-muted welcome-message">Welcome to INSPINIA+ Admin Theme.</span> </li> <li class="dropdown"> <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#"> <i class="fa fa-envelope"></i> <span class="label label-warning">16</span> </a> <ul class="dropdown-menu dropdown-messages"> <li> <div class="dropdown-messages-box"> <a href="profile.html" class="pull-left"> <img alt="image" class="img-circle" src="../../static/INSPINIA-theme/img/a7.jpg"> </a> <div class="media-body"> <small class="pull-right">46h ago</small> <strong>Mike Loreipsum</strong> started following <strong>Monica Smith</strong>. <br> <small class="text-muted">3 days ago at 7:58 pm - 10.06.2014</small> </div> </div> </li> <li class="divider"></li> <li> <div class="dropdown-messages-box"> <a href="profile.html" class="pull-left"> <img alt="image" class="img-circle" src="../../static/INSPINIA-theme/img/a4.jpg"> </a> <div class="media-body "> <small class="pull-right text-navy">5h ago</small> <strong>Chris Johnatan Overtunk</strong> started following <strong>Monica Smith</strong>. <br> <small class="text-muted">Yesterday 1:21 pm - 11.06.2014</small> </div> </div> </li> <li class="divider"></li> <li> <div class="dropdown-messages-box"> <a href="profile.html" class="pull-left"> <img alt="image" class="img-circle" src="../../static/INSPINIA-theme/img/profile.jpg"> </a> <div class="media-body "> <small class="pull-right">23h ago</small> <strong>Monica Smith</strong> love <strong>Kim Smith</strong>. <br> <small class="text-muted">2 days ago at 2:30 am - 11.06.2014</small> </div> </div> </li> <li class="divider"></li> <li> <div class="text-center link-block"> <a href="mailbox.html"> <i class="fa fa-envelope"></i> <strong>Read All Messages</strong> </a> </div> </li> </ul> </li> <li class="dropdown"> <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#"> <i class="fa fa-bell"></i> <span class="label label-primary">8</span> </a> <ul class="dropdown-menu dropdown-alerts"> <li> <a href="mailbox.html"> <div> <i class="fa fa-envelope fa-fw"></i> You have 16 messages <span class="pull-right text-muted small">4 minutes ago</span> </div> </a> </li> <li class="divider"></li> <li> <a href="profile.html"> <div> <i class="fa fa-twitter fa-fw"></i> 3 New Followers <span class="pull-right text-muted small">12 minutes ago</span> </div> </a> </li> <li class="divider"></li> <li> <a href="grid_options.html"> <div> <i class="fa fa-upload fa-fw"></i> Server Rebooted <span class="pull-right text-muted small">4 minutes ago</span> </div> </a> </li> <li class="divider"></li> <li> <div class="text-center link-block"> <a href="notifications.html"> <strong>See All Alerts</strong> <i class="fa fa-angle-right"></i> </a> </div> </li> </ul> </li> <li> <a href="login.html"> <i class="fa fa-sign-out"></i> Log out </a> </li> </ul> </nav> </div> <div class="wrapper wrapper-content"> <div class="row"> <div class="col-lg-3"> <div class="ibox float-e-margins"> <div class="ibox-content mailbox-content"> <div class="file-manager"> <a class="btn btn-block btn-primary compose-mail" href="mail_compose.html">Compose Mail</a> <div class="space-25"></div> <h5>Folders</h5> <ul class="folder-list m-b-md" style="padding: 0"> <li><a href="mailbox.html"> <i class="fa fa-inbox "></i> Inbox <span class="label label-warning pull-right">16</span> </a></li> <li><a href="mailbox.html"> <i class="fa fa-envelope-o"></i> Send Mail</a></li> <li><a href="mailbox.html"> <i class="fa fa-certificate"></i> Important</a></li> <li><a href="mailbox.html"> <i class="fa fa-file-text-o"></i> Drafts <span class="label label-danger pull-right">2</span></a></li> <li><a href="mailbox.html"> <i class="fa fa-trash-o"></i> Trash</a></li> </ul> <h5>Categories</h5> <ul class="category-list" style="padding: 0"> <li><a href="#"> <i class="fa fa-circle text-navy"></i> Work </a></li> <li><a href="#"> <i class="fa fa-circle text-danger"></i> Documents</a></li> <li><a href="#"> <i class="fa fa-circle text-primary"></i> Social</a></li> <li><a href="#"> <i class="fa fa-circle text-info"></i> Advertising</a></li> <li><a href="#"> <i class="fa fa-circle text-warning"></i> Clients</a></li> </ul> <h5 class="tag-title">Labels</h5> <ul class="tag-list" style="padding: 0"> <li><a href=""><i class="fa fa-tag"></i> Family</a></li> <li><a href=""><i class="fa fa-tag"></i> Work</a></li> <li><a href=""><i class="fa fa-tag"></i> Home</a></li> <li><a href=""><i class="fa fa-tag"></i> Children</a></li> <li><a href=""><i class="fa fa-tag"></i> Holidays</a></li> <li><a href=""><i class="fa fa-tag"></i> Music</a></li> <li><a href=""><i class="fa fa-tag"></i> Photography</a></li> <li><a href=""><i class="fa fa-tag"></i> Film</a></li> </ul> <div class="clearfix"></div> </div> </div> </div> </div> <div class="col-lg-9 animated fadeInRight"> <div class="mail-box-header"> <div class="pull-right tooltip-demo"> <a href="mailbox.html" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="Move to draft folder"><i class="fa fa-pencil"></i> Draft</a> <a href="mailbox.html" class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="top" title="Discard email"><i class="fa fa-times"></i> Discard</a> </div> <h2> Compse mail </h2> </div> <div class="mail-box"> <div class="mail-body"> <form class="form-horizontal" method="get"> <div class="form-group"><label class="col-sm-2 control-label">To:</label> <div class="col-sm-10"><input type="text" class="form-control" value="alex.smith@corporat.com"></div> </div> <div class="form-group"><label class="col-sm-2 control-label">Subject:</label> <div class="col-sm-10"><input type="text" class="form-control" value=""></div> </div> </form> </div> <div class="mail-text h-200"> <div class="summernote"> <h3>Hello Jonathan! </h3> dummy text of the printing and typesetting industry. <strong>Lorem Ipsum has been the industry's</strong> standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with <br/> <br/> </div> <div class="clearfix"></div> </div> <div class="mail-body text-right tooltip-demo"> <a href="mailbox.html" class="btn btn-sm btn-primary" data-toggle="tooltip" data-placement="top" title="Send"><i class="fa fa-reply"></i> Send</a> <a href="mailbox.html" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="Discard email"><i class="fa fa-times"></i> Discard</a> <a href="mailbox.html" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="Move to draft folder"><i class="fa fa-pencil"></i> Draft</a> </div> <div class="clearfix"></div> </div> </div> </div> </div> <div class="footer"> <div class="pull-right"> 10GB of <strong>250GB</strong> Free. </div> <div> <strong>Copyright</strong> Example Company &copy; 2014-2015 </div> </div> </div> </div> <!-- Mainly scripts --> <script src="../../static/INSPINIA-theme/js/jquery-2.1.1.js"></script> <script src="../../static/INSPINIA-theme/js/bootstrap.min.js"></script> <script src="../../static/INSPINIA-theme/js/plugins/metisMenu/jquery.metisMenu.js"></script> <script src="../../static/INSPINIA-theme/js/plugins/slimscroll/jquery.slimscroll.min.js"></script> <!-- Custom and plugin javascript --> <script src="../../static/INSPINIA-theme/js/inspinia.js"></script> <script src="../../static/INSPINIA-theme/js/plugins/pace/pace.min.js"></script> <!-- iCheck --> <script src="../../static/INSPINIA-theme/js/plugins/iCheck/icheck.min.js"></script> <!-- SUMMERNOTE --> <script src="../../static/INSPINIA-theme/js/plugins/summernote/summernote.min.js"></script> <script> $(document).ready(function(){ $('.i-checks').iCheck({ checkboxClass: 'icheckbox_square-green', radioClass: 'iradio_square-green', }); $('.summernote').summernote(); }); var edit = function() { $('.click2edit').summernote({focus: true}); }; var save = function() { var aHTML = $('.click2edit').code(); //save HTML If you need(aHTML: array). $('.click2edit').destroy(); }; </script> </body> </html>
CentechMTL/TableauDeBord
templates/INSPINIA-theme/mail_compose.html
HTML
gpl-3.0
26,052
# -*- coding: UTF-8 -*- ''' virtualbox_const_support.py Constants for VirtualBox. ''' __author__ = "Karol Będkowski <karol.bedkowski@gmail.com>" __version__ = '0.3' # virtual machine states VM_STATE_POWEROFF = 0 VM_STATE_POWERON = 1 VM_STATE_PAUSED = 2 # virtual machine actions VM_START_NORMAL = 1 VM_START_HEADLESS = 2 VM_PAUSE = 3 VM_POWEROFF = 4 VM_ACPI_POWEROFF = 5 VM_REBOOT = 6 VM_RESUME = 7 VM_SAVE = 8
cjparsons74/Kupfer-cjparsons74
kupfer/plugin/virtualbox/constants.py
Python
gpl-3.0
417
#pragma once #include <AP_Common/AP_Common.h> // Global parameter class. // class Parameters { public: // The version of the layout as described by the parameter enum. // // When changing the parameter enum in an incompatible fashion, this // value should be incremented by one. // // The increment will prevent old parameters from being used incorrectly // by newer code. // static const uint16_t k_format_version = 1; // The parameter software_type is set up solely for ground station use // and identifies the software type (eg ArduPilotMega versus // ArduCopterMega) // GCS will interpret values 0-9 as ArduPilotMega. Developers may use // values within that range to identify different branches. // static const uint16_t k_software_type = 40; // 0 for APM // trunk // Parameter identities. // // The enumeration defined here is used to ensure that every parameter // or parameter group has a unique ID number. This number is used by // AP_Param to store and locate parameters in EEPROM. // // Note that entries without a number are assigned the next number after // the entry preceding them. When adding new entries, ensure that they // don't overlap. // // Try to group related variables together, and assign them a set // range in the enumeration. Place these groups in numerical order // at the end of the enumeration. // // WARNING: Care should be taken when editing this enumeration as the // AP_Param load/save code depends on the values here to identify // variables saved in EEPROM. // // enum { // Layout version number, always key zero. // k_param_format_version = 0, k_param_software_type, k_param_g2, // 2nd block of parameters k_param_sitl, // Simulation // Telemetry k_param_gcs0 = 10, k_param_gcs1, k_param_gcs2, k_param_gcs3, k_param_sysid_this_mav, k_param_sysid_my_gcs, // Hardware/Software configuration k_param_BoardConfig = 20, // Board configuration (PX4/Linux/etc) k_param_scheduler, // Scheduler (for debugging/perf_info) k_param_DataFlash, // DataFlash Logging k_param_serial_manager, // Serial ports, AP_SerialManager k_param_notify, // Notify Library, AP_Notify k_param_arming = 26, // Arming checks k_param_BoardConfig_CAN, // Sensor objects k_param_ins = 30, // AP_InertialSensor k_param_compass, // Compass k_param_barometer, // Barometer/Depth Sensor k_param_battery, // AP_BattMonitor k_param_leak_detector, // Leak Detector k_param_rangefinder, // Rangefinder k_param_gps, // GPS k_param_optflow, // Optical Flow // Navigation libraries k_param_ahrs = 50, // AHRS k_param_NavEKF, // Extended Kalman Filter Inertial Navigation // remove k_param_NavEKF2, // EKF2 k_param_attitude_control, // Attitude Control k_param_pos_control, // Position Control k_param_wp_nav, // Waypoint navigation k_param_mission, // Mission library k_param_fence, // Fence Library k_param_terrain, // Terrain database k_param_rally, // Disabled k_param_circle_nav, // Disabled k_param_avoid, // Relies on proximity and fence k_param_NavEKF3, // Other external hardware interfaces k_param_motors = 65, // Motors k_param_relay, // Relay k_param_camera, // Camera k_param_camera_mount, // Camera gimbal // RC_Channel settings (deprecated) k_param_rc_1_old = 75, k_param_rc_2_old, k_param_rc_3_old, k_param_rc_4_old, k_param_rc_5_old, k_param_rc_6_old, k_param_rc_7_old, k_param_rc_8_old, k_param_rc_9_old, k_param_rc_10_old, k_param_rc_11_old, k_param_rc_12_old, k_param_rc_13_old, k_param_rc_14_old, // Joystick gain parameters k_param_gain_default, k_param_maxGain, k_param_minGain, k_param_numGainSettings, k_param_cam_tilt_step, // deprecated k_param_lights_step, // deprecated // Joystick button mapping parameters k_param_jbtn_0 = 95, k_param_jbtn_1, k_param_jbtn_2, k_param_jbtn_3, k_param_jbtn_4, k_param_jbtn_5, k_param_jbtn_6, k_param_jbtn_7, k_param_jbtn_8, k_param_jbtn_9, k_param_jbtn_10, k_param_jbtn_11, k_param_jbtn_12, k_param_jbtn_13, k_param_jbtn_14, k_param_jbtn_15, // PID Controllers k_param_p_pos_xy = 126, k_param_p_alt_hold, k_param_pi_vel_xy, k_param_p_vel_z, k_param_pid_accel_z, // Failsafes k_param_failsafe_gcs = 140, k_param_failsafe_leak, // leak failsafe behavior k_param_failsafe_pressure, // internal pressure failsafe behavior k_param_failsafe_pressure_max, // maximum internal pressure in pascal before failsafe is triggered k_param_failsafe_temperature, // internal temperature failsafe behavior k_param_failsafe_temperature_max, // maximum internal temperature in degrees C before failsafe is triggered k_param_failsafe_terrain, // terrain failsafe behavior k_param_fs_ekf_thresh, k_param_fs_ekf_action, k_param_fs_crash_check, k_param_failsafe_battery_enabled, k_param_fs_batt_mah, k_param_fs_batt_voltage, k_param_failsafe_pilot_input, k_param_failsafe_pilot_input_timeout, // Misc Sub settings k_param_log_bitmask = 165, k_param_angle_max = 167, k_param_rangefinder_gain, k_param_wp_yaw_behavior = 170, k_param_xtrack_angle_limit, // Angle limit for crosstrack correction in Auto modes (degrees) k_param_pilot_velocity_z_max, k_param_pilot_accel_z, k_param_compass_enabled, k_param_surface_depth, k_param_rc_speed, // Main output pwm frequency k_param_gcs_pid_mask = 178, k_param_throttle_filt, k_param_throttle_deadzone, // Used in auto-throttle modes k_param_terrain_follow = 182, k_param_rc_feel_rp, k_param_throttle_gain, k_param_cam_tilt_center, // deprecated k_param_frame_configuration, // Acro Mode parameters k_param_acro_yaw_p = 220, // Used in all modes for get_pilot_desired_yaw_rate k_param_acro_trainer, k_param_acro_expo, k_param_acro_rp_p, k_param_acro_balance_roll, k_param_acro_balance_pitch, // RPM Sensor k_param_rpm_sensor = 232, // Disabled // RC_Mapper Library k_param_rcmap, // Disabled k_param_cam_slew_limit = 237, // deprecated k_param_lights_steps, }; AP_Int16 format_version; AP_Int8 software_type; // Telemetry control // AP_Int16 sysid_this_mav; AP_Int16 sysid_my_gcs; AP_Float throttle_filt; AP_Float rangefinder_gain; AP_Int8 failsafe_battery_enabled; // battery failsafe enabled AP_Float fs_batt_voltage; // battery voltage below which failsafe will be triggered AP_Float fs_batt_mah; // battery capacity (in mah) below which failsafe will be triggered AP_Int8 failsafe_leak; // leak detection failsafe behavior AP_Int8 failsafe_gcs; // ground station failsafe behavior AP_Int8 failsafe_pressure; AP_Int8 failsafe_temperature; AP_Int32 failsafe_pressure_max; AP_Int8 failsafe_temperature_max; AP_Int8 failsafe_terrain; AP_Int8 failsafe_pilot_input; // pilot input failsafe behavior AP_Float failsafe_pilot_input_timeout; AP_Int8 xtrack_angle_limit; AP_Int8 compass_enabled; AP_Int8 wp_yaw_behavior; // controls how the autopilot controls yaw during missions AP_Int8 rc_feel_rp; // controls vehicle response to user input with 0 being extremely soft and 100 begin extremely crisp // Waypoints // AP_Int16 pilot_velocity_z_max; // maximum vertical velocity the pilot may request AP_Int16 pilot_accel_z; // vertical acceleration the pilot may request // Throttle // AP_Int16 throttle_deadzone; // Misc // AP_Int32 log_bitmask; AP_Int8 fs_ekf_action; AP_Int8 fs_crash_check; AP_Float fs_ekf_thresh; AP_Int16 gcs_pid_mask; AP_Int8 terrain_follow; AP_Int16 rc_speed; // speed of fast RC Channels in Hz AP_Float gain_default; AP_Float maxGain; AP_Float minGain; AP_Int8 numGainSettings; AP_Float throttle_gain; AP_Int16 lights_steps; // Joystick button parameters JSButton jbtn_0; JSButton jbtn_1; JSButton jbtn_2; JSButton jbtn_3; JSButton jbtn_4; JSButton jbtn_5; JSButton jbtn_6; JSButton jbtn_7; JSButton jbtn_8; JSButton jbtn_9; JSButton jbtn_10; JSButton jbtn_11; JSButton jbtn_12; JSButton jbtn_13; JSButton jbtn_14; JSButton jbtn_15; // Acro parameters AP_Float acro_rp_p; AP_Float acro_yaw_p; AP_Float acro_balance_roll; AP_Float acro_balance_pitch; AP_Int8 acro_trainer; AP_Float acro_expo; // PI/D controllers AC_PI_2D pi_vel_xy; AC_P p_vel_z; AC_PID pid_accel_z; AC_P p_pos_xy; AC_P p_alt_hold; AP_Float surface_depth; AP_Int8 frame_configuration; // Note: keep initializers here in the same order as they are declared // above. Parameters() : // PID controller initial P initial I initial D initial imax initial filt hz pid rate //--------------------------------------------------------------------------------------------------------------------------------- pi_vel_xy(VEL_XY_P, VEL_XY_I, VEL_XY_IMAX, VEL_XY_FILT_HZ, WPNAV_LOITER_UPDATE_TIME), p_vel_z(VEL_Z_P), pid_accel_z(ACCEL_Z_P, ACCEL_Z_I, ACCEL_Z_D, ACCEL_Z_IMAX, ACCEL_Z_FILT_HZ, MAIN_LOOP_SECONDS), // P controller initial P //---------------------------------------------------------------------- p_pos_xy(POS_XY_P), p_alt_hold(ALT_HOLD_P) { } }; /* 2nd block of parameters, to avoid going past 256 top level keys */ class ParametersG2 { public: ParametersG2(void); // var_info for holding Parameter information static const struct AP_Param::GroupInfo var_info[]; #if GRIPPER_ENABLED AP_Gripper gripper; #endif #if PROXIMITY_ENABLED == ENABLED // proximity (aka object avoidance) library AP_Proximity proximity; #endif // RC input channels RC_Channels rc_channels; // control over servo output ranges SRV_Channels servo_channels; }; extern const AP_Param::Info var_info[];
ranqingfa/ardupilot
ArduSub/Parameters.h
C
gpl-3.0
11,738
// Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved. // $HeadURL$ // $Id$ // This program is free software: you can redistribute it and/or modify it under the terms of the // GNU General Public License as published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See // the GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along with this program. If // not, see <http://www.gnu.org/licenses/>. /// \file /// \brief Source file for the Trace class. #include "torc/router/Trace.hpp" namespace torc { namespace router { } // namespace router } // namespace torc
eddiehung/dox-torc
src/torc/router/Trace.cpp
C++
gpl-3.0
924
/* * JSON-RPC-Java - a JSON-RPC to Java Bridge with dynamic invocation * * $Id: InvocationCallback.java,v 1.3.2.3 2006/03/06 12:39:21 mclark Exp $ * * Copyright Metaparadigm Pte. Ltd. 2004. * Michael Clark <michael@metaparadigm.com> * * 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.metaparadigm.jsonrpc; import java.io.Serializable; import java.lang.reflect.Method; /** * Interface to be implemented by objects registered for invocation callbacks * with the JSONRPCBridge. */ public interface InvocationCallback extends Serializable { /** * Callback before invocation of an RPC method. * * @param context * The transport context (the HttpServletRequest object in the * case of the HTTP transport). * @param instance * The object instance or null if it is a static method. * @param method * Method that failed the invocation. * @param arguments * The arguments passed to the method */ public void preInvoke(Object context, Object instance, Method method, Object arguments[]) throws Exception; /** * Callback after invocation of an RPC method. * * @param context * The transport context (the HttpServletRequest object in the * case of the HTTP transport). * @param instance * The object instance or null if it is a static method. * @param method * Method that failed the invocation. * @param result * The returned result from the method */ public void postInvoke(Object context, Object instance, Method method, Object result) throws Exception; }
lhebj/knx
src/com/metaparadigm/jsonrpc/InvocationCallback.java
Java
gpl-3.0
2,151
-- grid is a game written in Haskell -- Copyright (C) 2018 karamellpelle@hotmail.com -- -- This file is part of grid. -- -- grid is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- grid is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with grid. If not, see <http://www.gnu.org/licenses/>. -- module MEnv.System ( #ifdef GRID_PLATFORM_IOS module MEnv.System.IOS, #endif #ifdef GRID_PLATFORM_GLFW module MEnv.System.GLFW, #endif ) where #ifdef GRID_PLATFORM_IOS import MEnv.System.IOS #endif #ifdef GRID_PLATFORM_GLFW import MEnv.System.GLFW #endif
karamellpelle/grid
source/MEnv/System.hs
Haskell
gpl-3.0
1,023
/* console pcopy function */ #include "../fb.h" #include "fb_private_console.h" #include <go32.h> int fb_ConsolePageCopy( int src, int dst ) { /* use current? */ if( src < 0 ) src = __fb_con.active; if( dst < 0 ) dst = __fb_con.visible; if( src == dst ) return fb_ErrorSetNum( FB_RTERROR_OK ); /* do the copy */ int cols, rows; fb_ConsoleGetSize( &cols, &rows ); unsigned long srcAddr = fb_hGetPageAddr( src, cols, rows ); unsigned long dstAddr = fb_hGetPageAddr( dst, cols, rows ); _movedataw( _dos_ds, srcAddr, _dos_ds, dstAddr, cols * rows ); return fb_ErrorSetNum( FB_RTERROR_OK ); }
rvega/pd-bbb-gpio
vendors/FreeBASIC-0.90.0-source/src/rtlib/dos/io_pcopy.c
C
gpl-3.0
613
<?php /* ########################################################################## # # # Version 4 / / / # # -----------__---/__---__------__----__---/---/- # # | /| / /___) / ) (_ ` / ) /___) / / # # _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___ # # Free Content / Management System # # / # # # # # # Copyright 2005-2015 by webspell.org # # # # visit webSPELL.org, webspell.info to get webSPELL for free # # - Script runs under the GNU GENERAL PUBLIC LICENSE # # - It's NOT allowed to remove this copyright-tag # # -- http://www.fsf.org/licensing/licenses/gpl.html # # # # Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at), # # Far Development by Development Team - webspell.org # # # # visit webspell.org # # # ########################################################################## */ $language_array = array( /* do not edit above this line */ 'just_rate_between_0_10' => 'Please rate only from 0 to 10 points!', 'no_access' => 'nepovolený přístup!' );
nerdiabet/webSPELL
languages/cs/rating.php
PHP
gpl-3.0
1,920
subroutine fpcurf(iopt,x,y,w,m,xb,xe,k,s,nest,tol,maxit,k1,k2,& n,t,c,fp,fpint,z,a,b,g,q,nrdata,ier) IMPLICIT NONE #include "types.h" ! .. ! ..scalar arguments.. TREAL xb,xe,s,tol,fp TINTEGER iopt,m,k,nest,maxit,k1,k2,n,ier ! ..array arguments.. TREAL x(m),y(m),w(m),t(nest),c(nest),fpint(nest),& z(nest),a(nest,k1),b(nest,k2),g(nest,k2),q(m,k1) TINTEGER nrdata(nest) ! ..local scalars.. TREAL acc,con1,con4,con9,cos,half,fpart,fpms,fpold,fp0,f1,f2,f3,& one,p,pinv,piv,p1,p2,p3,rn,sin,store,term,wi,xi,yi TINTEGER i,ich1,ich3,it,iter,i1,i2,i3,j,k3,l,l0,& mk1,new,nk1,nmax,nmin,nplus,npl1,nrint,n8 ! ..local arrays.. TREAL h(7) ! ..function references TREAL abs,fprati TINTEGER max0,min0 ! ..subroutine references.. !fpback,fpbspl,fpgivs,fpdisc,fpknot,fprota ! .. ! set constants one = C_1_R con1 = C_01_R con9 = 0.9e0 con4 = 0.4e-01 half = C_05_R !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ! part 1: determination of the number of knots and their position c ! ************************************************************** c ! given a set of knots we compute the least-squares spline sinf(x), c ! and the corresponding sum of squared residuals fp=f(p=inf). c ! if iopt=-1 sinf(x) is the requested approximation. c ! if iopt=0 or iopt=1 we check whether we can accept the knots: c !if fp <=s we will continue with the current set of knots. c !if fp > s we will increase the number of knots and compute the c ! corresponding least-squares spline until finally fp<=s. c !the initial choice of knots depends on the value of s and iopt. c !if s=0 we have spline interpolation; in that case the number of c !knots equals nmax = m+k+1. c !if s > 0 and c ! iopt=0 we first compute the least-squares polynomial of c ! degree k; n = nmin = 2*k+2 c ! iopt=1 we start with the set of knots found at the last c ! call of the routine, except for the case that s > fp0; then c ! we compute directly the least-squares polynomial of degree k. c !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ! determine nmin, the number of knots for polynomial approximation. nmin = 2*k1 if(iopt.lt.0) go to 60 ! calculation of acc, the absolute tolerance for the root of f(p)=s. acc = tol*s ! determine nmax, the number of knots for spline interpolation. nmax = m+k1 if(s.gt.0.) go to 45 ! if s=0, s(x) is an interpolating spline. ! test whether the required storage space exceeds the available one. n = nmax if(nmax.gt.nest) go to 420 ! find the position of the interior knots in case of interpolation. 10 mk1 = m-k1 if(mk1.eq.0) go to 60 k3 = k/2 i = k2 j = k3+2 if(k3*2.eq.k) go to 30 do 20 l=1,mk1 t(i) = x(j) i = i+1 j = j+1 20 continue go to 60 30 do 40 l=1,mk1 t(i) = (x(j)+x(j-1))*half i = i+1 j = j+1 40 continue go to 60 ! if s>0 our initial choice of knots depends on the value of iopt. ! if iopt=0 or iopt=1 and s>=fp0, we start computing the least-squares ! polynomial of degree k which is a spline without interior knots. ! if iopt=1 and fp0>s we start computing the least squares spline ! according to the set of knots found at the last call of the routine. 45 if(iopt.eq.0) go to 50 if(n.eq.nmin) go to 50 fp0 = fpint(n) fpold = fpint(n-1) nplus = nrdata(n) if(fp0.gt.s) go to 60 50 n = nmin fpold = 0. nplus = 0 nrdata(1) = m-2 ! main loop for the different sets of knots. m is a save upper bound ! for the number of trials. 60 do 200 iter = 1,m if(n.eq.nmin) ier = -2 ! find nrint, tne number of knot intervals. nrint = n-nmin+1 ! find the position of the additional knots which are needed for ! the b-spline representation of s(x). nk1 = n-k1 i = n do 70 j=1,k1 t(j) = xb t(i) = xe i = i-1 70 continue ! compute the b-spline coefficients of the least-squares spline ! sinf(x). the observation matrix a is built up row by row and ! reduced to upper triangular form by givens transformations. ! at the same time fp=f(p=inf) is computed. fp = 0. ! initialize the observation matrix a. do 80 i=1,nk1 z(i) = 0. do 80 j=1,k1 a(i,j) = 0. 80 continue l = k1 do 130 it=1,m ! fetch the current data point x(it),y(it). xi = x(it) wi = w(it) yi = y(it)*wi ! search for knot interval t(l) <= xi < t(l+1). 85 if(xi.lt.t(l+1) .or. l.eq.nk1) go to 90 l = l+1 go to 85 ! evaluate the (k+1) non-zero b-splines at xi and store them in q. 90 call fpbspl(t,n,k,xi,l,h) do 95 i=1,k1 q(it,i) = h(i) h(i) = h(i)*wi 95 continue ! rotate the new row of the observation matrix into triangle. j = l-k1 do 110 i=1,k1 j = j+1 piv = h(i) if(piv.eq.0.) go to 110 ! calculate the parameters of the givens transformation. call fpgivs(piv,a(j,1),cos,sin) ! transformations to right hand side. call fprota(cos,sin,yi,z(j)) if(i.eq.k1) go to 120 i2 = 1 i3 = i+1 do 100 i1 = i3,k1 i2 = i2+1 ! transformations to left hand side. call fprota(cos,sin,h(i1),a(j,i2)) 100 continue 110 continue ! add contribution of this row to the sum of squares of residual ! right hand sides. 120 fp = fp+yi**2 130 continue if(ier.eq.(-2)) fp0 = fp fpint(n) = fp0 fpint(n-1) = fpold nrdata(n) = nplus ! backward substitution to obtain the b-spline coefficients. call fpback(a,z,nk1,k1,c,nest) ! test whether the approximation sinf(x) is an acceptable solution. if(iopt.lt.0) go to 440 fpms = fp-s if(abs(fpms).lt.acc) go to 440 ! if f(p=inf) < s accept the choice of knots. if(fpms.lt.0.) go to 250 ! if n = nmax, sinf(x) is an interpolating spline. if(n.eq.nmax) go to 430 ! increase the number of knots. ! if n=nest we cannot increase the number of knots because of ! the storage capacity limitation. if(n.eq.nest) go to 420 ! determine the number of knots nplus we are going to add. if(ier.eq.0) go to 140 nplus = 1 ier = 0 go to 150 140 npl1 = nplus*2 rn = nplus if(fpold-fp.gt.acc) npl1 = rn*fpms/(fpold-fp) nplus = min0(nplus*2,max0(npl1,nplus/2,1)) 150 fpold = fp ! compute the sum((w(i)*(y(i)-s(x(i))))**2) for each knot interval ! t(j+k) <= x(i) <= t(j+k+1) and store it in fpint(j),j=1,2,...nrint. fpart = 0. i = 1 l = k2 new = 0 do 180 it=1,m if(x(it).lt.t(l) .or. l.gt.nk1) go to 160 new = 1 l = l+1 160 term = 0. l0 = l-k2 do 170 j=1,k1 l0 = l0+1 term = term+c(l0)*q(it,j) 170 continue term = (w(it)*(term-y(it)))**2 fpart = fpart+term if(new.eq.0) go to 180 store = term*half fpint(i) = fpart-store i = i+1 fpart = store new = 0 180 continue fpint(nrint) = fpart do 190 l=1,nplus ! add a new knot. call fpknot(x,m,t,n,fpint,nrdata,nrint,nest,1) ! if n=nmax we locate the knots as for interpolation. if(n.eq.nmax) go to 10 ! test whether we cannot further increase the number of knots. if(n.eq.nest) go to 200 190 continue ! restart the computations with the new set of knots. 200 continue ! test whether the least-squares kth degree polynomial is a solution ! of our approximation problem. 250 if(ier.eq.(-2)) go to 440 !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ! part 2: determination of the smoothing spline sp(x). c ! *************************************************** c ! we have determined the number of knots and their position. c ! we now compute the b-spline coefficients of the smoothing spline c ! sp(x). the observation matrix a is extended by the rows of matrix c ! b expressing that the kth derivative discontinuities of sp(x) at c ! the interior knots t(k+2),...t(n-k-1) must be zero. the corres- c ! ponding weights of these additional rows are set to 1/p. c ! iteratively we then have to determine the value of p such that c ! f(p)=sum((w(i)*(y(i)-sp(x(i))))**2) be = s. we already know that c ! the least-squares kth degree polynomial corresponds to p=0, and c ! that the least-squares spline corresponds to p=infinity. the c ! iteration process which is proposed here, makes use of rational c ! interpolation. since f(p) is a convex and strictly decreasing c ! function of p, it can be approximated by a rational function c ! r(p) = (u*p+v)/(p+w). three values of p(p1,p2,p3) with correspond- c ! ing values of f(p) (f1=f(p1)-s,f2=f(p2)-s,f3=f(p3)-s) are used c ! to calculate the new value of p such that r(p)=s. convergence is c ! guaranteed by taking f1>0 and f3<0. c !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ! evaluate the discontinuity jump of the kth derivative of the ! b-splines at the knots t(l),l=k+2,...n-k-1 and store in b. call fpdisc(t,n,k2,b,nest) ! initial value for p. p1 = 0. f1 = fp0-s p3 = -one f3 = fpms p = 0. do 255 i=1,nk1 p = p+a(i,1) 255 continue rn = nk1 p = rn/p ich1 = 0 ich3 = 0 n8 = n-nmin ! iteration process to find the root of f(p) = s. do 360 iter=1,maxit ! the rows of matrix b with weight 1/p are rotated into the ! triangularised observation matrix a which is stored in g. pinv = one/p do 260 i=1,nk1 c(i) = z(i) g(i,k2) = 0. do 260 j=1,k1 g(i,j) = a(i,j) 260 continue do 300 it=1,n8 ! the row of matrix b is rotated into triangle by givens transformation do 270 i=1,k2 h(i) = b(it,i)*pinv 270 continue yi = 0. do 290 j=it,nk1 piv = h(1) ! calculate the parameters of the givens transformation. call fpgivs(piv,g(j,1),cos,sin) ! transformations to right hand side. call fprota(cos,sin,yi,c(j)) if(j.eq.nk1) go to 300 i2 = k1 if(j.gt.n8) i2 = nk1-j do 280 i=1,i2 ! transformations to left hand side. i1 = i+1 call fprota(cos,sin,h(i1),g(j,i1)) h(i) = h(i1) 280 continue h(i2+1) = 0. 290 continue 300 continue ! backward substitution to obtain the b-spline coefficients. call fpback(g,c,nk1,k2,c,nest) ! computation of f(p). fp = 0. l = k2 do 330 it=1,m if(x(it).lt.t(l) .or. l.gt.nk1) go to 310 l = l+1 310 l0 = l-k2 term = 0. do 320 j=1,k1 l0 = l0+1 term = term+c(l0)*q(it,j) 320 continue fp = fp+(w(it)*(term-y(it)))**2 330 continue ! test whether the approximation sp(x) is an acceptable solution. fpms = fp-s if(abs(fpms).lt.acc) go to 440 ! test whether the maximal number of iterations is reached. if(iter.eq.maxit) go to 400 ! carry out one more step of the iteration process. p2 = p f2 = fpms if(ich3.ne.0) go to 340 if((f2-f3).gt.acc) go to 335 ! our initial choice of p is too large. p3 = p2 f3 = f2 p = p*con4 if(p.le.p1) p=p1*con9 + p2*con1 go to 360 335 if(f2.lt.0.) ich3=1 340 if(ich1.ne.0) go to 350 if((f1-f2).gt.acc) go to 345 ! our initial choice of p is too small p1 = p2 f1 = f2 p = p/con4 if(p3.lt.0.) go to 360 if(p.ge.p3) p = p2*con1 + p3*con9 go to 360 345 if(f2.gt.0.) ich1=1 ! test whether the iteration process proceeds as theoretically ! expected. 350 if(f2.ge.f1 .or. f2.le.f3) go to 410 ! find the new value for p. p = fprati(p1,f1,p2,f2,p3,f3) 360 continue ! error codes and messages. 400 ier = 3 go to 440 410 ier = 2 go to 440 420 ier = 1 go to 440 430 ier = -1 440 return end
zrick/tlab
src/external/fitpack/fpcurf.f90
FORTRAN
gpl-3.0
12,868
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type import base64 import subprocess import sys import time import traceback from ansible.compat.six import iteritems, string_types, binary_type from ansible import constants as C from ansible.errors import AnsibleError, AnsibleParserError, AnsibleUndefinedVariable, AnsibleConnectionFailure from ansible.executor.task_result import TaskResult from ansible.module_utils._text import to_bytes, to_text from ansible.playbook.conditional import Conditional from ansible.playbook.task import Task from ansible.template import Templar from ansible.utils.encrypt import key_for_hostname from ansible.utils.listify import listify_lookup_plugin_terms from ansible.utils.ssh_functions import check_for_controlpersist from ansible.vars.unsafe_proxy import UnsafeProxy, wrap_var try: from __main__ import display except ImportError: from ansible.utils.display import Display display = Display() __all__ = ['TaskExecutor'] class TaskExecutor: ''' This is the main worker class for the executor pipeline, which handles loading an action plugin to actually dispatch the task to a given host. This class roughly corresponds to the old Runner() class. ''' # Modules that we optimize by squashing loop items into a single call to # the module SQUASH_ACTIONS = frozenset(C.DEFAULT_SQUASH_ACTIONS) def __init__(self, host, task, job_vars, play_context, new_stdin, loader, shared_loader_obj, rslt_q): self._host = host self._task = task self._job_vars = job_vars self._play_context = play_context self._new_stdin = new_stdin self._loader = loader self._shared_loader_obj = shared_loader_obj self._connection = None self._rslt_q = rslt_q self._task.squash() def run(self): ''' The main executor entrypoint, where we determine if the specified task requires looping and either runs the task with self._run_loop() or self._execute(). After that, the returned results are parsed and returned as a dict. ''' display.debug("in run()") try: items = self._get_loop_items() if items is not None: if len(items) > 0: item_results = self._run_loop(items) # loop through the item results, and remember the changed/failed # result flags based on any item there. changed = False failed = False for item in item_results: if 'changed' in item and item['changed']: changed = True if 'failed' in item and item['failed']: failed = True # create the overall result item, and set the changed/failed # flags there to reflect the overall result of the loop res = dict(results=item_results) if changed: res['changed'] = True if failed: res['failed'] = True res['msg'] = 'One or more items failed' else: res['msg'] = 'All items completed' else: res = dict(changed=False, skipped=True, skipped_reason='No items in the list', results=[]) else: display.debug("calling self._execute()") res = self._execute() display.debug("_execute() done") # make sure changed is set in the result, if it's not present if 'changed' not in res: res['changed'] = False def _clean_res(res): if isinstance(res, UnsafeProxy): return res._obj elif isinstance(res, binary_type): return to_text(res, errors='surrogate_or_strict') elif isinstance(res, dict): for k in res: res[k] = _clean_res(res[k]) elif isinstance(res, list): for idx,item in enumerate(res): res[idx] = _clean_res(item) return res display.debug("dumping result to json") res = _clean_res(res) display.debug("done dumping result, returning") return res except AnsibleError as e: return dict(failed=True, msg=to_text(e, nonstring='simplerepr')) except Exception as e: return dict(failed=True, msg='Unexpected failure during module execution.', exception=to_text(traceback.format_exc()), stdout='') finally: try: self._connection.close() except AttributeError: pass except Exception as e: display.debug(u"error closing connection: %s" % to_text(e)) def _get_loop_items(self): ''' Loads a lookup plugin to handle the with_* portion of a task (if specified), and returns the items result. ''' # save the play context variables to a temporary dictionary, # so that we can modify the job vars without doing a full copy # and later restore them to avoid modifying things too early play_context_vars = dict() self._play_context.update_vars(play_context_vars) old_vars = dict() for k in play_context_vars: if k in self._job_vars: old_vars[k] = self._job_vars[k] self._job_vars[k] = play_context_vars[k] # get search path for this task to pass to lookup plugins self._job_vars['ansible_search_path'] = self._task.get_search_path() templar = Templar(loader=self._loader, shared_loader_obj=self._shared_loader_obj, variables=self._job_vars) items = None if self._task.loop: if self._task.loop in self._shared_loader_obj.lookup_loader: if self._task.loop == 'first_found': # first_found loops are special. If the item is undefined then we want to fall through to the next value rather than failing. loop_terms = listify_lookup_plugin_terms(terms=self._task.loop_args, templar=templar, loader=self._loader, fail_on_undefined=False, convert_bare=False) loop_terms = [t for t in loop_terms if not templar._contains_vars(t)] else: loop_terms = listify_lookup_plugin_terms(terms=self._task.loop_args, templar=templar, loader=self._loader, fail_on_undefined=True, convert_bare=False) # get lookup mylookup = self._shared_loader_obj.lookup_loader.get(self._task.loop, loader=self._loader, templar=templar) # give lookup task 'context' for subdir (mostly needed for first_found) for subdir in ['template', 'var', 'file']: # TODO: move this to constants? if subdir in self._task.action: break setattr(mylookup,'_subdir', subdir + 's') # run lookup items = mylookup.run(terms=loop_terms, variables=self._job_vars, wantlist=True) else: raise AnsibleError("Unexpected failure in finding the lookup named '%s' in the available lookup plugins" % self._task.loop) # now we restore any old job variables that may have been modified, # and delete them if they were in the play context vars but not in # the old variables dictionary for k in play_context_vars: if k in old_vars: self._job_vars[k] = old_vars[k] else: del self._job_vars[k] if items: from ansible.vars.unsafe_proxy import UnsafeProxy for idx, item in enumerate(items): if item is not None and not isinstance(item, UnsafeProxy): items[idx] = UnsafeProxy(item) # ensure basedir is always in (dwim already searches here but we need to display it) if self._loader.get_basedir() not in self._job_vars['ansible_search_path']: self._job_vars['ansible_search_path'].append(self._loader.get_basedir()) return items def _run_loop(self, items): ''' Runs the task with the loop items specified and collates the result into an array named 'results' which is inserted into the final result along with the item for which the loop ran. ''' results = [] # make copies of the job vars and task so we can add the item to # the variables and re-validate the task with the item variable #task_vars = self._job_vars.copy() task_vars = self._job_vars loop_var = 'item' label = None loop_pause = 0 if self._task.loop_control: # the value may be 'None', so we still need to default it back to 'item' loop_var = self._task.loop_control.loop_var or 'item' label = self._task.loop_control.label or ('{{' + loop_var + '}}') loop_pause = self._task.loop_control.pause or 0 if loop_var in task_vars: display.warning(u"The loop variable '%s' is already in use. " u"You should set the `loop_var` value in the `loop_control` option for the task" u" to something else to avoid variable collisions and unexpected behavior." % loop_var) ran_once = False items = self._squash_items(items, loop_var, task_vars) for item in items: task_vars[loop_var] = item # pause between loop iterations if loop_pause and ran_once: time.sleep(loop_pause) else: ran_once = True try: tmp_task = self._task.copy(exclude_parent=True, exclude_tasks=True) tmp_task._parent = self._task._parent tmp_play_context = self._play_context.copy() except AnsibleParserError as e: results.append(dict(failed=True, msg=to_text(e))) continue # now we swap the internal task and play context with their copies, # execute, and swap them back so we can do the next iteration cleanly (self._task, tmp_task) = (tmp_task, self._task) (self._play_context, tmp_play_context) = (tmp_play_context, self._play_context) res = self._execute(variables=task_vars) (self._task, tmp_task) = (tmp_task, self._task) (self._play_context, tmp_play_context) = (tmp_play_context, self._play_context) # now update the result with the item info, and append the result # to the list of results res[loop_var] = item res['_ansible_item_result'] = True if label is not None: templar = Templar(loader=self._loader, shared_loader_obj=self._shared_loader_obj, variables=self._job_vars) res['_ansible_item_label'] = templar.template(label) self._rslt_q.put(TaskResult(self._host.name, self._task._uuid, res), block=False) results.append(res) del task_vars[loop_var] return results def _squash_items(self, items, loop_var, variables): ''' Squash items down to a comma-separated list for certain modules which support it (typically package management modules). ''' name = None try: # _task.action could contain templatable strings (via action: and # local_action:) Template it before comparing. If we don't end up # optimizing it here, the templatable string might use template vars # that aren't available until later (it could even use vars from the # with_items loop) so don't make the templated string permanent yet. templar = Templar(loader=self._loader, shared_loader_obj=self._shared_loader_obj, variables=variables) task_action = self._task.action if templar._contains_vars(task_action): task_action = templar.template(task_action, fail_on_undefined=False) if len(items) > 0 and task_action in self.SQUASH_ACTIONS: if all(isinstance(o, string_types) for o in items): final_items = [] for allowed in ['name', 'pkg', 'package']: name = self._task.args.pop(allowed, None) if name is not None: break # This gets the information to check whether the name field # contains a template that we can squash for template_no_item = template_with_item = None if name: if templar._contains_vars(name): variables[loop_var] = '\0$' template_no_item = templar.template(name, variables, cache=False) variables[loop_var] = '\0@' template_with_item = templar.template(name, variables, cache=False) del variables[loop_var] # Check if the user is doing some operation that doesn't take # name/pkg or the name/pkg field doesn't have any variables # and thus the items can't be squashed if template_no_item != template_with_item: for item in items: variables[loop_var] = item if self._task.evaluate_conditional(templar, variables): new_item = templar.template(name, cache=False) final_items.append(new_item) self._task.args['name'] = final_items # Wrap this in a list so that the calling function loop # executes exactly once return [final_items] else: # Restore the name parameter self._task.args['name'] = name #elif: # Right now we only optimize single entries. In the future we # could optimize more types: # * lists can be squashed together # * dicts could squash entries that match in all cases except the # name or pkg field. except: # Squashing is an optimization. If it fails for any reason, # simply use the unoptimized list of items. # Restore the name parameter if name is not None: self._task.args['name'] = name return items def _execute(self, variables=None): ''' The primary workhorse of the executor system, this runs the task on the specified host (which may be the delegated_to host) and handles the retry/until and block rescue/always execution ''' if variables is None: variables = self._job_vars templar = Templar(loader=self._loader, shared_loader_obj=self._shared_loader_obj, variables=variables) context_validation_error = None try: # apply the given task's information to the connection info, # which may override some fields already set by the play or # the options specified on the command line self._play_context = self._play_context.set_task_and_variable_override(task=self._task, variables=variables, templar=templar) # fields set from the play/task may be based on variables, so we have to # do the same kind of post validation step on it here before we use it. self._play_context.post_validate(templar=templar) # now that the play context is finalized, if the remote_addr is not set # default to using the host's address field as the remote address if not self._play_context.remote_addr: self._play_context.remote_addr = self._host.address # We also add "magic" variables back into the variables dict to make sure # a certain subset of variables exist. self._play_context.update_vars(variables) except AnsibleError as e: # save the error, which we'll raise later if we don't end up # skipping this task during the conditional evaluation step context_validation_error = e # Evaluate the conditional (if any) for this task, which we do before running # the final task post-validation. We do this before the post validation due to # the fact that the conditional may specify that the task be skipped due to a # variable not being present which would otherwise cause validation to fail try: if not self._task.evaluate_conditional(templar, variables): display.debug("when evaluation failed, skipping this task") return dict(changed=False, skipped=True, skip_reason='Conditional check failed', _ansible_no_log=self._play_context.no_log) except AnsibleError: # skip conditional exception in the case of includes as the vars needed might not be avaiable except in the included tasks or due to tags if self._task.action not in ['include', 'include_role']: raise # if we ran into an error while setting up the PlayContext, raise it now if context_validation_error is not None: raise context_validation_error # if this task is a TaskInclude, we just return now with a success code so the # main thread can expand the task list for the given host if self._task.action == 'include': include_variables = self._task.args.copy() include_file = include_variables.pop('_raw_params', None) if not include_file: return dict(failed=True, msg="No include file was specified to the include") include_file = templar.template(include_file) return dict(include=include_file, include_variables=include_variables) # if this task is a IncludeRole, we just return now with a success code so the main thread can expand the task list for the given host elif self._task.action == 'include_role': include_variables = self._task.args.copy() return dict(include_role=self._task, include_variables=include_variables) # Now we do final validation on the task, which sets all fields to their final values. self._task.post_validate(templar=templar) if '_variable_params' in self._task.args: variable_params = self._task.args.pop('_variable_params') if isinstance(variable_params, dict): display.deprecated("Using variables for task params is unsafe, especially if the variables come from an external source like facts") variable_params.update(self._task.args) self._task.args = variable_params # get the connection and the handler for this execution if not self._connection or not getattr(self._connection, 'connected', False) or self._play_context.remote_addr != self._connection._play_context.remote_addr: self._connection = self._get_connection(variables=variables, templar=templar) hostvars = variables.get('hostvars', None) if hostvars: try: target_hostvars = hostvars.raw_get(self._host.name) except: # FIXME: this should catch the j2undefined error here # specifically instead of all exceptions target_hostvars = dict() else: target_hostvars = dict() self._connection.set_host_overrides(host=self._host, hostvars=target_hostvars) else: # if connection is reused, its _play_context is no longer valid and needs # to be replaced with the one templated above, in case other data changed self._connection._play_context = self._play_context self._handler = self._get_action_handler(connection=self._connection, templar=templar) # And filter out any fields which were set to default(omit), and got the omit token value omit_token = variables.get('omit') if omit_token is not None: self._task.args = dict((i[0], i[1]) for i in iteritems(self._task.args) if i[1] != omit_token) # Read some values from the task, so that we can modify them if need be if self._task.until: retries = self._task.retries if retries is None: retries = 3 elif retries <= 0: retries = 1 else: retries += 1 else: retries = 1 delay = self._task.delay if delay < 0: delay = 1 # make a copy of the job vars here, in case we need to update them # with the registered variable value later on when testing conditions vars_copy = variables.copy() display.debug("starting attempt loop") result = None for attempt in range(1, retries + 1): display.debug("running the handler") try: result = self._handler.run(task_vars=variables) except AnsibleConnectionFailure as e: return dict(unreachable=True, msg=to_text(e)) display.debug("handler run complete") # preserve no log result["_ansible_no_log"] = self._play_context.no_log # update the local copy of vars with the registered value, if specified, # or any facts which may have been generated by the module execution if self._task.register: vars_copy[self._task.register] = wrap_var(result.copy()) if self._task.async > 0: if self._task.poll > 0 and not result.get('skipped'): result = self._poll_async_result(result=result, templar=templar, task_vars=vars_copy) # ensure no log is preserved result["_ansible_no_log"] = self._play_context.no_log # helper methods for use below in evaluating changed/failed_when def _evaluate_changed_when_result(result): if self._task.changed_when is not None and self._task.changed_when: cond = Conditional(loader=self._loader) cond.when = self._task.changed_when result['changed'] = cond.evaluate_conditional(templar, vars_copy) def _evaluate_failed_when_result(result): if self._task.failed_when: cond = Conditional(loader=self._loader) cond.when = self._task.failed_when failed_when_result = cond.evaluate_conditional(templar, vars_copy) result['failed_when_result'] = result['failed'] = failed_when_result else: failed_when_result = False return failed_when_result if 'ansible_facts' in result: vars_copy.update(result['ansible_facts']) # set the failed property if the result has a non-zero rc. This will be # overridden below if the failed_when property is set if result.get('rc', 0) != 0: result['failed'] = True # if we didn't skip this task, use the helpers to evaluate the changed/ # failed_when properties if 'skipped' not in result: _evaluate_changed_when_result(result) _evaluate_failed_when_result(result) if retries > 1: cond = Conditional(loader=self._loader) cond.when = self._task.until result['attempts'] = attempt if cond.evaluate_conditional(templar, vars_copy): break else: # no conditional check, or it failed, so sleep for the specified time if attempt < retries: result['_ansible_retry'] = True result['retries'] = retries display.debug('Retrying task, attempt %d of %d' % (attempt, retries)) self._rslt_q.put(TaskResult(self._host.name, self._task._uuid, result), block=False) time.sleep(delay) else: if retries > 1: # we ran out of attempts, so mark the result as failed result['attempts'] = retries - 1 result['failed'] = True # do the final update of the local variables here, for both registered # values and any facts which may have been created if self._task.register: variables[self._task.register] = wrap_var(result) if 'ansible_facts' in result: variables.update(result['ansible_facts']) # save the notification target in the result, if it was specified, as # this task may be running in a loop in which case the notification # may be item-specific, ie. "notify: service {{item}}" if self._task.notify is not None: result['_ansible_notify'] = self._task.notify # add the delegated vars to the result, so we can reference them # on the results side without having to do any further templating # FIXME: we only want a limited set of variables here, so this is currently # hardcoded but should be possibly fixed if we want more or if # there is another source of truth we can use delegated_vars = variables.get('ansible_delegated_vars', dict()).get(self._task.delegate_to, dict()).copy() if len(delegated_vars) > 0: result["_ansible_delegated_vars"] = dict() for k in ('ansible_host', ): result["_ansible_delegated_vars"][k] = delegated_vars.get(k) # and return display.debug("attempt loop complete, returning result") return result def _poll_async_result(self, result, templar, task_vars=None): ''' Polls for the specified JID to be complete ''' if task_vars is None: task_vars = self._job_vars async_jid = result.get('ansible_job_id') if async_jid is None: return dict(failed=True, msg="No job id was returned by the async task") # Create a new psuedo-task to run the async_status module, and run # that (with a sleep for "poll" seconds between each retry) until the # async time limit is exceeded. async_task = Task().load(dict(action='async_status jid=%s' % async_jid)) # Because this is an async task, the action handler is async. However, # we need the 'normal' action handler for the status check, so get it # now via the action_loader normal_handler = self._shared_loader_obj.action_loader.get( 'normal', task=async_task, connection=self._connection, play_context=self._play_context, loader=self._loader, templar=templar, shared_loader_obj=self._shared_loader_obj, ) time_left = self._task.async while time_left > 0: time.sleep(self._task.poll) try: async_result = normal_handler.run(task_vars=task_vars) # We do not bail out of the loop in cases where the failure # is associated with a parsing error. The async_runner can # have issues which result in a half-written/unparseable result # file on disk, which manifests to the user as a timeout happening # before it's time to timeout. if int(async_result.get('finished', 0)) == 1 or ('failed' in async_result and async_result.get('_ansible_parsed', False)) or 'skipped' in async_result: break except Exception as e: # Connections can raise exceptions during polling (eg, network bounce, reboot); these should be non-fatal. # On an exception, call the connection's reset method if it has one (eg, drop/recreate WinRM connection; some reused connections are in a broken state) display.vvvv("Exception during async poll, retrying... (%s)" % to_text(e)) display.debug("Async poll exception was:\n%s" % to_text(traceback.format_exc())) try: normal_handler._connection._reset() except AttributeError: pass time_left -= self._task.poll if int(async_result.get('finished', 0)) != 1: if async_result.get('_ansible_parsed'): return dict(failed=True, msg="async task did not complete within the requested time") else: return dict(failed=True, msg="async task produced unparseable results", async_result=async_result) else: return async_result def _get_connection(self, variables, templar): ''' Reads the connection property for the host, and returns the correct connection object from the list of connection plugins ''' if self._task.delegate_to is not None: # since we're delegating, we don't want to use interpreter values # which would have been set for the original target host for i in list(variables.keys()): if isinstance(i, string_types) and i.startswith('ansible_') and i.endswith('_interpreter'): del variables[i] # now replace the interpreter values with those that may have come # from the delegated-to host delegated_vars = variables.get('ansible_delegated_vars', dict()).get(self._task.delegate_to, dict()) if isinstance(delegated_vars, dict): for i in delegated_vars: if isinstance(i, string_types) and i.startswith("ansible_") and i.endswith("_interpreter"): variables[i] = delegated_vars[i] conn_type = self._play_context.connection if conn_type == 'smart': conn_type = 'ssh' if sys.platform.startswith('darwin') and self._play_context.password: # due to a current bug in sshpass on OSX, which can trigger # a kernel panic even for non-privileged users, we revert to # paramiko on that OS when a SSH password is specified conn_type = "paramiko" else: # see if SSH can support ControlPersist if not use paramiko if not check_for_controlpersist(self._play_context.ssh_executable): conn_type = "paramiko" connection = self._shared_loader_obj.connection_loader.get(conn_type, self._play_context, self._new_stdin) if not connection: raise AnsibleError("the connection plugin '%s' was not found" % conn_type) if self._play_context.accelerate: # accelerate is deprecated as of 2.1... display.deprecated('Accelerated mode is deprecated. Consider using SSH with ControlPersist and pipelining enabled instead') # launch the accelerated daemon here ssh_connection = connection handler = self._shared_loader_obj.action_loader.get( 'normal', task=self._task, connection=ssh_connection, play_context=self._play_context, loader=self._loader, templar=templar, shared_loader_obj=self._shared_loader_obj, ) key = key_for_hostname(self._play_context.remote_addr) accelerate_args = dict( password=base64.b64encode(key.__str__()), port=self._play_context.accelerate_port, minutes=C.ACCELERATE_DAEMON_TIMEOUT, ipv6=self._play_context.accelerate_ipv6, debug=self._play_context.verbosity, ) connection = self._shared_loader_obj.connection_loader.get('accelerate', self._play_context, self._new_stdin) if not connection: raise AnsibleError("the connection plugin '%s' was not found" % conn_type) try: connection._connect() except AnsibleConnectionFailure: display.debug('connection failed, fallback to accelerate') res = handler._execute_module(module_name='accelerate', module_args=accelerate_args, task_vars=variables, delete_remote_tmp=False) display.debug(res) connection._connect() return connection def _get_action_handler(self, connection, templar): ''' Returns the correct action plugin to handle the requestion task action ''' if self._task.action in self._shared_loader_obj.action_loader: if self._task.async != 0: raise AnsibleError("async mode is not supported with the %s module" % self._task.action) handler_name = self._task.action elif self._task.async == 0: handler_name = 'normal' else: handler_name = 'async' handler = self._shared_loader_obj.action_loader.get( handler_name, task=self._task, connection=connection, play_context=self._play_context, loader=self._loader, templar=templar, shared_loader_obj=self._shared_loader_obj, ) if not handler: raise AnsibleError("the handler '%s' was not found" % handler_name) return handler
wenottingham/ansible
lib/ansible/executor/task_executor.py
Python
gpl-3.0
35,230
#!/usr/bin/env bash source openmicroscopy/components/blitz/target/generated/resources/Classpath.sh java -cp $CLASSPATH ome.formats.importer.cli.CommandLineImporter "$@"
c0c0n3/omero-ms-queue
components/server/src/test/scripts/ome/blitz-import-test.sh
Shell
gpl-3.0
171
/* * Oreka -- A media capture and retrieval platform * * Copyright (C) 2005, orecx LLC * * http://www.orecx.com * * This program is free software, distributed under the terms of * the GNU General Public License. * Please refer to http://www.gnu.org/copyleft/gpl.html * */ #define _WINSOCKAPI_ // prevents the inclusion of winsock.h #include "ace/OS_NS_dirent.h" #include "LogManager.h" #include <log4cxx/propertyconfigurator.h> #include <log4cxx/basicconfigurator.h> #include <log4cxx/logmanager.h> OrkLogManager OrkLogManager::m_orkLogManager; OrkLogManager* OrkLogManager::Instance() { return &m_orkLogManager; } void OrkLogManager::Initialize() { BasicConfigurator::resetConfiguration(); BasicConfigurator::configure(); char* logCfgFilename = NULL; char* cfgEnvPath = ""; int cfgAlloc = 0; cfgEnvPath = ACE_OS::getenv("ORKAUDIO_CONFIG_PATH"); if(cfgEnvPath) { ACE_DIR* dir = ACE_OS::opendir(cfgEnvPath); if(dir) { int len = 0; ACE_OS::closedir(dir); len = strlen(cfgEnvPath)+1+strlen("logging.properties")+1; logCfgFilename = (char*)malloc(len); if(logCfgFilename) { cfgAlloc = 1; ACE_OS::snprintf(logCfgFilename, len, "%s/%s", cfgEnvPath, "logging.properties"); } } } if(!logCfgFilename) { FILE* file = ACE_OS::fopen("logging.properties", "r"); if(file) { // logging.properties exists in the current directory logCfgFilename = (char*)"logging.properties"; fclose(file); } else { // logging.properties could not be found in the current // directory, try to find it in system configuration directory logCfgFilename = (char*)"/etc/orkaudio/logging.properties"; } } // If this one fails, the above default configuration stays valid PropertyConfigurator::configure(logCfgFilename); // XXX should we free this here? if(cfgAlloc) { free(logCfgFilename); } rootLog = Logger::getLogger("root"); topLog = Logger::getLogger("top"); immediateProcessingLog = Logger::getLogger("immediateProcessing"); batchProcessingLog = Logger::getLogger("batchProcessing"); tapeFileNamingLog = Logger::getLogger("tapeFileNamingLog"); portLog = Logger::getLogger("port"); fileLog = Logger::getLogger("file"); configLog = Logger::getLogger("config"); tapelistLog = Logger::getLogger("tapelist"); tapeLog = Logger::getLogger("tape"); clientLog = Logger::getLogger("orkclient"); directionSelectorLog = Logger::getLogger("directionSelector"); reporting = Logger::getLogger("reporting"); ipfragmentation = Logger::getLogger("ipfragmentation"); messaging = Logger::getLogger("messaging"); } void OrkLogManager::Shutdown() { log4cxx::LogManager::shutdown(); }
iulianu/oreka
orkbasecxx/LogManager.cpp
C++
gpl-3.0
2,892
/* * Copyright (c) 2017-2021 Free Software Foundation, Inc. * * This file is part of GNU Wget. * * GNU Wget is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * GNU Wget is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Wget. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> #include <sys/types.h> #include <dirent.h> // opendir, readdir #include <stdint.h> // uint8_t #include <stdio.h> // fmemopen #include <string.h> // strncmp #include <stdlib.h> // free #include <fcntl.h> // open flags #include <unistd.h> // close #include <setjmp.h> // longjmp, setjmp #include "wget.h" #undef fopen_wgetrc #ifdef __cplusplus extern "C" { #endif #include "ftp.h" // declarations for wget internal functions int main_wget(int argc, const char **argv); void cleanup(void); FILE *fopen_wget(const char *pathname, const char *mode); FILE *fopen_wgetrc(const char *pathname, const char *mode); void exit_wget(int status); #ifdef __cplusplus } #endif #include "fuzzer.h" FILE *fopen_wget(const char *pathname, const char *mode) { return fopen("/dev/null", mode); } FILE *fopen_wgetrc(const char *pathname, const char *mode) { return NULL; } static int do_jump; static jmp_buf jmpbuf; #ifdef FUZZING void exit_wget(int status) { longjmp(jmpbuf, 1); } #elif defined HAVE_DLFCN_H #include <dlfcn.h> // dlsym #ifndef RTLD_NEXT #define RTLD_NEXT RTLD_GLOBAL #endif void exit(int status) { if (do_jump) { longjmp(jmpbuf, 1); } else { void (*libc_exit)(int) = (void(*)(int)) dlsym (RTLD_NEXT, "exit"); libc_exit(status); } } #endif int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { #ifdef HAVE_FMEMOPEN FILE *fp; struct fileinfo *fi; if (size > 4096) // same as max_len = ... in .options file return 0; fp = fmemopen((void *) data, size, "r"); if (!fp) return 0; CLOSE_STDERR do_jump = 1; if (setjmp(jmpbuf)) goto done; fi = ftp_parse_ls_fp(fp, ST_UNIX); freefileinfo(fi); rewind(fp); fi = ftp_parse_ls_fp(fp, ST_VMS); freefileinfo(fi); rewind(fp); fi = ftp_parse_ls_fp(fp, ST_WINNT); freefileinfo(fi); rewind(fp); fi = ftp_parse_ls_fp(fp, ST_MACOS); done: freefileinfo(fi); fclose(fp); do_jump = 0; RESTORE_STDERR #endif return 0; }
mirror/wget
fuzz/wget_ftpls_fuzzer.c
C
gpl-3.0
2,690
/* * Vortex OpenSplice * * This software and documentation are Copyright 2006 to TO_YEAR ADLINK * Technology Limited, its affiliated companies and licensors. 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. * */ package org.opensplice.dds.sub; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.omg.dds.core.InstanceHandle; import org.omg.dds.core.ServiceEnvironment; import org.omg.dds.sub.DataReader; import org.omg.dds.sub.DataReader.Selector; import org.omg.dds.sub.ReadCondition; import org.omg.dds.sub.Sample; import org.omg.dds.sub.Sample.Iterator; import org.omg.dds.sub.Subscriber.DataState; import org.opensplice.dds.core.IllegalArgumentExceptionImpl; import org.opensplice.dds.core.OsplServiceEnvironment; public class SelectorImpl<TYPE> implements DataReader.Selector<TYPE> { private final OsplServiceEnvironment environment; private final AbstractDataReader<TYPE> reader; private final int maxSamples; private final InstanceHandle instance; private final boolean retrieveNextInstance; private final DataState dataState; private final ReadConditionImpl<TYPE> condition; private final String queryExpression; private final List<String> queryParameters; public SelectorImpl(OsplServiceEnvironment environment, AbstractDataReader<TYPE> reader) { this.environment = environment; this.reader = reader; this.maxSamples = DDS.LENGTH_UNLIMITED.value; this.condition = null; this.dataState = DataStateImpl.any(environment); this.queryExpression = null; this.queryParameters = new ArrayList<String>(); this.instance = this.environment.getSPI().nilHandle(); this.retrieveNextInstance = false; } @SuppressWarnings("unchecked") private SelectorImpl(SelectorImpl<TYPE> s, DataState dataState, String queryExpression, List<String> queryParameters, int maxSamples, InstanceHandle instance, boolean retrieveNextInstance) { this.environment = s.environment; this.reader = s.reader; this.maxSamples = maxSamples; this.instance = instance; this.retrieveNextInstance = retrieveNextInstance; this.dataState = dataState.clone(); this.queryExpression = queryExpression; if (queryParameters == null) { throw new IllegalArgumentExceptionImpl(this.environment, "Illegal List of query arguments (null) provided."); } this.queryParameters = new ArrayList<String>(queryParameters); if (this.queryExpression != null) { this.condition = (ReadConditionImpl<TYPE>) this.reader .createQueryCondition(this.dataState, this.queryExpression, this.queryParameters); } else { this.condition = null; } } private SelectorImpl(SelectorImpl<TYPE> s, String queryExpression, List<String> queryParameters) { this(s, s.dataState, queryExpression, queryParameters, s.maxSamples, s.instance, s.retrieveNextInstance); } private SelectorImpl(SelectorImpl<TYPE> s, DataState dataState) { this(s, dataState, s.queryExpression, s.queryParameters, s.maxSamples, s.instance, s.retrieveNextInstance); } private SelectorImpl(SelectorImpl<TYPE> s, int maxSamples) { this(s, s.dataState, s.queryExpression, s.queryParameters, maxSamples, s.instance, s.retrieveNextInstance); } private SelectorImpl(SelectorImpl<TYPE> s, InstanceHandle instance) { this(s, s.dataState, s.queryExpression, s.queryParameters, s.maxSamples, instance, s.retrieveNextInstance); } private SelectorImpl(SelectorImpl<TYPE> s, boolean retrieveNextInstance) { this(s, s.dataState, s.queryExpression, s.queryParameters, s.maxSamples, s.instance, retrieveNextInstance); } @Override public ServiceEnvironment getEnvironment() { return this.environment; } @Override public Selector<TYPE> instance(InstanceHandle handle) { if (handle == null) { throw new IllegalArgumentExceptionImpl(this.environment, "Illegal InstanceHandle (null) provided."); } if (!handle.equals(this.instance)) { return new SelectorImpl<TYPE>(this, handle); } return this; } @Override public Selector<TYPE> nextInstance(boolean retrieveNextInstance) { if (this.retrieveNextInstance != retrieveNextInstance) { return new SelectorImpl<TYPE>(this, retrieveNextInstance); } return this; } private void checkDataStateValidity(DataState state) { if (state.getInstanceStates().size() == 0) { throw new IllegalArgumentExceptionImpl(this.environment, "Illegal instance state."); } if (state.getSampleStates().size() == 0) { throw new IllegalArgumentExceptionImpl(this.environment, "Illegal sample state."); } if (state.getViewStates().size() == 0) { throw new IllegalArgumentExceptionImpl(this.environment, "Illegal view state."); } } @Override public Selector<TYPE> dataState(DataState state) { if (state == null) { throw new IllegalArgumentExceptionImpl(environment, "Illegal DataState (null) provided."); } checkDataStateValidity(state); if (!state.equals(this.dataState)) { return new SelectorImpl<TYPE>(this, state); } return this; } private boolean isQueryEqualToCurrent(String qe, List<String> qp) { if (qe == null) { if (qp != null) { if (qp.size() > 0) { throw new IllegalArgumentException( "Query parameters for null query expression provided."); } } if (this.queryExpression == null) { if (qp == null) { return false; } return true; } return false; } if (qe.equals(this.queryExpression)) { if (qp == null) { if (this.queryParameters.size() == 0) { return true; } return false; } else if (qp.size() == 0 && this.queryParameters.size() == 0) { return true; } else if (qp.size() != this.queryParameters.size()) { return false; } else { for (int i = 0; i < qp.size(); i++) { if (!qp.get(i).equals(this.queryParameters.get(i))) { return false; } } return true; } } return false; } @Override public Selector<TYPE> Content(String queryExpression, List<String> queryParameters) { if (!isQueryEqualToCurrent(queryExpression, queryParameters)) { return new SelectorImpl<TYPE>(this, queryExpression, queryParameters); } return this; } @Override public Selector<TYPE> Content(String queryExpression, String... queryParameters) { if (queryParameters == null) { return this.Content(queryExpression, new ArrayList<String>()); } return this.Content(queryExpression, Arrays.asList(queryParameters)); } @Override public Selector<TYPE> maxSamples(int max) { if (max < 1) { throw new IllegalArgumentExceptionImpl(this.environment, "maxSamples < 1 not supported."); } if (this.maxSamples != max) { return new SelectorImpl<TYPE>(this, max); } return this; } @Override public InstanceHandle getInstance() { return this.instance; } @Override public boolean retrieveNextInstance() { return this.retrieveNextInstance; } @Override public DataState getDataState() { return this.dataState.clone(); } @Override public String getQueryExpression() { return this.queryExpression; } @Override public List<String> getQueryParameters() { return Collections.unmodifiableList(this.queryParameters); } @Override public int getMaxSamples() { return this.maxSamples; } @Override public ReadCondition<TYPE> getCondition() { if (this.condition == null) { return this.reader.createReadCondition(this.dataState); } return this.condition; } @Override public Iterator<TYPE> read() { return this.reader.read(this); } @Override public List<Sample<TYPE>> read(List<Sample<TYPE>> samples) { return this.reader.read(samples, this); } @Override public Iterator<TYPE> take() { return this.reader.take(this); } @Override public List<Sample<TYPE>> take(List<Sample<TYPE>> samples) { return this.reader.take(samples, this); } @Override protected void finalize() { if (this.condition != null) { try { this.condition.close(); } catch (Exception e) { // Ignore any exception here. } } } }
PrismTech/opensplice
src/api/dcps/java5/common/java/code/org/opensplice/dds/sub/SelectorImpl.java
Java
gpl-3.0
10,196
package gov.nasa.gsfc.seadas.processing.l2gen.productData; import java.util.ArrayList; /** * A ... * * @author Danny Knowles * @since SeaDAS 7.0 */ public class L2genWavelengthInfo extends L2genBaseInfo { public static final int INFRARED_LOWER_LIMIT = 3000; public static final int VISIBLE_UPPER_LIMIT = 725; public static final int NULL_WAVELENGTH = -1; private int wavelength = NULL_WAVELENGTH; public static enum WaveType { VISIBLE, INFRARED, NEAR_INFRARED, NULL } public L2genWavelengthInfo(int wavelength, L2genAlgorithmInfo algorithmInfo) { super(Integer.toString(wavelength), algorithmInfo); this.wavelength = wavelength; // correct the name for the special mode if (wavelength == L2genProductTools.WAVELENGTH_FOR_IFILE_INDEPENDENT_MODE) { setName(L2genProductTools.SHORTCUT_NAMEPART_ALL); } } public L2genWavelengthInfo(int wavelength) { this(wavelength, null); } public L2genWavelengthInfo(String wavelengthStr) { super(wavelengthStr); try { this.wavelength = Integer.parseInt(wavelengthStr); } catch (Exception e) { this.wavelength = NULL_WAVELENGTH; } } public L2genAlgorithmInfo getAlgorithmInfo() { return (L2genAlgorithmInfo) getParent(); } public int getWavelength() { return wavelength; } public void setWavelength(int wavelength) { this.wavelength = wavelength; if (wavelength == L2genProductTools.WAVELENGTH_FOR_IFILE_INDEPENDENT_MODE) { setName(L2genProductTools.SHORTCUT_NAMEPART_ALL); } else { setName(Integer.toString(wavelength)); } } public String getWavelengthString() { return Integer.toString(wavelength); } @Override public String getFullName() { StringBuilder result = new StringBuilder(); L2genBaseInfo aInfo = getParent(); if (aInfo != null) { String prefix = ((L2genAlgorithmInfo) aInfo).getPrefix(); String suffix = ((L2genAlgorithmInfo) aInfo).getSuffix(); if (prefix != null && !prefix.isEmpty()) { result.append(prefix); } if (wavelength != NULL_WAVELENGTH) { result.append(getName()); } if (suffix != null && !suffix.isEmpty()) { result.append(suffix); } } return result.toString().replaceAll("[_]+", "_"); } public boolean isWaveType(WaveType waveType) { if (waveType == WaveType.INFRARED && wavelength >= INFRARED_LOWER_LIMIT) { return true; } else if (waveType == WaveType.VISIBLE && wavelength <= VISIBLE_UPPER_LIMIT) { return true; } else if (waveType == WaveType.NEAR_INFRARED && wavelength > VISIBLE_UPPER_LIMIT && wavelength < INFRARED_LOWER_LIMIT) { return true; } else { return false; } } public WaveType getWaveType() { if (wavelength >= INFRARED_LOWER_LIMIT) { return WaveType.INFRARED; } else if (wavelength <= VISIBLE_UPPER_LIMIT) { return WaveType.VISIBLE; } else if (wavelength > VISIBLE_UPPER_LIMIT && wavelength < INFRARED_LOWER_LIMIT) { return WaveType.NEAR_INFRARED; } else { return WaveType.NULL; } } }
marpet/seadas
seadas-processing/src/main/java/gov/nasa/gsfc/seadas/processing/l2gen/productData/L2genWavelengthInfo.java
Java
gpl-3.0
3,517
/* This file is part of Indico. * Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN). * * Indico is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 3 of the * License, or (at your option) any later version. * * Indico is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Indico; if not, see <http://www.gnu.org/licenses/>. */ .tip p { margin-top: 8px; margin-bottom: 8px; } div.caption { background-color: #F0F0F0 !important; border: 1px solid #888888; border-bottom: none; height: 19px; } /* Marker info */ .mapBuildingInfo { max-height: 300px; overflow-y: auto; overflow-x: hidden; } .mapRoomsInfo { width: 175px; } .mapRoomInfoLink { border-left: 1px solid #AAAAAA; padding-left: 5px; } .mapBookRoomLink { padding-right: 5px; } .mapRoomDetailsLink { padding: 0px; margin: 0px; } .mapFilterTitle { color: #777777; font-size: 15px; margin: 0; padding: 0; font-weight: bold; } .mapCustomWidgetsHolder{ width:190px; } .mapFilterGroup { padding-left: 20px; } .mapFilterTextbox { width: 70px; } .mapFilterLabel { color:#444444; font-size:13px; padding-right: 5px; padding-left: 2px; display: inline-block; min-width: 70px; } .mapRoomTooltipTitle { font-size: 13px; } .mapRoomTooltipClose { padding: 3px; } .mapRoomTooltipImage { padding-left: 8px; padding-right: 8px; } .mapRoomTooltipDescription { padding-left: 8px; padding-right: 8px; max-width: 220px; } .mapResultsInfo { font-weight: bold; font-size: 12px; } #mapFilterBox { float: none; margin-top: -27px; margin-left: 30px; width: 210px; } .mapBuildingTitle { font-weight: bold; } .mapButton { margin-right: 5px; } /* Map table */ html, body { margin: 0 auto; height: 100%; } #map_table { width: 99%; height: 90%; } #map_cell { width: 100%; height:100%; } #map_canvas { width: 100%; height:100%; } #map_table_right { vertical-align: top; } #map_table_left { width: 100%; } /* Aspects links */ ul.mapAspectsList { display: block; list-style-type: none; margin: 0; padding: 0; padding-bottom: 5px; } ul.mapAspectsList li { position: relative; padding-right: 5px; padding-left: 5px; border-right: 1px solid #AAAAAA; } ul.mapAspectsList li.browserDefault { display: inline-table; } ul.mapAspectsList a { font-family: Verdana; font-size: 13px; font-weight: bold; cursor: pointer; } ul.mapAspectsList a:hover { color: #dbb03a !important; } .mapAspectsItem { white-space: nowrap; } .mapAspectSelected { color: #B38B1F !important; } .mapAspectUnselected { color: #4C6A83 !important; } ul.mapAspectsList li.first { padding-left: 0px; } ul.mapAspectsList li.last { padding-right: 0px; border-right: none; }
eliasdesousa/indico
indico/htdocs/css/mapofrooms.css
CSS
gpl-3.0
3,309
/* SSSD LDAP Enumeration Module Authors: Simo Sorce <ssorce@redhat.com> Jakub Hrozek <jhrozek@redhat.com> Copyright (C) 2013 Red Hat This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <errno.h> #include "util/util.h" #include "db/sysdb.h" #include "providers/ldap/ldap_common.h" #include "providers/ldap/sdap_async.h" #include "providers/ldap/sdap_async_enum.h" #include "providers/ldap/sdap_idmap.h" static struct tevent_req *enum_users_send(TALLOC_CTX *memctx, struct tevent_context *ev, struct sdap_id_ctx *ctx, struct sdap_domain *sdom, struct sdap_id_op *op, bool purge); static errno_t enum_users_recv(struct tevent_req *req); static struct tevent_req *enum_groups_send(TALLOC_CTX *memctx, struct tevent_context *ev, struct sdap_id_ctx *ctx, struct sdap_domain *sdom, struct sdap_id_op *op, bool purge); static errno_t enum_groups_recv(struct tevent_req *req); /* ==Enumeration-Request-with-connections=================================== */ struct sdap_dom_enum_ex_state { struct tevent_context *ev; struct sdap_id_ctx *ctx; struct sdap_domain *sdom; struct sdap_id_conn_ctx *user_conn; struct sdap_id_conn_ctx *group_conn; struct sdap_id_conn_ctx *svc_conn; struct sdap_id_op *user_op; struct sdap_id_op *group_op; struct sdap_id_op *svc_op; bool purge; }; static errno_t sdap_dom_enum_ex_retry(struct tevent_req *req, struct sdap_id_op *op, tevent_req_fn tcb); static bool sdap_dom_enum_ex_connected(struct tevent_req *subreq); static void sdap_dom_enum_ex_get_users(struct tevent_req *subreq); static void sdap_dom_enum_ex_posix_check_done(struct tevent_req *subreq); static errno_t sdap_dom_enum_search_users(struct tevent_req *req); static void sdap_dom_enum_ex_users_done(struct tevent_req *subreq); static void sdap_dom_enum_ex_get_groups(struct tevent_req *subreq); static void sdap_dom_enum_ex_groups_done(struct tevent_req *subreq); static void sdap_dom_enum_ex_get_svcs(struct tevent_req *subreq); static void sdap_dom_enum_ex_svcs_done(struct tevent_req *subreq); struct tevent_req * sdap_dom_enum_ex_send(TALLOC_CTX *memctx, struct tevent_context *ev, struct sdap_id_ctx *ctx, struct sdap_domain *sdom, struct sdap_id_conn_ctx *user_conn, struct sdap_id_conn_ctx *group_conn, struct sdap_id_conn_ctx *svc_conn) { struct tevent_req *req; struct sdap_dom_enum_ex_state *state; int t; errno_t ret; req = tevent_req_create(ctx, &state, struct sdap_dom_enum_ex_state); if (req == NULL) return NULL; state->ev = ev; state->ctx = ctx; state->sdom = sdom; state->user_conn = user_conn; state->group_conn = group_conn; state->svc_conn = svc_conn; sdom->last_enum = tevent_timeval_current(); t = dp_opt_get_int(ctx->opts->basic, SDAP_CACHE_PURGE_TIMEOUT); if ((sdom->last_purge.tv_sec + t) < sdom->last_enum.tv_sec) { state->purge = true; } state->user_op = sdap_id_op_create(state, user_conn->conn_cache); if (state->user_op == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "sdap_id_op_create failed for users\n"); ret = EIO; goto fail; } ret = sdap_dom_enum_ex_retry(req, state->user_op, sdap_dom_enum_ex_get_users); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, "sdap_dom_enum_ex_retry failed\n"); goto fail; } return req; fail: tevent_req_error(req, ret); tevent_req_post(req, ev); return req; } static errno_t sdap_dom_enum_ex_retry(struct tevent_req *req, struct sdap_id_op *op, tevent_req_fn tcb) { struct sdap_dom_enum_ex_state *state = tevent_req_data(req, struct sdap_dom_enum_ex_state); struct tevent_req *subreq; errno_t ret; subreq = sdap_id_op_connect_send(op, state, &ret); if (subreq == NULL) { DEBUG(SSSDBG_OP_FAILURE, "sdap_id_op_connect_send failed: %d\n", ret); return ret; } tevent_req_set_callback(subreq, tcb, req); return EOK; } static bool sdap_dom_enum_ex_connected(struct tevent_req *subreq) { errno_t ret; int dp_error; struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); ret = sdap_id_op_connect_recv(subreq, &dp_error); talloc_zfree(subreq); if (ret != EOK) { if (dp_error == DP_ERR_OFFLINE) { DEBUG(SSSDBG_TRACE_FUNC, "Backend is marked offline, retry later!\n"); tevent_req_done(req); } else { DEBUG(SSSDBG_MINOR_FAILURE, "Domain enumeration failed to connect to " \ "LDAP server: (%d)[%s]\n", ret, strerror(ret)); tevent_req_error(req, ret); } return false; } return true; } static void sdap_dom_enum_ex_get_users(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct sdap_dom_enum_ex_state *state = tevent_req_data(req, struct sdap_dom_enum_ex_state); bool use_id_mapping; errno_t ret; if (sdap_dom_enum_ex_connected(subreq) == false) { return; } use_id_mapping = sdap_idmap_domain_has_algorithmic_mapping( state->ctx->opts->idmap_ctx, state->sdom->dom->name, state->sdom->dom->domain_id); /* If POSIX attributes have been requested with an AD server and we * have no idea about POSIX attributes support, run a one-time check */ if (use_id_mapping == false && state->ctx->opts->schema_type == SDAP_SCHEMA_AD && state->ctx->srv_opts && state->ctx->srv_opts->posix_checked == false) { subreq = sdap_posix_check_send(state, state->ev, state->ctx->opts, sdap_id_op_handle(state->user_op), state->sdom->user_search_bases, dp_opt_get_int(state->ctx->opts->basic, SDAP_SEARCH_TIMEOUT)); if (subreq == NULL) { tevent_req_error(req, ENOMEM); return; } tevent_req_set_callback(subreq, sdap_dom_enum_ex_posix_check_done, req); return; } ret = sdap_dom_enum_search_users(req); if (ret != EOK) { tevent_req_error(req, ret); return; } /* Execution resumes in sdap_dom_enum_ex_users_done */ } static void sdap_dom_enum_ex_posix_check_done(struct tevent_req *subreq) { errno_t ret; bool has_posix; int dp_error; struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct sdap_dom_enum_ex_state *state = tevent_req_data(req, struct sdap_dom_enum_ex_state); ret = sdap_posix_check_recv(subreq, &has_posix); talloc_zfree(subreq); if (ret != EOK && ret != ERR_NO_POSIX) { /* We can only finish the id_op on error as the connection * is re-used by the user search */ ret = sdap_id_op_done(state->user_op, ret, &dp_error); if (dp_error == DP_ERR_OK && ret != EOK) { /* retry */ ret = sdap_dom_enum_ex_retry(req, state->user_op, sdap_dom_enum_ex_get_users); if (ret != EOK) { tevent_req_error(req, ret); } return; } else if (dp_error == DP_ERR_OFFLINE) { DEBUG(SSSDBG_TRACE_FUNC, "Backend is offline, retrying later\n"); tevent_req_done(req); return; } else { /* Non-recoverable error */ DEBUG(SSSDBG_OP_FAILURE, "POSIX check failed: %d: %s\n", ret, sss_strerror(ret)); tevent_req_error(req, ret); return; } } state->ctx->srv_opts->posix_checked = true; /* If the check ran to completion, we know for certain about the attributes */ if (has_posix == false) { tevent_req_error(req, ERR_NO_POSIX); return; } ret = sdap_dom_enum_search_users(req); if (ret != EOK) { tevent_req_error(req, ret); return; } /* Execution resumes in sdap_dom_enum_ex_users_done */ } static errno_t sdap_dom_enum_search_users(struct tevent_req *req) { struct sdap_dom_enum_ex_state *state = tevent_req_data(req, struct sdap_dom_enum_ex_state); struct tevent_req *subreq; subreq = enum_users_send(state, state->ev, state->ctx, state->sdom, state->user_op, state->purge); if (subreq == NULL) { return ENOMEM; } tevent_req_set_callback(subreq, sdap_dom_enum_ex_users_done, req); return EOK; } static void sdap_dom_enum_ex_users_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct sdap_dom_enum_ex_state *state = tevent_req_data(req, struct sdap_dom_enum_ex_state); errno_t ret; int dp_error; ret = enum_users_recv(subreq); talloc_zfree(subreq); ret = sdap_id_op_done(state->user_op, ret, &dp_error); if (dp_error == DP_ERR_OK && ret != EOK) { /* retry */ ret = sdap_dom_enum_ex_retry(req, state->user_op, sdap_dom_enum_ex_get_users); if (ret != EOK) { tevent_req_error(req, ret); return; } return; } else if (dp_error == DP_ERR_OFFLINE) { DEBUG(SSSDBG_TRACE_FUNC, "Backend is offline, retrying later\n"); tevent_req_done(req); return; } else if (ret != EOK && ret != ENOENT) { /* Non-recoverable error */ DEBUG(SSSDBG_OP_FAILURE, "User enumeration failed: %d: %s\n", ret, sss_strerror(ret)); tevent_req_error(req, ret); return; } state->group_op = sdap_id_op_create(state, state->group_conn->conn_cache); if (state->group_op == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "sdap_id_op_create failed for groups\n"); tevent_req_error(req, EIO); return; } ret = sdap_dom_enum_ex_retry(req, state->group_op, sdap_dom_enum_ex_get_groups); if (ret != EOK) { tevent_req_error(req, ret); return; } /* Continues to sdap_dom_enum_ex_get_groups */ } static void sdap_dom_enum_ex_get_groups(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct sdap_dom_enum_ex_state *state = tevent_req_data(req, struct sdap_dom_enum_ex_state); if (sdap_dom_enum_ex_connected(subreq) == false) { return; } subreq = enum_groups_send(state, state->ev, state->ctx, state->sdom, state->group_op, state->purge); if (subreq == NULL) { tevent_req_error(req, ENOMEM); return; } tevent_req_set_callback(subreq, sdap_dom_enum_ex_groups_done, req); } static void sdap_dom_enum_ex_groups_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct sdap_dom_enum_ex_state *state = tevent_req_data(req, struct sdap_dom_enum_ex_state); int ret; int dp_error; ret = enum_groups_recv(subreq); talloc_zfree(subreq); ret = sdap_id_op_done(state->group_op, ret, &dp_error); if (dp_error == DP_ERR_OK && ret != EOK) { /* retry */ ret = sdap_dom_enum_ex_retry(req, state->group_op, sdap_dom_enum_ex_get_groups); if (ret != EOK) { tevent_req_error(req, ret); return; } return; } else if (dp_error == DP_ERR_OFFLINE) { DEBUG(SSSDBG_TRACE_FUNC, "Backend is offline, retrying later\n"); tevent_req_done(req); return; } else if (ret != EOK && ret != ENOENT) { /* Non-recoverable error */ DEBUG(SSSDBG_OP_FAILURE, "Group enumeration failed: %d: %s\n", ret, sss_strerror(ret)); tevent_req_error(req, ret); return; } state->svc_op = sdap_id_op_create(state, state->svc_conn->conn_cache); if (state->svc_op == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "sdap_id_op_create failed for svcs\n"); tevent_req_error(req, EIO); return; } ret = sdap_dom_enum_ex_retry(req, state->svc_op, sdap_dom_enum_ex_get_svcs); if (ret != EOK) { tevent_req_error(req, ret); return; } } static void sdap_dom_enum_ex_get_svcs(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct sdap_dom_enum_ex_state *state = tevent_req_data(req, struct sdap_dom_enum_ex_state); if (sdap_dom_enum_ex_connected(subreq) == false) { return; } subreq = enum_services_send(state, state->ev, state->ctx, state->svc_op, state->purge); if (!subreq) { tevent_req_error(req, ENOMEM); return; } tevent_req_set_callback(subreq, sdap_dom_enum_ex_svcs_done, req); } static void sdap_dom_enum_ex_svcs_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct sdap_dom_enum_ex_state *state = tevent_req_data(req, struct sdap_dom_enum_ex_state); int ret; int dp_error; ret = enum_services_recv(subreq); talloc_zfree(subreq); ret = sdap_id_op_done(state->svc_op, ret, &dp_error); if (dp_error == DP_ERR_OK && ret != EOK) { /* retry */ ret = sdap_dom_enum_ex_retry(req, state->user_op, sdap_dom_enum_ex_get_svcs); if (ret != EOK) { tevent_req_error(req, ret); return; } return; } else if (dp_error == DP_ERR_OFFLINE) { DEBUG(SSSDBG_TRACE_FUNC, "Backend is offline, retrying later\n"); tevent_req_done(req); return; } else if (ret != EOK && ret != ENOENT) { /* Non-recoverable error */ DEBUG(SSSDBG_OP_FAILURE, "Service enumeration failed: %d: %s\n", ret, sss_strerror(ret)); tevent_req_error(req, ret); return; } /* Ok, we've completed an enumeration. Save this to the * sysdb so we can postpone starting up the enumeration * process on the next SSSD service restart (to avoid * slowing down system boot-up */ ret = sysdb_set_enumerated(state->sdom->dom, true); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, "Could not mark domain as having enumerated.\n"); /* This error is non-fatal, so continue */ } if (state->purge) { ret = ldap_id_cleanup(state->ctx->opts, state->sdom); if (ret != EOK) { /* Not fatal, worst case we'll have stale entries that would be * removed on a subsequent online lookup */ DEBUG(SSSDBG_MINOR_FAILURE, "Cleanup failed: %d\n", ret); } } tevent_req_done(req); } errno_t sdap_dom_enum_ex_recv(struct tevent_req *req) { TEVENT_REQ_RETURN_ON_ERROR(req); return EOK; } /* ==Enumeration-Request==================================================== */ struct tevent_req * sdap_dom_enum_send(TALLOC_CTX *memctx, struct tevent_context *ev, struct sdap_id_ctx *ctx, struct sdap_domain *sdom, struct sdap_id_conn_ctx *conn) { return sdap_dom_enum_ex_send(memctx, ev, ctx, sdom, conn, conn, conn); } errno_t sdap_dom_enum_recv(struct tevent_req *req) { return sdap_dom_enum_ex_recv(req); } /* ==User-Enumeration===================================================== */ struct enum_users_state { struct tevent_context *ev; struct sdap_id_ctx *ctx; struct sdap_domain *sdom; struct sdap_id_op *op; char *filter; const char **attrs; }; static void enum_users_done(struct tevent_req *subreq); static struct tevent_req *enum_users_send(TALLOC_CTX *memctx, struct tevent_context *ev, struct sdap_id_ctx *ctx, struct sdap_domain *sdom, struct sdap_id_op *op, bool purge) { struct tevent_req *req, *subreq; struct enum_users_state *state; int ret; bool use_mapping; req = tevent_req_create(memctx, &state, struct enum_users_state); if (!req) return NULL; state->ev = ev; state->sdom = sdom; state->ctx = ctx; state->op = op; use_mapping = sdap_idmap_domain_has_algorithmic_mapping( ctx->opts->idmap_ctx, sdom->dom->name, sdom->dom->domain_id); /* We always want to filter on objectclass and an available name */ state->filter = talloc_asprintf(state, "(&(objectclass=%s)(%s=*)", ctx->opts->user_map[SDAP_OC_USER].name, ctx->opts->user_map[SDAP_AT_USER_NAME].name); if (!state->filter) { DEBUG(SSSDBG_MINOR_FAILURE, "Failed to build base filter\n"); ret = ENOMEM; goto fail; } if (use_mapping) { /* If we're ID-mapping, check for the objectSID as well */ state->filter = talloc_asprintf_append_buffer( state->filter, "(%s=*)", ctx->opts->user_map[SDAP_AT_USER_OBJECTSID].name); } else { /* We're not ID-mapping, so make sure to only get entries * that have UID and GID */ state->filter = talloc_asprintf_append_buffer( state->filter, "(%s=*)(%s=*)", ctx->opts->user_map[SDAP_AT_USER_UID].name, ctx->opts->user_map[SDAP_AT_USER_GID].name); } if (!state->filter) { DEBUG(SSSDBG_MINOR_FAILURE, "Failed to build base filter\n"); ret = ENOMEM; goto fail; } if (ctx->srv_opts && ctx->srv_opts->max_user_value && !purge) { /* If we have lastUSN available and we're not doing a full * refresh, limit to changes with a higher entryUSN value. */ state->filter = talloc_asprintf_append_buffer( state->filter, "(%s>=%s)(!(%s=%s))", ctx->opts->user_map[SDAP_AT_USER_USN].name, ctx->srv_opts->max_user_value, ctx->opts->user_map[SDAP_AT_USER_USN].name, ctx->srv_opts->max_user_value); if (!state->filter) { DEBUG(SSSDBG_MINOR_FAILURE, "Failed to build base filter\n"); ret = ENOMEM; goto fail; } } /* Terminate the search filter */ state->filter = talloc_asprintf_append_buffer(state->filter, ")"); if (!state->filter) { DEBUG(SSSDBG_OP_FAILURE, "Failed to build base filter\n"); ret = ENOMEM; goto fail; } /* TODO: handle attrs_type */ ret = build_attrs_from_map(state, ctx->opts->user_map, SDAP_OPTS_USER, NULL, &state->attrs, NULL); if (ret != EOK) goto fail; /* TODO: restrict the enumerations to using a single * search base at a time. */ subreq = sdap_get_users_send(state, state->ev, state->sdom->dom, state->sdom->dom->sysdb, state->ctx->opts, state->sdom->user_search_bases, sdap_id_op_handle(state->op), state->attrs, state->filter, dp_opt_get_int(state->ctx->opts->basic, SDAP_ENUM_SEARCH_TIMEOUT), true); if (!subreq) { ret = ENOMEM; goto fail; } tevent_req_set_callback(subreq, enum_users_done, req); return req; fail: tevent_req_error(req, ret); tevent_req_post(req, ev); return req; } static void enum_users_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct enum_users_state *state = tevent_req_data(req, struct enum_users_state); char *usn_value; char *endptr = NULL; unsigned usn_number; int ret; ret = sdap_get_users_recv(subreq, state, &usn_value); talloc_zfree(subreq); if (ret) { tevent_req_error(req, ret); return; } if (usn_value) { talloc_zfree(state->ctx->srv_opts->max_user_value); state->ctx->srv_opts->max_user_value = talloc_steal(state->ctx, usn_value); usn_number = strtoul(usn_value, &endptr, 10); if ((endptr == NULL || (*endptr == '\0' && endptr != usn_value)) && (usn_number > state->ctx->srv_opts->last_usn)) { state->ctx->srv_opts->last_usn = usn_number; } } DEBUG(SSSDBG_CONF_SETTINGS, "Users higher USN value: [%s]\n", state->ctx->srv_opts->max_user_value); tevent_req_done(req); } static errno_t enum_users_recv(struct tevent_req *req) { TEVENT_REQ_RETURN_ON_ERROR(req); return EOK; } /* =Group-Enumeration===================================================== */ struct enum_groups_state { struct tevent_context *ev; struct sdap_id_ctx *ctx; struct sdap_domain *sdom; struct sdap_id_op *op; char *filter; const char **attrs; }; static void enum_groups_done(struct tevent_req *subreq); static struct tevent_req *enum_groups_send(TALLOC_CTX *memctx, struct tevent_context *ev, struct sdap_id_ctx *ctx, struct sdap_domain *sdom, struct sdap_id_op *op, bool purge) { struct tevent_req *req, *subreq; struct enum_groups_state *state; int ret; bool use_mapping; req = tevent_req_create(memctx, &state, struct enum_groups_state); if (!req) return NULL; state->ev = ev; state->sdom = sdom; state->ctx = ctx; state->op = op; use_mapping = sdap_idmap_domain_has_algorithmic_mapping( ctx->opts->idmap_ctx, sdom->dom->name, sdom->dom->domain_id); /* We always want to filter on objectclass and an available name */ state->filter = talloc_asprintf(state, "(&(objectclass=%s)(%s=*)", ctx->opts->group_map[SDAP_OC_GROUP].name, ctx->opts->group_map[SDAP_AT_GROUP_NAME].name); if (!state->filter) { DEBUG(SSSDBG_MINOR_FAILURE, "Failed to build base filter\n"); ret = ENOMEM; goto fail; } if (use_mapping) { /* If we're ID-mapping, check for the objectSID as well */ state->filter = talloc_asprintf_append_buffer( state->filter, "(%s=*)", ctx->opts->group_map[SDAP_AT_GROUP_OBJECTSID].name); } else { /* We're not ID-mapping, so make sure to only get entries * that have a non-zero GID. */ state->filter = talloc_asprintf_append_buffer( state->filter, "(&(%s=*)(!(%s=0)))", ctx->opts->group_map[SDAP_AT_GROUP_GID].name, ctx->opts->group_map[SDAP_AT_GROUP_GID].name); } if (!state->filter) { DEBUG(SSSDBG_MINOR_FAILURE, "Failed to build base filter\n"); ret = ENOMEM; goto fail; } if (ctx->srv_opts && ctx->srv_opts->max_group_value && !purge) { state->filter = talloc_asprintf_append_buffer( state->filter, "(%s>=%s)(!(%s=%s))", ctx->opts->group_map[SDAP_AT_GROUP_USN].name, ctx->srv_opts->max_group_value, ctx->opts->group_map[SDAP_AT_GROUP_USN].name, ctx->srv_opts->max_group_value); if (!state->filter) { DEBUG(SSSDBG_MINOR_FAILURE, "Failed to build base filter\n"); ret = ENOMEM; goto fail; } } /* Terminate the search filter */ state->filter = talloc_asprintf_append_buffer(state->filter, ")"); if (!state->filter) { DEBUG(SSSDBG_MINOR_FAILURE, "Failed to build base filter\n"); ret = ENOMEM; goto fail; } /* TODO: handle attrs_type */ ret = build_attrs_from_map(state, ctx->opts->group_map, SDAP_OPTS_GROUP, NULL, &state->attrs, NULL); if (ret != EOK) goto fail; /* TODO: restrict the enumerations to using a single * search base at a time. */ subreq = sdap_get_groups_send(state, state->ev, state->sdom, state->ctx->opts, sdap_id_op_handle(state->op), state->attrs, state->filter, dp_opt_get_int(state->ctx->opts->basic, SDAP_ENUM_SEARCH_TIMEOUT), true); if (!subreq) { ret = ENOMEM; goto fail; } tevent_req_set_callback(subreq, enum_groups_done, req); return req; fail: tevent_req_error(req, ret); tevent_req_post(req, ev); return req; } static void enum_groups_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct enum_groups_state *state = tevent_req_data(req, struct enum_groups_state); char *usn_value; char *endptr = NULL; unsigned usn_number; int ret; ret = sdap_get_groups_recv(subreq, state, &usn_value); talloc_zfree(subreq); if (ret) { tevent_req_error(req, ret); return; } if (usn_value) { talloc_zfree(state->ctx->srv_opts->max_group_value); state->ctx->srv_opts->max_group_value = talloc_steal(state->ctx, usn_value); usn_number = strtoul(usn_value, &endptr, 10); if ((endptr == NULL || (*endptr == '\0' && endptr != usn_value)) && (usn_number > state->ctx->srv_opts->last_usn)) { state->ctx->srv_opts->last_usn = usn_number; } } DEBUG(SSSDBG_CONF_SETTINGS, "Groups higher USN value: [%s]\n", state->ctx->srv_opts->max_group_value); tevent_req_done(req); } static errno_t enum_groups_recv(struct tevent_req *req) { TEVENT_REQ_RETURN_ON_ERROR(req); return EOK; }
yelley/sssd-gpo
src/providers/ldap/sdap_async_enum.c
C
gpl-3.0
29,710
/* * Copyright (c) 2014 Washington State Department of Transportation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> * */ package gov.wa.wsdot.mobile.client.activities.trafficmap.trafficincidents; import com.google.gwt.aria.client.Roles; import com.google.gwt.core.client.GWT; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Widget; import com.googlecode.mgwt.dom.client.event.tap.TapEvent; import com.googlecode.mgwt.ui.client.MGWT; import com.googlecode.mgwt.ui.client.widget.base.HasRefresh; import com.googlecode.mgwt.ui.client.widget.button.Button; import com.googlecode.mgwt.ui.client.widget.header.HeaderTitle; import com.googlecode.mgwt.ui.client.widget.list.celllist.CellList; import com.googlecode.mgwt.ui.client.widget.list.celllist.CellSelectedEvent; import com.googlecode.mgwt.ui.client.widget.panel.flex.FixedSpacer; import com.googlecode.mgwt.ui.client.widget.panel.flex.FlexSpacer; import com.googlecode.mgwt.ui.client.widget.panel.pull.PullArrowHeader; import com.googlecode.mgwt.ui.client.widget.panel.pull.PullArrowWidget; import com.googlecode.mgwt.ui.client.widget.panel.pull.PullPanel; import com.googlecode.mgwt.ui.client.widget.panel.pull.PullPanel.Pullhandler; import com.googlecode.mgwt.ui.client.widget.progress.ProgressIndicator; import gov.wa.wsdot.mobile.client.util.Consts; import gov.wa.wsdot.mobile.client.util.ParserUtils; import gov.wa.wsdot.mobile.client.widget.SimpleListItem; import gov.wa.wsdot.mobile.shared.HighwayAlertItem; import java.util.List; public class TrafficAlertsViewGwtImpl extends Composite implements TrafficAlertsView { /** * The UiBinder interface. */ interface TrafficAlertsViewGwtImplUiBinder extends UiBinder<Widget, TrafficAlertsViewGwtImpl> { } /** * The UiBinder used to generate the view. */ private static TrafficAlertsViewGwtImplUiBinder uiBinder = GWT .create(TrafficAlertsViewGwtImplUiBinder.class); @UiField HeaderTitle heading; @UiField Button doneButton; @UiField FixedSpacer leftFixedSpacer; @UiField FlexSpacer leftFlexSpacer; @UiField HTML amberAlertsHeader; @UiField(provided = true) CellList<HighwayAlertItem> amberAlertsCellList; @UiField(provided = true) CellList<HighwayAlertItem> blockingCellList; @UiField(provided = true) CellList<HighwayAlertItem> constructionCellList; @UiField(provided = true) CellList<HighwayAlertItem> closureCellList; @UiField(provided = true) CellList<HighwayAlertItem> specialCellList; @UiField(provided = true) PullPanel pullToRefresh; @UiField FlowPanel flowPanel; @UiField ProgressIndicator progressIndicator; private Presenter presenter; private PullArrowHeader pullArrowHeader; public TrafficAlertsViewGwtImpl() { pullToRefresh = new PullPanel(); pullArrowHeader = new PullArrowHeader(); pullToRefresh.setHeader(pullArrowHeader); amberAlertsCellList = new CellList<HighwayAlertItem>(new SimpleListItem<HighwayAlertItem>() { @Override public String getDisplayDescription(HighwayAlertItem model) { return model.getHeadlineDescription(); } @Override public String getDisplayLastUpdated(HighwayAlertItem model) { if (model.getLastUpdatedTime() == null) { return ""; } else { return ParserUtils.relativeTime(model.getLastUpdatedTime(), "MMMM d, yyyy h:mm a", false); } } }); blockingCellList = new CellList<HighwayAlertItem>(new SimpleListItem<HighwayAlertItem>() { @Override public String getDisplayDescription(HighwayAlertItem model) { return model.getHeadlineDescription(); } @Override public String getDisplayLastUpdated(HighwayAlertItem model) { if (model.getLastUpdatedTime() == null) { return ""; } else { return ParserUtils.relativeTime(model.getLastUpdatedTime(), "MMMM d, yyyy h:mm a", false); } } }); constructionCellList = new CellList<HighwayAlertItem>(new SimpleListItem<HighwayAlertItem>() { @Override public String getDisplayDescription(HighwayAlertItem model) { return model.getHeadlineDescription(); } @Override public String getDisplayLastUpdated(HighwayAlertItem model) { if (model.getLastUpdatedTime() == null) { return ""; } else { return ParserUtils.relativeTime(model.getLastUpdatedTime(), "MMMM d, yyyy h:mm a", false); } } }); closureCellList = new CellList<HighwayAlertItem>(new SimpleListItem<HighwayAlertItem>() { @Override public String getDisplayDescription(HighwayAlertItem model) { return model.getHeadlineDescription(); } @Override public String getDisplayLastUpdated(HighwayAlertItem model) { if (model.getLastUpdatedTime() == null) { return ""; } else { return ParserUtils.relativeTime(model.getLastUpdatedTime(), "MMMM d, yyyy h:mm a", false); } } }); specialCellList = new CellList<HighwayAlertItem>(new SimpleListItem<HighwayAlertItem>() { @Override public String getDisplayDescription(HighwayAlertItem model) { return model.getHeadlineDescription(); } @Override public String getDisplayLastUpdated(HighwayAlertItem model) { if (model.getLastUpdatedTime() == null) { return ""; } else { return ParserUtils.relativeTime(model.getLastUpdatedTime(), "MMMM d, yyyy h:mm a", false); } } }); initWidget(uiBinder.createAndBindUi(this)); accessibilityPrepare(); if (MGWT.getOsDetection().isAndroid()) { leftFixedSpacer.setWidth("12px"); leftFlexSpacer.setVisible(false); } } @UiHandler("blockingCellList") protected void onBlockingPressed(CellSelectedEvent event) { if (presenter != null) { int index = event.getIndex(); presenter.onItemSelected(Consts.BLOCKING, index); } } @UiHandler("constructionCellList") protected void onconstructionPressed(CellSelectedEvent event) { if (presenter != null) { int index = event.getIndex(); presenter.onItemSelected(Consts.CONSTRUCTION, index); } } @UiHandler("closureCellList") protected void onClosurePressed(CellSelectedEvent event) { if (presenter != null) { int index = event.getIndex(); presenter.onItemSelected(Consts.CLOSURES, index); } } @UiHandler("specialCellList") protected void onSpecialPressed(CellSelectedEvent event) { if (presenter != null) { int index = event.getIndex(); presenter.onItemSelected(Consts.SPECIAL, index); } } @UiHandler("doneButton") protected void onDoneButtonPressed(TapEvent event) { if (presenter != null) { presenter.onDoneButtonPressed(); } } @Override public void setPresenter(Presenter presenter) { this.presenter = presenter; } @Override public void renderAmberAlerts(List<HighwayAlertItem> amberAlertsList) { amberAlertsCellList.render(amberAlertsList); } @Override public void renderBlocking(List<HighwayAlertItem> blockingList) { blockingCellList.render(blockingList); } @Override public void renderConstruction(List<HighwayAlertItem> constructionList) { constructionCellList.render(constructionList); } @Override public void renderClosure(List<HighwayAlertItem> closureList) { closureCellList.render(closureList); } @Override public void renderSpecial(List<HighwayAlertItem> specialList) { specialCellList.render(specialList); } @Override public void showProgressIndicator() { progressIndicator.setVisible(true); } @Override public void hideProgressIndicator() { progressIndicator.setVisible(false); } @Override public void refresh() { pullToRefresh.refresh(); } @Override public void setHeaderPullHandler(Pullhandler pullHandler) { pullToRefresh.setHeaderPullHandler(pullHandler); } @Override public PullArrowWidget getPullHeader() { return pullArrowHeader; } @Override public HasRefresh getPullPanel() { return pullToRefresh; } @Override public void showAmberAlerts() { amberAlertsHeader.setVisible(true); amberAlertsCellList.setVisible(true); } @Override public void hideAmberAlerts() { amberAlertsHeader.setVisible(false); amberAlertsCellList.setVisible(false); } private void accessibilityPrepare(){ // Add ARIA roles for accessibility Roles.getHeadingRole().set(heading.getElement()); Roles.getProgressbarRole().set(progressIndicator.getElement()); Roles.getProgressbarRole().setAriaLabelProperty(progressIndicator.getElement(), "loading indicator"); // TODO Hide pull down until we can figure out how to get VoiceOver to work with it Roles.getButtonRole().setAriaHiddenState(pullArrowHeader.getElement(), true); } }
WSDOT/wsdot-mobile-app
src/main/java/gov/wa/wsdot/mobile/client/activities/trafficmap/trafficincidents/TrafficAlertsViewGwtImpl.java
Java
gpl-3.0
9,803
/* Substitute for and wrapper around <langinfo.h>. Copyright (C) 2009-2021 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* * POSIX <langinfo.h> for platforms that lack it or have an incomplete one. * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html> */ #ifndef _@GUARD_PREFIX@_LANGINFO_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_LANGINFO_H@ # @INCLUDE_NEXT@ @NEXT_LANGINFO_H@ #endif #ifndef _@GUARD_PREFIX@_LANGINFO_H #define _@GUARD_PREFIX@_LANGINFO_H #if !@HAVE_LANGINFO_H@ /* A platform that lacks <langinfo.h>. */ /* Assume that it also lacks <nl_types.h> and the nl_item type. */ # if !GNULIB_defined_nl_item typedef int nl_item; # define GNULIB_defined_nl_item 1 # endif /* nl_langinfo items of the LC_CTYPE category */ # define CODESET 10000 /* nl_langinfo items of the LC_NUMERIC category */ # define RADIXCHAR 10001 # define DECIMAL_POINT RADIXCHAR # define THOUSEP 10002 # define THOUSANDS_SEP THOUSEP # define GROUPING 10114 /* nl_langinfo items of the LC_TIME category */ # define D_T_FMT 10003 # define D_FMT 10004 # define T_FMT 10005 # define T_FMT_AMPM 10006 # define AM_STR 10007 # define PM_STR 10008 # define DAY_1 10009 # define DAY_2 (DAY_1 + 1) # define DAY_3 (DAY_1 + 2) # define DAY_4 (DAY_1 + 3) # define DAY_5 (DAY_1 + 4) # define DAY_6 (DAY_1 + 5) # define DAY_7 (DAY_1 + 6) # define ABDAY_1 10016 # define ABDAY_2 (ABDAY_1 + 1) # define ABDAY_3 (ABDAY_1 + 2) # define ABDAY_4 (ABDAY_1 + 3) # define ABDAY_5 (ABDAY_1 + 4) # define ABDAY_6 (ABDAY_1 + 5) # define ABDAY_7 (ABDAY_1 + 6) # define MON_1 10023 # define MON_2 (MON_1 + 1) # define MON_3 (MON_1 + 2) # define MON_4 (MON_1 + 3) # define MON_5 (MON_1 + 4) # define MON_6 (MON_1 + 5) # define MON_7 (MON_1 + 6) # define MON_8 (MON_1 + 7) # define MON_9 (MON_1 + 8) # define MON_10 (MON_1 + 9) # define MON_11 (MON_1 + 10) # define MON_12 (MON_1 + 11) # define ALTMON_1 10200 # define ALTMON_2 (ALTMON_1 + 1) # define ALTMON_3 (ALTMON_1 + 2) # define ALTMON_4 (ALTMON_1 + 3) # define ALTMON_5 (ALTMON_1 + 4) # define ALTMON_6 (ALTMON_1 + 5) # define ALTMON_7 (ALTMON_1 + 6) # define ALTMON_8 (ALTMON_1 + 7) # define ALTMON_9 (ALTMON_1 + 8) # define ALTMON_10 (ALTMON_1 + 9) # define ALTMON_11 (ALTMON_1 + 10) # define ALTMON_12 (ALTMON_1 + 11) # define ABMON_1 10035 # define ABMON_2 (ABMON_1 + 1) # define ABMON_3 (ABMON_1 + 2) # define ABMON_4 (ABMON_1 + 3) # define ABMON_5 (ABMON_1 + 4) # define ABMON_6 (ABMON_1 + 5) # define ABMON_7 (ABMON_1 + 6) # define ABMON_8 (ABMON_1 + 7) # define ABMON_9 (ABMON_1 + 8) # define ABMON_10 (ABMON_1 + 9) # define ABMON_11 (ABMON_1 + 10) # define ABMON_12 (ABMON_1 + 11) # define ERA 10047 # define ERA_D_FMT 10048 # define ERA_D_T_FMT 10049 # define ERA_T_FMT 10050 # define ALT_DIGITS 10051 /* nl_langinfo items of the LC_MONETARY category */ # define CRNCYSTR 10052 # define CURRENCY_SYMBOL CRNCYSTR # define INT_CURR_SYMBOL 10100 # define MON_DECIMAL_POINT 10101 # define MON_THOUSANDS_SEP 10102 # define MON_GROUPING 10103 # define POSITIVE_SIGN 10104 # define NEGATIVE_SIGN 10105 # define FRAC_DIGITS 10106 # define INT_FRAC_DIGITS 10107 # define P_CS_PRECEDES 10108 # define N_CS_PRECEDES 10109 # define P_SEP_BY_SPACE 10110 # define N_SEP_BY_SPACE 10111 # define P_SIGN_POSN 10112 # define N_SIGN_POSN 10113 /* nl_langinfo items of the LC_MESSAGES category */ # define YESEXPR 10053 # define NOEXPR 10054 #else /* A platform that has <langinfo.h>. */ # if !@HAVE_LANGINFO_CODESET@ # define CODESET 10000 # define GNULIB_defined_CODESET 1 # endif # if !@HAVE_LANGINFO_T_FMT_AMPM@ # define T_FMT_AMPM 10006 # define GNULIB_defined_T_FMT_AMPM 1 # endif # if !@HAVE_LANGINFO_ALTMON@ # define ALTMON_1 10200 # define ALTMON_2 (ALTMON_1 + 1) # define ALTMON_3 (ALTMON_1 + 2) # define ALTMON_4 (ALTMON_1 + 3) # define ALTMON_5 (ALTMON_1 + 4) # define ALTMON_6 (ALTMON_1 + 5) # define ALTMON_7 (ALTMON_1 + 6) # define ALTMON_8 (ALTMON_1 + 7) # define ALTMON_9 (ALTMON_1 + 8) # define ALTMON_10 (ALTMON_1 + 9) # define ALTMON_11 (ALTMON_1 + 10) # define ALTMON_12 (ALTMON_1 + 11) # define GNULIB_defined_ALTMON 1 # endif # if !@HAVE_LANGINFO_ERA@ # define ERA 10047 # define ERA_D_FMT 10048 # define ERA_D_T_FMT 10049 # define ERA_T_FMT 10050 # define ALT_DIGITS 10051 # define GNULIB_defined_ERA 1 # endif # if !@HAVE_LANGINFO_YESEXPR@ # define YESEXPR 10053 # define NOEXPR 10054 # define GNULIB_defined_YESEXPR 1 # endif #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Declare overridden functions. */ /* Return a piece of locale dependent information. Note: The difference between nl_langinfo (CODESET) and locale_charset () is that the latter normalizes the encoding names to GNU conventions. */ #if @GNULIB_NL_LANGINFO@ # if @REPLACE_NL_LANGINFO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef nl_langinfo # define nl_langinfo rpl_nl_langinfo # endif _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item)); _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item)); # else # if !@HAVE_NL_LANGINFO@ _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item)); # endif _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item)); # endif _GL_CXXALIASWARN (nl_langinfo); #elif defined GNULIB_POSIXCHECK # undef nl_langinfo # if HAVE_RAW_DECL_NL_LANGINFO _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - " "use gnulib module nl_langinfo for portability"); # endif #endif #endif /* _@GUARD_PREFIX@_LANGINFO_H */ #endif /* _@GUARD_PREFIX@_LANGINFO_H */
komh/tar-os2
gnu/langinfo.in.h
C
gpl-3.0
6,707
/*********************************************************************** * * Filename: sg_editor.cpp * * Description: Editor widget for scenegraph. * * Copyright (C) 2015 Richard Layman, rlayman2000@yahoo.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ***********************************************************************/ #include "sg_editor.hpp" #include "commands.hpp" #include "selection.hpp" #include "field.hpp" #include "state.hpp" #include "plugin.hpp" #include "qml_status.hpp" #define BACKGROUND_COLOR "#444444" #define NODE_TEXT_COLOR "#000000" #define SELECTED_NODE_COLOR "#FF007F" #define DESELECTED_NODE_COLOR "#666666" #define NODE_TITLE_BLOCK_COLOR "#888888" #define HOVER_NODE_COLOR "#FF8C00" #define SELECTED_CONNECTOR_COLOR "#FFFF00" // TODO #define DESELECTED_IN_CONNECTOR_COLOR "#50C878" #define HOVER_CONNECTOR_COLOR "#FFBF00" #define DESELECTED_OUT_CONNECTOR_COLOR "#9400D3" #define SELECTED_CONNECTION_COLOR "#FFEF00" #define DESELECTED_CONNECTION_COLOR "#99BADD" #define HOVER_CONNECTION_COLOR "" // TODO int MouseInfo::clickX=0; int MouseInfo::clickY=0; SGState::Mode SGState::mode=SGState::Normal; int SGState::srcUid=0; int SGState::srcNid=0; int SGState::srcFid=0; int SGState::tgtUid=0; int SGState::tgtNid=0; int SGState::tgtFid=0; SceneGraphEditor* SGState::pSge=NULL; std::vector<SceneGraphConnection*> SGState::selectedConnections = std::vector<SceneGraphConnection*>(); // SCENEGRAPH SceneGraphConnection::SceneGraphConnection(SceneGraphNode* node, SceneGraphConnection::Connection type, QQuickItem* parent) : QQuickPaintedItem(parent), m_selected(false), m_type(type), m_node(node) { setWidth(CONNECTION_WIDTH); setHeight(CONNECTION_HEIGHT); setAcceptedMouseButtons(Qt::AllButtons); setAcceptHoverEvents(true); if(m_type == In) m_connFillBrush = QBrush(QColor(DESELECTED_IN_CONNECTOR_COLOR)); else m_connFillBrush = QBrush(QColor(DESELECTED_OUT_CONNECTOR_COLOR)); } SceneGraphConnection::~SceneGraphConnection() { } void SceneGraphConnection::paint(QPainter* painter) { painter->setRenderHints(QPainter::Antialiasing, true); if(!m_selected){ if(m_type == In) m_connFillBrush = QBrush(QColor(DESELECTED_IN_CONNECTOR_COLOR)); else m_connFillBrush = QBrush(QColor(DESELECTED_OUT_CONNECTOR_COLOR)); } else { m_connFillBrush = QBrush(QColor(SELECTED_CONNECTOR_COLOR)); } painter->setBrush(m_connFillBrush); painter->drawRect(0,0,CONNECTION_WIDTH,CONNECTION_HEIGHT); } void SceneGraphConnection::mousePressEvent(QMouseEvent* event) { std::cout << "connector mouse press event\n"; MouseInfo::clickX = event->windowPos().x(); MouseInfo::clickY = event->windowPos().y(); // add to selected connections /* if(!m_selected) { m_selected=true; SGState::selectedConnections.push_back(this); } else { m_selected=false; SGState::remove(this); } */ connClicked(event->button(),m_type,event->screenPos().x(),event->screenPos().y()); update(); } void SceneGraphConnection::mouseReleaseEvent(QMouseEvent* event) { SGState::mode = SGState::Normal; //update(); } void SceneGraphConnection::hoverEnterEvent(QHoverEvent* event) { m_connFillBrush.setColor(QColor(HOVER_CONNECTOR_COLOR)); //update(); } void SceneGraphConnection::hoverLeaveEvent(QHoverEvent* event) { if(m_type == In) m_connFillBrush = QBrush(QColor(DESELECTED_IN_CONNECTOR_COLOR)); else m_connFillBrush = QBrush(QColor(DESELECTED_OUT_CONNECTOR_COLOR)); //update(); } void SceneGraphConnection::mouseMoveEvent(QMouseEvent* event) { std::cout << "connection mouse move event\n"; MouseInfo::clickX = event->windowPos().x(); MouseInfo::clickY = event->windowPos().y(); //parentItem()->update(); //SGState::pSge->update(); } // Node SceneGraphNode::SceneGraphNode(int uid, int nid, QQuickItem* parent) : QQuickPaintedItem(parent), m_uid(uid), m_nid(nid), m_x(0), m_y(0), m_imgDir("ui/icons/"), m_nodeFillBrush(QBrush(QColor(DESELECTED_NODE_COLOR))), m_layerFillBrush(QBrush(QColor("#DDDDDD"))), m_nodeTitleBrush(QBrush(QColor(NODE_TITLE_BLOCK_COLOR))), m_pInConn(new SceneGraphConnection(this,SceneGraphConnection::In,this)), m_pOutConn(new SceneGraphConnection(this,SceneGraphConnection::Out,this)) { feather::status e; connect(m_pInConn,SIGNAL(connClicked(Qt::MouseButton,SceneGraphConnection::Connection,int,int)),this,SLOT(ConnPressed(Qt::MouseButton,SceneGraphConnection::Connection,int,int))); connect(m_pOutConn,SIGNAL(connClicked(Qt::MouseButton,SceneGraphConnection::Connection,int,int)),this,SLOT(ConnPressed(Qt::MouseButton,SceneGraphConnection::Connection,int,int))); if(feather::smg::Instance()->selected(m_uid)) m_nodeFillBrush.setColor(QColor(SELECTED_NODE_COLOR)); else m_nodeFillBrush.setColor(QColor(DESELECTED_NODE_COLOR)); setAcceptedMouseButtons(Qt::AllButtons); setAcceptHoverEvents(true); m_inConnCount = feather::qml::command::get_in_field_count(m_uid); m_outConnCount = feather::qml::command::get_out_field_count(m_uid); m_connCount = feather::qml::command::get_field_count(m_uid); // set the location of the in and out connections m_pInConn->setX(0); m_pInConn->setY((NODE_HEIGHT/2)-(CONNECTION_HEIGHT/2)); m_pOutConn->setX(NODE_WIDTH-CONNECTION_HEIGHT); m_pOutConn->setY((NODE_HEIGHT/2)-(CONNECTION_HEIGHT/2)); feather::qml::command::get_node_icon(m_nid,m_imgFile,e); m_imgPath << m_imgDir << m_imgFile; setWidth(NODE_WIDTH); setHeight(NODE_HEIGHT); } SceneGraphNode::~SceneGraphNode() { delete m_pInConn; delete m_pOutConn; } void SceneGraphNode::ConnPressed(Qt::MouseButton button, SceneGraphConnection::Connection conn, int x, int y) { std::cout << "node got connector event\n"; ConnClicked(button,conn,x,y,m_uid,m_nid); } void SceneGraphNode::paint(QPainter* painter) { feather::status e; painter->setRenderHints(QPainter::Antialiasing, true); QPen trimPen = QPen(QColor(0,0,0),1); QPen textPen = QPen(QColor(NODE_TEXT_COLOR),2); QFont textFont("DejaVuSans",9); painter->setPen(textPen); painter->setFont(textFont); if(feather::smg::Instance()->selected(m_uid)) m_nodeFillBrush.setColor(QColor(SELECTED_NODE_COLOR)); else m_nodeFillBrush.setColor(QColor(DESELECTED_NODE_COLOR)); textFont.setBold((feather::smg::Instance()->selected(m_uid)) ? true : false); QBrush connInFillBrush = QBrush(QColor("#FF4500")); QBrush connOutFillBrush = QBrush(QColor("#DA70D6")); // node trim painter->setPen(trimPen); // draw layer bar painter->setBrush(m_layerFillBrush); // draw the node block painter->setBrush(m_nodeFillBrush); painter->drawRect(0,0,NODE_WIDTH,NODE_HEIGHT); // node icon QRectF tgt(NODE_WIDTH - (NODE_HEIGHT+CONNECTION_WIDTH),2,NODE_HEIGHT-4,NODE_HEIGHT-4); QImage img(m_imgPath.str().c_str()); painter->drawImage(tgt,img); // node label painter->setPen(textPen); painter->setFont(textFont); std::string name; feather::qml::command::get_node_name(m_uid,name,e); painter->drawText(QRect(CONNECTION_WIDTH,0,NODE_WIDTH-(NODE_HEIGHT+CONNECTION_WIDTH),NODE_HEIGHT),Qt::AlignHCenter|Qt::AlignVCenter,name.c_str()); } void SceneGraphNode::mousePressEvent(QMouseEvent* event) { m_x = event->screenPos().x(); m_y = event->screenPos().y(); } void SceneGraphNode::mouseDoubleClickEvent(QMouseEvent* event) { emit nodePressed(event->button(),m_uid,m_nid); } void SceneGraphNode::mouseReleaseEvent(QMouseEvent* event) { // this is triggered but not currently used } void SceneGraphNode::hoverEnterEvent(QHoverEvent* event) { m_nodeFillBrush.setColor(QColor(HOVER_NODE_COLOR)); update(); } void SceneGraphNode::hoverLeaveEvent(QHoverEvent* event) { if(feather::smg::Instance()->selected(m_uid)){ m_nodeFillBrush.setColor(QColor(SELECTED_NODE_COLOR)); } else { m_nodeFillBrush.setColor(QColor(DESELECTED_NODE_COLOR)); } update(); } void SceneGraphNode::mouseMoveEvent(QMouseEvent* event) { setX(x() + (event->screenPos().x() - m_x)); setY(y() + (event->screenPos().y() - m_y)); m_x = event->screenPos().x(); m_y = event->screenPos().y(); parentItem()->update(); } void SceneGraphNode::inConnectionPoint(QPointF& point) { point = mapToItem(parentItem(),QPoint(0,(NODE_HEIGHT/2))); } void SceneGraphNode::outConnectionPoint(QPointF& point) { point = mapToItem(parentItem(),QPoint(NODE_WIDTH,(NODE_HEIGHT/2))); } void SceneGraphNode::getConnectionPoint(feather::field::connection::Type conn, QPoint& npoint, QPoint& cpoint) { if(conn == feather::field::connection::In) { cpoint.setX(npoint.x()); cpoint.setY((npoint.y())+((NODE_HEIGHT)/2)); } else { cpoint.setX((npoint.x())+(NODE_WIDTH)); cpoint.setY((npoint.y())+((NODE_HEIGHT)/2)); } } SceneGraphConnection* SceneGraphNode::inConnection() { return m_pInConn; } SceneGraphConnection* SceneGraphNode::outConnection() { return m_pOutConn; } // Link SceneGraphLink::SceneGraphLink(SceneGraphConnection* sconn, SceneGraphConnection* tconn, QQuickItem* parent) : QQuickPaintedItem(parent), m_sconnection(sconn), m_tconnection(tconn) { } SceneGraphLink::~SceneGraphLink() { } void SceneGraphLink::paint(QPainter* painter) { QPainterPath path; QBrush brush = painter->brush(); brush.setStyle(Qt::NoBrush); QPointF sp; QPointF tp; m_sconnection->node()->outConnectionPoint(sp); m_tconnection->node()->inConnectionPoint(tp); QPen pathPen; if(SGState::mode==SGState::Normal) pathPen = QPen(QColor(DESELECTED_CONNECTION_COLOR),1); else pathPen = QPen(QColor(SELECTED_CONNECTION_COLOR),2); path.moveTo(sp.x(),sp.y()); int midSX = sp.x() + (abs(tp.x()-sp.x())/2); int midTX = tp.x() - (abs(tp.x()-sp.x())/2); if(SGState::mode==SGState::Normal) path.cubicTo(midSX,sp.y(), midTX,tp.y(), tp.x(),tp.y()); else path.cubicTo(MouseInfo::clickX,sp.y(), midTX,MouseInfo::clickY-35, MouseInfo::clickX-2,MouseInfo::clickY-35); painter->setPen(pathPen); painter->drawPath(path); } // Editor SceneGraphEditor::SceneGraphEditor(QQuickItem* parent) : QQuickPaintedItem(parent), m_scale(100), m_nodeWidth(80), m_nodeHeight(30), m_nodeGapWidth(NODE_WIDTH+40), m_nodeGapHeight(10) { SGState::pSge = this; setAcceptedMouseButtons(Qt::AllButtons); // for testing purposes I'm selecting the node from here. // later this will be done from the viewport or outliner feather::qml::command::select_node(0); updateGraph(); } SceneGraphEditor::~SceneGraphEditor() { clearGraph(); } void SceneGraphEditor::ConnOption(Qt::MouseButton button, SceneGraphConnection::Connection conn, int x, int y, int uid, int nid) { std::cout << "sg editor got node connector event\n"; connectorClicked(button,conn,x,y,uid,nid); } void SceneGraphEditor::nodePressed(Qt::MouseButton button, int uid, int nid) { // for now we'll have it so only one node can be selected at a time feather::qml::command::clear_selection(); feather::qml::command::select_node(uid); emit nodeSelection(0,uid,nid); updateNodes(); } void SceneGraphEditor::connectionMousePressed(int button, unsigned int uid, unsigned int nid, unsigned int fid) { std::cout << "connection mouse pressed, button " << button << " uid " << uid << " nid " << nid << " fid " << fid << std::endl; } void SceneGraphEditor::connectionMouseReleased(int button, unsigned int uid, unsigned int nid, unsigned int fid) { std::cout << "connection mouse released, button " << button << " uid " << uid << " nid " << nid << " fid " << fid << std::endl; } void SceneGraphEditor::connectionMouseClicked(int button, unsigned int uid, unsigned int nid, unsigned int fid) { std::cout << "connection mouse clicked, button " << button << " uid " << uid << " nid " << nid << " fid " << fid << std::endl; if(SGState::mode==SGState::Normal) SGState::mode=SGState::FieldConnection; else SGState::mode=SGState::Normal; } void SceneGraphEditor::clearGraph() { std::for_each(m_links.begin(), m_links.end(), [](SceneGraphLink* link){ delete link; }); m_links.clear(); std::for_each(m_nodes.begin(), m_nodes.end(), [](SceneGraphNode* node){ delete node; }); m_nodes.clear(); } void SceneGraphEditor::updateNodes() { for(auto n : m_nodes) n->update(); } bool SceneGraphEditor::connectNodes() { if(SGState::selectedConnections.size() > 1){ // for now we'll just connect the inputs to the first in connection we see SceneGraphConnection* in = nullptr; // find the first in connection for(auto c : SGState::selectedConnections) { if(c->type() == SceneGraphConnection::In) { in = c; break; } } if(in != nullptr) { for(auto c : SGState::selectedConnections) { if(c->type() == SceneGraphConnection::Out) { m_links.push_back(new SceneGraphLink(in,c,this)); } } } } // unselect all the currently selected connections for(auto c : SGState::selectedConnections) c->setSelected(false); SGState::selectedConnections.erase(SGState::selectedConnections.begin(),SGState::selectedConnections.end()); feather::qml::command::scenegraph_update(); update(); return true; } bool SceneGraphEditor::disconnectNodes() { return false; } // TODO - both of these functions will need to be modified later so that multiple // source and target fields can be selected so that the user doesn't need to keep // going back and redoing the process multiple times. void SceneGraphEditor::setConnectionSource(unsigned int uid, unsigned int fid) { SGState::srcUid = uid; SGState::srcFid = fid; status p; // if there is a target already selected, connect if(SGState::tgtUid){ std::cout << "CONNECTING Source->Target" << " suid:" << SGState::srcUid << " sfid:" << SGState::srcFid << " tuid:" << SGState::tgtUid << " tfid:" << SGState::tgtFid << std::endl; p = feather::plugin::connect( SGState::srcUid, SGState::srcFid, SGState::tgtUid, SGState::tgtFid ); // clear out selections SGState::srcUid = 0; SGState::srcFid = 0; SGState::tgtUid = 0; SGState::tgtFid = 0; Status out; } statusChanged(p.state,QString(p.msg.c_str())); }; void SceneGraphEditor::setConnectionTarget(unsigned int uid, unsigned int fid) { SGState::tgtUid = uid; SGState::tgtFid = fid; status p; // if there is a target already selected, connect if(SGState::srcUid){ std::cout << "CONNECTING Target->Source" << " suid:" << SGState::srcUid << " sfid:" << SGState::srcFid << " tuid:" << SGState::tgtUid << " tfid:" << SGState::tgtFid << std::endl; p = feather::plugin::connect( SGState::srcUid, SGState::srcFid, SGState::tgtUid, SGState::tgtFid ); // clear out selections SGState::srcUid = 0; SGState::srcFid = 0; SGState::tgtUid = 0; SGState::tgtFid = 0; } std::cout << "STATUS MESSAGE:" << p.msg << std::endl; statusChanged(p.state,QString(p.msg.c_str())); }; void SceneGraphEditor::paint(QPainter* painter) { setFillColor(QColor(BACKGROUND_COLOR)); painter->setRenderHints(QPainter::Antialiasing, true); std::for_each(m_links.begin(),m_links.end(),[painter](SceneGraphLink* l){ l->paint(painter); }); } void SceneGraphEditor::updateGraph() { int xpos = 50; int ypos = 50; clearGraph(); std::vector<int> uids; // disabled selection as root for testing //feather::qml::command::get_selected_nodes(uids); uids.push_back(0); std::cout << uids.size() << " nodes are selected\n"; std::for_each(uids.begin(),uids.end(),[](int& n){ std::cout << n << ","; }); updateNode(nullptr,0,xpos,ypos); for(auto n : m_nodes) updateLinks(n->uid()); } void SceneGraphEditor::updateNode(SceneGraphNode* pnode, int uid, int xpos, int ypos) { feather::status e; unsigned int nid = feather::qml::command::get_node_id(uid,e); // if the node is already in the draw list, don't add a new one SceneGraphNode *node = getNode(uid); if(!node){ std::cout << "ADDING NODE TO SG EDITOR\n"; node = new SceneGraphNode(uid,nid,this); m_nodes.push_back(node); // setup the node qt connections connect(node,SIGNAL(ConnClicked(Qt::MouseButton,SceneGraphConnection::Connection,int,int,int,int)),this,SLOT(ConnOption(Qt::MouseButton,SceneGraphConnection::Connection,int,int,int,int))); connect(node,SIGNAL(nodePressed(Qt::MouseButton,int,int)),this,SLOT(nodePressed(Qt::MouseButton,int,int))); // place the node in the scenegraph node->setX(xpos); node->setY(ypos); // get the connected nodes std::vector<unsigned int> cuids; feather::qml::command::get_node_connected_uids(uid,cuids); // add a link for each connection between the two nodes int ystep=0; for(auto c : cuids) { // add the child node to draw list and get it's links updateNode(node, c, xpos+m_nodeGapWidth, ypos+ystep); ystep+=node->height()+m_nodeGapHeight; } } } void SceneGraphEditor::updateLinks(int uid) { // draw all links between the uid and it's children nodes // get the node SceneGraphNode* pnode = nullptr; for(auto n : m_nodes){ if(n->uid() == uid) pnode=n; } // no point in going any further if no node was found if(!pnode) return; // get all the node's output connections std::vector<unsigned int> uids; feather::qml::command::get_node_connected_uids(uid,uids); // if there is no connected nodes, no need to go any further if(!uids.size()) return; // some of the connected uids are not shown in sg editor, so remove them from the list std::vector<int> shownuids; for(auto tuid : uids){ for(auto n : m_nodes){ if(n->uid()==tuid) shownuids.push_back(tuid); } } // if none of the uids are displayed, no need to go any further if(!shownuids.size()) return; // draw links between the nodes that connected to it for(auto tuid : shownuids){ // is the field connected bool connected = feather::plugin::get_node_connection_status(uid,tuid); if(connected){ // add the link m_links.push_back(new SceneGraphLink(pnode->outConnection(),getNode(tuid)->inConnection(),this)); } } } void SceneGraphEditor::mousePressEvent(QMouseEvent* event){ std::cout << "mouse press\n"; }; void SceneGraphEditor::mouseReleaseEvent(QMouseEvent* event){ std::cout << "mouse release\n"; }; void SceneGraphEditor::hoverEnterEvent(QHoverEvent* event){ std::cout << "hover enter\n"; }; void SceneGraphEditor::hoverLeaveEvent(QHoverEvent* event){ std::cout << "hover leave\n"; }; void SceneGraphEditor::hoverMoveEvent(QHoverEvent* event){ std::cout << "hover move\n"; }; void SceneGraphEditor::mouseMoveEvent(QMouseEvent* event){ std::cout << "mouse move\n"; };
richardlayman/feather
src/lib/qml/sg_editor.cpp
C++
gpl-3.0
20,554
/* This file is part of the CVD Library. Copyright (C) 2005 The Authors This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ //-*- c++ -*- ////////////////////////////////////////////////////////////////////////// // // // CVD::image.h // // // // Definitions for of template class CVD::Image, fast_image // // // // derived from IPRS_* developed by Tom Drummond // // Reworked to provide class heirachy and memory managementby E. Rosten// // // ////////////////////////////////////////////////////////////////////////// #ifndef CVD_IMAGE_H #define CVD_IMAGE_H #include <string.h> #include <cvd/image_ref.h> #include <cvd/exceptions.h> #include <string> #include <utility> #include <iterator> #include <cvd/internal/aligned_mem.h> namespace CVD { namespace Exceptions { /// @ingroup gException namespace Image { /// Base class for all Image_IO exceptions /// @ingroup gException struct All: public CVD::Exceptions::All {}; /// Input images have incompatible dimensions /// @ingroup gException struct IncompatibleImageSizes : public All { IncompatibleImageSizes(const std::string & function) { what = "Incompatible image sizes in " + function; }; }; /// Input ImageRef not within image dimensions /// @ingroup gException struct ImageRefNotInImage : public All { ImageRefNotInImage(const std::string & function) { what = "Input ImageRefs not in image in " + function; }; }; } } #ifndef DOXYGEN_IGNORE_INTERNAL namespace Internal { template<class C> class ImagePromise {}; }; #endif #ifdef CVD_IMAGE_DEBUG #define CVD_IMAGE_ASSERT(X,Y) if(!(X)) throw Y() #define CVD_IMAGE_ASSERT2(X,Y,Z) if(!(X)) throw Y(Z) #else #define CVD_IMAGE_ASSERT(X,Y) #define CVD_IMAGE_ASSERT2(X,Y,Z) #endif /// Fatal image errors (used for debugging). These are not included in the /// main CVD::Exceptions namespace since they are fatal errors which are /// only thrown if the library is compiled with <code>-D CVD_IMAGE_DEBUG</code>. /// This compiles in image bounds checking (see CVD::BasicImage::operator[]()) /// and makes image accesses very slow! /// @ingroup gException namespace ImageError { /// An attempt was made to access a pixel outside the image. Note that this is /// not derived from CVD::Exceptions::All. /// @ingroup gException class AccessOutsideImage{}; } namespace ImageUtil { template<class T> inline void memfill(T* data, int n, const T val) { T* de = data + n; for(;data < de; data++) *data=val; } template<> inline void memfill(unsigned char* data, int n, const unsigned char val) { memset(data, val, n); } template<> inline void memfill(signed char* data, int n, const signed char val) { memset(data, val, n); } template<> inline void memfill(char* data, int n, const char val) { memset(data, val, n); } } template<class T> class SubImage; template<class T> class ConstSubImageIterator { public: const ConstSubImageIterator& operator++() { ptr++; if(ptr == row_end) { ptr += row_increment; row_end += total_width; if(ptr >= end) end = NULL; } return *this; } void operator++(int) { operator++(); } const T* operator->() const { return ptr; } const T& operator*() const { return *ptr;} bool operator<(const ConstSubImageIterator& s) const { //It's illegal to iterate _past_ end(), so < is equivalent to != //for end iterators. if(is_end && s.is_end) return 0; else if(is_end) return s.end != NULL; else if(s.is_end) return end != NULL; else return ptr < s.ptr; } bool operator==(const ConstSubImageIterator& s) const { return !((*this)!=s); } bool operator!=(const ConstSubImageIterator& s) const { if(is_end && s.is_end) return 0; else if(is_end) return s.end != NULL; else if(s.is_end) return end != NULL; else return ptr != s.ptr; } //Make it look like a standard iterator typedef std::forward_iterator_tag iterator_category; typedef T value_type; typedef std::ptrdiff_t difference_type; typedef const T* pointer; typedef const T& reference; ConstSubImageIterator() {} ConstSubImageIterator(const T* start, int image_width, int row_stride, const T* off_end) :ptr(const_cast<T*>(start)), row_end(start + image_width), end(off_end), is_end(0), row_increment(row_stride-image_width), total_width(row_stride) { } //Prevent automatic conversion from a pointer (ie Image::iterator) explicit ConstSubImageIterator(const T* end) :ptr(const_cast<T*>(end)),is_end(1),row_increment(0),total_width(0) { } protected: T* ptr; const T *row_end, *end; bool is_end; int row_increment, total_width; }; template<class T> class SubImageIterator: public ConstSubImageIterator<T> { public: SubImageIterator(T* start, int image_width, int row_stride, const T* off_end) :ConstSubImageIterator<T>(start, image_width, row_stride, off_end) {} explicit SubImageIterator(T* end) :ConstSubImageIterator<T>(end) { } SubImageIterator() {} typedef T* pointer; typedef T& reference; T* operator->() { return ConstSubImageIterator<T>::ptr; } T& operator*() { return *ConstSubImageIterator<T>::ptr;} }; /// A generic image class to manage a block of arbitrarily padded data as an image. Provides /// basic image access such as accessing a particular pixel co-ordinate. /// @param T The pixel type for this image. Typically either /// <code>CVD::byte</code> or <code>CVD::Rgb<CVD::byte> ></code> are used, /// but images could be constructed of any available type. /// /// A BasicImage does not manage its own data, but provides access to an /// arbitrary externally-managed block of data as though it were an image. Use /// the derived Image class if you want an image which also has its own data. /// @ingroup gImage template<class T> class SubImage { public: /// Construct an image from a block of data. /// @param data The image data in horizontal scanline order /// @param size The size of the image /// @param stride The row stride (or width, including the padding) SubImage(T* data, const ImageRef& size, int stride) :my_data(data),my_size(size),my_stride(stride) { } /// Is this pixel co-ordinate inside the image? /// @param ir The co-ordinate to test bool in_image(const ImageRef& ir) const { return ir.x >=0 && ir.y >=0 && ir.x < my_size.x && ir.y < my_size.y; } /// Is this pixel co-ordinate inside the image, and not too close to the edges? /// @param ir The co-ordinate to test /// @param border The size of the border: positive points inside the image. bool in_image_with_border(const ImageRef& ir, int border) const { return ir.x >=border && ir.y >=border && ir.x < my_size.x - border && ir.y < my_size.y - border; } /// The image data is not destroyed when a BasicImage is destroyed. ~SubImage() {} /// Access a pixel from the image. Bounds checking is only performed if the library is compiled /// with <code>-D CVD_IMAGE_DEBUG</code>, in which case an ImageError::AccessOutsideImage exception is /// thrown. inline T& operator[](const ImageRef& pos) { CVD_IMAGE_ASSERT(in_image(pos), ImageError::AccessOutsideImage); return (my_data[pos.y*my_stride + pos.x]); } /// Access a pixel from the image. Bounds checking is only performed if the library is compiled /// with <code>-D CVD_IMAGE_DEBUG</code>, in which case an ImageError::AccessOutsideImage exception is /// thrown. inline const T& operator[](const ImageRef& pos) const { CVD_IMAGE_ASSERT(in_image(pos), ImageError::AccessOutsideImage); return (my_data[pos.y*my_stride + pos.x]); } /// Access pointer to pixel row. Returns the pointer to the first element of the passed row. /// Allows to use [y][x] on images to access a pixel. Bounds checking is only performed if the library is compiled /// with <code>-D CVD_IMAGE_DEBUG</code>, in which case an ImageError::AccessOutsideImage exception is /// thrown. inline T* operator[](int row) { CVD_IMAGE_ASSERT(in_image(ImageRef(0,row)), ImageError::AccessOutsideImage); return my_data+row*my_stride; } /// Access pointer to pixel row. Returns the pointer to the first element of the passed row. /// Allows to use [y][x] on images to access a pixel. Bounds checking is only performed if the library is compiled /// with <code>-D CVD_IMAGE_DEBUG</code>, in which case an ImageError::AccessOutsideImage exception is /// thrown. inline const T* operator[](int row) const { CVD_IMAGE_ASSERT(in_image(ImageRef(0,row)), ImageError::AccessOutsideImage); return my_data+row*my_stride; } /// Given a pointer, this returns the image position as an ImageRef inline ImageRef pos(const T* ptr) const { int diff = ptr - data(); return ImageRef(diff % my_stride, diff / my_size.x); } /// Returns the raw image data inline const T* data() const { return my_data; } /// Returns the raw image data inline T* data() { return my_data; } typedef SubImageIterator<T> iterator; typedef ConstSubImageIterator<T> const_iterator; /// The data type of the pixels in the image. typedef T value_type; /// Returns an iterator referencing the first (top-left) pixel in the image inline iterator begin() { return SubImageIterator<T>(data(), size().x, my_stride, end_ptr()); } /// Returns a const iterator referencing the first (top-left) pixel in the image inline const_iterator begin() const { return ConstSubImageIterator<T>(data(), size().x, my_stride, end_ptr()); } /// Returns an iterator pointing to one past the end of the image inline iterator end() { //Operator [] would always throw here! return SubImageIterator<T>(end_ptr()); } /// Returns a const iterator pointing to one past the end of the image inline const_iterator end() const { //Operator [] would always throw here! return ConstSubImageIterator<T>(end_ptr()); } inline void copy_from( const SubImage<T> & other ){ CVD_IMAGE_ASSERT2(other.size() == this->size(), Exceptions::Image::IncompatibleImageSizes, "copy_from"); std::copy(other.begin(), other.end(), this->begin()); } /// What is the size of this image? inline ImageRef size() const { return my_size; } /// What is the row stride of the image? inline int row_stride() const { return my_stride; } /// What is the total number of elements in the image (i.e. <code>size().x * size().y</code>), including padding inline int totalsize() const { return my_stride * my_size.y; } /// Set all the pixels in the image to zero. This is a relatively fast operation, using <code>memset</code>. inline void zero() { memset(my_data, 0, totalsize()*sizeof(T)); } /// Set all the pixels in the image to a value. This is a relatively fast operation, using <code>memfill</code>. /// @param d The value to write into the image inline void fill(const T d) { for(int y=0; y < my_size.y; y++) ImageUtil::memfill( (*this)[y], my_size.x, d); } /// Copy constructor /// @param copyof The image to copy SubImage(const SubImage& copyof) { my_size = copyof.my_size; my_data = copyof.my_data; my_stride = copyof.my_stride; } /// Return a sub image /// @param start Top left pixel of the sub image /// @param size width and height of the sub image SubImage sub_image(const ImageRef& start, const ImageRef& size) { CVD_IMAGE_ASSERT(in_image(start), ImageError::AccessOutsideImage); CVD_IMAGE_ASSERT(in_image(start + size - ImageRef(1,1)), ImageError::AccessOutsideImage); return SubImage( &operator[](start), size, my_stride); } /// Return const a sub image /// @param start Top left pixel of the sub image /// @param size width and height of the sub image const SubImage sub_image(const ImageRef& start, const ImageRef& size) const { CVD_IMAGE_ASSERT(in_image(start), ImageError::AccessOutsideImage); CVD_IMAGE_ASSERT(in_image(start + size - ImageRef(1,1)), ImageError::AccessOutsideImage); T*ptr = my_data + start.y * my_stride + start.x; return SubImage(ptr, size, my_stride); } /// Return a reference to a SubImage. Useful for passing anonymous SubImages to functions. SubImage& ref() { return *this; } protected: T* my_data; ///< The raw image data ImageRef my_size; ///< The size of the image int my_stride; ///< The row stride ///Return an off-the-end pointer without ever throwing AccessOutsideImage T* end_ptr() { return my_data+my_size.y*my_stride; } ///Return an off-the-end pointer without ever throwing AccessOutsideImage const T* end_ptr() const { return my_data+my_size.y*my_stride; } SubImage() {} }; /// A generic image class to manage a block of data as an image. Provides /// basic image access such as accessing a particular pixel co-ordinate. /// @param T The pixel type for this image. Typically either /// <code>CVD::byte</code> or <code>CVD::Rgb<CVD::byte> ></code> are used, /// but images could be constructed of any available type. /// /// A BasicImage does not manage its own data, but provides access to an /// arbitrary externally-managed block of data as though it were an image. Use /// the derived Image class if you want an image which also has its own data. /// /// Loading and saving, format conversion and some copying functionality is /// provided by external functions rather than as part of this class. See /// the @ref gImageIO "Image loading and saving, and format conversion" module /// for documentation of these functions. /// @ingroup gImage template<class T> class BasicImage: public SubImage<T> { public: /// Construct an image from a block of data. /// @param data The image data in horizontal scanline order /// @param size The size of the image BasicImage(T* data, const ImageRef& size) :SubImage<T>(data, size, size.x) { } /// Copy constructor /// @param copyof The image to copy BasicImage(const BasicImage& copyof) :SubImage<T>(copyof) { } void operator=(const BasicImage&copyof) { SubImage<T>::my_size = copyof.my_size; SubImage<T>::my_data = copyof.my_data; SubImage<T>::my_stride = copyof.my_stride; } /// The image data is not destroyed when a BasicImage is destroyed. ~BasicImage() {} /** A random-access iterator to read or write pixel values from the image. This can be incremented, decremented and dereferenced. Incrementing this iterator steps through pixels in the usual scanline order. */ typedef T* iterator; /** A random-access iterator to read pixel values from the image. This can be incremented, decremented and dereferenced. Incrementing this iterator steps through pixels in the usual scanline order. */ typedef const T* const_iterator; /// The data type of the pixels in the image. typedef T value_type; /** Returns a const iterator referencing the first (top-left) pixel in the image. */ const_iterator begin() const { return SubImage<T>::my_data; } /** Returns an iterator referencing the first (top-left) pixel in the image. */ iterator begin() { return SubImage<T>::my_data; } /** Returns a const iterator referencing the <em>pixel immediately after</em> the last (bottom-right) pixel in the image. */ const_iterator end() const { return SubImage<T>::my_data+SubImage<T>::totalsize(); } /** Returns an iterator referencing the <em>pixel immediately after</em> the last (bottom-right) pixel in the image. */ iterator end() { return SubImage<T>::my_data+SubImage<T>::totalsize(); } protected: /// The default constructor does nothing BasicImage() {} private: }; /** An input iterator which just returns N copies of the same value over and over again. This can be used for construction of containers of images. For intstance the code: @code vector<Image<float> > foo(3, ImageRef(10,10)); @endcode All elements of <code>foo</code> point to the same 10x10 image, which is probably not the desired behaviour. The desired behaviour can be obtained with the ImageCreationIterator: @code ImageCreationIterator<ImageRef> begin(10,10), end(3); vector<Image<float> > foo(begin, end); @endcode In this case, <code>foo</code> contains 3 distinct images. See also - @ref CreateImagesBegin - @ref CreateImagesEnd - @ref Image<T>::Image(ImageRef) - @ref Image<T>::Image(std::pair<ImageRef, T> ) - @ref Image<T>::copy_from_me() **/ template<class T> class ImageCreationIterator: public std::iterator<std::input_iterator_tag, T, std::ptrdiff_t> { public: void operator++(int) { num++; } void operator++() { num++; } bool operator==(const ImageCreationIterator& i){return num == i.num;} bool operator!=(const ImageCreationIterator& i){return num != i.num;} const T& operator*() { return *construct_from_me; } ImageCreationIterator(const T& data) :construct_from_me(&data),num(0){} ImageCreationIterator(int i) :construct_from_me(0),num(i){} private: const T* construct_from_me; int num; }; /// Shortcut function for creating an iterator from a bit of data.. /// @param from_me Data to construct from template<class C> inline ImageCreationIterator<C> CreateImagesBegin(const C& from_me) { return ImageCreationIterator<C>(from_me); } /// Shortcut to create an end iterator. /// The first parameter is used to get the type correct. /// @param i Number of copies to make template<class C> inline ImageCreationIterator<C> CreateImagesEnd(const C&, int i) { return ImageCreationIterator<C>(i); } /// Shortcut to create an end iterator. /// @param i Number of copies to make template<class C> inline ImageCreationIterator<C> CreateImagesEnd(int i) { return ImageCreationIterator<C>(i); } /// A full image which manages its own data. /// @param T The pixel type for this image. Typically either /// <code>CVD::byte</code> or <code>CVD::Rgb<CVD::byte> ></code> are used, /// but images could be constructed of any available type. /// /// Images do reference counting on the data, so multiple images can point /// to one block of data. This means that copying an image is like copying a /// pointer (so use the same care); to further the analogy, operator[]() /// dereferences images. Copy constructing is quite fast (a 16-byte copy and /// an increment), so images can be efficiently passed back in functions or /// used in containers like std::vector /// /// Image<> inherits all debugging macros from BasicImage and SubImage. /// In addition, the macro CVD_IMAGE_DEBUG_INITIALIZE_RANDOM will cause allocated /// memory to be initialized with random numbers before any constructors are called. /// /// Loading and saving, format conversion and some copying functionality is /// provided by external functions rather than as part of this class. See /// the @ref gImageIO "Image loading and saving, and format conversion" module /// for documentation of these functions. /// @ingroup gImage template<class T> class Image: public BasicImage<T> { private: struct CopyPlaceHolder { const Image* im; }; public: /// The data type of the pixels in the image. typedef T value_type; ///Copy constructor. This does not copy the data, it just creates a new ///reference to the image data ///@param copy The image to copy Image(const Image& copy) : BasicImage<T>(copy) { dup_from(&copy); } /**CopyFrom" constructor. If constructed from this, it creates a new copy of the data. This provides symmetry with @copy_from @ref copy_from_me @param c The (placeholder) image to copy from. **/ Image(const CopyPlaceHolder& c) { dup_from(NULL); copy_from(*(c.im)); } ///This returns a place holder from which an image can be constructed. ///On construction, a new copy of the data is made. CopyPlaceHolder copy_from_me() const { CopyPlaceHolder c = {this}; return c; } ///Make a (new) copy of the image, also making a copy of the data ///@param copy The image to copy void copy_from(const BasicImage<T>& copy) { resize(copy.size()); std::copy(copy.begin(), copy.end(), this->begin()); } ///Make a (new) copy of the image, also making a copy of the data ///@param copy The image to copy void copy_from(const SubImage<T>& copy) { Image<T> tmp(copy.size()); *this = tmp; std::copy(copy.begin(), copy.end(), this->begin()); } ///Make this image independent of any copies (i.e. force a copy of the image data). void make_unique() { if(*num_copies > 1) { Image<T> tmp(*this); copy_from(tmp); } } ///Assign this image to another one. This does not copy the data, it just creates a new ///reference to the image data ///@param copyof The image to copy const Image& operator=(const Image& copyof) { remove(); dup_from(&copyof); return *this; } #ifndef DOXYGEN_IGNORE_INTERNAL template<class C> const Image& operator=(Internal::ImagePromise<C> p) { p.execute(*this); return *this; } template<class C> Image(Internal::ImagePromise<C> p) { dup_from(NULL); p.execute(*this); } #endif ///Default constructor Image() { dup_from(NULL); } ///Create an empty image of a given size. ///@param size The size of image to create Image(const ImageRef& size) { //If the size of the image is zero pixels along any dimension, //still keep any of the non-zero dimensions in the size. The //caller should expect the size passed to the constructor //to be the same as the value returned by .size() if (size.x == 0 || size.y == 0) { dup_from(NULL); this->my_size = size; this->my_stride = size.x; } else { num_copies = new int; *num_copies = 1; this->my_size = size; this->my_stride = size.x; this->my_data = Internal::aligned_alloc<T>(this->totalsize(), 16); } } ///Create a filled image of a given size ///@param size The size of image to create ///@param val The value to fill the image with Image(const ImageRef& size, const T& val) { Image<T> tmp(size); tmp.fill(val); dup_from(&tmp); } ///Create a filled image of a given size ///@param p std::pair<ImageRef, T> containing the size and fill value. ///Useful for creating containers of images with ImageCreationIterator Image(const std::pair<ImageRef, T>& p) { Image<T> tmp(p.first); tmp.fill(p.second); dup_from(&tmp); } ///Resize the image (destroying the data). ///This does not affect any other images pointing to this data. ///@param size The new size of the image void resize(const ImageRef& size) { if(size != BasicImage<T>::my_size || *num_copies > 1) { Image<T> new_im(size); *this = new_im; } } ///Resize the image (destroying the data). ///This does not affect any other images pointing to this data. //The resized image is filled with val. ///@param size The new size of the image ///@param val The value to fill the image with void resize(const ImageRef& size, const T& val) { if(*num_copies > 1 || size != BasicImage<T>::my_size) { Image<T> new_im(size, val); *this = new_im; } else fill(val); } ///The destructor removes the image data ~Image() { remove(); } private: int* num_copies; //Reference count. inline void remove() //Get rid of a reference to the data { if(this->my_data && *num_copies && --(*num_copies) == 0) { Internal::aligned_free<T>(this->my_data, this->totalsize()); this->my_data = 0; delete num_copies; num_copies = 0; } } inline void dup_from(const Image* copyof) //Duplicate from another image { if(copyof != NULL) { //For images with zero pixels (e.g. 0 by 100 image), //we still want to preserve non-zero dimensions in the size. this->my_size = copyof->my_size; this->my_stride = copyof->my_stride; if (copyof->my_data != NULL) { this->my_data = copyof->my_data; num_copies = copyof->num_copies; (*num_copies)++; } else { this->my_data = 0; num_copies = 0; } } else { this->my_size.home(); this->my_data = 0; this->my_stride = 0; num_copies = 0; } } }; } // end namespace #endif
dev344/tum_ardrone
thirdparty/libcvd/installfiles/cvd/image.h
C
gpl-3.0
25,953
#region License // Copyright (c) 2013, ClearCanvas Inc. // All rights reserved. // http://www.ClearCanvas.ca // // This file is part of the ClearCanvas RIS/PACS open source project. // // The ClearCanvas RIS/PACS open source project is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // The ClearCanvas RIS/PACS open source project is distributed in the hope that it // will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General // Public License for more details. // // You should have received a copy of the GNU General Public License along with // the ClearCanvas RIS/PACS open source project. If not, see // <http://www.gnu.org/licenses/>. #endregion using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Text; using System.Xml; using System.Xml.Serialization; namespace Macro.Utilities.Manifest { /// <summary> /// Input file generated by <see cref="ManifestInputGenerationApplication"/> for <see cref="ManifestGenerationApplication"/>. /// </summary> [XmlRoot("ManifestInput", Namespace = "http://www.ClearCanvas.ca")] public class ManifestInput { #region Class definitions [XmlRoot("File")] public class InputFile { [XmlAttribute(AttributeName = "checksum", DataType = "boolean")] [DefaultValue(false)] public bool Checksum { get; set; } [XmlAttribute(AttributeName = "ignore", DataType = "boolean")] [DefaultValue(false)] public bool Ignore { get; set; } [XmlAttribute(AttributeName = "config", DataType = "boolean")] [DefaultValue(false)] public bool Config { get; set; } [XmlAttribute(AttributeName = "name", DataType = "string")] public string Name; } #endregion Class definitions #region Private Members private List<InputFile> _files; #endregion Private Members #region Public Properties [XmlArray("Files")] [XmlArrayItem("File")] public List<InputFile> Files { get { if (_files == null) _files = new List<InputFile>(); return _files; } set { _files = value; } } #endregion Public Properties #region Public Static Methods public static ManifestInput Deserialize(string filename) { XmlSerializer theSerializer = new XmlSerializer(typeof (ManifestInput)); using (FileStream fs = new FileStream(filename, FileMode.Open)) { ManifestInput input = (ManifestInput) theSerializer.Deserialize(fs); return input; } } public static void Serialize(string filename, ManifestInput input) { using (FileStream fs = new FileStream(filename, FileMode.CreateNew)) { XmlSerializer theSerializer = new XmlSerializer(typeof (ManifestInput)); XmlWriterSettings settings = new XmlWriterSettings { Indent = true, IndentChars = " ", Encoding = Encoding.UTF8, }; XmlWriter writer = XmlWriter.Create(fs, settings); if (writer != null) theSerializer.Serialize(writer, input); fs.Flush(); fs.Close(); } } #endregion } }
151706061/MacroMedicalSystem
Utilities/Manifest/ManifestInput.cs
C#
gpl-3.0
3,994
/*========================================================================= Program: ITK-SNAP Module: $RCSfile: Filename.cxx,v $ Language: C++ Date: $Date: 2010/10/18 11:25:44 $ Version: $Revision: 1.12 $ Copyright (c) 2011 Paul A. Yushkevich This file is part of ITK-SNAP ITK-SNAP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. =========================================================================*/ #ifndef QTABSTRACTOPENGLBOX_H #define QTABSTRACTOPENGLBOX_H #include <QOpenGLWidget> #include <SNAPCommon.h> #include <SNAPEvents.h> class QMouseEvent; class EventBucket; class QtInteractionDelegateWidget; class AbstractRenderer; namespace itk { class Object; } class QtAbstractOpenGLBox : public QOpenGLWidget { Q_OBJECT public: explicit QtAbstractOpenGLBox(QWidget *parent = 0); // Whether to grab keyboard focus when the mouse enters this widget irisGetSetMacro(GrabFocusOnEntry, bool) /** Use this function when the GL widget is only associated with a single interaction mode. */ void AttachSingleDelegate(QtInteractionDelegateWidget *delegate); /** The child class must override this method to return its pointer to the renderer object. Every instance of this object must have a renderer. */ virtual AbstractRenderer* GetRenderer() const = 0; /** Take a screenshot, save to a PNG file */ virtual bool SaveScreenshot(std::string filename); public slots: // Default slot for model updates virtual void onModelUpdate(const EventBucket &bucket) {} protected: /** Register to receive ITK events from object src. Events will be cached in an event bucket and delivered once execution returns to the UI loop */ void connectITK(itk::Object *src, const itk::EventObject &ev, const char *slot = SLOT(onModelUpdate(const EventBucket &))); // OpenGL painter methods virtual void paintGL(); virtual void resizeGL(int w, int h); virtual void initializeGL(); // Resize event // virtual void resizeEvent(QResizeEvent *); virtual void enterEvent(QEvent *); virtual void leaveEvent(QEvent *); // Whether we need to call GL resize next time a paint command occurs bool m_NeedResizeOnNextRepaint; // Whether this widget grabs keyboard focus when the mouse enters it bool m_GrabFocusOnEntry; // Whether a screenshot has been requested (non-empty string) QString m_ScreenshotRequest; signals: public slots: }; #endif // QTABSTRACTOPENGLBOX_H
romangrothausmann/itksnap
GUI/Qt/View/QtAbstractOpenGLBox.h
C
gpl-3.0
3,065
/////////////////////////////////////////////////////////////////////////////// // /// \file file_io.c /// \brief File opening, unlinking, and closing // // Author: Lasse Collin // // This file has been put into the public domain. // You can do whatever you want with this file. // /////////////////////////////////////////////////////////////////////////////// #include "private.h" #include <fcntl.h> #ifdef TUKLIB_DOSLIKE # include <io.h> #else # include <poll.h> static bool warn_fchown; #endif #if defined(HAVE_FUTIMES) || defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMES) # include <sys/time.h> #elif defined(HAVE_UTIME) # include <utime.h> #endif #ifdef HAVE_CAPSICUM # ifdef HAVE_SYS_CAPSICUM_H # include <sys/capsicum.h> # else # include <sys/capability.h> # endif #endif #include "tuklib_open_stdxxx.h" #ifndef O_BINARY # define O_BINARY 0 #endif #ifndef O_NOCTTY # define O_NOCTTY 0 #endif typedef enum { IO_WAIT_MORE, // Reading or writing is possible. IO_WAIT_ERROR, // Error or user_abort IO_WAIT_TIMEOUT, // poll() timed out } io_wait_ret; /// If true, try to create sparse files when decompressing. static bool try_sparse = true; #ifdef ENABLE_SANDBOX /// True if the conditions for sandboxing (described in main()) have been met. static bool sandbox_allowed = false; #endif #ifndef TUKLIB_DOSLIKE /// File status flags of standard input. This is used by io_open_src() /// and io_close_src(). static int stdin_flags; static bool restore_stdin_flags = false; /// Original file status flags of standard output. This is used by /// io_open_dest() and io_close_dest() to save and restore the flags. static int stdout_flags; static bool restore_stdout_flags = false; /// Self-pipe used together with the user_abort variable to avoid /// race conditions with signal handling. static int user_abort_pipe[2]; #endif static bool io_write_buf(file_pair *pair, const uint8_t *buf, size_t size); extern void io_init(void) { // Make sure that stdin, stdout, and stderr are connected to // a valid file descriptor. Exit immediately with exit code ERROR // if we cannot make the file descriptors valid. Maybe we should // print an error message, but our stderr could be screwed anyway. tuklib_open_stdxxx(E_ERROR); #ifndef TUKLIB_DOSLIKE // If fchown() fails setting the owner, we warn about it only if // we are root. warn_fchown = geteuid() == 0; // Create a pipe for the self-pipe trick. if (pipe(user_abort_pipe)) message_fatal(_("Error creating a pipe: %s"), strerror(errno)); // Make both ends of the pipe non-blocking. for (unsigned i = 0; i < 2; ++i) { int flags = fcntl(user_abort_pipe[i], F_GETFL); if (flags == -1 || fcntl(user_abort_pipe[i], F_SETFL, flags | O_NONBLOCK) == -1) message_fatal(_("Error creating a pipe: %s"), strerror(errno)); } #endif #ifdef __DJGPP__ // Avoid doing useless things when statting files. // This isn't important but doesn't hurt. _djstat_flags = _STAT_EXEC_EXT | _STAT_EXEC_MAGIC | _STAT_DIRSIZE; #endif return; } #ifndef TUKLIB_DOSLIKE extern void io_write_to_user_abort_pipe(void) { // If the write() fails, it's probably due to the pipe being full. // Failing in that case is fine. If the reason is something else, // there's not much we can do since this is called in a signal // handler. So ignore the errors and try to avoid warnings with // GCC and glibc when _FORTIFY_SOURCE=2 is used. uint8_t b = '\0'; const int ret = write(user_abort_pipe[1], &b, 1); (void)ret; return; } #endif extern void io_no_sparse(void) { try_sparse = false; return; } #ifdef ENABLE_SANDBOX extern void io_allow_sandbox(void) { sandbox_allowed = true; return; } /// Enables operating-system-specific sandbox if it is possible. /// src_fd is the file descriptor of the input file. static void io_sandbox_enter(int src_fd) { if (!sandbox_allowed) { message(V_DEBUG, _("Sandbox is disabled due " "to incompatible command line arguments")); return; } const char dummy_str[] = "x"; // Try to ensure that both libc and xz locale files have been // loaded when NLS is enabled. snprintf(NULL, 0, "%s%s", _(dummy_str), strerror(EINVAL)); // Try to ensure that iconv data files needed for handling multibyte // characters have been loaded. This is needed at least with glibc. tuklib_mbstr_width(dummy_str, NULL); #ifdef HAVE_CAPSICUM // Capsicum needs FreeBSD 10.0 or later. cap_rights_t rights; if (cap_rights_limit(src_fd, cap_rights_init(&rights, CAP_EVENT, CAP_FCNTL, CAP_LOOKUP, CAP_READ, CAP_SEEK))) goto error; if (cap_rights_limit(STDOUT_FILENO, cap_rights_init(&rights, CAP_EVENT, CAP_FCNTL, CAP_FSTAT, CAP_LOOKUP, CAP_WRITE, CAP_SEEK))) goto error; if (cap_rights_limit(user_abort_pipe[0], cap_rights_init(&rights, CAP_EVENT))) goto error; if (cap_rights_limit(user_abort_pipe[1], cap_rights_init(&rights, CAP_WRITE))) goto error; if (cap_enter()) goto error; #else # error ENABLE_SANDBOX is defined but no sandboxing method was found. #endif message(V_DEBUG, _("Sandbox was successfully enabled")); return; error: message(V_DEBUG, _("Failed to enable the sandbox")); } #endif // ENABLE_SANDBOX #ifndef TUKLIB_DOSLIKE /// \brief Waits for input or output to become available or for a signal /// /// This uses the self-pipe trick to avoid a race condition that can occur /// if a signal is caught after user_abort has been checked but before e.g. /// read() has been called. In that situation read() could block unless /// non-blocking I/O is used. With non-blocking I/O something like select() /// or poll() is needed to avoid a busy-wait loop, and the same race condition /// pops up again. There are pselect() (POSIX-1.2001) and ppoll() (not in /// POSIX) but neither is portable enough in 2013. The self-pipe trick is /// old and very portable. static io_wait_ret io_wait(file_pair *pair, int timeout, bool is_reading) { struct pollfd pfd[2]; if (is_reading) { pfd[0].fd = pair->src_fd; pfd[0].events = POLLIN; } else { pfd[0].fd = pair->dest_fd; pfd[0].events = POLLOUT; } pfd[1].fd = user_abort_pipe[0]; pfd[1].events = POLLIN; while (true) { const int ret = poll(pfd, 2, timeout); if (user_abort) return IO_WAIT_ERROR; if (ret == -1) { if (errno == EINTR || errno == EAGAIN) continue; message_error(_("%s: poll() failed: %s"), is_reading ? pair->src_name : pair->dest_name, strerror(errno)); return IO_WAIT_ERROR; } if (ret == 0) { assert(opt_flush_timeout != 0); flush_needed = true; return IO_WAIT_TIMEOUT; } if (pfd[0].revents != 0) return IO_WAIT_MORE; } } #endif /// \brief Unlink a file /// /// This tries to verify that the file being unlinked really is the file that /// we want to unlink by verifying device and inode numbers. There's still /// a small unavoidable race, but this is much better than nothing (the file /// could have been moved/replaced even hours earlier). static void io_unlink(const char *name, const struct stat *known_st) { #if defined(TUKLIB_DOSLIKE) // On DOS-like systems, st_ino is meaningless, so don't bother // testing it. Just silence a compiler warning. (void)known_st; #else struct stat new_st; // If --force was used, use stat() instead of lstat(). This way // (de)compressing symlinks works correctly. However, it also means // that xz cannot detect if a regular file foo is renamed to bar // and then a symlink foo -> bar is created. Because of stat() // instead of lstat(), xz will think that foo hasn't been replaced // with another file. Thus, xz will remove foo even though it no // longer is the same file that xz used when it started compressing. // Probably it's not too bad though, so this doesn't need a more // complex fix. const int stat_ret = opt_force ? stat(name, &new_st) : lstat(name, &new_st); if (stat_ret # ifdef __VMS // st_ino is an array, and we don't want to // compare st_dev at all. || memcmp(&new_st.st_ino, &known_st->st_ino, sizeof(new_st.st_ino)) != 0 # else // Typical POSIX-like system || new_st.st_dev != known_st->st_dev || new_st.st_ino != known_st->st_ino # endif ) // TRANSLATORS: When compression or decompression finishes, // and xz is going to remove the source file, xz first checks // if the source file still exists, and if it does, does its // device and inode numbers match what xz saw when it opened // the source file. If these checks fail, this message is // shown, %s being the filename, and the file is not deleted. // The check for device and inode numbers is there, because // it is possible that the user has put a new file in place // of the original file, and in that case it obviously // shouldn't be removed. message_error(_("%s: File seems to have been moved, " "not removing"), name); else #endif // There's a race condition between lstat() and unlink() // but at least we have tried to avoid removing wrong file. if (unlink(name)) message_error(_("%s: Cannot remove: %s"), name, strerror(errno)); return; } /// \brief Copies owner/group and permissions /// /// \todo ACL and EA support /// static void io_copy_attrs(const file_pair *pair) { // Skip chown and chmod on Windows. #ifndef TUKLIB_DOSLIKE // This function is more tricky than you may think at first. // Blindly copying permissions may permit users to access the // destination file who didn't have permission to access the // source file. // Try changing the owner of the file. If we aren't root or the owner // isn't already us, fchown() probably doesn't succeed. We warn // about failing fchown() only if we are root. if (fchown(pair->dest_fd, pair->src_st.st_uid, -1) && warn_fchown) message_warning(_("%s: Cannot set the file owner: %s"), pair->dest_name, strerror(errno)); mode_t mode; if (fchown(pair->dest_fd, -1, pair->src_st.st_gid)) { message_warning(_("%s: Cannot set the file group: %s"), pair->dest_name, strerror(errno)); // We can still safely copy some additional permissions: // `group' must be at least as strict as `other' and // also vice versa. // // NOTE: After this, the owner of the source file may // get additional permissions. This shouldn't be too bad, // because the owner would have had permission to chmod // the original file anyway. mode = ((pair->src_st.st_mode & 0070) >> 3) & (pair->src_st.st_mode & 0007); mode = (pair->src_st.st_mode & 0700) | (mode << 3) | mode; } else { // Drop the setuid, setgid, and sticky bits. mode = pair->src_st.st_mode & 0777; } if (fchmod(pair->dest_fd, mode)) message_warning(_("%s: Cannot set the file permissions: %s"), pair->dest_name, strerror(errno)); #endif // Copy the timestamps. We have several possible ways to do this, of // which some are better in both security and precision. // // First, get the nanosecond part of the timestamps. As of writing, // it's not standardized by POSIX, and there are several names for // the same thing in struct stat. long atime_nsec; long mtime_nsec; # if defined(HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC) // GNU and Solaris atime_nsec = pair->src_st.st_atim.tv_nsec; mtime_nsec = pair->src_st.st_mtim.tv_nsec; # elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC) // BSD atime_nsec = pair->src_st.st_atimespec.tv_nsec; mtime_nsec = pair->src_st.st_mtimespec.tv_nsec; # elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC) // GNU and BSD without extensions atime_nsec = pair->src_st.st_atimensec; mtime_nsec = pair->src_st.st_mtimensec; # elif defined(HAVE_STRUCT_STAT_ST_UATIME) // Tru64 atime_nsec = pair->src_st.st_uatime * 1000; mtime_nsec = pair->src_st.st_umtime * 1000; # elif defined(HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC) // UnixWare atime_nsec = pair->src_st.st_atim.st__tim.tv_nsec; mtime_nsec = pair->src_st.st_mtim.st__tim.tv_nsec; # else // Safe fallback atime_nsec = 0; mtime_nsec = 0; # endif // Construct a structure to hold the timestamps and call appropriate // function to set the timestamps. #if defined(HAVE_FUTIMENS) // Use nanosecond precision. struct timespec tv[2]; tv[0].tv_sec = pair->src_st.st_atime; tv[0].tv_nsec = atime_nsec; tv[1].tv_sec = pair->src_st.st_mtime; tv[1].tv_nsec = mtime_nsec; (void)futimens(pair->dest_fd, tv); #elif defined(HAVE_FUTIMES) || defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMES) // Use microsecond precision. struct timeval tv[2]; tv[0].tv_sec = pair->src_st.st_atime; tv[0].tv_usec = atime_nsec / 1000; tv[1].tv_sec = pair->src_st.st_mtime; tv[1].tv_usec = mtime_nsec / 1000; # if defined(HAVE_FUTIMES) (void)futimes(pair->dest_fd, tv); # elif defined(HAVE_FUTIMESAT) (void)futimesat(pair->dest_fd, NULL, tv); # else // Argh, no function to use a file descriptor to set the timestamp. (void)utimes(pair->dest_name, tv); # endif #elif defined(HAVE_UTIME) // Use one-second precision. utime() doesn't support using file // descriptor either. Some systems have broken utime() prototype // so don't make this const. struct utimbuf buf = { .actime = pair->src_st.st_atime, .modtime = pair->src_st.st_mtime, }; // Avoid warnings. (void)atime_nsec; (void)mtime_nsec; (void)utime(pair->dest_name, &buf); #endif return; } /// Opens the source file. Returns false on success, true on error. static bool io_open_src_real(file_pair *pair) { // There's nothing to open when reading from stdin. if (pair->src_name == stdin_filename) { pair->src_fd = STDIN_FILENO; #ifdef TUKLIB_DOSLIKE setmode(STDIN_FILENO, O_BINARY); #else // Try to set stdin to non-blocking mode. It won't work // e.g. on OpenBSD if stdout is e.g. /dev/null. In such // case we proceed as if stdin were non-blocking anyway // (in case of /dev/null it will be in practice). The // same applies to stdout in io_open_dest_real(). stdin_flags = fcntl(STDIN_FILENO, F_GETFL); if (stdin_flags == -1) { message_error(_("Error getting the file status flags " "from standard input: %s"), strerror(errno)); return true; } if ((stdin_flags & O_NONBLOCK) == 0 && fcntl(STDIN_FILENO, F_SETFL, stdin_flags | O_NONBLOCK) != -1) restore_stdin_flags = true; #endif #ifdef HAVE_POSIX_FADVISE // It will fail if stdin is a pipe and that's fine. (void)posix_fadvise(STDIN_FILENO, 0, 0, POSIX_FADV_SEQUENTIAL); #endif return false; } // Symlinks are not followed unless writing to stdout or --force // was used. const bool follow_symlinks = opt_stdout || opt_force; // We accept only regular files if we are writing the output // to disk too. bzip2 allows overriding this with --force but // gzip and xz don't. const bool reg_files_only = !opt_stdout; // Flags for open() int flags = O_RDONLY | O_BINARY | O_NOCTTY; #ifndef TUKLIB_DOSLIKE // Use non-blocking I/O: // - It prevents blocking when opening FIFOs and some other // special files, which is good if we want to accept only // regular files. // - It can help avoiding some race conditions with signal handling. flags |= O_NONBLOCK; #endif #if defined(O_NOFOLLOW) if (!follow_symlinks) flags |= O_NOFOLLOW; #elif !defined(TUKLIB_DOSLIKE) // Some POSIX-like systems lack O_NOFOLLOW (it's not required // by POSIX). Check for symlinks with a separate lstat() on // these systems. if (!follow_symlinks) { struct stat st; if (lstat(pair->src_name, &st)) { message_error("%s: %s", pair->src_name, strerror(errno)); return true; } else if (S_ISLNK(st.st_mode)) { message_warning(_("%s: Is a symbolic link, " "skipping"), pair->src_name); return true; } } #else // Avoid warnings. (void)follow_symlinks; #endif // Try to open the file. Signals have been blocked so EINTR shouldn't // be possible. pair->src_fd = open(pair->src_name, flags); if (pair->src_fd == -1) { // Signals (that have a signal handler) have been blocked. assert(errno != EINTR); #ifdef O_NOFOLLOW // Give an understandable error message if the reason // for failing was that the file was a symbolic link. // // Note that at least Linux, OpenBSD, Solaris, and Darwin // use ELOOP to indicate that O_NOFOLLOW was the reason // that open() failed. Because there may be // directories in the pathname, ELOOP may occur also // because of a symlink loop in the directory part. // So ELOOP doesn't tell us what actually went wrong, // and this stupidity went into POSIX-1.2008 too. // // FreeBSD associates EMLINK with O_NOFOLLOW and // Tru64 uses ENOTSUP. We use these directly here // and skip the lstat() call and the associated race. // I want to hear if there are other kernels that // fail with something else than ELOOP with O_NOFOLLOW. bool was_symlink = false; # if defined(__FreeBSD__) || defined(__DragonFly__) if (errno == EMLINK) was_symlink = true; # elif defined(__digital__) && defined(__unix__) if (errno == ENOTSUP) was_symlink = true; # elif defined(__NetBSD__) if (errno == EFTYPE) was_symlink = true; # else if (errno == ELOOP && !follow_symlinks) { const int saved_errno = errno; struct stat st; if (lstat(pair->src_name, &st) == 0 && S_ISLNK(st.st_mode)) was_symlink = true; errno = saved_errno; } # endif if (was_symlink) message_warning(_("%s: Is a symbolic link, " "skipping"), pair->src_name); else #endif // Something else than O_NOFOLLOW failing // (assuming that the race conditions didn't // confuse us). message_error("%s: %s", pair->src_name, strerror(errno)); return true; } // Stat the source file. We need the result also when we copy // the permissions, and when unlinking. // // NOTE: Use stat() instead of fstat() with DJGPP, because // then we have a better chance to get st_ino value that can // be used in io_open_dest_real() to prevent overwriting the // source file. #ifdef __DJGPP__ if (stat(pair->src_name, &pair->src_st)) goto error_msg; #else if (fstat(pair->src_fd, &pair->src_st)) goto error_msg; #endif if (S_ISDIR(pair->src_st.st_mode)) { message_warning(_("%s: Is a directory, skipping"), pair->src_name); goto error; } if (reg_files_only && !S_ISREG(pair->src_st.st_mode)) { message_warning(_("%s: Not a regular file, skipping"), pair->src_name); goto error; } #ifndef TUKLIB_DOSLIKE if (reg_files_only && !opt_force) { if (pair->src_st.st_mode & (S_ISUID | S_ISGID)) { // gzip rejects setuid and setgid files even // when --force was used. bzip2 doesn't check // for them, but calls fchown() after fchmod(), // and many systems automatically drop setuid // and setgid bits there. // // We accept setuid and setgid files if // --force was used. We drop these bits // explicitly in io_copy_attr(). message_warning(_("%s: File has setuid or " "setgid bit set, skipping"), pair->src_name); goto error; } if (pair->src_st.st_mode & S_ISVTX) { message_warning(_("%s: File has sticky bit " "set, skipping"), pair->src_name); goto error; } if (pair->src_st.st_nlink > 1) { message_warning(_("%s: Input file has more " "than one hard link, " "skipping"), pair->src_name); goto error; } } // If it is something else than a regular file, wait until // there is input available. This way reading from FIFOs // will work when open() is used with O_NONBLOCK. if (!S_ISREG(pair->src_st.st_mode)) { signals_unblock(); const io_wait_ret ret = io_wait(pair, -1, true); signals_block(); if (ret != IO_WAIT_MORE) goto error; } #endif #ifdef HAVE_POSIX_FADVISE // It will fail with some special files like FIFOs but that is fine. (void)posix_fadvise(pair->src_fd, 0, 0, POSIX_FADV_SEQUENTIAL); #endif return false; error_msg: message_error("%s: %s", pair->src_name, strerror(errno)); error: (void)close(pair->src_fd); return true; } extern file_pair * io_open_src(const char *src_name) { if (is_empty_filename(src_name)) return NULL; // Since we have only one file open at a time, we can use // a statically allocated structure. static file_pair pair; pair = (file_pair){ .src_name = src_name, .dest_name = NULL, .src_fd = -1, .dest_fd = -1, .src_eof = false, .dest_try_sparse = false, .dest_pending_sparse = 0, }; // Block the signals, for which we have a custom signal handler, so // that we don't need to worry about EINTR. signals_block(); const bool error = io_open_src_real(&pair); signals_unblock(); #ifdef ENABLE_SANDBOX if (!error) io_sandbox_enter(pair.src_fd); #endif return error ? NULL : &pair; } /// \brief Closes source file of the file_pair structure /// /// \param pair File whose src_fd should be closed /// \param success If true, the file will be removed from the disk if /// closing succeeds and --keep hasn't been used. static void io_close_src(file_pair *pair, bool success) { #ifndef TUKLIB_DOSLIKE if (restore_stdin_flags) { assert(pair->src_fd == STDIN_FILENO); restore_stdin_flags = false; if (fcntl(STDIN_FILENO, F_SETFL, stdin_flags) == -1) message_error(_("Error restoring the status flags " "to standard input: %s"), strerror(errno)); } #endif if (pair->src_fd != STDIN_FILENO && pair->src_fd != -1) { #ifdef TUKLIB_DOSLIKE (void)close(pair->src_fd); #endif // If we are going to unlink(), do it before closing the file. // This way there's no risk that someone replaces the file and // happens to get same inode number, which would make us // unlink() wrong file. // // NOTE: DOS-like systems are an exception to this, because // they don't allow unlinking files that are open. *sigh* if (success && !opt_keep_original) io_unlink(pair->src_name, &pair->src_st); #ifndef TUKLIB_DOSLIKE (void)close(pair->src_fd); #endif } return; } static bool io_open_dest_real(file_pair *pair) { if (opt_stdout || pair->src_fd == STDIN_FILENO) { // We don't modify or free() this. pair->dest_name = (char *)"(stdout)"; pair->dest_fd = STDOUT_FILENO; #ifdef TUKLIB_DOSLIKE setmode(STDOUT_FILENO, O_BINARY); #else // Try to set O_NONBLOCK if it isn't already set. // If it fails, we assume that stdout is non-blocking // in practice. See the comments in io_open_src_real() // for similar situation with stdin. // // NOTE: O_APPEND may be unset later in this function // and it relies on stdout_flags being set here. stdout_flags = fcntl(STDOUT_FILENO, F_GETFL); if (stdout_flags == -1) { message_error(_("Error getting the file status flags " "from standard output: %s"), strerror(errno)); return true; } if ((stdout_flags & O_NONBLOCK) == 0 && fcntl(STDOUT_FILENO, F_SETFL, stdout_flags | O_NONBLOCK) != -1) restore_stdout_flags = true; #endif } else { pair->dest_name = suffix_get_dest_name(pair->src_name); if (pair->dest_name == NULL) return true; #ifdef __DJGPP__ struct stat st; if (stat(pair->dest_name, &st) == 0) { // Check that it isn't a special file like "prn". if (st.st_dev == -1) { message_error("%s: Refusing to write to " "a DOS special file", pair->dest_name); free(pair->dest_name); return true; } // Check that we aren't overwriting the source file. if (st.st_dev == pair->src_st.st_dev && st.st_ino == pair->src_st.st_ino) { message_error("%s: Output file is the same " "as the input file", pair->dest_name); free(pair->dest_name); return true; } } #endif // If --force was used, unlink the target file first. if (opt_force && unlink(pair->dest_name) && errno != ENOENT) { message_error(_("%s: Cannot remove: %s"), pair->dest_name, strerror(errno)); free(pair->dest_name); return true; } // Open the file. int flags = O_WRONLY | O_BINARY | O_NOCTTY | O_CREAT | O_EXCL; #ifndef TUKLIB_DOSLIKE flags |= O_NONBLOCK; #endif const mode_t mode = S_IRUSR | S_IWUSR; pair->dest_fd = open(pair->dest_name, flags, mode); if (pair->dest_fd == -1) { message_error("%s: %s", pair->dest_name, strerror(errno)); free(pair->dest_name); return true; } } #ifndef TUKLIB_DOSLIKE // dest_st isn't used on DOS-like systems except as a dummy // argument to io_unlink(), so don't fstat() on such systems. if (fstat(pair->dest_fd, &pair->dest_st)) { // If fstat() really fails, we have a safe fallback here. # if defined(__VMS) pair->dest_st.st_ino[0] = 0; pair->dest_st.st_ino[1] = 0; pair->dest_st.st_ino[2] = 0; # else pair->dest_st.st_dev = 0; pair->dest_st.st_ino = 0; # endif } else if (try_sparse && opt_mode == MODE_DECOMPRESS) { // When writing to standard output, we need to be extra // careful: // - It may be connected to something else than // a regular file. // - We aren't necessarily writing to a new empty file // or to the end of an existing file. // - O_APPEND may be active. // // TODO: I'm keeping this disabled for DOS-like systems // for now. FAT doesn't support sparse files, but NTFS // does, so maybe this should be enabled on Windows after // some testing. if (pair->dest_fd == STDOUT_FILENO) { if (!S_ISREG(pair->dest_st.st_mode)) return false; if (stdout_flags & O_APPEND) { // Creating a sparse file is not possible // when O_APPEND is active (it's used by // shell's >> redirection). As I understand // it, it is safe to temporarily disable // O_APPEND in xz, because if someone // happened to write to the same file at the // same time, results would be bad anyway // (users shouldn't assume that xz uses any // specific block size when writing data). // // The write position may be something else // than the end of the file, so we must fix // it to start writing at the end of the file // to imitate O_APPEND. if (lseek(STDOUT_FILENO, 0, SEEK_END) == -1) return false; // Construct the new file status flags. // If O_NONBLOCK was set earlier in this // function, it must be kept here too. int flags = stdout_flags & ~O_APPEND; if (restore_stdout_flags) flags |= O_NONBLOCK; // If this fcntl() fails, we continue but won't // try to create sparse output. The original // flags will still be restored if needed (to // unset O_NONBLOCK) when the file is finished. if (fcntl(STDOUT_FILENO, F_SETFL, flags) == -1) return false; // Disabling O_APPEND succeeded. Mark // that the flags should be restored // in io_close_dest(). (This may have already // been set when enabling O_NONBLOCK.) restore_stdout_flags = true; } else if (lseek(STDOUT_FILENO, 0, SEEK_CUR) != pair->dest_st.st_size) { // Writing won't start exactly at the end // of the file. We cannot use sparse output, // because it would probably corrupt the file. return false; } } pair->dest_try_sparse = true; } #endif return false; } extern bool io_open_dest(file_pair *pair) { signals_block(); const bool ret = io_open_dest_real(pair); signals_unblock(); return ret; } /// \brief Closes destination file of the file_pair structure /// /// \param pair File whose dest_fd should be closed /// \param success If false, the file will be removed from the disk. /// /// \return Zero if closing succeeds. On error, -1 is returned and /// error message printed. static bool io_close_dest(file_pair *pair, bool success) { #ifndef TUKLIB_DOSLIKE // If io_open_dest() has disabled O_APPEND, restore it here. if (restore_stdout_flags) { assert(pair->dest_fd == STDOUT_FILENO); restore_stdout_flags = false; if (fcntl(STDOUT_FILENO, F_SETFL, stdout_flags) == -1) { message_error(_("Error restoring the O_APPEND flag " "to standard output: %s"), strerror(errno)); return true; } } #endif if (pair->dest_fd == -1 || pair->dest_fd == STDOUT_FILENO) return false; if (close(pair->dest_fd)) { message_error(_("%s: Closing the file failed: %s"), pair->dest_name, strerror(errno)); // Closing destination file failed, so we cannot trust its // contents. Get rid of junk: io_unlink(pair->dest_name, &pair->dest_st); free(pair->dest_name); return true; } // If the operation using this file wasn't successful, we git rid // of the junk file. if (!success) io_unlink(pair->dest_name, &pair->dest_st); free(pair->dest_name); return false; } extern void io_close(file_pair *pair, bool success) { // Take care of sparseness at the end of the output file. if (success && pair->dest_try_sparse && pair->dest_pending_sparse > 0) { // Seek forward one byte less than the size of the pending // hole, then write one zero-byte. This way the file grows // to its correct size. An alternative would be to use // ftruncate() but that isn't portable enough (e.g. it // doesn't work with FAT on Linux; FAT isn't that important // since it doesn't support sparse files anyway, but we don't // want to create corrupt files on it). if (lseek(pair->dest_fd, pair->dest_pending_sparse - 1, SEEK_CUR) == -1) { message_error(_("%s: Seeking failed when trying " "to create a sparse file: %s"), pair->dest_name, strerror(errno)); success = false; } else { const uint8_t zero[1] = { '\0' }; if (io_write_buf(pair, zero, 1)) success = false; } } signals_block(); // Copy the file attributes. We need to skip this if destination // file isn't open or it is standard output. if (success && pair->dest_fd != -1 && pair->dest_fd != STDOUT_FILENO) io_copy_attrs(pair); // Close the destination first. If it fails, we must not remove // the source file! if (io_close_dest(pair, success)) success = false; // Close the source file, and unlink it if the operation using this // file pair was successful and we haven't requested to keep the // source file. io_close_src(pair, success); signals_unblock(); return; } extern void io_fix_src_pos(file_pair *pair, size_t rewind_size) { assert(rewind_size <= IO_BUFFER_SIZE); if (rewind_size > 0) { // This doesn't need to work on unseekable file descriptors, // so just ignore possible errors. (void)lseek(pair->src_fd, -(off_t)(rewind_size), SEEK_CUR); } return; } extern size_t io_read(file_pair *pair, io_buf *buf_union, size_t size) { // We use small buffers here. assert(size < SSIZE_MAX); uint8_t *buf = buf_union->u8; size_t left = size; while (left > 0) { const ssize_t amount = read(pair->src_fd, buf, left); if (amount == 0) { pair->src_eof = true; break; } if (amount == -1) { if (errno == EINTR) { if (user_abort) return SIZE_MAX; continue; } #ifndef TUKLIB_DOSLIKE if (errno == EAGAIN || errno == EWOULDBLOCK) { const io_wait_ret ret = io_wait(pair, mytime_get_flush_timeout(), true); switch (ret) { case IO_WAIT_MORE: continue; case IO_WAIT_ERROR: return SIZE_MAX; case IO_WAIT_TIMEOUT: return size - left; default: message_bug(); } } #endif message_error(_("%s: Read error: %s"), pair->src_name, strerror(errno)); return SIZE_MAX; } buf += (size_t)(amount); left -= (size_t)(amount); } return size - left; } extern bool io_pread(file_pair *pair, io_buf *buf, size_t size, off_t pos) { // Using lseek() and read() is more portable than pread() and // for us it is as good as real pread(). if (lseek(pair->src_fd, pos, SEEK_SET) != pos) { message_error(_("%s: Error seeking the file: %s"), pair->src_name, strerror(errno)); return true; } const size_t amount = io_read(pair, buf, size); if (amount == SIZE_MAX) return true; if (amount != size) { message_error(_("%s: Unexpected end of file"), pair->src_name); return true; } return false; } static bool is_sparse(const io_buf *buf) { assert(IO_BUFFER_SIZE % sizeof(uint64_t) == 0); for (size_t i = 0; i < ARRAY_SIZE(buf->u64); ++i) if (buf->u64[i] != 0) return false; return true; } static bool io_write_buf(file_pair *pair, const uint8_t *buf, size_t size) { assert(size < SSIZE_MAX); while (size > 0) { const ssize_t amount = write(pair->dest_fd, buf, size); if (amount == -1) { if (errno == EINTR) { if (user_abort) return true; continue; } #ifndef TUKLIB_DOSLIKE if (errno == EAGAIN || errno == EWOULDBLOCK) { if (io_wait(pair, -1, false) == IO_WAIT_MORE) continue; return true; } #endif // Handle broken pipe specially. gzip and bzip2 // don't print anything on SIGPIPE. In addition, // gzip --quiet uses exit status 2 (warning) on // broken pipe instead of whatever raise(SIGPIPE) // would make it return. It is there to hide "Broken // pipe" message on some old shells (probably old // GNU bash). // // We don't do anything special with --quiet, which // is what bzip2 does too. If we get SIGPIPE, we // will handle it like other signals by setting // user_abort, and get EPIPE here. if (errno != EPIPE) message_error(_("%s: Write error: %s"), pair->dest_name, strerror(errno)); return true; } buf += (size_t)(amount); size -= (size_t)(amount); } return false; } extern bool io_write(file_pair *pair, const io_buf *buf, size_t size) { assert(size <= IO_BUFFER_SIZE); if (pair->dest_try_sparse) { // Check if the block is sparse (contains only zeros). If it // sparse, we just store the amount and return. We will take // care of actually skipping over the hole when we hit the // next data block or close the file. // // Since io_close() requires that dest_pending_sparse > 0 // if the file ends with sparse block, we must also return // if size == 0 to avoid doing the lseek(). if (size == IO_BUFFER_SIZE) { if (is_sparse(buf)) { pair->dest_pending_sparse += size; return false; } } else if (size == 0) { return false; } // This is not a sparse block. If we have a pending hole, // skip it now. if (pair->dest_pending_sparse > 0) { if (lseek(pair->dest_fd, pair->dest_pending_sparse, SEEK_CUR) == -1) { message_error(_("%s: Seeking failed when " "trying to create a sparse " "file: %s"), pair->dest_name, strerror(errno)); return true; } pair->dest_pending_sparse = 0; } } return io_write_buf(pair, buf->u8, size); }
evaautomation/xz
src/xz/file_io.c
C
gpl-3.0
34,408
// SPDX-License-Identifier: GPL-3.0-or-later #include "plugin_proc.h" #define PLUGIN_PROC_MODULE_INTERRUPTS_NAME "/proc/interrupts" #define CONFIG_SECTION_PLUGIN_PROC_INTERRUPTS "plugin:" PLUGIN_PROC_CONFIG_NAME ":" PLUGIN_PROC_MODULE_INTERRUPTS_NAME #define MAX_INTERRUPT_NAME 50 struct cpu_interrupt { unsigned long long value; RRDDIM *rd; }; struct interrupt { int used; char *id; char name[MAX_INTERRUPT_NAME + 1]; RRDDIM *rd; unsigned long long total; struct cpu_interrupt cpu[]; }; // since each interrupt is variable in size // we use this to calculate its record size #define recordsize(cpus) (sizeof(struct interrupt) + ((cpus) * sizeof(struct cpu_interrupt))) // given a base, get a pointer to each record #define irrindex(base, line, cpus) ((struct interrupt *)&((char *)(base))[(line) * recordsize(cpus)]) static inline struct interrupt *get_interrupts_array(size_t lines, int cpus) { static struct interrupt *irrs = NULL; static size_t allocated = 0; if(unlikely(lines != allocated)) { size_t l; int c; irrs = (struct interrupt *)reallocz(irrs, lines * recordsize(cpus)); // reset all interrupt RRDDIM pointers as any line could have shifted for(l = 0; l < lines ;l++) { struct interrupt *irr = irrindex(irrs, l, cpus); irr->rd = NULL; irr->name[0] = '\0'; for(c = 0; c < cpus ;c++) irr->cpu[c].rd = NULL; } allocated = lines; } return irrs; } int do_proc_interrupts(int update_every, usec_t dt) { (void)dt; static procfile *ff = NULL; static int cpus = -1, do_per_core = CONFIG_BOOLEAN_INVALID; struct interrupt *irrs = NULL; if(unlikely(do_per_core == CONFIG_BOOLEAN_INVALID)) do_per_core = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_INTERRUPTS, "interrupts per core", CONFIG_BOOLEAN_AUTO); if(unlikely(!ff)) { char filename[FILENAME_MAX + 1]; snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/interrupts"); ff = procfile_open(config_get(CONFIG_SECTION_PLUGIN_PROC_INTERRUPTS, "filename to monitor", filename), " \t", PROCFILE_FLAG_DEFAULT); } if(unlikely(!ff)) return 1; ff = procfile_readall(ff); if(unlikely(!ff)) return 0; // we return 0, so that we will retry to open it next time size_t lines = procfile_lines(ff), l; size_t words = procfile_linewords(ff, 0); if(unlikely(!lines)) { error("Cannot read /proc/interrupts, zero lines reported."); return 1; } // find how many CPUs are there if(unlikely(cpus == -1)) { uint32_t w; cpus = 0; for(w = 0; w < words ; w++) { if(likely(strncmp(procfile_lineword(ff, 0, w), "CPU", 3) == 0)) cpus++; } } if(unlikely(!cpus)) { error("PLUGIN: PROC_INTERRUPTS: Cannot find the number of CPUs in /proc/interrupts"); return 1; } // allocate the size we need; irrs = get_interrupts_array(lines, cpus); irrs[0].used = 0; // loop through all lines for(l = 1; l < lines ;l++) { struct interrupt *irr = irrindex(irrs, l, cpus); irr->used = 0; irr->total = 0; words = procfile_linewords(ff, l); if(unlikely(!words)) continue; irr->id = procfile_lineword(ff, l, 0); if(unlikely(!irr->id || !irr->id[0])) continue; size_t idlen = strlen(irr->id); if(irr->id[idlen - 1] == ':') irr->id[--idlen] = '\0'; int c; for(c = 0; c < cpus ;c++) { if(likely((c + 1) < (int)words)) irr->cpu[c].value = str2ull(procfile_lineword(ff, l, (uint32_t)(c + 1))); else irr->cpu[c].value = 0; irr->total += irr->cpu[c].value; } if(unlikely(isdigit(irr->id[0]) && (uint32_t)(cpus + 2) < words)) { strncpyz(irr->name, procfile_lineword(ff, l, words - 1), MAX_INTERRUPT_NAME); size_t nlen = strlen(irr->name); if(likely(nlen + 1 + idlen <= MAX_INTERRUPT_NAME)) { irr->name[nlen] = '_'; strncpyz(&irr->name[nlen + 1], irr->id, MAX_INTERRUPT_NAME - nlen - 1); } else { irr->name[MAX_INTERRUPT_NAME - idlen - 1] = '_'; strncpyz(&irr->name[MAX_INTERRUPT_NAME - idlen], irr->id, idlen); } } else { strncpyz(irr->name, irr->id, MAX_INTERRUPT_NAME); } irr->used = 1; } // -------------------------------------------------------------------- static RRDSET *st_system_interrupts = NULL; if(unlikely(!st_system_interrupts)) st_system_interrupts = rrdset_create_localhost( "system" , "interrupts" , NULL , "interrupts" , NULL , "System interrupts" , "interrupts/s" , PLUGIN_PROC_NAME , PLUGIN_PROC_MODULE_INTERRUPTS_NAME , NETDATA_CHART_PRIO_SYSTEM_INTERRUPTS , update_every , RRDSET_TYPE_STACKED ); else rrdset_next(st_system_interrupts); for(l = 0; l < lines ;l++) { struct interrupt *irr = irrindex(irrs, l, cpus); if(irr->used && irr->total) { // some interrupt may have changed without changing the total number of lines // if the same number of interrupts have been added and removed between two // calls of this function. if(unlikely(!irr->rd || strncmp(irr->rd->name, irr->name, MAX_INTERRUPT_NAME) != 0)) { irr->rd = rrddim_add(st_system_interrupts, irr->id, irr->name, 1, 1, RRD_ALGORITHM_INCREMENTAL); rrddim_set_name(st_system_interrupts, irr->rd, irr->name); // also reset per cpu RRDDIMs to avoid repeating strncmp() in the per core loop if(likely(do_per_core != CONFIG_BOOLEAN_NO)) { int c; for(c = 0; c < cpus; c++) irr->cpu[c].rd = NULL; } } rrddim_set_by_pointer(st_system_interrupts, irr->rd, irr->total); } } rrdset_done(st_system_interrupts); // -------------------------------------------------------------------- if(likely(do_per_core != CONFIG_BOOLEAN_NO)) { static RRDSET **core_st = NULL; static int old_cpus = 0; if(old_cpus < cpus) { core_st = reallocz(core_st, sizeof(RRDSET *) * cpus); memset(&core_st[old_cpus], 0, sizeof(RRDSET *) * (cpus - old_cpus)); old_cpus = cpus; } int c; for(c = 0; c < cpus ;c++) { if(unlikely(!core_st[c])) { char id[50+1]; snprintfz(id, 50, "cpu%d_interrupts", c); char title[100+1]; snprintfz(title, 100, "CPU%d Interrupts", c); core_st[c] = rrdset_create_localhost( "cpu" , id , NULL , "interrupts" , "cpu.interrupts" , title , "interrupts/s" , PLUGIN_PROC_NAME , PLUGIN_PROC_MODULE_INTERRUPTS_NAME , NETDATA_CHART_PRIO_INTERRUPTS_PER_CORE + c , update_every , RRDSET_TYPE_STACKED ); } else rrdset_next(core_st[c]); for(l = 0; l < lines ;l++) { struct interrupt *irr = irrindex(irrs, l, cpus); if(irr->used && (do_per_core == CONFIG_BOOLEAN_YES || irr->cpu[c].value)) { if(unlikely(!irr->cpu[c].rd)) { irr->cpu[c].rd = rrddim_add(core_st[c], irr->id, irr->name, 1, 1, RRD_ALGORITHM_INCREMENTAL); rrddim_set_name(core_st[c], irr->cpu[c].rd, irr->name); } rrddim_set_by_pointer(core_st[c], irr->cpu[c].rd, irr->cpu[c].value); } } rrdset_done(core_st[c]); } } return 0; }
3cky/netdata
collectors/proc.plugin/proc_interrupts.c
C
gpl-3.0
8,387
#ifndef STRTAG_H #define STRTAG_H /* When a struct use a struct-tag, it doesn't allocate memory */ struct strtag { unsigned int year; unsigned int month; unsigned int dat; }; #endif /* Within a .c file we can include this file: #include "strtag.h" */ /* A good way to create a new type is: typedef struct strtag NewType; Then we can declare a new struct data type with: NewType data; Now the memory will be allocated. */
b3h3moth/L-LP
src/C/C_lang/structures_and_unions/strtag.h
C
gpl-3.0
440
#!/usr/bin/perl # Test misc. # Copyright (C) 2017-2022 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. use strict; use File::stat; (my $program_name = $0) =~ s|.*/||; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; my $prog = 'sed'; print "PATH = $ENV{PATH}\n"; my @Tests = ( ['empty', qw(-e ''), {IN=>''}, {OUT=>''}], ['empty2', q('s/^ *//'), {IN=>"x\n\n"}, {OUT=>"x\n\n"}], ['head', qw(3q), {IN=>"1\n2\n3\n4\n"}, {OUT=>"1\n2\n3\n"}], ['space', q('s/_\S/XX/g;s/\s/_/g'), {IN=> "Hello World\t!\nSecond_line_ of tests\n" }, {OUT=> "Hello_World_!\nSecondXXine__of_tests\n" }], ['zero-anchor', qw(-z), q('N;N;s/^/X/g;s/^/X/mg;s/$/Y/g;s/$/Y/mg'), {IN=>"a\0b\0c\0" }, {OUT=>"XXaY\0XbY\0XcYY\0" }], ['case-insensitive', qw(-n), q('h;s/Version: *//p;g;s/version: *//Ip'), {IN=>"Version: 1.2.3\n" }, {OUT=>"1.2.3\n1.2.3\n" }, ], ['preserve-missing-EOL-at-EOF', q('s/$/x/'), {IN=> "a\nb" }, {OUT=>"ax\nbx" }, ], ['y-bracket', q('y/[/ /'), {IN => "Are you sure (y/n)? [y]\n" }, {OUT=> "Are you sure (y/n)? y]\n" }, ], ['y-zero', q('y/b/\x00/'), {IN => "abc\n" }, {OUT=> "a\0c\n" }, ], ['y-newline', q('H G y/Ss\nYy/yY$sS/'), {IN => "Are you sure (y/n)? [y]\n" }, {OUT=> 'Are Sou Yure (S/n)? [S]$$Are Sou Yure (S/n)? [S]'."\n"}, ], ['allsub', q('s/foo/bar/g'), {IN => "foo foo fo oo f oo foo foo foo foo foo foo foo foo foo\n"}, {OUT=> "bar bar fo oo f oo bar bar bar bar bar bar bar bar bar\n"}, ], ['insert-nl', qw(-f), {IN => "/foo/i\\\n"}, {IN => "bar\nfoo\n" }, {OUT=> "bar\n\nfoo\n" }, ], ['recall', # Check that the empty regex recalls the last *executed* regex, # not the last *compiled* regex qw(-f), {IN => "p;s/e/X/p;:x;s//Y/p;/f/bx"}, {IN => "eeefff\n" }, {OUT=> "eeefff\n" . "Xeefff\n" . "XYefff\n" . "XYeYff\n" . "XYeYYf\n" . "XYeYYY\n" . "XYeYYY\n" }, ], ['recall2', # Starting from sed 4.1.3, regexes are compiled with REG_NOSUB # if they are used in an address, so that the matcher does not # have to obey leftmost-longest. The tricky part is to recompile # them if they are then used in a substitution. qw(-f), {IN => '/\(ab*\)\+/ s//>\1</g'}, {IN => "ababb||abbbabbbb\n" }, {OUT=> ">abb<||>abbbb<\n" }, ], ['0range', # Test address 0 (GNU extension) # FIXME: This test does NOT actually fail if the address is changed to 1. qw(-e '0,/aaa/d'), {IN => "1\n" . "2\n" . "3\n" . "4\n" . "aaa\n" . "yes\n"}, {OUT => "yes\n"} ], ['amp-escape', # Test ampersand as escape sequence (ASCII 0x26), which should # not have a special meaning (i.e. the 'matched pattern') qw(-e 's/yes/yes\x26/'), {IN => "yes\n"}, {OUT => "yes&\n"} ], ['appquit', # Test 'a'ppend command before 'q'uit qw(-f), {IN => q(a\ ok q)}, {IN => "doh\n"}, {OUT => "doh\n" . "ok\n"} ], ['brackets', qw(-f), {IN => q(s/[[]/a/ s/[[[]/b/ s/[[[[]/c/ s/[[[[[]/d/ s/[[[[[[]/e/ s/[[[[[[[]/f/ s/[[[[[[[[]/g/ s/[[[[[[[[[]/h/ )}, {IN => "[[[[[[[[[\n"}, {OUT => "abcdefgh[\n"} ], ['bkslashes', # Test backslashes in regex # bug in sed 4.0b qw(-f), {IN => q(s/$/\\\\\ / )}, {IN => "a\n"}, {OUT => "a\\\n" . "\n"} ], ['classes', # inspired by an autoconf generated configure script. qw(-n -f), {IN => 's/^\([/[:lower:]A-Z0-9]*_cv_[[:lower:][:upper:]/[:digit:]]*\)'. '=\(.*\)/: \${\1=\'\2\'}/p'}, {IN => "_cv_=emptyvar\n" . "ac_cv_prog/RANLIB=/usr/bin/ranlib\n" . "ac_cv_prog/CC=/usr/unsupported/\\ \\ /lib/_cv_/cc\n" . "a/c_cv_prog/CPP=/usr/bin/cpp\n" . "SHELL=bash\n" . "GNU=GNU!UNIX\n"}, {OUT => ": \${_cv_='emptyvar'}\n" . ": \${ac_cv_prog/RANLIB='/usr/bin/ranlib'}\n" . ": \${ac_cv_prog/CC='/usr/unsupported/\\ \\ /lib/_cv_/cc'}\n" . ": \${a/c_cv_prog/CPP='/usr/bin/cpp'}\n"} ], ['cv-vars', # inspired by an autoconf generated configure script. qw(-n -f), {IN => q|s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p|}, {IN => "_cv_=emptyvar\n" . "ac_cv_prog_RANLIB=/usr/bin/ranlib\n" . "ac_cv_prog_CC=/usr/unsupported/\ \ /lib/_cv_/cc\n" . "ac_cv_prog_CPP=/usr/bin/cpp\n" . "SHELL=bash\n" . "GNU=GNU!UNIX\n"}, {OUT => ": \${_cv_='emptyvar'}\n" . ": \${ac_cv_prog_RANLIB='/usr/bin/ranlib'}\n" . ": \${ac_cv_prog_CC='/usr/unsupported/\ \ /lib/_cv_/cc'}\n" . ": \${ac_cv_prog_CPP='/usr/bin/cpp'}\n"} ], ['quiet', # the old 'quiet' test: --quiet instead of -n qw(--quiet -f), {IN => q|s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p|}, {IN => "_cv_=emptyvar\n" . "ac_cv_prog_RANLIB=/usr/bin/ranlib\n" . "ac_cv_prog_CC=/usr/unsupported/\ \ /lib/_cv_/cc\n" . "ac_cv_prog_CPP=/usr/bin/cpp\n" . "SHELL=bash\n" . "GNU=GNU!UNIX\n"}, {OUT => ": \${_cv_='emptyvar'}\n" . ": \${ac_cv_prog_RANLIB='/usr/bin/ranlib'}\n" . ": \${ac_cv_prog_CC='/usr/unsupported/\ \ /lib/_cv_/cc'}\n" . ": \${ac_cv_prog_CPP='/usr/bin/cpp'}\n"} ], ['file', # the old 'file' test: --file instead of -f qw(-n --file), {IN => q|s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p|}, {IN => "_cv_=emptyvar\n" . "ac_cv_prog_RANLIB=/usr/bin/ranlib\n" . "ac_cv_prog_CC=/usr/unsupported/\ \ /lib/_cv_/cc\n" . "ac_cv_prog_CPP=/usr/bin/cpp\n" . "SHELL=bash\n" . "GNU=GNU!UNIX\n"}, {OUT => ": \${_cv_='emptyvar'}\n" . ": \${ac_cv_prog_RANLIB='/usr/bin/ranlib'}\n" . ": \${ac_cv_prog_CC='/usr/unsupported/\ \ /lib/_cv_/cc'}\n" . ": \${ac_cv_prog_CPP='/usr/bin/cpp'}\n"} ], ['dollar', # Test replacement on the last line (address '$') qw(-e '$s/^/space /'), {IN => "I can't quite remember where I heard it,\n" . "but I can't seem to get out of my head\n" . "the phrase\n" . "the final frontier\n"}, {OUT => "I can't quite remember where I heard it,\n" . "but I can't seem to get out of my head\n" . "the phrase\n" . "space the final frontier\n"} ], ['enable', # inspired by an autoconf generated configure script. qw(-e 's/-*enable-//;s/=.*//'), {IN => "--enable-targets=sparc-sun-sunos4.1.3,srec\n" . "--enable-x11-testing=on\n" . "--enable-wollybears-in-minnesota=yes-id-like-that\n"}, {OUT => "targets\n" . "x11-testing\n" . "wollybears-in-minnesota\n"} ], ['fasts', # test `fast' substitutions qw(-f), {IN => q( h s/a// p g s/a//g p g s/^a//p g s/^a//g p g s/not present//g p g s/^[a-z]//g p g s/a$// p g y/a/b/ h s/b// p g s/b//g p g s/^b//p g s/^b//g p g s/^[a-z]//g p g s/b$// p g )}, {IN => "aaaaaaabbbbbbaaaaaaa\n"}, {OUT => "aaaaaabbbbbbaaaaaaa\n" . "bbbbbb\n" . "aaaaaabbbbbbaaaaaaa\n" . "aaaaaabbbbbbaaaaaaa\n" . "aaaaaaabbbbbbaaaaaaa\n" . "aaaaaabbbbbbaaaaaaa\n" . "aaaaaaabbbbbbaaaaaa\n" . "bbbbbbbbbbbbbbbbbbb\n" . "\n" . "bbbbbbbbbbbbbbbbbbb\n" . "bbbbbbbbbbbbbbbbbbb\n" . "bbbbbbbbbbbbbbbbbbb\n" . "bbbbbbbbbbbbbbbbbbb\n" . "bbbbbbbbbbbbbbbbbbbb\n"} ], ['factor', # Compute a few common factors for speed. Clear the subst flag # These are placed here to make the flow harder to understand :-) # The quotient of dividing by 11 is a limit to the remaining prime factors # Pattern space looks like CANDIDATE\nNUMBER. When a candidate is valid, # the number is divided and the candidate is tried again # We have a prime factor in CANDIDATE! Print it # If NUMBER = 1, we don't have any more factors qw(-n -f), {IN => q~ s/.*/&;9aaaaaaaaa8aaaaaaaa7aaaaaaa6aaaaaa5aaaaa4aaaa3aaa2aa1a0/ :encode s/\(a*\)\([0-9]\)\([0-9]*;.*\2\(a*\)\)/\1\1\1\1\1\1\1\1\1\1\4\3/ tencode s/;.*// t7a :2 a\ 2 b2a :3 a\ 3 b3a :5 a\ 5 b5a :7 a\ 7 :7a s/^\(aa*\)\1\{6\}$/\1/ t7 :5a s/^\(aa*\)\1\{4\}$/\1/ t5 :3a s/^\(aa*\)\1\1$/\1/ t3 :2a s/^\(aa*\)\1$/\1/ t2 /^a$/b s/^\(aa*\)\1\{10\}/\1=&/ :factor /^\(a\{7,\}\)=\1\1*$/! { # Decrement CANDIDATE, and search again if it is still >1 s/^a// /^aa/b factor # Print the last remaining factor: since it is stored in the NUMBER # rather than in the CANDIDATE, swap 'em: now NUMBER=1 s/\(.*\)=\(.*\)/\2=\1/ } h s/=.*/;;0a1aa2aaa3aaaa4aaaaa5aaaaaa6aaaaaaa7aaaaaaaa8aaaaaaaaa9/ :decode s/^\(a*\)\1\{9\}\(a\{0,9\}\)\([0-9]*;.*[^a]\2\([0-9]\)\)/\1\4\3/ /^a/tdecode s/;.*//p g :divide s/^\(a*\)\(=b*\)\1/\1\2b/ tdivide y/b/a/ /aa$/bfactor ~}, {IN => "2\n" . "3\n" . "4\n" . "5\n" . "8\n" . "11\n" . "16\n" . "143\n"}, {OUT => "2\n" . "3\n" . "2\n" . "2\n" . "5\n" . "2\n" . "2\n" . "2\n" . "11\n" . "2\n" . "2\n" . "2\n" . "2\n" . "13\n" . "11\n"} ], ['flipcase', qw(-f), {IN => q|s,\([^A-Za-z]*\)\([A-Za-z]*\),\1\L\u\2,g|}, {IN => "09 - 02 - 2002 00.00 Tg La7 La7 -\n" . "09 - 02 - 2002 00.00 Brand New Tmc 2 -\n" . "09 - 02 - 2002 00.10 Tg1 Notte Rai Uno -\n" . "09 - 02 - 2002 00.15 Tg Parlamento Rai Due -\n" . "09 - 02 - 2002 00.15 Kung Fu - La Leggenda Continua La7 -\n" . "09 - 02 - 2002 00.20 Berserk - La CoNFESSIONE Di Gatz" . " Italia 1 Cartoon\n" . "09 - 02 - 2002 00.20 Tg3 - Tg3 Meteo Rai TrE -\n" . "09 - 02 - 2002 00.25 Meteo 2 Rai Due -\n" . "09 - 02 - 2002 00.30 Appuntamento Al CinEMA RaI Due -\n" . "09 - 02 - 2002 00.30 Rai Educational - Mediamente Rai Tre -\n" . "09 - 02 - 2002 00.35 Profiler Rai Due -\n" . "09 - 02 - 2002 00.35 Stampa OggI - Che Tempo Fa Rai Uno -\n" . "09 - 02 - 2002 00.45 Rai Educational - Babele: Euro Rai Uno -\n" . "09 - 02 - 2002 00.45 BollettINO Della NEVE RETE 4 News\n" . "09 - 02 - 2002 00.50 STUDIO Aperto - La Giornata Italia 1 News\n" . "09 - 02 - 2002 00.50 BOCCA A Bocca - 2 Tempo Rete 4 Film\n" . "09 - 02 - 2002 01.00 AppuntAMENTO Al Cinema Rai Tre -\n" . "09 - 02 - 2002 01.00 Music NoN Stop Tmc 2 -\n" . "09 - 02 - 2002 01.00 Studio SpORT Italia 1 SporT\n" . "09 - 02 - 2002 01.00 Tg 5 - Notte Canale 5 News\n" . "09 - 02 - 2002 01.05 Fuori Orario. CosE (Mai) Viste Rai Tre -\n" . "09 - 02 - 2002 01.15 RAINOTTE Rai Due -\n" . "09 - 02 - 2002 01.15 Sottovoce Rai Uno -\n" . "09 - 02 - 2002 01.15 GiOCHI Olimpici InVERNALI - CERIMONIA" . " Di Apertura Rai Tre -\n" . "09 - 02 - 2002 01.17 Italia Interroga Rai Due -\n"}, {OUT => "09 - 02 - 2002 00.00 Tg La7 La7 -\n" . "09 - 02 - 2002 00.00 Brand New Tmc 2 -\n" . "09 - 02 - 2002 00.10 Tg1 Notte Rai Uno -\n" . "09 - 02 - 2002 00.15 Tg Parlamento Rai Due -\n" . "09 - 02 - 2002 00.15 Kung Fu - La Leggenda Continua La7 -\n" . "09 - 02 - 2002 00.20 Berserk - La Confessione Di Gatz" . " Italia 1 Cartoon\n" . "09 - 02 - 2002 00.20 Tg3 - Tg3 Meteo Rai Tre -\n" . "09 - 02 - 2002 00.25 Meteo 2 Rai Due -\n" . "09 - 02 - 2002 00.30 Appuntamento Al Cinema Rai Due -\n" . "09 - 02 - 2002 00.30 Rai Educational - Mediamente Rai Tre -\n" . "09 - 02 - 2002 00.35 Profiler Rai Due -\n" . "09 - 02 - 2002 00.35 Stampa Oggi - Che Tempo Fa Rai Uno -\n" . "09 - 02 - 2002 00.45 Rai Educational - Babele: Euro Rai Uno -\n" . "09 - 02 - 2002 00.45 Bollettino Della Neve Rete 4 News\n" . "09 - 02 - 2002 00.50 Studio Aperto - La Giornata Italia 1 News\n" . "09 - 02 - 2002 00.50 Bocca A Bocca - 2 Tempo Rete 4 Film\n" . "09 - 02 - 2002 01.00 Appuntamento Al Cinema Rai Tre -\n" . "09 - 02 - 2002 01.00 Music Non Stop Tmc 2 -\n" . "09 - 02 - 2002 01.00 Studio Sport Italia 1 Sport\n" . "09 - 02 - 2002 01.00 Tg 5 - Notte Canale 5 News\n" . "09 - 02 - 2002 01.05 Fuori Orario. Cose (Mai) Viste Rai Tre -\n" . "09 - 02 - 2002 01.15 Rainotte Rai Due -\n" . "09 - 02 - 2002 01.15 Sottovoce Rai Uno -\n" . "09 - 02 - 2002 01.15 Giochi Olimpici Invernali - Cerimonia" . " Di Apertura Rai Tre -\n" . "09 - 02 - 2002 01.17 Italia Interroga Rai Due -\n"} ], ['inclib', # inspired by an autoconf generated configure script. qw(-e 's;lib;include;'), {IN => " /usr/X11R6/lib\n" . " /usr/X11R5/lib\n" . " /usr/X11R4/lib\n" . "\n" . " /usr/lib/X11R6\n" . " /usr/lib/X11R5\n" . " /usr/lib/X11R4\n" . "\n" . " /usr/local/X11R6/lib\n" . " /usr/local/X11R5/lib\n" . " /usr/local/X11R4/lib\n" . "\n" . " /usr/local/lib/X11R6\n" . " /usr/local/lib/X11R5\n" . " /usr/local/lib/X11R4\n" . "\n" . " /usr/X11/lib\n" . " /usr/lib/X11\n" . " /usr/local/X11/lib\n" . " /usr/local/lib/X11\n" . "\n" . " /usr/X386/lib\n" . " /usr/x386/lib\n" . " /usr/XFree86/lib/X11\n" . "\n" . " /usr/lib\n" . " /usr/local/lib\n" . " /usr/unsupported/lib\n" . " /usr/athena/lib\n" . " /usr/local/x11r5/lib\n" . " /usr/lpp/Xamples/lib\n" . "\n" . " /usr/openwin/lib\n" . " /usr/openwin/share/lib\n"}, {OUT => " /usr/X11R6/include\n" . " /usr/X11R5/include\n" . " /usr/X11R4/include\n" . "\n" . " /usr/include/X11R6\n" . " /usr/include/X11R5\n" . " /usr/include/X11R4\n" . "\n" . " /usr/local/X11R6/include\n" . " /usr/local/X11R5/include\n" . " /usr/local/X11R4/include\n" . "\n" . " /usr/local/include/X11R6\n" . " /usr/local/include/X11R5\n" . " /usr/local/include/X11R4\n" . "\n" . " /usr/X11/include\n" . " /usr/include/X11\n" . " /usr/local/X11/include\n" . " /usr/local/include/X11\n" . "\n" . " /usr/X386/include\n" . " /usr/x386/include\n" . " /usr/XFree86/include/X11\n" . "\n" . " /usr/include\n" . " /usr/local/include\n" . " /usr/unsupported/include\n" . " /usr/athena/include\n" . " /usr/local/x11r5/include\n" . " /usr/lpp/Xamples/include\n" . "\n" . " /usr/openwin/include\n" . " /usr/openwin/share/include\n"} ], ['khadafy', # The Khadafy test is brought to you by Scott Anderson . . . qw(-f), {IN => '/M[ou]\'\{0,1\}am\{1,2\}[ae]r' . ' .*' . '\([AEae]l[- ]\)\{0,1\}' . '[GKQ]h\{0,1\}[aeu]\{1,\}\([dtz][dhz]\{0,1\}\)\{1,\}af[iy]/!d'}, {IN => "1) Muammar Qaddafi\n" . "2) Mo'ammar Gadhafi\n" . "3) Muammar Kaddafi\n" . "4) Muammar Qadhafi\n" . "5) Moammar El Kadhafi\n" . "6) Muammar Gadafi\n" . "7) Mu'ammar al-Qadafi\n" . "8) Moamer El Kazzafi\n" . "9) Moamar al-Gaddafi\n" . "10) Mu'ammar Al Qathafi\n" . "11) Muammar Al Qathafi\n" . "12) Mo'ammar el-Gadhafi\n" . "13) Moamar El Kadhafi\n" . "14) Muammar al-Qadhafi\n" . "15) Mu'ammar al-Qadhdhafi\n" . "16) Mu'ammar Qadafi\n" . "17) Moamar Gaddafi\n" . "18) Mu'ammar Qadhdhafi\n" . "19) Muammar Khaddafi\n" . "20) Muammar al-Khaddafi\n" . "21) Mu'amar al-Kadafi\n" . "22) Muammar Ghaddafy\n" . "23) Muammar Ghadafi\n" . "24) Muammar Ghaddafi\n" . "25) Muamar Kaddafi\n" . "26) Muammar Quathafi\n" . "27) Muammar Gheddafi\n" . "28) Muamar Al-Kaddafi\n" . "29) Moammar Khadafy\n" . "30) Moammar Qudhafi\n" . "31) Mu'ammar al-Qaddafi\n" . "32) Mulazim Awwal Mu'ammar Muhammad Abu Minyar al-Qadhafi\n"}, {OUT => "1) Muammar Qaddafi\n" . "2) Mo'ammar Gadhafi\n" . "3) Muammar Kaddafi\n" . "4) Muammar Qadhafi\n" . "5) Moammar El Kadhafi\n" . "6) Muammar Gadafi\n" . "7) Mu'ammar al-Qadafi\n" . "8) Moamer El Kazzafi\n" . "9) Moamar al-Gaddafi\n" . "10) Mu'ammar Al Qathafi\n" . "11) Muammar Al Qathafi\n" . "12) Mo'ammar el-Gadhafi\n" . "13) Moamar El Kadhafi\n" . "14) Muammar al-Qadhafi\n" . "15) Mu'ammar al-Qadhdhafi\n" . "16) Mu'ammar Qadafi\n" . "17) Moamar Gaddafi\n" . "18) Mu'ammar Qadhdhafi\n" . "19) Muammar Khaddafi\n" . "20) Muammar al-Khaddafi\n" . "21) Mu'amar al-Kadafi\n" . "22) Muammar Ghaddafy\n" . "23) Muammar Ghadafi\n" . "24) Muammar Ghaddafi\n" . "25) Muamar Kaddafi\n" . "26) Muammar Quathafi\n" . "27) Muammar Gheddafi\n" . "28) Muamar Al-Kaddafi\n" . "29) Moammar Khadafy\n" . "30) Moammar Qudhafi\n" . "31) Mu'ammar al-Qaddafi\n" . "32) Mulazim Awwal Mu'ammar Muhammad Abu Minyar al-Qadhafi\n"} ], ['linecnt', qw(-e '='), {IN => "A dialogue on poverty\n" . "\n" . " On the night when the rain beats,\n" . " Driven by the wind,\n" . " On the night when the snowflakes mingle\n" . " With a sleety rain,\n" . " I feel so helplessly cold.\n" . " I nibble at a lump of salt,\n" . " Sip the hot, oft-diluted dregs of _sake_;\n" . " And coughing, snuffling,\n" . " And stroking my scanty beard,\n" . " I say in my pride,\n" . " \"There's none worthy, save I!\"\n" . " But I shiver still with cold.\n" . " I pull up my hempen bedclothes,\n" . " Wear what few sleeveless clothes I have,\n" . " But cold and bitter is the night!\n" . " As for those poorer than myself,\n" . " Their parents must be cold and hungry,\n" . " Their wives and children beg and cry.\n" . " Then, how do you struggle through life?\n" . "\n" . " Wide as they call the heaven and earth,\n" . " For me they have shrunk quite small;\n" . " Bright though they call the sun and moon,\n" . " They never shine for me.\n" . " Is it the same with all men,\n" . " Or for me alone?\n" . " By rare chance I was born a man\n" . " And no meaner than my fellows,\n" . " But, wearing unwadded sleeveless clothes\n" . " In tatters, like weeds waving in the sea,\n" . " Hanging from my shoulders,\n" . " And under the sunken roof,\n" . " Within the leaning walls,\n" . " Here I lie on straw\n" . " Spread on bare earth,\n" . " With my parents at my pillow,\n" . " And my wife and children at my feet,\n" . " All huddled in grief and tears.\n" . " No fire sends up smoke\n" . " At the cooking-place,\n" . " And in the cauldron\n" . " A spider spins its web.\n" . " With not a grain to cook,\n" . " We moan like the night thrush.\n" . " Then, \"to cut,\" as the saying is,\n" . " \"The ends of what is already too short,\"\n" . " The village headman comes,\n" . " With rod in hand, to our sleeping place,\n" . " Growling for his dues.\n" . " Must it be so hopeless --\n" . " The way of this world?\n" . "\n" . " -- Yamanoue Okura\n"}, {OUT => "1\n" . "A dialogue on poverty\n" . "2\n" . "\n" . "3\n" . " On the night when the rain beats,\n" . "4\n" . " Driven by the wind,\n" . "5\n" . " On the night when the snowflakes mingle\n" . "6\n" . " With a sleety rain,\n" . "7\n" . " I feel so helplessly cold.\n" . "8\n" . " I nibble at a lump of salt,\n" . "9\n" . " Sip the hot, oft-diluted dregs of _sake_;\n" . "10\n" . " And coughing, snuffling,\n" . "11\n" . " And stroking my scanty beard,\n" . "12\n" . " I say in my pride,\n" . "13\n" . " \"There's none worthy, save I!\"\n" . "14\n" . " But I shiver still with cold.\n" . "15\n" . " I pull up my hempen bedclothes,\n" . "16\n" . " Wear what few sleeveless clothes I have,\n" . "17\n" . " But cold and bitter is the night!\n" . "18\n" . " As for those poorer than myself,\n" . "19\n" . " Their parents must be cold and hungry,\n" . "20\n" . " Their wives and children beg and cry.\n" . "21\n" . " Then, how do you struggle through life?\n" . "22\n" . "\n" . "23\n" . " Wide as they call the heaven and earth,\n" . "24\n" . " For me they have shrunk quite small;\n" . "25\n" . " Bright though they call the sun and moon,\n" . "26\n" . " They never shine for me.\n" . "27\n" . " Is it the same with all men,\n" . "28\n" . " Or for me alone?\n" . "29\n" . " By rare chance I was born a man\n" . "30\n" . " And no meaner than my fellows,\n" . "31\n" . " But, wearing unwadded sleeveless clothes\n" . "32\n" . " In tatters, like weeds waving in the sea,\n" . "33\n" . " Hanging from my shoulders,\n" . "34\n" . " And under the sunken roof,\n" . "35\n" . " Within the leaning walls,\n" . "36\n" . " Here I lie on straw\n" . "37\n" . " Spread on bare earth,\n" . "38\n" . " With my parents at my pillow,\n" . "39\n" . " And my wife and children at my feet,\n" . "40\n" . " All huddled in grief and tears.\n" . "41\n" . " No fire sends up smoke\n" . "42\n" . " At the cooking-place,\n" . "43\n" . " And in the cauldron\n" . "44\n" . " A spider spins its web.\n" . "45\n" . " With not a grain to cook,\n" . "46\n" . " We moan like the night thrush.\n" . "47\n" . " Then, \"to cut,\" as the saying is,\n" . "48\n" . " \"The ends of what is already too short,\"\n" . "49\n" . " The village headman comes,\n" . "50\n" . " With rod in hand, to our sleeping place,\n" . "51\n" . " Growling for his dues.\n" . "52\n" . " Must it be so hopeless --\n" . "53\n" . " The way of this world?\n" . "54\n" . "\n" . "55\n" . " -- Yamanoue Okura\n"} ], ['manis', # straight out of an autoconf-generated configure. # The input should look just like the input after this is run. # # Protect against being on the right side of a sed subst in config.status. qw(-f), {IN => q(s/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; s/@@/%@/; s/@@/@%/; s/@g$/%g/ )}, {IN => "s\%\@CFLAGS\@\%\%g\n" . "s\%\@CPPFLAGS\@\%-I/\%g\n" . "s\%\@CXXFLAGS\@\%-x c++\%g\n" . "s\%\@DEFS\@\%\$DEFS\%g\n" . "s\%\@LDFLAGS\@\%-L/usr/lib\%g\n" . "s\%\@LIBS\@\%-lgnu -lbfd\%g\n" . "s\%\@exec_prefix\@\%\%g\n" . "s\%\@prefix\@\%\$prefix\%g\n" . "s\%\@RANLIB\@\%\$RANLIB\%g\n" . "s\%\@CC\@\%/usr/local/bin/gcc\%g\n" . "s\%\@CPP\@\%\$CPP\%g\n" . "s\%\@XCFLAGS\@\%\$XCFLAGS\%g\n" . "s\%\@XINCLUDES\@\%\$XINCLUDES\%g\n" . "s\%\@XLIBS\@\%\$XLIBS\%g\n" . "s\%\@XPROGS\@\%\$XPROGS\%g\n" . "s\%\@TCLHDIR\@\%\$TCLHDIR\%g\n" . "s\%\@TCLLIB\@\%\$TCLLIB\%g\n" . "s\%\@TKHDIR\@\%\$TKHDIR\%g\n" . "s\%\@TKLIB\@\%\$TKLIB\%g\n" . "s\%\@PTY_TYPE\@\%\$PTY_TYPE\%g\n" . "s\%\@EVENT_TYPE\@\%\$EVENT_TYPE\%g\n" . "s\%\@SETUID\@\%\$SETUID\%g\n"}, {OUT => "s\%\@CFLAGS\@\%\%g\n" . "s\%\@CPPFLAGS\@\%-I/\%g\n" . "s\%\@CXXFLAGS\@\%-x c++\%g\n" . "s\%\@DEFS\@\%\$DEFS\%g\n" . "s\%\@LDFLAGS\@\%-L/usr/lib\%g\n" . "s\%\@LIBS\@\%-lgnu -lbfd\%g\n" . "s\%\@exec_prefix\@\%\%g\n" . "s\%\@prefix\@\%\$prefix\%g\n" . "s\%\@RANLIB\@\%\$RANLIB\%g\n" . "s\%\@CC\@\%/usr/local/bin/gcc\%g\n" . "s\%\@CPP\@\%\$CPP\%g\n" . "s\%\@XCFLAGS\@\%\$XCFLAGS\%g\n" . "s\%\@XINCLUDES\@\%\$XINCLUDES\%g\n" . "s\%\@XLIBS\@\%\$XLIBS\%g\n" . "s\%\@XPROGS\@\%\$XPROGS\%g\n" . "s\%\@TCLHDIR\@\%\$TCLHDIR\%g\n" . "s\%\@TCLLIB\@\%\$TCLLIB\%g\n" . "s\%\@TKHDIR\@\%\$TKHDIR\%g\n" . "s\%\@TKLIB\@\%\$TKLIB\%g\n" . "s\%\@PTY_TYPE\@\%\$PTY_TYPE\%g\n" . "s\%\@EVENT_TYPE\@\%\$EVENT_TYPE\%g\n" . "s\%\@SETUID\@\%\$SETUID\%g\n"} ], ['modulo', qw(-e '0~2d;='), {IN => "s\%\@CFLAGS\@\%\%g\n" . "s\%\@CPPFLAGS\@\%-I/\%g\n" . "s\%\@CXXFLAGS\@\%-x c++\%g\n" . "s\%\@DEFS\@\%\$DEFS\%g\n" . "s\%\@LDFLAGS\@\%-L/usr/lib\%g\n" . "s\%\@LIBS\@\%-lgnu -lbfd\%g\n" . "s\%\@exec_prefix\@\%\%g\n" . "s\%\@prefix\@\%\$prefix\%g\n" . "s\%\@RANLIB\@\%\$RANLIB\%g\n" . "s\%\@CC\@\%/usr/local/bin/gcc\%g\n" . "s\%\@CPP\@\%\$CPP\%g\n" . "s\%\@XCFLAGS\@\%\$XCFLAGS\%g\n" . "s\%\@XINCLUDES\@\%\$XINCLUDES\%g\n" . "s\%\@XLIBS\@\%\$XLIBS\%g\n" . "s\%\@XPROGS\@\%\$XPROGS\%g\n" . "s\%\@TCLHDIR\@\%\$TCLHDIR\%g\n" . "s\%\@TCLLIB\@\%\$TCLLIB\%g\n" . "s\%\@TKHDIR\@\%\$TKHDIR\%g\n" . "s\%\@TKLIB\@\%\$TKLIB\%g\n" . "s\%\@PTY_TYPE\@\%\$PTY_TYPE\%g\n" . "s\%\@EVENT_TYPE\@\%\$EVENT_TYPE\%g\n" . "s\%\@SETUID\@\%\$SETUID\%g\n"}, {OUT => "1\n" . "s\%\@CFLAGS\@\%\%g\n" . "3\n" . "s\%\@CXXFLAGS\@\%-x c++\%g\n" . "5\n" . "s\%\@LDFLAGS\@\%-L/usr/lib\%g\n" . "7\n" . "s\%\@exec_prefix\@\%\%g\n" . "9\n" . "s\%\@RANLIB\@\%\$RANLIB\%g\n" . "11\n" . "s\%\@CPP\@\%\$CPP\%g\n" . "13\n" . "s\%\@XINCLUDES\@\%\$XINCLUDES\%g\n" . "15\n" . "s\%\@XPROGS\@\%\$XPROGS\%g\n" . "17\n" . "s\%\@TCLLIB\@\%\$TCLLIB\%g\n" . "19\n" . "s\%\@TKLIB\@\%\$TKLIB\%g\n" . "21\n" . "s\%\@EVENT_TYPE\@\%\$EVENT_TYPE\%g\n"} ], ['middle', qw(-n -e '3,5p'), {IN => q( "...by imposing a tiny bit of order in a communication you are translating, you are carving out a little bit of order in the universe. You will never succeed. Everything will fail and come to an end finally. But you have a chance to carve a little bit of order and maybe even beauty out of the raw materials that surround you everywhere, and I think there is no greater meaning in life." Donald L. Philippi, Oct 1930 - Jan 1993 )}, {OUT => q( universe. You will never succeed. Everything will fail and come to an end finally. But you have a chance to carve a little bit of order and maybe even beauty out of the raw materials that )} ], ['newline-anchor', qw(-f), {IN => q(N N s/^/X/g s/^/X/mg s/$/Y/g s/$/Y/mg )}, {IN => "a\n" . "b\n" . "c\n"}, {OUT => "XXaY\n" . "XbY\n" . "XcYY\n"} ], ['noeolw', qw(-n -f), # The sed program: # generates two output files (in addition to STDOUT) {IN => q(w noeolw.1out $ { x w noeolw.1out x } h 1,3w noeolw.2out p p )}, # The input file (was: noeolw.inp). # NOTE: in the old test, the input file was given twice. # here we specify two (identical) input files. {IN => "This file is unique\n" . "in that it does\n" . "end in a newline."}, {IN => "This file is unique\n" . "in that it does\n" . "end in a newline."}, # The expected STDOUT (was: noeolw.good) {OUT => "This file is unique\n" . "This file is unique\n" . "in that it does\n" . "in that it does\n" . "end in a newline.\n" . "end in a newline.\n" . "This file is unique\n" . "This file is unique\n" . "in that it does\n" . "in that it does\n" . "end in a newline.\n" . "end in a newline."}, # The expected content of 'noeolw.1out' (was: noeolw.1good) {CMP => [ "This file is unique\n" . "in that it does\n" . "end in a newline.\n" . "This file is unique\n" . "in that it does\n" . "end in a newline.\n" . "in that it does\n", { 'noeolw.1out' => undef }]}, # The expected content of 'noeolw.2out' (was: noeolw.2good) {CMP => [ "This file is unique\n" . "in that it does\n" . "end in a newline.", { 'noeolw.2out' => undef }]}, ], ['numsub', qw(-f), {IN => q( # the first one matches, the second doesn't 1s/foo/bar/10 2s/foo/bar/20 # The second line should be deleted. ssed 3.55-3.58 do not. t d )}, {IN => q(foo foo fo oo f oo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo fo oo f oo foo foo foo foo foo foo foo foo foo foo foo foo foo )}, {OUT => "foo foo fo oo f oo foo foo foo foo " . "foo foo foo bar foo foo foo foo foo\n"} ], ['numsub2', qw(-n -e 's/a*/b/2'), {IN => "\n"}, {OUT => ""} ], ['numsub3', qw(-n -e 's/^a*/b/2'), {IN => "\n"}, {OUT => ""} ], ['numsub4', qw(-n -e 's/^a*/b/2p'), {IN => "z\n"}, {OUT => ""} ], ['numsub5', qw(-n -e 's/a*/b/3p'), {IN => "z\n"}, {OUT => ""} ], ['readin', qw(-f), {IN => q(/\.$/r readin.in2 /too\.$/q )}, {AUX => { 'readin.in2' => "MOO\n" }}, {IN => "``Democracy will not come today, this year,\n" . " nor ever through compromise and fear.\n" . " I have as much right as the other fellow has\n" . " to stand on my two feet and own the land.\n" . " I tire so of hearing people say\n" . " let things take their course,\n" . " tomorrow is another day.\n" . " I do not need my freedom when I'm dead.\n" . " I cannot live on tomorrow's bread.\n" . " Freedom is a strong seed\n" . " planted in a great need.\n" . " I live here, too.\n" . " I want freedom just as you.''\n" . " ``The Weary Blues'', Langston Hughes\n"}, {OUT => "``Democracy will not come today, this year,\n" . " nor ever through compromise and fear.\n" . "MOO\n" . " I have as much right as the other fellow has\n" . " to stand on my two feet and own the land.\n" . "MOO\n" . " I tire so of hearing people say\n" . " let things take their course,\n" . " tomorrow is another day.\n" . "MOO\n" . " I do not need my freedom when I'm dead.\n" . "MOO\n" . " I cannot live on tomorrow's bread.\n" . "MOO\n" . " Freedom is a strong seed\n" . " planted in a great need.\n" . "MOO\n" . " I live here, too.\n" . "MOO\n"} ], ['sep', # inspired by an autoconf generated configure script. qw(-f), {IN => q(s%/[^/][^/]*$%% s%[\/][^\/][^\/]*$%% s,.*[^\/],, )}, {IN => "miss mary mack mack//mack/ran down/the track track track\n" . "slashes\aren't%used enough/in/casual-conversation///\n" . "possibly sentences would be more attractive if they ended" . "in two slashes//\n"}, {OUT => "\n" . "///\n" . "//\n"} ], ['subwrite', # test s///w option qw(-e 's/you/YoU/w subwrite.wout'), {IN => "Not some church, and not the state,\n" . "Not some dark capricious fate.\n" . "Who you are, and when you lose,\n" . "Comes only from the things you choose.\n"}, # The expected STDOUT {OUT => "Not some church, and not the state,\n" . "Not some dark capricious fate.\n" . "Who YoU are, and when you lose,\n" . "Comes only from the things YoU choose.\n"}, # The expected content of 'writeout.wout' {CMP => [ "Who YoU are, and when you lose,\n" . "Comes only from the things YoU choose.\n", { 'subwrite.wout' => undef }]} ], ['writeout', # Test 'w' command qw(-e '/^Facts ar/w writeout.wout'), {IN => "Facts are simple and facts are straight\n" . "Facts are lazy and facts are late\n" . "Facts all come with points of view\n" . "Facts don't do what I want them to\n"}, # The expected STDOUT {OUT => "Facts are simple and facts are straight\n" . "Facts are lazy and facts are late\n" . "Facts all come with points of view\n" . "Facts don't do what I want them to\n"}, # The expected content of 'writeout.wout' {CMP => [ "Facts are simple and facts are straight\n" . "Facts are lazy and facts are late\n", { 'writeout.wout' => undef }]} ], ['xabcx', # from the ChangeLog (Fri May 21 1993) # Regex address with custom character (\xREGEXx) qw(-e '\xfeetxs/blue/too/'), {IN => "roses are red\n" . "violets are blue\n" . "my feet are cold\n" . "your feet are blue\n"}, {OUT => "roses are red\n" . "violets are blue\n" . "my feet are cold\n" . "your feet are too\n"} ], ['xbxcx', # from the ChangeLog (Wed Sep 5 2001) qw(-e 's/a*/x/g'), {IN => "\n" . "b\n" . "bc\n" . "bac\n" . "baac\n" . "baaac\n" . "baaaac\n"}, {OUT => "x\n" . "xbx\n" . "xbxcx\n" . "xbxcx\n" . "xbxcx\n" . "xbxcx\n" . "xbxcx\n"} ], ['xbxcx3', # Test s///N replacements (GNU extension) qw(-e 's/a*/x/3'), {IN => "\n" . "b\n" . "bc\n" . "bac\n" . "baac\n" . "baaac\n" . "baaaac\n"}, {OUT => "\n" . "b\n" . "bcx\n" . "bacx\n" . "baacx\n" . "baaacx\n" . "baaaacx\n"} ], # Four backslashes (2 pairs of "\\") to pass through two interpolations: # once in Perl, then the shell command line argument. # sed will see one backslash character in the s/// command. ['bug30794_1', "s/z/\\\\x5cA/", {IN=>'z'}, {OUT => "\\A"}], ['bug30794_2', "s/z/\\\\x5c/", {IN=>'z'}, {OUT => "\\"}], ['bug30794_3', "s/z/\\\\x5c1/", {IN=>'z'}, {OUT => "\\1"}], ); my $save_temps = $ENV{SAVE_TEMPS}; my $verbose = $ENV{VERBOSE}; my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose); exit $fail;
agordon/sed
testsuite/misc.pl
Perl
gpl-3.0
38,612
<?php class DWQA_Handle { public function __construct() { // question add_action( 'wp_loaded', array( $this, 'submit_question' ), 11 ); add_action( 'wp_loaded', array( $this, 'update_question' ) ); // answer add_action( 'wp_loaded', array( $this, 'insert_answer') ); add_action( 'wp_loaded', array( $this, 'update_answer' ) ); // comment add_action( 'wp_loaded', array( $this, 'insert_comment' ) ); add_action( 'wp_loaded', array( $this, 'update_comment' ) ); } public function insert_answer() { global $dwqa_options; if ( ! isset( $_POST['dwqa-action'] ) || ! isset( $_POST['submit-answer'] ) ) { return false; } // do_action( 'dwqa_add_answer', $answer_id, $question_id ); // die(); if ( 'add-answer' !== sanitize_text_field( $_POST['dwqa-action'] ) ) { return false; } if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( esc_html( $_POST['_wpnonce'] ), '_dwqa_add_new_answer' ) ) { dwqa_add_notice( __( '&quot;Helllo&quot;, Are you cheating huh?.', 'dw-question-answer' ), 'error' ); } if ( sanitize_text_field( $_POST['submit-answer'] ) == __( 'Delete draft', 'dw-question-answer' ) ) { $draft = isset( $_POST['answer-id'] ) ? intval( $_POST['answer-id'] ) : 0; if ( $draft ) wp_delete_post( $draft ); } if ( empty( $_POST['answer-content'] ) ) { dwqa_add_notice( __( 'Answer content is empty', 'dw-question-answer' ), 'error' ); } if ( empty( $_POST['question_id'] ) ) { dwqa_add_notice( __( 'Question is empty', 'dw-question-answer' ), 'error' ); } if ( !dwqa_current_user_can( 'post_answer' ) ) { dwqa_add_notice( __( 'You do not have permission to submit question.', 'dw-question-answer' ), 'error' ); } if ( !is_user_logged_in() && ( empty( $_POST['user-email'] ) || !is_email( sanitize_email( $_POST['user-email'] ) ) ) ) { dwqa_add_notice( __( 'Missing email information', 'dw-question-answer' ), 'error' ); } if ( !is_user_logged_in() && ( empty( $_POST['user-name'] ) ) ) { dwqa_add_notice( __( 'Missing name information', 'dw-question-answer' ), 'error' ); } if ( !dwqa_valid_captcha( 'single-question' ) ) { dwqa_add_notice( __( 'Captcha is not correct', 'dw-question-answer' ), 'error' ); } $user_id = 0; $is_anonymous = false; if ( is_user_logged_in() ) { $user_id = get_current_user_id(); } else { $is_anonymous = true; if ( isset( $_POST['user-email'] ) && is_email( $_POST['user-email'] ) ) { $post_author_email = sanitize_email( $_POST['user-email'] ); } if ( isset( $_POST['user-name'] ) && !empty( $_POST['user-name'] ) ) { $post_author_name = sanitize_text_field( $_POST['user-name'] ); } } $question_id = intval( $_POST['question_id'] ); $answer_title = __( 'Answer for ', 'dw-question-answer' ) . get_post_field( 'post_title', $question_id ); $answ_content = apply_filters( 'dwqa_prepare_answer_content', $_POST['answer-content'] ); $answers = array( 'comment_status' => 'open', 'post_author' => $user_id, 'post_content' => $answ_content, 'post_title' => $answer_title, 'post_type' => 'dwqa-answer', 'post_parent' => $question_id, ); $answers['post_status'] = isset( $_POST['save-draft'] ) ? 'draft' : ( isset( $_POST['dwqa-status'] ) && $_POST['dwqa-status'] ? sanitize_text_field( $_POST['dwqa-status'] ) : 'publish' ); do_action( 'dwqa_prepare_add_answer' ); if ( dwqa_count_notices( 'error' ) > 0 ) { return false; } $answers = apply_filters( 'dwqa_insert_answer_args', $answers ); $answer_id = wp_insert_post( $answers ); if ( !is_wp_error( $answer_id ) ) { if ( $answers['post_status'] != 'draft' ) { update_post_meta( $question_id, '_dwqa_status', 'answered' ); update_post_meta( $question_id, '_dwqa_answered_time', time() ); update_post_meta( $answer_id, '_dwqa_votes', 0 ); $answer_count = get_post_meta( $question_id, '_dwqa_answers_count', true ); update_post_meta( $question_id, '_dwqa_answers_count', (int) $answer_count + 1 ); } if ( $is_anonymous ) { update_post_meta( $answer_id, '_dwqa_is_anonymous', true ); if ( isset( $post_author_email ) && is_email( $post_author_email ) ) { update_post_meta( $answer_id, '_dwqa_anonymous_email', $post_author_email ); } if ( isset( $post_author_name ) && !empty( $post_author_name ) ) { update_post_meta( $answer_id, '_dwqa_anonymous_name', $post_author_name ); } } else { if ( !dwqa_is_followed( $question_id, get_current_user_id() ) ) { add_post_meta( $question_id, '_dwqa_followers', get_current_user_id() ); } } do_action( 'dwqa_add_answer', $answer_id, $question_id ); $this->update_modified_date( $question_id , current_time( 'timestamp', 0 ), current_time( 'timestamp', 1 ) ); exit( wp_redirect( get_permalink( $question_id ) ) ); } else { dwqa_add_wp_error_message( $answer_id ); } } public function update_answer() { if ( isset( $_POST['dwqa-edit-answer-submit'] ) ) { if ( !dwqa_current_user_can( 'edit_answer' ) ) { dwqa_add_notice( __( "You do not have permission to edit answer.", 'dw-question-answer' ), 'error' ); } if ( !isset( $_POST['_wpnonce'] ) && !wp_verify_nonce( esc_html( $_POST['_wpnonce'] ), '_dwqa_edit_answer' ) ) { dwqa_add_notice( __( 'Hello, Are you cheating huh?', 'dw-question-answer' ), 'error' ); } $answer_content = apply_filters( 'dwqa_prepare_edit_answer_content', $_POST['answer_content'] ); if ( empty( $answer_content ) ) { dwqa_add_notice( __( 'You must enter a valid answer content.', 'dw-question-answer' ), 'error' ); } $answer_id = isset( $_POST['answer_id'] ) ? intval( $_POST['answer_id'] ) : false; if ( !$answer_id ) { dwqa_add_notice( __( 'Answer is missing.', 'dw-question-answer' ), 'error' ); } if ( 'dwqa-answer' !== get_post_type( $answer_id ) ) { dwqa_add_notice( __( 'This post is not answer.', 'dw-question-answer' ), 'error' ); } do_action( 'dwqa_prepare_insert_question', $answer_id ); if ( dwqa_count_notices( 'error' ) > 0 ) { return false; } $args = array( 'ID' => $answer_id, 'post_content' => $answer_content ); $new_answer_id = wp_update_post( $args ); if ( !is_wp_error( $new_answer_id ) ) { $old_post = get_post( $answer_id ); $new_post = get_post( $new_answer_id ); do_action( 'dwqa_update_answer', $new_answer_id, $old_post, $new_post ); $question_id = dwqa_get_post_parent_id( $new_answer_id ); $this->update_modified_date( $question_id , current_time( 'sql', 0 ), current_time( 'sql', 1 ) ); wp_safe_redirect( get_permalink( $question_id ) . '#answer-' . $new_answer_id ); } else { dwqa_add_wp_error_message( $new_answer_id ); return false; } exit(); } } public function insert_comment() { global $current_user; if ( isset( $_POST['comment-submit'] ) ) { if ( ! dwqa_current_user_can( 'post_comment' ) ) { dwqa_add_notice( __( 'You can\'t post comment', 'dw-question-answer' ), 'error', true ); } if ( ! isset( $_POST['comment_post_ID'] ) ) { dwqa_add_notice( __( 'Missing post id.', 'dw-question-answer' ), 'error', true ); } $comment_content = isset( $_POST['comment'] ) ? $_POST['comment'] : ''; $comment_content = apply_filters( 'dwqa_pre_comment_content', $comment_content ); if ( empty( $comment_content ) ) { dwqa_add_notice( __( 'Please enter your comment content', 'dw-question-answer' ), 'error', true ); } $args = array( 'comment_post_ID' => intval( $_POST['comment_post_ID'] ), 'comment_content' => $comment_content, 'comment_parent' => isset( $_POST['comment_parent']) ? intval( $_POST['comment_parent'] ) : 0, 'comment_type' => 'dwqa-comment' ); if ( is_user_logged_in() ) { $args['user_id'] = $current_user->ID; $args['comment_author'] = $current_user->display_name; } else { if ( ! isset( $_POST['email'] ) || ! sanitize_email( $_POST['email'] ) ) { dwqa_add_notice( __( 'Missing email information', 'dw-question-answer' ), 'error', true ); } if ( ! isset( $_POST['name'] ) || empty( $_POST['name'] ) ) { dwqa_add_notice( __( 'Missing name information', 'dw-question-answer' ), 'error', true ); } $args['comment_author'] = isset( $_POST['name'] ) ? sanitize_text_field( $_POST['name'] ) : 'Anonymous'; $args['comment_author_email'] = sanitize_email( $_POST['email'] ); $args['comment_author_url'] = isset( $_POST['url'] ) ? esc_url( $_POST['url'] ) : ''; $args['user_id'] = -1; } $question_id = absint( $_POST['comment_post_ID'] ); if ( 'dwqa-answer' == get_post_type( $question_id ) ) { $question_id = dwqa_get_question_from_answer_id( $question_id ); } $redirect_to = get_permalink( $question_id ); if ( isset( $_GET['ans-page'] ) ) { $redirect_to = add_query_arg( 'ans-page', absint( $_GET['ans-page'] ), $redirect_to ); } if ( dwqa_count_notices( 'error', true ) > 0 ) { $redirect_to = apply_filters( 'dwqa_submit_comment_error_redirect', $redirect_to, $question_id); exit(wp_safe_redirect( $redirect_to )); return false; } $args = apply_filters( 'dwqa_insert_comment_args', $args ); $comment_id = wp_insert_comment( $args ); global $comment; $comment = get_comment( $comment_id ); $client_id = isset( $_POST['clientId'] ) ? sanitize_text_field( $_POST['clientId'] ) : false; do_action( 'dwqa_add_comment', $comment_id, $client_id ); $redirect_to = apply_filters( 'dwqa_submit_comment_success_redirect', $redirect_to, $question_id); exit(wp_safe_redirect( $redirect_to )); } } public function update_comment() { global $post_submit_filter; if ( isset( $_POST['dwqa-edit-comment-submit'] ) ) { if ( ! isset( $_POST['comment_id']) ) { dwqa_add_notice( __( 'Comment is missing', 'dw-question-answer' ), 'error' ); } $comment_id = intval( $_POST['comment_id'] ); $comment_content = isset( $_POST['comment_content'] ) ? $_POST['comment_content'] : ''; $comment_content = apply_filters( 'dwqa_pre_update_comment_content', $comment_content ); if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( $_POST['_wpnonce'] ), '_dwqa_edit_comment' ) ) { dwqa_add_notice( __( 'Are you cheating huh?', 'dw-question-answer' ), 'error' ); } if ( !dwqa_current_user_can( 'edit_comment', $comment_id ) ) { dwqa_add_notice( __( 'You do not have permission to edit comment.', 'dw-question-answer' ), 'error' ); } if ( strlen( $comment_content ) <= 0 || ! isset( $comment_id ) || ( int )$comment_id <= 0 ) { dwqa_add_notice( __( 'Comment content must not be empty.', 'dw-question-answer' ), 'error' ); } else { $commentarr = array( 'comment_ID' => $comment_id, 'comment_content' => $comment_content ); $intval = wp_update_comment( $commentarr ); if ( !is_wp_error( $intval ) ) { $comment = get_comment( $comment_id ); exit( wp_safe_redirect( dwqa_get_question_link( $comment->comment_post_ID ) ) ); }else { dwqa_add_wp_error_message( $intval ); } } } } public function submit_question() { global $dwqa_options; if ( isset( $_POST['dwqa-question-submit'] ) ) { global $dwqa_current_error; $valid_captcha = dwqa_valid_captcha( 'question' ); $dwqa_submit_question_errors = new WP_Error(); if ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( esc_html( $_POST['_wpnonce'] ), '_dwqa_submit_question' ) ) { if ( $valid_captcha ) { if ( empty( $_POST['question-title'] ) ) { dwqa_add_notice( __( 'You must enter a valid question title.', 'dw-question-answer' ), 'error' ); return false; } if ( !is_user_logged_in() ) { if ( empty( $_POST['_dwqa_anonymous_email'] ) || !is_email( sanitize_email( $_POST['_dwqa_anonymous_email'] ) ) ) { dwqa_add_notice( __( 'Missing email information', 'dw-question-answer' ), 'error' ); return false; } if ( empty( $_POST['_dwqa_anonymous_name'] ) ) { dwqa_add_notice( __( 'Missing name information', 'dw-question-answer' ), 'error' ); return false; } } $title = esc_html( $_POST['question-title'] ); $category = isset( $_POST['question-category'] ) ? intval( $_POST['question-category'] ) : 0; if ( ! term_exists( $category, 'dwqa-question_category' ) ) { $category = 0; } $tags = isset( $_POST['question-tag'] ) ? esc_html( $_POST['question-tag'] ): ''; $content = isset( $_POST['question-content'] ) ? $_POST['question-content'] : ''; $content = apply_filters( 'dwqa_prepare_question_content', $content ); $user_id = 0; $is_anonymous = false; if ( is_user_logged_in() ) { $user_id = get_current_user_id(); } else { //$post_author_email = $_POST['user-email']; if ( isset( $_POST['login-type'] ) && sanitize_text_field( $_POST['login-type'] ) == 'sign-in' ) { $user = wp_signon( array( 'user_login' => isset( $_POST['user-name'] ) ? esc_html( $_POST['user-name'] ) : '', 'user_password' => isset( $_POST['user-password'] ) ? esc_html( $_POST['user-password'] ) : '', ), false ); if ( ! is_wp_error( $user ) ) { global $current_user; $current_user = $user; get_currentuserinfo(); $user_id = $user->data->ID; } else { $dwqa_current_error = $user; return false; } } elseif ( isset( $_POST['login-type'] ) && sanitize_text_field( $_POST['login-type'] ) == 'sign-up' ) { //Create new user $users_can_register = get_option( 'users_can_register' ); if ( isset( $_POST['user-email'] ) && isset( $_POST['user-name-signup'] ) && $users_can_register && ! email_exists( $_POST['user-email'] ) && ! username_exists( $_POST['user-name-signup'] ) ) { if ( isset( $_POST['password-signup'] ) ) { $password = esc_html( $_POST['password-signup'] ); } else { $password = wp_generate_password( 12, false ); } $user_id = wp_create_user( esc_html( $_POST['user-name-signup'] ), $password, sanitize_email( $_POST['user-email'] ) ); if ( is_wp_error( $user_id ) ) { $dwqa_current_error = $user_id; return false; } wp_new_user_notification( $user_id, $password ); $user = wp_signon( array( 'user_login' => esc_html( $_POST['user-name-signup'] ), 'user_password' => $password, ), false ); if ( ! is_wp_error( $user ) ) { global $current_user; $current_user = $user; get_currentuserinfo(); $user_id = $user->data->ID; } else { $dwqa_current_error = $user; return false; } } else { $message = ''; if ( ! $users_can_register ) { $message .= __( 'User Registration was disabled.','dw-question-answer' ).'<br>'; } if ( isset( $_POST['user-name'] ) && email_exists( sanitize_email( $_POST['user-email'] ) ) ) { $message .= __( 'This email is already registered, please choose another one.','dw-question-answer' ).'<br>'; } if ( isset( $_POST['user-name'] ) && username_exists( esc_html( $_POST['user-name'] ) ) ) { $message .= __( 'This username is already registered. Please use another one.','dw-question-answer' ).'<br>'; } // $dwqa_current_error = new WP_Error( 'submit_question', $message ); dwqa_add_notice( $message, 'error' ); return false; } } else { $is_anonymous = true; $question_author_email = isset( $_POST['_dwqa_anonymous_email'] ) && is_email( $_POST['_dwqa_anonymous_email'] ) ? sanitize_email( $_POST['_dwqa_anonymous_email'] ) : false; $question_author_name = isset( $_POST['_dwqa_anonymous_name'] ) && !empty( $_POST['_dwqa_anonymous_name'] ) ? sanitize_text_field( $_POST['_dwqa_anonymous_name'] ) : false; $user_id = 0; } } $post_status = ( isset( $_POST['question-status'] ) && esc_html( $_POST['question-status'] ) ) ? $_POST['question-status'] : 'publish'; //Enable review mode global $dwqa_general_settings; if ( isset( $dwqa_general_settings['enable-review-question'] ) && $dwqa_general_settings['enable-review-question'] && $post_status != 'private' && ! current_user_can( 'manage_options' ) ) { $post_status = 'pending'; } $postarr = array( 'comment_status' => 'open', 'post_author' => $user_id, 'post_content' => $content, 'post_status' => $post_status, 'post_title' => $title, 'post_type' => 'dwqa-question', 'tax_input' => array( 'dwqa-question_category' => array( $category ), 'dwqa-question_tag' => explode( ',', $tags ) ) ); if ( apply_filters( 'dwqa-current-user-can-add-question', dwqa_current_user_can( 'post_question' ), $postarr ) ) { $new_question = $this->insert_question( $postarr ); do_action('dwqa_after_insert_question',$new_question); } else { //$dwqa_submit_question_errors->add( 'submit_question', __( 'You do not have permission to submit question.', 'dw-question-answer' ) ); dwqa_add_notice( __( 'You do not have permission to submit question.', 'dw-question-answer' ), 'error' ); $new_question = $dwqa_submit_question_errors; } if ( dwqa_count_notices( 'error' ) == 0 ) { if ( $is_anonymous ) { update_post_meta( $new_question, '_dwqa_anonymous_email', $question_author_email ); update_post_meta( $new_question, '_dwqa_anonymous_name', $question_author_name ); update_post_meta( $new_question, '_dwqa_is_anonymous', true ); } if ( isset( $dwqa_options['enable-review-question'] ) && $dwqa_options['enable-review-question'] && !current_user_can( 'manage_options' ) && $post_status != 'private' ) { dwqa_add_notice( __( 'Your question is waiting moderator.', 'dw-question-answer' ), 'success' ); } else { exit( wp_safe_redirect( get_permalink( $new_question ) ) ); } } } else { // $dwqa_submit_question_errors->add( 'submit_question', __( 'Captcha is not correct','dw-question-answer' ) ); dwqa_add_notice( __( 'Captcha is not correct', 'dw-question-answer' ), 'error' ); } } else { // $dwqa_submit_question_errors->add( 'submit_question', __( 'Are you cheating huh?','dw-question-answer' ) ); dwqa_add_notice( __( 'Are you cheating huh?', 'dw-question-answer' ), 'error' ); } //$dwqa_current_error = $dwqa_submit_question_errors; } } public function update_question() { if ( isset( $_POST['dwqa-edit-question-submit'] ) ) { if ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( esc_html( $_POST['_wpnonce'] ), '_dwqa_edit_question' ) ) { if ( !dwqa_current_user_can( 'edit_question' ) ) { dwqa_add_notice( __( "You do not have permission to edit question", 'dw-question-answer' ), 'error' ); } $question_title = apply_filters( 'dwqa_prepare_edit_question_title', sanitize_text_field( $_POST['question_title'] ) ); if ( empty( $question_title ) ) { dwqa_add_notice( __( 'You must enter a valid question title.', 'dw-question-answer' ), 'error' ); } $question_id = isset( $_POST['question_id'] ) ? sanitize_text_field( $_POST['question_id'] ) : false; if ( !$question_id ) { dwqa_add_notice( __( 'Question is missing.', 'dw-question-answer' ), 'error' ); } if ( 'dwqa-question' !== get_post_type( $question_id ) ) { dwqa_add_notice( __( 'This post is not question.', 'dw-question-answer' ), 'error' ); } $question_content = apply_filters( 'dwqa_prepare_edit_question_content', $_POST['question_content'] ); $tags = isset( $_POST['question-tag'] ) ? esc_html( $_POST['question-tag'] ): ''; $category = isset( $_POST['question-category'] ) ? intval( $_POST['question-category'] ) : 0; if ( ! term_exists( $category, 'dwqa-question_category' ) ) { $category = 0; } do_action( 'dwqa_prepare_update_question', $question_id ); if ( dwqa_count_notices( 'error' ) > 0 ) { return false; } $args = array( 'ID' => $question_id, 'post_content' => $question_content, 'post_title' => $question_title, 'tax_input' => array( 'dwqa-question_category' => array( $category ), 'dwqa-question_tag' => explode( ',', $tags ) ), ); $new_question_id = wp_update_post( $args ); if ( !is_wp_error( $new_question_id ) ) { $old_post = get_post( $question_id ); $new_post = get_post( $new_question_id ); do_action( 'dwqa_update_question', $new_question_id, $old_post, $new_post ); wp_safe_redirect( get_permalink( $new_question_id ) ); } else { dwqa_add_wp_error_message( $new_question_id ); return false; } } else { dwqa_add_notice( __( 'Hello, Are you cheating huh?', 'dw-question-answer' ), 'error' ); return false; } exit(0); } } public function insert_question( $args ) { if ( is_user_logged_in() ) { $user_id = get_current_user_id(); } elseif ( dwqa_current_user_can( 'post_question' ) ) { $user_id = 0; } else { return false; } $args = wp_parse_args( $args, array( 'comment_status' => 'open', 'post_author' => $user_id, 'post_content' => '', 'post_status' => 'pending', 'post_title' => '', 'post_type' => 'dwqa-question', ) ); $args = apply_filters( 'dwqa_insert_question_args', $args ); $new_question = wp_insert_post( $args, true ); if ( ! is_wp_error( $new_question ) ) { if ( isset( $args['tax_input'] ) ) { foreach ( $args['tax_input'] as $taxonomy => $tags ) { wp_set_post_terms( $new_question, $tags, $taxonomy ); } } update_post_meta( $new_question, '_dwqa_status', 'open' ); update_post_meta( $new_question, '_dwqa_views', 0 ); update_post_meta( $new_question, '_dwqa_votes', 0 ); update_post_meta( $new_question, '_dwqa_answers_count', 0 ); add_post_meta( $new_question, '_dwqa_followers', $user_id ); $date = get_post_field( 'post_date', $new_question ); // dwqa_log_last_activity_on_question( $new_question, 'Create question', $date ); //Call action when add question successfull do_action( 'dwqa_add_question', $new_question, $user_id ); } return $new_question; } function update_modified_date( $question_id, $modified_date, $modified_date_gmt ) { $data = array( 'ID' => $question_id, 'post_modified' => $this->timeformat_convert( $modified_date ), 'post_modified_gmt' => $this->timeformat_convert( $modified_date_gmt ), ); wp_update_post( $data ); } function timeformat_convert( $timestamp ) { return date("Y-m-d H:i:s", $timestamp ); } }
designwall/dw-question-answer
inc/Handle.php
PHP
gpl-3.0
22,973
# CentOS-7-Installer Version: 3.0.1 Author: MapFig, Inc OS Tested: CentOS 7x64 #For use on fresh install CentOS 7.x64 only!! <h1>Installation</h1> <h3>Installer Requirements </h3> <ul> <li>Access to a working SMTP email account. While you can configure this on the box you install MapFig Studio, the application is designed to authenticate email and links via an smtp email service. If you do not want email verification functionality or do not have access to an SMTP email account, see "Bypass Email Requirements" below.</li> </ul> <p>&nbsp;</p> <h3>CentOS 7 x64 </h3> <h4>The following is only for use on a <strong>clean installation</strong>. </h4> <p class="style7 style4">Get the installer from our secure CDN: <pre>[root@petiole ~]# wget https://cdn.acugis.com/petiole/v301/petiole-3.0.1-CentOS-7.sh</pre> </p> <p><span class="style7 style4">Check the file integrity</span>: <pre>[root@petiole ~]# md5sum petiole-3.0.1-CentOS-7.sh</pre> <p><span class="style4">MD5 output should match <a href="https://cdn.acugis.com/petiole/v301/petiole-3.0.1-CentOS-7-md5.txt" target="_blank">https://cdn.acugis.com/petiole/v301/petiole-3.0.1-CentOS-7-md5.txt</a></span></p> <p><span class="style7 style4">Make the file executable</span>: <pre>[root@petiole ~]# chmod 755 petiole-3.0.1-CentOS-7.sh</pre></p> <p><span class="style7 style4">Run the installer! </span> <pre>[root@petiole ~]# ./petiole-3.0.1-CentOS-7.sh</pre></p> <p>&nbsp;</p> <p class="style2">The script takes a few minutes, be patient. You will be prompted for SMTP credentials (required) as well as domain/VHOST (optional). If you do not have access to an email account see <a href="#EMAILBYPASS-DO">email section</a> below. </p> <p class="style1">&nbsp;</p> <p class="style2">A the end of installation your mapfig user password, database name, database password, and postgres password will be displayed as below as well as saved to an auth file (/root/mapfig-install.auth) on the file system.</p> <p class="style1"><pre>INFO: Virtual Host Configuration: /etc/httpd/conf.d/mapfig.conf Your studio database name is: fjcfgldypqimux Your studio stats database name is: fjcfgldypqimux_stats Your studio postgresql user password is: ClXpkibHXD68gYDAGKjn--M79C2bbFFd Your studio os user password is: -cfWQ8pHXfWMGUzUTU_J-yLd2Qi3dq2F Your postgres superuser password is: 6nAnKT9QQn8fR_0e508WYgFuaI0UzmhX Password are saved in /root/studio-install.auth [root@petiole ~]#</pre></p> <p class="style1">&nbsp;</p> <p class="style2">Navigate to your VM IP and follow the installation screens:</p> <p class="style1">&nbsp;</p> <p class="style2">Enter the db names and pgsql password from end of install script: </p> <p class="style1"><img src="https://cdn.acugis.com/petiole/v301/petdocs/populated.jpg"></p></p> <p class="style1">&nbsp;</p> <p class="style2">Select Admin User Name, Password, and Email: </p> <p class="style1"><img src="https://cdn.acugis.com/petiole/v301/petdocs/populated-indo.jpg"></p> <p class="style1">&nbsp;</p> <p class="style2"><span class="style5 style3">Check you email, click the verification link and log in:.</p> <p class="style1">&nbsp;</p> <img src="https://cdn.acugis.com/petiole/v301/petdocs/DONE.jpg"></p> <p class="style1">&nbsp;</p> <p class="style2"><span class="style5 style3">If verifcation email does work</span>, follow steps below to re-run mail configuration. You can re-run this as many times as you wish to set/change/update mail settings.</p> <p class="style1">&nbsp;</p> <p> <pre>[root@petiole ~]# wget https://cdn.acugis.com/petiole/v301/petiole-mail-config.sh</pre> </p> <p><pre>[root@petiole ~]# chmod 755 petiole-mail-config.sh</pre></p> <p><pre>[root@petiole ~]# ./petiole-mail-config.sh</pre></p> <p>&nbsp;</p> <p>&nbsp;</p> <p class="style2"><span class="style5"><span class="style3">If you want to point a sub domain</span> <span class="style3">(e.g. maps.mydomain.com) and did not do so during the install</span></span>, follow steps below to re-run vhost configuration. You can re-run this as many times as you wish to set/change/update vhost settings.</p> <p class="style1">&nbsp;</p> <p> <pre>[root@petiole ~]# wget https://cdn.acugis.com/petiole/v301/petiole-vhost-config-centos-07.sh</pre> </p> <p><pre>[root@petiole ~]# chmod 755 petiole-vhost-config-centos-07.sh</pre></p> <pre>[root@petiole ~]# ./petiole-vhost-config-centos-07.sh</pre> <h4>&nbsp;</h4> <h4>Bypass Email Requirements</a></h4> <p class="style2"><span class="style3">If you do not wish to use email functionality, or do not have access to an SMTP server</span>, connect as user mapfig to the postgresql database that was created by the script (fjcfgldypqimux, in our example above) :</p> <p class="style1">&nbsp;</p> <p> <pre>[root@petiole ~]# su - mapfig $ psql -d fjcfgldypqimux -U mapfig Password for user mapfig: psql (9.4.4) Type "help" for help. fjcfgldypqimux=></pre> </p> <p class="style2">Run the update statement below, where 'me@myemail.com' is the email you used during installation: </p> <p> <pre>fjcfgldypqimux=> update users set activationkey = '' where email = 'me@myemail.com';</pre> </p>
MapFig/petiole-CentOS-7-Installer
README.md
Markdown
gpl-3.0
5,101
package representation.expression; import enums.ExpressionType; import interfaces.Expression; public class ExpressionRepresentation implements Expression { private ExpressionType expressionType; private String value; public ExpressionRepresentation(ExpressionType expressionType, String value) { this.expressionType = expressionType; this.value = value; } @Override public ExpressionType getExpressionType() { return expressionType; } @Override public String toString() { return "ExpressionRepresentation{" + "expressionType=" + expressionType + ", value='" + value + '\'' + '}'; } public void setExpressionType(ExpressionType expressionType) { this.expressionType = expressionType; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } }
veresdavid/deik-tdk-2017
generator/src/main/java/representation/expression/ExpressionRepresentation.java
Java
gpl-3.0
882
# vi: ts=4 expandtab # # Copyright (C) 2011 Canonical Ltd. # Copyright (C) 2012 Hewlett-Packard Development Company, L.P. # # Author: Scott Moser <scott.moser@canonical.com> # Author: Juerg Haefliger <juerg.haefliger@hp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import os from cloudinit.settings import PER_INSTANCE from cloudinit import util frequency = PER_INSTANCE # This is a tool that cloud init provides HELPER_TOOL_TPL = '%s/cloud-init/write-ssh-key-fingerprints' def _get_helper_tool_path(distro): try: base_lib = distro.usr_lib_exec except AttributeError: base_lib = '/usr/lib' return HELPER_TOOL_TPL % base_lib def handle(name, cfg, cloud, log, _args): helper_path = _get_helper_tool_path(cloud.distro) if not os.path.exists(helper_path): log.warn(("Unable to activate module %s," " helper tool not found at %s"), name, helper_path) return fp_blacklist = util.get_cfg_option_list(cfg, "ssh_fp_console_blacklist", []) key_blacklist = util.get_cfg_option_list(cfg, "ssh_key_console_blacklist", ["ssh-dss"]) try: cmd = [helper_path] cmd.append(','.join(fp_blacklist)) cmd.append(','.join(key_blacklist)) (stdout, _stderr) = util.subp(cmd) util.multi_log("%s\n" % (stdout.strip()), stderr=False, console=True) except Exception: log.warn("Writing keys to the system console failed!") raise
prometheanfire/cloud-init
cloudinit/config/cc_keys_to_console.py
Python
gpl-3.0
2,179
<html lang="en"> <head> <title>Command Index - ECB - the Emacs Code Browser</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="ECB - the Emacs Code Browser"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="ecb.html#Top"> <link rel="prev" href="FAQ.html#FAQ" title="FAQ"> <link rel="next" href="Option-Index.html#Option-Index" title="Option Index"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Command-Index"></a> <p> Next:&nbsp;<a rel="next" accesskey="n" href="Option-Index.html#Option-Index">Option Index</a>, Previous:&nbsp;<a rel="previous" accesskey="p" href="FAQ.html#FAQ">FAQ</a>, Up:&nbsp;<a rel="up" accesskey="u" href="ecb.html#Top">Top</a> <hr> </div> <h2 class="unnumbered">Command Index</h2> <p class="noindent">This index contains all user commands of ECB. <p><strong>Please note</strong>: The commands in this index are listed without the prefix &ldquo;ecb-&rdquo; (e.g. the command <code>ecb-activate</code> is listed with name &ldquo;activate&rdquo;). <ul class="index-fn" compact> <li><a href="Interactive-ECB-commands.html#index-activate-57"><code>activate</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-add_002dall_002dbuffers_002dto_002dhistory-58"><code>add-all-buffers-to-history</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-analyse_002dbuffer_002dsync-59"><code>analyse-buffer-sync</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="The-edit_002darea.html#index-balance_002dwindows-38"><code>balance-windows</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="Interactive-ECB-commands.html#index-change_002dlayout-60"><code>change-layout</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-clear_002dhistory-61"><code>clear-history</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-create_002dnew_002dlayout-64"><code>create-new-layout</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-customize-62"><code>customize</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-customize_002dmost_002dimportant-63"><code>customize-most-important</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-cycle_002dmaximized_002decb_002dbuffers-65"><code>cycle-maximized-ecb-buffers</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-cycle_002dthrough_002dcompilation_002dbuffers-66"><code>cycle-through-compilation-buffers</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-deactivate-67"><code>deactivate</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-delete_002dnew_002dlayout-68"><code>delete-new-layout</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="The-edit_002darea.html#index-delete_002dother_002dwindows-29"><code>delete-other-windows</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="The-edit_002darea.html#index-delete_002dwindow-28"><code>delete-window</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="The-edit_002darea.html#index-delete_002dwindows_002don-30"><code>delete-windows-on</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="The-edit_002darea.html#index-display_002dbuffer-34"><code>display-buffer</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="Interactive-ECB-commands.html#index-display_002dnews_002dfor_002dupgrade-69"><code>display-news-for-upgrade</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-display_002dupgraded_002doptions-70"><code>display-upgraded-options</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-dump_002dsemantic_002dtoplevel-72"><code>dump-semantic-toplevel</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-eshell_002dcurrent_002dbuffer_002dsync-73"><code>eshell-current-buffer-sync</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-eshell_002drecenter-74"><code>eshell-recenter</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-expand_002ddirectory_002dnodes-75"><code>expand-directory-nodes</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-expand_002dmethods_002dnodes-71"><code>expand-methods-nodes</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-goto_002dwindow_002danalyse-76"><code>goto-window-analyse</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-goto_002dwindow_002dcompilation-77"><code>goto-window-compilation</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-goto_002dwindow_002ddirectories-78"><code>goto-window-directories</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-goto_002dwindow_002decb_002dby_002dsmart_002dselection-79"><code>goto-window-ecb-by-smart-selection</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-goto_002dwindow_002dedit_002dby_002dsmart_002dselection-80"><code>goto-window-edit-by-smart-selection</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-goto_002dwindow_002dedit_002dlast-83"><code>goto-window-edit-last</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-goto_002dwindow_002dedit1-81"><code>goto-window-edit1</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-goto_002dwindow_002dedit2-82"><code>goto-window-edit2</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-goto_002dwindow_002dhistory-84"><code>goto-window-history</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-goto_002dwindow_002dmethods-85"><code>goto-window-methods</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-goto_002dwindow_002dsources-86"><code>goto-window-sources</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-history_002dfilter-87"><code>history-filter</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-jde_002ddisplay_002dclass_002dat_002dpoint-88"><code>jde-display-class-at-point</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Programming-a-new-layout.html#index-layout_002ddefine-365"><code>layout-define</code></a>: <a href="Programming-a-new-layout.html#Programming-a-new-layout">Programming a new layout</a></li> <li><a href="Programming-a-new-layout.html#index-layout_002dundefine-366"><code>layout-undefine</code></a>: <a href="Programming-a-new-layout.html#Programming-a-new-layout">Programming a new layout</a></li> <li><a href="Interactive-ECB-commands.html#index-maximize_002dwindow_002danalyse-89"><code>maximize-window-analyse</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-maximize_002dwindow_002ddirectories-90"><code>maximize-window-directories</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-maximize_002dwindow_002dhistory-93"><code>maximize-window-history</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-maximize_002dwindow_002dmethods-92"><code>maximize-window-methods</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-maximize_002dwindow_002dsources-91"><code>maximize-window-sources</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-maximize_002dwindow_002dspeedbar-94"><code>maximize-window-speedbar</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-methods_002dfilter-95"><code>methods-filter</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-methods_002dfilter_002dcurrent_002dtype-96"><code>methods-filter-current-type</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-methods_002dfilter_002ddelete_002dlast-97"><code>methods-filter-delete-last</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-methods_002dfilter_002dfunction-98"><code>methods-filter-function</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-methods_002dfilter_002dnofilter-99"><code>methods-filter-nofilter</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-methods_002dfilter_002dprotection-100"><code>methods-filter-protection</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-methods_002dfilter_002dregexp-101"><code>methods-filter-regexp</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-methods_002dfilter_002dtagclass-102"><code>methods-filter-tagclass</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-minor_002dmode-103"><code>minor-mode</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-nav_002dgoto_002dnext-105"><code>nav-goto-next</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-nav_002dgoto_002dprevious-104"><code>nav-goto-previous</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="The-edit_002darea.html#index-other_002dwindow-27"><code>other-window</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="The-edit_002darea.html#index-other_002dwindow_002dfor_002dscrolling-37"><code>other-window-for-scrolling</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="Interactive-ECB-commands.html#index-rebuild_002dmethods_002dbuffer-106"><code>rebuild-methods-buffer</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-redraw_002dlayout-107"><code>redraw-layout</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-restore_002ddefault_002dwindow_002dsizes-108"><code>restore-default-window-sizes</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-restore_002dwindow_002dsizes-109"><code>restore-window-sizes</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-select_002decb_002dframe-110"><code>select-ecb-frame</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-show_002dhelp-111"><code>show-help</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-show_002dlayout_002dhelp-112"><code>show-layout-help</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-show_002dtip_002dof_002dthe_002dday-113"><code>show-tip-of-the-day</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-sources_002dfilter-114"><code>sources-filter</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="The-edit_002darea.html#index-split_002dwindow-31"><code>split-window</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="The-edit_002darea.html#index-split_002dwindow_002dhorizontally-32"><code>split-window-horizontally</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="The-edit_002darea.html#index-split_002dwindow_002dvertically-33"><code>split-window-vertically</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="Interactive-ECB-commands.html#index-store_002dwindow_002dsizes-115"><code>store-window-sizes</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-submit_002dproblem_002dreport-116"><code>submit-problem-report</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="The-edit_002darea.html#index-switch_002dto_002dbuffer-35"><code>switch-to-buffer</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="The-edit_002darea.html#index-switch_002dto_002dbuffer_002dother_002dwindow-36"><code>switch-to-buffer-other-window</code></a>: <a href="The-edit_002darea.html#The-edit_002darea">The edit-area</a></li> <li><a href="Interactive-ECB-commands.html#index-toggle_002dauto_002dexpand_002dtag_002dtree-117"><code>toggle-auto-expand-tag-tree</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-toggle_002dcompile_002dwindow-118"><code>toggle-compile-window</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-toggle_002dcompile_002dwindow_002dheight-119"><code>toggle-compile-window-height</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-toggle_002decb_002dwindows-120"><code>toggle-ecb-windows</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-toggle_002dlayout-121"><code>toggle-layout</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-toggle_002dscroll_002dother_002dwindow_002dscrolls_002dcompile-122"><code>toggle-scroll-other-window-scrolls-compile</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-update_002ddirectories_002dbuffer-123"><code>update-directories-buffer</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-upgrade_002doptions-124"><code>upgrade-options</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> <li><a href="Interactive-ECB-commands.html#index-window_002dsync-125"><code>window-sync</code></a>: <a href="Interactive-ECB-commands.html#Interactive-ECB-commands">Interactive ECB commands</a></li> </ul> </body></html>
chtlp/emacs24-profile
vendor/ecb/html-help/Command-Index.html
HTML
gpl-3.0
19,681
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Atto text editor integration version file. * * @package atto_unorderedlist * @copyright 2013 Damyon Wiese <damyon@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2020060900; // Requires this Moodle version. $plugin->component = 'atto_unorderedlist'; // Full name of the plugin (used for diagnostics).
samhemelryk/moodle
lib/editor/atto/plugins/unorderedlist/version.php
PHP
gpl-3.0
1,204
/* * Copyright (C) 2010-2021 Structr GmbH * * This file is part of Structr <http://structr.org>. * * Structr is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * Structr is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Structr. If not, see <http://www.gnu.org/licenses/>. */ package org.structr.common.error; import java.util.Date; import org.structr.core.property.PropertyKey; /** * Indicates that two given date properties must be ordered chronologically. * * */ public class ChronologicalOrderToken extends SemanticErrorToken { public ChronologicalOrderToken(final String type, final PropertyKey<Date> propertyKey1, final PropertyKey<Date> propertyKey2) { super(type, propertyKey1, "must_lie_before", propertyKey2.jsonName()); } }
structr/structr
structr-core/src/main/java/org/structr/common/error/ChronologicalOrderToken.java
Java
gpl-3.0
1,208
import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; import { type } from '../../utils'; import { createAction } from '../create-action'; import { AppState } from '../../models'; @Injectable() export class OrganizationActions { static FETCH = type('[Organization] Fetch'); static FETCH_SUCCESS = type('[Organization] Fetch Success'); static FETCH_FAIL = type('[Organization] Fetch Fail'); constructor( private store: Store<AppState> ) {} fetchOrganization(organizationID: number) { this.store.dispatch(createAction(OrganizationActions.FETCH, organizationID)); } }
emmanuelroussel/stockpile-app
src/store/organization/organization.actions.ts
TypeScript
gpl-3.0
620
module.exports={A:{A:{"2":"K D G E A B hB"},B:{"1":"2 C d J M H I"},C:{"2":"0 1 2 3 4 6 7 8 eB BB F N K D G E A B C d J M H I O P Q R S T U V W X Y Z a b c e f g h i j k l m n o L q r s t u v w x y z HB GB AB CB DB FB YB XB"},D:{"2":"0 1 2 3 4 6 7 8 F N K D G E A B C d J M H I O P Q R S T U V W X Y Z a b c e f g h i j k l m n o L q r s t u v w x y z HB GB AB CB DB FB RB LB JB jB MB NB OB PB"},E:{"1":"5 K D G E A B C TB UB VB WB p ZB","2":"F N QB IB SB"},F:{"2":"0 1 5 6 9 E B C J M H I O P Q R S T U V W X Y Z a b c e f g h i j k l m n o L q r s t u v w x y z aB bB cB dB p fB"},G:{"1":"G IB gB EB iB KB kB lB mB nB oB pB qB rB sB tB"},H:{"2":"uB"},I:{"1":"4 BB F yB EB zB 0B","2":"vB wB xB"},J:{"1":"A","2":"D"},K:{"1":"L","2":"5 9 A B C p"},L:{"1":"JB"},M:{"2":"3"},N:{"2":"A B"},O:{"1":"1B"},P:{"1":"F 2B 3B 4B 5B"},Q:{"1":"6B"},R:{"1":"7B"}},B:7,C:"HTTP Live Streaming (HLS)"};
hhkaos/awesome-arcgis
node_modules/caniuse-lite/data/features/http-live-streaming.js
JavaScript
gpl-3.0
886
/* This file is part of Mitsuba, a physically based rendering system. Copyright (c) 2007-2012 by Wenzel Jakob and others. Mitsuba is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation. Mitsuba is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #if !defined(__MITSUBA_CORE_NORMAL_H_) #define __MITSUBA_CORE_NORMAL_H_ #include <mitsuba/core/vector.h> MTS_NAMESPACE_BEGIN /** * \headerfile mitsuba/core/normal.h mitsuba/mitsuba.h * \brief Three-dimensional normal data structure * * Internally represented using floating point numbers of the chosen * compile-time precision. The main difference of this data structure * when compared to \ref TVector3<Float> is in how instances of * \ref Normal are treated by linear transformations. * * \ingroup libcore * \ingroup libpython */ struct Normal : public TVector3<Float> { /** \brief Construct a new normal without initializing it. * * This construtor is useful when the normal will either not * be used at all (it might be part of a larger data structure) * or initialized at a later point in time. Always make sure * that one of the two is the case! Otherwise your program will do * computations involving uninitialized memory, which will probably * lead to a difficult-to-find bug. */ Normal() { } /// Initialize the vector with the specified X and Z components Normal(Float x, Float y, Float z) : TVector3<Float>(x, y, z) { } /// Initialize all components of the the normal with the specified value explicit Normal(Float val) : TVector3<Float>(val) { } /// Unserialize a normal from a binary data stream Normal(Stream *stream) { x = stream->readElement<Float>(); y = stream->readElement<Float>(); z = stream->readElement<Float>(); } /// Construct a normal from a vector data structure Normal(const TVector3<Float> &v) : TVector3<Float>(v.x, v.y, v.z) { } /// Assign a vector to this normal void operator=(const TVector3<Float> &v) { x = v.x; y = v.y; z = v.z; } }; inline Normal normalize(const Normal &n) { return n / n.length(); } MTS_NAMESPACE_END #endif /* __MITSUBA_CORE_NORMAL_H_ */
tdmsolutions/mitsubarender
install/mitsuba/Mitsuba 0.5.0/sdk/include/mitsuba/core/normal.h
C
gpl-3.0
2,577
/* * This file is part of ADDIS (Aggregate Data Drug Information System). * ADDIS is distributed from http://drugis.org/. * Copyright © 2009 Gert van Valkenhoef, Tommi Tervonen. * Copyright © 2010 Gert van Valkenhoef, Tommi Tervonen, Tijs Zwinkels, * Maarten Jacobs, Hanno Koeslag, Florin Schimbinschi, Ahmad Kamal, Daniel * Reid. * Copyright © 2011 Gert van Valkenhoef, Ahmad Kamal, Daniel Reid, Florin * Schimbinschi. * Copyright © 2012 Gert van Valkenhoef, Daniel Reid, Joël Kuiper, Wouter * Reckman. * Copyright © 2013 Gert van Valkenhoef, Joël Kuiper. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.drugis.addis.util.jaxb; import org.junit.Before; import org.junit.Test; public class TreatmentDefinitionConverterTest { @Before public void setUp() throws Exception { } @Test public void test() { // fail("Not yet implemented"); } }
gertvv/addis
application/src/test/java/org/drugis/addis/util/jaxb/TreatmentDefinitionConverterTest.java
Java
gpl-3.0
1,485
// SuperTux // Copyright (C) 2006 Matthias Braun <matze@braunis.de> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. #include "badguy/stalactite.hpp" #include "audio/sound_manager.hpp" #include "math/random_generator.hpp" #include "object/bullet.hpp" #include "object/player.hpp" #include "sprite/sprite.hpp" #include "supertux/object_factory.hpp" #include "supertux/sector.hpp" static const int SHAKE_RANGE_X = 40; static const float SHAKE_TIME = .8f; static const float SHAKE_RANGE_Y = 400; Stalactite::Stalactite(const ReaderMapping& lisp) : BadGuy(lisp, "images/creatures/stalactite/stalactite.sprite", LAYER_TILES - 1), timer(), state(STALACTITE_HANGING), shake_delta() { countMe = false; set_colgroup_active(COLGROUP_TOUCHABLE); SoundManager::current()->preload("sounds/cracking.wav"); SoundManager::current()->preload("sounds/sizzle.ogg"); SoundManager::current()->preload("sounds/icecrash.ogg"); } void Stalactite::active_update(float elapsed_time) { if(state == STALACTITE_HANGING) { Player* player = get_nearest_player(); if (player) { if(player->get_bbox().p2.x > bbox.p1.x - SHAKE_RANGE_X && player->get_bbox().p1.x < bbox.p2.x + SHAKE_RANGE_X && player->get_bbox().p2.y > bbox.p1.y && player->get_bbox().p1.y < bbox.p2.y + SHAKE_RANGE_Y && Sector::current()->can_see_player(bbox.get_middle())) { timer.start(SHAKE_TIME); state = STALACTITE_SHAKING; SoundManager::current()->play("sounds/cracking.wav", get_pos()); } } } else if(state == STALACTITE_SHAKING) { shake_delta = Vector(graphicsRandom.rand(-3,3), 0); if(timer.check()) { state = STALACTITE_FALLING; physic.enable_gravity(true); set_colgroup_active(COLGROUP_MOVING); } } else if(state == STALACTITE_FALLING) { movement = physic.get_movement(elapsed_time); } } void Stalactite::squish() { state = STALACTITE_SQUISHED; physic.enable_gravity(true); physic.set_velocity_x(0); physic.set_velocity_y(0); set_state(STATE_SQUISHED); sprite->set_action("squished"); SoundManager::current()->play("sounds/icecrash.ogg", get_pos()); set_group(COLGROUP_MOVING_ONLY_STATIC); run_dead_script(); } void Stalactite::collision_solid(const CollisionHit& hit) { if(state == STALACTITE_FALLING) { if (hit.bottom) squish(); } if(state == STALACTITE_SQUISHED) { physic.set_velocity_y(0); } } HitResponse Stalactite::collision_player(Player& player, const CollisionHit& ) { if(state != STALACTITE_SQUISHED) { player.kill(false); } return FORCE_MOVE; } HitResponse Stalactite::collision_badguy(BadGuy& other, const CollisionHit& hit) { if (state == STALACTITE_SQUISHED) return FORCE_MOVE; // ignore other Stalactites if (dynamic_cast<Stalactite*>(&other)) return FORCE_MOVE; if (state != STALACTITE_FALLING) return BadGuy::collision_badguy(other, hit); if (other.is_freezable()) { other.freeze(); } else { other.kill_fall(); } return FORCE_MOVE; } HitResponse Stalactite::collision_bullet(Bullet& bullet, const CollisionHit& ) { if(state == STALACTITE_HANGING) { timer.start(SHAKE_TIME); state = STALACTITE_SHAKING; bullet.remove_me(); if(bullet.get_type() == FIRE_BONUS) SoundManager::current()->play("sounds/sizzle.ogg", get_pos()); SoundManager::current()->play("sounds/cracking.wav", get_pos()); } return FORCE_MOVE; } void Stalactite::kill_fall() { } void Stalactite::draw(DrawingContext& context) { if(get_state() == STATE_INIT || get_state() == STATE_INACTIVE) return; if(state == STALACTITE_SQUISHED) { sprite->draw(context, get_pos(), LAYER_OBJECTS); } else if(state == STALACTITE_SHAKING) { sprite->draw(context, get_pos() + shake_delta, layer); } else { sprite->draw(context, get_pos(), layer); } } void Stalactite::deactivate() { if(state != STALACTITE_HANGING) remove_me(); } /* EOF */
ChristophKuhfuss/supertuxNEAT
src/badguy/stalactite.cpp
C++
gpl-3.0
4,556
/* * test_map.cc - test for classic mission map generator * * Copyright (C) 2016-2017 Jon Lund Steffensen <jonlst@gmail.com> * * This file is part of freeserf. * * freeserf is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * freeserf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with freeserf. If not, see <http://www.gnu.org/licenses/>. */ #include <gtest/gtest.h> #include <iostream> #include <fstream> #include <vector> #include <iterator> #include "src/map.h" #include "src/map-generator.h" #include "src/map-geometry.h" #include "src/random.h" TEST(Map, ClassicMissionMapGenerator) { int map_size = 3; // Read map data from memory dump const char *src_dir = std::getenv("srcdir"); if (src_dir == NULL) src_dir = "."; std::string path = src_dir; path += "/tests/data/map-memdump-1"; std::ifstream is(path.c_str(), std::ifstream::binary); ASSERT_TRUE(is.good()) << "Error opening file! " << path; std::istreambuf_iterator<char> is_start(is), is_end; std::vector<char> data(is_start, is_end); is.close(); // Generate corresponding map const MapGeometry geom(map_size); Map map(geom); Random random = Random("8667715887436237"); ClassicMissionMapGenerator generator(map, random); generator.init(); generator.generate(); // Check that data is matching int expected_size = map.get_rows() * map.get_cols() * 8; EXPECT_EQ(expected_size, data.size()) << "Unexpected data size"; // Find offset for map dump indices int index_offset = 0; for (unsigned int v = map.get_cols(); v != 0; v >>= 1) { index_offset += 1; } for (unsigned int y = 0; y < map.get_rows(); y++) { for (unsigned int x = 0; x < map.get_cols(); x++) { MapPos pos = map.pos(x, y); int index_1 = ((y << index_offset) | x) << 2; int index_2 = ((y << index_offset) | (1 << (index_offset-1)) | x) << 2; // Height int height = data[index_1+1] & 0x1f; EXPECT_EQ(height, generator.get_height(pos)) << "Invalid height at " << x << "," << y << " is " << generator.get_height(pos) << " should have been " << height; // Type up int type_up = (data[index_1+2] & 0xf0) >> 4; EXPECT_EQ(type_up, generator.get_type_up(pos)) << "Invalid type up at " << x << "," << y << " is " << generator.get_type_up(pos) << " should have been " << type_up; // Type down int type_down = data[index_1+2] & 0xf; EXPECT_EQ(type_down, generator.get_type_down(pos)) << "Invalid type down at " << x << "," << y << " is " << generator.get_type_down(pos) << " should have been " << type_down; // Object int object = data[index_1+3] & 0x7f; EXPECT_EQ(object, generator.get_obj(pos)) << "Invalid object at " << x << "," << y << " is " << generator.get_obj(pos) << " should have been " << object; if (type_up <= Map::TerrainWater3) { // Fish resource int fish_amount = data[index_2]; EXPECT_EQ(fish_amount, generator.get_resource_amount(pos)) << "Invalid fish amount at " << x << "," << y << " is " << generator.get_resource_amount(pos) << " should have been " << fish_amount; } else { // Resource type int res_type = (data[index_2] & 0xe0) >> 5; EXPECT_EQ(res_type, generator.get_resource_type(pos)) << "Invalid resource type at " << x << "," << y << " is " << generator.get_resource_type(pos) << " should have been " << res_type; // Resource amount int res_amount = data[index_2] & 0x1f; EXPECT_EQ(res_amount, generator.get_resource_amount(pos)) << "Invalid resource amount at " << x << "," << y << " is " << generator.get_resource_amount(pos) << " should have been " << res_amount; } } } }
freeserf/freeserf
tests/test_map.cc
C++
gpl-3.0
4,339
/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt VS Tools. ** ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ using System; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Debugger.Interop; namespace QtVsTools.Qml.Debug.AD7 { sealed partial class QmlEngine { #region //////////////////// IDebugEngine2 //////////////////////////////////////////////// int IDebugEngine2.SetLocale(ushort wLangID) { return VSConstants.S_OK; } int IDebugEngine2.SetRegistryRoot(string pszRegistryRoot) { return VSConstants.S_OK; } int IDebugEngine2.SetMetric(string pszMetric, object varValue) { return VSConstants.S_OK; } int IDebugEngine2.EnumPrograms(out IEnumDebugPrograms2 ppEnum) { throw new NotImplementedException(); } int IDebugEngine2.SetException(EXCEPTION_INFO[] pException) { throw new NotImplementedException(); } int IDebugEngine2.RemoveSetException(EXCEPTION_INFO[] pException) { throw new NotImplementedException(); } int IDebugEngine2.RemoveAllSetExceptions(ref Guid guidType) { throw new NotImplementedException(); } int IDebugEngine2.DestroyProgram(IDebugProgram2 pProgram) { throw new NotImplementedException(); } int IDebugEngine2.CauseBreak() { throw new NotImplementedException(); } #endregion //////////////////// IDebugEngine2 ///////////////////////////////////////////// } sealed partial class ProgramProvider { #region //////////////////// IDebugProgramProvider2 /////////////////////////////////////// int IDebugProgramProvider2.GetProviderProcessData( enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess) { return VSConstants.E_NOTIMPL; } int IDebugProgramProvider2.GetProviderProgramNode( enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode) { ppProgramNode = null; return VSConstants.E_NOTIMPL; } int IDebugProgramProvider2.WatchForProviderEvents( enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 pEventCallback) { return VSConstants.S_OK; } int IDebugProgramProvider2.SetLocale(ushort wLangID) { return VSConstants.S_OK; } #endregion //////////////////// IDebugProgramProvider2 //////////////////////////////////// } sealed partial class Program { #region //////////////////// IDebugProgramNode2 /////////////////////////////////////////// int IDebugProgramNode2.GetHostName( enum_GETHOSTNAME_TYPE dwHostNameType, out string pbstrHostName) { pbstrHostName = string.Empty; return VSConstants.E_NOTIMPL; } int IDebugProgramNode2.GetHostMachineName_V7(out string pbstrHostMachineName) { throw new NotImplementedException(); } int IDebugProgramNode2.Attach_V7( IDebugProgram2 pMDMProgram, IDebugEventCallback2 pCallback, uint dwReason) { throw new NotImplementedException(); } int IDebugProgramNode2.DetachDebugger_V7() { throw new NotImplementedException(); } #endregion //////////////////// IDebugProgramNode2 //////////////////////////////////////// #region //////////////////// IDebugProgram3 /////////////////////////////////////////////// public int /*IDebugProgram3*/ Terminate() { return VSConstants.S_OK; } public int /*IDebugProgram3*/ CauseBreak() { return VSConstants.S_OK; } public int /*IDebugProgram3*/ CanDetach() { return VSConstants.S_OK; } public int /*IDebugProgram3*/ Detach() { return VSConstants.S_OK; } public int /*IDebugProgram3*/ GetProcess(out IDebugProcess2 ppProcess) { throw new NotImplementedException(); } public int /*IDebugProgram3*/ Attach(IDebugEventCallback2 pCallback) { throw new NotImplementedException(); } public int /*IDebugProgram3*/ GetDebugProperty(out IDebugProperty2 ppProperty) { throw new NotImplementedException(); } public int /*IDebugProgram3*/ Execute() { throw new NotImplementedException(); } public int /*IDebugProgram3*/ GetEngineInfo(out string pbstrEngine, out Guid pguidEngine) { throw new NotImplementedException(); } public int /*IDebugProgram3*/ EnumCodeContexts( IDebugDocumentPosition2 pDocPos, out IEnumDebugCodeContexts2 ppEnum) { throw new NotImplementedException(); } public int /*IDebugProgram3*/ GetMemoryBytes(out IDebugMemoryBytes2 ppMemoryBytes) { throw new NotImplementedException(); } public int /*IDebugProgram3*/ GetDisassemblyStream( enum_DISASSEMBLY_STREAM_SCOPE dwScope, IDebugCodeContext2 pCodeContext, out IDebugDisassemblyStream2 ppDisassemblyStream) { throw new NotImplementedException(); } public int /*IDebugProgram3*/ GetENCUpdate(out object ppUpdate) { throw new NotImplementedException(); } public int /*IDebugProgram3*/ EnumCodePaths(string pszHint, IDebugCodeContext2 pStart, IDebugStackFrame2 pFrame, int fSource, out IEnumCodePaths2 ppEnum, out IDebugCodeContext2 ppSafety) { throw new NotImplementedException(); } public int /*IDebugProgram3*/ WriteDump(enum_DUMPTYPE DUMPTYPE, string pszDumpUrl) { throw new NotImplementedException(); } #endregion //////////////////// IDebugProgram3 //////////////////////////////////////////// #region //////////////////// IDebugModule3 //////////////////////////////////////////////// public int /*IDebugModule3*/ IsUserCode(out int pfUser) { pfUser = 1; return VSConstants.S_OK; } public int /*IDebugModule3*/ ReloadSymbols_Deprecated( string pszUrlToSymbols, out string pbstrDebugMessage) { throw new NotImplementedException(); } public int /*IDebugModule3*/ GetSymbolInfo( enum_SYMBOL_SEARCH_INFO_FIELDS dwFields, MODULE_SYMBOL_SEARCH_INFO[] pinfo) { throw new NotImplementedException(); } public int /*IDebugModule3*/ LoadSymbols() { throw new NotImplementedException(); } public int /*IDebugModule3*/ SetJustMyCodeState(int fIsUserCode) { throw new NotImplementedException(); } #endregion //////////////////// IDebugModule3 ///////////////////////////////////////////// #region //////////////////// IDebugProcess2 /////////////////////////////////////////////// int IDebugProcess2.GetInfo(enum_PROCESS_INFO_FIELDS Fields, PROCESS_INFO[] pProcessInfo) { throw new NotImplementedException(); } int IDebugProcess2.GetName(enum_GETNAME_TYPE gnType, out string pbstrName) { throw new NotImplementedException(); } int IDebugProcess2.GetServer(out IDebugCoreServer2 ppServer) { throw new NotImplementedException(); } int IDebugProcess2.Terminate() { throw new NotImplementedException(); } int IDebugProcess2.EnumPrograms(out IEnumDebugPrograms2 ppEnum) { throw new NotImplementedException(); } int IDebugProcess2.Attach( IDebugEventCallback2 pCallback, Guid[] rgguidSpecificEngines, uint celtSpecificEngines, int[] rghrEngineAttach) { throw new NotImplementedException(); } int IDebugProcess2.GetAttachedSessionName(out string pbstrSessionName) { throw new NotImplementedException(); } #endregion //////////////////// IDebugProcess2 //////////////////////////////////////////// #region //////////////////// IDebugThread2 //////////////////////////////////////////////// int IDebugThread2.SetThreadName(string pszName) { throw new NotImplementedException(); } int IDebugThread2.GetProgram(out IDebugProgram2 ppProgram) { throw new NotImplementedException(); } int IDebugThread2.CanSetNextStatement( IDebugStackFrame2 pStackFrame, IDebugCodeContext2 pCodeContext) { throw new NotImplementedException(); } int IDebugThread2.SetNextStatement(IDebugStackFrame2 pStackFrame, IDebugCodeContext2 pCodeContext) { throw new NotImplementedException(); } int IDebugThread2.Suspend(out uint pdwSuspendCount) { throw new NotImplementedException(); } int IDebugThread2.Resume(out uint pdwSuspendCount) { throw new NotImplementedException(); } int IDebugThread2.GetLogicalThread(IDebugStackFrame2 pStackFrame, out IDebugLogicalThread2 ppLogicalThread) { throw new NotImplementedException(); } int IDebugThread100.GetFlags(out uint pFlags) { throw new NotImplementedException(); } int IDebugThread100.SetFlags(uint flags) { throw new NotImplementedException(); } int IDebugThread100.CanDoFuncEval() { throw new NotImplementedException(); } int IDebugThread100.GetThreadDisplayName(out string bstrDisplayName) { throw new NotImplementedException(); } int IDebugThread100.SetThreadDisplayName(string bstrDisplayName) { throw new NotImplementedException(); } #endregion //////////////////// IDebugThread2 ///////////////////////////////////////////// } sealed partial class CodeContext { #region //////////////////// IDebugDocumentContext2 /////////////////////////////////////// int IDebugDocumentContext2.GetDocument(out IDebugDocument2 ppDocument) { ppDocument = null; return VSConstants.E_FAIL; } int IDebugDocumentContext2.GetSourceRange( TEXT_POSITION[] pBegPosition, TEXT_POSITION[] pEndPosition) { throw new NotImplementedException(); } int IDebugDocumentContext2.Compare( enum_DOCCONTEXT_COMPARE Compare, IDebugDocumentContext2[] rgpDocContextSet, uint dwDocContextSetLen, out uint pdwDocContext) { dwDocContextSetLen = 0; pdwDocContext = 0; return VSConstants.E_NOTIMPL; } int IDebugDocumentContext2.Seek(int nCount, out IDebugDocumentContext2 ppDocContext) { ppDocContext = null; return VSConstants.E_NOTIMPL; } #endregion //////////////////// IDebugDocumentContext2 //////////////////////////////////// #region //////////////////// IDebugCodeContext2 /////////////////////////////////////////// public int /*IDebugCodeContext2*/ Add(ulong dwCount, out IDebugMemoryContext2 ppMemCxt) { throw new NotImplementedException(); } public int /*IDebugCodeContext2*/ Subtract( ulong dwCount, out IDebugMemoryContext2 ppMemCxt) { throw new NotImplementedException(); } public int /*IDebugCodeContext2*/ GetName(out string pbstrName) { throw new NotImplementedException(); } #endregion //////////////////// IDebugCodeContext2 //////////////////////////////////////// } sealed partial class PendingBreakpoint { #region //////////////////// IDebugPendingBreakpoint2 ///////////////////////////////////// int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum) { ppErrorEnum = null; return VSConstants.S_OK; } int IDebugPendingBreakpoint2.Virtualize(int fVirtualize) { return VSConstants.S_OK; } int IDebugPendingBreakpoint2.EnumErrorBreakpoints( enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum) { ppEnum = null; return VSConstants.S_OK; } int IDebugPendingBreakpoint2.SetCondition(BP_CONDITION bpCondition) { throw new NotImplementedException(); } int IDebugPendingBreakpoint2.SetPassCount(BP_PASSCOUNT bpPassCount) { throw new NotImplementedException(); } #endregion //////////////////// IDebugPendingBreakpoint2 ////////////////////////////////// } sealed partial class Breakpoint { #region //////////////////// IDebugBoundBreakpoint2 /////////////////////////////////////// int IDebugBoundBreakpoint2.GetHitCount(out uint pdwHitCount) { pdwHitCount = 0; return VSConstants.E_NOTIMPL; } int IDebugBoundBreakpoint2.SetHitCount(uint dwHitCount) { return VSConstants.E_NOTIMPL; } int IDebugBoundBreakpoint2.SetCondition(BP_CONDITION bpCondition) { throw new NotImplementedException(); } int IDebugBoundBreakpoint2.SetPassCount(BP_PASSCOUNT bpPassCount) { throw new NotImplementedException(); } #endregion //////////////////// IDebugBoundBreakpoint2 //////////////////////////////////// } sealed partial class StackFrame { #region //////////////////// IDebugExpressionContext2 ///////////////////////////////////// int IDebugExpressionContext2.GetName(out string pbstrName) { throw new NotImplementedException(); } #endregion //////////////////// IDebugExpressionContext2 ////////////////////////////////// #region //////////////////// IDebugProperty2 ////////////////////////////////////////////// int IDebugProperty2.GetDerivedMostProperty(out IDebugProperty2 ppDerivedMost) { ppDerivedMost = null; return VSConstants.E_NOTIMPL; } int IDebugProperty2.GetExtendedInfo(ref Guid guidExtendedInfo, out object pExtendedInfo) { pExtendedInfo = null; return VSConstants.E_NOTIMPL; } int IDebugProperty2.GetMemoryBytes(out IDebugMemoryBytes2 ppMemoryBytes) { ppMemoryBytes = null; return VSConstants.E_NOTIMPL; } int IDebugProperty2.GetMemoryContext(out IDebugMemoryContext2 ppMemory) { ppMemory = null; return VSConstants.E_NOTIMPL; } int IDebugProperty2.GetParent(out IDebugProperty2 ppParent) { ppParent = null; return VSConstants.E_NOTIMPL; } int IDebugProperty2.GetPropertyInfo( enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, uint dwTimeout, IDebugReference2[] rgpArgs, uint dwArgCount, DEBUG_PROPERTY_INFO[] pPropertyInfo) { return VSConstants.E_NOTIMPL; } int IDebugProperty2.GetReference(out IDebugReference2 ppReference) { ppReference = null; return VSConstants.E_NOTIMPL; } int IDebugProperty2.GetSize(out uint pdwSize) { pdwSize = 0; return VSConstants.E_NOTIMPL; } int IDebugProperty2.SetValueAsReference( IDebugReference2[] rgpArgs, uint dwArgCount, IDebugReference2 pValue, uint dwTimeout) { return VSConstants.E_NOTIMPL; } int IDebugProperty2.SetValueAsString(string pszValue, uint dwRadix, uint dwTimeout) { return VSConstants.E_NOTIMPL; } #endregion //////////////////// IDebugProperty2 /////////////////////////////////////////// } sealed partial class Property { #region //////////////////// IDebugProperty2 ////////////////////////////////////////////// int IDebugProperty2.SetValueAsReference( IDebugReference2[] rgpArgs, uint dwArgCount, IDebugReference2 pValue, uint dwTimeout) { throw new NotImplementedException(); } int IDebugProperty2.GetDerivedMostProperty(out IDebugProperty2 ppDerivedMost) { throw new NotImplementedException(); } int IDebugProperty2.GetMemoryBytes(out IDebugMemoryBytes2 ppMemoryBytes) { throw new NotImplementedException(); } int IDebugProperty2.GetMemoryContext(out IDebugMemoryContext2 ppMemory) { throw new NotImplementedException(); } int IDebugProperty2.GetSize(out uint pdwSize) { throw new NotImplementedException(); } int IDebugProperty2.GetReference(out IDebugReference2 ppReference) { throw new NotImplementedException(); } int IDebugProperty2.GetExtendedInfo(ref Guid guidExtendedInfo, out object pExtendedInfo) { throw new NotImplementedException(); } #endregion //////////////////// IDebugProperty2 /////////////////////////////////////////// } sealed partial class Expression { #region //////////////////// IDebugExpression2 //////////////////////////////////////////// int IDebugExpression2.Abort() { return VSConstants.E_NOTIMPL; } #endregion //////////////////// IDebugExpression2 ///////////////////////////////////////// } }
qtproject/qt-labs-vstools
src/qtvstools/QML/Debugging/AD7/QmlDebugAD7BoilerPlate.cs
C#
gpl-3.0
19,105
############################################################################## # Build global options # NOTE: Can be overridden externally. # # Compiler options here. ifeq ($(USE_OPT),) USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). ifeq ($(USE_COPT),) USE_COPT = endif # C++ specific options here (added to USE_OPT). ifeq ($(USE_CPPOPT),) USE_CPPOPT = -fno-rtti endif # Enable this if you want the linker to remove unused code and data ifeq ($(USE_LINK_GC),) USE_LINK_GC = yes endif # Linker extra options here. ifeq ($(USE_LDOPT),) USE_LDOPT = endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. ifeq ($(USE_THUMB),) USE_THUMB = yes endif # Enable this if you want to see the full log while compiling. ifeq ($(USE_VERBOSE_COMPILE),) USE_VERBOSE_COMPILE = no endif # If enabled, this option makes the build process faster by not compiling # modules not used in the current configuration. ifeq ($(USE_SMART_BUILD),) USE_SMART_BUILD = yes endif # # Build global options ############################################################################## ############################################################################## # Architecture or project specific options # # Stack size to be allocated to the Cortex-M process stack. This stack is # the stack used by the main() thread. ifeq ($(USE_PROCESS_STACKSIZE),) USE_PROCESS_STACKSIZE = 0x400 endif # Stack size to the allocated to the Cortex-M main/exceptions stack. This # stack is used for processing interrupts and exceptions. ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif # Enables the use of FPU (no, softfp, hard). ifeq ($(USE_FPU),) USE_FPU = no endif # # Architecture or project specific options ############################################################################## ############################################################################## # Project, sources and paths # # Define project name here PROJECT = ch # Imported source files and paths CHIBIOS = ../../../.. # Licensing files. include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk include $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F401RE/board.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk # EX files (optional). include $(CHIBIOS)/os/ex/ST/hts221.mk # Other files (optional). include $(CHIBIOS)/os/hal/lib/streams/streams.mk # Define linker script file here LDSCRIPT= $(STARTUPLD)/STM32F401xE.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. CSRC = $(ALLCSRC) \ $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. ACSRC = # C++ sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. ACPPSRC = # C sources to be compiled in THUMB mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. TCSRC = # C sources to be compiled in THUMB mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. TCPPSRC = # List ASM source files here ASMSRC = $(ALLASMSRC) ASMXSRC = $(ALLXASMSRC) INCDIR = $(ALLINC) $(TESTINC) # # Project, sources and paths ############################################################################## ############################################################################## # Compiler settings # MCU = cortex-m4 #TRGT = arm-elf- TRGT = arm-none-eabi- CC = $(TRGT)gcc CPPC = $(TRGT)g++ # Enable loading with g++ only if you need C++ runtime support. # NOTE: You can use C++ even without C++ support if you are careful. C++ # runtime support makes code size explode. LD = $(TRGT)gcc #LD = $(TRGT)g++ CP = $(TRGT)objcopy AS = $(TRGT)gcc -x assembler-with-cpp AR = $(TRGT)ar OD = $(TRGT)objdump SZ = $(TRGT)size HEX = $(CP) -O ihex BIN = $(CP) -O binary # ARM-specific options here AOPT = # THUMB-specific options here TOPT = -mthumb -DTHUMB # Define C warning options here CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes # Define C++ warning options here CPPWARN = -Wall -Wextra -Wundef # # Compiler settings ############################################################################## ############################################################################## # Start of user section # # List all user C define here, like -D_DEBUG=1 UDEFS = -DCHPRINTF_USE_FLOAT=1 \ -DHTS221_USE_ADVANCED=0 -DHTS221_SHARED_I2C=0 # Define ASM defines here UADEFS = # List all user directories here UINCDIR = # List the user directory to look for the libraries here ULIBDIR = # List all user libraries here ULIBS = # # End of user defines ############################################################################## RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC include $(RULESPATH)/rules.mk
mihadyuk/ChibiOS
testex/STM32/STM32F4xx/I2C-HTS221/Makefile
Makefile
gpl-3.0
6,085
require File.expand_path('../../../../spec_helper', __FILE__) module Pod describe Command::IPC::PodfileJSON do before do Command::IPC::PodfileJSON.any_instance.stubs(:output_pipe).returns(UI) end it 'converts a Podfile to JSON and prints it to STDOUT' do out = run_command('ipc', 'podfile-json', fixture('Podfile')) parsed_hash = JSON.parse(out) parsed_hash.should == { 'target_definitions' => [{ 'name' => 'Pods', 'abstract' => true, 'platform' => 'ios', 'dependencies' => [{ 'SSZipArchive' => ['>= 1'] }, { 'ASIHTTPRequest' => ['~> 1.8.0'] }, 'Reachability', { 'ASIWebPageRequest' => ['< 1.8.2'] }] }] } end end end
mhaslett/getthegist
CocoaPods-master/spec/functional/command/ipc/podfile_json_spec.rb
Ruby
gpl-3.0
664
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. \*---------------------------------------------------------------------------*/ #include "exponentialDiffusivity.H" #include "surfaceFields.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(exponentialDiffusivity, 0); addToRunTimeSelectionTable ( motionDiffusivity, exponentialDiffusivity, Istream ); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::exponentialDiffusivity::exponentialDiffusivity ( const fvMotionSolver& mSolver, Istream& mdData ) : motionDiffusivity(mSolver), alpha_(readScalar(mdData)), basicDiffusivityPtr_(motionDiffusivity::New(mSolver, mdData)) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::exponentialDiffusivity::~exponentialDiffusivity() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::tmp<Foam::surfaceScalarField> Foam::exponentialDiffusivity::operator()() const { return exp(-alpha_/basicDiffusivityPtr_->operator()()); } void Foam::exponentialDiffusivity::correct() { basicDiffusivityPtr_->correct(); } // ************************************************************************* //
OpenCFD/OpenFOAM-1.7.x
src/fvMotionSolver/motionDiffusivity/manipulators/exponential/exponentialDiffusivity.C
C++
gpl-3.0
2,404
--- name: f777 description: Function Nr. 777 returns: varchar --- RETURN f776();
qua-bla/hamsql
test/setups/function-many/functions.d/f777.sql
SQL
gpl-3.0
80
/* Copyright 2009,2010 Daniel Zerbino (dzerbino@soe.ucsc.edu) This file is part of Oases. Oases is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Oases is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Oases. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #include "globals.h" #include "recycleBin.h" #include "utility.h" #include "graph.h" #include "passageMarker.h" #include "readSet.h" #include "locallyCorrectedGraph.h" #include "concatenatedGraph.h" #include "tightString.h" #include "nodeList.h" #include "locus.h" #include "locallyCorrectedGraph2.h" #define ADENINE 0 #define CYTOSINE 1 #define GUANINE 2 #define THYMINE 3 #define BLOCK_SIZE 100000 #define LENGTHCUTOFF 50 static Graph *graph = NULL; struct locus_st { IDnum contigCount; IDnum longContigCount; Node **contigs; Transcript *transcript; }; static void setNodeConnectionStatus(Node * node, boolean status) { Connection *connect; for (connect = getConnection(node); connect; connect = getNextConnection(connect)) if (getNodeStatus (getTwinNode(getConnectionDestination(connect)))) setConnectionStatus(connect, status); } void setLocusConnectionStatus(Locus * locus, boolean status) { IDnum index; for (index = 0; index < locus->contigCount; index++) setNodeConnectionStatus(locus->contigs[index], status); } void removeNodeFromLocus(Node * node) { setNodeStatus(node, false); setNodeConnectionStatus(node, false); } void renumberLocusNodes(Locus * locus) { IDnum index; Node * node; IDnum counter = 0; Node ** newArray; for (index = 0; index < locus->contigCount; index++) { node = locus->contigs[index]; if (!getNodeStatus(node)) { locus->contigs[index] = NULL; counter++; if (getUniqueness(node)) locus->longContigCount--; } } if (counter == 0) return; newArray = callocOrExit(locus->contigCount - counter, Node *); counter = 0; for (index = 0; index < locus->contigCount; index++) { node = locus->contigs[index]; if (node == NULL) counter++; else newArray[index - counter] = node; } free(locus->contigs); locus->contigs = newArray; locus->contigCount -= counter; } Connection *getReverseActiveConnection(Node * node) { Connection *connect; for (connect = getConnection(getTwinNode(node)); connect; connect = getNextConnection(connect)) if (getNodeStatus(getConnectionDestination(connect))) return connect; return NULL; } void simplifyFromNode(Node * node, Locus * locus) { if (getReverseActiveConnection(node)) return; correctGraphLocally2(node, locus); } void setLocusStatus(Locus * locus, boolean status) { IDnum index; for (index = 0; index < locus->contigCount; index++) setSingleNodeStatus(locus->contigs[index], status); } void setDegreeCutoff(int val) { scaffold_setDegreeCutoff(val); } void setPairedThreshold(double pairedThreshold) { scaffold_setPairedThreshold(pairedThreshold); } Transcript * getTranscript(Locus * locus) { return locus->transcript; } void addTranscript(Locus * locus, Transcript * transcript) { setNextTranscript(transcript, locus->transcript); locus->transcript = transcript; } IDnum getContigCount(Locus *locus) { return locus->contigCount; } void setContigCount(Locus *locus, IDnum count) { if (locus->contigs) locus->contigs = reallocOrExit(locus->contigs, count, Node *); else locus->contigs = callocOrExit(count, Node *); } IDnum getLongContigCount(Locus *locus) { return locus->longContigCount; } void setLongContigCount(Locus *locus, IDnum count) { locus->longContigCount = count; locus->contigs = callocOrExit(count, Node *); } Node * getContig(Locus * locus, IDnum index) { return locus->contigs[index]; } void addContig(Locus * locus, Node * contig) { locus->contigs[locus->contigCount++] = contig; } void cleanLocusMemory(Locus * loci, IDnum locusCount) { IDnum index; cleanTranscriptMemory(loci, locusCount); for (index = 0; index < locusCount; index++) free(loci[index].contigs); free(loci); cleanScaffoldMemory(); cleanNodeListMemory(); } void clearLocus(Locus * locus) { locus->contigs = NULL; locus->contigCount = 0; locus->longContigCount = 0; locus->transcript = NULL; } Locus * getLocus(Locus * loci, IDnum index) { return loci + index; } Locus * allocateLocusArray(IDnum size) { return callocOrExit(size, Locus); } Locus * reallocateLocusArray(Locus * locus, IDnum size) { return reallocOrExit(locus, size, Locus); } void exportLocusGraph(FILE * file, IDnum index, Locus * loci) { Locus *locus = getLocus(loci, index); IDnum i; long long nodeID; Connection *connect; Node *node; resetNodeStatus(graph); setLocusStatus(locus, true); fprintf(file, "digraph graph_%lli {\n", (long long) index); fprintf(file, "rankdir=LR\n"); fprintf(file, "style=invis\n"); fprintf(file, "node [shape=point]\n"); fprintf(file, "edge [style=bold, color=red]\n"); for (i = 0; i < getLongContigCount(locus); i++) { nodeID = (long long) getNodeID(getContig(locus, i)); if (nodeID > 0) fprintf(file, "subgraph cluster%li {\n", (long) nodeID); else fprintf(file, "subgraph cluster0%li {\n", (long) -nodeID); fprintf(file, "%lli -> %lli [label=%lli]\n", nodeID, -nodeID, nodeID); fprintf(file, "}\n"); } fprintf(file, "edge [color=black]\n"); for (i = getLongContigCount(locus); i < getContigCount(locus); i++) { nodeID = (long long) getNodeID(getContig(locus, i)); if (nodeID > 0) fprintf(file, "subgraph cluster%li {\n", (long) nodeID); else fprintf(file, "subgraph cluster0%li {\n", (long) -nodeID); fprintf(file, "%lli -> %lli [label=%lli]\n", nodeID, -nodeID, nodeID); fprintf(file, "}\n"); } fprintf(file, "edge [style=normal]\n"); for (i = 0; i < getContigCount(locus); i++) { node = getContig(locus, i); nodeID = getNodeID(node); for (connect = getConnection(node); connect != NULL; connect = getNextConnection(connect)) if (getNodeStatus (getTwinNode (getConnectionDestination(connect)))) { fprintf(file, "%lli -> %lli [label=%lli_%li_%li", -nodeID, (long long) -getNodeID(getConnectionDestination (connect)), (long long) getConnectionDistance(connect), (long) getConnectionPairedCount(connect), (long) getConnectionDirectCount(connect)); if (!getConnectionStatus(connect)) fprintf(file, "XXX"); fprintf(file, "]\n"); } } fprintf(file, "}\n"); setLocusStatus(locus, false); } void revert(Locus * locus) { IDnum index; for (index = 0; index < getContigCount(locus); index++) locus->contigs[index] = getTwinNode(getContig(locus, index)); }
SchulzLab/oases
src/locus.c
C
gpl-3.0
7,160
/***************************************************************************** * * PROJECT: Multi Theft Auto * LICENSE: See LICENSE in the top level directory * FILE: core/CSettings.h * PURPOSE: Header file for in-game settings window class * * Multi Theft Auto is available from http://www.multitheftauto.com/ * *****************************************************************************/ class CSettings; #pragma once #include <core/CCoreInterface.h> #include "CMainMenu.h" #include "CCore.h" #define SKINS_PATH "skins/*" #define CHAT_PRESETS_PATH "mta/config/chatboxpresets.xml" #define CHAT_PRESETS_ROOT "chatboxpresets" //#define SHOWALLSETTINGS struct SKeyBindSection { SKeyBindSection(char* szTitle) { this->currentIndex = 0; this->szTitle = new char[strlen(szTitle) + 1]; this->szOriginalTitle = new char[strlen(szTitle) + 1]; // convert to upper case for (unsigned int i = 0; i < strlen(szTitle); i++) { if (isalpha((uchar)szTitle[i])) this->szTitle[i] = toupper(szTitle[i]); else this->szTitle[i] = szTitle[i]; } this->szTitle[strlen(szTitle)] = '\0'; strcpy(szOriginalTitle, szTitle); this->rowCount = 0; headerItem = NULL; } ~SKeyBindSection() { if (this->szTitle) delete[] this->szTitle; if (szOriginalTitle) delete[] szOriginalTitle; } int currentIndex; // temporarily stores the index while the list is being created char* szTitle; char* szOriginalTitle; int rowCount; class CGUIListItem* headerItem; }; class CColor; enum { FULLSCREEN_STANDARD, FULLSCREEN_BORDERLESS, FULLSCREEN_BORDERLESS_KEEP_RES, FULLSCREEN_BORDERLESS_STRETCHED, }; class CSettings { friend class CCore; public: CSettings(); ~CSettings(); void CreateGUI(); void DestroyGUI(); bool ProcessMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); void Update(); void Initialize(); void SetVisible(bool bVisible); bool IsVisible(); void SetIsModLoaded(bool bLoaded); void LoadData(); bool IsCapturingKey() { return m_bCaptureKey; } void UpdateCaptureAxis(); void UpdateJoypadTab(); void UpdateAudioTab(); void UpdateVideoTab(); void PopulateResolutionComboBox(); void UpdateFullScreenComboBoxEnabled(); void AddKeyBindSection(char* szSectionName); void RemoveKeyBindSection(char* szSectionName); void RemoveAllKeyBindSections(); void RequestNewNickname(); void ShowRestartQuestion(); void ShowDisconnectQuestion(); void TabSkip(bool bBackwards); bool IsActive(); void SetSelectedIndex(unsigned int uiIndex); protected: const static int SecKeyNum = 3; // Number of secondary keys // Keep these protected so we can access them in the event handlers of CClientGame CGUIElement* m_pWindow; CGUITabPanel* m_pTabs; CGUITab* m_pTabInterface; CGUITab* m_pTabBrowser; CGUIButton* m_pButtonOK; CGUIButton* m_pButtonCancel; CGUILabel* m_pLabelNick; CGUIEdit* m_pEditNick; CGUICheckBox* m_pSavePasswords; CGUICheckBox* m_pAutoRefreshBrowser; CGUILabel* m_pVideoGeneralLabel; CGUILabel* m_pVideoResolutionLabel; CGUIComboBox* m_pComboResolution; CGUICheckBox* m_pCheckBoxMipMapping; CGUICheckBox* m_pCheckBoxWindowed; CGUICheckBox* m_pCheckBoxDPIAware = nullptr; CGUICheckBox* m_pCheckBoxHudMatchAspectRatio; CGUICheckBox* m_pCheckBoxMinimize; CGUILabel* m_pMapRenderingLabel; CGUIComboBox* m_pComboFxQuality; CGUILabel* m_pFXQualityLabel; CGUIComboBox* m_pComboAspectRatio; CGUILabel* m_pAspectRatioLabel; CGUICheckBox* m_pCheckBoxVolumetricShadows; CGUICheckBox* m_pCheckBoxDeviceSelectionDialog; CGUICheckBox* m_pCheckBoxShowUnsafeResolutions; CGUICheckBox* m_pCheckBoxAllowScreenUpload; CGUICheckBox* m_pCheckBoxAllowExternalSounds; CGUICheckBox* m_pCheckBoxCustomizedSAFiles; CGUICheckBox* m_pCheckBoxAlwaysShowTransferBox; CGUICheckBox* m_pCheckBoxGrass; CGUICheckBox* m_pCheckBoxHeatHaze; CGUICheckBox* m_pCheckBoxTyreSmokeParticles; CGUICheckBox* m_pCheckBoxHighDetailVehicles; CGUICheckBox* m_pCheckBoxHighDetailPeds; CGUILabel* m_pFieldOfViewLabel; CGUIScrollBar* m_pFieldOfView; CGUILabel* m_pFieldOfViewValueLabel; CGUILabel* m_pDrawDistanceLabel; CGUIScrollBar* m_pDrawDistance; CGUILabel* m_pDrawDistanceValueLabel; CGUILabel* m_pBrightnessLabel; CGUIScrollBar* m_pBrightness; CGUILabel* m_pBrightnessValueLabel; CGUILabel* m_pAnisotropicLabel; CGUIScrollBar* m_pAnisotropic; CGUILabel* m_pAnisotropicValueLabel; CGUIComboBox* m_pComboAntiAliasing; CGUILabel* m_pAntiAliasingLabel; CGUILabel* m_pMapAlphaLabel; CGUIScrollBar* m_pMapAlpha; CGUILabel* m_pMapAlphaValueLabel; CGUILabel* m_pStreamingMemoryLabel; CGUIScrollBar* m_pStreamingMemory; CGUILabel* m_pStreamingMemoryMinLabel; CGUILabel* m_pStreamingMemoryMaxLabel; CGUILabel* m_pStreamingMemoryLabelInfo; CGUIButton* m_pVideoDefButton; CGUILabel* m_pAdvancedSettingDescriptionLabel; CGUILabel* m_pFullscreenStyleLabel; CGUIComboBox* m_pFullscreenStyleCombo; CGUILabel* m_pPriorityLabel; CGUIComboBox* m_pPriorityCombo; CGUILabel* m_pFastClothesLabel; CGUIComboBox* m_pFastClothesCombo; CGUILabel* m_pAudioGeneralLabel; CGUILabel* m_pUserTrackGeneralLabel; CGUILabel* m_pBrowserSpeedLabel; CGUIComboBox* m_pBrowserSpeedCombo; CGUILabel* m_pSingleDownloadLabel; CGUIComboBox* m_pSingleDownloadCombo; CGUILabel* m_pPacketTagLabel; CGUIComboBox* m_pPacketTagCombo; CGUILabel* m_pProgressAnimationLabel; CGUIComboBox* m_pProgressAnimationCombo; CGUILabel* m_pDebugSettingLabel; CGUIComboBox* m_pDebugSettingCombo; CGUILabel* m_pWin8Label; CGUICheckBox* m_pWin8ColorCheckBox; CGUICheckBox* m_pWin8MouseCheckBox; CGUILabel* m_pUpdateBuildTypeLabel; CGUIComboBox* m_pUpdateBuildTypeCombo; CGUILabel* m_pUpdateAutoInstallLabel; CGUIComboBox* m_pUpdateAutoInstallCombo; CGUIButton* m_pButtonUpdate; CGUILabel* m_pAdvancedMiscLabel; CGUILabel* m_pAdvancedUpdaterLabel; CGUILabel* m_pCachePathLabel; CGUILabel* m_pCachePathValue; CGUIButton* m_pCachePathShowButton; CGUILabel* m_pLabelMasterVolume; CGUILabel* m_pLabelRadioVolume; CGUILabel* m_pLabelSFXVolume; CGUILabel* m_pLabelMTAVolume; CGUILabel* m_pLabelVoiceVolume; CGUILabel* m_pLabelMasterVolumeValue; CGUILabel* m_pLabelRadioVolumeValue; CGUILabel* m_pLabelSFXVolumeValue; CGUILabel* m_pLabelMTAVolumeValue; CGUILabel* m_pLabelVoiceVolumeValue; CGUIScrollBar* m_pAudioMasterVolume; CGUIScrollBar* m_pAudioRadioVolume; CGUIScrollBar* m_pAudioSFXVolume; CGUIScrollBar* m_pAudioMTAVolume; CGUIScrollBar* m_pAudioVoiceVolume; CGUILabel* m_pAudioRadioLabel; CGUICheckBox* m_pCheckBoxAudioEqualizer; CGUICheckBox* m_pCheckBoxAudioAutotune; CGUILabel* m_pAudioMuteLabel; CGUICheckBox* m_pCheckBoxMuteMaster; CGUICheckBox* m_pCheckBoxMuteSFX; CGUICheckBox* m_pCheckBoxMuteRadio; CGUICheckBox* m_pCheckBoxMuteMTA; CGUICheckBox* m_pCheckBoxMuteVoice; CGUILabel* m_pAudioUsertrackLabel; CGUICheckBox* m_pCheckBoxUserAutoscan; CGUILabel* m_pLabelUserTrackMode; CGUIComboBox* m_pComboUsertrackMode; CGUIButton* m_pAudioDefButton; CGUIGridList* m_pBindsList; CGUIButton* m_pBindsDefButton; CGUIHandle m_hBind, m_hPriKey, m_hSecKeys[SecKeyNum]; CGUILabel* m_pJoypadName; CGUILabel* m_pJoypadUnderline; CGUIEdit* m_pEditDeadzone; CGUIEdit* m_pEditSaturation; std::vector<CGUILabel*> m_pJoypadLabels; std::vector<CGUIButton*> m_pJoypadButtons; int m_JoypadSettingsRevision; CGUILabel* m_pControlsMouseLabel; CGUICheckBox* m_pInvertMouse; CGUICheckBox* m_pSteerWithMouse; CGUICheckBox* m_pFlyWithMouse; CGUILabel* m_pLabelMouseSensitivity; CGUIScrollBar* m_pMouseSensitivity; CGUILabel* m_pLabelMouseSensitivityValue; CGUILabel* m_pLabelVerticalAimSensitivity; CGUIScrollBar* m_pVerticalAimSensitivity; CGUILabel* m_pLabelVerticalAimSensitivityValue; CGUILabel* m_pControlsJoypadLabel; CGUIScrollPane* m_pControlsInputTypePane; CGUIRadioButton* m_pStandardControls; CGUIRadioButton* m_pClassicControls; CGUIComboBox* m_pInterfaceLanguageSelector; CGUIComboBox* m_pInterfaceSkinSelector; CGUIButton* m_pInterfaceLoadSkin; CGUIComboBox* m_pChatPresets; CGUIButton* m_pChatLoadPreset; CGUIScrollBar* m_pChatRed[Chat::ColorType::MAX]; CGUIScrollBar* m_pChatGreen[Chat::ColorType::MAX]; CGUIScrollBar* m_pChatBlue[Chat::ColorType::MAX]; CGUIScrollBar* m_pChatAlpha[Chat::ColorType::MAX]; CGUILabel* m_pChatRedValue[Chat::ColorType::MAX]; CGUILabel* m_pChatGreenValue[Chat::ColorType::MAX]; CGUILabel* m_pChatBlueValue[Chat::ColorType::MAX]; CGUILabel* m_pChatAlphaValue[Chat::ColorType::MAX]; CGUIStaticImage* m_pChatColorPreview[Chat::ColorType::MAX]; CGUIScrollPane* m_pPaneChatFont; CGUIRadioButton* m_pRadioChatFont[Chat::Font::MAX]; CGUIComboBox* m_pChatHorizontalCombo; CGUIComboBox* m_pChatVerticalCombo; CGUIComboBox* m_pChatTextAlignCombo; CGUIEdit* m_pChatOffsetX; CGUIEdit* m_pChatOffsetY; CGUIEdit* m_pChatLines; CGUIEdit* m_pChatScaleX; CGUIEdit* m_pChatScaleY; CGUIEdit* m_pChatWidth; CGUICheckBox* m_pChatCssBackground; CGUICheckBox* m_pChatNickCompletion; CGUICheckBox* m_pChatCssText; CGUICheckBox* m_pChatTextBlackOutline; CGUIEdit* m_pChatLineLife; CGUIEdit* m_pChatLineFadeout; CGUICheckBox* m_pFlashWindow; CGUICheckBox* m_pTrayBalloon; CGUILabel* m_pLabelBrowserGeneral; CGUICheckBox* m_pCheckBoxRemoteBrowser; CGUICheckBox* m_pCheckBoxRemoteJavascript; CGUILabel* m_pLabelBrowserCustomBlacklist; CGUIEdit* m_pEditBrowserBlacklistAdd; CGUILabel* m_pLabelBrowserBlacklistAdd; CGUIButton* m_pButtonBrowserBlacklistAdd; CGUIGridList* m_pGridBrowserBlacklist; CGUIButton* m_pButtonBrowserBlacklistRemove; CGUILabel* m_pLabelBrowserCustomWhitelist; CGUIEdit* m_pEditBrowserWhitelistAdd; CGUILabel* m_pLabelBrowserWhitelistAdd; CGUIButton* m_pButtonBrowserWhitelistAdd; CGUIGridList* m_pGridBrowserWhitelist; CGUIButton* m_pButtonBrowserWhitelistRemove; bool m_bBrowserListsChanged; bool m_bBrowserListsLoadEnabled; bool OnJoypadTextChanged(CGUIElement* pElement); bool OnAxisSelectClick(CGUIElement* pElement); bool OnAudioDefaultClick(CGUIElement* pElement); bool OnControlsDefaultClick(CGUIElement* pElement); bool OnBindsDefaultClick(CGUIElement* pElement); bool OnVideoDefaultClick(CGUIElement* pElement); bool OnBindsListClick(CGUIElement* pElement); bool OnOKButtonClick(CGUIElement* pElement); bool OnCancelButtonClick(CGUIElement* pElement); bool OnFieldOfViewChanged(CGUIElement* pElement); bool OnDrawDistanceChanged(CGUIElement* pElement); bool OnBrightnessChanged(CGUIElement* pElement); bool OnAnisotropicChanged(CGUIElement* pElement); bool OnMapAlphaChanged(CGUIElement* pElement); bool OnMasterVolumeChanged(CGUIElement* pElement); bool OnRadioVolumeChanged(CGUIElement* pElement); bool OnSFXVolumeChanged(CGUIElement* pElement); bool OnMTAVolumeChanged(CGUIElement* pElement); bool OnVoiceVolumeChanged(CGUIElement* pElement); bool OnMasterMuteMinimizedChanged(CGUIElement* pElement); bool OnRadioMuteMinimizedChanged(CGUIElement* pElement); bool OnSFXMuteMinimizedChanged(CGUIElement* pElement); bool OnMTAMuteMinimizedChanged(CGUIElement* pElement); bool OnVoiceMuteMinimizedChanged(CGUIElement* pElement); bool OnChatRedChanged(CGUIElement* pElement); bool OnChatGreenChanged(CGUIElement* pElement); bool OnChatBlueChanged(CGUIElement* pElement); bool OnChatAlphaChanged(CGUIElement* pElement); bool OnUpdateButtonClick(CGUIElement* pElement); bool OnCachePathShowButtonClick(CGUIElement* pElement); bool OnMouseSensitivityChanged(CGUIElement* pElement); bool OnVerticalAimSensitivityChanged(CGUIElement* pElement); bool OnBrowserBlacklistAdd(CGUIElement* pElement); bool OnBrowserBlacklistRemove(CGUIElement* pElement); bool OnBrowserBlacklistDomainAddFocused(CGUIElement* pElement); bool OnBrowserBlacklistDomainAddDefocused(CGUIElement* pElement); bool OnBrowserWhitelistAdd(CGUIElement* pElement); bool OnBrowserWhitelistRemove(CGUIElement* pElement); bool OnBrowserWhitelistDomainAddFocused(CGUIElement* pElement); bool OnBrowserWhitelistDomainAddDefocused(CGUIElement* pElement); bool OnMouseDoubleClick(CGUIMouseEventArgs Args); bool OnChatLoadPresetClick(CGUIElement* pElement); bool OnLanguageChanged(CGUIElement* pElement); bool OnSkinChanged(CGUIElement* pElement); bool OnFxQualityChanged(CGUIElement* pElement); bool OnVolumetricShadowsClick(CGUIElement* pElement); bool OnAllowScreenUploadClick(CGUIElement* pElement); bool OnAllowExternalSoundsClick(CGUIElement* pElement); bool OnCustomizedSAFilesClick(CGUIElement* pElement); bool ShowUnsafeResolutionsClick(CGUIElement* pElement); bool OnWindowedClick(CGUIElement* pElement); bool OnDPIAwareClick(CGUIElement* pElement); bool OnShowAdvancedSettingDescription(CGUIElement* pElement); bool OnHideAdvancedSettingDescription(CGUIElement* pElement); bool OnTabChanged(CGUIElement* pElement); void ReloadBrowserLists(); private: void CreateInterfaceTabGUI(); void UpdateChatColorPreview(eChatColorType eType); void ProcessKeyBinds(); void ProcessJoypad(); void SaveData(); void LoadSkins(); void LoadChatPresets(); void CreateChatColorTab(eChatColorType eType, const char* szName, CGUITabPanel* pParent); void LoadChatColorFromCVar(eChatColorType eType, const char* szCVar); void LoadChatColorFromString(eChatColorType eType, const std::string& strColor); void SaveChatColor(eChatColorType eType, const char* szCVar); CColor GetChatColorValues(eChatColorType eType); void SetChatColorValues(eChatColorType eType, CColor pColor); int GetMilliseconds(CGUIEdit* pEdit); void SetMilliseconds(CGUIEdit* pEdit, int milliseconds); void ResetGTAVolume(); void SetRadioVolume(float fVolume); void SetSFXVolume(float fVolume); unsigned int m_uiCaptureKey; bool m_bCaptureKey; bool m_bCaptureAxis; bool m_bIsModLoaded; float m_fRadioVolume; float m_fSFXVolume; float m_fOldMasterVolume; float m_fOldRadioVolume; float m_fOldSFXVolume; float m_fOldMTAVolume; float m_fOldVoiceVolume; bool m_bOldMuteMaster; bool m_bOldMuteSFX; bool m_bOldMuteRadio; bool m_bOldMuteMTA; bool m_bOldMuteVoice; bool m_bMuteMaster; bool m_bMuteSFX; bool m_bMuteRadio; bool m_bMuteMTA; bool m_bMuteVoice; CGUIListItem* m_pSelectedBind; DWORD m_dwFrameCount; bool m_bShownVolumetricShadowsWarning; bool m_bShownAllowScreenUploadMessage; bool m_bShownAllowExternalSoundsMessage; int m_iMaxAnisotropic; std::list<SKeyBindSection*> m_pKeyBindSections; };
multitheftauto/mtasa-blue
Client/core/CSettings.h
C
gpl-3.0
16,154
/* * WorldEdit, a Minecraft world manipulation toolkit * Copyright (C) sk89q <http://www.sk89q.com> * Copyright (C) WorldEdit team and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package com.sk89q.worldedit.function.visitor; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; import java.util.Collection; import static com.google.common.base.Preconditions.checkNotNull; /** * Visits adjacent points on the same X-Z plane as long as the points * pass the given mask, and then executes the provided region * function on the entire column. * * <p>This is used by {@code //fill}.</p> */ public class DownwardVisitor extends RecursiveVisitor { private final int baseY; /** * Create a new visitor. * * @param mask the mask * @param function the function * @param baseY the base Y */ public DownwardVisitor(Mask mask, RegionFunction function, int baseY) { super(mask, function); checkNotNull(mask); this.baseY = baseY; Collection<BlockVector3> directions = getDirections(); directions.clear(); directions.add(BlockVector3.UNIT_X); directions.add(BlockVector3.UNIT_MINUS_X); directions.add(BlockVector3.UNIT_Z); directions.add(BlockVector3.UNIT_MINUS_Z); directions.add(BlockVector3.UNIT_MINUS_Y); } @Override protected boolean isVisitable(BlockVector3 from, BlockVector3 to) { int fromY = from.getBlockY(); return (fromY == baseY || to.subtract(from).getBlockY() < 0) && super.isVisitable(from, to); } }
HolodeckOne-Minecraft/WorldEdit
worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java
Java
gpl-3.0
2,287
# shipVelocityBonusMI # # Used by: # Variations of ship: Mammoth (2 of 2) # Ship: Hoarder # Ship: Prowler type = "passive" def handler(fit, ship, context): fit.ship.boostItemAttr("maxVelocity", ship.getModifiedItemAttr("shipBonusMI"), skill="Minmatar Industrial")
Ebag333/Pyfa
eos/effects/shipvelocitybonusmi.py
Python
gpl-3.0
270
/* @license * This file is part of the Game Closure SDK. * * The Game Closure SDK is free software: you can redistribute it and/or modify * it under the terms of the Mozilla Public License v. 2.0 as published by Mozilla. * The Game Closure SDK 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 * Mozilla Public License v. 2.0 for more details. * You should have received a copy of the Mozilla Public License v. 2.0 * along with the Game Closure SDK. If not, see <http://mozilla.org/MPL/2.0/>. */ #ifndef TIMESTEP_TEXT_DATA_H #define TIMESTEP_TEXT_DATA_H #include "core/types.h" #include "core/rgba.h" typedef struct timestep_text_data_t { rgba color; rgba background_color; double horizontal_padding; double vertical_padding; double line_height; char *text_align; char *vertical_align; bool multiline; int font_size; char *font_family; char *font_weight; char *stroke_style; double line_width; char *text; bool shadow; rgba shadow_color; } timestep_text_data; timestep_text_data *timestep_text_data_init(); void timestep_text_data_delete(timestep_text_data *text_data); #endif
hashcube/native-core
timestep/timestep_text_data.h
C
gpl-3.0
1,250
import tip from 'democracyos-tip' import View from '../../view/view.js' import template from './template.jade' export default class Participant extends View { /** * Participants View Class * * @param {Array} participants array of ids * @api public */ constructor (participant, index) { super(template, { participant: participant, index: index }) this.participant = participant this.index = index } switchOn () { tip(this.el[0]) } }
jskye/votebird
lib/site/participant-view/view.js
JavaScript
gpl-3.0
477
-- 160 -- UCColumnA -- Added UNIQUE to column sciname in table food_des CREATE TABLE "data_src" ( "datasrc_id" CHAR(6) NOT NULL, "authors" VARCHAR(100), "title" VARCHAR(100) NOT NULL, "year" INT, "journal" VARCHAR(100), "vol_city" VARCHAR(100), "issue_state" VARCHAR(100), "start_page" VARCHAR(100), "end_page" VARCHAR(100) ) CREATE TABLE "datsrcln" ( "ndb_no" CHAR(5) NOT NULL, "nutr_no" CHAR(3) NOT NULL, "datasrc_id" CHAR(6) NOT NULL ) CREATE TABLE "deriv_cd" ( "deriv_cd" VARCHAR(100) NOT NULL, "derivcd_desc" VARCHAR(100) NOT NULL ) CREATE TABLE "fd_group" ( "fdgrp_cd" CHAR(4) NOT NULL, "fddrp_desc" VARCHAR(100) NOT NULL ) CREATE TABLE "food_des" ( "ndb_no" CHAR(5) NOT NULL, "fdgrp_cd" CHAR(4) NOT NULL, "long_desc" VARCHAR(100) NOT NULL, "shrt_desc" VARCHAR(100) NOT NULL, "comname" VARCHAR(100), "manufacname" VARCHAR(100), "survey" CHAR(1), "ref_desc" VARCHAR(100), "refuse" INT, "sciname" VARCHAR(100) UNIQUE, "n_factor" INT, "pro_factor" INT, "fat_factor" INT, "cho_factor" INT ) CREATE TABLE "footnote" ( "ndb_no" CHAR(5) NOT NULL, "footnt_no" CHAR(4) NOT NULL, "footnt_typ" CHAR(1) NOT NULL, "nutr_no" CHAR(3), "footnt_txt" VARCHAR(100) NOT NULL ) CREATE TABLE "nut_data" ( "ndb_no" CHAR(5) NOT NULL, "nutr_no" CHAR(3) NOT NULL, "nutr_val" INT NOT NULL, "num_data_pts" INT NOT NULL, "std_error" INT, "src_cd" INT NOT NULL, "deriv_cd" VARCHAR(100), "ref_ndb_no" CHAR(5), "add_nutr_mark" CHAR(1), "num_studies" INT, "min" INT, "max" INT, "df" INT, "low_eb" INT, "up_eb" INT, "stat_cmt" VARCHAR(100), "cc" CHAR(1) ) CREATE TABLE "nutr_def" ( "nutr_no" CHAR(3) NOT NULL, "units" VARCHAR(100) NOT NULL, "tagname" VARCHAR(100), "nutrdesc" VARCHAR(100), "num_dec" SMALLINT, "sr_order" INT ) CREATE TABLE "src_cd" ( "src_cd" INT NOT NULL, "srccd_desc" VARCHAR(100) NOT NULL ) CREATE TABLE "weight" ( "ndb_no" CHAR(5) NOT NULL, "seq" CHAR(2) NOT NULL, "amount" INT NOT NULL, "msre_desc" VARCHAR(100) NOT NULL, "gm_wgt" INT NOT NULL, "num_data_pts" INT, "std_dev" INT )
schemaanalyst/schemaanalyst
src/paper/ineffectivemutants/manualevaluation/mutants/Usda_Postgres/160.sql
SQL
gpl-3.0
2,053
using Artexacta.App.Dashboard; using Artexacta.App.Dashboard.BLL; using Artexacta.App.FRTWB; using Artexacta.App.User.BLL; using Artexacta.App.Utilities.SystemMessages; using log4net; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Kpis_KpiDashboard : System.Web.UI.Page { private static readonly ILog log = LogManager.GetLogger("Standard"); protected override void InitializeCulture() { Artexacta.App.Utilities.LanguageUtilities.SetLanguageFromContext(); base.InitializeCulture(); } protected void Page_Load(object sender, EventArgs e) { LoadKpisData(); } public void LoadKpisData() { try { int userId = UserBLL.GetUserIdByUsername(User.Identity.Name); MainKpiDashboardControl.UserId = userId; UserIdHiddenField.Value = userId.ToString(); List<UserDashboard> dashboards = UserDashboardBLL.GetUserDashboards(userId); UserDashboard2Repeater.DataSource = dashboards; UserDashboard2Repeater.DataBind(); UserDashboardRepeater.DataSource = dashboards; UserDashboardRepeater.DataBind(); } catch (Exception ex) { log.Error("Error getting user id of current user", ex); } } protected void UserDashboardDataSource_Selected(object sender, ObjectDataSourceStatusEventArgs e) { if (e.Exception == null) return; log.Error("Error getting KPI for Dashboard", e.Exception); e.ExceptionHandled = true; } protected void UserDashboard2Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { UserControls_Dashboard_KpiDashboard control = (UserControls_Dashboard_KpiDashboard)e.Item.FindControl("UserDashboardControl"); if (control == null) return; try { control.UserId = Convert.ToInt32(UserIdHiddenField.Value); control.LoadKpis(); } catch (Exception ex) { log.Error("Error setting userID to KpiDashboard", ex); } Literal header = (Literal)e.Item.FindControl("HeaderLiteral"); if (header == null) return; try { UserDashboard obj = (UserDashboard)e.Item.DataItem; header.Text = "<div role=\"tabpanel\" class=\"tab-pane\" id=\"t-" + obj.DashboardId + "\">"; } catch (Exception ex) { log.Error("Error getting dataitem from repeater item", ex); } } protected void SaveButton_Click(object sender, EventArgs e) { try { int dashboardId = Convert.ToInt32(SelectedDashboardHiddenField.Value); if (dashboardId == 0) { int userId = Convert.ToInt32(UserIdHiddenField.Value); UserDashboardBLL.InsertUserDashboard(DashboardNameTextBox.Text, userId); } else UserDashboardBLL.UpdateUserDashboard(dashboardId, DashboardNameTextBox.Text); LoadKpisData(); SelectedDashboardHiddenField.Value = "0"; DashboardNameTextBox.Text = ""; ModalTitle.Text = "Add Dashboard"; } catch (Exception ex) { log.Error("Error saving selected dashboard", ex); } } protected void UserDashboard2Repeater_ItemCommand(object source, RepeaterCommandEventArgs e) { if(e.CommandName == "RenameDashboard") { try { ModalTitle.Text = "Rename Dashboard"; int dashboardId = Convert.ToInt32(e.CommandArgument); SelectedDashboardHiddenField.Value = dashboardId.ToString(); UserDashboard obj = UserDashboardBLL.GetUserDashboardById(dashboardId); DashboardNameTextBox.Text = obj.Name; OpenPopup.Value = "true"; } catch (Exception ex) { log.Error("error getting data of user dashboard", ex); } } if (e.CommandName == "DeleteDashboard") { try { int dashboardId = Convert.ToInt32(e.CommandArgument); UserDashboardBLL.DeleteUserDashboard(dashboardId); CurrentTabIndex.Value = "0"; LoadKpisData(); } catch (Exception ex) { log.Error("Error deleting selected dashboard", ex); } } } protected void UserDashboardControl_KpiDeleted() { LoadKpisData(); } }
hipatiait/KPITool
Software/KPITOOLWebApp/Kpis/KpiDashboard.aspx.cs
C#
gpl-3.0
4,756
/* * Twidere - Twitter client for Android * * Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.mariotaku.twidere.activity.support; import android.app.Fragment; import android.app.FragmentTransaction; import android.net.Uri; import android.os.Bundle; import android.view.MenuItem; import android.view.Window; import de.keyboardsurfer.android.widget.crouton.Crouton; import de.keyboardsurfer.android.widget.crouton.CroutonStyle; import org.mariotaku.twidere.R; import org.mariotaku.twidere.fragment.BaseWebViewFragment; public class BrowserActivity extends BaseSupportActivity { private Uri mUri = Uri.parse("about:blank"); @Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case MENU_HOME: finish(); break; } return super.onOptionsItemSelected(item); } @Override protected void onCreate(final Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); getActionBar().setDisplayHomeAsUpEnabled(true); mUri = getIntent().getData(); if (mUri == null) { Crouton.showText(this, R.string.error_occurred, CroutonStyle.ALERT); finish(); return; } final FragmentTransaction ft = getFragmentManager().beginTransaction(); final Fragment fragment = Fragment.instantiate(this, BaseWebViewFragment.class.getName()); final Bundle bundle = new Bundle(); bundle.putString(EXTRA_URI, mUri.toString()); fragment.setArguments(bundle); ft.replace(android.R.id.content, fragment); ft.commit(); } }
0359xiaodong/twidere
src/org/mariotaku/twidere/activity/support/BrowserActivity.java
Java
gpl-3.0
2,258
[![Build Status](https://travis-ci.org/spf13/flag.svg?branch=master)](https://travis-ci.org/spf13/flag) ## Description flag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. flag is compatible with the [GNU extensions to the POSIX recommendations for command-line options][1]. For a more precise description, see the "Command-line flag syntax" section below. [1]: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html flag is available under the same style of BSD license as the Go language, which can be found in the LICENSE file. ## Installation flag is available using the standard `go get` command. Install by running: go get github.com/spf13/flag Run tests by running: go test github.com/spf13/flag ## Usage flag is a drop-in replacement of Go's native flag package. If you import flag under the name "flag" then all code should continue to function with no changes. ``` go import flag "github.com/spf13/flag" ``` There is one exception to this: if you directly instantiate the Flag struct there is one more field "Shorthand" that you will need to set. Most code never instantiates this struct directly, and instead uses functions such as String(), BoolVar(), and Var(), and is therefore unaffected. Define flags using flag.String(), Bool(), Int(), etc. This declares an integer flag, -flagname, stored in the pointer ip, with type *int. ``` go var ip *int = flag.Int("flagname", 1234, "help message for flagname") ``` If you like, you can bind the flag to a variable using the Var() functions. ``` go var flagvar int func init() { flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname") } ``` Or you can create custom flags that satisfy the Value interface (with pointer receivers) and couple them to flag parsing by ``` go flag.Var(&flagVal, "name", "help message for flagname") ``` For such flags, the default value is just the initial value of the variable. After all flags are defined, call ``` go flag.Parse() ``` to parse the command line into the defined flags. Flags may then be used directly. If you're using the flags themselves, they are all pointers; if you bind to variables, they're values. ``` go fmt.Println("ip has value ", *ip) fmt.Println("flagvar has value ", flagvar) ``` There are helpers function to get values later if you have the FlagSet but it was difficult to keep up with all of the the flag pointers in your code. If you have a flag.FlagSet with a flag called 'flagname' of type int you can use GetInt() to get the int value. But notice that 'flagname' must exist and it must be an int. GetString("flagname") will fail. ``` go i, err := flagset.GetInt("flagname") ``` After parsing, the arguments after the flag are available as the slice flag.Args() or individually as flag.Arg(i). The arguments are indexed from 0 through flag.NArg()-1. The flag package also defines some new functions that are not in flag, that give one-letter shorthands for flags. You can use these by appending 'P' to the name of any function that defines a flag. ``` go var ip = flag.IntP("flagname", "f", 1234, "help message") var flagvar bool func init() { flag.BoolVarP("boolname", "b", true, "help message") } flag.VarP(&flagVar, "varname", "v", 1234, "help message") ``` Shorthand letters can be used with single dashes on the command line. Boolean shorthand flags can be combined with other shorthand flags. The default set of command-line flags is controlled by top-level functions. The FlagSet type allows one to define independent sets of flags, such as to implement subcommands in a command-line interface. The methods of FlagSet are analogous to the top-level functions for the command-line flag set. ## Setting no option default values for flags After you create a flag it is possible to set the flag.NoOptDefVal for the given flag. Doing this changes the meaning of the flag slightly. If a flag has a NoOptDefVal and the flag is set on the command line without an option the flag will be set to the NoOptDefVal. For example given: ``` go var ip = flag.IntP("flagname", "f", 1234, "help message") flag.Lookup("flagname").NoOptDefVal = "4321" ``` Would result in something like | Parsed Arguments | Resulting Value | | ------------- | ------------- | | --flagname=1357 | ip=1357 | | --flagname | ip=4321 | | [nothing] | ip=1234 | ## Command line flag syntax ``` --flag // boolean flags, or flags with no option default values --flag x // only on flags without a default value --flag=x ``` Unlike the flag package, a single dash before an option means something different than a double dash. Single dashes signify a series of shorthand letters for flags. All but the last shorthand letter must be boolean flags or a flag with a default value ``` // boolean or flags where the 'no option default value' is set -f -f=true -abc but -b true is INVALID // non-boolean and flags without a 'no option default value' -n 1234 -n=1234 -n1234 // mixed -abcs "hello" -absd="hello" -abcs1234 ``` Flag parsing stops after the terminator "--". Unlike the flag package, flags can be interspersed with arguments anywhere on the command line before this terminator. Integer flags accept 1234, 0664, 0x1234 and may be negative. Boolean flags (in their long form) accept 1, 0, t, f, true, false, TRUE, FALSE, True, False. Duration flags accept any input valid for time.ParseDuration. ## Mutating or "Normalizing" Flag names It is possible to set a custom flag name 'normalization function.' It allows flag names to be mutated both when created in the code and when used on the command line to some 'normalized' form. The 'normalized' form is used for comparison. Two examples of using the custom normalization func follow. **Example #1**: You want -, _, and . in flags to compare the same. aka --my-flag == --my_flag == --my.flag ``` go func wordSepNormalizeFunc(f *flag.FlagSet, name string) flag.NormalizedName { from := []string{"-", "_"} to := "." for _, sep := range from { name = strings.Replace(name, sep, to, -1) } return flag.NormalizedName(name) } myFlagSet.SetNormalizeFunc(wordSepNormalizeFunc) ``` **Example #2**: You want to alias two flags. aka --old-flag-name == --new-flag-name ``` go func aliasNormalizeFunc(f *flag.FlagSet, name string) flag.NormalizedName { switch name { case "old-flag-name": name = "new-flag-name" break } return flag.NormalizedName(name) } myFlagSet.SetNormalizeFunc(aliasNormalizeFunc) ``` ## Deprecating a flag or its shorthand It is possible to deprecate a flag, or just its shorthand. Deprecating a flag/shorthand hides it from help text and prints a usage message when the deprecated flag/shorthand is used. **Example #1**: You want to deprecate a flag named "badflag" as well as inform the users what flag they should use instead. ```go // deprecate a flag by specifying its name and a usage message flags.MarkDeprecated("badflag", "please use --good-flag instead") ``` This hides "badflag" from help text, and prints `Flag --badflag has been deprecated, please use --good-flag instead` when "badflag" is used. **Example #2**: You want to keep a flag name "noshorthandflag" but deprecate its shortname "n". ```go // deprecate a flag shorthand by specifying its flag name and a usage message flags.MarkShorthandDeprecated("noshorthandflag", "please use --noshorthandflag only") ``` This hides the shortname "n" from help text, and prints `Flag shorthand -n has been deprecated, please use --noshorthandflag only` when the shorthand "n" is used. Note that usage message is essential here, and it should not be empty. ## Hidden flags It is possible to mark a flag as hidden, meaning it will still function as normal, however will not show up in usage/help text. **Example**: You have a flag named "secretFlag" that you need for internal use only and don't want it showing up in help text, or for its usage text to be available. ```go // hide a flag by specifying its name flags.MarkHidden("secretFlag") ``` ## More info You can see the full reference documentation of the flag package [at godoc.org][3], or through go's standard documentation system by running `godoc -http=:6060` and browsing to [http://localhost:6060/pkg/github.com/ogier/flag][2] after installation. [2]: http://localhost:6060/pkg/github.com/ogier/flag [3]: http://godoc.org/github.com/ogier/flag
Mohammed90/go-coreutils
internal/flag/README.md
Markdown
gpl-3.0
8,420
/* Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments Copyright (C) ITsysCOM GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/> */ package config import ( "flag" "github.com/cgrates/cgrates/utils" "testing" ) var testLocal = flag.Bool("local", false, "Perform the tests only on local test environment, disabled by default.") // This flag will be passed here via "go test -local" args var mfCgrCfg *CGRConfig func TestMfInitConfig(t *testing.T) { if !*testLocal { return } var err error if mfCgrCfg, err = NewCGRConfigFromFolder("/usr/share/cgrates/conf/samples/multifiles"); err != nil { t.Fatal("Got config error: ", err.Error()) } } func TestMfGeneralItems(t *testing.T) { if !*testLocal { return } if mfCgrCfg.DefaultReqType != utils.META_PSEUDOPREPAID { // Twice reconfigured t.Error("DefaultReqType: ", mfCgrCfg.DefaultReqType) } if mfCgrCfg.DefaultCategory != "call" { // Not configred, should be inherited from default t.Error("DefaultCategory: ", mfCgrCfg.DefaultCategory) } } func TestMfCdreDefaultInstance(t *testing.T) { if !*testLocal { return } for _, prflName := range []string{"*default", "export1"} { if _, hasIt := mfCgrCfg.CdreProfiles[prflName]; !hasIt { t.Error("Cdre does not contain profile ", prflName) } } prfl := "*default" if mfCgrCfg.CdreProfiles[prfl].CdrFormat != "csv" { t.Error("Default instance has cdrFormat: ", mfCgrCfg.CdreProfiles[prfl].CdrFormat) } if mfCgrCfg.CdreProfiles[prfl].DataUsageMultiplyFactor != 1024.0 { t.Error("Default instance has cdrFormat: ", mfCgrCfg.CdreProfiles[prfl].DataUsageMultiplyFactor) } if len(mfCgrCfg.CdreProfiles[prfl].HeaderFields) != 0 { t.Error("Default instance has number of header fields: ", len(mfCgrCfg.CdreProfiles[prfl].HeaderFields)) } if len(mfCgrCfg.CdreProfiles[prfl].ContentFields) != 12 { t.Error("Default instance has number of content fields: ", len(mfCgrCfg.CdreProfiles[prfl].ContentFields)) } if mfCgrCfg.CdreProfiles[prfl].ContentFields[2].Tag != "Direction" { t.Error("Unexpected headerField value: ", mfCgrCfg.CdreProfiles[prfl].ContentFields[2].Tag) } } func TestMfCdreExport1Instance(t *testing.T) { if !*testLocal { return } prfl := "export1" if mfCgrCfg.CdreProfiles[prfl].CdrFormat != "csv" { t.Error("Export1 instance has cdrFormat: ", mfCgrCfg.CdreProfiles[prfl].CdrFormat) } if mfCgrCfg.CdreProfiles[prfl].DataUsageMultiplyFactor != 1.0 { t.Error("Export1 instance has DataUsageMultiplyFormat: ", mfCgrCfg.CdreProfiles[prfl].DataUsageMultiplyFactor) } if mfCgrCfg.CdreProfiles[prfl].CostRoundingDecimals != 3.0 { t.Error("Export1 instance has cdrFormat: ", mfCgrCfg.CdreProfiles[prfl].CostRoundingDecimals) } if len(mfCgrCfg.CdreProfiles[prfl].HeaderFields) != 2 { t.Error("Export1 instance has number of header fields: ", len(mfCgrCfg.CdreProfiles[prfl].HeaderFields)) } if mfCgrCfg.CdreProfiles[prfl].HeaderFields[1].Tag != "RunId" { t.Error("Unexpected headerField value: ", mfCgrCfg.CdreProfiles[prfl].HeaderFields[1].Tag) } if len(mfCgrCfg.CdreProfiles[prfl].ContentFields) != 9 { t.Error("Export1 instance has number of content fields: ", len(mfCgrCfg.CdreProfiles[prfl].ContentFields)) } if mfCgrCfg.CdreProfiles[prfl].ContentFields[2].Tag != "Account" { t.Error("Unexpected headerField value: ", mfCgrCfg.CdreProfiles[prfl].ContentFields[2].Tag) } }
razvancrainea/cgrates
config/multifiles_local_test.go
GO
gpl-3.0
3,949
![GitHub Actions](https://github.com/ardupilot/MAVProxy/actions/workflows/windows_build.yml/badge.svg) MAVProxy This is a MAVLink ground station written in python. Please see https://ardupilot.org/mavproxy/index.html for more information This ground station was developed as part of the CanberraUAV OBC team entry License ------- MAVProxy is released under the GNU General Public License v3 or later Maintainers ----------- The best way to discuss MAVProxy with the maintainers is to join the mavproxy channel on ArduPilot discord at https://ardupilot.org/discord Lead Developers: Andrew Tridgell and Peter Barker Windows Maintainer: Stephen Dade MacOS Maintainer: Rhys Mainwaring
ArduPilot/MAVProxy
README.md
Markdown
gpl-3.0
694
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Group.is_open' db.delete_column('askbot_group', 'is_open') def backwards(self, orm): # Adding field 'Group.is_open' db.add_column('askbot_group', 'is_open', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False) models = { 'askbot.activity': { 'Meta': {'object_name': 'Activity', 'db_table': "u'activity'"}, 'active_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'activity_type': ('django.db.models.fields.SmallIntegerField', [], {}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_auditted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), 'exercise': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['askbot.Post']", 'null': 'True'}), 'receiving_users': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'received_activity'", 'symmetrical': 'False', 'to': "orm['auth.User']"}), 'recipients': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'incoming_activity'", 'symmetrical': 'False', 'through': "orm['askbot.ActivityAuditStatus']", 'to': "orm['auth.User']"}), 'summary': ('django.db.models.fields.TextField', [], {'default': "''"}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, 'askbot.activityauditstatus': { 'Meta': {'unique_together': "(('user', 'activity'),)", 'object_name': 'ActivityAuditStatus'}, 'activity': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['askbot.Activity']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'status': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, 'askbot.anonymousproblem': { 'Meta': {'object_name': 'AnonymousProblem'}, 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), 'exercise': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'anonymous_problems'", 'to': "orm['askbot.Post']"}), 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), 'text': ('django.db.models.fields.TextField', [], {}), 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, 'askbot.anonymousexercise': { 'Meta': {'object_name': 'AnonymousExercise'}, 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), 'is_anonymous': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), 'text': ('django.db.models.fields.TextField', [], {}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}), 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, 'askbot.askwidget': { 'Meta': {'object_name': 'AskWidget'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'include_text_field': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'inner_style': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'outer_style': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'tag': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['askbot.Tag']", 'null': 'True', 'blank': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, 'askbot.award': { 'Meta': {'object_name': 'Award', 'db_table': "u'award'"}, 'awarded_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'badge': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_badge'", 'to': "orm['askbot.BadgeData']"}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'notified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_user'", 'to': "orm['auth.User']"}) }, 'askbot.badgedata': { 'Meta': {'ordering': "('slug',)", 'object_name': 'BadgeData'}, 'awarded_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'awarded_to': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'badges'", 'symmetrical': 'False', 'through': "orm['askbot.Award']", 'to': "orm['auth.User']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}) }, 'askbot.draftproblem': { 'Meta': {'object_name': 'DraftProblem'}, 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'draft_problems'", 'to': "orm['auth.User']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'text': ('django.db.models.fields.TextField', [], {'null': 'True'}), 'thread': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'draft_problems'", 'to': "orm['askbot.Thread']"}) }, 'askbot.draftexercise': { 'Meta': {'object_name': 'DraftExercise'}, 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125', 'null': 'True'}), 'text': ('django.db.models.fields.TextField', [], {'null': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True'}) }, 'askbot.emailfeedsetting': { 'Meta': {'unique_together': "(('subscriber', 'feed_type'),)", 'object_name': 'EmailFeedSetting'}, 'added_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'feed_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), 'frequency': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '8'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'reported_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), 'subscriber': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notification_subscriptions'", 'to': "orm['auth.User']"}) }, 'askbot.favoriteexercise': { 'Meta': {'object_name': 'FavoriteExercise', 'db_table': "u'favorite_exercise'"}, 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'thread': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['askbot.Thread']"}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_favorite_exercises'", 'to': "orm['auth.User']"}) }, 'askbot.group': { 'Meta': {'object_name': 'Group', '_ormbases': ['auth.Group']}, 'group_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.Group']", 'unique': 'True', 'primary_key': 'True'}), 'logo_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True'}), 'moderate_email': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'openness': ('django.db.models.fields.SmallIntegerField', [], {'default': '2'}), 'preapproved_email_domains': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True', 'blank': 'True'}), 'preapproved_emails': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True', 'blank': 'True'}) }, 'askbot.markedtag': { 'Meta': {'object_name': 'MarkedTag'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'reason': ('django.db.models.fields.CharField', [], {'max_length': '16'}), 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_selections'", 'to': "orm['askbot.Tag']"}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tag_selections'", 'to': "orm['auth.User']"}) }, 'askbot.post': { 'Meta': {'object_name': 'Post'}, 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'approved': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'posts'", 'to': "orm['auth.User']"}), 'comment_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_posts'", 'null': 'True', 'to': "orm['auth.User']"}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'group_posts'", 'symmetrical': 'False', 'through': "orm['askbot.PostToGroup']", 'to': "orm['askbot.Group']"}), 'html': ('django.db.models.fields.TextField', [], {'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_anonymous': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'last_edited_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_edited_posts'", 'null': 'True', 'to': "orm['auth.User']"}), 'locked': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'locked_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'locked_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locked_posts'", 'null': 'True', 'to': "orm['auth.User']"}), 'offensive_flag_count': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), 'old_problem_id': ('django.db.models.fields.PositiveIntegerField', [], {'default': 'None', 'unique': 'True', 'null': 'True', 'blank': 'True'}), 'old_comment_id': ('django.db.models.fields.PositiveIntegerField', [], {'default': 'None', 'unique': 'True', 'null': 'True', 'blank': 'True'}), 'old_exercise_id': ('django.db.models.fields.PositiveIntegerField', [], {'default': 'None', 'unique': 'True', 'null': 'True', 'blank': 'True'}), 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comments'", 'null': 'True', 'to': "orm['askbot.Post']"}), 'post_type': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), 'text': ('django.db.models.fields.TextField', [], {'null': 'True'}), 'thread': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'posts'", 'null': 'True', 'blank': 'True', 'to': "orm['askbot.Thread']"}), 'vote_down_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'vote_up_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'wikified_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) }, 'askbot.postflagreason': { 'Meta': {'object_name': 'PostFlagReason'}, 'added_at': ('django.db.models.fields.DateTimeField', [], {}), 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), 'details': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'post_reject_reasons'", 'to': "orm['askbot.Post']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '128'}) }, 'askbot.postrevision': { 'Meta': {'ordering': "('-revision',)", 'unique_together': "(('post', 'revision'),)", 'object_name': 'PostRevision'}, 'approved': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), 'approved_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'approved_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'postrevisions'", 'to': "orm['auth.User']"}), 'by_email': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'email_address': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_anonymous': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'post': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'revisions'", 'null': 'True', 'to': "orm['askbot.Post']"}), 'revised_at': ('django.db.models.fields.DateTimeField', [], {}), 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}), 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}), 'tagnames': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '125', 'blank': 'True'}), 'text': ('django.db.models.fields.TextField', [], {}), 'title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '300', 'blank': 'True'}) }, 'askbot.posttogroup': { 'Meta': {'unique_together': "(('post', 'group'),)", 'object_name': 'PostToGroup', 'db_table': "'askbot_post_groups'"}, 'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['askbot.Group']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'post': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['askbot.Post']"}) }, 'askbot.exerciseview': { 'Meta': {'object_name': 'ExerciseView'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'exercise': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'viewed'", 'to': "orm['askbot.Post']"}), 'when': ('django.db.models.fields.DateTimeField', [], {}), 'who': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'exercise_views'", 'to': "orm['auth.User']"}) }, 'askbot.exercisewidget': { 'Meta': {'object_name': 'ExerciseWidget'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'order_by': ('django.db.models.fields.CharField', [], {'default': "'-added_at'", 'max_length': '18'}), 'exercise_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '7'}), 'search_query': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'null': 'True', 'blank': 'True'}), 'style': ('django.db.models.fields.TextField', [], {'default': '"\\n@import url(\'http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:300,400,700\');\\nbody {\\n overflow: hidden;\\n}\\n\\n#container {\\n width: 200px;\\n height: 350px;\\n}\\nul {\\n list-style: none;\\n padding: 5px;\\n margin: 5px;\\n}\\nli {\\n border-bottom: #CCC 1px solid;\\n padding-bottom: 5px;\\n padding-top: 5px;\\n}\\nli:last-child {\\n border: none;\\n}\\na {\\n text-decoration: none;\\n color: #464646;\\n font-family: \'Yanone Kaffeesatz\', sans-serif;\\n font-size: 15px;\\n}\\n"', 'blank': 'True'}), 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '50'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, 'askbot.replyaddress': { 'Meta': {'object_name': 'ReplyAddress'}, 'address': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '25'}), 'allowed_from_email': ('django.db.models.fields.EmailField', [], {'max_length': '150'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'post': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'reply_addresses'", 'null': 'True', 'to': "orm['askbot.Post']"}), 'reply_action': ('django.db.models.fields.CharField', [], {'default': "'auto_problem_or_comment'", 'max_length': '32'}), 'response_post': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'edit_addresses'", 'null': 'True', 'to': "orm['askbot.Post']"}), 'used_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, 'askbot.repute': { 'Meta': {'object_name': 'Repute', 'db_table': "u'repute'"}, 'comment': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'negative': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), 'positive': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), 'exercise': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['askbot.Post']", 'null': 'True', 'blank': 'True'}), 'reputation': ('django.db.models.fields.IntegerField', [], {'default': '1'}), 'reputation_type': ('django.db.models.fields.SmallIntegerField', [], {}), 'reputed_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, 'askbot.tag': { 'Meta': {'ordering': "('-used_count', 'name')", 'object_name': 'Tag', 'db_table': "u'tag'"}, 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'created_tags'", 'to': "orm['auth.User']"}), 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_tags'", 'null': 'True', 'to': "orm['auth.User']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), 'status': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'}), 'suggested_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'suggested_tags'", 'symmetrical': 'False', 'to': "orm['auth.User']"}), 'tag_wiki': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'described_tag'", 'unique': 'True', 'null': 'True', 'to': "orm['askbot.Post']"}), 'used_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) }, 'askbot.thread': { 'Meta': {'object_name': 'Thread'}, 'accepted_problem': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['askbot.Post']"}), 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'problem_accepted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'problem_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'approved': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), 'close_reason': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}), 'closed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'closed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'closed_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), 'favorited_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'unused_favorite_threads'", 'symmetrical': 'False', 'through': "orm['askbot.FavoriteExercise']", 'to': "orm['auth.User']"}), 'favourite_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'followed_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'followed_threads'", 'symmetrical': 'False', 'to': "orm['auth.User']"}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'group_threads'", 'symmetrical': 'False', 'db_table': "'askbot_thread_groups'", 'to': "orm['askbot.Group']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'last_activity_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_activity_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'unused_last_active_in_threads'", 'to': "orm['auth.User']"}), 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'threads'", 'symmetrical': 'False', 'to': "orm['askbot.Tag']"}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}), 'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) }, 'askbot.vote': { 'Meta': {'unique_together': "(('user', 'voted_post'),)", 'object_name': 'Vote', 'db_table': "u'vote'"}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'votes'", 'to': "orm['auth.User']"}), 'vote': ('django.db.models.fields.SmallIntegerField', [], {}), 'voted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'voted_post': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'votes'", 'to': "orm['askbot.Post']"}) }, 'auth.group': { 'Meta': {'object_name': 'Group'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) }, 'auth.permission': { 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) }, 'auth.user': { 'Meta': {'object_name': 'User'}, 'about': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'avatar_type': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '1'}), 'bronze': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), 'consecutive_days_visit_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'country': ('django_countries.fields.CountryField', [], {'max_length': '2', 'blank': 'True'}), 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), 'display_tag_filter_strategy': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'email_isvalid': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'email_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}), 'email_signature': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'email_tag_filter_strategy': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'gold': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), 'gravatar': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'ignored_tags': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'interesting_tags': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_fake': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'location': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), 'new_response_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'exercises_per_page': ('django.db.models.fields.SmallIntegerField', [], {'default': '10'}), 'real_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), 'reputation': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}), 'seen_response_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'show_country': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'show_marked_tags': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'silver': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), 'status': ('django.db.models.fields.CharField', [], {'default': "'w'", 'max_length': '2'}), 'subscribed_tags': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), 'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}) }, 'contenttypes.contenttype': { 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) } } complete_apps = ['askbot']
maxwward/SCOPEBak
askbot/migrations/0141_auto__del_field_group_is_open.py
Python
gpl-3.0
32,000
/*! * VisualEditor ContentEditable AlignableNode class. * * @copyright 2011-2016 VisualEditor Team and others; see http://ve.mit-license.org */ /** * ContentEditable Alignable node. * * @class * @abstract * @extends ve.ce.ClassAttributeNode * * @constructor */ ve.ce.AlignableNode = function VeCeAlignableNode() { // Parent constructor ve.ce.AlignableNode.super.apply( this, arguments ); this.align = null; }; /* Inheritance */ OO.inheritClass( ve.ce.AlignableNode, ve.ce.ClassAttributeNode ); /* Events */ /** * @event align * @param {string} align New alignment */ /** * @inheritdoc */ ve.ce.AlignableNode.prototype.updateAttributeClasses = function () { var align; ve.ce.AlignableNode.super.prototype.updateAttributeClasses.apply( this, arguments ); align = this.model.getAttribute( 'align' ); if ( align && align !== this.align ) { this.emit( 'align', align ); this.align = align; } };
Facerafter/starcitizen-tools
extensions/VisualEditor/lib/ve/src/ce/ve.ce.AlignableNode.js
JavaScript
gpl-3.0
926
CREATE OR REPLACE FUNCTION fct_get_price_for_pricegroup( sModul varchar, iModulID integer, iArticleID integer) returns float AS ' DECLARE sSql text ; fPrice float ; iAddressID integer ; recData record ; pricegroupID integer ; BEGIN fPrice := 0.00 ; IF sModul = ''grave'' THEN sSql := '' select pricegroup1, pricegroup2,pricegroup3,pricegroup4,pricegroup_none from grave where grave.id = '' || iModulID ; ELSEIF sModul = ''orderposition'' THEN sSql := '' select pricegroup1, pricegroup2,pricegroup3,pricegroup4,pricegroup_none from orderbook where id = '' || iModulID ; END IF ; execute(sSql) into recData ; if recData.pricegroup1 IS NULL then pricegroupID :=5 ; ELSEIF recData.pricegroup1 = TRUE THEN pricegroupID :=1 ; ELSEIF recData.pricegroup2 = TRUE THEN pricegroupID :=2 ; ELSEIF recData.pricegroup3 = TRUE THEN pricegroupID :=3 ; ELSEIF recData.pricegroup4 = TRUE THEN pricegroupID :=4 ; ELSEIF recData.pricegroup_none = TRUE THEN pricegroupID :=5 ; ELSE pricegroupID :=5 ; END IF ; raise notice '' pricegroup id = % '',pricegroupID ; IF pricegroupID = 5 then IF sModul = ''grave'' THEN select into recData addressid from grave where id = iModulID ; -- raise notice '' address id = % '',recData.addressid ; iAddressID = recData.addressid ; ELSEIF sModul = ''orderposition'' THEN select into recData addressnumber from orderbook where orderbook.id = iModulID ; -- raise notice '' address id = % '',recData.addressnumber; iAddressID = recData.addressnumber ; END IF ; select into recData pricegroup1, pricegroup2,pricegroup3,pricegroup4,pricegroup_none from addresses_misc where address_id = iAddressID ; -- raise notice '' pricegroup by address = %, % , %'',recData.pricegroup1, recData.pricegroup2,recData.pricegroup3; if recData.pricegroup1 IS NULL then pricegroupID :=1 ; ELSEIF recData.pricegroup1 = TRUE THEN pricegroupID :=1 ; ELSEIF recData.pricegroup2 = TRUE THEN pricegroupID :=2 ; ELSEIF recData.pricegroup3 = TRUE THEN pricegroupID :=3 ; ELSEIF recData.pricegroup4 = TRUE THEN pricegroupID :=4 ; ELSEIF recData.pricegroup_none = TRUE THEN pricegroupID :=5 ; ELSE pricegroupID :=1 ; END IF ; END IF ; -- raise notice '' pricegroup id last value = % '',pricegroupID ; if pricegroupID < 5 then sSql = ''select sellingprice''||pricegroupID||'' as price from articles where id = '' || iArticleID ; -- raise notice '' sql = % '',sSql ; for recData in execute sSql LOOP END LOOP ; -- raise notice '' price = % '', recData.price ; fPrice := recData.price ; if fPrice IS NULL THEN fPrice := 0.00 ; END IF ; -- raise notice '' price = % '',fPrice ; END IF ; return fPrice ; END ; ' LANGUAGE 'plpgsql'; CREATE OR REPLACE FUNCTION fct_get_new_tax_vat_for_article_1(iArticleID int) returns float AS ' DECLARE sSql text ; r0 record ; iNewTaxVat int ; sNewTaxVat text ; iMGroup record ; aMGroups int[] ; aMGroupsString text[] ; sMGroups text ; iMGroupsTaxVat int ; iClient int ; i int ; fTaxVat float ; BEGIN iNewTaxVat = -1; fTaxVat := 0.00 ; iClient = fct_getUserDataClient( ) ; sMGroups = fct_get_config_option(iClient,''clients.ini'', ''CLIENT_'' || iClient, ''order_grave_materialgroups_for_tax_vat_1'') ; sNewTaxVat = fct_get_config_option(iClient,''clients.ini'', ''CLIENT_'' || iClient, ''order_grave_materialgroups_new_tax_vat_id_1'') ; sSql := ''select articles.material_group from articles where articles.id = '' || iArticleID ; execute(sSql) into r0 ; aMGroupsString = string_to_array(sMGroups, '','') ; IF r0.material_group IS NOT NULL THEN FOR i IN 1..array_length(aMGroupsString, 1) LOOP IF r0.material_group = aMGroupsString[i]::INTEGER THEN iNewTaxVat =sNewTaxVat::integer ; END IF ; END LOOP; END IF ; -- IF iNewTaxVat > -1 THEN -- select into fTaxVat vat_value from tax_vat where id = iNewTaxVat ; -- END IF ; if iNewTaxVat = -1 then iNewTaxVat = 0 ; end if ; return iNewTaxVat::float; END ; ' LANGUAGE 'plpgsql'; CREATE OR REPLACE FUNCTION fct_get_taxvat_for_article( iArticleID integer) returns float AS ' DECLARE sSql text ; fTaxVat float ; iTaxVatArticle integer ; rData record ; BEGIN fTaxVat := 0.00; select into rData tax_vat_id from articles where id = iArticleID ; IF rData.tax_vat_id IS NULL then iTaxVatArticle = 0; ELSE iTaxVatArticle = rData.tax_vat_id ; END IF ; IF iTaxVatArticle= 0 THEN select into rData material_group.tax_vat from articles,material_group where articles.id = iArticleID and articles.material_group = material_group.id ; IF rData.tax_vat IS NULL then iTaxVatArticle = 0; ELSE iTaxVatArticle = rData.tax_vat ; END IF ; END IF ; IF iTaxVatArticle>0 then select into rData vat_value from tax_vat where id = iTaxVatArticle; fTaxVat = rData.vat_value ; else fTaxVat = 0.00 ; END IF; return fTaxVat ; END ; ' LANGUAGE 'plpgsql'; CREATE OR REPLACE FUNCTION fct_get_net_for_article( iArticleID integer) returns bool AS ' DECLARE sSql text ; bNet bool ; net bool ; rData record ; BEGIN bNet := true ; raise notice '' net value is %'',bNet ; select into rData price_type_net from material_group, articles where articles.id = iArticleID and articles.material_group = material_group.id ; if rData.price_type_net is null then bNet := true ; else bNet := rData.price_type_net ; end if ; raise notice '' net value is %'',bNet ; return bNet ; END ; ' LANGUAGE 'plpgsql'; CREATE OR REPLACE FUNCTION fct_duplicateArticle( iArticleID integer) returns integer AS ' DECLARE sSql text ; newID integer ; rData record ; BEGIN newID = 0 ; select nextval(''articles_id'') into newID ; select into rData * from articles where articles.id = iArticleID ; insert into articles (id , client, sep_info_1 , sep_info_2 , sep_info_3 , number , designation , wrapping , quantumperwrap , unit , manufactor_id , weight , sellingprice1 , sellingprice2 , sellingprice3 , sellingprice4 , tax_vat , material_group , associated_with , associated_id , tax_vat_id ) values (newID , rData.client, rData.sep_info_1 , rData.sep_info_2 , rData.sep_info_3 , ''NEW-'' || rData.number , rData.designation , rData.wrapping , rData.quantumperwrap , rData.unit , rData.manufactor_id , rData.weight , rData.sellingprice1 , rData.sellingprice2 , rData.sellingprice3 , rData.sellingprice4 , rData. tax_vat , rData.material_group , rData.associated_with , rData.associated_id , rData.tax_vat_id ); return newID ; END ; ' LANGUAGE 'plpgsql'; CREATE OR REPLACE FUNCTION fct_getSellingPricesForArticle ( iArticleID integer, iPartID integer) returns record AS ' DECLARE sSql text ; rData record ; rData2 record ; BEGIN sSql = ''select apl.quantities, sellingprice1, sellingprice2, sellingprice3, sellingprice4, 0.0::float as t1, 0.0::float as t2,0.0::float as t3,0.0::float as t4 from articles, articles_parts_list as apl where articles.id = '' || iArticleID || '' and articles.id = apl.part_id and apl.article_id = '' || iPartID || '' '' || fct_getWhere(2,''apl.'') ; execute(sSql) into rData ; if rData.sellingprice1 IS NULL then rData.sellingprice1 := 0.0::float ; end if ; if rData.sellingprice2 IS NULL then rData.sellingprice2 := 0.0::float ; end if ; if rData.sellingprice3 IS NULL then rData.sellingprice3 := 0.0::float ; end if ; if rData.sellingprice4 IS NULL then rData.sellingprice4 := 0.0::float ; end if ; rData.t1 = rData.sellingprice1 * rData.quantities ; rData.t2 = rData.sellingprice2 * rData.quantities ; rData.t3 = rData.sellingprice3 * rData.quantities ; rData.t4 = rData.sellingprice4 * rData.quantities ; return rData ; END ; ' LANGUAGE 'plpgsql'; CREATE OR REPLACE FUNCTION fct_getTotalSellingPricesForArticle ( iPartID integer) returns record AS ' DECLARE sSql text ; rData record ; rData2 record ; ft1 float ; ft2 float ; ft3 float ; ft4 float ; BEGIN ft1 := 0.00 ; ft2 := 0.00 ; ft3 := 0.00 ; ft4 := 0.00 ; sSql := ''select apl.quantities, sellingprice1, sellingprice2, sellingprice3, sellingprice4, 0.0::float as t1, 0.0::float as t2,0.0::float as t3,0.0::float as t4 from articles, articles_parts_list as apl where articles.id = apl.part_id and apl.article_id = '' || iPartID || '' '' || fct_getWhere(2,''apl.'') ; raise notice '' sSql = %'', sSql ; FOR rData in execute(sSql) LOOP if rData.sellingprice1 IS NOT NULL then raise notice ''sellingprice 1 = % , % %'', rData.sellingprice1, rData.quantities, rData.t1 ; ft1 := ft1 + (rData.sellingprice1 * rData.quantities ); raise notice ''sellingprice 1 = % , % '', rData.sellingprice1, rData.t1 ; end if ; if rData.sellingprice2 IS NOT NULL then ft2 := ft2 + (rData.sellingprice2 * rData.quantities ); end if ; if rData.sellingprice3 IS NOT NULL then ft3 := ft3 + (rData.sellingprice3 * rData.quantities ); end if ; if rData.sellingprice4 IS NOT NULL then ft4 := ft4 + (rData.sellingprice4 * rData.quantities ); end if ; END LOOP ; rData.t1 := ft1 ; rData.t2 := ft2 ; rData.t3 := ft3 ; rData.t4 := ft4 ; return rData ; END ; ' LANGUAGE 'plpgsql';
juergenhamel/cuon
cuon_client/articles.sql
SQL
gpl-3.0
11,636
# -*- coding: utf-8 -*- from __future__ import with_statement import os import sys import traceback # monkey patch bug in python 2.6 and lower # http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 if sys.version_info < (2, 7) and os.name != "nt": import errno import subprocess def _eintr_retry_call(func, *args): while True: try: return func(*args) except OSError, e: if e.errno == errno.EINTR: continue raise #: Unsued timeout option for older python version def wait(self, timeout=0): """ Wait for child process to terminate. Returns returncode attribute. """ if self.returncode is None: try: pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0) except OSError, e: if e.errno != errno.ECHILD: raise #: This happens if SIGCLD is set to be ignored or waiting #: For child processes has otherwise been disabled for our #: process. This child is dead, we can't get the status. sts = 0 self._handle_exitstatus(sts) return self.returncode subprocess.Popen.wait = wait try: import send2trash except ImportError: pass from module.plugins.internal.Addon import Addon, Expose, threaded from module.plugins.internal.Plugin import exists, replace_patterns from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError from module.utils import fs_encode, save_join as fs_join, uniqify class ArchiveQueue(object): def __init__(self, plugin, storage): self.plugin = plugin self.storage = storage def get(self): try: return [int(pid) for pid in self.plugin.retrieve("ExtractArchive:%s" % self.storage, "").decode('base64').split()] except Exception: return [] def set(self, value): if isinstance(value, list): item = str(value)[1:-1].replace(' ', '').replace(',', ' ') else: item = str(value).strip() return self.plugin.store("ExtractArchive:%s" % self.storage, item.encode('base64')[:-1]) def delete(self): return self.plugin.delete("ExtractArchive:%s" % self.storage) def add(self, item): queue = self.get() if item not in queue: return self.set(queue + [item]) else: return True def remove(self, item): queue = self.get() try: queue.remove(item) except ValueError: pass if queue is []: return self.delete() return self.set(queue) class ExtractArchive(Addon): __name__ = "ExtractArchive" __type__ = "hook" __version__ = "1.50" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), ("overwrite" , "bool" , "Overwrite files" , False ), ("keepbroken" , "bool" , "Try to extract broken archives" , False ), ("repair" , "bool" , "Repair broken archives (RAR required)" , False ), ("test" , "bool" , "Test archive before extracting" , False ), ("usepasswordfile", "bool" , "Use password file" , True ), ("passwordfile" , "file" , "Password file" , "passwords.txt" ), ("delete" , "bool" , "Delete archive after extraction" , True ), ("deltotrash" , "bool" , "Move to trash (recycle bin) instead delete", True ), ("subfolder" , "bool" , "Create subfolder for each package" , False ), ("destination" , "folder" , "Extract files to folder" , "" ), ("extensions" , "str" , "Extract archives ending with extension" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), ("recursive" , "bool" , "Extract archives in archives" , True ), ("waitall" , "bool" , "Run after all downloads was processed" , False ), ("renice" , "int" , "CPU priority" , 0 )] __description__ = """Extract different kind of archives""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), ("Immenz" , "immenz@gmx.net" )] NAME_REPLACEMENTS = [(r'\.part\d+\.rar$', ".part.rar")] def init(self): self.event_map = {'allDownloadsProcessed': "all_downloads_processed", 'packageDeleted' : "package_deleted" } self.queue = ArchiveQueue(self, "Queue") self.failed = ArchiveQueue(self, "Failed") self.interval = 60 self.extracting = False self.last_package = False self.extractors = [] self.passwords = [] self.repair = False def activate(self): for p in ("UnRar", "SevenZip", "UnZip"): try: module = self.pyload.pluginManager.loadModule("internal", p) klass = getattr(module, p) if klass.find(): self.extractors.append(klass) if klass.REPAIR: self.repair = self.get_config('repair') except OSError, e: if e.errno == 2: self.log_warning(_("No %s installed") % p) else: self.log_warning(_("Could not activate: %s") % p, e) if self.pyload.debug: traceback.print_exc() except Exception, e: self.log_warning(_("Could not activate: %s") % p, e) if self.pyload.debug: traceback.print_exc() if self.extractors: self.log_debug(*["Found %s %s" % (Extractor.__name__, Extractor.VERSION) for Extractor in self.extractors]) self.extract_queued() #: Resume unfinished extractions else: self.log_info(_("No Extract plugins activated")) @threaded def extract_queued(self, thread): if self.extracting: #@NOTE: doing the check here for safty (called by coreReady) return self.extracting = True packages = self.queue.get() while packages: if self.last_package: #: Called from allDownloadsProcessed self.last_package = False if self.extract(packages, thread): #@NOTE: check only if all gone fine, no failed reporting for now self.manager.dispatchEvent("all_archives_extracted") self.manager.dispatchEvent("all_archives_processed") else: if self.extract(packages, thread): #@NOTE: check only if all gone fine, no failed reporting for now pass packages = self.queue.get() #: Check for packages added during extraction self.extracting = False #: Deprecated method, use `extract_package` instead @Expose def extractPackage(self, *args, **kwargs): """ See `extract_package` """ return self.extract_package(*args, **kwargs) @Expose def extract_package(self, *ids): """ Extract packages with given id """ for id in ids: self.queue.add(id) if not self.get_config('waitall') and not self.extracting: self.extract_queued() def package_deleted(self, pid): self.queue.remove(pid) def package_finished(self, pypack): self.queue.add(pypack.id) if not self.get_config('waitall') and not self.extracting: self.extract_queued() def all_downloads_processed(self): self.last_package = True if self.get_config('waitall') and not self.extracting: self.extract_queued() @Expose def extract(self, ids, thread=None): #@TODO: Use pypack, not pid to improve method usability if not ids: return False processed = [] extracted = [] failed = [] toList = lambda string: string.replace(' ', '').replace(',', '|').replace(';', '|').split('|') destination = self.get_config('destination') subfolder = self.get_config('subfolder') fullpath = self.get_config('fullpath') overwrite = self.get_config('overwrite') renice = self.get_config('renice') recursive = self.get_config('recursive') delete = self.get_config('delete') keepbroken = self.get_config('keepbroken') extensions = [x.lstrip('.').lower() for x in toList(self.get_config('extensions'))] excludefiles = toList(self.get_config('excludefiles')) if extensions: self.log_debug("Use for extensions: %s" % "|.".join(extensions)) #: Reload from txt file self.reload_passwords() download_folder = self.pyload.config.get("general", "download_folder") #: Iterate packages -> extractors -> targets for pid in ids: pypack = self.pyload.files.getPackage(pid) if not pypack: self.queue.remove(pid) continue self.log_info(_("Check package: %s") % pypack.name) #: Determine output folder out = fs_join(download_folder, pypack.folder, destination, "") #: Force trailing slash if subfolder: out = fs_join(out, pypack.folder) if not exists(out): os.makedirs(out) matched = False success = True files_ids = dict((pylink['name'], ((fs_join(download_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \ in sorted(pypack.getChildren().values(), key=lambda k: k['name'])).values() #: Remove duplicates #: Check as long there are unseen files while files_ids: new_files_ids = [] if extensions: files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids \ if filter(lambda ext: fname.lower().endswith(ext), extensions)] for Extractor in self.extractors: targets = Extractor.get_targets(files_ids) if targets: self.log_debug("Targets for %s: %s" % (Extractor.__name__, targets)) matched = True for fname, fid, fout in targets: name = os.path.basename(fname) if not exists(fname): self.log_debug(name, "File not found") continue self.log_info(name, _("Extract to: %s") % fout) try: pyfile = self.pyload.files.getFile(fid) archive = Extractor(self, fname, fout, fullpath, overwrite, excludefiles, renice, delete, keepbroken, fid) thread.addActive(pyfile) archive.init() try: new_files = self._extract(pyfile, archive, pypack.password) finally: pyfile.setProgress(100) thread.finishFile(pyfile) except Exception, e: self.log_error(name, e) success = False continue #: Remove processed file and related multiparts from list files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids \ if fname not in archive.get_delete_files()] self.log_debug("Extracted files: %s" % new_files) for file in new_files: self.set_permissions(file) for filename in new_files: file = fs_encode(fs_join(os.path.dirname(archive.filename), filename)) if not exists(file): self.log_debug("New file %s does not exists" % filename) continue if recursive and os.path.isfile(file): new_files_ids.append((filename, fid, os.path.dirname(filename))) #: Append as new target self.manager.dispatchEvent("archive_extracted", pyfile, archive) files_ids = new_files_ids #: Also check extracted files if matched: if success: extracted.append(pid) self.manager.dispatchEvent("package_extracted", pypack) else: failed.append(pid) self.manager.dispatchEvent("package_extract_failed", pypack) self.failed.add(pid) else: self.log_info(_("No files found to extract")) if not matched or not success and subfolder: try: os.rmdir(out) except OSError: pass self.queue.remove(pid) return True if not failed else False def _extract(self, pyfile, archive, password): name = os.path.basename(archive.filename) pyfile.setStatus("processing") encrypted = False try: self.log_debug("Password: %s" % (password or "None provided")) passwords = uniqify([password] + self.get_passwords(False)) if self.get_config('usepasswordfile') else [password] for pw in passwords: try: if self.get_config('test') or self.repair: pyfile.setCustomStatus(_("archive testing")) if pw: self.log_debug("Testing with password: %s" % pw) pyfile.setProgress(0) archive.verify(pw) pyfile.setProgress(100) else: archive.check(pw) self.add_password(pw) break except PasswordError: if not encrypted: self.log_info(name, _("Password protected")) encrypted = True except CRCError, e: self.log_debug(name, e) self.log_info(name, _("CRC Error")) if self.repair: self.log_warning(name, _("Repairing...")) pyfile.setCustomStatus(_("archive repairing")) pyfile.setProgress(0) repaired = archive.repair() pyfile.setProgress(100) if not repaired and not self.get_config('keepbroken'): raise CRCError("Archive damaged") self.add_password(pw) break raise CRCError("Archive damaged") except ArchiveError, e: raise ArchiveError(e) pyfile.setCustomStatus(_("extracting")) pyfile.setProgress(0) if not encrypted or not self.get_config('usepasswordfile'): self.log_debug("Extracting using password: %s" % (password or "None")) archive.extract(password) else: for pw in filter(None, uniqify([password] + self.get_passwords(False))): try: self.log_debug("Extracting using password: %s" % pw) archive.extract(pw) self.add_password(pw) break except PasswordError: self.log_debug("Password was wrong") else: raise PasswordError pyfile.setProgress(100) pyfile.setStatus("processing") delfiles = archive.get_delete_files() self.log_debug("Would delete: " + ", ".join(delfiles)) if self.get_config('delete'): self.log_info(_("Deleting %s files") % len(delfiles)) deltotrash = self.get_config('deltotrash') for f in delfiles: file = fs_encode(f) if not exists(file): continue if not deltotrash: os.remove(file) else: try: send2trash.send2trash(file) except NameError: self.log_warning(_("Unable to move %s to trash") % os.path.basename(f), _("Send2Trash lib not found")) except Exception, e: self.log_warning(_("Unable to move %s to trash") % os.path.basename(f), e.message) else: self.log_info(_("Moved %s to trash") % os.path.basename(f)) self.log_info(name, _("Extracting finished")) extracted_files = archive.files or archive.list() return extracted_files except PasswordError: self.log_error(name, _("Wrong password" if password else "No password found")) except CRCError, e: self.log_error(name, _("CRC mismatch"), e) except ArchiveError, e: self.log_error(name, _("Archive error"), e) except Exception, e: self.log_error(name, _("Unknown error"), e) if self.pyload.debug: traceback.print_exc() self.manager.dispatchEvent("archive_extract_failed", pyfile, archive) raise Exception(_("Extract failed")) #: Deprecated method, use `get_passwords` instead @Expose def getPasswords(self, *args, **kwargs): """ See `get_passwords` """ return self.get_passwords(*args, **kwargs) @Expose def get_passwords(self, reload=True): """ List of saved passwords """ if reload: self.reload_passwords() return self.passwords def reload_passwords(self): try: passwords = [] file = fs_encode(self.get_config('passwordfile')) with open(file) as f: for pw in f.read().splitlines(): passwords.append(pw) except IOError, e: self.log_error(e) else: self.passwords = passwords #: Deprecated method, use `add_password` instead @Expose def addPassword(self, *args, **kwargs): """ See `add_password` """ return self.add_password(*args, **kwargs) @Expose def add_password(self, password): """ Adds a password to saved list """ try: self.passwords = uniqify([password] + self.passwords) file = fs_encode(self.get_config('passwordfile')) with open(file, "wb") as f: for pw in self.passwords: f.write(pw + '\n') except IOError, e: self.log_error(e)
benbox69/pyload
module/plugins/hooks/ExtractArchive.py
Python
gpl-3.0
21,976
<!doctype html> <meta charset="utf-8"> <title>Server Error :(</title> <style> ::-moz-selection {text-shadow: none; } ::selection {text-shadow: none; } html { padding: 30px 10px; font-size: 20px; line-height: 1.4; color: #737373; background: #f0f0f0; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } html, input { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } body { max-width: 500px; _width: 500px; padding: 30px 20px 50px; border: 1px solid #b3b3b3; border-radius: 4px; margin: 0 auto; box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff; background: #fcfcfc; } h1 { margin: 0 10px; font-size: 50px; text-align: center; } h1 span { color: #bbb; } h3 { margin: 1.5em 0 0.5em; } p { margin: 1em 0; } ul { padding: 0 0 0 40px; margin: 1em 0; } .container { max-width: 380px; _width: 380px; margin: 0 auto; } </style> <div class="container"> <h1>Server Error<span>:(</span></h1> <p>Sorry, but we cannot resolve your request.</p> <p>It looks like this was the result of either:</p> <ul> <li>our mistake :)</li> </ul> </div>
Czocher/zebra-supervisor
templates/500.html
HTML
gpl-3.0
1,132
var searchData= [ ['cosangle',['cosAngle',['../class_polar.html#a4628c596876a75709853a2ac46bb0d86',1,'Polar']]] ];
dpointer80906/polar
doc/html/search/functions_0.js
JavaScript
gpl-3.0
117
#region Header // **************************************\ // _ _ _ __ ___ _ _ ___ | // |# |# |# |## |### |# |# |### | // |# |# |# |# |# |# |# |# |# | // |# |# |# |# |# |# |# |# |# | // _|# |#__|# _|# |# |#__|# |#__|# | // |## |## |## |# |## |### | // [http://www.playuo.org] | // **************************************/ // [2014] ServerList.cs // ************************************/ #endregion #region References using System; using System.IO; using System.Linq; using System.Net; using System.Net.NetworkInformation; using System.Net.Sockets; using System.Text.RegularExpressions; using Server.Network; #endregion namespace Server.Misc { public class ServerList { /* * The default setting for Address, a value of 'null', will use your local IP address. If all of your local IP addresses * are private network addresses and AutoDetect is 'true' then JustUO will attempt to discover your public IP address * for you automatically. * * If you do not plan on allowing clients outside of your LAN to connect, you can set AutoDetect to 'false' and leave * Address set to 'null'. * * If your public IP address cannot be determined, you must change the value of Address to your public IP address * manually to allow clients outside of your LAN to connect to your server. Address can be either an IP address or * a hostname that will be resolved when JustUO starts. * * If you want players outside your LAN to be able to connect to your server and you are behind a router, you must also * forward TCP port 2593 to your private IP address. The procedure for doing this varies by manufacturer but generally * involves configuration of the router through your web browser. * * ServerList will direct connecting clients depending on both the address they are connecting from and the address and * port they are connecting to. If it is determined that both ends of a connection are private IP addresses, ServerList * will direct the client to the local private IP address. If a client is connecting to a local public IP address, they * will be directed to whichever address and port they initially connected to. This allows multihomed servers to function * properly and fully supports listening on multiple ports. If a client with a public IP address is connecting to a * locally private address, the server will direct the client to either the AutoDetected IP address or the manually entered * IP address or hostname, whichever is applicable. Loopback clients will be directed to loopback. * * If you would like to listen on additional ports (i.e. 22, 23, 80, for clients behind highly restrictive egress * firewalls) or specific IP adddresses you can do so by modifying the file SocketOptions.cs found in this directory. */ public static readonly string Address = null; public static readonly string ServerName = StartupReader.GetShardName(); public static readonly bool AutoDetect = true; private static IPAddress _PublicAddress; private static readonly Regex _AddressPattern = new Regex(@"([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})"); public static void Initialize() { if (Address == null) { if (AutoDetect) { AutoDetection(); } } else { Resolve(Address, out _PublicAddress); } EventSink.ServerList += EventSink_ServerList; } private static void EventSink_ServerList(ServerListEventArgs e) { try { NetState ns = e.State; Socket s = ns.Socket; IPEndPoint ipep = (IPEndPoint)s.LocalEndPoint; IPAddress localAddress = ipep.Address; int localPort = ipep.Port; if (IsPrivateNetwork(localAddress)) { ipep = (IPEndPoint)s.RemoteEndPoint; if (!IsPrivateNetwork(ipep.Address) && _PublicAddress != null) { localAddress = _PublicAddress; } } e.AddServer(ServerName, new IPEndPoint(localAddress, localPort)); } catch (Exception x) { //x.ToConsole(); e.Rejected = true; } } private static void AutoDetection() { if (HasPublicIPAddress()) { return; } Console.Write("ServerList: Auto-detecting public IP address..."); _PublicAddress = FindPublicAddress(); if (_PublicAddress != null) { Console.WriteLine("done ({0})", _PublicAddress); } else { Console.WriteLine("failed"); } } public static void Resolve(string addr, out IPAddress outValue) { if (IPAddress.TryParse(addr.Trim(), out outValue)) { return; } try { IPHostEntry iphe = Dns.GetHostEntry(addr); if (iphe.AddressList.Length > 0) { outValue = iphe.AddressList[iphe.AddressList.Length - 1]; } } catch { } } public static bool HasPublicIPAddress() { var adapters = NetworkInterface.GetAllNetworkInterfaces(); return (adapters.Select(adapter => adapter.GetIPProperties()) .SelectMany( properties => properties.UnicastAddresses.Cast<IPAddressInformation>(), (properties, unicast) => unicast.Address)) .Any(ip => !IPAddress.IsLoopback(ip) && ip.AddressFamily != AddressFamily.InterNetworkV6 && !IsPrivateNetwork(ip)); } public static bool IsPrivateNetwork(IPAddress ip) { // 10.0.0.0/8 // 172.16.0.0/12 // 192.168.0.0/16 if (ip.AddressFamily == AddressFamily.InterNetworkV6) { return false; } if (Utility.IPMatch("192.168.*", ip)) { return true; } if (Utility.IPMatch("10.*", ip)) { return true; } if (Utility.IPMatch("172.16-31.*", ip)) { return true; } return false; } /// <summary> /// Uses checkip.dyndns.org to resolve the external IP of the current public network. /// RunUO uses it's own hosted page to do this, but it's often unresponsive, /// causing listener initialization delays. /// </summary> public static IPAddress FindPublicAddress() { string data = String.Empty; WebRequest request = WebRequest.Create("http://checkip.dyndns.org/"); using (WebResponse response = request.GetResponse()) { Stream r = response.GetResponseStream(); if (r != null) { using (var stream = new StreamReader(r)) { data = stream.ReadToEnd(); } } } Match m = _AddressPattern.Match(data); return m.Success ? IPAddress.Parse(m.Value) : null; } } }
zerodowned/justuo-with-ec-support
Scripts/Misc/ServerList.cs
C#
gpl-3.0
6,564
/* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * 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 . */ package mod._sfx; import java.io.PrintWriter; import lib.Status; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.dbg; import util.utils; import com.sun.star.uno.XInterface; /** * Test for object which is represented by service * <code>com.sun.star.comp.office.FrameLoader</code>. <p> * Object implements the following interfaces : * <ul> * <li> <code>com::sun::star::frame::XFrameLoader</code></li> * </ul> * This object test <b> is NOT </b> designed to be run in several * threads concurently. * @see com.sun.star.frame.FrameLoader * @see com.sun.star.frame.XSynchronousFrameLoader */ public class FrameLoader extends TestCase { /** * Creating a Testenvironment for the interfaces to be tested. * Creates an instance of the service * <code>com.sun.star.comp.office.FrameLoader</code>. <p> * Object relations created : * <ul> * <li> <code>'FrameLoader.URL"'</code> for * {@link ifc.frame._XFrameLoader} </li> * </ul> */ @Override protected TestEnvironment createTestEnvironment (TestParameters Param, PrintWriter log) { XInterface oObj = null; Object oInterface = null ; //now get the OButtonControl try { oInterface = Param.getMSF().createInstance ("com.sun.star.comp.office.FrameLoader") ; } catch (com.sun.star.uno.Exception e) { log.println("Couldn't get service"); e.printStackTrace(log); throw new StatusException("Couldn't get GridControl", e ); } if (oInterface == null) { log.println("Service wasn't created") ; throw new StatusException (Status.failed("Service wasn't created")) ; } oObj = (XInterface) oInterface ; System.out.println("ImplName: "+utils.getImplName(oObj)); dbg.printInterfaces(oObj); log.println( "creating a new environment for object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); // adding relation for XFrameLoader tEnv.addObjRelation("FrameLoader.URL","private:factory/swriter"); return tEnv; } // finish method getTestEnvironment }
Limezero/libreoffice
qadevOOo/tests/java/mod/_sfx/FrameLoader.java
Java
gpl-3.0
3,081
-- 161 -- PKCColumnA -- ListElementAdder with ChainedSupplier with PrimaryKeyConstraintSupplier and PrimaryKeyColumnsWithAlternativesSupplier - Added notes CREATE TABLE "db_category" ( "id" VARCHAR(9) PRIMARY KEY NOT NULL, "name" VARCHAR(30) NOT NULL, "parent_id" VARCHAR(9) CONSTRAINT "db_category_parent_fk" REFERENCES "db_category" ("id") ) CREATE TABLE "db_product" ( "ean_code" VARCHAR(13) NOT NULL, "name" VARCHAR(30) NOT NULL, "category_id" VARCHAR(9) CONSTRAINT "db_product_category_fk" REFERENCES "db_category" ("id") NOT NULL, "price" DECIMAL(8, 2) NOT NULL, "manufacturer" VARCHAR(30) NOT NULL, "notes" VARCHAR(256), "description" VARCHAR(256), PRIMARY KEY ("ean_code", "notes") ) CREATE TABLE "db_role" ( "name" VARCHAR(16) PRIMARY KEY NOT NULL ) CREATE TABLE "db_user" ( "id" INT PRIMARY KEY NOT NULL, "name" VARCHAR(30) NOT NULL, "email" VARCHAR(50) NOT NULL, "password" VARCHAR(16) NOT NULL, "role_id" VARCHAR(16) CONSTRAINT "db_user_role_fk" REFERENCES "db_role" ("name") NOT NULL, "active" SMALLINT NOT NULL, CONSTRAINT "active_flag" CHECK ("active" IN (0, 1)) ) CREATE TABLE "db_customer" ( "id" INT PRIMARY KEY CONSTRAINT "db_customer_user_fk" REFERENCES "db_user" ("id") NOT NULL, "category" CHAR(1) NOT NULL, "salutation" VARCHAR(10), "first_name" VARCHAR(30) NOT NULL, "last_name" VARCHAR(30) NOT NULL, "birth_date" DATE ) CREATE TABLE "db_order" ( "id" INT PRIMARY KEY NOT NULL, "customer_id" INT CONSTRAINT "db_order_customer_fk" REFERENCES "db_customer" ("id") NOT NULL, "total_price" DECIMAL(8, 2) NOT NULL, "created_at" TIMESTAMP NOT NULL ) CREATE TABLE "db_order_item" ( "id" INT PRIMARY KEY NOT NULL, "order_id" INT CONSTRAINT "db_order_item_order_fk" REFERENCES "db_order" ("id") NOT NULL, "number_of_items" INT NOT NULL, "product_ean_code" VARCHAR(13) CONSTRAINT "db_order_item_product_fk" REFERENCES "db_product" ("ean_code") NOT NULL, "total_price" DECIMAL(8, 2) NOT NULL )
schemaanalyst/schemaanalyst
src/paper/ineffectivemutants/manualevaluation/mutants/CustomerOrder_SQLite/161.sql
SQL
gpl-3.0
1,956
// // File assets/prueba.tmx converted to csv using cpct_tmx2csv [20170618 13:25:43 CEST] // * Width: 20 // * Height: 20 // * Bytes: 400 // #include <types.h> // Generated CSV tilemap from assets/prueba.tmx // 400 bytes (20 x 20) #define g_nivel_1_W 20 #define g_nivel_1_H 20 extern const u8 g_nivel_1[20*20];
rubirp/rubi_the_pirate
paintRoom-v01/src/levels/prueba.h
C
gpl-3.0
324
INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('1', 'Beklemrecht'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('2', 'Eigendom (recht van)'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('3', 'Erfpacht (recht van)'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('4', 'Gebruik en bewoning (recht van)'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('5', 'Grondrente (recht van)'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('6', 'Huurrecht (zakelijk)'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('7', 'Opstal (recht van)'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('8', 'Optierecht (zakelijk)'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('9', 'Oud-vaderlandsrecht'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('10', 'Zakelijk recht (als bedoeld in artikel 5, lid 3, onder b)'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('11', 'Stadsmeierrecht'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('12', 'Vruchtgebruik (recht van)'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('13', 'Erfpacht en Opstal (recht van)'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('14', 'Opstalrecht Nutsvoorzieningen'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('15', 'Eigendom Telecommunicatienetwerk'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('16', 'Erfpachtrecht Telecommunicatienetwerk'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('17', 'Vruchtgebruik Telecommunicatienetwerk'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('18', 'Overige zakelijke rechten'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('19', 'Voorrecht'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('20', 'Zakelijk recht na twee of meer zakelijke belastingen'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('21', 'Zakelijke belasting derde of volgende'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('22', 'BP-recht'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('23', 'Opstalrecht Nutsvoorzieningen op gedeelte van perceel'); INSERT INTO aard_recht_verkort (aand, omschr) VALUES ('24', 'Zakelijk recht op gedeelte van perceel (als bedoeld in artikel 5, lid 3, onder b)');
B3Partners/brmo
datamodel/extra_scripts/postgresql/108_insert_aard_recht_verkort.sql
SQL
gpl-3.0
2,260
#include "printf.h" #include "scanf.h" #include "platform.h" #include "soft_timer.h" #include "unique_id.h" #include "shell.h" /* Leds Commands */ static int cmd_leds_on(int argc, char **argv) { uint8_t leds = 0; if (argc != 2) return 1; if (1 != sscanf(argv[1], "%u", &leds)) return 1; leds_on(leds); printf("%s %x\n", argv[0], leds); return 0; } static int cmd_leds_off(int argc, char **argv) { uint8_t leds = 0; if (argc != 2) return 1; if (!sscanf(argv[1], "%u", &leds)) return 1; leds_off(leds); printf("%s %x\n", argv[0], leds); return 0; } static int cmd_leds_blink(int argc, char **argv) { uint8_t leds = 0; uint32_t time = 0; static soft_timer_t led_alarm; if (argc != 3) return 1; if (!sscanf(argv[1], "%u", &leds)) return 1; if (!sscanf(argv[2], "%u", &time)) return 1; if (time) { soft_timer_set_handler(&led_alarm, (handler_t)leds_toggle, (handler_arg_t)(uint32_t)leds); soft_timer_start(&led_alarm, soft_timer_ms_to_ticks(time), 1); printf("%s %u %u\n", argv[0], leds, time); } else { soft_timer_stop(&led_alarm); printf("%s stop\n", argv[0]); } return 0; } /* Simple Commands */ static int cmd_echo(int argc, char **argv) { int i; for (i = 1; i < argc; i++) if (i == 1) printf("%s", argv[i]); else printf(" %s", argv[i]); printf("\n"); return 0; } static int cmd_get_time(int argc, char **argv) { if (argc != 1) return 1; printf("%s %u ticks_32khz\n", argv[0], soft_timer_time()); return 0; } static int cmd_get_uid(int argc, char **argv) { if (argc != 1) return 1; printf("%s %08x%08x%08x\n", argv[0], uid->uid32[0], uid->uid32[1], uid->uid32[2]); return 0; } struct shell_command commands[] = { {"echo", "echo given arguments", cmd_echo}, {"get_time", "Print board time", cmd_get_time}, {"get_uid", "Print board uid", cmd_get_uid}, {"leds_on", "[leds_flag] Turn given leds on", cmd_leds_on}, {"leds_off", "[leds_flag] Turn given leds off", cmd_leds_off}, {"leds_blink", "[leds_flag] [time] Blink leds every 'time'. If 'time' == 0 disable", cmd_leds_blink}, {NULL, NULL, NULL}, }; int main(void) { platform_init(); soft_timer_init(); event_init(); shell_init(commands, 1); platform_run(); return 1; }
adjih/openlab
appli/iotlab_tests/shell_test/main.c
C
gpl-3.0
2,528
/* * This file is part of JGrasstools (http://www.jgrasstools.org) * (C) HydroloGIS - www.hydrologis.com * * JGrasstools is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.jgrasstools.hortonmachine.modules.networktools.trento_p.net; import static java.lang.Math.abs; import static java.lang.Math.pow; import static java.lang.Math.sin; import static java.lang.Math.sqrt; import static org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Constants.*; import static org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Constants.DEFAULT_CELERITY_FACTOR; import static org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Constants.DEFAULT_TMAX; import static org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Constants.EIGHTOVERTHREE; import static org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Constants.METER2CM; import static org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Constants.MINUTE2SEC; import static org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Constants.TWOOVERTHREE; import static org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Constants.TWO_THIRTEENOVERTHREE; import static org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Utility.angleToFillDegree; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map.Entry; import java.util.Set; import org.jgrasstools.gears.libs.modules.ModelsEngine; import org.jgrasstools.gears.libs.monitor.IJGTProgressMonitor; import org.jgrasstools.gears.utils.math.NumericsUtilities; import org.jgrasstools.gears.utils.sorting.QuickSortAlgorithm; import org.jgrasstools.hortonmachine.i18n.HortonMessageHandler; import org.jgrasstools.hortonmachine.modules.networktools.trento_p.OmsTrentoP; import org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Utility; import org.joda.time.DateTime; import static org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Constants.OUT_ID_PIPE; import static org.jgrasstools.hortonmachine.modules.networktools.trento_p.utils.Constants.OUT_INDEX_PIPE; /** * * Class which contains methods to verify a sewer network. * * <p> * * It contains a geosewere method which verify the net.. * * </p> * * @author Daniele Andreis, Riccardo Rigon, David Tamanini * */ public class NetworkCalibration implements Network { /** * The initial time, it's the initial time whre to start to search the tp max. * <p> * It's fixed to 15 minutes. * * </p> * */ public static final Integer INITIAL_TIME = 15; DateTime first = null; /* * Time step. */ private Integer dt; /* * Monitor. */ private final IJGTProgressMonitor pm; /* * */ private final HortonMessageHandler msg = HortonMessageHandler.getInstance(); /* * Rain data. */ private double[][] rainData; /* * The input rain. */ private final HashMap<DateTime, double[]> inRain; /* * Flag to exit if a pipe is full. */ boolean isFill = false; /* * Dati relativi alla rete */ private final Pipe[] networkPipes; /* * celerita-. */ private final double celerityfactor1; /* * The time of fill degree.. */ private double[][] lastTimeDischarge; /* * The time of fill degree.. */ private double[][] lastTimeFillDegree; /* * The end time of the simulation. */ private final int tMax; /* * A string where to put the warning messages. */ private final StringBuilder strBuilder; /* * The fill degree for each pipe and for each time. */ private HashMap<DateTime, HashMap<Integer, double[]>> fillDegree; /* * The discharg for each pipe and for each time. */ private HashMap<DateTime, HashMap<Integer, double[]>> discharge; /* * A flag that indicate to the program if search or not the maximum rain time. */ private final boolean foundMaxrainTime; /* * The upper limit time range. It is used to search the tpMax. The range to search the tpMax is [IITIAL_TIME, tpMaxCalibration]. */ private final Integer tpMaxCalibration; /* * The rain time that give the maximum discharge. */ private int tpMax; /* * Is the number of data rain to use. */ private int nTime; /* * True if there is an infinite loop. */ private boolean infiniteLoop = false; /* * Max number of iteration to search the solution. */ private final static int MAX_NUMBER_ITERATION = 1000; /** * Builder for the Calibration class. */ public static class Builder { // Mandatory parameters. /* * Progress monitor. */ private final IJGTProgressMonitor pm; /* * time step. */ private final Integer dt; /* * Builder that contains the warning messages. */ private final StringBuilder strBuilder; /* * The fillDegree for each pipe and for each time. */ private final HashMap<DateTime, HashMap<Integer, double[]>> fillDegree; /* * The discharg for each pipe and for each time. */ private final HashMap<DateTime, HashMap<Integer, double[]>> discharge; /* * Dati di pioggia. */ private final HashMap<DateTime, double[]> inRain; /* * Dati relativi alla rete */ private final Pipe[] networkPipe; /* * Flag to indicate if search or not the tpMax. */ private final boolean foundMaxrainTime; /* * Maximum time of calibration. */ private final Integer tpMaxCalibration; // optional parameter. /* * Celerity. */ private double celerityfactor1 = DEFAULT_CELERITY_FACTOR; /* * max number of time step. */ private int tMax = (int) DEFAULT_TMAX; /** * Initialize the object with the needed parameters * * * @param pm * @param msg * @param networkPipe the array of pipes. * @param dt time step. * @param inRain the rain data. * @param outDischarge the output, discharge. * @param outFillDegreethe output, fill degree. * @param strBuilder a string used to store the warnings. */ public Builder( IJGTProgressMonitor pm, Pipe[] networkPipe, Integer dt, HashMap<DateTime, double[]> inRain, HashMap<DateTime, HashMap<Integer, double[]>> outDischarge, HashMap<DateTime, HashMap<Integer, double[]>> outFillDegree, StringBuilder strBuilder, Integer tpMaxCalibration, boolean foundTpMax ) { this.pm = pm; this.networkPipe = networkPipe; this.inRain = inRain; this.dt = dt; this.discharge = outDischarge; this.fillDegree = outFillDegree; this.strBuilder = strBuilder; this.foundMaxrainTime = foundTpMax; if (tpMaxCalibration != null) { this.tpMaxCalibration = tpMaxCalibration; } else { this.tpMaxCalibration = tMax; } } /** * Set the max celerity factor. * * @param max * celerityFactor. */ public Builder celerityFactor( double celerityFactor ) { this.celerityfactor1 = celerityFactor; return this; } /** * Set the max number of time step. * * @param tMax * . */ public Builder tMax( int tMax ) { this.tMax = tMax; return this; } /** * Create a NetworkCalibration Object. * * @return */ public NetworkCalibration build() { return new NetworkCalibration(this); } } /** * Set the parameter throughout the Builder, * */ private NetworkCalibration( Builder builder ) { this.dt = builder.dt; this.pm = builder.pm; this.celerityfactor1 = builder.celerityfactor1; this.discharge = builder.discharge; this.fillDegree = builder.fillDegree; this.tMax = builder.tMax; this.strBuilder = builder.strBuilder; this.tpMaxCalibration = builder.tpMaxCalibration; this.foundMaxrainTime = builder.foundMaxrainTime; if (builder.networkPipe != null) { this.networkPipes = builder.networkPipe; } else { pm.errorMessage(msg.message("trentoP.error.network")); throw new IllegalArgumentException("trentoP.error.network"); } if (builder.inRain != null) { this.inRain = builder.inRain; // create the rains array from the input. Set<Entry<DateTime, double[]>> rainSet = inRain.entrySet(); DateTime second = null; int l = rainSet.size(); rainData = new double[l][2]; int index = 0; for( Entry<DateTime, double[]> rainRecord : rainSet ) { DateTime dateTime = rainRecord.getKey(); double[] values = rainRecord.getValue(); if (first == null) { first = dateTime; } else if (second == null && dt == null) { second = dateTime; } rainData[index][0] = index + 1; rainData[index][1] = values[0]; index++; } // Evaluate the time step, if it isn't passed as a parameter,as a difference between two // time. if (dt == null) { dt = abs(second.getMinuteOfDay() - first.getMinuteOfDay()); } // if the input has the date in a wrong order. if (dt <= 0) { pm.errorMessage(msg.message("trentoP.error.t")); throw new IllegalArgumentException(msg.message("trentoP.error.t")); } double tMaxApproximate = ModelsEngine.approximate2Multiple(tMax, dt); // initialize the output. nTime = (int) (tMaxApproximate / dt); lastTimeDischarge = createMatrix(); lastTimeFillDegree = createMatrix(); } else { pm.errorMessage(msg.message("trentoP.error.rainData ")); throw new IllegalArgumentException(msg.message("trentoP.error.rainData")); } } /** * Return the rain time. * * @return the rain time which give the maximum discharge. */ public int getTpMax() { return tpMax; } /* * Create the matrix which contains the result. */ private double[][] createMatrix() { double time = 0; double tmin = 0; tmin = rainData[0][0]; time = tmin; double[][] matrix = new double[nTime][networkPipes.length + 1]; for( int i = 0; i < nTime; ++i ) { matrix[i][0] = time; time += dt; } return matrix; } /** * verify of the no-head pipes. * * <p> * It evaluate the discharge. * </p> * * @param k ID of the pipe where evaluate the discharge. * @param cDelays delay matrix (for the evalutation of the flow wave). * @param net matrix that contains value of the network. * @return */ private double internalPipeVerify( int k, double[] cDelays, double[][] net, double[][] timeDischarge, double[][] timeFillDegree, int tp ) { int num; double localdelay, olddelay, qMax, B, known, theta, u; double[][] qPartial; qPartial = new double[timeDischarge.length][timeDischarge[0].length]; calculateDelays(k, cDelays, net); // First attempt local delay [min] localdelay = 1; double accuracy = networkPipes[0].getAccuracy(); int jMax = networkPipes[0].getjMax(); double minG = networkPipes[0].getMinG(); double maxtheta = networkPipes[0].getMaxTheta(); double tolerance = networkPipes[0].getTolerance(); int count = 0; do { olddelay = localdelay; qMax = 0; // Updates delays for( int i = 0; i < net.length; i++ ) { net[i][2] += localdelay; }; for( int j = 0; j < net.length; ++j ) { num = (int) net[j][0]; getHydrograph(num, qPartial, olddelay, net[j][2], tp); } getHydrograph(k, qPartial, olddelay, 0, tp); qMax = ModelsEngine.sumDoublematrixColumns(k, qPartial, timeDischarge, 0, qPartial[0].length - 1, pm); if (qMax <= 1) qMax = 1; // Resets delays for( int i = 0; i < net.length; i++ ) { net[i][2] -= localdelay; } calculateFillDegree(k, timeDischarge, timeFillDegree); B = qMax / (CUBICMETER2LITER * networkPipes[k].getKs() * sqrt(networkPipes[k].verifyPipeSlope / METER2CM)); known = (B * TWO_THIRTEENOVERTHREE) / pow(networkPipes[k].diameterToVerify / METER2CM, EIGHTOVERTHREE); theta = Utility.thisBisection(maxtheta, known, TWOOVERTHREE, minG, accuracy, jMax, pm, strBuilder); // Average velocity in pipe [ m / s ] u = qMax * 80 / (pow(networkPipes[k].diameterToVerify, 2) * (theta - sin(theta))); localdelay = networkPipes[k].getLenght() / (celerityfactor1 * u * MINUTE2SEC); count++; // verify if it's an infiniteloop. if (count > MAX_NUMBER_ITERATION) { infiniteLoop = true; throw new ArithmeticException(); } } while( abs(localdelay - olddelay) / olddelay >= tolerance ); cDelays[k] = localdelay; return qMax; } private void calculateFillDegree( int k, double[][] timeDischarge, double[][] timeFillDegree ) { double accuracy = networkPipes[0].getAccuracy(); int jMax = networkPipes[0].getjMax(); double minG = networkPipes[0].getMinG(); double maxtheta = networkPipes[0].getMaxTheta(); double initialFillValue = angleToFillDegree(maxtheta) + 0.1; for( int i = 0; i < timeDischarge.length; i++ ) { // set it over the max value so if the bisection fails(because it's over the max) it's // setted timeFillDegree[i][k] = initialFillValue; double q = timeDischarge[i][k]; if (q > NumericsUtilities.machineFEpsilon()) { double B = q / (CUBICMETER2LITER * networkPipes[k].getKs() * sqrt(networkPipes[k].verifyPipeSlope / METER2CM)); double known = (B * TWO_THIRTEENOVERTHREE) / pow(networkPipes[k].diameterToVerify / METER2CM, EIGHTOVERTHREE); double theta = Utility.thisBisection(maxtheta, known, TWOOVERTHREE, minG, accuracy, jMax, pm, strBuilder); timeFillDegree[i][k] = angleToFillDegree(theta); } else { timeFillDegree[i][k] = 0.0; } } } /** * Calcola il ritardo della tubazione k. * * @param k indice della tubazione. * @param cDelays matrice dei ritardi. * @param net matrice che contiene la sottorete. */ private void calculateDelays( int k, double[] cDelays, double[][] net ) { double t; int ind, r = 1; for( int j = 0; j < net.length; ++j ) { t = 0; r = 1; ind = (int) net[j][0]; /* * Area k is not included in delays */ while( networkPipes[ind].getIndexPipeWhereDrain() != k ) { ind = networkPipes[ind].getIndexPipeWhereDrain(); t += cDelays[ind]; r++; } if (r > networkPipes.length) { pm.errorMessage(msg.message("trentoP.error.incorrectmatrix")); throw new ArithmeticException(msg.message("trentoP.error.incorrectmatrix")); } net[j][2] = t; } } /** * Restituisce l'idrogramma. * * @param k tratto di tubazione. * @param Qpartial matrice delle portate temporanee necessarie per costriure 'idrogramma. * @param localdelay ritardo della tubazione k. * @param delay ritardo temporale. */ private double getHydrograph( int k, double[][] Qpartial, double localdelay, double delay, int tp ) { double Qmax = 0; double tmin = rainData[0][0]; /* [min] */ int j = 0; double t = tmin; double Q; double rain; int maxRain = 0; if (tMax == tpMaxCalibration) { maxRain = rainData.length; } else { maxRain = tp / dt; } double tMaxApproximate = ModelsEngine.approximate2Multiple(tMax, dt); for( t = tmin, j = 0; t <= tMaxApproximate; t += dt, ++j ) { Q = 0; for( int i = 0; i <= maxRain - 1; ++i ) { // [ l / s ] rain = rainData[i][1] * networkPipes[k].getDrainArea() * networkPipes[k].getRunoffCoefficient() * HAOVERH_TO_METEROVERS; if (t <= i * dt) { Q += 0; } else if (t <= (i + 1) * dt) { Q += rain * pFunction(k, t - i * dt, localdelay, delay); } else { Q += rain * (pFunction(k, t - i * dt, localdelay, delay) - pFunction(k, t - (i + 1) * dt, localdelay, delay)); } } Qpartial[j][k] = Q; if (Q >= Qmax) { Qmax = Q; } } return Qmax; } /** * * Verify of the head pipes. * * <p> * It evaluate the discharge. * </p> * * @param k * ID of the pipe where evaluate the discharge. * @param cDelays * delay matrix (for the evalutation of the flow wave). */ private double headPipeVerify( int k, double[] cDelays, double[][] timeDischarge, double[][] timeFillDegree, int tp ) { double olddelay = 0; double qMax = 0; double B = 0; double known = 0; double theta = 0; double u = 0; /* First attempt local delay [min] */ double localdelay = 1; double accuracy = networkPipes[0].getAccuracy(); int jMax = networkPipes[0].getjMax(); double minG = networkPipes[0].getMinG(); double maxtheta = networkPipes[0].getMaxTheta(); double tolerance = networkPipes[0].getTolerance(); int count = 0; do { olddelay = localdelay; qMax = getHydrograph(k, timeDischarge, olddelay, 0, tp); if (qMax <= 1) { qMax = 1; } calculateFillDegree(k, timeDischarge, timeFillDegree); B = qMax / (CUBICMETER2LITER * networkPipes[k].getKs() * Math.sqrt(networkPipes[k].verifyPipeSlope / METER2CM)); known = (B * TWO_THIRTEENOVERTHREE) / Math.pow(networkPipes[k].diameterToVerify / METER2CM, EIGHTOVERTHREE); theta = Utility.thisBisection(maxtheta, known, TWOOVERTHREE, minG, accuracy, jMax, pm, strBuilder); double tmp1 = 0; double tmp2 = 0; if (k - 1 >= 0) { tmp1 = networkPipes[k].diameterToVerify; tmp2 = networkPipes[k].getLenght(); } // Average velocity in pipe [ m / s ] u = qMax * 80 / (Math.pow(tmp1, 2) * (theta - Math.sin(theta))); localdelay = tmp2 / (celerityfactor1 * u * MINUTE2SEC); count++; if (count > MAX_NUMBER_ITERATION) { infiniteLoop = true; throw new ArithmeticException(); } } while( Math.abs(localdelay - olddelay) / olddelay >= tolerance ); cDelays[k] = localdelay; return qMax; } /** * * restituisce la funzione p. * * @param k tratto di tubazione esaminata. * @param ttempo esaminato. * @param localdelay ritardo nella tubazione k. * @param delay ritardo totale. * @return il valore della funxione p */ private double pFunction( int k, double t, double localdelay, double delay ) { double P = 0; if (t < 0) { pm.errorMessage(msg.message("trentoP.error.negativeP")); throw new ArithmeticException(msg.message("trentoP.error.negativeP")); } if (t < delay) { P = 0; } else if (t <= (delay + localdelay)) { P = (t - delay) / localdelay + networkPipes[k].k / localdelay * (Math.exp(-(t - delay) / networkPipes[k].k) - 1); } else { P = 1 + networkPipes[k].k / localdelay * Math.exp(-(t - delay) / networkPipes[k].k) * (1 - Math.exp(localdelay / networkPipes[k].k)); } return P; } /** * Estimate the discharge for each time and for each pipes. * *<p> *It can work with a single rain time step (if there is an actual rain) or search the maximum rain time, if the rain is unknown and *the rain data are builtthroghout the rain possibility curve. *</p> * <p> * It work throgout 2 loop: * <ol> * * * <li>The first on the head pipes. * <li>The second on the pipes which are internal. * * </ol> * </p> */ @Override public void geoSewer() throws Exception { if (!foundMaxrainTime) { evaluateDischarge(lastTimeDischarge, lastTimeFillDegree, tpMaxCalibration); } else { /* * start to evaluate the discharge from 15 minutes,evaluate the nearsted value to 15 minutes. */ int minTime = (int) ModelsEngine.approximate2Multiple(INITIAL_TIME, dt); double qMax = 0; for( int i = minTime; i < tpMaxCalibration; i = i + dt ) { tpMax = i; double[][] timeDischarge = createMatrix(); double[][] timeFillDegree = createMatrix(); double q = evaluateDischarge(timeDischarge, timeFillDegree, i); if (q > qMax) { qMax = q; lastTimeDischarge = timeDischarge; lastTimeFillDegree = timeFillDegree; } else if (q < qMax) { break; } if (isFill) { break; } } } getNetData(); } /* * Fill the two output HashMap. */ private void getNetData() { int nTime = lastTimeDischarge.length; int length = lastTimeDischarge[0].length; HashMap<Integer, double[]> tmpHMDis = new LinkedHashMap<Integer, double[]>(); HashMap<Integer, double[]> tmpHMFill = new LinkedHashMap<Integer, double[]>(); // order the outpt. int netLength = networkPipes.length; double[] one = new double[netLength]; double[] two = new double[netLength]; for( int i = 0; i < netLength; i++ ) { one[i] = i; two[i] = networkPipes[i].getId(); } QuickSortAlgorithm sort = new QuickSortAlgorithm(pm); sort.sort(two, one); for( int i = 0; i < length - 1; i++ ) { int index = (int) one[i]; tmpHMDis.put(networkPipes[index].getId(), new double[]{lastTimeDischarge[0][index]}); tmpHMFill.put(networkPipes[index].getId(), new double[]{lastTimeFillDegree[0][index]}); } discharge.put(first, tmpHMDis); fillDegree.put(first, tmpHMFill); DateTime tmp = first; for( int i = 1; i < nTime; ++i ) { tmp = tmp.plusMinutes(dt); tmpHMDis = new LinkedHashMap<Integer, double[]>(); tmpHMFill = new LinkedHashMap<Integer, double[]>(); for( int j = 0; j < length - 1; j++ ) { int index = (int) one[j]; tmpHMDis.put(networkPipes[index].getId(), new double[]{lastTimeDischarge[i][index]}); tmpHMFill.put(networkPipes[index].getId(), new double[]{lastTimeFillDegree[i][index]}); } discharge.put(tmp, tmpHMDis); fillDegree.put(tmp, tmpHMFill); } } /** * Compila la mantrice net con tutte i dati del sottobacino con chiusura nel * tratto che si sta analizzando, e restituisce la sua superfice * * @param k tratto analizzato del sottobacino chiuso in l. * @param l chiusura del bacino. * @param one indice dei versanti. * @param net sottobacino che si chiude in l. */ private double scanNetwork( int k, int l, double[] one, double[][] net ) { int ind; /* * t Ritardo accumulato dall'onda prima di raggiungere il tratto si sta * dimensionando. */ double t; /* * Distanza percorsa dall'acqua dall'area dove e' caduta per raggiungere * l'ingresso del tratto che si sta dimensionando. */ double length; /* * Superfice del sottobacino con chiusura nel tratto che si sta * analizzando. */ double totalarea = 0; int r = 0; int i = 0; /* * In one gli stati sono in ordine di magmitude crescente. Per ogni * stato di magnitude inferiore a quella del tratto l che si sta * progettando. */ for( int j = 0; j < k; j++ ) { /* La portata e valutata all'uscita di ciascun tratto */ t = 0; /* * ID dello lo stato di magnitude inferiore a quello del tratto che * si sta progettando. */ i = (int) one[j]; ind = i; // la lunghezza del tubo precedentemente progettato length = networkPipes[ind].getLenght(); // seguo il percorso dell'acqua finch� non si incontra l'uscita. while( networkPipes[ind].getIdPipeWhereDrain() != OUT_ID_PIPE ) { // lo stato dove drena a sua volta. ind = networkPipes[ind].getIndexPipeWhereDrain(); /* * se lo stato drena direttamente in quello che si sta * progettando */ if (ind == l) { /* * ID dello stato che drena in l, piu o meno direttamente. */ net[r][0] = i; /* * lunghezza del percorsa dall'acqua prima di raggiungere lo * stato l che si sta progettando */ net[r][1] = length + networkPipes[l].getLenght(); /* * Ritardo accumulato dall'onda di piena formatasi in uno * degli stati a monte, prima di raggiungere il tratto l che * si sta progettando */ net[r][2] = t; /* * area di tutti gli stati a monte che direttamente o * indirettamente drenano in l */ totalarea += networkPipes[i].getDrainArea(); r++; break; } } /* * viene incrementato solo se l'area drena in l quindi non puo' * superare net->nrh */ if (r > net.length) break; } // area degli stati a monte che drenano in l, l compreso totalarea += networkPipes[l].getDrainArea(); return totalarea; } private double evaluateDischarge( double[][] timeDischarge, double[][] timeFillDegree, int tp ) { /* l Tratto che si sta progettando. */ int l; /* * matrice che per ciascun area non di testa, contiene i dati geometrici * degli stati a monte, che direttamente o indirettamente, drenano in * esso */ double[][] net; /* * contiene la magnitude dei vari stati. */ double[] magnitude = new double[networkPipes.length]; /* * vettore che contiene l'indice dei versanti. */ double[] one = new double[networkPipes.length]; /* * vettore che contiene gli stati riceventi, compresa almeno un'uscita */ double[] two = new double[networkPipes.length]; /* *Max discharge at this iteration; */ double qMax = 0; // initialize the discharge array for( int i = 0; i < networkPipes.length; i++ ) { /* Indice degli stati */ one[i] = i; /* Indice degli stati riceventi, compresa almeno un'uscita */ two[i] = networkPipes[i].getIndexPipeWhereDrain(); } /* Calcola la magnitude di ciascun stato */ Utility.pipeMagnitude(magnitude, two, pm);/* * Calcola la magnitude di * ciascun stato */ /* al vettore two vengono assegnati gli elementi di magnitude */ for( int i = 0; i < two.length; i++ ) /* * al vettore two vengono assegnati * gli elementi di magnitude */ { two[i] = magnitude[i]; } /* * Ordina gli elementi del vettore magnitude in ordine crescente, e * posiziona nello stesso ordine gli elementi di one */ QuickSortAlgorithm t = new QuickSortAlgorithm(pm); t.sort(magnitude, one); int k = 0; // tratto che si sta analizzando o progettando l = (int) one[k]; pm.beginTask(msg.message("trentoP.begin"), networkPipes.length - 1); isFill = false; double[] cDelays = new double[networkPipes.length]; double maxFill = angleToFillDegree(networkPipes[k].getMaxTheta()); while( magnitude[k] == 1 ) { try { double q = headPipeVerify(l, cDelays, timeDischarge, timeFillDegree, tp); if (q > qMax) { qMax = q; } // Passo allo stato successivo k++; if (k < magnitude.length) { /* * Il prossimo tratto da progettare, ovviamente se avra * magnitude=1 */ l = (int) one[k]; } else { break; } pm.worked(1); } catch (ArithmeticException e) { if (infiniteLoop) { strBuilder.append(msg.message("trentoP.error.infiniteLoop")); } else { NumberFormat formatter = new DecimalFormat("#.###"); String limit = formatter.format(maxFill); strBuilder.append(" "); strBuilder.append(msg.message("trentoP.warning.emptydegree")); //$NON-NLS-2$ strBuilder.append(limit); strBuilder.append(" "); strBuilder.append(msg.message("trentoP.warning.emptydegree2")); strBuilder.append(networkPipes[l - 1].getId()); strBuilder.append(" "); strBuilder.append("tp " + tp); strBuilder.append("\n"); isFill = true; } break; } } /* * ----- INIZIO CICLO WHILE PER LA PROGETTAZIONE DELLE AREE NON DI TESTA * ----- * * Magnitude > 1 AREE NON DI TESTA */ if (!isFill) { while( k < magnitude.length ) { try { net = new double[(int) (magnitude[k] - 1)][9]; scanNetwork(k, l, one, net); double q = internalPipeVerify(l, cDelays, net, timeDischarge, timeFillDegree, tp); if (q > qMax) { qMax = q; } /* Passo allo stato successivo */ k++; /* se non sono arrivato alla fine */ if (k < magnitude.length) { /* Prossimo stato da progettare */ l = (int) one[k]; } else { break; } pm.worked(1); } catch (ArithmeticException e) { // if there is an infinite loop. if (infiniteLoop) { strBuilder.append(msg.message("trentoP.error.infiniteLoop")); } else { // if a pipe is fill. strBuilder.append(msg.message("trentoP.warning.emptydegree")); //$NON-NLS-2$ strBuilder.append(maxFill); strBuilder.append(" "); strBuilder.append(msg.message("trentoP.warning.emptydegree2")); strBuilder.append(networkPipes[l].getId()); strBuilder.append(" "); strBuilder.append("tp " + tp); strBuilder.append("\n"); isFill = true; } break; } } } return qMax; } }
silviafranceschi/jgrasstools
hortonmachine/src/main/java/org/jgrasstools/hortonmachine/modules/networktools/trento_p/net/NetworkCalibration.java
Java
gpl-3.0
34,950
/** * Copyright 2015 Google Inc. 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. */ .dash-animation { height: 200px; width: 300px; padding: 0; background: none; } .dash-animation__container { position: relative; overflow: hidden; margin: 0; padding: 0; width: 100%; height: 100%; text-align: center; background-color: #ddd; } .dash-animation__container-foreground { width: 100%; height: 100%; position: absolute; left: 0; top: 0; z-index: 100; } .dash-animation__container-background { line-height: 200px; z-index: -100; } /* Outside the view, on the left. We leave the view when moving to this state, so we use fast-out-linear-in. */ .dash-animation--position-0 { left: -102px; } /* Left side. We enter the view when moving to this state, so we use linear-out-slow-in. */ .dash-animation--position-1 { left: 20px; } /* Right side. We're always visible when moving to this state, so we use default. */ .dash-animation--position-2 { left: 180px; } /* Outside the view, on the right. We leave the view when moving to this state, so we use fast-out-linear-in. */ .dash-animation--position-3 { left: 302px; } /* Right side. We enter the view when moving to this state, so we use linear-out-slow-in. */ .dash-animation--position-4 { left: 180px; } /* Left side. We're always visible when moving to this state, so we use default. */ .dash-animation--position-5 { left: 20px; } .dash-animation__movable { background-color: red; border-radius: 2px; display: block; height: 100px; width: 100px; position: absolute; top: 50px; transition-property: left; transition-duration: 0.2s; }
Douglasfeuser/getCode
bower_components/material-design-lite/src/animation/demo.css
CSS
gpl-3.0
2,206
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>is_member_function_pointer</title> <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> <link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.TypeTraits"> <link rel="up" href="../reference.html" title="Alphabetical Reference"> <link rel="prev" href="is_lvalue_reference.html" title="is_lvalue_reference"> <link rel="next" href="is_member_object_pointer.html" title="is_member_object_pointer"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> <td align="center"><a href="../../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="is_lvalue_reference.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="is_member_object_pointer.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> <a name="boost_typetraits.reference.is_member_function_pointer"></a><a class="link" href="is_member_function_pointer.html" title="is_member_function_pointer">is_member_function_pointer</a> </h3></div></div></div> <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">is_member_function_pointer</span> <span class="special">:</span> <span class="keyword">public</span> <em class="replaceable"><code><a class="link" href="integral_constant.html" title="integral_constant">true_type</a>-or-<a class="link" href="integral_constant.html" title="integral_constant">false_type</a></code></em> <span class="special">{};</span> </pre> <p> <span class="bold"><strong>Inherits:</strong></span> If T is a (possibly cv-qualified) pointer to a member function then inherits from <a class="link" href="integral_constant.html" title="integral_constant">true_type</a>, otherwise inherits from <a class="link" href="integral_constant.html" title="integral_constant">false_type</a>. </p> <p> <span class="bold"><strong>C++ Standard Reference:</strong></span> 3.9.2 and 8.3.3. </p> <p> <span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers are supported by this trait. </p> <p> <span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">is_member_function_pointer</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code> or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code> </p> <p> <span class="bold"><strong>Examples:</strong></span> </p> <div class="blockquote"><blockquote class="blockquote"><p> <code class="computeroutput"><span class="identifier">is_member_function_pointer</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">MyClass</span><span class="special">::*)(</span><span class="keyword">void</span><span class="special">)&gt;</span></code> inherits from <code class="computeroutput"><a class="link" href="integral_constant.html" title="integral_constant">true_type</a></code>. </p></blockquote></div> <div class="blockquote"><blockquote class="blockquote"><p> <code class="computeroutput"><span class="identifier">is_member_function_pointer</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">MyClass</span><span class="special">::*)(</span><span class="keyword">char</span><span class="special">)&gt;::</span><span class="identifier">type</span></code> is the type <code class="computeroutput"><a class="link" href="integral_constant.html" title="integral_constant">true_type</a></code>. </p></blockquote></div> <div class="blockquote"><blockquote class="blockquote"><p> <code class="computeroutput"><span class="identifier">is_member_function_pointer</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">MyClass</span><span class="special">::*)(</span><span class="keyword">void</span><span class="special">)</span><span class="keyword">const</span><span class="special">&gt;::</span><span class="identifier">value</span></code> is an integral constant expression that evaluates to <span class="emphasis"><em>true</em></span>. </p></blockquote></div> <div class="blockquote"><blockquote class="blockquote"><p> <code class="computeroutput"><span class="identifier">is_member_function_pointer</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">(</span><span class="identifier">MyClass</span><span class="special">::*)&gt;::</span><span class="identifier">value</span></code> is an integral constant expression that evaluates to <span class="emphasis"><em>false</em></span>: the argument in this case is a pointer to a data member and not a member function, see <a class="link" href="is_member_object_pointer.html" title="is_member_object_pointer">is_member_object_pointer</a> and <a class="link" href="is_member_pointer.html" title="is_member_pointer">is_member_pointer</a> </p></blockquote></div> <div class="blockquote"><blockquote class="blockquote"><p> <code class="computeroutput"><span class="identifier">is_member_function_pointer</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">value_type</span></code> is the type <code class="computeroutput"><span class="keyword">bool</span></code>. </p></blockquote></div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2000, 2011 Adobe Systems Inc, David Abrahams, Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven Watanabe<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="is_lvalue_reference.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="is_member_object_pointer.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
gwq5210/litlib
thirdparty/sources/boost_1_60_0/libs/type_traits/doc/html/boost_typetraits/reference/is_member_function_pointer.html
HTML
gpl-3.0
8,571
/* ======================================================================== D O O M R e t r o The classic, refined DOOM source port. For Windows PC. ======================================================================== Copyright © 1993-2012 id Software LLC, a ZeniMax Media company. Copyright © 2013-2018 Brad Harding. DOOM Retro is a fork of Chocolate DOOM. For a list of credits, see <https://github.com/bradharding/doomretro/wiki/CREDITS>. This file is part of DOOM Retro. DOOM Retro is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. DOOM Retro is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with DOOM Retro. If not, see <https://www.gnu.org/licenses/>. DOOM is a registered trademark of id Software LLC, a ZeniMax Media company, in the US and/or other countries and is used without permission. All other trademarks are the property of their respective holders. DOOM Retro is in no way affiliated with nor endorsed by id Software. ======================================================================== */ #if !defined(__W_WAD_H__) #define __W_WAD_H__ #include "doomdef.h" #include "w_file.h" // // TYPES // // // WADFILE I/O related stuff. // #define IWAD 1 #define PWAD 2 typedef struct lumpinfo_s lumpinfo_t; struct lumpinfo_s { char name[9]; int size; void *cache; // killough 1/31/98: hash table fields, used for ultra-fast hash table lookup int index; int next; int position; wadfile_t *wadfile; }; extern lumpinfo_t **lumpinfo; extern int numlumps; extern char *iwadsrequired[]; char *GetCorrectCase(char *path); wadfile_t *W_AddFile(char *filename, dboolean automatic); int W_WadType(char *filename); int W_CheckNumForName(const char *name); int W_RangeCheckNumForName(int min, int max, const char *name); int W_GetNumForName(const char *name); int W_GetNumForName2(const char *name); int W_CheckMultipleLumps(const char *name); int W_LumpLength(int lump); void W_ReadLump(int lump, void *dest); void *W_CacheLumpNum(int lumpnum); #define W_CacheLumpName(name) W_CacheLumpNum(W_GetNumForName(name)) #define W_CacheLumpName2(name) W_CacheLumpNum(W_GetNumForName2(name)) void W_Init(void); unsigned int W_LumpNameHash(const char *s); void W_ReleaseLumpNum(int lumpnum); #define W_ReleaseLumpName(name) W_ReleaseLumpNum(W_GetNumForName(name)) GameMission_t IWADRequiredByPWAD(char *pwadname); dboolean HasDehackedLump(const char *pwadname); #endif
jasoncarlough/doomretro
src/w_wad.h
C
gpl-3.0
2,997
<?php class Facade extends AppModel { var $name = 'Facade'; var $useTable = false; } ?>
searchfirst/ODN
app/models/facade.php
PHP
gpl-3.0
89
// @file /* * Copyright (C) 2010 10gen Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <map> #include "../security_common.h" namespace mongo { /** here we keep a single connection (with reconnect) for a set of hosts, one each, and allow one user at a time per host. if in use already for that host, we block. so this is an easy way to keep a 1-deep pool of connections that many threads can share. thread-safe. Example: { ScopedConn c("foo.acme.com:9999"); c->runCommand(...); } throws exception on connect error (but fine to try again later with a new scopedconn object for same host). */ class ScopedConn { public: /** throws assertions if connect failure etc. */ ScopedConn(string hostport); ~ScopedConn() { // conLock releases... } void reconnect() { connInfo->cc.reset(new DBClientConnection(true, 0, 10)); connInfo->cc->_logLevel = 2; connInfo->connected = false; connect(); } /* If we were to run a query and not exhaust the cursor, future use of the connection would be problematic. So here what we do is wrapper known safe methods and not allow cursor-style queries at all. This makes ScopedConn limited in functionality but very safe. More non-cursor wrappers can be added here if needed. */ bool runCommand(const string &dbname, const BSONObj& cmd, BSONObj &info, int options=0, const AuthenticationTable* auth=NULL) { return conn()->runCommand(dbname, cmd, info, options, auth); } unsigned long long count(const string &ns) { return conn()->count(ns); } BSONObj findOne(const string &ns, const Query& q, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) { return conn()->findOne(ns, q, fieldsToReturn, queryOptions); } private: auto_ptr<scoped_lock> connLock; static mongo::mutex mapMutex; struct ConnectionInfo { mongo::mutex lock; scoped_ptr<DBClientConnection> cc; bool connected; ConnectionInfo() : lock("ConnectionInfo"), cc(new DBClientConnection(/*reconnect*/ true, 0, /*timeout*/ 10.0)), connected(false) { cc->_logLevel = 2; } } *connInfo; typedef map<string,ScopedConn::ConnectionInfo*> M; static M& _map; scoped_ptr<DBClientConnection>& conn() { return connInfo->cc; } const string _hostport; // we should already be locked... bool connect() { string err; if (!connInfo->cc->connect(_hostport, err)) { log() << "couldn't connect to " << _hostport << ": " << err << rsLog; return false; } connInfo->connected = true; // if we cannot authenticate against a member, then either its key file // or our key file has to change. if our key file has to change, we'll // be rebooting. if their file has to change, they'll be rebooted so the // connection created above will go dead, reconnect, and reauth. if (!noauth) { if (!connInfo->cc->auth("local", internalSecurity.user, internalSecurity.pwd, err, false)) { log() << "could not authenticate against " << _hostport << ", " << err << rsLog; return false; } connInfo->cc->setAuthenticationTable( AuthenticationTable::getInternalSecurityAuthenticationTable() ); } return true; } }; inline ScopedConn::ScopedConn(string hostport) : _hostport(hostport) { bool first = false; { scoped_lock lk(mapMutex); connInfo = _map[_hostport]; if( connInfo == 0 ) { connInfo = _map[_hostport] = new ConnectionInfo(); first = true; connLock.reset( new scoped_lock(connInfo->lock) ); } } // already locked connLock above if (first) { connect(); return; } connLock.reset( new scoped_lock(connInfo->lock) ); if (connInfo->connected) { return; } // Keep trying to connect if we're not yet connected connect(); } }
wolfsoft/dbpager
src/modules/dbp_mongo/mongo-cxx-driver-nightly/src/mongo/db/repl/connections.h
C
gpl-3.0
5,401
// trdlocal.cpp - written and placed in the public domain by Wei Dai #include "pch.h" #include "config.h" // TODO: fix this when more complete C++11 support is cut-in #if CRYPTOPP_MSC_VERSION # pragma warning(disable: 4297) #endif #ifndef CRYPTOPP_IMPORTS #if !defined(NO_OS_DEPENDENCE) && defined(THREADS_AVAILABLE) #include "trdlocal.h" #ifdef HAS_WINTHREADS #define WIN32_LEAN_AND_MEAN #include <windows.h> #endif NAMESPACE_BEGIN(CryptoPP) ThreadLocalStorage::Err::Err(const std::string& operation, int error) : OS_Error(OTHER_ERROR, "ThreadLocalStorage: " + operation + " operation failed with error 0x" + IntToString(error, 16), operation, error) { } ThreadLocalStorage::ThreadLocalStorage() { #ifdef HAS_WINTHREADS m_index = TlsAlloc(); assert(m_index != TLS_OUT_OF_INDEXES); if (m_index == TLS_OUT_OF_INDEXES) throw Err("TlsAlloc", GetLastError()); #else m_index = 0; int error = pthread_key_create(&m_index, NULL); assert(!error); if (error) throw Err("pthread_key_create", error); #endif } ThreadLocalStorage::~ThreadLocalStorage() CRYPTOPP_THROW { #ifdef CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE if (!std::uncaught_exception()) #else try #endif #ifdef HAS_WINTHREADS { int rc = TlsFree(m_index); assert(rc); if (!rc) throw Err("TlsFree", GetLastError()); } #else { int error = pthread_key_delete(m_index); assert(!error); if (error) throw Err("pthread_key_delete", error); } #endif #ifndef CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE catch(const Exception&) { } #endif } void ThreadLocalStorage::SetValue(void *value) { #ifdef HAS_WINTHREADS if (!TlsSetValue(m_index, value)) throw Err("TlsSetValue", GetLastError()); #else int error = pthread_setspecific(m_index, value); if (error) throw Err("pthread_key_getspecific", error); #endif } void *ThreadLocalStorage::GetValue() const { #ifdef HAS_WINTHREADS void *result = TlsGetValue(m_index); const DWORD dwRet = GetLastError(); assert(result || (!result && (dwRet == NO_ERROR))); if (!result && dwRet != NO_ERROR) throw Err("TlsGetValue", dwRet); #else // Null is a valid return value. Posix does not provide a way to // check for a "good" Null vs a "bad" Null (errno is not set). void *result = pthread_getspecific(m_index); #endif return result; } NAMESPACE_END #endif // THREADS_AVAILABLE #endif // CRYPTOPP_IMPORTS
EgorKolesnikov/Kolepov
cryptopp/trdlocal.cpp
C++
gpl-3.0
2,343
----------------------------------- -- Area: Castle Oztroja (151) -- MOB: Yagudo_Prior ----------------------------------- require("scripts/zones/Castle_Oztroja/MobIDs"); ----------------------------------- -- onMobDespawn ----------------------------------- function onMobDespawn(mob) local mobID = mob:getID(); if (Yaa_Haqa_the_Profane_PH[mobID] ~= nil) then local ToD = GetServerVariable("[POP]Yaa_Haqa_the_Profane"); if (ToD <= os.time(t) and GetMobAction(Yaa_Haqa_the_Profane) == 0) then if (math.random(1,20) == 5) then UpdateNMSpawnPoint(Yaa_Haqa_the_Profane); GetMobByID(Yaa_Haqa_the_Profane):setRespawnTime(GetMobRespawnTime(mobID)); SetServerVariable("[PH]Yaa_Haqa_the_Profane", mobID); DeterMob(mobID, true); end end end end;
kjl2y/darkstar
scripts/zones/Castle_Oztroja/mobs/Yagudo_Prior.lua
Lua
gpl-3.0
869
package org.esa.s2tbx.dataio.gdal.reader.plugins; /** * @author Jean Coravu */ public class RMFDriverProductReaderPlugInTest extends AbstractTestDriverProductReaderPlugIn { public RMFDriverProductReaderPlugInTest() { super(".rsw", "RMF", new RMFDriverProductReaderPlugIn()); } }
oscarpicas/s2tbx
s2tbx-gdal-reader/src/test/java/org/esa/s2tbx/dataio/gdal/reader/plugins/RMFDriverProductReaderPlugInTest.java
Java
gpl-3.0
299
compiler := gcc extra_flags := use_neon := 0 build = release DYLIB := so PREFIX := /usr INSTALLDIR := $(PREFIX)/lib/retroarch/filters/audio ifeq ($(platform),) platform = unix ifeq ($(shell uname -s),) platform = win else ifneq ($(findstring Darwin,$(shell uname -s)),) platform = osx arch = intel ifeq ($(shell uname -p),powerpc) arch = ppc endif else ifneq ($(findstring MINGW,$(shell uname -s)),) platform = win endif endif ifeq ($(platform),gcc) extra_rules_gcc := $(shell $(compiler) -dumpmachine) endif ifneq (,$(findstring armv7,$(extra_rules_gcc))) extra_flags += -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon use_neon := 1 endif ifneq (,$(findstring hardfloat,$(extra_rules_gcc))) extra_flags += -mfloat-abi=hard endif ifeq (release,$(build)) extra_flags += -O2 endif ifeq (debug,$(build)) extra_flags += -O0 -g endif ldflags := $(LDFLAGS) -shared -lm -Wl,--version-script=link.T ifeq ($(platform), unix) DYLIB = so else ifeq ($(platform), osx) compiler := $(CC) DYLIB = dylib ldflags := -dynamiclib ARCHFLAGS= MINVERFLAGS= ifeq ($(shell uname -p),arm) MINVERFLAGS = -mmacosx-version-min=10.15 -stdlib=libc++ # macOS (Metal, ARM 64bit) MINVERFLAGS += -DDONT_WANT_ARM_OPTIMIZATIONS else ifeq ($(HAVE_METAL),1) MINVERFLAGS = -mmacosx-version-min=10.13 -stdlib=libc++ # macOS (Metal, x86 64bit) else ifeq ($(shell uname -p),powerpc) MINVERFLAGS = -mmacosx-version-min=10.5 # macOSX (PowerPC 32-bit) else ifeq ($(shell uname -m),i386) MINVERFLAGS = -mmacosx-version-min=10.6 # macOSX (OpenGL, x86 32bit) else MINVERFLAGS = -mmacosx-version-min=10.7 -stdlib=libc++ # macOSX (OpenGL, x86 64bit) endif # Build for a specific architecture when ARCH is defined as a switch ifeq ($(ARCH),arm64) MINVERFLAGS = -mmacosx-version-min=10.15 -stdlib=libc++ # macOS (Metal, ARM 64bit) MINVERFLAGS += -DDONT_WANT_ARM_OPTIMIZATIONS ARCHFLAGS = -arch arm64 else ifeq ($(ARCH),x86_64) ifeq ($(HAVE_METAL),1) MINVERFLAGS = -mmacosx-version-min=10.13 -stdlib=libc++ else MINVERFLAGS = -mmacosx-version-min=10.7 -stdlib=libc++ endif ARCHFLAGS = -arch x86_64 else ifeq ($(ARCH),x86) MINVERFLAGS = -mmacosx-version-min=10.6 ARCHFLAGS = -arch x86 else ifeq ($(ARCH),ppc) MINVERFLAGS = -mmacosx-version-min=10.5 ARCHFLAGS = -arch ppc endif ifeq ($(BUILDBOT),1) ARCHFLAGS = -target $(LIBRETRO_APPLE_PLATFORM) -isysroot $(LIBRETRO_APPLE_ISYSROOT) endif extraflags += $(MINVERFLAGS) $(ARCHFLAGS) ldflags += $(MINVERFLAGS) $(ARCHFLAGS) else extra_flags += -static-libgcc -static-libstdc++ DYLIB = dll endif CC := $(compiler) -Wall CXX := $(subst CC,++,$(compiler)) -std=gnu++0x -Wall flags := $(CPPFLAGS) $(CFLAGS) -fPIC $(extra_flags) -I../../include asflags := $(ASFLAGS) -fPIC $(extra_flags) objects := ifeq (1,$(use_neon)) ASMFLAGS := -INEON/asm asflags += -mfpu=neon endif plugs := $(wildcard *.c) objects := $(plugs:.c=.o) targets := $(objects:.o=.$(DYLIB)) all: build; %.o: %.S $(CC) -c -o $@ $(asflags) $(ASMFLAGS) $< %.o: %.c $(CC) -c -o $@ $(flags) $< %.$(DYLIB): %.o $(CC) -o $@ $(ldflags) $(flags) $^ build: $(targets) clean: rm -f *.o rm -f *.$(DYLIB) strip: strip -s *.$(DYLIB) install: mkdir -p $(DESTDIR)$(INSTALLDIR) cp -t $(DESTDIR)$(INSTALLDIR) $(targets) *.dsp test-install: DESTDIR=/tmp/build $(MAKE) install
spec-chum/RetroArch
libretro-common/audio/dsp_filters/Makefile
Makefile
gpl-3.0
3,598
"""CLI tests for Insights part of RH Cloud - Inventory plugin. :Requirement: RH Cloud - Inventory :CaseAutomation: Automated :CaseLevel: System :CaseComponent: RHCloud-Inventory :Assignee: jpathan :TestType: Functional :CaseImportance: High :Upstream: No """ import pytest from broker.broker import VMBroker from robottelo.constants import DISTRO_RHEL7 from robottelo.constants import DISTRO_RHEL8 from robottelo.hosts import ContentHost @pytest.mark.tier4 @pytest.mark.parametrize('distro', [DISTRO_RHEL8, DISTRO_RHEL7]) def test_positive_connection_option(organization_ak_setup, default_sat, distro): """Verify that 'insights-client --test-connection' successfully tests the proxy connection via the Satellite. :id: 61a4a39e-b484-49f4-a6fd-46ffc7736e50 :Steps: 1. Create RHEL7 and RHEL8 VM and register to insights within org having manifest. 2. Run 'insights-client --test-connection'. :expectedresults: 'insights-client --test-connection' should return 0. :CaseImportance: Critical """ org, activation_key = organization_ak_setup with VMBroker(nick=distro, host_classes={'host': ContentHost}) as vm: vm.configure_rhai_client(default_sat, activation_key.name, org.label, distro) result = vm.run('insights-client --test-connection') assert result.status == 0, ( 'insights-client --test-connection failed.\n' f'status: {result.status}\n' f'stdout: {result.stdout}\n' f'stderr: {result.stderr}' )
lpramuk/robottelo
tests/foreman/cli/test_rhcloud_insights.py
Python
gpl-3.0
1,546
<?php // Heading $_['heading_title'] = 'Account Login'; // Text $_['text_account'] = 'Account'; $_['text_login'] = 'Login'; $_['text_new_customer'] = 'New Customer'; $_['text_register'] = 'Register Account'; $_['text_register_account'] = 'By creating an account you will be able to shop faster, be up to date on an order\'s status, and keep track of the orders you have previously made.'; $_['text_returning_customer'] = 'Returning Customer'; //$_['text_i_am_returning_customer'] = 'I am a returning customer'; $_['text_i_am_returning_customer'] = 'Sign in'; $_['text_forgotten'] = 'Forgotten Password?'; // Entry $_['entry_email'] = 'Email Address'; $_['entry_password'] = 'Password'; // Error $_['error_login'] = '*Warning: No match for Email Address and/or Password.'; $_['error_approved'] = '*Warning: Your account requires approval before you can login.'; $_['error_activation'] = '*Warning: Please activate your account first.'; ?>
kuuga2000/bungaindo
catalog/language/english/account/loginbk30sept.php
PHP
gpl-3.0
1,118
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers /***************************************************************************** * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. * * OpenRCT2 is the work of many authors, a full list can be found in contributors.md * For more information, visit https://github.com/OpenRCT2/OpenRCT2 * * OpenRCT2 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * A full copy of the GNU General Public License can be found in licence.txt *****************************************************************************/ #pragma endregion #ifndef _WIDGET_H_ #define _WIDGET_H_ #include "window.h" typedef enum { WWT_EMPTY = 0, WWT_FRAME = 1, WWT_RESIZE = 2, WWT_IMGBTN = 3, WWT_4 = 4, // Same as IMGBTN but uses .image + 1 while pressed/active WWT_5 = 5, WWT_COLOURBTN = 6, WWT_TRNBTN = 7, WWT_TAB = 8, WWT_FLATBTN = 9, WWT_DROPDOWN_BUTTON = 10, WWT_11, // Same as dropdown button but uses .text + 1 while pressed/active WWT_12, // looks like a normal label to me WWT_13, WWT_14, WWT_SPINNER = 15, WWT_DROPDOWN = 16, WWT_VIEWPORT = 17, WWT_18, WWT_GROUPBOX = 19, WWT_CAPTION = 20, WWT_CLOSEBOX = 21, WWT_SCROLL = 22, WWT_CHECKBOX = 23, WWT_24, WWT_25, WWT_TEXT_BOX = 27, WWT_LAST = 26, } WINDOW_WIDGET_TYPES; #define WIDGETS_END WWT_LAST, 0, 0, 0, 0, 0, 0, 0 #define BAR_BLINK (1u << 31) enum { SCROLL_HORIZONTAL = (1 << 0), SCROLL_VERTICAL = (1 << 1), SCROLL_BOTH = SCROLL_HORIZONTAL | SCROLL_VERTICAL }; #ifdef __cplusplus extern "C" { #endif void widget_scroll_update_thumbs(rct_window *w, rct_widgetindex widget_index); void widget_draw(rct_drawpixelinfo *dpi, rct_window *w, rct_widgetindex widgetIndex); bool widget_is_enabled(rct_window *w, rct_widgetindex widgetIndex); bool widget_is_disabled(rct_window *w, rct_widgetindex widgetIndex); bool widget_is_pressed(rct_window *w, rct_widgetindex widgetIndex); bool widget_is_highlighted(rct_window *w, rct_widgetindex widgetIndex); bool widget_is_active_tool(rct_window *w, rct_widgetindex widgetIndex); void widget_scroll_get_part(rct_window *w, rct_widget* widget, sint32 x, sint32 y, sint32 *output_x, sint32 *output_y, sint32 *output_scroll_area, sint32 *scroll_id); void widget_set_enabled(rct_window *w, rct_widgetindex widgetIndex, bool enabled); void widget_set_checkbox_value(rct_window *w, rct_widgetindex widgetIndex, sint32 value); #ifdef __cplusplus } #endif #endif
gDanix/OpenRCT2
src/openrct2/interface/widget.h
C
gpl-3.0
2,727
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using OpenDentBusiness; namespace OpenDental { public partial class FormClaimResend:Form { public FormClaimResend() { InitializeComponent(); Lan.F(this); } public bool IsClaimReplacement { get{ return radioClaimReplacement.Checked; } } private void radioClaimOriginal_Click(object sender,EventArgs e) { radioClaimOriginal.Checked=true; radioClaimReplacement.Checked=false; } private void radioClaimReplacement_Click(object sender,EventArgs e) { radioClaimOriginal.Checked=false; radioClaimReplacement.Checked=true; } private void butSend_Click(object sender,EventArgs e) { DialogResult=DialogResult.OK; } private void butCancel_Click(object sender,EventArgs e) { DialogResult=DialogResult.Cancel; } } }
eae/opendental
OpenDental/Forms/FormClaimResend.cs
C#
gpl-3.0
937
package com.arcusys.valamis.lesson.service.impl import com.arcusys.learn.liferay.LiferayClasses._ import com.arcusys.learn.liferay.util.CourseUtilHelper import com.arcusys.valamis.lesson.model.{LessonUser, Lesson, LessonViewer} import com.arcusys.valamis.member.model.{Member, MemberTypes} import com.arcusys.valamis.lesson.service.LessonMembersService import com.arcusys.valamis.lesson.storage.LessonTableComponent import com.arcusys.valamis.lesson.storage.query.{LessonQueries, LessonViewerQueries} import com.arcusys.valamis.member.service.MemberService import com.arcusys.valamis.model.{RangeResult, SkipTake} import com.arcusys.valamis.persistence.common.SlickProfile import scala.slick.driver.JdbcProfile import scala.slick.jdbc.JdbcBackend /** * Created by mminin on 19.02.16. */ abstract class LessonMembersServiceImpl(val db: JdbcBackend#DatabaseDef, val driver: JdbcProfile) extends LessonMembersService with LessonTableComponent with LessonViewerQueries with LessonQueries with SlickProfile { import driver.simple._ def memberService: MemberService def removeMembers(lessonId: Long, viewerIds: Seq[Long], viewerType: MemberTypes.Value): Unit = { db.withTransaction { implicit s => lessonViewers .filterByTypeAndLessonId(viewerType, lessonId) .filterByViewerIds(viewerIds) .delete } } def addMembers(lessonId: Long, viewerIds: Seq[Long], viewerType: MemberTypes.Value): Unit = { val viewers = viewerIds.map(LessonViewer(lessonId, _, viewerType)) db.withTransaction { implicit s => lessonViewers .filterByTypeAndLessonId(viewerType, lessonId) .filterByViewerIds(viewerIds) .delete lessonViewers ++= viewers } } def getMembers(lessonId: Long, viewerType: MemberTypes.Value, nameFilter: Option[String], ascending: Boolean, skipTake: Option[SkipTake]): RangeResult[Member] = { val (courseId, viewerIds) = db.withSession { implicit s => val courseId = lessons.filterById(lessonId).selectCourseId.first val viewerIds = lessonViewers .filterByTypeAndLessonId(viewerType, lessonId) .map(_.viewerId) .list (courseId, viewerIds) } if (viewerIds.isEmpty) { RangeResult(0, Nil) } else { val companyId = CourseUtilHelper.getCompanyId(courseId) memberService.getMembers(viewerIds, true, viewerType, companyId, nameFilter, ascending, skipTake) } } def getUserMembers(lessonId: Long, nameFilter: Option[String], ascending: Boolean, skipTake: Option[SkipTake], organizationId: Option[Long]): RangeResult[LUser] = { val (courseId, viewerIds) = db.withSession { implicit s => val courseId = lessons.filterById(lessonId).selectCourseId.first val viewerIds = lessonViewers .filterByTypeAndLessonId(MemberTypes.User, lessonId) .map(_.viewerId) .list (courseId, viewerIds) } if (viewerIds.isEmpty) { RangeResult(0, Nil) } else { val companyId = CourseUtilHelper.getCompanyId(courseId) memberService.getUserMembers(viewerIds, true, companyId, nameFilter, ascending, skipTake, organizationId) } } def getAvailableMembers(lessonId: Long, viewerType: MemberTypes.Value, nameFilter: Option[String], ascending: Boolean, skipTake: Option[SkipTake]): RangeResult[Member] = { val (courseId, viewerIds) = db.withSession { implicit s => val courseId = lessons.filterById(lessonId).selectCourseId.first val viewerIds = lessonViewers .filterByTypeAndLessonId(viewerType, lessonId) .map(_.viewerId) .list (courseId, viewerIds) } val companyId = CourseUtilHelper.getCompanyId(courseId) memberService.getMembers(viewerIds, false, viewerType, companyId, nameFilter, ascending, skipTake) } def getAvailableUserMembers(lessonId: Long, nameFilter: Option[String], ascending: Boolean, skipTake: Option[SkipTake], organizationId: Option[Long]): RangeResult[LUser] = { val (courseId, viewerIds) = db.withSession { implicit s => val courseId = lessons.filterById(lessonId).selectCourseId.first val viewerIds = lessonViewers .filterByTypeAndLessonId(MemberTypes.User, lessonId) .map(_.viewerId) .list (courseId, viewerIds) } val companyId = CourseUtilHelper.getCompanyId(courseId) memberService.getUserMembers(viewerIds, false, companyId, nameFilter, ascending, skipTake, organizationId) } def getLessonMembers(lessonIds: Seq[Long]): Seq[LessonViewer] = { db.withSession { implicit s => lessonViewers.filter(_.lessonId inSet lessonIds) .list } } def getLessonsUsers(lessons: Seq[Lesson], allUsers: Seq[LUser]): Seq[LessonUser] = { if (allUsers.isEmpty) { Seq() } else { val lessonIds = lessons.map(_.id) lazy val members = getLessonMembers(lessonIds) lessons.flatMap { lesson => lesson.isVisible match { case Some(true) => allUsers.map(LessonUser(lesson, _)) case Some(false) => Seq() case None => val users = members .filter(_.lessonId == lesson.id) .flatMap(v => memberService.getMembers(v.viewerId, v.viewerType)) allUsers.intersect(users).map(LessonUser(lesson, _)) } } } } }
igor-borisov/valamis
valamis-lesson/src/main/scala/com/arcusys/valamis/lesson/service/impl/LessonMembersServiceImpl.scala
Scala
gpl-3.0
5,736
----------------------------------------- -- ID: 4568 -- Item: moon_ball -- Food Effect: 30Min, All Races ----------------------------------------- -- Health 3 -- Magic 3 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,1800,4568); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 3); target:addMod(MOD_MP, 3); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 3); target:delMod(MOD_MP, 3); end;
Fatalerror66/ffxi-a
scripts/globals/items/moon_ball.lua
Lua
gpl-3.0
1,122
/* This file is part of edge_matching_puzzle The aim of this software is to find some solutions to edge matching puzzles Copyright (C) 2014 Julien Thevenon ( julien_thevenon at yahoo.fr ) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/> */ #include "feature_display_max.h" namespace edge_matching_puzzle { const std::string feature_display_max::m_class_name = "feature_display_max"; } //EOF
quicky2000/edge_matching_puzzle
src/feature_display_max.cpp
C++
gpl-3.0
1,040
<?php if(!defined('IN_KKFRAME')) exit('Access Denied!'); include 'plugins/xxx_post/core.php'; $obj = $_PLUGIN['obj']['xxx_post']; ?> <style type="text/css"> .small_gray{color:#757575;font-size:12px;} .small_gray_i{color:#B1B1B1;font-size:12px;font-style:italic;margin:0 0 2em 0;} .nav-tabs { border-bottom: 1px solid #ddd; list-style: none; padding: 0; margin: 0 0 20px 0; height:31px } .nav-tabs > li { margin-bottom: -1px;float: left; line-height: 20px; } .nav-tabs > li > a:hover, .nav-tabs > li > a:focus { border-color: #eeeeee #eeeeee #dddddd; cursor:pointer; } .nav-tabs > .active > a, .nav-tabs > .active > a:hover, .nav-tabs > .active > a:focus { color: #555555; cursor: default; background-color: #ffffff; border: 1px solid #ddd; border-bottom-color: transparent; } .nav-tabs > li > a { padding: 8px 12px 8px 12px; display: block; margin-right: 2px; line-height: 14px; border: 1px solid transparent; border-radius: 4px 4px 0 0; } .nav-tabs > li > a:hover, .nav-tabs > li > a:focus { border-color: #eeeeee #eeeeee #dddddd; text-decoration: none; background-color: #eeeeee; } .nav-tabs:before, .nav-tabs:after{ display: table; line-height: 0; content: ""; } .nav-tabs:after{ clear: both; } table.x_table thead tr{background-color:#dedede;} </style> <h2>客户端回帖</h2> <p class="small_gray">当前插件版本:0.3.1 | 更新日期:14-04-29 | Designed By <a href="http://tieba.baidu.com/home/main?un=%D0%C7%CF%D2%D1%A9&fr=index" target="_blank">@星弦雪</a></p> <p class="small_gray_i"><?php echo '——'.get_random_content();?> <div> <ul class="nav-tabs"> <li class="active"><a>设置</a></li><li><a>记录</a></li><li><a>帮助</a></li> </ul> </div> <div class="x_tab_content"> <div> <h3>常规</h3> <form method="post" id="xxx_post_settings" action="plugin.php?id=xxx_post&action=set-settings" onsubmit="return post_win(this.action, this.id)"> <p> 客户端类型: <select name="x_p_client_type" id="x_p_client_type" disabled> <option value="1">iPhone(可能封禁)</option> <option value="2">Android</option> <option value="3">Windows Phone</option> <option value="4">Windows 8</option> <option value="5">随机选择一种(不要选这个)</option> </select> </p> <p>回帖频率: <select name="x_p_frequency" id="x_p_frequency" disabled> <option value="2">每天回一次</option> <option value="1">早晚各回一次</option> <?php if ($obj->getSetting ( 'sxbk' ) == 1) echo '<option value="4">极限刷帖</option>'; ?> </select> ,<span id="x_p_runtimes_hide">每次回 <input type="number" name="x_p_runtimes" id="x_p_runtimes" min="1" max="<?php echo $obj->getSetting('max_runtime', 6); ?>" disabled> 贴(最多为<?php echo $obj->getSetting('max_runtime', 6); ?>),</span>发出一贴后等待 <input type="number" name="x_p_delay" id="x_p_delay" min="0" max="15" disabled> 分钟再发下一帖</p> <p><input type="submit" value="保存设置"></p> </form> <br> <h3>测试</h3> <p>随机选取一个帖子,进行一次回帖测试,检查你的设置有没有问题</p> <p><a href="plugin.php?id=xxx_post&action=test_post" class="btn" onclick="return msg_win_action(this.href)">测试回帖</a></p> <br> <h3>添加需要回的帖子</h3> <table class="x_table"> <thead><tr><td style="width:20px">序号</td><td>贴吧</td><td>贴子</td><td style="width: 20%">操作</td></tr></thead> <tbody id="xxx_post_show"> <tr><td colspan="4"><img src="./template/default/style/loading.gif">载入中请稍后</td></tr> </tbody> </table> <p> <a class="btn" id="xxx_post_add_tid">添加贴子</a> <a class="btn" id="x_p_add_tb" style="margin-left: 5px">添加贴吧</a> <a class="btn" id="x_p_del_tid" style="margin-left: 5px">全部删除</a> </p> <br> <h3>添加回帖内容</h3><p>回帖时随机使用其中之一,不添加的话会使用系统内置的</p> <table class="x_table"> <thead><tr><td style="width: 20px">序号</td><td>回帖内容</td><td style="width: 20%">操作</td></tr></thead> <tbody id="xxx_post_contents"><tr><td colspan="4"><img src="./template/default/style/loading.gif">载入中请稍后</td></tr></tbody> </table> <p> <a class="btn" id="xxx_post_add_content">添加内容</a> <a class="btn" id="x_p_add_con" style="margin-left: 5px">批量添加</a> <a class="btn" id="x_p_del_con" style="margin-left: 5px">全部删除</a> </p> </div> <div> <h2 id="x_p_post_log_tite">当天的回帖记录</h2> <p>如果帖子已从回帖列表删除,则不会在这里显示</p> <p id="x_p_pager_text"></p> <table class="x_table"> <thead><tr><td style="width: 20px">序号</td><td>贴吧</td><td>贴子</td><td style="width: 20px">成功</td><td style="width: 20px">失败</td></tr></thead> <tbody id="x_p_log_tab"><tr><td colspan="5">载入中请稍后</td></tr></tbody> </table> </div> <div> <p>使用该插件需做好每日被永封的准备,因发帖插件导致的账号被封、被屏蔽,请使用者自行承担后果</p> <h2>关于封禁与解封</h2> <p>其实解封很简单的= =(作者表示已经被永封过无数次)</p> <p>如果被度受永封的话:</p> <p>1.绑定手机秒解</p> <p>2.申请人工解封的话,只要你不是丧心病狂地每分钟一贴,一般都可以通过</p> <p>如果被吧务封禁的话,只好找吧务承认错误并表示永不再犯= =(不过在官方水楼里刷的话应该吧务不会插手)</p> </div> </div>
liujiantaoliu/Tieba_Sign
plugins/xxx_post/index.php
PHP
gpl-3.0
5,490
/* * Open Source Physics software is free software as described near the bottom of this code file. * * For additional information and documentation on Open Source Physics please see: * <https://www.compadre.org/osp/> */ package org.opensourcephysics.ejs.control.swing; import java.applet.Applet; import java.applet.AudioClip; import org.opensourcephysics.ejs.control.value.Value; /** * An element to play sound according to the state of an internal * variable. The element does not change this variable */ public class ControlSound extends ControlCheckBox { static final int VARIABLE = ControlCheckBox.VARIABLE+1; // shadows superclass field private AudioClip clip = null; private String audioFile = null; private boolean playing = false; /** * Constructor ControlSound * @param _visual */ public ControlSound(Object _visual) { super(_visual); checkbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent _e) { if(checkbox.isSelected()) { play(); } else { stop(); } } }); } public void setAudioClip(String _codebase, String _audioFile) { if(_audioFile==null) { stop(); clip = null; return; } try { String prefix = ""; //$NON-NLS-1$ if(_codebase==null) { prefix = "file:"; //$NON-NLS-1$ } else { prefix = _codebase.toString(); if(prefix.startsWith("file:")) { //$NON-NLS-1$ prefix = "file:///"+prefix.substring(6); //$NON-NLS-1$ } if(!prefix.endsWith("/")) { //$NON-NLS-1$ prefix += "/"; //$NON-NLS-1$ } } String filename = prefix+_audioFile; java.net.URL url = new java.net.URL(filename); clip = Applet.newAudioClip(url); } catch(Exception ex) { ex.printStackTrace(); clip = null; } } public void destroy() { if(clip!=null) { clip.stop(); } clip = null; super.destroy(); } public void play() { if(clip==null) { return; } clip.loop(); } public void stop() { if(clip!=null) { clip.stop(); } } // ------------------------------------------------ // Properties // ------------------------------------------------ static private java.util.ArrayList<String> infoList = null; public java.util.ArrayList<String> getPropertyList() { if(infoList==null) { infoList = new java.util.ArrayList<String>(); infoList.add("audiofile"); //$NON-NLS-1$ infoList.addAll(super.getPropertyList()); } return infoList; } public String getPropertyInfo(String _property) { if(_property.equals("audiofile")) { //$NON-NLS-1$ return "File|String"; //$NON-NLS-1$ } return super.getPropertyInfo(_property); } // ------------------------------------------------ // Set and Get the values of the properties // ------------------------------------------------ public void setValue(int _index, Value _value) { switch(_index) { case 0 : setAudioFile(_value.getString()); break; // audiofile case VARIABLE : if(_value.getBoolean()!=playing) { playing = _value.getBoolean(); if(playing) { play(); } else { stop(); } } super.setValue(ControlCheckBox.VARIABLE, _value); break; default : super.setValue(_index-1, _value); break; } } public void setDefaultValue(int _index) { switch(_index) { case 0 : setAudioClip(null, null); audioFile = null; break; default : super.setDefaultValue(_index-1); break; } } public Value getValue(int _index) { switch(_index) { case 0 : return null; default : return super.getValue(_index-1); } } // ------------------------------------- // private methods // ------------------------------------- private void setAudioFile(String _audio) { if((audioFile!=null)&&audioFile.equals(_audio)) { return; // no need to do it again } audioFile = _audio; if(getProperty("_ejs_codebase")!=null) { //$NON-NLS-1$ setAudioClip(getProperty("_ejs_codebase"), _audio); //$NON-NLS-1$ } else if((getSimulation()!=null)&&(getSimulation().getCodebase()!=null)) { setAudioClip(getSimulation().getCodebase().toString(), _audio); } else { setAudioClip(null, _audio); } } } /* * Open Source Physics software is free software; you can redistribute * it and/or modify it under the terms of the GNU General Public License (GPL) as * published by the Free Software Foundation; either version 2 of the License, * or(at your option) any later version. * Code that uses any portion of the code in the org.opensourcephysics package * or any subpackage (subdirectory) of this package must must also be be released * under the GNU GPL license. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA * or view the license online at http://www.gnu.org/copyleft/gpl.html * * Copyright (c) 2019 The Open Source Physics project * https://www.compadre.org/osp */
fschuett/osp
src/org/opensourcephysics/ejs/control/swing/ControlSound.java
Java
gpl-3.0
5,795
> **Note**: this page is only a draft, but this project is hosted on a [public repository](https://github.com/hhkaos/awesome-arcgis) where anyone can contribute. Learn how to [contribute in less than a minute](https://github.com/hhkaos/awesome-arcgis/blob/master/CONTRIBUTING.md#contributions). # Leica Geosystems Leica Geosystems based in eastern Switzerland produces products and systems for surveying and geographical measurement | [leica-geosystems.com](https://leica-geosystems.com) <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> **Table of contents** - [Introduction](#introduction) - [ArcGIS compatible products developed](#arcgis-compatible-products-developed) - [Additional resources](#additional-resources) - [Contributions](#contributions) <!-- END doctoc generated TOC please keep comment here to allow auto update --> ## Introduction [Leica Geosystems AG](https://leica-geosystems.com/) is a Gold member of the [partner program](../../programs/)produces products and systems for surveying and geographical measurement (geomatics). Its products employ a variety of technologies including GPS satellite navigation and laser rangefinders to enable users to model existing structures, terrains in computer based systems to high accuracies, often under 1 cm. ## ArcGIS compatible products developed * [ZenoCollector](https://www.esri.com/~/media/Files/Pdfs/partners/hardware/leica/zenocollector.pdf): r combines the world’s leading GIS software from Esri with the hardware expertise of Leica Geosystems in surveying and geographical measurement, so you can boost efficiency of field crews, reduce errors in data collection, and always have the latest information at your fingertips. ## Additional resources Probably not all the resources are in this list, please use the [ArcGIS Search](https://esri-es.github.io/arcgis-search/) tool looking for: ["leica"](https://esri-es.github.io/arcgis-search/?search="leica"&utm_campaign=awesome-list&utm_source=awesome-list&utm_medium=page). ## Contributions Feel free to improve/extend this resource page using [this template](../../../../PARTNER_PAGE_TEMPLATE.md)
hhkaos/awesome-arcgis
esri/partners/program-members/leica/README.md
Markdown
gpl-3.0
2,229
package ca.pfv.spmf.algorithms.frequentpatterns.SFUPMinerUemax; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; /** * * * This is an implementation of the skyline frequent-utility patterns mining algorithm using uemax array. * * Copyright (c) 2016 Jerry Chun-Wei Lin, Lu Yang, Philippe Fournier-Viger * * This file is part of the SPMF DATA MINING SOFTWARE * (http://www.philippe-fournier-viger.com/spmf). * * * SPMF is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * SPMF is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * * You should have received a copy of the GNU General Public License along with * SPMF. If not, see . * * @author Jerry Chun-Wei Lin, Lu Yang, Philippe Fournier-Viger */ public class AlgoSFUPMinerUemax { double maxMemory = 0; // the maximum memory usage long startTimestamp = 0; // the time the algorithm started long endTimestamp = 0; // the time the algorithm terminated int psfupCount =0; //the number of PSFUP int sfupCount =0; // the number of SFUP generated int searchCount =0; //the number of search patterns Map<Integer, Integer> mapItemToTWU; BufferedWriter writer = null; // writer to write the output file // this class represent an item and its utility in a transaction class Pair{ int item = 0; int utility = 0; } public AlgoSFUPMinerUemax() { } public void runAlgorithm(String input, String output) throws IOException { // reset maximum maxMemory =0; startTimestamp = System.currentTimeMillis(); writer = new BufferedWriter(new FileWriter(output)); // We create a map to store the TWU of each item mapItemToTWU = new HashMap<Integer, Integer>(); // We scan the database a first time to calculate the TWU of each item. BufferedReader myInput = null; String thisLine; try { // prepare the object for reading the file myInput = new BufferedReader(new InputStreamReader( new FileInputStream(new File(input)))); // for each line (transaction) until the end of file while ((thisLine = myInput.readLine()) != null) { // if the line is a comment, is empty or is a // kind of metadata if (thisLine.isEmpty() == true || thisLine.charAt(0) == '#' || thisLine.charAt(0) == '%' || thisLine.charAt(0) == '@') { continue; } // split the transaction according to the : separator String split[] = thisLine.split(":"); // the first part is the list of items String items[] = split[0].split(" "); // the second part is the transaction utility int transactionUtility = Integer.parseInt(split[1]); // for each item, we add the transaction utility to its TWU for(int i=0; i <items.length; i++){ // convert item to integer Integer item = Integer.parseInt(items[i]); // get the current TWU of that item Integer twu = mapItemToTWU.get(item); // add the utility of the item in the current transaction to its twu twu = (twu == null)? transactionUtility : twu + transactionUtility; mapItemToTWU.put(item, twu); } } } catch (Exception e) { // catches exception if error while reading the input file e.printStackTrace(); }finally { if(myInput != null){ myInput.close(); } } // CREATE A LIST TO STORE THE UTILITY LIST OF ITEMS List<UtilityList> listOfUtilityLists = new ArrayList<UtilityList>(); // CREATE A MAP TO STORE THE UTILITY LIST FOR EACH ITEM. // Key : item Value : utility list associated to that item Map<Integer, UtilityList> mapItemToUtilityList = new HashMap<Integer, UtilityList>(); // For each item for(Integer item: mapItemToTWU.keySet()){ // create an empty Utility List that we will fill later. UtilityList uList = new UtilityList(item); mapItemToUtilityList.put(item, uList); // add the item to the list of high TWU items listOfUtilityLists.add(uList); } // SORT THE LIST OF HIGH TWU ITEMS IN ASCENDING ORDER Collections.sort(listOfUtilityLists, new Comparator<UtilityList>(){ public int compare(UtilityList o1, UtilityList o2) { // compare the TWU of the items return compareItems(o1.item, o2.item); } } ); // SECOND DATABASE PASS TO CONSTRUCT THE UTILITY LISTS OF ALL 1-ITEMSETS // variable to count the number of transaction int tid =0; try { // prepare object for reading the file myInput = new BufferedReader(new InputStreamReader(new FileInputStream(new File(input)))); // for each line (transaction) until the end of file while ((thisLine = myInput.readLine()) != null) { // if the line is a comment, is empty or is a // kind of metadata if (thisLine.isEmpty() == true || thisLine.charAt(0) == '#' || thisLine.charAt(0) == '%' || thisLine.charAt(0) == '@') { continue; } // split the line according to the separator String split[] = thisLine.split(":"); // get the list of items String items[] = split[0].split(" "); // get the list of utility values corresponding to each item // for that transaction String utilityValues[] = split[2].split(" "); // Copy the transaction into lists int remainingUtility =0; // Create a list to store items List<Pair> revisedTransaction = new ArrayList<Pair>(); // for each item for(int i=0; i <items.length; i++){ /// convert values to integers Pair pair = new Pair(); pair.item = Integer.parseInt(items[i]); pair.utility = Integer.parseInt(utilityValues[i]); // add it revisedTransaction.add(pair); remainingUtility += pair.utility; } Collections.sort(revisedTransaction, new Comparator<Pair>(){ public int compare(Pair o1, Pair o2) { return compareItems(o1.item, o2.item); }}); // for each item left in the transaction for(Pair pair : revisedTransaction){ // subtract the utility of this item from the remaining utility remainingUtility = remainingUtility - pair.utility; // get the utility list of this item UtilityList utilityListOfItem = mapItemToUtilityList.get(pair.item); // Add a new Element to the utility list of this item corresponding to this transaction Element element = new Element(tid, pair.utility, remainingUtility); utilityListOfItem.addElement(element); } tid++; // increase tid number for next transaction } } catch (Exception e) { // to catch error while reading the input file e.printStackTrace(); }finally { if(myInput != null){ myInput.close(); } } // check the memory usage checkMemory(); // Mine the database recursively //This array is used to store the max utility value of each frequency,uEmax[0] is meaningless //uEmax[1] stored the max utiliey value of all the itemsets which have frequency equals to 1 int uEmax[]=new int[tid+1]; //The list is used to store the current potential skyline frequent-utility patterns (PSFUPs) //psfupList[1]store the psfup has frequent equals to 1 SkylineList psfupList[] = new SkylineList[tid+1]; //The list is used to store the current skyline frequent-utility patterns (SFUPs) List<Skyline> skylineList=new ArrayList<Skyline>(); //test //This method is used to mine all the PSFUPs SFUPMiner(new int[0], null, listOfUtilityLists, psfupList, skylineList, uEmax); //This method is used to mine all the SFUPs from PSFUPs judgeSkyline(skylineList,psfupList,uEmax); //This method is used to write out all the PSFUPs writeOut(skylineList); psfupCount=getpsfupCount(psfupList); // check the memory usage again and close the file. checkMemory(); // close output file writer.close(); // record end time endTimestamp = System.currentTimeMillis(); } private int compareItems(int item1, int item2) { int compare = mapItemToTWU.get(item1) - mapItemToTWU.get(item2); // if the same, use the lexical order otherwise use the TWU return (compare == 0)? item1 - item2 : compare; } /** * This is the recursive method to find all potential skyline frequent-utility patterns * @param prefix This is the current prefix. Initially, it is empty. * @param pUL This is the Utility List of the prefix. Initially, it is empty. * @param ULs The utility lists corresponding to each extension of the prefix. * @param psfupList Current potential skyline frequent-utility patterns.Initially, it is empty. * @param skylineList Current skyline frequent-utility patterns.Initially, it is empty. * @param uEmax The array of max utility value of each frequency.Initially, it is zero. * @throws IOException */ private void SFUPMiner(int [] prefix, UtilityList pUL, List<UtilityList> ULs, SkylineList psfupList[], List<Skyline> skylineList, int [] uEmax) throws IOException { // For each extension X of prefix P for(int i=0; i< ULs.size(); i++){ UtilityList X = ULs.get(i); searchCount++; //temp store the frequency of X int temp=X.elements.size(); //judge whether whether X is a PSFUP //if the utility of X equals to the PSFUP which has same frequency with X, insert X to psfupList if(X.sumIutils==uEmax[temp]&&uEmax[temp]!=0){ Skyline tempPoint=new Skyline(); tempPoint.itemSet=itemSetString(prefix, X.item); tempPoint.frequent=temp; tempPoint.utility=X.sumIutils; psfupList[temp].add(tempPoint); } //if the utility of X more than the PSFUP which has same frequency with X, update psfupList if(X.sumIutils>uEmax[temp]){ uEmax[temp]=X.sumIutils; //if psfupList[temp] is null, insert X to psfupList if(psfupList[temp]==null){ SkylineList tempList= new SkylineList(); Skyline tempPoint=new Skyline(); tempPoint.itemSet=itemSetString(prefix, X.item); tempPoint.frequent=temp; tempPoint.utility=X.sumIutils; tempList.add(tempPoint); psfupList[temp]=tempList; } //if psfupList[temp] is not null, update psfupList[temp] else{ //This is the number of PSFUPs which has same frequency with X. int templength=psfupList[temp].size(); if(templength==1){ psfupList[temp].get(0).itemSet=itemSetString(prefix, X.item); psfupList[temp].get(0).utility=X.sumIutils; } else { for(int j=templength-1;j>0;j--){ psfupList[temp].remove(j); } psfupList[temp].get(0).itemSet=itemSetString(prefix, X.item); psfupList[temp].get(0).utility=X.sumIutils; } } } // If the sum of the remaining utilities for pX // is higher than uEmax[j], we explore extensions of pX. // (this is the pruning condition) if(X.sumIutils + X.sumRutils >= uEmax[temp] && uEmax[temp]!=0){ // This list will contain the utility lists of pX extensions. List<UtilityList> exULs = new ArrayList<UtilityList>(); // For each extension of p appearing // after X according to the ascending order for(int j=i+1; j < ULs.size(); j++){ UtilityList Y = ULs.get(j); // we construct the extension pXY // and add it to the list of extensions of pX exULs.add(construct(pUL, X, Y)); } // We create new prefix pX int [] newPrefix = new int[prefix.length+1]; System.arraycopy(prefix, 0, newPrefix, 0, prefix.length); newPrefix[prefix.length] = X.item; // We make a recursive call to discover all itemsets with the prefix pXY SFUPMiner(newPrefix, X, exULs, psfupList, skylineList, uEmax); } } } /** * This method constructs the utility list of pXY * @param P : the utility list of prefix P. * @param px : the utility list of pX * @param py : the utility list of pY * @return the utility list of pXY */ private UtilityList construct(UtilityList P, UtilityList px, UtilityList py) { // create an empy utility list for pXY UtilityList pxyUL = new UtilityList(py.item); // for each element in the utility list of pX for(Element ex : px.elements){ // do a binary search to find element ey in py with tid = ex.tid Element ey = findElementWithTID(py, ex.tid); if(ey == null){ continue; } // if the prefix p is null if(P == null){ // Create the new element Element eXY = new Element(ex.tid, ex.iutils + ey.iutils, ey.rutils); // add the new element to the utility list of pXY pxyUL.addElement(eXY); }else{ // find the element in the utility list of p wih the same tid Element e = findElementWithTID(P, ex.tid); if(e != null){ // Create new element Element eXY = new Element(ex.tid, ex.iutils + ey.iutils - e.iutils, ey.rutils); // add the new element to the utility list of pXY pxyUL.addElement(eXY); } } } // return the utility list of pXY. return pxyUL; } /** * Do a binary search to find the element with a given tid in a utility list * @param ulist the utility list * @param tid the tid * @return the element or null if none has the tid. */ private Element findElementWithTID(UtilityList ulist, int tid){ List<Element> list = ulist.elements; // perform a binary search to check if the subset appears in level k-1. int first = 0; int last = list.size() - 1; // the binary search while( first <= last ) { int middle = ( first + last ) >>> 1; // divide by 2 if(list.get(middle).tid < tid){ first = middle + 1; // the itemset compared is larger than the subset according to the lexical order } else if(list.get(middle).tid > tid){ last = middle - 1; // the itemset compared is smaller than the subset is smaller according to the lexical order } else{ return list.get(middle); } } return null; } /** * Method to write out itemset name * @param prefix This is the current prefix * @param item This is the new item added after the prefix * @return the itemset name */ private String itemSetString(int[] prefix, int item) throws IOException { //Create a string buffer StringBuilder buffer = new StringBuilder(); // append the prefix for (int i = 0; i < prefix.length; i++) { buffer.append(prefix[i]); buffer.append(' '); } // append the last item buffer.append(item); return buffer.toString(); } /** * Method to write skyline frequent-utility itemset to the output file. * @param skylineList The list of skyline frequent-utility itemsets */ private void writeOut(List<Skyline> skylineList) throws IOException { sfupCount=skylineList.size(); //Create a string buffer StringBuilder buffer = new StringBuilder(); // buffer.append("Total skyline frequent-utility itemset: "); // buffer.append(sfupCount); // buffer.append(System.lineSeparator()); for(int i=0;i<sfupCount;i++){ buffer.append(skylineList.get(i).itemSet); buffer.append(" #SUP:"); buffer.append(skylineList.get(i).frequent); buffer.append(" #UTILITY:"); buffer.append(skylineList.get(i).utility); buffer.append(System.lineSeparator()); // write to file } writer.write(buffer.toString()); } /** * Method to judge whether the PSFUP is a SFUP * @param skylineList The skyline frequent-utility itemset list * @param psfupList The potential skyline frequent-utility itemset list * @param uEmax The max utility value of each frequency */ private void judgeSkyline(List<Skyline> skylineList, SkylineList psfupList[], int uEmax[]) { for(int i=1;i<psfupList.length;i++){ //if temp equals to 0, the value of psfupList[i] is higher than all the value of psfupList[j](j>i) int temp=0; //compare psfupList[i] with psfupList[j],(j>i) if(psfupList[i]!=null){ int j=i+1; while(j<psfupList.length){ if(psfupList[j]==null){ j++; } else{ if(psfupList[i].get(0).utility <=psfupList[j].get(0).utility){ temp=1; break; } else{ j++; } } } //it temp equals to 0, this PSFUP is a SFUP if(temp==0){ for(int k=0;k<psfupList[i].size();k++) skylineList.add(psfupList[i].get(k)); } } } } /** * Method to get the count of PSFUP. * @param psfupList the potential skyline frequent-utility itemset list * @return the count of PSFUPs */ private int getpsfupCount(SkylineList psfupList[]) { for(int i=1;i<psfupList.length;i++){ if(psfupList[i]!=null){ psfupCount=psfupCount+psfupList[i].size(); } } return psfupCount; } /** * Method to check the memory usage and keep the maximum memory usage. */ private void checkMemory() { // get the current memory usage double currentMemory = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024d / 1024d; // if higher than the maximum until now if (currentMemory > maxMemory) { // replace the maximum with the current memory usage maxMemory = currentMemory; } } /** * Print statistics about the latest execution to System.out. */ public void printStats() { System.out.println("============= uEmax skyline ALGORITHM v 2.11 - STATS ============="); System.out.println(" Total time ~ " + (endTimestamp - startTimestamp) + " ms"); System.out.println(" Memory ~ " + maxMemory+ " MB"); System.out.println(" Skyline itemsets count : " + sfupCount); System.out.println(" Search itemsets count : " + searchCount); System.out.println(" Candidate itemsets count : " + psfupCount); System.out.println("==================================================="); } }
qualitified/qualitified-crm
qualitified-crm-core/src/main/java/ca/pfv/spmf/algorithms/frequentpatterns/SFUPMinerUemax/AlgoSFUPMinerUemax.java
Java
gpl-3.0
18,755
/******************************************************************************* * Copyright (c) 2014 Tombenpotter. * All rights reserved. * * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html * * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. * http://www.minecraftforum.net/topic/1585216- ******************************************************************************/ package tombenpotter.emt.common.modules.ic2.tile.generators; import thaumcraft.api.aspects.Aspect; import tombenpotter.emt.common.util.EssentiasOutputs; public class TileEntityIgnisGenerator extends TileEntityBaseGenerator { public TileEntityIgnisGenerator() { aspect = Aspect.FIRE; EssentiasOutputs.outputs.get(aspect.getTag()); } }
TeamAmeriFrance/Electro-Magic-Tools
src/main/java/tombenpotter/emt/common/modules/ic2/tile/generators/TileEntityIgnisGenerator.java
Java
gpl-3.0
1,026
/***************************************************************************** * Copyright (c) 2014-2018 OpenRCT2 developers * * For a complete list of all authors, please refer to contributors.md * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 * * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ #include "../../drawing/Drawing.h" #include "../../paint/Supports.h" #include "../TrackData.h" #include "BolligerMabillardTrack.h" /** rct2: 0x008AA00C */ static void vertical_drop_rc_track_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_station( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_station(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA01C */ static void vertical_drop_rc_track_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA02C */ static void vertical_drop_rc_track_60_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_60_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA03C */ static void vertical_drop_rc_track_flat_to_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA04C */ static void vertical_drop_rc_track_25_deg_up_to_60_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_up_to_60_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA05C */ static void vertical_drop_rc_track_60_deg_up_to_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_60_deg_up_to_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA06C */ static void vertical_drop_rc_track_25_deg_up_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_up_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA07C */ static void vertical_drop_rc_track_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA08C */ static void vertical_drop_rc_track_60_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_60_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA09C */ static void vertical_drop_rc_track_flat_to_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA0AC */ static void vertical_drop_rc_track_25_deg_down_to_60_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_down_to_60_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA0BC */ static void vertical_drop_rc_track_60_deg_down_to_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_60_deg_down_to_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA0CC */ static void vertical_drop_rc_track_25_deg_down_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_down_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA0DC */ static void vertical_drop_rc_track_left_quarter_turn_5( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_5(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA0EC */ static void vertical_drop_rc_track_right_quarter_turn_5( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_5(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA0FC */ static void vertical_drop_rc_track_flat_to_left_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_left_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA10C */ static void vertical_drop_rc_track_flat_to_right_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_right_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA11C */ static void vertical_drop_rc_track_left_bank_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_bank_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA12C */ static void vertical_drop_rc_track_right_bank_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_bank_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA13C */ static void vertical_drop_rc_track_banked_left_quarter_turn_5( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_banked_left_quarter_turn_5(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA14C */ static void vertical_drop_rc_track_banked_right_quarter_turn_5( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_banked_right_quarter_turn_5(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA15C */ static void vertical_drop_rc_track_left_bank_to_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_bank_to_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA16C */ static void vertical_drop_rc_track_right_bank_to_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_bank_to_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA17C */ static void vertical_drop_rc_track_25_deg_up_to_left_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_up_to_left_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA18C */ static void vertical_drop_rc_track_25_deg_up_to_right_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_up_to_right_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA19C */ static void vertical_drop_rc_track_left_bank_to_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_bank_to_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA1AC */ static void vertical_drop_rc_track_right_bank_to_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_bank_to_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA1BC */ static void vertical_drop_rc_track_25_deg_down_to_left_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_down_to_left_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA1CC */ static void vertical_drop_rc_track_25_deg_down_to_right_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_down_to_right_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA1DC */ static void vertical_drop_rc_track_left_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA1EC */ static void vertical_drop_rc_track_right_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA1FC */ static void vertical_drop_rc_track_left_quarter_turn_5_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_5_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA20C */ static void vertical_drop_rc_track_right_quarter_turn_5_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_5_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA21C */ static void vertical_drop_rc_track_left_quarter_turn_5_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_5_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA22C */ static void vertical_drop_rc_track_right_quarter_turn_5_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_5_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA23C */ static void vertical_drop_rc_track_s_bend_left( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_s_bend_left(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA24C */ static void vertical_drop_rc_track_s_bend_right( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_s_bend_right(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA49C */ static void vertical_drop_rc_track_left_vertical_loop( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_vertical_loop(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA4AC */ static void vertical_drop_rc_track_right_vertical_loop( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_vertical_loop(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA28C */ static void vertical_drop_rc_track_left_quarter_turn_3( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_3(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA29C */ static void vertical_drop_rc_track_right_quarter_turn_3( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_3(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA2AC */ static void vertical_drop_rc_track_left_quarter_turn_3_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_3_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA2BC */ static void vertical_drop_rc_track_right_quarter_turn_3_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_3_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA2CC */ static void vertical_drop_rc_track_left_quarter_turn_3_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_3_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA2DC */ static void vertical_drop_rc_track_right_quarter_turn_3_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_3_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA2EC */ static void vertical_drop_rc_track_left_quarter_turn_3_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_3_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA2FC */ static void vertical_drop_rc_track_right_quarter_turn_3_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_3_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA30C */ static void vertical_drop_rc_track_left_half_banked_helix_up_small( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_half_banked_helix_up_small(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA31C */ static void vertical_drop_rc_track_right_half_banked_helix_up_small( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_half_banked_helix_up_small(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA32C */ static void vertical_drop_rc_track_left_half_banked_helix_down_small( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_half_banked_helix_down_small(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA33C */ static void vertical_drop_rc_track_right_half_banked_helix_down_small( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_half_banked_helix_down_small(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA34C */ static void vertical_drop_rc_track_left_half_banked_helix_up_large( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_half_banked_helix_up_large(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA35C */ static void vertical_drop_rc_track_right_half_banked_helix_up_large( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_half_banked_helix_up_large(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA36C */ static void vertical_drop_rc_track_left_half_banked_helix_down_large( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_half_banked_helix_down_large(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA37C */ static void vertical_drop_rc_track_right_half_banked_helix_down_large( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_half_banked_helix_down_large(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA3AC */ static void vertical_drop_rc_track_left_quarter_turn_1_60_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_1_60_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA38C */ static void vertical_drop_rc_track_right_quarter_turn_1_60_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_1_60_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA39C */ static void vertical_drop_rc_track_left_quarter_turn_1_60_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_1_60_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA3BC */ static void vertical_drop_rc_track_right_quarter_turn_1_60_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_1_60_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA40C */ static void vertical_drop_rc_track_brakes( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_brakes(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA7EC */ static void vertical_drop_rc_track_25_deg_up_left_banked( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_up_left_banked(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA7FC */ static void vertical_drop_rc_track_25_deg_up_right_banked( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_up_right_banked(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA41C */ static void vertical_drop_rc_track_on_ride_photo( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_on_ride_photo(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA80C */ static void vertical_drop_rc_track_25_deg_down_left_banked( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_down_left_banked(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA81C */ static void vertical_drop_rc_track_25_deg_down_right_banked( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_down_right_banked(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA42C */ static void vertical_drop_rc_track_90_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_90_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA43C */ static void vertical_drop_rc_track_90_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_90_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA44C */ static void vertical_drop_rc_track_60_deg_up_to_90_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_60_deg_up_to_90_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA45C */ static void vertical_drop_rc_track_90_deg_down_to_60_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_90_deg_down_to_60_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA46C */ static void vertical_drop_rc_track_90_deg_up_to_60_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_90_deg_up_to_60_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA47C */ static void vertical_drop_rc_track_60_deg_down_to_90_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_60_deg_down_to_90_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA4CC */ static void vertical_drop_rc_track_left_eighth_to_diag( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_eighth_to_diag(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA4DC */ static void vertical_drop_rc_track_right_eighth_to_diag( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_eighth_to_diag(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA4EC */ static void vertical_drop_rc_track_left_eighth_to_orthogonal( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_eighth_to_orthogonal(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA4FC */ static void vertical_drop_rc_track_right_eighth_to_orthogonal( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_eighth_to_orthogonal(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA50C */ static void vertical_drop_rc_track_left_eighth_bank_to_diag( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_eighth_bank_to_diag(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA51C */ static void vertical_drop_rc_track_right_eighth_bank_to_diag( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_eighth_bank_to_diag(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA52C */ static void vertical_drop_rc_track_left_eighth_bank_to_orthogonal( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_eighth_bank_to_orthogonal(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA53C */ static void vertical_drop_rc_track_right_eighth_bank_to_orthogonal( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_eighth_bank_to_orthogonal(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA4BC */ static void vertical_drop_rc_track_diag_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA56C */ static void vertical_drop_rc_track_diag_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA5CC */ static void vertical_drop_rc_track_diag_60_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_60_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA54C */ static void vertical_drop_rc_track_diag_flat_to_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_flat_to_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA5AC */ static void vertical_drop_rc_track_diag_25_deg_up_to_60_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_25_deg_up_to_60_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA5BC */ static void vertical_drop_rc_track_diag_60_deg_up_to_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_60_deg_up_to_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA55C */ static void vertical_drop_rc_track_diag_25_deg_up_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_25_deg_up_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA59C */ static void vertical_drop_rc_track_diag_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA5FC */ static void vertical_drop_rc_track_diag_60_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_60_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA57C */ static void vertical_drop_rc_track_diag_flat_to_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_flat_to_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA5DC */ static void vertical_drop_rc_track_diag_25_deg_down_to_60_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_25_deg_down_to_60_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA5EC */ static void vertical_drop_rc_track_diag_60_deg_down_to_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_60_deg_down_to_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA58C */ static void vertical_drop_rc_track_diag_25_deg_down_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_25_deg_down_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA62C */ static void vertical_drop_rc_track_diag_flat_to_left_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_flat_to_left_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA63C */ static void vertical_drop_rc_track_diag_flat_to_right_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_flat_to_right_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA64C */ static void vertical_drop_rc_track_diag_left_bank_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_left_bank_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA65C */ static void vertical_drop_rc_track_diag_right_bank_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_right_bank_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA68C */ static void vertical_drop_rc_track_diag_left_bank_to_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_left_bank_to_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA69C */ static void vertical_drop_rc_track_diag_right_bank_to_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_right_bank_to_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA66C */ static void vertical_drop_rc_track_diag_25_deg_up_to_left_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_25_deg_up_to_left_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA67C */ static void vertical_drop_rc_track_diag_25_deg_up_to_right_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_25_deg_up_to_right_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA6AC */ static void vertical_drop_rc_track_diag_left_bank_to_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_left_bank_to_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA6BC */ static void vertical_drop_rc_track_diag_right_bank_to_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_right_bank_to_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA6CC */ static void vertical_drop_rc_track_diag_25_deg_down_to_left_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_25_deg_down_to_left_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA6DC */ static void vertical_drop_rc_track_diag_25_deg_down_to_right_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_25_deg_down_to_right_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA60C */ static void vertical_drop_rc_track_diag_left_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_left_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA61C */ static void vertical_drop_rc_track_diag_right_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_right_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA72C */ static void vertical_drop_rc_track_left_bank_to_left_quarter_turn_3_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_bank_to_left_quarter_turn_3_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA73C */ static void vertical_drop_rc_track_right_bank_to_right_quarter_turn_3_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_bank_to_right_quarter_turn_3_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA74C */ static void vertical_drop_rc_track_left_quarter_turn_3_25_deg_down_to_left_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_3_25_deg_down_to_left_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA75C */ static void vertical_drop_rc_track_right_quarter_turn_3_25_deg_down_to_right_bank( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_3_25_deg_down_to_right_bank(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA9EC */ static void vertical_drop_rc_track_block_brakes( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_block_brakes(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA96C */ static void vertical_drop_rc_track_left_banked_quarter_turn_3_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_quarter_turn_3_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA97C */ static void vertical_drop_rc_track_right_banked_quarter_turn_3_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_quarter_turn_3_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA98C */ static void vertical_drop_rc_track_left_banked_quarter_turn_3_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_quarter_turn_3_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA99C */ static void vertical_drop_rc_track_right_banked_quarter_turn_3_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_quarter_turn_3_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA8AC */ static void vertical_drop_rc_track_left_banked_quarter_turn_5_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_quarter_turn_5_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA8BC */ static void vertical_drop_rc_track_right_banked_quarter_turn_5_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_quarter_turn_5_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA8CC */ static void vertical_drop_rc_track_left_banked_quarter_turn_5_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_quarter_turn_5_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA8DC */ static void vertical_drop_rc_track_right_banked_quarter_turn_5_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_quarter_turn_5_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA82C */ static void vertical_drop_rc_track_25_deg_up_to_left_banked_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_up_to_left_banked_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA83C */ static void vertical_drop_rc_track_25_deg_up_to_right_banked_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_up_to_right_banked_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA84C */ static void vertical_drop_rc_track_left_banked_25_deg_up_to_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_25_deg_up_to_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA85C */ static void vertical_drop_rc_track_right_banked_25_deg_up_to_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_25_deg_up_to_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA86C */ static void vertical_drop_rc_track_25_deg_down_to_left_banked_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_down_to_left_banked_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA87C */ static void vertical_drop_rc_track_25_deg_down_to_right_banked_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_25_deg_down_to_right_banked_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA88C */ static void vertical_drop_rc_track_left_banked_25_deg_down_to_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_25_deg_down_to_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA89C */ static void vertical_drop_rc_track_right_banked_25_deg_down_to_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_25_deg_down_to_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA8EC */ static void vertical_drop_rc_track_left_banked_flat_to_left_banked_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_flat_to_left_banked_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA8FC */ static void vertical_drop_rc_track_right_banked_flat_to_right_banked_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_flat_to_right_banked_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA92C */ static void vertical_drop_rc_track_left_banked_25_deg_up_to_left_banked_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_25_deg_up_to_left_banked_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA93C */ static void vertical_drop_rc_track_right_banked_25_deg_up_to_right_banked_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_25_deg_up_to_right_banked_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA94C */ static void vertical_drop_rc_track_left_banked_flat_to_left_banked_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_flat_to_left_banked_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA95C */ static void vertical_drop_rc_track_right_banked_flat_to_right_banked_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_flat_to_right_banked_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA90C */ static void vertical_drop_rc_track_left_banked_25_deg_down_to_left_banked_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_25_deg_down_to_left_banked_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA91C */ static void vertical_drop_rc_track_right_banked_25_deg_down_to_right_banked_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_25_deg_down_to_right_banked_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA76C */ static void vertical_drop_rc_track_flat_to_left_banked_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_left_banked_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA77C */ static void vertical_drop_rc_track_flat_to_right_banked_25_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_right_banked_25_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA78C */ static void vertical_drop_rc_track_left_banked_25_deg_up_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_25_deg_up_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA79C */ static void vertical_drop_rc_track_right_banked_25_deg_up_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_25_deg_up_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA7AC */ static void vertical_drop_rc_track_flat_to_left_banked_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_left_banked_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA7BC */ static void vertical_drop_rc_track_flat_to_right_banked_25_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_right_banked_25_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA7CC */ static void vertical_drop_rc_track_left_banked_25_deg_down_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_banked_25_deg_down_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA7DC */ static void vertical_drop_rc_track_right_banked_25_deg_down_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_banked_25_deg_down_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA9AC */ static void vertical_drop_rc_track_left_quarter_turn_1_90_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_1_90_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA9BC */ static void vertical_drop_rc_track_right_quarter_turn_1_90_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_1_90_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA9CC */ static void vertical_drop_rc_track_left_quarter_turn_1_90_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_quarter_turn_1_90_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA9DC */ static void vertical_drop_rc_track_right_quarter_turn_1_90_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_quarter_turn_1_90_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /* The following elements used to be specific to the vertical_drop RC */ /** rct2: 0x008AA3CC */ static void vertical_drop_rc_track_flat_to_60_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_60_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA3DC */ static void vertical_drop_rc_track_60_deg_up_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_60_deg_up_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA3EC */ static void vertical_drop_rc_track_flat_to_60_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_60_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA3FC */ static void vertical_drop_rc_track_60_deg_down_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_60_deg_down_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA48C */ static void vertical_drop_rc_track_brake_for_drop( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_brake_for_drop(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA6EC */ static void vertical_drop_rc_track_diag_flat_to_60_deg_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_flat_to_60_deg_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA6FC */ static void vertical_drop_rc_track_diag_60_deg_up_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_60_deg_up_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA70C */ static void vertical_drop_rc_track_diag_flat_to_60_deg_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_flat_to_60_deg_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /** rct2: 0x008AA71C */ static void vertical_drop_rc_track_diag_60_deg_down_to_flat( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_diag_60_deg_down_to_flat(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } /* The following elements used to be specific to the steel twister RC */ static void vertical_drop_rc_track_half_loop_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_half_loop_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_half_loop_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_half_loop_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_left_corkscrew_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_corkscrew_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_right_corkscrew_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_corkscrew_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_left_corkscrew_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_corkscrew_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_right_corkscrew_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_corkscrew_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_flat_to_60_deg_up_long_base( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_60_deg_up_long_base(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_60_deg_up_to_flat_long_base( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_60_deg_up_to_flat_long_base(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_flat_to_60_deg_down_long_base( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_flat_to_60_deg_down_long_base(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_60_deg_up_to_flat_long_base122( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_60_deg_up_to_flat_long_base122(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_left_barrel_roll_up_to_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_barrel_roll_up_to_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_right_barrel_roll_up_to_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_barrel_roll_up_to_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_left_barrel_roll_down_to_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_barrel_roll_down_to_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_right_barrel_roll_down_to_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_barrel_roll_down_to_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_powered_lift( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_powered_lift(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_left_large_half_loop_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_large_half_loop_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_right_large_half_loop_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_large_half_loop_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_right_large_half_loop_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_right_large_half_loop_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_left_large_half_loop_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_left_large_half_loop_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_90_deg_to_inverted_flat_quarter_loop_up( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_90_deg_to_inverted_flat_quarter_loop_up(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_inverted_flat_to_90_deg_quarter_loop_down( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_inverted_flat_to_90_deg_quarter_loop_down(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } static void vertical_drop_rc_track_booster( paint_session * session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, const rct_tile_element * tileElement) { bolliger_mabillard_track_booster(session, rideIndex, trackSequence, direction, height, tileElement, METAL_SUPPORTS_BOXED); } TRACK_PAINT_FUNCTION get_track_paint_function_vertical_drop_rc(int32_t trackType, int32_t direction) { switch (trackType) { case TRACK_ELEM_FLAT: return vertical_drop_rc_track_flat; case TRACK_ELEM_END_STATION: case TRACK_ELEM_BEGIN_STATION: case TRACK_ELEM_MIDDLE_STATION: return vertical_drop_rc_track_station; case TRACK_ELEM_25_DEG_UP: return vertical_drop_rc_track_25_deg_up; case TRACK_ELEM_60_DEG_UP: return vertical_drop_rc_track_60_deg_up; case TRACK_ELEM_FLAT_TO_25_DEG_UP: return vertical_drop_rc_track_flat_to_25_deg_up; case TRACK_ELEM_25_DEG_UP_TO_60_DEG_UP: return vertical_drop_rc_track_25_deg_up_to_60_deg_up; case TRACK_ELEM_60_DEG_UP_TO_25_DEG_UP: return vertical_drop_rc_track_60_deg_up_to_25_deg_up; case TRACK_ELEM_25_DEG_UP_TO_FLAT: return vertical_drop_rc_track_25_deg_up_to_flat; case TRACK_ELEM_25_DEG_DOWN: return vertical_drop_rc_track_25_deg_down; case TRACK_ELEM_60_DEG_DOWN: return vertical_drop_rc_track_60_deg_down; case TRACK_ELEM_FLAT_TO_25_DEG_DOWN: return vertical_drop_rc_track_flat_to_25_deg_down; case TRACK_ELEM_25_DEG_DOWN_TO_60_DEG_DOWN: return vertical_drop_rc_track_25_deg_down_to_60_deg_down; case TRACK_ELEM_60_DEG_DOWN_TO_25_DEG_DOWN: return vertical_drop_rc_track_60_deg_down_to_25_deg_down; case TRACK_ELEM_25_DEG_DOWN_TO_FLAT: return vertical_drop_rc_track_25_deg_down_to_flat; case TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES: return vertical_drop_rc_track_left_quarter_turn_5; case TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES: return vertical_drop_rc_track_right_quarter_turn_5; case TRACK_ELEM_FLAT_TO_LEFT_BANK: return vertical_drop_rc_track_flat_to_left_bank; case TRACK_ELEM_FLAT_TO_RIGHT_BANK: return vertical_drop_rc_track_flat_to_right_bank; case TRACK_ELEM_LEFT_BANK_TO_FLAT: return vertical_drop_rc_track_left_bank_to_flat; case TRACK_ELEM_RIGHT_BANK_TO_FLAT: return vertical_drop_rc_track_right_bank_to_flat; case TRACK_ELEM_BANKED_LEFT_QUARTER_TURN_5_TILES: return vertical_drop_rc_track_banked_left_quarter_turn_5; case TRACK_ELEM_BANKED_RIGHT_QUARTER_TURN_5_TILES: return vertical_drop_rc_track_banked_right_quarter_turn_5; case TRACK_ELEM_LEFT_BANK_TO_25_DEG_UP: return vertical_drop_rc_track_left_bank_to_25_deg_up; case TRACK_ELEM_RIGHT_BANK_TO_25_DEG_UP: return vertical_drop_rc_track_right_bank_to_25_deg_up; case TRACK_ELEM_25_DEG_UP_TO_LEFT_BANK: return vertical_drop_rc_track_25_deg_up_to_left_bank; case TRACK_ELEM_25_DEG_UP_TO_RIGHT_BANK: return vertical_drop_rc_track_25_deg_up_to_right_bank; case TRACK_ELEM_LEFT_BANK_TO_25_DEG_DOWN: return vertical_drop_rc_track_left_bank_to_25_deg_down; case TRACK_ELEM_RIGHT_BANK_TO_25_DEG_DOWN: return vertical_drop_rc_track_right_bank_to_25_deg_down; case TRACK_ELEM_25_DEG_DOWN_TO_LEFT_BANK: return vertical_drop_rc_track_25_deg_down_to_left_bank; case TRACK_ELEM_25_DEG_DOWN_TO_RIGHT_BANK: return vertical_drop_rc_track_25_deg_down_to_right_bank; case TRACK_ELEM_LEFT_BANK: return vertical_drop_rc_track_left_bank; case TRACK_ELEM_RIGHT_BANK: return vertical_drop_rc_track_right_bank; case TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_25_DEG_UP: return vertical_drop_rc_track_left_quarter_turn_5_25_deg_up; case TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_25_DEG_UP: return vertical_drop_rc_track_right_quarter_turn_5_25_deg_up; case TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_25_DEG_DOWN: return vertical_drop_rc_track_left_quarter_turn_5_25_deg_down; case TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_25_DEG_DOWN: return vertical_drop_rc_track_right_quarter_turn_5_25_deg_down; case TRACK_ELEM_S_BEND_LEFT: return vertical_drop_rc_track_s_bend_left; case TRACK_ELEM_S_BEND_RIGHT: return vertical_drop_rc_track_s_bend_right; case TRACK_ELEM_LEFT_VERTICAL_LOOP: return vertical_drop_rc_track_left_vertical_loop; case TRACK_ELEM_RIGHT_VERTICAL_LOOP: return vertical_drop_rc_track_right_vertical_loop; case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES: return vertical_drop_rc_track_left_quarter_turn_3; case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES: return vertical_drop_rc_track_right_quarter_turn_3; case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_BANK: return vertical_drop_rc_track_left_quarter_turn_3_bank; case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_BANK: return vertical_drop_rc_track_right_quarter_turn_3_bank; case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_25_DEG_UP: return vertical_drop_rc_track_left_quarter_turn_3_25_deg_up; case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_25_DEG_UP: return vertical_drop_rc_track_right_quarter_turn_3_25_deg_up; case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_25_DEG_DOWN: return vertical_drop_rc_track_left_quarter_turn_3_25_deg_down; case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_25_DEG_DOWN: return vertical_drop_rc_track_right_quarter_turn_3_25_deg_down; case TRACK_ELEM_LEFT_HALF_BANKED_HELIX_UP_SMALL: return vertical_drop_rc_track_left_half_banked_helix_up_small; case TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_UP_SMALL: return vertical_drop_rc_track_right_half_banked_helix_up_small; case TRACK_ELEM_LEFT_HALF_BANKED_HELIX_DOWN_SMALL: return vertical_drop_rc_track_left_half_banked_helix_down_small; case TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_DOWN_SMALL: return vertical_drop_rc_track_right_half_banked_helix_down_small; case TRACK_ELEM_LEFT_HALF_BANKED_HELIX_UP_LARGE: return vertical_drop_rc_track_left_half_banked_helix_up_large; case TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_UP_LARGE: return vertical_drop_rc_track_right_half_banked_helix_up_large; case TRACK_ELEM_LEFT_HALF_BANKED_HELIX_DOWN_LARGE: return vertical_drop_rc_track_left_half_banked_helix_down_large; case TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_DOWN_LARGE: return vertical_drop_rc_track_right_half_banked_helix_down_large; case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE_60_DEG_UP: return vertical_drop_rc_track_left_quarter_turn_1_60_deg_up; case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE_60_DEG_UP: return vertical_drop_rc_track_right_quarter_turn_1_60_deg_up; case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE_60_DEG_DOWN: return vertical_drop_rc_track_left_quarter_turn_1_60_deg_down; case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE_60_DEG_DOWN: return vertical_drop_rc_track_right_quarter_turn_1_60_deg_down; case TRACK_ELEM_BRAKES: return vertical_drop_rc_track_brakes; case TRACK_ELEM_25_DEG_UP_LEFT_BANKED: return vertical_drop_rc_track_25_deg_up_left_banked; case TRACK_ELEM_25_DEG_UP_RIGHT_BANKED: return vertical_drop_rc_track_25_deg_up_right_banked; case TRACK_ELEM_ON_RIDE_PHOTO: return vertical_drop_rc_track_on_ride_photo; case TRACK_ELEM_25_DEG_DOWN_LEFT_BANKED: return vertical_drop_rc_track_25_deg_down_left_banked; case TRACK_ELEM_25_DEG_DOWN_RIGHT_BANKED: return vertical_drop_rc_track_25_deg_down_right_banked; case TRACK_ELEM_90_DEG_UP: return vertical_drop_rc_track_90_deg_up; case TRACK_ELEM_90_DEG_DOWN: return vertical_drop_rc_track_90_deg_down; case TRACK_ELEM_60_DEG_UP_TO_90_DEG_UP: return vertical_drop_rc_track_60_deg_up_to_90_deg_up; case TRACK_ELEM_90_DEG_DOWN_TO_60_DEG_DOWN: return vertical_drop_rc_track_90_deg_down_to_60_deg_down; case TRACK_ELEM_90_DEG_UP_TO_60_DEG_UP: return vertical_drop_rc_track_90_deg_up_to_60_deg_up; case TRACK_ELEM_60_DEG_DOWN_TO_90_DEG_DOWN: return vertical_drop_rc_track_60_deg_down_to_90_deg_down; case TRACK_ELEM_LEFT_EIGHTH_TO_DIAG: return vertical_drop_rc_track_left_eighth_to_diag; case TRACK_ELEM_RIGHT_EIGHTH_TO_DIAG: return vertical_drop_rc_track_right_eighth_to_diag; case TRACK_ELEM_LEFT_EIGHTH_TO_ORTHOGONAL: return vertical_drop_rc_track_left_eighth_to_orthogonal; case TRACK_ELEM_RIGHT_EIGHTH_TO_ORTHOGONAL: return vertical_drop_rc_track_right_eighth_to_orthogonal; case TRACK_ELEM_LEFT_EIGHTH_BANK_TO_DIAG: return vertical_drop_rc_track_left_eighth_bank_to_diag; case TRACK_ELEM_RIGHT_EIGHTH_BANK_TO_DIAG: return vertical_drop_rc_track_right_eighth_bank_to_diag; case TRACK_ELEM_LEFT_EIGHTH_BANK_TO_ORTHOGONAL: return vertical_drop_rc_track_left_eighth_bank_to_orthogonal; case TRACK_ELEM_RIGHT_EIGHTH_BANK_TO_ORTHOGONAL: return vertical_drop_rc_track_right_eighth_bank_to_orthogonal; case TRACK_ELEM_DIAG_FLAT: return vertical_drop_rc_track_diag_flat; case TRACK_ELEM_DIAG_25_DEG_UP: return vertical_drop_rc_track_diag_25_deg_up; case TRACK_ELEM_DIAG_60_DEG_UP: return vertical_drop_rc_track_diag_60_deg_up; case TRACK_ELEM_DIAG_FLAT_TO_25_DEG_UP: return vertical_drop_rc_track_diag_flat_to_25_deg_up; case TRACK_ELEM_DIAG_25_DEG_UP_TO_60_DEG_UP: return vertical_drop_rc_track_diag_25_deg_up_to_60_deg_up; case TRACK_ELEM_DIAG_60_DEG_UP_TO_25_DEG_UP: return vertical_drop_rc_track_diag_60_deg_up_to_25_deg_up; case TRACK_ELEM_DIAG_25_DEG_UP_TO_FLAT: return vertical_drop_rc_track_diag_25_deg_up_to_flat; case TRACK_ELEM_DIAG_25_DEG_DOWN: return vertical_drop_rc_track_diag_25_deg_down; case TRACK_ELEM_DIAG_60_DEG_DOWN: return vertical_drop_rc_track_diag_60_deg_down; case TRACK_ELEM_DIAG_FLAT_TO_25_DEG_DOWN: return vertical_drop_rc_track_diag_flat_to_25_deg_down; case TRACK_ELEM_DIAG_25_DEG_DOWN_TO_60_DEG_DOWN: return vertical_drop_rc_track_diag_25_deg_down_to_60_deg_down; case TRACK_ELEM_DIAG_60_DEG_DOWN_TO_25_DEG_DOWN: return vertical_drop_rc_track_diag_60_deg_down_to_25_deg_down; case TRACK_ELEM_DIAG_25_DEG_DOWN_TO_FLAT: return vertical_drop_rc_track_diag_25_deg_down_to_flat; case TRACK_ELEM_DIAG_FLAT_TO_LEFT_BANK: return vertical_drop_rc_track_diag_flat_to_left_bank; case TRACK_ELEM_DIAG_FLAT_TO_RIGHT_BANK: return vertical_drop_rc_track_diag_flat_to_right_bank; case TRACK_ELEM_DIAG_LEFT_BANK_TO_FLAT: return vertical_drop_rc_track_diag_left_bank_to_flat; case TRACK_ELEM_DIAG_RIGHT_BANK_TO_FLAT: return vertical_drop_rc_track_diag_right_bank_to_flat; case TRACK_ELEM_DIAG_LEFT_BANK_TO_25_DEG_UP: return vertical_drop_rc_track_diag_left_bank_to_25_deg_up; case TRACK_ELEM_DIAG_RIGHT_BANK_TO_25_DEG_UP: return vertical_drop_rc_track_diag_right_bank_to_25_deg_up; case TRACK_ELEM_DIAG_25_DEG_UP_TO_LEFT_BANK: return vertical_drop_rc_track_diag_25_deg_up_to_left_bank; case TRACK_ELEM_DIAG_25_DEG_UP_TO_RIGHT_BANK: return vertical_drop_rc_track_diag_25_deg_up_to_right_bank; case TRACK_ELEM_DIAG_LEFT_BANK_TO_25_DEG_DOWN: return vertical_drop_rc_track_diag_left_bank_to_25_deg_down; case TRACK_ELEM_DIAG_RIGHT_BANK_TO_25_DEG_DOWN: return vertical_drop_rc_track_diag_right_bank_to_25_deg_down; case TRACK_ELEM_DIAG_25_DEG_DOWN_TO_LEFT_BANK: return vertical_drop_rc_track_diag_25_deg_down_to_left_bank; case TRACK_ELEM_DIAG_25_DEG_DOWN_TO_RIGHT_BANK: return vertical_drop_rc_track_diag_25_deg_down_to_right_bank; case TRACK_ELEM_DIAG_LEFT_BANK: return vertical_drop_rc_track_diag_left_bank; case TRACK_ELEM_DIAG_RIGHT_BANK: return vertical_drop_rc_track_diag_right_bank; case TRACK_ELEM_LEFT_BANK_TO_LEFT_QUARTER_TURN_3_TILES_25_DEG_UP: return vertical_drop_rc_track_left_bank_to_left_quarter_turn_3_25_deg_up; case TRACK_ELEM_RIGHT_BANK_TO_RIGHT_QUARTER_TURN_3_TILES_25_DEG_UP: return vertical_drop_rc_track_right_bank_to_right_quarter_turn_3_25_deg_up; case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_25_DEG_DOWN_TO_LEFT_BANK: return vertical_drop_rc_track_left_quarter_turn_3_25_deg_down_to_left_bank; case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_25_DEG_DOWN_TO_RIGHT_BANK: return vertical_drop_rc_track_right_quarter_turn_3_25_deg_down_to_right_bank; case TRACK_ELEM_BLOCK_BRAKES: return vertical_drop_rc_track_block_brakes; case TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_3_TILE_25_DEG_UP: return vertical_drop_rc_track_left_banked_quarter_turn_3_25_deg_up; case TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_3_TILE_25_DEG_UP: return vertical_drop_rc_track_right_banked_quarter_turn_3_25_deg_up; case TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN: return vertical_drop_rc_track_left_banked_quarter_turn_3_25_deg_down; case TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN: return vertical_drop_rc_track_right_banked_quarter_turn_3_25_deg_down; case TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_5_TILE_25_DEG_UP: return vertical_drop_rc_track_left_banked_quarter_turn_5_25_deg_up; case TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_5_TILE_25_DEG_UP: return vertical_drop_rc_track_right_banked_quarter_turn_5_25_deg_up; case TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN: return vertical_drop_rc_track_left_banked_quarter_turn_5_25_deg_down; case TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN: return vertical_drop_rc_track_right_banked_quarter_turn_5_25_deg_down; case TRACK_ELEM_25_DEG_UP_TO_LEFT_BANKED_25_DEG_UP: return vertical_drop_rc_track_25_deg_up_to_left_banked_25_deg_up; case TRACK_ELEM_25_DEG_UP_TO_RIGHT_BANKED_25_DEG_UP: return vertical_drop_rc_track_25_deg_up_to_right_banked_25_deg_up; case TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_25_DEG_UP: return vertical_drop_rc_track_left_banked_25_deg_up_to_25_deg_up; case TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_25_DEG_UP: return vertical_drop_rc_track_right_banked_25_deg_up_to_25_deg_up; case TRACK_ELEM_25_DEG_DOWN_TO_LEFT_BANKED_25_DEG_DOWN: return vertical_drop_rc_track_25_deg_down_to_left_banked_25_deg_down; case TRACK_ELEM_25_DEG_DOWN_TO_RIGHT_BANKED_25_DEG_DOWN: return vertical_drop_rc_track_25_deg_down_to_right_banked_25_deg_down; case TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_25_DEG_DOWN: return vertical_drop_rc_track_left_banked_25_deg_down_to_25_deg_down; case TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_25_DEG_DOWN: return vertical_drop_rc_track_right_banked_25_deg_down_to_25_deg_down; case TRACK_ELEM_LEFT_BANKED_FLAT_TO_LEFT_BANKED_25_DEG_UP: return vertical_drop_rc_track_left_banked_flat_to_left_banked_25_deg_up; case TRACK_ELEM_RIGHT_BANKED_FLAT_TO_RIGHT_BANKED_25_DEG_UP: return vertical_drop_rc_track_right_banked_flat_to_right_banked_25_deg_up; case TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_LEFT_BANKED_FLAT: return vertical_drop_rc_track_left_banked_25_deg_up_to_left_banked_flat; case TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_RIGHT_BANKED_FLAT: return vertical_drop_rc_track_right_banked_25_deg_up_to_right_banked_flat; case TRACK_ELEM_LEFT_BANKED_FLAT_TO_LEFT_BANKED_25_DEG_DOWN: return vertical_drop_rc_track_left_banked_flat_to_left_banked_25_deg_down; case TRACK_ELEM_RIGHT_BANKED_FLAT_TO_RIGHT_BANKED_25_DEG_DOWN: return vertical_drop_rc_track_right_banked_flat_to_right_banked_25_deg_down; case TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_LEFT_BANKED_FLAT: return vertical_drop_rc_track_left_banked_25_deg_down_to_left_banked_flat; case TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_RIGHT_BANKED_FLAT: return vertical_drop_rc_track_right_banked_25_deg_down_to_right_banked_flat; case TRACK_ELEM_FLAT_TO_LEFT_BANKED_25_DEG_UP: return vertical_drop_rc_track_flat_to_left_banked_25_deg_up; case TRACK_ELEM_FLAT_TO_RIGHT_BANKED_25_DEG_UP: return vertical_drop_rc_track_flat_to_right_banked_25_deg_up; case TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_FLAT: return vertical_drop_rc_track_left_banked_25_deg_up_to_flat; case TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_FLAT: return vertical_drop_rc_track_right_banked_25_deg_up_to_flat; case TRACK_ELEM_FLAT_TO_LEFT_BANKED_25_DEG_DOWN: return vertical_drop_rc_track_flat_to_left_banked_25_deg_down; case TRACK_ELEM_FLAT_TO_RIGHT_BANKED_25_DEG_DOWN: return vertical_drop_rc_track_flat_to_right_banked_25_deg_down; case TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_FLAT: return vertical_drop_rc_track_left_banked_25_deg_down_to_flat; case TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_FLAT: return vertical_drop_rc_track_right_banked_25_deg_down_to_flat; case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE_90_DEG_UP: return vertical_drop_rc_track_left_quarter_turn_1_90_deg_up; case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE_90_DEG_UP: return vertical_drop_rc_track_right_quarter_turn_1_90_deg_up; case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE_90_DEG_DOWN: return vertical_drop_rc_track_left_quarter_turn_1_90_deg_down; case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE_90_DEG_DOWN: return vertical_drop_rc_track_right_quarter_turn_1_90_deg_down; /* These track elements used to be specific to the vertical RC */ case TRACK_ELEM_FLAT_TO_60_DEG_UP: return vertical_drop_rc_track_flat_to_60_deg_up; case TRACK_ELEM_60_DEG_UP_TO_FLAT: return vertical_drop_rc_track_60_deg_up_to_flat; case TRACK_ELEM_FLAT_TO_60_DEG_DOWN: return vertical_drop_rc_track_flat_to_60_deg_down; case TRACK_ELEM_60_DEG_DOWN_TO_FLAT: return vertical_drop_rc_track_60_deg_down_to_flat; case TRACK_ELEM_BRAKE_FOR_DROP: return vertical_drop_rc_track_brake_for_drop; case TRACK_ELEM_DIAG_FLAT_TO_60_DEG_UP: return vertical_drop_rc_track_diag_flat_to_60_deg_up; case TRACK_ELEM_DIAG_60_DEG_UP_TO_FLAT: return vertical_drop_rc_track_diag_60_deg_up_to_flat; case TRACK_ELEM_DIAG_FLAT_TO_60_DEG_DOWN: return vertical_drop_rc_track_diag_flat_to_60_deg_down; case TRACK_ELEM_DIAG_60_DEG_DOWN_TO_FLAT: return vertical_drop_rc_track_diag_60_deg_down_to_flat; /* These track elements used to be specific to the steel vertical_drop */ case TRACK_ELEM_HALF_LOOP_UP: return vertical_drop_rc_track_half_loop_up; case TRACK_ELEM_HALF_LOOP_DOWN: return vertical_drop_rc_track_half_loop_down; case TRACK_ELEM_LEFT_CORKSCREW_UP: return vertical_drop_rc_track_left_corkscrew_up; case TRACK_ELEM_RIGHT_CORKSCREW_UP: return vertical_drop_rc_track_right_corkscrew_up; case TRACK_ELEM_LEFT_CORKSCREW_DOWN: return vertical_drop_rc_track_left_corkscrew_down; case TRACK_ELEM_RIGHT_CORKSCREW_DOWN: return vertical_drop_rc_track_right_corkscrew_down; case TRACK_ELEM_FLAT_TO_60_DEG_UP_LONG_BASE: return vertical_drop_rc_track_flat_to_60_deg_up_long_base; case TRACK_ELEM_60_DEG_UP_TO_FLAT_LONG_BASE: return vertical_drop_rc_track_60_deg_up_to_flat_long_base; case TRACK_ELEM_FLAT_TO_60_DEG_DOWN_LONG_BASE: return vertical_drop_rc_track_flat_to_60_deg_down_long_base; case TRACK_ELEM_60_DEG_UP_TO_FLAT_LONG_BASE_122: return vertical_drop_rc_track_60_deg_up_to_flat_long_base122; case TRACK_ELEM_LEFT_BARREL_ROLL_UP_TO_DOWN: return vertical_drop_rc_track_left_barrel_roll_up_to_down; case TRACK_ELEM_RIGHT_BARREL_ROLL_UP_TO_DOWN: return vertical_drop_rc_track_right_barrel_roll_up_to_down; case TRACK_ELEM_LEFT_BARREL_ROLL_DOWN_TO_UP: return vertical_drop_rc_track_left_barrel_roll_down_to_up; case TRACK_ELEM_RIGHT_BARREL_ROLL_DOWN_TO_UP: return vertical_drop_rc_track_right_barrel_roll_down_to_up; case TRACK_ELEM_POWERED_LIFT: return vertical_drop_rc_track_powered_lift; case TRACK_ELEM_LEFT_LARGE_HALF_LOOP_UP: return vertical_drop_rc_track_left_large_half_loop_up; case TRACK_ELEM_RIGHT_LARGE_HALF_LOOP_UP: return vertical_drop_rc_track_right_large_half_loop_up; case TRACK_ELEM_RIGHT_LARGE_HALF_LOOP_DOWN: return vertical_drop_rc_track_right_large_half_loop_down; case TRACK_ELEM_LEFT_LARGE_HALF_LOOP_DOWN: return vertical_drop_rc_track_left_large_half_loop_down; case TRACK_ELEM_90_DEG_TO_INVERTED_FLAT_QUARTER_LOOP_UP: return vertical_drop_rc_track_90_deg_to_inverted_flat_quarter_loop_up; case TRACK_ELEM_INVERTED_FLAT_TO_90_DEG_QUARTER_LOOP_DOWN: return vertical_drop_rc_track_inverted_flat_to_90_deg_quarter_loop_down; case TRACK_ELEM_BOOSTER: return vertical_drop_rc_track_booster; } return nullptr; }
Wirlie/OpenRCT2
src/openrct2/ride/coaster/VerticalDropRollerCoaster.cpp
C++
gpl-3.0
117,511
UMI.CMS 15 = 16e84cd228729e8f52ce3f969b9013f7
gohdan/DFC
known_files/hashes/sys-temp/updates/core/libs/vendor/nixsolutions/yandex-php-library/examples/SafeBrowsing/local-search.php
PHP
gpl-3.0
46
package uo.sdi.persistence.util; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLTimeoutException; import java.util.Properties; import uo.sdi.persistence.PersistenceException; public class Jdbc { private static final String DATABASE_PROPERTIES_FILE = "database.properties"; private static final String QUERIES_PROPERTIES_FILE = "sql_queries.properties"; private static final String DATABASE_URL; private static final String DATABASE_USER; private static final String DATABASE_PASSWORD; private static Properties sqlQueries; static { Properties dbConfig = loadProperties( DATABASE_PROPERTIES_FILE ); sqlQueries = loadProperties( QUERIES_PROPERTIES_FILE ); DATABASE_URL = dbConfig.getProperty( "DATABASE_URL" ); DATABASE_USER = dbConfig.getProperty( "DATABASE_USER" ); DATABASE_PASSWORD = dbConfig.getProperty( "DATABASE_PASSWORD" ); try { Class.forName( dbConfig.getProperty( "DATABASE_DRIVER" ) ); } catch (ClassNotFoundException e) { throw new PersistenceException("Driver not found", e); } } private static ThreadLocal<Connection> threadLocal = new ThreadLocal<>(); public static Connection createConnection() { try { Connection con = DriverManager.getConnection( DATABASE_URL, DATABASE_USER, DATABASE_PASSWORD ); threadLocal.set(con); return con; } catch (SQLTimeoutException e) { throw new PersistenceException("Timeout opennig JDBC conection", e); } catch (SQLException e) { throw new PersistenceException("An unexpected JDBC error has ocurred", e); } } public static Connection getCurrentConnection() { Connection con = threadLocal.get(); if (con == null) { con = createConnection(); } return con; } public static String getSqlQuery(String queryKey) { return sqlQueries.getProperty(queryKey).trim(); } public static void close(ResultSet rs, PreparedStatement ps, Connection con) { close(rs); close(ps); close(con); } public static void close(PreparedStatement ps, Connection con) { close( ps ); close( con ); } static void close(ResultSet rs) { if (rs != null) { try{ rs.close(); } catch (Exception ex){}}; } public static void close(PreparedStatement ps) { if (ps != null) { try{ ps.close(); } catch (Exception ex){}}; } /** * If not using a Transaction object a call to this method physically closes * the connection (each call to a Dao method is in its own transaction). * * If there is a Transaction open then this method don't do anything as the * Transaction itself will close the connection by calling commit or rollback * * @param con */ public static void close(Connection con) { if ( ! isInAutoCommitMode(con) ) return; // Transaction is in charge threadLocal.set(null); if (con != null) { try{ con.close(); } catch (Exception ex){}}; } private static boolean isInAutoCommitMode(Connection con) { try { return con.getAutoCommit(); } catch (SQLException e) { throw new PersistenceException("Unexpected exception", e); } } private static Properties loadProperties(String fileName) { Properties prop = new Properties(); InputStream stream = Jdbc.class.getClassLoader().getResourceAsStream(fileName); try { prop.load( stream ); } catch (IOException e) { throw new PersistenceException("Wrong configutation file " + fileName ); } return prop; } }
risuarez/work
sesion4.MVCCasero_changes/src/uo/sdi/persistence/util/Jdbc.java
Java
gpl-3.0
3,560
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace WindowsApplication1.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } }
diegoisawesome/AME
Dependencies/Hacking/old/Fire Emblem map editor/Backup/Fire Emblem map editor/Properties/Settings.Designer.cs
C#
gpl-3.0
1,074