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
# notepad-onthecloud A notepad clone using ASP.NET technology. Basic function only supported. More information, visit https://ijat.my/notepad-onthecloud
ijat/notepad-onthecloud
README.md
Markdown
gpl-3.0
153
/* * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package mp.teardrop; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; import android.widget.Scroller; /** * Displays a flingable/draggable View of cover art/song info images * generated by CoverBitmap. */ public final class CoverView extends View implements Handler.Callback { /** * The system-provided snap velocity, used as a threshold for detecting * flings. */ private static int sSnapVelocity = -1; /** * The screen density, from {@link DisplayMetrics#density}. */ private static double sDensity = -1; /** * The Handler with which to do background work. Will be null until * setupHandler is called. */ private Handler mHandler; /** * A handler running on the UI thread, for UI operations. */ private final Handler mUiHandler = new Handler(this); /** * How to render cover art and metadata. One of * CoverBitmap.STYLE_* */ private int mCoverStyle; /** * Interface to respond to CoverView motion actions. */ public interface Callback { /** * Called after the view has scrolled to the previous or next cover. * * @param delta -1 for the previous cover, 1 for the next. */ public void shiftCurrentSong(int delta); /** * Called when the user has swiped up on the view. */ public void upSwipe(); /** * Called when the user has swiped down on the view. */ public void downSwipe(); } /** * The instance of the callback. */ private Callback mCallback; /** * The current set of songs: 0 = previous, 1 = current, and 2 = next. */ private Song[] mSongs = new Song[3]; /** * The covers for the current songs: 0 = previous, 1 = current, and 2 = next. */ private Bitmap[] mBitmaps = new Bitmap[3]; /** * The bitmaps to be drawn. Usually the same as mBitmaps, unless scrolling. */ private Bitmap[] mActiveBitmaps = mBitmaps; /** * Cover art to use when a song has no cover art in no info display styles. */ private Bitmap mDefaultCover; /** * Computes scroll animations. */ private final Scroller mScroller; /** * Computes scroll velocity to detect flings. */ private VelocityTracker mVelocityTracker; /** * The x coordinate of the last touch down or move event. */ private float mLastMotionX; /** * The y coordinate of the last touch down or move event. */ private float mLastMotionY; /** * The x coordinate of the last touch down event. */ private float mStartX; /** * The y coordinate of the last touch down event. */ private float mStartY; /** * Ignore the next pointer up event, for long presses. */ private boolean mIgnoreNextUp; /** * If true, querySongs was called before the view initialized and should * be called when initialization finishes. */ private boolean mPendingQuery; /** * The current x scroll position of the view. * * Scrolling code from {@link View} is not used for this class since many of * its features are not required. */ private int mScrollX; /** * True if a scroll is in progress (i.e. mScrollX != getWidth()), false * otherwise. */ private boolean mScrolling; /** * Constructor intended to be called by inflating from XML. */ public CoverView(Context context, AttributeSet attributes) { super(context, attributes); mScroller = new Scroller(context); if (sSnapVelocity == -1) { sSnapVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity(); sDensity = context.getResources().getDisplayMetrics().density; } } /** * Setup the Handler and callback. This must be called before * the CoverView is used. * * @param looper A looper created on a worker thread. * @param callback The callback for nextSong/previousSong * @param style One of CoverBitmap.STYLE_* */ public void setup(Looper looper, Callback callback, int style) { mHandler = new Handler(looper, this); mCallback = callback; mCoverStyle = style; } /** * Reset the scroll position to its default state. */ private void resetScroll() { if (!mScroller.isFinished()) mScroller.abortAnimation(); mScrollX = getWidth(); invalidate(); } @Override protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { if (mPendingQuery && width != 0 && height != 0) { mPendingQuery = false; querySongs(PlaybackService.get(getContext())); } } /** * Paint the cover art views to the canvas. */ @Override protected void onDraw(Canvas canvas) { int width = getWidth(); int height = getHeight(); int x = 0; int scrollX = mScrollX; canvas.drawColor(Color.BLACK); for (Bitmap bitmap : mActiveBitmaps) { if (bitmap != null && scrollX + width > x && scrollX < x + width) { int xOffset = (width - bitmap.getWidth()) / 2; int yOffset = (height - bitmap.getHeight()) / 2; canvas.drawBitmap(bitmap, x + xOffset - scrollX, yOffset, null); } x += width; } } /** * Scrolls the view when dragged. Animates a fling to one of the three covers * when finished. The cover flung to will be either the nearest cover, or if * the fling is fast enough, the cover in the direction of the fling. * * Also performs a click on the view when it is tapped without dragging. */ @Override public boolean onTouchEvent(MotionEvent ev) { if (mVelocityTracker == null) mVelocityTracker = VelocityTracker.obtain(); mVelocityTracker.addMovement(ev); float x = ev.getX(); float y = ev.getY(); int scrollX = mScrollX; int width = getWidth(); switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: if (!mScroller.isFinished()) { mScroller.abortAnimation(); mActiveBitmaps = mBitmaps; } mStartX = x; mStartY = y; mLastMotionX = x; mLastMotionY = y; mScrolling = true; mUiHandler.sendEmptyMessageDelayed(MSG_LONG_CLICK, ViewConfiguration.getLongPressTimeout()); break; case MotionEvent.ACTION_MOVE: { float deltaX = mLastMotionX - x; float deltaY = mLastMotionY - y; if (Math.abs(deltaX) > Math.abs(deltaY)) { if (deltaX < 0) { int availableToScroll = scrollX - (mSongs[0] == null ? width : 0); if (availableToScroll > 0) { mScrollX += Math.max(-availableToScroll, (int)deltaX); invalidate(); } } else if (deltaX > 0) { int availableToScroll = width * 2 - scrollX; if (availableToScroll > 0) { mScrollX += Math.min(availableToScroll, (int)deltaX); invalidate(); } } } mLastMotionX = x; mLastMotionY = y; break; } case MotionEvent.ACTION_UP: { mUiHandler.removeMessages(MSG_LONG_CLICK); VelocityTracker velocityTracker = mVelocityTracker; velocityTracker.computeCurrentVelocity(250); int velocityX = (int) velocityTracker.getXVelocity(); int velocityY = (int) velocityTracker.getYVelocity(); int mvx = Math.abs(velocityX); int mvy = Math.abs(velocityY); // If -1 or 1, play the previous or next song, respectively and scroll // to that song's cover. If 0, just scroll back to current song's cover. int whichCover = 0; int min = mSongs[0] == null ? 0 : -1; int max = 1; if (Math.abs(mStartX - x) + Math.abs(mStartY - y) < 10) { // A long press was performed and thus the normal action should // not be executed. if (mIgnoreNextUp) mIgnoreNextUp = false; else performClick(); } else if (mvx > sSnapVelocity || mvy > sSnapVelocity) { if (mvy > mvx) { if (velocityY > 0) mCallback.downSwipe(); else mCallback.upSwipe(); } else { if (velocityX > 0) whichCover = min; else whichCover = max; } } else { int nearestCover = (scrollX + width / 2) / width - 1; whichCover = Math.max(min, Math.min(nearestCover, max)); } if (whichCover != 0) { scrollX = scrollX - width * whichCover; Bitmap[] bitmaps = mBitmaps; // Save the two covers being scrolled between, so that if one // of them changes from switching songs (which can happen when // shuffling), the new cover doesn't pop in during the scroll. // mActiveBitmaps is reset when the scroll is finished. if (whichCover == 1) { mActiveBitmaps = new Bitmap[] { bitmaps[1], bitmaps[2], null }; } else { mActiveBitmaps = new Bitmap[] { null, bitmaps[0], bitmaps[1] }; } mCallback.shiftCurrentSong(whichCover); mScrollX = scrollX; } int delta = width - scrollX; mScroller.startScroll(scrollX, 0, delta, 0, (int)(Math.abs(delta) * 2 / sDensity)); mUiHandler.sendEmptyMessage(MSG_SCROLL); if (mVelocityTracker != null) { mVelocityTracker.recycle(); mVelocityTracker = null; } break; } } return true; } /** * Generates a bitmap for the given song. * * @param i The position of the song in mSongs. */ private void generateBitmap(int i) { Song song = mSongs[i]; int style = mCoverStyle; Context context = getContext(); Bitmap cover = song == null ? null : song.getCover(context); if (cover == null && style == CoverBitmap.STYLE_NO_INFO) { Bitmap def = mDefaultCover; if (def == null) { //mDefaultCover = def = CoverBitmap.generateDefaultCover(getWidth(), getHeight()); mDefaultCover = def = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.fallback_cover); } mBitmaps[i] = def; } else { mBitmaps[i] = CoverBitmap.createBitmap(context, style, cover, song, getWidth(), getHeight()); } postInvalidate(); } /** * Set the Song at position <code>i</code> to <code>song</code>, generating * the bitmap for it in the background if needed. */ public void setSong(int i, Song song) { if (song == mSongs[i]) return; mSongs[i] = song; mBitmaps[i] = null; if (song != null) { mHandler.sendMessage(mHandler.obtainMessage(MSG_GENERATE_BITMAP, i, 0)); } } /** * Query all songs. Must be called on the UI thread. * * @param service Service to query from. */ public void querySongs(PlaybackService service) { if (getWidth() == 0 || getHeight() == 0) { mPendingQuery = true; return; } mHandler.removeMessages(MSG_GENERATE_BITMAP); Song[] songs = mSongs; Bitmap[] bitmaps = mBitmaps; Song[] newSongs = { service.getSong(-1), service.getSong(0), service.getSong(1) }; Bitmap[] newBitmaps = new Bitmap[3]; mSongs = newSongs; mBitmaps = newBitmaps; if (!mScrolling) mActiveBitmaps = newBitmaps; for (int i = 0; i != 3; ++i) { if (newSongs[i] == null) continue; for (int j = 0; j != 3; ++j) { if (newSongs[i] == songs[j]) { newBitmaps[i] = bitmaps[j]; break; } } if (newBitmaps[i] == null) { mHandler.sendMessage(mHandler.obtainMessage(MSG_GENERATE_BITMAP, i, 0)); } } resetScroll(); } /** * Call {@link CoverView#generateBitmap(int)} for the song at the given index. * * arg1 should be the index of the song. */ private static final int MSG_GENERATE_BITMAP = 0; /** * Perform a long click. * * @see View#performLongClick() */ private static final int MSG_LONG_CLICK = 2; /** * Update position for fling scroll animation and, when it is finished, * notify PlaybackService that the user has requested a track change and * update the cover art views. Will resend message until scrolling is * finished. */ private static final int MSG_SCROLL = 3; @Override public boolean handleMessage(Message message) { switch (message.what) { case MSG_GENERATE_BITMAP: generateBitmap(message.arg1); break; case MSG_LONG_CLICK: if (Math.abs(mStartX - mLastMotionX) + Math.abs(mStartY - mLastMotionY) < 10) { mIgnoreNextUp = true; performLongClick(); } break; case MSG_SCROLL: if (mScroller.computeScrollOffset()) { mScrollX = mScroller.getCurrX(); invalidate(); mUiHandler.sendEmptyMessage(MSG_SCROLL); } else { mScrolling = false; mActiveBitmaps = mBitmaps; } break; default: return false; } return true; } @Override protected void onMeasure(int widthSpec, int heightSpec) { // This implementation only tries to handle two cases: use in the // FullPlaybackActivity, where we want to fill the whole screen, // and use in the MiniPlaybackActivity, where we want to be square. int width = View.MeasureSpec.getSize(widthSpec); int height = View.MeasureSpec.getSize(heightSpec); if (View.MeasureSpec.getMode(widthSpec) == View.MeasureSpec.EXACTLY && View.MeasureSpec.getMode(heightSpec) == View.MeasureSpec.EXACTLY) { // FullPlaybackActivity: fill screen setMeasuredDimension(width, height); } else { // MiniPlaybackActivity: be square int size = Math.min(width, height); setMeasuredDimension(size, size); } } }
owoc/teardrop
app/src/main/java/mp/teardrop/CoverView.java
Java
gpl-3.0
14,674
<!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_18) on Sun Mar 21 10:29:32 CDT 2010 --> <TITLE> cern.jet.random.tdouble.engine (Parallel Colt 0.9.4 - API Specification) </TITLE> <META NAME="date" CONTENT="2010-03-21"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> </HEAD> <BODY BGCOLOR="white"> <FONT size="+1" CLASS="FrameTitleFont"> <A HREF="../../../../../cern/jet/random/tdouble/engine/package-summary.html" target="classFrame">cern.jet.random.tdouble.engine</A></FONT> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont"> Interfaces</FONT>&nbsp; <FONT CLASS="FrameItemFont"> <BR> <A HREF="RandomGenerator.html" title="interface in cern.jet.random.tdouble.engine" target="classFrame"><I>RandomGenerator</I></A></FONT></TD> </TR> </TABLE> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont"> Classes</FONT>&nbsp; <FONT CLASS="FrameItemFont"> <BR> <A HREF="DoubleMersenneTwister.html" title="class in cern.jet.random.tdouble.engine" target="classFrame">DoubleMersenneTwister</A> <BR> <A HREF="DoubleRandomEngine.html" title="class in cern.jet.random.tdouble.engine" target="classFrame">DoubleRandomEngine</A> <BR> <A HREF="DRand.html" title="class in cern.jet.random.tdouble.engine" target="classFrame">DRand</A> <BR> <A HREF="MersenneTwister64.html" title="class in cern.jet.random.tdouble.engine" target="classFrame">MersenneTwister64</A> <BR> <A HREF="RandomSeedGenerator.html" title="class in cern.jet.random.tdouble.engine" target="classFrame">RandomSeedGenerator</A> <BR> <A HREF="RandomSeedTable.html" title="class in cern.jet.random.tdouble.engine" target="classFrame">RandomSeedTable</A></FONT></TD> </TR> </TABLE> </BODY> </HTML>
Shappiro/GEOFRAME
PROJECTS/oms3.proj.richards1d/src/JAVA/ParallelColt/doc/cern/jet/random/tdouble/engine/package-frame.html
HTML
gpl-3.0
1,969
# Create ovs bridge, add eth0: ovs-vsctl add-br br-eth0 # Set IP configuration to ovs bridge interface (br-eth0) instead of eth0 and restart network after settings are changed # Consider setting MTU to 1546 to interface or reduce it to 1454 in the domains ovs-vsctl add-port br-eth0 eth0 && service network restart # Create internal ovs bridge and set GRE tunnel endpoints: ovs-vsctl add-br br-int0 ovs-vsctl add-port br-int0 gre0 -- set interface gre0 type=gre options:remote_ip=192.168.2.1 ovs-vsctl add-port br-int0 gre1 -- set interface gre1 type=gre options:remote_ip=192.168.2.3 # Enable STP (needed for more than 2 hosts): ovs-vsctl set bridge br-int0 stp_enable=true # Endpoints for the GRE tunnels can be set in VMs with libvirt as described in libvirt-vlans.xml.example # Local endpoints on hosts can be set too. For example if we need VLAN support: ovs-vsctl add-port br-int0 vlan100 tag=100 -- set Interface vlan100 type=internal ifconfig vlan100 172.16.0.5
racedo/vLab-Files
GRE Tunnels/create-gre-tunnel.sh
Shell
gpl-3.0
976
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Con_contactus extends Con_root { var $table = "citemplate_contactus"; var $pk = "contactus_id_pk"; var $name = "contactus_name"; var $message = "contactus_message"; var $phone = "contactus_phone"; var $email = "contactus_email"; var $fk_lookup_status = "contactus_lookup_status_id_fk"; var $create_date = "contactus_create_date"; //Lookup Group Value var $lookupgroup_status = 5200; //Lookup Action Value var $lookup_status_value = array( 'unread' => 5201, 'read' => 5202, 'reply_email' => 5203, 'reply_phone' => 5204 ); public function __construct() { parent::__construct(); } } /* End of file */
tvalentius/MarsColony
MarsColony/application/models/constant/con_contactus.php
PHP
gpl-3.0
816
/* -*- c++ -*- */ /* * Copyright 2009,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio 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, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef INCLUDED_PMT_SUGAR_H #define INCLUDED_PMT_SUGAR_H /*! * This file is included by pmt.h and contains pseudo-constructor * shorthand for making pmt objects */ #include <ocvc/messages/msg_accepter.h> namespace pmt { //! Make pmt symbol static inline pmt_t mp(const std::string &s) { return string_to_symbol(s); } //! Make pmt symbol static inline pmt_t mp(const char *s) { return string_to_symbol(s); } //! Make pmt long static inline pmt_t mp(long x){ return from_long(x); } //! Make pmt long static inline pmt_t mp(long long unsigned x){ return from_long(x); } //! Make pmt long static inline pmt_t mp(int x){ return from_long(x); } //! Make pmt double static inline pmt_t mp(double x){ return from_double(x); } //! Make pmt complex static inline pmt_t mp(std::complex<double> z) { return make_rectangular(z.real(), z.imag()); } //! Make pmt complex static inline pmt_t mp(std::complex<float> z) { return make_rectangular(z.real(), z.imag()); } //! Make pmt msg_accepter static inline pmt_t mp(boost::shared_ptr<oc::messages::msg_accepter> ma) { return make_msg_accepter(ma); } //! Make pmt Binary Large Object (BLOB) static inline pmt_t mp(const void *data, size_t len_in_bytes) { return make_blob(data, len_in_bytes); } //! Make tuple static inline pmt_t mp(const pmt_t &e0) { return make_tuple(e0); } //! Make tuple static inline pmt_t mp(const pmt_t &e0, const pmt_t &e1) { return make_tuple(e0, e1); } //! Make tuple static inline pmt_t mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2) { return make_tuple(e0, e1, e2); } //! Make tuple static inline pmt_t mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3) { return make_tuple(e0, e1, e2, e3); } //! Make tuple static inline pmt_t mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4) { return make_tuple(e0, e1, e2, e3, e4); } //! Make tuple static inline pmt_t mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5) { return make_tuple(e0, e1, e2, e3, e4, e5); } //! Make tuple static inline pmt_t mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6) { return make_tuple(e0, e1, e2, e3, e4, e5, e6); } //! Make tuple static inline pmt_t mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7) { return make_tuple(e0, e1, e2, e3, e4, e5, e6, e7); } //! Make tuple static inline pmt_t mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8) { return make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8); } //! Make tuple static inline pmt_t mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9) { return make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9); } } /* namespace pmt */ #endif /* INCLUDED_PMT_SUGAR_H */
atzengin/OCC
ocvc-runtime/include/pmt/pmt_sugar.h
C
gpl-3.0
4,168
from discord.ext import commands import discord.utils def is_owner_check(ctx): author = str(ctx.message.author) owner = ctx.bot.config['master'] return author == owner def is_owner(): return commands.check(is_owner_check) def check_permissions(ctx, perms): #if is_owner_check(ctx): # return True if not perms: return False ch = ctx.message.channel author = ctx.message.author resolved = ch.permissions_for(author) return all(getattr(resolved, name, None) == value for name, value in perms.items()) def role_or_permissions(ctx, check, **perms): if check_permissions(ctx, perms): return True ch = ctx.message.channel author = ctx.message.author if ch.is_private: return False # can't have roles in PMs role = discord.utils.find(check, author.roles) return role is not None def serverowner_or_permissions(**perms): def predicate(ctx): owner = ctx.message.server.owner if ctx.message.author.id == owner.id: return True return check_permissions(ctx,perms) return commands.check(predicate) def serverowner(): return serverowner_or_permissions() def check_wantchannel(ctx): if ctx.message.server is None: return False channel = ctx.message.channel server = ctx.message.server try: want_channels = ctx.bot.server_dict[server]['want_channel_list'] except KeyError: return False if channel in want_channels: return True def check_citychannel(ctx): if ctx.message.server is None: return False channel = ctx.message.channel.name server = ctx.message.server try: city_channels = ctx.bot.server_dict[server]['city_channels'].keys() except KeyError: return False if channel in city_channels: return True def check_raidchannel(ctx): if ctx.message.server is None: return False channel = ctx.message.channel server = ctx.message.server try: raid_channels = ctx.bot.server_dict[server]['raidchannel_dict'].keys() except KeyError: return False if channel in raid_channels: return True def check_eggchannel(ctx): if ctx.message.server is None: return False channel = ctx.message.channel server = ctx.message.server try: type = ctx.bot.server_dict[server]['raidchannel_dict'][channel]['type'] except KeyError: return False if type == 'egg': return True def check_raidactive(ctx): if ctx.message.server is None: return False channel = ctx.message.channel server = ctx.message.server try: return ctx.bot.server_dict[server]['raidchannel_dict'][channel]['active'] except KeyError: return False def check_raidset(ctx): if ctx.message.server is None: return False server = ctx.message.server try: return ctx.bot.server_dict[server]['raidset'] except KeyError: return False def check_wildset(ctx): if ctx.message.server is None: return False server = ctx.message.server try: return ctx.bot.server_dict[server]['wildset'] except KeyError: return False def check_wantset(ctx): if ctx.message.server is None: return False server = ctx.message.server try: return ctx.bot.server_dict[server]['wantset'] except KeyError: return False def check_teamset(ctx): if ctx.message.server is None: return False server = ctx.message.server try: return ctx.bot.server_dict[server]['team'] except KeyError: return False def teamset(): def predicate(ctx): return check_teamset(ctx) return commands.check(predicate) def wantset(): def predicate(ctx): return check_wantset(ctx) return commands.check(predicate) def wildset(): def predicate(ctx): return check_wildset(ctx) return commands.check(predicate) def raidset(): def predicate(ctx): return check_raidset(ctx) return commands.check(predicate) def citychannel(): def predicate(ctx): return check_citychannel(ctx) return commands.check(predicate) def wantchannel(): def predicate(ctx): if check_wantset(ctx): return check_wantchannel(ctx) return commands.check(predicate) def raidchannel(): def predicate(ctx): return check_raidchannel(ctx) return commands.check(predicate) def notraidchannel(): def predicate(ctx): return not check_raidchannel(ctx) return commands.check(predicate) def activeraidchannel(): def predicate(ctx): if check_raidchannel(ctx): return check_raidactive(ctx) return commands.check(predicate) def cityraidchannel(): def predicate(ctx): if check_raidchannel(ctx) == True: return True elif check_citychannel(ctx) == True: return True return commands.check(predicate) def cityeggchannel(): def predicate(ctx): if check_raidchannel(ctx) == True: if check_eggchannel(ctx) == True: return True elif check_citychannel(ctx) == True: return True return commands.check(predicate)
Jonqora/whiskers
checks.py
Python
gpl-3.0
5,290
using System; using System.Threading; using Hangfire.Server; using Hangfire.States; using Hangfire.Storage; using Moq; using Xunit; namespace Hangfire.Core.Tests.Server { public class SchedulePollerFacts { private const string JobId = "id"; private readonly Mock<JobStorage> _storage; private readonly Mock<IStorageConnection> _connection; private readonly Mock<IStateMachine> _stateMachine; private readonly Mock<IStateMachineFactory> _stateMachineFactory; private readonly CancellationTokenSource _cts; public SchedulePollerFacts() { _storage = new Mock<JobStorage>(); _connection = new Mock<IStorageConnection>(); _stateMachine = new Mock<IStateMachine>(); _cts = new CancellationTokenSource(); _cts.Cancel(); _stateMachineFactory = new Mock<IStateMachineFactory>(); _stateMachineFactory.Setup(x => x.Create(It.IsNotNull<IStorageConnection>())) .Returns(_stateMachine.Object); _storage.Setup(x => x.GetConnection()).Returns(_connection.Object); _connection.Setup(x => x.GetFirstByLowestScoreFromSet( "schedule", 0, It.Is<double>(time => time > 0))).Returns(JobId); } [Fact] public void Ctor_ThrowsAnException_WhenStorageIsNull() { var exception = Assert.Throws<ArgumentNullException>( () => new SchedulePoller( null, _stateMachineFactory.Object, Timeout.InfiniteTimeSpan)); Assert.Equal("storage", exception.ParamName); } [Fact] public void Ctor_ThrowsAnException_WhenStateMachineFactoryIsNull() { var exception = Assert.Throws<ArgumentNullException>( () => new SchedulePoller( _storage.Object, null, Timeout.InfiniteTimeSpan)); Assert.Equal("stateMachineFactory", exception.ParamName); } [Fact] public void Execute_TakesConnectionAndDisposesIt() { var scheduler = CreateScheduler(); scheduler.Execute(_cts.Token); _storage.Verify(x => x.GetConnection()); _connection.Verify(x => x.Dispose()); } [Fact] public void Execute_MovesJobStateToEnqueued() { var scheduler = CreateScheduler(); scheduler.Execute(_cts.Token); _stateMachine.Verify(x => x.TryToChangeState( JobId, It.IsAny<EnqueuedState>(), new[] { ScheduledState.StateName })); } [Fact] public void Execute_DoesNotCallStateMachine_IfThereAreNoJobsToEnqueue() { _connection.Setup(x => x.GetFirstByLowestScoreFromSet( "schedule", 0, It.Is<double>(time => time > 0))).Returns((string)null); var scheduler = CreateScheduler(); scheduler.Execute(_cts.Token); _stateMachine.Verify( x => x.TryToChangeState(It.IsAny<string>(), It.IsAny<IState>(), It.IsAny<string[]>()), Times.Never); } private SchedulePoller CreateScheduler() { return new SchedulePoller(_storage.Object, _stateMachineFactory.Object, Timeout.InfiniteTimeSpan); } } }
andrecarlucci/Hangfire
tests/Hangfire.Core.Tests/Server/SchedulePollerFacts.cs
C#
gpl-3.0
3,325
/* RetroArch - A frontend for libretro. * Copyright (C) 2015-2017 - Sergi Granell (xerpi) * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. * * RetroArch 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 RetroArch. * If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <gccore.h> #include <rthreads/rthreads.h> #include "../input_defines.h" #include "../input_driver.h" #include "../connect/joypad_connection.h" #include "../../tasks/tasks_internal.h" #include "../../verbosity.h" #define WIIUSB_SC_NONE 0 #define WIIUSB_SC_INTMSG 1 #define WIIUSB_SC_CTRLMSG 2 #define WIIUSB_SC_CTRLMSG2 3 typedef struct wiiusb_hid { joypad_connection_t *connections; struct wiiusb_adapter *adapters_head; sthread_t *poll_thread; volatile bool poll_thread_quit; /* helps on knowing if a new device has been inserted */ bool device_detected; /* helps on detecting that a device has just been removed */ bool removal_cb; bool manual_removal; } wiiusb_hid_t; struct wiiusb_adapter { wiiusb_hid_t *hid; struct wiiusb_adapter *next; bool busy; int32_t device_id; int32_t handle; int32_t endpoint_in; int32_t endpoint_out; int32_t endpoint_in_max_size; int32_t endpoint_out_max_size; int32_t slot; uint8_t *data; uint8_t send_control_type; uint8_t *send_control_buffer; uint32_t send_control_size; }; static void wiiusb_hid_process_control_message(struct wiiusb_adapter* adapter) { int32_t r; switch (adapter->send_control_type) { case WIIUSB_SC_INTMSG: do { r = USB_WriteIntrMsg(adapter->handle, adapter->endpoint_out, adapter->send_control_size, adapter->send_control_buffer); } while (r < 0); break; case WIIUSB_SC_CTRLMSG: do { r = USB_WriteCtrlMsg(adapter->handle, USB_REQTYPE_INTERFACE_SET, USB_REQ_SETREPORT, (USB_REPTYPE_FEATURE<<8) | 0xf4, 0x0, adapter->send_control_size, adapter->send_control_buffer); } while (r < 0); break; case WIIUSB_SC_CTRLMSG2: do { r = USB_WriteCtrlMsg(adapter->handle, USB_REQTYPE_INTERFACE_SET, USB_REQ_SETREPORT, (USB_REPTYPE_OUTPUT<<8) | 0x01, 0x0, adapter->send_control_size, adapter->send_control_buffer); } while (r < 0); break; /*default: any other case we do nothing */ } /* Reset the control type */ adapter->send_control_type = WIIUSB_SC_NONE; } static int32_t wiiusb_hid_read_cb(int32_t size, void *data) { struct wiiusb_adapter *adapter = (struct wiiusb_adapter*)data; wiiusb_hid_t *hid = adapter ? adapter->hid : NULL; if (hid && hid->connections && size > 0) pad_connection_packet(&hid->connections[adapter->slot], adapter->slot, adapter->data-1, size+1); if (adapter) adapter->busy = false; return size; } static void wiiusb_hid_device_send_control(void *data, uint8_t* data_buf, size_t size) { uint8_t control_type; struct wiiusb_adapter *adapter = (struct wiiusb_adapter*)data; if (!adapter || !data_buf || !adapter->send_control_buffer) return; /* first byte contains the type of control to use * which can be NONE, INT_MSG, CTRL_MSG, CTRL_MSG2 */ control_type = data_buf[0]; /* decrement size by one as we are getting rid of first byte */ adapter->send_control_size = size - 1; /* increase the buffer address so we access the actual data */ data_buf++; memcpy(adapter->send_control_buffer, data_buf, adapter->send_control_size); /* Activate it so it can be processed in the adapter thread */ adapter->send_control_type = control_type; } static void wiiusb_hid_device_add_autodetect(unsigned idx, const char *device_name, const char *driver_name, uint16_t dev_vid, uint16_t dev_pid) { if (!input_autoconfigure_connect( device_name, NULL, driver_name, idx, dev_vid, dev_pid)) input_config_set_device_name(idx, device_name); } static void wiiusb_get_description(usb_device_entry *device, struct wiiusb_adapter *adapter, usb_devdesc *devdesc) { unsigned char c; unsigned i, k; for (c = 0; c < devdesc->bNumConfigurations; c++) { const usb_configurationdesc *config = &devdesc->configurations[c]; for (i = 0; i < (int)config->bNumInterfaces; i++) { const usb_interfacedesc *inter = &config->interfaces[i]; for(k = 0; k < (int)inter->bNumEndpoints; k++) { const usb_endpointdesc *epdesc = &inter->endpoints[k]; bool is_int = (epdesc->bmAttributes & 0x03) == USB_ENDPOINT_INTERRUPT; bool is_out = (epdesc->bEndpointAddress & 0x80) == USB_ENDPOINT_OUT; bool is_in = (epdesc->bEndpointAddress & 0x80) == USB_ENDPOINT_IN; if (is_int) { if (is_in) { adapter->endpoint_in = epdesc->bEndpointAddress; adapter->endpoint_in_max_size = epdesc->wMaxPacketSize; } if (is_out) { adapter->endpoint_out = epdesc->bEndpointAddress; adapter->endpoint_out_max_size = epdesc->wMaxPacketSize; } } } break; } } } static const char *wiiusb_hid_joypad_name(void *data, unsigned pad) { wiiusb_hid_t *hid = (wiiusb_hid_t*)data; if (pad >= MAX_USERS) return NULL; if (hid) return pad_connection_get_name(&hid->connections[pad], pad); return NULL; } static int32_t wiiusb_hid_release_adapter(struct wiiusb_adapter *adapter) { wiiusb_hid_t *hid = NULL; const char *name = NULL; if (!adapter) return -1; hid = adapter->hid; name = wiiusb_hid_joypad_name(hid, adapter->slot); input_autoconfigure_disconnect(adapter->slot, name); pad_connection_pad_deinit(&hid->connections[adapter->slot], adapter->slot); free(adapter->send_control_buffer); free(adapter->data); free(adapter); return 0; } static int wiiusb_hid_remove_adapter(struct wiiusb_adapter *adapter) { if (!adapter) return -1; if (adapter->handle > 0) USB_CloseDevice(&adapter->handle); wiiusb_hid_release_adapter(adapter); return 0; } static int wiiusb_hid_removal_cb(int result, void *usrdata) { struct wiiusb_adapter *adapter = (struct wiiusb_adapter *)usrdata; wiiusb_hid_t *hid = adapter ? adapter->hid : NULL; struct wiiusb_adapter *temp = hid ? hid->adapters_head : NULL; if (!adapter || !hid || !temp || hid->manual_removal) return -1; if (temp == adapter) hid->adapters_head = adapter->next; else while (temp->next) { if (temp->next == adapter) { temp->next = adapter->next; break; } temp = temp->next; } /* get rid of the adapter */ wiiusb_hid_release_adapter(adapter); /* notify that we pass thru the removal callback */ hid->removal_cb = true; return 0; } static int wiiusb_hid_add_adapter(void *data, usb_device_entry *dev) { usb_devdesc desc; const char *device_name = NULL; wiiusb_hid_t *hid = (wiiusb_hid_t*)data; struct wiiusb_adapter *adapter = (struct wiiusb_adapter*) calloc(1, sizeof(struct wiiusb_adapter)); if (!adapter) return -1; if (!hid) { free(adapter); RARCH_ERR("Allocation of adapter failed.\n"); return -1; } if (USB_OpenDevice(dev->device_id, dev->vid, dev->pid, &adapter->handle) < 0) { RARCH_ERR("Error opening device 0x%p (VID/PID: %04x:%04x).\n", dev->device_id, dev->vid, dev->pid); free(adapter); return -1; } adapter->device_id = dev->device_id; USB_GetDescriptors(adapter->handle, &desc); wiiusb_get_description(dev, adapter, &desc); if (adapter->endpoint_in == 0) { RARCH_ERR("Could not find HID config for device.\n"); goto error; } /* Allocate mem for the send control buffer, 32bit aligned */ adapter->send_control_type = WIIUSB_SC_NONE; adapter->send_control_buffer = memalign(32, 128); if (!adapter->send_control_buffer) { RARCH_ERR("Error creating send control buffer.\n"); goto error; } /* Sent the pad name as dummy, we don't know the * control name until we get its interface */ adapter->slot = pad_connection_pad_init(hid->connections, "hid", desc.idVendor, desc.idProduct, adapter, &wiiusb_hid_device_send_control); if (adapter->slot == -1) goto error; if (!pad_connection_has_interface(hid->connections, adapter->slot)) { RARCH_ERR(" Interface not found.\n"); goto error; } adapter->data = memalign(32, 128); adapter->hid = hid; adapter->next = hid->adapters_head; hid->adapters_head = adapter; /* Get the name from the interface */ device_name = wiiusb_hid_joypad_name(hid, adapter->slot); RARCH_LOG("Interface found: [%s].\n", device_name); RARCH_LOG("Device 0x%p attached (VID/PID: %04x:%04x).\n", adapter->device_id, desc.idVendor, desc.idProduct); wiiusb_hid_device_add_autodetect(adapter->slot, device_name, wiiusb_hid.ident, desc.idVendor, desc.idProduct); USB_FreeDescriptors(&desc); USB_DeviceRemovalNotifyAsync(adapter->handle, wiiusb_hid_removal_cb, adapter); return 0; error: if (adapter->send_control_buffer) free(adapter->send_control_buffer); if (adapter) free(adapter); USB_FreeDescriptors(&desc); USB_CloseDevice(&adapter->handle); return -1; } static bool wiiusb_hid_new_device(wiiusb_hid_t *hid, int32_t id) { struct wiiusb_adapter *temp; if(!hid) return false; /* false, so we do not proceed to add it */ temp = hid->adapters_head; while (temp) { if (temp->device_id == id) return false; temp = temp->next; } return true; } static void wiiusb_hid_scan_for_devices(wiiusb_hid_t *hid) { unsigned i; u8 count; usb_device_entry *dev_entries = (usb_device_entry *) calloc(MAX_USERS, sizeof(*dev_entries)); if (!dev_entries) goto error; if (USB_GetDeviceList(dev_entries, MAX_USERS, USB_CLASS_HID, &count) < 0) goto error; for (i = 0; i < count; i++) { /* first check the device is not already in our list */ if (!wiiusb_hid_new_device(hid, dev_entries[i].device_id)) continue; if (dev_entries[i].vid > 0 && dev_entries[i].pid > 0) wiiusb_hid_add_adapter(hid, &dev_entries[i]); } error: if (dev_entries) free(dev_entries); } static void wiiusb_hid_poll_thread(void *data) { wiiusb_hid_t *hid = (wiiusb_hid_t*)data; struct wiiusb_adapter *adapter = NULL; if (!hid) return; while (!hid->poll_thread_quit) { /* first check for new devices */ if (hid->device_detected) { /* turn off the detection flag */ hid->device_detected = false; /* search for new pads and add them as needed */ wiiusb_hid_scan_for_devices(hid); } /* process each active adapter */ for (adapter = hid->adapters_head; adapter; adapter=adapter->next) { if (adapter->busy) continue; /* lock itself while writing or reading */ adapter->busy = true; if (adapter->send_control_type) wiiusb_hid_process_control_message(adapter); USB_ReadIntrMsgAsync(adapter->handle, adapter->endpoint_in, adapter->endpoint_in_max_size, adapter->data, wiiusb_hid_read_cb, adapter); } /* Wait 10 milliseconds to process again */ usleep(10000); } } static int wiiusb_hid_change_cb(int result, void *usrdata) { wiiusb_hid_t *hid = (wiiusb_hid_t*)usrdata; if (!hid) return -1; /* As it's not coming from the removal callback then we detected a new device being inserted */ if (!hid->removal_cb) hid->device_detected = true; else hid->removal_cb = false; /* Re-submit the change alert */ USB_DeviceChangeNotifyAsync(USB_CLASS_HID, wiiusb_hid_change_cb, usrdata); return 0; } static bool wiiusb_hid_joypad_query(void *data, unsigned pad) { return pad < MAX_USERS; } static uint64_t wiiusb_hid_joypad_get_buttons(void *data, unsigned port) { wiiusb_hid_t *hid = (wiiusb_hid_t*)data; if (hid) return pad_connection_get_buttons(&hid->connections[port], port); return 0; } static bool wiiusb_hid_joypad_button(void *data, unsigned port, uint16_t joykey) { uint64_t buttons = wiiusb_hid_joypad_get_buttons(data, port); /* Check hat. */ if (GET_HAT_DIR(joykey)) return false; /* Check the button. */ if ((port < MAX_USERS) && (joykey < 32)) return ((buttons & (1 << joykey)) != 0); return false; } static bool wiiusb_hid_joypad_rumble(void *data, unsigned pad, enum retro_rumble_effect effect, uint16_t strength) { wiiusb_hid_t *hid = (wiiusb_hid_t*)data; if (!hid) return false; return pad_connection_rumble(&hid->connections[pad], pad, effect, strength); } static int16_t wiiusb_hid_joypad_axis(void *data, unsigned port, uint32_t joyaxis) { int16_t val = 0; wiiusb_hid_t *hid = (wiiusb_hid_t*)data; if (joyaxis == AXIS_NONE) return 0; if (AXIS_NEG_GET(joyaxis) < 4) { val = pad_connection_get_axis(&hid->connections[port], port, AXIS_NEG_GET(joyaxis)); if (val >= 0) val = 0; } else if(AXIS_POS_GET(joyaxis) < 4) { val = pad_connection_get_axis(&hid->connections[port], port, AXIS_POS_GET(joyaxis)); if (val <= 0) val = 0; } return val; } static void wiiusb_hid_free(void *data) { struct wiiusb_adapter *adapter = NULL; struct wiiusb_adapter *next_adapter = NULL; wiiusb_hid_t *hid = (wiiusb_hid_t*)data; if (!hid) return; hid->poll_thread_quit = true; if (hid->poll_thread) sthread_join(hid->poll_thread); hid->manual_removal = TRUE; /* remove each of the adapters */ for (adapter = hid->adapters_head; adapter; adapter = next_adapter) { next_adapter = adapter->next; wiiusb_hid_remove_adapter(adapter); } pad_connection_destroy(hid->connections); free(hid); } static void *wiiusb_hid_init(void) { joypad_connection_t *connections = NULL; wiiusb_hid_t *hid = (wiiusb_hid_t*)calloc(1, sizeof(*hid)); if (!hid) goto error; connections = pad_connection_init(MAX_USERS); if (!connections) goto error; /* Initialize HID values */ hid->connections = connections; hid->adapters_head = NULL; hid->removal_cb = FALSE; hid->manual_removal = FALSE; hid->poll_thread_quit = FALSE; /* we set it initially to TRUE so we force * to add the already connected pads */ hid->device_detected = TRUE; hid->poll_thread = sthread_create(wiiusb_hid_poll_thread, hid); if (!hid->poll_thread) { RARCH_ERR("Error initializing poll thread.\n"); goto error; } USB_DeviceChangeNotifyAsync(USB_CLASS_HID, wiiusb_hid_change_cb, (void *)hid); return hid; error: wiiusb_hid_free(hid); return NULL; } static void wiiusb_hid_poll(void *data) { (void)data; } hid_driver_t wiiusb_hid = { wiiusb_hid_init, wiiusb_hid_joypad_query, wiiusb_hid_free, wiiusb_hid_joypad_button, wiiusb_hid_joypad_get_buttons, wiiusb_hid_joypad_axis, wiiusb_hid_poll, wiiusb_hid_joypad_rumble, wiiusb_hid_joypad_name, "wiiusb", };
Scheiker/RetroArch
input/drivers_hid/wiiusb_hid.c
C
gpl-3.0
16,373
<?php require_once('../../../config.php'); require_once('../lib.php'); $id = required_param('id', PARAM_INT); $groupid = optional_param('groupid', 0, PARAM_INT); //only for teachers $url = new moodle_url('/mod/chat/gui_header_js/index.php', array('id'=>$id)); if ($groupid !== 0) { $url->param('groupid', $groupid); } $PAGE->set_url($url); if (!$chat = $DB->get_record('chat', array('id'=>$id))) { print_error('invalidid', 'chat'); } if (!$course = $DB->get_record('course', array('id'=>$chat->course))) { print_error('invalidcourseid'); } if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) { print_error('invalidcoursemodule'); } $context = get_context_instance(CONTEXT_MODULE, $cm->id); require_login($course->id, false, $cm); require_capability('mod/chat:chat',$context); /// Check to see if groups are being used here if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used if ($groupid = groups_get_activity_group($cm)) { if (!$group = groups_get_group($groupid, false)) { print_error('invalidgroupid'); } $groupname = ': '.$group->name; } else { $groupname = ': '.get_string('allparticipants'); } } else { $groupid = 0; $groupname = ''; } $strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!! if (!$chat_sid = chat_login_user($chat->id, 'header_js', $groupid, $course)) { print_error('cantlogin', 'chat'); } $params = "chat_id=$id&chat_sid={$chat_sid}"; // fallback to the old jsupdate, but allow other update modes $updatemode = 'jsupdate'; if (!empty($CFG->chat_normal_updatemode)) { $updatemode = $CFG->chat_normal_updatemode; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title> <?php echo "$strchat: " . format_string($course->shortname) . ": ".format_string($chat->name,true)."$groupname" ?> </title> </head> <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1"> <frameset rows="0,0,*,50" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1"> <frame src="../empty.php" name="empty" scrolling="no" marginwidth="0" marginheight="0"> <frame src="<?php echo $updatemode ?>.php?<?php echo $params ?>" name="jsupdate" scrolling="no" marginwidth="0" marginheight="0"> <frame src="chatmsg.php?<?php echo $params ?>" name="msg" scrolling="auto" marginwidth="2" marginheight="1"> <frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1"> </frameset> <frame src="users.php?<?php echo $params ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5"> </frameset> <noframes> Sorry, this version of Moodle Chat needs a browser that handles frames. </noframes> </html>
dpogue/thss-moodle
mod/chat/gui_header_js/index.php
PHP
gpl-3.0
3,023
package mods.simwir.puremetals.items; public class ItemBowlIron extends ItemIronDust{ public ItemBowlIron(int par1) { super(par1); setUnlocalizedName("bowlIron"); setMaxStackSize(16); } }
simwir/puremetals
items/ItemBowlIron.java
Java
gpl-3.0
199
var gulp = require('gulp'); var sass = require('gulp-sass'); var auto = require('gulp-autoprefixer'); var sourcemaps = require('gulp-sourcemaps'); var browserSync = require('browser-sync').create(); var plumber = require('gulp-plumber'); gulp.task('scss', function() { return gulp.src('src/scss/*.scss') .pipe(plumber()) .pipe(sass()) .pipe(sourcemaps.init()) .pipe(auto()) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('pub/css')) .pipe(browserSync.reload({ stream: true })) });
JorreSpijker/gulp
gulp_files/tasks/sass.js
JavaScript
gpl-3.0
560
using SharpDX; namespace WoWEditor6.Scene { class PerspectiveCamera : Camera { private float mAspect = 1.0f; private float mFov = 55.0f; public float NearClip { get; private set; } public float FarClip { get; private set; } public PerspectiveCamera() { NearClip = 0.2f; FarClip = 2000.0f; UpdateProjection(); } public override void Update() { base.Update(); UpdateProjection(); } private void UpdateProjection() { var matProjection = (LeftHanded == false) ? Matrix.PerspectiveFovRH(MathUtil.DegreesToRadians(mFov), mAspect, NearClip, FarClip) : Matrix.PerspectiveFovLH(MathUtil.DegreesToRadians(mFov), mAspect, NearClip, FarClip); OnProjectionChanged(ref matProjection); } public void SetFarClip(float clip) { FarClip = clip; UpdateProjection(); } public void SetNearClip(float clip) { NearClip = clip; UpdateProjection(); } public void SetClip(float near, float far) { NearClip = near; FarClip = far; UpdateProjection(); } public void SetAspect(float aspect) { mAspect = aspect; UpdateProjection(); } public void SetFieldOfView(float fov) { mFov = fov; UpdateProjection(); } } }
WowDevTools/Neo
WoWEditor6/Scene/PerspectiveCamera.cs
C#
gpl-3.0
1,579
package com.gerolivo.stargazerdiary.config; import java.util.concurrent.TimeUnit; import org.springframework.context.annotation.Configuration; import org.springframework.http.CacheControl; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/webjars/**") .addResourceLocations("/webjars/") .setCacheControl(CacheControl.maxAge(30L, TimeUnit.DAYS) .cachePublic()) .resourceChain(true); } }
gerolvr/StargazerDiary
src/main/java/com/gerolivo/stargazerdiary/config/WebConfig.java
Java
gpl-3.0
710
namespace Maticsoft.OAuth { using System; public class Provider { private string authUrl; private string bindUrl; private int mediaID; private string mediaName; public Provider(string authUrl, string bindUrl, int mediaID, string mediaName) { this.authUrl = authUrl; this.bindUrl = bindUrl; this.mediaID = mediaID; this.mediaName = mediaName; } public string AuthUrl { get { return this.authUrl; } set { this.authUrl = value; } } public string BindUrl { get { return this.bindUrl; } set { this.bindUrl = value; } } public int MediaID { get { return this.mediaID; } set { this.mediaID = value; } } public string MediaName { get { return this.mediaName; } set { this.mediaName = value; } } } }
51zhaoshi/myyyyshop
Maticsoft.OAuth_Source/Maticsoft.OAuth/Provider.cs
C#
gpl-3.0
1,330
package org.rom.myfreetv.view; import java.awt.Dimension; import java.awt.Point; import java.awt.event.WindowAdapter; import javax.swing.BoxLayout; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; import org.rom.myfreetv.config.Config; public class PlayerWaiter extends JDialog { private static int pas = 200; private JProgressBar progress; private int ms; private WaiterThread runner; class WaiterThread extends Thread { private boolean cancelled; public void run() { int i = 0; while(!cancelled && i < ms) { int percent = (int) ((i * 100.0) / ms); if(percent < 0) percent = 0; else if(percent > 100) percent = 100; progress.setValue(percent); try { Thread.sleep(pas); } catch(InterruptedException e) {} i += pas; } dispose(); } public void kill() { cancelled = true; } } public PlayerWaiter(final int ms) { super(MyFreeTV.getInstance(), "TimeShift", true); // SkinManager.decore(this,Config.getInstance().getDecoration()); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing() { if(runner != null) runner.kill(); } }); this.ms = ms; setResizable(false); JPanel pan = new JPanel(); pan.setLayout(new BoxLayout(pan, BoxLayout.Y_AXIS)); Point p = MyFreeTV.getInstance().getLocation(); Dimension d = MyFreeTV.getInstance().getSize(); int x1 = (int) p.getX(); int y1 = (int) p.getY(); int x2 = x1 + (int) d.getWidth(); int y2 = y1 + (int) d.getHeight(); progress = new JProgressBar(); JPanel top = new JPanel(); top.add(new JLabel("Mise en mémoire tampon (TimeShift)...")); JPanel bottom = new JPanel(); bottom.add(progress); pan.add(top); pan.add(bottom); setContentPane(pan); pack(); int posX = (x1 + x2 - (int) getSize().getWidth()) / 2; int posY = (y1 + y2 - (int) getSize().getHeight()) / 2; setLocation(posX, posY); runner = new WaiterThread(); runner.start(); setVisible(true); } }
rom1v/myfreetv
src/org/rom/myfreetv/view/PlayerWaiter.java
Java
gpl-3.0
2,550
package com.taobao.api.domain; import java.util.Date; import com.taobao.api.TaobaoObject; import com.taobao.api.internal.mapping.ApiField; /** * 旅游商品图片结构。 * * @author auto create * @since 1.0, null */ public class TravelItemsImg extends TaobaoObject { private static final long serialVersionUID = 6615346549958748237L; /** * 图片创建时间 时间格式:yyyy-MM-dd HH:mm:ss。 */ @ApiField("created") private Date created; /** * 商品图片的ID。 */ @ApiField("id") private Long id; /** * 图片放在第几张(多图时可设置) */ @ApiField("position") private Long position; /** * 图片链接地址。 */ @ApiField("url") private String url; public Date getCreated() { return this.created; } public Long getId() { return this.id; } public Long getPosition() { return this.position; } public String getUrl() { return this.url; } public void setCreated(Date created) { this.created = created; } public void setId(Long id) { this.id = id; } public void setPosition(Long position) { this.position = position; } public void setUrl(String url) { this.url = url; } }
kuiwang/my-dev
src/main/java/com/taobao/api/domain/TravelItemsImg.java
Java
gpl-3.0
1,337
# -*- coding: utf-8 -*- """ nwdiag.sphinx_ext ~~~~~~~~~~~~~~~~~~~~ Allow nwdiag-formatted diagrams to be included in Sphinx-generated documents inline. :copyright: Copyright 2010 by Takeshi Komiya. :license: BSDL. """ from __future__ import absolute_import import os import re import traceback from collections import namedtuple from docutils import nodes from sphinx import addnodes from sphinx.util.osutil import ensuredir import nwdiag.utils.rst.nodes import nwdiag.utils.rst.directives from blockdiag.utils.bootstrap import detectfont from blockdiag.utils.compat import u, string_types from blockdiag.utils.fontmap import FontMap # fontconfig; it will be initialized on `builder-inited` event. fontmap = None class nwdiag_node(nwdiag.utils.rst.nodes.nwdiag): def to_drawer(self, image_format, builder, **kwargs): if 'filename' in kwargs: filename = kwargs.pop('filename') else: filename = self.get_abspath(image_format, builder) antialias = builder.config.nwdiag_antialias image = super(nwdiag_node, self).to_drawer(image_format, filename, fontmap, antialias=antialias, **kwargs) for node in image.diagram.traverse_nodes(): node.href = resolve_reference(builder, node.href) return image def get_relpath(self, image_format, builder): options = dict(antialias=builder.config.nwdiag_antialias, fontpath=builder.config.nwdiag_fontpath, fontmap=builder.config.nwdiag_fontmap, format=image_format) outputdir = getattr(builder, 'imgpath', builder.outdir) return os.path.join(outputdir, self.get_path(**options)) def get_abspath(self, image_format, builder): options = dict(antialias=builder.config.nwdiag_antialias, fontpath=builder.config.nwdiag_fontpath, fontmap=builder.config.nwdiag_fontmap, format=image_format) if hasattr(builder, 'imgpath'): outputdir = os.path.join(builder.outdir, '_images') else: outputdir = builder.outdir path = os.path.join(outputdir, self.get_path(**options)) ensuredir(os.path.dirname(path)) return path class Nwdiag(nwdiag.utils.rst.directives.NwdiagDirective): node_class = nwdiag_node def node2image(self, node, diagram): return node def resolve_reference(builder, href): if href is None: return None pattern = re.compile(u("^:ref:`(.+?)`"), re.UNICODE) matched = pattern.search(href) if matched is None: return href else: refid = matched.group(1) domain = builder.env.domains['std'] node = addnodes.pending_xref(refexplicit=False) xref = domain.resolve_xref(builder.env, builder.current_docname, builder, 'ref', refid, node, node) if xref: if 'refid' in xref: return "#" + xref['refid'] else: return xref['refuri'] else: builder.warn('undefined label: %s' % refid) return None def html_render_svg(self, node): image = node.to_drawer('SVG', self.builder, filename=None, nodoctype=True) image.draw() if 'align' in node['options']: align = node['options']['align'] self.body.append('<div align="%s" class="align-%s">' % (align, align)) self.context.append('</div>\n') else: self.body.append('<div>') self.context.append('</div>\n') # reftarget for node_id in node['ids']: self.body.append('<span id="%s"></span>' % node_id) # resize image size = image.pagesize().resize(**node['options']) self.body.append(image.save(size)) self.context.append('') def html_render_clickablemap(self, image, width_ratio, height_ratio): href_nodes = [node for node in image.nodes if node.href] if not href_nodes: return self.body.append('<map name="map_%d">' % id(image)) for node in href_nodes: x1, y1, x2, y2 = image.metrics.cell(node) x1 *= width_ratio x2 *= width_ratio y1 *= height_ratio y2 *= height_ratio areatag = '<area shape="rect" coords="%s,%s,%s,%s" href="%s">' % (x1, y1, x2, y2, node.href) self.body.append(areatag) self.body.append('</map>') def html_render_png(self, node): image = node.to_drawer('PNG', self.builder) if not os.path.isfile(image.filename): image.draw() image.save() # align if 'align' in node['options']: align = node['options']['align'] self.body.append('<div align="%s" class="align-%s">' % (align, align)) self.context.append('</div>\n') else: self.body.append('<div>') self.context.append('</div>') # link to original image relpath = node.get_relpath('PNG', self.builder) if 'width' in node['options'] or 'height' in node['options'] or 'scale' in node['options']: self.body.append('<a class="reference internal image-reference" href="%s">' % relpath) self.context.append('</a>') else: self.context.append('') # <img> tag original_size = image.pagesize() resized = original_size.resize(**node['options']) img_attr = dict(src=relpath, width=resized.width, height=resized.height) if any(node.href for node in image.nodes): img_attr['usemap'] = "#map_%d" % id(image) width_ratio = float(resized.width) / original_size.width height_ratio = float(resized.height) / original_size.height html_render_clickablemap(self, image, width_ratio, height_ratio) if 'alt' in node['options']: img_attr['alt'] = node['options']['alt'] self.body.append(self.starttag(node, 'img', '', empty=True, **img_attr)) def html_visit_nwdiag(self, node): try: image_format = get_image_format_for(self.builder) if image_format.upper() == 'SVG': html_render_svg(self, node) else: html_render_png(self, node) except UnicodeEncodeError: if self.builder.config.nwdiag_debug: traceback.print_exc() msg = ("nwdiag error: UnicodeEncodeError caught " "(check your font settings)") self.builder.warn(msg) raise nodes.SkipNode except Exception as exc: if self.builder.config.nwdiag_debug: traceback.print_exc() self.builder.warn('dot code %r: %s' % (node['code'], str(exc))) raise nodes.SkipNode def html_depart_nwdiag(self, node): self.body.append(self.context.pop()) self.body.append(self.context.pop()) def get_image_format_for(builder): if builder.format == 'html': image_format = builder.config.nwdiag_html_image_format.upper() elif builder.format == 'latex': if builder.config.nwdiag_tex_image_format: image_format = builder.config.nwdiag_tex_image_format.upper() else: image_format = builder.config.nwdiag_latex_image_format.upper() else: image_format = 'PNG' if image_format.upper() not in ('PNG', 'PDF', 'SVG'): raise ValueError('unknown format: %s' % image_format) if image_format.upper() == 'PDF': try: import reportlab # NOQA: importing test except ImportError: raise ImportError('Could not output PDF format. Install reportlab.') return image_format def on_builder_inited(self): # show deprecated message if self.builder.config.nwdiag_tex_image_format: self.builder.warn('nwdiag_tex_image_format is deprecated. Use nwdiag_latex_image_format.') # initialize fontmap global fontmap try: fontmappath = self.builder.config.nwdiag_fontmap fontmap = FontMap(fontmappath) except: fontmap = FontMap(None) try: fontpath = self.builder.config.nwdiag_fontpath if isinstance(fontpath, string_types): fontpath = [fontpath] if fontpath: config = namedtuple('Config', 'font')(fontpath) fontpath = detectfont(config) fontmap.set_default_font(fontpath) except: pass def on_doctree_resolved(self, doctree, docname): if self.builder.format == 'html': return try: image_format = get_image_format_for(self.builder) except Exception as exc: if self.builder.config.nwdiag_debug: traceback.print_exc() self.builder.warn('nwdiag error: %s' % exc) for node in doctree.traverse(nwdiag_node): node.parent.remove(node) return for node in doctree.traverse(nwdiag_node): try: relfn = node.get_relpath(image_format, self.builder) image = node.to_drawer(image_format, self.builder) if not os.path.isfile(image.filename): image.draw() image.save() image = nodes.image(uri=image.filename, candidates={'*': relfn}, **node['options']) node.parent.replace(node, image) except Exception as exc: if self.builder.config.nwdiag_debug: traceback.print_exc() self.builder.warn('dot code %r: %s' % (node['code'], str(exc))) node.parent.remove(node) def setup(app): app.add_node(nwdiag_node, html=(html_visit_nwdiag, html_depart_nwdiag)) app.add_directive('nwdiag', Nwdiag) app.add_config_value('nwdiag_fontpath', None, 'html') app.add_config_value('nwdiag_fontmap', None, 'html') app.add_config_value('nwdiag_antialias', False, 'html') app.add_config_value('nwdiag_debug', False, 'html') app.add_config_value('nwdiag_html_image_format', 'PNG', 'html') app.add_config_value('nwdiag_tex_image_format', None, 'html') # backward compatibility for 0.6.1 app.add_config_value('nwdiag_latex_image_format', 'PNG', 'html') app.connect("builder-inited", on_builder_inited) app.connect("doctree-resolved", on_doctree_resolved)
bboalimoe/ndn-cache-policy
docs/sphinx-contrib/nwdiag/sphinxcontrib/nwdiag.py
Python
gpl-3.0
10,218
<?php /** * @package Mautic * @copyright 2014 Mautic Contributors. All rights reserved. * @author Mautic * @link http://mautic.org * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ namespace Mautic\LeadBundle\Controller; use Mautic\LeadBundle\Entity\Tag; use Mautic\LeadBundle\Entity\UtmTag; use Mautic\LeadBundle\Helper\FormFieldHelper; use Mautic\PluginBundle\Helper\IntegrationHelper; use Mautic\CoreBundle\Controller\AjaxController as CommonAjaxController; use Mautic\CoreBundle\Helper\BuilderTokenHelper; use Mautic\CoreBundle\Helper\InputHelper; use Symfony\Component\HttpFoundation\Request; use Mautic\LeadBundle\LeadEvents; use Mautic\LeadBundle\Event\LeadTimelineEvent; /** * Class AjaxController * * @package Mautic\LeadBundle\Controller */ class AjaxController extends CommonAjaxController { /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function userListAction(Request $request) { $filter = InputHelper::clean($request->query->get('filter')); $results = $this->getModel('lead.lead')->getLookupResults('user', $filter); $dataArray = []; foreach ($results as $r) { $name = $r['firstName'].' '.$r['lastName']; $dataArray[] = [ "label" => $name, "value" => $r['id'] ]; } return $this->sendJsonResponse($dataArray); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function getLeadIdsByFieldValueAction(Request $request) { $field = InputHelper::clean($request->request->get('field')); $value = InputHelper::clean($request->request->get('value')); $ignore = (int) $request->request->get('ignore'); $dataArray = ['items' => []]; if ($field && $value) { $repo = $this->getModel('lead.lead')->getRepository(); $leads = $repo->getLeadsByFieldValue($field, $value, $ignore); $dataArray['existsMessage'] = $this->factory->getTranslator()->trans('mautic.lead.exists.by.field').': '; foreach ($leads as $lead) { $fields = $repo->getFieldValues($lead->getId()); $lead->setFields($fields); $name = $lead->getName(); if (!$name) { $name = $lead->getEmail(); } if (!$name) { $name = $this->factory->getTranslator()->trans('mautic.lead.lead.anonymous'); } $leadLink = $this->generateUrl('mautic_contact_action', ['objectAction' => 'view', 'objectId' => $lead->getId()]); $dataArray['items'][] = [ 'name' => $name, 'id' => $lead->getId(), 'link' => $leadLink ]; } } return $this->sendJsonResponse($dataArray); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function fieldListAction(Request $request) { $dataArray = ['success' => 0]; $filter = InputHelper::clean($request->query->get('filter')); $leadField = InputHelper::clean($request->query->get('field')); if (!empty($leadField)) { if ($leadField == "owner_id") { $results = $this->getModel('lead.lead')->getLookupResults('user', $filter); foreach ($results as $r) { $name = $r['firstName'].' '.$r['lastName']; $dataArray[] = [ "value" => $name, "id" => $r['id'] ]; } } elseif ($leadField == "hit_url") { $dataArray[] = [ 'value' => '' ]; } else { $results = $this->getModel('lead.field')->getLookupResults($leadField, $filter); foreach ($results as $r) { $dataArray[] = ['value' => $r[$leadField]]; } } } return $this->sendJsonResponse($dataArray); } /** * Updates the cache and gets returns updated HTML * * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function updateSocialProfileAction(Request $request) { $dataArray = ['success' => 0]; $network = InputHelper::clean($request->request->get('network')); $leadId = InputHelper::clean($request->request->get('lead')); if (!empty($leadId)) { //find the lead $model = $this->getModel('lead.lead'); $lead = $model->getEntity($leadId); if ($lead !== null && $this->factory->getSecurity()->hasEntityAccess('lead:leads:editown', 'lead:leads:editown', $lead->getOwner())) { $leadFields = $lead->getFields(); /** @var IntegrationHelper $integrationHelper */ $integrationHelper = $this->factory->getHelper('integration'); $socialProfiles = $integrationHelper->getUserProfiles($lead, $leadFields, true, $network); $socialProfileUrls = $integrationHelper->getSocialProfileUrlRegex(false); $integrations = []; $socialCount = count($socialProfiles); if (empty($network) || empty($socialCount)) { $dataArray['completeProfile'] = $this->renderView( 'MauticLeadBundle:Social:index.html.php', [ 'socialProfiles' => $socialProfiles, 'lead' => $lead, 'socialProfileUrls' => $socialProfileUrls ] ); $dataArray['socialCount'] = $socialCount; } else { foreach ($socialProfiles as $name => $details) { if ($integrationObject = $integrationHelper->getIntegrationObject($name)) { if ($template = $integrationObject->getSocialProfileTemplate()) { $integrations[$name]['newContent'] = $this->renderView( $template, [ 'lead' => $lead, 'details' => $details, 'integrationName' => $name, 'socialProfileUrls' => $socialProfileUrls ] ); } } } $dataArray['profiles'] = $integrations; } $dataArray['success'] = 1; } } return $this->sendJsonResponse($dataArray); } /** * Clears the cache for a network * * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function clearSocialProfileAction(Request $request) { $dataArray = ['success' => 0]; $network = InputHelper::clean($request->request->get('network')); $leadId = InputHelper::clean($request->request->get('lead')); if (!empty($leadId)) { //find the lead $model = $this->getModel('lead.lead'); $lead = $model->getEntity($leadId); if ($lead !== null && $this->factory->getSecurity()->hasEntityAccess('lead:leads:editown', 'lead:leads:editown', $lead->getOwner())) { $dataArray['success'] = 1; /** @var \Mautic\PluginBundle\Helper\IntegrationHelper $helper */ $helper = $this->factory->getHelper('integration'); $socialProfiles = $helper->clearIntegrationCache($lead, $network); $socialCount = count($socialProfiles); if (empty($socialCount)) { $dataArray['completeProfile'] = $this->renderView( 'MauticLeadBundle:Social:index.html.php', [ 'socialProfiles' => $socialProfiles, 'lead' => $lead, 'socialProfileUrls' => $helper->getSocialProfileUrlRegex(false) ] ); } $dataArray['socialCount'] = $socialCount; } } return $this->sendJsonResponse($dataArray); } /** * Updates the timeline events and gets returns updated HTML * * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function updateTimelineAction(Request $request) { $dataArray = ['success' => 0]; $includeEvents = InputHelper::clean($request->request->get('includeEvents', [])); $excludeEvents = InputHelper::clean($request->request->get('excludeEvents', [])); $search = InputHelper::clean($request->request->get('search')); $leadId = InputHelper::int($request->request->get('leadId')); if (!empty($leadId)) { //find the lead $model = $this->getModel('lead.lead'); $lead = $model->getEntity($leadId); if ($lead !== null) { $session = $this->factory->getSession(); $filter = [ 'search' => $search, 'includeEvents' => $includeEvents, 'excludeEvents' => $excludeEvents ]; $session->set('mautic.lead.'.$leadId.'.timeline.filters', $filter); // Trigger the TIMELINE_ON_GENERATE event to fetch the timeline events from subscribed bundles $dispatcher = $this->factory->getDispatcher(); $event = new LeadTimelineEvent($lead, $filter); $dispatcher->dispatch(LeadEvents::TIMELINE_ON_GENERATE, $event); $events = $event->getEvents(); $eventTypes = $event->getEventTypes(); $timeline = $this->renderView( 'MauticLeadBundle:Lead:history.html.php', [ 'events' => $events, 'eventTypes' => $eventTypes, 'eventFilters' => $filter, 'lead' => $lead ] ); $dataArray['success'] = 1; $dataArray['timeline'] = $timeline; $dataArray['historyCount'] = count($events); } } return $this->sendJsonResponse($dataArray); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function toggleLeadListAction(Request $request) { $dataArray = ['success' => 0]; $leadId = InputHelper::int($request->request->get('leadId')); $listId = InputHelper::int($request->request->get('listId')); $action = InputHelper::clean($request->request->get('listAction')); if (!empty($leadId) && !empty($listId) && in_array($action, ['remove', 'add'])) { $leadModel = $this->getModel('lead'); $listModel = $this->getModel('lead.list'); $lead = $leadModel->getEntity($leadId); $list = $listModel->getEntity($listId); if ($lead !== null && $list !== null) { $class = $action == 'add' ? 'addToLists' : 'removeFromLists'; $leadModel->$class($lead, $list); $dataArray['success'] = 1; } } return $this->sendJsonResponse($dataArray); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function toggleLeadCampaignAction(Request $request) { $dataArray = ['success' => 0]; $leadId = InputHelper::int($request->request->get('leadId')); $campaignId = InputHelper::int($request->request->get('campaignId')); $action = InputHelper::clean($request->request->get('campaignAction')); if (!empty($leadId) && !empty($campaignId) && in_array($action, ['remove', 'add'])) { $leadModel = $this->getModel('lead'); $campaignModel = $this->getModel('campaign'); $lead = $leadModel->getEntity($leadId); $campaign = $campaignModel->getEntity($campaignId); if ($lead !== null && $campaign !== null) { $class = "{$action}Lead"; $campaignModel->$class($campaign, $lead, true); $dataArray['success'] = 1; } } return $this->sendJsonResponse($dataArray); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function getImportProgressAction(Request $request) { $dataArray = ['success' => 1]; if ($this->factory->getSecurity()->isGranted('lead:leads:create')) { $session = $this->factory->getSession(); $dataArray['progress'] = $session->get('mautic.lead.import.progress', [0, 0]); $dataArray['percent'] = ($dataArray['progress'][1]) ? ceil(($dataArray['progress'][0] / $dataArray['progress'][1]) * 100) : 100; } return $this->sendJsonResponse($dataArray); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function removeBounceStatusAction(Request $request) { $dataArray = ['success' => 0]; $dncId = $request->request->get('id'); if (!empty($dncId)) { /** @var \Mautic\LeadBundle\Model\LeadModel $model */ $model = $this->getModel('lead'); /** @var \Mautic\LeadBundle\Entity\DoNotContact $dnc */ $dnc = $this->getDoctrine()->getManager()->getRepository('MauticLeadBundle:DoNotContact')->findOneBy( [ 'id' => $dncId ] ); $lead = $dnc->getLead(); if ($lead) { // Use lead model to trigger listeners $model->removeDncForLead($lead, 'email'); } else { $this->getModel('email')->getRepository()->deleteDoNotEmailEntry($dncId); } $dataArray['success'] = 1; } return $this->sendJsonResponse($dataArray); } /** * Get the rows for new leads * * @param Request $request * * @return array|\Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse */ protected function getNewLeadsAction(Request $request) { $dataArray = ['success' => 0]; $maxId = $request->get('maxId'); if (!empty($maxId)) { //set some permissions $permissions = $this->factory->getSecurity()->isGranted( [ 'lead:leads:viewown', 'lead:leads:viewother', 'lead:leads:create', 'lead:leads:editown', 'lead:leads:editother', 'lead:leads:deleteown', 'lead:leads:deleteother' ], "RETURN_ARRAY" ); if (!$permissions['lead:leads:viewown'] && !$permissions['lead:leads:viewother']) { return $this->accessDenied(true); } /** @var \Mautic\LeadBundle\Model\LeadModel $model */ $model = $this->getModel('lead.lead'); $session = $this->factory->getSession(); $search = $session->get('mautic.lead.filter', ''); $filter = ['string' => $search, 'force' => []]; $translator = $this->factory->getTranslator(); $anonymous = $translator->trans('mautic.lead.lead.searchcommand.isanonymous'); $mine = $translator->trans('mautic.core.searchcommand.ismine'); $indexMode = $session->get('mautic.lead.indexmode', 'list'); $session->set('mautic.lead.indexmode', $indexMode); // (strpos($search, "$isCommand:$anonymous") === false && strpos($search, "$listCommand:") === false)) || if ($indexMode != 'list') { //remove anonymous leads unless requested to prevent clutter $filter['force'][] = "!$anonymous"; } if (!$permissions['lead:leads:viewother']) { $filter['force'][] = $mine; } $filter['force'][] = [ 'column' => 'l.id', 'expr' => 'gt', 'value' => $maxId ]; $results = $model->getEntities( [ 'filter' => $filter, 'withTotalCount' => true ] ); $count = $results['count']; if (!empty($count)) { // Get the max ID of the latest lead added $maxLeadId = $model->getRepository()->getMaxLeadId(); // We need the EmailRepository to check if a lead is flagged as do not contact /** @var \Mautic\EmailBundle\Entity\EmailRepository $emailRepo */ $emailRepo = $this->getModel('email')->getRepository(); $indexMode = $this->request->get('view', $session->get('mautic.lead.indexmode', 'list')); $template = ($indexMode == 'list') ? 'list_rows' : 'grid_cards'; $dataArray['leads'] = $this->factory->getTemplating()->render( "MauticLeadBundle:Lead:{$template}.html.php", [ 'items' => $results['results'], 'noContactList' => $emailRepo->getDoNotEmailList(), 'permissions' => $permissions, 'security' => $this->factory->getSecurity(), 'highlight' => true ] ); $dataArray['indexMode'] = $indexMode; $dataArray['maxId'] = $maxLeadId; $dataArray['success'] = 1; } } return $this->sendJsonResponse($dataArray); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function getEmailTemplateAction(Request $request) { $data = ['success' => 1, 'body' => '', 'subject' => '']; $emailId = $request->get('template'); /** @var \Mautic\EmailBundle\Model\EmailModel $model */ $model = $this->getModel('email'); /** @var \Mautic\EmailBundle\Entity\Email $email */ $email = $model->getEntity($emailId); if ($email !== null && $this->factory->getSecurity()->hasEntityAccess( 'email:emails:viewown', 'email:emails:viewother', $email->getCreatedBy() ) ) { $mailer = $this->factory->getMailer(); $mailer->setEmail($email, true, [], [], true); $data['body'] = $mailer->getBody(); $data['subject'] = $mailer->getSubject(); // Parse tokens into view data $tokens = $model->getBuilderComponents($email, ['tokens', 'visualTokens']); BuilderTokenHelper::replaceTokensWithVisualPlaceholders($tokens, $data['body']); } return $this->sendJsonResponse($data); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function updateLeadTagsAction(Request $request) { /** @var \Mautic\LeadBundle\Model\LeadModel $leadModel */ $leadModel = $this->getModel('lead'); $post = $request->request->get('lead_tags', [], true); $lead = $leadModel->getEntity((int) $post['id']); $updatedTags = (!empty($post['tags']) && is_array($post['tags'])) ? $post['tags'] : []; $data = ['success' => 0]; if ($lead !== null && $this->factory->getSecurity()->hasEntityAccess('lead:leads:editown', 'lead:leads:editother', $lead->getOwner())) { $leadModel->setTags($lead, $updatedTags, true); /** @var \Doctrine\ORM\PersistentCollection $leadTags */ $leadTags = $lead->getTags(); $leadTagKeys = $leadTags->getKeys(); // Get an updated list of tags $tags = $leadModel->getTagRepository()->getSimpleList(null, [], 'tag'); $tagOptions = ''; foreach ($tags as $tag) { $selected = (in_array($tag['label'], $leadTagKeys)) ? ' selected="selected"' : ''; $tagOptions .= '<option'.$selected.' value="'.$tag['value'].'">'.$tag['label'].'</option>'; } $data['success'] = 1; $data['tags'] = $tagOptions; } return $this->sendJsonResponse($data); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function addLeadTagsAction(Request $request) { $tags = $request->request->get('tags'); $tags = json_decode($tags, true); if (is_array($tags)) { $newTags = []; foreach ($tags as $tag) { if (!is_numeric($tag)) { // New tag $tagEntity = new Tag(); $tagEntity->setTag(InputHelper::clean($tag)); $newTags[] = $tagEntity; } } $leadModel = $this->getModel('lead'); if (!empty($newTags)) { $leadModel->getTagRepository()->saveEntities($newTags); } // Get an updated list of tags $allTags = $leadModel->getTagRepository()->getSimpleList(null, [], 'tag'); $tagOptions = ''; foreach ($allTags as $tag) { $selected = (in_array($tag['value'], $tags) || in_array($tag['label'], $tags)) ? ' selected="selected"' : ''; $tagOptions .= '<option'.$selected.' value="'.$tag['value'].'">'.$tag['label'].'</option>'; } $data = [ 'success' => 1, 'tags' => $tagOptions ]; } else { $data = ['success' => 0]; } return $this->sendJsonResponse($data); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function addLeadUtmTagsAction(Request $request) { $utmTags = $request->request->get('utmtags'); $utmTags = json_decode($utmTags, true); if (is_array($utmTags)) { $newUtmTags = []; foreach ($utmTags as $utmTag) { if (!is_numeric($utmTag)) { // New tag $utmTagEntity = new UtmTag(); $utmTagEntity->setUtmTag(InputHelper::clean($utmTag)); $newUtmTags[] = $utmTagEntity; } } $leadModel = $this->factory->getModel('lead'); if (!empty($newUtmTags)) { $leadModel->getUtmTagRepository()->saveEntities($newUtmTags); } // Get an updated list of tags $allUtmTags = $leadModel->getUtmTagRepository()->getSimpleList(null, [], 'utmtag'); $utmTagOptions = ''; foreach ($allUtmTags as $utmTag) { $selected = (in_array($utmTag['value'], $utmTags) || in_array($utmTag['label'], $utmTags)) ? ' selected="selected"' : ''; $utmTagOptions .= '<option'.$selected.' value="'.$utmTag['value'].'">'.$utmTag['label'].'</option>'; } $data = [ 'success' => 1, 'tags' => $utmTagOptions ]; } else { $data = ['success' => 0]; } return $this->sendJsonResponse($data); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function reorderAction(Request $request) { $dataArray = ['success' => 0]; $order = InputHelper::clean($request->request->get('field')); $page = InputHelper::int($request->get('page')); $limit = InputHelper::int($request->get('limit')); if (!empty($order)) { /** @var \Mautic\LeadBundle\Model\FieldModel $model */ $model = $this->getModel('lead.field'); $startAt = ($page > 1) ? ($page * $limit) + 1 : 1; $model->reorderFieldsByList($order, $startAt); $dataArray['success'] = 1; } return $this->sendJsonResponse($dataArray); } /** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function updateLeadFieldValuesAction(Request $request) { $alias = InputHelper::clean($request->request->get('alias')); $dataArray = ['success' => 0, 'options' => null]; $leadField = $this->getModel('lead.field')->getRepository()->findOneBy(['alias' => $alias]); $choiceTypes = ['boolean', 'locale', 'country', 'region', 'lookup', 'timezone', 'select', 'radio']; if ($leadField && in_array($leadField->getType(), $choiceTypes)) { $properties = $leadField->getProperties(); $leadFieldType = $leadField->getType(); if (!empty($properties['list'])) { // Lookup/Select options $options = explode('|', $properties['list']); $options = array_combine($options, $options); } elseif (!empty($properties) && $leadFieldType == 'boolean') { // Boolean options $options = [ 0 => $properties['no'], 1 => $properties['yes'] ]; } else { switch ($leadFieldType) { case 'country': $options = FormFieldHelper::getCountryChoices(); break; case 'region': $options = FormFieldHelper::getRegionChoices(); break; case 'timezone': $options = FormFieldHelper::getTimezonesChoices(); break; case 'locale': $options = FormFieldHelper::getLocaleChoices(); break; default: $options = (!empty($properties)) ? $properties : []; } } $dataArray['options'] = $options; } $dataArray['success'] = 1; return $this->sendJsonResponse($dataArray); } }
mqueme/mautic
app/bundles/LeadBundle/Controller/AjaxController.php
PHP
gpl-3.0
27,782
<!DOCTYPE html> <html lang="en" class="no-js"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Unity - Scripting API: ComputeBuffer.ComputeBuffer</title> <meta name="description" content="Develop once, publish everywhere! Unity is the ultimate tool for video game development, architectural visualizations, and interactive media installations - publish to the web, Windows, OS X, Wii, Xbox 360, and iPhone with many more platforms to come." /> <meta name="author" content="Unity Technologies" /> <link rel="shortcut icon" href="../StaticFiles/images/favicons/favicon.ico" /> <link rel="icon" type="image/png" href="../StaticFiles/images/favicons/favicon.png" /> <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../StaticFiles/images/favicons/apple-touch-icon-152x152.png" /> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../StaticFiles/images/favicons/apple-touch-icon-144x144.png" /> <link rel="apple-touch-icon-precomposed" sizes="120x120" href="../StaticFiles/images/favicons/apple-touch-icon-120x120.png" /> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../StaticFiles/images/favicons/apple-touch-icon-114x114.png" /> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../StaticFiles/images/favicons/apple-touch-icon-72x72.png" /> <link rel="apple-touch-icon-precomposed" href="../StaticFiles/images/favicons/apple-touch-icon.png" /> <meta name="msapplication-TileColor" content="#222c37" /> <meta name="msapplication-TileImage" content="../StaticFiles/images/favicons/tileicon-144x144.png" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-2854981-1']); _gaq.push(['_setDomainName', 'unity3d.com']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <script type="text/javascript" src="../StaticFiles/js/jquery.js"> </script> <script type="text/javascript" src="docdata/toc.js">//toc</script> <!--local TOC--> <script type="text/javascript" src="docdata/global_toc.js">//toc</script> <!--global TOC, including other platforms--> <script type="text/javascript" src="../StaticFiles/js/core.js"> </script> <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="../StaticFiles/css/core.css" /> </head> <body> <div class="header-wrapper"> <div id="header" class="header"> <div class="content"> <div class="spacer"> <div class="menu"> <div class="logo"> <a href="http://docs.unity3d.com"> </a> </div> <div class="search-form"> <form action="30_search.html" method="get" class="apisearch"> <input type="text" name="q" placeholder="Search scripting..." autosave="Unity Reference" results="5" class="sbox field" id="q"> </input> <input type="submit" class="submit"> </input> </form> </div> <ul> <li> <a href="http://docs.unity3d.com">Overview</a> </li> <li> <a href="../Manual/index.html">Manual</a> </li> <li> <a href="../ScriptReference/index.html" class="selected">Scripting API</a> </li> </ul> </div> </div> <div class="more"> <div class="filler"> </div> <ul> <li> <a href="http://unity3d.com/">unity3d.com</a> </li> </ul> </div> </div> </div> <div class="toolbar"> <div class="content clear"> <div class="lang-switcher hide"> <div class="current toggle" data-target=".lang-list"> <div class="lbl">Language: <span class="b">English</span></div> <div class="arrow"> </div> </div> <div class="lang-list" style="display:none;"> <ul> <li> <a href="">English</a> </li> </ul> </div> </div> <div class="script-lang"> <ul> <li class="selected" data-lang="CS">C#</li> <li data-lang="JS">JS</li> </ul> <div id="script-lang-dialog" class="dialog hide"> <div class="dialog-content clear"> <h2>Script language</h2> <div class="close"> </div> <p class="clear">Select your preferred scripting language. All code snippets will be displayed in this language.</p> </div> </div> </div> </div> </div> </div> <div id="master-wrapper" class="master-wrapper clear"> <div id="sidebar" class="sidebar"> <div class="sidebar-wrap"> <div class="content"> <div class="sidebar-menu"> <div class="toc"> <h2>Scripting API</h2> </div> </div> <p> <a href="40_history.html" class="cw">History</a> </p> </div> </div> </div> <div id="content-wrap" class="content-wrap"> <div class="content-block"> <div class="content"> <div class="section"> <div class="mb20 clear"> <h1 class="heading inherit"> <a href="ComputeBuffer.html">ComputeBuffer</a>.ComputeBuffer</h1> <div class="clear"> </div> <div class="clear"> </div> <div class="suggest"> <a class="blue-btn sbtn">Suggest a change</a> <div class="suggest-wrap rel hide"> <div class="loading hide"> <div> </div> <div> </div> <div> </div> </div> <div class="suggest-success hide"> <h2>Success!</h2> <p>Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.</p> <a class="gray-btn sbtn close">Close</a> </div> <div class="suggest-failed hide"> <h2>Sumbission failed</h2> <p>For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.</p> <a class="gray-btn sbtn close">Close</a> </div> <div class="suggest-form clear"> <label for="suggest_name">Your name</label> <input id="suggest_name" type="text"> </input> <label for="suggest_email">Your email</label> <input id="suggest_email" type="email"> </input> <label for="suggest_body" class="clear">Suggestion <span class="r">*</span></label> <textarea id="suggest_body" class="req"> </textarea> <button id="suggest_submit" class="blue-btn mr10">Submit suggestion</button> <p class="mb0"> <a class="cancel left lh42 cn">Cancel</a> </p> </div> </div> </div> <a href="" class="switch-link gray-btn sbtn left hide">Switch to Manual</a> <div class="clear"> </div> </div> <div class="subsection"> <div class="signature"> <div class="signature-JS sig-block">public <span class="sig-kw">ComputeBuffer</span>(<span class="sig-kw">count</span>: int, <span class="sig-kw">stride</span>: int)</div> <div class="signature-CS sig-block">public <span class="sig-kw">ComputeBuffer</span>(int <span class="sig-kw">count</span>, int <span class="sig-kw">stride</span>); </div> <div class="signature-JS sig-block">public <span class="sig-kw">ComputeBuffer</span>(<span class="sig-kw">count</span>: int, <span class="sig-kw">stride</span>: int, <span class="sig-kw">type</span>: <a href="ComputeBufferType.html">ComputeBufferType</a>)</div> <div class="signature-CS sig-block">public <span class="sig-kw">ComputeBuffer</span>(int <span class="sig-kw">count</span>, int <span class="sig-kw">stride</span>, <a href="ComputeBufferType.html">ComputeBufferType </a><span class="sig-kw">type</span>); </div> </div> </div> <div class="subsection"> <h2>Parameters</h2> <table class="list"> <tr> <td class="name lbl">count</td> <td class="desc">Number of elements in the buffer.</td> </tr> <tr> <td class="name lbl">stride</td> <td class="desc">Size of one element in the buffer. Has to match size of buffer type in the shader.</td> </tr> <tr> <td class="name lbl">type</td> <td class="desc">Type of the buffer, default is ComputeBufferType.Default.<br /><br />See Also: <a href="SystemInfo-supportsComputeShaders.html">SystemInfo.supportsComputeShaders</a>, <a href="ComputeShader.html">ComputeShader</a> class, <a href="Shader.SetGlobalBuffer.html">Shader.SetGlobalBuffer</a>, <a href="Material.SetBuffer.html">Material.SetBuffer</a>, <a href="../Manual/ComputeShaders.html">Compute Shaders</a>.</td> </tr> </table> </div> <div class="subsection"> <h2>Description</h2> <p>Create a Compute Buffer.</p> </div> <div class="subsection"> <p>Use <a href="ComputeBuffer.Release.html">Release</a> to release the buffer when no longer needed.</p> </div> </div> <div class="footer-wrapper"> <div class="footer clear"> <div class="copy">Copyright © 2014 Unity Technologies</div> <div class="menu"> <a href="http://unity3d.com/learn">Learn</a> <a href="http://unity3d.com/community">Community</a> <a href="http://unity3d.com/asset-store">Asset Store</a> <a href="https://store.unity3d.com">Buy</a> <a href="http://unity3d.com/unity/download">Download</a> </div> </div> </div> </div> </div> </div> </div> </body> </html>
rakuten/Uinty3D-Docs-zhcn
ScriptReference/ComputeBuffer-ctor.html
HTML
gpl-3.0
12,042
<!DOCTYPE html> <html lang="en" class="no-js"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Unity - Scripting API: RenderSettings.defaultReflectionMode</title> <meta name="description" content="Develop once, publish everywhere! Unity is the ultimate tool for video game development, architectural visualizations, and interactive media installations - publish to the web, Windows, OS X, Wii, Xbox 360, and iPhone with many more platforms to come." /> <meta name="author" content="Unity Technologies" /> <link rel="shortcut icon" href="../StaticFiles/images/favicons/favicon.ico" /> <link rel="icon" type="image/png" href="../StaticFiles/images/favicons/favicon.png" /> <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../StaticFiles/images/favicons/apple-touch-icon-152x152.png" /> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../StaticFiles/images/favicons/apple-touch-icon-144x144.png" /> <link rel="apple-touch-icon-precomposed" sizes="120x120" href="../StaticFiles/images/favicons/apple-touch-icon-120x120.png" /> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../StaticFiles/images/favicons/apple-touch-icon-114x114.png" /> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../StaticFiles/images/favicons/apple-touch-icon-72x72.png" /> <link rel="apple-touch-icon-precomposed" href="../StaticFiles/images/favicons/apple-touch-icon.png" /> <meta name="msapplication-TileColor" content="#222c37" /> <meta name="msapplication-TileImage" content="../StaticFiles/images/favicons/tileicon-144x144.png" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-2854981-1']); _gaq.push(['_setDomainName', 'unity3d.com']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <script type="text/javascript" src="../StaticFiles/js/jquery.js"> </script> <script type="text/javascript" src="docdata/toc.js">//toc</script> <!--local TOC--> <script type="text/javascript" src="docdata/global_toc.js">//toc</script> <!--global TOC, including other platforms--> <script type="text/javascript" src="../StaticFiles/js/core.js"> </script> <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="../StaticFiles/css/core.css" /> </head> <body> <div class="header-wrapper"> <div id="header" class="header"> <div class="content"> <div class="spacer"> <div class="menu"> <div class="logo"> <a href="http://docs.unity3d.com"> </a> </div> <div class="search-form"> <form action="30_search.html" method="get" class="apisearch"> <input type="text" name="q" placeholder="Search scripting..." autosave="Unity Reference" results="5" class="sbox field" id="q"> </input> <input type="submit" class="submit"> </input> </form> </div> <ul> <li> <a href="http://docs.unity3d.com">Overview</a> </li> <li> <a href="../Manual/index.html">Manual</a> </li> <li> <a href="../ScriptReference/index.html" class="selected">Scripting API</a> </li> </ul> </div> </div> <div class="more"> <div class="filler"> </div> <ul> <li> <a href="http://unity3d.com/">unity3d.com</a> </li> </ul> </div> </div> </div> <div class="toolbar"> <div class="content clear"> <div class="lang-switcher hide"> <div class="current toggle" data-target=".lang-list"> <div class="lbl">Language: <span class="b">English</span></div> <div class="arrow"> </div> </div> <div class="lang-list" style="display:none;"> <ul> <li> <a href="">English</a> </li> </ul> </div> </div> <div class="script-lang"> <ul> <li class="selected" data-lang="CS">C#</li> <li data-lang="JS">JS</li> </ul> <div id="script-lang-dialog" class="dialog hide"> <div class="dialog-content clear"> <h2>Script language</h2> <div class="close"> </div> <p class="clear">Select your preferred scripting language. All code snippets will be displayed in this language.</p> </div> </div> </div> </div> </div> </div> <div id="master-wrapper" class="master-wrapper clear"> <div id="sidebar" class="sidebar"> <div class="sidebar-wrap"> <div class="content"> <div class="sidebar-menu"> <div class="toc"> <h2>Scripting API</h2> </div> </div> <p> <a href="40_history.html" class="cw">History</a> </p> </div> </div> </div> <div id="content-wrap" class="content-wrap"> <div class="content-block"> <div class="content"> <div class="section"> <div class="mb20 clear"> <h1 class="heading inherit"> <a href="RenderSettings.html">RenderSettings</a>.defaultReflectionMode</h1> <div class="clear"> </div> <div class="clear"> </div> <div class="suggest"> <a class="blue-btn sbtn">Suggest a change</a> <div class="suggest-wrap rel hide"> <div class="loading hide"> <div> </div> <div> </div> <div> </div> </div> <div class="suggest-success hide"> <h2>Success!</h2> <p>Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.</p> <a class="gray-btn sbtn close">Close</a> </div> <div class="suggest-failed hide"> <h2>Sumbission failed</h2> <p>For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.</p> <a class="gray-btn sbtn close">Close</a> </div> <div class="suggest-form clear"> <label for="suggest_name">Your name</label> <input id="suggest_name" type="text"> </input> <label for="suggest_email">Your email</label> <input id="suggest_email" type="email"> </input> <label for="suggest_body" class="clear">Suggestion <span class="r">*</span></label> <textarea id="suggest_body" class="req"> </textarea> <button id="suggest_submit" class="blue-btn mr10">Submit suggestion</button> <p class="mb0"> <a class="cancel left lh42 cn">Cancel</a> </p> </div> </div> </div> <a href="" class="switch-link gray-btn sbtn left hide">Switch to Manual</a> <div class="clear"> </div> </div> <div class="subsection"> <div class="signature"> <div class="signature-JS sig-block">public static var <span class="sig-kw">defaultReflectionMode</span>: <a href="Rendering.DefaultReflectionMode.html">Rendering.DefaultReflectionMode</a>; </div> <div class="signature-CS sig-block">public static <a href="Rendering.DefaultReflectionMode.html">Rendering.DefaultReflectionMode</a> <span class="sig-kw">defaultReflectionMode</span>; </div> </div> </div> <div class="subsection"> <h2>Description</h2> <p>Default reflection mode.</p> </div> <div class="subsection"> <p>Unity can use a custom texture or generate a specular reflection texture from skybox.<br /><br />See Also: <a href="RenderSettings-defaultReflectionMode.html">RenderSettings.defaultReflectionMode</a>, <a href="../Manual/class-RenderSettings.html">Render Settings</a>.</p> </div> </div> <div class="footer-wrapper"> <div class="footer clear"> <div class="copy">Copyright © 2014 Unity Technologies</div> <div class="menu"> <a href="http://unity3d.com/learn">Learn</a> <a href="http://unity3d.com/community">Community</a> <a href="http://unity3d.com/asset-store">Asset Store</a> <a href="https://store.unity3d.com">Buy</a> <a href="http://unity3d.com/unity/download">Download</a> </div> </div> </div> </div> </div> </div> </div> </body> </html>
rakuten/Uinty3D-Docs-zhcn
ScriptReference/RenderSettings-defaultReflectionMode.html
HTML
gpl-3.0
10,591
#!/usr/bin/python import sys def fib(n): if(n<=2): return (n-1) else: return fib(n-1)+fib(n-2) if ( len(sys.argv) == 2 ): print fib(int(sys.argv[1])) else: print "Usage : "+sys.argv[0]+" <term required>"
simula67/Coding
python/AAD PoC/naive_fibinocci.py
Python
gpl-3.0
241
<?php if (!defined('init_pages')) { header('HTTP/1.0 404 not found'); exit; } $CORE->loggedInOrReturn(); //Set the title $TPL->SetTitle('Store Activity'); //Add header javascript $TPL->AddHeaderJs($config['WoWDB_JS'], true); //CSS $TPL->AddCSS('template/style/page-activity-all.css'); //Print the header $TPL->LoadHeader(); $p = (isset($_GET['p']) ? (int)$_GET['p'] : 1); //load the pagination module $CORE->load_CoreModule('paginationType2'); //Let's setup our pagination $pagies = new Pagination(); $pagies->addToLink('?page='.$pageName); $perPage = 8; $where = ""; $id = $CURUSER->get('id'); //count the total records $res = $DB->prepare("SELECT COUNT(*) FROM `store_activity` WHERE `account` = :acc " . $where . ";"); $res->bindParam(':acc', $id, PDO::PARAM_INT); $res->execute(); $count_row = $res->fetch(PDO::FETCH_NUM); $count = $count_row[0]; unset($count_row); unset($res); ?> <div class="content_holder"> <div class="sub-page-title"> <div id="title"><h1>Account Panel<p></p><span></span></h1></div> <div class="quick-menu"> <a class="arrow" href="#"></a> <ul class="dropdown-qmenu"> <li><a href="<?php echo $config['BaseURL']; ?>/index.php?page=store">Store</a></li> <li><a href="<?php echo $config['BaseURL']; ?>/index.php?page=teleporter">Teleporter</a></li> <li><a href="<?php echo $config['BaseURL']; ?>/index.php?page=buycoins">Buy Coins</a></li> <li><a href="<?php echo $config['BaseURL']; ?>/index.php?page=vote">Vote</a></li> <li><a href="<?php echo $config['BaseURL']; ?>/index.php?page=pstore">Premium Store</a></li> <li><a href="<?php echo $config['BaseURL']; ?>/index.php?page=unstuck">Unstuck</a></li> <!--<li id="messages-ddm"> <a href="<?php echo $config['BaseURL']; ?>/index.php?page=pm"> <b>55</b> <i>Private Messages</i> </a> </li>--> </ul> </div> </div> <div class="container_2 account" align="center"> <div class="cont-image"> <div class="container_3 account_sub_header"> <div class="grad"> <div class="page-title">Store activity</div> <a href="<?php echo $config['BaseURL'], '/index.php?page=account'; ?>">Back to account</a> </div> </div> <!-- Store Activity --> <div class="store-activity"> <div class="page-desc-holder"> All the items you have bought from our Store will be shown at this page. </div> <div class="container_3 account-wide" align="center"> <ul class="activity-list"> <?php if ($count > 0) { //calculate the pages $pages = $pagies->calculate_pages($count, $perPage, $p); $userid = $CURUSER->get('id'); //get the activity records $res = $DB->prepare("SELECT * FROM `store_activity` WHERE `account` = :acc ORDER BY id DESC LIMIT ".$pages['limit'].";"); $res->bindParam(':acc', $userid, PDO::PARAM_INT); $res->execute(); //loop the records while ($arr = $res->fetch()) { //get the item record from the store $res2 = $DB->prepare("SELECT entry, name, Quality FROM `store_items` WHERE `id` = :id LIMIT 1;"); $res2->bindParam(':id', $arr['itemId'], PDO::PARAM_INT); $res2->execute(); //check if we have found the item if ($res2->rowCount() > 0) { $item = $res2->fetch(); } else { //that's the array for missing item $item = array('entry' => 0, 'name' => 'Unknown', 'Quality' => '0'); } unset($res2); //format the time $time = $CORE->getTime(true, $arr['time']); $arr['time'] = $time->format('d F Y, H:i:s'); unset($time); echo ' <li> <p id="r-item" class="sac"><a class="', strtolower($CORE->getItemQualityString($item['Quality'])), '" href="', $config['WoWDB_URL'], '/?item=', $item['entry'], '" target="_newtab" rel="item=', $item['entry'], '">[', $item['name'], ']</a></p> <p id="r-date" class="sac">', $arr['time'], '</p> <p id="r-info" class="sac">', $arr['money'], '</p> </li>'; unset($item); } unset($arr); } else { echo '<p class="there-is-nothing">There are no items.</p>'; } unset($res); ?> </ul> </div> <?php if ($count > 0 and $count > $perPage) { echo ' <!-- Pagination --> <div class="d-cont wide pagination-holder"> <ul class="pagination" id="store-pagination"> ', $pages['first'], ' ', $pages['previous'], ' ', $pages['info'], ' ', $pages['next'], ' ', $pages['last'], ' </ul> <div class="clear"></div> </div>'; } ?> </div> <!-- Store Activity.End --> </div> </div> </div> </div> <?php unset($pagies, $pages, $p, $perPage, $where, $count); $TPL->LoadFooter(); ?>
Tyrelis/Warcry-Modified
template/pages/sactivity.php
PHP
gpl-3.0
5,495
//note: please do not modify this file manually! // this file has been generated automatically by BOAST version 2.0.2 // by: make boast_kernels /* !===================================================================== ! ! S p e c f e m 3 D G l o b e V e r s i o n 7 . 0 ! -------------------------------------------------- ! ! Main historical authors: Dimitri Komatitsch and Jeroen Tromp ! Princeton University, USA ! and CNRS / University of Marseille, France ! (there are currently many more authors!) ! (c) Princeton University and CNRS / University of Marseille, April 2014 ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 3 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License along ! with this program; if not, write to the Free Software Foundation, Inc., ! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ! !===================================================================== */ const char * compute_iso_undoatt_kernel_program = "\ inline void atomicAdd(volatile __global float *source, const float val) {\n\ union {\n\ unsigned int iVal;\n\ float fVal;\n\ } res, orig;\n\ do {\n\ orig.fVal = *source;\n\ res.fVal = orig.fVal + val;\n\ } while (atomic_cmpxchg((volatile __global unsigned int *)source, orig.iVal, res.iVal) != orig.iVal);\n\ }\n\ #ifndef INDEX2\n\ #define INDEX2(isize,i,j) i + isize*j\n\ #endif\n\ #ifndef INDEX3\n\ #define INDEX3(isize,jsize,i,j,k) i + isize*(j + jsize*k)\n\ #endif\n\ #ifndef INDEX4\n\ #define INDEX4(isize,jsize,ksize,i,j,k,x) i + isize*(j + jsize*(k + ksize*x))\n\ #endif\n\ #ifndef INDEX5\n\ #define INDEX5(isize,jsize,ksize,xsize,i,j,k,x,y) i + isize*(j + jsize*(k + ksize*(x + xsize*y)))\n\ #endif\n\ \n\ #ifndef NDIM\n\ #define NDIM 3\n\ #endif\n\ #ifndef NGLLX\n\ #define NGLLX 5\n\ #endif\n\ #ifndef NGLL2\n\ #define NGLL2 25\n\ #endif\n\ #ifndef NGLL3\n\ #define NGLL3 125\n\ #endif\n\ #ifndef NGLL3_PADDED\n\ #define NGLL3_PADDED 128\n\ #endif\n\ #ifndef N_SLS\n\ #define N_SLS 3\n\ #endif\n\ #ifndef IREGION_CRUST_MANTLE\n\ #define IREGION_CRUST_MANTLE 1\n\ #endif\n\ #ifndef IREGION_INNER_CORE\n\ #define IREGION_INNER_CORE 3\n\ #endif\n\ #ifndef IFLAG_IN_FICTITIOUS_CUBE\n\ #define IFLAG_IN_FICTITIOUS_CUBE 11\n\ #endif\n\ #ifndef R_EARTH_KM\n\ #define R_EARTH_KM 6371.0f\n\ #endif\n\ #ifndef COLORING_MIN_NSPEC_INNER_CORE\n\ #define COLORING_MIN_NSPEC_INNER_CORE 1000\n\ #endif\n\ #ifndef COLORING_MIN_NSPEC_OUTER_CORE\n\ #define COLORING_MIN_NSPEC_OUTER_CORE 1000\n\ #endif\n\ #ifndef BLOCKSIZE_TRANSFER\n\ #define BLOCKSIZE_TRANSFER 256\n\ #endif\n\ \n\ #if __OPENCL_C_VERSION__ && __OPENCL_C_VERSION__ >= 120\n\ static\n\ #endif\n\ void compute_element_strain_undoatt(const int ispec, const int ijk_ispec, const __global int * d_ibool, const __local float * s_dummyx_loc, const __local float * s_dummyy_loc, const __local float * s_dummyz_loc, const __global float * d_xix, const __global float * d_xiy, const __global float * d_xiz, const __global float * d_etax, const __global float * d_etay, const __global float * d_etaz, const __global float * d_gammax, const __global float * d_gammay, const __global float * d_gammaz, const __local float * sh_hprime_xx, float * epsilondev_loc, float * epsilon_trace_over_3){\n\ int tx;\n\ int K;\n\ int J;\n\ int I;\n\ int l;\n\ int offset;\n\ float tempx1l;\n\ float tempx2l;\n\ float tempx3l;\n\ float tempy1l;\n\ float tempy2l;\n\ float tempy3l;\n\ float tempz1l;\n\ float tempz2l;\n\ float tempz3l;\n\ float xixl;\n\ float xiyl;\n\ float xizl;\n\ float etaxl;\n\ float etayl;\n\ float etazl;\n\ float gammaxl;\n\ float gammayl;\n\ float gammazl;\n\ float duxdxl;\n\ float duxdyl;\n\ float duxdzl;\n\ float duydxl;\n\ float duydyl;\n\ float duydzl;\n\ float duzdxl;\n\ float duzdyl;\n\ float duzdzl;\n\ float templ;\n\ float fac1;\n\ float fac2;\n\ float fac3;\n\ tx = get_local_id(0);\n\ K = (tx) / (NGLL2);\n\ J = (tx - ((K) * (NGLL2))) / (NGLLX);\n\ I = tx - ((K) * (NGLL2)) - ((J) * (NGLLX));\n\ tempx1l = 0.0f;\n\ tempx2l = 0.0f;\n\ tempx3l = 0.0f;\n\ tempy1l = 0.0f;\n\ tempy2l = 0.0f;\n\ tempy3l = 0.0f;\n\ tempz1l = 0.0f;\n\ tempz2l = 0.0f;\n\ tempz3l = 0.0f;\n\ for (l = 0; l <= NGLLX - (1); l += 1) {\n\ fac1 = sh_hprime_xx[(l) * (NGLLX) + I];\n\ tempx1l = tempx1l + (s_dummyx_loc[(K) * (NGLL2) + (J) * (NGLLX) + l]) * (fac1);\n\ tempy1l = tempy1l + (s_dummyy_loc[(K) * (NGLL2) + (J) * (NGLLX) + l]) * (fac1);\n\ tempz1l = tempz1l + (s_dummyz_loc[(K) * (NGLL2) + (J) * (NGLLX) + l]) * (fac1);\n\ fac2 = sh_hprime_xx[(l) * (NGLLX) + J];\n\ tempx2l = tempx2l + (s_dummyx_loc[(K) * (NGLL2) + (l) * (NGLLX) + I]) * (fac2);\n\ tempy2l = tempy2l + (s_dummyy_loc[(K) * (NGLL2) + (l) * (NGLLX) + I]) * (fac2);\n\ tempz2l = tempz2l + (s_dummyz_loc[(K) * (NGLL2) + (l) * (NGLLX) + I]) * (fac2);\n\ fac3 = sh_hprime_xx[(l) * (NGLLX) + K];\n\ tempx3l = tempx3l + (s_dummyx_loc[(l) * (NGLL2) + (J) * (NGLLX) + I]) * (fac3);\n\ tempy3l = tempy3l + (s_dummyy_loc[(l) * (NGLL2) + (J) * (NGLLX) + I]) * (fac3);\n\ tempz3l = tempz3l + (s_dummyz_loc[(l) * (NGLL2) + (J) * (NGLLX) + I]) * (fac3);\n\ }\n\ offset = (ispec) * (NGLL3_PADDED) + tx;\n\ xixl = d_xix[offset];\n\ etaxl = d_etax[offset];\n\ gammaxl = d_gammax[offset];\n\ xiyl = d_xiy[offset];\n\ etayl = d_etay[offset];\n\ gammayl = d_gammay[offset];\n\ xizl = d_xiz[offset];\n\ etazl = d_etaz[offset];\n\ gammazl = d_gammaz[offset];\n\ duxdxl = (xixl) * (tempx1l) + (etaxl) * (tempx2l) + (gammaxl) * (tempx3l);\n\ duxdyl = (xiyl) * (tempx1l) + (etayl) * (tempx2l) + (gammayl) * (tempx3l);\n\ duxdzl = (xizl) * (tempx1l) + (etazl) * (tempx2l) + (gammazl) * (tempx3l);\n\ duydxl = (xixl) * (tempy1l) + (etaxl) * (tempy2l) + (gammaxl) * (tempy3l);\n\ duydyl = (xiyl) * (tempy1l) + (etayl) * (tempy2l) + (gammayl) * (tempy3l);\n\ duydzl = (xizl) * (tempy1l) + (etazl) * (tempy2l) + (gammazl) * (tempy3l);\n\ duzdxl = (xixl) * (tempz1l) + (etaxl) * (tempz2l) + (gammaxl) * (tempz3l);\n\ duzdyl = (xiyl) * (tempz1l) + (etayl) * (tempz2l) + (gammayl) * (tempz3l);\n\ duzdzl = (xizl) * (tempz1l) + (etazl) * (tempz2l) + (gammazl) * (tempz3l);\n\ templ = (duxdxl + duydyl + duzdzl) * (0.3333333333333333f);\n\ epsilondev_loc[0] = duxdxl - (templ);\n\ epsilondev_loc[1] = duydyl - (templ);\n\ epsilondev_loc[2] = (duxdyl + duydxl) * (0.5f);\n\ epsilondev_loc[3] = (duzdxl + duxdzl) * (0.5f);\n\ epsilondev_loc[4] = (duzdyl + duydzl) * (0.5f);\n\ *(epsilon_trace_over_3) = templ;\n\ }\n\ __kernel void compute_iso_undoatt_kernel(const __global float * epsilondev_xx, const __global float * epsilondev_yy, const __global float * epsilondev_xy, const __global float * epsilondev_xz, const __global float * epsilondev_yz, const __global float * epsilon_trace_over_3, __global float * mu_kl, __global float * kappa_kl, const int NSPEC, const float deltat, const __global int * d_ibool, const __global float * d_b_displ, const __global float * d_xix, const __global float * d_xiy, const __global float * d_xiz, const __global float * d_etax, const __global float * d_etay, const __global float * d_etaz, const __global float * d_gammax, const __global float * d_gammay, const __global float * d_gammaz, const __global float * d_hprime_xx){\n\ int ispec;\n\ int ijk_ispec;\n\ int tx;\n\ int iglob;\n\ int offset;\n\ float eps_trace_over_3;\n\ float b_eps_trace_over_3;\n\ float epsdev[(5)];\n\ float b_epsdev[(5)];\n\ __local float s_dummyx_loc[(NGLL3)];\n\ __local float s_dummyy_loc[(NGLL3)];\n\ __local float s_dummyz_loc[(NGLL3)];\n\ __local float sh_hprime_xx[(NGLL2)];\n\ ispec = get_group_id(0) + (get_group_id(1)) * (get_num_groups(0));\n\ ijk_ispec = get_local_id(0) + (NGLL3) * (ispec);\n\ tx = get_local_id(0);\n\ if (tx < NGLL2) {\n\ sh_hprime_xx[tx] = d_hprime_xx[tx];\n\ }\n\ if (ispec < NSPEC) {\n\ iglob = d_ibool[ijk_ispec] - (1);\n\ s_dummyx_loc[tx] = d_b_displ[0 + (3) * (iglob)];\n\ s_dummyy_loc[tx] = d_b_displ[1 + (3) * (iglob)];\n\ s_dummyz_loc[tx] = d_b_displ[2 + (3) * (iglob)];\n\ }\n\ barrier(CLK_LOCAL_MEM_FENCE);\n\ if (ispec < NSPEC) {\n\ epsdev[0] = epsilondev_xx[ijk_ispec];\n\ epsdev[1] = epsilondev_yy[ijk_ispec];\n\ epsdev[2] = epsilondev_xy[ijk_ispec];\n\ epsdev[3] = epsilondev_xz[ijk_ispec];\n\ epsdev[4] = epsilondev_yz[ijk_ispec];\n\ eps_trace_over_3 = epsilon_trace_over_3[ijk_ispec];\n\ compute_element_strain_undoatt(ispec, ijk_ispec, d_ibool, s_dummyx_loc, s_dummyy_loc, s_dummyz_loc, d_xix, d_xiy, d_xiz, d_etax, d_etay, d_etaz, d_gammax, d_gammay, d_gammaz, sh_hprime_xx, b_epsdev, &b_eps_trace_over_3);\n\ mu_kl[ijk_ispec] = mu_kl[ijk_ispec] + (deltat) * ((epsdev[0]) * (b_epsdev[0]) + (epsdev[1]) * (b_epsdev[1]) + (epsdev[0] + epsdev[1]) * (b_epsdev[0] + b_epsdev[1]) + ((epsdev[2]) * (b_epsdev[2]) + (epsdev[3]) * (b_epsdev[3]) + (epsdev[4]) * (b_epsdev[4])) * (2.0f));\n\ kappa_kl[ijk_ispec] = kappa_kl[ijk_ispec] + (deltat) * (((eps_trace_over_3) * (b_eps_trace_over_3)) * (9.0f));\n\ }\n\ }\n\ ";
mpbl/specfem3d_globe
src/gpu/kernels.gen/compute_iso_undoatt_kernel_cl.c
C
gpl-3.0
9,685
package quests; import l2s.gameserver.Config; import l2s.gameserver.model.pledge.Clan; import l2s.gameserver.model.Player; import l2s.gameserver.model.instances.NpcInstance; import l2s.gameserver.model.quest.Quest; import l2s.gameserver.model.quest.QuestState; import l2s.gameserver.network.l2.s2c.SystemMessage; import l2s.gameserver.scripts.ScriptFile; import l2s.gameserver.utils.Util; public class _508_TheClansReputation extends Quest implements ScriptFile { // Quest NPC private static final int SIR_ERIC_RODEMAI = 30868; // Quest Items private static final int NUCLEUS_OF_FLAMESTONE_GIANT = 8494; // Nucleus of Flamestone Giant : Nucleus obtained by defeating Flamestone Giant private static final int THEMIS_SCALE = 8277; // Themis' Scale : Obtain this scale by defeating Palibati Queen Themis. private static final int Hisilromes_Heart = 14883; // Heart obtained after defeating Shilen's Priest Hisilrome. private static final int TIPHON_SHARD = 8280; // Tiphon Shard : Debris obtained by defeating Tiphon, Gargoyle Lord. private static final int GLAKIS_NECLEUS = 8281; // Glaki's Necleus : Nucleus obtained by defeating Glaki, the last lesser Giant. private static final int RAHHAS_FANG = 8282; // Rahha's Fang : Fangs obtained by defeating Rahha. // Quest Raid Bosses private static final int FLAMESTONE_GIANT = 25524; private static final int PALIBATI_QUEEN_THEMIS = 25252; private static final int Shilens_Priest_Hisilrome = 25478; private static final int GARGOYLE_LORD_TIPHON = 25255; private static final int LAST_LESSER_GIANT_GLAKI = 25245; private static final int RAHHA = 25051; // id:[RaidBossNpcId,questItemId] private static final int[][] REWARDS_LIST = { { 0, 0 }, { PALIBATI_QUEEN_THEMIS, THEMIS_SCALE, 85 }, { Shilens_Priest_Hisilrome, Hisilromes_Heart, 65 }, { GARGOYLE_LORD_TIPHON, TIPHON_SHARD, 50 }, { LAST_LESSER_GIANT_GLAKI, GLAKIS_NECLEUS, 125 }, { RAHHA, RAHHAS_FANG, 71 }, { FLAMESTONE_GIANT, NUCLEUS_OF_FLAMESTONE_GIANT, 80 } }; private static final int[][] RADAR = { { 0, 0, 0 }, { 192346, 21528, -3648 }, { 191979, 54902, -7658 }, { 170038, -26236, -3824 }, { 171762, 55028, -5992 }, { 117232, -9476, -3320 }, { 144218, -5816, -4722 }, }; @Override public void onLoad() { } @Override public void onReload() { } @Override public void onShutdown() { } public _508_TheClansReputation() { super(PARTY_ALL); addStartNpc(SIR_ERIC_RODEMAI); for(int[] i : REWARDS_LIST) { if(i[0] > 0) addKillId(i[0]); if(i[1] > 0) addQuestItem(i[1]); } } @Override public String onEvent(String event, QuestState st, NpcInstance npc) { int cond = st.getCond(); String htmltext = event; if(event.equalsIgnoreCase("30868-0.htm") && cond == 0) { st.setCond(1); st.setState(STARTED); } else if(Util.isNumber(event)) { int evt = Integer.parseInt(event); st.set("raid", event); htmltext = "30868-" + event + ".htm"; int x = RADAR[evt][0]; int y = RADAR[evt][1]; int z = RADAR[evt][2]; if(x + y + z > 0) st.addRadar(x, y, z); st.playSound(SOUND_ACCEPT); } else if(event.equalsIgnoreCase("30868-7.htm")) { st.playSound(SOUND_FINISH); st.exitCurrentQuest(true); } return htmltext; } @Override public String onTalk(NpcInstance npc, QuestState st) { String htmltext = "noquest"; Clan clan = st.getPlayer().getClan(); if(clan == null) { st.exitCurrentQuest(true); htmltext = "30868-0a.htm"; } else if(clan.getLeader().getPlayer() != st.getPlayer()) { st.exitCurrentQuest(true); htmltext = "30868-0a.htm"; } else if(clan.getLevel() < 5) { st.exitCurrentQuest(true); htmltext = "30868-0b.htm"; } else { int cond = st.getCond(); int raid = st.getInt("raid"); int id = st.getState(); if(id == CREATED && cond == 0) htmltext = "30868-0c.htm"; else if(id == STARTED && cond == 1) { int item = REWARDS_LIST[raid][1]; long count = st.getQuestItemsCount(item); if(count == 0) htmltext = "30868-" + raid + "a.htm"; else if(count == 1) { htmltext = "30868-" + raid + "b.htm"; int increasedPoints = clan.incReputation(REWARDS_LIST[raid][2], true, "_508_TheClansReputation"); st.getPlayer().sendPacket(new SystemMessage(SystemMessage.YOU_HAVE_SUCCESSFULLY_COMPLETED_A_CLAN_QUEST_S1_POINTS_HAVE_BEEN_ADDED_TO_YOUR_CLAN_REPUTATION_SCORE).addNumber(increasedPoints)); st.takeItems(item, 1); } } } return htmltext; } @Override public String onKill(NpcInstance npc, QuestState st) { Player clan_leader; try { clan_leader = st.getPlayer().getClan().getLeader().getPlayer(); } catch(Exception E) { return null; } if(clan_leader == null) return null; if(!st.getPlayer().equals(clan_leader) && clan_leader.getDistance(npc) > Config.ALT_PARTY_DISTRIBUTION_RANGE) return null; QuestState qs = clan_leader.getQuestState(getName()); if(qs == null || !qs.isStarted() || qs.getCond() != 1) return null; int raid = REWARDS_LIST[st.getInt("raid")][0]; int item = REWARDS_LIST[st.getInt("raid")][1]; if(npc.getNpcId() == raid && st.getQuestItemsCount(item) == 0) { st.giveItems(item, 1); st.playSound(SOUND_MIDDLE); } return null; } }
pantelis60/L2Scripts_Underground
dist/gameserver/data/scripts/quests/_508_TheClansReputation.java
Java
gpl-3.0
5,523
\documentclass[a4paper]{article} \begin{document} \title{Test read\_gmsh.c} \maketitle cretiron of successful reading of msh file: \begin{itemize} \item the sum of the number of internal faces and neighbour faces is 3. \item every internal face has a master cell (owner) and a neighbour cell. boundary face has no neighbour cell, the cell pointer is \verb|NULL|. \item the total ara is correct. \end{itemize} \end{document}
onlyacan/fsc
doc/test_read_msh.tex
TeX
gpl-3.0
434
package it.cnr.isti.labsedc.glimpse.impl; import java.util.HashMap; import java.util.Vector; import org.w3c.dom.Document; import it.cnr.isti.labsedc.glimpse.BPMN.PathExplorer; import it.cnr.isti.labsedc.glimpse.coverage.Activity; public class PathExplorerImpl implements PathExplorer { public Vector<Activity[]> lastExploredBPMN; public Vector<Activity[]> getUnfoldedBPMN(Document theBusinessProcessToUnfold, String idBPMN) { //call the software provided by third parties lastExploredBPMN = new Vector<Activity[]>(); HashMap<String, Float> kpiExample = new HashMap<String, Float>(); kpiExample.put("kpiOne", 0.1f); kpiExample.put("kpiTwo", 0.2f); kpiExample.put("kpiThree", 0.3f); kpiExample.put("kpiFour", 0.4f); Activity obj27830 = new Activity("Assess Application", "Assess Application", "obj.27830", kpiExample, 3000.0f); Activity obj27812 = new Activity("Send Communication of non-admissible instance", "Send Communication of non-admissible instance", "obj.27812", kpiExample, 3000.0f); Activity obj27782 = new Activity("Check Application", "Check Application", "obj.27782", kpiExample, 3000.0f); Activity obj29013 = new Activity("Request Amendment", "Request Amendment", "obj.29013", kpiExample, 3000.0f); Activity obj27833 = new Activity("Check Amendment", "Check Amendment", "obj.27833", kpiExample, 3000.0f); Activity obj27788 = new Activity("Send Authorization Document", "Send Authorization Document", "obj.27788", kpiExample, 3000.0f); Activity obj27839 = new Activity("Manage Inhibition", "Manage Inhibition", "obj.27839", kpiExample, 3000.0f); Activity obj27987 = new Activity("Activate Service Conference", "Activate Service Conference", "obj.27987", kpiExample, 3000.0f); Activity obj27921 = new Activity("Send Instance to Third Party", "Send Instance to Third Party", "obj.27921", kpiExample, 3000.0f); Activity obj27990 = new Activity("Receive Confirmation", "Receive Confirmation", "obj.27990", kpiExample, 3000.0f); Activity usertask1 = new Activity("Activate Service Conference", "Activate Service Conference", "usertask1", kpiExample, 3000.0f); Activity usertask16 = new Activity("Check Amendment", "Check Amendment", "usertask16", kpiExample, 3000.0f); Activity usertask17 = new Activity("Richiedi Integrazione", "Richiedi Integrazione", "usertask17", kpiExample, 3000.0f); Activity usertask18 = new Activity("Fornisce Autorizzazioni", "Fornisce Autorizzazioni", "usertask18", kpiExample, 3000.0f); Activity usertask19 = new Activity("Fornisce Autorizzazioni Sotto Condizione", "Fornisce Autorizzazioni Sotto Condizione", "usertask19", kpiExample, 3000.0f); Activity usertask20 = new Activity("Fornisce Diniego (inibizione a procedere)", "Fornisce Diniego (inibizione a procedere)", "usertask20", kpiExample, 3000.0f); Activity usertask21 = new Activity("Prende la Decisione Finale", "Prende la Decisione Finale", "usertask21", kpiExample, 3000.0f); Activity usertask22 = new Activity("Fornisce Report Finale", "Final decision", "usertask22", kpiExample, 3000.0f); Activity usertask2 = new Activity("Protocolla la documentazione ricevuta", "Protocolla la documentazione ricevuta", "usertask2", kpiExample, 3000.0f); Activity usertask3 = new Activity("Protocolla la documentazione ricevuta", "Protocolla la documentazione ricevuta", "usertask3", kpiExample, 3000.0f); Activity usertask4 = new Activity("Controlla la Documentazione Fornita", "Controlla la Documentazione Fornita", "usertask4", kpiExample, 3000.0f); Activity usertask5 = new Activity("Controlla la Documentazione Fornita", "Controlla la Documentazione Fornita", "usertask5", kpiExample, 3000.0f); Activity usertask6 = new Activity("Elabora Richiesta Integrazioni", "Elabora Richiesta Integrazioni", "usertask6", kpiExample, 3000.0f); Activity usertask7 = new Activity("Elabora Richiesta Integrazioni", "Elabora Richiesta Integrazioni", "usertask7", kpiExample, 3000.0f); Activity usertask8 = new Activity("Prende una Decisione", "Prende una Decisione", "usertask8", kpiExample, 3000.0f); Activity usertask11 = new Activity("Prende una Decisione", "Prende una Decisione", "usertask11", kpiExample, 3000.0f); Activity usertask14 = new Activity("Fornisci Opinione", "Fornisci Opinione", "usertask14", kpiExample, 3000.0f); Activity usertask15 = new Activity("Fornisci Opinione", "Fornisci Opinione", "usertask15", kpiExample, 3000.0f); //titolo unico if (idBPMN.compareTo("mod.21093") == 0) { lastExploredBPMN.add(new Activity[] {obj27830, obj27812}); lastExploredBPMN.add(new Activity[] {obj27830, obj27782, obj27987, obj27990, obj27788}); lastExploredBPMN.add(new Activity[] {obj27830, obj27782, obj27987, obj27990, obj27839}); lastExploredBPMN.add(new Activity[] {obj27830, obj27782, obj27987, obj27990, obj29013, obj27833, obj27788}); lastExploredBPMN.add(new Activity[] {obj27830, obj27782, obj27987, obj27990, obj29013, obj27833, obj27839}); lastExploredBPMN.add(new Activity[] {obj27830, obj27782, obj27921, obj27788}); lastExploredBPMN.add(new Activity[] {obj27830, obj27782, obj27921, obj27839}); lastExploredBPMN.add(new Activity[] {obj27830, obj27782, obj27921, obj27987, obj27990, obj27788}); lastExploredBPMN.add(new Activity[] {obj27830, obj27782, obj27921, obj27987, obj27990, obj27839}); lastExploredBPMN.add(new Activity[] {obj27830, obj27782, obj27921, obj27987, obj27990, obj29013, obj27833, obj27788}); lastExploredBPMN.add(new Activity[] {obj27830, obj27782, obj27921, obj27987, obj27990, obj29013, obj27833, obj27839}); } //conferenza servizi if (idBPMN.compareTo("mod.21262") == 0) { lastExploredBPMN.add(new Activity[] {usertask1, usertask16, usertask17, usertask22}); lastExploredBPMN.add(new Activity[] {usertask1, usertask16, usertask18, usertask22}); lastExploredBPMN.add(new Activity[] {usertask1, usertask16, usertask19, usertask22}); lastExploredBPMN.add(new Activity[] {usertask1, usertask16, usertask20, usertask22}); lastExploredBPMN.add(new Activity[] {usertask1, usertask16, usertask21, usertask22}); lastExploredBPMN.add(new Activity[] {usertask2, usertask4}); lastExploredBPMN.add(new Activity[] {usertask2, usertask4, usertask6, usertask15}); lastExploredBPMN.add(new Activity[] {usertask2, usertask4, usertask8, usertask15}); lastExploredBPMN.add(new Activity[] {usertask3, usertask5}); lastExploredBPMN.add(new Activity[] {usertask3, usertask5, usertask7, usertask14}); lastExploredBPMN.add(new Activity[] {usertask3, usertask5, usertask11, usertask14}); } //controlla pratica if (idBPMN.compareTo("mod.TBD") == 0) { } return lastExploredBPMN; } public void setUnfoldedBPMN(Vector<Activity[]> theUnfoldedBusinessProcess) { lastExploredBPMN = theUnfoldedBusinessProcess; } }
acalabro/glimpse
src/main/java/it/cnr/isti/labsedc/glimpse/impl/PathExplorerImpl.java
Java
gpl-3.0
6,810
#!/bin/sh appname=`basename $0 | sed s,\.sh$,,` dirname=`dirname $0` tmp="${dirname#?}" if [ "${dirname%$tmp}" != "/" ]; then dirname=$PWD/$dirname fi LD_LIBRARY_PATH=$dirname/lib export LD_LIBRARY_PATH # Uncomment to debug plugin loading for Qt # QT_DEBUG_PLUGINS=1 # export QT_DEBUG_PLUGINS appname='BatlabToolkitGUI' gdb "$dirname/$appname" "$@"
Lexcelon/batlab-toolkit-gui
dist/linux/packages/com.lexcelon.batlabtoolkitgui/data/debug-BatlabToolkitGUI.sh
Shell
gpl-3.0
358
# -*- coding: utf-8 -*- # # Copyright (C) 2011 Tiger Soldier # # This file is part of OSD Lyrics. # # OSD Lyrics is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OSD Lyrics 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 OSD Lyrics. If not, see <http://www.gnu.org/licenses/>. #/ import consts import urlparse import urllib import os.path from errors import PatternException def expand_file(pattern, metadata): """ Expands the pattern to a file name according to the infomation of a music The following are supported place holder in the pattern: - %t: Title of the track. 'title' in metadata - %p: Performer (artist) of the music. 'artist' in metadata - %a: Album of the music. 'album' in metadata - %n: Track number of the music. 'tracknumber' in metadata - %f: Filename without extension of the music. 'location' in metadata. - %%: The `%' punctuation Arguments: - `pattern`: The pattern to expand. - `metadata`: A dict representing metadata. Useful keys are listed above. If the pattern cannot be expand, raise an PatternException. Otherwise return the expended pattern. >>> metadata = {'artist': 'Foo', ... 'title': 'Bar', ... 'tracknumber': '1', ... 'album': 'Album', ... 'location': 'file:///%E6%AD%8C%E6%9B%B2/%E7%9A%84/%E5%9C%B0%E5%9D%80.mp3'} >>> expand_file('%p - %t', metadata) 'Foo - Bar' >>> expand_file('foobar', metadata) 'foobar' >>> print expand_file('name is %f :)', metadata) name is 地址 :) >>> expand_file('%something else', metadata) '%something else' >>> expand_file('%%a - %%t', metadata) '%a - %t' >>> expand_file('%%%', metadata) '%%' >>> expand_file('%n - %a:%p,%t', metadata) '1 - Album:Foo,Bar' >>> expand_file('%t', {}) Traceback (most recent call last): ... PatternException: 'title not in metadata' """ keys = {'t': 'title', 'p': 'artist', 'a': 'album', 'n': 'tracknum', } start = 0 parts = [] while start < len(pattern): end = pattern.find('%', start) if end > -1: parts.append(pattern[start:end]) has_tag = False if end + 1 < len(pattern): tag = pattern[end + 1] if tag == '%': has_tag = True parts.append('%') elif tag == 'f': location = metadata.location if not location: raise PatternException('Location not found in metadata') uri = urlparse.urlparse(location) if uri.scheme != '' and not uri.scheme in ['file']: raise PatternException('Unsupported file scheme %s' % uri.scheme) if uri.scheme == '': path = uri.path else: path = urllib.url2pathname(uri.path) basename = os.path.basename(path) root, ext = os.path.splitext(basename) has_tag = True parts.append(root) elif tag in keys: value = getattr(metadata, keys[tag]) if not value: raise PatternException('%s not in metadata' % keys[tag]) has_tag = True parts.append(value) if has_tag: start = end + 2 else: start = end + 1 parts.append('%') else: parts.append(pattern[start:]) break return ''.join(parts) def expand_path(pattern, metadata): """ Expands the pattern to a directory path according to the infomation of a music The pattern can be one of the three forms: - begin with `/': the path is an absolute path and will not be expanded - begin with `~/': the path is an relative path and the `~' wiil be expanded to the absolute path of the user's home directory - `%': the path will be expanded to the directory of the music file according to its URI. ``location`` attribute is used in metadata Arguments: - `pattern`: The pattern to expand. - `metadata`: A dict representing metadata. Useful keys are listed above. If the pattern cannot be expand, raise an PatternException. Otherwise return the expended pattern. >>> expand_path('%', {'location': 'file:///tmp/a.lrc'}) '/tmp' >>> expand_path('%foo', {'location': 'file:///tmp/a.lrc'}) '%foo' >>> expand_path('/bar', {}) '/bar' >>> expand_path('%', {'Title': 'hello'}) Traceback (most recent call last): ... PatternException: 'Location not found in metadata' """ if pattern == '%': location = metadata.location if not location: raise PatternException('Location not found in metadata') uri = urlparse.urlparse(location) if not uri.scheme in ['file']: raise PatternException('Unsupported file scheme %s' % uri.scheme) path = urllib.url2pathname(uri.path) return os.path.dirname(path) return os.path.expanduser(pattern) if __name__ == '__main__': import doctest doctest.testmod()
ihacklog/osdlyrics
python/pattern.py
Python
gpl-3.0
5,769
/* * ProtoBuffMessage.cpp * * Created on: 2014年7月12日 * Author: jarek * Brief: */ #include <Common/Message/ProtoBuffMessage.h> #include <Engine/Log/LogMacro.h> #include <sstream> #include <Engine/Language/String.h> #include <Engine/Util/Util.h> using namespace std; ProtoBuffMessage::ProtoBuffMessage() { // NULL } ProtoBuffMessage::~ProtoBuffMessage() { // NULL; } bool ProtoBuffMessage::ParseMsg(const string& binaryData) { if (!protoBuffMsgSet.ParseFromString(binaryData)) { LOG_ERR("Parse msg error data<%s>", BinaryToReadableString(binaryData.c_str(), binaryData.size()).c_str()); assert(false); return false; } #if MSG_TRACE_ON LOG_TRACE("ProtobufMsg<%s> init from orignial data to be handled", BriefInfo()); #endif return true; } int ProtoBuffMessage::GetMessageID() const { return protoBuffMsgSet.msg().Get(0).id(); } int ProtoBuffMessage::GetSequenceID() const { return protoBuffMsgSet.head().sequence(); } string ProtoBuffMessage::BriefInfo() const { stringstream briefInfo; briefInfo << "sessionID:" << protoBuffMsgSet.head().session_id(); briefInfo << ", sequence:" << protoBuffMsgSet.head().sequence(); for (int i = 0; i < protoBuffMsgSet.msg().size(); ++i) { briefInfo << ", msgID:" << MsgID_Name(protoBuffMsgSet.msg().Get(i).id()); } return briefInfo.str(); } string ProtoBuffMessage::DetailInfo() const { return protoBuffMsgSet.DebugString(); } MsgSet& ProtoBuffMessage::GetMsgSet() { return protoBuffMsgSet; } const MsgSet& ProtoBuffMessage::GetMsgSet() const { return protoBuffMsgSet; } int ProtoBuffMessage::GetSessionID() const { return protoBuffMsgSet.head().session_id(); } NetMsg& ProtoBuffMessage::GetDefaultMsg() { if (protoBuffMsgSet.msg().size() == 0) { return *(protoBuffMsgSet.mutable_msg()->Add()); } else { return *(protoBuffMsgSet.mutable_msg()->Mutable(0)); } } const NetMsg* ProtoBuffMessage::GetMsgByMsgID(MsgID msgID) const { for (int i = 0; i < protoBuffMsgSet.msg().size(); ++i) { const NetMsg& msg = protoBuffMsgSet.msg(i); if (msg.id() == msgID) { return &msg; } } return NULL; }
jarekzha/ChaosServer
Src/Common/Message/ProtoBuffMessage.cpp
C++
gpl-3.0
2,278
'use strict' const Q = require(`q`) const readFile = Q.denodeify(require(`fs`).readFile) const resolve = require(`path`).resolve module.exports = Q.all([ readFile(resolve(__dirname, './templates/template.hbs'), 'utf-8'), readFile(resolve(__dirname, './templates/header.hbs'), 'utf-8'), readFile(resolve(__dirname, './templates/commit.hbs'), 'utf-8') ]) .spread((template, header, commit) => { const writerOpts = getWriterOpts() writerOpts.mainTemplate = template writerOpts.headerPartial = header writerOpts.commitPartial = commit return writerOpts }) function getWriterOpts () { return { transform: (commit) => { if (!commit.language) { return } if (typeof commit.hash === `string`) { commit.hash = commit.hash.substring(0, 7) } return commit }, groupBy: `language`, commitGroupsSort: `title`, commitsSort: [`language`, `type`, `message`] } }
nitishvu/ProjectTracking
node_modules/conventional-changelog-codemirror/writer-opts.js
JavaScript
gpl-3.0
951
<?php // Define the APPLICATION settings array define('SETTINGS', parse_ini_file('../config/application.ini')); // Define the environment that the application is running define('ENVIRONMENT', SETTINGS['environment']); // Define include paths for php define('PUBLICPATH', realpath(dirname(__FILE__))); define('BASEPATH', realpath(PUBLICPATH . '/..')); define('LIBRARY', BASEPATH . '/library'); define('APPLICATION', BASEPATH . '/application'); // Define extensions for file types define('SCRIPTEXT', SETTINGS['script_extension']); define('DISPLAYEXT', SETTINGS['display_extension']); // Define database credentials define('DATABASE', array( "HOST" => SETTINGS['database_host'], "NAME" => SETTINGS['database_name'], "USER" => SETTINGS['database_user'], "PASSWORD" => SETTINGS['database_password'] )); // Add paths to the include path for php set_include_path( implode( PATH_SEPARATOR, array( BASEPATH, PUBLICPATH, LIBRARY, APPLICATION, get_include_path() ) ) ); // Load the bootstrap file include 'bootstrap' . SCRIPTEXT;
lazybearcreations/lazybear-boilerplate
public_html/index.php
PHP
gpl-3.0
1,135
<?php /* * Portal Content Management System * Copyright (C) 2011 Hendrik Weiler * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @author Hendrik Weiler * @license http://www.gnu.org/licenses/gpl.html * @copyright 2011 Hendrik Weiler */ class Controller_Shop_Article extends Controller { private $data = array(); private $id; public function before() { model_auth::check_startup(); $this->data['title'] = 'Admin - Shop'; $this->id = $this->param('id'); $permissions = model_permission::mainNavigation(); $this->data['permission'] = $permissions[Session::get('lang_prefix')]; if(!model_permission::currentLangValid() && model_permission::$user->admin) Response::redirect('admin/logout'); Lang::load('tasks'); } public function action_add() { if(Input::post('add_article') != '') { $article = new model_db_article(); $first_lang = model_db_language::find('first'); $article->label = json_encode(array( $first_lang->prefix => Input::post('label') )); $article->description = json_encode(array( $first_lang->prefix => 'Description of ' . Input::post('label') )); $article->price = 0; $article->tax_group_id = model_db_tax_group::find('first')->id; $article->main_image_index = 0; $article->sold_out = 0; $article->save(); $last_article = model_db_article::find('last'); Response::redirect('admin/shop/articles/edit/' . $last_article->id); } } public function action_delete() { $article_id = $this->param('id'); $article = model_db_article::find($article_id); File::delete_dir(DOCROOT . 'uploads/shop/article/' . $article->id); $article->delete(); Response::redirect('admin/shop/articles'); } public function action_delete_picture() { $article_id = $this->param('id'); $picture_index = $this->param('index'); $article = model_db_article::find($article_id); $images = Format::forge($article->images,'json')->to_array(); $picture_name = $images[$picture_index]; unset($images[$picture_index]); $article->images = Format::forge($images)->to_json(); if($article->main_image_index == $picture_index) $article->main_image_index = 0; $article->save(); File::delete(DOCROOT . 'uploads/shop/article/' . $article->id . '/original/' . $picture_name); File::delete(DOCROOT . 'uploads/shop/article/' . $article->id . '/medium/' . $picture_name); File::delete(DOCROOT . 'uploads/shop/article/' . $article->id . '/big/' . $picture_name); File::delete(DOCROOT . 'uploads/shop/article/' . $article->id . '/thumbs/' . $picture_name); Response::redirect('admin/shop/articles/edit/' . $article->id); } public function action_edit() { $id = $this->param('id'); $data = array(); $data['article'] = model_db_article::find($id); if(Input::post('edit_article') != '') { $labels = array(); $descriptions = array(); foreach ($_POST as $key => $value) { if(preg_match('#lang_#i', $key)) { $lang_prefix = explode('lang_', $key); $labels[$lang_prefix[1]] = $value; } if(preg_match('#editor_#i', $key)) { $lang_prefix = explode('editor_', $key); $descriptions[$lang_prefix[1]] = $value; } } $data['article']->label = Format::forge($labels)->to_json(); $data['article']->description = Format::forge($descriptions)->to_json(); $data['article']->tax_group_id = Input::post('tax_group'); $data['article']->price = str_replace(',','.',Input::post('price')); $data['article']->article_group_id = Input::post('article_group'); $data['article']->sold_out = Input::post('sold_out') == '' ? 0 : 1; $data['article']->nr = Input::post('nr'); $data['article']->main_image_index = Input::post('main_image_index'); if(!is_dir(DOCROOT . 'uploads/shop/article/' . $data['article']->id)) File::create_dir(DOCROOT . 'uploads/shop/article/' , $data['article']->id,0777); if(!is_dir(DOCROOT . 'uploads/shop/article/' . $data['article']->id. '/original')) File::create_dir(DOCROOT . 'uploads/shop/article/' , $data['article']->id . '/original',0777); if(!is_dir(DOCROOT . 'uploads/shop/article/' . $data['article']->id. '/big')) File::create_dir(DOCROOT . 'uploads/shop/article/' , $data['article']->id . '/big',0777); if(!is_dir(DOCROOT . 'uploads/shop/article/' . $data['article']->id. '/medium')) File::create_dir(DOCROOT . 'uploads/shop/article/' , $data['article']->id . '/medium',0777); if(!is_dir(DOCROOT . 'uploads/shop/article/' . $data['article']->id. '/thumbs')) File::create_dir(DOCROOT . 'uploads/shop/article/' , $data['article']->id . '/thumbs',0777); $config = array( 'path' => DOCROOT.'uploads/shop/article/' . $data['article']->id . '/original', 'randomize' => true, 'auto_rename' => false, 'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png'), ); Upload::process($config); empty($data['article']->images) and $data['article']->images = '[]'; $data['article']->images = json_decode($data['article']->images,true); if (Upload::is_valid()) { Upload::save(); foreach(Upload::get_files() as $file) { $resizeObj = new image\resize(DOCROOT . 'uploads/shop/article/' . $data['article']->id . '/original/' . $file['saved_as']); $size = Image::sizes(DOCROOT . 'uploads/shop/article/' . $data['article']->id . '/original/' . $file['saved_as']); if($size->width >= 1280) $size->width = 1280; if($size->height >= 720) $size->height = 720; $data['article']->images[] = $file['saved_as']; $resizeObj -> resizeImage($size->width, $size->height, 'auto'); $resizeObj -> saveImage(DOCROOT . 'uploads/shop/article/' . $data['article']->id . '/big/' . $file['saved_as'], 100); $resizeObj -> resizeImage(150, 150, 'crop'); $resizeObj -> saveImage(DOCROOT . 'uploads/shop/article/' . $data['article']->id . '/medium/' . $file['saved_as'], 100); $resizeObj -> resizeImage(50, 50, 'crop'); $resizeObj -> saveImage(DOCROOT . 'uploads/shop/article/' . $data['article']->id . '/thumbs/' . $file['saved_as'], 100); } } $data['article']->images = Format::forge($data['article']->images)->to_json(); $data['article']->save(); Response::redirect(Uri::current()); } $labels = Format::forge($data['article']->label, 'json')->to_array(); $data['labels'] = array(); foreach (model_db_language::find('all') as $lang) { !isset($labels[$lang->prefix]) and $labels[$lang->prefix] = ''; $data['labels'][$lang->prefix] = $labels[$lang->prefix]; } $descriptions = Format::forge($data['article']->description, 'json')->to_array(); empty($data['article']->images) and $data['article']->images = '[]'; $data['descriptions'] = array(); foreach (model_db_language::find('all') as $lang) { !isset($descriptions[$lang->prefix]) and $descriptions[$lang->prefix] = ''; $data['descriptions'][$lang->prefix] = $descriptions[$lang->prefix]; } $data['images'] = Format::forge($data['article']->images,'json')->to_array(); $this->data['content'] = View::factory('admin/shop/columns/article_edit',$data); if(Input::post('back') != '') { Response::redirect('admin/shop/articles'); } } public function action_index() { $data = array(); $data['articles'] = model_db_article::find('all'); $this->data['content'] = View::factory('admin/shop/columns/article',$data); } public function after($response) { $this->response->body = View::factory('admin/index',$this->data); } }
hendrik-weiler/Portal-CMS
fuel/app/classes/controller/shop/article.php
PHP
gpl-3.0
8,133
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_144) on Sat Oct 28 05:22:53 EDT 2017 --> <title>NetworkTable (Documentation - Release API)</title> <meta name="date" content="2017-10-28"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="NetworkTable (Documentation - Release API)"; } } catch(err) { } //--> var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../edu/wpi/first/networktables/LogMessage.html" title="class in edu.wpi.first.networktables"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../edu/wpi/first/networktables/NetworkTableEntry.html" title="class in edu.wpi.first.networktables"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?edu/wpi/first/networktables/NetworkTable.html" target="_top">Frames</a></li> <li><a href="NetworkTable.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">edu.wpi.first.networktables</div> <h2 title="Class NetworkTable" class="title">Class NetworkTable</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>edu.wpi.first.networktables.NetworkTable</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>public final class <span class="typeNameLabel">NetworkTable</span> extends java.lang.Object</pre> <div class="block">A network table that knows its subtable path.</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- =========== FIELD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="field.summary"> <!-- --> </a> <h3>Field Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> <caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>static char</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#PATH_SEPARATOR">PATH_SEPARATOR</a></span></code> <div class="block">The path separator for sub-tables and keys</div> </td> </tr> </table> </li> </ul> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#NetworkTable-edu.wpi.first.networktables.NetworkTableInstance-java.lang.String-">NetworkTable</a></span>(<a href="../../../../edu/wpi/first/networktables/NetworkTableInstance.html" title="class in edu.wpi.first.networktables">NetworkTableInstance</a>&nbsp;inst, java.lang.String&nbsp;path)</code>&nbsp;</td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#addEntryListener-java.lang.String-edu.wpi.first.networktables.TableEntryListener-int-">addEntryListener</a></span>(java.lang.String&nbsp;key, <a href="../../../../edu/wpi/first/networktables/TableEntryListener.html" title="interface in edu.wpi.first.networktables">TableEntryListener</a>&nbsp;listener, int&nbsp;flags)</code> <div class="block">Listen to a single key.</div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#addEntryListener-edu.wpi.first.networktables.TableEntryListener-int-">addEntryListener</a></span>(<a href="../../../../edu/wpi/first/networktables/TableEntryListener.html" title="interface in edu.wpi.first.networktables">TableEntryListener</a>&nbsp;listener, int&nbsp;flags)</code> <div class="block">Listen to keys only within this table.</div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#addSubTableListener-edu.wpi.first.networktables.TableListener-boolean-">addSubTableListener</a></span>(<a href="../../../../edu/wpi/first/networktables/TableListener.html" title="interface in edu.wpi.first.networktables">TableListener</a>&nbsp;listener, boolean&nbsp;localNotify)</code> <div class="block">Listen for sub-table creation.</div> </td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#containsKey-java.lang.String-">containsKey</a></span>(java.lang.String&nbsp;key)</code> <div class="block">Checks the table and tells if it contains the specified key</div> </td> </tr> <tr id="i4" class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#containsSubTable-java.lang.String-">containsSubTable</a></span>(java.lang.String&nbsp;key)</code>&nbsp;</td> </tr> <tr id="i5" class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#delete-java.lang.String-">delete</a></span>(java.lang.String&nbsp;key)</code> <div class="block">Deletes the specified key in this table.</div> </td> </tr> <tr id="i6" class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#equals-java.lang.Object-">equals</a></span>(java.lang.Object&nbsp;o)</code>&nbsp;</td> </tr> <tr id="i7" class="rowColor"> <td class="colFirst"><code><a href="../../../../edu/wpi/first/networktables/NetworkTableEntry.html" title="class in edu.wpi.first.networktables">NetworkTableEntry</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#getEntry-java.lang.String-">getEntry</a></span>(java.lang.String&nbsp;key)</code> <div class="block">Gets the entry for a subkey.</div> </td> </tr> <tr id="i8" class="altColor"> <td class="colFirst"><code><a href="../../../../edu/wpi/first/networktables/NetworkTableInstance.html" title="class in edu.wpi.first.networktables">NetworkTableInstance</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#getInstance--">getInstance</a></span>()</code> <div class="block">Gets the instance for the table.</div> </td> </tr> <tr id="i9" class="rowColor"> <td class="colFirst"><code>java.util.Set&lt;java.lang.String&gt;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#getKeys--">getKeys</a></span>()</code> <div class="block">Gets all keys in the table (not including sub-tables).</div> </td> </tr> <tr id="i10" class="altColor"> <td class="colFirst"><code>java.util.Set&lt;java.lang.String&gt;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#getKeys-int-">getKeys</a></span>(int&nbsp;types)</code> <div class="block">Gets all keys in the table (not including sub-tables).</div> </td> </tr> <tr id="i11" class="rowColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#getPath--">getPath</a></span>()</code></td> </tr> <tr id="i12" class="altColor"> <td class="colFirst"><code><a href="../../../../edu/wpi/first/networktables/NetworkTable.html" title="class in edu.wpi.first.networktables">NetworkTable</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#getSubTable-java.lang.String-">getSubTable</a></span>(java.lang.String&nbsp;key)</code> <div class="block">Returns the table at the specified key.</div> </td> </tr> <tr id="i13" class="rowColor"> <td class="colFirst"><code>java.util.Set&lt;java.lang.String&gt;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#getSubTables--">getSubTables</a></span>()</code> <div class="block">Gets the names of all subtables in the table.</div> </td> </tr> <tr id="i14" class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#hashCode--">hashCode</a></span>()</code>&nbsp;</td> </tr> <tr id="i15" class="rowColor"> <td class="colFirst"><code>java.lang.String[]</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#loadEntries-java.lang.String-">loadEntries</a></span>(java.lang.String&nbsp;filename)</code> <div class="block">Load table values from a file.</div> </td> </tr> <tr id="i16" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#removeEntryListener-int-">removeEntryListener</a></span>(int&nbsp;listener)</code> <div class="block">Remove an entry listener.</div> </td> </tr> <tr id="i17" class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#removeTableListener-int-">removeTableListener</a></span>(int&nbsp;listener)</code> <div class="block">Remove a sub-table listener.</div> </td> </tr> <tr id="i18" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#saveEntries-java.lang.String-">saveEntries</a></span>(java.lang.String&nbsp;filename)</code> <div class="block">Save table values to a file.</div> </td> </tr> <tr id="i19" class="rowColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/networktables/NetworkTable.html#toString--">toString</a></span>()</code>&nbsp;</td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, finalize, getClass, notify, notifyAll, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ FIELD DETAIL =========== --> <ul class="blockList"> <li class="blockList"><a name="field.detail"> <!-- --> </a> <h3>Field Detail</h3> <a name="PATH_SEPARATOR"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>PATH_SEPARATOR</h4> <pre>public static final&nbsp;char PATH_SEPARATOR</pre> <div class="block">The path separator for sub-tables and keys</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../constant-values.html#edu.wpi.first.networktables.NetworkTable.PATH_SEPARATOR">Constant Field Values</a></dd> </dl> </li> </ul> </li> </ul> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="NetworkTable-edu.wpi.first.networktables.NetworkTableInstance-java.lang.String-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>NetworkTable</h4> <pre>public&nbsp;NetworkTable(<a href="../../../../edu/wpi/first/networktables/NetworkTableInstance.html" title="class in edu.wpi.first.networktables">NetworkTableInstance</a>&nbsp;inst, java.lang.String&nbsp;path)</pre> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getInstance--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getInstance</h4> <pre>public&nbsp;<a href="../../../../edu/wpi/first/networktables/NetworkTableInstance.html" title="class in edu.wpi.first.networktables">NetworkTableInstance</a>&nbsp;getInstance()</pre> <div class="block">Gets the instance for the table.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>Instance</dd> </dl> </li> </ul> <a name="toString--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>toString</h4> <pre>public&nbsp;java.lang.String&nbsp;toString()</pre> <dl> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd> </dl> </li> </ul> <a name="getEntry-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getEntry</h4> <pre>public&nbsp;<a href="../../../../edu/wpi/first/networktables/NetworkTableEntry.html" title="class in edu.wpi.first.networktables">NetworkTableEntry</a>&nbsp;getEntry(java.lang.String&nbsp;key)</pre> <div class="block">Gets the entry for a subkey.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>key</code> - the key name</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>Network table entry.</dd> </dl> </li> </ul> <a name="addEntryListener-edu.wpi.first.networktables.TableEntryListener-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>addEntryListener</h4> <pre>public&nbsp;int&nbsp;addEntryListener(<a href="../../../../edu/wpi/first/networktables/TableEntryListener.html" title="interface in edu.wpi.first.networktables">TableEntryListener</a>&nbsp;listener, int&nbsp;flags)</pre> <div class="block">Listen to keys only within this table.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>listener</code> - listener to add</dd> <dd><code>flags</code> - <a href="../../../../edu/wpi/first/networktables/EntryListenerFlags.html" title="interface in edu.wpi.first.networktables"><code>EntryListenerFlags</code></a> bitmask</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>Listener handle</dd> </dl> </li> </ul> <a name="addEntryListener-java.lang.String-edu.wpi.first.networktables.TableEntryListener-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>addEntryListener</h4> <pre>public&nbsp;int&nbsp;addEntryListener(java.lang.String&nbsp;key, <a href="../../../../edu/wpi/first/networktables/TableEntryListener.html" title="interface in edu.wpi.first.networktables">TableEntryListener</a>&nbsp;listener, int&nbsp;flags)</pre> <div class="block">Listen to a single key.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>key</code> - the key name</dd> <dd><code>listener</code> - listener to add</dd> <dd><code>flags</code> - <a href="../../../../edu/wpi/first/networktables/EntryListenerFlags.html" title="interface in edu.wpi.first.networktables"><code>EntryListenerFlags</code></a> bitmask</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>Listener handle</dd> </dl> </li> </ul> <a name="removeEntryListener-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>removeEntryListener</h4> <pre>public&nbsp;void&nbsp;removeEntryListener(int&nbsp;listener)</pre> <div class="block">Remove an entry listener.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>listener</code> - listener handle</dd> </dl> </li> </ul> <a name="addSubTableListener-edu.wpi.first.networktables.TableListener-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>addSubTableListener</h4> <pre>public&nbsp;int&nbsp;addSubTableListener(<a href="../../../../edu/wpi/first/networktables/TableListener.html" title="interface in edu.wpi.first.networktables">TableListener</a>&nbsp;listener, boolean&nbsp;localNotify)</pre> <div class="block">Listen for sub-table creation. This calls the listener once for each newly created sub-table. It immediately calls the listener for any existing sub-tables.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>listener</code> - listener to add</dd> <dd><code>localNotify</code> - notify local changes as well as remote</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>Listener handle</dd> </dl> </li> </ul> <a name="removeTableListener-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>removeTableListener</h4> <pre>public&nbsp;void&nbsp;removeTableListener(int&nbsp;listener)</pre> <div class="block">Remove a sub-table listener.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>listener</code> - listener handle</dd> </dl> </li> </ul> <a name="getSubTable-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getSubTable</h4> <pre>public&nbsp;<a href="../../../../edu/wpi/first/networktables/NetworkTable.html" title="class in edu.wpi.first.networktables">NetworkTable</a>&nbsp;getSubTable(java.lang.String&nbsp;key)</pre> <div class="block">Returns the table at the specified key. If there is no table at the specified key, it will create a new table</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>key</code> - the name of the table relative to this one</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a sub table relative to this one</dd> </dl> </li> </ul> <a name="containsKey-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>containsKey</h4> <pre>public&nbsp;boolean&nbsp;containsKey(java.lang.String&nbsp;key)</pre> <div class="block">Checks the table and tells if it contains the specified key</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>key</code> - the key to search for</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if the table as a value assigned to the given key</dd> </dl> </li> </ul> <a name="containsSubTable-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>containsSubTable</h4> <pre>public&nbsp;boolean&nbsp;containsSubTable(java.lang.String&nbsp;key)</pre> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>key</code> - the key to search for</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if there is a subtable with the key which contains at least one key/subtable of its own</dd> </dl> </li> </ul> <a name="getKeys-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getKeys</h4> <pre>public&nbsp;java.util.Set&lt;java.lang.String&gt;&nbsp;getKeys(int&nbsp;types)</pre> <div class="block">Gets all keys in the table (not including sub-tables).</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>types</code> - bitmask of types; 0 is treated as a "don't care".</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>keys currently in the table</dd> </dl> </li> </ul> <a name="getKeys--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getKeys</h4> <pre>public&nbsp;java.util.Set&lt;java.lang.String&gt;&nbsp;getKeys()</pre> <div class="block">Gets all keys in the table (not including sub-tables).</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>keys currently in the table</dd> </dl> </li> </ul> <a name="getSubTables--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getSubTables</h4> <pre>public&nbsp;java.util.Set&lt;java.lang.String&gt;&nbsp;getSubTables()</pre> <div class="block">Gets the names of all subtables in the table.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>subtables currently in the table</dd> </dl> </li> </ul> <a name="delete-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>delete</h4> <pre>public&nbsp;void&nbsp;delete(java.lang.String&nbsp;key)</pre> <div class="block">Deletes the specified key in this table. The key can not be null.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>key</code> - the key name</dd> </dl> </li> </ul> <a name="getPath--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getPath</h4> <pre>public&nbsp;java.lang.String&nbsp;getPath()</pre> </li> </ul> <a name="saveEntries-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>saveEntries</h4> <pre>public&nbsp;void&nbsp;saveEntries(java.lang.String&nbsp;filename) throws <a href="../../../../edu/wpi/first/networktables/PersistentException.html" title="class in edu.wpi.first.networktables">PersistentException</a></pre> <div class="block">Save table values to a file. The file format used is identical to that used for SavePersistent.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>filename</code> - filename</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="../../../../edu/wpi/first/networktables/PersistentException.html" title="class in edu.wpi.first.networktables">PersistentException</a></code> - if error saving file</dd> </dl> </li> </ul> <a name="loadEntries-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>loadEntries</h4> <pre>public&nbsp;java.lang.String[]&nbsp;loadEntries(java.lang.String&nbsp;filename) throws <a href="../../../../edu/wpi/first/networktables/PersistentException.html" title="class in edu.wpi.first.networktables">PersistentException</a></pre> <div class="block">Load table values from a file. The file format used is identical to that used for SavePersistent / LoadPersistent.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>filename</code> - filename</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>List of warnings (errors result in an exception instead)</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="../../../../edu/wpi/first/networktables/PersistentException.html" title="class in edu.wpi.first.networktables">PersistentException</a></code> - if error saving file</dd> </dl> </li> </ul> <a name="equals-java.lang.Object-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>equals</h4> <pre>public&nbsp;boolean&nbsp;equals(java.lang.Object&nbsp;o)</pre> <dl> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code>equals</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd> </dl> </li> </ul> <a name="hashCode--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>hashCode</h4> <pre>public&nbsp;int&nbsp;hashCode()</pre> <dl> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code>hashCode</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../edu/wpi/first/networktables/LogMessage.html" title="class in edu.wpi.first.networktables"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../edu/wpi/first/networktables/NetworkTableEntry.html" title="class in edu.wpi.first.networktables"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?edu/wpi/first/networktables/NetworkTable.html" target="_top">Frames</a></li> <li><a href="NetworkTable.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
wh1ter0se/PowerUp-2018
wpilib18/java/current/javadoc/edu/wpi/first/networktables/NetworkTable.html
HTML
gpl-3.0
29,694
/* * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ #include <src/include/pmix_config.h> #include <src/include/types.h> #include "src/util/argv.h" #include "src/util/error.h" #include "src/util/output.h" #include "src/buffer_ops/types.h" #include "src/buffer_ops/internal.h" pmix_status_t pmix_bfrop_unpack(pmix_buffer_t *buffer, void *dst, int32_t *num_vals, pmix_data_type_t type) { pmix_status_t rc, ret; int32_t local_num, n=1; pmix_data_type_t local_type; /* check for error */ if (NULL == buffer || NULL == dst || NULL == num_vals) { return PMIX_ERR_BAD_PARAM; } /* if user provides a zero for num_vals, then there is no storage allocated * so return an appropriate error */ if (0 == *num_vals) { pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: inadequate space ( %p, %p, %lu, %d )\n", (void*)buffer, dst, (long unsigned int)*num_vals, (int)type); return PMIX_ERR_UNPACK_INADEQUATE_SPACE; } /** Unpack the declared number of values * REMINDER: it is possible that the buffer is corrupted and that * the BFROP will *think* there is a proper int32_t variable at the * beginning of the unpack region - but that the value is bogus (e.g., just * a byte field in a string array that so happens to have a value that * matches the int32_t data type flag). Therefore, this error check is * NOT completely safe. This is true for ALL unpack functions, not just * int32_t as used here. */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { if (PMIX_SUCCESS != (rc = pmix_bfrop_get_data_type(buffer, &local_type))) { *num_vals = 0; /* don't error log here as the user may be unpacking past * the end of the buffer, which isn't necessarily an error */ return rc; } if (PMIX_INT32 != local_type) { /* if the length wasn't first, then error */ *num_vals = 0; return PMIX_ERR_UNPACK_FAILURE; } } n=1; if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_int32(buffer, &local_num, &n, PMIX_INT32))) { *num_vals = 0; /* don't error log here as the user may be unpacking past * the end of the buffer, which isn't necessarily an error */ return rc; } pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: found %d values for %d provided storage", local_num, *num_vals); /** if the storage provided is inadequate, set things up * to unpack as much as we can and to return an error code * indicating that everything was not unpacked - the buffer * is left in a state where it can not be further unpacked. */ if (local_num > *num_vals) { local_num = *num_vals; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: inadequate space ( %p, %p, %lu, %d )\n", (void*)buffer, dst, (long unsigned int)*num_vals, (int)type); ret = PMIX_ERR_UNPACK_INADEQUATE_SPACE; } else { /** enough or more than enough storage */ *num_vals = local_num; /** let the user know how many we actually unpacked */ ret = PMIX_SUCCESS; } /** Unpack the value(s) */ if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_buffer(buffer, dst, &local_num, type))) { *num_vals = 0; ret = rc; } return ret; } pmix_status_t pmix_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32_t *num_vals, pmix_data_type_t type) { pmix_status_t rc; pmix_data_type_t local_type; pmix_bfrop_type_info_t *info; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_buffer( %p, %p, %lu, %d )\n", (void*)buffer, dst, (long unsigned int)*num_vals, (int)type); /** Unpack the declared data type */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { if (PMIX_SUCCESS != (rc = pmix_bfrop_get_data_type(buffer, &local_type))) { return rc; } /* if the data types don't match, then return an error */ if (type != local_type) { pmix_output(0, "PMIX bfrop:unpack: got type %d when expecting type %d", local_type, type); return PMIX_ERR_PACK_MISMATCH; } } /* Lookup the unpack function for this type and call it */ if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&pmix_bfrop_types, type))) { return PMIX_ERR_UNPACK_FAILURE; } return info->odti_unpack_fn(buffer, dst, num_vals, type); } /* UNPACK GENERIC SYSTEM TYPES */ /* * BOOL */ pmix_status_t pmix_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint8_t *src; bool *dst; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_bool * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, *num_vals)) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; } /* unpack the data */ src = (uint8_t*)buffer->unpack_ptr; dst = (bool*)dest; for (i=0; i < *num_vals; i++) { if (src[i]) { dst[i] = true; } else { dst[i] = false; } } /* update buffer pointer */ buffer->unpack_ptr += *num_vals; return PMIX_SUCCESS; } /* * INT */ pmix_status_t pmix_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &remote_type))) { return ret; } if (remote_type == BFROP_TYPE_INT) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, dest, num_vals, BFROP_TYPE_INT))) { } } else { /* slow path - types are different sizes */ UNPACK_SIZE_MISMATCH(int, remote_type, ret); } return ret; } /* * SIZE_T */ pmix_status_t pmix_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &remote_type))) { return ret; } if (remote_type == BFROP_TYPE_SIZE_T) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, dest, num_vals, BFROP_TYPE_SIZE_T))) { } } else { /* slow path - types are different sizes */ UNPACK_SIZE_MISMATCH(size_t, remote_type, ret); } return ret; } /* * PID_T */ pmix_status_t pmix_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &remote_type))) { return ret; } if (remote_type == BFROP_TYPE_PID_T) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, dest, num_vals, BFROP_TYPE_PID_T))) { } } else { /* slow path - types are different sizes */ UNPACK_SIZE_MISMATCH(pid_t, remote_type, ret); } return ret; } /* UNPACK FUNCTIONS FOR NON-GENERIC SYSTEM TYPES */ /* * BYTE, CHAR, INT8 */ pmix_status_t pmix_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_byte * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, *num_vals)) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; } /* unpack the data */ memcpy(dest, buffer->unpack_ptr, *num_vals); /* update buffer pointer */ buffer->unpack_ptr += *num_vals; return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint16_t tmp, *desttmp = (uint16_t*) dest; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_int16 * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(tmp))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; } /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) ); tmp = pmix_ntohs(tmp); memcpy(&desttmp[i], &tmp, sizeof(tmp)); buffer->unpack_ptr += sizeof(tmp); } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint32_t tmp, *desttmp = (uint32_t*) dest; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_int32 * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(tmp))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; } /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) ); tmp = ntohl(tmp); memcpy(&desttmp[i], &tmp, sizeof(tmp)); buffer->unpack_ptr += sizeof(tmp); } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { return pmix_bfrop_unpack_int32(buffer, dest, num_vals, type); } pmix_status_t pmix_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint64_t tmp, *desttmp = (uint64_t*) dest; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_int64 * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(tmp))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; } /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) ); tmp = pmix_ntoh64(tmp); memcpy(&desttmp[i], &tmp, sizeof(tmp)); buffer->unpack_ptr += sizeof(tmp); } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; int32_t i, len, n=1; char **sdest = (char**) dest; for (i = 0; i < (*num_vals); ++i) { if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int32(buffer, &len, &n, PMIX_INT32))) { return ret; } if (0 == len) { /* zero-length string - unpack the NULL */ sdest[i] = NULL; } else { sdest[i] = (char*)malloc(len); if (NULL == sdest[i]) { return PMIX_ERR_OUT_OF_RESOURCE; } if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_byte(buffer, sdest[i], &len, PMIX_BYTE))) { return ret; } } } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; float *desttmp = (float*) dest, tmp; pmix_status_t ret; char *convert; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_float * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(float))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; } /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=1; convert = NULL; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &convert, &n, PMIX_STRING))) { return ret; } if (NULL != convert) { tmp = strtof(convert, NULL); memcpy(&desttmp[i], &tmp, sizeof(tmp)); free(convert); } } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; double *desttmp = (double*) dest, tmp; pmix_status_t ret; char *convert; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_double * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(double))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; } /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=1; convert = NULL; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &convert, &n, PMIX_STRING))) { return ret; } if (NULL != convert) { tmp = strtod(convert, NULL); memcpy(&desttmp[i], &tmp, sizeof(tmp)); free(convert); } } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; int64_t tmp[2]; struct timeval *desttmp = (struct timeval *) dest, tt; pmix_status_t ret; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_timeval * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(struct timeval))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; } /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=2; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int64(buffer, tmp, &n, PMIX_INT64))) { return ret; } tt.tv_sec = tmp[0]; tt.tv_usec = tmp[1]; memcpy(&desttmp[i], &tt, sizeof(tt)); } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; time_t *desttmp = (time_t *) dest, tmp; pmix_status_t ret; uint64_t ui64; /* time_t is a system-dependent size, so cast it * to uint64_t as a generic safe size */ pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack_time * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*(sizeof(uint64_t)))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; } /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int64(buffer, &ui64, &n, PMIX_UINT64))) { return ret; } tmp = (time_t)ui64; memcpy(&desttmp[i], &tmp, sizeof(tmp)); } return PMIX_SUCCESS; } /* UNPACK FUNCTIONS FOR GENERIC PMIX TYPES */ /* * PMIX_VALUE */ static pmix_status_t unpack_val(pmix_buffer_t *buffer, pmix_value_t *val) { int32_t m; pmix_status_t ret; m = 1; switch (val->type) { case PMIX_BOOL: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.flag, &m, PMIX_BOOL))) { return ret; } break; case PMIX_BYTE: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.byte, &m, PMIX_BYTE))) { return ret; } break; case PMIX_STRING: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.string, &m, PMIX_STRING))) { return ret; } break; case PMIX_SIZE: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.size, &m, PMIX_SIZE))) { return ret; } break; case PMIX_PID: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.pid, &m, PMIX_PID))) { return ret; } break; case PMIX_INT: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.integer, &m, PMIX_INT))) { return ret; } break; case PMIX_INT8: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int8, &m, PMIX_INT8))) { return ret; } break; case PMIX_INT16: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int16, &m, PMIX_INT16))) { return ret; } break; case PMIX_INT32: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int32, &m, PMIX_INT32))) { return ret; } break; case PMIX_INT64: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.int64, &m, PMIX_INT64))) { return ret; } break; case PMIX_UINT: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint, &m, PMIX_UINT))) { return ret; } break; case PMIX_UINT8: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint8, &m, PMIX_UINT8))) { return ret; } break; case PMIX_UINT16: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint16, &m, PMIX_UINT16))) { return ret; } break; case PMIX_UINT32: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint32, &m, PMIX_UINT32))) { return ret; } break; case PMIX_UINT64: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.uint64, &m, PMIX_UINT64))) { return ret; } break; case PMIX_FLOAT: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.fval, &m, PMIX_FLOAT))) { return ret; } break; case PMIX_DOUBLE: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.dval, &m, PMIX_DOUBLE))) { return ret; } break; case PMIX_TIMEVAL: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.tv, &m, PMIX_TIMEVAL))) { return ret; } break; case PMIX_INFO_ARRAY: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.array, &m, PMIX_INFO_ARRAY))) { return ret; } break; case PMIX_BYTE_OBJECT: if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.bo, &m, PMIX_BYTE_OBJECT))) { return ret; } break; default: pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE"); return PMIX_ERROR; } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_value_t *ptr; int32_t i, m, n; pmix_status_t ret; ptr = (pmix_value_t *) dest; n = *num_vals; for (i = 0; i < n; ++i) { /* unpack the type */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].type, &m, PMIX_INT))) { return ret; } /* unpack value */ if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i])) ) { return ret; } } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_info_t *ptr; int32_t i, n, m; pmix_status_t ret; char *tmp; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: %d info", *num_vals); ptr = (pmix_info_t *) dest; n = *num_vals; for (i = 0; i < n; ++i) { memset(ptr[i].key, 0, sizeof(ptr[i].key)); memset(&ptr[i].value, 0, sizeof(pmix_value_t)); /* unpack key */ m=1; tmp = NULL; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { return PMIX_ERROR; } (void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); free(tmp); /* unpack value - since the value structure is statically-defined * instead of a pointer in this struct, we directly unpack it to * avoid the malloc */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].value.type, &m, PMIX_INT))) { return ret; } pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: info type %d", ptr[i].value.type); m=1; if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i].value))) { return ret; } } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_pdata_t *ptr; int32_t i, n, m; pmix_status_t ret; char *tmp; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: %d pdata", *num_vals); ptr = (pmix_pdata_t *) dest; n = *num_vals; for (i = 0; i < n; ++i) { PMIX_PDATA_CONSTRUCT(&ptr[i]); /* unpack the proc */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_proc(buffer, &ptr[i].proc, &m, PMIX_PROC))) { return ret; } /* unpack key */ m=1; tmp = NULL; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { return PMIX_ERROR; } (void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); free(tmp); /* unpack value - since the value structure is statically-defined * instead of a pointer in this struct, we directly unpack it to * avoid the malloc */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].value.type, &m, PMIX_INT))) { return ret; } pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: pdata type %d", ptr[i].value.type); m=1; if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i].value))) { return ret; } } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_buffer_t **ptr; int32_t i, n, m; pmix_status_t ret; size_t nbytes; ptr = (pmix_buffer_t **) dest; n = *num_vals; for (i = 0; i < n; ++i) { /* allocate the new object */ ptr[i] = PMIX_NEW(pmix_buffer_t); if (NULL == ptr[i]) { return PMIX_ERR_OUT_OF_RESOURCE; } /* unpack the number of bytes */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_sizet(buffer, &nbytes, &m, PMIX_SIZE))) { return ret; } m = nbytes; /* setup the buffer's data region */ if (0 < nbytes) { ptr[i]->base_ptr = (char*)malloc(nbytes); /* unpack the bytes */ if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_byte(buffer, ptr[i]->base_ptr, &m, PMIX_BYTE))) { return ret; } } ptr[i]->pack_ptr = ptr[i]->base_ptr + m; ptr[i]->unpack_ptr = ptr[i]->base_ptr; ptr[i]->bytes_allocated = nbytes; ptr[i]->bytes_used = m; } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_proc_t *ptr; int32_t i, n, m; pmix_status_t ret; char *tmp; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: %d procs", *num_vals); ptr = (pmix_proc_t *) dest; n = *num_vals; for (i = 0; i < n; ++i) { pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: init proc[%d]", i); memset(&ptr[i], 0, sizeof(pmix_proc_t)); /* unpack nspace */ m=1; tmp = NULL; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { return PMIX_ERROR; } (void)strncpy(ptr[i].nspace, tmp, PMIX_MAX_NSLEN); free(tmp); /* unpack the rank */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].rank, &m, PMIX_INT))) { return ret; } } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_app_t *ptr; int32_t i, k, n, m; pmix_status_t ret; int32_t nval; char *tmp; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: %d apps", *num_vals); ptr = (pmix_app_t *) dest; n = *num_vals; for (i = 0; i < n; ++i) { /* initialize the fields */ PMIX_APP_CONSTRUCT(&ptr[i]); /* unpack cmd */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &ptr[i].cmd, &m, PMIX_STRING))) { return ret; } /* unpack argc */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].argc, &m, PMIX_INT))) { return ret; } /* unpack argv */ for (k=0; k < ptr[i].argc; k++) { m=1; tmp = NULL; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { return PMIX_ERROR; } pmix_argv_append_nosize(&ptr[i].argv, tmp); free(tmp); } /* unpack env */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int32(buffer, &nval, &m, PMIX_INT32))) { return ret; } for (k=0; k < nval; k++) { m=1; tmp = NULL; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { return PMIX_ERROR; } pmix_argv_append_nosize(&ptr[i].env, tmp); free(tmp); } /* unpack maxprocs */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].maxprocs, &m, PMIX_INT))) { return ret; } /* unpack info array */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_sizet(buffer, &ptr[i].ninfo, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].ninfo) { PMIX_INFO_CREATE(ptr[i].info, ptr[i].ninfo); m = ptr[i].ninfo; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_info(buffer, ptr[i].info, &m, PMIX_INFO))) { return ret; } } } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_kval_t *ptr; int32_t i, n, m; pmix_status_t ret; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: %d kvals", *num_vals); ptr = (pmix_kval_t*) dest; n = *num_vals; for (i = 0; i < n; ++i) { PMIX_CONSTRUCT(&ptr[i], pmix_kval_t); /* unpack the key */ m = 1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &ptr[i].key, &m, PMIX_STRING))) { PMIX_ERROR_LOG(ret); return ret; } /* allocate the space */ ptr[i].value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); /* unpack the value */ m = 1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_value(buffer, ptr[i].value, &m, PMIX_VALUE))) { PMIX_ERROR_LOG(ret); return ret; } } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_info_array_t *ptr; int32_t i, n, m; pmix_status_t ret; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: %d info arrays", *num_vals); ptr = (pmix_info_array_t*) dest; n = *num_vals; for (i = 0; i < n; ++i) { pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: init array[%d]", i); memset(&ptr[i], 0, sizeof(pmix_info_array_t)); /* unpack the size of this array */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t)); m=ptr[i].size; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_value(buffer, ptr[i].array, &m, PMIX_INFO))) { return ret; } } } return PMIX_SUCCESS; } #if PMIX_HAVE_HWLOC pmix_status_t pmix_bfrop_unpack_topo(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { /* NOTE: hwloc defines topology_t as a pointer to a struct! */ hwloc_topology_t t, *tarray = (hwloc_topology_t*)dest; pmix_status_t rc=PMIX_SUCCESS; int32_t cnt, i, j; char *xmlbuffer; struct hwloc_topology_support *support; for (i=0, j=0; i < *num_vals; i++) { /* unpack the xml string */ cnt=1; xmlbuffer = NULL; if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_string(buffer, &xmlbuffer, &cnt, PMIX_STRING))) { goto cleanup; } if (NULL == xmlbuffer) { goto cleanup; } /* convert the xml */ if (0 != hwloc_topology_init(&t)) { rc = PMIX_ERROR; goto cleanup; } if (0 != hwloc_topology_set_xmlbuffer(t, xmlbuffer, strlen(xmlbuffer))) { rc = PMIX_ERROR; free(xmlbuffer); hwloc_topology_destroy(t); goto cleanup; } /* since we are loading this from an external source, we have to * explicitly set a flag so hwloc sets things up correctly */ if (0 != hwloc_topology_set_flags(t, HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM | HWLOC_TOPOLOGY_FLAG_IO_DEVICES)) { free(xmlbuffer); rc = PMIX_ERROR; hwloc_topology_destroy(t); goto cleanup; } /* now load the topology */ if (0 != hwloc_topology_load(t)) { free(xmlbuffer); rc = PMIX_ERROR; hwloc_topology_destroy(t); goto cleanup; } if (NULL != xmlbuffer) { free(xmlbuffer); } /* get the available support - hwloc unfortunately does * not include this info in its xml import! */ support = (struct hwloc_topology_support*)hwloc_topology_get_support(t); cnt = sizeof(struct hwloc_topology_discovery_support); if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_byte(buffer, support->discovery, &cnt, PMIX_BYTE))) { goto cleanup; } cnt = sizeof(struct hwloc_topology_cpubind_support); if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_byte(buffer, support->cpubind, &cnt, PMIX_BYTE))) { goto cleanup; } cnt = sizeof(struct hwloc_topology_membind_support); if (PMIX_SUCCESS != (rc = pmix_bfrop_unpack_byte(buffer, support->membind, &cnt, PMIX_BYTE))) { goto cleanup; } /* pass it back */ tarray[i] = t; /* track the number added */ j++; } cleanup: *num_vals = j; return rc; } #endif pmix_status_t pmix_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_modex_data_t *ptr; int32_t i, n, m; pmix_status_t ret; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: %d modex", *num_vals); ptr = (pmix_modex_data_t *) dest; n = *num_vals; for (i = 0; i < n; ++i) { memset(&ptr[i], 0, sizeof(pmix_modex_data_t)); /* unpack the number of bytes */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].blob = (uint8_t*)malloc(ptr[i].size * sizeof(uint8_t)); m=ptr[i].size; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_byte(buffer, ptr[i].blob, &m, PMIX_UINT8))) { return ret; } } } return PMIX_SUCCESS; } pmix_status_t pmix_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { return pmix_bfrop_unpack_int(buffer, dest, num_vals, PMIX_INT); } pmix_status_t pmix_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_byte_object_t *ptr; int32_t i, n, m; pmix_status_t ret; pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_unpack: %d byte_object", *num_vals); ptr = (pmix_byte_object_t *) dest; n = *num_vals; for (i = 0; i < n; ++i) { memset(&ptr[i], 0, sizeof(pmix_byte_object_t)); /* unpack the number of bytes */ m=1; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].bytes = (char*)malloc(ptr[i].size * sizeof(char)); m=ptr[i].size; if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_byte(buffer, ptr[i].bytes, &m, PMIX_BYTE))) { return ret; } } } return PMIX_SUCCESS; }
ClaudioNahmad/Servicio-Social
Parametros/CosmoMC/prerrequisitos/openmpi-2.0.2/opal/mca/pmix/pmix112/pmix/src/buffer_ops/unpack.c
C
gpl-3.0
36,413
/* * Copyright (C) 2007 Kamil Dudka <rrv@dudka.cz> * Copyright (C) 2015 Claude Heiland-Allen <claude@mathr.co.uk> * * This file is part of rrv (Radiosity Renderer and Visualizer). * * rrv is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * rrv 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 rrv. If not, see <http://www.gnu.org/licenses/>. */ #include "PatchCache.h" #include "PatchRandomAccessEnumerator.h" #include "FormFactorEngine.h" PatchCache::PatchCache( PatchRandomAccessEnumerator *patchEnumerator, float ffTreshold, size_t maxCacheSize, const FormFactorHemicube &hemicube, int pipeline ): patchEnumerator_(patchEnumerator), ffTreshold_(ffTreshold), maxCacheSize_(maxCacheSize), hemicube_(hemicube), pipeline_(pipeline), cachedSize_(0) { patchCount_ = patchEnumerator->count(); // FIXME: Does this constructor zero vector's items? cache_ = new TCache(patchCount_, 0); // Create patch cache (priority) queue cacheQueue_ = new TQueue; ffe_ = new FormFactorEngine(patchEnumerator, hemicube_); } PatchCache::~PatchCache() { delete ffe_; delete cacheQueue_; // Destroy patch cache TCache::iterator i; for(i= cache_->begin(); i!= cache_->end(); i++) delete *i; delete cache_; } size_t PatchCache::cacheRawSize() const { return cachedSize_; } bool PatchCache::full() const { return cacheQueue_->size() == patchCount_; } Color PatchCache::totalRadiosity(int destPatch, const DenseVector<Color> &sceneRadiosity, bool sequential, bool noGL) { // master branche PatchCacheLine *&cacheLine = cache_->operator[](destPatch); if (0==cacheLine) { (void) noGL; // silence warning with debug builds assert(! noGL); // pre-fill GPU form-factor calculation pipeline if (sequential) { if (destPatch == 0) for(int nextPatch = 0; nextPatch <= pipeline_ && nextPatch < int(patchCount_); ++nextPatch) ffe_->prepare(nextPatch); else if (destPatch + pipeline_ < int(patchCount_)) ffe_->prepare(destPatch + pipeline_); } else ffe_->prepare(destPatch); // Cache-line was not in cache --> create and fill cacheLine = new PatchCacheLine(patchEnumerator_, ffTreshold_); ffe_->fillCacheLine(destPatch, cacheLine); // Update metadata cachedSize_ += cacheLine->size() + sizeof(cacheLine); cacheQueue_->push(&cacheLine); } // Use cache-line to cumpute total radiosity Color rad = cacheLine->totalRadiosity(sceneRadiosity); // master branche if (maxCacheSize_ > 0 && this->cacheRawSize() >= size_t(maxCacheSize_)) { // maxCacheSize exceed --> free the largest cache-line const TQueueItem &qi = cacheQueue_->top(); PatchCacheLine *&topCL = qi.pCacheLine(); cachedSize_ -= topCL->size() + sizeof(*topCL); delete topCL; topCL = 0; cacheQueue_->pop(); } return rad; }
kdudka/rrv
src/PatchCache.cpp
C++
gpl-3.0
3,546
/* * WARNING: do not edit! * Generated by Makefile from include/openssl/opensslconf.h.in * * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifdef __cplusplus extern "C" { #endif #ifdef OPENSSL_ALGORITHM_DEFINES # error OPENSSL_ALGORITHM_DEFINES no longer supported #endif /* * OpenSSL was configured with the following options: */ #ifndef OPENSSL_NO_CHACHA # define OPENSSL_NO_CHACHA #endif #ifndef OPENSSL_NO_COMP # define OPENSSL_NO_COMP #endif #ifndef OPENSSL_NO_IDEA # define OPENSSL_NO_IDEA #endif #ifndef OPENSSL_NO_MD2 # define OPENSSL_NO_MD2 #endif #ifndef OPENSSL_NO_RC5 # define OPENSSL_NO_RC5 #endif #ifndef OPENSSL_NO_SRP # define OPENSSL_NO_SRP #endif #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif #ifndef OPENSSL_NO_AFALGENG # define OPENSSL_NO_AFALGENG #endif #ifndef OPENSSL_NO_APPS # define OPENSSL_NO_APPS #endif #ifndef OPENSSL_NO_ASAN # define OPENSSL_NO_ASAN #endif #ifndef OPENSSL_NO_ASM # define OPENSSL_NO_ASM #endif #ifndef OPENSSL_NO_CAPIENG # define OPENSSL_NO_CAPIENG #endif #ifndef OPENSSL_NO_CRYPTO_MDEBUG # define OPENSSL_NO_CRYPTO_MDEBUG #endif #ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE # define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE #endif #ifndef OPENSSL_NO_DTLS # define OPENSSL_NO_DTLS #endif #ifndef OPENSSL_NO_DTLS1 # define OPENSSL_NO_DTLS1 #endif #ifndef OPENSSL_NO_DTLS1_2 # define OPENSSL_NO_DTLS1_2 #endif #ifndef OPENSSL_NO_EC2M # define OPENSSL_NO_EC2M #endif #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 # define OPENSSL_NO_EC_NISTP_64_GCC_128 #endif #ifndef OPENSSL_NO_EGD # define OPENSSL_NO_EGD #endif #ifndef OPENSSL_NO_ENGINE # define OPENSSL_NO_ENGINE #endif #ifndef OPENSSL_NO_FUZZ_AFL # define OPENSSL_NO_FUZZ_AFL #endif #ifndef OPENSSL_NO_FUZZ_LIBFUZZER # define OPENSSL_NO_FUZZ_LIBFUZZER #endif #ifndef OPENSSL_NO_HEARTBEATS # define OPENSSL_NO_HEARTBEATS #endif #ifndef OPENSSL_NO_HW # define OPENSSL_NO_HW #endif #ifndef OPENSSL_NO_MSAN # define OPENSSL_NO_MSAN #endif #ifndef OPENSSL_NO_PSK # define OPENSSL_NO_PSK #endif #ifndef OPENSSL_NO_SCTP # define OPENSSL_NO_SCTP #endif #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif #ifndef OPENSSL_NO_SSL3 # define OPENSSL_NO_SSL3 #endif #ifndef OPENSSL_NO_SSL3_METHOD # define OPENSSL_NO_SSL3_METHOD #endif #ifndef OPENSSL_NO_STDIO # define OPENSSL_NO_STDIO #endif #ifndef OPENSSL_NO_TESTS # define OPENSSL_NO_TESTS #endif #ifndef OPENSSL_NO_UBSAN # define OPENSSL_NO_UBSAN #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif #ifndef OPENSSL_NO_WEAK_SSL_CIPHERS # define OPENSSL_NO_WEAK_SSL_CIPHERS #endif #ifndef OPENSSL_NO_AFALGENG # define OPENSSL_NO_AFALGENG #endif /* * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers * don't like that. This will hopefully silence them. */ #define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; /* * Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the * declarations of functions deprecated in or before <version>. Otherwise, they * still won't see them if the library has been built to disable deprecated * functions. */ #if defined(OPENSSL_NO_DEPRECATED) # define DECLARE_DEPRECATED(f) #elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) # define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); #else # define DECLARE_DEPRECATED(f) f; #endif #ifndef OPENSSL_FILE # ifdef OPENSSL_NO_FILENAMES # define OPENSSL_FILE "" # define OPENSSL_LINE 0 # else # define OPENSSL_FILE __FILE__ # define OPENSSL_LINE __LINE__ # endif #endif #ifndef OPENSSL_MIN_API # define OPENSSL_MIN_API 0 #endif #if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API # undef OPENSSL_API_COMPAT # define OPENSSL_API_COMPAT OPENSSL_MIN_API #endif #if OPENSSL_API_COMPAT < 0x10100000L # define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) #else # define DEPRECATEDIN_1_1_0(f) #endif #if OPENSSL_API_COMPAT < 0x10000000L # define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) #else # define DEPRECATEDIN_1_0_0(f) #endif #if OPENSSL_API_COMPAT < 0x00908000L # define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) #else # define DEPRECATEDIN_0_9_8(f) #endif /* Generate 80386 code? */ #undef I386_ONLY #undef OPENSSL_UNISTD #define OPENSSL_UNISTD <unistd.h> #undef OPENSSL_EXPORT_VAR_AS_FUNCTION /* * The following are cipher-specific, but are part of the public API. */ #if !defined(OPENSSL_SYS_UEFI) # undef BN_LLONG /* Only one for the following should be defined */ # define SIXTY_FOUR_BIT_LONG # undef SIXTY_FOUR_BIT # undef THIRTY_TWO_BIT #endif #define RC4_INT unsigned char #ifdef __cplusplus } #endif
Jappsy/jappsy
src/libs/openssl/android/arm64-v8a/include/openssl/opensslconf.h
C
gpl-3.0
4,876
package com.oryx.core.dashboard.view.dashboard; import com.google.common.eventbus.Subscribe; import com.oryx.core.dashboard.DashboardUI; import com.oryx.core.dashboard.component.TopTenMoviesTable; import com.oryx.core.dashboard.domain.DashboardNotification; import com.oryx.core.dashboard.event.DashboardEvent.CloseOpenWindowsEvent; import com.oryx.core.dashboard.event.DashboardEvent.NotificationsCountUpdatedEvent; import com.oryx.core.dashboard.event.DashboardEventBus; import com.oryx.core.dashboard.view.dashboard.DashboardEdit.DashboardEditListener; import com.vaadin.event.LayoutEvents.LayoutClickEvent; import com.vaadin.event.LayoutEvents.LayoutClickListener; import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; import com.vaadin.server.FontAwesome; import com.vaadin.server.Responsive; import com.vaadin.ui.*; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.MenuBar.Command; import com.vaadin.ui.MenuBar.MenuItem; import com.vaadin.ui.themes.ValoTheme; import java.util.Collection; import java.util.Iterator; @SuppressWarnings("serial") public final class DashboardView extends Panel implements View, DashboardEditListener { public static final String EDIT_ID = "dashboard-edit"; public static final String TITLE_ID = "dashboard-title"; private final VerticalLayout root; private Label titleLabel; private NotificationsButton notificationsButton; private CssLayout dashboardPanels; private Window notificationsWindow; public DashboardView() { addStyleName(ValoTheme.PANEL_BORDERLESS); setSizeFull(); DashboardEventBus.register(this); root = new VerticalLayout(); root.setSizeFull(); root.setMargin(true); root.addStyleName("dashboard-view"); setContent(root); Responsive.makeResponsive(root); root.addComponent(buildHeader()); root.addComponent(buildSparklines()); Component content = buildContent(); root.addComponent(content); root.setExpandRatio(content, 1); // All the open component-windows should be closed whenever the root ui // gets clicked. root.addLayoutClickListener(new LayoutClickListener() { @Override public void layoutClick(final LayoutClickEvent event) { DashboardEventBus.post(new CloseOpenWindowsEvent()); } }); } private Component buildSparklines() { CssLayout sparks = new CssLayout(); sparks.addStyleName("sparks"); sparks.setWidth("100%"); Responsive.makeResponsive(sparks); return sparks; } private Component buildHeader() { HorizontalLayout header = new HorizontalLayout(); header.addStyleName("viewheader"); header.setSpacing(true); titleLabel = new Label("Dashboard"); titleLabel.setId(TITLE_ID); titleLabel.setSizeUndefined(); titleLabel.addStyleName(ValoTheme.LABEL_H1); titleLabel.addStyleName(ValoTheme.LABEL_NO_MARGIN); header.addComponent(titleLabel); notificationsButton = buildNotificationsButton(); Component edit = buildEditButton(); HorizontalLayout tools = new HorizontalLayout(notificationsButton, edit); tools.setSpacing(true); tools.addStyleName("toolbar"); header.addComponent(tools); return header; } private NotificationsButton buildNotificationsButton() { NotificationsButton result = new NotificationsButton(); result.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { openNotificationsPopup(event); } }); return result; } private Component buildEditButton() { Button result = new Button(); result.setId(EDIT_ID); result.setIcon(FontAwesome.EDIT); result.addStyleName("icon-edit"); result.addStyleName(ValoTheme.BUTTON_ICON_ONLY); result.setDescription("Edit Dashboard"); result.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { getUI().addWindow( new DashboardEdit(DashboardView.this, titleLabel .getValue())); } }); return result; } private Component buildContent() { dashboardPanels = new CssLayout(); dashboardPanels.addStyleName("dashboard-panels"); Responsive.makeResponsive(dashboardPanels); dashboardPanels.addComponent(buildNotes()); dashboardPanels.addComponent(buildTop10TitlesByRevenue()); return dashboardPanels; } private Component buildNotes() { TextArea notes = new TextArea("Notes"); notes.setValue("Remember to:\n· Zoom in and out in the Sales view\n· Filter the transactions and drag a set of them to the Reports tab\n· Create a new report\n· Change the schedule of the movie theater"); notes.setSizeFull(); notes.addStyleName(ValoTheme.TEXTAREA_BORDERLESS); Component panel = createContentWrapper(notes); panel.addStyleName("notes"); return panel; } private Component buildTop10TitlesByRevenue() { Component contentWrapper = createContentWrapper(new TopTenMoviesTable()); contentWrapper.addStyleName("top10-revenue"); return contentWrapper; } private Component createContentWrapper(final Component content) { final CssLayout slot = new CssLayout(); slot.setWidth("100%"); slot.addStyleName("dashboard-panel-slot"); CssLayout card = new CssLayout(); card.setWidth("100%"); card.addStyleName(ValoTheme.LAYOUT_CARD); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addStyleName("dashboard-panel-toolbar"); toolbar.setWidth("100%"); Label caption = new Label(content.getCaption()); caption.addStyleName(ValoTheme.LABEL_H4); caption.addStyleName(ValoTheme.LABEL_COLORED); caption.addStyleName(ValoTheme.LABEL_NO_MARGIN); content.setCaption(null); MenuBar tools = new MenuBar(); tools.addStyleName(ValoTheme.MENUBAR_BORDERLESS); MenuItem max = tools.addItem("", FontAwesome.EXPAND, new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (!slot.getStyleName().contains("max")) { selectedItem.setIcon(FontAwesome.COMPRESS); toggleMaximized(slot, true); } else { slot.removeStyleName("max"); selectedItem.setIcon(FontAwesome.EXPAND); toggleMaximized(slot, false); } } }); max.setStyleName("icon-only"); MenuItem root = tools.addItem("", FontAwesome.COG, null); root.addItem("Configure", new Command() { @Override public void menuSelected(final MenuItem selectedItem) { Notification.show("Not implemented in this demo"); } }); root.addSeparator(); root.addItem("Close", new Command() { @Override public void menuSelected(final MenuItem selectedItem) { Notification.show("Not implemented in this demo"); } }); toolbar.addComponents(caption, tools); toolbar.setExpandRatio(caption, 1); toolbar.setComponentAlignment(caption, Alignment.MIDDLE_LEFT); card.addComponents(toolbar, content); slot.addComponent(card); return slot; } private void openNotificationsPopup(final ClickEvent event) { VerticalLayout notificationsLayout = new VerticalLayout(); notificationsLayout.setMargin(true); notificationsLayout.setSpacing(true); Label title = new Label("Notifications"); title.addStyleName(ValoTheme.LABEL_H3); title.addStyleName(ValoTheme.LABEL_NO_MARGIN); notificationsLayout.addComponent(title); Collection<DashboardNotification> notifications = DashboardUI .getDataProvider().getNotifications(); DashboardEventBus.post(new NotificationsCountUpdatedEvent()); for (DashboardNotification notification : notifications) { VerticalLayout notificationLayout = new VerticalLayout(); notificationLayout.addStyleName("notification-item"); Label titleLabel = new Label(notification.getFirstName() + " " + notification.getLastName() + " " + notification.getAction()); titleLabel.addStyleName("notification-title"); Label timeLabel = new Label(notification.getPrettyTime()); timeLabel.addStyleName("notification-time"); Label contentLabel = new Label(notification.getContent()); contentLabel.addStyleName("notification-content"); notificationLayout.addComponents(titleLabel, timeLabel, contentLabel); notificationsLayout.addComponent(notificationLayout); } HorizontalLayout footer = new HorizontalLayout(); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth("100%"); Button showAll = new Button("View All Notifications", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { Notification.show("Not implemented in this demo"); } }); showAll.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); showAll.addStyleName(ValoTheme.BUTTON_SMALL); footer.addComponent(showAll); footer.setComponentAlignment(showAll, Alignment.TOP_CENTER); notificationsLayout.addComponent(footer); if (notificationsWindow == null) { notificationsWindow = new Window(); notificationsWindow.setWidth(300.0f, Unit.PIXELS); notificationsWindow.addStyleName("notifications"); notificationsWindow.setClosable(false); notificationsWindow.setResizable(false); notificationsWindow.setDraggable(false); notificationsWindow.setCloseShortcut(KeyCode.ESCAPE, null); notificationsWindow.setContent(notificationsLayout); } if (!notificationsWindow.isAttached()) { notificationsWindow.setPositionY(event.getClientY() - event.getRelativeY() + 40); getUI().addWindow(notificationsWindow); notificationsWindow.focus(); } else { notificationsWindow.close(); } } @Override public void enter(final ViewChangeEvent event) { notificationsButton.updateNotificationsCount(null); } @Override public void dashboardNameEdited(final String name) { titleLabel.setValue(name); } private void toggleMaximized(final Component panel, final boolean maximized) { for (Iterator<Component> it = root.iterator(); it.hasNext(); ) { it.next().setVisible(!maximized); } dashboardPanels.setVisible(true); for (Iterator<Component> it = dashboardPanels.iterator(); it.hasNext(); ) { Component c = it.next(); c.setVisible(!maximized); } if (maximized) { panel.setVisible(true); panel.addStyleName("max"); } else { panel.removeStyleName("max"); } } public static final class NotificationsButton extends Button { public static final String ID = "dashboard-notifications"; private static final String STYLE_UNREAD = "unread"; public NotificationsButton() { setIcon(FontAwesome.BELL); setId(ID); addStyleName("notifications"); addStyleName(ValoTheme.BUTTON_ICON_ONLY); DashboardEventBus.register(this); } @Subscribe public void updateNotificationsCount( final NotificationsCountUpdatedEvent event) { setUnreadCount(DashboardUI.getDataProvider() .getUnreadNotificationsCount()); } public void setUnreadCount(final int count) { setCaption(String.valueOf(count)); String description = "Notifications"; if (count > 0) { addStyleName(STYLE_UNREAD); description += " (" + count + " unread)"; } else { removeStyleName(STYLE_UNREAD); } setDescription(description); } } }
241180/Oryx
oryx-dashboard/src/main/java/com/oryx/core/dashboard/view/dashboard/DashboardView.java
Java
gpl-3.0
13,003
webpackJsonp([2],{581:function(e,t,n){"use strict";function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;switch(arguments[1].type){case u.a:return e+1;case u.b:return e-1;default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var u=n(584);t.default=r,r.reducer="page2"},584:function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"b",function(){return u}),t.c=function(){return{type:r}},t.d=function(){return{type:u}};var r="PAGE2_INCREMENT",u="PAGE2_DECREMENT"}});
luigiplr/react-router-redux-rxjs-code-splitting
docs/2-a4127f472c009ba9ea8b.chunk.js
JavaScript
gpl-3.0
510
{% extends 'main.html' %} {% block body %} <h1 class="center">管理:#{{problem[0]}}. {{problem[2]}} 数据信息</h1> <br> <div class="row"> <div class="col-md-9"> <div class="progress"> <div class="progress-bar progress-bar-success" style="width: {{(tongji[1]+1)/(tongji[0]+1)*100}}%"></div> <div class="progress-bar progress-bar-danger" style="width: {{tongji[2]/(tongji[0]+1)*100}}%"></div> <div class="progress-bar progress-bar-warning" style="width: {{tongji[3]/(tongji[0]+1)*100}}%"></div> <div class="progress-bar progress-bar-info" style="width: {{tongji[4]/(tongji[0]+1)*100}}%"></div> <div class="progress-bar progress-bar-progress-bar-striped" style="width: {{tongji[5]/(tongji[0]+1)*100}}%"></div> </div> </div> <div class="col-md-3"> <div class="btn-group"> <button class="btn btn-info" onclick="window.location.href='/problem/{{problem[0]}}'">查看题目页面</button> <button data-toggle="dropdown" class="btn btn-info dropdown-toggle"><span class="caret"></span></button> <ul class="dropdown-menu" > <li> <a href="/problem/{{problem[0]}}/status">统计</a> </li> <li> <a href="#post">讨论</a> </li> <li> <a href="#msg">报错</a> </li> <li class="divider"> </li> <li > <a href="/problem/{{problem[0]}}/edit/0">管理题目基本信息</a> </li> <li > <a href="/problem/{{problem[0]}}/edit/1">管理题面描述信息</a> </li> <li > <a href="/problem/{{problem[0]}}/edit/2">管理题目评测信息</a> </li> <li class="active"> <a href="/problem/{{problem[0]}}/edit/3">管理题目数据信息</a> </li> </ul> </div> </div> </div> <div class="row"> <div class="col-md-4"> <table class="table table-bordered"> <tbody> <tr><td>总提交</td> <td><a href="/status?problem={{problem[0]}}">{{tongji[0]}}</a></td></tr> <tr><td>通过</td> <td>{{tongji[1]}}</td></tr> <tr><td>答案错误</td> <td>{{tongji[2]}}</td></tr> <tr><td>超时</td> <td>{{tongji[3]}}</td></tr> <tr><td>超内存</td> <td>{{tongji[4]}}</td></tr> <tr><td>运行错误</td> <td>{{tongji[5]}}</td></tr> <tr><td>编译错误</td> <td>{{tongji[6]}}</td></tr> <tr><td>其他</td> <td>{{tongji[0]-sum(tongji[1:])}}</td></tr> </tbody> </table> </div> <div class="col-md-8"> <div class="panel panel-info"> <div class="panel-heading"> <h3 class="panel-title">最近的十次提交 &nbsp;&nbsp;<button class="btn btn-link btn-xs" type="button" onclick="window.location.href='/status?problem={{problem[0]}}'">更多</button></h3> </div> <div class="panel-body"> <table class="table table-striped"> <thead> <tr> <th>#</th> <th>提交者</th> <th>状态</th> <th>总用时</th> <th>内存</th> <th>代码长度</th> </tr> </thead> <tbody> {% for row in status %} <tr> <td>{{row[0]}}</td> <td><a href="/user/{{row[1]}}">{{row[1]}}</a></td> <td> <a href="/status/{{row[0]}}"> {% if row[2] == 0 or row[2] == None %} <span class="label label-default">非法状态</span> {% end %} {% if row[2] == 1 %} <span class="label label-info">等待评测</span> {% end %} {% if row[2] == 2 %} <span class="label label-primary">评测中</span> {% end %} {% if row[2] == 3 %} <span class="label label-success">通过</span> {% end %} {% if row[2] == 4 %} <span class="label label-danger">答案错误</span> {% end %} {% if row[2] == 5 %} <span class="label label-warning">超时</span> {% end %} {% if row[2] == 6 %} <span class="label label-danger">运行错误</span> {% end %} {% if row[2] == 7 %} <span class="label label-warning">超内存</span> {% end %} {% if row[2] == 8 %} <span class="label label-danger">编译错误</span> {% end %} {% if row[2] == 9 %} <span class="label label-danger">系统错误</span> {% end %} </a> </td> <td>{{row[3]}}</td> <td>{{row[4]}}</td> <td>{{row[5]}}</td> </tr> {% end %} </tbody> </table> </div> </div> </div> </div> <form class="form-horizontal" action="{{submit_url}}" enctype="multipart/form-data" > {% raw xsrf_form_html()%} <fieldset> <input type="hidden" name="prob_id" value="{{problem[0]}}"> <input type="hidden" name="user" value="{{current_user}}"> <input type="hidden" name="tim" value="{{tim}}"> <input type="hidden" name="key" value="{{key}}"> <legend>评测信息</legend> <span class="help-block">请看数据添加帮助</span> <div class="form-group"> <label for="inputFile" class="col-lg-2 control-label">上传数据</label> <div class="col-lg-10"> <span class="help-block">请上传zip压缩文件,里面<strong>直接</strong>为*.in和*.out。<strong>没有</strong>子文件夹。</span> <span class="help-block">若数据太大可以分批上传,单次大小限制约90MB</span> <span class="help-block">不要包含任何中文内容</span> <input class="form-control" type="file" name="zip" id="inputFile"> </div> </div> <div class="form-group"> <label class="col-lg-2 control-label">是否覆盖之前数据</label> <div class="col-lg-10"> <span class="help-block">若选中下面方块则为覆盖,会删除之前数据;不选中这次添加的数据会和之前数据合并。</span> <input class="form-control" type="checkbox" name="cover" id="inputFile" value="1"> </div> </div> <div class="form-group"> <label class="col-lg-2 control-label">数据预览</label> <div class="col-lg-10"> <span class="help-block">数据下载后可能没有后缀名,请手动添加或直接用文本编辑器打开。</span> <span class="help-block">刚上传的文件可能需要刷新才能显示。</span> <textarea class="form-control" rows="6" id="inputData" >{{problem[3]}}</textarea> </div> </div> <div class="form-group"> <div class="col-lg-10 col-lg-offset-2"> <button type="reset" class="btn btn-default">重置</button> <button type="submit" formmethod="post" class="btn btn-primary">提交</button> </div> </div> </fieldset> </form> {% end %}
zrt/XOJ
web/templates/edit_problem_3.html
HTML
gpl-3.0
9,587
/** * @author Dennis W. Gichangi <dennis.dichangi@dewcis.com> * @version 2011.03.29 * @since 1.6 * website www.dewcis.com * The contents of this file are subject to the Dew CIS Solutions License * The file should only be shared to OpenBravo. */ package org.baraza.com; import java.util.logging.Logger; import java.net.URL; import java.net.MalformedURLException; import java.io.InputStream; import java.io.IOException; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperPrintManager; import net.sf.jasperreports.engine.JasperPrint; import java.sql.Connection; import java.util.Map; import java.util.HashMap; import java.awt.BorderLayout; import java.awt.Toolkit; import java.awt.EventQueue; import javax.swing.JFrame; import org.baraza.xml.BXML; import org.baraza.xml.BElement; import org.baraza.DB.BDB; import org.baraza.reports.BReportViewer; public class BScreenReports extends Thread { Logger log = Logger.getLogger(BScreenReports.class.getName()); BReportViewer rp; JasperPrint rd; int lastPage = 0; int currentPage = 0; int currentCycle = 0; int pageDelay = 1000; int pageRefresh = 10; String keyData = null; public boolean isCreated = false; public static void main(String args[]) { if(args.length == 1) { BScreenReports sr = new BScreenReports(args[0]); sr.start(); Toolkit tk = Toolkit.getDefaultToolkit(); JFrame frame = new JFrame("Baraza Report Screen"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); if(sr.isCreated) frame.getContentPane().add(sr.getReportPanel(), BorderLayout.CENTER); frame.setBounds(0, 0, tk.getScreenSize().width + 10, tk.getScreenSize().height + 10); frame.setVisible(true); } else { System.out.println("USAGE : java -cp baraza.jar org.baraza.com.BScreenReports screenreports.xml"); } } public void run() { boolean isRunning = true; while(isRunning) { try { Thread.sleep(pageDelay); } catch (InterruptedException e) { System.out.println("I wasn't done"); } turnPage(); } } public BScreenReports(String xmlFile) { BXML xml = new BXML(xmlFile, false); BElement root = xml.getRoot(); BDB db = new BDB(root); Connection conn = db.getDB(); String jasperfile = root.getAttribute("reportpath") + root.getAttribute("report"); if(root.getAttribute("pagedelay") != null) pageDelay = Integer.parseInt(root.getAttribute("pagedelay")); if(root.getAttribute("pagerefresh") != null) pageRefresh = Integer.parseInt(root.getAttribute("pagerefresh")); if(root.getAttribute("keydata") != null) keyData = root.getAttribute("keydata"); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("reportpath", root.getAttribute("reportpath")); parameters.put("SUBREPORT_DIR", root.getAttribute("reportpath")); String auditTable = null; try { // Reab from http and from file if(jasperfile.startsWith("http")) { URL url = new URL(jasperfile); InputStream in = url.openStream(); rd = JasperFillManager.fillReport(in, parameters, conn); if(rd.getPages() != null) lastPage = rd.getPages().size(); } else { rd = JasperFillManager.fillReport(jasperfile, parameters, db.getDB()); if(rd.getPages() != null) lastPage = rd.getPages().size(); } rp = new BReportViewer(rd, db, auditTable, keyData); isCreated = true; } catch (JRException ex) { log.severe("Jasper Compile error : " + ex); } catch (MalformedURLException ex) { log.severe("HTML Error : " + ex); } catch (IOException ex) { log.severe("IO Error : " + ex); } } public BReportViewer getReportPanel() { return rp; } public void turnPage() { if(currentPage < lastPage) { currentPage++; } else { currentPage = 0; currentCycle++; } if(pageRefresh == currentCycle) { currentCycle = 0; rp.loadReport(rd, keyData); } rp.setPageIndex(currentPage); rp.refreshPage(); } }
enbiso/openbaraza
src/org/baraza/com/BScreenReports.java
Java
gpl-3.0
4,024
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; namespace MarshalDll { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : Application { } }
p21816/Dasha
IT Step/System Programming/MarshalDll/MarshalDll/App.xaml.cs
C#
gpl-3.0
326
INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('1', 'crp_multiple_coa', '1', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('3', 'crp_multiple_coa', '0', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('4', 'crp_multiple_coa', '1', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('5', 'crp_multiple_coa', '1', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('7', 'crp_multiple_coa', '1', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('21', 'crp_multiple_coa', '1', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('22', 'crp_multiple_coa', '1', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('1', 'crp_email_funding_source', '1', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('3', 'crp_email_funding_source', '0', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('4', 'crp_email_funding_source', '1', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('5', 'crp_email_funding_source', '1', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('7', 'crp_email_funding_source', '1', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('21', 'crp_email_funding_source', '1', '1', '3', '3', ''); INSERT INTO `crp_parameters` (`crp_id`, `key`, `value`, `is_active`, `created_by`, `modified_by`, `modification_justification`) VALUES ('22', 'crp_email_funding_source', '1', '1', '3', '3', '');
CCAFS/MARLO
marlo-web/src/main/resources/database/migrations/V2_0_0_20170321_1300__CoaUniqueParameter.sql
SQL
gpl-3.0
2,678
#!/usr/bin/env python # -*- coding: utf-8 -*- # # encryption-generator.py # # Copyright 2016 Netuser <zorgonteam@gmail.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 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, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. # encryption-generator.py Version 2.0 # site http://zorgonteam.wordpress.com import os import sys import time import base64 import urllib import hashlib import subprocess from datetime import date from datetime import datetime from Crypto.Cipher import DES from Crypto import Random date=date.today() now=datetime.now() if os.name in ['nt','win32']: os.system('cls') else: os.system('clear') print "[*] Author Netuser [*]" print "[*] encryption generator [*]" print "[*] date :",date," [*]" print print "[*] Encrypt With Strong Crypto is Coming soon" back = 'back' #while back == 'back': while True: try: menu=raw_input('\n[*] encrypt or decrypt $ ') menu_item="update" if menu_item == menu: print "[*] Updating Databases Information .... " url=urllib.urlretrieve("https://raw.githubusercontent.com/P1d0f/encryptGen/master/encryption-generator.py","encryption-generator.py") print "[*] Update Succesfully" sys.exit() menu_item="help" if menu == menu_item: print """ you just type encrypt or decrypt example : encrypt = encrypt or decrypt $ encrypt (enter) decrypt = encrypt or decrypt $ decrypt (enter) """ menu_item="encrypt" if menu == menu_item: print print "----> md5" print "----> sha1" print "----> sha224" print "----> sha256" print "----> sha384" print "----> sha512" print "----> base16" print "----> base32" print "----> base64" print "----> cryptoDES" print raw=raw_input('[*] type and choice one $ ') menu_item="exit" if raw == menu_item: print "[*] thanks for shopping" sys.exit() menu_item="cryptoDES" if menu_item == raw: telo=raw_input('[*] your text $ ') iv=Random.get_random_bytes(8) des1=DES.new('01234567', DES.MODE_CFB, iv) des2=DES.new('01234567', DES.MODE_CFB, iv) text=telo cipher_text=des2.encrypt(text) nama_file=open('text.encrypt','w') nama_file.writelines(cipher_text) nama_file.close() time.sleep(2) for i in(5,4,3,2,1): print "[*] encrypted at",now print "\n[*] saved into text.encrypt" menu_item="base16" if menu_item == raw: telo=raw_input('[*] text $ ') base16=base64.b16encode('%s' % (telo)) for i in(5,4,3,2,1): print "[*] encoded at",now print "\n[*] result :",base16 menu_item="sha224" if menu_item == raw: telo=raw_input('[*] text $ ') sha224=hashlib.sha224('%s' % (telo)).hexdigest() for i in(5,4,3,2,1): print "[*] encrypted at",now print "\n[*] result :",sha224 menu_item="sha384" if menu_item == raw: telo=raw_input('[*] text $ ') sha384=hashlib.sha384('%s' % (telo)).hexdigest() for i in(5,4,3,2,1): print "[*] encrypted at",now print "\n[*] result :",sha384 menu_item="sha512" if menu_item == raw: telo=raw_input('[*] text $ ') sha512=hashlib.sha512('%s' % (telo)).hexdigest() for i in(5,4,3,2,1): print "[*] encrypted at",now print "\n[*] result :",sha512 menu_item="base64" if menu_item == raw: telo=raw_input('[*] text $ ') base64=base64.b64encode('%s' % (telo)) for i in(5,4,3,2,1): print "[*] encoded at",now print "\n[*] result :",base64 menu_item="md5" if menu_item == raw: telo=raw_input('[*] text $ ') md5=hashlib.md5('%s' % (telo)).hexdigest() for i in(1,2,3,4,5): print "[*] encrypted at",now print "\n[*] result :",md5 menu_item="sha256" if menu_item == raw: telo=raw_input('[*] text $ ') sha256=hashlib.sha256('%s' % (telo)).hexdigest() print for i in(1,2,3,4,5): print "[*] encrypted at",now print "\n[*] result :",sha256 menu_item="sha1" if menu_item == raw: telo=raw_input('[*] text $ ') sha1=hashlib.sha1('%s' % (telo)).hexdigest() print for i in(1,2,3,4,5): print "[*] encrypted at",now print "\n[*] result :",sha1 menu_item="base32" if menu_item == raw: ff=raw_input('[*] text or file $ ') menu_fuck="text" if menu_fuck == ff: telo=raw_input('text $ ') base32=base64.b32encode('%s' % (telo)) print for i in(1,2,3,4,5): print "[*] encoded at",now print "\n[*] result :",base32 menu_ss="file" if menu_ss == ff: try: print "[*] WARNING : if you encrypt this file your file original will be remove !" fileno=raw_input('\n[*] file to encrypt $ ') baca=open('%s' % (fileno), 'r') ss=baca.read() decrypt=base64.b32encode(ss) simpan=open('text.enc','w') simpan.writelines(decrypt) simpan.close() time.sleep(2) for i in(5,4,3,2,1): print "[*] encoded at",now print "\n[*] saved to text.enc" os.remove(fileno) except IOError: print "\n[*] no file found",fileno sys.exit() menu_telo="decrypt" if menu_telo == menu: print print "----> base16" print "----> base32" print "----> base64" print "----> cryptoDES" print oke=raw_input('[*] type and choice one $ ') menu_telo="cryptoDES" if menu_telo == oke: try: telo=raw_input('[*] file.encrypt : ') iv=Random.get_random_bytes(8) des1=DES.new('01234567', DES.MODE_CFB, iv) des2=DES.new('01234567', DES.MODE_CFB, iv) nama_file=open('%s' % (telo),'r') ss=nama_file.read() decs=des2.decrypt(ss) save1=open('text.decrypt','w') save1.writelines(decs) save1.close() time.sleep(2) for i in(5,4,3,2,1): print "[*] decrypted at",now print "\n[*] saved file text.decrypt" except IOError: print "\n[*] Not found file encrypt",telo menu_telo="base16" if oke == menu_telo: raw1=raw_input('[*] text base16 $ ') dec16=base64.b16decode('%s' % (raw1)) for i in(5,4,3,2,1): print "[*] decoded at",now print "\n[*] result :",dec16 menu_telo="base32" if oke == menu_telo: ss=raw_input('[*] text or file $ ') menu_gg="text" if menu_gg == ss: raw2=raw_input('[*] text base32 $ ') print dec32=base64.b32decode('%s' % (raw2)) for i in(5,4,3,2,1): print "[*] decoded at",now print "\n[*] result :",dec32 menu_hh="file" if menu_hh == ss: try: fileno=raw_input('[*] file text.enc $ ') print fuck=open('%s' % (fileno), 'r') anjir=fuck.read() dec43=base64.b32decode(anjir) telo=open('text.dec','w') telo.writelines(dec43) telo.close() time.sleep(2) for i in(5,4,3,2,1): print "[*] decoded at",now print "\n[*] save file text.dec" os.remove(fileno) except: print "[*] Not found file enc " menu_telo="base64" #this is Bug Sorry if oke == menu_telo:# raw3=raw_input('[*] text base64 $ ')# dec64=base64.b64decode('%s' % (raw3))# for i in (5,4,3,2,1):# print "[*] decoded at",now# print "\n[*] result :",dec64# menu_telo="exit" if menu_telo == oke: print "[*] thanks for shopping" sys.exit() menu_item="exit" if menu == menu_item: print "[*] thanks for shopping" sys.exit() except KeyboardInterrupt: print "\n[*] ctrl+c active " sys.exit() ##### Finished #################################### Finished ################## ############################################################################### #the Bug is cannot decrypt crypto encryption but i will try to repair and make# #progam is the best ever #you can wait this progam to be version 2.0 #
P1d0f/encryptGen
encryption-generator.py
Python
gpl-3.0
8,291
<?php function nxs_widgets_carouselitem_geticonid() { // there's no carouselitem image yet; we re-use the image icon // $widget_name = basename(dirname(__FILE__)); return "nxs-icon-image"; // . $widget_name; } function nxs_widgets_carouselitem_gettitle() { return nxs_l18n__("Carousel item", "nxs_td"); } // Unistyle function nxs_widgets_carouselitem_getunifiedstylinggroup() { return "carouselitemwidget"; } // Unicontent function nxs_widgets_carouselitem_getunifiedcontentgroup() { return "carouselitemwidget"; } /* WIDGET STRUCTURE ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- */ // Define the properties of this widget function nxs_widgets_carouselitem_home_getoptions($args) { // CORE WIDGET OPTIONS $options = array ( "sheettitle" => nxs_widgets_carouselitem_gettitle(), "sheeticonid" => nxs_widgets_carouselitem_geticonid(), "unifiedstyling" => array("group" => nxs_widgets_carouselitem_getunifiedstylinggroup(),), "unifiedcontent" => array ("group" => nxs_widgets_carouselitem_getunifiedcontentgroup(),), "fields" => array ( // TITLE array ( "id" => "image_imageid", "type" => "image", "label" => nxs_l18n__("Image", "nxs_td"), "unicontentablefield" => true, "localizablefield" => true ), array ( "id" => "destination_articleid", "type" => "article_link", "label" => nxs_l18n__("Article link", "nxs_td"), "unicontentablefield" => true, "tooltip" => nxs_l18n__("Link the menu item to an article within your site.", "nxs_td"), ), array ( "id" => "destination_url", "type" => "input", "label" => nxs_l18n__("External link", "nxs_td"), "placeholder" => nxs_l18n__("https://www.example.org", "nxs_td"), "tooltip" => nxs_l18n__("Link the button to an external source using the full url.", "nxs_td"), "unicontentablefield" => true, "localizablefield" => true ), ) ); return $options; } // rendert de placeholder zoals deze uiteindelijk door een gebruiker zichtbaar is, // hierbij worden afhankelijk van de rechten ook knoppen gerenderd waarmee de gebruiker // het bewerken van de placeholder kan opstarten function nxs_widgets_carouselitem_render_webpart_render_htmlvisualization($args) { // extract($args); global $nxs_global_row_render_statebag; $result = array(); $result["result"] = "OK"; $temp_array = nxs_getwidgetmetadata($postid, $placeholderid); // blend unistyle properties $unistyle = $temp_array["unistyle"]; if (isset($unistyle) && $unistyle != "") { // blend unistyle properties $unistyleproperties = nxs_unistyle_getunistyleproperties(nxs_widgets_carouselitem_getunifiedstylinggroup(), $unistyle); $temp_array = array_merge($temp_array, $unistyleproperties); } // Blend unicontent properties $unicontent = $temp_array["unicontent"]; if (isset($unicontent) && $unicontent != "") { // blend unistyle properties $unicontentproperties = nxs_unicontent_getunicontentproperties(nxs_widgets_carouselitem_getunifiedcontentgroup(), $unicontent); $temp_array = array_merge($temp_array, $unicontentproperties); } // The $mixedattributes is an array which will be used to set various widget specific variables (and non-specific). $mixedattributes = array_merge($temp_array, $args); $image_imageid = $mixedattributes['image_imageid']; $title = $mixedattributes['title']; $text = $mixedattributes['text']; $destination_articleid = $mixedattributes['destination_articleid']; $lookup = nxs_wp_get_attachment_image_src($image_imageid, 'full', true); $width = $lookup[1]; $height = $lookup[2]; $lookup = nxs_wp_get_attachment_image_src($image_imageid, 'thumbnail', true); $url = $lookup[0]; $url = nxs_img_getimageurlthemeversion($url); if (nxs_has_adminpermissions()) { $renderBeheer = true; } else { $renderBeheer = false; } if ($rendermode == "default") { if ($renderBeheer) { $shouldrenderhover = true; } else { $shouldrenderhover = false; } } else if ($rendermode == "anonymous") { $shouldrenderhover = false; } else { nxs_webmethod_return_nack("unsupported rendermode;" . $rendermode); } global $nxs_global_placeholder_render_statebag; if ($render_behaviour == "code") { // } else { // $hovermenuargs = array(); $hovermenuargs["postid"] = $postid; $hovermenuargs["placeholderid"] = $placeholderid; $hovermenuargs["placeholdertemplate"] = $placeholdertemplate; $hovermenuargs["metadata"] = $mixedattributes; nxs_widgets_setgenericwidgethovermenu_v2($hovermenuargs); } // // render actual control / html // nxs_ob_start(); $nxs_global_placeholder_render_statebag["widgetclass"] = "nxs-carouselitemr-item"; ?> <div class="nxs-dragrow-handler nxs-padding-menu-item"> <div class="content2"> <div class="box-content nxs-width20 nxs-float-left"> <div class='fixed-image-container'> <img src="<?php echo $url; ?>" /> </div> <p> <?php echo sprintf(nxs_l18n__("Dimensions %s px h:%s px[nxs:span]", "nxs_td"), $width, $height); ?> </p> </div> <div class="box-content nxs-width30 nxs-float-left"><?php echo nxs_render_html_escape_gtlt($title); ?></div> <div class="box-content nxs-width50 nxs-float-left"><?php echo nxs_render_html_escape_gtlt($text); ?></div> <div class="nxs-clear"></div> </div> <!--END content--> </div> <!-- --> <?php $html = nxs_ob_get_contents(); nxs_ob_end_clean(); $result["html"] = $html; $result["replacedomid"] = 'nxs-widget-' . $placeholderid; return $result; } function nxs_widgets_carouselitem_initplaceholderdata($args) { extract($args); $args['ph_margin_bottom'] = "0-0"; // current values as defined by unistyle prefail over the above "default" props $unistylegroup = nxs_widgets_carouselitem_getunifiedstylinggroup(); $args = nxs_unistyle_blendinitialunistyleproperties($args, $unistylegroup); // current values as defined by unicontent prefail over the above "default" props $unicontentgroup = nxs_widgets_carouselitem_getunifiedcontentgroup(); $args = nxs_unicontent_blendinitialunicontentproperties($args, $unicontentgroup); nxs_mergewidgetmetadata_internal($postid, $placeholderid, $args); $result = array(); $result["result"] = "OK"; return $result; } function nxs_dataprotection_nexusframework_widget_carouselitem_getprotecteddata($args) { return nxs_dataprotection_factor_createprotecteddata("widget-none"); } ?>
nexusthemes/nexusframework
nexusframework/nexuscore/widgets/carouselitem/widget_carouselitem.php
PHP
gpl-3.0
6,776
#!/usr/bin/perl use strict; use warnings; use fastaSunhh; my $fs_obj = fastaSunhh->new(); use fileSunhh; use LogInforSunhh; use Getopt::Long; my %opts; GetOptions(\%opts, "help!", "max_gapR:f", # 1 "get_4d:i", "as_coding!", "in_fa:s", # in_aln.fas "out:s", # outfile "wind:i", "step:i", ); $opts{'max_gapR'} //= 1; $opts{'wind'} //= 1; $opts{'step'} //= 1; my ($wind, $step) = ($opts{'wind'}, $opts{'step'}); my $help_txt = <<HH; ################################################################################ # perl $0 -in_fa in_aln.fasta -out trimmed_aln.fasta # # -help # # -get_4d [translation_table_number] will set -as_coding # # -as_coding [Boolean] If given, treated as codons (three bases) # Same to " -wind 3 -step 3 " # -max_gapR [$opts{'max_gapR'}] Maximum allowed gap ratio. [0-1] ################################################################################ HH $opts{'help'} and &LogInforSunhh::usage($help_txt); defined $opts{'in_fa'} or &LogInforSunhh::usage($help_txt); $opts{'get_4d'} //= 0; my %codon_4d; if ( $opts{'get_4d'} > 0 ) { $opts{'as_coding'} = 1; %codon_4d = %{ &fastaSunhh::get_4d_codon($opts{'get_4d'}) }; } my $ofh_fa = \*STDOUT; defined $opts{'out'} and $ofh_fa = &openFH( $opts{'out'}, '>' ); if ($opts{'as_coding'}) { $wind = $step = 3; } my %in_fa = %{ $fs_obj->save_seq_to_hash( 'faFile' => $opts{'in_fa'} , 'has_head'=>1) }; my @ids = sort { $in_fa{$a}{'Order'} <=> $in_fa{$b}{'Order'} } keys %in_fa; my $seqN = scalar(@ids); my $seqL ; for (@ids) { $in_fa{$_}{'seq'} =~ s!\s!!g; $in_fa{$_}{'len'} = length( $in_fa{$_}{'seq'} ); $seqL //= $in_fa{$_}{'len'}; $seqL == $in_fa{$_}{'len'} or &stopErr("[Err] Different length of sequences [$seqL VS. $in_fa{$_}{'len'}]\n"); $in_fa{$_}{'ccc'} = [ split(//, $in_fa{$_}{'seq'}) ]; } my @toRM; for ( my $i=0; $i<$seqL; $i+=$step ) { my @wb; for (my $k=0; $k<$seqN; $k++) { my $t_wb = ''; for (my $j=0; $j<$wind and $j+$i<$seqL; $j++) { $j+$i < $seqL or last; $t_wb .= $in_fa{$ids[$k]}{'ccc'}[$i+$j]; } push(@wb, $t_wb); } # Count for gap ratio my $gapN = 0; for my $t_wb (@wb) { $t_wb =~ m![\-]! and $gapN ++; } my $is_good_4d = 1; my %frame_4d_p; if ( $opts{'get_4d'} > 0 ) { $wind == 3 or &stopErr("[Err] wind [$wind] is not 3.\n"); my %frame_4d; my $cnt_total = 0; for my $bbb (@wb) { if ( $bbb =~ m![\-]! ) { next; } $cnt_total ++; defined $codon_4d{$bbb} or do { $is_good_4d = 0; last; }; for my $tp ( keys %{$codon_4d{$bbb}[1]} ) { $frame_4d{$tp} ++; } } for my $tp (sort { $a <=> $b } keys %frame_4d) { $frame_4d{$tp} == $cnt_total and $frame_4d_p{$tp} = 1; } scalar( keys %frame_4d_p ) > 0 or $is_good_4d = 0; } if ( $gapN > $seqN * $opts{'max_gapR'} ) { for (my $j=0; $j<$wind and $j+$i<$seqL; $j++) { $toRM[$j+$i] //= 1; } } elsif ( $opts{'get_4d'} > 0 ) { my $bbb = join('', @wb); if ($is_good_4d == 1) { for (my $j=0; $j<$wind and $j+$i<$seqL; $j++) { my $tj = $j+1; defined $frame_4d_p{$tj} and next; $toRM[$j+$i] //= 1; } } else { for (my $j=0; $j<$wind and $j+$i<$seqL; $j++) { $toRM[$j+$i] //= 1; } } } } for (my $i=0; $i<$seqL; $i++) { defined $toRM[$i] and $toRM[$i] == 1 and next; for (my $k=0; $k<$seqN; $k++) { $in_fa{$ids[$k]}{'got'} .= $in_fa{$ids[$k]}{'ccc'}[$i]; } } for my $tk (@ids) { $in_fa{$tk}{'got'} =~ s!(.{60})!$1\n!g; chomp( $in_fa{$tk}{'got'} ); print {$ofh_fa} ">$tk\n$in_fa{$tk}{'got'}\n"; }
Sunhh/NGS_data_processing
ortho_tools/trim_faAln.pl
Perl
gpl-3.0
3,569
/* Encod_er.h - библиотека для обработки сигналов инкрементного энкодера параллельным процессом Функция scanState() должна вызываться регулярно в параллельном процессе timeRight - время/признак поворота энкодера вправо, timeLeft - время/признак поворота энкодера влево, если = 0, то поворота не было если = 0, то поворота не было если не = 0, то содержит время последнего изменения / 8 периодов вызова scanState() position - абсолютное положение энкодера read() - чтение position Библиотека разработана Калининым Эдуардом http://mypractic.ru/ Уроки Ардуино, урок 55. */ // проверка, что библиотека еще не подключена #ifndef Encod_er_h // если библиотека Button не подключена #define Encod_er_h // тогда подключаем ее #include "Arduino.h" class Encod_er { public: Encod_er(byte pinA, byte pinB, byte timeFilter); byte timeRight; // время/признак вращения вправо (* 8 периодов) byte timeLeft; // время/признак вращения влево (* 8 периодов) long position; // текущее положение энкодера void scanState(); // метод проверки состояния энкодера long read(); // метод чтения положения энкодера private: byte _pinA; // вывод сигнала A энкодера byte _pinB; // вывод сигнала B энкодера byte _countA; // счетчик фильтрации сигнала A энкодера byte _countB; // счетчик фильтрации сигнала B энкодера byte _timeFilter; // время подтверждения состояния сигнала boolean _flagPressA; // признак состояния сигнала A boolean _flagPressB; // признак состояния сигнала B byte _changeEncCount; // счетчик времени переключения энкодера byte _divChangecCount; // делитель счетчика времени переключения энкодера }; #endif
phpscriptru/LED-Photoresist-Timer
Arduino/Libraries/Encod_er/Encod_er.h
C
gpl-3.0
2,596
apachesubst - Template engine for Apache HTTPD configuration files ==================================================================== About ----- apachesubst provides a trivial way to generate configuration files from templates. Features: * Easy to learn: Simple syntax (Tcl syntax) * Easy to use: Generate site configurations from templates in seconds * Powerful: Change all generated config files by changing its template * Flexible: Can be used to generate arbitrary configuration files. (not limited to apache) * Unobtrusive: Can be used with manually managed configuration files. * Slim: Less than 100 Lines-of-Code. Check it out yourself. Installation ------------ Required packages: * Tcl 8.5 or later * fileutil (usually installed with tcllib) Installation: Just copy `templates`, `Makefile` and `apachesubst.tcl` to your apache `sites-available` directory, e.g. `/etc/apache2/sites-available`. Quick Introduction ------------------ * Take a look at the examples: `sample*.tmpl` * Type `make` * Done. Syntax ------ A template file consists of text and Tcl commands. Tcl commands are enclosed in square brackets `[]`. Example: This is a [return "test"]. This alone would be a sufficient template engine by itself. In order to make repetitive tasks even more convenient, a few commands have been defined (see 'Extra Commands' below). Extra Commands -------------- * `substitute ...`: apply arguments to templating/substitution process * `include <filename>`: include template file. usually used to include templates * `include_raw <filename>`: include file as is * `raw <data>`: use <data> as is * `define_template <name> <data>`: define template * `use_template <name> ...`: use template with arguments as defined * `value <varname> <default>`: use variable if available, or otherwise default value * `include_template_args [<num=0>]`: use inside `define_template` definition: insert argument <num>
bef/apachesubst
README.md
Markdown
gpl-3.0
1,923
#include "SeqIO_b.h" using namespace std; SeqIO::SeqIO(const string& f, const char d): file(f), direction(d), fd(0), begin(), identifier(), pointer(0) { if( direction == 'r' ) { /* Opening for reading */ fd.open(file.c_str(), ios::in); } else if ( direction == 'w') { /* Opening for writing... * fd.open(file.c_str(), ios::out); * Todo... */ } if ( ! fd.is_open() ) { std::cerr << "" << std::endl; cerr << "ERROR: couldn't open file: " << file << endl; throw 1; } /* Compilation of regex */ regcomp(&notDna, "[^acgtACGTnN]", REG_EXTENDED); regcomp(&notQual, "[^!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ]", REG_EXTENDED); } SeqIO::~SeqIO() { regfree(&notDna); regfree(&notQual); fd.close(); } void SeqIO::index() { char c = 0; string line, id; state = start; fd.seekg(0, fd.beg); size_t pos, countLine = 0, counter; counter = 0; /* Parsing input file */ while ( getline(fd, line) ) { if ( line != "" ) c = line.at(0); counter++; if( state == start && c == '>' ) { /* New sequence */ pos = line.find(" "); id = line.substr(1, pos-1); state = fastaSeq; begin.push_back( fd.tellg() ); identifier.push_back( id ); // cerr << id << endl; } else if ( state == start && c == '@' ) { /* New read */ pos = line.find(" "); id = line.substr(1, pos-1); state = fastqSeq; begin.push_back( fd.tellg() ); identifier.push_back( id ); // cerr << id << endl; } else if ( state == fastaSeq && c == '>' ) { // cerr << id << endl; // cerr << "sq[" << seq << "]" << endl; /* New sequence */ pos = line.find(" "); id = line.substr(1, pos-1); begin.push_back( fd.tellg() ); identifier.push_back( id ); // cerr << id << endl; } else if ( state == fastqSeq && c == '+' ) { /* New quality string */ state = fastqQual; } else if ( state == fastqQual && c == '@' && countLine == 0 ) { if( countLine != 0 ) { cerr << "ERROR: not same number of lines for sequence and quality at line " << counter; cerr << line << endl; throw 3; } /* New read */ pos = line.find(" "); id = line.substr(1, pos-1); countLine = 0; state = fastqSeq; begin.push_back( fd.tellg() ); identifier.push_back( id ); // cerr << id << endl; } else if ( state == fastaSeq ) { if ( regexec(&notDna, line.c_str(), MAX_MATCHES, matches, 0) == 0 ) { cerr << "ERROR: illegal sequence char found at line " << counter; cerr << ", position " << matches[0].rm_so + 1 << endl; cerr << line << endl; throw 1; } } else if ( state == fastqSeq ) { if ( regexec(&notDna, line.c_str(), MAX_MATCHES, matches, 0) == 0 ) { cerr << "ERROR: illegal sequence char found at line " << counter; cerr << ", position " << matches[0].rm_so + 1 << endl; cerr << line << endl; throw 1; } else countLine++; } else if ( state == fastqQual ) { if ( regexec(&notQual, line.c_str(), MAX_MATCHES, matches, 0) == 0 ) { cerr << "ERROR: illegal quality char found at line " << counter; cerr << ", position " << matches[0].rm_so + 1 << endl; cerr << line << endl; throw 2; } else countLine--; } else { /* Malformed file */ cerr << "ERROR: file malformed at line " << counter << endl; throw; } } fd.clear(); fd.seekg(0, ios::beg); // return; } bool SeqIO::read(GenericSeq& gs) { /* Get the last sequence ? */ if ( pointer >= begin.size() ) return false; /* Is file open ? */ if ( ! fd.is_open() ) { cerr << "ERROR: unable to read the file!" << endl; throw; return false; } size_t length = 0; streampos start, end, eof; fd.seekg(0, ios::end); eof = fd.tellg(); start = begin[pointer]; fd.seekg(start, ios::beg); /* Pointer to the end of the sequence */ if ( pointer+1 < begin.size() ) end = begin[pointer+1]; else end = eof; /* Compute sequence length */ fd.seekg(start, ios::beg); string line; while (!fd.eof() && getline(fd, line) && line[0] != '>' && line[0] != '@' && line[0] != '+') { length += line.length(); } /* Reading the sequence */ fd.clear(); fd.seekg(start, ios::beg); if (length) { gs = GenericSeq (length); gs.set_id(identifier[pointer]); size_t i = 0; while (!fd.eof() && getline(fd, line) && line[0] != '>' && line[0] != '+') { for (size_t x = 0; x < line.length(); x++) { gs.set_symbol_at(i++, line[x]); } } } /* Point to the next sequence */ pointer++; return true; } bool SeqIO::is_eof() const { return fd.eof(); }
bigey/BioSeq
src/SeqIO_b.cpp
C++
gpl-3.0
5,608
/***************************************************************************** * Copyright 2010-2012 Katholieke Universiteit Leuven * * Use of this software is governed by the GNU LGPLv3.0 license * * Written by Broes De Cat, Bart Bogaerts, Stef De Pooter, Johan Wittocx, * Jo Devriendt, Joachim Jansen and Pieter Van Hertum * K.U.Leuven, Departement Computerwetenschappen, * Celestijnenlaan 200A, B-3001 Leuven, Belgium ****************************************************************************/ #ifndef BDDBASEDGENERATORFACTORY_HPP_ #define BDDBASEDGENERATORFACTORY_HPP_ #include "commontypes.hpp" #include "GeneratorFactory.hpp" #include "fobdds/FoBdd.hpp" class FOBDDManager; class FOBDDVariable; class FOBDDAggKernel; class FOBDD; class FOBDDKernel; class GeneratorNode; class Term; class PredForm; class Variable; class InstGenerator; class DomElemContainer; class Structure; class Universe; struct BddGeneratorData { const FOBDD* bdd; std::vector<Pattern> pattern; std::vector<const DomElemContainer*> vars; std::vector<const FOBDDVariable*> bddvars; const Structure* structure; Universe universe; BddGeneratorData(): bdd(NULL), structure(NULL){ } bool check() const { //std::cerr <<print(bdd) <<"\n\n"; return bdd!=NULL && structure!=NULL && pattern.size() == vars.size() && pattern.size() == bddvars.size() && pattern.size() == universe.tables().size(); } }; enum class BRANCH { FALSEBRANCH, TRUEBRANCH }; std::ostream& operator<<(std::ostream& output, const BRANCH& type); PRINTTOSTREAM(BRANCH) /** * Class to convert a bdd into a generator */ class BDDToGenerator { private: std::shared_ptr<FOBDDManager> _manager; /* * Help-method for creating from predform */ PredForm* smartGraphFunction(PredForm* atom, const std::vector<Pattern>& pattern, const std::vector<Variable*>& atomvars, const Structure* structure); /* * Creates an instance generator from a predform (i.e.~an atom kernel). * Can only be used on atoms that contain only var and domain terms (no functions and aggregates) */ InstGenerator *createFromSimplePredForm(PredForm *atom, const std::vector<Pattern>& pattern, const std::vector<const DomElemContainer*> & vars, const std::vector<Variable*> & atomvars, const Structure *structure, BRANCH branchToGenerate, const Universe & universe); /* * Creates an instance generator from a predform (i.e.~an atom kernel). * branchToGenerate determines whether all instances for which the predform evaluates to true * or all instances for which the predform evaluates to false are generated */ InstGenerator* createFromPredForm(PredForm*, const std::vector<Pattern>&, const std::vector<const DomElemContainer*>&, const std::vector<Variable*>&, const Structure*, BRANCH branchToGenerate, const Universe&); /* * Creates an instance generator from a aggform (i.e.~an aggkernel). * branchToGenerate determines whether all instances for which the predform evaluates to true * or all instances for which the aggform evaluates to false are generated * PRECONDITION: the first argument is an aggform of which the left term is no aggregate nor functerm */ InstGenerator* createFromAggForm(AggForm*, const std::vector<Pattern>&, const std::vector<const DomElemContainer*>&, const std::vector<Variable*>&, const Structure*, BRANCH branchToGenerate, const Universe&); /* * Creates an instance generator from a formula * PRECONDITION: f is either a predform or an aggform of which the left term is no * aggregate nor functerm (i.e.~is the direct translation of an atomkernel or an aggkernel) */ InstGenerator* createFromFormula(Formula* f, const std::vector<Pattern>&, const std::vector<const DomElemContainer*>&, const std::vector<Variable*>&, const Structure*, BRANCH branchToGenerate, const Universe&); /* * Creates an instance generator from a kernel. branchToGenerate determines whether all instances for which the kernel evaluates to true * or all instances for which the kernel evaluates to false are generated */ InstGenerator* createFromKernel(const FOBDDKernel*, const std::vector<Pattern>&, const std::vector<const DomElemContainer*>&, const std::vector<const FOBDDVariable*>&, const Structure* structure, BRANCH branchToGenerate, const Universe&); /* * Same as createfromKernel, but for aggkernels only. */ InstGenerator* createFromAggKernel(const FOBDDAggKernel*, const std::vector<Pattern>&, const std::vector<const DomElemContainer*>&, const std::vector<const FOBDDVariable*>&, const Structure* structure, BRANCH branchToGenerate, const Universe&); std::vector<InstGenerator*> turnConjunctionIntoGenerators(const std::vector<Pattern> & pattern, const std::vector<const DomElemContainer*> & vars, const std::vector<Variable*> & atomvars, const Universe & universe, QuantForm *quantform, const Structure *structure, std::vector<Formula*> conjunction, Formula *origatom, BRANCH branchToGenerate); /** * The boolean represents whether or not we should optimze the Bdd. In general: we optimize every time we enter a quantkernel (and initially) * --> Every time an extra variable is queried */ InstGenerator* createFromBDD(const BddGeneratorData& data, bool optimize = false); public: BDDToGenerator(std::shared_ptr<FOBDDManager> manager); /** * Create a generator which generates all instances for which the formula is CERTAINLY TRUE in the given structure. */ InstGenerator* create(const BddGeneratorData& data); }; #endif /* BDDBASEDGENERATORFACTORY_HPP_ */
KULeuven-KRR/IDP
src/generators/BDDBasedGeneratorFactory.hpp
C++
gpl-3.0
5,524
#!/bin/env python2.7 # -*- coding: utf-8 -*- # This file is part of AT-Platform. # # EPlatform is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # EPlatform 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 EPlatform. If not, see <http://www.gnu.org/licenses/>. import wxversion wxversion.select( '2.8' ) import glob, os, time import wx, alsaaudio import wx.lib.buttons as bt from pymouse import PyMouse from string import maketrans from pygame import mixer import subprocess as sp import shlex import numpy as np from random import shuffle #============================================================================= class speller( wx.Frame ): def __init__(self, parent): self.parent = parent self.initializeParameters( ) self.initializeBitmaps( ) self.createGui( ) #------------------------------------------------------------------------- def initializeParameters(self): self.pathToEPlatform = './' with open( self.pathToEPlatform + 'spellerParameters', 'r' ) as parametersFile: for line in parametersFile: if line[ :line.find('=')-1 ] == 'polishLettersColour': self.polishLettersColour = line[ line.rfind('=')+2:-1 ] elif line[ :line.find('=')-1 ] == 'voice': pass elif line[ :line.find('=')-1 ] == 'vowelColour': self.vowelColour= line[ line.rfind('=')+2:-1 ] elif not line.isspace( ): print '\nNiewłaściwie opisany parametr. Błąd w linii:\n%s' % line self.vowelColour = 'red' self.polishLettersColour = 'blue' with open( self.pathToEPlatform + 'parametersCW', 'r' ) as parametersFile: for line in parametersFile: if line[ :line.find('=')-1 ] == 'textSize': pass elif line[ :line.find('=')-1 ] == 'checkTime': pass elif line[ :line.find('=')-1 ] == 'maxPoints': pass elif line[ :line.find('=')-1 ] == 'colorGrat': pass elif line[ :line.find('=')-1 ] == 'colorNiest': pass elif line[ :line.find('=')-1 ] == 'ileLuk': pass #self.ileLuk= int(line[ line.rfind('=')+2:-1 ]) elif not line.isspace( ): print 'Niewłaściwie opisane parametry' print 'Błąd w linii', line #self.ileLuk=2 with open( self.pathToEPlatform + 'parameters', 'r' ) as parametersFile: for line in parametersFile: if line[ :line.find('=')-1 ] == 'timeGap': self.timeGap = int( line[ line.rfind('=')+2:-1 ] ) elif line[ :line.find('=')-1 ] == 'backgroundColour': self.backgroundColour = line[ line.rfind('=')+2:-1 ] elif line[ :line.find('=')-1 ] == 'textColour': self.textColour = line[ line.rfind('=')+2:-1 ] elif line[ :line.find('=')-1 ] == 'scanningColour': self.scanningColour = line[ line.rfind('=')+2:-1 ] elif line[ :line.find('=')-1 ] == 'selectionColour': self.selectionColour = line[ line.rfind('=')+2:-1 ] elif line[ :line.find('=')-1 ] == 'musicVolume': pass elif line[ :line.find('=')-1 ] == 'filmVolume': pass elif not line.isspace( ): print '\nNiewłaściwie opisany parametr. Błąd w linii:\n%s' % line self.timeGap = 1500 self.backgroundColour = 'white' self.textColour = 'black' self.scanningColour = '#E7FAFD' self.selectionColour = '#9EE4EF' self.labels = [ 'a e b c d f g h i o j k l m n p u y r s t w z SPECIAL_CHARACTERS DELETE TRASH CHECK ORISPEAK SPEAK EXIT'.split( ), '1 2 3 4 5 6 7 8 9 0 + - * / = % $ & . , ; : " ? ! @ # ( ) [ ] { } < > ~ DELETE TRASH CHECK ORISPEAK SPEAK EXIT'.split( ) ] self.colouredLabels = [ 'a','e','i','o','u','y'] self.winWidth, self.winHeight = wx.DisplaySize( ) self.voice=False self.slowo=self.parent.word self.ileLiter =len(self.slowo) #if self.ileLuk >=len(self.slowo): #self.ileLuk=len(self.slowo)-1 self.numberOfRows = [4, 5 ] self.numberOfColumns = [ 8, 9 ] #self.flag = 'row' #self.rowIteration = 0 #self.columnIteration = 0 #self.countRows = 0 #self.countColumns = 0 self.kolejnyKrok=0 #self.maxNumberOfColumns = 2 self.numberOfPresses = 1 self.subSizerNumber = 0 self.mouseCursor = PyMouse( ) mixer.init( ) self.typewriterKeySound = mixer.Sound( self.pathToEPlatform+'sounds/typewriter_key.wav' ) self.typewriterForwardSound = mixer.Sound( self.pathToEPlatform+'sounds/typewriter_forward.wav' ) self.typewriterSpaceSound = mixer.Sound( self.pathToEPlatform+'sounds/typewriter_space.wav' ) self.phones = glob.glob( self.pathToEPlatform+'sounds/phone/*' ) self.phoneLabels = [ item[ item.rfind( '/' )+1 : item.rfind( '_' ) ] for item in self.phones ] self.sounds = [ mixer.Sound( self.sound ) for self.sound in self.phones ] self.parent.SetBackgroundColour( 'dark grey' ) #------------------------------------------------------------------------- def initializeBitmaps(self): self.path=self.pathToEPlatform+'multimedia/' labelFiles = [ file for file in [ self.path+'icons/speller/special_characters.png', self.path+'icons/speller/DELETE.png', self.path+'icons/speller/TRASH.png', self.path+'icons/speller/CHECK.png',self.path+'icons/speller/ORISPEAK.png', self.path+'icons/speller/SPEAK.png', self.path+'icons/speller/exit.png', ] ] self.labelBitmaps = { } labelBitmapIndex = [ self.labels[ 0 ].index( self.labels[ 0 ][ -7 ] ), self.labels[ 0 ].index( self.labels[ 0 ][ -6 ] ), self.labels[ 0 ].index( self.labels[ 0 ][ -5 ] ), self.labels[ 0 ].index( self.labels[ 0 ][ -4 ] ), self.labels[ 0 ].index( self.labels[ 0 ][ -3 ] ),self.labels[ 0 ].index( self.labels[ 0 ][ -2 ] ), self.labels[ 0 ].index( self.labels[ 0 ][ -1 ] ) ] for labelFilesIndex, labelIndex in enumerate( labelBitmapIndex ): self.labelBitmaps[ self.labels[ 0 ][ labelIndex ] ] = wx.BitmapFromImage( wx.ImageFromStream( open( labelFiles[ labelFilesIndex ], 'rb' )) ) self.labelBitmaps2 = { } labelBitmapIndex2 = [ self.labels[ 1 ].index( self.labels[ 1 ][ -6 ] ), self.labels[ 1 ].index( self.labels[ 1 ][ -5 ] ), self.labels[ 1 ].index( self.labels[ 1 ][ -4 ] ), self.labels[ 1 ].index( self.labels[ 1 ][ -3 ] ),self.labels[ 1 ].index( self.labels[ 1 ][ -2 ] ), self.labels[ 1 ].index( self.labels[ 1 ][ -1 ] ) ] for labelFilesIndex2, labelIndex2 in enumerate( labelBitmapIndex2 ): self.labelBitmaps2[ self.labels[ 1 ][ labelIndex2 ] ] = wx.BitmapFromImage( wx.ImageFromStream( open( labelFiles[ 1: ][ labelFilesIndex2 ], 'rb' )) ) #------------------------------------------------------------------------- def createGui(self): self.textField = wx.TextCtrl( self.parent, style = wx.TE_LEFT|wx.TE_RICH2, size = ( self.winWidth, 0.2 * self.winHeight ) ) self.textField.SetFont( wx.Font( 60, wx.SWISS, wx.NORMAL, wx.NORMAL ) ) self.parent.mainSizer.Add( self.textField, flag = wx.EXPAND | wx.TOP | wx.BOTTOM, border = 3 ) self.subSizers = [ ] subSizer = wx.GridBagSizer( 3, 3 ) self.pomieszane=[] for i in self.slowo: self.pomieszane.append(self.labels[0].index(i)) shuffle(self.pomieszane) #print self.pomieszane for litera in self.pomieszane: if self.pomieszane.count(litera) > 1: self.pomieszane.remove(litera) zakres=(self.numberOfRows[0]-1)* self.numberOfColumns[0] -1 print zakres dodaj=np.random.randint(0,zakres,1)[0] while dodaj in self.pomieszane: dodaj=np.random.randint(0,zakres,1)[0] self.pomieszane.append(dodaj) slowoList=list(self.slowo) shuffle(slowoList) zmieszane_slowo= ''.join(slowoList) #print zmieszane_slowo for i in self.pomieszane: self.labels[0][i]=zmieszane_slowo[-1] zmieszane_slowo=zmieszane_slowo[:-1] self.pomieszane.sort() ile=0 for index_1, item in enumerate( self.labels[ 0 ][ :-7 ] ): ile+=1 b = bt.GenButton( self.parent, -1, item , name = item+str(ile), size = ( 0.985*self.winWidth / self.numberOfColumns[ 0 ], 0.79 * self.winHeight / self.numberOfRows[ 0 ] ) ) b.SetFont( wx.Font( 100, wx.FONTFAMILY_ROMAN, wx.FONTWEIGHT_LIGHT, False ) ) b.SetBezelWidth( 3 ) if index_1 not in self.pomieszane: b.SetBackgroundColour( 'grey' ) else: b.SetBackgroundColour( self.backgroundColour ) if item in self.colouredLabels and self.vowelColour != 'False': if index_1 not in self.pomieszane: b.SetForegroundColour( 'grey' ) else: b.SetForegroundColour( self.vowelColour ) else: if index_1 not in self.pomieszane: b.SetForegroundColour( 'grey' ) else: b.SetForegroundColour( self.textColour ) b.Bind( wx.EVT_LEFT_DOWN, self.onPress ) subSizer.Add( b, ( index_1 / self.numberOfColumns[ 0 ], index_1 % self.numberOfColumns[ 0 ] ), wx.DefaultSpan, wx.EXPAND ) for index_2, item in enumerate( self.labels[ 0 ][ -7 : ] ): if item == 'SPECIAL_CHARACTERS': b = bt.GenButton( self.parent, -1, item, name = item, size = ( 0.985*self.winWidth / self.numberOfColumns[ 0 ], 0.79 * self.winHeight / self.numberOfRows[ 0 ] ) ) b.SetFont( wx.Font( 100, wx.FONTFAMILY_ROMAN, wx.FONTWEIGHT_LIGHT, False ) ) b.SetForegroundColour( 'grey' ) b.SetBackgroundColour( 'grey' ) else: b = bt.GenBitmapButton( self.parent, -1, bitmap = self.labelBitmaps[ item ] ) b.SetBackgroundColour( self.backgroundColour ) b.SetBezelWidth( 3 ) b.Bind( wx.EVT_LEFT_DOWN, self.onPress ) if index_2==3: subSizer.Add( b, ( ( index_1 + index_2 +1) / self.numberOfColumns[ 0 ], ( index_1 + index_2+1 ) % self.numberOfColumns[ 0 ] ), (1,3), wx.EXPAND ) elif index_2>3: subSizer.Add( b, ( ( index_1 + index_2 +3) / self.numberOfColumns[ 0 ], ( index_1 + index_2 +3) % self.numberOfColumns[ 0 ] ), wx.DefaultSpan, wx.EXPAND ) else: subSizer.Add( b, ( ( index_1 + index_2+1 ) / self.numberOfColumns[ 0 ], ( index_1 + index_2 +1) % self.numberOfColumns[ 0 ] ), wx.DefaultSpan, wx.EXPAND ) self.subSizers.append( subSizer ) self.parent.mainSizer.Add( self.subSizers[ 0 ], proportion = 1, flag = wx.EXPAND ) self.parent.SetSizer( self.parent.mainSizer ) subSizer2 = wx.GridBagSizer( 3, 3 ) for index_1, item in enumerate( self.labels[ 1 ][ :-6 ] ): b = bt.GenButton( self.parent, -1, item, name = item, size = ( 0.985*self.winWidth / self.numberOfColumns[ 1 ], 0.75 * self.winHeight / self.numberOfRows[ 1 ] ) ) b.SetFont( wx.Font( 100, wx.FONTFAMILY_ROMAN, wx.FONTWEIGHT_LIGHT, False ) ) b.SetBezelWidth( 3 ) b.SetBackgroundColour( self.backgroundColour ) b.SetForegroundColour( self.textColour ) b.Bind( wx.EVT_LEFT_DOWN, self.onPress ) subSizer2.Add( b, ( index_1 / self.numberOfColumns[ 1 ], index_1 % self.numberOfColumns[ 1 ] ), wx.DefaultSpan, wx.EXPAND ) for index_2, item in enumerate( self.labels[ 1 ][ -6 : ] ): b = bt.GenBitmapButton( self.parent, -1, bitmap = self.labelBitmaps2[ item ] ) b.SetBackgroundColour( self.backgroundColour ) b.SetBezelWidth( 3 ) b.Bind( wx.EVT_LEFT_DOWN, self.onPress ) if index_2==2: subSizer2.Add( b, ( ( index_1 + index_2 +1) / self.numberOfColumns[ 1 ], ( index_1 + index_2 +1) % self.numberOfColumns[ 1 ] ), (1,4), wx.EXPAND ) elif index_2>2: subSizer2.Add( b, ( ( index_1 + index_2 +4) / self.numberOfColumns[ 1], ( index_1 + index_2+4 ) % self.numberOfColumns[ 1 ] ), wx.DefaultSpan, wx.EXPAND ) else: subSizer2.Add( b, ( ( index_1 + index_2+1 ) / self.numberOfColumns[ 1 ], ( index_1 + index_2 +1) % self.numberOfColumns[ 1 ] ), wx.DefaultSpan, wx.EXPAND ) self.subSizers.append( subSizer2 ) self.parent.mainSizer.Add( self.subSizers[ 1 ], proportion = 1, flag = wx.EXPAND ) self.parent.mainSizer.Show( item = self.subSizers[ 1 ], show = False, recursive = True ) self.parent.SetSizer( self.parent.mainSizer ) ikony=range(self.numberOfColumns[0]*self.numberOfRows[0]-8,self.numberOfColumns[0]*self.numberOfRows[0]-2) self.ktore=self.pomieszane for i in ikony: self.ktore.append(i) self.parent.Layout() self.usuniete=[] def onExit(self): self.parent.PicNr-=1 self.parent.stoper2.Stop( ) self.parent.back() def czytajLitere(self,litera): time.sleep(1) soundIndex = self.phoneLabels.index( [ item for item in self.phoneLabels if litera.swapcase() in item ][ 0 ] ) sound = self.sounds[ soundIndex ] sound.play( ) self.parent.SetFocus() #---------------------------------------------------------------------------- def onPress(self, event): self.numberOfPresses += 1 if self.numberOfPresses == 1: label = self.labels[ 0 ][self.ktore[self.kolejnyKrok-1]] item = self.subSizers[ 0 ].GetChildren() b = item[self.ktore[self.kolejnyKrok-1]] b=b.GetWindow( ) if label != 'SPEAK': b.SetBackgroundColour( self.selectionColour ) else: pass b.SetFocus( ) b.Update( ) if label in self.slowo: self.typewriterKeySound.play() self.textField.WriteText(label) item = self.subSizers[ 0 ].GetChildren() b = item[self.ktore[self.kolejnyKrok-1]] b=b.GetWindow( ) b.SetBackgroundColour( 'grey' ) b.SetForegroundColour('grey') b.SetFocus( ) b.Update( ) self.usuniete.append(self.ktore[self.kolejnyKrok-1]) self.ktore.remove( self.ktore[self.kolejnyKrok-1] ) self.kolejnyKrok=0 elif label == 'DELETE': text=self.textField.GetValue() if text: self.typewriterForwardSound.play( ) item = self.subSizers[ 0 ].GetChildren() b = item[self.usuniete[-1]] b=b.GetWindow( ) b.SetBackgroundColour( self.backgroundColour) if self.labels[0][self.usuniete[-1]] in self.colouredLabels: b.SetForegroundColour( self.vowelColour ) else: b.SetForegroundColour( self.textColour ) b.SetFocus( ) b.Update( ) self.ktore.append(self.usuniete[-1]) self.ktore.sort() self.usuniete.remove( self.usuniete[-1] ) self.textField.Remove(self.textField.GetInsertionPoint()-1, self.textField.GetInsertionPoint()) self.kolejnyKrok=0 else: pass elif label == 'SPEAK': if not self.voice: self.voice=True b.SetBackgroundColour('indian red') b.SetFocus( ) b.Update() else: b.SetBackgroundColour(self.backgroundColour) b.SetFocus( ) b.Update() self.voice=False elif label == 'ORISPEAK': self.parent.stoper2.Stop() if str(self.parent.word)+'.ogg' not in os.listdir(self.pathToEPlatform+'multimedia/spelling/'): command='sox -m '+self.pathToEPlatform+'sounds/phone/'+list(self.parent.word)[0].swapcase()+'.wav' ile=0 for l in list(self.parent.word)[1:]: ile+=2 command+=' "|sox '+self.pathToEPlatform+'sounds/phone/'+l.swapcase()+'.wav'+' -p pad '+str(ile)+'"' command+=' '+self.pathToEPlatform+'multimedia/spelling/'+self.parent.word+'.ogg' wykonaj=sp.Popen(shlex.split(command)) time.sleep(1.5) do_literowania=mixer.Sound(self.pathToEPlatform+'multimedia/spelling/'+self.parent.word+'.ogg') do_literowania.play() self.parent.stoper4.Start((do_literowania.get_length()+0.5 )* 1000) elif label == 'TRASH': text=self.textField.GetValue() if text: self.typewriterForwardSound.play() self.textField.Remove(0,self.textField.GetInsertionPoint()) for litera in self.usuniete: item = self.subSizers[ 0 ].GetChildren() b = item[litera] b=b.GetWindow( ) b.SetBackgroundColour( self.backgroundColour) if self.labels[0][litera] in self.colouredLabels: b.SetForegroundColour( self.vowelColour ) else: b.SetForegroundColour( self.textColour ) #print self.usuniete,self.ktore b.SetFocus( ) b.Update( ) while self.usuniete: self.ktore.append(self.usuniete[-1]) self.ktore.sort() self.usuniete.remove(self.usuniete[-1] ) self.kolejnyKrok=0 else: pass elif label == 'EXIT': self.onExit( ) elif label =='CHECK': self.parent.stoper2.Stop() self.parent.ownWord=self.textField.GetValue() self.parent.check() else: pass else: event.Skip( ) #------------------------------------------------------------------------- def timerUpdate(self, event): self.mouseCursor.move( self.winWidth - 12, self.winHeight - 20 ) self.numberOfPresses = 0 for i in self.ktore: if self.voice and i == self.numberOfRows[0]*self.numberOfColumns[0]-4: items = self.subSizers[ 0 ].GetChildren() b = items[i] b=b.GetWindow( ) b.SetBackgroundColour( 'indian red') b.SetFocus( ) b.Update( ) else: items = self.subSizers[ 0 ].GetChildren() b = items[i] b=b.GetWindow( ) b.SetBackgroundColour( self.backgroundColour ) b.SetFocus( ) b.Update( ) if self.voice and self.ktore[self.kolejnyKrok] == self.numberOfRows[0]*self.numberOfColumns[0]-4: item = self.subSizers[ 0 ].GetChildren() b = item[self.ktore[self.kolejnyKrok]] b=b.GetWindow( ) b.SetBackgroundColour( 'orange red') b.SetFocus( ) b.Update( ) else: item = self.subSizers[ 0 ].GetChildren() b = item[self.ktore[self.kolejnyKrok]] b=b.GetWindow( ) b.SetBackgroundColour( self.scanningColour) b.SetFocus( ) b.Update( ) if self.voice and self.labels[0][self.ktore[self.kolejnyKrok]] in self.slowo: self.parent.stoper2.Stop() label = self.labels[ 0 ][self.ktore[self.kolejnyKrok]] self.czytajLitere(label) self.parent.stoper2.Start(self.timeGap) if self.kolejnyKrok == len(self.ktore)-1: self.kolejnyKrok=0 else: self.kolejnyKrok+=1
bjura/EPlatform
spellerPuzzle.py
Python
gpl-3.0
24,523
package com.baeldung.jsondateformat; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.ResponseEntity; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import java.io.IOException; import java.text.ParseException; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.util.List; import java.util.Map; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = RANDOM_PORT, classes = ContactApp.class) @TestPropertySource(properties = { "spring.jackson.date-format=yyyy-MM-dd HH:mm:ss" }) public class ContactAppIntegrationTest { private final ObjectMapper mapper = new ObjectMapper(); @LocalServerPort private int port; @Autowired private TestRestTemplate restTemplate; @Test public void givenJsonFormatAnnotationAndJava8DateType_whenGet_thenReturnExpectedDateFormat() throws IOException, ParseException { ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:" + port + "/contacts", String.class); assertEquals(200, response.getStatusCodeValue()); List<Map<String, String>> respMap = mapper.readValue(response.getBody(), new TypeReference<List<Map<String, String>>>(){}); LocalDate birthdayDate = LocalDate.parse(respMap.get(0).get("birthday"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); LocalDateTime lastUpdateTime = LocalDateTime.parse(respMap.get(0).get("lastUpdate"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); assertNotNull(birthdayDate); assertNotNull(lastUpdateTime); } @Test public void givenJsonFormatAnnotationAndLegacyDateType_whenGet_thenReturnExpectedDateFormat() throws IOException { ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:" + port + "/contacts/javaUtilDate", String.class); assertEquals(200, response.getStatusCodeValue()); List<Map<String, String>> respMap = mapper.readValue(response.getBody(), new TypeReference<List<Map<String, String>>>(){}); LocalDate birthdayDate = LocalDate.parse(respMap.get(0).get("birthday"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); LocalDateTime lastUpdateTime = LocalDateTime.parse(respMap.get(0).get("lastUpdate"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); assertNotNull(birthdayDate); assertNotNull(lastUpdateTime); } @Test public void givenDefaultDateFormatInAppPropertiesAndLegacyDateType_whenGet_thenReturnExpectedDateFormat() throws IOException { ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:" + port + "/contacts/plainWithJavaUtilDate", String.class); assertEquals(200, response.getStatusCodeValue()); List<Map<String, String>> respMap = mapper.readValue(response.getBody(), new TypeReference<List<Map<String, String>>>(){}); LocalDate birthdayDate = LocalDate.parse(respMap.get(0).get("birthday"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); LocalDateTime lastUpdateTime = LocalDateTime.parse(respMap.get(0).get("lastUpdate"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); assertNotNull(birthdayDate); assertNotNull(lastUpdateTime); } @Test(expected = DateTimeParseException.class) public void givenDefaultDateFormatInAppPropertiesAndJava8DateType_whenGet_thenNotApplyFormat() throws IOException { ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:" + port + "/contacts/plain", String.class); assertEquals(200, response.getStatusCodeValue()); List<Map<String, String>> respMap = mapper.readValue(response.getBody(), new TypeReference<List<Map<String, String>>>(){}); LocalDate birthdayDate = LocalDate.parse(respMap.get(0).get("birthday"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); LocalDateTime lastUpdateTime = LocalDateTime.parse(respMap.get(0).get("lastUpdate"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); } }
Niky4000/UsefulUtils
projects/tutorials-master/tutorials-master/spring-boot-data/src/test/java/com/baeldung/jsondateformat/ContactAppIntegrationTest.java
Java
gpl-3.0
4,712
Wanawana ======== Wana meet? Wanawana is an event management system. Details ======= It is still in the earlier stages of development. Check the issues or the [TODO](TODO.md) document. Demo instance ============= http://wanawana.worlddomination.be/ Installation ============ Wanawana is a vanilla python/django website, any classical tutorial on how to deploy a django website is good for it.
Psycojoker/wanawana
README.md
Markdown
gpl-3.0
402
# Copyright (c) 2012 Jakub Pastuszek # # This file is part of Distributed Monitoring System. # # Distributed Monitoring System is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Distributed Monitoring System 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 Distributed Monitoring System. If not, see <http://www.gnu.org/licenses/>. require 'dms-poller/processing_thread' class CollectorThread < ProcessingThread def initialize(shutdown_queue, collector_bind_address, data_processor_address, queue_message_count, disk_queue_size, linger_time) log.info "Binding collector socket at: #{collector_bind_address}" log.info "Connecting collector with data porcessor at: #{data_processor_address}" super(shutdown_queue) do ZeroMQ.new do |zmq| begin zmq.pull_bind(collector_bind_address) do |pull| zmq.push_connect(data_processor_address, hwm: queue_message_count, swap: disk_queue_size, buffer: 0, linger: linger_time) do |push| pull.on :raw do |message| push.send message end loop do pull.receive! end end end ensure log.info "waiting for messages to be sent..." end end end end end
jpastuszek/dms-poller
lib/dms-poller/collector_thread.rb
Ruby
gpl-3.0
1,630
import json import argparse import numpy import sys import copy from astropy.coordinates import SkyCoord from astropy import units import operator class Program(object): def __init__(self, runid="16BP06", pi_login="gladman"): self.config = {"runid": runid, "pi_login": pi_login, "program_configuration": {"mjdates": [], "observing_blocks": [], "observing_groups": [] }} def add_target(self, target): self.config["program_configuration"]["mjdates"].append(target) def add_observing_block(self, observing_block): self.config["program_configuration"]["observing_blocks"].append(observing_block) def add_observing_group(self, observing_group): self.config["program_configuration"]["observing_groups"].append(observing_group) class Target(object): def __init__(self, filename=None): self.config = json.load(open(filename)) @property def token(self): return self.config["identifier"]["client_token"] @property def mag(self): return self.config["moving_target"]["ephemeris_points"][0]["mag"] @property def coordinate(self): return SkyCoord(self.config["moving_target"]["ephemeris_points"][0]["coordinate"]["ra"], self.config["moving_target"]["ephemeris_points"][0]["coordinate"]["dec"], unit='degree') class ObservingBlock(object): def __init__(self, client_token, target_token): self.config = {"identifier": {"client_token": client_token}, "target_identifier": {"client_token": target_token}, "constraint_identifiers": [{"server_token": "C1"}], "instrument_config_identifiers": [{"server_token": "I1"}]} @property def token(self): return self.config["identifier"]["client_token"] class ObservingGroup(object): def __init__(self, client_token): self.config = {"identifier": {"client_token": client_token}, "observing_block_identifiers": []} def add_ob(self, client_token): self.config["observing_block_identifiers"].append({"client_token": client_token}) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('ogname') parser.add_argument('mjdates', nargs='+') args = parser.parse_args() # Break the mjdates into OBs based on their max mag of source in pointing. cuts = numpy.array([23.0, 23.5, 24.0, 24.5, 25.0, 25.5, 26.0, 30.0]) IC_exptimes = [50, 100, 200, 300, 400, 500, 600, 700] program = Program() ob_tokens = [] mags = {} ob_coordinate = {} for filename in args.mjdates: target = Target(filename) program.add_target(target.config) ob_token = "OB-{}-{}".format(target.token, target.mag) ob = ObservingBlock(ob_token, target.token) idx = (target.mag > cuts).sum() + 4 ob.config["instrument_config_identifiers"] = [{"server_token": "I{}".format(idx)}] program.add_observing_block(ob.config) ob_tokens.append(ob_token) mags[ob_token] = target.mag ob_coordinate[ob_token] = target.coordinate sf = lambda x, y: cmp(x.ra, y.ra) order_tokens = sorted(ob_coordinate, cmp=sf, key=ob_coordinate.get) total_itime = 0 ogs = {} scheduled = {} og_idx = 0 while len(scheduled) < len(ob_tokens): og_idx += 1 og_token = "OG_{}_{}_{}".format(args.ogname, og_idx, 0) sys.stdout.write("{}: ".format(og_token)) og = ObservingGroup(og_token) og_coord = None og_itime = 0 for ob_token in order_tokens: if ob_token not in scheduled: if og_coord is None: og_coord = ob_coordinate[ob_token] if ob_coordinate[ob_token].separation(og_coord) > 30 * units.degree: continue og.add_ob(ob_token) scheduled[ob_token] = True sys.stdout.write("{} ".format(ob_token)) sys.stdout.flush() idx = (mags[ob_token] > cuts).sum() print ob_token, mags[ob_token], idx + 4 og_itime += IC_exptimes[idx] + 40 if og_itime > 3000.0: break break total_itime += og_itime sys.stdout.write(" {}s \n".format(og_itime)) program.add_observing_group(og.config) nrepeats = 0 for repeat in range(nrepeats): total_itime += og_itime og_token = "OG_{}_{}_{}".format(args.ogname, og_idx, repeat + 1) og = copy.deepcopy(og) og.config["identifier"]["client_token"] = og_token program.add_observing_group(og.config) print "Total I-Time: {} hrs".format(total_itime/3600.) json.dump(program.config, open('program.json', 'w'), indent=4, sort_keys=True)
CFIS-Octarine/octarine
planning/ph2.py
Python
gpl-3.0
5,099
#-*- coding: utf-8 -*- from django.conf.urls import url from . import views app_name = "perso" urlpatterns = [ url(r'^$', views.main, name='main'), url(r'^(?P<pageId>[0-9]+)/?$', views.main, name='main'), url(r'^about/?$', views.about, name='about'), url(r'^contact/?$', views.contact, name='contact'), url(r'^(?P<cat_slug>[-a-zA-Z0-9_]+)/?$', views.main, name='main'), url(r'^(?P<cat_slug>[-a-zA-Z0-9_]+)/(?P<pageId>[0-9]+)/?$', views.main, name='main'), url(r'^publication/(?P<slug>[-a-zA-Z0-9_]+)/?$', views.publication, name='publication'), url(r'^tag/(?P<slug>[-a-zA-Z0-9_]+)/?$', views.tag, name='tag'), ]
LeMinaw/minaw.net
perso/urls.py
Python
gpl-3.0
901
<!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_07) on Sun Mar 22 19:06:38 GMT 2009 --> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <TITLE> org.jqurantree.core.collections Class Hierarchy (JQuranTree API Documentation) </TITLE> <META NAME="date" CONTENT="2009-03-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="org.jqurantree.core.collections Class Hierarchy (JQuranTree API Documentation)"; } } </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"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../org/jqurantree/arabic/encoding/unicode/package-tree.html"><B>PREV</B></A>&nbsp; &nbsp;<A HREF="../../../../org/jqurantree/core/error/package-tree.html"><B>NEXT</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/jqurantree/core/collections/package-tree.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-tree.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> Hierarchy For Package org.jqurantree.core.collections </H2> </CENTER> <DL> <DT><B>Package Hierarchies:</B><DD><A HREF="../../../../overview-tree.html">All Packages</A></DL> <HR> <H2> Class Hierarchy </H2> <UL> <LI TYPE="circle">java.lang.Object<UL> <LI TYPE="circle">org.jqurantree.core.collections.<A HREF="../../../../org/jqurantree/core/collections/ImmutableIteratorBase.html" title="class in org.jqurantree.core.collections"><B>ImmutableIteratorBase</B></A>&lt;T&gt; (implements java.util.Iterator&lt;E&gt;) <UL> <LI TYPE="circle">org.jqurantree.core.collections.<A HREF="../../../../org/jqurantree/core/collections/ArrayIterator.html" title="class in org.jqurantree.core.collections"><B>ArrayIterator</B></A>&lt;T&gt; (implements java.lang.Iterable&lt;T&gt;) </UL> </UL> </UL> <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"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../org/jqurantree/arabic/encoding/unicode/package-tree.html"><B>PREV</B></A>&nbsp; &nbsp;<A HREF="../../../../org/jqurantree/core/error/package-tree.html"><B>NEXT</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/jqurantree/core/collections/package-tree.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-tree.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> Copyright&copy; Kais Dukes, 2009. All Rights Reserved. </BODY> </HTML>
reemeldeeb/jqurantree
javadoc/org/jqurantree/core/collections/package-tree.html
HTML
gpl-3.0
6,835
package in.mayurshah.DTO; import org.openqa.selenium.Platform; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.DesiredCapabilities; public class WebDriverConfig { private boolean intenal; private String remoteURL; private String TestCaseName; private String browserName; private String OS; private String browserVersion; private DesiredCapabilities desiredCapabilities; private ChromeOptions chromeOptions; public WebDriverConfig(){ this.desiredCapabilities = new DesiredCapabilities(); } public void setChromeOptions(ChromeOptions chromeOptions){ this.chromeOptions = chromeOptions; } public ChromeOptions getChromeOptions(){ return this.chromeOptions; } public boolean isIntenal() { return intenal; } public void setIntenal(boolean intenal) { this.intenal = intenal; } public void appendCapability(String key, Object value){ this.desiredCapabilities.setCapability(key,value); } public void appendCapability(String key, String value){ this.desiredCapabilities.setCapability(key,value); } public DesiredCapabilities getDesiredCapabilities(){ this.desiredCapabilities.setBrowserName(this.browserName); this.desiredCapabilities.setPlatform(Platform.fromString(this.OS)); this.desiredCapabilities.setVersion(this.browserVersion); return desiredCapabilities; } public String getRemoteURL() { return remoteURL; } public void setRemoteURL(String remoteURL) { this.remoteURL = remoteURL; } public String getTestCaseName() { return TestCaseName; } public void setTestCaseName(String testCaseName) { TestCaseName = testCaseName; } public void setBrowserName(String browserName) { this.browserName = browserName; } public void setOS(String oS) { OS = oS; } public void setBrowserVersion(String browserVersion) { this.browserVersion = browserVersion; } }
selenium-webdriver-software-testing/kspl-selenium-helper
src/main/java/in/mayurshah/DTO/WebDriverConfig.java
Java
gpl-3.0
1,867
/* global Converter, probandDatav2 */ describe('Converter', function() { describe('load', function() { it('should load proband data', function() { var converter = new Converter(); converter.load(probandDatav2); expect(converter.data).to.deep.equal(probandDatav2); }); it('sould create empty comments object', function() { var converter = new Converter(); converter.load(probandDatav2); expect(converter.comments).to.deep.equal({}); }); it('sould create empty diary array', function() { var converter = new Converter(); converter.load(probandDatav2); expect(converter.diary).to.deep.equal([]); }); it('sould create empty interactions array', function() { var converter = new Converter(); converter.load(probandDatav2); expect(converter.interactions).to.deep.equal([]); }); }); describe('convertComments', function() { it('sould convert v2 diary format to v1 diary format', function() { var commentsDatav1 = { "3c92a4df": "1389823488 ~ ein Freund von mir hat ein Scherz über Bundeswehr gepostet, ich fand es sehr witzig ", "0a81f271": "1389823819 ~ ich habe ein Link von einer Kommilitonin kommentiert, es ging um \"52 Places to go in 2014\" von NY-Times, obwohl München und Berlin nicht dabei sind, ist Frankfurt dabei, naja ich persönlich finde es gibt schönere Plätze in Deutschland ", "7bcddf87": "1389911628 ~ es geht um eine online Umfrage bezüglich unserer Kantine im Niederrad, gepostet hat ein Mitlied des Studentenrates", "13901343": "1390134335 ~ Ich kommentiere einen Zeitungsartikel, den ich selbst geteilt habe. Es wurde in der Rhein-Neckar-Zeitung veröffentlicht und geht darum, dass das Kino in der Altstadt schleißt. Ich finde es sehr traurig, viele Erinnerungen hängen daran, deswegen habe ich mich entschieden es mit meinen Freunden zu teilen. ", "75019456": "1390134527 ~ Es handelt sich dabei um eine bezahlte Werbung von Watchever, einen \"online video stream\" Anbieter. Es geht um ein Gewinnspiel. Mich nerven diese Werbeanzeigen...", "70e816cf": "1390328184 ~ ", "ba5dfbdb": "1390341915 ~ Ich kommentiere einen Videoclip, welches von einer Gruppe gepostet wurde. Es handelt sich dabei um ein Musikvideo von David Guetta, sehr cool, gefällt mir." }; var converter = new Converter(); converter.load(probandDatav2); converter.convertComments(); expect(converter.comments).to.deep.equal(commentsDatav1); }); }); describe('convertInteractions', function() { it('should convert v2 interactions format to v1 interactions format', function() { var interactionsDatav1 = [{ "nr": 0, "interaction_type": "openFacebook", "time": "2014-01-15T19:45:49.374Z", "network": "Facebook" }, { "nr": 1, "interaction_type": "closeFacebook", "time": "2014-01-15T21:24:14.670Z", "network": "Facebook" }, { "nr": 2, "interaction_type": "openFacebook", "time": "2014-01-15T21:24:14.761Z", "network": "Facebook" }, { "nr": 3, "interaction_type": "like", "time": "2014-01-15T21:45:57.751Z", "network": "Facebook", "object_id": "3e799b96", "object_owner": "9cb2fda2", "object_type": "status" }, { "nr": 4, "interaction_type": "like", "time": "2014-01-15T21:58:48.983Z", "network": "Facebook", "object_id": "3c92a4df", "object_owner": "1abcc45b", "object_type": "status" }]; var converter = new Converter(); converter.load(probandDatav2); converter.convertInteractions(); var convertedInteractions = converter.interactions.splice(0, 5); expect(convertedInteractions).to.deep.equal(interactionsDatav1); }); }); describe('convertDiary', function() { it('sould convert v2 diary format to v1 diary format', function() { var diaryDatav1 = [ ["2014-01-15T22:02:33.565Z", "habe eine Freundschaftsanfrage geschickt"], ["2014-01-16T22:13:34.870Z", "Ein guter Freund von mir ist wieder bei Facebook. Anfang September hat er sein Facebook-Account deaktiviert wegen Staatsexamen, jetzt ist er wieder da. "], ["2014-01-19T12:33:18.834Z", "gestern wurde ich wieder in eine Gruppe der \"Studenten Karlsruhe\" eingeladen, obwohl ich schon mal eingeladen wurde und ich ausgetreten bin...\nwas ich nicht verstehe, dass obwohl ich nirgendswo zugestimmt habe, war ich automatisch ein Mitglied der Gruppe und konnte alles sehen...\njetzt bin ich wieder ausgetreten, und so eingestellt, dass mich Leute nicht wieder einladen können!"], ["2014-01-21T22:37:24.245Z", "was mich zur Zeit nervt, ist das Häkchen bei einer gelesener Nachricht, leider klicke ich manchmal auf eine neue Nachricht und der Absender weißt sofort, dass ich es gesehen habe...\ngenau das wollte ich heute in den Einstellungen ändern, leider fand ich nichts... "], ["2014-01-22T22:35:26.653Z", "Eine Freundin wollte heute in Facebook wissen, wie man es so einstellen kann, dass z. B. Google deine Facebook-Seite nicht als Ergebnis anzeigt, wenn man den Namen eingetippt..."] ]; var converter = new Converter(); converter.load(probandDatav2); converter.convertDiary(); expect(converter.diary).to.deep.equal(diaryDatav1); }); }); });
secure-software-engineering/ivy
test/spec/converter_test.js
JavaScript
gpl-3.0
6,072
<?php /* Public-Storm Copyright (C) 2008-2012 Mathieu Lory <mathieu@internetcollaboratif.info> This file is part of Public-Storm. Public-Storm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Public-Storm 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 Public-Storm. If not, see <http://www.gnu.org/licenses/>. */ final class graphviz extends Plugins { public static $subdirs = array(); public static $name = "graphviz"; public static $graph; public static $s; public function __construct() { require(Settings::getVar('prefix') . 'conf/graphviz.php'); require_once("./plugins/graphviz/classes/GraphViz.php"); self::$graph = new Image_GraphViz(false, null, 'G', false); /* $graph->addEdge(array('run' => 'intr')); $graph->addEdge(array('intr' => 'runbl')); $graph->addEdge(array('runbl' => 'run')); $graph->addEdge(array('run' => 'kernel')); $graph->addEdge(array('kernel' => 'zombie')); $graph->addEdge(array('kernel' => 'sleep')); $graph->addEdge(array('kernel' => 'runmem')); $graph->addEdge(array('sleep' => 'swap')); $graph->addEdge(array('swap' => 'runswap')); $graph->addEdge(array('runswap' => 'new')); $graph->addEdge(array('runswap' => 'runmem')); $graph->addEdge(array('new' => 'runmem')); $graph->addEdge(array('sleep' => 'runmem')); $graph->addNode('c', array('shape' => 'polygon', 'sides' => 4, 'skew' => .4, 'label' => 'hello world')); $graph->addNode('Node1', array('label' => 'Node1'), 'cluster_1'); $result = $graph->image(); //$graph->parse(); print $result; */ } public function renderDotFile($dotfile, $outputfile, $format='svg', $command=null) { return self::$graph->renderDotFile($dotfile, $outputfile, $format, $command); } public function loadLang() { return parent::loadLang(self::$name); } public function getVersion() { return parent::getVersion(); } public function getName() { return self::$name; } public function getDescription() { return parent::getDescription(); } public function getAuthor() { return parent::getAuthor(); } public function getSubDirs() { return self::$subdirs; } } ?>
mathcoll/Public-Storm
Trunk/www/plugins/graphviz/_plugin.php
PHP
gpl-3.0
2,782
<?php /** * @package Arastta eCommerce * @copyright Copyright (C) 2015-2016 Arastta Association. All rights reserved. (arastta.org) * @credits See CREDITS.txt for credits and other copyright notices. * @license GNU General Public License version 3; see LICENSE.txt */ // Heading $_['heading_title'] = 'Account'; // Text $_['text_register'] = 'Register'; $_['text_login'] = 'Login'; $_['text_logout'] = 'Logout'; $_['text_forgotten'] = 'Forgotten Password'; $_['text_account'] = 'My Account'; $_['text_edit'] = 'Edit Account'; $_['text_password'] = 'Password'; $_['text_address'] = 'Address Books'; $_['text_wishlist'] = 'Wish List'; $_['text_order'] = 'Order History'; $_['text_download'] = 'Downloads'; $_['text_reward'] = 'Reward Points'; $_['text_return'] = 'Returns'; $_['text_credit'] = 'Credits'; $_['text_newsletter'] = 'Newsletter'; $_['text_recurring'] = 'Recurring Payments';
denisdulici/arastta
catalog/language/en-GB/module/account.php
PHP
gpl-3.0
986
package com.projectreddog.machinemod.client.gui; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.texture.ITextureObject; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; import com.projectreddog.machinemod.container.ContainerDumpTruck; import com.projectreddog.machinemod.entity.EntityDumpTruck; import com.projectreddog.machinemod.reference.Reference; public class GuiDumpTruck extends GuiContainer { public GuiDumpTruck (InventoryPlayer inventoryPlayer, EntityDumpTruck dumpTruck) { //the container is instanciated and passed to the superclass for handling super(new ContainerDumpTruck(inventoryPlayer, dumpTruck)); } @Override public void initGui() { this.xSize =176; this.ySize =222; super.initGui(); } @Override protected void drawGuiContainerForegroundLayer(int param1, int param2) { //draw text and stuff here //the parameters for drawString are: string, x, y, color // fontRenderer.drawString("Tiny", 8, 6, 4210752); // //draws "Inventory" or your regional equivalent // fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { //draw your Gui here, only thing you need to change is the path GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(new ResourceLocation(Reference.MOD_ID , "textures/gui/dumptruck.png")); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); } }
TechStack/MachineMod
src/main/java/com/projectreddog/machinemod/client/gui/GuiDumpTruck.java
Java
gpl-3.0
1,949
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_51) on Thu Feb 06 09:12:27 CET 2014 --> <title>M-Index</title> <meta name="date" content="2014-02-06"> <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="M-Index"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../overview-summary.html">Overview</a></li> <li>Package</li> <li>Class</li> <li>Use</li> <li><a href="../overview-tree.html">Tree</a></li> <li><a href="../deprecated-list.html">Deprecated</a></li> <li class="navBarCell1Rev">Index</li> <li><a href="../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="index-4.html">Prev Letter</a></li> <li><a href="index-6.html">Next Letter</a></li> </ul> <ul class="navList"> <li><a href="../index.html?index-filesindex-5.html" target="_top">Frames</a></li> <li><a href="index-5.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="contentContainer"><a href="index-1.html">C</a>&nbsp;<a href="index-2.html">F</a>&nbsp;<a href="index-3.html">G</a>&nbsp;<a href="index-4.html">L</a>&nbsp;<a href="index-5.html">M</a>&nbsp;<a href="index-6.html">O</a>&nbsp;<a href="index-7.html">R</a>&nbsp;<a href="index-8.html">S</a>&nbsp;<a href="index-9.html">W</a>&nbsp;<a name="_M_"> <!-- --> </a> <h2 class="title">M</h2> <dl> <dt><span class="strong"><a href="../FileManagerRunner.html#main(java.lang.String[])">main(String[])</a></span> - Static method in class <a href="../FileManagerRunner.html" title="class in &lt;Unnamed&gt;">FileManagerRunner</a></dt> <dd>&nbsp;</dd> <dt><span class="strong"><a href="../fileManagerAPI/CommonFileOperations.html#manipulateFile()">manipulateFile()</a></span> - Method in class fileManagerAPI.<a href="../fileManagerAPI/CommonFileOperations.html" title="class in fileManagerAPI">CommonFileOperations</a></dt> <dd>&nbsp;</dd> <dt><span class="strong"><a href="../fileManagerAPI/FileManager.html#manipulateFile()">manipulateFile()</a></span> - Method in interface fileManagerAPI.<a href="../fileManagerAPI/FileManager.html" title="interface in fileManagerAPI">FileManager</a></dt> <dd> <div class="block">Do something on the file.</div> </dd> <dt><span class="strong"><a href="../fileManagerAPI/FileReader.html#manipulateFile()">manipulateFile()</a></span> - Method in class fileManagerAPI.<a href="../fileManagerAPI/FileReader.html" title="class in fileManagerAPI">FileReader</a></dt> <dd>&nbsp;</dd> <dt><span class="strong"><a href="../fileManagerAPI/FileWriter.html#manipulateFile()">manipulateFile()</a></span> - Method in class fileManagerAPI.<a href="../fileManagerAPI/FileWriter.html" title="class in fileManagerAPI">FileWriter</a></dt> <dd>&nbsp;</dd> <dt><span class="strong"><a href="../fileManagerAPI/LazyReader.html#manipulateFile()">manipulateFile()</a></span> - Method in class fileManagerAPI.<a href="../fileManagerAPI/LazyReader.html" title="class in fileManagerAPI">LazyReader</a></dt> <dd>&nbsp;</dd> <dt><span class="strong"><a href="../fileManagerAPI/LazyWriter.html#manipulateFile()">manipulateFile()</a></span> - Method in class fileManagerAPI.<a href="../fileManagerAPI/LazyWriter.html" title="class in fileManagerAPI">LazyWriter</a></dt> <dd>&nbsp;</dd> <dt><span class="strong"><a href="../myFileManager/Reader.html#manipulateFile()">manipulateFile()</a></span> - Method in class myFileManager.<a href="../myFileManager/Reader.html" title="class in myFileManager">Reader</a></dt> <dd>&nbsp;</dd> <dt><span class="strong"><a href="../myFileManager/Writer.html#manipulateFile()">manipulateFile()</a></span> - Method in class myFileManager.<a href="../myFileManager/Writer.html" title="class in myFileManager">Writer</a></dt> <dd>&nbsp;</dd> <dt><a href="../myFileManager/package-summary.html">myFileManager</a> - package myFileManager</dt> <dd>&nbsp;</dd> </dl> <a href="index-1.html">C</a>&nbsp;<a href="index-2.html">F</a>&nbsp;<a href="index-3.html">G</a>&nbsp;<a href="index-4.html">L</a>&nbsp;<a href="index-5.html">M</a>&nbsp;<a href="index-6.html">O</a>&nbsp;<a href="index-7.html">R</a>&nbsp;<a href="index-8.html">S</a>&nbsp;<a href="index-9.html">W</a>&nbsp;</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../overview-summary.html">Overview</a></li> <li>Package</li> <li>Class</li> <li>Use</li> <li><a href="../overview-tree.html">Tree</a></li> <li><a href="../deprecated-list.html">Deprecated</a></li> <li class="navBarCell1Rev">Index</li> <li><a href="../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="index-4.html">Prev Letter</a></li> <li><a href="index-6.html">Next Letter</a></li> </ul> <ul class="navList"> <li><a href="../index.html?index-filesindex-5.html" target="_top">Frames</a></li> <li><a href="index-5.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
buoncubi/JFileManager
JavaDoc/index-files/index-5.html
HTML
gpl-3.0
6,544
<?php // ensure this file is being included by a parent file if ( !defined('_JEXEC') && !defined('_VALID_MOS')) die('Restricted access'); /** * @version $Id: list.php 235 2014-04-08 08:55:05Z soeren $ * @package eXtplorer * @copyright soeren 2007-2014 * @author The eXtplorer project (http://extplorer.net) * @author The The QuiX project (http://quixplorer.sourceforge.net) * * @license * The contents of this file are subject to the Mozilla Public License * Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * Alternatively, the contents of this file may be used under the terms * of the GNU General Public License Version 2 or later (the "GPL"), in * which case the provisions of the GPL are applicable instead of * those above. If you wish to allow use of your version of this file only * under the terms of the GPL and not to allow others to use * your version of this file under the MPL, indicate your decision by * deleting the provisions above and replace them with the notice and * other provisions required by the GPL. If you do not delete * the provisions above, a recipient may use your version of this file * under either the MPL or the GPL." * * Directory-Listing Functions */ //------------------------------------------------------------------------------ // HELPER FUNCTIONS (USED BY MAIN FUNCTION 'list_dir', SEE BOTTOM) // make list of files function make_list(&$_list1, &$_list2) { $list = array(); if ($GLOBALS["direction"]=="ASC") { $list1 = $_list1; $list2 = $_list2; } else { $list1 = $_list2; $list2 = $_list1; } if (is_array($list1)) { while (list($key, $val) = each($list1)) { $list[$key] = $val; } } if (is_array($list2)) { while (list($key, $val) = each($list2)) { $list[$key] = $val; } } return $list; } /** * make tables & place results in reference-variables passed to function * also 'return' total filesize & total number of items * * @param string $dir * @param array $dir_list * @param array $file_list * @param int $tot_file_size * @param int $num_items */ // make table of files in dir function get_dircontents($dir, &$dir_list, &$file_list, &$tot_file_size, &$num_items) { $homedir = realpath($GLOBALS['home_dir']); $tot_file_size = $num_items = 0; // Open directory $handle = @$GLOBALS['ext_File']->opendir(get_abs_dir($dir)); if ($handle === false && $dir == "") { $handle = @$GLOBALS['ext_File']->opendir($homedir . $GLOBALS['separator']); } if ($handle === false) { ext_Result::sendResult('list', false, $dir . ": " . $GLOBALS["error_msg"]["opendir"]); } $file_list = array(); $dir_list = array(); // Read directory while(($new_item = @$GLOBALS['ext_File']->readdir($handle)) !== false) { if (is_array($new_item)) { $abs_new_item = $new_item; } else { $abs_new_item = get_abs_item($dir, $new_item); } /*if (get_is_dir($abs_new_item)) { continue; }*/ if ($new_item == "." || $new_item == "..") continue; if (!@$GLOBALS['ext_File']->file_exists($abs_new_item)) { //ext_Result::sendResult('list', false, $dir."/$abs_new_item: ".$GLOBALS["error_msg"]["readdir"]); } if (!get_show_item($dir, $new_item)) continue; $new_file_size = @$GLOBALS['ext_File']->filesize($abs_new_item); $tot_file_size += $new_file_size; $num_items++; $new_item_name = $new_item; if (ext_isFTPMode()) { $new_item_name = $new_item['name']; } if (get_is_dir($abs_new_item)) { if ($GLOBALS["order"] == "modified") { $dir_list[$new_item_name] = @$GLOBALS['ext_File']->filemtime($abs_new_item); } else { // order == "size", "type" or "name" $dir_list[$new_item_name] = $new_item; } } else { if ($GLOBALS["order"] == "size") { $file_list[$new_item_name] = $new_file_size; } elseif ($GLOBALS["order"] == "modified") { $file_list[$new_item_name] = @$GLOBALS['ext_File']->filemtime($abs_new_item); } elseif ($GLOBALS["order"] == "type") { $file_list[$new_item_name] = get_mime_type($abs_new_item, "type"); } else { // order == "name" $file_list[$new_item_name] = $new_item; } } } @$GLOBALS['ext_File']->closedir($handle); // sort if (is_array($dir_list)) { if ($GLOBALS["order"] == "modified") { if ($GLOBALS["direction"] == "ASC") arsort($dir_list); else asort($dir_list); } else { // order == "size", "type" or "name" if ($GLOBALS["direction"] == "ASC") ksort($dir_list); else krsort($dir_list); } } // sort if (is_array($file_list)) { if ($GLOBALS["order"] == "modified") { if ($GLOBALS["direction"] == "ASC") arsort($file_list); else asort($file_list); } elseif ($GLOBALS["order"] == "size" || $GLOBALS["order"] == "type") { if ($GLOBALS["direction"] == "ASC") asort($file_list); else arsort($file_list); } else { // order == "name" if ($GLOBALS["direction"] == "ASC") ksort($file_list); else krsort($file_list); } } if ($GLOBALS['start'] > $num_items) { $GLOBALS['start'] = 0; } } /** * This function assembles an array (list) of files or directories in the directory specified by $dir * The result array is send using JSON * * @param string $dir * @param string $sendWhat Can be "files" or "dirs" */ function send_dircontents($dir, $sendWhat = 'files') { // print table of files global $dir_up, $mainframe; // make file & dir tables, & get total filesize & number of items get_dircontents($dir, $dir_list, $file_list, $tot_file_size, $num_items); if ($sendWhat == 'files') { $list = $file_list; } elseif ($sendWhat == 'dirs') { $list = $dir_list; } else { $list = make_list($dir_list, $file_list); } $i = 0; $items['totalCount'] = count($list); $items['items'] = array(); $dirlist = array(); if ($sendWhat != 'dirs') { // Replaced array_splice, because it resets numeric indexes (like files or dirs with a numeric name) // Here we reduce the list to the range of $limit beginning at $start $a = 0; $output_array = array(); foreach ($list as $key => $value) { if ($a >= $GLOBALS['start'] && ($a - $GLOBALS['start'] < $GLOBALS['limit'])) { $output_array[$key] = $value; } $a++; } $list = $output_array; } while(list($item,$info) = each($list)) { // link to dir / file if (is_array($info)) { $abs_item = $info; if (extension_loaded('posix')) { $user_info = posix_getpwnam($info['user']); $file_info['uid'] = $user_info['uid']; $file_info['gid'] = $user_info['gid']; } } else { $abs_item = get_abs_item(ext_TextEncoding::fromUTF8($dir), $item); $file_info = @stat($abs_item); } $is_dir = get_is_dir($abs_item); if ($GLOBALS['use_mb']) { if (ext_isFTPMode()) { $items['items'][$i]['name'] = $item; } else if (mb_detect_encoding($item) == 'ASCII') { $items['items'][$i]['name'] = ext_TextEncoding::toUTF8($item); } else { $items['items'][$i]['name'] = ext_TextEncoding::toUTF8($item); } } else { $items['items'][$i]['name'] = ext_isFTPMode() ? $item : ext_TextEncoding::toUTF8($item); } $items['items'][$i]['is_file'] = get_is_file($abs_item); $items['items'][$i]['is_archive'] = ext_isArchive($item) && !ext_isFTPMode(); $items['items'][$i]['is_writable'] = $is_writable = @$GLOBALS['ext_File']->is_writable($abs_item); $items['items'][$i]['is_chmodable'] = $is_chmodable = @$GLOBALS['ext_File']->is_chmodable($abs_item); $items['items'][$i]['is_readable'] = $is_readable = @$GLOBALS['ext_File']->is_readable($abs_item); $items['items'][$i]['is_deletable'] = $is_deletable = @$GLOBALS['ext_File']->is_deletable($abs_item); $items['items'][$i]['is_editable'] = get_is_editable($abs_item); $items['items'][$i]['icon'] = _EXT_URL."/images/".get_mime_type($abs_item, "img"); $items['items'][$i]['size'] = parse_file_size(get_file_size($abs_item)); // type $items['items'][$i]['type'] = get_mime_type($abs_item, "type"); // modified $items['items'][$i]['modified'] = parse_file_date(get_file_date($abs_item)); // permissions $perms = get_file_perms($abs_item); if ($perms) { if (strlen($perms)>3) { $perms = substr($perms, 2); } $items['items'][$i]['perms'] = $perms. ' (' . parse_file_perms($perms) . ')'; } else { $items['items'][$i]['perms'] = ' (unknown) '; } $items['items'][$i]['perms'] = $perms. ' (' . parse_file_perms($perms) . ')'; if (extension_loaded("posix")) { if ($file_info["uid"]) { $user_info = posix_getpwuid($file_info["uid"]); //$group_info = posix_getgrgid($file_info["gid"]); $items['items'][$i]['owner'] = $user_info["name"]. " (".$file_info["uid"].")"; } else { $items['items'][$i]['owner'] = " (unknown) "; } } else { $items['items'][$i]['owner'] = 'n/a'; } if ($is_dir && $sendWhat != 'files') { $id = str_replace('/', $GLOBALS['separator'], $dir). $GLOBALS['separator'].$item; $id = str_replace($GLOBALS['separator'], '_RRR_', $id); $qtip = "<strong>".ext_Lang::mime('dir',true)."</strong><br /><strong>".ext_Lang::msg('miscperms',true).":</strong> ".$perms."<br />"; $qtip .= '<strong>'.ext_Lang::msg('miscowner',true).':</strong> '.$items['items'][$i]['owner']; if ($GLOBALS['use_mb']) { if (ext_isFTPMode()) { $dirlist[] = array('text' => htmlspecialchars($item), 'id' => $id, 'qtip' => $qtip, 'is_writable' => $is_writable, 'is_chmodable' => $is_chmodable, 'is_readable' => $is_readable, 'is_deletable' => $is_deletable, 'cls' => 'folder'); } else if (mb_detect_encoding($item) == 'ASCII') { $dirlist[] = array('text' => htmlspecialchars(ext_TextEncoding::toUTF8($item)), 'id' => utf8_encode($id), 'qtip' => $qtip, 'is_writable' => $is_writable, 'is_chmodable' => $is_chmodable, 'is_readable' => $is_readable, 'is_deletable' => $is_deletable, 'cls' => 'folder'); } else { $dirlist[] = array('text' => htmlspecialchars($item), 'id' => $id, 'qtip' => $qtip, 'is_writable' => $is_writable, 'is_chmodable' => $is_chmodable, 'is_readable' => $is_readable, 'is_deletable' => $is_deletable, 'cls' => 'folder'); } } else { $dirlist[] = array('text' => htmlspecialchars(ext_isFTPMode() ? $item : ext_TextEncoding::toUTF8($item)), 'id' => ext_isFTPMode() ? $id : ext_TextEncoding::toUTF8($id), 'qtip' => $qtip, 'is_writable' => $is_writable, 'is_chmodable' => $is_chmodable, 'is_readable' => $is_readable, 'is_deletable' => $is_deletable, 'cls' => 'folder'); } } if (!$is_dir && $sendWhat == 'files' || $sendWhat == 'both') { $i++; } } while(@ob_end_clean()); if ($sendWhat == 'dirs') { $result = $dirlist; } else { $result = $items; } $classname = class_exists('ext_Json') ? 'ext_Json' : 'Services_JSON'; $json = new $classname(); echo $json->encode($result); ext_exit(); } class ext_List extends ext_Action { function execAction($dir) { // list directory contents global $dir_up, $mosConfig_live_site, $_VERSION; $allow = ($GLOBALS["permissions"]&01) == 01; $admin = ((($GLOBALS["permissions"]&04) == 04) || (($GLOBALS["permissions"]&02) == 02)); $dir_up = dirname($dir); if ($dir_up == ".") $dir_up = ""; if (!get_show_item($dir_up,basename($dir))) { ext_Result::sendResult('list', false, $dir." : ".$GLOBALS["error_msg"]["accessdir"]); } // Sorting of items if ($GLOBALS["direction"] == "ASC") { $_srt = "no"; } else { $_srt = "yes"; } show_header(); extHTML::loadExtJS(); ?> <div id="dirtree-panel"></div> <div id="locationbar-panel"></div> <div id="item-grid"></div> <div id="ext_statusbar" class="ext_statusbar"></div> <?php // That's the main javascript file to build the Layout & App Logic include(_EXT_PATH.'/scripts/application.js.php'); } }
MBWE-Extras/Sources
extplorer_1_0/1_tgzContent/Pack/include/list.php
PHP
gpl-3.0
12,248
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2016-2022, Regents of the University of California, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University. * * This file is part of ndn-tools (Named Data Networking Essential Tools). * See AUTHORS.md for complete list of ndn-tools authors and contributors. * * ndn-tools is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Foundation, * either version 3 of the License, or (at your option) any later version. * * ndn-tools 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 * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. * * See AUTHORS.md for complete list of ndn-cxx authors and contributors. * * @author Shuo Yang * @author Weiwei Liu * @author Chavoosh Ghasemi * @author Klaus Schneider */ #include "pipeline-interests-aimd.hpp" #include <cmath> namespace ndn::chunks { PipelineInterestsAimd::PipelineInterestsAimd(Face& face, RttEstimatorWithStats& rttEstimator, const Options& opts) : PipelineInterestsAdaptive(face, rttEstimator, opts) { if (m_options.isVerbose) { printOptions(); } } void PipelineInterestsAimd::increaseWindow() { if (m_cwnd < m_ssthresh) { m_cwnd += m_options.aiStep; // additive increase } else { m_cwnd += m_options.aiStep / std::floor(m_cwnd); // congestion avoidance } emitSignal(afterCwndChange, time::steady_clock::now() - getStartTime(), m_cwnd); } void PipelineInterestsAimd::decreaseWindow() { // please refer to RFC 5681, Section 3.1 for the rationale behind it m_ssthresh = std::max(MIN_SSTHRESH, m_cwnd * m_options.mdCoef); // multiplicative decrease m_cwnd = m_options.resetCwndToInit ? m_options.initCwnd : m_ssthresh; emitSignal(afterCwndChange, time::steady_clock::now() - getStartTime(), m_cwnd); } } // namespace ndn::chunks
named-data/ndn-tools
tools/chunks/catchunks/pipeline-interests-aimd.cpp
C++
gpl-3.0
2,334
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Biruni.Shared; namespace Biruni.Reports { public partial class frmReportCriteria2 : Biruni.Shared.Templates.frmEntry1 { public frmReportCriteria2() { InitializeComponent(); dsCore1.EnforceConstraints = false; daItems.Connection = AppHelper.GetDbConnection(); daItems.Fill(dsCore1.Items); } public int SelectedID { get { return (int)c1Combo1.SelectedValue; } } private void btnSave_Click(object sender, EventArgs e) { Close(); } } }
hidayat365/Inventory.NET
Biruni.Reports/frmReportCriteria2.cs
C#
gpl-3.0
765
#JumpToTop { position: fixed; bottom: 14px; }
hgtonight/Vanilla-Plugins
JumpToTop/design/jumptotop.css
CSS
gpl-3.0
47
Bitrix 16.5 Business Demo = 2a4be83c0d92f19cfe8a1ae9a1775bff
gohdan/DFC
known_files/hashes/bitrix/modules/blog/install/components/bitrix/blog/templates/.default/post_edit.php
PHP
gpl-3.0
61
/* * Process Hacker - * provider base class * * Copyright (C) 2008-2009 wj32 * * This file is part of Process Hacker. * * Process Hacker is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Process Hacker 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 Process Hacker. If not, see <http://www.gnu.org/licenses/>. */ using System; using System.Collections.Generic; using ProcessHacker.Common; using ProcessHacker.Common.Objects; namespace ProcessHacker { /// <summary> /// Provides services for continuously updating data. /// </summary> public abstract class Provider<TKey, TValue> : BaseObject, IProvider { /// <summary> /// A generic delegate which is used when updating the dictionary. /// </summary> public delegate void ProviderUpdateOnce(); /// <summary> /// Represents a handler called when a dictionary item is added. /// </summary> /// <param name="item">The added item.</param> public delegate void ProviderDictionaryAdded(TValue item); /// <summary> /// Represents a handler called when a dictionary item is modified. /// </summary> /// <param name="oldItem">The old item.</param> /// <param name="newItem">The new item.</param> public delegate void ProviderDictionaryModified(TValue oldItem, TValue newItem); /// <summary> /// Represents a handler called when a dictionary item is removed. /// </summary> /// <param name="item">The removed item.</param> public delegate void ProviderDictionaryRemoved(TValue item); /// <summary> /// Represents a handler called when an error occurs while updating. /// </summary> /// <param name="ex">The raised exception.</param> public delegate void ProviderError(Exception ex); public new event Action<IProvider> Disposed; public event ProviderUpdateOnce BeforeUpdate; /// <summary> /// Occurs when the provider has been updated. /// </summary> public event ProviderUpdateOnce Updated; /// <summary> /// Occurs when the provider adds an item to the dictionary. /// </summary> public event ProviderDictionaryAdded DictionaryAdded; /// <summary> /// Occurs when the provider modifies an item in the dictionary. /// </summary> public event ProviderDictionaryModified DictionaryModified; /// <summary> /// Occurs when the provider removes an item from the dictionary. /// </summary> public event ProviderDictionaryRemoved DictionaryRemoved; /// <summary> /// Occurs when an exception is raised while updating. /// </summary> public event ProviderError Error; private string _name = string.Empty; private IDictionary<TKey, TValue> _dictionary; private bool _disposing; private bool _boosting; private bool _busy; private bool _enabled; private readonly LinkedListEntry<IProvider> _listEntry; private ProviderThread _owner; private int _runCount; private bool _unregistering; /// <summary> /// Creates a new instance of the Provider class. /// </summary> protected Provider() : this(new Dictionary<TKey, TValue>()) { } /// <summary> /// Creates a new instance of the Provider class, specifying a /// custom equality comparer. /// </summary> protected Provider(IEqualityComparer<TKey> comparer) : this(new Dictionary<TKey, TValue>(comparer)) { } /// <summary> /// Creates a new instance of the Provider class, specifying a /// custom <seealso cref="System.Collections.Generic.IDictionary&lt;TKey, TValue&gt;"/> instance. /// </summary> protected Provider(IDictionary<TKey, TValue> dictionary) { if (dictionary == null) throw new ArgumentNullException("dictionary"); _dictionary = dictionary; _listEntry = new LinkedListEntry<IProvider> { Value = this }; } protected override void DisposeObject(bool disposing) { _disposing = true; if (this.Disposed != null) { try { this.Disposed(this); } catch (Exception ex) { Logging.Log(ex); } } } public string Name { get { return _name; } protected set { _name = value; if (_name == null) _name = string.Empty; } } public bool Boosting { get { return _boosting; } set { _boosting = value; } } /// <summary> /// Determines whether the provider is currently updating. /// </summary> public bool Busy { get { return _busy; } } /// <summary> /// Gets whether the provider is shutting down. /// </summary> protected bool Disposing { get { return _disposing; } } /// <summary> /// Determines whether the provider should update. /// </summary> public bool Enabled { get { return _enabled; } set { _enabled = value; } } public LinkedListEntry<IProvider> ListEntry { get { return _listEntry; } } public ProviderThread Owner { get { return _owner; } set { _owner = value; } } /// <summary> /// Gets the number of times this provider has updated. /// </summary> public int RunCount { get { return _runCount; } } public bool Unregistering { get { return _unregistering; } set { _unregistering = value; } } /// <summary> /// Gets the dictionary. /// </summary> public IDictionary<TKey, TValue> Dictionary { get { return _dictionary; } protected set { _dictionary = value; } } /// <summary> /// Causes the provider to run immediately. /// </summary> public void Boost() { _owner.Boost(this); } /// <summary> /// Updates the provider. Do not call this function. /// </summary> public void Run() { // Bail out if we are disposing if (_disposing) { Logging.Log(Logging.Importance.Warning, "Provider (" + _name + "): RunOnce: currently disposing"); return; } _busy = true; { try { if (BeforeUpdate != null) BeforeUpdate(); } catch { } try { this.Update(); _runCount++; } catch (Exception ex) { if (Error != null) { try { Error(ex); } catch { } } else { Logging.Log(Logging.Importance.Error, ex.ToString()); } } try { if (Updated != null) Updated(); } catch { } } _busy = false; } protected void OnDictionaryAdded(TValue item) { if (this.DictionaryAdded != null) this.DictionaryAdded(item); } protected void OnDictionaryModified(TValue oldItem, TValue newItem) { if (this.DictionaryModified != null) this.DictionaryModified(oldItem, newItem); } protected void OnDictionaryRemoved(TValue item) { if (this.DictionaryRemoved != null) this.DictionaryRemoved(item); } protected virtual void Update() { } } }
zippy1981/ProcessHacker-v1x
ProcessHacker/Providers/Provider.cs
C#
gpl-3.0
9,511
package pl.mrugames.commons.router.request_handlers; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.core.AuthenticationException; import org.springframework.stereotype.Service; import pl.mrugames.commons.router.Response; import pl.mrugames.commons.router.ResponseStatus; import pl.mrugames.commons.router.RouteExceptionWrapper; import pl.mrugames.commons.router.RouterProperties; import pl.mrugames.commons.router.exceptions.ApplicationException; import pl.mrugames.commons.router.exceptions.IncompatibleParameterException; import pl.mrugames.commons.router.exceptions.ParameterNotFoundException; import pl.mrugames.commons.router.exceptions.RouteConstraintViolationException; import pl.mrugames.commons.router.sessions.SessionDoesNotExistException; import pl.mrugames.commons.router.sessions.SessionExpiredException; import pl.mrugames.social.i18n.I18nObjectTranslator; import pl.mrugames.social.i18n.Translatable; import javax.annotation.PostConstruct; import javax.validation.constraints.NotNull; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.function.Function; @Service public class ExceptionHandler { private class Handler<T extends Throwable> { final Class<T> supportedType; final Function<T, Response> handler; Handler(Class<T> supportedType, Function<T, Response> handler) { this.supportedType = supportedType; this.handler = handler; } } private final Logger logger = LoggerFactory.getLogger(getClass()); private final List<Handler<Throwable>> handlers; private final I18nObjectTranslator objectTranslator; private final boolean sendStackTraces; ExceptionHandler(I18nObjectTranslator objectTranslator, @Value("${" + RouterProperties.SEND_STACK_TRACES + "}") boolean sendStackTraces) { this.objectTranslator = objectTranslator; handlers = new CopyOnWriteArrayList<>(); this.sendStackTraces = sendStackTraces; } @PostConstruct void init() { registerHandler(ParameterNotFoundException.class, e -> new Response(-1, ResponseStatus.BAD_REQUEST, e.getMessage())); registerHandler(IllegalArgumentException.class, e -> new Response(-1, ResponseStatus.BAD_REQUEST, e.getMessage())); registerHandler(IncompatibleParameterException.class, e -> new Response(-1, ResponseStatus.BAD_REQUEST, e.getMessage())); registerHandler(RouteConstraintViolationException.class, e -> new Response(-1, ResponseStatus.BAD_PARAMETERS, e.getMessages())); registerHandler(SessionExpiredException.class, e -> new Response(-1, ResponseStatus.BAD_REQUEST, "Session expired")); registerHandler(SessionDoesNotExistException.class, e -> new Response(-1, ResponseStatus.BAD_REQUEST, "Session does not exist")); registerHandler(ApplicationException.class, e -> new Response(-1, e.getResponseStatus(), e.getMessage())); registerHandler(AuthenticationException.class, e -> new Response(-1, ResponseStatus.PERMISSION_DENIED, e.getMessage())); registerHandler(AccessDeniedException.class, e -> new Response(-1, ResponseStatus.PERMISSION_DENIED, e.getMessage())); } Response handle(long requestId, Throwable e) { if (e instanceof RouteExceptionWrapper) { e = e.getCause(); } Handler<Throwable> mostSpecific = null; for (Handler<Throwable> handler : handlers) { if (!handler.supportedType.isAssignableFrom(e.getClass())) { continue; } if (mostSpecific == null || mostSpecific.supportedType.isAssignableFrom(handler.supportedType)) { mostSpecific = handler; } } if (mostSpecific != null) { Response sample = mostSpecific.handler.apply(e); Object payload = sample.getPayload(); if (payload instanceof String) { payload = objectTranslator.translateString((String) payload); } else if (payload instanceof Translatable) { try { objectTranslator.translate(payload); } catch (IllegalAccessException e1) { logger.error("Failed to translate object", e1); if (sendStackTraces) { return new Response(requestId, ResponseStatus.INTERNAL_ERROR, String.format("Error: %s, %s", e1.getMessage(), ErrorUtil.exceptionStackTraceToString(e1))); } else { return new Response(requestId, ResponseStatus.INTERNAL_ERROR, String.format("Error: %s", e1.getMessage())); } } } return new Response(requestId, sample.getStatus(), payload); } logger.error("Internal error while processing the request", e); if (sendStackTraces) { return new Response(requestId, ResponseStatus.INTERNAL_ERROR, String.format("Error: %s, %s", e.getMessage(), ErrorUtil.exceptionStackTraceToString(e))); } else { return new Response(requestId, ResponseStatus.INTERNAL_ERROR, String.format("Error: %s", e.getMessage())); } } /** * @param handler - handler which translates the exception to response. Response id will be rewritten thus * it doesn't matter. * example: * exceptionHandler.registerHandler(RuntimeException.class, * e -> new Response(-1, ResponseStatus.BAD_PARAMETERS, customPayload)); */ @SuppressWarnings("unchecked") public <T extends Throwable> void registerHandler(@NotNull Class<T> supportedType, Function<T, Response> handler) { if (supportedType == null) { throw new IllegalArgumentException("Supported type may not be null"); } for (Handler existing : handlers) { if (supportedType.equals(existing.supportedType)) { throw new IllegalArgumentException("Handler of type '" + existing.supportedType.getSimpleName() + "' is already registered"); } } handlers.add(new Handler(supportedType, handler)); } }
Mariusz-v7/RequestsRouter
src/main/java/pl/mrugames/commons/router/request_handlers/ExceptionHandler.java
Java
gpl-3.0
6,352
package main import ( "bytes" "fmt" "os/exec" "github.com/mgutz/ansi" "github.com/stevedomin/termtable" "strings" ) func fmtString(color, str, reset string) string { return fmt.Sprintf("%s%s%s", color, str, reset) } func main() { services := []string{ "cronie.service", "httpd.service", "mysqld.service", "ntpd.service", "postfix.service", "sshd.service", "home.mount", "mnt-extra.mount", "tmp.mount", "var-lib-mysqltmp.mount", "var.mount", } t := termtable.NewTable(nil, nil) t.SetHeader([]string{"SERVICE", "STATUS"}) for _, service := range services { // The systemctl command. syscommand := exec.Command("systemctl", "status", service) // The grep command. grepcommand := exec.Command("grep", "Active:") // Pipe the stdout of syscommand to the stdin of grepcommand. grepcommand.Stdin, _ = syscommand.StdoutPipe() // Create a buffer of bytes. var b bytes.Buffer // Assign the address of our buffer to grepcommand.Stdout. grepcommand.Stdout = &b // Start grepcommand. _ = grepcommand.Start() // Run syscommand _ = syscommand.Run() // Wait for grepcommand to exit. _ = grepcommand.Wait() s := fmt.Sprintf("%s", &b) if strings.Contains(s, "active (running)") || strings.Contains(s, "active (mounted)") { color := ansi.ColorCode("green+h:black") reset := ansi.ColorCode("reset") t.AddRow([]string{fmtString(color, service, reset), fmtString(color, s, reset)}) } else { color := ansi.ColorCode("red+h:black") reset := ansi.ColorCode("reset") t.AddRow([]string{fmtString(color, service, reset), fmtString(color, s, reset)}) } } fmt.Println(t.Render()) }
prinsmike/archstatus
archstatus.go
GO
gpl-3.0
1,658
using System; using BaldurSuchtFiona.Models; namespace BaldurSuchtFiona { public class Healpot : Item { public int HealthRestoration { get;set;} public Healpot () { HealthRestoration = 10; } public override void OnCollect(World world){ } } }
icekuhn/Baldur-Sucht-Fiona
BaldurSuchtFiona/Models/Healpot.cs
C#
gpl-3.0
298
// melement.cpp --- // Author: Subhasis Ray // Created: Mon Jul 22 16:50:41 2013 (+0530) #include <Python.h> #include <structmember.h> #include <iostream> #include <typeinfo> #include <cstring> #include <map> #include <ctime> #ifdef USE_MPI #include <mpi.h> #endif #include "../basecode/header.h" #include "../basecode/Id.h" #include "../basecode/ObjId.h" #include "../shell/Shell.h" #include "../utility/utility.h" #include "../utility/strutil.h" #include "../utility/print_function.hpp" #include "moosemodule.h" using namespace std; extern PyTypeObject ObjIdType; extern PyTypeObject IdType; extern int PyType_IsSubtype(PyTypeObject *, PyTypeObject *); PyObject *get_ObjId_attr(_ObjId *oid, string attribute) { if (attribute == "vec") { return moose_ObjId_getId(oid); } else if (attribute == "dindex") { return moose_ObjId_getDataIndex(oid); } else if (attribute == "findex") { return moose_ObjId_getFieldIndex(oid); } return NULL; } int moose_ObjId_init_from_id(_ObjId *self, PyObject *args, PyObject *kwargs) { extern PyTypeObject ObjIdType; static const char *const kwlist[] = {"id", "dataIndex", "fieldIndex", NULL}; unsigned int id = 0, data = 0, field = 0; PyObject *obj = NULL; if (PyArg_ParseTupleAndKeywords( args, kwargs, "I|II:moose_ObjId_init_from_id", (char **)kwlist, &id, &data, &field)) { PyErr_Clear(); if (!Id::isValid(id)) { RAISE_INVALID_ID(-1, "moose_ObjId_init_from_id"); } self->oid_ = ObjId(Id(id), data, field); if (self->oid_.bad()) { PyErr_SetString(PyExc_ValueError, "Invalid ObjId"); return -1; } return 0; } PyErr_Clear(); if (PyArg_ParseTupleAndKeywords( args, kwargs, "O|II:moose_ObjId_init_from_id", (char **)kwlist, &obj, &data, &field)) { PyErr_Clear(); // If first argument is an Id object, construct an ObjId out of it if (Id_Check(obj)) { if (!Id::isValid(((_Id *)obj)->id_)) { RAISE_INVALID_ID(-1, "moose_ObjId_init_from_id"); } self->oid_ = ObjId(((_Id *)obj)->id_, data, field); if (self->oid_.bad()) { PyErr_SetString(PyExc_ValueError, "Invalid dataIndex/fieldIndex."); return -1; } return 0; } else if (PyObject_IsInstance(obj, (PyObject *)&ObjIdType)) { if (!Id::isValid(((_ObjId *)obj)->oid_.id)) { RAISE_INVALID_ID(-1, "moose_ObjId_init_from_id"); } self->oid_ = ((_ObjId *)obj)->oid_; if (self->oid_.bad()) { PyErr_SetString(PyExc_ValueError, "Invalid ObjId"); return -1; } return 0; } } return -1; } int moose_ObjId_init_from_path(_ObjId *self, PyObject *args, PyObject *kwargs) { static const char *const kwlist[] = {"path", "n", "g", "dtype", NULL}; const char *parsedPath; unsigned int numData = 1; unsigned int isGlobal = 0; char *type = NULL; self->oid_ = ObjId(0, BADINDEX); PyTypeObject *mytype = Py_TYPE(self); string mytypename(mytype->tp_name); // First try to parse the arguments as (parsedPath, n, g, dtype) bool parse_success = false; if (PyArg_ParseTupleAndKeywords( args, kwargs, "s|IIs:moose_ObjId_init_from_path", (char **)kwlist, &parsedPath, &numData, &isGlobal, &type)) { parse_success = true; } // we need to clear the parse error so that the callee can try // other alternative: moose_ObjId_init_from_id PyErr_Clear(); if (!parse_success) { return -2; } string path(parsedPath); // Remove one or more instances of '/' by a single '/' e.g. //a -> /a, // /a//b -> /a/b etc. path = moose::fix(path); ostringstream err, warn; // First see if there is an existing object with at path self->oid_ = ObjId(path); PyTypeObject *basetype = getBaseClass((PyObject *)self); string basetype_str; if (type == NULL) { if (basetype == NULL) { PyErr_SetString( PyExc_TypeError, "Unknown class. Need a valid MOOSE class or subclass thereof."); return -1; } basetype_str = string(basetype->tp_name) .substr(6); // remove `moose.` prefix from type name } else { basetype_str = string(type); } // If oid_ is bad, it can be either a nonexistent path or the root. if (self->oid_.bad()) { // is this the root element? if ((path == "/") || (path == "/root")) { if ((basetype == NULL) || PyType_IsSubtype(mytype, basetype)) { return 0; } err << "cannot convert moose." << Field<string>::get(self->oid_, "className") << " to " << mytypename << "To get the existing object use " "`moose.element(obj)` instead."; PyErr_SetString(PyExc_TypeError, err.str().c_str()); return -1; } // no - so we need to create a new element } else // this is a non-root existing element { // If the current class is a subclass of some predefined // moose class, do nothing. string className = self->oid_.element()->cinfo()->name(); map<string, PyTypeObject *>::iterator ii = get_moose_classes().find(className); PyTypeObject *basetype = 0; if (ii != get_moose_classes().end()) { basetype = ii->second; // remove `moose.` prefix from type name basetype_str = string(basetype->tp_name).substr(6); } else { err << "Unknown class: " << className << endl; basetype = getBaseClass((PyObject *)self); } // NOTE: Existing paths are handled in Shell::doCreate function. if ((basetype != NULL) && PyType_IsSubtype(mytype, basetype)) { // Fine. This path already exits. err << "Accessing existing paths using object constrcutors has " "been deprecated. Use " << " moose.element to access existing object. In future " << " this will be an error." << endl; PyErr_WarnEx(PyExc_DeprecationWarning, err.str().c_str(), 1); return 0; } // element exists at this path, but it does not inherit from any moose // class. // throw an error err << "cannot convert moose." << className << " to " << mytypename << ". To get the existing object use `moose.element(obj)` instead."; PyErr_SetString(PyExc_TypeError, err.str().c_str()); return -1; } // try to create new vec Id new_id = create_Id_from_path(path, numData, isGlobal, basetype_str); // vec failed. throw error if (new_id == Id() && PyErr_Occurred()) { return -1; } self->oid_ = ObjId(new_id); return 0; } int moose_ObjId_init(_ObjId *self, PyObject *args, PyObject *kwargs) { if (self && !PyObject_IsInstance((PyObject *)self, (PyObject *)Py_TYPE((PyObject *)self))) { ostringstream error; error << "Expected an melement or subclass. Found " << Py_TYPE(self)->tp_name; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return -1; } int ret = moose_ObjId_init_from_path(self, args, kwargs); if (ret >= -1) { return ret; } // parsing arguments as (path, dims, classname) failed. See if it is // existing Id or ObjId. if (moose_ObjId_init_from_id(self, args, kwargs) == 0) { return 0; } PyErr_SetString(PyExc_ValueError, "Could not parse arguments. " " Call __init__(path, n, g, dtype) or" " __init__(id, dataIndex, fieldIndex)"); return -1; } /** This function combines Id, DataId and fieldIndex to construct the hash of this object. Here we assume 16 most significant bits for Id, next 32 bits for dataIndex and the least significant 16 bits for fieldIndex. If these criteria are not met, the hash function will cause collissions. Note that the bitshift opeartions are byte order independent - so they should give the same result on both little- and big-endian systems. */ long moose_ObjId_hash(_ObjId *self) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(-1, "moose_ObjId_hash"); } long long id = (long long)(self->oid_.id.value()); long dataIndex = self->oid_.dataIndex; long fieldIndex = self->oid_.fieldIndex; /* attempt to make it with 32 bit system - assuming id will * have its value within least significant 16 bits and * dataIndex and fieldIndex will be limited to first 8 bits */ if (sizeof(size_t) == 8) { return id << 48 | dataIndex << 16 | fieldIndex; } else { return id << 16 | dataIndex << 8 | fieldIndex; } } PyObject *moose_ObjId_repr(_ObjId *self) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_repr"); } ostringstream repr; repr << "<moose." << Field<string>::get(self->oid_, "className") << ": " << "id=" << self->oid_.id.value() << ", " << "dataIndex=" << self->oid_.dataIndex << ", " << "path=" << self->oid_.path() << ">"; return PyString_FromString(repr.str().c_str()); } // ! moose_ObjId_repr PyObject *moose_ObjId_str(_ObjId *self) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_str"); } ostringstream repr; repr << "<moose." << Field<string>::get(self->oid_, "className") << ": " << "id=" << self->oid_.id.value() << ", " << "dataIndex=" << self->oid_.dataIndex << ", " << "path=" << self->oid_.path() << ">"; return PyString_FromString(repr.str().c_str()); } // ! moose_ObjId_str PyDoc_STRVAR( moose_ObjId_getId_documentation, "getId() -> vec\n" "\n" "Returns the information of the object's classtype, Id, and path \n" "in form of a vector.\n" "\nExample\n" "-------\n" " >>> com = moose.Compartment('/com')\n" " >>> com.getId()\n" " moose.vec: class=Compartment, id=481, path=/com>" "\n"); PyObject *moose_ObjId_getId(_ObjId *self) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_getId"); } extern PyTypeObject IdType; _Id *ret = PyObject_New(_Id, &IdType); ret->id_ = self->oid_.id; return (PyObject *)ret; } PyDoc_STRVAR(moose_ObjId_getFieldType_documentation, "getFieldType(fieldname)\n" "\n" "Returns the type of the field `fieldname` (as a string).\n" "\n" "Parameters\n" "----------\n" "fieldname : string\n" " Name of the field to be queried.\n" "\n" " >>> comp.getFieldType('neighbors')\n" " >>> 'string,vector<Id>' \n" "\n"); PyObject *moose_ObjId_getFieldType(_ObjId *self, PyObject *args) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_getFieldType"); } char *fieldName = NULL; if (!PyArg_ParseTuple(args, "s:moose_ObjId_getFieldType", &fieldName)) { return NULL; } string typeStr = getFieldType(Field<string>::get(self->oid_, "className"), string(fieldName)); if (typeStr.length() <= 0) { PyErr_SetString(PyExc_ValueError, "Empty string for field type. " "Field name may be incorrect."); return NULL; } PyObject *type = PyString_FromString(typeStr.c_str()); return type; } // ! moose_Id_getFieldType /** Wrapper over getattro to allow direct access as a function with variable argument list */ PyDoc_STRVAR(moose_ObjId_getField_documentation, "getField(fieldname)\n" "\n" "Returns the value of the field `fieldname`.\n" "\n" "Parameters\n" "----------\n" "fieldname : string\n" " Name of the field.\n" "\n" " >>> comp.getField('x0')\n" " >>> 0.0 \n"); PyObject *moose_ObjId_getField(_ObjId *self, PyObject *args) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_getField"); } PyObject *attr; if (!PyArg_ParseTuple(args, "O:moose_ObjId_getField", &attr)) { return NULL; } return moose_ObjId_getattro(self, attr); } /** */ PyObject *moose_ObjId_getattro(_ObjId *self, PyObject *attr) { int new_attr = 0; if (self->oid_.bad()) { RAISE_INVALID_ID(NULL, "moose_ObjId_getattro"); } const char *field; char ftype; if (PyString_Check(attr)) { field = PyString_AsString(attr); } else { return PyObject_GenericGetAttr((PyObject *)self, attr); } PyObject *_ret = get_ObjId_attr(self, field); if (_ret != NULL) { return _ret; } string fieldName(field); string className = Field<string>::get(self->oid_, "className"); vector<string> valueFinfos = getFieldNames(className, "valueFinfo"); bool isValueField = false; for (unsigned int ii = 0; ii < valueFinfos.size(); ++ii) { if (fieldName == valueFinfos[ii]) { isValueField = true; break; } } string type = getFieldType(className, fieldName); if (type.empty() || !isValueField) { // Check if this field name is aliased and update fieldName and type if // so. map<string, string>::const_iterator it = get_field_alias().find(fieldName); if (it != get_field_alias().end()) { fieldName = it->second; field = fieldName.c_str(); isValueField = false; for (unsigned int ii = 0; ii < valueFinfos.size(); ++ii) { if (fieldName == valueFinfos[ii]) { isValueField = true; break; } } type = getFieldType(Field<string>::get(self->oid_, "className"), fieldName); attr = PyString_FromString(field); new_attr = 1; } } if (type.empty() || !isValueField) { _ret = PyObject_GenericGetAttr((PyObject *)self, attr); if (new_attr) { Py_DECREF(attr); } return _ret; } ftype = shortType(type); if (!ftype) { _ret = PyObject_GenericGetAttr((PyObject *)self, attr); if (new_attr) { Py_DECREF(attr); } return _ret; } fieldName = string(field); switch (ftype) { case 's': { string _s = Field<string>::get(self->oid_, fieldName); _ret = Py_BuildValue("s", _s.c_str()); break; } case 'd': { double value = Field<double>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'i': { int value = Field<int>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'I': { unsigned int value = Field<unsigned int>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'l': { long value = Field<long>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'L': { long long value = Field<long long>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'k': { unsigned long value = Field<unsigned long>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'K': { unsigned long long value = Field<unsigned long long>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'f': { float value = Field<float>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'x': { Id value = Field<Id>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'y': { ObjId value = Field<ObjId>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'z': { PyErr_SetString(PyExc_NotImplementedError, "DataId handling not implemented yet."); _ret = NULL; break; } case 'D': { vector<double> value = Field<vector<double>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'X': // vector<Id> { vector<Id> value = Field<vector<Id>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'Y': // vector<ObjId> { vector<ObjId> value = Field<vector<ObjId>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'M': { vector<long> value = Field<vector<long>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'P': { vector<unsigned long> value = Field<vector<unsigned long>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'S': { vector<string> value = Field<vector<string>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'v': { vector<int> value = Field<vector<int>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'N': { vector<unsigned int> value = Field<vector<unsigned int>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'T': // vector<vector < unsigned int >> { vector<vector<unsigned int>> value = Field<vector<vector<unsigned int>>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'Q': // vector< vector < int > > { vector<vector<int>> value = Field<vector<vector<int>>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'R': // vector< vector < double > > { vector<vector<double>> value = Field<vector<vector<double>>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'F': { vector<float> value = Field<vector<float>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'c': { char value = Field<char>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'h': { short value = Field<short>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'H': { unsigned short value = Field<unsigned short>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'w': { vector<short> value = Field<vector<short>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'C': { vector<char> value = Field<vector<char>>::get(self->oid_, fieldName); _ret = to_py(&value, ftype); break; } case 'b': { bool value = Field<bool>::get(self->oid_, fieldName); if (value) { _ret = Py_True; Py_INCREF(Py_True); } else { _ret = Py_False; Py_INCREF(Py_False); } break; } default: _ret = PyObject_GenericGetAttr((PyObject *)self, attr); } if (new_attr) { Py_DECREF(attr); } return _ret; } /** Wrapper over setattro to make METHOD_VARARG */ PyDoc_STRVAR(moose_ObjId_setField_documentation, "setField(fieldname, value)\n" "\n" "Set the value of specified field.\n" "\n" "Parameters\n" "----------\n" "fieldname : string\n" " Field to be assigned value to.\n" "\n" "value : python datatype compatible with the type of the field\n" " The value to be assigned to the field." "\n" "\n" " >>> comp.setField('x0', 45.25) \n" " >>> print comp.x0\n" " 45.25\n"); PyObject *moose_ObjId_setField(_ObjId *self, PyObject *args) { PyObject *field; PyObject *value; if (!PyArg_ParseTuple(args, "OO:moose_ObjId_setField", &field, &value)) { return NULL; } if (moose_ObjId_setattro(self, field, value) == -1) { return NULL; } Py_RETURN_NONE; } /** Set a specified field. Redone on 2011-03-23 14:41:45 (+0530) */ int moose_ObjId_setattro(_ObjId *self, PyObject *attr, PyObject *value) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(-1, "moose_ObjId_setattro"); } const char *field; if (PyString_Check(attr)) { field = PyString_AsString(attr); } else { PyErr_SetString(PyExc_TypeError, "Attribute name must be a string"); return -1; } string fieldtype = getFieldType(Field<string>::get(self->oid_, "className"), string(field)); if (fieldtype.length() == 0) { // If it is instance of a MOOSE built-in class then throw // error (to avoid silently creating new attributes due to // typos). Otherwise, it must have been subclassed in // Python. Then we allow normal Pythonic behaviour and // consider such mistakes user's responsibility. string className = ((PyTypeObject *)PyObject_Type((PyObject *)self))->tp_name; if (get_moose_classes().find(className) == get_moose_classes().end()) { return PyObject_GenericSetAttr( (PyObject *)self, PyString_FromString(field), value); } ostringstream msg; msg << "'" << className << "' class has no field '" << field << "'" << endl; PyErr_SetString(PyExc_AttributeError, msg.str().c_str()); return -1; } char ftype = shortType(fieldtype); int ret = 0; switch (ftype) { case 'd': { double _value = PyFloat_AsDouble(value); ret = Field<double>::set(self->oid_, string(field), _value); break; } case 'l': { long _value = PyInt_AsLong(value); if ((_value != -1) || (!PyErr_Occurred())) { ret = Field<long>::set(self->oid_, string(field), _value); } break; } case 'I': { unsigned long _value = PyInt_AsUnsignedLongMask(value); ret = Field<unsigned int>::set(self->oid_, string(field), (unsigned int)_value); break; } case 'k': { unsigned long _value = PyInt_AsUnsignedLongMask(value); ret = Field<unsigned long>::set(self->oid_, string(field), _value); break; } case 'f': { float _value = PyFloat_AsDouble(value); ret = Field<float>::set(self->oid_, string(field), _value); break; } case 's': { char *_value = PyString_AsString(value); if (_value) { ret = Field<string>::set(self->oid_, string(field), string(_value)); } break; } case 'x': // Id { if (value) { ret = Field<Id>::set(self->oid_, string(field), ((_Id *)value)->id_); } else { PyErr_SetString(PyExc_ValueError, "Null pointer passed as vec Id value."); return -1; } break; } case 'y': // ObjId { if (value) { ret = Field<ObjId>::set(self->oid_, string(field), ((_ObjId *)value)->oid_); } else { PyErr_SetString(PyExc_ValueError, "Null pointer passed as vec Id value."); return -1; } break; } case 'D': // SET_VECFIELD(double, d) { if (!PySequence_Check(value)) { PyErr_SetString(PyExc_TypeError, "For setting vector<double> field, specified " "value must be a sequence."); } else { Py_ssize_t length = PySequence_Length(value); vector<double> _value; for (int ii = 0; ii < length; ++ii) { PyObject *vo = PySequence_GetItem(value, ii); double v = PyFloat_AsDouble(vo); Py_XDECREF(vo); _value.push_back(v); } ret = Field<vector<double>>::set(self->oid_, string(field), _value); } break; } case 'b': { bool _value = (Py_True == value) || (PyInt_AsLong(value) != 0); ret = Field<bool>::set(self->oid_, string(field), _value); break; } case 'c': { char *_value = PyString_AsString(value); if (_value && _value[0]) { ret = Field<char>::set(self->oid_, string(field), _value[0]); } break; } case 'i': { int _value = PyInt_AsLong(value); if ((_value != -1) || (!PyErr_Occurred())) { ret = Field<int>::set(self->oid_, string(field), _value); } break; } case 'h': { short _value = (short)PyInt_AsLong(value); if ((_value != -1) || (!PyErr_Occurred())) { ret = Field<short>::set(self->oid_, string(field), _value); } break; } case 'z': // DataId { PyErr_SetString(PyExc_NotImplementedError, "DataId handling not implemented yet."); return -1; } case 'v': { if (!PySequence_Check(value)) { PyErr_SetString(PyExc_TypeError, "For setting vector<int> field, specified " "value must be a sequence."); } Py_ssize_t length = PySequence_Length(value); vector<int> _value; for (int ii = 0; ii < length; ++ii) { PyObject *vo = PySequence_GetItem(value, ii); int v = PyInt_AsLong(vo); Py_XDECREF(vo); _value.push_back(v); } ret = Field<vector<int>>::set(self->oid_, string(field), _value); break; } case 'w': { if (!PySequence_Check(value)) { PyErr_SetString(PyExc_TypeError, "For setting vector<short> field, specified " "value must be a sequence."); } else { Py_ssize_t length = PySequence_Length(value); vector<short> _value; for (int ii = 0; ii < length; ++ii) { PyObject *vo = PySequence_GetItem(value, ii); short v = PyInt_AsLong(vo); Py_XDECREF(vo); _value.push_back(v); } ret = Field<vector<short>>::set(self->oid_, string(field), _value); } break; } case 'L': // SET_VECFIELD(long, l) { if (!PySequence_Check(value)) { PyErr_SetString(PyExc_TypeError, "For setting vector<long> field, specified " "value must be a sequence."); } else { Py_ssize_t length = PySequence_Length(value); vector<long> _value; for (int ii = 0; ii < length; ++ii) { PyObject *vo = PySequence_GetItem(value, ii); long v = PyInt_AsLong(vo); Py_XDECREF(vo); _value.push_back(v); } ret = Field<vector<long>>::set(self->oid_, string(field), _value); } break; } case 'N': // SET_VECFIELD(unsigned int, I) { if (!PySequence_Check(value)) { PyErr_SetString(PyExc_TypeError, "For setting vector<unsigned int> field, " "specified value must be a sequence."); } else { Py_ssize_t length = PySequence_Length(value); vector<unsigned int> _value; for (int ii = 0; ii < length; ++ii) { PyObject *vo = PySequence_GetItem(value, ii); unsigned int v = PyInt_AsUnsignedLongMask(vo); Py_XDECREF(vo); _value.push_back(v); } ret = Field<vector<unsigned int>>::set(self->oid_, string(field), _value); } break; } case 'K': // SET_VECFIELD(unsigned long, k) { if (!PySequence_Check(value)) { PyErr_SetString(PyExc_TypeError, "For setting vector<unsigned long> field, " "specified value must be a sequence."); } else { Py_ssize_t length = PySequence_Length(value); vector<unsigned long> _value; for (int ii = 0; ii < length; ++ii) { PyObject *vo = PySequence_GetItem(value, ii); unsigned long v = PyInt_AsUnsignedLongMask(vo); Py_XDECREF(vo); _value.push_back(v); } ret = Field<vector<unsigned long>>::set(self->oid_, string(field), _value); } break; } case 'F': // SET_VECFIELD(float, f) { if (!PySequence_Check(value)) { PyErr_SetString(PyExc_TypeError, "For setting vector<float> field, specified " "value must be a sequence."); } else { Py_ssize_t length = PySequence_Length(value); vector<float> _value; for (int ii = 0; ii < length; ++ii) { PyObject *vo = PySequence_GetItem(value, ii); float v = PyFloat_AsDouble(vo); Py_XDECREF(vo); _value.push_back(v); } ret = Field<vector<float>>::set(self->oid_, string(field), _value); } break; } case 'S': { if (!PySequence_Check(value)) { PyErr_SetString(PyExc_TypeError, "For setting vector<string> field, specified " "value must be a sequence."); } else { Py_ssize_t length = PySequence_Length(value); vector<string> _value; for (int ii = 0; ii < length; ++ii) { PyObject *vo = PySequence_GetItem(value, ii); char *v = PyString_AsString(vo); Py_XDECREF(vo); _value.push_back(string(v)); } ret = Field<vector<string>>::set(self->oid_, string(field), _value); } break; } case 'T': // vector< vector<unsigned int> > { vector<vector<unsigned>> *_value = (vector<vector<unsigned>> *)to_cpp(value, ftype); if (!PyErr_Occurred()) { ret = Field<vector<vector<unsigned>>>::set(self->oid_, string(field), *_value); } delete _value; break; } case 'Q': // vector< vector<int> > { vector<vector<int>> *_value = (vector<vector<int>> *)to_cpp(value, ftype); if (!PyErr_Occurred()) { ret = Field<vector<vector<int>>>::set(self->oid_, string(field), *_value); } delete _value; break; } case 'R': // vector< vector<double> > { vector<vector<double>> *_value = (vector<vector<double>> *)to_cpp(value, ftype); if (!PyErr_Occurred()) { ret = Field<vector<vector<double>>>::set(self->oid_, string(field), *_value); } delete _value; break; } case 'X': // SET_VECFIELD(Id, f) { if (!PySequence_Check(value)) { PyErr_SetString(PyExc_TypeError, "For setting vector<Id> field, specified value " "must be a sequence."); } else { Py_ssize_t length = PySequence_Length(value); vector<Id> _value; for (int ii = 0; ii < length; ++ii) { PyObject *vo = PySequence_GetItem(value, ii); Id v = ((_Id *)vo)->id_; Py_XDECREF(vo); _value.push_back(v); } ret = Field<vector<Id>>::set(self->oid_, string(field), _value); } break; } case 'Y': // SET_VECFIELD(ObjId, f) { if (!PySequence_Check(value)) { PyErr_SetString(PyExc_TypeError, "For setting vector<ObjId> field, specified " "value must be a sequence."); } else { Py_ssize_t length = PySequence_Length(value); vector<ObjId> _value; for (int ii = 0; ii < length; ++ii) { PyObject *vo = PySequence_GetItem(value, ii); ObjId v = ((_ObjId *)vo)->oid_; Py_XDECREF(vo); _value.push_back(v); } ret = Field<vector<ObjId>>::set(self->oid_, string(field), _value); } break; } default: break; } // MOOSE Field::set returns 1 for success 0 for // failure. Python treats return value 0 from stters as // success, anything else failure. if (ret) { return 0; } else { ostringstream msg; msg << "Failed to set field '" << field << "'"; PyErr_SetString(PyExc_AttributeError, msg.str().c_str()); return -1; } } // moose_ObjId_setattro PyObject *moose_ObjId_getItem(_ObjId *self, Py_ssize_t index) { if (index < 0) { index += moose_ObjId_getLength(self); } if ((index < 0) || (index >= moose_ObjId_getLength(self))) { PyErr_SetString(PyExc_IndexError, "Index out of bounds."); return NULL; } // Here I am assuming the user can start with any ObjId and // ask for an index - which will be field index. // Thus if syn[0...9] correspond to chan[0...9], then syn[0] is still a // valid ObjId. // For example, syn has Id X, dataIndex 0...9, and under dataIndex=0, we // have 5 field elements f[0...5] // Then syn = Id(X) // syn[0] = ObjId(X, 0, 0) = syn[0][0] // assign s0 <- syn[0] // what is s0[1]? ObjId(X // syn[0][1]->ObjId(X, 0, 1) =syn[0][0][0] - which is an ObjId. // Now, what is syn[0][1][2] ? // In PyMOOSE, user is allowed to directly put in the numbers // for Id, dataIndex and fieldIndex directly and construct an // ObjId. _ObjId *ret = PyObject_New(_ObjId, &ObjIdType); ret->oid_ = ObjId(self->oid_.id, self->oid_.dataIndex, index); return (PyObject *)ret; } PyObject *moose_ObjId_getSlice(_ObjId *self, Py_ssize_t start, Py_ssize_t end) { Py_ssize_t len = moose_ObjId_getLength(self); while (start < 0) { start += len; } while (end < 0) { end += len; } if (start > end) { // PyErr_SetString(PyExc_IndexError, "Start index must be less than // end."); // python itself returns empty tuple - follow that return PyTuple_New(0); } PyObject *ret = PyTuple_New((Py_ssize_t)(end - start)); // Py_XINCREF(ret); for (int ii = start; ii < end; ++ii) { _ObjId *value = PyObject_New(_ObjId, &ObjIdType); value->oid_ = ObjId(self->oid_.id, self->oid_.dataIndex, ii); if (PyTuple_SetItem(ret, (Py_ssize_t)(ii - start), (PyObject *)value)) // danger - must we DECREF all prior values? { Py_XDECREF(ret); // Py_XDECREF(value); PyErr_SetString(PyExc_RuntimeError, "Failed to assign tuple entry."); return NULL; } } return ret; } Py_ssize_t moose_ObjId_getLength(_ObjId *self) { Element *el = self->oid_.element(); if (!el->hasFields()) { return 0; } FieldElement *fe = reinterpret_cast<FieldElement *>(el); if (fe == NULL) { return 0; } return (Py_ssize_t)(fe->numData()); } /// Inner function for looking up value from LookupField on object /// with ObjId target. /// /// args should be a tuple (lookupFieldName, key) PyObject *getLookupField(ObjId target, char *fieldName, PyObject *key) { vector<string> type_vec; if (parseFinfoType(Field<string>::get(target, "className"), "lookupFinfo", string(fieldName), type_vec) < 0) { ostringstream error; error << "Cannot handle key type for LookupField `" << Field<string>::get(target, "className") << "." << fieldName << "`."; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } if (type_vec.size() != 2) { ostringstream error; error << "LookupField type signature should be <keytype>, <valuetype>. " "But for `" << Field<string>::get(target, "className") << "." << fieldName << "` got " << type_vec.size() << " components."; PyErr_SetString(PyExc_AssertionError, error.str().c_str()); return NULL; } PyObject *ret = NULL; char key_type_code = shortType(type_vec[0]); char value_type_code = shortType(type_vec[1]); switch (key_type_code) { case 'b': { ret = lookup_value<bool>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'c': { ret = lookup_value<char>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'h': { ret = lookup_value<short>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'H': { ret = lookup_value<unsigned short>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'i': { ret = lookup_value<int>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'I': { ret = lookup_value<unsigned int>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'l': { ret = lookup_value<long>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'k': { ret = lookup_value<unsigned long>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'L': { ret = lookup_value<long long>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'K': { ret = lookup_value<unsigned long long>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'd': { ret = lookup_value<double>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'f': { ret = lookup_value<float>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 's': { ret = lookup_value<string>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'x': { ret = lookup_value<Id>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'y': { ret = lookup_value<ObjId>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'D': { ret = lookup_value<vector<double>>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'S': { ret = lookup_value<vector<string>>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'X': { ret = lookup_value<vector<Id>>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'Y': { ret = lookup_value<vector<ObjId>>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'v': { ret = lookup_value<vector<int>>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'N': { ret = lookup_value<vector<unsigned int>>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'P': { ret = lookup_value<vector<unsigned long>>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'F': { ret = lookup_value<vector<float>>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'w': { ret = lookup_value<vector<short>>( target, string(fieldName), value_type_code, key_type_code, key); break; } case 'C': { ret = lookup_value<vector<char>>( target, string(fieldName), value_type_code, key_type_code, key); break; } default: ostringstream error; error << "Unhandled key type `" << type_vec[0] << "` for " << Field<string>::get(target, "className") << "." << fieldName; PyErr_SetString(PyExc_TypeError, error.str().c_str()); } return ret; } PyDoc_STRVAR( moose_ObjId_getLookupField_documentation, "getLookupField(fieldname, key) -> value type\n" "\n" "Lookup entry for `key` in `fieldName`\n" "\n" "Parameters\n" "----------\n" "fieldname : string\n" " Name of the lookupfield.\n" "\n" "key : appropriate type for key of the lookupfield (as in the dict " " getFieldDict).\n" " Key for the look-up."); PyObject *moose_ObjId_getLookupField(_ObjId *self, PyObject *args) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_getLookupField"); } char *fieldName = NULL; PyObject *key = NULL; if (!PyArg_ParseTuple(args, "sO:moose_ObjId_getLookupField", &fieldName, &key)) { return NULL; } return getLookupField(self->oid_, fieldName, key); } // moose_ObjId_getLookupField int setLookupField(ObjId target, char *fieldName, PyObject *key, PyObject *value) { vector<string> type_vec; if (parseFinfoType(Field<string>::get(target, "className"), "lookupFinfo", string(fieldName), type_vec) < 0) { ostringstream error; error << "Cannot handle key type for LookupField `" << Field<string>::get(target, "className") << "." << fieldName << "`."; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return -1; } if (type_vec.size() != 2) { ostringstream error; error << "LookupField type signature should be <keytype>, <valuetype>. " "But for `" << Field<string>::get(target, "className") << "." << fieldName << "` got " << type_vec.size() << " components."; PyErr_SetString(PyExc_AssertionError, error.str().c_str()); return -1; } char key_type_code = shortType(type_vec[0]); char value_type_code = shortType(type_vec[1]); int ret = -1; switch (key_type_code) { case 'I': { ret = set_lookup_value<unsigned int>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'k': { ret = set_lookup_value<unsigned long>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 's': { ret = set_lookup_value<string>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'i': { ret = set_lookup_value<int>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'l': { ret = set_lookup_value<long>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'L': { ret = set_lookup_value<long long>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'K': { ret = set_lookup_value<unsigned long long>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'b': { ret = set_lookup_value<bool>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'c': { ret = set_lookup_value<char>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'h': { ret = set_lookup_value<short>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'H': { ret = set_lookup_value<unsigned short>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'd': { ret = set_lookup_value<double>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'f': { ret = set_lookup_value<float>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'x': { ret = set_lookup_value<Id>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } case 'y': { ret = set_lookup_value<ObjId>( target, string(fieldName), value_type_code, key_type_code, key, value); break; } default: ostringstream error; error << "setLookupField: invalid key type " << type_vec[0]; PyErr_SetString(PyExc_TypeError, error.str().c_str()); } return ret; } // setLookupField PyDoc_STRVAR(moose_ObjId_setLookupField_documentation, "setLookupField(fieldname, key, value)\n" "\n" "Set a lookup field entry.\n" "\n" "Parameters\n" "----------\n" "fieldname : str\n" " name of the field to be set\n" "key : key type\n" " key in the lookup field for which the value is to be set.\n" "value : value type\n" " value to be set for `key` in the lookup field.\n"); PyObject *moose_ObjId_setLookupField(_ObjId *self, PyObject *args) { if (!Id::isValid(self->oid_.id)) { return NULL; } PyObject *key; PyObject *value; char *field; if (!PyArg_ParseTuple(args, "sOO:moose_ObjId_setLookupField", &field, &key, &value)) { return NULL; } if (setLookupField(self->oid_, field, key, value) == 0) { Py_RETURN_NONE; } return NULL; } // moose_ObjId_setLookupField PyDoc_STRVAR( moose_ObjId_setDestField_documentation, "setDestField(arg0, arg1, ...)\n" "\n" "Set a destination field. This is for advanced uses. destFields can\n" "(and should) be directly called like functions as\n" "`element.fieldname(arg0, ...)`\n" "\n" "Parameters\n" "----------\n" "The number and type of paramateres depend on the destFinfo to be\n" "set. Use moose.doc('{classname}.{fieldname}') to get builtin\n" "documentation on the destFinfo `fieldname`\n"); PyObject *moose_ObjId_setDestField(_ObjId *self, PyObject *args) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_setDestField"); } PyObject *arglist[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; ostringstream error; ObjId oid = ((_ObjId *)self)->oid_; error << "moose.setDestField: "; // Unpack the arguments if (!PyArg_UnpackTuple(args, "setDestField", MIN_ARGS, MAX_ARGS, &arglist[0], &arglist[1], &arglist[2], &arglist[3], &arglist[4], &arglist[5], &arglist[6], &arglist[7], &arglist[8], &arglist[9])) { error << "At most " << MAX_ARGS - 1 << " arguments can be handled."; PyErr_SetString(PyExc_ValueError, error.str().c_str()); return NULL; } // Get the destFinfo name char *fieldName = PyString_AsString(arglist[0]); if (!fieldName) // not a string, raises TypeError { error << "first argument must be a string specifying field name."; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } // Try to parse the arguments. vector<string> argType; if (parseFinfoType( Field<string>::get(oid, "className"), "destFinfo", string(fieldName), argType) < 0) { error << "Arguments not handled: " << fieldName << "("; for (unsigned int ii = 0; ii < argType.size(); ++ii) { error << argType[ii] << ","; } error << ")"; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } if (argType.size() == 1) { if (arglist[1] == NULL && argType[0] == "void") { bool ret = SetGet0::set(oid, string(fieldName)); if (ret) { Py_RETURN_TRUE; } else { Py_RETURN_FALSE; } } return setDestFinfo(oid, string(fieldName), arglist[1], argType[0]); } else if (argType.size() == 2) { return setDestFinfo2(oid, string(fieldName), arglist[1], shortType(argType[0]), arglist[2], shortType(argType[1])); } else { error << "Can handle only up to 2 arguments" << endl; return NULL; } } // moose_ObjId_setDestField PyObject *setDestFinfo(ObjId obj, string fieldName, PyObject *arg, string argType) { char typecode = shortType(argType); bool ret; ostringstream error; error << "moose.setDestFinfo: "; switch (typecode) { case 'f': case 'd': { double param = PyFloat_AsDouble(arg); if (typecode == 'f') { ret = SetGet1<float>::set(obj, fieldName, (float)param); } else { ret = SetGet1<double>::set(obj, fieldName, param); } } break; case 's': { char *param = PyString_AsString(arg); ret = SetGet1<string>::set(obj, fieldName, string(param)); } break; case 'i': case 'l': { long param = PyInt_AsLong(arg); if (param == -1 && PyErr_Occurred()) { return NULL; } if (typecode == 'i') { ret = SetGet1<int>::set(obj, fieldName, (int)param); } else { ret = SetGet1<long>::set(obj, fieldName, param); } } break; case 'I': case 'k': { unsigned long param = PyLong_AsUnsignedLong(arg); if (PyErr_Occurred()) { return NULL; } if (typecode == 'I') { ret = SetGet1<unsigned int>::set(obj, fieldName, (unsigned int)param); } else { ret = SetGet1<unsigned long>::set(obj, fieldName, param); } } break; case 'x': { Id param; _Id *id = (_Id *)(arg); if (id == NULL) { error << "argument should be an vec or an melement"; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } param = id->id_; ret = SetGet1<Id>::set(obj, fieldName, param); } break; case 'y': { ObjId param; _ObjId *oid = (_ObjId *)(arg); if (oid == NULL) { error << "argument should be vec or an melement"; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } param = oid->oid_; ret = SetGet1<ObjId>::set(obj, fieldName, param); } break; case 'c': { char *param = PyString_AsString(arg); if (!param) { error << "expected argument of type char/string"; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } else if (strlen(param) == 0) { error << "Empty string not allowed."; PyErr_SetString(PyExc_ValueError, error.str().c_str()); return NULL; } ret = SetGet1<char>::set(obj, fieldName, param[0]); } break; //////////////////////////////////////////////////// // We do NOT handle multiple vectors. Use the argument // list as a single vector argument. //////////////////////////////////////////////////// case 'v': { return _set_vector_destFinfo<int>(obj, string(fieldName), arg, typecode); } case 'w': { return _set_vector_destFinfo<short>(obj, string(fieldName), arg, typecode); } case 'L': // SET_VECFIELD(long, l) { { return _set_vector_destFinfo<long>(obj, string(fieldName), arg, typecode); } case 'N': // SET_VECFIELD(unsigned int, I) { return _set_vector_destFinfo<unsigned int>(obj, string(fieldName), arg, typecode); } case 'K': // SET_VECFIELD(unsigned long, k) { return _set_vector_destFinfo<unsigned long>(obj, string(fieldName), arg, typecode); } case 'F': // SET_VECFIELD(float, f) { return _set_vector_destFinfo<float>(obj, string(fieldName), arg, typecode); } case 'D': // SET_VECFIELD(double, d) { return _set_vector_destFinfo<double>(obj, string(fieldName), arg, typecode); } case 'S': { return _set_vector_destFinfo<string>(obj, string(fieldName), arg, typecode); } case 'X': { return _set_vector_destFinfo<Id>(obj, string(fieldName), arg, typecode); } case 'Y': { return _set_vector_destFinfo<ObjId>(obj, string(fieldName), arg, typecode); } default: { error << "Cannot handle argument type: " << argType; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } } // switch (shortType(argType[ii]) if (ret) { Py_RETURN_TRUE; } else { Py_RETURN_FALSE; } } /** Set destFinfo for 2 argument destination field functions. */ // template <class A> PyObject *setDestFinfo2(ObjId obj, string fieldName, PyObject *arg1, char type1, PyObject *arg2, char type2) { ostringstream error; error << "moose.setDestFinfo2: "; switch (type2) { case 'f': case 'd': { double param = PyFloat_AsDouble(arg2); if (type2 == 'f') { return setDestFinfo1<float>(obj, fieldName, arg1, type1, (float)param); } else { return setDestFinfo1<double>(obj, fieldName, arg1, type1, param); } } case 's': { char *param = PyString_AsString(arg2); return setDestFinfo1<string>(obj, fieldName, arg1, type1, string(param)); } case 'i': case 'l': { long param = PyInt_AsLong(arg2); if (param == -1 && PyErr_Occurred()) { return NULL; } if (type2 == 'i') { return setDestFinfo1<int>(obj, fieldName, arg1, type1, (int)param); } else { return setDestFinfo1<long>(obj, fieldName, arg1, type1, param); } } case 'I': case 'k': { unsigned long param = PyLong_AsUnsignedLong(arg2); if (PyErr_Occurred()) { return NULL; } if (type2 == 'I') { return setDestFinfo1<unsigned int>( obj, fieldName, arg1, type1, (unsigned int)param); } else { return setDestFinfo1<unsigned long>(obj, fieldName, arg1, type1, param); } } case 'x': { Id param; // if (Id_SubtypeCheck(arg)){ _Id *id = (_Id *)(arg2); if (id == NULL) { error << "argument should be an vec or an melement"; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } param = id->id_; // } else if (ObjId_SubtypeCheck(arg)){ // _ObjId * oid = (_ObjId*)(arg); // if (oid == NULL){ // error << "argument should be an vec or an melement"; // PyErr_SetString(PyExc_TypeError, error.str().c_str()); // return NULL; // } // param = oid->oid_.id; // } return setDestFinfo1<Id>(obj, fieldName, arg1, type1, param); } case 'y': { ObjId param; // if (Id_SubtypeCheck(arg)){ // _Id * id = (_Id*)(arg); // if (id == NULL){ // error << "argument should be an vec or an melement"; // PyErr_SetString(PyExc_TypeError, error.str().c_str()); // return NULL; // } // param = ObjId(id->id_); // } else if (ObjId_SubtypeCheck(arg)){ _ObjId *oid = (_ObjId *)(arg2); if (oid == NULL) { error << "argument should be an vec or an melement"; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } param = oid->oid_; // } return setDestFinfo1<ObjId>(obj, fieldName, arg1, type1, param); } case 'c': { char *param = PyString_AsString(arg2); if (!param) { error << "expected argument of type char/string"; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } else if (strlen(param) == 0) { error << "Empty string not allowed."; PyErr_SetString(PyExc_ValueError, error.str().c_str()); return NULL; } return setDestFinfo1<char>(obj, fieldName, arg1, type1, param[0]); } default: { error << "Unhandled argument 2 type (shortType=" << type2 << ")"; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } } } PyDoc_STRVAR( moose_ObjId_getFieldNames_documenation, "getFieldNames(fieldType='') -> tuple of str\n" "\n" "Returns the names of fields of this element of fieldType kind.\n" "\n" "Parameters\n" "----------\n" "fieldType : str\n" " Type of the fields you wish to retrieve. Can be\n" " - `valueFinfo` - attributes of the object\n" " - `srcFinfo` - fields of the object which can be used as source of " "information for connect\n" " - `destFinfo` - fields of the object which can be used as " "destination of information for connect\n" " - `lookupFinfo`- fields which can be looked at through this object" ", etc. If an empty string is specified, names of all avaialable fields " "are returned.\n" "\n" "Returns\n" "-------\n" "names : tuple of strings.\n" " names of the fields of the specified type.\n" "\n" "Examples\n" "--------\n" "List names of all the source fields in PulseGen class:\n" "\n" " >>> comp.getFieldNames('lookupFinfo') \n" " ('neighbors', 'msgDests', 'msgDestFunctions', 'isA')\n" " >>> moose.getFieldNames('PulseGen', 'srcFinfo')\n" " ('childMsg', 'output')\n" "\n"); // 2011-03-23 15:28:26 (+0530) PyObject *moose_ObjId_getFieldNames(_ObjId *self, PyObject *args) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_getFieldNames"); } char *ftype = NULL; if (!PyArg_ParseTuple(args, "|s:moose_ObjId_getFieldNames", &ftype)) { return NULL; } string ftype_str = (ftype != NULL) ? string(ftype) : ""; vector<string> ret; string className = Field<string>::get(self->oid_, "className"); if (ftype_str == "") { for (const char **a = getFinfoTypes(); *a; ++a) { vector<string> fields = getFieldNames(className, string(*a)); ret.insert(ret.end(), fields.begin(), fields.end()); } } else { ret = getFieldNames(className, ftype_str); } PyObject *pyret = PyTuple_New((Py_ssize_t)ret.size()); for (unsigned int ii = 0; ii < ret.size(); ++ii) { PyObject *fname = Py_BuildValue("s", ret[ii].c_str()); if (!fname) { Py_XDECREF(pyret); pyret = NULL; break; } if (PyTuple_SetItem(pyret, (Py_ssize_t)ii, fname)) { Py_XDECREF(pyret); // Py_DECREF(fname); pyret = NULL; break; } } return pyret; } PyDoc_STRVAR( moose_ObjId_getNeighbors_documentation, "getNeighbors(fieldName) -> tuple of vecs\n" "\n" "Get the objects connected to this element on specified field.\n" "\n" "Parameters\n" "----------\n" "fieldName : str\n" " name of the connection field (a destFinfo/srcFinfo/sharedFinfo)\n" "\n" "Returns\n" "-------\n" "neighbors: tuple of vecs.\n" " tuple containing the ids of the neighbour vecs.\n" "\n"); PyObject *moose_ObjId_getNeighbors(_ObjId *self, PyObject *args) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_getNeighbors"); } char *field = NULL; if (!PyArg_ParseTuple(args, "s:moose_ObjId_getNeighbors", &field)) { return NULL; } vector<Id> val = LookupField<string, vector<Id>>::get(self->oid_, "neighbors", string(field)); PyObject *ret = PyTuple_New((Py_ssize_t)val.size()); for (unsigned int ii = 0; ii < val.size(); ++ii) { _Id *entry = PyObject_New(_Id, &IdType); if (!entry || PyTuple_SetItem(ret, (Py_ssize_t)ii, (PyObject *)entry)) { Py_DECREF(ret); // Py_DECREF((PyObject*)entry); ret = NULL; break; } entry->id_ = val[ii]; } return ret; } // 2011-03-28 10:10:19 (+0530) // 2011-03-23 15:13:29 (+0530) // getChildren is not required as it can be accessed as getField("children") // 2011-03-28 10:51:52 (+0530) PyDoc_STRVAR(moose_ObjId_connect_documentation, "connect(src, srcfield, destobj, destfield[,msgtype]) -> bool\n" "\n" "Create a message between `src_field` on `src` object to " "`dest_field` on `dest` object.\n" "This function is used mainly, to say, connect two entities, and " "to denote what kind of give-and-take relationship they share." "It enables the 'destfield' (of the 'destobj') to acquire the " "data, from 'srcfield'(of the 'src')." "\n" "Parameters\n" "----------\n" "src : element/vec/string\n" " the source object (or its path) \n" " (the one that provides information)\n" "srcfield : str\n" " source field on self.(type of the information)\n" "destobj : element\n" " Destination object to connect to.\n" " (The one that need to get information)\n" "destfield : str\n" " field to connect to on `destobj`.\n" "msgtype : str\n" " type of the message. Can be \n" " `Single` - \n" " `OneToAll` - \n" " `AllToOne` - \n" " `OneToOne` - \n" " `Reduce` - \n" " `Sparse` - \n" " Default: `Single`.\n" "\n" "Returns\n" "-------\n" "msgmanager: melement\n" " message-manager for the newly created message.\n" "\n" "Examples\n" "--------\n" "Connect the output of a pulse generator to the input of a spike\n" "generator::\n" "\n" " >>> pulsegen = moose.PulseGen('pulsegen')\n" " >>> spikegen = moose.SpikeGen('spikegen')\n" " >>> pulsegen.connect('output', spikegen, 'Vm')\n" "\n" "See also\n" "--------\n" "moose.connect\n" "\n"); PyObject *moose_ObjId_connect(_ObjId *self, PyObject *args) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_connect"); } extern PyTypeObject ObjIdType; PyObject *destPtr = NULL; char *srcField = NULL, *destField = NULL, *msgType = NULL; static char default_msg_type[] = "Single"; if (!PyArg_ParseTuple( args, "sOs|s:moose_ObjId_connect", &srcField, &destPtr, &destField, &msgType)) { return NULL; } if (msgType == NULL) { msgType = default_msg_type; } _ObjId *dest = reinterpret_cast<_ObjId *>(destPtr); ObjId mid = SHELLPTR->doAddMsg( msgType, self->oid_, string(srcField), dest->oid_, string(destField)); if (mid.bad()) { PyErr_SetString( PyExc_NameError, "connect failed: check field names and type compatibility."); return NULL; } _ObjId *msgMgrId = (_ObjId *)PyObject_New(_ObjId, &ObjIdType); msgMgrId->oid_ = mid; return (PyObject *)msgMgrId; } PyDoc_STRVAR( moose_ObjId_richcompare_documentation, "Compare two element instances. This just does a string comparison of\n" "the paths of the element instances. This function exists only to\n" "facilitate certain operations requiring sorting/comparison, like\n" "using elements for dict keys. Conceptually only equality comparison is\n" "meaningful for elements.\n"); PyObject *moose_ObjId_richcompare(_ObjId *self, PyObject *other, int op) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_richcompare"); } extern PyTypeObject ObjIdType; if ((self != NULL && other == NULL) || (self == NULL && other != NULL)) { if (op == Py_EQ) { Py_RETURN_FALSE; } else if (op == Py_NE) { Py_RETURN_TRUE; } else { PyErr_SetString(PyExc_TypeError, "Cannot compare NULL with non-NULL"); return NULL; } } if (!PyObject_IsInstance(other, (PyObject *)&ObjIdType)) { ostringstream error; error << "Cannot compare ObjId with " << Py_TYPE(other)->tp_name; PyErr_SetString(PyExc_TypeError, error.str().c_str()); return NULL; } if (!Id::isValid(((_ObjId *)other)->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_richcompare"); } string l_path = self->oid_.path(); string r_path = ((_ObjId *)other)->oid_.path(); int result = l_path.compare(r_path); if (result == 0) { if (op == Py_EQ || op == Py_LE || op == Py_GE) { Py_RETURN_TRUE; } Py_RETURN_FALSE; } else if (result < 0) { if (op == Py_LT || op == Py_LE || op == Py_NE) { Py_RETURN_TRUE; } Py_RETURN_FALSE; } else { if (op == Py_GT || op == Py_GE || op == Py_NE) { Py_RETURN_TRUE; } Py_RETURN_FALSE; } } PyDoc_STRVAR(moose_ObjId_getDataIndex_documentation, "getDataIndex() -> int\n" "\n" "Returns the dataIndex (position of the object in vector) " "of this object, if it belongs to a vector, otherwise returns 0.\n" "\n" " >>> comp = moose.Compartment('/comp')\n" " >>> comp.getDataIndex()\n" " >>> 0\n" ""); PyObject *moose_ObjId_getDataIndex(_ObjId *self) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_getDataIndex"); } PyObject *ret = Py_BuildValue("I", self->oid_.dataIndex); return ret; } // WARNING: fieldIndex has been deprecated in dh_branch. This // needs to be updated accordingly. The current code is just // place-holer to avoid compilation errors. PyObject *moose_ObjId_getFieldIndex(_ObjId *self) { if (!Id::isValid(self->oid_.id)) { RAISE_INVALID_ID(NULL, "moose_ObjId_getFieldIndex"); } PyObject *ret = Py_BuildValue("I", self->oid_.dataIndex); return ret; } /////////////////////////////////////////////// // Python method lists for PyObject of ObjId /////////////////////////////////////////////// static PyMethodDef ObjIdMethods[] = { {"getFieldType", (PyCFunction)moose_ObjId_getFieldType, METH_VARARGS, moose_ObjId_getFieldType_documentation}, {"getField", (PyCFunction)moose_ObjId_getField, METH_VARARGS, moose_ObjId_getField_documentation}, {"setField", (PyCFunction)moose_ObjId_setField, METH_VARARGS, moose_ObjId_setField_documentation}, {"getLookupField", (PyCFunction)moose_ObjId_getLookupField, METH_VARARGS, moose_ObjId_getLookupField_documentation}, {"setLookupField", (PyCFunction)moose_ObjId_setLookupField, METH_VARARGS, moose_ObjId_setLookupField_documentation}, {"getId", (PyCFunction)moose_ObjId_getId, METH_NOARGS, moose_ObjId_getId_documentation}, {"vec", (PyCFunction)moose_ObjId_getId, METH_NOARGS, "Return the vec this element belongs to. This is overridden by the" " attribute of the same name for quick access."}, {"getFieldNames", (PyCFunction)moose_ObjId_getFieldNames, METH_VARARGS, moose_ObjId_getFieldNames_documenation}, {"getNeighbors", (PyCFunction)moose_ObjId_getNeighbors, METH_VARARGS, moose_ObjId_getNeighbors_documentation}, {"connect", (PyCFunction)moose_ObjId_connect, METH_VARARGS, moose_ObjId_connect_documentation}, {"getDataIndex", (PyCFunction)moose_ObjId_getDataIndex, METH_NOARGS, moose_ObjId_getDataIndex_documentation}, {"getFieldIndex", (PyCFunction)moose_ObjId_getFieldIndex, METH_NOARGS, "Get the index of this object as a field."}, {"setDestField", (PyCFunction)moose_ObjId_setDestField, METH_VARARGS, moose_ObjId_setDestField_documentation}, {NULL, NULL, 0, NULL}, /* Sentinel */ }; /////////////////////////////////////////////// // Type defs for PyObject of ObjId /////////////////////////////////////////////// PyDoc_STRVAR( moose_ObjId_documentation, "Individual moose element contained in an array-type object" " (vec).\n" "\n" "Each element has a unique path, possibly with its index in" " the vec. These are identified by three components: vec, dndex and" " findex. vec is the containing vec, which is identified by a unique" " number (field `value`). `dindex` is the index of the current" " item in the containing vec. `dindex` is 0 for single elements." " findex is field index, specifying the index of elements which exist" " as fields of another moose element.\n" "\n" "Notes\n" "-----\n" "Users need not create melement directly. Instead use the named moose" " class for creating new elements. To get a reference to an existing" " element, use the :ref:`moose.element` function.\n" "\n" "Parameters\n" "----------\n" "path : str\n" " path of the element to be created.\n" "\n" "n : positive int, optional\n" " defaults to 1. If greater, then a vec of that size is created and\n" " this element is a reference to the first entry of the vec.\n" "\n" "g : int, optional\n" " if 1, this is a global element, else if 0 (default), the element\n" " is local to the current node.\n" "\n" "dtype : str\n" " name of the class of the element. If creating any concrete\n" " subclass, this is automatically taken from the class name and\n" " should not be specified explicitly.\n" "\n" "Attributes\n" "----------\n" "vec : moose.vec\n" " The vec containing this element. `vec` wraps the Id of the object in " "MOOSE C++ API.\n" "\n" "dindex : int\n" " index of this element in the container vec\n" "\n" "findex: int\n" " if this is a tertiary object, i.e. acts as a field in another\n" " element (like synapse[0] in IntFire[1]), then the index of\n" " this field in the containing element.\n" "\n" "Examples\n" "--------\n" "\n" ">>> a = Neutral('alpha') # Creates element named `alpha` under current " "working element\n" ">>> b = Neutral('alpha/beta') # Creates the element named `beta` under " "`alpha`\n" ">>> c = moose.melement(b)"); PyTypeObject ObjIdType = { PyVarObject_HEAD_INIT(NULL, 0) /* tp_head */ "moose.melement", /* tp_name */ sizeof(_ObjId), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ (reprfunc)moose_ObjId_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)moose_ObjId_hash, /* tp_hash */ 0, /* tp_call */ (reprfunc)moose_ObjId_str, /* tp_str */ (getattrofunc)moose_ObjId_getattro, /* tp_getattro */ (setattrofunc)moose_ObjId_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, moose_ObjId_documentation, 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)moose_ObjId_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ObjIdMethods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)moose_ObjId_init, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ }; // // melement.cpp ends here
BhallaLab/moose-core
pymoose/melement.cpp
C++
gpl-3.0
75,256
<div class="row-fluid"> <div class="block span6"> <a href="#tablewidget" class="block-heading" data-toggle="collapse"><?PHP I18n::p('W_S');?></a> <div id="tablewidget" class="block-body collapse in"> <table class="table"> <tbody> <tr> <td><?PHP I18n::p('PHP_V');?></td> <td><?php echo $this->data['phpversion']; ?></td> </tr> <tr> <td><?PHP I18n::p('W_S');?></td> <td><?php echo $this->data['webserver']; ?></td> </tr> <?php if(isset($this->data['mongoinfo']['version'])){?> <tr> <td><?PHP I18n::p('MONGODB_V');?></td> <td><?php echo $this->data['mongoinfo']['version']; ?></td> </tr> <?php }?> </tbody> </table> </div> </div> <div class="block span6"> <a href="#widget1container" class="block-heading" data-toggle="collapse"><?PHP I18n::p('B_I');?></a> <div id="widget1container" class="block-body collapse in"> <table class="table"> <tbody> <?php if(is_array($this->data['mongoinfo'])){ foreach($this->data['mongoinfo'] as $k=>$v){ ?> <tr> <td><?php echo $k;?></td> <td><?php print_r($v);?></td> </tr> <?php } } ?> </tbody> </table> </div> </div> </div>
phpmongodb/phpmongodb
application/views/Index/index.php
PHP
gpl-3.0
1,793
/* buttons */ /*responsive settings*/ @media all and (min-width: 1500px) { } @media all and (max-width: 1499px) and (min-width: 600px) { } @media all and (max-width: 800px) and (min-width: 50px) { button .unica{ font-size: 20px !important; } button .inconsolata{ font-size: 25px; letter-spacing: 1.7px; } button .playfair{ font-size: 16px !important; letter-spacing: 1px !important; } button .graduate{ font-size: 20px !important; } button .francois{ font-size: 18px !important; } button .squada{ font-size: 20px !important; letter-spacing: 1px !important; } button .oleo{ font-size: 25px !important; letter-spacing: 2px !important; } button .bungee{ font-size: 24px !important; letter-spacing: 1.3px !important; } } button{ border: unset; } #button { text-align: center; padding: 15px 15px 15px 15px; margin: auto; margin-bottom: 28px; border-style: dotted; border-width: 2px; } #button.lemon, #button.raspberry, #button.violet { background: repeating-linear-gradient( 50deg, rgba(0 ,0, 0, 0), rgba(0 ,0, 0, 0) 2px, rgba(0 ,0, 0, 0.1) 2px, rgba(0 ,0, 0, 0.1) 10px ); border-color: rgba(0, 0, 0, 0); color: black; } #button.raspberry:hover, #button.lemon:hover, #button.violet:hover { border-style: dotted; border-width: 2px; border-color: black; } #button.night, #button.mint, #button.green { background: repeating-linear-gradient( 50deg, rgba(255 ,255, 255, 0), rgba(0 ,0, 0, 0) 2px, rgba(255 ,255, 255, 0.1) 2px, rgba(255 ,255, 255, 0.1) 10px ); border-color: rgba(0, 0, 0, 0); color: white; } #button.night:hover, #button.mint:hover, #button.green:hover { border-style: dotted; border-width: 2px; border-color: white; } button .unica{ font-family: 'Unica One', cursive; font-size: 20px; } button .inconsolata{ font-family: 'Inconsolata', cursive; font-size: 25px; letter-spacing: 1.7px; } button .playfair{ font-family: 'Playfair Display', serif; font-weight: 700; font-size: 21px; letter-spacing: 2.2px; } button .graduate{ font-family: 'Graduate', cursive; font-size: 23px; text-transform: uppercase; letter-spacing: 1px; } button .francois{ font-family: 'Francois One', sans-serif; font-size: 23px; letter-spacing: 1px; text-transform: uppercase; } button .squada{ font-family: 'Squada One', cursive; font-size: 30px; text-transform: uppercase; letter-spacing: 1.5px; } button .oleo{ font-family: 'Merienda One', cursive; font-size: 25px; letter-spacing: 2px; font-weight: 400; } button .bungee{ font-family: 'Bungee Inline', cursive; font-size: 24px; letter-spacing: 1.3px; } button .oswald{ font-family: 'Oswald', sans-serif; font-size: 25px; } /*FOO*/ #button-ddwn { cursor: pointer; flex-basis: 1; background-color: unset; border: none; padding: 10px 10px 10px 10px; } #button-ddwn:active .dropdown-content { visibility: visible; } #button-ddwn:hover { background-color: white; color: black; } /*.dropdown { position: relative; display: inline-block; } */ .dropdown-content { display: none; position: absolute; background-color: var(--grey1); min-width: 160px; overflow: auto; visibility: hidden; } #ddwn-button { background-color: white; color:black; } #ddwn-button:hover { background-color: orange; } /* .dropdown-content button { color: var(--white); padding: 12px 16px; text-decoration: none; display: block; } .dropdown button:hover { } */
LeBlockFest/blockfest20
stylesheets/buttons.css
CSS
gpl-3.0
3,432
/** * Default theme for jixedbar * written by Ryan Yonzon, http://ryan.rawswift.com/ * Last update: August 13, 2010 */ /*----- bar style -----*/ .jx-bar { height:30px; padding:0px; width:80%; background-color:#e5e5e5; border:#b5b5b5 solid 1px; } /* rounded top-left corner */ .jx-bar-rounded-tl { -webkit-border-top-left-radius:5px; -khtml-border-radius-topleft:5px; -moz-border-radius-topleft:5px; border-top-left-radius:5px; } /* rounded bottom-left corner */ .jx-bar-rounded-bl { -webkit-border-bottom-left-radius:5px; -khtml-border-radius-bottomleft:5px; -moz-border-radius-bottomleft:5px; border-bottom-left-radius:5px; } /* rounded top-right corner */ .jx-bar-rounded-tr { -webkit-border-top-right-radius:5px; -khtml-border-radius-topright:5px; -moz-border-radius-topright:5px; border-top-right-radius:5x; } /* rounded bottom-right corner */ .jx-bar-rounded-br { -webkit-border-bottom-right-radius:5px; -khtml-border-radius-bottomright:5px; -moz-border-radius-bottomright:5px; border-bottom-right-radius:5x; } /*----- bar separator -----*/ .jx-bar span { width:1px; height:100%; background-color:#ccc; } .jx-separator-left { float:left; } .jx-separator-right { float:right; } /*----- bar button -----*/ .jx-bar-button ul { margin:0px; padding:0px; } .jx-bar-button li { float:left; list-style:none; } .jx-bar-button-right li { float:right; list-style:none; } .jx-bar-button li { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; cursor:pointer; padding:4px 8px 4px 8px; border:#e5e5e5 solid 1px; margin:2px; } /* button hover effect */ .jx-bar-button li:hover { background-color:#eee; border:#ccc solid 1px; padding:4px 8px 4px 8px; margin:2px; } /* rounded button corners */ .jx-bar-button-rounded li:hover { -webkit-border-radius:3px; -khtml-border-radius:3px; -moz-border-radius:3px; border-radius:3px; } /* default button's anchor text style */ .jx-bar-button li a:link, .jx-bar-button li a:visited { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#666; text-decoration:none; padding:1px; } .jx-bar-button li a:hover { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#333; text-decoration:none; } /*----- bar text container and button arrow indicator -----*/ .jx-bar div, .jx-bar iframe { float:left; } .jx-bar div { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#666; padding:4px 8px 4px 8px; margin:4px 0px 4px 0px; } .jx-bar iframe { margin:4px 0px 4px 10px; } .jx-bar div a:link, .jx-bar div a:visited { color:#666; text-decoration:none; } .jx-bar div a:hover { color:#0099FF; text-decoration:none; } /*----- button tooltip -----*/ .jx-bar-button-tooltip { height:auto; padding:5px 10px 5px 10px; color:#fff; background-color:#36393D; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; } /* rounded tooltip */ .jx-bar-button-tooltip { -moz-border-radius: 3px; -webkit-border-radius:3px; } /*----- nav menu -----*/ .jx-nav-menu { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; padding:2px; background-color:#eee; border:#ccc solid 1px; } .jx-nav-menu-rounded { -webkit-border-radius:3px; -khtml-border-radius:3px; -moz-border-radius:3px; border-radius:3px; } .jx-nav-menu ul { margin:0; padding:0; list-style:none; width:150px; /* width of menu items */ } .jx-nav-menu a:hover { background-color:#4096EE; color:#fff; text-decoration:none; } /* styles for menu items */ .jx-nav-menu ul li a { display:block; text-decoration:none; color:#777; background:#fff; /* IE6 Bug */ padding:8px; border:1px solid #eee; /* IE6 Bug */ border-bottom:0px; } /* active menu button */ .jx-nav-menu-active { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; cursor:pointer; background-color:#ccc; padding:4px 8px 4px 8px; margin:2px; } /* active menu button (rounded) */ .jx-nav-menu-active-rounded { -webkit-border-radius:3px; -khtml-border-radius:3px; -moz-border-radius:3px; border-radius:3px; } /* menu indicator UP state */ .jx-arrow-up { background-image:url('up.gif'); background-repeat:no-repeat; background-position:center; } /* menu indicator DOWN state */ .jx-arrow-down { background-image:url('dn.gif'); background-repeat:no-repeat; background-position:center; } /* tooltip point direction */ .jx-tool-point-dir-down { background-image:url('ttd.gif'); background-repeat:no-repeat; background-position:center bottom; height:5px; width:auto; } .jx-tool-point-dir-up { background-image:url('ttu.gif'); background-repeat:no-repeat; background-position:center bottom; height:5px; width:auto; } /* hide and show/unhide item */ .jx-hide { float:right; background-image:url('../img/hide.gif'); background-repeat:no-repeat; height:16px; width:16px; } /* if showOnTop is TRUE, use "show.gif" instead of "hide.gif" */ .jx-hide-top { float:right; background-image:url('../img/show.gif'); background-repeat:no-repeat; height:16px; width:16px; } .jx-show { height:30px; padding:0px; width:40px; background-color:#e5e5e5; border:#b5b5b5 solid 1px; } .jx-show-button { float:right; background-image:url('../img/show.gif'); background-repeat:no-repeat; height:16px; width:16px; } /* if showOnTop is TRUE, use "hide.gif" instead of "show.gif" */ .jx-show-button-top { float:right; background-image:url('../img/hide.gif'); background-repeat:no-repeat; height:16px; width:16px; } .jx-hide-separator { width:1px; height:100%; background-color:#ccc; float:right; }
luisdias/thewinecellar
app/webroot/css/jx.bar.css
CSS
gpl-3.0
5,708
\hypertarget{impl_2genericCrossbar_8cc}{ \section{source/components/impl/genericCrossbar.cc File Reference} \label{impl_2genericCrossbar_8cc}\index{source/components/impl/genericCrossbar.cc@{source/components/impl/genericCrossbar.cc}} } {\tt \#include \char`\"{}genericCrossbar.h\char`\"{}}\par
mrasquinha/Capstone_v2
documentation/latex/impl_2genericCrossbar_8cc.tex
TeX
gpl-3.0
295
package script //---------------------------------------------------------------------- // This file is part of Gospel. // Copyright (C) 2011-2020 Bernd Fix // // Gospel 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. // // Gospel is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // // SPDX-License-Identifier: AGPL3.0-or-later //---------------------------------------------------------------------- import ( "fmt" "github.com/bfix/gospel/bitcoin" "github.com/bfix/gospel/math" ) // Result codes returned by script functions. const ( RcOK = iota RcErr RcExceeds RcParseError RcScriptError RcLengthMismatch RcEmptyStack RcInvalidFinalStack RcNotImplemented RcInvalidOpcode RcReservedOpcode RcTxInvalid RcTypeMismatch RcInvalidStackType RcExceedsStack RcNoTransaction RcUnclosedIf RcDoubleElse RcInvalidTransaction RcInvalidPubkey RcInvalidUint RcInvalidSignature RcInvalidTransfer RcNotVerified RcDisabledOpcode RcTxNotSignable RcEmptyScript ) // Human-readable result codes var ( RcString = []string{ "OK", "Generic error", "Operation exceeds available data", "Parse error", "Script error", "Length mismatch", "Empty stack", "Invalid final stack", "Not implemented yet", "Invalid opcode", "Reserved opcode", "Invalid transaction", "Type mismatch", "Invalid stack type", "Operation exceeds stack", "No transaction available", "Unclosed IF", "Double ELSE", "Invalid transaction", "Invalid pubkey", "Invalid Uint", "Invalid signature", "Invalid transfer", "Not verified", "Disabled opcode", "Transaction not signable", "Empty script", } ) // R is the Bitcoin script runtime environment type R struct { script *Script // list of parsed statements pos int // index of current statement stack *Stack // stack for script operations altStack *Stack // alternative stack tx *bitcoin.DissectedTransaction // associated dissected transaction CbStep func(stack *Stack, stmt *Statement, rc int) } // NewRuntime creates a new script parser and execution runtime. func NewRuntime() *R { return &R{ script: nil, pos: -1, stack: NewStack(), altStack: NewStack(), tx: nil, CbStep: nil, } } // ExecScript executes a script belonging to a transaction. If no transaction is // specified, some script opcodes like OpCHECKSIG could not be executed. // N.B.: To successfully execute 'script' that involves OpCHECKSIG it needs // to be assembled (concatenated) and cleaned up from the prev.sigScript and // curr.pkScript (see https://en.bitcoin.it/wiki/OpCHECKSIG); 'tx' is the // current transaction in dissected format already prepared for signature. func (r *R) ExecScript(script *Script, tx *bitcoin.DissectedTransaction) (bool, int) { if tx.Signable == nil || tx.VinSlot < 0 { return false, RcTxNotSignable } r.tx = tx return r.exec(script) } // CheckSig performs a OpCHECKSIG operation on the stack (without pushing a // result onto the stack) func (r *R) CheckSig() (bool, int) { // pop pubkey from stack pkInt, rc := r.stack.Pop() if rc != RcOK { return false, rc } // pop signature from stack sigInt, rc := r.stack.Pop() if rc != RcOK { return false, rc } // perform signature verify return r.checkSig(pkInt, sigInt) } // CheckMultiSig performs a OpCHECKMULTISIG operation on the stack (without // pushing a result onto the stack). func (r *R) CheckMultiSig() (bool, int) { // pop pubkeys from stack nk, rc := r.stack.Pop() if rc != RcOK { return false, rc } var keys []*math.Int for i := 0; i < int(nk.Int64()); i++ { pkInt, rc := r.stack.Pop() if rc != RcOK { return false, rc } keys = append(keys, pkInt) } // pop signatures from stack ns, rc := r.stack.Pop() if rc != RcOK { return false, rc } var sigs []*math.Int for i := 0; i < int(ns.Int64()); i++ { sigInt, rc := r.stack.Pop() if rc != RcOK { return false, rc } sigs = append(sigs, sigInt) } // pop extra (due to a bug in the initial implementation) if _, rc := r.stack.Pop(); rc != RcOK { return false, rc } // perform signature verifications for _, sigInt := range sigs { var ( j int pkInt *math.Int valid = false rc int ) for j, pkInt = range keys { if pkInt == nil { continue } valid, rc = r.checkSig(pkInt, sigInt) if rc != RcOK { return false, rc } if valid { break } } if valid { keys[j] = nil } else { return false, RcOK } } return true, RcOK } // exec executes a sequence of parsed statement of a script. func (r *R) exec(script *Script) (bool, int) { r.script = script if r.script.Stmts == nil || len(r.script.Stmts) == 0 { return false, RcEmptyScript } r.pos = 0 size := len(r.script.Stmts) for r.pos < size { s := r.script.Stmts[r.pos] opc := GetOpcode(s.Opcode) if opc == nil { fmt.Printf("Opcode: %v\n", s.Opcode) return false, RcInvalidOpcode } rc := opc.Exec(r) if r.CbStep != nil { r.CbStep(r.stack, s, rc) } if rc != RcOK { return false, rc } r.pos++ } if r.stack.Len() == 1 { v, rc := r.stack.Pop() if rc != RcOK { return false, rc } if v.Equals(math.ONE) { return true, RcOK } return false, RcOK } return false, RcInvalidFinalStack } // checkSig checks the signature of a prepared transaction. func (r *R) checkSig(pkInt, sigInt *math.Int) (bool, int) { if r.tx == nil { return false, RcNoTransaction } // get public key pk, err := bitcoin.PublicKeyFromBytes(pkInt.Bytes()) if err != nil { return false, RcInvalidPubkey } // get signature and hash type sigData := sigInt.Bytes() hashType := sigData[len(sigData)-1] sigData = sigData[:len(sigData)-1] // compute hash of amended transaction txSign := append(r.tx.Signable, []byte{hashType, 0, 0, 0}...) txHash := bitcoin.Hash256(txSign) // decode signature from DER data sig, err := bitcoin.NewSignatureFromASN1(sigData) if err != nil { return false, RcInvalidSignature } // perform signature verify return bitcoin.Verify(pk, txHash, sig), RcOK }
bfix/gospel
bitcoin/script/run.go
GO
gpl-3.0
6,670
/** ****************************************************************************** * @file fonts.c * @author MCD Application Team * @version V5.0.2 * @date 05-March-2012 * @brief This file provides text fonts for STM32xx-EVAL's LCD driver. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 * * 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. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "fonts.h" /** @addtogroup Utilities * @{ */ /** @addtogroup STM32_EVAL * @{ */ /** @addtogroup Common * @{ */ /** @addtogroup FONTS * @brief This file includes the Fonts driver of STM32xx-EVAL boards. * @{ */ /** @defgroup FONTS_Private_Types * @{ */ /** * @} */ /** @defgroup FONTS_Private_Defines * @{ */ /** * @} */ /** @defgroup FONTS_Private_Macros * @{ */ /** * @} */ /** @defgroup FONTS_Private_Variables * @{ */ const uint16_t ASCII16x24_Table [] = { /** * @brief Space ' ' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '!' */ 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '"' */ 0x0000, 0x0000, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '#' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C60, 0x0C60, 0x0C60, 0x0630, 0x0630, 0x1FFE, 0x1FFE, 0x0630, 0x0738, 0x0318, 0x1FFE, 0x1FFE, 0x0318, 0x0318, 0x018C, 0x018C, 0x018C, 0x0000, /** * @brief '$' */ 0x0000, 0x0080, 0x03E0, 0x0FF8, 0x0E9C, 0x1C8C, 0x188C, 0x008C, 0x0098, 0x01F8, 0x07E0, 0x0E80, 0x1C80, 0x188C, 0x188C, 0x189C, 0x0CB8, 0x0FF0, 0x03E0, 0x0080, 0x0080, 0x0000, 0x0000, 0x0000, /** * @brief '%' */ 0x0000, 0x0000, 0x0000, 0x180E, 0x0C1B, 0x0C11, 0x0611, 0x0611, 0x0311, 0x0311, 0x019B, 0x018E, 0x38C0, 0x6CC0, 0x4460, 0x4460, 0x4430, 0x4430, 0x4418, 0x6C18, 0x380C, 0x0000, 0x0000, 0x0000, /** * @brief '&' */ 0x0000, 0x01E0, 0x03F0, 0x0738, 0x0618, 0x0618, 0x0330, 0x01F0, 0x00F0, 0x00F8, 0x319C, 0x330E, 0x1E06, 0x1C06, 0x1C06, 0x3F06, 0x73FC, 0x21F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief ''' */ 0x0000, 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '(' */ 0x0000, 0x0200, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x0060, 0x0060, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0060, 0x0060, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0200, 0x0000, /** * @brief ')' */ 0x0000, 0x0020, 0x0060, 0x00C0, 0x0180, 0x0180, 0x0300, 0x0300, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0300, 0x0300, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0020, 0x0000, /** * @brief '*' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, 0x06D8, 0x07F8, 0x01E0, 0x0330, 0x0738, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '+' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x3FFC, 0x3FFC, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief ',' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, /** * @brief '-' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07E0, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '.' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '/' */ 0x0000, 0x0C00, 0x0C00, 0x0600, 0x0600, 0x0600, 0x0300, 0x0300, 0x0300, 0x0380, 0x0180, 0x0180, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x0060, 0x0060, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '0' */ 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C18, 0x0E38, 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '1' */ 0x0000, 0x0100, 0x0180, 0x01C0, 0x01F0, 0x0198, 0x0188, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '2' */ 0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x1800, 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '3' */ 0x0000, 0x01E0, 0x07F8, 0x0E18, 0x0C0C, 0x0C0C, 0x0C00, 0x0600, 0x03C0, 0x07C0, 0x0C00, 0x1800, 0x1800, 0x180C, 0x180C, 0x0C18, 0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '4' */ 0x0000, 0x0C00, 0x0E00, 0x0F00, 0x0F00, 0x0D80, 0x0CC0, 0x0C60, 0x0C60, 0x0C30, 0x0C18, 0x0C0C, 0x3FFC, 0x3FFC, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '5' */ 0x0000, 0x0FF8, 0x0FF8, 0x0018, 0x0018, 0x000C, 0x03EC, 0x07FC, 0x0E1C, 0x1C00, 0x1800, 0x1800, 0x1800, 0x180C, 0x0C1C, 0x0E18, 0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '6' */ 0x0000, 0x07C0, 0x0FF0, 0x1C38, 0x1818, 0x0018, 0x000C, 0x03CC, 0x0FEC, 0x0E3C, 0x1C1C, 0x180C, 0x180C, 0x180C, 0x1C18, 0x0E38, 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '7' */ 0x0000, 0x1FFC, 0x1FFC, 0x0C00, 0x0600, 0x0600, 0x0300, 0x0380, 0x0180, 0x01C0, 0x00C0, 0x00E0, 0x0060, 0x0060, 0x0070, 0x0030, 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '8' */ 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x0C18, 0x0C18, 0x0638, 0x07F0, 0x07F0, 0x0C18, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C38, 0x0FF8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '9' */ 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C1C, 0x180C, 0x180C, 0x180C, 0x1C1C, 0x1E38, 0x1BF8, 0x19E0, 0x1800, 0x0C00, 0x0C00, 0x0E1C, 0x07F8, 0x01F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief ':' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief ';' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, 0x0000, /** * @brief '<' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1000, 0x1C00, 0x0F80, 0x03E0, 0x00F8, 0x0018, 0x00F8, 0x03E0, 0x0F80, 0x1C00, 0x1000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '=' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1FF8, 0x0000, 0x0000, 0x0000, 0x1FF8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '>' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0038, 0x01F0, 0x07C0, 0x1F00, 0x1800, 0x1F00, 0x07C0, 0x01F0, 0x0038, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '?' */ 0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '@' */ 0x0000, 0x0000, 0x07E0, 0x1818, 0x2004, 0x29C2, 0x4A22, 0x4411, 0x4409, 0x4409, 0x4409, 0x2209, 0x1311, 0x0CE2, 0x4002, 0x2004, 0x1818, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'A' */ 0x0000, 0x0380, 0x0380, 0x06C0, 0x06C0, 0x06C0, 0x0C60, 0x0C60, 0x1830, 0x1830, 0x1830, 0x3FF8, 0x3FF8, 0x701C, 0x600C, 0x600C, 0xC006, 0xC006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'B' */ 0x0000, 0x03FC, 0x0FFC, 0x0C0C, 0x180C, 0x180C, 0x180C, 0x0C0C, 0x07FC, 0x0FFC, 0x180C, 0x300C, 0x300C, 0x300C, 0x300C, 0x180C, 0x1FFC, 0x07FC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'C' */ 0x0000, 0x07C0, 0x1FF0, 0x3838, 0x301C, 0x700C, 0x6006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x6006, 0x700C, 0x301C, 0x1FF0, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'D' */ 0x0000, 0x03FE, 0x0FFE, 0x0E06, 0x1806, 0x1806, 0x3006, 0x3006, 0x3006, 0x3006, 0x3006, 0x3006, 0x3006, 0x1806, 0x1806, 0x0E06, 0x0FFE, 0x03FE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'E' */ 0x0000, 0x3FFC, 0x3FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x1FFC, 0x1FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x3FFC, 0x3FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'F' */ 0x0000, 0x3FF8, 0x3FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'G' */ 0x0000, 0x0FE0, 0x3FF8, 0x783C, 0x600E, 0xE006, 0xC007, 0x0003, 0x0003, 0xFE03, 0xFE03, 0xC003, 0xC007, 0xC006, 0xC00E, 0xF03C, 0x3FF8, 0x0FE0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'H' */ 0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x3FFC, 0x3FFC, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'I' */ 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'J' */ 0x0000, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0618, 0x0618, 0x0738, 0x03F0, 0x01E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'K' */ 0x0000, 0x3006, 0x1806, 0x0C06, 0x0606, 0x0306, 0x0186, 0x00C6, 0x0066, 0x0076, 0x00DE, 0x018E, 0x0306, 0x0606, 0x0C06, 0x1806, 0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'L' */ 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x1FF8, 0x1FF8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'M' */ 0x0000, 0xE00E, 0xF01E, 0xF01E, 0xF01E, 0xD836, 0xD836, 0xD836, 0xD836, 0xCC66, 0xCC66, 0xCC66, 0xC6C6, 0xC6C6, 0xC6C6, 0xC6C6, 0xC386, 0xC386, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'N' */ 0x0000, 0x300C, 0x301C, 0x303C, 0x303C, 0x306C, 0x306C, 0x30CC, 0x30CC, 0x318C, 0x330C, 0x330C, 0x360C, 0x360C, 0x3C0C, 0x3C0C, 0x380C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'O' */ 0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0x6006, 0x700E, 0x381C, 0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'P' */ 0x0000, 0x0FFC, 0x1FFC, 0x380C, 0x300C, 0x300C, 0x300C, 0x300C, 0x180C, 0x1FFC, 0x07FC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'Q' */ 0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xE003, 0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0xE007, 0x6306, 0x3F0E, 0x3C1C, 0x3FF8, 0xF7E0, 0xC000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'R' */ 0x0000, 0x0FFE, 0x1FFE, 0x3806, 0x3006, 0x3006, 0x3006, 0x3806, 0x1FFE, 0x07FE, 0x0306, 0x0606, 0x0C06, 0x1806, 0x1806, 0x3006, 0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'S' */ 0x0000, 0x03E0, 0x0FF8, 0x0C1C, 0x180C, 0x180C, 0x000C, 0x001C, 0x03F8, 0x0FE0, 0x1E00, 0x3800, 0x3006, 0x3006, 0x300E, 0x1C1C, 0x0FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'T' */ 0x0000, 0x7FFE, 0x7FFE, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'U' */ 0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x1818, 0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'V' */ 0x0000, 0x6003, 0x3006, 0x3006, 0x3006, 0x180C, 0x180C, 0x180C, 0x0C18, 0x0C18, 0x0E38, 0x0630, 0x0630, 0x0770, 0x0360, 0x0360, 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'W' */ 0x0000, 0x6003, 0x61C3, 0x61C3, 0x61C3, 0x3366, 0x3366, 0x3366, 0x3366, 0x3366, 0x3366, 0x1B6C, 0x1B6C, 0x1B6C, 0x1A2C, 0x1E3C, 0x0E38, 0x0E38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'X' */ 0x0000, 0xE00F, 0x700C, 0x3018, 0x1830, 0x0C70, 0x0E60, 0x07C0, 0x0380, 0x0380, 0x03C0, 0x06E0, 0x0C70, 0x1C30, 0x1818, 0x300C, 0x600E, 0xE007, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'Y' */ 0x0000, 0xC003, 0x6006, 0x300C, 0x381C, 0x1838, 0x0C30, 0x0660, 0x07E0, 0x03C0, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'Z' */ 0x0000, 0x7FFC, 0x7FFC, 0x6000, 0x3000, 0x1800, 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 0x000C, 0x0006, 0x7FFE, 0x7FFE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '[' */ 0x0000, 0x03E0, 0x03E0, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x03E0, 0x03E0, 0x0000, /** * @brief '\' */ 0x0000, 0x0030, 0x0030, 0x0060, 0x0060, 0x0060, 0x00C0, 0x00C0, 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0300, 0x0300, 0x0300, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief ']' */ 0x0000, 0x03E0, 0x03E0, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x03E0, 0x03E0, 0x0000, /** * @brief '^' */ 0x0000, 0x0000, 0x01C0, 0x01C0, 0x0360, 0x0360, 0x0360, 0x0630, 0x0630, 0x0C18, 0x0C18, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '_' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief ''' */ 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'a' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03F0, 0x07F8, 0x0C1C, 0x0C0C, 0x0F00, 0x0FF0, 0x0CF8, 0x0C0C, 0x0C0C, 0x0F1C, 0x0FF8, 0x18F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'b' */ 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x03D8, 0x0FF8, 0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38, 0x0FF8, 0x03D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'c' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x07F0, 0x0E30, 0x0C18, 0x0018, 0x0018, 0x0018, 0x0018, 0x0C18, 0x0E30, 0x07F0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'd' */ 0x0000, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x1BC0, 0x1FF0, 0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30, 0x1FF0, 0x1BC0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'e' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0, 0x0C30, 0x1818, 0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x1838, 0x1C30, 0x0FF0, 0x07C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'f' */ 0x0000, 0x0F80, 0x0FC0, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'g' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0DE0, 0x0FF8, 0x0E18, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0E18, 0x0FF8, 0x0DE0, 0x0C00, 0x0C0C, 0x061C, 0x07F8, 0x01F0, 0x0000, /** * @brief 'h' */ 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x07D8, 0x0FF8, 0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'i' */ 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'j' */ 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00F8, 0x0078, 0x0000, /** * @brief 'k' */ 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0C0C, 0x060C, 0x030C, 0x018C, 0x00CC, 0x006C, 0x00FC, 0x019C, 0x038C, 0x030C, 0x060C, 0x0C0C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'l' */ 0x0000, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'm' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3C7C, 0x7EFF, 0xE3C7, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'n' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0798, 0x0FF8, 0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'o' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0, 0x0C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C30, 0x0FF0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'p' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03D8, 0x0FF8, 0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38, 0x0FF8, 0x03D8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0000, /** * @brief 'q' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1BC0, 0x1FF0, 0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30, 0x1FF0, 0x1BC0, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x0000, /** * @brief 'r' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07B0, 0x03F0, 0x0070, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 's' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03E0, 0x03F0, 0x0E38, 0x0C18, 0x0038, 0x03F0, 0x07C0, 0x0C00, 0x0C18, 0x0E38, 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 't' */ 0x0000, 0x0000, 0x0080, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x07C0, 0x0780, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'u' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C38, 0x1FF0, 0x19E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'v' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x180C, 0x0C18, 0x0C18, 0x0C18, 0x0630, 0x0630, 0x0630, 0x0360, 0x0360, 0x0360, 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'w' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41C1, 0x41C1, 0x61C3, 0x6363, 0x6363, 0x6363, 0x3636, 0x3636, 0x3636, 0x1C1C, 0x1C1C, 0x1C1C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'x' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x381C, 0x1C38, 0x0C30, 0x0660, 0x0360, 0x0360, 0x0360, 0x0360, 0x0660, 0x0C30, 0x1C38, 0x381C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief 'y' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3018, 0x1830, 0x1830, 0x1870, 0x0C60, 0x0C60, 0x0CE0, 0x06C0, 0x06C0, 0x0380, 0x0380, 0x0380, 0x0180, 0x0180, 0x01C0, 0x00F0, 0x0070, 0x0000, /** * @brief 'z' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1FFC, 0x1FFC, 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /** * @brief '{' */ 0x0000, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0060, 0x0060, 0x0030, 0x0060, 0x0040, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0000, 0x0000, /** * @brief '|' */ 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, /** * @brief '}' */ 0x0000, 0x0060, 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0300, 0x0300, 0x0600, 0x0300, 0x0100, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0000, 0x0000, /** * @brief '~' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x10F0, 0x1FF8, 0x0F08, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}; const uint16_t ASCII12x12_Table [] = { 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x0000,0x2000,0x0000,0x0000, 0x0000,0x5000,0x5000,0x5000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0900,0x0900,0x1200,0x7f00,0x1200,0x7f00,0x1200,0x2400,0x2400,0x0000,0x0000, 0x1000,0x3800,0x5400,0x5000,0x5000,0x3800,0x1400,0x5400,0x5400,0x3800,0x1000,0x0000, 0x0000,0x3080,0x4900,0x4900,0x4a00,0x32c0,0x0520,0x0920,0x0920,0x10c0,0x0000,0x0000, 0x0000,0x0c00,0x1200,0x1200,0x1400,0x1800,0x2500,0x2300,0x2300,0x1d80,0x0000,0x0000, 0x0000,0x4000,0x4000,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0800,0x1000,0x1000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x1000,0x1000, 0x0000,0x4000,0x2000,0x2000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x2000,0x2000, 0x0000,0x2000,0x7000,0x2000,0x5000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0800,0x0800,0x7f00,0x0800,0x0800,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,0x2000,0x4000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,0x0000,0x0000, 0x0000,0x1000,0x1000,0x1000,0x2000,0x2000,0x2000,0x2000,0x4000,0x4000,0x0000,0x0000, 0x0000,0x1000,0x2800,0x4400,0x4400,0x4400,0x4400,0x4400,0x2800,0x1000,0x0000,0x0000, 0x0000,0x1000,0x3000,0x5000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x0000,0x0000, 0x0000,0x3000,0x4800,0x4400,0x0400,0x0800,0x1000,0x2000,0x4000,0x7c00,0x0000,0x0000, 0x0000,0x3000,0x4800,0x0400,0x0800,0x1000,0x0800,0x4400,0x4800,0x3000,0x0000,0x0000, 0x0000,0x0800,0x1800,0x1800,0x2800,0x2800,0x4800,0x7c00,0x0800,0x0800,0x0000,0x0000, 0x0000,0x3c00,0x2000,0x4000,0x7000,0x4800,0x0400,0x4400,0x4800,0x3000,0x0000,0x0000, 0x0000,0x1800,0x2400,0x4000,0x5000,0x6800,0x4400,0x4400,0x2800,0x1000,0x0000,0x0000, 0x0000,0x7c00,0x0400,0x0800,0x1000,0x1000,0x1000,0x2000,0x2000,0x2000,0x0000,0x0000, 0x0000,0x1000,0x2800,0x4400,0x2800,0x1000,0x2800,0x4400,0x2800,0x1000,0x0000,0x0000, 0x0000,0x1000,0x2800,0x4400,0x4400,0x2c00,0x1400,0x0400,0x4800,0x3000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,0x2000,0x4000, 0x0000,0x0000,0x0400,0x0800,0x3000,0x4000,0x3000,0x0800,0x0400,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x7c00,0x0000,0x0000,0x7c00,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x4000,0x2000,0x1800,0x0400,0x1800,0x2000,0x4000,0x0000,0x0000,0x0000, 0x0000,0x3800,0x6400,0x4400,0x0400,0x0800,0x1000,0x1000,0x0000,0x1000,0x0000,0x0000, 0x0000,0x0f80,0x1040,0x2ea0,0x51a0,0x5120,0x5120,0x5120,0x5320,0x4dc0,0x2020,0x1040, 0x0000,0x0800,0x1400,0x1400,0x1400,0x2200,0x3e00,0x2200,0x4100,0x4100,0x0000,0x0000, 0x0000,0x3c00,0x2200,0x2200,0x2200,0x3c00,0x2200,0x2200,0x2200,0x3c00,0x0000,0x0000, 0x0000,0x0e00,0x1100,0x2100,0x2000,0x2000,0x2000,0x2100,0x1100,0x0e00,0x0000,0x0000, 0x0000,0x3c00,0x2200,0x2100,0x2100,0x2100,0x2100,0x2100,0x2200,0x3c00,0x0000,0x0000, 0x0000,0x3e00,0x2000,0x2000,0x2000,0x3e00,0x2000,0x2000,0x2000,0x3e00,0x0000,0x0000, 0x0000,0x3e00,0x2000,0x2000,0x2000,0x3c00,0x2000,0x2000,0x2000,0x2000,0x0000,0x0000, 0x0000,0x0e00,0x1100,0x2100,0x2000,0x2700,0x2100,0x2100,0x1100,0x0e00,0x0000,0x0000, 0x0000,0x2100,0x2100,0x2100,0x2100,0x3f00,0x2100,0x2100,0x2100,0x2100,0x0000,0x0000, 0x0000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x0000,0x0000, 0x0000,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x4800,0x4800,0x3000,0x0000,0x0000, 0x0000,0x2200,0x2400,0x2800,0x2800,0x3800,0x2800,0x2400,0x2400,0x2200,0x0000,0x0000, 0x0000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x3e00,0x0000,0x0000, 0x0000,0x2080,0x3180,0x3180,0x3180,0x2a80,0x2a80,0x2a80,0x2a80,0x2480,0x0000,0x0000, 0x0000,0x2100,0x3100,0x3100,0x2900,0x2900,0x2500,0x2300,0x2300,0x2100,0x0000,0x0000, 0x0000,0x0c00,0x1200,0x2100,0x2100,0x2100,0x2100,0x2100,0x1200,0x0c00,0x0000,0x0000, 0x0000,0x3c00,0x2200,0x2200,0x2200,0x3c00,0x2000,0x2000,0x2000,0x2000,0x0000,0x0000, 0x0000,0x0c00,0x1200,0x2100,0x2100,0x2100,0x2100,0x2100,0x1600,0x0d00,0x0100,0x0000, 0x0000,0x3e00,0x2100,0x2100,0x2100,0x3e00,0x2400,0x2200,0x2100,0x2080,0x0000,0x0000, 0x0000,0x1c00,0x2200,0x2200,0x2000,0x1c00,0x0200,0x2200,0x2200,0x1c00,0x0000,0x0000, 0x0000,0x3e00,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0000,0x0000, 0x0000,0x2100,0x2100,0x2100,0x2100,0x2100,0x2100,0x2100,0x1200,0x0c00,0x0000,0x0000, 0x0000,0x4100,0x4100,0x2200,0x2200,0x2200,0x1400,0x1400,0x1400,0x0800,0x0000,0x0000, 0x0000,0x4440,0x4a40,0x2a40,0x2a80,0x2a80,0x2a80,0x2a80,0x2a80,0x1100,0x0000,0x0000, 0x0000,0x4100,0x2200,0x1400,0x1400,0x0800,0x1400,0x1400,0x2200,0x4100,0x0000,0x0000, 0x0000,0x4100,0x2200,0x2200,0x1400,0x0800,0x0800,0x0800,0x0800,0x0800,0x0000,0x0000, 0x0000,0x7e00,0x0200,0x0400,0x0800,0x1000,0x1000,0x2000,0x4000,0x7e00,0x0000,0x0000, 0x0000,0x3000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000, 0x0000,0x4000,0x4000,0x2000,0x2000,0x2000,0x2000,0x2000,0x1000,0x1000,0x0000,0x0000, 0x0000,0x6000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000, 0x0000,0x1000,0x2800,0x2800,0x2800,0x4400,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7e00, 0x4000,0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x3800,0x4400,0x0400,0x3c00,0x4400,0x4400,0x3c00,0x0000,0x0000, 0x0000,0x4000,0x4000,0x5800,0x6400,0x4400,0x4400,0x4400,0x6400,0x5800,0x0000,0x0000, 0x0000,0x0000,0x0000,0x3000,0x4800,0x4000,0x4000,0x4000,0x4800,0x3000,0x0000,0x0000, 0x0000,0x0400,0x0400,0x3400,0x4c00,0x4400,0x4400,0x4400,0x4c00,0x3400,0x0000,0x0000, 0x0000,0x0000,0x0000,0x3800,0x4400,0x4400,0x7c00,0x4000,0x4400,0x3800,0x0000,0x0000, 0x0000,0x6000,0x4000,0xe000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x3400,0x4c00,0x4400,0x4400,0x4400,0x4c00,0x3400,0x0400,0x4400, 0x0000,0x4000,0x4000,0x5800,0x6400,0x4400,0x4400,0x4400,0x4400,0x4400,0x0000,0x0000, 0x0000,0x4000,0x0000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x0000,0x0000, 0x0000,0x4000,0x0000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000, 0x0000,0x4000,0x4000,0x4800,0x5000,0x6000,0x5000,0x5000,0x4800,0x4800,0x0000,0x0000, 0x0000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x5200,0x6d00,0x4900,0x4900,0x4900,0x4900,0x4900,0x0000,0x0000, 0x0000,0x0000,0x0000,0x5800,0x6400,0x4400,0x4400,0x4400,0x4400,0x4400,0x0000,0x0000, 0x0000,0x0000,0x0000,0x3800,0x4400,0x4400,0x4400,0x4400,0x4400,0x3800,0x0000,0x0000, 0x0000,0x0000,0x0000,0x5800,0x6400,0x4400,0x4400,0x4400,0x6400,0x5800,0x4000,0x4000, 0x0000,0x0000,0x0000,0x3400,0x4c00,0x4400,0x4400,0x4400,0x4c00,0x3400,0x0400,0x0400, 0x0000,0x0000,0x0000,0x5000,0x6000,0x4000,0x4000,0x4000,0x4000,0x4000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x3000,0x4800,0x4000,0x3000,0x0800,0x4800,0x3000,0x0000,0x0000, 0x0000,0x4000,0x4000,0xe000,0x4000,0x4000,0x4000,0x4000,0x4000,0x6000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x4400,0x4400,0x4400,0x4400,0x4400,0x4c00,0x3400,0x0000,0x0000, 0x0000,0x0000,0x0000,0x4400,0x4400,0x2800,0x2800,0x2800,0x2800,0x1000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x4900,0x4900,0x5500,0x5500,0x5500,0x5500,0x2200,0x0000,0x0000, 0x0000,0x0000,0x0000,0x4400,0x2800,0x2800,0x1000,0x2800,0x2800,0x4400,0x0000,0x0000, 0x0000,0x0000,0x0000,0x4400,0x4400,0x2800,0x2800,0x2800,0x1000,0x1000,0x1000,0x1000, 0x0000,0x0000,0x0000,0x7800,0x0800,0x1000,0x2000,0x2000,0x4000,0x7800,0x0000,0x0000, 0x0000,0x1000,0x2000,0x2000,0x2000,0x2000,0x4000,0x2000,0x2000,0x2000,0x2000,0x2000, 0x0000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000, 0x0000,0x4000,0x2000,0x2000,0x2000,0x2000,0x1000,0x2000,0x2000,0x2000,0x2000,0x2000, 0x0000,0x0000,0x0000,0x0000,0x7400,0x5800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x7000,0x5000,0x5000,0x5000,0x5000,0x5000,0x5000,0x7000,0x0000,0x0000}; const uint16_t ASCII8x12_Table [] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00, 0x00,0x00,0x00,0x28,0x28,0x28,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x14,0x14,0x3e,0x14,0x28,0x7c,0x28,0x28,0x00, 0x00,0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x14,0x54,0x38,0x10, 0x00,0x00,0x00,0x44,0xa8,0xa8,0x50,0x14,0x1a,0x2a,0x24,0x00, 0x00,0x00,0x00,0x20,0x50,0x50,0x20,0xe8,0x98,0x98,0x60,0x00, 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, 0x00,0x00,0x00,0x40,0xe0,0x40,0xa0,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, 0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x80,0x00, 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, 0x00,0x00,0x00,0x20,0x60,0xa0,0x20,0x20,0x20,0x20,0x20,0x00, 0x00,0x00,0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x80,0xf0,0x00, 0x00,0x00,0x00,0x60,0x90,0x10,0x60,0x10,0x10,0x90,0x60,0x00, 0x00,0x00,0x00,0x10,0x30,0x50,0x50,0x90,0xf8,0x10,0x10,0x00, 0x00,0x00,0x00,0x70,0x40,0x80,0xe0,0x10,0x10,0x90,0x60,0x00, 0x00,0x00,0x00,0x60,0x90,0x80,0xa0,0xd0,0x90,0x90,0x60,0x00, 0x00,0x00,0x00,0xf0,0x10,0x20,0x20,0x20,0x40,0x40,0x40,0x00, 0x00,0x00,0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00, 0x00,0x00,0x00,0x60,0x90,0x90,0xb0,0x50,0x10,0x90,0x60,0x00, 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x40,0x00, 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x40,0x40, 0x00,0x00,0x00,0x00,0x00,0x10,0x60,0x80,0x60,0x10,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0xf0,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x10,0x60,0x80,0x00,0x00, 0x00,0x00,0x00,0x60,0x90,0x10,0x20,0x40,0x40,0x00,0x40,0x00, 0x00,0x00,0x00,0x1c,0x22,0x5b,0xa5,0xa5,0xa5,0xa5,0x9e,0x41, 0x00,0x00,0x00,0x20,0x50,0x50,0x50,0x50,0x70,0x88,0x88,0x00, 0x00,0x00,0x00,0xf0,0x88,0x88,0xf0,0x88,0x88,0x88,0xf0,0x00, 0x00,0x00,0x00,0x38,0x44,0x84,0x80,0x80,0x84,0x44,0x38,0x00, 0x00,0x00,0x00,0xe0,0x90,0x88,0x88,0x88,0x88,0x90,0xe0,0x00, 0x00,0x00,0x00,0xf8,0x80,0x80,0xf8,0x80,0x80,0x80,0xf8,0x00, 0x00,0x00,0x00,0x78,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x00, 0x00,0x00,0x00,0x38,0x44,0x84,0x80,0x9c,0x84,0x44,0x38,0x00, 0x00,0x00,0x00,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x88,0x00, 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x90,0x90,0x60,0x00, 0x00,0x00,0x00,0x88,0x90,0xa0,0xe0,0xa0,0x90,0x90,0x88,0x00, 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf0,0x00, 0x00,0x00,0x00,0x82,0xc6,0xc6,0xaa,0xaa,0xaa,0xaa,0x92,0x00, 0x00,0x00,0x00,0x84,0xc4,0xa4,0xa4,0x94,0x94,0x8c,0x84,0x00, 0x00,0x00,0x00,0x30,0x48,0x84,0x84,0x84,0x84,0x48,0x30,0x00, 0x00,0x00,0x00,0xf0,0x88,0x88,0x88,0xf0,0x80,0x80,0x80,0x00, 0x00,0x00,0x00,0x30,0x48,0x84,0x84,0x84,0x84,0x58,0x34,0x04, 0x00,0x00,0x00,0x78,0x44,0x44,0x78,0x50,0x48,0x44,0x42,0x00, 0x00,0x00,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x88,0x70,0x00, 0x00,0x00,0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, 0x00,0x00,0x00,0x84,0x84,0x84,0x84,0x84,0x84,0x48,0x30,0x00, 0x00,0x00,0x00,0x88,0x88,0x50,0x50,0x50,0x50,0x50,0x20,0x00, 0x00,0x00,0x00,0x92,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0x44,0x00, 0x00,0x00,0x00,0x84,0x48,0x48,0x30,0x30,0x48,0x48,0x84,0x00, 0x00,0x00,0x00,0x88,0x50,0x50,0x20,0x20,0x20,0x20,0x20,0x00, 0x00,0x00,0x00,0xf8,0x08,0x10,0x20,0x20,0x40,0x80,0xf8,0x00, 0x00,0x00,0x00,0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x40,0x40,0x20,0x20,0x00, 0x00,0x00,0x00,0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, 0x00,0x00,0x00,0x40,0xa0,0xa0,0xa0,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8, 0x00,0x00,0x00,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0xe0,0x10,0x70,0x90,0x90,0x70,0x00, 0x00,0x00,0x00,0x80,0x80,0xa0,0xd0,0x90,0x90,0xd0,0xa0,0x00, 0x00,0x00,0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00, 0x00,0x00,0x00,0x10,0x10,0x50,0xb0,0x90,0x90,0xb0,0x50,0x00, 0x00,0x00,0x00,0x00,0x00,0x60,0x90,0xf0,0x80,0x90,0x60,0x00, 0x00,0x00,0x00,0xc0,0x80,0xc0,0x80,0x80,0x80,0x80,0x80,0x00, 0x00,0x00,0x00,0x00,0x00,0x50,0xb0,0x90,0x90,0xb0,0x50,0x10, 0x00,0x00,0x00,0x80,0x80,0xa0,0xd0,0x90,0x90,0x90,0x90,0x00, 0x00,0x00,0x00,0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00, 0x00,0x00,0x00,0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x00,0x00,0x00,0x80,0x80,0x90,0xa0,0xc0,0xa0,0x90,0x90,0x00, 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, 0x00,0x00,0x00,0x00,0x00,0xa6,0xda,0x92,0x92,0x92,0x92,0x00, 0x00,0x00,0x00,0x00,0x00,0xa0,0xd0,0x90,0x90,0x90,0x90,0x00, 0x00,0x00,0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00, 0x00,0x00,0x00,0x00,0x00,0xa0,0xd0,0x90,0x90,0xd0,0xa0,0x80, 0x00,0x00,0x00,0x00,0x00,0x50,0xb0,0x90,0x90,0xb0,0x50,0x10, 0x00,0x00,0x00,0x00,0x00,0xa0,0xc0,0x80,0x80,0x80,0x80,0x00, 0x00,0x00,0x00,0x00,0x00,0xe0,0x90,0x40,0x20,0x90,0x60,0x00, 0x00,0x00,0x00,0x80,0x80,0xc0,0x80,0x80,0x80,0x80,0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x90,0x90,0x90,0x90,0xb0,0x50,0x00, 0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x50,0x50,0x50,0x20,0x00, 0x00,0x00,0x00,0x00,0x00,0x92,0xaa,0xaa,0xaa,0xaa,0x44,0x00, 0x00,0x00,0x00,0x00,0x00,0x88,0x50,0x20,0x20,0x50,0x88,0x00, 0x00,0x00,0x00,0x00,0x00,0x88,0x50,0x50,0x50,0x20,0x20,0x20, 0x00,0x00,0x00,0x00,0x00,0xf0,0x10,0x20,0x40,0x80,0xf0,0x00, 0x00,0x00,0x00,0xc0,0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x80, 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x00,0x00,0x00,0xc0,0x40,0x40,0x40,0x20,0x40,0x40,0x40,0x40, 0x00,0x00,0x00,0x00,0x00,0x00,0xe8,0xb0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xe0,0xa0,0xa0,0xa0,0xa0,0xa0,0xe0,0x00}; const uint16_t ASCII8x8_Table [] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x40, 0xa0, 0xa0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0xfe, 0x48, 0xfc, 0x48, 0x48, 0x38, 0x54, 0x50, 0x38, 0x14, 0x14, 0x54, 0x38, 0x44, 0xa8, 0xa8, 0x50, 0x14, 0x1a, 0x2a, 0x24, 0x10, 0x28, 0x28, 0x10, 0x74, 0x4c, 0x4c, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00, 0x24, 0x18, 0x3c, 0x18, 0x24, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x08, 0x18, 0x28, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x44, 0x00, 0x04, 0x08, 0x10, 0x20, 0x7c, 0x18, 0x24, 0x04, 0x18, 0x04, 0x04, 0x24, 0x18, 0x04, 0x0c, 0x14, 0x24, 0x44, 0x7e, 0x04, 0x04, 0x3c, 0x20, 0x20, 0x38, 0x04, 0x04, 0x24, 0x18, 0x18, 0x24, 0x20, 0x38, 0x24, 0x24, 0x24, 0x18, 0x3c, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x10, 0x18, 0x24, 0x24, 0x18, 0x24, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x24, 0x1c, 0x04, 0x24, 0x18, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x04, 0x18, 0x20, 0x18, 0x04, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x20, 0x18, 0x04, 0x18, 0x20, 0x00, 0x18, 0x24, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10, 0x3c, 0x42, 0x99, 0xa5, 0xa5, 0x9d, 0x42, 0x38, 0x38, 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x78, 0x1c, 0x22, 0x42, 0x40, 0x40, 0x42, 0x22, 0x1c, 0x70, 0x48, 0x44, 0x44, 0x44, 0x44, 0x48, 0x70, 0x7c, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x7c, 0x3c, 0x20, 0x20, 0x38, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x22, 0x42, 0x40, 0x4e, 0x42, 0x22, 0x1c, 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x04, 0x04, 0x04, 0x04, 0x04, 0x24, 0x24, 0x18, 0x44, 0x48, 0x50, 0x70, 0x50, 0x48, 0x48, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x82, 0xc6, 0xc6, 0xaa, 0xaa, 0xaa, 0xaa, 0x92, 0x42, 0x62, 0x52, 0x52, 0x4a, 0x4a, 0x46, 0x42, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x2c, 0x1a, 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x42, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x44, 0x38, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x44, 0x44, 0x28, 0x28, 0x28, 0x28, 0x28, 0x10, 0x92, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x42, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x42, 0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x04, 0x08, 0x10, 0x10, 0x20, 0x40, 0x7c, 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1c, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x1c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x1c, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x04, 0x1c, 0x24, 0x24, 0x1c, 0x20, 0x20, 0x28, 0x34, 0x24, 0x24, 0x34, 0x28, 0x00, 0x00, 0x18, 0x24, 0x20, 0x20, 0x24, 0x18, 0x04, 0x04, 0x14, 0x2c, 0x24, 0x24, 0x2c, 0x14, 0x00, 0x00, 0x18, 0x24, 0x3c, 0x20, 0x24, 0x18, 0x00, 0x18, 0x10, 0x10, 0x18, 0x10, 0x10, 0x10, 0x00, 0x18, 0x24, 0x24, 0x18, 0x04, 0x24, 0x18, 0x20, 0x20, 0x28, 0x34, 0x24, 0x24, 0x24, 0x24, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x08, 0x08, 0x08, 0x08, 0x28, 0x10, 0x20, 0x20, 0x24, 0x28, 0x30, 0x28, 0x24, 0x24, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0xa6, 0xda, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, 0x28, 0x34, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x28, 0x34, 0x24, 0x38, 0x20, 0x20, 0x20, 0x00, 0x14, 0x2c, 0x24, 0x1c, 0x04, 0x04, 0x04, 0x00, 0x00, 0x2c, 0x30, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x18, 0x24, 0x10, 0x08, 0x24, 0x18, 0x00, 0x10, 0x38, 0x10, 0x10, 0x10, 0x10, 0x18, 0x00, 0x00, 0x24, 0x24, 0x24, 0x24, 0x2c, 0x14, 0x00, 0x00, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x00, 0x00, 0x92, 0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x00, 0x00, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, 0x00, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x3c, 0x04, 0x08, 0x10, 0x20, 0x3c, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x08, 0x08, 0x04, 0x08, 0x08, 0x10, 0x00, 0x00, 0x00, 0x60, 0x92, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; const uint16_t Avenir_Table [] = { 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (0) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (1) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (2) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (3) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (4) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (5) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (6) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (7) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (8) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (9) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (10) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (11) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (12) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (13) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (14) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (15) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (16) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (17) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (18) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (19) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (20) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (21) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (22) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (23) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (24) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (25) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (26) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (27) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (28) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (29) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (30) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (31) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // (32) 0x0000,0x0000,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0000,0x0000,0x0002,0x0007,0x0007,0x0003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // ! (33) 0x0000,0x0000,0x00f8,0x01fc,0x038e,0x0306,0x0306,0x0301,0x0300,0x0180,0x01c0,0x00e0,0x0070,0x0038,0x0018,0x0018,0x0018,0x0000,0x0000,0x0010,0x0038,0x0038,0x0018,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // " (34) 0x0000,0x0000,0x0198,0x0098,0x0098,0x00c8,0x00c8,0x00cc,0x03ff,0x03ff,0x00cc,0x00cc,0x00cc,0x004c,0x01ff,0x01ff,0x0064,0x0064,0x0066,0x0066,0x0066,0x0066,0x0066,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // # (35) 0x0060,0x0060,0x01f8,0x07fc,0x066c,0x0266,0x0066,0x0066,0x0066,0x006e,0x007c,0x00fc,0x01f8,0x03e0,0x0760,0x0660,0x0660,0x0660,0x0660,0x0662,0x0366,0x03ff,0x01fc,0x0060,0x0060,0x0000,0x0000,0x0000,0x0000,0x0000, // $ (36) 0x0000,0x1000,0x303c,0x107c,0x18e4,0x18c0,0x0cc0,0x0cc0,0x04c0,0x06e4,0x067c,0x033c,0xf300,0xf900,0x9981,0x0d81,0x0cc3,0x0cc3,0x0c43,0x0c63,0x9863,0xf831,0xf031,0x0020,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // % (37) 0x0000,0x0000,0x01f0,0x03f8,0x0718,0x060c,0x060c,0x060c,0x060c,0x0318,0x01d8,0x00f0,0x70fc,0x38e6,0x19e6,0x1fc3,0x0f83,0x0f83,0x0f03,0x1f87,0x3fc6,0x39fe,0x70f8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // & (38) 0x0000,0x0000,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // ' (39) 0x0000,0x0008,0x0018,0x001c,0x000c,0x000e,0x0006,0x0006,0x0006,0x0007,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0006,0x0006,0x0006,0x0006,0x000c,0x000c,0x001c,0x0018,0x0000,0x0000, // ( (40) 0x0000,0x0002,0x0003,0x0006,0x0006,0x000e,0x000c,0x000c,0x000c,0x001c,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x000c,0x000c,0x000c,0x000c,0x0006,0x0006,0x0007,0x0003,0x0000,0x0000, // ) (41) 0x0000,0x0000,0x0030,0x0030,0x0030,0x0333,0x03ff,0x01fc,0x0078,0x0078,0x00cc,0x01ce,0x0084,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // * (42) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0xffff,0xffff,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // + (43) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x000c,0x000e,0x0006,0x0006,0x0006,0x0006,0x0003,0x0003,0x0000,0x0000,0x0000, // , (44) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x001f,0x001f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // - (45) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0002,0x0007,0x0007,0x0003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // . (46) 0x0060,0x0060,0x0060,0x0020,0x0030,0x0030,0x0030,0x0010,0x0018,0x0018,0x0018,0x0018,0x0008,0x000c,0x000c,0x000c,0x0004,0x0006,0x0006,0x0006,0x0006,0x0003,0x0003,0x0003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // / (47) 0x0000,0x0000,0x00f0,0x01f8,0x030c,0x0606,0x0606,0x0606,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0606,0x0606,0x0606,0x030c,0x03fc,0x00f0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 0 (48) 0x0000,0x0000,0x0070,0x0078,0x007c,0x006f,0x0067,0x0062,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 1 (49) 0x0000,0x0000,0x00f8,0x01fe,0x018e,0x0307,0x0303,0x0300,0x0300,0x0300,0x0380,0x0180,0x01c0,0x00e0,0x00f0,0x0070,0x0038,0x001c,0x001e,0x000e,0x0007,0x03ff,0x03ff,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 2 (50) 0x0000,0x0000,0x01f0,0x03fc,0x031e,0x060c,0x0600,0x0600,0x0600,0x0700,0x0380,0x01f0,0x01f0,0x0380,0x0700,0x0600,0x0600,0x0600,0x0602,0x0707,0x038e,0x03fe,0x00f8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 3 (51) 0x0000,0x0000,0x0380,0x03c0,0x03c0,0x03e0,0x0360,0x0370,0x0330,0x0338,0x0318,0x031c,0x030c,0x030e,0x0306,0x0307,0x1fff,0x1fff,0x0300,0x0300,0x0300,0x0300,0x0300,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 4 (52) 0x0000,0x0000,0x03fc,0x03fc,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x01fc,0x03fc,0x0384,0x0700,0x0600,0x0600,0x0600,0x0600,0x0604,0x0707,0x038e,0x03fc,0x00f8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 5 (53) 0x0000,0x0000,0x01c0,0x00e0,0x00e0,0x0070,0x0070,0x0038,0x0038,0x001c,0x01ec,0x03fe,0x070e,0x0e07,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0606,0x070e,0x03fc,0x01f8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 6 (54) 0x0000,0x0000,0x07ff,0x07ff,0x0700,0x0700,0x0380,0x0380,0x0180,0x01c0,0x01c0,0x00e0,0x00e0,0x00e0,0x0070,0x0070,0x0070,0x0038,0x0038,0x0018,0x001c,0x001c,0x000e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 7 (55) 0x0000,0x0000,0x0078,0x01fe,0x0186,0x0303,0x0303,0x0303,0x0303,0x0387,0x0186,0x00fc,0x00fc,0x0186,0x0387,0x0303,0x0303,0x0303,0x0303,0x0387,0x0186,0x01fe,0x0078,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 8 (56) 0x0000,0x0000,0x01f0,0x03fc,0x070e,0x0606,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0e07,0x070e,0x07fc,0x0378,0x0380,0x0180,0x01c0,0x00c0,0x00e0,0x0060,0x0070,0x0038,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 9 (57) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0002,0x0007,0x0007,0x0007,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0002,0x0007,0x0007,0x0007,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // : (58) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0004,0x000e,0x000e,0x000e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x000e,0x000e,0x0006,0x0006,0x0006,0x0003,0x0003,0x0003,0x0000,0x0000,0x0000, // ; (59) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x4000,0x7000,0x7c00,0x1f00,0x07e0,0x01f8,0x007e,0x001f,0x001f,0x007e,0x01f8,0x07e0,0x1f00,0x7c00,0x7000,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // < (60) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xffff,0xffff,0x0000,0x0000,0x0000,0xffff,0xffff,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // = (61) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,0x0007,0x001f,0x007c,0x03f0,0x0fc0,0x3f00,0x7c00,0x7c00,0x3f00,0x0fc0,0x03f0,0x007c,0x001f,0x0007,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // > (62) 0x0000,0x0000,0x00f8,0x01fc,0x038e,0x0306,0x0306,0x0301,0x0300,0x0180,0x01c0,0x00e0,0x0070,0x0038,0x0018,0x0018,0x0018,0x0000,0x0000,0x0010,0x0038,0x0038,0x0018,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // ? (63) 0x0000,0x0000,0x0fc0,0x3ff0,0x7838,0xe01c,0xc38e,0xdfc6,0x9c67,0x9c63,0x9c33,0x8c33,0x8c33,0x8c33,0xce33,0xce72,0x7fe6,0x39c6,0x400e,0xe01c,0x7078,0x3ff0,0x0fc0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // @ (64) 0x0000,0x0000,0x01e0,0x03e0,0x03e0,0x0360,0x0370,0x0730,0x0730,0x0630,0x0638,0x0e38,0x0e18,0x0e18,0x0c1c,0x1c1c,0x1ffc,0x1ffc,0x1c0e,0x380e,0x380e,0x3806,0x3807,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // A (65) 0x0000,0x0000,0x007f,0x01ff,0x01c3,0x0383,0x0303,0x0303,0x0303,0x0383,0x01c3,0x00ff,0x00ff,0x03c3,0x0383,0x0303,0x0303,0x0303,0x0303,0x0383,0x01c3,0x01ff,0x007f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // B (66) 0x0000,0x0000,0x03f0,0x07f8,0x0e1c,0x040e,0x0006,0x0006,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0006,0x0006,0x040e,0x0e1c,0x07f8,0x01f0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // C (67) 0x0000,0x0000,0x007f,0x01ff,0x0383,0x0703,0x0603,0x0603,0x0e03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0e03,0x0603,0x0603,0x0703,0x03c3,0x01ff,0x007f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // D (68) 0x0000,0x0000,0x00ff,0x00ff,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x00ff,0x00ff,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x01ff,0x01ff,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // E (69) 0x0000,0x0000,0x00ff,0x00ff,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x00ff,0x00ff,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // F (70) 0x0000,0x0000,0x03f0,0x07f8,0x0e1c,0x040e,0x0006,0x0006,0x0003,0x0003,0x0003,0x0003,0x1f03,0x1f03,0x1803,0x1803,0x1807,0x1806,0x1806,0x180c,0x183c,0x1ff8,0x07e0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // G (71) 0x0000,0x0000,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0fff,0x0fff,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // H (72) 0x0000,0x0000,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // I (73) 0x0000,0x0000,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0183,0x00c7,0x00fe,0x007c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // J (74) 0x0000,0x0000,0x0703,0x0383,0x0383,0x01c3,0x00e3,0x0063,0x0073,0x003b,0x001b,0x001f,0x001f,0x003b,0x003b,0x0073,0x00e3,0x00e3,0x01c3,0x03c3,0x0383,0x0703,0x0f03,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // K (75) 0x0000,0x0000,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x00ff,0x00ff,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // L (76) 0x0000,0x0000,0xe00e,0xe00f,0xf01f,0xf01f,0xf01f,0xb81b,0xb83b,0xb83b,0x983b,0x9c33,0x9c73,0x9c73,0x8c63,0x8e63,0x8ee3,0x86c3,0x86c3,0x87c3,0x87c3,0x8383,0x8383,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // M (77) 0x0000,0x0000,0x0c07,0x0c0f,0x0c0f,0x0c1f,0x0c1f,0x0c1f,0x0c3b,0x0c3b,0x0c73,0x0c73,0x0cf3,0x0ce3,0x0ce3,0x0dc3,0x0dc3,0x0f83,0x0f83,0x0f83,0x0f03,0x0f03,0x0e03,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // N (78) 0x0000,0x0000,0x01e0,0x07f8,0x0e1c,0x0c0e,0x1806,0x1806,0x3803,0x3003,0x3003,0x3003,0x3003,0x3003,0x3003,0x3003,0x3803,0x1806,0x1806,0x0c0c,0x0e1c,0x07f8,0x01e0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // O (79) 0x0000,0x0000,0x00ff,0x01ff,0x0383,0x0703,0x0603,0x0603,0x0603,0x0603,0x0703,0x0383,0x01ff,0x00ff,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // P (80) 0x0000,0x0000,0x01e0,0x07f8,0x0e1c,0x0c0c,0x1806,0x1806,0x3807,0x3003,0x3003,0x3003,0x3003,0x3003,0x3003,0x3003,0x1807,0x1806,0x1806,0x0c0c,0x061c,0x7ff8,0x7fe0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Q (81) 0x0000,0x0000,0x00ff,0x03ff,0x0383,0x0703,0x0603,0x0603,0x0603,0x0703,0x0783,0x03ff,0x01ff,0x00e3,0x00e3,0x01c3,0x01c3,0x0183,0x0383,0x0303,0x0703,0x0703,0x0603,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // R (82) 0x0000,0x0000,0x00f0,0x03fc,0x010c,0x0106,0x0006,0x0006,0x0006,0x000e,0x001c,0x003c,0x00f8,0x01e0,0x01c0,0x0380,0x0300,0x0300,0x0300,0x0302,0x0187,0x01ff,0x007c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // S (83) 0x0000,0x0000,0x03ff,0x03ff,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // T (84) 0x0000,0x0000,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0c03,0x0606,0x070e,0x03fc,0x01f8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // U (85) 0x0000,0x0000,0x3807,0x3806,0x380e,0x1c0e,0x1c0e,0x1c0c,0x1c1c,0x0c1c,0x0e1c,0x0e18,0x0e18,0x0638,0x0738,0x0730,0x0330,0x0370,0x0370,0x03e0,0x01e0,0x01e0,0x01e0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // V (86) 0x0000,0x0000,0x0c00,0x0e1c,0x0e1c,0x1e0c,0x1e0c,0x1e0c,0x170e,0x170e,0x1306,0x3306,0x3306,0x3307,0x3387,0x31a7,0x71a3,0x71a3,0xe1a3,0xe1e3,0xe0e3,0xe0e1,0xe0e1,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // W (87) 0x0000,0x0000,0x1c0e,0x1c0e,0x0e1c,0x0e1c,0x0638,0x0738,0x0330,0x03f0,0x01e0,0x01e0,0x01e0,0x01e0,0x03f0,0x0330,0x0738,0x0718,0x0e1c,0x0e1c,0x1c0e,0x1c0e,0x3807,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // X (88) 0x0000,0x0000,0x0e07,0x0e07,0x060e,0x070e,0x030c,0x031c,0x039c,0x0198,0x01f8,0x00f0,0x00f0,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Y (89) 0x0000,0x0000,0x03ff,0x03ff,0x0380,0x0380,0x01c0,0x01c0,0x00e0,0x00e0,0x0070,0x0070,0x0078,0x0038,0x0038,0x001c,0x001c,0x000e,0x000e,0x0007,0x0007,0x03ff,0x03ff,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Z (90) 0x0000,0x001f,0x001f,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x001f,0x001f,0x0000,0x0000, // [ (91) 0x0003,0x0003,0x0003,0x0002,0x0006,0x0006,0x0006,0x0004,0x000c,0x000c,0x000c,0x000c,0x0008,0x0018,0x0018,0x0018,0x0010,0x0030,0x0030,0x0030,0x0030,0x0060,0x0060,0x0060,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // \ (92) 0x0000,0x001f,0x001f,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x001f,0x001f,0x0000,0x0000, // ] (93) 0x0000,0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x0e70,0x0e70,0x1c38,0x1818,0x381c,0x700e,0x700e,0xe007,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // ^ (94) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0x7fff,0x0000,0x0000,0x0000, // _ (95) 0x0000,0x0000,0x0007,0x0006,0x000c,0x0018,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // ` (96) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x007c,0x00fe,0x00c7,0x0180,0x0180,0x0180,0x01f8,0x01fe,0x0186,0x0183,0x0183,0x01c3,0x01c7,0x01fe,0x01bc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // a (97) 0x0000,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0073,0x00ff,0x01cf,0x0187,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0187,0x01cf,0x00fb,0x007b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // b (98) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0078,0x00fe,0x004e,0x0006,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0007,0x004e,0x00fe,0x0078,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // c (99) 0x0000,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x0678,0x07fc,0x078e,0x0706,0x0603,0x0603,0x0603,0x0603,0x0603,0x0603,0x0603,0x0706,0x078e,0x06fc,0x0678,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // d (100) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0078,0x01fc,0x018e,0x0306,0x0303,0x0303,0x03ff,0x03ff,0x0003,0x0003,0x0003,0x0106,0x038e,0x01fc,0x00f8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // e (101) 0x0070,0x0078,0x001c,0x000c,0x000c,0x000c,0x000c,0x000c,0x003f,0x003f,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // f (102) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0010,0x06fc,0x07fe,0x078e,0x0706,0x0603,0x0603,0x0603,0x0603,0x0603,0x0603,0x0603,0x0706,0x078e,0x06fc,0x0678,0x0600,0x0600,0x0600,0x0302,0x038f,0x01fe,0x00fc, // g (103) 0x0000,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x00f3,0x01fb,0x038f,0x0307,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // h (104) 0x0000,0x0000,0x0002,0x0007,0x0007,0x0003,0x0000,0x0000,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // i (105) 0x0000,0x0000,0x0010,0x0038,0x0038,0x0038,0x0000,0x0000,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x001c,0x000f,0x0007, // j (106) 0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x01c3,0x00e3,0x00e3,0x0073,0x003b,0x001b,0x001f,0x001f,0x001b,0x003b,0x0073,0x0063,0x00e3,0x01c3,0x03c3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // k (107) 0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // l (108) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7872,0xfcfa,0xc7c6,0x8387,0x8183,0x8183,0x8183,0x8183,0x8183,0x8183,0x8183,0x8183,0x8183,0x8183,0x8183,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // m (109) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00f3,0x01fb,0x038b,0x0307,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // n (110) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00f8,0x01fc,0x038e,0x0306,0x0603,0x0603,0x0603,0x0603,0x0603,0x0603,0x0603,0x0306,0x038e,0x01fc,0x00f8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // o (111) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x007b,0x00fb,0x01cf,0x0187,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0187,0x01cf,0x00ff,0x0073,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003, // p (112) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0678,0x06fc,0x078e,0x0706,0x0603,0x0603,0x0603,0x0603,0x0603,0x0603,0x0603,0x0706,0x078e,0x06fc,0x0678,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600, // q (113) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0033,0x003b,0x000f,0x0007,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // r (114) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x007c,0x00fe,0x0047,0x0003,0x0003,0x0007,0x001e,0x007c,0x0070,0x00c0,0x00c0,0x00c1,0x00e3,0x007f,0x003e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // s (115) 0x0000,0x0000,0x0000,0x0000,0x000c,0x000c,0x000c,0x000c,0x007f,0x007f,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x007c,0x0078,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // t (116) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0303,0x0383,0x03c7,0x037e,0x033c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // u (117) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0607,0x0706,0x070e,0x070e,0x030c,0x030c,0x039c,0x019c,0x0198,0x0198,0x01f8,0x00f0,0x00f0,0x00f0,0x00f0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // v (118) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc183,0xc1c3,0xe3c7,0xe3c7,0x63c6,0x63c6,0x6666,0x766e,0x766e,0x366c,0x362c,0x3c3c,0x3c3c,0x3c3c,0x1c38,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // w (119) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x070e,0x030c,0x039c,0x0198,0x01f8,0x00f0,0x00f0,0x00f0,0x00f0,0x01f8,0x01d8,0x039c,0x038c,0x070e,0x0707,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // x (120) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0607,0x0606,0x070e,0x070e,0x030c,0x030c,0x039c,0x0398,0x0198,0x0198,0x01b8,0x00f0,0x00f0,0x00f0,0x00e0,0x0060,0x0060,0x0070,0x0070,0x0030,0x003e,0x001e, // y (121) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00ff,0x00ff,0x00e0,0x0060,0x0070,0x0030,0x0038,0x001c,0x000c,0x000e,0x0006,0x0007,0x0003,0x00ff,0x00ff,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // z (122) 0x0000,0x0078,0x0078,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000e,0x0007,0x0007,0x000e,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x0078,0x0078,0x0000,0x0000, // { (123) 0x0000,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003, // | (124) 0x0000,0x000f,0x001f,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0038,0x0070,0x0070,0x0038,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x000f,0x000f,0x0000,0x0000, // } (125) 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x207c,0x71fe,0x3fc7,0x1f02,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 // ~ (126) }; sFONT Font16x24 = { ASCII16x24_Table, 16, /* Width */ 24, /* Height */ }; sFONT Font12x12 = { ASCII12x12_Table, 12, /* Width */ 12, /* Height */ }; sFONT Font8x12 = { ASCII8x12_Table, 8, /* Width */ 12, /* Height */ }; sFONT Font8x8 = { ASCII8x8_Table, 8, /* Width */ 8, /* Height */ }; sFONT Avenir = { Avenir_Table, 16, /* Width */ 30, /* Height */ }; /** * @} */ /** @defgroup FONTS_Private_Function_Prototypes * @{ */ /** * @} */ /** @defgroup FONTS_Private_Functions * @{ */ /** * @} */ /** * @} */ /** * @} */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
fishr/Origin
Src/fonts.c
C
gpl-3.0
74,556
<!DOCTYPE HTML> <!-- http://proyectos.analizo.info/app/omc-marzo-2014/ --> <html lang="es"> <head> <meta charset="utf-8"/> <title>La comida ultra incendia Orriols</title> <link type="text/css" rel="stylesheet" href="http://proyectos.analizo.info/static/apps/omc/css.css"/> </head> <body> <div id="main"> <p class="fs20 fwb">La comida ultra incendia Orriols</p> <p class="fsi">Un reparto de alimentos solo entre españoles fractura a un barrio valenciano de inmigrantes</p> <p>Luisa Fernández cobra 400 euros. Mantiene a seis hijos y cuatro nietos. Y reside en una casa “de patada”, que es como denomina al piso que ocupa ilegalmente en un bloque de la antigua CAM. Este sábado sonreía. Se llevó una bolsa blanca con conservas, pasta y productos de higiene. “No soy racista. Pero es que los inmigrantes…”, decía esta gitana de 52 años.</p> <p>Emulando a los neonazis griegos de Amanecer Dorado, más de un centenar de familias al filo de la exclusión aguardaron ayer hasta seis horas de cola para recoger los 122 lotes de alimentos que repartió la ONG del partido ultra España 2000 en el barrio valenciano de Orriols. El salvoconducto era estar parado y acreditar con el DNI ser español. La tonelada de comida se esfumó en una hora.</p> <p>La cola del hambre era una maqueta de la España espoleada. El cristalero Rafael Pallá acudió porque con 426 euros y los recortes no puede atender a su hijo con una discapacidad del 96%. Manuel Rodrigo porque su alquiler de 480 euros no le permite pagar la luz. Y Ana Gadea porque sufre una minusvalía y está desesperada.</p> <p>Orriols encarna la tormenta perfecta para los agitadores del odio. Uno de cada tres vecinos es inmigrante. Cuatro de cada diez, desempleado. Y una mezquita llama al rezo a centenares de musulmanes.</p> <p>Para evitar la cerilla en el polvorín, una decena de ONG intentó sin éxito que la Delegación de Gobierno en la Comunidad Valenciana prohibiera el reparto ultra. Advertían que cebaba el odio racial (artículo 510 del Código Penal). En el departamento que dirige Paula Sánchez de León, del PP, dicen que no pudieron frenarlo. “Cumplía los requisitos administrativos”. Incluso, marginando a extranjeros.</p> <p class="fwb">La mezquita local distribuye víveres entre españoles necesitados</p> <p>“Es una provocación”, gritó desgarrado ante la cola Cristián Sánchez, de Valencia Acoge. Fue la única condena ayer. Las ONG, los vecinos y los antifascistas acordaron no acudir al reparto para no avivar el protagonismo ultra.</p> <p>España 2000, la segunda formación de extrema derecha española (cinco concejales), desarrollará su próxima distribución en el deprimido barrio valenciano de La Fuensanta. Desde que EL PAÍS publicó en 2012 que su ONG Hogar Social María Luisa Navarro daba comida del Banco de Alimentos en Valencia, las Administraciones le cerraron el grifo. Y ahora sus víveres proceden de colectas propias. “Atendemos a 200 familias”, se defiende el fundador de la formación, José Luis Roberto, un magnate de la seguridad privada con negocios en Lituania y República Dominicana.</p> <p class="fwb">La ropa cedida por los musulmanes viste a medio centenar de vecinos</p> <p>Su solidaridad excluyente contrasta en un barrio multicolor con un sólido entramado asociativo. A 400 metros del puesto ultra, emerge cada tres meses otra cola de la necesidad. La secuencia se desarrolló por última vez el pasado jueves. El sol cae a plomo. Un centenar de desahuciados se arremolina ante un desvencijado local. Cinco musulmanes reparten 19 toneladas de alimentos. Casi 20 veces más que los ultras. Leche, macarrones, legumbres. Los españoles son, desde el pasado año, los principales usuarios de este servicio que presta el Centro Cultural Islámico de Valencia con víveres de la Unión Europea gestionados por Cruz Roja.</p> <p>Aquí no se mira la nacionalidad. Solo se pide un certificado de ingresos para comprobar que la familia navega por la exclusión.</p> <p>La cola se esparce en silencio. Rosario nació en el barrio. Tiene 60 años. Un rostro marcado y una bronquitis. Mantiene con 426 euros a tres hijos parados y a una nieta. Se asoma a la indigencia desde que dejó de pagar su alquiler de 350 euros en noviembre. “Me van a echar”. Llora. Mira al suelo. Nunca se vio recogiendo una bolsa de un argelino.</p> <p>Pablo y María (nombres figurados) esperan tras ella. Son peruanos. Superan la treintena. Su vía de escape es el aeropuerto. No pueden ahorrar para regresar. Tienen una hija de siete años. Tocan a la puerta de la caridad por primera vez desde que aterrizaron en España, en 2006.</p> <p>El Centro Cultural Islámico está desbordado. Sus informes dibujan un nuevo rostro de la exclusión. Españoles al borde de la indigencia. Un ejemplo es María Dolores, de 48 años. Desconfía en encontrar trabajo. Reparte 20 currículos a la semana. Ya no se avergüenza de que la reconozcan las vecinas en la cola de los musulmanes.</p> <p>“Aquí no discriminamos a nadie”, insiste la responsable del área social del Centro Cultural Islámico, Mar Cantador. Una enérgica mujer que, como su marido, argelino, está desempleada. Aunque no desocupada. Dedica su tiempo a tramitar la llegada de la comida, cuyo transporte desde las instalaciones de Cruz Roja costean los musulmanes. A recoger prendas para nutrir el ropero que el pasado año vistió a medio centenar de pobres del barrio de once nacionalidades. Españoles, incluidos. Y a transportar los alimentos a las casas de los dependientes.</p> <p>Cantador pidió a los usuarios de la solidaridad árabe que no respondieran a los ultras. “Es un acto racista”, decía el jueves. Todos los españoles consultados que aguardaban en su cola defendían en voz baja a la extrema derecha. Una madre soltera de 34 años, incluso, atribuía la crisis a la decisión del Gobierno de abrir la puerta de la inmigración “a los moros”. Y Rosario, la señora del rostro marcado, recogió ayer también una bolsa de los extremistas. “Estamos desesperados”, susurraba en las dos colas del hambre.</p> </div> </body> </html>
proyectos-analizo-info/app-omc
tasks/marzo/html/2093605.html
HTML
gpl-3.0
6,208
#ifndef PLAYER_H #define PLAYER_H #include <QString> class Player { private: QString name; bool bot; public: Player(QString _name); QString getName(); bool getBot(); }; #endif // PLAYER_H
betaros/maumau
player.h
C
gpl-3.0
213
package at.logic.gapt.examples.tip.isaplanner import at.logic.gapt.expr._ import at.logic.gapt.formats.ClasspathInputFile import at.logic.gapt.formats.tip.TipSmtParser import at.logic.gapt.proofs.Ant import at.logic.gapt.proofs.gaptic._ import at.logic.gapt.provers.viper.aip.axioms.SequentialInductionAxioms import at.logic.gapt.provers.viper.aip.provers.escargot import at.logic.gapt.provers.viper.aip.{ AnalyticInductionProver, ProverOptions } /* This proof is not a s.i.p. */ object prop_24 extends TacticsProof { val bench = TipSmtParser.fixupAndParse( ClasspathInputFile( "tip/isaplanner/prop_24.smt2", getClass ) ) ctx = bench.ctx val sequent = bench.toSequent.zipWithIndex.map { case ( f, Ant( i ) ) => s"h$i" -> f case ( f, _ ) => "goal" -> f } /* This proof uses induction on the goal, and subinductions on some * subformulas of the goal. These subinductions do not use their induction * hypothesis and are therefore merely case distinctions. */ val proof1 = Lemma( sequent ) { allR induction( hov"a:Nat" ) allR andR allL( "h1", le"b:Nat" ) eql( "h1_0", "goal" ).fromLeftToRight induction( hov"b:Nat" ) impR allL( "h4", le"Z" ) axiomLog impR allL( "h9", le"b_0:Nat" ) negL axiomLog allL( "h1", le"b:Nat" ) eql( "h1_0", "goal" ).fromLeftToRight induction( hov"b:Nat" ) impR axiomLog impR allL( "h5", le"b_0:Nat" ) negL axiomLog allR andR // In order to continue we need again to do a case distinction // on b. It seems preferable to apply induction before decomposing the formula. induction( hov"b:Nat" ) allL( "h2", le"a_0:Nat" ) eql( "h2_0", "goal" ).fromLeftToRight impR allL( "h4", le"S(a_0:Nat)" ) axiomLog allL( "h3", le"a_0:Nat", le"b_0:Nat" ) eql( "h3_0", "goal" ).fromLeftToRight impR allL( "h10", le"max2(a_0:Nat, b_0:Nat):Nat", le"a_0:Nat" ) andL( "h10_0" ) forget( "h10_0_1" ) impL( "h10_0_0" ) axiomLog allL( "h6", le"b_0:Nat", le"a_0:Nat" ) andL( "h6_0" ) forget( "h6_0_0" ) impL( "h6_0_1" ) allL( "IHa_0", le"b_0:Nat" ) andL( "IHa_0_0" ) forget( "IHa_0_0_1" ) impL( "IHa_0_0_0" ) axiomLog axiomLog axiomLog induction( hov"b:Nat" ) impR allL( "h2", le"a_0:Nat" ) eql( "h2_0", "goal_1" ).fromLeftToRight // Now we need to prove equal(S(a_0),S(a_0)). This reduces via the axioms // to equal(a_0, a_0). But proving this requires a separate induction and this // cannot be done with the analytical induction provided by the sequential // axioms. allL( "h10", le"a_0:Nat", le"a_0:Nat" ) andL( "h10_0" ) forget( "h10_0_0" ) impL( "h10_0_1" ) forget( "goal_1" ) induction( hov"a_0:Nat" ) axiomLog allL( "h10", le"a_1:Nat", le"a_1:Nat" ) andL( "h10_1" ) forget( "h10_1_0" ) impL( "h10_1_1" ) axiomLog axiomLog axiomLog impR allL( "h6", le"b_0:Nat", le"a_0:Nat" ) andL( "h6_0" ) forget( "h6_0_1" ) impL( "h6_0_0" ) axiomLog allL( "h3", le"a_0:Nat", le"b_0:Nat" ) eql( "h3_0", "goal_1" ).fromLeftToRight allL( "h10", le"max2(a_0:Nat, b_0:Nat):Nat", le"a_0:Nat" ) andL( "h10_0" ) forget( "h10_0_0" ) allL( "IHa_0", le"b_0:Nat" ) andL( "IHa_0_0" ) forget( "IHa_0_0_0" ) impL( "IHa_0_0_1" ) axiomLog impL( "h10_0_1" ) axiomLog axiomLog } val options = new ProverOptions( escargot, SequentialInductionAxioms().forAllVariables.forLabel( "goal" ) ) val proof2 = new AnalyticInductionProver( options ) lkProof ( ( "refl" -> hof"!x equal(x,x)" ) +: sequent ) get }
gebner/gapt
examples/tip/isaplanner/prop_24.scala
Scala
gpl-3.0
3,690
package mx.com.kosmos.connections; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.ProtocolException; import java.net.URL; import java.net.URLEncoder; import java.security.InvalidKeyException; import java.security.KeyPair; import java.security.NoSuchAlgorithmException; import java.security.Signature; import java.security.SignatureException; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpPut; import org.apache.http.impl.client.BasicResponseHandler; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.entity.StringEntity; import org.aspectj.apache.bcel.classfile.annotation.NameValuePair; import org.bouncycastle.util.encoders.Base64; import org.bouncycastle.crypto.AsymmetricCipherKeyPair; import org.bouncycastle.openssl.PEMException; import org.bouncycastle.openssl.PEMKeyPair; import org.bouncycastle.openssl.PEMParser; import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter; import com.google.gson.Gson; import grails.converters.JSON; public class SaltEdge { public final static int REQUEST_EXPIRES_MINUTES = 3; public final static String CLIENT_ID = "2cM5lSif8pkggDETQc193g"; public final static String SERIVICE_SECRET = "N8KbiMK2BETvB8kWDBGA70H3XNl33DJSYEcmVvrgNcg"; private final static String CONTENT_TYPE_JSON="application/json; charset=ISO-8859-1"; public final String PRIVATE_KEY_PATH = "src/main/resources/private.pem"; private static PEMKeyPair PRIVATE_KEY = null; public SaltEdge() { PRIVATE_KEY = readPrivateKey(PRIVATE_KEY_PATH); } // HTTP GET request public String get(String url) { return request("GET", url,null); } // HTTP POST request public String post(String url, Object payload) { return "Not Supported"; } private String processResponse(HttpURLConnection con) { BufferedReader in; StringBuffer response = new StringBuffer(); try { in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); } catch (IOException e) { System.out.println("Exception : " + e); e.printStackTrace(); } return response.toString(); } private String request(String method, String url,String json) { HttpPost post;HttpGet get;HttpPut put; HttpDelete delete; HttpClient client = new DefaultHttpClient(); String resp = "";String line = ""; HttpResponse response= null; StringEntity params = null; try { switch(method){ case "POST": post = new HttpPost(url); post.setHeader("Content-type",CONTENT_TYPE_JSON); post.setHeader("Client-id", CLIENT_ID); post.setHeader("Service-secret", SERIVICE_SECRET); System.out.println("PETICION JSON:::::>"+json); params =new StringEntity(json); post.setEntity(params); response = client.execute(post); break; case "GET": get = new HttpGet(url); get.setHeader("Content-type",CONTENT_TYPE_JSON); get.setHeader("Client-id", CLIENT_ID); get.setHeader("Service-secret", SERIVICE_SECRET); long expires = generateExpiresAt(); //get.setHeader("Signature",generateSignature("GET", expires,url, "")); //System.out.println("EXPIRES::::>" + expires); //get.setHeader("Expires-at",String.valueOf(expires)); response = client.execute(get); break; case "PUT": put = new HttpPut(url); put.setHeader("Content-type",CONTENT_TYPE_JSON); put.setHeader("Client-id", CLIENT_ID); put.setHeader("Service-secret", SERIVICE_SECRET); System.out.println("PETICION JSON:::::>"+json); params =new StringEntity(json); put.setEntity(params); response = client.execute(put); break; case "DELETE": delete = new HttpDelete(url); delete.setHeader("Content-type",CONTENT_TYPE_JSON); delete.setHeader("Client-id", CLIENT_ID); delete.setHeader("Service-secret", SERIVICE_SECRET); response = client.execute(delete); break; } BufferedReader rd = new BufferedReader(new InputStreamReader( response.getEntity().getContent())); while ((line = rd.readLine()) != null) {resp = resp + line;} System.out.println("JSON Response::>" + resp); } catch (ProtocolException e) { System.out.println("ProtocolException : " + e); e.printStackTrace(); } catch (IOException e) { System.out.println("IOException : " + e); e.printStackTrace(); } return resp; } private long generateExpiresAt() { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MINUTE, REQUEST_EXPIRES_MINUTES); return calendar.getTimeInMillis(); } /* private String generateSignature(String method, long expires, String url,String postBody) { String signature = String.format("%d|%s|%s|%s", expires, method, url, postBody); byte[] bytes = signature.getBytes(); byte[] shaSignature = null; try { shaSignature = sign(bytes); } catch (SignatureException e) { System.out.println("SignatureException : " + e); e.printStackTrace(); } catch (PEMException e) { System.out.println("PEMException : " + e); e.printStackTrace(); } return Base64.toBase64String(shaSignature); } */ private byte[] sign(byte[] bytes) throws SignatureException, PEMException { KeyPair keyPair = null; Signature signature = null; try { signature = Signature.getInstance("SHA1withRSA"); signature.initSign(new JcaPEMKeyConverter() .getPrivateKey(PRIVATE_KEY.getPrivateKeyInfo())); signature.update(bytes); } catch (NoSuchAlgorithmException e) { System.out.println("NoSuchAlgorithmException : " + e); e.printStackTrace(); } catch (InvalidKeyException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SignatureException e) { // TODO Auto-generated catch block e.printStackTrace(); } return signature.sign(); } public PEMKeyPair readPrivateKey(String privateKeyFileName) { AsymmetricCipherKeyPair keyPair = null; File f = new File(privateKeyFileName); FileReader fileReader = null; try { fileReader = new FileReader(f); } catch (FileNotFoundException e) { System.out.println("FileNotFoundException : " + e); e.printStackTrace(); return null; } PEMKeyPair obj = null; try { obj = (PEMKeyPair) new PEMParser(fileReader).readObject(); } catch (IOException e) { System.out.println("IOException : " + e); e.printStackTrace(); return null; } return obj; } }
therealthom/kosmos-app
src/java/mx/com/kosmos/connections/SaltEdge.java
Java
gpl-3.0
7,094
#region References using UnityEngine; #endregion public class RocketComponent : GameEntityComponent { public const int MIN_DISTANCE_TO_EXPLODE = 1; public Vector2 flyToPosition; public bool canFly, canLook; public float velocity = 200f; public override void Explode () { base.Explode(); Destroy(); } #region Overrides of GameEntityComponent public override void HitByExplosion (ExplosionComponent explosion) { // don't create explosion } #endregion #region Unity protected void Update () { // direction if (canLook) transform.LookAt2D(flyToPosition); // fly if (canFly) { Vector2 position = transform.position; var next = Vector2.MoveTowards(position, flyToPosition, Time.deltaTime * velocity); transform.SetPosition2D(next); if (Vector2.Distance(next, flyToPosition) < MIN_DISTANCE_TO_EXPLODE) Explode(); } } #endregion }
gavar/Missile-Game
Assets/Game/Scripts/RocketComponent.cs
C#
gpl-3.0
880
@CHARSET "UTF-8"; #mostrarListaPresenca .formWrapper label { display: block; float: none; padding: 0px; } #mostrarListaPresenca .formWrapper form ul.controls li { float: left; padding: 5px 8px 0px 0px; } #mostrarListaPresenca .formWrapper .field { width: 100% !important; } #mostrarListaPresenca .subgrupo { clear: both; }
filipemb/siesp
WebContent/WEB-INF/screen/listapresenca/mostrarListaPresenca.css
CSS
gpl-3.0
333
package de.luc1412.em.gui; import de.luc1412.em.EasyMaintenance; import de.luc1412.em.commands.CMDEasyMaintenance; import de.luc1412.em.utils.Utils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; /** * Created by Luc1412 on 22.08.2017 at 00:19 */ class InventoryAnimationManager { private int taskID; private int slot = 10; private boolean animationRunning = false; private Inventory GUI; private Player p; InventoryAnimationManager(Player p, Inventory GUI) { this.GUI = GUI; this.p = p; startAnimation(); } private void startAnimation() { if (EasyMaintenance.getMaintenanceManager().getCountdownManager() == null) { animationRunning = true; taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(EasyMaintenance.getInstance(), () -> { EasyMaintenance.getUtils().playSoundOfConfig(p, p.getLocation(), "GUIClickSound", 1000); if (EasyMaintenance.getUtils().getInMaintenance()) { GUI.setItem(slot, CMDEasyMaintenance.getGuiManager().getGreenStatusItem()); } else GUI.setItem(slot, CMDEasyMaintenance.getGuiManager().getRedStatusItem()); if (slot == 17) { cancelTask(taskID); p.closeInventory(); EasyMaintenance.getUtils().manageGUIPlayer(Utils.ManageType.REMOVE, p); p.performCommand("em toggle"); animationRunning = false; } slot++; }, 20, 10); } else EasyMaintenance.getUtils().getTranslatedMsgOfConfig("Countdown.CountdownIsRunning", true); } private void cancelTask(int taskID) { Bukkit.getScheduler().cancelTask(taskID); } boolean getAnimationRunning() { return animationRunning; } }
Luc1412/EasyMaintenance
src/main/java/de/luc1412/em/gui/InventoryAnimationManager.java
Java
gpl-3.0
1,639
#!/usr/bin/env python ######################################################################## # $HeadURL$ ######################################################################## """ Get the list of all the user files. """ __RCSID__ = "$Id$" from DIRAC.Core.Base import Script days = 0 months = 0 years = 0 wildcard = None baseDir = '' emptyDirsFlag = False Script.registerSwitch( "D:", "Days=", "Match files older than number of days [%s]" % days ) Script.registerSwitch( "M:", "Months=", "Match files older than number of months [%s]" % months ) Script.registerSwitch( "Y:", "Years=", "Match files older than number of years [%s]" % years ) Script.registerSwitch( "w:", "Wildcard=", "Wildcard for matching filenames [All]" ) Script.registerSwitch( "b:", "BaseDir=", "Base directory to begin search (default /[vo]/user/[initial]/[username])" ) Script.registerSwitch( "e", "EmptyDirs", "Create a list of empty directories" ) Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[1], 'Usage:', ' %s [option|cfgfile] ...' % Script.scriptName, ] ) ) Script.parseCommandLine( ignoreErrors = False ) for switch in Script.getUnprocessedSwitches(): if switch[0] == "D" or switch[0].lower() == "days": days = int( switch[1] ) if switch[0] == "M" or switch[0].lower() == "months": months = int( switch[1] ) if switch[0] == "Y" or switch[0].lower() == "years": years = int( switch[1] ) if switch[0].lower() == "w" or switch[0].lower() == "wildcard": wildcard = switch[1] if switch[0].lower() == "b" or switch[0].lower() == "basedir": baseDir = switch[1] if switch[0].lower() == "e" or switch[0].lower() == "emptydirs": emptyDirsFlag = True import DIRAC from DIRAC import gLogger from DIRAC.ConfigurationSystem.Client.Helpers.Registry import getVOForGroup from DIRAC.Core.Security.ProxyInfo import getProxyInfo from DIRAC.Resources.Catalog.FileCatalog import FileCatalog from DIRAC.Core.Utilities.List import sortList from datetime import datetime, timedelta import sys, os, time, fnmatch fc = FileCatalog() def isOlderThan( cTimeStruct, days ): timeDelta = timedelta( days = days ) maxCTime = datetime.utcnow() - timeDelta if cTimeStruct < maxCTime: return True return False withMetadata = False if days or months or years: withMetadata = True totalDays = 0 if years: totalDays += 365 * years if months: totalDays += 30 * months if days: totalDays += days res = getProxyInfo( False, False ) if not res['OK']: gLogger.error( "Failed to get client proxy information.", res['Message'] ) DIRAC.exit( 2 ) proxyInfo = res['Value'] username = proxyInfo['username'] vo = '' if 'group' in proxyInfo: vo = getVOForGroup( proxyInfo['group'] ) if not baseDir: if not vo: gLogger.error( 'Could not determine VO' ) Script.showHelp() baseDir = '/%s/user/%s/%s' % ( vo, username[0], username ) baseDir = baseDir.rstrip( '/' ) gLogger.info( 'Will search for files in %s' % baseDir ) activeDirs = [baseDir] allFiles = [] emptyDirs = [] while len( activeDirs ) > 0: currentDir = activeDirs.pop() res = fc.listDirectory( currentDir, withMetadata, timeout = 360 ) if not res['OK']: gLogger.error( "Error retrieving directory contents", "%s %s" % ( currentDir, res['Message'] ) ) elif currentDir in res['Value']['Failed']: gLogger.error( "Error retrieving directory contents", "%s %s" % ( currentDir, res['Value']['Failed'][currentDir] ) ) else: dirContents = res['Value']['Successful'][currentDir] subdirs = dirContents['SubDirs'] files = dirContents['Files'] if not subdirs and not files: emptyDirs.append( currentDir ) gLogger.notice( '%s: empty directory' % currentDir ) else: for subdir in sorted( subdirs, reverse = True ): if ( not withMetadata ) or isOlderThan( subdirs[subdir]['CreationDate'], totalDays ): activeDirs.append( subdir ) for filename in sorted( files ): fileOK = False if ( not withMetadata ) or isOlderThan( files[filename]['MetaData']['CreationDate'], totalDays ): if wildcard is None or fnmatch.fnmatch( filename, wildcard ): fileOK = True if not fileOK: files.pop( filename ) allFiles += sorted( files ) gLogger.notice( "%s: %d files%s, %d sub-directories" % ( currentDir, len( files ), ' matching' if withMetadata or wildcard else '', len( subdirs ) ) ) outputFileName = '%s.lfns' % baseDir.replace( '/%s' % vo, '%s' % vo ).replace( '/', '-' ) outputFile = open( outputFileName, 'w' ) for lfn in sortList( allFiles ): outputFile.write( lfn + '\n' ) outputFile.close() gLogger.notice( '%d matched files have been put in %s' % ( len( allFiles ), outputFileName ) ) if emptyDirsFlag: outputFileName = '%s.emptydirs' % baseDir.replace( '/%s' % vo, '%s' % vo ).replace( '/', '-' ) outputFile = open( outputFileName, 'w' ) for dir in sortList( emptyDirs ): outputFile.write( dir + '\n' ) outputFile.close() gLogger.notice( '%d empty directories have been put in %s' % ( len( emptyDirs ), outputFileName ) ) DIRAC.exit( 0 )
vmendez/DIRAC
DataManagementSystem/scripts/dirac-dms-user-lfns.py
Python
gpl-3.0
5,259
/* $License: Copyright (C) 2011 InvenSense Corporation, All Rights Reserved. $ */ /****************************************************************************** * * $Id:$ * *****************************************************************************/ /** * @defgroup ML * @{ * @file mlarray_lite.c * @brief APIs to read different data sets from FIFO. */ /* ------------------ */ /* - Include Files. - */ /* ------------------ */ #include "ml.h" #include "mltypes.h" #include "mlinclude.h" #include "mlMathFunc.h" #include "mlmath.h" #include "mlstates.h" #include "mlFIFO.h" #include "mlsupervisor.h" #include "mldl.h" #include "dmpKey.h" //#include "compass.h" #include "temp_comp.h" /** * @brief inv_get_rot_mat is used to get the rotation matrix * representation of the current sensor fusion solution. * The array format will be R11, R12, R13, R21, R22, R23, R31, R32, * R33, representing the matrix: * <center>R11 R12 R13</center> * <center>R21 R22 R23</center> * <center>R31 R32 R33</center> * Values are scaled, where 1.0 = 2^30 LSBs. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 9 cells long</b>. * * @return Zero if the command is successful; an ML error code otherwise. */ inv_error_t inv_get_rot_mat(long *data) { inv_error_t result = INV_SUCCESS; long qdata[4]; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } inv_get_quaternion(qdata); inv_quaternion_to_rotation(qdata, data); return result; } /** * @internal * @brief inv_get_angular_velocity is used to get an estimate of the body * frame angular velocity, which is computed from the current and * previous sensor fusion solutions. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long </b>. * * @return Zero if the command is successful; an ML error code otherwise. */ inv_error_t inv_get_angular_velocity(long *data) { return INV_ERROR_FEATURE_NOT_IMPLEMENTED; /* not implemented. old (invalid) implementation: if ( inv_get_state() < INV_STATE_DMP_OPENED ) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = inv_obj.ang_v_body[0]; data[1] = inv_obj.ang_v_body[1]; data[2] = inv_obj.ang_v_body[2]; return result; */ } /** * @brief inv_get_euler_angles is used to get the Euler angle representation * of the current sensor fusion solution. * Euler angles may follow various conventions. This function is equivelant * to inv_get_euler_angles_x, refer to inv_get_euler_angles_x for more * information. * * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long </b>. * * @return Zero if the command is successful; an ML error code otherwise. */ inv_error_t inv_get_euler_angles(long *data) { return inv_get_euler_angles_x(data); } /** * @brief inv_get_euler_angles_x is used to get the Euler angle representation * of the current sensor fusion solution. * Euler angles are returned according to the X convention. * This is typically the convention used for mobile devices where the X * axis is the width of the screen, Y axis is the height, and Z the * depth. In this case roll is defined as the rotation around the X * axis of the device. * <TABLE> * <TR><TD>Element </TD><TD><b>Euler angle</b></TD><TD><b>Rotation about </b></TD></TR> * <TR><TD> 0 </TD><TD>Roll </TD><TD>X axis </TD></TR> * <TR><TD> 1 </TD><TD>Pitch </TD><TD>Y axis </TD></TR> * <TR><TD> 2 </TD><TD>Yaw </TD><TD>Z axis </TD></TR> * </TABLE> * * Values are scaled where 1.0 = 2^16. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long </b>. * * @return Zero if the command is successful; an ML error code otherwise. */ inv_error_t inv_get_euler_angles_x(long *data) { inv_error_t result = INV_SUCCESS; float rotMatrix[9]; float tmp; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_rot_mat_float(rotMatrix); tmp = rotMatrix[6]; if (tmp > 1.0f) { tmp = 1.0f; } if (tmp < -1.0f) { tmp = -1.0f; } data[0] = (long)((float) (atan2f(rotMatrix[7], rotMatrix[8]) * 57.29577951308) * 65536L); data[1] = (long)((float)((double)asin(tmp) * 57.29577951308) * 65536L); data[2] = (long)((float) (atan2f(rotMatrix[3], rotMatrix[0]) * 57.29577951308) * 65536L); return result; } /** * @brief inv_get_euler_angles_y is used to get the Euler angle representation * of the current sensor fusion solution. * Euler angles are returned according to the Y convention. * This convention is typically used in augmented reality applications, * where roll is defined as the rotation around the axis along the * height of the screen of a mobile device, namely the Y axis. * <TABLE> * <TR><TD>Element </TD><TD><b>Euler angle</b></TD><TD><b>Rotation about </b></TD></TR> * <TR><TD> 0 </TD><TD>Roll </TD><TD>Y axis </TD></TR> * <TR><TD> 1 </TD><TD>Pitch </TD><TD>X axis </TD></TR> * <TR><TD> 2 </TD><TD>Yaw </TD><TD>Z axis </TD></TR> * </TABLE> * * Values are scaled where 1.0 = 2^16. * * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return Zero if the command is successful; an ML error code otherwise. */ inv_error_t inv_get_euler_angles_y(long *data) { inv_error_t result = INV_SUCCESS; float rotMatrix[9]; float tmp; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_rot_mat_float(rotMatrix); tmp = rotMatrix[7]; if (tmp > 1.0f) { tmp = 1.0f; } if (tmp < -1.0f) { tmp = -1.0f; } data[0] = (long)((float) (atan2f(rotMatrix[8], rotMatrix[6]) * 57.29577951308f) * 65536L); data[1] = (long)((float)((double)asin(tmp) * 57.29577951308) * 65536L); data[2] = (long)((float) (atan2f(rotMatrix[4], rotMatrix[1]) * 57.29577951308f) * 65536L); return result; } /** @brief inv_get_euler_angles_z is used to get the Euler angle representation * of the current sensor fusion solution. * This convention is mostly used in application involving the use * of a camera, typically placed on the back of a mobile device, that * is along the Z axis. In this convention roll is defined as the * rotation around the Z axis. * Euler angles are returned according to the Y convention. * <TABLE> * <TR><TD>Element </TD><TD><b>Euler angle</b></TD><TD><b>Rotation about </b></TD></TR> * <TR><TD> 0 </TD><TD>Roll </TD><TD>Z axis </TD></TR> * <TR><TD> 1 </TD><TD>Pitch </TD><TD>X axis </TD></TR> * <TR><TD> 2 </TD><TD>Yaw </TD><TD>Y axis </TD></TR> * </TABLE> * * Values are scaled where 1.0 = 2^16. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_euler_angles_z(long *data) { inv_error_t result = INV_SUCCESS; float rotMatrix[9]; float tmp; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_rot_mat_float(rotMatrix); tmp = rotMatrix[8]; if (tmp > 1.0f) { tmp = 1.0f; } if (tmp < -1.0f) { tmp = -1.0f; } data[0] = (long)((float) (atan2f(rotMatrix[6], rotMatrix[7]) * 57.29577951308) * 65536L); data[1] = (long)((float)((double)asin(tmp) * 57.29577951308) * 65536L); data[2] = (long)((float) (atan2f(rotMatrix[5], rotMatrix[2]) * 57.29577951308) * 65536L); return result; } /** * @brief inv_get_gyro_bias is used to get the gyroscope biases. * The argument array elements are ordered X,Y,Z. * The values are scaled such that 1 dps = 2^16 LSBs. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return Zero if the command is successful; an ML error code otherwise. */ inv_error_t inv_get_gyro_bias(long *data) { inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = inv_obj.gyro->bias[0]; data[1] = inv_obj.gyro->bias[1]; data[2] = inv_obj.gyro->bias[2]; return result; } /** * @brief inv_get_accel_bias is used to get the accelerometer baises. * The argument array elements are ordered X,Y,Z. * The values are scaled such that 1 g (gravity) = 2^16 LSBs. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long </b>. * * @return Zero if the command is successful; an ML error code otherwise. */ inv_error_t inv_get_accel_bias(long *data) { inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = inv_obj.accel->bias[0]; data[1] = inv_obj.accel->bias[1]; data[2] = inv_obj.accel->bias[2]; return result; } /** * @cond MPL * @brief inv_get_mag_bias is used to get Magnetometer Bias * * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long </b>. * * @return Zero if the command is successful; an ML error code otherwise. * @endcond */ inv_error_t inv_get_mag_bias(long *data) { inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = inv_obj.mag->bias[0]; data[1] = inv_obj.mag->bias[1]; data[2] = inv_obj.mag->bias[2]; return result; } /** * @cond MPL * @brief inv_get_mag_raw_data is used to get Raw magnetometer data. * * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long </b>. * * @return Zero if the command is successful; an ML error code otherwise. * @endcond */ inv_error_t inv_get_mag_raw_data(long *data) { inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = inv_obj.mag->sensor_data[0]; data[1] = inv_obj.mag->sensor_data[1]; data[2] = inv_obj.mag->sensor_data[2]; return result; } /** * @cond MPL * @brief inv_get_magnetometer is used to get magnetometer data. * * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return Zero if the command is successful; an ML error code otherwise. * @endcond */ inv_error_t inv_get_magnetometer(long *data) { inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = inv_obj.mag->calibrated_data[0]; data[1] = inv_obj.mag->calibrated_data[1]; data[2] = inv_obj.mag->calibrated_data[2]; return result; } /** * @cond MPL * @brief inv_get_pressure is used to get Pressure data. * * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to data to be passed back to the user. * * @return Zero if the command is successful; an ML error code otherwise. * @endcond */ inv_error_t inv_get_pressure(long *data) { inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = inv_obj.pressure->meas; return result; } /** * @cond MPL * @brief inv_get_heading is used to get heading from Rotation Matrix. * * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to data to be passed back to the user. * * @return Zero if the command is successful; an ML error code otherwise. * @endcond */ inv_error_t inv_get_heading(long *data) { inv_error_t result = INV_SUCCESS; float rotMatrix[9]; float tmp; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_rot_mat_float(rotMatrix); if ((rotMatrix[7] < 0.707) && (rotMatrix[7] > -0.707)) { tmp = (float)(atan2f(rotMatrix[4], rotMatrix[1]) * 57.29577951308 - 90.0f); } else { tmp = (float)(atan2f(rotMatrix[5], rotMatrix[2]) * 57.29577951308 + 90.0f); } if (tmp < 0) { tmp += 360.0f; } data[0] = (long)((360 - tmp) * 65536.0f); return result; } /** * @brief inv_get_gyro_cal_matrix is used to get the gyroscope * calibration matrix. The gyroscope calibration matrix defines the relationship * between the gyroscope sensor axes and the sensor fusion solution axes. * Calibration matrix data members will have a value of 1, 0, or -1. * The matrix has members * <center>C11 C12 C13</center> * <center>C21 C22 C23</center> * <center>C31 C32 C33</center> * The argument array elements are ordered C11, C12, C13, C21, C22, C23, C31, C32, C33. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 9 cells long</b>. * * @return Zero if the command is successful; an ML error code otherwise. */ inv_error_t inv_get_gyro_cal_matrix(long *data) { inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = inv_obj.calmat->gyro[0]; data[1] = inv_obj.calmat->gyro[1]; data[2] = inv_obj.calmat->gyro[2]; data[3] = inv_obj.calmat->gyro[3]; data[4] = inv_obj.calmat->gyro[4]; data[5] = inv_obj.calmat->gyro[5]; data[6] = inv_obj.calmat->gyro[6]; data[7] = inv_obj.calmat->gyro[7]; data[8] = inv_obj.calmat->gyro[8]; return result; } /** * @brief inv_get_accel_cal_matrix is used to get the accelerometer * calibration matrix. * Calibration matrix data members will have a value of 1, 0, or -1. * The matrix has members * <center>C11 C12 C13</center> * <center>C21 C22 C23</center> * <center>C31 C32 C33</center> * The argument array elements are ordered C11, C12, C13, C21, C22, C23, C31, C32, C33. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 9 cells long</b>. * * @return Zero if the command is successful; an ML error code otherwise. */ inv_error_t inv_get_accel_cal_matrix(long *data) { inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = inv_obj.calmat->accel[0]; data[1] = inv_obj.calmat->accel[1]; data[2] = inv_obj.calmat->accel[2]; data[3] = inv_obj.calmat->accel[3]; data[4] = inv_obj.calmat->accel[4]; data[5] = inv_obj.calmat->accel[5]; data[6] = inv_obj.calmat->accel[6]; data[7] = inv_obj.calmat->accel[7]; data[8] = inv_obj.calmat->accel[8]; return result; } /** * @cond MPL * @brief inv_get_mag_cal_matrix is used to get magnetometer calibration matrix. * * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 9 cells long at least</b>. * * @return Zero if the command is successful; an ML error code otherwise. * @endcond */ inv_error_t inv_get_mag_cal_matrix(long *data) { inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = inv_obj.calmat->compass[0]; data[1] = inv_obj.calmat->compass[1]; data[2] = inv_obj.calmat->compass[2]; data[3] = inv_obj.calmat->compass[3]; data[4] = inv_obj.calmat->compass[4]; data[5] = inv_obj.calmat->compass[5]; data[6] = inv_obj.calmat->compass[6]; data[7] = inv_obj.calmat->compass[7]; data[8] = inv_obj.calmat->compass[8]; return result; } /** * @brief inv_get_gyro_float is used to get the most recent gyroscope measurement. * The argument array elements are ordered X,Y,Z. * The values are in units of dps (degrees per second). * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_gyro_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; long ldata[3]; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_gyro(ldata); data[0] = (float)ldata[0] / 65536.0f; data[1] = (float)ldata[1] / 65536.0f; data[2] = (float)ldata[2] / 65536.0f; return result; } /** * @internal * @brief inv_get_angular_velocity_float is used to get an array of three data points representing the angular * velocity as derived from <b>both</b> gyroscopes and accelerometers. * This requires that ML_SENSOR_FUSION be enabled, to fuse data from * the gyroscope and accelerometer device, appropriately scaled and * oriented according to the respective mounting matrices. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_angular_velocity_float(float *data) { return INV_ERROR_FEATURE_NOT_IMPLEMENTED; /* not implemented. old (invalid) implementation: return inv_get_gyro_float(data); */ } /** * @brief inv_get_temperature_float is used to get the most recent * temperature measurement. * The argument array should only have one element. * The value is in units of deg C (degrees Celsius). * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to data to be passed back to the user. * * @return Zero if the command is successful; an ML error code otherwise. */ inv_error_t inv_get_temperature_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; long ldata[1]; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_temperature(ldata); data[0] = (float)ldata[0] / 65536.0f; return result; } /** * @brief inv_get_rot_mat_float is used to get an array of nine data points representing the rotation * matrix generated from all available sensors. * The array format will be R11, R12, R13, R21, R22, R23, R31, R32, * R33, representing the matrix: * <center>R11 R12 R13</center> * <center>R21 R22 R23</center> * <center>R31 R32 R33</center> * <b>Please refer to the "9-Axis Sensor Fusion Application Note" document, * section 7 "Sensor Fusion Output", for details regarding rotation * matrix output</b>. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 9 cells long at least</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_rot_mat_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } { long qdata[4], rdata[9]; inv_get_quaternion(qdata); inv_quaternion_to_rotation(qdata, rdata); data[0] = (float)rdata[0] / 1073741824.0f; data[1] = (float)rdata[1] / 1073741824.0f; data[2] = (float)rdata[2] / 1073741824.0f; data[3] = (float)rdata[3] / 1073741824.0f; data[4] = (float)rdata[4] / 1073741824.0f; data[5] = (float)rdata[5] / 1073741824.0f; data[6] = (float)rdata[6] / 1073741824.0f; data[7] = (float)rdata[7] / 1073741824.0f; data[8] = (float)rdata[8] / 1073741824.0f; } return result; } /** * @brief inv_get_quaternion_float is used to get the quaternion representation * of the current sensor fusion solution. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 4 cells long</b>. * * @return INV_SUCCESS if the command is successful; an ML error code otherwise. */ /* inv_get_quaternion_float implemented in mlFIFO.c */ /** * @brief inv_get_linear_accel_float is used to get an estimate of linear * acceleration, based on the most recent accelerometer measurement * and sensor fusion solution. * The values are in units of g (gravity). * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_linear_accel_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; long ldata[3]; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_linear_accel(ldata); data[0] = (float)ldata[0] / 65536.0f; data[1] = (float)ldata[1] / 65536.0f; data[2] = (float)ldata[2] / 65536.0f; return result; } /** * @brief inv_get_linear_accel_in_world_float is used to get an estimate of * linear acceleration, in the world frame, based on the most * recent accelerometer measurement and sensor fusion solution. * The values are in units of g (gravity). * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_linear_accel_in_world_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; long ldata[3]; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_linear_accel_in_world(ldata); data[0] = (float)ldata[0] / 65536.0f; data[1] = (float)ldata[1] / 65536.0f; data[2] = (float)ldata[2] / 65536.0f; return result; } /** * @brief inv_get_gravity_float is used to get an estimate of the body frame * gravity vector, based on the most recent sensor fusion solution. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long at least</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_gravity_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; long ldata[3]; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_gravity(ldata); data[0] = (float)ldata[0] / 65536.0f; data[1] = (float)ldata[1] / 65536.0f; data[2] = (float)ldata[2] / 65536.0f; return result; } /** * @brief inv_get_gyro_cal_matrix_float is used to get the gyroscope * calibration matrix. The gyroscope calibration matrix defines the relationship * between the gyroscope sensor axes and the sensor fusion solution axes. * Calibration matrix data members will have a value of 1.0, 0, or -1.0. * The matrix has members * <center>C11 C12 C13</center> * <center>C21 C22 C23</center> * <center>C31 C32 C33</center> * The argument array elements are ordered C11, C12, C13, C21, C22, C23, C31, C32, C33. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 9 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_gyro_cal_matrix_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = (float)inv_obj.calmat->gyro[0] / 1073741824.0f; data[1] = (float)inv_obj.calmat->gyro[1] / 1073741824.0f; data[2] = (float)inv_obj.calmat->gyro[2] / 1073741824.0f; data[3] = (float)inv_obj.calmat->gyro[3] / 1073741824.0f; data[4] = (float)inv_obj.calmat->gyro[4] / 1073741824.0f; data[5] = (float)inv_obj.calmat->gyro[5] / 1073741824.0f; data[6] = (float)inv_obj.calmat->gyro[6] / 1073741824.0f; data[7] = (float)inv_obj.calmat->gyro[7] / 1073741824.0f; data[8] = (float)inv_obj.calmat->gyro[8] / 1073741824.0f; return result; } /** * @brief inv_get_accel_cal_matrix_float is used to get the accelerometer * calibration matrix. * Calibration matrix data members will have a value of 1.0, 0, or -1.0. * The matrix has members * <center>C11 C12 C13</center> * <center>C21 C22 C23</center> * <center>C31 C32 C33</center> * The argument array elements are ordered C11, C12, C13, C21, C22, C23, C31, C32, C33. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 9 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_accel_cal_matrix_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = (float)inv_obj.calmat->accel[0] / 1073741824.0f; data[1] = (float)inv_obj.calmat->accel[1] / 1073741824.0f; data[2] = (float)inv_obj.calmat->accel[2] / 1073741824.0f; data[3] = (float)inv_obj.calmat->accel[3] / 1073741824.0f; data[4] = (float)inv_obj.calmat->accel[4] / 1073741824.0f; data[5] = (float)inv_obj.calmat->accel[5] / 1073741824.0f; data[6] = (float)inv_obj.calmat->accel[6] / 1073741824.0f; data[7] = (float)inv_obj.calmat->accel[7] / 1073741824.0f; data[8] = (float)inv_obj.calmat->accel[8] / 1073741824.0f; return result; } /** * @cond MPL * @brief inv_get_mag_cal_matrix_float is used to get an array of nine data points * representing the calibration matrix for the compass: * <center>C11 C12 C13</center> * <center>C21 C22 C23</center> * <center>C31 C32 C33</center> * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 9 cells long at least</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. * @endcond */ inv_error_t inv_get_mag_cal_matrix_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = (float)inv_obj.calmat->compass[0] / 1073741824.0f; data[1] = (float)inv_obj.calmat->compass[1] / 1073741824.0f; data[2] = (float)inv_obj.calmat->compass[2] / 1073741824.0f; data[3] = (float)inv_obj.calmat->compass[3] / 1073741824.0f; data[4] = (float)inv_obj.calmat->compass[4] / 1073741824.0f; data[5] = (float)inv_obj.calmat->compass[5] / 1073741824.0f; data[6] = (float)inv_obj.calmat->compass[6] / 1073741824.0f; data[7] = (float)inv_obj.calmat->compass[7] / 1073741824.0f; data[8] = (float)inv_obj.calmat->compass[8] / 1073741824.0f; return result; } /** * @brief inv_get_gyro_bias_float is used to get the gyroscope biases. * The argument array elements are ordered X,Y,Z. * The values are in units of dps (degrees per second). * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_gyro_bias_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = (float)inv_obj.gyro->bias[0] / 65536.0f; data[1] = (float)inv_obj.gyro->bias[1] / 65536.0f; data[2] = (float)inv_obj.gyro->bias[2] / 65536.0f; return result; } /** * @brief inv_get_accel_bias_float is used to get the accelerometer baises. * The argument array elements are ordered X,Y,Z. * The values are in units of g (gravity). * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_accel_bias_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = (float)inv_obj.accel->bias[0] / 65536.0f; data[1] = (float)inv_obj.accel->bias[1] / 65536.0f; data[2] = (float)inv_obj.accel->bias[2] / 65536.0f; return result; } /** * @cond MPL * @brief inv_get_mag_bias_float is used to get an array of three data points representing * the compass biases. * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. * @endcond */ inv_error_t inv_get_mag_bias_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = ((float)inv_obj.mag->bias[0]) / 65536.0f; data[1] = ((float)inv_obj.mag->bias[1]) / 65536.0f; data[2] = ((float)inv_obj.mag->bias[2]) / 65536.0f; if(IS_INV_ADVFEATURES_ENABLED(inv_obj)) { data[0] += (float)((long long)inv_obj.adv_fusion->init_compass_bias[0] * inv_obj.mag->sens / 16384) / 65536.0f; data[1] += (float)((long long)inv_obj.adv_fusion->init_compass_bias[1] * inv_obj.mag->sens / 16384) / 65536.0f; data[2] += (float)((long long)inv_obj.adv_fusion->init_compass_bias[2] * inv_obj.mag->sens / 16384) / 65536.0f; } return result; } /** * @brief inv_get_gyro_and_accel_sensor_float is used to get the most recent set of all sensor data. * The argument array elements are ordered gyroscope X,Y, and Z, * accelerometer X, Y, and Z, and magnetometer X,Y, and Z. * \if UMPL The magnetometer elements are not populated in UMPL. \endif * The gyroscope and accelerometer data is not scaled or offset, it is * copied directly from the sensor registers, and cast as a float. * In the case of accelerometers with 8-bit output resolution, the data * is scaled up to match the 2^14 = 1 g typical represntation of +/- 2 g * full scale range * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 9 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_gyro_and_accel_sensor_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; long ldata[6]; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_gyro_and_accel_sensor(ldata); data[0] = (float)ldata[0]; data[1] = (float)ldata[1]; data[2] = (float)ldata[2]; data[3] = (float)ldata[3]; data[4] = (float)ldata[4]; data[5] = (float)ldata[5]; data[6] = (float)inv_obj.mag->sensor_data[0]; data[7] = (float)inv_obj.mag->sensor_data[1]; data[8] = (float)inv_obj.mag->sensor_data[2]; return result; } /** * @brief inv_get_euler_angles_x is used to get the Euler angle representation * of the current sensor fusion solution. * Euler angles are returned according to the X convention. * This is typically the convention used for mobile devices where the X * axis is the width of the screen, Y axis is the height, and Z the * depth. In this case roll is defined as the rotation around the X * axis of the device. * <TABLE> * <TR><TD>Element </TD><TD><b>Euler angle</b></TD><TD><b>Rotation about </b></TD></TR> * <TR><TD> 0 </TD><TD>Roll </TD><TD>X axis </TD></TR> * <TR><TD> 1 </TD><TD>Pitch </TD><TD>Y axis </TD></TR> * <TR><TD> 2 </TD><TD>Yaw </TD><TD>Z axis </TD></TR> * </TABLE> * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_euler_angles_x_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; float rotMatrix[9]; float tmp; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_rot_mat_float(rotMatrix); tmp = rotMatrix[6]; if (tmp > 1.0f) { tmp = 1.0f; } if (tmp < -1.0f) { tmp = -1.0f; } data[0] = (float)(atan2f(rotMatrix[7], rotMatrix[8]) * 57.29577951308); data[1] = (float)((double)asin(tmp) * 57.29577951308); data[2] = (float)(atan2f(rotMatrix[3], rotMatrix[0]) * 57.29577951308); return result; } /** * @brief inv_get_euler_angles_float is used to get an array of three data points three data points * representing roll, pitch, and yaw corresponding to the INV_EULER_ANGLES_X output and it is * therefore the default convention for Euler angles. * Please refer to the INV_EULER_ANGLES_X for a detailed description. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_euler_angles_float(float *data) { return inv_get_euler_angles_x_float(data); } /** @brief inv_get_euler_angles_y_float is used to get the Euler angle representation * of the current sensor fusion solution. * Euler angles are returned according to the Y convention. * This convention is typically used in augmented reality applications, * where roll is defined as the rotation around the axis along the * height of the screen of a mobile device, namely the Y axis. * <TABLE> * <TR><TD>Element </TD><TD><b>Euler angle</b></TD><TD><b>Rotation about </b></TD></TR> * <TR><TD> 0 </TD><TD>Roll </TD><TD>Y axis </TD></TR> * <TR><TD> 1 </TD><TD>Pitch </TD><TD>X axis </TD></TR> * <TR><TD> 2 </TD><TD>Yaw </TD><TD>Z axis </TD></TR> * </TABLE> * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_euler_angles_y_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; float rotMatrix[9]; float tmp; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_rot_mat_float(rotMatrix); tmp = rotMatrix[7]; if (tmp > 1.0f) { tmp = 1.0f; } if (tmp < -1.0f) { tmp = -1.0f; } data[0] = (float)(atan2f(rotMatrix[8], rotMatrix[6]) * 57.29577951308); data[1] = (float)((double)asin(tmp) * 57.29577951308); data[2] = (float)(atan2f(rotMatrix[4], rotMatrix[1]) * 57.29577951308); return result; } /** @brief inv_get_euler_angles_z_float is used to get the Euler angle representation * of the current sensor fusion solution. * This convention is mostly used in application involving the use * of a camera, typically placed on the back of a mobile device, that * is along the Z axis. In this convention roll is defined as the * rotation around the Z axis. * Euler angles are returned according to the Y convention. * <TABLE> * <TR><TD>Element </TD><TD><b>Euler angle</b></TD><TD><b>Rotation about </b></TD></TR> * <TR><TD> 0 </TD><TD>Roll </TD><TD>Z axis </TD></TR> * <TR><TD> 1 </TD><TD>Pitch </TD><TD>X axis </TD></TR> * <TR><TD> 2 </TD><TD>Yaw </TD><TD>Y axis </TD></TR> * </TABLE> * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. */ inv_error_t inv_get_euler_angles_z_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; float rotMatrix[9]; float tmp; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } result = inv_get_rot_mat_float(rotMatrix); tmp = rotMatrix[8]; if (tmp > 1.0f) { tmp = 1.0f; } if (tmp < -1.0f) { tmp = -1.0f; } data[0] = (float)(atan2f(rotMatrix[6], rotMatrix[7]) * 57.29577951308); data[1] = (float)((double)asin(tmp) * 57.29577951308); data[2] = (float)(atan2f(rotMatrix[5], rotMatrix[2]) * 57.29577951308); return result; } /** * @cond MPL * @brief inv_get_mag_raw_data_float is used to get Raw magnetometer data * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. * @endcond */ inv_error_t inv_get_mag_raw_data_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = (float)inv_obj.mag->sensor_data[0]; data[1] = (float)inv_obj.mag->sensor_data[1]; data[2] = (float)inv_obj.mag->sensor_data[2]; if (IS_INV_ADVFEATURES_ENABLED(inv_obj)) { data[0] += (float)inv_obj.adv_fusion->init_compass_bias[0]; data[1] += (float)inv_obj.adv_fusion->init_compass_bias[1]; data[2] += (float)inv_obj.adv_fusion->init_compass_bias[2]; } return result; } /** * @cond MPL * @brief inv_get_magnetometer_float is used to get magnetometer data * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to an array to be passed back to the user. * <b>Must be 3 cells long</b>. * * @return INV_SUCCESS if the command is successful; an error code otherwise. * @endcond */ inv_error_t inv_get_magnetometer_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = (float)inv_obj.mag->calibrated_data[0] / 65536.0f; data[1] = (float)inv_obj.mag->calibrated_data[1] / 65536.0f; data[2] = (float)inv_obj.mag->calibrated_data[2] / 65536.0f; return result; } /** * @cond MPL * @brief inv_get_pressure_float is used to get a single value representing the pressure in Pascal * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to the data to be passed back to the user. * * @return INV_SUCCESS if the command is successful; an error code otherwise. * @endcond */ inv_error_t inv_get_pressure_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } data[0] = (float)inv_obj.pressure->meas; return result; } /** * @cond MPL * @brief inv_get_heading_float is used to get single number representing the heading of the device * relative to the Earth, in which 0 represents North, 90 degrees * represents East, and so on. * The heading is defined as the direction of the +Y axis if the Y * axis is horizontal, and otherwise the direction of the -Z axis. * * @pre MLDmpOpen() \ifnot UMPL or MLDmpPedometerStandAloneOpen() \endif * must have been called. * * @param data * A pointer to the data to be passed back to the user. * * @return INV_SUCCESS if the command is successful; an error code otherwise. * @endcond */ inv_error_t inv_get_heading_float(float *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; float rotMatrix[9]; float tmp; if (inv_get_state() < INV_STATE_DMP_OPENED) return INV_ERROR_SM_IMPROPER_STATE; if (NULL == data) { return INV_ERROR_INVALID_PARAMETER; } inv_get_rot_mat_float(rotMatrix); if ((rotMatrix[7] < 0.707) && (rotMatrix[7] > -0.707)) { tmp = (float)(atan2f(rotMatrix[4], rotMatrix[1]) * 57.29577951308 - 90.0f); } else { tmp = (float)(atan2f(rotMatrix[5], rotMatrix[2]) * 57.29577951308 + 90.0f); } if (tmp < 0) { tmp += 360.0f; } data[0] = 360 - tmp; return result; } /** * @brief inv_set_gyro_bias is used to set the gyroscope bias. * The argument array elements are ordered X,Y,Z. * The values are scaled at 1 dps = 2^16 LSBs. * * Please refer to the provided "9-Axis Sensor Fusion * Application Note" document provided. * * @pre MLDmpOpen() \ifnot UMPL or * MLDmpPedometerStandAloneOpen() \endif * * @param data A pointer to an array to be copied from the user. * * @return INV_SUCCESS if successful; a non-zero error code otherwise. */ inv_error_t inv_set_gyro_bias(long *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; long biasTmp; long sf = 0; short offset[GYRO_NUM_AXES]; int i; struct mldl_cfg *mldl_cfg = inv_get_dl_config(); if (mldl_cfg->mpu_chip_info->gyro_sens_trim != 0) { sf = 2000 * 131 / mldl_cfg->mpu_chip_info->gyro_sens_trim; } else { sf = 2000; } for (i = 0; i < GYRO_NUM_AXES; i++) { inv_obj.gyro->bias[i] = data[i]; biasTmp = -inv_obj.gyro->bias[i] / sf; if (biasTmp < 0) biasTmp += 65536L; offset[i] = (short)biasTmp; } result = inv_set_offset(offset); if (result) { return result; } return INV_SUCCESS; } /** * @brief inv_set_accel_bias is used to set the accelerometer bias. * The argument array elements are ordered X,Y,Z. * The values are scaled in units of g (gravity), * where 1 g = 2^16 LSBs. * * Please refer to the provided "9-Axis Sensor Fusion * Application Note" document provided. * * @pre MLDmpOpen() \ifnot UMPL or * MLDmpPedometerStandAloneOpen() \endif * * @param data A pointer to an array to be copied from the user. * * @return INV_SUCCESS if successful; a non-zero error code otherwise. */ inv_error_t inv_set_accel_bias(long *data) { INVENSENSE_FUNC_START; inv_error_t result = INV_SUCCESS; long biasTmp; int i, j; unsigned char regs[6]; struct mldl_cfg *mldl_cfg = inv_get_dl_config(); for (i = 0; i < ACCEL_NUM_AXES; i++) { inv_obj.accel->bias[i] = data[i]; if (inv_obj.accel->sens != 0 && mldl_cfg && mldl_cfg->pdata) { long long tmp64; inv_obj.accel->scaled_bias[i] = 0; for (j = 0; j < ACCEL_NUM_AXES; j++) { inv_obj.accel->scaled_bias[i] += data[j] * (long)mldl_cfg->pdata_slave[EXT_SLAVE_TYPE_ACCEL] ->orientation[i * 3 + j]; } tmp64 = (long long)inv_obj.accel->scaled_bias[i] << 13; biasTmp = (long)(tmp64 / inv_obj.accel->sens); } else { biasTmp = 0; } if (biasTmp < 0) biasTmp += 65536L; regs[2 * i + 0] = (unsigned char)(biasTmp / 256); regs[2 * i + 1] = (unsigned char)(biasTmp % 256); } result = inv_set_mpu_memory(KEY_D_1_8, 2, &regs[0]); if (result) { return result; } result = inv_set_mpu_memory(KEY_D_1_10, 2, &regs[2]); if (result) { return result; } result = inv_set_mpu_memory(KEY_D_1_2, 2, &regs[4]); if (result) { return result; } return INV_SUCCESS; } /** * @brief inv_set_gyro_bias_float is used to set the gyroscope bias. * The argument array elements are ordered X,Y,Z. * The values are in units of dps (degrees per second). * * Please refer to the provided "9-Axis Sensor Fusion * Application Note" document provided. * * @pre MLDmpOpen() \ifnot UMPL or * MLDmpPedometerStandAloneOpen() \endif * @pre MLDmpStart() must <b>NOT</b> have been called. * * @param data A pointer to an array to be copied from the user. * * @return INV_SUCCESS if successful; a non-zero error code otherwise. */ inv_error_t inv_set_gyro_bias_float(float *data) { long arrayTmp[3]; arrayTmp[0] = (long)(data[0] * 65536.f); arrayTmp[1] = (long)(data[1] * 65536.f); arrayTmp[2] = (long)(data[2] * 65536.f); return inv_set_gyro_bias(arrayTmp); } /** * @brief inv_set_accel_bias_float is used to set the accelerometer bias. * The argument array elements are ordered X,Y,Z. * The values are in units of g (gravity). * * Please refer to the provided "9-Axis Sensor Fusion * Application Note" document provided. * * @pre MLDmpOpen() \ifnot UMPL or * MLDmpPedometerStandAloneOpen() \endif * @pre MLDmpStart() must <b>NOT</b> have been called. * * @param data A pointer to an array to be copied from the user. * * @return INV_SUCCESS if successful; a non-zero error code otherwise. */ inv_error_t inv_set_accel_bias_float(float *data) { long arrayTmp[3]; arrayTmp[0] = (long)(data[0] * 65536.f); arrayTmp[1] = (long)(data[1] * 65536.f); arrayTmp[2] = (long)(data[2] * 65536.f); return inv_set_accel_bias(arrayTmp); }
lehnert/muAV
Software Design/muAV/muAV/imu3000/umpl/mlarray_lite.c
C
gpl-3.0
55,341
#ifndef SNESPALETTE_H #define SNESPALETTE_H #include <QRgb> #include <QVector> #include <QtGlobal> // Snes color are encoded on 2 bytes, 0BBBBBGG GGGRRRRR struct SNESColor { SNESColor(); quint16 snes; QRgb rgb; void setRgb(QRgb); void setSNES(quint16); quint16 approxSNES(); QRgb approxRGB(); }; class SNESPalette { public: SNESPalette(); SNESPalette(quint8 mSize); SNESPalette(QByteArray snesPal); SNESPalette(QVector<QRgb>); QByteArray encode(); quint8 size; QVector<SNESColor> colors; }; #endif // SNESPALETTE_H
Skarsnik/SNESTilesKitten
snespalette.h
C
gpl-3.0
611
package se.esss.litterbox.linaclego.v2.webapp.client.contentpanels; import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.InlineHTML; import com.google.gwt.user.client.ui.VerticalPanel; import se.esss.litterbox.linaclego.v2.webapp.client.gskel.GskelSetupApp; import se.esss.litterbox.linaclego.v2.webapp.client.gskel.GskelVerticalPanel; import se.esss.litterbox.linaclego.v2.webapp.shared.HtmlTextTree; public class PbsLayoutPanel extends GskelVerticalPanel { private String treeType = ""; HtmlTextTree textTree; PbsLevelPanel pbsLevelPanel; public String getTreeType() {return treeType;} public PbsLayoutPanel(String tabTitle, String tabStyle, String treeType, GskelSetupApp setupApp) { super(tabTitle, tabStyle, setupApp); this.treeType = treeType; setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); } public void addTree(HtmlTextTree textTree) { if (getWidgetCount() > 0) clear(); getStatusTextArea().addStatus("Finished building " + treeType + " layout view."); pbsLevelPanel = new PbsLevelPanel(0, textTree.getTextTreeArrayList().get(0), true, null, getGskelTabLayoutScrollPanel()); VerticalPanel vertWrapperPanel = new VerticalPanel(); vertWrapperPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); vertWrapperPanel.add(new InlineHTML(textTree.getInlineHtmlString(false, false))); vertWrapperPanel.add(pbsLevelPanel); add(vertWrapperPanel); // pbsLevelPanel.focusPanel.setFocus(false); pbsLevelPanel.expandPanel(); } @Override public void tabLayoutPanelInterfaceAction(String message) { // TODO Auto-generated method stub } @Override public void optionDialogInterfaceAction(String choiceButtonText) { // TODO Auto-generated method stub } }
se-esss-litterbox/linac-lego
LinacLegoV2WebApp/src/se/esss/litterbox/linaclego/v2/webapp/client/contentpanels/PbsLayoutPanel.java
Java
gpl-3.0
1,849
#ifndef CURSE_IMPACT_EVENT_T_HPP #define CURSE_IMPACT_EVENT_T_HPP #include <map> #include <vector> #include <utility> #include <iostream> #include "instruction_t.hpp" #include "position_t.hpp" #include "util.hpp" #ifdef DEBUG # include <ncurses.h> #endif struct ship_event_t { ship_event_t(); ~ship_event_t() = default; enum class type { NOP, MOVEMENT, ATTACK, APPEAR, // TODO remove once everything is set }; enum class direction { NOP, UP, DOWN }; type type_; direction direction_; }; // TODO remove once the others are finished struct appear_event_t { appear_event_t(); ~appear_event_t() = default; int id_; int rect_id_; position_t position_; int hp_; int speed_; }; template <typename T> struct is_event_t { // TODO implement static constexpr bool value = true; }; template <typename event_T> class event_list_t { static_assert(is_event_t<event_T>::value, "is not a valid event_T"); using key_T = int; using event_vec_t = std::vector<event_T>; public: //-- public types --// enum class repeat_type { SINGULAR, REPEATABLE, }; public: //-- public functions --// event_list_t(): event_list_t(repeat_type::SINGULAR) { } event_list_t(repeat_type rt): container_(), tick_(0), repeat_type_(rt) { } event_list_t(bool repeatable): event_list_t( repeatable?(repeat_type::REPEATABLE):(repeat_type::SINGULAR)) { } ~event_list_t() = default; const event_vec_t* tick() { auto contains = this->container_.count(this->tick_); event_vec_t* ptr = nullptr; if (contains) { ptr = &(this->container_.at(this->tick_)); } if (this->repeat_type_ == repeat_type::REPEATABLE) { this->tick_ %= this->last_tick_; } this->tick_++; return ptr; } event_vec_t& at(const key_T& index) { return this->container_.at(index); } const event_vec_t& at(const key_T& index) const { return this->at(index); } void insert(const key_T& key, const event_T& ev) { util::set_if_undef<event_vec_t>(this->container_, key); this->container_.at(key).push_back(ev); finalize(); } size_t size() const { return this->container_.size(); } private: //-- private functions --// void finalize() { auto max_it = util::max_if(this->container_.begin(), this->container_.end(), [](const auto& max, const auto& elem) { return max.first < elem.first; }); this->last_tick_ = max_it->first; } private: //-- private members --// std::map<key_T, event_vec_t> container_; key_T tick_; repeat_type repeat_type_; key_T last_tick_; }; using ship_event_list_t = event_list_t<ship_event_t>; #endif // CURSE_IMPACT_EVENT_T_HPP
Arp-/curse_impact
inc/event_t.hpp
C++
gpl-3.0
2,681
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_11) on Mon Jun 16 17:36:07 PDT 2014 --> <title>Uses of Class javax.swing.DefaultButtonModel (Java Platform SE 8 )</title> <meta name="date" content="2014-06-16"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class javax.swing.DefaultButtonModel (Java Platform SE 8 )"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../javax/swing/DefaultButtonModel.html" title="class in javax.swing">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-files/index-1.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><strong>Java&trade;&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;8</strong></div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../index.html?javax/swing/class-use/DefaultButtonModel.html" target="_top">Frames</a></li> <li><a href="DefaultButtonModel.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class javax.swing.DefaultButtonModel" class="title">Uses of Class<br>javax.swing.DefaultButtonModel</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../javax/swing/DefaultButtonModel.html" title="class in javax.swing">DefaultButtonModel</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#javax.swing">javax.swing</a></td> <td class="colLast"> <div class="block">Provides a set of &quot;lightweight&quot; (all-Java language) components that, to the maximum degree possible, work the same on all platforms.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="javax.swing"> <!-- --> </a> <h3>Uses of <a href="../../../javax/swing/DefaultButtonModel.html" title="class in javax.swing">DefaultButtonModel</a> in <a href="../../../javax/swing/package-summary.html">javax.swing</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../../javax/swing/DefaultButtonModel.html" title="class in javax.swing">DefaultButtonModel</a> in <a href="../../../javax/swing/package-summary.html">javax.swing</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>static class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/swing/JToggleButton.ToggleButtonModel.html" title="class in javax.swing">JToggleButton.ToggleButtonModel</a></span></code> <div class="block">The ToggleButton model</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../javax/swing/DefaultButtonModel.html" title="class in javax.swing">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-files/index-1.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><strong>Java&trade;&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;8</strong></div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../index.html?javax/swing/class-use/DefaultButtonModel.html" target="_top">Frames</a></li> <li><a href="DefaultButtonModel.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small><font size="-1"> <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a> <br>For further API reference and developer documentation, see <a href="http://download.oracle.com/javase/8/docs/index.html" target="_blank">Java SE Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> Copyright &#x00a9; 1993, 2014, Oracle and/or its affiliates. All rights reserved. </font></small></p> </body> </html>
DeanAaron/jdk8
jdk8en_us/docs/api/javax/swing/class-use/DefaultButtonModel.html
HTML
gpl-3.0
6,983
#!/usr/bin/env python """ @file costFunctionChecker.py @author Michael Behrisch @author Daniel Krajzewicz @author Jakob Erdmann @date 2009-08-31 @version $Id: costFunctionChecker.py 13811 2013-05-01 20:31:43Z behrisch $ Run duarouter repeatedly and simulate weight changes via a cost function. SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ Copyright (C) 2009-2013 DLR (http://www.dlr.de/) and contributors All rights reserved """ import os, sys, subprocess, types from datetime import datetime from optparse import OptionParser from xml.sax import make_parser, handler def call(command, log): if not isinstance(args, types.StringTypes): command = [str(c) for c in command] print >> log, "-" * 79 print >> log, command log.flush() retCode = subprocess.call(command, stdout=log, stderr=log) if retCode != 0: print >> sys.stderr, "Execution of %s failed. Look into %s for details." % (command, log.name) sys.exit(retCode) def writeRouteConf(step, options, file, output): fd = open("iteration_" + str(step) + ".duarcfg", "w") print >> fd, """<configuration> <input> <net-file value="%s"/>""" % options.net if step==0: if options.flows: print >> fd, ' <flow-definition value="%s"/>' % file else: print >> fd, ' <trip-defs value="%s"/>' % file else: print >> fd, ' <alternatives value="%s"/>' % file print >> fd, ' <weights value="dump_%s_%s.xml"/>' % (step-1, options.aggregation) print >> fd, """ </input> <output> <output-file value="%s"/> <exit-times value="True"/> </output>""" % output print >> fd, """ <processing> <continue-on-unbuild value="%s"/> <expand-weights value="True"/> <gBeta value="%s"/> <gA value="%s"/> </processing>""" % (options.continueOnUnbuild, options.gBeta, options.gA) print >> fd, ' <random_number><abs-rand value="%s"/></random_number>' % options.absrand print >> fd, ' <time><begin value="%s"/>' % options.begin, if options.end: print >> fd, '<end value="%s"/>' % options.end, print >> fd, """</time> <report> <verbose value="%s"/> <suppress-warnings value="%s"/> </report> </configuration>""" % (options.verbose, options.noWarnings) fd.close() class RouteReader(handler.ContentHandler): def __init__(self): self._edgeWeights = {} self._maxDepart = 0 def startElement(self, name, attrs): if name == 'route': for edge in attrs['edges'].split(): if not edge in self._edgeWeights: self._edgeWeights[edge] = 0 self._edgeWeights[edge] += 1 elif name == 'vehicle': if float(attrs['depart']) > self._maxDepart: self._maxDepart = float(attrs['depart']) def getWeight(self, edge): return self._edgeWeights.get(edge, 0) def getMaxDepart(self): return self._maxDepart class NetReader(handler.ContentHandler): def __init__(self): self._edges = [] def startElement(self, name, attrs): if name == 'edge': if not attrs.has_key('function') or attrs['function'] == 'normal': self._edges.append(attrs['id']) def getEdges(self): return self._edges def identity(edge, weight): return weight def generateWeights(step, options, edges, weights, costFunction): fd = open("dump_%s_%s.xml" % (step, options.aggregation), "w") print >> fd, '<?xml version="1.0"?>\n<netstats>' for time in range(0, int(reader.getMaxDepart()+1), options.aggregation): print >> fd, ' <interval begin="%s" end="%s" id="dump_%s">' % (time, time + options.aggregation, options.aggregation) for edge in edges: cost = costFunction(edge, weights.getWeight(edge)) if cost != None: print >> fd, ' <edge id="%s" traveltime="%s"/>' % (edge, cost) print >> fd, ' </interval>' print >> fd, '</netstats>' fd.close() optParser = OptionParser() optParser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="tell me what you are doing") optParser.add_option("-C", "--continue-on-unbuild", action="store_true", dest="continueOnUnbuild", default=False, help="continues on unbuild routes") optParser.add_option("-w", "--disable-warnings", action="store_true", dest="noWarnings", default=False, help="disables warnings") optParser.add_option("-n", "--net-file", dest="net", help="SUMO network (mandatory)", metavar="FILE") optParser.add_option("-t", "--trips", dest="trips", help="trips in step 0 (this or flows is mandatory)", metavar="FILE") optParser.add_option("-F", "--flows", help="flows in step 0 (this or trips is mandatory)", metavar="FILE") optParser.add_option("-+", "--additional", dest="additional", default="", help="Additional files") optParser.add_option("-b", "--begin", dest="begin", type="int", default=0, help="Set simulation/routing begin [default: %default]") optParser.add_option("-e", "--end", dest="end", type="int", help="Set simulation/routing end [default: %default]") optParser.add_option("-R", "--route-steps", dest="routeSteps", type="int", default=200, help="Set simulation route steps [default: %default]") optParser.add_option("-a", "--aggregation", dest="aggregation", type="int", default=900, help="Set main weights aggregation period [default: %default]") optParser.add_option("-A", "--gA", dest="gA", type="float", default=.5, help="Sets Gawron's Alpha [default: %default]") optParser.add_option("-B", "--gBeta", dest="gBeta", type="float", default=.9, help="Sets Gawron's Beta [default: %default]") optParser.add_option("-f", "--first-step", dest="firstStep", type="int", default=0, help="First DUA step [default: %default]") optParser.add_option("-l", "--last-step", dest="lastStep", type="int", default=50, help="Last DUA step [default: %default]") optParser.add_option("-p", "--path", dest="path", default=os.environ.get("SUMO_BINDIR", ""), help="Path to binaries [default: %default]") optParser.add_option("-y", "--absrand", dest="absrand", action="store_true", default=False, help="use current time to generate random number") optParser.add_option("-c", "--cost-function", dest="costfunc", default="identity", help="(python) function to use as cost function") (options, args) = optParser.parse_args() if not options.net or not (options.trips or options.flows): optParser.error("At least --net-file and --trips or --flows have to be given!") duaBinary = os.environ.get("DUAROUTER_BINARY", os.path.join(options.path, "duarouter")) log = open("dua-log.txt", "w+") parser = make_parser() reader = NetReader() parser.setContentHandler(reader) parser.parse(options.net) edges = reader.getEdges() if "." in options.costfunc: idx = options.costfunc.rfind(".") module = options.costfunc[:idx] func = options.costfunc[idx+1:] exec("from %s import %s as costFunction" % (module, func)) else: exec("costFunction = %s" % options.costfunc) if options.flows: tripFiles = options.flows.split(",") else: tripFiles = options.trips.split(",") starttime = datetime.now() for step in range(options.firstStep, options.lastStep): btimeA = datetime.now() print "> Executing step " + str(step) # router files = [] for tripFile in tripFiles: file = tripFile tripFile = os.path.basename(tripFile) if step>0: file = tripFile[:tripFile.find(".")] + "_%s.rou.alt.xml" % (step-1) output = tripFile[:tripFile.find(".")] + "_%s.rou.xml" % step print ">> Running router with " + file btime = datetime.now() print ">>> Begin time: %s" % btime writeRouteConf(step, options, file, output) retCode = call([duaBinary, "-c", "iteration_%s.duarcfg" % step], log) etime = datetime.now() print ">>> End time: %s" % etime print ">>> Duration: %s" % (etime-btime) print "<<" files.append(output) # generating weights file print ">> Generating weights" reader = RouteReader() parser.setContentHandler(reader) for f in files: parser.parse(f) generateWeights(step, options, edges, reader, costFunction) print "<<" print "< Step %s ended (duration: %s)" % (step, datetime.now() - btimeA) print "------------------\n" sys.stdout.flush() print "dua-iterate ended (duration: %s)" % (datetime.now() - starttime) log.close()
rudhir-upretee/Sumo17_With_Netsim
tools/assign/costFunctionChecker.py
Python
gpl-3.0
8,986
--- title: "11 साल बाद शहाबुद्दीन जेल से रिहा" layout: item category: ["politics"] date: 2016-09-10T08:43:07.736Z image: 1473496987735shahbuddin.jpg --- <p>पटना: बिहार के बाहुबली नेता और सीवान के पूर्व आरजेडी सांसद शहाबुद्दीन को 11 साल बाद जेल से रिहा कर दिया गया है. पटना हाइकोर्ट से राजीव रोशन मर्डर केस में जमानत मिलने के बाद शहाबुद्दीन की भागलपुर जेल से रिहाई हुई. जेल से रिहाई के वक्‍त राज्य सरकार के कई मंत्री और विधायक भी शहाबुद्दीन की अगवानी के लिए पहुंचे थे. इसके अलावा भारी संख्‍या में उनके समर्थक भी साथ हैं.</p> <p>भागलपुर जेल में बंद शहाबुद्दीन के स्वागत के लिए रात से ही समर्थक जेल के बाहर जमा थे. साल 2014 के राजीव रोशन हत्याकांड में शहाबुद्दीन को ज़मानत मिली थी, जिसके बाद जेल से बाहर आने का रास्ता साफ़ हो गया. राजीव रोशन 2004 में दो भाईयों गिरिश राज और सतीश राज की हत्या के मामले में गवाह था.</p> <p>भागलपुर जेल से बाहर आने के बाद शहाबुद्दीन ने कहा कि &#39;लालू यादव ही मेरे नेता है. नीतीश कुमार परिस्थितियों के मुख्‍यमंत्री हैं. सब जानते हैं कि मुझे फंसाया गया है&#39;. बीजेपी ने शहाबुद्दीन की रिहाई को बिहार में जंगल राज की वापसी बताया है. बीजेपी का कहना है कि शहाबुद्दीन की रिहाई से फिर से दहशत का माहौल बनेगा.</p>
InstantKhabar/_source
_source/news/2016-09-10-shahbuddin.html
HTML
gpl-3.0
2,655
Note: This is not the [authoritative source](https://www.comlaw.gov.au/Details/C2014C00544) for this act, and likely contains errors # Commonwealth Places (Mirror Taxes) Act 1998 ##### No. 24, 1998 as amended ##### Compilation start date: 1 July 2014 ##### Includes amendments up to: Act No. 62, 2014 ### About this compilation **This compilation** **This is a compilation of the _Commonwealth Places (Mirror Taxes) Act 1998_ as in force on 1 July 2014. It includes any commenced amendment affecting the legislation to that date. This compilation was prepared on 4 August 2014. The notes at the end of this compilation (the **_endnotes_**) include information about amending laws and the amendment history of each amended provision. **Uncommenced amendments** **The effect of uncommenced amendments is not reflected in the text of the compiled law but the text of the amendments is included in the endnotes. **Application, saving and transitional provisions for provisions and amendments** **If the operation of a provision or amendment is affected by an application, saving or transitional provision that is not included in this compilation, details are included in the endnotes. **Modifications** **If a provision of the compiled law is affected by a modification that is in force, details are included in the endnotes. **Provisions ceasing to have effect** **If a provision of the compiled law has expired or otherwise ceased to have effect in accordance with a provision of the law, details are included in the endnotes. ## Contents * Part 1 Preliminary * 1 Short title * 2 Commencement * 3 Definitions * 4 Scope of this Act * 5 This Act binds the Crown * Part 2 Application of State taxing laws as applied laws in relation to Commonwealth places * 6 State taxing laws to have effect as applied laws * 7 Operative date for applied laws * 8 Modification of applied laws * 9 Arrangements with States * 10 Jurisdiction of courts * 11 Procedure in proceedings under applied law * 12 Continuation of proceedings where place found to be a Commonwealth place * 13 Objection not allowable on ground of duplicate proceedings * 14 Proceedings on certain appeals * 15 Grant of pardon, remission etc. * 16 Certificates about ownership of land * 17 Extinguishment of causes of action * 18 Validation of things purportedly done under a State taxing law * 19 Instruments referring to State taxing laws * 20 Other Commonwealth laws not to apply in relation to applied laws * 21 Commonwealth laws providing exemptions from Commonwealth taxes * 22 Saving provision for applied law where place ceases to be a Commonwealth place * 23 Money paid or received under applied law * Part 3 Miscellaneous * 24 Saving provision for State taxing law where place becomes a Commonwealth place * 25 Regulations * Schedule 1--Scheduled State taxing laws 16 * 1 New South Wales * 2 Victoria * 3 Queensland * 4 Western Australia * 5 South Australia * 6 Tasmania * Endnotes 18 * Endnote 1--About the endnotes 18 * Endnote 2--Abbreviation key 20 * Endnote 3--Legislation history 21 * Endnote 4--Amendment history 22 * Endnote 5--Uncommenced amendments [none] 23 * Endnote 6--Modifications [none] 23 * Endnote 7--Misdescribed amendments [none] 23 * Endnote 8--Miscellaneous [none] 23 ### An Act to provide for the application of State taxing laws in relation to Commonwealth places, and for related purposes ### Part 1--Preliminary ##### 1 Short title * This Act may be cited as the _Commonwealth Places (Mirror Taxes) Act 1998_. ##### 2 Commencement * This Act commences on the day on which it receives the Royal Assent. ##### 3 Definitions * In this Act, unless the contrary intention appears: * **_applied law_** means the provisions of a State taxing law that apply in relation to a Commonwealth place in accordance with this Act. * **_authority_**, in relation to a State, means any of the following: * (a) the Governor, a Minister or a member of the Executive Council of the State; * (b) a court of the State; * (c) a person who holds office as a member of a court of the State; * (d) a body created by or under the law of the State; * (e) an officer or employee of the State, or of a body referred to in paragraph (d). * **_Commonwealth place_** means a place referred to in paragraph 52(i) of the Constitution, other than the seat of government. * **_corresponding applied law_**, in relation to a State taxing law, means an applied law that corresponds to the State taxing law. * **_corresponding State taxing law_**, in relation to an applied law, means the State taxing law to which the applied law corresponds. * **_excluded by paragraph 52(i) of the Constitution _**means inapplicable by reason only of the operation of section 52 of the Constitution in relation to Commonwealth places. * **_in relation to_**, when used in relation to a Commonwealth place, means in, or in relation to, the Commonwealth place. * **_modifications_** includes additions, omissions and substitutions. * **_proceedings_** means any proceedings, whether civil or criminal and whether original or appellate. * **_scheduled law_**, in relation to a State, means a law that is specified in Schedule 1 in relation to the State, but does not include any part of such a law that is prescribed by the regulations for the purposes of this definition. * **_State law_**, in relation to a State, means: * (a) any law in force in the State, whether written or unwritten; and * (b) any instrument made or having effect under a law referred to in paragraph (a); * but does not include a law of the Commonwealth, whether written or unwritten, or an instrument made or having effect under such a law. * **_State taxing law_**, in relation to a State, means the following, as in force from time to time: * (a) a scheduled law of the State; * (b) a State law that imposes tax and is prescribed by the regulations for the purposes of this paragraph; * (c) any other State law of the State, to the extent that it is relevant to the operation of a law covered by paragraph (a) or (b). ##### 4 Scope of this Act * This Act has effect only to the extent that it is an exercise of the legislative powers of the Parliament under the following provisions of the Constitution: * (a) paragraph 52(i); * (b) section 73; * (c) paragraph 77(iii); * (d) paragraph 51(xxxix), so far as it relates to paragraph 52(i), section 73 or paragraph 77(iii). ##### 5 This Act binds the Crown * This Act binds the Crown in each of its capacities, but does not make the Crown liable to be prosecuted for an offence. ### Part 2--Application of State taxing laws as applied laws in relation to Commonwealth places ##### 6 State taxing laws to have effect as applied laws * (1) In this section: * **_excluded provisions_**, in relation to a State taxing law, means provisions of that law to the extent that they are excluded by paragraph 52(i) of the Constitution. * (2) Subject to this Act, the excluded provisions of a State taxing law, as in force at any time before or after the commencement of this Act, apply, or are taken to have applied, according to their tenor, at that time, in relation to each place in the State that is or was a Commonwealth place at that time. * (3) Subsection (2) does not extend to the provisions of a State taxing law in so far as it is not within the authority of the Parliament to make those provisions applicable in relation to a Commonwealth place. * (4) An applied law has effect subject to any modifications under section 8. * (5) Except as provided by modifications under section 8, nothing in this Act has the effect of creating an office, body, court or other tribunal. * (6) This section does not have effect in relation to a State unless an arrangement is in operation under section 9 in relation to the State. ##### 7 Operative date for applied laws * (1) An applied law does not have effect in relation to an amount that would (apart from this subsection) have become due for payment before 6 October 1997 under the applied law. * (2) In determining whether an amount is or was payable under an applied law, it must be assumed that all obligations of any relevant person that arose before 6 October 1997 have been fully and promptly complied with. * (3) An applied law does not have effect in relation to an amount that would (apart from this subsection) have become due for payment as stamp duty on an instrument made before 6 October 1997. * (4) In determining whether an amount is or was payable under an applied law relating to stamp duty, it must be assumed that: * (a) all relevant instruments made before 6 October 1997 were lodged for assessment of stamp duty; and * (b) the stamp duty (if any) on those instruments was assessed and paid. ##### 8 Modification of applied laws * (1) The regulations may prescribe modifications of any applied law. * (2) The Treasurer of a State may, by legislative instrument, prescribe modifications of the applied laws of the State, other than modifications for the purpose of overcoming a difficulty that arises from the requirements of the Constitution. * (4) Modifications may be made under this section only to the extent that they are necessary or convenient: * (a) for the purpose of enabling the effective operation of an applied law as a law of the Commonwealth; or * (b) for the purpose of enabling an applied law to operate so that the combined tax liability of a taxpayer under: * (i) the applied law; and * (ii) the corresponding State taxing law; * is as nearly as possible the same as the taxpayer's liability would be under the corresponding State taxing law alone if the Commonwealth places in the State were not Commonwealth places. * (5) Modifications under this section: * (a) may be expressed to take effect from a date that is earlier than the date on which the modifications are notified in the _Gazette_; and * (b) may deal with the circumstances in which the modifications apply, and with matters of a transitional or saving nature. * (6) To the extent of any inconsistency, modifications under subsection (1) prevail over modifications under subsection (2). ##### 9 Arrangements with States * (1) The GovernorGeneral may make an arrangement with the Governor of a State in relation to the exercise or performance of a power, duty or function (not being a power, duty or function involving the exercise of judicial power) by an authority of the State under the applied laws of the State. * (2) Where such an arrangement is in force, the power, duty or function may or must, as the case may be, be exercised or performed accordingly. * (3) The GovernorGeneral may arrange with the Governor of a State for the variation or revocation of an arrangement made under this section in relation to the State. * (4) An arrangement, variation or revocation under this section must be made by instrument in writing, a copy of which must be published in the _Gazette_. ##### 10 Jurisdiction of courts * (1) Within the limits of their several jurisdictions, the courts of a State are invested with federal jurisdiction in all matters arising under an applied law as having, or as having had, effect in relation to a Commonwealth place. For this purpose, **_limits_** means limits of any kind, whether as to subject matter or otherwise, but does not include any limitation that exists by reason of a place being a Commonwealth place. * (2) The jurisdiction conferred by subsection (1) in relation to matters arising under an applied law is to be exercised in accordance with the applied law. * (3) Among other things, modifications under section 8 may modify an applied law so that the applied law, as modified, makes provision for and in relation to investing a court of a State with federal jurisdiction, whether within the limits of its jurisdiction or otherwise. * (4) The jurisdiction with which courts are invested by subsection (1) or by modifications under section 8, is invested subject to the restriction in subsection (5) of this section, but not subject to any other conditions or restrictions. * (5) If a State law prohibits any appeal from such a court, then an appeal does not lie to the High Court from a decision of that court unless the High Court grants special leave to appeal. * (6) Nothing in this Act affects the operation of section 38 of the _Judiciary Act 1903_. * (7) Unless the High Court gives special leave to appeal, an appeal does not lie to the High Court from a judgment, decree, order or sentence of: * (a) a Justice of the High Court; or * (b) a federal court other than the High Court; or * (c) a court of a State or Territory; * if any ground relied upon in support of the appeal involves a question as to the operation or interpretation of section 52 of the Constitution in relation to a place (not being the seat of government). ##### 11 Procedure in proceedings under applied law * (1) Subject to this Act: * (a) any proceedings under an applied law (**_core proceedings_**) must be instituted and conducted in the same manner as though they were proceedings under the corresponding State taxing law; and * (b) any other proceedings in relation to the core proceedings (including declining to proceed further in a prosecution) must also be taken as though the core proceedings were proceedings under the corresponding State taxing law. * (2) The trial on indictment of an offence against an applied law must be by jury. ##### 12 Continuation of proceedings where place found to be a Commonwealth place * If proceedings have been commenced under a State taxing law and the court is satisfied that: * (a) the State taxing law is excluded by paragraph 52(i) of the Constitution; and * (b) an applied law corresponds to the State taxing law; * then the proceedings must be continued as though they had been commenced under the applied law. ##### 13 Objection not allowable on ground of duplicate proceedings * In any proceedings under an applied law, an objection must not be allowed merely on the ground that proceedings have been commenced, or are pending, under the corresponding State taxing law. ##### 14 Proceedings on certain appeals * (1) This section applies to an appeal from a judgment, decree, order or sentence of a court of a State or Territory in proceedings under a State taxing law, except where the appeal is an appeal to the High Court. * (2) If the court is satisfied that: * (a) the State taxing law is excluded by paragraph 52(i) of the Constitution; and * (b) an applied law corresponds to the State taxing law; * then the court must deal with the appeal as though: * (c) the proceedings in relation to which the appeal was brought had been brought under the applied law; and * (d) the judgment, decree, order or sentence had been given or made in proceedings brought under the applied law. ##### 15 Grant of pardon, remission etc. * (1) If a person is convicted under an applied law of a State, then an authority of the State may exercise or perform the same powers and functions in relation to the convicted person as the authority would have been empowered to exercise or perform under the State laws of the State if the offence had been committed in the State but not in relation to a Commonwealth place. * (2) Nothing in this section affects any power or function of the GovernorGeneral. ##### 16 Certificates about ownership of land * (1) In proceedings under an applied law (or purporting to be under an applied law), a certificate in writing given by an authorised person about any of the following matters relating to land is evidence of the matters stated in the certificate: * (a) the ownership of the land, or of an estate or interest in the land, on a date or during a period specified in the certificate; * (b) the existence and ownership of a right in respect of the land, on a date or during a period specified in the certificate. * (2) A document that purports to be a certificate referred to in subsection (1) is taken to be such a certificate, and to have been duly given, unless the contrary is proved. * (3) In this section: * **_authorised person_** means a person who is a delegate, in respect of any power or function, under section 139 of the _Lands Acquisition Act 1989_. ##### 17 Extinguishment of causes of action * If: * (a) an act or omission gives, or gave, to a person a cause of action under an applied law and also gives, or gave, to the person a cause of action under the corresponding State taxing law; and * (b) the cause of action under the corresponding State taxing law has been extinguished; * then the cause of action under the applied law is also extinguished. ##### 18 Validation of things purportedly done under a State taxing law * If: * (a) something purports to have been done in relation to a Commonwealth place under a State taxing law; and * (b) the State taxing law is excluded by paragraph 52(i) of the Constitution; and * (c) an applied law corresponded to the State taxing law; * then that thing is taken to have been done under the applied law. ##### 19 Instruments referring to State taxing laws * (1) This section applies to an instrument or other writing that relates to an act, matter or thing that has a connection with a Commonwealth place. * (2) In so far as: * (a) the instrument or writing contains a reference to a State taxing law; and * (b) the State taxing law is excluded by paragraph 52(i) of the Constitution; and * (c) an applied law corresponds to the State taxing law; * the reference has effect as if it were a reference to the applied law. ##### 20 Other Commonwealth laws not to apply in relation to applied laws * (1) Subject to this Act, no Commonwealth law (other than an applied law) applies in relation to: * (a) any applied law; or * (b) anything done under an applied law. * (1A) To avoid doubt, Chapter 2 of the _Criminal Code_ does not apply in relation to, or in relation to anything done under, an applied law. * (2) Subsection (1) has effect subject to any modifications prescribed by the regulations. * (3) To the extent that: * (a) a Commonwealth law applies to a State taxing law, or to things done under a State taxing law; and * (b) there is a corresponding applied law; * the Commonwealth law also applies to the applied law and to things done under the corresponding applied law. * (4) If: * (a) a law of the Commonwealth (other than an applied law) contains a reference to a State taxing law; and * (b) an applied law corresponds to the State taxing law; * then the reference is taken to include a reference to the applied law. ##### 21 Commonwealth laws providing exemptions from Commonwealth taxes * (1) This section applies to a provision (the **_exempting provision_**) of a Commonwealth law (other than an applied law) that is expressed to exempt a person or body from taxes or charges, or specified taxes or charges, under a law of the Commonwealth. * (2) Unless it expressly provides otherwise, the exempting provision is not to be treated as applying to taxes or charges under an applied law. ##### 22 Saving provision for applied law where place ceases to be a Commonwealth place * (1) This section applies if an applied law ceases, or ceased, to have effect in relation to a place at a particular time because the place ceases, or ceased, to be a Commonwealth place at that time. * (2) The following things are not affected: * (a) the previous operation of the applied law before that time; * (b) any right, privilege, obligation or liability acquired, accrued or incurred under the applied law; * (c) any penalty, forfeiture or punishment incurred in respect of an offence against the applied law; * (d) any investigation, legal proceeding or remedy in respect of any right, privilege, obligation, liability, penalty, forfeiture or punishment referred to in paragraph (b) or (c). * (3) Any penalty, forfeiture or punishment referred to in paragraph (2)(c) may be imposed as if the applied law had not ceased to have effect. * (4) An investigation, legal proceeding or remedy referred to in paragraph (2)(d) may be instituted, continued or enforced as if the applied law had not ceased to have effect. * (5) This section is not intended to affect the operation of a State law. ##### 23 Money paid or received under applied law * (1) The Commonwealth is liable to pay to a State amounts equal to amounts received by the Commonwealth (including amounts received by a State on behalf of the Commonwealth) under an applied law of the State. * (3) Amounts payable by the Commonwealth under subsection (1) are to be reduced by amounts paid by the Commonwealth under any applied law of the State concerned. For this purpose, **_amounts paid by the Commonwealth_** does not include amounts paid by way of tax. * (4) The Consolidated Revenue Fund is appropriated for the purpose of: * (a) payments under this section; and * (b) payments by the Commonwealth under an applied law. * (5) Despite subsection 105(2) of the _Public Governance, Performance and Accountability Act 2013_, an amount received under an applied law is not other CRF money for the purposes of that Act. ### Part 3--Miscellaneous ##### 24 Saving provision for State taxing law where place becomes a Commonwealth place * (1) This section applies if a State taxing law ceases, or ceased, to have effect in relation to a place at a particular time because the place becomes, or became, a Commonwealth place at that time. * (2) The following things are not affected: * (a) the previous operation of the State taxing law before that time; * (b) any right, privilege, obligation or liability acquired, accrued or incurred under the State taxing law; * (c) any penalty, forfeiture or punishment incurred in respect of an offence against the State taxing law; * (d) any investigation, legal proceeding or remedy in respect of any right, privilege, obligation, liability, penalty, forfeiture or punishment referred to in paragraph (b) or (c). * (3) Any penalty, forfeiture or punishment referred to in paragraph (2)(c) may be imposed as if the State taxing law had not ceased to have effect. * (4) An investigation, legal proceeding or remedy referred to in paragraph (2)(d) may be instituted, continued or enforced as if the State taxing law had not ceased to have effect. * (5) This section is not intended to affect the operation of any State taxing law. ##### 25 Regulations * (1) The GovernorGeneral may make regulations prescribing matters: * (a) required or permitted by this Act to be prescribed; or * (b) necessary or convenient to be prescribed for carrying out or giving effect to this Act. * (2) Subsection 12(2) of the _Legislative Instruments Act 2003_ does not apply to regulations made under this Act. ## Schedule 1-- taxing laws * Note: See section 3. ##### 1 * Each of the following laws of is a **_scheduled law_**: * (a) _Debits Tax Act 1990_; * (b) _Duties Act 1997_; * (c) _Payroll Tax Act 1971_; * (d) _Stamp Duties Act 1920_. ##### 2 * Each of the following laws of is a **_scheduled law_**: * (a) _Debits Tax Act 1990_; * (b) _Financial Institutions Duty Act 1982_; * (c) _Payroll Tax Act 1971_; * (d) _Stamps Act 1958_. ##### 3 * Each of the following laws of is a **_scheduled law_**: * (a) _Debits Tax Act 1990_; * (b) _Payroll Tax Act 1971_; * (c) _Stamp Act 1894_. ##### 4 * The _Stamp Act 1921_ of is a **_scheduled law_**. ##### 5 * Each of the following laws of is a **_scheduled law_**: * (a) _Debits Tax Act 1994_; * (b) _Financial Institutions Duty Act 1983_; * (c) _Payroll Tax Act 1971_; * (d) _Stamp Duties Act 1923_. ##### 6 * The _Payroll Tax Act 1971_ of is a **_scheduled law_**. #### Endnotes ##### Endnote 1--About the endnotes The endnotes provide details of the history of this legislation and its provisions. The following endnotes are included in each compilation: Endnote 1--About the endnotes Endnote 2--Abbreviation key Endnote 3--Legislation history Endnote 4--Amendment history Endnote 5--Uncommenced amendments Endnote 6--Modifications Endnote 7--Misdescribed amendments Endnote 8--Miscellaneous If there is no information under a particular endnote, the word "none" will appear in square brackets after the endnote heading. **Abbreviation key--Endnote 2** **The abbreviation key in this endnote sets out abbreviations that may be used in the endnotes. **Legislation history and amendment history--Endnotes 3 and 4** **Amending laws are annotated in the legislation history and amendment history. The legislation history in endnote 3 provides information about each law that has amended the compiled law. The information includes commencement information for amending laws and details of application, saving or transitional provisions that are not included in this compilation. The amendment history in endnote 4 provides information about amendments at the provision level. It also includes information about any provisions that have expired or otherwise ceased to have effect in accordance with a provision of the compiled law. **Uncommenced amendments--Endnote 5** **The effect of uncommenced amendments is not reflected in the text of the compiled law but the text of the amendments is included in endnote 5. **Modifications--Endnote 6** **If the compiled law is affected by a modification that is in force, details of the modification are included in endnote 6. **Misdescribed amendments--Endnote 7** **An amendment is a misdescribed amendment if the effect of the amendment cannot be incorporated into the text of the compilation. Any misdescribed amendment is included in endnote 7. **Miscellaneous--Endnote 8** **Endnote 8 includes any additional information that may be helpful for a reader of the compilation. ##### Endnote 2--Abbreviation key ##### Endnote 3--Legislation history ##### Endnote 4--Amendment history ##### Endnote 5--Uncommenced amendments [none] ##### Endnote 6--Modifications [none] ##### Endnote 7--Misdescribed amendments [none] ##### Endnote 8--Miscellaneous [none]
xlfe/gitlaw-au
acts/current/c/commonwealth places (mirror taxes) act 1998.md
Markdown
gpl-3.0
27,322
/* * SD-DSS-Util, a Utility Library and a Command Line Interface for SD-DSS. * Copyright (C) 2013 La Traccia http://www.latraccia.it/en/ * Developed by Francesco Pontillo * * 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 General Public License * along with this program. If not, see [http://www.gnu.org/licenses/]. */ package it.latraccia.dss.util.exception; public class SignaturePolicyAlgorithmMismatchException extends SignatureException { public SignaturePolicyAlgorithmMismatchException() { } public SignaturePolicyAlgorithmMismatchException(Exception e) { super(e); } @Override public String getMessage() { return "The selected explicit policy algorithm is not available!"; } }
latraccia/sd-dss-util
sd-dss-util-lib/src/main/java/it/latraccia/dss/util/exception/SignaturePolicyAlgorithmMismatchException.java
Java
gpl-3.0
1,247
/************************************************************************ AvalonDock Copyright (C) 2007-2013 Xceed Software Inc. This program is provided to you under the terms of the Microsoft Public License (Ms-PL) as published at https://opensource.org/licenses/MS-PL ************************************************************************/ using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Shapes; using AvalonDock.Layout; using AvalonDock.Themes; namespace AvalonDock.Controls { public class OverlayWindow : Window, IOverlayWindow { #region Members private ResourceDictionary currentThemeResourceDictionary; // = null private Canvas _mainCanvasPanel; private Grid _gridDockingManagerDropTargets; private Grid _gridAnchorablePaneDropTargets; private Grid _gridDocumentPaneDropTargets; private Grid _gridDocumentPaneFullDropTargets; private FrameworkElement _dockingManagerDropTargetBottom; private FrameworkElement _dockingManagerDropTargetTop; private FrameworkElement _dockingManagerDropTargetLeft; private FrameworkElement _dockingManagerDropTargetRight; private FrameworkElement _anchorablePaneDropTargetBottom; private FrameworkElement _anchorablePaneDropTargetTop; private FrameworkElement _anchorablePaneDropTargetLeft; private FrameworkElement _anchorablePaneDropTargetRight; private FrameworkElement _anchorablePaneDropTargetInto; private FrameworkElement _documentPaneDropTargetBottom; private FrameworkElement _documentPaneDropTargetTop; private FrameworkElement _documentPaneDropTargetLeft; private FrameworkElement _documentPaneDropTargetRight; private FrameworkElement _documentPaneDropTargetInto; private FrameworkElement _documentPaneDropTargetBottomAsAnchorablePane; private FrameworkElement _documentPaneDropTargetTopAsAnchorablePane; private FrameworkElement _documentPaneDropTargetLeftAsAnchorablePane; private FrameworkElement _documentPaneDropTargetRightAsAnchorablePane; private FrameworkElement _documentPaneFullDropTargetBottom; private FrameworkElement _documentPaneFullDropTargetTop; private FrameworkElement _documentPaneFullDropTargetLeft; private FrameworkElement _documentPaneFullDropTargetRight; private FrameworkElement _documentPaneFullDropTargetInto; private Path _previewBox; private IOverlayWindowHost _host; private LayoutFloatingWindowControl _floatingWindow = null; private List<IDropArea> _visibleAreas = new List<IDropArea>(); #endregion #region Constructors static OverlayWindow() { DefaultStyleKeyProperty.OverrideMetadata(typeof(OverlayWindow), new FrameworkPropertyMetadata(typeof(OverlayWindow))); OverlayWindow.AllowsTransparencyProperty.OverrideMetadata(typeof(OverlayWindow), new FrameworkPropertyMetadata(true)); OverlayWindow.WindowStyleProperty.OverrideMetadata(typeof(OverlayWindow), new FrameworkPropertyMetadata(WindowStyle.None)); OverlayWindow.ShowInTaskbarProperty.OverrideMetadata(typeof(OverlayWindow), new FrameworkPropertyMetadata(false)); OverlayWindow.ShowActivatedProperty.OverrideMetadata(typeof(OverlayWindow), new FrameworkPropertyMetadata(false)); OverlayWindow.VisibilityProperty.OverrideMetadata(typeof(OverlayWindow), new FrameworkPropertyMetadata(Visibility.Hidden)); } internal OverlayWindow(IOverlayWindowHost host) { _host = host; UpdateThemeResources(); } #endregion #region Overrides public override void OnApplyTemplate() { base.OnApplyTemplate(); _mainCanvasPanel = GetTemplateChild("PART_DropTargetsContainer") as Canvas; _gridDockingManagerDropTargets = GetTemplateChild("PART_DockingManagerDropTargets") as Grid; _gridAnchorablePaneDropTargets = GetTemplateChild("PART_AnchorablePaneDropTargets") as Grid; _gridDocumentPaneDropTargets = GetTemplateChild("PART_DocumentPaneDropTargets") as Grid; _gridDocumentPaneFullDropTargets = GetTemplateChild("PART_DocumentPaneFullDropTargets") as Grid; _gridDockingManagerDropTargets.Visibility = System.Windows.Visibility.Hidden; _gridAnchorablePaneDropTargets.Visibility = System.Windows.Visibility.Hidden; _gridDocumentPaneDropTargets.Visibility = System.Windows.Visibility.Hidden; if (_gridDocumentPaneFullDropTargets != null) _gridDocumentPaneFullDropTargets.Visibility = System.Windows.Visibility.Hidden; _dockingManagerDropTargetBottom = GetTemplateChild("PART_DockingManagerDropTargetBottom") as FrameworkElement; _dockingManagerDropTargetTop = GetTemplateChild("PART_DockingManagerDropTargetTop") as FrameworkElement; _dockingManagerDropTargetLeft = GetTemplateChild("PART_DockingManagerDropTargetLeft") as FrameworkElement; _dockingManagerDropTargetRight = GetTemplateChild("PART_DockingManagerDropTargetRight") as FrameworkElement; _anchorablePaneDropTargetBottom = GetTemplateChild("PART_AnchorablePaneDropTargetBottom") as FrameworkElement; _anchorablePaneDropTargetTop = GetTemplateChild("PART_AnchorablePaneDropTargetTop") as FrameworkElement; _anchorablePaneDropTargetLeft = GetTemplateChild("PART_AnchorablePaneDropTargetLeft") as FrameworkElement; _anchorablePaneDropTargetRight = GetTemplateChild("PART_AnchorablePaneDropTargetRight") as FrameworkElement; _anchorablePaneDropTargetInto = GetTemplateChild("PART_AnchorablePaneDropTargetInto") as FrameworkElement; _documentPaneDropTargetBottom = GetTemplateChild("PART_DocumentPaneDropTargetBottom") as FrameworkElement; _documentPaneDropTargetTop = GetTemplateChild("PART_DocumentPaneDropTargetTop") as FrameworkElement; _documentPaneDropTargetLeft = GetTemplateChild("PART_DocumentPaneDropTargetLeft") as FrameworkElement; _documentPaneDropTargetRight = GetTemplateChild("PART_DocumentPaneDropTargetRight") as FrameworkElement; _documentPaneDropTargetInto = GetTemplateChild("PART_DocumentPaneDropTargetInto") as FrameworkElement; _documentPaneDropTargetBottomAsAnchorablePane = GetTemplateChild("PART_DocumentPaneDropTargetBottomAsAnchorablePane") as FrameworkElement; _documentPaneDropTargetTopAsAnchorablePane = GetTemplateChild("PART_DocumentPaneDropTargetTopAsAnchorablePane") as FrameworkElement; _documentPaneDropTargetLeftAsAnchorablePane = GetTemplateChild("PART_DocumentPaneDropTargetLeftAsAnchorablePane") as FrameworkElement; _documentPaneDropTargetRightAsAnchorablePane = GetTemplateChild("PART_DocumentPaneDropTargetRightAsAnchorablePane") as FrameworkElement; _documentPaneFullDropTargetBottom = GetTemplateChild("PART_DocumentPaneFullDropTargetBottom") as FrameworkElement; _documentPaneFullDropTargetTop = GetTemplateChild("PART_DocumentPaneFullDropTargetTop") as FrameworkElement; _documentPaneFullDropTargetLeft = GetTemplateChild("PART_DocumentPaneFullDropTargetLeft") as FrameworkElement; _documentPaneFullDropTargetRight = GetTemplateChild("PART_DocumentPaneFullDropTargetRight") as FrameworkElement; _documentPaneFullDropTargetInto = GetTemplateChild("PART_DocumentPaneFullDropTargetInto") as FrameworkElement; _previewBox = GetTemplateChild("PART_PreviewBox") as Path; } protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { base.OnClosing(e); } #endregion #region Internal Methods internal void UpdateThemeResources(Theme oldTheme = null) { if (oldTheme != null) { if (oldTheme is DictionaryTheme) { if (currentThemeResourceDictionary != null) { Resources.MergedDictionaries.Remove(currentThemeResourceDictionary); currentThemeResourceDictionary = null; } } else { var resourceDictionaryToRemove = Resources.MergedDictionaries.FirstOrDefault(r => r.Source == oldTheme.GetResourceUri()); if (resourceDictionaryToRemove != null) Resources.MergedDictionaries.Remove( resourceDictionaryToRemove); } } if (_host.Manager.Theme != null) { if (_host.Manager.Theme is DictionaryTheme) { currentThemeResourceDictionary = ((DictionaryTheme)_host.Manager.Theme).ThemeResourceDictionary; Resources.MergedDictionaries.Add(currentThemeResourceDictionary); } else { Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = _host.Manager.Theme.GetResourceUri() }); } } } internal void EnableDropTargets() { if (_mainCanvasPanel != null) _mainCanvasPanel.Visibility = System.Windows.Visibility.Visible; } internal void HideDropTargets() { if (_mainCanvasPanel != null) _mainCanvasPanel.Visibility = System.Windows.Visibility.Hidden; } #endregion #region Private Methods /// <summary> /// This method controls the DropTargetInto button of the overlay window. /// It checks that only 1 of the defined ContentLayouts can be present on the LayoutDocumentPane or LayoutAnchorablePane. /// The combination between the ContentLayout Title and the ContentId is the search key, and has to be unique. /// If a floating window is dropped on a LayoutDocumentPane or LayoutAnchorablePane, it checks if one of the containing LayoutContents /// is already present on the LayoutDocumentPane or LayoutAnchorablePane. If so, then it will disable the DropTargetInto button. /// </summary> /// <param name="positionableElement">The given LayoutDocumentPane or LayoutAnchorablePane</param> private void SetDropTargetIntoVisibility(ILayoutPositionableElement positionableElement) { if (positionableElement is LayoutAnchorablePane) { _anchorablePaneDropTargetInto.Visibility = Visibility.Visible; } else if (positionableElement is LayoutDocumentPane) { _documentPaneDropTargetInto.Visibility = Visibility.Visible; } if (positionableElement == null || _floatingWindow.Model == null || positionableElement.AllowDuplicateContent) { return; } // Find all content layouts in the anchorable pane (object to drop on) var contentLayoutsOnPositionableElementPane = GetAllLayoutContents(positionableElement); // Find all content layouts in the floating window (object to drop) var contentLayoutsOnFloatingWindow = GetAllLayoutContents(_floatingWindow.Model); // If any of the content layouts is present in the drop area, then disable the DropTargetInto button. foreach (var content in contentLayoutsOnFloatingWindow) { if (!contentLayoutsOnPositionableElementPane.Any(item => item.Title == content.Title && item.ContentId == content.ContentId)) { continue; } if (positionableElement is LayoutAnchorablePane) { _anchorablePaneDropTargetInto.Visibility = Visibility.Hidden; } else if (positionableElement is LayoutDocumentPane) { _documentPaneDropTargetInto.Visibility = Visibility.Hidden; } break; } } /// <summary> /// Find any LayoutDocument or LayoutAnchorable from a given source (e.g. LayoutDocumentPane, LayoutAnchorableFloatingWindow, etc.) /// </summary> /// <param name="source">The given source to search in</param> /// <returns>A list of all LayoutContent's</returns> private List<LayoutContent> GetAllLayoutContents(object source) { var result = new List<LayoutContent>(); var documentFloatingWindow = source as LayoutDocumentFloatingWindow; if (documentFloatingWindow != null) { foreach (var layoutElement in documentFloatingWindow.Children) { result.AddRange(GetAllLayoutContents(layoutElement)); } } var anchorableFloatingWindow = source as LayoutAnchorableFloatingWindow; if (anchorableFloatingWindow != null) { foreach (var layoutElement in anchorableFloatingWindow.Children) { result.AddRange(GetAllLayoutContents(layoutElement)); } } var documentPaneGroup = source as LayoutDocumentPaneGroup; if (documentPaneGroup != null) { foreach (var layoutDocumentPane in documentPaneGroup.Children) { result.AddRange(GetAllLayoutContents(layoutDocumentPane)); } } var anchorablePaneGroup = source as LayoutAnchorablePaneGroup; if (anchorablePaneGroup != null) { foreach (var layoutDocumentPane in anchorablePaneGroup.Children) { result.AddRange(GetAllLayoutContents(layoutDocumentPane)); } } var documentPane = source as LayoutDocumentPane; if (documentPane != null) { foreach (var layoutContent in documentPane.Children) { result.Add(layoutContent); } } var anchorablePane = source as LayoutAnchorablePane; if (anchorablePane != null) { foreach (var layoutContent in anchorablePane.Children) { result.Add(layoutContent); } } var document = source as LayoutDocument; if (document != null) { result.Add(document); } var anchorable = source as LayoutAnchorable; if (anchorable != null) { result.Add(anchorable); } return result; } #endregion #region IOverlayWindow IEnumerable<IDropTarget> IOverlayWindow.GetTargets() { foreach (var visibleArea in _visibleAreas) { switch (visibleArea.Type) { case DropAreaType.DockingManager: { var dropAreaDockingManager = visibleArea as DropArea<DockingManager>; yield return new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetLeft.GetScreenArea(), DropTargetType.DockingManagerDockLeft); yield return new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetTop.GetScreenArea(), DropTargetType.DockingManagerDockTop); yield return new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetBottom.GetScreenArea(), DropTargetType.DockingManagerDockBottom); yield return new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetRight.GetScreenArea(), DropTargetType.DockingManagerDockRight); } break; case DropAreaType.AnchorablePane: { var dropAreaAnchorablePane = visibleArea as DropArea<LayoutAnchorablePaneControl>; yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetLeft.GetScreenArea(), DropTargetType.AnchorablePaneDockLeft); yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetTop.GetScreenArea(), DropTargetType.AnchorablePaneDockTop); yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetRight.GetScreenArea(), DropTargetType.AnchorablePaneDockRight); yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetBottom.GetScreenArea(), DropTargetType.AnchorablePaneDockBottom); if (_anchorablePaneDropTargetInto.IsVisible) yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetInto.GetScreenArea(), DropTargetType.AnchorablePaneDockInside); var parentPaneModel = dropAreaAnchorablePane.AreaElement.Model as LayoutAnchorablePane; LayoutAnchorableTabItem lastAreaTabItem = null; foreach (var dropAreaTabItem in dropAreaAnchorablePane.AreaElement.FindVisualChildren<LayoutAnchorableTabItem>()) { var tabItemModel = dropAreaTabItem.Model as LayoutAnchorable; lastAreaTabItem = lastAreaTabItem == null || lastAreaTabItem.GetScreenArea().Right < dropAreaTabItem.GetScreenArea().Right ? dropAreaTabItem : lastAreaTabItem; int tabIndex = parentPaneModel.Children.IndexOf(tabItemModel); yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, dropAreaTabItem.GetScreenArea(), DropTargetType.AnchorablePaneDockInside, tabIndex); } if (lastAreaTabItem != null) { var lastAreaTabItemScreenArea = lastAreaTabItem.GetScreenArea(); var newAreaTabItemScreenArea = new Rect(lastAreaTabItemScreenArea.TopRight, new Point(lastAreaTabItemScreenArea.Right + lastAreaTabItemScreenArea.Width, lastAreaTabItemScreenArea.Bottom)); if (newAreaTabItemScreenArea.Right < dropAreaAnchorablePane.AreaElement.GetScreenArea().Right) yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, newAreaTabItemScreenArea, DropTargetType.AnchorablePaneDockInside, parentPaneModel.Children.Count); } var dropAreaTitle = dropAreaAnchorablePane.AreaElement.FindVisualChildren<AnchorablePaneTitle>().FirstOrDefault(); if (dropAreaTitle != null) yield return new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, dropAreaTitle.GetScreenArea(), DropTargetType.AnchorablePaneDockInside); } break; case DropAreaType.DocumentPane: { bool isDraggingAnchorables = _floatingWindow.Model is LayoutAnchorableFloatingWindow; if (isDraggingAnchorables && _gridDocumentPaneFullDropTargets != null) { var dropAreaDocumentPane = visibleArea as DropArea<LayoutDocumentPaneControl>; if (_documentPaneFullDropTargetLeft.IsVisible) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetLeft.GetScreenArea(), DropTargetType.DocumentPaneDockLeft); if (_documentPaneFullDropTargetTop.IsVisible) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetTop.GetScreenArea(), DropTargetType.DocumentPaneDockTop); if (_documentPaneFullDropTargetRight.IsVisible) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetRight.GetScreenArea(), DropTargetType.DocumentPaneDockRight); if (_documentPaneFullDropTargetBottom.IsVisible) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetBottom.GetScreenArea(), DropTargetType.DocumentPaneDockBottom); if (_documentPaneFullDropTargetInto.IsVisible) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneDockInside); var parentPaneModel = dropAreaDocumentPane.AreaElement.Model as LayoutDocumentPane; LayoutDocumentTabItem lastAreaTabItem = null; foreach (var dropAreaTabItem in dropAreaDocumentPane.AreaElement.FindVisualChildren<LayoutDocumentTabItem>()) { var tabItemModel = dropAreaTabItem.Model; lastAreaTabItem = lastAreaTabItem == null || lastAreaTabItem.GetScreenArea().Right < dropAreaTabItem.GetScreenArea().Right ? dropAreaTabItem : lastAreaTabItem; int tabIndex = parentPaneModel.Children.IndexOf(tabItemModel); yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, dropAreaTabItem.GetScreenArea(), DropTargetType.DocumentPaneDockInside, tabIndex); } if (lastAreaTabItem != null) { var lastAreaTabItemScreenArea = lastAreaTabItem.GetScreenArea(); var newAreaTabItemScreenArea = new Rect(lastAreaTabItemScreenArea.TopRight, new Point(lastAreaTabItemScreenArea.Right + lastAreaTabItemScreenArea.Width, lastAreaTabItemScreenArea.Bottom)); if (newAreaTabItemScreenArea.Right < dropAreaDocumentPane.AreaElement.GetScreenArea().Right) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, newAreaTabItemScreenArea, DropTargetType.DocumentPaneDockInside, parentPaneModel.Children.Count); } if (_documentPaneDropTargetLeftAsAnchorablePane.IsVisible) yield return new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetLeftAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableLeft); if (_documentPaneDropTargetTopAsAnchorablePane.IsVisible) yield return new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetTopAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableTop); if (_documentPaneDropTargetRightAsAnchorablePane.IsVisible) yield return new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetRightAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableRight); if (_documentPaneDropTargetBottomAsAnchorablePane.IsVisible) yield return new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetBottomAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableBottom); } else { var dropAreaDocumentPane = visibleArea as DropArea<LayoutDocumentPaneControl>; if (_documentPaneDropTargetLeft.IsVisible) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetLeft.GetScreenArea(), DropTargetType.DocumentPaneDockLeft); if (_documentPaneDropTargetTop.IsVisible) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetTop.GetScreenArea(), DropTargetType.DocumentPaneDockTop); if (_documentPaneDropTargetRight.IsVisible) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetRight.GetScreenArea(), DropTargetType.DocumentPaneDockRight); if (_documentPaneDropTargetBottom.IsVisible) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetBottom.GetScreenArea(), DropTargetType.DocumentPaneDockBottom); if (_documentPaneDropTargetInto.IsVisible) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneDockInside); var parentPaneModel = dropAreaDocumentPane.AreaElement.Model as LayoutDocumentPane; LayoutDocumentTabItem lastAreaTabItem = null; foreach (var dropAreaTabItem in dropAreaDocumentPane.AreaElement.FindVisualChildren<LayoutDocumentTabItem>()) { var tabItemModel = dropAreaTabItem.Model; lastAreaTabItem = lastAreaTabItem == null || lastAreaTabItem.GetScreenArea().Right < dropAreaTabItem.GetScreenArea().Right ? dropAreaTabItem : lastAreaTabItem; int tabIndex = parentPaneModel.Children.IndexOf(tabItemModel); yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, dropAreaTabItem.GetScreenArea(), DropTargetType.DocumentPaneDockInside, tabIndex); } if (lastAreaTabItem != null) { var lastAreaTabItemScreenArea = lastAreaTabItem.GetScreenArea(); var newAreaTabItemScreenArea = new Rect(lastAreaTabItemScreenArea.TopRight, new Point(lastAreaTabItemScreenArea.Right + lastAreaTabItemScreenArea.Width, lastAreaTabItemScreenArea.Bottom)); if (newAreaTabItemScreenArea.Right < dropAreaDocumentPane.AreaElement.GetScreenArea().Right) yield return new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, newAreaTabItemScreenArea, DropTargetType.DocumentPaneDockInside, parentPaneModel.Children.Count); } } } break; case DropAreaType.DocumentPaneGroup: { var dropAreaDocumentPane = visibleArea as DropArea<LayoutDocumentPaneGroupControl>; if (_documentPaneDropTargetInto.IsVisible) yield return new DocumentPaneGroupDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneGroupDockInside); } break; } } yield break; } void IOverlayWindow.DragEnter(LayoutFloatingWindowControl floatingWindow) { _floatingWindow = floatingWindow; EnableDropTargets(); } void IOverlayWindow.DragLeave(LayoutFloatingWindowControl floatingWindow) { Visibility = System.Windows.Visibility.Hidden; _floatingWindow = null; } void IOverlayWindow.DragEnter(IDropArea area) { var floatingWindowManager = _floatingWindow.Model.Root.Manager; _visibleAreas.Add(area); FrameworkElement areaElement; switch (area.Type) { case DropAreaType.DockingManager: var dropAreaDockingManager = area as DropArea<DockingManager>; if (dropAreaDockingManager.AreaElement != floatingWindowManager) { _visibleAreas.Remove(area); return; } areaElement = _gridDockingManagerDropTargets; break; case DropAreaType.AnchorablePane: areaElement = _gridAnchorablePaneDropTargets; var dropAreaAnchorablePaneGroup = area as DropArea<LayoutAnchorablePaneControl>; var layoutAnchorablePane = dropAreaAnchorablePaneGroup.AreaElement.Model as LayoutAnchorablePane; if (layoutAnchorablePane.Root.Manager != floatingWindowManager) { _visibleAreas.Remove(area); return; } SetDropTargetIntoVisibility(layoutAnchorablePane); break; case DropAreaType.DocumentPaneGroup: { areaElement = _gridDocumentPaneDropTargets; var dropAreaDocumentPaneGroup = area as DropArea<LayoutDocumentPaneGroupControl>; var layoutDocumentPane = (dropAreaDocumentPaneGroup.AreaElement.Model as LayoutDocumentPaneGroup).Children.First() as LayoutDocumentPane; var parentDocumentPaneGroup = layoutDocumentPane.Parent as LayoutDocumentPaneGroup; if (parentDocumentPaneGroup.Root.Manager != floatingWindowManager) { _visibleAreas.Remove(area); return; } _documentPaneDropTargetLeft.Visibility = Visibility.Hidden; _documentPaneDropTargetRight.Visibility = Visibility.Hidden; _documentPaneDropTargetTop.Visibility = Visibility.Hidden; _documentPaneDropTargetBottom.Visibility = Visibility.Hidden; } break; case DropAreaType.DocumentPane: default: { bool isDraggingAnchorables = _floatingWindow.Model is LayoutAnchorableFloatingWindow; if (isDraggingAnchorables && _gridDocumentPaneFullDropTargets != null) { areaElement = _gridDocumentPaneFullDropTargets; var dropAreaDocumentPaneGroup = area as DropArea<LayoutDocumentPaneControl>; var layoutDocumentPane = dropAreaDocumentPaneGroup.AreaElement.Model as LayoutDocumentPane; var parentDocumentPaneGroup = layoutDocumentPane.Parent as LayoutDocumentPaneGroup; if (layoutDocumentPane.Root.Manager != floatingWindowManager) { _visibleAreas.Remove(area); return; } SetDropTargetIntoVisibility(layoutDocumentPane); if (parentDocumentPaneGroup != null && parentDocumentPaneGroup.Children.Where(c => c.IsVisible).Count() > 1) { var manager = parentDocumentPaneGroup.Root.Manager; if (!manager.AllowMixedOrientation) { _documentPaneFullDropTargetLeft.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Horizontal ? Visibility.Visible : Visibility.Hidden; _documentPaneFullDropTargetRight.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Horizontal ? Visibility.Visible : Visibility.Hidden; _documentPaneFullDropTargetTop.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Vertical ? Visibility.Visible : Visibility.Hidden; _documentPaneFullDropTargetBottom.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Vertical ? Visibility.Visible : Visibility.Hidden; } else { _documentPaneFullDropTargetLeft.Visibility = Visibility.Visible; _documentPaneFullDropTargetRight.Visibility = Visibility.Visible; _documentPaneFullDropTargetTop.Visibility = Visibility.Visible; _documentPaneFullDropTargetBottom.Visibility = Visibility.Visible; } } else if (parentDocumentPaneGroup == null && layoutDocumentPane != null && layoutDocumentPane.ChildrenCount == 0) { _documentPaneFullDropTargetLeft.Visibility = Visibility.Hidden; _documentPaneFullDropTargetRight.Visibility = Visibility.Hidden; _documentPaneFullDropTargetTop.Visibility = Visibility.Hidden; _documentPaneFullDropTargetBottom.Visibility = Visibility.Hidden; } else { _documentPaneFullDropTargetLeft.Visibility = Visibility.Visible; _documentPaneFullDropTargetRight.Visibility = Visibility.Visible; _documentPaneFullDropTargetTop.Visibility = Visibility.Visible; _documentPaneFullDropTargetBottom.Visibility = Visibility.Visible; } if (parentDocumentPaneGroup != null && parentDocumentPaneGroup.Children.Where(c => c.IsVisible).Count() > 1) { int indexOfDocumentPane = parentDocumentPaneGroup.Children.Where(ch => ch.IsVisible).ToList().IndexOf(layoutDocumentPane); bool isFirstChild = indexOfDocumentPane == 0; bool isLastChild = indexOfDocumentPane == parentDocumentPaneGroup.ChildrenCount - 1; var manager = parentDocumentPaneGroup.Root.Manager; if (!manager.AllowMixedOrientation) { _documentPaneDropTargetBottomAsAnchorablePane.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Vertical ? (isLastChild ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden) : System.Windows.Visibility.Hidden; _documentPaneDropTargetTopAsAnchorablePane.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Vertical ? (isFirstChild ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden) : System.Windows.Visibility.Hidden; _documentPaneDropTargetLeftAsAnchorablePane.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Horizontal ? (isFirstChild ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden) : System.Windows.Visibility.Hidden; _documentPaneDropTargetRightAsAnchorablePane.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Horizontal ? (isLastChild ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden) : System.Windows.Visibility.Hidden; } else { _documentPaneDropTargetBottomAsAnchorablePane.Visibility = System.Windows.Visibility.Visible; _documentPaneDropTargetLeftAsAnchorablePane.Visibility = System.Windows.Visibility.Visible; _documentPaneDropTargetRightAsAnchorablePane.Visibility = System.Windows.Visibility.Visible; _documentPaneDropTargetTopAsAnchorablePane.Visibility = System.Windows.Visibility.Visible; } } else { _documentPaneDropTargetBottomAsAnchorablePane.Visibility = System.Windows.Visibility.Visible; _documentPaneDropTargetLeftAsAnchorablePane.Visibility = System.Windows.Visibility.Visible; _documentPaneDropTargetRightAsAnchorablePane.Visibility = System.Windows.Visibility.Visible; _documentPaneDropTargetTopAsAnchorablePane.Visibility = System.Windows.Visibility.Visible; } } else { areaElement = _gridDocumentPaneDropTargets; var dropAreaDocumentPaneGroup = area as DropArea<LayoutDocumentPaneControl>; var layoutDocumentPane = dropAreaDocumentPaneGroup.AreaElement.Model as LayoutDocumentPane; var parentDocumentPaneGroup = layoutDocumentPane.Parent as LayoutDocumentPaneGroup; if (layoutDocumentPane.Root.Manager != floatingWindowManager) { _visibleAreas.Remove(area); return; } SetDropTargetIntoVisibility(layoutDocumentPane); if (parentDocumentPaneGroup != null && parentDocumentPaneGroup.Children.Where(c => c.IsVisible).Count() > 1) { var manager = parentDocumentPaneGroup.Root.Manager; if (!manager.AllowMixedOrientation) { _documentPaneDropTargetLeft.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Horizontal ? Visibility.Visible : Visibility.Hidden; _documentPaneDropTargetRight.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Horizontal ? Visibility.Visible : Visibility.Hidden; _documentPaneDropTargetTop.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Vertical ? Visibility.Visible : Visibility.Hidden; _documentPaneDropTargetBottom.Visibility = parentDocumentPaneGroup.Orientation == Orientation.Vertical ? Visibility.Visible : Visibility.Hidden; } else { _documentPaneDropTargetLeft.Visibility = Visibility.Visible; _documentPaneDropTargetRight.Visibility = Visibility.Visible; _documentPaneDropTargetTop.Visibility = Visibility.Visible; _documentPaneDropTargetBottom.Visibility = Visibility.Visible; } } else if (parentDocumentPaneGroup == null && layoutDocumentPane != null && layoutDocumentPane.ChildrenCount == 0) { _documentPaneDropTargetLeft.Visibility = Visibility.Hidden; _documentPaneDropTargetRight.Visibility = Visibility.Hidden; _documentPaneDropTargetTop.Visibility = Visibility.Hidden; _documentPaneDropTargetBottom.Visibility = Visibility.Hidden; } else { _documentPaneDropTargetLeft.Visibility = Visibility.Visible; _documentPaneDropTargetRight.Visibility = Visibility.Visible; _documentPaneDropTargetTop.Visibility = Visibility.Visible; _documentPaneDropTargetBottom.Visibility = Visibility.Visible; } } } break; } Canvas.SetLeft(areaElement, area.DetectionRect.Left - Left); Canvas.SetTop(areaElement, area.DetectionRect.Top - Top); areaElement.Width = area.DetectionRect.Width; areaElement.Height = area.DetectionRect.Height; areaElement.Visibility = System.Windows.Visibility.Visible; } void IOverlayWindow.DragLeave(IDropArea area) { _visibleAreas.Remove(area); FrameworkElement areaElement; switch (area.Type) { case DropAreaType.DockingManager: areaElement = _gridDockingManagerDropTargets; break; case DropAreaType.AnchorablePane: areaElement = _gridAnchorablePaneDropTargets; break; case DropAreaType.DocumentPaneGroup: areaElement = _gridDocumentPaneDropTargets; break; case DropAreaType.DocumentPane: default: { bool isDraggingAnchorables = _floatingWindow.Model is LayoutAnchorableFloatingWindow; if (isDraggingAnchorables && _gridDocumentPaneFullDropTargets != null) areaElement = _gridDocumentPaneFullDropTargets; else areaElement = _gridDocumentPaneDropTargets; } break; } areaElement.Visibility = System.Windows.Visibility.Hidden; } void IOverlayWindow.DragEnter(IDropTarget target) { var previewBoxPath = target.GetPreviewPath(this, _floatingWindow.Model as LayoutFloatingWindow); if (previewBoxPath != null) { _previewBox.Data = previewBoxPath; _previewBox.Visibility = System.Windows.Visibility.Visible; } } void IOverlayWindow.DragLeave(IDropTarget target) { _previewBox.Visibility = System.Windows.Visibility.Hidden; } void IOverlayWindow.DragDrop(IDropTarget target) { target.Drop(_floatingWindow.Model as LayoutFloatingWindow); } #endregion } }
Altaxo/Altaxo
Libraries/AvalonDock/AvalonDock/Controls/OverlayWindow.cs
C#
gpl-3.0
35,333
<!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_45) on Sun Jun 09 12:16:07 GMT+05:30 2013 --> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <TITLE> Uses of Class org.apache.solr.util.AdjustableSemaphore (Solr 4.3.1 API) </TITLE> <META NAME="date" CONTENT="2013-06-09"> <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.apache.solr.util.AdjustableSemaphore (Solr 4.3.1 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/apache/solr/util/AdjustableSemaphore.html" title="class in org.apache.solr.util"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../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/apache/solr/util//class-useAdjustableSemaphore.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="AdjustableSemaphore.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.apache.solr.util.AdjustableSemaphore</B></H2> </CENTER> No usage of org.apache.solr.util.AdjustableSemaphore <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/apache/solr/util/AdjustableSemaphore.html" title="class in org.apache.solr.util"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../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/apache/solr/util//class-useAdjustableSemaphore.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="AdjustableSemaphore.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 &copy; 2000-2013 Apache Software Foundation. All Rights Reserved.</i> <script src='../../../../../prettify.js' type='text/javascript'></script> <script type='text/javascript'> (function(){ var oldonload = window.onload; if (typeof oldonload != 'function') { window.onload = prettyPrint; } else { window.onload = function() { oldonload(); prettyPrint(); } } })(); </script> </BODY> </HTML>
jeffersonmolleri/sesra
bin/solr-4.3.1/docs/solr-core/org/apache/solr/util/class-use/AdjustableSemaphore.html
HTML
gpl-3.0
6,334
/****************************************************************************! * _ _ _ _ * * | |__ _ __ / \ | |_| |__ ___ _ __ __ _ * * | '_ \| '__/ _ \| __| '_ \ / _ \ '_ \ / _` | * * | |_) | | / ___ \ |_| | | | __/ | | | (_| | * * |_.__/|_|/_/ \_\__|_| |_|\___|_| |_|\__,_| * * * * www.brathena.org * ****************************************************************************** * src/map/chrif.c * ****************************************************************************** * Copyright (c) brAthena Dev Team * * Copyright (c) Hercules Dev Team * * Copyright (c) Athena Dev Teams * * * * Licenciado sob a licença GNU GPL * * Para mais informações leia o arquivo LICENSE na raíz do emulador * *****************************************************************************/ #define BRATHENA_CORE #include "config/core.h" // AUTOTRADE_PERSISTENCY, STATS_OPT_OUT #include "chrif.h" #include "map/battle.h" #include "map/clif.h" #include "map/elemental.h" #include "map/guild.h" #include "map/homunculus.h" #include "map/instance.h" #include "map/intif.h" #include "map/map.h" #include "map/mercenary.h" #include "map/npc.h" #include "map/pc.h" #include "map/pet.h" #include "map/quest.h" #include "map/skill.h" #include "map/status.h" #include "map/storage.h" #include "common/cbasetypes.h" #include "common/ers.h" #include "common/memmgr.h" #include "common/nullpo.h" #include "common/showmsg.h" #include "common/socket.h" #include "common/strlib.h" #include "common/timer.h" #include <stdio.h> #include <stdlib.h> #include <sys/types.h> struct chrif_interface chrif_s; //Used Packets: //2af8: Outgoing, chrif_connect -> 'connect to charserver / auth @ charserver' //2af9: Incoming, chrif_connectack -> 'answer of the 2af8 login(ok / fail)' //2afa: Outgoing, chrif_sendmap -> 'sending our maps' //2afb: Incoming, chrif_sendmapack -> 'Maps received successfully / or not ..' //2afc: Outgoing, chrif_scdata_request -> request sc_data for pc->authok'ed char. <- new command reuses previous one. //2afd: Incoming, chrif_authok -> 'client authentication ok' //2afe: Outgoing, send_usercount_tochar -> 'sends player count of this map server to charserver' //2aff: Outgoing, chrif_send_users_tochar -> 'sends all actual connected character ids to charserver' //2b00: Incoming, map_setusers -> 'set the actual usercount? PACKET.2B COUNT.L.. ?' (not sure) //2b01: Outgoing, chrif_save -> 'charsave of char XY account XY (complete struct)' //2b02: Outgoing, chrif_charselectreq -> 'player returns from ingame to charserver to select another char.., this packets includes sessid etc' ? (not 100% sure) //2b03: Incoming, clif_charselectok -> '' (i think its the packet after enterworld?) (not sure) //2b04: Incoming, chrif_recvmap -> 'getting maps from charserver of other mapserver's' //2b05: Outgoing, chrif_changemapserver -> 'Tell the charserver the mapchange / quest for ok...' //2b06: Incoming, chrif_changemapserverack -> 'answer of 2b05, ok/fail, data: dunno^^' //2b07: Outgoing, chrif_removefriend -> 'Tell charserver to remove friend_id from char_id friend list' //2b08: Outgoing, chrif_searchcharid -> '...' //2b09: Incoming, map_addchariddb -> 'Adds a name to the nick db' //2b0a: Incoming/Outgoing, socket_datasync() //2b0b: Outgoing, update charserv skillid2idx //2b0c: Outgoing, chrif_changeemail -> 'change mail address ...' //2b0d: Incoming, chrif_changedsex -> 'Change sex of acc XY' (or char) //2b0e: Outgoing, chrif_char_ask_name -> 'Do some operations (change sex, ban / unban etc)' //2b0f: Incoming, chrif_char_ask_name_answer -> 'answer of the 2b0e' //2b10: Outgoing, chrif_updatefamelist -> 'Update the fame ranking lists and send them' //2b11: Outgoing, chrif_divorce -> 'tell the charserver to do divorce' //2b12: Incoming, chrif_divorceack -> 'divorce chars //2b13: FREE //2b14: Incoming, chrif_accountban -> 'not sure: kick the player with message XY' //2b15: FREE //2b16: Outgoing, chrif_ragsrvinfo -> 'sends base / job / drop rates ....' //2b17: Outgoing, chrif_char_offline -> 'tell the charserver that the char is now offline' //2b18: Outgoing, chrif_char_reset_offline -> 'set all players OFF!' //2b19: Outgoing, chrif_char_online -> 'tell the charserver that the char .. is online' //2b1a: Outgoing, chrif_buildfamelist -> 'Build the fame ranking lists and send them' //2b1b: Incoming, chrif_recvfamelist -> 'Receive fame ranking lists' //2b1c: Outgoing, chrif_save_scdata -> 'Send sc_data of player for saving.' //2b1d: Incoming, chrif_load_scdata -> 'received sc_data of player for loading.' //2b1e: Incoming, chrif_update_ip -> 'Request forwarded from char-server for interserver IP sync.' [Lance] //2b1f: Incoming, chrif_disconnectplayer -> 'disconnects a player (aid X) with the message XY ... 0x81 ..' [Sirius] //2b20: Incoming, chrif_removemap -> 'remove maps of a server (sample: its going offline)' [Sirius] //2b21: Incoming, chrif_save_ack. Returned after a character has been "final saved" on the char-server. [Skotlex] //2b22: Incoming, chrif_updatefamelist_ack. Updated one position in the fame list. //2b23: Outgoing, chrif_keepalive. charserver ping. //2b24: Incoming, chrif_keepalive_ack. charserver ping reply. //2b25: Incoming, chrif_deadopt -> 'Removes baby from Father ID and Mother ID' //2b26: Outgoing, chrif_authreq -> 'client authentication request' //2b27: Incoming, chrif_authfail -> 'client authentication failed' //This define should spare writing the check in every function. [Skotlex] #define chrif_check(a) do { if(!chrif->isconnected()) return a; } while(0) /// Resets all the data. void chrif_reset(void) { // TODO kick everyone out and reset everything [FlavioJS] exit(EXIT_FAILURE); } /// Checks the conditions for the server to stop. /// Releases the cookie when all characters are saved. /// If all the conditions are met, it stops the core loop. void chrif_check_shutdown(void) { if( core->runflag != MAPSERVER_ST_SHUTDOWN ) return; if( db_size(chrif->auth_db) > 0 ) return; core->runflag = CORE_ST_STOP; } struct auth_node* chrif_search(int account_id) { return (struct auth_node*)idb_get(chrif->auth_db, account_id); } struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state state) { struct auth_node *node = chrif->search(account_id); return ( node && node->char_id == char_id && node->state == state ) ? node : NULL; } bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) { struct auth_node *node; if ( (node = chrif->auth_check(account_id, char_id, state) ) ) { int fd = node->sd ? node->sd->fd : node->fd; if ( sockt->session[fd] && sockt->session[fd]->session_data == node->sd ) sockt->session[fd]->session_data = NULL; if ( node->sd ) { if( node->sd->regs.vars ) node->sd->regs.vars->destroy(node->sd->regs.vars, script->reg_destroy); if( node->sd->regs.arrays ) node->sd->regs.arrays->destroy(node->sd->regs.arrays, script->array_free_db); aFree(node->sd); } ers_free(chrif->auth_db_ers, node); idb_remove(chrif->auth_db,account_id); return true; } return false; } //Moves the sd character to the auth_db structure. bool chrif_sd_to_auth(TBL_PC* sd, enum sd_state state) { struct auth_node *node; nullpo_retr(false, sd); if ( chrif->search(sd->status.account_id) ) return false; //Already exists? node = ers_alloc(chrif->auth_db_ers, struct auth_node); memset(node, 0, sizeof(struct auth_node)); node->account_id = sd->status.account_id; node->char_id = sd->status.char_id; node->login_id1 = sd->login_id1; node->login_id2 = sd->login_id2; node->sex = sd->status.sex; node->fd = sd->fd; node->sd = sd; //Data from logged on char. node->node_created = timer->gettick(); //timestamp for node timeouts node->state = state; sd->state.active = 0; idb_put(chrif->auth_db, node->account_id, node); return true; } bool chrif_auth_logout(TBL_PC* sd, enum sd_state state) { nullpo_retr(false, sd); if(sd->fd && state == ST_LOGOUT) { //Disassociate player, and free it after saving ack returns. [Skotlex] //fd info must not be lost for ST_MAPCHANGE as a final packet needs to be sent to the player. if ( sockt->session[sd->fd] ) sockt->session[sd->fd]->session_data = NULL; sd->fd = 0; } return chrif->sd_to_auth(sd, state); } bool chrif_auth_finished(TBL_PC* sd) { struct auth_node *node; nullpo_retr(false, sd); node = chrif->search(sd->status.account_id); if ( node && node->sd == sd && node->state == ST_LOGIN ) { node->sd = NULL; return chrif->auth_delete(node->account_id, node->char_id, ST_LOGIN); } return false; } // sets char-server's user id void chrif_setuserid(char *id) { nullpo_retv(id); memcpy(chrif->userid, id, NAME_LENGTH); } // sets char-server's password void chrif_setpasswd(char *pwd) { nullpo_retv(pwd); memcpy(chrif->passwd, pwd, NAME_LENGTH); } // security check, prints warning if using default password void chrif_checkdefaultlogin(void) { if (strcmp(chrif->userid, "s1")==0 && strcmp(chrif->passwd, "p1")==0) { ShowWarning("Utilizar o usuario/senha padrao 's1/p1' nao e recomendado.\n"); ShowNotice("Por favor edite sua tabela 'login' para criar usuario/senha corretos para o inter-server (sexo 'S')\n"); ShowNotice("Apos isso, modifique usuario/senha utilizados no conf/map-server.conf (ou conf/import/map_conf.txt)\n"); } } // sets char-server's ip address bool chrif_setip(const char* ip) { char ip_str[16]; nullpo_retr(false, ip); if ( !( chrif->ip = sockt->host2ip(ip) ) ) { ShowWarning("Falha ao tentar resolver o IP do servidor de personagem! (%s)\n", ip); return false; } safestrncpy(chrif->ip_str, ip, sizeof(chrif->ip_str)); ShowInfo("Endereco do servidor de personagem : '"CL_WHITE"%s"CL_RESET"' -> '"CL_WHITE"%s"CL_RESET"'.\n", ip, sockt->ip2str(chrif->ip, ip_str)); return true; } // sets char-server's port number void chrif_setport(uint16 port) { chrif->port = port; } // says whether the char-server is connected or not int chrif_isconnected(void) { return (chrif->fd > 0 && sockt->session[chrif->fd] != NULL && chrif->state == 2); } /*========================================== * Saves character data. * Flag = 1: Character is quitting * Flag = 2: Character is changing map-servers *------------------------------------------*/ bool chrif_save(struct map_session_data *sd, int flag) { nullpo_ret(sd); pc->makesavestatus(sd); if (flag && sd->state.active) { //Store player data which is quitting //FIXME: SC are lost if there's no connection at save-time because of the way its related data is cleared immediately after this function. [Skotlex] if ( chrif->isconnected() ) chrif->save_scdata(sd); if ( !chrif->auth_logout(sd,flag == 1 ? ST_LOGOUT : ST_MAPCHANGE) ) ShowError("chrif_save: Falha ao definir jogador %d:%d para propriedade de logout!\n", sd->status.account_id, sd->status.char_id); } chrif_check(false); //Character is saved on reconnect. //For data sync if (sd->state.storage_flag == STORAGE_FLAG_GUILD) gstorage->save(sd->status.account_id, sd->status.guild_id, flag); if (flag) sd->state.storage_flag = STORAGE_FLAG_CLOSED; //Force close it. //Saving of registry values. if (sd->vars_dirty) intif->saveregistry(sd); WFIFOHEAD(chrif->fd, sizeof(sd->status) + 13); WFIFOW(chrif->fd,0) = 0x2b01; WFIFOW(chrif->fd,2) = sizeof(sd->status) + 13; WFIFOL(chrif->fd,4) = sd->status.account_id; WFIFOL(chrif->fd,8) = sd->status.char_id; WFIFOB(chrif->fd,12) = (flag==1)?1:0; //Flag to tell char-server this character is quitting. memcpy(WFIFOP(chrif->fd,13), &sd->status, sizeof(sd->status)); WFIFOSET(chrif->fd, WFIFOW(chrif->fd,2)); if( sd->status.pet_id > 0 && sd->pd ) intif->save_petdata(sd->status.account_id,&sd->pd->pet); if( sd->hd && homun_alive(sd->hd) ) homun->save(sd->hd); if( sd->md && mercenary->get_lifetime(sd->md) > 0 ) mercenary->save(sd->md); if( sd->ed && elemental->get_lifetime(sd->ed) > 0 ) elemental->save(sd->ed); if( sd->save_quest ) intif->quest_save(sd); return true; } // connects to char-server (plaintext) void chrif_connect(int fd) { ShowStatus("Logando no servidor de personagem...\n"); WFIFOHEAD(fd,60); WFIFOW(fd,0) = 0x2af8; memcpy(WFIFOP(fd,2), chrif->userid, NAME_LENGTH); memcpy(WFIFOP(fd,26), chrif->passwd, NAME_LENGTH); WFIFOL(fd,50) = 0; WFIFOL(fd,54) = htonl(clif->map_ip); WFIFOW(fd,58) = htons(clif->map_port); WFIFOSET(fd,60); } // sends maps to char-server void chrif_sendmap(int fd) { int i; ShowStatus("Enviando mapas para o servidor de personagem...\n"); // Sending normal maps, not instances WFIFOHEAD(fd, 4 + instance->start_id * 4); WFIFOW(fd,0) = 0x2afa; for(i = 0; i < instance->start_id; i++) WFIFOW(fd,4+i*4) = map_id2index(i); WFIFOW(fd,2) = 4 + i * 4; WFIFOSET(fd,WFIFOW(fd,2)); } // receive maps from some other map-server (relayed via char-server) void chrif_recvmap(int fd) { int i, j; uint32 ip = ntohl(RFIFOL(fd,4)); uint16 port = ntohs(RFIFOW(fd,8)); for(i = 10, j = 0; i < RFIFOW(fd,2); i += 4, j++) { map->setipport(RFIFOW(fd,i), ip, port); } if (battle_config.etc_log) ShowStatus("Recebendo mapas de %d.%d.%d.%d:%d (%d mapas)\n", CONVIP(ip), port, j); chrif->other_mapserver_count++; } // remove specified maps (used when some other map-server disconnects) void chrif_removemap(int fd) { int i, j; uint32 ip = RFIFOL(fd,4); uint16 port = RFIFOW(fd,8); for(i = 10, j = 0; i < RFIFOW(fd, 2); i += 4, j++) map->eraseipport(RFIFOW(fd, i), ip, port); chrif->other_mapserver_count--; if(battle_config.etc_log) ShowStatus("Removendo mapas do servidor %d.%d.%d.%d:%d (%d mapas)\n", CONVIP(ip), port, j); } // received after a character has been "final saved" on the char-server void chrif_save_ack(int fd) { chrif->auth_delete(RFIFOL(fd,2), RFIFOL(fd,6), ST_LOGOUT); chrif->check_shutdown(); } // request to move a character between mapservers bool chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port) { nullpo_ret(sd); if (chrif->other_mapserver_count < 1) {//No other map servers are online! clif->authfail_fd(sd->fd, 0); return false; } chrif_check(false); WFIFOHEAD(chrif->fd,35); WFIFOW(chrif->fd, 0) = 0x2b05; WFIFOL(chrif->fd, 2) = sd->bl.id; WFIFOL(chrif->fd, 6) = sd->login_id1; WFIFOL(chrif->fd,10) = sd->login_id2; WFIFOL(chrif->fd,14) = sd->status.char_id; WFIFOW(chrif->fd,18) = sd->mapindex; WFIFOW(chrif->fd,20) = sd->bl.x; WFIFOW(chrif->fd,22) = sd->bl.y; WFIFOL(chrif->fd,24) = htonl(ip); WFIFOW(chrif->fd,28) = htons(port); WFIFOB(chrif->fd,30) = sd->status.sex; WFIFOL(chrif->fd,31) = htonl(sockt->session[sd->fd]->client_addr); WFIFOL(chrif->fd,35) = sd->group_id; WFIFOSET(chrif->fd,39); return true; } /// map-server change request acknowledgment (positive or negative) /// R 2b06 <account_id>.L <login_id1>.L <login_id2>.L <char_id>.L <map_index>.W <x>.W <y>.W <ip>.L <port>.W bool chrif_changemapserverack(int account_id, int login_id1, int login_id2, int char_id, short map_index, short x, short y, uint32 ip, uint16 port) { struct auth_node *node; if ( !( node = chrif->auth_check(account_id, char_id, ST_MAPCHANGE) ) ) return false; if ( !login_id1 ) { ShowError("chrif_changemapserverack: Falha na mudanca do servidor de mapas.\n"); clif->authfail_fd(node->fd, 0); // Disconnected from server } else clif->changemapserver(node->sd, map_index, x, y, ntohl(ip), ntohs(port)); //Player has been saved already, remove him from memory. [Skotlex] chrif->auth_delete(account_id, char_id, ST_MAPCHANGE); return (!login_id1)?false:true; // Is this the best approach here? } /*========================================== * *------------------------------------------*/ void chrif_connectack(int fd) { static bool char_init_done = false; if (RFIFOB(fd,2)) { ShowFatalError("Conexao com o servidor de personagem falhou %d.\n", RFIFOB(fd,2)); exit(EXIT_FAILURE); } ShowStatus("Conectado com sucesso ao servidor de personagem (Conexao: '"CL_WHITE"%d"CL_RESET"').\n",fd); chrif->state = 1; chrif->connected = 1; chrif->sendmap(fd); ShowNpc("Evento '"CL_WHITE"OnInterIfInit"CL_RESET"' executado em '"CL_WHITE"%d"CL_RESET"' NPCs.\n", npc->event_doall("OnInterIfInit")); if( !char_init_done ) { char_init_done = true; ShowNpc("Evento '"CL_WHITE"OnInterIfInitOnce"CL_RESET"' executado em '"CL_WHITE"%d"CL_RESET"' NPCs.\n", npc->event_doall("OnInterIfInitOnce")); guild->castle_map_init(); } sockt->datasync(fd, true); chrif->skillid2idx(fd); } /** * @see DBApply */ int chrif_reconnect(DBKey key, DBData *data, va_list ap) { struct auth_node *node = DB->data2ptr(data); nullpo_ret(node); switch (node->state) { case ST_LOGIN: if ( node->sd ) {//Since there is no way to request the char auth, make it fail. pc->authfail(node->sd); chrif_char_offline(node->sd); chrif->auth_delete(node->account_id, node->char_id, ST_LOGIN); } break; case ST_LOGOUT: //Re-send final save chrif->save(node->sd, 1); break; case ST_MAPCHANGE: { //Re-send map-change request. struct map_session_data *sd = node->sd; uint32 ip; uint16 port; if( map->mapname2ipport(sd->mapindex,&ip,&port) == 0 ) chrif->changemapserver(sd, ip, port); else //too much lag/timeout is the closest explanation for this error. clif->authfail_fd(sd->fd, 3); // timeout break; } } return 0; } /// Called when all the connection steps are completed. void chrif_on_ready(void) { static bool once = false; ShowStatus("Servidor de mapas agora esta online.\n"); chrif->state = 2; chrif->check_shutdown(); //If there are players online, send them to the char-server. [Skotlex] chrif->send_users_tochar(); //Auth db reconnect handling chrif->auth_db->foreach(chrif->auth_db,chrif->reconnect); //Re-save any storages that were modified in the disconnection time. [Skotlex] storage->reconnect(); //Re-save any guild castles that were modified in the disconnection time. guild->castle_reconnect(-1, 0, 0); if( !once ) { #ifdef AUTOTRADE_PERSISTENCY pc->autotrade_load(); #endif once = true; } } /*========================================== * *------------------------------------------*/ void chrif_sendmapack(int fd) { if (RFIFOB(fd,2)) { ShowFatalError("chrif : falha ao enviar a lista de mapas para o servidor de personagem %d\n", RFIFOB(fd,2)); exit(EXIT_FAILURE); } memcpy(map->wisp_server_name, RFIFOP(fd,3), NAME_LENGTH); chrif->on_ready(); } /*========================================== * Request sc_data from charserver [Skotlex] *------------------------------------------*/ bool chrif_scdata_request(int account_id, int char_id) { #ifdef ENABLE_SC_SAVING chrif_check(false); WFIFOHEAD(chrif->fd,10); WFIFOW(chrif->fd,0) = 0x2afc; WFIFOL(chrif->fd,2) = account_id; WFIFOL(chrif->fd,6) = char_id; WFIFOSET(chrif->fd,10); #endif return true; } /*========================================== * Request auth confirmation *------------------------------------------*/ void chrif_authreq(struct map_session_data *sd, bool hstandalone) { struct auth_node *node= chrif->search(sd->bl.id); nullpo_retv(sd); if( node != NULL || !chrif->isconnected() ) { sockt->eof(sd->fd); return; } WFIFOHEAD(chrif->fd,20); WFIFOW(chrif->fd,0) = 0x2b26; WFIFOL(chrif->fd,2) = sd->status.account_id; WFIFOL(chrif->fd,6) = sd->status.char_id; WFIFOL(chrif->fd,10) = sd->login_id1; WFIFOB(chrif->fd,14) = sd->status.sex; WFIFOL(chrif->fd,15) = htonl(sockt->session[sd->fd]->client_addr); WFIFOB(chrif->fd,19) = hstandalone ? 1 : 0; WFIFOSET(chrif->fd,20); chrif->sd_to_auth(sd, ST_LOGIN); } /*========================================== * Auth confirmation ack *------------------------------------------*/ void chrif_authok(int fd) { int account_id, group_id, char_id; uint32 login_id1,login_id2; time_t expiration_time; struct mmo_charstatus* charstatus; struct auth_node *node; bool changing_mapservers; TBL_PC* sd; //Check if both servers agree on the struct's size if( RFIFOW(fd,2) - 25 != sizeof(struct mmo_charstatus) ) { ShowError("chrif_authok: Tamanho de dados incompativel! %d != %"PRIuS"\n", RFIFOW(fd,2) - 25, sizeof(struct mmo_charstatus)); return; } account_id = RFIFOL(fd,4); login_id1 = RFIFOL(fd,8); login_id2 = RFIFOL(fd,12); expiration_time = (time_t)(int32)RFIFOL(fd,16); group_id = RFIFOL(fd,20); changing_mapservers = (RFIFOB(fd,24)); charstatus = (struct mmo_charstatus*)RFIFOP(fd,25); char_id = charstatus->char_id; //Check if we don't already have player data in our server //Causes problems if the currently connected player tries to quit or this data belongs to an already connected player which is trying to re-auth. if ( ( sd = map->id2sd(account_id) ) != NULL ) return; if ( ( node = chrif->search(account_id) ) == NULL ) return; // should not happen if ( node->state != ST_LOGIN ) return; //character in logout phase, do not touch that data. if ( node->sd == NULL ) { /* //When we receive double login info and the client has not connected yet, //discard the older one and keep the new one. chrif->auth_delete(node->account_id, node->char_id, ST_LOGIN); */ return; // should not happen } sd = node->sd; if( core->runflag == MAPSERVER_ST_RUNNING && node->account_id == account_id && node->char_id == char_id && node->login_id1 == login_id1 ) { //Auth Ok if (pc->authok(sd, login_id2, expiration_time, group_id, charstatus, changing_mapservers)) return; } else { //Auth Failed pc->authfail(sd); } chrif_char_offline(sd); //Set him offline, the char server likely has it set as online already. chrif->auth_delete(account_id, char_id, ST_LOGIN); } // client authentication failed void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used (but is available) */ int account_id, char_id; uint32 login_id1; char sex; struct auth_node* node; account_id = RFIFOL(fd,2); char_id = RFIFOL(fd,6); login_id1 = RFIFOL(fd,10); sex = RFIFOB(fd,14); node = chrif->search(account_id); if( node != NULL && node->account_id == account_id && node->char_id == char_id && node->login_id1 == login_id1 && node->sex == sex && node->state == ST_LOGIN ) {// found a match clif->authfail_fd(node->fd, 0); // Disconnected from server chrif->auth_delete(account_id, char_id, ST_LOGIN); } } /** * This can still happen (client times out while waiting for char to confirm auth data) * @see DBApply */ int auth_db_cleanup_sub(DBKey key, DBData *data, va_list ap) { struct auth_node *node = DB->data2ptr(data); nullpo_retr(1, node); if(DIFF_TICK(timer->gettick(),node->node_created)>60000) { const char* states[] = { "Logou", "Deslogou", "Mudanca de mapa" }; switch (node->state) { case ST_LOGOUT: //Re-save attempt (->sd should never be null here). node->node_created = timer->gettick(); //Refresh tick (avoid char-server load if connection is really bad) chrif->save(node->sd, 1); break; default: //Clear data. any connected players should have timed out by now. ShowInfo("auth_db: Node (estado %s) tempo esgotado para %d:%d\n", states[node->state], node->account_id, node->char_id); chrif->char_offline_nsd(node->account_id, node->char_id); chrif->auth_delete(node->account_id, node->char_id, node->state); break; } return 1; } return 0; } int auth_db_cleanup(int tid, int64 tick, int id, intptr_t data) { chrif_check(0); chrif->auth_db->foreach(chrif->auth_db, chrif->auth_db_cleanup_sub); return 0; } /*========================================== * Request char selection *------------------------------------------*/ bool chrif_charselectreq(struct map_session_data* sd, uint32 s_ip) { nullpo_ret(sd); if( !sd->bl.id || !sd->login_id1 ) return false; chrif_check(false); WFIFOHEAD(chrif->fd,22); WFIFOW(chrif->fd, 0) = 0x2b02; WFIFOL(chrif->fd, 2) = sd->bl.id; WFIFOL(chrif->fd, 6) = sd->login_id1; WFIFOL(chrif->fd,10) = sd->login_id2; WFIFOL(chrif->fd,14) = htonl(s_ip); WFIFOL(chrif->fd,18) = sd->group_id; WFIFOSET(chrif->fd,22); return true; } /*========================================== * Search Char trough id on char serv *------------------------------------------*/ bool chrif_searchcharid(int char_id) { if( !char_id ) return false; chrif_check(false); WFIFOHEAD(chrif->fd,6); WFIFOW(chrif->fd,0) = 0x2b08; WFIFOL(chrif->fd,2) = char_id; WFIFOSET(chrif->fd,6); return true; } /*========================================== * Change Email *------------------------------------------*/ bool chrif_changeemail(int id, const char *actual_email, const char *new_email) { if (battle_config.etc_log) ShowInfo("chrif_changeemail: conta: %d, email_atual: '%s', novo_email: '%s'.\n", id, actual_email, new_email); nullpo_retr(false, actual_email); nullpo_retr(false, new_email); chrif_check(false); WFIFOHEAD(chrif->fd,86); WFIFOW(chrif->fd,0) = 0x2b0c; WFIFOL(chrif->fd,2) = id; memcpy(WFIFOP(chrif->fd,6), actual_email, 40); memcpy(WFIFOP(chrif->fd,46), new_email, 40); WFIFOSET(chrif->fd,86); return true; } /*========================================== * S 2b0e <accid>.l <name>.24B <type>.w { <additional fields>.12B } * { <year>.w <month>.w <day>.w <hour>.w <minute>.w <second>.w } * Send an account modification request to the login server (via char server). * type of operation: @see enum zh_char_ask_name * block { n/a } * ban { <year>.w <month>.w <day>.w <hour>.w <minute>.w <second>.w } * unblock { n/a } * unban { n/a } * changesex { n/a } -- use chrif_changesex * charban { <year>.w <month>.w <day>.w <hour>.w <minute>.w <second>.w } * charunban { n/a } * changecharsex { <sex>.b } -- use chrif_changesex *------------------------------------------*/ bool chrif_char_ask_name(int acc, const char* character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second) { nullpo_retr(false, character_name); chrif_check(false); WFIFOHEAD(chrif->fd,44); WFIFOW(chrif->fd,0) = 0x2b0e; WFIFOL(chrif->fd,2) = acc; safestrncpy((char*)WFIFOP(chrif->fd,6), character_name, NAME_LENGTH); WFIFOW(chrif->fd,30) = operation_type; if (operation_type == CHAR_ASK_NAME_BAN || operation_type == CHAR_ASK_NAME_CHARBAN) { WFIFOW(chrif->fd,32) = year; WFIFOW(chrif->fd,34) = month; WFIFOW(chrif->fd,36) = day; WFIFOW(chrif->fd,38) = hour; WFIFOW(chrif->fd,40) = minute; WFIFOW(chrif->fd,42) = second; } WFIFOSET(chrif->fd,44); return true; } /** * Requests a sex change (either per character or per account). * * @param sd The character's data. * @param change_account Whether to change the per-account sex. * @retval true. */ bool chrif_changesex(struct map_session_data *sd, bool change_account) { nullpo_retr(false, sd); chrif_check(false); WFIFOHEAD(chrif->fd,44); WFIFOW(chrif->fd,0) = 0x2b0e; WFIFOL(chrif->fd,2) = sd->status.account_id; safestrncpy((char*)WFIFOP(chrif->fd,6), sd->status.name, NAME_LENGTH); WFIFOW(chrif->fd,30) = change_account ? CHAR_ASK_NAME_CHANGESEX : CHAR_ASK_NAME_CHANGECHARSEX; if (!change_account) WFIFOB(chrif->fd,32) = sd->status.sex == SEX_MALE ? SEX_FEMALE : SEX_MALE; WFIFOSET(chrif->fd,44); clif->message(sd->fd, msg_sd(sd,408)); //"Disconnecting to perform change-sex request..." if (sd->fd) clif->authfail_fd(sd->fd, 15); else map->quit(sd); return true; } /*========================================== * R 2b0f <accid>.l <name>.24B <type>.w <answer>.w * Processing a reply to chrif->char_ask_name() (request to modify an account). * type of operation: @see chrif_char_ask_name * type of answer: @see hz_char_ask_name_answer *------------------------------------------*/ bool chrif_char_ask_name_answer(int acc, const char* player_name, uint16 type, uint16 answer) { struct map_session_data* sd; char action[25]; char output[256]; bool charsrv = ( type == CHAR_ASK_NAME_CHARBAN || type == CHAR_ASK_NAME_CHARUNBAN ) ? true : false; nullpo_retr(false, player_name); sd = map->id2sd(acc); if( acc < 0 || sd == NULL ) { ShowError("chrif_char_ask_name_answer falhou - jogador offline.\n"); return false; } /* re-use previous msg_number */ if( type == CHAR_ASK_NAME_CHARBAN ) type = CHAR_ASK_NAME_BAN; if( type == CHAR_ASK_NAME_CHARUNBAN ) type = CHAR_ASK_NAME_UNBAN; if( type >= CHAR_ASK_NAME_BLOCK && type <= CHAR_ASK_NAME_CHANGESEX ) snprintf(action,25,"%s",msg_sd(sd,427+type)); //block|ban|unblock|unban|change the sex of else snprintf(action,25,"???"); switch( answer ) { case CHAR_ASK_NAME_ANS_DONE: sprintf(output, msg_sd(sd,charsrv?434:424), action, NAME_LENGTH, player_name); break; case CHAR_ASK_NAME_ANS_NOTFOUND: sprintf(output, msg_sd(sd,425), NAME_LENGTH, player_name); break; case CHAR_ASK_NAME_ANS_GMLOW: sprintf(output, msg_sd(sd,426), action, NAME_LENGTH, player_name); break; case CHAR_ASK_NAME_ANS_OFFLINE: sprintf(output, msg_sd(sd,427), action, NAME_LENGTH, player_name); break; default: output[0] = '\0'; break; } clif->message(sd->fd, output); return true; } /*========================================== * Request char server to change sex of char (modified by Yor) *------------------------------------------*/ void chrif_changedsex(int fd) { int acc = RFIFOL(fd,2); //int sex = RFIFOL(fd,6); // Dead store. Uncomment if needed again. if ( battle_config.etc_log ) ShowNotice("chrif_changedsex %d.\n", acc); // Path to activate this response: // Map(start) (0x2b0e type 5) -> Char(0x2727) -> Login // Login(0x2723) [ALL] -> Char (0x2b0d)[ALL] -> Map (HERE) // Char will usually be "logged in" despite being forced to log-out in the beginning // of this process, but there's no need to perform map-server specific response // as everything should been changed through char-server [Panikon] } /*========================================== * Request Char Server to Divorce Players *------------------------------------------*/ bool chrif_divorce(int partner_id1, int partner_id2) { chrif_check(false); WFIFOHEAD(chrif->fd,10); WFIFOW(chrif->fd,0) = 0x2b11; WFIFOL(chrif->fd,2) = partner_id1; WFIFOL(chrif->fd,6) = partner_id2; WFIFOSET(chrif->fd,10); return true; } /*========================================== * Divorce players * only used if 'partner_id' is offline *------------------------------------------*/ bool chrif_divorceack(int char_id, int partner_id) { struct map_session_data* sd; int i; if( !char_id || !partner_id ) return false; if( ( sd = map->charid2sd(char_id) ) != NULL && sd->status.partner_id == partner_id ) { sd->status.partner_id = 0; for(i = 0; i < MAX_INVENTORY; i++) if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F){ logs->item_getrem(0, sd, &sd->status.inventory[i], -1, "Script"); pc->delitem(sd, i, 1, 0, DELITEM_NORMAL); } } if( ( sd = map->charid2sd(partner_id) ) != NULL && sd->status.partner_id == char_id ) { sd->status.partner_id = 0; for(i = 0; i < MAX_INVENTORY; i++) if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F){ logs->consume(sd,&sd->status.inventory[i],1,"Divorce"); pc->delitem(sd, i, 1, 0, DELITEM_NORMAL); } } return true; } /*========================================== * Removes Baby from parents *------------------------------------------*/ void chrif_deadopt(int father_id, int mother_id, int child_id) { struct map_session_data* sd; int idx = skill->get_index(WE_CALLBABY); if( father_id && ( sd = map->charid2sd(father_id) ) != NULL && sd->status.child == child_id ) { sd->status.child = 0; sd->status.skill[idx].id = 0; sd->status.skill[idx].lv = 0; sd->status.skill[idx].flag = 0; clif->deleteskill(sd,WE_CALLBABY); } if( mother_id && ( sd = map->charid2sd(mother_id) ) != NULL && sd->status.child == child_id ) { sd->status.child = 0; sd->status.skill[idx].id = 0; sd->status.skill[idx].lv = 0; sd->status.skill[idx].flag = 0; clif->deleteskill(sd,WE_CALLBABY); } } /*========================================== * Disconnection of a player (account or char has been banned of has a status, from login or char server) by [Yor] *------------------------------------------*/ void chrif_idbanned(int fd) { int id; struct map_session_data *sd; id = RFIFOL(fd,2); if ( battle_config.etc_log ) ShowNotice("chrif_idbanned %d.\n", id); sd = ( RFIFOB(fd,6) == 2 ) ? map->charid2sd(id) : map->id2sd(id); if ( id < 0 || sd == NULL ) { /* player not online or unknown id, either way no error is necessary (since if you try to ban a offline char it still works) */ return; } sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters if (RFIFOB(fd,6) == 0) { // 0: change of status int ret_status = RFIFOL(fd,7); // status or final date of a banishment if(0<ret_status && ret_status<=9) clif->message(sd->fd, msg_sd(sd,411+ret_status)); // Message IDs (for search convenience): 412, 413, 414, 415, 416, 417, 418, 419, 420 else if(ret_status==100) clif->message(sd->fd, msg_sd(sd,421)); else clif->message(sd->fd, msg_sd(sd,420)); //"Your account has not more authorized." } else if (RFIFOB(fd,6) == 1) { // 1: ban time_t timestamp; char tmpstr[2048]; timestamp = (time_t)RFIFOL(fd,7); // status or final date of a banishment safestrncpy(tmpstr, msg_sd(sd,423), sizeof(tmpstr)); //"Your account has been banished until " strftime(tmpstr + strlen(tmpstr), 24, "%d-%m-%Y %H:%M:%S", localtime(&timestamp)); clif->message(sd->fd, tmpstr); } else if (RFIFOB(fd,6) == 2) { // 2: change of status for character time_t timestamp; char tmpstr[2048]; timestamp = (time_t)RFIFOL(fd,7); // status or final date of a banishment safestrncpy(tmpstr, msg_sd(sd,433), sizeof(tmpstr)); //"This character has been banned until " strftime(tmpstr + strlen(tmpstr), 24, "%d-%m-%Y %H:%M:%S", localtime(&timestamp)); clif->message(sd->fd, tmpstr); } sockt->eof(sd->fd); // forced to disconnect for the change map->quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X] } //Disconnect the player out of the game, simple packet //packet.w AID.L WHY.B 2+4+1 = 7byte int chrif_disconnectplayer(int fd) { struct map_session_data* sd; int account_id = RFIFOL(fd, 2); sd = map->id2sd(account_id); if( sd == NULL ) { struct auth_node* auth = chrif->search(account_id); if( auth != NULL && chrif->auth_delete(account_id, auth->char_id, ST_LOGIN) ) return 0; return -1; } if (!sd->fd) { //No connection if (sd->state.autotrade) map->quit(sd); //Remove it. //Else we don't remove it because the char should have a timer to remove the player because it force-quit before, //and we don't want them kicking their previous instance before the 10 secs penalty time passes. [Skotlex] return 0; } switch(RFIFOB(fd, 6)) { case 1: clif->authfail_fd(sd->fd, 1); break; //server closed case 2: clif->authfail_fd(sd->fd, 2); break; //someone else logged in case 3: clif->authfail_fd(sd->fd, 4); break; //server overpopulated case 4: clif->authfail_fd(sd->fd, 10); break; //out of available time paid for case 5: clif->authfail_fd(sd->fd, 15); break; //forced to dc by gm } return 0; } /*========================================== * Request/Receive top 10 Fame character list *------------------------------------------*/ int chrif_updatefamelist(struct map_session_data* sd) { char type; nullpo_retr(0, sd); chrif_check(-1); switch(sd->class_ & MAPID_UPPERMASK) { case MAPID_BLACKSMITH: type = RANKTYPE_BLACKSMITH; break; case MAPID_ALCHEMIST: type = RANKTYPE_ALCHEMIST; break; case MAPID_TAEKWON: type = RANKTYPE_TAEKWON; break; default: return 0; } WFIFOHEAD(chrif->fd, 11); WFIFOW(chrif->fd,0) = 0x2b10; WFIFOL(chrif->fd,2) = sd->status.char_id; WFIFOL(chrif->fd,6) = sd->status.fame; WFIFOB(chrif->fd,10) = type; WFIFOSET(chrif->fd,11); return 0; } bool chrif_buildfamelist(void) { chrif_check(false); WFIFOHEAD(chrif->fd,2); WFIFOW(chrif->fd,0) = 0x2b1a; WFIFOSET(chrif->fd,2); return true; } void chrif_recvfamelist(int fd) { int num, size; int total = 0, len = 8; memset(pc->smith_fame_list, 0, sizeof(pc->smith_fame_list)); memset(pc->chemist_fame_list, 0, sizeof(pc->chemist_fame_list)); memset(pc->taekwon_fame_list, 0, sizeof(pc->taekwon_fame_list)); size = RFIFOW(fd, 6); //Blacksmith block size for (num = 0; len < size && num < MAX_FAME_LIST; num++) { memcpy(&pc->smith_fame_list[num], RFIFOP(fd,len), sizeof(struct fame_list)); len += sizeof(struct fame_list); } total += num; size = RFIFOW(fd, 4); //Alchemist block size for (num = 0; len < size && num < MAX_FAME_LIST; num++) { memcpy(&pc->chemist_fame_list[num], RFIFOP(fd,len), sizeof(struct fame_list)); len += sizeof(struct fame_list); } total += num; size = RFIFOW(fd, 2); //Total packet length for (num = 0; len < size && num < MAX_FAME_LIST; num++) { memcpy(&pc->taekwon_fame_list[num], RFIFOP(fd,len), sizeof(struct fame_list)); len += sizeof(struct fame_list); } total += num; ShowInfo("Recebida a lista de fama de '"CL_WHITE"%d"CL_RESET"' personagens.\n", total); } /// fame ranking update confirmation /// R 2b22 <table>.B <index>.B <value>.L int chrif_updatefamelist_ack(int fd) { struct fame_list* list; uint8 index; switch (RFIFOB(fd,2)) { case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; default: return 0; } index = RFIFOB(fd, 3); if (index >= MAX_FAME_LIST) return 0; list[index].fame = RFIFOL(fd,4); return 1; } bool chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the player and sends it to the char-server for saving. [Skotlex] #ifdef ENABLE_SC_SAVING int i, count=0; int64 tick; struct status_change_data data; struct status_change *sc; const struct TimerData *td; nullpo_retr(false, sd); sc = &sd->sc; chrif_check(false); tick = timer->gettick(); WFIFOHEAD(chrif->fd, 14 + SC_MAX*sizeof(struct status_change_data)); WFIFOW(chrif->fd,0) = 0x2b1c; WFIFOL(chrif->fd,4) = sd->status.account_id; WFIFOL(chrif->fd,8) = sd->status.char_id; for (i = 0; i < SC_MAX; i++) { if (!sc->data[i]) continue; if (sc->data[i]->timer != INVALID_TIMER) { td = timer->get(sc->data[i]->timer); if (td == NULL || td->func != status->change_timer) continue; if (DIFF_TICK32(td->tick,tick) > 0) data.tick = DIFF_TICK32(td->tick,tick); //Duration that is left before ending. else data.tick = 0; //Negative tick does not necessarily mean that sc has expired } else data.tick = -1; //Infinite duration data.type = i; data.val1 = sc->data[i]->val1; data.val2 = sc->data[i]->val2; data.val3 = sc->data[i]->val3; data.val4 = sc->data[i]->val4; memcpy(WFIFOP(chrif->fd,14 +count*sizeof(struct status_change_data)), &data, sizeof(struct status_change_data)); count++; } if (count == 0) return true; //Nothing to save. | Everything was as successful as if there was something to save. WFIFOW(chrif->fd,12) = count; WFIFOW(chrif->fd,2) = 14 +count*sizeof(struct status_change_data); //Total packet size WFIFOSET(chrif->fd,WFIFOW(chrif->fd,2)); #endif return true; } //Retrieve and load sc_data for a player. [Skotlex] bool chrif_load_scdata(int fd) { #ifdef ENABLE_SC_SAVING struct map_session_data *sd; int aid, cid, i, count; aid = RFIFOL(fd,4); //Player Account ID cid = RFIFOL(fd,8); //Player Char ID sd = map->id2sd(aid); if ( !sd ) { ShowError("chrif_load_scdata: Jogador de ID %d nao encontrado!\n", aid); return false; } if ( sd->status.char_id != cid ) { ShowError("chrif_load_scdata: Dados recebidos da conta %d, char id incompativel (%d != %d)!\n", aid, sd->status.char_id, cid); return false; } count = RFIFOW(fd,12); //sc_count for (i = 0; i < count; i++) { struct status_change_data *data = (struct status_change_data*)RFIFOP(fd,14 + i*sizeof(struct status_change_data)); status->change_start(NULL, &sd->bl, (sc_type)data->type, 10000, data->val1, data->val2, data->val3, data->val4, data->tick, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK|SCFLAG_LOADED|SCFLAG_FIXEDRATE); } pc->scdata_received(sd); #endif return true; } /*========================================== * Send rates to char server [Wizputer] * S 2b16 <base rate>.L <job rate>.L <drop rate>.L *------------------------------------------*/ bool chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate) { chrif_check(false); WFIFOHEAD(chrif->fd,14); WFIFOW(chrif->fd,0) = 0x2b16; WFIFOL(chrif->fd,2) = base_rate; WFIFOL(chrif->fd,6) = job_rate; WFIFOL(chrif->fd,10) = drop_rate; WFIFOSET(chrif->fd,14); return true; } /*========================================= * Tell char-server character disconnected [Wizputer] *-----------------------------------------*/ bool chrif_char_offline_nsd(int account_id, int char_id) { chrif_check(false); WFIFOHEAD(chrif->fd,10); WFIFOW(chrif->fd,0) = 0x2b17; WFIFOL(chrif->fd,2) = char_id; WFIFOL(chrif->fd,6) = account_id; WFIFOSET(chrif->fd,10); return true; } /*========================================= * Tell char-server to reset all chars offline [Wizputer] *-----------------------------------------*/ bool chrif_flush(void) { chrif_check(false); sockt->set_nonblocking(chrif->fd, 0); sockt->flush_fifos(); sockt->set_nonblocking(chrif->fd, 1); return true; } /*========================================= * Tell char-server to reset all chars offline [Wizputer] *-----------------------------------------*/ bool chrif_char_reset_offline(void) { chrif_check(false); WFIFOHEAD(chrif->fd,2); WFIFOW(chrif->fd,0) = 0x2b18; WFIFOSET(chrif->fd,2); return true; } /*========================================= * Tell char-server character is online [Wizputer]. Look like unused. *-----------------------------------------*/ bool chrif_char_online(struct map_session_data *sd) { chrif_check(false); nullpo_retr(false, sd); WFIFOHEAD(chrif->fd,10); WFIFOW(chrif->fd,0) = 0x2b19; WFIFOL(chrif->fd,2) = sd->status.char_id; WFIFOL(chrif->fd,6) = sd->status.account_id; WFIFOSET(chrif->fd,10); return true; } /// Called when the connection to Char Server is disconnected. void chrif_on_disconnect(void) { if( chrif->connected != 1 ) ShowWarning("Conexao com o servidor de personagem perdida.\n\n"); chrif->connected = 0; chrif->other_mapserver_count = 0; //Reset counter. We receive ALL maps from all map-servers on reconnect. map->eraseallipport(); //Attempt to reconnect in a second. [Skotlex] timer->add(timer->gettick() + 1000, chrif->check_connect_char_server, 0, 0); } void chrif_update_ip(int fd) { uint32 new_ip; WFIFOHEAD(fd,6); new_ip = sockt->host2ip(chrif->ip_str); if (new_ip && new_ip != chrif->ip) chrif->ip = new_ip; //Update chrif->ip new_ip = clif->refresh_ip(); if (!new_ip) return; //No change WFIFOW(fd,0) = 0x2736; WFIFOL(fd,2) = htonl(new_ip); WFIFOSET(fd,6); } // pings the charserver ( since on-demand flag.ping was introduced, shouldn't this be dropped? only wasting traffic and processing [Ind]) void chrif_keepalive(int fd) { WFIFOHEAD(fd,2); WFIFOW(fd,0) = 0x2b23; WFIFOSET(fd,2); } void chrif_keepalive_ack(int fd) { sockt->session[fd]->flag.ping = 0;/* reset ping state, we received a packet */ } void chrif_skillid2idx(int fd) { int i, count = 0; if( fd == 0 ) fd = chrif->fd; if( !sockt->session_is_valid(fd) ) return; WFIFOHEAD(fd,4 + (MAX_SKILL * 4)); WFIFOW(fd,0) = 0x2b0b; for(i = 0; i < MAX_SKILL; i++) { if( skill->dbs->db[i].nameid ) { WFIFOW(fd, 4 + (count*4)) = skill->dbs->db[i].nameid; WFIFOW(fd, 6 + (count*4)) = i; count++; } } WFIFOW(fd,2) = 4 + (count * 4); WFIFOSET(fd,4 + (count * 4)); } /*========================================== * *------------------------------------------*/ int chrif_parse(int fd) { int packet_len, cmd; // only process data from the char-server if ( fd != chrif->fd ) { ShowDebug("chrif_parse: Desconectando sessao invalida #%d\n", fd); sockt->close(fd); return 0; } if ( sockt->session[fd]->flag.eof ) { sockt->close(fd); chrif->fd = -1; chrif->on_disconnect(); return 0; } else if ( sockt->session[fd]->flag.ping ) {/* we've reached stall time */ if( DIFF_TICK(sockt->last_tick, sockt->session[fd]->rdata_tick) > (sockt->stall_time * 2) ) {/* we can't wait any longer */ sockt->eof(fd); return 0; } else if( sockt->session[fd]->flag.ping != 2 ) { /* we haven't sent ping out yet */ chrif->keepalive(fd); sockt->session[fd]->flag.ping = 2; } } while ( RFIFOREST(fd) >= 2 ) { cmd = RFIFOW(fd,0); if (cmd < 0x2af8 || cmd >= 0x2af8 + ARRAYLENGTH(chrif->packet_len_table) || chrif->packet_len_table[cmd-0x2af8] == 0) { int result = intif->parse(fd); // Passed on to the intif if (result == 1) continue; // Treated in intif if (result == 2) return 0; // Didn't have enough data (len==-1) ShowWarning("chrif_parse: sessao #%d, intif->parse falhou (comando nao reconhecido 0x%.4x).\n", fd, cmd); sockt->eof(fd); return 0; } if ( ( packet_len = chrif->packet_len_table[cmd-0x2af8] ) == -1) { // dynamic-length packet, second WORD holds the length if (RFIFOREST(fd) < 4) return 0; packet_len = RFIFOW(fd,2); } if ((int)RFIFOREST(fd) < packet_len) return 0; //ShowDebug("Received packet 0x%4x (%d bytes) from char-server (connection %d)\n", RFIFOW(fd,0), packet_len, fd); switch(cmd) { case 0x2af9: chrif->connectack(fd); break; case 0x2afb: chrif->sendmapack(fd); break; case 0x2afd: chrif->authok(fd); break; case 0x2b00: map->setusers(RFIFOL(fd,2)); chrif->keepalive(fd); break; case 0x2b03: clif->charselectok(RFIFOL(fd,2), RFIFOB(fd,6)); break; case 0x2b04: chrif->recvmap(fd); break; case 0x2b06: chrif->changemapserverack(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), RFIFOW(fd,18), RFIFOW(fd,20), RFIFOW(fd,22), RFIFOL(fd,24), RFIFOW(fd,28)); break; case 0x2b09: map->addnickdb(RFIFOL(fd,2), (char*)RFIFOP(fd,6)); break; case 0x2b0a: sockt->datasync(fd, false); break; case 0x2b0d: chrif->changedsex(fd); break; case 0x2b0f: chrif->char_ask_name_answer(RFIFOL(fd,2), (char*)RFIFOP(fd,6), RFIFOW(fd,30), RFIFOW(fd,32)); break; case 0x2b12: chrif->divorceack(RFIFOL(fd,2), RFIFOL(fd,6)); break; case 0x2b14: chrif->idbanned(fd); break; case 0x2b1b: chrif->recvfamelist(fd); break; case 0x2b1d: chrif->load_scdata(fd); break; case 0x2b1e: chrif->update_ip(fd); break; case 0x2b1f: chrif->disconnectplayer(fd); break; case 0x2b20: chrif->removemap(fd); break; case 0x2b21: chrif->save_ack(fd); break; case 0x2b22: chrif->updatefamelist_ack(fd); break; case 0x2b24: chrif->keepalive_ack(fd); break; case 0x2b25: chrif->deadopt(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break; case 0x2b27: chrif->authfail(fd); break; default: ShowError("chrif_parse : Pacote desconhecido (sessao #%d): 0x%x. Desconectando.\n", fd, cmd); sockt->eof(fd); return 0; } if ( fd == chrif->fd ) //There's the slight chance we lost the connection during parse, in which case this would segfault if not checked [Skotlex] RFIFOSKIP(fd, packet_len); } return 0; } int send_usercount_tochar(int tid, int64 tick, int id, intptr_t data) { chrif_check(-1); WFIFOHEAD(chrif->fd,4); WFIFOW(chrif->fd,0) = 0x2afe; WFIFOW(chrif->fd,2) = map->usercount(); WFIFOSET(chrif->fd,4); return 0; } /*========================================== * timerFunction * Send to char the number of client connected to map *------------------------------------------*/ bool send_users_tochar(void) { int users = 0, i = 0; struct map_session_data* sd; struct s_mapiterator* iter; chrif_check(false); users = map->usercount(); WFIFOHEAD(chrif->fd, 6+8*users); WFIFOW(chrif->fd,0) = 0x2aff; iter = mapit_getallusers(); for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) { WFIFOL(chrif->fd,6+8*i) = sd->status.account_id; WFIFOL(chrif->fd,6+8*i+4) = sd->status.char_id; i++; } mapit->free(iter); WFIFOW(chrif->fd,2) = 6 + 8*users; WFIFOW(chrif->fd,4) = users; WFIFOSET(chrif->fd, 6+8*users); return true; } /*========================================== * timerFunction * Check the connection to char server, (if it down) *------------------------------------------*/ int check_connect_char_server(int tid, int64 tick, int id, intptr_t data) { static int displayed = 0; if ( chrif->fd <= 0 || sockt->session[chrif->fd] == NULL ) { if ( !displayed ) { ShowStatus("Tentando se conectar ao servidor de personagem. Por favor, aguarde.\n"); displayed = 1; } chrif->state = 0; if ( ( chrif->fd = sockt->make_connection(chrif->ip, chrif->port,NULL) ) == -1) //Attempt to connect later. [Skotlex] return 0; sockt->session[chrif->fd]->func_parse = chrif->parse; sockt->session[chrif->fd]->flag.server = 1; sockt->realloc_fifo(chrif->fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); chrif->connect(chrif->fd); chrif->connected = (chrif->state == 2); chrif->srvinfo = 0; } else { if (chrif->srvinfo == 0) { chrif->ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common); chrif->srvinfo = 1; } } if ( chrif->isconnected() ) displayed = 0; return 0; } /*========================================== * Asks char server to remove friend_id from the friend list of char_id *------------------------------------------*/ bool chrif_removefriend(int char_id, int friend_id) { chrif_check(false); WFIFOHEAD(chrif->fd,10); WFIFOW(chrif->fd,0) = 0x2b07; WFIFOL(chrif->fd,2) = char_id; WFIFOL(chrif->fd,6) = friend_id; WFIFOSET(chrif->fd,10); return true; } void chrif_send_report(char* buf, int len) { #ifndef STATS_OPT_OUT if( chrif->fd > 0 ) { nullpo_retv(buf); WFIFOHEAD(chrif->fd,len + 2); WFIFOW(chrif->fd,0) = 0x3008; memcpy(WFIFOP(chrif->fd,2), buf, len); WFIFOSET(chrif->fd,len + 2); sockt->flush(chrif->fd); /* ensure it's sent now. */ } #endif } /** * Sends a single scdata for saving into char server, meant to ensure integrity of duration-less conditions **/ void chrif_save_scdata_single(int account_id, int char_id, short type, struct status_change_entry *sce) { if( !chrif->isconnected() ) return; nullpo_retv(sce); WFIFOHEAD(chrif->fd, 28); WFIFOW(chrif->fd, 0) = 0x2740; WFIFOL(chrif->fd, 2) = account_id; WFIFOL(chrif->fd, 6) = char_id; WFIFOW(chrif->fd, 10) = type; WFIFOL(chrif->fd, 12) = sce->val1; WFIFOL(chrif->fd, 16) = sce->val2; WFIFOL(chrif->fd, 20) = sce->val3; WFIFOL(chrif->fd, 24) = sce->val4; WFIFOSET(chrif->fd, 28); } /** * Sends a single scdata deletion request into char server, meant to ensure integrity of duration-less conditions **/ void chrif_del_scdata_single(int account_id, int char_id, short type) { if( !chrif->isconnected() ) { ShowError("Falha ao deletar estado %d de CID:%d/AID:%d\n",type,char_id,account_id); return; } WFIFOHEAD(chrif->fd, 12); WFIFOW(chrif->fd, 0) = 0x2741; WFIFOL(chrif->fd, 2) = account_id; WFIFOL(chrif->fd, 6) = char_id; WFIFOW(chrif->fd, 10) = type; WFIFOSET(chrif->fd, 12); } /** * @see DBApply */ int auth_db_final(DBKey key, DBData *data, va_list ap) { struct auth_node *node = DB->data2ptr(data); nullpo_ret(node); if (node->sd) { if( node->sd->regs.vars ) node->sd->regs.vars->destroy(node->sd->regs.vars, script->reg_destroy); if( node->sd->regs.arrays ) node->sd->regs.arrays->destroy(node->sd->regs.arrays, script->array_free_db); aFree(node->sd); } ers_free(chrif->auth_db_ers, node); return 0; } /*========================================== * Destructor *------------------------------------------*/ void do_final_chrif(void) { if( chrif->fd != -1 ) { sockt->close(chrif->fd); chrif->fd = -1; } chrif->auth_db->destroy(chrif->auth_db, chrif->auth_db_final); ers_destroy(chrif->auth_db_ers); } /*========================================== * *------------------------------------------*/ void do_init_chrif(bool minimal) { if (minimal) return; chrif->auth_db = idb_alloc(DB_OPT_BASE); chrif->auth_db_ers = ers_new(sizeof(struct auth_node),"chrif.c::auth_db_ers",ERS_OPT_NONE); timer->add_func_list(chrif->check_connect_char_server, "check_connect_char_server"); timer->add_func_list(chrif->auth_db_cleanup, "auth_db_cleanup"); timer->add_func_list(chrif->send_usercount_tochar, "send_usercount_tochar"); // establish map-char connection if not present timer->add_interval(timer->gettick() + 1000, chrif->check_connect_char_server, 0, 0, 10 * 1000); // wipe stale data for timed-out client connection requests timer->add_interval(timer->gettick() + 1000, chrif->auth_db_cleanup, 0, 0, 30 * 1000); // send the user count every 10 seconds, to hide the charserver's online counting problem timer->add_interval(timer->gettick() + 1000, chrif->send_usercount_tochar, 0, 0, UPDATE_INTERVAL); } void chrif_defaults(void) { const int packet_len_table[CHRIF_PACKET_LEN_TABLE_SIZE] = { // U - used, F - free 60, 3, -1, 27, 10, -1, 6, -1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff 6, -1, 18, 7, -1, 39, 30, 10, // 2b00-2b07: U->2b00, U->2b01, U->2b02, U->2b03, U->2b04, U->2b05, U->2b06, U->2b07 6, 30, -1, 0, 86, 7, 44, 34, // 2b08-2b0f: U->2b08, U->2b09, U->2b0a, F->2b0b, U->2b0c, U->2b0d, U->2b0e, U->2b0f 11, 10, 10, 0, 11, 0,266, 10, // 2b10-2b17: U->2b10, U->2b11, U->2b12, F->2b13, U->2b14, F->2b15, U->2b16, U->2b17 2, 10, 2, -1, -1, -1, 2, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, U->2b1e, U->2b1f -1, 10, 8, 2, 2, 14, 19, 19, // 2b20-2b27: U->2b20, U->2b21, U->2b22, U->2b23, U->2b24, U->2b25, U->2b26, U->2b27 }; chrif = &chrif_s; /* vars */ chrif->connected = 0; chrif->other_mapserver_count = 0; memcpy(chrif->packet_len_table,&packet_len_table,sizeof(chrif->packet_len_table)); chrif->fd = -1; chrif->srvinfo = 0; memset(chrif->ip_str,0,sizeof(chrif->ip_str)); chrif->ip = 0; chrif->port = 6121; memset(chrif->userid,0,sizeof(chrif->userid)); memset(chrif->passwd,0,sizeof(chrif->passwd)); chrif->state = 0; /* */ chrif->auth_db = NULL; chrif->auth_db_ers = NULL; /* */ chrif->init = do_init_chrif; chrif->final = do_final_chrif; /* funcs */ chrif->setuserid = chrif_setuserid; chrif->setpasswd = chrif_setpasswd; chrif->checkdefaultlogin = chrif_checkdefaultlogin; chrif->setip = chrif_setip; chrif->setport = chrif_setport; chrif->isconnected = chrif_isconnected; chrif->check_shutdown = chrif_check_shutdown; chrif->search = chrif_search; chrif->auth_check = chrif_auth_check; chrif->auth_delete = chrif_auth_delete; chrif->auth_finished = chrif_auth_finished; chrif->authreq = chrif_authreq; chrif->authok = chrif_authok; chrif->scdata_request = chrif_scdata_request; chrif->save = chrif_save; chrif->charselectreq = chrif_charselectreq; chrif->changemapserver = chrif_changemapserver; chrif->searchcharid = chrif_searchcharid; chrif->changeemail = chrif_changeemail; chrif->char_ask_name = chrif_char_ask_name; chrif->updatefamelist = chrif_updatefamelist; chrif->buildfamelist = chrif_buildfamelist; chrif->save_scdata = chrif_save_scdata; chrif->ragsrvinfo = chrif_ragsrvinfo; chrif->char_offline_nsd = chrif_char_offline_nsd; chrif->char_reset_offline = chrif_char_reset_offline; chrif->send_users_tochar = send_users_tochar; chrif->char_online = chrif_char_online; // look like unused chrif->changesex = chrif_changesex; //chrif->chardisconnect = chrif_chardisconnect; chrif->divorce = chrif_divorce; chrif->removefriend = chrif_removefriend; chrif->send_report = chrif_send_report; chrif->flush = chrif_flush; chrif->skillid2idx = chrif_skillid2idx; chrif->sd_to_auth = chrif_sd_to_auth; chrif->check_connect_char_server = check_connect_char_server; chrif->auth_logout = chrif_auth_logout; chrif->save_ack = chrif_save_ack; chrif->reconnect = chrif_reconnect; chrif->auth_db_cleanup_sub = auth_db_cleanup_sub; chrif->char_ask_name_answer = chrif_char_ask_name_answer; chrif->auth_db_final = auth_db_final; chrif->send_usercount_tochar = send_usercount_tochar; chrif->auth_db_cleanup = auth_db_cleanup; chrif->connect = chrif_connect; chrif->connectack = chrif_connectack; chrif->sendmap = chrif_sendmap; chrif->sendmapack = chrif_sendmapack; chrif->recvmap = chrif_recvmap; chrif->changemapserverack = chrif_changemapserverack; chrif->changedsex = chrif_changedsex; chrif->divorceack = chrif_divorceack; chrif->idbanned = chrif_idbanned; chrif->recvfamelist = chrif_recvfamelist; chrif->load_scdata = chrif_load_scdata; chrif->update_ip = chrif_update_ip; chrif->disconnectplayer = chrif_disconnectplayer; chrif->removemap = chrif_removemap; chrif->updatefamelist_ack = chrif_updatefamelist_ack; chrif->keepalive = chrif_keepalive; chrif->keepalive_ack = chrif_keepalive_ack; chrif->deadopt = chrif_deadopt; chrif->authfail = chrif_authfail; chrif->on_ready = chrif_on_ready; chrif->on_disconnect = chrif_on_disconnect; chrif->parse = chrif_parse; chrif->save_scdata_single = chrif_save_scdata_single; chrif->del_scdata_single = chrif_del_scdata_single; }
Badarosk0/brAthena
src/map/chrif.c
C
gpl-3.0
58,125
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Participants block caps. * * @package block_participants * @copyright Mark Nelson <markn@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $capabilities = array( 'block/course_participants:addinstance' => array( 'riskbitmask' => RISK_SPAM | RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_BLOCK, 'archetypes' => array( 'editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW ), 'clonepermissionsfrom' => 'moodle/site:manageblocks' ), );
techsavv/deecd
blocks/course_participants/db/access.php
PHP
gpl-3.0
1,309