text
stringlengths 4
6.14k
|
|---|
/*
* Calcurse - text-based organizer
*
* Copyright (c) 2004-2011 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Send your feedback or comments to : misc@calcurse.org
* Calcurse home page : http://calcurse.org
*
*/
/* Linked lists. */
typedef struct llist_item llist_item_t;
struct llist_item {
struct llist_item *next;
void *data;
};
typedef struct llist llist_t;
struct llist {
struct llist_item *head;
};
typedef int (*llist_fn_cmp_t) (void *, void *);
typedef int (*llist_fn_match_t) (void *, long);
typedef void (*llist_fn_free_t) (void *);
/* Initialization and deallocation. */
void llist_init (llist_t *);
void llist_free (llist_t *);
void llist_free_inner (llist_t *, llist_fn_free_t);
#define LLIST_INIT(l) llist_init(l)
#define LLIST_FREE(l) llist_free(l)
#define LLIST_FREE_INNER(l, fn_free) \
llist_free_inner(l, (llist_fn_free_t)fn_free)
/* Retrieving list items. */
llist_item_t *llist_first (llist_t *);
llist_item_t *llist_nth (llist_t *, int);
llist_item_t *llist_next (llist_item_t *);
llist_item_t *llist_find_first (llist_t *, long, llist_fn_match_t);
llist_item_t *llist_find_next (llist_item_t *, long, llist_fn_match_t);
llist_item_t *llist_find_nth (llist_t *, int, long, llist_fn_match_t);
#define LLIST_FIRST(l) llist_first(l)
#define LLIST_NTH(l, n) llist_nth(l, n)
#define LLIST_NEXT(i) llist_next(i)
#define LLIST_FIND_FIRST(l, data, fn_match) \
llist_find_first(l, data, (llist_fn_match_t)fn_match)
#define LLIST_FIND_NEXT(i, data, fn_match) \
llist_find_next(i, data, (llist_fn_match_t)fn_match)
#define LLIST_FIND_NTH(l, n, data, fn_match) \
llist_find_nth(l, n, data, (llist_fn_match_t)fn_match)
#define LLIST_FOREACH(l, i) for (i = LLIST_FIRST (l); i; i = LLIST_NEXT (i))
#define LLIST_FIND_FOREACH(l, data, fn_match, i) \
for (i = LLIST_FIND_FIRST (l, data, fn_match); i; \
i = LLIST_FIND_NEXT (i, data, fn_match))
/* Accessing list item data. */
void *llist_get_data (llist_item_t *);
#define LLIST_GET_DATA(i) llist_get_data(i)
/* List manipulation. */
void llist_add (llist_t *, void *);
void llist_add_sorted (llist_t *, void *, llist_fn_cmp_t);
void llist_remove (llist_t *, llist_item_t *);
#define LLIST_ADD(l, data) llist_add(l, data)
#define LLIST_ADD_SORTED(l, data, fn_cmp) \
llist_add_sorted(l, data, (llist_fn_cmp_t)fn_cmp)
#define LLIST_REMOVE(l, i) llist_remove(l, i)
|
/*Copyright (c) 1985-2012, B-Core (UK) Ltd
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
extern int Rename_ffnc_objP2;
extern int Rename_ffnc_objP3;
extern int Rename_fnc_obj[];
extern int Rename_ssize_fnc_obj;
extern int Rename_old_fnc_obj[];
extern int Rename_sold_fnc_obj;
char Rename_buf_ffnc_obj[1000];
#define Rename_CHARperWORD 4
#define INI_Rename_ffnc_obj() \
{Rename_ssize_fnc_obj = 0; Rename_sold_fnc_obj=0;}
#define Rename_INI_FNC_OBJ() \
{Rename_ssize_fnc_obj = 0; Rename_sold_fnc_obj=0;}
#define Rename_STS_FNC_OBJ(mm,nn) \
{ \
*(mm) = (Rename_ssize_fnc_obj - Rename_sold_fnc_obj); \
*(nn) = (Rename_ffnc_objP3); \
}
#define Rename_ANY_FNC_OBJ(vv) \
{*(vv) = 1;}
#define Rename_TST_FLD_FNC_OBJ(bb,pp) \
{ *(bb) = ( ( (pp>0) && (pp<=Rename_ffnc_objP2) )!=0) ;}
#define Rename_FUL_FNC_OBJ(bb) \
{*(bb) = (((Rename_ssize_fnc_obj - Rename_sold_fnc_obj) == Rename_ffnc_objP3)!=0);}
#define Rename_DEF_FNC_OBJ(bb,ff,ii) \
{*(bb) = (Rename_fnc_obj[(ff-1)*Rename_ffnc_objP2+ii] != 2147483647)!=0;}
#define Rename_VAL_FNC_OBJ(vv,ff,ii) \
{*(vv) = Rename_fnc_obj[(ff-1)*Rename_ffnc_objP2+ii];}
#define Rename_STO_FNC_OBJ(ff,ii,vv) \
{Rename_fnc_obj[(ff-1)*Rename_ffnc_objP2+(ii)] = (vv);}
#define Rename_RMV_FNC_OBJ(ff,ii) \
{Rename_fnc_obj[(ff-1)*Rename_ffnc_objP2+ii] = 2147483647;}
#define Rename_KIL_FNC_OBJ(ff) \
{Rename_sold_fnc_obj=Rename_sold_fnc_obj+1; \
Rename_old_fnc_obj[Rename_sold_fnc_obj]=ff;}
void Rename_CRE_FNC_OBJ();
void Rename_XST_FNC_OBJ();
void Rename_SAV_FNC_OBJ();
void Rename_SAVN_FNC_OBJ();
void Rename_RST_FNC_OBJ();
void Rename_RSTN_FNC_OBJ();
void Rename_FIRST_FNC_OBJ();
void Rename_NEXT_FNC_OBJ();
void Rename_OVR_LIT_FFNC_OBJ();
void Rename_OVR_FFNC_OBJ();
void Rename_EQL_FFNC_OBJ();
void Rename_MOV_FFNC_OBJ();
void Rename_XTR_FFNC_OBJ();
|
#include "universe.h"
#define YES 1
#define NO 0
// Static pattern will match an allowed catalyzer if:
// 0 = Is On, Off or Unknown
// 1 = Is On or Unknown
// 2 = Is Off
// 4 = Is Off or Unknown
static int block [4] [6] [6] =
{{{0, 4, 2, 2, 4, 0},
{4, 4, 4, 4, 4, 4},
{4, 4, 1, 1, 4, 4},
{4, 4, 1, 1, 4, 4},
{4, 4, 4, 4, 4, 4},
{0, 4, 4, 4, 4, 0}},
{{0, 4, 4, 4, 4, 0},
{4, 4, 4, 4, 4, 4},
{4, 4, 1, 1, 4, 4},
{4, 4, 1, 1, 4, 4},
{4, 4, 4, 4, 4, 4},
{0, 4, 2, 2, 4, 0}},
{{0, 4, 4, 4, 4, 0},
{4, 4, 4, 4, 4, 4},
{2, 4, 1, 1, 4, 4},
{2, 4, 1, 1, 4, 4},
{4, 4, 4, 4, 4, 4},
{0, 4, 4, 4, 4, 0}},
{{0, 4, 4, 4, 4, 0},
{4, 4, 4, 4, 4, 4},
{4, 4, 1, 1, 4, 2},
{4, 4, 1, 1, 4, 2},
{4, 4, 4, 4, 4, 4},
{0, 4, 4, 4, 4, 0}}};
static int tub_boat [4] [7] [7] =
{{{0, 0, 4, 4, 4, 0, 0},
{0, 2, 2, 4, 4, 4, 0},
{4, 2, 4, 1, 4, 4, 4},
{4, 4, 1, 4, 1, 4, 4},
{4, 4, 4, 1, 1, 4, 4},
{0, 4, 4, 4, 4, 4, 4},
{0, 0, 4, 4, 4, 4, 0}},
{{0, 0, 4, 4, 4, 4, 0},
{0, 4, 4, 4, 4, 4, 4},
{4, 4, 4, 1, 1, 4, 4},
{4, 4, 1, 4, 1, 4, 4},
{4, 2, 4, 1, 4, 4, 4},
{0, 2, 2, 4, 4, 4, 0},
{0, 0, 4, 4, 4, 0, 0}},
{{0, 0, 4, 4, 4, 0, 0},
{0, 4, 4, 4, 2, 2, 0},
{4, 4, 4, 1, 4, 2, 4},
{4, 4, 1, 4, 1, 4, 4},
{4, 4, 1, 1, 4, 4, 4},
{4, 4, 4, 4, 4, 4, 0},
{0, 4, 4, 4, 4, 0, 0}},
{{0, 4, 4, 4, 4, 0, 0},
{4, 4, 4, 4, 4, 4, 0},
{4, 4, 1, 1, 4, 4, 4},
{4, 4, 1, 4, 1, 4, 4},
{4, 4, 4, 1, 4, 2, 4},
{0, 4, 4, 4, 2, 2, 0},
{0, 0, 4, 4, 4, 0, 0}}};
static int eater1 [8] [7] [7] =
{{{0, 4, 4, 4, 4, 0, 0},
{4, 2, 4, 4, 4, 0, 0},
{4, 4, 1, 1, 4, 4, 4},
{4, 4, 1, 4, 4, 4, 4},
{4, 4, 4, 1, 1, 4, 4},
{0, 4, 4, 4, 4, 4, 4},
{0, 0, 4, 4, 4, 4, 0}},
{{0, 4, 4, 4, 4, 0, 0},
{4, 2, 4, 4, 4, 4, 0},
{4, 4, 1, 1, 4, 4, 4},
{4, 4, 1, 4, 1, 4, 4},
{4, 4, 4, 4, 1, 4, 4},
{0, 0, 4, 4, 4, 4, 4},
{0, 0, 4, 4, 4, 4, 0}},
{{0, 0, 4, 4, 4, 4, 0},
{0, 4, 4, 4, 4, 4, 4},
{4, 4, 4, 1, 1, 4, 4},
{4, 4, 1, 4, 4, 4, 4},
{4, 4, 1, 1, 4, 4, 4},
{4, 2, 4, 4, 4, 0, 0},
{0, 4, 4, 4, 4, 0, 0}},
{{0, 0, 4, 4, 4, 4, 0},
{0, 0, 4, 4, 4, 4, 4},
{4, 4, 4, 4, 1, 4, 4},
{4, 4, 1, 4, 1, 4, 4},
{4, 4, 1, 1, 4, 4, 4},
{4, 2, 4, 4, 4, 4, 0},
{0, 4, 4, 4, 4, 0, 0}},
{{0, 0, 4, 4, 4, 4, 0},
{0, 0, 4, 4, 4, 2, 4},
{4, 4, 4, 1, 1, 4, 4},
{4, 4, 4, 4, 1, 4, 4},
{4, 4, 1, 1, 4, 4, 4},
{4, 4, 4, 4, 4, 4, 0},
{0, 4, 4, 4, 4, 0, 0}},
{{0, 0, 4, 4, 4, 4, 0},
{0, 4, 4, 4, 4, 2, 4},
{4, 4, 4, 1, 1, 4, 4},
{4, 4, 1, 4, 1, 4, 4},
{4, 4, 1, 4, 4, 4, 4},
{4, 4, 4, 4, 4, 0, 0},
{0, 4, 4, 4, 4, 0, 0}},
{{0, 4, 4, 4, 4, 0, 0},
{4, 4, 4, 4, 4, 4, 0},
{4, 4, 1, 1, 4, 4, 4},
{4, 4, 4, 4, 1, 4, 4},
{4, 4, 4, 1, 1, 4, 4},
{0, 0, 4, 4, 4, 2, 4},
{0, 0, 4, 4, 4, 4, 0}},
{{0, 4, 4, 4, 4, 0, 0},
{4, 4, 4, 4, 4, 0, 0},
{4, 4, 1, 4, 4, 4, 4},
{4, 4, 1, 4, 1, 4, 4},
{4, 4, 4, 1, 1, 4, 4},
{0, 4, 4, 4, 4, 2, 4},
{0, 0, 4, 4, 4, 4, 0}}};
static int cat_cell (int *cat, int sym, int x, int y, int ht, int wd)
{
return cat [sym * ht * wd + y * wd + x];
}
static int could_be_part_of_cat (tile *t, int x, int y, int *cat, int symcnt, int ht, int wd)
{
int symi;
int my;
int mx;
int cy;
int cx;
for (symi = 0; symi < symcnt; symi++)
for (my = 0; my < ht; my++)
for (mx = 0; mx < wd; mx++)
if (cat_cell (cat, symi, mx, my, ht, wd) == 1)
{
int match = YES;
for (cy = 0; cy < ht; cy++)
{
for (cx = 0; cx < wd; cx++)
{
int pst = tile_get_cell (t, x - mx + cx, y - my + cy);
int tst = cat_cell (cat, symi, cx, cy, ht, wd);
if (tst == 0)
continue;
else if (tst == 1)
{
if (pst == ON || pst == UNKNOWN_STABLE)
continue;
}
else if (tst == 2)
{
if (pst == OFF)
continue;
}
else if (tst == 4)
{
if (pst == OFF || pst == UNKNOWN_STABLE)
continue;
}
match = NO;
break;
}
if (!match)
break;
}
if (match)
return YES;
}
return NO;
}
int ver_cats (generation *ge)
{
tile *t = ge->all_first->auxdata;
int y;
int x;
for (y = 8; y < TILE_HEIGHT - 8; y++)
for (x = 8; x < TILE_WIDTH - 8; x++)
if (tile_get_cell (t, x, y) == ON)
if (!could_be_part_of_cat (t, x, y, (int *) block, 4, 6, 6) &&
!could_be_part_of_cat (t, x, y, (int *) tub_boat, 4, 7, 7) &&
!could_be_part_of_cat (t, x, y, (int *) eater1, 8, 7, 7))
return NO;
return YES;
}
|
#include "abilities.h"
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <base/base.h>
#include <mechanics/mechanics.h>
static int
special_NPC_roll(struct rnd *rnd,
enum ability_flag flags,
enum ability_flag flag);
struct abilities *
abilities_alloc(struct rnd *rnd)
{
struct abilities *abilities = calloc_or_die(1, sizeof(struct abilities));
abilities->strength = roll("3d6", rnd);
abilities->intelligence = roll("3d6", rnd);
abilities->wisdom = roll("3d6", rnd);
abilities->dexterity = roll("3d6", rnd);
abilities->constitution = roll("3d6", rnd);
abilities->charisma = roll("3d6", rnd);
return abilities;
}
struct abilities *
abilities_alloc_general_NPC(struct rnd *rnd)
{
struct abilities *abilities = calloc_or_die(1, sizeof(struct abilities));
struct dice threeD6 = dice_make(3, 6);
abilities->strength = dice_roll_with_average_scoring(threeD6, rnd);
abilities->intelligence = dice_roll_with_average_scoring(threeD6, rnd);
abilities->wisdom = dice_roll_with_average_scoring(threeD6, rnd);
abilities->dexterity = dice_roll_with_average_scoring(threeD6, rnd);
abilities->constitution = dice_roll_with_average_scoring(threeD6, rnd);
abilities->charisma = dice_roll_with_average_scoring(threeD6, rnd);
return abilities;
}
struct abilities *
abilities_alloc_method_3(struct rnd *rnd)
{
struct abilities *abilities = calloc_or_die(1, sizeof(struct abilities));
for (int i = 0; i < 6; ++i) {
int ability = roll("3d6", rnd);
if (ability > abilities->strength) {
abilities->strength = ability;
}
}
for (int i = 0; i < 6; ++i) {
int ability = roll("3d6", rnd);
if (ability > abilities->intelligence) {
abilities->intelligence = ability;
}
}
for (int i = 0; i < 6; ++i) {
int ability = roll("3d6", rnd);
if (ability > abilities->wisdom) {
abilities->wisdom = ability;
}
}
for (int i = 0; i < 6; ++i) {
int ability = roll("3d6", rnd);
if (ability > abilities->dexterity) {
abilities->dexterity = ability;
}
}
for (int i = 0; i < 6; ++i) {
int ability = roll("3d6", rnd);
if (ability > abilities->constitution) {
abilities->constitution = ability;
}
}
for (int i = 0; i < 6; ++i) {
int ability = roll("3d6", rnd);
if (ability > abilities->charisma) {
abilities->charisma = ability;
}
}
return abilities;
}
struct abilities *
abilities_alloc_special_NPC(struct rnd *rnd,
enum ability_flag flags)
{
struct abilities *abilities = calloc_or_die(1, sizeof(struct abilities));
abilities->strength = special_NPC_roll(rnd, flags, ability_flag_strength);
abilities->intelligence = special_NPC_roll(rnd, flags, ability_flag_intelligence);
abilities->wisdom = special_NPC_roll(rnd, flags, ability_flag_wisdom);
abilities->dexterity = special_NPC_roll(rnd, flags, ability_flag_dexterity);
abilities->constitution = special_NPC_roll(rnd, flags, ability_flag_constitution);
abilities->charisma = special_NPC_roll(rnd, flags, ability_flag_charisma);
return abilities;
}
int
abilities_compare(struct abilities const *first,
struct abilities const *second)
{
return abilities_total(second)
- abilities_total(first);
}
void
abilities_free(struct abilities *abilities)
{
free_or_die(abilities);
}
int
abilities_total(struct abilities const *abilities)
{
return abilities->strength
+ abilities->intelligence
+ abilities->wisdom
+ abilities->dexterity
+ abilities->constitution
+ abilities->charisma;
}
static int
special_NPC_roll(struct rnd *rnd,
enum ability_flag flags,
enum ability_flag flag)
{
struct dice threeD6 = dice_make(3, 6);
return flag & flags ? dice_roll_and_adjust_upwards(threeD6, rnd)
: dice_roll(threeD6, rnd, NULL);
}
|
/**************************************************************************************************
**************************************************************************************************
BSD 3-Clause License (https://www.tldrlegal.com/l/bsd3)
Copyright (c) 2014 Andrés Solís Montero <http://www.solism.ca>, All rights reserved.
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.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
**************************************************************************************************
**************************************************************************************************/
#ifndef __detection3D__kalman__
#define __detection3D__kalman__
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/video/tracking.hpp>
using namespace std;
using namespace cv;
class Kalman
{
private:
vector<KalmanFilter> filters;
void initialize(int numPts);
void initState(vector<Point2f> &pts);
bool initialized;
public:
Kalman(vector<Point2f> &pts);
Kalman(int numPts);
vector<Point2f> correct(vector<Point2f> &pts);
vector<Point2f> predict();
void reset();
};
#endif /* defined(__detection3D__kalman__) */
|
#if defined(__WIN32)
#include <SDL2/SDL_ttf.h>
#else
#include <SDL_ttf.h>
#endif
|
/*
Copyright (c) 2010-2011, BILD digital GmbH & Co. KG
All rights reserved.
BSD License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of BILD digital GmbH & Co. KG nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY BILD digital GmbH & Co. KG ''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 BILD digital GmbH & Co. KG 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.
*/
#import <Foundation/Foundation.h>
@interface NSData (NSMAdditions)
- (NSString *)nsm_hexString;
@end
|
/*
* CSS Media Query Evaluator
*
* Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
*
* 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 THE AUTHOR ``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 APPLE COMPUTER, INC. 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.
*/
#ifndef MediaQueryEvaluator_h
#define MediaQueryEvaluator_h
#include "platform/heap/Handle.h"
#include "wtf/text/WTFString.h"
namespace blink {
class LocalFrame;
class MediaQuery;
class MediaQueryExp;
class MediaQueryResult;
class MediaQuerySet;
class MediaValues;
typedef WillBeHeapVector<RefPtrWillBeMember<MediaQueryResult>> MediaQueryResultList;
// Class that evaluates css media queries as defined in
// CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/)
// Special constructors are needed, if simple media queries are to be
// evaluated without knowledge of the medium features. This can happen
// for example when parsing UA stylesheets, if evaluation is done
// right after parsing.
//
// the boolean parameter is used to approximate results of evaluation, if
// the device characteristics are not known. This can be used to prune the loading
// of stylesheets to only those which are probable to match.
class MediaQueryEvaluator {
WTF_MAKE_NONCOPYABLE(MediaQueryEvaluator); WTF_MAKE_FAST_ALLOCATED(MediaQueryEvaluator);
public:
// Creates evaluator which evaluates only simple media queries
// Evaluator returns true for "all", and returns value of \mediaFeatureResult
// for any media features.
explicit MediaQueryEvaluator(bool mediaFeatureResult = false);
// Creates evaluator which evaluates only simple media queries
// Evaluator returns true for acceptedMediaType and returns value of \mediafeatureResult
// for any media features.
MediaQueryEvaluator(const char* acceptedMediaType, bool mediaFeatureResult = false);
// Creates evaluator which evaluates full media queries.
explicit MediaQueryEvaluator(LocalFrame*);
// Creates evaluator which evaluates in a thread-safe manner a subset of media values.
explicit MediaQueryEvaluator(const MediaValues&);
~MediaQueryEvaluator();
bool mediaTypeMatch(const String& mediaTypeToMatch) const;
// Evaluates a list of media queries.
bool eval(const MediaQuerySet*, MediaQueryResultList* = 0) const;
// Evaluates media query.
bool eval(const MediaQuery*, MediaQueryResultList*) const;
// Evaluates media query subexpression, ie "and (media-feature: value)" part.
bool eval(const MediaQueryExp*) const;
private:
const String mediaType() const;
String m_mediaType;
bool m_expectedResult;
RefPtr<MediaValues> m_mediaValues;
};
} // namespace
#endif
|
/**
* Copyright (c) 2015-present, Horcrux.
* All rights reserved.
*
* This source code is licensed under the MIT-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "ABI41_0_0RNSVGRenderableManager.h"
@interface ABI41_0_0RNSVGEllipseManager : ABI41_0_0RNSVGRenderableManager
@end
|
/*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
*/
#ifndef QUEUEDPACKETSENDER_H
#define QUEUEDPACKETSENDER_H
#include "PacketSender.h"
#include "NetPacketQueue.h"
/**
* Puts packets in a send queue
*/
class QueuedPacketSender: public PacketSender {
public:
typedef NetPacketQueue SendQueue;
virtual ~QueuedPacketSender();
protected:
explicit QueuedPacketSender( SendQueue& queue );
void sendUDP( Packet* packet,
const IPnPort& destination );
void sendTCP( Packet* packet,
const IPnPort& destination );
private:
SendQueue& m_sendQueue;
};
#endif // QUEUEDPACKETSENDER_H
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkConeSource.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkConeSource - generate polygonal cone
// .SECTION Description
// vtkConeSource creates a cone centered at a specified point and pointing in
// a specified direction. (By default, the center is the origin and the
// direction is the x-axis.) Depending upon the resolution of this object,
// different representations are created. If resolution=0 a line is created;
// if resolution=1, a single triangle is created; if resolution=2, two
// crossed triangles are created. For resolution > 2, a 3D cone (with
// resolution number of sides) is created. It also is possible to control
// whether the bottom of the cone is capped with a (resolution-sided)
// polygon, and to specify the height and radius of the cone.
#ifndef __vtkConeSource_h
#define __vtkConeSource_h
#include "vtkFiltersSourcesExport.h" // For export macro
#include "vtkPolyDataAlgorithm.h"
#include "vtkCell.h" // Needed for VTK_CELL_SIZE
class VTKFILTERSSOURCES_EXPORT vtkConeSource : public vtkPolyDataAlgorithm
{
public:
vtkTypeMacro(vtkConeSource,vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Construct with default resolution 6, height 1.0, radius 0.5, and
// capping on. The cone is centered at the origin and points down
// the x-axis.
static vtkConeSource *New();
// Description:
// Set the height of the cone. This is the height along the cone in
// its specified direction.
vtkSetClampMacro(Height,double,0.0,VTK_DOUBLE_MAX)
vtkGetMacro(Height,double);
// Description:
// Set the base radius of the cone.
vtkSetClampMacro(Radius,double,0.0,VTK_DOUBLE_MAX)
vtkGetMacro(Radius,double);
// Description:
// Set the number of facets used to represent the cone.
vtkSetClampMacro(Resolution,int,0,VTK_CELL_SIZE)
vtkGetMacro(Resolution,int);
// Description:
// Set the center of the cone. It is located at the middle of the axis of
// the cone. Warning: this is not the center of the base of the cone!
// The default is 0,0,0.
vtkSetVector3Macro(Center,double);
vtkGetVectorMacro(Center,double,3);
// Description:
// Set the orientation vector of the cone. The vector does not have
// to be normalized. The direction goes from the center of the base toward
// the apex. The default is (1,0,0).
vtkSetVector3Macro(Direction,double);
vtkGetVectorMacro(Direction,double,3);
// Description:
// Set the angle of the cone. This is the angle between the axis of the cone
// and a generatrix. Warning: this is not the aperture! The aperture is
// twice this angle.
// As a side effect, the angle plus height sets the base radius of the cone.
// Angle is expressed in degrees.
void SetAngle (double angle);
double GetAngle ();
// Description:
// Turn on/off whether to cap the base of the cone with a polygon.
vtkSetMacro(Capping,int);
vtkGetMacro(Capping,int);
vtkBooleanMacro(Capping,int);
protected:
vtkConeSource(int res=6);
~vtkConeSource() {}
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
double Height;
double Radius;
int Resolution;
int Capping;
double Center[3];
double Direction[3];
private:
vtkConeSource(const vtkConeSource&); // Not implemented.
void operator=(const vtkConeSource&); // Not implemented.
};
#endif
|
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif
#define IDC_EDIT1 1002
#define IDC_BROWSE1 1003
#define IDS_APP_TITLE 1004
#define IDR_TREEFROG_QT50_MSI 1050
#define IDR_TREEFROG_QT51_MSI 1051
#define IDR_TREEFROG_QT52_MSI 1052
#define IDR_TREEFROG_QT53_MSI 1053
#define IDR_TREEFROG_QT54_MSI 1054
#define IDR_TREEFROG_QT55_MSI 1055
|
/**
*
* @file core_cplghe.c
*
* PLASMA core_blas kernel
* PLASMA is a software package provided by Univ. of Tennessee,
* Univ. of California Berkeley and Univ. of Colorado Denver
*
* @version 2.4.2
* @author Piotr Luszczek
* @author Pierre Lemarinier
* @author Mathieu Faverge
* @date 2010-11-15
* @generated c Thu Sep 15 12:09:00 2011
*
**/
#include "common.h"
#define COMPLEX
#undef REAL
/*
Rnd64seed is a global variable but it doesn't spoil thread safety. All matrix
generating threads only read Rnd64seed. It is safe to set Rnd64seed before
and after any calls to create_tile(). The only problem can be caused if
Rnd64seed is changed during the matrix generation time.
*/
//static unsigned long long int Rnd64seed = 100;
#define Rnd64_A 6364136223846793005ULL
#define Rnd64_C 1ULL
#define RndF_Mul 5.4210108624275222e-20f
#define RndD_Mul 5.4210108624275222e-20
#ifdef COMPLEX
#define NBELEM 2
#else
#define NBELEM 1
#endif
static unsigned long long int
Rnd64_jump(unsigned long long int n, unsigned long long int seed ) {
unsigned long long int a_k, c_k, ran;
int i;
a_k = Rnd64_A;
c_k = Rnd64_C;
ran = seed;
for (i = 0; n; n >>= 1, i++) {
if (n & 1)
ran = a_k * ran + c_k;
c_k *= (a_k + 1);
a_k *= a_k;
}
return ran;
}
#if defined(PLASMA_HAVE_WEAK)
#pragma weak CORE_cplghe = PCORE_cplghe
#define CORE_cplghe PCORE_cplghe
#endif
void CORE_cplghe( float bump, int m, int n, PLASMA_Complex32_t *A, int lda,
int bigM, int m0, int n0, unsigned long long int seed )
{
PLASMA_Complex32_t *tmp = A;
int i, j;
unsigned long long int ran, jump;
jump = m0 + n0 * bigM;
/*
* Tile diagonal
*/
if ( m0 == n0 ) {
for (j = 0; j < n; j++) {
ran = Rnd64_jump( NBELEM * jump, seed );
for (i = j; i < m; i++) {
*tmp = 0.5f - ran * RndF_Mul;
ran = Rnd64_A * ran + Rnd64_C;
#ifdef COMPLEX
*tmp += I*(0.5f - ran * RndF_Mul);
ran = Rnd64_A * ran + Rnd64_C;
#endif
tmp++;
}
tmp += (lda - i + j + 1);
jump += bigM + j;
}
for (j = 0; j < n; j++) {
#ifdef COMPLEX
A[j+j*lda] += bump - I*cimagf( A[j+j*lda] );
#else
A[j+j*lda] += bump;
#endif
for (i=0; i<j; i++) {
A[lda*j+i] = conjf( A[lda*i+j] );
}
}
}
/*
* Lower part
*/
else if ( m0 > n0 ) {
for (j = 0; j < n; j++) {
ran = Rnd64_jump( NBELEM * jump, seed );
for (i = 0; i < m; i++) {
*tmp = 0.5f - ran * RndF_Mul;
ran = Rnd64_A * ran + Rnd64_C;
#ifdef COMPLEX
*tmp += I*(0.5f - ran * RndF_Mul);
ran = Rnd64_A * ran + Rnd64_C;
#endif
tmp++;
}
tmp += (lda - i);
jump += bigM;
}
}
/*
* Upper part
*/
else if ( m0 < n0 ) {
/* Overwrite jump */
jump = n0 + m0 * bigM;
for (i = 0; i < m; i++) {
ran = Rnd64_jump( NBELEM * jump, seed );
for (j = 0; j < n; j++) {
A[j*lda+i] = 0.5f - ran * RndF_Mul;
ran = Rnd64_A * ran + Rnd64_C;
#ifdef COMPLEX
A[j*lda+i] -= I*(0.5f - ran * RndF_Mul);
ran = Rnd64_A * ran + Rnd64_C;
#endif
}
jump += bigM;
}
}
}
/***************************************************************************//**
*
**/
void QUARK_CORE_cplghe( Quark *quark, Quark_Task_Flags *task_flags,
float bump, int m, int n, PLASMA_Complex32_t *A, int lda,
int bigM, int m0, int n0, unsigned long long int seed )
{
DAG_CORE_PLGHE;
QUARK_Insert_Task(quark, CORE_cplghe_quark, task_flags,
sizeof(float), &bump, VALUE,
sizeof(int), &m, VALUE,
sizeof(int), &n, VALUE,
sizeof(PLASMA_Complex32_t)*lda*n, A, OUTPUT,
sizeof(int), &lda, VALUE,
sizeof(int), &bigM, VALUE,
sizeof(int), &m0, VALUE,
sizeof(int), &n0, VALUE,
sizeof(unsigned long long int), &seed, VALUE,
0);
}
/***************************************************************************//**
*
**/
#if defined(PLASMA_HAVE_WEAK)
#pragma weak CORE_cplghe_quark = PCORE_cplghe_quark
#define CORE_cplghe_quark PCORE_cplghe_quark
#endif
void CORE_cplghe_quark(Quark *quark)
{
float bump;
int m;
int n;
PLASMA_Complex32_t *A;
int lda;
int bigM;
int m0;
int n0;
unsigned long long int seed;
quark_unpack_args_9( quark, bump, m, n, A, lda, bigM, m0, n0, seed );
CORE_cplghe( bump, m, n, A, lda, bigM, m0, n0, seed );
}
|
/** @file
Internal include file for Status Code Handler Driver.
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __STATUS_CODE_HANDLER_RUNTIME_DXE_H__
#define __STATUS_CODE_HANDLER_RUNTIME_DXE_H__
#include <Protocol/ReportStatusCodeHandler.h>
#include <Guid/MemoryStatusCodeRecord.h>
#include <Guid/StatusCodeDataTypeId.h>
#include <Guid/StatusCodeDataTypeDebug.h>
#include <Guid/EventGroup.h>
#include <Library/SynchronizationLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <Library/PrintLib.h>
#include <Library/PcdLib.h>
#include <Library/HobLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiRuntimeLib.h>
#include <Library/SerialPortLib.h>
//
// Define the maximum message length
//
#define MAX_DEBUG_MESSAGE_LENGTH 0x100
extern RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable;
/**
Locates Serial I/O Protocol as initialization for serial status code worker.
@retval EFI_SUCCESS Serial I/O Protocol is successfully located.
**/
EFI_STATUS
EfiSerialStatusCodeInitializeWorker (
VOID
);
/**
Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
@param CodeType Indicates the type of status code being reported.
@param Value Describes the current status of a hardware or software entity.
This included information about the class and subclass that is used to
classify the entity as well as an operation.
@param Instance The enumeration of a hardware or software entity within
the system. Valid instance numbers start with 1.
@param CallerId This optional parameter may be used to identify the caller.
This parameter allows the status code driver to apply different rules to
different callers.
@param Data This optional parameter may be used to pass additional data.
@retval EFI_SUCCESS Status code reported to serial I/O successfully.
@retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
@retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
**/
EFI_STATUS
EFIAPI
SerialStatusCodeReportWorker (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId,
IN EFI_STATUS_CODE_DATA *Data OPTIONAL
);
/**
Initialize runtime memory status code table as initialization for runtime memory status code worker
@retval EFI_SUCCESS Runtime memory status code table successfully initialized.
@retval others Errors from gBS->InstallConfigurationTable().
**/
EFI_STATUS
RtMemoryStatusCodeInitializeWorker (
VOID
);
/**
Report status code into runtime memory. If the runtime pool is full, roll back to the
first record and overwrite it.
@param CodeType Indicates the type of status code being reported.
@param Value Describes the current status of a hardware or software entity.
This included information about the class and subclass that is used to
classify the entity as well as an operation.
@param Instance The enumeration of a hardware or software entity within
the system. Valid instance numbers start with 1.
@param CallerId This optional parameter may be used to identify the caller.
This parameter allows the status code driver to apply different rules to
different callers.
@param Data This optional parameter may be used to pass additional data.
@retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
**/
EFI_STATUS
EFIAPI
RtMemoryStatusCodeReportWorker (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId,
IN EFI_STATUS_CODE_DATA *Data OPTIONAL
);
#endif
|
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char **argv){
if (argc<3 || argc>4) {
fprintf(stderr,"USAGE: ln [-s] file linkname\n");
return 1;
}
if (argc==3) {if (link(argv[1],argv[2])==-1){
perror("ln");
return 1;
} else return 0;}
if (strcmp(argv[1],"-s")){
fprintf(stderr,"Unknown argument: %s\n",argv[1]);
return 1;
}
if (symlink(argv[1],argv[2])==-1){
perror("ln -s");
return 1;
}
return 0;
}
|
// Copyright 2015 The Cobalt Authors. 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.
#ifndef COBALT_DOM_NODE_LIST_LIVE_H_
#define COBALT_DOM_NODE_LIST_LIVE_H_
#include "cobalt/dom/node_list.h"
#include "base/memory/ref_counted.h"
namespace cobalt {
namespace dom {
class Node;
// A NodeListLive is a live NodeList, which is a collection of nodes.
// https://www.w3.org/TR/2015/WD-dom-20150428/#interface-nodelist
class NodeListLive : public NodeList {
public:
// Create a live collection of all first-level child nodes.
static scoped_refptr<NodeListLive> CreateWithChildren(
const scoped_refptr<const Node>& base);
// Web API: NodeList
//
unsigned int length() override;
scoped_refptr<Node> Item(unsigned int item) override;
// Custom, not in any spec.
//
void MaybeRefreshCollection();
private:
explicit NodeListLive(const scoped_refptr<const Node>& base);
~NodeListLive() override {}
// Base node that was used to generate the collection.
const scoped_refptr<const Node> base_;
// Generation of the base node that was used to create the cache.
uint32_t base_node_generation_;
DISALLOW_COPY_AND_ASSIGN(NodeListLive);
};
} // namespace dom
} // namespace cobalt
#endif // COBALT_DOM_NODE_LIST_LIVE_H_
|
/*
*
* Font_Handler.h
* Rad Adventure Development
*
* Created by Oliver Plunkett.
* Copyright 2010 Dunsany Interactive. All rights reserved.
*
*/
#ifndef FONT_HANDLER_H
#define FONT_HANDLER_H
#include "Font.h"
#define NUM_CHARS_PER_LINE 16
#define FONT_Y_START 0
#define FONT_X_SIZE 32
#define FONT_Y_SIZE 32
#define FONT_TEX_WIDTH 512
#define SAFE_DELETE(p) {if (p) { delete (p); (p) = NULL; } }
namespace Font_Handler {
extern GE::Image *fontTexture;
extern std::list<Font*> font_list;
extern Font *cursor;
extern std::stringstream *char_input;
void init();
void createLetter(int ascii_code);
void setLetter(Font* font, int ascii_code);
void createString(std::string words);
void draw();
void clean();
void deleteLine();
};
#endif
|
/*-
* Copyright (c) 2008 Isilon Inc http://www.isilon.com/
* Authors: Doug Rabson <dfr@rabson.org>
* Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
*
* 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 THE 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 THE 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/9.3/sys/kgssapi/gssd_prot.c 184588 2008-11-03 10:38:00Z dfr $");
#ifdef _KERNEL
#include <sys/malloc.h>
#else
#include <stdlib.h>
#include <string.h>
#endif
#include <rpc/rpc.h>
#include <rpc/rpc_com.h>
#include "gssd.h"
bool_t
xdr_gss_buffer_desc(XDR *xdrs, gss_buffer_desc *buf)
{
char *val;
u_int len;
len = buf->length;
val = buf->value;
if (!xdr_bytes(xdrs, &val, &len, ~0))
return (FALSE);
buf->length = len;
buf->value = val;
return (TRUE);
}
bool_t
xdr_gss_OID_desc(XDR *xdrs, gss_OID_desc *oid)
{
char *val;
u_int len;
len = oid->length;
val = oid->elements;
if (!xdr_bytes(xdrs, &val, &len, ~0))
return (FALSE);
oid->length = len;
oid->elements = val;
return (TRUE);
}
bool_t
xdr_gss_OID(XDR *xdrs, gss_OID *oidp)
{
gss_OID oid;
bool_t is_null;
switch (xdrs->x_op) {
case XDR_ENCODE:
oid = *oidp;
if (oid) {
is_null = FALSE;
if (!xdr_bool(xdrs, &is_null)
|| !xdr_gss_OID_desc(xdrs, oid))
return (FALSE);
} else {
is_null = TRUE;
if (!xdr_bool(xdrs, &is_null))
return (FALSE);
}
break;
case XDR_DECODE:
if (!xdr_bool(xdrs, &is_null))
return (FALSE);
if (is_null) {
*oidp = GSS_C_NO_OID;
} else {
oid = mem_alloc(sizeof(gss_OID_desc));
memset(oid, 0, sizeof(*oid));
if (!xdr_gss_OID_desc(xdrs, oid))
return (FALSE);
*oidp = oid;
}
break;
case XDR_FREE:
oid = *oidp;
if (oid) {
xdr_gss_OID_desc(xdrs, oid);
mem_free(oid, sizeof(gss_OID_desc));
}
}
return (TRUE);
}
bool_t
xdr_gss_OID_set_desc(XDR *xdrs, gss_OID_set_desc *set)
{
caddr_t addr;
u_int len;
len = set->count;
addr = (caddr_t) set->elements;
if (!xdr_array(xdrs, &addr, &len, ~0, sizeof(gss_OID_desc),
(xdrproc_t) xdr_gss_OID_desc))
return (FALSE);
set->count = len;
set->elements = (gss_OID) addr;
return (TRUE);
}
bool_t
xdr_gss_OID_set(XDR *xdrs, gss_OID_set *setp)
{
gss_OID_set set;
bool_t is_null;
switch (xdrs->x_op) {
case XDR_ENCODE:
set = *setp;
if (set) {
is_null = FALSE;
if (!xdr_bool(xdrs, &is_null)
|| !xdr_gss_OID_set_desc(xdrs, set))
return (FALSE);
} else {
is_null = TRUE;
if (!xdr_bool(xdrs, &is_null))
return (FALSE);
}
break;
case XDR_DECODE:
if (!xdr_bool(xdrs, &is_null))
return (FALSE);
if (is_null) {
*setp = GSS_C_NO_OID_SET;
} else {
set = mem_alloc(sizeof(gss_OID_set_desc));
memset(set, 0, sizeof(*set));
if (!xdr_gss_OID_set_desc(xdrs, set))
return (FALSE);
*setp = set;
}
break;
case XDR_FREE:
set = *setp;
if (set) {
xdr_gss_OID_set_desc(xdrs, set);
mem_free(set, sizeof(gss_OID_set_desc));
}
}
return (TRUE);
}
bool_t
xdr_gss_channel_bindings_t(XDR *xdrs, gss_channel_bindings_t *chp)
{
gss_channel_bindings_t ch;
bool_t is_null;
switch (xdrs->x_op) {
case XDR_ENCODE:
ch = *chp;
if (ch) {
is_null = FALSE;
if (!xdr_bool(xdrs, &is_null)
|| !xdr_uint32_t(xdrs, &ch->initiator_addrtype)
|| !xdr_gss_buffer_desc(xdrs,
&ch->initiator_address)
|| !xdr_uint32_t(xdrs, &ch->acceptor_addrtype)
|| !xdr_gss_buffer_desc(xdrs,
&ch->acceptor_address)
|| !xdr_gss_buffer_desc(xdrs,
&ch->application_data))
return (FALSE);
} else {
is_null = TRUE;
if (!xdr_bool(xdrs, &is_null))
return (FALSE);
}
break;
case XDR_DECODE:
if (!xdr_bool(xdrs, &is_null))
return (FALSE);
if (is_null) {
*chp = GSS_C_NO_CHANNEL_BINDINGS;
} else {
ch = mem_alloc(sizeof(*ch));
memset(ch, 0, sizeof(*ch));
if (!xdr_uint32_t(xdrs, &ch->initiator_addrtype)
|| !xdr_gss_buffer_desc(xdrs,
&ch->initiator_address)
|| !xdr_uint32_t(xdrs, &ch->acceptor_addrtype)
|| !xdr_gss_buffer_desc(xdrs,
&ch->acceptor_address)
|| !xdr_gss_buffer_desc(xdrs,
&ch->application_data))
return (FALSE);
*chp = ch;
}
break;
case XDR_FREE:
ch = *chp;
if (ch) {
xdr_gss_buffer_desc(xdrs, &ch->initiator_address);
xdr_gss_buffer_desc(xdrs, &ch->acceptor_address);
xdr_gss_buffer_desc(xdrs, &ch->application_data);
mem_free(ch, sizeof(*ch));
}
}
return (TRUE);
}
|
/*
* This file is part of `et engine`
* Copyright 2009-2016 by Sergey Reznik
* Please, modify content only if you know what are you doing.
*
*/
#pragma once
#include <et/core/tasks.h>
#include <et/core/criticalsection.h>
namespace et
{
class TaskPool
{
public:
TaskPool();
~TaskPool();
void update(float t);
void addTask(Task* t, float delay = 0.0f);
bool hasTasks();
private:
void joinTasks();
ET_DENY_COPY(TaskPool);
private:
CriticalSection _csModifying;
Task::List _tasks;
Task::List _tasksToAdd;
float _lastTime = 0.0f;
};
}
|
/*******************************************************************************
@file libisten_test.c
*//**
Tests the isten library
*******************************************************************************/
#include <stdio.h>
#include "libisten.h"
int
main(void)
{
int passT1 = 0;
int passT2 = 0;
int t1 = 10;
int t2 = 12;
int numPass = 0;
int totTest = 2;
if (isten(t1))
{
passT1 = 1;
numPass++;
}
if (!isten(t2))
{
passT2 = 1;
numPass++;
}
printf("libisten test results:\n");
printf("%d/%d passed\n", numPass, totTest);
if (numPass == totTest)
{
printf("All tests passed!\n");
}
return !(numPass == totTest);
}
|
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* 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.txt
*
* 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 itkAnalyticSignalImageFilter_h
#define itkAnalyticSignalImageFilter_h
#include <complex>
#include "itkFFT1DComplexToComplexImageFilter.h"
#include "itkFFT1DRealToComplexConjugateImageFilter.h"
#include "itkImageRegionSplitterDirection.h"
namespace itk
{
/** \class AnalyticSignalImageFilter
* \brief Generates the analytic signal from one direction of an image.
*
* This filter generates the complex valued analytic signal along one direction
* of an image. This input is a real valued image, and the output is a complex
* image.
*
* The analytic signal is given by
*
* f_a(x) = f(x) - i f_H(x)
*
* Where i is the square root of one and f_H(x) is the Hibert transform of f(x).
*
* Since the Hilbert transform in the Fourier domain is
*
* F_H(k) = F(k) i sign(k),
*
* f_a(x) is calculated by
*
* f_a(x) = F^{-1}( F(k) 2 U(k) )
*
* where U(k) is the unit step function.
*
* \ingroup FourierTransform
* \ingroup Ultrasound
*/
template< typename TInputImage, typename TOutputImage >
class AnalyticSignalImageFilter:
public ImageToImageFilter< TInputImage, TOutputImage >
{
public:
/** Standard class typedefs. */
typedef TInputImage InputImageType;
typedef TOutputImage OutputImageType;
typedef typename OutputImageType::RegionType OutputImageRegionType;
itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
typedef AnalyticSignalImageFilter Self;
typedef ImageToImageFilter< InputImageType, OutputImageType > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
itkTypeMacro( AnalyticSignalImageFilter, ImageToImageFilter );
itkNewMacro( Self );
/** Get the direction in which the filter is to be applied. */
virtual unsigned int GetDirection() const
{
return this->m_FFTRealToComplexFilter->GetDirection();
}
/** Set the direction in which the filter is to be applied. */
virtual void SetDirection( const unsigned int direction )
{
if( this->m_FFTRealToComplexFilter->GetDirection() != direction )
{
this->m_FFTRealToComplexFilter->SetDirection( direction );
this->m_FFTComplexToComplexFilter->SetDirection( direction );
this->Modified();
}
}
protected:
AnalyticSignalImageFilter();
virtual ~AnalyticSignalImageFilter() {}
void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
// These behave like their analogs in FFT1DRealToComplexConjugateImageFilter.
virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
virtual void EnlargeOutputRequestedRegion(DataObject *output) ITK_OVERRIDE;
virtual void BeforeThreadedGenerateData() ITK_OVERRIDE;
virtual void ThreadedGenerateData( const OutputImageRegionType& outputRegionForThread, ThreadIdType threadId ) ITK_OVERRIDE;
virtual void AfterThreadedGenerateData() ITK_OVERRIDE;
typedef FFT1DRealToComplexConjugateImageFilter< InputImageType, OutputImageType > FFTRealToComplexType;
typedef FFT1DComplexToComplexImageFilter< OutputImageType, OutputImageType > FFTComplexToComplexType;
typename FFTRealToComplexType::Pointer m_FFTRealToComplexFilter;
typename FFTComplexToComplexType::Pointer m_FFTComplexToComplexFilter;
/** Override to return a splitter that does not split along the direction we
* are performing the transform. */
virtual const ImageRegionSplitterBase* GetImageRegionSplitter() const ITK_OVERRIDE;
private:
AnalyticSignalImageFilter( const Self& ); // purposely not implemented
void operator=( const Self& ); // purposely not implemented
ImageRegionSplitterDirection::Pointer m_ImageRegionSplitter;
};
}
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkAnalyticSignalImageFilter.hxx"
#endif
#endif // itkAnalyticSignalImageFilter_h
|
/*
Copyright (c) 2008-2013, Northwestern University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of the Northwestern University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
*/
#ifndef _ALTOVA_INCLUDED_AIMXML_ALTOVA__ALTOVA_CComparisonOperator
#define _ALTOVA_INCLUDED_AIMXML_ALTOVA__ALTOVA_CComparisonOperator
namespace AIMXML
{
class CComparisonOperator : public TypeBase
{
public:
AIMXML_EXPORT CComparisonOperator(xercesc::DOMNode* const& init);
AIMXML_EXPORT CComparisonOperator(CComparisonOperator const& init);
void operator=(CComparisonOperator const& other) { m_node = other.m_node; }
static altova::meta::SimpleType StaticInfo() { return altova::meta::SimpleType(types + _altova_ti_altova_CComparisonOperator); }
enum EnumValues {
Invalid = -1,
k_Equal = 0, // Equal
k_NotEqual = 1, // NotEqual
k_LessThan = 2, // LessThan
k_LessThanEqual = 3, // LessThanEqual
k_GreaterThan = 4, // GreaterThan
k_GreaterThanEqual = 5, // GreaterThanEqual
EnumValueCount
};
void operator= (const string_type& value)
{
altova::XmlFormatter* Formatter = static_cast<altova::XmlFormatter*>(altova::AnySimpleTypeFormatter);
XercesTreeOperations::SetValue(GetNode(), Formatter->Format(value));
}
operator string_type()
{
return CastAs<string_type >::Do(GetNode(), 0);
}
};
} // namespace AIMXML
#endif // _ALTOVA_INCLUDED_AIMXML_ALTOVA__ALTOVA_CComparisonOperator
|
/*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
*/
#ifndef SQLDATACONTAINER_H
#define SQLDATACONTAINER_H
#include "config.h"
#include "SQLQuery.h"
#include "MC2String.h"
// Forward declaration
class Packet;
class SQLDataContainer {
public:
/**
* A class to keep track if the value is numeric or not.
*/
class NameAndIsNum : public pair< MC2String, bool > {
public:
/**
* Creates a NameAndIsNum with the value name and if its numeric.
*
* @param value The name of value.
* @param isNumeric Set to true if it value is a numeric type, if not
* set it to false.
*/
NameAndIsNum( MC2String value, bool isNumeric )
: pair< MC2String, bool >( value, isNumeric ) {}
};
typedef vector< NameAndIsNum > rowName_t;
typedef vector< vector< MC2String > > rowValues_t;
/** Default constructor */
SQLDataContainer();
/**
* Creates a SQLDataContainer with the column names and a row of values.
*
* @param rowNames The column names.
* @param rowValue The values of a row.
*/
SQLDataContainer( const rowName_t& rowNames,
const rowValues_t::value_type& rowValue );
~SQLDataContainer();
/**
* Get the number of rows.
*
* @return The number of value rows.
*/
inline uint32 getNbrRows() const;
/**
* Append the key and value to the SQL query statement.
* To be used when asking for data from the database.
*
* @param s The query string that we wish to append the key and value to.
*/
void appendRowCol( MC2String& s ) const;
/**
* Append the key and value to the SQL query statement.
* To be used when inserting data to the database.
*
* @param s The query string we wish to append the values to.
*/
void appendValues( MC2String& s ) const;
/**
* Get the data from p and set into this.
*
* @param p The SQL query.
*
* @return Returns true if succeded false otherwise.
*/
bool getSQLData( SQLQuery* p );
/**
* Get the value from a certain row and column.
*
* @param row The row number.
* @param col The column name in the database.
* @param value The value we are looking for will be set to this.
*
* @return Returns true if succeded false otherwise.
*/
bool getCol( uint32 row, const MC2String& col, MC2String& value ) const;
/**
* Load from packet.
*
* @param p The packet we want to load from.
* @param pos The header size of the packet type.
*
* @return Returns true if succeded false otherwise.
*/
void load( const Packet* p, int& pos );
/**
* Save to packet.
*
* @param p The packet we want to save to.
* @param pos The header size of the packet type.
*
* @return Returns true if succeded false otherwise.
*/
void save( Packet* p, int& pos ) const;
/**
* Returns the size of the packet.
*
* @return Size in packet.
*/
uint32 getSizeInPacket() const;
private:
/// Holds the names and if the type is numeric of the columns in the table.
rowName_t m_rowNames;
/// Holds the data from the table.
rowValues_t m_rowValues;
};
inline uint32
SQLDataContainer::getNbrRows() const
{
return m_rowValues.size();
}
#endif //SQLDATACONTAINER_H
|
/**/
#include <stdio.h>
#include <math.h>
int main(void)
{
int num1, num2, num3, num4, num_smallest;
printf("Please enter 4 numbers separated by spaces > ");
scanf("%d%d%d%d",&num1,&num2,&num3,&num4);
if ((num1 < num2) && (num1 < num3) && (num1 < num4))
{
num_smallest = num1;
printf("%d is the smallest\n",num_smallest);
}
else if ((num2 < num1) && (num2 < num3) && (num2 < num4))
{
num_smallest = num2;
printf("%d is the smallest\n",num_smallest);
}
else if ((num3 < num1) && (num3 < num2) && (num3 < num4))
{
num_smallest = num3;
printf("%d is the smallest\n",num_smallest);
}
else if ((num4 < num1) && (num4 < num2) && (num4 < num3))
{
num_smallest = num1;
printf("%d is the smallest\n",num_smallest);
}
return 0;
}
|
/*
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#pragma once
#include <folly/io/async/AsyncServerSocket.h>
#include "bistro/bistro/if/gen-cpp2/common_types.h"
namespace facebook { namespace bistro {
/**
* Makes a socket, on which this server will listen, and returns the socket
* with its address. Unless overridden via --server_* command-line
* arguments, automatically chooses:
* - the network interface
* - the address & port
* Also see ServiceClients::getAsyncClientForAddress.
*
* This is a good place to add proxy support.
*/
std::pair<folly::AsyncServerSocket::UniquePtr, cpp2::ServiceAddress>
getServerSocketAndAddress();
}}
|
/* $NetBSD: reloc.h,v 1.6 1996/10/07 03:15:03 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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.
*
* @(#)reloc.h 8.1 (Berkeley) 6/10/93
*
* from: Header: reloc.h,v 1.6 92/06/20 09:59:37 torek Exp
*/
#ifndef __MIPS_RELOC_H__
#define __MIPS_RELOC_H__
/*
* MIPS relocation types.
*/
enum reloc_type {
MIPS_RELOC_32, /* 32-bit absolute */
MIPS_RELOC_JMP, /* 26-bit absolute << 2 | high 4 bits of pc */
MIPS_RELOC_WDISP16, /* 16-bit signed pc-relative << 2 */
MIPS_RELOC_HI16, /* 16-bit absolute << 16 */
MIPS_RELOC_HI16_S, /* 16-bit absolute << 16 (+1 if needed) */
MIPS_RELOC_LO16, /* 16-bit absolute */
};
/*
* MIPS relocation info.
*
* Symbol-relative relocation is done by:
* 1. start with the value r_addend,
* 2. locate the appropriate symbol and if defined, add symbol value,
* 3. if pc relative, subtract pc,
* 4. if the reloc_type is MIPS_RELOC_HI16_S and the result bit 15 is set,
* add 0x00010000,
* 5. shift down 2 or 16 if necessary.
* The resulting value is then to be stuffed into the appropriate bits
* in the object (the low 16, or the low 26 bits).
*/
struct reloc_info_mips {
u_long r_address; /* relocation addr (offset in segment) */
u_int r_index:24, /* segment (r_extern==0) or symbol index */
r_extern:1, /* if set, r_index is symbol index */
:2; /* unused */
enum reloc_type r_type:5; /* relocation type, from above */
long r_addend; /* value to add to symbol value */
};
#define relocation_info reloc_info_mips
#endif /* __MIPS_RELOC_H__ */
|
//
// SDLRPCStruct.h
#import <Foundation/Foundation.h>
#import "NSNumber+NumberType.h"
NS_ASSUME_NONNULL_BEGIN
/// Superclass of all RPC-related structs and messages
@interface SDLRPCStruct : NSObject <NSCopying>
/// The store that contains RPC data
@property (strong, nonatomic, readonly) NSMutableDictionary<NSString *, id> *store;
/// Declares if the RPC payload ought to be protected
@property (assign, nonatomic, getter=isPayloadProtected) BOOL payloadProtected;
/**
* Convenience init
*
* @param dict A dictionary
* @return A SDLRPCStruct object
*/
- (instancetype)initWithDictionary:(NSDictionary<NSString *, id> *)dict;
/**
* Converts struct to JSON formatted data
*
* @param version The protocol version
* @return JSON formatted data
*/
- (NSDictionary<NSString *, id> *)serializeAsDictionary:(Byte)version;
@end
NS_ASSUME_NONNULL_END
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <ABI44_0_0React/ABI44_0_0RCTComponentViewProtocol.h>
NS_ASSUME_NONNULL_BEGIN
/*
* Holds a native view instance and a set of attributes associated with it.
* Mounting infrastructure uses these objects to bookkeep views and cache their
* attributes for efficient access.
*/
class ABI44_0_0RCTComponentViewDescriptor final {
public:
/*
* Associated (and owned) native view instance.
*/
__strong UIView<ABI44_0_0RCTComponentViewProtocol> *view = nil;
/*
* Indicates a requirement to call on the view methods from
* `ABI44_0_0RCTMountingTransactionObserving` protocol.
*/
bool observesMountingTransactionWillMount{false};
bool observesMountingTransactionDidMount{false};
};
inline bool operator==(ABI44_0_0RCTComponentViewDescriptor const &lhs, ABI44_0_0RCTComponentViewDescriptor const &rhs)
{
return lhs.view == rhs.view;
}
inline bool operator!=(ABI44_0_0RCTComponentViewDescriptor const &lhs, ABI44_0_0RCTComponentViewDescriptor const &rhs)
{
return lhs.view != rhs.view;
}
template <>
struct std::hash<ABI44_0_0RCTComponentViewDescriptor> {
size_t operator()(ABI44_0_0RCTComponentViewDescriptor const &componentViewDescriptor) const
{
return std::hash<void *>()((__bridge void *)componentViewDescriptor.view);
}
};
NS_ASSUME_NONNULL_END
|
#pragma once
#include "afxwin.h"
#include "ChannelAssignmentWnd.h"
// CConfigurationPage dialog
class CConfigurationPage : public CPropertyPage
{
DECLARE_DYNAMIC(CConfigurationPage)
public:
CConfigurationPage(COMMCONFIG *CommConfig, CString COMPortName);
virtual ~CConfigurationPage();
// Dialog Data
enum { IDD = IDD_PP_CONFIGURATION };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
void PopulateSystemSerialPorts();
DECLARE_MESSAGE_MAP()
public:
virtual BOOL OnInitDialog();
CComboBox m_comportComboControl;
COMMCONFIG *m_pCommConfig;
CString m_strPortName;
afx_msg void OnBnClickedButtonSettings();
CString m_comportComboValue;
CChannelAssignmentWnd m_ChannelAssignmentWnd;
};
|
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2014, The University of Texas
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of The University of Texas nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "blis.h"
void bli_hemv_blk_var3( conj_t conjh,
obj_t* alpha,
obj_t* a,
obj_t* x,
obj_t* beta,
obj_t* y,
hemv_t* cntl )
{
obj_t a11, a11_pack;
obj_t a21;
obj_t x1, x1_pack;
obj_t x2;
obj_t y1, y1_pack;
obj_t y2;
dim_t mn;
dim_t ij;
dim_t b_alg;
// Even though this blocked algorithm is expressed only in terms of the
// lower triangular case, the upper triangular case is still supported:
// when bli_acquire_mpart_tl2br() is passed a matrix that is stored in
// in the upper triangle, and the requested subpartition resides in the
// lower triangle (as is the case for this algorithm), the routine fills
// the request as if the caller had actually requested the corresponding
// "mirror" subpartition in the upper triangle, except that it marks the
// subpartition for transposition (and conjugation).
// Initialize objects for packing.
bli_obj_init_pack( &a11_pack );
bli_obj_init_pack( &x1_pack );
bli_obj_init_pack( &y1_pack );
// Query dimension.
mn = bli_obj_length( *a );
// y = beta * y;
bli_scalv_int( beta,
y,
cntl_sub_scalv( cntl ) );
// Partition diagonally.
for ( ij = 0; ij < mn; ij += b_alg )
{
// Determine the current algorithmic blocksize.
b_alg = bli_determine_blocksize_f( ij, mn, a,
cntl_blocksize( cntl ) );
// Acquire partitions for A11, A10, x1, x0, y1, and y0.
bli_acquire_mpart_tl2br( BLIS_SUBPART11,
ij, b_alg, a, &a11 );
bli_acquire_mpart_tl2br( BLIS_SUBPART21,
ij, b_alg, a, &a21 );
bli_acquire_vpart_f2b( BLIS_SUBPART1,
ij, b_alg, x, &x1 );
bli_acquire_vpart_f2b( BLIS_SUBPART2,
ij, b_alg, x, &x2 );
bli_acquire_vpart_f2b( BLIS_SUBPART1,
ij, b_alg, y, &y1 );
bli_acquire_vpart_f2b( BLIS_SUBPART2,
ij, b_alg, y, &y2 );
// Initialize objects for packing A11, x1, and y1 (if needed).
bli_packm_init( &a11, &a11_pack,
cntl_sub_packm_a11( cntl ) );
bli_packv_init( &x1, &x1_pack,
cntl_sub_packv_x1( cntl ) );
bli_packv_init( &y1, &y1_pack,
cntl_sub_packv_y1( cntl ) );
// Copy/pack A11, x1, y1 (if needed).
bli_packm_int( &a11, &a11_pack,
cntl_sub_packm_a11( cntl ),
&BLIS_PACKM_SINGLE_THREADED );
bli_packv_int( &x1, &x1_pack,
cntl_sub_packv_x1( cntl ) );
bli_packv_int( &y1, &y1_pack,
cntl_sub_packv_y1( cntl ) );
// y1 = y1 + alpha * A21' * x2;
bli_gemv_int( bli_apply_conj( conjh, BLIS_TRANSPOSE ),
BLIS_NO_CONJUGATE,
alpha,
&a21,
&x2,
&BLIS_ONE,
&y1_pack,
cntl_sub_gemv_t_cp( cntl ) );
// y1 = y1 + alpha * A11 * x1;
bli_hemv_int( conjh,
alpha,
&a11_pack,
&x1_pack,
&BLIS_ONE,
&y1_pack,
cntl_sub_hemv( cntl ) );
// y2 = y2 + alpha * A21 * x1;
bli_gemv_int( BLIS_NO_TRANSPOSE,
BLIS_NO_CONJUGATE,
alpha,
&a21,
&x1_pack,
&BLIS_ONE,
&y2,
cntl_sub_gemv_n_cp( cntl ) );
// Copy/unpack y1 (if y1 was packed).
bli_unpackv_int( &y1_pack, &y1,
cntl_sub_unpackv_y1( cntl ) );
}
// If any packing buffers were acquired within packm, release them back
// to the memory manager.
bli_obj_release_pack( &a11_pack );
bli_obj_release_pack( &x1_pack );
bli_obj_release_pack( &y1_pack );
}
|
#ifndef VLR_VEHICLE_H_
#define VLR_VEHICLE_H_
#include "MKZ_constants.h"
#include "Global.h"
namespace vlr {
typedef struct {
int torque_mode;
double max_steering, max_throttle, max_brake, max_torque;
double max_wheel_angle, max_wheel_rate;
double steering_ratio, wheel_base, imu_to_cg_dist;
double a, b, ftire_stiffness, rtire_stiffness;
double mass, iz, tau;
double max_steering_rate;
double steer_inertia;
double brake_decel_coef, throttle_accel_coef;
int bicycle_model;
} vehicle_params;
class vehicle_state {
public:
vehicle_state();
void set_mkz_params(void);
vehicle_params param;
/* offset to real world coordinates */
double origin_x, origin_y;
char utmzone[5];
int paused;
double x, y, yaw;
double v_x, v_y, yaw_rate;
double wheel_angle, wheel_angle_rate;
double commanded_wheel_angle, commanded_forward_accel;
double actual_forward_accel;
double lateral_accel;
double added_error_x, added_error_y;
double torque, throttle;
int shifting;
double shift_timer;
int commanded_direction, direction;
};
} // namespace vlr
#endif
|
/**
* Compile to WASM
*
* emcc sort.c -Os -s BINARYEN=1 -s WASM=1 -s SIDE_MODULE=1 -s EXPORTED_FUNCTIONS="['_sort', '_setup']" -o sort.wasm
*
* Compile to asm.js
*
* emcc sort.c -s EXPORTED_FUNCTIONS="['_sort', '_setup']" -O2 -s SIDE_MODULE=0 -s WASM=0 -o sort.asm.js
*
*/
#include <stdio.h>
void bubble_sort(int* a, int n)
{
int i = 0, j = 0, min = 0, tmp = 0, k = 0;
if (n < 0 || a == NULL)
return;
for (i = 0; i < n; ++i) {
min = a[i];
k = 0;
for (j = i + 1; j < n; ++j) {
if (a[j] < min) {
min = a[j];
k = j;
}
}
if (k > 0) {
tmp = a[i];
a[i] = min;
a[k] = tmp;
}
}
}
#define N 1000
int a[N] = { 0 };
void setup()
{
for (int i = 0; i < N; ++i)
a[i] = N - i;
}
void sort(int count)
{
for (int i = 0; i < count; ++i)
bubble_sort(a, N);
}
|
//
// SMOPSyncProcess.h
// SM1Password Sync
//
// Created by sam on 3/18/13.
// Copyright 2013 Sam Marshall. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "SMOPFunctions.h"
@protocol SMOPSyncProcessDelegate <NSObject>
-(void)syncItemNumber:(NSUInteger)item ofTotal:(NSUInteger)count;
@end
@interface SMOPSyncProcess : NSObject {
NSString *localKeychainPath;
NSString *mergeKeychainPath;
AMDevice *device;
NSMutableSet *localContents;
NSMutableSet *deviceContents;
BOOL deviceSyncError;
id<SMOPSyncProcessDelegate> delegate;
}
@property (nonatomic, retain) id<SMOPSyncProcessDelegate> delegate;
- (void)setSyncDevice:(AMDevice *)syncDevice withSyncStatus:(BOOL)status;
#pragma mark -
#pragma mark 1Password Sync
- (AMDevice *)getSyncDevice;
- (void)loadContentsData;
- (void)synchronizePasswords;
- (BOOL)deviceSyncStateFileExistsLocally;
- (BOOL)checkForSyncPossible;
- (void)initiateSyncingProcess;
- (void)updateSyncingProcessToFile:(NSString *)name forSyncState:(NSString *)state;
- (void)finishSyncingProcess;
#pragma mark -
#pragma mark Application Install
- (void)installOnePassword;
@end
|
/* Copyright (c) 2010-2019, Delft University of Technology
* All rigths reserved
*
* This file is part of the Tudat. Redistribution and use in source and
* binary forms, with or without modification, are permitted exclusively
* under the terms of the Modified BSD license. You should have received
* a copy of the license with this file. If not, please or visit:
* http://tudat.tudelft.nl/LICENSE.
*
* Notes
* More information on the trajectory design code and how the quantities
* are calculated can be found in [Musegaas, 2012], who is also the author
* of this code
*
*/
#ifndef TUDAT_DEPARTURE_LEG_MGA_H
#define TUDAT_DEPARTURE_LEG_MGA_H
#include <vector>
#include <Tudat/Mathematics/BasicMathematics/mathematicalConstants.h>
#include "Tudat/Astrodynamics/TrajectoryDesign/departureLeg.h"
namespace tudat
{
namespace transfer_trajectories
{
//! Departure Leg class of an MGA trajectory model.
/*!
* A class that calculates the required impulses for a departure leg for an MGA high-thrust,
* patched-conics trajectory model.
* It extends the departure leg base class and uses a lambert targeter for finding the required
* departure and arrival velocities of the spacecraft.
*/
class DepartureLegMga : public DepartureLeg
{
public:
//! Constructor with immediate definition of parameters.
/*!
* Constructor, sets objects and functions from which relevant environment and state variables
* are retrieved.
* \param departureBodyPosition location of the departure body.
* \param arrivalBodyPosition position of the target body.
* \param timeOfFlight Length of the leg.
* \param departureBodyVelocity velocity of the departure body.
* \param centralBodyGravitationalParameter gravitational parameter of the cebtral body (most cases the Sun).
* \param departureBodyGravitationalParameter gravitational parameter of the departure body.
* \param semiMajorAxis semi-major axis of the orbit after the capture is performed.
* \param eccentricity eccentricity of the orbit after the capture is performed.
* \param includeDepartureDeltaV Boolean denoting whether to include the Delta V of departure.
*/
DepartureLegMga( const Eigen::Vector3d& departureBodyPosition,
const Eigen::Vector3d& arrivalBodyPosition,
const double timeOfFlight,
const Eigen::Vector3d& departureBodyVelocity,
const double centralBodyGravitationalParameter,
const double departureBodyGravitationalParameter,
const double semiMajorAxis,
const double eccentricity,
const bool includeDepartureDeltaV = true ):
DepartureLeg( departureBodyPosition,
arrivalBodyPosition,
timeOfFlight,
departureBodyVelocity,
centralBodyGravitationalParameter,
departureBodyGravitationalParameter,
semiMajorAxis,
eccentricity, includeDepartureDeltaV )
{
velocityAfterDeparture_( 0 ) = TUDAT_NAN;
}
//! Calculate the leg
/*!
* Performs all calculations required for this leg.
* \param velocityBeforeArrivalBody the velocity of the spacecraft before it arrives at the target body.
* \param deltaV the delta V required to perform the leg.
*/
void calculateLeg( Eigen::Vector3d& velocityBeforeArrivalBody,
double& deltaV );
//! Calculate intermediate positions and their corresponding times.
/*!
* Calculates intermediate positions and their corresponding times in the leg, based on a
* maximum time between two points.
* \param maximumTimeStep the maximum time between two points along the trajectory.
* \param positionVector Vector of positions along the orbit, space according to the maximum time step.
* \param timeVector The times corresponding to the positions.
* \param startingTime the initial time from which the intermediate points are given.
*/
void intermediatePoints( const double maximumTimeStep,
std::vector < Eigen::Vector3d >& positionVector,
std::vector < double >& timeVector,
const double startingTime = 0.0 );
//! Return maneuvres along the leg.
/*!
* Returns the maneuver points, times and sizes along the trajectory.
* \param positionVector Vector of the positions of the maneuvers.
* \param timeVector The times corresponding to the positions.
* \param deltaVVector the delta V required for each maneuver.
* \param startingTime the initial time from which the maneuvers are given.
*/
void maneuvers( std::vector < Eigen::Vector3d >& positionVector,
std::vector < double >& timeVector,
std::vector < double >& deltaVVector,
const double startingTime = 0. );
//! Update the defining variables.
/*!
* Sets the trajectory defining variables to the newly specified values. Required for re-using
* the class, without re-initializing it. For this leg: time of flight.
* \param variableVector the new variable vector.
*/
void updateDefiningVariables( const Eigen::VectorXd& variableVector );
protected:
private:
};
} // namespace transfer_trajectories
} // namespace tudat
#endif // TUDAT_DEPARTURE_LEG_MGA_H
|
// Copyright 2018 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 MEDIA_LEARNING_IMPL_FISHER_IRIS_DATASET_H_
#define MEDIA_LEARNING_IMPL_FISHER_IRIS_DATASET_H_
#include <vector>
#include "base/memory/ref_counted.h"
#include "media/learning/common/labelled_example.h"
namespace media {
namespace learning {
// Classic machine learning dataset.
//
// @misc{Dua:2017 ,
// author = "Dheeru, Dua and Karra Taniskidou, Efi",
// year = "2017",
// title = "{UCI} Machine Learning Repository",
// url = "http://archive.ics.uci.edu/ml",
// institution = "University of California, Irvine, "
// "School of Information and Computer Sciences" }
class FisherIrisDataset {
public:
FisherIrisDataset();
~FisherIrisDataset();
const TrainingData& GetTrainingData() const;
private:
TrainingData training_data_;
};
} // namespace learning
} // namespace media
#endif // MEDIA_LEARNING_IMPL_FISHER_IRIS_DATASET_H_
|
/*
* @HEADER
*
* ***********************************************************************
*
* Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
* Copyright 2012 Sandia Corporation
*
* Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
* the U.S. Government retains certain rights in this software.
*
* 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.
*
* 3. Neither the name of the Corporation nor the names of the
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "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 SANDIA CORPORATION OR THE
* 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.
*
* Questions? Contact Karen Devine kddevin@sandia.gov
* Erik Boman egboman@sandia.gov
*
* ***********************************************************************
*
* @HEADER
*/
#include <mpi.h>
#include <stdlib.h>
#include <stdio.h>
#include "dr_const.h"
#include "dr_loadbal_const.h"
#ifdef __cplusplus
/* if C++, define the rest of this header file as extern C */
extern "C" {
#endif
/*****************************************************************************/
void setup_fixed_obj(MESH_INFO_PTR mesh, int Num_Global_Parts)
{
int i, part;
int proc, nprocs;
FILE *fp;
MPI_Comm_rank(MPI_COMM_WORLD, &proc);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
/* Initialize fixed elements in mesh */
for (i = 0; i < mesh->num_elems; i++) mesh->elements[i].fixed_part = -1;
switch (Test.Fixed_Objects) {
case 1:
/* Fix 100% of objects */
for (i = 0; i < mesh->num_elems; i++) {
mesh->elements[i].fixed_part = i % Num_Global_Parts;
}
break;
case 2:
/* Fix 50% of objects */
for (i = 1; i < mesh->num_elems; i+=2) {
mesh->elements[i].fixed_part = i % Num_Global_Parts;
}
break;
case 3:
/* Fix 10% of objects */
for (i = 0; i < mesh->num_elems; i+=10) {
mesh->elements[i].fixed_part = i % Num_Global_Parts;
}
break;
case 4:
/* Fix 100% of objects to partition 1 */
for (i = 0; i < mesh->num_elems; i++) {
mesh->elements[i].fixed_part = 1;
}
break;
case 5:
/* Fix 50% of objects to partition 1 */
for (i = mesh->num_elems/2; i < mesh->num_elems; i++) {
mesh->elements[i].fixed_part = 1;
}
break;
case 6:
/* Fix 10% of objects to partition 1 */
for (i = 0; i < mesh->num_elems/10; i++) {
mesh->elements[i].fixed_part = 1;
}
break;
case 7:
/* Fix one object on each proc. */
for (i = 0; i < MIN(1, mesh->num_elems); i++) {
mesh->elements[i].fixed_part = (proc%Num_Global_Parts);
}
break;
case 8:
/* Fix half the objects on half the procs, 25% overall */
if (proc&1){
for (i = 0; i < mesh->num_elems/2; i++) {
mesh->elements[i].fixed_part = (proc%Num_Global_Parts);
}
}
break;
case 9:
/* Fix first two objects on proc 0 only. */
if (proc == 0){
for (i = 0; i < MIN(2, mesh->num_elems); i++) {
mesh->elements[i].fixed_part = i;
}
}
break;
case 10:
/* Fix 0% of objects */
break;
case 99:
/* Read from file. Assume serial execution for now. */
if (proc == 0){
/* TODO: Make filename a parameter. Hardcoded for now. */
fp = fopen("fixed.dat", "r");
if (fp == NULL)
fprintf(stderr, "ERROR in opening file fixed.dat. No fixed vertices set.\n");
else {
while (1){
if (feof(fp)) break;
/* read (i, part) for each fixed vertex */
fscanf(fp, "%i%i\n", &i, &part);
if ((part >= 0) && (part < Num_Global_Parts)){
/* printf("Debug: setting fixed[%i] = %i\n", i, part); */
mesh->elements[i].fixed_part = part;
}
else
printf("Warning: Invalid part number %i ignored\n", part);
}
fclose(fp);
}
}
break;
}
}
#ifdef __cplusplus
} /* closing bracket for extern "C" */
#endif
|
#pragma once
#include <arpa/inet.h>
namespace hare {
namespace net {
namespace sockets {
int createNonblockingOrDie(sa_family_t family);
int connect(const int sockfd, const struct sockaddr *addr);
void bindOrDie(const int sockfd, const struct sockaddr *addr);
void listenOrDie(const int sockfd);
int accept(const int sockfd, struct sockaddr_in6 *addr);
ssize_t read(const int sockfd, void *buf, const size_t count);
ssize_t readv(const int sockfd, const struct iovec *iov, const int iovcnt);
ssize_t write(const int sockfd, const void *buf, const size_t count);
void close(const int sockfd);
void shutdownWrite(int sockfd);
void toIpPort(char *buf, const size_t size, const struct sockaddr *addr);
void toIp(char *buf, const size_t size, const struct sockaddr *addr);
void fromIpPort(const char *ip, const uint16_t port, struct sockaddr_in *addr);
void fromIpPort(const char *ip, const uint16_t port, struct sockaddr_in6 *addr);
int getSocketError(const int sockfd);
const struct sockaddr* sockaddr_cast(const struct sockaddr_in* addr);
const struct sockaddr* sockaddr_cast(const struct sockaddr_in6* addr);
struct sockaddr* sockaddr_cast(struct sockaddr_in6* addr);
const struct sockaddr_in* sockaddr_in_cast(const struct sockaddr* addr);
const struct sockaddr_in6* sockaddr_in6_cast(const struct sockaddr* addr);
struct sockaddr_in6 getLocalAddr(const int sockfd);
struct sockaddr_in6 getPeerAddr(const int sockfd);
bool isSelfConnect(const int sockfd);
}
}
}
|
/*
* 2007 2013 Copyright Northwestern University
*
* Distributed under the OSI-approved BSD 3-Clause License.
* See http://ncip.github.com/annotation-and-image-markup/LICENSE.txt for details.
*/
#ifndef _ALTOVA_INCLUDED_AIMXML_ALTOVA__ALTOVA_CreferencedDicomObjectCollectionType
#define _ALTOVA_INCLUDED_AIMXML_ALTOVA__ALTOVA_CreferencedDicomObjectCollectionType
namespace AIMXML
{
class CreferencedDicomObjectCollectionType : public TypeBase
{
public:
AIMXML_EXPORT CreferencedDicomObjectCollectionType(xercesc::DOMNode* const& init);
AIMXML_EXPORT CreferencedDicomObjectCollectionType(CreferencedDicomObjectCollectionType const& init);
void operator=(CreferencedDicomObjectCollectionType const& other) { m_node = other.m_node; }
static altova::meta::ComplexType StaticInfo() { return altova::meta::ComplexType(types + _altova_ti_altova_CreferencedDicomObjectCollectionType); }
MemberElement<CReferencedDicomObject, _altova_mi_altova_CreferencedDicomObjectCollectionType_altova_ReferencedDicomObject> ReferencedDicomObject;
struct ReferencedDicomObject { typedef Iterator<CReferencedDicomObject> iterator; };
};
} // namespace AIMXML
#endif // _ALTOVA_INCLUDED_AIMXML_ALTOVA__ALTOVA_CreferencedDicomObjectCollectionType
|
// 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 MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_STRING_PIECE_H_
#define MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_STRING_PIECE_H_
#include "base/strings/string_piece.h"
#include "mojo/public/cpp/bindings/string_traits.h"
namespace mojo {
template <>
struct StringTraits<base::StringPiece> {
static bool IsNull(base::StringPiece input) {
// base::StringPiece is always converted to non-null mojom string. We could
// have let StringPiece containing a null data pointer map to null mojom
// string, but StringPiece::empty() returns true in this case. It seems
// confusing to mix the concept of empty and null strings, especially
// because they mean different things in mojom.
return false;
}
static void SetToNull(base::StringPiece* output) {
// Convert null to an "empty" base::StringPiece.
*output = base::StringPiece();
}
static base::StringPiece GetUTF8(base::StringPiece input) { return input; }
static bool Read(StringDataView input, base::StringPiece* output) {
*output = base::StringPiece(input.storage(), input.size());
return true;
}
};
} // namespace mojo
#endif // MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_STRING_PIECE_H_
|
/*
* Copyright 2008 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can
* be found in the LICENSE file.
*/
// Portable representation of scriptable NaClDesc.
#ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_DESC_BASED_HANDLE_H_
#define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_DESC_BASED_HANDLE_H_
#include <stdio.h>
#include <map>
#include "native_client/src/include/nacl_macros.h"
#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
#include "native_client/src/trusted/plugin/portable_handle.h"
#include "native_client/src/trusted/plugin/utility.h"
struct NaClDesc;
namespace nacl {
class DescWrapper;
} // namespace nacl
namespace plugin {
class Plugin;
// DescBasedHandles are used to make NaClDesc objects scriptable by JavaScript.
class DescBasedHandle : public PortableHandle {
public:
static DescBasedHandle* New(Plugin* plugin, nacl::DescWrapper* wrapper);
void Invalidate() { }
virtual BrowserInterface* browser_interface() const;
virtual Plugin* plugin() const { return plugin_; }
// Get the contained descriptor.
virtual nacl::DescWrapper* wrapper() const { return wrapper_; }
virtual NaClDesc* desc() const {
if (NULL == wrapper_) {
return NULL;
}
return wrapper_->desc();
}
protected:
DescBasedHandle();
virtual ~DescBasedHandle();
bool Init(Plugin* plugin, nacl::DescWrapper* wrapper);
private:
NACL_DISALLOW_COPY_AND_ASSIGN(DescBasedHandle);
void LoadMethods();
Plugin* plugin_;
nacl::DescWrapper* wrapper_;
};
} // namespace plugin
#endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_DESC_BASED_HANDLE_H_
|
/*
* File: wbt_mq_cluster.c
* Author: fcten
*
* Created on 2017年6月9日, 下午7:16
*/
#include "wbt_mq_cluster.h"
|
/* manually created file to be able to use pomp2_region_info.* files
* from OPARI2 component */
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
/* Translator is not ISO/IEC 9899:1999-compliant. */
#if !defined(restrict)
#define restrict
#endif
#endif
|
/* $NetBSD: intr.h,v 1.5 1996/05/13 06:11:28 mycroft Exp $ */
/*
* Copyright (c) 1996 Charles M. Hannum. All rights reserved.
*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Charles M. Hannum.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR 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.
*/
#ifndef _I386_INTR_H_
#define _I386_INTR_H_
/* Interrupt priority `levels'; not mutually exclusive. */
#define IPL_BIO 0 /* block I/O */
#define IPL_NET 1 /* network */
#define IPL_TTY 2 /* terminal */
#define IPL_CLOCK 3 /* clock */
#define IPL_IMP 4 /* memory allocation */
#define IPL_NONE 5 /* nothing */
#define IPL_HIGH 6 /* everything */
/* Interrupt sharing types. */
#define IST_NONE 0 /* none */
#define IST_PULSE 1 /* pulsed */
#define IST_EDGE 2 /* edge-triggered */
#define IST_LEVEL 3 /* level-triggered */
/* Soft interrupt masks. */
#define SIR_CLOCK 31
#define SIR_CLOCKMASK ((1 << SIR_CLOCK))
#define SIR_NET 30
#define SIR_NETMASK ((1 << SIR_NET) | SIR_CLOCKMASK)
#define SIR_TTY 29
#define SIR_TTYMASK ((1 << SIR_TTY) | SIR_CLOCKMASK)
#define SIR_ALLMASK (SIR_CLOCKMASK | SIR_NETMASK | SIR_TTYMASK)
#ifndef _LOCORE
volatile int cpl, ipending, astpending;
int imask[7];
extern void Xspllower __P((void));
static __inline int splraise __P((int));
static __inline int spllower __P((int));
static __inline void splx __P((int));
static __inline void softintr __P((int));
/*
* Add a mask to cpl, and return the old value of cpl.
*/
static __inline int
splraise(ncpl)
register int ncpl;
{
register int ocpl = cpl;
cpl = ocpl | ncpl;
return (ocpl);
}
/*
* Restore a value to cpl (unmasking interrupts). If any unmasked
* interrupts are pending, call Xspllower() to process them.
*/
static __inline void
splx(ncpl)
register int ncpl;
{
cpl = ncpl;
if (ipending & ~ncpl)
Xspllower();
}
/*
* Same as splx(), but we return the old value of spl, for the
* benefit of some splsoftclock() callers.
*/
static __inline int
spllower(ncpl)
register int ncpl;
{
register int ocpl = cpl;
cpl = ncpl;
if (ipending & ~ncpl)
Xspllower();
return (ocpl);
}
/*
* Hardware interrupt masks
*/
#define splbio() splraise(imask[IPL_BIO])
#define splnet() splraise(imask[IPL_NET])
#define spltty() splraise(imask[IPL_TTY])
#define splclock() splraise(imask[IPL_CLOCK])
#define splimp() splraise(imask[IPL_IMP])
#define splstatclock() splhigh()
/*
* Software interrupt masks
*
* NOTE: splsoftclock() is used by hardclock() to lower the priority from
* clock to softclock before it calls softclock().
*/
#define splsoftclock() spllower(SIR_CLOCKMASK)
#define splsoftnet() splraise(SIR_NETMASK)
#define splsofttty() splraise(SIR_TTYMASK)
/*
* Miscellaneous
*/
#define splhigh() splraise(-1)
#define spl0() spllower(0)
/*
* Software interrupt registration
*
* We hand-code this to ensure that it's atomic.
*/
static __inline void
softintr(mask)
register int mask;
{
__asm __volatile("orl %0,_ipending" : : "ir" (mask));
}
#define setsoftast() (astpending = 1)
#define setsoftclock() softintr(1 << SIR_CLOCK)
#define setsoftnet() softintr(1 << SIR_NET)
#define setsofttty() softintr(1 << SIR_TTY)
#endif /* !_LOCORE */
#endif /* !_I386_INTR_H_ */
|
/* Standard includes. */
#include <stdio.h>
#include "AHRS.h"
#include "OSConfig.h"
/* Library includes. */
#include "spi.h"
#include "ledTask.h"
#include "flashTask.h"
#include "AHRSEKF.h"
/*
* Configure the clocks, GPIO and other peripherals as required by the demo.
*/
static void prvSetupHardware( void );
int main( void )
{
#ifdef DEBUG
debug();
#endif
prvSetupHardware();
xAccCaliQueue = xQueueCreate(1,sizeof(AccCaliType));
xEKFQueue = xQueueCreate(1,sizeof(SensorDataType));
EKFToComQueue = xQueueCreate(1,sizeof(AttComType));
xTaskCreate(vLED1Task
,(signed char *)"Led flash"
,configMINIMAL_STACK_SIZE
,NULL
,mainFLASH_TASK_PRIORITY
,(xTaskHandle *)NULL);
xTaskCreate(vFlashTask
,(signed char *)"flash"
,configMINIMAL_STACK_SIZE+128
,NULL
,mainFLASH_TASK_PRIORITY+2
,(xTaskHandle *)NULL);
xTaskCreate(vAHRSConfig
,(signed char *)"ahrs_config"
,configMINIMAL_STACK_SIZE+128
,NULL
,mainFLASH_TASK_PRIORITY+3
,(xTaskHandle *)NULL);
/* Start the scheduler. */
vTaskStartScheduler();
for(;;);
return 0;
}
void vApplicationIdleHook(void)
{
// printf(".");
}
static void prvSetupHardware( void )
{
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
SPI_DMA_Config();
SPI_DMA_IT_Config();
}
#ifdef DEBUG
/* Keep the linker happy. */
void assert_failed( unsigned portCHAR* pcFile, unsigned portLONG ulLine )
{
for( ;; )
{
}
}
#endif
|
/**
* Copyright (c) 2015-present, Horcrux.
* All rights reserved.
*
* This source code is licensed under the MIT-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import "ABI38_0_0RNSVGGroup.h"
@interface ABI38_0_0RNSVGText : ABI38_0_0RNSVGGroup
@property (nonatomic, strong) ABI38_0_0RNSVGLength *inlineSize;
@property (nonatomic, strong) ABI38_0_0RNSVGLength *textLength;
@property (nonatomic, strong) NSString *baselineShift;
@property (nonatomic, strong) NSString *lengthAdjust;
@property (nonatomic, strong) NSString *alignmentBaseline;
@property (nonatomic, strong) NSArray<ABI38_0_0RNSVGLength *> *deltaX;
@property (nonatomic, strong) NSArray<ABI38_0_0RNSVGLength *> *deltaY;
@property (nonatomic, strong) NSArray<ABI38_0_0RNSVGLength *> *positionX;
@property (nonatomic, strong) NSArray<ABI38_0_0RNSVGLength *> *positionY;
@property (nonatomic, strong) NSArray<ABI38_0_0RNSVGLength *> *rotate;
- (CGPathRef)getGroupPath:(CGContextRef)context;
- (CTFontRef)getFontFromContext;
- (CGFloat)getSubtreeTextChunksTotalAdvance;
- (ABI38_0_0RNSVGText*)getTextAnchorRoot;
@end
|
#pragma once
#include "Entity/Component.h"
#include "Scene3D/Entity.h"
#include "Reflection/Reflection.h"
namespace DAVA
{
class SnapToLandscapeControllerComponent : public Component
{
public:
SnapToLandscapeControllerComponent();
Component* Clone(Entity* toEntity) override;
void Serialize(KeyedArchive* archive, SerializationContext* serializationContext) override;
void Deserialize(KeyedArchive* archive, SerializationContext* serializationContext) override;
inline float32 GetHeightOnLandscape() const;
void SetHeightOnLandscape(float32 height);
protected:
float32 heightOnLandscape;
DAVA_VIRTUAL_REFLECTION(SnapToLandscapeControllerComponent, Component);
};
inline float32 SnapToLandscapeControllerComponent::GetHeightOnLandscape() const
{
return heightOnLandscape;
}
}
|
// Copyright (c) 2011 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 CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_
#define CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_
#pragma once
#include "base/basictypes.h"
#include "build/build_config.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#if defined(OS_WIN)
#include <windows.h>
#elif defined(OS_MACOSX)
#ifdef __OBJC__
@class NSEvent;
#else
class NSEvent;
#endif // __OBJC__
#elif defined(OS_POSIX)
typedef struct _GdkEventKey GdkEventKey;
#endif
#if defined(TOOLKIT_VIEWS)
namespace views {
class KeyEvent;
}
#endif
// Owns a platform specific event; used to pass own and pass event through
// platform independent code.
struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
NativeWebKeyboardEvent();
#if defined(OS_WIN)
NativeWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
#elif defined(OS_MACOSX)
explicit NativeWebKeyboardEvent(NSEvent *event);
NativeWebKeyboardEvent(wchar_t character,
int state,
double time_stamp_seconds);
#elif defined(TOOLKIT_USES_GTK)
// TODO(suzhe): Limit these constructors to Linux native Gtk port.
// For Linux Views port, after using RenderWidgetHostViewViews to replace
// RenderWidgetHostViewGtk, we can use constructors for TOOLKIT_VIEWS defined
// below.
explicit NativeWebKeyboardEvent(const GdkEventKey* event);
NativeWebKeyboardEvent(wchar_t character,
int state,
double time_stamp_seconds);
#endif
#if defined(TOOLKIT_VIEWS)
// TODO(suzhe): remove once we get rid of Gtk from Views.
struct FromViewsEvent {};
// These two constructors are shared between Windows and Linux Views ports.
explicit NativeWebKeyboardEvent(const views::KeyEvent& event);
// TODO(suzhe): Sadly, we need to add a meanless FromViewsEvent parameter to
// distinguish between this contructor and above Gtk one, because they use
// different modifier flags. We can remove this extra parameter as soon as we
// disable above Gtk constructor in Linux Views port.
NativeWebKeyboardEvent(uint16 character,
int flags,
double time_stamp_seconds,
FromViewsEvent);
#endif
NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event);
~NativeWebKeyboardEvent();
NativeWebKeyboardEvent& operator=(const NativeWebKeyboardEvent& event);
#if defined(OS_WIN)
MSG os_event;
#elif defined(OS_MACOSX)
NSEvent* os_event;
#elif defined(TOOLKIT_USES_GTK)
GdkEventKey* os_event;
#endif
// True if the browser should ignore this event if it's not handled by the
// renderer. This happens for RawKeyDown events that are created while IME is
// active and is necessary to prevent backspace from doing "history back" if
// it is hit in ime mode.
// Currently, it's only used by Linux and Mac ports.
bool skip_in_browser;
#if defined(OS_LINUX)
// True if the key event matches an edit command. In order to ensure the edit
// command always work in web page, the browser should not pre-handle this key
// event as a reserved accelerator. See http://crbug.com/54573
bool match_edit_command;
#endif
};
#endif // CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_
|
/*
* $Id: XMMainWindowController.h,v 1.14 2008/10/24 12:22:02 hfriederich Exp $
*
* Copyright (c) 2005-2008 XMeeting Project ("http://xmeeting.sf.net").
* All rights reserved.
* Copyright (c) 2005-2008 Hannes Friederich. All rights reserved.
*/
#ifndef __XM_MAIN_WINDOW_CONTROLLER_H__
#define __XM_MAIN_WINDOW_CONTROLLER_H__
#import <Cocoa/Cocoa.h>
#import "XMMainWindowModule.h"
@class XMFullScreenWindow;
extern NSString *XMNotification_DidBeginFullScreenMode;
extern NSString *XMNotification_DidEndFullScreenMode;
/**
* XMMainWindowController manages the content of the main
* window. This is done by using modules as defined
* in the interface XMMaindWindowModule.
**/
@interface XMMainWindowController : NSWindowController {
@private
NSArray *modules;
unsigned activeModuleIndex;
XMFullScreenWindow *fullScreenWindow;
BOOL isFullScreen;
}
/**
* Returns the shared singleton instance of this
* class
**/
+ (XMMainWindowController *)sharedInstance;
/**
* Shows the main window on screen, moving it to front if necessary
**/
- (void)showMainWindow;
/**
* Shows the current active module in a full screen window
* Returns the success of this operation
**/
- (BOOL)beginFullScreen;
/**
* Ends the full screen mode
**/
- (void)endFullScreen;
/**
* Returns whether we're showing full screen or not
**/
- (BOOL)isFullScreen;
/**
* Returns the full screen window if in full screen mode.
* Else returns nil
**/
- (NSWindow *)fullScreenWindow;
/**
* Sets the modules of the receiver
**/
- (void)setModules:(NSArray *)modules;
/**
* Displays the desired module on screen.
* Does nothing if module is not contained in the
* module list of the receiver
**/
- (void)showModule:(id<XMMainWindowModule>)module fullScreen:(BOOL)showFullscreen;
/**
* Returns the module which is currently active
* (displayed on screen)
**/
- (id<XMMainWindowModule>)activeModule;
/**
* Informs the receiver that some size values of the sending module
* have changed. This may cause the main window to be resized
**/
- (void)noteSizeValuesDidChangeOfModule:(id<XMMainWindowModule>)module;
@end
#endif // __XM_MAIN_WINDOW_CONTROLLER_H__
|
/*
*
* All codes and statements are licensed equally to the lib-c-generic library.
*
*
*
* compile with built library:
* gcc -i<pathToLibcgeneric> <pathToLibcgeneric>/libs/libcgen.a tutorial.c -o tutorial
*
*
* compile with installed library:
* gcc -lcgeneric tutorial.c -o tutorial
*
*
*/
//include some basic system header files
#include <stdio.h>
#include <limits.h>
#include <string.h>
//include the installed libcgeneric library
//#include <libcgeneric/libcgeneric.h>
//include the built libcgeneric library
#include "libcgeneric/libcgeneric.h"
//declare the output function used by our list
void print(const void *element);
//declaration of the comparison function
int intcmp(const void* a, const void* b, size_t x UNUSED);
//main function
int main() {
//print out some application instructions
printf("Enter some numbers that are bigger than 0 and smaller than %u\n", UINT_MAX);
printf("If you enter the number 0 the applications will print out all given numbers as a sorted list\n\n---- Input --------------\n\n");
//declare a c-generic datatype
List container;
//initialize the list
memset(&container, 0, sizeof(List));
construct(List, &container, sizeof(unsigned int), FREEOBJ);
while(1) {
//read out an element
unsigned int* t=malloc(sizeof(unsigned int));
scanf("%u", t);
//add it to the list
push_back(List, &container, t, DYNAMIC);
//break if zero is the input
if(*t==0)
break;
}
printf("\n\n---- Unsorted --------------\n\n");
//set print functions
set_print(List, &container, print);
//print all element in our list
print_all(List, &container);
//lets have fun with iterators (instead using print_all)
printf("\n\n---- Iterators --------------\n\n");
ListIter* i = create(ListIter, &container);
//check if it is empty - this will never happen
if(!empty(List, &container)) {
//place the iterator at the first element
head(ListIter, i);
do {
printf("%u\n", *((unsigned int*)retrieve(ListIter, i)));
}while(!next(ListIter, i));
}
//give the memory free
destroy(ListIter, i);
printf("\n\n---- Sorted ASC --------------\n\n");
//set the sort functions
set_compare(List, &container, intcmp);
//use the in-place sort
sort(List, &container);
print_all(List, &container);
//give the memory free
destruct(List, &container);
printf("\n\n");
return 0;
}
//write the print function
void print(const void *element) {
//cast it to the right type and format the output string
printf("%u\n", (*(const unsigned int *) element));
}
//write the comparison function
int intcmp(const void* a, const void* b, size_t x UNUSED) {
/* see note 1*/
return (*((unsigned int*)a)>*((unsigned int*)b))-(*((unsigned int*)a)<*((unsigned int*)b));
}
|
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include "yarpl/Refcounted.h"
#include "yarpl/observable/Subscriptions.h"
#include <folly/ExceptionWrapper.h>
#include <glog/logging.h>
namespace yarpl {
namespace observable {
template <typename T>
class Observer : public virtual Refcounted, public yarpl::enable_get_ref {
public:
// Note: If any of the following methods is overridden in a subclass, the new
// methods SHOULD ensure that these are invoked as well.
virtual void onSubscribe(std::shared_ptr<Subscription> subscription) {
DCHECK(subscription);
if (subscription_) {
DLOG(ERROR) << "attempt to double subscribe";
subscription->cancel();
return;
}
subscription_ = std::move(subscription);
}
// No further calls to the subscription after this method is invoked.
virtual void onComplete() {
DCHECK(subscription_) << "Calling onComplete() without a subscription";
subscription_.reset();
}
// No further calls to the subscription after this method is invoked.
virtual void onError(folly::exception_wrapper) {
DCHECK(subscription_) << "Calling onError() without a subscription";
subscription_.reset();
}
virtual void onNext(T) = 0;
bool isUnsubscribed() const {
CHECK(subscription_);
return subscription_->isCancelled();
}
// Ability to add more subscription objects which will be notified when the
// subscription has been cancelled.
// Note that calling cancel on the tied subscription is not going to cancel
// this subscriber
void addSubscription(std::shared_ptr<Subscription> subscription) {
if(!subscription_) {
subscription->cancel();
return;
}
subscription_->tieSubscription(std::move(subscription));
}
template<typename OnCancel>
void addSubscription(OnCancel onCancel) {
addSubscription(Subscriptions::create(std::move(onCancel)));
}
bool isUnsubscribedOrTerminated() const {
return !subscription_ || subscription_->isCancelled();
}
protected:
Subscription* subscription() {
return subscription_.operator->();
}
void unsubscribe() {
CHECK(subscription_);
subscription_->cancel();
}
private:
std::shared_ptr<Subscription> subscription_;
};
}
}
|
#import <UIKit/UIKit.h>
@interface bsKeyboard : NSObject
+ (void)hideKeyboard;
+ (void)__hideKeyboardRecursion:(UIView *)view;
@end
|
/* $NetBSD: db_interface.c,v 1.25 1998/07/04 22:18:27 jonathan Exp $ */
/*
* Mach Operating System
* Copyright (c) 1992 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* Interface to the "ddb" kernel debugger.
*/
#include "opt_ddb.h"
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/systm.h> /* just for boothowto --eichin */
#include <vm/vm.h>
#include <dev/cons.h>
#include <machine/trap.h>
#include <machine/db_machdep.h>
#include <ddb/db_command.h>
#include <ddb/db_sym.h>
#include <ddb/db_extern.h>
extern label_t *db_recover;
int db_active = 0;
db_regs_t ddb_regs;
static void kdbprinttrap __P((int, int));
/*
* Received keyboard interrupt sequence.
*/
void
kdb_kintr(regs)
register db_regs_t *regs;
{
if (db_active == 0 && (boothowto & RB_KDB)) {
printf("\n\nkernel: keyboard interrupt\n");
kdb_trap(-1, regs);
}
}
/*
* kdb_trap - field a TRACE or BPT trap
* Return non-zero if we "handled" the trap.
*/
int
kdb_trap(type, regs)
int type;
register db_regs_t *regs;
{
switch (type) {
case T_TRACE: /* single-step */
case T_BREAKPOINT: /* breakpoint */
/* case T_WATCHPOINT:*/
break;
case -1:
break;
default:
kdbprinttrap(type, 0);
if (db_recover != 0) {
/* This will longjmp back to db_command_loop */
db_error("Caught exception in ddb.\n");
/*NOTREACHED*/
}
/*
* Tell caller "We did NOT handle the trap."
* Caller should panic or whatever.
*/
return (0);
}
/*
* We'd like to be on a separate debug stack here, but
* that's easier to do in locore.s before we get here.
* See sun3/locore.s:T_TRACE for stack switch code.
*/
ddb_regs = *regs;
db_active++;
cnpollc(TRUE); /* set polling mode, unblank video */
db_trap(type, 0); /* where the work happens */
cnpollc(FALSE); /* resume interrupt mode */
db_active--;
*regs = ddb_regs;
/*
* Indicate that single_step is for KDB.
* But lock out interrupts to prevent TRACE_KDB from setting the
* trace bit in the current SR (and trapping while exiting KDB).
*/
(void) spl7();
/*
* Tell caller "We HAVE handled the trap."
* Caller will return to locore and rte.
*/
return(1);
}
extern char *trap_type[];
extern int trap_types;
/*
* Print trap reason.
*/
static void
kdbprinttrap(type, code)
int type, code;
{
printf("kernel: ");
if (type >= trap_types || type < 0)
printf("type %d", type);
else
printf("%s", trap_type[type]);
printf(" trap\n");
}
void
Debugger()
{
asm ("trap #15");
}
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_DOWNLOAD_DATABASE_DOWNLOAD_DB_IMPL_H_
#define COMPONENTS_DOWNLOAD_DATABASE_DOWNLOAD_DB_IMPL_H_
#include <string>
#include <vector>
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "components/download/database/download_db.h"
#include "components/leveldb_proto/public/proto_database.h"
namespace download_pb {
class DownloadDBEntry;
}
namespace leveldb_proto {
class ProtoDatabaseProvider;
} // namespace leveldb_proto
namespace download {
// A protodb Implementation of DownloadDB.
class DownloadDBImpl : public DownloadDB {
public:
DownloadDBImpl(DownloadNamespace download_namespace,
const base::FilePath& database_dir,
leveldb_proto::ProtoDatabaseProvider* db_provider);
DownloadDBImpl(
DownloadNamespace download_namespace,
std::unique_ptr<
leveldb_proto::ProtoDatabase<download_pb::DownloadDBEntry>> db);
~DownloadDBImpl() override;
// DownloadDB implementation.
void Initialize(DownloadDBCallback callback) override;
void AddOrReplace(const DownloadDBEntry& entry) override;
void AddOrReplaceEntries(const std::vector<DownloadDBEntry>& entries,
DownloadDBCallback callback) override;
void LoadEntries(LoadEntriesCallback callback) override;
void Remove(const std::string& guid) override;
private:
friend class DownloadDBTest;
bool IsInitialized();
void DestroyAndReinitialize(DownloadDBCallback callback);
// Returns the key of the db entry.
std::string GetEntryKey(const std::string& guid) const;
// Called when database is initialized.
void OnDatabaseInitialized(DownloadDBCallback callback,
leveldb_proto::Enums::InitStatus status);
// Called when database is destroyed.
void OnDatabaseDestroyed(DownloadDBCallback callback, bool success);
// Called when entry is removed.
void OnRemoveDone(bool success);
// Called when all database entries are loaded.
void OnAllEntriesLoaded(
LoadEntriesCallback callback,
bool success,
std::unique_ptr<std::vector<download_pb::DownloadDBEntry>> entries);
// Proto db for storing all the entries.
std::unique_ptr<leveldb_proto::ProtoDatabase<download_pb::DownloadDBEntry>>
db_;
// Whether the object is initialized.
bool is_initialized_ = false;
// Namespace of this db.
DownloadNamespace download_namespace_;
// Number of initialize attempts.
int num_initialize_attempts_ = 0;
base::WeakPtrFactory<DownloadDBImpl> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DownloadDBImpl);
};
} // namespace download
#endif // COMPONENTS_DOWNLOAD_DATABASE_IN_PROGRESS_DOWNLOAD_DB_IMPL_H_
|
/* $OpenBSD: conf.c,v 1.2 1997/09/14 07:02:05 downsj Exp $ */
/* $NetBSD: conf.c,v 1.12 1996/10/14 07:29:15 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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.
*
* @(#)conf.c 8.1 (Berkeley) 6/10/93
*/
#include <sys/param.h>
#include <lib/libsa/stand.h>
#include "samachdep.h"
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netinet/in_systm.h>
#include <lib/libsa/nfs.h>
#include <lib/libsa/cd9660.h>
#include <lib/libsa/ufs.h>
#include "rawfs.h"
int debug = 0; /* XXX */
/*
* Device configuration
*/
int netstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
int netopen __P((struct open_file *, ...));
int netclose __P((struct open_file *));
#define netioctl noioctl
int ctstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
int ctopen __P((struct open_file *, ...));
int ctclose __P((struct open_file *));
#define ctioctl noioctl
int hdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
int hdopen __P((struct open_file *, ...));
int hdclose __P((struct open_file *));
#define hdioctl noioctl
int sdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
int sdopen __P((struct open_file *, ...));
int sdclose __P((struct open_file *));
#define sdioctl noioctl
#define xxstrategy \
(int (*) __P((void *, int, daddr_t, size_t, void *, size_t *)))nullsys
#define xxopen (int (*) __P((struct open_file *, ...)))nodev
#define xxclose (int (*) __P((struct open_file *)))nullsys
/*
* Note: "le" isn't a major offset.
*/
struct devsw devsw[] = {
{ "ct", ctstrategy, ctopen, ctclose, ctioctl }, /*0*/
{ "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
{ "hd", hdstrategy, hdopen, hdclose, hdioctl }, /*2*/
{ "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
{ "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
{ "??", xxstrategy, xxopen, xxclose, noioctl }, /*5*/
{ "le", netstrategy, netopen, netclose, netioctl },/*6*/
};
int ndevs = (sizeof(devsw) / sizeof(devsw[0]));
extern struct netif_driver le_driver;
struct netif_driver *netif_drivers[] = {
&le_driver,
};
int n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
/*
* Physical unit/lun detection.
*/
int punitzero __P((int, int, int *));
int
punitzero(ctlr, slave, punit)
int ctlr, slave, *punit;
{
*punit = 0;
return (0);
}
extern int ctpunit __P((int, int, int *));
#define xxpunit punitzero
#define hdpunit punitzero
#define sdpunit punitzero
#define lepunit punitzero
struct punitsw punitsw[] = {
{ ctpunit },
{ xxpunit },
{ hdpunit },
{ xxpunit },
{ sdpunit },
{ xxpunit },
{ lepunit },
};
int npunit = (sizeof(punitsw) / sizeof(punitsw[0]));
/*
* Filesystem configuration
*/
struct fs_ops file_system_rawfs[] = {
{ rawfs_open, rawfs_close, rawfs_read, rawfs_write, rawfs_seek,
rawfs_stat },
};
struct fs_ops file_system_ufs[] = {
{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
};
struct fs_ops file_system_nfs[] = {
{ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
};
struct fs_ops file_system_cd9660[] = {
{ cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
cd9660_stat },
};
struct fs_ops file_system[2];
int nfsys = 1; /* default; changed per device type. */
/*
* Inititalize controllers
*
* XXX this should be a table
*/
void ctlrinit()
{
leinit();
hpibinit();
scsiinit();
}
|
/**
* \file premake.h
* \brief Program-wide constants and definitions.
* \author Copyright (c) 2002-2015 Jason Perkins and the Premake project
*/
#define lua_c
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#define PREMAKE_VERSION "5.0.0-dev"
#define PREMAKE_COPYRIGHT "Copyright (C) 2002-2017 Jason Perkins and the Premake Project"
#define PREMAKE_PROJECT_URL "https://github.com/premake/premake-core/wiki"
/* Identify the current platform I'm not sure how to reliably detect
* Windows but since it is the most common I use it as the default */
#if defined(__linux__)
#define PLATFORM_LINUX (1)
#define PLATFORM_STRING "linux"
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#define PLATFORM_BSD (1)
#define PLATFORM_STRING "bsd"
#elif defined(__APPLE__) && defined(__MACH__)
#define PLATFORM_MACOSX (1)
#define PLATFORM_STRING "macosx"
#elif defined(__sun__) && defined(__svr4__)
#define PLATFORM_SOLARIS (1)
#define PLATFORM_STRING "solaris"
#elif defined(__HAIKU__)
#define PLATFORM_HAIKU (1)
#define PLATFORM_STRING "haiku"
#elif defined (_AIX)
#define PLATFORM_AIX (1)
#define PLATFORM_STRING "aix"
#elif defined (__GNU__)
#define PLATFORM_HURD (1)
#define PLATFORM_STRING "hurd"
#else
#define PLATFORM_WINDOWS (1)
#define PLATFORM_STRING "windows"
#endif
#define PLATFORM_POSIX (PLATFORM_LINUX || PLATFORM_BSD || PLATFORM_MACOSX || PLATFORM_SOLARIS)
/* Pull in platform-specific headers required by built-in functions */
#if PLATFORM_WINDOWS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
#else
#include <unistd.h>
#endif
/* Fill in any missing bits */
#ifndef PATH_MAX
#define PATH_MAX (4096)
#endif
/* A success return code */
#define OKAY (0)
/* Bitmasks for the different script file search locations */
#define TEST_LOCAL (0x01)
#define TEST_SCRIPTS (0x02)
#define TEST_PATH (0x04)
#define TEST_EMBEDDED (0x08)
/* If a /scripts argument is present, its value */
extern const char* scripts_path;
/* Bootstrapping helper functions */
int do_chdir(lua_State* L, const char* path);
unsigned long do_hash(const char* str, int seed);
void do_getabsolute(char* result, const char* value, const char* relative_to);
int do_getcwd(char* buffer, size_t size);
int do_isabsolute(const char* path);
int do_isfile(lua_State* L, const char* filename);
int do_locate(lua_State* L, const char* filename, const char* path);
void do_normalize(lua_State* L, char* buffer, const char* path);
int do_pathsearch(lua_State* L, const char* filename, const char* path);
void do_translate(char* value, const char sep);
/* Built-in functions */
int criteria_compile(lua_State* L);
int criteria_delete(lua_State* L);
int criteria_matches(lua_State* L);
int debug_prompt(lua_State* L);
int path_getabsolute(lua_State* L);
int path_getrelative(lua_State* L);
int path_isabsolute(lua_State* L);
int path_join(lua_State* L);
int path_normalize(lua_State* L);
int path_translate(lua_State* L);
int path_wildcards(lua_State* L);
int os_chdir(lua_State* L);
int os_chmod(lua_State* L);
int os_copyfile(lua_State* L);
int os_getcwd(lua_State* L);
int os_getpass(lua_State* L);
int os_getWindowsRegistry(lua_State* L);
int os_getversion(lua_State* L);
int os_host(lua_State* L);
int os_is64bit(lua_State* L);
int os_isdir(lua_State* L);
int os_isfile(lua_State* L);
int os_islink(lua_State* L);
int os_locate(lua_State* L);
int os_matchdone(lua_State* L);
int os_matchisfile(lua_State* L);
int os_matchname(lua_State* L);
int os_matchnext(lua_State* L);
int os_matchstart(lua_State* L);
int os_mkdir(lua_State* L);
int os_pathsearch(lua_State* L);
int os_realpath(lua_State* L);
int os_rmdir(lua_State* L);
int os_stat(lua_State* L);
int os_uuid(lua_State* L);
int os_writefile_ifnotequal(lua_State* L);
int os_compile(lua_State* L);
int string_endswith(lua_State* L);
int string_hash(lua_State* L);
int string_sha1(lua_State* L);
int string_startswith(lua_State* L);
int buffered_new(lua_State* L);
int buffered_write(lua_State* L);
int buffered_writeln(lua_State* L);
int buffered_close(lua_State* L);
int buffered_tostring(lua_State* L);
int term_getTextColor(lua_State* L);
int term_setTextColor(lua_State* L);
#ifdef PREMAKE_CURL
int http_get(lua_State* L);
int http_post(lua_State* L);
int http_download(lua_State* L);
#endif
#ifdef PREMAKE_COMPRESSION
int zip_extract(lua_State* L);
#endif
#ifdef _MSC_VER
#ifndef snprintf
#define snprintf _snprintf
#endif
#endif
/* Engine interface */
typedef struct
{
const char* name;
const unsigned char* bytecode;
size_t length;
} buildin_mapping;
extern const buildin_mapping builtin_scripts[];
int premake_init(lua_State* L);
int premake_execute(lua_State* L, int argc, const char** argv, const char* script);
int premake_load_embedded_script(lua_State* L, const char* filename);
const buildin_mapping* premake_find_embedded_script(const char* filename);
int premake_locate_executable(lua_State* L, const char* argv0);
int premake_test_file(lua_State* L, const char* filename, int searchMask);
|
#ifndef _PLUGIN_REGISTRATION_H_INCLUDED_
#define _PLUGIN_REGISTRATION_H_INCLUDED_
#include "OPS_Core/Plugins/IPlugin.h"
#include <string>
typedef OPS::Core::IPlugin& (*PluginInstanceFunction)();
void registerStaticPluginInstanceFunction(const std::string& pluginName,
PluginInstanceFunction pluginInstanceFunction);
#define EXPORT_STATIC_PLUGIN2(pluginName, PluginClass) \
OPS::Core::IPlugin& pluginInstanceFunction##pluginName() \
{ \
static PluginClass s_instance; \
return s_instance; \
}
#define IMPORT_STATIC_PLUGIN(pluginName) \
OPS::Core::IPlugin& pluginInstanceFunction##pluginName(); \
\
class Static##pluginName##PluginInitializer \
{ \
public: \
\
Static##pluginName##PluginInitializer() \
{ \
registerStaticPluginInstanceFunction(#pluginName, \
pluginInstanceFunction##pluginName); \
} \
}; \
\
static Static##pluginName##PluginInitializer s_static##pluginName##PluginInitializer;
#endif // _PLUGIN_REGISTRATION_H_INCLUDED_
|
/*
* Copyright (C) 2013 Motorola Mobility LLC. All rights reserved.
*
* 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 APPLE AND ITS 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 APPLE OR ITS 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.
*/
#ifndef OESTextureHalfFloat_h
#define OESTextureHalfFloat_h
#include "WebGLExtension.h"
#include <wtf/PassOwnPtr.h>
namespace WebCore {
class OESTextureHalfFloat : public WebGLExtension {
public:
static OwnPtr<OESTextureHalfFloat> create(WebGLRenderingContext*);
virtual ~OESTextureHalfFloat();
virtual ExtensionName getName() const;
private:
OESTextureHalfFloat(WebGLRenderingContext*);
};
} // namespace WebCore
#endif // OESTextureHalfFloat_h
|
/******************************************************************************
**
** Copyright (C) 2009-2011 Kyle Lutz <kyle.r.lutz@gmail.com>
** All rights reserved.
**
** This file is a part of the chemkit project. For more information
** see <http://www.chemkit.org>.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the chemkit project nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
******************************************************************************/
#ifndef QUATERNIONTEST_H
#define QUATERNIONTEST_H
#include <QtTest>
class QuaternionTest : public QObject
{
Q_OBJECT
private slots:
void basic();
void multiply();
void conjugate();
};
#endif // QUATERNIONTEST_H
|
// Copyright (c) 2012 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 DEVICE_GAMEPAD_GAMEPAD_MONITOR_H_
#define DEVICE_GAMEPAD_GAMEPAD_MONITOR_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "device/gamepad/gamepad_consumer.h"
#include "device/gamepad/gamepad_export.h"
#include "device/gamepad/public/mojom/gamepad.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace device {
class DEVICE_GAMEPAD_EXPORT GamepadMonitor : public GamepadConsumer,
public mojom::GamepadMonitor {
public:
GamepadMonitor();
~GamepadMonitor() override;
static void Create(mojo::PendingReceiver<mojom::GamepadMonitor> receiver);
// GamepadConsumer implementation.
void OnGamepadConnected(uint32_t index, const Gamepad& gamepad) override;
void OnGamepadDisconnected(uint32_t index, const Gamepad& gamepad) override;
void OnGamepadButtonOrAxisChanged(uint32_t index,
const Gamepad& gamepad) override;
// mojom::GamepadMonitor implementation.
void GamepadStartPolling(GamepadStartPollingCallback callback) override;
void GamepadStopPolling(GamepadStopPollingCallback callback) override;
void SetObserver(
mojo::PendingRemote<mojom::GamepadObserver> gamepad_observer) override;
private:
mojo::Remote<mojom::GamepadObserver> gamepad_observer_remote_;
// True if this monitor is an active gamepad consumer.
bool is_started_ = false;
// True if this monitor has been registered with the gamepad service.
bool is_registered_consumer_ = false;
DISALLOW_COPY_AND_ASSIGN(GamepadMonitor);
};
} // namespace device
#endif // DEVICE_GAMEPAD_GAMEPAD_MONITOR_H_
|
/*-
* Copyright (c) 1998 Doug Rabson <dfr@freebsd.org>
* All rights reserved.
*
* 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 THE 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 THE 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: releng/9.3/sys/boot/common/dev_net.h 50477 1999-08-28 01:08:13Z peter $
*/
extern struct devsw netdev;
|
// Copyright (c) 2012 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 UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
#define UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "ui/gfx/insets.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/window/non_client_view.h"
namespace views {
class Label;
class LabelButton;
class BubbleBorder;
// The non-client frame view of bubble-styled widgets.
class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView,
public ButtonListener {
public:
explicit BubbleFrameView(const gfx::Insets& content_margins);
virtual ~BubbleFrameView();
// NonClientFrameView overrides:
virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
virtual gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const OVERRIDE;
virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
virtual void GetWindowMask(const gfx::Size& size,
gfx::Path* window_mask) OVERRIDE;
virtual void ResetWindowControls() OVERRIDE;
virtual void UpdateWindowIcon() OVERRIDE;
virtual void UpdateWindowTitle() OVERRIDE;
// View overrides:
virtual gfx::Insets GetInsets() const OVERRIDE;
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void Layout() OVERRIDE;
virtual std::string GetClassName() const OVERRIDE;
// Overridden from ButtonListener:
virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE;
// Use bubble_border() and SetBubbleBorder(), not border() and set_border().
BubbleBorder* bubble_border() const { return bubble_border_; }
void SetBubbleBorder(BubbleBorder* border);
gfx::Insets content_margins() const { return content_margins_; }
void SetTitle(const string16& title);
void SetShowCloseButton(bool show);
void set_can_drag(bool can_drag) { can_drag_ = can_drag; }
// Given the size of the contents and the rect to point at, returns the bounds
// of the bubble window. The bubble's arrow location may change if the bubble
// does not fit on the monitor and |adjust_if_offscreen| is true.
gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect,
gfx::Size client_size,
bool adjust_if_offscreen);
protected:
// Returns the bounds for the monitor showing the specified |rect|.
// This function is virtual to support testing environments.
virtual gfx::Rect GetMonitorBounds(const gfx::Rect& rect);
private:
FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView);
// Mirrors the bubble's arrow location on the |vertical| or horizontal axis,
// if the generated window bounds don't fit in the monitor bounds.
void MirrorArrowIfOffScreen(bool vertical,
const gfx::Rect& anchor_rect,
const gfx::Size& client_size);
// Adjust the bubble's arrow offsets if the generated window bounds don't fit
// in the monitor bounds.
void OffsetArrowIfOffScreen(const gfx::Rect& anchor_rect,
const gfx::Size& client_size);
// The bubble border.
BubbleBorder* bubble_border_;
// Margins between the content and the inside of the border, in pixels.
gfx::Insets content_margins_;
// The optional title and (x) close button.
Label* title_;
LabelButton* close_;
// A flag controlling the ability to drag this frame.
bool can_drag_;
DISALLOW_COPY_AND_ASSIGN(BubbleFrameView);
};
} // namespace views
#endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
|
// Copyright (c) 2011 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 CHROME_BROWSER_PROFILES_PROFILE_INFO_INTERFACE_H_
#define CHROME_BROWSER_PROFILES_PROFILE_INFO_INTERFACE_H_
#include "base/files/file_path.h"
#include "base/strings/string16.h"
namespace gfx {
class Image;
}
// This abstract interface is used to query the profiles backend for information
// about the different profiles. Its sole concrete implementation is the
// ProfileInfoCache. This interface exists largely to assist in testing.
class ProfileInfoInterface {
public:
virtual size_t GetNumberOfProfiles() const = 0;
virtual size_t GetIndexOfProfileWithPath(
const base::FilePath& profile_path) const = 0;
virtual string16 GetNameOfProfileAtIndex(size_t index) const = 0;
virtual string16 GetShortcutNameOfProfileAtIndex(size_t index) const = 0;
virtual base::FilePath GetPathOfProfileAtIndex(size_t index) const = 0;
virtual string16 GetUserNameOfProfileAtIndex(size_t index) const = 0;
virtual const gfx::Image& GetAvatarIconOfProfileAtIndex(
size_t index) const = 0;
// Returns true if the profile at the given index is currently running any
// background apps.
virtual bool GetBackgroundStatusOfProfileAtIndex(
size_t index) const = 0;
virtual string16 GetGAIANameOfProfileAtIndex(size_t index) const = 0;
virtual string16 GetGAIAGivenNameOfProfileAtIndex(size_t index) const = 0;
// Checks if the GAIA name should be used as the profile's name.
virtual bool IsUsingGAIANameOfProfileAtIndex(size_t index) const = 0;
virtual const gfx::Image* GetGAIAPictureOfProfileAtIndex(
size_t index) const = 0;
// Checks if the GAIA picture should be used as the profile's avatar icon.
virtual bool IsUsingGAIAPictureOfProfileAtIndex(size_t index) const = 0;
virtual bool ProfileIsManagedAtIndex(size_t index) const = 0;
virtual std::string GetManagedUserIdOfProfileAtIndex(size_t index) const = 0;
// This profile is associated with an account but has been signed-out.
virtual bool ProfileIsSigninRequiredAtIndex(size_t index) const = 0;
// Profile is known to be ephemeral and should be deleted when closed.
virtual bool ProfileIsEphemeralAtIndex(size_t index) const = 0;
protected:
virtual ~ProfileInfoInterface() {}
};
#endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_INTERFACE_H_
|
//
// ViewController.h
// Blomaga
//
// Created by mtgto on 1/26/13.
// Copyright (c) 2013 mtgto. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ShowURLDelegate.h"
@interface ViewController : UIViewController<UIWebViewDelegate, ShowURLDelegate>
@property (weak, nonatomic) IBOutlet UIWebView *webView;
- (IBAction)pushHome:(id)sender;
@end
|
/*
Project : Wolf Engine. Copyright(c) Pooya Eimandar (http://PooyaEimandar.com) . All rights reserved.
Source : Please direct any bug to https://github.com/PooyaEimandar/Wolf.Engine/issues
Website : http://WolfSource.io
Name : scene.h
Description : The media player of Wolf.Engine, the media sample is "Snow Monkeys in Japan 5K Retina 60p (Ultra HD) - YouTube (https://youtu.be/nRt4Duf7GoI)"
Comment : Read more information about this sample on http://wolfsource.io/gpunotes/
*/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef __SCENE_H__
#define __SCENE_H__
#include <w_framework/w_game.h>
#include <w_graphics/w_command_buffers.h>
#include <w_graphics/w_render_pass.h>
#include <w_graphics/w_semaphore.h>
#include <w_graphics/w_shader.h>
#include <w_graphics/w_pipeline.h>
#include <w_graphics/w_mesh.h>
#include <w_graphics/w_texture.h>
//++++++++++++++++++++++++++++++++++++++++++++++++++++
//The following codes have been added for this project
//++++++++++++++++++++++++++++++++++++++++++++++++++++
#include <w_media_core.h>
#include <w_memory_pool.h>
#include <tbb/atomic.h>
#include <tbb/critical_section.h>
#include <tbb/compat/condition_variable>
//++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++
class scene : public wolf::framework::w_game
{
public:
scene(_In_z_ const std::wstring& pContentPath, _In_ const wolf::system::w_logger_config& pLogConfig);
virtual ~scene();
/*
Allows the game to perform any initialization and it needs to before starting to run.
Calling Game::Initialize() will enumerate through any components and initialize them as well.
The parameter pOutputWindowsInfo represents the information of output window(s) of this game.
*/
void initialize(_In_ std::map<int, w_present_info> pOutputWindowsInfo) override;
//The function "Load()" will be called once per game and is the place to load all of your game assets.
void load() override;
//This is the place where allows the game to run logic such as updating the world, checking camera, collisions, physics, input, playing audio and etc.
void update(_In_ const wolf::system::w_game_time& pGameTime) override;
//This is called when the game should draw itself.
W_RESULT render(_In_ const wolf::system::w_game_time& pGameTime) override;
//This is called when the window game should resized.
void on_window_resized(_In_ const uint32_t& pGraphicsDeviceIndex, _In_ const w_point& pNewSizeOfWindow) override;
//This is called when the we lost graphics device.
void on_device_lost() override;
//Release will be called once per game and is the place to unload assets and release all resources
ULONG release() override;
private:
W_RESULT _build_draw_command_buffers();
void _run_video_buffering_thread();
void _buffer_video(_In_ const size_t& pNumberOfFrames);
wolf::graphics::w_viewport _viewport;
wolf::graphics::w_viewport_scissor _viewport_scissor;
wolf::graphics::w_command_buffers _draw_command_buffers;
wolf::graphics::w_render_pass _draw_render_pass;
wolf::graphics::w_fences _draw_fence;
wolf::graphics::w_semaphore _draw_semaphore;
wolf::graphics::w_shader _shader;
wolf::graphics::w_pipeline _pipeline;
wolf::graphics::w_mesh _mesh;
wolf::graphics::w_texture _texture;
//++++++++++++++++++++++++++++++++++++++++++++++++++++
//The following codes have been added for this project
//++++++++++++++++++++++++++++++++++++++++++++++++++++
size_t _max_buffering_frames;
wolf::framework::w_media_core _media_core;
wolf::system::w_game_time _media_time;
wolf::system::w_memory_pool _media_memory;
tbb::mutex _media_buffer_mutex;
tbb::interface5::condition_variable _media_signal_slot;
tbb::mutex _media_thread_exit_mutex;
tbb::interface5::condition_variable _media_thread_exited;
//++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++
};
#endif
|
//
// SRCustomSwitch.h
// CustomUISwitch
//
// Created by 郭伟林 on 2017/6/28.
// Copyright © 2017年 SR. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SRCustomSwitch : UIView
@property (nonatomic, strong) UIColor *onDotColor;
@property (nonatomic, strong) UIColor *onBarColor;
@property (nonatomic, strong) UIColor *offDotColor;
@property (nonatomic, strong) UIColor *offBarColor;
@property (nonatomic, strong) UIColor *tintColor;
@property (nonatomic, readonly, getter=isOn) BOOL on;
@property (nonatomic, copy) void (^statusChanged)(BOOL isOn);
- (void)switchStatus:(BOOL)isOn animated:(BOOL)flag;
@end
|
#pragma once
#include "game/Window.h"
#include "game/Cursor.h"
#include "game/gui/GuiWindowButton.h"
class GuiComponent;
class GameWindow;
class MainMenuWindow : public Window {
public:
// Ctor and dtor ///////////////////////////////////////////////////////////
// Ctor for a MainMenuWindow
// playWindow - Window of the playing game
// size - Size to make the window
MainMenuWindow(GameWindow* playWindow, Vector2 size = Vector2(0.0f, 0.0f));
// MainMenuWindow dtor
~MainMenuWindow();
// Methods /////////////////////////////////////////////////////////////////
// Update the MainMenuWindow
// diff - Microseconds to update for
virtual void update(int diff);
// Render to a window
// window- sf::RenderWindow to render to
virtual void render(sf::RenderWindow& window);
protected:
// Vars ////////////////////////////////////////////////////////////////////
GuiComponent* _toolbar;
Cursor _cursor;
};
|
/* For use in comm programs written in Lattice C; allows calling XProtocol
library functions directly without glue routines. */
long XProtocolCleanup(struct XPR_IO *);
long XProtocolSetup(struct XPR_IO *);
long XProtocolSend(struct XPR_IO *);
long XProtocolReceive(struct XPR_IO *);
#ifdef __GNUC__
# include "inline/xpr.h"
#else
#pragma libcall XProtocolBase XProtocolCleanup 1e 801
#pragma libcall XProtocolBase XProtocolSetup 24 801
#pragma libcall XProtocolBase XProtocolSend 2a 801
#pragma libcall XProtocolBase XProtocolReceive 30 801
#pragma libcall XProtocolBase XProtocolHostMon 36 109804
#pragma libcall XProtocolBase XProtocolUserMon 3c 109804
#endif
|
extern std::wstring g_datapath;
|
// RUN: %ucc -DS_OR_U=struct %s; [ $? -ne 0 ]
// RUN: %ucc -DS_OR_U=union %s -o %t
// RUN: %t; [ $? -eq 1 ]
union f;
#define DECAY(x) (0, x)
main()
{
return _Generic(
DECAY(*(__typeof((*(struct A { int (*i)(union f); } *)0).i))0)
, char: 5, int (*)(S_OR_U f): 1);
}
|
#ifndef COMMON_VECTOR_TYPES
#define COMMON_VECTOR_TYPES
#include "VM/types.h"
#include "templates/tvec2d.h"
#include "templates/tvec3d.h"
#include "templates/tvec4d.h"
namespace anl
{
//typedef rhs4D<float> SRGBA;
struct SRGBA
{
SRGBA() : r(0), g(0), b(0), a(0){}
SRGBA(int al) : r(a), g(a), b(a), a(al) {}
SRGBA(const SRGBA &rhs) : r(rhs.r), g(rhs.g), b(rhs.b), a(rhs.a){}
SRGBA(const float t1, const float t2, const float t3, const float t4) : r(t1), g(t2), b(t3), a(t4){}
~SRGBA(){}
bool operator ==(const SRGBA &rhs) const
{
if(r==rhs.r && g==rhs.g && b==rhs.b && a==rhs.a) return true;
return false;
};
bool operator !=(const SRGBA &rhs) const
{
if(r==rhs.r && g==rhs.g && b==rhs.b && a==rhs.a) return false;
return true;
};
SRGBA operator +(const SRGBA &rhs) const
{
return SRGBA(r+rhs.r, g+rhs.g, b+rhs.b, a+rhs.a);
};
SRGBA operator -(const SRGBA &rhs) const
{
return SRGBA(r-rhs.r, g-rhs.g, b-rhs.b, a-rhs.a);
};
SRGBA operator *(const SRGBA &rhs) const
{
return SRGBA(r*rhs.r, g*rhs.g, b*rhs.b, a*rhs.a);
};
SRGBA operator *(const double &rhs) const
{
return SRGBA(r*rhs, g*rhs, b*rhs, a*rhs);
}
SRGBA operator /(const SRGBA &rhs) const
{
return SRGBA(r/rhs.r, g/rhs.g, b/rhs.b, a/rhs.a);
};
SRGBA operator /(const double &rhs) const
{
return SRGBA(r/rhs, g/rhs, b/rhs, a/rhs);
}
SRGBA operator -() const
{
return SRGBA(-r, -g, -b, -a);
};
SRGBA &operator +=(const SRGBA &rhs)
{
r += rhs.r;
g += rhs.g;
b += rhs.b;
a += rhs.a;
return (*this);
};
SRGBA &operator -=(const SRGBA &rhs)
{
r -= rhs.r;
g -= rhs.g;
b -= rhs.b;
a -= rhs.a;
return (*this);
};
SRGBA &operator *=(const SRGBA &rhs)
{
r *= rhs.r;
g *= rhs.g;
b *= rhs.b;
a *= rhs.a;
return (*this);
};
SRGBA &operator /=(const SRGBA &rhs)
{
r /= rhs.r;
g /= rhs.g;
b /= rhs.b;
a /= rhs.a;
return (*this);
};
SRGBA operator +(const float &val) const
{
return SRGBA(r+val, g+val, b+val, a+val);
};
SRGBA operator -(const float &val) const
{
return SRGBA(r-val, g-val, b-val, a-val);
};
SRGBA operator *(const float &val) const
{
return SRGBA(r*val, g*val, b*val, a*val);
};
SRGBA operator /(const float &val) const
{
return SRGBA(r/val, g/val, b/val, a/val);
};
SRGBA &operator +=(const float &val)
{
r+=val;
g+=val;
b+=val;
a+=val;
return (*this);
};
SRGBA &operator -=(const float &val)
{
r-=val;
g-=val;
b-=val;
a-=val;
return (*this);
};
SRGBA &operator *=(const float &val)
{
r*=val;
g*=val;
b*=val;
a*=val;
return (*this);
}
SRGBA &operator /=(const float &val)
{
r/=val;
g/=val;
b/=val;
a/=val;
return (*this);
};
float r;
float g;
float b;
float a;
};
typedef TVec2D<float> CVec2f;
typedef TVec2D<double> CVec2d;
typedef TVec3D<float> CVec3f;
typedef TVec3D<double> CVec3d;
typedef TVec4D<float> CVec4f;
typedef TVec4D<double> CVec4d;
typedef TVec2D<int> CVec2i;
typedef TVec3D<int> CVec3i;
typedef TVec4D<int> CVec4i;
typedef TVec2D<unsigned int> CVec2ui;
typedef TVec3D<unsigned int> CVec3ui;
typedef TVec4D<unsigned int> CVec4ui;
};
#endif
|
/*
Text Designer Outline Text Library
Copyright (c) 2009 Wong Shao Voon
The Code Project Open License (CPOL)
http://www.codeproject.com/info/cpol10.aspx
*/
#ifndef _TEXTGRADOUTLINESTRATEGY_H_
#define _TEXTGRADOUTLINESTRATEGY_H_
#include <Gdiplus.h>
#include <vector>
#include "TextImplGetHeight.h"
namespace TextDesigner
{
class TextGradOutlineStrategy : public TextImplGetHeight
{
public:
//! default constructor
TextGradOutlineStrategy(void);
//! destructor
virtual ~TextGradOutlineStrategy(void);
ITextStrategy* Clone();
/** Initialize the strategy
@param[in] clrText is the text color
@param[in] clrOutline1 is the inner outline color
@param[in] clrOutline2 is the outer outline color
@param[in] nThickness1 is the inner outline thickness
@param[in] nThickness2 is the outer outline thickness
*/
void Init(
Gdiplus::Color clrText,
Gdiplus::Color clrOutline1,
Gdiplus::Color clrOutline2,
int nThickness);
/** Initialize the strategy
@param[in] pbrushText is the text brush(Must cleaned up by caller)
@param[in] clrOutline1 is the inner outline color
@param[in] clrOutline2 is the outer outline color
@param[in] nThickness1 is the inner outline thickness
@param[in] nThickness2 is the outer outline thickness
*/
void Init(
Gdiplus::Brush* pbrushText,
Gdiplus::Color clrOutline1,
Gdiplus::Color clrOutline2,
int nThickness);
/** Draw String, using a point as the starting point
@param[in] pGraphics is the graphics context
@param[in] pFontFamily is font family which is used(Collection of similar fonts)
@param[in] fontStyle like Bold, Italic or Regular should be specified.
@param[in] nfontSize is font size
@param[in] pszText is the text which is displayed.
@param[in] ptDraw is the staring point to draw
@param[in] pStrFormat is the string format to be specified(can be left at default)
@return true for success
*/
bool DrawString(
Gdiplus::Graphics* pGraphics,
Gdiplus::FontFamily* pFontFamily,
Gdiplus::FontStyle fontStyle,
int nfontSize,
const wchar_t*pszText,
Gdiplus::Point ptDraw,
Gdiplus::StringFormat* pStrFormat);
/** Draw String, using a rectangle
@param[in] pGraphics is the graphics context
@param[in] pFontFamily is font family which is used(Collection of similar fonts)
@param[in] fontStyle like Bold, Italic or Regular should be specified.
@param[in] nfontSize is font size
@param[in] pszText is the text which is displayed.
@param[in] rtDraw is the rectangle where the whole drawing will be centralized
@param[in] pStrFormat is the string format to be specified(can be left at default)
@return true for success
*/
bool DrawString(
Gdiplus::Graphics* pGraphics,
Gdiplus::FontFamily* pFontFamily,
Gdiplus::FontStyle fontStyle,
int nfontSize,
const wchar_t*pszText,
Gdiplus::Rect rtDraw,
Gdiplus::StringFormat* pStrFormat);
/** Draw String using a starting point. Using GDI paths, instead of GDI+ paths
@param[in] pGraphics is the graphics context
@param[in] pLogFont is the LOGFONT from which the font will be created.
@param[in] pszText is the text which is displayed.
@param[in] ptDraw is the staring point to draw
@return true for success
*/
bool GdiDrawString(
Gdiplus::Graphics* pGraphics,
LOGFONTW* pLogFont,
const wchar_t*pszText,
Gdiplus::Point ptDraw);
/** Draw String using a rectangle. Using GDI paths, instead of GDI+ paths
@param[in] pGraphics is the graphics context
@param[in] pLogFont is the LOGFONT from which the font will be created.
@param[in] pszText is the text which is displayed.
@param[in] rtDraw is the rectangle where the whole drawing will be centralized
@return true for success
*/
bool GdiDrawString(
Gdiplus::Graphics* pGraphics,
LOGFONTW* pLogFont,
const wchar_t*pszText,
Gdiplus::Rect rtDraw);
private:
void CalculateGradient(
Gdiplus::Color clr1,
Gdiplus::Color clr2,
int nThickness,
std::vector<Gdiplus::Color>& vec);
protected:
//! m_clrText is the text color
Gdiplus::Color m_clrText;
//! m_clrOutline1 is the inner outline color
Gdiplus::Color m_clrOutline1;
//! m_clrOutline2 is the outer outline color
Gdiplus::Color m_clrOutline2;
//! Text Brush
Gdiplus::Brush* m_pbrushText;
//! Using color or brush for text
bool m_bClrText;
};
} // namespace TextDesigner
#endif // _TEXTGRADOUTLINESTRATEGY_H_
|
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by XMLSign.rc
//
#define IDS_PROJNAME 100
#define IDR_SIGNATURE 101
#define IDC_SIGOK 101
#define IDR_CERTIFICATE 102
#define IDS_SIGNEW 102
#define IDD_SHOWSELECTCERT 103
#define IDS_SERIALNO 103
#define IDS_EXPDATE 104
#define IDS_ISSUEDBY 105
#define IDS_ISSUEDTO 106
#define IDS_MSGINSTALL 107
#define IDS_STRING108 108
#define IDS_MSGNOCERT 108
#define IDS_CAPTION 109
#define IDI_ICON1 201
#define IDC_LIST1 201
#define IDC_LIST2 202
#define IDC_BUTTON1 203
#define IDI_ICON2 204
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 210
#define _APS_NEXT_COMMAND_VALUE 500
#define _APS_NEXT_CONTROL_VALUE 204
#define _APS_NEXT_SYMED_VALUE 104
#endif
#endif
|
/* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern float strtof(char const *str , char const *endptr ) ;
extern void signal(int sig , void *func ) ;
typedef struct _IO_FILE FILE;
extern int atoi(char const *s ) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int strcmp(char const *a , char const *b ) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
void RandomFunc(unsigned int input[1] , unsigned int output[1] ) ;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const *format , ...) ;
int main(int argc , char *argv[] ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern void *malloc(unsigned long size ) ;
extern int scanf(char const *format , ...) ;
int main(int argc , char *argv[] )
{
unsigned int input[1] ;
unsigned int output[1] ;
int randomFuns_i5 ;
unsigned int randomFuns_value6 ;
int randomFuns_main_i7 ;
{
megaInit();
if (argc != 2) {
printf("Call this program with %i arguments\n", 1);
exit(-1);
} else {
}
randomFuns_i5 = 0;
while (randomFuns_i5 < 1) {
randomFuns_value6 = (unsigned int )strtoul(argv[randomFuns_i5 + 1], 0, 10);
input[randomFuns_i5] = randomFuns_value6;
randomFuns_i5 ++;
}
RandomFunc(input, output);
if (output[0] == 2010370709U) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%u\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
void RandomFunc(unsigned int input[1] , unsigned int output[1] )
{
unsigned int state[1] ;
unsigned int local1 ;
unsigned short copy11 ;
unsigned short copy12 ;
{
state[0UL] = input[0UL] + 4284877637U;
local1 = 0UL;
while (local1 < 0U) {
if (state[0UL] > local1) {
if (state[0UL] > local1) {
copy11 = *((unsigned short *)(& state[local1]) + 1);
*((unsigned short *)(& state[local1]) + 1) = *((unsigned short *)(& state[local1]) + 0);
*((unsigned short *)(& state[local1]) + 0) = copy11;
copy11 = *((unsigned short *)(& state[local1]) + 0);
*((unsigned short *)(& state[local1]) + 0) = *((unsigned short *)(& state[local1]) + 1);
*((unsigned short *)(& state[local1]) + 1) = copy11;
} else {
state[0UL] += state[0UL];
}
} else {
copy12 = *((unsigned short *)(& state[0UL]) + 0);
*((unsigned short *)(& state[0UL]) + 0) = *((unsigned short *)(& state[0UL]) + 1);
*((unsigned short *)(& state[0UL]) + 1) = copy12;
copy12 = *((unsigned short *)(& state[0UL]) + 1);
*((unsigned short *)(& state[0UL]) + 1) = *((unsigned short *)(& state[0UL]) + 0);
*((unsigned short *)(& state[0UL]) + 0) = copy12;
}
local1 += 2UL;
}
output[0UL] = (state[0UL] + 1039116836UL) + 981331187U;
}
}
void megaInit(void)
{
{
}
}
|
int test ();
|
#pragma once
#include "DataFrame.h"
#include "Mess.h"
/*
完成下面数据模型的实现:
1.数据库表的实现
2.数据条目的实现
*/
/*****************数据库表************/
/*
为了数据库文件的实现方便,需要添加一个隐藏列_ROW_STATE_TAG_来表示某行是否被删除
*/
class Table : public DataFrame {
Table(); //所有表都默认有一个_ROW_STATE_TAG_列来标记某行是否被删除
Bytes toBytes();
};
/***************数据条目(记录)**************/
class Entry : public DataRow {
Bytes toBytes();
};
|
/*-------------------------------------------------------------------------
*
* getaddrinfo.h
* Support getaddrinfo() on platforms that don't have it.
*
* Note: we use our own routines on platforms that don't HAVE_STRUCT_ADDRINFO,
* whether or not the library routine getaddrinfo() can be found. This
* policy is needed because on some platforms a manually installed libbind.a
* may provide getaddrinfo(), yet the system headers may not provide the
* struct definitions needed to call it. To avoid conflict with the libbind
* definition in such cases, we rename our routines to pg_xxx() via macros.
*
* This code will also work on platforms where struct addrinfo is defined
* in the system headers but no getaddrinfo() can be located.
*
* Copyright (c) 2003-2008, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.25 2008/01/01 19:45:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef GETADDRINFO_H
#define GETADDRINFO_H
#include <sys/socket.h>
#include <netdb.h>
/* Various macros that ought to be in <netdb.h>, but might not be */
#ifndef EAI_FAIL
#ifndef WIN32
#define EAI_BADFLAGS (-1)
#define EAI_NONAME (-2)
#define EAI_AGAIN (-3)
#define EAI_FAIL (-4)
#define EAI_FAMILY (-6)
#define EAI_SOCKTYPE (-7)
#define EAI_SERVICE (-8)
#define EAI_MEMORY (-10)
#define EAI_SYSTEM (-11)
#else /* WIN32 */
#ifdef WIN32_ONLY_COMPILER
#ifndef WSA_NOT_ENOUGH_MEMORY
#define WSA_NOT_ENOUGH_MEMORY (WSAENOBUFS)
#endif
#ifndef __BORLANDC__
#define WSATYPE_NOT_FOUND (WSABASEERR+109)
#endif
#endif
#define EAI_AGAIN WSATRY_AGAIN
#define EAI_BADFLAGS WSAEINVAL
#define EAI_FAIL WSANO_RECOVERY
#define EAI_FAMILY WSAEAFNOSUPPORT
#define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
#define EAI_NODATA WSANO_DATA
#define EAI_NONAME WSAHOST_NOT_FOUND
#define EAI_SERVICE WSATYPE_NOT_FOUND
#define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
#endif /* !WIN32 */
#endif /* !EAI_FAIL */
#ifndef AI_PASSIVE
#define AI_PASSIVE 0x0001
#endif
#ifndef AI_NUMERICHOST
/*
* some platforms don't support AI_NUMERICHOST; define as zero if using
* the system version of getaddrinfo...
*/
#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO)
#define AI_NUMERICHOST 0
#else
#define AI_NUMERICHOST 0x0004
#endif
#endif
#ifndef NI_NUMERICHOST
#define NI_NUMERICHOST 1
#endif
#ifndef NI_NUMERICSERV
#define NI_NUMERICSERV 2
#endif
#ifndef NI_MAXHOST
#define NI_MAXHOST 1025
#endif
#ifndef NI_MAXSERV
#define NI_MAXSERV 32
#endif
#ifndef HAVE_STRUCT_ADDRINFO
#ifndef WIN32
struct addrinfo
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
struct sockaddr *ai_addr;
char *ai_canonname;
struct addrinfo *ai_next;
};
#else
/*
* The order of the structure elements on Win32 doesn't match the
* order specified in the standard, but we have to match it for
* IPv6 to work.
*/
struct addrinfo
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
#endif
#endif /* HAVE_STRUCT_ADDRINFO */
#ifndef HAVE_GETADDRINFO
/* Rename private copies per comments above */
#ifdef getaddrinfo
#undef getaddrinfo
#endif
#define getaddrinfo pg_getaddrinfo
#ifdef freeaddrinfo
#undef freeaddrinfo
#endif
#define freeaddrinfo pg_freeaddrinfo
#ifdef gai_strerror
#undef gai_strerror
#endif
#define gai_strerror pg_gai_strerror
#ifdef getnameinfo
#undef getnameinfo
#endif
#define getnameinfo pg_getnameinfo
extern int getaddrinfo(const char *node, const char *service,
const struct addrinfo * hints, struct addrinfo ** res);
extern void freeaddrinfo(struct addrinfo * res);
extern const char *gai_strerror(int errcode);
extern int getnameinfo(const struct sockaddr * sa, int salen,
char *node, int nodelen,
char *service, int servicelen, int flags);
#endif /* HAVE_GETADDRINFO */
#endif /* GETADDRINFO_H */
|
/**
******************************************************************************
* @file IWDG/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.0.0
* @date 19-September-2011
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_it.h"
#include "stm32f4_discovery.h"
/** @addtogroup STM32F4xx_StdPeriph_Examples
* @{
*/
/** @addtogroup IWDG_Example
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
extern __IO uint32_t TimingDelay;
extern __IO uint32_t PeriodValue;
extern __IO uint32_t CaptureNumber;
uint16_t tmpCC4[2] = {0, 0},var1 = 0;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
/* Cortex-M4 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
STM_EVAL_LEDOn(LED5);
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Memory Manage exception.
* @param None
* @retval None
*/
void MemManage_Handler(void)
{
/* Go to infinite loop when Memory Manage exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval None
*/
void BusFault_Handler(void)
{
/* Go to infinite loop when Bus Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval None
*/
void UsageFault_Handler(void)
{
/* Go to infinite loop when Usage Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
void SVC_Handler(void)
{
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
void PendSV_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
TimingDelay--;
}
/******************************************************************************/
/* STM32F4xx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32f4xx.s). */
/******************************************************************************/
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval None
*/
/*void PPP_IRQHandler(void)
{
}*/
/**
* @brief This function handles External line O interrupt request.
* @param None
* @retval None
*/
void EXTI0_IRQHandler(void)
{
if (EXTI_GetITStatus(USER_BUTTON_EXTI_LINE) != RESET)
{
/* Clear the Key Button EXTI Line Pending Bit */
EXTI_ClearITPendingBit(USER_BUTTON_EXTI_LINE);
/* As the following address is invalid (not mapped), a Hardfault exception
will be generated with an infinite loop and when the IWDG counter reaches 0
the IWDG reset occurs */
*(__IO uint32_t *) 0xA0001000 = 0xFF;
}
}
/**
* @brief This function handles TIM5 global interrupt request.
* @param None
* @retval None
*/
void TIM5_IRQHandler(void)
{
if (TIM_GetITStatus(TIM5, TIM_IT_CC4) != RESET)
{
/* Get the Input Capture value */
tmpCC4[CaptureNumber++] = TIM_GetCapture4(TIM5);
/* Clear CC4 Interrupt pending bit */
TIM_ClearITPendingBit(TIM5, TIM_IT_CC4);
if (CaptureNumber >= 2)
{
/* Compute the period length */
PeriodValue = (uint16_t)(0xFFFF - tmpCC4[0] + tmpCC4[1] + 1);
}
}
}
/**
* @}
*/
/**
* @}
*/
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|
//
// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
// file was obtained (LICENSE.txt). A copy of the license may also be
// found online at https://opensource.org/licenses/MIT.
//
#ifndef NNG_PROTOCOL_REQREP0_REP_H
#define NNG_PROTOCOL_REQREP0_REP_H
#ifdef __cplusplus
extern "C" {
#endif
NNG_DECL int nng_rep0_open(nng_socket *);
NNG_DECL int nng_rep0_open_raw(nng_socket *);
#ifndef nng_rep_open
#define nng_rep_open nng_rep0_open
#endif
#ifndef nng_rep_open_raw
#define nng_rep_open_raw nng_rep0_open_raw
#endif
#define NNG_REP0_SELF 0x31
#define NNG_REP0_PEER 0x30
#define NNG_REP0_SELF_NAME "rep"
#define NNG_REP0_PEER_NAME "req"
#ifdef __cplusplus
}
#endif
#endif // NNG_PROTOCOL_REQREP0_REP_H
|
//
// SyncanoResponse_Notifications.h
// Syncano
//
// Created by Syncano Inc. on 09/01/14.
// Copyright (c) 2014 Syncano Inc. All rights reserved.
//
#import "SyncanoResponse.h"
@interface SyncanoResponse_Notifications_GetHistory : SyncanoResponse
/**
Requested list of notification history entries
*/
@property (strong) NSArray *history;
@end
|
/**
* \file
*
* \brief Configuration file for the timeout example
*
* Copyright (C) 2014 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
/**
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef CONF_EXAMPLE_H
#define CONF_EXAMPLE_H
// Led port is set to PORTE
#define LED_PORT 4
#define LED_PORT_MASK 0xFF
#endif /* CONF_EXAMPLE_H */
|
/*
* Generated by class-dump 3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard.
*/
#import "NSObject.h"
@class NSString;
@interface NSObject (IDEModelObjectConformanceString)
@property(readonly) NSString *navigableItem_conformanceString;
@end
|
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* All Rights Reserved.
*
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
*
**************************************************************************/
/**
* @file
* Helper functions for logical operations.
*
* @author Jose Fonseca <jfonseca@vmware.com>
*/
#ifndef LP_BLD_LOGIC_H
#define LP_BLD_LOGIC_H
#include "gallivm/lp_bld.h"
#include "pipe/p_defines.h" /* For PIPE_FUNC_xxx */
struct lp_type;
struct lp_build_context;
LLVMValueRef
lp_build_compare(struct gallivm_state *gallivm,
const struct lp_type type,
unsigned func,
LLVMValueRef a,
LLVMValueRef b);
/**
* @param func is one of PIPE_FUNC_xxx
*/
LLVMValueRef
lp_build_cmp(struct lp_build_context *bld,
unsigned func,
LLVMValueRef a,
LLVMValueRef b);
LLVMValueRef
lp_build_select_bitwise(struct lp_build_context *bld,
LLVMValueRef mask,
LLVMValueRef a,
LLVMValueRef b);
LLVMValueRef
lp_build_select(struct lp_build_context *bld,
LLVMValueRef mask,
LLVMValueRef a,
LLVMValueRef b);
LLVMValueRef
lp_build_select_aos(struct lp_build_context *bld,
unsigned mask,
LLVMValueRef a,
LLVMValueRef b,
unsigned num_channels);
LLVMValueRef
lp_build_any_true_range(struct lp_build_context *bld,
unsigned real_length,
LLVMValueRef val);
#endif /* !LP_BLD_LOGIC_H */
|
/*
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
#ifdef AWS_MULTI_FRAMEWORK
#import <AWSRuntime/AmazonServiceRequest.h>
#else
#import "../AmazonServiceRequest.h"
#endif
#ifdef AWS_MULTI_FRAMEWORK
#import <AWSRuntime/AmazonSDKUtil.h>
#else
#import "../AmazonSDKUtil.h"
#endif
#import "CloudWatchRequest.h"
#import "CloudWatchGetMetricStatisticsRequest.h"
#import "CloudWatchDimension.h"
#import "CloudWatchDimension.h"
/**
* Get Metric Statistics Request Marshaller
*/
@interface CloudWatchGetMetricStatisticsRequestMarshaller:NSObject {
}
+(AmazonServiceRequest *)createRequest:(CloudWatchGetMetricStatisticsRequest *)getMetricStatisticsRequest;
@end
|
#include "pysam.h"
#include <stdlib.h>
#include <string.h>
#include "bam.h"
// currently, this function ONLY works if each read has one hit
void bam_mating_core(bamFile in, bamFile out)
{
bam_header_t *header;
bam1_t *b[2];
int curr, has_prev;
header = bam_header_read(in);
bam_header_write(out, header);
b[0] = bam_init1();
b[1] = bam_init1();
curr = 0; has_prev = 0;
while (bam_read1(in, b[curr]) >= 0) {
bam1_t *cur = b[curr], *pre = b[1-curr];
if (has_prev) {
if (strcmp(bam1_qname(cur), bam1_qname(pre)) == 0) { // identical pair name
cur->core.mtid = pre->core.tid; cur->core.mpos = pre->core.pos;
pre->core.mtid = cur->core.tid; pre->core.mpos = cur->core.pos;
if (pre->core.tid == cur->core.tid && !(cur->core.flag&(BAM_FUNMAP|BAM_FMUNMAP))
&& !(pre->core.flag&(BAM_FUNMAP|BAM_FMUNMAP)))
{
uint32_t cur5, pre5;
cur5 = (cur->core.flag&BAM_FREVERSE)? bam_calend(&cur->core, bam1_cigar(cur)) : cur->core.pos;
pre5 = (pre->core.flag&BAM_FREVERSE)? bam_calend(&pre->core, bam1_cigar(pre)) : pre->core.pos;
cur->core.isize = pre5 - cur5; pre->core.isize = cur5 - pre5;
} else cur->core.isize = pre->core.isize = 0;
if (pre->core.flag&BAM_FREVERSE) cur->core.flag |= BAM_FMREVERSE;
else cur->core.flag &= ~BAM_FMREVERSE;
if (cur->core.flag&BAM_FREVERSE) pre->core.flag |= BAM_FMREVERSE;
else pre->core.flag &= ~BAM_FMREVERSE;
if (cur->core.flag & BAM_FUNMAP) { pre->core.flag |= BAM_FMUNMAP; pre->core.flag &= ~BAM_FPROPER_PAIR; }
if (pre->core.flag & BAM_FUNMAP) { cur->core.flag |= BAM_FMUNMAP; cur->core.flag &= ~BAM_FPROPER_PAIR; }
bam_write1(out, pre);
bam_write1(out, cur);
has_prev = 0;
} else { // unpaired or singleton
pre->core.mtid = -1; pre->core.mpos = -1; pre->core.isize = 0;
if (pre->core.flag & BAM_FPAIRED) {
pre->core.flag |= BAM_FMUNMAP;
pre->core.flag &= ~BAM_FMREVERSE & ~BAM_FPROPER_PAIR;
}
bam_write1(out, pre);
}
} else has_prev = 1;
curr = 1 - curr;
}
if (has_prev) bam_write1(out, b[1-curr]);
bam_header_destroy(header);
bam_destroy1(b[0]);
bam_destroy1(b[1]);
}
int bam_mating(int argc, char *argv[])
{
bamFile in, out;
if (argc < 3) {
fprintf(pysamerr, "samtools fixmate <in.nameSrt.bam> <out.nameSrt.bam>\n");
return 1;
}
in = (strcmp(argv[1], "-") == 0)? bam_dopen(fileno(stdin), "r") : bam_open(argv[1], "r");
out = (strcmp(argv[2], "-") == 0)? bam_dopen(fileno(stdout), "w") : bam_open(argv[2], "w");
bam_mating_core(in, out);
bam_close(in); bam_close(out);
return 0;
}
|
/**
* \file
*
* \brief FreeRTOS demo application configuration file.
*
* Copyright (C) 2014 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
/**
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef CONF_DEMO_H
#define CONF_DEMO_H
//! Extension header for the OLED1 Xplained Pro
#define OLED1_EXT_HEADER EXT3
//! Timer/Counter instance to use as tick timer
#define TICK_TC TC4
#endif // CONF_DEMO_H
|
#include <stdio.h>
#include <stdlib.h>
#define N 10000+100
int num[N];
int compare (const void *_a, const void *_b) {
int *a = (int*)_a;
int *b = (int*)_b;
return *a-*b;
}
int main() {
int n, q, t;
int i, j, c;
c = 1;
while (scanf ("%d%d", &n, &q) == 2) {
if (n == 0 && q == 0) break;
for (i=0; i<n; i++)
scanf ("%d", &num[i]);
qsort (num, n, sizeof(int), compare);
printf ("CASE# %d:\n", c++);
for (i=0; i<q; i++) {
scanf ("%d", &t);
for (j=0; j<n; j++)
if (num[j] == t) {printf ("%d found at %d\n", t, j+1); break;}
if (j == n) printf ("%d not found\n", t);
}
}
return 0;
}
|
#if defined(PEGASUS_OS_HPUX)
# include "UNIX_DeviceSAPImplementationPrivate_HPUX.h"
#elif defined(PEGASUS_OS_LINUX)
# include "UNIX_DeviceSAPImplementationPrivate_LINUX.h"
#elif defined(PEGASUS_OS_DARWIN)
# include "UNIX_DeviceSAPImplementationPrivate_DARWIN.h"
#elif defined(PEGASUS_OS_AIX)
# include "UNIX_DeviceSAPImplementationPrivate_AIX.h"
#elif defined(PEGASUS_OS_FREEBSD)
# include "UNIX_DeviceSAPImplementationPrivate_FREEBSD.h"
#elif defined(PEGASUS_OS_SOLARIS)
# include "UNIX_DeviceSAPImplementationPrivate_SOLARIS.h"
#elif defined(PEGASUS_OS_ZOS)
# include "UNIX_DeviceSAPImplementationPrivate_ZOS.h"
#elif defined(PEGASUS_OS_VMS)
# include "UNIX_DeviceSAPImplementationPrivate_VMS.h"
#elif defined(PEGASUS_OS_TRU64)
# include "UNIX_DeviceSAPImplementationPrivate_TRU64.h"
#else
# include "UNIX_DeviceSAPImplementationPrivate_STUB.h"
#endif
|
//
// AFBrowserViewController.h
// AdformSDK
//
// Created by Vladas on 07/07/14.
// Copyright (c) 2014 adform. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/**
Internal browser used for MRAID open function.
It opens an add from URL in a new modal viewController with web browser.
*/
@interface AFBrowserViewController : UIViewController
/**
The toolbar that presents navigation items.
*/
@property (nonatomic, strong, readonly) UIToolbar *toolBar;
/**
A progress bar used to display page loading progress.
*/
@property (nonatomic, strong, readonly) UIProgressView *progressView;
/**
Bar back navigtaion item.
*/
@property (nonatomic, strong, readonly) UIBarButtonItem *backItem;
/**
Bar forward navigtaion item.
*/
@property (nonatomic, strong, readonly) UIBarButtonItem *forwardItem;
/**
Var reload page item.
*/
@property (nonatomic, strong, readonly) UIBarButtonItem *reloadItem;
/**
Bar open page in safari item.
*/
@property (nonatomic, strong, readonly) UIBarButtonItem *openItem;
/**
Bar close item.
*/
@property (nonatomic, strong, readonly) UIBarButtonItem *closeItem;
@end
NS_ASSUME_NONNULL_END
|
#pragma once
#include <string>
#include <vector>
#include <stdarg.h>
// todo: cstr versions
std::string NarrowString(const std::wstring& wide);
std::wstring WidenString(const std::string& narrow);
// Remove all trailing \n characters from the input string.
std::wstring StripTrailingEndl(const std::wstring& str);
std::string StripTrailingEndl(const std::string& str);
void ToLowercase(std::string& str);
void ToLowercase(std::wstring& str);
void CStrToLower(char* str);
std::string FormatVarArgs(const char* fmt, va_list marker);
std::wstring FormatVarArgsW(const wchar_t* fmt, va_list marker);
std::string m_sprintf(const char* _Format, ...);
std::wstring m_swprintf(const wchar_t* _Format, ...);
//
// Number functions
// -----------------------------------------------------------------------
// Helper function for StringToNumber
template <class T>
T _StringToNumber(const char* start, char** end);
// Parse the input string as a number. If there are any characters that
// would produce a malformed number, false is returned.
template <class T>
bool StringToNumber(const std::string& str, T& out)
{
const char* start = str.c_str(), *expected_end = start + str.size();
char* end;
T value = _StringToNumber<T>(start, &end);
if (end != expected_end) return false;
out = value;
return true;
}
//
// Tokenization functions
// -----------------------------------------------------------------------
template <class T>
const T ArgsSearchString();
template <> const std::string ArgsSearchString<std::string>();
template <> const std::wstring ArgsSearchString<std::wstring>();
// Get the substring ending at the next occurrence of c.
// start is the position (inclusive) where to start searching from.
// end is the position after the next occurrence, or npos if none.
template <class T, class _Tc>
T GetStringEndingAtNext(const T& input, _Tc c, size_t start, size_t& end)
{
size_t found = input.find_first_of(c, start);
T out = input.substr(start, found - start);
end = found == input.npos ? input.npos : found + 1;
return out;
}
// Tokenize a string into its constituent arguments, an argument
// ends at a space unless within ' or " in which case it ends at the
// next escaping ' or ".
template <class T, class _Tc>
std::vector<T> TokenizeArgsT(const T& in)
{
using namespace std;
vector<T> out;
const T tofind = ArgsSearchString<T>(); // " ' or space
size_t curpos = 0;
while (curpos != in.npos)
{
curpos = in.find_first_not_of(_Tc(' '), curpos);
if (curpos == in.npos) break;
size_t nextpos = in.find_first_of(tofind, curpos);
if (nextpos == in.npos) { // no more matches, copy everything.
out.push_back(in.substr(curpos, in.npos));
break;
}
_Tc c = in.at(nextpos);
size_t startfrom = c == _Tc(' ') ? curpos : curpos + 1;
T token = GetStringEndingAtNext<T, _Tc>(in, c, startfrom, curpos);
if (token.size()) out.push_back(token);
}
return out;
}
typedef std::vector<std::string> (*tokargs_t)(const std::string&);
typedef std::vector<std::wstring> (*tokargsw_t)(const std::wstring&);
tokargs_t const TokenizeArgs = &TokenizeArgsT<std::string, char>;
tokargsw_t const TokenizeWArgs = &TokenizeArgsT<std::wstring, wchar_t>;
template <class T>
std::vector<T> Tokenize(const T& str, const T& delim)
{
// http://www.gamedev.net/community/forums/topic.asp?topic_id=381544#TokenizeString
std::vector<T> tokens;
size_t p0 = 0, p1 = T::npos;
while (p0 != T::npos) {
p1 = str.find_first_of(delim, p0);
if(p1 != p0) {
T token = str.substr(p0, p1 - p0);
tokens.push_back(token);
}
p0 = str.find_first_not_of(delim, p1);
}
return tokens;
}
|
// This file is part of SWGANH which is released under the MIT license.
// See file LICENSE or go to http://swganh.com/LICENSE
#pragma once
#include <cstdint>
#include <string>
#include "swganh/byte_buffer.h"
#include "swganh_core/messages/obj_controller_message.h"
namespace swganh
{
namespace messages
{
namespace controllers
{
class CommandQueueEnqueue : public ObjControllerMessage
{
public:
explicit CommandQueueEnqueue(uint32_t controller_type = 0x0000000B)
: ObjControllerMessage(controller_type, message_type())
{}
CommandQueueEnqueue(const ObjControllerMessage& base)
: ObjControllerMessage(base)
{
}
CommandQueueEnqueue(const CommandQueueEnqueue& other)
: ObjControllerMessage(other)
{
action_counter = other.action_counter;
command_crc = other.command_crc;
target_id = other.target_id;
command_options = other.command_options;
}
static uint32_t message_type()
{
return 0x00000116;
}
uint32_t action_counter;
uint32_t command_crc;
uint64_t target_id;
std::wstring command_options;
void OnControllerSerialize(swganh::ByteBuffer& buffer) const
{
buffer.write(action_counter);
buffer.write(command_crc);
buffer.write(target_id);
buffer.write(command_options);
}
void OnControllerDeserialize(swganh::ByteBuffer& buffer)
{
action_counter = buffer.read<uint32_t>();
command_crc = buffer.read<uint32_t>();
target_id = buffer.read<uint64_t>();
command_options = buffer.read<std::wstring>();
}
};
}
}
} // namespace swganh::messages::controllers
|
//%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// 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.
//
//////////////////////////////////////////////////////////////////////////
//
//%/////////////////////////////////////////////////////////////////////////
#ifndef __CIM_LOG_H
#define __CIM_LOG_H
#include "CIM_EnabledLogicalElement.h"
#define PROPERTY_MAX_NUMBER_OF_RECORDS "MaxNumberOfRecords"
#define PROPERTY_CURRENT_NUMBER_OF_RECORDS "CurrentNumberOfRecords"
#define PROPERTY_OVERWRITE_POLICY "OverwritePolicy"
#define PROPERTY_LOG_STATE "LogState"
class CIM_Log :
public CIM_EnabledLogicalElement
{
public:
virtual Boolean initialize()=0;
virtual Boolean load(int&)=0;
virtual Boolean finalize()=0;
virtual Boolean find(Array<CIMKeyBinding>&)=0;
virtual Boolean validateKey(CIMKeyBinding&) const=0;
virtual void setScope(CIMName)=0;
virtual Boolean getMaxNumberOfRecords(CIMProperty&) const=0;
virtual Uint64 getMaxNumberOfRecords() const=0;
virtual Boolean getCurrentNumberOfRecords(CIMProperty&) const=0;
virtual Uint64 getCurrentNumberOfRecords() const=0;
virtual Boolean getOverwritePolicy(CIMProperty&) const=0;
virtual Uint16 getOverwritePolicy() const=0;
virtual Boolean getLogState(CIMProperty&) const=0;
virtual Uint16 getLogState() const=0;
private:
};
#endif /* CIM_LOG */
|
//
// CRViewController.h
// Criollo
//
// Created by Cătălin Stan on 5/17/14.
// Copyright (c) 2014 Catalin Stan. All rights reserved.
//
#import <Criollo/CRRouteController.h>
#import <Criollo/CRTypes.h>
#import <Foundation/Foundation.h>
@class CRView, CRRequest, CRResponse;
NS_ASSUME_NONNULL_BEGIN
@interface CRViewController : CRRouteController
@property (nonatomic, strong, nullable) CRView* view;
@property (nonatomic, strong) NSMutableDictionary<NSString*, NSString*> *vars;
@property (nonatomic, readonly) NSString *nibName;
@property (nonatomic, readonly, nullable) NSBundle *nibBundle;
@property (nonatomic, readonly) BOOL shouldFinishResponse;
- (instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil;
- (instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil prefix:(NSString * _Nullable)prefix NS_DESIGNATED_INITIALIZER;
- (void)viewDidLoad;
- (NSString*)presentViewControllerWithRequest:(CRRequest *)request response:(CRResponse *)response;
@end
NS_ASSUME_NONNULL_END
|
#ifndef __LINESTREAMBUFFER_H__
#define __LINESTREAMBUFFER_H__
class LineStreamBuffer
{
public:
template <typename T> LineStreamBuffer(T* object, void (T::*method)(const char* line))
{
m_target = new Target<T>(object, method);
}
~LineStreamBuffer()
{
Flush();
delete m_target;
}
void HandleText(const char* text, int length)
{
const char* pos = text;
while(pos - text < length)
{
const char* start;
start = pos;
while(pos - text < length && *pos != '\n' && *pos != '\r')
{
++pos;
}
m_buffer.append(start, pos);
if (*pos == '\n' || *pos == '\r')
{
m_target->Call(m_buffer.c_str());
m_buffer.resize(0);
while (*pos == '\n' || *pos == '\r')
++pos;
}
}
}
void Flush()
{
if (!m_buffer.empty())
{
m_target->Call(m_buffer.c_str());
m_buffer.resize(0);
}
}
private:
struct ITarget
{
virtual ~ITarget() {}
virtual void Call(const char* line) = 0;
};
template <typename T> struct Target : public ITarget
{
public:
Target(T* object, void (T::*method)(const char* line)): object(object), method(method) {}
virtual void Call(const char* line)
{
(object->*method)(line);
}
private:
T* object;
void (T::*method)(const char* line);
};
ITarget* m_target;
string m_buffer;
};
#endif //__LINESTREAMBUFFER_H__
|
/*
本ソースリストは2017/11/2に下記からダウンロードしたものです。
改変部以外は原作者の権利が継続します。
https://learn.adafruit.com/096-mini-color-oled/wiring
2017/11/2 国野 亘
*/
// Font structures for newer Adafruit_GFX (1.1 and later).
// Example fonts are included in 'Fonts' directory.
// To use a font in your Arduino sketch, #include the corresponding .h
// file and pass address of GFXfont struct to setFont(). Pass NULL to
// revert to 'classic' fixed-space bitmap font.
#ifndef _GFXFONT_H_
#define _GFXFONT_H_
typedef struct { // Data stored PER GLYPH
uint16_t bitmapOffset; // Pointer into GFXfont->bitmap
uint8_t width, height; // Bitmap dimensions in pixels
uint8_t xAdvance; // Distance to advance cursor (x axis)
int8_t xOffset, yOffset; // Dist from cursor pos to UL corner
} GFXglyph;
typedef struct { // Data stored for FONT AS A WHOLE:
uint8_t *bitmap; // Glyph bitmaps, concatenated
GFXglyph *glyph; // Glyph array
uint8_t first, last; // ASCII extents
uint8_t yAdvance; // Newline distance (y axis)
} GFXfont;
#endif // _GFXFONT_H_
|
/*
* mousedrv.c - Mouse handling for OS/2
*
* Written by
* Thomas Bretz <tbretz@uni-sw.gwdg.de>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "vice.h"
#define INCL_WININPUT
#define INCL_WINPOINTERS
#include "mouse.h"
#include "mousedrv.h"
#include "fullscr.h"
#include "cmdline.h"
#include "resources.h"
#include "translate.h"
#include "vsyncapi.h"
static int hide_mouseptr;
static int visible=TRUE;
static SHORT _mouse_x, _mouse_y; // [-32768, 32768]
static unsigned long mouse_timestamp = 0;
/* ----------------------------------------------------------- */
void mousedrv_mouse_changed(void)
{
/* -- FIXME: rash while startup --
mouse_button_left(0);
mouse_button_right(0);
*/
}
static int set_hide_mouseptr(int val, void *param)
{
hide_mouseptr = val;
if (!hide_mouseptr && !visible && !FullscreenIsNow()) { // do we have to show the ptr again?
WinSetCapture(HWND_DESKTOP, NULLHANDLE);
WinShowPointer(HWND_DESKTOP, TRUE);
visible = TRUE;
}
return 0;
}
static const resource_int_t resources_int[] = {
{ "HideMousePtr", 0, RES_EVENT_NO, NULL,
&hide_mouseptr, set_hide_mouseptr, NULL },
{ NULL }
};
int mousedrv_resources_init(void)
{
return resources_register_int(resources_int);
}
/* ----------------------------------------------------------- */
static const cmdline_option_t cmdline_options[] = {
{ "-hidemouseptr", SET_RESOURCE, 0,
NULL, NULL, "HideMousePtr", (resource_value_t) 1,
USE_PARAM_STRING, USE_DESCRIPTION_ID,
IDCLS_UNUSED, IDCLS_UNUSED,
NULL, "Enable hiding of mouse pointer inside the window" },
{ "+hidemouseptr", SET_RESOURCE, 0,
NULL, NULL, "HideMousePtr", (resource_value_t) 0,
USE_PARAM_STRING, USE_DESCRIPTION_ID,
IDCLS_UNUSED, IDCLS_UNUSED,
NULL, "Disable hiding of mouse pointer inside the window" },
{ NULL }
};
int mousedrv_cmdline_options_init(void)
{
return cmdline_register_options(cmdline_options);
}
void mousedrv_init(void)
{
}
const int mouse_step = 15;
extern int stretch; // video.c
inline int mousedrv_get_x(void)
{
#ifndef __XVIC__
return (_mouse_x / stretch) << 1;
#else
return _mouse_x / stretch;
#endif
}
inline int mousedrv_get_y(void)
{
return (_mouse_y / stretch) << 1;
}
unsigned long mousedrv_get_timestamp(void)
{
return mouse_timestamp;
}
/* ----------------- OS/2 specific ------------------------- */
void mouse_button(HWND hwnd, ULONG msg, MPARAM mp1)
{
if (!_mouse_enabled) {
return;
}
switch (msg) {
case WM_MOUSEMOVE:
_mouse_x = SHORT1FROMMP(mp1);
_mouse_y = SHORT2FROMMP(mp1);
mouse_timestamp = vsyncarch_gettime();
{
SWP swp;
WinQueryWindowPos(hwnd, &swp);
//
// check whether the pointer is outside or inside the window
//
if (FullscreenIsNow()) {
visible = TRUE;
}
if (_mouse_x >= 0 && _mouse_x < swp.cx && _mouse_y >= 0 && _mouse_y < swp.cy) {
//
// FIXME: Don't capture the mouse pointer if it is in front
// of a client dialog!
//
if (WinQueryCapture(HWND_DESKTOP)!= hwnd && hide_mouseptr && !FullscreenIsNow()) {
WinSetCapture(HWND_DESKTOP, hwnd);
}
if (visible && hide_mouseptr && !FullscreenIsNow()) {
WinShowPointer(HWND_DESKTOP, FALSE);
visible = FALSE;
}
} else {
if (WinQueryCapture(HWND_DESKTOP) == hwnd && !FullscreenIsNow()) {
WinSetCapture(HWND_DESKTOP, NULLHANDLE);
}
if (!visible && !FullscreenIsNow()) {
WinShowPointer(HWND_DESKTOP, TRUE);
visible = TRUE;
}
//
// don't use 'outside'-values which appears one times
// if the mouse pointer leaves the window
//
if (_mouse_x < 0) {
_mouse_x = 0;
} else {
if (_mouse_x >= swp.cx) {
_mouse_x = swp.cx - 1;
}
}
if (_mouse_y < 0) {
_mouse_y = 0;
} else {
if (_mouse_y >= swp.cy) {
_mouse_y = swp.cy - 1;
}
}
}
}
return;
case WM_BUTTON1DOWN:
mouse_button_left(1);
return;
case WM_BUTTON1UP:
mouse_button_left(0);
return;
case WM_BUTTON2DOWN:
mouse_button_right(1);
return;
case WM_BUTTON2UP:
mouse_button_right(0);
return;
case WM_BUTTON3DOWN:
mouse_button_middle(1);
return;
case WM_BUTTON3UP:
mouse_button_middle(0);
return;
}
}
|
/**
* \file base64.h
*
* Copyright (C) 2006-2010, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef POLARSSL_BASE64_H
#define POLARSSL_BASE64_H
#define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL 0x0010
#define POLARSSL_ERR_BASE64_INVALID_CHARACTER 0x0012
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief Encode a buffer into base64 format
*
* \param dst destination buffer
* \param dlen size of the buffer
* \param src source buffer
* \param slen amount of data to be encoded
*
* \return 0 if successful, or POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL.
* *dlen is always updated to reflect the amount
* of data that has (or would have) been written.
*
* \note Call this function with *dlen = 0 to obtain the
* required buffer size in *dlen
*/
int base64_encode( unsigned char *dst, int *dlen,
const unsigned char *src, int slen );
/**
* \brief Decode a base64-formatted buffer
*
* \param dst destination buffer
* \param dlen size of the buffer
* \param src source buffer
* \param slen amount of data to be decoded
*
* \return 0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, or
* POLARSSL_ERR_BASE64_INVALID_DATA if the input data is not
* correct. *dlen is always updated to reflect the amount
* of data that has (or would have) been written.
*
* \note Call this function with *dlen = 0 to obtain the
* required buffer size in *dlen
*/
int base64_decode( unsigned char *dst, int *dlen,
const unsigned char *src, int slen );
/**
* \brief Checkup routine
*
* \return 0 if successful, or 1 if the test failed
*/
int base64_self_test( int verbose );
#ifdef __cplusplus
}
#endif
#endif /* base64.h */
|
#include <gb/gb.h>
#include <gb/console.h>
#include <stdio.h>
#include <string.h>
UBYTE vbl_cnt, tim_cnt;
void vbl()
{
/* Upon IRQ, interrupts are automatically disabled */
vbl_cnt++;
}
void tim()
{
/* Upon IRQ, interrupts are automatically disabled */
tim_cnt++;
}
void print_counter()
{
UBYTE cnt;
/* Ensure mutual exclusion (not really necessary in this example)... */
disable_interrupts();
cnt = tim_cnt;
enable_interrupts();
printf(" TIM %u", (unsigned int)cnt);
gotoxy(9, posy());
/* Ensure mutual exclusion (not really necessary in this example)... */
disable_interrupts();
cnt = vbl_cnt;
enable_interrupts();
printf("- VBL %u\n", (unsigned int)cnt);
}
void main()
{
/* Ensure mutual exclusion (not really necessary in this example)... */
disable_interrupts();
vbl_cnt = tim_cnt = 0;
add_VBL(vbl);
add_TIM(tim);
enable_interrupts();
/* Set TMA to divide clock by 0x100 */
TMA_REG = 0x00U;
/* Set clock to 4096 Hertz */
TAC_REG = 0x04U;
/* Handle VBL and TIM interrupts */
set_interrupts(VBL_IFLAG | TIM_IFLAG);
while(1) {
print_counter();
delay(1000UL);
}
}
|
//
// Region+Extensions.h
// PinballMap
//
// Created by Frank Michael on 12/28/14.
// Copyright (c) 2014 Frank Michael Sanchez. All rights reserved.
//
#import "Region.h"
@interface Region (Extensions)
- (NSUInteger)numberOfLocations;
- (NSUInteger)numberOfLocalMachines;
@end
|
//
// RazeEffects.h
//
// Created by Rob Visentin on 4/17/15.
// Copyright (c) 2015 Raizlabs. All rights reserved.
//
#import <Foundation/Foundation.h>
FOUNDATION_EXPORT double RazeEffectsVersionNumber;
FOUNDATION_EXPORT const unsigned char RazeEffectsVersionString[];
#import <RazeEffects/RZXEffect.h>
#import <RazeEffects/RZXPassthroughEffect.h>
#import <RazeEffects/RZXGrayscaleEffect.h>
#import <RazeEffects/RZXConvolutionEffect.h>
#import <RazeEffects/RZXBlurEffect.h>
#import <RazeEffects/RZXClothEffect.h>
#import <RazeEffects/RZXCompositeEffect.h>
#import <RazeEffects/RZXADSPhongEffect.h>
#import <RazeEffects/RZXImageFilter.h>
|
#pragma once
class fft {
public:
fft();
~fft();
/* Calculate the power spectrum */
void powerSpectrum(int start, int half, float *data, int windowSize,float *magnitude,float *phase, float *power, float *avg_power);
/* ... the inverse */
void inversePowerSpectrum(int start, int half, int windowSize, float *finalOut,float *magnitude,float *phase);
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.