hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 588
values | lang stringclasses 305
values | max_stars_repo_path stringlengths 3 363 | max_stars_repo_name stringlengths 5 118 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringdate 2015-01-01 00:00:35 2022-03-31 23:43:49 ⌀ | max_stars_repo_stars_event_max_datetime stringdate 2015-01-01 12:37:38 2022-03-31 23:59:52 ⌀ | max_issues_repo_path stringlengths 3 363 | max_issues_repo_name stringlengths 5 118 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count float64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 363 | max_forks_repo_name stringlengths 5 135 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringdate 2015-01-01 00:01:02 2022-03-31 23:27:27 ⌀ | max_forks_repo_forks_event_max_datetime stringdate 2015-01-03 08:55:07 2022-03-31 23:59:24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1.13 1.04M | max_line_length int64 1 1.05M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c5901b008cf06df1e5f006c01c31bbbcd28108cd | 15,324 | c | C | src/bltinmodule.c | tomjackbear/python-0.9.1 | 00adeddadaede51e92447523266c9d5616201c38 | [
"FSFAP"
] | 4 | 2020-07-21T09:47:52.000Z | 2022-01-05T21:43:36.000Z | src/bltinmodule.c | tomjackbear/python-0.9.1 | 00adeddadaede51e92447523266c9d5616201c38 | [
"FSFAP"
] | 1 | 2020-09-23T20:46:33.000Z | 2020-09-23T20:59:57.000Z | src/bltinmodule.c | tomjackbear/python-0.9.1 | 00adeddadaede51e92447523266c9d5616201c38 | [
"FSFAP"
] | 4 | 2020-07-13T00:45:24.000Z | 2021-09-04T14:50:46.000Z | /***********************************************************
Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
Netherlands.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
/* Built-in functions */
#include "allobjects.h"
#include "node.h"
#include "graminit.h"
#include "errcode.h"
#include "sysmodule.h"
#include "bltinmodule.h"
#include "import.h"
#include "pythonrun.h"
#include "compile.h" /* For ceval.h */
#include "ceval.h"
#include "modsupport.h"
static object *
builtin_abs(self, v)
object *self;
object *v;
{
/* XXX This should be a method in the as_number struct in the type */
if (v == NULL) {
/* */
}
else if (is_intobject(v)) {
long x = getintvalue(v);
if (x < 0)
x = -x;
return newintobject(x);
}
else if (is_floatobject(v)) {
double x = getfloatvalue(v);
if (x < 0)
x = -x;
return newfloatobject(x);
}
err_setstr(TypeError, "abs() argument must be float or int");
return NULL;
}
static object *
builtin_chr(self, v)
object *self;
object *v;
{
long x;
char s[1];
if (v == NULL || !is_intobject(v)) {
err_setstr(TypeError, "chr() must have int argument");
return NULL;
}
x = getintvalue(v);
if (x < 0 || x >= 256) {
err_setstr(RuntimeError, "chr() arg not in range(256)");
return NULL;
}
s[0] = x;
return newsizedstringobject(s, 1);
}
static object *
builtin_dir(self, v)
object *self;
object *v;
{
object *d;
if (v == NULL) {
d = getlocals();
}
else {
if (!is_moduleobject(v)) {
err_setstr(TypeError,
"dir() argument, must be module or absent");
return NULL;
}
d = getmoduledict(v);
}
v = getdictkeys(d);
if (sortlist(v) != 0) {
DECREF(v);
v = NULL;
}
return v;
}
static object *
builtin_divmod(self, v)
object *self;
object *v;
{
object *x, *y;
long xi, yi, xdivy, xmody;
if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) {
err_setstr(TypeError, "divmod() requires 2 int arguments");
return NULL;
}
x = gettupleitem(v, 0);
y = gettupleitem(v, 1);
if (!is_intobject(x) || !is_intobject(y)) {
err_setstr(TypeError, "divmod() requires 2 int arguments");
return NULL;
}
xi = getintvalue(x);
yi = getintvalue(y);
if (yi == 0) {
err_setstr(TypeError, "divmod() division by zero");
return NULL;
}
if (yi < 0) {
xdivy = -xi / -yi;
}
else {
xdivy = xi / yi;
}
xmody = xi - xdivy*yi;
if (xmody < 0 && yi > 0 || xmody > 0 && yi < 0) {
xmody += yi;
xdivy -= 1;
}
v = newtupleobject(2);
x = newintobject(xdivy);
y = newintobject(xmody);
if (v == NULL || x == NULL || y == NULL ||
settupleitem(v, 0, x) != 0 ||
settupleitem(v, 1, y) != 0) {
XDECREF(v);
XDECREF(x);
XDECREF(y);
return NULL;
}
return v;
}
static object *
exec_eval(v, start)
object *v;
int start;
{
object *str = NULL, *globals = NULL, *locals = NULL;
int n;
if (v != NULL) {
if (is_stringobject(v))
str = v;
else if (is_tupleobject(v) &&
((n = gettuplesize(v)) == 2 || n == 3)) {
str = gettupleitem(v, 0);
globals = gettupleitem(v, 1);
if (n == 3)
locals = gettupleitem(v, 2);
}
}
if (str == NULL || !is_stringobject(str) ||
globals != NULL && !is_dictobject(globals) ||
locals != NULL && !is_dictobject(locals)) {
err_setstr(TypeError,
"exec/eval arguments must be string[,dict[,dict]]");
return NULL;
}
return run_string(getstringvalue(str), start, globals, locals);
}
static object *
builtin_eval(self, v)
object *self;
object *v;
{
return exec_eval(v, eval_input);
}
static object *
builtin_exec(self, v)
object *self;
object *v;
{
return exec_eval(v, file_input);
}
static object *
builtin_float(self, v)
object *self;
object *v;
{
if (v == NULL) {
/* */
}
else if (is_floatobject(v)) {
INCREF(v);
return v;
}
else if (is_intobject(v)) {
long x = getintvalue(v);
return newfloatobject((double)x);
}
err_setstr(TypeError, "float() argument must be float or int");
return NULL;
}
static object *
builtin_input(self, v)
object *self;
object *v;
{
FILE *in = sysgetfile("stdin", stdin);
FILE *out = sysgetfile("stdout", stdout);
node *n;
int err;
object *m, *d;
flushline();
if (v != NULL)
printobject(v, out, PRINT_RAW);
m = add_module("__main__");
d = getmoduledict(m);
return run_file(in, "<stdin>", expr_input, d, d);
}
static object *
builtin_int(self, v)
object *self;
object *v;
{
if (v == NULL) {
/* */
}
else if (is_intobject(v)) {
INCREF(v);
return v;
}
else if (is_floatobject(v)) {
double x = getfloatvalue(v);
return newintobject((long)x);
}
err_setstr(TypeError, "int() argument must be float or int");
return NULL;
}
static object *
builtin_len(self, v)
object *self;
object *v;
{
long len;
typeobject *tp;
if (v == NULL) {
err_setstr(TypeError, "len() without argument");
return NULL;
}
tp = v->ob_type;
if (tp->tp_as_sequence != NULL) {
len = (*tp->tp_as_sequence->sq_length)(v);
}
else if (tp->tp_as_mapping != NULL) {
len = (*tp->tp_as_mapping->mp_length)(v);
}
else {
err_setstr(TypeError, "len() of unsized object");
return NULL;
}
return newintobject(len);
}
static object *
min_max(v, sign)
object *v;
int sign;
{
int i, n, cmp;
object *w, *x;
sequence_methods *sq;
if (v == NULL) {
err_setstr(TypeError, "min() or max() without argument");
return NULL;
}
sq = v->ob_type->tp_as_sequence;
if (sq == NULL) {
err_setstr(TypeError, "min() or max() of non-sequence");
return NULL;
}
n = (*sq->sq_length)(v);
if (n == 0) {
err_setstr(RuntimeError, "min() or max() of empty sequence");
return NULL;
}
w = (*sq->sq_item)(v, 0); /* Implies INCREF */
for (i = 1; i < n; i++) {
x = (*sq->sq_item)(v, i); /* Implies INCREF */
cmp = cmpobject(x, w);
if (cmp * sign > 0) {
DECREF(w);
w = x;
}
else
DECREF(x);
}
return w;
}
static object *
builtin_min(self, v)
object *self;
object *v;
{
return min_max(v, -1);
}
static object *
builtin_max(self, v)
object *self;
object *v;
{
return min_max(v, 1);
}
static object *
builtin_open(self, v)
object *self;
object *v;
{
object *name, *mode;
if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2 ||
!is_stringobject(name = gettupleitem(v, 0)) ||
!is_stringobject(mode = gettupleitem(v, 1))) {
err_setstr(TypeError, "open() requires 2 string arguments");
return NULL;
}
v = newfileobject(getstringvalue(name), getstringvalue(mode));
return v;
}
static object *
builtin_ord(self, v)
object *self;
object *v;
{
if (v == NULL || !is_stringobject(v)) {
err_setstr(TypeError, "ord() must have string argument");
return NULL;
}
if (getstringsize(v) != 1) {
err_setstr(RuntimeError, "ord() arg must have length 1");
return NULL;
}
return newintobject((long)(getstringvalue(v)[0] & 0xff));
}
static object *
builtin_range(self, v)
object *self;
object *v;
{
static char *errmsg = "range() requires 1-3 int arguments";
int i, n;
long ilow, ihigh, istep;
if (v != NULL && is_intobject(v)) {
ilow = 0; ihigh = getintvalue(v); istep = 1;
}
else if (v == NULL || !is_tupleobject(v)) {
err_setstr(TypeError, errmsg);
return NULL;
}
else {
n = gettuplesize(v);
if (n < 1 || n > 3) {
err_setstr(TypeError, errmsg);
return NULL;
}
for (i = 0; i < n; i++) {
if (!is_intobject(gettupleitem(v, i))) {
err_setstr(TypeError, errmsg);
return NULL;
}
}
if (n == 3) {
istep = getintvalue(gettupleitem(v, 2));
--n;
}
else
istep = 1;
ihigh = getintvalue(gettupleitem(v, --n));
if (n > 0)
ilow = getintvalue(gettupleitem(v, 0));
else
ilow = 0;
}
if (istep == 0) {
err_setstr(RuntimeError, "zero step for range()");
return NULL;
}
/* XXX ought to check overflow of subtraction */
if (istep > 0)
n = (ihigh - ilow + istep - 1) / istep;
else
n = (ihigh - ilow + istep + 1) / istep;
if (n < 0)
n = 0;
v = newlistobject(n);
if (v == NULL)
return NULL;
for (i = 0; i < n; i++) {
object *w = newintobject(ilow);
if (w == NULL) {
DECREF(v);
return NULL;
}
setlistitem(v, i, w);
ilow += istep;
}
return v;
}
static object *
builtin_raw_input(self, v)
object *self;
object *v;
{
FILE *in = sysgetfile("stdin", stdin);
FILE *out = sysgetfile("stdout", stdout);
char *p;
int err;
int n = 1000;
flushline();
if (v != NULL)
printobject(v, out, PRINT_RAW);
v = newsizedstringobject((char *)NULL, n);
if (v != NULL) {
if ((err = fgets_intr(getstringvalue(v), n+1, in)) != E_OK) {
err_input(err);
DECREF(v);
return NULL;
}
else {
n = strlen(getstringvalue(v));
if (n > 0 && getstringvalue(v)[n-1] == '\n')
n--;
resizestring(&v, n);
}
}
return v;
}
static object *
builtin_reload(self, v)
object *self;
object *v;
{
return reload_module(v);
}
static object *
builtin_type(self, v)
object *self;
object *v;
{
if (v == NULL) {
err_setstr(TypeError, "type() requres an argument");
return NULL;
}
v = (object *)v->ob_type;
INCREF(v);
return v;
}
static struct methodlist builtin_methods[] = {
{"abs", builtin_abs},
{"chr", builtin_chr},
{"dir", builtin_dir},
{"divmod", builtin_divmod},
{"eval", builtin_eval},
{"exec", builtin_exec},
{"float", builtin_float},
{"input", builtin_input},
{"int", builtin_int},
{"len", builtin_len},
{"max", builtin_max},
{"min", builtin_min},
{"open", builtin_open}, /* XXX move to OS module */
{"ord", builtin_ord},
{"range", builtin_range},
{"raw_input", builtin_raw_input},
{"reload", builtin_reload},
{"type", builtin_type},
{NULL, NULL},
};
static object *builtin_dict;
object *
getbuiltin(name)
char *name;
{
return dictlookup(builtin_dict, name);
}
/* Predefined exceptions */
object *RuntimeError;
object *EOFError;
object *TypeError;
object *MemoryError;
object *NameError;
object *SystemError;
object *KeyboardInterrupt;
static object *
newstdexception(name, message)
char *name, *message;
{
object *v = newstringobject(message);
if (v == NULL || dictinsert(builtin_dict, name, v) != 0)
fatal("no mem for new standard exception");
return v;
}
static void
initerrors()
{
RuntimeError = newstdexception("RuntimeError", "run-time error");
EOFError = newstdexception("EOFError", "end-of-file read");
TypeError = newstdexception("TypeError", "type error");
MemoryError = newstdexception("MemoryError", "out of memory");
NameError = newstdexception("NameError", "undefined name");
SystemError = newstdexception("SystemError", "system error");
KeyboardInterrupt =
newstdexception("KeyboardInterrupt", "keyboard interrupt");
}
void
initbuiltin()
{
object *m;
m = initmodule("builtin", builtin_methods);
builtin_dict = getmoduledict(m);
INCREF(builtin_dict);
initerrors();
(void) dictinsert(builtin_dict, "None", None);
}
| 27.364286 | 76 | 0.485839 |
a603fc433dad3c2917fc9d0decbcdaf8a6d00b2e | 1,214 | h | C | Ritualberater/RuneTreeModel.h | odom11/ritualberater | b5af60785f8a7b5ec2e0a6be53c4441cc38ba94d | [
"MIT"
] | null | null | null | Ritualberater/RuneTreeModel.h | odom11/ritualberater | b5af60785f8a7b5ec2e0a6be53c4441cc38ba94d | [
"MIT"
] | null | null | null | Ritualberater/RuneTreeModel.h | odom11/ritualberater | b5af60785f8a7b5ec2e0a6be53c4441cc38ba94d | [
"MIT"
] | null | null | null | #pragma once
#include <memory>
#include <QModelIndex>
#include <QVariant>
#include "AbstractRuneNode.h"
#include "RuneLeaf.h"
class RuneTreeModel : public QAbstractItemModel {
Q_OBJECT
public:
explicit RuneTreeModel(const QString& data, QObject* parent = nullptr);
QVariant data(const QModelIndex& index, int role) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex& index, const QVariant& value,
int role = Qt::EditRole) override;
QModelIndex index(int row, int column,
const QModelIndex& parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex& index) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
private:
void initializeRuneTree();
RuneLeaf* getRuneleafPointer(QModelIndex index) const;
std::unique_ptr<AbstractRuneNode> root;
//void setupModelData(const QStringList& lines, TreeItem* parent);
//TreeItem* rootItem;
}; | 35.705882 | 78 | 0.737232 |
a60511ea7264be12b0a56d4b1e14c848d2c46187 | 14,905 | c | C | BSP_DISCO_F769NI/Drivers/BSP/Components/adv7533/adv7533.c | tdjastrzebski/DISCO-F769NI_LCD_demo | 475d6367f0370dd798e1fd32c5ad953d65bb6e98 | [
"MIT"
] | 3 | 2020-02-13T12:56:41.000Z | 2021-04-02T14:32:09.000Z | BSP_DISCO_F769NI/Drivers/BSP/Components/adv7533/adv7533.c | tdjastrzebski/DISCO-F769NI_LCD_demo | 475d6367f0370dd798e1fd32c5ad953d65bb6e98 | [
"MIT"
] | null | null | null | BSP_DISCO_F769NI/Drivers/BSP/Components/adv7533/adv7533.c | tdjastrzebski/DISCO-F769NI_LCD_demo | 475d6367f0370dd798e1fd32c5ad953d65bb6e98 | [
"MIT"
] | null | null | null | /**
******************************************************************************
* @file adv7533.c
* @author MCD Application Team
* @version V1.0.1
* @date 05-December-2016
* @brief This file provides the ADV7533 DSI to HDMI bridge driver
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* 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 STMicroelectronics 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "adv7533.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @defgroup ADV7533 ADV7533
* @brief This file provides a set of functions needed to drive the
* adv7533 DSI-HDMI bridge.
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/** @defgroup ADV7533_Private_Constants ADV7533 Private Constants
* @{
*/
/**
* @}
*/
/* Private macros ------------------------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/** @defgroup ADV7533_Exported_Variables
* @{
*/
AUDIO_DrvTypeDef adv7533_drv =
{
adv7533_AudioInit,
adv7533_DeInit,
adv7533_ReadID,
adv7533_Play,
adv7533_Pause,
adv7533_Resume,
adv7533_Stop,
adv7533_SetFrequency,
adv7533_SetVolume, /* Not supported, added for compatibility */
adv7533_SetMute,
adv7533_SetOutputMode, /* Not supported, added for compatibility */
adv7533_Reset /* Not supported, added for compatibility */
};
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @defgroup ADV7533_Exported_Functions ADV7533 Exported Functions
* @{
*/
/**
* @brief Initializes the ADV7533 bridge.
* @param None
* @retval Status
*/
uint8_t ADV7533_Init(void)
{
HDMI_IO_Init();
/* Configure the IC2 address for CEC_DSI interface */
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xE1, ADV7533_CEC_DSI_I2C_ADDR);
return 0;
}
/**
* @brief Power on the ADV7533 bridge.
* @param None
* @retval None
*/
void ADV7533_PowerOn(void)
{
uint8_t tmp;
/* Power on */
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x41);
tmp &= ~0x40;
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x41, tmp);
}
/**
* @brief Power off the ADV7533 bridge.
* @param None
* @retval None
*/
void ADV7533_PowerDown(void)
{
uint8_t tmp;
/* Power down */
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x41);
tmp |= 0x40;
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x41, tmp);
}
/**
* @brief Configure the DSI-HDMI ADV7533 bridge for video.
* @param config : pointer to adv7533ConfigTypeDef that contains the
* video configuration parameters
* @retval None
*/
void ADV7533_Configure(adv7533ConfigTypeDef * config)
{
uint8_t tmp;
/* Sequence from Section 3 - Quick Start Guide */
/* ADV7533 Power Settings */
/* Power down */
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x41);
tmp &= ~0x40;
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x41, tmp);
/* HPD Override */
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xD6);
tmp |= 0x40;
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xD6, tmp);
/* Gate DSI LP Oscillator and DSI Bias Clock Powerdown */
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x03);
tmp &= ~0x02;
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x03, tmp);
/* Fixed registers that must be set on power-up */
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x16);
tmp &= ~0x3E;
tmp |= 0x20;
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x16, tmp);
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x9A, 0xE0);
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xBA);
tmp &= ~0xF8;
tmp |= 0x70;
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xBA, tmp);
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xDE, 0x82);
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xE4);
tmp |= 0x40;
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xE4, tmp);
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xE5, 0x80);
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x15);
tmp &= ~0x30;
tmp |= 0x10;
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x17);
tmp &= ~0xF0;
tmp |= 0xD0;
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x17, tmp);
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x24);
tmp &= ~0x10;
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x24, tmp);
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x57);
tmp |= 0x01;
tmp |= 0x10;
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x57, tmp);
/* Configure the number of DSI lanes */
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x1C, (config->DSI_LANES << 4));
/* Setup video output mode */
/* Select HDMI mode */
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xAF);
tmp |= 0x02;
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xAF, tmp);
/* HDMI Output Enable */
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x03);
tmp |= 0x80;
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x03, tmp);
/* GC packet enable */
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x40);
tmp |= 0x80;
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x40, tmp);
/* Input color depth 24-bit per pixel */
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x4C);
tmp &= ~0x0F;
tmp |= 0x03;
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x4C, tmp);
/* Down dither output color depth */
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x49, 0xfc);
/* Internal timing disabled */
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x27);
tmp &= ~0x80;
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x27, tmp);
}
/**
* @brief Enable video pattern generation.
* @param None
* @retval None
*/
void ADV7533_PatternEnable(void)
{
/* Timing generator enable */
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x55, 0x80); /* Color bar */
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x55, 0xA0); /* Color ramp */
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x03, 0x89);
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0xAF, 0x16);
}
/**
* @brief Disable video pattern generation.
* @param none
* @retval none
*/
void ADV7533_PatternDisable(void)
{
/* Timing generator enable */
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x55, 0x00);
}
/**
* @brief Initializes the ADV7533 audio interface.
* @param DeviceAddr: Device address on communication Bus.
* @param OutputDevice: Not used (for compatiblity only).
* @param Volume: Not used (for compatiblity only).
* @param AudioFreq: Audio Frequency
* @retval 0 if correct communication, else wrong communication
*/
uint32_t adv7533_AudioInit(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume,uint32_t AudioFreq)
{
uint32_t val = 4096;
uint8_t tmp = 0;
/* Audio data enable*/
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x05);
tmp &= ~0x20;
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x05, tmp);
/* HDMI statup */
tmp= (uint8_t)((val & 0xF0000)>>16);
HDMI_IO_Write(DeviceAddr, 0x01, tmp);
tmp= (uint8_t)((val & 0xFF00)>>8);
HDMI_IO_Write(DeviceAddr, 0x02, tmp);
tmp= (uint8_t)((val & 0xFF));
HDMI_IO_Write(DeviceAddr, 0x03, tmp);
/* Enable spdif */
tmp = HDMI_IO_Read(DeviceAddr, 0x0B);
tmp |= 0x80;
HDMI_IO_Write(DeviceAddr, 0x0B, tmp);
/* Enable I2S */
tmp = HDMI_IO_Read(DeviceAddr, 0x0C);
tmp |=0x04;
HDMI_IO_Write(DeviceAddr, 0x0C, tmp);
/* Set audio sampling frequency */
adv7533_SetFrequency(DeviceAddr, AudioFreq);
/* Select SPDIF is 0x10 , I2S=0x00 */
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x0A);
tmp &=~ 0x10;
HDMI_IO_Write(DeviceAddr, 0x0A, tmp);
/* Set v1P2 enable */
tmp = HDMI_IO_Read(DeviceAddr, 0xE4);
tmp |= 0x80;
HDMI_IO_Write(DeviceAddr, 0xE4, tmp);
return 0;
}
/**
* @brief Deinitializes the adv7533
* @param None
* @retval None
*/
void adv7533_DeInit(void)
{
/* Deinitialize Audio adv7533 interface */
AUDIO_IO_DeInit();
}
/**
* @brief Get the adv7533 ID.
* @param DeviceAddr: Device address on communication Bus.
* @retval The adv7533 ID
*/
uint32_t adv7533_ReadID(uint16_t DeviceAddr)
{
uint32_t tmp = 0;
tmp = HDMI_IO_Read(DeviceAddr, ADV7533_CHIPID_ADDR0);
tmp = (tmp<<8);
tmp |= HDMI_IO_Read(DeviceAddr, ADV7533_CHIPID_ADDR1);
return(tmp);
}
/**
* @brief Pauses playing on the audio hdmi
* @param DeviceAddr: Device address on communication Bus.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t adv7533_Pause(uint16_t DeviceAddr)
{
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_ON));
}
/**
* @brief Resumes playing on the audio hdmi.
* @param DeviceAddr: Device address on communication Bus.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t adv7533_Resume(uint16_t DeviceAddr)
{
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_OFF));
}
/**
* @brief Start the audio hdmi play feature.
* @note For this codec no Play options are required.
* @param DeviceAddr: Device address on communication Bus.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t adv7533_Play(uint16_t DeviceAddr ,uint16_t* pBuffer ,uint16_t Size)
{
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_OFF));
}
/**
* @brief Stop playing on the audio hdmi
* @param DeviceAddr: Device address on communication Bus.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t adv7533_Stop(uint16_t DeviceAddr,uint32_t cmd)
{
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_ON));
}
/**
* @brief Enables or disables the mute feature on the audio hdmi.
* @param DeviceAddr: Device address on communication Bus.
* @param Cmd: AUDIO_MUTE_ON to enable the mute or AUDIO_MUTE_OFF to disable the
* mute mode.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t adv7533_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
{
uint8_t tmp = 0;
tmp = HDMI_IO_Read(DeviceAddr, 0x0D);
if (Cmd == AUDIO_MUTE_ON)
{
/* enable audio mute*/
tmp |= 0x40;
HDMI_IO_Write(DeviceAddr, 0x0D, tmp);
}
else
{
/*audio mute off disable the mute */
tmp &= ~0x40;
HDMI_IO_Write(DeviceAddr, 0x0D, tmp);
}
return 0;
}
/**
* @brief Sets output mode.
* @param DeviceAddr: Device address on communication Bus.
* @param Output : hdmi output.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t adv7533_SetOutputMode(uint16_t DeviceAddr, uint8_t Output)
{
return 0;
}
/**
* @brief Sets volumee.
* @param DeviceAddr: Device address on communication Bus.
* @param Volume : volume value.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t adv7533_SetVolume(uint16_t DeviceAddr, uint8_t Volume)
{
return 0;
}
/**
* @brief Resets adv7533 registers.
* @param DeviceAddr: Device address on communication Bus.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t adv7533_Reset(uint16_t DeviceAddr)
{
return 0;
}
/**
* @brief Sets new frequency.
* @param DeviceAddr: Device address on communication Bus.
* @param AudioFreq: Audio frequency used to play the audio stream.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t adv7533_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq)
{
uint8_t tmp = 0;
tmp = HDMI_IO_Read(DeviceAddr, 0x15);
tmp &= (~0xF0);
/* Clock Configurations */
switch (AudioFreq)
{
case AUDIO_FREQUENCY_32K:
/* Sampling Frequency =32 KHZ*/
tmp |= 0x30;
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
break;
case AUDIO_FREQUENCY_44K:
/* Sampling Frequency =44,1 KHZ*/
tmp |= 0x00;
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
break;
case AUDIO_FREQUENCY_48K:
/* Sampling Frequency =48KHZ*/
tmp |= 0x20;
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
break;
case AUDIO_FREQUENCY_96K:
/* Sampling Frequency =96 KHZ*/
tmp |= 0xA0;
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
break;
case AUDIO_FREQUENCY_88K:
/* Sampling Frequency =88,2 KHZ*/
tmp |= 0x80;
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
break;
case AUDIO_FREQUENCY_176K:
/* Sampling Frequency =176,4 KHZ*/
tmp |= 0xC0;
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
break;
case AUDIO_FREQUENCY_192K:
/* Sampling Frequency =192KHZ*/
tmp |= 0xE0;
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
break;
}
return 0;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| 28.998054 | 106 | 0.63529 |
43ac88eb2db1cfaf936af7861870d739f5ab9680 | 4,689 | c | C | examples/native/mbed/test_os/test_Semaphore/test_Semaphore.c | knmcguire/gap_sdk | 7b0a09a353ab6f0550793d40bd46e98051f4a3d7 | [
"Apache-2.0"
] | 1 | 2020-01-29T15:39:31.000Z | 2020-01-29T15:39:31.000Z | examples/native/mbed/test_os/test_Semaphore/test_Semaphore.c | knmcguire/gap_sdk | 7b0a09a353ab6f0550793d40bd46e98051f4a3d7 | [
"Apache-2.0"
] | null | null | null | examples/native/mbed/test_os/test_Semaphore/test_Semaphore.c | knmcguire/gap_sdk | 7b0a09a353ab6f0550793d40bd46e98051f4a3d7 | [
"Apache-2.0"
] | 1 | 2021-07-01T15:43:05.000Z | 2021-07-01T15:43:05.000Z | /**
* @file
* Mbed OS Standard Test
* Reference : https://www.keil.com/pack/doc/CMSIS/RTOS2/html/group__CMSIS__RTOS__SemaphoreMgmt.html
*/
// MBED OS
#include "rtx_lib.h"
// GAP Driver API
#include "gap_common.h"
#define TASK_SIZE 1024
GAP_FC_DATA __attribute__ ((aligned (8))) unsigned char TASK1_STK[TASK_SIZE];
GAP_FC_DATA __attribute__ ((aligned (8))) unsigned char TASK2_STK[TASK_SIZE];
GAP_FC_DATA __attribute__ ((aligned (8))) unsigned char TASK3_STK[TASK_SIZE];
#define SEMAPHORE_SIZE 16
GAP_FC_DATA unsigned int SEMAPHORE_STK[SEMAPHORE_SIZE];
// TASK1
os_thread_t task1_obj;
const osThreadAttr_t task1_attr = {
"task_thread",
0,
&task1_obj,
sizeof(task1_obj),
TASK1_STK,
sizeof(TASK1_STK),
osPriorityNormal
};
// TASK2
os_thread_t task2_obj;
const osThreadAttr_t task2_attr = {
"task_thread",
0,
&task2_obj,
sizeof(task2_obj),
TASK2_STK,
sizeof(TASK2_STK),
osPriorityNormal
};
// TASK3
os_thread_t task3_obj;
const osThreadAttr_t task3_attr = {
"task_thread",
0,
&task3_obj,
sizeof(task3_obj),
TASK3_STK,
sizeof(TASK3_STK),
osPriorityNormal
};
osSemaphoreId_t sid_Thread_Semaphore; // semaphore id
const osSemaphoreAttr_t Thread_Semaphore_attr = {
"myThreadSem", // human readable mutex name
0, // attr_bits
SEMAPHORE_STK, // memory for control block
SEMAPHORE_SIZE // size for control block
};
int CreateSemaphore (void)
{
sid_Thread_Semaphore = osSemaphoreNew(2, 2, &Thread_Semaphore_attr);
if (!sid_Thread_Semaphore) {
// Semaphore object not created, handle failure
printf("New semaphore can not create\n");
}
return(0);
}
void task1 () {
osStatus_t val;
while(1) {
val = osSemaphoreAcquire (sid_Thread_Semaphore, 10); // wait 10 mSec
printf("Sem1 = %x, ", (int)val);
switch (val) {
case osOK:
printf("Task1 got a count, release after 1ms\n");
osDelay(1U);
osSemaphoreRelease (sid_Thread_Semaphore); // Return a token back to a semaphore
break;
case osErrorResource:
printf("Task1 can not get a count\n");
break;
case osErrorParameter:
printf("Task1 can not get a count\n");
break;
default:
break;
}
osThreadYield (); // suspend thread
}
}
void task2 () {
osStatus_t val;
while(1) {
val = osSemaphoreAcquire (sid_Thread_Semaphore, 10); // wait 10 mSec
printf("Sem2 = %x, ", (int)val);
switch (val) {
case osOK:
printf("Task2 got a count, release after 2ms\n");
osDelay(2U);
osSemaphoreRelease (sid_Thread_Semaphore); // Return a token back to a semaphore
break;
case osErrorResource:
printf("Task2 can not get a count\n");
break;
case osErrorParameter:
printf("Task2 can not get a count\n");
break;
default:
break;
}
osThreadYield (); // suspend thread
}
}
void task3 () {
osStatus_t val;
while(1) {
val = osSemaphoreAcquire (sid_Thread_Semaphore, 10); // wait 10 mSec
printf("Sem3 = %x, ", (int)val);
switch (val) {
case osOK:
printf("Task3 got a count, release after 3ms\n");
osDelay(3U);
osSemaphoreRelease (sid_Thread_Semaphore); // Return a token back to a semaphore
break;
case osErrorResource:
printf("Task3 can not get a count\n");
break;
case osErrorParameter:
printf("Task3 can not get a count\n");
break;
default:
break;
}
osThreadYield (); // suspend thread
}
}
int create_new_thread(void *task, const osThreadAttr_t *task_attr) {
osThreadId_t result = osThreadNew ((osThreadFunc_t)task, NULL, task_attr);
if ((void *)result == NULL) {
printf("New thread not created\n");
return -1;
}
return 0;
}
int main()
{
if (__is_FC()) {
printf("Fabric controller code execution for mbed_os test\n");
int error = CreateSemaphore();
error = create_new_thread(task1, &task1_attr);
error = create_new_thread(task2, &task2_attr);
error = create_new_thread(task3, &task3_attr);
printf("Created semaphore of 2 count\n");
while(1) {
printf("main: Do not disturb me ..\n");
osDelay(3);
}
if (error)
{
printf("Test failed\n");
return -1;
}
else
{
printf("Test success\n");
printf("Main thread is finished, then go to idle thread, sleep() function is not implemented ...\n");
return 0;
}
}
}
| 23.923469 | 107 | 0.616123 |
b762cf6a7f0557aad570af87ca831043916a2e90 | 12,801 | c | C | os/fs/inode/fs_files.c | ziyik/TizenRT-1 | d510c03303fcfa605bc12c60f826fa5642bbe406 | [
"Apache-2.0"
] | 511 | 2017-03-29T09:14:09.000Z | 2022-03-30T23:10:29.000Z | os/fs/inode/fs_files.c | ziyik/TizenRT-1 | d510c03303fcfa605bc12c60f826fa5642bbe406 | [
"Apache-2.0"
] | 4,673 | 2017-03-29T10:43:43.000Z | 2022-03-31T08:33:44.000Z | os/fs/inode/fs_files.c | ziyik/TizenRT-1 | d510c03303fcfa605bc12c60f826fa5642bbe406 | [
"Apache-2.0"
] | 642 | 2017-03-30T20:45:33.000Z | 2022-03-24T17:07:33.000Z | /****************************************************************************
*
* Copyright 2016 Samsung Electronics 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.
*
****************************************************************************/
/****************************************************************************
* fs/inode/fs_files.c
*
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.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.
* 3. Neither the name NuttX 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <tinyara/config.h>
#include <sys/types.h>
#include <string.h>
#include <semaphore.h>
#include <assert.h>
#include <sched.h>
#include <errno.h>
#include <tinyara/fs/fs.h>
#include <tinyara/kmalloc.h>
#include "inode/inode.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Variables
****************************************************************************/
/****************************************************************************
* Private Variables
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: _files_semtake
****************************************************************************/
static void _files_semtake(FAR struct filelist *list)
{
/* Take the semaphore (perhaps waiting) */
while (sem_wait(&list->fl_sem) != 0) {
/* The only case that an error should occr here is if
* the wait was awakened by a signal.
*/
ASSERT(get_errno() == EINTR);
}
}
/****************************************************************************
* Name: _files_semgive
****************************************************************************/
#define _files_semgive(list) sem_post(&list->fl_sem)
/****************************************************************************
* Name: _files_close
*
* Description:
* Close an inode (if open)
*
* Assumuptions:
* Caller holds the list semaphore because the file descriptor will be freed.
*
****************************************************************************/
static int _files_close(FAR struct file *filep)
{
struct inode *inode = filep->f_inode;
int ret = OK;
/* Check if the struct file is open (i.e., assigned an inode) */
if (inode) {
/* Close the file, driver, or mountpoint. */
if (inode->u.i_ops && inode->u.i_ops->close) {
/* Perform the close operation */
ret = inode->u.i_ops->close(filep);
}
/* And release the inode */
inode_release(inode);
/* Release the file descriptor */
filep->f_oflags = 0;
filep->f_pos = 0;
filep->f_inode = NULL;
}
return ret;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: files_initialize
*
* Description:
* This is called from the FS initialization logic to configure the files.
*
****************************************************************************/
void files_initialize(void)
{
}
/****************************************************************************
* Name: files_initlist
*
* Description: Initializes the list of files for a new task
*
****************************************************************************/
void files_initlist(FAR struct filelist *list)
{
DEBUGASSERT(list);
/* Initialize the list access mutex */
(void)sem_init(&list->fl_sem, 0, 1);
}
/****************************************************************************
* Name: files_releaselist
*
* Description:
* Release a reference to the file list
*
****************************************************************************/
void files_releaselist(FAR struct filelist *list)
{
int i;
DEBUGASSERT(list);
/* Close each file descriptor .. Normally, you would need take the list
* semaphore, but it is safe to ignore the semaphore in this context because
* there should not be any references in this context.
*/
for (i = 0; i < CONFIG_NFILE_DESCRIPTORS; i++) {
(void)_files_close(&list->fl_files[i]);
}
/* Destroy the semaphore */
(void)sem_destroy(&list->fl_sem);
}
/****************************************************************************
* Name: file_dup
*
* Description:
* Equivalent to the non-standard fs_dupfd() function except that it
* accepts a struct file instance instead of a file descriptor. Currently
* used only by file_vfcntl();
*
****************************************************************************/
int file_dup(FAR struct file *filep, int minfd)
{
int fd2;
struct file *filep2;
int ret;
/* Verify that fd is a valid, open file descriptor */
if (!filep || !filep->f_inode) {
set_errno(EBADF);
return ERROR;
}
/* Increment the reference count on the contained inode */
inode_addref(filep->f_inode);
/* Then allocate a new file descriptor for the inode */
fd2 = files_allocate(filep->f_inode, filep->f_oflags, filep->f_pos, minfd);
if (fd2 < 0) {
goto errout_with_inode;
}
ret = fs_getfilep(fd2, &filep2);
if (ret < 0) {
goto errout_with_inode;
}
DEBUGASSERT(filep->f_inode == filep2->f_inode);
if (filep->f_inode->u.i_ops && filep->f_inode->u.i_ops->open) {
#ifndef CONFIG_DISABLE_MOUNTPOINT
if (INODE_IS_MOUNTPT(filep->f_inode)) {
/* Dup the open file on the in the new file structure */
ret = filep->f_inode->u.i_mops->dup(filep, filep2);
} else
#endif
{
ret = filep->f_inode->u.i_ops->open(filep2);
}
/* Handle open failures */
if (ret < 0) {
goto errout_with_fd;
}
}
return fd2;
errout_with_fd:
files_release(fd2);
errout_with_inode:
inode_release(filep->f_inode);
set_errno(EMFILE);
return ERROR;
}
/****************************************************************************
* Name: file_dup2
*
* Description:
* Assign an inode to a specific files structure. This is the heart of
* dup2.
*
****************************************************************************/
int file_dup2(FAR struct file *filep1, FAR struct file *filep2)
{
FAR struct filelist *list;
FAR struct inode *inode;
int err;
int ret;
if (!filep1 || !filep1->f_inode || !filep2) {
err = EBADF;
goto errout;
}
list = sched_getfiles();
DEBUGASSERT(list);
_files_semtake(list);
/* If there is already an inode contained in the new file structure,
* close the file and release the inode.
*/
ret = _files_close(filep2);
if (ret < 0) {
/* An error occurred while closing the driver */
goto errout_with_ret;
}
/* Increment the reference count on the contained inode */
inode = filep1->f_inode;
inode_addref(inode);
/* Then clone the file structure */
filep2->f_oflags = filep1->f_oflags;
filep2->f_pos = filep1->f_pos;
filep2->f_inode = inode;
/* Call the open method on the file, driver, mountpoint so that it
* can maintain the correct open counts.
*/
if (inode->u.i_ops && inode->u.i_ops->open) {
#ifndef CONFIG_DISABLE_MOUNTPOINT
if (INODE_IS_MOUNTPT(inode)) {
/* Dup the open file on the in the new file structure */
ret = inode->u.i_mops->dup(filep1, filep2);
} else
#endif
{
/* (Re-)open the pseudo file or device driver */
ret = inode->u.i_ops->open(filep2);
}
/* Handle open failures */
if (ret < 0) {
goto errout_with_inode;
}
}
_files_semgive(list);
return OK;
/* Handler various error conditions */
errout_with_inode:
inode_release(filep2->f_inode);
filep2->f_oflags = 0;
filep2->f_pos = 0;
filep2->f_inode = NULL;
errout_with_ret:
err = -ret;
_files_semgive(list);
errout:
set_errno(err);
return ERROR;
}
/****************************************************************************
* Name: files_allocate
*
* Description:
* Allocate a struct files instance and associate it with an inode instance.
* Returns the file descriptor == index into the files array.
*
****************************************************************************/
int files_allocate(FAR struct inode *inode, int oflags, off_t pos, int minfd)
{
FAR struct filelist *list;
int i;
list = sched_getfiles();
DEBUGASSERT(list);
_files_semtake(list);
for (i = minfd; i < CONFIG_NFILE_DESCRIPTORS; i++) {
if (!list->fl_files[i].f_inode) {
list->fl_files[i].f_oflags = oflags;
list->fl_files[i].f_pos = pos;
list->fl_files[i].f_inode = inode;
list->fl_files[i].f_priv = NULL;
_files_semgive(list);
return i;
}
}
_files_semgive(list);
return ERROR;
}
/****************************************************************************
* Name: files_close
*
* Description:
* Close an inode (if open)
*
* Assumuptions:
* Caller holds the list semaphore because the file descriptor will be freed.
*
****************************************************************************/
int files_close(int fd)
{
FAR struct filelist *list;
int ret;
/* Get the thread-specific file list */
list = sched_getfiles();
DEBUGASSERT(list);
/* If the file was properly opened, there should be an inode assigned */
if (fd < 0 || fd >= CONFIG_NFILE_DESCRIPTORS || !list->fl_files[fd].f_inode) {
return -EBADF;
}
/* Perform the protected close operation */
_files_semtake(list);
ret = _files_close(&list->fl_files[fd]);
_files_semgive(list);
return ret;
}
/****************************************************************************
* Name: files_release
*
* Assumuptions:
* Similar to files_close(). Called only from open() logic on error
* conditions.
*
****************************************************************************/
void files_release(int fd)
{
FAR struct filelist *list;
list = sched_getfiles();
DEBUGASSERT(list);
if (fd >= 0 && fd < CONFIG_NFILE_DESCRIPTORS) {
_files_semtake(list);
list->fl_files[fd].f_oflags = 0;
list->fl_files[fd].f_pos = 0;
list->fl_files[fd].f_inode = NULL;
_files_semgive(list);
}
}
| 27.411135 | 79 | 0.526678 |
2c0676e56fe3a8375f10ef31df372a155a13c124 | 1,956 | h | C | adios-1.9.0/src/public/adios_types.h | swatisgupta/Adaptive-compression | b97a1d3d3e0e968f59c7023c7367a7efa9f672d0 | [
"BSD-2-Clause"
] | null | null | null | adios-1.9.0/src/public/adios_types.h | swatisgupta/Adaptive-compression | b97a1d3d3e0e968f59c7023c7367a7efa9f672d0 | [
"BSD-2-Clause"
] | null | null | null | adios-1.9.0/src/public/adios_types.h | swatisgupta/Adaptive-compression | b97a1d3d3e0e968f59c7023c7367a7efa9f672d0 | [
"BSD-2-Clause"
] | null | null | null | /*
* ADIOS is freely available under the terms of the BSD license described
* in the COPYING file in the top level directory of this source distribution.
*
* Copyright (c) 2008 - 2009. UT-BATTELLE, LLC. All rights reserved.
*/
#ifndef ADIOS_TYPES_H
#define ADIOS_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
/* global defines needed for the type creation/setup functions */
enum ADIOS_DATATYPES {adios_unknown = -1 /* (size) */
,adios_byte = 0 /* (1) */
,adios_short = 1 /* (2) */
,adios_integer = 2 /* (4) */
,adios_long = 4 /* (8) */
,adios_unsigned_byte = 50 /* (1) */
,adios_unsigned_short = 51 /* (2) */
,adios_unsigned_integer = 52 /* (4) */
,adios_unsigned_long = 54 /* (8) */
,adios_real = 5 /* (4) */
,adios_double = 6 /* (8) */
,adios_long_double = 7 /* (16) */
,adios_string = 9 /* (?) */
,adios_complex = 10 /* (8) */
,adios_double_complex = 11 /* (16) */
/* Only for attributes: char** array of strings.
Number of elements must be known externally */
,adios_string_array = 12 /* (sizeof(char*)) usually 4 */
};
enum ADIOS_FLAG {adios_flag_unknown = 0
,adios_flag_yes = 1
,adios_flag_no = 2
};
enum ADIOS_BUFFER_ALLOC_WHEN {ADIOS_BUFFER_ALLOC_UNKNOWN
,ADIOS_BUFFER_ALLOC_NOW
,ADIOS_BUFFER_ALLOC_LATER
};
#ifdef __cplusplus
}
#endif
#endif
| 34.928571 | 84 | 0.441207 |
c8ee436fb34949b96355bc2d574783ab1481e5ce | 363 | c | C | src/common/datatype.c | gvallee/collective_profiler | b4abd3ab68dfd385e15c7ad80a50630c5bde9094 | [
"BSD-3-Clause"
] | 8 | 2021-03-23T15:34:55.000Z | 2021-06-17T06:55:43.000Z | src/common/datatype.c | gvallee/collective_profiler | b4abd3ab68dfd385e15c7ad80a50630c5bde9094 | [
"BSD-3-Clause"
] | 12 | 2021-03-01T06:20:39.000Z | 2021-11-02T03:38:37.000Z | src/common/datatype.c | gvallee/collective_profiler | b4abd3ab68dfd385e15c7ad80a50630c5bde9094 | [
"BSD-3-Clause"
] | 7 | 2021-04-12T21:34:02.000Z | 2021-06-18T22:32:40.000Z | /*************************************************************************
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
*
* See LICENSE.txt for license information
************************************************************************/
#include <stdbool.h>
#include <stdlib.h>
#include <assert.h>
#include "mpi.h"
#include "datatype.h"
| 25.928571 | 74 | 0.418733 |
087434b9e09c84d4e57e5d5727467d03d806a112 | 5,441 | h | C | Saturn/src/Saturn/Scene/Components.h | BEASTSM96/Saturn-Engine | a018f5602c1583ea4802154924fb0452d7582b8d | [
"MIT"
] | 17 | 2020-10-22T14:46:27.000Z | 2022-01-12T02:09:32.000Z | Saturn/src/Saturn/Scene/Components.h | BEASTSM96/Saturn-Engine | a018f5602c1583ea4802154924fb0452d7582b8d | [
"MIT"
] | null | null | null | Saturn/src/Saturn/Scene/Components.h | BEASTSM96/Saturn-Engine | a018f5602c1583ea4802154924fb0452d7582b8d | [
"MIT"
] | 2 | 2020-12-04T04:06:54.000Z | 2020-12-21T05:38:24.000Z | /********************************************************************************************
* *
* *
* *
* MIT License *
* *
* Copyright (c) 2020 - 2021 BEAST *
* *
* 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. *
*********************************************************************************************
*/
#pragma once
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "Saturn/Core/UUID.h"
#include <string>
namespace Saturn {
/** @brief A TransformComponent.
*
* @code
*
* glm::mat4 Transform (default 1.0f)
*
* TransformComponent()
* TransformComponent(const TransformComponent&)
* TransformComponent(const glm::mat4 & Transform)
*
*
* operator glm::mat4& ()
*
* operator const glm::mat4& ()
*
* @endcode
*/
struct TransformComponent
{
glm::vec3 Position ={ 0.0f , 0.0f, 0.0f };
glm::vec3 Rotation ={ 0.0f, 0.0f, 0.0f };
glm::vec3 Scale ={ 1.0f , 1.0f, 1.0f };
glm::vec3 Up ={ 0.0f, 1.0f, 0.0f };
glm::vec3 Right ={ 1.0f, 0.0f, 0.0f };
glm::vec3 Forward ={ 0.0f, 0.0f, -1.0f };
TransformComponent( void ) = default;
TransformComponent( const TransformComponent& ) = default;
TransformComponent( const glm::vec3& Position )
: Position( Position )
{
}
glm::mat4 GetTransform() const
{
glm::mat4 rotation = glm::toMat4( glm::quat( Rotation ) );
return glm::translate( glm::mat4( 1.0f ), Position )
* rotation
* glm::scale( glm::mat4( 1.0f ), Scale );
}
#if defined ( SAT_WINDOWS )
operator glm::mat4& ( ) { return GetTransform(); }
operator const glm::mat4& ( ) const { return GetTransform(); }
#else
operator glm::mat4& ( )
{
glm::mat4 rotation = glm::toMat4( glm::quat( Rotation ) );
return glm::translate( glm::mat4( 1.0f ), Position )
* rotation
* glm::scale( glm::mat4( 1.0f ), Scale );
}
operator const glm::mat4& ( ) const
{
glm::mat4 rotation = glm::toMat4( glm::quat( Rotation ) );
return glm::translate( glm::mat4( 1.0f ), Position )
* rotation
* glm::scale( glm::mat4( 1.0f ), Scale );
}
#endif
};
/** @brief A TagComponent.
*
* @code
*
* std::string Tag;
*
* TagComponent()
* TagComponent(const TagComponent&) = default
* TagComponent(const std::string& tag)
*
* @endcode
*/
struct TagComponent
{
std::string Tag;
TagComponent() = default;
TagComponent( const TagComponent& ) = default;
TagComponent( const std::string& tag )
: Tag( tag )
{
}
};
/** @brief A IdComponent.
*
* @code
*
* UUID ID;
*
* IdComponent()
* IdComponent(const IdComponent&) = default
* IdComponent(const UUID& uuid)
*
* @endcode
*/
struct IdComponent
{
UUID ID;
IdComponent() = default;
IdComponent( const IdComponent& ) = default;
IdComponent( const UUID& uuid )
: ID( uuid )
{
}
};
/** @brief A MeshComponent.
*
* @code
*
* Ref of type Mesh
*
*
* MeshComponent()
* MeshComponent(const MeshComponent&) = default
* MeshComponent( Ref of type Mesh )
*
*
* @endcode
*/
class Mesh;
struct MeshComponent
{
Ref<Saturn::Mesh> Mesh;
MeshComponent() = default;
MeshComponent( const MeshComponent& other ) = default;
MeshComponent( Ref<Saturn::Mesh>& model )
: Mesh( model )
{
}
operator Ref<Saturn::Mesh>() { return Mesh; }
};
} | 28.486911 | 93 | 0.497151 |
860134c7389b4d89c46d9e353ec39f9690ca379d | 4,609 | h | C | nx/include/switch/services/usb.h | Atmosphere-NX/libnx | b2bee550ffc97fcb6d30cc8f9da55be53f8b97af | [
"0BSD"
] | 27 | 2018-04-28T18:47:56.000Z | 2022-03-24T01:10:10.000Z | nx/include/switch/services/usb.h | Atmosphere-NX/libnx | b2bee550ffc97fcb6d30cc8f9da55be53f8b97af | [
"0BSD"
] | null | null | null | nx/include/switch/services/usb.h | Atmosphere-NX/libnx | b2bee550ffc97fcb6d30cc8f9da55be53f8b97af | [
"0BSD"
] | 11 | 2018-06-15T21:55:26.000Z | 2022-03-27T14:55:50.000Z | /**
* @file usb.h
* @brief Common USB (usb:*) service IPC header.
* @author SciresM, yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/sm.h"
#include "../kernel/event.h"
/// Names starting with "libusb" were changed to "usb" to avoid collision with actual libusb if it's ever used.
/// Imported from libusb with changed names.
/* Descriptor sizes per descriptor type */
#define USB_DT_INTERFACE_SIZE 9
#define USB_DT_ENDPOINT_SIZE 7
#define USB_DT_DEVICE_SIZE 0x12
#define USB_DT_SS_ENDPOINT_COMPANION_SIZE 6
/// Imported from libusb, with some adjustments.
struct usb_endpoint_descriptor {
uint8_t bLength;
uint8_t bDescriptorType; ///< Must match USB_DT_ENDPOINT.
uint8_t bEndpointAddress; ///< Should be one of the usb_endpoint_direction values, the endpoint-number is automatically allocated.
uint8_t bmAttributes;
uint16_t wMaxPacketSize;
uint8_t bInterval;
};
/// Imported from libusb, with some adjustments.
struct usb_interface_descriptor {
uint8_t bLength;
uint8_t bDescriptorType; ///< Must match USB_DT_INTERFACE.
uint8_t bInterfaceNumber; ///< See also USBDS_DEFAULT_InterfaceNumber.
uint8_t bAlternateSetting; ///< Must match 0.
uint8_t bNumEndpoints;
uint8_t bInterfaceClass;
uint8_t bInterfaceSubClass;
uint8_t bInterfaceProtocol;
uint8_t iInterface; ///< Ignored.
};
/// Imported from libusb, with some adjustments.
struct usb_device_descriptor {
uint8_t bLength;
uint8_t bDescriptorType; ///< Must match USB_DT_Device.
uint16_t bcdUSB;
uint8_t bDeviceClass;
uint8_t bDeviceSubClass;
uint8_t bDeviceProtocol;
uint8_t bMaxPacketSize0;
uint16_t idVendor;
uint16_t idProduct;
uint16_t bcdDevice;
uint8_t iManufacturer;
uint8_t iProduct;
uint8_t iSerialNumber;
uint8_t bNumConfigurations;
};
/// Imported from libusb, with some adjustments.
struct usb_config_descriptor {
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t wTotalLength;
uint8_t bNumInterfaces;
uint8_t bConfigurationValue;
uint8_t iConfiguration;
uint8_t bmAttributes;
uint8_t MaxPower;
};
/// Imported from libusb, with some adjustments.
struct usb_ss_endpoint_companion_descriptor {
uint8_t bLength;
uint8_t bDescriptorType; ///< Must match USB_DT_SS_ENDPOINT_COMPANION.
uint8_t bMaxBurst;
uint8_t bmAttributes;
uint16_t wBytesPerInterval;
};
/// Imported from libusb, with some adjustments.
struct usb_string_descriptor {
uint8_t bLength;
uint8_t bDescriptorType; ///< Must match USB_DT_STRING.
uint16_t wData[0x40];
};
/// Imported from libusb, with changed names.
enum usb_class_code {
USB_CLASS_PER_INTERFACE = 0,
USB_CLASS_AUDIO = 1,
USB_CLASS_COMM = 2,
USB_CLASS_HID = 3,
USB_CLASS_PHYSICAL = 5,
USB_CLASS_PRINTER = 7,
USB_CLASS_PTP = 6, /* legacy name from libusb-0.1 usb.h */
USB_CLASS_IMAGE = 6,
USB_CLASS_MASS_STORAGE = 8,
USB_CLASS_HUB = 9,
USB_CLASS_DATA = 10,
USB_CLASS_SMART_CARD = 0x0b,
USB_CLASS_CONTENT_SECURITY = 0x0d,
USB_CLASS_VIDEO = 0x0e,
USB_CLASS_PERSONAL_HEALTHCARE = 0x0f,
USB_CLASS_DIAGNOSTIC_DEVICE = 0xdc,
USB_CLASS_WIRELESS = 0xe0,
USB_CLASS_APPLICATION = 0xfe,
USB_CLASS_VENDOR_SPEC = 0xff
};
/// Imported from libusb, with changed names.
enum usb_descriptor_type {
USB_DT_DEVICE = 0x01,
USB_DT_CONFIG = 0x02,
USB_DT_STRING = 0x03,
USB_DT_INTERFACE = 0x04,
USB_DT_ENDPOINT = 0x05,
USB_DT_BOS = 0x0f,
USB_DT_DEVICE_CAPABILITY = 0x10,
USB_DT_HID = 0x21,
USB_DT_REPORT = 0x22,
USB_DT_PHYSICAL = 0x23,
USB_DT_HUB = 0x29,
USB_DT_SUPERSPEED_HUB = 0x2a,
USB_DT_SS_ENDPOINT_COMPANION = 0x30
};
/// Imported from libusb, with changed names.
enum usb_endpoint_direction {
USB_ENDPOINT_IN = 0x80,
USB_ENDPOINT_OUT = 0x00
};
/// Imported from libusb, with changed names.
enum usb_transfer_type {
USB_TRANSFER_TYPE_CONTROL = 0,
USB_TRANSFER_TYPE_ISOCHRONOUS = 1,
USB_TRANSFER_TYPE_BULK = 2,
USB_TRANSFER_TYPE_INTERRUPT = 3,
USB_TRANSFER_TYPE_BULK_STREAM = 4,
};
/// Imported from libusb, with changed names.
enum usb_iso_sync_type {
USB_ISO_SYNC_TYPE_NONE = 0,
USB_ISO_SYNC_TYPE_ASYNC = 1,
USB_ISO_SYNC_TYPE_ADAPTIVE = 2,
USB_ISO_SYNC_TYPE_SYNC = 3
};
/// Imported from libusb, with changed names.
enum usb_iso_usage_type {
USB_ISO_USAGE_TYPE_DATA = 0,
USB_ISO_USAGE_TYPE_FEEDBACK = 1,
USB_ISO_USAGE_TYPE_IMPLICIT = 2,
};
| 28.80625 | 135 | 0.72315 |
886870ecd270e9f56d8a16cab81e22630167893f | 761 | h | C | MySlambook2/ch13/gx_tinySLAM/include/myslam/config.h | liuyang9609/SLAMProgramming | 69522f6332e21183e6e0e5c34a9f48c9c580bb43 | [
"MIT"
] | null | null | null | MySlambook2/ch13/gx_tinySLAM/include/myslam/config.h | liuyang9609/SLAMProgramming | 69522f6332e21183e6e0e5c34a9f48c9c580bb43 | [
"MIT"
] | null | null | null | MySlambook2/ch13/gx_tinySLAM/include/myslam/config.h | liuyang9609/SLAMProgramming | 69522f6332e21183e6e0e5c34a9f48c9c580bb43 | [
"MIT"
] | null | null | null | #pragma once
#ifndef MYSLAM_CONFIG_H
#define MYSLAM_CONFIG_H
#include "myslam/common_include.h"
namespace myslam {
/**
* 配置类,使用SetParameterFile确定配置文件
* 然后用Get得到对应值
* 单例模式
*/
class Config {
private:
static std::shared_ptr<Config> config_;
cv::FileStorage file_;
Config() {} // private constructor makes a singleton
public:
~Config(); // close the file when deconstructing
// set a new config file
static bool SetParameterFile(const std::string &filename);
// access the parameter values
template<typename T>
static T Get(const std::string &key) {
return T(Config::config_->file_[key]);
}
};
} // namespace myslam
#endif // MYSLAM_CONFIG_H
| 21.742857 | 66 | 0.633377 |
88f3fb7bcebcb1d4e41d2d88f1548b1d2d7c4f2f | 930 | h | C | SDKs/CryCode/3.6.15/CryEngine/CryAction/VehicleSystem/VehiclePartAnimatedChar.h | amrhead/FireNET | 34d439aa0157b0c895b20b2b664fddf4f9b84af1 | [
"BSD-2-Clause"
] | 4 | 2017-12-18T20:10:16.000Z | 2021-02-07T21:21:24.000Z | SDKs/CryCode/3.8.1/CryEngine/CryAction/VehicleSystem/VehiclePartAnimatedChar.h | amrhead/FireNET | 34d439aa0157b0c895b20b2b664fddf4f9b84af1 | [
"BSD-2-Clause"
] | null | null | null | SDKs/CryCode/3.8.1/CryEngine/CryAction/VehicleSystem/VehiclePartAnimatedChar.h | amrhead/FireNET | 34d439aa0157b0c895b20b2b664fddf4f9b84af1 | [
"BSD-2-Clause"
] | 3 | 2019-03-11T21:36:15.000Z | 2021-02-07T21:21:26.000Z | /*************************************************************************
Crytek Source File.
Copyright (C), Crytek Studios, 2001-2011.
-------------------------------------------------------------------------
$Id$
$DateTime$
Description: Implements a part for vehicles which extends the VehiclePartAnimated
but provides for using living entity type, useful for walkers
-------------------------------------------------------------------------
History:
- 24:08:2011: Created by Richard Semmens
*************************************************************************/
#ifndef __VEHICLEPARTANIMATEDCHAR_H__
#define __VEHICLEPARTANIMATEDCHAR_H__
#include "VehiclePartAnimated.h"
class CVehiclePartAnimatedChar
: public CVehiclePartAnimated
{
IMPLEMENT_VEHICLEOBJECT
public:
CVehiclePartAnimatedChar();
virtual ~CVehiclePartAnimatedChar();
// IVehiclePart
virtual void Physicalize();
// ~IVehiclePart
};
#endif
| 27.352941 | 81 | 0.541935 |
0053c618e30e77abbc17deb233cc3011fa269ddb | 3,822 | h | C | Include/10.0.17134.0/cppwinrt/winrt/impl/Windows.UI.Text.Core.2.h | sezero/windows-sdk-headers | e8e9d4d50769ded01a2df905c6bf4355eb3fa8b5 | [
"MIT"
] | 5 | 2020-05-29T06:22:17.000Z | 2021-11-28T08:21:38.000Z | Include/10.0.17134.0/cppwinrt/winrt/impl/Windows.UI.Text.Core.2.h | sezero/windows-sdk-headers | e8e9d4d50769ded01a2df905c6bf4355eb3fa8b5 | [
"MIT"
] | null | null | null | Include/10.0.17134.0/cppwinrt/winrt/impl/Windows.UI.Text.Core.2.h | sezero/windows-sdk-headers | e8e9d4d50769ded01a2df905c6bf4355eb3fa8b5 | [
"MIT"
] | 5 | 2020-05-30T04:15:11.000Z | 2021-11-28T08:48:56.000Z | // C++/WinRT v1.0.180227.3
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "winrt/impl/Windows.Foundation.1.h"
#include "winrt/impl/Windows.Globalization.1.h"
#include "winrt/impl/Windows.UI.Text.1.h"
#include "winrt/impl/Windows.UI.ViewManagement.1.h"
#include "winrt/impl/Windows.UI.Text.Core.1.h"
WINRT_EXPORT namespace winrt::Windows::UI::Text::Core {
struct CoreTextRange
{
int32_t StartCaretPosition;
int32_t EndCaretPosition;
};
inline bool operator==(CoreTextRange const& left, CoreTextRange const& right) noexcept
{
return left.StartCaretPosition == right.StartCaretPosition && left.EndCaretPosition == right.EndCaretPosition;
}
inline bool operator!=(CoreTextRange const& left, CoreTextRange const& right) noexcept
{
return !(left == right);
}
}
namespace winrt::impl {
}
WINRT_EXPORT namespace winrt::Windows::UI::Text::Core {
struct WINRT_EBO CoreTextCompositionCompletedEventArgs :
Windows::UI::Text::Core::ICoreTextCompositionCompletedEventArgs
{
CoreTextCompositionCompletedEventArgs(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextCompositionSegment :
Windows::UI::Text::Core::ICoreTextCompositionSegment
{
CoreTextCompositionSegment(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextCompositionStartedEventArgs :
Windows::UI::Text::Core::ICoreTextCompositionStartedEventArgs
{
CoreTextCompositionStartedEventArgs(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextEditContext :
Windows::UI::Text::Core::ICoreTextEditContext,
impl::require<CoreTextEditContext, Windows::UI::Text::Core::ICoreTextEditContext2>
{
CoreTextEditContext(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextFormatUpdatingEventArgs :
Windows::UI::Text::Core::ICoreTextFormatUpdatingEventArgs
{
CoreTextFormatUpdatingEventArgs(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextLayoutBounds :
Windows::UI::Text::Core::ICoreTextLayoutBounds
{
CoreTextLayoutBounds(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextLayoutRequest :
Windows::UI::Text::Core::ICoreTextLayoutRequest
{
CoreTextLayoutRequest(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextLayoutRequestedEventArgs :
Windows::UI::Text::Core::ICoreTextLayoutRequestedEventArgs
{
CoreTextLayoutRequestedEventArgs(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextSelectionRequest :
Windows::UI::Text::Core::ICoreTextSelectionRequest
{
CoreTextSelectionRequest(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextSelectionRequestedEventArgs :
Windows::UI::Text::Core::ICoreTextSelectionRequestedEventArgs
{
CoreTextSelectionRequestedEventArgs(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextSelectionUpdatingEventArgs :
Windows::UI::Text::Core::ICoreTextSelectionUpdatingEventArgs
{
CoreTextSelectionUpdatingEventArgs(std::nullptr_t) noexcept {}
};
struct CoreTextServicesConstants
{
CoreTextServicesConstants() = delete;
static char16_t HiddenCharacter();
};
struct WINRT_EBO CoreTextServicesManager :
Windows::UI::Text::Core::ICoreTextServicesManager
{
CoreTextServicesManager(std::nullptr_t) noexcept {}
static Windows::UI::Text::Core::CoreTextServicesManager GetForCurrentView();
};
struct WINRT_EBO CoreTextTextRequest :
Windows::UI::Text::Core::ICoreTextTextRequest
{
CoreTextTextRequest(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextTextRequestedEventArgs :
Windows::UI::Text::Core::ICoreTextTextRequestedEventArgs
{
CoreTextTextRequestedEventArgs(std::nullptr_t) noexcept {}
};
struct WINRT_EBO CoreTextTextUpdatingEventArgs :
Windows::UI::Text::Core::ICoreTextTextUpdatingEventArgs
{
CoreTextTextUpdatingEventArgs(std::nullptr_t) noexcept {}
};
}
| 27.695652 | 114 | 0.774725 |
159f20e0439d9ec7751331da9d8b6354b786b0de | 775 | h | C | src/Camera.h | NoahR02/MinecraftClone | e0b1621a15a0ce4726cac66e7a418ce38c3756dd | [
"Unlicense"
] | null | null | null | src/Camera.h | NoahR02/MinecraftClone | e0b1621a15a0ce4726cac66e7a418ce38c3756dd | [
"Unlicense"
] | null | null | null | src/Camera.h | NoahR02/MinecraftClone | e0b1621a15a0ce4726cac66e7a418ce38c3756dd | [
"Unlicense"
] | null | null | null | #pragma once
/*
* TODO:
* Research the math behind the camera code and make it smoother.
*/
/**
*
* Almost all of the camera code is from this youtube tutorial:
* https://www.youtube.com/watch?v=86_pQCKOIPk
*
*/
#include "Renderer/ShaderProgram.h"
#include "Input.h"
#include "Window.h"
struct Camera {
glm::vec3 position;
glm::vec3 direction = {0.0f, 0.0f, -1.0f};
glm::vec3 up = {0.0f, 1.0f, 0.0f};
int width;
int height;
bool firstClick = true;
float speed = 4.00f;
float sensitivity = 100.0f;
Camera(int width, int height, const glm::vec3& position);
void uploadMatrixToShader(float fov, float nearPlane, float farPlane, const ShaderProgram& shader);
void handleCameraInput(Window& window, const Input& input, float deltaTime);
}; | 20.394737 | 101 | 0.687742 |
15bd544ff1321b0d07ca11dcd562ec31c5382723 | 1,694 | h | C | chrome/browser/chromeos/app_mode/kiosk_app_prefs_local_state.h | GnorTech/chromium | e1c7731d5bd099ca5544fcf8eda3867d4ce5bab5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1 | 2018-03-10T13:08:49.000Z | 2018-03-10T13:08:49.000Z | chrome/browser/chromeos/app_mode/kiosk_app_prefs_local_state.h | GnorTech/chromium | e1c7731d5bd099ca5544fcf8eda3867d4ce5bab5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | chrome/browser/chromeos/app_mode/kiosk_app_prefs_local_state.h | GnorTech/chromium | e1c7731d5bd099ca5544fcf8eda3867d4ce5bab5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1 | 2020-11-04T07:19:31.000Z | 2020-11-04T07:19:31.000Z | // Copyright 2013 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_CHROMEOS_APP_MODE_KIOSK_APP_PREFS_LOCAL_STATE_H_
#define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_PREFS_LOCAL_STATE_H_
#include <string>
#include "base/basictypes.h"
#include "base/observer_list.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_prefs.h"
class PrefService;
namespace chromeos {
class KioskAppManager;
// Implements KioskAppPrefs persisted in local state.
class KioskAppPrefsLocalState : public KioskAppPrefs {
public:
// KioskAppPrefs overrides:
virtual std::string GetAutoLaunchApp() const OVERRIDE;
virtual void SetAutoLaunchApp(const std::string& app_id) OVERRIDE;
virtual bool GetSuppressAutoLaunch() const OVERRIDE;
virtual void SetSuppressAutoLaunch(bool suppress) OVERRIDE;
virtual void GetApps(AppIds* app_ids) const OVERRIDE;
virtual void AddApp(const std::string& app_id) OVERRIDE;
virtual void RemoveApp(const std::string& app_id) OVERRIDE;
virtual void AddObserver(KioskAppPrefsObserver* observer) OVERRIDE;
virtual void RemoveObserver(KioskAppPrefsObserver* observer) OVERRIDE;
private:
friend class KioskAppManager;
KioskAppPrefsLocalState();
virtual ~KioskAppPrefsLocalState();
// Returns true if |app_id| is in prefs.
bool HasApp(const std::string& app_id) const;
PrefService* local_state_; // Not owned.
ObserverList<KioskAppPrefsObserver, true> observers_;
DISALLOW_COPY_AND_ASSIGN(KioskAppPrefsLocalState);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_PREFS_LOCAL_STATE_H_
| 32.576923 | 74 | 0.803424 |
4b9ecb3d8c5e918b479ce492807f470ee3890933 | 478 | h | C | sources/vehicle.h | xiasun/vehicles_tracking | 18234c3a79bf97cc9f54875a5d9acdcda539b045 | [
"Apache-2.0"
] | 1 | 2019-12-08T03:53:35.000Z | 2019-12-08T03:53:35.000Z | sources/vehicle.h | xiasun/vehicles_tracking | 18234c3a79bf97cc9f54875a5d9acdcda539b045 | [
"Apache-2.0"
] | null | null | null | sources/vehicle.h | xiasun/vehicles_tracking | 18234c3a79bf97cc9f54875a5d9acdcda539b045 | [
"Apache-2.0"
] | null | null | null | #ifndef VEHICLE_H
#define VEHICLE_H
#include <vector>
#include <opencv2/opencv.hpp>
#include "box2.h"
class Vehicle {
public:
explicit Vehicle();
explicit Vehicle(box firstBox);
~Vehicle();
std::string brand;
std::string size;
int numFrames; // total number of frames, to calculate speed
std::vector<box> boxes; // boxes for each frame
std::vector<cv::Mat> screenShots;
bool out; // vehicle already out of boundary
};
#endif // VEHICLE_H
| 20.782609 | 64 | 0.679916 |
c61514884e119312c7039d99a30eee2af065e971 | 1,089 | h | C | src/scanresults.h | loh-tar/wpa-cute | 4dca47d842b8a26b99e100585446928c735a82b3 | [
"BSD-3-Clause"
] | 21 | 2018-12-13T16:41:16.000Z | 2022-03-17T03:24:08.000Z | src/scanresults.h | loh-tar/wpa-cute | 4dca47d842b8a26b99e100585446928c735a82b3 | [
"BSD-3-Clause"
] | 9 | 2018-08-13T14:47:14.000Z | 2021-01-15T06:21:49.000Z | src/scanresults.h | loh-tar/wpa-cute | 4dca47d842b8a26b99e100585446928c735a82b3 | [
"BSD-3-Clause"
] | 7 | 2018-09-28T08:35:18.000Z | 2022-03-02T03:56:31.000Z | /*
* wpaCute - A graphical wpa_supplicant front end
* Copyright (C) 2018 loh.tar@googlemail.com
*
* wpa_gui - ScanResults class
* Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See COPYING for more details.
*/
#ifndef SCANRESULTS_H
#define SCANRESULTS_H
#include <QObject>
#include "ui_scanresults.h"
class WpaGui;
class ScanResults : public QDialog, public Ui::ScanResults
{
Q_OBJECT
public:
ScanResults(WpaGui* _wpagui);
~ScanResults();
enum ScanResultsColumn {
SRColSsid = 0,
SRColBssid,
SRColSignal,
SRColFreq,
SRColFlags,
};
public slots:
void requestScan();
void updateResults();
protected slots:
void languageChange();
void networkSelected(QTreeWidgetItem* curr);
void addNetwork();
void showWpsDialog();
void chooseNetwork();
private:
WpaGui* wpagui;
bool wpsIsSupported;
QString selectedNetworkId;
QTreeWidgetItem* selectedNetwork;
};
#endif /* SCANRESULTS_H */
| 19.446429 | 71 | 0.673095 |
c6151cc93e1f380faf3b56c5344ba82da2472c76 | 24,161 | h | C | components/password_manager/core/browser/password_store.h | google-ar/chromium | 2441c86a5fd975f09a6c30cddb57dfb7fc239699 | [
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 777 | 2017-08-29T15:15:32.000Z | 2022-03-21T05:29:41.000Z | components/password_manager/core/browser/password_store.h | harrymarkovskiy/WebARonARCore | 2441c86a5fd975f09a6c30cddb57dfb7fc239699 | [
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 66 | 2017-08-30T18:31:18.000Z | 2021-08-02T10:59:35.000Z | components/password_manager/core/browser/password_store.h | harrymarkovskiy/WebARonARCore | 2441c86a5fd975f09a6c30cddb57dfb7fc239699 | [
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 123 | 2017-08-30T01:19:34.000Z | 2022-03-17T22:55:31.000Z | // Copyright 2014 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_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_H_
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_H_
#include <memory>
#include <ostream>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/observer_list_threadsafe.h"
#include "base/single_thread_task_runner.h"
#include "base/time/time.h"
#include "components/keyed_service/core/refcounted_keyed_service.h"
#include "components/password_manager/core/browser/password_reuse_detector.h"
#include "components/password_manager/core/browser/password_reuse_detector_consumer.h"
#include "components/password_manager/core/browser/password_store_change.h"
#include "components/password_manager/core/browser/password_store_sync.h"
#include "components/sync/model/syncable_service.h"
class PasswordStoreProxyMac;
namespace autofill {
struct PasswordForm;
}
namespace syncer {
class SyncableService;
}
namespace password_manager {
class AffiliatedMatchHelper;
class PasswordStoreConsumer;
class PasswordSyncableService;
struct InteractionsStats;
// Interface for storing form passwords in a platform-specific secure way.
// The login request/manipulation API is not threadsafe and must be used
// from the UI thread.
// Implementations, however, should carry out most tasks asynchronously on a
// background thread: the base class provides functionality to facilitate this.
// I/O heavy initialization should also be performed asynchronously in this
// manner. If this deferred initialization fails, all subsequent method calls
// should fail without side effects, return no data, and send no notifications.
// PasswordStoreSync is a hidden base class because only PasswordSyncableService
// needs to access these methods.
class PasswordStore : protected PasswordStoreSync,
public RefcountedKeyedService {
public:
// An interface used to notify clients (observers) of this object that data in
// the password store has changed. Register the observer via
// PasswordStore::AddObserver.
class Observer {
public:
// Notifies the observer that password data changed. Will be called from
// the UI thread.
virtual void OnLoginsChanged(const PasswordStoreChangeList& changes) = 0;
protected:
virtual ~Observer() {}
};
// Represents a subset of autofill::PasswordForm needed for credential
// retrievals.
struct FormDigest {
FormDigest(autofill::PasswordForm::Scheme scheme,
const std::string& signon_realm,
const GURL& origin);
explicit FormDigest(const autofill::PasswordForm& form);
FormDigest(const FormDigest& other);
FormDigest(FormDigest&& other);
FormDigest& operator=(const FormDigest& other);
FormDigest& operator=(FormDigest&& other);
bool operator==(const FormDigest& other) const;
autofill::PasswordForm::Scheme scheme;
std::string signon_realm;
GURL origin;
};
PasswordStore(scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner);
// Reimplement this to add custom initialization. Always call this too.
virtual bool Init(const syncer::SyncableService::StartSyncFlare& flare);
// RefcountedKeyedService:
void ShutdownOnUIThread() override;
// Sets the affiliation-based match |helper| that will be used by subsequent
// GetLogins() calls to return credentials stored not only for the requested
// sign-on realm, but also for affiliated Android applications. If |helper| is
// null, clears the the currently set helper if any. Unless a helper is set,
// affiliation-based matching is disabled. The passed |helper| must already be
// initialized if it is non-null.
void SetAffiliatedMatchHelper(std::unique_ptr<AffiliatedMatchHelper> helper);
AffiliatedMatchHelper* affiliated_match_helper() const {
return affiliated_match_helper_.get();
}
// Toggles whether or not to propagate password changes in Android credentials
// to the affiliated Web credentials.
void enable_propagating_password_changes_to_web_credentials(bool enabled) {
is_propagating_password_changes_to_web_credentials_enabled_ = enabled;
}
// Adds the given PasswordForm to the secure password store asynchronously.
virtual void AddLogin(const autofill::PasswordForm& form);
// Updates the matching PasswordForm in the secure password store (async).
// If any of the primary key fields (signon_realm, origin, username_element,
// username_value, password_element) are updated, then the second version of
// the method must be used that takes |old_primary_key|, i.e., the old values
// for the primary key fields (the rest of the fields are ignored).
virtual void UpdateLogin(const autofill::PasswordForm& form);
virtual void UpdateLoginWithPrimaryKey(
const autofill::PasswordForm& new_form,
const autofill::PasswordForm& old_primary_key);
// Removes the matching PasswordForm from the secure password store (async).
virtual void RemoveLogin(const autofill::PasswordForm& form);
// Remove all logins whose origins match the given filter and that were
// created
// in the given date range. |completion| will be posted to the
// |main_thread_runner_| after deletions have been completed and notification
// have been sent out.
void RemoveLoginsByURLAndTime(
const base::Callback<bool(const GURL&)>& url_filter,
base::Time delete_begin,
base::Time delete_end,
const base::Closure& completion);
// Removes all logins created in the given date range. If |completion| is not
// null, it will be posted to the |main_thread_runner_| after deletions have
// be completed and notification have been sent out.
void RemoveLoginsCreatedBetween(base::Time delete_begin,
base::Time delete_end,
const base::Closure& completion);
// Removes all logins synced in the given date range.
void RemoveLoginsSyncedBetween(base::Time delete_begin,
base::Time delete_end);
// Removes all the stats created in the given date range.
// If |origin_filter| is not null, only statistics for matching origins are
// removed. If |completion| is not null, it will be posted to the
// |main_thread_runner_| after deletions have been completed.
// Should be called on the UI thread.
void RemoveStatisticsByOriginAndTime(
const base::Callback<bool(const GURL&)>& origin_filter,
base::Time delete_begin,
base::Time delete_end,
const base::Closure& completion);
// Sets the 'skip_zero_click' flag for all logins in the database that match
// |origin_filter| to 'true'. |completion| will be posted to
// the |main_thread_runner_| after these modifications are completed
// and notifications are sent out.
void DisableAutoSignInForOrigins(
const base::Callback<bool(const GURL&)>& origin_filter,
const base::Closure& completion);
// Removes cached affiliation data that is no longer needed; provided that
// affiliation-based matching is enabled.
void TrimAffiliationCache();
// Searches for a matching PasswordForm, and notifies |consumer| on
// completion. The request will be cancelled if the consumer is destroyed.
virtual void GetLogins(const FormDigest& form,
PasswordStoreConsumer* consumer);
// Gets the complete list of PasswordForms that are not blacklist entries--and
// are thus auto-fillable. |consumer| will be notified on completion.
// The request will be cancelled if the consumer is destroyed.
virtual void GetAutofillableLogins(PasswordStoreConsumer* consumer);
// Same as above, but also fills in |affiliated_web_realm| for Android
// credentials.
virtual void GetAutofillableLoginsWithAffiliatedRealms(
PasswordStoreConsumer* consumer);
// Gets the complete list of PasswordForms that are blacklist entries,
// and notify |consumer| on completion. The request will be cancelled if the
// consumer is destroyed.
virtual void GetBlacklistLogins(PasswordStoreConsumer* consumer);
// Same as above, but also fills in |affiliated_web_realm| for Android
// credentials.
virtual void GetBlacklistLoginsWithAffiliatedRealms(
PasswordStoreConsumer* consumer);
// Reports usage metrics for the database. |sync_username| and
// |custom_passphrase_sync_enabled| determine some of the UMA stats that
// may be reported.
virtual void ReportMetrics(const std::string& sync_username,
bool custom_passphrase_sync_enabled);
// Adds or replaces the statistics for the domain |stats.origin_domain|.
void AddSiteStats(const InteractionsStats& stats);
// Removes the statistics for |origin_domain|.
void RemoveSiteStats(const GURL& origin_domain);
// Retrieves the statistics for |origin_domain| and notifies |consumer| on
// completion. The request will be cancelled if the consumer is destroyed.
void GetSiteStats(const GURL& origin_domain, PasswordStoreConsumer* consumer);
// Adds an observer to be notified when the password store data changes.
void AddObserver(Observer* observer);
// Removes |observer| from the observer list.
void RemoveObserver(Observer* observer);
// Schedules the given |task| to be run on the PasswordStore's TaskRunner.
bool ScheduleTask(const base::Closure& task);
base::WeakPtr<syncer::SyncableService> GetPasswordSyncableService();
// Checks that some suffix of |input| equals to a password saved on another
// registry controlled domain than |domain|.
// If such suffix is found, |consumer|->OnReuseFound() is called on the same
// thread on which this method is called.
// |consumer| must not be null.
virtual void CheckReuse(const base::string16& input,
const std::string& domain,
PasswordReuseDetectorConsumer* consumer);
protected:
friend class base::RefCountedThreadSafe<PasswordStore>;
typedef base::Callback<PasswordStoreChangeList(void)> ModificationTask;
// Represents a single GetLogins() request. Implements functionality to filter
// results and send them to the consumer on the consumer's message loop.
class GetLoginsRequest {
public:
explicit GetLoginsRequest(PasswordStoreConsumer* consumer);
~GetLoginsRequest();
// Removes any credentials in |results| that were saved before the cutoff,
// then notifies the consumer with the remaining results.
// Note that if this method is not called before destruction, the consumer
// will not be notified.
void NotifyConsumerWithResults(
std::vector<std::unique_ptr<autofill::PasswordForm>> results);
void NotifyWithSiteStatistics(std::vector<InteractionsStats> stats);
void set_ignore_logins_cutoff(base::Time cutoff) {
ignore_logins_cutoff_ = cutoff;
}
private:
// See GetLogins(). Logins older than this will be removed from the reply.
base::Time ignore_logins_cutoff_;
scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_;
base::WeakPtr<PasswordStoreConsumer> consumer_weak_;
DISALLOW_COPY_AND_ASSIGN(GetLoginsRequest);
};
// Represents a single CheckReuse() request. Implements functionality to
// listen to reuse events and propagate them to |consumer| on the thread on
// which CheckReuseRequest is created.
class CheckReuseRequest : public PasswordReuseDetectorConsumer {
public:
// |consumer| must not be null.
explicit CheckReuseRequest(PasswordReuseDetectorConsumer* consumer);
~CheckReuseRequest() override;
// PasswordReuseDetectorConsumer
void OnReuseFound(const base::string16& password,
const std::string& saved_domain,
int saved_passwords,
int number_matches) override;
private:
const scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_;
const base::WeakPtr<PasswordReuseDetectorConsumer> consumer_weak_;
DISALLOW_COPY_AND_ASSIGN(CheckReuseRequest);
};
~PasswordStore() override;
// Get the TaskRunner to use for PasswordStore background tasks.
// By default, a SingleThreadTaskRunner on the DB thread is used, but
// subclasses can override.
virtual scoped_refptr<base::SingleThreadTaskRunner> GetBackgroundTaskRunner();
// Methods below will be run in PasswordStore's own thread.
// Synchronous implementation that reports usage metrics.
virtual void ReportMetricsImpl(const std::string& sync_username,
bool custom_passphrase_sync_enabled) = 0;
// Synchronous implementation to remove the given logins.
virtual PasswordStoreChangeList RemoveLoginsByURLAndTimeImpl(
const base::Callback<bool(const GURL&)>& url_filter,
base::Time delete_begin,
base::Time delete_end) = 0;
// Synchronous implementation to remove the given logins.
virtual PasswordStoreChangeList RemoveLoginsCreatedBetweenImpl(
base::Time delete_begin,
base::Time delete_end) = 0;
// Synchronous implementation to remove the given logins.
virtual PasswordStoreChangeList RemoveLoginsSyncedBetweenImpl(
base::Time delete_begin,
base::Time delete_end) = 0;
// Synchronous implementation to remove the statistics.
virtual bool RemoveStatisticsByOriginAndTimeImpl(
const base::Callback<bool(const GURL&)>& origin_filter,
base::Time delete_begin,
base::Time delete_end) = 0;
// Synchronous implementation to disable auto sign-in.
virtual PasswordStoreChangeList DisableAutoSignInForOriginsImpl(
const base::Callback<bool(const GURL&)>& origin_filter) = 0;
// Finds all PasswordForms with a signon_realm that is equal to, or is a
// PSL-match to that of |form|, and takes care of notifying the consumer with
// the results when done.
// Note: subclasses should implement FillMatchingLogins() instead. This needs
// to be virtual only because asynchronous behavior in PasswordStoreWin.
// TODO(engedy): Make this non-virtual once https://crbug.com/78830 is fixed.
virtual void GetLoginsImpl(const FormDigest& form,
std::unique_ptr<GetLoginsRequest> request);
// Synchronous implementation provided by subclasses to add the given login.
virtual PasswordStoreChangeList AddLoginImpl(
const autofill::PasswordForm& form) = 0;
// Synchronous implementation provided by subclasses to update the given
// login.
virtual PasswordStoreChangeList UpdateLoginImpl(
const autofill::PasswordForm& form) = 0;
// Synchronous implementation provided by subclasses to remove the given
// login.
virtual PasswordStoreChangeList RemoveLoginImpl(
const autofill::PasswordForm& form) = 0;
// Finds and returns all PasswordForms with the same signon_realm as |form|,
// or with a signon_realm that is a PSL-match to that of |form|.
virtual std::vector<std::unique_ptr<autofill::PasswordForm>>
FillMatchingLogins(const FormDigest& form) = 0;
// Synchronous implementation for manipulating with statistics.
virtual void AddSiteStatsImpl(const InteractionsStats& stats) = 0;
virtual void RemoveSiteStatsImpl(const GURL& origin_domain) = 0;
virtual std::vector<InteractionsStats> GetSiteStatsImpl(
const GURL& origin_domain) = 0;
// Log UMA stats for number of bulk deletions.
void LogStatsForBulkDeletion(int num_deletions);
// Log UMA stats for password deletions happening on clear browsing data
// since first sync during rollback.
void LogStatsForBulkDeletionDuringRollback(int num_deletions);
// PasswordStoreSync:
PasswordStoreChangeList AddLoginSync(
const autofill::PasswordForm& form) override;
PasswordStoreChangeList UpdateLoginSync(
const autofill::PasswordForm& form) override;
PasswordStoreChangeList RemoveLoginSync(
const autofill::PasswordForm& form) override;
// Called by WrapModificationTask() once the underlying data-modifying
// operation has been performed. Notifies observers that password store data
// may have been changed.
void NotifyLoginsChanged(const PasswordStoreChangeList& changes) override;
// Synchronous implementation of CheckReuse().
void CheckReuseImpl(std::unique_ptr<CheckReuseRequest> request,
const base::string16& input,
const std::string& domain);
// TaskRunner for tasks that run on the main thread (usually the UI thread).
scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_;
// TaskRunner for the DB thread. By default, this is the task runner used for
// background tasks -- see |GetBackgroundTaskRunner|.
scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner_;
private:
FRIEND_TEST_ALL_PREFIXES(PasswordStoreTest, GetLoginImpl);
FRIEND_TEST_ALL_PREFIXES(PasswordStoreTest,
UpdatePasswordsStoredForAffiliatedWebsites);
// TODO(vasilii): remove this together with PasswordStoreProxyMac.
friend class ::PasswordStoreProxyMac;
// Schedule the given |func| to be run in the PasswordStore's own thread with
// responses delivered to |consumer| on the current thread.
void Schedule(void (PasswordStore::*func)(std::unique_ptr<GetLoginsRequest>),
PasswordStoreConsumer* consumer);
// Wrapper method called on the destination thread (DB for non-mac) that
// invokes |task| and then calls back into the source thread to notify
// observers that the password store may have been modified via
// NotifyLoginsChanged(). Note that there is no guarantee that the called
// method will actually modify the password store data.
void WrapModificationTask(ModificationTask task);
// Temporary specializations of WrapModificationTask for a better stack trace.
void AddLoginInternal(const autofill::PasswordForm& form);
void UpdateLoginInternal(const autofill::PasswordForm& form);
void RemoveLoginInternal(const autofill::PasswordForm& form);
void UpdateLoginWithPrimaryKeyInternal(
const autofill::PasswordForm& new_form,
const autofill::PasswordForm& old_primary_key);
void RemoveLoginsByURLAndTimeInternal(
const base::Callback<bool(const GURL&)>& url_filter,
base::Time delete_begin,
base::Time delete_end,
const base::Closure& completion);
void RemoveLoginsCreatedBetweenInternal(base::Time delete_begin,
base::Time delete_end,
const base::Closure& completion);
void RemoveLoginsSyncedBetweenInternal(base::Time delete_begin,
base::Time delete_end);
void RemoveStatisticsByOriginAndTimeInternal(
const base::Callback<bool(const GURL&)>& origin_filter,
base::Time delete_begin,
base::Time delete_end,
const base::Closure& completion);
void DisableAutoSignInForOriginsInternal(
const base::Callback<bool(const GURL&)>& origin_filter,
const base::Closure& completion);
// Finds all non-blacklist PasswordForms, and notifies the consumer.
void GetAutofillableLoginsImpl(std::unique_ptr<GetLoginsRequest> request);
// Same as above, but also fills in |affiliated_web_realm| for Android
// credentials.
void GetAutofillableLoginsWithAffiliatedRealmsImpl(
std::unique_ptr<GetLoginsRequest> request);
// Finds all blacklist PasswordForms, and notifies the consumer.
void GetBlacklistLoginsImpl(std::unique_ptr<GetLoginsRequest> request);
// Same as above, but also fills in |affiliated_web_realm| for Android
// credentials.
void GetBlacklistLoginsWithAffiliatedRealmsImpl(
std::unique_ptr<GetLoginsRequest> request);
// Notifies |request| about the stats for |origin_domain|.
void NotifySiteStats(const GURL& origin_domain,
std::unique_ptr<GetLoginsRequest> request);
// Notifies |request| about the autofillable logins with affiliated web
// realms for Android credentials.
void NotifyLoginsWithAffiliatedRealms(
std::unique_ptr<GetLoginsRequest> request,
std::vector<std::unique_ptr<autofill::PasswordForm>> obtained_forms);
// Extended version of GetLoginsImpl that also returns credentials stored for
// the specified affiliated Android applications. That is, it finds all
// PasswordForms with a signon_realm that is either:
// * equal to that of |form|,
// * is a PSL-match to the realm of |form|,
// * is one of those in |additional_android_realms|,
// and takes care of notifying the consumer with the results when done.
void GetLoginsWithAffiliationsImpl(
const FormDigest& form,
std::unique_ptr<GetLoginsRequest> request,
const std::vector<std::string>& additional_android_realms);
// Retrieves and fills in |affiliated_web_realm| values for Android
// credentials in |forms|. Called on the main thread.
void InjectAffiliatedWebRealms(
std::vector<std::unique_ptr<autofill::PasswordForm>> forms,
std::unique_ptr<GetLoginsRequest> request);
// Schedules GetLoginsWithAffiliationsImpl() to be run on the DB thread.
void ScheduleGetLoginsWithAffiliations(
const FormDigest& form,
std::unique_ptr<GetLoginsRequest> request,
const std::vector<std::string>& additional_android_realms);
// Retrieves the currently stored form, if any, with the same primary key as
// |form|, that is, with the same signon_realm, origin, username_element,
// username_value and password_element attributes. To be called on the
// background thread.
std::unique_ptr<autofill::PasswordForm> GetLoginImpl(
const autofill::PasswordForm& primary_key);
// Called when a password is added or updated for an Android application, and
// triggers finding web sites affiliated with the Android application and
// propagating the new password to credentials for those web sites, if any.
// Called on the main thread.
void FindAndUpdateAffiliatedWebLogins(
const autofill::PasswordForm& added_or_updated_android_form);
// Posts FindAndUpdateAffiliatedWebLogins() to the main thread. Should be
// called from the background thread.
void ScheduleFindAndUpdateAffiliatedWebLogins(
const autofill::PasswordForm& added_or_updated_android_form);
// Called when a password is added or updated for an Android application, and
// propagates these changes to credentials stored for |affiliated_web_realms|
// under the same username, if there are any. Called on the background thread.
void UpdateAffiliatedWebLoginsImpl(
const autofill::PasswordForm& updated_android_form,
const std::vector<std::string>& affiliated_web_realms);
// Schedules UpdateAffiliatedWebLoginsImpl() to run on the background thread.
// Should be called from the main thread.
void ScheduleUpdateAffiliatedWebLoginsImpl(
const autofill::PasswordForm& updated_android_form,
const std::vector<std::string>& affiliated_web_realms);
// Creates PasswordSyncableService and PasswordReuseDetector instances on the
// background thread.
void InitOnBackgroundThread(
const syncer::SyncableService::StartSyncFlare& flare);
// Deletes objest that should be destroyed on the background thread.
void DestroyOnBackgroundThread();
// The observers.
scoped_refptr<base::ObserverListThreadSafe<Observer>> observers_;
std::unique_ptr<PasswordSyncableService> syncable_service_;
std::unique_ptr<AffiliatedMatchHelper> affiliated_match_helper_;
std::unique_ptr<PasswordReuseDetector> reuse_detector_;
bool is_propagating_password_changes_to_web_credentials_enabled_;
bool shutdown_called_;
DISALLOW_COPY_AND_ASSIGN(PasswordStore);
};
// For logging only.
std::ostream& operator<<(std::ostream& os,
const PasswordStore::FormDigest& digest);
} // namespace password_manager
#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_H_
| 43.849365 | 86 | 0.74881 |
eb8fcc86cc4f4d28b54ad8e26973cf156ee249a3 | 4,291 | h | C | GeneratorInterface/Core/interface/BaseHadronizer.h | bkilian15/cmssw | ad9b85e79d89f4f6c393c8cc648261366d82adca | [
"Apache-2.0"
] | null | null | null | GeneratorInterface/Core/interface/BaseHadronizer.h | bkilian15/cmssw | ad9b85e79d89f4f6c393c8cc648261366d82adca | [
"Apache-2.0"
] | null | null | null | GeneratorInterface/Core/interface/BaseHadronizer.h | bkilian15/cmssw | ad9b85e79d89f4f6c393c8cc648261366d82adca | [
"Apache-2.0"
] | null | null | null | // -*- C++ -*-
//
//
// class BaseHadronizer meant as base class for hadronizers
// implements a few common methods concerning communication with the
// gen::HadronizerFilter<...> and gen::GeneratorFilter<...> templates,
// mostly memory management regarding the GenEvent pointers and such
#ifndef gen_BaseHadronizer_h
#define gen_BaseHadronizer_h
#include <memory>
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h"
#include "SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h"
#include "GeneratorInterface/LHEInterface/interface/LHERunInfo.h"
#include "GeneratorInterface/LHEInterface/interface/LHEEvent.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "CLHEP/Random/RandomEngine.h"
// foward declarations
namespace edm {
class Event;
}
namespace CLHEP {
class HepRandomEngine;
}
namespace gen {
class BaseHadronizer {
public:
BaseHadronizer( edm::ParameterSet const& ps );
virtual ~BaseHadronizer() noexcept (false) {}
// GenRunInfo and GenEvent passing
GenRunInfoProduct &getGenRunInfo() { return genRunInfo_; }
HepMC::GenEvent *getGenEvent() { return genEvent_.release(); }
GenEventInfoProduct *getGenEventInfo() { return genEventInfo_.release(); }
virtual GenLumiInfoHeader *getGenLumiInfoHeader() const;
void resetEvent(HepMC::GenEvent *event) { genEvent_.reset(event); }
void resetEventInfo(GenEventInfoProduct *eventInfo) { genEventInfo_.reset(eventInfo); }
// LHERunInfo and LHEEvent passing
const boost::shared_ptr<lhef::LHERunInfo> &getLHERunInfo() const { return lheRunInfo_; }
void setLHERunInfo(lhef::LHERunInfo *runInfo) { lheRunInfo_.reset(runInfo); }
void setLHEEvent(lhef::LHEEvent *event) { lheEvent_.reset(event); }
// interface for accessing the EDM information from the hadronizer
void setEDMEvent(edm::Event &event) { edmEvent_ = &event; }
edm::Event &getEDMEvent() const { return *edmEvent_; }
virtual bool select(HepMC::GenEvent*) const { return true;}
void setRandomEngine(CLHEP::HepRandomEngine* v) { doSetRandomEngine(v); }
std::vector<std::string> const& sharedResources() const { return doSharedResources(); }
int randomIndex() const { return randomIndex_; }
const std::string &randomInitConfigDescription() const { return randomInitConfigDescriptions_[randomIndex_]; }
const std::string &gridpackPath() const { return gridpackPaths_[std::max(randomIndex_,0)]; }
void randomizeIndex(edm::LuminosityBlock const& lumi, CLHEP::HepRandomEngine* rengine);
void generateLHE(edm::LuminosityBlock const& lumi, CLHEP::HepRandomEngine* rengine, unsigned int ncpu);
void cleanLHE();
protected:
GenRunInfoProduct& runInfo() { return genRunInfo_; }
std::unique_ptr<HepMC::GenEvent>& event() { return genEvent_; }
std::unique_ptr<GenEventInfoProduct>& eventInfo() { return genEventInfo_; }
lhef::LHEEvent* lheEvent() { return lheEvent_.get(); }
lhef::LHERunInfo *lheRunInfo() { return lheRunInfo_.get(); }
int randomIndex_;
std::string lheFile_;
private:
virtual void doSetRandomEngine(CLHEP::HepRandomEngine* v) { }
virtual std::vector<std::string> const& doSharedResources() const { return theSharedResources; }
GenRunInfoProduct genRunInfo_;
std::unique_ptr<HepMC::GenEvent> genEvent_;
std::unique_ptr<GenEventInfoProduct> genEventInfo_;
boost::shared_ptr<lhef::LHERunInfo> lheRunInfo_;
std::unique_ptr<lhef::LHEEvent> lheEvent_;
edm::Event *edmEvent_;
static const std::vector<std::string> theSharedResources;
std::vector<double> randomInitWeights_;
std::vector<std::string> randomInitConfigDescriptions_;
std::vector<std::string> gridpackPaths_;
};
} // namespace gen
#endif // gen_BaseHadronizer_h
| 35.758333 | 114 | 0.73759 |
9db64416c6297e1bd9a0b9849d8facf43ba60f2a | 796 | c | C | code_guide/progs/20190804.review/is_balance.c | YangXiaoHei/Interview_Question_Solutions | 7c7c99be248f68c38856d655ecb4c36358bef8b1 | [
"Apache-2.0"
] | null | null | null | code_guide/progs/20190804.review/is_balance.c | YangXiaoHei/Interview_Question_Solutions | 7c7c99be248f68c38856d655ecb4c36358bef8b1 | [
"Apache-2.0"
] | null | null | null | code_guide/progs/20190804.review/is_balance.c | YangXiaoHei/Interview_Question_Solutions | 7c7c99be248f68c38856d655ecb4c36358bef8b1 | [
"Apache-2.0"
] | null | null | null | #include "ds.h"
int max(int a, int b) { return a > b ? a : b; }
int xabs(int a, int b) {
int diff = a - b;
return diff < 0 ? -diff : diff;
}
int is_balance_core(treenode *root, int *balance)
{
if (!root)
return 0;
if (!*balance)
return 0; // 这里已经不 care 最终返回什么了
int lheight = is_balance_core(root->left, balance);
int rheight = is_balance_core(root->right, balance);
if (xabs(lheight, rheight) > 1) {
*balance = 0;
return 0;
}
return 1 + max(lheight, rheight);
}
int is_balance(treenode *root)
{
int balance = 1;
is_balance_core(root, &balance);
return balance;
}
int main(int argc, char *argv[])
{
treenode *root = bst_create(5);
tree_draw(root);
printf("is balance : %d\n", is_balance(root));
}
| 19.414634 | 56 | 0.586683 |
9de202d22a3504cd214bdee04ff756e4b8448088 | 29,531 | c | C | extras/deprecated/perfmon/perfmon_intel_skx.c | yasics/vpp | a4d0956082f12ac8269fd415134af7f605c1f3c9 | [
"Apache-2.0"
] | 751 | 2017-07-13T06:16:46.000Z | 2022-03-30T09:14:35.000Z | extras/deprecated/perfmon/perfmon_intel_skx.c | yasics/vpp | a4d0956082f12ac8269fd415134af7f605c1f3c9 | [
"Apache-2.0"
] | 32 | 2021-03-24T06:04:08.000Z | 2021-09-14T02:02:22.000Z | extras/deprecated/perfmon/perfmon_intel_skx.c | yasics/vpp | a4d0956082f12ac8269fd415134af7f605c1f3c9 | [
"Apache-2.0"
] | 479 | 2017-07-13T06:17:26.000Z | 2022-03-31T18:20:43.000Z |
#include <perfmon/perfmon_intel.h>
static perfmon_intel_pmc_cpu_model_t cpu_model_table[] = {
{0x55, 0x00, 1},
{0x55, 0x01, 1},
{0x55, 0x02, 1},
{0x55, 0x03, 1},
{0x55, 0x04, 1},
};
static perfmon_intel_pmc_event_t event_table[] = {
{
.event_code = {0x00},
.umask = 0x01,
.event_name = "inst_retired.any",
},
{
.event_code = {0x00},
.umask = 0x02,
.event_name = "cpu_clk_unhalted.thread",
},
{
.event_code = {0x00},
.umask = 0x02,
.event_name = "cpu_clk_unhalted.thread_any",
},
{
.event_code = {0x00},
.umask = 0x03,
.event_name = "cpu_clk_unhalted.ref_tsc",
},
{
.event_code = {0x03},
.umask = 0x02,
.event_name = "ld_blocks.store_forward",
},
{
.event_code = {0x03},
.umask = 0x08,
.event_name = "ld_blocks.no_sr",
},
{
.event_code = {0x07},
.umask = 0x01,
.event_name = "ld_blocks_partial.address_alias",
},
{
.event_code = {0x08},
.umask = 0x01,
.event_name = "dtlb_load_misses.miss_causes_a_walk",
},
{
.event_code = {0x08},
.umask = 0x02,
.event_name = "dtlb_load_misses.walk_completed_4k",
},
{
.event_code = {0x08},
.umask = 0x04,
.event_name = "dtlb_load_misses.walk_completed_2m_4m",
},
{
.event_code = {0x08},
.umask = 0x08,
.event_name = "dtlb_load_misses.walk_completed_1g",
},
{
.event_code = {0x08},
.umask = 0x0E,
.event_name = "dtlb_load_misses.walk_completed",
},
{
.event_code = {0x08},
.umask = 0x10,
.event_name = "dtlb_load_misses.walk_pending",
},
{
.event_code = {0x08},
.umask = 0x20,
.event_name = "dtlb_load_misses.stlb_hit",
},
{
.event_code = {0x0D},
.umask = 0x01,
.event_name = "int_misc.recovery_cycles",
},
{
.event_code = {0x0D},
.umask = 0x01,
.anyt = 1,
.event_name = "int_misc.recovery_cycles_any",
},
{
.event_code = {0x0D},
.umask = 0x80,
.event_name = "int_misc.clear_resteer_cycles",
},
{
.event_code = {0x0E},
.umask = 0x01,
.cmask = 1,
.inv = 1,
.event_name = "uops_issued.stall_cycles",
},
{
.event_code = {0x0E},
.umask = 0x01,
.event_name = "uops_issued.any",
},
{
.event_code = {0x0E},
.umask = 0x20,
.event_name = "uops_issued.slow_lea",
},
{
.event_code = {0x14},
.umask = 0x01,
.event_name = "arith.divider_active",
},
{
.event_code = {0x24},
.umask = 0x21,
.event_name = "l2_rqsts.demand_data_rd_miss",
},
{
.event_code = {0x24},
.umask = 0x22,
.event_name = "l2_rqsts.rfo_miss",
},
{
.event_code = {0x24},
.umask = 0x24,
.event_name = "l2_rqsts.code_rd_miss",
},
{
.event_code = {0x24},
.umask = 0x27,
.event_name = "l2_rqsts.all_demand_miss",
},
{
.event_code = {0x24},
.umask = 0x38,
.event_name = "l2_rqsts.pf_miss",
},
{
.event_code = {0x24},
.umask = 0x3F,
.event_name = "l2_rqsts.miss",
},
{
.event_code = {0x24},
.umask = 0xc1,
.event_name = "l2_rqsts.demand_data_rd_hit",
},
{
.event_code = {0x24},
.umask = 0xc2,
.event_name = "l2_rqsts.rfo_hit",
},
{
.event_code = {0x24},
.umask = 0xc4,
.event_name = "l2_rqsts.code_rd_hit",
},
{
.event_code = {0x24},
.umask = 0xd8,
.event_name = "l2_rqsts.pf_hit",
},
{
.event_code = {0x24},
.umask = 0xE1,
.event_name = "l2_rqsts.all_demand_data_rd",
},
{
.event_code = {0x24},
.umask = 0xE2,
.event_name = "l2_rqsts.all_rfo",
},
{
.event_code = {0x24},
.umask = 0xE4,
.event_name = "l2_rqsts.all_code_rd",
},
{
.event_code = {0x24},
.umask = 0xe7,
.event_name = "l2_rqsts.all_demand_references",
},
{
.event_code = {0x24},
.umask = 0xF8,
.event_name = "l2_rqsts.all_pf",
},
{
.event_code = {0x24},
.umask = 0xFF,
.event_name = "l2_rqsts.references",
},
{
.event_code = {0x28},
.umask = 0x07,
.event_name = "core_power.lvl0_turbo_license",
},
{
.event_code = {0x28},
.umask = 0x18,
.event_name = "core_power.lvl1_turbo_license",
},
{
.event_code = {0x28},
.umask = 0x20,
.event_name = "core_power.lvl2_turbo_license",
},
{
.event_code = {0x28},
.umask = 0x40,
.event_name = "core_power.throttle",
},
{
.event_code = {0x2E},
.umask = 0x41,
.event_name = "longest_lat_cache.miss",
},
{
.event_code = {0x2E},
.umask = 0x4F,
.event_name = "longest_lat_cache.reference",
},
{
.event_code = {0x32},
.umask = 0x01,
.event_name = "sw_prefetch_access.nta",
},
{
.event_code = {0x32},
.umask = 0x02,
.event_name = "sw_prefetch_access.t0",
},
{
.event_code = {0x32},
.umask = 0x04,
.event_name = "sw_prefetch_access.t1_t2",
},
{
.event_code = {0x32},
.umask = 0x08,
.event_name = "sw_prefetch_access.prefetchw",
},
{
.event_code = {0x3C},
.umask = 0x00,
.event_name = "cpu_clk_unhalted.thread_p",
},
{
.event_code = {0x3C},
.umask = 0x00,
.anyt = 1,
.event_name = "cpu_clk_unhalted.thread_p_any",
},
{
.event_code = {0x3C},
.umask = 0x00,
.event_name = "cpu_clk_unhalted.ring0_trans",
},
{
.event_code = {0x3C},
.umask = 0x01,
.event_name = "cpu_clk_thread_unhalted.ref_xclk",
},
{
.event_code = {0x3C},
.umask = 0x01,
.anyt = 1,
.event_name = "cpu_clk_thread_unhalted.ref_xclk_any",
},
{
.event_code = {0x3C},
.umask = 0x01,
.event_name = "cpu_clk_unhalted.ref_xclk_any",
},
{
.event_code = {0x3C},
.umask = 0x01,
.event_name = "cpu_clk_unhalted.ref_xclk",
},
{
.event_code = {0x3C},
.umask = 0x02,
.event_name = "cpu_clk_thread_unhalted.one_thread_active",
},
{
.event_code = {0x48},
.umask = 0x01,
.cmask = 1,
.event_name = "l1d_pend_miss.pending_cycles",
},
{
.event_code = {0x48},
.umask = 0x01,
.event_name = "l1d_pend_miss.pending",
},
{
.event_code = {0x48},
.umask = 0x02,
.event_name = "l1d_pend_miss.fb_full",
},
{
.event_code = {0x49},
.umask = 0x01,
.event_name = "dtlb_store_misses.miss_causes_a_walk",
},
{
.event_code = {0x49},
.umask = 0x02,
.event_name = "dtlb_store_misses.walk_completed_4k",
},
{
.event_code = {0x49},
.umask = 0x04,
.event_name = "dtlb_store_misses.walk_completed_2m_4m",
},
{
.event_code = {0x49},
.umask = 0x08,
.event_name = "dtlb_store_misses.walk_completed_1g",
},
{
.event_code = {0x49},
.umask = 0x0E,
.event_name = "dtlb_store_misses.walk_completed",
},
{
.event_code = {0x49},
.umask = 0x10,
.cmask = 1,
.event_name = "dtlb_store_misses.walk_active",
},
{
.event_code = {0x49},
.umask = 0x10,
.event_name = "dtlb_store_misses.walk_pending",
},
{
.event_code = {0x49},
.umask = 0x20,
.event_name = "dtlb_store_misses.stlb_hit",
},
{
.event_code = {0x4C},
.umask = 0x01,
.event_name = "load_hit_pre.sw_pf",
},
{
.event_code = {0x4F},
.umask = 0x10,
.event_name = "ept.walk_pending",
},
{
.event_code = {0x51},
.umask = 0x01,
.event_name = "l1d.replacement",
},
{
.event_code = {0x54},
.umask = 0x01,
.event_name = "tx_mem.abort_conflict",
},
{
.event_code = {0x54},
.umask = 0x02,
.event_name = "tx_mem.abort_capacity",
},
{
.event_code = {0x54},
.umask = 0x04,
.event_name = "tx_mem.abort_hle_store_to_elided_lock",
},
{
.event_code = {0x54},
.umask = 0x08,
.event_name = "tx_mem.abort_hle_elision_buffer_not_empty",
},
{
.event_code = {0x54},
.umask = 0x10,
.event_name = "tx_mem.abort_hle_elision_buffer_mismatch",
},
{
.event_code = {0x54},
.umask = 0x20,
.event_name = "tx_mem.abort_hle_elision_buffer_unsupported_alignment",
},
{
.event_code = {0x54},
.umask = 0x40,
.event_name = "tx_mem.hle_elision_buffer_full",
},
{
.event_code = {0x59},
.umask = 0x01,
.event_name = "partial_rat_stalls.scoreboard",
},
{
.event_code = {0x5d},
.umask = 0x01,
.event_name = "tx_exec.misc1",
},
{
.event_code = {0x5d},
.umask = 0x02,
.event_name = "tx_exec.misc2",
},
{
.event_code = {0x5d},
.umask = 0x04,
.event_name = "tx_exec.misc3",
},
{
.event_code = {0x5d},
.umask = 0x08,
.event_name = "tx_exec.misc4",
},
{
.event_code = {0x5d},
.umask = 0x10,
.event_name = "tx_exec.misc5",
},
{
.event_code = {0x5E},
.umask = 0x01,
.cmask = 1,
.inv = 1,
.event_name = "rs_events.empty_end",
},
{
.event_code = {0x5E},
.umask = 0x01,
.event_name = "rs_events.empty_cycles",
},
{
.event_code = {0x60},
.umask = 0x01,
.cmask = 1,
.event_name = "offcore_requests_outstanding.cycles_with_demand_data_rd",
},
{
.event_code = {0x60},
.umask = 0x01,
.event_name = "offcore_requests_outstanding.demand_data_rd",
},
{
.event_code = {0x60},
.umask = 0x02,
.event_name = "offcore_requests_outstanding.demand_code_rd",
},
{
.event_code = {0x60},
.umask = 0x02,
.cmask = 1,
.event_name = "offcore_requests_outstanding.cycles_with_demand_code_rd",
},
{
.event_code = {0x60},
.umask = 0x04,
.event_name = "offcore_requests_outstanding.demand_rfo",
},
{
.event_code = {0x60},
.umask = 0x04,
.cmask = 1,
.event_name = "offcore_requests_outstanding.cycles_with_demand_rfo",
},
{
.event_code = {0x60},
.umask = 0x08,
.cmask = 1,
.event_name = "offcore_requests_outstanding.cycles_with_data_rd",
},
{
.event_code = {0x60},
.umask = 0x08,
.event_name = "offcore_requests_outstanding.all_data_rd",
},
{
.event_code = {0x60},
.umask = 0x10,
.event_name = "offcore_requests_outstanding.l3_miss_demand_data_rd",
},
{
.event_code = {0x79},
.umask = 0x04,
.cmask = 1,
.event_name = "idq.mite_cycles",
},
{
.event_code = {0x79},
.umask = 0x04,
.event_name = "idq.mite_uops",
},
{
.event_code = {0x79},
.umask = 0x08,
.cmask = 1,
.event_name = "idq.dsb_cycles",
},
{
.event_code = {0x79},
.umask = 0x08,
.event_name = "idq.dsb_uops",
},
{
.event_code = {0x79},
.umask = 0x10,
.event_name = "idq.ms_dsb_cycles",
},
{
.event_code = {0x79},
.umask = 0x18,
.cmask = 1,
.event_name = "idq.all_dsb_cycles_any_uops",
},
{
.event_code = {0x79},
.umask = 0x18,
.cmask = 4,
.event_name = "idq.all_dsb_cycles_4_uops",
},
{
.event_code = {0x79},
.umask = 0x20,
.event_name = "idq.ms_mite_uops",
},
{
.event_code = {0x79},
.umask = 0x24,
.event_name = "idq.all_mite_cycles_any_uops",
},
{
.event_code = {0x79},
.umask = 0x24,
.event_name = "idq.all_mite_cycles_4_uops",
},
{
.event_code = {0x79},
.umask = 0x30,
.cmask = 1,
.event_name = "idq.ms_cycles",
},
{
.event_code = {0x79},
.umask = 0x30,
.event_name = "idq.ms_uops",
},
{
.event_code = {0x79},
.umask = 0x30,
.edge = 1,
.event_name = "idq.ms_switches",
},
{
.event_code = {0x80},
.umask = 0x04,
.event_name = "icache_16b.ifdata_stall",
},
{
.event_code = {0x83},
.umask = 0x01,
.event_name = "icache_64b.iftag_hit",
},
{
.event_code = {0x83},
.umask = 0x02,
.event_name = "icache_64b.iftag_miss",
},
{
.event_code = {0x83},
.umask = 0x04,
.event_name = "icache_64b.iftag_stall",
},
{
.event_code = {0x85},
.umask = 0x01,
.event_name = "itlb_misses.miss_causes_a_walk",
},
{
.event_code = {0x85},
.umask = 0x02,
.event_name = "itlb_misses.walk_completed_4k",
},
{
.event_code = {0x85},
.umask = 0x04,
.event_name = "itlb_misses.walk_completed_2m_4m",
},
{
.event_code = {0x85},
.umask = 0x08,
.event_name = "itlb_misses.walk_completed_1g",
},
{
.event_code = {0x85},
.umask = 0x0E,
.event_name = "itlb_misses.walk_completed",
},
{
.event_code = {0x85},
.umask = 0x10,
.event_name = "itlb_misses.walk_pending",
},
{
.event_code = {0x85},
.umask = 0x10,
.event_name = "itlb_misses.walk_active",
},
{
.event_code = {0x85},
.umask = 0x20,
.event_name = "itlb_misses.stlb_hit",
},
{
.event_code = {0x87},
.umask = 0x01,
.event_name = "ild_stall.lcp",
},
{
.event_code = {0x9C},
.umask = 0x01,
.cmask = 1,
.inv = 1,
.event_name = "idq_uops_not_delivered.cycles_fe_was_ok",
},
{
.event_code = {0x9C},
.umask = 0x01,
.cmask = 1,
.event_name = "idq_uops_not_delivered.cycles_le_3_uop_deliv.core",
},
{
.event_code = {0x9C},
.umask = 0x01,
.cmask = 2,
.event_name = "idq_uops_not_delivered.cycles_le_2_uop_deliv.core",
},
{
.event_code = {0x9C},
.umask = 0x01,
.cmask = 3,
.event_name = "idq_uops_not_delivered.cycles_le_1_uop_deliv.core",
},
{
.event_code = {0x9C},
.umask = 0x01,
.cmask = 4,
.event_name = "idq_uops_not_delivered.cycles_0_uops_deliv.core",
},
{
.event_code = {0x9C},
.umask = 0x01,
.event_name = "idq_uops_not_delivered.core",
},
{
.event_code = {0xA1},
.umask = 0x01,
.event_name = "uops_dispatched_port.port_0",
},
{
.event_code = {0xA1},
.umask = 0x02,
.event_name = "uops_dispatched_port.port_1",
},
{
.event_code = {0xA1},
.umask = 0x04,
.event_name = "uops_dispatched_port.port_2",
},
{
.event_code = {0xA1},
.umask = 0x08,
.event_name = "uops_dispatched_port.port_3",
},
{
.event_code = {0xA1},
.umask = 0x10,
.event_name = "uops_dispatched_port.port_4",
},
{
.event_code = {0xA1},
.umask = 0x20,
.event_name = "uops_dispatched_port.port_5",
},
{
.event_code = {0xA1},
.umask = 0x40,
.event_name = "uops_dispatched_port.port_6",
},
{
.event_code = {0xA1},
.umask = 0x80,
.event_name = "uops_dispatched_port.port_7",
},
{
.event_code = {0xa2},
.umask = 0x01,
.event_name = "resource_stalls.any",
},
{
.event_code = {0xA2},
.umask = 0x08,
.event_name = "resource_stalls.sb",
},
{
.event_code = {0xA3},
.umask = 0x01,
.cmask = 1,
.event_name = "cycle_activity.cycles_l2_miss",
},
{
.event_code = {0xA3},
.umask = 0x04,
.cmask = 4,
.event_name = "cycle_activity.stalls_total",
},
{
.event_code = {0xA3},
.umask = 0x05,
.cmask = 5,
.event_name = "cycle_activity.stalls_l2_miss",
},
{
.event_code = {0xA3},
.umask = 0x08,
.cmask = 8,
.event_name = "cycle_activity.cycles_l1d_miss",
},
{
.event_code = {0xA3},
.umask = 0x0C,
.cmask = 12,
.event_name = "cycle_activity.stalls_l1d_miss",
},
{
.event_code = {0xA3},
.umask = 0x10,
.cmask = 16,
.event_name = "cycle_activity.cycles_mem_any",
},
{
.event_code = {0xA3},
.umask = 0x14,
.cmask = 20,
.event_name = "cycle_activity.stalls_mem_any",
},
{
.event_code = {0xA6},
.umask = 0x01,
.event_name = "exe_activity.exe_bound_0_ports",
},
{
.event_code = {0xA6},
.umask = 0x02,
.event_name = "exe_activity.1_ports_util",
},
{
.event_code = {0xA6},
.umask = 0x04,
.event_name = "exe_activity.2_ports_util",
},
{
.event_code = {0xA6},
.umask = 0x08,
.event_name = "exe_activity.3_ports_util",
},
{
.event_code = {0xA6},
.umask = 0x10,
.event_name = "exe_activity.4_ports_util",
},
{
.event_code = {0xA6},
.umask = 0x40,
.event_name = "exe_activity.bound_on_stores",
},
{
.event_code = {0xA8},
.umask = 0x01,
.event_name = "lsd.uops",
},
{
.event_code = {0xA8},
.umask = 0x01,
.cmask = 4,
.event_name = "lsd.cycles_4_uops",
},
{
.event_code = {0xA8},
.umask = 0x01,
.cmask = 1,
.event_name = "lsd.cycles_active",
},
{
.event_code = {0xAB},
.umask = 0x02,
.event_name = "dsb2mite_switches.penalty_cycles",
},
{
.event_code = {0xAE},
.umask = 0x01,
.event_name = "itlb.itlb_flush",
},
{
.event_code = {0xB0},
.umask = 0x01,
.event_name = "offcore_requests.demand_data_rd",
},
{
.event_code = {0xB0},
.umask = 0x02,
.event_name = "offcore_requests.demand_code_rd",
},
{
.event_code = {0xB0},
.umask = 0x04,
.event_name = "offcore_requests.demand_rfo",
},
{
.event_code = {0xB0},
.umask = 0x08,
.event_name = "offcore_requests.all_data_rd",
},
{
.event_code = {0xB0},
.umask = 0x10,
.event_name = "offcore_requests.l3_miss_demand_data_rd",
},
{
.event_code = {0xB0},
.umask = 0x80,
.event_name = "offcore_requests.all_requests",
},
{
.event_code = {0xB1},
.umask = 0x01,
.cmask = 4,
.event_name = "uops_executed.cycles_ge_4_uops_exec",
},
{
.event_code = {0xB1},
.umask = 0x01,
.cmask = 3,
.event_name = "uops_executed.cycles_ge_3_uops_exec",
},
{
.event_code = {0xB1},
.umask = 0x01,
.cmask = 2,
.event_name = "uops_executed.cycles_ge_2_uops_exec",
},
{
.event_code = {0xB1},
.umask = 0x01,
.cmask = 1,
.event_name = "uops_executed.cycles_ge_1_uop_exec",
},
{
.event_code = {0xB1},
.umask = 0x01,
.cmask = 1,
.inv = 1,
.event_name = "uops_executed.stall_cycles",
},
{
.event_code = {0xB1},
.umask = 0x01,
.event_name = "uops_executed.thread",
},
{
.event_code = {0xB1},
.umask = 0x02,
.event_name = "uops_executed.core",
},
{
.event_code = {0xB1},
.umask = 0x02,
.cmask = 1,
.inv = 1,
.event_name = "uops_executed.core_cycles_none",
},
{
.event_code = {0xB1},
.umask = 0x02,
.cmask = 4,
.event_name = "uops_executed.core_cycles_ge_4",
},
{
.event_code = {0xB1},
.umask = 0x02,
.cmask = 3,
.event_name = "uops_executed.core_cycles_ge_3",
},
{
.event_code = {0xB1},
.umask = 0x02,
.cmask = 2,
.event_name = "uops_executed.core_cycles_ge_2",
},
{
.event_code = {0xB1},
.umask = 0x02,
.cmask = 1,
.event_name = "uops_executed.core_cycles_ge_1",
},
{
.event_code = {0xB1},
.umask = 0x10,
.event_name = "uops_executed.x87",
},
{
.event_code = {0xB2},
.umask = 0x01,
.event_name = "offcore_requests_buffer.sq_full",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response",
},
{
.event_code = {0xBD},
.umask = 0x01,
.event_name = "tlb_flush.dtlb_thread",
},
{
.event_code = {0xBD},
.umask = 0x20,
.event_name = "tlb_flush.stlb_any",
},
{
.event_code = {0xC0},
.umask = 0x00,
.event_name = "inst_retired.any_p",
},
{
.event_code = {0xC0},
.umask = 0x01,
.event_name = "inst_retired.prec_dist",
},
{
.event_code = {0xC0},
.umask = 0x01,
.cmask = 10,
.event_name = "inst_retired.total_cycles_ps",
},
{
.event_code = {0xC2},
.umask = 0x02,
.cmask = 10,
.inv = 1,
.event_name = "uops_retired.total_cycles",
},
{
.event_code = {0xC2},
.umask = 0x02,
.cmask = 1,
.inv = 1,
.event_name = "uops_retired.stall_cycles",
},
{
.event_code = {0xC2},
.umask = 0x02,
.event_name = "uops_retired.retire_slots",
},
{
.event_code = {0xC3},
.umask = 0x01,
.cmask = 1,
.edge = 1,
.event_name = "machine_clears.count",
},
{
.event_code = {0xC3},
.umask = 0x02,
.event_name = "machine_clears.memory_ordering",
},
{
.event_code = {0xC3},
.umask = 0x04,
.event_name = "machine_clears.smc",
},
{
.event_code = {0xC4},
.umask = 0x00,
.event_name = "br_inst_retired.all_branches",
},
{
.event_code = {0xC4},
.umask = 0x01,
.event_name = "br_inst_retired.conditional",
},
{
.event_code = {0xC4},
.umask = 0x02,
.event_name = "br_inst_retired.near_call",
},
{
.event_code = {0xC4},
.umask = 0x04,
.event_name = "br_inst_retired.all_branches_pebs",
},
{
.event_code = {0xC4},
.umask = 0x08,
.event_name = "br_inst_retired.near_return",
},
{
.event_code = {0xC4},
.umask = 0x10,
.event_name = "br_inst_retired.not_taken",
},
{
.event_code = {0xC4},
.umask = 0x20,
.event_name = "br_inst_retired.near_taken",
},
{
.event_code = {0xC4},
.umask = 0x40,
.event_name = "br_inst_retired.far_branch",
},
{
.event_code = {0xC5},
.umask = 0x00,
.event_name = "br_misp_retired.all_branches",
},
{
.event_code = {0xC5},
.umask = 0x01,
.event_name = "br_misp_retired.conditional",
},
{
.event_code = {0xC5},
.umask = 0x02,
.event_name = "br_misp_retired.near_call",
},
{
.event_code = {0xC5},
.umask = 0x04,
.event_name = "br_misp_retired.all_branches_pebs",
},
{
.event_code = {0xC5},
.umask = 0x20,
.event_name = "br_misp_retired.near_taken",
},
{
.event_code = {0xC7},
.umask = 0x01,
.event_name = "fp_arith_inst_retired.scalar_double",
},
{
.event_code = {0xC7},
.umask = 0x02,
.event_name = "fp_arith_inst_retired.scalar_single",
},
{
.event_code = {0xC7},
.umask = 0x04,
.event_name = "fp_arith_inst_retired.128b_packed_double",
},
{
.event_code = {0xC7},
.umask = 0x08,
.event_name = "fp_arith_inst_retired.128b_packed_single",
},
{
.event_code = {0xC7},
.umask = 0x10,
.event_name = "fp_arith_inst_retired.256b_packed_double",
},
{
.event_code = {0xC7},
.umask = 0x20,
.event_name = "fp_arith_inst_retired.256b_packed_single",
},
{
.event_code = {0xC7},
.umask = 0x40,
.event_name = "fp_arith_inst_retired.512b_packed_double",
},
{
.event_code = {0xC7},
.umask = 0x80,
.event_name = "fp_arith_inst_retired.512b_packed_single",
},
{
.event_code = {0xC8},
.umask = 0x01,
.event_name = "hle_retired.start",
},
{
.event_code = {0xC8},
.umask = 0x02,
.event_name = "hle_retired.commit",
},
{
.event_code = {0xC8},
.umask = 0x04,
.event_name = "hle_retired.aborted",
},
{
.event_code = {0xC8},
.umask = 0x08,
.event_name = "hle_retired.aborted_mem",
},
{
.event_code = {0xC8},
.umask = 0x10,
.event_name = "hle_retired.aborted_timer",
},
{
.event_code = {0xC8},
.umask = 0x20,
.event_name = "hle_retired.aborted_unfriendly",
},
{
.event_code = {0xC8},
.umask = 0x40,
.event_name = "hle_retired.aborted_memtype",
},
{
.event_code = {0xC8},
.umask = 0x80,
.event_name = "hle_retired.aborted_events",
},
{
.event_code = {0xC9},
.umask = 0x01,
.event_name = "rtm_retired.start",
},
{
.event_code = {0xC9},
.umask = 0x02,
.event_name = "rtm_retired.commit",
},
{
.event_code = {0xC9},
.umask = 0x04,
.event_name = "rtm_retired.aborted",
},
{
.event_code = {0xC9},
.umask = 0x08,
.event_name = "rtm_retired.aborted_mem",
},
{
.event_code = {0xC9},
.umask = 0x10,
.event_name = "rtm_retired.aborted_timer",
},
{
.event_code = {0xC9},
.umask = 0x20,
.event_name = "rtm_retired.aborted_unfriendly",
},
{
.event_code = {0xC9},
.umask = 0x40,
.event_name = "rtm_retired.aborted_memtype",
},
{
.event_code = {0xC9},
.umask = 0x80,
.event_name = "rtm_retired.aborted_events",
},
{
.event_code = {0xCA},
.umask = 0x1E,
.cmask = 1,
.event_name = "fp_assist.any",
},
{
.event_code = {0xCB},
.umask = 0x01,
.event_name = "hw_interrupts.received",
},
{
.event_code = {0xCC},
.umask = 0x20,
.event_name = "rob_misc_events.lbr_inserts",
},
{
.event_code = {0xCC},
.umask = 0x40,
.event_name = "rob_misc_events.pause_inst",
},
{
.event_code = {0xD0},
.umask = 0x11,
.event_name = "mem_inst_retired.stlb_miss_loads",
},
{
.event_code = {0xD0},
.umask = 0x12,
.event_name = "mem_inst_retired.stlb_miss_stores",
},
{
.event_code = {0xD0},
.umask = 0x21,
.event_name = "mem_inst_retired.lock_loads",
},
{
.event_code = {0xD0},
.umask = 0x41,
.event_name = "mem_inst_retired.split_loads",
},
{
.event_code = {0xD0},
.umask = 0x42,
.event_name = "mem_inst_retired.split_stores",
},
{
.event_code = {0xD0},
.umask = 0x81,
.event_name = "mem_inst_retired.all_loads",
},
{
.event_code = {0xD0},
.umask = 0x82,
.event_name = "mem_inst_retired.all_stores",
},
{
.event_code = {0xD1},
.umask = 0x01,
.event_name = "mem_load_retired.l1_hit",
},
{
.event_code = {0xD1},
.umask = 0x02,
.event_name = "mem_load_retired.l2_hit",
},
{
.event_code = {0xD1},
.umask = 0x04,
.event_name = "mem_load_retired.l3_hit",
},
{
.event_code = {0xD1},
.umask = 0x08,
.event_name = "mem_load_retired.l1_miss",
},
{
.event_code = {0xD1},
.umask = 0x10,
.event_name = "mem_load_retired.l2_miss",
},
{
.event_code = {0xD1},
.umask = 0x20,
.event_name = "mem_load_retired.l3_miss",
},
{
.event_code = {0xD1},
.umask = 0x40,
.event_name = "mem_load_retired.fb_hit",
},
{
.event_code = {0xD2},
.umask = 0x01,
.event_name = "mem_load_l3_hit_retired.xsnp_miss",
},
{
.event_code = {0xD2},
.umask = 0x02,
.event_name = "mem_load_l3_hit_retired.xsnp_hit",
},
{
.event_code = {0xD2},
.umask = 0x04,
.event_name = "mem_load_l3_hit_retired.xsnp_hitm",
},
{
.event_code = {0xD2},
.umask = 0x08,
.event_name = "mem_load_l3_hit_retired.xsnp_none",
},
{
.event_code = {0xD3},
.umask = 0x01,
.event_name = "mem_load_l3_miss_retired.local_dram",
},
{
.event_code = {0xD3},
.umask = 0x02,
.event_name = "mem_load_l3_miss_retired.remote_dram",
},
{
.event_code = {0xD3},
.umask = 0x04,
.event_name = "mem_load_l3_miss_retired.remote_hitm",
},
{
.event_code = {0xD3},
.umask = 0x08,
.event_name = "mem_load_l3_miss_retired.remote_fwd",
},
{
.event_code = {0xD4},
.umask = 0x04,
.event_name = "mem_load_misc_retired.uc",
},
{
.event_code = {0xE6},
.umask = 0x01,
.event_name = "baclears.any",
},
{
.event_code = {0xEF},
.umask = 0x01,
.event_name = "core_snoop_response.rsp_ihiti",
},
{
.event_code = {0xEF},
.umask = 0x02,
.event_name = "core_snoop_response.rsp_ihitfse",
},
{
.event_code = {0xEF},
.umask = 0x04,
.event_name = "core_snoop_response.rsp_shitfse",
},
{
.event_code = {0xEF},
.umask = 0x08,
.event_name = "core_snoop_response.rsp_sfwdm",
},
{
.event_code = {0xEF},
.umask = 0x10,
.event_name = "core_snoop_response.rsp_ifwdm",
},
{
.event_code = {0xEF},
.umask = 0x20,
.event_name = "core_snoop_response.rsp_ifwdfe",
},
{
.event_code = {0xEF},
.umask = 0x40,
.event_name = "core_snoop_response.rsp_sfwdfe",
},
{
.event_code = {0xF0},
.umask = 0x40,
.event_name = "l2_trans.l2_wb",
},
{
.event_code = {0xF1},
.umask = 0x1F,
.event_name = "l2_lines_in.all",
},
{
.event_code = {0xF2},
.umask = 0x01,
.event_name = "l2_lines_out.silent",
},
{
.event_code = {0xF2},
.umask = 0x02,
.event_name = "l2_lines_out.non_silent",
},
{
.event_code = {0xF2},
.umask = 0x04,
.event_name = "l2_lines_out.useless_pref",
},
{
.event_code = {0xF2},
.umask = 0x04,
.event_name = "l2_lines_out.useless_hwpf",
},
{
.event_code = {0xF4},
.umask = 0x10,
.event_name = "sq_misc.split_lock",
},
{
.event_code = {0xFE},
.umask = 0x02,
.event_name = "idi_misc.wb_upgrade",
},
{
.event_code = {0xFE},
.umask = 0x04,
.event_name = "idi_misc.wb_downgrade",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.demand_data_rd.l3_hit.snoop_hit_with_fwd",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.demand_rfo.l3_hit.snoop_hit_with_fwd",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.demand_code_rd.l3_hit.snoop_hit_with_fwd",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.pf_l2_data_rd.l3_hit.snoop_hit_with_fwd",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.pf_l2_rfo.l3_hit.snoop_hit_with_fwd",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.pf_l3_data_rd.l3_hit.snoop_hit_with_fwd",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.pf_l3_rfo.l3_hit.snoop_hit_with_fwd",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.pf_l1d_and_sw.l3_hit.snoop_hit_with_fwd",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.all_pf_data_rd.l3_hit.snoop_hit_with_fwd",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.all_pf_rfo.l3_hit.snoop_hit_with_fwd",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.all_data_rd.l3_hit.snoop_hit_with_fwd",
},
{
.event_code = {0xB7, 0xBB},
.umask = 0x01,
.event_name = "offcore_response.all_rfo.l3_hit.snoop_hit_with_fwd",
},
{
.event_name = 0,
},
};
PERFMON_REGISTER_INTEL_PMC (cpu_model_table, event_table);
| 20.171448 | 77 | 0.582574 |
9df768067991ab1a037ac8c12964325789496276 | 3,980 | c | C | src/lpc8xx_mrt.c | panda5mt/RaVem | 92e6881fe743ef1625df4c4c20f4455b18bc9f5c | [
"MIT"
] | 7 | 2019-02-04T11:06:18.000Z | 2022-02-08T22:52:21.000Z | src/lpc8xx_mrt.c | panda5mt/RaVem | 92e6881fe743ef1625df4c4c20f4455b18bc9f5c | [
"MIT"
] | null | null | null | src/lpc8xx_mrt.c | panda5mt/RaVem | 92e6881fe743ef1625df4c4c20f4455b18bc9f5c | [
"MIT"
] | 1 | 2017-10-11T17:27:55.000Z | 2017-10-11T17:27:55.000Z | /****************************************************************************
* $Id:: lpc8xx_mrt.c 5543 2012-10-31 02:19:19Z usb00423 $
* Project: NXP LPC8xx multi-rate timer(MRT) example
*
* Description:
* This file contains MRT timer code example which include timer
* initialization, timer interrupt handler, and related APIs for
* timer setup.
*
****************************************************************************
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* products. This software is supplied "AS IS" without any warranties.
* NXP Semiconductors assumes no responsibility or liability for the
* use of the software, conveys no license or title under any patent,
* copyright, or mask work right to the product. NXP Semiconductors
* reserves the right to make changes in the software without
* notification. NXP Semiconductors also make no representation or
* warranty that such application will be suitable for the specified
* use without further testing or modification.
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, under NXP Semiconductors'
* relevant copyright in the software, without fee, provided that it
* is used in conjunction with NXP Semiconductors microcontrollers. This
* copyright, permission, and disclaimer notice must appear in all copies of
* this code.
****************************************************************************/
#include "LPC8xx.h"
#include "lpc8xx_nmi.h"
#include "lpc8xx_mrt.h"
volatile uint32_t mrt_counter = 0;
/*****************************************************************************
** Function name: delayMs
**
** Descriptions: Start the timer delay in milo seconds until elapsed
**
** parameters: timer number, Delay value in milo second
**
** Returned value: None
**
*****************************************************************************/
void delayMs(uint32_t delayInMs)
{
/* wait until delay time has elapsed */
LPC_MRT->Channel[0].INTVAL = delayInMs;
LPC_MRT->Channel[0].INTVAL |= 0x1UL<<31;
while (LPC_MRT->Channel[0].TIMER);
return;
}
/******************************************************************************
** Function name: MRT_IRQHandler
**
** Descriptions: MRT interrupt handler
**
** parameters: None
** Returned value: None
**
******************************************************************************/
void MRT_IRQHandler(void)
{
if ( LPC_MRT->Channel[0].STAT & MRT_STAT_IRQ_FLAG )
{
LPC_MRT->Channel[0].STAT = MRT_STAT_IRQ_FLAG; /* clear interrupt flag */
mrt_counter++;
}
return;
}
/******************************************************************************
** Function name: init_timer
**
** Descriptions: Initialize timer, set timer interval, reset timer,
** install timer interrupt handler
**
** parameters: timer interval
** Returned value: None
**
******************************************************************************/
void init_mrt(uint32_t TimerInterval)
{
/* Enable clock to MRT and reset the MRT peripheral */
LPC_SYSCON->SYSAHBCLKCTRL |= (0x1<<10);
LPC_SYSCON->PRESETCTRL &= ~(0x1<<7);
LPC_SYSCON->PRESETCTRL |= (0x1<<7);
mrt_counter = 0;
LPC_MRT->Channel[0].INTVAL = TimerInterval;
LPC_MRT->Channel[0].INTVAL |= 0x1UL<<31;
LPC_MRT->Channel[0].CTRL = MRT_REPEATED_MODE|MRT_INT_ENA;
/* Enable the MRT Interrupt */
#if NMI_ENABLED
NVIC_DisableIRQ( MRT_IRQn );
NMI_Init( MRT_IRQn );
#else
NVIC_EnableIRQ(MRT_IRQn);
#endif
return;
}
/******************************************************************************
** End Of File
******************************************************************************/
| 36.513761 | 81 | 0.536432 |
ca864555dfd3072632edc10c27dacc97991b89ca | 10,697 | h | C | chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h | zipated/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | // Copyright 2013 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_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_
#include <string>
#include "base/command_line.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/chromeos/login/screens/core_oobe_view.h"
#include "chrome/browser/chromeos/login/screens/gaia_view.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
#include "chromeos/login/auth/authpolicy_login_helper.h"
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "net/base/net_errors.h"
class AccountId;
namespace policy {
class TempCertsCacheNSS;
}
namespace chromeos {
class ActiveDirectoryPasswordChangeScreenHandler;
class Key;
class SigninScreenHandler;
// A class that handles WebUI hooks in Gaia screen.
class GaiaScreenHandler : public BaseScreenHandler,
public GaiaView,
public NetworkPortalDetector::Observer {
public:
enum FrameState {
FRAME_STATE_UNKNOWN = 0,
FRAME_STATE_LOADING,
FRAME_STATE_LOADED,
FRAME_STATE_ERROR
};
GaiaScreenHandler(
CoreOobeView* core_oobe_view,
const scoped_refptr<NetworkStateInformer>& network_state_informer,
ActiveDirectoryPasswordChangeScreenHandler*
active_directory_password_change_screen_handler);
~GaiaScreenHandler() override;
// GaiaView:
void MaybePreloadAuthExtension() override;
void DisableRestrictiveProxyCheckForTest() override;
void ShowGaiaAsync(const base::Optional<AccountId>& account_id) override;
private:
// TODO (xiaoyinh): remove this dependency.
friend class SigninScreenHandler;
struct GaiaContext;
void LoadGaia(const GaiaContext& context);
// Callback that loads GAIA after version and stat consent information has
// been retrieved.
void LoadGaiaWithPartition(const GaiaContext& context,
const std::string& partition_name);
// Callback that loads GAIA after version and stat consent information has
// been retrieved.
void LoadGaiaWithPartitionAndVersionAndConsent(
const GaiaContext& context,
const std::string& partition_name,
const std::string* platform_version,
const bool* collect_stats_consent);
// Sends request to reload Gaia. If |force_reload| is true, request
// will be sent in any case, otherwise it will be sent only when Gaia is
// not loading right now.
void ReloadGaia(bool force_reload);
// Turns offline idle detection on or off. Idle detection should only be on if
// we're using the offline login page but the device is online.
void MonitorOfflineIdle(bool is_online);
// Show error UI at the end of GAIA flow when user is not whitelisted.
void ShowWhitelistCheckFailedError();
// BaseScreenHandler implementation:
void DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) override;
void Initialize() override;
// WebUIMessageHandler implementation:
void RegisterMessages() override;
// NetworkPortalDetector::Observer implementation.
void OnPortalDetectionCompleted(
const NetworkState* network,
const NetworkPortalDetector::CaptivePortalState& state) override;
// WebUI message handlers.
void HandleWebviewLoadAborted(const std::string& error_reason_str);
void HandleCompleteAuthentication(const std::string& gaia_id,
const std::string& email,
const std::string& password,
const std::string& auth_code,
bool using_saml,
const std::string& gaps_cookie,
const ::login::StringList& services);
void HandleCompleteLogin(const std::string& gaia_id,
const std::string& typed_email,
const std::string& password,
bool using_saml);
void HandleCompleteAdAuthentication(const std::string& username,
const std::string& password);
void HandleCancelActiveDirectoryAuth();
void HandleUsingSAMLAPI();
void HandleScrapedPasswordCount(int password_count);
void HandleScrapedPasswordVerificationFailed();
void HandleGaiaUIReady();
void HandleIdentifierEntered(const std::string& account_identifier);
void HandleAuthExtensionLoaded();
void HandleUpdateGaiaDialogSize(int width, int height);
void HandleUpdateGaiaDialogVisibility(bool visible);
void HandleShowAddUser(const base::ListValue* args);
void OnShowAddUser();
// Really handles the complete login message.
void DoCompleteLogin(const std::string& gaia_id,
const std::string& typed_email,
const std::string& password,
bool using_saml);
// Fill GAIA user name.
void set_populated_email(const std::string& populated_email) {
populated_email_ = populated_email;
}
// Kick off cookie / local storage cleanup.
void StartClearingCookies(const base::Closure& on_clear_callback);
void OnCookiesCleared(const base::Closure& on_clear_callback);
// Kick off DNS cache flushing.
void StartClearingDnsCache();
void OnDnsCleared();
// Callback for AuthPolicyClient.
void DoAdAuth(const std::string& username,
const Key& key,
authpolicy::ErrorType error,
const authpolicy::ActiveDirectoryAccountInfo& account_info);
// Show sign-in screen for the given credentials.
// Should match the same method in SigninScreenHandler.
void ShowSigninScreenForTest(const std::string& username,
const std::string& password,
const std::string& services);
// Attempts login for test.
void SubmitLoginFormForTest();
// Updates the member variable and UMA histogram indicating whether the
// principals API was used during SAML login.
void SetSAMLPrincipalsAPIUsed(bool api_used);
// Cancels the request to show the sign-in screen while the asynchronous
// clean-up process that precedes the screen showing is in progress.
void CancelShowGaiaAsync();
// Shows signin screen after dns cache and cookie cleanup operations finish.
void ShowGaiaScreenIfReady();
// Tells webui to load authentication extension. |force| is used to force the
// extension reloading, if it has already been loaded. |offline| is true when
// offline version of the extension should be used.
void LoadAuthExtension(bool force, bool offline);
// TODO (antrim@): GaiaScreenHandler should implement
// NetworkStateInformer::Observer.
void UpdateState(NetworkError::ErrorReason reason);
// TODO (antrim@): remove this dependency.
void set_signin_screen_handler(SigninScreenHandler* handler) {
signin_screen_handler_ = handler;
}
// Are we on a restrictive proxy?
bool IsRestrictiveProxy() const;
// Returns temporary unused device Id.
std::string GetTemporaryDeviceId();
FrameState frame_state() const { return frame_state_; }
net::Error frame_error() const { return frame_error_; }
// Returns user canonical e-mail. Finds already used account alias, if
// user has already signed in.
AccountId GetAccountId(const std::string& authenticated_email,
const std::string& id,
const AccountType& account_type) const;
bool offline_login_is_active() const { return offline_login_is_active_; }
void set_offline_login_is_active(bool offline_login_is_active) {
offline_login_is_active_ = offline_login_is_active;
}
// Current state of Gaia frame.
FrameState frame_state_ = FRAME_STATE_UNKNOWN;
// Latest Gaia frame error.
net::Error frame_error_ = net::OK;
// Network state informer used to keep signin screen up.
scoped_refptr<NetworkStateInformer> network_state_informer_;
CoreOobeView* core_oobe_view_ = nullptr;
ActiveDirectoryPasswordChangeScreenHandler*
active_directory_password_change_screen_handler_ = nullptr;
// Email to pre-populate with.
std::string populated_email_;
// True if dns cache cleanup is done.
bool dns_cleared_ = false;
// True if DNS cache task is already running.
bool dns_clear_task_running_ = false;
// True if cookie jar cleanup is done.
bool cookies_cleared_ = false;
// If true, the sign-in screen will be shown when DNS cache and cookie
// clean-up finish.
bool show_when_dns_and_cookies_cleared_ = false;
// Has Gaia page silent load been started for the current sign-in attempt?
bool gaia_silent_load_ = false;
// The active network at the moment when Gaia page was preloaded.
std::string gaia_silent_load_network_;
// If the user authenticated via SAML, this indicates whether the principals
// API was used.
bool using_saml_api_ = false;
// Test credentials.
std::string test_user_;
std::string test_pass_;
// Test result of userInfo.
std::string test_services_;
bool test_expects_complete_login_ = false;
// True if proxy doesn't allow access to google.com/generate_204.
NetworkPortalDetector::CaptivePortalStatus captive_portal_status_ =
NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
std::unique_ptr<NetworkPortalDetector> network_portal_detector_;
bool disable_restrictive_proxy_check_for_test_ = false;
// Non-owning ptr to SigninScreenHandler instance. Should not be used
// in dtor.
// TODO (antrim@): GaiaScreenHandler shouldn't communicate with
// signin_screen_handler directly.
SigninScreenHandler* signin_screen_handler_ = nullptr;
// True if offline GAIA is active.
bool offline_login_is_active_ = false;
// True if the authentication extension is still loading.
bool auth_extension_being_loaded_ = false;
// Helper to call AuthPolicyClient and cancel calls if needed. Used to
// authenticate users against Active Directory server.
std::unique_ptr<AuthPolicyLoginHelper> authpolicy_login_helper_;
// Makes untrusted authority certificates from device policy available for
// client certificate discovery.
std::unique_ptr<policy::TempCertsCacheNSS> untrusted_authority_certs_cache_;
base::WeakPtrFactory<GaiaScreenHandler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(GaiaScreenHandler);
};
} // namespace chromeos
#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_
| 36.138514 | 80 | 0.730392 |
a9c2dfb0d75135d09eedb2383aa9fa3f6c58bef4 | 65,372 | c | C | text_test.c | WartyMN/A2560-FoenixRetroOS | fd4c03d78794f2cc75e9d2de6b9ce86024e5b6fa | [
"MIT"
] | null | null | null | text_test.c | WartyMN/A2560-FoenixRetroOS | fd4c03d78794f2cc75e9d2de6b9ce86024e5b6fa | [
"MIT"
] | null | null | null | text_test.c | WartyMN/A2560-FoenixRetroOS | fd4c03d78794f2cc75e9d2de6b9ce86024e5b6fa | [
"MIT"
] | null | null | null | /*
* text_test.c
*
* Created on: Feb 19, 2022
* Author: micahbly
*/
/*****************************************************************************/
/* Includes */
/*****************************************************************************/
// unit testing framework
#include "minunit.h"
// project includes
// class being tested
#include "text.h"
// C includes
#include <stdbool.h>
// A2560 includes
#include <mb/a2560_platform.h>
#include <mb/general.h>
#include <mb/lib_sys.h>
/*****************************************************************************/
/* Definitions */
/*****************************************************************************/
/*****************************************************************************/
/* Enumerations */
/*****************************************************************************/
/*****************************************************************************/
/* Global Variables */
/*****************************************************************************/
extern System* global_system;
/*****************************************************************************/
/* Private Function Prototypes */
/*****************************************************************************/
// test using sys_kbd_scancode() instead of a channel driver - TEMP - BAD
bool keyboard_test_2(void);
// test using channel driver - TEMP - BAD
bool keyboard_test(void);
/*****************************************************************************/
/* Private Function Definitions */
/*****************************************************************************/
// test using sys_kbd_scancode() instead of a channel driver - TEMP - BAD
bool keyboard_test_2(void)
{
// LOGIC:
// page 34 of FoenixMCP Manual
// try a simple loop that just keeps banging on the keyboard scanner
// keys return their keycode when pushed, and their keyboard + 128 when released.
int16_t the_code;
do
{
the_code = sys_kbd_scancode();
if (the_code > 127)
{
DEBUG_OUT(("%s %d: key released: code=%u, keycode=%u", __func__, __LINE__, the_code, the_code & 0xF0));
// handle_event_key_up()
}
else
{
DEBUG_OUT(("%s %d: key pressed: code=%u", __func__, __LINE__, the_code));
}
} while (the_code != 0);
return true;
}
// test using channel driver - TEMP - BAD
bool keyboard_test(void)
{
int16_t bytes_read = 0;
int16_t bytes_requested = 5;
static unsigned char keyboard_buff[256];
unsigned char* the_keyboard_buff = keyboard_buff;
int16_t the_channel_id;
int16_t the_device_id = 0;
bool stop = false;
int16_t y = 30;
// Text_DrawStringAtXY(ID_CHANNEL_B, 0, y++, (char*)"Trying to open keyboard device...", FG_COLOR_DK_BLUE, BG_COLOR_YELLOW);
DEBUG_OUT(("%s %d: Trying to open keyboard device...", __func__, __LINE__));
// open keyboard console for reading. Console is on device 0 and 1.
the_channel_id = sys_chan_open(the_device_id, (unsigned char*)"", 1);
if (the_channel_id < 0)
{
//DEBUG_OUT(("%s %d: Failed to open channel for device %i. Error# %i", __func__, __LINE__, the_device_id, the_channel_id));
//Text_DrawStringAtXY(ID_CHANNEL_A, 0, y++, (char*)"Failed to open keyboard device", FG_COLOR_DK_BLUE, BG_COLOR_YELLOW);
DEBUG_OUT(("%s %d: Failed to open keyboard device. proceeding anyway...", __func__, __LINE__));
// return false;
}
else
{
//Text_DrawStringAtXY(ID_CHANNEL_A, 0, y++, (char*)"Opened keyboard device", FG_COLOR_DK_BLUE, BG_COLOR_YELLOW);
DEBUG_OUT(("%s %d: Opened keyboard device", __func__, __LINE__));
}
sys_chan_flush(the_channel_id);
//Text_DrawStringAtXY(ID_CHANNEL_A, 0, y++, (char*)"flushed channel", FG_COLOR_DK_BLUE, BG_COLOR_YELLOW);
DEBUG_OUT(("%s %d: Flushed channel", __func__, __LINE__));
if ( ((sys_chan_status(the_channel_id) & CDEV_STAT_ERROR) == 1) )
{
//Text_DrawStringAtXY(ID_CHANNEL_A, 0, y++, (char*)"channel status had error (0x01)", FG_COLOR_DK_BLUE, BG_COLOR_YELLOW);
DEBUG_OUT(("%s %d: channel status had error (0x01)", __func__, __LINE__));
return false;
}
else
{
//Text_DrawStringAtXY(ID_CHANNEL_A, 0, y++, (char*)"channel status says no error condition", FG_COLOR_DK_BLUE, BG_COLOR_YELLOW);
DEBUG_OUT(("%s %d: channel status says no error condition", __func__, __LINE__));
}
// read and type characters to screen until there is an channel error, or the char typed is tab
while ( ((sys_chan_status(the_channel_id) & CDEV_STAT_ERROR) == 0) && !stop)
{
unsigned char the_char;
//bytes_read = sys_chan_read(the_channel_id, the_keyboard_buff, bytes_requested);
the_char = sys_chan_read_b(the_channel_id);
bytes_read++;
if (the_char == '\t')
{
stop = true;
}
else
{
Text_SetCharAtXY(ID_CHANNEL_A, bytes_read, 40, the_char);
}
//Text_DrawStringAtXY(ID_CHANNEL_A, 0, 40, (char*)the_keyboard_buff, FG_COLOR_DK_BLUE, BG_COLOR_YELLOW);
}
// close channel
sys_chan_close(the_channel_id);
return true;
}
/*****************************************************************************/
/* MinUnit Function Defintions */
/*****************************************************************************/
void text_test_setup(void) // this is called EVERY test
{
// foo = 7;
// bar = 4;
//
}
void text_test_teardown(void) // this is called EVERY test
{
}
MU_TEST(text_test_block_copy)
{
char* buffer1;
char* buffer2;
// these test pass, but visually, copying from screen A to B or vice versa doesn't work well right now
// these reason has to do with different # of columns/rows.
// TODO: re-write these tests to copy to an off-screen location. have a different offscreen buffer with some preprerated text. copy that to screen. then copy original buffer back to screen.
// TODO: if function is necessary, device a smarter, dedicated buffer to screen copy that accounts for width of copied buffer and width of target screen.
mu_assert( (buffer1 = (char*)calloc(global_system->screen_[ID_CHANNEL_A]->text_mem_cols_ * global_system->screen_[ID_CHANNEL_A]->text_mem_rows_, sizeof(char)) ) != NULL, "could not alloc space for screen buffer 1");
mu_assert( (buffer2 = (char*)calloc(global_system->screen_[ID_CHANNEL_A]->text_mem_cols_ * global_system->screen_[ID_CHANNEL_A]->text_mem_rows_, sizeof(char)) ) != NULL, "could not alloc space for screen buffer 2");
// copy text on channel B, to off-screen buffer 1
mu_assert( Text_CopyScreen(global_system->screen_[ID_CHANNEL_B], buffer1, SCREEN_COPY_FROM_SCREEN, SCREEN_FOR_TEXT_CHAR == true), "Could not copy chan B char to buffer 1" );
// copy text on channel A, to off-screen buffer 2
mu_assert( Text_CopyScreen(global_system->screen_[ID_CHANNEL_A], buffer2, SCREEN_COPY_FROM_SCREEN, SCREEN_FOR_TEXT_CHAR == true), "Could not copy chan A char to buffer 2" );
// copy text in offscreen buffer 1, to channel A
mu_assert( Text_CopyScreen(global_system->screen_[ID_CHANNEL_A], buffer1, SCREEN_COPY_TO_SCREEN, SCREEN_FOR_TEXT_CHAR == true), "Could not copy buffer1 to chan A char" );
// copy text in offscreen buffer 2, to channel B
mu_assert( Text_CopyScreen(global_system->screen_[ID_CHANNEL_B], buffer2, SCREEN_COPY_TO_SCREEN, SCREEN_FOR_TEXT_CHAR == true), "Could not copy buffer2 to chan B char" );
// copy attr on channel B, to off-screen buffer 1
mu_assert( Text_CopyScreen(global_system->screen_[ID_CHANNEL_B], buffer1, SCREEN_COPY_FROM_SCREEN, SCREEN_FOR_TEXT_ATTR == true), "Could not copy chan B attr to buffer 1" );
// copy attr on channel A, to off-screen buffer 2
mu_assert( Text_CopyScreen(global_system->screen_[ID_CHANNEL_A], buffer2, SCREEN_COPY_FROM_SCREEN, SCREEN_FOR_TEXT_ATTR == true), "Could not copy chan A attr to buffer 2" );
// copy attr in offscreen buffer 1, to channel A
mu_assert( Text_CopyScreen(global_system->screen_[ID_CHANNEL_A], buffer1, SCREEN_COPY_TO_SCREEN, SCREEN_FOR_TEXT_ATTR == true), "Could not copy buffer1 to chan A attr" );
// copy attr in offscreen buffer 2, to channel B
// mu_assert( Text_CopyScreen(global_system->screen_[ID_CHANNEL_B], buffer2, SCREEN_COPY_TO_SCREEN, SCREEN_FOR_TEXT_ATTR == true), "Could not copy buffer2 to chan B attr" );
// // copy text on channel B, to off-screen buffer 1
// mu_assert( Text_CopyCharMemFromScreen(global_system->screen_[ID_CHANNEL_B], buffer1) == true, "Could not copy chan B char to buffer 1" );
//
// // copy text on channel A, to off-screen buffer 2
// mu_assert( Text_CopyCharMemFromScreen(global_system->screen_[ID_CHANNEL_A], buffer2) == true, "Could not copy chan A char to buffer 2" );
//
// // copy text in offscreen buffer 1, to channel A
// mu_assert( Text_CopyCharMemToScreen(global_system->screen_[ID_CHANNEL_A], buffer1) == true, "Could not copy buffer1 to chan A char" );
//
// // copy text in offscreen buffer 2, to channel B
// mu_assert( Text_CopyCharMemToScreen(global_system->screen_[ID_CHANNEL_B], buffer2) == true, "Could not copy buffer2 to chan B char" );
//
// // copy attr on channel B, to off-screen buffer 1
// mu_assert( Text_CopyAttrMemFromScreen(global_system->screen_[ID_CHANNEL_B], buffer1) == true, "Could not copy chan B attr to buffer 1" );
//
// // copy attr on channel A, to off-screen buffer 2
// mu_assert( Text_CopyAttrMemFromScreen(global_system->screen_[ID_CHANNEL_A], buffer2) == true, "Could not copy chan A attr to buffer 2" );
//
// // copy attr in offscreen buffer 1, to channel A
// mu_assert( Text_CopyAttrMemToScreen(global_system->screen_[ID_CHANNEL_A], buffer1) == true, "Could not copy buffer1 to chan A attr" );
//
// // copy attr in offscreen buffer 2, to channel B
// mu_assert( Text_CopyAttrMemToScreen(global_system->screen_[ID_CHANNEL_B], buffer2) == true, "Could not copy buffer2 to chan B attr" );
free(buffer1);
free(buffer2);
}
MU_TEST(text_test_block_copy_box)
{
int16_t x;
int16_t y;
int16_t h_line_len;
int16_t v_line_len;
char* buffer1;
char* buffer2;
x = 45;
y = 4;
h_line_len = 6;
v_line_len = 6;
// get out 2 buffers that are the full size of the screens. this block copy is designed to use same offsets as a normal sized screen.
mu_assert( (buffer1 = (char*)calloc(global_system->screen_[ID_CHANNEL_A]->text_mem_cols_ * global_system->screen_[ID_CHANNEL_A]->text_mem_rows_, sizeof(char)) ) != NULL, "could not alloc space for screen buffer 1");
mu_assert( (buffer2 = (char*)calloc(global_system->screen_[ID_CHANNEL_A]->text_mem_cols_ * global_system->screen_[ID_CHANNEL_A]->text_mem_rows_, sizeof(char)) ) != NULL, "could not alloc space for screen buffer 2");
// copy text on channel B, to off-screen buffer 1
mu_assert( Text_CopyMemBox(global_system->screen_[ID_CHANNEL_B], buffer1, x, y, x+h_line_len, y+v_line_len, SCREEN_COPY_FROM_SCREEN, SCREEN_FOR_TEXT_CHAR == true), "Could not copy box of chan B char to buffer 1" );
// copy text on channel A, to off-screen buffer 2
mu_assert( Text_CopyMemBox(global_system->screen_[ID_CHANNEL_A], buffer2, 0, 0, 71, 8, SCREEN_COPY_FROM_SCREEN, SCREEN_FOR_TEXT_CHAR == true), "Could not copy box of chan A char to buffer 2" );
// copy text in offscreen buffer 1, to channel A
mu_assert( Text_CopyMemBox(global_system->screen_[ID_CHANNEL_A], buffer1, x, y, x+h_line_len, y+v_line_len, SCREEN_COPY_TO_SCREEN, SCREEN_FOR_TEXT_CHAR == true), "Could not copy box of buffer1 to chan A char" );
// copy text in offscreen buffer 2, to channel B
mu_assert( Text_CopyMemBox(global_system->screen_[ID_CHANNEL_B], buffer2, 0, 0, 71, 8, SCREEN_COPY_TO_SCREEN, SCREEN_FOR_TEXT_CHAR == true), "Could not copy box of buffer2 to chan B char" );
// copy attr on channel B, to off-screen buffer 1
mu_assert( Text_CopyMemBox(global_system->screen_[ID_CHANNEL_B], buffer1, x, y, x+h_line_len, y+v_line_len, SCREEN_COPY_FROM_SCREEN, SCREEN_FOR_TEXT_ATTR == true), "Could not copy box of chan B attr to buffer 1" );
// copy attr on channel A, to off-screen buffer 2
mu_assert( Text_CopyMemBox(global_system->screen_[ID_CHANNEL_A], buffer2, 0, 0, 71, 8, SCREEN_COPY_FROM_SCREEN, SCREEN_FOR_TEXT_ATTR == true), "Could not copy box of chan A attr to buffer 2" );
// copy attr in offscreen buffer 1, to channel A
mu_assert( Text_CopyMemBox(global_system->screen_[ID_CHANNEL_A], buffer1, x, y, x+h_line_len, y+v_line_len, SCREEN_COPY_TO_SCREEN, SCREEN_FOR_TEXT_ATTR == true), "Could not copy box of buffer1 to chan A attr" );
// copy attr in offscreen buffer 2, to channel B
mu_assert( Text_CopyMemBox(global_system->screen_[ID_CHANNEL_B], buffer2, 0, 0, 71, 8, SCREEN_COPY_TO_SCREEN, SCREEN_FOR_TEXT_ATTR == true), "Could not copy box of buffer2 to chan B attr" );
free(buffer1);
free(buffer2);
}
MU_TEST(text_test_fill_text)
{
mu_assert( Text_FillCharMem(global_system->screen_[ID_CHANNEL_A], 'Z'), "Could not fill character memory in channel A" );
mu_assert( Text_FillCharMem(global_system->screen_[ID_CHANNEL_B], 4), "Could not fill character memory in channel B" );
// 4 = diamond. good mix of fore/back color
// bad values
mu_assert( Text_FillCharMem(NULL, 4) == false, "Text_FillCharMem accepted bad parameter" );
}
MU_TEST(text_test_fill_attr)
{
mu_assert( Text_FillAttrMem(global_system->screen_[ID_CHANNEL_A], 127), "Could not fill attribute memory in channel A" );
mu_assert( Text_FillAttrMem(global_system->screen_[ID_CHANNEL_B], 148), "Could not fill attribute memory in channel B" );
// illegal values
mu_assert( Text_FillAttrMem(NULL, 148) == false, "Text_FillAttrMem accepted bad parameter" );
// 31=black on white
// 64=dark blue on black
// 96=dark cyan on black
// 112=medium gray on black
// 128=medium gray on black
// 138=black on light green
// 139=black on bright yellow
// 140=gray? on medium blue
// 141=gray? on pink
// 142=gray? on light cyan
// 143=black/gray? on white
// 15=black on white
// 144=red on black
// 16=dark red on black
// 145=light red on dark red
// 17=dark red on dark red
// 146=light red on medium green
// 18=dark red on medium green
// 147=light red on olive
// 19=dark red on medium green?
// 148=light red on dark blue
}
MU_TEST(text_test_fill_box)
{
// good values
mu_assert( Text_FillBoxSlow(global_system->screen_[ID_CHANNEL_A], 0, 6, 15, 8, CH_CHECKERED1, COLOR_BLACK, BG_COLOR_WHITE, CHAR_AND_ATTR) == true, "Text_FillBoxSlow failed" );
mu_assert( Text_FillBoxSlow(global_system->screen_[ID_CHANNEL_A], 21, 5, 39, 7, CH_CHECKERED2, COLOR_DK_RED, COLOR_RED, CHAR_AND_ATTR) == true, "Text_FillBoxSlow failed" );
mu_assert( Text_FillBox(global_system->screen_[ID_CHANNEL_A], 3, 6, 67, 50, CH_CHECKERED3, COLOR_GREEN, COLOR_DK_GREEN) == true, "Text_FillBox failed" );
mu_assert( Text_FillBox(global_system->screen_[ID_CHANNEL_B], 21, 21, 40, 40, CH_CHECKERED3, COLOR_YELLOW, COLOR_DK_YELLOW) == true, "Text_FillBox failed" );
// bad values
mu_assert( Text_FillBoxSlow(NULL, 0, 6, 15, 8, CH_CHECKERED1, COLOR_VIOLET, COLOR_CYAN, CHAR_AND_ATTR) == false, "Text_FillBoxSlow accepted an illegal screen ID" );
mu_assert( Text_FillBox(global_system->screen_[ID_CHANNEL_B], -67, 6, 72, 30, CH_CHECKERED3, COLOR_BLUE, COLOR_DK_BLUE) == false, "Text_FillBoxSlow accepted an illegal x coord" );
mu_assert( Text_FillBox(global_system->screen_[ID_CHANNEL_B], 32767, 6, 72, 30, CH_CHECKERED3, COLOR_BLUE, COLOR_DK_BLUE) == false, "Text_FillBoxSlow accepted an illegal x coord" );
mu_assert( Text_FillBox(global_system->screen_[ID_CHANNEL_B], 5, -6, 72, 30, CH_CHECKERED3, COLOR_BLUE, COLOR_DK_BLUE) == false, "Text_FillBoxSlow accepted an illegal y coord" );
mu_assert( Text_FillBox(global_system->screen_[ID_CHANNEL_B], 5, 6000, 72, 30, CH_CHECKERED3, COLOR_BLUE, COLOR_DK_BLUE) == false, "Text_FillBoxSlow accepted an illegal y coord" );
}
MU_TEST(text_test_invert_box)
{
int32_t i;
for (i = 0; i < 999; i++)
{
mu_assert( Text_InvertBox(global_system->screen_[ID_CHANNEL_B], 0, 6, 15, 8), "Could not invert color of a box" );
}
mu_assert( Text_InvertBox(global_system->screen_[ID_CHANNEL_B], 50, 13, 71, 16), "Could not invert color of a box" );
// bad values
mu_assert( Text_InvertBox(NULL, 50, 13, 71, 16) == false, "Text_InvertBox accepted an illegal screen ID" );
mu_assert( Text_InvertBox(global_system->screen_[ID_CHANNEL_B], 50, 13, 1500, 16) == false, "Text_InvertBox accepted illegal rect coordinates" );
mu_assert( Text_InvertBox(global_system->screen_[ID_CHANNEL_B], 71, 16, 50, 10) == false, "Text_InvertBox accepted illegal rect coordinates" );
}
MU_TEST(text_test_font_overwrite)
{
mu_assert( Text_UpdateFontData(global_system->screen_[ID_CHANNEL_A], (char*)0x000000), "Could not replace font data for channel A" );
mu_assert( Text_UpdateFontData(global_system->screen_[ID_CHANNEL_B], (char*)0x000000), "Could not replace font data for channel B" );
// bad values
mu_assert( Text_UpdateFontData(NULL, (char*)0x000000) == false, "Text_UpdateFontData accepted an illegal screen ID" );
}
MU_TEST(text_test_show_font)
{
mu_assert( Text_ShowFontChars(global_system->screen_[ID_CHANNEL_A], 10), "Could not show font chars for channel A" );
mu_assert( Text_ShowFontChars(global_system->screen_[ID_CHANNEL_B], 10), "Could not show font chars for channel B" );
// bad values
mu_assert( Text_ShowFontChars(NULL, 10) == false, " accepted an illegal screen ID" );
}
//test char placement
MU_TEST(text_test_char_placement)
{
int16_t x;
int16_t y;
for (y = 4; y < 40; y = y+2)
{
for (x = 0; x < 50; x++)
{
mu_assert( Text_SetCharAtXY(global_system->screen_[ID_CHANNEL_A], x, y, 'X'), "text char placement failed" );
}
}
// bad values
mu_assert( Text_SetCharAtXY(NULL, 0, 0, 'X') == false, "Text_SetCharAtXY accepted illegal screen ID" );
mu_assert( Text_SetCharAtXY(global_system->screen_[ID_CHANNEL_A], -1, 3, 'b') == false, "Text_SetCharAtXY accepted illegal coordinates" );
mu_assert( Text_SetCharAtXY(global_system->screen_[ID_CHANNEL_A], -1, -1, 'c') == false, "Text_SetCharAtXY accepted illegal coordinates" );
mu_assert( Text_SetCharAtXY(global_system->screen_[ID_CHANNEL_A], 0, -1, 'd') == false, "Text_SetCharAtXY accepted illegal coordinates" );
mu_assert( Text_SetCharAtXY(global_system->screen_[ID_CHANNEL_A], 500, 4, 'e') == false, "Text_SetCharAtXY accepted illegal coordinates" );
mu_assert( Text_SetCharAtXY(global_system->screen_[ID_CHANNEL_A], 500, 500, 'f') == false, "Text_SetCharAtXY accepted illegal coordinates" );
mu_assert( Text_SetCharAtXY(global_system->screen_[ID_CHANNEL_A], 0, 500, 'g') == false, "Text_SetCharAtXY accepted illegal coordinates" );
}
// char and color writing
MU_TEST(text_test_char_and_attr_writing)
{
// same story here: 4 or so works ok, add more, and it's likely to crash.
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 0, 4, 33, FG_COLOR_BLACK, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 1, 4, 34, FG_COLOR_DK_RED, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 2, 4, 35, FG_COLOR_GREEN, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 3, 4, 36, FG_COLOR_BLUE, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 4, 4, 37, COLOR_LT_GRAY, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 5, 4, 38, COLOR_LT_GRAY, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 6, 4, 39, FG_COLOR_VIOLET, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 7, 4, 40, COLOR_LT_GRAY, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 8, 4, 41, COLOR_BLACK, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 9, 4, 42, COLOR_LT_GRAY, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 10, 4, 43, COLOR_LT_GRAY, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 11, 4, 44, COLOR_LT_GRAY, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 12, 4, 45, FG_COLOR_DK_GRAY, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 13, 4, 46, COLOR_LT_GRAY, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 14, 4, 47, FG_COLOR_WHITE, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 15, 4, 48, COLOR_LT_GRAY, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 0, 5, 33, FG_COLOR_WHITE, BG_COLOR_BLACK) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 1, 5, 34, FG_COLOR_WHITE, BG_COLOR_DK_RED) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 2, 5, 35, FG_COLOR_WHITE, BG_COLOR_GREEN) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 3, 5, 36, FG_COLOR_WHITE, BG_COLOR_BLUE) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 4, 4, 37, FG_COLOR_WHITE, COLOR_RED) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 5, 5, 38, FG_COLOR_WHITE, COLOR_RED) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 6, 5, 39, FG_COLOR_WHITE, COLOR_RED) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 7, 5, 40, FG_COLOR_WHITE, BG_COLOR_DK_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 8, 5, 41, FG_COLOR_WHITE, COLOR_RED) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 9, 5, 42, FG_COLOR_WHITE, COLOR_RED) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 10, 5, 43, FG_COLOR_WHITE, COLOR_RED) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 11, 5, 44, FG_COLOR_WHITE, COLOR_RED) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 12, 5, 45, FG_COLOR_WHITE, COLOR_RED) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 13, 5, 46, FG_COLOR_WHITE, COLOR_RED) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 14, 5, 47, FG_COLOR_WHITE, BG_COLOR_LT_GRAY) == true, "Text_SetCharAndColorAtXY failed" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_B], 15, 5, 48, FG_COLOR_WHITE, BG_COLOR_WHITE) == true, "Text_SetCharAndColorAtXY failed" );
// bad values
mu_assert( Text_SetCharAndColorAtXY(NULL, 0, 0, 'X', FG_COLOR_WHITE, BG_COLOR_WHITE) == false, "Text_SetCharAndColorAtXY accepted illegal screen ID" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_A], -1, 3, 'b', FG_COLOR_WHITE, BG_COLOR_WHITE) == false, "Text_SetCharAndColorAtXY accepted illegal coordinates" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_A], -1, -1, 'c', FG_COLOR_WHITE, BG_COLOR_WHITE) == false, "Text_SetCharAndColorAtXY accepted illegal coordinates" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_A], 0, -1, 'd', FG_COLOR_WHITE, BG_COLOR_WHITE) == false, "Text_SetCharAndColorAtXY accepted illegal coordinates" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_A], 500, 4, 'e', FG_COLOR_WHITE, BG_COLOR_WHITE) == false, "Text_SetCharAndColorAtXY accepted illegal coordinates" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_A], 500, 500, 'f', FG_COLOR_WHITE, BG_COLOR_WHITE) == false, "Text_SetCharAndColorAtXY accepted illegal coordinates" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_A], 0, 500, 'g', FG_COLOR_WHITE, BG_COLOR_WHITE) == false, "Text_SetCharAndColorAtXY accepted illegal coordinates" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_A], 1, 1, 'h', -1, 1) == false, "Text_SetCharAndColorAtXY accepted illegal color value" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_A], 1, 1, 'i', 17, 1) == false, "Text_SetCharAndColorAtXY accepted illegal color value" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_A], 1, 1, 'j', 1, -54) == false, "Text_SetCharAndColorAtXY accepted illegal color value" );
mu_assert( Text_SetCharAndColorAtXY(global_system->screen_[ID_CHANNEL_A], 1, 1, 'k', 1, 23) == false, "Text_SetCharAndColorAtXY accepted illegal color value" );
}
// test char and color reading
MU_TEST(text_test_char_and_attr_reading)
{
unsigned char the_color;
unsigned char the_char;
unsigned char the_attribute_value;
int16_t x;
int16_t y;
x = 0;
y = 6;
the_attribute_value = ((COLOR_ORANGE << 4) | BG_COLOR_WHITE);
// set known chars and colors to test again
Text_SetAttrAtXY(global_system->screen_[ID_CHANNEL_A], x, y, FG_COLOR_WHITE, BG_COLOR_BLACK);
Text_SetAttrAtXY(global_system->screen_[ID_CHANNEL_A], x+1, y, FG_COLOR_VIOLET, BG_COLOR_DK_GRAY);
Text_SetAttrAtXY(global_system->screen_[ID_CHANNEL_A], x+2, y, COLOR_ORANGE, BG_COLOR_WHITE);
Text_SetCharAtXY(global_system->screen_[ID_CHANNEL_A], x, y, CH_DIAMOND);
Text_SetCharAtXY(global_system->screen_[ID_CHANNEL_A], x+1, y, CH_CLUB);
Text_SetCharAtXY(global_system->screen_[ID_CHANNEL_A], x+2, y, CH_SPADE);
mu_assert( (the_color = Text_GetForeColorAtXY(global_system->screen_[ID_CHANNEL_A], x, y)) == FG_COLOR_WHITE, "Text_GetForeColorAtXY failed" );
mu_assert( (the_color = Text_GetBackColorAtXY(global_system->screen_[ID_CHANNEL_A], x, y)) == BG_COLOR_BLACK, "Text_GetBackColorAtXY failed" );
x++;
mu_assert( (the_color = Text_GetForeColorAtXY(global_system->screen_[ID_CHANNEL_A], x, y)) == FG_COLOR_VIOLET, "Text_GetForeColorAtXY failed" );
mu_assert( (the_color = Text_GetBackColorAtXY(global_system->screen_[ID_CHANNEL_A], x, y)) == BG_COLOR_DK_GRAY, "Text_GetBackColorAtXY failed" );
x++;
mu_assert( (the_color = Text_GetAttrAtXY(global_system->screen_[ID_CHANNEL_A], x, y)) == the_attribute_value, "Text_GetAttrAtXY failed");
x = 0;
mu_assert( (the_char = Text_GetCharAtXY(global_system->screen_[ID_CHANNEL_A], x, y)) == CH_DIAMOND, "Text_GetCharAtXY failed");
x++;
mu_assert( (the_char = Text_GetCharAtXY(global_system->screen_[ID_CHANNEL_A], x, y)) == CH_CLUB, "Text_GetCharAtXY failed");
x++;
mu_assert( (the_char = Text_GetCharAtXY(global_system->screen_[ID_CHANNEL_A], x, y)) == CH_SPADE, "Text_GetCharAtXY failed");
}
MU_TEST(text_test_line_drawing)
{
int16_t x;
int16_t y;
int16_t line_len;
unsigned char the_char;
// good values
x = 20;
y = 4;
line_len = 20;
the_char = CH_WALL_H;
mu_assert( Text_DrawHLine(global_system->screen_[ID_CHANNEL_A], x, y, line_len, the_char, FG_COLOR_GREEN, BG_COLOR_BLACK, CHAR_ONLY) == true, "Text_DrawHLine failed" );
y = 8;
mu_assert( Text_DrawHLine(global_system->screen_[ID_CHANNEL_A], x, y, line_len, the_char, FG_COLOR_GREEN, BG_COLOR_BLACK, CHAR_AND_ATTR) == true, "Text_DrawHLine failed" );
y = 4;
line_len = 4;
the_char = CH_WALL_V;
mu_assert( Text_DrawVLine(global_system->screen_[ID_CHANNEL_A], x, y, line_len, the_char, BG_COLOR_YELLOW, BG_COLOR_BLACK, ATTR_ONLY) == true, "Text_DrawVLine failed" );
x = x + 20;
mu_assert( Text_DrawVLine(global_system->screen_[ID_CHANNEL_A], x, y, line_len, the_char, BG_COLOR_YELLOW, BG_COLOR_BLACK, CHAR_AND_ATTR) == true, "Text_DrawVLine failed" );
// bad values
mu_assert( Text_DrawVLine(NULL, x, y, line_len, the_char, COLOR_DK_RED, COLOR_RED, CHAR_AND_ATTR) == false, "Text_DrawVLine accepted illegal screen ID" );
mu_assert( Text_DrawVLine(global_system->screen_[ID_CHANNEL_B], -1, y, line_len, the_char, COLOR_DK_RED, COLOR_RED, CHAR_AND_ATTR) == false, "Text_DrawVLine accepted illegal x coord" );
mu_assert( Text_DrawVLine(global_system->screen_[ID_CHANNEL_B], x, 425, line_len, the_char, COLOR_DK_RED, COLOR_RED, CHAR_AND_ATTR) == false, "Text_DrawVLine accepted illegal y coord" );
}
MU_TEST(text_test_basic_box_coords)
{
int16_t x;
int16_t y;
int16_t h_line_len;
int16_t v_line_len;
unsigned char the_char;
x = 45;
y = 4;
h_line_len = 6;
v_line_len = 6;
the_char = CH_CHECKERED1;
// good values
mu_assert( Text_DrawBoxCoords(global_system->screen_[ID_CHANNEL_A], x, y, x + h_line_len, y + v_line_len, the_char, FG_COLOR_LT_GRAY, BG_COLOR_DK_GRAY, CHAR_AND_ATTR) == true, "Text_DrawBoxCoords failed" );
// bad values
}
MU_TEST(text_test_basic_box_hw)
{
int16_t x;
int16_t y;
int16_t h_line_len;
int16_t v_line_len;
unsigned char the_char;
x = 60;
y = 6;
h_line_len = 6;
v_line_len = 6;
the_char = CH_CHECKERED3;
// good values
mu_assert(Text_DrawBox(global_system->screen_[ID_CHANNEL_A], x, y, h_line_len, v_line_len, the_char, FG_COLOR_CYAN, BG_COLOR_DK_CYAN, CHAR_AND_ATTR) == true, "Text_DrawBox failed" );
x += 7;
y += 2;
mu_assert(Text_DrawBox(global_system->screen_[ID_CHANNEL_A], x, y, h_line_len-2, v_line_len+5, --the_char, FG_COLOR_CYAN, BG_COLOR_DK_CYAN, CHAR_AND_ATTR) == true, "Text_DrawBox failed" );
// bad values
mu_assert(Text_DrawBox(global_system->screen_[ID_CHANNEL_B], -10, y, h_line_len, v_line_len, the_char, FG_COLOR_CYAN, BG_COLOR_DK_CYAN, CHAR_AND_ATTR) == false, "Text_DrawBox accepted illegal x coord" );
}
MU_TEST(text_test_fancy_box)
{
int16_t x1;
int16_t y1;
int16_t x2;
int16_t y2;
// int16_t h_line_len;
// int16_t v_line_len;
char* the_message;
// good values
the_message = General_StrlcpyWithAlloc((char*)"\nThe Anecdote\n\nBill Atkinson worked mostly at home, but whenever he made significant progress he rushed in to Apple to show it off to anyone who would appreciate it. This time, he visited the Macintosh offices at Texaco Towers to show off his brand new oval routines in Quickdraw, which were implemented using a really clever algorithm.\n\nBill had added new code to QuickDraw (which was still called LisaGraf at this point) to draw circles and ovals very quickly. That was a bit hard to do on the Macintosh, since the math for circles usually involved taking square roots, and the 68000 processor in the Lisa and Macintosh didn't support floating point operations. But Bill had come up with a clever way to do the circle calculation that only used addition and subtraction, not even multiplication or division, which the 68000 could do, but was kind of slow at.\n\nBill's technique used the fact the sum of a sequence of odd numbers is always the next perfect square (For example, 1 + 3 = 4, 1 + 3 + 5 = 9, 1 + 3 + 5 + 7 = 16, etc). So he could figure out when to bump the dependent coordinate value by iterating in a loop until a threshold was exceeded. This allowed QuickDraw to draw ovals very quickly.\n\nBill fired up his demo and it quickly filled the Lisa screen with randomly-sized ovals, faster than you thought was possible. But something was bothering Steve Jobs. 'Well, circles and ovals are good, but how about drawing rectangles with rounded corners? Can we do that now, too?'\n\n'No, there's no way to do that. In fact it would be really hard to do, and I don't think we really need it'. I think Bill was a little miffed that Steve wasn't raving over the fast ovals and still wanted more.\n\nSteve suddenly got more intense. 'Rectangles with rounded corners are everywhere! Just look around this room!'. And sure enough, there were lots of them, like the whiteboard and some of the desks and tables. Then he pointed out the window. 'And look outside, there's even more, practically everywhere you look!'. He even persuaded Bill to take a quick walk around the block with him, pointing out every rectangle with rounded corners that he could find.\n\n\nWhen Steve and Bill passed a no-parking sign with rounded corners, it did the trick. 'OK, I give up', Bill pleaded. 'I'll see if it's as hard as I thought.' He went back home to work on it.\n\nBill returned to Texaco Towers the following afternoon, with a big smile on his face. His demo was now drawing rectangles with beautifully rounded corners blisteringly fast, almost at the speed of plain rectangles. When he added the code to LisaGraf, he named the new primitive 'RoundRects'. Over the next few months, roundrects worked their way into various parts of the user interface, and soon became indispensable.\n\nThe Code\n\nAuthor: Bill Atkinson\nYear: 1981\n\nQuickDraw is the Macintosh library for creating bit-mapped graphics, which was used by MacPaint and other applications. It consists of a total of 17,101 lines in 36 files, all written in assembler language for the 68000.\n\n .INCLUDE GRAFTYPES.TEXT\n;-----------------------------------------------------------\n;\n;\n; **** **** ***** *** ***** ***\n; * * * * * * * * * *\n; * * * * * * * *\n; **** **** *** * * ***\n; * * * * * * * *\n; * * * * * * * * * *\n; * * * * ***** *** * ***\n;\n;\n; procedures for operating on RoundRects.\n;\n;\n .PROC StdRRect,4\n .REF CheckPic,DPutPicByte,PutPicVerb,PutPicLong,PutPicRect\n .REF PutOval,PushVerb,DrawArc\n;---------------------------------------------------------------\n;\n; PROCEDURE StdRRect(verb: GrafVerb; r: Rect; ovWd,ovHt: INTEGER);\n;\n; A6 OFFSETS OF PARAMS AFTER LINK:\n;\nPARAMSIZE .EQU 10\nVERB .EQU PARAMSIZE+8-2 ;GRAFVERB\nRECT .EQU VERB-4 ;LONG, ADDR OF RECT\nOVWD .EQU RECT-2 ;WORD\nOVHT .EQU OVWD-2 ;WORD\n LINK A6,#0 ;NO LOCALS\n MOVEM.L D7/A3-A4,-(SP) ;SAVE REGS\n MOVE.B VERB(A6),D7 ;GET VERB\n JSR CHECKPIC ;SET UP A4,A3 AND CHECK PICSAVE\n BLE.S NOTPIC ;BRANCH IF NOT PICSAVE\n MOVE.B D7,-(SP) ;PUSH VERB\n JSR PutPicVerb ;PUT ADDIONAL PARAMS TO THEPIC\n;\n; CHECK FOR NEW OVAL SIZE\n;\n MOVE.L PICSAVE(A3),A0 ;GET PICSAVE HANDLE\n MOVE.L (A0),A0 ;DE-REFERENCE PICSAVE\n MOVE.L OVHT(A6),D0 ;GET OVWD AND OVHT\n CMP.L PICOVSIZE(A0),D0 ;SAME AS CURRENT OVAL SIZE ?\n BEQ.S OVALOK ;YES, CONTINUE\n MOVE.L D0,PICOVSIZE(A0) ;NO, UPDATE STATE VARIABLE\n MOVE.L D0,-(SP) ;PUSH OVSIZE FOR PutPicLong CALL\n MOVEQ #$0B,D0\n JSR DPutPicByte ;PUT OVSIZE OPCODE\n JSR PutPicLong ;PUT NEW OVAL SIZE DATA\nOVALOK MOVEQ #$40,D0 ;PUT RRECT NOUN IN HI NIBBLE\n ADD D7,D0 ;PUT VERB IN LO NIBBLE\n MOVE.B D0,-(SP) ;PUSH OPCODE\n MOVE.L RECT(A6),-(SP) ;PUSH ADDR OF RECT\n JSR PutPicRect ;PUT OPCODE AND RECTANGLE\nNOTPIC MOVE.L RECT(A6),-(SP) ;PUSH ADDR OF RECT\n CLR.B -(SP) ;PUSH HOLLOW = FALSE\n TST.B D7 ;IS VERB FRAME ?\n BNE.S DOIT ;NO, CONTINUE\n TST.L RGNSAVE(A3) ;YES, IS RGNSAVE TRUE ?\n BEQ.S NOTRGN ;NO, CONTINUE\n MOVE.L RECT(A6),-(SP) ;YES, PUSH ADDR OF RECT\n MOVE.L OVHT(A6),-(SP) ;PUSH OVWD, OVHT\n MOVE.L RGNBUF(A4),-(SP) ;PUSH RGNBUF\n PEA RGNINDEX(A4) ;PUSH VAR RGNINDEX\n PEA RGNMAX(A4) ;PUSH VAR RGNMAX\n JSR PutOval ;ADD AN OVAL TO THERGN\nNOTRGN MOVE.B #1,(SP) ;REPLACE, PUSH HOLLOW = TRUE\nDOIT MOVE.L OVHT(A6),-(SP) ;PUSH OVWD,OVHT\n JSR PushVerb ;PUSH MODE AND PATTERN\n CLR -(SP) ;PUSH STARTANGLE = 0\n MOVE #360,-(SP) ;PUSH ARCANGLE = 360", 80*60+1);
// the_message = General_StrlcpyWithAlloc((char*)"\nThe Anecdote\n\nBill Atkinson worked mostly at home, but whenever he made significant progress he rushed in to Apple to show it off to anyone who would appreciate it. This time, he visited the Macintosh offices at Texaco Towers to show off his brand new oval routines in Quickdraw, which were implemented using a really clever algorithm.\n\nBill had added new code to QuickDraw", 80*60+1);
// the_message = General_StrlcpyWithAlloc((char*)"\n\n\nLINE ONE\n\nLINE TWO", 80*60+1);
// the_message = General_StrlcpyWithAlloc((char*)"THISISAREALLYBIGWORDBIGGERTHANANYYOUCANTHINK_OF_OR_AT_LEAST_I_THINK_SO", 80*60+1);
// draw huge on channel A screen
x1 = 2;
y1 = 2;
x2 = 98;
y2 = 73;
mu_assert( Text_FillBox(global_system->screen_[ID_CHANNEL_A], x1+1, y1+1, x2-1, y2-1, CH_CHECKERED1, BG_COLOR_CYAN, BG_COLOR_DK_BLUE) == true, "Text_FillBox failed" );
mu_assert(Text_DrawBoxCoordsFancy(global_system->screen_[ID_CHANNEL_A], x1, y1, x2, y2, FG_COLOR_LT_GRAY, BG_COLOR_BLACK) == true, "Text_DrawBoxCoordsFancy failed" );
x1 = 3;
y1 = 3;
x2 = 97;
y2 = 72;
mu_assert(Text_DrawStringInBox(global_system->screen_[ID_CHANNEL_A], x1, y1, x2, y2, the_message, FG_COLOR_WHITE, BG_COLOR_BLACK, NULL) != NULL, "Text_DrawStringInBox failed" );
// medium box on chan B
x1 = 12;
y1 = 4;
x2 = 68;
y2 = 51;
mu_assert( Text_FillBox(global_system->screen_[ID_CHANNEL_A], x1+1, y1+1, x2-1, y2-1, CH_CHECKERED3, FG_COLOR_LT_GRAY, BG_COLOR_WHITE) == true, "Text_FillBox failed" );
mu_assert(Text_DrawBoxCoordsFancy(global_system->screen_[ID_CHANNEL_A], x1, y1, x2, y2, FG_COLOR_LT_GRAY, BG_COLOR_DK_GRAY) == true, "Text_DrawBoxCoordsFancy failed" );
x1 = 13;
y1 = 5;
x2 = 67;
y2 = 50;
mu_assert(Text_DrawStringInBox(global_system->screen_[ID_CHANNEL_A], x1, y1, x2, y2, the_message, FG_COLOR_BLACK, BG_COLOR_WHITE, NULL) != NULL, "Text_DrawStringInBox failed" );
// small box on chan B
x1 = 39;
y1 = 19;
x2 = 71;
y2 = 41;
mu_assert( Text_FillBox(global_system->screen_[ID_CHANNEL_A], x1+1, y1+1, x2-1, y2-1, CH_CHECKERED1, BG_COLOR_CYAN, BG_COLOR_DK_BLUE) == true, "Text_FillBox failed" );
mu_assert(Text_DrawBoxCoordsFancy(global_system->screen_[ID_CHANNEL_A], x1, y1, x2, y2, FG_COLOR_LT_GRAY, BG_COLOR_BLACK) == true, "Text_DrawBoxCoordsFancy failed" );
x1 = 40;
y1 = 20;
x2 = 70;
y2 = 40;
mu_assert(Text_DrawStringInBox(global_system->screen_[ID_CHANNEL_A], x1, y1, x2, y2, the_message, FG_COLOR_WHITE, BG_COLOR_BLACK, NULL) != NULL, "Text_DrawStringInBox failed" );
}
MU_TEST(text_test_draw_string)
{
char* the_message;
// good values
mu_assert((the_message = General_StrlcpyWithAlloc((char*)"this is a string", 250)) != NULL, "General_StrlcpyWithAlloc returned NULL" );
mu_assert_string_eq("this is a string", (char*)the_message);
mu_assert(Text_DrawStringAtXY(global_system->screen_[ID_CHANNEL_B], 0, 5, the_message, FG_COLOR_YELLOW, BG_COLOR_DK_BLUE) == true, "Text_DrawStringAtXY failed" );
mu_assert(Text_DrawStringAtXY(global_system->screen_[ID_CHANNEL_B], 67, 4, the_message, FG_COLOR_DK_BLUE, BG_COLOR_YELLOW) == true, "Text_DrawStringAtXY failed" );
// bad values
mu_assert(Text_DrawStringAtXY(global_system->screen_[ID_CHANNEL_B], -1, 0, the_message, FG_COLOR_DK_BLUE, BG_COLOR_YELLOW) == false, "Text_DrawBoxCoordsFancy accepted illegal x coord" );
}
MU_TEST(text_test_draw_string_in_box)
{
char* the_message;
// good values
//mu_assert((the_message = General_StrlcpyWithAlloc((char*)"This is a short sentence.", 80*60+1)) != NULL, "General_StrlcpyWithAlloc returned NULL" );
//mu_assert((the_message = General_StrlcpyWithAlloc((char*)"This is a short sentence. Many are shorter. Like this. Heyo! Hello-Goodbye!", 80*60+1)) != NULL, "General_StrlcpyWithAlloc returned NULL" );
// mu_assert((the_message = General_StrlcpyWithAlloc((char*)"This is a longish sentence but others are longer. Many are shorter. Like this. oooooh, what a nice thingamajig you've got there.", 80*60+1)) != NULL, "General_StrlcpyWithAlloc returned NULL" );
the_message = General_StrlcpyWithAlloc((char*)"\nThe Anecdote\n\nBill Atkinson worked mostly at home, but whenever he made significant progress he rushed in to Apple to show it off to anyone who would appreciate it. This time, he visited the Macintosh offices at Texaco Towers to show off his brand new oval routines in Quickdraw, which were implemented using a really clever algorithm.\n\nBill had added new code to QuickDraw (which was still called LisaGraf at this point) to draw circles and ovals very quickly. That was a bit hard to do on the Macintosh, since the math for circles usually involved taking square roots, and the 68000 processor in the Lisa and Macintosh didn't support floating point operations. But Bill had come up with a clever way to do the circle calculation that only used addition and subtraction, not even multiplication or division, which the 68000 could do, but was kind of slow at.\n\nBill's technique used the fact the sum of a sequence of odd numbers is always the next perfect square (For example, 1 + 3 = 4, 1 + 3 + 5 = 9, 1 + 3 + 5 + 7 = 16, etc). So he could figure out when to bump the dependent coordinate value by iterating in a loop until a threshold was exceeded. This allowed QuickDraw to draw ovals very quickly.\n\nBill fired up his demo and it quickly filled the Lisa screen with randomly-sized ovals, faster than you thought was possible. But something was bothering Steve Jobs. 'Well, circles and ovals are good, but how about drawing rectangles with rounded corners? Can we do that now, too?'\n\n'No, there's no way to do that. In fact it would be really hard to do, and I don't think we really need it'. I think Bill was a little miffed that Steve wasn't raving over the fast ovals and still wanted more.\n\nSteve suddenly got more intense. 'Rectangles with rounded corners are everywhere! Just look around this room!'. And sure enough, there were lots of them, like the whiteboard and some of the desks and tables. Then he pointed out the window. 'And look outside, there's even more, practically everywhere you look!'. He even persuaded Bill to take a quick walk around the block with him, pointing out every rectangle with rounded corners that he could find.\n\n\nWhen Steve and Bill passed a no-parking sign with rounded corners, it did the trick. 'OK, I give up', Bill pleaded. 'I'll see if it's as hard as I thought.' He went back home to work on it.\n\nBill returned to Texaco Towers the following afternoon, with a big smile on his face. His demo was now drawing rectangles with beautifully rounded corners blisteringly fast, almost at the speed of plain rectangles. When he added the code to LisaGraf, he named the new primitive 'RoundRects'. Over the next few months, roundrects worked their way into various parts of the user interface, and soon became indispensable.\n\nThe Code\n\nAuthor: Bill Atkinson\nYear: 1981\n\nQuickDraw is the Macintosh library for creating bit-mapped graphics, which was used by MacPaint and other applications. It consists of a total of 17,101 lines in 36 files, all written in assembler language for the 68000.\n\n .INCLUDE GRAFTYPES.TEXT\n;-----------------------------------------------------------\n;\n;\n; **** **** ***** *** ***** ***\n; * * * * * * * * * *\n; * * * * * * * *\n; **** **** *** * * ***\n; * * * * * * * *\n; * * * * * * * * * *\n; * * * * ***** *** * ***\n;\n;\n; procedures for operating on RoundRects.\n;\n;\n .PROC StdRRect,4\n .REF CheckPic,DPutPicByte,PutPicVerb,PutPicLong,PutPicRect\n .REF PutOval,PushVerb,DrawArc\n;---------------------------------------------------------------\n;\n; PROCEDURE StdRRect(verb: GrafVerb; r: Rect; ovWd,ovHt: INTEGER);\n;\n; A6 OFFSETS OF PARAMS AFTER LINK:\n;\nPARAMSIZE .EQU 10\nVERB .EQU PARAMSIZE+8-2 ;GRAFVERB\nRECT .EQU VERB-4 ;LONG, ADDR OF RECT\nOVWD .EQU RECT-2 ;WORD\nOVHT .EQU OVWD-2 ;WORD\n LINK A6,#0 ;NO LOCALS\n MOVEM.L D7/A3-A4,-(SP) ;SAVE REGS\n MOVE.B VERB(A6),D7 ;GET VERB\n JSR CHECKPIC ;SET UP A4,A3 AND CHECK PICSAVE\n BLE.S NOTPIC ;BRANCH IF NOT PICSAVE\n MOVE.B D7,-(SP) ;PUSH VERB\n JSR PutPicVerb ;PUT ADDIONAL PARAMS TO THEPIC\n;\n; CHECK FOR NEW OVAL SIZE\n;\n MOVE.L PICSAVE(A3),A0 ;GET PICSAVE HANDLE\n MOVE.L (A0),A0 ;DE-REFERENCE PICSAVE\n MOVE.L OVHT(A6),D0 ;GET OVWD AND OVHT\n CMP.L PICOVSIZE(A0),D0 ;SAME AS CURRENT OVAL SIZE ?\n BEQ.S OVALOK ;YES, CONTINUE\n MOVE.L D0,PICOVSIZE(A0) ;NO, UPDATE STATE VARIABLE\n MOVE.L D0,-(SP) ;PUSH OVSIZE FOR PutPicLong CALL\n MOVEQ #$0B,D0\n JSR DPutPicByte ;PUT OVSIZE OPCODE\n JSR PutPicLong ;PUT NEW OVAL SIZE DATA\nOVALOK MOVEQ #$40,D0 ;PUT RRECT NOUN IN HI NIBBLE\n ADD D7,D0 ;PUT VERB IN LO NIBBLE\n MOVE.B D0,-(SP) ;PUSH OPCODE\n MOVE.L RECT(A6),-(SP) ;PUSH ADDR OF RECT\n JSR PutPicRect ;PUT OPCODE AND RECTANGLE\nNOTPIC MOVE.L RECT(A6),-(SP) ;PUSH ADDR OF RECT\n CLR.B -(SP) ;PUSH HOLLOW = FALSE\n TST.B D7 ;IS VERB FRAME ?\n BNE.S DOIT ;NO, CONTINUE\n TST.L RGNSAVE(A3) ;YES, IS RGNSAVE TRUE ?\n BEQ.S NOTRGN ;NO, CONTINUE\n MOVE.L RECT(A6),-(SP) ;YES, PUSH ADDR OF RECT\n MOVE.L OVHT(A6),-(SP) ;PUSH OVWD, OVHT\n MOVE.L RGNBUF(A4),-(SP) ;PUSH RGNBUF\n PEA RGNINDEX(A4) ;PUSH VAR RGNINDEX\n PEA RGNMAX(A4) ;PUSH VAR RGNMAX\n JSR PutOval ;ADD AN OVAL TO THERGN\nNOTRGN MOVE.B #1,(SP) ;REPLACE, PUSH HOLLOW = TRUE\nDOIT MOVE.L OVHT(A6),-(SP) ;PUSH OVWD,OVHT\n JSR PushVerb ;PUSH MODE AND PATTERN\n CLR -(SP) ;PUSH STARTANGLE = 0\n MOVE #360,-(SP) ;PUSH ARCANGLE = 360", 80*60+1);
// the_message = General_StrlcpyWithAlloc((char*)"\nThe Anecdote\n\nBill Atkinson worked mostly at home, but whenever he made significant progress he rushed in to Apple to show it off to anyone who would appreciate it. This time, he visited the Macintosh offices at Texaco Towers to show off his brand new oval routines in Quickdraw, which were implemented using a really clever algorithm.\n\nBill had added new code to QuickDraw", 80*60+1);
// the_message = General_StrlcpyWithAlloc((char*)"\n\n\nLINE ONE\n\nLINE TWO", 80*60+1);
// the_message = General_StrlcpyWithAlloc((char*)"THISISAREALLYBIGWORDBIGGERTHANANYYOUCANTHINK_OF_OR_AT_LEAST_I_THINK_SO", 80*60+1);
mu_assert(Text_DrawStringInBox(global_system->screen_[ID_CHANNEL_A], 3, 6, 67, 50, the_message, FG_COLOR_BLACK, BG_COLOR_WHITE, NULL) != NULL, "Text_DrawStringInBox failed" );
mu_assert(Text_DrawStringInBox(global_system->screen_[ID_CHANNEL_B], 21, 21, 40, 40, the_message, FG_COLOR_WHITE, BG_COLOR_BLACK, NULL) != NULL, "Text_DrawStringInBox failed" );
}
MU_TEST(font_replace_test)
{
// until file objects available in emulator, need to embed data to test font replacement.
// this is a remapped C64 font for code page 437
// Exported using VChar64 v0.2.4
// Total bytes: 2048
unsigned char testfont[] = {
0xf0,0xf0,0xf0,0xf0,0x0f,0x0f,0x0f,0x0f,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,
0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0x36,0x7f,0x7f,0x7f,0x3e,0x1c,0x08,0x00,
0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x08,0x00,0x18,0x18,0x66,0x66,0x18,0x18,0x3c,0x00,
0x08,0x1c,0x3e,0x7f,0x7f,0x1c,0x3e,0x00,0x00,0x3c,0x7e,0x7e,0x7e,0x7e,0x3c,0x00,
0xff,0xc3,0x81,0x81,0x81,0x81,0xc3,0xff,0x00,0x3c,0x7e,0x66,0x66,0x7e,0x3c,0x00,
0xff,0xc3,0x81,0x99,0x99,0x81,0xc3,0xff,0x00,0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,
0xff,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0x00,0x00,
0xff,0xff,0xfc,0xc1,0x89,0xc9,0xc9,0xff,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,
0xf7,0xe3,0xc1,0x80,0x80,0xe3,0xc1,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,
0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,
0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xff,0xff,0xff,0x1f,0x0f,0xc7,0xe7,0xe7,
0xe7,0xe7,0xe3,0xf0,0xf8,0xff,0xff,0xff,0x00,0x10,0x30,0x7f,0x7f,0x30,0x10,0x00,
0x00,0x00,0x00,0x00,0x0f,0x0f,0x0f,0x0f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x03,0x07,0x0e,0x1c,0x38,0x70,0xe0,0xc0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x00,0x18,0x00,
0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,0x66,0x66,0xff,0x66,0xff,0x66,0x66,0x00,
0x18,0x3e,0x60,0x3c,0x06,0x7c,0x18,0x00,0x62,0x66,0x0c,0x18,0x30,0x66,0x46,0x00,
0x3c,0x66,0x3c,0x38,0x67,0x66,0x3f,0x00,0x06,0x0c,0x18,0x00,0x00,0x00,0x00,0x00,
0x0c,0x18,0x30,0x30,0x30,0x18,0x0c,0x00,0x30,0x18,0x0c,0x0c,0x0c,0x18,0x30,0x00,
0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x03,0x06,0x0c,0x18,0x30,0x60,0x00,
0x3c,0x66,0x6e,0x76,0x66,0x66,0x3c,0x00,0x18,0x18,0x38,0x18,0x18,0x18,0x7e,0x00,
0x3c,0x66,0x06,0x0c,0x30,0x60,0x7e,0x00,0x3c,0x66,0x06,0x1c,0x06,0x66,0x3c,0x00,
0x06,0x0e,0x1e,0x66,0x7f,0x06,0x06,0x00,0x7e,0x60,0x7c,0x06,0x06,0x66,0x3c,0x00,
0x3c,0x66,0x60,0x7c,0x66,0x66,0x3c,0x00,0x7e,0x66,0x0c,0x18,0x18,0x18,0x18,0x00,
0x3c,0x66,0x66,0x3c,0x66,0x66,0x3c,0x00,0x3c,0x66,0x66,0x3e,0x06,0x66,0x3c,0x00,
0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x18,0x30,
0x0e,0x18,0x30,0x60,0x30,0x18,0x0e,0x00,0x00,0x00,0x7e,0x00,0x7e,0x00,0x00,0x00,
0x70,0x18,0x0c,0x06,0x0c,0x18,0x70,0x00,0x3c,0x66,0x06,0x0c,0x18,0x00,0x18,0x00,
0x3c,0x66,0x6e,0x6e,0x60,0x62,0x3c,0x00,0x18,0x3c,0x66,0x7e,0x66,0x66,0x66,0x00,
0x7c,0x66,0x66,0x7c,0x66,0x66,0x7c,0x00,0x3c,0x66,0x60,0x60,0x60,0x66,0x3c,0x00,
0x78,0x6c,0x66,0x66,0x66,0x6c,0x78,0x00,0x7e,0x60,0x60,0x78,0x60,0x60,0x7e,0x00,
0x7e,0x60,0x60,0x78,0x60,0x60,0x60,0x00,0x3c,0x66,0x60,0x6e,0x66,0x66,0x3c,0x00,
0x66,0x66,0x66,0x7e,0x66,0x66,0x66,0x00,0x3c,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,
0x1e,0x0c,0x0c,0x0c,0x0c,0x6c,0x38,0x00,0x66,0x6c,0x78,0x70,0x78,0x6c,0x66,0x00,
0x60,0x60,0x60,0x60,0x60,0x60,0x7e,0x00,0x63,0x77,0x7f,0x6b,0x63,0x63,0x63,0x00,
0x66,0x76,0x7e,0x7e,0x6e,0x66,0x66,0x00,0x3c,0x66,0x66,0x66,0x66,0x66,0x3c,0x00,
0x7c,0x66,0x66,0x7c,0x60,0x60,0x60,0x00,0x3c,0x66,0x66,0x66,0x66,0x3c,0x0e,0x00,
0x7c,0x66,0x66,0x7c,0x78,0x6c,0x66,0x00,0x3c,0x66,0x60,0x3c,0x06,0x66,0x3c,0x00,
0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3c,0x00,
0x66,0x66,0x66,0x66,0x66,0x3c,0x18,0x00,0x63,0x63,0x63,0x6b,0x7f,0x77,0x63,0x00,
0x66,0x66,0x3c,0x18,0x3c,0x66,0x66,0x00,0x66,0x66,0x66,0x3c,0x18,0x18,0x18,0x00,
0x7e,0x06,0x0c,0x18,0x30,0x60,0x7e,0x00,0x3c,0x30,0x30,0x30,0x30,0x30,0x3c,0x00,
0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x07,0x03,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c,0x00,
0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,
0x00,0x00,0x00,0xe0,0xf0,0x38,0x18,0x18,0x00,0x00,0x3c,0x06,0x3e,0x66,0x3e,0x00,
0x00,0x60,0x60,0x7c,0x66,0x66,0x7c,0x00,0x00,0x00,0x3c,0x60,0x60,0x60,0x3c,0x00,
0x00,0x06,0x06,0x3e,0x66,0x66,0x3e,0x00,0x00,0x00,0x3c,0x66,0x7e,0x60,0x3c,0x00,
0x00,0x0e,0x18,0x3e,0x18,0x18,0x18,0x00,0x00,0x00,0x3e,0x66,0x66,0x3e,0x06,0x7c,
0x00,0x60,0x60,0x7c,0x66,0x66,0x66,0x00,0x00,0x18,0x00,0x38,0x18,0x18,0x3c,0x00,
0x00,0x06,0x00,0x06,0x06,0x06,0x06,0x3c,0x00,0x60,0x60,0x6c,0x78,0x6c,0x66,0x00,
0x00,0x38,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x66,0x7f,0x7f,0x6b,0x63,0x00,
0x00,0x00,0x7c,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x3c,0x66,0x66,0x66,0x3c,0x00,
0x00,0x00,0x7c,0x66,0x66,0x7c,0x60,0x60,0x00,0x00,0x3e,0x66,0x66,0x3e,0x06,0x06,
0x00,0x00,0x7c,0x66,0x60,0x60,0x60,0x00,0x00,0x00,0x3e,0x60,0x3c,0x06,0x7c,0x00,
0x00,0x18,0x7e,0x18,0x18,0x18,0x0e,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x3e,0x00,
0x00,0x00,0x66,0x66,0x66,0x3c,0x18,0x00,0x00,0x00,0x63,0x6b,0x7f,0x3e,0x36,0x00,
0x00,0x00,0x66,0x3c,0x18,0x3c,0x66,0x00,0x00,0x00,0x66,0x66,0x66,0x3e,0x0c,0x78,
0x00,0x00,0x7e,0x0c,0x18,0x30,0x7e,0x00,0x18,0x18,0x18,0xff,0xff,0x18,0x18,0x18,
0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x18,0x18,0x18,0xff,0xff,0x00,0x00,0x00,
0x0c,0x12,0x30,0x7c,0x30,0x62,0xfc,0x00,0x01,0x03,0x06,0x6c,0x78,0x70,0x60,0x00,
0xff,0xff,0xff,0xe0,0xe0,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0x00,0x00,0xff,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0xe7,0xe7,0xe7,0x3f,0x3f,0xcf,0xcf,0x3f,0x3f,0xcf,0xcf,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe7,0xe7,0xc7,0x0f,0x1f,0xff,0xff,0xff,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x3f,0x1f,0x8f,0xc7,0xe3,0xf1,0xf8,0xfc,
0xfc,0xf8,0xf1,0xe3,0xc7,0x8f,0x1f,0x3f,0x00,0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x00,0x00,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0x0f,0x0f,0x0f,0x0f,0xf0,0xf0,0xf0,0xf0,
0x00,0x00,0x00,0x00,0xf0,0xf0,0xf0,0xf0,0xc9,0x80,0x80,0x80,0xc1,0xe3,0xf7,0xff,
0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0xff,0xff,0xff,0xf8,0xf0,0xe3,0xe7,0xe7,
0x3c,0x18,0x81,0xc3,0xc3,0x81,0x18,0x3c,0x0f,0x0f,0x0f,0x0f,0x00,0x00,0x00,0x00,
0xe7,0xe7,0x99,0x99,0xe7,0xe7,0xc3,0xff,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,
0xf7,0xe3,0xc1,0x80,0xc1,0xe3,0xf7,0xff,0xe7,0xe7,0xe7,0x00,0x00,0xe7,0xe7,0xe7,
0xc0,0xc0,0x30,0x30,0xc0,0xc0,0x30,0x30,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x18,0x18,0x18,0x1f,0x1f,0x18,0x18,0x18,0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,
0x18,0x18,0x18,0xff,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
0xff,0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x33,0x33,0xcc,0xcc,0x33,0x33,0xcc,0xcc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
0xff,0xff,0xff,0xff,0x33,0x33,0xcc,0xcc,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,
0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xe7,0xe7,0xe7,0xe0,0xe0,0xe7,0xe7,0xe7,
0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,0xe7,0xe7,0xe7,0xe0,0xe0,0xff,0xff,0xff,
0xff,0xff,0xff,0x07,0x07,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
0x33,0x33,0xcc,0xcc,0x33,0x33,0xcc,0xcc,0x33,0x99,0xcc,0x66,0x33,0x99,0xcc,0x66,
0xcc,0xcc,0x33,0x33,0xcc,0xcc,0x33,0x33,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
0x18,0x18,0x18,0xf8,0xf8,0x18,0x18,0x18,0x00,0x00,0x00,0xff,0xff,0x18,0x18,0x18,
0xe7,0xe7,0xe7,0x07,0x07,0xe7,0xe7,0xe7,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,
0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,
0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0x0f,0x0f,0x0f,0x0f,
0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0x07,0x07,0xff,0xff,0xff,
0x0f,0x0f,0x0f,0x0f,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xf8,0xf8,0x18,0x18,0x18,
0x18,0x18,0x18,0x1f,0x1f,0x00,0x00,0x00,0xc0,0xc0,0x30,0x30,0xc0,0xc0,0x30,0x30,
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,
0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x34,
0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
0x18,0x18,0x1c,0x0f,0x07,0x00,0x00,0x00,0x18,0x18,0x38,0xf0,0xe0,0x00,0x00,0x00,
0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,
0xff,0xff,0x03,0x03,0x03,0x03,0x03,0x03,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,
0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x07,0x0f,0x1c,0x18,0x18,
0xc3,0xe7,0x7e,0x3c,0x3c,0x7e,0xe7,0xc3,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x00,0x00,0x00,0x00,0xcc,0xcc,0x33,0x33,0x18,0x18,0x18,0xf8,0xf8,0x00,0x00,0x00,
0x00,0x00,0x00,0x1f,0x1f,0x18,0x18,0x18,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
0x00,0x00,0x03,0x3e,0x76,0x36,0x36,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,
0xcc,0xcc,0x33,0x33,0xcc,0xcc,0x33,0x33,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x00,0x00,0x00,0x00,0xcc,0xcc,0x33,0x33,0xcc,0x99,0x33,0x66,0xcc,0x99,0x33,0x66,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x18,0x18,0x18,0x1f,0x1f,0x18,0x18,0x18,
0x00,0x00,0x00,0x00,0x0f,0x0f,0x0f,0x0f,0x18,0x18,0x18,0x1f,0x1f,0x00,0x00,0x00,
0x00,0x00,0x00,0xf8,0xf8,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,
0x00,0x00,0x00,0x1f,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0xff,0x00,0x00,0x00,
0x00,0x00,0x00,0xff,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0xf8,0x18,0x18,0x18,
0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,
0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,
0x03,0x03,0x03,0x03,0x03,0x03,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xf0,0xf0,0xf0,
0x0f,0x0f,0x0f,0x0f,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xf8,0xf8,0x00,0x00,0x00,
0xf0,0xf0,0xf0,0xf0,0x00,0x00,0x00,0x00,0xf0,0xf0,0xf0,0xf0,0x0f,0x0f,0x0f,0x0f,
};
unsigned char* the_new_font_data = testfont;
// mu_assert(Text_UpdateFontData(global_system->screen_[ID_CHANNEL_A], (char*)the_new_font_data) == true, "Failed to update font data for Channel A" );
mu_assert(Text_UpdateFontData(global_system->screen_[ID_CHANNEL_B], (char*)the_new_font_data) == true, "Failed to update font data for Channel B" );
}
// **** speed tests
MU_TEST(text_test_hline_speed)
{
long start1;
long end1;
long start2;
long end2;
int16_t x;
int16_t y;
int16_t line_len;
unsigned char the_char;
int16_t i;
int16_t num_passes = 90;
int16_t j;
int16_t num_cycles = 10;
x = 1;
y = 1;
line_len = 120;
the_char = CH_WALL_H;
// test speed of first variant
start1 = mu_timer_real();
for (j = 0; j < num_cycles; j++)
{
for (i=0; i < num_passes; i++)
{
mu_assert( Text_DrawHLineSlow(global_system->screen_[ID_CHANNEL_A], x, y + i, line_len, the_char, FG_COLOR_GREEN, BG_COLOR_BLACK, CHAR_ONLY) == true, "Text_DrawHLine failed" );
}
}
end1 = mu_timer_real();
// test speed of second variant
x++;
start2 = mu_timer_real();
for (j = 0; j < num_cycles; j++)
{
for (i=0; i < num_passes; i++)
{
mu_assert( Text_DrawHLine(global_system->screen_[ID_CHANNEL_A], x, y + i, line_len, the_char, FG_COLOR_RED, BG_COLOR_BLACK, CHAR_ONLY) == true, "Text_DrawHLine failed" );
}
}
end2 = mu_timer_real();
printf("\nSpeed results: first routine completed in %li ticks; second in %li ticks\n", end1 - start1, end2 - start2);
// run again, with different values
x = 1;
y = 1;
line_len = 120;
the_char = CH_WALL_H;
// test speed of first variant
start1 = mu_timer_real();
for (j = 0; j < num_cycles; j++)
{
for (i=0; i < num_passes; i++)
{
mu_assert( Text_DrawHLineSlow(global_system->screen_[ID_CHANNEL_A], x, y + i, line_len, the_char, FG_COLOR_GREEN, BG_COLOR_BLACK, CHAR_AND_ATTR) == true, "Text_DrawHLine failed" );
}
}
end1 = mu_timer_real();
// test speed of second variant
x++;
start2 = mu_timer_real();
for (j = 0; j < num_cycles; j++)
{
for (i=0; i < num_passes; i++)
{
mu_assert( Text_DrawHLine(global_system->screen_[ID_CHANNEL_A], x, y + i, line_len, the_char, FG_COLOR_RED, BG_COLOR_BLACK, CHAR_AND_ATTR) == true, "Text_DrawHLine failed" );
}
}
end2 = mu_timer_real();
printf("\nSpeed results: first routine completed in %li ticks; second in %li ticks\n", end1 - start1, end2 - start2);
}
// speed tests
MU_TEST_SUITE(text_test_suite_speed)
{
MU_SUITE_CONFIGURE(&text_test_setup, &text_test_teardown);
MU_RUN_TEST(text_test_hline_speed);
}
// unit tests
MU_TEST_SUITE(text_test_suite_units)
{
MU_SUITE_CONFIGURE(&text_test_setup, &text_test_teardown);
MU_RUN_TEST(text_test_fill_text);
MU_RUN_TEST(text_test_fill_attr);
MU_RUN_TEST(text_test_fill_box);
MU_RUN_TEST(text_test_show_font);
MU_RUN_TEST(text_test_char_placement);
MU_RUN_TEST(text_test_block_copy_box);
// MU_RUN_TEST(text_test_font_overwrite);
// MU_RUN_TEST(text_test_update_font);
MU_RUN_TEST(text_test_char_and_attr_writing);
MU_RUN_TEST(text_test_char_and_attr_reading);
MU_RUN_TEST(text_test_line_drawing);
MU_RUN_TEST(text_test_basic_box_coords);
MU_RUN_TEST(text_test_basic_box_hw);
MU_RUN_TEST(text_test_fancy_box);
MU_RUN_TEST(text_test_draw_string);
MU_RUN_TEST(text_test_draw_string_in_box);
MU_RUN_TEST(text_test_invert_box);
MU_RUN_TEST(text_test_block_copy);
MU_RUN_TEST(font_replace_test);
}
/*****************************************************************************/
/* Public Function Definitions */
/*****************************************************************************/
int main(int argc, char* argv[])
{
if (Sys_InitSystem() == false)
{
DEBUG_OUT(("%s %d: Couldn't initialize the system", __func__, __LINE__));
exit(0);
}
#if defined(RUN_TESTS)
MU_RUN_SUITE(text_test_suite_units);
// MU_RUN_SUITE(text_test_suite_speed);
// MU_REPORT();
return MU_EXIT_CODE;
#endif
return 0;
}
| 63.344961 | 7,020 | 0.689469 |
aaa277dd6d991e9de2cb7bc7f9087d7d131a9637 | 15,026 | c | C | runtime/musl-lkl/lkl/drivers/clk/ti/divider.c | dme26/intravisor | 9bf9c50aa14616bd9bd66eee47623e8b61514058 | [
"MIT"
] | 11 | 2022-02-05T12:12:43.000Z | 2022-03-08T08:09:08.000Z | runtime/musl-lkl/lkl/drivers/clk/ti/divider.c | dme26/intravisor | 9bf9c50aa14616bd9bd66eee47623e8b61514058 | [
"MIT"
] | null | null | null | runtime/musl-lkl/lkl/drivers/clk/ti/divider.c | dme26/intravisor | 9bf9c50aa14616bd9bd66eee47623e8b61514058 | [
"MIT"
] | 1 | 2022-02-22T20:32:22.000Z | 2022-02-22T20:32:22.000Z | /*
* TI Divider Clock
*
* Copyright (C) 2013 Texas Instruments, Inc.
*
* Tero Kristo <t-kristo@ti.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/clk-provider.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/clk/ti.h>
#include "clock.h"
#undef pr_fmt
#define pr_fmt(fmt) "%s: " fmt, __func__
#define div_mask(d) ((1 << ((d)->width)) - 1)
static unsigned int _get_table_maxdiv(const struct clk_div_table *table)
{
unsigned int maxdiv = 0;
const struct clk_div_table *clkt;
for (clkt = table; clkt->div; clkt++)
if (clkt->div > maxdiv)
maxdiv = clkt->div;
return maxdiv;
}
static unsigned int _get_maxdiv(struct clk_omap_divider *divider)
{
if (divider->flags & CLK_DIVIDER_ONE_BASED)
return div_mask(divider);
if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
return 1 << div_mask(divider);
if (divider->table)
return _get_table_maxdiv(divider->table);
return div_mask(divider) + 1;
}
static unsigned int _get_table_div(const struct clk_div_table *table,
unsigned int val)
{
const struct clk_div_table *clkt;
for (clkt = table; clkt->div; clkt++)
if (clkt->val == val)
return clkt->div;
return 0;
}
static unsigned int _get_div(struct clk_omap_divider *divider, unsigned int val)
{
if (divider->flags & CLK_DIVIDER_ONE_BASED)
return val;
if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
return 1 << val;
if (divider->table)
return _get_table_div(divider->table, val);
return val + 1;
}
static unsigned int _get_table_val(const struct clk_div_table *table,
unsigned int div)
{
const struct clk_div_table *clkt;
for (clkt = table; clkt->div; clkt++)
if (clkt->div == div)
return clkt->val;
return 0;
}
static unsigned int _get_val(struct clk_omap_divider *divider, u8 div)
{
if (divider->flags & CLK_DIVIDER_ONE_BASED)
return div;
if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
return __ffs(div);
if (divider->table)
return _get_table_val(divider->table, div);
return div - 1;
}
static unsigned long ti_clk_divider_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
struct clk_omap_divider *divider = to_clk_omap_divider(hw);
unsigned int div, val;
val = ti_clk_ll_ops->clk_readl(÷r->reg) >> divider->shift;
val &= div_mask(divider);
div = _get_div(divider, val);
if (!div) {
WARN(!(divider->flags & CLK_DIVIDER_ALLOW_ZERO),
"%s: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set\n",
clk_hw_get_name(hw));
return parent_rate;
}
return DIV_ROUND_UP(parent_rate, div);
}
/*
* The reverse of DIV_ROUND_UP: The maximum number which
* divided by m is r
*/
#define MULT_ROUND_UP(r, m) ((r) * (m) + (m) - 1)
static bool _is_valid_table_div(const struct clk_div_table *table,
unsigned int div)
{
const struct clk_div_table *clkt;
for (clkt = table; clkt->div; clkt++)
if (clkt->div == div)
return true;
return false;
}
static bool _is_valid_div(struct clk_omap_divider *divider, unsigned int div)
{
if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
return is_power_of_2(div);
if (divider->table)
return _is_valid_table_div(divider->table, div);
return true;
}
static int _div_round_up(const struct clk_div_table *table,
unsigned long parent_rate, unsigned long rate)
{
const struct clk_div_table *clkt;
int up = INT_MAX;
int div = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
for (clkt = table; clkt->div; clkt++) {
if (clkt->div == div)
return clkt->div;
else if (clkt->div < div)
continue;
if ((clkt->div - div) < (up - div))
up = clkt->div;
}
return up;
}
static int _div_round(const struct clk_div_table *table,
unsigned long parent_rate, unsigned long rate)
{
if (!table)
return DIV_ROUND_UP(parent_rate, rate);
return _div_round_up(table, parent_rate, rate);
}
static int ti_clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
unsigned long *best_parent_rate)
{
struct clk_omap_divider *divider = to_clk_omap_divider(hw);
int i, bestdiv = 0;
unsigned long parent_rate, best = 0, now, maxdiv;
unsigned long parent_rate_saved = *best_parent_rate;
if (!rate)
rate = 1;
maxdiv = _get_maxdiv(divider);
if (!(clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)) {
parent_rate = *best_parent_rate;
bestdiv = _div_round(divider->table, parent_rate, rate);
bestdiv = bestdiv == 0 ? 1 : bestdiv;
bestdiv = bestdiv > maxdiv ? maxdiv : bestdiv;
return bestdiv;
}
/*
* The maximum divider we can use without overflowing
* unsigned long in rate * i below
*/
maxdiv = min(ULONG_MAX / rate, maxdiv);
for (i = 1; i <= maxdiv; i++) {
if (!_is_valid_div(divider, i))
continue;
if (rate * i == parent_rate_saved) {
/*
* It's the most ideal case if the requested rate can be
* divided from parent clock without needing to change
* parent rate, so return the divider immediately.
*/
*best_parent_rate = parent_rate_saved;
return i;
}
parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw),
MULT_ROUND_UP(rate, i));
now = DIV_ROUND_UP(parent_rate, i);
if (now <= rate && now > best) {
bestdiv = i;
best = now;
*best_parent_rate = parent_rate;
}
}
if (!bestdiv) {
bestdiv = _get_maxdiv(divider);
*best_parent_rate =
clk_hw_round_rate(clk_hw_get_parent(hw), 1);
}
return bestdiv;
}
static long ti_clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate)
{
int div;
div = ti_clk_divider_bestdiv(hw, rate, prate);
return DIV_ROUND_UP(*prate, div);
}
static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_omap_divider *divider;
unsigned int div, value;
u32 val;
if (!hw || !rate)
return -EINVAL;
divider = to_clk_omap_divider(hw);
div = DIV_ROUND_UP(parent_rate, rate);
value = _get_val(divider, div);
if (value > div_mask(divider))
value = div_mask(divider);
if (divider->flags & CLK_DIVIDER_HIWORD_MASK) {
val = div_mask(divider) << (divider->shift + 16);
} else {
val = ti_clk_ll_ops->clk_readl(÷r->reg);
val &= ~(div_mask(divider) << divider->shift);
}
val |= value << divider->shift;
ti_clk_ll_ops->clk_writel(val, ÷r->reg);
ti_clk_latch(÷r->reg, divider->latch);
return 0;
}
const struct clk_ops ti_clk_divider_ops = {
.recalc_rate = ti_clk_divider_recalc_rate,
.round_rate = ti_clk_divider_round_rate,
.set_rate = ti_clk_divider_set_rate,
};
static struct clk *_register_divider(struct device *dev, const char *name,
const char *parent_name,
unsigned long flags,
struct clk_omap_reg *reg,
u8 shift, u8 width, s8 latch,
u8 clk_divider_flags,
const struct clk_div_table *table)
{
struct clk_omap_divider *div;
struct clk *clk;
struct clk_init_data init;
if (clk_divider_flags & CLK_DIVIDER_HIWORD_MASK) {
if (width + shift > 16) {
pr_warn("divider value exceeds LOWORD field\n");
return ERR_PTR(-EINVAL);
}
}
/* allocate the divider */
div = kzalloc(sizeof(*div), GFP_KERNEL);
if (!div)
return ERR_PTR(-ENOMEM);
init.name = name;
init.ops = &ti_clk_divider_ops;
init.flags = flags | CLK_IS_BASIC;
init.parent_names = (parent_name ? &parent_name : NULL);
init.num_parents = (parent_name ? 1 : 0);
/* struct clk_divider assignments */
memcpy(&div->reg, reg, sizeof(*reg));
div->shift = shift;
div->width = width;
div->latch = latch;
div->flags = clk_divider_flags;
div->hw.init = &init;
div->table = table;
/* register the clock */
clk = ti_clk_register(dev, &div->hw, name);
if (IS_ERR(clk))
kfree(div);
return clk;
}
int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
u8 flags, u8 *width,
const struct clk_div_table **table)
{
int valid_div = 0;
u32 val;
int div;
int i;
struct clk_div_table *tmp;
if (!div_table) {
if (flags & CLKF_INDEX_STARTS_AT_ONE)
val = 1;
else
val = 0;
div = 1;
while (div < max_div) {
if (flags & CLKF_INDEX_POWER_OF_TWO)
div <<= 1;
else
div++;
val++;
}
*width = fls(val);
*table = NULL;
return 0;
}
i = 0;
while (!num_dividers || i < num_dividers) {
if (div_table[i] == -1)
break;
if (div_table[i])
valid_div++;
i++;
}
num_dividers = i;
tmp = kzalloc(sizeof(*tmp) * (valid_div + 1), GFP_KERNEL);
if (!tmp)
return -ENOMEM;
valid_div = 0;
*width = 0;
for (i = 0; i < num_dividers; i++)
if (div_table[i] > 0) {
tmp[valid_div].div = div_table[i];
tmp[valid_div].val = i;
valid_div++;
*width = i;
}
*width = fls(*width);
*table = tmp;
return 0;
}
static const struct clk_div_table *
_get_div_table_from_setup(struct ti_clk_divider *setup, u8 *width)
{
const struct clk_div_table *table = NULL;
ti_clk_parse_divider_data(setup->dividers, setup->num_dividers,
setup->max_div, setup->flags, width,
&table);
return table;
}
struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup)
{
struct clk_omap_divider *div;
struct clk_omap_reg *reg;
if (!setup)
return NULL;
div = kzalloc(sizeof(*div), GFP_KERNEL);
if (!div)
return ERR_PTR(-ENOMEM);
reg = (struct clk_omap_reg *)&div->reg;
reg->index = setup->module;
reg->offset = setup->reg;
if (setup->flags & CLKF_INDEX_STARTS_AT_ONE)
div->flags |= CLK_DIVIDER_ONE_BASED;
if (setup->flags & CLKF_INDEX_POWER_OF_TWO)
div->flags |= CLK_DIVIDER_POWER_OF_TWO;
div->table = _get_div_table_from_setup(setup, &div->width);
div->shift = setup->bit_shift;
div->latch = -EINVAL;
return &div->hw;
}
struct clk *ti_clk_register_divider(struct ti_clk *setup)
{
struct ti_clk_divider *div = setup->data;
struct clk_omap_reg reg = {
.index = div->module,
.offset = div->reg,
};
u8 width;
u32 flags = 0;
u8 div_flags = 0;
const struct clk_div_table *table;
struct clk *clk;
if (div->flags & CLKF_INDEX_STARTS_AT_ONE)
div_flags |= CLK_DIVIDER_ONE_BASED;
if (div->flags & CLKF_INDEX_POWER_OF_TWO)
div_flags |= CLK_DIVIDER_POWER_OF_TWO;
if (div->flags & CLKF_SET_RATE_PARENT)
flags |= CLK_SET_RATE_PARENT;
table = _get_div_table_from_setup(div, &width);
if (IS_ERR(table))
return (struct clk *)table;
clk = _register_divider(NULL, setup->name, div->parent,
flags, ®, div->bit_shift,
width, -EINVAL, div_flags, table);
if (IS_ERR(clk))
kfree(table);
return clk;
}
static struct clk_div_table *
__init ti_clk_get_div_table(struct device_node *node)
{
struct clk_div_table *table;
const __be32 *divspec;
u32 val;
u32 num_div;
u32 valid_div;
int i;
divspec = of_get_property(node, "ti,dividers", &num_div);
if (!divspec)
return NULL;
num_div /= 4;
valid_div = 0;
/* Determine required size for divider table */
for (i = 0; i < num_div; i++) {
of_property_read_u32_index(node, "ti,dividers", i, &val);
if (val)
valid_div++;
}
if (!valid_div) {
pr_err("no valid dividers for %s table\n", node->name);
return ERR_PTR(-EINVAL);
}
table = kzalloc(sizeof(*table) * (valid_div + 1), GFP_KERNEL);
if (!table)
return ERR_PTR(-ENOMEM);
valid_div = 0;
for (i = 0; i < num_div; i++) {
of_property_read_u32_index(node, "ti,dividers", i, &val);
if (val) {
table[valid_div].div = val;
table[valid_div].val = i;
valid_div++;
}
}
return table;
}
static int _get_divider_width(struct device_node *node,
const struct clk_div_table *table,
u8 flags)
{
u32 min_div;
u32 max_div;
u32 val = 0;
u32 div;
if (!table) {
/* Clk divider table not provided, determine min/max divs */
if (of_property_read_u32(node, "ti,min-div", &min_div))
min_div = 1;
if (of_property_read_u32(node, "ti,max-div", &max_div)) {
pr_err("no max-div for %s!\n", node->name);
return -EINVAL;
}
/* Determine bit width for the field */
if (flags & CLK_DIVIDER_ONE_BASED)
val = 1;
div = min_div;
while (div < max_div) {
if (flags & CLK_DIVIDER_POWER_OF_TWO)
div <<= 1;
else
div++;
val++;
}
} else {
div = 0;
while (table[div].div) {
val = table[div].val;
div++;
}
}
return fls(val);
}
static int __init ti_clk_divider_populate(struct device_node *node,
struct clk_omap_reg *reg, const struct clk_div_table **table,
u32 *flags, u8 *div_flags, u8 *width, u8 *shift, s8 *latch)
{
u32 val;
int ret;
ret = ti_clk_get_reg_addr(node, 0, reg);
if (ret)
return ret;
if (!of_property_read_u32(node, "ti,bit-shift", &val))
*shift = val;
else
*shift = 0;
if (latch) {
if (!of_property_read_u32(node, "ti,latch-bit", &val))
*latch = val;
else
*latch = -EINVAL;
}
*flags = 0;
*div_flags = 0;
if (of_property_read_bool(node, "ti,index-starts-at-one"))
*div_flags |= CLK_DIVIDER_ONE_BASED;
if (of_property_read_bool(node, "ti,index-power-of-two"))
*div_flags |= CLK_DIVIDER_POWER_OF_TWO;
if (of_property_read_bool(node, "ti,set-rate-parent"))
*flags |= CLK_SET_RATE_PARENT;
*table = ti_clk_get_div_table(node);
if (IS_ERR(*table))
return PTR_ERR(*table);
*width = _get_divider_width(node, *table, *div_flags);
return 0;
}
/**
* of_ti_divider_clk_setup - Setup function for simple div rate clock
* @node: device node for this clock
*
* Sets up a basic divider clock.
*/
static void __init of_ti_divider_clk_setup(struct device_node *node)
{
struct clk *clk;
const char *parent_name;
struct clk_omap_reg reg;
u8 clk_divider_flags = 0;
u8 width = 0;
u8 shift = 0;
s8 latch = -EINVAL;
const struct clk_div_table *table = NULL;
u32 flags = 0;
parent_name = of_clk_get_parent_name(node, 0);
if (ti_clk_divider_populate(node, ®, &table, &flags,
&clk_divider_flags, &width, &shift, &latch))
goto cleanup;
clk = _register_divider(NULL, node->name, parent_name, flags, ®,
shift, width, latch, clk_divider_flags, table);
if (!IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk);
of_ti_clk_autoidle_setup(node);
return;
}
cleanup:
kfree(table);
}
CLK_OF_DECLARE(divider_clk, "ti,divider-clock", of_ti_divider_clk_setup);
static void __init of_ti_composite_divider_clk_setup(struct device_node *node)
{
struct clk_omap_divider *div;
u32 val;
div = kzalloc(sizeof(*div), GFP_KERNEL);
if (!div)
return;
if (ti_clk_divider_populate(node, &div->reg, &div->table, &val,
&div->flags, &div->width, &div->shift,
NULL) < 0)
goto cleanup;
if (!ti_clk_add_component(node, &div->hw, CLK_COMPONENT_TYPE_DIVIDER))
return;
cleanup:
kfree(div->table);
kfree(div);
}
CLK_OF_DECLARE(ti_composite_divider_clk, "ti,composite-divider-clock",
of_ti_composite_divider_clk_setup);
| 22.494012 | 80 | 0.686943 |
34237cbaeab25a3effa5b0e41804f5f898b1b079 | 10,684 | c | C | xdk-asf-3.51.0/common/components/wifi/winc1500/simple_growl_example/main21.c | j3270/SAMD_Experiments | 5c242aff44fc8d7092322d7baf2dda450a78a9b7 | [
"MIT"
] | null | null | null | xdk-asf-3.51.0/common/components/wifi/winc1500/simple_growl_example/main21.c | j3270/SAMD_Experiments | 5c242aff44fc8d7092322d7baf2dda450a78a9b7 | [
"MIT"
] | null | null | null | xdk-asf-3.51.0/common/components/wifi/winc1500/simple_growl_example/main21.c | j3270/SAMD_Experiments | 5c242aff44fc8d7092322d7baf2dda450a78a9b7 | [
"MIT"
] | null | null | null | /**
*
* \file
*
* \brief WINC1500 Simple Growl Example.
*
* Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.
*
* \asf_license_start
*
* \page License
*
* Subject to your compliance with these terms, you may use Microchip
* software and any derivatives exclusively with Microchip products.
* It is your responsibility to comply with third party license terms applicable
* to your use of third party software (including open source software) that
* may accompany Microchip software.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
* INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
* LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
* SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
* POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
* RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
*
* \asf_license_stop
*
*/
/** \mainpage
* \section intro Introduction
* This example demonstrates the use of the WINC1500 with the SAMD21 Xplained Pro.
* It basically transmits a notification from the WINC1500 Wi-Fi module (based on a
* certain trigger) to a public remote server which in turn sends back a notification
* to a specific phone application.<br>
* The initiated notification from the WINC1500 device is directed to a certain
* subscriber on the server.<br>
* The supported applications are PROWL (for iPhone notifications) and NMA (for
* ANDROID notifications).<br>
* It uses the following hardware:
* - the SAMD21 Xplained Pro.
* - the WINC1500 on EXT1.
*
* \section files Main Files
* - main.c : Initialize growl and send notification message.
*
* \section usage Usage
* -# Build the program and download it into the board.
* -# On the computer, open and configure a terminal application as the follows.
* \code
* Baud Rate : 115200
* Data : 8bit
* Parity bit : none
* Stop bit : 1bit
* Flow control : none
* \endcode
* -# Start the application.
* -# In the terminal window, the following text should appear:
* \code
* -- WINC1500 simple growl example --
* -- SAMD21_XPLAINED_PRO --
* -- Compiled: xxx xx xxxx xx:xx:xx --
* Provision Mode started.
* Connect to [atmelconfig.com] via AP[WINC1500_xx:xx] and fill up the page
* Wi-Fi connected
* Wi-Fi IP is xxx.xxx.xxx.xxx
* wifi_cb: M2M_WIFI_RESP_PROVISION_INFO.
* Wi-Fi connected
* Wi-Fi IP is xxx.xxx.xxx.xxx
* send Growl message
* Growl CB : 20
* \endcode
*
* This application supports sending GROWL notifications to the following servers.
* -# PROWL for iOS push notifications (https://www.prowlapp.com/).
* -# NMA for Android push notifications (http://www.notifymyandroid.com/).
*
* In order to enable the GROWL application (for sending notifications), apply the following instructions.
* -# Create a NMA account at http://www.notifymyandroid.com/ and create an API key. Copy the obtained key string in the file
* main.h in the MACRO NMA_API_KEY as the following.
* -# Create a PROWL account at https://www.prowlapp.com/ and create an API key. Copy the obtained API key string in the file
* main.h in the MACRO PROWL_API_KEY as the following.<br>
* #define NMA_API_KEY "f8bd3e7c9c5c10183751ab010e57d8f73494b32da73292f6"<br>
* #define PROWL_API_KEY "117911f8a4f2935b2d84abc934be9ff77d883678"
*
* \warning
* \code
* For using the growl, the root certificate must be installed.
* Download the root certificate using the root_certificate_downloader. (Refer to WINC1500 Software User Guide.)
* \endcode
*
* \section compinfo Compilation Information
* This software was written for the GNU GCC compiler using Atmel Studio 6.2
* Other compilers may or may not work.
*
* \section contactinfo Contact Information
* For further information, visit
* <A href="http://www.microchip.com">Microchip</A>.\n
*/
#include "asf.h"
#include "main.h"
#include "driver/source/nmasic.h"
#include "growl/growl.h"
#define STRING_EOL "\r\n"
#define STRING_HEADER "-- WINC1500 simple growl example --"STRING_EOL \
"-- "BOARD_NAME " --"STRING_EOL \
"-- Compiled: "__DATE__ " "__TIME__ " --"STRING_EOL
/** UART module for debug. */
static struct usart_module cdc_uart_module;
/**
* \brief Configure UART console.
*/
static void configure_console(void)
{
struct usart_config usart_conf;
usart_get_config_defaults(&usart_conf);
usart_conf.mux_setting = EDBG_CDC_SERCOM_MUX_SETTING;
usart_conf.pinmux_pad0 = EDBG_CDC_SERCOM_PINMUX_PAD0;
usart_conf.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1;
usart_conf.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2;
usart_conf.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3;
usart_conf.baudrate = 115200;
stdio_serial_init(&cdc_uart_module, EDBG_CDC_MODULE, &usart_conf);
usart_enable(&cdc_uart_module);
}
/**
* \brief Send a specific notification to a registered Android(NMA) or IOS(PROWL)
*/
static int growl_send_message_handler(void)
{
printf("send Growl message \r\n");
/* NMI_GrowlSendNotification(PROWL_CLIENT, (uint8_t*)"Growl_Sample", (uint8_t*)"Growl_Event", (uint8_t*)msg_for_growl,PROWL_CONNECTION_TYPE); // send by PROWL */
NMI_GrowlSendNotification(NMA_CLIENT, (uint8_t *)"Growl_Sample", (uint8_t *)"Growl_Event", (uint8_t *)"growl_test", NMA_CONNECTION_TYPE); /* send by NMA */
return 0;
}
static void set_dev_name_to_mac(uint8_t *name, uint8_t *mac_addr)
{
/* Name must be in the format WINC1500_00:00 */
uint16 len;
len = m2m_strlen(name);
if (len >= 5) {
name[len - 1] = MAIN_HEX2ASCII((mac_addr[5] >> 0) & 0x0f);
name[len - 2] = MAIN_HEX2ASCII((mac_addr[5] >> 4) & 0x0f);
name[len - 4] = MAIN_HEX2ASCII((mac_addr[4] >> 0) & 0x0f);
name[len - 5] = MAIN_HEX2ASCII((mac_addr[4] >> 4) & 0x0f);
}
}
/**
* \brief Callback to get the Wi-Fi status update.
*
* \param[in] u8MsgType type of Wi-Fi notification. Possible types are:
* - [M2M_WIFI_RESP_CON_STATE_CHANGED](@ref M2M_WIFI_RESP_CON_STATE_CHANGED)
* - [M2M_WIFI_REQ_DHCP_CONF](@ref M2M_WIFI_REQ_DHCP_CONF)
* \param[in] pvMsg A pointer to a buffer containing the notification parameters
* (if any). It should be casted to the correct data type corresponding to the
* notification type.
*/
static void wifi_cb(uint8_t u8MsgType, void *pvMsg)
{
switch (u8MsgType) {
case M2M_WIFI_RESP_CON_STATE_CHANGED:
{
tstrM2mWifiStateChanged *pstrWifiState = (tstrM2mWifiStateChanged *)pvMsg;
if (pstrWifiState->u8CurrState == M2M_WIFI_CONNECTED) {
printf("Wi-Fi connected\r\n");
m2m_wifi_request_dhcp_client();
} else if (pstrWifiState->u8CurrState == M2M_WIFI_DISCONNECTED) {
printf("Wi-Fi disconnected\r\n");
}
break;
}
case M2M_WIFI_REQ_DHCP_CONF:
{
uint8_t *pu8IPAddress = (uint8_t *)pvMsg;
printf("Wi-Fi IP is %u.%u.%u.%u\r\n",
pu8IPAddress[0], pu8IPAddress[1], pu8IPAddress[2], pu8IPAddress[3]);
if (gbRespProvInfo) {
/** init growl */
NMI_GrowlInit((uint8_t *)PROWL_API_KEY, (uint8_t *)NMA_API_KEY);
growl_send_message_handler();
}
break;
}
case M2M_WIFI_RESP_PROVISION_INFO:
{
tstrM2MProvisionInfo *pstrProvInfo = (tstrM2MProvisionInfo *)pvMsg;
printf("wifi_cb: M2M_WIFI_RESP_PROVISION_INFO.\r\n");
if (pstrProvInfo->u8Status == M2M_SUCCESS) {
m2m_wifi_connect((char *)pstrProvInfo->au8SSID, strlen((char *)pstrProvInfo->au8SSID), pstrProvInfo->u8SecType,
pstrProvInfo->au8Password, M2M_WIFI_CH_ALL);
gbRespProvInfo = true;
} else {
printf("wifi_cb: Provision failed.\r\n");
}
break;
}
default:
{
break;
}
}
}
/**
* \brief Growl notification callback.
* Pointer to a function delivering growl events.
*
* \param [u8Code] Possible error codes could be returned by the nma server and refer to the comments in the growl.h.
* - [20] GROWL_SUCCESS (@ref GROWL_SUCCESS)
* - [40] GROWL_ERR_BAD_REQUEST (@ref GROWL_ERR_BAD_REQUEST)
* - [41] GROWL_ERR_NOT_AUTHORIZED (@ref GROWL_ERR_NOT_AUTHORIZED)
* - [42] GROWL_ERR_NOT_ACCEPTED (@ref GROWL_ERR_NOT_ACCEPTED)
* - [46] GROWL_ERR_API_EXCEED (@ref GROWL_ERR_API_EXCEED)
* - [49] GROWL_ERR_NOT_APPROVED (@ref GROWL_ERR_NOT_APPROVED)
* - [50] GROWL_ERR_SERVER_ERROR (@ref GROWL_ERR_SERVER_ERROR)
* - [30] GROWL_ERR_LOCAL_ERROR (@ref GROWL_ERR_LOCAL_ERROR)
* - [10] GROWL_ERR_CONN_FAILED (@ref GROWL_ERR_CONN_FAILED)
* - [11] GROWL_ERR_RESOLVE_DNS (@GROWL_ERR_RESOLVE_DNS GROWL_RETRY)
* - [12] GROWL_RETRY (@ref GROWL_RETRY)
* \param [u8ClientID] client id returned by the nma server.
*/
void GrowlCb(uint8_t u8Code, uint8_t u8ClientID)
{
printf("Growl CB : %d \r\n", u8Code);
}
/**
* \brief Main application function.
*
* \return program return value.
*/
int main(void)
{
tstrWifiInitParam param;
int8_t ret;
uint8_t mac_addr[6];
uint8_t u8IsMacAddrValid;
/* Initialize the board. */
system_init();
/* Initialize the UART console. */
configure_console();
printf(STRING_HEADER);
/* Initialize the BSP. */
nm_bsp_init();
/* Initialize Wi-Fi parameters structure. */
memset((uint8_t *)¶m, 0, sizeof(tstrWifiInitParam));
/* Initialize Wi-Fi driver with data and status callbacks. */
param.pfAppWifiCb = wifi_cb;
ret = m2m_wifi_init(¶m);
if (M2M_SUCCESS != ret) {
printf("main: m2m_wifi_init call error!(%d)\r\n", ret);
while (1) {
}
}
m2m_wifi_get_otp_mac_address(mac_addr, &u8IsMacAddrValid);
if (!u8IsMacAddrValid) {
m2m_wifi_set_mac_address(gau8MacAddr);
}
m2m_wifi_get_mac_address(gau8MacAddr);
set_dev_name_to_mac((uint8_t *)gacDeviceName, gau8MacAddr);
set_dev_name_to_mac((uint8_t *)gstrM2MAPConfig.au8SSID, gau8MacAddr);
m2m_wifi_set_device_name((uint8_t *)gacDeviceName, (uint8_t)m2m_strlen((uint8_t *)gacDeviceName));
gstrM2MAPConfig.au8DHCPServerIP[0] = 0xC0; /* 192 */
gstrM2MAPConfig.au8DHCPServerIP[1] = 0xA8; /* 168 */
gstrM2MAPConfig.au8DHCPServerIP[2] = 0x01; /* 1 */
gstrM2MAPConfig.au8DHCPServerIP[3] = 0x01; /* 1 */
m2m_wifi_start_provision_mode((tstrM2MAPConfig *)&gstrM2MAPConfig, (char *)gacHttpProvDomainName, 1);
printf("Provision Mode started.\r\nConnect to [%s] via AP[%s] and fill up the page.\r\n", MAIN_HTTP_PROV_SERVER_DOMAIN_NAME, gstrM2MAPConfig.au8SSID);
while (1) {
/* Handle pending events from network controller. */
while (m2m_wifi_handle_events(NULL) != M2M_SUCCESS) {
}
}
return 0;
}
| 34.24359 | 166 | 0.728472 |
e76f498913b18dc0278f60fa08b57a2bfb896974 | 22,816 | c | C | Source files/communication.c | XenoVkl/Bank-Server-Client-System | c4b865c6e0e9bbd6a540b2c856e3d693c9db76be | [
"MIT"
] | 1 | 2018-08-13T18:32:33.000Z | 2018-08-13T18:32:33.000Z | Source files/communication.c | XenoVkl/Bank-Server-Client-System | c4b865c6e0e9bbd6a540b2c856e3d693c9db76be | [
"MIT"
] | null | null | null | Source files/communication.c | XenoVkl/Bank-Server-Client-System | c4b865c6e0e9bbd6a540b2c856e3d693c9db76be | [
"MIT"
] | 1 | 2018-08-13T18:32:53.000Z | 2018-08-13T18:32:53.000Z | #include "communication.h"
#include "hashtable.h"
void initialize(queue_t * queue, int size) //Initialize queue that we will store socket descriptors
{
queue->start = 0;
queue->end = -1;
queue->count = 0;
queue->max_size=size;
queue->q_array=malloc(size*sizeof(int));
}
void place(queue_t * queue, int sock_des) // place a socket descript in the queue
{
pthread_mutex_lock(&mut); // lock mutex
while (queue->count >= queue->max_size) //wait while queue is full
{
printf(">> Queue is Full \n");
pthread_cond_wait(&cond_nonfull, &mut); //use the condition variable to wait
}
queue->end = (queue->end + 1) % queue->max_size;
queue->q_array[queue->end] = sock_des;
queue->count++;
pthread_mutex_unlock(&mut); //unlock mutex
}
int obtain(queue_t * queue) // obtain a socket descriptor from the queue
{
int item = 0;
pthread_mutex_lock(&mut);
while (queue->count <= 0) // wait if the queue is empty
{
printf("Worker thread (%ld) - Waiting to obtain a socket descriptor from the connections' queue\n", pthread_self());
pthread_cond_wait(&cond_nonempty, &mut); //use the condition variable to wait
}
item = queue->q_array[queue->start];
printf("Worker thread (%ld) obtained connection(socket descriptor %d)\n", pthread_self(), item);
queue->start = (queue->start + 1) % queue->max_size;
queue->count--;
pthread_mutex_unlock(&mut); // unlock mutex
return item;
}
void *consumer(void * ptr) //thread function - in a few words, this function takes a socket descriptor from the queue and starts reading commands from it
{
char str[1024], temp_str[1024], ret[1024], temp[11], *s, *token, *t_array[20];
int k, size, c, d, i , pos, newsock_des, msec, entries = 129, j = 0, option = 0, flag = 0, t, *arr, swap;
for (i=0; i<20; i++)
t_array[i]=malloc(30*sizeof(char));
while (1) //worker thread will run forever, each time trying to obtain a socket descriptor and then start reading from it
{
t=0;
memset(str, 0, sizeof(str));
memset(temp_str, 0, sizeof(temp_str));
newsock_des=obtain(&queue); //take a socket descript from the queue
//printf("consumer %d\n", newsock_des);
for (i=0; i<20; i++)
memset(t_array[i], 0 , sizeof(t_array[i]));
while(read(newsock_des, str, sizeof(str)) > 0)
{
j=0;
option=0;
msec=0;
//printf("I received the string : %s", str);
/*Parse the received message */
strcpy(temp_str, str);
token = strtok_r(str, " \n", &s);
while (token != NULL) //parse the string and go to the right case
{
if (j == 0)
{
if (strcmp(token, "add_account") == 0)
{
option = 1;
}
else if (strcmp(token, "add_transfer") == 0)
{
option = 2;
}
else if (strcmp(token, "add_multi_transfer") == 0)
{
option = 3;
}
else if (strcmp(token, "print_balance") == 0)
{
option = 4;
}
else if (strcmp(token, "print_multi_balance") == 0)
{
option = 5;
}
else //other command(unknown)
{
option = 6;
break;
}
}
else if (j != 0)
{
strcpy(t_array[j], token); //store the tokens in an array of strings
}
token = strtok_r(NULL, " \n", &s);
j++;
}
switch(option)
{
case 1: //add_account
if (j>3) //if there is a delay in the command
{
pos=hash_function(t_array[2],entries);
pthread_mutex_lock(&mut_array[pos]); //lock the mutex of a specific hashtable's bucket and enter the critical section
msec=atoi(t_array[3]); //apply delay to the command
usleep(msec*1000);
t=create_hash_node(&hash_table[pos], t_array[2], atoi(t_array[1])); //create the account
pthread_mutex_unlock(&mut_array[pos]); //unlock the mutex of the bucket
if (t == 1) //if the account creation was successful
{
strcpy(ret, "Success. Account creation(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, "[:");
strcat(ret, t_array[3]);
strcat(ret, "])");
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to client through the socket
perror_exit("write");
}
else //if the account creation failed for some reason
{
strcpy(ret, "Error. Account creation failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, "[:");
strcat(ret, t_array[3]);
strcat(ret, "])");
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to client through the socket
perror_exit("write");
}
}
else //if there is no delay in the command
{
pos=hash_function(t_array[2],entries);
pthread_mutex_lock(&mut_array[pos]); //lock mutex of the bucket
t=create_hash_node(&hash_table[pos], t_array[2], atoi(t_array[1])); //create account
pthread_mutex_unlock(&mut_array[pos]); //unlock mutex of the bucket
if (t == 1) //account creation was successful
{
strcpy(ret, "success. Account creation(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, ")");
fflush(stdout);
//printf("I ll send %s from the socket\n", ret);
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to client through the socket
perror_exit("write");
}
else //account creation failed
{
strcpy(ret, "Error. Account creation failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, ")");
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to client through the socket
perror_exit("write");
}
}
break;
case 2: //transfer command
c=hash_function(t_array[2], entries); //get the position of the buckets in the hashtable
d=hash_function(t_array[2], entries);
if (c == d) //if they are the same we'll need to lock the mutex only once
size=1;
else
size=2;
arr=malloc(size*sizeof(int));
if (size == 2) // if they are not the same , put them in an array and sort it (we'll avoid deadlocks by using that sorting method)
{
if (arr[0] > arr[1])
{
t=arr[0];
arr[0]=arr[1];
arr[1]=t;
}
}
if (j>4) //if the command has a delay
{
for (i=0; i<size; i++)
pthread_mutex_lock(&mut_array[arr[i]]); //lock the mutexes of the buckets that invlove those accounts in the right order
msec=atoi(t_array[4]); //apply delay
usleep(msec*1000);
t=check_account(hash_table, entries, t_array[2]);
if (t==0) //if the first account of the transfer command does not exist
{
strcpy(ret, "Error. Transfer addition failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[3]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, "[:");
strcat(ret, t_array[4]);
strcat(ret, "])");
for (i=0; i<size; i++) //unlock the mutexes of the buckets that involve those accounts in the right order
pthread_mutex_unlock(&mut_array[arr[i]]);
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to the client through the socket
perror_exit("write");
free(arr);
break;
}
t=check_account(hash_table, entries, t_array[3]);
if (t==0) //if the second account of the transfer command does not exist
{
strcpy(ret, "Error. Transfer addition failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[3]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, "[:");
strcat(ret, t_array[4]);
strcat(ret, "])");
for (i=0; i<size; i++) //unlock the mutexes of the buckets that involve those accounts in the right order
pthread_mutex_unlock(&mut_array[arr[i]]);
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to the client through the socket
perror_exit("write");
free(arr);
break;
}
t=check_transfer(t_array[2], atoi(t_array[1]), hash_table, entries);
if (t==0)
{
strcpy(ret, "Error. Transfer addition failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[3]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, "[:");
strcat(ret, t_array[4]);
strcat(ret, "])");
for (i=0; i<size; i++) //unlock the mutexes of the buckets that involve those accounts in the right order
pthread_mutex_unlock(&mut_array[arr[i]]);
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to the client through the socket
perror_exit("write");
free(arr);
break;
}
transfer_amount(t_array[2], t_array[3], atoi(t_array[1]), hash_table, entries);
strcpy(ret, "Success. Transfer addition(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[3]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, "[:");
strcat(ret, t_array[4]);
strcat(ret, "])");
for (i=0; i<size; i++) //unlock the mutexes of the buckets that involve those accounts in the right order
pthread_mutex_unlock(&mut_array[arr[i]]);
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to the client through the socket
perror_exit("write");
free(arr);
}
else //if there is not a delay
{
for (i=0; i<size; i++)
pthread_mutex_lock(&mut_array[arr[i]]);
t=check_account(hash_table, entries, t_array[2]);
if (t==0) //account does not exist
{
strcpy(ret, "Error. Transfer addition failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[3]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, ")");
for (i=0; i<size; i++) //unlock the mutexes of the buckets that involve those accounts in the right order
pthread_mutex_unlock(&mut_array[arr[i]]);
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to the client through the socket
perror_exit("write");
free(arr);
break;
}
t=check_account(hash_table, entries, t_array[3]);
if (t==0) //account does not exist
{
strcpy(ret, "Error. Transfer addition failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[3]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, ")");
for (i=0; i<size; i++)
pthread_mutex_unlock(&mut_array[arr[i]]);
if (write(newsock_des, ret, sizeof(ret)) < 0)
perror_exit("write");
free(arr);
break;
}
t=check_transfer(t_array[2], atoi(t_array[1]), hash_table, entries);
if (t==0)
{
strcpy(ret, "Error. Transfer addition failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[3]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, ")");
for (i=0; i<size; i++) //unlock the mutexes of the buckets that involve those accounts in the right order
pthread_mutex_unlock(&mut_array[arr[i]]);
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to the client through the socket
perror_exit("write");
free(arr);
break;
}
transfer_amount(t_array[2], t_array[3], atoi(t_array[1]), hash_table, entries);
strcpy(ret, "Success. Transfer addition(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[3]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, ")");
for (i=0; i<size; i++)
pthread_mutex_unlock(&mut_array[arr[i]]); //unlock the mutexes of the buckets that involve those accounts in the right order
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to the client through the socket
perror_exit("write");
free(arr);
}
break;
case 3://multitransfer command
k=is_number(t_array[j-1]); // check if the last string of the command is a number(delay)
if (k == 1) //if it is, define the right size
{
size=j-3;
arr=malloc(size*sizeof(int)); //create an array that will have the position of the buckets(involved in the transfer command)
for (i=2; i<j-1; i++)
{
arr[i-2]=hash_function(t_array[i], entries);
}
}
else //if it is not, define the right size
{
size=j-2;
arr=malloc(size*sizeof(int)); //create an array that will have the position of the buckets(involved in the transfer command)
for (i=2; i<=j-1; i++)
{
arr[i-2]=hash_function(t_array[i], entries);
}
}
//sort array
for (c = 0 ; c < ( size - 1 ); c++)
{
for (d = 0 ; d < size - c - 1; d++)
{
if (arr[d] > arr[d+1])
{
swap = arr[d];
arr[d] = arr[d+1];
arr[d+1] = swap;
}
}
}
for (i=0; i<size; i++)
{
if (arr[i] != arr[i+1] && i!=size-1)
{
//printf("lock mutex %d\n", arr[i]);
pthread_mutex_lock(&mut_array[arr[i]]); //lock mutexes using the sorted array and skip the same mutexes(don't lock twice)
}
}
if (k==1) //apply delay
{
msec=atoi(t_array[j-1]);
usleep(msec*1000);
}
for (i=2; i<j ;i++)
{
t=check_account(hash_table, entries, t_array[i]);
if (t == 0) //does not exist
{
if (k == 0) // there is no delay but the account does not exist
{
strcpy(ret, "Error. Multi-Transfer addition failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, ")");
if (write(newsock_des, ret, sizeof(ret)) < 0)
perror_exit("write");
flag=1;
break;
}
else if (k==1 && i!=(j-1))// there is not a delay since the last string is an account
{
strcpy(ret, "Error. Multi-Transfer addition failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, "[:");
strcat(ret, t_array[j-1]);
strcat(ret, "])");
if (write(newsock_des, ret, sizeof(ret)) < 0)
perror_exit("write");
flag=1;
break;
}
else if (k==1 && i==(j-1))
break;
}
}
if (flag == 1) //time to exit the switch-case
{
flag=0;
for (i=0; i<size; i++)
{
if (arr[i] != arr[i+1] && i!=size-1)
{
//printf("Unlock mutex %d\n", arr[i]);
pthread_mutex_unlock(&mut_array[arr[i]]); //unlock mutexes of the right buckets
}
}
free(arr);
break;
}
//store the amount that needs to be transferred in the variable i
if (k == 1) //if there is a delay
i=j-4;
else // if not
i=j-3;
t=check_transfer(t_array[2], i*atoi(t_array[1]), hash_table, entries); //check the transfer
if (t == 0 && k == 1) // cannot transfer and there is a delay
{
strcpy(ret, "Error. Multi-Transfer addition failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, "[:");
strcat(ret, t_array[j-1]);
strcat(ret, "])");
for (i=0; i<size; i++)
{
if (arr[i] != arr[i+1] && i!=size-1)
{
//printf("Unlock mutex %d\n", arr[i]);
pthread_mutex_unlock(&mut_array[arr[i]]); //unlock the right mutexes
}
}
free(arr);
if (write(newsock_des, ret, sizeof(ret)) < 0)
perror_exit("write");
}
else if (t== 0 && k == 0) //cannot transfer and there is no delay
{
strcpy(ret, "Error. Multi-Transfer addition failed(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, "])");
for (i=0; i<size; i++)
{
if (arr[i] != arr[i+1] && i!=size-1)
{
//printf("Unlock mutex %d\n", arr[i]);
pthread_mutex_unlock(&mut_array[arr[i]]); //unlock the right mutexes of the buckets
}
}
free(arr);
if (write(newsock_des, ret, sizeof(ret)) < 0)
perror_exit("write");
}
else if (t == 1 && k == 0) //account exists and there is no delay
{
strcpy(ret, "Success. Multi-Transfer addition(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, "])");
for (i=3; i<j; i++)
{
transfer_amount(t_array[2], t_array[i], atoi(t_array[1]), hash_table, entries);
}
for (i=0; i<size; i++)
{
if (arr[i] != arr[i+1] && i!=size-1)
{
//printf("Unlock mutex %d\n", arr[i]);
pthread_mutex_unlock(&mut_array[arr[i]]); //unlock mutexes
}
}
free(arr);
if (write(newsock_des, ret, sizeof(ret)) < 0)
perror_exit("write");
}
else if (t == 1 && k == 1) //account exists and there is a delay
{
strcpy(ret, "Success. Multi-Transfer addition(");
strcat(ret, t_array[2]);
strcat(ret, ":");
strcat(ret, t_array[1]);
strcat(ret, "[:");
strcat(ret, t_array[j-1]);
strcat(ret, "])");
for (i=3; i<j-1; i++)
{
transfer_amount(t_array[2], t_array[i], atoi(t_array[1]), hash_table, entries); //time to transfer amounts
}
for (i=0; i<size; i++)
{
if (arr[i] != arr[i+1] && i!=size-1)
{
//printf("Unlock mutex %d\n", arr[i]);
pthread_mutex_unlock(&mut_array[arr[i]]);
}
}
free(arr);
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to client through the socket
perror_exit("write");
}
break;
case 4: //balance command
/*Critical Section */
pos=hash_function(t_array[1], entries);
pthread_mutex_lock(&mut_array[pos]); //lock the mutex of the right position of the hashtable(bucket)
t=check_account(hash_table, entries, t_array[1]);
if (t==0) //account does not exist
{
strcpy(ret, "Error. Balance(");
strcat(ret, t_array[1]);
strcat(ret, ")");
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back
perror_exit("write");
pthread_mutex_unlock(&mut_array[pos]); //unlock mutex
break;
}
t=account_balance(hash_table, entries, t_array[1]); //get amount
strcpy(ret, "Success. Balance(");
strcat(ret, t_array[1]);
strcat(ret, ":");
sprintf(temp, "%d", t);
strcat(ret, temp);
strcat(ret, ")");
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back
perror_exit("write");
pthread_mutex_unlock(&mut_array[pos]); //unlock mutex
break;
case 5://multibalance command
size=j-1;
arr=malloc(size*sizeof(int)); //create an array
for (i=1; i<j; i++) //store the positions of the accounts in the hashtable(buckets) to the array
{
arr[i-1]=hash_function(t_array[i], entries);
}
for (c = 0 ; c < ( size - 1 ); c++) //sort the array
{
for (d = 0 ; d < size - c - 1; d++)
{
if (arr[d] > arr[d+1])
{
swap = arr[d];
arr[d] = arr[d+1];
arr[d+1] = swap;
}
}
}
for (i=0; i<size; i++)
{
if (arr[i] != arr[i+1] && i!=size-1) //lock the right mutexes (sorting order) and ignore the same mutexes(we don't want to lock twice)
{
//printf("Lock mutex %d\n", arr[i]);
pthread_mutex_lock(&mut_array[arr[i]]);
}
}
for (i=1; i<j; i++)
{
t=check_account(hash_table, entries, t_array[i]);
if (t==0) //account exists
{
strcpy(ret, "Error. Multi-Balance(");
flag=1;
break;
}
}
if (flag==1) //return failure
{
for (i=1; i<j; i++)
{
strcat(ret, t_array[i]);
if (i != j-1)
strcat(ret, ":");
}
strcat(ret, ")");
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back to client through the socket
perror_exit("write");
flag=0;
for (i=0; i<size; i++)
{
if (arr[i] != arr[i+1] && i!=size-1)
{
//printf("Unlock mutex %d\n", arr[i]);
pthread_mutex_unlock(&mut_array[arr[i]]); //unlock the right mutexes
}
}
free(arr);
break;
}
strcpy(ret, "Success. Multi-Balance(");
for (i=1; i<j; i++)
{
t=account_balance(hash_table, entries, t_array[i]); //get amount
strcat(ret, t_array[i]);
strcat(ret, "/");
sprintf(temp, "%d", t);
strcat(ret, temp);
if (i != j-1)
strcat(ret, ":");
}
strcat(ret, ")");
if (write(newsock_des, ret, sizeof(ret)) < 0) //write back
perror_exit("write");
for (i=0; i<size; i++)
{
if (arr[i] != arr[i+1] && i!=size-1)
{
//printf("Unlock mutex %d\n", arr[i]);
pthread_mutex_unlock(&mut_array[arr[i]]); //unlock mutexes
}
}
free(arr);
break;
case 6: //unknown command
strcpy(str, "Unknown Command");
if (write(newsock_des, str, sizeof(str)) < 0)
perror_exit("write");
break;
default:
strcpy(str, "success");
if (write(newsock_des, str, sizeof(str)) < 0)
perror_exit("write");
break;
}
}
printf("Closing connection(%d)\n", newsock_des);
close(newsock_des);
pthread_cond_signal(&cond_nonfull);
usleep(500000);
}
for (i=0; i<20; i++)
free(t_array[i]);
}
| 34.104634 | 154 | 0.526823 |
a11540492ddd577833df1f383a0ae3297d41cacf | 4,859 | h | C | sakura_core/recent/CRecentImp.h | toduq/sakura | d819494b53c0d0b8286a2991043d23fbeb368270 | [
"Zlib"
] | null | null | null | sakura_core/recent/CRecentImp.h | toduq/sakura | d819494b53c0d0b8286a2991043d23fbeb368270 | [
"Zlib"
] | null | null | null | sakura_core/recent/CRecentImp.h | toduq/sakura | d819494b53c0d0b8286a2991043d23fbeb368270 | [
"Zlib"
] | null | null | null | /*! @file */
// 各CRecent実装クラスのベースクラス
// エディタ系ファイルからincludeするときは CRecent.h をinclude
/*
Copyright (C) 2008, kobake
Copyright (C) 2018-2021, Sakura Editor Organization
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is
not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#ifndef SAKURA_CRECENTIMP_B18E6196_5684_44E4_91E0_ADB1542BF7E1_H_
#define SAKURA_CRECENTIMP_B18E6196_5684_44E4_91E0_ADB1542BF7E1_H_
#pragma once
#include "recent/CRecent.h"
template < class DATA_TYPE, class RECEIVE_TYPE = const DATA_TYPE* >
class CRecentImp : public CRecent{
using Me = CRecentImp<DATA_TYPE, RECEIVE_TYPE>;
typedef DATA_TYPE DataType;
typedef RECEIVE_TYPE ReceiveType;
public:
CRecentImp(){ Terminate(); }
CRecentImp(const Me&) = delete;
Me& operator = (const Me&) = delete;
CRecentImp(Me&&) noexcept = delete;
Me& operator = (Me&&) noexcept = delete;
virtual ~CRecentImp(){ Terminate(); }
protected:
//生成
bool Create(
DataType* pszItemArray, //!< アイテム配列へのポインタ
size_t nTextMaxLength, //!< 最大テキスト長(終端含む)
int* pnItemCount, //!< アイテム個数へのポインタ
bool* pbItemFavorite, //!< お気に入りへのポインタ(NULL許可)
int nArrayCount, //!< 最大管理可能なアイテム数
int* pnViewCount //!< 表示個数(NULL許可)
);
public:
void Terminate();
bool IsAvailable() const;
void _Recovery();
//更新
bool ChangeViewCount( int nViewCount ); //表示数の変更
bool UpdateView();
//プロパティ取得系
int GetArrayCount() const { return m_nArrayCount; } //最大要素数
int GetItemCount() const { return ( IsAvailable() ? *m_pnUserItemCount : 0); } //登録アイテム数
int GetViewCount() const { return ( IsAvailable() ? (m_pnUserViewCount ? *m_pnUserViewCount : m_nArrayCount) : 0); } //表示数
//お気に入り制御系
bool SetFavorite( int nIndex, bool bFavorite = true); //お気に入りに設定
bool ResetFavorite( int nIndex ) { return SetFavorite( nIndex, false ); } //お気に入りを解除
void ResetAllFavorite(); //お気に入りをすべて解除
bool IsFavorite( int nIndex ) const; //お気に入りか調べる
//アイテム制御
bool AppendItem( ReceiveType pItemData ); //アイテムを先頭に追加
bool AppendItemText( LPCWSTR pszText );
bool EditItemText( int nIndex, LPCWSTR pszText );
bool DeleteItem( int nIndex ); //アイテムをクリア
bool DeleteItem( ReceiveType pItemData )
{
return DeleteItem( FindItem( pItemData ) );
}
bool DeleteItemsNoFavorite(); //お気に入り以外のアイテムをクリア
void DeleteAllItem(); //アイテムをすべてクリア
//アイテム取得
const DataType* GetItem( int nIndex ) const;
DataType* GetItem( int nIndex ){ return const_cast<DataType*>(static_cast<const Me*>(this)->GetItem(nIndex)); }
int FindItem( ReceiveType pItemData ) const;
bool MoveItem( int nSrcIndex, int nDstIndex ); //アイテムを移動
//オーバーライド用インターフェース
virtual int CompareItem( const DataType* p1, ReceiveType p2 ) const = 0;
virtual void CopyItem( DataType* dst, ReceiveType src ) const = 0;
virtual bool DataToReceiveType( ReceiveType* dst, const DataType* src ) const = 0;
virtual bool TextToDataType( DataType* dst, LPCWSTR pszText ) const = 0;
virtual bool ValidateReceiveType( ReceiveType p ) const = 0;
//実装補助
private:
const DataType* GetItemPointer(int nIndex) const;
DataType* GetItemPointer(int nIndex){ return const_cast<DataType*>(static_cast<const Me*>(this)->GetItemPointer(nIndex)); }
void ZeroItem( int nIndex ); //アイテムをゼロクリアする
int GetOldestItem( int nIndex, bool bFavorite ); //最古のアイテムを探す
bool CopyItem( int nSrcIndex, int nDstIndex );
protected:
//内部フラグ
bool m_bCreate; //!< Create済みか
//外部参照
DataType* m_puUserItemData; //!< アイテム配列へのポインタ
int* m_pnUserItemCount; //!< アイテム個数へのポインタ
bool* m_pbUserItemFavorite; //!< お気に入りへのポインタ (NULL許可)
int m_nArrayCount; //!< 最大管理可能なアイテム数
int* m_pnUserViewCount; //!< 表示個数 (NULL許可)
size_t m_nTextMaxLength; //!< 最大テキスト長(終端含む)
};
#include "CRecentFile.h"
#include "CRecentFolder.h"
#include "CRecentExceptMru.h"
#include "CRecentSearch.h"
#include "CRecentReplace.h"
#include "CRecentGrepFile.h"
#include "CRecentGrepFolder.h"
#include "CRecentExcludeFile.h"
#include "CRecentExcludeFolder.h"
#include "CRecentCmd.h"
#include "CRecentCurDir.h"
#include "CRecentEditNode.h"
#include "CRecentTagjumpKeyword.h"
#endif /* SAKURA_CRECENTIMP_B18E6196_5684_44E4_91E0_ADB1542BF7E1_H_ */
| 34.707143 | 124 | 0.739658 |
313d9f5fd0560b5e9c5c108e3b3d2af196c7af86 | 1,207 | h | C | libs/xapiancommon/hashterm.h | restpose/restpose | 8f0bfe96e997eb988baf5edfcc49957aa2f1ceec | [
"MIT"
] | 4 | 2015-11-05T10:36:12.000Z | 2018-10-27T09:59:48.000Z | libs/xapiancommon/hashterm.h | restpose/restpose | 8f0bfe96e997eb988baf5edfcc49957aa2f1ceec | [
"MIT"
] | null | null | null | libs/xapiancommon/hashterm.h | restpose/restpose | 8f0bfe96e997eb988baf5edfcc49957aa2f1ceec | [
"MIT"
] | null | null | null | /* hashterm.h: replace the end of a long term with a hash.
*
* Copyright (C) 2006,2007 Olly Betts
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#ifndef OMEGA_INCLUDED_HASHTERM_H
#define OMEGA_INCLUDED_HASHTERM_H
#include <string>
const unsigned int MAX_SAFE_TERM_LENGTH = 240;
/* If term is longer than max_length, replace the end with a hashed version
* so that it's exactly max_length characters long.
*/
std::string hash_long_term(const std::string &term, unsigned int max_length);
#endif // OMEGA_INCLUDED_HASHTERM_H
| 35.5 | 77 | 0.756421 |
bd07f2240f67b8639f2fe54310a10174ba6fd03f | 31,747 | c | C | server.c | qca/sigma-dut | bf2b5216acef90f0c7723bd4a59a825b30c2a981 | [
"Unlicense"
] | 24 | 2016-01-06T07:42:05.000Z | 2022-02-09T11:00:15.000Z | server.c | qca/sigma-dut | bf2b5216acef90f0c7723bd4a59a825b30c2a981 | [
"Unlicense"
] | 1 | 2020-08-17T07:06:12.000Z | 2020-08-17T07:06:12.000Z | server.c | qca/sigma-dut | bf2b5216acef90f0c7723bd4a59a825b30c2a981 | [
"Unlicense"
] | 21 | 2016-01-19T11:12:40.000Z | 2022-03-25T10:06:30.000Z | /*
* Sigma Control API DUT (server)
* Copyright (c) 2014, Qualcomm Atheros, Inc.
* Copyright (c) 2018-2021, The Linux Foundation
* All Rights Reserved.
* Licensed under the Clear BSD license. See README for more details.
*/
#include "sigma_dut.h"
#include <sqlite3.h>
#ifndef ROOT_DIR
#define ROOT_DIR "/home/user/hs20-server"
#endif /* ROOT_DIR */
#ifndef SERVER_DB
#define SERVER_DB ROOT_DIR "/AS/DB/eap_user.db"
#endif /* SERVER_DB */
#ifndef CERT_DIR
#define CERT_DIR ROOT_DIR "/certs"
#endif /* CERT_DIR */
static enum sigma_cmd_result cmd_server_ca_get_version(struct sigma_dut *dut,
struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
send_resp(dut, conn, SIGMA_COMPLETE, "version," SIGMA_DUT_VER);
return STATUS_SENT;
}
static enum sigma_cmd_result cmd_server_get_info(struct sigma_dut *dut,
struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
char ver[128], resp[256];
get_ver(ROOT_DIR "/spp/hs20_spp_server -v", ver, sizeof(ver));
snprintf(resp, sizeof(resp), "vendor,OSU,model,OS,version,%s", ver);
send_resp(dut, conn, SIGMA_COMPLETE, resp);
return STATUS_SENT;
}
static int server_reset_user(struct sigma_dut *dut, const char *user)
{
sqlite3 *db;
int res = -1;
char *sql = NULL;
const char *realm = "wi-fi.org";
const char *methods = "TTLS-MSCHAPV2";
const char *password = "ChangeMe";
int phase2 = 1;
int machine_managed = 1;
const char *remediation = "";
int fetch_pps = 0;
const char *osu_user = NULL;
const char *osu_password = NULL;
const char *policy = NULL;
sigma_dut_print(dut, DUT_MSG_DEBUG, "Reset user %s", user);
if (sqlite3_open(SERVER_DB, &db)) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"Failed to open SQLite database %s",
SERVER_DB);
return -1;
}
if (strcmp(user, "test01") == 0) {
remediation = "machine";
} else if (strcmp(user, "test02") == 0) {
remediation = "user";
machine_managed = 0;
} else if (strcmp(user, "test03") == 0) {
/* UpdateInterval-based client trigger for policy update */
policy = "ruckus130";
} else if (strcmp(user, "test04") == 0) {
} else if (strcmp(user, "test05") == 0) {
} else if (strcmp(user, "test06") == 0) {
realm = "example.com";
} else if (strcmp(user, "test07") == 0) {
} else if (strcmp(user, "test08") == 0) {
remediation = "machine";
osu_user = "testdmacc08";
osu_password = "P@ssw0rd";
} else if (strcmp(user, "test09") == 0) {
/* UpdateInterval-based client trigger for policy update */
policy = "ruckus130";
osu_user = "testdmacc09";
osu_password = "P@ssw0rd";
} else if (strcmp(user, "test10") == 0) {
remediation = "machine";
methods = "TLS";
} else if (strcmp(user, "test11") == 0) {
} else if (strcmp(user, "test12") == 0) {
remediation = "user";
methods = "TLS";
} else if (strcmp(user, "test20") == 0) {
} else if (strcmp(user, "test26") == 0) {
/* TODO: Cred01 with username/password? */
user = "1310026000000001";
methods = "SIM";
} else if (strcmp(user, "test30") == 0) {
osu_user = "testdmacc30";
osu_password = "P@ssw0rd";
} else if (strcmp(user, "test31") == 0) {
osu_user = "testdmacc31";
osu_password = "P@ssw0rd";
} else if (strcmp(user, "test32") == 0) {
osu_user = "testdmacc32";
osu_password = "P@ssw0rd";
} else if (strcmp(user, "test33") == 0) {
osu_user = "testdmacc33";
osu_password = "P@ssw0rd";
} else if (strcmp(user, "test34") == 0) {
osu_user = "testdmacc34";
osu_password = "P@ssw0rd";
} else if (strcmp(user, "test35") == 0) {
osu_user = "testdmacc35";
osu_password = "P@ssw0rd";
} else if (strcmp(user, "test36") == 0) {
} else if (strcmp(user, "test37") == 0) {
osu_user = "testdmacc37";
osu_password = "P@ssw0rd";
} else if (strcmp(user, "testdmacc08") == 0 ||
strcmp(user, "testdmacc09") == 0) {
/* No need to set anything separate for testdmacc* users */
sqlite3_close(db);
return 0;
} else {
sigma_dut_print(dut, DUT_MSG_INFO, "Unsupported username '%s'",
user);
goto fail;
}
sql = sqlite3_mprintf("INSERT OR REPLACE INTO users(identity,realm,methods,password,phase2,machine_managed,remediation,fetch_pps,osu_user,osu_password,policy) VALUES (%Q,%Q,%Q,%Q,%d,%d,%Q,%d,%Q,%Q,%Q)",
user, realm, methods, password,
phase2, machine_managed, remediation, fetch_pps,
osu_user, osu_password, policy);
if (!sql)
goto fail;
sigma_dut_print(dut, DUT_MSG_DEBUG, "SQL: %s", sql);
if (sqlite3_exec(db, sql, NULL, NULL, NULL) != SQLITE_OK) {
sigma_dut_print(dut, DUT_MSG_ERROR, "SQL operation failed: %s",
sqlite3_errmsg(db));
} else {
res = 0;
}
sqlite3_free(sql);
fail:
sqlite3_close(db);
return res;
}
static int server_reset_serial(struct sigma_dut *dut, const char *serial)
{
sqlite3 *db;
int res = -1;
char *sql = NULL;
const char *realm = "wi-fi.org";
const char *methods = "TLS";
int phase2 = 0;
int machine_managed = 1;
const char *remediation = "";
int fetch_pps = 0;
const char *osu_user = NULL;
const char *osu_password = NULL;
const char *policy = NULL;
char user[128];
const char *cert = "";
const char *subrem = "";
snprintf(user, sizeof(user), "cert-%s", serial);
sigma_dut_print(dut, DUT_MSG_DEBUG, "Reset user %s (serial number: %s)",
user, serial);
if (sqlite3_open(SERVER_DB, &db)) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"Failed to open SQLite database %s",
SERVER_DB);
return -1;
}
if (strcmp(serial, "1046") == 0) {
remediation = "machine";
cert = "3786eb9ef44778fe8048f9fa6f8c3e611f2dbdd15f239fa93edcc417debefa5a";
subrem = "homeoi";
} else if (strcmp(serial, "1047") == 0) {
remediation = "user";
cert = "55cd0af162f2fb6de5b9481e37a0b0887f42e477ab09586b0c10f24b269b893f";
} else {
sigma_dut_print(dut, DUT_MSG_INFO,
"Unsupported serial number '%s'", serial);
goto fail;
}
sql = sqlite3_mprintf("INSERT OR REPLACE INTO users(identity,realm,methods,phase2,machine_managed,remediation,fetch_pps,osu_user,osu_password,policy,cert,subrem) VALUES (%Q,%Q,%Q,%d,%d,%Q,%d,%Q,%Q,%Q,%Q,%Q)",
user, realm, methods,
phase2, machine_managed, remediation, fetch_pps,
osu_user, osu_password, policy, cert, subrem);
if (!sql)
goto fail;
sigma_dut_print(dut, DUT_MSG_DEBUG, "SQL: %s", sql);
if (sqlite3_exec(db, sql, NULL, NULL, NULL) != SQLITE_OK) {
sigma_dut_print(dut, DUT_MSG_ERROR, "SQL operation failed: %s",
sqlite3_errmsg(db));
} else {
res = 0;
}
sqlite3_free(sql);
fail:
sqlite3_close(db);
return res;
}
static int server_reset_cert_enroll(struct sigma_dut *dut, const char *addr)
{
sqlite3 *db;
char *sql;
sigma_dut_print(dut, DUT_MSG_DEBUG,
"Reset certificate enrollment status for %s", addr);
if (sqlite3_open(SERVER_DB, &db)) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"Failed to open SQLite database %s",
SERVER_DB);
return -1;
}
sql = sqlite3_mprintf("DELETE FROM cert_enroll WHERE mac_addr=%Q",
addr);
if (!sql) {
sqlite3_close(db);
return -1;
}
sigma_dut_print(dut, DUT_MSG_DEBUG, "SQL: %s", sql);
if (sqlite3_exec(db, sql, NULL, NULL, NULL) != SQLITE_OK) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"SQL operation failed: %s",
sqlite3_errmsg(db));
sqlite3_free(sql);
sqlite3_close(db);
return -1;
}
sqlite3_free(sql);
sqlite3_close(db);
return 0;
}
static int server_reset_imsi(struct sigma_dut *dut, const char *imsi)
{
sqlite3 *db;
char *sql;
sigma_dut_print(dut, DUT_MSG_DEBUG, "Reset policy provisioning for %s",
imsi);
if (sqlite3_open(SERVER_DB, &db)) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"Failed to open SQLite database %s",
SERVER_DB);
return -1;
}
sql = sqlite3_mprintf("DELETE FROM users WHERE identity=%Q", imsi);
if (!sql) {
sqlite3_close(db);
return -1;
}
sigma_dut_print(dut, DUT_MSG_DEBUG, "SQL: %s", sql);
if (sqlite3_exec(db, sql, NULL, NULL, NULL) != SQLITE_OK) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"SQL operation failed: %s",
sqlite3_errmsg(db));
sqlite3_free(sql);
sqlite3_close(db);
return -1;
}
sqlite3_free(sql);
sqlite3_close(db);
return 0;
}
static enum sigma_cmd_result cmd_server_reset_default(struct sigma_dut *dut,
struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
const char *var;
enum sigma_program prog;
var = get_param(cmd, "Program");
if (!var) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Missing program parameter");
return STATUS_SENT;
}
prog = sigma_program_to_enum(var);
if (prog != PROGRAM_HS2_R2 && prog != PROGRAM_HS2_R3) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported program");
return STATUS_SENT;
}
var = get_param(cmd, "UserName");
if (var && server_reset_user(dut, var) < 0) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Failed to reset user account to defaults");
return STATUS_SENT;
}
var = get_param(cmd, "SerialNo");
if (var && server_reset_serial(dut, var)) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Failed to reset user account to defaults");
return STATUS_SENT;
}
var = get_param(cmd, "ClientMACAddr");
if (var && server_reset_cert_enroll(dut, var) < 0) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Failed to reset cert enroll to defaults");
return STATUS_SENT;
}
var = get_param(cmd, "imsi_val");
if (var && server_reset_imsi(dut, var) < 0) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Failed to reset IMSI/SIM user");
return STATUS_SENT;
}
return SUCCESS_SEND_STATUS;
}
static int get_last_msk_cb(void *ctx, int argc, char *argv[], char *col[])
{
char **last_msk = ctx;
if (argc < 1 || !argv[0])
return 0;
free(*last_msk);
*last_msk = strdup(argv[0]);
return 0;
}
static char * get_last_msk(struct sigma_dut *dut, sqlite3 *db,
const char *username)
{
char *sql, *last_msk = NULL;
sql = sqlite3_mprintf("SELECT last_msk FROM users WHERE identity=%Q",
username);
if (!sql)
return NULL;
if (sqlite3_exec(db, sql, get_last_msk_cb, &last_msk, NULL) !=
SQLITE_OK) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"SQL operation to fetch last_msk failed: %s",
sqlite3_errmsg(db));
sqlite3_free(sql);
return NULL;
}
sqlite3_free(sql);
return last_msk;
}
static enum sigma_cmd_result
aaa_auth_status(struct sigma_dut *dut, struct sigma_conn *conn,
struct sigma_cmd *cmd, const char *username, int timeout)
{
sqlite3 *db;
char *sql = NULL;
int i;
char resp[500];
if (sqlite3_open(SERVER_DB, &db)) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"Failed to open SQLite database %s",
SERVER_DB);
return INVALID_SEND_STATUS;
}
sql = sqlite3_mprintf("UPDATE users SET last_msk=NULL WHERE identity=%Q",
username);
if (!sql) {
sqlite3_close(db);
return ERROR_SEND_STATUS;
}
if (sqlite3_exec(db, sql, NULL, NULL, NULL) != SQLITE_OK) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"SQL operation to clear last_msk failed: %s",
sqlite3_errmsg(db));
sqlite3_free(sql);
sqlite3_close(db);
return ERROR_SEND_STATUS;
}
sqlite3_free(sql);
if (sqlite3_changes(db) < 1) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"No DB rows modified (specified user not found)");
sqlite3_close(db);
return ERROR_SEND_STATUS;
}
snprintf(resp, sizeof(resp), "AuthStatus,TIMEOUT,MSK,NULL");
for (i = 0; i < timeout; i++) {
char *last_msk;
last_msk = get_last_msk(dut, db, username);
if (last_msk) {
if (strcmp(last_msk, "FAIL") == 0) {
snprintf(resp, sizeof(resp),
"AuthStatus,FAIL,MSK,NULL");
} else {
snprintf(resp, sizeof(resp),
"AuthStatus,SUCCESS,MSK,%s", last_msk);
}
free(last_msk);
break;
}
sleep(1);
}
sqlite3_close(db);
send_resp(dut, conn, SIGMA_COMPLETE, resp);
return STATUS_SENT;
}
static int get_last_serial_cb(void *ctx, int argc, char *argv[], char *col[])
{
char **last_serial = ctx;
if (argc < 1 || !argv[0])
return 0;
free(*last_serial);
*last_serial = strdup(argv[0]);
return 0;
}
static char * get_last_serial(struct sigma_dut *dut, sqlite3 *db,
const char *addr)
{
char *sql, *last_serial = NULL;
sql = sqlite3_mprintf("SELECT serialnum FROM cert_enroll WHERE mac_addr=%Q",
addr);
if (!sql)
return NULL;
sigma_dut_print(dut, DUT_MSG_DEBUG, "SQL: %s", sql);
if (sqlite3_exec(db, sql, get_last_serial_cb, &last_serial, NULL) !=
SQLITE_OK) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"SQL operation to fetch last_serial failed: %s",
sqlite3_errmsg(db));
sqlite3_free(sql);
return NULL;
}
sqlite3_free(sql);
return last_serial;
}
static enum sigma_cmd_result
osu_cert_enroll_status(struct sigma_dut *dut, struct sigma_conn *conn,
struct sigma_cmd *cmd, const char *addr, int timeout)
{
sqlite3 *db;
int i;
char resp[500];
if (sqlite3_open(SERVER_DB, &db)) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"Failed to open SQLite database %s",
SERVER_DB);
return INVALID_SEND_STATUS;
}
snprintf(resp, sizeof(resp), "OSUStatus,TIMEOUT");
for (i = 0; i < timeout; i++) {
char *last_serial;
last_serial = get_last_serial(dut, db, addr);
if (last_serial) {
if (strcmp(last_serial, "FAIL") == 0) {
snprintf(resp, sizeof(resp),
"OSUStatus,FAIL");
} else if (strlen(last_serial) > 0) {
snprintf(resp, sizeof(resp),
"OSUStatus,SUCCESS,SerialNo,%s",
last_serial);
}
free(last_serial);
break;
}
sleep(1);
}
sqlite3_close(db);
send_resp(dut, conn, SIGMA_COMPLETE, resp);
return STATUS_SENT;
}
static int get_user_field_cb(void *ctx, int argc, char *argv[], char *col[])
{
char **val = ctx;
if (argc < 1 || !argv[0])
return 0;
free(*val);
*val = strdup(argv[0]);
return 0;
}
static char * get_user_field_helper(struct sigma_dut *dut, sqlite3 *db,
const char *id_field,
const char *identity, const char *field)
{
char *sql, *val = NULL;
sql = sqlite3_mprintf("SELECT %s FROM users WHERE %s=%Q",
field, id_field, identity);
if (!sql)
return NULL;
sigma_dut_print(dut, DUT_MSG_DEBUG, "SQL: %s", sql);
if (sqlite3_exec(db, sql, get_user_field_cb, &val, NULL) != SQLITE_OK) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"SQL operation to fetch user field failed: %s",
sqlite3_errmsg(db));
sqlite3_free(sql);
return NULL;
}
sqlite3_free(sql);
return val;
}
static char * get_user_field(struct sigma_dut *dut, sqlite3 *db,
const char *identity, const char *field)
{
return get_user_field_helper(dut, db, "identity", identity, field);
}
static char * get_user_dmacc_field(struct sigma_dut *dut, sqlite3 *db,
const char *identity, const char *field)
{
return get_user_field_helper(dut, db, "osu_user", identity, field);
}
static int get_eventlog_new_serialno_cb(void *ctx, int argc, char *argv[],
char *col[])
{
char **serialno = ctx;
char *val;
if (argc < 1 || !argv[0])
return 0;
val = argv[0];
if (strncmp(val, "renamed user to: cert-", 22) != 0)
return 0;
val += 22;
free(*serialno);
*serialno = strdup(val);
return 0;
}
static char * get_eventlog_new_serialno(struct sigma_dut *dut, sqlite3 *db,
const char *username)
{
char *sql, *serial = NULL;
sql = sqlite3_mprintf("SELECT notes FROM eventlog WHERE user=%Q AND notes LIKE %Q",
username, "renamed user to:%");
if (!sql)
return NULL;
if (sqlite3_exec(db, sql, get_eventlog_new_serialno_cb, &serial,
NULL) != SQLITE_OK) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"SQL operation to fetch new serialno failed: %s",
sqlite3_errmsg(db));
sqlite3_free(sql);
return NULL;
}
sqlite3_free(sql);
return serial;
}
static enum sigma_cmd_result
osu_remediation_status(struct sigma_dut *dut, struct sigma_conn *conn,
int timeout, const char *username, const char *serialno)
{
sqlite3 *db;
int i;
char resp[500];
char name[100];
char *remediation = NULL;
int dmacc = 0;
if (!username && !serialno)
return INVALID_SEND_STATUS;
if (!username) {
snprintf(name, sizeof(name), "cert-%s", serialno);
username = name;
}
if (sqlite3_open(SERVER_DB, &db)) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"Failed to open SQLite database %s",
SERVER_DB);
return ERROR_SEND_STATUS;
}
remediation = get_user_field(dut, db, username, "remediation");
if (!remediation) {
remediation = get_user_dmacc_field(dut, db, username,
"remediation");
dmacc = 1;
}
if (!remediation) {
snprintf(resp, sizeof(resp),
"RemediationStatus,User entry not found");
goto done;
}
if (remediation[0] == '\0') {
snprintf(resp, sizeof(resp),
"RemediationStatus,User was not configured to need remediation");
goto done;
}
snprintf(resp, sizeof(resp), "RemediationStatus,TIMEOUT");
for (i = 0; i < timeout; i++) {
sleep(1);
free(remediation);
if (dmacc)
remediation = get_user_dmacc_field(dut, db, username,
"remediation");
else
remediation = get_user_field(dut, db, username,
"remediation");
if (!remediation && serialno) {
char *new_serial;
/* Certificate reenrollment through subscription
* remediation - fetch the new serial number */
new_serial = get_eventlog_new_serialno(dut, db,
username);
if (!new_serial) {
/* New SerialNo not known?! */
snprintf(resp, sizeof(resp),
"RemediationStatus,Remediation Complete,SerialNo,Unknown");
break;
}
snprintf(resp, sizeof(resp),
"RemediationStatus,Remediation Complete,SerialNo,%s",
new_serial);
free(new_serial);
break;
} else if (remediation && remediation[0] == '\0') {
snprintf(resp, sizeof(resp),
"RemediationStatus,Remediation Complete");
break;
}
}
done:
free(remediation);
sqlite3_close(db);
send_resp(dut, conn, SIGMA_COMPLETE, resp);
return STATUS_SENT;
}
static enum sigma_cmd_result
osu_polupd_status(struct sigma_dut *dut, struct sigma_conn *conn, int timeout,
const char *username, const char *serialno)
{
sqlite3 *db;
char *sql;
int i;
char resp[500];
char name[100];
char *policy = NULL;
int dmacc = 0;
if (!username && !serialno)
return INVALID_SEND_STATUS;
if (!username) {
snprintf(name, sizeof(name), "cert-%s", serialno);
username = name;
}
if (sqlite3_open(SERVER_DB, &db)) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"Failed to open SQLite database %s",
SERVER_DB);
return ERROR_SEND_STATUS;
}
policy = get_user_field(dut, db, username, "policy");
if (!policy) {
policy = get_user_dmacc_field(dut, db, username, "policy");
dmacc = 1;
}
if (!policy) {
snprintf(resp, sizeof(resp),
"PolicyUpdateStatus,User entry not found");
goto done;
}
if (policy[0] == '\0') {
snprintf(resp, sizeof(resp),
"PolicyUpdateStatus,User was not configured to need policy update");
goto done;
}
sql = sqlite3_mprintf("UPDATE users SET polupd_done=0 WHERE %s=%Q",
(dmacc ? "osu_user" : "identity"),
username);
if (!sql) {
snprintf(resp, sizeof(resp),
"PolicyUpdateStatus,Internal error");
goto done;
}
sigma_dut_print(dut, DUT_MSG_DEBUG, "SQL: %s", sql);
if (sqlite3_exec(db, sql, NULL, NULL, NULL) != SQLITE_OK) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"SQL operation to fetch user field failed: %s",
sqlite3_errmsg(db));
sqlite3_free(sql);
goto done;
}
sqlite3_free(sql);
snprintf(resp, sizeof(resp), "PolicyUpdateStatus,TIMEOUT");
for (i = 0; i < timeout; i++) {
sleep(1);
free(policy);
if (dmacc)
policy = get_user_dmacc_field(dut, db, username,
"polupd_done");
else
policy = get_user_field(dut, db, username,
"polupd_done");
if (policy && atoi(policy)) {
snprintf(resp, sizeof(resp),
"PolicyUpdateStatus,UpdateComplete");
break;
}
}
done:
free(policy);
sqlite3_close(db);
send_resp(dut, conn, SIGMA_COMPLETE, resp);
return STATUS_SENT;
}
static enum sigma_cmd_result
osu_sim_policy_provisioning_status(struct sigma_dut *dut,
struct sigma_conn *conn,
const char *imsi, int timeout)
{
sqlite3 *db;
int i;
char resp[500];
char *id = NULL;
if (sqlite3_open(SERVER_DB, &db)) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"Failed to open SQLite database %s",
SERVER_DB);
return INVALID_SEND_STATUS;
}
snprintf(resp, sizeof(resp), "PolicyProvisioning,TIMEOUT");
for (i = 0; i < timeout; i++) {
free(id);
id = get_user_field(dut, db, imsi, "identity");
if (id) {
snprintf(resp, sizeof(resp),
"PolicyProvisioning,Provisioning Complete");
break;
}
sleep(1);
}
free(id);
sqlite3_close(db);
send_resp(dut, conn, SIGMA_COMPLETE, resp);
return STATUS_SENT;
}
static enum sigma_cmd_result cmd_server_request_status(struct sigma_dut *dut,
struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
const char *var, *username, *serialno, *imsi, *addr, *status;
int osu, timeout;
char resp[500];
enum sigma_program prog;
var = get_param(cmd, "Program");
if (!var) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Missing program parameter");
return STATUS_SENT;
}
prog = sigma_program_to_enum(var);
if (prog != PROGRAM_HS2_R2 && prog != PROGRAM_HS2_R3) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported program");
return STATUS_SENT;
}
var = get_param(cmd, "Device");
if (!var ||
(strcasecmp(var, "AAAServer") != 0 &&
strcasecmp(var, "OSUServer") != 0)) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported device type");
return STATUS_SENT;
}
osu = strcasecmp(var, "OSUServer") == 0;
var = get_param(cmd, "Timeout");
if (!var) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Missing timeout");
return STATUS_SENT;
}
timeout = atoi(var);
sigma_dut_print(dut, DUT_MSG_DEBUG, "timeout: %d", timeout);
username = get_param(cmd, "UserName");
if (username)
sigma_dut_print(dut, DUT_MSG_DEBUG, "UserName: %s", username);
serialno = get_param(cmd, "SerialNo");
if (serialno)
sigma_dut_print(dut, DUT_MSG_DEBUG, "SerialNo: %s", serialno);
imsi = get_param(cmd, "imsi_val");
if (imsi)
sigma_dut_print(dut, DUT_MSG_DEBUG, "imsi_val: %s", imsi);
addr = get_param(cmd, "ClientMACAddr");
if (addr)
sigma_dut_print(dut, DUT_MSG_DEBUG, "ClientMACAddr: %s", addr);
status = get_param(cmd, "Status");
if (status)
sigma_dut_print(dut, DUT_MSG_DEBUG, "Status: %s", status);
if (osu && status && strcasecmp(status, "Remediation") == 0)
return osu_remediation_status(dut, conn, timeout, username,
serialno);
if (osu && status && strcasecmp(status, "PolicyUpdate") == 0)
return osu_polupd_status(dut, conn, timeout, username,
serialno);
if (!osu && status && strcasecmp(status, "Authentication") == 0 &&
username)
return aaa_auth_status(dut, conn, cmd, username, timeout);
if (!osu && status && strcasecmp(status, "Authentication") == 0 &&
serialno) {
snprintf(resp, sizeof(resp), "cert-%s", serialno);
return aaa_auth_status(dut, conn, cmd, resp, timeout);
}
if (osu && status && strcasecmp(status, "OSU") == 0 && addr)
return osu_cert_enroll_status(dut, conn, cmd, addr, timeout);
if (osu && status && strcasecmp(status, "PolicyProvisioning") == 0 &&
imsi)
return osu_sim_policy_provisioning_status(dut, conn, imsi,
timeout);
return SUCCESS_SEND_STATUS;
}
static int osu_set_cert_reenroll(struct sigma_dut *dut, const char *serial,
int enable)
{
sqlite3 *db;
char *sql;
char id[100];
int ret = -1;
if (sqlite3_open(SERVER_DB, &db)) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"Failed to open SQLite database %s",
SERVER_DB);
return -1;
}
snprintf(id, sizeof(id), "cert-%s", serial);
sql = sqlite3_mprintf("UPDATE users SET remediation=%Q WHERE lower(identity)=lower(%Q)",
enable ? "reenroll" : "", id);
if (!sql)
goto fail;
sigma_dut_print(dut, DUT_MSG_DEBUG, "SQL: %s", sql);
if (sqlite3_exec(db, sql, NULL, NULL, NULL) != SQLITE_OK) {
sigma_dut_print(dut, DUT_MSG_ERROR, "SQL operation failed: %s",
sqlite3_errmsg(db));
goto fail;
}
if (sqlite3_changes(db) < 1) {
sigma_dut_print(dut, DUT_MSG_ERROR, "No DB rows modified (specified serial number not found)");
goto fail;
}
ret = 0;
fail:
sqlite3_close(db);
return ret;
}
static enum sigma_cmd_result cmd_server_set_parameter(struct sigma_dut *dut,
struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
const char *var, *root_ca, *inter_ca, *osu_cert, *issuing_arch, *name;
const char *reenroll, *serial;
int osu, timeout = -1;
enum sigma_program prog;
var = get_param(cmd, "Program");
if (!var) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Missing program parameter");
return STATUS_SENT;
}
prog = sigma_program_to_enum(var);
if (prog != PROGRAM_HS2_R2 && prog != PROGRAM_HS2_R3) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported program");
return STATUS_SENT;
}
var = get_param(cmd, "Device");
if (!var ||
(strcasecmp(var, "AAAServer") != 0 &&
strcasecmp(var, "OSUServer") != 0)) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported device type");
return STATUS_SENT;
}
osu = strcasecmp(var, "OSUServer") == 0;
var = get_param(cmd, "Timeout");
if (var)
timeout = atoi(var);
var = get_param(cmd, "ProvisioningProto");
if (var && strcasecmp(var, "SOAP") != 0) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported ProvisioningProto");
return STATUS_SENT;
}
reenroll = get_param(cmd, "CertReEnroll");
serial = get_param(cmd, "SerialNo");
if (reenroll && serial) {
int enable;
if (strcasecmp(reenroll, "Enable") == 0) {
enable = 1;
} else if (strcasecmp(reenroll, "Disable") == 0) {
enable = 0;
} else {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Invalid CertReEnroll value");
return STATUS_SENT;
}
if (osu_set_cert_reenroll(dut, serial, enable) < 0) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Failed to update certificate reenrollment state");
return STATUS_SENT;
}
}
name = get_param(cmd, "Name");
root_ca = get_param(cmd, "TrustRootCACert");
inter_ca = get_param(cmd, "InterCACert");
osu_cert = get_param(cmd, "OSUServerCert");
issuing_arch = get_param(cmd, "Issuing_Arch");
if (timeout > -1) {
/* TODO */
}
if (osu && name && root_ca && inter_ca && osu_cert && issuing_arch) {
const char *srv;
char buf[500];
char buf2[500];
int col;
sigma_dut_print(dut, DUT_MSG_DEBUG,
"Update server certificate setup");
if (strcasecmp(name, "ruckus") == 0) {
srv = "RKS";
} else if (strcasecmp(name, "aruba") == 0) {
srv = "ARU";
} else {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported Name value");
return STATUS_SENT;
}
if (strcasecmp(issuing_arch, "col2") == 0) {
col = 2;
} else if (strcasecmp(issuing_arch, "col4") == 0) {
col = 4;
} else {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported Issuing_Arch value");
return STATUS_SENT;
}
if (strcasecmp(root_ca, "ID-T") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU trust root: NetworkFX");
if (system("cp " CERT_DIR "/IDT-cert-RootCA.pem "
CERT_DIR "/cacert.pem") < 0)
return ERROR_SEND_STATUS;
} else if (strcasecmp(root_ca, "ID-Y") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU trust root: NetworkFX");
if (system("cp " CERT_DIR "/IDY-cert-RootCA.pem "
CERT_DIR "/cacert.pem") < 0)
return ERROR_SEND_STATUS;
} else if (strcasecmp(root_ca, "ID-K.1") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU trust root: Not-trusted");
if (system("cp " CERT_DIR "/IDK1-ca.pem "
CERT_DIR "/cacert.pem") < 0)
return ERROR_SEND_STATUS;
} else {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported TrustRootCACert value");
return STATUS_SENT;
}
if (strcasecmp(inter_ca, "ID-Z.2") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU intermediate CA: NetworkFX (col2)");
if (system("cat " CERT_DIR "/IDZ2-cert-InterCA.pem >> "
CERT_DIR "/cacert.pem") < 0)
return ERROR_SEND_STATUS;
} else if (strcasecmp(inter_ca, "ID-Z.4") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU intermediate CA: DigiCert (col2)");
if (system("cat " CERT_DIR "/IDZ4-cert-InterCA.pem >> "
CERT_DIR "/cacert.pem") < 0)
return ERROR_SEND_STATUS;
} else if (strcasecmp(inter_ca, "ID-Z.6") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU intermediate CA: NetworkFX (col4)");
if (system("cat " CERT_DIR "/IDZ6-cert-InterCA.pem >> "
CERT_DIR "/cacert.pem") < 0)
return ERROR_SEND_STATUS;
} else if (strcasecmp(inter_ca, "ID-Z.8") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU intermediate CA: DigiCert (col4)");
if (system("cat " CERT_DIR "/IDZ8-cert-InterCA.pem >> "
CERT_DIR "/cacert.pem") < 0)
return ERROR_SEND_STATUS;
} else if (strcasecmp(inter_ca, "ID-K.1") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU intermediate CA: Not-trusted");
if (system("cat " CERT_DIR "/IDK1-IntCA.pem >> "
CERT_DIR "/cacert.pem") < 0)
return ERROR_SEND_STATUS;
} else {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported InterCACert value");
return STATUS_SENT;
}
if (strcasecmp(osu_cert, "ID-Q") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU server cert: NetworkFX col%d",
col);
snprintf(buf, sizeof(buf),
"cp " CERT_DIR "/IDQ-cert-c%d-%s.pem "
CERT_DIR "/server.pem",
col, srv);
snprintf(buf2, sizeof(buf2),
"cp " CERT_DIR "/IDQ-key-%s.pem "
CERT_DIR "/server.key", srv);
} else if (strcasecmp(osu_cert, "ID-W") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU server cert: DigiCert col%d",
col);
snprintf(buf, sizeof(buf),
"cp " CERT_DIR "/IDW-cert-c%d-%s.pem "
CERT_DIR "/server.pem",
col, srv);
snprintf(buf2, sizeof(buf2),
"cp " CERT_DIR "/IDW-key-%s.pem "
CERT_DIR "/server.key", srv);
} else if (strcasecmp(osu_cert, "ID-K.1") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU server cert: Not-trusted");
snprintf(buf, sizeof(buf),
"cp " CERT_DIR "/IDK1-cert-%s.pem "
CERT_DIR "/server.pem",
srv);
snprintf(buf2, sizeof(buf2),
"cp " CERT_DIR "/IDK1-key-%s.pem "
CERT_DIR "/server.key", srv);
} else if (strcasecmp(osu_cert, "ID-R.2") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU server cert: NetworkFX revoked col%d",
col);
snprintf(buf, sizeof(buf),
"cp " CERT_DIR "/IDR2-cert-c%d-%s.pem "
CERT_DIR "/server.pem",
col, srv);
snprintf(buf2, sizeof(buf2),
"cp " CERT_DIR "/IDR2-key-%s.pem "
CERT_DIR "/server.key", srv);
} else if (strcasecmp(osu_cert, "ID-R.4") == 0) {
sigma_dut_print(dut, DUT_MSG_DEBUG,
"OSU server cert: DigiCert revoked col%d",
col);
snprintf(buf, sizeof(buf),
"cp " CERT_DIR "/IDR4-cert-c%d-%s.pem "
CERT_DIR "/server.pem",
col, srv);
snprintf(buf2, sizeof(buf2),
"cp " CERT_DIR "/IDR4-key-%s.pem "
CERT_DIR "/server.key", srv);
} else {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Unsupported OSUServerCert value");
return STATUS_SENT;
}
if (system(buf) < 0 || system(buf2) < 0)
return ERROR_SEND_STATUS;
if (system("service apache2 reload") < 0) {
send_resp(dut, conn, SIGMA_ERROR,
"errorCode,Failed to restart Apache");
return STATUS_SENT;
}
}
/* TODO */
return SUCCESS_SEND_STATUS;
}
void server_register_cmds(void)
{
sigma_dut_reg_cmd("server_ca_get_version", NULL,
cmd_server_ca_get_version);
sigma_dut_reg_cmd("server_get_info", NULL,
cmd_server_get_info);
sigma_dut_reg_cmd("server_reset_default", NULL,
cmd_server_reset_default);
sigma_dut_reg_cmd("server_request_status", NULL,
cmd_server_request_status);
sigma_dut_reg_cmd("server_set_parameter", NULL,
cmd_server_set_parameter);
}
| 25.520096 | 209 | 0.662866 |
bd97cadd6e96b7db4fe0bb943f80a8d9e6635df6 | 3,641 | h | C | wxWidgets-2.9.1/include/wx/validate.h | gamekit-developers/gamekit | 74c896af5826ebe8fb72f2911015738f38ab7bb2 | [
"Zlib",
"MIT"
] | 241 | 2015-01-04T00:36:58.000Z | 2022-01-06T19:19:23.000Z | wxWidgets-2.9.1/include/wx/validate.h | gamekit-developers/gamekit | 74c896af5826ebe8fb72f2911015738f38ab7bb2 | [
"Zlib",
"MIT"
] | 10 | 2015-07-10T18:27:17.000Z | 2019-06-26T20:59:59.000Z | wxWidgets-2.9.1/include/wx/validate.h | gamekit-developers/gamekit | 74c896af5826ebe8fb72f2911015738f38ab7bb2 | [
"Zlib",
"MIT"
] | 82 | 2015-01-25T18:02:35.000Z | 2022-03-05T12:28:17.000Z | /////////////////////////////////////////////////////////////////////////////
// Name: wx/validate.h
// Purpose: wxValidator class
// Author: Julian Smart
// Modified by:
// Created: 29/01/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_VALIDATE_H_
#define _WX_VALIDATE_H_
#include "wx/defs.h"
#if wxUSE_VALIDATORS
#include "wx/event.h"
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxWindowBase;
/*
A validator has up to three purposes:
1) To validate the data in the window that's associated
with the validator.
2) To transfer data to and from the window.
3) To filter input, using its role as a wxEvtHandler
to intercept e.g. OnChar.
Note that wxValidator and derived classes use reference counting.
*/
class WXDLLIMPEXP_CORE wxValidator : public wxEvtHandler
{
public:
wxValidator();
virtual ~wxValidator();
// Make a clone of this validator (or return NULL) - currently necessary
// if you're passing a reference to a validator.
// Another possibility is to always pass a pointer to a new validator
// (so the calling code can use a copy constructor of the relevant class).
virtual wxObject *Clone() const
{ return NULL; }
bool Copy(const wxValidator& val)
{ m_validatorWindow = val.m_validatorWindow; return true; }
// Called when the value in the window must be validated.
// This function can pop up an error message.
virtual bool Validate(wxWindow *WXUNUSED(parent)) { return false; }
// Called to transfer data to the window
virtual bool TransferToWindow() { return false; }
// Called to transfer data from the window
virtual bool TransferFromWindow() { return false; }
// accessors
wxWindow *GetWindow() const { return (wxWindow *)m_validatorWindow; }
void SetWindow(wxWindowBase *win) { m_validatorWindow = win; }
// validators beep by default if invalid key is pressed, this function
// allows to change this
static void SuppressBellOnError(bool suppress = true)
{ ms_isSilent = suppress; }
// test if beep is currently disabled
static bool IsSilent() { return ms_isSilent; }
// this function is deprecated because it handled its parameter
// unnaturally: it disabled the bell when it was true, not false as could
// be expected; use SuppressBellOnError() instead
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED_INLINE(
static void SetBellOnError(bool doIt = true),
ms_isSilent = doIt;
)
#endif
protected:
wxWindowBase *m_validatorWindow;
private:
static bool ms_isSilent;
DECLARE_DYNAMIC_CLASS(wxValidator)
wxDECLARE_NO_COPY_CLASS(wxValidator);
};
extern WXDLLIMPEXP_DATA_CORE(const wxValidator) wxDefaultValidator;
#define wxVALIDATOR_PARAM(val) val
#else // !wxUSE_VALIDATORS
// wxWidgets is compiled without support for wxValidator, but we still
// want to be able to pass wxDefaultValidator to the functions which take
// a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS"
// everywhere
class WXDLLIMPEXP_FWD_CORE wxValidator;
#define wxDefaultValidator (*reinterpret_cast<wxValidator*>(NULL))
// this macro allows to avoid warnings about unused parameters when
// wxUSE_VALIDATORS == 0
#define wxVALIDATOR_PARAM(val)
#endif // wxUSE_VALIDATORS/!wxUSE_VALIDATORS
#endif // _WX_VALIDATE_H_
| 32.508929 | 79 | 0.665477 |
d804a7129e2ee420aac59989b118b143476c65ac | 688 | h | C | statusvollite/statusvolliteprefs/prefs-common.h | kieranjailbreak/cydua-tweaks-to-code-for-own | 31ab66c12d8c7325e372be0e498c33c291f1fa3e | [
"MIT"
] | 19 | 2015-01-21T13:24:01.000Z | 2022-01-25T12:31:36.000Z | statusvollite/statusvolliteprefs/prefs-common.h | kieranjailbreak/cydua-tweaks-to-code-for-own | 31ab66c12d8c7325e372be0e498c33c291f1fa3e | [
"MIT"
] | 4 | 2015-02-10T18:39:05.000Z | 2021-07-16T19:56:31.000Z | statusvollite/statusvolliteprefs/prefs-common.h | kieranjailbreak/cydua-tweaks-to-code-for-own | 31ab66c12d8c7325e372be0e498c33c291f1fa3e | [
"MIT"
] | 10 | 2015-01-27T22:29:16.000Z | 2021-02-22T00:58:33.000Z | @interface PSListController : UITableViewController{
UITableView *_table;
id _specifiers;
}
- (id)specifiers;
- (id)loadSpecifiersFromPlistName:(id)arg1 target:(id)arg2;
@end
@interface PSSpecifier : NSObject
@end
@interface PSTableCell : UITableViewCell
-(id)initWithStyle:(long long)arg1 reuseIdentifier:(id)arg2 specifier:(id)arg3;
@end
@interface PSControlTableCell : PSTableCell
-(UIControl *)control;
@end
@interface PSSwitchTableCell : PSControlTableCell
-(id)initWithStyle:(int)arg1 reuseIdentifier:(id)arg2 specifier:(id)arg3 ;
@end
@interface PSSliderTableCell : PSControlTableCell
-(id)initWithStyle:(int)arg1 reuseIdentifier:(id)arg2 specifier:(id)arg3 ;
@end | 26.461538 | 80 | 0.780523 |
26a55dcfc942ed1f6985aa030c1be1cb5d917a30 | 1,473 | h | C | org.alloytools.kodkod.nativesat/lib/lingeling-587f/jni/kodkod_engine_satlab_Lingeling.h | chongliujlu/ColorfulAlloy | 4f8ff5074b959f91d3b70a46bc6b7355cf28911b | [
"Apache-2.0"
] | 71 | 2015-09-24T19:31:27.000Z | 2022-02-17T06:26:59.000Z | org.alloytools.kodkod.nativesat/lib/lingeling-587f/jni/kodkod_engine_satlab_Lingeling.h | chongliujlu/ColorfulAlloy | 4f8ff5074b959f91d3b70a46bc6b7355cf28911b | [
"Apache-2.0"
] | 55 | 2019-10-06T18:28:49.000Z | 2021-10-20T14:21:43.000Z | org.alloytools.kodkod.nativesat/lib/lingeling-587f/jni/kodkod_engine_satlab_Lingeling.h | chongliujlu/ColorfulAlloy | 4f8ff5074b959f91d3b70a46bc6b7355cf28911b | [
"Apache-2.0"
] | 22 | 2015-11-11T08:40:43.000Z | 2020-04-13T01:57:40.000Z | /* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class kodkod_engine_satlab_Lingeling */
#ifndef _Included_kodkod_engine_satlab_Lingeling
#define _Included_kodkod_engine_satlab_Lingeling
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: kodkod_engine_satlab_Lingeling
* Method: make
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_kodkod_engine_satlab_Lingeling_make
(JNIEnv *, jclass);
/*
* Class: kodkod_engine_satlab_Lingeling
* Method: free
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_kodkod_engine_satlab_Lingeling_free
(JNIEnv *, jobject, jlong);
/*
* Class: kodkod_engine_satlab_Lingeling
* Method: addVariables
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_kodkod_engine_satlab_Lingeling_addVariables
(JNIEnv *, jobject, jlong, jint);
/*
* Class: kodkod_engine_satlab_Lingeling
* Method: addClause
* Signature: (J[I)Z
*/
JNIEXPORT jboolean JNICALL Java_kodkod_engine_satlab_Lingeling_addClause
(JNIEnv *, jobject, jlong, jintArray);
/*
* Class: kodkod_engine_satlab_Lingeling
* Method: solve
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_kodkod_engine_satlab_Lingeling_solve
(JNIEnv *, jobject, jlong);
/*
* Class: kodkod_engine_satlab_Lingeling
* Method: valueOf
* Signature: (JI)Z
*/
JNIEXPORT jboolean JNICALL Java_kodkod_engine_satlab_Lingeling_valueOf
(JNIEnv *, jobject, jlong, jint);
#ifdef __cplusplus
}
#endif
#endif
| 23.758065 | 72 | 0.748133 |
9ccee32013620982bb7b345a37f2b309e187d736 | 574 | h | C | interfaces/isessionproxy.h | cayprogram/cpl_main | 9cc8f4c8cf33465506bdb18ddc84340992b16494 | [
"MIT"
] | null | null | null | interfaces/isessionproxy.h | cayprogram/cpl_main | 9cc8f4c8cf33465506bdb18ddc84340992b16494 | [
"MIT"
] | null | null | null | interfaces/isessionproxy.h | cayprogram/cpl_main | 9cc8f4c8cf33465506bdb18ddc84340992b16494 | [
"MIT"
] | null | null | null | #ifndef SESSIONPROXYINTERFACE_H
#define SESSIONPROXYINTERFACE_H
class ISessionProxy {
public:
/** is valid to record session */
virtual int IsValidRecordSession() = 0;
/** is running session */
virtual int IsRunningSession() = 0;
/** write command session */
virtual void WriteCommandSession(char* cmdStr) = 0;
/** read function session */
virtual void WriteFunctionSession(char* funStr) = 0;
/** is function not need to be recorded */
virtual int IsSkipRecordFunction(char* funStr) = 0;
};
#endif //SESSIONPROXYINTERFACE_H
| 23.916667 | 56 | 0.691638 |
8c443ef8172b8003ae3aec4bc686ce85c7ed4614 | 3,215 | h | C | NurbsFit/open_curve.h | OpenNurbsFit/OpenNurbsFit | d1ca01437a6da6bbf921466013ff969def5dfe65 | [
"BSD-3-Clause"
] | 14 | 2015-07-06T13:04:49.000Z | 2022-02-06T10:09:05.000Z | NurbsFit/open_curve.h | OpenNurbsFit/OpenNurbsFit | d1ca01437a6da6bbf921466013ff969def5dfe65 | [
"BSD-3-Clause"
] | 1 | 2020-12-07T03:26:39.000Z | 2020-12-07T03:26:39.000Z | NurbsFit/open_curve.h | OpenNurbsFit/OpenNurbsFit | d1ca01437a6da6bbf921466013ff969def5dfe65 | [
"BSD-3-Clause"
] | 11 | 2015-07-06T13:04:43.000Z | 2022-03-29T10:57:04.000Z | /*
* Software License Agreement (BSD License)
*
* Copyright (c) 2015, Thomas Mörwald
* 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 copyright holder(s) 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 NURBS_FIT_OPEN_CURVE_H
#define NURBS_FIT_OPEN_CURVE_H
#include "curve.h"
namespace nurbsfit{
class FitOpenCurve : public FitCurve
{
protected:
void updateCurve();
public:
/** Initialize the NURBS curve.
* @param[in] dims Dimension of NURBS surface (ie. control points).
* @param[in] order Polynomial order
* @param[in] cps Number of control points
* @param[in] domain The domain range of the NURBS curve.
* @param[in] clamped true creates terminating curve ends (mulitple knots), false leaves them open (uniform knots)
* @see FitCurve::Domain
*/
void initCurve(int dims, int order, int cps, Domain range, bool clamped=true);
/** Initialize the solver. Assembly of matrix A and QR decomposition. Requires NURBS curve to be initialized.
* @param[in] param Vector of parametric positions, corresponding to values
*/
void initSolver(const Eigen::VectorXd& param);
/** Solve the linear system A * x = b with respect to x und updates control points of ON_NurbsCurve m_nurbs.
* Requires NURBS curve and solver to be initialized.
* @param[in] values The values the NURBS curve is fitted to (conforms b in linear system)
*/
void solve(const Eigen::VectorXd& values);
/** Compute fitting error.
* @param[in] values The values the NURBS curve has been fitted to (conforms b in linear system)
* @return Fitting error for each value (return A*x-b)
*/
Eigen::VectorXd getError(const Eigen::VectorXd& values);
};
} // namespace nurbsfit
#endif // NURBS_FIT_OPEN_CURVE_H
| 40.1875 | 117 | 0.733748 |
96a69abc1825a1f38ab4f3433c2777b23aea1cc6 | 128 | h | C | CLActionSheet/CLActionSheet/CLActionSheetCell.h | IOS-mamu/CLActionSheet | 2fe8346fa63ec5df401557bed22a9fbb44655439 | [
"MIT"
] | 3 | 2016-01-21T03:58:03.000Z | 2016-06-14T03:11:07.000Z | CLActionSheet/CLActionSheet/CLActionSheetCell.h | IOS-mamu/CLActionSheet | 2fe8346fa63ec5df401557bed22a9fbb44655439 | [
"MIT"
] | null | null | null | CLActionSheet/CLActionSheet/CLActionSheetCell.h | IOS-mamu/CLActionSheet | 2fe8346fa63ec5df401557bed22a9fbb44655439 | [
"MIT"
] | null | null | null | #import <UIKit/UIKit.h>
@interface CLActionSheetCell : UITableViewCell
@property (nonatomic,strong)UILabel * centerLabel;
@end
| 21.333333 | 50 | 0.796875 |
8862586ff809161950358d04082bc50b9ea300ba | 1,102 | c | C | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.target/i386/avx512dq-vinserti64x2-1.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.target/i386/avx512dq-vinserti64x2-1.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.target/i386/avx512dq-vinserti64x2-1.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | /* { dg-do compile } */
/* { dg-options "-mavx512dq -mavx512vl -O2" } */
/* { dg-final { scan-assembler-times "vinserti64x2\[^\n\]*ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vinserti64x2\[^\n\]*ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vinserti64x2\[^\n\]*ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vinserti64x2\[^\n\]*zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vinserti64x2\[^\n\]*zmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vinserti64x2\[^\n\]*zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
volatile __m512i z;
volatile __m256i x;
volatile __m128i y;
void extern
avx512dq_test (void)
{
x = _mm256_inserti64x2 (x, y, 1);
x = _mm256_mask_inserti64x2 (x, 2, x, y, 1);
x = _mm256_maskz_inserti64x2 (2, x, y, 1);
z = _mm512_inserti64x2 (z, y, 0);
z = _mm512_mask_inserti64x2 (z, 2, z, y, 0);
z = _mm512_maskz_inserti64x2 (2, z, y, 0);
}
| 42.384615 | 115 | 0.528131 |
15c709710a55d0d0680434311484b74f63d2bcaf | 682 | h | C | libembroidery/emb-settings.h | Drahflow/Embroidermodder | 5fe2bed6407845e9d183aee40095b3f778a5b559 | [
"Zlib"
] | 3 | 2017-05-18T13:57:43.000Z | 2018-08-13T14:56:33.000Z | libembroidery/emb-settings.h | Drahflow/Embroidermodder | 5fe2bed6407845e9d183aee40095b3f778a5b559 | [
"Zlib"
] | null | null | null | libembroidery/emb-settings.h | Drahflow/Embroidermodder | 5fe2bed6407845e9d183aee40095b3f778a5b559 | [
"Zlib"
] | null | null | null | /*! @file emb-settings.h */
#ifndef EMB_SETTINGS_H
#define EMB_SETTINGS_H
#include "emb-point.h"
#include "api-start.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct EmbSettings_
{
unsigned int dstJumpsPerTrim;
EmbPoint home;
} EmbSettings;
extern EMB_PUBLIC EmbSettings EMB_CALL embSettings_init(void);
extern EMB_PUBLIC EmbPoint EMB_CALL embSettings_home(EmbSettings* settings);
extern EMB_PUBLIC void EMB_CALL embSettings_setHome(EmbSettings* settings, EmbPoint point);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include "api-stop.h"
#endif /* EMB_SETTINGS_H */
/* kate: bom off; indent-mode cstyle; indent-width 4; replace-trailing-space-save on; */
| 22 | 91 | 0.76393 |
76b65b2f6884c911601964e74d08c59978914aad | 2,282 | h | C | clang/include/clang/ARCMigrate/FileRemapper.h | medismailben/llvm-project | e334a839032fe500c3bba22bf976ab7af13ce1c1 | [
"Apache-2.0"
] | 3,102 | 2015-01-04T02:28:35.000Z | 2022-03-30T12:53:41.000Z | clang/include/clang/ARCMigrate/FileRemapper.h | medismailben/llvm-project | e334a839032fe500c3bba22bf976ab7af13ce1c1 | [
"Apache-2.0"
] | 11,789 | 2015-01-05T04:50:15.000Z | 2022-03-31T23:39:19.000Z | clang/include/clang/ARCMigrate/FileRemapper.h | medismailben/llvm-project | e334a839032fe500c3bba22bf976ab7af13ce1c1 | [
"Apache-2.0"
] | 1,868 | 2015-01-03T04:27:11.000Z | 2022-03-25T13:37:35.000Z | //===-- FileRemapper.h - File Remapping Helper ------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_ARCMIGRATE_FILEREMAPPER_H
#define LLVM_CLANG_ARCMIGRATE_FILEREMAPPER_H
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringRef.h"
#include <memory>
namespace llvm {
class MemoryBuffer;
}
namespace clang {
class FileManager;
class FileEntry;
class DiagnosticsEngine;
class PreprocessorOptions;
namespace arcmt {
class FileRemapper {
// FIXME: Reuse the same FileManager for multiple ASTContexts.
std::unique_ptr<FileManager> FileMgr;
typedef llvm::PointerUnion<const FileEntry *, llvm::MemoryBuffer *> Target;
typedef llvm::DenseMap<const FileEntry *, Target> MappingsTy;
MappingsTy FromToMappings;
llvm::DenseMap<const FileEntry *, const FileEntry *> ToFromMappings;
public:
FileRemapper();
~FileRemapper();
bool initFromDisk(StringRef outputDir, DiagnosticsEngine &Diag,
bool ignoreIfFilesChanged);
bool initFromFile(StringRef filePath, DiagnosticsEngine &Diag,
bool ignoreIfFilesChanged);
bool flushToDisk(StringRef outputDir, DiagnosticsEngine &Diag);
bool flushToFile(StringRef outputPath, DiagnosticsEngine &Diag);
bool overwriteOriginal(DiagnosticsEngine &Diag,
StringRef outputDir = StringRef());
void remap(StringRef filePath, std::unique_ptr<llvm::MemoryBuffer> memBuf);
void applyMappings(PreprocessorOptions &PPOpts) const;
void clear(StringRef outputDir = StringRef());
private:
void remap(const FileEntry *file, std::unique_ptr<llvm::MemoryBuffer> memBuf);
void remap(const FileEntry *file, const FileEntry *newfile);
const FileEntry *getOriginalFile(StringRef filePath);
void resetTarget(Target &targ);
bool report(const Twine &err, DiagnosticsEngine &Diag);
std::string getRemapInfoFile(StringRef outputDir);
};
} // end namespace arcmt
} // end namespace clang
#endif
| 29.636364 | 80 | 0.710342 |
63b1c65caf5f2917e6801bb500e377baf717a9e2 | 210 | h | C | OSX Client/src/ColoredNSWindow.h | bensnell/ofxRemoteUI | 748c2da201d7568370610212efef4e4ea9710265 | [
"MIT"
] | 74 | 2015-01-06T05:08:42.000Z | 2022-01-09T03:29:14.000Z | OSX Client/src/ColoredNSWindow.h | bensnell/ofxRemoteUI | 748c2da201d7568370610212efef4e4ea9710265 | [
"MIT"
] | 15 | 2015-01-22T20:37:32.000Z | 2020-02-06T12:25:58.000Z | OSX Client/src/ColoredNSWindow.h | bensnell/ofxRemoteUI | 748c2da201d7568370610212efef4e4ea9710265 | [
"MIT"
] | 12 | 2015-02-22T16:52:14.000Z | 2020-06-30T04:19:10.000Z | //
// ColoredNSWindow.h
// ofxRemoteUIClientOSX
//
// Created by Oriol Ferrer Mesià on 15/08/13.
//
//
#import <Cocoa/Cocoa.h>
@interface ColoredNSWindow : NSWindow{
}
-(void)setColor:(NSColor*)c;
@end
| 11.666667 | 46 | 0.671429 |
6fb6f314940e3a4f391d472ce961080b2ff6d698 | 1,096 | c | C | examples/freertos/l2_cache/src/print_info.c | danielpieczko/xcore_sdk | abb3bdc62d72fa8c13e77f778312ba9f8b29c0f4 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | examples/freertos/l2_cache/src/print_info.c | danielpieczko/xcore_sdk | abb3bdc62d72fa8c13e77f778312ba9f8b29c0f4 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | examples/freertos/l2_cache/src/print_info.c | danielpieczko/xcore_sdk | abb3bdc62d72fa8c13e77f778312ba9f8b29c0f4 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | // Copyright 2020-2021 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#include <platform.h> // for PLATFORM_REFERENCE_MHZ
#include <stdio.h>
#include <stdlib.h>
#include "l2_cache.h"
#include "print_info.h"
#include "xcore_utils.h"
void print_info(uint32_t timer_ticks)
{
#if PRINT_TIMING_INFO
#if L2_CACHE_DEBUG_FLOAT_ON
// NOTE: This is invalid if L2 Cache debug is enabled, so don't print it.
printf(" Timing: %0.01f us\n", timer_ticks / 100.0f);
#else
debug_printf(" Timing: %lu us\n", timer_ticks / 100);
#endif
#endif // PRINT_TIMING_INFO
#if L2_CACHE_DEBUG_ON
// NOTE: This info isn't collected unless L2 Cache debug is enabled.
#if L2_CACHE_DEBUG_FLOAT_ON
printf(" Cache Hit Rate: %0.04f\n", l2_cache_debug_hit_rate() );
#else
debug_printf(" Cache Hit Rate: %lu\n", l2_cache_debug_hit_rate() );
#endif
debug_printf(" Hit Count: %lu\n", get_hit_count() );
debug_printf(" Fill Request Count: %lu\n", get_fill_request_count() );
l2_cache_debug_stats_reset();
#endif // L2_CACHE_DEBUG_ON
}
| 30.444444 | 79 | 0.712591 |
a58af4107714c8d8985e6b54a0082cff774802bd | 2,839 | h | C | vs/include/alibabacloud/vs/model/CreateRenderingDeviceRequest.h | aliyun/aliyun-openapi-cpp-sdk | 0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36 | [
"Apache-2.0"
] | 89 | 2018-02-02T03:54:39.000Z | 2021-12-13T01:32:55.000Z | vs/include/alibabacloud/vs/model/CreateRenderingDeviceRequest.h | aliyun/aliyun-openapi-cpp-sdk | 0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36 | [
"Apache-2.0"
] | 89 | 2018-03-14T07:44:54.000Z | 2021-11-26T07:43:25.000Z | vs/include/alibabacloud/vs/model/CreateRenderingDeviceRequest.h | aliyun/aliyun-openapi-cpp-sdk | 0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36 | [
"Apache-2.0"
] | 69 | 2018-01-22T09:45:52.000Z | 2022-03-28T07:58:38.000Z | /*
* Copyright 2009-2017 Alibaba Cloud 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 ALIBABACLOUD_VS_MODEL_CREATERENDERINGDEVICEREQUEST_H_
#define ALIBABACLOUD_VS_MODEL_CREATERENDERINGDEVICEREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/vs/VsExport.h>
namespace AlibabaCloud
{
namespace Vs
{
namespace Model
{
class ALIBABACLOUD_VS_EXPORT CreateRenderingDeviceRequest : public RpcServiceRequest
{
public:
CreateRenderingDeviceRequest();
~CreateRenderingDeviceRequest();
std::string getImageId()const;
void setImageId(const std::string& imageId);
std::string getSecurityGroupId()const;
void setSecurityGroupId(const std::string& securityGroupId);
std::string getDescription()const;
void setDescription(const std::string& description);
std::string getInstanceChargeType()const;
void setInstanceChargeType(const std::string& instanceChargeType);
std::string getShowLog()const;
void setShowLog(const std::string& showLog);
int getAutoRenewPeriod()const;
void setAutoRenewPeriod(int autoRenewPeriod);
int getPeriod()const;
void setPeriod(int period);
int getCount()const;
void setCount(int count);
std::string getSpecification()const;
void setSpecification(const std::string& specification);
std::string getClusterId()const;
void setClusterId(const std::string& clusterId);
long getOwnerId()const;
void setOwnerId(long ownerId);
std::string getPeriodUnit()const;
void setPeriodUnit(const std::string& periodUnit);
bool getAutoRenew()const;
void setAutoRenew(bool autoRenew);
std::string getEdgeNodeName()const;
void setEdgeNodeName(const std::string& edgeNodeName);
private:
std::string imageId_;
std::string securityGroupId_;
std::string description_;
std::string instanceChargeType_;
std::string showLog_;
int autoRenewPeriod_;
int period_;
int count_;
std::string specification_;
std::string clusterId_;
long ownerId_;
std::string periodUnit_;
bool autoRenew_;
std::string edgeNodeName_;
};
}
}
}
#endif // !ALIBABACLOUD_VS_MODEL_CREATERENDERINGDEVICEREQUEST_H_ | 32.632184 | 87 | 0.728073 |
4f96ed5084274173774665c1c06a374b9addf322 | 453 | h | C | src/math/AABB.h | zippybenjiman/PythonCraft | daeb9b4eac1530c98843bf8fc412345f58e37c97 | [
"MIT"
] | 51 | 2015-08-08T22:36:47.000Z | 2022-03-02T20:20:54.000Z | src/math/AABB.h | zippybenjiman/PythonCraft | daeb9b4eac1530c98843bf8fc412345f58e37c97 | [
"MIT"
] | 3 | 2016-04-12T16:36:58.000Z | 2019-03-02T21:46:10.000Z | src/math/AABB.h | zippybenjiman/PythonCraft | daeb9b4eac1530c98843bf8fc412345f58e37c97 | [
"MIT"
] | 13 | 2016-03-25T07:05:40.000Z | 2021-08-15T12:19:04.000Z | #ifndef _AABB_H_
#define _AABB_H_
class AABB
{
public:
double minX;
double minY;
double minZ;
double maxX;
double maxY;
double maxZ;
AABB()
{
minX = 0;
minY = 0;
minZ = 0;
maxX = 0;
maxY = 0;
maxZ = 0;
}
AABB(double minx, double miny, double minz, double maxx, double maxy, double maxz)
{
this->minX = minx;
this->minY = miny;
this->minZ = minz;
this->maxX = maxx;
this->maxY = maxy;
this->maxZ = maxz;
}
};
#endif | 13.323529 | 83 | 0.613687 |
4ff42e66f8065f8b38e7909c97113c0d81429053 | 616 | h | C | Carthage/Checkouts/Typhoon/Source/Utils/Swizzle/TyphoonMethodSwizzler.h | pomozoff/accountslist | 5649b27a8337d8df2f8604553754d1d4b66111bc | [
"MIT"
] | null | null | null | Carthage/Checkouts/Typhoon/Source/Utils/Swizzle/TyphoonMethodSwizzler.h | pomozoff/accountslist | 5649b27a8337d8df2f8604553754d1d4b66111bc | [
"MIT"
] | null | null | null | Carthage/Checkouts/Typhoon/Source/Utils/Swizzle/TyphoonMethodSwizzler.h | pomozoff/accountslist | 5649b27a8337d8df2f8604553754d1d4b66111bc | [
"MIT"
] | null | null | null | ////////////////////////////////////////////////////////////////////////////////
//
// TYPHOON FRAMEWORK
// Copyright 2014, Typhoon Framework Contributors
// All Rights Reserved.
//
// NOTICE: The authors permit you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
@protocol TyphoonMethodSwizzler<NSObject>
@required
- (BOOL)swizzleMethod:(SEL)selA withMethod:(SEL)selB onClass:(Class)pClass error:(NSError **)error;
@end | 29.333333 | 99 | 0.553571 |
128a221d0f1a2f16bce4a93114bf970dd4734cee | 1,574 | h | C | addons/ofxFX/src/operations/ofxBounce.h | creatologist/openFrameworks0084 | aa74f188f105b62fbcecb7baf2b41d56d97cf7bc | [
"MIT"
] | 220 | 2015-01-19T04:53:59.000Z | 2022-02-19T13:02:03.000Z | addons/ofxFX/src/operations/ofxBounce.h | creatologist/openFrameworks0084 | aa74f188f105b62fbcecb7baf2b41d56d97cf7bc | [
"MIT"
] | 17 | 2015-01-22T06:44:44.000Z | 2021-06-25T14:18:34.000Z | addons/ofxFX/src/operations/ofxBounce.h | creatologist/openFrameworks0084 | aa74f188f105b62fbcecb7baf2b41d56d97cf7bc | [
"MIT"
] | 41 | 2015-02-28T14:22:33.000Z | 2021-07-20T20:36:56.000Z | //
// ofxBounce.h
// example-waterRipples
//
// Created by Patricio Gonzalez Vivo on 11/24/12.
//
//
#pragma once
#define STRINGIFY(A) #A
#include "ofMain.h"
#include "ofxFXObject.h"
class ofxBounce : public ofxFXObject {
public:
ofxBounce(){
passes = 1;
internalFormat = GL_RGBA32F;
fragmentShader = STRINGIFY(uniform sampler2DRect tex0; // displacement
uniform sampler2DRect tex1; // background
void main(){
vec2 st = gl_TexCoord[0].st;
float offsetX = texture2DRect(tex0, st + vec2(-1.0, 0.0)).r - texture2DRect(tex0, st + vec2(1.0, 0.0)).r;
float offsetY = texture2DRect(tex0, st + vec2(0.0,- 1.0)).r - texture2DRect(tex0, st + vec2(0.0, 1.0)).r;
float shading = offsetX;
vec4 pixel = texture2DRect(tex1, st + vec2(offsetX, offsetY));
pixel.r += shading;
pixel.g += shading;
pixel.b += shading;
gl_FragColor = pixel;
} );
}
};
| 36.604651 | 144 | 0.369123 |
c4913e0326496854606a118f271361a33b19a418 | 112,969 | c | C | deps/inchi/INCHI-1-API/INCHI_API/inchi_dll/ikey_base26.c | smikes/inchi | 7a980f01b2c3eef3b5cf4f2502d814724366d385 | [
"MIT"
] | 7 | 2015-01-21T04:48:06.000Z | 2021-05-26T09:10:58.000Z | deps/inchi/INCHI-1-API/INCHI_API/inchi_dll/ikey_base26.c | smikes/inchi | 7a980f01b2c3eef3b5cf4f2502d814724366d385 | [
"MIT"
] | 1 | 2018-02-20T19:47:40.000Z | 2018-02-20T19:47:40.000Z | deps/inchi/INCHI-1-API/INCHI_API/inchi_dll/ikey_base26.c | smikes/inchi | 7a980f01b2c3eef3b5cf4f2502d814724366d385 | [
"MIT"
] | 1 | 2015-06-25T15:09:14.000Z | 2015-06-25T15:09:14.000Z | /*
* International Chemical Identifier (InChI)
* Version 1
* Software version 1.04
* September 9, 2011
*
* The InChI library and programs are free software developed under the
* auspices of the International Union of Pure and Applied Chemistry (IUPAC).
* Originally developed at NIST. Modifications and additions by IUPAC
* and the InChI Trust.
*
* IUPAC/InChI-Trust Licence No.1.0 for the
* International Chemical Identifier (InChI) Software version 1.04
* Copyright (C) IUPAC and InChI Trust Limited
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the IUPAC/InChI Trust InChI Licence No.1.0,
* or any later version.
*
* Please note that this library is distributed WITHOUT ANY WARRANTIES
* whatsoever, whether expressed or implied. See the IUPAC/InChI Trust
* Licence for the International Chemical Identifier (InChI) Software
* version 1.04, October 2011 ("IUPAC/InChI-Trust InChI Licence No.1.0")
* for more details.
*
* You should have received a copy of the IUPAC/InChI Trust InChI
* Licence No. 1.0 with this library; if not, please write to:
*
* The InChI Trust
* c/o FIZ CHEMIE Berlin
*
* Franklinstrasse 11
* 10587 Berlin
* GERMANY
*
* or email to: ulrich@inchi-trust.org.
*
*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
InChIKey: procedures for base-26 encoding
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
#ifdef _MSC_VER
#if _MSC_VER > 1000
#pragma warning( disable : 4996 )
#endif
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "ikey_base26.h"
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
As the 2^14 (16384) is very close to 26^3 (17576), a triplet of uppercase
letters A..Z encodes 14 bits with good efficiency.
For speed, we just tabulate triplets below.
We should throw away 17576-16384= 1192 triplets.
These are 676 triplets starting from 'E', the most frequent letter in English
texts (the other 516 are those started at 'T' , "TAA" to "TTV").
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
static char t26[][4] =
{
"AAA","AAB","AAC","AAD","AAE","AAF","AAG","AAH","AAI","AAJ","AAK","AAL","AAM","AAN","AAO","AAP",
"AAQ","AAR","AAS","AAT","AAU","AAV","AAW","AAX","AAY","AAZ","ABA","ABB","ABC","ABD","ABE","ABF",
"ABG","ABH","ABI","ABJ","ABK","ABL","ABM","ABN","ABO","ABP","ABQ","ABR","ABS","ABT","ABU","ABV",
"ABW","ABX","ABY","ABZ","ACA","ACB","ACC","ACD","ACE","ACF","ACG","ACH","ACI","ACJ","ACK","ACL",
"ACM","ACN","ACO","ACP","ACQ","ACR","ACS","ACT","ACU","ACV","ACW","ACX","ACY","ACZ","ADA","ADB",
"ADC","ADD","ADE","ADF","ADG","ADH","ADI","ADJ","ADK","ADL","ADM","ADN","ADO","ADP","ADQ","ADR",
"ADS","ADT","ADU","ADV","ADW","ADX","ADY","ADZ","AEA","AEB","AEC","AED","AEE","AEF","AEG","AEH",
"AEI","AEJ","AEK","AEL","AEM","AEN","AEO","AEP","AEQ","AER","AES","AET","AEU","AEV","AEW","AEX",
"AEY","AEZ","AFA","AFB","AFC","AFD","AFE","AFF","AFG","AFH","AFI","AFJ","AFK","AFL","AFM","AFN",
"AFO","AFP","AFQ","AFR","AFS","AFT","AFU","AFV","AFW","AFX","AFY","AFZ","AGA","AGB","AGC","AGD",
"AGE","AGF","AGG","AGH","AGI","AGJ","AGK","AGL","AGM","AGN","AGO","AGP","AGQ","AGR","AGS","AGT",
"AGU","AGV","AGW","AGX","AGY","AGZ","AHA","AHB","AHC","AHD","AHE","AHF","AHG","AHH","AHI","AHJ",
"AHK","AHL","AHM","AHN","AHO","AHP","AHQ","AHR","AHS","AHT","AHU","AHV","AHW","AHX","AHY","AHZ",
"AIA","AIB","AIC","AID","AIE","AIF","AIG","AIH","AII","AIJ","AIK","AIL","AIM","AIN","AIO","AIP",
"AIQ","AIR","AIS","AIT","AIU","AIV","AIW","AIX","AIY","AIZ","AJA","AJB","AJC","AJD","AJE","AJF",
"AJG","AJH","AJI","AJJ","AJK","AJL","AJM","AJN","AJO","AJP","AJQ","AJR","AJS","AJT","AJU","AJV",
"AJW","AJX","AJY","AJZ","AKA","AKB","AKC","AKD","AKE","AKF","AKG","AKH","AKI","AKJ","AKK","AKL",
"AKM","AKN","AKO","AKP","AKQ","AKR","AKS","AKT","AKU","AKV","AKW","AKX","AKY","AKZ","ALA","ALB",
"ALC","ALD","ALE","ALF","ALG","ALH","ALI","ALJ","ALK","ALL","ALM","ALN","ALO","ALP","ALQ","ALR",
"ALS","ALT","ALU","ALV","ALW","ALX","ALY","ALZ","AMA","AMB","AMC","AMD","AME","AMF","AMG","AMH",
"AMI","AMJ","AMK","AML","AMM","AMN","AMO","AMP","AMQ","AMR","AMS","AMT","AMU","AMV","AMW","AMX",
"AMY","AMZ","ANA","ANB","ANC","AND","ANE","ANF","ANG","ANH","ANI","ANJ","ANK","ANL","ANM","ANN",
"ANO","ANP","ANQ","ANR","ANS","ANT","ANU","ANV","ANW","ANX","ANY","ANZ","AOA","AOB","AOC","AOD",
"AOE","AOF","AOG","AOH","AOI","AOJ","AOK","AOL","AOM","AON","AOO","AOP","AOQ","AOR","AOS","AOT",
"AOU","AOV","AOW","AOX","AOY","AOZ","APA","APB","APC","APD","APE","APF","APG","APH","API","APJ",
"APK","APL","APM","APN","APO","APP","APQ","APR","APS","APT","APU","APV","APW","APX","APY","APZ",
"AQA","AQB","AQC","AQD","AQE","AQF","AQG","AQH","AQI","AQJ","AQK","AQL","AQM","AQN","AQO","AQP",
"AQQ","AQR","AQS","AQT","AQU","AQV","AQW","AQX","AQY","AQZ","ARA","ARB","ARC","ARD","ARE","ARF",
"ARG","ARH","ARI","ARJ","ARK","ARL","ARM","ARN","ARO","ARP","ARQ","ARR","ARS","ART","ARU","ARV",
"ARW","ARX","ARY","ARZ","ASA","ASB","ASC","ASD","ASE","ASF","ASG","ASH","ASI","ASJ","ASK","ASL",
"ASM","ASN","ASO","ASP","ASQ","ASR","ASS","AST","ASU","ASV","ASW","ASX","ASY","ASZ","ATA","ATB",
"ATC","ATD","ATE","ATF","ATG","ATH","ATI","ATJ","ATK","ATL","ATM","ATN","ATO","ATP","ATQ","ATR",
"ATS","ATT","ATU","ATV","ATW","ATX","ATY","ATZ","AUA","AUB","AUC","AUD","AUE","AUF","AUG","AUH",
"AUI","AUJ","AUK","AUL","AUM","AUN","AUO","AUP","AUQ","AUR","AUS","AUT","AUU","AUV","AUW","AUX",
"AUY","AUZ","AVA","AVB","AVC","AVD","AVE","AVF","AVG","AVH","AVI","AVJ","AVK","AVL","AVM","AVN",
"AVO","AVP","AVQ","AVR","AVS","AVT","AVU","AVV","AVW","AVX","AVY","AVZ","AWA","AWB","AWC","AWD",
"AWE","AWF","AWG","AWH","AWI","AWJ","AWK","AWL","AWM","AWN","AWO","AWP","AWQ","AWR","AWS","AWT",
"AWU","AWV","AWW","AWX","AWY","AWZ","AXA","AXB","AXC","AXD","AXE","AXF","AXG","AXH","AXI","AXJ",
"AXK","AXL","AXM","AXN","AXO","AXP","AXQ","AXR","AXS","AXT","AXU","AXV","AXW","AXX","AXY","AXZ",
"AYA","AYB","AYC","AYD","AYE","AYF","AYG","AYH","AYI","AYJ","AYK","AYL","AYM","AYN","AYO","AYP",
"AYQ","AYR","AYS","AYT","AYU","AYV","AYW","AYX","AYY","AYZ","AZA","AZB","AZC","AZD","AZE","AZF",
"AZG","AZH","AZI","AZJ","AZK","AZL","AZM","AZN","AZO","AZP","AZQ","AZR","AZS","AZT","AZU","AZV",
"AZW","AZX","AZY","AZZ","BAA","BAB","BAC","BAD","BAE","BAF","BAG","BAH","BAI","BAJ","BAK","BAL",
"BAM","BAN","BAO","BAP","BAQ","BAR","BAS","BAT","BAU","BAV","BAW","BAX","BAY","BAZ","BBA","BBB",
"BBC","BBD","BBE","BBF","BBG","BBH","BBI","BBJ","BBK","BBL","BBM","BBN","BBO","BBP","BBQ","BBR",
"BBS","BBT","BBU","BBV","BBW","BBX","BBY","BBZ","BCA","BCB","BCC","BCD","BCE","BCF","BCG","BCH",
"BCI","BCJ","BCK","BCL","BCM","BCN","BCO","BCP","BCQ","BCR","BCS","BCT","BCU","BCV","BCW","BCX",
"BCY","BCZ","BDA","BDB","BDC","BDD","BDE","BDF","BDG","BDH","BDI","BDJ","BDK","BDL","BDM","BDN",
"BDO","BDP","BDQ","BDR","BDS","BDT","BDU","BDV","BDW","BDX","BDY","BDZ","BEA","BEB","BEC","BED",
"BEE","BEF","BEG","BEH","BEI","BEJ","BEK","BEL","BEM","BEN","BEO","BEP","BEQ","BER","BES","BET",
"BEU","BEV","BEW","BEX","BEY","BEZ","BFA","BFB","BFC","BFD","BFE","BFF","BFG","BFH","BFI","BFJ",
"BFK","BFL","BFM","BFN","BFO","BFP","BFQ","BFR","BFS","BFT","BFU","BFV","BFW","BFX","BFY","BFZ",
"BGA","BGB","BGC","BGD","BGE","BGF","BGG","BGH","BGI","BGJ","BGK","BGL","BGM","BGN","BGO","BGP",
"BGQ","BGR","BGS","BGT","BGU","BGV","BGW","BGX","BGY","BGZ","BHA","BHB","BHC","BHD","BHE","BHF",
"BHG","BHH","BHI","BHJ","BHK","BHL","BHM","BHN","BHO","BHP","BHQ","BHR","BHS","BHT","BHU","BHV",
"BHW","BHX","BHY","BHZ","BIA","BIB","BIC","BID","BIE","BIF","BIG","BIH","BII","BIJ","BIK","BIL",
"BIM","BIN","BIO","BIP","BIQ","BIR","BIS","BIT","BIU","BIV","BIW","BIX","BIY","BIZ","BJA","BJB",
"BJC","BJD","BJE","BJF","BJG","BJH","BJI","BJJ","BJK","BJL","BJM","BJN","BJO","BJP","BJQ","BJR",
"BJS","BJT","BJU","BJV","BJW","BJX","BJY","BJZ","BKA","BKB","BKC","BKD","BKE","BKF","BKG","BKH",
"BKI","BKJ","BKK","BKL","BKM","BKN","BKO","BKP","BKQ","BKR","BKS","BKT","BKU","BKV","BKW","BKX",
"BKY","BKZ","BLA","BLB","BLC","BLD","BLE","BLF","BLG","BLH","BLI","BLJ","BLK","BLL","BLM","BLN",
"BLO","BLP","BLQ","BLR","BLS","BLT","BLU","BLV","BLW","BLX","BLY","BLZ","BMA","BMB","BMC","BMD",
"BME","BMF","BMG","BMH","BMI","BMJ","BMK","BML","BMM","BMN","BMO","BMP","BMQ","BMR","BMS","BMT",
"BMU","BMV","BMW","BMX","BMY","BMZ","BNA","BNB","BNC","BND","BNE","BNF","BNG","BNH","BNI","BNJ",
"BNK","BNL","BNM","BNN","BNO","BNP","BNQ","BNR","BNS","BNT","BNU","BNV","BNW","BNX","BNY","BNZ",
"BOA","BOB","BOC","BOD","BOE","BOF","BOG","BOH","BOI","BOJ","BOK","BOL","BOM","BON","BOO","BOP",
"BOQ","BOR","BOS","BOT","BOU","BOV","BOW","BOX","BOY","BOZ","BPA","BPB","BPC","BPD","BPE","BPF",
"BPG","BPH","BPI","BPJ","BPK","BPL","BPM","BPN","BPO","BPP","BPQ","BPR","BPS","BPT","BPU","BPV",
"BPW","BPX","BPY","BPZ","BQA","BQB","BQC","BQD","BQE","BQF","BQG","BQH","BQI","BQJ","BQK","BQL",
"BQM","BQN","BQO","BQP","BQQ","BQR","BQS","BQT","BQU","BQV","BQW","BQX","BQY","BQZ","BRA","BRB",
"BRC","BRD","BRE","BRF","BRG","BRH","BRI","BRJ","BRK","BRL","BRM","BRN","BRO","BRP","BRQ","BRR",
"BRS","BRT","BRU","BRV","BRW","BRX","BRY","BRZ","BSA","BSB","BSC","BSD","BSE","BSF","BSG","BSH",
"BSI","BSJ","BSK","BSL","BSM","BSN","BSO","BSP","BSQ","BSR","BSS","BST","BSU","BSV","BSW","BSX",
"BSY","BSZ","BTA","BTB","BTC","BTD","BTE","BTF","BTG","BTH","BTI","BTJ","BTK","BTL","BTM","BTN",
"BTO","BTP","BTQ","BTR","BTS","BTT","BTU","BTV","BTW","BTX","BTY","BTZ","BUA","BUB","BUC","BUD",
"BUE","BUF","BUG","BUH","BUI","BUJ","BUK","BUL","BUM","BUN","BUO","BUP","BUQ","BUR","BUS","BUT",
"BUU","BUV","BUW","BUX","BUY","BUZ","BVA","BVB","BVC","BVD","BVE","BVF","BVG","BVH","BVI","BVJ",
"BVK","BVL","BVM","BVN","BVO","BVP","BVQ","BVR","BVS","BVT","BVU","BVV","BVW","BVX","BVY","BVZ",
"BWA","BWB","BWC","BWD","BWE","BWF","BWG","BWH","BWI","BWJ","BWK","BWL","BWM","BWN","BWO","BWP",
"BWQ","BWR","BWS","BWT","BWU","BWV","BWW","BWX","BWY","BWZ","BXA","BXB","BXC","BXD","BXE","BXF",
"BXG","BXH","BXI","BXJ","BXK","BXL","BXM","BXN","BXO","BXP","BXQ","BXR","BXS","BXT","BXU","BXV",
"BXW","BXX","BXY","BXZ","BYA","BYB","BYC","BYD","BYE","BYF","BYG","BYH","BYI","BYJ","BYK","BYL",
"BYM","BYN","BYO","BYP","BYQ","BYR","BYS","BYT","BYU","BYV","BYW","BYX","BYY","BYZ","BZA","BZB",
"BZC","BZD","BZE","BZF","BZG","BZH","BZI","BZJ","BZK","BZL","BZM","BZN","BZO","BZP","BZQ","BZR",
"BZS","BZT","BZU","BZV","BZW","BZX","BZY","BZZ","CAA","CAB","CAC","CAD","CAE","CAF","CAG","CAH",
"CAI","CAJ","CAK","CAL","CAM","CAN","CAO","CAP","CAQ","CAR","CAS","CAT","CAU","CAV","CAW","CAX",
"CAY","CAZ","CBA","CBB","CBC","CBD","CBE","CBF","CBG","CBH","CBI","CBJ","CBK","CBL","CBM","CBN",
"CBO","CBP","CBQ","CBR","CBS","CBT","CBU","CBV","CBW","CBX","CBY","CBZ","CCA","CCB","CCC","CCD",
"CCE","CCF","CCG","CCH","CCI","CCJ","CCK","CCL","CCM","CCN","CCO","CCP","CCQ","CCR","CCS","CCT",
"CCU","CCV","CCW","CCX","CCY","CCZ","CDA","CDB","CDC","CDD","CDE","CDF","CDG","CDH","CDI","CDJ",
"CDK","CDL","CDM","CDN","CDO","CDP","CDQ","CDR","CDS","CDT","CDU","CDV","CDW","CDX","CDY","CDZ",
"CEA","CEB","CEC","CED","CEE","CEF","CEG","CEH","CEI","CEJ","CEK","CEL","CEM","CEN","CEO","CEP",
"CEQ","CER","CES","CET","CEU","CEV","CEW","CEX","CEY","CEZ","CFA","CFB","CFC","CFD","CFE","CFF",
"CFG","CFH","CFI","CFJ","CFK","CFL","CFM","CFN","CFO","CFP","CFQ","CFR","CFS","CFT","CFU","CFV",
"CFW","CFX","CFY","CFZ","CGA","CGB","CGC","CGD","CGE","CGF","CGG","CGH","CGI","CGJ","CGK","CGL",
"CGM","CGN","CGO","CGP","CGQ","CGR","CGS","CGT","CGU","CGV","CGW","CGX","CGY","CGZ","CHA","CHB",
"CHC","CHD","CHE","CHF","CHG","CHH","CHI","CHJ","CHK","CHL","CHM","CHN","CHO","CHP","CHQ","CHR",
"CHS","CHT","CHU","CHV","CHW","CHX","CHY","CHZ","CIA","CIB","CIC","CID","CIE","CIF","CIG","CIH",
"CII","CIJ","CIK","CIL","CIM","CIN","CIO","CIP","CIQ","CIR","CIS","CIT","CIU","CIV","CIW","CIX",
"CIY","CIZ","CJA","CJB","CJC","CJD","CJE","CJF","CJG","CJH","CJI","CJJ","CJK","CJL","CJM","CJN",
"CJO","CJP","CJQ","CJR","CJS","CJT","CJU","CJV","CJW","CJX","CJY","CJZ","CKA","CKB","CKC","CKD",
"CKE","CKF","CKG","CKH","CKI","CKJ","CKK","CKL","CKM","CKN","CKO","CKP","CKQ","CKR","CKS","CKT",
"CKU","CKV","CKW","CKX","CKY","CKZ","CLA","CLB","CLC","CLD","CLE","CLF","CLG","CLH","CLI","CLJ",
"CLK","CLL","CLM","CLN","CLO","CLP","CLQ","CLR","CLS","CLT","CLU","CLV","CLW","CLX","CLY","CLZ",
"CMA","CMB","CMC","CMD","CME","CMF","CMG","CMH","CMI","CMJ","CMK","CML","CMM","CMN","CMO","CMP",
"CMQ","CMR","CMS","CMT","CMU","CMV","CMW","CMX","CMY","CMZ","CNA","CNB","CNC","CND","CNE","CNF",
"CNG","CNH","CNI","CNJ","CNK","CNL","CNM","CNN","CNO","CNP","CNQ","CNR","CNS","CNT","CNU","CNV",
"CNW","CNX","CNY","CNZ","COA","COB","COC","COD","COE","COF","COG","COH","COI","COJ","COK","COL",
"COM","CON","COO","COP","COQ","COR","COS","COT","COU","COV","COW","COX","COY","COZ","CPA","CPB",
"CPC","CPD","CPE","CPF","CPG","CPH","CPI","CPJ","CPK","CPL","CPM","CPN","CPO","CPP","CPQ","CPR",
"CPS","CPT","CPU","CPV","CPW","CPX","CPY","CPZ","CQA","CQB","CQC","CQD","CQE","CQF","CQG","CQH",
"CQI","CQJ","CQK","CQL","CQM","CQN","CQO","CQP","CQQ","CQR","CQS","CQT","CQU","CQV","CQW","CQX",
"CQY","CQZ","CRA","CRB","CRC","CRD","CRE","CRF","CRG","CRH","CRI","CRJ","CRK","CRL","CRM","CRN",
"CRO","CRP","CRQ","CRR","CRS","CRT","CRU","CRV","CRW","CRX","CRY","CRZ","CSA","CSB","CSC","CSD",
"CSE","CSF","CSG","CSH","CSI","CSJ","CSK","CSL","CSM","CSN","CSO","CSP","CSQ","CSR","CSS","CST",
"CSU","CSV","CSW","CSX","CSY","CSZ","CTA","CTB","CTC","CTD","CTE","CTF","CTG","CTH","CTI","CTJ",
"CTK","CTL","CTM","CTN","CTO","CTP","CTQ","CTR","CTS","CTT","CTU","CTV","CTW","CTX","CTY","CTZ",
"CUA","CUB","CUC","CUD","CUE","CUF","CUG","CUH","CUI","CUJ","CUK","CUL","CUM","CUN","CUO","CUP",
"CUQ","CUR","CUS","CUT","CUU","CUV","CUW","CUX","CUY","CUZ","CVA","CVB","CVC","CVD","CVE","CVF",
"CVG","CVH","CVI","CVJ","CVK","CVL","CVM","CVN","CVO","CVP","CVQ","CVR","CVS","CVT","CVU","CVV",
"CVW","CVX","CVY","CVZ","CWA","CWB","CWC","CWD","CWE","CWF","CWG","CWH","CWI","CWJ","CWK","CWL",
"CWM","CWN","CWO","CWP","CWQ","CWR","CWS","CWT","CWU","CWV","CWW","CWX","CWY","CWZ","CXA","CXB",
"CXC","CXD","CXE","CXF","CXG","CXH","CXI","CXJ","CXK","CXL","CXM","CXN","CXO","CXP","CXQ","CXR",
"CXS","CXT","CXU","CXV","CXW","CXX","CXY","CXZ","CYA","CYB","CYC","CYD","CYE","CYF","CYG","CYH",
"CYI","CYJ","CYK","CYL","CYM","CYN","CYO","CYP","CYQ","CYR","CYS","CYT","CYU","CYV","CYW","CYX",
"CYY","CYZ","CZA","CZB","CZC","CZD","CZE","CZF","CZG","CZH","CZI","CZJ","CZK","CZL","CZM","CZN",
"CZO","CZP","CZQ","CZR","CZS","CZT","CZU","CZV","CZW","CZX","CZY","CZZ","DAA","DAB","DAC","DAD",
"DAE","DAF","DAG","DAH","DAI","DAJ","DAK","DAL","DAM","DAN","DAO","DAP","DAQ","DAR","DAS","DAT",
"DAU","DAV","DAW","DAX","DAY","DAZ","DBA","DBB","DBC","DBD","DBE","DBF","DBG","DBH","DBI","DBJ",
"DBK","DBL","DBM","DBN","DBO","DBP","DBQ","DBR","DBS","DBT","DBU","DBV","DBW","DBX","DBY","DBZ",
"DCA","DCB","DCC","DCD","DCE","DCF","DCG","DCH","DCI","DCJ","DCK","DCL","DCM","DCN","DCO","DCP",
"DCQ","DCR","DCS","DCT","DCU","DCV","DCW","DCX","DCY","DCZ","DDA","DDB","DDC","DDD","DDE","DDF",
"DDG","DDH","DDI","DDJ","DDK","DDL","DDM","DDN","DDO","DDP","DDQ","DDR","DDS","DDT","DDU","DDV",
"DDW","DDX","DDY","DDZ","DEA","DEB","DEC","DED","DEE","DEF","DEG","DEH","DEI","DEJ","DEK","DEL",
"DEM","DEN","DEO","DEP","DEQ","DER","DES","DET","DEU","DEV","DEW","DEX","DEY","DEZ","DFA","DFB",
"DFC","DFD","DFE","DFF","DFG","DFH","DFI","DFJ","DFK","DFL","DFM","DFN","DFO","DFP","DFQ","DFR",
"DFS","DFT","DFU","DFV","DFW","DFX","DFY","DFZ","DGA","DGB","DGC","DGD","DGE","DGF","DGG","DGH",
"DGI","DGJ","DGK","DGL","DGM","DGN","DGO","DGP","DGQ","DGR","DGS","DGT","DGU","DGV","DGW","DGX",
"DGY","DGZ","DHA","DHB","DHC","DHD","DHE","DHF","DHG","DHH","DHI","DHJ","DHK","DHL","DHM","DHN",
"DHO","DHP","DHQ","DHR","DHS","DHT","DHU","DHV","DHW","DHX","DHY","DHZ","DIA","DIB","DIC","DID",
"DIE","DIF","DIG","DIH","DII","DIJ","DIK","DIL","DIM","DIN","DIO","DIP","DIQ","DIR","DIS","DIT",
"DIU","DIV","DIW","DIX","DIY","DIZ","DJA","DJB","DJC","DJD","DJE","DJF","DJG","DJH","DJI","DJJ",
"DJK","DJL","DJM","DJN","DJO","DJP","DJQ","DJR","DJS","DJT","DJU","DJV","DJW","DJX","DJY","DJZ",
"DKA","DKB","DKC","DKD","DKE","DKF","DKG","DKH","DKI","DKJ","DKK","DKL","DKM","DKN","DKO","DKP",
"DKQ","DKR","DKS","DKT","DKU","DKV","DKW","DKX","DKY","DKZ","DLA","DLB","DLC","DLD","DLE","DLF",
"DLG","DLH","DLI","DLJ","DLK","DLL","DLM","DLN","DLO","DLP","DLQ","DLR","DLS","DLT","DLU","DLV",
"DLW","DLX","DLY","DLZ","DMA","DMB","DMC","DMD","DME","DMF","DMG","DMH","DMI","DMJ","DMK","DML",
"DMM","DMN","DMO","DMP","DMQ","DMR","DMS","DMT","DMU","DMV","DMW","DMX","DMY","DMZ","DNA","DNB",
"DNC","DND","DNE","DNF","DNG","DNH","DNI","DNJ","DNK","DNL","DNM","DNN","DNO","DNP","DNQ","DNR",
"DNS","DNT","DNU","DNV","DNW","DNX","DNY","DNZ","DOA","DOB","DOC","DOD","DOE","DOF","DOG","DOH",
"DOI","DOJ","DOK","DOL","DOM","DON","DOO","DOP","DOQ","DOR","DOS","DOT","DOU","DOV","DOW","DOX",
"DOY","DOZ","DPA","DPB","DPC","DPD","DPE","DPF","DPG","DPH","DPI","DPJ","DPK","DPL","DPM","DPN",
"DPO","DPP","DPQ","DPR","DPS","DPT","DPU","DPV","DPW","DPX","DPY","DPZ","DQA","DQB","DQC","DQD",
"DQE","DQF","DQG","DQH","DQI","DQJ","DQK","DQL","DQM","DQN","DQO","DQP","DQQ","DQR","DQS","DQT",
"DQU","DQV","DQW","DQX","DQY","DQZ","DRA","DRB","DRC","DRD","DRE","DRF","DRG","DRH","DRI","DRJ",
"DRK","DRL","DRM","DRN","DRO","DRP","DRQ","DRR","DRS","DRT","DRU","DRV","DRW","DRX","DRY","DRZ",
"DSA","DSB","DSC","DSD","DSE","DSF","DSG","DSH","DSI","DSJ","DSK","DSL","DSM","DSN","DSO","DSP",
"DSQ","DSR","DSS","DST","DSU","DSV","DSW","DSX","DSY","DSZ","DTA","DTB","DTC","DTD","DTE","DTF",
"DTG","DTH","DTI","DTJ","DTK","DTL","DTM","DTN","DTO","DTP","DTQ","DTR","DTS","DTT","DTU","DTV",
"DTW","DTX","DTY","DTZ","DUA","DUB","DUC","DUD","DUE","DUF","DUG","DUH","DUI","DUJ","DUK","DUL",
"DUM","DUN","DUO","DUP","DUQ","DUR","DUS","DUT","DUU","DUV","DUW","DUX","DUY","DUZ","DVA","DVB",
"DVC","DVD","DVE","DVF","DVG","DVH","DVI","DVJ","DVK","DVL","DVM","DVN","DVO","DVP","DVQ","DVR",
"DVS","DVT","DVU","DVV","DVW","DVX","DVY","DVZ","DWA","DWB","DWC","DWD","DWE","DWF","DWG","DWH",
"DWI","DWJ","DWK","DWL","DWM","DWN","DWO","DWP","DWQ","DWR","DWS","DWT","DWU","DWV","DWW","DWX",
"DWY","DWZ","DXA","DXB","DXC","DXD","DXE","DXF","DXG","DXH","DXI","DXJ","DXK","DXL","DXM","DXN",
"DXO","DXP","DXQ","DXR","DXS","DXT","DXU","DXV","DXW","DXX","DXY","DXZ","DYA","DYB","DYC","DYD",
"DYE","DYF","DYG","DYH","DYI","DYJ","DYK","DYL","DYM","DYN","DYO","DYP","DYQ","DYR","DYS","DYT",
"DYU","DYV","DYW","DYX","DYY","DYZ","DZA","DZB","DZC","DZD","DZE","DZF","DZG","DZH","DZI","DZJ",
"DZK","DZL","DZM","DZN","DZO","DZP","DZQ","DZR","DZS","DZT","DZU","DZV","DZW","DZX","DZY","DZZ",
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E-starteds are intentionally omitted
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
"FAA","FAB","FAC","FAD","FAE","FAF","FAG","FAH","FAI","FAJ","FAK","FAL",
"FAM","FAN","FAO","FAP","FAQ","FAR","FAS","FAT","FAU","FAV","FAW","FAX","FAY","FAZ","FBA","FBB",
"FBC","FBD","FBE","FBF","FBG","FBH","FBI","FBJ","FBK","FBL","FBM","FBN","FBO","FBP","FBQ","FBR",
"FBS","FBT","FBU","FBV","FBW","FBX","FBY","FBZ","FCA","FCB","FCC","FCD","FCE","FCF","FCG","FCH",
"FCI","FCJ","FCK","FCL","FCM","FCN","FCO","FCP","FCQ","FCR","FCS","FCT","FCU","FCV","FCW","FCX",
"FCY","FCZ","FDA","FDB","FDC","FDD","FDE","FDF","FDG","FDH","FDI","FDJ","FDK","FDL","FDM","FDN",
"FDO","FDP","FDQ","FDR","FDS","FDT","FDU","FDV","FDW","FDX","FDY","FDZ","FEA","FEB","FEC","FED",
"FEE","FEF","FEG","FEH","FEI","FEJ","FEK","FEL","FEM","FEN","FEO","FEP","FEQ","FER","FES","FET",
"FEU","FEV","FEW","FEX","FEY","FEZ","FFA","FFB","FFC","FFD","FFE","FFF","FFG","FFH","FFI","FFJ",
"FFK","FFL","FFM","FFN","FFO","FFP","FFQ","FFR","FFS","FFT","FFU","FFV","FFW","FFX","FFY","FFZ",
"FGA","FGB","FGC","FGD","FGE","FGF","FGG","FGH","FGI","FGJ","FGK","FGL","FGM","FGN","FGO","FGP",
"FGQ","FGR","FGS","FGT","FGU","FGV","FGW","FGX","FGY","FGZ","FHA","FHB","FHC","FHD","FHE","FHF",
"FHG","FHH","FHI","FHJ","FHK","FHL","FHM","FHN","FHO","FHP","FHQ","FHR","FHS","FHT","FHU","FHV",
"FHW","FHX","FHY","FHZ","FIA","FIB","FIC","FID","FIE","FIF","FIG","FIH","FII","FIJ","FIK","FIL",
"FIM","FIN","FIO","FIP","FIQ","FIR","FIS","FIT","FIU","FIV","FIW","FIX","FIY","FIZ","FJA","FJB",
"FJC","FJD","FJE","FJF","FJG","FJH","FJI","FJJ","FJK","FJL","FJM","FJN","FJO","FJP","FJQ","FJR",
"FJS","FJT","FJU","FJV","FJW","FJX","FJY","FJZ","FKA","FKB","FKC","FKD","FKE","FKF","FKG","FKH",
"FKI","FKJ","FKK","FKL","FKM","FKN","FKO","FKP","FKQ","FKR","FKS","FKT","FKU","FKV","FKW","FKX",
"FKY","FKZ","FLA","FLB","FLC","FLD","FLE","FLF","FLG","FLH","FLI","FLJ","FLK","FLL","FLM","FLN",
"FLO","FLP","FLQ","FLR","FLS","FLT","FLU","FLV","FLW","FLX","FLY","FLZ","FMA","FMB","FMC","FMD",
"FME","FMF","FMG","FMH","FMI","FMJ","FMK","FML","FMM","FMN","FMO","FMP","FMQ","FMR","FMS","FMT",
"FMU","FMV","FMW","FMX","FMY","FMZ","FNA","FNB","FNC","FND","FNE","FNF","FNG","FNH","FNI","FNJ",
"FNK","FNL","FNM","FNN","FNO","FNP","FNQ","FNR","FNS","FNT","FNU","FNV","FNW","FNX","FNY","FNZ",
"FOA","FOB","FOC","FOD","FOE","FOF","FOG","FOH","FOI","FOJ","FOK","FOL","FOM","FON","FOO","FOP",
"FOQ","FOR","FOS","FOT","FOU","FOV","FOW","FOX","FOY","FOZ","FPA","FPB","FPC","FPD","FPE","FPF",
"FPG","FPH","FPI","FPJ","FPK","FPL","FPM","FPN","FPO","FPP","FPQ","FPR","FPS","FPT","FPU","FPV",
"FPW","FPX","FPY","FPZ","FQA","FQB","FQC","FQD","FQE","FQF","FQG","FQH","FQI","FQJ","FQK","FQL",
"FQM","FQN","FQO","FQP","FQQ","FQR","FQS","FQT","FQU","FQV","FQW","FQX","FQY","FQZ","FRA","FRB",
"FRC","FRD","FRE","FRF","FRG","FRH","FRI","FRJ","FRK","FRL","FRM","FRN","FRO","FRP","FRQ","FRR",
"FRS","FRT","FRU","FRV","FRW","FRX","FRY","FRZ","FSA","FSB","FSC","FSD","FSE","FSF","FSG","FSH",
"FSI","FSJ","FSK","FSL","FSM","FSN","FSO","FSP","FSQ","FSR","FSS","FST","FSU","FSV","FSW","FSX",
"FSY","FSZ","FTA","FTB","FTC","FTD","FTE","FTF","FTG","FTH","FTI","FTJ","FTK","FTL","FTM","FTN",
"FTO","FTP","FTQ","FTR","FTS","FTT","FTU","FTV","FTW","FTX","FTY","FTZ","FUA","FUB","FUC","FUD",
"FUE","FUF","FUG","FUH","FUI","FUJ","FUK","FUL","FUM","FUN","FUO","FUP","FUQ","FUR","FUS","FUT",
"FUU","FUV","FUW","FUX","FUY","FUZ","FVA","FVB","FVC","FVD","FVE","FVF","FVG","FVH","FVI","FVJ",
"FVK","FVL","FVM","FVN","FVO","FVP","FVQ","FVR","FVS","FVT","FVU","FVV","FVW","FVX","FVY","FVZ",
"FWA","FWB","FWC","FWD","FWE","FWF","FWG","FWH","FWI","FWJ","FWK","FWL","FWM","FWN","FWO","FWP",
"FWQ","FWR","FWS","FWT","FWU","FWV","FWW","FWX","FWY","FWZ","FXA","FXB","FXC","FXD","FXE","FXF",
"FXG","FXH","FXI","FXJ","FXK","FXL","FXM","FXN","FXO","FXP","FXQ","FXR","FXS","FXT","FXU","FXV",
"FXW","FXX","FXY","FXZ","FYA","FYB","FYC","FYD","FYE","FYF","FYG","FYH","FYI","FYJ","FYK","FYL",
"FYM","FYN","FYO","FYP","FYQ","FYR","FYS","FYT","FYU","FYV","FYW","FYX","FYY","FYZ","FZA","FZB",
"FZC","FZD","FZE","FZF","FZG","FZH","FZI","FZJ","FZK","FZL","FZM","FZN","FZO","FZP","FZQ","FZR",
"FZS","FZT","FZU","FZV","FZW","FZX","FZY","FZZ","GAA","GAB","GAC","GAD","GAE","GAF","GAG","GAH",
"GAI","GAJ","GAK","GAL","GAM","GAN","GAO","GAP","GAQ","GAR","GAS","GAT","GAU","GAV","GAW","GAX",
"GAY","GAZ","GBA","GBB","GBC","GBD","GBE","GBF","GBG","GBH","GBI","GBJ","GBK","GBL","GBM","GBN",
"GBO","GBP","GBQ","GBR","GBS","GBT","GBU","GBV","GBW","GBX","GBY","GBZ","GCA","GCB","GCC","GCD",
"GCE","GCF","GCG","GCH","GCI","GCJ","GCK","GCL","GCM","GCN","GCO","GCP","GCQ","GCR","GCS","GCT",
"GCU","GCV","GCW","GCX","GCY","GCZ","GDA","GDB","GDC","GDD","GDE","GDF","GDG","GDH","GDI","GDJ",
"GDK","GDL","GDM","GDN","GDO","GDP","GDQ","GDR","GDS","GDT","GDU","GDV","GDW","GDX","GDY","GDZ",
"GEA","GEB","GEC","GED","GEE","GEF","GEG","GEH","GEI","GEJ","GEK","GEL","GEM","GEN","GEO","GEP",
"GEQ","GER","GES","GET","GEU","GEV","GEW","GEX","GEY","GEZ","GFA","GFB","GFC","GFD","GFE","GFF",
"GFG","GFH","GFI","GFJ","GFK","GFL","GFM","GFN","GFO","GFP","GFQ","GFR","GFS","GFT","GFU","GFV",
"GFW","GFX","GFY","GFZ","GGA","GGB","GGC","GGD","GGE","GGF","GGG","GGH","GGI","GGJ","GGK","GGL",
"GGM","GGN","GGO","GGP","GGQ","GGR","GGS","GGT","GGU","GGV","GGW","GGX","GGY","GGZ","GHA","GHB",
"GHC","GHD","GHE","GHF","GHG","GHH","GHI","GHJ","GHK","GHL","GHM","GHN","GHO","GHP","GHQ","GHR",
"GHS","GHT","GHU","GHV","GHW","GHX","GHY","GHZ","GIA","GIB","GIC","GID","GIE","GIF","GIG","GIH",
"GII","GIJ","GIK","GIL","GIM","GIN","GIO","GIP","GIQ","GIR","GIS","GIT","GIU","GIV","GIW","GIX",
"GIY","GIZ","GJA","GJB","GJC","GJD","GJE","GJF","GJG","GJH","GJI","GJJ","GJK","GJL","GJM","GJN",
"GJO","GJP","GJQ","GJR","GJS","GJT","GJU","GJV","GJW","GJX","GJY","GJZ","GKA","GKB","GKC","GKD",
"GKE","GKF","GKG","GKH","GKI","GKJ","GKK","GKL","GKM","GKN","GKO","GKP","GKQ","GKR","GKS","GKT",
"GKU","GKV","GKW","GKX","GKY","GKZ","GLA","GLB","GLC","GLD","GLE","GLF","GLG","GLH","GLI","GLJ",
"GLK","GLL","GLM","GLN","GLO","GLP","GLQ","GLR","GLS","GLT","GLU","GLV","GLW","GLX","GLY","GLZ",
"GMA","GMB","GMC","GMD","GME","GMF","GMG","GMH","GMI","GMJ","GMK","GML","GMM","GMN","GMO","GMP",
"GMQ","GMR","GMS","GMT","GMU","GMV","GMW","GMX","GMY","GMZ","GNA","GNB","GNC","GND","GNE","GNF",
"GNG","GNH","GNI","GNJ","GNK","GNL","GNM","GNN","GNO","GNP","GNQ","GNR","GNS","GNT","GNU","GNV",
"GNW","GNX","GNY","GNZ","GOA","GOB","GOC","GOD","GOE","GOF","GOG","GOH","GOI","GOJ","GOK","GOL",
"GOM","GON","GOO","GOP","GOQ","GOR","GOS","GOT","GOU","GOV","GOW","GOX","GOY","GOZ","GPA","GPB",
"GPC","GPD","GPE","GPF","GPG","GPH","GPI","GPJ","GPK","GPL","GPM","GPN","GPO","GPP","GPQ","GPR",
"GPS","GPT","GPU","GPV","GPW","GPX","GPY","GPZ","GQA","GQB","GQC","GQD","GQE","GQF","GQG","GQH",
"GQI","GQJ","GQK","GQL","GQM","GQN","GQO","GQP","GQQ","GQR","GQS","GQT","GQU","GQV","GQW","GQX",
"GQY","GQZ","GRA","GRB","GRC","GRD","GRE","GRF","GRG","GRH","GRI","GRJ","GRK","GRL","GRM","GRN",
"GRO","GRP","GRQ","GRR","GRS","GRT","GRU","GRV","GRW","GRX","GRY","GRZ","GSA","GSB","GSC","GSD",
"GSE","GSF","GSG","GSH","GSI","GSJ","GSK","GSL","GSM","GSN","GSO","GSP","GSQ","GSR","GSS","GST",
"GSU","GSV","GSW","GSX","GSY","GSZ","GTA","GTB","GTC","GTD","GTE","GTF","GTG","GTH","GTI","GTJ",
"GTK","GTL","GTM","GTN","GTO","GTP","GTQ","GTR","GTS","GTT","GTU","GTV","GTW","GTX","GTY","GTZ",
"GUA","GUB","GUC","GUD","GUE","GUF","GUG","GUH","GUI","GUJ","GUK","GUL","GUM","GUN","GUO","GUP",
"GUQ","GUR","GUS","GUT","GUU","GUV","GUW","GUX","GUY","GUZ","GVA","GVB","GVC","GVD","GVE","GVF",
"GVG","GVH","GVI","GVJ","GVK","GVL","GVM","GVN","GVO","GVP","GVQ","GVR","GVS","GVT","GVU","GVV",
"GVW","GVX","GVY","GVZ","GWA","GWB","GWC","GWD","GWE","GWF","GWG","GWH","GWI","GWJ","GWK","GWL",
"GWM","GWN","GWO","GWP","GWQ","GWR","GWS","GWT","GWU","GWV","GWW","GWX","GWY","GWZ","GXA","GXB",
"GXC","GXD","GXE","GXF","GXG","GXH","GXI","GXJ","GXK","GXL","GXM","GXN","GXO","GXP","GXQ","GXR",
"GXS","GXT","GXU","GXV","GXW","GXX","GXY","GXZ","GYA","GYB","GYC","GYD","GYE","GYF","GYG","GYH",
"GYI","GYJ","GYK","GYL","GYM","GYN","GYO","GYP","GYQ","GYR","GYS","GYT","GYU","GYV","GYW","GYX",
"GYY","GYZ","GZA","GZB","GZC","GZD","GZE","GZF","GZG","GZH","GZI","GZJ","GZK","GZL","GZM","GZN",
"GZO","GZP","GZQ","GZR","GZS","GZT","GZU","GZV","GZW","GZX","GZY","GZZ","HAA","HAB","HAC","HAD",
"HAE","HAF","HAG","HAH","HAI","HAJ","HAK","HAL","HAM","HAN","HAO","HAP","HAQ","HAR","HAS","HAT",
"HAU","HAV","HAW","HAX","HAY","HAZ","HBA","HBB","HBC","HBD","HBE","HBF","HBG","HBH","HBI","HBJ",
"HBK","HBL","HBM","HBN","HBO","HBP","HBQ","HBR","HBS","HBT","HBU","HBV","HBW","HBX","HBY","HBZ",
"HCA","HCB","HCC","HCD","HCE","HCF","HCG","HCH","HCI","HCJ","HCK","HCL","HCM","HCN","HCO","HCP",
"HCQ","HCR","HCS","HCT","HCU","HCV","HCW","HCX","HCY","HCZ","HDA","HDB","HDC","HDD","HDE","HDF",
"HDG","HDH","HDI","HDJ","HDK","HDL","HDM","HDN","HDO","HDP","HDQ","HDR","HDS","HDT","HDU","HDV",
"HDW","HDX","HDY","HDZ","HEA","HEB","HEC","HED","HEE","HEF","HEG","HEH","HEI","HEJ","HEK","HEL",
"HEM","HEN","HEO","HEP","HEQ","HER","HES","HET","HEU","HEV","HEW","HEX","HEY","HEZ","HFA","HFB",
"HFC","HFD","HFE","HFF","HFG","HFH","HFI","HFJ","HFK","HFL","HFM","HFN","HFO","HFP","HFQ","HFR",
"HFS","HFT","HFU","HFV","HFW","HFX","HFY","HFZ","HGA","HGB","HGC","HGD","HGE","HGF","HGG","HGH",
"HGI","HGJ","HGK","HGL","HGM","HGN","HGO","HGP","HGQ","HGR","HGS","HGT","HGU","HGV","HGW","HGX",
"HGY","HGZ","HHA","HHB","HHC","HHD","HHE","HHF","HHG","HHH","HHI","HHJ","HHK","HHL","HHM","HHN",
"HHO","HHP","HHQ","HHR","HHS","HHT","HHU","HHV","HHW","HHX","HHY","HHZ","HIA","HIB","HIC","HID",
"HIE","HIF","HIG","HIH","HII","HIJ","HIK","HIL","HIM","HIN","HIO","HIP","HIQ","HIR","HIS","HIT",
"HIU","HIV","HIW","HIX","HIY","HIZ","HJA","HJB","HJC","HJD","HJE","HJF","HJG","HJH","HJI","HJJ",
"HJK","HJL","HJM","HJN","HJO","HJP","HJQ","HJR","HJS","HJT","HJU","HJV","HJW","HJX","HJY","HJZ",
"HKA","HKB","HKC","HKD","HKE","HKF","HKG","HKH","HKI","HKJ","HKK","HKL","HKM","HKN","HKO","HKP",
"HKQ","HKR","HKS","HKT","HKU","HKV","HKW","HKX","HKY","HKZ","HLA","HLB","HLC","HLD","HLE","HLF",
"HLG","HLH","HLI","HLJ","HLK","HLL","HLM","HLN","HLO","HLP","HLQ","HLR","HLS","HLT","HLU","HLV",
"HLW","HLX","HLY","HLZ","HMA","HMB","HMC","HMD","HME","HMF","HMG","HMH","HMI","HMJ","HMK","HML",
"HMM","HMN","HMO","HMP","HMQ","HMR","HMS","HMT","HMU","HMV","HMW","HMX","HMY","HMZ","HNA","HNB",
"HNC","HND","HNE","HNF","HNG","HNH","HNI","HNJ","HNK","HNL","HNM","HNN","HNO","HNP","HNQ","HNR",
"HNS","HNT","HNU","HNV","HNW","HNX","HNY","HNZ","HOA","HOB","HOC","HOD","HOE","HOF","HOG","HOH",
"HOI","HOJ","HOK","HOL","HOM","HON","HOO","HOP","HOQ","HOR","HOS","HOT","HOU","HOV","HOW","HOX",
"HOY","HOZ","HPA","HPB","HPC","HPD","HPE","HPF","HPG","HPH","HPI","HPJ","HPK","HPL","HPM","HPN",
"HPO","HPP","HPQ","HPR","HPS","HPT","HPU","HPV","HPW","HPX","HPY","HPZ","HQA","HQB","HQC","HQD",
"HQE","HQF","HQG","HQH","HQI","HQJ","HQK","HQL","HQM","HQN","HQO","HQP","HQQ","HQR","HQS","HQT",
"HQU","HQV","HQW","HQX","HQY","HQZ","HRA","HRB","HRC","HRD","HRE","HRF","HRG","HRH","HRI","HRJ",
"HRK","HRL","HRM","HRN","HRO","HRP","HRQ","HRR","HRS","HRT","HRU","HRV","HRW","HRX","HRY","HRZ",
"HSA","HSB","HSC","HSD","HSE","HSF","HSG","HSH","HSI","HSJ","HSK","HSL","HSM","HSN","HSO","HSP",
"HSQ","HSR","HSS","HST","HSU","HSV","HSW","HSX","HSY","HSZ","HTA","HTB","HTC","HTD","HTE","HTF",
"HTG","HTH","HTI","HTJ","HTK","HTL","HTM","HTN","HTO","HTP","HTQ","HTR","HTS","HTT","HTU","HTV",
"HTW","HTX","HTY","HTZ","HUA","HUB","HUC","HUD","HUE","HUF","HUG","HUH","HUI","HUJ","HUK","HUL",
"HUM","HUN","HUO","HUP","HUQ","HUR","HUS","HUT","HUU","HUV","HUW","HUX","HUY","HUZ","HVA","HVB",
"HVC","HVD","HVE","HVF","HVG","HVH","HVI","HVJ","HVK","HVL","HVM","HVN","HVO","HVP","HVQ","HVR",
"HVS","HVT","HVU","HVV","HVW","HVX","HVY","HVZ","HWA","HWB","HWC","HWD","HWE","HWF","HWG","HWH",
"HWI","HWJ","HWK","HWL","HWM","HWN","HWO","HWP","HWQ","HWR","HWS","HWT","HWU","HWV","HWW","HWX",
"HWY","HWZ","HXA","HXB","HXC","HXD","HXE","HXF","HXG","HXH","HXI","HXJ","HXK","HXL","HXM","HXN",
"HXO","HXP","HXQ","HXR","HXS","HXT","HXU","HXV","HXW","HXX","HXY","HXZ","HYA","HYB","HYC","HYD",
"HYE","HYF","HYG","HYH","HYI","HYJ","HYK","HYL","HYM","HYN","HYO","HYP","HYQ","HYR","HYS","HYT",
"HYU","HYV","HYW","HYX","HYY","HYZ","HZA","HZB","HZC","HZD","HZE","HZF","HZG","HZH","HZI","HZJ",
"HZK","HZL","HZM","HZN","HZO","HZP","HZQ","HZR","HZS","HZT","HZU","HZV","HZW","HZX","HZY","HZZ",
"IAA","IAB","IAC","IAD","IAE","IAF","IAG","IAH","IAI","IAJ","IAK","IAL","IAM","IAN","IAO","IAP",
"IAQ","IAR","IAS","IAT","IAU","IAV","IAW","IAX","IAY","IAZ","IBA","IBB","IBC","IBD","IBE","IBF",
"IBG","IBH","IBI","IBJ","IBK","IBL","IBM","IBN","IBO","IBP","IBQ","IBR","IBS","IBT","IBU","IBV",
"IBW","IBX","IBY","IBZ","ICA","ICB","ICC","ICD","ICE","ICF","ICG","ICH","ICI","ICJ","ICK","ICL",
"ICM","ICN","ICO","ICP","ICQ","ICR","ICS","ICT","ICU","ICV","ICW","ICX","ICY","ICZ","IDA","IDB",
"IDC","IDD","IDE","IDF","IDG","IDH","IDI","IDJ","IDK","IDL","IDM","IDN","IDO","IDP","IDQ","IDR",
"IDS","IDT","IDU","IDV","IDW","IDX","IDY","IDZ","IEA","IEB","IEC","IED","IEE","IEF","IEG","IEH",
"IEI","IEJ","IEK","IEL","IEM","IEN","IEO","IEP","IEQ","IER","IES","IET","IEU","IEV","IEW","IEX",
"IEY","IEZ","IFA","IFB","IFC","IFD","IFE","IFF","IFG","IFH","IFI","IFJ","IFK","IFL","IFM","IFN",
"IFO","IFP","IFQ","IFR","IFS","IFT","IFU","IFV","IFW","IFX","IFY","IFZ","IGA","IGB","IGC","IGD",
"IGE","IGF","IGG","IGH","IGI","IGJ","IGK","IGL","IGM","IGN","IGO","IGP","IGQ","IGR","IGS","IGT",
"IGU","IGV","IGW","IGX","IGY","IGZ","IHA","IHB","IHC","IHD","IHE","IHF","IHG","IHH","IHI","IHJ",
"IHK","IHL","IHM","IHN","IHO","IHP","IHQ","IHR","IHS","IHT","IHU","IHV","IHW","IHX","IHY","IHZ",
"IIA","IIB","IIC","IID","IIE","IIF","IIG","IIH","III","IIJ","IIK","IIL","IIM","IIN","IIO","IIP",
"IIQ","IIR","IIS","IIT","IIU","IIV","IIW","IIX","IIY","IIZ","IJA","IJB","IJC","IJD","IJE","IJF",
"IJG","IJH","IJI","IJJ","IJK","IJL","IJM","IJN","IJO","IJP","IJQ","IJR","IJS","IJT","IJU","IJV",
"IJW","IJX","IJY","IJZ","IKA","IKB","IKC","IKD","IKE","IKF","IKG","IKH","IKI","IKJ","IKK","IKL",
"IKM","IKN","IKO","IKP","IKQ","IKR","IKS","IKT","IKU","IKV","IKW","IKX","IKY","IKZ","ILA","ILB",
"ILC","ILD","ILE","ILF","ILG","ILH","ILI","ILJ","ILK","ILL","ILM","ILN","ILO","ILP","ILQ","ILR",
"ILS","ILT","ILU","ILV","ILW","ILX","ILY","ILZ","IMA","IMB","IMC","IMD","IME","IMF","IMG","IMH",
"IMI","IMJ","IMK","IML","IMM","IMN","IMO","IMP","IMQ","IMR","IMS","IMT","IMU","IMV","IMW","IMX",
"IMY","IMZ","INA","INB","INC","IND","INE","INF","ING","INH","INI","INJ","INK","INL","INM","INN",
"INO","INP","INQ","INR","INS","INT","INU","INV","INW","INX","INY","INZ","IOA","IOB","IOC","IOD",
"IOE","IOF","IOG","IOH","IOI","IOJ","IOK","IOL","IOM","ION","IOO","IOP","IOQ","IOR","IOS","IOT",
"IOU","IOV","IOW","IOX","IOY","IOZ","IPA","IPB","IPC","IPD","IPE","IPF","IPG","IPH","IPI","IPJ",
"IPK","IPL","IPM","IPN","IPO","IPP","IPQ","IPR","IPS","IPT","IPU","IPV","IPW","IPX","IPY","IPZ",
"IQA","IQB","IQC","IQD","IQE","IQF","IQG","IQH","IQI","IQJ","IQK","IQL","IQM","IQN","IQO","IQP",
"IQQ","IQR","IQS","IQT","IQU","IQV","IQW","IQX","IQY","IQZ","IRA","IRB","IRC","IRD","IRE","IRF",
"IRG","IRH","IRI","IRJ","IRK","IRL","IRM","IRN","IRO","IRP","IRQ","IRR","IRS","IRT","IRU","IRV",
"IRW","IRX","IRY","IRZ","ISA","ISB","ISC","ISD","ISE","ISF","ISG","ISH","ISI","ISJ","ISK","ISL",
"ISM","ISN","ISO","ISP","ISQ","ISR","ISS","IST","ISU","ISV","ISW","ISX","ISY","ISZ","ITA","ITB",
"ITC","ITD","ITE","ITF","ITG","ITH","ITI","ITJ","ITK","ITL","ITM","ITN","ITO","ITP","ITQ","ITR",
"ITS","ITT","ITU","ITV","ITW","ITX","ITY","ITZ","IUA","IUB","IUC","IUD","IUE","IUF","IUG","IUH",
"IUI","IUJ","IUK","IUL","IUM","IUN","IUO","IUP","IUQ","IUR","IUS","IUT","IUU","IUV","IUW","IUX",
"IUY","IUZ","IVA","IVB","IVC","IVD","IVE","IVF","IVG","IVH","IVI","IVJ","IVK","IVL","IVM","IVN",
"IVO","IVP","IVQ","IVR","IVS","IVT","IVU","IVV","IVW","IVX","IVY","IVZ","IWA","IWB","IWC","IWD",
"IWE","IWF","IWG","IWH","IWI","IWJ","IWK","IWL","IWM","IWN","IWO","IWP","IWQ","IWR","IWS","IWT",
"IWU","IWV","IWW","IWX","IWY","IWZ","IXA","IXB","IXC","IXD","IXE","IXF","IXG","IXH","IXI","IXJ",
"IXK","IXL","IXM","IXN","IXO","IXP","IXQ","IXR","IXS","IXT","IXU","IXV","IXW","IXX","IXY","IXZ",
"IYA","IYB","IYC","IYD","IYE","IYF","IYG","IYH","IYI","IYJ","IYK","IYL","IYM","IYN","IYO","IYP",
"IYQ","IYR","IYS","IYT","IYU","IYV","IYW","IYX","IYY","IYZ","IZA","IZB","IZC","IZD","IZE","IZF",
"IZG","IZH","IZI","IZJ","IZK","IZL","IZM","IZN","IZO","IZP","IZQ","IZR","IZS","IZT","IZU","IZV",
"IZW","IZX","IZY","IZZ","JAA","JAB","JAC","JAD","JAE","JAF","JAG","JAH","JAI","JAJ","JAK","JAL",
"JAM","JAN","JAO","JAP","JAQ","JAR","JAS","JAT","JAU","JAV","JAW","JAX","JAY","JAZ","JBA","JBB",
"JBC","JBD","JBE","JBF","JBG","JBH","JBI","JBJ","JBK","JBL","JBM","JBN","JBO","JBP","JBQ","JBR",
"JBS","JBT","JBU","JBV","JBW","JBX","JBY","JBZ","JCA","JCB","JCC","JCD","JCE","JCF","JCG","JCH",
"JCI","JCJ","JCK","JCL","JCM","JCN","JCO","JCP","JCQ","JCR","JCS","JCT","JCU","JCV","JCW","JCX",
"JCY","JCZ","JDA","JDB","JDC","JDD","JDE","JDF","JDG","JDH","JDI","JDJ","JDK","JDL","JDM","JDN",
"JDO","JDP","JDQ","JDR","JDS","JDT","JDU","JDV","JDW","JDX","JDY","JDZ","JEA","JEB","JEC","JED",
"JEE","JEF","JEG","JEH","JEI","JEJ","JEK","JEL","JEM","JEN","JEO","JEP","JEQ","JER","JES","JET",
"JEU","JEV","JEW","JEX","JEY","JEZ","JFA","JFB","JFC","JFD","JFE","JFF","JFG","JFH","JFI","JFJ",
"JFK","JFL","JFM","JFN","JFO","JFP","JFQ","JFR","JFS","JFT","JFU","JFV","JFW","JFX","JFY","JFZ",
"JGA","JGB","JGC","JGD","JGE","JGF","JGG","JGH","JGI","JGJ","JGK","JGL","JGM","JGN","JGO","JGP",
"JGQ","JGR","JGS","JGT","JGU","JGV","JGW","JGX","JGY","JGZ","JHA","JHB","JHC","JHD","JHE","JHF",
"JHG","JHH","JHI","JHJ","JHK","JHL","JHM","JHN","JHO","JHP","JHQ","JHR","JHS","JHT","JHU","JHV",
"JHW","JHX","JHY","JHZ","JIA","JIB","JIC","JID","JIE","JIF","JIG","JIH","JII","JIJ","JIK","JIL",
"JIM","JIN","JIO","JIP","JIQ","JIR","JIS","JIT","JIU","JIV","JIW","JIX","JIY","JIZ","JJA","JJB",
"JJC","JJD","JJE","JJF","JJG","JJH","JJI","JJJ","JJK","JJL","JJM","JJN","JJO","JJP","JJQ","JJR",
"JJS","JJT","JJU","JJV","JJW","JJX","JJY","JJZ","JKA","JKB","JKC","JKD","JKE","JKF","JKG","JKH",
"JKI","JKJ","JKK","JKL","JKM","JKN","JKO","JKP","JKQ","JKR","JKS","JKT","JKU","JKV","JKW","JKX",
"JKY","JKZ","JLA","JLB","JLC","JLD","JLE","JLF","JLG","JLH","JLI","JLJ","JLK","JLL","JLM","JLN",
"JLO","JLP","JLQ","JLR","JLS","JLT","JLU","JLV","JLW","JLX","JLY","JLZ","JMA","JMB","JMC","JMD",
"JME","JMF","JMG","JMH","JMI","JMJ","JMK","JML","JMM","JMN","JMO","JMP","JMQ","JMR","JMS","JMT",
"JMU","JMV","JMW","JMX","JMY","JMZ","JNA","JNB","JNC","JND","JNE","JNF","JNG","JNH","JNI","JNJ",
"JNK","JNL","JNM","JNN","JNO","JNP","JNQ","JNR","JNS","JNT","JNU","JNV","JNW","JNX","JNY","JNZ",
"JOA","JOB","JOC","JOD","JOE","JOF","JOG","JOH","JOI","JOJ","JOK","JOL","JOM","JON","JOO","JOP",
"JOQ","JOR","JOS","JOT","JOU","JOV","JOW","JOX","JOY","JOZ","JPA","JPB","JPC","JPD","JPE","JPF",
"JPG","JPH","JPI","JPJ","JPK","JPL","JPM","JPN","JPO","JPP","JPQ","JPR","JPS","JPT","JPU","JPV",
"JPW","JPX","JPY","JPZ","JQA","JQB","JQC","JQD","JQE","JQF","JQG","JQH","JQI","JQJ","JQK","JQL",
"JQM","JQN","JQO","JQP","JQQ","JQR","JQS","JQT","JQU","JQV","JQW","JQX","JQY","JQZ","JRA","JRB",
"JRC","JRD","JRE","JRF","JRG","JRH","JRI","JRJ","JRK","JRL","JRM","JRN","JRO","JRP","JRQ","JRR",
"JRS","JRT","JRU","JRV","JRW","JRX","JRY","JRZ","JSA","JSB","JSC","JSD","JSE","JSF","JSG","JSH",
"JSI","JSJ","JSK","JSL","JSM","JSN","JSO","JSP","JSQ","JSR","JSS","JST","JSU","JSV","JSW","JSX",
"JSY","JSZ","JTA","JTB","JTC","JTD","JTE","JTF","JTG","JTH","JTI","JTJ","JTK","JTL","JTM","JTN",
"JTO","JTP","JTQ","JTR","JTS","JTT","JTU","JTV","JTW","JTX","JTY","JTZ","JUA","JUB","JUC","JUD",
"JUE","JUF","JUG","JUH","JUI","JUJ","JUK","JUL","JUM","JUN","JUO","JUP","JUQ","JUR","JUS","JUT",
"JUU","JUV","JUW","JUX","JUY","JUZ","JVA","JVB","JVC","JVD","JVE","JVF","JVG","JVH","JVI","JVJ",
"JVK","JVL","JVM","JVN","JVO","JVP","JVQ","JVR","JVS","JVT","JVU","JVV","JVW","JVX","JVY","JVZ",
"JWA","JWB","JWC","JWD","JWE","JWF","JWG","JWH","JWI","JWJ","JWK","JWL","JWM","JWN","JWO","JWP",
"JWQ","JWR","JWS","JWT","JWU","JWV","JWW","JWX","JWY","JWZ","JXA","JXB","JXC","JXD","JXE","JXF",
"JXG","JXH","JXI","JXJ","JXK","JXL","JXM","JXN","JXO","JXP","JXQ","JXR","JXS","JXT","JXU","JXV",
"JXW","JXX","JXY","JXZ","JYA","JYB","JYC","JYD","JYE","JYF","JYG","JYH","JYI","JYJ","JYK","JYL",
"JYM","JYN","JYO","JYP","JYQ","JYR","JYS","JYT","JYU","JYV","JYW","JYX","JYY","JYZ","JZA","JZB",
"JZC","JZD","JZE","JZF","JZG","JZH","JZI","JZJ","JZK","JZL","JZM","JZN","JZO","JZP","JZQ","JZR",
"JZS","JZT","JZU","JZV","JZW","JZX","JZY","JZZ","KAA","KAB","KAC","KAD","KAE","KAF","KAG","KAH",
"KAI","KAJ","KAK","KAL","KAM","KAN","KAO","KAP","KAQ","KAR","KAS","KAT","KAU","KAV","KAW","KAX",
"KAY","KAZ","KBA","KBB","KBC","KBD","KBE","KBF","KBG","KBH","KBI","KBJ","KBK","KBL","KBM","KBN",
"KBO","KBP","KBQ","KBR","KBS","KBT","KBU","KBV","KBW","KBX","KBY","KBZ","KCA","KCB","KCC","KCD",
"KCE","KCF","KCG","KCH","KCI","KCJ","KCK","KCL","KCM","KCN","KCO","KCP","KCQ","KCR","KCS","KCT",
"KCU","KCV","KCW","KCX","KCY","KCZ","KDA","KDB","KDC","KDD","KDE","KDF","KDG","KDH","KDI","KDJ",
"KDK","KDL","KDM","KDN","KDO","KDP","KDQ","KDR","KDS","KDT","KDU","KDV","KDW","KDX","KDY","KDZ",
"KEA","KEB","KEC","KED","KEE","KEF","KEG","KEH","KEI","KEJ","KEK","KEL","KEM","KEN","KEO","KEP",
"KEQ","KER","KES","KET","KEU","KEV","KEW","KEX","KEY","KEZ","KFA","KFB","KFC","KFD","KFE","KFF",
"KFG","KFH","KFI","KFJ","KFK","KFL","KFM","KFN","KFO","KFP","KFQ","KFR","KFS","KFT","KFU","KFV",
"KFW","KFX","KFY","KFZ","KGA","KGB","KGC","KGD","KGE","KGF","KGG","KGH","KGI","KGJ","KGK","KGL",
"KGM","KGN","KGO","KGP","KGQ","KGR","KGS","KGT","KGU","KGV","KGW","KGX","KGY","KGZ","KHA","KHB",
"KHC","KHD","KHE","KHF","KHG","KHH","KHI","KHJ","KHK","KHL","KHM","KHN","KHO","KHP","KHQ","KHR",
"KHS","KHT","KHU","KHV","KHW","KHX","KHY","KHZ","KIA","KIB","KIC","KID","KIE","KIF","KIG","KIH",
"KII","KIJ","KIK","KIL","KIM","KIN","KIO","KIP","KIQ","KIR","KIS","KIT","KIU","KIV","KIW","KIX",
"KIY","KIZ","KJA","KJB","KJC","KJD","KJE","KJF","KJG","KJH","KJI","KJJ","KJK","KJL","KJM","KJN",
"KJO","KJP","KJQ","KJR","KJS","KJT","KJU","KJV","KJW","KJX","KJY","KJZ","KKA","KKB","KKC","KKD",
"KKE","KKF","KKG","KKH","KKI","KKJ","KKK","KKL","KKM","KKN","KKO","KKP","KKQ","KKR","KKS","KKT",
"KKU","KKV","KKW","KKX","KKY","KKZ","KLA","KLB","KLC","KLD","KLE","KLF","KLG","KLH","KLI","KLJ",
"KLK","KLL","KLM","KLN","KLO","KLP","KLQ","KLR","KLS","KLT","KLU","KLV","KLW","KLX","KLY","KLZ",
"KMA","KMB","KMC","KMD","KME","KMF","KMG","KMH","KMI","KMJ","KMK","KML","KMM","KMN","KMO","KMP",
"KMQ","KMR","KMS","KMT","KMU","KMV","KMW","KMX","KMY","KMZ","KNA","KNB","KNC","KND","KNE","KNF",
"KNG","KNH","KNI","KNJ","KNK","KNL","KNM","KNN","KNO","KNP","KNQ","KNR","KNS","KNT","KNU","KNV",
"KNW","KNX","KNY","KNZ","KOA","KOB","KOC","KOD","KOE","KOF","KOG","KOH","KOI","KOJ","KOK","KOL",
"KOM","KON","KOO","KOP","KOQ","KOR","KOS","KOT","KOU","KOV","KOW","KOX","KOY","KOZ","KPA","KPB",
"KPC","KPD","KPE","KPF","KPG","KPH","KPI","KPJ","KPK","KPL","KPM","KPN","KPO","KPP","KPQ","KPR",
"KPS","KPT","KPU","KPV","KPW","KPX","KPY","KPZ","KQA","KQB","KQC","KQD","KQE","KQF","KQG","KQH",
"KQI","KQJ","KQK","KQL","KQM","KQN","KQO","KQP","KQQ","KQR","KQS","KQT","KQU","KQV","KQW","KQX",
"KQY","KQZ","KRA","KRB","KRC","KRD","KRE","KRF","KRG","KRH","KRI","KRJ","KRK","KRL","KRM","KRN",
"KRO","KRP","KRQ","KRR","KRS","KRT","KRU","KRV","KRW","KRX","KRY","KRZ","KSA","KSB","KSC","KSD",
"KSE","KSF","KSG","KSH","KSI","KSJ","KSK","KSL","KSM","KSN","KSO","KSP","KSQ","KSR","KSS","KST",
"KSU","KSV","KSW","KSX","KSY","KSZ","KTA","KTB","KTC","KTD","KTE","KTF","KTG","KTH","KTI","KTJ",
"KTK","KTL","KTM","KTN","KTO","KTP","KTQ","KTR","KTS","KTT","KTU","KTV","KTW","KTX","KTY","KTZ",
"KUA","KUB","KUC","KUD","KUE","KUF","KUG","KUH","KUI","KUJ","KUK","KUL","KUM","KUN","KUO","KUP",
"KUQ","KUR","KUS","KUT","KUU","KUV","KUW","KUX","KUY","KUZ","KVA","KVB","KVC","KVD","KVE","KVF",
"KVG","KVH","KVI","KVJ","KVK","KVL","KVM","KVN","KVO","KVP","KVQ","KVR","KVS","KVT","KVU","KVV",
"KVW","KVX","KVY","KVZ","KWA","KWB","KWC","KWD","KWE","KWF","KWG","KWH","KWI","KWJ","KWK","KWL",
"KWM","KWN","KWO","KWP","KWQ","KWR","KWS","KWT","KWU","KWV","KWW","KWX","KWY","KWZ","KXA","KXB",
"KXC","KXD","KXE","KXF","KXG","KXH","KXI","KXJ","KXK","KXL","KXM","KXN","KXO","KXP","KXQ","KXR",
"KXS","KXT","KXU","KXV","KXW","KXX","KXY","KXZ","KYA","KYB","KYC","KYD","KYE","KYF","KYG","KYH",
"KYI","KYJ","KYK","KYL","KYM","KYN","KYO","KYP","KYQ","KYR","KYS","KYT","KYU","KYV","KYW","KYX",
"KYY","KYZ","KZA","KZB","KZC","KZD","KZE","KZF","KZG","KZH","KZI","KZJ","KZK","KZL","KZM","KZN",
"KZO","KZP","KZQ","KZR","KZS","KZT","KZU","KZV","KZW","KZX","KZY","KZZ","LAA","LAB","LAC","LAD",
"LAE","LAF","LAG","LAH","LAI","LAJ","LAK","LAL","LAM","LAN","LAO","LAP","LAQ","LAR","LAS","LAT",
"LAU","LAV","LAW","LAX","LAY","LAZ","LBA","LBB","LBC","LBD","LBE","LBF","LBG","LBH","LBI","LBJ",
"LBK","LBL","LBM","LBN","LBO","LBP","LBQ","LBR","LBS","LBT","LBU","LBV","LBW","LBX","LBY","LBZ",
"LCA","LCB","LCC","LCD","LCE","LCF","LCG","LCH","LCI","LCJ","LCK","LCL","LCM","LCN","LCO","LCP",
"LCQ","LCR","LCS","LCT","LCU","LCV","LCW","LCX","LCY","LCZ","LDA","LDB","LDC","LDD","LDE","LDF",
"LDG","LDH","LDI","LDJ","LDK","LDL","LDM","LDN","LDO","LDP","LDQ","LDR","LDS","LDT","LDU","LDV",
"LDW","LDX","LDY","LDZ","LEA","LEB","LEC","LED","LEE","LEF","LEG","LEH","LEI","LEJ","LEK","LEL",
"LEM","LEN","LEO","LEP","LEQ","LER","LES","LET","LEU","LEV","LEW","LEX","LEY","LEZ","LFA","LFB",
"LFC","LFD","LFE","LFF","LFG","LFH","LFI","LFJ","LFK","LFL","LFM","LFN","LFO","LFP","LFQ","LFR",
"LFS","LFT","LFU","LFV","LFW","LFX","LFY","LFZ","LGA","LGB","LGC","LGD","LGE","LGF","LGG","LGH",
"LGI","LGJ","LGK","LGL","LGM","LGN","LGO","LGP","LGQ","LGR","LGS","LGT","LGU","LGV","LGW","LGX",
"LGY","LGZ","LHA","LHB","LHC","LHD","LHE","LHF","LHG","LHH","LHI","LHJ","LHK","LHL","LHM","LHN",
"LHO","LHP","LHQ","LHR","LHS","LHT","LHU","LHV","LHW","LHX","LHY","LHZ","LIA","LIB","LIC","LID",
"LIE","LIF","LIG","LIH","LII","LIJ","LIK","LIL","LIM","LIN","LIO","LIP","LIQ","LIR","LIS","LIT",
"LIU","LIV","LIW","LIX","LIY","LIZ","LJA","LJB","LJC","LJD","LJE","LJF","LJG","LJH","LJI","LJJ",
"LJK","LJL","LJM","LJN","LJO","LJP","LJQ","LJR","LJS","LJT","LJU","LJV","LJW","LJX","LJY","LJZ",
"LKA","LKB","LKC","LKD","LKE","LKF","LKG","LKH","LKI","LKJ","LKK","LKL","LKM","LKN","LKO","LKP",
"LKQ","LKR","LKS","LKT","LKU","LKV","LKW","LKX","LKY","LKZ","LLA","LLB","LLC","LLD","LLE","LLF",
"LLG","LLH","LLI","LLJ","LLK","LLL","LLM","LLN","LLO","LLP","LLQ","LLR","LLS","LLT","LLU","LLV",
"LLW","LLX","LLY","LLZ","LMA","LMB","LMC","LMD","LME","LMF","LMG","LMH","LMI","LMJ","LMK","LML",
"LMM","LMN","LMO","LMP","LMQ","LMR","LMS","LMT","LMU","LMV","LMW","LMX","LMY","LMZ","LNA","LNB",
"LNC","LND","LNE","LNF","LNG","LNH","LNI","LNJ","LNK","LNL","LNM","LNN","LNO","LNP","LNQ","LNR",
"LNS","LNT","LNU","LNV","LNW","LNX","LNY","LNZ","LOA","LOB","LOC","LOD","LOE","LOF","LOG","LOH",
"LOI","LOJ","LOK","LOL","LOM","LON","LOO","LOP","LOQ","LOR","LOS","LOT","LOU","LOV","LOW","LOX",
"LOY","LOZ","LPA","LPB","LPC","LPD","LPE","LPF","LPG","LPH","LPI","LPJ","LPK","LPL","LPM","LPN",
"LPO","LPP","LPQ","LPR","LPS","LPT","LPU","LPV","LPW","LPX","LPY","LPZ","LQA","LQB","LQC","LQD",
"LQE","LQF","LQG","LQH","LQI","LQJ","LQK","LQL","LQM","LQN","LQO","LQP","LQQ","LQR","LQS","LQT",
"LQU","LQV","LQW","LQX","LQY","LQZ","LRA","LRB","LRC","LRD","LRE","LRF","LRG","LRH","LRI","LRJ",
"LRK","LRL","LRM","LRN","LRO","LRP","LRQ","LRR","LRS","LRT","LRU","LRV","LRW","LRX","LRY","LRZ",
"LSA","LSB","LSC","LSD","LSE","LSF","LSG","LSH","LSI","LSJ","LSK","LSL","LSM","LSN","LSO","LSP",
"LSQ","LSR","LSS","LST","LSU","LSV","LSW","LSX","LSY","LSZ","LTA","LTB","LTC","LTD","LTE","LTF",
"LTG","LTH","LTI","LTJ","LTK","LTL","LTM","LTN","LTO","LTP","LTQ","LTR","LTS","LTT","LTU","LTV",
"LTW","LTX","LTY","LTZ","LUA","LUB","LUC","LUD","LUE","LUF","LUG","LUH","LUI","LUJ","LUK","LUL",
"LUM","LUN","LUO","LUP","LUQ","LUR","LUS","LUT","LUU","LUV","LUW","LUX","LUY","LUZ","LVA","LVB",
"LVC","LVD","LVE","LVF","LVG","LVH","LVI","LVJ","LVK","LVL","LVM","LVN","LVO","LVP","LVQ","LVR",
"LVS","LVT","LVU","LVV","LVW","LVX","LVY","LVZ","LWA","LWB","LWC","LWD","LWE","LWF","LWG","LWH",
"LWI","LWJ","LWK","LWL","LWM","LWN","LWO","LWP","LWQ","LWR","LWS","LWT","LWU","LWV","LWW","LWX",
"LWY","LWZ","LXA","LXB","LXC","LXD","LXE","LXF","LXG","LXH","LXI","LXJ","LXK","LXL","LXM","LXN",
"LXO","LXP","LXQ","LXR","LXS","LXT","LXU","LXV","LXW","LXX","LXY","LXZ","LYA","LYB","LYC","LYD",
"LYE","LYF","LYG","LYH","LYI","LYJ","LYK","LYL","LYM","LYN","LYO","LYP","LYQ","LYR","LYS","LYT",
"LYU","LYV","LYW","LYX","LYY","LYZ","LZA","LZB","LZC","LZD","LZE","LZF","LZG","LZH","LZI","LZJ",
"LZK","LZL","LZM","LZN","LZO","LZP","LZQ","LZR","LZS","LZT","LZU","LZV","LZW","LZX","LZY","LZZ",
"MAA","MAB","MAC","MAD","MAE","MAF","MAG","MAH","MAI","MAJ","MAK","MAL","MAM","MAN","MAO","MAP",
"MAQ","MAR","MAS","MAT","MAU","MAV","MAW","MAX","MAY","MAZ","MBA","MBB","MBC","MBD","MBE","MBF",
"MBG","MBH","MBI","MBJ","MBK","MBL","MBM","MBN","MBO","MBP","MBQ","MBR","MBS","MBT","MBU","MBV",
"MBW","MBX","MBY","MBZ","MCA","MCB","MCC","MCD","MCE","MCF","MCG","MCH","MCI","MCJ","MCK","MCL",
"MCM","MCN","MCO","MCP","MCQ","MCR","MCS","MCT","MCU","MCV","MCW","MCX","MCY","MCZ","MDA","MDB",
"MDC","MDD","MDE","MDF","MDG","MDH","MDI","MDJ","MDK","MDL","MDM","MDN","MDO","MDP","MDQ","MDR",
"MDS","MDT","MDU","MDV","MDW","MDX","MDY","MDZ","MEA","MEB","MEC","MED","MEE","MEF","MEG","MEH",
"MEI","MEJ","MEK","MEL","MEM","MEN","MEO","MEP","MEQ","MER","MES","MET","MEU","MEV","MEW","MEX",
"MEY","MEZ","MFA","MFB","MFC","MFD","MFE","MFF","MFG","MFH","MFI","MFJ","MFK","MFL","MFM","MFN",
"MFO","MFP","MFQ","MFR","MFS","MFT","MFU","MFV","MFW","MFX","MFY","MFZ","MGA","MGB","MGC","MGD",
"MGE","MGF","MGG","MGH","MGI","MGJ","MGK","MGL","MGM","MGN","MGO","MGP","MGQ","MGR","MGS","MGT",
"MGU","MGV","MGW","MGX","MGY","MGZ","MHA","MHB","MHC","MHD","MHE","MHF","MHG","MHH","MHI","MHJ",
"MHK","MHL","MHM","MHN","MHO","MHP","MHQ","MHR","MHS","MHT","MHU","MHV","MHW","MHX","MHY","MHZ",
"MIA","MIB","MIC","MID","MIE","MIF","MIG","MIH","MII","MIJ","MIK","MIL","MIM","MIN","MIO","MIP",
"MIQ","MIR","MIS","MIT","MIU","MIV","MIW","MIX","MIY","MIZ","MJA","MJB","MJC","MJD","MJE","MJF",
"MJG","MJH","MJI","MJJ","MJK","MJL","MJM","MJN","MJO","MJP","MJQ","MJR","MJS","MJT","MJU","MJV",
"MJW","MJX","MJY","MJZ","MKA","MKB","MKC","MKD","MKE","MKF","MKG","MKH","MKI","MKJ","MKK","MKL",
"MKM","MKN","MKO","MKP","MKQ","MKR","MKS","MKT","MKU","MKV","MKW","MKX","MKY","MKZ","MLA","MLB",
"MLC","MLD","MLE","MLF","MLG","MLH","MLI","MLJ","MLK","MLL","MLM","MLN","MLO","MLP","MLQ","MLR",
"MLS","MLT","MLU","MLV","MLW","MLX","MLY","MLZ","MMA","MMB","MMC","MMD","MME","MMF","MMG","MMH",
"MMI","MMJ","MMK","MML","MMM","MMN","MMO","MMP","MMQ","MMR","MMS","MMT","MMU","MMV","MMW","MMX",
"MMY","MMZ","MNA","MNB","MNC","MND","MNE","MNF","MNG","MNH","MNI","MNJ","MNK","MNL","MNM","MNN",
"MNO","MNP","MNQ","MNR","MNS","MNT","MNU","MNV","MNW","MNX","MNY","MNZ","MOA","MOB","MOC","MOD",
"MOE","MOF","MOG","MOH","MOI","MOJ","MOK","MOL","MOM","MON","MOO","MOP","MOQ","MOR","MOS","MOT",
"MOU","MOV","MOW","MOX","MOY","MOZ","MPA","MPB","MPC","MPD","MPE","MPF","MPG","MPH","MPI","MPJ",
"MPK","MPL","MPM","MPN","MPO","MPP","MPQ","MPR","MPS","MPT","MPU","MPV","MPW","MPX","MPY","MPZ",
"MQA","MQB","MQC","MQD","MQE","MQF","MQG","MQH","MQI","MQJ","MQK","MQL","MQM","MQN","MQO","MQP",
"MQQ","MQR","MQS","MQT","MQU","MQV","MQW","MQX","MQY","MQZ","MRA","MRB","MRC","MRD","MRE","MRF",
"MRG","MRH","MRI","MRJ","MRK","MRL","MRM","MRN","MRO","MRP","MRQ","MRR","MRS","MRT","MRU","MRV",
"MRW","MRX","MRY","MRZ","MSA","MSB","MSC","MSD","MSE","MSF","MSG","MSH","MSI","MSJ","MSK","MSL",
"MSM","MSN","MSO","MSP","MSQ","MSR","MSS","MST","MSU","MSV","MSW","MSX","MSY","MSZ","MTA","MTB",
"MTC","MTD","MTE","MTF","MTG","MTH","MTI","MTJ","MTK","MTL","MTM","MTN","MTO","MTP","MTQ","MTR",
"MTS","MTT","MTU","MTV","MTW","MTX","MTY","MTZ","MUA","MUB","MUC","MUD","MUE","MUF","MUG","MUH",
"MUI","MUJ","MUK","MUL","MUM","MUN","MUO","MUP","MUQ","MUR","MUS","MUT","MUU","MUV","MUW","MUX",
"MUY","MUZ","MVA","MVB","MVC","MVD","MVE","MVF","MVG","MVH","MVI","MVJ","MVK","MVL","MVM","MVN",
"MVO","MVP","MVQ","MVR","MVS","MVT","MVU","MVV","MVW","MVX","MVY","MVZ","MWA","MWB","MWC","MWD",
"MWE","MWF","MWG","MWH","MWI","MWJ","MWK","MWL","MWM","MWN","MWO","MWP","MWQ","MWR","MWS","MWT",
"MWU","MWV","MWW","MWX","MWY","MWZ","MXA","MXB","MXC","MXD","MXE","MXF","MXG","MXH","MXI","MXJ",
"MXK","MXL","MXM","MXN","MXO","MXP","MXQ","MXR","MXS","MXT","MXU","MXV","MXW","MXX","MXY","MXZ",
"MYA","MYB","MYC","MYD","MYE","MYF","MYG","MYH","MYI","MYJ","MYK","MYL","MYM","MYN","MYO","MYP",
"MYQ","MYR","MYS","MYT","MYU","MYV","MYW","MYX","MYY","MYZ","MZA","MZB","MZC","MZD","MZE","MZF",
"MZG","MZH","MZI","MZJ","MZK","MZL","MZM","MZN","MZO","MZP","MZQ","MZR","MZS","MZT","MZU","MZV",
"MZW","MZX","MZY","MZZ","NAA","NAB","NAC","NAD","NAE","NAF","NAG","NAH","NAI","NAJ","NAK","NAL",
"NAM","NAN","NAO","NAP","NAQ","NAR","NAS","NAT","NAU","NAV","NAW","NAX","NAY","NAZ","NBA","NBB",
"NBC","NBD","NBE","NBF","NBG","NBH","NBI","NBJ","NBK","NBL","NBM","NBN","NBO","NBP","NBQ","NBR",
"NBS","NBT","NBU","NBV","NBW","NBX","NBY","NBZ","NCA","NCB","NCC","NCD","NCE","NCF","NCG","NCH",
"NCI","NCJ","NCK","NCL","NCM","NCN","NCO","NCP","NCQ","NCR","NCS","NCT","NCU","NCV","NCW","NCX",
"NCY","NCZ","NDA","NDB","NDC","NDD","NDE","NDF","NDG","NDH","NDI","NDJ","NDK","NDL","NDM","NDN",
"NDO","NDP","NDQ","NDR","NDS","NDT","NDU","NDV","NDW","NDX","NDY","NDZ","NEA","NEB","NEC","NED",
"NEE","NEF","NEG","NEH","NEI","NEJ","NEK","NEL","NEM","NEN","NEO","NEP","NEQ","NER","NES","NET",
"NEU","NEV","NEW","NEX","NEY","NEZ","NFA","NFB","NFC","NFD","NFE","NFF","NFG","NFH","NFI","NFJ",
"NFK","NFL","NFM","NFN","NFO","NFP","NFQ","NFR","NFS","NFT","NFU","NFV","NFW","NFX","NFY","NFZ",
"NGA","NGB","NGC","NGD","NGE","NGF","NGG","NGH","NGI","NGJ","NGK","NGL","NGM","NGN","NGO","NGP",
"NGQ","NGR","NGS","NGT","NGU","NGV","NGW","NGX","NGY","NGZ","NHA","NHB","NHC","NHD","NHE","NHF",
"NHG","NHH","NHI","NHJ","NHK","NHL","NHM","NHN","NHO","NHP","NHQ","NHR","NHS","NHT","NHU","NHV",
"NHW","NHX","NHY","NHZ","NIA","NIB","NIC","NID","NIE","NIF","NIG","NIH","NII","NIJ","NIK","NIL",
"NIM","NIN","NIO","NIP","NIQ","NIR","NIS","NIT","NIU","NIV","NIW","NIX","NIY","NIZ","NJA","NJB",
"NJC","NJD","NJE","NJF","NJG","NJH","NJI","NJJ","NJK","NJL","NJM","NJN","NJO","NJP","NJQ","NJR",
"NJS","NJT","NJU","NJV","NJW","NJX","NJY","NJZ","NKA","NKB","NKC","NKD","NKE","NKF","NKG","NKH",
"NKI","NKJ","NKK","NKL","NKM","NKN","NKO","NKP","NKQ","NKR","NKS","NKT","NKU","NKV","NKW","NKX",
"NKY","NKZ","NLA","NLB","NLC","NLD","NLE","NLF","NLG","NLH","NLI","NLJ","NLK","NLL","NLM","NLN",
"NLO","NLP","NLQ","NLR","NLS","NLT","NLU","NLV","NLW","NLX","NLY","NLZ","NMA","NMB","NMC","NMD",
"NME","NMF","NMG","NMH","NMI","NMJ","NMK","NML","NMM","NMN","NMO","NMP","NMQ","NMR","NMS","NMT",
"NMU","NMV","NMW","NMX","NMY","NMZ","NNA","NNB","NNC","NND","NNE","NNF","NNG","NNH","NNI","NNJ",
"NNK","NNL","NNM","NNN","NNO","NNP","NNQ","NNR","NNS","NNT","NNU","NNV","NNW","NNX","NNY","NNZ",
"NOA","NOB","NOC","NOD","NOE","NOF","NOG","NOH","NOI","NOJ","NOK","NOL","NOM","NON","NOO","NOP",
"NOQ","NOR","NOS","NOT","NOU","NOV","NOW","NOX","NOY","NOZ","NPA","NPB","NPC","NPD","NPE","NPF",
"NPG","NPH","NPI","NPJ","NPK","NPL","NPM","NPN","NPO","NPP","NPQ","NPR","NPS","NPT","NPU","NPV",
"NPW","NPX","NPY","NPZ","NQA","NQB","NQC","NQD","NQE","NQF","NQG","NQH","NQI","NQJ","NQK","NQL",
"NQM","NQN","NQO","NQP","NQQ","NQR","NQS","NQT","NQU","NQV","NQW","NQX","NQY","NQZ","NRA","NRB",
"NRC","NRD","NRE","NRF","NRG","NRH","NRI","NRJ","NRK","NRL","NRM","NRN","NRO","NRP","NRQ","NRR",
"NRS","NRT","NRU","NRV","NRW","NRX","NRY","NRZ","NSA","NSB","NSC","NSD","NSE","NSF","NSG","NSH",
"NSI","NSJ","NSK","NSL","NSM","NSN","NSO","NSP","NSQ","NSR","NSS","NST","NSU","NSV","NSW","NSX",
"NSY","NSZ","NTA","NTB","NTC","NTD","NTE","NTF","NTG","NTH","NTI","NTJ","NTK","NTL","NTM","NTN",
"NTO","NTP","NTQ","NTR","NTS","NTT","NTU","NTV","NTW","NTX","NTY","NTZ","NUA","NUB","NUC","NUD",
"NUE","NUF","NUG","NUH","NUI","NUJ","NUK","NUL","NUM","NUN","NUO","NUP","NUQ","NUR","NUS","NUT",
"NUU","NUV","NUW","NUX","NUY","NUZ","NVA","NVB","NVC","NVD","NVE","NVF","NVG","NVH","NVI","NVJ",
"NVK","NVL","NVM","NVN","NVO","NVP","NVQ","NVR","NVS","NVT","NVU","NVV","NVW","NVX","NVY","NVZ",
"NWA","NWB","NWC","NWD","NWE","NWF","NWG","NWH","NWI","NWJ","NWK","NWL","NWM","NWN","NWO","NWP",
"NWQ","NWR","NWS","NWT","NWU","NWV","NWW","NWX","NWY","NWZ","NXA","NXB","NXC","NXD","NXE","NXF",
"NXG","NXH","NXI","NXJ","NXK","NXL","NXM","NXN","NXO","NXP","NXQ","NXR","NXS","NXT","NXU","NXV",
"NXW","NXX","NXY","NXZ","NYA","NYB","NYC","NYD","NYE","NYF","NYG","NYH","NYI","NYJ","NYK","NYL",
"NYM","NYN","NYO","NYP","NYQ","NYR","NYS","NYT","NYU","NYV","NYW","NYX","NYY","NYZ","NZA","NZB",
"NZC","NZD","NZE","NZF","NZG","NZH","NZI","NZJ","NZK","NZL","NZM","NZN","NZO","NZP","NZQ","NZR",
"NZS","NZT","NZU","NZV","NZW","NZX","NZY","NZZ","OAA","OAB","OAC","OAD","OAE","OAF","OAG","OAH",
"OAI","OAJ","OAK","OAL","OAM","OAN","OAO","OAP","OAQ","OAR","OAS","OAT","OAU","OAV","OAW","OAX",
"OAY","OAZ","OBA","OBB","OBC","OBD","OBE","OBF","OBG","OBH","OBI","OBJ","OBK","OBL","OBM","OBN",
"OBO","OBP","OBQ","OBR","OBS","OBT","OBU","OBV","OBW","OBX","OBY","OBZ","OCA","OCB","OCC","OCD",
"OCE","OCF","OCG","OCH","OCI","OCJ","OCK","OCL","OCM","OCN","OCO","OCP","OCQ","OCR","OCS","OCT",
"OCU","OCV","OCW","OCX","OCY","OCZ","ODA","ODB","ODC","ODD","ODE","ODF","ODG","ODH","ODI","ODJ",
"ODK","ODL","ODM","ODN","ODO","ODP","ODQ","ODR","ODS","ODT","ODU","ODV","ODW","ODX","ODY","ODZ",
"OEA","OEB","OEC","OED","OEE","OEF","OEG","OEH","OEI","OEJ","OEK","OEL","OEM","OEN","OEO","OEP",
"OEQ","OER","OES","OET","OEU","OEV","OEW","OEX","OEY","OEZ","OFA","OFB","OFC","OFD","OFE","OFF",
"OFG","OFH","OFI","OFJ","OFK","OFL","OFM","OFN","OFO","OFP","OFQ","OFR","OFS","OFT","OFU","OFV",
"OFW","OFX","OFY","OFZ","OGA","OGB","OGC","OGD","OGE","OGF","OGG","OGH","OGI","OGJ","OGK","OGL",
"OGM","OGN","OGO","OGP","OGQ","OGR","OGS","OGT","OGU","OGV","OGW","OGX","OGY","OGZ","OHA","OHB",
"OHC","OHD","OHE","OHF","OHG","OHH","OHI","OHJ","OHK","OHL","OHM","OHN","OHO","OHP","OHQ","OHR",
"OHS","OHT","OHU","OHV","OHW","OHX","OHY","OHZ","OIA","OIB","OIC","OID","OIE","OIF","OIG","OIH",
"OII","OIJ","OIK","OIL","OIM","OIN","OIO","OIP","OIQ","OIR","OIS","OIT","OIU","OIV","OIW","OIX",
"OIY","OIZ","OJA","OJB","OJC","OJD","OJE","OJF","OJG","OJH","OJI","OJJ","OJK","OJL","OJM","OJN",
"OJO","OJP","OJQ","OJR","OJS","OJT","OJU","OJV","OJW","OJX","OJY","OJZ","OKA","OKB","OKC","OKD",
"OKE","OKF","OKG","OKH","OKI","OKJ","OKK","OKL","OKM","OKN","OKO","OKP","OKQ","OKR","OKS","OKT",
"OKU","OKV","OKW","OKX","OKY","OKZ","OLA","OLB","OLC","OLD","OLE","OLF","OLG","OLH","OLI","OLJ",
"OLK","OLL","OLM","OLN","OLO","OLP","OLQ","OLR","OLS","OLT","OLU","OLV","OLW","OLX","OLY","OLZ",
"OMA","OMB","OMC","OMD","OME","OMF","OMG","OMH","OMI","OMJ","OMK","OML","OMM","OMN","OMO","OMP",
"OMQ","OMR","OMS","OMT","OMU","OMV","OMW","OMX","OMY","OMZ","ONA","ONB","ONC","OND","ONE","ONF",
"ONG","ONH","ONI","ONJ","ONK","ONL","ONM","ONN","ONO","ONP","ONQ","ONR","ONS","ONT","ONU","ONV",
"ONW","ONX","ONY","ONZ","OOA","OOB","OOC","OOD","OOE","OOF","OOG","OOH","OOI","OOJ","OOK","OOL",
"OOM","OON","OOO","OOP","OOQ","OOR","OOS","OOT","OOU","OOV","OOW","OOX","OOY","OOZ","OPA","OPB",
"OPC","OPD","OPE","OPF","OPG","OPH","OPI","OPJ","OPK","OPL","OPM","OPN","OPO","OPP","OPQ","OPR",
"OPS","OPT","OPU","OPV","OPW","OPX","OPY","OPZ","OQA","OQB","OQC","OQD","OQE","OQF","OQG","OQH",
"OQI","OQJ","OQK","OQL","OQM","OQN","OQO","OQP","OQQ","OQR","OQS","OQT","OQU","OQV","OQW","OQX",
"OQY","OQZ","ORA","ORB","ORC","ORD","ORE","ORF","ORG","ORH","ORI","ORJ","ORK","ORL","ORM","ORN",
"ORO","ORP","ORQ","ORR","ORS","ORT","ORU","ORV","ORW","ORX","ORY","ORZ","OSA","OSB","OSC","OSD",
"OSE","OSF","OSG","OSH","OSI","OSJ","OSK","OSL","OSM","OSN","OSO","OSP","OSQ","OSR","OSS","OST",
"OSU","OSV","OSW","OSX","OSY","OSZ","OTA","OTB","OTC","OTD","OTE","OTF","OTG","OTH","OTI","OTJ",
"OTK","OTL","OTM","OTN","OTO","OTP","OTQ","OTR","OTS","OTT","OTU","OTV","OTW","OTX","OTY","OTZ",
"OUA","OUB","OUC","OUD","OUE","OUF","OUG","OUH","OUI","OUJ","OUK","OUL","OUM","OUN","OUO","OUP",
"OUQ","OUR","OUS","OUT","OUU","OUV","OUW","OUX","OUY","OUZ","OVA","OVB","OVC","OVD","OVE","OVF",
"OVG","OVH","OVI","OVJ","OVK","OVL","OVM","OVN","OVO","OVP","OVQ","OVR","OVS","OVT","OVU","OVV",
"OVW","OVX","OVY","OVZ","OWA","OWB","OWC","OWD","OWE","OWF","OWG","OWH","OWI","OWJ","OWK","OWL",
"OWM","OWN","OWO","OWP","OWQ","OWR","OWS","OWT","OWU","OWV","OWW","OWX","OWY","OWZ","OXA","OXB",
"OXC","OXD","OXE","OXF","OXG","OXH","OXI","OXJ","OXK","OXL","OXM","OXN","OXO","OXP","OXQ","OXR",
"OXS","OXT","OXU","OXV","OXW","OXX","OXY","OXZ","OYA","OYB","OYC","OYD","OYE","OYF","OYG","OYH",
"OYI","OYJ","OYK","OYL","OYM","OYN","OYO","OYP","OYQ","OYR","OYS","OYT","OYU","OYV","OYW","OYX",
"OYY","OYZ","OZA","OZB","OZC","OZD","OZE","OZF","OZG","OZH","OZI","OZJ","OZK","OZL","OZM","OZN",
"OZO","OZP","OZQ","OZR","OZS","OZT","OZU","OZV","OZW","OZX","OZY","OZZ","PAA","PAB","PAC","PAD",
"PAE","PAF","PAG","PAH","PAI","PAJ","PAK","PAL","PAM","PAN","PAO","PAP","PAQ","PAR","PAS","PAT",
"PAU","PAV","PAW","PAX","PAY","PAZ","PBA","PBB","PBC","PBD","PBE","PBF","PBG","PBH","PBI","PBJ",
"PBK","PBL","PBM","PBN","PBO","PBP","PBQ","PBR","PBS","PBT","PBU","PBV","PBW","PBX","PBY","PBZ",
"PCA","PCB","PCC","PCD","PCE","PCF","PCG","PCH","PCI","PCJ","PCK","PCL","PCM","PCN","PCO","PCP",
"PCQ","PCR","PCS","PCT","PCU","PCV","PCW","PCX","PCY","PCZ","PDA","PDB","PDC","PDD","PDE","PDF",
"PDG","PDH","PDI","PDJ","PDK","PDL","PDM","PDN","PDO","PDP","PDQ","PDR","PDS","PDT","PDU","PDV",
"PDW","PDX","PDY","PDZ","PEA","PEB","PEC","PED","PEE","PEF","PEG","PEH","PEI","PEJ","PEK","PEL",
"PEM","PEN","PEO","PEP","PEQ","PER","PES","PET","PEU","PEV","PEW","PEX","PEY","PEZ","PFA","PFB",
"PFC","PFD","PFE","PFF","PFG","PFH","PFI","PFJ","PFK","PFL","PFM","PFN","PFO","PFP","PFQ","PFR",
"PFS","PFT","PFU","PFV","PFW","PFX","PFY","PFZ","PGA","PGB","PGC","PGD","PGE","PGF","PGG","PGH",
"PGI","PGJ","PGK","PGL","PGM","PGN","PGO","PGP","PGQ","PGR","PGS","PGT","PGU","PGV","PGW","PGX",
"PGY","PGZ","PHA","PHB","PHC","PHD","PHE","PHF","PHG","PHH","PHI","PHJ","PHK","PHL","PHM","PHN",
"PHO","PHP","PHQ","PHR","PHS","PHT","PHU","PHV","PHW","PHX","PHY","PHZ","PIA","PIB","PIC","PID",
"PIE","PIF","PIG","PIH","PII","PIJ","PIK","PIL","PIM","PIN","PIO","PIP","PIQ","PIR","PIS","PIT",
"PIU","PIV","PIW","PIX","PIY","PIZ","PJA","PJB","PJC","PJD","PJE","PJF","PJG","PJH","PJI","PJJ",
"PJK","PJL","PJM","PJN","PJO","PJP","PJQ","PJR","PJS","PJT","PJU","PJV","PJW","PJX","PJY","PJZ",
"PKA","PKB","PKC","PKD","PKE","PKF","PKG","PKH","PKI","PKJ","PKK","PKL","PKM","PKN","PKO","PKP",
"PKQ","PKR","PKS","PKT","PKU","PKV","PKW","PKX","PKY","PKZ","PLA","PLB","PLC","PLD","PLE","PLF",
"PLG","PLH","PLI","PLJ","PLK","PLL","PLM","PLN","PLO","PLP","PLQ","PLR","PLS","PLT","PLU","PLV",
"PLW","PLX","PLY","PLZ","PMA","PMB","PMC","PMD","PME","PMF","PMG","PMH","PMI","PMJ","PMK","PML",
"PMM","PMN","PMO","PMP","PMQ","PMR","PMS","PMT","PMU","PMV","PMW","PMX","PMY","PMZ","PNA","PNB",
"PNC","PND","PNE","PNF","PNG","PNH","PNI","PNJ","PNK","PNL","PNM","PNN","PNO","PNP","PNQ","PNR",
"PNS","PNT","PNU","PNV","PNW","PNX","PNY","PNZ","POA","POB","POC","POD","POE","POF","POG","POH",
"POI","POJ","POK","POL","POM","PON","POO","POP","POQ","POR","POS","POT","POU","POV","POW","POX",
"POY","POZ","PPA","PPB","PPC","PPD","PPE","PPF","PPG","PPH","PPI","PPJ","PPK","PPL","PPM","PPN",
"PPO","PPP","PPQ","PPR","PPS","PPT","PPU","PPV","PPW","PPX","PPY","PPZ","PQA","PQB","PQC","PQD",
"PQE","PQF","PQG","PQH","PQI","PQJ","PQK","PQL","PQM","PQN","PQO","PQP","PQQ","PQR","PQS","PQT",
"PQU","PQV","PQW","PQX","PQY","PQZ","PRA","PRB","PRC","PRD","PRE","PRF","PRG","PRH","PRI","PRJ",
"PRK","PRL","PRM","PRN","PRO","PRP","PRQ","PRR","PRS","PRT","PRU","PRV","PRW","PRX","PRY","PRZ",
"PSA","PSB","PSC","PSD","PSE","PSF","PSG","PSH","PSI","PSJ","PSK","PSL","PSM","PSN","PSO","PSP",
"PSQ","PSR","PSS","PST","PSU","PSV","PSW","PSX","PSY","PSZ","PTA","PTB","PTC","PTD","PTE","PTF",
"PTG","PTH","PTI","PTJ","PTK","PTL","PTM","PTN","PTO","PTP","PTQ","PTR","PTS","PTT","PTU","PTV",
"PTW","PTX","PTY","PTZ","PUA","PUB","PUC","PUD","PUE","PUF","PUG","PUH","PUI","PUJ","PUK","PUL",
"PUM","PUN","PUO","PUP","PUQ","PUR","PUS","PUT","PUU","PUV","PUW","PUX","PUY","PUZ","PVA","PVB",
"PVC","PVD","PVE","PVF","PVG","PVH","PVI","PVJ","PVK","PVL","PVM","PVN","PVO","PVP","PVQ","PVR",
"PVS","PVT","PVU","PVV","PVW","PVX","PVY","PVZ","PWA","PWB","PWC","PWD","PWE","PWF","PWG","PWH",
"PWI","PWJ","PWK","PWL","PWM","PWN","PWO","PWP","PWQ","PWR","PWS","PWT","PWU","PWV","PWW","PWX",
"PWY","PWZ","PXA","PXB","PXC","PXD","PXE","PXF","PXG","PXH","PXI","PXJ","PXK","PXL","PXM","PXN",
"PXO","PXP","PXQ","PXR","PXS","PXT","PXU","PXV","PXW","PXX","PXY","PXZ","PYA","PYB","PYC","PYD",
"PYE","PYF","PYG","PYH","PYI","PYJ","PYK","PYL","PYM","PYN","PYO","PYP","PYQ","PYR","PYS","PYT",
"PYU","PYV","PYW","PYX","PYY","PYZ","PZA","PZB","PZC","PZD","PZE","PZF","PZG","PZH","PZI","PZJ",
"PZK","PZL","PZM","PZN","PZO","PZP","PZQ","PZR","PZS","PZT","PZU","PZV","PZW","PZX","PZY","PZZ",
"QAA","QAB","QAC","QAD","QAE","QAF","QAG","QAH","QAI","QAJ","QAK","QAL","QAM","QAN","QAO","QAP",
"QAQ","QAR","QAS","QAT","QAU","QAV","QAW","QAX","QAY","QAZ","QBA","QBB","QBC","QBD","QBE","QBF",
"QBG","QBH","QBI","QBJ","QBK","QBL","QBM","QBN","QBO","QBP","QBQ","QBR","QBS","QBT","QBU","QBV",
"QBW","QBX","QBY","QBZ","QCA","QCB","QCC","QCD","QCE","QCF","QCG","QCH","QCI","QCJ","QCK","QCL",
"QCM","QCN","QCO","QCP","QCQ","QCR","QCS","QCT","QCU","QCV","QCW","QCX","QCY","QCZ","QDA","QDB",
"QDC","QDD","QDE","QDF","QDG","QDH","QDI","QDJ","QDK","QDL","QDM","QDN","QDO","QDP","QDQ","QDR",
"QDS","QDT","QDU","QDV","QDW","QDX","QDY","QDZ","QEA","QEB","QEC","QED","QEE","QEF","QEG","QEH",
"QEI","QEJ","QEK","QEL","QEM","QEN","QEO","QEP","QEQ","QER","QES","QET","QEU","QEV","QEW","QEX",
"QEY","QEZ","QFA","QFB","QFC","QFD","QFE","QFF","QFG","QFH","QFI","QFJ","QFK","QFL","QFM","QFN",
"QFO","QFP","QFQ","QFR","QFS","QFT","QFU","QFV","QFW","QFX","QFY","QFZ","QGA","QGB","QGC","QGD",
"QGE","QGF","QGG","QGH","QGI","QGJ","QGK","QGL","QGM","QGN","QGO","QGP","QGQ","QGR","QGS","QGT",
"QGU","QGV","QGW","QGX","QGY","QGZ","QHA","QHB","QHC","QHD","QHE","QHF","QHG","QHH","QHI","QHJ",
"QHK","QHL","QHM","QHN","QHO","QHP","QHQ","QHR","QHS","QHT","QHU","QHV","QHW","QHX","QHY","QHZ",
"QIA","QIB","QIC","QID","QIE","QIF","QIG","QIH","QII","QIJ","QIK","QIL","QIM","QIN","QIO","QIP",
"QIQ","QIR","QIS","QIT","QIU","QIV","QIW","QIX","QIY","QIZ","QJA","QJB","QJC","QJD","QJE","QJF",
"QJG","QJH","QJI","QJJ","QJK","QJL","QJM","QJN","QJO","QJP","QJQ","QJR","QJS","QJT","QJU","QJV",
"QJW","QJX","QJY","QJZ","QKA","QKB","QKC","QKD","QKE","QKF","QKG","QKH","QKI","QKJ","QKK","QKL",
"QKM","QKN","QKO","QKP","QKQ","QKR","QKS","QKT","QKU","QKV","QKW","QKX","QKY","QKZ","QLA","QLB",
"QLC","QLD","QLE","QLF","QLG","QLH","QLI","QLJ","QLK","QLL","QLM","QLN","QLO","QLP","QLQ","QLR",
"QLS","QLT","QLU","QLV","QLW","QLX","QLY","QLZ","QMA","QMB","QMC","QMD","QME","QMF","QMG","QMH",
"QMI","QMJ","QMK","QML","QMM","QMN","QMO","QMP","QMQ","QMR","QMS","QMT","QMU","QMV","QMW","QMX",
"QMY","QMZ","QNA","QNB","QNC","QND","QNE","QNF","QNG","QNH","QNI","QNJ","QNK","QNL","QNM","QNN",
"QNO","QNP","QNQ","QNR","QNS","QNT","QNU","QNV","QNW","QNX","QNY","QNZ","QOA","QOB","QOC","QOD",
"QOE","QOF","QOG","QOH","QOI","QOJ","QOK","QOL","QOM","QON","QOO","QOP","QOQ","QOR","QOS","QOT",
"QOU","QOV","QOW","QOX","QOY","QOZ","QPA","QPB","QPC","QPD","QPE","QPF","QPG","QPH","QPI","QPJ",
"QPK","QPL","QPM","QPN","QPO","QPP","QPQ","QPR","QPS","QPT","QPU","QPV","QPW","QPX","QPY","QPZ",
"QQA","QQB","QQC","QQD","QQE","QQF","QQG","QQH","QQI","QQJ","QQK","QQL","QQM","QQN","QQO","QQP",
"QQQ","QQR","QQS","QQT","QQU","QQV","QQW","QQX","QQY","QQZ","QRA","QRB","QRC","QRD","QRE","QRF",
"QRG","QRH","QRI","QRJ","QRK","QRL","QRM","QRN","QRO","QRP","QRQ","QRR","QRS","QRT","QRU","QRV",
"QRW","QRX","QRY","QRZ","QSA","QSB","QSC","QSD","QSE","QSF","QSG","QSH","QSI","QSJ","QSK","QSL",
"QSM","QSN","QSO","QSP","QSQ","QSR","QSS","QST","QSU","QSV","QSW","QSX","QSY","QSZ","QTA","QTB",
"QTC","QTD","QTE","QTF","QTG","QTH","QTI","QTJ","QTK","QTL","QTM","QTN","QTO","QTP","QTQ","QTR",
"QTS","QTT","QTU","QTV","QTW","QTX","QTY","QTZ","QUA","QUB","QUC","QUD","QUE","QUF","QUG","QUH",
"QUI","QUJ","QUK","QUL","QUM","QUN","QUO","QUP","QUQ","QUR","QUS","QUT","QUU","QUV","QUW","QUX",
"QUY","QUZ","QVA","QVB","QVC","QVD","QVE","QVF","QVG","QVH","QVI","QVJ","QVK","QVL","QVM","QVN",
"QVO","QVP","QVQ","QVR","QVS","QVT","QVU","QVV","QVW","QVX","QVY","QVZ","QWA","QWB","QWC","QWD",
"QWE","QWF","QWG","QWH","QWI","QWJ","QWK","QWL","QWM","QWN","QWO","QWP","QWQ","QWR","QWS","QWT",
"QWU","QWV","QWW","QWX","QWY","QWZ","QXA","QXB","QXC","QXD","QXE","QXF","QXG","QXH","QXI","QXJ",
"QXK","QXL","QXM","QXN","QXO","QXP","QXQ","QXR","QXS","QXT","QXU","QXV","QXW","QXX","QXY","QXZ",
"QYA","QYB","QYC","QYD","QYE","QYF","QYG","QYH","QYI","QYJ","QYK","QYL","QYM","QYN","QYO","QYP",
"QYQ","QYR","QYS","QYT","QYU","QYV","QYW","QYX","QYY","QYZ","QZA","QZB","QZC","QZD","QZE","QZF",
"QZG","QZH","QZI","QZJ","QZK","QZL","QZM","QZN","QZO","QZP","QZQ","QZR","QZS","QZT","QZU","QZV",
"QZW","QZX","QZY","QZZ","RAA","RAB","RAC","RAD","RAE","RAF","RAG","RAH","RAI","RAJ","RAK","RAL",
"RAM","RAN","RAO","RAP","RAQ","RAR","RAS","RAT","RAU","RAV","RAW","RAX","RAY","RAZ","RBA","RBB",
"RBC","RBD","RBE","RBF","RBG","RBH","RBI","RBJ","RBK","RBL","RBM","RBN","RBO","RBP","RBQ","RBR",
"RBS","RBT","RBU","RBV","RBW","RBX","RBY","RBZ","RCA","RCB","RCC","RCD","RCE","RCF","RCG","RCH",
"RCI","RCJ","RCK","RCL","RCM","RCN","RCO","RCP","RCQ","RCR","RCS","RCT","RCU","RCV","RCW","RCX",
"RCY","RCZ","RDA","RDB","RDC","RDD","RDE","RDF","RDG","RDH","RDI","RDJ","RDK","RDL","RDM","RDN",
"RDO","RDP","RDQ","RDR","RDS","RDT","RDU","RDV","RDW","RDX","RDY","RDZ","REA","REB","REC","RED",
"REE","REF","REG","REH","REI","REJ","REK","REL","REM","REN","REO","REP","REQ","RER","RES","RET",
"REU","REV","REW","REX","REY","REZ","RFA","RFB","RFC","RFD","RFE","RFF","RFG","RFH","RFI","RFJ",
"RFK","RFL","RFM","RFN","RFO","RFP","RFQ","RFR","RFS","RFT","RFU","RFV","RFW","RFX","RFY","RFZ",
"RGA","RGB","RGC","RGD","RGE","RGF","RGG","RGH","RGI","RGJ","RGK","RGL","RGM","RGN","RGO","RGP",
"RGQ","RGR","RGS","RGT","RGU","RGV","RGW","RGX","RGY","RGZ","RHA","RHB","RHC","RHD","RHE","RHF",
"RHG","RHH","RHI","RHJ","RHK","RHL","RHM","RHN","RHO","RHP","RHQ","RHR","RHS","RHT","RHU","RHV",
"RHW","RHX","RHY","RHZ","RIA","RIB","RIC","RID","RIE","RIF","RIG","RIH","RII","RIJ","RIK","RIL",
"RIM","RIN","RIO","RIP","RIQ","RIR","RIS","RIT","RIU","RIV","RIW","RIX","RIY","RIZ","RJA","RJB",
"RJC","RJD","RJE","RJF","RJG","RJH","RJI","RJJ","RJK","RJL","RJM","RJN","RJO","RJP","RJQ","RJR",
"RJS","RJT","RJU","RJV","RJW","RJX","RJY","RJZ","RKA","RKB","RKC","RKD","RKE","RKF","RKG","RKH",
"RKI","RKJ","RKK","RKL","RKM","RKN","RKO","RKP","RKQ","RKR","RKS","RKT","RKU","RKV","RKW","RKX",
"RKY","RKZ","RLA","RLB","RLC","RLD","RLE","RLF","RLG","RLH","RLI","RLJ","RLK","RLL","RLM","RLN",
"RLO","RLP","RLQ","RLR","RLS","RLT","RLU","RLV","RLW","RLX","RLY","RLZ","RMA","RMB","RMC","RMD",
"RME","RMF","RMG","RMH","RMI","RMJ","RMK","RML","RMM","RMN","RMO","RMP","RMQ","RMR","RMS","RMT",
"RMU","RMV","RMW","RMX","RMY","RMZ","RNA","RNB","RNC","RND","RNE","RNF","RNG","RNH","RNI","RNJ",
"RNK","RNL","RNM","RNN","RNO","RNP","RNQ","RNR","RNS","RNT","RNU","RNV","RNW","RNX","RNY","RNZ",
"ROA","ROB","ROC","ROD","ROE","ROF","ROG","ROH","ROI","ROJ","ROK","ROL","ROM","RON","ROO","ROP",
"ROQ","ROR","ROS","ROT","ROU","ROV","ROW","ROX","ROY","ROZ","RPA","RPB","RPC","RPD","RPE","RPF",
"RPG","RPH","RPI","RPJ","RPK","RPL","RPM","RPN","RPO","RPP","RPQ","RPR","RPS","RPT","RPU","RPV",
"RPW","RPX","RPY","RPZ","RQA","RQB","RQC","RQD","RQE","RQF","RQG","RQH","RQI","RQJ","RQK","RQL",
"RQM","RQN","RQO","RQP","RQQ","RQR","RQS","RQT","RQU","RQV","RQW","RQX","RQY","RQZ","RRA","RRB",
"RRC","RRD","RRE","RRF","RRG","RRH","RRI","RRJ","RRK","RRL","RRM","RRN","RRO","RRP","RRQ","RRR",
"RRS","RRT","RRU","RRV","RRW","RRX","RRY","RRZ","RSA","RSB","RSC","RSD","RSE","RSF","RSG","RSH",
"RSI","RSJ","RSK","RSL","RSM","RSN","RSO","RSP","RSQ","RSR","RSS","RST","RSU","RSV","RSW","RSX",
"RSY","RSZ","RTA","RTB","RTC","RTD","RTE","RTF","RTG","RTH","RTI","RTJ","RTK","RTL","RTM","RTN",
"RTO","RTP","RTQ","RTR","RTS","RTT","RTU","RTV","RTW","RTX","RTY","RTZ","RUA","RUB","RUC","RUD",
"RUE","RUF","RUG","RUH","RUI","RUJ","RUK","RUL","RUM","RUN","RUO","RUP","RUQ","RUR","RUS","RUT",
"RUU","RUV","RUW","RUX","RUY","RUZ","RVA","RVB","RVC","RVD","RVE","RVF","RVG","RVH","RVI","RVJ",
"RVK","RVL","RVM","RVN","RVO","RVP","RVQ","RVR","RVS","RVT","RVU","RVV","RVW","RVX","RVY","RVZ",
"RWA","RWB","RWC","RWD","RWE","RWF","RWG","RWH","RWI","RWJ","RWK","RWL","RWM","RWN","RWO","RWP",
"RWQ","RWR","RWS","RWT","RWU","RWV","RWW","RWX","RWY","RWZ","RXA","RXB","RXC","RXD","RXE","RXF",
"RXG","RXH","RXI","RXJ","RXK","RXL","RXM","RXN","RXO","RXP","RXQ","RXR","RXS","RXT","RXU","RXV",
"RXW","RXX","RXY","RXZ","RYA","RYB","RYC","RYD","RYE","RYF","RYG","RYH","RYI","RYJ","RYK","RYL",
"RYM","RYN","RYO","RYP","RYQ","RYR","RYS","RYT","RYU","RYV","RYW","RYX","RYY","RYZ","RZA","RZB",
"RZC","RZD","RZE","RZF","RZG","RZH","RZI","RZJ","RZK","RZL","RZM","RZN","RZO","RZP","RZQ","RZR",
"RZS","RZT","RZU","RZV","RZW","RZX","RZY","RZZ","SAA","SAB","SAC","SAD","SAE","SAF","SAG","SAH",
"SAI","SAJ","SAK","SAL","SAM","SAN","SAO","SAP","SAQ","SAR","SAS","SAT","SAU","SAV","SAW","SAX",
"SAY","SAZ","SBA","SBB","SBC","SBD","SBE","SBF","SBG","SBH","SBI","SBJ","SBK","SBL","SBM","SBN",
"SBO","SBP","SBQ","SBR","SBS","SBT","SBU","SBV","SBW","SBX","SBY","SBZ","SCA","SCB","SCC","SCD",
"SCE","SCF","SCG","SCH","SCI","SCJ","SCK","SCL","SCM","SCN","SCO","SCP","SCQ","SCR","SCS","SCT",
"SCU","SCV","SCW","SCX","SCY","SCZ","SDA","SDB","SDC","SDD","SDE","SDF","SDG","SDH","SDI","SDJ",
"SDK","SDL","SDM","SDN","SDO","SDP","SDQ","SDR","SDS","SDT","SDU","SDV","SDW","SDX","SDY","SDZ",
"SEA","SEB","SEC","SED","SEE","SEF","SEG","SEH","SEI","SEJ","SEK","SEL","SEM","SEN","SEO","SEP",
"SEQ","SER","SES","SET","SEU","SEV","SEW","SEX","SEY","SEZ","SFA","SFB","SFC","SFD","SFE","SFF",
"SFG","SFH","SFI","SFJ","SFK","SFL","SFM","SFN","SFO","SFP","SFQ","SFR","SFS","SFT","SFU","SFV",
"SFW","SFX","SFY","SFZ","SGA","SGB","SGC","SGD","SGE","SGF","SGG","SGH","SGI","SGJ","SGK","SGL",
"SGM","SGN","SGO","SGP","SGQ","SGR","SGS","SGT","SGU","SGV","SGW","SGX","SGY","SGZ","SHA","SHB",
"SHC","SHD","SHE","SHF","SHG","SHH","SHI","SHJ","SHK","SHL","SHM","SHN","SHO","SHP","SHQ","SHR",
"SHS","SHT","SHU","SHV","SHW","SHX","SHY","SHZ","SIA","SIB","SIC","SID","SIE","SIF","SIG","SIH",
"SII","SIJ","SIK","SIL","SIM","SIN","SIO","SIP","SIQ","SIR","SIS","SIT","SIU","SIV","SIW","SIX",
"SIY","SIZ","SJA","SJB","SJC","SJD","SJE","SJF","SJG","SJH","SJI","SJJ","SJK","SJL","SJM","SJN",
"SJO","SJP","SJQ","SJR","SJS","SJT","SJU","SJV","SJW","SJX","SJY","SJZ","SKA","SKB","SKC","SKD",
"SKE","SKF","SKG","SKH","SKI","SKJ","SKK","SKL","SKM","SKN","SKO","SKP","SKQ","SKR","SKS","SKT",
"SKU","SKV","SKW","SKX","SKY","SKZ","SLA","SLB","SLC","SLD","SLE","SLF","SLG","SLH","SLI","SLJ",
"SLK","SLL","SLM","SLN","SLO","SLP","SLQ","SLR","SLS","SLT","SLU","SLV","SLW","SLX","SLY","SLZ",
"SMA","SMB","SMC","SMD","SME","SMF","SMG","SMH","SMI","SMJ","SMK","SML","SMM","SMN","SMO","SMP",
"SMQ","SMR","SMS","SMT","SMU","SMV","SMW","SMX","SMY","SMZ","SNA","SNB","SNC","SND","SNE","SNF",
"SNG","SNH","SNI","SNJ","SNK","SNL","SNM","SNN","SNO","SNP","SNQ","SNR","SNS","SNT","SNU","SNV",
"SNW","SNX","SNY","SNZ","SOA","SOB","SOC","SOD","SOE","SOF","SOG","SOH","SOI","SOJ","SOK","SOL",
"SOM","SON","SOO","SOP","SOQ","SOR","SOS","SOT","SOU","SOV","SOW","SOX","SOY","SOZ","SPA","SPB",
"SPC","SPD","SPE","SPF","SPG","SPH","SPI","SPJ","SPK","SPL","SPM","SPN","SPO","SPP","SPQ","SPR",
"SPS","SPT","SPU","SPV","SPW","SPX","SPY","SPZ","SQA","SQB","SQC","SQD","SQE","SQF","SQG","SQH",
"SQI","SQJ","SQK","SQL","SQM","SQN","SQO","SQP","SQQ","SQR","SQS","SQT","SQU","SQV","SQW","SQX",
"SQY","SQZ","SRA","SRB","SRC","SRD","SRE","SRF","SRG","SRH","SRI","SRJ","SRK","SRL","SRM","SRN",
"SRO","SRP","SRQ","SRR","SRS","SRT","SRU","SRV","SRW","SRX","SRY","SRZ","SSA","SSB","SSC","SSD",
"SSE","SSF","SSG","SSH","SSI","SSJ","SSK","SSL","SSM","SSN","SSO","SSP","SSQ","SSR","SSS","SST",
"SSU","SSV","SSW","SSX","SSY","SSZ","STA","STB","STC","STD","STE","STF","STG","STH","STI","STJ",
"STK","STL","STM","STN","STO","STP","STQ","STR","STS","STT","STU","STV","STW","STX","STY","STZ",
"SUA","SUB","SUC","SUD","SUE","SUF","SUG","SUH","SUI","SUJ","SUK","SUL","SUM","SUN","SUO","SUP",
"SUQ","SUR","SUS","SUT","SUU","SUV","SUW","SUX","SUY","SUZ","SVA","SVB","SVC","SVD","SVE","SVF",
"SVG","SVH","SVI","SVJ","SVK","SVL","SVM","SVN","SVO","SVP","SVQ","SVR","SVS","SVT","SVU","SVV",
"SVW","SVX","SVY","SVZ","SWA","SWB","SWC","SWD","SWE","SWF","SWG","SWH","SWI","SWJ","SWK","SWL",
"SWM","SWN","SWO","SWP","SWQ","SWR","SWS","SWT","SWU","SWV","SWW","SWX","SWY","SWZ","SXA","SXB",
"SXC","SXD","SXE","SXF","SXG","SXH","SXI","SXJ","SXK","SXL","SXM","SXN","SXO","SXP","SXQ","SXR",
"SXS","SXT","SXU","SXV","SXW","SXX","SXY","SXZ","SYA","SYB","SYC","SYD","SYE","SYF","SYG","SYH",
"SYI","SYJ","SYK","SYL","SYM","SYN","SYO","SYP","SYQ","SYR","SYS","SYT","SYU","SYV","SYW","SYX",
"SYY","SYZ","SZA","SZB","SZC","SZD","SZE","SZF","SZG","SZH","SZI","SZJ","SZK","SZL","SZM","SZN",
"SZO","SZP","SZQ","SZR","SZS","SZT","SZU","SZV","SZW","SZX","SZY","SZZ",
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TAA to TTV - 516 triplets - intentionally omitted
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
"TTW","TTX","TTY","TTZ","TUA","TUB","TUC","TUD","TUE","TUF","TUG","TUH","TUI","TUJ","TUK","TUL",
"TUM","TUN","TUO","TUP","TUQ","TUR","TUS","TUT","TUU","TUV","TUW","TUX","TUY","TUZ","TVA","TVB",
"TVC","TVD","TVE","TVF","TVG","TVH","TVI","TVJ","TVK","TVL","TVM","TVN","TVO","TVP","TVQ","TVR",
"TVS","TVT","TVU","TVV","TVW","TVX","TVY","TVZ","TWA","TWB","TWC","TWD","TWE","TWF","TWG","TWH",
"TWI","TWJ","TWK","TWL","TWM","TWN","TWO","TWP","TWQ","TWR","TWS","TWT","TWU","TWV","TWW","TWX",
"TWY","TWZ","TXA","TXB","TXC","TXD","TXE","TXF","TXG","TXH","TXI","TXJ","TXK","TXL","TXM","TXN",
"TXO","TXP","TXQ","TXR","TXS","TXT","TXU","TXV","TXW","TXX","TXY","TXZ","TYA","TYB","TYC","TYD",
"TYE","TYF","TYG","TYH","TYI","TYJ","TYK","TYL","TYM","TYN","TYO","TYP","TYQ","TYR","TYS","TYT",
"TYU","TYV","TYW","TYX","TYY","TYZ","TZA","TZB","TZC","TZD","TZE","TZF","TZG","TZH","TZI","TZJ",
"TZK","TZL","TZM","TZN","TZO","TZP","TZQ","TZR","TZS","TZT","TZU","TZV","TZW","TZX","TZY","TZZ",
"UAA","UAB","UAC","UAD","UAE","UAF","UAG","UAH","UAI","UAJ","UAK","UAL","UAM","UAN","UAO","UAP",
"UAQ","UAR","UAS","UAT","UAU","UAV","UAW","UAX","UAY","UAZ","UBA","UBB","UBC","UBD","UBE","UBF",
"UBG","UBH","UBI","UBJ","UBK","UBL","UBM","UBN","UBO","UBP","UBQ","UBR","UBS","UBT","UBU","UBV",
"UBW","UBX","UBY","UBZ","UCA","UCB","UCC","UCD","UCE","UCF","UCG","UCH","UCI","UCJ","UCK","UCL",
"UCM","UCN","UCO","UCP","UCQ","UCR","UCS","UCT","UCU","UCV","UCW","UCX","UCY","UCZ","UDA","UDB",
"UDC","UDD","UDE","UDF","UDG","UDH","UDI","UDJ","UDK","UDL","UDM","UDN","UDO","UDP","UDQ","UDR",
"UDS","UDT","UDU","UDV","UDW","UDX","UDY","UDZ","UEA","UEB","UEC","UED","UEE","UEF","UEG","UEH",
"UEI","UEJ","UEK","UEL","UEM","UEN","UEO","UEP","UEQ","UER","UES","UET","UEU","UEV","UEW","UEX",
"UEY","UEZ","UFA","UFB","UFC","UFD","UFE","UFF","UFG","UFH","UFI","UFJ","UFK","UFL","UFM","UFN",
"UFO","UFP","UFQ","UFR","UFS","UFT","UFU","UFV","UFW","UFX","UFY","UFZ","UGA","UGB","UGC","UGD",
"UGE","UGF","UGG","UGH","UGI","UGJ","UGK","UGL","UGM","UGN","UGO","UGP","UGQ","UGR","UGS","UGT",
"UGU","UGV","UGW","UGX","UGY","UGZ","UHA","UHB","UHC","UHD","UHE","UHF","UHG","UHH","UHI","UHJ",
"UHK","UHL","UHM","UHN","UHO","UHP","UHQ","UHR","UHS","UHT","UHU","UHV","UHW","UHX","UHY","UHZ",
"UIA","UIB","UIC","UID","UIE","UIF","UIG","UIH","UII","UIJ","UIK","UIL","UIM","UIN","UIO","UIP",
"UIQ","UIR","UIS","UIT","UIU","UIV","UIW","UIX","UIY","UIZ","UJA","UJB","UJC","UJD","UJE","UJF",
"UJG","UJH","UJI","UJJ","UJK","UJL","UJM","UJN","UJO","UJP","UJQ","UJR","UJS","UJT","UJU","UJV",
"UJW","UJX","UJY","UJZ","UKA","UKB","UKC","UKD","UKE","UKF","UKG","UKH","UKI","UKJ","UKK","UKL",
"UKM","UKN","UKO","UKP","UKQ","UKR","UKS","UKT","UKU","UKV","UKW","UKX","UKY","UKZ","ULA","ULB",
"ULC","ULD","ULE","ULF","ULG","ULH","ULI","ULJ","ULK","ULL","ULM","ULN","ULO","ULP","ULQ","ULR",
"ULS","ULT","ULU","ULV","ULW","ULX","ULY","ULZ","UMA","UMB","UMC","UMD","UME","UMF","UMG","UMH",
"UMI","UMJ","UMK","UML","UMM","UMN","UMO","UMP","UMQ","UMR","UMS","UMT","UMU","UMV","UMW","UMX",
"UMY","UMZ","UNA","UNB","UNC","UND","UNE","UNF","UNG","UNH","UNI","UNJ","UNK","UNL","UNM","UNN",
"UNO","UNP","UNQ","UNR","UNS","UNT","UNU","UNV","UNW","UNX","UNY","UNZ","UOA","UOB","UOC","UOD",
"UOE","UOF","UOG","UOH","UOI","UOJ","UOK","UOL","UOM","UON","UOO","UOP","UOQ","UOR","UOS","UOT",
"UOU","UOV","UOW","UOX","UOY","UOZ","UPA","UPB","UPC","UPD","UPE","UPF","UPG","UPH","UPI","UPJ",
"UPK","UPL","UPM","UPN","UPO","UPP","UPQ","UPR","UPS","UPT","UPU","UPV","UPW","UPX","UPY","UPZ",
"UQA","UQB","UQC","UQD","UQE","UQF","UQG","UQH","UQI","UQJ","UQK","UQL","UQM","UQN","UQO","UQP",
"UQQ","UQR","UQS","UQT","UQU","UQV","UQW","UQX","UQY","UQZ","URA","URB","URC","URD","URE","URF",
"URG","URH","URI","URJ","URK","URL","URM","URN","URO","URP","URQ","URR","URS","URT","URU","URV",
"URW","URX","URY","URZ","USA","USB","USC","USD","USE","USF","USG","USH","USI","USJ","USK","USL",
"USM","USN","USO","USP","USQ","USR","USS","UST","USU","USV","USW","USX","USY","USZ","UTA","UTB",
"UTC","UTD","UTE","UTF","UTG","UTH","UTI","UTJ","UTK","UTL","UTM","UTN","UTO","UTP","UTQ","UTR",
"UTS","UTT","UTU","UTV","UTW","UTX","UTY","UTZ","UUA","UUB","UUC","UUD","UUE","UUF","UUG","UUH",
"UUI","UUJ","UUK","UUL","UUM","UUN","UUO","UUP","UUQ","UUR","UUS","UUT","UUU","UUV","UUW","UUX",
"UUY","UUZ","UVA","UVB","UVC","UVD","UVE","UVF","UVG","UVH","UVI","UVJ","UVK","UVL","UVM","UVN",
"UVO","UVP","UVQ","UVR","UVS","UVT","UVU","UVV","UVW","UVX","UVY","UVZ","UWA","UWB","UWC","UWD",
"UWE","UWF","UWG","UWH","UWI","UWJ","UWK","UWL","UWM","UWN","UWO","UWP","UWQ","UWR","UWS","UWT",
"UWU","UWV","UWW","UWX","UWY","UWZ","UXA","UXB","UXC","UXD","UXE","UXF","UXG","UXH","UXI","UXJ",
"UXK","UXL","UXM","UXN","UXO","UXP","UXQ","UXR","UXS","UXT","UXU","UXV","UXW","UXX","UXY","UXZ",
"UYA","UYB","UYC","UYD","UYE","UYF","UYG","UYH","UYI","UYJ","UYK","UYL","UYM","UYN","UYO","UYP",
"UYQ","UYR","UYS","UYT","UYU","UYV","UYW","UYX","UYY","UYZ","UZA","UZB","UZC","UZD","UZE","UZF",
"UZG","UZH","UZI","UZJ","UZK","UZL","UZM","UZN","UZO","UZP","UZQ","UZR","UZS","UZT","UZU","UZV",
"UZW","UZX","UZY","UZZ","VAA","VAB","VAC","VAD","VAE","VAF","VAG","VAH","VAI","VAJ","VAK","VAL",
"VAM","VAN","VAO","VAP","VAQ","VAR","VAS","VAT","VAU","VAV","VAW","VAX","VAY","VAZ","VBA","VBB",
"VBC","VBD","VBE","VBF","VBG","VBH","VBI","VBJ","VBK","VBL","VBM","VBN","VBO","VBP","VBQ","VBR",
"VBS","VBT","VBU","VBV","VBW","VBX","VBY","VBZ","VCA","VCB","VCC","VCD","VCE","VCF","VCG","VCH",
"VCI","VCJ","VCK","VCL","VCM","VCN","VCO","VCP","VCQ","VCR","VCS","VCT","VCU","VCV","VCW","VCX",
"VCY","VCZ","VDA","VDB","VDC","VDD","VDE","VDF","VDG","VDH","VDI","VDJ","VDK","VDL","VDM","VDN",
"VDO","VDP","VDQ","VDR","VDS","VDT","VDU","VDV","VDW","VDX","VDY","VDZ","VEA","VEB","VEC","VED",
"VEE","VEF","VEG","VEH","VEI","VEJ","VEK","VEL","VEM","VEN","VEO","VEP","VEQ","VER","VES","VET",
"VEU","VEV","VEW","VEX","VEY","VEZ","VFA","VFB","VFC","VFD","VFE","VFF","VFG","VFH","VFI","VFJ",
"VFK","VFL","VFM","VFN","VFO","VFP","VFQ","VFR","VFS","VFT","VFU","VFV","VFW","VFX","VFY","VFZ",
"VGA","VGB","VGC","VGD","VGE","VGF","VGG","VGH","VGI","VGJ","VGK","VGL","VGM","VGN","VGO","VGP",
"VGQ","VGR","VGS","VGT","VGU","VGV","VGW","VGX","VGY","VGZ","VHA","VHB","VHC","VHD","VHE","VHF",
"VHG","VHH","VHI","VHJ","VHK","VHL","VHM","VHN","VHO","VHP","VHQ","VHR","VHS","VHT","VHU","VHV",
"VHW","VHX","VHY","VHZ","VIA","VIB","VIC","VID","VIE","VIF","VIG","VIH","VII","VIJ","VIK","VIL",
"VIM","VIN","VIO","VIP","VIQ","VIR","VIS","VIT","VIU","VIV","VIW","VIX","VIY","VIZ","VJA","VJB",
"VJC","VJD","VJE","VJF","VJG","VJH","VJI","VJJ","VJK","VJL","VJM","VJN","VJO","VJP","VJQ","VJR",
"VJS","VJT","VJU","VJV","VJW","VJX","VJY","VJZ","VKA","VKB","VKC","VKD","VKE","VKF","VKG","VKH",
"VKI","VKJ","VKK","VKL","VKM","VKN","VKO","VKP","VKQ","VKR","VKS","VKT","VKU","VKV","VKW","VKX",
"VKY","VKZ","VLA","VLB","VLC","VLD","VLE","VLF","VLG","VLH","VLI","VLJ","VLK","VLL","VLM","VLN",
"VLO","VLP","VLQ","VLR","VLS","VLT","VLU","VLV","VLW","VLX","VLY","VLZ","VMA","VMB","VMC","VMD",
"VME","VMF","VMG","VMH","VMI","VMJ","VMK","VML","VMM","VMN","VMO","VMP","VMQ","VMR","VMS","VMT",
"VMU","VMV","VMW","VMX","VMY","VMZ","VNA","VNB","VNC","VND","VNE","VNF","VNG","VNH","VNI","VNJ",
"VNK","VNL","VNM","VNN","VNO","VNP","VNQ","VNR","VNS","VNT","VNU","VNV","VNW","VNX","VNY","VNZ",
"VOA","VOB","VOC","VOD","VOE","VOF","VOG","VOH","VOI","VOJ","VOK","VOL","VOM","VON","VOO","VOP",
"VOQ","VOR","VOS","VOT","VOU","VOV","VOW","VOX","VOY","VOZ","VPA","VPB","VPC","VPD","VPE","VPF",
"VPG","VPH","VPI","VPJ","VPK","VPL","VPM","VPN","VPO","VPP","VPQ","VPR","VPS","VPT","VPU","VPV",
"VPW","VPX","VPY","VPZ","VQA","VQB","VQC","VQD","VQE","VQF","VQG","VQH","VQI","VQJ","VQK","VQL",
"VQM","VQN","VQO","VQP","VQQ","VQR","VQS","VQT","VQU","VQV","VQW","VQX","VQY","VQZ","VRA","VRB",
"VRC","VRD","VRE","VRF","VRG","VRH","VRI","VRJ","VRK","VRL","VRM","VRN","VRO","VRP","VRQ","VRR",
"VRS","VRT","VRU","VRV","VRW","VRX","VRY","VRZ","VSA","VSB","VSC","VSD","VSE","VSF","VSG","VSH",
"VSI","VSJ","VSK","VSL","VSM","VSN","VSO","VSP","VSQ","VSR","VSS","VST","VSU","VSV","VSW","VSX",
"VSY","VSZ","VTA","VTB","VTC","VTD","VTE","VTF","VTG","VTH","VTI","VTJ","VTK","VTL","VTM","VTN",
"VTO","VTP","VTQ","VTR","VTS","VTT","VTU","VTV","VTW","VTX","VTY","VTZ","VUA","VUB","VUC","VUD",
"VUE","VUF","VUG","VUH","VUI","VUJ","VUK","VUL","VUM","VUN","VUO","VUP","VUQ","VUR","VUS","VUT",
"VUU","VUV","VUW","VUX","VUY","VUZ","VVA","VVB","VVC","VVD","VVE","VVF","VVG","VVH","VVI","VVJ",
"VVK","VVL","VVM","VVN","VVO","VVP","VVQ","VVR","VVS","VVT","VVU","VVV","VVW","VVX","VVY","VVZ",
"VWA","VWB","VWC","VWD","VWE","VWF","VWG","VWH","VWI","VWJ","VWK","VWL","VWM","VWN","VWO","VWP",
"VWQ","VWR","VWS","VWT","VWU","VWV","VWW","VWX","VWY","VWZ","VXA","VXB","VXC","VXD","VXE","VXF",
"VXG","VXH","VXI","VXJ","VXK","VXL","VXM","VXN","VXO","VXP","VXQ","VXR","VXS","VXT","VXU","VXV",
"VXW","VXX","VXY","VXZ","VYA","VYB","VYC","VYD","VYE","VYF","VYG","VYH","VYI","VYJ","VYK","VYL",
"VYM","VYN","VYO","VYP","VYQ","VYR","VYS","VYT","VYU","VYV","VYW","VYX","VYY","VYZ","VZA","VZB",
"VZC","VZD","VZE","VZF","VZG","VZH","VZI","VZJ","VZK","VZL","VZM","VZN","VZO","VZP","VZQ","VZR",
"VZS","VZT","VZU","VZV","VZW","VZX","VZY","VZZ","WAA","WAB","WAC","WAD","WAE","WAF","WAG","WAH",
"WAI","WAJ","WAK","WAL","WAM","WAN","WAO","WAP","WAQ","WAR","WAS","WAT","WAU","WAV","WAW","WAX",
"WAY","WAZ","WBA","WBB","WBC","WBD","WBE","WBF","WBG","WBH","WBI","WBJ","WBK","WBL","WBM","WBN",
"WBO","WBP","WBQ","WBR","WBS","WBT","WBU","WBV","WBW","WBX","WBY","WBZ","WCA","WCB","WCC","WCD",
"WCE","WCF","WCG","WCH","WCI","WCJ","WCK","WCL","WCM","WCN","WCO","WCP","WCQ","WCR","WCS","WCT",
"WCU","WCV","WCW","WCX","WCY","WCZ","WDA","WDB","WDC","WDD","WDE","WDF","WDG","WDH","WDI","WDJ",
"WDK","WDL","WDM","WDN","WDO","WDP","WDQ","WDR","WDS","WDT","WDU","WDV","WDW","WDX","WDY","WDZ",
"WEA","WEB","WEC","WED","WEE","WEF","WEG","WEH","WEI","WEJ","WEK","WEL","WEM","WEN","WEO","WEP",
"WEQ","WER","WES","WET","WEU","WEV","WEW","WEX","WEY","WEZ","WFA","WFB","WFC","WFD","WFE","WFF",
"WFG","WFH","WFI","WFJ","WFK","WFL","WFM","WFN","WFO","WFP","WFQ","WFR","WFS","WFT","WFU","WFV",
"WFW","WFX","WFY","WFZ","WGA","WGB","WGC","WGD","WGE","WGF","WGG","WGH","WGI","WGJ","WGK","WGL",
"WGM","WGN","WGO","WGP","WGQ","WGR","WGS","WGT","WGU","WGV","WGW","WGX","WGY","WGZ","WHA","WHB",
"WHC","WHD","WHE","WHF","WHG","WHH","WHI","WHJ","WHK","WHL","WHM","WHN","WHO","WHP","WHQ","WHR",
"WHS","WHT","WHU","WHV","WHW","WHX","WHY","WHZ","WIA","WIB","WIC","WID","WIE","WIF","WIG","WIH",
"WII","WIJ","WIK","WIL","WIM","WIN","WIO","WIP","WIQ","WIR","WIS","WIT","WIU","WIV","WIW","WIX",
"WIY","WIZ","WJA","WJB","WJC","WJD","WJE","WJF","WJG","WJH","WJI","WJJ","WJK","WJL","WJM","WJN",
"WJO","WJP","WJQ","WJR","WJS","WJT","WJU","WJV","WJW","WJX","WJY","WJZ","WKA","WKB","WKC","WKD",
"WKE","WKF","WKG","WKH","WKI","WKJ","WKK","WKL","WKM","WKN","WKO","WKP","WKQ","WKR","WKS","WKT",
"WKU","WKV","WKW","WKX","WKY","WKZ","WLA","WLB","WLC","WLD","WLE","WLF","WLG","WLH","WLI","WLJ",
"WLK","WLL","WLM","WLN","WLO","WLP","WLQ","WLR","WLS","WLT","WLU","WLV","WLW","WLX","WLY","WLZ",
"WMA","WMB","WMC","WMD","WME","WMF","WMG","WMH","WMI","WMJ","WMK","WML","WMM","WMN","WMO","WMP",
"WMQ","WMR","WMS","WMT","WMU","WMV","WMW","WMX","WMY","WMZ","WNA","WNB","WNC","WND","WNE","WNF",
"WNG","WNH","WNI","WNJ","WNK","WNL","WNM","WNN","WNO","WNP","WNQ","WNR","WNS","WNT","WNU","WNV",
"WNW","WNX","WNY","WNZ","WOA","WOB","WOC","WOD","WOE","WOF","WOG","WOH","WOI","WOJ","WOK","WOL",
"WOM","WON","WOO","WOP","WOQ","WOR","WOS","WOT","WOU","WOV","WOW","WOX","WOY","WOZ","WPA","WPB",
"WPC","WPD","WPE","WPF","WPG","WPH","WPI","WPJ","WPK","WPL","WPM","WPN","WPO","WPP","WPQ","WPR",
"WPS","WPT","WPU","WPV","WPW","WPX","WPY","WPZ","WQA","WQB","WQC","WQD","WQE","WQF","WQG","WQH",
"WQI","WQJ","WQK","WQL","WQM","WQN","WQO","WQP","WQQ","WQR","WQS","WQT","WQU","WQV","WQW","WQX",
"WQY","WQZ","WRA","WRB","WRC","WRD","WRE","WRF","WRG","WRH","WRI","WRJ","WRK","WRL","WRM","WRN",
"WRO","WRP","WRQ","WRR","WRS","WRT","WRU","WRV","WRW","WRX","WRY","WRZ","WSA","WSB","WSC","WSD",
"WSE","WSF","WSG","WSH","WSI","WSJ","WSK","WSL","WSM","WSN","WSO","WSP","WSQ","WSR","WSS","WST",
"WSU","WSV","WSW","WSX","WSY","WSZ","WTA","WTB","WTC","WTD","WTE","WTF","WTG","WTH","WTI","WTJ",
"WTK","WTL","WTM","WTN","WTO","WTP","WTQ","WTR","WTS","WTT","WTU","WTV","WTW","WTX","WTY","WTZ",
"WUA","WUB","WUC","WUD","WUE","WUF","WUG","WUH","WUI","WUJ","WUK","WUL","WUM","WUN","WUO","WUP",
"WUQ","WUR","WUS","WUT","WUU","WUV","WUW","WUX","WUY","WUZ","WVA","WVB","WVC","WVD","WVE","WVF",
"WVG","WVH","WVI","WVJ","WVK","WVL","WVM","WVN","WVO","WVP","WVQ","WVR","WVS","WVT","WVU","WVV",
"WVW","WVX","WVY","WVZ","WWA","WWB","WWC","WWD","WWE","WWF","WWG","WWH","WWI","WWJ","WWK","WWL",
"WWM","WWN","WWO","WWP","WWQ","WWR","WWS","WWT","WWU","WWV","WWW","WWX","WWY","WWZ","WXA","WXB",
"WXC","WXD","WXE","WXF","WXG","WXH","WXI","WXJ","WXK","WXL","WXM","WXN","WXO","WXP","WXQ","WXR",
"WXS","WXT","WXU","WXV","WXW","WXX","WXY","WXZ","WYA","WYB","WYC","WYD","WYE","WYF","WYG","WYH",
"WYI","WYJ","WYK","WYL","WYM","WYN","WYO","WYP","WYQ","WYR","WYS","WYT","WYU","WYV","WYW","WYX",
"WYY","WYZ","WZA","WZB","WZC","WZD","WZE","WZF","WZG","WZH","WZI","WZJ","WZK","WZL","WZM","WZN",
"WZO","WZP","WZQ","WZR","WZS","WZT","WZU","WZV","WZW","WZX","WZY","WZZ","XAA","XAB","XAC","XAD",
"XAE","XAF","XAG","XAH","XAI","XAJ","XAK","XAL","XAM","XAN","XAO","XAP","XAQ","XAR","XAS","XAT",
"XAU","XAV","XAW","XAX","XAY","XAZ","XBA","XBB","XBC","XBD","XBE","XBF","XBG","XBH","XBI","XBJ",
"XBK","XBL","XBM","XBN","XBO","XBP","XBQ","XBR","XBS","XBT","XBU","XBV","XBW","XBX","XBY","XBZ",
"XCA","XCB","XCC","XCD","XCE","XCF","XCG","XCH","XCI","XCJ","XCK","XCL","XCM","XCN","XCO","XCP",
"XCQ","XCR","XCS","XCT","XCU","XCV","XCW","XCX","XCY","XCZ","XDA","XDB","XDC","XDD","XDE","XDF",
"XDG","XDH","XDI","XDJ","XDK","XDL","XDM","XDN","XDO","XDP","XDQ","XDR","XDS","XDT","XDU","XDV",
"XDW","XDX","XDY","XDZ","XEA","XEB","XEC","XED","XEE","XEF","XEG","XEH","XEI","XEJ","XEK","XEL",
"XEM","XEN","XEO","XEP","XEQ","XER","XES","XET","XEU","XEV","XEW","XEX","XEY","XEZ","XFA","XFB",
"XFC","XFD","XFE","XFF","XFG","XFH","XFI","XFJ","XFK","XFL","XFM","XFN","XFO","XFP","XFQ","XFR",
"XFS","XFT","XFU","XFV","XFW","XFX","XFY","XFZ","XGA","XGB","XGC","XGD","XGE","XGF","XGG","XGH",
"XGI","XGJ","XGK","XGL","XGM","XGN","XGO","XGP","XGQ","XGR","XGS","XGT","XGU","XGV","XGW","XGX",
"XGY","XGZ","XHA","XHB","XHC","XHD","XHE","XHF","XHG","XHH","XHI","XHJ","XHK","XHL","XHM","XHN",
"XHO","XHP","XHQ","XHR","XHS","XHT","XHU","XHV","XHW","XHX","XHY","XHZ","XIA","XIB","XIC","XID",
"XIE","XIF","XIG","XIH","XII","XIJ","XIK","XIL","XIM","XIN","XIO","XIP","XIQ","XIR","XIS","XIT",
"XIU","XIV","XIW","XIX","XIY","XIZ","XJA","XJB","XJC","XJD","XJE","XJF","XJG","XJH","XJI","XJJ",
"XJK","XJL","XJM","XJN","XJO","XJP","XJQ","XJR","XJS","XJT","XJU","XJV","XJW","XJX","XJY","XJZ",
"XKA","XKB","XKC","XKD","XKE","XKF","XKG","XKH","XKI","XKJ","XKK","XKL","XKM","XKN","XKO","XKP",
"XKQ","XKR","XKS","XKT","XKU","XKV","XKW","XKX","XKY","XKZ","XLA","XLB","XLC","XLD","XLE","XLF",
"XLG","XLH","XLI","XLJ","XLK","XLL","XLM","XLN","XLO","XLP","XLQ","XLR","XLS","XLT","XLU","XLV",
"XLW","XLX","XLY","XLZ","XMA","XMB","XMC","XMD","XME","XMF","XMG","XMH","XMI","XMJ","XMK","XML",
"XMM","XMN","XMO","XMP","XMQ","XMR","XMS","XMT","XMU","XMV","XMW","XMX","XMY","XMZ","XNA","XNB",
"XNC","XND","XNE","XNF","XNG","XNH","XNI","XNJ","XNK","XNL","XNM","XNN","XNO","XNP","XNQ","XNR",
"XNS","XNT","XNU","XNV","XNW","XNX","XNY","XNZ","XOA","XOB","XOC","XOD","XOE","XOF","XOG","XOH",
"XOI","XOJ","XOK","XOL","XOM","XON","XOO","XOP","XOQ","XOR","XOS","XOT","XOU","XOV","XOW","XOX",
"XOY","XOZ","XPA","XPB","XPC","XPD","XPE","XPF","XPG","XPH","XPI","XPJ","XPK","XPL","XPM","XPN",
"XPO","XPP","XPQ","XPR","XPS","XPT","XPU","XPV","XPW","XPX","XPY","XPZ","XQA","XQB","XQC","XQD",
"XQE","XQF","XQG","XQH","XQI","XQJ","XQK","XQL","XQM","XQN","XQO","XQP","XQQ","XQR","XQS","XQT",
"XQU","XQV","XQW","XQX","XQY","XQZ","XRA","XRB","XRC","XRD","XRE","XRF","XRG","XRH","XRI","XRJ",
"XRK","XRL","XRM","XRN","XRO","XRP","XRQ","XRR","XRS","XRT","XRU","XRV","XRW","XRX","XRY","XRZ",
"XSA","XSB","XSC","XSD","XSE","XSF","XSG","XSH","XSI","XSJ","XSK","XSL","XSM","XSN","XSO","XSP",
"XSQ","XSR","XSS","XST","XSU","XSV","XSW","XSX","XSY","XSZ","XTA","XTB","XTC","XTD","XTE","XTF",
"XTG","XTH","XTI","XTJ","XTK","XTL","XTM","XTN","XTO","XTP","XTQ","XTR","XTS","XTT","XTU","XTV",
"XTW","XTX","XTY","XTZ","XUA","XUB","XUC","XUD","XUE","XUF","XUG","XUH","XUI","XUJ","XUK","XUL",
"XUM","XUN","XUO","XUP","XUQ","XUR","XUS","XUT","XUU","XUV","XUW","XUX","XUY","XUZ","XVA","XVB",
"XVC","XVD","XVE","XVF","XVG","XVH","XVI","XVJ","XVK","XVL","XVM","XVN","XVO","XVP","XVQ","XVR",
"XVS","XVT","XVU","XVV","XVW","XVX","XVY","XVZ","XWA","XWB","XWC","XWD","XWE","XWF","XWG","XWH",
"XWI","XWJ","XWK","XWL","XWM","XWN","XWO","XWP","XWQ","XWR","XWS","XWT","XWU","XWV","XWW","XWX",
"XWY","XWZ","XXA","XXB","XXC","XXD","XXE","XXF","XXG","XXH","XXI","XXJ","XXK","XXL","XXM","XXN",
"XXO","XXP","XXQ","XXR","XXS","XXT","XXU","XXV","XXW","XXX","XXY","XXZ","XYA","XYB","XYC","XYD",
"XYE","XYF","XYG","XYH","XYI","XYJ","XYK","XYL","XYM","XYN","XYO","XYP","XYQ","XYR","XYS","XYT",
"XYU","XYV","XYW","XYX","XYY","XYZ","XZA","XZB","XZC","XZD","XZE","XZF","XZG","XZH","XZI","XZJ",
"XZK","XZL","XZM","XZN","XZO","XZP","XZQ","XZR","XZS","XZT","XZU","XZV","XZW","XZX","XZY","XZZ",
"YAA","YAB","YAC","YAD",
"YAE","YAF","YAG","YAH","YAI","YAJ","YAK","YAL","YAM","YAN","YAO","YAP","YAQ","YAR","YAS","YAT",
"YAU","YAV","YAW","YAX","YAY","YAZ","YBA","YBB","YBC","YBD","YBE","YBF","YBG","YBH","YBI","YBJ",
"YBK","YBL","YBM","YBN","YBO","YBP","YBQ","YBR","YBS","YBT","YBU","YBV","YBW","YBX","YBY","YBZ",
"YCA","YCB","YCC","YCD","YCE","YCF","YCG","YCH","YCI","YCJ","YCK","YCL","YCM","YCN","YCO","YCP",
"YCQ","YCR","YCS","YCT","YCU","YCV","YCW","YCX","YCY","YCZ","YDA","YDB","YDC","YDD","YDE","YDF",
"YDG","YDH","YDI","YDJ","YDK","YDL","YDM","YDN","YDO","YDP","YDQ","YDR","YDS","YDT","YDU","YDV",
"YDW","YDX","YDY","YDZ","YEA","YEB","YEC","YED","YEE","YEF","YEG","YEH","YEI","YEJ","YEK","YEL",
"YEM","YEN","YEO","YEP","YEQ","YER","YES","YET","YEU","YEV","YEW","YEX","YEY","YEZ","YFA","YFB",
"YFC","YFD","YFE","YFF","YFG","YFH","YFI","YFJ","YFK","YFL","YFM","YFN","YFO","YFP","YFQ","YFR",
"YFS","YFT","YFU","YFV","YFW","YFX","YFY","YFZ","YGA","YGB","YGC","YGD","YGE","YGF","YGG","YGH",
"YGI","YGJ","YGK","YGL","YGM","YGN","YGO","YGP","YGQ","YGR","YGS","YGT","YGU","YGV","YGW","YGX",
"YGY","YGZ","YHA","YHB","YHC","YHD","YHE","YHF","YHG","YHH","YHI","YHJ","YHK","YHL","YHM","YHN",
"YHO","YHP","YHQ","YHR","YHS","YHT","YHU","YHV","YHW","YHX","YHY","YHZ","YIA","YIB","YIC","YID",
"YIE","YIF","YIG","YIH","YII","YIJ","YIK","YIL","YIM","YIN","YIO","YIP","YIQ","YIR","YIS","YIT",
"YIU","YIV","YIW","YIX","YIY","YIZ","YJA","YJB","YJC","YJD","YJE","YJF","YJG","YJH","YJI","YJJ",
"YJK","YJL","YJM","YJN","YJO","YJP","YJQ","YJR","YJS","YJT","YJU","YJV","YJW","YJX","YJY","YJZ",
"YKA","YKB","YKC","YKD","YKE","YKF","YKG","YKH","YKI","YKJ","YKK","YKL","YKM","YKN","YKO","YKP",
"YKQ","YKR","YKS","YKT","YKU","YKV","YKW","YKX","YKY","YKZ","YLA","YLB","YLC","YLD","YLE","YLF",
"YLG","YLH","YLI","YLJ","YLK","YLL","YLM","YLN","YLO","YLP","YLQ","YLR","YLS","YLT","YLU","YLV",
"YLW","YLX","YLY","YLZ","YMA","YMB","YMC","YMD","YME","YMF","YMG","YMH","YMI","YMJ","YMK","YML",
"YMM","YMN","YMO","YMP","YMQ","YMR","YMS","YMT","YMU","YMV","YMW","YMX","YMY","YMZ","YNA","YNB",
"YNC","YND","YNE","YNF","YNG","YNH","YNI","YNJ","YNK","YNL","YNM","YNN","YNO","YNP","YNQ","YNR",
"YNS","YNT","YNU","YNV","YNW","YNX","YNY","YNZ","YOA","YOB","YOC","YOD","YOE","YOF","YOG","YOH",
"YOI","YOJ","YOK","YOL","YOM","YON","YOO","YOP","YOQ","YOR","YOS","YOT","YOU","YOV","YOW","YOX",
"YOY","YOZ","YPA","YPB","YPC","YPD","YPE","YPF","YPG","YPH","YPI","YPJ","YPK","YPL","YPM","YPN",
"YPO","YPP","YPQ","YPR","YPS","YPT","YPU","YPV","YPW","YPX","YPY","YPZ","YQA","YQB","YQC","YQD",
"YQE","YQF","YQG","YQH","YQI","YQJ","YQK","YQL","YQM","YQN","YQO","YQP","YQQ","YQR","YQS","YQT",
"YQU","YQV","YQW","YQX","YQY","YQZ","YRA","YRB","YRC","YRD","YRE","YRF","YRG","YRH","YRI","YRJ",
"YRK","YRL","YRM","YRN","YRO","YRP","YRQ","YRR","YRS","YRT","YRU","YRV","YRW","YRX","YRY","YRZ",
"YSA","YSB","YSC","YSD","YSE","YSF","YSG","YSH","YSI","YSJ","YSK","YSL","YSM","YSN","YSO","YSP",
"YSQ","YSR","YSS","YST","YSU","YSV","YSW","YSX","YSY","YSZ","YTA","YTB","YTC","YTD","YTE","YTF",
"YTG","YTH","YTI","YTJ","YTK","YTL","YTM","YTN","YTO","YTP","YTQ","YTR","YTS","YTT","YTU","YTV",
"YTW","YTX","YTY","YTZ","YUA","YUB","YUC","YUD","YUE","YUF","YUG","YUH","YUI","YUJ","YUK","YUL",
"YUM","YUN","YUO","YUP","YUQ","YUR","YUS","YUT","YUU","YUV","YUW","YUX","YUY","YUZ","YVA","YVB",
"YVC","YVD","YVE","YVF","YVG","YVH","YVI","YVJ","YVK","YVL","YVM","YVN","YVO","YVP","YVQ","YVR",
"YVS","YVT","YVU","YVV","YVW","YVX","YVY","YVZ","YWA","YWB","YWC","YWD","YWE","YWF","YWG","YWH",
"YWI","YWJ","YWK","YWL","YWM","YWN","YWO","YWP","YWQ","YWR","YWS","YWT","YWU","YWV","YWW","YWX",
"YWY","YWZ","YXA","YXB","YXC","YXD","YXE","YXF","YXG","YXH","YXI","YXJ","YXK","YXL","YXM","YXN",
"YXO","YXP","YXQ","YXR","YXS","YXT","YXU","YXV","YXW","YXX","YXY","YXZ","YYA","YYB","YYC","YYD",
"YYE","YYF","YYG","YYH","YYI","YYJ","YYK","YYL","YYM","YYN","YYO","YYP","YYQ","YYR","YYS","YYT",
"YYU","YYV","YYW","YYX","YYY","YYZ","YZA","YZB","YZC","YZD","YZE","YZF","YZG","YZH","YZI","YZJ",
"YZK","YZL","YZM","YZN","YZO","YZP","YZQ","YZR","YZS","YZT","YZU","YZV","YZW","YZX","YZY","YZZ",
"ZAA","ZAB","ZAC","ZAD",
"ZAE","ZAF","ZAG","ZAH","ZAI","ZAJ","ZAK","ZAL","ZAM","ZAN","ZAO","ZAP","ZAQ","ZAR","ZAS","ZAT",
"ZAU","ZAV","ZAW","ZAX","ZAY","ZAZ","ZBA","ZBB","ZBC","ZBD","ZBE","ZBF","ZBG","ZBH","ZBI","ZBJ",
"ZBK","ZBL","ZBM","ZBN","ZBO","ZBP","ZBQ","ZBR","ZBS","ZBT","ZBU","ZBV","ZBW","ZBX","ZBY","ZBZ",
"ZCA","ZCB","ZCC","ZCD","ZCE","ZCF","ZCG","ZCH","ZCI","ZCJ","ZCK","ZCL","ZCM","ZCN","ZCO","ZCP",
"ZCQ","ZCR","ZCS","ZCT","ZCU","ZCV","ZCW","ZCX","ZCY","ZCZ","ZDA","ZDB","ZDC","ZDD","ZDE","ZDF",
"ZDG","ZDH","ZDI","ZDJ","ZDK","ZDL","ZDM","ZDN","ZDO","ZDP","ZDQ","ZDR","ZDS","ZDT","ZDU","ZDV",
"ZDW","ZDX","ZDY","ZDZ","ZEA","ZEB","ZEC","ZED","ZEE","ZEF","ZEG","ZEH","ZEI","ZEJ","ZEK","ZEL",
"ZEM","ZEN","ZEO","ZEP","ZEQ","ZER","ZES","ZET","ZEU","ZEV","ZEW","ZEX","ZEY","ZEZ","ZFA","ZFB",
"ZFC","ZFD","ZFE","ZFF","ZFG","ZFH","ZFI","ZFJ","ZFK","ZFL","ZFM","ZFN","ZFO","ZFP","ZFQ","ZFR",
"ZFS","ZFT","ZFU","ZFV","ZFW","ZFX","ZFY","ZFZ","ZGA","ZGB","ZGC","ZGD","ZGE","ZGF","ZGG","ZGH",
"ZGI","ZGJ","ZGK","ZGL","ZGM","ZGN","ZGO","ZGP","ZGQ","ZGR","ZGS","ZGT","ZGU","ZGV","ZGW","ZGX",
"ZGY","ZGZ","ZHA","ZHB","ZHC","ZHD","ZHE","ZHF","ZHG","ZHH","ZHI","ZHJ","ZHK","ZHL","ZHM","ZHN",
"ZHO","ZHP","ZHQ","ZHR","ZHS","ZHT","ZHU","ZHV","ZHW","ZHX","ZHY","ZHZ","ZIA","ZIB","ZIC","ZID",
"ZIE","ZIF","ZIG","ZIH","ZII","ZIJ","ZIK","ZIL","ZIM","ZIN","ZIO","ZIP","ZIQ","ZIR","ZIS","ZIT",
"ZIU","ZIV","ZIW","ZIX","ZIY","ZIZ","ZJA","ZJB","ZJC","ZJD","ZJE","ZJF","ZJG","ZJH","ZJI","ZJJ",
"ZJK","ZJL","ZJM","ZJN","ZJO","ZJP","ZJQ","ZJR","ZJS","ZJT","ZJU","ZJV","ZJW","ZJX","ZJY","ZJZ",
"ZKA","ZKB","ZKC","ZKD","ZKE","ZKF","ZKG","ZKH","ZKI","ZKJ","ZKK","ZKL","ZKM","ZKN","ZKO","ZKP",
"ZKQ","ZKR","ZKS","ZKT","ZKU","ZKV","ZKW","ZKX","ZKY","ZKZ","ZLA","ZLB","ZLC","ZLD","ZLE","ZLF",
"ZLG","ZLH","ZLI","ZLJ","ZLK","ZLL","ZLM","ZLN","ZLO","ZLP","ZLQ","ZLR","ZLS","ZLT","ZLU","ZLV",
"ZLW","ZLX","ZLY","ZLZ","ZMA","ZMB","ZMC","ZMD","ZME","ZMF","ZMG","ZMH","ZMI","ZMJ","ZMK","ZML",
"ZMM","ZMN","ZMO","ZMP","ZMQ","ZMR","ZMS","ZMT","ZMU","ZMV","ZMW","ZMX","ZMY","ZMZ","ZNA","ZNB",
"ZNC","ZND","ZNE","ZNF","ZNG","ZNH","ZNI","ZNJ","ZNK","ZNL","ZNM","ZNN","ZNO","ZNP","ZNQ","ZNR",
"ZNS","ZNT","ZNU","ZNV","ZNW","ZNX","ZNY","ZNZ","ZOA","ZOB","ZOC","ZOD","ZOE","ZOF","ZOG","ZOH",
"ZOI","ZOJ","ZOK","ZOL","ZOM","ZON","ZOO","ZOP","ZOQ","ZOR","ZOS","ZOT","ZOU","ZOV","ZOW","ZOX",
"ZOY","ZOZ","ZPA","ZPB","ZPC","ZPD","ZPE","ZPF","ZPG","ZPH","ZPI","ZPJ","ZPK","ZPL","ZPM","ZPN",
"ZPO","ZPP","ZPQ","ZPR","ZPS","ZPT","ZPU","ZPV","ZPW","ZPX","ZPY","ZPZ","ZQA","ZQB","ZQC","ZQD",
"ZQE","ZQF","ZQG","ZQH","ZQI","ZQJ","ZQK","ZQL","ZQM","ZQN","ZQO","ZQP","ZQQ","ZQR","ZQS","ZQT",
"ZQU","ZQV","ZQW","ZQX","ZQY","ZQZ","ZRA","ZRB","ZRC","ZRD","ZRE","ZRF","ZRG","ZRH","ZRI","ZRJ",
"ZRK","ZRL","ZRM","ZRN","ZRO","ZRP","ZRQ","ZRR","ZRS","ZRT","ZRU","ZRV","ZRW","ZRX","ZRY","ZRZ",
"ZSA","ZSB","ZSC","ZSD","ZSE","ZSF","ZSG","ZSH","ZSI","ZSJ","ZSK","ZSL","ZSM","ZSN","ZSO","ZSP",
"ZSQ","ZSR","ZSS","ZST","ZSU","ZSV","ZSW","ZSX","ZSY","ZSZ","ZTA","ZTB","ZTC","ZTD","ZTE","ZTF",
"ZTG","ZTH","ZTI","ZTJ","ZTK","ZTL","ZTM","ZTN","ZTO","ZTP","ZTQ","ZTR","ZTS","ZTT","ZTU","ZTV",
"ZTW","ZTX","ZTY","ZTZ","ZUA","ZUB","ZUC","ZUD","ZUE","ZUF","ZUG","ZUH","ZUI","ZUJ","ZUK","ZUL",
"ZUM","ZUN","ZUO","ZUP","ZUQ","ZUR","ZUS","ZUT","ZUU","ZUV","ZUW","ZUX","ZUY","ZUZ","ZVA","ZVB",
"ZVC","ZVD","ZVE","ZVF","ZVG","ZVH","ZVI","ZVJ","ZVK","ZVL","ZVM","ZVN","ZVO","ZVP","ZVQ","ZVR",
"ZVS","ZVT","ZVU","ZVV","ZVW","ZVX","ZVY","ZVZ","ZWA","ZWB","ZWC","ZWD","ZWE","ZWF","ZWG","ZWH",
"ZWI","ZWJ","ZWK","ZWL","ZWM","ZWN","ZWO","ZWP","ZWQ","ZWR","ZWS","ZWT","ZWU","ZWV","ZWW","ZWX",
"ZWY","ZWZ","ZXA","ZXB","ZXC","ZXD","ZXE","ZXF","ZXG","ZXH","ZXI","ZXJ","ZXK","ZXL","ZXM","ZXN",
"ZXO","ZXP","ZXQ","ZXR","ZXS","ZXT","ZXU","ZXV","ZXW","ZXX","ZXY","ZXZ","ZYA","ZYB","ZYC","ZYD",
"ZYE","ZYF","ZYG","ZYH","ZYI","ZYJ","ZYK","ZYL","ZYM","ZYN","ZYO","ZYP","ZYQ","ZYR","ZYS","ZYT",
"ZYU","ZYV","ZYW","ZYX","ZYY","ZYZ","ZZA","ZZB","ZZC","ZZD","ZZE","ZZF","ZZG","ZZH","ZZI","ZZJ",
"ZZK","ZZL","ZZM","ZZN","ZZO","ZZP","ZZQ","ZZR","ZZS","ZZT","ZZU","ZZV","ZZW","ZZX","ZZY","ZZZ"
};
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
static char d26[][3] =
{
"AA","AB","AC","AD","AE","AF","AG","AH","AI","AJ","AK","AL","AM","AN","AO","AP",
"AQ","AR","AS","AT","AU","AV","AW","AX","AY","AZ","BA","BB","BC","BD","BE","BF",
"BG","BH","BI","BJ","BK","BL","BM","BN","BO","BP","BQ","BR","BS","BT","BU","BV",
"BW","BX","BY","BZ","CA","CB","CC","CD","CE","CF","CG","CH","CI","CJ","CK","CL",
"CM","CN","CO","CP","CQ","CR","CS","CT","CU","CV","CW","CX","CY","CZ","DA","DB",
"DC","DD","DE","DF","DG","DH","DI","DJ","DK","DL","DM","DN","DO","DP","DQ","DR",
"DS","DT","DU","DV","DW","DX","DY","DZ","EA","EB","EC","ED","EE","EF","EG","EH",
"EI","EJ","EK","EL","EM","EN","EO","EP","EQ","ER","ES","ET","EU","EV","EW","EX",
"EY","EZ","FA","FB","FC","FD","FE","FF","FG","FH","FI","FJ","FK","FL","FM","FN",
"FO","FP","FQ","FR","FS","FT","FU","FV","FW","FX","FY","FZ","GA","GB","GC","GD",
"GE","GF","GG","GH","GI","GJ","GK","GL","GM","GN","GO","GP","GQ","GR","GS","GT",
"GU","GV","GW","GX","GY","GZ","HA","HB","HC","HD","HE","HF","HG","HH","HI","HJ",
"HK","HL","HM","HN","HO","HP","HQ","HR","HS","HT","HU","HV","HW","HX","HY","HZ",
"IA","IB","IC","ID","IE","IF","IG","IH","II","IJ","IK","IL","IM","IN","IO","IP",
"IQ","IR","IS","IT","IU","IV","IW","IX","IY","IZ","JA","JB","JC","JD","JE","JF",
"JG","JH","JI","JJ","JK","JL","JM","JN","JO","JP","JQ","JR","JS","JT","JU","JV",
"JW","JX","JY","JZ","KA","KB","KC","KD","KE","KF","KG","KH","KI","KJ","KK","KL",
"KM","KN","KO","KP","KQ","KR","KS","KT","KU","KV","KW","KX","KY","KZ","LA","LB",
"LC","LD","LE","LF","LG","LH","LI","LJ","LK","LL","LM","LN","LO","LP","LQ","LR",
"LS","LT","LU","LV","LW","LX","LY","LZ","MA","MB","MC","MD","ME","MF","MG","MH",
"MI","MJ","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX",
"MY","MZ","NA","NB","NC","ND","NE","NF","NG","NH","NI","NJ","NK","NL","NM","NN",
"NO","NP","NQ","NR","NS","NT","NU","NV","NW","NX","NY","NZ","OA","OB","OC","OD",
"OE","OF","OG","OH","OI","OJ","OK","OL","OM","ON","OO","OP","OQ","OR","OS","OT",
"OU","OV","OW","OX","OY","OZ","PA","PB","PC","PD","PE","PF","PG","PH","PI","PJ",
"PK","PL","PM","PN","PO","PP","PQ","PR","PS","PT","PU","PV","PW","PX","PY","PZ",
"QA","QB","QC","QD","QE","QF","QG","QH","QI","QJ","QK","QL","QM","QN","QO","QP",
"QQ","QR","QS","QT","QU","QV","QW","QX","QY","QZ","RA","RB","RC","RD","RE","RF",
"RG","RH","RI","RJ","RK","RL","RM","RN","RO","RP","RQ","RR","RS","RT","RU","RV",
"RW","RX","RY","RZ","SA","SB","SC","SD","SE","SF","SG","SH","SI","SJ","SK","SL",
"SM","SN","SO","SP","SQ","SR","SS","ST","SU","SV","SW","SX","SY","SZ","TA","TB",
"TC","TD","TE","TF","TG","TH","TI","TJ","TK","TL","TM","TN","TO","TP","TQ","TR",
"TS","TT","TU","TV","TW","TX","TY","TZ","UA","UB","UC","UD","UE","UF","UG","UH",
"UI","UJ","UK","UL","UM","UN","UO","UP","UQ","UR","US","UT","UU","UV","UW","UX",
"UY","UZ","VA","VB","VC","VD","VE","VF","VG","VH","VI","VJ","VK","VL","VM","VN",
"VO","VP","VQ","VR","VS","VT","VU","VV","VW","VX","VY","VZ","WA","WB","WC","WD",
"WE","WF","WG","WH","WI","WJ","WK","WL","WM","WN","WO","WP","WQ","WR","WS","WT",
"WU","WV","WW","WX","WY","WZ","XA","XB","XC","XD","XE","XF","XG","XH","XI","XJ",
"XK","XL","XM","XN","XO","XP","XQ","XR","XS","XT","XU","XV","XW","XX","XY","XZ",
"YA","YB","YC","YD","YE","YF","YG","YH","YI","YJ","YK","YL","YM","YN","YO","YP",
"YQ","YR","YS","YT","YU","YV","YW","YX","YY","YZ","ZA","ZB","ZC","ZD","ZE","ZF",
"ZG","ZH","ZI","ZJ","ZK","ZL","ZM","ZN","ZO","ZP","ZQ","ZR","ZS","ZT","ZU","ZV",
"ZW","ZX","ZY","ZZ"
};
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Also tabulate 26 base-26 chars.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
static const char *c26 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; /* added const 2007-09-26 DT */
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Weight scheme for check character .
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
#define N_UNIQUE_WEIGHTS 12
static int weights_for_checksum[N_UNIQUE_WEIGHTS] = { 1,3,5,7,9,11,15,17,19,21,23,25 };
/*^^^ co-primes with 26 which are < 26 */
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Get a character representing 1st 14-bit triplet (bits 0..13 of contiguous array of octets)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
const char* base26_triplet_1(const unsigned char *a)
{
UINT32 b0, b1,h;
b0 = (UINT32) a[0]; /* 1111 1111 */
#ifndef FIX_BASE26_ENC_BUG
b1 = (UINT32) ( a[1] & 0x3f ); /* 0011 1111 */
h = (UINT32) ( b0 | b1 << 8 );
#else
b1 = (UINT32) ( a[1] & 0xfc ); /* 1111 1100 */
h = (UINT32) ( b0 << 8 | b1 ) >> 2;
#endif
return t26[h];
}
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Get a character representing 2nd 14-bit triplet (bits 14..27)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
const char* base26_triplet_2(const unsigned char *a)
{
UINT32 b0, b1, b2, h;
#ifndef FIX_BASE26_ENC_BUG
b0 = (UINT32) ( a[1] & 0xc0); /* 1100 0000 */
b1 = (UINT32) ( a[2] ); /* 1111 1111 */
b2 = (UINT32) ( a[3] & 0x0f ); /* 0000 1111 */
h = (UINT32)( b0 | b1 << 8 | b2 << 16 ) >> 6 ;
#else
b0 = (UINT32) ( a[1] & 0x03); /* 0000 0011 */
b1 = (UINT32) ( a[2] ); /* 1111 1111 */
b2 = (UINT32) ( a[3] & 0xf0 ); /* 1111 0000 */
h = (UINT32)( b0 << 16 | b1 << 8 | b2 ) >> 4 ;
#endif
return t26[h];
}
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Get a character representing 3rd 14-bit triplet (bits 28..41)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
const char* base26_triplet_3(const unsigned char *a)
{
UINT32 b0, b1, b2, h;
#ifndef FIX_BASE26_ENC_BUG
b0 = (UINT32) ( a[3] & 0xf0); /* 1111 0000 */
b1 = (UINT32) ( a[4] ); /* 1111 1111 */
b2 = (UINT32) ( a[5] & 0x03 ); /* 0000 0011 */
h = (UINT32) ( b0 | b1 << 8 | b2 << 16 ) >> 4 ;
#else
b0 = (UINT32) ( a[3] & 0x0f); /* 0000 1111 */
b1 = (UINT32) ( a[4] ); /* 1111 1111 */
b2 = (UINT32) ( a[5] & 0xc0 ); /* 1100 0000 */
h = (UINT32) ( b0 << 16 | b1 << 8 | b2 ) >> 6 ;
#endif
return t26[h];
}
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Get a character representing 4th 14-bit triplet (bits 42..55)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
const char* base26_triplet_4(const unsigned char *a)
{
UINT32 b0, b1, h;
#ifndef FIX_BASE26_ENC_BUG
b0 = (UINT32) ( a[5] & 0xfc); /* 1111 1100 */
b1 = (UINT32) ( a[6] ); /* 1111 1111 */
h = (UINT32) ( b0 | b1 << 8 ) >> 2 ;
#else
b0 = (UINT32) ( a[5] & 0x3f); /* 0011 1111 */
b1 = (UINT32) ( a[6] ); /* 1111 1111 */
h = (UINT32) ( b0 << 8 | b1 ) ;
#endif
return t26[h];
}
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Tail dublets
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
a4 a3 a2 a1 a0
28-36: 0001 1111 1111 0000 0000 0000 0000 0000 0000 0000
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Get dublet (bits 28..36)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
const char* base26_dublet_for_bits_28_to_36(unsigned char *a)
{
UINT32 b0, b1, h;
#ifndef FIX_BASE26_ENC_BUG
b0 = (UINT32) ( a[3] & 0xf0); /* 1111 0000 */
b1 = (UINT32) ( a[4] & 0x1f ); /* 0001 1111 */
h = (UINT32)( b0 | b1 << 8 ) >> 4 ;
#else
b0 = (UINT32) ( a[3] & 0x0f); /* 0000 1111 */
b1 = (UINT32) ( a[4] & 0xf8 ); /* 1111 1000 */
h = (UINT32)( b0 << 8 | b1 ) >> 3 ;
#endif
return d26[h];
}
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
a9 a8 a7
56-64: 0000 0000 0000 0001 1111 1111
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Get dublet (bits 56..64)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
const char* base26_dublet_for_bits_56_to_64(unsigned char *a)
{
UINT32 b0, b1, h;
#ifndef FIX_BASE26_ENC_BUG
b0 = (UINT32) ( a[7] ); /* 1111 1111 */
b1 = (UINT32) ( a[8] & 0x01 ); /* 0000 0001 */
h = (UINT32)( b0 | b1 << 8 );
#else
b0 = (UINT32) ( a[7] ); /* 1111 1111 */
b1 = (UINT32) ( a[8] & 0x80 ); /* 1000 0000 */
h = (UINT32)( b0 << 8 | b1 ) >> 7;
#endif
return d26[h];
}
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Calculate check character A..Z for the string.
NB: ignore delimiter dashes.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
char base26_checksum(const char *str)
{
size_t slen, j, jj=0, checksum = 0;
char c;
slen = strlen(str);
for (j=0; j < slen; j++)
{
c = str[j];
if (c=='-')
continue;
checksum+= weights_for_checksum[jj]*c;
jj++;
if (jj > N_UNIQUE_WEIGHTS - 1)
jj = 0;
}
return c26[checksum%26];
}
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Get hash extension in hexadecimal representation for the major block.
Len(extension) = 256 - 65 = 191 bit.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
void get_xtra_hash_major_hex(const unsigned char *a, char* szXtra)
{
unsigned char c;
int i, j, start_byte=8;
#ifndef FIX_BASE26_ENC_BUG
c = a[start_byte] & 0xfe ; /* 1111 1110 */
#else
c = a[start_byte] & 0x7f ; /* 0111 1111 */
#endif
j = sprintf(szXtra,"%02x", c);
for( i = start_byte+1; i < 32; i++ )
j+= sprintf(szXtra+j,"%02x", a[i]);
}
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Get hash extension in hexadecimal representation for the minor block.
Len(extension) = 256 - 37 = 219 bit.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
void get_xtra_hash_minor_hex(const unsigned char *a, char* szXtra)
{
unsigned char c;
int i, j, start_byte=4;
#ifndef FIX_BASE26_ENC_BUG
c = a[start_byte] & 0xe0 ; /* 1110 0000 */
#else
c = a[start_byte] & 0x07 ; /* 0000 0111 */
#endif
j = sprintf(szXtra,"%02x", c);
for( i = start_byte+1; i < 32; i++ )
j+= sprintf(szXtra+j,"%02x", a[i]);
}
| 82.640088 | 96 | 0.484407 |
1619370d18ee56ed4ebe406bdb1664648f885bdf | 931 | c | C | ncarg2d/src/libncarg/ezmapCC/c_mdprst.c | tenomoto/ncl | a87114a689a1566e9aa03d85bcf6dc7325b47633 | [
"Apache-2.0"
] | 210 | 2016-11-24T09:05:08.000Z | 2022-03-24T19:15:32.000Z | ncarg2d/src/libncarg/ezmapCC/c_mdprst.c | tenomoto/ncl | a87114a689a1566e9aa03d85bcf6dc7325b47633 | [
"Apache-2.0"
] | 156 | 2017-09-22T09:56:48.000Z | 2022-03-30T07:02:21.000Z | ncarg2d/src/libncarg/ezmapCC/c_mdprst.c | tenomoto/ncl | a87114a689a1566e9aa03d85bcf6dc7325b47633 | [
"Apache-2.0"
] | 58 | 2016-12-14T00:15:22.000Z | 2022-03-15T09:13:00.000Z | /*
* $Id: c_mdprst.c,v 1.2 2008-07-23 16:16:51 haley Exp $
*/
/************************************************************************
* *
* Copyright (C) 2000 *
* University Corporation for Atmospheric Research *
* All Rights Reserved *
* *
* The use of this Software is governed by a License Agreement. *
* *
************************************************************************/
#include <ncarg/ncargC.h>
extern void NGCALLF(mdprst,MDPRST)(int*);
void c_mdprst
#ifdef NeedFuncProto
(
int ifno
)
#else
(ifno)
int ifno;
#endif
{
NGCALLF(mdprst,MDPRST)(&ifno);
}
| 31.033333 | 73 | 0.311493 |
e9435bbfe30dc60215dac0dbe4c50b6949f77141 | 131 | h | C | main/main.h | mlytvyn80/nucleo-f103rb-cmsis-template | f146860aa10554608c94534c9b9c13116eb6b235 | [
"MIT"
] | 1 | 2020-07-05T07:29:13.000Z | 2020-07-05T07:29:13.000Z | main/main.h | mlytvyn80/nucleo-f103rb-cmsis-template | f146860aa10554608c94534c9b9c13116eb6b235 | [
"MIT"
] | null | null | null | main/main.h | mlytvyn80/nucleo-f103rb-cmsis-template | f146860aa10554608c94534c9b9c13116eb6b235 | [
"MIT"
] | 1 | 2020-10-07T05:52:20.000Z | 2020-10-07T05:52:20.000Z | //
// Created by Itachi on 2019-05-08.
//
#ifndef MYST_MAIN_H
#define MYST_MAIN_H
void clock_config(void);
#endif //MYST_MAIN_H
| 11.909091 | 35 | 0.725191 |
ac0b255331fc88d4a494ecb3ca3e02beff5fde9f | 90 | h | C | datapath/linux/compat/include/linux/PaxHeaders.47482/in.h | xiaobinglu/openvswitch | b206a49997a51909d73fd5c11784c17aa885f76b | [
"Apache-2.0"
] | null | null | null | datapath/linux/compat/include/linux/PaxHeaders.47482/in.h | xiaobinglu/openvswitch | b206a49997a51909d73fd5c11784c17aa885f76b | [
"Apache-2.0"
] | null | null | null | datapath/linux/compat/include/linux/PaxHeaders.47482/in.h | xiaobinglu/openvswitch | b206a49997a51909d73fd5c11784c17aa885f76b | [
"Apache-2.0"
] | null | null | null | 30 mtime=1434842301.108108323
30 atime=1440176505.863228567
30 ctime=1440177386.193358395
| 22.5 | 29 | 0.866667 |
b1c6f70e323f0e8e9dcfaf80a2bcd0fab362b015 | 6,338 | c | C | gala-gopher/src/probes/extends/ebpf.probe/src/endpointprobe/endpoint.bpf.c | openeuler-mirror/A-Ops | e6b75797852e81fa504ecf04c3be499a92fa9146 | [
"MulanPSL-1.0"
] | null | null | null | gala-gopher/src/probes/extends/ebpf.probe/src/endpointprobe/endpoint.bpf.c | openeuler-mirror/A-Ops | e6b75797852e81fa504ecf04c3be499a92fa9146 | [
"MulanPSL-1.0"
] | null | null | null | gala-gopher/src/probes/extends/ebpf.probe/src/endpointprobe/endpoint.bpf.c | openeuler-mirror/A-Ops | e6b75797852e81fa504ecf04c3be499a92fa9146 | [
"MulanPSL-1.0"
] | null | null | null | #ifdef BPF_PROG_USER
#undef BPF_PROG_USER
#endif
#define BPF_PROG_KERN
#include "bpf.h"
#include "endpoint.h"
#define BIG_INDIAN_SK_FL_PROTO_SHIFT 16
#define BIG_INDIAN_SK_FL_PROTO_MASK 0x00ff0000
#define LITTLE_INDIAN_SK_FL_PROTO_SHIFT 8
#define LITTLE_INDIAN_SK_FL_PROTO_MASK 0x0000ff00
char LICENSE[] SEC("license") = "GPL";
struct bpf_map_def SEC("maps") endpoint_map = {
.type = BPF_MAP_TYPE_HASH,
.key_size = sizeof(struct endpoint_key_t),
.value_size = sizeof(struct endpoint_val_t),
.max_entries = MAX_ENDPOINT_LEN,
};
struct bpf_map_def SEC("maps") socket_map = {
.type = BPF_MAP_TYPE_HASH,
.key_size = sizeof(u32),
.value_size = sizeof(unsigned long),
.max_entries = MAX_ENTRIES,
};
static int is_little_endian()
{
int i = 1;
return (int)*((char *)&i) == 1;
}
static void add_item_to_sockmap(unsigned long val)
{
u32 tid = bpf_get_current_pid_tgid();
bpf_map_update_elem(&socket_map, &tid, &val, BPF_ANY);
return;
}
static void* get_item_from_sockmap()
{
u32 tid = bpf_get_current_pid_tgid();
return bpf_map_lookup_elem(&socket_map, &tid);
}
static void init_ep_key(struct endpoint_key_t *ep_key, unsigned long sock_p)
{
u32 pid = bpf_get_current_pid_tgid() >> 32;
ep_key->pid = pid;
ep_key->sock_p = sock_p;
return;
}
static void init_ep_val(struct endpoint_val_t *ep_val, struct socket *sock)
{
struct sock *sk = _(sock->sk);
unsigned int sk_flags_offset;
ep_val->type = SK_TYPE_INIT;
ep_val->uid = bpf_get_current_uid_gid();
bpf_get_current_comm(&ep_val->comm, sizeof(ep_val->comm));
ep_val->s_type = _(sock->type);
ep_val->family = _(sk->sk_family);
bpf_probe_read(&sk_flags_offset, sizeof(unsigned int), sk->__sk_flags_offset);
if (is_little_endian()) {
ep_val->protocol = (sk_flags_offset & LITTLE_INDIAN_SK_FL_PROTO_MASK) >> LITTLE_INDIAN_SK_FL_PROTO_SHIFT;
} else {
ep_val->protocol = (sk_flags_offset & BIG_INDIAN_SK_FL_PROTO_MASK) >> BIG_INDIAN_SK_FL_PROTO_SHIFT;
}
return;
}
KPROBE(__sock_create, pt_regs)
{
int type = (int)PT_REGS_PARM3(ctx);
struct socket **res = (struct socket **)PT_REGS_PARM5(ctx);
int kern = (int)PT_REGS_PARM6(ctx);
u32 tid = bpf_get_current_pid_tgid();
if (kern != 0) {
return;
}
if (type != SOCK_STREAM && type != SOCK_DGRAM) {
return;
}
add_item_to_sockmap((unsigned long)res);
bpf_printk("====[tid=%u]: start creating new socket\n", tid);
return;
}
KRETPROBE(__sock_create, pt_regs)
{
int ret = PT_REGS_RC(ctx);
struct socket ***sockppp;
struct socket *sock;
struct endpoint_key_t ep_key = {0};
struct endpoint_val_t ep_val = {0};
u32 tid = bpf_get_current_pid_tgid();
long err;
if (ret < 0) {
goto cleanup;
}
sockppp = (struct socket ***)get_item_from_sockmap();
if (!sockppp) {
return;
}
sock = _(**sockppp);
init_ep_key(&ep_key, (unsigned long)sock);
init_ep_val(&ep_val, sock);
err = bpf_map_update_elem(&endpoint_map, &ep_key, &ep_val, BPF_ANY);
if (err < 0) {
bpf_printk("====[tid=%u]: new endpoint update to map failed\n", tid);
goto cleanup;
}
bpf_printk("====[tid=%u]: new endpoint created.\n", tid);
cleanup:
bpf_map_delete_elem(&socket_map, &tid);
return;
}
KPROBE(inet_bind, pt_regs)
{
struct socket *sock = (struct socket*)PT_REGS_PARM1(ctx);
add_item_to_sockmap((unsigned long)sock);
bpf_printk("====[tid=%u]: start binding endpoint.\n", (u32)bpf_get_current_pid_tgid());
return;
}
KRETPROBE(inet_bind, pt_regs)
{
int ret = PT_REGS_RC(ctx);
struct socket **sockpp;
struct socket *sock;
struct sock *sk;
int type;
struct endpoint_key_t ep_key = {0};
struct endpoint_val_t *ep_val;
u32 tid = bpf_get_current_pid_tgid();
if (ret != 0) {
goto cleanup;
}
sockpp = (struct socket **)get_item_from_sockmap();
if (!sockpp) {
return;
}
sock = *sockpp;
sk = _(sock->sk);
init_ep_key(&ep_key, (unsigned long)sock);
ep_val = (struct endpoint_val_t *)bpf_map_lookup_elem(&endpoint_map, &ep_key);
if (!ep_val) {
bpf_printk("====[tid=%u]: endpoint can not find.\n", tid);
goto cleanup;
}
struct ip *ip_addr = (struct ip*)&(ep_val->s_addr);
if (ep_val->family == AF_INET) {
ip_addr->ip4 = _(sk->sk_rcv_saddr);
} else if (ep_val->family == AF_INET6) {
bpf_probe_read(ip_addr->ip6, IP6_LEN, &sk->sk_v6_rcv_saddr);
}
ep_val->s_port = _(sk->sk_num);
type = _(sock->type);
if (type == SOCK_DGRAM) {
if (ep_val) {
ep_val->type = SK_TYPE_LISTEN_UDP;
bpf_printk("====[tid=%u]: endpoint has been set to udp listening state.\n", tid);
}
}
cleanup:
bpf_map_delete_elem(&socket_map, &tid);
return;
}
KPROBE(inet_listen, pt_regs)
{
struct socket *sock = (struct socket*)PT_REGS_PARM1(ctx);
add_item_to_sockmap((unsigned long)sock);
bpf_printk("====[tid=%u]: start listening endpoint.\n", (u32)bpf_get_current_pid_tgid());
return;
}
KRETPROBE(inet_listen, pt_regs)
{
int ret = PT_REGS_RC(ctx);
struct socket **sockpp;
struct socket *sock;
struct endpoint_key_t ep_key = {0};
struct endpoint_val_t *ep_val;
u32 tid = bpf_get_current_pid_tgid();
long err;
if (ret != 0) {
goto cleanup;
}
sockpp = (struct socket **)get_item_from_sockmap();
if (!sockpp) {
return;
}
sock = *sockpp;
init_ep_key(&ep_key, (unsigned long)sock);
ep_val = (struct endpoint_val_t *)bpf_map_lookup_elem(&endpoint_map, &ep_key);
if (ep_val) {
ep_val->type = SK_TYPE_LISTEN_TCP;
bpf_printk("====[tid=%u]: endpoint has been set to tcp listening state.\n", tid);
}
cleanup:
bpf_map_delete_elem(&socket_map, &tid);
return;
}
KPROBE(__sock_release, pt_regs)
{
struct socket *sock = (struct socket*)PT_REGS_PARM1(ctx);
struct endpoint_key_t ep_key = {0};
u32 tid = bpf_get_current_pid_tgid();
long err;
init_ep_key(&ep_key, (unsigned long)sock);
err = bpf_map_delete_elem(&endpoint_map, &ep_key);
if (!err) {
bpf_printk("====[tid=%u]: endpoint has been removed.\n", tid);
}
return;
} | 26.298755 | 113 | 0.647365 |
75153c58cae324c31e5dff918f7bfdfa4b81f660 | 200 | h | C | alg/string/search_naive.h | mirazabal/alg_ds | c70b0ece10fff64625e0235a0f8ce86fc5fef572 | [
"MIT"
] | null | null | null | alg/string/search_naive.h | mirazabal/alg_ds | c70b0ece10fff64625e0235a0f8ce86fc5fef572 | [
"MIT"
] | null | null | null | alg/string/search_naive.h | mirazabal/alg_ds | c70b0ece10fff64625e0235a0f8ce86fc5fef572 | [
"MIT"
] | null | null | null | #ifndef NAIVE_SEARCH_ALG_H
#define NAIVE_SEARCH_ALG_H
#include <stddef.h>
char* search_naive(size_t len_needle, char needle[len_needle], size_t len_haystack, char haystack[len_haystack]);
#endif
| 20 | 113 | 0.805 |
ceded9b27b48af16d188ed935fe3bb51c01cae6c | 2,504 | c | C | rdp/scene5.c | kbeckmann/n64fun | c424bab970882e68016d0ac17ba7329891a1828d | [
"MIT"
] | 3 | 2021-09-21T18:07:04.000Z | 2021-11-13T09:00:03.000Z | rdp/scene5.c | kbeckmann/n64fun | c424bab970882e68016d0ac17ba7329891a1828d | [
"MIT"
] | 1 | 2021-10-16T18:04:34.000Z | 2021-10-16T20:57:39.000Z | rdp/scene5.c | kbeckmann/n64fun | c424bab970882e68016d0ac17ba7329891a1828d | [
"MIT"
] | null | null | null | // Copyright (c) 2021 Konrad Beckmann
// SPDX-License-Identifier: MIT
#include "common.h"
// 4x supersampling test. Super slow.
void scene5(display_context_t disp, uint32_t t[8])
{
if (__width != 512 || __height != 240 || __bitdepth != 2) {
// unsupported resolution
return;
}
static int initialized;
static uint8_t *scene_data_start;
static uint8_t *scene_data;
if (!initialized) {
initialized = 1;
scene_data_start = niccc_get_data();
scene_data = scene_data_start;
}
struct controller_data keys = get_keys_pressed();
if (keys.c[0].start) {
// Reset when pressing start
scene_data = scene_data_start;
}
t[1] = TICKS_READ();
#define buf_w (512*2)
#define buf_h (240*2)
static uint16_t off_buf[buf_w * buf_h] __attribute__((aligned(64)));
rdp_sync(SYNC_PIPE);
rdp_set_clipping( 0, 0, buf_w-1, buf_h-1 );
rdp_attach_buffer(off_buf, buf_w);
render_niccc(&scene_data, buf_w-1, buf_h);
t[2] = TICKS_READ();
uint16_t *fb = __get_buffer(disp);
// Perform 1:2 bilinear downscaling (slow)
for (int y = 0; y < __height; y++) {
// Source
uint16_t *row0_s = &off_buf[buf_w * (2*y)];
uint16_t *row1_s = &off_buf[buf_w * (2*y + 1)];
// Destination
uint16_t *row_d = &fb[__width * y];
for (int x = 0; x < __width; x++) {
uint16_t samp00 = row0_s[2*x];
uint16_t samp01 = row0_s[2*x+1];
uint16_t samp10 = row1_s[2*x];
uint16_t samp11 = row1_s[2*x+1];
#define GET_R(_x) (((_x) >> (1 + 5 + 5)) & 0x1F)
#define GET_G(_x) (((_x) >> (1 + 5 )) & 0x1F)
#define GET_B(_x) (((_x) >> (1 )) & 0x1F)
#define SET_R(_x) (((_x) & 0x1F) << (1 + 5 + 5))
#define SET_G(_x) (((_x) & 0x1F) << (1 + 5 ))
#define SET_B(_x) (((_x) & 0x1F) << (1 ))
uint16_t col = (
SET_R((GET_R(samp00) + GET_R(samp01) + GET_R(samp10) + GET_R(samp11)) / 4) |
SET_G((GET_G(samp00) + GET_G(samp01) + GET_G(samp10) + GET_G(samp11)) / 4) |
SET_B((GET_B(samp00) + GET_B(samp01) + GET_B(samp10) + GET_B(samp11)) / 4) |
1
);
row_d[x] = col;
// row_d[x] = samp00;
// row_d[x] = SET_R(x) | SET_G(y) | 1;
}
}
t[3] = TICKS_READ();
t[4] = t[5] = t[6] = t[7] = TICKS_READ();
}
| 29.458824 | 92 | 0.521166 |
0e208f895ad946bf04c526b822378cc6dc092242 | 2,421 | h | C | System/Library/PrivateFrameworks/ContentKit.framework/WFContentAttribution.h | lechium/tvOS142Headers | c7696f6d760e4822f61b9f2c2adcd18749700fda | [
"MIT"
] | 1 | 2020-11-11T06:05:23.000Z | 2020-11-11T06:05:23.000Z | System/Library/PrivateFrameworks/ContentKit.framework/WFContentAttribution.h | lechium/tvOS142Headers | c7696f6d760e4822f61b9f2c2adcd18749700fda | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/ContentKit.framework/WFContentAttribution.h | lechium/tvOS142Headers | c7696f6d760e4822f61b9f2c2adcd18749700fda | [
"MIT"
] | null | null | null | /*
* This header is generated by classdump-dyld 1.5
* on Tuesday, November 10, 2020 at 10:20:14 PM Mountain Standard Time
* Operating System: Version 14.2 (Build 18K57)
* Image Source: /System/Library/PrivateFrameworks/ContentKit.framework/ContentKit
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley.
*/
#import <libobjc.A.dylib/NSSecureCoding.h>
#import <libobjc.A.dylib/WFSerializableContent.h>
@class LSApplicationProxy, NSString;
@interface WFContentAttribution : NSObject <NSSecureCoding, WFSerializableContent> {
unsigned long long _disclosureLevel;
unsigned long long _managedLevel;
}
@property (nonatomic,readonly) LSApplicationProxy * app;
@property (nonatomic,readonly) unsigned long long disclosureLevel; //@synthesize disclosureLevel=_disclosureLevel - In the implementation block
@property (nonatomic,readonly) unsigned long long managedLevel; //@synthesize managedLevel=_managedLevel - In the implementation block
@property (readonly) unsigned long long hash;
@property (readonly) Class superclass;
@property (copy,readonly) NSString * description;
@property (copy,readonly) NSString * debugDescription;
+(BOOL)supportsSecureCoding;
+(id)objectWithWFSerializedRepresentation:(id)arg1 ;
+(id)attributionWithAccountBasedBundleIdentifier:(id)arg1 accountIdentifier:(id)arg2 disclosureLevel:(unsigned long long)arg3 ;
+(id)attributionWithDisclosureLevel:(unsigned long long)arg1 managedLevel:(unsigned long long)arg2 ;
+(id)attributionWithBundleIdentifier:(id)arg1 disclosureLevel:(unsigned long long)arg2 ;
+(id)attributionWithBundleIdentifier:(id)arg1 accountIdentifier:(id)arg2 disclosureLevel:(unsigned long long)arg3 managedLevel:(unsigned long long)arg4 ;
+(id)shortcutsAppAttribution;
+(id)shortcutsAppAttributionWithDisclosureLevel:(unsigned long long)arg1 ;
-(LSApplicationProxy *)app;
-(BOOL)isEqual:(id)arg1 ;
-(unsigned long long)hash;
-(id)localizedDescription;
-(void)encodeWithCoder:(id)arg1 ;
-(id)initWithCoder:(id)arg1 ;
-(id)wfSerializedRepresentation;
-(unsigned long long)managedLevel;
-(id)attributionIdentifier;
-(id)initWithDisclosureLevel:(unsigned long long)arg1 managedLevel:(unsigned long long)arg2 ;
-(unsigned long long)disclosureLevel;
@end
| 49.408163 | 156 | 0.750929 |
cdf75867d34095e4ee6f2955e9fcde83cf5f863e | 1,421 | h | C | source/common/filesystem/w_zip.h | prg318/Raze | 4ff4fa643bcea6a19a6cce5f06dd436c454b88f3 | [
"RSA-MD"
] | 5 | 2021-07-31T03:34:09.000Z | 2021-08-31T21:43:50.000Z | source/common/filesystem/w_zip.h | Quake-Backup/Raze | 16c81f0b1f409436ebf576d2c23f2459a29b34b4 | [
"RSA-MD"
] | null | null | null | source/common/filesystem/w_zip.h | Quake-Backup/Raze | 16c81f0b1f409436ebf576d2c23f2459a29b34b4 | [
"RSA-MD"
] | null | null | null | #ifndef __W_ZIP
#define __W_ZIP
#include "basics.h"
#pragma pack(1)
// FZipCentralInfo
struct FZipEndOfCentralDirectory
{
uint32_t Magic;
uint16_t DiskNumber;
uint16_t FirstDisk;
uint16_t NumEntries;
uint16_t NumEntriesOnAllDisks;
uint32_t DirectorySize;
uint32_t DirectoryOffset;
uint16_t ZipCommentLength;
} FORCE_PACKED;
// FZipFileInfo
struct FZipCentralDirectoryInfo
{
uint32_t Magic;
uint8_t VersionMadeBy[2];
uint8_t VersionToExtract[2];
uint16_t Flags;
uint16_t Method;
uint16_t ModTime;
uint16_t ModDate;
uint32_t CRC32;
uint32_t CompressedSize;
uint32_t UncompressedSize;
uint16_t NameLength;
uint16_t ExtraLength;
uint16_t CommentLength;
uint16_t StartingDiskNumber;
uint16_t InternalAttributes;
uint32_t ExternalAttributes;
uint32_t LocalHeaderOffset;
// file name and other variable length info follows
} FORCE_PACKED;
// FZipLocalHeader
struct FZipLocalFileHeader
{
uint32_t Magic;
uint8_t VersionToExtract[2];
uint16_t Flags;
uint16_t Method;
uint16_t ModTime;
uint16_t ModDate;
uint32_t CRC32;
uint32_t CompressedSize;
uint32_t UncompressedSize;
uint16_t NameLength;
uint16_t ExtraLength;
// file name and other variable length info follows
} FORCE_PACKED;
#pragma pack()
#define ZIP_LOCALFILE MAKE_ID('P','K',3,4)
#define ZIP_CENTRALFILE MAKE_ID('P','K',1,2)
#define ZIP_ENDOFDIR MAKE_ID('P','K',5,6)
// File header flags.
#define ZF_ENCRYPTED 0x1
#endif
| 20.014085 | 52 | 0.7924 |
078f90d8e17bbed194347820a06bf5e035ce281d | 2,695 | h | C | export/windows/obj/include/openfl/_internal/renderer/cairo/CairoTextField.h | arturspon/zombie-killer | 07848c5006916e9079537a3d703ffe3740afaa5a | [
"MIT"
] | null | null | null | export/windows/obj/include/openfl/_internal/renderer/cairo/CairoTextField.h | arturspon/zombie-killer | 07848c5006916e9079537a3d703ffe3740afaa5a | [
"MIT"
] | null | null | null | export/windows/obj/include/openfl/_internal/renderer/cairo/CairoTextField.h | arturspon/zombie-killer | 07848c5006916e9079537a3d703ffe3740afaa5a | [
"MIT"
] | 1 | 2021-07-16T22:57:01.000Z | 2021-07-16T22:57:01.000Z | // Generated by Haxe 4.0.0-rc.2+77068e10c
#ifndef INCLUDED_openfl__internal_renderer_cairo_CairoTextField
#define INCLUDED_openfl__internal_renderer_cairo_CairoTextField
#ifndef HXCPP_H
#include <hxcpp.h>
#endif
HX_DECLARE_CLASS4(openfl,_internal,renderer,cairo,CairoTextField)
HX_DECLARE_CLASS2(openfl,display,CairoRenderer)
HX_DECLARE_CLASS2(openfl,display,DisplayObject)
HX_DECLARE_CLASS2(openfl,display,DisplayObjectRenderer)
HX_DECLARE_CLASS2(openfl,display,IBitmapDrawable)
HX_DECLARE_CLASS2(openfl,display,InteractiveObject)
HX_DECLARE_CLASS2(openfl,events,EventDispatcher)
HX_DECLARE_CLASS2(openfl,events,IEventDispatcher)
HX_DECLARE_CLASS2(openfl,geom,Matrix)
HX_DECLARE_CLASS2(openfl,text,TextField)
namespace openfl{
namespace _internal{
namespace renderer{
namespace cairo{
class HXCPP_CLASS_ATTRIBUTES CairoTextField_obj : public hx::Object
{
public:
typedef hx::Object super;
typedef CairoTextField_obj OBJ_;
CairoTextField_obj();
public:
enum { _hx_ClassId = 0x76dbe9c2 };
void __construct();
inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="openfl._internal.renderer.cairo.CairoTextField")
{ return hx::Object::operator new(inSize,inContainer,inName); }
inline void *operator new(size_t inSize, int extra)
{ return hx::Object::operator new(inSize+extra,false,"openfl._internal.renderer.cairo.CairoTextField"); }
hx::ObjectPtr< CairoTextField_obj > __new() {
hx::ObjectPtr< CairoTextField_obj > __this = new CairoTextField_obj();
__this->__construct();
return __this;
}
static hx::ObjectPtr< CairoTextField_obj > __alloc(hx::Ctx *_hx_ctx) {
CairoTextField_obj *__this = (CairoTextField_obj*)(hx::Ctx::alloc(_hx_ctx, sizeof(CairoTextField_obj), false, "openfl._internal.renderer.cairo.CairoTextField"));
*(void **)__this = CairoTextField_obj::_hx_vtable;
return __this;
}
static void * _hx_vtable;
static Dynamic __CreateEmpty();
static Dynamic __Create(hx::DynamicArray inArgs);
//~CairoTextField_obj();
HX_DO_RTTI_ALL;
static bool __GetStatic(const ::String &inString, Dynamic &outValue, hx::PropertyAccess inCallProp);
static void __register();
bool _hx_isInstanceOf(int inClassId);
::String __ToString() const { return HX_("CairoTextField",45,17,7a,57); }
static void __boot();
static ::Dynamic __meta__;
static void render( ::openfl::text::TextField textField, ::openfl::display::CairoRenderer renderer, ::openfl::geom::Matrix transform);
static ::Dynamic render_dyn();
};
} // end namespace openfl
} // end namespace _internal
} // end namespace renderer
} // end namespace cairo
#endif /* INCLUDED_openfl__internal_renderer_cairo_CairoTextField */
| 34.551282 | 164 | 0.78256 |
07c6aad988ce81a5b29839b6d87ad7ed4e139047 | 4,619 | h | C | src/components/sde/interface/papi_sde_interface.h | cothan/PAPI_ARMv8_Cortex_A72 | 2f9d855f1d202b744984f8f24ab5f3f18e15988d | [
"BSD-3-Clause"
] | 4 | 2020-09-18T05:38:40.000Z | 2021-07-16T06:21:51.000Z | src/components/sde/interface/papi_sde_interface.h | cothan/PAPI_ARMv8_Cortex_A72 | 2f9d855f1d202b744984f8f24ab5f3f18e15988d | [
"BSD-3-Clause"
] | 1 | 2021-07-03T08:05:50.000Z | 2021-07-03T09:03:38.000Z | src/components/sde/interface/papi_sde_interface.h | cothan/PAPI_ARMv8_Cortex_A72 | 2f9d855f1d202b744984f8f24ab5f3f18e15988d | [
"BSD-3-Clause"
] | 1 | 2021-12-27T06:12:22.000Z | 2021-12-27T06:12:22.000Z | #ifndef PAPI_SDE_INTERFACE_H
#define PAPI_SDE_INTERFACE_H
#include <stdint.h>
#define PAPI_SDE_RO 0x00
#define PAPI_SDE_RW 0x01
#define PAPI_SDE_DELTA 0x00
#define PAPI_SDE_INSTANT 0x10
#define PAPI_SDE_long_long 0x0
#define PAPI_SDE_int 0x1
#define PAPI_SDE_double 0x2
#define PAPI_SDE_float 0x3
#define PAPI_SDE_SUM 0x0
#define PAPI_SDE_MAX 0x1
#define PAPI_SDE_MIN 0x2
#define GET_FLOAT_SDE(x) *((float *)&x)
#define GET_DOUBLE_SDE(x) *((double *)&x)
/*
* GET_SDE_RECORDER_ADDRESS() USAGE EXAMPLE:
* If SDE recorder logs values of type 'double':
* double *ptr = GET_SDE_RECORDER_ADDRESS(papi_event_value[6], double);
* for (j=0; j<CNT; j++)
* printf(" %d: %.4e\n",j, ptr[j]);
*/
#define GET_SDE_RECORDER_ADDRESS(x,rcrd_type) ((rcrd_type *)x)
typedef long long int (*papi_sde_fptr_t)( void * );
typedef int (*papi_sde_cmpr_fptr_t)( void * );
typedef void * papi_handle_t;
#ifdef __cplusplus
extern "C" {
#endif
typedef struct papi_sde_fptr_struct_s {
papi_handle_t (*init)(const char *lib_name );
int (*register_counter)( papi_handle_t handle, const char *event_name, int mode, int type, void *counter );
int (*register_fp_counter)( papi_handle_t handle, const char *event_name, int mode, int type, papi_sde_fptr_t fp_counter, void *param );
int (*unregister_counter)( papi_handle_t handle, const char *event_name );
int (*describe_counter)( papi_handle_t handle, const char *event_name, const char *event_description );
int (*add_counter_to_group)( papi_handle_t handle, const char *event_name, const char *group_name, uint32_t group_flags );
int (*create_counter)( papi_handle_t handle, const char *event_name, int cntr_type, void **cntr_handle );
int (*inc_counter)( papi_handle_t cntr_handle, long long int increment );
int (*create_recorder)( papi_handle_t handle, const char *event_name, size_t typesize, int (*cmpr_func_ptr)(const void *p1, const void *p2), void **record_handle );
int (*record)( void *record_handle, size_t typesize, void *value );
int (*reset_recorder)(void *record_handle );
int (*reset_counter)( void *cntr_handle );
void *(*get_counter_handle)(papi_handle_t handle, const char *event_name);
}papi_sde_fptr_struct_t;
papi_handle_t papi_sde_init(const char *name_of_library );
int papi_sde_register_counter(papi_handle_t handle, const char *event_name, int cntr_mode, int cntr_type, void *counter );
int papi_sde_register_fp_counter(papi_handle_t handle, const char *event_name, int cntr_mode, int cntr_type, papi_sde_fptr_t func_ptr, void *param );
int papi_sde_unregister_counter( void *handle, const char *event_name );
int papi_sde_describe_counter(papi_handle_t handle, const char *event_name, const char *event_description );
int papi_sde_add_counter_to_group(papi_handle_t handle, const char *event_name, const char *group_name, uint32_t group_flags );
int papi_sde_create_counter( papi_handle_t handle, const char *event_name, int cntr_type, void **cntr_handle );
int papi_sde_inc_counter( void *cntr_handle, long long int increment );
int papi_sde_create_recorder( papi_handle_t handle, const char *event_name, size_t typesize, int (*cmpr_func_ptr)(const void *p1, const void *p2), void **record_handle );
int papi_sde_record( void *record_handle, size_t typesize, void *value );
int papi_sde_reset_recorder(void *record_handle );
int papi_sde_reset_counter( void *cntr_handle );
void *papi_sde_get_counter_handle( papi_handle_t handle, const char *event_name);
int papi_sde_compare_long_long(const void *p1, const void *p2);
int papi_sde_compare_int(const void *p1, const void *p2);
int papi_sde_compare_double(const void *p1, const void *p2);
int papi_sde_compare_float(const void *p1, const void *p2);
papi_handle_t papi_sde_hook_list_events( papi_sde_fptr_struct_t *fptr_struct);
#ifdef __cplusplus
}
#endif
#define POPULATE_SDE_FPTR_STRUCT( _A_ ) do{\
_A_.init = papi_sde_init;\
_A_.register_counter = papi_sde_register_counter;\
_A_.register_fp_counter = papi_sde_register_fp_counter;\
_A_.unregister_counter = papi_sde_unregister_counter;\
_A_.describe_counter = papi_sde_describe_counter;\
_A_.add_counter_to_group = papi_sde_add_counter_to_group;\
_A_.create_counter = papi_sde_create_counter;\
_A_.inc_counter = papi_sde_inc_counter;\
_A_.create_recorder = papi_sde_create_recorder;\
_A_.record = papi_sde_record;\
_A_.reset_recorder = papi_sde_reset_recorder;\
_A_.reset_counter = papi_sde_reset_counter;\
_A_.get_counter_handle = papi_sde_get_counter_handle;\
}while(0)
#endif
| 46.19 | 170 | 0.76575 |
35db1970afe05bb8ceb7680ef2b655b9aca2af63 | 987 | h | C | lib/cpp/vpath.h | fooofei/c_cpp | 83b780fd48cd3c03fd3850fb297576d5fc907955 | [
"MIT"
] | null | null | null | lib/cpp/vpath.h | fooofei/c_cpp | 83b780fd48cd3c03fd3850fb297576d5fc907955 | [
"MIT"
] | null | null | null | lib/cpp/vpath.h | fooofei/c_cpp | 83b780fd48cd3c03fd3850fb297576d5fc907955 | [
"MIT"
] | null | null | null | #pragma once
#include <string>
#ifndef NAMESPACE_BASE_BEGIN
#define NAMESPACE_BASE_BEGIN namespace base {
#endif
#ifndef NAMESPACE_END
#define NAMESPACE_END }
#endif
NAMESPACE_BASE_BEGIN
/* abspath src to dst, utf8 bytes encoding path */
int
path_abspath(const std::string & src, std::string & dst);
// get the executable located directory
int
get_current_directory(std::string & );
/* use the executable path as current path to get abspath
if the executable path is c:\\test1\\test2\\1.exe
and the we start at c:\\
then the abspath(.\1.txt) will be c:\\1.txt
this funtion will let it be c:\\test1\\test2\\1.txt
*/
int
path_abspath_current(const std::string &, std::string &);
int
path_try_abspath_current(std::string &);
/* for Windows, not for posix
path not exists return false
*/
bool
path_is_directory(const std::wstring & );
/* for posix, not for Windows */
bool
path_is_directory(const std::string &);
bool
path_exists(const std::string &);
NAMESPACE_END;
| 20.142857 | 57 | 0.734549 |
6dfeea1359ed41f64353d784e1cfb396081e499a | 73 | h | C | graph_theory_floyd-warshall_algorithm/floydWarshall.h | 1ndrew100/graph_theory_floyd-warshall_algorithm | cdc89367b974f05adc36aa24e23fb828cd245a23 | [
"MIT"
] | null | null | null | graph_theory_floyd-warshall_algorithm/floydWarshall.h | 1ndrew100/graph_theory_floyd-warshall_algorithm | cdc89367b974f05adc36aa24e23fb828cd245a23 | [
"MIT"
] | null | null | null | graph_theory_floyd-warshall_algorithm/floydWarshall.h | 1ndrew100/graph_theory_floyd-warshall_algorithm | cdc89367b974f05adc36aa24e23fb828cd245a23 | [
"MIT"
] | null | null | null | #pragma once
#include "Graph.h"
void floydWarshall(const Graph& graph); | 14.6 | 39 | 0.753425 |
a30068b567502107e97029fd261cfffd9c4692c1 | 899 | h | C | myprogram/src/commands/CommandDisplayScoresOfStudent.h | JohnLFX/COP3331-Final-Project | f0e7c8c055c56091606d4325754d815d118cf0d0 | [
"MIT"
] | null | null | null | myprogram/src/commands/CommandDisplayScoresOfStudent.h | JohnLFX/COP3331-Final-Project | f0e7c8c055c56091606d4325754d815d118cf0d0 | [
"MIT"
] | null | null | null | myprogram/src/commands/CommandDisplayScoresOfStudent.h | JohnLFX/COP3331-Final-Project | f0e7c8c055c56091606d4325754d815d118cf0d0 | [
"MIT"
] | null | null | null | #ifndef INC_3331PROJECT_COMMANDDISPLAYSCORESOFSTUDENT_H
#define INC_3331PROJECT_COMMANDDISPLAYSCORESOFSTUDENT_H
#include "types/AuthenticatedCommand.h"
class CommandDisplayScoresOfStudent : public AuthenticatedCommand {
public:
CommandDisplayScoresOfStudent(FinalProject *finalProject) : AuthenticatedCommand(3, finalProject) {};
void execute() {
AuthenticatedCommand::execute();
string studentID = this->promptForStudentID();
Student student = this->finalProject->studentDatabase.getStudent(studentID);
cout << "--- Exam Scores for " << studentID << " ---" << endl;
for (unsigned int i = 0; i < student.getExamsCount(); i++)
cout << "Exam " << (i + 1) << ": " << student.getExamScore(i) << endl;
cout << "---" << endl;
}
};
#endif //INC_3331PROJECT_COMMANDDISPLAYSCORESOFSTUDENT_H
| 28.09375 | 106 | 0.658509 |
b88e0e6566007374475d0b34ec194b2e16fb7a80 | 222 | c | C | packages/PIPS/validation/Task_parallelization/sequence03.c | DVSR1966/par4all | 86b33ca9da736e832b568c5637a2381f360f1996 | [
"MIT"
] | 51 | 2015-01-31T01:51:39.000Z | 2022-02-18T02:01:50.000Z | packages/PIPS/validation/Task_parallelization/sequence03.c | DVSR1966/par4all | 86b33ca9da736e832b568c5637a2381f360f1996 | [
"MIT"
] | 7 | 2017-05-29T09:29:00.000Z | 2019-03-11T16:01:39.000Z | packages/PIPS/validation/Task_parallelization/sequence03.c | DVSR1966/par4all | 86b33ca9da736e832b568c5637a2381f360f1996 | [
"MIT"
] | 12 | 2015-03-26T08:05:38.000Z | 2022-02-18T02:01:51.000Z | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
void main(int argc, char *argv[]){
unsigned int i;
double A[10], B[10], C[10];
i = 4;
A[i] = 42;
B[i] = 24;
C[i]+= A[i] + B[i];
}
| 12.333333 | 34 | 0.472973 |
335e61fef57a780b062bce5f3e1cce4199062174 | 732 | c | C | test/chora/benchmarks/icrasuite/frankenstein/relational/loop_splitting_test_safe.c | jbreck/duet-jbreck | 3bf4aa0c69983d15f199bf02f294d356c354e932 | [
"MIT"
] | 1 | 2020-08-15T15:26:25.000Z | 2020-08-15T15:26:25.000Z | test/chora/benchmarks/icrasuite/frankenstein/relational/loop_splitting_test_safe.c | jbreck/duet-jbreck | 3bf4aa0c69983d15f199bf02f294d356c354e932 | [
"MIT"
] | null | null | null | test/chora/benchmarks/icrasuite/frankenstein/relational/loop_splitting_test_safe.c | jbreck/duet-jbreck | 3bf4aa0c69983d15f199bf02f294d356c354e932 | [
"MIT"
] | null | null | null |
/* Source: Rahul Sharma, Isil Dillig, Thomas Dillig, Alex Aiken
Simplifying Loop Invariant Generation Using Splitter Predicates
CAV 2011 */
int main(int argc, char ** argv) {
int x1 = __VERIFIER_nondet_int();
int y1 = __VERIFIER_nondet_int();
int x2 = __VERIFIER_nondet_int();
int y2 = __VERIFIER_nondet_int();
__VERIFIER_assume(x1 == x2);
__VERIFIER_assume(y1 == y2);
while(x1<100) { //multi-path loop
x1 = x1 + 1;
if (x1>50) y1 = y1 + 1;
}
while (x2<=49) x2 = x2 + 1; //previous loop split into two
while (x2<100 && x2>49) {
x2 = x2 + 1;
y2 = y2 + 1;
}
__VERIFIER_assert(x1 == x2);
__VERIFIER_assert(y1 == y2);
return 0;
}
| 22.181818 | 66 | 0.587432 |
98f182ca1b0e889c6fdbcd889f75dd0400a41bab | 8,422 | h | C | opennurbs_polyline.h | elifri/opennurbs | 08ba072313d912b58d38eabe3525aa5bd627f55f | [
"Zlib"
] | 46 | 2015-05-02T07:27:47.000Z | 2022-01-19T11:21:54.000Z | opennurbs_polyline.h | elifri/opennurbs | 08ba072313d912b58d38eabe3525aa5bd627f55f | [
"Zlib"
] | 2 | 2018-12-27T08:50:53.000Z | 2021-09-22T07:06:58.000Z | opennurbs_polyline.h | elifri/opennurbs | 08ba072313d912b58d38eabe3525aa5bd627f55f | [
"Zlib"
] | 31 | 2015-01-14T21:42:04.000Z | 2022-02-08T06:33:57.000Z | /* $NoKeywords: $ */
/*
//
// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
// McNeel & Associates.
//
// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
// MERCHANTABILITY ARE HEREBY DISCLAIMED.
//
// For complete openNURBS copyright information see <http://www.opennurbs.org>.
//
////////////////////////////////////////////////////////////////
*/
#if !defined(ON_POLYLINE_INC_)
#define ON_POLYLINE_INC_
class ON_CLASS ON_Polyline : public ON_3dPointArray
{
public:
ON_Polyline();
~ON_Polyline();
ON_Polyline(const ON_3dPointArray&);
ON_Polyline& operator=(const ON_3dPointArray&);
// Description:
// Create a regular polygon inscribed in a circle.
// The vertices of the polygon will be on the circle.
// Parameters:
// circle - [in]
// side_count - [in] (>=3) number of sides
// Returns:
// true if successful. false if circle is invalid or
// side_count < 3.
bool CreateInscribedPolygon(
const ON_Circle& circle,
int side_count
);
// Description:
// Create a regular polygon circumscribe about a circle.
// The midpoints of the polygon's edges will be tanget to the
// circle.
// Parameters:
// circle - [in]
// side_count - [in] (>=3) number of sides
// Returns:
// true if successful. false if circle is invalid or
// side_count < 3.
bool CreateCircumscribedPolygon(
const ON_Circle& circle,
int side_count
);
// Description:
// Create a regular star polygon.
// The star begins at circle.PointAt(0) and the vertices alternate
// between being on circle and begin on a concentric circle of
// other_radius.
// Parameters:
// circle - [in] circle star polygon starts on
// other_radius - [in] radius of other circle
// corner_count - [in] (>=3) number of corners on circle
// There will be 2*corner_count sides and 2*corner_count
// vertices.
// Returns:
// true if successful. false if circle is invalid, other_radius < 0.0,
// or side_count < 3.
bool CreateStarPolygon(
const ON_Circle& circle,
double other_radius,
int side_count
);
// Description:
// Checks that polyline has at least two points
// and that sequential points are distinct. If the
// polyline has 2 or 3 points, then the start and end
// point must be distinct.
// Parameters:
// tolerance - [in] tolerance used to check for duplicate points.
// Returns:
// true if polyline is valid.
// See Also:
// ON_Polyline::Clean.
bool IsValid(
double tolerance = 0.0
) const;
// Description:
// Removes duplicate points that result in zero length segments.
// Parameters:
// tolerance - [in] tolerance used to check for duplicate points.
// Returns:
// Number of points removed.
// Remarks:
// If the distance between points polyline[i] and polyline[i+1]
// is <= tolerance, then the point with index (i+1) is removed.
int Clean(
double tolerance = 0.0
);
// Returns:
// Number of points in the polyline.
int PointCount() const;
// Returns:
// Number of segments in the polyline.
int SegmentCount() const;
// Description:
// Test a polyline to see if it is closed.
// Returns:
// true if polyline has 4 or more points, the distance between the
// start and end points is <= tolerance, and there is a
// point in the polyline whose distance from the start and end
// points is > tolerance.
bool IsClosed(
double tolerance = 0.0
) const;
// Returns:
// Length of the polyline.
double Length() const;
// Parameters:
// segment_index - [in] zero based segment index
// Returns:
// vector = point[segment_index+1] - point[segment_index].
ON_3dVector SegmentDirection (
int segment_index
) const;
// Parameters:
// segment_index - [in] zero based segment index
// Returns:
// Unit vector in the direction of the segment
ON_3dVector SegmentTangent (
int segment_index
) const;
// Description:
// Evaluate the polyline location at a parameter.
// Parameters:
// t - [in] the i-th segment goes from i <= t < i+1
ON_3dPoint PointAt( double t ) const;
// Description:
// Evaluate the polyline first derivative at a parameter.
// Parameters:
// t - [in] the i-th segment goes from i <= t < i+1
ON_3dVector DerivativeAt( double t ) const;
// Description:
// Evaluate the polyline unit tangent at a parameter.
// Parameters:
// t - [in] the i-th segment goes from i <= t < i+1
ON_3dVector TangentAt( double t ) const;
// Description:
// Find a point on the polyline that is closest
// to test_point.
// Parameters:
// test_point - [in]
// t - [out] parameter for a point on the polyline that
// is closest to test_point. If mulitple solutions
// exist, then the smallest solution is returned.
// Returns:
// true if successful.
bool ClosestPointTo(
const ON_3dPoint& test_point,
double* t
) const;
// Description:
// Find a point on the polyline that is closest
// to test_point.
// Parameters:
// test_point - [in]
// t - [out] parameter for a point on the polyline that
// is closest to test_point. If mulitple solutions
// exist, then the smallest solution is returned.
// segment_index0 - [in] index of segment where search begins
// segment_index1 - [in] index of segment where search ends
// This segment is NOT searched.
// Example:
// Search segments 3,4, and 5 for the point closest to (0,0,0).
// double t;
// ClosestPointTo( ON_3dPoint(0,0,0), &t, 3, 6 );
// Returns:
// true if successful.
bool ClosestPointTo(
const ON_3dPoint& test_point,
double* t,
int segment_index0, // index of segment where search begins
int segment_index1 // index + 1 of segment where search stops
) const;
// Description:
// Find a point on the polyline that is closest
// to test_point.
// Parameters:
// test_point - [in]
// Returns:
// point on polyline.
ON_3dPoint ClosestPointTo(
const ON_3dPoint& test_point
) const;
};
/*
Description:
Join all contiguous polylines of an array of ON_Polylines.
Parameters:
InPlines - [in] Array of polylines to be joined (not modified)
OutPlines - [out] Resulting joined polylines and copies of polylines that were not joined to anything
are appended.
join_tol - [in] Distance tolerance used to decide if endpoints are close enough
kink_tol - [in] Angle in radians. If > 0.0, then curves within join_tol will only be joined if the angle between them
is less than kink_tol. If <= 0, then the angle will be ignored and only join_tol will be used.
bUseTanAngle - [in] If true, choose the best match using angle between tangents.
If false, best match is the closest. This is used whether or not kink_tol is positive.
bPreserveDirection - [in] If true, polylines endpoints will be compared to polylines startpoints.
If false, all start and endpoints will be compared, and copies of input
curves may be reversed in output.
key - [out] if key is not null, InPlines[i] was joined into OutPlines[key[i]].
Returns:
Number of polylines added to OutPlines
Remarks:
Closed polylines are copied to OutPlines.
Plines that cannot be joined to others are copied to OutPlines.
*/
ON_DECL
int ON_JoinPolylines(const ON_SimpleArray<const ON_Polyline*>& InPlines,
ON_SimpleArray<ON_Polyline*>& OutPlines,
double join_tol,
double kink_tol,
bool bUseTanAngle,
bool bPreserveDirection = false,
ON_SimpleArray<int>* key = 0
);
#endif
| 33.688 | 121 | 0.623842 |
32fa15c11568238ebcfd192ef92a97c1a4764593 | 3,042 | h | C | admin/wizards/shrwiz/wizclnt.h | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | admin/wizards/shrwiz/wizclnt.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | admin/wizards/shrwiz/wizclnt.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | #if !defined(AFX_WIZCLNT_H__5F8E4B7A_C1ED_11D2_8E4A_0000F87A3388__INCLUDED_)
#define AFX_WIZCLNT_H__5F8E4B7A_C1ED_11D2_8E4A_0000F87A3388__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// WizClnt.h : header file
//
typedef enum _CLIENT_TYPE {
CLIENT_TYPE_SMB=0,
CLIENT_TYPE_SFM
} CLIENT_TYPE;
/////////////////////////////////////////////////////////////////////////////
// CWizClient0 dialog
class CWizClient0 : public CPropertyPageEx
{
DECLARE_DYNCREATE(CWizClient0)
// Construction
public:
CWizClient0();
~CWizClient0();
// Dialog Data
//{{AFX_DATA(CWizClient0)
enum { IDD = IDD_SHRWIZ_FOLDER0 };
// NOTE - ClassWizard will add data members here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CWizClient0)
public:
virtual LRESULT OnWizardNext();
virtual BOOL OnSetActive();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CWizClient0)
virtual BOOL OnInitDialog();
afx_msg void OnCSCChange();
afx_msg void OnChangeSharename();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void UpdateCSCString();
LRESULT OnSetPageFocus(WPARAM wParam, LPARAM lParam);
void Reset();
BOOL ShareNameExists(IN LPCTSTR lpszShareName);
BOOL m_bCSC;
DWORD m_dwCSCFlag;
};
/////////////////////////////////////////////////////////////////////////////
// CWizClient dialog
class CWizClient : public CPropertyPageEx
{
DECLARE_DYNCREATE(CWizClient)
// Construction
public:
CWizClient();
~CWizClient();
// Dialog Data
//{{AFX_DATA(CWizClient)
enum { IDD = IDD_SHRWIZ_FOLDER };
// NOTE - ClassWizard will add data members here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CWizClient)
public:
virtual LRESULT OnWizardNext();
virtual BOOL OnSetActive();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CWizClient)
virtual BOOL OnInitDialog();
afx_msg void OnCSCChange();
afx_msg void OnCheckMac();
afx_msg void OnCheckMs();
afx_msg void OnChangeSharename();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void UpdateCSCString();
void OnCheckClient();
LRESULT OnSetPageFocus(WPARAM wParam, LPARAM lParam);
void Reset();
BOOL ShareNameExists(IN LPCTSTR lpszShareName, IN CLIENT_TYPE iType);
BOOL m_bCSC;
DWORD m_dwCSCFlag;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_WIZCLNT_H__5F8E4B7A_C1ED_11D2_8E4A_0000F87A3388__INCLUDED_)
| 25.35 | 104 | 0.679487 |
f80c825e23a4e28cdc336cdaf301667f573a1fdf | 1,009 | h | C | Common01/Source/Common/DrawSystem/Geometry/IGeometry.h | DavidCoenFish/game02 | 3011cf2fe069b579759aa95333cb406a8ff52d53 | [
"Unlicense"
] | null | null | null | Common01/Source/Common/DrawSystem/Geometry/IGeometry.h | DavidCoenFish/game02 | 3011cf2fe069b579759aa95333cb406a8ff52d53 | [
"Unlicense"
] | null | null | null | Common01/Source/Common/DrawSystem/Geometry/IGeometry.h | DavidCoenFish/game02 | 3011cf2fe069b579759aa95333cb406a8ff52d53 | [
"Unlicense"
] | null | null | null | #pragma once
//#include "Common/DrawSystem/IResource.h"
class DrawSystem;
class IGeometry// : public IResource
{
public:
//IGeometry(DrawSystem* const pDrawSystem);
//virtual ~IGeometry();
//virtual void Draw(ID3D12GraphicsCommandList* const pCommandList) = 0;
//protected:
static void DrawImplementation(
ID3D12GraphicsCommandList* const pCommandList,
const UINT vertexCount,
const D3D_PRIMITIVE_TOPOLOGY primitiveTopology,
D3D12_VERTEX_BUFFER_VIEW& vertexBufferView
);
static void DeviceLostImplementation(
Microsoft::WRL::ComPtr<ID3D12Resource>& pVertexBuffer
);
static void DeviceRestoredImplementation(
DrawSystem* const pDrawSystem,
ID3D12GraphicsCommandList* const pCommandList,
ID3D12Device* const pDevice,
const int vertexCount,
const int byteVertexSize,
Microsoft::WRL::ComPtr<ID3D12Resource>& pVertexBuffer,
D3D12_VERTEX_BUFFER_VIEW& vertexBufferView,
void* pRawData
);
};
| 28.027778 | 75 | 0.725471 |
928210c47f3323a0a2a0a28692d1c9ffd2765904 | 3,317 | c | C | assign1/test_file/result/vla_test_1hr/afl_output/cov/diff/id:000010,orig:05_array.c | Kur1su0/cs6888 | 8eefcfeb23f2f7e7d8f6ee0e76a20a20623b9b9f | [
"MIT"
] | null | null | null | assign1/test_file/result/vla_test_1hr/afl_output/cov/diff/id:000010,orig:05_array.c | Kur1su0/cs6888 | 8eefcfeb23f2f7e7d8f6ee0e76a20a20623b9b9f | [
"MIT"
] | null | null | null | assign1/test_file/result/vla_test_1hr/afl_output/cov/diff/id:000010,orig:05_array.c | Kur1su0/cs6888 | 8eefcfeb23f2f7e7d8f6ee0e76a20a20623b9b9f | [
"MIT"
] | null | null | null | diff id:000009,orig:04_for.expect -> id:000010,orig:05_array.c
Src file: /root/git/cs6888/assign1/tcc-0.9.27-cov/x86_64-gen.c
New 'function' coverage: gen_modrm64()
New 'function' coverage: gen_opl()
New 'line' coverage: 1767
New 'line' coverage: 1768
New 'line' coverage: 1769
New 'line' coverage: 1770
New 'line' coverage: 1771
New 'line' coverage: 1779
New 'line' coverage: 1781
New 'line' coverage: 1782
New 'line' coverage: 1798
New 'line' coverage: 1799
New 'line' coverage: 1800
New 'line' coverage: 1801
New 'line' coverage: 1802
New 'line' coverage: 1803
New 'line' coverage: 1804
New 'line' coverage: 1805
New 'line' coverage: 1806
New 'line' coverage: 1807
New 'line' coverage: 1808
New 'line' coverage: 1814
New 'line' coverage: 1815
New 'line' coverage: 1816
New 'line' coverage: 1818
New 'line' coverage: 1819
New 'line' coverage: 1820
New 'line' coverage: 1821
New 'line' coverage: 1822
New 'line' coverage: 1823
New 'line' coverage: 1831
New 'line' coverage: 1832
New 'line' coverage: 1864
New 'line' coverage: 1866
New 'line' coverage: 1867
New 'line' coverage: 312
New 'line' coverage: 320
New 'line' coverage: 333
New 'line' coverage: 336
New 'line' coverage: 337
New 'line' coverage: 338
New 'line' coverage: 339
New 'line' coverage: 382
New 'line' coverage: 383
New 'line' coverage: 384
New 'line' coverage: 385
New 'line' coverage: 386
New 'line' coverage: 388
New 'line' coverage: 446
New 'line' coverage: 477
New 'line' coverage: 478
New 'line' coverage: 593
New 'line' coverage: 603
New 'line' coverage: 604
Src file: /root/git/cs6888/assign1/tcc-0.9.27-cov/tccgen.c
New 'function' coverage: gv2()
New 'line' coverage: 1000
New 'line' coverage: 1001
New 'line' coverage: 1002
New 'line' coverage: 1003
New 'line' coverage: 1004
New 'line' coverage: 1007
New 'line' coverage: 1018
New 'line' coverage: 1019
New 'line' coverage: 1022
New 'line' coverage: 1026
New 'line' coverage: 1030
New 'line' coverage: 1031
New 'line' coverage: 1431
New 'line' coverage: 1438
New 'line' coverage: 1439
New 'line' coverage: 1440
New 'line' coverage: 1441
New 'line' coverage: 1442
New 'line' coverage: 1443
New 'line' coverage: 1445
New 'line' coverage: 1460
New 'line' coverage: 1962
New 'line' coverage: 1973
New 'line' coverage: 1974
New 'line' coverage: 1975
New 'line' coverage: 1976
New 'line' coverage: 1977
New 'line' coverage: 1979
New 'line' coverage: 1980
New 'line' coverage: 1981
New 'line' coverage: 1987
New 'line' coverage: 2006
New 'line' coverage: 2548
New 'line' coverage: 2553
New 'line' coverage: 2556
New 'line' coverage: 2559
New 'line' coverage: 2602
New 'line' coverage: 2605
New 'line' coverage: 2606
New 'line' coverage: 2607
New 'line' coverage: 2609
New 'line' coverage: 2610
New 'line' coverage: 2614
New 'line' coverage: 2616
New 'line' coverage: 2617
New 'line' coverage: 977
New 'line' coverage: 981
New 'line' coverage: 982
New 'line' coverage: 983
New 'line' coverage: 984
New 'line' coverage: 985
New 'line' coverage: 987
New 'line' coverage: 989
New 'line' coverage: 991
New 'line' coverage: 992
New 'line' coverage: 995
New 'line' coverage: 999
| 28.594828 | 62 | 0.680736 |
de35dcfcf7b685258321d4f0d18765582e6a349d | 194 | c | C | regression-tests/horn-hcc-array/out-of-bounds-loop.c | pottu/tricera | 0f4af70bce7ce67bc6abdb403cdf46bbae6f0f41 | [
"BSD-3-Clause"
] | 12 | 2019-03-05T08:55:15.000Z | 2022-03-14T22:20:42.000Z | regression-tests/horn-hcc-array/out-of-bounds-loop.c | pottu/tricera | 0f4af70bce7ce67bc6abdb403cdf46bbae6f0f41 | [
"BSD-3-Clause"
] | null | null | null | regression-tests/horn-hcc-array/out-of-bounds-loop.c | pottu/tricera | 0f4af70bce7ce67bc6abdb403cdf46bbae6f0f41 | [
"BSD-3-Clause"
] | null | null | null | #include <stdlib.h>
#include <assert.h>
extern int nondet();
int a[];
void main() {
int n = 1;
a = malloc(sizeof(int)*n);
for (int i = 0; i <= n; ++i) {
a[i] = 3;
}
free(a);
}
| 11.411765 | 32 | 0.494845 |
0529b52303714ee393b4de78784d775bcf69e07e | 2,518 | h | C | game/shared/CWeaponInfoCache.h | xalalau/HLEnhanced | f108222ab7d303c9ed5a8e81269f9e949508e78e | [
"Unlicense"
] | 83 | 2016-06-10T20:49:23.000Z | 2022-02-13T18:05:11.000Z | game/shared/CWeaponInfoCache.h | xalalau/HLEnhanced | f108222ab7d303c9ed5a8e81269f9e949508e78e | [
"Unlicense"
] | 26 | 2016-06-16T22:27:24.000Z | 2019-04-30T19:25:51.000Z | game/shared/CWeaponInfoCache.h | xalalau/HLEnhanced | f108222ab7d303c9ed5a8e81269f9e949508e78e | [
"Unlicense"
] | 58 | 2016-06-10T23:52:33.000Z | 2021-12-30T02:30:50.000Z | #ifndef GAME_SHARED_CWEAPONINFOCACHE_H
#define GAME_SHARED_CWEAPONINFOCACHE_H
#include <memory>
#include <unordered_map>
#include <vector>
#include "StringUtils.h"
#include "CWeaponInfo.h"
/**
* Singleton class that caches weapon info.
*/
class CWeaponInfoCache final
{
public:
static const char* const WEAPON_INFO_DIR;
/**
* Callback used to enumerate weapon info.
* @param info Weapon info.
* @param pUserData User data.
* @return true to continue enumerating, false to stop.
*/
using EnumInfoCallback = bool ( * )( const CWeaponInfo& info, void* pUserData );
private:
typedef std::unordered_map<const char*, size_t, RawCharHashI, RawCharEqualToI> InfoMap_t;
typedef std::vector<std::unique_ptr<CWeaponInfo>> InfoList_t;
public:
CWeaponInfoCache();
~CWeaponInfoCache();
/**
* @return The number of weapons.
*/
size_t GetWeaponCount() const { return m_InfoList.size(); }
/**
* Finds weapon info by weapon name.
* @param pszWeaponName Name of the weapon.
* @return If found, the weapon info. Otherwise, null.
*/
const CWeaponInfo* FindWeaponInfo( const char* const pszWeaponName ) const;
/**
* Loads weapon info for the given weapon name.
* @param iID Weapon ID.
* @param pszWeaponName Name of the weapon whose info should be loaded.
* @param pszSubDir Optional. Subdirectory to check.
* @return Weapon info instance.
*/
const CWeaponInfo* LoadWeaponInfo( const int iID, const char* const pszWeaponName, const char* const pszSubDir = nullptr );
/**
* Clears all info.
*/
void ClearInfos();
/**
* Enumerate weapon info.
* @param pCallback Callback to invoke on every weapon info instance.
* @param pUserData User data to pass.
*/
void EnumInfos( EnumInfoCallback pCallback, void* pUserData = nullptr ) const;
size_t GenerateHash() const;
private:
/**
* Loads weapon info from a file.
* @param pszWeaponName Name of the weapon whose info should be loaded.
* @param pszSubDir Optional. Subdirectory to check.
* @param info Weapon info structure to initialize.
* @return true on success, false otherwise.
*/
bool LoadWeaponInfoFromFile( const char* const pszWeaponName, const char* const pszSubDir, CWeaponInfo& info );
private:
InfoMap_t m_InfoMap;
InfoList_t m_InfoList;
//Used when a file failed to load.
CWeaponInfo m_DefaultInfo;
private:
CWeaponInfoCache( const CWeaponInfoCache& ) = delete;
CWeaponInfoCache& operator=( const CWeaponInfoCache& ) = delete;
};
extern CWeaponInfoCache g_WeaponInfoCache;
#endif //GAME_SHARED_CWEAPONINFOCACHE_H | 26.505263 | 124 | 0.745433 |
dc66390801aae24010cf6720a3b7b7de127dede9 | 1,763 | h | C | src/frr/pceplib/test/pcep_msg_tools_test.h | zhouhaifeng/vpe | 9c644ffd561988e5740021ed26e0f7739844353d | [
"Apache-2.0"
] | null | null | null | src/frr/pceplib/test/pcep_msg_tools_test.h | zhouhaifeng/vpe | 9c644ffd561988e5740021ed26e0f7739844353d | [
"Apache-2.0"
] | null | null | null | src/frr/pceplib/test/pcep_msg_tools_test.h | zhouhaifeng/vpe | 9c644ffd561988e5740021ed26e0f7739844353d | [
"Apache-2.0"
] | null | null | null | /*
* This file is part of the PCEPlib, a PCEP protocol library.
*
* Copyright (C) 2020 Volta Networks https://voltanet.io/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Author : Javier Garcia <javier.garcia@voltanet.io>
*
*/
/*
* Timer definitions to be used internally by the pcep_timers library.
*/
#ifndef PCEP_MSG_TOOLS_TEST_H_
#define PCEP_MSG_TOOLS_TEST_H_
int pcep_tools_test_suite_setup(void);
int pcep_tools_test_suite_teardown(void);
void pcep_tools_test_setup(void);
void pcep_tools_test_teardown(void);
void test_pcep_msg_read_pcep_initiate(void);
void test_pcep_msg_read_pcep_initiate2(void);
void test_pcep_msg_read_pcep_update(void);
void test_pcep_msg_read_pcep_open(void);
void test_pcep_msg_read_pcep_open_initiate(void);
void test_validate_message_header(void);
void test_validate_message_objects(void);
void test_validate_message_objects_invalid(void);
void test_pcep_msg_read_pcep_open_cisco_pce(void);
void test_pcep_msg_read_pcep_update_cisco_pce(void);
void test_pcep_msg_read_pcep_report_cisco_pcc(void);
void test_pcep_msg_read_pcep_initiate_cisco_pcc(void);
#endif /* PCEPTIMERINTERNALS_H_ */
| 35.979592 | 75 | 0.802042 |
dc08216d57c8e15de9f5f3fdc2ef619095bf1800 | 5,176 | h | C | include/ironbee/array.h | b1v1r/ironbee | 97b453afd9c3dc70342c6183a875bde22c9c4a76 | [
"Apache-2.0"
] | 148 | 2015-01-10T01:53:39.000Z | 2022-03-20T20:48:12.000Z | include/ironbee/array.h | ErikHendriks/ironbee | 97b453afd9c3dc70342c6183a875bde22c9c4a76 | [
"Apache-2.0"
] | 8 | 2015-03-09T15:50:36.000Z | 2020-10-10T19:23:06.000Z | include/ironbee/array.h | ErikHendriks/ironbee | 97b453afd9c3dc70342c6183a875bde22c9c4a76 | [
"Apache-2.0"
] | 46 | 2015-03-08T22:45:42.000Z | 2022-01-15T13:47:59.000Z | /*****************************************************************************
* Licensed to Qualys, Inc. (QUALYS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* QUALYS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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 _IB_ARRAY_H_
#define _IB_ARRAY_H_
/**
* @file
* @brief IronBee --- Array Utility Functions
*
* @author Brian Rectanus <brectanus@qualys.com>
*/
#include <ironbee/build.h>
#include <ironbee/mm.h>
#include <ironbee/types.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup IronBeeUtilArray Dynamic Array
* @ingroup IronBeeUtil
*
* Dynamic array routines.
*
* @{
*/
/**
* A dynamic array.
*/
typedef struct ib_array_t ib_array_t;
/**
* Create an array.
*
* The array will be extended by "ninit" elements when more room is required.
* Up to "nextents" extents will be performed. If more than this number of
* extents is required, then "nextents" will be doubled and the array will
* be reorganized.
*
* @param parr Address which new array is written
* @param mm Memory manager to use
* @param ninit Initial number of elements
* @param nextents Initial number of extents
*
* @returns Status code
*/
ib_status_t DLL_PUBLIC ib_array_create(ib_array_t **parr, ib_mm_t mm,
size_t ninit, size_t nextents);
/**
* Get an element from an array at a given index.
*
* If the array is not big enough to hold the index, then IB_EINVAL is
* returned and pval will be NULL.
*
* @param arr Array
* @param idx Index
* @param pval Address which element is written
*
* @returns Status code
*/
ib_status_t DLL_PUBLIC ib_array_get(ib_array_t *arr, size_t idx, void *pval);
/**
* Set an element from an array at a given index.
*
* If the array is not big enough to hold the index, then it will be extended
* by ninit until it is at least this value before setting the value.
*
* @note The element is added without copying.
*
* @param arr Array
* @param idx Index
* @param val Value
*
* @returns Status code
*/
ib_status_t DLL_PUBLIC ib_array_setn(ib_array_t *arr, size_t idx, void *val);
/**
* Append an element to the end of the array.
*
* If the array is not big enough to hold the index, then it will be extended
* by ninit first.
*
* @note The element is added without copying.
*
* @param arr Array
* @param val Value
*
* @returns Status code
*/
ib_status_t DLL_PUBLIC ib_array_appendn(ib_array_t *arr, void *val);
/**
* Number of elements in an array.
*
* @param arr Array
*
* @returns Number of elements
*/
size_t DLL_PUBLIC ib_array_elements(ib_array_t *arr);
/**
* Allocated space in the array.
*
* @param arr Array
*
* @returns Max number of elements before needing to extend.
*/
size_t DLL_PUBLIC ib_array_size(ib_array_t *arr);
/**
* Dynamic array loop.
*
* This just loops over the indexes in a dynamic array.
*
* @code
* // Where data stored in "arr" is "int *", this will print all int values.
* size_t ne;
* size_t idx;
* int *val;
* IB_ARRAY_LOOP(arr, ne, idx, val) {
* printf("%4d: item[%p]=%d\n", i++, val, *val);
* }
* @endcode
*
* @param arr Array
* @param ne Symbol holding the number of elements
* @param idx Symbol holding the index, set for each iteration
* @param val Symbol holding the value at the index, set for each iteration
*/
#define IB_ARRAY_LOOP(arr, ne, idx, val) \
for ((ne) = ib_array_elements(arr), (idx) = 0; \
ib_array_get((arr), (idx), (void *)&(val)) \
== IB_OK && (idx) < (ne); \
++(idx))
/**
* Dynamic array loop in reverse.
*
* This just loops over the indexes in a dynamic array in reverse order.
*
* @code
* // Where data stored in "arr" is "int *", this will print all int values.
* size_t ne;
* size_t idx;
* int *val;
* IB_ARRAY_LOOP_REVERSE(arr, ne, idx, val) {
* printf("%4d: item[%p]=%d\n", i++, val, *val);
* }
* @endcode
*
* @param arr Array
* @param ne Symbol holding the number of elements
* @param idx Symbol holding the index, set for each iteration
* @param val Symbol holding the value at the index, set for each iteration
*/
#define IB_ARRAY_LOOP_REVERSE(arr, ne, idx, val) \
for ((ne) = ib_array_elements(arr), (idx) = (ne) > 0 ? (ne)-1 : 0; \
ib_array_get((arr), (idx), (void *)&(val)) == IB_OK && (idx) > 0; \
--(idx))
/** @} IronBeeUtilArray */
/**
* @} IronBeeUtil
*/
#ifdef __cplusplus
}
#endif
#endif /* _IB_ARRAY_H_ */
| 26.274112 | 78 | 0.652048 |
492ccba32f7249a4d2c26379ead7c3e9ab8276a7 | 17,415 | c | C | lb.c | dylanrainwater/kilo | fec2a436e1fd65c258ffdc011e3baf705098640d | [
"MIT"
] | null | null | null | lb.c | dylanrainwater/kilo | fec2a436e1fd65c258ffdc011e3baf705098640d | [
"MIT"
] | null | null | null | lb.c | dylanrainwater/kilo | fec2a436e1fd65c258ffdc011e3baf705098640d | [
"MIT"
] | null | null | null | /*** includes ***/
// Feature test macros to make a little more portable
#define _DEFAULT_SOURCE
#define _BSD_SOURCE
#define _GNU_SOURCE
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <termios.h>
#include <time.h>
#include <unistd.h>
/*** defines ***/
#define LB_VERSION "0.0.1"
#define TAB_LENGTH 4
#define CTRL_KEY(k) ((k) & 0x1f) // 0x1f = 00011111
enum editorKey {
BACK_SPACE = 127,
ARROW_LEFT = 1000,
ARROW_RIGHT,
ARROW_UP,
ARROW_DOWN,
DEL_KEY,
PAGE_UP,
PAGE_DOWN,
HOME_KEY,
END_KEY
};
/*** data ***/
typedef struct editor_row {
int length;
int render_length;
char *chars;
char *render;
} erow;
struct statusbar {
char *filename;
char msg[80];
time_t msg_time;
};
struct editorConfig {
int cursor_x, cursor_y;
int render_x;
int row_offset;
int screen_rows;
int col_offset;
int screen_cols;
int num_rows;
erow *rows;
struct statusbar status;
struct termios orig_termios;
};
struct editorConfig E;
/*** prototypes ***/
void editorSetStatusMessage(const char *fmt, ...);
/*** terminal ***/
void die(const char *s) {
// Escape command to clear the whole screen
write(STDOUT_FILENO, "\x1b[2J", 4);
// Reposition cursor
write(STDOUT_FILENO, "\x1b[H", 3);
perror(s);
exit(1);
}
void disableRawMode() {
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &E.orig_termios) == -1) {
die("disableRawMode()::tcsetattr");
}
}
void enableRawMode() {
if (tcgetattr(STDIN_FILENO, &E.orig_termios) == -1) {
die("enableRawMode()::tcgetattr");
}
atexit(disableRawMode);
struct termios raw = E.orig_termios;
// Turn off control characters and carriage return / new line
raw.c_iflag &= ~(IXON | ICRNL | BRKINT | INPCK | ISTRIP);
// Turn off output processing (for \n to \r\n translation)
raw.c_oflag &= ~(OPOST);
// Sets character size to 8, just in case
raw.c_cflag |= (CS8);
// Turn off echoing, canonical mode, SIGINT/SIGTSTP signals, and implementation-defined input processing
raw.c_lflag &= ~(ECHO | ICANON | ISIG | IEXTEN);
// Min number of bytes = 0 for timeout
raw.c_cc[VMIN] = 0;
// Time to wait for timeout in 1/10 of a second
raw.c_cc[VTIME] = 10;
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw) == -1) {
die("enableRawMode()::tcsetattr");
}
}
/* Waits for keypress and returns it */
int editorReadKey() {
int nread;
char c;
while ((nread = read(STDIN_FILENO, &c, 1)) != 1) {
if (nread == -1 && errno != EAGAIN) {
die("editorReadKey()::read");
}
}
// Check for command sequence
if (c == '\x1b') {
char seq[3];
// Assume <esc> if nothing after initial seq
if (read(STDIN_FILENO, &seq[0], 1) != 1) {
return '\x1b';
}
if (read(STDIN_FILENO, &seq[1], 1) != 1) {
return '\x1b';
}
if (seq[0] == '[') {
// Check for quick jump commands
if (seq[1] >= '0' && seq[1] <= '9') {
if (read(STDIN_FILENO, &seq[2], 1) != 1) {
return '\x1b';
}
if (seq[2] == '~') {
switch(seq[1]) {
case '1': return HOME_KEY;
case '3': return DEL_KEY;
case '4': return END_KEY;
case '5': return PAGE_UP;
case '6': return PAGE_DOWN;
case '7': return HOME_KEY;
case '8': return END_KEY;
}
}
} else {
// Check for arrow keys
switch(seq[1]) {
case 'A': return ARROW_UP;
case 'B': return ARROW_DOWN;
case 'C': return ARROW_RIGHT;
case 'D': return ARROW_LEFT;
case 'H': return HOME_KEY;
case 'F': return END_KEY;
}
}
} else if (seq[0] == 'O') {
switch (seq[1]) {
case 'H': return HOME_KEY;
case 'F': return END_KEY;
}
}
return '\x1b';
}
return c;
}
int getCursorPosition(int *rows, int *cols) {
char buf[32];
unsigned int i = 0;
// Command to ask for cursor position
if (write(STDOUT_FILENO, "\x1b[6n", 4) != 4) {
return -1;
}
// Read response from request
while (i < sizeof(buf) - 1) {
if (read(STDIN_FILENO, &buf[i], 1) != 1) {
break;
}
if (buf[i] == 'R') {
break;
}
i++;
}
buf[i] = '\0';
// Check for command sequence
if (buf[0] != '\x1b' || buf[1] != '[') {
return -1;
}
if (sscanf(&buf[2], "%d;%d", rows, cols) != 2) {
return -1;
}
return 0;
}
int getWindowSize(int *rows, int *cols) {
struct winsize ws;
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) {
// As fallback if system doesn't support ioctl
// Move to bottom right and count how far you moved to get there
if (write(STDOUT_FILENO, "\x1b[999C\x1b[999B", 12) != 12) {
return -1;
}
return getCursorPosition(rows, cols);
} else {
*cols = ws.ws_col;
*rows = ws.ws_row;
return 0;
}
}
/*** row operations ***/
int cursorXToRenderX(erow *row, int cx) {
int rx = 0;
int i;
for (i = 0; i < cx; i++) {
if (row->chars[i] == '\t') {
rx += (TAB_LENGTH - 1) - (rx % TAB_LENGTH);
}
rx++;
}
return rx;
}
void editorUpdateRow(erow *row) {
int tabs = 0;
int j;
for (j = 0; j < row->length; j++) {
if (row->chars[j] == '\t') {
tabs++;
}
}
free(row->render);
row->render = malloc(row->length + (tabs * (TAB_LENGTH - 1)) + 1);
int rlength = 0;
for (j = 0; j < row->length; j++) {
// Render tabs as spaces
if (row->chars[j] == '\t') {
row->render[rlength++] = ' ';
while (rlength % TAB_LENGTH != 0) {
row->render[rlength++] = ' ';
}
} else {
row->render[rlength++] = row->chars[j];
}
}
row->render[rlength] = '\0';
row->render_length = rlength;
}
void editorAppendRow(char *s, size_t len) {
E.rows = realloc(E.rows, sizeof(erow) * (E.num_rows + 1));
int r = E.num_rows;
E.rows[r].length = len;
E.rows[r].chars = malloc(len + 1);
memcpy(E.rows[r].chars, s, len);
E.rows[r].chars[len - 1] = '\0';
E.rows[r].render_length = 0;
E.rows[r].render = NULL;
editorUpdateRow(&E.rows[r]);
E.num_rows++;
}
void editorInsertCharAt(erow *row, int at, int c) {
if (at < 0 || at > row->length) {
at = row->length;
}
row->chars = realloc(row->chars, row->length + 2);
memmove(&row->chars[at + 1], &row->chars[at], row->length - at + 1);
row->length++;
row->chars[at] = c;
editorUpdateRow(row);
}
/*** editor operations ***/
void editorInsertChar(char c) {
if (E.cursor_y == E.num_rows) {
editorAppendRow("", 0);
}
editorInsertCharAt(&E.rows[E.cursor_y], E.cursor_x, c);
E.cursor_x++;
}
/*** file I/O ***/
char *editorRowsToString(int *buffer_length) {
int total_length = 0;
int j;
for (j = 0; j < E.num_rows; j++) {
total_length += E.rows[j].length + 1;
}
*buffer_length = total_length;
char *buffer = malloc(total_length);
char *p = buffer;
for (j = 0; j < E.num_rows; j++) {
memcpy(p, E.rows[j].chars, E.rows[j].length);
p += E.rows[j].length;
*p = '\n';
p++;
}
return buffer;
}
void openEditor(char *filename) {
free(E.status.filename);
E.status.filename = strdup(filename);
FILE *fp = fopen(filename, "r");
if (!fp) {
die("openEditor::fopen");
}
char *line = NULL;
size_t line_cap = 0;
ssize_t line_len = 0;
while((line_len = getline(&line, &line_cap, fp)) != -1) {
// Strip off newline or carriage returns
while (line_len > 0 && (line[line_len - 1] == '\n' || line[line_len - 1] == '\r')) line_len--;
editorAppendRow(line, line_len + 1);
}
free(line);
fclose(fp);
}
void saveEditor() {
if (E.status.filename == NULL) {
return;
}
int len;
char *buf = editorRowsToString(&len);
int fd = open(E.status.filename, O_RDWR | O_CREAT, 0644);
if (fd != -1) {
if (ftruncate(fd, len) != -1) {
if (write(fd, buf, len) == len) {
close(fd);
free(buf);
editorSetStatusMessage("%d bytes successfully written to disk.", len);
return;
}
}
close(fd);
}
free(buf);
editorSetStatusMessage("ERROR: Can't save! I/O error: %s", strerror(errno));
}
/*** append buffer ***/
// dynamic, append-only string
struct abuf {
char *b;
int len;
};
#define ABUF_INIT { NULL, 0 }
void abAppend(struct abuf *ab, const char *s, int len) {
char *new = realloc(ab->b, ab->len + len);
if (new == NULL) {
return;
}
memcpy(&new[ab->len], s, len);
ab->b = new;
ab->len += len;
}
void abFree(struct abuf *ab) {
free(ab->b);
}
/*** output ***/
void editorScroll() {
E.render_x = 0;
if (E.cursor_y < E.num_rows) {
E.render_x = cursorXToRenderX(&E.rows[E.cursor_y], E.cursor_x);
}
/*** Vertical Scrolling ***/
// Scroll above window if necessary
if (E.cursor_y < E.row_offset) {
E.row_offset = E.cursor_y;
}
// Scroll to bottom if necessary
if (E.cursor_y >= E.row_offset + E.screen_rows) {
E.row_offset = E.cursor_y - E.screen_rows + 1;
}
/*** Horizontal Scrolling ***/
if (E.render_x < E.col_offset) {
E.col_offset = E.render_x;
}
if (E.render_x >= E.col_offset + E.screen_cols) {
E.col_offset = E.render_x + E.screen_cols + 1;
}
}
/*
* Works by appending message to ab using calls to abAppend();
*/
void editorDrawRows(struct abuf *ab) {
int y;
int screen_rows = E.screen_rows;
for (y = 0; y < screen_rows; y++) {
int file_row = y + E.row_offset;
if (file_row >= E.num_rows) {
// Display welcome message
if (E.num_rows == 0 && y == screen_rows / 3) {
char welcome[80];
int welcomelen = snprintf(welcome, sizeof(welcome), "lb editor -- v%s", LB_VERSION);
if (welcomelen > E.screen_cols) {
welcomelen = E.screen_cols;
}
int padding = (E.screen_cols - welcomelen) / 2;
if (padding) {
abAppend(ab, "~", 1);
padding--;
}
while (padding--) {
abAppend(ab, " ", 1);
}
abAppend(ab, welcome, welcomelen);
} else {
abAppend(ab, "~", 1);
}
} else {
int len = E.rows[file_row].render_length - E.col_offset;
if (len < 0) {
len = 0;
}
if (len > E.screen_cols) {
len = E.screen_cols;
}
abAppend(ab, &E.rows[file_row].render[E.col_offset], len);
}
// Clear to end of line
abAppend(ab, "\x1b[K", 3);
abAppend(ab, "\r\n", 2);
}
}
void editorDrawStatusBar(struct abuf *ab) {
abAppend(ab, "\x1b[7m", 4); // Invert colors
char status[80], rstatus[80];
int len = snprintf(status, sizeof(status), "# %.20s - %d lines",
E.status.filename ? E.status.filename : "[New File]", E.num_rows);
int rlen = snprintf(rstatus, sizeof(rstatus), "%d:%d %d ", E.cursor_y + 1, E.cursor_x + 1, E.num_rows);
if (len > E.screen_cols) {
len = E.screen_cols;
}
abAppend(ab, status, len);
while (len < E.screen_cols) {
if (E.screen_cols - len == rlen) {
abAppend(ab, rstatus, rlen);
break;
} else {
abAppend(ab, " ", 1);
len++;
}
}
abAppend(ab, "\x1b[m", 3); // Re-invert colors
abAppend(ab, "\r\n", 2);
}
void editorDrawMessage(struct abuf *ab) {
int show_length = 5; // seconds
abAppend(ab, "\x1b[K", 3); // clear message bar
int msglen = strlen(E.status.msg);
if (msglen > E.screen_cols) {
msglen = E.screen_cols;
}
if (msglen && time(NULL) - E.status.msg_time < show_length) {
abAppend(ab, E.status.msg, msglen);
}
}
void editorRefreshScreen() {
editorScroll();
struct abuf ab = ABUF_INIT;
// Hide cursor
abAppend(&ab, "\x1b[?25l", 6);
// Reposition cursor
abAppend(&ab, "\x1b[H", 3);
editorDrawRows(&ab);
editorDrawStatusBar(&ab);
editorDrawMessage(&ab);
char buf[32];
snprintf(buf, sizeof(buf), "\x1b[%d;%dH", (E.cursor_y - E.row_offset) + 1, (E.render_x - E.col_offset) + 1);
abAppend(&ab, buf, strlen(buf));
// Show cursor
abAppend(&ab, "\x1b[?25h", 6);
write(STDOUT_FILENO, ab.b, ab.len);
abFree(&ab);
}
void editorSetStatusMessage(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vsnprintf(E.status.msg, sizeof(E.status.msg), fmt, ap);
va_end(ap);
E.status.msg_time = time(NULL);
}
/*** input ***/
void editorMoveCursor(int key) {
erow *row = (E.cursor_y >= E.num_rows) ? NULL : &E.rows[E.cursor_y];
switch (key) {
case ARROW_LEFT:
if (E.cursor_x != 0) {
E.cursor_x--;
} else if (E.cursor_y > 0) {
E.cursor_y--;
E.cursor_x = E.rows[E.cursor_y].length;
}
break;
case ARROW_RIGHT:
if (row && E.cursor_x < row->length) {
E.cursor_x++;
} else if (row && E.cursor_x == row->length) {
E.cursor_x = 0;
E.cursor_y++;
}
break;
case ARROW_UP:
if (E.cursor_y != 0) {
E.cursor_y--;
}
break;
case ARROW_DOWN:
if (E.cursor_y < E.num_rows) {
E.cursor_y++;
}
break;
}
// Account for row lengths being different
row = (E.cursor_y >= E.num_rows) ? NULL : &E.rows[E.cursor_y];
int row_len = row ? row->length : 0;
if (E.cursor_x > row_len) {
E.cursor_x = row_len;
}
}
void editorProcessKeypresses() {
int c = editorReadKey();
switch (c) {
case '\r':
/* TODO */
break;
case CTRL_KEY('q'):
// Escape command to clear the whole screen
write(STDOUT_FILENO, "\x1b[2J", 4);
// Reposition cursor
write(STDOUT_FILENO, "\x1b[H", 3);
exit(0);
break;
case CTRL_KEY('s'):
saveEditor();
break;
case PAGE_UP:
case PAGE_DOWN:
{
if (c == PAGE_UP) {
E.cursor_y = E.row_offset;
} else if (c == PAGE_DOWN) {
E.cursor_y = E.row_offset + E.screen_rows + 1;
if (E.cursor_y > E.num_rows) {
E.cursor_y = E.num_rows;
}
}
int times = E.screen_rows;
while (times--) {
editorMoveCursor(c == PAGE_UP ? ARROW_UP : ARROW_DOWN);
}
}
break;
case HOME_KEY:
E.cursor_x = 0;
break;
case END_KEY:
if (E.cursor_y < E.num_rows) {
E.cursor_x = E.rows[E.cursor_y].length;
}
break;
case BACK_SPACE:
case CTRL_KEY('h'):
case DEL_KEY:
/* TODO */
break;
case ARROW_UP:
case ARROW_LEFT:
case ARROW_DOWN:
case ARROW_RIGHT:
editorMoveCursor(c);
break;
case CTRL_KEY('l'):
case '\x1b':
break;
default:
editorInsertChar(c);
break;
}
}
/*** init ***/
void initEditor() {
E.cursor_x = 0;
E.cursor_y = 0;
E.render_x = 0;
E.num_rows = 0;
E.rows = NULL;
E.row_offset = 0;
E.col_offset = 0;
E.status.filename = NULL;
E.status.msg[0] = '\0';
E.status.msg_time = 0;
if (getWindowSize(&E.screen_rows, &E.screen_cols) == -1) {
die("initEditor::getWindowSize");
}
E.screen_rows -= 2; // make room for status bar
}
int main(int argc, char *argv[]) {
enableRawMode();
initEditor();
if (argc >= 2) {
openEditor(argv[1]);
}
editorSetStatusMessage("lb help: Ctrl-S to save | Ctrl-Q to quit");
// Input loop
while (1) {
editorRefreshScreen();
editorProcessKeypresses();
}
return 0;
}
| 23.921703 | 112 | 0.496985 |
72c09f3aec740a530d0700513e6fe9e2ab403251 | 3,742 | h | C | Source/IntegratedExternals/vaBulletPhysicsIntegration.h | GameTechDev/XeGTAO | 0d177ce06bfa642f64d8af4de1197ad1bcb862d4 | [
"MIT"
] | 318 | 2021-08-20T10:16:12.000Z | 2022-03-24T03:08:16.000Z | Source/IntegratedExternals/vaBulletPhysicsIntegration.h | s-nase/XeGTAO | 11e439c33e3dd7c1e4ea0fc73733ca840bc95bec | [
"MIT"
] | 5 | 2021-09-03T11:40:54.000Z | 2022-02-09T12:37:12.000Z | Source/IntegratedExternals/vaBulletPhysicsIntegration.h | s-nase/XeGTAO | 11e439c33e3dd7c1e4ea0fc73733ca840bc95bec | [
"MIT"
] | 22 | 2021-09-02T03:33:18.000Z | 2022-02-23T06:36:39.000Z | #pragma once
#include "Core/vaCore.h"
#ifdef VA_BULLETPHYSICS_INTEGRATION_ENABLED
#include "Core/vaMath.h"
#include "IntegratedExternals\bullet\btBulletDynamicsCommon.h"
#include "IntegratedExternals\bullet\btBulletCollisionCommon.h"
#include "IntegratedExternals\bullet\BulletCollision\CollisionShapes\btHeightfieldTerrainShape.h"
//
//#include "BulletDynamics/MLCPSolvers/btDantzigSolver.h"
//#include "BulletDynamics/MLCPSolvers/btSolveProjectedGaussSeidel.h"
//#include "BulletDynamics/MLCPSolvers/btMLCPSolver.h"
//#include "BulletDynamics/ConstraintSolver/btHingeConstraint.h"
//#include "BulletDynamics/ConstraintSolver/btSliderConstraint.h"
//
//#include "../CommonInterfaces/CommonExampleInterface.h"
//#include "LinearMath/btAlignedObjectArray.h"
// Due to size, included manually through this file; also provides va <-> bt glue where needed
// From documentation:
// Description of the library
// Bullet Physics is a professional open source collision detection, rigid body and soft body dynamics library written in portable C++.The library is primarily designed for use in games, visual effects and robotic simulation.The library is free for commercial use under the ZLib license.
// Main Features
// - Discrete and continuous collision detection including ray and convex sweep test.Collision shapes include concave and convex meshes and all basic primitives
// - Maximal coordinate 6 - degree of freedom rigid bodies( btRigidBody ) connected by constraints( btTypedConstraint ) as well as generalized coordinate multi - bodies( btMultiBody ) connected by mobilizers using the articulated body algorithm.
// - Fast and stable rigid body dynamics constraint solver, vehicle dynamics, character controller and slider, hinge, generic 6DOF and cone twist constraint for ragdolls
// - Soft Body dynamics for cloth, rope and deformable volumes with two - way interaction with rigid bodies, including constraint support
// - Open source C++ code under Zlib license and free for any commercial use on all platforms including PLAYSTATION 3, XBox 360, Wii, PC, Linux, Mac OSX, Android and iPhone
// - Maya Dynamica plugin, Blender integration, native binary.bullet serialization and examples how to import URDF, Wavefront.obj and Quake.bsp files.
// - Many examples showing how to use the SDK.All examples are easy to browse in the OpenGL 3 example browser.Each example can also be compiled without graphics.
// - Quickstart Guide, Doxygen documentation, wiki and forum complement the examples.
// Contact and Support ? Public forum for support and feedback is available at http://bulletphysics.org
namespace Vanilla
{
inline btVector3 btvaBridge( const vaVector3 & v ) { return btVector3( v.x, v.y, v.z ); }
inline vaVector3 btvaBridge( const btVector3 & v ) { return vaVector3( v.getX(), v.getY(), v.getZ() ); }
inline btQuaternion btvaBridge( const vaQuaternion & v ) { return btQuaternion( v.x, v.y, v.z, v.w ); }
inline vaQuaternion btvaBridge( const btQuaternion & v ) { return vaQuaternion( v.getX(), v.getY( ), v.getZ( ), v.getW() ); }
inline btTransform btvaBridge( const vaQuaternion & rot, const vaVector3 & trans ) { return btTransform( btvaBridge( rot ), btvaBridge( trans ) ); }
inline btTransform btvaBridge( const vaMatrix4x4 & trans ) { return btvaBridge( vaQuaternion::FromRotationMatrix(trans), trans.GetTranslation() ); }
inline vaMatrix4x4 btvaBridge( const btTransform & trans ) { return vaMatrix4x4::FromRotationTranslation( btvaBridge( trans.getRotation() ), btvaBridge( trans.getOrigin() ) ); }
}
#endif | 70.603774 | 287 | 0.742117 |
3c51278fbfc9ef5974dd172bf8ddc9c900a21b16 | 662 | h | C | 170410/01_algos/01_stl/02_helper.h | yeputons/spring-2017-cpp | f590dcf031be6f2920cae5fc9fe147fcac414d3f | [
"MIT"
] | null | null | null | 170410/01_algos/01_stl/02_helper.h | yeputons/spring-2017-cpp | f590dcf031be6f2920cae5fc9fe147fcac414d3f | [
"MIT"
] | null | null | null | 170410/01_algos/01_stl/02_helper.h | yeputons/spring-2017-cpp | f590dcf031be6f2920cae5fc9fe147fcac414d3f | [
"MIT"
] | null | null | null | #ifndef H_01_STL_02_HELPER_H_
#define H_01_STL_02_HELPER_H_
#include <chrono>
template<typename T>
void fill(T& container) {
for (int i = 0; i < 10000; i++) {
container.push_back(i);
}
}
template<typename T>
void check(const T& container) {
using std::chrono::steady_clock;
using std::chrono::duration_cast;
using std::chrono::microseconds;
steady_clock::time_point start = steady_clock::now();
for (int i = 0; i < 10000; i++) {
std::binary_search(container.begin(), container.end(), i);
}
std::cout << "Spent: " <<
duration_cast<microseconds>(steady_clock::now() - start).count() << " us\n";
}
#endif // H_01_STL_02_HELPER_H_
| 24.518519 | 80 | 0.675227 |
715a7d362d324bcf64f6d489ee9870581e56f47c | 1,948 | h | C | src/prod/src/Hosting2/ServiceFactoryRegistrationTable.h | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 2,542 | 2018-03-14T21:56:12.000Z | 2019-05-06T01:18:20.000Z | src/prod/src/Hosting2/ServiceFactoryRegistrationTable.h | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 994 | 2019-05-07T02:39:30.000Z | 2022-03-31T13:23:04.000Z | src/prod/src/Hosting2/ServiceFactoryRegistrationTable.h | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 300 | 2018-03-14T21:57:17.000Z | 2019-05-06T20:07:00.000Z | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#pragma once
namespace Hosting2
{
class ServiceFactoryRegistrationTable
{
DENY_COPY(ServiceFactoryRegistrationTable)
public:
ServiceFactoryRegistrationTable();
Common::ErrorCode Add(ServiceFactoryRegistrationSPtr const & registration);
Common::ErrorCode Remove(ServiceModel::ServiceTypeIdentifier const & serviceTypeId, bool removeInvalid = false);
Common::ErrorCode Validate(ServiceModel::ServiceTypeIdentifier const & serviceTypeId);
Common::AsyncOperationSPtr BeginFind(
ServiceModel::ServiceTypeIdentifier const & serviceTypeId,
Common::AsyncCallback const & callback,
Common::AsyncOperationSPtr const & parent);
Common::ErrorCode EndFind(
Common::AsyncOperationSPtr const & operation,
__out ServiceFactoryRegistrationSPtr & registration,
__out ServiceModel::ServiceTypeIdentifier & serviceTypeId);
//TODO: serviceTypeId is required as a part of End as caller is not aware about the type of operation
//To avoid this we can create an AsyncOperation in the caller, store serviceTypeId and can pass it as a parent to BeginFind
//For Test Only
bool Test_IsServiceTypeInvalid(ServiceModel::ServiceTypeIdentifier const & serviceTypeId);
private:
class Entry;
typedef std::shared_ptr<Entry> EntrySPtr;
class EntryValidationLinkedAsyncOperation;
private:
Common::RwLock lock_;
std::map<ServiceModel::ServiceTypeIdentifier, EntrySPtr> map_;
};
}
| 42.347826 | 135 | 0.637577 |
7169b682af417a6bc7ac14601a5dc7d61fe4e97b | 14,216 | c | C | qamsource/podmgr/podserver/cardmanager/scm_pod_stack/podlowapi.c | rdkcmf/rdk-mediaframework | 55c7753eedaeb15719c5825f212372857459a87e | [
"Apache-2.0"
] | null | null | null | qamsource/podmgr/podserver/cardmanager/scm_pod_stack/podlowapi.c | rdkcmf/rdk-mediaframework | 55c7753eedaeb15719c5825f212372857459a87e | [
"Apache-2.0"
] | null | null | null | qamsource/podmgr/podserver/cardmanager/scm_pod_stack/podlowapi.c | rdkcmf/rdk-mediaframework | 55c7753eedaeb15719c5825f212372857459a87e | [
"Apache-2.0"
] | null | null | null | /*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2011 RDK Management
*
* 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <time.h>
#include "utils.h"
#include "transport.h"
#include "session.h"
#include "lcsm_log.h"
#include "podlowapi.h"
#include <string.h>
#ifdef LINUX
//# include "pthreadLibrary.h"
//# include "podmod.h"
# include "poddrv.h"
#include "rmf_osal_mem.h"
#ifdef VL_USE_MEMORY_POOL_FOR_POD_WRITE
#include "rmfStaticMemoryPool.h"
#endif
#define __MTAG__ VL_CARD_MANAGER
#if USE_SYSRES_MLT
#include "mlt_malloc.h"
#endif
#endif // LINUX
#ifdef __cplusplus
extern "C" {
#endif
// Add file name and revision tag to object code
#define REVISION __FILE__ " $Revision: 1.14 $"
/*@unused@*/
static char *podlowapi_tag = REVISION;
extern ULONG TaskID;
//************************************************************************************
// Memory management
//************************************************************************************
#define TRACE_MEM
#ifdef VL_USE_MEMORY_POOL_FOR_POD_WRITE
//#define VL_POD_MEM_POOL_TYPE_STATIC
//#define VL_POD_MEM_POOL_TYPE_HEAP
#define VL_POD_MEM_POOL_TYPE_PROTECTED
#ifdef VL_POD_MEM_POOL_TYPE_STATIC
#define VL_POD_MEM_POOL_TYPE RMF_MEM_POOL_TYPE_STATIC
#endif
#ifdef VL_POD_MEM_POOL_TYPE_HEAP
#define VL_POD_MEM_POOL_TYPE RMF_MEM_POOL_TYPE_HEAP
#endif
#ifdef VL_POD_MEM_POOL_TYPE_PROTECTED
#define VL_POD_MEM_POOL_TYPE RMF_MEM_POOL_TYPE_PROTECTED
#endif
static RMF_FIXED_H124_MEM_POOL * vlg_pPodMemPool = NULL;
#ifdef VL_POD_MEM_POOL_TYPE_STATIC
static VL_FIXED_H124_MEM_POOL vlg_staticMemPool;
#endif // not (VL_MEM_POOL_TYPE_STATIC == VL_POD_MEM_POOL_TYPE)
#endif // VL_USE_MEMORY_POOL_FOR_POD_WRITE
/****************************************************************************************
Name: vlCardManager_PodMemFree
type: function
Description: Free the allocated memory
MR IMPLEMENTATION NOTE: Assumes memory freed is regular target RAM (not
in the POD) previously allocated via PODMemAllocate
In: Nothing
Out: UCHAR* pU: Pointer on the allocated area
Return value: void
*****************************************************************************************/
void vlCardManager_PodMemFree(UCHAR * pU)
{
#ifdef VL_USE_MEMORY_POOL_FOR_POD_WRITE
if(RMF_MEM_POOL_RESULT_NOT_FROM_THIS_POOL == rmfFixedH124MemPoolReleaseToPool(vlg_pPodMemPool, pU))
{
// The block did not belong to the pool. Try releasing the block to the process heap.
// This may crash due to invalid pointer, double-free, heap corruption, etc.
free( pU);
}
#else // not VL_USE_MEMORY_POOL_FOR_POD_WRITE
PODMemFree(pU);
#endif // not VL_USE_MEMORY_POOL_FOR_POD_WRITE
}
/****************************************************************************************
Name: vlCardManager_PodMemAllocate
type: function
Description: Allocate memory
MR IMPLEMENTATION NOTE: Assumes memory to be allocated is regular target
RAM (not in the POD) that can be freed via PODMemFree
In: Size to be allocated
Out: Nothing
Return value: UCHAR* pU: Pointer on the allocated area
*****************************************************************************************/
unsigned char * vlCardManager_PodMemAllocate(USHORT size)
{
#ifdef VL_USE_MEMORY_POOL_FOR_POD_WRITE
if(NULL == vlg_pPodMemPool)
{
#ifdef VL_POD_MEM_POOL_TYPE_STATIC
rmfFixedH124MemPoolInit(&vlg_staticMemPool, "VL_POD_MEM_POOL");
vlg_pPodMemPool = &vlg_staticMemPool;
#else
rmfFixedH124MemPoolCreate(&vlg_pPodMemPool, "VL_POD_MEM_POOL", VL_POD_MEM_POOL_TYPE);
#endif
}
void * pBuf = NULL;
rmfFixedH124MemPoolAllocFromPool(vlg_pPodMemPool, size, &pBuf);
if(NULL == pBuf)
{
// The memory pool appears to be exausted OR unable to accomodate the buffer size.
// Resort to process heap instead of returning NULL.
// This may crash due to heap corruption, etc.
return (unsigned char *)malloc(size);
}
return (unsigned char *)pBuf;
#else // not VL_USE_MEMORY_POOL_FOR_POD_WRITE
return (unsigned char *)PODMemAllocate(size);
#endif // not VL_USE_MEMORY_POOL_FOR_POD_WRITE
}
/****************************************************************************************
Name: PODMemFree
type: function
Description: Free the allocated memory
MR IMPLEMENTATION NOTE: Assumes memory freed is regular target RAM (not
in the POD) previously allocated via PODMemAllocate
In: Nothing
Out: UCHAR* pU: Pointer on the allocated area
Return value: void
*****************************************************************************************/
void PODMemFree(UCHAR * pU)
{
#ifdef WIN32
rmf_osal_memFreeP(RMF_OSAL_MEM_POD, pU);
pU = NULL;
#elif PSOS
ULONG RetCode;
# ifdef TRACE_MEM
PODFree(pU);
# endif
RetCode = rn_retseg(0 , (void *)(pU));
if ( ! RetCode )
{
return;
}
else
{
return ;
}
#elif LINUX
// avoid free'ing nothing (even though free checks for that)
// MDEBUG(DPM_TEMP, " pU=0x%x\n", (unsigned int) pU );
if( pU )
rmf_osal_memFreeP(RMF_OSAL_MEM_POD, pU);
return;
#else // RTOS not defined - error
# error __FILE__ __LINE__ RTOS must be defined in utils.h
#endif // WIN32
}
/****************************************************************************************
Name: PODMemAllocate
type: function
Description: Allocate memory
MR IMPLEMENTATION NOTE: Assumes memory to be allocated is regular target
RAM (not in the POD) that can be freed via PODMemFree
In: Size to be allocated
Out: Nothing
Return value: UCHAR* pU: Pointer on the allocated area
*****************************************************************************************/
unsigned char * PODMemAllocate(USHORT size)
{
#ifdef WIN32
UCHAR* p;
rmf_osal_memAllocP(RMF_OSAL_MEM_POD, size,(void **)&p);
return p;
#elif PSOS
ULONG RetCode;
void * pAddr;
RetCode = rn_getseg( 0, size, RN_NOWAIT, 0, (void**)(&pAddr) );
if ( ! RetCode )
{
# ifdef TRACE_MEM
PODMalloc(pAddr,size);
# endif
return ((UCHAR*)pAddr);
}
else
{
return NULL;
}
#elif LINUX
// return a pointer to the beginning of a cleared memory block
UCHAR *puc;
rmf_osal_memAllocP(RMF_OSAL_MEM_POD, (size_t) size ,(void **)&puc);
memset (puc, 0, (size_t) size);
if ( puc == NULL )
{
MDEBUG (DPM_ERROR, "ERROR: Can't alloc size=0x%x\n", size );
}
return puc;
// UCHAR * chunk = (UCHAR *) malloc( (size_t) size );
// MDEBUG (DPM_GEN, " chunk=0x%x size=0x%x\n", (unsigned int) chunk, size );
// return chunk;
#else
# error __FILE__ __LINE__ RTOS must be defined in utils.h
return NULL;
#endif // WIN32
}
/****************************************************************************************
Name: PODMemCopy
type: function
Description: Copy Source buffer to Destination buffer
MR IMPLEMENTATION NOTE: Assumes memory source and destination addresses
are in regular target RAM (not in the POD); i.e. always "case 1"
In: PVOID Destination : Destination address
PVOID Source : Source Address
USHORT Length : Length to be copied
Out: Nothing
Return value: void
*****************************************************************************************/
void PODMemCopy( PUCHAR Destination, PUCHAR Source, USHORT Length)
{
#ifdef WIN32
// memcpy(Destination,Source,Length);
memcpy(Destination,Source,Length);
#elif PSOS
USHORT i;
UCHAR* pD = (UCHAR*)Destination;
UCHAR* pS = (UCHAR*)Source;
for ( i = 0; i<Length; i++)
{
(pD[i]) = (UCHAR)(pS[i]);
}
#elif LINUX
/* 4 possible cases of memory copy:
* 1. from regular memory to regular memory
* 2. from regular memory to POD
* 3. from POD to regular memory
* 4. from POD to POD
* With the help of mmap(), all 4 cases handled by memcpy()
*/
// MDEBUG (DPM_GEN, "( 0x%x, 0x%x, %d )\n", (int) Destination, (int) Source, (int) Length );
// avoid undefined results based on bogus args
if( Destination && Source && Length )
{
// memcpy( Destination, Source, (size_t) Length );
memcpy( Destination, Source, (size_t) Length );
}
else
{
MDEBUG (DPM_ERROR, "ERROR: return FALSE\r\n");
}
// MDEBUG (DPM_GEN, "after PODMemCopy()\n");
#else // RTOS not defined - error
# error __FILE__ __LINE__ RTOS must be defined in utils.h
#endif // WIN32
}
//************************************************************************************
//
//
// MISCELLANEOUS SYSTEM FUNCTIONS...
//
//
//************************************************************************************
/****************************************************************************************
Name: PODSleep
type: function
Description: Calling task sleeps during TimeMs ms
In: USHORT TimeMs : Time to sleep
Out: Nothing
Return value: void
*****************************************************************************************/
void PODSleep(USHORT TimeMs)
{
#ifdef WIN32
Sleep(TimeMs);
#elif PSOS
// SHHHHH, no trace of what we do here
// Macros are taken from PSOS files
# define TICK_RATE 100 /* x ticks per second */
# define TIMER_MSEC(t) ( ((t) * TICK_RATE / 1000) + 1 )
tm_wkafter( TIMER_MSEC(TimeMs));
# undef TICK_RATE
# undef TIMER_MSEC
#elif LINUX
// nb: can't be any more granular than 1/HZ which is kernel's timer interval
if( TimeMs )
{
struct timespec req, rem; // requested, remaining
req.tv_sec = TimeMs / 1000;
req.tv_nsec = ( (long)TimeMs - ( req.tv_sec * 1000 ) ) * 1000 * 1000;
// MDEBUG (DPM_TEMP, " TimeMs=%d req.tv_sec=%d req.tv_nsec=%d\n",
// (int) TimeMs, (int) req.tv_sec, (int) req.tv_nsec );
// until nanosleep returns 0 (indicating requested time has elasped)
while( nanosleep( &req, &rem ) )
{
/* commented by Hannah
if( errno != EINTR )
break;
*/
// received an interrupt which prematurely cancelled sleeping.
// setup time left to sleep (returned in 'rem' by nanosleep)
req.tv_sec = rem.tv_sec;
req.tv_nsec = rem.tv_nsec;
}
}
#else
# error __FILE__ __LINE__ RTOS must be defined in utils.h
#endif // WIN32
}
//************************************************************************************
//
// GLOBAL STRUCTURES, VARIABLES AND FUNCTIONS
//
// FOR MEMORY ALLOCATIONS CHECKING
//
//************************************************************************************
#ifdef TRACE_MEM
typedef struct
{
PVOID Addr;
USHORT Size;
} PODAllocation;
#define MAX_ALLOCATIONS 300
PODAllocation Alloc[MAX_ALLOCATIONS];
USHORT NumberOfAllocations = 0;
void PODMalloc(UCHAR* Ret, USHORT Size)
{
if(Ret && ( NumberOfAllocations < MAX_ALLOCATIONS ))
{
MDEBUG (DPM_OFF, "%d : Allocate %d Bytes at 0x%08X \r\n",NumberOfAllocations, Size,(unsigned int)Ret);
Alloc[NumberOfAllocations].Size = Size;
Alloc[NumberOfAllocations].Addr = Ret;
NumberOfAllocations++;
}
else
{
MDEBUG (DPM_ERROR, "ERROR: Allocation Failed\r\n");
}
}
void PODFree(UCHAR* pDest)
{
unsigned short i,j;
for ( i = 0; i < NumberOfAllocations; i++)
{
if (Alloc[i].Addr == pDest)
{
MDEBUG (DPM_TEMP, "%d : free at 0x%08X\r\n",i, (unsigned int)pDest);
Alloc[i].Addr = NULL;
Alloc[i].Size = 0;
/* Cleanup by shifting all allocations down in the table so there
** are no empty spots */
for(j=i; j<(NumberOfAllocations -1); j++)
{
Alloc[j].Addr = Alloc[j+1].Addr;
Alloc[j].Size = Alloc[j+1].Size;
}
NumberOfAllocations--;
return;
}
}
MDEBUG (DPM_ERROR, "ERROR: cannot free memory 0x%08X\r\n", (unsigned int)pDest);
}
/* Only used for debug after we believe that all allocs should have been freed */
void PODCheck()
{
unsigned short i;
BOOL Error = FALSE;
MDEBUG (DPM_OFF, "-------------------------------------------------\r\n");
MDEBUG (DPM_OFF, "Checking memory allocations \r\n");
for ( i = 0; i < MAX_ALLOCATIONS; i++)
{
if ((Alloc[i].Addr != NULL) )
{
MDEBUG (DPM_ERROR, "ERROR: Forget to Free memory Address = 0x%08X Size = %d\r\n",(unsigned int)Alloc[i].Addr,Alloc[i].Size);
Error = TRUE;
}
}
if (! Error)
MDEBUG (DPM_OFF, "Wonderful ! ! No Error \r\n");
MDEBUG (DPM_OFF, "-------------------------------------------------\r\n");
}
#endif
#ifdef __cplusplus
}
#endif
| 27.391137 | 140 | 0.550155 |
14bdf46ae60233ac4fba69393bb6a718cd6369c2 | 2,401 | c | C | cgi-bin/logout.c | Ikaros-521/boa_cgi_SMS | 194c79c34f6a27588a85ea9d2f51866310e55eef | [
"Apache-2.0"
] | 3 | 2021-12-15T10:21:27.000Z | 2022-02-02T16:33:15.000Z | cgi-bin/logout.c | Ikaros-521/boa_cgi_SMS | 194c79c34f6a27588a85ea9d2f51866310e55eef | [
"Apache-2.0"
] | null | null | null | cgi-bin/logout.c | Ikaros-521/boa_cgi_SMS | 194c79c34f6a27588a85ea9d2f51866310e55eef | [
"Apache-2.0"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include "cgic.h"
#define SESSION_ID_LEN 45
int cgiMain(void)
{
char *lenstr;
int fd_webdata=-1;
if(lenstr=getenv("QUERY_STRING"))
{
}
else
{
}
printf("Content_type: text/html\n\n");
if(strstr(lenstr,"logout,") != NULL)
{
char username[20] = {};
char session_id[SESSION_ID_LEN] = {};
int i = 0;
char *temp = lenstr;
temp = strstr(lenstr, "username:");
if(temp == NULL)
{
printf("<p>error,JS发送数据错误</p>");
close(fd_webdata);
return 0;
}
temp += 9;
while(1)
{
if(temp[i] != ',')
{
username[i] = temp[i];
i++;
}
else
{
break;
}
}
i = 0;
temp = NULL;
temp = strstr(lenstr, "session_id:");
if(temp == NULL)
{
printf("<p>error,JS发送数据错误</p>");
close(fd_webdata);
return 0;
}
temp += 11;
while(1)
{
if(temp[i] != ',')
{
session_id[i] = temp[i];
i++;
}
else
{
break;
}
}
i = 0;
temp = NULL;
char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
time_t timep;
struct tm *p;
time(&timep);
p=localtime(&timep); /*取得当地时间*/
// 写入日志 log.log
char log_name[30] = {};
if((1+p->tm_mon) < 10)
{
if(p->tm_mday < 10)
sprintf(log_name, "../log/log%d-0%d-0%d.log", (1900+p->tm_year),(1+p->tm_mon), p->tm_mday);
else
sprintf(log_name, "../log/log%d-0%d-%d.log", (1900+p->tm_year),(1+p->tm_mon), p->tm_mday);
}
else
{
if(p->tm_mday < 10)
sprintf(log_name, "../log/log%d-%d-0%d.log", (1900+p->tm_year),(1+p->tm_mon), p->tm_mday);
else
sprintf(log_name, "../log/log%d-%d-%d.log", (1900+p->tm_year),(1+p->tm_mon), p->tm_mday);
}
FILE *fd = fopen(log_name, "a");
if(fd == NULL)
{
printf("<p>error</p>");
close(fd_webdata);
return 0;
}
else
{
int size = fprintf(fd, "%d-%d-%d_%d:%d:%d logout username:%s,logout\n",(1900+p->tm_year),(1+p->tm_mon), p->tm_mday ,p->tm_hour, p
->tm_min, p->tm_sec, username);
fclose(fd);
}
char shell_str[200] = {};
sprintf(shell_str, "sudo rm -rf /var/www/session/%s", session_id);
int ret = system(shell_str);
if(ret == 0)
{
// 把结果发送回去
printf("<p>success</p>");
}
else
{
printf("<p>error,删除session失败</p>");
}
}
//最后记得关闭文件
close(fd_webdata);
return 0;
}
| 17.91791 | 132 | 0.546855 |
213cf4ccf80d34fb180a1c50534488fdeb0a10ab | 2,221 | c | C | 2_stacks_1_buffer/checker_s/ft_game_2.c | iiasceri/AcademyPlus | 3a48cbfe82c1d1e859d5d9300c2b811715c0b042 | [
"MIT"
] | null | null | null | 2_stacks_1_buffer/checker_s/ft_game_2.c | iiasceri/AcademyPlus | 3a48cbfe82c1d1e859d5d9300c2b811715c0b042 | [
"MIT"
] | null | null | null | 2_stacks_1_buffer/checker_s/ft_game_2.c | iiasceri/AcademyPlus | 3a48cbfe82c1d1e859d5d9300c2b811715c0b042 | [
"MIT"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_game_2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: iiasceri <iiasceri@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/03/22 14:50:27 by iiasceri #+# #+# */
/* Updated: 2018/03/22 14:50:28 by iiasceri ### ########.fr */
/* */
/* ************************************************************************** */
#include "../shared_s/push_swap.h"
static void ft_use_commands(int n, t_stack *stks)
{
void (*oper[11])(t_stack*);
oper[1] = &sa;
oper[2] = &sb;
oper[3] = &ss;
oper[4] = &pa;
oper[5] = &pb;
oper[6] = &ra;
oper[7] = &rb;
oper[8] = &rr;
oper[9] = &rra;
oper[0] = &rrb;
oper[10] = &rrr;
oper[n](stks);
}
static int ft_game_act_2(t_history *history, int oper, t_stack *stks)
{
if (oper == 15)
ft_print_history(history, 1);
if (oper == 16)
ft_print_history(history, 0);
if (oper == 17)
return (1);
if (oper == 18)
{
if (stks->clear == 0)
stks->clear = 1;
else if (stks->clear == 1)
stks->clear = 0;
}
return (0);
}
int ft_game_act(char *argument, t_stack *stks, t_history *history)
{
int oper;
oper = ft_check_game_command(argument);
free(argument);
if (oper >= 0 && oper < 11)
ft_use_commands(oper, stks);
else if (oper == 11)
return (-1);
else if (oper == 12)
ft_print_list_of_commands();
else if (oper == 13)
{
if (stks->elems_a < stks->size)
ft_printf("warning: stack not filled\n"
"only %d of %d numbers in the stack a\n", stks->elems_a, stks->size);
if (ft_is_stack_in_order(stks) == 1)
ft_printf("OK\n");
else
ft_printf("KO\n");
}
else if (oper == 14)
ft_print_stacks(stks);
else
return (ft_game_act_2(history, oper, stks));
return (0);
}
| 28.113924 | 80 | 0.410176 |
34acb8ff4bcd963459d642ae8f79bc272048980f | 8,807 | c | C | main.c | ysph/g403-GUI-control | 37de9ea3a1858785f8e5fa20f8e917d8445c9576 | [
"MIT"
] | 4 | 2021-03-28T01:58:59.000Z | 2022-01-29T10:26:19.000Z | main.c | ysph/g403-GUI-control | 37de9ea3a1858785f8e5fa20f8e917d8445c9576 | [
"MIT"
] | 2 | 2020-06-11T12:23:48.000Z | 2020-06-18T20:16:40.000Z | main.c | ysph/gHub-GUI | 37de9ea3a1858785f8e5fa20f8e917d8445c9576 | [
"MIT"
] | 2 | 2021-11-03T17:34:36.000Z | 2022-03-01T03:42:14.000Z | // Copyright 2020 Mikhail ysph Subbotin
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#include <libusb-1.0/libusb.h>
#include "mouselist.h"
#include "miscellaneous.h"
#define LIBUSB_OPTION_LOG_LEVEL 0
#define LIBUSB_LOG_LEVEL_ERROR 1
static libusb_device_handle *devh = NULL;
libusb_context *global_context;
static int source, type, R, G, B;
static const int bmRequestType = 0x21; // type and recipient: 0b00100001
static const int bRequest = 0x09; // type of request: set_report
static const int wValue = 0x0211; // report type and id: output, 0x11
int wIndex, returnCode, found = 0;
Item* available_head; // the list contains available devices
//temporary
int temp_id;
void CloseDeviceAndExit(void) {
if (devh)
libusb_close(devh);
libusb_exit(NULL);
}
void DetachKernel(void) {
if (libusb_kernel_driver_active(devh, wIndex)) {
libusb_detach_kernel_driver(devh, wIndex);
}
returnCode = libusb_claim_interface(devh, wIndex);
if (returnCode < 0) {
fprintf(stderr, "Error: Cannot claim interface: %s\n",
libusb_error_name(returnCode));
CloseDeviceAndExit();
return;
}
}
void AttachKernel(void) {
libusb_release_interface(devh, wIndex);
if (!libusb_kernel_driver_active(devh, wIndex)) {
libusb_attach_kernel_driver(devh, wIndex);
}
}
int openDevice(void) {
const int available = getSize(available_head);
int choice;
char input_string[20];
printf("\nChoose what device you would like to operate on. Available devices:\n");
printAllItems(available_head);
printf("Enter [0] to exit.\n");
LOOP:
fgets(input_string, 20, stdin);
choice = strtol(input_string, NULL, 0);
if ((choice < 0) || (choice > available)) {
printf("Choose correct number or exit!\n");
fflush(stdin);
goto LOOP;
} else if (choice == 0) {
printf("Exiting...\n");
fflush(stdin);
return 2;
}
const int needed_id = getNthId(available_head, choice);
const char* temp_name = getName(available_head, needed_id);
//open device
devh = libusb_open_device_with_vid_pid(NULL, ID_VENDOR, needed_id);
if (!devh) {
fprintf(stderr, "Error: Cannot open %s\n", temp_name);
return -1;
}
printf("\nDevice %s is operating...\n", temp_name);
//process
srand((unsigned)time(NULL));
wIndex = getInterface(available_head, needed_id);
int devByte[4];
// we dont choose what we change yet
// devByte[0] is changed to 0x10 when we change dpi or response rate
// devByte[3] is changing as well
devByte[0] = 0x11;
devByte[2] = getByte3(available_head, needed_id);
devByte[3] = 0x3b;
// exclusive option for logitech pro wireless
switch (wIndex) {
case 1:
devByte[1] = 0xff;
break;
case 2:
devByte[1] = 0x01;
break;
default:
printf("Error: Wrong interface!\n");
return -1;
}
if (needed_id == 0xc088) {
wIndex = 2;
devByte[1] = 0xff;
}
uint32_t random = (uint32_t)rand();
type = 0x01; // static
source = random & 0x01; // 0 - primary, 1 - logo
R = random & 0xff;
G = (random >> 8) & 0xff;
B = (random >> 16) & 0xff;
unsigned char data[20] = {devByte[0], devByte[1], devByte[2], devByte[3], source, type, R, G, B, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
/* detach kernel
&
claim the interface on a given device handle */
DetachKernel();
returnCode = libusb_control_transfer(devh, bmRequestType, bRequest, wValue,
wIndex, data, sizeof(data), 2000);
if (returnCode < 0) {
fprintf(stderr, "Error: Cannot transfer control data: %s\n", libusb_error_name(returnCode));
}
/* release the interface previously claimed
&
attach kernel */
AttachKernel();
if (devh)
libusb_close(devh);
return EXIT_SUCCESS;
}
int getDevice(Item* head) {
libusb_device **list;
struct libusb_device_descriptor desc;
int i;
ssize_t count = libusb_get_device_list(global_context, &list);
for (i = 0; i < count; ++i) {
libusb_device *device = list[i];
if (!libusb_get_device_descriptor(device, &desc)) {
if (desc.idProduct == ID_PRODUCT_UNIDENTIFIED) {
printf("Found wireless logitech device, but it's UNIDENTIFIED.\n");
printf("Consider upgrading the kernel to at least version of 5.2.\nOr use wired option of your mouse.\n\n");
continue;
}
if (ID_VENDOR == desc.idVendor && searchItem(head, desc.idProduct)) {
const char* temp_name = getName(head, desc.idProduct);
const int temp_interface = getInterface(head, desc.idProduct);
const int temp_byte3 = getByte3(head, desc.idProduct);
pushItem(&available_head, desc.idProduct, temp_name, temp_interface, temp_byte3);
printf("\nDevice id=0x%x, name=%s, interface=%x - has been found!\n", desc.idProduct, temp_name, temp_interface);
found++;
}
}
}
if (!found) return found;
libusb_free_device_list(list, 1);
return 1;
}
int main(void) {
// init
returnCode = libusb_init(NULL);
#if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01000106) // >=1.0.22
libusb_set_option(global_context, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_ERROR);
#else
libusb_set_debug(global_context, LIBUSB_LOG_LEVEL_ERROR);
#endif
if (returnCode < 0) {
fprintf(stderr, "Error: Cannot initialize libusb. %s\n", libusb_error_name(returnCode));
return returnCode;
}
// add known devices
Item* head = (Item*)malloc(size_of_Item);
head->next = NULL;
//pushItem(&head, 0xc092, "G102-G203 LIGHTSYNC", WIRED_OR_CABLE);
pushItem(&head, 0xc084, "G203 Prodigy", WIRED_OR_CABLE, 0x0e);
pushItem(&head, 0xc083, "G403 Prodigy", WIRED_OR_CABLE, 0x0e);
//pushItem(&head, 0xc07f, "G302 Daedalus Prime", WIRED_OR_CABLE,);
//pushItem(&head, 0xc080, "G303 Daedalus Apex", WIRED_OR_CABLE,);
//pushItem(&head, 0x4074, "G305 Lightspeed Wireless", WIRELESS_RECEIVER,);
//pushItem(&head, 0xc07e, "G402 Hyperion Fury", WIRED_OR_CABLE,);
//pushItem(&head, 0xc08f, "G403 Hero", WIRED_OR_CABLE);
pushItem(&head, 0xc082, "G403 Wireless", WIRED_OR_CABLE, 0x18);
pushItem(&head, 0x405d, "G403 Wireless", WIRELESS_RECEIVER, 0x18);
//pushItem(&head, 0xc07d, "G502 Proteus Core", WIRED_OR_CABLE, 0x02);
//pushItem(&head, 0xc08b, "G502 Hero", WIRED_OR_CABLE);
pushItem(&head, 0xc332, "G502 Proteus Spectrum", WIRED_OR_CABLE, 0x02);
//pushItem(&head, 0xc08d, "G502 Lightspeed Wireless", WIRED_OR_CABLE);
//pushItem(&head, 0x407f, "G502 Lightspeed Wireless", WIRELESS_RECEIVER);
//pushItem(&head, 0xc08e, "MX518", WIRED_OR_CABLE);
//pushItem(&head, 0xc24a, "G600 MMO", WIRED_OR_CABLE);
//pushItem(&head, 0xc537, "G602 Wireless", WIRELESS_RECEIVER);
//pushItem(&head, 0x406c, "G603 Lightspeed Wireless", WIRELESS_RECEIVER);
//pushItem(&head, 0xb024, "G604 Lightspeed Wireless", WIRED_OR_CABLE);
//pushItem(&head, 0x4085, "G604 Lightspeed Wireless", WIRELESS_RECEIVER);
pushItem(&head, 0xc087, "G703 Lightspeed Wireless", WIRED_OR_CABLE, 0x18);
pushItem(&head, 0x4070, "G703 Lightspeed Wireless", WIRELESS_RECEIVER, 0x18);
//pushItem(&head, 0xc090, "G703 Lightspeed Hero Wireless", WIRED_OR_CABLE);
//pushItem(&head, 0x4086, "G703 Lightspeed Hero Wireless", WIRELESS_RECEIVER);
//pushItem(&head, 0xc081, "G900 Chaos Spectrum Wireless", WIRED_OR_CABLE);
//pushItem(&head, 0x4053, "G900 Chaos Spectrum Wireless", WIRELESS_RECEIVER);
//pushItem(&head, 0xc086, "G903 Lightspeed Wireless", WIRED_OR_CABLE);
//pushItem(&head, 0x4067, "G903 Lightspeed Wireless", WIRELESS_RECEIVER);
//pushItem(&head, 0xc091, "G903 Lightspeed Hero Wireless", WIRED_OR_CABLE);
//pushItem(&head, 0x4087, "G903 Lightspeed Hero Wireless", WIRELESS_RECEIVER);
//pushItem(&head, 0xc085, "PRO", WIRED_OR_CABLE);
//pushItem(&head, 0xc08c, "PRO HERO", WIRED_OR_CABLE);
pushItem(&head, 0xc088, "PRO Wireless", WIRED_OR_CABLE, 0x07);
pushItem(&head, 0x4079, "PRO Wireless", WIRELESS_RECEIVER, 0x07);
// list for available devices
available_head = (Item*)malloc(size_of_Item);
available_head->next = NULL;
// find device
returnCode = getDevice(head);
if (!returnCode) {
fprintf(stderr, "Error: Cannot find any logitech mouse. %s\n", libusb_error_name(returnCode));
CloseDeviceAndExit();
return returnCode;
}
returnCode = openDevice();
if (returnCode == 2) {
deleteLinkedList(&head);
deleteLinkedList(&available_head);
CloseDeviceAndExit();
return EXIT_SUCCESS;
}
if (returnCode < 0) {
fprintf(stderr, "Error: Cannot operate logitech mouse. %s\n", libusb_error_name(returnCode));
CloseDeviceAndExit();
return EXIT_FAILURE;
}
if (returnCode >= 0) {
printf("Now, the color of your ");
switch (source) {
case 0:
printf("primary ");
break;
case 1:
printf("logo ");
break;
default:
printf("undefined!\n");
deleteLinkedList(&head);
deleteLinkedList(&available_head);
exit(EXIT_FAILURE);
}
printf("is #%02x%02x%02x\n",R,G,B);
}
deleteLinkedList(&head);
deleteLinkedList(&available_head);
libusb_exit(NULL);
return EXIT_SUCCESS;
}
| 30.160959 | 134 | 0.707732 |
1fb39119868bcdb0f70b7229472c3530dc064f63 | 1,665 | h | C | reuse/m2c/Errors.h | cocolab8/cocktail | 6b4dfe28fcca30098c9a053f48e5a395c006009d | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | reuse/m2c/Errors.h | cocolab8/cocktail | 6b4dfe28fcca30098c9a053f48e5a395c006009d | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | reuse/m2c/Errors.h | cocolab8/cocktail | 6b4dfe28fcca30098c9a053f48e5a395c006009d | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | #define DEFINITION_Errors
#ifndef DEFINITION_Position
#include "Position.h"
#endif
#ifndef DEFINITION_IO
#include "IO.h"
#endif
#define ZblNKKO_0 0
#define ZblNKKO_1 1
#define ZblNKKO_2 2
#define ZblNKKO_3 3
#define ZblNKKO_4 4
#define ZblNKKO_5 5
#define ZblNKKO_6 6
#define ZblNKKO_7 7
#define ZblNKKO_8 8
#define ZblNKKO_9 9
#define ZblNKKO_10 10
#define ZblNKKO_11 11
#define ZblNKKO_12 12
#define ZblNKKO_13 0
#define ZblNKKO_14 1
#define ZblNKKO_15 2
#define ZblNKKO_16 3
#define ZblNKKO_17 4
#define ZblNKKO_18 5
#define ZblNKKO_19 6
#define ZblNKKO_20 7
#define ZblNKKO_21 0
#define ZblNKKO_22 1
#define ZblNKKO_23 2
#define ZblNKKO_24 3
#define ZblNKKO_25 4
#define ZblNKKO_26 5
#define ZblNKKO_27 6
#define ZblNKKO_28 7
#define ZblNKKO_29 8
#define ZblNKKO_30 9
#define ZblNKKO_31 10
#define ZblNKKO_32 11
#define ZblNKKO_33 12
#define ZblNKKO_34 13
#define ZblNKKO_35 14
#define ZblNKKO_36 15
extern PROC ZblNKKO_37;
extern BOOLEAN ZblNKKO_38;
extern BOOLEAN ZblNKKO_39;
extern BOOLEAN ZblNKKO_40;
extern void ZblNKKO_41 ARGS ((void));
extern void ZblNKKO_42 ARGS ((void));
extern void ZblNKKO_43 ARGS ((BOOLEAN Z162));
extern void ZblNKKO_44 ARGS ((CARDINAL Z164, CARDINAL Z165, ZmtLFGGBG_0 Z115));
extern void ZblNKKO_45 ARGS ((CARDINAL Z164, CARDINAL Z165, ZmtLFGGBG_0 Z115, CARDINAL Z167, ADDRESS Z168));
extern void ZblNKKO_46 ARGS ((CHAR Z170[], LONGCARD , CARDINAL Z165, ZmtLFGGBG_0 Z115));
extern void ZblNKKO_47 ARGS ((CHAR Z170[], LONGCARD , CARDINAL Z165, ZmtLFGGBG_0 Z115, CARDINAL Z167, ADDRESS Z168));
extern void ZblNKKO_48 ARGS ((ZfM_3 Z173));
extern CARDINAL ZblNKKO_49 ARGS ((CARDINAL Z165));
extern void BEGIN_Errors ARGS ((void));
| 26.854839 | 117 | 0.792793 |
225ead49e4458c289e28d333823ff7094977bafa | 26,445 | h | C | include/star/utils/detail/basic_circular.h | hara-y/StarROS | 03008d8acb46f606bf750cdbb4a9703fae427694 | [
"Apache-2.0"
] | 2 | 2020-05-16T03:14:54.000Z | 2020-05-16T08:27:24.000Z | include/star/utils/detail/basic_circular.h | hara-y/StarROS | 03008d8acb46f606bf750cdbb4a9703fae427694 | [
"Apache-2.0"
] | null | null | null | include/star/utils/detail/basic_circular.h | hara-y/StarROS | 03008d8acb46f606bf750cdbb4a9703fae427694 | [
"Apache-2.0"
] | 3 | 2020-05-15T09:50:06.000Z | 2020-08-26T12:47:05.000Z | /**
* @author : John
* @date : 2018-09-20
*/
#ifndef __STAR_SDK_UTILS_BASIC_CIRCULAR_H
#define __STAR_SDK_UTILS_BASIC_CIRCULAR_H
#include <star/star.h>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <stdexcept>
#include <star/utils/detail/buffer.h>
namespace ss {
namespace utils {
namespace detail {
template <typename _Tp, bool _Fixed>
struct circular_policy_base {
public:
typedef _Tp value_type;
inline static std::size_t get_capacity(std::size_t capacity) noexcept
{
return capacity + 1;
}
inline static std::size_t get_position(std::size_t position, ssize_t offset, std::size_t capacity) noexcept
{
#if 1
if(offset < 0 && position < static_cast<std::size_t>(-offset)) {
return (capacity + offset + position);
}
position = position + offset;
if(position < capacity) {
return position;
}
return position - capacity;
#else
return (capacity + position + offset) % capacity;
#endif
}
inline static std::size_t get_length(std::size_t start, std::size_t stop, std::size_t capacity)
{
return get_size(start, stop, capacity);
}
// static std::size_t get_capacity(std::size_t capacity) noexcept
// {
// return capacity;
// }
inline static bool empty(std::size_t head, std::size_t tail, std::size_t capacity) noexcept
{
(void)capacity;
return head == tail;
}
inline static bool full(std::size_t head, std::size_t tail, std::size_t capacity) noexcept
{
#if 0
return ((tail + 1) % capacity) == head;
#else
std::size_t t = tail + 1;
if(t >= capacity) {
return t - capacity == head;
}
return t == head;
#endif
}
inline static std::size_t get_size(std::size_t head, std::size_t tail, std::size_t capacity) noexcept
{
#if 1
if(head <= tail) {
return tail - head;
}
return capacity - head + tail;
#else
return (capacity - head + tail) % capacity;
#endif
}
inline static constexpr bool is_fixed()
{
return _Fixed;
};
};
template <typename _Policy, typename _Tp, bool isTrivial>
struct __circular_destroy_helper
{
public:
typedef _Tp value_type;
inline static void destroy (
value_type* data,
std::size_t position,
ssize_t length,
std::size_t capacity) noexcept
{
if(length < 0) {
for (ssize_t idx = length + 1; idx <=0 ; ++idx) {
value_type* d = data + _Policy::get_position(position, idx, capacity);
try {
d->~value_type();
}
catch (const std::exception&) {
}
}
}
else {
for (ssize_t idx = 0; idx < length ; ++idx) {
value_type* d = data + _Policy::get_position(position, idx, capacity);
try {
d->~value_type();
}
catch (const std::exception&) {
}
}
}
}
};
template <typename _Policy, typename _Tp>
struct __circular_destroy_helper<_Policy, _Tp, true>
{
public:
typedef _Tp value_type;
inline static void destroy (
value_type* data,
std::size_t position,
ssize_t length,
std::size_t capacity) noexcept
{
(void)data;
(void)position;
(void)length;
(void)capacity;
//do nothing
}
};
template <typename _Policy>
struct circular_destroy_helper : public __circular_destroy_helper<
_Policy,
typename _Policy::value_type,
std::is_trivial<typename _Policy::value_type>::value>
{
};
template <typename _Tp, bool _Fixed>
struct circular_policy : public circular_policy_base<_Tp, _Fixed> {
public:
typedef typename circular_policy_base<_Tp, _Fixed>::value_type value_type;
inline static void destroy (
value_type* data,
std::size_t offset,
ssize_t length,
std::size_t capacity) noexcept
{
circular_destroy_helper<circular_policy<_Tp, _Fixed>>::destroy(data, offset, length, capacity);
}
};
template <int value>
struct get_exp_ceil;
template <>
struct get_exp_ceil<4> {
typedef uint32_t value_type ;
inline int operator()(value_type value) const
{
const volatile auto fx = static_cast<float>(value);
const volatile auto pix = (reinterpret_cast<const volatile uint32_t *>(&fx));
const volatile auto ix = *pix;
volatile int exp = static_cast<int>((ix >> 23u) & 0xffu) - 127;
if(value & ((1u << exp) - 1)) {
return exp + 1;
}
return exp;
}
};
template <>
struct get_exp_ceil<8> {
typedef uint64_t value_type ;
inline int operator()(uint64_t value) const
{
const volatile auto fx = static_cast<double>(value);
const volatile auto pix = (reinterpret_cast<const volatile uint64_t *>(&fx));
const volatile auto ix = *pix;
volatile int exp = static_cast<int>((ix >> 52u) & 0x7ffu) - 1023;
if(value & ((1u << exp) - 1)) {
return exp + 1;
}
return exp;
}
};
template <typename _Tp, bool _Fixed = true>
struct aligned_circular_policy : public circular_policy<_Tp, _Fixed> {
public:
typedef typename circular_policy<_Tp, _Fixed>::value_type value_type;
inline static std::size_t get_capacity(std::size_t capacity)
{
return 1u << get_exp_ceil<sizeof(std::size_t)>()(capacity);
}
inline static std::size_t get_position(std::size_t position, ssize_t offset, std::size_t capacity) noexcept
{
return (position + offset) & (capacity - 1);
}
inline static bool empty(std::size_t head, std::size_t tail, std::size_t capacity) noexcept
{
(void)capacity;
return head == tail;
}
inline static bool full(std::size_t head, std::size_t tail, std::size_t capacity) noexcept
{
return ((tail + 1) & (capacity - 1)) == head;
}
inline static std::size_t size(std::size_t head, std::size_t tail, std::size_t capacity) noexcept
{
return ((capacity + tail - head) & (capacity - 1));
}
};
template <typename _Tp>
struct basic_circular_iterator {
public:
typedef _Tp value_type;
inline basic_circular_iterator(value_type* data, std::size_t head, std::size_t capacity) noexcept :
_data(data),
_end(data + capacity),
_value(data + head)
{
}
inline bool operator ==(const basic_circular_iterator &other) const noexcept
{
return _data == other._data
&& _end == other._end
&& _value == other._value;
}
inline bool operator !=(const basic_circular_iterator &other) const noexcept
{
return !(this->operator==(other));
}
protected:
inline void move_value(ssize_t offset) noexcept
{
_value = get_value(offset);
}
inline const value_type* get_value(ssize_t offset)
{
if(offset < 0) {
#if 0
if(_value - _data < -offset) {
return _end + offset + (_value - _data) ;
}
return _value + offset;
#endif
return _value + (offset < _data - _value ? offset + _end - _data : offset);
}
return (_value + (offset < (_end - _value) ? offset : offset - (_end - _data)));
}
inline const value_type* value() const
{
return _value;
}
protected:
const value_type *_data;
const value_type *_end;
const value_type *_value;
};
template <typename _Tp>
struct circular_iterator : public basic_circular_iterator<_Tp> {
public:
typedef typename basic_circular_iterator<_Tp>::value_type value_type;
inline circular_iterator(value_type* data, size_t head, size_t capacity) noexcept :
basic_circular_iterator<_Tp>(data, head, capacity)
{
}
inline value_type& operator *() noexcept
{
return *const_cast<value_type* >(this->value());
}
inline value_type* operator ->() noexcept
{
return const_cast<value_type* >(this->value());
}
inline value_type* pointer() noexcept
{
return const_cast<value_type* >(this->value());
}
inline circular_iterator &operator++() noexcept
{
basic_circular_iterator<_Tp>::move_value(1);
return *this;
}
inline const circular_iterator operator++(int) noexcept
{
circular_iterator temp = *this;
basic_circular_iterator<_Tp>::move_value(1);
return temp;
}
inline circular_iterator &operator--() noexcept
{
basic_circular_iterator<_Tp>::move_value(-1);
return *this;
}
inline const circular_iterator operator--(int) noexcept
{
circular_iterator temp = *this;
basic_circular_iterator<_Tp>::move_value(-1);
return temp;
}
};
template <typename _Tp>
struct const_circular_iterator : public basic_circular_iterator<_Tp> {
public:
typedef typename basic_circular_iterator<_Tp>::value_type value_type;
inline const_circular_iterator(value_type* data, size_t head, size_t capacity) noexcept :
basic_circular_iterator<_Tp>(data, head, capacity)
{
}
inline const value_type& operator*() const noexcept
{
return *this->value();
}
inline const value_type* operator->() const noexcept
{
return this->value();
}
inline const_circular_iterator& operator++() noexcept
{
basic_circular_iterator<_Tp>::move_value(1);
return *this;
}
inline const const_circular_iterator operator++(int) noexcept
{
const_circular_iterator temp = *this;
basic_circular_iterator<_Tp>::move_value(1);
return temp;
}
inline const_circular_iterator &operator--() noexcept
{
basic_circular_iterator<_Tp>::move_value(-1);
return *this;
}
inline const const_circular_iterator operator--(int) noexcept
{
const_circular_iterator temp = *this;
basic_circular_iterator<_Tp>::move_value(-1);
return temp;
}
};
template <typename _CircularIterator>
struct reverse_circular_iterator {
public:
typedef _CircularIterator iterator_type;
typedef typename iterator_type::value_type value_type;
inline reverse_circular_iterator(value_type* data, size_t head, size_t capacity) noexcept :
_iterator(data, head, capacity)
{
}
inline reverse_circular_iterator& operator++() noexcept
{
--_iterator;
return *this;
}
inline const reverse_circular_iterator operator++(int) noexcept
{
reverse_circular_iterator temp = *this;
--_iterator;
return temp;
}
inline reverse_circular_iterator& operator--() noexcept
{
++_iterator;
return *this;
}
inline const reverse_circular_iterator operator--(int) noexcept
{
reverse_circular_iterator temp = *this;
++_iterator;
return temp;
}
inline const value_type& operator*() const noexcept
{
iterator_type _temp = _iterator;
--_temp;
return *_temp;
}
inline const value_type* operator->() const noexcept
{
iterator_type _temp = _iterator;
--_temp;
return _temp.operator->();
}
inline bool operator ==(const reverse_circular_iterator &other) const noexcept
{
return _iterator == other._iterator;
}
inline bool operator !=(const reverse_circular_iterator &other) const noexcept
{
return _iterator != other._iterator;
}
protected:
iterator_type _iterator;
};
/**
* 环形结构
* -------------------------------------
* | | H | * | * | * | * | * | T |
* -------------------------------------
*/
template <typename _Tp, typename _Policy, class _Alloc>
class basic_circular {
public:
using value_type = _Tp;
using policy = _Policy;
using alloc_type = typename std::allocator_traits<_Alloc>::template rebind_alloc<value_type>;
using alloc_traits = std::allocator_traits<alloc_type>;
using reference = value_type&;
using const_reference = value_type const&;
using pointer = value_type*;
using const_pointer = value_type const*;
using iterator = circular_iterator<_Tp>;
using const_iterator = const_circular_iterator<_Tp>;
using reverse_iterator = reverse_circular_iterator<iterator>;
using const_reverse_iterator = reverse_circular_iterator<const_iterator>;
explicit basic_circular(std::size_t capacity) noexcept :
_data(nullptr),
_head(0),
_tail(0),
_capacity(capacity)
{
this->reserve(this->_capacity);
}
basic_circular(const basic_circular& other) noexcept :
_data(nullptr),
_head(0),
_tail(0),
_capacity(other._capacity)
{
this->reserve(this->_capacity);
for(auto iter = other.cbegin(); iter != other.cend(); ++iter) {
this->push_back(*iter);
}
}
basic_circular& operator=(const basic_circular& other) noexcept
{
if(&other == this) {
return *this;
}
this->clear();
this->reserve(other._capacity);
for(auto iter = other.cbegin(); iter != other.cend(); ++iter) {
this->push_back(*iter);
}
return *this;
}
basic_circular(basic_circular&& other) noexcept :
_data(other._data),
_head(other._head),
_tail(other._tail),
_capacity(other._capacity),
_allocator(std::move(other._allocator))
{
other._data = nullptr;
other._head = 0;
other._tail = 0;
other._capacity = 0;
}
basic_circular& operator=(basic_circular&& other) noexcept
{
if(this->_data != nullptr) {
this->clear();
}
_allocator.deallocate(_data, _capacity);
_data = nullptr;
this->swap(other);
return *this;
}
~basic_circular() noexcept
{
clear();
if (_data != nullptr) {
_allocator.deallocate(_data, _capacity);
}
_data = nullptr;
}
inline void clear()
{
if(_data != nullptr)
{
policy::destroy(_data, _head, this->size(), _capacity);
}
_head = 0;
_tail = 0;
}
inline void push_front(const value_type& data)
{
if (!this->push_prepare(1)) {
throw std::out_of_range("circular::push_front()");
}
unchecked_push_front(data);
}
inline void unchecked_push_front(const value_type& data) noexcept
{
_head = policy::get_position(_head, -1, _capacity);
new (_data + _head) value_type(data);
}
inline void push_front(value_type&& data)
{
if (!this->push_prepare(1)) {
throw std::out_of_range("circular::push_front()");
}
unchecked_push_front(std::move(data));
}
inline void unchecked_push_front(value_type&& data) noexcept
{
_head = policy::get_position(_head, -1, _capacity);
new (_data + _head) value_type(std::move(data));
}
inline void push_front(const value_type* data, std::size_t length)
{
if (!this->push_prepare(length)) {
throw std::out_of_range("circular::push_front()");
}
unchecked_push_front(data, length);
}
inline void unchecked_push_front(const value_type* data, std::size_t length) noexcept
{
if (_head < length) {
size_t len = length - _head;
detail::memcpy(_data, data + len, _head);
detail::memcpy(_data + _capacity - len, data, len);
_head = policy::get_position(_head, -static_cast<ssize_t>(length), _capacity);
}
else {
_head = policy::get_position(_head, -static_cast<ssize_t>(length), _capacity);
detail::memcpy(_data + _head, data, length);
}
}
inline void push_back(const value_type& data)
{
if (!this->push_prepare(1)) {
throw std::out_of_range("circular::push_back()");
}
unchecked_push_back(data);
}
inline void unchecked_push_back(const value_type& data) noexcept
{
new (_data + _tail) value_type(data);
_tail = policy::get_position(_tail, 1, _capacity);
}
inline void push_back(value_type&& data)
{
if (!this->push_prepare(1)) {
throw std::out_of_range("circular::push_back()");
}
unchecked_push_back(std::move(data));
}
inline void unchecked_push_back(value_type&& data) noexcept
{
new (_data + _tail) value_type(std::move(data));
_tail = policy::get_position(_tail, 1, _capacity);
}
inline void push_back(const value_type* data, std::size_t length)
{
if (!this->push_prepare(length)) {
throw std::out_of_range("circular::push_back()");
}
unchecked_push_back(data, length);
}
inline void unchecked_push_back(const value_type* data, std::size_t length) noexcept
{
if (_tail + length > _capacity) {
std::size_t len1 = _capacity - _tail;
detail::memcpy(_data + _tail, data, len1);
detail::memcpy(_data, data + len1, length - len1);
}
else {
detail::memcpy(_data + _tail, data, length);
}
_tail = policy::get_position(_tail, length, _capacity);
}
inline void pop_front(std::size_t length)
{
if(this->size() < length) {
throw std::out_of_range("circular::pop_front()");
}
unchecked_pop_front(length);
}
inline void unchecked_pop_front(std::size_t length) noexcept
{
policy::destroy(_data, _head, length, _capacity);
_head = policy::get_position(_head, length, _capacity);
}
inline void pop_front()
{
if(this->size() < 1) {
throw std::out_of_range("circular::pop_front()");
}
unchecked_pop_front();
}
inline void unchecked_pop_front() noexcept
{
policy::destroy(_data, _head, 1, _capacity);
_head = policy::get_position(_head, 1, _capacity);
}
inline void pop_back(std::size_t length)
{
if(this->size() < length) {
throw std::out_of_range("circular::pop_back()");
}
unchecked_pop_back(length);
}
inline void unchecked_pop_back(std::size_t length) noexcept
{
policy::destroy(_data, _tail, -static_cast<ssize_t>(length), _capacity);
_tail = policy::get_position(_tail, -static_cast<ssize_t>(length), _capacity);
}
inline void pop_back()
{
if(this->size() < 1) {
throw std::out_of_range("circular::pop_back()");
}
unchecked_pop_back();
}
inline void unchecked_pop_back() noexcept
{
policy::destroy(_data, _tail, -1, _capacity);
_tail = policy::get_position(_tail, -1, _capacity);
}
inline void peek_front(value_type* data, std::size_t length) const
{
if(this->size() < length) {
throw std::out_of_range("circular::peek_front()");
}
unchecked_peek_front(data, length);
}
inline void unchecked_peek_front(value_type* data, std::size_t length) const noexcept
{
std::size_t head = policy::get_position(_head, 0, _capacity);
if (head + length > _capacity) {
std::size_t len1 = _capacity - head;
detail::memcpy(data, _data + head, len1);
detail::memcpy(data + len1, _data, length - len1);
}
else {
detail::memcpy(data, _data + head, length);
}
}
inline void peek_back(value_type* data, std::size_t length) const
{
if(this->size() < length) {
throw std::out_of_range("circular::peek_front()");
}
unchecked_peek_back(data, length);
}
inline void unchecked_peek_back(value_type* data, std::size_t length) const noexcept
{
std::size_t tail = policy::get_position(_tail, 0, _capacity);
if (tail < length) {
std::size_t len1 = length - tail;
detail::memcpy(data, _data + _capacity - len1, len1);
detail::memcpy(data + len1, _data, length - len1);
}
else {
detail::memcpy(data, _data + tail - length, length);
}
}
std::size_t tellg(std::size_t head) const noexcept
{
return policy::get_length(head, _head, _capacity);
}
std::size_t tellp(std::size_t tail) const noexcept
{
return policy::get_length(tail, _tail, _capacity);
}
void seekg(std::size_t head, std::size_t offset) noexcept
{
_head = policy::get_position(head, offset, _capacity);
}
void seekp(std::size_t tail, std::size_t offset) noexcept
{
//offset = std::min(offset, this->capacity() - policy::get_size(_head, tail, _capacity));
_tail = policy::get_position(tail, offset, _capacity);
}
inline std::size_t head() const noexcept
{
return _head;
}
inline std::size_t tail() const noexcept
{
return _tail;
}
inline std::size_t get_position(std::size_t position, ssize_t offset) const noexcept
{
return policy::get_position(position, offset, _capacity);
}
inline reference front_at(std::size_t offset)
{
if(offset > this->size()) {
throw std::out_of_range("circular::front_at");
}
return unchecked_front_at(offset);
}
inline const_reference front_at(std::size_t offset) const
{
if(offset > this->size()) {
throw std::out_of_range("circular::front_at");
}
return unchecked_front_at(offset);
}
inline reference back_at(std::size_t offset)
{
if(offset > this->size()) {
throw std::out_of_range("circular::back_at");
}
return unchecked_back_at(offset);
}
inline const_reference back_at(std::size_t offset) const
{
if(offset > this->size()) {
throw std::out_of_range("circular::back_at");
}
return unchecked_back_at(offset);
}
inline reference unchecked_front_at(std::size_t offset) noexcept
{
return this->_data[policy::get_position(_head, offset, _capacity)];
}
inline const_reference unchecked_front_at(std::size_t offset) const noexcept
{
return this->_data[policy::get_position(_head, offset, _capacity)];
}
inline reference unchecked_back_at(std::size_t offset) noexcept
{
return this->_data[policy::get_position(_tail, -1 - offset, _capacity)];
}
inline const_reference unchecked_back_at(std::size_t offset) const noexcept
{
return this->_data[policy::get_position(_tail, -1 - offset, _capacity)];
}
inline std::size_t size() const noexcept
{
return policy::get_size(_head, _tail, _capacity);
}
inline std::size_t capacity() const noexcept
{
return _capacity - 1;
}
inline bool full() const noexcept
{
return policy::full(_head, _tail, _capacity);
}
inline bool empty() const noexcept
{
return policy::empty(_head, _tail, _capacity);
}
bool reserve(std::size_t capacity) noexcept
{
value_type* data = nullptr;
capacity = policy::get_capacity(static_cast<uint32_t>(capacity));
try {
data = _allocator.allocate(capacity);
if(data == nullptr) {
return false;
}
this->peek_front(data, this->size());
}
catch (const std::exception&) {
return false;
}
if(!empty()) {
//for (iterator iter = begin(); iter != end(); ++iter) {
// alloc_traits::destroy(_allocator, iter.pointer());
//}
policy::destroy(_data, _tail, -static_cast<ssize_t>(this->size()), _capacity);
_allocator.deallocate(_data, _capacity);
}
_tail = this->size();
_head = 0;
_capacity = capacity;
_data = data;
return true;
}
inline iterator begin() noexcept
{
return iterator(_data, _head, _capacity);
}
inline iterator end() noexcept
{
return iterator(_data, _tail, _capacity);
}
inline const_iterator cbegin() const noexcept
{
return const_iterator(_data, _head, _capacity);
}
inline const_iterator cend() const noexcept
{
return const_iterator(_data, _tail, _capacity);
}
inline reverse_iterator rbegin() noexcept
{
return reverse_iterator(_data, _tail, _capacity );
}
inline const_reverse_iterator crbegin() const noexcept
{
return const_reverse_iterator(_data, _tail, _capacity);
}
inline reverse_iterator rend() noexcept
{
return reverse_iterator(_data, _head, _capacity);
}
inline const_reverse_iterator crend() const noexcept
{
return const_reverse_iterator(_data, _head, _capacity);
}
inline constexpr bool is_fixed()
{
return policy::is_fixed();
}
inline bool push_prepare(std::size_t length)
{
if(capacity() - size() < length) {
if(is_fixed()) {
return false;
}
if (length > (_capacity << 1)) {
return this->reserve(length << 1);
}
return this->reserve(_capacity << 1);
}
return true;
}
void swap(basic_circular& other) noexcept
{
std::swap(this->_data, other._data);
std::swap(this->_head, other._head);
std::swap(this->_tail, other._tail);
std::swap(this->_capacity, other._capacity);
std::swap(this->_allocator, other._allocator);
}
protected:
value_type* _data;
std::size_t _head;
std::size_t _tail;
std::size_t _capacity;
alloc_type _allocator;
};
}
}
}
#endif //__STAR_SDK_UTILS_BASIC_CIRCULAR_H
| 27.123077 | 111 | 0.593912 |
e80e4dd3a647a07ec71a5ed77f34fac51c812c82 | 1,432 | c | C | usr/spawnd/ps.c | renlord/ethz-aos2015 | 0c3face3ba42784e8feacebfec0fbefc083800b1 | [
"MIT"
] | 1 | 2021-02-25T13:59:00.000Z | 2021-02-25T13:59:00.000Z | usr/spawnd/ps.c | renlord/ethz-aos2015 | 0c3face3ba42784e8feacebfec0fbefc083800b1 | [
"MIT"
] | null | null | null | usr/spawnd/ps.c | renlord/ethz-aos2015 | 0c3face3ba42784e8feacebfec0fbefc083800b1 | [
"MIT"
] | null | null | null | #include "ps.h"
errval_t ps_register(struct ps_entry *entry, domainid_t *domainid,
domainid_t parentid)
{
assert(parentid < MAX_DOMAINS);
struct ps_entry **child_slot;
bool child_slot_avail = false;
for (int i = 0; i < MAX_CHILD_PROCESS; i++) {
if (registry[parentid]->child[i] == NULL) {
child_slot = ®istry[parentid]->child[i];
child_slot_avail = true;
break;
}
}
if (!child_slot_avail) {
return SPAWN_ERR_DOMAIN_ALLOCATE;
}
for (domainid_t i = 1; i < MAX_DOMAINS; i++) {
if (registry[i] == NULL) {
registry[i] = entry;
*child_slot = registry[i];
*domainid = i;
return SYS_ERR_OK;
}
}
return SPAWN_ERR_DOMAIN_ALLOCATE;
}
void ps_remove(domainid_t domain_id)
{
assert(domain_id < MAX_DOMAINS);
for (uint8_t i = 0; i < MAX_CHILD_PROCESS; i++) {
assert(registry[domain_id]->child[i] != NULL);
ps_remove(registry[domain_id]->child[i]->pid);
registry[domain_id]->child[i] = NULL;
}
registry[domain_id] = NULL;
};
bool ps_exists(domainid_t domain_id)
{
assert(domain_id < MAX_DOMAINS);
return (registry[domain_id] == NULL) ? false : true;
}
struct ps_entry *ps_get(domainid_t domain_id)
{
if (domain_id > MAX_DOMAINS) {
return NULL;
}
return registry[domain_id];
}
| 23.866667 | 67 | 0.589385 |
e811ce7f7895fc876a630ef3232af3db437e1c3a | 875 | h | C | VulkanSetup/CharacterSet.h | NEtuee/AnimationEngine | feb7d974edf9cb19725578cae1bcda35a0edc683 | [
"MIT"
] | null | null | null | VulkanSetup/CharacterSet.h | NEtuee/AnimationEngine | feb7d974edf9cb19725578cae1bcda35a0edc683 | [
"MIT"
] | null | null | null | VulkanSetup/CharacterSet.h | NEtuee/AnimationEngine | feb7d974edf9cb19725578cae1bcda35a0edc683 | [
"MIT"
] | null | null | null | #pragma once
#include <string>
#include <unordered_map>
class BoneStructure;
class BlendTree;
class AnimationDataPack;
class CharacterSetLoader;
class IKChain;
class CharacterSet
{
public:
CharacterSet();
void createCharacterSet(std::string name);
void destroyCharacterSet();
void frame(float deltaTime);
void setName(std::string name);
BoneStructure* getBoneStructure();
const BlendTree* getBlendTree();
const std::string& getName();
const std::vector<IKChain*>& getIKChains();
const std::unordered_map<std::string, AnimationDataPack*>& getAnimations();
private:
//std::unordered_map<size_t, AnimationDataPack*> _animations;
std::unordered_map<std::string, AnimationDataPack*> _animations;
std::vector<IKChain*> _ikChains;
std::string _name;
BoneStructure* _bone;
BlendTree* _tree;
friend CharacterSetLoader;
};
| 21.341463 | 76 | 0.737143 |
9fc952d04ad928821fb47460415bcebcca8f4e39 | 465 | h | C | src/token.h | pinebit/vault | eafb42e08c7bb2f25cbf5aa9f3d9a17317f72c04 | [
"MIT"
] | 3 | 2018-04-04T06:09:22.000Z | 2019-02-28T05:31:49.000Z | src/token.h | pinebit/vault | eafb42e08c7bb2f25cbf5aa9f3d9a17317f72c04 | [
"MIT"
] | null | null | null | src/token.h | pinebit/vault | eafb42e08c7bb2f25cbf5aa9f3d9a17317f72c04 | [
"MIT"
] | 3 | 2018-11-14T21:14:43.000Z | 2019-10-28T21:15:36.000Z | #ifndef VAULT_TOKEN_H
#define VAULT_TOKEN_H
#include <vault.pb.h>
#include "types.h"
namespace vault {
blob_t encode_token(const Authentication &authentication,
const blob_t &aes_key,
const blob_t &aes_iv);
void decode_token(const blob_t &data,
Authentication &authentication,
blob_t &aes_key,
blob_t &aes_iv);
}
#endif // VAULT_TOKEN_H
| 22.142857 | 61 | 0.576344 |
b212ff062c728f8ac80af1ea2f6fd197db1d87c5 | 1,028 | h | C | PrivateFrameworks/TelephonyUI.framework/TPBottomBar.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 36 | 2016-04-20T04:19:04.000Z | 2018-10-08T04:12:25.000Z | PrivateFrameworks/TelephonyUI.framework/TPBottomBar.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | null | null | null | PrivateFrameworks/TelephonyUI.framework/TPBottomBar.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 10 | 2016-06-16T02:40:44.000Z | 2019-01-15T03:31:45.000Z | /* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/TelephonyUI.framework/TelephonyUI
*/
@interface TPBottomBar : UIView {
long long _orientation;
long long _style;
}
+ (double)defaultHeight;
+ (double)defaultHeightForOrientation:(long long)arg1;
+ (double)defaultHeightForStyle:(long long)arg1;
+ (double)defaultHeightForStyle:(long long)arg1 orientation:(long long)arg2;
+ (long long)fullscreenStyle;
+ (long long)overlayStyle;
- (id)init;
- (id)initWithDefaultSize;
- (id)initWithDefaultSizeForOrientation:(long long)arg1;
- (id)initWithFrame:(struct CGRect { struct CGPoint { double x_1_1_1; double x_1_1_2; } x1; struct CGSize { double x_2_1_1; double x_2_1_2; } x2; })arg1;
- (id)initWithFrame:(struct CGRect { struct CGPoint { double x_1_1_1; double x_1_1_2; } x1; struct CGSize { double x_2_1_1; double x_2_1_2; } x2; })arg1 style:(long long)arg2;
- (long long)orientation;
- (void)setOrientation:(long long)arg1;
- (void)setOrientation:(long long)arg1 updateFrame:(bool)arg2;
@end
| 38.074074 | 175 | 0.753891 |
2513b6cb2ba3eff7222ae25e07fcb64a80236bf2 | 5,295 | h | C | source/cosa/package/slap/include/slap_co_oid.h | lgirdk/ccsp-common-library | 8d912984e96f960df6dadb4b0e6bc76c76376776 | [
"Apache-2.0"
] | 4 | 2018-02-26T05:41:14.000Z | 2019-12-20T07:31:39.000Z | source/cosa/package/slap/include/slap_co_oid.h | rdkcmf/rdkb-CcspCommonLibrary | 3eba76685bbf5eb6656f45eb4b57fdb5c269c2a1 | [
"Apache-2.0"
] | null | null | null | source/cosa/package/slap/include/slap_co_oid.h | rdkcmf/rdkb-CcspCommonLibrary | 3eba76685bbf5eb6656f45eb4b57fdb5c269c2a1 | [
"Apache-2.0"
] | 3 | 2017-07-30T15:35:16.000Z | 2020-08-18T20:44:08.000Z | /*
* If not stated otherwise in this file or this component's Licenses.txt file the
* following copyright and licenses apply:
*
* Copyright 2015 RDK Management
*
* 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.
*/
/**********************************************************************
Copyright [2014] [Cisco Systems, Inc.]
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.
**********************************************************************/
/**********************************************************************
module: slap_co_oid.h
For Service Logic Aggregation Plane Implementation (SLAP),
BroadWay Service Delivery System
---------------------------------------------------------------
description:
This wrapper file defines the object ids for the Slap
Component Objects.
---------------------------------------------------------------
environment:
platform independent
---------------------------------------------------------------
author:
Xuechen Yang
---------------------------------------------------------------
revision:
07/04/03 initial revision.
**********************************************************************/
#ifndef _SLAP_CO_OID_
#define _SLAP_CO_OID_
/***********************************************************
GENERAL SLAP FEATURE OBJECTS DEFINITION
***********************************************************/
/*
* Define the object names for all the Feature Objects that cannot be categorized. Feature Objects
* are the objects that encapsulate certain features and provide services.
*/
#define SLAP_FEATURE_OBJECT_OID_BASE SLAP_COMPONENT_OID_BASE + 0x1000
#define SLAP_GENERAL_FO_OID_BASE SLAP_FEATURE_OBJECT_OID_BASE + 0x0000
#define SLAP_ENV_CONTROLLER_OID SLAP_GENERAL_FO_OID_BASE + 0x0001
#define SLAP_OBJ_MAPPER_OID SLAP_GENERAL_FO_OID_BASE + 0x0002
#define SLAP_OBJ_BROKER_OID SLAP_GENERAL_FO_OID_BASE + 0x0003
#define SLAP_OBJ_ENTITY_OID SLAP_GENERAL_FO_OID_BASE + 0x0004
#define SLAP_OBJ_RECORD_OID SLAP_GENERAL_FO_OID_BASE + 0x0005
#define SLAP_OBJ_CONTAINER_OID SLAP_GENERAL_FO_OID_BASE + 0x0006
#define SLAP_OBJ_WRAPPER_OID SLAP_GENERAL_FO_OID_BASE + 0x0007
#define SLAP_OBJ_AGENT_OID SLAP_GENERAL_FO_OID_BASE + 0x0008
#define SLAP_OBJ_PROXY_OID SLAP_GENERAL_FO_OID_BASE + 0x0009
#define SLAP_SRV_COMPONENT_OID SLAP_GENERAL_FO_OID_BASE + 0x000A
#define SLAP_SRV_PROXY_OID SLAP_GENERAL_FO_OID_BASE + 0x000B
#define SLAP_LOAM_CLIENT_OID SLAP_GENERAL_FO_OID_BASE + 0x000C
#define SLAP_LOAM_SERVER_OID SLAP_GENERAL_FO_OID_BASE + 0x000D
#define SLAP_LOAM_BROKER_OID SLAP_GENERAL_FO_OID_BASE + 0x000E
#define SLAP_ACCESS_MANAGER_OID SLAP_GENERAL_FO_OID_BASE + 0x000F
#define SLAP_SCO_STANDARD_OID SLAP_GENERAL_FO_OID_BASE + 0x0011
#define SLAP_SCO_BUFFER_OID SLAP_GENERAL_FO_OID_BASE + 0x0012
#define SLAP_SCO_COLLECTION_OID SLAP_GENERAL_FO_OID_BASE + 0x0013
#define SLAP_SCO_GALLERY_OID SLAP_GENERAL_FO_OID_BASE + 0x0014
#define SLAP_VAR_ENTITY_OID SLAP_GENERAL_FO_OID_BASE + 0x0021
#define SLAP_VAR_CONVERTER_OID SLAP_GENERAL_FO_OID_BASE + 0x0022
#define SLAP_VAR_MAPPER_OID SLAP_GENERAL_FO_OID_BASE + 0x0023
#define SLAP_VAR_HELPER_OID SLAP_GENERAL_FO_OID_BASE + 0x0024
#define SLAP_OWO_UOAO_OID SLAP_GENERAL_FO_OID_BASE + 0x0031
#define SLAP_OWO_LOAO_OID SLAP_GENERAL_FO_OID_BASE + 0x0032
#define SLAP_OWO_UOAC_OID SLAP_GENERAL_FO_OID_BASE + 0x0033
#define SLAP_OWO_LOAC_OID SLAP_GENERAL_FO_OID_BASE + 0x0034
#endif
| 44.125 | 98 | 0.580737 |
d7add50d9c3a89d15934295bbb8125bcd27804c7 | 319 | h | C | instruction/instruction.h | muyulong/pi_gateway | bd47e2a937389d47d8e3298a73dbe48556670d3d | [
"WTFPL"
] | 2 | 2022-03-27T08:38:16.000Z | 2022-03-27T08:46:46.000Z | instruction/instruction.h | muyulong/Pi_gateway | 48f4bc7d42852f3b21ee8ad3b3066499bfb8e43b | [
"WTFPL"
] | null | null | null | instruction/instruction.h | muyulong/Pi_gateway | 48f4bc7d42852f3b21ee8ad3b3066499bfb8e43b | [
"WTFPL"
] | null | null | null | #ifndef INSTRUCTION_H
#define INSTRUCTION_H
#include <QWidget>
namespace Ui {
class instruction;
}
class instruction : public QWidget
{
Q_OBJECT
public:
explicit instruction(QWidget *parent = nullptr);
~instruction();
private:
Ui::instruction *ui;
};
#endif // INSTRUCTION_H
| 13.869565 | 53 | 0.664577 |
baae37e2d5b2796bf2b3e7586ccc32caed395f47 | 2,216 | c | C | src/horse.c | ederlf/paper-sigsim-pads-18 | 27c9959c0782cc5edc56a3051709a05c89e6b139 | [
"BSD-3-Clause"
] | 7 | 2018-07-06T09:29:04.000Z | 2022-03-01T16:53:43.000Z | src/horse.c | ederlf/paper-sigsim-pads-18 | 27c9959c0782cc5edc56a3051709a05c89e6b139 | [
"BSD-3-Clause"
] | null | null | null | src/horse.c | ederlf/paper-sigsim-pads-18 | 27c9959c0782cc5edc56a3051709a05c89e6b139 | [
"BSD-3-Clause"
] | 1 | 2018-07-12T20:08:17.000Z | 2018-07-12T20:08:17.000Z | /* Copyright (c) 2016-2017, Eder Leao Fernandes
* All rights reserved.
*
* The contents of this file are subject to the license defined in
* file 'doc/LICENSE', which is part of this source code package.
*
*
* Author: Eder Leao Fernandes <e.leao@qmul.ac.uk>
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "net/datapath.h"
#include "net/topology.h"
#include "net/flow_table.h"
#include "sim/sim.h"
static void
display_help_message(void)
{
printf("horse: SDN simulator\n");
printf("Usage: horse [OPTIONS]\n");
printf("\n");
printf(" -h display help message.\n");
printf("\n");
}
static void
display_horse(void)
{
printf(" >>\\.\n");
printf(" /_ )`.\n");
printf(" / _)`^)`. _.---. _hjw\n");
printf(" (_,' \\ `^-)"" `.\\\n");
printf(" | | \\\n");
printf(" \\ / |\n");
printf(" / \\ /.___.'\\ (\\ (_\n");
printf(" < ,\"|| \\ |`. \\`-'\n");
printf(" \\\\ () )| )/\n");
printf(" |_>|> /_] //\n");
printf(" /_] /_]\n");
}
int
main(int argc, char *argv[]){
int c;
while ((c = getopt (argc, argv, "ht")) != -1){
switch (c){
case 'h':{
display_horse();
display_help_message();
break;
}
case 't':{
struct topology *topo = from_json(argv[optind]);
struct sim_config *conf = sim_config_new();
// struct topology *topo = topology_new();
start(topo, conf);
break;
}
case '?':{
if (isprint (optopt)){
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
}
else{
fprintf (stderr,
"Unknown option character `\\x%x'.\n",
optopt);
}
return 1;
}
default:{
display_help_message();
exit(EXIT_FAILURE);
}
}
}
return EXIT_SUCCESS;
}
| 27.02439 | 70 | 0.428249 |
445318a8b400cb6718e49962d971dbf4ba89b25f | 3,020 | h | C | include/raa.h | revery-ui/esy-nasm | 64a802b70c403634d8f9698bb85563932f7c0cfa | [
"BSD-2-Clause"
] | null | null | null | include/raa.h | revery-ui/esy-nasm | 64a802b70c403634d8f9698bb85563932f7c0cfa | [
"BSD-2-Clause"
] | null | null | null | include/raa.h | revery-ui/esy-nasm | 64a802b70c403634d8f9698bb85563932f7c0cfa | [
"BSD-2-Clause"
] | 1 | 2022-03-21T07:51:52.000Z | 2022-03-21T07:51:52.000Z | /* ----------------------------------------------------------------------- *
*
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* 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.
*
* ----------------------------------------------------------------------- */
#ifndef NASM_RAA_H
#define NASM_RAA_H 1
#include "compiler.h"
struct real_raa;
struct RAA;
union intorptr {
int64_t i;
void *p;
};
struct real_raa * never_null real_raa_init(void);
static inline struct RAA *never_null raa_init(void)
{
return (struct RAA *)real_raa_init();
}
static inline struct RAAPTR *never_null raa_init_ptr(void)
{
return (struct RAAPTR *)real_raa_init();
}
void real_raa_free(struct real_raa *);
static inline void raa_free(struct RAA *raa)
{
real_raa_free((struct real_raa *)raa);
}
static inline void raa_free_ptr(struct RAAPTR *raa)
{
real_raa_free((struct real_raa *)raa);
}
int64_t raa_read(struct RAA *, int32_t);
void *raa_read_ptr(struct RAAPTR *, int32_t);
struct real_raa * never_null
real_raa_write(struct real_raa *r, int32_t posn, union intorptr value);
static inline struct RAA * never_null
raa_write(struct RAA *r, int32_t posn, int64_t value)
{
union intorptr ip;
ip.i = value;
return (struct RAA *)real_raa_write((struct real_raa *)r, posn, ip);
}
static inline struct RAAPTR * never_null
raa_write_ptr(struct RAAPTR *r, int32_t posn, void *value)
{
union intorptr ip;
ip.p = value;
return (struct RAAPTR *)real_raa_write((struct real_raa *)r, posn, ip);
}
#endif /* NASM_RAA_H */
| 34.318182 | 77 | 0.68245 |
80e6133271d08495f8f7969a721034353fd1f7c4 | 4,214 | h | C | 02_Library/Include/XMM3G/M3GMaterial.h | mcodegeeks/OpenKODE-Framework | d4382d781da7f488a0e7667362a89e8e389468dd | [
"MIT"
] | 2 | 2017-08-03T07:15:00.000Z | 2018-06-18T10:32:53.000Z | 02_Library/Include/XMM3G/M3GMaterial.h | mcodegeeks/OpenKODE-Framework | d4382d781da7f488a0e7667362a89e8e389468dd | [
"MIT"
] | null | null | null | 02_Library/Include/XMM3G/M3GMaterial.h | mcodegeeks/OpenKODE-Framework | d4382d781da7f488a0e7667362a89e8e389468dd | [
"MIT"
] | 2 | 2019-03-04T22:57:42.000Z | 2020-03-06T01:32:26.000Z | /* --------------------------------------------------------------------------
*
* File M3GMaterial.h
* Author Young-Hwan Mun
*
* --------------------------------------------------------------------------
*
* Copyright (c) 2010 UEDA.Takashi
* Copyright (c) 2010-2013 XMSoft. All rights reserved.
*
* Contact Email: xmsoft77@gmail.com
*
* --------------------------------------------------------------------------
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* -------------------------------------------------------------------------- */
#ifndef __M3GMaterial_h__
#define __M3GMaterial_h__
#include "M3GObject3D.h"
/**
* @~English An Appearance component encapsulating material attributes for lighting computations.
*/
class M3GMaterial : public M3GObject3D
{
public :
/**
* @~English A parameter to setColor and getColor, specifying that the ambient color component.
*/
static const KDint AMBIENT = 1<<10;
/**
* @~English A parameter to setColor and getColor, specifying that the diffuse color component.
*/
static const KDint DIFFUSE = 1<<11;
/**
* @~English A parameter to setColor and getColor, specifying that the emissive color component.
*/
static const KDint EMISSIVE = 1<<12;
/**
* @~English A parameter to setColor and getColor, specifying that the specular color component.
*/
static const KDint SPECULAR = 1<<13;
public :
/**
* @~English Creates a Material object with default values.
*/
M3GMaterial ( KDvoid );
/**
* @~English Destruct this object.
*/
virtual ~M3GMaterial ( KDvoid );
public :
virtual KDvoid addAnimationTrack ( M3GAnimationTrack* animationTrack );
virtual KDint animate ( KDint time );
virtual M3GObject3D* duplicate ( KDvoid ) const;
/**
* @~English Gets the value of the specified color component of this Material.
* @param[in] target
* @return
*/
KDint getColor ( KDint target ) const;
/**
* @~English Gets the current shininess of this Material.
* @return
*/
KDfloat getShininess ( KDvoid ) const;
/**
* @~English Queries whether vertex color tracking is enabled.
* @return
*/
KDbool isVertexColorTrackingEnabled ( KDvoid ) const;
/**
* @~English Sets the given value to the specified color component(s) of this Material.
* @param[in] target
* @param[in] ARGB
*/
KDvoid setColor ( KDint target, KDint ARGB );
/**
* @~English Sets the shininess of this Material.
* @param[in] shininess
*/
KDvoid setShininess ( KDfloat shininess );
/**
* @~English Enables or disables vertex color tracking.
* @param[in] enable
*/
KDvoid setVertexColorTrackingEnable ( KDbool enable );
public :
static KDvoid render ( KDvoid );
virtual KDvoid render ( M3GRenderState& state ) const;
protected :
KDvoid _duplicate ( M3GMaterial* pObj ) const;
private :
KDbool m_bVertexColorTracking;
KDint m_nAmbientColor;
KDint m_nDiffuseColor;
KDint m_nEmissiveColor;
KDint m_nSpecularColor;
KDfloat m_fShininess;
};
#endif
| 29.263889 | 104 | 0.572852 |
c5195820be66a358079a443ec6a3ffc9a59ef18a | 6,108 | h | C | src/libpidee.h | Pidee/ofxPidee | 1dc50befc1077e04c0d0c8c6250a88ee102ad9c9 | [
"MIT"
] | null | null | null | src/libpidee.h | Pidee/ofxPidee | 1dc50befc1077e04c0d0c8c6250a88ee102ad9c9 | [
"MIT"
] | null | null | null | src/libpidee.h | Pidee/ofxPidee | 1dc50befc1077e04c0d0c8c6250a88ee102ad9c9 | [
"MIT"
] | null | null | null | /**
* Copyright (c) 2016 Ross Cairns <ross@electricglen.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _LIB_PIDEE_H
#define _LIB_PIDEE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <wiringPi.h>
/* Feature Type */
typedef enum {
PIDEE_FEATURE_DIP,
PIDEE_FEATURE_BUTTON,
PIDEE_FEATURE_LED
} pidee_feature_t;
/* Features */
typedef struct pidee_feature {
const char *name;
pidee_feature_t feature_type;
int bcm_pin;
void(*interupt_handler)(pidee_feature);
} pidee_feature;
// Pin mapping source: http://pinout.xyz/pinout/
pidee_feature pidee_feature_button = { "button", PIDEE_FEATURE_BUTTON, 18 /* physical pin: 12 */ };
pidee_feature pidee_feature_dip_1 = { "dip.1", PIDEE_FEATURE_DIP, 6 /* physical pin: 31 */ };
pidee_feature pidee_feature_dip_2 = { "dip.2", PIDEE_FEATURE_DIP, 5 /* physical pin: 29 */ };
pidee_feature pidee_feature_dip_3 = { "dip.3", PIDEE_FEATURE_DIP, 25 /* physical pin: 22 */ };
pidee_feature pidee_feature_dip_4 = { "dip.4", PIDEE_FEATURE_DIP, 24 /* physical pin: 18 */ };
pidee_feature pidee_feature_dip_5 = { "dip.5", PIDEE_FEATURE_DIP, 23 /* physical pin: 16 */ };
pidee_feature pidee_feature_dip_6 = { "dip.6", PIDEE_FEATURE_DIP, 22 /* physical pin: 15 */ };
pidee_feature pidee_feature_dip_7 = { "dip.7", PIDEE_FEATURE_DIP, 27 /* 21 on pi rev 1. physical pin: 13 */ };
pidee_feature pidee_feature_dip_8 = { "dip.8", PIDEE_FEATURE_DIP, 17 /* physical pin: 11 */ };
pidee_feature pidee_feature_led_red = { "led.red", PIDEE_FEATURE_LED, 13 /* physical pin: 33 */ };
pidee_feature pidee_feature_led_green = { "led.green", PIDEE_FEATURE_LED, 12 /* physical pin: 32 */ };
pidee_feature pidee_feature_led_yellow = { "led.yellow", PIDEE_FEATURE_LED, 19 /* physical pin: 35 */ };
/* Interupts */
void pidee_button_interupt() { if ( pidee_feature_button.interupt_handler != NULL ) { pidee_feature_button.interupt_handler( pidee_feature_button ); } };
void pidee_dip_1_interupt() { if ( pidee_feature_dip_1.interupt_handler != NULL ) { pidee_feature_dip_1.interupt_handler( pidee_feature_dip_1 ); } };
void pidee_dip_2_interupt() { if ( pidee_feature_dip_2.interupt_handler != NULL ) { pidee_feature_dip_2.interupt_handler( pidee_feature_dip_2 ); }};
void pidee_dip_3_interupt() { if ( pidee_feature_dip_3.interupt_handler != NULL ) { pidee_feature_dip_3.interupt_handler( pidee_feature_dip_3 ); }};
void pidee_dip_4_interupt() { if ( pidee_feature_dip_4.interupt_handler != NULL ) { pidee_feature_dip_4.interupt_handler( pidee_feature_dip_4 ); }};
void pidee_dip_5_interupt() { if ( pidee_feature_dip_5.interupt_handler != NULL ) { pidee_feature_dip_5.interupt_handler( pidee_feature_dip_5 ); }};
void pidee_dip_6_interupt() { if ( pidee_feature_dip_6.interupt_handler != NULL ) { pidee_feature_dip_6.interupt_handler( pidee_feature_dip_6 ); }};
void pidee_dip_7_interupt() { if ( pidee_feature_dip_7.interupt_handler != NULL ) { pidee_feature_dip_7.interupt_handler( pidee_feature_dip_7 ); }};
void pidee_dip_8_interupt() { if ( pidee_feature_dip_8.interupt_handler != NULL ) { pidee_feature_dip_8.interupt_handler( pidee_feature_dip_8 ); }};
/* Setup/Read/Write */
void pidee_system_command( const char *head, int pin, const char *tail ) {
char str[100];
sprintf( str, "%s %d %s", head, pin, tail );
system( str );
}
void pidee_feature_setup( pidee_feature *feature ) {
if ( feature->feature_type == PIDEE_FEATURE_BUTTON || feature->feature_type == PIDEE_FEATURE_DIP ) {
pidee_system_command( "gpio export ", feature->bcm_pin, " in" );
pidee_system_command( "gpio -g mode ", feature->bcm_pin, " up" );
} else {
pidee_system_command( "gpio export ", feature->bcm_pin, " out" );
}
}
int pidee_feature_read( pidee_feature *feature ) {
return digitalRead( feature->bcm_pin ) ? 0 : 1;
}
void pidee_feature_write( pidee_feature *feature, int value ) {
digitalWrite( feature->bcm_pin, value );
}
/* Interupts */
void pidee_feature_enable_interupt( pidee_feature *feature ) {
int pin = feature->bcm_pin;
if ( pidee_feature_button.bcm_pin == pin ) { wiringPiISR( pin, INT_EDGE_BOTH, &pidee_button_interupt ); }
else if ( pidee_feature_dip_1.bcm_pin == pin ) { wiringPiISR( pin, INT_EDGE_BOTH, &pidee_dip_1_interupt ); }
else if ( pidee_feature_dip_2.bcm_pin == pin ) { wiringPiISR( pin, INT_EDGE_BOTH, &pidee_dip_2_interupt ); }
else if ( pidee_feature_dip_3.bcm_pin == pin ) { wiringPiISR( pin, INT_EDGE_BOTH, &pidee_dip_3_interupt ); }
else if ( pidee_feature_dip_4.bcm_pin == pin ) { wiringPiISR( pin, INT_EDGE_BOTH, &pidee_dip_4_interupt ); }
else if ( pidee_feature_dip_5.bcm_pin == pin ) { wiringPiISR( pin, INT_EDGE_BOTH, &pidee_dip_5_interupt ); }
else if ( pidee_feature_dip_6.bcm_pin == pin ) { wiringPiISR( pin, INT_EDGE_BOTH, &pidee_dip_6_interupt ); }
else if ( pidee_feature_dip_7.bcm_pin == pin ) { wiringPiISR( pin, INT_EDGE_BOTH, &pidee_dip_7_interupt ); }
else if ( pidee_feature_dip_8.bcm_pin == pin ) { wiringPiISR( pin, INT_EDGE_BOTH, &pidee_dip_8_interupt ); }
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* defined _PIDEE_H */
| 50.065574 | 153 | 0.714637 |
5dffd2307f9d7c8fb8e706bd1f58504667bd8387 | 39 | h | C | MulticategorySinglelayerNetwork/Process.h | uzunb/Artificial-Neural-Network-GUI | 4c7d3898dd24ddef9bff411995700bc167280538 | [
"MIT"
] | null | null | null | MulticategorySinglelayerNetwork/Process.h | uzunb/Artificial-Neural-Network-GUI | 4c7d3898dd24ddef9bff411995700bc167280538 | [
"MIT"
] | null | null | null | MulticategorySinglelayerNetwork/Process.h | uzunb/Artificial-Neural-Network-GUI | 4c7d3898dd24ddef9bff411995700bc167280538 | [
"MIT"
] | 1 | 2021-02-08T19:47:40.000Z | 2021-02-08T19:47:40.000Z |
int YPoint(int x, double* w, int = 1); | 19.5 | 38 | 0.615385 |
70776de6a6e21ede52acf46f96ca2de05a22ee00 | 4,252 | h | C | core/Render.h | jiwenchen/MonkeyGL | 98f8478b753c91e8b8e6c872a03a9742962fbb63 | [
"MIT"
] | 4 | 2022-02-25T02:48:49.000Z | 2022-03-28T08:02:15.000Z | core/Render.h | jiwenchen/MonkeyGL | 98f8478b753c91e8b8e6c872a03a9742962fbb63 | [
"MIT"
] | null | null | null | core/Render.h | jiwenchen/MonkeyGL | 98f8478b753c91e8b8e6c872a03a9742962fbb63 | [
"MIT"
] | null | null | null | // MIT License
// Copyright (c) 2022 jiwenchen(cjwbeyond@hotmail.com)
// 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.
#pragma once
#include "Defines.h"
#include "TransferFunction.h"
#include "VolumeInfo.h"
#include "Methods.h"
#include "IRender.h"
namespace MonkeyGL {
class Render : public IRender
{
public:
Render(void);
~Render(void);
public:
// volume info
virtual bool SetVolumeData(std::shared_ptr<short>pData, int nWidth, int nHeight, int nDepth);
virtual unsigned char AddNewObjectMask(std::shared_ptr<unsigned char>pData, int nWidth, int nHeight, int nDepth);
virtual bool UpdateObjectMask(std::shared_ptr<unsigned char>pData, int nWidth, int nHeight, int nDepth, const unsigned char& nLabel);
virtual void SetVolumeFile(const char* szFile, int nWidth, int nHeight, int nDepth);
virtual void SetSpacing(double x, double y, double z);
// output
virtual bool GetPlaneMaxSize(int& nWidth, int& nHeight, const PlaneType& planeType);
virtual bool GetPlaneData(short* pData, int& nWidth, int& nHeight, const PlaneType& planeType);
virtual bool GetCrossHairPoint(double& x, double& y, const PlaneType& planeType);
virtual void PanCrossHair(int nx, int ny, PlaneType planeType);
virtual bool GetVRData(unsigned char* pVR, int nWidth, int nHeight);
virtual bool GetBatchData( std::vector<short*>& vecBatchData, BatchInfo batchInfo );
virtual bool GetPlaneRotateMatrix(float* pMatirx, PlaneType planeType);
virtual void Anterior();
virtual void Posterior();
virtual void Left();
virtual void Right();
virtual void Head();
virtual void Foot();
virtual void Rotate(float fxRotate, float fyRotate);
virtual void Zoom(float ratio);
virtual void Pan(float fxShift, float fyShift);
virtual bool SetVRWWWL(float fWW, float fWL);
virtual bool SetVRWWWL(float fWW, float fWL, unsigned char nLabel);
virtual bool SetObjectAlpha(float fAlpha);
virtual bool SetObjectAlpha(float fAlpha, unsigned char nLabel);
virtual bool SetTransferFunc(std::map<int, RGBA> ctrlPts);
virtual bool SetTransferFunc(std::map<int, RGBA> ctrlPts, unsigned char nLabel);
virtual bool SetTransferFunc(std::map<int, RGBA> rgbPts, std::map<int, float> alphaPts);
virtual bool SetTransferFunc(std::map<int, RGBA> rgbPts, std::map<int, float> alphaPts, unsigned char nLabel);
private:
void InitLights();
void CopyTransferFunc2Device();
void CopyAlphaWWWL2Device();
void NormalizeVOI();
void testcuda();
private:
float m_fVOI_xStart;
float m_fVOI_xEnd;
float m_fVOI_yStart;
float m_fVOI_yEnd;
float m_fVOI_zStart;
float m_fVOI_zEnd;
VOI m_voi_Normalize;
float m_fTotalXTranslate;
float m_fTotalYTranslate;
float m_fTotalScale;
AlphaAndWWWL m_AlphaAndWWWL[MAXOBJECTCOUNT+1];
float* m_pRotateMatrix;
float* m_pTransposRotateMatrix;
float* m_pTransformMatrix;
float* m_pTransposeTransformMatrix;
};
}
| 38.654545 | 141 | 0.6992 |
bee2681436c618cb1d03c3e7dcf1540d5b39d47f | 1,338 | h | C | libs/libft/get_next_line.h | JoorsB/corewar | 868ea2d7ff68f22db1f65fe6b66e3667db0d9bd8 | [
"MIT"
] | 2 | 2020-06-17T16:52:23.000Z | 2020-07-16T12:59:17.000Z | libs/libft/get_next_line.h | JoorsB/corewar | 868ea2d7ff68f22db1f65fe6b66e3667db0d9bd8 | [
"MIT"
] | 12 | 2020-07-15T12:45:11.000Z | 2020-09-14T15:00:14.000Z | libs/libft/get_next_line.h | JoorsB/corewar | 868ea2d7ff68f22db1f65fe6b66e3667db0d9bd8 | [
"MIT"
] | 4 | 2020-06-17T16:52:30.000Z | 2020-07-16T12:59:25.000Z | /* ************************************************************************** */
/* */
/* :::::::: */
/* get_next_line.h :+: :+: */
/* +:+ */
/* By: ffredrik <ffredrik@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2019/02/06 16:39:38 by ffredrik #+# #+# */
/* Updated: 2019/02/11 20:13:43 by ffredrik ######## odam.nl */
/* */
/* ************************************************************************** */
#ifndef GET_NEXT_LINE_H
# define GET_NEXT_LINE_H
# include "libft.h"
# define BUFF_SIZE 2048
typedef enum e_return t_return;
enum e_return {
kHasMore = 2,
kEndLine = 1,
kNoRead = 0,
kError = -1,
};
int read_from_cache(const int fd, char **line, t_dict *cache);
int read_from_file(const int fd, t_dict *cache);
void update_cache(char **str, size_t take_len);
t_return read_file(ssize_t *lr, size_t *rb, char *buff, int fd);
#endif
| 38.228571 | 80 | 0.324365 |
2acf549f05df175ffce691d9d93d1427381a9fe6 | 2,304 | c | C | third-party/gasnet/gasnet-src/pami-conduit/gasnet_coll_pami_gathr.c | milisarge/chapel | 5a3bb108f1dde56f19ad0811726809566b9e6613 | [
"ECL-2.0",
"Apache-2.0"
] | 7 | 2015-03-02T01:42:08.000Z | 2021-05-11T22:04:04.000Z | third-party/gasnet/gasnet-src/pami-conduit/gasnet_coll_pami_gathr.c | milisarge/chapel | 5a3bb108f1dde56f19ad0811726809566b9e6613 | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2019-09-19T17:35:56.000Z | 2019-09-19T20:54:12.000Z | third-party/gasnet/gasnet-src/pami-conduit/gasnet_coll_pami_gathr.c | milisarge/chapel | 5a3bb108f1dde56f19ad0811726809566b9e6613 | [
"ECL-2.0",
"Apache-2.0"
] | 6 | 2015-03-01T13:02:20.000Z | 2021-02-27T01:55:40.000Z | /* $Source: bitbucket.org:berkeleylab/gasnet.git/pami-conduit/gasnet_coll_pami_gathr.c $
* Description: GASNet extended collectives implementation on PAMI
* Copyright 2012, The Regents of the University of California
* Terms of use are as specified in license.txt
*/
#include <gasnet_coll_pami.h>
#if GASNET_PAMI_NATIVE_COLL
static void
gasnete_coll_pami_gathr(const gasnet_team_handle_t team,
gasnet_image_t dstimage, void *dst,
const void *src, size_t nbytes,
int flags GASNETI_THREAD_FARG)
{
const int i_am_leader = 1;
if (i_am_leader) {
volatile unsigned int done = 0;
pami_result_t rc;
pami_xfer_t op;
if (flags & GASNET_COLL_IN_ALLSYNC) gasnetc_fast_barrier();
op = gasnete_op_template_gathr;
op.cookie = (void *)&done;
op.algorithm = team->pami.gathr_alg;
op.cmd.xfer_gather.root = gasnetc_endpoint(GASNETE_COLL_REL2ACT(team, dstimage));
op.cmd.xfer_gather.sndbuf = (/*not-const*/ void *)src;
op.cmd.xfer_gather.stypecount = nbytes;
op.cmd.xfer_gather.rcvbuf = dst;
op.cmd.xfer_gather.rtypecount = nbytes;
GASNETC_PAMI_LOCK(gasnetc_context);
rc = PAMI_Collective(gasnetc_context, &op);
GASNETC_PAMI_UNLOCK(gasnetc_context);
GASNETC_PAMI_CHECK(rc, "initiating blocking gather");
gasneti_polluntil(done);
}
if (flags & GASNET_COLL_OUT_ALLSYNC) {
if (i_am_leader) gasnetc_fast_barrier();
}
}
extern void
gasnete_coll_gather_pami(gasnet_team_handle_t team,
gasnet_image_t dstimage, void *dst,
void *src, size_t nbytes,
int flags GASNETI_THREAD_FARG)
{
if ((team->pami.geom == PAMI_GEOMETRY_NULL) || !gasnete_use_pami_gathr) {
/* Use generic implementation for cases we don't (yet) handle, or when disabled */
gex_Event_t handle;
handle = gasnete_coll_gather_nb_default(team,dstimage,dst,src,nbytes,flags,0 GASNETI_THREAD_PASS);
gasnete_wait(handle GASNETI_THREAD_PASS);
} else { /* Use PAMI-specific implementation: */
gasnete_coll_pami_gathr(team,dstimage,dst,src,nbytes,flags GASNETI_THREAD_PASS);
}
}
#endif /* GASNET_PAMI_NATIVE_COLL */
| 35.446154 | 102 | 0.673177 |
f1c864e960e676bc4121a911fa22f6d62a07bab4 | 643 | h | C | students/students/DeleteViewController.h | fzh541788/Week3 | bee311a9c09ba796cdbedd9d170250001023ad19 | [
"Apache-2.0"
] | null | null | null | students/students/DeleteViewController.h | fzh541788/Week3 | bee311a9c09ba796cdbedd9d170250001023ad19 | [
"Apache-2.0"
] | null | null | null | students/students/DeleteViewController.h | fzh541788/Week3 | bee311a9c09ba796cdbedd9d170250001023ad19 | [
"Apache-2.0"
] | null | null | null | //
// DeleteViewController.h
// students
//
// Created by young_jerry on 2020/7/30.
// Copyright © 2020 young_jerry. All rights reserved.
//
#import <UIKit/UIKit.h>
//声明协议方法
@protocol DeleteDelegate <NSObject>
- (void)deleteContent:(NSMutableArray *)nameArr andClass:(NSMutableArray *)classArr andScore:(NSMutableArray *)scoreArr;
@end
NS_ASSUME_NONNULL_BEGIN
@interface DeleteViewController : UIViewController
@property NSMutableArray *nameArr;
@property NSMutableArray *classArr;
@property NSMutableArray *scoreArr;
@property UITextField *deleteTextField;
//声明代理
@property id<DeleteDelegate> delegate;
@end
NS_ASSUME_NONNULL_END
| 20.741935 | 120 | 0.783826 |
4a45e00ebad6c29b4ac6739e175f3773726147cd | 680 | c | C | Examen/Examen_1/FuncionesPunteros.c | mikenavarroro/ProgramacionII | 9e7834051db7b1b0cfc9b69722507ea14ba822da | [
"MIT"
] | null | null | null | Examen/Examen_1/FuncionesPunteros.c | mikenavarroro/ProgramacionII | 9e7834051db7b1b0cfc9b69722507ea14ba822da | [
"MIT"
] | null | null | null | Examen/Examen_1/FuncionesPunteros.c | mikenavarroro/ProgramacionII | 9e7834051db7b1b0cfc9b69722507ea14ba822da | [
"MIT"
] | null | null | null | #include <stdio.h>
void promedio(float a; int *b);
typedef struct{
char nombre[30];
float prom;
}estu;
int main(){
int N; i;
float prom = 0.0;
printf("Cuantos alumnos quiere ingresar?\n");
scanf("%i"; &N);
estu estudientes[N];
for (i = 0; i < N; i++){
printf("Nombre del %d estudiente: "; i+1);
scanf("%s"; estudientes[i].nombre);
printf("%d calificación: "; i+1);
scanf("%f"; &estudientes[i].prom);
prom += estudientes[i].prom;
}
promedio(prom; &N);
}
void promedio(float prom; int *N){
float prom_gen;
prom_gen = prom / *N;
printf("El promedio total es %.3f\n"; prom_gen);
}
| 17.894737 | 52 | 0.551471 |
9a305fd237a7eba0b6a4c0d6c2268b3e2f99d365 | 11,539 | c | C | src/snmp-mib/agent/target-module.c | verrio/osnmpd | a7c7830cfbbb77fc20d18021531e250267da67e3 | [
"MIT"
] | 11 | 2017-05-20T22:34:34.000Z | 2022-02-15T00:30:49.000Z | src/snmp-mib/agent/target-module.c | verrio/osnmpd | a7c7830cfbbb77fc20d18021531e250267da67e3 | [
"MIT"
] | 1 | 2019-12-10T01:40:18.000Z | 2019-12-10T01:40:18.000Z | src/snmp-mib/agent/target-module.c | verrio/osnmpd | a7c7830cfbbb77fc20d18021531e250267da67e3 | [
"MIT"
] | 5 | 2017-05-20T22:40:25.000Z | 2021-03-18T19:00:54.000Z | /*
* This file is part of the osnmpd project (https://github.com/verrio/osnmpd).
* Copyright (C) 2016 Olivier Verriest
*
* 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.
*/
#include <arpa/inet.h>
#include <stddef.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <inttypes.h>
#include <stdio.h>
#include "config.h"
#include "snmp-agent/mib-tree.h"
#include "snmp-agent/agent-cache.h"
#include "snmp-agent/agent-config.h"
#include "snmp-core/utils.h"
#include "snmp-core/snmp-types.h"
#include "snmp-mib/single-level-module.h"
#include "snmp-mib/agent/target-module.h"
#define TARGET_MIB_OID SNMP_OID_SNMPMODULES,12,1
#define TARGET_MIB_COMPLIANCE_OID SNMP_OID_SNMPMODULES,12,3,1,1
/* single instance index */
SubOID target_table_idx[] = { 117, 112, 115, 116, 114, 101, 97, 109 };
size_t target_table_idx_len = OID_LENGTH(target_table_idx);
/* message processing and security model 3 */
#define MPV3 3
#define MSECV3 3
static const char *table_index_ref = "upstream";
#define TARGET_TAG_LIST "upstream monitoring"
/* transport domains */
#define TRANSPORT_DOMAIN_UDP_IP4 SNMP_OID_MIB2,100,1,1
#define TRANSPORT_DOMAIN_UDP_IP6 SNMP_OID_MIB2,100,1,2
#define TRANSPORT_DOMAIN_UDP_DNS SNMP_OID_MIB2,100,1,14
enum TargetAddressType {
TARGET_IP4,
TARGET_IP6,
TARGET_DNS
};
static SysOREntry target_or_entry = {
.or_id = {
.subid = { TARGET_MIB_COMPLIANCE_OID },
.len = OID_SEQ_LENGTH(TARGET_MIB_COMPLIANCE_OID)
},
.or_descr = "SNMP-TARGET-MIB - MIB module for managing notification targets",
.next = NULL
};
enum TargetMIBObjects {
SNMP_TARGET_SPIN_LOCK = 1,
SNMP_TARGET_ADDRESS_TABLE = 2,
SNMP_TARGET_PARAMS_TABLE = 3,
SNMP_UNAVAILABLE_CONTEXTS = 4,
SNMP_UNKNOWN_CONTEXTS = 5
};
enum TargetAddressTableColumns {
SNMP_TARGET_ADDR_NAME = 1,
SNMP_TARGET_ADDR_TDOMAIN = 2,
SNMP_TARGET_ADDR_TADDRESS = 3,
SNMP_TARGET_ADDR_TIMEOUT = 4,
SNMP_TARGET_ADDR_RETRY_COUNT = 5,
SNMP_TARGET_ADDR_TAG_LIST = 6,
SNMP_TARGET_ADDR_PARAMS = 7,
SNMP_TARGET_ADDR_STORAGE_TYPE = 8,
SNMP_TARGET_ADDR_ROW_STATUS = 9
};
enum ParametersTableColumns {
SNMP_TARGET_PARAMS_NAME = 1,
SNMP_TARGET_PARAMS_MP_MODEL = 2,
SNMP_TARGET_PARAMS_SECURITY_MODEL = 3,
SNMP_TARGET_PARAMS_SECURITY_NAME = 4,
SNMP_TARGET_PARAMS_SECURITY_LEVEL = 5,
SNMP_TARGET_PARAMS_STORAGE_TYPE = 6,
SNMP_TARGET_PARAMS_ROW_STATUS = 7
};
static enum TargetAddressType get_target_address_type(void)
{
char *host = get_trap_configuration()->destination;
uint8_t addr[16];
if (host == NULL ||
inet_pton(AF_INET6, host, addr) == 1) {
return TARGET_IP6;
} else if (inet_pton(AF_INET, host, addr) == 1) {
return TARGET_IP4;
} else {
return TARGET_DNS;
}
}
static SnmpErrorStatus get_address_table(int column, SubOID *row,
size_t row_len, SnmpVariableBinding *binding, int next_row)
{
/* single instance */
int cmp = cmp_index_to_oid(target_table_idx, target_table_idx_len, row, row_len);
if (next_row && cmp >= 0) {
binding->type = SMI_EXCEPT_END_OF_MIB_VIEW;
return NO_ERROR;
} else if (!next_row && cmp) {
binding->type = SMI_EXCEPT_NO_SUCH_INSTANCE;
return NO_ERROR;
}
switch (column) {
case SNMP_TARGET_ADDR_TDOMAIN: {
switch (get_target_address_type()) {
case TARGET_IP6: {
SET_OID_BIND(binding, TRANSPORT_DOMAIN_UDP_IP6);
break;
}
case TARGET_IP4: {
SET_OID_BIND(binding, TRANSPORT_DOMAIN_UDP_IP4);
break;
}
case TARGET_DNS: {
SET_OID_BIND(binding, TRANSPORT_DOMAIN_UDP_DNS);
break;
}
}
break;
}
case SNMP_TARGET_ADDR_TADDRESS: {
char buf[512];
if (get_trap_configuration()->destination == NULL) {
buf[0] = '\0';
} else if (get_target_address_type() == TARGET_IP6) {
snprintf(buf, sizeof(buf), "[%s]:%" PRIu16,
get_trap_configuration()->destination, get_trap_configuration()->port);
} else {
snprintf(buf, sizeof(buf), "%s:%" PRIu16,
get_trap_configuration()->destination, get_trap_configuration()->port);
}
SET_OCTET_STRING_RESULT(binding, strdup(buf), strlen(buf));
break;
}
case SNMP_TARGET_ADDR_TIMEOUT: {
/* timeout in 0.01 seconds */
SET_INTEGER_BIND(binding, get_trap_configuration()->timeout * 100);
break;
}
case SNMP_TARGET_ADDR_RETRY_COUNT: {
SET_INTEGER_BIND(binding, get_trap_configuration()->retries);
break;
}
case SNMP_TARGET_ADDR_TAG_LIST: {
SET_OCTET_STRING_RESULT(binding, strdup(TARGET_TAG_LIST),
strlen(TARGET_TAG_LIST));
break;
}
case SNMP_TARGET_ADDR_NAME:
case SNMP_TARGET_ADDR_PARAMS: {
SET_OCTET_STRING_RESULT(binding, strdup(table_index_ref),
strlen(table_index_ref));
break;
}
case SNMP_TARGET_ADDR_STORAGE_TYPE: {
/* readOnly */
SET_INTEGER_BIND(binding, 5);
break;
}
case SNMP_TARGET_ADDR_ROW_STATUS: {
/* active/notInService */
SET_INTEGER_BIND(binding, get_trap_configuration()->enabled ? 1 : 2);
break;
}
}
INSTANCE_FOUND_OID_ROW(next_row, TARGET_MIB_OID, SNMP_TARGET_ADDRESS_TABLE,
column, target_table_idx, target_table_idx_len);
}
static SnmpErrorStatus get_params_table(int column, SubOID *row,
size_t row_len, SnmpVariableBinding *binding, int next_row)
{
/* single instance */
int cmp = cmp_index_to_oid(target_table_idx, target_table_idx_len, row, row_len);
if (next_row && cmp >= 0) {
binding->type = SMI_EXCEPT_END_OF_MIB_VIEW;
return NO_ERROR;
} else if (!next_row && cmp) {
binding->type = SMI_EXCEPT_NO_SUCH_INSTANCE;
return NO_ERROR;
}
switch (column) {
case SNMP_TARGET_PARAMS_NAME: {
SET_OCTET_STRING_RESULT(binding, strdup(table_index_ref),
strlen(table_index_ref));
break;
}
case SNMP_TARGET_PARAMS_MP_MODEL: {
SET_INTEGER_BIND(binding, MPV3);
break;
}
case SNMP_TARGET_PARAMS_SECURITY_MODEL: {
SET_INTEGER_BIND(binding, MSECV3);
break;
}
case SNMP_TARGET_PARAMS_SECURITY_NAME: {
if (get_trap_configuration()->user != -1) {
char *user = get_user_configuration(get_trap_configuration()
->user)->name;
SET_OCTET_STRING_RESULT(binding, strdup(user), strlen(user));
} else {
SET_OCTET_STRING_BIND(binding, NULL, 0);
}
break;
}
case SNMP_TARGET_PARAMS_SECURITY_LEVEL: {
int level = 0;
if (get_trap_configuration()->user != -1) {
level = get_user_configuration(get_trap_configuration()->user)
->security_level;
}
SET_INTEGER_BIND(binding, level);
break;
}
case SNMP_TARGET_PARAMS_STORAGE_TYPE: {
/* readOnly */
SET_INTEGER_BIND(binding, 5);
break;
}
case SNMP_TARGET_PARAMS_ROW_STATUS: {
/* active/notInService */
SET_INTEGER_BIND(binding, get_trap_configuration()->enabled ? 1 : 2);
break;
}
}
INSTANCE_FOUND_OID_ROW(next_row, TARGET_MIB_OID, SNMP_TARGET_PARAMS_TABLE,
column, target_table_idx, target_table_idx_len);
}
DEF_METHOD(get_scalar, SnmpErrorStatus, SingleLevelMibModule,
SingleLevelMibModule, int id, SnmpVariableBinding *binding)
{
switch (id) {
case SNMP_TARGET_SPIN_LOCK: {
SET_INTEGER_BIND(binding, 0);
break;
}
case SNMP_UNAVAILABLE_CONTEXTS: {
/* all engine ID mismatches are counted as unknown engines */
SET_UNSIGNED_BIND(binding, 0);
break;
}
case SNMP_UNKNOWN_CONTEXTS: {
SET_UNSIGNED_BIND(binding, get_statistics()->usm_stats_unknown_engine_ids);
break;
}
}
return NO_ERROR;
}
DEF_METHOD(set_scalar, SnmpErrorStatus, SingleLevelMibModule,
SingleLevelMibModule, int id, SnmpVariableBinding *binding, int dry_run)
{
return NOT_WRITABLE;
}
DEF_METHOD(get_tabular, SnmpErrorStatus, SingleLevelMibModule,
SingleLevelMibModule, int id, int column, SubOID *row, size_t row_len,
SnmpVariableBinding *binding, int next_row)
{
switch (id) {
case SNMP_TARGET_ADDRESS_TABLE: {
return get_address_table(column, row, row_len, binding, next_row);
}
case SNMP_TARGET_PARAMS_TABLE: {
return get_params_table(column, row, row_len, binding, next_row);
}
default: {
return GENERAL_ERROR;
}
}
}
DEF_METHOD(set_tabular, SnmpErrorStatus, SingleLevelMibModule,
SingleLevelMibModule, int id, int column, SubOID *index, size_t index_len,
SnmpVariableBinding *binding, int dry_run)
{
return NOT_WRITABLE;
}
DEF_METHOD(finish_module, void, MibModule, SingleLevelMibModule)
{
finish_single_level_module(this);
}
MibModule *init_target_module(void)
{
SingleLevelMibModule *module = malloc(sizeof(SingleLevelMibModule));
if (module == NULL) {
return NULL;
} else if (init_single_level_module(module, SNMP_TARGET_SPIN_LOCK,
SNMP_UNKNOWN_CONTEXTS - SNMP_TARGET_SPIN_LOCK + 1, LEAF_SCALAR,
SNMP_TARGET_ADDR_ROW_STATUS, SNMP_TARGET_PARAMS_ROW_STATUS,
LEAF_SCALAR, LEAF_SCALAR)) {
free(module);
return NULL;
}
SET_PREFIX(module, TARGET_MIB_OID);
SET_OR_ENTRY(module, &target_or_entry);
SET_METHOD(module, MibModule, finish_module);
SET_METHOD(module, SingleLevelMibModule, get_scalar);
SET_METHOD(module, SingleLevelMibModule, set_scalar);
SET_METHOD(module, SingleLevelMibModule, get_tabular);
SET_METHOD(module, SingleLevelMibModule, set_tabular);
return &module->public;
}
| 32.052778 | 91 | 0.647543 |
2bee8c2132e4f96b7646f949a478aff5347980ab | 2,292 | h | C | Source/ILABReverseVideoDefs.h | km-mjkong/TRReverse | 0b31a3a4cdbb9f90b2123f73bf7f7adfa7799cc3 | [
"BSD-3-Clause"
] | 2 | 2019-08-26T00:39:19.000Z | 2019-10-11T00:30:48.000Z | Source/ILABReverseVideoDefs.h | km-mjkong/TRReverse | 0b31a3a4cdbb9f90b2123f73bf7f7adfa7799cc3 | [
"BSD-3-Clause"
] | null | null | null | Source/ILABReverseVideoDefs.h | km-mjkong/TRReverse | 0b31a3a4cdbb9f90b2123f73bf7f7adfa7799cc3 | [
"BSD-3-Clause"
] | 1 | 2019-08-26T05:55:48.000Z | 2019-08-26T05:55:48.000Z | //
// ILABReverseVideoDefs.h
// ILABReverseVideoExporter
//
// Created by Jon Gilkison on 8/15/17.
//
#import <Foundation/Foundation.h>
extern NSString * const kILABReverseVideoExportSessionErrorDomain;
typedef enum : NSInteger {
ILABSessionErrorMissingOutputURL = -101,
ILABSessionErrorAVAssetReaderStartReading = -102,
ILABSessionErrorVideoNoSamples = -103,
ILABSessionErrorAVAssetWriterStartWriting = -104,
ILABSessionErrorVideoUnableToWirteFrame = -105,
ILABSessionErrorUserCancel = -106,
ILABSessionErrorAVAssetReaderReading = -107,
ILABSessionErrorAVAssetExportSessionCompatibility = -108,
ILABSessionErrorInsertTrack = -109,
ILABSessionErrorAVAssetExportSessionCreate = -110,
ILABSessionErrorAudioInvalidTrackIndex = -201,
ILABSessionErrorAudioCannotAddInput = -202,
ILABSessionErrorAudioCanAddOutput = -203,
ILABSessionErrorNoCompleteAudioExport = -204,
} ILABSessionError;
/**
Block called when a reversal has completed.
@param complete YES if successful, NO if not
@param error If not successful, the NSError describing the problem
*/
typedef void(^ILABCompleteBlock)(BOOL complete, NSError *error);
/**
Progress block called during reversal process
@param currentOperation The current operation name/title
@param progress The current progress normalized 0 .. 1, INFINITY for an operation that is indeterminate
*/
typedef void(^ILABProgressBlock)(NSString *currentOperation, float progress);
/**
Category for easily generation NSError instances in the kILABReverseVideoExportSessionErrorDomain domain.
*/
@interface NSError(ILABReverseVideoExportSession)
/**
Return an NSError with the kILABReverseVideoExportSessionDomain, error code and localized description set
@param errorStatus The error status to return
@return The NSError instance
*/
+(NSError *)ILABSessionError:(ILABSessionError)errorStatus;
/**
Returns an NSError with a helpful localized description for common audio errors
@param statusCode The status code
@return The NSError instance
*/
+(NSError *)errorWithAudioFileStatusCode:(OSStatus)statusCode;
@end
| 32.28169 | 106 | 0.732984 |
60034f1c172a04d650b2063787959c65c9ecda89 | 128 | h | C | qtCyberDIP-master/qtCyberDip/QTFFmpegWrapper/libavutil/ffversion.h | leofansq/Automatic-Puzzle-Solver | 7179d7ebcaa290eade1fb4846ea50bae2c7bbf2b | [
"MIT"
] | 2 | 2018-11-02T02:46:12.000Z | 2020-07-05T10:40:08.000Z | qtCyberDIP-master/qtCyberDip/QTFFmpegWrapper/libavutil/ffversion.h | leofansq/Automatic-Puzzle-Solver | 7179d7ebcaa290eade1fb4846ea50bae2c7bbf2b | [
"MIT"
] | null | null | null | qtCyberDIP-master/qtCyberDip/QTFFmpegWrapper/libavutil/ffversion.h | leofansq/Automatic-Puzzle-Solver | 7179d7ebcaa290eade1fb4846ea50bae2c7bbf2b | [
"MIT"
] | null | null | null | #ifndef AVUTIL_FFVERSION_H
#define AVUTIL_FFVERSION_H
#define FFMPEG_VERSION "N-59015-g3efe5e3"
#endif /* AVUTIL_FFVERSION_H */
| 25.6 | 41 | 0.820313 |
44e5b2580c1989ae5d90b14f873c39e4e7e8b541 | 6,266 | c | C | src/yalex_interop.c | AlexanderBrevig/yalex | cca45be9544684781a7c41471c4c7d32a115a9a5 | [
"MIT"
] | 4 | 2019-03-12T22:20:00.000Z | 2022-03-09T09:50:22.000Z | src/yalex_interop.c | AlexanderBrevig/yalex | cca45be9544684781a7c41471c4c7d32a115a9a5 | [
"MIT"
] | 1 | 2020-03-11T08:31:53.000Z | 2020-03-11T08:31:53.000Z | src/yalex_interop.c | AlexanderBrevig/yalex | cca45be9544684781a7c41471c4c7d32a115a9a5 | [
"MIT"
] | null | null | null | #ifdef __cplusplus
extern "C" {
#endif
#include "yalex_interop.h"
int yalex_strlen(const char * str) {
if (str == 0) return 0;
int len = 0;
while (str[len]) len++;
return len;
}
int yalex_strcat(char * to, unsigned int size, const char * from) {
if (to == 0 || from == 0 || size == 0) return 0;
unsigned int i, j;
for (i = 0; to[i] != '\0'; i++)
;
for (j = 0; from[j] != '\0'; j++) {
if (i + j > size) return 0;
to[i + j] = from[j];
}
to[i + j] = '\0';
return i + j;
}
int yalex_strcmp(const char * a, const char * b) {
if (a == 0 || b == 0) return -1;
int offset = 0;
for (int i = 0; a[i] && a[i] != b[0]; i++) {
offset++;
if (a[offset] == b[0]) {
return offset;
}
}
for (int i = 0; ; i++) {
if (a[i] == '\0' && b[i] == '\0') {
return 0;
}
if (a[i] != b[i]) {
return a[i] < b[i] ? -1 : 1;
}
}
}
int yalex_strcpy(char * to, unsigned int size, const char * from) {
if (to == 0 || from == 0 || size == 0) {
return 0;
}
unsigned int i = 0;
while (i < size && from[i]) {
to[i] = from[i];
i++;
}
to[i] = from[i];
if (i >= size) return 0;
return 1;
}
void * yalex_memset(void *s, int c, unsigned int n) {
if (s == 0) return 0;
unsigned char* p = s;
while (n--)
*p++ = (unsigned char) c;
return s;
}
void yalex_lltoa_s(long long num, char buf[21], char radix) {
if (buf == 0) return;
radix = 10; //unused
char str[21];
int i = 0;
char isNegative = 0;
/* Handle 0 explicitely, otherwise empty string is printed for 0 */
if (num == 0) {
buf[i++] = '0';
buf[i++] = '\0';
return;
}
// In standard itoa(), negative numbers are handled only with
// base 10. Otherwise numbers are considered unsigned.
if (num < 0) {
isNegative = 1;
num = -num;
}
// Process individual digits
while (num != 0 && i < 20) {
char rem = num % 10;
str[i++] = rem + '0';
num = num / 10;
}
// If number is negative, append '-'
if (isNegative)
str[i++] = '-';
for (int j = i; j > 0; --j) {
buf[i - j] = str[j - 1];
}
buf[i] = '\0'; // Append string terminator
}
/*-
* Copyright (c) 2014 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. [rescinded 22 July 1999]
* 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.
*/
//https://github.com/gcc-mirror/gcc/blob/master/libiberty/strtoll.c
long long yalex_atoll_s(const char *buf, char **end, int radix) {
end = 0;
register const char *s = buf;
register unsigned long long acc;
register int c;
register unsigned long long cutoff;
register int neg = 0, any, cutlim;
c = *s++;
if (c == '-') {
neg = 1;
c = *s++;
} else if (c == '+') {
c = *s++;
}
if ((radix == 0 || radix == 16) &&
c == '0' && (*s == 'x' || *s == 'X')) {
c = s[1];
s += 2;
radix = 16;
}
if (radix == 0)
radix = c == '0' ? 8 : 10;
/*
* Compute the cutoff value between legal numbers and illegal
* numbers. That is the largest legal value, divided by the
* base. An input number that is greater than this value, if
* followed by a legal input character, is too big. One that
* is equal to this value may be valid or not; the limit
* between valid and invalid numbers is then based on the last
* digit. For instance, if the range for longs is
* [-2147483648..2147483647] and the input base is 10,
* cutoff will be set to 214748364 and cutlim to either
* 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated
* a value > 214748364, or equal but the next digit is > 7 (or 8),
* the number is too big, and we will return a range error.
*
* Set any if any `digits' consumed; make it negative to indicate
* overflow.
*/
cutoff = neg ? YALEX_LLONG_MIN : YALEX_LLONG_MAX;
cutlim = cutoff % (long long) radix;
cutoff /= (long long) radix;
for (acc = 0, any = 0;; c = *s++) {
if (ISDIGIT(c))
c -= '0';
else if (ISALPHA(c))
c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10;
else
break;
if (c >= radix)
break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
acc *= radix;
acc += c;
}
}
if (any < 0) {
return neg ? YALEX_LLONG_MIN : YALEX_LLONG_MAX;
} else if (neg) {
return -1 * ((long long) acc);
}
return (long long) acc;
}
#ifdef __cplusplus
}
#endif | 30.270531 | 77 | 0.558091 |
cd10216f3e74a202e277f4ce91ea88fb29bbc169 | 1,470 | c | C | mainf.c | I-rocha/Semaforo | a0317e396453e6b4cf476a7b69e5c7033ed6731d | [
"MIT"
] | null | null | null | mainf.c | I-rocha/Semaforo | a0317e396453e6b4cf476a7b69e5c7033ed6731d | [
"MIT"
] | null | null | null | mainf.c | I-rocha/Semaforo | a0317e396453e6b4cf476a7b69e5c7033ed6731d | [
"MIT"
] | null | null | null | #include<stdio.h>
#include<stdlib.h>
#include<semaphore.h>
#include<pthread.h>
#include<unistd.h>
sem_t* sem_a;
sem_t* sem_b;
void* fA(){
printf("Thread A: %llu\n\n", (long long unsigned int)pthread_self());
// printf("before waiting fa\n");
sem_wait(sem_a);
printf("after A alocar a\n");
sem_wait(sem_b);
printf("after A alocar b\n");
// sleep(2);
// printf("sleeping fa\n");
// sleep(5);
// printf("A requisitando B");
// sem_wait(sem_b);
// printf("After A alocar b\n");
// sleep(4);
sem_post(sem_a);
printf("After a free a\n");
sem_post(sem_b);
printf("After a free b\n");
printf("fa out\n");
pthread_exit(0);
}
void* fB(){
printf("Thread B: %llu\n\n", (long long unsigned int)pthread_self());
// printf("before waiting fb\n");
// sleep(2);
sem_wait(sem_b);
printf("after B alocar b\n");
// printf("sleeping fb\n");
//sleep(5);
sem_wait(sem_a);
printf("After B alocar a\n");
sem_post(sem_b);
printf("After b free b\n");
sem_post(sem_a);
printf("After b free a\n");
printf("fb out\n");
pthread_exit(0);
}
int main(){
pthread_t A,B;
// sem_t* sem_a;
// sem_t* sem_b;
sem_a = (sem_t*)malloc(sizeof(sem_t));
sem_b = (sem_t*)malloc(sizeof(sem_t));
// printf("sem_a: %p\n", sem_a);
// printf("sem_b: %p\n\n", sem_b);
sem_init(sem_a, 0, 1);
sem_init(sem_b, 0, 1);
// pthread_join(A, NULL);
pthread_create(&A, NULL, fA, NULL);
pthread_create(&B, NULL, fB, NULL);
pthread_join(A, NULL);
pthread_join(B, NULL);
return 0;
}
| 18.846154 | 70 | 0.637415 |
75ca60c60b176aad0fa89ed3a049a6568e564f19 | 2,906 | c | C | doc/mwc/doc/coherent/manual/FILES.c | gspu/Coherent | 299bea1bb52a4dcc42a06eabd5b476fce77013ef | [
"BSD-3-Clause"
] | 20 | 2019-10-10T14:14:56.000Z | 2022-02-24T02:54:38.000Z | doc/mwc/doc/coherent/manual/FILES.c | gspu/Coherent | 299bea1bb52a4dcc42a06eabd5b476fce77013ef | [
"BSD-3-Clause"
] | null | null | null | doc/mwc/doc/coherent/manual/FILES.c | gspu/Coherent | 299bea1bb52a4dcc42a06eabd5b476fce77013ef | [
"BSD-3-Clause"
] | 1 | 2022-03-25T18:38:37.000Z | 2022-03-25T18:38:37.000Z | /v/doc/coherent/lx/c
/v/doc/coherent/lx/c_keyword
/v/doc/coherent/lx/c_languag
/v/doc/coherent/lx/c_preproc
/v/doc/coherent/lx/cabs
/v/doc/coherent/lx/cal
/v/doc/coherent/lx/calendar
/v/doc/coherent/lx/calling_c
/v/doc/coherent/lx/calloc
/v/doc/coherent/lx/cancel
/v/doc/coherent/lx/canon.h
/v/doc/coherent/lx/captoinfo
/v/doc/coherent/lx/case.c
/v/doc/coherent/lx/case.k
/v/doc/coherent/lx/cast
/v/doc/coherent/lx/cat
/v/doc/coherent/lx/caveat_ut
/v/doc/coherent/lx/cc
/v/doc/coherent/lx/cc0
/v/doc/coherent/lx/cc1
/v/doc/coherent/lx/cc2
/v/doc/coherent/lx/cc3
/v/doc/coherent/lx/cchead
/v/doc/coherent/lx/cctail
/v/doc/coherent/lx/cd
/v/doc/coherent/lx/cd-rom
/v/doc/coherent/lx/cdmp
/v/doc/coherent/lx/cdplayer
/v/doc/coherent/lx/cdrom.h
/v/doc/coherent/lx/cdu31
/v/doc/coherent/lx/cdv
/v/doc/coherent/lx/cdview
/v/doc/coherent/lx/ceil
/v/doc/coherent/lx/cfgetispe
/v/doc/coherent/lx/cfgetospe
/v/doc/coherent/lx/cfsetispe
/v/doc/coherent/lx/cfsetospe
/v/doc/coherent/lx/cgrep
/v/doc/coherent/lx/char
/v/doc/coherent/lx/chase
/v/doc/coherent/lx/chdir
/v/doc/coherent/lx/check
/v/doc/coherent/lx/checkerr
/v/doc/coherent/lx/checklist
/v/doc/coherent/lx/chgrp
/v/doc/coherent/lx/chmod.c
/v/doc/coherent/lx/chmod.s
/v/doc/coherent/lx/chmog
/v/doc/coherent/lx/chown.c
/v/doc/coherent/lx/chown.s
/v/doc/coherent/lx/chreq
/v/doc/coherent/lx/chroot.c
/v/doc/coherent/lx/chroot.s
/v/doc/coherent/lx/chsize
/v/doc/coherent/lx/ckermit
/v/doc/coherent/lx/clear
/v/doc/coherent/lx/clearerr
/v/doc/coherent/lx/clist.h
/v/doc/coherent/lx/clock
/v/doc/coherent/lx/clock.l
/v/doc/coherent/lx/close
/v/doc/coherent/lx/closedir
/v/doc/coherent/lx/clri
/v/doc/coherent/lx/cmos
/v/doc/coherent/lx/cmp
/v/doc/coherent/lx/coff.h
/v/doc/coherent/lx/coffnlist
/v/doc/coherent/lx/coh_intro
/v/doc/coherent/lx/coheren.h
/v/doc/coherent/lx/coherent
/v/doc/coherent/lx/cohtune
/v/doc/coherent/lx/col
/v/doc/coherent/lx/comm
/v/doc/coherent/lx/commands
/v/doc/coherent/lx/compress
/v/doc/coherent/lx/compressi
/v/doc/coherent/lx/con.h
/v/doc/coherent/lx/config.s
/v/doc/coherent/lx/config.u
/v/doc/coherent/lx/connect
/v/doc/coherent/lx/console
/v/doc/coherent/lx/const
/v/doc/coherent/lx/const.h
/v/doc/coherent/lx/continu.c
/v/doc/coherent/lx/continu.k
/v/doc/coherent/lx/controls
/v/doc/coherent/lx/conv
/v/doc/coherent/lx/core.f
/v/doc/coherent/lx/core.h
/v/doc/coherent/lx/cos
/v/doc/coherent/lx/cosh
/v/doc/coherent/lx/cp
/v/doc/coherent/lx/cpdir
/v/doc/coherent/lx/cpio
/v/doc/coherent/lx/cpp
/v/doc/coherent/lx/cpphead
/v/doc/coherent/lx/cpptail
/v/doc/coherent/lx/creat
/v/doc/coherent/lx/cron
/v/doc/coherent/lx/crontab
/v/doc/coherent/lx/crypt.c
/v/doc/coherent/lx/crypt.g
/v/doc/coherent/lx/ct
/v/doc/coherent/lx/ctags
/v/doc/coherent/lx/ctermid
/v/doc/coherent/lx/ctime
/v/doc/coherent/lx/ctype.h
/v/doc/coherent/lx/cu
/v/doc/coherent/lx/curses.h
/v/doc/coherent/lx/cut
/v/doc/coherent/lx/cvmail
/v/doc/coherent/lx/cwd
| 25.716814 | 28 | 0.759463 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.