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
#!/bin/bash . lib-it.sh for file in ./*.mp4 do for keep_audio in "" "--keep_audio" do run_cmd "video-reverse -i $file -o tmp/$file.reverse.mp4 $keep_audio" done done echo "----------------------------------------" echo "SUCCESS $(basename $0)" echo "----------------------------------------" rm tmp/*.reverse.* 2>/dev/null exit 0
okorach/audio-video-tools
it/it-03-video-reverse.sh
Shell
lgpl-3.0
351
package inusualz.mechanics.common.blocks; import net.minecraft.block.material.Material; public class BlockSmelter extends BlockBase { public BlockSmelter() { super("smelter"); } }
InusualZ/Mechanics
src/main/java/inusualz/mechanics/common/blocks/BlockSmelter.java
Java
lgpl-3.0
188
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const react_1 = __importDefault(require("react")); const R = react_1.default.createElement; const ui = __importStar(require("react-library/lib/bootstrap")); // Number input component that handles parsing and maintains state when number is invalid class NumberAnswerComponent extends react_1.default.Component { focus() { var _a; return (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus(); } validate() { if (!this.input.isValid()) { return "Invalid number"; } return null; } render() { return R(ui.NumberInput, { ref: (c) => { return (this.input = c); }, decimal: this.props.decimal, value: this.props.value, onChange: this.props.onChange, size: this.props.small ? "sm" : undefined, onTab: this.props.onNextOrComments, onEnter: this.props.onNextOrComments }); } } exports.default = NumberAnswerComponent;
mWater/mwater-forms
lib/answers/NumberAnswerComponent.js
JavaScript
lgpl-3.0
2,266
/* * Copyright 2013, Nexedi SA * * This program is free software: you can Use, Study, Modify and Redistribute * it under the terms of the GNU General Public License version 3, or (at your * option) any later version, as published by the Free Software Foundation. * * You can also Link and Combine this program with other software covered by * the terms of any of the Free Software licenses or any of the Open Source * Initiative approved licenses and Convey the resulting work. Corresponding * source of such a combination shall include the source code for all other * software used. * * This program is distributed WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See COPYING file for full licensing terms. * See https://www.nexedi.com/licensing for rationale and options. */ return parser.parse(string); } // parseStringToObject
nexedi/jio
src/queries/parser-end.js
JavaScript
lgpl-3.0
921
// CSmtp.h: interface for the Smtp class. // ////////////////////////////////////////////////////////////////////// #pragma once #ifndef __CSMTP_H__ #define __CSMTP_H__ #include <vector> #include <string.h> #include <assert.h> #ifdef LINUX #include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <errno.h> #include <stdio.h> #include <iostream> #define SOCKET_ERROR -1 #define INVALID_SOCKET -1 typedef unsigned short WORD; typedef int SOCKET; typedef struct sockaddr_in SOCKADDR_IN; typedef struct hostent* LPHOSTENT; typedef struct servent* LPSERVENT; typedef struct in_addr* LPIN_ADDR; typedef struct sockaddr* LPSOCKADDR; #else #include <winsock2.h> #include <time.h> #pragma comment(lib, "ws2_32.lib") #endif #define TIME_IN_SEC 10 // how long client will wait for server response in non-blocking mode #define BUFFER_SIZE 10240 // SendData and RecvData buffers sizes #define MSG_SIZE_IN_MB 5 // the maximum size of the message with all attachments #define COUNTER_VALUE 100 // how many times program will try to receive data const char BOUNDARY_TEXT[] = "__MESSAGE__ID__54yg6f6h6y456345"; enum CSmptXPriority { XPRIORITY_HIGH = 2, XPRIORITY_NORMAL = 3, XPRIORITY_LOW = 4 }; class ECSmtp { public: enum CSmtpError { CSMTP_NO_ERROR = 0, WSA_STARTUP = 100, // WSAGetLastError() WSA_VER, WSA_SEND, WSA_RECV, WSA_CONNECT, WSA_GETHOSTBY_NAME_ADDR, WSA_INVALID_SOCKET, WSA_HOSTNAME, WSA_IOCTLSOCKET, WSA_SELECT, BAD_IPV4_ADDR, UNDEF_MSG_HEADER = 200, UNDEF_MAIL_FROM, UNDEF_SUBJECT, UNDEF_RECIPIENTS, UNDEF_LOGIN, UNDEF_PASSWORD, UNDEF_RECIPIENT_MAIL, COMMAND_MAIL_FROM = 300, COMMAND_EHLO, COMMAND_AUTH_LOGIN, COMMAND_DATA, COMMAND_QUIT, COMMAND_RCPT_TO, MSG_BODY_ERROR, CONNECTION_CLOSED = 400, // by server SERVER_NOT_READY, // remote server SERVER_NOT_RESPONDING, SELECT_TIMEOUT, FILE_NOT_EXIST, MSG_TOO_BIG, BAD_LOGIN_PASS, UNDEF_XYZ_RESPONSE, LACK_OF_MEMORY, TIME_ERROR, RECVBUF_IS_EMPTY, SENDBUF_IS_EMPTY, OUT_OF_MSG_RANGE, }; ECSmtp(CSmtpError err_) : ErrorCode(err_) {} CSmtpError GetErrorNum(void) const {return ErrorCode;} std::string GetErrorText(void) const; private: CSmtpError ErrorCode; }; class CSmtp { public: CSmtp(); virtual ~CSmtp(); void AddRecipient(const char *email, const char *name=NULL); void AddBCCRecipient(const char *email, const char *name=NULL); void AddCCRecipient(const char *email, const char *name=NULL); void AddAttachment(const char *path); void AddMsgLine(const char* text); void DelRecipients(void); void DelBCCRecipients(void); void DelCCRecipients(void); void DelAttachments(void); void DelMsgLines(void); void DelMsgLine(unsigned int line); void ModMsgLine(unsigned int line,const char* text); unsigned int GetBCCRecipientCount() const; unsigned int GetCCRecipientCount() const; unsigned int GetRecipientCount() const; const char* GetLocalHostIP() const; const char* GetLocalHostName() const; const char* GetMsgLineText(unsigned int line) const; unsigned int GetMsgLines(void) const; const char* GetReplyTo() const; const char* GetMailFrom() const; const char* GetSenderName() const; const char* GetSubject() const; const char* GetXMailer() const; CSmptXPriority GetXPriority() const; void Send(); void SetSubject(const char*); void SetSenderName(const char*); void SetSenderMail(const char*); void SetReplyTo(const char*); void SetXMailer(const char*); void SetLogin(const char*); void SetPassword(const char*); void SetXPriority(CSmptXPriority); void SetSMTPServer(const char* server,const unsigned short port=0); private: std::string m_sLocalHostName; std::string m_sMailFrom; std::string m_sNameFrom; std::string m_sSubject; std::string m_sXMailer; std::string m_sReplyTo; std::string m_sIPAddr; std::string m_sLogin; std::string m_sPassword; std::string m_sSMTPSrvName; unsigned short m_iSMTPSrvPort; CSmptXPriority m_iXPriority; char *SendBuf; char *RecvBuf; SOCKET hSocket; struct Recipient { std::string Name; std::string Mail; }; std::vector<Recipient> Recipients; std::vector<Recipient> CCRecipients; std::vector<Recipient> BCCRecipients; std::vector<std::string> Attachments; std::vector<std::string> MsgBody; void ReceiveData(); void SendData(); void FormatHeader(char*); int SmtpXYZdigits(); SOCKET ConnectRemoteServer(const char* server, const unsigned short port=0); }; #endif // __CSMTP_H__
davecalkins/pollyanna
source/CSmtp.h
C
lgpl-3.0
4,565
/* * SonarQube * Copyright (C) 2009-2016 SonarSource SA * mailto:contact AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.server.user; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import org.sonar.api.utils.log.Loggers; import org.sonar.server.platform.Platform; /** * @since 3.6 */ public class UserSessionFilter implements Filter { private final Platform platform; public UserSessionFilter() { this.platform = Platform.getInstance(); } public UserSessionFilter(Platform platform) { this.platform = platform; } @Override public void init(FilterConfig filterConfig) throws ServletException { // nothing to do } @Override public void destroy() { // nothing to do } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { try { chain.doFilter(servletRequest, servletResponse); } finally { ThreadLocalUserSession userSession = platform.getContainer().getComponentByType(ThreadLocalUserSession.class); if (userSession == null) { Loggers.get(UserSessionFilter.class).error("Can not retrieve ThreadLocalUserSession from Platform"); } else { userSession.remove(); } } } }
joansmith/sonarqube
server/sonar-server/src/main/java/org/sonar/server/user/UserSessionFilter.java
Java
lgpl-3.0
2,210
/* * SonarQube * Copyright (C) 2009-2017 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import Backbone from 'backbone'; import Rule from './rule'; export default Backbone.Collection.extend({ model: Rule, parseRules(r) { let rules = r.rules; const profiles = r.qProfiles || []; if (r.actives != null) { rules = rules.map(rule => { const activations = (r.actives[rule.key] || []).map(activation => { const profile = profiles[activation.qProfile]; if (profile != null) { Object.assign(activation, { profile }); if (profile.parent != null) { Object.assign(activation, { parentProfile: profiles[profile.parent] }); } } return activation; }); return { ...rule, activation: activations.length > 0 ? activations[0] : null }; }); } return rules; }, setIndex() { this.forEach((rule, index) => { rule.set({ index }); }); }, addExtraAttributes(repositories) { this.models.forEach(model => { model.addExtraAttributes(repositories); }); } });
lbndev/sonarqube
server/sonar-web/src/main/js/apps/coding-rules/models/rules.js
JavaScript
lgpl-3.0
1,878
/* * Copyright (c) 2020 Neil C Smith * * This file is part of gstreamer-java. * * This code is free software: you can redistribute it and/or modify it under the terms of the GNU * Lesser General Public License version 3 only, as published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License version 3 for more details. * * You should have received a copy of the GNU Lesser General Public License version 3 along with * this work. If not, see <http://www.gnu.org/licenses/>. */ package org.freedesktop.gstreamer.lowlevel; import com.sun.jna.Pointer; /** * GstMessage pointer. */ public class GstMessagePtr extends GstMiniObjectPtr { private static final int TYPE_OFFSET; private static final int SRC_OFFSET; static { GstMessageAPI.MessageStruct struct = new GstMessageAPI.MessageStruct(); TYPE_OFFSET = struct.typeOffset(); SRC_OFFSET = struct.srcOffset(); } public GstMessagePtr() { } public GstMessagePtr(Pointer ptr) { super(ptr); } public int getMessageType() { return getPointer().getInt(TYPE_OFFSET); } public GstObjectPtr getSource() { Pointer raw = getPointer().getPointer(SRC_OFFSET); return raw == null ? null : new GstObjectPtr(raw); } }
gstreamer-java/gst1-java-core
src/org/freedesktop/gstreamer/lowlevel/GstMessagePtr.java
Java
lgpl-3.0
1,512
package com.serenegiant.gamepaddiag; /* * AndroGamepad * library and sample to access to various gamepad with common interface * * Copyright (c) 2015-2016 saki t_saki@serenegiant.com * * File name: GamepadView.java * * Distributed under the terms of the GNU Lesser General Public License (LGPL v3.0) License. * License details are in the file license.txt, distributed as part of this software. */ import android.content.Context; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.SparseIntArray; import android.view.View; import com.serenegiant.gamepad.GamePadConst; import java.util.ArrayList; import java.util.List; public class GamepadView extends View { // private static final boolean DEBUG = false; // FIXME 実同時はfalseにすること // private static final String TAG = GamepadView.class.getSimpleName(); private final Object mSync = new Object(); private final List<KeyPosition> mKeyPositions = new ArrayList<KeyPosition>(); private final SparseIntArray mKeyStates = new SparseIntArray(); private Drawable mGamepadDrawable; private Drawable mKeypadDrawable; private int mImageWidth, mImageHeight; private float mScale; private float mCenterViewX, mCenterViewY; private float mCenterImageX, mCenterImageY; private float mOffsetX, mOffsetY; private final int[] mStickPos = new int[6]; private final float[] mStickVals = new float[4]; private float mStickScaleLeft, mStickScaleRight; public GamepadView(final Context context) { this(context, null, 0); } public GamepadView(final Context context, final AttributeSet attrs) { this(context, attrs, 0); } public GamepadView(final Context context, final AttributeSet attrs, final int defStyleAttr) { super(context, attrs, defStyleAttr); TypedArray attribs = context.obtainStyledAttributes(attrs, R.styleable.GamepadView, defStyleAttr, 0); mGamepadDrawable = attribs.getDrawable(R.styleable.GamepadView_gamepadview_gamepad_drawable); mKeypadDrawable = attribs.getDrawable(R.styleable.GamepadView_gamepadview_keypad_drawable); attribs.recycle(); attribs = null; if (mGamepadDrawable instanceof BitmapDrawable) { final Bitmap bitmap = ((BitmapDrawable)mGamepadDrawable).getBitmap(); mImageWidth = bitmap.getWidth(); mImageHeight = bitmap.getHeight(); } else { mImageWidth = mGamepadDrawable.getIntrinsicWidth(); mImageHeight = mGamepadDrawable.getIntrinsicHeight(); } final Rect bounds = new Rect(); bounds.set(mGamepadDrawable.getBounds()); // if (DEBUG) Log.v(TAG, String.format("ImageSize(%d,%d),bounds=", mImageWidth, mImageHeight) + bounds); mGamepadDrawable.setBounds(0, 0, mImageWidth, mImageHeight); bounds.set(mGamepadDrawable.getBounds()); // if (DEBUG) Log.v(TAG, String.format("ImageSize(%d,%d),bounds=", mImageWidth, mImageHeight) + bounds); } @Override protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } @Override protected void onLayout(final boolean changed, final int left, final int top, final int right, final int bottom) { super.onLayout(changed, left, top, right, bottom); if (changed && (mImageWidth * mImageHeight != 0)) { // このビューのサイズ final int view_width = right - left; final int view_height = bottom - top; // ゲームパッド画像をビューにフィットさせるときの縦横の拡大率を計算 final float scale_x = view_width / (float)mImageWidth; final float scale_y = view_height / (float)mImageHeight; // アスペクトを保ったままはみ出さずに表示できる最大の拡大率=縦横の拡大率の小さい方を選択 // クロップセンターにするなら大きい方を選択する // final float scale = Math.max(scale_x, scale_y); // SCALE_MODE_CROP final float scale = Math.min(scale_x, scale_y); // SCALE_MODE_KEEP_ASPECT final float offset_x = (view_width / scale - mImageWidth) / 2.0f; final float offset_y = (view_height / scale - mImageHeight) / 2.0f; // if (DEBUG) Log.v(TAG, String.format("view(%d,%d),size(%d,%d),scale(%f,%f,%f)", // view_width, view_height, mImageWidth, mImageHeight, scale_x, scale_y, scale)); mScale = scale; mCenterViewX = view_width / 2.0f; mCenterViewY = view_height / 2.0f; mCenterImageX = mImageWidth / 2.0f; mCenterImageY = mImageHeight / 2.0f; mOffsetX = offset_x; mOffsetY = offset_y; mStickScaleLeft = mStickPos[2] * mScale / 256.f; mStickScaleRight = mStickPos[5] * mScale / 256.f; } } private static final int[] CHECKED_STATE_SET = { android.R.attr.state_checked, android.R.attr.state_enabled }; private final Paint mPaint = new Paint(); private final SparseIntArray mWorkState = new SparseIntArray(); private boolean[] mDowns = new boolean[GamePadConst.KEY_NUMS]; private boolean[] mDownsCopy = new boolean[GamePadConst.KEY_NUMS]; private final int[] mAnalogs = new int[4]; @Override protected void onDraw(final Canvas canvas) { if (mKeypadDrawable != null) { // if (DEBUG) Log.v(TAG, "onDraw:"); final int n = GamePadConst.KEY_NUMS; synchronized (mSync) { System.arraycopy(mDowns, 0, mDownsCopy, 0, GamePadConst.KEY_NUMS); } // キーパッドの描画処理 mWorkState.clear(); final int[] state = getDrawableState(); int k = state != null ? state.length : 0; // if (DEBUG) Log.v(TAG, "onDraw:getDrawableState:k=" + k); for (int i = 0; i < k; i++) { mWorkState.put(state[i], state[i]); } mWorkState.delete(android.R.attr.state_checked); k = mWorkState.size(); final int[] base_state = new int[k + 2]; for (int i = 0; i < k; i++) { base_state[i] = mWorkState.indexOfKey(i); } base_state[k - 2] = android.R.attr.state_enabled; final int m = mKeyPositions.size(); for (int i = 0; i < m; i++) { final KeyPosition pos = mKeyPositions.get(i); if (pos != null) { final int key = pos.key; final int saveCount = canvas.save(Canvas.MATRIX_SAVE_FLAG); try { canvas.scale(mScale, mScale); canvas.translate(pos.center_x + mOffsetX - pos.width / 2.0f, pos.center_y + mOffsetY - pos.height / 2.0f); mKeypadDrawable.setBounds(0, 0, pos.width, pos.height); base_state[k-1] = mDownsCopy[key] ? android.R.attr.state_checked : 0; mKeypadDrawable.setState(mDownsCopy[key] ? CHECKED_STATE_SET : null); mKeypadDrawable.draw(canvas); } finally { canvas.restoreToCount(saveCount); } } } } // ゲームパッド画像の表示 int saveCount = canvas.save(Canvas.MATRIX_SAVE_FLAG); try { // Canvas#setMatrixはうまく働かない // 元のイメージの中心点を原点に移動→拡大縮小→Viewの中心座標まで原点を移動 canvas.translate(mCenterViewX, mCenterViewY); canvas.scale(mScale, mScale); canvas.translate(-mCenterImageX, -mCenterImageY); if (mGamepadDrawable != null) { mGamepadDrawable.draw(canvas); } } finally { canvas.restoreToCount(saveCount); } // アナログスティックの表示 drawStickOne(canvas, mStickPos[0], mStickPos[1], mStickVals[0], mStickVals[1]); drawStickOne(canvas, mStickPos[3], mStickPos[4], mStickVals[2], mStickVals[3]); } private void drawStickOne(final Canvas canvas, final float cx, final float cy, final float vx, final float vy) { final int saveCount = canvas.save(Canvas.MATRIX_SAVE_FLAG); try { canvas.scale(mScale, mScale); canvas.translate(mOffsetX, mOffsetY); mPaint.setColor(0xffff0000); // 赤 mPaint.setStrokeWidth(5.0f); canvas.drawLine(cx, cy, vx, vy, mPaint); } finally { canvas.restoreToCount(saveCount); } } public void setKeys(final List<KeyPosition> positions) { // if (DEBUG) Log.v(TAG, "setKeys:"); synchronized (mSync) { mKeyPositions.clear(); final int n = positions != null ? positions.size() : 0; for (int i = 0; i < n; i++) { mKeyPositions.add(positions.get(i)); } } } public void setSticks(final int[] xyr) { synchronized (mSync) { System.arraycopy(xyr, 0, mStickPos, 0, 6); mStickVals[0] = mStickPos[0]; mStickVals[1] = mStickPos[1]; mStickVals[2] = mStickPos[3]; mStickVals[3] = mStickPos[4]; } } public void setKeyState(final boolean[] downs, final int[] analogs) { // if (DEBUG) Log.v(TAG, "setKeyState:"); boolean modified = false; synchronized (mSync) { final int n = GamePadConst.KEY_NUMS; for (int i = 0; i < n; i++) { if (mDowns[i] != downs[i]) { mDowns[i] = downs[i]; modified = true; } } // 左アナログスティック if (mAnalogs[0] != analogs[0]) { mStickVals[0] = analogs[0] * mStickScaleLeft + mStickPos[0]; mAnalogs[0] = analogs[0]; modified = true; } if (mAnalogs[1] != analogs[1]) { mStickVals[1] = analogs[1] * mStickScaleLeft + mStickPos[1]; mAnalogs[1] = analogs[1]; modified = true; } // 右アナログスティック if (mAnalogs[2] != analogs[2]) { mStickVals[2] = analogs[2] * mStickScaleRight + mStickPos[3]; mAnalogs[2] = analogs[2]; modified = true; } if (mAnalogs[3] != analogs[3]) { mStickVals[3] = analogs[3] * mStickScaleRight + mStickPos[4]; mAnalogs[3] = analogs[3]; modified = true; } } if (modified) { postInvalidate(); } } }
saki4510t/AndroGamepad
app/src/main/java/com/serenegiant/gamepaddiag/GamepadView.java
Java
lgpl-3.0
9,536
module (arg and arg[1]) local timer_mt = { __index = {} } local timer = timer_mt.__index -- create new event list function new () return setmetatable ({jobs={}}, timer_mt) end -- add event -- f() is called no sooner than time t function timer:add (t, f) local job={time=t, func=f} local ins = -1 for i,v in ipairs (self.jobs) do if v.time > t then ins = i break end end if ins > 0 then table.insert (self.jobs, ins, job) else table.insert (self.jobs, job) end end -- add relatike event -- f() is called no sooner than time now+t -- (t is seconds in most systems) function timer:add_rel (t, f) return self:add (os.time() + t, f) end -- add repeatig event -- f() is called no more often than once each t -- (seconds in most systems) function timer:add_rep (t, f) local function w () f () return self:add_rel (t, w) end return self:add_rel (t, w) end -- called periodically function timer:tick () while self.jobs[1] and os.time() >= self.jobs[1].time do local job = table.remove (self.jobs, 1) job.func() end end
kveratis/GameCode4
Source/GCC4/3rdParty/luaplus51-all/Src/Modules/xavante/src/codeweb/timer.lua
Lua
lgpl-3.0
1,109
# -*- coding: utf-8 -*- from common.db_sum import _metric_meta_db '''get the data from table by name''' def get_data_by_name(name, status=[1], other=0): result = [] where = '' if status: status = ",".join([str(x) for x in status]) where += ' and status in ({}) '.format(status) if other: where += ' and id not in ({}) '.format(other) sql = """ select * from t_chart_reports where name="{}" {}; """.format(name, where) try: result = _metric_meta_db.query(sql) if result: result = result[0] except Exception, e: from traceback import print_exc print_exc() return result '''get chart from table by ids''' def get_data_by_ids(sids): result = [] sids = [str(x) for x in sids] sql = """ select * from t_chart_reports where id in ({}); """.format(",".join(sids)) try: result = _metric_meta_db.query(sql) except Exception, e: from traceback import print_exc print_exc() return result '''get the data from table by id''' def get_data_by_id(sid): result = [] sql = """ select * from t_chart_reports where id={} and status=1; """.format(int(sid)) try: result = _metric_meta_db.query(sql) if result: result = result[0] except Exception, e: from traceback import print_exc print_exc() return result '''save data to chart table''' def save(form): hid = _metric_meta_db.insert('t_chart_reports', **form) return hid '''update chart table's data by id ''' def update(form): _metric_meta_db.update('t_chart_reports', where="id={}".format(form['id']), **form) return form['id'] '''get highchart_edit json''' def get_chart(chart, data): result = {} if chart and data: if chart.get('series', False): first = data[0] data = get_column_combine(data) lens = len(first) series = chart['series'] tmp_series = [] if series: now_key = -1 for key, item in enumerate(series): if key < lens - 1: now_key = key item['name'] = first[key + 1] item['data'] = data[key] tmp_series.append(item) else: break template_series = series[-1] for key, item in enumerate(first): if key == 0: continue elif now_key < key - 1: tmp = dict(template_series) tmp['name'] = item tmp['data'] = data[key - 1] tmp['_colorIndex'] = key - 1 tmp['_symbolIndex'] = key - 1 tmp_series.append(tmp) else: tmp_series = series chart['series'] = tmp_series result = chart return result '''parse new data to highchart_edit json data''' def get_column_combine(data): result = [] if data: lens = len(data[0]) if lens > 0: result = [[] for i in xrange(lens)] for key, item in enumerate(data): if key > 0: for k, it in enumerate(item): if k > 0: if it == '': result[k - 1].append([item[0], None]) else: if type(it) == str or type(it) == unicode: try: if r"." in it: if r"," in it: tmp = it.replace(",", "") it = float(tmp) else: it = float(it) elif r"," in it: tmp = it.replace(",", "") it = int(tmp) else: it = int(it) except Exception, e: from traceback import print_exc print_exc() result[k - 1].append([item[0], it]) return result '''get the chart list''' def get_chart_list(sid="", name="", fields=[], iscount=False, current=1, rowCount=20): where = [] limit = '' if sid: if type(sid) != list: sid = [sid] where.append("""and id in ({})""".format(",".join(map(str, sid)))) if name: where.append("""and name like "%{}%" """.format(name)) if rowCount: stc = (int(current) - 1) * int(rowCount) if not stc: stc = 0 limit = "limit {},{}".format(int(current) - 1, rowCount) content = "*" orders = "order by id desc" if iscount: limit = "" content = "count(*) as c" orders = "" elif fields: content = ",".join(fields) sql = """ select {} from t_chart_reports where status=1 {} {} {}; """.format(content, " ".join(where), orders, limit) result = _metric_meta_db.query(sql) if iscount: if result: return result[0]['c'] else: return 0 else: if result: return result else: return []
popoyz/charts
base/chart_b.py
Python
lgpl-3.0
5,726
package ben.ui.renderer; import ben.ui.math.PmvMatrix; import ben.ui.math.Rect; import ben.ui.resource.GlResourceManager; import ben.ui.resource.color.Color; import ben.ui.resource.shader.FlatProgram; import javax.annotation.Nonnull; import com.jogamp.opengl.GL2; /** * Flat Rectangle Renderer. * <p> * Renders a 2D rectangle with a solid colour. * </p> */ public final class FlatRenderer { /** * The number of vertices in a rectangle. */ private static final int NUMBER_OF_VERTICES = 4; /** * The shader program. */ private final FlatProgram program; /** * The VAO. */ @Nonnull private final VertexArrayObject vertexArrayObject; /** * The colour. */ private Color color; /** * The position buffer of the vertices. */ private final int positionsBuffer; /** * Constructor. * @param gl the OpenGL interface * @param glResourceManager the resource manager * @param rect the position and size of the rectangle * @param color the colour of the rectangle */ public FlatRenderer(@Nonnull GL2 gl, @Nonnull GlResourceManager glResourceManager, @Nonnull Rect rect, @Nonnull Color color) { program = glResourceManager.getShaderManager().getProgram(FlatProgram.class); vertexArrayObject = new VertexArrayObject(gl); this.color = color; float[] positions = createPositions(rect); positionsBuffer = vertexArrayObject.addBuffer(gl, FlatProgram.POSITION_LOCATION, positions, 2); } /** * Draw the rectangle. * @param gl the OpenGL interface * @param pmvMatrix the PMV matrix */ public void draw(@Nonnull GL2 gl, @Nonnull PmvMatrix pmvMatrix) { program.use(gl); program.setPmvMatrix(gl, pmvMatrix); program.setColor(gl, color); vertexArrayObject.draw(gl, GL2.GL_TRIANGLE_FAN, NUMBER_OF_VERTICES); } /** * Set the colour of the rectangle. * @param color the new colour */ public void setColor(@Nonnull Color color) { this.color = color; } /** * Set the position and size of the rectangle. * @param gl the OpenGL interface * @param rect the rectangle */ public void setRect(@Nonnull GL2 gl, @Nonnull Rect rect) { float[] positions = createPositions(rect); vertexArrayObject.updateBuffer(gl, positionsBuffer, positions); } /** * Create the positions array of the verticies for the rectangle. * @param rect the position and size of the rectangle * @return the positions */ @Nonnull private float[] createPositions(@Nonnull Rect rect) { return new float[] {rect.getX(), rect.getY(), rect.getX() + rect.getWidth(), rect.getY(), rect.getX() + rect.getWidth(), rect.getY() + rect.getHeight(), rect.getX(), rect.getY() + rect.getHeight()}; } /** * Remove the renderers VAO. * @param gl the OpenGL interface */ public void remove(@Nonnull GL2 gl) { vertexArrayObject.remove(gl); } }
bensmith87/ui
src/main/java/ben/ui/renderer/FlatRenderer.java
Java
lgpl-3.0
3,128
-------------------------------------------------------------------------------- -- This file is part of the Lua HUD for TASing Sega Genesis Sonic games. -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU Lesser General Public License as -- published by the Free Software Foundation, either version 3 of the -- License, or (at your option) any later version. -- -- 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 Lesser General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Global, character independent, game data. -- Written by: Marzo Junior -- Based on game disassemblies and Gens' RAM search. -------------------------------------------------------------------------------- require("sonic/common/rom-check") require("sonic/common/enums") game = { curr_char = nil, shields = nil, } local curr_data = rom.data if rom:is_scheroes() or rom:is_sonic_cd() then -- Timer with centiseconds function game:get_time() return string.format(" %2d'%02d''%02d", memory.readbyte(curr_data.Timer_minute), memory.readbyte(curr_data.Timer_second), math.floor(memory.readbyte(curr_data.Timer_frame) * 10/6)) end else -- Timer with frames function game:get_time() return string.format(" %2d:%02d::%02d", memory.readbyte(curr_data.Timer_minute), memory.readbyte(curr_data.Timer_second), memory.readbyte(curr_data.Timer_frame)) end end if curr_data.Timer_frames == nil then function game:get_level_frames() return 0 -- Not used. end else function game:get_level_frames() return memory.readbyte(curr_data.Timer_frames+1) end end function game:get_lives() return string.format("x%2d", memory.readbyte(curr_data.Life_count)) end if curr_data.Continue_count ~= nil then function game:get_continues() return string.format("x%2d", memory.readbyte(curr_data.Continue_count)) end end function game:get_score() return string.format("%11d", 10 * memory.readlong(curr_data.Score)) end function game:get_raw_rings() return memory.readword(rom.ring_offset) end if curr_data.Perfect_rings_left == nil then function game:get_rings() return string.format("%3d", self:get_raw_rings()) end else function game:get_rings() return string.format("%3d (%d)", self:get_raw_rings(), memory.readwordsigned(curr_data.Perfect_rings_left)) end end function game:has_super_emeralds() return curr_data.S2_Emerald_count ~= nil end -- Only gets called for S3K or SCH: function game:get_super_emeralds() return string.format("%2d", memory.readbyte(curr_data.S2_Emerald_count)) end -- normal = 0; becoming super = 1; reverting to normal = 2; transformed = -1 if curr_data.Turning_Super_flag == nil then function game:super_status() return 0 end else function game:super_status() return memory.readbytesigned(curr_data.Turning_Super_flag) end end -- Super Sonic/Knuckles = 1, Hyper Sonic/Knuckles = -1, all others 0 if curr_data.Super_Sonic_flag == nil then function game:hyper_form() return false end else function game:hyper_form() return memory.readbytesigned(curr_data.Super_Sonic_flag) == -1 end end if rom.scroll_delay ~= nil then if rom:is_scheroes() then -- Indirect value in SCH function game:scroll_delay() local delayaddr = 0xff0000 + memory.readword(rom.scroll_delay) return memory.readword(delayaddr) end else function game:scroll_delay() return memory.readbyte(rom.scroll_delay) end end else function game:scroll_delay() return 0 end end function game:super_active() return self:super_status() == -1 end function game:scroll_delay_timer() return string.format("%5d", self.scroll_delay()) end function game:scroll_delay_active() return self:scroll_delay() ~= 0 end if curr_data.Super_Sonic_frame_count ~= nil then function game:super_timer() return string.format("%5d", 61 * game:get_raw_rings() + memory.readword(curr_data.Super_Sonic_frame_count) - 60) end else function game:super_timer() return string.format("%5d", 0) end end if rom:is_sonic_cd() then -- This is an ugly hack. local function showing_hud() return AND(memory.readword(curr_data.HUD_ScoreTime + curr_data.art_tile), 0x7ff) ~= 0x568 or AND(memory.readword(curr_data.HUD_Lives + curr_data.art_tile), 0x7ff) ~= 0x568 or AND(memory.readword(curr_data.HUD_Rings + curr_data.art_tile), 0x7ff) ~= 0x568 end function game:disable_hud() -- RAM byte 0xff1522 indicates if Sonic is actually travelling in time; -- this is the time travel cutscene proper. if memory.readbyte(curr_data.ResetLevel_Flags) == 2 or showing_hud() then return true end return false end elseif curr_data.Ending_running_flag ~= nil then local boringmodes = {0, 4, 0x28, 0x34, 0x48, 0x4c, 0x8c} function game:disable_hud() local mode = memory.readbyte(curr_data.Game_Mode) for _, m in ipairs(boringmodes) do if mode == m then return true end end -- Endgame. return memory.readbytesigned(curr_data.Ending_running_flag) == -1 end else local boringmodes = nil local level_loading = 0x80 + curr_data.GameModeID_Level if rom:is_scheroes() then boringmodes = { curr_data.GameModeID_SegaScreen, curr_data.GameModeID_TitleScreen, curr_data.GameModeID_SpecialStage, curr_data.GameModeID_EndingSequence, curr_data.GameModeID_OptionsScreen, curr_data.GameModeID_S1_Ending, } elseif rom:is_keh() then boringmodes = {0, 1, 2, 5, 6, 7, 8, 9, 10} elseif rom:is_sonic2() then boringmodes = {0, 4, 0x10, 0x14, 0x18, 0x1c, 0x20, 0x24, 0x28} else boringmodes = {0, 4, 0x14, 0x18, 0x1c} end function game:disable_hud() local mode = memory.readbyte(curr_data.Game_Mode) for _, m in ipairs(boringmodes) do if mode == m then return true end end if mode == level_loading then local time = memory.readlong(curr_data.Timer) return not (time > 0 and time < 5) end return false end end function game:get_zone() return memory.readbyte(curr_data.Apparent_Zone) end if curr_data.Apparent_Act == nil then function game:get_act() return 0 end function game:get_level() return game:get_zone() end else function game:get_act() return memory.readbyte(curr_data.Apparent_Act) end function game:get_level() return memory.readword(curr_data.Apparent_Zone) end end function game:get_char() return rom.get_char() end function game:get_mode() return memory.readbyte(curr_data.Game_Mode) end function game:in_score_tally() return memory.readbyte(curr_data.Game_Mode) == curr_data.GameModeID_Level and memory.readlong(curr_data.Bonus_Countdown_1) ~= 0 end if curr_data.S1_Emerald_count == nil then function game:get_chaos_emeralds() return 0 end elseif rom:is_sonic_cd() then -- Emeralds are stored as a bit mask in SCD. local emerald_mask = {} -- This is probably overkill: for i = 0, 255, 1 do local count = 0 local n = i while n ~= 0 do count = count + (n % 2) n = math.floor(n / 2) end emerald_mask[i] = count end function game:get_chaos_emeralds() return string.format("%3d", emerald_mask[memory.readbyte(curr_data.S1_Emerald_count)]) end else function game:get_chaos_emeralds() return string.format("%3d", memory.readbyte(curr_data.S1_Emerald_count)) end end if curr_data.TimeWarp_Direction == nil then function game:get_timewarp_icon() return nil end else function game:get_timewarp_icon() local val = memory.readbytesigned(curr_data.TimeWarp_Direction) if val == -1 then return "warp-past" elseif val == 1 then return "warp-future" end return "blank" end end if curr_data.TimeWarp_Counter == nil then function game:warp_time_left() return 0 end else function game:warp_time_left() -- Time until warp local val = 210 - memory.readword(curr_data.TimeWarp_Counter) return (val >= 0 and val) or 0 end end if curr_data.TimeWarp_Active == nil then function game:warp_active() -- If a warp has been initiated and return false end else function game:warp_active() -- If a warp has been initiated return memory.readbyte(curr_data.TimeWarp_Active) == 1 and game:warp_time_left() > 0 end end function game:warp_timer() return string.format("%5d", self:warp_time_left()) end function game:camera_pos() return memory.readword(curr_data.Camera_X_pos), memory.readword(curr_data.Camera_Y_pos) end function game:level_bounds() return memory.readword(curr_data.Camera_Min_X_pos), memory.readword(curr_data.Camera_Max_X_pos), memory.readword(curr_data.Camera_Min_Y_pos), memory.readword(curr_data.Camera_Max_Y_pos_now) end function game:min_camera_y() return memory.readword(curr_data.Camera_Min_Y_pos) end if rom:is_scheroes() then function game:extend_screen_bounds() return self:get_zone() == curr_data.sky_chase_zone end elseif rom:is_keh() or rom:is_sonic3() or rom:is_sonick() then function game:extend_screen_bounds() return false end else function game:extend_screen_bounds() return memory.readbyte(curr_data.Current_Boss_ID) == 0 end end if rom:is_scheroes() or rom:is_sonic_cd() then function game:bounds_deltas() return 0x10, 0x130, 0x38, 0xE0 end else function game:bounds_deltas() return 0x10, 0x128, 0x40, 0xE0 end end function game:get_camera() return string.format("%5d,%5d", game:camera_pos()) end function game:get_camera_rect() local l, r, t, b = game:level_bounds() local x, y = game:camera_pos() return l - x, r - x, t - y, b - y end function game:init() if rom:is_scheroes() then self.shields = {shieldids.flame_shield, shieldids.lightning_shield, shieldids.bubble_shield, shieldids.normal_shield} elseif rom:is_sonic3() or rom:is_sonick() then self.shields = {shieldids.flame_shield, shieldids.lightning_shield, shieldids.bubble_shield} else self.shields = {shieldids.normal_shield} end end game:init()
flamewing/sonic-gens-hud
sonic/common/game-info.lua
Lua
lgpl-3.0
10,216
/******************************************************************************* * Copyright (C) 2009-2020 Human Media Interaction, University of Twente, the Netherlands * * This file is part of the Articulated Social Agents Platform BML realizer (ASAPRealizer). * * ASAPRealizer is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License (LGPL) as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ASAPRealizer 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 Lesser General Public License * along with ASAPRealizer. If not, see http://www.gnu.org/licenses/. ******************************************************************************/ package asap.ipaacaadapters.loader; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import hmi.util.Clock; import hmi.xml.XMLTokenizer; import java.io.IOException; import org.junit.Test; import asap.realizerport.BMLFeedbackListener; import asap.realizerport.RealizerPort; /** * Unit tests for the IpaacaToBMLRealizerAdapterLoader * @author Herwin * */ public class IpaacaToBMLRealizerAdapterLoaderTest { private RealizerPort mockRealizerPort = mock(RealizerPort.class); private Clock mockSchedulingClock = mock(Clock.class); @Test public void testReadFromXML() throws IOException { String pipeLoaderStr = "<PipeLoader id=\"id1\" loader=\"x\"/>"; XMLTokenizer tok = new XMLTokenizer(pipeLoaderStr); tok.takeSTag("PipeLoader"); IpaacaToBMLRealizerAdapterLoader loader = new IpaacaToBMLRealizerAdapterLoader(); loader.readXML(tok, "id1", "vh1", "name", mockRealizerPort, mockSchedulingClock); verify(mockRealizerPort, times(1)).addListeners(any(BMLFeedbackListener[].class)); assertEquals(mockRealizerPort, loader.getAdaptedRealizerPort()); } }
ArticulatedSocialAgentsPlatform/AsapRealizer
BMLAdapters/AsapIpaacaRealizerAdapters/java/test/src/asap/ipaacaadapters/loader/IpaacaToBMLRealizerAdapterLoaderTest.java
Java
lgpl-3.0
2,312
package org.celstec.arlearn2.portal.client.author.ui.gi.extensionEditors; import org.celstec.arlearn2.gwtcommonlib.client.objects.GeneralItem; import org.celstec.arlearn2.gwtcommonlib.client.objects.MozillaOpenBadge; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.layout.VLayout; public class MozillaOpenBadgeExtensionEditor extends VLayout implements ExtensionEditor{ protected DynamicForm form; private GeneralItem generalItem; public void setGeneralItem(GeneralItem generalItem) { this.generalItem = generalItem; } public MozillaOpenBadgeExtensionEditor() { form = new DynamicForm(); final TextItem badgeUrlItem = new TextItem(MozillaOpenBadge.BADGE_URL, "badge url"); final TextItem imageLocalUrlItem = new TextItem(MozillaOpenBadge.IMAGE, "image local url"); form.setFields(badgeUrlItem, imageLocalUrlItem); form.setWidth100(); addMember(form); } public MozillaOpenBadgeExtensionEditor(GeneralItem gi) { this(); form.setValue(MozillaOpenBadge.BADGE_URL, gi.getValueAsString(MozillaOpenBadge.BADGE_URL)); form.setValue(MozillaOpenBadge.IMAGE, gi.getValueAsString(MozillaOpenBadge.IMAGE)); } @Override public void saveToBean(GeneralItem gi) { gi.setString(MozillaOpenBadge.BADGE_URL, form.getValueAsString(MozillaOpenBadge.BADGE_URL)); gi.setString(MozillaOpenBadge.IMAGE, form.getValueAsString(MozillaOpenBadge.IMAGE)); } @Override public boolean validate() { return true; } }
WELTEN/dojo-ibl
src/main/java/org/celstec/arlearn2/portal/client/author/ui/gi/extensionEditors/MozillaOpenBadgeExtensionEditor.java
Java
lgpl-3.0
1,547
#ifndef ROPE_H #define ROPE_H #include "BangMath/AABox.h" #include "Bang/Array.h" #include "Bang/AssetHandle.h" #include "Bang/BangDefines.h" #include "Bang/ComponentMacros.h" #include "Bang/LineRenderer.h" #include "Bang/MetaNode.h" #include "Bang/Particle.h" #include "Bang/String.h" namespace Bang { class Serializable; class Mesh; class ShaderProgram; class Rope : public LineRenderer { COMPONENT_WITHOUT_CLASS_ID(Rope) public: Rope(); virtual ~Rope() override; // Component void OnStart() override; void OnUpdate() override; // Renderer void Bind() override; void OnRender() override; virtual AABox GetAABBox() const override; void SetUniformsOnBind(ShaderProgram *sp) override; void Reset(); void SetDamping(float damping); void SetNumPoints(uint numPoints); void SetBounciness(float bounciness); void SetRopeLength(float ropeLength); void SetSpringsForce(float springsForce); void SetSpringsDamping(float springsDamping); void SetFixedPoint(uint i, bool fixed); void SetFixedPoints(const Array<bool> &pointsFixed); void SetPoints(const Array<Vector3> &points); void SetSeeDebugPoints(bool seeDebugPoints); bool IsPointFixed(uint i) const; float GetSpringsForce() const; float GetRopeLength() const; float GetBounciness() const; float GetDamping() const; uint GetNumPoints() const; bool GetSeeDebugPoints() const; float GetSpringsDamping() const; // Serializable virtual void CloneInto(Serializable *clone, bool cloneGUID) const override; // Serializable virtual void Reflect() override; private: Array<Vector3> m_points; Array<bool> m_fixedPoints; Particle::Parameters m_particleParams; float m_ropeLength = 1.0f; float m_springsForce = 1.0f; float m_springsDamping = 1.0f; Array<Particle::Data> m_particlesData; bool m_seeDebugPoints = false; AH<Mesh> m_ropeDebugPointsMesh; bool m_validLineRendererPoints = false; void InitParticle(uint i, const Particle::Parameters &params); const Particle::Parameters &GetParameters() const; float GetPartLength() const; void AddSpringForces(); void ConstrainPointsPositions(); void UpdateLineRendererPoints(); }; } #endif // ROPE_H
Bang3DEngine/Bang
include/Bang/Rope.h
C
lgpl-3.0
2,298
from rapidsms.tests.scripted import TestScript from apps.form.models import * from apps.reporters.models import * import apps.reporters.app as reporter_app import apps.supply.app as supply_app import apps.form.app as form_app import apps.default.app as default_app from app import App from django.core.management.commands.dumpdata import Command import time import random import os from datetime import datetime class TestApp (TestScript): #apps = (reporter_app.App, App,form_app.App, supply_app.App, default_app.App ) apps = (reporter_app.App, App,form_app.App, supply_app.App ) # the test_backend script does the loading of the dummy backend that allows reporters # to work properly in tests fixtures = ['nigeria_llin', 'test_kano_locations', 'test_backend'] def setUp(self): TestScript.setUp(self) def testFixtures(self): self._testKanoLocations() self._testForms() self._testRoles() def testScript(self): a = """ 8005551219 > llin register 20 dl crummy user 8005551219 < Hello crummy! You are now registered as Distribution point team leader at KANO State. """ self.runScript(a) # this should succeed because we just created him reporters = Reporter.objects.all() Reporter.objects.get(alias="cuser") dict = {"alias":"fail"} # make sure checking a non-existant user fails self.assertRaises(Reporter.DoesNotExist, Reporter.objects.get, **dict) testRegistration = """ 8005551212 > llin my status 8005551212 < Please register your phone with RapidSMS. 8005551212 > llin register 20 dl dummy user 8005551212 < Hello dummy! You are now registered as Distribution point team leader at KANO State. 8005551212 > llin my status 8005551212 < I think you are dummy user. #duplicate submission test_reg_dup > llin register 20 dl duplicate user test_reg_dup < Hello duplicate! You are now registered as Distribution point team leader at KANO State. # this one should be a duplicate test_reg_dup > llin register 20 dl duplicate user test_reg_dup < Hello again duplicate! You are already registered as a Distribution point team leader at KANO State. # but all of these should create a new registration test_reg_dup > llin register 20 dl duplicate user withanothername test_reg_dup < Hello duplicate! You are now registered as Distribution point team leader at KANO State. test_reg_dup > llin register 20 dl duplicate userlonger test_reg_dup < Hello duplicate! You are now registered as Distribution point team leader at KANO State. test_reg_dup > llin register 20 dl duplicated user test_reg_dup < Hello duplicated! You are now registered as Distribution point team leader at KANO State. test_reg_dup > llin register 20 sm duplicate user test_reg_dup < Hello duplicate! You are now registered as Stock manager at KANO State. test_reg_dup > llin register 2001 dl duplicate user test_reg_dup < Hello duplicate! You are now registered as Distribution point team leader at AJINGI LGA. # case sensitivity test_reg_2 > llin REGISTER 20 dl another user test_reg_2 < Hello another! You are now registered as Distribution point team leader at KANO State. # different name formats test_reg_3 > llin register 20 dl onename test_reg_3 < Hello onename! You are now registered as Distribution point team leader at KANO State. # these fail test_reg_4 > llin register 20 dl mister three names test_reg_4 < Hello mister! You are now registered as Distribution point team leader at KANO State. test_reg_5 > llin register 20 dl mister four name guy test_reg_5 < Hello mister! You are now registered as Distribution point team leader at KANO State. # some other spellings test_reg_short > llin regstr 20 dl short user test_reg_short < Hello short! You are now registered as Distribution point team leader at KANO State. test_reg_short_2 > llin regs 20 dl short user test_reg_short_2 < Hello short! You are now registered as Distribution point team leader at KANO State. test_reg_short_3 > llin reg 20 dl short user test_reg_short_3 < Hello short! You are now registered as Distribution point team leader at KANO State. test_reg_long > llin registered 20 dl long user test_reg_long < Hello long! You are now registered as Distribution point team leader at KANO State. # extra spaces test_reg_8 > llin register 20 dl space guy test_reg_8 < Hello space! You are now registered as Distribution point team leader at KANO State. # new tests for more flexible roles test_reg_dl > llin register 20 dl distribution leader test_reg_dl < Hello distribution! You are now registered as Distribution point team leader at KANO State. test_reg_dl_2 > llin register 20 ds distribution leader test_reg_dl_2 < Hello distribution! You are now registered as Distribution point team leader at KANO State. test_reg_dl_3 > llin register 20 dm distribution leader test_reg_dl_3 < Hello distribution! You are now registered as Distribution point team leader at KANO State. test_reg_dl_4 > llin register 20 dp distribution leader test_reg_dl_4 < Hello distribution! You are now registered as Distribution point team leader at KANO State. test_reg_lf > llin register 20 lf lga focal person test_reg_lf < Hello lga! You are now registered as LGA focal person at KANO State. test_reg_lf > llin register 20 lp lga focal person test_reg_lf < Hello again lga! You are already registered as a LGA focal person at KANO State. # alas, we're not perfect test_reg_fail > llin rgstr 20 dl sorry guy test_reg_fail < Sorry we didn't understand that. Available forms are LLIN: REGISTER, NETCARDS, NETS, RECEIVE, ISSUE """ testRegistrationErrors = """ 12345 > llin my status 12345 < Please register your phone with RapidSMS. 12345 > llin register 45 DL hello world 12345 < Invalid form. 45 not in list of location codes 12345 > llin my status 12345 < Please register your phone with RapidSMS. 12345 > llin register 20 pp hello world 12345 < Invalid form. Unknown role code: pp 12345 > llin my status 12345 < Please register your phone with RapidSMS. 12345 > llin register 6803 AL hello world 12345 < Invalid form. 6803 not in list of location codes. Unknown role code: AL 12345 > llin my status 12345 < Please register your phone with RapidSMS. """ testKeyword= """ tkw_1 > llin register 20 dl keyword tester tkw_1 < Hello keyword! You are now registered as Distribution point team leader at KANO State. # base case tkw_1 > llin nets 2001 123 456 78 90 tkw_1 < Thank you keyword. Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90 # capitalize the domain tkw_1 > LLIN nets 2001 123 456 78 90 tkw_1 < Thank you keyword. Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90 # drop an L tkw_1 > lin nets 2001 123 456 78 90 tkw_1 < Thank you keyword. Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90 # mix the order - this is no longer supported #tkw_1 > ILLn nets 2001 123 456 78 90 #tkw_1 < Thank you keyword. Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90 #tkw_1 > ilin nets 2001 123 456 78 90 #tkw_1 < Thank you keyword. Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90 # ll anything works? tkw_1 > ll nets 2001 123 456 78 90 tkw_1 < Thank you keyword. Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90 tkw_1 > llan nets 2001 123 456 78 90 tkw_1 < Thank you keyword. Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90 # don't support w/o keyword tkw_1 > nets 2001 123 456 78 90 # the default app to the rescue! tkw_1 < Sorry we didn't understand that. Available forms are LLIN: REGISTER, NETCARDS, NETS, RECEIVE, ISSUE """ testNets= """ 8005551213 > llin register 2001 lf net guy 8005551213 < Hello net! You are now registered as LGA focal person at AJINGI LGA. 8005551213 > llin nets 2001 123 456 78 90 8005551213 < Thank you net. Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90 8005551213 > llin nets 2001 123 456 78 8005551213 < Invalid form. The following fields are required: discrepancy # test some of the different form prefix options # case sensitivity 8005551213 > llin NETS 2001 123 456 78 90 8005551213 < Thank you net. Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90 # no s 8005551213 > llin net 2001 123 456 78 90 8005551213 < Thank you net. Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90 # really? this works? 8005551213 > llin Nt 2001 123 456 78 90 8005551213 < Thank you net. Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90 # something's gotta fail 8005551213 > llin n 2001 123 456 78 90 8005551213 < Sorry we didn't understand that. Available forms are LLIN: REGISTER, NETCARDS, NETS, RECEIVE, ISSUE 8005551213 > llin bednets 2001 123 456 78 90 8005551213 < Sorry we didn't understand that. Available forms are LLIN: REGISTER, NETCARDS, NETS, RECEIVE, ISSUE 8005551213 > llin ents 2001 123 456 78 90 8005551213 < Sorry we didn't understand that. Available forms are LLIN: REGISTER, NETCARDS, NETS, RECEIVE, ISSUE """ testNetCards= """ 8005551214 > llin register 200201 lf card guy 8005551214 < Hello card! You are now registered as LGA focal person at ALBASU CENTRAL Ward. 8005551214 > llin net cards 200201 123 456 78 8005551214 < Thank you card. Received report for LLIN NET CARDS: location=ALBASU CENTRAL, settlements=123, people=456, distributed=78 8005551214 > llin net cards 200201 123 456 8005551214 < Invalid form. The following fields are required: issued # test some of the different form prefix options # case sensitivity 8005551214 > llin NET CARDS 200201 123 456 78 8005551214 < Thank you card. Received report for LLIN NET CARDS: location=ALBASU CENTRAL, settlements=123, people=456, distributed=78 # no s 8005551214 > llin net card 200201 123 456 78 8005551214 < Thank you card. Received report for LLIN NET CARDS: location=ALBASU CENTRAL, settlements=123, people=456, distributed=78 # one word 8005551214 > llin netcards 200201 123 456 78 8005551214 < Thank you card. Received report for LLIN NET CARDS: location=ALBASU CENTRAL, settlements=123, people=456, distributed=78 8005551214 > llin netcard 200201 123 456 78 8005551214 < Thank you card. Received report for LLIN NET CARDS: location=ALBASU CENTRAL, settlements=123, people=456, distributed=78 # he he 8005551214 > llin nt cd 200201 123 456 78 8005551214 < Thank you card. Received report for LLIN NET CARDS: location=ALBASU CENTRAL, settlements=123, people=456, distributed=78 8005551214 > llin ntcrds 200201 123 456 78 8005551214 < Thank you card. Received report for LLIN NET CARDS: location=ALBASU CENTRAL, settlements=123, people=456, distributed=78 # something's gotta fail 8005551214 > llin cards 200201 123 456 78 8005551214 < Sorry we didn't understand that. Available forms are LLIN: REGISTER, NETCARDS, NETS, RECEIVE, ISSUE """ testUnregisteredSubmissions = """ tus_1 > llin net cards 200201 123 456 78 tus_1 < Received report for LLIN NET CARDS: location=ALBASU CENTRAL, settlements=123, people=456, distributed=78. Please register your phone tus_1 > llin my status tus_1 < Please register your phone with RapidSMS. tus_2 > llin nets 2001 123 456 78 90 tus_2 < Received report for LLIN NETS: location=AJINGI, distributed=123, expected=456, actual=78, discrepancy=90. Please register your phone tus_2 > llin my status tus_2 < Please register your phone with RapidSMS. """ def testGenerateNetFixtures(self): """ This isn't actually a test. It just takes advantage of the test harness to spam a bunch of messages to the nigeria app and spit out the data in a format that can be sucked into a fixture. It should be moved to some data generator at some point, but is being left here for laziness sake """ # this is the number of net reports that will be generated count = 0 # the sender will always be the same, for now phone = "55555" expected_actual_match_percent = .8 # allow specifying the minimum and maximum dates for message generation min_date = datetime(2009,4,1) max_date = datetime(2009,4,30) min_time = time.mktime(min_date.timetuple()) max_time = time.mktime(max_date.timetuple()) # these are the locations that will be chosen. The actual # location will be a distribution point under one of these # wards wards = [200101, 200102, 200103, 200104, 200105, 200106, 200107, 200108, 200109, 200110, 200201] all_net_strings = [] for i in range(count): # this first part generates a net form at a random DP date = datetime.fromtimestamp(random.randint(min_time, max_time)) ward = Location.objects.get(code=random.choice(wards)) dp = random.choice(ward.children.all()) distributed = random.randint(50,500) expected = random.randint(0,2000) # create an actual amount based on the likelihood of match if random.random() < expected_actual_match_percent: actual = expected else: actual = random.randint(0,2000) discrepancy = random.randint(0,distributed/5) net_string = "%s@%s > llin nets %s %s %s %s %s" % (phone, date.strftime("%Y%m%d%H%M"), dp.code, distributed, expected, actual, discrepancy) all_net_strings.append(net_string) # the second part generates a net card form at a random MT date = datetime.fromtimestamp(random.randint(min_time, max_time)) ward = Location.objects.get(code=random.choice(wards)) dp = random.choice(ward.children.all()) mt = random.choice(dp.children.all()) settlements = random.randint(3, 50) people = random.randint(50, 600) coupons = random.randint(50, 600) net_card_string = "%s@%s > llin net cards %s %s %s %s" % (phone, date.strftime("%Y%m%d%H%M"), mt.code, settlements, people, coupons ) all_net_strings.append(net_card_string) script = "\n".join(all_net_strings) self.runScript(script) dumpdata = Command() filename = os.path.abspath(os.path.join(os.path.dirname(__file__),"fixtures/test_net_data.json")) options = { "indent" : 2 } datadump = dumpdata.handle("bednets", **options) # uncomment these lines to save the fixture # file = open(filename, "w") # file.write(datadump) # file.close() # print "=== Successfully wrote fixtures to %s ===" % filename # def _testKanoLocations(self): #TODO test for DPs and MTs loc_types = LocationType.objects.all() self.assertEqual(6, len(loc_types)) state = LocationType.objects.get(name="State") lga = LocationType.objects.get(name="LGA") ward = LocationType.objects.get(name="Ward") locations = Location.objects.all() # 1 state self.assertEqual(1, len(locations.filter(type=state))) # 44 lgas self.assertEqual(44, len(locations.filter(type=lga))) # 484 wards self.assertEqual(484, len(locations.filter(type=ward))) kano = locations.get(type=state) self.assertEqual("KANO", kano.name) self.assertEqual(44, len(kano.children.all())) for lga in locations.filter(type=lga): self.assertEqual(kano, lga.parent) def _testForms(self): forms = Form.objects.all() self.assertEqual(5, len(forms)) for form_name in ["register", "issue", "receive", "nets", "netcards"]: # this will throw an error if it doesn't exist Form.objects.get(code__abbreviation=form_name) def _testRoles(self): # add this when we have a fixture for roles roles = Role.objects.all() self.assertEqual(4, len(roles)) for role_name in ["LGA focal person", "Ward supervisor", "Stock manager", "Distribution point team leader"]: # this will throw an error if it doesn't exist Role.objects.get(name=role_name)
takinbo/rapidsms-borno
apps/bednets/tests.py
Python
lgpl-3.0
18,579
package com.sirma.itt.seip.template.observers; import static com.sirma.itt.seip.domain.ObjectTypes.TEMPLATE; import static com.sirma.itt.seip.template.TemplateProperties.FOR_OBJECT_TYPE; import static com.sirma.itt.seip.template.TemplateProperties.IS_PRIMARY_TEMPLATE; import static com.sirma.itt.seip.template.TemplateProperties.TEMPLATE_PURPOSE; import java.lang.invoke.MethodHandles; import java.util.Optional; import javax.enterprise.event.Observes; import javax.inject.Inject; import javax.inject.Singleton; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.sirma.itt.seip.domain.instance.Instance; import com.sirma.itt.seip.instance.event.BeforeInstancePersistEvent; import com.sirma.itt.seip.template.Template; import com.sirma.itt.seip.template.db.TemplateDao; /** * Observes template instances creation and auto-sets the appropriate primary flag to them, if needed. * * @author Vilizar Tsonev */ @Singleton public class TemplateCreateObserver { @Inject private TemplateDao templateDao; private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); /** * Observes the {@link BeforeInstancePersistEvent} and if there is no existing primary template for the type and * purpose of the new template, forcibly sets it to be primary. * * @param event * is the {@link BeforeInstancePersistEvent} */ public <I extends Instance> void onBeforeTemplateCreated(@Observes BeforeInstancePersistEvent<I, ?> event) { I newTemplateinstance = event.getInstance(); if (newTemplateinstance.type().is(TEMPLATE)) { String forType = newTemplateinstance.getAsString(FOR_OBJECT_TYPE); String templatePurpose = newTemplateinstance.getAsString(TEMPLATE_PURPOSE); Optional<Template> existingPrimaryTemplate = templateDao.findExistingPrimaryTemplate(forType, templatePurpose, null, null); if (!existingPrimaryTemplate.isPresent() && !newTemplateinstance.getBoolean(IS_PRIMARY_TEMPLATE)) { LOGGER.debug( "There is not yet primary template for type {} and purpose {} . Newly created [{}] will be forcibly set as primary", newTemplateinstance.getAsString(FOR_OBJECT_TYPE), newTemplateinstance.getAsString(TEMPLATE_PURPOSE), newTemplateinstance.getId()); newTemplateinstance.add(IS_PRIMARY_TEMPLATE, Boolean.TRUE); } } } }
SirmaITT/conservation-space-1.7.0
docker/sirma-platform/platform/seip-parent/platform/domain-model/instance-templates-impl/src/main/java/com/sirma/itt/seip/template/observers/TemplateCreateObserver.java
Java
lgpl-3.0
2,352
package com.chenyg.wporter.a.app; import java.util.ArrayList; import java.util.Set; import com.chenyg.wporter.Config; import com.chenyg.wporter.InitException; import com.chenyg.wporter.WPMain; import com.chenyg.wporter.WPRequest; import com.chenyg.wporter.WPorterType; import com.chenyg.wporter.WebPorter; import com.chenyg.wporter.base.RequestMethod; public class AppPorterMain { private WPMain wpMain; private boolean started; private AppPorterSender appPorterSender; public AppPorterMain(String contextPath) { initSender(); wpMain = new WPMain(getClass().getName(), WPorterType.APP, contextPath); } public WPMain getWpMain() { return wpMain; } private void initSender() { appPorterSender = new AppPorterSender() { @Override public void send(AppCommunication communication, AppPorterListener listener) throws AppPorterException { WPRequest request = getRequest(communication); RequestMethod method = communication.getReqMethod(); if (method == null) { throw new AppPorterException("the request method is null"); } AppResponse response = getResponse(); try { wpMain.doRequest(request, response, method); if (listener != null) { listener.onResponse(response.getAppReciever()); } } catch (Exception e) { if (listener != null) { AppReciever appReciever = response.getAppReciever(); appReciever.list = new ArrayList<Object>(); appReciever.list.add(e); appReciever.errorCode = -1; appReciever.statusCode = -1; listener.onResponse(appReciever); } else { e.printStackTrace(); } } } private AppResponse getResponse() { AppResponse response = null; response = new AppResponse(); return response; } private WPRequest getRequest(AppCommunication communication) { AppRequest request = null; request = new AppRequest(communication, AppPorterMain.this); return request; } }; } public AppPorterSender getAppPorterSender() { return appPorterSender; } // public String getContextPath() // { // return contextPath; // } /** * @param config * @param set * @param isSys * @param classLoader * @throws InitException */ public void start(Config config, Set<WebPorter> set, boolean isSys, ClassLoader classLoader) throws InitException { if (!started) { wpMain.setClassLoader(classLoader); wpMain.init(new AppParamDealt(), StateListenerImpl.addSelf(config), set, isSys, null); started = true; } } /** * 是否已经开始运行。 * * @return */ public boolean isStarted() { return started; } public void stop() { if (started) { wpMain.destroy(); started = false; } } }
CLovinr/WebPorter
maven/WebPorter/src/main/java/com/chenyg/wporter/a/app/AppPorterMain.java
Java
lgpl-3.0
3,604
#include "Color.hpp" #include <boost/python.hpp> #include <avango/python/register_field.h> #include <avango/gua/Fields.hpp> #include <avango/gua/Types.hpp> using namespace boost::python; using namespace av::python; namespace boost { namespace python { template <class T> struct pointee<av::Link<T>> { using type = T; }; } // namespace python } // namespace boost float getR(::gua::utils::Color3f* self) { return self->r(); } float getG(::gua::utils::Color3f* self) { return self->g(); } float getB(::gua::utils::Color3f* self) { return self->b(); } void setR(::gua::utils::Color3f* self, float value) { self->r(value); } void setG(::gua::utils::Color3f* self, float value) { self->g(value); } void setB(::gua::utils::Color3f* self, float value) { self->b(value); } void init_Color() { // wrapping gua::math::vec3 functionality class_<::gua::utils::Color3f>("Color") .def(init<float, float, float>()) .def(init<::gua::utils::Color3f>()) .add_property("r", &getR, &setR) .add_property("g", &getG, &setG) .add_property("b", &getB, &setB); // register as a field register_field<av::gua::SFColor>("SFColor"); // register_multifield<av::gua::MFColor>("MFColor"); }
vrsys/avango
avango-gua/python/avango/gua/utils/Color.cpp
C++
lgpl-3.0
1,233
{include="header"} <style type="text/css"> .tachada{ text-decoration:line-through; } </style> <script type="text/javascript"> function fs_marcar_todo() { $('input:checkbox').prop('checked', true); } function fs_marcar_nada() { $('input:checkbox').prop('checked', false); } function buscar_lineas() { if(document.f_buscar_lineas.buscar_lineas.value == '') { $('#search_results').html(''); } else { $.ajax({ type: 'POST', url: '{$fsc->url()}', dataType: 'html', data: $('form[name=f_buscar_lineas]').serialize(), success: function(datos) { var re = /<!--(.*?)-->/g; var m = re.exec( datos ); if( m[1] == document.f_buscar_lineas.buscar_lineas.value ) { $('#search_results').html(datos); } } }); } } function clean_cliente() { document.f_custom_search.ac_cliente.value=''; document.f_custom_search.codcliente.value=''; document.f_custom_search.ac_cliente.focus(); } $(document).ready(function() { bootbox.setLocale('es'); {if="$fsc->mostrar=='buscar'"} document.f_custom_search.query.focus(); {/if} $('#b_buscar_lineas').click(function(event) { event.preventDefault(); $('#modal_buscar_lineas').modal('show'); document.f_buscar_lineas.buscar_lineas.focus(); }); $('#f_buscar_lineas').keyup(function() { buscar_lineas(); }); $('#f_buscar_lineas').submit(function(event) { event.preventDefault(); buscar_lineas(); }); $("#ac_cliente").autocomplete({ serviceUrl: '{$fsc->url()}', paramName: 'buscar_cliente', onSelect: function (suggestion) { if(suggestion) { if(document.f_custom_search.codcliente.value != suggestion.data && suggestion.data != '') { document.f_custom_search.codcliente.value = suggestion.data; document.f_custom_search.submit(); } } } }); $('#b_imprimir_pdf').click(function(event) { event.preventDefault(); var checkboxValues = []; var seguir = true; $('input[name=imprimir]:checked').map(function() { checkboxValues.push($(this).val()); }); if(checkboxValues.length === 0){ seguir = false; bootbox.alert('Debe elegir una factura como minimo para Imprimir'); } if(seguir){ $('#modal_impresion_facturas').modal('show'); $("#imprimir_facturas").detach(); $("<iframe id='imprimir_facturas' />") .attr('src', 'index.php?page=factura_ncf&solicitud=imprimir&id='+checkboxValues) .attr('width', '100%') .attr('height', '500') .appendTo('#modal_body_impresion_facturas'); } }); $('#b_imprimir_txt').click(function(event) { event.preventDefault(); //var newWin = window.open(); $.ajax({ type: 'POST', url: '{$fsc->url()}', dataType: 'text', data: { 'imprimir': 'txt' }, success: function(datos) { var archivo = JSON.parse(datos); if(archivo.file !== '') { $("<iframe name='imprimir_facturas' id='imprimir_facturas' style='display: none;'/>") .attr('src', archivo.file) .attr('width', '100%') .attr('height', '1') .appendTo('#modal_body_impresion_facturas'); } window.frames["imprimir_facturas"].focus(); window.frames["imprimir_facturas"].print(); //window.open(archivo.file); //window.close(); //window.focus(); //window.print(); //window.close(); } }); /* var checkboxValues = []; var seguir = true; $('input[name=imprimir]:checked').map(function() { checkboxValues.push($(this).val()); }); if(checkboxValues.length === 0){ seguir = false; bootbox.alert('Debe elegir una factura como minimo para Imprimir'); } if(seguir){ $('#modal_impresion_facturas').modal('show'); $("#imprimir_facturas").detach(); $("<iframe id='imprimir_facturas' />") .attr('src', 'index.php?page=factura_ncf&solicitud=imprimir&id='+checkboxValues) .attr('width', '100%') .attr('height', '500') .appendTo('#modal_body_impresion_facturas'); } */ }); }); </script> <div class="container-fluid" style="margin-top: 10px; margin-bottom: 10px;"> <div class="row"> <div class="col-sm-8 col-xs-6"> <div class="btn-group hidden-xs"> <a class="btn btn-sm btn-default" href="{$fsc->url()}" title="Recargar la página"> <span class="glyphicon glyphicon-refresh"></span> </a> {if="$fsc->page->is_default()"} <a class="btn btn-sm btn-default active" href="{$fsc->url()}&amp;default_page=FALSE" title="desmarcar como página de inicio"> <span class="glyphicon glyphicon-home"></span> </a> {else} <a class="btn btn-sm btn-default" href="{$fsc->url()}&amp;default_page=TRUE" title="marcar como página de inicio"> <span class="glyphicon glyphicon-home"></span> </a> {/if} </div> <div class="btn-group"> <div class="btn-group"> <div class="dropdown"> <button id="dLabel" class="btn btn-sm btn-success" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="fa fa-print"></span>&nbsp;Imprimir <span class="caret"></span> </button> <ul class="dropdown-menu" aria-labelledby="dLabel"> <li class="dropdown"> <a id="b_imprimir_pdf" class="dropdown-toggle" role="button"> <span class="fa fa-print"></span>&nbsp;Impresión Gráfica </a> </li> <li class="dropdown"> <a id="b_imprimir_txt" class="dropdown-toggle hidden" role="button"> <span class="fa fa-print"></span>&nbsp;Impresión Matricial </a> </li> </ul> </div> </div> {loop="$fsc->extensions"} {if="$value->type=='button'"} <a href="index.php?page={$value->from}{$value->params}" class="btn btn-sm btn-default">{$value->text}</a> {/if} {/loop} </div> </div> <div class="col-sm-4 col-xs-6 text-right"> <a id="b_buscar_lineas" class="btn btn-sm btn-info" title="Buscar en las líneas"> <span class="glyphicon glyphicon-search"></span> &nbsp; Líneas </a> <div class="btn-group"> <button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-sort-by-attributes-alt" aria-hidden="true"></span> </button> <ul class="dropdown-menu dropdown-menu-right"> <li> <a href="{$fsc->url()}&mostrar={$fsc->mostrar}&order=fecha_desc"> <span class="glyphicon glyphicon-sort-by-attributes-alt" aria-hidden="true"></span> &nbsp; Fecha &nbsp; {if="$fsc->order=='fecha DESC'"}<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>{/if} </a> </li> <li> <a href="{$fsc->url()}&mostrar={$fsc->mostrar}&order=fecha_asc"> <span class="glyphicon glyphicon-sort-by-attributes" aria-hidden="true"></span> &nbsp; Fecha &nbsp; {if="$fsc->order=='fecha ASC'"}<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>{/if} </a> </li> <li> <a href="{$fsc->url()}&mostrar={$fsc->mostrar}&order=vencimiento_desc"> <span class="glyphicon glyphicon-sort-by-attributes-alt" aria-hidden="true"></span> &nbsp; Vencimiento &nbsp; {if="$fsc->order=='vencimiento DESC'"}<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>{/if} </a> </li> <li> <a href="{$fsc->url()}&mostrar={$fsc->mostrar}&order=vencimiento_asc"> <span class="glyphicon glyphicon-sort-by-attributes" aria-hidden="true"></span> &nbsp; Vencimiento &nbsp; {if="$fsc->order=='vencimiento ASC'"}<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>{/if} </a> </li> </ul> </div> </div> </div> </div> <ul class="nav nav-tabs" role="tablist"> <li{if="$fsc->mostrar=='todo'"} class="active"{/if}> <a href="{$fsc->url()}&mostrar=todo"> Todas las {#FS_FACTURAS#} </a> </li> <li{if="$fsc->mostrar=='buscar'"} class="active"{/if}> <a href="{$fsc->url()}&mostrar=buscar" title="Buscar"> <span class="glyphicon glyphicon-search"></span> {if="$fsc->num_resultados!==''"} <span class="hidden-xs badge">{$fsc->num_resultados}</span> {/if} </a> </li> </ul> {if="$fsc->mostrar=='buscar'"} <br/> <form name="f_custom_search" action="{$fsc->url()}" method="post" class="form"> {if="$fsc->cliente"} <input type="hidden" name="codcliente" value="{$fsc->cliente->codcliente}"/> {else} <input type="hidden" name="codcliente"/> {/if} <div class="container-fluid"> <div class="row"> <div class="col-sm-2"> <div class="form-group"> <div class="input-group"> <input class="form-control" type="text" name="query" value="{$fsc->query}" autocomplete="off" placeholder="Buscar"> <span class="input-group-btn"> <button class="btn btn-primary hidden-sm" type="submit"> <span class="glyphicon glyphicon-search"></span> </button> </span> </div> </div> </div> <div class="col-sm-2"> <div class="form-group"> <select class="form-control" name="codserie" onchange="this.form.submit()"> <option value="">Cualquier serie</option> <option value="">-----</option> {loop="$fsc->serie->all()"} {if="$value->codserie==$fsc->codserie"} <option value="{$value->codserie}" selected="">{$value->descripcion}</option> {else} <option value="{$value->codserie}">{$value->descripcion}</option> {/if} {/loop} </select> </div> </div> <div class="col-sm-2"> <div class="form-group"> <select name="codagente" class="form-control" onchange="this.form.submit()"> <option value="">Cualquier empleado</option> <option value="">------</option> {loop="$fsc->agente->all()"} {if="$value->codagente==$fsc->codagente"} <option value="{$value->codagente}" selected="">{$value->get_fullname()}</option> {else} <option value="{$value->codagente}">{$value->get_fullname()}</option> {/if} {/loop} </select> </div> </div> <div class="col-sm-2"> <div class="form-group"> <div class="input-group"> {if="$fsc->cliente"} <input class="form-control" type="text" name="ac_cliente" value="{$fsc->cliente->nombre}" id="ac_cliente" placeholder="Cualquier cliente" autocomplete="off"/> {else} <input class="form-control" type="text" name="ac_cliente" id="ac_cliente" placeholder="Cualquier cliente" autocomplete="off"/> {/if} <span class="input-group-btn"> <button class="btn btn-default" type="button" onclick="clean_cliente()"> <span class="glyphicon glyphicon-remove"></span> </button> </span> </div> </div> </div> <div class="col-sm-2"> <div class="form-group"> <input type="text" name="desde" value="{$fsc->desde}" class="form-control datepicker" placeholder="Desde" autocomplete="off" onchange="this.form.submit()"/> </div> </div> <div class="col-sm-2"> <div class="form-group"> <input type="text" name="hasta" value="{$fsc->hasta}" class="form-control datepicker" placeholder="Hasta" autocomplete="off" onchange="this.form.submit()"/> </div> </div> <div class="col-sm-2"> <div class="form-group"> <select name="codalmacen" class="form-control" onchange="this.form.submit()"> <option value="">Cualquier almacén</option> {loop="$fsc->almacenes->all()"} {if="$value->codalmacen==$fsc->codalmacen"} <option value="{$value->codalmacen}" selected="">{$value->nombre}</option> {else} <option value="{$value->codalmacen}">{$value->nombre}</option> {/if} {/loop} </select> </div> </div> <div class="col-sm-2"> <div class="form-group"> <select name="codruta" class="form-control" onchange="this.form.submit()"> <option value="">Cualquier ruta</option> {if="$fsc->codalmacen"} {loop="$fsc->rutas->all_rutasporalmacen($fsc->empresa->id,$fsc->codalmacen)"} <option value="{$value->ruta}" {if="$value->ruta==$fsc->codruta"}selected{/if}>{$value->ruta} - {$value->descripcion}</option> {/loop} {else} {loop="$fsc->rutas->all($fsc->empresa->id)"} <option value="{$value->ruta}" {if="$value->ruta==$fsc->codruta"}selected{/if}>{$value->ruta} - {$value->descripcion}</option> {/loop} {/if} </select> </div> </div> </div> <div class="row"> <div class='col-sm-8' style="margin-bottom: 10px;"> <label class="radio-inline"> <input type="radio" name="listar" value="todo" onclick="this.form.submit();" {if="$fsc->listar=='todo'"}checked{/if}> Todas </label> <label class="radio-inline"> <input type="radio" name="listar" value="facturas" onclick="this.form.submit();" {if="$fsc->listar=='facturas'"}checked{/if}> Facturas Válidas </label> <label class="radio-inline"> <input type="radio" name="listar" value="rectificativas" onclick="this.form.submit();" {if="$fsc->listar=='rectificativas'"}checked{/if}> {#FS_FACTURA_RECTIFICATIVA#} </label> <label class="radio-inline"> <input type="radio" name="listar" value="anuladas" onclick="this.form.submit();" {if="$fsc->listar=='anuladas'"}checked{/if}> Anuladas </label> </div> </div> </div> </form> {/if} <div class="table-responsive"> <table class="table table-hover"> <thead> <tr> <th colspan="2"> <div class="btn-group"> <button class="btn btn-sm btn-default" type="button" onclick="fs_marcar_todo()" title="Marcar todo"> <span class="glyphicon glyphicon-check"></span> </button> <button class="btn btn-sm btn-default" type="button" onclick="fs_marcar_nada()" title="Desmarcar todo"> <span class="glyphicon glyphicon-unchecked"></span> </button> </div> </th> <th></th> <th class="text-left">Código + {#FS_NUMERO2#}</th> <th class="text-left">Ruta</th> <th class="text-left">Cliente</th> <th class="text-left">Observaciones</th> <th class="text-right">Total</th> {if="$fsc->codagente!==''"} <th class="text-right">Comisión</th> <th class="text-left">%</th> {/if} <th class="text-right">Fecha</th> <th class="text-right">Vencimiento</th> </tr> </thead> {loop="$fsc->resultados"} <tr class="{if="$value->vencida()"} danger{elseif="$value->pagada"} success{elseif="$value->total<=0"} warning{/if} {if="$value->anulada"}tachada{/if}"> <td class="text-center"> {if="!$value->anulada"} <input type="checkbox" name="imprimir" value="{$value->idfactura}" class="check-mark"/> {/if} </td> <td class="text-center"> {if="$value->pagada"} <span class="glyphicon glyphicon-ok" title="La {#FS_FACTURA#} está pagada"></span> {/if} {if="$value->anulada"} <span class="glyphicon glyphicon-remove" title="La factura está anulada"></span> {/if} {if="$value->idfacturarect"} <span class="glyphicon glyphicon-flag" title="{#FS_FACTURA_RECTIFICATIVA#} de {$value->codigorect}"></span> {/if} {if="$value->femail"} <span class="glyphicon glyphicon-send" title="La factura fue enviada por email el {$value->femail}"></span> {/if} </td> <td class="text-center"> {if="$value->idasiento"} <span class="glyphicon glyphicon-paperclip" title="La {#FS_FACTURA#} tiene vinculado un asiento contable"></span> {/if} </td> <td> <a href="{$value->url()}">{$value->codigo}</a> {$value->numero2} {if="$value->totaliva==0"}<span class="label label-warning">Sin {#FS_IVA#}</span>{/if} {if="$value->totalrecargo!=0"}<span class="label label-default">RE</span>{/if} {if="$value->totalirpf!=0"}<span class="label label-default">{#FS_IRPF#}</span>{/if} </td> <td> {$value->codruta} </td> <td> {$value->nombrecliente} {if="$value->codcliente"} <a href="{$fsc->url()}&codcliente={$value->codcliente}" class="cancel_clickable" title="Ver más facturas de {$value->nombrecliente}">[+]</a> {else} <span class="label label-danger" title="Cliente desconocido">???</span> {/if} {if="!$value->cifnif"}<span class="label label-warning" title="Sin {#FS_CIFNIF#}"><s>{#FS_CIFNIF#}</s></span>{/if} </td> <td>{$value->observaciones_resume()}</td> <td class="text-right">{$fsc->show_precio($value->total, $value->coddivisa)}</td> {if="$fsc->codagente!==''"} <td class="text-right bg-info"> {$fsc->show_precio($value->neto*$value->porcomision/100, $value->coddivisa)} </td> <td class="text-left">{$fsc->show_numero($value->porcomision)}</td> {/if} <td class="text-right"> {if="$value->fecha==$fsc->today()"}<b>{$value->fecha}</b>{else}{$value->fecha}{/if} </td> <td class="text-right">{$value->vencimiento}</td> </tr> {else} <tr class="warning"> <td></td> <td></td> <td colspan="8">Ninguna {#FS_FACTURA#} encontrada.</td> {if="$fsc->codagente!==''"} <td></td> <td></td> {/if} </tr> {/loop} {if="$fsc->total_resultados!==''"} <tr> <td colspan="8" class="text-right"> {$fsc->total_resultados_txt} &nbsp; <b>{$fsc->show_precio($fsc->total_resultados)}</b> </td> {if="$fsc->codagente!==''"} <td class="text-right"><b>{$fsc->show_precio($fsc->total_resultados_comision)}</b></td> <td></td> {/if} <td colspan="2"></td> </tr> {/if} </table> </div> <div class="container-fluid"> <div class="row"> <div class="col-sm-12 text-center"> <ul class="pagination"> {loop="$fsc->paginas()"} <li{if="$value['actual']"} class="active"{/if}> <a href="{$value['url']}">{$value['num']}</a> </li> {/loop} </ul> </div> </div> </div> <form class="form" role="form" id="f_buscar_lineas" name="f_buscar_lineas" action ="{$fsc->url()}" method="post"> <div class="modal" id="modal_buscar_lineas"> <div class="modal-dialog" style="width: 99%; max-width: 950px;"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title">Buscar en las líneas</h4> {if="$fsc->cliente"} <p class="help-block"> Estas buscando en las líneas de las {#FS_FACTURAS#} de {$fsc->cliente->nombre}. </p> {else} <p class="help-block">Si quieres, puede <a href="{$fsc->url()}&mostrar=buscar">filtrar por cliente</a>.</p> {/if} </div> <div class="modal-body"> {if="$fsc->cliente"} <input type="hidden" name="codcliente" value="{$fsc->cliente->codcliente}"/> <div class="container-fluid"> <div class="row"> <div class="col-lg-6 col-md-6 col-sm-6"> <div class="input-group"> <input class="form-control" type="text" name="buscar_lineas" placeholder="Referencia" autocomplete="off"/> <span class="input-group-btn"> <button class="btn btn-primary" type="submit"> <span class="glyphicon glyphicon-search"></span> </button> </span> </div> </div> <div class="col-lg-6 col-md-6 col-sm-6"> <div class="form-group"> <input class="form-control" type="text" name="buscar_lineas_o" placeholder="Observaciones" autocomplete="off"/> </div> </div> </div> </div> {else} <div class="input-group"> <input class="form-control" type="text" name="buscar_lineas" placeholder="Referencia" autocomplete="off"/> <span class="input-group-btn"> <button class="btn btn-primary" type="submit"> <span class="glyphicon glyphicon-search"></span> </button> </span> </div> {/if} </div> <div id="search_results" class="table-responsive"></div> </div> </div> </div> </form> <div class="modal" id="modal_impresion_facturas"> <div class="modal-dialog" style="width: 99%; max-width: 950px;"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> </div> <div class="modal-body" id='modal_body_impresion_facturas'> </div> </div> </div> </div> {include="footer"}
joenilson/distribucion
view/imprimir_facturas.html
HTML
lgpl-3.0
26,425
/** * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team * http://www.mod-buildcraft.com * * BuildCraft is distributed under the terms of the Minecraft Mod Public * License 1.0, or MMPL. Please check the contents of the license located in * http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.core.render; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.util.ForgeDirection; /* * This interface designates a block as a state machine responsible for culling * For implementation details look into FakeBlock implementation */ public interface ICullable { //Side Rendering States //They are used to effectively cull obstructed sides while processing facades. //Make sure your implementation is correct otherwise expect FPS drop void setRenderSide(ForgeDirection side, boolean render); void setRenderAllSides(); boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side); void setRenderMask(int mask); }
hea3ven/BuildCraft
api/buildcraft/api/core/render/ICullable.java
Java
lgpl-3.0
1,009
/* * Tulip Indicators * https://tulipindicators.org/ * Copyright (c) 2010-2020 Tulip Charts LLC * Lewis Van Winkle (LV@tulipcharts.org) * * This file is part of Tulip Indicators. * * Tulip Indicators is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * Tulip Indicators 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 Tulip Indicators. If not, see <http://www.gnu.org/licenses/>. * */ /*VERSION*/ #include "indicators.h" const char* ti_version(void) {return TI_VERSION;} long int ti_build(void) {return TI_BUILD;} int ti_indicator_count(void) {return TI_INDICATOR_COUNT;} /*INDICATORS*/ struct ti_stream { int index; int progress; }; int ti_stream_run(ti_stream *stream, int size, TI_REAL const *const *inputs, TI_REAL *const *outputs) { return ti_indicators[stream->index].stream_run(stream, size, inputs, outputs); } ti_indicator_info *ti_stream_get_info(ti_stream *stream) { return ti_indicators + stream->index; } int ti_stream_get_progress(ti_stream *stream) { return stream->progress; } void ti_stream_free(ti_stream *stream) { ti_indicators[stream->index].stream_free(stream); } const ti_indicator_info *ti_find_indicator(const char *name) { int imin = 0; int imax = sizeof(ti_indicators) / sizeof(ti_indicator_info) - 2; /*Binary search.*/ while (imax >= imin) { const int i = (imin + ((imax-imin)/2)); const int c = strcmp(name, ti_indicators[i].name); if (c == 0) { return ti_indicators + i; } else if (c > 0) { imin = i + 1; } else { imax = i - 1; } } return 0; }
TulipCharts/tulipindicators
templates/indicators.c
C
lgpl-3.0
2,120
/******************************************************************************* * You may amend and distribute as you like, but don't remove this header! * * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets. * See https://github.com/JanKallman/EPPlus for details. * * Copyright (C) 2011 Jan Källman * * 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. * * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html * * All code and executables are provided "as is" with no warranty either express or implied. * The author accepts no liability for any damage or loss of business that this product may cause. * * Code change notes: * * Author Change Date * ****************************************************************************** * Jan Källman Initial Release 2009-10-01 * Jan Källman License changed GPL-->LGPL 2011-12-16 *******************************************************************************/ using System; using System.Collections.Generic; using System.Text; using System.Xml; using System.Globalization; using System.Text.RegularExpressions; namespace OfficeOpenXml.Style.XmlAccess { /// <summary> /// Xml access class for number formats /// </summary> public sealed class ExcelNumberFormatXml : StyleXmlHelper { internal ExcelNumberFormatXml(XmlNamespaceManager nameSpaceManager) : base(nameSpaceManager) { } internal ExcelNumberFormatXml(XmlNamespaceManager nameSpaceManager, bool buildIn): base(nameSpaceManager) { BuildIn = buildIn; } internal ExcelNumberFormatXml(XmlNamespaceManager nsm, XmlNode topNode) : base(nsm, topNode) { _numFmtId = GetXmlNodeInt("@numFmtId"); _format = GetXmlNodeString("@formatCode"); } public bool BuildIn { get; private set; } int _numFmtId; // const string idPath = "@numFmtId"; /// <summary> /// Id for number format /// /// Build in ID's /// /// 0 General /// 1 0 /// 2 0.00 /// 3 #,##0 /// 4 #,##0.00 /// 9 0% /// 10 0.00% /// 11 0.00E+00 /// 12 # ?/? /// 13 # ??/?? /// 14 mm-dd-yy /// 15 d-mmm-yy /// 16 d-mmm /// 17 mmm-yy /// 18 h:mm AM/PM /// 19 h:mm:ss AM/PM /// 20 h:mm /// 21 h:mm:ss /// 22 m/d/yy h:mm /// 37 #,##0 ;(#,##0) /// 38 #,##0 ;[Red](#,##0) /// 39 #,##0.00;(#,##0.00) /// 40 #,##0.00;[Red](#,##0.00) /// 45 mm:ss /// 46 [h]:mm:ss /// 47 mmss.0 /// 48 ##0.0E+0 /// 49 @ /// </summary> public int NumFmtId { get { return _numFmtId; } set { _numFmtId = value; } } internal override string Id { get { return _format; } } const string fmtPath = "@formatCode"; string _format = string.Empty; public string Format { get { return _format; } set { _numFmtId = ExcelNumberFormat.GetFromBuildIdFromFormat(value); _format = value; } } internal string GetNewID(int NumFmtId, string Format) { if (NumFmtId < 0) { NumFmtId = ExcelNumberFormat.GetFromBuildIdFromFormat(Format); } return NumFmtId.ToString(); } internal static void AddBuildIn(XmlNamespaceManager NameSpaceManager, ExcelStyleCollection<ExcelNumberFormatXml> NumberFormats) { NumberFormats.Add("General",new ExcelNumberFormatXml(NameSpaceManager,true){NumFmtId=0,Format="General"}); NumberFormats.Add("0", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 1, Format = "0" }); NumberFormats.Add("0.00", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 2, Format = "0.00" }); NumberFormats.Add("#,##0", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 3, Format = "#,##0" }); NumberFormats.Add("#,##0.00", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 4, Format = "#,##0.00" }); NumberFormats.Add("0%", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 9, Format = "0%" }); NumberFormats.Add("0.00%", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 10, Format = "0.00%" }); NumberFormats.Add("0.00E+00", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 11, Format = "0.00E+00" }); NumberFormats.Add("# ?/?", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 12, Format = "# ?/?" }); NumberFormats.Add("# ??/??", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 13, Format = "# ??/??" }); NumberFormats.Add("mm-dd-yy", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 14, Format = "mm-dd-yy" }); NumberFormats.Add("d-mmm-yy", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 15, Format = "d-mmm-yy" }); NumberFormats.Add("d-mmm", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 16, Format = "d-mmm" }); NumberFormats.Add("mmm-yy", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 17, Format = "mmm-yy" }); NumberFormats.Add("h:mm AM/PM", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 18, Format = "h:mm AM/PM" }); NumberFormats.Add("h:mm:ss AM/PM", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 19, Format = "h:mm:ss AM/PM" }); NumberFormats.Add("h:mm", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 20, Format = "h:mm" }); NumberFormats.Add("h:mm:ss", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 21, Format = "h:mm:ss" }); NumberFormats.Add("m/d/yy h:mm", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 22, Format = "m/d/yy h:mm" }); NumberFormats.Add("#,##0 ;(#,##0)", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 37, Format = "#,##0 ;(#,##0)" }); NumberFormats.Add("#,##0 ;[Red](#,##0)", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 38, Format = "#,##0 ;[Red](#,##0)" }); NumberFormats.Add("#,##0.00;(#,##0.00)", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 39, Format = "#,##0.00;(#,##0.00)" }); NumberFormats.Add("#,##0.00;[Red](#,##0.00)", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 40, Format = "#,##0.00;[Red](#,##0.00)" }); NumberFormats.Add("mm:ss", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 45, Format = "mm:ss" }); NumberFormats.Add("[h]:mm:ss", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 46, Format = "[h]:mm:ss" }); NumberFormats.Add("mmss.0", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 47, Format = "mmss.0" }); NumberFormats.Add("##0.0", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 48, Format = "##0.0" }); NumberFormats.Add("@", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 49, Format = "@" }); NumberFormats.NextId = 164; //Start for custom formats. } internal override XmlNode CreateXmlNode(XmlNode topNode) { TopNode = topNode; SetXmlNodeString("@numFmtId", NumFmtId.ToString()); SetXmlNodeString("@formatCode", Format); return TopNode; } internal enum eFormatType { Unknown = 0, Number = 1, DateTime = 2, } ExcelFormatTranslator _translator = null; internal ExcelFormatTranslator FormatTranslator { get { if (_translator == null) { _translator = new ExcelFormatTranslator(Format, NumFmtId); } return _translator; } } #region Excel --> .Net Format internal class ExcelFormatTranslator { internal enum eSystemDateFormat { None, SystemLongDate, SystemLongTime, Conditional, SystemShortDate, } internal ExcelFormatTranslator(string format, int numFmtID) { if (numFmtID == 14) { NetFormat = NetFormatForWidth = ""; NetTextFormat = NetTextFormatForWidth = ""; SpecialDateFormat = eSystemDateFormat.SystemShortDate; DataType = eFormatType.DateTime; } else if (format.Equals("general",StringComparison.OrdinalIgnoreCase)) { NetFormat = NetFormatForWidth = "0.#####"; NetTextFormat = NetTextFormatForWidth = ""; DataType = eFormatType.Number; } else { ToNetFormat(format, false); ToNetFormat(format, true); } } internal string NetTextFormat { get; private set; } internal string NetFormat { get; private set; } CultureInfo _ci = null; internal CultureInfo Culture { get { if (_ci == null) { return CultureInfo.CurrentCulture; } return _ci; } private set { _ci = value; } } internal eFormatType DataType { get; private set; } internal string NetTextFormatForWidth { get; private set; } internal string NetFormatForWidth { get; private set; } internal string FractionFormat { get; private set; } internal eSystemDateFormat SpecialDateFormat { get; private set; } private void ToNetFormat(string ExcelFormat, bool forColWidth) { DataType = eFormatType.Unknown; int secCount = 0; bool isText = false; bool isBracket = false; string bracketText = ""; bool prevBslsh = false; bool useMinute = false; bool prevUnderScore = false; bool ignoreNext = false; int fractionPos = -1; bool containsAmPm = ExcelFormat.Contains("AM/PM"); List<int> lstDec=new List<int>(); StringBuilder sb = new StringBuilder(); Culture = null; var format = ""; var text = ""; char clc; if (containsAmPm) { ExcelFormat = Regex.Replace(ExcelFormat, "AM/PM", ""); DataType = eFormatType.DateTime; } for (int pos = 0; pos < ExcelFormat.Length; pos++) { char c = ExcelFormat[pos]; if (c == '"') { isText = !isText; } else { if (ignoreNext) { ignoreNext = false; continue; } else if (isText && !isBracket) { sb.Append(c); } else if (isBracket) { if (c == ']') { isBracket = false; if (bracketText[0] == '$') //Local Info { string[] li = Regex.Split(bracketText, "-"); if (li[0].Length > 1) { sb.Append("\"" + li[0].Substring(1, li[0].Length - 1) + "\""); //Currency symbol } if (li.Length > 1) { if (li[1].Equals("f800", StringComparison.OrdinalIgnoreCase)) { SpecialDateFormat=eSystemDateFormat.SystemLongDate; } else if (li[1].Equals("f400", StringComparison.OrdinalIgnoreCase)) { SpecialDateFormat = eSystemDateFormat.SystemLongTime; } else { var num = int.Parse(li[1], NumberStyles.HexNumber); try { Culture = CultureInfo.GetCultureInfo(num & 0xFFFF); } catch { Culture = null; } } } } else if(bracketText.StartsWith("<") || bracketText.StartsWith(">") || bracketText.StartsWith("=")) //Conditional { SpecialDateFormat = eSystemDateFormat.Conditional; } else { sb.Append(bracketText); SpecialDateFormat = eSystemDateFormat.Conditional; } } else { bracketText += c; } } else if (prevUnderScore) { if (forColWidth) { sb.AppendFormat("\"{0}\"", c); } prevUnderScore = false; } else { if (c == ';') //We use first part (for positive only at this stage) { secCount++; if (DataType == eFormatType.DateTime || secCount == 3) { //Add qoutes if (DataType == eFormatType.DateTime) SetDecimal(lstDec, sb); //Remove? lstDec = new List<int>(); format = sb.ToString(); sb = new StringBuilder(); } else { sb.Append(c); } } else { clc = c.ToString().ToLower(CultureInfo.InvariantCulture)[0]; //Lowercase character //Set the datetype if (DataType == eFormatType.Unknown) { if (c == '0' || c == '#' || c == '.') { DataType = eFormatType.Number; } else if (clc == 'y' || clc == 'm' || clc == 'd' || clc == 'h' || clc == 'm' || clc == 's') { DataType = eFormatType.DateTime; } } if (prevBslsh) { if (c == '.' || c == ',') { sb.Append('\\'); } sb.Append(c); prevBslsh = false; } else if (c == '[') { bracketText = ""; isBracket = true; } else if (c == '\\') { prevBslsh = true; } else if (c == '0' || c == '#' || c == '.' || c == ',' || c == '%' || clc == 'd' || clc == 's') { sb.Append(c); if(c=='.') { lstDec.Add(sb.Length - 1); } } else if (clc == 'h') { if (containsAmPm) { sb.Append('h'); ; } else { sb.Append('H'); } useMinute = true; } else if (clc == 'm') { if (useMinute) { sb.Append('m'); } else { sb.Append('M'); } } else if (c == '_') //Skip next but use for alignment { prevUnderScore = true; } else if (c == '?') { sb.Append(' '); } else if (c == '/') { if (DataType == eFormatType.Number) { fractionPos = sb.Length; int startPos = pos - 1; while (startPos >= 0 && (ExcelFormat[startPos] == '?' || ExcelFormat[startPos] == '#' || ExcelFormat[startPos] == '0')) { startPos--; } if (startPos > 0) //RemovePart sb.Remove(sb.Length-(pos-startPos-1),(pos-startPos-1)) ; int endPos = pos + 1; while (endPos < ExcelFormat.Length && (ExcelFormat[endPos] == '?' || ExcelFormat[endPos] == '#' || (ExcelFormat[endPos] >= '0' && ExcelFormat[endPos]<= '9'))) { endPos++; } pos = endPos; if (FractionFormat != "") { FractionFormat = ExcelFormat.Substring(startPos+1, endPos - startPos-1); } sb.Append('?'); //Will be replaced later on by the fraction } else { sb.Append('/'); } } else if (c == '*') { //repeat char--> ignore ignoreNext = true; } else if (c == '@') { sb.Append("{0}"); } else { sb.Append(c); } } } } } //Add qoutes if (DataType == eFormatType.DateTime) SetDecimal(lstDec, sb); //Remove? // AM/PM format if (containsAmPm) { format += "tt"; } if (format == "") format = sb.ToString(); else text = sb.ToString(); if (forColWidth) { NetFormatForWidth = format; NetTextFormatForWidth = text; } else { NetFormat = format; NetTextFormat = text; } if (Culture == null) { Culture = CultureInfo.CurrentCulture; } } private static void SetDecimal(List<int> lstDec, StringBuilder sb) { if (lstDec.Count > 1) { for (int i = lstDec.Count - 1; i >= 0; i--) { sb.Insert(lstDec[i] + 1, '\''); sb.Insert(lstDec[i], '\''); } } } internal string FormatFraction(double d) { int numerator, denomerator; int intPart = (int)d; string[] fmt = FractionFormat.Split('/'); int fixedDenominator; if (!int.TryParse(fmt[1], out fixedDenominator)) { fixedDenominator = 0; } if (d == 0 || double.IsNaN(d)) { if (fmt[0].Trim() == "" && fmt[1].Trim() == "") { return new string(' ', FractionFormat.Length); } else { return 0.ToString(fmt[0]) + "/" + 1.ToString(fmt[0]); } } int maxDigits = fmt[1].Length; string sign = d < 0 ? "-" : ""; if (fixedDenominator == 0) { List<double> numerators = new List<double>() { 1, 0 }; List<double> denominators = new List<double>() { 0, 1 }; if (maxDigits < 1 && maxDigits > 12) { throw (new ArgumentException("Number of digits out of range (1-12)")); } int maxNum = 0; for (int i = 0; i < maxDigits; i++) { maxNum += 9 * (int)(Math.Pow((double)10, (double)i)); } double divRes = 1 / ((double)Math.Abs(d) - intPart); double result, prevResult = double.NaN; int listPos = 2, index = 1; while (true) { index++; double intDivRes = Math.Floor(divRes); numerators.Add((intDivRes * numerators[index - 1] + numerators[index - 2])); if (numerators[index] > maxNum) { break; } denominators.Add((intDivRes * denominators[index - 1] + denominators[index - 2])); result = numerators[index] / denominators[index]; if (denominators[index] > maxNum) { break; } listPos = index; if (result == prevResult) break; if (result == d) break; prevResult = result; divRes = 1 / (divRes - intDivRes); //Rest } numerator = (int)numerators[listPos]; denomerator = (int)denominators[listPos]; } else { numerator = (int)Math.Round((d - intPart) / (1D / fixedDenominator), 0); denomerator = fixedDenominator; } if (numerator == denomerator || numerator==0) { if(numerator == denomerator) intPart++; return sign + intPart.ToString(NetFormat).Replace("?", new string(' ', FractionFormat.Length)); } else if (intPart == 0) { return sign + FmtInt(numerator, fmt[0]) + "/" + FmtInt(denomerator, fmt[1]); } else { return sign + intPart.ToString(NetFormat).Replace("?", FmtInt(numerator, fmt[0]) + "/" + FmtInt(denomerator, fmt[1])); } } private string FmtInt(double value, string format) { string v = value.ToString("#"); string pad = ""; if (v.Length < format.Length) { for (int i = format.Length - v.Length-1; i >= 0; i--) { if (format[i] == '?') { pad += " "; } else if (format[i] == ' ') { pad += "0"; } } } return pad + v; } } #endregion } }
JanKallman/EPPlus
EPPlus/Style/XmlAccess/ExcelNumberFormatXml.cs
C#
lgpl-3.0
29,945
var searchData= [ ['linqtosqlrepository',['LinqToSqlRepository',['../class_catharsis_1_1_repository_1_1_linq_to_sql_repository_3_01_e_n_t_i_t_y_01_4.html#a9203aa99de2433032df5e63c5bd74f83',1,'Catharsis.Repository.LinqToSqlRepository&lt; ENTITY &gt;.LinqToSqlRepository(string connectionString)'],['../class_catharsis_1_1_repository_1_1_linq_to_sql_repository_3_01_e_n_t_i_t_y_01_4.html#ac135f994c78d476168d2551dd69371bf',1,'Catharsis.Repository.LinqToSqlRepository&lt; ENTITY &gt;.LinqToSqlRepository(IDbConnection connection)']]], ['linqtosqlrepository_3c_20entity_20_3e',['LinqToSqlRepository&lt; ENTITY &gt;',['../class_catharsis_1_1_repository_1_1_linq_to_sql_repository_3_01_e_n_t_i_t_y_01_4.html',1,'Catharsis::Repository']]] ];
prokhor-ozornin/Catharsis.NET.Repository
doc/html/search/all_6.js
JavaScript
lgpl-3.0
739
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Add Layer &#8212; MeteoInfo 3.0 documentation</title> <link rel="stylesheet" href="../../../_static/sphinxdoc.css" type="text/css" /> <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" type="text/css" href="../../../_static/graphviz.css" /> <script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script> <script src="../../../_static/jquery.js"></script> <script src="../../../_static/underscore.js"></script> <script src="../../../_static/doctools.js"></script> <script src="../../../_static/language_data.js"></script> <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script> <link rel="index" title="Index" href="../../../genindex.html" /> <link rel="search" title="Search" href="../../../search.html" /> <link rel="next" title="Legend Scheme" href="legend_scheme.html" /> <link rel="prev" title="Using Layers" href="using_layers.html" /> </head><body> <div style="background-color: white; text-align: left; padding: 2px 2px 2px 2px"> <a href="../../../index.html"><img src="../../../_static/logo.jpg" border="0"/></a></div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../../../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="legend_scheme.html" title="Legend Scheme" accesskey="N">next</a> |</li> <li class="right" > <a href="using_layers.html" title="Using Layers" accesskey="P">previous</a> |</li> <li><a href="../../../index.html">home</a>|&nbsp;</li> <li><a href="../../../news/index.html">news</a>|&nbsp;</li> <li><a href="../../../examples/index.html">examples</a>|&nbsp;</li> <li><a href="../../../downloads/index.html">downloads</a>|&nbsp;</li> <li><a href="../../index.html">docs</a>|&nbsp;</li> <li class="nav-item nav-item-1"><a href="../../index.html" >Documentation</a> &#187;</li> <li class="nav-item nav-item-2"><a href="../index.html" >MeteoInfoMap</a> &#187;</li> <li class="nav-item nav-item-3"><a href="index.html" >Desktop</a> &#187;</li> <li class="nav-item nav-item-4"><a href="using_layers.html" accesskey="U">Using Layers</a> &#187;</li> <li class="nav-item nav-item-this"><a href="">Add Layer</a></li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="add-layer"> <h1>Add Layer<a class="headerlink" href="#add-layer" title="Permalink to this headline">¶</a></h1> <p>Press ‘Add Layer’ button and select a supported map data file to open it.</p> <p>In this case, we select to open ‘country1.shp’ file. ‘country1.shp’ is a polygon shape file, so it is opened as a colored map. The default color is light yellow.</p> <img alt="../../../_images/addlayer_country.png" src="../../../_images/addlayer_country.png" /> <p>Double click the layer name of ‘country1.shp’ to open its ‘Layer Property’ dialog to change the layer’s apperance.</p> <p>Vector layer properties:</p> <img alt="../../../_images/layerproperty_vectorlayer.png" src="../../../_images/layerproperty_vectorlayer.png" /> <p>Image layer properties:</p> <img alt="../../../_images/layerproperty_imagelayer.png" src="../../../_images/layerproperty_imagelayer.png" /> <p>Raster layer properties:</p> <img alt="../../../_images/layerproperty_rasterlayer.png" src="../../../_images/layerproperty_rasterlayer.png" /> <p>Web map layer properties:</p> <img alt="../../../_images/layerproperty_webmaplayer.png" src="../../../_images/layerproperty_webmaplayer.png" /> </div> <div class="clearer"></div> </div> </div> </div> <a target="_blank" href="https://github.com/meteoinfo/MeteoInfo"> <img style="position: fixed; top: 0; right: 0; border: 0;" src="../../../_static/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"> </a> <a target="_blank" href="https://gitter.im/meteoinfo/community"> <img style="position: fixed; bottom: 0; right: 0; border: 0;" src="https://badges.gitter.im/meteoinfo/community/meteoinfo.svg" alt="Join the chat at Gitter"> </a> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="using_layers.html" title="previous chapter">Using Layers</a></p> <h4>Next topic</h4> <p class="topless"><a href="legend_scheme.html" title="next chapter">Legend Scheme</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../../../_sources/docs/meteoinfo/desktop/add_layer.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3 id="searchlabel">Quick search</h3> <div class="searchformwrapper"> <form class="search" action="../../../search.html" method="get"> <input type="text" name="q" aria-labelledby="searchlabel" /> <input type="submit" value="Go" /> </form> </div> </div> <script>$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../../../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="legend_scheme.html" title="Legend Scheme" >next</a> |</li> <li class="right" > <a href="using_layers.html" title="Using Layers" >previous</a> |</li> <li><a href="../../../index.html">home</a>|&nbsp;</li> <li><a href="../../../news/index.html">news</a>|&nbsp;</li> <li><a href="../../../examples/index.html">examples</a>|&nbsp;</li> <li><a href="../../../downloads/index.html">downloads</a>|&nbsp;</li> <li><a href="../../index.html">docs</a>|&nbsp;</li> <li class="nav-item nav-item-1"><a href="../../index.html" >Documentation</a> &#187;</li> <li class="nav-item nav-item-2"><a href="../index.html" >MeteoInfoMap</a> &#187;</li> <li class="nav-item nav-item-3"><a href="index.html" >Desktop</a> &#187;</li> <li class="nav-item nav-item-4"><a href="using_layers.html" >Using Layers</a> &#187;</li> <li class="nav-item nav-item-this"><a href="">Add Layer</a></li> </ul> </div> <div class="footer" role="contentinfo"> &#169; Copyright 2010-2021, MeteoInfo developers. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1. </div> </body> </html>
meteoinfo/MeteoInfoDoc
_build/html/docs/meteoinfo/desktop/add_layer.html
HTML
lgpl-3.0
7,676
/* * SonarQube Java * Copyright (C) 2012-2017 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.java.checks; import org.sonar.check.Rule; import org.sonar.java.model.ExpressionUtils; import org.sonar.plugins.java.api.JavaFileScanner; import org.sonar.plugins.java.api.JavaFileScannerContext; import org.sonar.plugins.java.api.tree.AssignmentExpressionTree; import org.sonar.plugins.java.api.tree.BaseTreeVisitor; import org.sonar.plugins.java.api.tree.BinaryExpressionTree; import org.sonar.plugins.java.api.tree.ExpressionTree; import org.sonar.plugins.java.api.tree.IdentifierTree; import org.sonar.plugins.java.api.tree.MemberSelectExpressionTree; import org.sonar.plugins.java.api.tree.Tree; @Rule(key = "S1697") public class NullDereferenceInConditionalCheck extends BaseTreeVisitor implements JavaFileScanner { private JavaFileScannerContext context; @Override public void scanFile(JavaFileScannerContext context) { this.context = context; scan(context.getTree()); } @Override public void visitBinaryExpression(BinaryExpressionTree tree) { if (isAndWithNullComparison(tree) || isOrWithNullExclusion(tree)) { ExpressionTree nonNullOperand = getNonNullOperand(tree.leftOperand()); IdentifierTree identifierTree = getIdentifier(nonNullOperand); if (identifierTree != null) { IdentifierVisitor visitor = new IdentifierVisitor(identifierTree); tree.rightOperand().accept(visitor); if (visitor.raiseIssue) { context.reportIssue(this, tree, "Either reverse the equality operator in the \"" + identifierTree.name() + "\" null test, or reverse the logical operator that follows it."); } } } super.visitBinaryExpression(tree); } private static IdentifierTree getIdentifier(ExpressionTree tree) { ExpressionTree nonNullOperand = ExpressionUtils.skipParentheses(tree); if (nonNullOperand.is(Tree.Kind.IDENTIFIER)) { return (IdentifierTree) nonNullOperand; } return null; } private static boolean isAndWithNullComparison(BinaryExpressionTree tree) { return tree.is(Tree.Kind.CONDITIONAL_AND) && isEqualNullComparison(tree.leftOperand()); } private static boolean isOrWithNullExclusion(BinaryExpressionTree tree) { return tree.is(Tree.Kind.CONDITIONAL_OR) && isNotEqualNullComparison(tree.leftOperand()); } private static class IdentifierVisitor extends BaseTreeVisitor { private IdentifierTree identifierTree; boolean raiseIssue = false; IdentifierVisitor(IdentifierTree identifierTree) { this.identifierTree = identifierTree; } @Override public void visitMemberSelectExpression(MemberSelectExpressionTree tree) { if (tree.expression().is(Tree.Kind.IDENTIFIER) || tree.expression().is(Tree.Kind.MEMBER_SELECT)) { //Check only first identifier of a member select expression : in a.b.c we are only interested in a. scan(tree.expression()); } } @Override public void visitAssignmentExpression(AssignmentExpressionTree tree) { //Ignore assignment to the identifier if (!isIdentifierWithSameName(tree.variable())) { scan(tree.variable()); } scan(tree.expression()); } @Override public void visitBinaryExpression(BinaryExpressionTree tree) { boolean scanLeft = true; boolean scanRight = true; if (tree.is(Tree.Kind.EQUAL_TO) || tree.is(Tree.Kind.NOT_EQUAL_TO)) { scanLeft = !isIdentifierWithSameName(tree.leftOperand()); scanRight = !isIdentifierWithSameName(tree.rightOperand()); } if (scanLeft) { scan(tree.leftOperand()); } if (scanRight) { scan(tree.rightOperand()); } } @Override public void visitIdentifier(IdentifierTree tree) { raiseIssue |= equalsIdentName(tree); } private boolean equalsIdentName(IdentifierTree tree) { return identifierTree.name().equals(tree.name()); } private boolean isIdentifierWithSameName(ExpressionTree tree) { return tree.is(Tree.Kind.IDENTIFIER) && equalsIdentName((IdentifierTree) tree); } } private static boolean isEqualNullComparison(ExpressionTree tree) { return isNullComparison(tree, Tree.Kind.EQUAL_TO); } private static boolean isNotEqualNullComparison(ExpressionTree tree) { return isNullComparison(tree, Tree.Kind.NOT_EQUAL_TO); } private static boolean isNullComparison(ExpressionTree expressionTree, Tree.Kind comparatorKind) { ExpressionTree tree = ExpressionUtils.skipParentheses(expressionTree); if (tree.is(comparatorKind)) { BinaryExpressionTree binary = (BinaryExpressionTree) tree; return binary.leftOperand().is(Tree.Kind.NULL_LITERAL) || binary.rightOperand().is(Tree.Kind.NULL_LITERAL); } return false; } private static ExpressionTree getNonNullOperand(ExpressionTree expressionTree) { BinaryExpressionTree binaryExpressionTree = (BinaryExpressionTree) ExpressionUtils.skipParentheses(expressionTree); if (binaryExpressionTree.leftOperand().is(Tree.Kind.NULL_LITERAL)) { return binaryExpressionTree.rightOperand(); } return binaryExpressionTree.leftOperand(); } }
mbring/sonar-java
java-checks/src/main/java/org/sonar/java/checks/NullDereferenceInConditionalCheck.java
Java
lgpl-3.0
5,979
BBBx.window.ScheduledMeeting = function (config) { config = config || {}; var preloadSlides = MODx.load({ xtype: 'modx-combo-browser', browserEl: 'modx-browser', fieldLabel: 'preloadSlides', name: 'preloadSlides', anchor: '100%' }); preloadSlides.on('select', function (data) { var srcBrowserId = preloadSlides.browser.id; var browserCmp = Ext.getCmp(srcBrowserId); var source = browserCmp.tree.baseParams.source; var preloadSlidesSourceIdField = this.fp.getForm().findField('preloadSlidesSourceId'); preloadSlidesSourceIdField.setValue(source); }, this); Ext.applyIf(config, { // provided by triggers // title: _('bbbx.meeting_update'), // baseParams: { // action: 'mgr/meetings/scheduled/create' // }, url: BBBx.config.connectorUrl, width: 600, autoScroll: true, // fileUpload: true, allowDrop: false, items: [ { html: '<p>' + _('bbbx.api_desc') + _('bbbx.name_is_required') + '</p>', bodyCssClass: 'panel-desc' } ], fields: [ { xtype: 'modx-tabs', enableTabScroll: true, defaults: { border: false, autoHeight: true, layout: 'form' }, border: true, items: [ { title: _('bbbx.basics'), defaults: {autoHeight: true}, border: false, items: [ { layout: 'column', items: [ { columnWidth: .5, layout: 'form', border: false, items: [ { xtype: 'textfield', fieldLabel: 'name *', name: 'name', anchor: '100%', allowBlank: false } ] }, { columnWidth: .5, layout: 'form', border: false, items: [ { xtype: 'textfield', fieldLabel: 'meetingID', name: 'meeting_id', anchor: '100%' } ] } ] }, { layout: 'form', border: false, items: [ { xtype: 'textarea', fieldLabel: 'description', name: 'description', anchor: '100%' } ] }, { layout: 'column', items: [ { columnWidth: .5, layout: 'form', border: false, items: [ { xtype: 'textfield', fieldLabel: 'attendeePW', name: 'attendee_pw', anchor: '100%' } ] }, { columnWidth: .5, layout: 'form', border: false, items: [ { xtype: 'textfield', fieldLabel: 'moderatorPW', name: 'moderator_pw', anchor: '100%' } ] } ] }, { xtype: 'label', cls: 'desc-under', html: _('bbbx.password_desc'), }, { layout: 'column', items: [ { columnWidth: .5, layout: 'form', border: false, items: [ { xtype: 'numberfield', fieldLabel: 'maxParticipants', name: 'max_participants', anchor: '100%' } ] }, { columnWidth: .5, layout: 'form', border: false, items: [ // { // xtype: 'numberfield', // fieldLabel: 'duration', // name: 'duration', // anchor: '100%' // } ] } ] }, { layout: 'form', border: false, items: [ { xtype: 'textfield', fieldLabel: 'logoutURL', name: 'logout_url', anchor: '100%' } ] } ] }, { title: _('bbbx.access'), defaults: {autoHeight: true}, border: false, items: [ { layout: 'column', items: [ { columnWidth: .5, layout: 'form', border: false, items: [ { fieldLabel: _('bbbx.start'), layout: 'hbox', items: [ { xtype: 'datefield', name: 'started_date', flex: 1 }, { xtype: 'timefield', name: 'started_time', format: 'H:i', flex: 1 } ] } ] }, { columnWidth: .5, layout: 'form', border: false, items: [ { fieldLabel: _('bbbx.end'), layout: 'hbox', items: [ { xtype: 'datefield', name: 'ended_date', flex: 1 }, { xtype: 'timefield', name: 'ended_time', format: 'H:i', flex: 1 } ] } ] } ] }, { fieldLabel: _('bbbx.usergroups'), layout: 'column', items: [ { columnWidth: .5, layout: 'form', border: false, items: [ { fieldLabel: _('bbbx.moderator'), xtype: 'bbbx-combo-usergroup', preventRender: true, name: 'moderator_usergroups[]', hiddenName: 'moderator_usergroups[]', anchor: '100%' } ] }, { columnWidth: .5, layout: 'form', border: false, items: [ { fieldLabel: _('bbbx.viewer'), xtype: 'bbbx-combo-usergroup', preventRender: true, name: 'viewer_usergroups[]', hiddenName: 'viewer_usergroups[]', anchor: '100%' } ] } ] }, { fieldLabel: _('bbbx.users'), layout: 'column', items: [ { columnWidth: .5, layout: 'form', border: false, items: [ { fieldLabel: _('bbbx.moderator'), xtype: 'bbbx-combo-user', preventRender: true, name: 'moderator_users[]', hiddenName: 'moderator_users[]', anchor: '100%' } ] }, { columnWidth: .5, layout: 'form', border: false, items: [ { fieldLabel: _('bbbx.viewer'), xtype: 'bbbx-combo-user', preventRender: true, name: 'viewer_users[]', hiddenName: 'viewer_users[]', anchor: '100%' } ] } ] }, { xtype: 'label', cls: 'desc-under', html: _('bbbx.user_access_desc'), }, { layout: 'column', items: [ { columnWidth: .5, layout: 'form', border: false, items: [ { xtype: 'radiogroup', name: 'is_moderator_first', fieldLabel: _('bbbx.is_moderator_first'), items: [ { boxLabel: _('no'), name: 'is_moderator_first', inputValue: 0 }, { boxLabel: _('yes'), name: 'is_moderator_first', inputValue: 1 } ] }, { xtype: 'label', cls: 'desc-under', html: _('bbbx.is_moderator_first_desc') } ] }, { columnWidth: .5, layout: 'form', border: false, items: [ { fieldLabel: _('bbbx.context_key'), xtype: 'bbbx-combo-contextkey', preventRender: true, name: 'context_key[]', hiddenName: 'context_key[]', anchor: '100%' }, { xtype: 'label', cls: 'desc-under', html: _('bbbx.context_key_desc') } ] } ] } ] }, { title: _('bbbx.messages'), defaults: {autoHeight: true}, items: [ { xtype: 'textarea', fieldLabel: 'welcome', name: 'welcome', grow: true, anchor: '100%' }, { xtype: 'label', cls: 'desc-under', html: _('bbbx.welcome_desc') }, { xtype: 'textarea', fieldLabel: 'moderatorOnlyMessage', name: 'moderator_only_message', grow: true, anchor: '100%' } ] }, { title: _('bbbx.voice'), defaults: {autoHeight: true}, layout: 'column', border: false, items: [ { columnWidth: .5, layout: 'form', border: false, items: [ { xtype: 'textfield', fieldLabel: 'dialNumber', name: 'dial_number', anchor: '100%' }, { xtype: 'textfield', fieldLabel: 'webVoice', name: 'web_voice', anchor: '100%' } ] }, { columnWidth: .5, layout: 'form', border: false, items: [ { xtype: 'numberfield', fieldLabel: 'voiceBridge', name: 'voice_bridge', anchor: '100%' } ] } ] }, { title: _('bbbx.recording'), defaults: {autoHeight: true}, items: [ { layout: 'column', autoScroll: true, items: [ { columnWidth: .33, baseCls: 'x-plain', bodyStyle: 'padding:5px 0 5px 5px', layout: 'form', items: [ { xtype: 'radiogroup', name: 'is_recorded', fieldLabel: 'record', items: [ { boxLabel: _('no'), name: 'is_recorded', inputValue: 0 }, { boxLabel: _('yes'), name: 'is_recorded', inputValue: 1 } ] } ] }, { columnWidth: .33, baseCls: 'x-plain', bodyStyle: 'padding:5px 0 5px 5px', layout: 'form', items: [ { xtype: 'radiogroup', name: 'auto_start_recording', fieldLabel: 'autoStartRecording', items: [ { boxLabel: _('no'), name: 'auto_start_recording', inputValue: 0 }, { boxLabel: _('yes'), name: 'auto_start_recording', inputValue: 1 } ] } ] }, { columnWidth: .33, baseCls: 'x-plain', bodyStyle: 'padding:5px 0 5px 5px', layout: 'form', items: [ { xtype: 'radiogroup', name: 'allow_start_stop_recording', fieldLabel: 'allowStartStopRecording', items: [ { boxLabel: _('no'), name: 'allow_start_stop_recording', inputValue: 0 }, { boxLabel: _('yes'), name: 'allow_start_stop_recording', inputValue: 1 } ] } ] } ] } ] }, { title: _('bbbx.preload_slides'), defaults: {autoHeight: true}, items: [ preloadSlides, { xtype: 'hidden', name: 'preloadSlidesSourceId' } ] }, { title: _('bbbx.meta'), defaults: {autoHeight: true}, items: [ { xtype: 'textarea', fieldLabel: 'meta', name: 'meta', grow: true, anchor: '100%' }, { xtype: 'label', cls: 'desc-under', html: _('bbbx.meta_desc'), } ] }, { title: _('bbbx.configurations'), defaults: {autoHeight: true}, items: [ { xtype: 'bbbx-combo-config', name: 'config', hiddenName: 'config', } ] } ] } ] }); BBBx.window.ScheduledMeeting.superclass.constructor.call(this, config); }; Ext.extend(BBBx.window.ScheduledMeeting, MODx.Window); Ext.reg('bbbx-window-scheduledmeeting', BBBx.window.ScheduledMeeting);
virtudraft/bbbx
www/assets/components/bbbx/js/mgr/widgets/window.scheduledmeeting.js
JavaScript
lgpl-3.0
26,890
''' This file is part of GEAR_mc. GEAR_mc is a fork of Jeremie Passerin's GEAR project. GEAR is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/lgpl.html>. Author: Jeremie Passerin geerem@hotmail.com www.jeremiepasserin.com Fork Author: Miquel Campos hello@miqueltd.com www.miqueltd.com Date: 2013 / 08 / 16 ''' ## @package gear.xsi.curve # @author Jeremie Passerin # # @brief create, merge, split curves... ########################################################## # GLOBAL ########################################################## # gear from gear.xsi import xsi, c, XSIMath, XSIFactory import gear.xsi.utils as uti import gear.xsi.transform as tra ########################################################## # DRAW ########################################################## # ======================================================== ## Create a curve attached to given centers. One point per center.\n # Do to so we use a cluster center operator per point. We could use an envelope (method to do so is in the code), but there was a reason I can't remember why it was better to use clustercenter. # @param parent X3DObject - Parent object. # @param name String - Name. # @param centers List of X3DObject or Collection - Object that will drive the curve. # @param close Boolean - True to close the fcurve. # @param degree Integer - 1 for linear curve, 3 for Cubic. # @return NurbCurve - The newly created curve. def addCnsCurve(parent, name, centers, close=False, degree=1): # convert collections to list centers = [center for center in centers] if degree == 3: if len(centers) == 2: centers.insert(0, centers[0]) centers.append(centers[-1]) elif len(centers) == 3: centers.append(centers[-1]) points = [] for center in centers: points.append(center.Kinematics.Global.Transform.PosX) points.append(center.Kinematics.Global.Transform.PosY) points.append(center.Kinematics.Global.Transform.PosZ) points.append(1) curve = parent.AddNurbsCurve(points, None, close, degree, c.siNonUniformParameterization, c.siSINurbs, name) crv_geo = curve.ActivePrimitive.Geometry for i, center in enumerate(centers): cluster = crv_geo.AddCluster( c.siVertexCluster, "center_%s"%i, [i] ) xsi.ApplyOp( "ClusterCenter", cluster.FullName+";"+center.FullName, 0, 0, None, 2) # Here is a method to replace the cluster centers with an envelope # envelopeop = curve.ApplyEnvelope(cCenters) # # aWeights = [] # for i in range(cCenters.Count): # for j in range(cCenters.Count): # if i == j: # aWeights.append(100) # else: # aWeights.append(0) # # envelopeop.Weights.Array = aWeights return curve # ======================================================== ## Create a NurbsCurve with a single subcurve. # @param parent X3DObject - Parent object. # @param name String - Name. # @param points List of Double - positions of the curve in a one dimension array [point0X, point0Y, point0Z, 1, point1X, point1Y, point1Z, 1, ...]. # @param close Boolean - True to close the curve. # @param degree Integer - 1 for linear curve, 3 for Cubic. # @param t SITransformation - Global transform. # @param color List of Double - The RGB color of the Null (ie. [1,0,0] for red). # @return NurbCurve - The newly created curve. def addCurve(parent, name, points, close=False, degree=1, t=XSIMath.CreateTransform(), color=[0,0,0]): curve = parent.AddNurbsCurve(points, None, close, degree, c.siNonUniformParameterization, c.siSINurbs, name) uti.setColor(curve, color) curve.Kinematics.Global.Transform = t return curve # ======================================================== ## Create a NurbsCurve with multiple subcurve. # @param parent X3DObject - Parent object. # @param name String - Name. # @param points List of Double - positions of the curve in a one dimension array [point0X, point0Y, point0Z, 1, point1X, point1Y, point1Z, 1, ...]. # @param ncp List of Double - See XSI SDK Docv for AddNurbsCurveList2. # @param kn List of Double - See XSI SDK Docv for AddNurbsCurveList2. # @param nkn List of Double - See XSI SDK Docv for AddNurbsCurveList2. # @param close List of Boolean - True to close the curve. # @param degree List of Integer - 1 for linear curve, 3 for Cubic. # @param t SITransformation - Global transform. # @param color List of Double - The RGB color of the Null (ie. [1,0,0] for red). # @return NurbCurve - The newly created curve. def addCurve2(parent, name, points, ncp=[], kn=[], nkn=[], close=[], degree=[], t=XSIMath.CreateTransform(), color=[0,0,0]): pointCount = len(ncp) aPar = [c.siNonUniformParameterization for i in range(pointCount)] curve = parent.AddNurbsCurveList2(pointCount, points, ncp, kn, nkn, close, degree, aPar, c.siSINurbs, name) uti.setColor(curve, color) curve.Kinematics.Global.Transform = t return curve # ======================================================== ## Create a NurbsCurve with a single subcurve from a list of position. # @param parent X3DObject - Parent object. # @param name String - Name. # @param positions List of SIVector3 - positions of the curve points. # @param close Boolean - True to close the curve. # @param degree Integer - 1 for linear curve, 3 for Cubic. # @param knotsPara - knots parametrization in the curve # @param t SITransformation - Global transform. # @param color List of Double - The RGB color of the object (ie. [1,0,0] for red). # @return NurbCurve - The newly created curve. def addCurveFromPos(parent, name, positions, close=False, degree=1, knotsPara=c.siNonUniformParameterization, t=XSIMath.CreateTransform(), color=[0,0,0]): points = [] for v in positions: points.append(v.X) points.append(v.Y) points.append(v.Z) points.append(1) curve = parent.AddNurbsCurve(points, None, close, degree, knotsPara, c.siSINurbs, name) uti.setColor(curve, color) curve.Kinematics.Global.Transform = t return curve ########################################################## # SUBCURVES ########################################################## # Merge Curves =========================================== ## Merge given curve in one unique curve. # @param curve List of NurbsCurve - The curves to merge. # @return NurbsCurve. def mergeCurves(curves): points = [] ncp = [] kn = [] nkn = [] closed = [] degree = [] for curve in curves: curve_matrix = curve.Kinematics.Global.Transform.Matrix4 for nurbscrv in curve.ActivePrimitive.Geometry.Curves: ncp.append(nurbscrv.ControlPoints.Count) kn.extend(nurbscrv.Knots.Array) nkn.append(len(nurbscrv.Knots.Array)) closed.append(isClosed(nurbscrv)) degree.append(nurbscrv.Degree) for point in nurbscrv.ControlPoints: point_pos = point.Position point_pos.MulByMatrix4InPlace(curve_matrix) points.extend([point_pos.X, point_pos.Y,point_pos.Z, 1]) if len(ncp) > 1: curve = addCurve2(xsi.ActiveSceneRoot, "curve", points, ncp, kn, nkn, closed, degree) else: curve = addCurve(xsi.ActiveSceneRoot, "curve", points, closed[0], degree[0]) return curve # Split Curves =========================================== ## Split the sub curve of given curve. # @param curve NurbsCurve - The curves to split. # @return List of NurbsCurve. def splitCurve(curve): t = curve.Kinematics.Global.Transform curves = [addCurve(curve.Parent, curve.Name+str(i), nurbscrv.ControlPoints.Array, isClosed(nurbscrv), nurbscrv.Degree, t) for i, nurbscrv in enumerate(curve.ActivePrimitive.Geometry.Curves)] return curves # Is Closed ============================================== ## Return true if the given nurbscurve is closed. # @param nurbscrv NurbsCurve - The nurbs curves to check. # @return Boolean. def isClosed(nurbscrv): if nurbscrv.Degree == 3: return not nurbscrv.ControlPoints.Count == (len(nurbscrv.Knots.Array)-2) else: return not nurbscrv.ControlPoints.Count == len(nurbscrv.Knots.Array) ########################################################## # OPERATOR ########################################################## # Apply Curve Resampler Op =============================== ## Resample the curve on itself, code of the operator is in the plugin sn_CurveTools # @param curve NurbsCurve - The curve to resample. # @return Operator def applyCurveResamplerOp(curve): op = XSIFactory.CreateObject("gear_CurveResamplerOp") op.AddIOPort(curve.ActivePrimitive) op.Connect() return op ########################################################## # EVAL CURVE ########################################################## # ======================================================== def getGlobalPositionFromPercentage(percentage, crv, subcurve=0): crv_geo = crv.ActivePrimitive.Geometry crv_sub = crv_geo.Curves(subcurve) crv_tra = crv.Kinematics.Global.Transform position = crv_sub.EvaluatePositionFromPercentage(percentage)[0] position = XSIMath.MapObjectPositionToWorldSpace(crv_tra, position) return position # ======================================================== # @param position SIVector3 - The global position # @param crv NurbsCurve - The curve to eval # @return Double def getClosestU(position, crv, normalized=False): crv_geo = crv.ActivePrimitive.Geometry crv_tra = crv.Kinematics.Global.Transform pos = XSIMath.MapWorldPositionToObjectSpace(crv_tra, position) rtn = crv_geo.GetClosestCurvePosition2(pos) crv_sub = crv_geo.Curves(rtn[0]) u = rtn[2] if normalized: u = crv_sub.GetNormalizedUFromU(u) return u # ======================================================== # @param position SIVector3 - The global position # @param crv NurbsCurve - The curve to eval # @return Double def getClosestPercentage(position, crv): crv_geo = crv.ActivePrimitive.Geometry crv_tra = crv.Kinematics.Global.Transform pos = XSIMath.MapWorldPositionToObjectSpace(crv_tra, position) rtn = crv_geo.GetClosestCurvePosition2(pos) crv_sub = crv_geo.Curves(rtn[0]) perc = crv_sub.GetPercentageFromU(rtn[2]) return perc # ======================================================== # @param position SIVector3 - The global position # @param crv NurbsCurve - The curve to eval # @param subcurve int - The index of subcurve to eval # @return SIVector3 - The closest Global position def getClosestGlobalTransform(position, crv, subcurve=0, tan_axis="x", upv_axis="y", normal=XSIMath.CreateVector3(0,1,0)): crv_geo = crv.ActivePrimitive.Geometry crv_sub = crv_geo.Curves(subcurve) crv_tra = crv.Kinematics.Global.Transform pos = XSIMath.MapWorldPositionToObjectSpace(crv_tra, position) rtn = crv_geo.GetClosestCurvePosition2(pos) u = rtn[2] pos = rtn[3] pos = XSIMath.MapObjectPositionToWorldSpace(crv_tra, pos) tan = crv_sub.EvaluatePosition(u)[1] r = crv_tra.Rotation r.InvertInPlace() tan.MulByRotationInPlace(r) tan.AddInPlace(pos) t = tra.getTransformLookingAt(pos, tan, normal, tan_axis+upv_axis, False) return t # ======================================================== # @param position SIVector3 - The global position # @param crv NurbsCurve - The curve to eval # @param subcurve int - The index of subcurve to eval # @return SIVector3 - The closest Global position def getClosestGlobalPosition(position, crv, subcurve=0): crv_geo = crv.ActivePrimitive.Geometry crv_sub = crv_geo.Curves(subcurve) crv_tra = crv.Kinematics.Global.Transform pos = XSIMath.MapWorldPositionToObjectSpace(crv_tra, position) pos = crv_geo.GetClosestCurvePosition2(pos)[3] pos = XSIMath.MapObjectPositionToWorldSpace(crv_tra, pos) return pos # ======================================================== # @param position SIVector3 - The global position # @param crv NurbsCurve - The curve to eval # @param subcurve int - The index of subcurve to eval # @return SIVector3 - The closest tangent def getClosestGlobalTangent(position, crv, subcurve=0): crv_geo = crv.ActivePrimitive.Geometry crv_sub = crv_geo.Curves(subcurve) crv_tra = crv.Kinematics.Global.Transform pos = XSIMath.MapWorldPositionToObjectSpace(crv_tra, position) u = crv_geo.GetClosestCurvePosition2(pos)[2] tan = crv_sub.EvaluatePosition(u)[1] tan.MulByRotationInPlace(crv_tra.Rotation) return tan # ======================================================== # @param position SIVector3 - The global position # @param crv NurbsCurve - The curve to eval # @param subcurve int - The index of subcurve to eval # @return SIVector3 - The closest tangent def getClosestGlobalNormal(position, crv, subcurve=0): crv_geo = crv.ActivePrimitive.Geometry crv_sub = crv_geo.Curves(subcurve) crv_tra = crv.Kinematics.Global.Transform pos = XSIMath.MapWorldPositionToObjectSpace(crv_tra, position) u = crv_geo.GetClosestCurvePosition2(pos)[2] nor = crv_sub.EvaluatePosition(u)[2] nor.MulByRotationInPlace(crv_tra.Rotation) return nor # ======================================================== # @param position SIVector3 - The global position # @param crv NurbsCurve - The curve to eval # @param subcurve int - The index of subcurve to eval # @return SIVector3 - The closest tangent def getClosestGlobalBiNormal(position, crv, subcurve=0): crv_geo = crv.ActivePrimitive.Geometry crv_sub = crv_geo.Curves(subcurve) crv_tra = crv.Kinematics.Global.Transform pos = XSIMath.MapWorldPositionToObjectSpace(crv_tra, position) u = crv_geo.GetClosestCurvePosition2(pos)[2] bin = crv_sub.EvaluatePosition(u)[3] bin.MulByRotationInPlace(crv_tra.Rotation) return bin # ======================================================== def getGlobalPointPosition(index, crv): crv_geo = crv.ActivePrimitive.Geometry crv_tra = crv.Kinematics.Global.Transform pos = XSIMath.MapObjectPositionToWorldSpace(crv_tra, crv_geo.Points(index).Position) return pos
miquelcampos/GEAR_mc
gear/xsi/curve.py
Python
lgpl-3.0
14,878
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns='http://www.w3.org/1999/xhtml' lang='he' dir='rtl'> <head> <meta http-equiv='Content-Type' content='text/html; charset=windows-1255' /> <meta charset='windows-1255' /> <meta http-equiv='Content-Script-Type' content='text/javascript' /> <meta http-equiv='revisit-after' content='15 days' /> <title>äòáøú áé÷åøú - àéê ìîúåç áé÷åøú?</title> <link rel='stylesheet' type='text/css' href='../../_script/klli.css' /> <link rel='stylesheet' type='text/css' href='../../tnk1/_themes/klli.css' /> <meta property='og:url' content='https://tora.us.fm/tnk1/msr/3tokxot.html'/> <meta name='author' content="" /> <meta name='receiver' content="" /> <meta name='jmQovc' content="tnk1/msr/3tokxot.html" /> <meta name='tvnit' content="tnk_ol" /> <link rel='canonical' href='https://tora.us.fm/tnk1/msr/3tokxot.html' /> </head> <!-- PHP Programming by Erel Segal-Halevi --> <body lang='he' dir='rtl' id = 'tnk1_msr_3tokxot' class='awsp_twspt tnk_ol'> <div class='pnim'> <script type='text/javascript' src='../../_script/vars.js'></script> <!--NiwutElyon0--> <div class='NiwutElyon'> <div class='NiwutElyon'><a class='link_to_homepage' href='../../tnk1/index.html'>øàùé</a>&gt;<a href='../../tnk1/msr/3.html'>áéï àãí ìçáøå</a>&gt;<a href='../../tnk1/ktuv/mjly/dibur_wjtiqa.html'>ãéáåøéí</a>&gt;</div> <div class='NiwutElyon'><a class='link_to_homepage' href='../../tnk1/index.html'>øàùé</a>&gt;<a href='../../tryg/index.html'>äàúø ìî÷åøéåú áîöååú</a>&gt;<a href='../../tryg/mamr/kll_mcwa.html'>ëìì äîöååú</a>&gt;<a href='../../tryg/mamr/hvdlim.html'>äáãìé îöååú</a>&gt;<a href='../../tryg/sug/rayon_axryut.html'>àçøéåú ìîòùé äæåìú</a>&gt;<a href='../../tryg/sug/biqort_wtwkxh.html'>áé÷åøú åúåëçä</a>&gt;</div> </div> <!--NiwutElyon1--> <h1 id='h1'>äòáøú áé÷åøú - àéê ìîúåç áé÷åøú?</h1> <div id='idfields'> <p>÷åã: îúéçú áé÷åøú áúð"ê</p> <p>ñåâ: àåñó_úåñôú</p> <p>îàú: </p> <p>àì: </p> </div> <script type='text/javascript'>kotrt()</script> <ul id='ulbnim'> <li>àåñó: <a href='../../tnk1/kma/qjrim1/biqort_mxmaot.html' class='awsp dor1'>ëãé ùäáé÷åøú úåòéì åìà úæé÷ - éù ìùìá áä ùáçéí åîçîàåú<small> / àøàì</small></a>&nbsp; <div class='dor2'> <a href='../../tnk1/ktuv/mj/25-12.html' class='mamr' title='áéàåø:îùìé ëä12'>çëîéí éåãòéí ìééôåú àú äàãí ùä...</a> <a href='../../tnk1/ktuv/mj/24-25.html' class='mamr' title='áéàåø:îùìé ëã25'>îåúø ìäâéã ìøùòéí ùäí öãé÷éí ë...</a> <a href='../../tnk1/ktuv/mj/29-01.html' class='mamr' title='áéàåø:îùìé ëè1'>îé ùéåãò ìåîø ø÷ ãáøé áé÷åøú -...</a> <a onclick='showSiblings(this); hide(this)'>...</a> <a style='display:none' href='../../tnk1/ktuv/mj/13-15.html' class='mamr' title='áéàåø:îùìé éâ15'>îé ùéù ìå ùëì èåá, éëåì ìîöåà ...</a> <a style='display:none' href='../../tnk1/ktuv/dhb/db-19.html' class='kll' title='îçîàåú ìôðé áé÷åøú - éäåà áï çððé åéäåùôè îìê éäåãä'>ëùéäåà áï çððé îúç áé÷åøú òì é...</a> <a style='display:none' href='../../tnk1/nvia/yrmyhu/yr-28-06.html' class='mamr' title='áéàåø:éøîéäå ëç6'>éøîéäå ðúï ìçððéä ôúç ìäúçøè á...</a> <a style='display:none' href='../../tnk1/ktuv/mj/09-07.html' class='mamr' title='áéàåø:îùìé è7'>àì úåëéç úåê ùéîåù áëéðåééí "ì...</a> </div><!--dor2--> </li> <li>àåñó: <a href='../../tnk1/kma/qjrim1/musr_tokxa.html' class='awsp dor1'>îåñø - úåëçä: ùúé ãøëéí ìîúåç áé÷åøú<small> / àøàì</small></a></li> <li>ùéø: <a href='../../tnk1/klli/jirim/jbt_hyom_l1.html' class='jyr dor1'>àéìå äéä ìé ëåç... äééúé îëøéæ åàåîø "ùáú äéåí ìä'!"<small> / àøàì -> ðç"ú ùáú çùåï ð"è</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/mj/29-05.html' class='mamr dor1'>âáø îçìé÷ òì øòäå, øùú ôåøù òì ôòîéå<small> / àøàì -> ñâìåú îùìé</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/mj/17-10.html' class='mamr dor1'>âòøä òìåìä ìâøåí ðæ÷ ðôùé<small> / àøàì -> ñâìåú îùìé</small></a></li> <li>îáðä: <a href='../../tnk1/nvia/tryasr/xg-01.html' class='mbnh dor1'>äðáéà çâé áîáöò äñáøä ìîòï áðééï äî÷ãù<small> / àøàì -> ôéøåùéí åñéîðéí 13</small></a></li> <li>îáðä: <a href='../../tnk1/ktuv/mj/19-19.html' class='mbnh dor1'>ìééñø áìé ìëòåñ<small> / àøàì -> ôéøåùéí åñéîðéí îùìé á</small></a></li> <li>äáãìéí: <a href='../../tnk1/nvir/mlkima/ma-19-09.html' class='hbdlym dor1'>ìôðé ùä' äåëéç àú àìéäå, äåà ðúï ìå ìàëåì åìùúåú<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/mj/28-23.html' class='mamr dor1'>îåëéç àãí - "àçøé!"<small> / àøàì -> ñâìåú îùìé</small></a></li> <li>ëìì: <a href='../../tnk1/nvir/mikl_hds.html' class='kll dor1'>îéëì ìà ãéáøä òí ãåã îééã òì îä ùäôøéò ìä àìà ùîøä "ááèï", åìëï áñåó äúôøöä åôâòä áëáåãå<small> / äãñ àøðåï -> ùéòåø ðç"ú éøåùìéí ñá-ñâ</small></a></li> <li>îàîø: <a href='../../tnk1/tora/brejit/nox_wavrhm.html' class='mamr dor1'>ðåç åàáøäí<small> / àìéùáò -> ðç"ú ùáú çùåï ð"è</small></a></li> <li>îàîø: <a href='../../tnk1/nvia/yrmyhu/yr-05-01.html' class='mamr dor1'>àéù àîåðä àçã éëåì ìäöéì àú ëì éøåùìéí<small> / àøàì</small></a></li> <li>îáðä: <a href='../../tnk1/nvia/tryasr/ho-04-0104.html' class='mbnh dor1'>áú÷åôú äåùò ìà øöå ìäåëéç åäâéòå ìîöá àáñåøãé<small> / àøàì</small></a></li> <li>äáãìéí: <a href='../../tnk1/ktuv/mjly/mj-09.html' class='hbdlym dor1'>äãòåú äðëåðåú îúçéìåú îòîãä ðçåúä éåúø áãòú ä÷äì, åìëï äï öøéëåú ìäéåú çøåöåú éåúø ëãé "ìîùåê ÷äì"<small> / àøàì -> ñâìåú îùìé</small></a></li> <li>îàîø: <a href='../../tnk1/tora/brejit/sdom.html' class='mamr dor1'>äîñø îôøùú ñãåí - ìà ø÷ 'àì úäéä ëîåäí', àìà 'àì úéúï ìæä ì÷øåú ìéãê'<small> / îéãã -> ëôéú ä'úùñ"à ëñìå</small></a></li> <li>îàîø: <a href='http://www.daat.ac.il/daat/tanach/achronim/yehezkel7a-4.htm' class='mamr dor1' target='_blank'>äöãé÷éí ðòðùéí òì ëê ùìà îéçå áàðùé ãåøí<small> / éäåãä àéæðáøâ -> ÷åì éùøàì</small> <small>(÷éùåø çéöåðé)</small></a></li> <li>îàîø: <a href='../../tnk1/nvia/yxzqel/yx-03.html' class='mamr dor1'>éçæ÷àì ðòðù òì ëê ùìà ãéáø åìà äåëéç àú òí éùøàì<small> / àøàì (äâää: éòì) -> ôéøåùéí åñéîðéí 13</small></a></li> <li>áñéñ: <a href='../../tnk1/nvir/jmuela/br31.html' class='bsys dor1'>àéê ìäúîåãã òí çùãåú<small> / øáé àìòæø -> úìîåã ááìé, áøëåú ìà</small></a></li> <li>ëìì: <a href='../../tnk1/sofrim/mali/mlkut_tokxa.html' class='kll dor1'>àéê îåëéçéí îðäéâ<small> / äøá àìéäå îàìé</small></a></li> <li>îàîø: <a href='../../tnk1/nvir/mlkimb/mb-01-03.html' class='mamr dor1'>àìéäå îçæéø áúùåáä àú ùìéçé àçæéä<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/dniel/dn-12-03.html' class='mamr dor1'>áòúéã, îåëéçé äøáéí éäéå ëëåëáéí ìòåìí åòã<small> / ãåã à÷ñìøåã</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/mgilot/ei-01-06.html' class='mamr dor1'>âãåìé éùøàì éöàå ìâìåú ëé äòìéîå òéï îòáéøåú<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/messages/msr_4thlikjlom_0.html' class='mamr dor1'>äàéùä äéà òæø ãåå÷à ëùäéà ðâãå<small> / îéëàì òæøà</small></a></li> <li>îàîø ìà âîåø: <a href='http://hydepark.hevre.co.il/hydepark/topic.asp?topic_id=2025907&amp;whichpage=1' class='mamr_la_gmwr dor1' target='_blank'>äàí éù ìîúåç áé÷åøú òì àðùéí ùîáæéí àú ä', àå ùòöí äáé÷åøú ôåâòú áëáåã ä'?<small> / àøàì -> òöåø ëàï çåùáéí</small> <small>(÷éùåø çéöåðé)</small></a></li> <li>áñéñ: <a href='../../tnk1/nvia/yjayhu/yj-50-07.html' class='bsys dor1'>äáåèç áä' ìà îúáééù ìäåëéç<small> / àøàì -> àåøçåú öãé÷éí, ùòø úùéòé - ùòø äùîçä</small></a></li> <li>îàîø: <a href='../../tnk1/nvia/tryasr/am-05-13.html' class='mamr dor1'>äîùëéì áòú ääéà ééãåí<small> / àøàì</small></a></li> <li>ëìì: <a href='../../tnk1/messages/nvia_tryasr_ml-02-10_0_1.html' class='kll dor1'>äðáéà îùúó àú òöîå á÷øéàä ìúùåáä<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/nvia/yxzqel/yx-03-1619.html' class='mamr dor1'>äöåôä öøéê ìäæäéø àú äøùò âí àí ìà éùîò<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/nvia/tryasr/ho-04-04.html' class='mamr dor1'>åòîê ëîøéáé ëäï - ëîä ôéøåùéí<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/mgilot/qh-07-07.html' class='mamr dor1'>ëé äòåù÷ éäåìì çëí = ëùäçëí îúòñ÷ áîøéáåú, äãáø ôåâò áàéëåú ãáøé äáé÷åøú ùìå<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/mj/14-02.html' class='mamr dor1'>ëùàãí áà ìäåëéç àú çáøå, äåà öøéê ÷åãí-ëì ìäëéø àåúå äéèá, ëãé ùééãò äàí äúåëçä äæàú áàîú îúàéîä ìå òì-ôé îöáå äðôùé<small> / àøàì</small></a></li> <li>äáãìéí: <a href='../../tnk1/tora/brejit/cxoq.html' class='hbdlym dor1'>ìà öøéê ìååúø òì úåëçä, àáì òì äôøèéí ùáñéôåø ä÷ùåøéí ìä, àáì ìà îäåúééí ìòðééðä, öøéê ìååúø<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/nvia/yjayhu/yj-58-01.html' class='mamr dor1'>ìäåëéç áëì äëåç<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/mj/10-19.html' class='mamr dor1'>ìäåëéç á÷éöåø<small> / àøàì -> ñâìåú îùìé</small></a></li> <li>îàîø: <a href='../../tnk1/nvia/yrmyhu/yr-15-19.html' class='mamr dor1'>ìäåöéà é÷ø îæåìì<small> / àøàì åâìéä ñâì-äìåé</small></a></li> <li>îàîø: <a href='../../tnk1/kma/qjrim1/biqort_ruti.html' class='mamr dor1'>ìîúåç áé÷åøú îúåê àäáä åòðåä<small> / øåúé øåáéï -> îðç"ú ùáú ä'úùñ"å àçøé-÷ãåùéí</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/mgilot/jj-02-1113.html' class='mamr dor1'>ìòåøø àú äøöåï ìöàú ìçåôùé<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/mj/05-03.html' class='mamr dor1'>ìôðé ùîåúçéí áé÷åøú, éù ìäáéï îä îåùê àú äæåìú áîòùä äøò ùäåà òåùä<small> / àøàì</small></a></li> <li>ëìì: <a href='../../tnk1/kma/qjrim1/jela.html' class='kll dor1'>ìúú ìçåèà äæãîðåú ìäåãåú<small> / àøàì</small></a></li> <li>îàîø: <a href='http://www.daat.ac.il/daat/kitveyet/shmaatin/habracha.htm' class='mamr dor1' target='_blank'>îâîú äôéåñ ááøëåúéå ùì îùä áôøùú "åæàú äáøëä"<small> / éàéø âðæ -> ùîòúéï ä'úùð"ã, 115-116</small> <small>(÷éùåø çéöåðé)</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/mj/09-08.html' class='mamr dor1'>îåúø ìôúé ìîúåç áé÷åøú òì çëîéí<small> / àøàì -> ñâìåú îùìé</small></a></li> <li>îàîø: <a href='../../tnk1/tora/brejit/br-04-0607.html' class='mamr dor1'>îèøú äúåëçä - çéãåã äáçéøä<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/ktuv/mgilot/qh-12-13.html' class='mamr dor1'>îé ùéù áå éøàú ùîéí - ãáøéå ðùîòéí<small> / àøàì</small></a></li> <li>îàîø: <a href='../../tnk1/tora/brejit/ec_hdat.html' class='mamr dor1'>òõ äãòú èåá åøò = òõ ùâåøí ìàåëìéå ìäéåú áé÷åøúééí åùéôåèééí ëìôé çáøéäí<small> / ã÷ìä àìôé -> ëôéú ä'úùñ"à ëñìå</small></a></li> <li>îàîø: <a href='../../tnk1/messages/forums_66.html' class='mamr dor1'>ôøùú åéçé - úåëçä àéîúé?<small> / àäåáä ÷ìééï -> Ahuvak @ bezeqint.net</small></a></li> <li>îàîø: <a href='../../tnk1/nvir/jmuela/ja-15-23.html' class='mamr dor1'>ùîåàì îá÷ø àú ùàåì ãåå÷à áãáø ùäéä äëé çùåá ìå - "çèàú ÷ñí îøé"<small> / àøàì</small></a></li> <li>ëìì: <a href='../../tnk1/messages/dmut_dmut_692_0.html' class='kll dor1'>àáùìåí äéä àîéõ åäáéò àú ãòúå, àëï ìà áöåøä ìâéèéîéú åðëåðä, àáì ãòúå ðùîòä<small> / àìéàá ñîåàì -> ëôéú ä'úùñ"ã ùáè, îãåø åòãú áé÷åøú</small></a></li> <li>äáãìéí: <a href='http://www.daat.ac.il/daat/tanach/achronim/yehezkel1-4.htm' class='hbdlym dor1' target='_blank'>äúåëçåú ùì éçæ÷àì ìà ðåòãå ìäçæéø àú äòí áúùåáä, àìà ø÷ ìîðåò îäòí úøåõ áðåñç "ìà äæäéøå àåúðå"<small> / éäåãä àéæðáøâ -> ÷åì éùøàì</small> <small>(÷éùåø çéöåðé)</small></a></li> <li>îàîø: <a href='../../tnk1/messages/prqim_t0319_5.html' class='mamr dor1'>áé÷åøú úäéä!<small> / çâé äåôø</small></a></li> </ul><!--end--> <script type='text/javascript'>AnalyzeBnim(); ktov_bnim_tnk(); </script> <h2 id='tguvot'>úåñôåú åúâåáåú</h2> <script type='text/javascript'>ktov_bnim_axrim("<"+"ul>","</"+"ul>")</script> <script type='text/javascript'>tguva(); txtit()</script> </div><!--pnim--> </body> </html>
erelsgl/erel-sites
tnk1/msr/3tokxot.html
HTML
lgpl-3.0
11,738
#ifndef CK2_TITLE_HH #define CK2_TITLE_HH #include "UtilityFunctions.hh" class CK2Character; class CK2Ruler; class EU4Country; class TitleLevel : public Enumerable<TitleLevel> { public: TitleLevel (string n, bool f) : Enumerable<TitleLevel>(this, n, f) {}; static TitleLevel const* const getLevel (const string& key); static TitleLevel const* const Barony; static TitleLevel const* const County; static TitleLevel const* const Duchy; static TitleLevel const* const Kingdom; static TitleLevel const* const Empire; }; class CK2Title : public Enumerable<CK2Title>, public ObjectWrapper { public: CK2Title (Object* o); void addClaimant (CK2Character* claimant); int distanceToSovereign (); TitleLevel const* const getLevel () const; EU4Country* getEU4Country () const {return eu4country;} CK2Title* getDeJureLiege () const {return deJureLiege;} CK2Title* getDeJureLevel (TitleLevel const* const level); CK2Title* getLiege (); CK2Ruler* getRuler () {return ruler;} CK2Ruler* getSovereign (); // Returns the first liege that converts to an EU4 nation. CK2Title* getSovereignTitle (); // The title that converts. string getTag() { return getKey(); } bool isDeJureOverlordOf (CK2Title* dat) const; bool isRebelTitle () const {return isRebel;} void setRuler (CK2Ruler* r) {ruler = r;} void setDeJureLiege (CK2Title* djl); void setEU4Country (EU4Country* eu4) {eu4country = eu4;} vector<CK2Character*>::iterator startClaimant () {return claimants.begin();} vector<CK2Character*>::iterator finalClaimant () {return claimants.end();} static Iter startEmpire () {return empires.begin();} static Iter finalEmpire () {return empires.end();} static Iter startLevel (TitleLevel const* const level); static Iter finalLevel (TitleLevel const* const level); private: vector<CK2Character*> claimants; EU4Country* eu4country; CK2Ruler* ruler; CK2Title* deJureLiege; CK2Title* liegeTitle; TitleLevel const* const titleLevel; bool isRebel; static Container empires; static Container kingdoms; static Container duchies; static Container counties; static Container baronies; }; #endif
kingofmen/CK2toEU4
CK2Title.hh
C++
lgpl-3.0
2,154
from test_methods import TestBaseFeedlyClass
pedroma/python-feedly
tests/__init__.py
Python
lgpl-3.0
44
<dibl-sidebar></dibl-sidebar> <div id="page-wrapper" class="gray-bg"> <dibl-header></dibl-header> <dibl-toolbar></dibl-toolbar> <div class="row inquiry"> <div class="col-md-6 wrapper wrapper-content animated fadeInpanel-body"> <div class="ibox-content"> <div class="heading ng-binding"> {{'dibl.inquiry.new-edit.inquiry-metadata' | translate}} <div class="ibox-tools"> <a class="close-link" ng-show="game.accessRights == 1" href="#/inquiry/{{ run.gameId }}/edit" title="{{'dibl.toolbar.edit-structure' | translate }} {{ run.game.title }}"> <i class="fa fa-pencil"></i> </a> </div> </div> <div class="padding"> <div class="ibox-content profile-content"> <form role="form"> <div class="box-body"> <form novalidate> <div class="form-group"> <label for="gameTitle">{{'dibl.inquiry.new-edit.inquiry-title' | translate}}</label> <input required type="name" class="form-control" id="gameTitle" placeholder="{{'dibl.inquiry.new-edit.inquiry-title-placeholder' | translate}}" ng-model="run.title"> </div> </form> <label>{{ 'dibl.inquiry.new-edit.inquiry-description' | translate }}</label> <!--<div summernote></div>--> <text-angular ta-toolbar="[ ['bold','italics'], ['justifyCenter', 'justifyLeft'], ['ul', 'ol'], ['insertImage', 'insertLink','insertVideo']] " ng-model="run.game.description"></text-angular> <!--<text-angular ta-toolbar="[['h1','h2','h3', 'B'], ['html']]"--> <!--id="gameDescription"--> <!--name="description"--> <!--class="hola"--> <!--ng-model="run.game.description"></text-angular>--> </div> </form> <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-times"></i> Discard</a> <a class="btn btn-primary btn-sm" data-toggle="tooltip" data-placement="top" ng-click="ok()" title="Save inquiry"><i class="fa fa-check"></i> {{ 'dibl.inquiry.new-edit.inquiry-save' | translate }}</a> </div> </div> </div> </div> </div> <div class="col-md-6 wrapper wrapper-content animated fadeInpanel-body"> <div class="ibox-content"> <div class="heading ng-binding"> {{ 'dibl.inquiry.new-edit.run-participants' | translate }} </div> <div class="padding"> <div class="ibox-content profile-content"> <div class="row"> <div class="project-list col-md-12"> <table class="table table-hover"> <tbody> <tr ng-repeat="user in usersRun track by $index"> <td class="client-avatar"> <ng-letter-avatar ng-if="user.picture == ''" data="{{ user.name }}"></ng-letter-avatar> <img alt="image" ng-if="user.picture != ''" ng-src="{{ user.picture }}"> </td> <td><a data-toggle="tab" href="#/profile/{{ user.localId }}" class="client-link">{{ user.name }}</a></td> <td class="contact-type"><i class="fa fa-envelope"> </i></td> <td> {{ user.email }}</td> <td> <div class="pull-right"> <button type="button" class="btn btn-sm btn-white" ng-click="removeAccess(run.runId, user)"><i class="fa fa-times"></i> Remove </button> </div> </td> </tr> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> <dibl-footer></dibl-footer> </div>
WELTEN/dojo-ibl
src/main/webapp/src/components/run/inquiry.edit.template.html
HTML
lgpl-3.0
5,766
package com.sqsoft.mars.framework.domain; import java.io.Serializable; import javax.persistence.*; import org.hibernate.annotations.GenericGenerator; import java.util.Date; import java.util.List; /** * The persistent class for the syst_staff database table. * */ @Entity @Table(name="syst_staff") @NamedQuery(name="SystStaff.findAll", query="SELECT s FROM SystStaff s") public class SystStaff implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="STAFF_ID") @GenericGenerator(name="wch_STAFF_ID_GENERATOR", strategy="uuid") @GeneratedValue(generator="wch_STAFF_ID_GENERATOR") private String staffId; @Column(name="ALLOW_LOGIN") private String allowLogin; @Column(name="BIRTHDAY") private String birthday; @Column(name="CODE") private String code; @Temporal(TemporalType.TIMESTAMP) @Column(name="CREATE_TIME") private Date createTime; @Column(name="EMAIL") private String email; @Column(name="GENDER") private String gender; @Column(name="LAST_NAME") private String lastName; @Temporal(TemporalType.TIMESTAMP) @Column(name="LOCK_TIME") private Date lockTime; @Column(name="PASSWD_CHANGED") private String passwdChanged; @Column(name="PASSWORD") private String password; @Column(name="REMARK") private String remark; @Column(name="STAFF_NAME") private String staffName; @Column(name="STATE") private String state; @Column(name="USER_ID") private String userId; //bi-directional many-to-many association to SystRole @ManyToMany @JoinTable( name="syst_staff_role" , joinColumns={ @JoinColumn(name="STAFF_ID") } , inverseJoinColumns={ @JoinColumn(name="ROLE_ID") } ) private List<SystRole> systRoles; public SystStaff() { } public String getStaffId() { return this.staffId; } public void setStaffId(String staffId) { this.staffId = staffId; } public String getAllowLogin() { return this.allowLogin; } public void setAllowLogin(String allowLogin) { this.allowLogin = allowLogin; } public String getBirthday() { return this.birthday; } public void setBirthday(String birthday) { this.birthday = birthday; } public String getCode() { return this.code; } public void setCode(String code) { this.code = code; } public Date getCreateTime() { return this.createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; } public String getGender() { return this.gender; } public void setGender(String gender) { this.gender = gender; } public String getLastName() { return this.lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Date getLockTime() { return this.lockTime; } public void setLockTime(Date lockTime) { this.lockTime = lockTime; } public String getPasswdChanged() { return this.passwdChanged; } public void setPasswdChanged(String passwdChanged) { this.passwdChanged = passwdChanged; } public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } public String getRemark() { return this.remark; } public void setRemark(String remark) { this.remark = remark; } public String getStaffName() { return this.staffName; } public void setStaffName(String staffName) { this.staffName = staffName; } public String getState() { return this.state; } public void setState(String state) { this.state = state; } public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; } public List<SystRole> getSystRoles() { return this.systRoles; } public void setSystRoles(List<SystRole> systRoles) { this.systRoles = systRoles; } }
anndy201/mars-framework
mars-framework-dao/src/main/java/com/sqsoft/mars/framework/domain/SystStaff.java
Java
lgpl-3.0
3,881
int f(){ return 0; } int main(void){ f(); return 0; }
melt-umn/ableC
testing/tests/kframework/positive/j301a.c
C
lgpl-3.0
57
# my_first_hello-world First repository to explore GitHub features # 2017-03-22 11:33 WW changes to README.md # Here I am write a bit about yourself.This is in order to demo the process of making a change in a branch from the master branch
wwolfe2017/my_first_hello-world
README.md
Markdown
lgpl-3.0
240
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #include "deletebudgetresponse.h" #include "deletebudgetresponse_p.h" #include <QDebug> #include <QNetworkReply> #include <QXmlStreamReader> namespace QtAws { namespace Budgets { /*! * \class QtAws::Budgets::DeleteBudgetResponse * \brief The DeleteBudgetResponse class provides an interace for Budgets DeleteBudget responses. * * \inmodule QtAwsBudgets * * The AWS Budgets API enables you to use AWS Budgets to plan your service usage, service costs, and instance reservations. * The API reference provides descriptions, syntax, and usage examples for each of the actions and data types for AWS * Budgets. * * </p * * Budgets provide you with a way to see the following * * information> <ul> <li> * * How close your plan is to your budgeted amount or to the free tier * * limit> </li> <li> * * Your usage-to-date, including how much you've used of your Reserved Instances * * (RIs> </li> <li> * * Your current estimated charges from AWS, and how much your predicted usage will accrue in charges by the end of the * * mont> </li> <li> * * How much of your budget has been * * use> </li> </ul> * * AWS updates your budget status several times a day. Budgets track your unblended costs, subscriptions, refunds, and RIs. * You can create the following types of * * budgets> <ul> <li> * * <b>Cost budgets</b> - Plan how much you want to spend on a * * service> </li> <li> * * <b>Usage budgets</b> - Plan how much you want to use one or more * * services> </li> <li> * * <b>RI utilization budgets</b> - Define a utilization threshold, and receive alerts when your RI usage falls below that * threshold. This lets you see if your RIs are unused or * * under-utilized> </li> <li> * * <b>RI coverage budgets</b> - Define a coverage threshold, and receive alerts when the number of your instance hours that * are covered by RIs fall below that threshold. This lets you see how much of your instance usage is covered by a * * reservation> </li> </ul> * * Service * * Endpoin> * * The AWS Budgets API provides the following * * endpoint> <ul> <li> * * https://budgets.amazonaws.co> </li> </ul> * * For information about costs that are associated with the AWS Budgets API, see <a * href="https://aws.amazon.com/aws-cost-management/pricing/">AWS Cost Management * * \sa BudgetsClient::deleteBudget */ /*! * Constructs a DeleteBudgetResponse object for \a reply to \a request, with parent \a parent. */ DeleteBudgetResponse::DeleteBudgetResponse( const DeleteBudgetRequest &request, QNetworkReply * const reply, QObject * const parent) : BudgetsResponse(new DeleteBudgetResponsePrivate(this), parent) { setRequest(new DeleteBudgetRequest(request)); setReply(reply); } /*! * \reimp */ const DeleteBudgetRequest * DeleteBudgetResponse::request() const { Q_D(const DeleteBudgetResponse); return static_cast<const DeleteBudgetRequest *>(d->request); } /*! * \reimp * Parses a successful Budgets DeleteBudget \a response. */ void DeleteBudgetResponse::parseSuccess(QIODevice &response) { //Q_D(DeleteBudgetResponse); QXmlStreamReader xml(&response); /// @todo } /*! * \class QtAws::Budgets::DeleteBudgetResponsePrivate * \brief The DeleteBudgetResponsePrivate class provides private implementation for DeleteBudgetResponse. * \internal * * \inmodule QtAwsBudgets */ /*! * Constructs a DeleteBudgetResponsePrivate object with public implementation \a q. */ DeleteBudgetResponsePrivate::DeleteBudgetResponsePrivate( DeleteBudgetResponse * const q) : BudgetsResponsePrivate(q) { } /*! * Parses a Budgets DeleteBudget response element from \a xml. */ void DeleteBudgetResponsePrivate::parseDeleteBudgetResponse(QXmlStreamReader &xml) { Q_ASSERT(xml.name() == QLatin1String("DeleteBudgetResponse")); Q_UNUSED(xml) ///< @todo } } // namespace Budgets } // namespace QtAws
pcolby/libqtaws
src/budgets/deletebudgetresponse.cpp
C++
lgpl-3.0
4,704
/* * Functions for testing * * Copyright (C) 2008-2022, Joachim Metz <joachim.metz@gmail.com> * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * 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 Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <common.h> #include <file_stream.h> #include <narrow_string.h> #include <system_string.h> #include <types.h> #include <wide_string.h> #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include <stdlib.h> #endif #include "pff_test_libbfio.h" #include "pff_test_libcerror.h" #include "pff_test_libclocale.h" #include "pff_test_libuna.h" /* Retrieves source as a narrow string * Returns 1 if successful or -1 on error */ int pff_test_get_narrow_source( const system_character_t *source, char *narrow_string, size_t narrow_string_size, libcerror_error_t **error ) { static char *function = "pff_test_get_narrow_source"; size_t narrow_source_size = 0; size_t source_length = 0; #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int result = 0; #endif if( source == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid source.", function ); return( -1 ); } if( narrow_string == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid narrow string.", function ); return( -1 ); } if( narrow_string_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid narrow string size value exceeds maximum.", function ); return( -1 ); } source_length = system_string_length( source ); if( source_length > (size_t) ( SSIZE_MAX - 1 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid source length value out of bounds.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf8_string_size_from_utf32( (libuna_utf32_character_t *) source, source_length + 1, &narrow_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf8_string_size_from_utf16( (libuna_utf16_character_t *) source, source_length + 1, &narrow_source_size, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_byte_stream_size_from_utf32( (libuna_utf32_character_t *) source, source_length + 1, libclocale_codepage, &narrow_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_byte_stream_size_from_utf16( (libuna_utf16_character_t *) source, source_length + 1, libclocale_codepage, &narrow_source_size, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to determine narrow string size.", function ); return( -1 ); } #else narrow_source_size = source_length + 1; #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ if( narrow_string_size < narrow_source_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, "%s: narrow string too small.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf8_string_copy_from_utf32( (libuna_utf8_character_t *) narrow_string, narrow_string_size, (libuna_utf32_character_t *) source, source_length + 1, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf8_string_copy_from_utf16( (libuna_utf8_character_t *) narrow_string, narrow_string_size, (libuna_utf16_character_t *) source, source_length + 1, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_byte_stream_copy_from_utf32( (uint8_t *) narrow_string, narrow_string_size, libclocale_codepage, (libuna_utf32_character_t *) source, source_length + 1, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_byte_stream_copy_from_utf16( (uint8_t *) narrow_string, narrow_string_size, libclocale_codepage, (libuna_utf16_character_t *) source, source_length + 1, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to set narrow string.", function ); return( -1 ); } #else if( system_string_copy( narrow_string, source, source_length ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to set narrow string.", function ); return( -1 ); } narrow_string[ source_length ] = 0; #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ return( 1 ); } #if defined( HAVE_WIDE_CHARACTER_TYPE ) /* Retrieves source as a wide string * Returns 1 if successful or -1 on error */ int pff_test_get_wide_source( const system_character_t *source, wchar_t *wide_string, size_t wide_string_size, libcerror_error_t **error ) { static char *function = "pff_test_get_wide_source"; size_t wide_source_size = 0; size_t source_length = 0; #if !defined( HAVE_WIDE_SYSTEM_CHARACTER ) int result = 0; #endif if( source == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid source.", function ); return( -1 ); } if( wide_string == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid wide string.", function ); return( -1 ); } if( wide_string_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid wide string size value exceeds maximum.", function ); return( -1 ); } source_length = system_string_length( source ); if( source_length > (size_t) ( SSIZE_MAX - 1 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid source length value out of bounds.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) wide_source_size = source_length + 1; #else if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_size_from_utf8( (libuna_utf8_character_t *) source, source_length + 1, &wide_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_size_from_utf8( (libuna_utf8_character_t *) source, source_length + 1, &wide_source_size, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_size_from_byte_stream( (uint8_t *) source, source_length + 1, libclocale_codepage, &wide_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_size_from_byte_stream( (uint8_t *) source, source_length + 1, libclocale_codepage, &wide_source_size, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to determine wide string size.", function ); return( -1 ); } #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ if( wide_string_size < wide_source_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, "%s: wide string too small.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) if( system_string_copy( wide_string, source, source_length ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to set wide string.", function ); return( -1 ); } wide_string[ source_length ] = 0; #else if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_copy_from_utf8( (libuna_utf32_character_t *) wide_string, wide_string_size, (uint8_t *) source, source_length + 1, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_copy_from_utf8( (libuna_utf16_character_t *) wide_string, wide_string_size, (uint8_t *) source, source_length + 1, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_copy_from_byte_stream( (libuna_utf32_character_t *) wide_string, wide_string_size, (uint8_t *) source, source_length + 1, libclocale_codepage, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_copy_from_byte_stream( (libuna_utf16_character_t *) wide_string, wide_string_size, (uint8_t *) source, source_length + 1, libclocale_codepage, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to set wide string.", function ); return( -1 ); } #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ return( 1 ); } #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ /* Creates a file IO handle for test data * Returns 1 if successful or -1 on error */ int pff_test_open_file_io_handle( libbfio_handle_t **file_io_handle, uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "pff_test_open_file_io_handle"; if( file_io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file IO handle.", function ); return( -1 ); } if( libbfio_memory_range_initialize( file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create file IO handle.", function ); goto on_error; } if( libbfio_memory_range_set( *file_io_handle, data, data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set memory range of file IO handle.", function ); goto on_error; } if( libbfio_handle_open( *file_io_handle, LIBBFIO_OPEN_READ, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open file IO handle.", function ); goto on_error; } return( 1 ); on_error: if( *file_io_handle != NULL ) { libbfio_handle_free( file_io_handle, NULL ); } return( -1 ); } /* Closes a file IO handle for test data * Returns 0 if successful or -1 on error */ int pff_test_close_file_io_handle( libbfio_handle_t **file_io_handle, libcerror_error_t **error ) { static char *function = "pff_test_close_file_io_handle"; int result = 0; if( file_io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file IO handle.", function ); return( -1 ); } if( libbfio_handle_close( *file_io_handle, error ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_CLOSE_FAILED, "%s: unable to close file IO handle.", function ); result = -1; } if( libbfio_handle_free( file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free file IO handle.", function ); result = -1; } return( result ); }
libyal/libpff
tests/pff_test_functions.c
C
lgpl-3.0
13,235
package com.sirma.sep.instance.operation.executor; import static com.sirma.itt.seip.instance.actions.ExecutableOperationProperties.CTX_TARGET; import static com.sirma.itt.seip.instance.actions.ExecutableOperationProperties.DMS_ID; import static com.sirma.itt.seip.instance.actions.ExecutableOperationProperties.PERMISSIONS; import java.io.Serializable; import javax.inject.Inject; import org.json.JSONObject; import com.sirma.itt.seip.configuration.Options; import com.sirma.itt.seip.domain.instance.DMSInstance; import com.sirma.itt.seip.domain.instance.DefaultProperties; import com.sirma.itt.seip.domain.instance.Instance; import com.sirma.itt.seip.domain.instance.InstanceReference; import com.sirma.itt.seip.instance.actions.BaseInstanceExecutor; import com.sirma.itt.seip.instance.actions.OperationContext; import com.sirma.itt.seip.instance.actions.OperationResponse; import com.sirma.itt.seip.instance.actions.OperationStatus; import com.sirma.itt.seip.instance.state.Operation; import com.sirma.itt.seip.json.JsonUtil; import com.sirma.itt.seip.permissions.role.RoleService; /** * Base class to implement the import operations. * * @author BBonev */ public abstract class BaseImportInstanceExecutor extends BaseInstanceExecutor { @Inject private RoleService roleService; @Override public OperationContext parseRequest(JSONObject data) { OperationContext context = super.parseRequest(data); context.put(DMS_ID, JsonUtil.getStringValue(data, DMS_ID)); // mark the class as non persisted - we are just importing it InstanceReference reference = context.getIfSameType(CTX_TARGET, InstanceReference.class); idManager.registerId(reference.getId()); InstanceExecutorUtils.extractAdditionalPermissions(data, context, roleService); context.put(PERMISSIONS, (Serializable) InstanceExecutorUtils.extractPermissions(data, PERMISSIONS, resourceService, roleService)); return context; } @Override public OperationResponse execute(OperationContext context) { Instance instance = getOrCreateInstance(context); if (instance instanceof DMSInstance) { String dmsId = context.getIfSameType(DMS_ID, String.class); ((DMSInstance) instance).setDmsId(dmsId); } instance.getProperties().put(DefaultProperties.IS_IMPORTED, Boolean.TRUE); beforeSave(instance, context); Options.DO_NOT_CALL_DMS.enable(); try { Instance savedInstance = getInstanceService().save(instance, new Operation(getOperation())); return new OperationResponse(OperationStatus.COMPLETED, toJson(savedInstance)); } finally { Options.DO_NOT_CALL_DMS.disable(); } } /** * Method called before save of the instance after has been created. * * @param instance * the instance * @param context * the context */ protected void beforeSave(Instance instance, OperationContext context) { // nothing to do here } @Override public boolean rollback(OperationContext data) { // nothing to rollback return true; } }
SirmaITT/conservation-space-1.7.0
docker/sirma-platform/platform/seip-parent/platform/domain-model/instance-core/src/main/java/com/sirma/sep/instance/operation/executor/BaseImportInstanceExecutor.java
Java
lgpl-3.0
2,977
/* Copyright 2012-2014 Infinitycoding all rights reserved This file is part of the universe standart c library. The universe standart c 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 3 of the License, or any later version. The universe standart c 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 the universe standart c library. If not, see <http://www.gnu.org/licenses/>. */ /** * @author Simon Diepold aka. Tdotu <simon.diepold@infinitycoding.de> * @author Andreas Hahn aka. thedrakor * @copyright GNU Lesser Public License */ #include <stdlib.h> #include <stdint.h> #include <c/list.h> /** * @brief Creates a linked list. * @return new list */ list_t *list_create(void) { list_t *list = (list_t *) malloc(sizeof(list_t)); struct list_node *dummy = (struct list_node *) malloc(sizeof(struct list_node)); list->head = dummy; dummy->next = dummy; dummy->prev = dummy; dummy->element = (void *) 0; return list; } /** * @brief Destroys a list. * @param list the list to be destroied */ void list_destroy(list_t *list) { struct list_node *node = list->head->next; struct list_node *head = list->head; while (node != head) { node = node->next; free(node); } free(list); return; } /** * @brief Moves all elements between start and end after target. * @param start Start of the element chain * @param end end of the element chain * @param target Target place */ void list_splice(struct list_node *start, struct list_node *end, struct list_node *target) { start->prev->next = end->next; end->next->prev = start->prev; start->prev = target; end->next = target->next; target->next->prev = end; target->next = start; return; } /** * @brief Adds an element before the dummy element (...|last element|new element|dummy|first entry|...). * @param list the list * @param element the element to be added to the list * @return pointer to the list */ list_t *list_push_back(list_t *list, void *element) { struct list_node *node = (struct list_node *) malloc(sizeof(struct list_node)); node->element = element; node->next = node; node->prev = node; list_splice(node, node, list->head->prev); return list; } /** * @brief Adds an element after of the dummy to a list (...|last element|dummy|new element|first entry|...). * @param list the list * @param element the element to be added to the list * @return pointer to the list */ list_t *list_push_front(list_t *list, void *element) { struct list_node *node = (struct list_node *) malloc(sizeof(struct list_node)); node->element = element; node->next = node; node->prev = node; list_splice(node, node, list->head); return list; } /** * @brief Internal function which removes a specific node from a list. * @param node the node to be removed * @return pointer to the content of the removed element */ void *list_remove_node(struct list_node *node) { void *element = node->element; node->prev->next = node->next; node->next->prev = node->prev; free(node); return element; } /** * @brief Removes the element before the dummy (complementary to list_pop_back). * @param the list * @pointer to the removed element */ void *list_pop_back(list_t *list) { struct list_node *last = list->head->prev; void *element = last->element; last->prev->next = last->next; last->next->prev = last->prev; free(last); return element; } /** * @brief Removes the element after the dummy (complementary to list_pop_front). * @param the list * @pointer to the removed element */ void *list_pop_front(list_t *list) { struct list_node *first = list->head->next; void *element = first->element; first->prev->next = first->next; first->next->prev = first->prev; free(first); return element; } void* list_get_by_int(list_t *list, uintptr_t off, int value) { struct list_node *node = list->head->next; struct list_node *head = list->head; while (node != head) { int val1 = *((int*) ((uintptr_t) node->element + off)); if(val1 == value) { return node->element; } node = node->next; } return NULL; } struct list_node* list_get_node_by_int(list_t *list, uintptr_t off, int value) { struct list_node *node = list->head->next; struct list_node *head = list->head; while (node != head) { int val1 = *((int*) ((uintptr_t) node->element + off)); if(val1 == value) { return node; } node = node->next; } return NULL; } /** * @brief Counts the number of elements in the given list. * @brief list the list * @return number of elements */ int list_length(list_t *list) { struct list_node *node = list->head->next; struct list_node *head = list->head; size_t size = 0; while (node != head) { node = node->next; size++; } return size; } /** * @brief Checks if the given list is empty. * @param list the list * @return true if the list is empty, false if the list contains elements */ bool list_is_empty(list_t *list) { return (list->head == list->head->next); } /** * @breif Creates a new iterator fot a list. * @param list the list * @return the new iterator */ iterator_t iterator_create(list_t *list) { iterator_t new_iterator; new_iterator.list = list; new_iterator.current = list->head->next; return new_iterator; } /** * @brief Inserts an element after the current element which is selected by the iterator. * @param iterator the iterator * @param element the element to be inserted */ void list_insert_after(iterator_t *it, void *element) { struct list_node *node = (struct list_node *) malloc(sizeof(struct list_node)); node->element = element; node->next = node; node->prev = node; list_splice(node, node, it->current); } /** * @brief Inserts an element before the current element which is selected by the iterator. * @param iterator the iterator * @param element the element to be inserted */ void list_insert_before(iterator_t *it, void *element) { struct list_node *node = (struct list_node *) malloc(sizeof(struct list_node)); node->element = element; node->next = node; node->prev = node; list_splice(node, node, it->current->prev); } /** * @brief Get the current element of a list selected by an iterator. * @param the iterator * @return the current element */ void *list_get_current(iterator_t *it) { if(it) if(it->current) return it->current->element; return NULL; } /** * @brief Switches the current element of an iterator to the next element of it's list. (forward) * @param iterator the iterator */ void list_next(iterator_t *it) { it->current = it->current->next; } /** * @brief Switches the current element of an iterator to the previous element of it's list. * @param iterator the iterator */ void list_previous(iterator_t *it) { it->current = it->current->prev; } /** * @brief Checks if the current element is the last before the dummy element or if the list is empty. * @return true if it's the last element, false if it's not. */ bool list_is_last(iterator_t *it) { return (it->current == it->list->head); } /** * @brief Sets the first element after the dummy as current element of an iterator. * @param iterator the iterator */ void list_set_first(iterator_t *it) { it->current = it->list->head->next; } /** * @brief Sets the first element before the dummy as current element of an iterator. * @param iterator the iterator */ void list_set_last(iterator_t *it) { it->current = it->list->head->prev; } /** * @brief Removes the current element from the list and returns it. * @param iterator the iterator * @return the corrent element */ void *list_remove(iterator_t *it) { void *element = list_get_current(it); struct list_node *node = it->current; node->prev->next = node->next; node->next->prev = node->prev; it->current = node->next; free(node); return element; }
infinitycoding/mercury
list.c
C
lgpl-3.0
8,672
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Maker.RiseEngine { public enum LogType { Info, Warning, Error, Message} public static class Debug { public static void WriteLog(string text, LogType logMessageType, string senderName) { Console.WriteLine($"{logMessageType.ToString()} {senderName} {text}"); } } }
MakerDevTeam/MakerRiseProjet
src/Maker.RiseEngine.Core/Debug.cs
C#
lgpl-3.0
450
""" Created on 2013-12-16 @author: readon @copyright: reserved @note: CustomWidget example for mvp """ from gi.repository import Gtk from gi.repository import GObject class CustomEntry(Gtk.Entry): """ custom widget inherit from gtkentry. """ def __init__(self): Gtk.Entry.__init__(self) print "this is a custom widget loading" GObject.type_register(CustomEntry)
Readon/mvpsample
src/gtkcustom.py
Python
lgpl-3.0
414
#!/bin/sh cd bin jar cvfe ../../../build/jar/plc.jar ru.dz.plc.PlcMain . jar xvf ../lib/soot-2.5.0.jar jar cvfe ../../../build/jar/jpc.jar ru.dz.soot.SootMain . # cd ../lib # jar uvfe ../../../build/jar/jpc.jar ru.dz.soot.SootMain ../lib/soot-2.5.0.jar
dzavalishin/phantomuserland
tools/plc/mkjar.sh
Shell
lgpl-3.0
258
/* gdb_hooks.h - Hooks for GDB Stub library Copyright (c) 2018 Ivan Grokhotkov. All right reserved. 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #pragma once #include <user_config.h> #ifdef __cplusplus extern "C" { #endif /** @defgroup GDB GDB debugging support * @{ */ /** * @brief Initialise GDB stub, if present * @note Called by framework at startup, but does nothing if gdbstub is not linked. */ void gdb_init(void); /** * @brief Dynamically enable/disable GDB stub * @param state true to enable, false to disable * @note has no effect if gdbstub is not present * * Calling with `enable = false` overrides configured behaviour as follows: * * - Debug exceptions will be silently ignored * - System exceptions will cause a watchdog reset, as for `GDBSTUB_BREAK_ON_EXCEPTION = 0` * - All incoming serial data is passed through to UART2 without inspection, as for `GDBSTUB_CTRLC_BREAK = 0` * */ void gdb_enable(bool state); /** * @brief Break into GDB, if present */ #ifdef ENABLE_GDB #ifdef ARCH_HOST #define gdb_do_break() __asm__("int $0x03") #else #define gdb_do_break() __asm__("break 0,0") #endif #else #define gdb_do_break() \ do { \ } while(0) #endif typedef enum { eGDB_NotPresent, eGDB_Detached, eGDB_Attached, } GdbState; /** * @brief Check if GDB stub is present */ GdbState gdb_present(void); /** * @brief Called from task queue when GDB attachment status changes * @note User can implement this function to respond to attachment changes */ void gdb_on_attach(bool attached); /** * @brief Detach from GDB, if attached * @note We send GDB an 'exit process' message */ void gdb_detach(); /* * @brief Called by framekwork on unexpected system reset */ void debug_crash_callback(const struct rst_info* rst_info, uint32_t stack, uint32_t stack_end); /** * @brief Send a stack dump to debug output * @param start Start address to output * @param end Output up to - but not including - this address */ void debug_print_stack(uint32_t start, uint32_t end); #ifdef __cplusplus } // extern "C" #endif /** @} */
anakod/Sming
Sming/System/include/gdb/gdb_hooks.h
C
lgpl-3.0
2,947
package fr.univmobile.mobileweb.it; import static fr.univmobile.backend.core.impl.ConnectionType.MYSQL; import static fr.univmobile.it.commons.AppiumCapabilityType.DEVICE; import static fr.univmobile.it.commons.AppiumCapabilityType.DEVICE_NAME; import static fr.univmobile.it.commons.AppiumCapabilityType.PLATFORM_NAME; import static fr.univmobile.it.commons.AppiumCapabilityType.PLATFORM_VERSION; import static org.apache.commons.lang3.CharEncoding.UTF_8; import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME; import static org.openqa.selenium.remote.CapabilityType.PLATFORM; import io.appium.java_client.AppiumDriver; import java.io.File; import java.net.URL; import java.sql.Connection; import java.sql.DriverManager; import org.apache.commons.io.FileUtils; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.OutputType; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import fr.univmobile.backend.it.TestBackend; import fr.univmobile.it.commons.EnvironmentUtils; import fr.univmobile.testutil.PropertiesUtils; public class SimpleAppiumTest { @Before public void setUp() throws Exception { // "/tmp/unm-mobileweb/dataDir" final String dataDir = TestBackend.readMobilewebAppLocalDataDir(new File( "target", "unm-mobileweb-app-local/WEB-INF/web.xml")); final Connection cxn = DriverManager.getConnection( PropertiesUtils.getTestProperty("mysqlUrl"), PropertiesUtils.getTestProperty("mysqlUsername"), PropertiesUtils.getTestProperty("mysqlPassword")); try { TestBackend.setUpData("001", new File(dataDir), MYSQL, cxn); } finally { cxn.close(); } } @Test public void testAppiumSimple() throws Exception { final DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(BROWSER_NAME, "Safari"); capabilities.setCapability(PLATFORM, "Mac"); capabilities.setCapability(PLATFORM_NAME, "iOS"); capabilities.setCapability(PLATFORM_VERSION, EnvironmentUtils.getCurrentPlatformVersion("iOS")); capabilities.setCapability(DEVICE, "iPhone Simulator"); capabilities.setCapability(DEVICE_NAME, // "iPhone Retina (4-inch)"); // "iPhone"); // "iPhone Retina (3.5-inch)"); // capabilities.setCapability(APP, "safari"); final AppiumDriver driver = new AppiumDriver(new URL( "http://localhost:4723/wd/hub"), capabilities); try { driver.get("http://localhost:8380/unm-mobileweb/"); new WebDriverWait(driver, 60).until(ExpectedConditions .presenceOfElementLocated(By.id( // "div-selectedUniversity"))); final File file = // ((TakesScreenshot) augmentedDriver) driver.getScreenshotAs(OutputType.FILE); FileUtils.copyFile(file, new File("target", "home.png")); file.delete(); final String pageSource = driver.getPageSource(); FileUtils.write(new File("target", "home.html"), // pageSource, UTF_8); } finally { driver.quit(); } } }
univmobile/unm-mobileweb
unm-mobileweb-app-local-it/src/test/java/fr/univmobile/mobileweb/it/SimpleAppiumTest.java
Java
lgpl-3.0
3,078
# -*- coding: utf-8 -*- import hashlib import io import struct # default from KeePass2 source BLOCK_LENGTH = 1024 * 1024 try: file_types = (file, io.IOBase) except NameError: file_types = (io.IOBase,) # HEADER_LENGTH = 4+32+4 def read_int(stream, length): try: return struct.unpack('<I', stream.read(length))[0] except Exception: return None class HashedBlockIO(io.BytesIO): """ The data is stored in hashed blocks. Each block consists of a block index (4 bytes), the hash (32 bytes) and the block length (4 bytes), followed by the block data. The block index starts counting at 0. The block hash is a SHA-256 hash of the block data. A block has a maximum length of BLOCK_LENGTH, but can be shorter. Provide a I/O stream containing the hashed block data as the `block_stream` argument when creating a HashedBlockReader. Alternatively the `bytes` argument can be used to hand over data as a string/bytearray/etc. The data is verified upon initialization and an IOError is raised when a hash does not match. HashedBlockReader is a subclass of io.BytesIO. The inherited read, seek, ... functions shall be used to access the verified data. """ def __init__(self, block_stream=None, bytes=None): io.BytesIO.__init__(self) input_stream = None if block_stream is not None: if not (isinstance(block_stream, io.IOBase) or isinstance(block_stream, file_types)): raise TypeError('Stream does not have the buffer interface.') input_stream = block_stream elif bytes is not None: input_stream = io.BytesIO(bytes) if input_stream is not None: self.read_block_stream(input_stream) def read_block_stream(self, block_stream): """ Read the whole block stream into the self-BytesIO. """ if not (isinstance(block_stream, io.IOBase) or isinstance(block_stream, file_types)): raise TypeError('Stream does not have the buffer interface.') while True: data = self._next_block(block_stream) if not self.write(data): break self.seek(0) def _next_block(self, block_stream): """ Read the next block and verify the data. Raises an IOError if the hash does not match. """ index = read_int(block_stream, 4) bhash = block_stream.read(32) length = read_int(block_stream, 4) if length > 0: data = block_stream.read(length) if hashlib.sha256(data).digest() == bhash: return data else: raise IOError('Block hash mismatch error.') return bytes() def write_block_stream(self, stream, block_length=BLOCK_LENGTH): """ Write all data in this buffer, starting at stream position 0, formatted in hashed blocks to the given `stream`. For example, writing data from one file into another as hashed blocks:: # create new hashed block io without input stream or data hb = HashedBlockIO() # read from a file, write into the empty hb with open('sample.dat', 'rb') as infile: hb.write(infile.read()) # write from the hb into a new file with open('hb_sample.dat', 'w') as outfile: hb.write_block_stream(outfile) """ if not (isinstance(stream, io.IOBase) or isinstance(stream, file_types)): raise TypeError('Stream does not have the buffer interface.') index = 0 self.seek(0) while True: data = self.read(block_length) if data: stream.write(struct.pack('<I', index)) stream.write(hashlib.sha256(data).digest()) stream.write(struct.pack('<I', len(data))) stream.write(data) index += 1 else: stream.write(struct.pack('<I', index)) stream.write('\x00' * 32) stream.write(struct.pack('<I', 0)) break
AlessandroZ/LaZagne
Windows/lazagne/softwares/memory/libkeepass/hbio.py
Python
lgpl-3.0
4,214
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development * and Distribution License("CDDL") (collectively, the "License"). You * may not use this file except in compliance with the License. You can obtain * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt. * Sun designates this particular file as subject to the "Classpath" exception * as provided by Sun in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the License * Header, with the fields enclosed by brackets [] replaced by your own * identifying information: "Portions Copyrighted [year] * [name of copyright owner]" * * Contributor(s): * * If you wish your version of this file to be governed by only the CDDL or * only the GPL Version 2, indicate your decision by adding "[Contributor] * elects to include this software in this distribution under the [CDDL or GPL * Version 2] license." If you don't indicate a single choice of license, a * recipient has the option to distribute your version of this file under * either the CDDL, the GPL Version 2 or to extend the choice of license to * its licensees as provided above. However, if you add GPL Version 2 code * and therefore, elected the GPL Version 2 license, then the option applies * only if the new code is made subject to such option by the copyright * holder. */ package com.sun.xml.bind.v2.model.runtime; import java.lang.reflect.Type; import com.sun.xml.bind.v2.model.core.TypeInfo; /** * @author Kohsuke Kawaguchi */ public interface RuntimeTypeInfo extends TypeInfo<Type,Class> { }
B3Partners/b3p-commons-csw
src/main/jaxb/jaxb-ri-20090708/lib/jaxb-impl.src/com/sun/xml/bind/v2/model/runtime/RuntimeTypeInfo.java
Java
lgpl-3.0
2,170
################################################################################### # # Copyright (c) 2017-2019 MuK IT GmbH. # # This file is part of MuK Documents Access # (see https://mukit.at). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ################################################################################### from odoo import models, fields, api class AccessGroups(models.Model): _inherit = 'muk_security.access_groups' #---------------------------------------------------------- # Database #---------------------------------------------------------- directories = fields.Many2many( comodel_name='muk_dms.directory', relation='muk_dms_directory_groups_rel', string="Directories", column1='gid', column2='aid', readonly=True) count_directories = fields.Integer( compute='_compute_count_directories', string="Count Directories") #---------------------------------------------------------- # Read, View #---------------------------------------------------------- @api.depends('directories') def _compute_count_directories(self): for record in self: record.count_directories = len(record.directories)
muk-it/muk_dms
muk_dms_access/models/access_groups.py
Python
lgpl-3.0
1,927
<?php namespace Cyantree\Grout\Checks; use Cyantree\Grout\Checks\Check; use Cyantree\Grout\Types\FileUpload; class IsFile extends Check { public $id = 'isFile'; public function isValid($fileUploadOrPath) { if ($fileUploadOrPath instanceof FileUpload) { if (!is_file($fileUploadOrPath->file)) { return false; } } else { if (!is_file($fileUploadOrPath)) { return false; } } return true; } }
cyantree/grout-experimental
Checks/IsFile.php
PHP
lgpl-3.0
521
/*************************************************** * * cismet GmbH, Saarbruecken, Germany * * ... and it just works. * ****************************************************/ /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package de.cismet.watergis.gui.dialog; import java.awt.Color; import javax.swing.DefaultListModel; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import de.cismet.cids.custom.beans.watergis.Bookmark; import de.cismet.watergis.broker.AppBroker; import de.cismet.watergis.gui.actions.bookmarks.DeleteBookmarkAction; import de.cismet.watergis.gui.actions.bookmarks.LoadBookmarksAction; import de.cismet.watergis.gui.actions.bookmarks.ZoomBookmarkInMapAction; /** * DOCUMENT ME! * * @author Gilles Baatz * @version $Revision$, $Date$ */ public class ManageBookmarksDialog extends javax.swing.JDialog { //~ Instance fields -------------------------------------------------------- private DocumentListener txtNameDocumentListener; private DocumentListener txtaDescriptionDocumentListener; // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnDelete; private javax.swing.JButton btnLoad; private javax.swing.JButton btnPan; private javax.swing.JButton btnSave; private javax.swing.JButton btnZoom; private de.cismet.watergis.gui.actions.bookmarks.DeleteBookmarkAction deleteBookmarkAction; private javax.swing.Box.Filler filler1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JLabel lblDescription; private javax.swing.JLabel lblName; private de.cismet.watergis.gui.actions.bookmarks.LoadBookmarksAction loadBookmarksAction; private javax.swing.JList lstBookmarks; private de.cismet.watergis.gui.actions.bookmarks.SaveBookmarksAction saveBookmarksAction; private de.cismet.watergis.gui.actions.bookmarks.PanBookmarkInMapAction showBookmarkInMapAction; private javax.swing.JTextField txtName; private javax.swing.JTextArea txtaDescription; private de.cismet.watergis.gui.actions.bookmarks.ZoomBookmarkInMapAction zoomBookmarkInMapAction; // End of variables declaration//GEN-END:variables //~ Constructors ----------------------------------------------------------- /** * Creates new form ManageBookmarksDialog. * * @param parent DOCUMENT ME! * @param modal DOCUMENT ME! */ public ManageBookmarksDialog(final java.awt.Frame parent, final boolean modal) { super(parent, modal); initComponents(); initDocumentListener(); addDocumentListeners(); enableComponents(false); } //~ Methods ---------------------------------------------------------------- /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The * content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; showBookmarkInMapAction = new de.cismet.watergis.gui.actions.bookmarks.PanBookmarkInMapAction(this); deleteBookmarkAction = new DeleteBookmarkAction(this); zoomBookmarkInMapAction = new ZoomBookmarkInMapAction(this); saveBookmarksAction = new de.cismet.watergis.gui.actions.bookmarks.SaveBookmarksAction(); loadBookmarksAction = new LoadBookmarksAction(this); jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); lstBookmarks = new javax.swing.JList(); lblName = new javax.swing.JLabel(); txtName = new javax.swing.JTextField(); lblDescription = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); txtaDescription = new javax.swing.JTextArea(); filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0)); jPanel2 = new javax.swing.JPanel(); btnLoad = new javax.swing.JButton(); btnSave = new javax.swing.JButton(); btnZoom = new javax.swing.JButton(); btnDelete = new javax.swing.JButton(); btnPan = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle(org.openide.util.NbBundle.getMessage(ManageBookmarksDialog.class, "ManageBookmarksDialog.title")); // NOI18N setPreferredSize(new java.awt.Dimension(471, 441)); addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowOpened(final java.awt.event.WindowEvent evt) { formWindowOpened(evt); } }); jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 7, 7, 7)); jPanel1.setLayout(new java.awt.GridBagLayout()); lstBookmarks.setMaximumSize(new java.awt.Dimension(32767, 32767)); lstBookmarks.addListSelectionListener(new javax.swing.event.ListSelectionListener() { @Override public void valueChanged(final javax.swing.event.ListSelectionEvent evt) { lstBookmarksValueChanged(evt); } }); jScrollPane1.setViewportView(lstBookmarks); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(1, 0, 3, 0); jPanel1.add(jScrollPane1, gridBagConstraints); org.openide.awt.Mnemonics.setLocalizedText( lblName, org.openide.util.NbBundle.getMessage(ManageBookmarksDialog.class, "ManageBookmarksDialog.lblName.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(5, 0, 4, 2); jPanel1.add(lblName, gridBagConstraints); txtName.setText(org.openide.util.NbBundle.getMessage( ManageBookmarksDialog.class, "ManageBookmarksDialog.txtName.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 2, 4, 0); jPanel1.add(txtName, gridBagConstraints); org.openide.awt.Mnemonics.setLocalizedText( lblDescription, org.openide.util.NbBundle.getMessage( ManageBookmarksDialog.class, "ManageBookmarksDialog.lblDescription.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(5, 0, 4, 2); jPanel1.add(lblDescription, gridBagConstraints); jScrollPane2.setPreferredSize(new java.awt.Dimension(258, 125)); txtaDescription.setColumns(20); txtaDescription.setRows(5); txtaDescription.setPreferredSize(new java.awt.Dimension(250, 120)); jScrollPane2.setViewportView(txtaDescription); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 4; gridBagConstraints.gridheight = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.5; gridBagConstraints.insets = new java.awt.Insets(5, 2, 4, 0); jPanel1.add(jScrollPane2, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; jPanel1.add(filler1, gridBagConstraints); jPanel2.setLayout(new java.awt.GridBagLayout()); btnLoad.setAction(loadBookmarksAction); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(3, 0, 0, 4); jPanel2.add(btnLoad, gridBagConstraints); btnSave.setAction(saveBookmarksAction); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(3, 0, 0, 4); jPanel2.add(btnSave, gridBagConstraints); btnZoom.setAction(zoomBookmarkInMapAction); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(3, 0, 0, 4); jPanel2.add(btnZoom, gridBagConstraints); btnDelete.setAction(deleteBookmarkAction); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(3, 4, 0, 0); jPanel2.add(btnDelete, gridBagConstraints); btnPan.setAction(showBookmarkInMapAction); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(3, 4, 0, 4); jPanel2.add(btnPan, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = 6; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel1.add(jPanel2, gridBagConstraints); getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); pack(); } // </editor-fold>//GEN-END:initComponents /** * DOCUMENT ME! * * @param evt DOCUMENT ME! */ private void formWindowOpened(final java.awt.event.WindowEvent evt) { //GEN-FIRST:event_formWindowOpened updateModel(); } //GEN-LAST:event_formWindowOpened /** * DOCUMENT ME! * * @param evt DOCUMENT ME! */ private void lstBookmarksValueChanged(final javax.swing.event.ListSelectionEvent evt) { //GEN-FIRST:event_lstBookmarksValueChanged final Bookmark bookmark = (Bookmark)lstBookmarks.getSelectedValue(); if (bookmark != null) { txtName.setText(bookmark.getName()); txtaDescription.setText(bookmark.getDescription()); enableComponents(true); } else { removeDocumentListeners(); txtName.setText(""); txtaDescription.setText(""); enableComponents(false); addDocumentListeners(); } } //GEN-LAST:event_lstBookmarksValueChanged /** * DOCUMENT ME! */ public void updateModel() { final DefaultListModel<Bookmark> model = new DefaultListModel<Bookmark>(); for (final Bookmark b : AppBroker.getInstance().getBookmarkManager().getBookmarks()) { model.addElement(b); } lstBookmarks.setModel(model); } /** * DOCUMENT ME! */ private void initDocumentListener() { txtNameDocumentListener = new DocumentListener() { @Override public void insertUpdate(final DocumentEvent e) { updateBookMarkName(); } @Override public void removeUpdate(final DocumentEvent e) { updateBookMarkName(); } @Override public void changedUpdate(final DocumentEvent e) { updateBookMarkName(); } }; txtaDescriptionDocumentListener = new DocumentListener() { @Override public void insertUpdate(final DocumentEvent e) { updateBookMarkDescription(); } @Override public void removeUpdate(final DocumentEvent e) { updateBookMarkDescription(); } @Override public void changedUpdate(final DocumentEvent e) { updateBookMarkDescription(); } }; } /** * DOCUMENT ME! */ private void updateBookMarkName() { final Bookmark bookmark = (Bookmark)lstBookmarks.getSelectedValue(); final String bookmarkName = txtName.getText().trim(); if ((bookmarkName == null) || bookmarkName.equals("")) { txtName.setBackground(Color.red); } else { bookmark.setName(txtName.getText()); txtName.setBackground(Color.white); } } /** * DOCUMENT ME! */ private void updateBookMarkDescription() { final Bookmark bookmark = (Bookmark)lstBookmarks.getSelectedValue(); bookmark.setDescription(txtaDescription.getText()); } /** * DOCUMENT ME! * * @param args the command line arguments */ public static void main(final String[] args) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (final javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(ManageBookmarksDialog.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ManageBookmarksDialog.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ManageBookmarksDialog.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ManageBookmarksDialog.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { final ManageBookmarksDialog dialog = new ManageBookmarksDialog(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(final java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ public Bookmark getSelectedBookmark() { return (Bookmark)lstBookmarks.getSelectedValue(); } /** * DOCUMENT ME! * * @param bookmark DOCUMENT ME! */ public void removeBookmarkFromList(final Bookmark bookmark) { ((DefaultListModel)lstBookmarks.getModel()).removeElement(bookmark); } /** * DOCUMENT ME! * * @param b DOCUMENT ME! */ private void enableComponents(final boolean b) { btnDelete.setEnabled(b); btnPan.setEnabled(b); btnZoom.setEnabled(b); txtaDescription.setEnabled(b); txtName.setEnabled(b); } /** * DOCUMENT ME! */ private void addDocumentListeners() { txtName.getDocument().addDocumentListener(txtNameDocumentListener); txtaDescription.getDocument().addDocumentListener(txtaDescriptionDocumentListener); } /** * DOCUMENT ME! */ private void removeDocumentListeners() { txtName.getDocument().removeDocumentListener(txtNameDocumentListener); txtaDescription.getDocument().removeDocumentListener(txtaDescriptionDocumentListener); } }
cismet/watergis-client
src/main/java/de/cismet/watergis/gui/dialog/ManageBookmarksDialog.java
Java
lgpl-3.0
18,326
namespace System { /** * 系统总初始化函数 */ export function Init() { let CreateProcess=ProcessCore.CreateProcessByCode; let sign=CreateProcess(` onmessage=function(){ for(let i=0;i<100;++i){console.log(i);} postMessage({operation:"Post",data:{DestType:"System",Dest:"test",Data:"hello world"}}); } `); MessageCore.SystemDestRegist("test",(msg:DataType.IMessage)=>{ alert(JSON.stringify(msg)); }); } }
gmono/PlOS
System/Init.ts
TypeScript
lgpl-3.0
532
var searchData= [ ['hisconst',['HISConst',['../namespaceglados_1_1loaders.html#ac429e94c883bc55092765c8bf14dbe29',1,'glados::loaders']]] ];
HZDR-FWDF/RISA
docs/search/enums_2.js
JavaScript
lgpl-3.0
142
/** Game Of Life (Display) */ #include "BlueDisplay.h" #include "GameOfLife.h" #include "main.h" // for StringBuffer #include "timing.h" #include "stdlib.h" #include <stdio.h> uint16_t generation = 0; uint16_t drawcolor[5]; uint8_t (*frame)[GOL_Y_SIZE]; uint8_t alive(uint8_t x, uint8_t y) { if ((x < GOL_X_SIZE)&& (y < GOL_Y_SIZE)){ if (frame[x][y] & ON_CELL) { return 1; } } return 0; } uint8_t neighbors(uint8_t x, uint8_t y) { uint8_t count = 0; //3 above if (alive(x - 1, y - 1)) { count++; } if (alive(x, y - 1)) { count++; } if (alive(x + 1, y - 1)) { count++; } //2 on each side if (alive(x - 1, y)) { count++; } if (alive(x + 1, y)) { count++; } //3 below if (alive(x - 1, y + 1)) { count++; } if (alive(x, y + 1)) { count++; } if (alive(x + 1, y + 1)) { count++; } return count; } void play_gol(void) { uint8_t x, y, count; //update cells for (x = 0; x < GOL_X_SIZE; x++) { for (y = 0; y < GOL_Y_SIZE; y++) { count = neighbors(x, y); if ((count == 3) && !alive(x, y)) { frame[x][y] = NEW_CELL; //new cell } if (((count < 2) || (count > 3)) && alive(x, y)) { frame[x][y] |= NEW_DEL_CELL; //cell dies } } } //increment generation if (++generation > GOL_MAX_GEN) { init_gol(); } } void draw_gol(void) { uint8_t c, x, y, color = 0; uint16_t px, py; for (x = 0, px = 0; x < GOL_X_SIZE; x++) { for (y = 0, py = 0; y < GOL_Y_SIZE; y++) { c = frame[x][y]; if (c) { if (c & NEW_CELL) { //new frame[x][y] = ON_CELL; color = ALIVE_COLOR; } else if (c & NEW_DEL_CELL) { //die 1. time -> clear alive Bits and decrease die count frame[x][y] = 2; color = DIE2_COLOR; } else if (c == 2) { //die frame[x][y] = 1; color = DIE1_COLOR; } else if (c == 1) { //delete frame[x][y] = 0; color = DEAD_COLOR; } if (c != ON_CELL) { BlueDisplay1.fillRect(px + 1, py + 1, px + (BlueDisplay1.getDisplayWidth() / GOL_X_SIZE)- 2, py + (BlueDisplay1.getDisplayHeight() / GOL_Y_SIZE) - 2, drawcolor[color]); } } py += (BlueDisplay1.getDisplayHeight() / GOL_Y_SIZE); } px += (BlueDisplay1.getDisplayWidth() / GOL_X_SIZE); } } /** * switch color scheme */ void init_gol(void) { int x, y; uint32_t c; generation = 0; //change color drawcolor[DEAD_COLOR] = RGB( 255, 255, 255); switch (drawcolor[ALIVE_COLOR]) { case RGB( 0,255, 0): //RGB(255, 0, 0) drawcolor[BG_COLOR] = RGB( 0, 180, 180); drawcolor[ALIVE_COLOR] = RGB(255, 0, 0); drawcolor[DIE1_COLOR] = RGB( 130, 0, 0); drawcolor[DIE2_COLOR] = RGB(180, 0, 0); break; case RGB( 0, 0,255): //RGB( 0,255, 0) drawcolor[BG_COLOR] = RGB( 180, 0, 180); drawcolor[ALIVE_COLOR] = RGB( 0,255, 0); drawcolor[DIE1_COLOR] = RGB( 0, 130, 0); drawcolor[DIE2_COLOR] = RGB( 0,180, 0); break; default: //RGB( 0, 0,255) drawcolor[BG_COLOR] = RGB(180, 180, 0); drawcolor[ALIVE_COLOR] = RGB( 0, 0,255); drawcolor[DIE1_COLOR] = RGB( 0, 0, 130); drawcolor[DIE2_COLOR] = RGB( 0, 0,180); break; } if (!GolShowDying) { // change colors drawcolor[DIE1_COLOR] = RGB( 255, 255, 255); drawcolor[DIE2_COLOR] = RGB( 255, 255, 255); } //generate random start data srand(getMillisSinceBoot()); for (x = 0; x < GOL_X_SIZE; x++) { c = (rand() | (rand() << 16)) & 0xAAAAAAAA; //0xAAAAAAAA 0x33333333 0xA924A924 for (y = 0; y < GOL_Y_SIZE; y++) { if (c & (1 << y)) { frame[x][y] = ON_CELL; } else { frame[x][y] = 0; } } } ClearScreenAndDrawGameOfLifeGrid(); } void ClearScreenAndDrawGameOfLifeGrid(void) { int px, py; int x, y; BlueDisplay1.clearDisplay(drawcolor[BG_COLOR]); //clear cells for (x = 0, px = 0; x < GOL_X_SIZE; x++) { for (y = 0, py = 0; y < GOL_Y_SIZE; y++) { BlueDisplay1.fillRect(px + 1, py + 1, px - 2 + (BlueDisplay1.getDisplayWidth() / GOL_X_SIZE), py + (BlueDisplay1.getDisplayHeight() / GOL_Y_SIZE) - 2, drawcolor[DEAD_COLOR]); py += (BlueDisplay1.getDisplayHeight() / GOL_Y_SIZE); } px += (BlueDisplay1.getDisplayWidth() / GOL_X_SIZE); } } void drawGenerationText(void) { //draw current generation snprintf(sStringBuffer, sizeof sStringBuffer, "Gen.%3d", generation); BlueDisplay1.drawText(0, TEXT_SIZE_11_ASCEND, sStringBuffer, TEXT_SIZE_11, RGB(50,50,50), drawcolor[DEAD_COLOR]); } void test(void) { frame[2][2] = ON_CELL; frame[3][2] = ON_CELL; frame[4][2] = ON_CELL; frame[6][2] = ON_CELL; frame[7][2] = ON_CELL; frame[6][3] = ON_CELL; frame[7][3] = ON_CELL; }
ArminJo/STMF3-Discovery-Demos
src/GameOfLife.cpp
C++
lgpl-3.0
5,670
<?php /* * This file is part of the foomo Opensource Framework. * * The foomo Opensource Framework is free software: you can redistribute it * and/or modify it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * The foomo Opensource Framework 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 * the foomo Opensource Framework. If not, see <http://www.gnu.org/licenses/>. */ namespace Foomo\MVC\Mock\Frontend\Controller; /** * @link www.foomo.org * @license www.gnu.org/licenses/lgpl.txt * @author jan */ use Foomo\MVC\Controller\AbstractAction; class ActionFoo extends AbstractAction { public function run($bla, $blubb) { $this->app->model->test = $bla . $blubb; } }
foomo/Foomo
tests/Foomo/MVC/Mock/Frontend/Controller/ActionFoo.php
PHP
lgpl-3.0
1,105
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OpenMI.Standard2.SuggestedChanges.Space { public interface ISpaceOutput : ISpaceExchangeItemNew { ///<summary> /// Overridden version of the <see cref="IBaseOutput.GetValues"/> method. /// <see cref="GetValues"/> now returns an <see cref="ITimeSpaceValueSet"/>, /// instead of an <see cref="IBaseValueSet"/>. /// </summary> new ISpaceValueSet GetValues(IBaseExchangeItem querySpecifier); } }
cbuahin/OpenMI
Source/csharp/OpenMI.Standard2/SuggestedChanges/Space/ISpaceOutput.cs
C#
lgpl-3.0
582
/* * SonarLint for Visual Studio * Copyright (C) 2015 SonarSource * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ using System.Collections.Immutable; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using SonarLint.Common; using SonarLint.Common.Sqale; using SonarLint.Helpers; namespace SonarLint.Rules { [DiagnosticAnalyzer(LanguageNames.CSharp)] [SqaleConstantRemediation("2min")] [SqaleSubCharacteristic(SqaleSubCharacteristic.Readability)] [Rule(DiagnosticId, RuleSeverity, Title, IsActivatedByDefault)] [Tags("unused")] public class RedundantParentheses : DiagnosticAnalyzer { internal const string DiagnosticId = "S3235"; internal const string Title = "Redundant parentheses should not be used"; internal const string Description = "Redundant parentheses are simply wasted keystrokes, and should be removed."; internal const string MessageFormat = "Remove these redundant parentheses."; internal const string Category = "SonarQube"; internal const Severity RuleSeverity = Severity.Minor; internal const bool IsActivatedByDefault = true; private const IdeVisibility ideVisibility = IdeVisibility.Hidden; internal static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, RuleSeverity.ToDiagnosticSeverity(ideVisibility), IsActivatedByDefault, helpLinkUri: DiagnosticId.GetHelpLink(), description: Description, customTags: ideVisibility.ToCustomTags()); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } } public override void Initialize(AnalysisContext context) { context.RegisterSyntaxNodeActionInNonGenerated( c => { var argumentList = (AttributeArgumentListSyntax)c.Node; if (!argumentList.Arguments.Any()) { c.ReportDiagnostic(Diagnostic.Create(Rule, argumentList.GetLocation())); } }, SyntaxKind.AttributeArgumentList); context.RegisterSyntaxNodeActionInNonGenerated( c => { var objectCreation = (ObjectCreationExpressionSyntax)c.Node; var argumentList = objectCreation.ArgumentList; if (argumentList != null && objectCreation.Initializer != null && !argumentList.Arguments.Any()) { c.ReportDiagnostic(Diagnostic.Create(Rule, argumentList.GetLocation())); } }, SyntaxKind.ObjectCreationExpression); } } }
peterstevens130561/sonarlint-vs
src/SonarLint/Rules/RedundantParentheses.cs
C#
lgpl-3.0
3,725
# # The videos were made with QuickTime on OS X, default # settings, except with the internal microphone turned off. # # QuickTime produces H.264 codec quicktime vidoes (*.mov). # QuickTime does export into other formats, but they are all H.264. # For cross browser compatability (as of Feb. 2012), one must # provide H.264 and either Theora or VP8 (webm) codecs. # # Aim for # H.264 codec with mpeg 4 (*.mp4) # theora codec with ogg (*.ogv) # # Full details at: # http://wiki.videolan.org/Documentation:Streaming_HowTo/Advanced_Streaming_Using_the_Command_Line # mp4 := $(patsubst %.mov,%.mp4,$(wildcard *.mov)) ogv := $(patsubst %.mov,%.ogv,$(wildcard *.mov)) convert: $(ogv) $(mp4) convert-ogv: $(ogv) convert-mp4: $(mp4) # # To see what the UI conversion is, open the Messages window # and set verbosity level to 1 or higher. The transcode settings # are shown there. # # Sadly, it looks like transcode cannot adjust audio volume. # %.mp4: %.mov cvlc -v "$<" --sout="#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:file{dst='$@'}" vlc://quit # %.ogv: %.mov cvlc -v "$<" --sout="#transcode{vcodec=theo,vb=800,scale=1,acodec=vorb,ab=128,channels=2,samplerate=44100}:file{dst='$@'}" vlc://quit
bvds/andes
review/tutorial-videos/Makefile
Makefile
lgpl-3.0
1,274
endor_arachne_webmaster_lair_neutral_small = Lair:new { mobiles = {}, spawnLimit = 15, buildingsVeryEasy = {}, buildingsEasy = {}, buildingsMedium = {}, buildingsHard = {}, buildingsVeryHard = {}, } addLairTemplate("endor_arachne_webmaster_lair_neutral_small", endor_arachne_webmaster_lair_neutral_small)
kidaa/Awakening-Core3
bin/scripts/mobile/lair/creature_lair/endor_arachne_webmaster_lair_neutral_small.lua
Lua
lgpl-3.0
313
global_brigand_highwayman_camp_neutral_large_theater = Lair:new { mobiles = {}, spawnLimit = 15, buildingsVeryEasy = {}, buildingsEasy = {}, buildingsMedium = {}, buildingsHard = {}, buildingsVeryHard = {}, } addLairTemplate("global_brigand_highwayman_camp_neutral_large_theater", global_brigand_highwayman_camp_neutral_large_theater)
kidaa/Awakening-Core3
bin/scripts/mobile/lair/npc_theater/global_brigand_highwayman_camp_neutral_large_theater.lua
Lua
lgpl-3.0
343
<?php use ch\hnm\util\n2n\textblocks\model\TextBlockExportForm; use n2n\impl\web\ui\view\html\HtmlView; use n2n\l10n\Message; $view = HtmlView::view($view); $html = HtmlView::html($view); $formHtml = HtmlView::formHtml($view); $textBlockExportForm = $view->getParam('textBlockExportForm'); $view->assert($textBlockExportForm instanceof TextBlockExportForm); try { $view->useTemplate('\bstmpl\view\bsTemplate.html', array('title' => 'Textblocks')); } catch (\n2n\core\TypeNotFoundException $e) { $view->useTemplate('template.html', ['title' => 'Textblocks']); } // $bootstrapFormHtml = new BsFormHtmlBuilder($view); ?> <?php $html->messageList(null, Message::SEVERITY_INFO, array('class' => 'alert alert-info list-unstyled')) ?> <?php $formHtml->open($textBlockExportForm, null, null, array('class' => 'form-horizontal')) ?> <div class="form-group"> <h2>Select Modules</h2> <div class=""> <?php foreach ($textBlockExportForm->getModuleNamespaceOptions() as $moduleNamespace => $moduleName): ?> <label class="checkbox"> <?php $formHtml->inputCheckbox('selectedModuleNamespaces[' . $moduleNamespace . ']', $moduleNamespace) ?> <?php $html->out($moduleNamespace) ?> </label> <?php endforeach ?> </div> </div> <div class="form-group"> <h2> Select Locales </h2> <div class=""> <?php foreach (TextBlockExportForm::getLocaleIdOptions() as $localeId => $localeName): ?> <label class="checkbox"> <?php $formHtml->inputCheckbox('selectedLocaleIds[' . $localeId . ']', $localeId) ?> <?php $html->out($localeName) ?> </label> <?php endforeach ?> </div> </div> <div class="form-group"> <h2> Existing Language Keys </h2> <label class="radio"> <?php $formHtml->inputRadio('skipTranslated', true) ?> Skip existing Language Keys </label> <label class="radio"> <?php $formHtml->inputRadio('skipTranslated', false) ?> Print Translations </label> </div> <div> <?php $formHtml->inputSubmit('export', 'Language Files Exportieren', array('class' => 'btn btn-block')) ?> </div> <?php $formHtml->close() ?>
hnm/ch-hnm-util
src/app/ch/hnm/util/n2n/textblocks/view/export.html.php
PHP
lgpl-3.0
2,170
/****************************************************************************** * Copyright (C) 2015 by Ralf Kaestner * * ralf.kaestner@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the Lesser 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 * * Lesser GNU General Public License for more details. * * * * You should have received a copy of the Lesser GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ #include <QColorDialog> #include <QFileDialog> #include <ros/package.h> #include <rqt_multiplot/PlotTableWidget.h> #include <rqt_multiplot/PlotWidget.h> #include <ui_PlotTableConfigWidget.h> #include "rqt_multiplot/PlotTableConfigWidget.h" namespace rqt_multiplot { /*****************************************************************************/ /* Constructors and Destructor */ /*****************************************************************************/ PlotTableConfigWidget::PlotTableConfigWidget(QWidget* parent) : QWidget(parent), ui_(new Ui::PlotTableConfigWidget()), menuImportExport_(new QMenu(this)), config_(0), plotTable_(0) { ui_->setupUi(this); ui_->labelBackgroundColor->setAutoFillBackground(true); ui_->labelForegroundColor->setAutoFillBackground(true); ui_->widgetProgress->setEnabled(false); ui_->pushButtonRun->setIcon( QIcon(QString::fromStdString(ros::package::getPath("rqt_multiplot"). append("/resource/16x16/run.png")))); ui_->pushButtonPause->setIcon( QIcon(QString::fromStdString(ros::package::getPath("rqt_multiplot"). append("/resource/16x16/pause.png")))); ui_->pushButtonClear->setIcon( QIcon(QString::fromStdString(ros::package::getPath("rqt_multiplot"). append("/resource/16x16/clear.png")))); ui_->pushButtonImportExport->setIcon( QIcon(QString::fromStdString(ros::package::getPath("rqt_multiplot"). append("/resource/16x16/eject.png")))); ui_->pushButtonPause->setEnabled(false); menuImportExport_->addAction("Import from bag file...", this, SLOT(menuImportBagFileTriggered())); menuImportExport_->addSeparator(); menuImportExport_->addAction("Export to image file...", this, SLOT(menuExportImageFileTriggered())); menuImportExport_->addAction("Export to text file...", this, SLOT(menuExportTextFileTriggered())); connect(ui_->spinBoxRows, SIGNAL(valueChanged(int)), this, SLOT(spinBoxRowsValueChanged(int))); connect(ui_->spinBoxColumns, SIGNAL(valueChanged(int)), this, SLOT(spinBoxColumnsValueChanged(int))); connect(ui_->checkBoxLinkScale, SIGNAL(stateChanged(int)), this, SLOT(checkBoxLinkScaleStateChanged(int))); connect(ui_->checkBoxLinkCursor, SIGNAL(stateChanged(int)), this, SLOT(checkBoxLinkCursorStateChanged(int))); connect(ui_->checkBoxTrackPoints, SIGNAL(stateChanged(int)), this, SLOT(checkBoxTrackPointsStateChanged(int))); connect(ui_->pushButtonRun, SIGNAL(clicked()), this, SLOT(pushButtonRunClicked())); connect(ui_->pushButtonPause, SIGNAL(clicked()), this, SLOT(pushButtonPauseClicked())); connect(ui_->pushButtonClear, SIGNAL(clicked()), this, SLOT(pushButtonClearClicked())); connect(ui_->pushButtonImportExport, SIGNAL(clicked()), this, SLOT(pushButtonImportExportClicked())); ui_->labelBackgroundColor->installEventFilter(this); ui_->labelForegroundColor->installEventFilter(this); } PlotTableConfigWidget::~PlotTableConfigWidget() { delete ui_; } /*****************************************************************************/ /* Accessors */ /*****************************************************************************/ void PlotTableConfigWidget::setConfig(PlotTableConfig* config) { if (config != config_) { if (config_) { disconnect(config_, SIGNAL(backgroundColorChanged(const QColor&)), this, SLOT(configBackgroundColorChanged(const QColor&))); disconnect(config_, SIGNAL(foregroundColorChanged(const QColor&)), this, SLOT(configForegroundColorChanged(const QColor&))); disconnect(config_, SIGNAL(numPlotsChanged(size_t, size_t)), this, SLOT(configNumPlotsChanged(size_t, size_t))); disconnect(config_, SIGNAL(linkScaleChanged(bool)), this, SLOT(configLinkScaleChanged(bool))); disconnect(config_, SIGNAL(linkCursorChanged(bool)), this, SLOT(configLinkCursorChanged(bool))); disconnect(config_, SIGNAL(trackPointsChanged(bool)), this, SLOT(configTrackPointsChanged(bool))); } config_ = config; if (config) { connect(config, SIGNAL(backgroundColorChanged(const QColor&)), this, SLOT(configBackgroundColorChanged(const QColor&))); connect(config, SIGNAL(foregroundColorChanged(const QColor&)), this, SLOT(configForegroundColorChanged(const QColor&))); connect(config, SIGNAL(numPlotsChanged(size_t, size_t)), this, SLOT(configNumPlotsChanged(size_t, size_t))); connect(config, SIGNAL(linkScaleChanged(bool)), this, SLOT(configLinkScaleChanged(bool))); connect(config, SIGNAL(linkCursorChanged(bool)), this, SLOT(configLinkCursorChanged(bool))); connect(config, SIGNAL(trackPointsChanged(bool)), this, SLOT(configTrackPointsChanged(bool))); configBackgroundColorChanged(config->getBackgroundColor()); configForegroundColorChanged(config->getForegroundColor()); configNumPlotsChanged(config->getNumRows(), config->getNumColumns()); configLinkScaleChanged(config_->isScaleLinked()); configLinkCursorChanged(config_->isCursorLinked()); configTrackPointsChanged(config_->arePointsTracked()); } } } PlotTableConfig* PlotTableConfigWidget::getConfig() const { return config_; } void PlotTableConfigWidget::setPlotTable(PlotTableWidget* plotTable) { if (plotTable != plotTable_) { if (plotTable_) { disconnect(plotTable_, SIGNAL(plotPausedChanged()), this, SLOT(plotTablePlotPausedChanged())); disconnect(plotTable_, SIGNAL(jobStarted(const QString&)), this, SLOT(plotTableJobStarted(const QString&))); disconnect(plotTable_, SIGNAL(jobProgressChanged(double)), this, SLOT(plotTableJobProgressChanged(double))); disconnect(plotTable_, SIGNAL(jobFinished(const QString&)), this, SLOT(plotTableJobFinished(const QString&))); disconnect(plotTable_, SIGNAL(jobFailed(const QString&)), this, SLOT(plotTableJobFailed(const QString&))); } plotTable_ = plotTable; if (plotTable) { connect(plotTable, SIGNAL(plotPausedChanged()), this, SLOT(plotTablePlotPausedChanged())); connect(plotTable, SIGNAL(jobStarted(const QString&)), this, SLOT(plotTableJobStarted(const QString&))); connect(plotTable, SIGNAL(jobProgressChanged(double)), this, SLOT(plotTableJobProgressChanged(double))); connect(plotTable, SIGNAL(jobFinished(const QString&)), this, SLOT(plotTableJobFinished(const QString&))); connect(plotTable, SIGNAL(jobFailed(const QString&)), this, SLOT(plotTableJobFailed(const QString&))); plotTablePlotPausedChanged(); } } } PlotTableWidget* PlotTableConfigWidget::getPlotTableWidget() const { return plotTable_; } void PlotTableConfigWidget::runPlots() { if (plotTable_) { plotTable_->runPlots(); } } /*****************************************************************************/ /* Methods */ /*****************************************************************************/ bool PlotTableConfigWidget::eventFilter(QObject* object, QEvent* event) { if (config_) { if (((object == ui_->labelBackgroundColor) || (object == ui_->labelForegroundColor)) && (event->type() == QEvent::MouseButtonPress)) { QColorDialog dialog(this); dialog.setCurrentColor((object == ui_->labelBackgroundColor) ? config_->getBackgroundColor() : config_->getForegroundColor()); if (dialog.exec() == QDialog::Accepted) { if (object == ui_->labelBackgroundColor) config_->setBackgroundColor(dialog.currentColor()); else config_->setForegroundColor(dialog.currentColor()); } } } return false; } /*****************************************************************************/ /* Slots */ /*****************************************************************************/ void PlotTableConfigWidget::configBackgroundColorChanged(const QColor& color) { QPalette palette = ui_->labelBackgroundColor->palette(); palette.setColor(QPalette::Window, color); ui_->labelBackgroundColor->setPalette(palette); } void PlotTableConfigWidget::configForegroundColorChanged(const QColor& color) { QPalette palette = ui_->labelForegroundColor->palette(); palette.setColor(QPalette::Window, color); ui_->labelForegroundColor->setPalette(palette); } void PlotTableConfigWidget::configNumPlotsChanged(size_t numRows, size_t numColumns) { ui_->spinBoxRows->setValue(numRows); ui_->spinBoxColumns->setValue(numColumns); } void PlotTableConfigWidget::configLinkScaleChanged(bool link) { ui_->checkBoxLinkScale->setCheckState(link ? Qt::Checked : Qt::Unchecked); } void PlotTableConfigWidget::configLinkCursorChanged(bool link) { ui_->checkBoxLinkCursor->setCheckState(link ? Qt::Checked : Qt::Unchecked); } void PlotTableConfigWidget::configTrackPointsChanged(bool track) { ui_->checkBoxTrackPoints->setCheckState(track ? Qt::Checked : Qt::Unchecked); } void PlotTableConfigWidget::spinBoxRowsValueChanged(int value) { if (config_) config_->setNumRows(value); } void PlotTableConfigWidget::spinBoxColumnsValueChanged(int value) { if (config_) config_->setNumColumns(value); } void PlotTableConfigWidget::checkBoxLinkScaleStateChanged(int state) { if (config_) config_->setLinkScale(state == Qt::Checked); } void PlotTableConfigWidget::checkBoxLinkCursorStateChanged(int state) { if (config_) config_->setLinkCursor(state == Qt::Checked); } void PlotTableConfigWidget::checkBoxTrackPointsStateChanged(int state) { if (config_) config_->setTrackPoints(state == Qt::Checked); } void PlotTableConfigWidget::pushButtonRunClicked() { if (plotTable_) plotTable_->runPlots(); } void PlotTableConfigWidget::pushButtonPauseClicked() { if (plotTable_) plotTable_->pausePlots(); } void PlotTableConfigWidget::pushButtonClearClicked() { if (plotTable_) plotTable_->clearPlots(); } void PlotTableConfigWidget::pushButtonImportExportClicked() { menuImportExport_->popup(QCursor::pos()); } void PlotTableConfigWidget::menuImportBagFileTriggered() { QFileDialog dialog(this, "Open Bag", QDir::homePath(), "ROS Bag (*.bag)"); dialog.setAcceptMode(QFileDialog::AcceptOpen); dialog.setFileMode(QFileDialog::ExistingFile); if (dialog.exec() == QDialog::Accepted) plotTable_->loadFromBagFile(dialog.selectedFiles().first()); } void PlotTableConfigWidget::menuExportImageFileTriggered() { QFileDialog dialog(this, "Save Image File", QDir::homePath(), "Portable Network Graphics (*.png)"); dialog.setAcceptMode(QFileDialog::AcceptSave); dialog.setFileMode(QFileDialog::AnyFile); dialog.selectFile("rqt_multiplot.png"); if (dialog.exec() == QDialog::Accepted) plotTable_->saveToImageFile(dialog.selectedFiles().first()); } void PlotTableConfigWidget::menuExportTextFileTriggered() { QFileDialog dialog(this, "Save Text File", QDir::homePath(), "Text file (*.txt)"); dialog.setAcceptMode(QFileDialog::AcceptSave); dialog.setFileMode(QFileDialog::AnyFile); dialog.selectFile("rqt_multiplot.txt"); if (dialog.exec() == QDialog::Accepted) plotTable_->saveToTextFile(dialog.selectedFiles().first()); } void PlotTableConfigWidget::plotTablePlotPausedChanged() { if (plotTable_) { bool allPlotsPaused = true; bool anyPlotPaused = false; for (size_t row = 0; row < plotTable_->getNumRows(); ++row) { for (size_t column = 0; column < plotTable_->getNumColumns(); ++column) { allPlotsPaused &= plotTable_->getPlotWidget(row, column)->isPaused(); anyPlotPaused |= plotTable_->getPlotWidget(row, column)->isPaused(); } } ui_->pushButtonRun->setEnabled(anyPlotPaused); ui_->pushButtonPause->setEnabled(!allPlotsPaused); } } void PlotTableConfigWidget::plotTableJobStarted(const QString& toolTip) { ui_->widgetProgress->setEnabled(true); ui_->widgetProgress->start(toolTip); } void PlotTableConfigWidget::plotTableJobProgressChanged(double progress) { ui_->widgetProgress->setCurrentProgress(progress); } void PlotTableConfigWidget::plotTableJobFinished(const QString& toolTip) { ui_->widgetProgress->finish(toolTip); } void PlotTableConfigWidget::plotTableJobFailed(const QString& toolTip) { ui_->widgetProgress->fail(toolTip); } }
ethz-asl/ros-rqt-multiplot-plugin
src/rqt_multiplot/PlotTableConfigWidget.cpp
C++
lgpl-3.0
13,941
/* * Warning: Do not edit this file. It was automatically * generated by 'beam_makeops' on Mon Jan 19 19:23:03 2015. */ #ifndef __OPCODES_H__ #define __OPCODES_H__ #define BEAM_FORMAT_NUMBER 0 #define MAX_GENERIC_OPCODE 148 #define NUM_GENERIC_OPS 319 #define NUM_SPECIFIC_OPS 429 #ifdef ARCH_64 # define BEAM_LOOSE_MASK 0x1FFFUL # define BEAM_TIGHT_MASK 0x1FF8UL # define BEAM_LOOSE_SHIFT 16 # define BEAM_TIGHT_SHIFT 16 #else # define BEAM_LOOSE_MASK 0xFFF # define BEAM_TIGHT_MASK 0xFFC # define BEAM_LOOSE_SHIFT 16 # define BEAM_TIGHT_SHIFT 10 #endif /* * The following operand types for generic instructions * occur in beam files. */ #define TAG_u 0 #define TAG_i 1 #define TAG_a 2 #define TAG_x 3 #define TAG_y 4 #define TAG_f 5 #define TAG_h 6 #define TAG_z 7 /* * The following operand types are only used in the loader. */ #define TAG_n 8 #define TAG_p 9 #define TAG_r 10 #define TAG_v 11 #define TAG_l 12 #define TAG_q 13 #define BEAM_NUM_TAGS 14 #define TOP_call 0 #define TOP_commit 1 #define TOP_end 2 #define TOP_fail 3 #define TOP_is_bif 4 #define TOP_is_eq 5 #define TOP_is_func 6 #define TOP_is_not_bif 7 #define TOP_is_op 8 #define TOP_is_same_var 9 #define TOP_is_type 10 #define TOP_new_instr 11 #define TOP_next_arg 12 #define TOP_next_instr 13 #define TOP_pred 14 #define TOP_rest_args 15 #define TOP_set_var_next_arg 16 #define TOP_store_op 17 #define TOP_store_type 18 #define TOP_store_val 19 #define TOP_store_var 20 #define TOP_try_me_else 21 #define NUM_TOPS 22 #define TE_MAX_VARS 8 extern char tag_to_letter[]; extern Uint op_transform[]; #define op_allocate_tt 0 #define op_allocate_heap_III 1 #define op_allocate_heap_zero_III 2 #define op_allocate_init_tIy 3 #define op_allocate_zero_tt 4 #define op_apply_I 5 #define op_apply_bif 6 #define op_apply_last_IP 7 #define op_badarg_j 8 #define op_badmatch_s 9 #define op_bif1_fbsd 10 #define op_bif1_body_bsd 11 #define op_bs_context_to_binary_r 12 #define op_bs_context_to_binary_x 13 #define op_bs_context_to_binary_y 14 #define op_bs_init_writable 15 #define op_bs_put_string_II 16 #define op_bs_test_tail_imm2_frI 17 #define op_bs_test_tail_imm2_fxI 18 #define op_bs_test_unit_frI 19 #define op_bs_test_unit_fxI 20 #define op_bs_test_unit8_fr 21 #define op_bs_test_unit8_fx 22 #define op_bs_test_zero_tail2_fr 23 #define op_bs_test_zero_tail2_fx 24 #define op_call_bif0_e 25 #define op_call_bif1_e 26 #define op_call_bif2_e 27 #define op_call_bif3_e 28 #define op_call_error_handler 29 #define op_call_traced_function 30 #define op_case_end_s 31 #define op_catch_yf 32 #define op_catch_end_y 33 #define op_continue_exit 34 #define op_deallocate_I 35 #define op_deallocate_return_P 36 #define op_error_action_code 37 #define op_extract_next_element_x 38 #define op_extract_next_element_y 39 #define op_extract_next_element2_x 40 #define op_extract_next_element2_y 41 #define op_extract_next_element3_x 42 #define op_extract_next_element3_y 43 #define op_fclearerror 44 #define op_fconv_dl 45 #define op_fmove_ql 46 #define op_fmove_dl 47 #define op_fmove_new_ld 48 #define op_get_list_rrx 49 #define op_get_list_rry 50 #define op_get_list_rxr 51 #define op_get_list_rxx 52 #define op_get_list_rxy 53 #define op_get_list_ryr 54 #define op_get_list_ryx 55 #define op_get_list_ryy 56 #define op_get_list_xrx 57 #define op_get_list_xry 58 #define op_get_list_xxr 59 #define op_get_list_xxx 60 #define op_get_list_xxy 61 #define op_get_list_xyr 62 #define op_get_list_xyx 63 #define op_get_list_xyy 64 #define op_get_list_yrx 65 #define op_get_list_yry 66 #define op_get_list_yxr 67 #define op_get_list_yxx 68 #define op_get_list_yxy 69 #define op_get_list_yyr 70 #define op_get_list_yyx 71 #define op_get_list_yyy 72 #define op_i_apply 73 #define op_i_apply_fun 74 #define op_i_apply_fun_last_P 75 #define op_i_apply_fun_only 76 #define op_i_apply_last_P 77 #define op_i_apply_only 78 #define op_i_band_jId 79 #define op_i_bif2_fbd 80 #define op_i_bif2_body_bd 81 #define op_i_bor_jId 82 #define op_i_bs_add_jId 83 #define op_i_bs_append_jIIId 84 #define op_i_bs_bits_to_bytes_rjd 85 #define op_i_bs_bits_to_bytes_xjd 86 #define op_i_bs_bits_to_bytes_yjd 87 #define op_i_bs_get_binary2_frIsId 88 #define op_i_bs_get_binary2_fxIsId 89 #define op_i_bs_get_binary_all2_frIId 90 #define op_i_bs_get_binary_all2_fxIId 91 #define op_i_bs_get_binary_all_reuse_rfI 92 #define op_i_bs_get_binary_all_reuse_xfI 93 #define op_i_bs_get_binary_imm2_frIIId 94 #define op_i_bs_get_binary_imm2_fxIIId 95 #define op_i_bs_get_float2_frIsId 96 #define op_i_bs_get_float2_fxIsId 97 #define op_i_bs_get_integer_fIId 98 #define op_i_bs_get_integer_16_rfd 99 #define op_i_bs_get_integer_16_xfd 100 #define op_i_bs_get_integer_32_rfId 101 #define op_i_bs_get_integer_32_xfId 102 #define op_i_bs_get_integer_8_rfd 103 #define op_i_bs_get_integer_8_xfd 104 #define op_i_bs_get_integer_imm_rIIfId 105 #define op_i_bs_get_integer_imm_xIIfId 106 #define op_i_bs_get_integer_small_imm_rIfId 107 #define op_i_bs_get_integer_small_imm_xIfId 108 #define op_i_bs_get_utf16_rfId 109 #define op_i_bs_get_utf16_xfId 110 #define op_i_bs_get_utf8_rfd 111 #define op_i_bs_get_utf8_xfd 112 #define op_i_bs_init_IId 113 #define op_i_bs_init_bits_IId 114 #define op_i_bs_init_bits_fail_rjId 115 #define op_i_bs_init_bits_fail_xjId 116 #define op_i_bs_init_bits_fail_yjId 117 #define op_i_bs_init_bits_fail_heap_IjId 118 #define op_i_bs_init_bits_heap_IIId 119 #define op_i_bs_init_fail_rjId 120 #define op_i_bs_init_fail_xjId 121 #define op_i_bs_init_fail_yjId 122 #define op_i_bs_init_fail_heap_IjId 123 #define op_i_bs_init_heap_IIId 124 #define op_i_bs_init_heap_bin_IId 125 #define op_i_bs_init_heap_bin_heap_IIId 126 #define op_i_bs_match_string_rfII 127 #define op_i_bs_match_string_xfII 128 #define op_i_bs_private_append_jId 129 #define op_i_bs_put_utf16_jIs 130 #define op_i_bs_put_utf8_js 131 #define op_i_bs_restore2_rI 132 #define op_i_bs_restore2_xI 133 #define op_i_bs_save2_rI 134 #define op_i_bs_save2_xI 135 #define op_i_bs_skip_bits2_frxI 136 #define op_i_bs_skip_bits2_fryI 137 #define op_i_bs_skip_bits2_fxrI 138 #define op_i_bs_skip_bits2_fxxI 139 #define op_i_bs_skip_bits2_fxyI 140 #define op_i_bs_skip_bits_all2_frI 141 #define op_i_bs_skip_bits_all2_fxI 142 #define op_i_bs_skip_bits_imm2_frI 143 #define op_i_bs_skip_bits_imm2_fxI 144 #define op_i_bs_start_match2_rfIId 145 #define op_i_bs_start_match2_xfIId 146 #define op_i_bs_start_match2_yfIId 147 #define op_i_bs_utf16_size_sd 148 #define op_i_bs_utf8_size_sd 149 #define op_i_bs_validate_unicode_js 150 #define op_i_bs_validate_unicode_retract_j 151 #define op_i_bsl_jId 152 #define op_i_bsr_jId 153 #define op_i_bxor_jId 154 #define op_i_call_f 155 #define op_i_call_ext_e 156 #define op_i_call_ext_last_eP 157 #define op_i_call_ext_only_e 158 #define op_i_call_fun_I 159 #define op_i_call_fun_last_IP 160 #define op_i_call_last_fP 161 #define op_i_call_only_f 162 #define op_i_count_breakpoint 163 #define op_i_debug_breakpoint 164 #define op_i_element_jssd 165 #define op_i_fadd_lll 166 #define op_i_fast_element_jIsd 167 #define op_i_fcheckerror 168 #define op_i_fdiv_lll 169 #define op_i_fetch_rx 170 #define op_i_fetch_ry 171 #define op_i_fetch_xr 172 #define op_i_fetch_xx 173 #define op_i_fetch_xy 174 #define op_i_fetch_yr 175 #define op_i_fetch_yx 176 #define op_i_fetch_yy 177 #define op_i_fetch_rc 178 #define op_i_fetch_xc 179 #define op_i_fetch_yc 180 #define op_i_fetch_cr 181 #define op_i_fetch_cx 182 #define op_i_fetch_cy 183 #define op_i_fetch_cc 184 #define op_i_fetch_ss 185 #define op_i_fmul_lll 186 #define op_i_fnegate_ll 187 #define op_i_fsub_lll 188 #define op_i_func_info_IaaI 189 #define op_i_gc_bif1_jIsId 190 #define op_i_get_sd 191 #define op_i_get_tuple_element_rPr 192 #define op_i_get_tuple_element_rPx 193 #define op_i_get_tuple_element_rPy 194 #define op_i_get_tuple_element_xPr 195 #define op_i_get_tuple_element_xPx 196 #define op_i_get_tuple_element_xPy 197 #define op_i_get_tuple_element_yPr 198 #define op_i_get_tuple_element_yPx 199 #define op_i_get_tuple_element_yPy 200 #define op_i_global_cons 201 #define op_i_global_copy 202 #define op_i_global_tuple 203 #define op_i_hibernate 204 #define op_i_int_bnot_jsId 205 #define op_i_int_div_jId 206 #define op_i_is_eq_f 207 #define op_i_is_eq_exact_f 208 #define op_i_is_eq_immed_frc 209 #define op_i_is_eq_immed_fxc 210 #define op_i_is_eq_immed_fyc 211 #define op_i_is_ge_f 212 #define op_i_is_lt_f 213 #define op_i_is_ne_f 214 #define op_i_is_ne_exact_f 215 #define op_i_jump_on_val_sfII 216 #define op_i_jump_on_val_zero_sfI 217 #define op_i_loop_rec_fr 218 #define op_i_m_div_jId 219 #define op_i_make_fun_It 220 #define op_i_minus_jId 221 #define op_i_move_call_crf 222 #define op_i_move_call_ext_cre 223 #define op_i_move_call_ext_last_ePcr 224 #define op_i_move_call_ext_only_ecr 225 #define op_i_move_call_last_fPcr 226 #define op_i_move_call_only_fcr 227 #define op_i_mtrace_breakpoint 228 #define op_i_new_bs_put_binary_jsIs 229 #define op_i_new_bs_put_binary_all_jsI 230 #define op_i_new_bs_put_binary_imm_jIs 231 #define op_i_new_bs_put_float_jsIs 232 #define op_i_new_bs_put_float_imm_jIIs 233 #define op_i_new_bs_put_integer_jsIs 234 #define op_i_new_bs_put_integer_imm_jIIs 235 #define op_i_plus_jId 236 #define op_i_put_tuple_Anr 237 #define op_i_put_tuple_Anx 238 #define op_i_put_tuple_Arx 239 #define op_i_put_tuple_Ary 240 #define op_i_put_tuple_Axr 241 #define op_i_put_tuple_Axx 242 #define op_i_put_tuple_Axy 243 #define op_i_put_tuple_Ayr 244 #define op_i_put_tuple_Ayx 245 #define op_i_put_tuple_Ayy 246 #define op_i_put_tuple_Acr 247 #define op_i_put_tuple_Acx 248 #define op_i_put_tuple_Acy 249 #define op_i_put_tuple_only_Ad 250 #define op_i_rem_jId 251 #define op_i_return_to_trace 252 #define op_i_select_big_sf 253 #define op_i_select_float_sfI 254 #define op_i_select_tuple_arity_sfI 255 #define op_i_select_val_sfI 256 #define op_i_times_jId 257 #define op_i_trace_breakpoint 258 #define op_i_trim_I 259 #define op_i_wait_error 260 #define op_i_wait_error_locked 261 #define op_i_wait_timeout_fI 262 #define op_i_wait_timeout_fs 263 #define op_i_wait_timeout_locked_fI 264 #define op_i_wait_timeout_locked_fs 265 #define op_i_yield 266 #define op_if_end 267 #define op_init_y 268 #define op_init2_yy 269 #define op_init3_yyy 270 #define op_int_code_end 271 #define op_is_atom_fr 272 #define op_is_atom_fx 273 #define op_is_atom_fy 274 #define op_is_binary_fr 275 #define op_is_binary_fx 276 #define op_is_binary_fy 277 #define op_is_bitstring_fr 278 #define op_is_bitstring_fx 279 #define op_is_bitstring_fy 280 #define op_is_boolean_fr 281 #define op_is_boolean_fx 282 #define op_is_boolean_fy 283 #define op_is_constant_fr 284 #define op_is_constant_fx 285 #define op_is_constant_fy 286 #define op_is_float_fr 287 #define op_is_float_fx 288 #define op_is_float_fy 289 #define op_is_function_fr 290 #define op_is_function_fx 291 #define op_is_function_fy 292 #define op_is_function2_fss 293 #define op_is_integer_fr 294 #define op_is_integer_fx 295 #define op_is_integer_fy 296 #define op_is_integer_allocate_frII 297 #define op_is_integer_allocate_fxII 298 #define op_is_list_fr 299 #define op_is_list_fx 300 #define op_is_list_fy 301 #define op_is_nil_fr 302 #define op_is_nil_fx 303 #define op_is_nil_fy 304 #define op_is_non_empty_list_test_heap_frII 305 #define op_is_nonempty_list_fr 306 #define op_is_nonempty_list_fx 307 #define op_is_nonempty_list_fy 308 #define op_is_nonempty_list_allocate_frII 309 #define op_is_nonempty_list_allocate_fxII 310 #define op_is_number_fr 311 #define op_is_number_fx 312 #define op_is_number_fy 313 #define op_is_pid_fr 314 #define op_is_pid_fx 315 #define op_is_pid_fy 316 #define op_is_port_fr 317 #define op_is_port_fx 318 #define op_is_port_fy 319 #define op_is_reference_fr 320 #define op_is_reference_fx 321 #define op_is_reference_fy 322 #define op_is_tuple_fr 323 #define op_is_tuple_fx 324 #define op_is_tuple_fy 325 #define op_is_tuple_of_arity_frA 326 #define op_is_tuple_of_arity_fxA 327 #define op_is_tuple_of_arity_fyA 328 #define op_jump_f 329 #define op_label_L 330 #define op_loop_rec_end_f 331 #define op_move_nr 332 #define op_move_nx 333 #define op_move_rx 334 #define op_move_ry 335 #define op_move_xr 336 #define op_move_xx 337 #define op_move_xy 338 #define op_move_yr 339 #define op_move_yx 340 #define op_move_yy 341 #define op_move_cr 342 #define op_move_cx 343 #define op_move_cy 344 #define op_move_sd 345 #define op_move2_xyxy 346 #define op_move2_yxyx 347 #define op_move_call_xrf 348 #define op_move_call_yrf 349 #define op_move_call_last_xrfP 350 #define op_move_call_last_yrfP 351 #define op_move_call_only_xrf 352 #define op_move_deallocate_return_nrP 353 #define op_move_deallocate_return_xrP 354 #define op_move_deallocate_return_yrP 355 #define op_move_deallocate_return_crP 356 #define op_move_return_nr 357 #define op_move_return_xr 358 #define op_move_return_cr 359 #define op_node_r 360 #define op_node_x 361 #define op_node_y 362 #define op_normal_exit 363 #define op_put_n 364 #define op_put_r 365 #define op_put_x 366 #define op_put_y 367 #define op_put_c 368 #define op_put_list_rnx 369 #define op_put_list_rxr 370 #define op_put_list_rxx 371 #define op_put_list_ryx 372 #define op_put_list_xnx 373 #define op_put_list_xrr 374 #define op_put_list_xxr 375 #define op_put_list_xxx 376 #define op_put_list_xyx 377 #define op_put_list_ynx 378 #define op_put_list_yrr 379 #define op_put_list_yrx 380 #define op_put_list_yxx 381 #define op_put_list_yyr 382 #define op_put_list_yyx 383 #define op_put_list_rcr 384 #define op_put_list_rcx 385 #define op_put_list_rcy 386 #define op_put_list_xcr 387 #define op_put_list_xcx 388 #define op_put_list_xcy 389 #define op_put_list_ycr 390 #define op_put_list_ycx 391 #define op_put_list_ycy 392 #define op_put_list_cnr 393 #define op_put_list_cnx 394 #define op_put_list_crr 395 #define op_put_list_crx 396 #define op_put_list_cry 397 #define op_put_list_cxr 398 #define op_put_list_cxx 399 #define op_put_list_cxy 400 #define op_put_list_cyr 401 #define op_put_list_cyx 402 #define op_put_list_cyy 403 #define op_put_list_ssd 404 #define op_put_string_IId 405 #define op_raise_ss 406 #define op_remove_message 407 #define op_return 408 #define op_return_trace 409 #define op_self_r 410 #define op_self_x 411 #define op_self_y 412 #define op_send 413 #define op_set_tuple_element_sdP 414 #define op_system_limit_j 415 #define op_test_arity_frA 416 #define op_test_arity_fxA 417 #define op_test_arity_fyA 418 #define op_test_heap_II 419 #define op_test_heap_1_put_list_Iy 420 #define op_timeout 421 #define op_timeout_locked 422 #define op_too_old_compiler 423 #define op_try_case_end_s 424 #define op_try_end_y 425 #define op_wait_f 426 #define op_wait_locked_f 427 #define op_wait_unlocked_f 428 #define NUMBER_OF_OPCODES 429 #define op_count_allocate_tt 429 #define op_count_allocate_heap_III 430 #define op_count_allocate_heap_zero_III 431 #define op_count_allocate_init_tIy 432 #define op_count_allocate_zero_tt 433 #define op_count_apply_I 434 #define op_count_apply_bif 435 #define op_count_apply_last_IP 436 #define op_count_badarg_j 437 #define op_count_badmatch_s 438 #define op_count_bif1_fbsd 439 #define op_count_bif1_body_bsd 440 #define op_count_bs_context_to_binary_r 441 #define op_count_bs_context_to_binary_x 442 #define op_count_bs_context_to_binary_y 443 #define op_count_bs_init_writable 444 #define op_count_bs_put_string_II 445 #define op_count_bs_test_tail_imm2_frI 446 #define op_count_bs_test_tail_imm2_fxI 447 #define op_count_bs_test_unit_frI 448 #define op_count_bs_test_unit_fxI 449 #define op_count_bs_test_unit8_fr 450 #define op_count_bs_test_unit8_fx 451 #define op_count_bs_test_zero_tail2_fr 452 #define op_count_bs_test_zero_tail2_fx 453 #define op_count_call_bif0_e 454 #define op_count_call_bif1_e 455 #define op_count_call_bif2_e 456 #define op_count_call_bif3_e 457 #define op_count_call_error_handler 458 #define op_count_call_traced_function 459 #define op_count_case_end_s 460 #define op_count_catch_yf 461 #define op_count_catch_end_y 462 #define op_count_continue_exit 463 #define op_count_deallocate_I 464 #define op_count_deallocate_return_P 465 #define op_count_error_action_code 466 #define op_count_extract_next_element_x 467 #define op_count_extract_next_element_y 468 #define op_count_extract_next_element2_x 469 #define op_count_extract_next_element2_y 470 #define op_count_extract_next_element3_x 471 #define op_count_extract_next_element3_y 472 #define op_count_fclearerror 473 #define op_count_fconv_dl 474 #define op_count_fmove_ql 475 #define op_count_fmove_dl 476 #define op_count_fmove_new_ld 477 #define op_count_get_list_rrx 478 #define op_count_get_list_rry 479 #define op_count_get_list_rxr 480 #define op_count_get_list_rxx 481 #define op_count_get_list_rxy 482 #define op_count_get_list_ryr 483 #define op_count_get_list_ryx 484 #define op_count_get_list_ryy 485 #define op_count_get_list_xrx 486 #define op_count_get_list_xry 487 #define op_count_get_list_xxr 488 #define op_count_get_list_xxx 489 #define op_count_get_list_xxy 490 #define op_count_get_list_xyr 491 #define op_count_get_list_xyx 492 #define op_count_get_list_xyy 493 #define op_count_get_list_yrx 494 #define op_count_get_list_yry 495 #define op_count_get_list_yxr 496 #define op_count_get_list_yxx 497 #define op_count_get_list_yxy 498 #define op_count_get_list_yyr 499 #define op_count_get_list_yyx 500 #define op_count_get_list_yyy 501 #define op_count_i_apply 502 #define op_count_i_apply_fun 503 #define op_count_i_apply_fun_last_P 504 #define op_count_i_apply_fun_only 505 #define op_count_i_apply_last_P 506 #define op_count_i_apply_only 507 #define op_count_i_band_jId 508 #define op_count_i_bif2_fbd 509 #define op_count_i_bif2_body_bd 510 #define op_count_i_bor_jId 511 #define op_count_i_bs_add_jId 512 #define op_count_i_bs_append_jIIId 513 #define op_count_i_bs_bits_to_bytes_rjd 514 #define op_count_i_bs_bits_to_bytes_xjd 515 #define op_count_i_bs_bits_to_bytes_yjd 516 #define op_count_i_bs_get_binary2_frIsId 517 #define op_count_i_bs_get_binary2_fxIsId 518 #define op_count_i_bs_get_binary_all2_frIId 519 #define op_count_i_bs_get_binary_all2_fxIId 520 #define op_count_i_bs_get_binary_all_reuse_rfI 521 #define op_count_i_bs_get_binary_all_reuse_xfI 522 #define op_count_i_bs_get_binary_imm2_frIIId 523 #define op_count_i_bs_get_binary_imm2_fxIIId 524 #define op_count_i_bs_get_float2_frIsId 525 #define op_count_i_bs_get_float2_fxIsId 526 #define op_count_i_bs_get_integer_fIId 527 #define op_count_i_bs_get_integer_16_rfd 528 #define op_count_i_bs_get_integer_16_xfd 529 #define op_count_i_bs_get_integer_32_rfId 530 #define op_count_i_bs_get_integer_32_xfId 531 #define op_count_i_bs_get_integer_8_rfd 532 #define op_count_i_bs_get_integer_8_xfd 533 #define op_count_i_bs_get_integer_imm_rIIfId 534 #define op_count_i_bs_get_integer_imm_xIIfId 535 #define op_count_i_bs_get_integer_small_imm_rIfId 536 #define op_count_i_bs_get_integer_small_imm_xIfId 537 #define op_count_i_bs_get_utf16_rfId 538 #define op_count_i_bs_get_utf16_xfId 539 #define op_count_i_bs_get_utf8_rfd 540 #define op_count_i_bs_get_utf8_xfd 541 #define op_count_i_bs_init_IId 542 #define op_count_i_bs_init_bits_IId 543 #define op_count_i_bs_init_bits_fail_rjId 544 #define op_count_i_bs_init_bits_fail_xjId 545 #define op_count_i_bs_init_bits_fail_yjId 546 #define op_count_i_bs_init_bits_fail_heap_IjId 547 #define op_count_i_bs_init_bits_heap_IIId 548 #define op_count_i_bs_init_fail_rjId 549 #define op_count_i_bs_init_fail_xjId 550 #define op_count_i_bs_init_fail_yjId 551 #define op_count_i_bs_init_fail_heap_IjId 552 #define op_count_i_bs_init_heap_IIId 553 #define op_count_i_bs_init_heap_bin_IId 554 #define op_count_i_bs_init_heap_bin_heap_IIId 555 #define op_count_i_bs_match_string_rfII 556 #define op_count_i_bs_match_string_xfII 557 #define op_count_i_bs_private_append_jId 558 #define op_count_i_bs_put_utf16_jIs 559 #define op_count_i_bs_put_utf8_js 560 #define op_count_i_bs_restore2_rI 561 #define op_count_i_bs_restore2_xI 562 #define op_count_i_bs_save2_rI 563 #define op_count_i_bs_save2_xI 564 #define op_count_i_bs_skip_bits2_frxI 565 #define op_count_i_bs_skip_bits2_fryI 566 #define op_count_i_bs_skip_bits2_fxrI 567 #define op_count_i_bs_skip_bits2_fxxI 568 #define op_count_i_bs_skip_bits2_fxyI 569 #define op_count_i_bs_skip_bits_all2_frI 570 #define op_count_i_bs_skip_bits_all2_fxI 571 #define op_count_i_bs_skip_bits_imm2_frI 572 #define op_count_i_bs_skip_bits_imm2_fxI 573 #define op_count_i_bs_start_match2_rfIId 574 #define op_count_i_bs_start_match2_xfIId 575 #define op_count_i_bs_start_match2_yfIId 576 #define op_count_i_bs_utf16_size_sd 577 #define op_count_i_bs_utf8_size_sd 578 #define op_count_i_bs_validate_unicode_js 579 #define op_count_i_bs_validate_unicode_retract_j 580 #define op_count_i_bsl_jId 581 #define op_count_i_bsr_jId 582 #define op_count_i_bxor_jId 583 #define op_count_i_call_f 584 #define op_count_i_call_ext_e 585 #define op_count_i_call_ext_last_eP 586 #define op_count_i_call_ext_only_e 587 #define op_count_i_call_fun_I 588 #define op_count_i_call_fun_last_IP 589 #define op_count_i_call_last_fP 590 #define op_count_i_call_only_f 591 #define op_count_i_count_breakpoint 592 #define op_count_i_debug_breakpoint 593 #define op_count_i_element_jssd 594 #define op_count_i_fadd_lll 595 #define op_count_i_fast_element_jIsd 596 #define op_count_i_fcheckerror 597 #define op_count_i_fdiv_lll 598 #define op_count_i_fetch_rx 599 #define op_count_i_fetch_ry 600 #define op_count_i_fetch_xr 601 #define op_count_i_fetch_xx 602 #define op_count_i_fetch_xy 603 #define op_count_i_fetch_yr 604 #define op_count_i_fetch_yx 605 #define op_count_i_fetch_yy 606 #define op_count_i_fetch_rc 607 #define op_count_i_fetch_xc 608 #define op_count_i_fetch_yc 609 #define op_count_i_fetch_cr 610 #define op_count_i_fetch_cx 611 #define op_count_i_fetch_cy 612 #define op_count_i_fetch_cc 613 #define op_count_i_fetch_ss 614 #define op_count_i_fmul_lll 615 #define op_count_i_fnegate_ll 616 #define op_count_i_fsub_lll 617 #define op_count_i_func_info_IaaI 618 #define op_count_i_gc_bif1_jIsId 619 #define op_count_i_get_sd 620 #define op_count_i_get_tuple_element_rPr 621 #define op_count_i_get_tuple_element_rPx 622 #define op_count_i_get_tuple_element_rPy 623 #define op_count_i_get_tuple_element_xPr 624 #define op_count_i_get_tuple_element_xPx 625 #define op_count_i_get_tuple_element_xPy 626 #define op_count_i_get_tuple_element_yPr 627 #define op_count_i_get_tuple_element_yPx 628 #define op_count_i_get_tuple_element_yPy 629 #define op_count_i_global_cons 630 #define op_count_i_global_copy 631 #define op_count_i_global_tuple 632 #define op_count_i_hibernate 633 #define op_count_i_int_bnot_jsId 634 #define op_count_i_int_div_jId 635 #define op_count_i_is_eq_f 636 #define op_count_i_is_eq_exact_f 637 #define op_count_i_is_eq_immed_frc 638 #define op_count_i_is_eq_immed_fxc 639 #define op_count_i_is_eq_immed_fyc 640 #define op_count_i_is_ge_f 641 #define op_count_i_is_lt_f 642 #define op_count_i_is_ne_f 643 #define op_count_i_is_ne_exact_f 644 #define op_count_i_jump_on_val_sfII 645 #define op_count_i_jump_on_val_zero_sfI 646 #define op_count_i_loop_rec_fr 647 #define op_count_i_m_div_jId 648 #define op_count_i_make_fun_It 649 #define op_count_i_minus_jId 650 #define op_count_i_move_call_crf 651 #define op_count_i_move_call_ext_cre 652 #define op_count_i_move_call_ext_last_ePcr 653 #define op_count_i_move_call_ext_only_ecr 654 #define op_count_i_move_call_last_fPcr 655 #define op_count_i_move_call_only_fcr 656 #define op_count_i_mtrace_breakpoint 657 #define op_count_i_new_bs_put_binary_jsIs 658 #define op_count_i_new_bs_put_binary_all_jsI 659 #define op_count_i_new_bs_put_binary_imm_jIs 660 #define op_count_i_new_bs_put_float_jsIs 661 #define op_count_i_new_bs_put_float_imm_jIIs 662 #define op_count_i_new_bs_put_integer_jsIs 663 #define op_count_i_new_bs_put_integer_imm_jIIs 664 #define op_count_i_plus_jId 665 #define op_count_i_put_tuple_Anr 666 #define op_count_i_put_tuple_Anx 667 #define op_count_i_put_tuple_Arx 668 #define op_count_i_put_tuple_Ary 669 #define op_count_i_put_tuple_Axr 670 #define op_count_i_put_tuple_Axx 671 #define op_count_i_put_tuple_Axy 672 #define op_count_i_put_tuple_Ayr 673 #define op_count_i_put_tuple_Ayx 674 #define op_count_i_put_tuple_Ayy 675 #define op_count_i_put_tuple_Acr 676 #define op_count_i_put_tuple_Acx 677 #define op_count_i_put_tuple_Acy 678 #define op_count_i_put_tuple_only_Ad 679 #define op_count_i_rem_jId 680 #define op_count_i_return_to_trace 681 #define op_count_i_select_big_sf 682 #define op_count_i_select_float_sfI 683 #define op_count_i_select_tuple_arity_sfI 684 #define op_count_i_select_val_sfI 685 #define op_count_i_times_jId 686 #define op_count_i_trace_breakpoint 687 #define op_count_i_trim_I 688 #define op_count_i_wait_error 689 #define op_count_i_wait_error_locked 690 #define op_count_i_wait_timeout_fI 691 #define op_count_i_wait_timeout_fs 692 #define op_count_i_wait_timeout_locked_fI 693 #define op_count_i_wait_timeout_locked_fs 694 #define op_count_i_yield 695 #define op_count_if_end 696 #define op_count_init_y 697 #define op_count_init2_yy 698 #define op_count_init3_yyy 699 #define op_count_int_code_end 700 #define op_count_is_atom_fr 701 #define op_count_is_atom_fx 702 #define op_count_is_atom_fy 703 #define op_count_is_binary_fr 704 #define op_count_is_binary_fx 705 #define op_count_is_binary_fy 706 #define op_count_is_bitstring_fr 707 #define op_count_is_bitstring_fx 708 #define op_count_is_bitstring_fy 709 #define op_count_is_boolean_fr 710 #define op_count_is_boolean_fx 711 #define op_count_is_boolean_fy 712 #define op_count_is_constant_fr 713 #define op_count_is_constant_fx 714 #define op_count_is_constant_fy 715 #define op_count_is_float_fr 716 #define op_count_is_float_fx 717 #define op_count_is_float_fy 718 #define op_count_is_function_fr 719 #define op_count_is_function_fx 720 #define op_count_is_function_fy 721 #define op_count_is_function2_fss 722 #define op_count_is_integer_fr 723 #define op_count_is_integer_fx 724 #define op_count_is_integer_fy 725 #define op_count_is_integer_allocate_frII 726 #define op_count_is_integer_allocate_fxII 727 #define op_count_is_list_fr 728 #define op_count_is_list_fx 729 #define op_count_is_list_fy 730 #define op_count_is_nil_fr 731 #define op_count_is_nil_fx 732 #define op_count_is_nil_fy 733 #define op_count_is_non_empty_list_test_heap_frII 734 #define op_count_is_nonempty_list_fr 735 #define op_count_is_nonempty_list_fx 736 #define op_count_is_nonempty_list_fy 737 #define op_count_is_nonempty_list_allocate_frII 738 #define op_count_is_nonempty_list_allocate_fxII 739 #define op_count_is_number_fr 740 #define op_count_is_number_fx 741 #define op_count_is_number_fy 742 #define op_count_is_pid_fr 743 #define op_count_is_pid_fx 744 #define op_count_is_pid_fy 745 #define op_count_is_port_fr 746 #define op_count_is_port_fx 747 #define op_count_is_port_fy 748 #define op_count_is_reference_fr 749 #define op_count_is_reference_fx 750 #define op_count_is_reference_fy 751 #define op_count_is_tuple_fr 752 #define op_count_is_tuple_fx 753 #define op_count_is_tuple_fy 754 #define op_count_is_tuple_of_arity_frA 755 #define op_count_is_tuple_of_arity_fxA 756 #define op_count_is_tuple_of_arity_fyA 757 #define op_count_jump_f 758 #define op_count_label_L 759 #define op_count_loop_rec_end_f 760 #define op_count_move_nr 761 #define op_count_move_nx 762 #define op_count_move_rx 763 #define op_count_move_ry 764 #define op_count_move_xr 765 #define op_count_move_xx 766 #define op_count_move_xy 767 #define op_count_move_yr 768 #define op_count_move_yx 769 #define op_count_move_yy 770 #define op_count_move_cr 771 #define op_count_move_cx 772 #define op_count_move_cy 773 #define op_count_move_sd 774 #define op_count_move2_xyxy 775 #define op_count_move2_yxyx 776 #define op_count_move_call_xrf 777 #define op_count_move_call_yrf 778 #define op_count_move_call_last_xrfP 779 #define op_count_move_call_last_yrfP 780 #define op_count_move_call_only_xrf 781 #define op_count_move_deallocate_return_nrP 782 #define op_count_move_deallocate_return_xrP 783 #define op_count_move_deallocate_return_yrP 784 #define op_count_move_deallocate_return_crP 785 #define op_count_move_return_nr 786 #define op_count_move_return_xr 787 #define op_count_move_return_cr 788 #define op_count_node_r 789 #define op_count_node_x 790 #define op_count_node_y 791 #define op_count_normal_exit 792 #define op_count_put_n 793 #define op_count_put_r 794 #define op_count_put_x 795 #define op_count_put_y 796 #define op_count_put_c 797 #define op_count_put_list_rnx 798 #define op_count_put_list_rxr 799 #define op_count_put_list_rxx 800 #define op_count_put_list_ryx 801 #define op_count_put_list_xnx 802 #define op_count_put_list_xrr 803 #define op_count_put_list_xxr 804 #define op_count_put_list_xxx 805 #define op_count_put_list_xyx 806 #define op_count_put_list_ynx 807 #define op_count_put_list_yrr 808 #define op_count_put_list_yrx 809 #define op_count_put_list_yxx 810 #define op_count_put_list_yyr 811 #define op_count_put_list_yyx 812 #define op_count_put_list_rcr 813 #define op_count_put_list_rcx 814 #define op_count_put_list_rcy 815 #define op_count_put_list_xcr 816 #define op_count_put_list_xcx 817 #define op_count_put_list_xcy 818 #define op_count_put_list_ycr 819 #define op_count_put_list_ycx 820 #define op_count_put_list_ycy 821 #define op_count_put_list_cnr 822 #define op_count_put_list_cnx 823 #define op_count_put_list_crr 824 #define op_count_put_list_crx 825 #define op_count_put_list_cry 826 #define op_count_put_list_cxr 827 #define op_count_put_list_cxx 828 #define op_count_put_list_cxy 829 #define op_count_put_list_cyr 830 #define op_count_put_list_cyx 831 #define op_count_put_list_cyy 832 #define op_count_put_list_ssd 833 #define op_count_put_string_IId 834 #define op_count_raise_ss 835 #define op_count_remove_message 836 #define op_count_return 837 #define op_count_return_trace 838 #define op_count_self_r 839 #define op_count_self_x 840 #define op_count_self_y 841 #define op_count_send 842 #define op_count_set_tuple_element_sdP 843 #define op_count_system_limit_j 844 #define op_count_test_arity_frA 845 #define op_count_test_arity_fxA 846 #define op_count_test_arity_fyA 847 #define op_count_test_heap_II 848 #define op_count_test_heap_1_put_list_Iy 849 #define op_count_timeout 850 #define op_count_timeout_locked 851 #define op_count_too_old_compiler 852 #define op_count_try_case_end_s 853 #define op_count_try_end_y 854 #define op_count_wait_f 855 #define op_count_wait_locked_f 856 #define op_count_wait_unlocked_f 857 #define DEFINE_OPCODES \ &&lb_allocate_tt, \ &&lb_allocate_heap_III, \ &&lb_allocate_heap_zero_III, \ &&lb_allocate_init_tIy, \ &&lb_allocate_zero_tt, \ &&lb_apply_I, \ &&lb_apply_bif, \ &&lb_apply_last_IP, \ &&lb_badarg_j, \ &&lb_badmatch_s, \ &&lb_bif1_fbsd, \ &&lb_bif1_body_bsd, \ &&lb_bs_context_to_binary_r, \ &&lb_bs_context_to_binary_x, \ &&lb_bs_context_to_binary_y, \ &&lb_bs_init_writable, \ &&lb_bs_put_string_II, \ &&lb_bs_test_tail_imm2_frI, \ &&lb_bs_test_tail_imm2_fxI, \ &&lb_bs_test_unit_frI, \ &&lb_bs_test_unit_fxI, \ &&lb_bs_test_unit8_fr, \ &&lb_bs_test_unit8_fx, \ &&lb_bs_test_zero_tail2_fr, \ &&lb_bs_test_zero_tail2_fx, \ &&lb_call_bif0_e, \ &&lb_call_bif1_e, \ &&lb_call_bif2_e, \ &&lb_call_bif3_e, \ &&lb_call_error_handler, \ &&lb_call_traced_function, \ &&lb_case_end_s, \ &&lb_catch_yf, \ &&lb_catch_end_y, \ &&lb_continue_exit, \ &&lb_deallocate_I, \ &&lb_deallocate_return_P, \ &&lb_error_action_code, \ &&lb_extract_next_element_x, \ &&lb_extract_next_element_y, \ &&lb_extract_next_element2_x, \ &&lb_extract_next_element2_y, \ &&lb_extract_next_element3_x, \ &&lb_extract_next_element3_y, \ &&lb_fclearerror, \ &&lb_fconv_dl, \ &&lb_fmove_ql, \ &&lb_fmove_dl, \ &&lb_fmove_new_ld, \ &&lb_get_list_rrx, \ &&lb_get_list_rry, \ &&lb_get_list_rxr, \ &&lb_get_list_rxx, \ &&lb_get_list_rxy, \ &&lb_get_list_ryr, \ &&lb_get_list_ryx, \ &&lb_get_list_ryy, \ &&lb_get_list_xrx, \ &&lb_get_list_xry, \ &&lb_get_list_xxr, \ &&lb_get_list_xxx, \ &&lb_get_list_xxy, \ &&lb_get_list_xyr, \ &&lb_get_list_xyx, \ &&lb_get_list_xyy, \ &&lb_get_list_yrx, \ &&lb_get_list_yry, \ &&lb_get_list_yxr, \ &&lb_get_list_yxx, \ &&lb_get_list_yxy, \ &&lb_get_list_yyr, \ &&lb_get_list_yyx, \ &&lb_get_list_yyy, \ &&lb_i_apply, \ &&lb_i_apply_fun, \ &&lb_i_apply_fun_last_P, \ &&lb_i_apply_fun_only, \ &&lb_i_apply_last_P, \ &&lb_i_apply_only, \ &&lb_i_band_jId, \ &&lb_i_bif2_fbd, \ &&lb_i_bif2_body_bd, \ &&lb_i_bor_jId, \ &&lb_i_bs_add_jId, \ &&lb_i_bs_append_jIIId, \ &&lb_i_bs_bits_to_bytes_rjd, \ &&lb_i_bs_bits_to_bytes_xjd, \ &&lb_i_bs_bits_to_bytes_yjd, \ &&lb_i_bs_get_binary2_frIsId, \ &&lb_i_bs_get_binary2_fxIsId, \ &&lb_i_bs_get_binary_all2_frIId, \ &&lb_i_bs_get_binary_all2_fxIId, \ &&lb_i_bs_get_binary_all_reuse_rfI, \ &&lb_i_bs_get_binary_all_reuse_xfI, \ &&lb_i_bs_get_binary_imm2_frIIId, \ &&lb_i_bs_get_binary_imm2_fxIIId, \ &&lb_i_bs_get_float2_frIsId, \ &&lb_i_bs_get_float2_fxIsId, \ &&lb_i_bs_get_integer_fIId, \ &&lb_i_bs_get_integer_16_rfd, \ &&lb_i_bs_get_integer_16_xfd, \ &&lb_i_bs_get_integer_32_rfId, \ &&lb_i_bs_get_integer_32_xfId, \ &&lb_i_bs_get_integer_8_rfd, \ &&lb_i_bs_get_integer_8_xfd, \ &&lb_i_bs_get_integer_imm_rIIfId, \ &&lb_i_bs_get_integer_imm_xIIfId, \ &&lb_i_bs_get_integer_small_imm_rIfId, \ &&lb_i_bs_get_integer_small_imm_xIfId, \ &&lb_i_bs_get_utf16_rfId, \ &&lb_i_bs_get_utf16_xfId, \ &&lb_i_bs_get_utf8_rfd, \ &&lb_i_bs_get_utf8_xfd, \ &&lb_i_bs_init_IId, \ &&lb_i_bs_init_bits_IId, \ &&lb_i_bs_init_bits_fail_rjId, \ &&lb_i_bs_init_bits_fail_xjId, \ &&lb_i_bs_init_bits_fail_yjId, \ &&lb_i_bs_init_bits_fail_heap_IjId, \ &&lb_i_bs_init_bits_heap_IIId, \ &&lb_i_bs_init_fail_rjId, \ &&lb_i_bs_init_fail_xjId, \ &&lb_i_bs_init_fail_yjId, \ &&lb_i_bs_init_fail_heap_IjId, \ &&lb_i_bs_init_heap_IIId, \ &&lb_i_bs_init_heap_bin_IId, \ &&lb_i_bs_init_heap_bin_heap_IIId, \ &&lb_i_bs_match_string_rfII, \ &&lb_i_bs_match_string_xfII, \ &&lb_i_bs_private_append_jId, \ &&lb_i_bs_put_utf16_jIs, \ &&lb_i_bs_put_utf8_js, \ &&lb_i_bs_restore2_rI, \ &&lb_i_bs_restore2_xI, \ &&lb_i_bs_save2_rI, \ &&lb_i_bs_save2_xI, \ &&lb_i_bs_skip_bits2_frxI, \ &&lb_i_bs_skip_bits2_fryI, \ &&lb_i_bs_skip_bits2_fxrI, \ &&lb_i_bs_skip_bits2_fxxI, \ &&lb_i_bs_skip_bits2_fxyI, \ &&lb_i_bs_skip_bits_all2_frI, \ &&lb_i_bs_skip_bits_all2_fxI, \ &&lb_i_bs_skip_bits_imm2_frI, \ &&lb_i_bs_skip_bits_imm2_fxI, \ &&lb_i_bs_start_match2_rfIId, \ &&lb_i_bs_start_match2_xfIId, \ &&lb_i_bs_start_match2_yfIId, \ &&lb_i_bs_utf16_size_sd, \ &&lb_i_bs_utf8_size_sd, \ &&lb_i_bs_validate_unicode_js, \ &&lb_i_bs_validate_unicode_retract_j, \ &&lb_i_bsl_jId, \ &&lb_i_bsr_jId, \ &&lb_i_bxor_jId, \ &&lb_i_call_f, \ &&lb_i_call_ext_e, \ &&lb_i_call_ext_last_eP, \ &&lb_i_call_ext_only_e, \ &&lb_i_call_fun_I, \ &&lb_i_call_fun_last_IP, \ &&lb_i_call_last_fP, \ &&lb_i_call_only_f, \ &&lb_i_count_breakpoint, \ &&lb_i_debug_breakpoint, \ &&lb_i_element_jssd, \ &&lb_i_fadd_lll, \ &&lb_i_fast_element_jIsd, \ &&lb_i_fcheckerror, \ &&lb_i_fdiv_lll, \ &&lb_i_fetch_rx, \ &&lb_i_fetch_ry, \ &&lb_i_fetch_xr, \ &&lb_i_fetch_xx, \ &&lb_i_fetch_xy, \ &&lb_i_fetch_yr, \ &&lb_i_fetch_yx, \ &&lb_i_fetch_yy, \ &&lb_i_fetch_rc, \ &&lb_i_fetch_xc, \ &&lb_i_fetch_yc, \ &&lb_i_fetch_cr, \ &&lb_i_fetch_cx, \ &&lb_i_fetch_cy, \ &&lb_i_fetch_cc, \ &&lb_i_fetch_ss, \ &&lb_i_fmul_lll, \ &&lb_i_fnegate_ll, \ &&lb_i_fsub_lll, \ &&lb_i_func_info_IaaI, \ &&lb_i_gc_bif1_jIsId, \ &&lb_i_get_sd, \ &&lb_i_get_tuple_element_rPr, \ &&lb_i_get_tuple_element_rPx, \ &&lb_i_get_tuple_element_rPy, \ &&lb_i_get_tuple_element_xPr, \ &&lb_i_get_tuple_element_xPx, \ &&lb_i_get_tuple_element_xPy, \ &&lb_i_get_tuple_element_yPr, \ &&lb_i_get_tuple_element_yPx, \ &&lb_i_get_tuple_element_yPy, \ &&lb_i_global_cons, \ &&lb_i_global_copy, \ &&lb_i_global_tuple, \ &&lb_i_hibernate, \ &&lb_i_int_bnot_jsId, \ &&lb_i_int_div_jId, \ &&lb_i_is_eq_f, \ &&lb_i_is_eq_exact_f, \ &&lb_i_is_eq_immed_frc, \ &&lb_i_is_eq_immed_fxc, \ &&lb_i_is_eq_immed_fyc, \ &&lb_i_is_ge_f, \ &&lb_i_is_lt_f, \ &&lb_i_is_ne_f, \ &&lb_i_is_ne_exact_f, \ &&lb_i_jump_on_val_sfII, \ &&lb_i_jump_on_val_zero_sfI, \ &&lb_i_loop_rec_fr, \ &&lb_i_m_div_jId, \ &&lb_i_make_fun_It, \ &&lb_i_minus_jId, \ &&lb_i_move_call_crf, \ &&lb_i_move_call_ext_cre, \ &&lb_i_move_call_ext_last_ePcr, \ &&lb_i_move_call_ext_only_ecr, \ &&lb_i_move_call_last_fPcr, \ &&lb_i_move_call_only_fcr, \ &&lb_i_mtrace_breakpoint, \ &&lb_i_new_bs_put_binary_jsIs, \ &&lb_i_new_bs_put_binary_all_jsI, \ &&lb_i_new_bs_put_binary_imm_jIs, \ &&lb_i_new_bs_put_float_jsIs, \ &&lb_i_new_bs_put_float_imm_jIIs, \ &&lb_i_new_bs_put_integer_jsIs, \ &&lb_i_new_bs_put_integer_imm_jIIs, \ &&lb_i_plus_jId, \ &&lb_i_put_tuple_Anr, \ &&lb_i_put_tuple_Anx, \ &&lb_i_put_tuple_Arx, \ &&lb_i_put_tuple_Ary, \ &&lb_i_put_tuple_Axr, \ &&lb_i_put_tuple_Axx, \ &&lb_i_put_tuple_Axy, \ &&lb_i_put_tuple_Ayr, \ &&lb_i_put_tuple_Ayx, \ &&lb_i_put_tuple_Ayy, \ &&lb_i_put_tuple_Acr, \ &&lb_i_put_tuple_Acx, \ &&lb_i_put_tuple_Acy, \ &&lb_i_put_tuple_only_Ad, \ &&lb_i_rem_jId, \ &&lb_i_return_to_trace, \ &&lb_i_select_big_sf, \ &&lb_i_select_float_sfI, \ &&lb_i_select_tuple_arity_sfI, \ &&lb_i_select_val_sfI, \ &&lb_i_times_jId, \ &&lb_i_trace_breakpoint, \ &&lb_i_trim_I, \ &&lb_i_wait_error, \ &&lb_i_wait_error_locked, \ &&lb_i_wait_timeout_fI, \ &&lb_i_wait_timeout_fs, \ &&lb_i_wait_timeout_locked_fI, \ &&lb_i_wait_timeout_locked_fs, \ &&lb_i_yield, \ &&lb_if_end, \ &&lb_init_y, \ &&lb_init2_yy, \ &&lb_init3_yyy, \ &&lb_int_code_end, \ &&lb_is_atom_fr, \ &&lb_is_atom_fx, \ &&lb_is_atom_fy, \ &&lb_is_binary_fr, \ &&lb_is_binary_fx, \ &&lb_is_binary_fy, \ &&lb_is_bitstring_fr, \ &&lb_is_bitstring_fx, \ &&lb_is_bitstring_fy, \ &&lb_is_boolean_fr, \ &&lb_is_boolean_fx, \ &&lb_is_boolean_fy, \ &&lb_is_constant_fr, \ &&lb_is_constant_fx, \ &&lb_is_constant_fy, \ &&lb_is_float_fr, \ &&lb_is_float_fx, \ &&lb_is_float_fy, \ &&lb_is_function_fr, \ &&lb_is_function_fx, \ &&lb_is_function_fy, \ &&lb_is_function2_fss, \ &&lb_is_integer_fr, \ &&lb_is_integer_fx, \ &&lb_is_integer_fy, \ &&lb_is_integer_allocate_frII, \ &&lb_is_integer_allocate_fxII, \ &&lb_is_list_fr, \ &&lb_is_list_fx, \ &&lb_is_list_fy, \ &&lb_is_nil_fr, \ &&lb_is_nil_fx, \ &&lb_is_nil_fy, \ &&lb_is_non_empty_list_test_heap_frII, \ &&lb_is_nonempty_list_fr, \ &&lb_is_nonempty_list_fx, \ &&lb_is_nonempty_list_fy, \ &&lb_is_nonempty_list_allocate_frII, \ &&lb_is_nonempty_list_allocate_fxII, \ &&lb_is_number_fr, \ &&lb_is_number_fx, \ &&lb_is_number_fy, \ &&lb_is_pid_fr, \ &&lb_is_pid_fx, \ &&lb_is_pid_fy, \ &&lb_is_port_fr, \ &&lb_is_port_fx, \ &&lb_is_port_fy, \ &&lb_is_reference_fr, \ &&lb_is_reference_fx, \ &&lb_is_reference_fy, \ &&lb_is_tuple_fr, \ &&lb_is_tuple_fx, \ &&lb_is_tuple_fy, \ &&lb_is_tuple_of_arity_frA, \ &&lb_is_tuple_of_arity_fxA, \ &&lb_is_tuple_of_arity_fyA, \ &&lb_jump_f, \ &&lb_label_L, \ &&lb_loop_rec_end_f, \ &&lb_move_nr, \ &&lb_move_nx, \ &&lb_move_rx, \ &&lb_move_ry, \ &&lb_move_xr, \ &&lb_move_xx, \ &&lb_move_xy, \ &&lb_move_yr, \ &&lb_move_yx, \ &&lb_move_yy, \ &&lb_move_cr, \ &&lb_move_cx, \ &&lb_move_cy, \ &&lb_move_sd, \ &&lb_move2_xyxy, \ &&lb_move2_yxyx, \ &&lb_move_call_xrf, \ &&lb_move_call_yrf, \ &&lb_move_call_last_xrfP, \ &&lb_move_call_last_yrfP, \ &&lb_move_call_only_xrf, \ &&lb_move_deallocate_return_nrP, \ &&lb_move_deallocate_return_xrP, \ &&lb_move_deallocate_return_yrP, \ &&lb_move_deallocate_return_crP, \ &&lb_move_return_nr, \ &&lb_move_return_xr, \ &&lb_move_return_cr, \ &&lb_node_r, \ &&lb_node_x, \ &&lb_node_y, \ &&lb_normal_exit, \ &&lb_put_n, \ &&lb_put_r, \ &&lb_put_x, \ &&lb_put_y, \ &&lb_put_c, \ &&lb_put_list_rnx, \ &&lb_put_list_rxr, \ &&lb_put_list_rxx, \ &&lb_put_list_ryx, \ &&lb_put_list_xnx, \ &&lb_put_list_xrr, \ &&lb_put_list_xxr, \ &&lb_put_list_xxx, \ &&lb_put_list_xyx, \ &&lb_put_list_ynx, \ &&lb_put_list_yrr, \ &&lb_put_list_yrx, \ &&lb_put_list_yxx, \ &&lb_put_list_yyr, \ &&lb_put_list_yyx, \ &&lb_put_list_rcr, \ &&lb_put_list_rcx, \ &&lb_put_list_rcy, \ &&lb_put_list_xcr, \ &&lb_put_list_xcx, \ &&lb_put_list_xcy, \ &&lb_put_list_ycr, \ &&lb_put_list_ycx, \ &&lb_put_list_ycy, \ &&lb_put_list_cnr, \ &&lb_put_list_cnx, \ &&lb_put_list_crr, \ &&lb_put_list_crx, \ &&lb_put_list_cry, \ &&lb_put_list_cxr, \ &&lb_put_list_cxx, \ &&lb_put_list_cxy, \ &&lb_put_list_cyr, \ &&lb_put_list_cyx, \ &&lb_put_list_cyy, \ &&lb_put_list_ssd, \ &&lb_put_string_IId, \ &&lb_raise_ss, \ &&lb_remove_message, \ &&lb_return, \ &&lb_return_trace, \ &&lb_self_r, \ &&lb_self_x, \ &&lb_self_y, \ &&lb_send, \ &&lb_set_tuple_element_sdP, \ &&lb_system_limit_j, \ &&lb_test_arity_frA, \ &&lb_test_arity_fxA, \ &&lb_test_arity_fyA, \ &&lb_test_heap_II, \ &&lb_test_heap_1_put_list_Iy, \ &&lb_timeout, \ &&lb_timeout_locked, \ &&lb_too_old_compiler, \ &&lb_try_case_end_s, \ &&lb_try_end_y, \ &&lb_wait_f, \ &&lb_wait_locked_f, \ &&lb_wait_unlocked_f, #define DEFINE_COUNTING_OPCODES \ &&lb_count_allocate_tt, \ &&lb_count_allocate_heap_III, \ &&lb_count_allocate_heap_zero_III, \ &&lb_count_allocate_init_tIy, \ &&lb_count_allocate_zero_tt, \ &&lb_count_apply_I, \ &&lb_count_apply_bif, \ &&lb_count_apply_last_IP, \ &&lb_count_badarg_j, \ &&lb_count_badmatch_s, \ &&lb_count_bif1_fbsd, \ &&lb_count_bif1_body_bsd, \ &&lb_count_bs_context_to_binary_r, \ &&lb_count_bs_context_to_binary_x, \ &&lb_count_bs_context_to_binary_y, \ &&lb_count_bs_init_writable, \ &&lb_count_bs_put_string_II, \ &&lb_count_bs_test_tail_imm2_frI, \ &&lb_count_bs_test_tail_imm2_fxI, \ &&lb_count_bs_test_unit_frI, \ &&lb_count_bs_test_unit_fxI, \ &&lb_count_bs_test_unit8_fr, \ &&lb_count_bs_test_unit8_fx, \ &&lb_count_bs_test_zero_tail2_fr, \ &&lb_count_bs_test_zero_tail2_fx, \ &&lb_count_call_bif0_e, \ &&lb_count_call_bif1_e, \ &&lb_count_call_bif2_e, \ &&lb_count_call_bif3_e, \ &&lb_count_call_error_handler, \ &&lb_count_call_traced_function, \ &&lb_count_case_end_s, \ &&lb_count_catch_yf, \ &&lb_count_catch_end_y, \ &&lb_count_continue_exit, \ &&lb_count_deallocate_I, \ &&lb_count_deallocate_return_P, \ &&lb_count_error_action_code, \ &&lb_count_extract_next_element_x, \ &&lb_count_extract_next_element_y, \ &&lb_count_extract_next_element2_x, \ &&lb_count_extract_next_element2_y, \ &&lb_count_extract_next_element3_x, \ &&lb_count_extract_next_element3_y, \ &&lb_count_fclearerror, \ &&lb_count_fconv_dl, \ &&lb_count_fmove_ql, \ &&lb_count_fmove_dl, \ &&lb_count_fmove_new_ld, \ &&lb_count_get_list_rrx, \ &&lb_count_get_list_rry, \ &&lb_count_get_list_rxr, \ &&lb_count_get_list_rxx, \ &&lb_count_get_list_rxy, \ &&lb_count_get_list_ryr, \ &&lb_count_get_list_ryx, \ &&lb_count_get_list_ryy, \ &&lb_count_get_list_xrx, \ &&lb_count_get_list_xry, \ &&lb_count_get_list_xxr, \ &&lb_count_get_list_xxx, \ &&lb_count_get_list_xxy, \ &&lb_count_get_list_xyr, \ &&lb_count_get_list_xyx, \ &&lb_count_get_list_xyy, \ &&lb_count_get_list_yrx, \ &&lb_count_get_list_yry, \ &&lb_count_get_list_yxr, \ &&lb_count_get_list_yxx, \ &&lb_count_get_list_yxy, \ &&lb_count_get_list_yyr, \ &&lb_count_get_list_yyx, \ &&lb_count_get_list_yyy, \ &&lb_count_i_apply, \ &&lb_count_i_apply_fun, \ &&lb_count_i_apply_fun_last_P, \ &&lb_count_i_apply_fun_only, \ &&lb_count_i_apply_last_P, \ &&lb_count_i_apply_only, \ &&lb_count_i_band_jId, \ &&lb_count_i_bif2_fbd, \ &&lb_count_i_bif2_body_bd, \ &&lb_count_i_bor_jId, \ &&lb_count_i_bs_add_jId, \ &&lb_count_i_bs_append_jIIId, \ &&lb_count_i_bs_bits_to_bytes_rjd, \ &&lb_count_i_bs_bits_to_bytes_xjd, \ &&lb_count_i_bs_bits_to_bytes_yjd, \ &&lb_count_i_bs_get_binary2_frIsId, \ &&lb_count_i_bs_get_binary2_fxIsId, \ &&lb_count_i_bs_get_binary_all2_frIId, \ &&lb_count_i_bs_get_binary_all2_fxIId, \ &&lb_count_i_bs_get_binary_all_reuse_rfI, \ &&lb_count_i_bs_get_binary_all_reuse_xfI, \ &&lb_count_i_bs_get_binary_imm2_frIIId, \ &&lb_count_i_bs_get_binary_imm2_fxIIId, \ &&lb_count_i_bs_get_float2_frIsId, \ &&lb_count_i_bs_get_float2_fxIsId, \ &&lb_count_i_bs_get_integer_fIId, \ &&lb_count_i_bs_get_integer_16_rfd, \ &&lb_count_i_bs_get_integer_16_xfd, \ &&lb_count_i_bs_get_integer_32_rfId, \ &&lb_count_i_bs_get_integer_32_xfId, \ &&lb_count_i_bs_get_integer_8_rfd, \ &&lb_count_i_bs_get_integer_8_xfd, \ &&lb_count_i_bs_get_integer_imm_rIIfId, \ &&lb_count_i_bs_get_integer_imm_xIIfId, \ &&lb_count_i_bs_get_integer_small_imm_rIfId, \ &&lb_count_i_bs_get_integer_small_imm_xIfId, \ &&lb_count_i_bs_get_utf16_rfId, \ &&lb_count_i_bs_get_utf16_xfId, \ &&lb_count_i_bs_get_utf8_rfd, \ &&lb_count_i_bs_get_utf8_xfd, \ &&lb_count_i_bs_init_IId, \ &&lb_count_i_bs_init_bits_IId, \ &&lb_count_i_bs_init_bits_fail_rjId, \ &&lb_count_i_bs_init_bits_fail_xjId, \ &&lb_count_i_bs_init_bits_fail_yjId, \ &&lb_count_i_bs_init_bits_fail_heap_IjId, \ &&lb_count_i_bs_init_bits_heap_IIId, \ &&lb_count_i_bs_init_fail_rjId, \ &&lb_count_i_bs_init_fail_xjId, \ &&lb_count_i_bs_init_fail_yjId, \ &&lb_count_i_bs_init_fail_heap_IjId, \ &&lb_count_i_bs_init_heap_IIId, \ &&lb_count_i_bs_init_heap_bin_IId, \ &&lb_count_i_bs_init_heap_bin_heap_IIId, \ &&lb_count_i_bs_match_string_rfII, \ &&lb_count_i_bs_match_string_xfII, \ &&lb_count_i_bs_private_append_jId, \ &&lb_count_i_bs_put_utf16_jIs, \ &&lb_count_i_bs_put_utf8_js, \ &&lb_count_i_bs_restore2_rI, \ &&lb_count_i_bs_restore2_xI, \ &&lb_count_i_bs_save2_rI, \ &&lb_count_i_bs_save2_xI, \ &&lb_count_i_bs_skip_bits2_frxI, \ &&lb_count_i_bs_skip_bits2_fryI, \ &&lb_count_i_bs_skip_bits2_fxrI, \ &&lb_count_i_bs_skip_bits2_fxxI, \ &&lb_count_i_bs_skip_bits2_fxyI, \ &&lb_count_i_bs_skip_bits_all2_frI, \ &&lb_count_i_bs_skip_bits_all2_fxI, \ &&lb_count_i_bs_skip_bits_imm2_frI, \ &&lb_count_i_bs_skip_bits_imm2_fxI, \ &&lb_count_i_bs_start_match2_rfIId, \ &&lb_count_i_bs_start_match2_xfIId, \ &&lb_count_i_bs_start_match2_yfIId, \ &&lb_count_i_bs_utf16_size_sd, \ &&lb_count_i_bs_utf8_size_sd, \ &&lb_count_i_bs_validate_unicode_js, \ &&lb_count_i_bs_validate_unicode_retract_j, \ &&lb_count_i_bsl_jId, \ &&lb_count_i_bsr_jId, \ &&lb_count_i_bxor_jId, \ &&lb_count_i_call_f, \ &&lb_count_i_call_ext_e, \ &&lb_count_i_call_ext_last_eP, \ &&lb_count_i_call_ext_only_e, \ &&lb_count_i_call_fun_I, \ &&lb_count_i_call_fun_last_IP, \ &&lb_count_i_call_last_fP, \ &&lb_count_i_call_only_f, \ &&lb_count_i_count_breakpoint, \ &&lb_count_i_debug_breakpoint, \ &&lb_count_i_element_jssd, \ &&lb_count_i_fadd_lll, \ &&lb_count_i_fast_element_jIsd, \ &&lb_count_i_fcheckerror, \ &&lb_count_i_fdiv_lll, \ &&lb_count_i_fetch_rx, \ &&lb_count_i_fetch_ry, \ &&lb_count_i_fetch_xr, \ &&lb_count_i_fetch_xx, \ &&lb_count_i_fetch_xy, \ &&lb_count_i_fetch_yr, \ &&lb_count_i_fetch_yx, \ &&lb_count_i_fetch_yy, \ &&lb_count_i_fetch_rc, \ &&lb_count_i_fetch_xc, \ &&lb_count_i_fetch_yc, \ &&lb_count_i_fetch_cr, \ &&lb_count_i_fetch_cx, \ &&lb_count_i_fetch_cy, \ &&lb_count_i_fetch_cc, \ &&lb_count_i_fetch_ss, \ &&lb_count_i_fmul_lll, \ &&lb_count_i_fnegate_ll, \ &&lb_count_i_fsub_lll, \ &&lb_count_i_func_info_IaaI, \ &&lb_count_i_gc_bif1_jIsId, \ &&lb_count_i_get_sd, \ &&lb_count_i_get_tuple_element_rPr, \ &&lb_count_i_get_tuple_element_rPx, \ &&lb_count_i_get_tuple_element_rPy, \ &&lb_count_i_get_tuple_element_xPr, \ &&lb_count_i_get_tuple_element_xPx, \ &&lb_count_i_get_tuple_element_xPy, \ &&lb_count_i_get_tuple_element_yPr, \ &&lb_count_i_get_tuple_element_yPx, \ &&lb_count_i_get_tuple_element_yPy, \ &&lb_count_i_global_cons, \ &&lb_count_i_global_copy, \ &&lb_count_i_global_tuple, \ &&lb_count_i_hibernate, \ &&lb_count_i_int_bnot_jsId, \ &&lb_count_i_int_div_jId, \ &&lb_count_i_is_eq_f, \ &&lb_count_i_is_eq_exact_f, \ &&lb_count_i_is_eq_immed_frc, \ &&lb_count_i_is_eq_immed_fxc, \ &&lb_count_i_is_eq_immed_fyc, \ &&lb_count_i_is_ge_f, \ &&lb_count_i_is_lt_f, \ &&lb_count_i_is_ne_f, \ &&lb_count_i_is_ne_exact_f, \ &&lb_count_i_jump_on_val_sfII, \ &&lb_count_i_jump_on_val_zero_sfI, \ &&lb_count_i_loop_rec_fr, \ &&lb_count_i_m_div_jId, \ &&lb_count_i_make_fun_It, \ &&lb_count_i_minus_jId, \ &&lb_count_i_move_call_crf, \ &&lb_count_i_move_call_ext_cre, \ &&lb_count_i_move_call_ext_last_ePcr, \ &&lb_count_i_move_call_ext_only_ecr, \ &&lb_count_i_move_call_last_fPcr, \ &&lb_count_i_move_call_only_fcr, \ &&lb_count_i_mtrace_breakpoint, \ &&lb_count_i_new_bs_put_binary_jsIs, \ &&lb_count_i_new_bs_put_binary_all_jsI, \ &&lb_count_i_new_bs_put_binary_imm_jIs, \ &&lb_count_i_new_bs_put_float_jsIs, \ &&lb_count_i_new_bs_put_float_imm_jIIs, \ &&lb_count_i_new_bs_put_integer_jsIs, \ &&lb_count_i_new_bs_put_integer_imm_jIIs, \ &&lb_count_i_plus_jId, \ &&lb_count_i_put_tuple_Anr, \ &&lb_count_i_put_tuple_Anx, \ &&lb_count_i_put_tuple_Arx, \ &&lb_count_i_put_tuple_Ary, \ &&lb_count_i_put_tuple_Axr, \ &&lb_count_i_put_tuple_Axx, \ &&lb_count_i_put_tuple_Axy, \ &&lb_count_i_put_tuple_Ayr, \ &&lb_count_i_put_tuple_Ayx, \ &&lb_count_i_put_tuple_Ayy, \ &&lb_count_i_put_tuple_Acr, \ &&lb_count_i_put_tuple_Acx, \ &&lb_count_i_put_tuple_Acy, \ &&lb_count_i_put_tuple_only_Ad, \ &&lb_count_i_rem_jId, \ &&lb_count_i_return_to_trace, \ &&lb_count_i_select_big_sf, \ &&lb_count_i_select_float_sfI, \ &&lb_count_i_select_tuple_arity_sfI, \ &&lb_count_i_select_val_sfI, \ &&lb_count_i_times_jId, \ &&lb_count_i_trace_breakpoint, \ &&lb_count_i_trim_I, \ &&lb_count_i_wait_error, \ &&lb_count_i_wait_error_locked, \ &&lb_count_i_wait_timeout_fI, \ &&lb_count_i_wait_timeout_fs, \ &&lb_count_i_wait_timeout_locked_fI, \ &&lb_count_i_wait_timeout_locked_fs, \ &&lb_count_i_yield, \ &&lb_count_if_end, \ &&lb_count_init_y, \ &&lb_count_init2_yy, \ &&lb_count_init3_yyy, \ &&lb_count_int_code_end, \ &&lb_count_is_atom_fr, \ &&lb_count_is_atom_fx, \ &&lb_count_is_atom_fy, \ &&lb_count_is_binary_fr, \ &&lb_count_is_binary_fx, \ &&lb_count_is_binary_fy, \ &&lb_count_is_bitstring_fr, \ &&lb_count_is_bitstring_fx, \ &&lb_count_is_bitstring_fy, \ &&lb_count_is_boolean_fr, \ &&lb_count_is_boolean_fx, \ &&lb_count_is_boolean_fy, \ &&lb_count_is_constant_fr, \ &&lb_count_is_constant_fx, \ &&lb_count_is_constant_fy, \ &&lb_count_is_float_fr, \ &&lb_count_is_float_fx, \ &&lb_count_is_float_fy, \ &&lb_count_is_function_fr, \ &&lb_count_is_function_fx, \ &&lb_count_is_function_fy, \ &&lb_count_is_function2_fss, \ &&lb_count_is_integer_fr, \ &&lb_count_is_integer_fx, \ &&lb_count_is_integer_fy, \ &&lb_count_is_integer_allocate_frII, \ &&lb_count_is_integer_allocate_fxII, \ &&lb_count_is_list_fr, \ &&lb_count_is_list_fx, \ &&lb_count_is_list_fy, \ &&lb_count_is_nil_fr, \ &&lb_count_is_nil_fx, \ &&lb_count_is_nil_fy, \ &&lb_count_is_non_empty_list_test_heap_frII, \ &&lb_count_is_nonempty_list_fr, \ &&lb_count_is_nonempty_list_fx, \ &&lb_count_is_nonempty_list_fy, \ &&lb_count_is_nonempty_list_allocate_frII, \ &&lb_count_is_nonempty_list_allocate_fxII, \ &&lb_count_is_number_fr, \ &&lb_count_is_number_fx, \ &&lb_count_is_number_fy, \ &&lb_count_is_pid_fr, \ &&lb_count_is_pid_fx, \ &&lb_count_is_pid_fy, \ &&lb_count_is_port_fr, \ &&lb_count_is_port_fx, \ &&lb_count_is_port_fy, \ &&lb_count_is_reference_fr, \ &&lb_count_is_reference_fx, \ &&lb_count_is_reference_fy, \ &&lb_count_is_tuple_fr, \ &&lb_count_is_tuple_fx, \ &&lb_count_is_tuple_fy, \ &&lb_count_is_tuple_of_arity_frA, \ &&lb_count_is_tuple_of_arity_fxA, \ &&lb_count_is_tuple_of_arity_fyA, \ &&lb_count_jump_f, \ &&lb_count_label_L, \ &&lb_count_loop_rec_end_f, \ &&lb_count_move_nr, \ &&lb_count_move_nx, \ &&lb_count_move_rx, \ &&lb_count_move_ry, \ &&lb_count_move_xr, \ &&lb_count_move_xx, \ &&lb_count_move_xy, \ &&lb_count_move_yr, \ &&lb_count_move_yx, \ &&lb_count_move_yy, \ &&lb_count_move_cr, \ &&lb_count_move_cx, \ &&lb_count_move_cy, \ &&lb_count_move_sd, \ &&lb_count_move2_xyxy, \ &&lb_count_move2_yxyx, \ &&lb_count_move_call_xrf, \ &&lb_count_move_call_yrf, \ &&lb_count_move_call_last_xrfP, \ &&lb_count_move_call_last_yrfP, \ &&lb_count_move_call_only_xrf, \ &&lb_count_move_deallocate_return_nrP, \ &&lb_count_move_deallocate_return_xrP, \ &&lb_count_move_deallocate_return_yrP, \ &&lb_count_move_deallocate_return_crP, \ &&lb_count_move_return_nr, \ &&lb_count_move_return_xr, \ &&lb_count_move_return_cr, \ &&lb_count_node_r, \ &&lb_count_node_x, \ &&lb_count_node_y, \ &&lb_count_normal_exit, \ &&lb_count_put_n, \ &&lb_count_put_r, \ &&lb_count_put_x, \ &&lb_count_put_y, \ &&lb_count_put_c, \ &&lb_count_put_list_rnx, \ &&lb_count_put_list_rxr, \ &&lb_count_put_list_rxx, \ &&lb_count_put_list_ryx, \ &&lb_count_put_list_xnx, \ &&lb_count_put_list_xrr, \ &&lb_count_put_list_xxr, \ &&lb_count_put_list_xxx, \ &&lb_count_put_list_xyx, \ &&lb_count_put_list_ynx, \ &&lb_count_put_list_yrr, \ &&lb_count_put_list_yrx, \ &&lb_count_put_list_yxx, \ &&lb_count_put_list_yyr, \ &&lb_count_put_list_yyx, \ &&lb_count_put_list_rcr, \ &&lb_count_put_list_rcx, \ &&lb_count_put_list_rcy, \ &&lb_count_put_list_xcr, \ &&lb_count_put_list_xcx, \ &&lb_count_put_list_xcy, \ &&lb_count_put_list_ycr, \ &&lb_count_put_list_ycx, \ &&lb_count_put_list_ycy, \ &&lb_count_put_list_cnr, \ &&lb_count_put_list_cnx, \ &&lb_count_put_list_crr, \ &&lb_count_put_list_crx, \ &&lb_count_put_list_cry, \ &&lb_count_put_list_cxr, \ &&lb_count_put_list_cxx, \ &&lb_count_put_list_cxy, \ &&lb_count_put_list_cyr, \ &&lb_count_put_list_cyx, \ &&lb_count_put_list_cyy, \ &&lb_count_put_list_ssd, \ &&lb_count_put_string_IId, \ &&lb_count_raise_ss, \ &&lb_count_remove_message, \ &&lb_count_return, \ &&lb_count_return_trace, \ &&lb_count_self_r, \ &&lb_count_self_x, \ &&lb_count_self_y, \ &&lb_count_send, \ &&lb_count_set_tuple_element_sdP, \ &&lb_count_system_limit_j, \ &&lb_count_test_arity_frA, \ &&lb_count_test_arity_fxA, \ &&lb_count_test_arity_fyA, \ &&lb_count_test_heap_II, \ &&lb_count_test_heap_1_put_list_Iy, \ &&lb_count_timeout, \ &&lb_count_timeout_locked, \ &&lb_count_too_old_compiler, \ &&lb_count_try_case_end_s, \ &&lb_count_try_end_y, \ &&lb_count_wait_f, \ &&lb_count_wait_locked_f, \ &&lb_count_wait_unlocked_f, #define DEFINE_COUNTING_LABELS \ CountCase(allocate_tt): opc[0].count++; goto lb_allocate_tt; \ CountCase(allocate_heap_III): opc[1].count++; goto lb_allocate_heap_III; \ CountCase(allocate_heap_zero_III): opc[2].count++; goto lb_allocate_heap_zero_III; \ CountCase(allocate_init_tIy): opc[3].count++; goto lb_allocate_init_tIy; \ CountCase(allocate_zero_tt): opc[4].count++; goto lb_allocate_zero_tt; \ CountCase(apply_I): opc[5].count++; goto lb_apply_I; \ CountCase(apply_bif): opc[6].count++; goto lb_apply_bif; \ CountCase(apply_last_IP): opc[7].count++; goto lb_apply_last_IP; \ CountCase(badarg_j): opc[8].count++; goto lb_badarg_j; \ CountCase(badmatch_s): opc[9].count++; goto lb_badmatch_s; \ CountCase(bif1_fbsd): opc[10].count++; goto lb_bif1_fbsd; \ CountCase(bif1_body_bsd): opc[11].count++; goto lb_bif1_body_bsd; \ CountCase(bs_context_to_binary_r): opc[12].count++; goto lb_bs_context_to_binary_r; \ CountCase(bs_context_to_binary_x): opc[13].count++; goto lb_bs_context_to_binary_x; \ CountCase(bs_context_to_binary_y): opc[14].count++; goto lb_bs_context_to_binary_y; \ CountCase(bs_init_writable): opc[15].count++; goto lb_bs_init_writable; \ CountCase(bs_put_string_II): opc[16].count++; goto lb_bs_put_string_II; \ CountCase(bs_test_tail_imm2_frI): opc[17].count++; goto lb_bs_test_tail_imm2_frI; \ CountCase(bs_test_tail_imm2_fxI): opc[18].count++; goto lb_bs_test_tail_imm2_fxI; \ CountCase(bs_test_unit_frI): opc[19].count++; goto lb_bs_test_unit_frI; \ CountCase(bs_test_unit_fxI): opc[20].count++; goto lb_bs_test_unit_fxI; \ CountCase(bs_test_unit8_fr): opc[21].count++; goto lb_bs_test_unit8_fr; \ CountCase(bs_test_unit8_fx): opc[22].count++; goto lb_bs_test_unit8_fx; \ CountCase(bs_test_zero_tail2_fr): opc[23].count++; goto lb_bs_test_zero_tail2_fr; \ CountCase(bs_test_zero_tail2_fx): opc[24].count++; goto lb_bs_test_zero_tail2_fx; \ CountCase(call_bif0_e): opc[25].count++; goto lb_call_bif0_e; \ CountCase(call_bif1_e): opc[26].count++; goto lb_call_bif1_e; \ CountCase(call_bif2_e): opc[27].count++; goto lb_call_bif2_e; \ CountCase(call_bif3_e): opc[28].count++; goto lb_call_bif3_e; \ CountCase(call_error_handler): opc[29].count++; goto lb_call_error_handler; \ CountCase(call_traced_function): opc[30].count++; goto lb_call_traced_function; \ CountCase(case_end_s): opc[31].count++; goto lb_case_end_s; \ CountCase(catch_yf): opc[32].count++; goto lb_catch_yf; \ CountCase(catch_end_y): opc[33].count++; goto lb_catch_end_y; \ CountCase(continue_exit): opc[34].count++; goto lb_continue_exit; \ CountCase(deallocate_I): opc[35].count++; goto lb_deallocate_I; \ CountCase(deallocate_return_P): opc[36].count++; goto lb_deallocate_return_P; \ CountCase(error_action_code): opc[37].count++; goto lb_error_action_code; \ CountCase(extract_next_element_x): opc[38].count++; goto lb_extract_next_element_x; \ CountCase(extract_next_element_y): opc[39].count++; goto lb_extract_next_element_y; \ CountCase(extract_next_element2_x): opc[40].count++; goto lb_extract_next_element2_x; \ CountCase(extract_next_element2_y): opc[41].count++; goto lb_extract_next_element2_y; \ CountCase(extract_next_element3_x): opc[42].count++; goto lb_extract_next_element3_x; \ CountCase(extract_next_element3_y): opc[43].count++; goto lb_extract_next_element3_y; \ CountCase(fclearerror): opc[44].count++; goto lb_fclearerror; \ CountCase(fconv_dl): opc[45].count++; goto lb_fconv_dl; \ CountCase(fmove_ql): opc[46].count++; goto lb_fmove_ql; \ CountCase(fmove_dl): opc[47].count++; goto lb_fmove_dl; \ CountCase(fmove_new_ld): opc[48].count++; goto lb_fmove_new_ld; \ CountCase(get_list_rrx): opc[49].count++; goto lb_get_list_rrx; \ CountCase(get_list_rry): opc[50].count++; goto lb_get_list_rry; \ CountCase(get_list_rxr): opc[51].count++; goto lb_get_list_rxr; \ CountCase(get_list_rxx): opc[52].count++; goto lb_get_list_rxx; \ CountCase(get_list_rxy): opc[53].count++; goto lb_get_list_rxy; \ CountCase(get_list_ryr): opc[54].count++; goto lb_get_list_ryr; \ CountCase(get_list_ryx): opc[55].count++; goto lb_get_list_ryx; \ CountCase(get_list_ryy): opc[56].count++; goto lb_get_list_ryy; \ CountCase(get_list_xrx): opc[57].count++; goto lb_get_list_xrx; \ CountCase(get_list_xry): opc[58].count++; goto lb_get_list_xry; \ CountCase(get_list_xxr): opc[59].count++; goto lb_get_list_xxr; \ CountCase(get_list_xxx): opc[60].count++; goto lb_get_list_xxx; \ CountCase(get_list_xxy): opc[61].count++; goto lb_get_list_xxy; \ CountCase(get_list_xyr): opc[62].count++; goto lb_get_list_xyr; \ CountCase(get_list_xyx): opc[63].count++; goto lb_get_list_xyx; \ CountCase(get_list_xyy): opc[64].count++; goto lb_get_list_xyy; \ CountCase(get_list_yrx): opc[65].count++; goto lb_get_list_yrx; \ CountCase(get_list_yry): opc[66].count++; goto lb_get_list_yry; \ CountCase(get_list_yxr): opc[67].count++; goto lb_get_list_yxr; \ CountCase(get_list_yxx): opc[68].count++; goto lb_get_list_yxx; \ CountCase(get_list_yxy): opc[69].count++; goto lb_get_list_yxy; \ CountCase(get_list_yyr): opc[70].count++; goto lb_get_list_yyr; \ CountCase(get_list_yyx): opc[71].count++; goto lb_get_list_yyx; \ CountCase(get_list_yyy): opc[72].count++; goto lb_get_list_yyy; \ CountCase(i_apply): opc[73].count++; goto lb_i_apply; \ CountCase(i_apply_fun): opc[74].count++; goto lb_i_apply_fun; \ CountCase(i_apply_fun_last_P): opc[75].count++; goto lb_i_apply_fun_last_P; \ CountCase(i_apply_fun_only): opc[76].count++; goto lb_i_apply_fun_only; \ CountCase(i_apply_last_P): opc[77].count++; goto lb_i_apply_last_P; \ CountCase(i_apply_only): opc[78].count++; goto lb_i_apply_only; \ CountCase(i_band_jId): opc[79].count++; goto lb_i_band_jId; \ CountCase(i_bif2_fbd): opc[80].count++; goto lb_i_bif2_fbd; \ CountCase(i_bif2_body_bd): opc[81].count++; goto lb_i_bif2_body_bd; \ CountCase(i_bor_jId): opc[82].count++; goto lb_i_bor_jId; \ CountCase(i_bs_add_jId): opc[83].count++; goto lb_i_bs_add_jId; \ CountCase(i_bs_append_jIIId): opc[84].count++; goto lb_i_bs_append_jIIId; \ CountCase(i_bs_bits_to_bytes_rjd): opc[85].count++; goto lb_i_bs_bits_to_bytes_rjd; \ CountCase(i_bs_bits_to_bytes_xjd): opc[86].count++; goto lb_i_bs_bits_to_bytes_xjd; \ CountCase(i_bs_bits_to_bytes_yjd): opc[87].count++; goto lb_i_bs_bits_to_bytes_yjd; \ CountCase(i_bs_get_binary2_frIsId): opc[88].count++; goto lb_i_bs_get_binary2_frIsId; \ CountCase(i_bs_get_binary2_fxIsId): opc[89].count++; goto lb_i_bs_get_binary2_fxIsId; \ CountCase(i_bs_get_binary_all2_frIId): opc[90].count++; goto lb_i_bs_get_binary_all2_frIId; \ CountCase(i_bs_get_binary_all2_fxIId): opc[91].count++; goto lb_i_bs_get_binary_all2_fxIId; \ CountCase(i_bs_get_binary_all_reuse_rfI): opc[92].count++; goto lb_i_bs_get_binary_all_reuse_rfI; \ CountCase(i_bs_get_binary_all_reuse_xfI): opc[93].count++; goto lb_i_bs_get_binary_all_reuse_xfI; \ CountCase(i_bs_get_binary_imm2_frIIId): opc[94].count++; goto lb_i_bs_get_binary_imm2_frIIId; \ CountCase(i_bs_get_binary_imm2_fxIIId): opc[95].count++; goto lb_i_bs_get_binary_imm2_fxIIId; \ CountCase(i_bs_get_float2_frIsId): opc[96].count++; goto lb_i_bs_get_float2_frIsId; \ CountCase(i_bs_get_float2_fxIsId): opc[97].count++; goto lb_i_bs_get_float2_fxIsId; \ CountCase(i_bs_get_integer_fIId): opc[98].count++; goto lb_i_bs_get_integer_fIId; \ CountCase(i_bs_get_integer_16_rfd): opc[99].count++; goto lb_i_bs_get_integer_16_rfd; \ CountCase(i_bs_get_integer_16_xfd): opc[100].count++; goto lb_i_bs_get_integer_16_xfd; \ CountCase(i_bs_get_integer_32_rfId): opc[101].count++; goto lb_i_bs_get_integer_32_rfId; \ CountCase(i_bs_get_integer_32_xfId): opc[102].count++; goto lb_i_bs_get_integer_32_xfId; \ CountCase(i_bs_get_integer_8_rfd): opc[103].count++; goto lb_i_bs_get_integer_8_rfd; \ CountCase(i_bs_get_integer_8_xfd): opc[104].count++; goto lb_i_bs_get_integer_8_xfd; \ CountCase(i_bs_get_integer_imm_rIIfId): opc[105].count++; goto lb_i_bs_get_integer_imm_rIIfId; \ CountCase(i_bs_get_integer_imm_xIIfId): opc[106].count++; goto lb_i_bs_get_integer_imm_xIIfId; \ CountCase(i_bs_get_integer_small_imm_rIfId): opc[107].count++; goto lb_i_bs_get_integer_small_imm_rIfId; \ CountCase(i_bs_get_integer_small_imm_xIfId): opc[108].count++; goto lb_i_bs_get_integer_small_imm_xIfId; \ CountCase(i_bs_get_utf16_rfId): opc[109].count++; goto lb_i_bs_get_utf16_rfId; \ CountCase(i_bs_get_utf16_xfId): opc[110].count++; goto lb_i_bs_get_utf16_xfId; \ CountCase(i_bs_get_utf8_rfd): opc[111].count++; goto lb_i_bs_get_utf8_rfd; \ CountCase(i_bs_get_utf8_xfd): opc[112].count++; goto lb_i_bs_get_utf8_xfd; \ CountCase(i_bs_init_IId): opc[113].count++; goto lb_i_bs_init_IId; \ CountCase(i_bs_init_bits_IId): opc[114].count++; goto lb_i_bs_init_bits_IId; \ CountCase(i_bs_init_bits_fail_rjId): opc[115].count++; goto lb_i_bs_init_bits_fail_rjId; \ CountCase(i_bs_init_bits_fail_xjId): opc[116].count++; goto lb_i_bs_init_bits_fail_xjId; \ CountCase(i_bs_init_bits_fail_yjId): opc[117].count++; goto lb_i_bs_init_bits_fail_yjId; \ CountCase(i_bs_init_bits_fail_heap_IjId): opc[118].count++; goto lb_i_bs_init_bits_fail_heap_IjId; \ CountCase(i_bs_init_bits_heap_IIId): opc[119].count++; goto lb_i_bs_init_bits_heap_IIId; \ CountCase(i_bs_init_fail_rjId): opc[120].count++; goto lb_i_bs_init_fail_rjId; \ CountCase(i_bs_init_fail_xjId): opc[121].count++; goto lb_i_bs_init_fail_xjId; \ CountCase(i_bs_init_fail_yjId): opc[122].count++; goto lb_i_bs_init_fail_yjId; \ CountCase(i_bs_init_fail_heap_IjId): opc[123].count++; goto lb_i_bs_init_fail_heap_IjId; \ CountCase(i_bs_init_heap_IIId): opc[124].count++; goto lb_i_bs_init_heap_IIId; \ CountCase(i_bs_init_heap_bin_IId): opc[125].count++; goto lb_i_bs_init_heap_bin_IId; \ CountCase(i_bs_init_heap_bin_heap_IIId): opc[126].count++; goto lb_i_bs_init_heap_bin_heap_IIId; \ CountCase(i_bs_match_string_rfII): opc[127].count++; goto lb_i_bs_match_string_rfII; \ CountCase(i_bs_match_string_xfII): opc[128].count++; goto lb_i_bs_match_string_xfII; \ CountCase(i_bs_private_append_jId): opc[129].count++; goto lb_i_bs_private_append_jId; \ CountCase(i_bs_put_utf16_jIs): opc[130].count++; goto lb_i_bs_put_utf16_jIs; \ CountCase(i_bs_put_utf8_js): opc[131].count++; goto lb_i_bs_put_utf8_js; \ CountCase(i_bs_restore2_rI): opc[132].count++; goto lb_i_bs_restore2_rI; \ CountCase(i_bs_restore2_xI): opc[133].count++; goto lb_i_bs_restore2_xI; \ CountCase(i_bs_save2_rI): opc[134].count++; goto lb_i_bs_save2_rI; \ CountCase(i_bs_save2_xI): opc[135].count++; goto lb_i_bs_save2_xI; \ CountCase(i_bs_skip_bits2_frxI): opc[136].count++; goto lb_i_bs_skip_bits2_frxI; \ CountCase(i_bs_skip_bits2_fryI): opc[137].count++; goto lb_i_bs_skip_bits2_fryI; \ CountCase(i_bs_skip_bits2_fxrI): opc[138].count++; goto lb_i_bs_skip_bits2_fxrI; \ CountCase(i_bs_skip_bits2_fxxI): opc[139].count++; goto lb_i_bs_skip_bits2_fxxI; \ CountCase(i_bs_skip_bits2_fxyI): opc[140].count++; goto lb_i_bs_skip_bits2_fxyI; \ CountCase(i_bs_skip_bits_all2_frI): opc[141].count++; goto lb_i_bs_skip_bits_all2_frI; \ CountCase(i_bs_skip_bits_all2_fxI): opc[142].count++; goto lb_i_bs_skip_bits_all2_fxI; \ CountCase(i_bs_skip_bits_imm2_frI): opc[143].count++; goto lb_i_bs_skip_bits_imm2_frI; \ CountCase(i_bs_skip_bits_imm2_fxI): opc[144].count++; goto lb_i_bs_skip_bits_imm2_fxI; \ CountCase(i_bs_start_match2_rfIId): opc[145].count++; goto lb_i_bs_start_match2_rfIId; \ CountCase(i_bs_start_match2_xfIId): opc[146].count++; goto lb_i_bs_start_match2_xfIId; \ CountCase(i_bs_start_match2_yfIId): opc[147].count++; goto lb_i_bs_start_match2_yfIId; \ CountCase(i_bs_utf16_size_sd): opc[148].count++; goto lb_i_bs_utf16_size_sd; \ CountCase(i_bs_utf8_size_sd): opc[149].count++; goto lb_i_bs_utf8_size_sd; \ CountCase(i_bs_validate_unicode_js): opc[150].count++; goto lb_i_bs_validate_unicode_js; \ CountCase(i_bs_validate_unicode_retract_j): opc[151].count++; goto lb_i_bs_validate_unicode_retract_j; \ CountCase(i_bsl_jId): opc[152].count++; goto lb_i_bsl_jId; \ CountCase(i_bsr_jId): opc[153].count++; goto lb_i_bsr_jId; \ CountCase(i_bxor_jId): opc[154].count++; goto lb_i_bxor_jId; \ CountCase(i_call_f): opc[155].count++; goto lb_i_call_f; \ CountCase(i_call_ext_e): opc[156].count++; goto lb_i_call_ext_e; \ CountCase(i_call_ext_last_eP): opc[157].count++; goto lb_i_call_ext_last_eP; \ CountCase(i_call_ext_only_e): opc[158].count++; goto lb_i_call_ext_only_e; \ CountCase(i_call_fun_I): opc[159].count++; goto lb_i_call_fun_I; \ CountCase(i_call_fun_last_IP): opc[160].count++; goto lb_i_call_fun_last_IP; \ CountCase(i_call_last_fP): opc[161].count++; goto lb_i_call_last_fP; \ CountCase(i_call_only_f): opc[162].count++; goto lb_i_call_only_f; \ CountCase(i_count_breakpoint): opc[163].count++; goto lb_i_count_breakpoint; \ CountCase(i_debug_breakpoint): opc[164].count++; goto lb_i_debug_breakpoint; \ CountCase(i_element_jssd): opc[165].count++; goto lb_i_element_jssd; \ CountCase(i_fadd_lll): opc[166].count++; goto lb_i_fadd_lll; \ CountCase(i_fast_element_jIsd): opc[167].count++; goto lb_i_fast_element_jIsd; \ CountCase(i_fcheckerror): opc[168].count++; goto lb_i_fcheckerror; \ CountCase(i_fdiv_lll): opc[169].count++; goto lb_i_fdiv_lll; \ CountCase(i_fetch_rx): opc[170].count++; goto lb_i_fetch_rx; \ CountCase(i_fetch_ry): opc[171].count++; goto lb_i_fetch_ry; \ CountCase(i_fetch_xr): opc[172].count++; goto lb_i_fetch_xr; \ CountCase(i_fetch_xx): opc[173].count++; goto lb_i_fetch_xx; \ CountCase(i_fetch_xy): opc[174].count++; goto lb_i_fetch_xy; \ CountCase(i_fetch_yr): opc[175].count++; goto lb_i_fetch_yr; \ CountCase(i_fetch_yx): opc[176].count++; goto lb_i_fetch_yx; \ CountCase(i_fetch_yy): opc[177].count++; goto lb_i_fetch_yy; \ CountCase(i_fetch_rc): opc[178].count++; goto lb_i_fetch_rc; \ CountCase(i_fetch_xc): opc[179].count++; goto lb_i_fetch_xc; \ CountCase(i_fetch_yc): opc[180].count++; goto lb_i_fetch_yc; \ CountCase(i_fetch_cr): opc[181].count++; goto lb_i_fetch_cr; \ CountCase(i_fetch_cx): opc[182].count++; goto lb_i_fetch_cx; \ CountCase(i_fetch_cy): opc[183].count++; goto lb_i_fetch_cy; \ CountCase(i_fetch_cc): opc[184].count++; goto lb_i_fetch_cc; \ CountCase(i_fetch_ss): opc[185].count++; goto lb_i_fetch_ss; \ CountCase(i_fmul_lll): opc[186].count++; goto lb_i_fmul_lll; \ CountCase(i_fnegate_ll): opc[187].count++; goto lb_i_fnegate_ll; \ CountCase(i_fsub_lll): opc[188].count++; goto lb_i_fsub_lll; \ CountCase(i_func_info_IaaI): opc[189].count++; goto lb_i_func_info_IaaI; \ CountCase(i_gc_bif1_jIsId): opc[190].count++; goto lb_i_gc_bif1_jIsId; \ CountCase(i_get_sd): opc[191].count++; goto lb_i_get_sd; \ CountCase(i_get_tuple_element_rPr): opc[192].count++; goto lb_i_get_tuple_element_rPr; \ CountCase(i_get_tuple_element_rPx): opc[193].count++; goto lb_i_get_tuple_element_rPx; \ CountCase(i_get_tuple_element_rPy): opc[194].count++; goto lb_i_get_tuple_element_rPy; \ CountCase(i_get_tuple_element_xPr): opc[195].count++; goto lb_i_get_tuple_element_xPr; \ CountCase(i_get_tuple_element_xPx): opc[196].count++; goto lb_i_get_tuple_element_xPx; \ CountCase(i_get_tuple_element_xPy): opc[197].count++; goto lb_i_get_tuple_element_xPy; \ CountCase(i_get_tuple_element_yPr): opc[198].count++; goto lb_i_get_tuple_element_yPr; \ CountCase(i_get_tuple_element_yPx): opc[199].count++; goto lb_i_get_tuple_element_yPx; \ CountCase(i_get_tuple_element_yPy): opc[200].count++; goto lb_i_get_tuple_element_yPy; \ CountCase(i_global_cons): opc[201].count++; goto lb_i_global_cons; \ CountCase(i_global_copy): opc[202].count++; goto lb_i_global_copy; \ CountCase(i_global_tuple): opc[203].count++; goto lb_i_global_tuple; \ CountCase(i_hibernate): opc[204].count++; goto lb_i_hibernate; \ CountCase(i_int_bnot_jsId): opc[205].count++; goto lb_i_int_bnot_jsId; \ CountCase(i_int_div_jId): opc[206].count++; goto lb_i_int_div_jId; \ CountCase(i_is_eq_f): opc[207].count++; goto lb_i_is_eq_f; \ CountCase(i_is_eq_exact_f): opc[208].count++; goto lb_i_is_eq_exact_f; \ CountCase(i_is_eq_immed_frc): opc[209].count++; goto lb_i_is_eq_immed_frc; \ CountCase(i_is_eq_immed_fxc): opc[210].count++; goto lb_i_is_eq_immed_fxc; \ CountCase(i_is_eq_immed_fyc): opc[211].count++; goto lb_i_is_eq_immed_fyc; \ CountCase(i_is_ge_f): opc[212].count++; goto lb_i_is_ge_f; \ CountCase(i_is_lt_f): opc[213].count++; goto lb_i_is_lt_f; \ CountCase(i_is_ne_f): opc[214].count++; goto lb_i_is_ne_f; \ CountCase(i_is_ne_exact_f): opc[215].count++; goto lb_i_is_ne_exact_f; \ CountCase(i_jump_on_val_sfII): opc[216].count++; goto lb_i_jump_on_val_sfII; \ CountCase(i_jump_on_val_zero_sfI): opc[217].count++; goto lb_i_jump_on_val_zero_sfI; \ CountCase(i_loop_rec_fr): opc[218].count++; goto lb_i_loop_rec_fr; \ CountCase(i_m_div_jId): opc[219].count++; goto lb_i_m_div_jId; \ CountCase(i_make_fun_It): opc[220].count++; goto lb_i_make_fun_It; \ CountCase(i_minus_jId): opc[221].count++; goto lb_i_minus_jId; \ CountCase(i_move_call_crf): opc[222].count++; goto lb_i_move_call_crf; \ CountCase(i_move_call_ext_cre): opc[223].count++; goto lb_i_move_call_ext_cre; \ CountCase(i_move_call_ext_last_ePcr): opc[224].count++; goto lb_i_move_call_ext_last_ePcr; \ CountCase(i_move_call_ext_only_ecr): opc[225].count++; goto lb_i_move_call_ext_only_ecr; \ CountCase(i_move_call_last_fPcr): opc[226].count++; goto lb_i_move_call_last_fPcr; \ CountCase(i_move_call_only_fcr): opc[227].count++; goto lb_i_move_call_only_fcr; \ CountCase(i_mtrace_breakpoint): opc[228].count++; goto lb_i_mtrace_breakpoint; \ CountCase(i_new_bs_put_binary_jsIs): opc[229].count++; goto lb_i_new_bs_put_binary_jsIs; \ CountCase(i_new_bs_put_binary_all_jsI): opc[230].count++; goto lb_i_new_bs_put_binary_all_jsI; \ CountCase(i_new_bs_put_binary_imm_jIs): opc[231].count++; goto lb_i_new_bs_put_binary_imm_jIs; \ CountCase(i_new_bs_put_float_jsIs): opc[232].count++; goto lb_i_new_bs_put_float_jsIs; \ CountCase(i_new_bs_put_float_imm_jIIs): opc[233].count++; goto lb_i_new_bs_put_float_imm_jIIs; \ CountCase(i_new_bs_put_integer_jsIs): opc[234].count++; goto lb_i_new_bs_put_integer_jsIs; \ CountCase(i_new_bs_put_integer_imm_jIIs): opc[235].count++; goto lb_i_new_bs_put_integer_imm_jIIs; \ CountCase(i_plus_jId): opc[236].count++; goto lb_i_plus_jId; \ CountCase(i_put_tuple_Anr): opc[237].count++; goto lb_i_put_tuple_Anr; \ CountCase(i_put_tuple_Anx): opc[238].count++; goto lb_i_put_tuple_Anx; \ CountCase(i_put_tuple_Arx): opc[239].count++; goto lb_i_put_tuple_Arx; \ CountCase(i_put_tuple_Ary): opc[240].count++; goto lb_i_put_tuple_Ary; \ CountCase(i_put_tuple_Axr): opc[241].count++; goto lb_i_put_tuple_Axr; \ CountCase(i_put_tuple_Axx): opc[242].count++; goto lb_i_put_tuple_Axx; \ CountCase(i_put_tuple_Axy): opc[243].count++; goto lb_i_put_tuple_Axy; \ CountCase(i_put_tuple_Ayr): opc[244].count++; goto lb_i_put_tuple_Ayr; \ CountCase(i_put_tuple_Ayx): opc[245].count++; goto lb_i_put_tuple_Ayx; \ CountCase(i_put_tuple_Ayy): opc[246].count++; goto lb_i_put_tuple_Ayy; \ CountCase(i_put_tuple_Acr): opc[247].count++; goto lb_i_put_tuple_Acr; \ CountCase(i_put_tuple_Acx): opc[248].count++; goto lb_i_put_tuple_Acx; \ CountCase(i_put_tuple_Acy): opc[249].count++; goto lb_i_put_tuple_Acy; \ CountCase(i_put_tuple_only_Ad): opc[250].count++; goto lb_i_put_tuple_only_Ad; \ CountCase(i_rem_jId): opc[251].count++; goto lb_i_rem_jId; \ CountCase(i_return_to_trace): opc[252].count++; goto lb_i_return_to_trace; \ CountCase(i_select_big_sf): opc[253].count++; goto lb_i_select_big_sf; \ CountCase(i_select_float_sfI): opc[254].count++; goto lb_i_select_float_sfI; \ CountCase(i_select_tuple_arity_sfI): opc[255].count++; goto lb_i_select_tuple_arity_sfI; \ CountCase(i_select_val_sfI): opc[256].count++; goto lb_i_select_val_sfI; \ CountCase(i_times_jId): opc[257].count++; goto lb_i_times_jId; \ CountCase(i_trace_breakpoint): opc[258].count++; goto lb_i_trace_breakpoint; \ CountCase(i_trim_I): opc[259].count++; goto lb_i_trim_I; \ CountCase(i_wait_error): opc[260].count++; goto lb_i_wait_error; \ CountCase(i_wait_error_locked): opc[261].count++; goto lb_i_wait_error_locked; \ CountCase(i_wait_timeout_fI): opc[262].count++; goto lb_i_wait_timeout_fI; \ CountCase(i_wait_timeout_fs): opc[263].count++; goto lb_i_wait_timeout_fs; \ CountCase(i_wait_timeout_locked_fI): opc[264].count++; goto lb_i_wait_timeout_locked_fI; \ CountCase(i_wait_timeout_locked_fs): opc[265].count++; goto lb_i_wait_timeout_locked_fs; \ CountCase(i_yield): opc[266].count++; goto lb_i_yield; \ CountCase(if_end): opc[267].count++; goto lb_if_end; \ CountCase(init_y): opc[268].count++; goto lb_init_y; \ CountCase(init2_yy): opc[269].count++; goto lb_init2_yy; \ CountCase(init3_yyy): opc[270].count++; goto lb_init3_yyy; \ CountCase(int_code_end): opc[271].count++; goto lb_int_code_end; \ CountCase(is_atom_fr): opc[272].count++; goto lb_is_atom_fr; \ CountCase(is_atom_fx): opc[273].count++; goto lb_is_atom_fx; \ CountCase(is_atom_fy): opc[274].count++; goto lb_is_atom_fy; \ CountCase(is_binary_fr): opc[275].count++; goto lb_is_binary_fr; \ CountCase(is_binary_fx): opc[276].count++; goto lb_is_binary_fx; \ CountCase(is_binary_fy): opc[277].count++; goto lb_is_binary_fy; \ CountCase(is_bitstring_fr): opc[278].count++; goto lb_is_bitstring_fr; \ CountCase(is_bitstring_fx): opc[279].count++; goto lb_is_bitstring_fx; \ CountCase(is_bitstring_fy): opc[280].count++; goto lb_is_bitstring_fy; \ CountCase(is_boolean_fr): opc[281].count++; goto lb_is_boolean_fr; \ CountCase(is_boolean_fx): opc[282].count++; goto lb_is_boolean_fx; \ CountCase(is_boolean_fy): opc[283].count++; goto lb_is_boolean_fy; \ CountCase(is_constant_fr): opc[284].count++; goto lb_is_constant_fr; \ CountCase(is_constant_fx): opc[285].count++; goto lb_is_constant_fx; \ CountCase(is_constant_fy): opc[286].count++; goto lb_is_constant_fy; \ CountCase(is_float_fr): opc[287].count++; goto lb_is_float_fr; \ CountCase(is_float_fx): opc[288].count++; goto lb_is_float_fx; \ CountCase(is_float_fy): opc[289].count++; goto lb_is_float_fy; \ CountCase(is_function_fr): opc[290].count++; goto lb_is_function_fr; \ CountCase(is_function_fx): opc[291].count++; goto lb_is_function_fx; \ CountCase(is_function_fy): opc[292].count++; goto lb_is_function_fy; \ CountCase(is_function2_fss): opc[293].count++; goto lb_is_function2_fss; \ CountCase(is_integer_fr): opc[294].count++; goto lb_is_integer_fr; \ CountCase(is_integer_fx): opc[295].count++; goto lb_is_integer_fx; \ CountCase(is_integer_fy): opc[296].count++; goto lb_is_integer_fy; \ CountCase(is_integer_allocate_frII): opc[297].count++; goto lb_is_integer_allocate_frII; \ CountCase(is_integer_allocate_fxII): opc[298].count++; goto lb_is_integer_allocate_fxII; \ CountCase(is_list_fr): opc[299].count++; goto lb_is_list_fr; \ CountCase(is_list_fx): opc[300].count++; goto lb_is_list_fx; \ CountCase(is_list_fy): opc[301].count++; goto lb_is_list_fy; \ CountCase(is_nil_fr): opc[302].count++; goto lb_is_nil_fr; \ CountCase(is_nil_fx): opc[303].count++; goto lb_is_nil_fx; \ CountCase(is_nil_fy): opc[304].count++; goto lb_is_nil_fy; \ CountCase(is_non_empty_list_test_heap_frII): opc[305].count++; goto lb_is_non_empty_list_test_heap_frII; \ CountCase(is_nonempty_list_fr): opc[306].count++; goto lb_is_nonempty_list_fr; \ CountCase(is_nonempty_list_fx): opc[307].count++; goto lb_is_nonempty_list_fx; \ CountCase(is_nonempty_list_fy): opc[308].count++; goto lb_is_nonempty_list_fy; \ CountCase(is_nonempty_list_allocate_frII): opc[309].count++; goto lb_is_nonempty_list_allocate_frII; \ CountCase(is_nonempty_list_allocate_fxII): opc[310].count++; goto lb_is_nonempty_list_allocate_fxII; \ CountCase(is_number_fr): opc[311].count++; goto lb_is_number_fr; \ CountCase(is_number_fx): opc[312].count++; goto lb_is_number_fx; \ CountCase(is_number_fy): opc[313].count++; goto lb_is_number_fy; \ CountCase(is_pid_fr): opc[314].count++; goto lb_is_pid_fr; \ CountCase(is_pid_fx): opc[315].count++; goto lb_is_pid_fx; \ CountCase(is_pid_fy): opc[316].count++; goto lb_is_pid_fy; \ CountCase(is_port_fr): opc[317].count++; goto lb_is_port_fr; \ CountCase(is_port_fx): opc[318].count++; goto lb_is_port_fx; \ CountCase(is_port_fy): opc[319].count++; goto lb_is_port_fy; \ CountCase(is_reference_fr): opc[320].count++; goto lb_is_reference_fr; \ CountCase(is_reference_fx): opc[321].count++; goto lb_is_reference_fx; \ CountCase(is_reference_fy): opc[322].count++; goto lb_is_reference_fy; \ CountCase(is_tuple_fr): opc[323].count++; goto lb_is_tuple_fr; \ CountCase(is_tuple_fx): opc[324].count++; goto lb_is_tuple_fx; \ CountCase(is_tuple_fy): opc[325].count++; goto lb_is_tuple_fy; \ CountCase(is_tuple_of_arity_frA): opc[326].count++; goto lb_is_tuple_of_arity_frA; \ CountCase(is_tuple_of_arity_fxA): opc[327].count++; goto lb_is_tuple_of_arity_fxA; \ CountCase(is_tuple_of_arity_fyA): opc[328].count++; goto lb_is_tuple_of_arity_fyA; \ CountCase(jump_f): opc[329].count++; goto lb_jump_f; \ CountCase(label_L): opc[330].count++; goto lb_label_L; \ CountCase(loop_rec_end_f): opc[331].count++; goto lb_loop_rec_end_f; \ CountCase(move_nr): opc[332].count++; goto lb_move_nr; \ CountCase(move_nx): opc[333].count++; goto lb_move_nx; \ CountCase(move_rx): opc[334].count++; goto lb_move_rx; \ CountCase(move_ry): opc[335].count++; goto lb_move_ry; \ CountCase(move_xr): opc[336].count++; goto lb_move_xr; \ CountCase(move_xx): opc[337].count++; goto lb_move_xx; \ CountCase(move_xy): opc[338].count++; goto lb_move_xy; \ CountCase(move_yr): opc[339].count++; goto lb_move_yr; \ CountCase(move_yx): opc[340].count++; goto lb_move_yx; \ CountCase(move_yy): opc[341].count++; goto lb_move_yy; \ CountCase(move_cr): opc[342].count++; goto lb_move_cr; \ CountCase(move_cx): opc[343].count++; goto lb_move_cx; \ CountCase(move_cy): opc[344].count++; goto lb_move_cy; \ CountCase(move_sd): opc[345].count++; goto lb_move_sd; \ CountCase(move2_xyxy): opc[346].count++; goto lb_move2_xyxy; \ CountCase(move2_yxyx): opc[347].count++; goto lb_move2_yxyx; \ CountCase(move_call_xrf): opc[348].count++; goto lb_move_call_xrf; \ CountCase(move_call_yrf): opc[349].count++; goto lb_move_call_yrf; \ CountCase(move_call_last_xrfP): opc[350].count++; goto lb_move_call_last_xrfP; \ CountCase(move_call_last_yrfP): opc[351].count++; goto lb_move_call_last_yrfP; \ CountCase(move_call_only_xrf): opc[352].count++; goto lb_move_call_only_xrf; \ CountCase(move_deallocate_return_nrP): opc[353].count++; goto lb_move_deallocate_return_nrP; \ CountCase(move_deallocate_return_xrP): opc[354].count++; goto lb_move_deallocate_return_xrP; \ CountCase(move_deallocate_return_yrP): opc[355].count++; goto lb_move_deallocate_return_yrP; \ CountCase(move_deallocate_return_crP): opc[356].count++; goto lb_move_deallocate_return_crP; \ CountCase(move_return_nr): opc[357].count++; goto lb_move_return_nr; \ CountCase(move_return_xr): opc[358].count++; goto lb_move_return_xr; \ CountCase(move_return_cr): opc[359].count++; goto lb_move_return_cr; \ CountCase(node_r): opc[360].count++; goto lb_node_r; \ CountCase(node_x): opc[361].count++; goto lb_node_x; \ CountCase(node_y): opc[362].count++; goto lb_node_y; \ CountCase(normal_exit): opc[363].count++; goto lb_normal_exit; \ CountCase(put_n): opc[364].count++; goto lb_put_n; \ CountCase(put_r): opc[365].count++; goto lb_put_r; \ CountCase(put_x): opc[366].count++; goto lb_put_x; \ CountCase(put_y): opc[367].count++; goto lb_put_y; \ CountCase(put_c): opc[368].count++; goto lb_put_c; \ CountCase(put_list_rnx): opc[369].count++; goto lb_put_list_rnx; \ CountCase(put_list_rxr): opc[370].count++; goto lb_put_list_rxr; \ CountCase(put_list_rxx): opc[371].count++; goto lb_put_list_rxx; \ CountCase(put_list_ryx): opc[372].count++; goto lb_put_list_ryx; \ CountCase(put_list_xnx): opc[373].count++; goto lb_put_list_xnx; \ CountCase(put_list_xrr): opc[374].count++; goto lb_put_list_xrr; \ CountCase(put_list_xxr): opc[375].count++; goto lb_put_list_xxr; \ CountCase(put_list_xxx): opc[376].count++; goto lb_put_list_xxx; \ CountCase(put_list_xyx): opc[377].count++; goto lb_put_list_xyx; \ CountCase(put_list_ynx): opc[378].count++; goto lb_put_list_ynx; \ CountCase(put_list_yrr): opc[379].count++; goto lb_put_list_yrr; \ CountCase(put_list_yrx): opc[380].count++; goto lb_put_list_yrx; \ CountCase(put_list_yxx): opc[381].count++; goto lb_put_list_yxx; \ CountCase(put_list_yyr): opc[382].count++; goto lb_put_list_yyr; \ CountCase(put_list_yyx): opc[383].count++; goto lb_put_list_yyx; \ CountCase(put_list_rcr): opc[384].count++; goto lb_put_list_rcr; \ CountCase(put_list_rcx): opc[385].count++; goto lb_put_list_rcx; \ CountCase(put_list_rcy): opc[386].count++; goto lb_put_list_rcy; \ CountCase(put_list_xcr): opc[387].count++; goto lb_put_list_xcr; \ CountCase(put_list_xcx): opc[388].count++; goto lb_put_list_xcx; \ CountCase(put_list_xcy): opc[389].count++; goto lb_put_list_xcy; \ CountCase(put_list_ycr): opc[390].count++; goto lb_put_list_ycr; \ CountCase(put_list_ycx): opc[391].count++; goto lb_put_list_ycx; \ CountCase(put_list_ycy): opc[392].count++; goto lb_put_list_ycy; \ CountCase(put_list_cnr): opc[393].count++; goto lb_put_list_cnr; \ CountCase(put_list_cnx): opc[394].count++; goto lb_put_list_cnx; \ CountCase(put_list_crr): opc[395].count++; goto lb_put_list_crr; \ CountCase(put_list_crx): opc[396].count++; goto lb_put_list_crx; \ CountCase(put_list_cry): opc[397].count++; goto lb_put_list_cry; \ CountCase(put_list_cxr): opc[398].count++; goto lb_put_list_cxr; \ CountCase(put_list_cxx): opc[399].count++; goto lb_put_list_cxx; \ CountCase(put_list_cxy): opc[400].count++; goto lb_put_list_cxy; \ CountCase(put_list_cyr): opc[401].count++; goto lb_put_list_cyr; \ CountCase(put_list_cyx): opc[402].count++; goto lb_put_list_cyx; \ CountCase(put_list_cyy): opc[403].count++; goto lb_put_list_cyy; \ CountCase(put_list_ssd): opc[404].count++; goto lb_put_list_ssd; \ CountCase(put_string_IId): opc[405].count++; goto lb_put_string_IId; \ CountCase(raise_ss): opc[406].count++; goto lb_raise_ss; \ CountCase(remove_message): opc[407].count++; goto lb_remove_message; \ CountCase(return): opc[408].count++; goto lb_return; \ CountCase(return_trace): opc[409].count++; goto lb_return_trace; \ CountCase(self_r): opc[410].count++; goto lb_self_r; \ CountCase(self_x): opc[411].count++; goto lb_self_x; \ CountCase(self_y): opc[412].count++; goto lb_self_y; \ CountCase(send): opc[413].count++; goto lb_send; \ CountCase(set_tuple_element_sdP): opc[414].count++; goto lb_set_tuple_element_sdP; \ CountCase(system_limit_j): opc[415].count++; goto lb_system_limit_j; \ CountCase(test_arity_frA): opc[416].count++; goto lb_test_arity_frA; \ CountCase(test_arity_fxA): opc[417].count++; goto lb_test_arity_fxA; \ CountCase(test_arity_fyA): opc[418].count++; goto lb_test_arity_fyA; \ CountCase(test_heap_II): opc[419].count++; goto lb_test_heap_II; \ CountCase(test_heap_1_put_list_Iy): opc[420].count++; goto lb_test_heap_1_put_list_Iy; \ CountCase(timeout): opc[421].count++; goto lb_timeout; \ CountCase(timeout_locked): opc[422].count++; goto lb_timeout_locked; \ CountCase(too_old_compiler): opc[423].count++; goto lb_too_old_compiler; \ CountCase(try_case_end_s): opc[424].count++; goto lb_try_case_end_s; \ CountCase(try_end_y): opc[425].count++; goto lb_try_end_y; \ CountCase(wait_f): opc[426].count++; goto lb_wait_f; \ CountCase(wait_locked_f): opc[427].count++; goto lb_wait_locked_f; \ CountCase(wait_unlocked_f): opc[428].count++; goto lb_wait_unlocked_f; #define genop_label_1 1 #define genop_func_info_3 2 #define genop_int_code_end_0 3 #define genop_call_2 4 #define genop_call_last_3 5 #define genop_call_only_2 6 #define genop_call_ext_2 7 #define genop_call_ext_last_3 8 #define genop_bif0_2 9 #define genop_bif1_4 10 #define genop_bif2_5 11 #define genop_allocate_2 12 #define genop_allocate_heap_3 13 #define genop_allocate_zero_2 14 #define genop_allocate_heap_zero_3 15 #define genop_test_heap_2 16 #define genop_init_1 17 #define genop_deallocate_1 18 #define genop_return_0 19 #define genop_send_0 20 #define genop_remove_message_0 21 #define genop_timeout_0 22 #define genop_loop_rec_2 23 #define genop_loop_rec_end_1 24 #define genop_wait_1 25 #define genop_wait_timeout_2 26 #define genop_m_plus_4 27 #define genop_m_minus_4 28 #define genop_m_times_4 29 #define genop_m_div_4 30 #define genop_int_div_4 31 #define genop_int_rem_4 32 #define genop_int_band_4 33 #define genop_int_bor_4 34 #define genop_int_bxor_4 35 #define genop_int_bsl_4 36 #define genop_int_bsr_4 37 #define genop_int_bnot_3 38 #define genop_is_lt_3 39 #define genop_is_ge_3 40 #define genop_is_eq_3 41 #define genop_is_ne_3 42 #define genop_is_eq_exact_3 43 #define genop_is_ne_exact_3 44 #define genop_is_integer_2 45 #define genop_is_float_2 46 #define genop_is_number_2 47 #define genop_is_atom_2 48 #define genop_is_pid_2 49 #define genop_is_reference_2 50 #define genop_is_port_2 51 #define genop_is_nil_2 52 #define genop_is_binary_2 53 #define genop_is_constant_2 54 #define genop_is_list_2 55 #define genop_is_nonempty_list_2 56 #define genop_is_tuple_2 57 #define genop_test_arity_3 58 #define genop_select_val_3 59 #define genop_select_tuple_arity_3 60 #define genop_jump_1 61 #define genop_catch_2 62 #define genop_catch_end_1 63 #define genop_move_2 64 #define genop_get_list_3 65 #define genop_get_tuple_element_3 66 #define genop_set_tuple_element_3 67 #define genop_put_string_3 68 #define genop_put_list_3 69 #define genop_put_tuple_2 70 #define genop_put_1 71 #define genop_badmatch_1 72 #define genop_if_end_0 73 #define genop_case_end_1 74 #define genop_call_fun_1 75 #define genop_make_fun_3 76 #define genop_is_function_2 77 #define genop_call_ext_only_2 78 #define genop_bs_start_match_2 79 #define genop_bs_get_integer_5 80 #define genop_bs_get_float_5 81 #define genop_bs_get_binary_5 82 #define genop_bs_skip_bits_4 83 #define genop_bs_test_tail_2 84 #define genop_bs_save_1 85 #define genop_bs_restore_1 86 #define genop_bs_init_2 87 #define genop_bs_final_2 88 #define genop_bs_put_integer_5 89 #define genop_bs_put_binary_5 90 #define genop_bs_put_float_5 91 #define genop_bs_put_string_2 92 #define genop_bs_need_buf_1 93 #define genop_fclearerror_0 94 #define genop_fcheckerror_1 95 #define genop_fmove_2 96 #define genop_fconv_2 97 #define genop_fadd_4 98 #define genop_fsub_4 99 #define genop_fmul_4 100 #define genop_fdiv_4 101 #define genop_fnegate_3 102 #define genop_make_fun2_1 103 #define genop_try_2 104 #define genop_try_end_1 105 #define genop_try_case_1 106 #define genop_try_case_end_1 107 #define genop_raise_2 108 #define genop_bs_init2_6 109 #define genop_bs_bits_to_bytes_3 110 #define genop_bs_add_5 111 #define genop_apply_1 112 #define genop_apply_last_2 113 #define genop_is_boolean_2 114 #define genop_is_function2_3 115 #define genop_bs_start_match2_5 116 #define genop_bs_get_integer2_7 117 #define genop_bs_get_float2_7 118 #define genop_bs_get_binary2_7 119 #define genop_bs_skip_bits2_5 120 #define genop_bs_test_tail2_3 121 #define genop_bs_save2_2 122 #define genop_bs_restore2_2 123 #define genop_gc_bif1_5 124 #define genop_gc_bif2_6 125 #define genop_bs_final2_2 126 #define genop_bs_bits_to_bytes2_2 127 #define genop_put_literal_2 128 #define genop_is_bitstr_2 129 #define genop_bs_context_to_binary_1 130 #define genop_bs_test_unit_3 131 #define genop_bs_match_string_4 132 #define genop_bs_init_writable_0 133 #define genop_bs_append_8 134 #define genop_bs_private_append_6 135 #define genop_trim_2 136 #define genop_bs_init_bits_6 137 #define genop_bs_get_utf8_5 138 #define genop_bs_skip_utf8_4 139 #define genop_bs_get_utf16_5 140 #define genop_bs_skip_utf16_4 141 #define genop_bs_get_utf32_5 142 #define genop_bs_skip_utf32_4 143 #define genop_bs_utf8_size_3 144 #define genop_bs_put_utf8_3 145 #define genop_bs_utf16_size_3 146 #define genop_bs_put_utf16_3 147 #define genop_bs_put_utf32_3 148 #define genop_too_old_compiler_0 149 #define genop_i_func_info_4 150 #define genop_i_trace_breakpoint_0 151 #define genop_i_mtrace_breakpoint_0 152 #define genop_i_debug_breakpoint_0 153 #define genop_i_count_breakpoint_0 154 #define genop_i_return_to_trace_0 155 #define genop_i_yield_0 156 #define genop_i_global_cons_0 157 #define genop_i_global_tuple_0 158 #define genop_i_global_copy_0 159 #define genop_i_trim_1 160 #define genop_init2_2 161 #define genop_init3_3 162 #define genop_i_select_val_3 163 #define genop_i_select_tuple_arity_3 164 #define genop_i_select_big_2 165 #define genop_i_select_float_3 166 #define genop_i_jump_on_val_zero_3 167 #define genop_i_jump_on_val_4 168 #define genop_i_get_tuple_element_3 169 #define genop_badarg_1 170 #define genop_system_limit_1 171 #define genop_move2_4 172 #define genop_timeout_locked_0 173 #define genop_i_loop_rec_2 174 #define genop_wait_locked_1 175 #define genop_wait_unlocked_1 176 #define genop_i_wait_timeout_2 177 #define genop_i_wait_timeout_locked_2 178 #define genop_i_wait_error_0 179 #define genop_i_wait_error_locked_0 180 #define genop_i_is_lt_1 181 #define genop_i_is_ge_1 182 #define genop_i_is_eq_1 183 #define genop_i_is_ne_1 184 #define genop_i_is_eq_exact_1 185 #define genop_i_is_ne_exact_1 186 #define genop_i_is_eq_immed_3 187 #define genop_i_put_tuple_only_2 188 #define genop_i_put_tuple_3 189 #define genop_i_fetch_2 190 #define genop_normal_exit_0 191 #define genop_continue_exit_0 192 #define genop_apply_bif_0 193 #define genop_call_error_handler_0 194 #define genop_error_action_code_0 195 #define genop_call_traced_function_0 196 #define genop_return_trace_0 197 #define genop_move_return_2 198 #define genop_move_deallocate_return_3 199 #define genop_deallocate_return_1 200 #define genop_test_heap_1_put_list_2 201 #define genop_is_tuple_of_arity_3 202 #define genop_original_reg_2 203 #define genop_extract_next_element_1 204 #define genop_extract_next_element2_1 205 #define genop_extract_next_element3_1 206 #define genop_is_integer_allocate_4 207 #define genop_is_nonempty_list_allocate_4 208 #define genop_is_non_empty_list_test_heap_4 209 #define genop_is_bitstring_2 210 #define genop_allocate_init_3 211 #define genop_i_apply_0 212 #define genop_i_apply_last_1 213 #define genop_i_apply_only_0 214 #define genop_i_apply_fun_0 215 #define genop_i_apply_fun_last_1 216 #define genop_i_apply_fun_only_0 217 #define genop_i_hibernate_0 218 #define genop_call_bif0_1 219 #define genop_call_bif1_1 220 #define genop_call_bif2_1 221 #define genop_call_bif3_1 222 #define genop_i_get_2 223 #define genop_self_1 224 #define genop_node_1 225 #define genop_i_fast_element_4 226 #define genop_i_element_4 227 #define genop_bif1_body_3 228 #define genop_i_bif2_3 229 #define genop_i_bif2_body_2 230 #define genop_i_move_call_3 231 #define genop_move_call_3 232 #define genop_i_move_call_last_4 233 #define genop_move_call_last_4 234 #define genop_i_move_call_only_3 235 #define genop_move_call_only_3 236 #define genop_i_call_1 237 #define genop_i_call_last_2 238 #define genop_i_call_only_1 239 #define genop_i_call_ext_1 240 #define genop_i_call_ext_last_2 241 #define genop_i_call_ext_only_1 242 #define genop_i_move_call_ext_3 243 #define genop_i_move_call_ext_last_4 244 #define genop_i_move_call_ext_only_3 245 #define genop_i_call_fun_1 246 #define genop_i_call_fun_last_2 247 #define genop_i_make_fun_2 248 #define genop_i_bs_start_match2_5 249 #define genop_i_bs_save2_2 250 #define genop_i_bs_restore2_2 251 #define genop_i_bs_match_string_4 252 #define genop_i_bs_get_integer_small_imm_5 253 #define genop_i_bs_get_integer_imm_6 254 #define genop_i_bs_get_integer_4 255 #define genop_i_bs_get_integer_8_3 256 #define genop_i_bs_get_integer_16_3 257 #define genop_i_bs_get_integer_32_4 258 #define genop_i_bs_get_binary_imm2_6 259 #define genop_i_bs_get_binary2_6 260 #define genop_i_bs_get_binary_all2_5 261 #define genop_i_bs_get_binary_all_reuse_3 262 #define genop_i_bs_get_float2_6 263 #define genop_i_bs_skip_bits_imm2_3 264 #define genop_i_bs_skip_bits2_4 265 #define genop_i_bs_skip_bits_all2_3 266 #define genop_bs_test_zero_tail2_2 267 #define genop_bs_test_tail_imm2_3 268 #define genop_bs_test_unit8_2 269 #define genop_i_bs_get_utf8_3 270 #define genop_i_bs_get_utf16_4 271 #define genop_i_bs_validate_unicode_retract_1 272 #define genop_i_bs_init_fail_4 273 #define genop_i_bs_init_fail_heap_4 274 #define genop_i_bs_init_3 275 #define genop_i_bs_init_heap_bin_3 276 #define genop_i_bs_init_heap_4 277 #define genop_i_bs_init_heap_bin_heap_4 278 #define genop_i_bs_init_bits_fail_4 279 #define genop_i_bs_init_bits_fail_heap_4 280 #define genop_i_bs_init_bits_3 281 #define genop_i_bs_init_bits_heap_4 282 #define genop_i_bs_bits_to_bytes_3 283 #define genop_i_bs_add_3 284 #define genop_i_bs_append_5 285 #define genop_i_bs_private_append_3 286 #define genop_i_new_bs_put_integer_4 287 #define genop_i_new_bs_put_integer_imm_4 288 #define genop_i_bs_utf8_size_2 289 #define genop_i_bs_utf16_size_2 290 #define genop_i_bs_put_utf8_2 291 #define genop_i_bs_put_utf16_3 292 #define genop_i_bs_validate_unicode_2 293 #define genop_i_new_bs_put_float_4 294 #define genop_i_new_bs_put_float_imm_4 295 #define genop_i_new_bs_put_binary_4 296 #define genop_i_new_bs_put_binary_imm_3 297 #define genop_i_new_bs_put_binary_all_3 298 #define genop_i_fadd_3 299 #define genop_i_fsub_3 300 #define genop_i_fmul_3 301 #define genop_i_fdiv_3 302 #define genop_i_fnegate_2 303 #define genop_i_fcheckerror_0 304 #define genop_fmove_new_2 305 #define genop_i_plus_3 306 #define genop_i_minus_3 307 #define genop_i_times_3 308 #define genop_i_m_div_3 309 #define genop_i_int_div_3 310 #define genop_i_rem_3 311 #define genop_i_bsl_3 312 #define genop_i_bsr_3 313 #define genop_i_band_3 314 #define genop_i_bor_3 315 #define genop_i_bxor_3 316 #define genop_i_int_bnot_4 317 #define genop_i_gc_bif1_5 318 #endif
olikasg/erlang-scala-metrics
otp_src_R12B-5/erts/emulator/i386-apple-darwin14.0.0/opt/smp/beam_opcodes.h
C
lgpl-3.0
95,471
/* * @(#)SwatchPanel.java 1.0 30 March 2005 * * Copyright (c) 2004 Werner Randelshofer * Staldenmattweg 2, Immensee, CH-6405, Switzerland. * All rights reserved. * * This software is the confidential and proprietary information of * Werner Randelshofer. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Werner Randelshofer. */ package org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.colorchooser; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; import javax.swing.event.*; import javax.swing.border.*; import javax.swing.colorchooser.*; import javax.swing.plaf.*; import org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.*; /** * SwatchPanel. * * Code derived from javax.swing.colorchooser.DefaultSwatchChooserPanel. * * @author Werner Randelshofer * @version 1.0 30 March 2005 Created. */ public class SwatchPanel extends javax.swing.JPanel { protected Color[] colors; protected Dimension swatchSize = new Dimension(); protected Dimension defaultSwatchSize; protected Dimension numSwatches; protected Dimension gap; private final static Color gridColor = new Color(0xaaaaaa); /** Creates new form. */ public SwatchPanel() { initComponents(); initValues(); initColors(); setToolTipText(""); // register for events setOpaque(false); //setBackground(Color.white); setRequestFocusEnabled(false); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents setLayout(new java.awt.BorderLayout()); }//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables public boolean isFocusTraversable() { return false; } protected void initValues() { defaultSwatchSize = UIManager.getDimension("ColorChooser.swatchesSwatchSize"); swatchSize.width = defaultSwatchSize.width; swatchSize.height = defaultSwatchSize.height; gap = new Dimension(1, 1); } public void setBounds(int x, int y, int width, int height) { super.setBounds(x, y, width, height); if (width > getPreferredSize().width) { swatchSize.width = (width - numSwatches.width * gap.width) / numSwatches.width; } else { swatchSize.width = defaultSwatchSize.width; } if (height > getPreferredSize().height) { swatchSize.height = (height - numSwatches.height * gap.height) / numSwatches.height; } else { swatchSize.height = defaultSwatchSize.height; } } public void setColors(Color[] colors) { this.colors = colors; } public void setNumSwatches(int rows, int columns) { numSwatches = new Dimension(rows, columns); } public void paintComponent(Graphics g) { Dimension preferredSize = getSwatchesSize(); int xoffset = (getWidth() - preferredSize.width) / 2; int yoffset = 0;// (getHeight() - preferredSize.height) / 2; for (int row = 0; row < numSwatches.height; row++) { for (int column = 0; column < numSwatches.width; column++) { Color cellColor = getColorForCell(column, row); g.setColor(cellColor); //int x = (numSwatches.width - column - 1) * (swatchSize.width + gap.width); int x = xoffset + column * (swatchSize.width + gap.width) + 1; int y = yoffset + row * (swatchSize.height + gap.height) + 1; g.fillRect( x, y, swatchSize.width, swatchSize.height); g.setColor(cellColor.darker()); g.fillRect(x - 1, y - 1, swatchSize.width+1, 1); g.fillRect(x - 1, y, 1, swatchSize.height); } } } public Dimension getSwatchesSize() { int x = numSwatches.width * (swatchSize.width + gap.width); int y = numSwatches.height * (swatchSize.height + gap.height); return new Dimension( x, y ); } public Dimension getPreferredSize() { int x = numSwatches.width * (defaultSwatchSize.width + gap.width); int y = numSwatches.height * (defaultSwatchSize.height + gap.height); return new Dimension( x, y ); } protected void initColors() { } public String getToolTipText(MouseEvent e) { Color color = getColorForLocation(e.getX(), e.getY()); return (color == null) ? null : color.getRed()+", "+ color.getGreen() + ", " + color.getBlue(); } public Color getColorForLocation( int x, int y ) { Dimension preferredSize = getSwatchesSize(); x -= (getWidth() - preferredSize.width) / 2; //y -= (getHeight() - preferredSize.height) / 2; int column; if ((!this.getComponentOrientation().isLeftToRight())) { column = numSwatches.width - x / (swatchSize.width + gap.width) - 1; } else { column = x / (swatchSize.width + gap.width); } int row = y / (swatchSize.height + gap.height); return getColorForCell(column, row); } private Color getColorForCell( int column, int row) { int index = (row * numSwatches.width) + column; return (index < colors.length) ? colors[index] : null; } }
Depter/JRLib
NetbeansProject/jreserve-dummy/substance/src/main/java/org/pushingpixels/substance/internal/contrib/randelshofer/quaqua/colorchooser/SwatchPanel.java
Java
lgpl-3.0
5,863
package com.ToxicBakery.libs.jlibewf.section; import com.ToxicBakery.libs.jlibewf.EWFIOException; import com.ToxicBakery.libs.jlibewf.EWFSection; import com.ToxicBakery.libs.jlibewf.EWFSegmentFileReader; import java.io.File; import java.io.IOException; /** * An implementation of the table section portion of a section. * The table section contains the chunk count and table base offset. */ public class TableSection { /** * the offset into the chunk table offset array. */ public static final int OFFSET_ARRAY_OFFSET = 100; private static final int CHUNK_COUNT_OFFSET = 76; private static final int TABLE_BASE_OFFSET = 84; /** * the number of chunks in this table section. */ private int tableChunkCount; /** * the base offset of the integer chunk offsets with respect to the beginning of the file. */ private long tableBaseOffset; /** * Constructs a table section based on bytes from the given EWF file and address. * * @param reader the EWF reader instance to use for reading * @param sectionPrefix the section prefix from which this header section is composed * @throws IOException If an I/O error occurs, which is possible if the requested read fails */ public TableSection(EWFSegmentFileReader reader, SectionPrefix sectionPrefix, String longFormat) throws IOException { File file = sectionPrefix.getFile(); long fileOffset = sectionPrefix.getFileOffset(); long sectionSize = sectionPrefix.getSectionSize(); // make sure the section prefix is correct if (sectionPrefix.getSectionType() != EWFSection.SectionType.TABLE_TYPE) { throw new RuntimeException("Invalid section type"); } // validate section size if (sectionSize < OFFSET_ARRAY_OFFSET) { throw new EWFIOException("table section chunk count size is too small", file, fileOffset, longFormat); } // read the table section long address = fileOffset + SectionPrefix.SECTION_PREFIX_SIZE; int numBytes = OFFSET_ARRAY_OFFSET - SectionPrefix.SECTION_PREFIX_SIZE; byte[] bytes = reader.readAdler32(file, address, numBytes); // set table section values // tableChunkCount long longChunkCount = EWFSegmentFileReader.bytesToUInt(bytes, CHUNK_COUNT_OFFSET - SectionPrefix.SECTION_PREFIX_SIZE); // make sure the value is valid before typecasting it if (!EWFSection.isPositiveInt(longChunkCount)) { throw new EWFIOException("Invalid chunk count", file, fileOffset, longFormat); } tableChunkCount = (int) longChunkCount; // tableBaseOffset tableBaseOffset = EWFSegmentFileReader.bytesToLong(bytes, TABLE_BASE_OFFSET - SectionPrefix.SECTION_PREFIX_SIZE); } /** * Provides a visual representation of this object. */ public String toString() { return "TableSection: tableChunkCount: " + tableChunkCount + " tableBaseOffset: " + tableBaseOffset; } public int getTableChunkCount() { return tableChunkCount; } public long getTableBaseOffset() { return tableBaseOffset; } }
ToxicBakery/jlibewf
library/src/main/java/com/ToxicBakery/libs/jlibewf/section/TableSection.java
Java
lgpl-3.0
3,217
package net.shadowfacts.shadowmc.ui.element.button; import lombok.Setter; import net.shadowfacts.shadowmc.ui.UIDimensions; import net.shadowfacts.shadowmc.ui.style.UIAttribute; import net.shadowfacts.shadowmc.ui.util.UIHelper; import net.shadowfacts.shadowmc.util.MouseButton; import java.util.function.BiFunction; /** * @author shadowfacts */ public class UIButtonText extends UIButtonBase { @Setter protected String text; protected BiFunction<UIButtonText, MouseButton, Boolean> callback; public UIButtonText(String text, BiFunction<UIButtonText, MouseButton, Boolean> callback, String id, String... classes) { super("button-text", id, classes); this.text = text; this.callback = callback; } @Override protected boolean handlePress(int mouseX, int mouseY, MouseButton button) { return callback.apply(this, button); } @Override protected void drawButton(int mouseX, int mouseY) { UIHelper.drawCenteredText(UIHelper.styleText(text, this), x, y, x + dimensions.width, y + dimensions.height, getStyle(UIAttribute.TEXT_COLOR), getStyle(UIAttribute.TEXT_SHADOW)); } @Override public UIDimensions getMinDimensions() { return getPreferredDimensions(); } @Override public UIDimensions getPreferredDimensions() { return new UIDimensions(mc.fontRenderer.getStringWidth(UIHelper.styleText(text, this)) + 10, mc.fontRenderer.FONT_HEIGHT + 10); } }
shadowfacts/ShadowMC
src/main/java/net/shadowfacts/shadowmc/ui/element/button/UIButtonText.java
Java
lgpl-3.0
1,381
// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see http://www.gnu.org/licenses/. // #ifndef LISNOCBASEMODULE_H_ #define LISNOCBASEMODULE_H_ #include <csimplemodule.h> #include <LISNoCMessages.h> namespace lisnoc { /** * Basic flow control handling * * This class provides the designer the basic flow control protocol * handling as employed by all modules. The class itself is * abstract, i.e., it cannot be instantiated. You need to derive * your module from this class and implement the following function: * * - `void handleIncomingFlit(LISNoCFlit *msg)`: Handle an incoming * message after successfull flow control handshake * * */ class LISNoCBaseModule: public cSimpleModule { public: virtual ~LISNoCBaseModule(); virtual void finish(); private: bool m_allowLateAck; cMessage *m_selfTrigger; LISNoCFlowControlRequest *m_delayedTransfer; simtime_t m_clock; bool m_activeRequest; std::pair<LISNoCFlowControlRequest*, simtime_t> m_pendingRequestWithLateAck; bool m_isInitialized; virtual LISNoCFlowControlRequest *createFlowControlRequest(LISNoCFlit *flit); virtual LISNoCFlowControlRequest *createFlowControlRequest(LISNoCFlowControlGrant *grant); virtual LISNoCFlowControlGrant *createFlowControlGrant(LISNoCFlowControlRequest *request); protected: virtual void initialize(); virtual void allowLateAck(); virtual void handleMessage(cMessage *msg); virtual void handleIncomingRequest(LISNoCFlowControlRequest *msg); virtual void handleIncomingGrant(LISNoCFlowControlGrant *msg); virtual void handleIncomingFlit(LISNoCFlit *msg) = 0; virtual void triggerSelf(unsigned int numcycles = 1, cMessage *msg = NULL); virtual void handleSelfMessage(cMessage *msg) = 0; virtual bool canRequestTransfer(LISNoCFlit *msg); virtual void requestTransfer(LISNoCFlit *msg); virtual void requestTransferAfter(LISNoCFlit *msg, unsigned int numcycles); virtual void delayedTransfer(); virtual void doTransfer() = 0; virtual bool isRequestGranted(LISNoCFlowControlRequest *msg) = 0; virtual void tryLateGrant(); }; } /* namespace lisnoc */ #endif /* LISNOCBASEMODULE_H_ */
TUM-LIS/nocbscsim
omnetpp/src/LISNoCBaseModule.h
C
lgpl-3.0
2,842
<!DOCTYPE html> <html dir="ltr"> <head> <title>Schwermetalle in Moosen</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body contenteditable="true"> <div><h1><font face="Verdana">Schwermetalle in Moosen</font></h1> <p><font face="Verdana">Der Indexdatenbestand des UIM2020 Demonstrators Datenintegration enthält aggregierte Informationen zu Ergebnissen der Moose Aufsammlungen von 1995 - 2010. Im Demonstrator können Sie anhand verschiedener Suchkriterien nach Moosproben suchen. Folgende Navigations-, Such- und Filterkategorien stehen zur Verfügung: </font></p> <ul> <li><font face="Verdana">Navigieren zu Moosproben nach Bundesländern<br></font></li><li><font face="Verdana">Navigieren im Katalog nach Tätigkeitsarten<br></font></li> <li><font face="Verdana">Navigieren zu Moosproben nach Moosarten</font></li> <li><font face="Verdana">Suchen nach Moosproben nach Stichworten</font></li> <li><font face="Verdana">Suchen nach Moosproben auf einer Karte</font></li> <li><font face="Verdana">Filtern der Moosproben-Suchergebnisse nach Schwellwerten für einen oder mehrere Schadstoffe</font></li> <li><font face="Verdana">Datenquellenübergreifendes Filtern aller Suchergebnisse nach Schadstoffen und Schadstoffgruppen</font></li> </ul> <p><font face="Verdana">Darüber hinaus besteht die Möglichkeit, Daten aus der Moosproben Datenlieferung in den Formaten Microsoft Excel, ESRI Shapefile und CSV (comma-separated values) zu exportieren sowie die Originaldatei der Datenlieferung (Microsoft Excel) herunterzuladen. </font></p> </div> </body></html>
cismet/cids-custom-udm2020-di
src/main/resources/de/cismet/cids/custom/udm2020di/description/moss/index.html
HTML
lgpl-3.0
1,954
package net.lomeli.augment.inventory; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.lomeli.lomlib.util.ItemUtil; import net.lomeli.augment.inventory.slot.IPhantomSlot; public class ContainerBase extends Container { @Override public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) { Slot slot = slotNum < 0 ? null : this.inventorySlots.get(slotNum); if (slot instanceof IPhantomSlot) return slotClickPhantom(slot, mouseButton, modifier, player); return super.slotClick(slotNum, mouseButton, modifier, player); } private ItemStack slotClickPhantom(Slot slot, int mouseButton, int modifier, EntityPlayer player) { ItemStack stack = null; if (mouseButton == 2) { if (((IPhantomSlot) slot).canAdjust()) slot.putStack(null); } else if (mouseButton == 0 || mouseButton == 1) { InventoryPlayer playerInv = player.inventory; slot.onSlotChanged(); ItemStack stackSlot = slot.getStack(); ItemStack stackHeld = playerInv.getItemStack(); if (stackSlot != null) stack = stackSlot.copy(); if (stackSlot == null) { if (stackHeld != null && slot.isItemValid(stackHeld)) fillPhantomSlot(slot, stackHeld, mouseButton); } else if (stackHeld == null) { adjustPhantomSlot(slot, mouseButton, modifier); slot.onPickupFromSlot(player, playerInv.getItemStack()); } else if (slot.isItemValid(stackHeld)) { if (ItemUtil.canStacksMerge(stackSlot, stackHeld)) adjustPhantomSlot(slot, mouseButton, modifier); else fillPhantomSlot(slot, stackHeld, mouseButton); } } return stack; } protected void adjustPhantomSlot(Slot slot, int mouseButton, int modifier) { if (!((IPhantomSlot) slot).canAdjust()) return; ItemStack stackSlot = slot.getStack(); int stackSize; if (modifier == 1) stackSize = mouseButton == 0 ? (stackSlot.stackSize + 1) / 2 : stackSlot.stackSize * 2; else stackSize = mouseButton == 0 ? stackSlot.stackSize - 1 : stackSlot.stackSize + 1; if (stackSize > slot.getSlotStackLimit()) stackSize = slot.getSlotStackLimit(); stackSlot.stackSize = stackSize; if (stackSlot.stackSize <= 0) slot.putStack(null); } protected void fillPhantomSlot(Slot slot, ItemStack stackHeld, int mouseButton) { if (!((IPhantomSlot) slot).canAdjust()) return; int stackSize = mouseButton == 0 ? stackHeld.stackSize : 1; if (stackSize > slot.getSlotStackLimit()) stackSize = slot.getSlotStackLimit(); ItemStack phantomStack = stackHeld.copy(); phantomStack.stackSize = stackSize; slot.putStack(phantomStack); } @Override public boolean canInteractWith(EntityPlayer player) { return false; } @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { return null; } }
Lomeli12/Augmented-Accessories
src/main/java/net/lomeli/augment/inventory/ContainerBase.java
Java
lgpl-3.0
3,424
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns='http://www.w3.org/1999/xhtml' lang='he' dir='rtl'> <head> <meta http-equiv='Content-Type' content='text/html; charset=windows-1255' /> <meta http-equiv='Content-Script-Type' content='text/javascript' /> <meta http-equiv='revisit-after' content='15 days' /> <title>÷ìò2</title> <link rel='stylesheet' type='text/css' href='../../../_script/klli.css' /> <link rel='stylesheet' type='text/css' href='../../../tnk1/_themes/klli.css' /> <meta name='author' content="" /> <meta name='receiver' content="" /> <meta name='jmQovc' content="tnk1/ljon/jorj/qle2" /> <meta name='tvnit' content="tnk_jorj" /> <meta name='description' lang='he' content="÷ìò2" /> <meta name='description' lang='en' content="this page is in Hebrew" /> <meta name='keywords' lang='he' content="÷ìò2 áúð&quot;ê,÷ìò2" /> </head> <!-- PHP Programming by Erel Segal - Rent a Brain http://tora.us.fm/rentabrain --> <body lang='he' dir='rtl' id = 'tnk1_ljon_jorj_qle2' class='jzmj tnk_jorj'> <div class='pnim'> <script type='text/javascript' src='../../../_script/vars.js'></script> <!--NiwutElyon0--> <div class='NiwutElyon'> <div class='NiwutElyon'><a class='link_to_homepage' href='../../../tnk1/index.html'>øàùé</a>&gt;<a href='../../../tnk1/ljon/index.html'>ìùåï äî÷øà</a>&gt;<a href='../../../tnk1/ljon/jorj/index.html'>ùåøùéí</a>&gt;<a href='../../../tnk1/ljon/jorj/qle.html'>÷ìò</a>&gt;</div> </div> <!--NiwutElyon1--> <h1 id='h1'>÷ìò2</h1> <div id='idfields'> <p>÷åã: ÷ìò2 áúð"ê</p> <p>ñåâ: ùæîù</p> <p>îàú: </p> <p>àì: </p> </div> <script type='text/javascript'>kotrt()</script> <ul id='ulbnim'> <li>äâãøä_ëììéú: <span class='hgdrh_kllyt dor1'>= òðéðå öéåø öéåøéí îôåúçéí.<small> [ùáé"ì]</small></span>&nbsp;&nbsp;</li> <li>úåàø: <span class='twar dor1'>î÷ìòú (ùí îúåàø)</span>&nbsp;&nbsp;&nbsp; <div class='dor2'> <span class='hgdrh'>= öéåøéí îôåúçéí.</span>&nbsp;&nbsp; <a href='../../../tnk1/messages/prqim_t09a_0.html' class='hgdrh' title='îéìéí ùéù ø÷ áñôø îìëéí à'><small>[áàä ø÷ áñôø îìëéí à]</small></a> </div><!--dor2--> </li> <li>ôåòì: <span class='pwel dor1'>÷ìÇò2 (ôòì)</span>&nbsp;&nbsp;&nbsp; <div class='dor2'> <a href='../../../tnk1/messages/prqim_t09a_0.html' class='hgdrh' title='îéìéí ùéù ø÷ áñôø îìëéí à'><small>[áàä ø÷ áñôø îìëéí à]</small></a> </div><!--dor2--> </li> <li>öéìåí: <span class='cylwm dor1'><img src='' /></span>&nbsp;&nbsp;</li> </ul><!--end--> <script type='text/javascript'> AnalyzeBnim(); ktov_bnim_jorj(); </script> <h2 id='tguvot'>úåñôåú åúâåáåú</h2> <script type='text/javascript'>ktov_bnim_axrim("<"+"ul>","</"+"ul>")</script> <script type='text/javascript'>tguva(); txtit()</script> </div><!--pnim--> </body> </html>
erelsgl/erel-sites
tnk1/ljon/jorj/qle2.html
HTML
lgpl-3.0
2,791
// -*- mode: C++; c-file-style: "cc-mode" -*- //************************************************************************* // DESCRIPTION: Verilator: Add C++ casts across expression size changes // // Code available from: https://verilator.org // //************************************************************************* // // Copyright 2004-2022 by Wilson Snyder. This program is free software; you // can redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 // //************************************************************************* // V3Cast's Transformations: // // Each module: // For each math operator, if above operator requires 32 bits, // and this isn't, cast to 32 bits. // Likewise for 64 bit operators. // // C++ rules: // Integral promotions allow conversion to larger int. Unsigned is only // used if a int would not fit the value. // // Bools converts to int, not unsigned. // // Most operations return unsigned if either operand is unsigned. // // Unsignedness can be lost on results of the below operations, as they // may need the sign bit for proper operation: // /, %, /=, %=, <, <=, >, or >= // // Signed values are always sign extended on promotion or right shift, // even if assigning to a unsigned. // //************************************************************************* #include "config_build.h" #include "verilatedos.h" #include "V3Global.h" #include "V3Cast.h" #include "V3Ast.h" #include <algorithm> //###################################################################### // Cast state, as a visitor of each AstNode class CastVisitor final : public VNVisitor { private: // NODE STATE // Entire netlist: // AstNode::user() // bool. Indicates node is of known size const VNUser1InUse m_inuser1; // STATE // METHODS VL_DEBUG_FUNC; // Declare debug() void insertCast(AstNode* nodep, int needsize) { // We'll insert ABOVE passed node UINFO(4, " NeedCast " << nodep << endl); VNRelinker relinkHandle; nodep->unlinkFrBack(&relinkHandle); // AstCCast* const castp = new AstCCast{nodep->fileline(), nodep, needsize, nodep->widthMin()}; relinkHandle.relink(castp); // if (debug() > 8) castp->dumpTree(cout, "-castins: "); // ensureLower32Cast(castp); nodep->user1(1); // Now must be of known size } static int castSize(AstNode* nodep) { if (nodep->isQuad()) { return VL_QUADSIZE; } else if (nodep->width() <= 8) { return 8; } else if (nodep->width() <= 16) { return 16; } else { return VL_IDATASIZE; } } void ensureCast(AstNode* nodep) { if (castSize(nodep->backp()) != castSize(nodep) || !nodep->user1()) { insertCast(nodep, castSize(nodep->backp())); } } void ensureLower32Cast(AstCCast* nodep) { // If we have uint64 = CAST(uint64(x)) then the upcasting // really needs to be CAST(uint64(CAST(uint32(x))). // Otherwise a (uint64)(a>b) would return wrong value, as // less than has nondeterministic signedness. if (nodep->isQuad() && !nodep->lhsp()->isQuad() && !VN_IS(nodep->lhsp(), CCast)) { insertCast(nodep->lhsp(), VL_IDATASIZE); } } void ensureNullChecked(AstNode* nodep) { // TODO optimize to track null checked values and avoid where possible if (!VN_IS(nodep->backp(), NullCheck)) { VNRelinker relinkHandle; nodep->unlinkFrBack(&relinkHandle); AstNode* const newp = new AstNullCheck{nodep->fileline(), nodep}; relinkHandle.relink(newp); } } // VISITORS virtual void visit(AstNodeUniop* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1()); if (nodep->sizeMattersLhs()) ensureCast(nodep->lhsp()); } virtual void visit(AstNodeBiop* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1() | nodep->rhsp()->user1()); if (nodep->sizeMattersLhs()) ensureCast(nodep->lhsp()); if (nodep->sizeMattersRhs()) ensureCast(nodep->rhsp()); } virtual void visit(AstNodeTriop* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1() | nodep->rhsp()->user1() | nodep->thsp()->user1()); if (nodep->sizeMattersLhs()) ensureCast(nodep->lhsp()); if (nodep->sizeMattersRhs()) ensureCast(nodep->rhsp()); if (nodep->sizeMattersThs()) ensureCast(nodep->thsp()); } virtual void visit(AstNodeQuadop* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1() | nodep->rhsp()->user1() | nodep->thsp()->user1() | nodep->fhsp()->user1()); if (nodep->sizeMattersLhs()) ensureCast(nodep->lhsp()); if (nodep->sizeMattersRhs()) ensureCast(nodep->rhsp()); if (nodep->sizeMattersThs()) ensureCast(nodep->thsp()); if (nodep->sizeMattersFhs()) ensureCast(nodep->fhsp()); } virtual void visit(AstCCast* nodep) override { iterateChildren(nodep); ensureLower32Cast(nodep); nodep->user1(1); } virtual void visit(AstNegate* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1()); if (nodep->lhsp()->widthMin() == 1) { // We want to avoid a GCC "converting of negative value" warning // from our expansion of // out = {32{a<b}} => out = - (a<b) insertCast(nodep->lhsp(), castSize(nodep)); } else { ensureCast(nodep->lhsp()); } } virtual void visit(AstVarRef* nodep) override { const AstNode* const backp = nodep->backp(); if (nodep->access().isReadOnly() && !VN_IS(backp, CCast) && VN_IS(backp, NodeMath) && !VN_IS(backp, ArraySel) && !VN_IS(backp, RedXor) && backp->width() && castSize(nodep) != castSize(nodep->varp())) { // Cast vars to IData first, else below has upper bits wrongly set // CData x=3; out = (QData)(x<<30); insertCast(nodep, castSize(nodep)); } nodep->user1(1); } virtual void visit(AstConst* nodep) override { // Constants are of unknown size if smaller than 33 bits, because // we're too lazy to wrap every constant in the universe in // ((IData)#). nodep->user1(nodep->isQuad() || nodep->isWide()); } // Null dereference protection virtual void visit(AstNullCheck* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1()); } virtual void visit(AstCMethodCall* nodep) override { iterateChildren(nodep); ensureNullChecked(nodep->fromp()); } virtual void visit(AstMemberSel* nodep) override { iterateChildren(nodep); ensureNullChecked(nodep->fromp()); } // NOPs virtual void visit(AstVar*) override {} //-------------------- virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit CastVisitor(AstNetlist* nodep) { iterate(nodep); } virtual ~CastVisitor() override = default; }; //###################################################################### // Cast class functions void V3Cast::castAll(AstNetlist* nodep) { UINFO(2, __FUNCTION__ << ": " << endl); { CastVisitor{nodep}; } // Destruct before checking V3Global::dumpCheckGlobalTree("cast", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); }
verilator/verilator
src/V3Cast.cpp
C++
lgpl-3.0
7,877
#region LGPL License /*---------------------------------------------------------------------------- * This file (Tests\CK.Javascript.Tests\WithGlobalContext.cs) is part of CiviKey. * * CiviKey is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * CiviKey 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 CiviKey. If not, see <http://www.gnu.org/licenses/>. * * Copyright © 2007-2014, * Invenietis <http://www.invenietis.com>, * In’Tech INFO <http://www.intechinfo.fr>, * All rights reserved. *-----------------------------------------------------------------------------*/ #endregion using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NUnit.Framework; namespace CK.Javascript.Tests { public class WithGlobalContext { class Context : GlobalContext { public double [] Array = new double[0]; public override void Visit( IEvalVisitor v, IAccessorFrame frame ) { IAccessorFrame frameArray = frame.MatchMember( "Array" ); if( frameArray != null ) { AccessorIndexerExpr indexer = frameArray.Expr as AccessorIndexerExpr; if( indexer != null ) { v.VisitExpr( indexer.Index ); if( !v.HasError() ) { if( v.Current.Type != "number" ) { frameArray.SetRuntimeError( "Number expected." ); } else { int i = JSSupport.ToInt32( v.Current.ToDouble() ); if( i < 0 || i >= Array.Length ) frameArray.SetRuntimeError( "Index out of range." ); else frameArray.SetResult( CreateNumber( Array[i] ) ); } } } } base.Visit( v, frame ); } } [Test] public void AccessToIntrinsicArray() { RuntimeObj o = EvalVisitor.Evaluate( "Array[0]" ); Assert.That( o is RuntimeError ); var ctx = new Context(); o = EvalVisitor.Evaluate( "Array[0]", ctx ); Assert.That( ((RuntimeError)o).Message, Is.EqualTo( "Index out of range." ) ); ctx.Array = new[] { 1.2 }; o = EvalVisitor.Evaluate( "Array[-1]", ctx ); Assert.That( ((RuntimeError)o).Message, Is.EqualTo( "Index out of range." ) ); o = EvalVisitor.Evaluate( "Array[2]", ctx ); Assert.That( ((RuntimeError)o).Message, Is.EqualTo( "Index out of range." ) ); o = EvalVisitor.Evaluate( "Array[0]", ctx ); Assert.That( o is JSEvalNumber ); Assert.That( o.ToDouble(), Is.EqualTo( 1.2 ) ); ctx.Array = new[] { 3.4, 5.6 }; o = EvalVisitor.Evaluate( "Array[0] + Array[1] ", ctx ); Assert.That( o is JSEvalNumber ); Assert.That( o.ToDouble(), Is.EqualTo( 3.4 + 5.6 ) ); } } }
Invenietis/ck-javascript
Tests/CK.Javascript.Tests/WithGlobalContext.cs
C#
lgpl-3.0
3,718
package cz.cvut.felk.cig.jcool.benchmark.method.cmaes; import org.apache.commons.math.linear.MatrixUtils; import org.ytoh.configurations.annotations.Component; /** * @author sulcanto */ @Component(name = "History IPOP-CMA-ES: Increasing Population Covariance Matrix Adaptation Evolution Strategy") public class SigmaMeanIPOPCMAESMethod extends IPOPCMAESMethod{ @Override public void restart(){ super.restart(); double bestWorstDist = MatrixUtils.createRealVector(this.theBestPoint.getPoint().toArray()).getDistance(this.theWorstPoint.getPoint().toArray()); super.xmean = MatrixUtils.createRealVector(super.theBestPoint.getPoint().toArray()).subtract(super.theWorstPoint.getPoint().toArray()).mapDivide(2); this.sigma = bestWorstDist/2; } }
dhonza/JCOOL
jcool/benchmark/src/main/java/cz/cvut/felk/cig/jcool/benchmark/method/cmaes/SigmaMeanIPOPCMAESMethod.java
Java
lgpl-3.0
805
package com.nullpointers.pathpointer; /** * An immutable class to represent a time. * A time is made of hours and minutes. * 24 hour system. */ class Time { private final int hour; private final int minute; /** Returns a time corresponding to midnight */ private Time() { hour = 0; minute = 0; } /** * Constructor for a time object. * @param hour the hour represented * @param minute the minute represented * @throws IllegalArgumentException if hour is not between 0 and 23 * or minute is not between 0 and 60. */ public Time(int hour, int minute) { if (0 > hour || 23 < hour || 0 > minute || 59 < minute) { String timeString = String.format("%1$02d:%2$02d",hour,minute); throw new IllegalArgumentException("Illegal time " + timeString); } this.hour = hour; this.minute = minute; } /** Returns the hour */ public int getHour() {return hour;} /** Returns the minute */ public int getMinute() {return minute;} /** * Returns true if this time is the same or later than t, false otherwise * @param t the time to compare this time to */ public boolean isLaterThan(Time t) { if(hour == t.getHour()) { return minute >= t.getMinute(); } return hour >= t.getHour(); } /** * Returns true if this time is earlier than t, false otherwise * @param t the time to compare this time to */ public boolean isEarlierThan(Time t) { if(hour == t.getHour()) { return minute < t.getMinute(); } return hour < t.getHour(); } @Override public String toString() { return String.format("%1$02d:%2$02d",getHour(),getMinute()); } @Override public boolean equals(Object other) { if (! (other instanceof Time)) return false; else { Time o = (Time) other; return hour == o.getHour() && minute == o.getMinute(); } } @Override public int hashCode() { Integer h = Integer.valueOf(hour).hashCode(); Integer m = Integer.valueOf(minute).hashCode(); return 24*h + m; } }
jfucci/PathPointerRPI
app/src/main/java/com/nullpointers/pathpointer/Time.java
Java
lgpl-3.0
2,238
 """ ----------------------------------------------------------------------------- This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net Copyright (c) 2010 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OSTIS 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 OSTIS. If not, see <http://www.gnu.org/licenses/>. ----------------------------------------------------------------------------- """ ''' Created on Oct 2, 2009 @author: Denis Koronchik ''' import pm import time import thread import threading import sys, traceback class Processor(threading.Thread): def __init__(self, params = {}): """Constuructor @param params: dictionary with parameters to start processor module Available parameters: repo_path - path to repository folder @type params: dict """ threading.Thread.__init__(self) self.stoped = False self.finished = False self.started = False self.__repo_path = '.' if params.has_key('repo_path'): self.__repo_path = params['repo_path'] self.start() def run(self): try: pm.do_init(False, True, self.__repo_path, False) pm.do_dedicated(False) except: print "Error:", sys.exc_info()[0] traceback.print_exc(file=sys.stdout) return self.started = True while not self.stoped: pm.do_step() time.sleep(0.01) pm.libsc_deinit() self.finished = True def stop(self): self.stoped = True class Callback(pm.sc_event_multi): def __init__(self): pm.sc_event_multi.__init__(self) self.__disown__() def activate(self, wait_type, params, len): print str(params) class TestOp(pm.ScOperationActSetMember): def __init__(self, aset): pm.ScOperationActSetMember.__init__(self, "Test", aset) def activateImpl(self, arc, el): print "Hello" Processor({'repo_path': '../repo/fs_repo'}) #call = Callback() #time.sleep(5) #print "Open segment" #seg = pm.get_session().open_segment("/proc/keynode") #print seg # #print "Create element" #print pm.get_session() #node = pm.get_session().create_el(seg, pm.SC_N_CONST) #print node # #print "Attach event" ##call.attach_to(pm.get_session(), pm.SC_WAIT_HACK_SET_MEMBER, pm.ADDR_AS_PAR(node), 1) # #oper = TestOp(node) #oper.registerOperation() # #node1 = pm.get_session().create_el(seg, pm.SC_N_CONST) #line = pm.get_session().create_el(seg, pm.SC_A_CONST) # #pm.get_session().set_beg(line, node) #pm.get_session().set_end(line, node1) #line = pm.get_session().gen3_f_a_f(node, line, seg, pm.SC_A_CONST, node1)
laz2/sc-core
bindings/python/sc_core/pm_test.py
Python
lgpl-3.0
3,358
Directory structure =================== - The directory `src` contains the Visual Studio solution with the actual source code. - The directory `lib` contains pre-compiled 3rd party libraries which are not available via NuGet. - The directory `doc` contains scripts for generating source code and developer documentation. - The directory `modeling` contains UML and other diagrams. - The directory `installer` contains scripts for creating a Windows installer. - The directory `bundled` contains a portable GnuPG distribution (Windows only) and an external solver (all platforms). - The directory `build` contains the results of various compilation processes. It is created on first usage. It can contain the following subdirectories: - Backend: Contains the libraries forming the Zero Install Backend. - Frontend: Contains the executables for the Zero Install Frontend plus all required libraries (including the Backend). - Tools: Contains the executables for Zero Install Tools such as the Feed Editor plus all required libraries (including the Backend). - Installer: Contains the generated installers. - Documentation: Contains the generated source code documentation. - The directory `feeds` contains local Zero Install feeds referencing the contents of the `build` directory. They can be registered with `0install add-feed` in order to replace the online versions of Zero Install and its tools with your local builds. `VERSION` and `VERSION_UPDATER` contain the version numbers used by build scripts. Keep in sync with the version numbers in `src/AssemblyInfo.Global.cs` and `src/Updater/AssemblyInfo.Updater.cs`! Windows ======= The external solver (required) is not included in the repository. To get it run `bundled/download-solver.ps1`. `build.cmd` will call build scripts in subdirectories to create a Zero Install for Windows installer in `build/Frontend/Installer`. Note: Please read `installer/readme.txt` aswell for information about required tools. `cleanup.cmd` will delete any temporary files created by the build process or Visual Studio. Linux ===== The external solver (required) is not included in the repository. To get it run `bundled/download-solver.sh`. `build.sh` will perform a partial debug compilation using Mono's xbuild. A installer package will not be built. `cleanup.sh` will delete any temporary files created by the xbuild build process. `test.sh` will run the unit tests using the NUnit console runner. Note: You must perform a Debug build first (using MonoDevelop or `src/build.sh`) before you can run the unit tests. Environment variables ===================== - `ZEROINSTALL_PORTABLE_BASE`: Set by the C# code to to inform the Python code of Portable mode. - `ZEROINSTALL_EXTERNAL_FETCHER`: Set by the C# code to make the Python code delegate downloading files back to the C# implementation. - `ZEROINSTALL_EXTERNAL_STORE`: Set by the C# code to make the Python code delegate extracting archives back to the C# implementation.
clawplach/0install-win
README.md
Markdown
lgpl-3.0
3,048
// This file is part of rgtk. // // rgtk is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // rgtk 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 rgtk. If not, see <http://www.gnu.org/licenses/>. use libc::c_double; use gtk::cast::GTK_SCALEBUTTON; use gtk::{self, ffi}; pub trait ScaleButtonTrait: gtk::WidgetTrait + gtk::ContainerTrait + gtk::ButtonTrait { fn set_adjustment(&mut self, adjustment: &gtk::Adjustment) -> () { unsafe { ffi::gtk_scale_button_set_adjustment(GTK_SCALEBUTTON(self.unwrap_widget()), adjustment.unwrap_pointer()); } } fn set_value(&mut self, value: f64) -> () { unsafe { ffi::gtk_scale_button_set_value(GTK_SCALEBUTTON(self.unwrap_widget()), value as c_double); } } fn get_value(&self) -> f64 { unsafe { ffi::gtk_scale_button_get_value(GTK_SCALEBUTTON(self.unwrap_widget())) as f64 } } fn get_adjustment(&self) -> gtk::Adjustment { unsafe { gtk::Adjustment::wrap_pointer(ffi::gtk_scale_button_get_adjustment(GTK_SCALEBUTTON(self.unwrap_widget()))) } } }
jeremyletang/rgtk
src/gtk/traits/scale_button.rs
Rust
lgpl-3.0
1,610
package co.codewizards.cloudstore.core.collection; import static co.codewizards.cloudstore.core.util.Util.*; import static java.util.Objects.*; import java.io.Serializable; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.lang.reflect.Array; import java.util.AbstractMap; import java.util.AbstractSet; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; import co.codewizards.cloudstore.core.ref.IdentityWeakReference; public class WeakIdentityHashMap<K, V> implements Map<K, V>, Serializable { private static final long serialVersionUID = 1L; private final ReferenceQueue<K> keyRefQueue = new ReferenceQueue<K>(); private final HashMap<Reference<K>, V> delegate; private transient Set<Map.Entry<K, V>> entrySet; public WeakIdentityHashMap() { delegate = new HashMap<>(); } public WeakIdentityHashMap(int initialCapacity) { delegate = new HashMap<>(initialCapacity); } public WeakIdentityHashMap(final Map<? extends K, ? extends V> map) { this(requireNonNull(map, "map").size()); putAll(map); } public WeakIdentityHashMap(int initialCapacity, float loadFactor) { delegate = new HashMap<>(initialCapacity, loadFactor); } @Override public V get(final Object key) { expunge(); @SuppressWarnings("unchecked") final WeakReference<K> keyRef = createReference((K) key); return delegate.get(keyRef); } @Override public V put(final K key, final V value) { expunge(); requireNonNull(key, "key"); final WeakReference<K> keyRef = createReference(key, keyRefQueue); return delegate.put(keyRef, value); } @Override public void putAll(final Map<? extends K, ? extends V> map) { expunge(); requireNonNull(map, "map"); for (final Map.Entry<? extends K, ? extends V> entry : map.entrySet()) { final K key = entry.getKey(); requireNonNull(key, "entry.key"); final WeakReference<K> keyRef = createReference(key, keyRefQueue); delegate.put(keyRef, entry.getValue()); } } @Override public V remove(final Object key) { expunge(); @SuppressWarnings("unchecked") final WeakReference<K> keyref = createReference((K) key); return delegate.remove(keyref); } @Override public void clear() { expunge(); delegate.clear(); } @Override public int size() { expunge(); return delegate.size(); } @Override public boolean isEmpty() { expunge(); return delegate.isEmpty(); } @Override public boolean containsKey(final Object key) { expunge(); @SuppressWarnings("unchecked") final WeakReference<K> keyRef = createReference((K) key); return delegate.containsKey(keyRef); } @Override public boolean containsValue(final Object value) { expunge(); return delegate.containsValue(value); } @Override public Set<K> keySet() { expunge(); throw new UnsupportedOperationException("NYI"); // TODO implement this! It should be backed! Read javadoc for the proper contract! } @Override public Collection<V> values() { expunge(); return delegate.values(); } @Override public Set<Map.Entry<K,V>> entrySet() { expunge(); Set<Map.Entry<K,V>> es = entrySet; if (es != null) return es; else return entrySet = new EntrySet(); } private class EntrySet extends AbstractSet<Map.Entry<K, V>> { @Override public Iterator<Map.Entry<K,V>> iterator() { return new EntryIterator(); } @Override public boolean contains(Object o) { if (! (o instanceof Map.Entry)) return false; @SuppressWarnings("unchecked") final Map.Entry<K, V> entry = (Map.Entry<K, V>)o; final K keyParam = entry.getKey(); if (! WeakIdentityHashMap.this.containsKey(keyParam)) return false; final V value = WeakIdentityHashMap.this.get(keyParam); return equal(value, entry.getValue()); } @Override public boolean remove(Object o) { if (!(o instanceof Map.Entry)) return false; @SuppressWarnings("unchecked") final Map.Entry<K, V> entry = (Map.Entry<K, V>)o; final K keyParam = entry.getKey(); if (! WeakIdentityHashMap.this.containsKey(keyParam)) return false; WeakIdentityHashMap.this.remove(keyParam); return true; } @Override public int size() { return WeakIdentityHashMap.this.size(); } @Override public void clear() { WeakIdentityHashMap.this.clear(); } /* * Must revert from AbstractSet's impl to AbstractCollection's, as * the former contains an optimization that results in incorrect * behavior when c is a smaller "normal" (non-identity-based) Set. */ @Override public boolean removeAll(Collection<?> c) { boolean modified = false; for (Iterator<Map.Entry<K,V>> i = iterator(); i.hasNext(); ) { if (c.contains(i.next())) { i.remove(); modified = true; } } return modified; } @Override public Object[] toArray() { int size = size(); Object[] result = new Object[size]; Iterator<Map.Entry<K,V>> it = iterator(); for (int i = 0; i < size; i++) result[i] = new AbstractMap.SimpleEntry<>(it.next()); return result; } @Override @SuppressWarnings("unchecked") public <T> T[] toArray(T[] a) { int size = size(); if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); Iterator<Map.Entry<K,V>> it = iterator(); for (int i = 0; i < size; i++) a[i] = (T) new AbstractMap.SimpleEntry<>(it.next()); if (a.length > size) a[size] = null; return a; } } private class EntryIterator implements Iterator<Map.Entry<K, V>> { private final Iterator<Map.Entry<Reference<K>, V>> delegateIterator = delegate.entrySet().iterator(); private Map.Entry<K, V> nextEntry; @Override public boolean hasNext() { if (nextEntry != null) return true; nextEntry = pullNext(); return nextEntry != null; } @Override public Map.Entry<K, V> next() throws NoSuchElementException { Map.Entry<K, V> result = nextEntry; nextEntry = null; if (result == null) { result = pullNext(); if (result == null) throw new NoSuchElementException(); } return result; } private Map.Entry<K, V> pullNext() { while (delegateIterator.hasNext()) { final Map.Entry<Reference<K>, V> delegateNext = delegateIterator.next(); final K key = delegateNext.getKey().get(); if (key != null) { final V value = delegateNext.getValue(); return new AbstractMap.SimpleEntry<K, V>(key, value) { private static final long serialVersionUID = 1L; @Override public V setValue(V value) { return delegateNext.setValue(value); } }; } } return null; } @Override public void remove() throws IllegalStateException { delegateIterator.remove(); } } private void expunge() { Reference<? extends K> keyRef; while ((keyRef = keyRefQueue.poll()) != null) delegate.remove(keyRef); } private WeakReference<K> createReference(K referent) { return new IdentityWeakReference<K>(referent); } private WeakReference<K> createReference(K referent, ReferenceQueue<K> q) { return new IdentityWeakReference<K>(referent, q); } }
cloudstore/cloudstore
co.codewizards.cloudstore.core/src/main/java/co/codewizards/cloudstore/core/collection/WeakIdentityHashMap.java
Java
lgpl-3.0
7,785
# Copyright 2019 Rafis Bikbov <https://it-projects.info/team/RafiZz> # Copyright 2019 Alexandr Kolushov <https://it-projects.info/team/KolushovAlexandr> # Copyright 2019 Eugene Molotov <https://it-projects.info/team/em230418> # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). import logging from odoo import api, conf from odoo.tests.common import HttpCase, tagged _logger = logging.getLogger(__name__) @tagged("post_install", "-at_install") class TestProductTmplImage(HttpCase): def _get_original_image_url(self, px=1024): return "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1e/Gullfoss%2C_an_iconic_waterfall_of_Iceland.jpg/{}px-Gullfoss%2C_an_iconic_waterfall_of_Iceland.jpg".format( px ) def _get_odoo_image_url(self, model, record_id, field): return "/web/image?model={}&id={}&field={}".format(model, record_id, field) def test_getting_product_variant_image_fields_urls(self): assert ( "ir_attachment_url" in conf.server_wide_modules ), "ir_attachment_url is not in server_wide_modules. Please add it via --load parameter" env = api.Environment(self.registry.test_cr, self.uid, {}) env["ir.config_parameter"].set_param("ir_attachment_url.storage", "url") product_tmpl = env["product.template"].create( { "name": "Test template", "image": self._get_original_image_url(1024), "image_medium": self._get_original_image_url(128), "image_small": self._get_original_image_url(64), } ) product_product = env["product.product"].create( { "name": "Test product", "image": False, "image_medium": False, "image_small": False, "product_tmpl_id": product_tmpl.id, } ) odoo_image_url = self._get_odoo_image_url( "product.product", product_product.id, "image" ) odoo_image_medium_url = self._get_odoo_image_url( "product.product", product_product.id, "image_medium" ) odoo_image_small_url = self._get_odoo_image_url( "product.product", product_product.id, "image_small" ) product_tmpl_image_attachment = env["ir.http"].find_field_attachment( env, "product.template", "image", product_tmpl ) product_tmpl_image_medium_attachment = env["ir.http"].find_field_attachment( env, "product.template", "image_medium", product_tmpl ) product_tmpl_image_small_attachment = env["ir.http"].find_field_attachment( env, "product.template", "image_small", product_tmpl ) self.assertTrue(product_tmpl_image_attachment) self.assertTrue(product_tmpl_image_medium_attachment) self.assertTrue(product_tmpl_image_small_attachment) self.authenticate("demo", "demo") self.assertEqual( self.url_open(odoo_image_url).url, product_tmpl_image_attachment.url ) self.assertEqual( self.url_open(odoo_image_medium_url).url, product_tmpl_image_medium_attachment.url, ) self.assertEqual( self.url_open(odoo_image_small_url).url, product_tmpl_image_small_attachment.url, )
yelizariev/addons-yelizariev
ir_attachment_url/tests/test_product_tmpl_image.py
Python
lgpl-3.0
3,397
# coding: utf-8 # <pycompressor - compress and merge static files (css,js) in html files> # Copyright (C) <2012> Marcel Nicolay <marcel.nicolay@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from optparse import OptionParser import sys class CLI(object): color = { "PINK": "", "BLUE": "", "CYAN": "", "GREEN": "", "YELLOW": "", "RED": "", "END": "", } @staticmethod def show_colors(): CLI.color = { "PINK": "\033[35m", "BLUE": "\033[34m", "CYAN": "\033[36m", "GREEN": "\033[32m", "YELLOW": "\033[33m", "RED": "\033[31m", "END": "\033[0m", } def __init__(self): self.__config_parser() def __config_parser(self): self.__parser = OptionParser(usage="usage: %prog [options] start") self.__parser.add_option("-c", "--config", dest="config_file", default="compressor.yaml", help="Use a specific config file. If not provided, will search for 'compressor.yaml' in the current directory.") self.__parser.add_option("-s", "--sync", dest="sync", action="store_true", default=False, help="Sync files with S3") self.__parser.add_option("-v", "--version", action="store_true", dest="compressor_version", default=False, help="Displays compressor version and exit.") self.__parser.add_option("--color", action="store_true", dest="show_colors", default=False, help="Output with beautiful colors.") self.__parser.add_option("--prefix", dest="prefix", default="min", help="Use prefix in output js and css.") def get_parser(self): return self.__parser def parse(self): return self.__parser.parse_args() def error_and_exit(self, msg): self.msg("[ERROR] %s\n" % msg, "RED") sys.exit(1) def info_and_exit(self, msg): self.msg("%s\n" % msg, "BLUE") sys.exit(0) def msg(self, msg, color="CYAN"): print "%s%s%s" % (self.color[color], msg, self.color["END"])
marcelnicolay/pycompressor
compressor/cli.py
Python
lgpl-3.0
2,967
// Copyright (C) 2012 Corrado Maurini // // This file is part of DOLFIN. // // DOLFIN is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // DOLFIN 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 DOLFIN. If not, see <http://www.gnu.org/licenses/>. #ifdef HAS_PETSC #include <petsclog.h> #include <petscversion.h> #include <dolfin/common/Timer.h> #include <dolfin/common/MPI.h> #include <dolfin/common/NoDeleter.h> #include <dolfin/log/log.h> #include "dolfin/la/GenericMatrix.h" #include "dolfin/la/GenericVector.h" #include "dolfin/la/PETScMatrix.h" #include "dolfin/la/PETScVector.h" #include "dolfin/la/PETScKrylovSolver.h" #include "dolfin/la/PETScPreconditioner.h" #include "TAOLinearBoundSolver.h" #include "petscksp.h" #include "petscvec.h" #include "petscmat.h" #include "petsctao.h" using namespace dolfin; //----------------------------------------------------------------------------- // Mapping from ksp_method string to PETSc const std::map<std::string, const KSPType> TAOLinearBoundSolver::_ksp_methods = { {"default", ""}, {"cg", KSPCG}, {"gmres", KSPGMRES}, {"minres", KSPMINRES}, {"tfqmr", KSPTFQMR}, {"richardson", KSPRICHARDSON}, #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 7 && PETSC_VERSION_RELEASE == 1 {"nash", KSPNASH}, {"stcg", KSPSTCG}, #endif {"bicgstab", KSPBCGS} }; //----------------------------------------------------------------------------- // Mapping from method string to description const std::map<std::string, std::string> TAOLinearBoundSolver::_methods_descr = { {"default" , "Default Tao method (tao_tron)"}, {"tron" , "Newton Trust Region method"}, {"bqpip", "Interior Point Newton Algorithm"}, {"gpcg" , "Gradient Projection Conjugate Gradient"}, {"blmvm", "Limited memory variable metric method"} }; //----------------------------------------------------------------------------- std::map<std::string, std::string> TAOLinearBoundSolver::methods() { return TAOLinearBoundSolver::_methods_descr; } //----------------------------------------------------------------------------- std::map<std::string, std::string> TAOLinearBoundSolver::krylov_solvers() { return PETScKrylovSolver::methods(); } //----------------------------------------------------------------------------- std::map<std::string, std::string> TAOLinearBoundSolver::preconditioners() { return PETScPreconditioner::preconditioners(); } //----------------------------------------------------------------------------- TAOLinearBoundSolver::TAOLinearBoundSolver(MPI_Comm comm) : _tao(nullptr), _preconditioner_set(false) { PetscErrorCode ierr; // Create TAO object ierr = TaoCreate(PETSC_COMM_WORLD, &_tao); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCreate"); } //----------------------------------------------------------------------------- TAOLinearBoundSolver::TAOLinearBoundSolver(const std::string method, const std::string ksp_type, const std::string pc_type) : _tao(NULL), _preconditioner(new PETScPreconditioner(pc_type)), _preconditioner_set(false) { // Set parameter values parameters = default_parameters(); PetscErrorCode ierr; // Create TAO object ierr = TaoCreate(PETSC_COMM_WORLD, &_tao); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCreate"); // Set tao solver set_solver(method); //Set the PETSC KSP used by TAO set_ksp(ksp_type); // Some preconditioners may lead to errors because not compatible with TAO. if ((pc_type != "default") or (ksp_type != "default") or (method != "default")) { log(WARNING, "Some preconditioners may be not be applicable to "\ "TAO solvers and generate errors."); } } //----------------------------------------------------------------------------- TAOLinearBoundSolver::~TAOLinearBoundSolver() { if (_tao) TaoDestroy(&_tao); } //----------------------------------------------------------------------------- void TAOLinearBoundSolver::set_operators(std::shared_ptr<const GenericMatrix> A, std::shared_ptr<const GenericVector> b) { std::shared_ptr<const PETScMatrix> _matA = as_type<const PETScMatrix>(A); std::shared_ptr<const PETScVector> _b = as_type<const PETScVector>(b); set_operators(_matA, _b); } //----------------------------------------------------------------------------- void TAOLinearBoundSolver::set_operators(std::shared_ptr<const PETScMatrix> A, std::shared_ptr<const PETScVector> b) { this->_matA = A; this->_b = b; } //----------------------------------------------------------------------------- std::size_t TAOLinearBoundSolver::solve(const GenericMatrix& A1, GenericVector& x, const GenericVector& b1, const GenericVector& xl, const GenericVector& xu) { return solve(as_type<const PETScMatrix>(A1), as_type<PETScVector>(x), as_type<const PETScVector>(b1), as_type<const PETScVector>(xl), as_type<const PETScVector>(xu)); } //----------------------------------------------------------------------------- std::size_t TAOLinearBoundSolver::solve(const PETScMatrix& A1, PETScVector& x, const PETScVector& b1, const PETScVector& xl, const PETScVector& xu) { PetscErrorCode ierr; // Check symmetry dolfin_assert(A1.size(0) == A1.size(1)); // Set operators (A and b) std::shared_ptr<const PETScMatrix> A(&A1, NoDeleter()); std::shared_ptr<const PETScVector> b(&b1, NoDeleter()); set_operators(A, b); dolfin_assert(A->mat()); //dolfin_assert(b->vec()); // Set initial vector dolfin_assert(_tao); ierr = TaoSetInitialVector(_tao, x.vec()); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetInitialVector"); // Set the bound on the variables ierr = TaoSetVariableBounds(_tao, xl.vec(), xu.vec()); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetVariableBounds"); // Set the user function, gradient, hessian evaluation routines and // data structures ierr = TaoSetObjectiveAndGradientRoutine(_tao, __TAOFormFunctionGradientQuadraticProblem, this); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetObjectiveAndGradientRoutine"); ierr = TaoSetHessianRoutine(_tao, A->mat(), A->mat(), __TAOFormHessianQuadraticProblem, this); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetHessianRoutine"); // Set parameters from local parameters, including ksp parameters read_parameters(); // Clear previous monitors ierr = TaoCancelMonitors(_tao); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCancelMonitors"); // Set the monitor if (parameters["monitor_convergence"].is_set()) { if (parameters["monitor_convergence"]) { ierr = TaoSetMonitor(_tao, __TAOMonitor, this, NULL); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetMonitor"); } } // Solve the bound constrained problem Timer timer("TAO solver"); const char* tao_type; ierr = TaoGetType(_tao, &tao_type); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetType"); log(PROGRESS, "Tao solver %s starting to solve %i x %i system", tao_type, A->size(0), A->size(1)); // Solve ierr = TaoSolve(_tao); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSolve"); // Update ghost values x.update_ghost_values(); // Print the report on convergences and methods used if (parameters["report"].is_set()) { if (parameters["report"]) { ierr = TaoView(_tao, PETSC_VIEWER_STDOUT_WORLD); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoView"); } } // Check for convergence TaoConvergedReason reason; ierr = TaoGetConvergedReason(_tao, &reason); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetConvergedReason"); // Get the number of iterations PetscInt num_iterations = 0; ierr = TaoGetMaximumIterations(_tao, &num_iterations); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetMaximumIterations"); // Report number of iterations if (reason >= 0) log(PROGRESS, "Tao solver converged\n"); else { if (parameters["error_on_nonconvergence"].is_set()) { bool error_on_nonconvergence = parameters["error_on_nonconvergence"]; if (error_on_nonconvergence) { ierr = TaoView(_tao, PETSC_VIEWER_STDOUT_WORLD); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoView"); dolfin_error("TAOLinearBoundSolver.cpp", "solve linear system using Tao solver", "Solution failed to converge in %i iterations (TAO reason %d)", num_iterations, reason); } else { log(WARNING, "Tao solver %s failed to converge. Try a different TAO method," \ " adjust some parameters", tao_type); } } } return num_iterations; } //----------------------------------------------------------------------------- void TAOLinearBoundSolver::set_solver(const std::string& method) { dolfin_assert(_tao); PetscErrorCode ierr; // Do nothing if default type is specified if (method == "default") ierr = TaoSetType(_tao, "tron"); else { // Choose solver if (method == "tron") ierr = TaoSetType(_tao, "tron"); else if (method == "blmvm") ierr = TaoSetType(_tao, "blmvm" ); else if (method == "gpcg") ierr = TaoSetType(_tao, "gpcg" ); else if (method == "bqpip") ierr = TaoSetType(_tao, "bqpip"); else { dolfin_error("TAOLinearBoundSolver.cpp", "set solver for TAO solver", "Unknown solver type (\"%s\")", method.c_str()); ierr = 0; // Make compiler happy about uninitialized variable } } if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetType"); } //----------------------------------------------------------------------------- void TAOLinearBoundSolver::set_ksp(std::string ksp_type) { PetscErrorCode ierr; // Set ksp type if (ksp_type != "default") { dolfin_assert(_tao); KSP ksp; ierr = TaoGetKSP(_tao, &ksp); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetKSP"); if (ksp) { dolfin_assert(_ksp_methods.find(ksp_type) != _ksp_methods.end()); ierr = KSPSetType(ksp, _ksp_methods.find(ksp_type)->second); if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetType"); } else { log(WARNING, "The selected tao solver does not allow one to set a specific "\ "Krylov solver. Option %s is ignored", ksp_type.c_str()); } } } //----------------------------------------------------------------------------- Tao TAOLinearBoundSolver::tao() const { return _tao; } //----------------------------------------------------------------------------- std::shared_ptr<const PETScMatrix> TAOLinearBoundSolver::get_matrix() const { return _matA; } //----------------------------------------------------------------------------- std::shared_ptr<const PETScVector> TAOLinearBoundSolver::get_vector() const { return _b; } //----------------------------------------------------------------------------- void TAOLinearBoundSolver::read_parameters() { dolfin_assert(_tao); PetscErrorCode ierr; // Set tolerances ierr = TaoSetTolerances(_tao, parameters["gradient_absolute_tol"], parameters["gradient_relative_tol"], parameters["gradient_t_tol"]); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetTolerances"); // Set TAO solver maximum iterations if (parameters["maximum_iterations"].is_set()) { int maxits = parameters["maximum_iterations"]; ierr = TaoSetMaximumIterations(_tao, maxits); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetMaximumIterations"); } // Set ksp_options set_ksp_options(); } //----------------------------------------------------------------------------- void TAOLinearBoundSolver::init(const std::string& method) { PetscErrorCode ierr; // Check that nobody else shares this solver if (_tao) { ierr = TaoDestroy(&_tao); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoDestroy"); } // Set up solver environment ierr = TaoCreate(PETSC_COMM_WORLD, &_tao); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCreate"); // Set tao solver set_solver(method); } //----------------------------------------------------------------------------- void TAOLinearBoundSolver::set_ksp_options() { dolfin_assert(_tao); PetscErrorCode ierr; KSP ksp; ierr = TaoGetKSP(_tao, &ksp); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetKSP"); if (ksp) { Parameters krylov_parameters = parameters("krylov_solver"); // Non-zero initial guess bool nonzero_guess = false; if (krylov_parameters["nonzero_initial_guess"].is_set()) nonzero_guess = krylov_parameters["nonzero_initial_guess"]; if (nonzero_guess) ierr = KSPSetInitialGuessNonzero(ksp, PETSC_TRUE); else ierr = KSPSetInitialGuessNonzero(ksp, PETSC_FALSE); if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetInitialGuessNonzero"); if (krylov_parameters["monitor_convergence"].is_set()) { if (krylov_parameters["monitor_convergence"]) { PetscViewer viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)ksp)); PetscViewerFormat format = PETSC_VIEWER_DEFAULT; PetscViewerAndFormat *vf; ierr = PetscViewerAndFormatCreate(viewer,format,&vf); ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm, vf,(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy); if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet"); } } // Set tolerances const double rtol = krylov_parameters["relative_tolerance"].is_set() ? (double)krylov_parameters["relative_tolerance"] : PETSC_DEFAULT; const double atol = krylov_parameters["absolute_tolerance"].is_set() ? (double)krylov_parameters["absolute_tolerance"] : PETSC_DEFAULT; const double dtol = krylov_parameters["divergence_limit"].is_set() ? (double)krylov_parameters["divergence_limit"] : PETSC_DEFAULT; const int max_ksp_it = krylov_parameters["maximum_iterations"].is_set() ? (int)krylov_parameters["maximum_iterations"] : PETSC_DEFAULT; ierr = KSPSetTolerances(ksp, rtol, atol, dtol, max_ksp_it); if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetTolerances"); // Set preconditioner if (_preconditioner && !_preconditioner_set) { PETScKrylovSolver dolfin_ksp(ksp); _preconditioner->set(dolfin_ksp); _preconditioner_set = true; } } } //----------------------------------------------------------------------------- PetscErrorCode TAOLinearBoundSolver::__TAOFormFunctionGradientQuadraticProblem(Tao tao, Vec X, PetscReal *ener, Vec G, void *ptr) { PetscErrorCode ierr; PetscReal AXX, bX; dolfin_assert(ptr); const TAOLinearBoundSolver* solver = static_cast<TAOLinearBoundSolver*>(ptr); const PETScMatrix* A = solver->get_matrix().get(); const PETScVector* b = solver->get_vector().get(); dolfin_assert(A); dolfin_assert(b); // Calculate AX=A*X and store in G ierr = MatMult(A->mat(), X, G); if (ierr != 0) petsc_error(ierr, __FILE__, "MatMult"); // Calculate AXX=A*X*X ierr = VecDot(G, X, &AXX); if (ierr != 0) petsc_error(ierr, __FILE__, "VecDot"); // Calculate bX=b*X ierr = VecDot(b->vec(), X, &bX); if (ierr != 0) petsc_error(ierr, __FILE__, "VecDot"); // Calculate the functional value ener=1/2*A*X*X-b*X dolfin_assert(ener); *ener = 0.5*AXX-bX; // Calculate the gradient vector G=A*X-b ierr = VecAXPBY(G, -1.0, 1.0, b->vec()); if (ierr != 0) petsc_error(ierr, __FILE__, "VecAXPBY"); return 0; } //----------------------------------------------------------------------------- PetscErrorCode TAOLinearBoundSolver::__TAOFormHessianQuadraticProblem(Tao tao, Vec X, Mat H, Mat Hpre, void *ptr) { dolfin_assert(ptr); const TAOLinearBoundSolver* solver = static_cast<TAOLinearBoundSolver*>(ptr); const PETScMatrix* A = solver->get_matrix().get(); dolfin_assert(A); // Set the hessian to the matrix A (quadratic problem) Mat Atmp = A->mat(); H = Atmp; return 0; } //------------------------------------------------------------------------------ PetscErrorCode TAOLinearBoundSolver::__TAOMonitor(Tao tao, void *ctx) { dolfin_assert(tao); PetscErrorCode ierr; PetscInt its; PetscReal f, gnorm, cnorm, xdiff; TaoConvergedReason reason; ierr = TaoGetSolutionStatus(tao, &its, &f, &gnorm, &cnorm, &xdiff, &reason); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetSolutionStatus"); if (!(its % 5)) { ierr = PetscPrintf(PETSC_COMM_WORLD,"iteration=%D\tf=%g\n", its, (double)f); if (ierr != 0) petsc_error(ierr, __FILE__, "PetscPrintf"); } return 0; } //------------------------------------------------------------------------------ #endif
FEniCS/dolfin
dolfin/nls/TAOLinearBoundSolver.cpp
C++
lgpl-3.0
18,237
<?php /** * [ADMIN] ブログカテゴリ 一覧 * * baserCMS : Based Website Development Project <http://basercms.net> * Copyright 2008 - 2015, baserCMS Users Community <http://sites.google.com/site/baserusers/> * * @copyright Copyright 2008 - 2015, baserCMS Users Community * @link http://basercms.net baserCMS Project * @package Blog.View * @since baserCMS v 0.1.0 * @license http://basercms.net/license/index.html */ $allowOwners = array(); if (isset($user['user_group_id'])) { $allowOwners = array('', $user['user_group_id']); } $this->BcBaser->js(array( 'admin/jquery.baser_ajax_data_list', 'admin/jquery.baser_ajax_batch', 'admin/baser_ajax_data_list_config', 'admin/baser_ajax_batch_config' )); ?> <script type="text/javascript"> $(function(){ /** * 削除 */ $.baserAjaxDataList.config.methods.del = { button: '.btn-delete', confirm: 'このデータを本当に削除してもいいですか?\nこのカテゴリに関連する記事は、どのカテゴリにも関連しない状態として残ります。', result: function(row, result) { var config = $.baserAjaxDataList.config; if(result) { var rowClass = row.attr('class'); var currentRowClassies = rowClass.split(' '); currentRowClassies = currentRowClassies.reverse(); var currentRowGroupClass; $(currentRowClassies).each(function(){ if(this.match(/row-group/)) { currentRowGroupClass = this; return false; } }); $('.'+currentRowGroupClass).fadeOut(300, function(){ $('.'+currentRowGroupClass).remove(); if($(config.dataList+" tbody td").length) { $.baserAjaxDataList.initList(); $(config.dataList+" tbody tr").removeClass('even odd'); $.yuga.stripe(); } else { var ajax = 'ajax=1'; if( document.location.href.indexOf('?') == -1 ) { ajax = '?' + ajax; } else { ajax = '&' + ajax; } $.baserAjaxDataList.load(document.location.href + ajax); } }); } else { $(config.alertBox).html('削除に失敗しました。'); $(config.alertBox).fadeIn(500); } } }; $.baserAjaxDataList.init(); $.baserAjaxBatch.init({ url: $("#AjaxBatchUrl").html()}); }); </script> <div id="AjaxBatchUrl" style="display:none"><?php $this->BcBaser->url(array('controller' => 'blog_categories', 'action' => 'ajax_batch', $this->request->pass[0])) ?></div> <div id="AlertMessage" class="message" style="display:none"></div> <div id="MessageBox" style="display:none"><div id="flashMessage" class="notice-message"></div></div> <div id="DataList"><?php $this->BcBaser->element('blog_categories/index_list') ?></div>
kiyosue/ECbaser
html/basercms/lib/Baser/Plugin/Blog/View/BlogCategories/admin/index.php
PHP
lgpl-3.0
2,690
/* Copyright 2006 Jerry Huxtable 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.meteoinfo.image.filter; /** * Applies a bit mask to each ARGB pixel of an image. You can use this for, say, masking out the red channel. */ public class MaskFilter extends PointFilter { private int mask; public MaskFilter() { this(0xff00ffff); } public MaskFilter(int mask) { canFilterIndexColorModel = true; setMask(mask); } public void setMask(int mask) { this.mask = mask; } public int getMask() { return mask; } public int filterRGB(int x, int y, int rgb) { return rgb & mask; } public String toString() { return "Mask"; } }
meteoinfo/meteoinfolib
src/org/meteoinfo/image/filter/MaskFilter.java
Java
lgpl-3.0
1,140
<?php namespace Dealer\Model\Base; use \Exception; use \PDO; use Dealer\Model\DealerContent as ChildDealerContent; use Dealer\Model\DealerContentQuery as ChildDealerContentQuery; use Dealer\Model\Map\DealerContentTableMap; use Propel\Runtime\Propel; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; use Thelia\Model\Content; /** * Base class that represents a query for the 'dealer_content' table. * * * * @method ChildDealerContentQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildDealerContentQuery orderByDealerId($order = Criteria::ASC) Order by the dealer_id column * @method ChildDealerContentQuery orderByContentId($order = Criteria::ASC) Order by the content_id column * @method ChildDealerContentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildDealerContentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildDealerContentQuery orderByVersion($order = Criteria::ASC) Order by the version column * @method ChildDealerContentQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column * @method ChildDealerContentQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column * * @method ChildDealerContentQuery groupById() Group by the id column * @method ChildDealerContentQuery groupByDealerId() Group by the dealer_id column * @method ChildDealerContentQuery groupByContentId() Group by the content_id column * @method ChildDealerContentQuery groupByCreatedAt() Group by the created_at column * @method ChildDealerContentQuery groupByUpdatedAt() Group by the updated_at column * @method ChildDealerContentQuery groupByVersion() Group by the version column * @method ChildDealerContentQuery groupByVersionCreatedAt() Group by the version_created_at column * @method ChildDealerContentQuery groupByVersionCreatedBy() Group by the version_created_by column * * @method ChildDealerContentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildDealerContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildDealerContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query * * @method ChildDealerContentQuery leftJoinDealer($relationAlias = null) Adds a LEFT JOIN clause to the query using the Dealer relation * @method ChildDealerContentQuery rightJoinDealer($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Dealer relation * @method ChildDealerContentQuery innerJoinDealer($relationAlias = null) Adds a INNER JOIN clause to the query using the Dealer relation * * @method ChildDealerContentQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation * @method ChildDealerContentQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation * @method ChildDealerContentQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation * * @method ChildDealerContentQuery leftJoinDealerContentVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the DealerContentVersion relation * @method ChildDealerContentQuery rightJoinDealerContentVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the DealerContentVersion relation * @method ChildDealerContentQuery innerJoinDealerContentVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the DealerContentVersion relation * * @method ChildDealerContent findOne(ConnectionInterface $con = null) Return the first ChildDealerContent matching the query * @method ChildDealerContent findOneOrCreate(ConnectionInterface $con = null) Return the first ChildDealerContent matching the query, or a new ChildDealerContent object populated from the query conditions when no match is found * * @method ChildDealerContent findOneById(int $id) Return the first ChildDealerContent filtered by the id column * @method ChildDealerContent findOneByDealerId(int $dealer_id) Return the first ChildDealerContent filtered by the dealer_id column * @method ChildDealerContent findOneByContentId(int $content_id) Return the first ChildDealerContent filtered by the content_id column * @method ChildDealerContent findOneByCreatedAt(string $created_at) Return the first ChildDealerContent filtered by the created_at column * @method ChildDealerContent findOneByUpdatedAt(string $updated_at) Return the first ChildDealerContent filtered by the updated_at column * @method ChildDealerContent findOneByVersion(int $version) Return the first ChildDealerContent filtered by the version column * @method ChildDealerContent findOneByVersionCreatedAt(string $version_created_at) Return the first ChildDealerContent filtered by the version_created_at column * @method ChildDealerContent findOneByVersionCreatedBy(string $version_created_by) Return the first ChildDealerContent filtered by the version_created_by column * * @method array findById(int $id) Return ChildDealerContent objects filtered by the id column * @method array findByDealerId(int $dealer_id) Return ChildDealerContent objects filtered by the dealer_id column * @method array findByContentId(int $content_id) Return ChildDealerContent objects filtered by the content_id column * @method array findByCreatedAt(string $created_at) Return ChildDealerContent objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildDealerContent objects filtered by the updated_at column * @method array findByVersion(int $version) Return ChildDealerContent objects filtered by the version column * @method array findByVersionCreatedAt(string $version_created_at) Return ChildDealerContent objects filtered by the version_created_at column * @method array findByVersionCreatedBy(string $version_created_by) Return ChildDealerContent objects filtered by the version_created_by column * */ abstract class DealerContentQuery extends ModelCriteria { // versionable behavior /** * Whether the versioning is enabled */ static $isVersioningEnabled = true; /** * Initializes internal state of \Dealer\Model\Base\DealerContentQuery object. * * @param string $dbName The database name * @param string $modelName The phpName of a model, e.g. 'Book' * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ public function __construct($dbName = 'thelia', $modelName = '\\Dealer\\Model\\DealerContent', $modelAlias = null) { parent::__construct($dbName, $modelName, $modelAlias); } /** * Returns a new ChildDealerContentQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildDealerContentQuery */ public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof \Dealer\Model\DealerContentQuery) { return $criteria; } $query = new \Dealer\Model\DealerContentQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; } /** * Find object by primary key. * Propel uses the instance pool to skip the database if the object exists. * Go fast if the query is untouched. * * <code> * $obj = $c->findPk(12, $con); * </code> * * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con an optional connection object * * @return ChildDealerContent|array|mixed the result, formatted by the current formatter */ public function findPk($key, $con = null) { if ($key === null) { return null; } if ((null !== ($obj = DealerContentTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { // the object is already in the instance pool return $obj; } if ($con === null) { $con = Propel::getServiceContainer()->getReadConnection(DealerContentTableMap::DATABASE_NAME); } $this->basePreSelect($con); if ($this->formatter || $this->modelAlias || $this->with || $this->select || $this->selectColumns || $this->asColumns || $this->selectModifiers || $this->map || $this->having || $this->joins) { return $this->findPkComplex($key, $con); } else { return $this->findPkSimple($key, $con); } } /** * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * * @return ChildDealerContent A model object, or null if the key is not found */ protected function findPkSimple($key, $con) { $sql = 'SELECT ID, DEALER_ID, CONTENT_ID, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM dealer_content WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->execute(); } catch (Exception $e) { Propel::log($e->getMessage(), Propel::LOG_ERR); throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); } $obj = null; if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { $obj = new ChildDealerContent(); $obj->hydrate($row); DealerContentTableMap::addInstanceToPool($obj, (string) $key); } $stmt->closeCursor(); return $obj; } /** * Find object by primary key. * * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * * @return ChildDealerContent|array|mixed the result, formatted by the current formatter */ protected function findPkComplex($key, $con) { // As the query uses a PK condition, no limit(1) is necessary. $criteria = $this->isKeepQuery() ? clone $this : $this; $dataFetcher = $criteria ->filterByPrimaryKey($key) ->doSelect($con); return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); } /** * Find objects by primary key * <code> * $objs = $c->findPks(array(12, 56, 832), $con); * </code> * @param array $keys Primary keys to use for the query * @param ConnectionInterface $con an optional connection object * * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter */ public function findPks($keys, $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); } $this->basePreSelect($con); $criteria = $this->isKeepQuery() ? clone $this : $this; $dataFetcher = $criteria ->filterByPrimaryKeys($keys) ->doSelect($con); return $criteria->getFormatter()->init($criteria)->format($dataFetcher); } /** * Filter the query by primary key * * @param mixed $key Primary key to use for the query * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByPrimaryKey($key) { return $this->addUsingAlias(DealerContentTableMap::ID, $key, Criteria::EQUAL); } /** * Filter the query by a list of primary keys * * @param array $keys The list of primary key to use for the query * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { return $this->addUsingAlias(DealerContentTableMap::ID, $keys, Criteria::IN); } /** * Filter the query on the id column * * Example usage: * <code> * $query->filterById(1234); // WHERE id = 1234 * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) * $query->filterById(array('min' => 12)); // WHERE id > 12 * </code> * * @param mixed $id The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterById($id = null, $comparison = null) { if (is_array($id)) { $useMinMax = false; if (isset($id['min'])) { $this->addUsingAlias(DealerContentTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($id['max'])) { $this->addUsingAlias(DealerContentTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(DealerContentTableMap::ID, $id, $comparison); } /** * Filter the query on the dealer_id column * * Example usage: * <code> * $query->filterByDealerId(1234); // WHERE dealer_id = 1234 * $query->filterByDealerId(array(12, 34)); // WHERE dealer_id IN (12, 34) * $query->filterByDealerId(array('min' => 12)); // WHERE dealer_id > 12 * </code> * * @see filterByDealer() * * @param mixed $dealerId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByDealerId($dealerId = null, $comparison = null) { if (is_array($dealerId)) { $useMinMax = false; if (isset($dealerId['min'])) { $this->addUsingAlias(DealerContentTableMap::DEALER_ID, $dealerId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($dealerId['max'])) { $this->addUsingAlias(DealerContentTableMap::DEALER_ID, $dealerId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(DealerContentTableMap::DEALER_ID, $dealerId, $comparison); } /** * Filter the query on the content_id column * * Example usage: * <code> * $query->filterByContentId(1234); // WHERE content_id = 1234 * $query->filterByContentId(array(12, 34)); // WHERE content_id IN (12, 34) * $query->filterByContentId(array('min' => 12)); // WHERE content_id > 12 * </code> * * @see filterByContent() * * @param mixed $contentId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByContentId($contentId = null, $comparison = null) { if (is_array($contentId)) { $useMinMax = false; if (isset($contentId['min'])) { $this->addUsingAlias(DealerContentTableMap::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($contentId['max'])) { $this->addUsingAlias(DealerContentTableMap::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(DealerContentTableMap::CONTENT_ID, $contentId, $comparison); } /** * Filter the query on the created_at column * * Example usage: * <code> * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' * </code> * * @param mixed $createdAt The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByCreatedAt($createdAt = null, $comparison = null) { if (is_array($createdAt)) { $useMinMax = false; if (isset($createdAt['min'])) { $this->addUsingAlias(DealerContentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($createdAt['max'])) { $this->addUsingAlias(DealerContentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(DealerContentTableMap::CREATED_AT, $createdAt, $comparison); } /** * Filter the query on the updated_at column * * Example usage: * <code> * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' * </code> * * @param mixed $updatedAt The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByUpdatedAt($updatedAt = null, $comparison = null) { if (is_array($updatedAt)) { $useMinMax = false; if (isset($updatedAt['min'])) { $this->addUsingAlias(DealerContentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($updatedAt['max'])) { $this->addUsingAlias(DealerContentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(DealerContentTableMap::UPDATED_AT, $updatedAt, $comparison); } /** * Filter the query on the version column * * Example usage: * <code> * $query->filterByVersion(1234); // WHERE version = 1234 * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34) * $query->filterByVersion(array('min' => 12)); // WHERE version > 12 * </code> * * @param mixed $version The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByVersion($version = null, $comparison = null) { if (is_array($version)) { $useMinMax = false; if (isset($version['min'])) { $this->addUsingAlias(DealerContentTableMap::VERSION, $version['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($version['max'])) { $this->addUsingAlias(DealerContentTableMap::VERSION, $version['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(DealerContentTableMap::VERSION, $version, $comparison); } /** * Filter the query on the version_created_at column * * Example usage: * <code> * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14' * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14' * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13' * </code> * * @param mixed $versionCreatedAt The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null) { if (is_array($versionCreatedAt)) { $useMinMax = false; if (isset($versionCreatedAt['min'])) { $this->addUsingAlias(DealerContentTableMap::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($versionCreatedAt['max'])) { $this->addUsingAlias(DealerContentTableMap::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(DealerContentTableMap::VERSION_CREATED_AT, $versionCreatedAt, $comparison); } /** * Filter the query on the version_created_by column * * Example usage: * <code> * $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue' * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%' * </code> * * @param string $versionCreatedBy The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null) { if (null === $comparison) { if (is_array($versionCreatedBy)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) { $versionCreatedBy = str_replace('*', '%', $versionCreatedBy); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(DealerContentTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison); } /** * Filter the query by a related \Dealer\Model\Dealer object * * @param \Dealer\Model\Dealer|ObjectCollection $dealer The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByDealer($dealer, $comparison = null) { if ($dealer instanceof \Dealer\Model\Dealer) { return $this ->addUsingAlias(DealerContentTableMap::DEALER_ID, $dealer->getId(), $comparison); } elseif ($dealer instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this ->addUsingAlias(DealerContentTableMap::DEALER_ID, $dealer->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByDealer() only accepts arguments of type \Dealer\Model\Dealer or Collection'); } } /** * Adds a JOIN clause to the query using the Dealer relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return ChildDealerContentQuery The current query, for fluid interface */ public function joinDealer($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Dealer'); // create a ModelJoin object for this join $join = new ModelJoin(); $join->setJoinType($joinType); $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); if ($previousJoin = $this->getPreviousJoin()) { $join->setPreviousJoin($previousJoin); } // add the ModelJoin to the current object if ($relationAlias) { $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { $this->addJoinObject($join, 'Dealer'); } return $this; } /** * Use the Dealer relation Dealer object * * @see useQuery() * * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \Dealer\Model\DealerQuery A secondary query class using the current class as primary query */ public function useDealerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinDealer($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'Dealer', '\Dealer\Model\DealerQuery'); } /** * Filter the query by a related \Thelia\Model\Content object * * @param \Thelia\Model\Content|ObjectCollection $content The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByContent($content, $comparison = null) { if ($content instanceof \Thelia\Model\Content) { return $this ->addUsingAlias(DealerContentTableMap::CONTENT_ID, $content->getId(), $comparison); } elseif ($content instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this ->addUsingAlias(DealerContentTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByContent() only accepts arguments of type \Thelia\Model\Content or Collection'); } } /** * Adds a JOIN clause to the query using the Content relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return ChildDealerContentQuery The current query, for fluid interface */ public function joinContent($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Content'); // create a ModelJoin object for this join $join = new ModelJoin(); $join->setJoinType($joinType); $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); if ($previousJoin = $this->getPreviousJoin()) { $join->setPreviousJoin($previousJoin); } // add the ModelJoin to the current object if ($relationAlias) { $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { $this->addJoinObject($join, 'Content'); } return $this; } /** * Use the Content relation Content object * * @see useQuery() * * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query */ public function useContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinContent($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery'); } /** * Filter the query by a related \Dealer\Model\DealerContentVersion object * * @param \Dealer\Model\DealerContentVersion|ObjectCollection $dealerContentVersion the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildDealerContentQuery The current query, for fluid interface */ public function filterByDealerContentVersion($dealerContentVersion, $comparison = null) { if ($dealerContentVersion instanceof \Dealer\Model\DealerContentVersion) { return $this ->addUsingAlias(DealerContentTableMap::ID, $dealerContentVersion->getId(), $comparison); } elseif ($dealerContentVersion instanceof ObjectCollection) { return $this ->useDealerContentVersionQuery() ->filterByPrimaryKeys($dealerContentVersion->getPrimaryKeys()) ->endUse(); } else { throw new PropelException('filterByDealerContentVersion() only accepts arguments of type \Dealer\Model\DealerContentVersion or Collection'); } } /** * Adds a JOIN clause to the query using the DealerContentVersion relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return ChildDealerContentQuery The current query, for fluid interface */ public function joinDealerContentVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('DealerContentVersion'); // create a ModelJoin object for this join $join = new ModelJoin(); $join->setJoinType($joinType); $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); if ($previousJoin = $this->getPreviousJoin()) { $join->setPreviousJoin($previousJoin); } // add the ModelJoin to the current object if ($relationAlias) { $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { $this->addJoinObject($join, 'DealerContentVersion'); } return $this; } /** * Use the DealerContentVersion relation DealerContentVersion object * * @see useQuery() * * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \Dealer\Model\DealerContentVersionQuery A secondary query class using the current class as primary query */ public function useDealerContentVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinDealerContentVersion($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'DealerContentVersion', '\Dealer\Model\DealerContentVersionQuery'); } /** * Exclude object from result * * @param ChildDealerContent $dealerContent Object to remove from the list of results * * @return ChildDealerContentQuery The current query, for fluid interface */ public function prune($dealerContent = null) { if ($dealerContent) { $this->addUsingAlias(DealerContentTableMap::ID, $dealerContent->getId(), Criteria::NOT_EQUAL); } return $this; } /** * Deletes all rows from the dealer_content table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ public function doDeleteAll(ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(DealerContentTableMap::DATABASE_NAME); } $affectedRows = 0; // initialize var to track total num of affected rows try { // use transaction because $criteria could contain info // for more than one table or we could emulating ON DELETE CASCADE, etc. $con->beginTransaction(); $affectedRows += parent::doDeleteAll($con); // Because this db requires some delete cascade/set null emulation, we have to // clear the cached instance *after* the emulation has happened (since // instances get re-added by the select statement contained therein). DealerContentTableMap::clearInstancePool(); DealerContentTableMap::clearRelatedInstancePool(); $con->commit(); } catch (PropelException $e) { $con->rollBack(); throw $e; } return $affectedRows; } /** * Performs a DELETE on the database, given a ChildDealerContent or Criteria object OR a primary key value. * * @param mixed $values Criteria or ChildDealerContent object or primary key or array of primary keys * which is used to create the DELETE statement * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public function delete(ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(DealerContentTableMap::DATABASE_NAME); } $criteria = $this; // Set the correct dbName $criteria->setDbName(DealerContentTableMap::DATABASE_NAME); $affectedRows = 0; // initialize var to track total num of affected rows try { // use transaction because $criteria could contain info // for more than one table or we could emulating ON DELETE CASCADE, etc. $con->beginTransaction(); DealerContentTableMap::removeInstanceFromPool($criteria); $affectedRows += ModelCriteria::delete($con); DealerContentTableMap::clearRelatedInstancePool(); $con->commit(); return $affectedRows; } catch (PropelException $e) { $con->rollBack(); throw $e; } } // timestampable behavior /** * Filter by the latest updated * * @param int $nbDays Maximum age of the latest update in days * * @return ChildDealerContentQuery The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { return $this->addUsingAlias(DealerContentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); } /** * Filter by the latest created * * @param int $nbDays Maximum age of in days * * @return ChildDealerContentQuery The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { return $this->addUsingAlias(DealerContentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); } /** * Order by update date desc * * @return ChildDealerContentQuery The current query, for fluid interface */ public function lastUpdatedFirst() { return $this->addDescendingOrderByColumn(DealerContentTableMap::UPDATED_AT); } /** * Order by update date asc * * @return ChildDealerContentQuery The current query, for fluid interface */ public function firstUpdatedFirst() { return $this->addAscendingOrderByColumn(DealerContentTableMap::UPDATED_AT); } /** * Order by create date desc * * @return ChildDealerContentQuery The current query, for fluid interface */ public function lastCreatedFirst() { return $this->addDescendingOrderByColumn(DealerContentTableMap::CREATED_AT); } /** * Order by create date asc * * @return ChildDealerContentQuery The current query, for fluid interface */ public function firstCreatedFirst() { return $this->addAscendingOrderByColumn(DealerContentTableMap::CREATED_AT); } // versionable behavior /** * Checks whether versioning is enabled * * @return boolean */ static public function isVersioningEnabled() { return self::$isVersioningEnabled; } /** * Enables versioning */ static public function enableVersioning() { self::$isVersioningEnabled = true; } /** * Disables versioning */ static public function disableVersioning() { self::$isVersioningEnabled = false; } } // DealerContentQuery
thelia-modules/Dealer
Model/Base/DealerContentQuery.php
PHP
lgpl-3.0
41,741
/* mdb.c Server-specific in-memory database support. */ /* * Copyright (c) 2011-2014 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Internet Systems Consortium, Inc. * 950 Charter Street * Redwood City, CA 94063 * <info@isc.org> * https://www.isc.org/ * */ #include "dhcpd.h" #include "omapip/hash.h" struct subnet *subnets; struct shared_network *shared_networks; host_hash_t *host_hw_addr_hash; host_hash_t *host_uid_hash; host_hash_t *host_name_hash; lease_id_hash_t *lease_uid_hash; lease_ip_hash_t *lease_ip_addr_hash; lease_id_hash_t *lease_hw_addr_hash; /* * We allow users to specify any option as a host identifier. * * Any host is uniquely identified by the combination of * option type & option data. * * We expect people will only use a few types of options as host * identifier. Because of this, we store a list with an entry for * each option type. Each of these has a hash table, which contains * hash of the option data. * * For v6 we also include a relay count - this specifies which * relay to check for the requested option. As each different * value of relays creates a new instance admins should use the * same value across each option for all host-identifers. * A value of 0 indicates that we aren't doing relay options * and should simply look in the current option list. */ typedef struct host_id_info { struct option *option; host_hash_t *values_hash; int relays; struct host_id_info *next; } host_id_info_t; static host_id_info_t *host_id_info = NULL; int numclasseswritten; omapi_object_type_t *dhcp_type_host; isc_result_t enter_class(cd, dynamicp, commit) struct class *cd; int dynamicp; int commit; { if (!collections -> classes) { /* A subclass with no parent is invalid. */ if (cd->name == NULL) return DHCP_R_INVALIDARG; class_reference (&collections -> classes, cd, MDL); } else if (cd->name != NULL) { /* regular class */ struct class *c = 0; if (find_class(&c, cd->name, MDL) != ISC_R_NOTFOUND) { class_dereference(&c, MDL); return ISC_R_EXISTS; } /* Find the tail. */ for (c = collections -> classes; c -> nic; c = c -> nic) /* nothing */ ; class_reference (&c -> nic, cd, MDL); } if (dynamicp && commit) { const char *name = cd->name; if (name == NULL) { name = cd->superclass->name; } write_named_billing_class ((const unsigned char *)name, 0, cd); if (!commit_leases ()) return ISC_R_IOERROR; } return ISC_R_SUCCESS; } /* Variable to check if we're starting the server. The server will init as * starting - but just to be safe start out as false to avoid triggering new * special-case code * XXX: There is actually a server_startup state...which is never entered... */ #define SS_NOSYNC 1 #define SS_QFOLLOW 2 static int server_starting = 0; static int find_uid_statement (struct executable_statement *esp, void *vp, int condp) { struct executable_statement **evp = vp; if (esp -> op == supersede_option_statement && esp -> data.option && (esp -> data.option -> option -> universe == &dhcp_universe) && (esp -> data.option -> option -> code == DHO_DHCP_CLIENT_IDENTIFIER)) { if (condp) { log_error ("dhcp client identifier may not be %s", "specified conditionally."); } else if (!(*evp)) { executable_statement_reference (evp, esp, MDL); return 1; } else { log_error ("only one dhcp client identifier may be %s", "specified"); } } return 0; } static host_id_info_t * find_host_id_info(unsigned int option_code, int relays) { host_id_info_t *p; for (p = host_id_info; p != NULL; p = p->next) { if ((p->option->code == option_code) && (p->relays == relays)) { break; } } return p; } /* Debugging code */ #if 0 isc_result_t print_host(const void *name, unsigned len, void *value) { struct host_decl *h; printf("--------------\n"); printf("name:'%s'\n", print_hex_1(len, name, 60)); printf("len:%d\n", len); h = (struct host_decl *)value; printf("host @%p is '%s'\n", h, h->name); return ISC_R_SUCCESS; } void hash_print_hosts(struct hash_table *h) { hash_foreach(h, print_host); printf("--------------\n"); } #endif /* 0 */ void change_host_uid(struct host_decl *host, const char *uid, int len) { /* XXX: should consolidate this type of code throughout */ if (host_uid_hash == NULL) { if (!host_new_hash(&host_uid_hash, HOST_HASH_SIZE, MDL)) { log_fatal("Can't allocate host/uid hash"); } } /* * Remove the old entry, if one exists. */ if (host->client_identifier.data != NULL) { host_hash_delete(host_uid_hash, host->client_identifier.data, host->client_identifier.len, MDL); data_string_forget(&host->client_identifier, MDL); } /* * Set our new value. */ memset(&host->client_identifier, 0, sizeof(host->client_identifier)); host->client_identifier.len = len; if (!buffer_allocate(&host->client_identifier.buffer, len, MDL)) { log_fatal("Can't allocate uid buffer"); } host->client_identifier.data = host->client_identifier.buffer->data; memcpy((char *)host->client_identifier.data, uid, len); /* * And add to hash. */ host_hash_add(host_uid_hash, host->client_identifier.data, host->client_identifier.len, host, MDL); } isc_result_t enter_host (hd, dynamicp, commit) struct host_decl *hd; int dynamicp; int commit; { struct host_decl *hp = (struct host_decl *)0; struct host_decl *np = (struct host_decl *)0; struct executable_statement *esp; host_id_info_t *h_id_info; if (!host_name_hash) { if (!host_new_hash(&host_name_hash, HOST_HASH_SIZE, MDL)) log_fatal ("Can't allocate host name hash"); host_hash_add (host_name_hash, (unsigned char *)hd -> name, strlen (hd -> name), hd, MDL); } else { host_hash_lookup (&hp, host_name_hash, (unsigned char *)hd -> name, strlen (hd -> name), MDL); /* If it's deleted, we can supersede it. */ if (hp && (hp -> flags & HOST_DECL_DELETED)) { host_hash_delete (host_name_hash, (unsigned char *)hd -> name, strlen (hd -> name), MDL); /* If the old entry wasn't dynamic, then we always have to keep the deletion. */ if (hp -> flags & HOST_DECL_STATIC) { hd -> flags |= HOST_DECL_STATIC; } host_dereference (&hp, MDL); } /* If we are updating an existing host declaration, we can just delete it and add it again. */ if (hp && hp == hd) { host_dereference (&hp, MDL); delete_host (hd, 0); if (!write_host (hd)) return ISC_R_IOERROR; hd -> flags &= ~HOST_DECL_DELETED; } /* If there isn't already a host decl matching this address, add it to the hash table. */ if (!hp) { host_hash_add (host_name_hash, (unsigned char *)hd -> name, strlen (hd -> name), hd, MDL); } else { /* XXX actually, we have to delete the old one XXX carefully and replace it. Not done yet. */ host_dereference (&hp, MDL); return ISC_R_EXISTS; } } if (hd -> n_ipaddr) host_dereference (&hd -> n_ipaddr, MDL); if (!hd -> type) hd -> type = dhcp_type_host; if (hd -> interface.hlen) { if (!host_hw_addr_hash) { if (!host_new_hash(&host_hw_addr_hash, HOST_HASH_SIZE, MDL)) log_fatal ("Can't allocate host/hw hash"); } else { /* If there isn't already a host decl matching this address, add it to the hash table. */ host_hash_lookup (&hp, host_hw_addr_hash, hd -> interface.hbuf, hd -> interface.hlen, MDL); } if (!hp) host_hash_add (host_hw_addr_hash, hd -> interface.hbuf, hd -> interface.hlen, hd, MDL); else { /* If there was already a host declaration for this hardware address, add this one to the end of the list. */ for (np = hp; np -> n_ipaddr; np = np -> n_ipaddr) ; host_reference (&np -> n_ipaddr, hd, MDL); host_dereference (&hp, MDL); } } /* See if there's a statement that sets the client identifier. This is a kludge - the client identifier really shouldn't be set with an executable statement. */ esp = NULL; if (executable_statement_foreach (hd->group->statements, find_uid_statement, &esp, 0)) { (void) evaluate_option_cache (&hd->client_identifier, NULL, NULL, NULL, NULL, NULL, &global_scope, esp->data.option, MDL); } /* If we got a client identifier, hash this entry by client identifier. */ if (hd -> client_identifier.len) { /* If there's no uid hash, make one; otherwise, see if there's already an entry in the hash for this host. */ if (!host_uid_hash) { if (!host_new_hash(&host_uid_hash, HOST_HASH_SIZE, MDL)) log_fatal ("Can't allocate host/uid hash"); host_hash_add (host_uid_hash, hd -> client_identifier.data, hd -> client_identifier.len, hd, MDL); } else { /* If there's already a host declaration for this client identifier, add this one to the end of the list. Otherwise, add it to the hash table. */ if (host_hash_lookup (&hp, host_uid_hash, hd -> client_identifier.data, hd -> client_identifier.len, MDL)) { /* Don't link it in twice... */ if (!np) { for (np = hp; np -> n_ipaddr; np = np -> n_ipaddr) { if (hd == np) break; } if (hd != np) host_reference (&np -> n_ipaddr, hd, MDL); } host_dereference (&hp, MDL); } else { host_hash_add (host_uid_hash, hd -> client_identifier.data, hd -> client_identifier.len, hd, MDL); } } } /* * If we use an option as our host identifier, record it here. */ if (hd->host_id_option != NULL) { /* * Look for the host identifier information for this option, * and create a new entry if there is none. */ h_id_info = find_host_id_info(hd->host_id_option->code, hd->relays); if (h_id_info == NULL) { h_id_info = dmalloc(sizeof(*h_id_info), MDL); if (h_id_info == NULL) { log_fatal("No memory for host-identifier " "option information."); } option_reference(&h_id_info->option, hd->host_id_option, MDL); if (!host_new_hash(&h_id_info->values_hash, HOST_HASH_SIZE, MDL)) { log_fatal("No memory for host-identifier " "option hash."); } h_id_info->relays = hd->relays; h_id_info->next = host_id_info; host_id_info = h_id_info; } if (host_hash_lookup(&hp, h_id_info->values_hash, hd->host_id.data, hd->host_id.len, MDL)) { /* * If this option is already present, then add * this host to the list in n_ipaddr, unless * we have already done so previously. * * XXXSK: This seems scary to me, but I don't * fully understand how these are used. * Shouldn't there be multiple lists, or * maybe we should just forbid duplicates? */ if (np == NULL) { np = hp; while (np->n_ipaddr != NULL) { np = np->n_ipaddr; } if (hd != np) { host_reference(&np->n_ipaddr, hd, MDL); } } host_dereference(&hp, MDL); } else { host_hash_add(h_id_info->values_hash, hd->host_id.data, hd->host_id.len, hd, MDL); } } if (dynamicp && commit) { if (!write_host (hd)) return ISC_R_IOERROR; if (!commit_leases ()) return ISC_R_IOERROR; } return ISC_R_SUCCESS; } isc_result_t delete_class (cp, commit) struct class *cp; int commit; { cp->flags |= CLASS_DECL_DELETED; /* do the write first as we won't be leaving it in any data structures, unlike the host objects */ if (commit) { write_named_billing_class ((unsigned char *)cp->name, 0, cp); if (!commit_leases ()) return ISC_R_IOERROR; } /* * If this is a subclass remove it from the class's hash table */ if (cp->superclass) { class_hash_delete(cp->superclass->hash, (const char *)cp->hash_string.data, cp->hash_string.len, MDL); } /* remove from collections */ unlink_class(&cp); return ISC_R_SUCCESS; } isc_result_t delete_host (hd, commit) struct host_decl *hd; int commit; { struct host_decl *hp = (struct host_decl *)0; struct host_decl *np = (struct host_decl *)0; struct host_decl *foo; int hw_head = 0, uid_head = 1; /* Don't need to do it twice. */ if (hd -> flags & HOST_DECL_DELETED) return ISC_R_SUCCESS; /* But we do need to do it once! :') */ hd -> flags |= HOST_DECL_DELETED; if (hd -> interface.hlen) { if (host_hw_addr_hash) { if (host_hash_lookup (&hp, host_hw_addr_hash, hd -> interface.hbuf, hd -> interface.hlen, MDL)) { if (hp == hd) { host_hash_delete (host_hw_addr_hash, hd -> interface.hbuf, hd -> interface.hlen, MDL); hw_head = 1; } else { np = (struct host_decl *)0; foo = (struct host_decl *)0; host_reference (&foo, hp, MDL); while (foo) { if (foo == hd) break; if (np) host_dereference (&np, MDL); host_reference (&np, foo, MDL); host_dereference (&foo, MDL); if (np -> n_ipaddr) host_reference (&foo, np -> n_ipaddr, MDL); } if (foo) { host_dereference (&np -> n_ipaddr, MDL); if (hd -> n_ipaddr) host_reference (&np -> n_ipaddr, hd -> n_ipaddr, MDL); host_dereference (&foo, MDL); } if (np) host_dereference (&np, MDL); } host_dereference (&hp, MDL); } } } /* If we got a client identifier, hash this entry by client identifier. */ if (hd -> client_identifier.len) { if (host_uid_hash) { if (host_hash_lookup (&hp, host_uid_hash, hd -> client_identifier.data, hd -> client_identifier.len, MDL)) { if (hp == hd) { host_hash_delete (host_uid_hash, hd -> client_identifier.data, hd -> client_identifier.len, MDL); uid_head = 1; } else { np = (struct host_decl *)0; foo = (struct host_decl *)0; host_reference (&foo, hp, MDL); while (foo) { if (foo == hd) break; if (np) host_dereference (&np, MDL); host_reference (&np, foo, MDL); host_dereference (&foo, MDL); if (np -> n_ipaddr) host_reference (&foo, np -> n_ipaddr, MDL); } if (foo) { host_dereference (&np -> n_ipaddr, MDL); if (hd -> n_ipaddr) host_reference (&np -> n_ipaddr, hd -> n_ipaddr, MDL); host_dereference (&foo, MDL); } if (np) host_dereference (&np, MDL); } host_dereference (&hp, MDL); } } } if (hd->host_id_option != NULL) { option_dereference(&hd->host_id_option, MDL); data_string_forget(&hd->host_id, MDL); } if (hd -> n_ipaddr) { if (uid_head && hd -> n_ipaddr -> client_identifier.len) { host_hash_add (host_uid_hash, hd -> n_ipaddr -> client_identifier.data, hd -> n_ipaddr -> client_identifier.len, hd -> n_ipaddr, MDL); } if (hw_head && hd -> n_ipaddr -> interface.hlen) { host_hash_add (host_hw_addr_hash, hd -> n_ipaddr -> interface.hbuf, hd -> n_ipaddr -> interface.hlen, hd -> n_ipaddr, MDL); } host_dereference (&hd -> n_ipaddr, MDL); } if (host_name_hash) { if (host_hash_lookup (&hp, host_name_hash, (unsigned char *)hd -> name, strlen (hd -> name), MDL)) { if (hp == hd && !(hp -> flags & HOST_DECL_STATIC)) { host_hash_delete (host_name_hash, (unsigned char *)hd -> name, strlen (hd -> name), MDL); } host_dereference (&hp, MDL); } } if (commit) { if (!write_host (hd)) return ISC_R_IOERROR; if (!commit_leases ()) return ISC_R_IOERROR; } return ISC_R_SUCCESS; } int find_hosts_by_haddr (struct host_decl **hp, int htype, const unsigned char *haddr, unsigned hlen, const char *file, int line) { struct hardware h; #if defined(LDAP_CONFIGURATION) int ret; if ((ret = find_haddr_in_ldap (hp, htype, hlen, haddr, file, line))) return ret; #endif h.hlen = hlen + 1; h.hbuf [0] = htype; memcpy (&h.hbuf [1], haddr, hlen); return host_hash_lookup (hp, host_hw_addr_hash, h.hbuf, h.hlen, file, line); } int find_hosts_by_uid (struct host_decl **hp, const unsigned char *data, unsigned len, const char *file, int line) { return host_hash_lookup (hp, host_uid_hash, data, len, file, line); } int find_hosts_by_option(struct host_decl **hp, struct packet *packet, struct option_state *opt_state, const char *file, int line) { host_id_info_t *p; struct option_cache *oc; struct data_string data; int found; struct packet *relay_packet; struct option_state *relay_state; for (p = host_id_info; p != NULL; p = p->next) { relay_packet = packet; relay_state = opt_state; /* If this option block is for a relay (relays != 0) * and we are processing the main options and not * options from the IA (packet->options == opt_state) * try to find the proper relay */ if ((p->relays != 0) && (packet->options == opt_state)) { int i = p->relays; while ((i != 0) && (relay_packet->dhcpv6_container_packet != NULL)) { relay_packet = relay_packet->dhcpv6_container_packet; i--; } /* We wanted a specific relay but were * unable to find it */ if ((p->relays <= MAX_V6RELAY_HOPS) && (i != 0)) continue; relay_state = relay_packet->options; } oc = lookup_option(p->option->universe, relay_state, p->option->code); if (oc != NULL) { memset(&data, 0, sizeof(data)); if (!evaluate_option_cache(&data, relay_packet, NULL, NULL, relay_state, NULL, &global_scope, oc, MDL)) { log_error("Error evaluating option cache"); return 0; } found = host_hash_lookup(hp, p->values_hash, data.data, data.len, file, line); data_string_forget(&data, MDL); if (found) { return 1; } } } return 0; } /* More than one host_decl can be returned by find_hosts_by_haddr or find_hosts_by_uid, and each host_decl can have multiple addresses. Loop through the list of hosts, and then for each host, through the list of addresses, looking for an address that's in the same shared network as the one specified. Store the matching address through the addr pointer, update the host pointer to point at the host_decl that matched, and return the subnet that matched. */ int find_host_for_network (struct subnet **sp, struct host_decl **host, struct iaddr *addr, struct shared_network *share) { int i; struct iaddr ip_address; struct host_decl *hp; struct data_string fixed_addr; memset (&fixed_addr, 0, sizeof fixed_addr); for (hp = *host; hp; hp = hp -> n_ipaddr) { if (!hp -> fixed_addr) continue; if (!evaluate_option_cache (&fixed_addr, (struct packet *)0, (struct lease *)0, (struct client_state *)0, (struct option_state *)0, (struct option_state *)0, &global_scope, hp -> fixed_addr, MDL)) continue; for (i = 0; i < fixed_addr.len; i += 4) { ip_address.len = 4; memcpy (ip_address.iabuf, fixed_addr.data + i, 4); if (find_grouped_subnet (sp, share, ip_address, MDL)) { struct host_decl *tmp = (struct host_decl *)0; *addr = ip_address; /* This is probably not necessary, but just in case *host is the only reference to that host declaration, make a temporary reference so that dereferencing it doesn't dereference hp out from under us. */ host_reference (&tmp, *host, MDL); host_dereference (host, MDL); host_reference (host, hp, MDL); host_dereference (&tmp, MDL); data_string_forget (&fixed_addr, MDL); return 1; } } data_string_forget (&fixed_addr, MDL); } return 0; } void new_address_range (cfile, low, high, subnet, pool, lpchain) struct parse *cfile; struct iaddr low, high; struct subnet *subnet; struct pool *pool; struct lease **lpchain; { #if defined(COMPACT_LEASES) struct lease *address_range; #endif unsigned min, max, i; char lowbuf [16], highbuf [16], netbuf [16]; struct shared_network *share = subnet -> shared_network; struct lease *lt = (struct lease *)0; #if !defined(COMPACT_LEASES) isc_result_t status; #endif /* All subnets should have attached shared network structures. */ if (!share) { strcpy (netbuf, piaddr (subnet -> net)); log_fatal ("No shared network for network %s (%s)", netbuf, piaddr (subnet -> netmask)); } /* Initialize the hash table if it hasn't been done yet. */ if (!lease_uid_hash) { if (!lease_id_new_hash(&lease_uid_hash, LEASE_HASH_SIZE, MDL)) log_fatal ("Can't allocate lease/uid hash"); } if (!lease_ip_addr_hash) { if (!lease_ip_new_hash(&lease_ip_addr_hash, LEASE_HASH_SIZE, MDL)) log_fatal ("Can't allocate lease/ip hash"); } if (!lease_hw_addr_hash) { if (!lease_id_new_hash(&lease_hw_addr_hash, LEASE_HASH_SIZE, MDL)) log_fatal ("Can't allocate lease/hw hash"); } /* Make sure that high and low addresses are in this subnet. */ if (!addr_eq(subnet->net, subnet_number(low, subnet->netmask))) { strcpy(lowbuf, piaddr(low)); strcpy(netbuf, piaddr(subnet->net)); log_fatal("bad range, address %s not in subnet %s netmask %s", lowbuf, netbuf, piaddr(subnet->netmask)); } if (!addr_eq(subnet->net, subnet_number(high, subnet->netmask))) { strcpy(highbuf, piaddr(high)); strcpy(netbuf, piaddr(subnet->net)); log_fatal("bad range, address %s not in subnet %s netmask %s", highbuf, netbuf, piaddr(subnet->netmask)); } /* Get the high and low host addresses... */ max = host_addr (high, subnet -> netmask); min = host_addr (low, subnet -> netmask); /* Allow range to be specified high-to-low as well as low-to-high. */ if (min > max) { max = min; min = host_addr (high, subnet -> netmask); } /* Get a lease structure for each address in the range. */ #if defined (COMPACT_LEASES) address_range = new_leases (max - min + 1, MDL); if (!address_range) { strcpy (lowbuf, piaddr (low)); strcpy (highbuf, piaddr (high)); log_fatal ("No memory for address range %s-%s.", lowbuf, highbuf); } #endif /* Fill out the lease structures with some minimal information. */ for (i = 0; i < max - min + 1; i++) { struct lease *lp = (struct lease *)0; #if defined (COMPACT_LEASES) omapi_object_initialize ((omapi_object_t *)&address_range [i], dhcp_type_lease, 0, sizeof (struct lease), MDL); lease_reference (&lp, &address_range [i], MDL); #else status = lease_allocate (&lp, MDL); if (status != ISC_R_SUCCESS) log_fatal ("No memory for lease %s: %s", piaddr (ip_addr (subnet -> net, subnet -> netmask, i + min)), isc_result_totext (status)); #endif lp->ip_addr = ip_addr(subnet->net, subnet->netmask, i + min); lp->starts = MIN_TIME; lp->ends = MIN_TIME; subnet_reference(&lp->subnet, subnet, MDL); pool_reference(&lp->pool, pool, MDL); lp->binding_state = FTS_FREE; lp->next_binding_state = FTS_FREE; lp->rewind_binding_state = FTS_FREE; lp->flags = 0; /* Remember the lease in the IP address hash. */ if (find_lease_by_ip_addr (&lt, lp -> ip_addr, MDL)) { if (lt -> pool) { parse_warn (cfile, "lease %s is declared twice!", piaddr (lp -> ip_addr)); } else pool_reference (&lt -> pool, pool, MDL); lease_dereference (&lt, MDL); } else lease_ip_hash_add(lease_ip_addr_hash, lp->ip_addr.iabuf, lp->ip_addr.len, lp, MDL); /* Put the lease on the chain for the caller. */ if (lpchain) { if (*lpchain) { lease_reference (&lp -> next, *lpchain, MDL); lease_dereference (lpchain, MDL); } lease_reference (lpchain, lp, MDL); } lease_dereference (&lp, MDL); } } int find_subnet (struct subnet **sp, struct iaddr addr, const char *file, int line) { struct subnet *rv; for (rv = subnets; rv; rv = rv -> next_subnet) { if (addr_eq (subnet_number (addr, rv -> netmask), rv -> net)) { if (subnet_reference (sp, rv, file, line) != ISC_R_SUCCESS) return 0; return 1; } } return 0; } int find_grouped_subnet (struct subnet **sp, struct shared_network *share, struct iaddr addr, const char *file, int line) { struct subnet *rv; for (rv = share -> subnets; rv; rv = rv -> next_sibling) { if (addr_eq (subnet_number (addr, rv -> netmask), rv -> net)) { if (subnet_reference (sp, rv, file, line) != ISC_R_SUCCESS) return 0; return 1; } } return 0; } /* XXX: could speed up if everyone had a prefix length */ int subnet_inner_than(const struct subnet *subnet, const struct subnet *scan, int warnp) { if (addr_eq(subnet_number(subnet->net, scan->netmask), scan->net) || addr_eq(subnet_number(scan->net, subnet->netmask), subnet->net)) { char n1buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255")]; int i, j; for (i = 0; i < 128; i++) if (subnet->netmask.iabuf[3 - (i >> 3)] & (1 << (i & 7))) break; for (j = 0; j < 128; j++) if (scan->netmask.iabuf[3 - (j >> 3)] & (1 << (j & 7))) break; if (warnp) { strcpy(n1buf, piaddr(subnet->net)); log_error("Warning: subnet %s/%d overlaps subnet %s/%d", n1buf, 32 - i, piaddr(scan->net), 32 - j); } if (i < j) return 1; } return 0; } /* Enter a new subnet into the subnet list. */ void enter_subnet (subnet) struct subnet *subnet; { struct subnet *scan = (struct subnet *)0; struct subnet *next = (struct subnet *)0; struct subnet *prev = (struct subnet *)0; /* Check for duplicates... */ if (subnets) subnet_reference (&next, subnets, MDL); while (next) { subnet_reference (&scan, next, MDL); subnet_dereference (&next, MDL); /* When we find a conflict, make sure that the subnet with the narrowest subnet mask comes first. */ if (subnet_inner_than (subnet, scan, 1)) { if (prev) { if (prev -> next_subnet) subnet_dereference (&prev -> next_subnet, MDL); subnet_reference (&prev -> next_subnet, subnet, MDL); subnet_dereference (&prev, MDL); } else { subnet_dereference (&subnets, MDL); subnet_reference (&subnets, subnet, MDL); } subnet_reference (&subnet -> next_subnet, scan, MDL); subnet_dereference (&scan, MDL); return; } subnet_reference (&prev, scan, MDL); subnet_dereference (&scan, MDL); } if (prev) subnet_dereference (&prev, MDL); /* XXX use the BSD radix tree code instead of a linked list. */ if (subnets) { subnet_reference (&subnet -> next_subnet, subnets, MDL); subnet_dereference (&subnets, MDL); } subnet_reference (&subnets, subnet, MDL); } /* Enter a new shared network into the shared network list. */ void enter_shared_network (share) struct shared_network *share; { if (shared_networks) { shared_network_reference (&share -> next, shared_networks, MDL); shared_network_dereference (&shared_networks, MDL); } shared_network_reference (&shared_networks, share, MDL); } void new_shared_network_interface (cfile, share, name) struct parse *cfile; struct shared_network *share; const char *name; { struct interface_info *ip; isc_result_t status; if (share -> interface) { parse_warn (cfile, "A subnet or shared network can't be connected %s", "to two interfaces."); return; } for (ip = interfaces; ip; ip = ip -> next) if (!strcmp (ip -> name, name)) break; if (!ip) { status = interface_allocate (&ip, MDL); if (status != ISC_R_SUCCESS) log_fatal ("new_shared_network_interface %s: %s", name, isc_result_totext (status)); if (strlen (name) > sizeof ip -> name) { memcpy (ip -> name, name, (sizeof ip -> name) - 1); ip -> name [(sizeof ip -> name) - 1] = 0; } else strcpy (ip -> name, name); if (interfaces) { interface_reference (&ip -> next, interfaces, MDL); interface_dereference (&interfaces, MDL); } interface_reference (&interfaces, ip, MDL); ip -> flags = INTERFACE_REQUESTED; /* XXX this is a reference loop. */ shared_network_reference (&ip -> shared_network, share, MDL); interface_reference (&share -> interface, ip, MDL); } } /* Enter a lease into the system. This is called by the parser each time it reads in a new lease. If the subnet for that lease has already been read in (usually the case), just update that lease; otherwise, allocate temporary storage for the lease and keep it around until we're done reading in the config file. */ void enter_lease (lease) struct lease *lease; { struct lease *comp = (struct lease *)0; if (find_lease_by_ip_addr (&comp, lease -> ip_addr, MDL)) { if (!comp -> pool) { log_error ("undeclared lease found in database: %s", piaddr (lease -> ip_addr)); } else pool_reference (&lease -> pool, comp -> pool, MDL); if (comp -> subnet) subnet_reference (&lease -> subnet, comp -> subnet, MDL); lease_ip_hash_delete(lease_ip_addr_hash, lease->ip_addr.iabuf, lease->ip_addr.len, MDL); lease_dereference (&comp, MDL); } /* The only way a lease can get here without a subnet is if it's in the lease file, but not in the dhcpd.conf file. In this case, we *should* keep it around until it's expired, but never reallocate it or renew it. Currently, to maintain consistency, we are not doing this. XXX fix this so that the lease is kept around until it expires. XXX this will be important in IPv6 with addresses that become XXX non-renewable as a result of a renumbering event. */ if (!lease -> subnet) { log_error ("lease %s: no subnet.", piaddr (lease -> ip_addr)); return; } lease_ip_hash_add(lease_ip_addr_hash, lease->ip_addr.iabuf, lease->ip_addr.len, lease, MDL); } /* Replace the data in an existing lease with the data in a new lease; adjust hash tables to suit, and insertion sort the lease into the list of leases by expiry time so that we can always find the oldest lease. */ int supersede_lease (comp, lease, commit, propogate, pimmediate) struct lease *comp, *lease; int commit; int propogate; int pimmediate; { struct lease *lp, **lq, *prev; struct timeval tv; #if defined (FAILOVER_PROTOCOL) int do_pool_check = 0; /* We must commit leases before sending updates regarding them to failover peers. It is, therefore, an error to set pimmediate and not commit. */ if (pimmediate && !commit) return 0; #endif /* If there is no sample lease, just do the move. */ if (!lease) goto just_move_it; /* Static leases are not currently kept in the database... */ if (lease -> flags & STATIC_LEASE) return 1; /* If the existing lease hasn't expired and has a different unique identifier or, if it doesn't have a unique identifier, a different hardware address, then the two leases are in conflict. If the existing lease has a uid and the new one doesn't, but they both have the same hardware address, and dynamic bootp is allowed on this lease, then we allow that, in case a dynamic BOOTP lease is requested *after* a DHCP lease has been assigned. */ if (lease -> binding_state != FTS_ABANDONED && lease -> next_binding_state != FTS_ABANDONED && comp -> binding_state == FTS_ACTIVE && (((comp -> uid && lease -> uid) && (comp -> uid_len != lease -> uid_len || memcmp (comp -> uid, lease -> uid, comp -> uid_len))) || (!comp -> uid && ((comp -> hardware_addr.hlen != lease -> hardware_addr.hlen) || memcmp (comp -> hardware_addr.hbuf, lease -> hardware_addr.hbuf, comp -> hardware_addr.hlen))))) { log_error ("Lease conflict at %s", piaddr (comp -> ip_addr)); } /* If there's a Unique ID, dissociate it from the hash table and free it if necessary. */ if (comp->uid) { uid_hash_delete(comp); if (comp->uid != comp->uid_buf) { dfree(comp->uid, MDL); comp->uid_max = 0; comp->uid_len = 0; } comp -> uid = (unsigned char *)0; } /* If there's a hardware address, remove the lease from its * old position in the hash bucket's ordered list. */ if (comp->hardware_addr.hlen) hw_hash_delete(comp); /* If the lease has been billed to a class, remove the billing. */ if (comp -> billing_class != lease -> billing_class) { if (comp -> billing_class) unbill_class (comp, comp -> billing_class); if (lease -> billing_class) bill_class (comp, lease -> billing_class); } /* Copy the data files, but not the linkages. */ comp -> starts = lease -> starts; if (lease -> uid) { if (lease -> uid_len <= sizeof (lease -> uid_buf)) { memcpy (comp -> uid_buf, lease -> uid, lease -> uid_len); comp -> uid = &comp -> uid_buf [0]; comp -> uid_max = sizeof comp -> uid_buf; comp -> uid_len = lease -> uid_len; } else if (lease -> uid != &lease -> uid_buf [0]) { comp -> uid = lease -> uid; comp -> uid_max = lease -> uid_max; lease -> uid = (unsigned char *)0; lease -> uid_max = 0; comp -> uid_len = lease -> uid_len; lease -> uid_len = 0; } else { log_fatal ("corrupt lease uid."); /* XXX */ } } else { comp -> uid = (unsigned char *)0; comp -> uid_len = comp -> uid_max = 0; } if (comp -> host) host_dereference (&comp -> host, MDL); host_reference (&comp -> host, lease -> host, MDL); comp -> hardware_addr = lease -> hardware_addr; comp -> flags = ((lease -> flags & ~PERSISTENT_FLAGS) | (comp -> flags & ~EPHEMERAL_FLAGS)); if (comp -> scope) binding_scope_dereference (&comp -> scope, MDL); if (lease -> scope) { binding_scope_reference (&comp -> scope, lease -> scope, MDL); binding_scope_dereference (&lease -> scope, MDL); } if (comp -> agent_options) option_chain_head_dereference (&comp -> agent_options, MDL); if (lease -> agent_options) { /* Only retain the agent options if the lease is still affirmatively associated with a client. */ if (lease -> next_binding_state == FTS_ACTIVE || lease -> next_binding_state == FTS_EXPIRED) option_chain_head_reference (&comp -> agent_options, lease -> agent_options, MDL); option_chain_head_dereference (&lease -> agent_options, MDL); } /* Record the hostname information in the lease. */ if (comp -> client_hostname) dfree (comp -> client_hostname, MDL); comp -> client_hostname = lease -> client_hostname; lease -> client_hostname = (char *)0; if (lease->on_star.on_expiry) { if (comp->on_star.on_expiry) executable_statement_dereference (&comp->on_star.on_expiry, MDL); executable_statement_reference (&comp->on_star.on_expiry, lease->on_star.on_expiry, MDL); } if (lease->on_star.on_commit) { if (comp->on_star.on_commit) executable_statement_dereference (&comp->on_star.on_commit, MDL); executable_statement_reference (&comp->on_star.on_commit, lease->on_star.on_commit, MDL); } if (lease->on_star.on_release) { if (comp->on_star.on_release) executable_statement_dereference (&comp->on_star.on_release, MDL); executable_statement_reference (&comp->on_star.on_release, lease->on_star.on_release, MDL); } /* Record the lease in the uid hash if necessary. */ if (comp->uid) uid_hash_add(comp); /* Record it in the hardware address hash if necessary. */ if (comp->hardware_addr.hlen) hw_hash_add(comp); comp->cltt = lease->cltt; #if defined (FAILOVER_PROTOCOL) comp->tstp = lease->tstp; comp->tsfp = lease->tsfp; comp->atsfp = lease->atsfp; #endif /* FAILOVER_PROTOCOL */ comp->ends = lease->ends; comp->next_binding_state = lease->next_binding_state; /* * If we have a control block pointer copy it in. * We don't zero out an older ponter as it is still * in use. We shouldn't need to overwrite an * old pointer with a new one as the old transaction * should have been cancelled before getting here. */ if (lease->ddns_cb != NULL) comp->ddns_cb = lease->ddns_cb; just_move_it: #if defined (FAILOVER_PROTOCOL) /* * Atsfp should be cleared upon any state change that implies * propagation whether supersede_lease was given a copy lease * structure or not (often from the pool_timer()). */ if (propogate) comp->atsfp = 0; #endif /* FAILOVER_PROTOCOL */ if (!comp -> pool) { log_error ("Supersede_lease: lease %s with no pool.", piaddr (comp -> ip_addr)); return 0; } /* Figure out which queue it's on. */ switch (comp -> binding_state) { case FTS_FREE: if (comp->flags & RESERVED_LEASE) lq = &comp->pool->reserved; else { lq = &comp->pool->free; comp->pool->free_leases--; } #if defined(FAILOVER_PROTOCOL) do_pool_check = 1; #endif break; case FTS_ACTIVE: lq = &comp -> pool -> active; break; case FTS_EXPIRED: case FTS_RELEASED: case FTS_RESET: lq = &comp -> pool -> expired; break; case FTS_ABANDONED: lq = &comp -> pool -> abandoned; break; case FTS_BACKUP: if (comp->flags & RESERVED_LEASE) lq = &comp->pool->reserved; else { lq = &comp->pool->backup; comp->pool->backup_leases--; } #if defined(FAILOVER_PROTOCOL) do_pool_check = 1; #endif break; default: log_error ("Lease with bogus binding state: %d", comp -> binding_state); #if defined (BINDING_STATE_DEBUG) abort (); #endif return 0; } /* Remove the lease from its current place in its current timer sequence. */ /* XXX this is horrid. */ prev = (struct lease *)0; for (lp = *lq; lp; lp = lp -> next) { if (lp == comp) break; prev = lp; } if (!lp) { log_fatal("Lease with binding state %s not on its queue.", (comp->binding_state < 1 || comp->binding_state > FTS_LAST) ? "unknown" : binding_state_names[comp->binding_state - 1]); } if (prev) { lease_dereference (&prev -> next, MDL); if (comp -> next) { lease_reference (&prev -> next, comp -> next, MDL); lease_dereference (&comp -> next, MDL); } } else { lease_dereference (lq, MDL); if (comp -> next) { lease_reference (lq, comp -> next, MDL); lease_dereference (&comp -> next, MDL); } } /* Make the state transition. */ if (commit || !pimmediate) make_binding_state_transition (comp); /* Put the lease back on the appropriate queue. If the lease is corrupt (as detected by lease_enqueue), don't go any farther. */ if (!lease_enqueue (comp)) return 0; /* If this is the next lease that will timeout on the pool, zap the old timeout and set the timeout on this pool to the time that the lease's next event will happen. We do not actually set the timeout unless commit is true - we don't want to thrash the timer queue when reading the lease database. Instead, the database code calls the expiry event on each pool after reading in the lease file, and the expiry code sets the timer if there's anything left to expire after it's run any outstanding expiry events on the pool. */ if ((commit || !pimmediate) && comp -> sort_time != MIN_TIME && comp -> sort_time > cur_time && (comp -> sort_time < comp -> pool -> next_event_time || comp -> pool -> next_event_time == MIN_TIME)) { comp -> pool -> next_event_time = comp -> sort_time; tv . tv_sec = comp -> pool -> next_event_time; tv . tv_usec = 0; add_timeout (&tv, pool_timer, comp -> pool, (tvref_t)pool_reference, (tvunref_t)pool_dereference); } if (commit) { #if defined(FAILOVER_PROTOCOL) /* * If commit and propogate are set, then we can save a * possible fsync later in BNDUPD socket transmission by * stepping the rewind state forward to the new state, in * case it has changed. This is only worth doing if the * failover connection is currently connected, as in this * case it is likely we will be transmitting to the peer very * shortly. */ if (propogate && (comp->pool->failover_peer != NULL) && ((comp->pool->failover_peer->service_state == cooperating) || (comp->pool->failover_peer->service_state == not_responding))) comp->rewind_binding_state = comp->binding_state; #endif if (!write_lease (comp)) return 0; if ((server_starting & SS_NOSYNC) == 0) { if (!commit_leases ()) return 0; } } #if defined (FAILOVER_PROTOCOL) if (propogate) { comp -> desired_binding_state = comp -> binding_state; if (!dhcp_failover_queue_update (comp, pimmediate)) return 0; } if (do_pool_check && comp->pool->failover_peer) dhcp_failover_pool_check(comp->pool); #endif /* If the current binding state has already expired, do an expiry event right now. */ /* XXX At some point we should optimize this so that we don't XXX write the lease twice, but this is a safe way to fix the XXX problem for 3.0 (I hope!). */ if ((commit || !pimmediate) && comp -> sort_time < cur_time && comp -> next_binding_state != comp -> binding_state) pool_timer (comp -> pool); return 1; } void make_binding_state_transition (struct lease *lease) { #if defined (FAILOVER_PROTOCOL) dhcp_failover_state_t *peer; if (lease -> pool && lease -> pool -> failover_peer) peer = lease -> pool -> failover_peer; else peer = (dhcp_failover_state_t *)0; #endif /* If the lease was active and is now no longer active, but isn't released, then it just expired, so do the expiry event. */ if (lease -> next_binding_state != lease -> binding_state && (( #if defined (FAILOVER_PROTOCOL) peer && (lease->binding_state == FTS_EXPIRED || lease->binding_state == FTS_ACTIVE) && (lease->next_binding_state == FTS_FREE || lease->next_binding_state == FTS_BACKUP)) || (!peer && #endif lease -> binding_state == FTS_ACTIVE && lease -> next_binding_state != FTS_RELEASED))) { #if defined (NSUPDATE) (void) ddns_removals(lease, NULL, NULL, ISC_TRUE); #endif if (lease->on_star.on_expiry) { execute_statements(NULL, NULL, lease, NULL, NULL, NULL, &lease->scope, lease->on_star.on_expiry, NULL); if (lease->on_star.on_expiry) executable_statement_dereference (&lease->on_star.on_expiry, MDL); } /* No sense releasing a lease after it's expired. */ if (lease->on_star.on_release) executable_statement_dereference (&lease->on_star.on_release, MDL); /* Get rid of client-specific bindings that are only correct when the lease is active. */ if (lease -> billing_class) unbill_class (lease, lease -> billing_class); if (lease -> agent_options) option_chain_head_dereference (&lease -> agent_options, MDL); if (lease -> client_hostname) { dfree (lease -> client_hostname, MDL); lease -> client_hostname = (char *)0; } if (lease -> host) host_dereference (&lease -> host, MDL); /* Send the expiry time to the peer. */ lease -> tstp = lease -> ends; } /* If the lease was active and is now released, do the release event. */ if (lease -> next_binding_state != lease -> binding_state && (( #if defined (FAILOVER_PROTOCOL) peer && lease -> binding_state == FTS_RELEASED && (lease -> next_binding_state == FTS_FREE || lease -> next_binding_state == FTS_BACKUP)) || (!peer && #endif lease -> binding_state == FTS_ACTIVE && lease -> next_binding_state == FTS_RELEASED))) { #if defined (NSUPDATE) /* * Note: ddns_removals() is also iterated when the lease * enters state 'released' in 'release_lease()'. The below * is caught when a peer receives a BNDUPD from a failover * peer; it may not have received the client's release (it * may have been offline). * * We could remove the call from release_lease() because * it will also catch here on the originating server after the * peer acknowledges the state change. However, there could * be many hours inbetween, and in this case we /know/ the * client is no longer using the lease when we receive the * release message. This is not true of expiry, where the * peer may have extended the lease. */ (void) ddns_removals(lease, NULL, NULL, ISC_TRUE); #endif if (lease->on_star.on_release) { execute_statements(NULL, NULL, lease, NULL, NULL, NULL, &lease->scope, lease->on_star.on_release, NULL); executable_statement_dereference (&lease->on_star.on_release, MDL); } /* A released lease can't expire. */ if (lease->on_star.on_expiry) executable_statement_dereference (&lease->on_star.on_expiry, MDL); /* Get rid of client-specific bindings that are only correct when the lease is active. */ if (lease -> billing_class) unbill_class (lease, lease -> billing_class); if (lease -> agent_options) option_chain_head_dereference (&lease -> agent_options, MDL); if (lease -> client_hostname) { dfree (lease -> client_hostname, MDL); lease -> client_hostname = (char *)0; } if (lease -> host) host_dereference (&lease -> host, MDL); /* Send the release time (should be == cur_time) to the peer. */ lease -> tstp = lease -> ends; } #if defined (DEBUG_LEASE_STATE_TRANSITIONS) log_debug ("lease %s moves from %s to %s", piaddr (lease -> ip_addr), binding_state_print (lease -> binding_state), binding_state_print (lease -> next_binding_state)); #endif lease -> binding_state = lease -> next_binding_state; switch (lease -> binding_state) { case FTS_ACTIVE: #if defined (FAILOVER_PROTOCOL) if (lease -> pool && lease -> pool -> failover_peer) lease -> next_binding_state = FTS_EXPIRED; else #endif lease -> next_binding_state = FTS_FREE; break; case FTS_EXPIRED: case FTS_RELEASED: case FTS_ABANDONED: case FTS_RESET: lease->next_binding_state = FTS_FREE; #if defined(FAILOVER_PROTOCOL) /* If we are not in partner_down, leases don't go from EXPIRED to FREE on a timeout - only on an update. If we're in partner_down, they expire at mclt past the time we entered partner_down. */ if ((lease->pool != NULL) && (lease->pool->failover_peer != NULL) && (lease->pool->failover_peer->me.state == partner_down)) lease->tsfp = (lease->pool->failover_peer->me.stos + lease->pool->failover_peer->mclt); #endif /* FAILOVER_PROTOCOL */ break; case FTS_FREE: case FTS_BACKUP: lease -> next_binding_state = lease -> binding_state; break; } #if defined (DEBUG_LEASE_STATE_TRANSITIONS) log_debug ("lease %s: next binding state %s", piaddr (lease -> ip_addr), binding_state_print (lease -> next_binding_state)); #endif } /* Copy the contents of one lease into another, correctly maintaining reference counts. */ int lease_copy (struct lease **lp, struct lease *lease, const char *file, int line) { struct lease *lt = (struct lease *)0; isc_result_t status; status = lease_allocate (&lt, MDL); if (status != ISC_R_SUCCESS) return 0; lt -> ip_addr = lease -> ip_addr; lt -> starts = lease -> starts; lt -> ends = lease -> ends; lt -> uid_len = lease -> uid_len; lt -> uid_max = lease -> uid_max; if (lease -> uid == lease -> uid_buf) { lt -> uid = lt -> uid_buf; memcpy (lt -> uid_buf, lease -> uid_buf, sizeof lt -> uid_buf); } else if (!lease -> uid_max) { lt -> uid = (unsigned char *)0; } else { lt -> uid = dmalloc (lt -> uid_max, MDL); if (!lt -> uid) { lease_dereference (&lt, MDL); return 0; } memcpy (lt -> uid, lease -> uid, lease -> uid_max); } if (lease -> client_hostname) { lt -> client_hostname = dmalloc (strlen (lease -> client_hostname) + 1, MDL); if (!lt -> client_hostname) { lease_dereference (&lt, MDL); return 0; } strcpy (lt -> client_hostname, lease -> client_hostname); } if (lease -> scope) binding_scope_reference (&lt -> scope, lease -> scope, MDL); if (lease -> agent_options) option_chain_head_reference (&lt -> agent_options, lease -> agent_options, MDL); host_reference (&lt -> host, lease -> host, file, line); subnet_reference (&lt -> subnet, lease -> subnet, file, line); pool_reference (&lt -> pool, lease -> pool, file, line); class_reference (&lt -> billing_class, lease -> billing_class, file, line); lt -> hardware_addr = lease -> hardware_addr; if (lease->on_star.on_expiry) executable_statement_reference (&lt->on_star.on_expiry, lease->on_star.on_expiry, file, line); if (lease->on_star.on_commit) executable_statement_reference (&lt->on_star.on_commit, lease->on_star.on_commit, file, line); if (lease->on_star.on_release) executable_statement_reference (&lt->on_star.on_release, lease->on_star.on_release, file, line); lt->flags = lease->flags; lt->tstp = lease->tstp; lt->tsfp = lease->tsfp; lt->atsfp = lease->atsfp; lt->cltt = lease -> cltt; lt->binding_state = lease->binding_state; lt->next_binding_state = lease->next_binding_state; lt->rewind_binding_state = lease->rewind_binding_state; status = lease_reference(lp, lt, file, line); lease_dereference(&lt, MDL); return status == ISC_R_SUCCESS; } /* Release the specified lease and re-hash it as appropriate. */ void release_lease (lease, packet) struct lease *lease; struct packet *packet; { /* If there are statements to execute when the lease is released, execute them. */ #if defined (NSUPDATE) (void) ddns_removals(lease, NULL, NULL, ISC_FALSE); #endif if (lease->on_star.on_release) { execute_statements (NULL, packet, lease, NULL, packet->options, NULL, &lease->scope, lease->on_star.on_release, NULL); if (lease->on_star.on_release) executable_statement_dereference (&lease->on_star.on_release, MDL); } /* We do either the on_release or the on_expiry events, but not both (it's possible that they could be the same, in any case). */ if (lease->on_star.on_expiry) executable_statement_dereference (&lease->on_star.on_expiry, MDL); if (lease -> binding_state != FTS_FREE && lease -> binding_state != FTS_BACKUP && lease -> binding_state != FTS_RELEASED && lease -> binding_state != FTS_EXPIRED && lease -> binding_state != FTS_RESET) { if (lease->on_star.on_commit) executable_statement_dereference (&lease->on_star.on_commit, MDL); /* Blow away any bindings. */ if (lease -> scope) binding_scope_dereference (&lease -> scope, MDL); /* Set sort times to the present. */ lease -> ends = cur_time; /* Lower layers of muckery set tstp to ->ends. But we send * protocol messages before this. So it is best to set * tstp now anyway. */ lease->tstp = cur_time; #if defined (FAILOVER_PROTOCOL) if (lease -> pool && lease -> pool -> failover_peer) { dhcp_failover_state_t *peer = NULL; if (lease->pool != NULL) peer = lease->pool->failover_peer; if ((peer->service_state == not_cooperating) && (((peer->i_am == primary) && (lease->rewind_binding_state == FTS_FREE)) || ((peer->i_am == secondary) && (lease->rewind_binding_state == FTS_BACKUP)))) { lease->next_binding_state = lease->rewind_binding_state; } else lease -> next_binding_state = FTS_RELEASED; } else { lease -> next_binding_state = FTS_FREE; } #else lease -> next_binding_state = FTS_FREE; #endif supersede_lease (lease, (struct lease *)0, 1, 1, 1); } } /* Abandon the specified lease (set its timeout to infinity and its particulars to zero, and re-hash it as appropriate. */ void abandon_lease (lease, message) struct lease *lease; const char *message; { struct lease *lt = (struct lease *)0; #if defined (NSUPDATE) (void) ddns_removals(lease, NULL, NULL, ISC_FALSE); #endif if (!lease_copy (&lt, lease, MDL)) return; if (lt->scope) binding_scope_dereference(&lt->scope, MDL); lt -> ends = cur_time; /* XXX */ lt -> next_binding_state = FTS_ABANDONED; log_error ("Abandoning IP address %s: %s", piaddr (lease -> ip_addr), message); lt -> hardware_addr.hlen = 0; if (lt -> uid && lt -> uid != lt -> uid_buf) dfree (lt -> uid, MDL); lt -> uid = (unsigned char *)0; lt -> uid_len = 0; lt -> uid_max = 0; supersede_lease (lease, lt, 1, 1, 1); lease_dereference (&lt, MDL); } #if 0 /* * This doesn't appear to be in use for anything anymore. * I'm ifdeffing it now and if there are no complaints in * the future it will be removed. * SAR */ /* Abandon the specified lease (set its timeout to infinity and its particulars to zero, and re-hash it as appropriate. */ void dissociate_lease (lease) struct lease *lease; { struct lease *lt = (struct lease *)0; #if defined (NSUPDATE) (void) ddns_removals(lease, NULL, NULL, ISC_FALSE); #endif if (!lease_copy (&lt, lease, MDL)) return; #if defined (FAILOVER_PROTOCOL) if (lease -> pool && lease -> pool -> failover_peer) { lt -> next_binding_state = FTS_RESET; } else { lt -> next_binding_state = FTS_FREE; } #else lt -> next_binding_state = FTS_FREE; #endif lt -> ends = cur_time; /* XXX */ lt -> hardware_addr.hlen = 0; if (lt -> uid && lt -> uid != lt -> uid_buf) dfree (lt -> uid, MDL); lt -> uid = (unsigned char *)0; lt -> uid_len = 0; lt -> uid_max = 0; supersede_lease (lease, lt, 1, 1, 1); lease_dereference (&lt, MDL); } #endif /* Timer called when a lease in a particular pool expires. */ void pool_timer (vpool) void *vpool; { struct pool *pool; struct lease *next = (struct lease *)0; struct lease *lease = (struct lease *)0; #define FREE_LEASES 0 #define ACTIVE_LEASES 1 #define EXPIRED_LEASES 2 #define ABANDONED_LEASES 3 #define BACKUP_LEASES 4 #define RESERVED_LEASES 5 struct lease **lptr[RESERVED_LEASES+1]; TIME next_expiry = MAX_TIME; int i; struct timeval tv; pool = (struct pool *)vpool; lptr [FREE_LEASES] = &pool -> free; lptr [ACTIVE_LEASES] = &pool -> active; lptr [EXPIRED_LEASES] = &pool -> expired; lptr [ABANDONED_LEASES] = &pool -> abandoned; lptr [BACKUP_LEASES] = &pool -> backup; lptr[RESERVED_LEASES] = &pool->reserved; for (i = FREE_LEASES; i <= RESERVED_LEASES; i++) { /* If there's nothing on the queue, skip it. */ if (!*(lptr [i])) continue; #if defined (FAILOVER_PROTOCOL) if (pool->failover_peer && pool->failover_peer->me.state != partner_down) { /* * Normally the secondary doesn't initiate expiration * events (unless in partner-down), but rather relies * on the primary to expire the lease. However, when * disconnected from its peer, the server is allowed to * rewind a lease to the previous state that the peer * would have recorded it. This means there may be * opportunities for active->free or active->backup * expirations while out of contact. * * Q: Should we limit this expiration to * comms-interrupt rather than not-normal? */ if ((i == ACTIVE_LEASES) && (pool->failover_peer->i_am == secondary) && (pool->failover_peer->me.state == normal)) continue; /* Leases in an expired state don't move to free because of a timeout unless we're in partner_down. */ if (i == EXPIRED_LEASES) continue; } #endif lease_reference (&lease, *(lptr [i]), MDL); while (lease) { /* Remember the next lease in the list. */ if (next) lease_dereference (&next, MDL); if (lease -> next) lease_reference (&next, lease -> next, MDL); /* If we've run out of things to expire on this list, stop. */ if (lease -> sort_time > cur_time) { if (lease -> sort_time < next_expiry) next_expiry = lease -> sort_time; break; } /* If there is a pending state change, and this lease has gotten to the time when the state change should happen, just call supersede_lease on it to make the change happen. */ if (lease->next_binding_state != lease->binding_state) { #if defined(FAILOVER_PROTOCOL) dhcp_failover_state_t *peer = NULL; if (lease->pool != NULL) peer = lease->pool->failover_peer; /* Can we rewind the lease to a free state? */ if (peer != NULL && peer->service_state == not_cooperating && lease->next_binding_state == FTS_EXPIRED && ((peer->i_am == primary && lease->rewind_binding_state == FTS_FREE) || (peer->i_am == secondary && lease->rewind_binding_state == FTS_BACKUP))) lease->next_binding_state = lease->rewind_binding_state; #endif supersede_lease(lease, NULL, 1, 1, 1); } lease_dereference (&lease, MDL); if (next) lease_reference (&lease, next, MDL); } if (next) lease_dereference (&next, MDL); if (lease) lease_dereference (&lease, MDL); } if (next_expiry != MAX_TIME) { pool -> next_event_time = next_expiry; tv . tv_sec = pool -> next_event_time; tv . tv_usec = 0; add_timeout (&tv, pool_timer, pool, (tvref_t)pool_reference, (tvunref_t)pool_dereference); } else pool -> next_event_time = MIN_TIME; } /* Locate the lease associated with a given IP address... */ int find_lease_by_ip_addr (struct lease **lp, struct iaddr addr, const char *file, int line) { return lease_ip_hash_lookup(lp, lease_ip_addr_hash, addr.iabuf, addr.len, file, line); } int find_lease_by_uid (struct lease **lp, const unsigned char *uid, unsigned len, const char *file, int line) { if (len == 0) return 0; return lease_id_hash_lookup (lp, lease_uid_hash, uid, len, file, line); } int find_lease_by_hw_addr (struct lease **lp, const unsigned char *hwaddr, unsigned hwlen, const char *file, int line) { if (hwlen == 0) return (0); /* * If it's an infiniband address don't bother * as we don't have a useful address to hash. */ if ((hwlen == 1) && (hwaddr[0] == HTYPE_INFINIBAND)) return (0); return (lease_id_hash_lookup(lp, lease_hw_addr_hash, hwaddr, hwlen, file, line)); } /* If the lease is preferred over the candidate, return truth. The * 'cand' and 'lease' names are retained to read more clearly against * the 'uid_hash_add' and 'hw_hash_add' functions (this is common logic * to those two functions). * * 1) ACTIVE leases are preferred. The active lease with * the longest lifetime is preferred over shortest. * 2) "transitional states" are next, this time with the * most recent CLTT. * 3) free/backup/etc states are next, again with CLTT. In truth we * should never see reset leases for this. * 4) Abandoned leases are always dead last. */ static isc_boolean_t client_lease_preferred(struct lease *cand, struct lease *lease) { if (cand->binding_state == FTS_ACTIVE) { if (lease->binding_state == FTS_ACTIVE && lease->ends >= cand->ends) return ISC_TRUE; } else if (cand->binding_state == FTS_EXPIRED || cand->binding_state == FTS_RELEASED) { if (lease->binding_state == FTS_ACTIVE) return ISC_TRUE; if ((lease->binding_state == FTS_EXPIRED || lease->binding_state == FTS_RELEASED) && lease->cltt >= cand->cltt) return ISC_TRUE; } else if (cand->binding_state != FTS_ABANDONED) { if (lease->binding_state == FTS_ACTIVE || lease->binding_state == FTS_EXPIRED || lease->binding_state == FTS_RELEASED) return ISC_TRUE; if (lease->binding_state != FTS_ABANDONED && lease->cltt >= cand->cltt) return ISC_TRUE; } else /* (cand->binding_state == FTS_ABANDONED) */ { if (lease->binding_state != FTS_ABANDONED || lease->cltt >= cand->cltt) return ISC_TRUE; } return ISC_FALSE; } /* Add the specified lease to the uid hash. */ void uid_hash_add(struct lease *lease) { struct lease *head = NULL; struct lease *cand = NULL; struct lease *prev = NULL; struct lease *next = NULL; /* If it's not in the hash, just add it. */ if (!find_lease_by_uid (&head, lease -> uid, lease -> uid_len, MDL)) lease_id_hash_add(lease_uid_hash, lease->uid, lease->uid_len, lease, MDL); else { /* Otherwise, insert it into the list in order of its * preference for "resuming allocation to the client." * * Because we don't have control of the hash bucket index * directly, we have to remove and re-insert the client * id into the hash if we're inserting onto the head. */ lease_reference(&cand, head, MDL); while (cand != NULL) { if (client_lease_preferred(cand, lease)) break; if (prev != NULL) lease_dereference(&prev, MDL); lease_reference(&prev, cand, MDL); if (cand->n_uid != NULL) lease_reference(&next, cand->n_uid, MDL); lease_dereference(&cand, MDL); if (next != NULL) { lease_reference(&cand, next, MDL); lease_dereference(&next, MDL); } } /* If we want to insert 'before cand', and prev is NULL, * then it was the head of the list. Assume that position. */ if (prev == NULL) { lease_reference(&lease->n_uid, head, MDL); lease_id_hash_delete(lease_uid_hash, lease->uid, lease->uid_len, MDL); lease_id_hash_add(lease_uid_hash, lease->uid, lease->uid_len, lease, MDL); } else /* (prev != NULL) */ { if(prev->n_uid != NULL) { lease_reference(&lease->n_uid, prev->n_uid, MDL); lease_dereference(&prev->n_uid, MDL); } lease_reference(&prev->n_uid, lease, MDL); lease_dereference(&prev, MDL); } if (cand != NULL) lease_dereference(&cand, MDL); lease_dereference(&head, MDL); } } /* Delete the specified lease from the uid hash. */ void uid_hash_delete (lease) struct lease *lease; { struct lease *head = (struct lease *)0; struct lease *scan; /* If it's not in the hash, we have no work to do. */ if (!find_lease_by_uid (&head, lease -> uid, lease -> uid_len, MDL)) { if (lease -> n_uid) lease_dereference (&lease -> n_uid, MDL); return; } /* If the lease we're freeing is at the head of the list, remove the hash table entry and add a new one with the next lease on the list (if there is one). */ if (head == lease) { lease_id_hash_delete(lease_uid_hash, lease->uid, lease->uid_len, MDL); if (lease -> n_uid) { lease_id_hash_add(lease_uid_hash, lease->n_uid->uid, lease->n_uid->uid_len, lease->n_uid, MDL); lease_dereference (&lease -> n_uid, MDL); } } else { /* Otherwise, look for the lease in the list of leases attached to the hash table entry, and remove it if we find it. */ for (scan = head; scan -> n_uid; scan = scan -> n_uid) { if (scan -> n_uid == lease) { lease_dereference (&scan -> n_uid, MDL); if (lease -> n_uid) { lease_reference (&scan -> n_uid, lease -> n_uid, MDL); lease_dereference (&lease -> n_uid, MDL); } break; } } } lease_dereference (&head, MDL); } /* Add the specified lease to the hardware address hash. */ /* We don't add leases with infiniband addresses to the * hash as there isn't any address to hash on. */ void hw_hash_add(struct lease *lease) { struct lease *head = NULL; struct lease *cand = NULL; struct lease *prev = NULL; struct lease *next = NULL; /* * If it's an infiniband address don't bother * as we don't have a useful address to hash. */ if ((lease->hardware_addr.hlen == 1) && (lease->hardware_addr.hbuf[0] == HTYPE_INFINIBAND)) return; /* If it's not in the hash, just add it. */ if (!find_lease_by_hw_addr (&head, lease -> hardware_addr.hbuf, lease -> hardware_addr.hlen, MDL)) lease_id_hash_add(lease_hw_addr_hash, lease->hardware_addr.hbuf, lease->hardware_addr.hlen, lease, MDL); else { /* Otherwise, insert it into the list in order of its * preference for "resuming allocation to the client." * * Because we don't have control of the hash bucket index * directly, we have to remove and re-insert the client * id into the hash if we're inserting onto the head. */ lease_reference(&cand, head, MDL); while (cand != NULL) { if (client_lease_preferred(cand, lease)) break; if (prev != NULL) lease_dereference(&prev, MDL); lease_reference(&prev, cand, MDL); if (cand->n_hw != NULL) lease_reference(&next, cand->n_hw, MDL); lease_dereference(&cand, MDL); if (next != NULL) { lease_reference(&cand, next, MDL); lease_dereference(&next, MDL); } } /* If we want to insert 'before cand', and prev is NULL, * then it was the head of the list. Assume that position. */ if (prev == NULL) { lease_reference(&lease->n_hw, head, MDL); lease_id_hash_delete(lease_hw_addr_hash, lease->hardware_addr.hbuf, lease->hardware_addr.hlen, MDL); lease_id_hash_add(lease_hw_addr_hash, lease->hardware_addr.hbuf, lease->hardware_addr.hlen, lease, MDL); } else /* (prev != NULL) */ { if(prev->n_hw != NULL) { lease_reference(&lease->n_hw, prev->n_hw, MDL); lease_dereference(&prev->n_hw, MDL); } lease_reference(&prev->n_hw, lease, MDL); lease_dereference(&prev, MDL); } if (cand != NULL) lease_dereference(&cand, MDL); lease_dereference(&head, MDL); } } /* Delete the specified lease from the hardware address hash. */ void hw_hash_delete (lease) struct lease *lease; { struct lease *head = (struct lease *)0; struct lease *next = (struct lease *)0; /* * If it's an infiniband address don't bother * as we don't have a useful address to hash. */ if ((lease->hardware_addr.hlen == 1) && (lease->hardware_addr.hbuf[0] == HTYPE_INFINIBAND)) return; /* If it's not in the hash, we have no work to do. */ if (!find_lease_by_hw_addr (&head, lease -> hardware_addr.hbuf, lease -> hardware_addr.hlen, MDL)) { if (lease -> n_hw) lease_dereference (&lease -> n_hw, MDL); return; } /* If the lease we're freeing is at the head of the list, remove the hash table entry and add a new one with the next lease on the list (if there is one). */ if (head == lease) { lease_id_hash_delete(lease_hw_addr_hash, lease->hardware_addr.hbuf, lease->hardware_addr.hlen, MDL); if (lease->n_hw) { lease_id_hash_add(lease_hw_addr_hash, lease->n_hw->hardware_addr.hbuf, lease->n_hw->hardware_addr.hlen, lease->n_hw, MDL); lease_dereference(&lease->n_hw, MDL); } } else { /* Otherwise, look for the lease in the list of leases attached to the hash table entry, and remove it if we find it. */ while (head -> n_hw) { if (head -> n_hw == lease) { lease_dereference (&head -> n_hw, MDL); if (lease -> n_hw) { lease_reference (&head -> n_hw, lease -> n_hw, MDL); lease_dereference (&lease -> n_hw, MDL); } break; } lease_reference (&next, head -> n_hw, MDL); lease_dereference (&head, MDL); lease_reference (&head, next, MDL); lease_dereference (&next, MDL); } } if (head) lease_dereference (&head, MDL); } /* Write v4 leases to permanent storage. */ int write_leases4(void) { struct lease *l; struct shared_network *s; struct pool *p; struct lease **lptr[RESERVED_LEASES+1]; int num_written = 0, i; /* Write all the leases. */ for (s = shared_networks; s; s = s->next) { for (p = s->pools; p; p = p->next) { lptr[FREE_LEASES] = &p->free; lptr[ACTIVE_LEASES] = &p->active; lptr[EXPIRED_LEASES] = &p->expired; lptr[ABANDONED_LEASES] = &p->abandoned; lptr[BACKUP_LEASES] = &p->backup; lptr[RESERVED_LEASES] = &p->reserved; for (i = FREE_LEASES; i <= RESERVED_LEASES; i++) { for (l = *(lptr[i]); l; l = l->next) { #if !defined (DEBUG_DUMP_ALL_LEASES) if (l->hardware_addr.hlen != 0 || l->uid_len != 0 || l->tsfp != 0 || l->binding_state != FTS_FREE) #endif { if (write_lease(l) == 0) return (0); num_written++; } } } } } log_info ("Wrote %d leases to leases file.", num_written); return (1); } /* Write all interesting leases to permanent storage. */ int write_leases () { struct host_decl *hp; struct group_object *gp; struct hash_bucket *hb; struct class *cp; struct collection *colp; int i; int num_written; /* write all the dynamically-created class declarations. */ if (collections->classes) { numclasseswritten = 0; for (colp = collections ; colp ; colp = colp->next) { for (cp = colp->classes ; cp ; cp = cp->nic) { write_named_billing_class( (unsigned char *)cp->name, 0, cp); } } /* XXXJAB this number doesn't include subclasses... */ log_info ("Wrote %d class decls to leases file.", numclasseswritten); } /* Write all the dynamically-created group declarations. */ if (group_name_hash) { num_written = 0; for (i = 0; i < group_name_hash -> hash_count; i++) { for (hb = group_name_hash -> buckets [i]; hb; hb = hb -> next) { gp = (struct group_object *)hb -> value; if ((gp -> flags & GROUP_OBJECT_DYNAMIC) || ((gp -> flags & GROUP_OBJECT_STATIC) && (gp -> flags & GROUP_OBJECT_DELETED))) { if (!write_group (gp)) return 0; ++num_written; } } } log_info ("Wrote %d group decls to leases file.", num_written); } /* Write all the deleted host declarations. */ if (host_name_hash) { num_written = 0; for (i = 0; i < host_name_hash -> hash_count; i++) { for (hb = host_name_hash -> buckets [i]; hb; hb = hb -> next) { hp = (struct host_decl *)hb -> value; if (((hp -> flags & HOST_DECL_STATIC) && (hp -> flags & HOST_DECL_DELETED))) { if (!write_host (hp)) return 0; ++num_written; } } } log_info ("Wrote %d deleted host decls to leases file.", num_written); } /* Write all the new, dynamic host declarations. */ if (host_name_hash) { num_written = 0; for (i = 0; i < host_name_hash -> hash_count; i++) { for (hb = host_name_hash -> buckets [i]; hb; hb = hb -> next) { hp = (struct host_decl *)hb -> value; if ((hp -> flags & HOST_DECL_DYNAMIC)) { if (!write_host (hp)) ++num_written; } } } log_info ("Wrote %d new dynamic host decls to leases file.", num_written); } #if defined (FAILOVER_PROTOCOL) /* Write all the failover states. */ if (!dhcp_failover_write_all_states ()) return 0; #endif switch (local_family) { case AF_INET: if (write_leases4() == 0) return (0); break; #ifdef DHCPv6 case AF_INET6: if (write_leases6() == 0) return (0); break; #endif /* DHCPv6 */ } if (commit_leases() == 0) return (0); return (1); } /* In addition to placing this lease upon a lease queue depending on its * state, it also keeps track of the number of FREE and BACKUP leases in * existence, and sets the sort_time on the lease. * * Sort_time is used in pool_timer() to determine when the lease will * bubble to the top of the list and be supersede_lease()'d into its next * state (possibly, if all goes well). Example, ACTIVE leases move to * EXPIRED state when the 'ends' value is reached, so that is its sort * time. Most queues are sorted by 'ends', since it is generally best * practice to re-use the oldest lease, to reduce address collision * chances. */ int lease_enqueue (struct lease *comp) { struct lease **lq, *prev, *lp; static struct lease **last_lq = NULL; static struct lease *last_insert_point = NULL; /* No queue to put it on? */ if (!comp -> pool) return 0; /* Figure out which queue it's going to. */ switch (comp -> binding_state) { case FTS_FREE: if (comp->flags & RESERVED_LEASE) { lq = &comp->pool->reserved; } else { lq = &comp->pool->free; comp->pool->free_leases++; } comp -> sort_time = comp -> ends; break; case FTS_ACTIVE: lq = &comp -> pool -> active; comp -> sort_time = comp -> ends; break; case FTS_EXPIRED: case FTS_RELEASED: case FTS_RESET: lq = &comp -> pool -> expired; #if defined(FAILOVER_PROTOCOL) /* In partner_down, tsfp is the time at which the lease * may be reallocated (stos+mclt). We can do that with * lease_mine_to_reallocate() anywhere between tsfp and * ends. But we prefer to wait until ends before doing it * automatically (choose the greater of the two). Note * that 'ends' is usually a historic timestamp in the * case of expired leases, is really only in the future * on released leases, and if we know a lease to be released * the peer might still know it to be active...in which case * it's possible the peer has renewed this lease, so avoid * doing that. */ if (comp->pool->failover_peer && comp->pool->failover_peer->me.state == partner_down) comp->sort_time = (comp->tsfp > comp->ends) ? comp->tsfp : comp->ends; else #endif comp->sort_time = comp->ends; break; case FTS_ABANDONED: lq = &comp -> pool -> abandoned; comp -> sort_time = comp -> ends; break; case FTS_BACKUP: if (comp->flags & RESERVED_LEASE) { lq = &comp->pool->reserved; } else { lq = &comp->pool->backup; comp->pool->backup_leases++; } comp -> sort_time = comp -> ends; break; default: log_error ("Lease with bogus binding state: %d", comp -> binding_state); #if defined (BINDING_STATE_DEBUG) abort (); #endif return 0; } /* This only works during server startup: during runtime, the last * lease may be dequeued in between calls. If the queue is the same * as was used previously, and the lease structure isn't (this is not * a re-queue), use that as a starting point for the insertion-sort. */ if ((server_starting & SS_QFOLLOW) && (lq == last_lq) && (comp != last_insert_point) && (last_insert_point->sort_time <= comp->sort_time)) { prev = last_insert_point; lp = prev->next; } else { prev = NULL; lp = *lq; } /* Insertion sort the lease onto the appropriate queue. */ for (; lp ; lp = lp->next) { if (lp -> sort_time >= comp -> sort_time) break; prev = lp; } if (prev) { if (prev -> next) { lease_reference (&comp -> next, prev -> next, MDL); lease_dereference (&prev -> next, MDL); } lease_reference (&prev -> next, comp, MDL); } else { if (*lq) { lease_reference (&comp -> next, *lq, MDL); lease_dereference (lq, MDL); } lease_reference (lq, comp, MDL); } last_insert_point = comp; last_lq = lq; return 1; } /* For a given lease, sort it onto the right list in its pool and put it in each appropriate hash, understanding that it's already by definition in lease_ip_addr_hash. */ isc_result_t lease_instantiate(const void *key, unsigned len, void *object) { struct lease *lease = object; struct class *class; /* XXX If the lease doesn't have a pool at this point, it's an XXX orphan, which we *should* keep around until it expires, XXX but which right now we just forget. */ if (!lease -> pool) { lease_ip_hash_delete(lease_ip_addr_hash, lease->ip_addr.iabuf, lease->ip_addr.len, MDL); return ISC_R_SUCCESS; } /* Put the lease on the right queue. Failure to queue is probably * due to a bogus binding state. In such a case, we claim success, * so that later leases in a hash_foreach are processed, but we * return early as we really don't want hw address hash entries or * other cruft to surround such a bogus entry. */ if (!lease_enqueue(lease)) return ISC_R_SUCCESS; /* Record the lease in the uid hash if possible. */ if (lease -> uid) { uid_hash_add (lease); } /* Record it in the hardware address hash if possible. */ if (lease -> hardware_addr.hlen) { hw_hash_add (lease); } /* If the lease has a billing class, set up the billing. */ if (lease -> billing_class) { class = (struct class *)0; class_reference (&class, lease -> billing_class, MDL); class_dereference (&lease -> billing_class, MDL); /* If the lease is available for allocation, the billing is invalid, so we don't keep it. */ if (lease -> binding_state == FTS_ACTIVE || lease -> binding_state == FTS_EXPIRED || lease -> binding_state == FTS_RELEASED || lease -> binding_state == FTS_RESET) bill_class (lease, class); class_dereference (&class, MDL); } return ISC_R_SUCCESS; } /* Run expiry events on every pool. This is called on startup so that any expiry events that occurred after the server stopped and before it was restarted can be run. At the same time, if failover support is compiled in, we compute the balance of leases for the pool. */ void expire_all_pools () { struct shared_network *s; struct pool *p; int i; struct lease *l; struct lease **lptr[RESERVED_LEASES+1]; /* Indicate that we are in the startup phase */ server_starting = SS_NOSYNC | SS_QFOLLOW; /* First, go over the hash list and actually put all the leases on the appropriate lists. */ lease_ip_hash_foreach(lease_ip_addr_hash, lease_instantiate); /* Loop through each pool in each shared network and call the * expiry routine on the pool. It is no longer safe to follow * the queue insertion point, as expiration of a lease can move * it between queues (and this may be the lease that function * points at). */ server_starting &= ~SS_QFOLLOW; for (s = shared_networks; s; s = s -> next) { for (p = s -> pools; p; p = p -> next) { pool_timer (p); p -> lease_count = 0; p -> free_leases = 0; p -> backup_leases = 0; lptr [FREE_LEASES] = &p -> free; lptr [ACTIVE_LEASES] = &p -> active; lptr [EXPIRED_LEASES] = &p -> expired; lptr [ABANDONED_LEASES] = &p -> abandoned; lptr [BACKUP_LEASES] = &p -> backup; lptr [RESERVED_LEASES] = &p->reserved; for (i = FREE_LEASES; i <= RESERVED_LEASES; i++) { for (l = *(lptr [i]); l; l = l -> next) { p -> lease_count++; if (l -> ends <= cur_time) { if (l->binding_state == FTS_FREE) { if (i == FREE_LEASES) p->free_leases++; else if (i != RESERVED_LEASES) log_fatal("Impossible case " "at %s:%d.", MDL); } else if (l->binding_state == FTS_BACKUP) { if (i == BACKUP_LEASES) p->backup_leases++; else if (i != RESERVED_LEASES) log_fatal("Impossible case " "at %s:%d.", MDL); } } #if defined (FAILOVER_PROTOCOL) if (p -> failover_peer && l -> tstp > l -> atsfp && !(l -> flags & ON_UPDATE_QUEUE)) { l -> desired_binding_state = l -> binding_state; dhcp_failover_queue_update (l, 1); } #endif } } } } /* turn off startup phase */ server_starting = 0; } void dump_subnets () { struct lease *l; struct shared_network *s; struct subnet *n; struct pool *p; struct lease **lptr[RESERVED_LEASES+1]; int i; log_info ("Subnets:"); for (n = subnets; n; n = n -> next_subnet) { log_debug (" Subnet %s", piaddr (n -> net)); log_debug (" netmask %s", piaddr (n -> netmask)); } log_info ("Shared networks:"); for (s = shared_networks; s; s = s -> next) { log_info (" %s", s -> name); for (p = s -> pools; p; p = p -> next) { lptr [FREE_LEASES] = &p -> free; lptr [ACTIVE_LEASES] = &p -> active; lptr [EXPIRED_LEASES] = &p -> expired; lptr [ABANDONED_LEASES] = &p -> abandoned; lptr [BACKUP_LEASES] = &p -> backup; lptr [RESERVED_LEASES] = &p->reserved; for (i = FREE_LEASES; i <= RESERVED_LEASES; i++) { for (l = *(lptr [i]); l; l = l -> next) { print_lease (l); } } } } } HASH_FUNCTIONS(lease_ip, const unsigned char *, struct lease, lease_ip_hash_t, lease_reference, lease_dereference, do_ip4_hash) HASH_FUNCTIONS(lease_id, const unsigned char *, struct lease, lease_id_hash_t, lease_reference, lease_dereference, do_id_hash) HASH_FUNCTIONS (host, const unsigned char *, struct host_decl, host_hash_t, host_reference, host_dereference, do_string_hash) HASH_FUNCTIONS (class, const char *, struct class, class_hash_t, class_reference, class_dereference, do_string_hash) #if defined (DEBUG_MEMORY_LEAKAGE) && \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) extern struct hash_table *dns_zone_hash; extern struct interface_info **interface_vector; extern int interface_count; dhcp_control_object_t *dhcp_control_object; extern struct hash_table *auth_key_hash; struct hash_table *universe_hash; struct universe **universes; int universe_count, universe_max; #if 0 extern int end; #endif #if defined (COMPACT_LEASES) extern struct lease *lease_hunks; #endif void free_everything(void) { struct subnet *sc = (struct subnet *)0, *sn = (struct subnet *)0; struct shared_network *nc = (struct shared_network *)0, *nn = (struct shared_network *)0; struct pool *pc = (struct pool *)0, *pn = (struct pool *)0; struct lease *lc = (struct lease *)0, *ln = (struct lease *)0; struct interface_info *ic = (struct interface_info *)0, *in = (struct interface_info *)0; struct class *cc = (struct class *)0, *cn = (struct class *)0; struct collection *lp; int i; /* Get rid of all the hash tables. */ if (host_hw_addr_hash) host_free_hash_table (&host_hw_addr_hash, MDL); host_hw_addr_hash = 0; if (host_uid_hash) host_free_hash_table (&host_uid_hash, MDL); host_uid_hash = 0; if (lease_uid_hash) lease_id_free_hash_table (&lease_uid_hash, MDL); lease_uid_hash = 0; if (lease_ip_addr_hash) lease_ip_free_hash_table (&lease_ip_addr_hash, MDL); lease_ip_addr_hash = 0; if (lease_hw_addr_hash) lease_id_free_hash_table (&lease_hw_addr_hash, MDL); lease_hw_addr_hash = 0; if (host_name_hash) host_free_hash_table (&host_name_hash, MDL); host_name_hash = 0; if (dns_zone_hash) dns_zone_free_hash_table (&dns_zone_hash, MDL); dns_zone_hash = 0; while (host_id_info != NULL) { host_id_info_t *tmp; option_dereference(&host_id_info->option, MDL); host_free_hash_table(&host_id_info->values_hash, MDL); tmp = host_id_info->next; dfree(host_id_info, MDL); host_id_info = tmp; } #if 0 if (auth_key_hash) auth_key_free_hash_table (&auth_key_hash, MDL); #endif auth_key_hash = 0; omapi_object_dereference ((omapi_object_t **)&dhcp_control_object, MDL); for (lp = collections; lp; lp = lp -> next) { if (lp -> classes) { class_reference (&cn, lp -> classes, MDL); do { if (cn) { class_reference (&cc, cn, MDL); class_dereference (&cn, MDL); } if (cc -> nic) { class_reference (&cn, cc -> nic, MDL); class_dereference (&cc -> nic, MDL); } group_dereference (&cc -> group, MDL); if (cc -> hash) { class_free_hash_table (&cc -> hash, MDL); cc -> hash = (struct hash_table *)0; } class_dereference (&cc, MDL); } while (cn); class_dereference (&lp -> classes, MDL); } } if (interface_vector) { for (i = 0; i < interface_count; i++) { if (interface_vector [i]) interface_dereference (&interface_vector [i], MDL); } dfree (interface_vector, MDL); interface_vector = 0; } if (interfaces) { interface_reference (&in, interfaces, MDL); do { if (in) { interface_reference (&ic, in, MDL); interface_dereference (&in, MDL); } if (ic -> next) { interface_reference (&in, ic -> next, MDL); interface_dereference (&ic -> next, MDL); } omapi_unregister_io_object ((omapi_object_t *)ic); if (ic -> shared_network) { if (ic -> shared_network -> interface) interface_dereference (&ic -> shared_network -> interface, MDL); shared_network_dereference (&ic -> shared_network, MDL); } interface_dereference (&ic, MDL); } while (in); interface_dereference (&interfaces, MDL); } /* Subnets are complicated because of the extra links. */ if (subnets) { subnet_reference (&sn, subnets, MDL); do { if (sn) { subnet_reference (&sc, sn, MDL); subnet_dereference (&sn, MDL); } if (sc -> next_subnet) { subnet_reference (&sn, sc -> next_subnet, MDL); subnet_dereference (&sc -> next_subnet, MDL); } if (sc -> next_sibling) subnet_dereference (&sc -> next_sibling, MDL); if (sc -> shared_network) shared_network_dereference (&sc -> shared_network, MDL); group_dereference (&sc -> group, MDL); if (sc -> interface) interface_dereference (&sc -> interface, MDL); subnet_dereference (&sc, MDL); } while (sn); subnet_dereference (&subnets, MDL); } /* So are shared networks. */ /* XXX: this doesn't work presently, but i'm ok just filtering * it out of the noise (you get a bigger spike on the real leaks). * It would be good to fix this, but it is not a "real bug," so not * today. This hack is incomplete, it doesn't trim out sub-values. */ if (shared_networks) { shared_network_dereference (&shared_networks, MDL); /* This is the old method (tries to free memory twice, broken) */ } else if (0) { shared_network_reference (&nn, shared_networks, MDL); do { if (nn) { shared_network_reference (&nc, nn, MDL); shared_network_dereference (&nn, MDL); } if (nc -> next) { shared_network_reference (&nn, nc -> next, MDL); shared_network_dereference (&nc -> next, MDL); } /* As are pools. */ if (nc -> pools) { pool_reference (&pn, nc -> pools, MDL); do { struct lease **lptr[RESERVED_LEASES+1]; if (pn) { pool_reference (&pc, pn, MDL); pool_dereference (&pn, MDL); } if (pc -> next) { pool_reference (&pn, pc -> next, MDL); pool_dereference (&pc -> next, MDL); } lptr [FREE_LEASES] = &pc -> free; lptr [ACTIVE_LEASES] = &pc -> active; lptr [EXPIRED_LEASES] = &pc -> expired; lptr [ABANDONED_LEASES] = &pc -> abandoned; lptr [BACKUP_LEASES] = &pc -> backup; lptr [RESERVED_LEASES] = &pc->reserved; /* As (sigh) are leases. */ for (i = FREE_LEASES ; i <= RESERVED_LEASES ; i++) { if (*lptr [i]) { lease_reference (&ln, *lptr [i], MDL); do { if (ln) { lease_reference (&lc, ln, MDL); lease_dereference (&ln, MDL); } if (lc -> next) { lease_reference (&ln, lc -> next, MDL); lease_dereference (&lc -> next, MDL); } if (lc -> billing_class) class_dereference (&lc -> billing_class, MDL); if (lc -> state) free_lease_state (lc -> state, MDL); lc -> state = (struct lease_state *)0; if (lc -> n_hw) lease_dereference (&lc -> n_hw, MDL); if (lc -> n_uid) lease_dereference (&lc -> n_uid, MDL); lease_dereference (&lc, MDL); } while (ln); lease_dereference (lptr [i], MDL); } } if (pc -> group) group_dereference (&pc -> group, MDL); if (pc -> shared_network) shared_network_dereference (&pc -> shared_network, MDL); pool_dereference (&pc, MDL); } while (pn); pool_dereference (&nc -> pools, MDL); } /* Because of a circular reference, we need to nuke this manually. */ group_dereference (&nc -> group, MDL); shared_network_dereference (&nc, MDL); } while (nn); shared_network_dereference (&shared_networks, MDL); } cancel_all_timeouts (); relinquish_timeouts (); relinquish_ackqueue(); trace_free_all (); group_dereference (&root_group, MDL); executable_statement_dereference (&default_classification_rules, MDL); shutdown_state = shutdown_drop_omapi_connections; omapi_io_state_foreach (dhcp_io_shutdown, 0); shutdown_state = shutdown_listeners; omapi_io_state_foreach (dhcp_io_shutdown, 0); shutdown_state = shutdown_dhcp; omapi_io_state_foreach (dhcp_io_shutdown, 0); omapi_object_dereference ((omapi_object_t **)&icmp_state, MDL); universe_free_hash_table (&universe_hash, MDL); for (i = 0; i < universe_count; i++) { #if 0 union { const char *c; char *s; } foo; #endif if (universes [i]) { if (universes[i]->name_hash) option_name_free_hash_table( &universes[i]->name_hash, MDL); if (universes[i]->code_hash) option_code_free_hash_table( &universes[i]->code_hash, MDL); #if 0 if (universes [i] -> name > (char *)&end) { foo.c = universes [i] -> name; dfree (foo.s, MDL); } if (universes [i] > (struct universe *)&end) dfree (universes [i], MDL); #endif } } dfree (universes, MDL); relinquish_free_lease_states (); relinquish_free_pairs (); relinquish_free_expressions (); relinquish_free_binding_values (); relinquish_free_option_caches (); relinquish_free_packets (); #if defined(COMPACT_LEASES) relinquish_lease_hunks (); #endif relinquish_hash_bucket_hunks (); omapi_type_relinquish (); } #endif /* DEBUG_MEMORY_LEAKAGE_ON_EXIT */
jpereira/isc-dhp-relay
dhcp-4.3.1/server/mdb.c
C
lgpl-3.0
89,320
from django.db import models class Channel(models.Model): channel_id = models.CharField(max_length=50, unique=True) channel_name = models.CharField(max_length=50, null=True, blank=True) rtmp_url = models.CharField(max_length=100, null=True, blank=True) active = models.IntegerField(null=True, blank=True) start = models.IntegerField(null=True, blank=True) PID = models.IntegerField(null=True, blank=True) PGID = models.IntegerField(null=True, blank=True) client_ip = models.CharField(max_length=50, null=True, blank=True) sort = models.IntegerField(null=False, blank=True, default=0) class Meta: managed = False db_table = 'channel' verbose_name = '频道' verbose_name_plural = '频道管理' def __str__(self): return self.channel_name + '(' + self.channel_id + ')' class Program(models.Model): channel = models.ForeignKey(Channel, to_field='channel_id', null=True) start_time = models.DateTimeField(auto_now_add=False, null=True, blank=True) end_time = models.DateTimeField(auto_now_add=False, null=True, blank=True) url = models.CharField(max_length=50, null=True, blank=True) title = models.CharField(max_length=50, null=True, blank=True) finished = models.IntegerField(null=True, blank=True, default=0) event_id = models.IntegerField(null=True, blank=True) class Meta: managed = False db_table = 'program' verbose_name = '节目' verbose_name_plural = '节目管理' def __str__(self): return str(self.channel) + ':' + self.title
xahhy/Django-vod
epg/models.py
Python
lgpl-3.0
1,604
/* * Low level reading functions * * Copyright (c) 2006-2009, Joachim Metz <forensics@hoffmannbv.nl>, * Hoffmann Investigations. * * Refer to AUTHORS for acknowledgements. * * This software is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * 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 Lesser General Public License * along with this software. If not, see <http://www.gnu.org/licenses/>. */ #include <common.h> #include <byte_stream.h> #include <types.h> #include <liberror.h> #include <libnotify.h> #include "libewf_definitions.h" #include "libewf_compression.h" #include "libewf_chunk_cache.h" #include "libewf_libbfio.h" #include "libewf_media_values.h" #include "libewf_offset_table.h" #include "libewf_read_io_handle.h" #include "libewf_sector_table.h" #include "libewf_segment_file_handle.h" #include "ewf_crc.h" #include "ewf_file_header.h" /* Initialize the read io handle * Returns 1 if successful or -1 on error */ int libewf_read_io_handle_initialize( libewf_read_io_handle_t **read_io_handle, liberror_error_t **error ) { static char *function = "libewf_read_io_handle_initialize"; if( read_io_handle == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid read io handle.", function ); return( -1 ); } if( *read_io_handle == NULL ) { *read_io_handle = (libewf_read_io_handle_t *) memory_allocate( sizeof( libewf_read_io_handle_t ) ); if( *read_io_handle == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_MEMORY, LIBERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create read io handle.", function ); return( -1 ); } if( memory_set( *read_io_handle, 0, sizeof( libewf_read_io_handle_t ) ) == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_MEMORY, LIBERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear read io handle.", function ); memory_free( *read_io_handle ); *read_io_handle = NULL; return( -1 ); } if( libewf_sector_table_initialize( &( ( *read_io_handle )->crc_errors ), 0, error ) != 1 ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_RUNTIME, LIBERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create crc errors.", function ); memory_free( *read_io_handle ); *read_io_handle = NULL; return( -1 ); } ( *read_io_handle )->wipe_on_error = 1; } return( 1 ); } /* Frees the read io handle including elements * Returns 1 if successful or -1 on error */ int libewf_read_io_handle_free( libewf_read_io_handle_t **read_io_handle, liberror_error_t **error ) { static char *function = "libewf_read_io_handle_free"; int result = 1; if( read_io_handle == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid read io handle.", function ); return( 1 ); } if( *read_io_handle != NULL ) { if( libewf_sector_table_free( &( ( *read_io_handle )->crc_errors ), error ) != 1 ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_RUNTIME, LIBERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free crc errors.", function ); result = -1; } memory_free( *read_io_handle ); *read_io_handle = NULL; } return( result ); } /* Processes the chunk data, applies decompression if necessary and validates the CRC * Sets the crc_mismatch value to 1 if the chunk CRC did not match the calculated CRC * Returns the amount of bytes of the processed chunk data or -1 on error */ ssize_t libewf_read_io_handle_process_chunk( uint8_t *chunk_buffer, size_t chunk_buffer_size, uint8_t *uncompressed_buffer, size_t *uncompressed_buffer_size, int8_t is_compressed, ewf_crc_t chunk_crc, int8_t read_crc, uint8_t *crc_mismatch, liberror_error_t **error ) { uint8_t *crc_buffer = NULL; static char *function = "libewf_read_io_handle_process_chunk"; ewf_crc_t calculated_crc = 0; if( chunk_buffer == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid chunk buffer.", function ); return( -1 ); } if( chunk_buffer_size > (size_t) SSIZE_MAX ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid chunk buffer size value exceeds maximum.", function ); return( -1 ); } if( crc_mismatch == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid CRC mismatch.", function ); return( -1 ); } *crc_mismatch = 0; /* Do not bother with an empry chunk */ if( chunk_buffer_size == 0 ) { return( 0 ); } if( is_compressed == 0 ) { if( read_crc == 0 ) { chunk_buffer_size -= sizeof( ewf_crc_t ); crc_buffer = &( chunk_buffer[ chunk_buffer_size ] ); byte_stream_copy_to_uint32_little_endian( crc_buffer, chunk_crc ); } calculated_crc = ewf_crc_calculate( chunk_buffer, chunk_buffer_size, 1 ); if( chunk_crc != calculated_crc ) { #if defined( HAVE_VERBOSE_OUTPUT ) libnotify_verbose_printf( "%s: CRC does not match (in file: %" PRIu32 " calculated: %" PRIu32 ").\n", function, chunk_crc, calculated_crc ); #endif *crc_mismatch = 1; } *uncompressed_buffer_size = chunk_buffer_size; } else { if( uncompressed_buffer == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid uncompressed buffer.", function ); return( -1 ); } if( chunk_buffer== uncompressed_buffer ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid uncompressed buffer is the same as chunk buffer.", function ); return( -1 ); } if( *uncompressed_buffer_size > (size_t) SSIZE_MAX ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid uncompressed buffer size value exceeds maximum.", function ); return( -1 ); } if( libewf_uncompress( uncompressed_buffer, uncompressed_buffer_size, chunk_buffer, chunk_buffer_size, error ) != 1 ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_COMPRESSION, LIBERROR_COMPRESSION_ERROR_UNCOMPRESS_FAILED, "%s: unable to uncompressed buffer.", function ); return( -1 ); } } return( (ssize_t) *uncompressed_buffer_size ); } /* Reads a certain chunk of data into the chunk buffer * Will read until the requested size is filled or the entire chunk is read * read_crc is set if the crc has been read into crc_buffer * read_crc is used for uncompressed chunks only * chunk_crc is set to a runtime version of the value in the crc_buffer * Returns the amount of bytes read, 0 if no bytes can be read or -1 on error */ ssize_t libewf_read_io_handle_read_chunk( libewf_io_handle_t *io_handle, libewf_offset_table_t *offset_table, uint32_t chunk, uint8_t *chunk_buffer, size_t chunk_buffer_size, int8_t *is_compressed, uint8_t *crc_buffer, ewf_crc_t *chunk_crc, int8_t *read_crc, liberror_error_t **error ) { libewf_segment_file_handle_t *segment_file_handle = NULL; #if defined( HAVE_VERBOSE_OUTPUT ) char *chunk_type = NULL; #endif static char *function = "libewf_read_io_handle_read_chunk"; ssize_t read_count = 0; ssize_t total_read_count = 0; size_t chunk_size = 0; if( io_handle == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid io handle.", function ); return( -1 ); } if( offset_table == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid offset table.", function ); return( -1 ); } if( offset_table->chunk_offset == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_RUNTIME, LIBERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid offset table - missing chunk offsets.", function ); return( -1 ); } if( chunk_buffer == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid chunk buffer.", function ); return( -1 ); } if( chunk_buffer_size == 0 ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, "%s: invalid chunk buffer size value is zero.", function ); return( -1 ); } if( chunk_buffer_size > (size_t) SSIZE_MAX ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid chunk buffer size value exceeds maximum.", function ); return( -1 ); } if( is_compressed == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid is compressed.", function ); return( -1 ); } if( chunk_crc == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid chunk crc.", function ); return( -1 ); } if( read_crc == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid read crc.", function ); return( -1 ); } /* Check if the chunk is available */ if( chunk >= offset_table->amount_of_chunk_offsets ) { return( 0 ); } *chunk_crc = 0; *read_crc = 0; *is_compressed = 0; /* Determine the size of the chunk including the CRC */ chunk_size = offset_table->chunk_offset[ chunk ].size; /* Determine if the chunk is compressed or not */ if( ( offset_table->chunk_offset[ chunk ].flags & LIBEWF_CHUNK_OFFSET_FLAGS_COMPRESSED ) == LIBEWF_CHUNK_OFFSET_FLAGS_COMPRESSED ) { *is_compressed = 1; } else if( chunk_buffer_size < chunk_size ) { chunk_size -= sizeof( ewf_crc_t ); *read_crc = 1; } segment_file_handle = offset_table->chunk_offset[ chunk ].segment_file_handle; if( segment_file_handle == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid segment file.", function ); return( -1 ); } /* Make sure the segment file offset is in the right place */ if( libbfio_pool_seek_offset( io_handle->file_io_pool, segment_file_handle->file_io_pool_entry, offset_table->chunk_offset[ chunk ].file_offset, SEEK_SET, error ) <= -1 ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_IO, LIBERROR_IO_ERROR_SEEK_FAILED, "%s: unable to seek chunk in segment file.", function ); return( -1 ); } #if defined( HAVE_VERBOSE_OUTPUT ) if( ( offset_table->chunk_offset[ chunk ].flags & LIBEWF_CHUNK_OFFSET_FLAGS_DELTA_CHUNK ) == LIBEWF_CHUNK_OFFSET_FLAGS_DELTA_CHUNK ) { chunk_type = "uncompressed delta"; } else if( *is_compressed == 0 ) { chunk_type = "uncompressed"; } else { chunk_type = "compressed"; } libnotify_verbose_printf( "%s: reading %s chunk %" PRIu32 " of %" PRIu32 " at offset: %" PRIu64 " with size: %" PRIzd ".\n", function, chunk_type, chunk, offset_table->amount_of_chunk_offsets, offset_table->chunk_offset[ chunk ].file_offset, offset_table->chunk_offset[ chunk ].size ); #endif /* Check if the chunk and crc buffers are aligned * if so read the chunk and crc at the same time */ if( ( *is_compressed == 0 ) && ( *read_crc != 0 ) && ( &( chunk_buffer[ chunk_size ] ) == crc_buffer ) ) { chunk_size += sizeof( ewf_crc_t ); } /* Read the chunk data */ read_count = libbfio_pool_read( io_handle->file_io_pool, segment_file_handle->file_io_pool_entry, chunk_buffer, chunk_size, error ); if( read_count != (ssize_t) chunk_size ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_IO, LIBERROR_IO_ERROR_READ_FAILED, "%s: unable to read chunk in segment file.", function ); return( -1 ); } total_read_count += read_count; /* Determine if the CRC should be read seperately */ if( *read_crc != 0 ) { /* Check if the chunk and crc buffers are aligned * if not the chunk and crc need to be read separately */ if( &( chunk_buffer[ chunk_size ] ) != crc_buffer ) { if( crc_buffer == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid crc buffer.", function ); return( -1 ); } read_count = libbfio_pool_read( io_handle->file_io_pool, segment_file_handle->file_io_pool_entry, crc_buffer, sizeof( ewf_crc_t ), error ); if( read_count != (ssize_t) sizeof( ewf_crc_t ) ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_IO, LIBERROR_IO_ERROR_READ_FAILED, "%s: error reading CRC of chunk: %" PRIu32 " from segment file.", function, chunk ); return( -1 ); } total_read_count += read_count; } byte_stream_copy_to_uint32_little_endian( crc_buffer, *chunk_crc ); } return( total_read_count ); } /* Reads a certain chunk of data from the segment file(s) * Will read until the requested size is filled or the entire chunk is read * Returns the amount of bytes read, 0 if no bytes can be read or -1 on error */ ssize_t libewf_read_io_handle_read_chunk_data( libewf_read_io_handle_t *read_io_handle, libewf_io_handle_t *io_handle, libewf_media_values_t *media_values, libewf_offset_table_t *offset_table, libewf_chunk_cache_t *chunk_cache, uint32_t chunk, uint32_t chunk_offset, uint8_t *buffer, size_t size, liberror_error_t **error ) { uint8_t stored_crc_buffer[ 4 ]; uint8_t *chunk_buffer = NULL; uint8_t *chunk_read_buffer = NULL; uint8_t *crc_read_buffer = NULL; static char *function = "libewf_read_io_handle_read_chunk_data"; ewf_crc_t chunk_crc = 0; size_t chunk_data_size = 0; size_t chunk_size = 0; size_t bytes_available = 0; ssize_t read_count = 0; int64_t sector = 0; uint32_t amount_of_sectors = 0; int chunk_cache_data_used = 0; uint8_t crc_mismatch = 0; int8_t is_compressed = 0; int8_t read_crc = 0; if( read_io_handle == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid read io handle.", function ); return( -1 ); } if( media_values == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid media values.", function ); return( -1 ); } if( offset_table == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid offset table.", function ); return( -1 ); } if( offset_table->chunk_offset == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_RUNTIME, LIBERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid offset table - missing chunk offsets.", function ); return( -1 ); } if( chunk_cache == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid chunk cache.", function ); return( -1 ); } if( buffer == NULL ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid buffer.", function ); return( -1 ); } if( buffer == chunk_cache->compressed ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_ARGUMENTS, LIBERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid buffer - same as chunk cache compressed.", function ); return( -1 ); } /* Check if the chunk is not cached */ if( ( chunk_cache->chunk != chunk ) || ( chunk_cache->cached == 0 ) ) { /* Determine the size of the chunk including the CRC */ chunk_size = offset_table->chunk_offset[ chunk ].size; /* Make sure the chunk cache is large enough */ chunk_cache_data_used = (int) ( buffer == chunk_cache->data ); if( chunk_size > chunk_cache->allocated_size ) { #if defined( HAVE_VERBOSE_OUTPUT ) libnotify_verbose_printf( "%s: reallocating chunk size: %" PRIzu ".\n", function, chunk_size ); #endif if( libewf_chunk_cache_resize( chunk_cache, chunk_size, error ) != 1 ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_RUNTIME, LIBERROR_RUNTIME_ERROR_RESIZE_FAILED, "%s: unable to resize chunk cache.", function ); return( -1 ); } /* Adjust chunk data buffer if necessary */ if( ( chunk_cache_data_used == 1 ) && ( buffer != chunk_cache->data ) ) { buffer = chunk_cache->data; } } if( ( offset_table->chunk_offset[ chunk ].flags & LIBEWF_CHUNK_OFFSET_FLAGS_COMPRESSED ) == 0 ) { is_compressed = 0; } else { is_compressed = 1; } chunk_buffer = chunk_cache->data; /* Directly read to the buffer if * the buffer isn't the chunk cache * and no data was previously copied into the chunk cache * and the buffer contains the necessary amount of bytes to fill a chunk * and the buffer is not compressed */ if( ( buffer != chunk_cache->data ) && ( chunk_offset == 0 ) && ( size >= (size_t) media_values->chunk_size ) && ( is_compressed == 0 ) ) { chunk_buffer = buffer; /* The CRC is read seperately for uncompressed chunks */ chunk_size -= sizeof( ewf_crc_t ); } /* Determine if the chunk data should be directly read into chunk data buffer * or to use the intermediate storage for a compressed chunk */ if( is_compressed == 1 ) { chunk_read_buffer = chunk_cache->compressed; } else { chunk_read_buffer = chunk_buffer; } /* Use chunk and crc buffer alignment when the chunk cache data is directly being passed */ if( chunk_read_buffer == chunk_cache->data ) { crc_read_buffer = &( chunk_read_buffer[ media_values->chunk_size ] ); } else { crc_read_buffer = stored_crc_buffer; } /* Read the chunk */ read_count = libewf_read_io_handle_read_chunk( io_handle, offset_table, chunk, chunk_read_buffer, chunk_size, &is_compressed, crc_read_buffer, &chunk_crc, &read_crc, error ); if( read_count <= -1 ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_IO, LIBERROR_IO_ERROR_READ_FAILED, "%s: unable to read chunk.", function ); return( -1 ); } if( is_compressed != 0 ) { chunk_data_size = media_values->chunk_size + sizeof( ewf_crc_t ); } else { chunk_data_size = chunk_size; } if( libewf_read_io_handle_process_chunk( chunk_read_buffer, chunk_size, chunk_buffer, &chunk_data_size, is_compressed, chunk_crc, read_crc, &crc_mismatch, error ) == -1 ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_MEMORY, LIBERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to process chunk data.", function ); return( -1 ); } if( crc_mismatch != 0 ) { /* Wipe the chunk if nescessary */ if( ( read_io_handle->wipe_on_error != 0 ) && ( memory_set( chunk_read_buffer, 0, size ) == NULL ) ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_MEMORY, LIBERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to wipe chunk data.", function ); return( -1 ); } /* Add CRC error */ sector = (int64_t) chunk * (int64_t) media_values->sectors_per_chunk; amount_of_sectors = media_values->sectors_per_chunk; if( ( sector + amount_of_sectors ) > (int64_t) media_values->amount_of_sectors ) { amount_of_sectors = (uint32_t) ( (int64_t) media_values->amount_of_sectors - sector ); } if( libewf_sector_table_add_sector( read_io_handle->crc_errors, sector, amount_of_sectors, 1, error ) != 1 ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_RUNTIME, LIBERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set CRC error.", function ); return( -1 ); } chunk_data_size = amount_of_sectors * media_values->bytes_per_sector; } /* Flag that the chunk was cached */ if( chunk_buffer == chunk_cache->data ) { chunk_cache->chunk = chunk; chunk_cache->amount = chunk_data_size; chunk_cache->offset = 0; chunk_cache->cached = 1; } } else { chunk_buffer = chunk_cache->data; chunk_data_size = chunk_cache->amount; } /* Determine the available amount of data within the cached chunk */ if( chunk_offset > chunk_data_size ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_RUNTIME, LIBERROR_RUNTIME_ERROR_VALUE_OUT_OF_RANGE, "%s: chunk offset exceeds amount of bytes available in chunk.", function ); return( -1 ); } bytes_available = chunk_data_size - chunk_offset; /* Correct the available amount of bytes is larger than the requested amount of bytes */ if( bytes_available > size ) { bytes_available = size; } if( bytes_available > (size_t) INT32_MAX ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_RUNTIME, LIBERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid available amount of bytes value exceeds maximum.", function ); return( -1 ); } /* If the data was read into the chunk cache copy it to the buffer * and the buffer is not the chunk cache itself */ if( ( chunk_buffer == chunk_cache->data ) && ( buffer != chunk_cache->data ) ) { /* Copy the relevant data to buffer */ if( ( bytes_available > 0 ) && ( memory_copy( buffer, &( chunk_buffer[ chunk_offset ] ), bytes_available ) == NULL ) ) { liberror_error_set( error, LIBERROR_ERROR_DOMAIN_MEMORY, LIBERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to set chunk data in buffer.", function ); return( -1 ); } } return( (ssize_t) bytes_available ); }
jonstewart/libewf
libewf/libewf_read_io_handle.c
C
lgpl-3.0
23,584
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_DELETEROOMRESPONSE_P_H #define QTAWS_DELETEROOMRESPONSE_P_H #include "alexaforbusinessresponse_p.h" namespace QtAws { namespace AlexaForBusiness { class DeleteRoomResponse; class DeleteRoomResponsePrivate : public AlexaForBusinessResponsePrivate { public: explicit DeleteRoomResponsePrivate(DeleteRoomResponse * const q); void parseDeleteRoomResponse(QXmlStreamReader &xml); private: Q_DECLARE_PUBLIC(DeleteRoomResponse) Q_DISABLE_COPY(DeleteRoomResponsePrivate) }; } // namespace AlexaForBusiness } // namespace QtAws #endif
pcolby/libqtaws
src/alexaforbusiness/deleteroomresponse_p.h
C
lgpl-3.0
1,299
package com.bsgcoach.reports.fir; import javax.annotation.concurrent.NotThreadSafe; import de.invesdwin.util.bean.AValueObject; import de.invesdwin.util.math.decimal.Decimal; @NotThreadSafe public class IncomeStatement extends AValueObject { // Net Revenues private Decimal netRevenues; // Cost of Pairs private Decimal costOfPairs; // Warehouse private Decimal warehouse; // Marketing private Decimal marketing; // Administrative private Decimal administrative; // Operating Profit private Decimal operatingProfit; // Interest Expense private Decimal interestExpense; // Income Taxes private Decimal incomeTaxes; // Net Profit private Decimal netProfit; // Dividends private Decimal dividends; // Stock Shares private Decimal stockShares; public Decimal getNetRevenues() { return netRevenues; } public void setNetRevenues(final Decimal netRevenues) { this.netRevenues = netRevenues; } public Decimal getCostOfPairs() { return costOfPairs; } public void setCostOfPairs(final Decimal costOfPairs) { this.costOfPairs = costOfPairs; } public Decimal getWarehouse() { return warehouse; } public void setWarehouse(final Decimal warehouse) { this.warehouse = warehouse; } public Decimal getMarketing() { return marketing; } public void setMarketing(final Decimal marketing) { this.marketing = marketing; } public Decimal getAdministrative() { return administrative; } public void setAdministrative(final Decimal administrative) { this.administrative = administrative; } public Decimal getOperatingProfit() { return operatingProfit; } public void setOperatingProfit(final Decimal operatingProfit) { this.operatingProfit = operatingProfit; } public Decimal getInterestExpense() { return interestExpense; } public void setInterestExpense(final Decimal interestExpense) { this.interestExpense = interestExpense; } public Decimal getIncomeTaxes() { return incomeTaxes; } public void setIncomeTaxes(final Decimal incomeTaxes) { this.incomeTaxes = incomeTaxes; } public Decimal getNetProfit() { return netProfit; } public void setNetProfit(final Decimal netProfit) { this.netProfit = netProfit; } public Decimal getDividends() { return dividends; } public void setDividends(final Decimal dividends) { this.dividends = dividends; } public Decimal getStockShares() { return stockShares; } public void setStockShares(final Decimal stockShares) { this.stockShares = stockShares; } }
subes/invesdwin-nowicket
invesdwin-nowicket-examples/invesdwin-nowicket-examples-mvp-bsgcoach/src/main/java/com/bsgcoach/reports/fir/IncomeStatement.java
Java
lgpl-3.0
2,866
/**************************************************** Statistics Online Computational Resource (SOCR) http://www.StatisticsResource.org All SOCR programs, materials, tools and resources are developed by and freely disseminated to the entire community. Users may revise, extend, redistribute, modify under the terms of the Lesser GNU General Public License as published by the Open Source Initiative http://opensource.org/licenses/. All efforts should be made to develop and distribute factually correct, useful, portable and extensible resource all available in all digital formats for free over the Internet. SOCR resources are distributed in the hope that they will be useful, but without any warranty; without any explicit, implicit or implied warranty for merchantability or fitness for a particular purpose. See the GNU Lesser General Public License for more details see http://opensource.org/licenses/lgpl-license.php. http://www.SOCR.ucla.edu http://wiki.stat.ucla.edu/socr It s Online, Therefore, It Exists! ****************************************************/ /* Module.java * * Module.java contains CurvedGaussian and Uniform classes for drawing * Gaussian and Line model fits of the EM algorithm * MixtureEMExperiment.java * */ package edu.ucla.stat.SOCR.util; import java.awt.Color; import java.awt.Graphics; import java.awt.Polygon; public class CurvedGaussian extends Module { double kmx, kmy, ksx, ksy, ksxy; final int mins = 5; boolean plotcircle = true; Polygon gaussian2ndPolygon = new Polygon(); public CurvedGaussian(int xSize, int ySize, double w) { super(xSize, ySize, w); } public void randomKernel(double w) { weight = w; kmx = xsiz * Math.random(); kmy = ysiz * Math.random(); ksx = xsiz / 4 + mins; ksy = ysiz / 4 + mins; ksxy = 0; } public void setplotline() { plotcircle = false; } public double[] getPar() { double pars[]; pars = new double[6]; pars[0] = weight; pars[1] = kmx; pars[2] = kmy; pars[3] = ksx; pars[4] = ksy; pars[5] = ksxy; return pars; } public void paint(Graphics g, Database db) { paint(g, db, null); } public void paint(Graphics g, Database db, Color KernelColor) { int j; double theta, u1x, u1y, u2x, u2y, r1, r2, tmp, varx, vary; if(Math.abs(ksxy) <= 1e-4) { if(ksx > ksy) { u1x = u2y = 1; u1y = u2x = 0; r1 = ksx; r2 = ksy; } else { u1x = u2y = 0; u1y = u2x = 1; r1 = ksy; r2 = ksx; } } else { varx = ksx * ksx; vary = ksy * ksy; // eigen value tmp = varx - vary; tmp = Math.sqrt(tmp * tmp + 4 * ksxy * ksxy); r1 = Math.sqrt((varx + vary + tmp) / 2); r2 = Math.sqrt((varx + vary - tmp) / 2); // eigen vectors u1x = r1 * r1 - vary; tmp = Math.sqrt(u1x * u1x + ksxy * ksxy); u1x /= tmp; u1y = ksxy / tmp; u2x = r2 * r2 - vary; tmp = Math.sqrt(u2x * u2x + ksxy * ksxy); u2x /= tmp; u2y = ksxy / tmp; } if (KernelColor!=null) g.setColor(KernelColor); else g.setColor(Color.red); g.drawString("Weight="+weight, (int) kmx, (int) kmy); if (KernelColor!=null) g.setColor(KernelColor); else g.setColor(Color.blue); if(plotcircle) { for(j = 1; j < 4; j++) { drawCurvedOval(g, u1x, u1y, u2x, u2y, r1 * j, r2 * j); if (j==2) // find/save polygon { //System.out.println("save2ndGaussianPolygon call!!!"); save2ndGaussianPolygon(u1x, u1y, u2x, u2y, r1 * j, r2 * j); } } } else { g.drawLine((int)(kmx + 3 * r1 * u1x), (int)(kmy + 3 * r1 * u1y), (int)(kmx - 3 * r1 * u1x), (int)(kmy - 3 * r1 * u1y)); } } public void drawCurvedOval(Graphics g, double x1, double y1, double x2, double y2, double r1, double r2) { int fx, fy, tx, ty; double w1, w2; fx = (int) (kmx + r1 * x1); fy = (int) (kmy + r1 * y1); for(double th = 0.1; th < 6.4; th += 0.1) { w1 = Math.cos(th); w2 = Math.sin(th); tx = (int) (kmx + r1 * x1 * w1 + r2 * x2 * w2); ty = (int) (kmy + r1 * y1 * w1 + r2 * y2 * w2); g.drawLine(fx, fy, tx, ty); fx = tx; fy = ty; } } public void save2ndGaussianPolygon(double x1, double y1, double x2, double y2, double r1, double r2) { int fx, fy, tx, ty; double w1, w2; gaussian2ndPolygon = new Polygon(); //System.out.println("INSIDE::save2ndGaussianPolygon Poly= "+gaussian2ndPolygon); fx = (int) (kmx + r1 * x1); fy = (int) (kmy + r1 * y1); gaussian2ndPolygon.addPoint(fx, fy); //System.out.println("INSIDE::save2ndGaussianPolygon Poly.nPoints= "+gaussian2ndPolygon.npoints); for(double th = 0.1; th < 6.4; th += 0.1) { w1 = Math.cos(th); w2 = Math.sin(th); tx = (int) (kmx + r1 * x1 * w1 + r2 * x2 * w2); ty = (int) (kmy + r1 * y1 * w1 + r2 * y2 * w2); //gaussian2ndPolygon.addPolygonOld2NewPOint(fx, fy, tx, ty); gaussian2ndPolygon.addPoint(tx, ty); fx = tx; fy = ty; } //System.out.println("INSIDE::save2ndGaussianPolygon() Poly.N_Points= "+gaussian2ndPolygon.npoints); setPolygon(gaussian2ndPolygon); return; } public void setPolygon(Polygon _gaussian2ndPolygon) { gaussian2ndPolygon = _gaussian2ndPolygon; //System.out.println("INSIDE::setPolygon() Poly.N_Points= "+gaussian2ndPolygon.npoints); } public Polygon getPolygon() { //System.out.println("INSIDE::getPolygon() Poly.N_Points = "+gaussian2ndPolygon.npoints); return gaussian2ndPolygon; } public double density(int x, int y) { double tmpx, tmpy, tmpxy, det, varx, vary; varx = ksx * ksx; vary = ksy * ksy; det = varx * vary - ksxy * ksxy; tmpx = (x - kmx) * (x - kmx); tmpy = (y - kmy) * (y - kmy); tmpxy = (x - kmx) * (y - kmy); return weight / Math.sqrt(det) / 6.28319 * Math.exp(-(tmpx * vary + tmpy * varx - 2 * tmpxy * ksxy) / det / 2); } public void EMpar(Database db, double prior) { int j, np; double x, y, tmp, tmpx, tmpy, tmpsx, tmpsy, tmpsxy; np = db.nPoints(); tmpsx = tmpsy = tmpsxy = kmx = kmy = 0; for(j = 0; j < np; j++) { x = db.xVal(j); y = db.yVal(j); kmx += probs[j] * x; kmy += probs[j] * y; tmpsx += probs[j] * x * x; tmpsy += probs[j] * y * y; tmpsxy += probs[j] * x * y; } tmp = np * weight; kmx /= tmp; kmy /= tmp; ksx = Math.sqrt(tmpsx / tmp - kmx * kmx); ksy = Math.sqrt(tmpsy / tmp - kmy * kmy); ksxy = tmpsxy / tmp - kmx * kmy; if(ksx < mins) ksx = mins; if(ksy < mins) ksy = mins; weight = 0.9 * weight + 0.1 * prior; } } //END::CurvedGaussian.java
SOCR/HTML5_WebSite
SOCR2.8/src/edu/ucla/stat/SOCR/util/CurvedGaussian.java
Java
lgpl-3.0
6,984
/********** 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 3 of the License, or (at your option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) 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 **********/ // Copyright (c) 1996-2021 Live Networks, Inc. All rights reserved. // The SRTP 'Cryptographic Context', used in all of our uses of SRTP. // Definition #ifndef _SRTP_CRYPTOGRAPHIC_CONTEXT_HH #define _SRTP_CRYPTOGRAPHIC_CONTEXT_HH #ifndef _MIKEY_HH #include "MIKEY.hh" #endif class SRTPCryptographicContext { public: SRTPCryptographicContext(MIKEYState const& mikeyState); virtual ~SRTPCryptographicContext(); // Authenticate (if necessary) and decrypt (if necessary) incoming SRTP and SRTCP packets. // Returns True iff the packet is well-formed and authenticates OK. // ("outPacketSize" will be <= "inPacketSize".) Boolean processIncomingSRTPPacket(u_int8_t* buffer, unsigned inPacketSize, unsigned& outPacketSize); Boolean processIncomingSRTCPPacket(u_int8_t* buffer, unsigned inPacketSize, unsigned& outPacketSize); // Encrypt (if necessary) and add an authentication tag (if necessary) to an outgoing // RTCP packet. // Returns True iff the packet is well-formed. // ("outPacketSize" will be >= "inPacketSize"; there must be enough space at the end of // "buffer" for the extra SRTCP tags (4+4+10 bytes).) Boolean processOutgoingSRTCPPacket(u_int8_t* buffer, unsigned inPacketSize, unsigned& outPacketSize); #ifndef NO_OPENSSL private: // Definitions specific to the "SRTP_AES128_CM_HMAC_SHA1_80" ciphersuite. // Later generalize to support more SRTP ciphersuites ##### #define SRTP_CIPHER_KEY_LENGTH (128/8) // in bytes #define SRTP_CIPHER_SALT_LENGTH (112/8) // in bytes #define SRTP_MKI_LENGTH 4 // in bytes #define SRTP_AUTH_KEY_LENGTH (160/8) // in bytes #define SRTP_AUTH_TAG_LENGTH (80/8) // in bytes struct derivedKeys { u_int8_t cipherKey[SRTP_CIPHER_KEY_LENGTH]; u_int8_t salt[SRTP_CIPHER_SALT_LENGTH]; u_int8_t authKey[SRTP_AUTH_KEY_LENGTH]; }; struct allDerivedKeys { derivedKeys srtp; derivedKeys srtcp; }; typedef enum { label_srtp_encryption = 0x00, label_srtp_msg_auth = 0x01, label_srtp_salt = 0x02, label_srtcp_encryption = 0x03, label_srtcp_msg_auth = 0x04, label_srtcp_salt = 0x05 } SRTPKeyDerivationLabel; unsigned generateSRTCPAuthenticationTag(u_int8_t const* dataToAuthenticate, unsigned numBytesToAuthenticate, u_int8_t* resultAuthenticationTag); // returns the size of the resulting authentication tag Boolean verifySRTPAuthenticationTag(u_int8_t* dataToAuthenticate, unsigned numBytesToAuthenticate, u_int32_t roc, u_int8_t const* authenticationTag); Boolean verifySRTCPAuthenticationTag(u_int8_t const* dataToAuthenticate, unsigned numBytesToAuthenticate, u_int8_t const* authenticationTag); void decryptSRTPPacket(u_int64_t index, u_int32_t ssrc, u_int8_t* data, unsigned numDataBytes); void decryptSRTCPPacket(u_int32_t index, u_int32_t ssrc, u_int8_t* data, unsigned numDataBytes); void encryptSRTCPPacket(u_int32_t index, u_int32_t ssrc, u_int8_t* data, unsigned numDataBytes); unsigned generateAuthenticationTag(derivedKeys& keysToUse, u_int8_t const* dataToAuthenticate, unsigned numBytesToAuthenticate, u_int8_t* resultAuthenticationTag); // returns the size of the resulting authentication tag // "resultAuthenticationTag" must point to an array of at least SRTP_AUTH_TAG_LENGTH Boolean verifyAuthenticationTag(derivedKeys& keysToUse, u_int8_t const* dataToAuthenticate, unsigned numBytesToAuthenticate, u_int8_t const* authenticationTag); void cryptData(derivedKeys& keys, u_int64_t index, u_int32_t ssrc, u_int8_t* data, unsigned numDataBytes); void performKeyDerivation(); void deriveKeysFromMaster(u_int8_t const* masterKey, u_int8_t const* salt, allDerivedKeys& allKeysResult); // used to implement "performKeyDerivation()" void deriveSingleKey(u_int8_t const* masterKey, u_int8_t const* salt, SRTPKeyDerivationLabel label, unsigned resultKeyLength, u_int8_t* resultKey); // used to implement "deriveKeysFromMaster()". // ("resultKey" must be an existing buffer, of size >= "resultKeyLength") private: MIKEYState const& fMIKEYState; // Master key + salt: u_int8_t const* masterKeyPlusSalt() const { return fMIKEYState.keyData(); } u_int8_t const* masterKey() const { return &masterKeyPlusSalt()[0]; } u_int8_t const* masterSalt() const { return &masterKeyPlusSalt()[SRTP_CIPHER_KEY_LENGTH]; } Boolean weEncryptSRTP() const { return fMIKEYState.encryptSRTP(); } Boolean weEncryptSRTCP() const { return fMIKEYState.encryptSRTCP(); } Boolean weAuthenticate() const { return fMIKEYState.useAuthentication(); } u_int32_t MKI() const { return fMIKEYState.MKI(); } // Derived (i.e., session) keys: allDerivedKeys fDerivedKeys; // State used for handling the reception of SRTP packets: Boolean fHaveReceivedSRTPPackets; u_int16_t fPreviousHighRTPSeqNum; u_int32_t fROC; // rollover counter // State used for handling the sending of SRTCP packets: u_int32_t fSRTCPIndex; #endif }; #endif
k0zmo/live555
liveMedia/include/SRTPCryptographicContext.hh
C++
lgpl-3.0
5,825
module Com module Model::MetaColumn extend ActiveSupport::Concern included do attribute :record_name, :string, index: true attribute :column_name, :string attribute :sql_type, :string attribute :column_type, :string attribute :column_limit, :integer attribute :comment, :string attribute :defined_db, :boolean, default: false attribute :defined_model, :boolean, default: false attribute :belongs_enable, :boolean, default: false attribute :belongs_table, :string belongs_to :meta_model, foreign_key: :record_name, primary_key: :record_name end def sync unless record_class.column_names.include?(self.column_name) record_class.connection.add_column(record_class.table_name, column_name, column_type) record_class.reset_column_information end end def test record_class.update self.column_name => 'ss' end def record_class record_name.constantize end end end
qinmingyuan/rails_com
app/models/com/model/meta_column.rb
Ruby
lgpl-3.0
1,008
/* * Copyright (C) 2003-2019 eXo Platform SAS. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Affero 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.exoplatform.social.core.processor; import java.util.LinkedHashMap; import java.util.Map; import org.exoplatform.container.PortalContainer; import org.exoplatform.portal.config.UserPortalConfigService; import org.exoplatform.social.core.BaseActivityProcessorPlugin; import org.exoplatform.social.core.activity.model.ExoSocialActivity; import org.exoplatform.social.core.activity.model.ExoSocialActivityImpl; import org.exoplatform.social.core.identity.model.Identity; import org.exoplatform.social.core.identity.provider.OrganizationIdentityProvider; import org.exoplatform.social.core.manager.IdentityManager; import org.exoplatform.social.core.service.LinkProvider; import org.exoplatform.social.core.test.AbstractCoreTest; public class MentionsProcessorTest extends AbstractCoreTest { private IdentityManager identityManager; private UserPortalConfigService userPortalConfigService; private Identity rootIdentity, johnIdentity; public void setUp() throws Exception { super.setUp(); identityManager = PortalContainer.getInstance().getComponentInstanceOfType(IdentityManager.class); userPortalConfigService = PortalContainer.getInstance().getComponentInstanceOfType(UserPortalConfigService.class); assertNotNull("identityManager must not be null", identityManager); rootIdentity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, "root"); johnIdentity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, "john"); assertNotNull("rootIdentity.getId() must not be null", rootIdentity.getId()); assertNotNull("johnIdentity.getId() must not be null", johnIdentity.getId()); } public void tearDown() throws Exception { identityManager.deleteIdentity(rootIdentity); identityManager.deleteIdentity(johnIdentity); super.tearDown(); } public void testSubstituteUsernames() throws Exception { assertTrue(true); MentionsProcessor processor = (MentionsProcessor) getContainer().getComponentInstanceOfType(MentionsProcessor.class); assertNotNull("prococessor must not be null", processor); ExoSocialActivity activity = null; processor.processActivity(activity); assertNull("returned activity must be null", activity); activity = new ExoSocialActivityImpl(); processor.processActivity(activity); assertNull(activity.getTitle()); assertNull(activity.getBody()); String root = "root", john = "john"; String rootLink = LinkProvider.getProfileLink(root, userPortalConfigService.getDefaultPortal()); String johnLink = LinkProvider.getProfileLink(john, userPortalConfigService.getDefaultPortal()); activity.setTitle("single @root substitution"); processor.processActivity(activity); assertEquals("Single substitution : ",activity.getTitle(), "single " + rootLink + " substitution"); assertNull(activity.getBody()); activity.setTitle("@root and @john title"); activity.setBody("body with @root and @john"); processor.processActivity(activity); assertEquals("Multiple substitution : ",activity.getTitle(), rootLink + " and " + johnLink + " title"); assertEquals(activity.getBody(), "body with " + rootLink + " and " + johnLink); { // test case wrong user name is mentioned activity.setTitle("@root and @wrong_username title"); activity.setBody("body with @root and @wrong_username"); processor.processActivity(activity); assertEquals(activity.getTitle(), rootLink + " and @wrong_username title"); assertEquals(activity.getBody(), "body with " + rootLink + " and @wrong_username"); } } public void testProcessActivityWithTemplateParam() throws Exception { MentionsProcessor processor = (MentionsProcessor) getContainer().getComponentInstanceOfType(MentionsProcessor.class); ExoSocialActivity activity = new ExoSocialActivityImpl(); String sample = "this is a <strong> tag to keep</strong>"; activity.setTitle(sample); activity.setBody(sample); String keysToProcess = "a|b|c"; Map<String, String> templateParams = new LinkedHashMap<String, String>(); templateParams.put("a", "@root and @john"); templateParams.put("b", "@john"); templateParams.put("d", "@mary"); templateParams.put(BaseActivityProcessorPlugin.TEMPLATE_PARAM_TO_PROCESS, keysToProcess); activity.setTemplateParams(templateParams); processor.processActivity(activity); templateParams = activity.getTemplateParams(); assertEquals(LinkProvider.getProfileLink("root", userPortalConfigService.getDefaultPortal()) + " and " + LinkProvider.getProfileLink("john", userPortalConfigService.getDefaultPortal()), templateParams.get("a")); assertEquals(LinkProvider.getProfileLink("john", userPortalConfigService.getDefaultPortal()), templateParams.get("b")); assertEquals("@mary", templateParams.get("d")); } }
exodev/social
component/core/src/test/java/org/exoplatform/social/core/processor/MentionsProcessorTest.java
Java
lgpl-3.0
5,645
// Created file "Lib\src\Uuid\X64\ieguids" typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } DEFINE_GUID(NOTIFICATIONTYPE_TASKS_ABORT, 0xd34f17e9, 0x576e, 0x11d0, 0xb2, 0x8c, 0x00, 0xc0, 0x4f, 0xd7, 0xcd, 0x22);
Frankie-PellesC/fSDK
Lib/src/Uuid/X64/ieguids0000005D.c
C
lgpl-3.0
464
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>src/ui/react/src/components/buttons/button-table-row.jsx - alloyeditor</title> <!-- Favicon --> <link rel="shortcut icon" type="image/png" href="../assets/favicon.ico"> <!-- CSS --> <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css"> <link rel="stylesheet" href="../assets/css/main.css" id="site_styles"> <!-- AlloyUI --> <link rel="stylesheet" href="http://cdn.alloyui.com/2.0.x/aui-css/css/bootstrap.min.css"> <link rel="stylesheet" href="http://cdn.alloyui.com/2.0.x/aui-css/css/bootstrap-responsive.min.css"> <script src="http://cdn.alloyui.com/2.0.x/aui/aui-min.js"></script> </head> <body class="yui3-skin-sam"> <div class="navbar"> <div class="navbar-inner"> <h1 class="brand"> <a href="/"> <img alt="alloyeditor" src="../assets/img/logo-small.png" title="alloyeditor"> </a> </h1> <div class="nav"> <li class="divider-vertical"></li> <li> <p class="navbar-text"> API Docs for Version: <b>0.5.1</b> </p> </li> </div> </div> </div> <div id="bd" class="container"> <div class="row"> <div class="span3"> <div id="docs-sidebar" class="sidebar apidocs"> <div id="api-list"> <h2 class="off-left">APIs</h2> <div id="api-tabview"> <ul class="nav nav-tabs"> <li><a href="#api-classes">Classes</a></li> <li><a href="#api-modules">Modules</a></li> </ul> <div id="api-tabview-filter"> <input type="search" id="api-filter" placeholder="Type to filter APIs"> </div> <div id="api-tabview-panel"> <ul id="api-classes" class="apis classes tab-pane"> <li><a href="../classes/AlloyEditor.html">AlloyEditor</a></li> <li><a href="../classes/Attribute.html">Attribute</a></li> <li><a href="../classes/Base.html">Base</a></li> <li><a href="../classes/ButtonActionStyle.html">ButtonActionStyle</a></li> <li><a href="../classes/ButtonBold.html">ButtonBold</a></li> <li><a href="../classes/ButtonCamera.html">ButtonCamera</a></li> <li><a href="../classes/ButtonCameraImage.html">ButtonCameraImage</a></li> <li><a href="../classes/ButtonCode.html">ButtonCode</a></li> <li><a href="../classes/ButtonCommand.html">ButtonCommand</a></li> <li><a href="../classes/ButtonCommandListItem.html">ButtonCommandListItem</a></li> <li><a href="../classes/ButtonCommandsList.html">ButtonCommandsList</a></li> <li><a href="../classes/ButtonDropdown.html">ButtonDropdown</a></li> <li><a href="../classes/ButtonH1.html">ButtonH1</a></li> <li><a href="../classes/ButtonH2.html">ButtonH2</a></li> <li><a href="../classes/ButtonHline.html">ButtonHline</a></li> <li><a href="../classes/ButtonImage.html">ButtonImage</a></li> <li><a href="../classes/ButtonImageAlignLeft.html">ButtonImageAlignLeft</a></li> <li><a href="../classes/ButtonImageAlignRight.html">ButtonImageAlignRight</a></li> <li><a href="../classes/ButtonItalic.html">ButtonItalic</a></li> <li><a href="../classes/ButtonLink.html">ButtonLink</a></li> <li><a href="../classes/ButtonLinkEdit.html">ButtonLinkEdit</a></li> <li><a href="../classes/ButtonOrderedList.html">ButtonOrderedList</a></li> <li><a href="../classes/ButtonParagraphAlignLeft.html">ButtonParagraphAlignLeft</a></li> <li><a href="../classes/ButtonParagraphAlignRight.html">ButtonParagraphAlignRight</a></li> <li><a href="../classes/ButtonParagraphCenter.html">ButtonParagraphCenter</a></li> <li><a href="../classes/ButtonParagraphJustify.html">ButtonParagraphJustify</a></li> <li><a href="../classes/ButtonQuote.html">ButtonQuote</a></li> <li><a href="../classes/ButtonRemoveFormat.html">ButtonRemoveFormat</a></li> <li><a href="../classes/ButtonsStylesListHeader.html">ButtonsStylesListHeader</a></li> <li><a href="../classes/ButtonStateClasses.html">ButtonStateClasses</a></li> <li><a href="../classes/ButtonStrike.html">ButtonStrike</a></li> <li><a href="../classes/ButtonStyle.html">ButtonStyle</a></li> <li><a href="../classes/ButtonStyles.html">ButtonStyles</a></li> <li><a href="../classes/ButtonStylesList.html">ButtonStylesList</a></li> <li><a href="../classes/ButtonStylesListItem.html">ButtonStylesListItem</a></li> <li><a href="../classes/ButtonStylesListItemRemove.html">ButtonStylesListItemRemove</a></li> <li><a href="../classes/ButtonSubscript.html">ButtonSubscript</a></li> <li><a href="../classes/ButtonSuperscript.html">ButtonSuperscript</a></li> <li><a href="../classes/ButtonTable.html">ButtonTable</a></li> <li><a href="../classes/ButtonTableCell.html">ButtonTableCell</a></li> <li><a href="../classes/ButtonTableColumn.html">ButtonTableColumn</a></li> <li><a href="../classes/ButtonTableEdit.html">ButtonTableEdit</a></li> <li><a href="../classes/ButtonTableHeading.html">ButtonTableHeading</a></li> <li><a href="../classes/ButtonTableRemove.html">ButtonTableRemove</a></li> <li><a href="../classes/ButtonTableRow.html">ButtonTableRow</a></li> <li><a href="../classes/ButtonTwitter.html">ButtonTwitter</a></li> <li><a href="../classes/ButtonUnderline.html">ButtonUnderline</a></li> <li><a href="../classes/ButtonUnorderedlist.html">ButtonUnorderedlist</a></li> <li><a href="../classes/CKEDITOR.Link.html">CKEDITOR.Link</a></li> <li><a href="../classes/CKEDITOR.plugins.ae_autolink.html">CKEDITOR.plugins.ae_autolink</a></li> <li><a href="../classes/CKEDITOR.plugins.ae_buttonbridge.html">CKEDITOR.plugins.ae_buttonbridge</a></li> <li><a href="../classes/CKEDITOR.plugins.ae_panelmenubuttonbridge.html">CKEDITOR.plugins.ae_panelmenubuttonbridge</a></li> <li><a href="../classes/CKEDITOR.plugins.ae_placeholder.html">CKEDITOR.plugins.ae_placeholder</a></li> <li><a href="../classes/CKEDITOR.plugins.ae_richcombobridge.html">CKEDITOR.plugins.ae_richcombobridge</a></li> <li><a href="../classes/CKEDITOR.plugins.ae_selectionregion.html">CKEDITOR.plugins.ae_selectionregion</a></li> <li><a href="../classes/CKEDITOR.plugins.ae_uibridge.html">CKEDITOR.plugins.ae_uibridge</a></li> <li><a href="../classes/CKEDITOR.plugins.ae_uicore.html">CKEDITOR.plugins.ae_uicore</a></li> <li><a href="../classes/CKEDITOR.Table.html">CKEDITOR.Table</a></li> <li><a href="../classes/CKEDITOR.tools.html">CKEDITOR.tools</a></li> <li><a href="../classes/Core.html">Core</a></li> <li><a href="../classes/Lang.html">Lang</a></li> <li><a href="../classes/ToolbarAdd.html">ToolbarAdd</a></li> <li><a href="../classes/ToolbarButtons.html">ToolbarButtons</a></li> <li><a href="../classes/ToolbarStyles.html">ToolbarStyles</a></li> <li><a href="../classes/UI.html">UI</a></li> <li><a href="../classes/WidgetArrowBox.html">WidgetArrowBox</a></li> <li><a href="../classes/WidgetDropdown.html">WidgetDropdown</a></li> <li><a href="../classes/WidgetExclusive.html">WidgetExclusive</a></li> <li><a href="../classes/WidgetFocusManager.html">WidgetFocusManager</a></li> <li><a href="../classes/WidgetInteractionPoint.html">WidgetInteractionPoint</a></li> <li><a href="../classes/WidgetPosition.html">WidgetPosition</a></li> </ul> <ul id="api-modules" class="apis modules tab-pane"> </ul> </div> </div> </div> </div> </div> <div class="span9"> <div id="api-options" class="form-inline pull-right"> Show: <label for="api-show-inherited"> <input type="checkbox" id="api-show-inherited" checked> Inherited </label> <label for="api-show-protected"> <input type="checkbox" id="api-show-protected"> Protected </label> <label for="api-show-private"> <input type="checkbox" id="api-show-private"> Private </label> <label for="api-show-deprecated"> <input type="checkbox" id="api-show-deprecated"> Deprecated </label> </div> <div class="apidocs"> <div id="docs-main"> <div class="content"> <div class="page-header"> <h1><small>File</small> <code>src/ui/react/src/components/buttons/button-table-row.jsx</code></h1> </div> <div class="file"> <pre class="code prettyprint linenums"> (function () { &#x27;use strict&#x27;; /** * The ButtonTableRow class provides functionality to work with table rows. * * @class ButtonTableRow */ var ButtonTableRow = React.createClass({ // Allows validating props being passed to the component. propTypes: { /** * List of the commands the button is able to handle. * * @property {Array} commands */ commands: React.PropTypes.arrayOf(React.PropTypes.object), /** * The editor instance where the component is being used. * * @property {Object} editor */ editor: React.PropTypes.object.isRequired, /** * Indicates whether the styles list is expanded or not. * * @property {Boolean} expanded */ expanded: React.PropTypes.bool, /** * The label that should be used for accessibility purposes. * * @property {String} label */ label: React.PropTypes.string, /** * The tabIndex of the button in its toolbar current state. A value other than -1 * means that the button has focus and is the active element. * * @property {Number} tabIndex */ tabIndex: React.PropTypes.number, /** * Callback provided by the button host to notify when the styles list has been expanded. * * @property {Function} toggleDropdown */ toggleDropdown: React.PropTypes.func }, // Lifecycle. Provides static properties to the widget. statics: { /** * The name which will be used as an alias of the button in the configuration. * * @static * @property {String} key * @default tableRow */ key: &#x27;tableRow&#x27; }, /** * Lifecycle. Renders the UI of the button. * * @method render * @return {Object} The content which should be rendered. */ render: function() { var buttonCommandsList; var buttonCommandsListId; if (this.props.expanded) { buttonCommandsListId = ButtonTableRow.key + &#x27;List&#x27;; buttonCommandsList = &lt;AlloyEditor.ButtonCommandsList commands={this._getCommands()} editor={this.props.editor} listId={buttonCommandsListId} onDismiss={this.props.toggleDropdown} /&gt; } return ( &lt;div className=&quot;ae-container ae-has-dropdown&quot;&gt; &lt;button aria-expanded={this.props.expanded} aria-label={AlloyEditor.Strings.row} aria-owns={buttonCommandsListId} className=&quot;ae-button&quot; onClick={this.props.toggleDropdown} role=&quot;combobox&quot; tabIndex={this.props.tabIndex} title={AlloyEditor.Strings.row}&gt; &lt;span className=&quot;ae-icon-row&quot;&gt;&lt;/span&gt; &lt;/button&gt; {buttonCommandsList} &lt;/div&gt; ); }, /** * Returns a list of commands. If a list of commands was passed * as property &#x60;commands&#x60;, it will take a precedence over the default ones. * * @method _getCommands * @return {Array} The list of available commands. */ _getCommands: function () { return this.props.commands || [ { command: &#x27;rowInsertBefore&#x27;, label: AlloyEditor.Strings.rowInsertBefore }, { command: &#x27;rowInsertAfter&#x27;, label: AlloyEditor.Strings.rowInsertAfter }, { command: &#x27;rowDelete&#x27;, label: AlloyEditor.Strings.rowDelete } ]; } }); AlloyEditor.Buttons[ButtonTableRow.key] = AlloyEditor.ButtonTableRow = ButtonTableRow; }()); </pre> </div> </div> </div> </div> </div> </div> </div> <script src="../assets/vendor/prettify/prettify-min.js"></script> <script>prettyPrint();</script> <script src="../assets/js/yui-prettify.js"></script> <script src="../assets/../api.js"></script> <script src="../assets/js/api-filter.js"></script> <script src="../assets/js/api-list.js"></script> <script src="../assets/js/api-search.js"></script> <script src="../assets/js/apidocs.js"></script> </body> </html>
silvaemota/alloy-editor
api/files/src_ui_react_src_components_buttons_button-table-row.jsx.html
HTML
lgpl-3.0
20,170
# # SonarQube, open source software quality management tool. # Copyright (C) 2008-2014 SonarSource # mailto:contact AT sonarsource DOT com # # SonarQube is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 3 of the License, or (at your option) any later version. # # SonarQube 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 program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # require "json" class Api::SourcesController < Api::RestController def rest_call unless params[:resource] rest_status_ko('Missing parameter: resource', 400) return end resource_id=params[:resource] if resource_id @resource=Project.by_key(resource_id) if @resource.nil? || @resource.last_snapshot.nil? rest_status_ko('Resource not found', 404) return end end unless has_role?(:codeviewer, @resource) access_denied return end source = @resource.last_snapshot.source if !source rest_status_ko('Resource has no sources', 404) else #optimization #source.snapshot.project=@resource rest_render({:source => source, :params => params}) end end def rest_to_json(objects) source = objects[:source] params = objects[:params] JSON([source.to_hash_json(params)]) end def rest_to_xml(objects) source = objects[:source] params = objects[:params] xml = Builder::XmlMarkup.new(:indent => 0) xml.instruct! source.to_xml(xml, params) end def rest_to_text(objects) source = objects[:source] params = objects[:params] source.to_txt(params) end end
teryk/sonarqube
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/sources_controller.rb
Ruby
lgpl-3.0
2,086
// CKView.cpp : implementation of the CKView class // #include "stdafx.h" #include ".\CApp.h" #include ".\CDoc.h" #include ".\CKView.h" #include ".\CAView.h" #include ".\CKeyManagerDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CKView IMPLEMENT_DYNCREATE(CKView, CTreeView) // CKView diagnostics #ifdef _DEBUG void CKView::AssertValid() const { CTreeView::AssertValid(); } void CKView::Dump(CDumpContext& dc) const { CTreeView::Dump(dc); } CDoc* CKView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDoc))); return (CDoc*)m_pDocument; } #endif //_DEBUG BEGIN_MESSAGE_MAP(CKView, CTreeView) ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnTvnSelchanged) ON_NOTIFY_REFLECT(NM_DBLCLK, OnDoubleClick) ON_NOTIFY_REFLECT(NM_RETURN, OnDoubleClick) END_MESSAGE_MAP() // CKView construction/destruction CKView::CKView() : m_tree(GetTreeCtrl()) { m_pDoc = NULL; m_ImageList.Create(16,16, ILC_COLOR16, 0, 4); CWinApp* app = ::AfxGetApp(); m_ImageList.Add(app->LoadIcon(IDI_ICON_LEAF_RED)); m_ImageList.Add(app->LoadIcon(IDI_ICON_LEAF_GREY)); m_ImageList.Add(app->LoadIcon(IDI_ICON_KEY_GOLD)); m_ImageList.Add(app->LoadIcon(IDI_ICON_KEY_GREY)); m_ImageList.Add(app->LoadIcon(IDI_ICON_KEY_RED)); m_hFound = NULL; m_hNotFound = NULL; } CKView::~CKView() { if (m_pDoc) { m_pDoc->m_pKView = NULL; } } BOOL CKView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs cs.style |= TVS_SHOWSELALWAYS; return CTreeView::PreCreateWindow(cs); } void CKView::OnInitialUpdate() { m_pDoc = GetDocument(); m_pDoc->m_pKView = this; LONG lTreeStyle = GetWindowLong(m_tree.m_hWnd, GWL_STYLE); lTreeStyle |= TVS_SHOWSELALWAYS | TVS_LINESATROOT | TVS_HASBUTTONS; SetWindowLong(m_tree.m_hWnd, GWL_STYLE, lTreeStyle); m_tree.SetImageList(&m_ImageList, TVSIL_NORMAL); CTreeView::OnInitialUpdate(); } void CKView::ClearAll() { m_tree.SetBkColor(::GetSysColor(COLOR_3DFACE)); ResetItemData(m_hFound); ResetItemData(m_hNotFound); m_hFound = NULL; m_hNotFound = NULL; } void CKView::ResetItemData(HTREEITEM _hItem) { while (_hItem != NULL) { m_tree.SetItemData(_hItem, NULL); if (m_tree.ItemHasChildren(_hItem)) { // recursion this->ResetItemData(m_tree.GetChildItem(_hItem)); } m_tree.DeleteItem(_hItem); _hItem = m_tree.GetNextSiblingItem(_hItem); } } HTREEITEM CKView::FindTreeItemByKey(CKey* _pKey) { HTREEITEM hItem = m_tree.GetChildItem(m_hFound); while (hItem != NULL) { TVITEM item; SecureZeroMemory(&item, sizeof (TVITEM)); item.mask = TVIF_HANDLE | TVIF_PARAM; item.hItem = hItem; // that I have item.lParam = NULL; // this I need BOOL bOK = m_tree.GetItem(/*out*/ &item); if ((TRUE == bOK) && (_pKey == (CKey *) item.lParam)) { return hItem; } hItem = m_tree.GetNextSiblingItem(hItem); } return NULL; } void CKView::OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/) { // called from CDocument::UpdateAllViews this->ReflectKeyList(); } void CKView::ReflectKeyList() { RETURNIF(NULL == m_pDoc || m_pDoc->m_WorkState.IsActive()); CWaitCursor toggleWaitCursor; this->ClearAll(); m_hFound = m_tree.InsertItem(sPRG_KEYTREE_FOUND, 0,0); m_hNotFound = m_tree.InsertItem(sPRG_KEYTREE_NOTFOUND, 1,1); HTREEITEM hItem; DWORD dwFound = 0; m_dwTotalFound = 0; ::EnterCriticalSection(&m_pDoc->m_DocData.m_klUsed_lock); CKeyList* pKeyList = &m_pDoc->m_DocData.m_klUsed; for (CKey* pKey = pKeyList->GetRoot(); NULL != pKey; pKey = pKey->Next()) { dwFound = (DWORD) pKey->m_MediaSet.GetCount(); if (dwFound == 0) { hItem = m_tree.InsertItem(pKey->m_sName, 3,3, m_hNotFound); } else { m_dwTotalFound += dwFound; CString str; str.Format(_T("%s: %d"), pKey->m_sName, dwFound); hItem = m_tree.InsertItem(str, 2,4, m_hFound); } m_tree.SetItemData(hItem, (INT_PTR) pKey); } ::LeaveCriticalSection(&m_pDoc->m_DocData.m_klUsed_lock); CString sFound; sFound.Format(_T("%s: %d"), sPRG_KEYTREE_FOUND, m_dwTotalFound); m_tree.SetItemText(m_hFound, sFound); m_tree.SetBkColor(RGB(255,255,255)); // Set first selection m_tree.Expand(m_hNotFound, TVE_EXPAND); m_tree.Expand(m_hFound, TVE_EXPAND); m_tree.SetFocus(); m_tree.SelectItem(m_hFound); } void CKView::RemoveFromKey(CKey* _pKey, DWORD _dwRemoved) { RETURNIF(NULL == _pKey || 0 == _dwRemoved); HTREEITEM hItem = m_tree.GetSelectedItem(); // update `m_dwTotalFound` counter and Total Found tree leaf m_dwTotalFound -= _dwRemoved; CString sFound; sFound.Format(_T("%s: %d"), sPRG_KEYTREE_FOUND, m_dwTotalFound); m_tree.SetItemText(m_hFound, sFound); if (hItem != m_hFound) { // removed some media from MEDIA Table DWORD dwMediaCount = (DWORD) _pKey->m_MediaSet.GetCount(); if (dwMediaCount != 0) { // key still has some media CString str; str.Format(_T("%s: %d"), _pKey->m_sName, dwMediaCount); m_tree.SetItemText(hItem, str); return; } } else { // key removed from SUMMARY Table hItem = FindTreeItemByKey(_pKey); } // key is empty now - move it to "Not Found" m_tree.SetItemData(hItem, NULL); m_tree.DeleteItem(hItem); hItem = m_tree.InsertItem(_pKey->m_sName, 3,3, m_hNotFound, TVI_SORT); m_tree.SetItemData(hItem, (INT_PTR)_pKey); m_tree.Expand(m_hNotFound, TVE_EXPAND); } void CKView::OnTvnSelchanged(NMHDR* /*pNMHDR*/, LRESULT* /*pResult*/) { RETURNIF(NULL == m_pDoc || NULL == m_pDoc->m_pAView || m_pDoc->m_WorkState.IsActive()); CWaitCursor toggleWaitCursor; if (::TryEnterCriticalSection(&m_pDoc->m_DocData.m_klUsed_lock)) { HTREEITEM hItem = m_tree.GetSelectedItem(); CKey* pKey = (CKey *)m_tree.GetItemData(hItem); if (hItem == m_hFound || NULL != pKey && pKey->m_MediaSet.GetCount() != 0) { if (NULL == pKey) { m_pDoc->m_pAView->ShowSummaryForKeys(&m_pDoc->m_DocData.m_klUsed); } else { m_pDoc->m_pAView->ShowMediaForKey(pKey); } } else { m_pDoc->m_pAView->ClearAll(); } ::LeaveCriticalSection(&m_pDoc->m_DocData.m_klUsed_lock); }else{ AFXDUMP("!!!!!!!!!!!!!!!! ::TryEnterCriticalSection(&m_pDoc->m_DocData.m_klUsed_lock) !!!!!!!!!!!!!!!!\n"); } } void CKView::ShowKey(CKey* _pKey) { if (NULL == _pKey || m_pDoc->m_WorkState.IsActive()) { return; } HTREEITEM hItem = FindTreeItemByKey(_pKey); if (hItem != NULL) { m_tree.SetFocus(); m_tree.Expand(m_hFound, TVE_EXPAND); m_tree.SelectItem(hItem); } } void CKView::OnDoubleClick(NMHDR* /*pNMHDR*/, LRESULT* pResult) { if (NULL == m_pDoc || m_pDoc->m_WorkState.IsActive()) { return; } m_pDoc->m_WorkState.m_bMakingKeys = true; HTREEITEM hItem = m_tree.GetSelectedItem(); CKey* pKey = (CKey*)m_tree.GetItemData(hItem); if (NULL != pKey) { CKeyManagerDlg dlg(theApp.m_pMainWnd); dlg.m_sForKeyName = pKey->m_sName; ::EnterCriticalSection(&this->m_pDoc->m_DocData.m_klUsed_lock); dlg.m_pKeyList = new CKeyList(this->m_pDoc->m_DocData.m_klUsed); ::LeaveCriticalSection(&this->m_pDoc->m_DocData.m_klUsed_lock); INT_PTR iRet = dlg.DoModal(); if (IDOK == iRet && dlg.m_bHasChanges) { ::EnterCriticalSection(&this->m_pDoc->m_DocData.m_klUsed_lock); this->ClearAll(); this->m_pDoc->m_DocData.m_klUsed.Absorb(dlg.m_pKeyList); ::LeaveCriticalSection(&this->m_pDoc->m_DocData.m_klUsed_lock); this->m_pDoc->SetModifiedFlag(TRUE); m_pDoc->m_WorkState.m_bMakingKeys = false; this->ReflectKeyList(); } delete dlg.m_pKeyList; *pResult = TRUE; // message processed } else { *pResult = FALSE; } m_pDoc->m_WorkState.m_bMakingKeys = false; }
zendive/file-key-search
CKView.cpp
C++
lgpl-3.0
7,887
/* Copyright (2007-2012) Schibsted ASA * This file is part of Possom. * * Possom is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Possom 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 Possom. If not, see <http://www.gnu.org/licenses/>. */ package no.sesat.search.mode.command; import no.sesat.search.mode.config.NewsMyNewsCommandConfig; import no.sesat.search.result.BasicResultList; import no.sesat.search.result.ResultItem; import no.sesat.search.result.ResultList; import org.apache.log4j.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * * * @version $Id$ */ public final class NewsMyNewsSearchCommand extends AbstractSearchCommand { private static final Logger LOG = Logger.getLogger(NewsMyNewsSearchCommand.class); private static final Pattern cookiePattern = Pattern.compile("(?:\\A|\\|)([^\\|]+)\\:{2}([^\\|]+)\\|?"); /** * @param cxt The context to execute in. */ public NewsMyNewsSearchCommand(Context cxt) { super(cxt); } public ResultList<ResultItem> execute() { LOG.debug("entering execute()"); final NewsMyNewsCommandConfig config = getSearchConfiguration(); String myNews = (String) context.getDataModel().getJunkYard().getValue("myNews"); LOG.debug("Cookie is: " + myNews); if (myNews != null && myNews.length() > 0) { final ResultList<ResultItem> mergedResult = new BasicResultList<ResultItem>(); Matcher matcher = cookiePattern.matcher(myNews); int hitCount = 0; while (matcher.find()) { // count all cookies hitCount++; } matcher.reset(); int position = 0; int offset = getOffset(); for (int i = 0; i < offset; i++) { // Forward matcher to correct place in cookie. if (!matcher.find()) { break; } } while (matcher.find() && position < config.getResultsToReturn()) { ResultList<ResultItem> collectedResult; String commandName = null; final String type = matcher.group(2); if (type.equals("knippe")) { commandName = "clusterMyNews" + position; } else if (type.equals("sak")) { commandName = "newsCase" + position; } else if (type.equals("person")) { commandName = "newsPerson" + position; } else if (type.equals("art")) { commandName = "article" + position; } if (commandName != null) { try { LOG.debug("Waiting for " + commandName); collectedResult = getSearchResult(commandName, datamodel); if (collectedResult != null && collectedResult.getResults().size() > 0) { // Article if(!(collectedResult.getResults().get(0) instanceof ResultList<?>)) { ResultItem searchResultItem = collectedResult.getResults().get(0); searchResultItem = searchResultItem.addField("type", type); mergedResult.addResult(searchResultItem); } else { ResultList<ResultItem> searchResultItem = (ResultList<ResultItem>) collectedResult.getResults().get(0); final int lastSubPos = Math.min(collectedResult.getResults().size(), 4); if (lastSubPos > 1) { final ResultList<ResultItem> subSearchResults = new BasicResultList<ResultItem>(); subSearchResults.setHitCount(collectedResult.getHitCount()); searchResultItem.addResult(subSearchResults); for (int i = 1; i < lastSubPos; i++) { subSearchResults.addResult(collectedResult.getResults().get(i)); } } searchResultItem = searchResultItem.addField("type", type); if (type.equals("sak") || type.equals("person")) { searchResultItem = searchResultItem.addField("newsCase", matcher.group(1)); } mergedResult.addResult(searchResultItem); LOG.debug("Collected " + searchResultItem.getField("type") + ":" + searchResultItem.getField("title")); } } else { LOG.debug("Command " + commandName + " is empty or wrong type: " + collectedResult); } } catch (InterruptedException e) { LOG.error("Command was interrupted", e); } } position++; } mergedResult.setHitCount(hitCount); setNextOffset(mergedResult, config.getResultsToReturn()); return mergedResult; } else { LOG.info("Could not find cookie"); ResultList<ResultItem> searchResult = new BasicResultList<ResultItem>(); searchResult.setHitCount(0); return searchResult; } } private void setNextOffset(ResultList<ResultItem> searchResult, int returnedResults) { int offset = getOffset(); if (offset + returnedResults < searchResult.getHitCount()) { LOG.debug("Setting next offset to: " + (offset + returnedResults)); NewsEspSearchCommand.addNextOffsetField(offset + returnedResults, searchResult); } } @Override public NewsMyNewsCommandConfig getSearchConfiguration() { return (NewsMyNewsCommandConfig) super.getSearchConfiguration(); } }
michaelsembwever/Sesat
generic.sesam/search-command-control/fast/src/main/java/no/sesat/search/mode/command/NewsMyNewsSearchCommand.java
Java
lgpl-3.0
6,705
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_26) on Sun Dec 22 15:55:57 GMT 2013 --> <TITLE> Uses of Class org.lwjgl.opengl.ARBExplicitUniformLocation (LWJGL API) </TITLE> <META NAME="date" CONTENT="2013-12-22"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.lwjgl.opengl.ARBExplicitUniformLocation (LWJGL API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../org/lwjgl/opengl/ARBExplicitUniformLocation.html" title="class in org.lwjgl.opengl"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/lwjgl/opengl//class-useARBExplicitUniformLocation.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ARBExplicitUniformLocation.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>org.lwjgl.opengl.ARBExplicitUniformLocation</B></H2> </CENTER> No usage of org.lwjgl.opengl.ARBExplicitUniformLocation <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../org/lwjgl/opengl/ARBExplicitUniformLocation.html" title="class in org.lwjgl.opengl"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/lwjgl/opengl//class-useARBExplicitUniformLocation.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ARBExplicitUniformLocation.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <i>Copyright &#169; 2002-2009 lwjgl.org. All Rights Reserved.</i> </BODY> </HTML>
GokulEvuri/VenganceRabbit
lib/Docs/javadoc/org/lwjgl/opengl/class-use/ARBExplicitUniformLocation.html
HTML
lgpl-3.0
6,012
from __future__ import annotations from decimal import Decimal from typing import ( Any, Mapping, Sequence, ) import uuid from pprint import pprint import pytest from ai.backend.common.docker import ImageRef from ai.backend.common.types import ( AccessKey, AgentId, KernelId, ResourceSlot, SessionTypes, ) from ai.backend.manager.scheduler import PendingSession, ExistingSession, AgentContext from ai.backend.manager.scheduler.dispatcher import load_scheduler from ai.backend.manager.scheduler.fifo import FIFOSlotScheduler, LIFOSlotScheduler from ai.backend.manager.scheduler.drf import DRFScheduler from ai.backend.manager.scheduler.mof import MOFScheduler def test_load_intrinsic(): assert isinstance(load_scheduler('fifo', {}), FIFOSlotScheduler) assert isinstance(load_scheduler('lifo', {}), LIFOSlotScheduler) assert isinstance(load_scheduler('drf', {}), DRFScheduler) assert isinstance(load_scheduler('mof', {}), MOFScheduler) example_group_id = uuid.uuid4() example_total_capacity = ResourceSlot({'cpu': '4.0', 'mem': '4096'}) @pytest.fixture def example_agents(): return [ AgentContext( agent_id=AgentId('i-001'), agent_addr='10.0.1.1:6001', scaling_group='sg01', available_slots=ResourceSlot({ 'cpu': Decimal('4.0'), 'mem': Decimal('4096'), 'cuda.shares': Decimal('4.0'), 'rocm.devices': Decimal('2'), }), occupied_slots=ResourceSlot({ 'cpu': Decimal('0'), 'mem': Decimal('0'), 'cuda.shares': Decimal('0'), 'rocm.devices': Decimal('0'), }), ), AgentContext( agent_id=AgentId('i-101'), agent_addr='10.0.2.1:6001', scaling_group='sg02', available_slots=ResourceSlot({ 'cpu': Decimal('3.0'), 'mem': Decimal('2560'), 'cuda.shares': Decimal('1.0'), 'rocm.devices': Decimal('8'), }), occupied_slots=ResourceSlot({ 'cpu': Decimal('0'), 'mem': Decimal('0'), 'cuda.shares': Decimal('0'), 'rocm.devices': Decimal('0'), }), ), ] @pytest.fixture def example_mixed_agents(): return [ AgentContext( agent_id=AgentId('i-gpu'), agent_addr='10.0.1.1:6001', scaling_group='sg01', available_slots=ResourceSlot({ 'cpu': Decimal('4.0'), 'mem': Decimal('4096'), 'cuda.shares': Decimal('4.0'), }), occupied_slots=ResourceSlot({ 'cpu': Decimal('0'), 'mem': Decimal('0'), 'cuda.shares': Decimal('0'), }), ), AgentContext( agent_id=AgentId('i-cpu'), agent_addr='10.0.2.1:6001', scaling_group='sg02', available_slots=ResourceSlot({ 'cpu': Decimal('3.0'), 'mem': Decimal('2560'), 'cuda.shares': Decimal('0'), }), occupied_slots=ResourceSlot({ 'cpu': Decimal('0'), 'mem': Decimal('0'), 'cuda.shares': Decimal('0'), }), ), ] @pytest.fixture def example_agents_first_one_assigned(): return [ AgentContext( agent_id=AgentId('i-001'), agent_addr='10.0.1.1:6001', scaling_group='sg01', available_slots=ResourceSlot({ 'cpu': Decimal('2.0'), 'mem': Decimal('2048'), 'cuda.shares': Decimal('2.0'), 'rocm.devices': Decimal('1'), }), occupied_slots=ResourceSlot({ 'cpu': Decimal('2.0'), 'mem': Decimal('2048'), 'cuda.shares': Decimal('2.0'), 'rocm.devices': Decimal('1'), }), ), AgentContext( agent_id=AgentId('i-101'), agent_addr='10.0.2.1:6001', scaling_group='sg02', available_slots=ResourceSlot({ 'cpu': Decimal('3.0'), 'mem': Decimal('2560'), 'cuda.shares': Decimal('1.0'), 'rocm.devices': Decimal('8'), }), occupied_slots=ResourceSlot({ 'cpu': Decimal('0'), 'mem': Decimal('0'), 'cuda.shares': Decimal('0'), 'rocm.devices': Decimal('0'), }), ), ] @pytest.fixture def example_agents_no_valid(): return [ AgentContext( agent_id=AgentId('i-001'), agent_addr='10.0.1.1:6001', scaling_group='sg01', available_slots=ResourceSlot({ 'cpu': Decimal('0'), 'mem': Decimal('0'), 'cuda.shares': Decimal('0'), 'rocm.devices': Decimal('0'), }), occupied_slots=ResourceSlot({ 'cpu': Decimal('4.0'), 'mem': Decimal('4096'), 'cuda.shares': Decimal('4.0'), 'rocm.devices': Decimal('2'), }), ), AgentContext( agent_id=AgentId('i-101'), agent_addr='10.0.2.1:6001', scaling_group='sg02', available_slots=ResourceSlot({ 'cpu': Decimal('0'), 'mem': Decimal('0'), 'cuda.shares': Decimal('0'), 'rocm.devices': Decimal('0'), }), occupied_slots=ResourceSlot({ 'cpu': Decimal('3.0'), 'mem': Decimal('2560'), 'cuda.shares': Decimal('1.0'), 'rocm.devices': Decimal('8'), }), ), ] pending_kernel_ids: Sequence[KernelId] = [ KernelId(uuid.uuid4()) for _ in range(3) ] existing_kernel_ids: Sequence[KernelId] = [ KernelId(uuid.uuid4()) for _ in range(3) ] _common_dummy_for_pending_session: Mapping[str, Any] = dict( image_ref=ImageRef('lablup/python:3.6-ubunt18.04'), domain_name='default', group_id=example_group_id, resource_policy={}, resource_opts={}, mounts=[], mount_map={}, environ={}, bootstrap_script=None, startup_command=None, internal_data=None, preopen_ports=[], ) _common_dummy_for_existing_session: Mapping[str, Any] = dict( image_ref=ImageRef('lablup/python:3.6-ubunt18.04'), domain_name='default', group_id=example_group_id, ) @pytest.fixture def example_pending_sessions(): # lower indicies are enqueued first. return [ PendingSession( # rocm kernel_id=pending_kernel_ids[0], access_key=AccessKey('user01'), session_name='es01', session_type=SessionTypes.BATCH, scaling_group='sg01', requested_slots=ResourceSlot({ 'cpu': Decimal('2.0'), 'mem': Decimal('1024'), 'cuda.shares': Decimal('0'), 'rocm.devices': Decimal('1'), }), target_sgroup_names=[], **_common_dummy_for_pending_session, ), PendingSession( # cuda kernel_id=pending_kernel_ids[1], access_key=AccessKey('user02'), session_name='es01', session_type=SessionTypes.BATCH, scaling_group='sg01', requested_slots=ResourceSlot({ 'cpu': Decimal('1.0'), 'mem': Decimal('2048'), 'cuda.shares': Decimal('0.5'), 'rocm.devices': Decimal('0'), }), target_sgroup_names=[], **_common_dummy_for_pending_session, ), PendingSession( # cpu-only kernel_id=pending_kernel_ids[2], access_key=AccessKey('user03'), session_name='es01', session_type=SessionTypes.BATCH, scaling_group='sg01', requested_slots=ResourceSlot({ 'cpu': Decimal('1.0'), 'mem': Decimal('1024'), 'cuda.shares': Decimal('0'), 'rocm.devices': Decimal('0'), }), target_sgroup_names=[], **_common_dummy_for_pending_session, ), ] @pytest.fixture def example_existing_sessions(): return [ ExistingSession( kernel_id=existing_kernel_ids[0], access_key=AccessKey('user01'), session_name='es01', session_type=SessionTypes.BATCH, occupying_slots=ResourceSlot({ 'cpu': Decimal('3.0'), 'mem': Decimal('1024'), 'cuda.shares': Decimal('0'), 'rocm.devices': Decimal('1'), }), scaling_group='sg01', **_common_dummy_for_existing_session, ), ExistingSession( kernel_id=existing_kernel_ids[1], access_key=AccessKey('user02'), session_name='es01', session_type=SessionTypes.BATCH, occupying_slots=ResourceSlot({ 'cpu': Decimal('1.0'), 'mem': Decimal('2048'), 'cuda.shares': Decimal('0.5'), 'rocm.devices': Decimal('0'), }), scaling_group='sg01', **_common_dummy_for_existing_session, ), ExistingSession( kernel_id=existing_kernel_ids[2], access_key=AccessKey('user03'), session_name='es01', session_type=SessionTypes.BATCH, occupying_slots=ResourceSlot({ 'cpu': Decimal('4.0'), 'mem': Decimal('4096'), 'cuda.shares': Decimal('0'), 'rocm.devices': Decimal('0'), }), scaling_group='sg01', **_common_dummy_for_existing_session, ), ] def _find_and_pop_picked_session(pending_sessions, picked_session_id): for picked_idx, pending_sess in enumerate(pending_sessions): if pending_sess.kernel_id == picked_session_id: break else: # no matching entry for picked session? raise RuntimeError('should not reach here') return pending_sessions.pop(picked_idx) def test_fifo_scheduler(example_agents, example_pending_sessions, example_existing_sessions): scheduler = FIFOSlotScheduler({}) picked_session_id = scheduler.pick_session( example_total_capacity, example_pending_sessions, example_existing_sessions) assert picked_session_id == example_pending_sessions[0].kernel_id picked_session = _find_and_pop_picked_session( example_pending_sessions, picked_session_id) agent_id = scheduler.assign_agent(example_agents, picked_session) assert agent_id == AgentId('i-001') def test_lifo_scheduler(example_agents, example_pending_sessions, example_existing_sessions): scheduler = LIFOSlotScheduler({}) picked_session_id = scheduler.pick_session( example_total_capacity, example_pending_sessions, example_existing_sessions) assert picked_session_id == example_pending_sessions[2].kernel_id picked_session = _find_and_pop_picked_session( example_pending_sessions, picked_session_id) agent_id = scheduler.assign_agent(example_agents, picked_session) assert agent_id == 'i-001' def test_fifo_scheduler_favor_cpu_for_requests_without_accelerators( example_mixed_agents, example_pending_sessions, ): scheduler = FIFOSlotScheduler({}) for idx in range(3): picked_session_id = scheduler.pick_session( example_total_capacity, example_pending_sessions, []) assert picked_session_id == example_pending_sessions[0].kernel_id picked_session = _find_and_pop_picked_session( example_pending_sessions, picked_session_id) agent_id = scheduler.assign_agent(example_mixed_agents, picked_session) if idx == 0: # example_mixed_agents do not have any agent with ROCM accelerators. assert agent_id is None elif idx == 1: assert agent_id == AgentId('i-gpu') elif idx == 2: # It should favor the CPU-only agent if the requested slots # do not include accelerators. assert agent_id == AgentId('i-cpu') def test_lifo_scheduler_favor_cpu_for_requests_without_accelerators( example_mixed_agents, example_pending_sessions, ): # Check the reverse with the LIFO scheduler. # The result must be same. scheduler = LIFOSlotScheduler({}) for idx in range(3): picked_session_id = scheduler.pick_session( example_total_capacity, example_pending_sessions, []) assert picked_session_id == example_pending_sessions[-1].kernel_id picked_session = _find_and_pop_picked_session( example_pending_sessions, picked_session_id) agent_id = scheduler.assign_agent(example_mixed_agents, picked_session) if idx == 2: # example_mixed_agents do not have any agent with ROCM accelerators. assert agent_id is None elif idx == 1: assert agent_id == AgentId('i-gpu') elif idx == 0: # It should favor the CPU-only agent if the requested slots # do not include accelerators. assert agent_id == AgentId('i-cpu') def test_drf_scheduler(example_agents, example_pending_sessions, example_existing_sessions): scheduler = DRFScheduler({}) picked_session_id = scheduler.pick_session( example_total_capacity, example_pending_sessions, example_existing_sessions) pprint(example_pending_sessions) assert picked_session_id == example_pending_sessions[1].kernel_id picked_session = _find_and_pop_picked_session( example_pending_sessions, picked_session_id) agent_id = scheduler.assign_agent(example_agents, picked_session) assert agent_id == 'i-001' def test_mof_scheduler_first_assign(example_agents, example_pending_sessions, example_existing_sessions): scheduler = MOFScheduler({}) picked_session_id = scheduler.pick_session( example_total_capacity, example_pending_sessions, example_existing_sessions) assert picked_session_id == example_pending_sessions[0].kernel_id picked_session = _find_and_pop_picked_session( example_pending_sessions, picked_session_id) agent_id = scheduler.assign_agent(example_agents, picked_session) assert agent_id == 'i-001' def test_mof_scheduler_second_assign(example_agents_first_one_assigned, example_pending_sessions, example_existing_sessions): scheduler = MOFScheduler({}) picked_session_id = scheduler.pick_session( example_total_capacity, example_pending_sessions, example_existing_sessions) assert picked_session_id == example_pending_sessions[0].kernel_id picked_session = _find_and_pop_picked_session( example_pending_sessions, picked_session_id) agent_id = scheduler.assign_agent( example_agents_first_one_assigned, picked_session) assert agent_id == 'i-101' def test_mof_scheduler_no_valid_agent(example_agents_no_valid, example_pending_sessions, example_existing_sessions): scheduler = MOFScheduler({}) picked_session_id = scheduler.pick_session( example_total_capacity, example_pending_sessions, example_existing_sessions) assert picked_session_id == example_pending_sessions[0].kernel_id picked_session = _find_and_pop_picked_session( example_pending_sessions, picked_session_id) agent_id = scheduler.assign_agent(example_agents_no_valid, picked_session) assert agent_id is None # TODO: write tests for multiple agents and scaling groups
lablup/sorna-manager
tests/manager/test_scheduler.py
Python
lgpl-3.0
16,173
////////////////////////////////////////////////////////////////////////////////////// // // // Copyright (c) 2016-2017 Leonardo Consoni <consoni_2519@hotmail.com> // // // // This file is part of Robot Control Library. // // // // Robot Control 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 3 of the License, or // // (at your option) any later version. // // // // Robot Control 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 Robot Control Library. If not, see <http://www.gnu.org/licenses/>. // // // ////////////////////////////////////////////////////////////////////////////////////// /// @file sensors.h /// @brief Generic sensor (measure reading) functions /// /// Interface for configurable sensor reading and control. Specific underlying implementation and further configuration are defined as explained in @ref sensor_config /// @page sensor_config Sensor Configuration /// The sensor-level configuration (see @ref configuration_levels) is read using the [data I/O implementation currently defined](https://bitiquinho.github.io/Platform-Utils/structDataIO.html). Internal conversion curve, if needed, is defined according to @ref curve_config /// /// Any configuration file/location path must be provided without its format extension, and relative to CONFIG_DIR/sensors/, where CONFIG_DIR is the [defined base data path](https://bitiquinho.github.io/Platform-Utils/classDATA__IO__INTERFACE.html) /// /// The possible configuration fields and their values are here exemplified for the case of a JSON format configuration: /// @code /// { /// "input_interface": { // Hardware/virtual interface properties /// "type": "<library_names>", // Path (without extension) to plugin with signal input implementation (loaded from MODULES_DIR/signal_io/) /// "config": "...", // Signal input/output device identifier passed to plugin initialization call /// "channel": 0 // Device channel from which input values will be read /// }, /// "input_gain": { // Signal scaling parameters /// "multiplier": 1.0, // Value that multiplies the signal value /// "divisor": 1.0 // Value that divides the signal value /// }, /// "signal_processing": { // Internal signal processor options /// "rectified": false, // Rectify signal if true /// "normalized": false, // Normalize signal (after calibration) if true /// "smoothing_frequency": -1.0 // Low-pass filter cut frequency, relative to (factor of) the sampling frequency (negative for no smoothing) /// }, /// "relative_to": "<sensor_identifier>", // String identifier (file name) or data object of configuration for measure reference sensor, if any /// "conversion_curve": { // Curve configuration string identifier or data object, if needed for more complex relation between raw and processed values /// "segments": [ // List of segments that compose the entire curve /// { /// "type": "polynomial", // Segment defined by a polynomial expression /// "bounds": [ -0.5, -0.0032 ], // Limits of segment function domain /// "parameters": [ -652.05, -0.3701 ] // Polynom coefficients (from bigger to lower order) /// }, /// { /// "type": "cubic_spline", // Segment defined by cubic (4 coefficients) spline points /// "bounds": [ -0.0032, 0.0032 ], // Limits of segment function domain /// "parameters": [ 1.7165, -652.05, -1.5608, -671.77 ] // Function value and derivative (respectively) on each spline bound /// } /// ], /// "scale_factor": 1.0 // Multiply curve value by a factor /// }, /// "log_data": false // Set true to save signal reading log to LOGS_DIR/signal_io /// } /// @endcode #ifndef SENSORS_H #define SENSORS_H #include "signal_processing.h" #include "data_io.h" typedef struct _SensorData SensorData; ///< Single sensor internal data structure typedef SensorData* Sensor; ///< Opaque reference to sensor internal data structure /// @brief Creates and initializes sensor data structure based on given information /// @param[in] configuration reference to data object containing configuration parameters, as explained at @ref sensor_config /// @return reference/pointer to newly created and initialized sensor data structure Sensor Sensor_Init( DataHandle configuration ); /// @brief Deallocates internal data of given sensor /// @param[in] sensor reference to sensor void Sensor_End( Sensor sensor ); /// @brief Performs single reading and processing of signal measured by given sensor /// @param[in] sensor reference to sensor /// @param[out] rawBuffer pointer to preallocated buffer to hold all original raw samples (size returned by GetInputBufferLength()) acquired by underlying signal reading implementation (NULL, if not needed) /// @return current value of processed signal (0.0 on erros) double Sensor_Update( Sensor sensor, double* rawBuffer ); /// @brief Gets length of internal raw input samples buffer for given sensor /// @param[in] sensor reference to sensor /// @return size (in elements) of internal input buffer size_t Sensor_GetInputBufferLength( Sensor sensor ); /// @brief Calls underlying signal reading implementation to check for errors on given sensor /// @param[in] sensor reference to sensor /// @return true on detected error, false otherwise bool Sensor_HasError( Sensor sensor ); /// @brief Resets signal processing state and possible sensor device errors /// @param[in] sensor reference to sensor void Sensor_Reset( Sensor sensor ); /// @brief Sets current processing phase/state/mode of given sensor /// @param[in] sensor reference to sensor /// @param[in] newProcessingState desired signal processing phase void Sensor_SetState( Sensor sensor, enum SigProcState newProcessingState ); #endif // SENSORS_H
Bitiquinho/Robot-Control-OpenSim
sensors.h
C
lgpl-3.0
7,676