text stringlengths 4 6.14k |
|---|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: core/CDebugView.h
* PURPOSE: Header file for debug view class
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#ifndef __CDEBUGVIEW_H
#define __CDEBUGVIEW_H
#include "CGUI.h"
#include <gui/CGUI.h>
#include "CChat.h"
#define DEBUGVIEW_WIDTH 576 // Debugview default width
#define DEBUGVIEW_TEXT_COLOR CColor( 235, 221, 178, 255 ) // Debugview default text color
class CDebugView : public CChat
{
public:
CDebugView(CGUI* pManager, const CVector2D& vecPosition);
void Draw(bool bUseCacheTexture, bool bAllowOutline);
void Output(const char* szText, bool bColorCoded);
protected:
// Debug view doesn't support position changes unlike chat box
void UpdatePosition(void){};
};
#endif
|
#include <stdio.h>
#include <math.h>
double w=-2.0/3.0;
void point(double Qx, double Qy, double Qz, double vx, double vy, double vz, double bx, double by, double bz)
{
double Q[3];
double v[3],b[3];
double rn[3];
double fv[3];
double fb[3];
double vv[3][3];
double vb[3][3];
double bv[3][3];
double bb[3][3];
double fvl=0.0;
double fbl=0.0;
for(int i=1;i<=3;i++)
for(int j=1;j<=3;j++)
{
vv[i][j]=0;
vb[i][j]=0;
bv[i][j]=0;
bb[i][j]=0;
}
double Q2,Qalpha;
// begin Todor Method Area
// -----------------------------------------------------------------------------
// nachalo na prisvojavane na lokalni promenlivi
Q[1]=Qx; Q[2]=Qy; Q[3]=Qz;
/*
v[1]=vx[ix][iy][iz]; v[2]=vy[ix][iy][iz]; v[3]=vz[ix][iy][iz];
b[1]=bx[ix][iy][iz]; b[2]=vy[ix][iy][iz]; b[3]=vz[ix][iy][iz];
*/
v[1]=vx; v[2]=vy; v[3]=vz;
b[1]=bx; b[2]=vy; b[3]=vz;
/*
vv[1][1]=wwxx[ix][iy][iz]; vv[1][2]=wwxy[ix][iy][iz]; vv[1][3]=wwxz[ix][iy][iz];
vv[2][1]=wwyx[ix][iy][iz]; vv[2][2]=wwyy[ix][iy][iz]; vv[2][3]=wwyz[ix][iy][iz];
vv[3][1]=wwzx[ix][iy][iz]; vv[3][2]=wwzy[ix][iy][iz]; vv[3][3]=wwzz[ix][iy][iz];
vb[1][1]=wwxx[ix][iy][iz]; vb[1][2]=wwxy[ix][iy][iz]; vb[1][3]=wwxz[ix][iy][iz];
vb[2][1]=wwyx[ix][iy][iz]; vb[2][2]=wwyy[ix][iy][iz]; vb[2][3]=wwyz[ix][iy][iz];
vb[3][1]=wwzx[ix][iy][iz]; vb[3][2]=wwzy[ix][iy][iz]; vb[3][3]=wwzz[ix][iy][iz];
bv[1][1]=wwxx[ix][iy][iz]; bv[1][2]=wwxy[ix][iy][iz]; bv[1][3]=wwxz[ix][iy][iz];
bv[2][1]=wwyx[ix][iy][iz]; bv[2][2]=wwyy[ix][iy][iz]; bv[2][3]=wwyz[ix][iy][iz];
bv[3][1]=wwzx[ix][iy][iz]; bv[3][2]=wwzy[ix][iy][iz]; bv[3][3]=wwzz[ix][iy][iz];
bb[1][1]=wwxx[ix][iy][iz]; bb[1][2]=wwxy[ix][iy][iz]; bb[1][3]=wwxz[ix][iy][iz];
bb[2][1]=wwyx[ix][iy][iz]; bb[2][2]=wwyy[ix][iy][iz]; bb[2][3]=wwyz[ix][iy][iz];
bb[3][1]=wwzx[ix][iy][iz]; bb[3][2]=wwzy[ix][iy][iz]; bb[3][3]=wwzz[ix][iy][iz];
*/
// kraj na prisvojavaneto na lokalni promenlivi
for(int i=1;i<=3;i++)
{fv[i]=0.0;
fb[i]=0.0;} // nulirane na proizvodni
fv[1]= 2.*w*v[2];
fv[2]=-2.*w*v[1]; // Coriolis
for(int i=1;i<=3;i++)
{fv[i]+= Qalpha*b[i]-rn[i]*Q2*v[i];
fb[i]+=-Qalpha*v[i]-rn[i]*Q2*b[i];} // ba li gy kvo znachi
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
fv[i]+=(vv[i][j]+vv[i][j])*Q[j];
fb[i]+=(bv[i][j]-vb[i][j])*Q[j];
}
} // nelinejni chlenove
for(int i=1;i<=3;i++)
{fvl+=rn[i]*fv[i];
fbl+=rn[i]*fb[i];} // nadlyzhni chlenove
for(int i=1;i<=3;i++)
{fv[i]-=rn[i]*fvl;
fb[i]-=rn[i]*fbl;} // ortogonalizacija
for(int i=1;i<=3;i++)
{fv[i]+=2.0*rn[2]*v[1]*rn[i];} // srjazvane
fv[2]-=v[1];
fb[2]+=b[1]; // kraj na srqzvaneto; ednotipni clenove
for(int i=1;i<=3;i++)
{
printf("fv[%i]=%g\n",i,fv[i]);
printf("fb[%i]=%g\n",i,fb[i]);
}
// ------------------------------------------------------------------------------
// end Todor Method Area
}
int main(void)
{
//point(double Qx, double Qy, double Qz, double vx, double vy, double vz, double bx, double by, double bz)
point(0.0, 0.0, 0.65, -1.0, 1.0, 0.0, 1.0, 1.0, 0.0);
return 0;
}
|
#ifndef _SERVERPROXY_H_INCLUDED
#define _SERVERPROXY_H_INCLUDED
#include <Sensoria.h>
#include <SensoriaCore/Communicator.h>
//~ #include <SensoriaCore/Server.h>
class TransducerProxy;
class SensorProxy;
class ActuatorProxy;
class Stereotype;
class ServerProxy {
public:
char name[MAX_SERVER_NAME];
byte protocolVersion;
byte nFailures;
ServerProxy (SensoriaCommunicator* _comm, SensoriaAddress* address);
SensoriaCommunicator::SendResult sendcmd (const char *cmd, char*& reply);
boolean addTransducer (TransducerProxy *tpx);
TransducerProxy* getTransducer (const char *name) const;
SensorProxy* getSensor (const char *name) const;
boolean read (TransducerProxy& t);
boolean write (ActuatorProxy& a, Stereotype& st);
private:
SensoriaCommunicator *comm;
SensoriaAddress *address;
byte nTransducers;
uint16_t checksum;
TransducerProxy *transducers[MAX_TRANSDUCERS];
friend class SensoriaIterator;
friend class SensoriaClient;
};
#endif
|
#include "gsl_gsl_math.h"
#include "gsl_gsl_cblas.h"
#include "cblas_cblas.h"
void
cblas_srotg (float *a, float *b, float *c, float *s)
{
#define BASE float
#include "cblas_source_rotg.h"
#undef BASE
}
|
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "NGAP-IEs"
* found in "../support/ngap-r16.1.0/38413-g10.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _NGAP_CauseMisc_H_
#define _NGAP_CauseMisc_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeEnumerated.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum NGAP_CauseMisc {
NGAP_CauseMisc_control_processing_overload = 0,
NGAP_CauseMisc_not_enough_user_plane_processing_resources = 1,
NGAP_CauseMisc_hardware_failure = 2,
NGAP_CauseMisc_om_intervention = 3,
NGAP_CauseMisc_unknown_PLMN = 4,
NGAP_CauseMisc_unspecified = 5
/*
* Enumeration is extensible
*/
} e_NGAP_CauseMisc;
/* NGAP_CauseMisc */
typedef long NGAP_CauseMisc_t;
/* Implementation */
extern asn_per_constraints_t asn_PER_type_NGAP_CauseMisc_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_NGAP_CauseMisc;
extern const asn_INTEGER_specifics_t asn_SPC_CauseMisc_specs_1;
asn_struct_free_f CauseMisc_free;
asn_struct_print_f CauseMisc_print;
asn_constr_check_f CauseMisc_constraint;
ber_type_decoder_f CauseMisc_decode_ber;
der_type_encoder_f CauseMisc_encode_der;
xer_type_decoder_f CauseMisc_decode_xer;
xer_type_encoder_f CauseMisc_encode_xer;
oer_type_decoder_f CauseMisc_decode_oer;
oer_type_encoder_f CauseMisc_encode_oer;
per_type_decoder_f CauseMisc_decode_uper;
per_type_encoder_f CauseMisc_encode_uper;
per_type_decoder_f CauseMisc_decode_aper;
per_type_encoder_f CauseMisc_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _NGAP_CauseMisc_H_ */
#include <asn_internal.h>
|
#ifndef _PIT_C_
#define _PIT_C_
#include <stdint.h>
#include <stdbool.h>
extern bool pit_oneshot_done;
void prime_pit(uint32_t time);
void fire_pit();
void square_pit();
void oneshot_handler();
static inline bool is_oneshot_done()
{
return pit_oneshot_done;
}
#endif
|
static int
power_of_two(size_t n)
{
size_t k = 1;
while (1) {
if (n == k) return 1;
k *= 2;
if (n < k || k==0) break;
}
rb_raise(nary_eShapeError,"array size is not 2**n");
return 0;
}
static VALUE
wavelet_array_check(VALUE v1, int nd, size_t *size)
{
size_t n1, n2;
VALUE tmp;
narray_t *na;
GetNArray(v1,na);
if (na->ndim < nd) {
rb_raise(nary_eDimensionError,"ndim(=%d) should >= %d", na->ndim, nd);
}
switch(nd) {
case 2:
n1 = na->shape[na->ndim-2];
n2 = na->shape[na->ndim-1];
if (n1 != n2) {
rb_raise(nary_eShapeError,"not square 2d array");
}
power_of_two(n1);
power_of_two(n2);
*size = n2;
break;
case 1:
n2 = na->shape[na->ndim-1];
power_of_two(n2);
*size = n2;
break;
default:
rb_bug("invalid value for nd");
}
if (TEST_INPLACE(v1)) {
v1 = rb_funcall(cDF, rb_intern("cast"), 1, v1);
if (!RTEST(na_check_contiguous(v1))) {
v1 = na_copy(v1);
}
} else {
tmp = rb_narray_new(cDF, na->ndim, na->shape);
rb_funcall(tmp, rb_intern("store"), 1, v1);
v1 = tmp;
}
return v1;
}
|
/* tmpl-template-locator.c
*
* Copyright (C) 2016 Christian Hergert <chergert@redhat.com>
*
* This file is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This file 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 General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <glib/gi18n.h>
#include "tmpl-error.h"
#include "tmpl-template-locator.h"
typedef struct
{
GQueue *search_path;
} TmplTemplateLocatorPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (TmplTemplateLocator, tmpl_template_locator, G_TYPE_OBJECT)
static GInputStream *
tmpl_template_locator_locate_in_path (TmplTemplateLocator *self,
const gchar *path_base,
const gchar *path)
{
GInputStream *ret = NULL;
gchar *full_path;
g_assert (TMPL_IS_TEMPLATE_LOCATOR (self));
g_assert (path_base != NULL);
g_assert (path != NULL);
full_path = g_build_path (path_base, path, NULL);
if (g_str_has_prefix (full_path, "resource://"))
{
/*
* A mediocre attempt to prevent escapes using ../
*/
if (strstr (full_path, "..") == NULL)
ret = g_resources_open_stream (full_path + strlen ("resource://"), 0, NULL);
}
else
{
GFile *parent = g_file_new_for_path (path_base);
GFile *file = g_file_new_for_path (full_path);
gchar *relative;
/*
* If the path tries to escape the search path, using ../../ or
* something clever, we will get an invalid path here.
*/
if ((relative = g_file_get_relative_path (parent, file)))
{
g_free (relative);
ret = (GInputStream *)g_file_read (file, NULL, NULL);
}
g_object_unref (parent);
g_object_unref (file);
}
g_free (full_path);
return ret;
}
static GInputStream *
tmpl_template_locator_real_locate (TmplTemplateLocator *self,
const gchar *path,
GError **error)
{
TmplTemplateLocatorPrivate *priv = tmpl_template_locator_get_instance_private (self);
GInputStream *ret = NULL;
const GList *iter;
const GList *search_path;
g_assert (TMPL_IS_TEMPLATE_LOCATOR (self));
g_assert (path != NULL);
search_path = priv->search_path->head;
for (iter = search_path; ret == NULL && iter != NULL; iter = iter->next)
{
const gchar *path_base = iter->data;
ret = tmpl_template_locator_locate_in_path (self, path_base, path);
}
if (ret == NULL)
{
g_set_error (error,
TMPL_ERROR,
TMPL_ERROR_TEMPLATE_NOT_FOUND,
_("Failed to locate template \"%s\""),
path);
return NULL;
}
return ret;
}
static void
tmpl_template_locator_class_init (TmplTemplateLocatorClass *klass)
{
klass->locate = tmpl_template_locator_real_locate;
}
static void
tmpl_template_locator_init (TmplTemplateLocator *self)
{
TmplTemplateLocatorPrivate *priv = tmpl_template_locator_get_instance_private (self);
priv->search_path = g_queue_new ();
}
void
tmpl_template_locator_append_search_path (TmplTemplateLocator *self,
const gchar *path)
{
TmplTemplateLocatorPrivate *priv = tmpl_template_locator_get_instance_private (self);
g_return_if_fail (TMPL_IS_TEMPLATE_LOCATOR (self));
g_return_if_fail (path != NULL);
g_queue_push_tail (priv->search_path, g_strdup (path));
}
void
tmpl_template_locator_prepend_search_path (TmplTemplateLocator *self,
const gchar *path)
{
TmplTemplateLocatorPrivate *priv = tmpl_template_locator_get_instance_private (self);
g_return_if_fail (TMPL_IS_TEMPLATE_LOCATOR (self));
g_return_if_fail (path != NULL);
g_queue_push_head (priv->search_path, g_strdup (path));
}
/**
* tmpl_template_locator_get_search_path:
* @self: A #TmplTemplateLocator
*
* Gets the current search path used by the template locator.
*
* Returns: (transfer full): A %NULL-terminated array of strings.
*/
gchar **
tmpl_template_locator_get_search_path (TmplTemplateLocator *self)
{
TmplTemplateLocatorPrivate *priv = tmpl_template_locator_get_instance_private (self);
GPtrArray *ar;
const GList *iter;
g_return_val_if_fail (TMPL_IS_TEMPLATE_LOCATOR (self), NULL);
ar = g_ptr_array_new ();
for (iter = priv->search_path->head; iter != NULL; iter = iter->next)
{
const gchar *path = iter->data;
g_ptr_array_add (ar, g_strdup (path));
}
g_ptr_array_add (ar, NULL);
return (gchar **)g_ptr_array_free (ar, FALSE);
}
TmplTemplateLocator *
tmpl_template_locator_new (void)
{
return g_object_new (TMPL_TYPE_TEMPLATE_LOCATOR, NULL);
}
/**
* tmpl_template_locator_locate:
* @self: A #TmplTemplateLocator.
* @path: a relative path to the file
*
* This will resolve the relative path using the search paths found within
* the template loader.
*
* Returns: (transfer full): A #GInputStream or %NULL and @error is set.
*/
GInputStream *
tmpl_template_locator_locate (TmplTemplateLocator *self,
const gchar *path,
GError **error)
{
g_return_val_if_fail (TMPL_IS_TEMPLATE_LOCATOR (self), NULL);
g_return_val_if_fail (path != NULL, NULL);
return TMPL_TEMPLATE_LOCATOR_GET_CLASS (self)->locate (self, path, error);
}
|
/*
* Copyright 2011 Anand Bose <anandbose@in.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef BOOKMARKSWINDOW_H
#define BOOKMARKSWINDOW_H
#include "infowidget.h"
#include <QtGui/QTreeWidget>
#include <QtGui/QPushButton>
#include <QtGui/QHBoxLayout>
#include <QtGui/QVBoxLayout>
#include <QtCore/QFile>
#include "bookmark.h"
#include "addbookmarkwindow.h"
class BookmarksWindow : public InfoWidget
{
Q_OBJECT
public:
BookmarksWindow();
void addBookmark(QString title, QString url);
Bookmark* getBookmarkAt(int index);
bool saveBookmarksToFile(QFile &file);
bool loadBookmarksFromFile(QFile &file);
public slots:
void addBookmark(Bookmark *bookmark);
private:
void setupConnections();
AddBookmarkWindow *addBookmarkWindow;
QTreeWidget *bookmarksTreeWidget;
QPushButton *addButton;
QPushButton *closeButton;
QPushButton *loadButton;
QPushButton *saveButton;
QPushButton *removeButton;
QPushButton *openButton;
QHBoxLayout *buttonsLayout;
QVBoxLayout *mainLayout;
private slots:
void on_addButton_clicked();
void on_removeButton_clicked();
void on_closeButton_clicked();
void on_loadButton_clicked();
void on_saveButton_clicked();
void on_openButton_clicked();
void addBookmarkItem(Bookmark *bookmark);
signals:
void openUrlRequest(QString url);
};
#endif
|
/**
* Copyright 2010-2015 Cenan Ozen <betik@cenanozen.com>
* This file is part of Betik.
*
* Betik is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Betik 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 Betik. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
char* duplicate_string(char* str)
{
assert(str);
char* result;
result = (char*)malloc(strlen(str) + 1);
strcpy(result, str);
return result;
}
#define STACK_SIZE 1024
btk_stack_t* create_stack(unsigned item_length)
{
assert(item_length != 0);
btk_stack_t* s = (btk_stack_t*)malloc(sizeof(btk_stack_t));
assert(s);
s->top = 0;
s->buffer = malloc(STACK_SIZE * item_length);
assert(s->buffer != NULL);
s->item_length = item_length;
return s;
}
void destroy_stack(btk_stack_t* s)
{
assert(s);
assert(s->buffer);
free(s->buffer);
memset(s, 0, sizeof(btk_stack_t));
free(s);
}
void stack_push(btk_stack_t* s, void* item)
{
assert(s);
assert(s->buffer);
assert(item);
assert(s->top < 1024);
unsigned char* ptr = (unsigned char*)s->buffer;
ptr += s->item_length * s->top;
memcpy(ptr, item, s->item_length);
s->top++;
}
const void* stack_pop(btk_stack_t* s)
{
assert(s);
assert(s->buffer);
assert(s->top > 0);
unsigned char* ptr = (unsigned char*)s->buffer;
s->top--;
ptr += s->item_length * s->top;
return ptr;
}
int stack_get_count(btk_stack_t* s)
{
assert(s);
return s->top;
}
list_t* create_list(void)
{
list_t* list;
list = (list_t*)malloc(sizeof(list_t));
list->item_count = 0;
list->head = NULL;
return list;
}
void destroy_list(list_t* list)
{
listitem_t* item;
listitem_t* nitem;
item = list->head;
while (item != NULL) {
nitem = item->next;
free(item);
list->item_count--;
item = nitem;
}
list->item_count = 0;
free(list);
}
void list_insert(list_t* list, void* data)
{
listitem_t* item;
listitem_t* new_item;
new_item = (listitem_t*)malloc(sizeof(listitem_t));
new_item->next = NULL;
new_item->prev = NULL;
new_item->data = data;
if (list->item_count == 0) {
list->head = new_item;
list->item_count = 1;
return;
}
// find last item
for (item = list->head; item->next != NULL; item = item->next)
; // nothing
item->next = new_item;
new_item->prev = item;
list->item_count++;
}
static void _remove_item(list_t* list, listitem_t* item)
{
if (item == list->head) {
list->head = item->next;
}
if (item->prev != NULL) {
item->prev->next = item->next;
}
if (item->next != NULL) {
item->next->prev = item->prev;
}
free(item);
list->item_count--;
}
void list_remove_by_index(list_t* list, int item_index)
{
int i = 0;
listitem_t* item;
item = list->head;
while (item != NULL) {
if (i == item_index) {
_remove_item(list, item);
return;
}
item = item->next;
i++;
}
fprintf(stderr, "list_remove_by_index, cant find item in the list");
exit(1);
}
void list_remove_by_data(list_t* list, void* data)
{
listitem_t* item;
item = list->head;
while (item != NULL) {
if (item->data == data) {
_remove_item(list, item);
return;
}
item = item->next;
}
fprintf(stderr, "list_remove_by_data, cant find item in the list");
exit(1);
}
void* list_get_item(list_t* list, int item_index)
{
int i = 0;
listitem_t* item;
item = list->head;
while (item != NULL) {
if (i == item_index) {
return item->data;
}
i++;
item = item->next;
}
fprintf(stderr, "list_get_item, can not find item in the list");
return NULL;
}
void list_set_item(list_t* list, int item_index, void* data)
{
int i = 0;
listitem_t* item;
item = list->head;
while (item != NULL) {
if (i == item_index) {
item->data = data;
}
i++;
item = item->next;
}
}
int list_get_item_count(list_t* list)
{
return list->item_count;
}
// unit tests {{{
#ifdef UNITTESTS
#include "seatest.h"
static void btk_stack_test()
{
int a = 10, b = 20, c = 30;
btk_stack_t* s = create_stack(sizeof(int));
stack_push(s, &a);
stack_push(s, &b);
stack_push(s, &c);
assert_int_equal(30, *(int*)stack_pop(s));
assert_int_equal(20, *(int*)stack_pop(s));
assert_int_equal(10, *(int*)stack_pop(s));
destroy_stack(s);
}
list_t* create_list();
void destroy_list(list_t* list);
void list_insert(list_t* list, void* data);
void list_remove_by_index(list_t* list, int item_index);
void list_remove_by_data(list_t* list, void* data);
void* list_get_item(list_t* list, int item_index);
int list_get_item_count(list_t* list);
static void list_test()
{
list_t* l = create_list();
list_insert(l, (void*)10);
list_insert(l, (void*)20);
list_insert(l, (void*)30);
list_insert(l, (void*)40);
assert_int_equal(10, (int)list_get_item(l, 0));
assert_int_equal(20, (int)list_get_item(l, 1));
assert_int_equal(30, (int)list_get_item(l, 2));
assert_int_equal(40, (int)list_get_item(l, 3));
assert_int_equal(4, list_get_item_count(l));
list_remove_by_index(l, 1);
assert_int_equal(3, list_get_item_count(l));
assert_int_equal(30, (int)list_get_item(l, 1));
list_remove_by_data(l, (void*)10);
assert_int_equal(30, (int)list_get_item(l, 0));
assert_int_equal(2, list_get_item_count(l));
int i;
for (i = 0; i < 10000; i++) {
list_insert(l, (void*)i);
}
assert_int_equal(10002, list_get_item_count(l));
for (i = 0; i < 10000; i++) {
list_remove_by_data(l, (void*)i);
}
assert_int_equal(2, list_get_item_count(l));
destroy_list(l);
}
void common_lib_test_fixture(void)
{
test_fixture_start();
run_test(btk_stack_test);
run_test(list_test);
test_fixture_end();
}
#endif // UNITTESTS
// }}}
|
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class MyNewString */
#ifndef _Included_MyNewString
#define _Included_MyNewString
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: MyNewString
* Method: getString
* Signature: ([CI)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_MyNewString_getString
(JNIEnv *, jclass, jcharArray, jint);
#ifdef __cplusplus
}
#endif
#endif
|
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "common.h"
#include "gfx.h"
#include "conf.h"
//tokens must be array or pre-allocated pointer
int conf_parse(const char* data, conftok_t* token){
int len;
len = data[0];
token->townname = calloc(len+1, 1); //1 = '\0'
sprintf(token->townname, "%.*s", len, &data[1]);
token->mediatype_val = data[1+len];
return 0;
}
//data must not be a pointer to an array
int conf_gen(char** data, conftok_t* token){
//str format: (length of townname (1 bytes))townname(mediatype_val (1 byte))
*data = calloc(1+strlen(token->townname+1+1), 1);
sprintf(*data, "%c%s%c", strlen(token->townname), token->townname, token->mediatype_val);
return 0;
}
|
/*
* This file is part of game.
*
* game is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* game 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 game. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifndef SETTINGS_H
#define SETTINGS_H
#include "logger.h"
#include <stdbool.h>
struct program_settings{
bool server;
bool client;
bool daemon;
const char * language;
const char * resource_path;
enum log_priority log_priority;
};
int load_program_settings(struct program_settings * settings, int arg_count, char * const args[]);
void log_program_settings(const struct program_settings * settings);
#endif
|
#include <dlfree/dlfree.h>
#include <dlfree/gxp.h>
#include <stdio.h>
#include <stdlib.h>
#include "collective.h"
static void
myabort(char** argv, const char *msg){
fprintf(stderr, "%s\n", msg);
fprintf(stderr, "usage: %s <xml> <msg size[MB]> [<iter:10> [<seed:1>]]\n", argv[0]);
exit(1);
}
static void
parseopt(int argc, char** argv, char *filename, float *size, int *iter, int *seed){
*iter = 10;
*seed = 1;
if(argc < 3)
myabort(argv, "too few arguments");
if(sscanf(argv[1], "%s", filename) != 1)
myabort(argv, "invalid xml-filename");
if(sscanf(argv[2], "%f", size) != 1)
myabort(argv, "invalid message size value");
if(argc > 3){
if(sscanf(argv[3], "%d", iter) != 1)
myabort(argv, "invalid iteration value");
}
if(argc > 4){
if(sscanf(argv[4], "%d", seed) != 1)
myabort(argv, "invalid seed value");
}
}
int
main(int argc, char** argv){
gxp_man_t gxp;
dlfree_comm_node_t comm_node;
char filename[100];
float size;
int iter, seed;
parseopt(argc, argv, filename, &size, &iter, &seed);
/* initialization */
gxp = gxp_man_create();
comm_node = dlfree_comm_node_create(gxp_man_peer_id(gxp));
gxp_man_init(gxp);
/* connect in ring */
gxp_man_connect_ring(gxp, comm_node);
/* compute dlfree routing table */
gxp_man_compute_rt(gxp, comm_node, filename, GXP_RT_TYPE_UPDOWN_DFS, seed);
/* do some communication */
send_all2all(gxp, comm_node, 1024 * 1024 * size, iter);
/* finalization */
gxp_man_sync(gxp);
dlfree_comm_node_destroy(comm_node);
gxp_man_destroy(gxp);
return 0;
}
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[2];
void *t0(void *arg){
label_1:;
atomic_store_explicit(&vars[0], 2, memory_order_seq_cst);
atomic_store_explicit(&vars[1], 1, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
atomic_store_explicit(&vars[1], 2, memory_order_seq_cst);
int v2_r3 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v4_r4 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v5_cmpeq = (v4_r4 == v4_r4);
if (v5_cmpeq) goto lbl_LC00; else goto lbl_LC00;
lbl_LC00:;
atomic_store_explicit(&vars[0], 1, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
atomic_init(&vars[1], 0);
atomic_init(&vars[0], 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
int v6 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v7 = (v6 == 2);
int v8 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v9 = (v8 == 2);
int v10_conj = v7 & v9;
if (v10_conj == 1) assert(0);
return 0;
}
|
/*
* Copyright 2014 Christopher Nilsen
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef LAPACK_H
#define LAPACK_H
void dgeev_(char *jobvl, char *jobvr, int *n, double *a, int *lda, double *wr,
double *wi, double *vl, int *ldvl, double *vr, int *ldvr,
double *work, int *lwork, int *info);
void dlasrt_(char *id, int *n, double *x, int *info);
void dsygv_(int *itype, char *jobz, char *uplo, int *n, double *a, int *lda,
double *b, int *ldb, double *w, double *work, int *lwork,
int *info);
#endif
|
/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <gnutls/abstract.h>
#include <gnutls/gnutls.h>
#include "libdnssec/binary.h"
#include "libdnssec/error.h"
#include "libdnssec/key/algorithm.h"
#include "libdnssec/key/convert.h"
#include "libdnssec/key/dnskey.h"
#include "libdnssec/key/internal.h"
#include "libdnssec/key/privkey.h"
#include "libdnssec/shared/shared.h"
#include "libdnssec/shared/binary_wire.h"
/* -- internal functions --------------------------------------------------- */
/*!
* Check if the algorithm number is valid for given DNSKEY.
*/
static bool valid_algorithm(dnssec_key_t *key, gnutls_privkey_t privkey)
{
uint8_t current = dnssec_key_get_algorithm(key);
int gnu_algorithm = gnutls_privkey_get_pk_algorithm(privkey, NULL);
return (gnu_algorithm == algorithm_to_gnutls(current));
}
/*!
* Create GnuTLS public key from private key.
*/
static int public_from_private(gnutls_privkey_t privkey, gnutls_pubkey_t *pubkey)
{
assert(privkey);
assert(pubkey);
gnutls_pubkey_t new_key = NULL;
int result = gnutls_pubkey_init(&new_key);
if (result != GNUTLS_E_SUCCESS) {
return DNSSEC_ENOMEM;
}
result = gnutls_pubkey_import_privkey(new_key, privkey, 0, 0);
if (result != GNUTLS_E_SUCCESS) {
gnutls_pubkey_deinit(new_key);
return DNSSEC_KEY_IMPORT_ERROR;
}
*pubkey = new_key;
return DNSSEC_EOK;
}
/*!
* Create public key (GnuTLS and DNSKEY RDATA) from a private key.
*/
static int create_public_key(gnutls_privkey_t privkey,
gnutls_pubkey_t *pubkey_ptr,
dnssec_binary_t *rdata)
{
assert(privkey);
assert(pubkey_ptr);
assert(rdata);
// crypto public key
gnutls_pubkey_t pubkey = NULL;
int result = public_from_private(privkey, &pubkey);
if (result != DNSSEC_EOK) {
return result;
}
// dnssec public key
_cleanup_binary_ dnssec_binary_t rdata_pubkey = { 0 };
result = convert_pubkey_to_dnskey(pubkey, &rdata_pubkey);
if (result != DNSSEC_EOK) {
gnutls_pubkey_deinit(pubkey);
return result;
}
size_t rdata_size = DNSKEY_RDATA_OFFSET_PUBKEY + rdata_pubkey.size;
result = dnssec_binary_resize(rdata, rdata_size);
if (result != DNSSEC_EOK) {
gnutls_pubkey_deinit(pubkey);
return result;
}
// updated RDATA
wire_ctx_t wire = binary_init(rdata);
wire_ctx_set_offset(&wire, DNSKEY_RDATA_OFFSET_PUBKEY);
binary_write(&wire, &rdata_pubkey);
assert(wire_ctx_offset(&wire) == rdata->size);
*pubkey_ptr = pubkey;
return DNSSEC_EOK;
}
/* -- internal API --------------------------------------------------------- */
/*!
* Load a private key into a DNSSEC key, create a public part if necessary.
*/
int key_set_private_key(dnssec_key_t *key, gnutls_privkey_t privkey)
{
assert(key);
assert(privkey);
assert(key->private_key == NULL);
if (!valid_algorithm(key, privkey)) {
return DNSSEC_INVALID_KEY_ALGORITHM;
}
if (!key->public_key) {
int r = create_public_key(privkey, &key->public_key, &key->rdata);
if (r != DNSSEC_EOK) {
return r;
}
}
key->private_key = privkey;
return DNSSEC_EOK;
}
|
#include "motor.h"
#include "pwm.h"
void MOTOR_Init(){
GPIO_InitTypeDef GPIO_InitStruct;
// GPIO Ports Clock Enable
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
// Configure GPIO pin : PB6 PB7 PB3
GPIO_InitStruct.Pin = MOTOR_R_IN1|MOTOR_R_IN2|MOTOR_L_IN1;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
// Configure GPIO pins : PA15
GPIO_InitStruct.Pin = MOTOR_L_IN2;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
_motor_sense_l = FREE;
_motor_sense_r = FREE;
}
void set_sense(motor_t motor, motor_sense_t sense){
if (motor == MOTOR_R){
if(sense == FORWARD){
HAL_GPIO_WritePin(GPIOB, MOTOR_R_IN1, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, MOTOR_R_IN2, GPIO_PIN_SET);
}
else if (sense == BACKWARD){
HAL_GPIO_WritePin(GPIOB, MOTOR_R_IN1, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOB, MOTOR_R_IN2, GPIO_PIN_RESET);
}
else if (sense == BRAKE){
HAL_GPIO_WritePin(GPIOB, MOTOR_R_IN1, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOB, MOTOR_R_IN2, GPIO_PIN_SET);
}
else if (sense == FREE){
HAL_GPIO_WritePin(GPIOB, MOTOR_R_IN1, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, MOTOR_R_IN2, GPIO_PIN_RESET);
}
}
else if (motor == MOTOR_L){
if(sense == FORWARD){
HAL_GPIO_WritePin(GPIOB, MOTOR_L_IN1, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA, MOTOR_L_IN2, GPIO_PIN_RESET);
}
else if (sense == BACKWARD){
HAL_GPIO_WritePin(GPIOB, MOTOR_L_IN1, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, MOTOR_L_IN2, GPIO_PIN_SET);
}
else if (sense == BRAKE){
HAL_GPIO_WritePin(GPIOB, MOTOR_L_IN1, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA, MOTOR_L_IN2, GPIO_PIN_SET);
}
else if (sense == FREE){
HAL_GPIO_WritePin(GPIOB, MOTOR_L_IN1, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, MOTOR_L_IN2, GPIO_PIN_RESET);
}
}
}
void set_speed(motor_t motor, int16_t speed){
if (speed > 0){
set_sense(motor, FORWARD);
}
else {
set_sense(motor, BACKWARD);
speed *= -1;
}
if(speed > 1000) speed = 1000;
if(motor == MOTOR_L){
set_pwm(PWM_2, speed);
}
else if (motor == MOTOR_R){
set_pwm(PWM_1, speed);
}
}
void update_speed(motor_t motor){
if (motor == MOTOR_R){
_motor_speed_r = get_encoder_delta(ENCODER_R); // /sample time 1ms
}
else if (motor == MOTOR_L){
_motor_speed_l = get_encoder_delta(ENCODER_L);
}
}
int32_t get_speed(motor_t motor){
if (motor == MOTOR_R){
return _motor_speed_r;
}
else if (motor == MOTOR_L){
return _motor_speed_l;
}
}
|
#pragma once
#include <sys/cdefs.h>
#include <stddef.h>
__BEGIN_DECLS
struct lconv {
char *currency_symbol;
char *decimal_point;
char frac_digits;
char *grouping;
char *int_curr_symbol;
char int_frac_digits;
char int_n_cs_precedes;
char int_n_sep_by_space;
char int_n_sign_posn;
char int_p_cs_precedes;
char int_p_sep_by_space;
char int_p_sign_posn;
char *mon_decimal_point;
char *mon_grouping;
char *mon_thousands_sep;
char *negative_sign;
char n_cs_precedes;
char n_sep_by_space;
char n_sign_posn;
char *positive_sign;
char p_cs_precedes;
char p_sep_by_space;
char p_sign_posn;
char *thousands_sep;
};
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
#define LC_MESSAGES 3
#define LC_MONETARY 4
#define LC_NUMERIC 5
#define LC_TIME 6
#define LC_COLLATE_MASK (1<<0)
#define LC_CTYPE_MASK (1<<1)
#define LC_MESSAGES_MASK (1<<2)
#define LC_MONETARY_MASK (1<<3)
#define LC_NUMERIC_MASK (1<<4)
#define LC_TIME_MASK (1<<5)
#define LC_ALL_MASK \
(LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \
LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
struct __locale_struct {
};
typedef struct __locale_struct *locale_t;
locale_t duplocale(locale_t);
void freelocale(locale_t);
struct lconv *localeconv(void);
locale_t newlocale(int, char const *, locale_t);
char *setlocale(int, char const *);
locale_t uselocale (locale_t);
__END_DECLS
|
/*
Copyright (C) 2012-2014 AC SOFTWARE SP. Z O.O.
(p.zygmunt@acsoftware.pl)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class Order;
@interface OrderItem : NSManagedObject
@property (nonatomic, retain) NSNumber * discount;
@property (nonatomic, retain) NSNumber * discountpercent;
@property (nonatomic, retain) NSNumber * individualprice;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSNumber * price;
@property (nonatomic, retain) NSNumber * pricenet;
@property (nonatomic, retain) NSNumber * qty;
@property (nonatomic, retain) NSString * shortcut;
@property (nonatomic, retain) NSNumber * totalgross;
@property (nonatomic, retain) NSNumber * totalnet;
@property (nonatomic, retain) NSString * unit;
@property (nonatomic, retain) NSString * vatrate;
@property (nonatomic, retain) NSNumber * vatvalue;
@property (nonatomic, retain) Order *order;
@end
|
/*
* UI.h
*
* Created on: May 10, 2014
* Author: seregia
*/
#ifndef PAGEINDEX_H_
#define PAGEINDEX_H_
#include <stdint.h>
#include <U8glib.h>
#include "PageBase.h"
#include "Utils.h"
class PageIndex : public PageBase
{
public:
PageIndex(IO& io, U8GLIB_PCF8812& u8gl);
virtual void DrawImpl(uint8_t unDrawIdx);
void Loop();
private:
void HandleButtons(KEY eKey);
uint32_t m_unLongPressTime;
uint8_t m_unCountOfIterations;
};
extern U8GLIB_PCF8812 u8g;
#endif /* PAGEINDEX_H_ */
|
/*
* (C) 2003-2006 Gabest
* (C) 2006-2014 see Authors.txt
*
* This file is part of MPC-HC.
*
* MPC-HC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* MPC-HC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "CMPCThemePlayerBar.h"
#include "PlayerCaptureDialog.h"
// CPlayerCaptureBar
class CPlayerCaptureBar : public CMPCThemePlayerBar
{
DECLARE_DYNAMIC(CPlayerCaptureBar)
public:
CPlayerCaptureDialog m_capdlg;
CPlayerCaptureBar(CMainFrame* pMainFrame);
virtual ~CPlayerCaptureBar();
BOOL Create(CWnd* pParentWnd, UINT defDockBarID);
virtual void ReloadTranslatableResources();
void InitControls();
protected:
virtual BOOL PreTranslateMessage(MSG* pMsg);
DECLARE_MESSAGE_MAP()
};
|
/**
* @author Michele Tomaiuolo - http://www.ce.unipr.it/people/tomamic
* @license This software is free - http://www.gnu.org/licenses/gpl.html
*/
#ifndef POLYGON_H
#define POLYGON_H
#include "point.h"
#include <vector>
#include <iostream>
using namespace std;
class Polygon
{
public:
Polygon();
~Polygon();
float perimeter();
void read(istream& in);
void write(ostream& out);
private:
vector<Point*> points;
};
#endif // POLYGON_H
|
/*
This file is part of AutoQuad.
AutoQuad is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
AutoQuad 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 AutoQuad. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2011-2014 Bill Nesbitt
*/
#ifndef _compass_h
#define _compass_h
extern float compassNormalize(float heading);
extern float compassDifference(float a, float b);
#endif
|
/*
This file is part of Mac Eve Tools.
Mac Eve Tools is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mac Eve Tools is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mac Eve Tools. If not, see <http://www.gnu.org/licenses/>.
Copyright Matt Tyson, 2009.
*/
#import <Cocoa/Cocoa.h>
#include "macros.h"
/*return a roman numeral string for a number. eg @"3" returns @"III" */
NSString* romanForString(NSString *value);
NSString* romanForInteger(NSInteger value);
/*
these are to convert strings such as "memory" into integers for storage. see
macros.h for valid values
*/
NSInteger attrCodeForString(NSString *str);
NSString* strForAttrCode(NSInteger code);
NSInteger attrCodeForDBInt(NSInteger dbcode);
BOOL createDirectory(NSString *path);
/*the skill points required for a particular level*/
NSInteger skillPointsForLevel(NSInteger skillLevel, NSInteger skillRank);
/*the total skill points up to a particular level*/
NSInteger totalSkillPointsForLevel(NSInteger skillLevel, NSInteger skillRank);
/*given the number of seconds, return a string describing how long it will take to train*/
enum TrainingTimeFields
{
TTF_Days = (1 << 1),
TTF_Hours = (1 << 2),
TTF_Minutes = (1 << 3),
TTF_Seconds = (1 << 4),
TTF_All = 0xFFFFFFFF
};
NSString* stringTrainingTime2(NSInteger trainingTime , enum TrainingTimeFields ttf);
NSString* stringTrainingTime(NSInteger trainingTime);
CGFloat skillPercentCompleted(NSInteger startingPoints, NSInteger finishingPoints, NSInteger currentPoints);
NSString* sqlite3_column_nsstr(void *stmt, int col);
NSString* languageForId(enum DatabaseLanguage lang);
const char* langCodeForId(enum DatabaseLanguage lang);
|
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
printf("In exitTest . . .\n");
exit(1);
return 0;
}
|
// wake.h - originally written and placed in the public domain by Wei Dai
/// \file wake.h
/// \brief Classes for WAKE stream cipher
#ifndef CRYPTOPP_WAKE_H
#define CRYPTOPP_WAKE_H
#include "seckey.h"
#include "secblock.h"
#include "strciphr.h"
NAMESPACE_BEGIN(CryptoPP)
/// \class WAKE_OFB_Info
/// \brief WAKE stream cipher information
/// \tparam B Endianness of the stream cipher
/// \since Crypto++ 1.0
template <class B = BigEndian>
struct WAKE_OFB_Info : public FixedKeyLength<32>
{
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";}
};
class CRYPTOPP_NO_VTABLE WAKE_Base
{
protected:
word32 M(word32 x, word32 y);
void GenKey(word32 k0, word32 k1, word32 k2, word32 k3);
word32 t[257];
word32 r3, r4, r5, r6;
};
/// \class WAKE_Policy
/// \brief WAKE stream cipher operation
/// \tparam B Endianness of the stream cipher
/// \since Crypto++ 1.0
template <class B = BigEndian>
class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy<word32, 1, 64>, protected WAKE_Base
{
protected:
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
// OFB
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
bool CipherIsRandomAccess() const {return false;}
};
/// \class WAKE_OFB
/// \brief WAKE stream cipher
/// \tparam B Endianness of the stream cipher
/// \since Crypto++ 1.0
template <class B = BigEndian>
struct WAKE_OFB : public WAKE_OFB_Info<B>, public SymmetricCipherDocumentation
{
typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, AdditiveCipherTemplate<> >, WAKE_OFB_Info<B> > Encryption;
typedef Encryption Decryption;
};
/*
template <class B = BigEndian>
class WAKE_ROFB_Policy : public WAKE_Policy<B>
{
protected:
void Iterate(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount);
};
template <class B = BigEndian>
struct WAKE_ROFB : public WAKE_Info<B>
{
typedef SymmetricCipherTemplate<ConcretePolicyHolder<AdditiveCipherTemplate<>, WAKE_ROFB_Policy<B> > > Encryption;
typedef Encryption Decryption;
};
*/
NAMESPACE_END
#endif
|
//=============================================================================
// Copyright © 2015 Point Grey Research, Inc. All Rights Reserved.
//
// This software is the confidential and proprietary information of
// Point Grey Research, Inc. ("Confidential Information"). You shall not
// disclose such Confidential Information and shall use it only in
// accordance with the terms of the "License Agreement" that you
// entered into with PGR in connection with this software.
//
// UNLESS OTHERWISE SET OUT IN THE LICENSE AGREEMENT, THIS SOFTWARE IS
// PROVIDED ON AN “AS-IS” BASIS AND POINT GREY RESEARCH INC. MAKES NO
// REPRESENTATIONS OR WARRANTIES ABOUT THE SOFTWARE, EITHER EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OR
// CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
// NON-INFRINGEMENT. POINT GREY RESEARCH INC. SHALL NOT BE LIABLE FOR ANY
// DAMAGES, INCLUDING BUT NOT LIMITED TO ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR ANY LOSS OF PROFITS,
// REVENUE, DATA OR DATA USE, ARISING OUT OF OR IN CONNECTION WITH THIS
// SOFTWARE OR OTHERWISE SUFFERED BY YOU AS A RESULT OF USING, MODIFYING
// OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
//=============================================================================
#ifndef PGR_SPINNAKER_CAMERA_PTR_H
#define PGR_SPINNAKER_CAMERA_PTR_H
#include "SpinnakerPlatform.h"
#include "BasePtr.h"
#include "Camera.h"
namespace Spinnaker
{
/**
* @defgroup SpinnakerClasses Spinnaker Classes
*/
/*@{*/
/**
* @defgroup CameraPtr_h CameraPtr Class
*/
/*@{*/
/**
* @brief A reference tracked pointer to a camera object.
*/
class SPINNAKER_API CameraPtr : public BasePtr<Camera,CameraBase>
{
public:
//! Default constructor.
CameraPtr() throw()
: BasePtr<Camera,CameraBase>()
{
}
//! Default constructor.
CameraPtr(const int /*nMustBeNull*/) throw()
: BasePtr<Camera, CameraBase>()
{
}
//! Virtual destructor.
virtual ~CameraPtr(void){};
//! Assignment operator.
virtual CameraPtr& operator=(const int nMustBeNull){ return dynamic_cast<CameraPtr&>(BasePtr<Camera, CameraBase>::operator=(nMustBeNull)); };
};
}
#endif //PGR_SPINNAKER_CAMERA_PTR_H |
/*
* Copyright (c) 2016 Maxime Ripard. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*/
#ifndef _CCU_MP_H_
#define _CCU_MP_H_
#include <linux/clk-provider.h>
#include "ccu_common.h"
#include "ccu_div.h"
#include "ccu_mult.h"
#include "ccu_mux.h"
/*
* struct ccu_mp - Definition of an M-P clock
*
* Clocks based on the formula parent >> P / M
*/
struct ccu_mp
{
u32 enable;
struct _ccu_div m;
struct _ccu_div p;
struct ccu_mux_internal mux;
struct ccu_common common;
};
#define SUNXI_CCU_MP_WITH_MUX_GATE(_struct, _name, _parents, _reg, \
_mshift, _mwidth, \
_pshift, _pwidth, \
_muxshift, _muxwidth, \
_gate, _flags) \
struct ccu_mp _struct = { \
.enable = _gate, \
.m = _SUNXI_CCU_DIV(_mshift, _mwidth), \
.p = _SUNXI_CCU_DIV(_pshift, _pwidth), \
.mux = _SUNXI_CCU_MUX(_muxshift, _muxwidth), \
.common = { \
.reg = _reg, \
.hw.init = CLK_HW_INIT_PARENTS(_name, \
_parents, \
&ccu_mp_ops, \
_flags), \
} \
}
#define SUNXI_CCU_MP_WITH_MUX(_struct, _name, _parents, _reg, \
_mshift, _mwidth, \
_pshift, _pwidth, \
_muxshift, _muxwidth, \
_flags) \
SUNXI_CCU_MP_WITH_MUX_GATE(_struct, _name, _parents, _reg, \
_mshift, _mwidth, \
_pshift, _pwidth, \
_muxshift, _muxwidth, \
0, _flags)
static inline struct ccu_mp *hw_to_ccu_mp(struct clk_hw *hw)
{
struct ccu_common *common = hw_to_ccu_common(hw);
return container_of(common, struct ccu_mp, common);
}
extern const struct clk_ops ccu_mp_ops;
#endif /* _CCU_MP_H_ */
|
/* vsprintf with automatic memory allocation.
Copyright (C) 2002-2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2, 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
#ifndef _VASNPRINTF_H
#define _VASNPRINTF_H
/* Get va_list. */
#include <stdarg.h>
/* Get size_t. */
#include <stddef.h>
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(Spec) /* empty */
# endif
/* The __-protected variants of `format' and `printf' attributes
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Write formatted output to a string dynamically allocated with malloc().
You can pass a preallocated buffer for the result in RESULTBUF and its
size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
If successful, return the address of the string (this may be = RESULTBUF
if no dynamic memory allocation was necessary) and set *LENGTHP to the
number of resulting bytes, excluding the trailing NUL. Upon error, set
errno and return NULL.
When dynamic memory allocation occurs, the preallocated buffer is left
alone (with possibly modified contents). This makes it possible to use
a statically allocated or stack-allocated buffer, like this:
char buf[100];
size_t len = sizeof (buf);
char *output = vasnprintf (buf, &len, format, args);
if (output == NULL)
... error handling ...;
else
{
... use the output string ...;
if (output != buf)
free (output);
}
*/
extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
__attribute__ ((__format__ (__printf__, 3, 0)));
#ifdef __cplusplus
}
#endif
#endif /* _VASNPRINTF_H */
|
#include <stdio.h>
#define START_NUM 2
typedef unsigned long long Big;
Big get_factor(Big num)
{
Big cur;
for (cur = 2; cur < num; ++cur)
if (num % cur == 0)
return cur;
return 0;
}
int main()
{
Big num = 6321246989923;
if (Big factor = get_factor(num))
{
printf("%I64u is not a prime number. Factorization:\n", num);
printf("%I64u\n", factor);
factor = num;
do
factor = get_factor(factor);
while (get_factor(factor));
}
return 0;
}
|
/*
* Copyright (C) 2003-2017 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat 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 WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WEECHAT_ALIAS_INFO_H
#define WEECHAT_ALIAS_INFO_H 1
extern void alias_info_init ();
#endif /* WEECHAT_ALIAS_INFO_H */
|
#ifndef _FORMAL_PARAMETER_DATAMODEL_H_
#define _FORMAL_PARAMETER_DATAMODEL_H_
//TO_BE_EXPORTED
#include "bOS/bOS.h"
#include "bOS/bOSStringUtils.h"
using namespace bOS::CoreString;
#include "bOS/bOSXMLNode.h"
#include "bOS/bOSXMLObject.h"
#include "bOS/bOSStringUtils.h"
using namespace bOS::CoreString;
#include "CriteriaCommonDefines.h"
#include "bOS/bOSCollectionEntry.h"
namespace DataManager
{
namespace Panorama
{
namespace Common
{
class ENGINE_API FormalParameter : public bOS::XML::Data::XMLObject,
public bOS::Collections::CollectionEntry
{
public:
FormalParameter();
FormalParameter(const String& sName, const String& sValue);
FormalParameter(bOS::XML::XMLNode* node);
virtual ~FormalParameter();
//XMLObject
virtual void init();
bool parse(bOS::XML::XMLAttribute*);
bool parse(bOS::XML::XMLNode*);
bOS::XML::XMLNode* getXMLNode(unsigned int iHow);
bool isValid(){return true;}
//CollectionEntry
//TODO: Sviluppare il metodo.
bool equalTo(bOS::Collections::CollectionEntry*);
String& getName() { return sName;}
String& getValue() { return sValue;}
String& getType() { return sType;}
String& getBind() { return sBind;}
bool isMandatory() { return bMandatory;}
void setName(const String& Value) {sName=Value;}
void setValue(const String& Value) { sValue=Value;}
void setType(const String& Value) { sType=Value;}
void setXMLType();
void setMandatory() {bMandatory = true;}
void setNoMandatory() { bMandatory=false;}
void setBind(const String& Value) { sBind = Value;}
private:
String sName;
String sValue;
String sType;
String sBind;
bool bMandatory;
};
class ENGINE_API XMLFormalParameter
{
public:
static String MAIN_NODE;
static String NAME_ATTRIBUTE;
static String TYPE_ATTRIBUTE;
static String MANDATORY_ATTRIBUTE;
static String VALUE_NODE;
static String BIND_NODE;
static String NONE_TYPE;
static String NUMBER_TYPE;
static String STRING_TYPE;
static String XML_TYPE;
friend class FormalParameter;
};
}
}
}
#endif //_FORMAL_PARAMETER_DATAMODEL_H_
|
/*
Copyright (c) 2013 James McLean
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef CAMERADEMO_H
#define CAMERADEMO_H
#include <QMainWindow>
#include <QMessageBox>
#include <QString>
#include <v4l2.h>
namespace Ui {
class CameraDemo;
}
class CameraDemo : public QMainWindow {
Q_OBJECT
public:
explicit CameraDemo(QWidget *parent = 0);
~CameraDemo();
private slots:
void startCapture();
void stopCapture();
void quit();
protected:
void timerEvent(QTimerEvent* timerEvent);
private:
Ui::CameraDemo *ui;
int timerId;
bool capturing;
v4l2_device_t* device;
int width, height;
unsigned char *frame;
unsigned char *rgbFrame;
void displayImage(int width, int height, unsigned char *data);
};
#endif // CAMERADEMO_H
|
../../../linux-headers-3.0.0-12/include/linux/cpufreq.h |
#define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>
#include <string.h>
#include "ChessMoves.h"
// This is a hacky-horrible way of hard-coding a test case.
Game *testcase17(void)
{
int i;
char *moves[10];
Game *g = NULL;
i = 0;
moves[i++] = "1. d3 d6";
moves[i++] = "2. e3 e6";
moves[i++] = "3. f3 f6";
moves[i++] = "4. d4 d5";
moves[i++] = "5. e4 e5";
moves[i++] = "6. f4 f5";
moves[i++] = "7. h3 fxe4";
g = malloc(sizeof(Game));
g->numMoves = i;
g->moves = malloc(sizeof(char *) * g->numMoves);
for (i = 0; i < g->numMoves; i++)
{
g->moves[i] = malloc(sizeof(char) * (strlen(moves[i]) + 1));
strcpy(g->moves[i], moves[i]);
}
return g;
}
Game *destroyGame(Game *g)
{
int i;
if (g == NULL)
return NULL;
for (i = 0; i < g->numMoves; i++)
free(g->moves[i]);
free(g->moves);
free(g);
return NULL;
}
int main(void)
{
// Create a Game struct for this test case.
Game *g = testcase17();
// Play the game.
char **finalBoardState = playTheGame(g);
// Destroy the chess board returned by playTheGame().
finalBoardState = destroyChessBoard(finalBoardState);
// Destroy the Game struct with all the chess moves.
g = destroyGame(g);
return 0;
}
|
//
// C++ Interface: IServerAdapter
//
// Description:
//
//
// Author: Erik Hjortsberg <erik.hjortsberg@gmail.com>, (C) 2006
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.//
//
#ifndef EMBERISERVERADAPTER_H
#define EMBERISERVERADAPTER_H
#include <Atlas/Objects/Entity.h>
#include <wfmath/atlasconv.h>
#include <wfmath/point.h>
namespace Eris
{
class Entity;
}
namespace Ember {
/**
@author Erik Hjortsberg <erik.hjortsberg@gmail.com>
*/
class IServerAdapter {
public:
virtual ~IServerAdapter() {}
virtual void moveToPoint(const WFMath::Point<3>& dest) = 0;
virtual void moveInDirection(const WFMath::Vector<3>& velocity, const WFMath::Quaternion& orientation) = 0;
virtual void moveInDirection(const WFMath::Vector<3>& velocity) = 0;
// virtual void teleportTo(const WFMath::Point<3>& dest) = 0;
virtual void say(const std::string &message) = 0;
virtual void touch(Eris::Entity* entity) = 0;
virtual void emote(const std::string& emote) = 0;
virtual void drop(Eris::Entity* entity, const WFMath::Vector<3>& offset, const WFMath::Quaternion& orientation) = 0;
virtual void place(Eris::Entity* entity, Eris::Entity* target, const WFMath::Point<3>& pos = WFMath::Point<3>(0, 0, 0)) = 0;
virtual void place(Eris::Entity* entity, Eris::Entity* target, const WFMath::Point<3>& pos, const WFMath::Quaternion& orient) = 0;
virtual void wield(Eris::Entity* entity, const std::string& outfitSlot) = 0;
virtual void take(Eris::Entity* entity) = 0;
virtual void use(Eris::Entity* entity, WFMath::Point<3> pos, const std::string& operation) = 0;
virtual void useStop() = 0;
virtual void actuate(Eris::Entity* entity, const std::string& action) = 0;
virtual void attack(Eris::Entity* entity) = 0;
virtual void eat(Eris::Entity* entity) = 0;
virtual void deleteEntity(Eris::Entity* entity) = 0;
virtual void setAttributes(Eris::Entity* entity, Atlas::Message::MapType& attributes) = 0;
virtual void adminTell(const std::string& entityId, const std::string& attribute, const std::string &value) = 0;
virtual void createTypeInfo(const Atlas::Objects::Root& typeInfo) = 0;
virtual void setTypeInfo(const Atlas::Objects::Root& typeInfo) = 0;
};
}
#endif
|
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose: Expose things from GameInterface.cpp. Mostly the engine interfaces.
//
// $NoKeywords: $
//=============================================================================
#ifndef GAMEINTERFACE_H
#define GAMEINTERFACE_H
#ifdef _WIN32
#pragma once
#endif
class IFileSystem; // include FileSystem.h
class IUniformRandomStream; // include vstdlib/random.h
class IEngineSound; // include engine/IEngineSound.h
class IVEngineServer;
class IVoiceServer;
class IStaticPropMgrServer;
class ISpatialPartition;
class IVModelInfo;
class IEngineTrace;
class IGameEventManager;
extern IVEngineServer *engine;
extern IVoiceServer *g_pVoiceServer;
extern IFileSystem *filesystem;
extern IStaticPropMgrServer *staticpropmgr;
extern ISpatialPartition *partition;
extern IEngineSound *enginesound;
extern IUniformRandomStream *random;
extern IVModelInfo *modelinfo;
extern IEngineTrace *enginetrace;
extern IGameEventManager *gameeventmanager;
// HACKHACK: Builds a global list of entities that were restored from all levels
void AddRestoredEntity( CBaseEntity *pEntity );
//-----------------------------------------------------------------------------
// Precaches a material
//-----------------------------------------------------------------------------
void PrecacheMaterial( const char *pMaterialName );
//-----------------------------------------------------------------------------
// Converts a previously precached material into an index
//-----------------------------------------------------------------------------
int GetMaterialIndex( const char *pMaterialName );
class IRecipientFilter;
void MessageBegin( IRecipientFilter& filter, int msg_type = 0 );
void UserMessageBegin( IRecipientFilter& filter, const char *messagename );
void MessageEnd( void );
// bytewise
void MessageWriteByte( int iValue);
void MessageWriteChar( int iValue);
void MessageWriteShort( int iValue);
void MessageWriteWord( int iValue );
void MessageWriteLong( int iValue);
void MessageWriteFloat( float flValue);
void MessageWriteAngle( float flValue);
void MessageWriteCoord( float flValue);
void MessageWriteVec3Coord( const Vector& rgflValue);
void MessageWriteVec3Normal( const Vector& rgflValue);
void MessageWriteAngles( const QAngle& rgflValue);
void MessageWriteString( const char *sz );
void MessageWriteEntity( int iValue);
// bitwise
void MessageWriteBool( bool bValue );
void MessageWriteUBitLong( unsigned int data, int numbits );
void MessageWriteSBitLong( int data, int numbits );
void MessageWriteBits( const void *pIn, int nBits );
#endif // GAMEINTERFACE_H
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2011, Teo Mrnjavac <teo@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TAG_H
#define TAG_H
#include "DllMacro.h"
#include <QSharedPointer>
#include <QtCore/QString>
#include <taglib/tag.h>
#include <taglib/fileref.h>
namespace Tomahawk
{
class DLLEXPORT Tag
{
public:
static QSharedPointer<Tag> fromFile( const TagLib::FileRef &f );
//getter-setters for common TagLib items
virtual QString title() const { return TStringToQString( m_tag->title() ).trimmed(); }
virtual QString artist() const { return TStringToQString( m_tag->artist() ).trimmed(); }
virtual QString album() const { return TStringToQString( m_tag->album() ).trimmed(); }
virtual QString comment() const { return TStringToQString( m_tag->comment() ).trimmed(); }
virtual QString genre() const { return TStringToQString( m_tag->genre() ).trimmed(); }
virtual unsigned int year() const { return m_tag->year(); }
virtual unsigned int track() const { return m_tag->track(); }
virtual void setTitle( const QString &s ) { m_tag->setTitle( TagLib::String( s.toUtf8().data(), TagLib::String::UTF8 ) ); }
virtual void setArtist( const QString &s ) { m_tag->setArtist( TagLib::String( s.toUtf8().data(), TagLib::String::UTF8 ) ); }
virtual void setAlbum( const QString &s ) { m_tag->setAlbum( TagLib::String( s.toUtf8().data(), TagLib::String::UTF8 ) ); }
virtual void setComment( const QString &s ) { m_tag->setComment( TagLib::String( s.toUtf8().data(), TagLib::String::UTF8 ) ); }
virtual void setGenre( const QString &s ) { m_tag->setGenre( TagLib::String( s.toUtf8().data(), TagLib::String::UTF8 ) ); }
virtual void setYear( unsigned int i ) { m_tag->setYear( i ); }
virtual void setTrack( unsigned int i ) { m_tag->setTrack( i ); }
virtual bool isEmpty() const { return m_tag->isEmpty(); }
virtual QString albumArtist() const = 0;
virtual QString composer() const = 0;
virtual unsigned int discNumber() const = 0;
//TODO: add support for writing those 3 items with TagLib's addField/setField
protected:
Tag( TagLib::Tag *tag ) : m_tag( tag ), m_discNumber( 0 ) {}
unsigned int processDiscNumber( const QString & ) const;
TagLib::Tag *m_tag;
QString m_albumArtist;
QString m_composer;
unsigned int m_discNumber;
};
}
#endif // TAG_H
|
/*
* Copyright(C) 2011-2018 Pedro H. Penna <pedrohenriquepenna@gmail.com>
* 2016-2018 Davidson Francis <davidsondfgl@gmail.com>
*
* This file is part of Nanvix.
*
* Nanvix is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Nanvix 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 Nanvix. If not, see <http://www.gnu.org/licenses/>.
*/
#include <nanvix/syscall.h>
#include <errno.h>
#include <reent.h>
/*
* Creates a new process.
*/
pid_t fork(void)
{
register pid_t pid
__asm__("r11") = NR_fork;
__asm__ volatile (
"l.sys 1"
: "=r" (pid)
: "r" (pid)
);
/* Error. */
if (pid < 0)
{
errno = -pid;
_REENT->_errno = -pid;
return (-1);
}
return (pid);
}
|
/*
* Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
*
* This file is part of mpblocks.
*
* mpblocks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* mpblocks 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 mpblocks. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file mpblocks/kd_tree/euclidean/Distance.h
*
* @date Nov 20, 2012
* @author Josh Bialkowski (jbialk@mit.edu)
* @brief
*/
#ifndef MPBLOCKS_KD_TREE_EUCLIDEAN_DISTANCE_H_
#define MPBLOCKS_KD_TREE_EUCLIDEAN_DISTANCE_H_
namespace mpblocks {
namespace kd_tree {
namespace euclidean {
/// provides euclidean distance computation
template <class Traits>
class Distance
{
public:
typedef typename Traits::Format_t Format_t;
typedef Eigen::Matrix<Format_t,Traits::NDim,1> Point_t;
typedef HyperRect<Traits> Hyper_t;
public:
/// return the euclidean distance between two points
Format_t operator()( const Point_t& pa, const Point_t& pb );
/// return the euclidean distance between a point and hyper rectangle
Format_t operator()( const Point_t& p, const Hyper_t& h );
};
} // namespace eucliean
} // namespace kd_tree
} // namespace mpblocks
#endif // DEFAULTDISTANCE_H_
|
/***************************************************************************
* Copyright (C) 2011 by Hramchenko *
* v.hramchenko@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
***************************************************************************/
#ifndef AUDITMESSAGEFIELD_H_
#define AUDITMESSAGEFIELD_H_
#include <QString>
class AuditMessageField {
public:
AuditMessageField();
virtual ~AuditMessageField();
public:
QString name;
QString value;
QString interpretedValue;
};
#endif /* AUDITMESSAGEFIELD_H_ */
|
/*
* Copyright (C), 2000-2007 by the monit project group.
* All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BASE64_H
#define BASE64_H
size_t decode_base64(unsigned char *dest, const char *src);
char *encode_base64(size_t size, unsigned char *src);
#endif
|
/*
Copyright 2010 Alex Margarit <alex@alxm.org>
This file is part of Faur, a C video game framework.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3,
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef F_INC_GRAPHICS_PNG_P_H
#define F_INC_GRAPHICS_PNG_P_H
#include "../general/f_system_includes.h"
#endif // F_INC_GRAPHICS_PNG_P_H
|
#ifndef __VGMMESHRENDERWAY_H__
#define __VGMMESHRENDERWAY_H__
#include <vgMesh/vgmDefinition.h>
#include <vgKernel/vgkForward.h>
#include <vgKernel/vgkRay.h>
#include <vgKernel/vgkSegment3.h>
#include <vgKernel/vgkRgbaQuad.h>
namespace vgMesh {
/**
@date 2008/07/17 15:06
@author leven
@brief ʵÏÖ¼òµ¥µÄreference»úÖÆ£¬µ±ÒýÓüÆÊýΪ0ʱ£¬Íⲿ¸ºÔðdelete£»
»òÕߣ¬µ÷ÓÃ×ÔÉíµÄdoReferenceDelete(),×Ô¶¯Ö´ÐÐdelete this¡£
@see
*/
class MeshRenderWay
{
public:
MeshRenderWay()
: _referenceCount( 0 ),
_isTransparent( false )
{
}
virtual ~MeshRenderWay()
{
assert( _referenceCount == 0 );
}
// ³õʼ»¯²Ù×÷,Òª±£Ö¤ÔÚrender֮ǰִÐйýÒ»´Î
virtual bool initialiseInMainThread() = 0;
virtual void render( const int& lod , int force_render_in_num_layers,
RgbaQuad* colorval ) = 0;
virtual std::pair<bool, float> testIntersection(const vgKernel::Ray* ray) = 0;
virtual bool testIntersection(const vgKernel::Segment3* segment) = 0;
void setTransparent( bool enable_it )
{
_isTransparent = enable_it;
}
void addRef()
{
++_referenceCount;
}
void releaseRef()
{
if ( _referenceCount <= 0 )
{
assert(0);
}
if ( _referenceCount == 0 )
{
return;
}
--_referenceCount;
}
int getRefCount() const
{
return _referenceCount;
}
// ÏÈreleaseRef£¬È»ºó³¢ÊÔɾ³ý×ÔÉí
void doReferenceDelete()
{
releaseRef();
if ( getRefCount() == 0 )
{
delete this;
}
}
protected:
bool _isTransparent;
private:
int _referenceCount;
};
}// end of namespace vgMesh
#endif // end of __VGMMESHRENDERWAY_H__ |
//
// C++ Interface: ModelMount
//
// Description:
//
//
// Author: Erik Ogenvik <erik@ogenvik.org>, (C) 2008
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.//
//
#ifndef EMBEROGREMODELMOUNT_H
#define EMBEROGREMODELMOUNT_H
#include <wfmath/axisbox.h>
#include <string>
namespace WFMath {
template<int>
class AxisBox;
}
namespace Ogre {
class SceneNode;
class Node;
class MovableObject;
}
namespace Ember {
namespace OgreView {
struct INodeProvider;
namespace Model {
class Model;
/**
@brief Acts as a mount for a model, connecting it to two scene nodes.
A model can contain internal orientation and offset data. This requires us to use two different scene nodes for each model instance. The inner most scene node, called the "scale node", is the one which the Model is attached to. This is then offset and oriented in relation to the outer scene node. Whenever we move the Model, we move only the outer scene node, leaving the inner scene node completely in the hands of the Model.
The scale node will be owned by this class.
@author Erik Ogenvik <erik@ogenvik.org>
*/
class ModelMount {
public:
/**
* @brief Ctor.
* @param model The model which we need a mount for.
* @param nodeProvider Provides an instance of a subclass of Ogre::Node to which the Model can be attached.
*/
ModelMount(Model& model, std::unique_ptr<INodeProvider> nodeProvider, std::string pose = "");
/**
* @brief Dtor.
* The scale node will be destroyed here.
*/
virtual ~ModelMount();
/**
* @brief Gets the Model instance to which this mount is attached.
* @return The model instance.
*/
Model& getModel() const;
/**
* @brief Rescales the model according to the bounding box.
* @param wfBbox The bounding box to the model should be scaled. If you don't have an axis box available, just send null.
*/
void rescale(const WFMath::AxisBox<3>* wfBbox);
/**
* @brief Resets all scaling and rotation
*/
void reset();
/**
* @brief Gets the node provider, which is responsible for providing nodes to which the model mount can attach the model.
* @return The node provider in use.
*/
INodeProvider* getNodeProvider() const;
protected:
/**
*@brief The Model which this mount is attached to.
*/
Model& mModel;
/**
* @brief The node provider used by the mount.
* The node to which the Model is attached to is provided by this instance. It can be either a SceneNode or a TagPoint.
*/
std::unique_ptr<INodeProvider> mNodeProvider;
const std::string mPose;
/**
* @brief Scales the scale node accoring to the submitted bounding box.
* @note You should in almost all cases call reset() before calling this method.
* @param wfBbox The bounding box, in WF space, for which we should scale the node, or null if there's no bbox available.
*/
void scaleNode(const WFMath::AxisBox<3>* wfBbox);
/**
* @brief Gets the node to which the model is attached, as provided by the mNodeProvider instance.
* @return The node to which the model is attached.
*/
Ogre::Node* getNode() const;
};
inline Model& ModelMount::getModel() const {
return mModel;
}
}
}
}
#endif
|
#pragma once
#include "defines.h"
typedef struct SList_tag
{
void* value;
struct SList_tag* prev;
struct SList_tag* next;
} SListElement;
typedef struct
{
uint32 size;
SListElement* first; /* head */
SListElement* last; /* tail */
} SList;
SList* ListCreate ();
void ListDestroy (SList** list);
void ListAddElement (SList* list, void* value);
void ListDeleteElementByValue (SList* list, void* value);
void ListDeleteElementByNymber (SList* list, uint32 numOfElement);
void* ListGetElement (SList* list, uint32 numOfElement);
uint32 ListGetSize (SList* list);
void ListClear (SList* list);
|
/***********************************************************************
HiSIM (Hiroshima University STARC IGFET Model)
Copyright (C) 2003 STARC
VERSION : HiSIM 1.2.0
FILE : hsm1mdel.c of HiSIM 1.2.0
April 9, 2003 : released by STARC Physical Design Group
***********************************************************************/
#include "ngspice.h"
#include "hsm1def.h"
#include "sperror.h"
#include "suffix.h"
int
HSM1mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{
HSM1model **model = (HSM1model**)inModel;
HSM1model *modfast = (HSM1model*)kill;
HSM1instance *here;
HSM1instance *prev = NULL;
HSM1model **oldmod;
oldmod = model;
for ( ;*model ;model = &((*model)->HSM1nextModel) ) {
if ( (*model)->HSM1modName == modname ||
(modfast && *model == modfast) ) goto delgot;
oldmod = model;
}
return(E_NOMOD);
delgot:
*oldmod = (*model)->HSM1nextModel; /* cut deleted device out of list */
for ( here = (*model)->HSM1instances ;
here ;here = here->HSM1nextInstance ) {
if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev);
FREE(*model);
return(OK);
}
|
/*
* This file is part of cg3lib: https://github.com/cg3hci/cg3lib
* This Source Code Form is subject to the terms of the GNU GPL 3.0
*
* @author Alessandro Muntoni (muntoni.alessandro@gmail.com)
*/
#ifndef CG3_DRAWABLE_SEGMENT2_H
#define CG3_DRAWABLE_SEGMENT2_H
#include <cg3/geometry/segment2.h>
#include "../opengl_objects/opengl_objects2.h"
#include "../interfaces/drawable_object.h"
namespace cg3 {
/**
* @ingroup cg3viewer
* @brief The DrawableSegment2D class
*/
class DrawableSegment2 : public Segment2d, public DrawableObject
{
public:
DrawableSegment2();
DrawableSegment2(const Segment2d& s);
DrawableSegment2(const Point2d& _p1, const Point2d& _p2);
// DrawableObject interface
void draw() const;
Point3d sceneCenter() const;
double sceneRadius() const;
void setColor(const QColor& c);
void setWidth(int w);
protected:
QColor color;
int width;
};
} //namespace cg3
#ifndef CG3_STATIC
#define CG3_DRAWABLE_SEGMENT2_CPP "drawable_segment2.cpp"
#include CG3_DRAWABLE_SEGMENT2_CPP
#undef CG3_DRAWABLE_SEGMENT2_CPP
#endif //CG3_STATIC
#endif // CG3_DRAWABLE_SEGMENT2_H
|
// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0+
//
// Author(s): Shahar <shasha94@gmail.com>
// Efi Fogel <efif@gmail.com>
#ifndef CGAL_SET_MOVABLE_SEPARABILITY_2_INTERNAL_UTILS_H
#define CGAL_SET_MOVABLE_SEPARABILITY_2_INTERNAL_UTILS_H
#include <CGAL/license/Set_movable_separability_2.h>
#include <CGAL/enum.h>
#include <CGAL/Polygon_2.h>
namespace CGAL {
namespace Set_movable_separability_2 {
namespace internal {
/*! \fn std::pair<typename Kernel::Direction_2,typename Kernel::Direction_2> get_segment_outer_circle(typename Kernel::Segment_2 seg, CGAL::Orientation orientation)
* \param[in] seg the polygon segment
* \param[in] orientation the orientation of the segment (and the polygon).
* if CLOCKWISE then the outer half circle is to the left.
* \return the open outer half-circle of the edge.
*/
template <typename Kernel>
inline std::pair<typename Kernel::Direction_2, typename Kernel::Direction_2>
get_segment_outer_circle(const typename Kernel::Segment_2 seg,
const CGAL::Orientation orientation)
{
typename Kernel::Direction_2 forward( seg);
typename Kernel::Direction_2 backward(-forward);
return (orientation == CGAL::CLOCKWISE) ?
std::make_pair(backward, forward) : std::make_pair(forward, backward);
}
template <typename Kernel>
bool is_any_edge_colinear(const CGAL::Polygon_2<Kernel>& pgn, Kernel& kernel)
{
typedef typename Kernel::Point_2 Point_2;
typedef typename CGAL::Polygon_2<Kernel> Polygon_2;
typedef typename Polygon_2::Vertex_const_iterator Vertex_const_iterator;
auto collinear = kernel.collinear_2_object();
Vertex_const_iterator vci = pgn.vertices_begin();
Point_2 firstVar = *(vci++);
Point_2 secondVar = *(vci++);
Point_2 thirdVar = *(vci++);
for (; vci != pgn.vertices_end(); ++vci) {
firstVar = secondVar;
secondVar = thirdVar;
thirdVar = *vci;
if (collinear(firstVar, secondVar, thirdVar)) return true;
}
vci = pgn.vertices_begin();
firstVar = secondVar;
secondVar = thirdVar;
thirdVar = *(vci++);
if(collinear(firstVar, secondVar, thirdVar)) return true;
firstVar = secondVar;
secondVar = thirdVar;
thirdVar = *(vci++);
if (collinear(firstVar, secondVar, thirdVar)) return true;
return false;
}
} // namespace internal
} // namespace Set_movable_separability_2
} // namespace CGAL
#endif
|
/* Glom
*
* Copyright (C) 2001-2004 Murray Cumming
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*/
#ifndef GLOM_DATASTRUCTURE_TRANSLATABLE_ITEM_H
#define GLOM_DATASTRUCTURE_TRANSLATABLE_ITEM_H
#include <glibmm/ustring.h>
#include <unordered_map>
#include <libglom/sharedptr.h>
namespace Glom
{
///TranslatableItem have a map of translation strings - one string for each locale.
class TranslatableItem
{
public:
TranslatableItem() noexcept;
TranslatableItem(const TranslatableItem& src) = default;
TranslatableItem(TranslatableItem&& src) = default;
virtual ~TranslatableItem() = default;
TranslatableItem& operator=(const TranslatableItem& src) = default;
TranslatableItem& operator=(TranslatableItem&& src) = default;
bool operator==(const TranslatableItem& src) const noexcept;
bool operator!=(const TranslatableItem& src) const noexcept;
/** Set the non-translated identifier name.
*/
virtual void set_name(const Glib::ustring& name) noexcept;
/** Get the non-translated identifier name.
*/
virtual Glib::ustring get_name() const noexcept;
bool get_name_not_empty() const noexcept; //For performance.
virtual Glib::ustring get_title_or_name(const Glib::ustring& locale) const noexcept;
/** Get the title's translation for the specified locale, falling back to the
* original text if there is no translation.
*
* See also get_title_translation() and get_title_original(), which (optionally)
* do not use fallbacks.
*
* @param locale The locale whose title text should be returned. If this is empty then the original text will be returned.
* @result The text of the title.
*/
virtual Glib::ustring get_title(const Glib::ustring& locale) const noexcept;
//This is virtual so that ChoiceValue can override it.
/** Get the title's original (non-translated, usually English) text.
*/
virtual Glib::ustring get_title_original() const noexcept;
/** Get the title's translation for the specified @a locale, optionally
* falling back to a locale of the same language, and then falling back to
* the original.
* Calling this with the current locale is the same as calling get_title_original().
*/
Glib::ustring get_title_translation(const Glib::ustring& locale, bool fallback = true) const noexcept;
/** Set the title's translation for the specified locale.
* @param title The text of the title.
* @param locale The locale whose title text should be set. If this is empty then the original text will be set.
*/
void set_title(const Glib::ustring& title, const Glib::ustring& locale) noexcept;
/** Set the title's original (non-translated, usually English) text.
* This is the same as calling set_title() with an empty locale parameter.
*/
void set_title_original(const Glib::ustring& title) noexcept;
/// Clear the original title and any translations of the title.
void clear_title_in_all_locales() noexcept;
typedef std::unordered_map<Glib::ustring, Glib::ustring, std::hash<std::string>> type_map_locale_to_translations;
bool get_has_translations() const noexcept;
enum class enumTranslatableItemType
{
INVALID,
FIELD,
RELATIONSHIP,
LAYOUT_ITEM,
CUSTOM_TITLE,
PRINT_LAYOUT,
REPORT,
TABLE,
BUTTON,
TEXTOBJECT, //This has a enumTranslatableItemType::STATIC_TEXT child.
IMAGEOBJECT,
CHOICEVALUE,
DATABASE_TITLE,
STATIC_TEXT
};
enumTranslatableItemType get_translatable_item_type() const noexcept;
//Direct access, for performance:
const type_map_locale_to_translations& _get_translations_map() const noexcept;
static Glib::ustring get_translatable_type_name(enumTranslatableItemType item_type) noexcept;
/** The non-translated name is used for the context in gettext .po files.
*/
static Glib::ustring get_translatable_type_name_nontranslated(enumTranslatableItemType item_type) noexcept;
private:
void set_title_translation(const Glib::ustring& locale, const Glib::ustring& translation) noexcept;
protected:
enumTranslatableItemType m_translatable_item_type;
private:
Glib::ustring m_name; //Non-translated identifier;
Glib::ustring m_title; //The original, untranslated (usually-English) title.
type_map_locale_to_translations m_map_translations;
};
template <class T_object>
Glib::ustring glom_get_sharedptr_name(const std::shared_ptr<T_object>& item)
{
if(item)
return item->get_name();
else
return Glib::ustring();
}
} //namespace Glom
#endif //GLOM_DATASTRUCTURE_TRANSLATABLE_ITEM_H
|
//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009-2015 Richel Bilderbeek
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#ifndef WTSELECTHOMETRAINERFILEDIALOG_H
#define WTSELECTHOMETRAINERFILEDIALOG_H
#include <string>
#include <vector>
#include "wtselectfiledialog.h"
namespace ribi {
struct WtSelectHometrainerFileDialog : public WtSelectFileDialog
{
WtSelectHometrainerFileDialog();
///The virtual method how to select Hometrainer files from a folder
std::vector<std::string> SelectFiles() const noexcept;
private:
///GetFirstLineFromFile reads the first line from a file
static std::string GetFirstLineFromFile(const std::string& filename);
};
} //~namespace ribi
#endif // WTSELECTHOMETRAINERFILEDIALOG_H
|
/* ide-device-info.h
*
* Copyright 2018 Christian Hergert <chergert@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include <gio/gio.h>
G_BEGIN_DECLS
typedef enum
{
IDE_DEVICE_KIND_COMPUTER,
IDE_DEVICE_KIND_PHONE,
IDE_DEVICE_KIND_TABLET,
IDE_DEVICE_KIND_MICRO_CONTROLLER,
} IdeDeviceKind;
#define IDE_TYPE_DEVICE_INFO (ide_device_info_get_type())
G_DECLARE_FINAL_TYPE (IdeDeviceInfo, ide_device_info, IDE, DEVICE_INFO, GObject)
IdeDeviceInfo *ide_device_info_new (void);
IdeDeviceKind ide_device_info_get_kind (IdeDeviceInfo *self);
void ide_device_info_set_kind (IdeDeviceInfo *self,
IdeDeviceKind kind);
const gchar *ide_device_info_get_kernel (IdeDeviceInfo *self);
void ide_device_info_set_kernel (IdeDeviceInfo *self,
const gchar *kernel);
const gchar *ide_device_info_get_arch (IdeDeviceInfo *self);
void ide_device_info_set_arch (IdeDeviceInfo *self,
const gchar *arch);
const gchar *ide_device_info_get_system (IdeDeviceInfo *self);
void ide_device_info_set_system (IdeDeviceInfo *self,
const gchar *system);
G_END_DECLS
|
/*
Copyright (C) Cfengine AS
This file is part of Cfengine 3 - written and maintained by Cfengine AS.
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; version 3.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
To the extent this program is licensed as part of the Enterprise
versions of Cfengine, the applicable Commerical Open Source License
(COSL) may apply to this file if you as a licensee so wish it. See
included file COSL.txt.
*/
#ifndef CFENGINE_SIGNALS_H
#define CFENGINE_SIGNALS_H
#include "cf3.defs.h"
// check whether the running deamon should terminate after having received a signal.
bool IsPendingTermination(void);
void HandleSignalsForDaemon(int signum);
void HandleSignalsForAgent(int signum);
#endif
|
#ifndef __OPTIONS_H__
#define __OPTIONS_H__
#include "common.h"
#include <inttypes.h>
#include <stdbool.h>
typedef struct tca_address {
char *address_str;
uint16_t port;
} tca_address;
tca_address *allocate_tca_address(void);
void free_tca_address(void *t);
#define NUMBER_OF_ENDPOINTS 2
typedef struct tca_options {
bool use_ipv6;
tca_address *connection_endpoints[NUMBER_OF_ENDPOINTS];
} tca_options;
tca_options *allocate_tca_options(void);
void free_tca_options(void *t);
char *usage_text(char const *progname);
tca_options *evaluate_options(int argc, char *argv[]);
#endif
|
/*******************************************************************************#
# guvcview http://guvcview.sourceforge.net #
# #
# Paulo Assis <pj.assis@gmail.com> #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
********************************************************************************/
#ifndef SOUND_H
#define SOUND_H
#include <glib.h>
#include <pthread.h>
#include "globals.h"
#include "../config.h"
#include "defs.h"
/*------------- portaudio defs ----------------*/
/*---- can be override in rc file or GUI ------*/
#define DEFAULT_LATENCY_DURATION 100.0
#define DEFAULT_LATENCY_CORRECTION -130.0
#define SAMPLE_RATE (0) /* 0 device default*/
//#define FRAMES_PER_BUFFER (4096)
/* sound can go for more 1 seconds than video */
#define NUM_CHANNELS (0) /* 0-device default 1-mono 2-stereo */
#define PA_SAMPLE_TYPE paFloat32
#define PA_FOURCC WAVE_FORMAT_PCM //use PCM 16 bits converted from float
#define PULSE_SAMPLE_TYPE PA_SAMPLE_FLOAT32LE //for PCM -> PA_SAMPLE_S16LE
#define SAMPLE_SILENCE (0.0f)
#define MAX_SAMPLE (1.0f)
#define PRINTF_S_FORMAT "%.8f"
/*buffer flags*/
#define AUD_IN_USE 0 /* in use by interrupt handler*/
#define AUD_PROCESS 1 /* ready to process */
#define AUD_PROCESSING 2 /* processing */
#define AUD_PROCESSED 3 /* ready to write to disk */
#define AUD_READY 4 /* ready to re-use by interrupt handler*/
//API index
#define PORT 0
#define PULSE 1
typedef struct _AudBuff
{
gboolean used;
QWORD time_stamp;
SAMPLE *frame;
} AudBuff;
// main audio interface struct
struct paRecordData
{
int api; //0-Portaudio 1-pulse audio
int input_type; // audio SAMPLE type
unsigned long framesPerBuffer; //frames per buffer passed in audio callback
char device_name[512]; //device name - for pulse
int device_id; //device id - for portaudio
int w_ind; // producer index
int r_ind; // consumer index
int bw_ind; // audio_buffer in_use index
int br_ind; // audio_buffer processing
int blast_ind; // last in_use index (for vu meter)
int last_ind; // last producer index (for vu meter)
int channels; // channels
gboolean streaming; // audio streaming flag
int flush; // flush mp2 buffer flag
int samprate; // samp rate
int numsec; // aprox. number of seconds for out buffer size
int aud_numBytes; // bytes copied to out buffer*/
int aud_numSamples; // samples copied to out buffer*/
int64_t snd_begintime; // audio recording start time*/
int capVid; // video capture flag
SAMPLE *recordedSamples; // callback buffer
int sampleIndex;
AudBuff *audio_buff[AUDBUFF_NUM];// ring buffers for audio data captured from device
int audio_buff_flag[AUDBUFF_NUM];// process_buffer flags
int64_t a_ts; // audio frame time stamp
int64_t ts_ref; // timestamp video reference
int64_t ts_drift; // time drift between audio device clock and system clock
gint16 *pcm_sndBuff; // buffer for pcm coding with int16
float *float_sndBuff; // buffer for pcm coding with float
BYTE *mp2Buff; // mp2 encode buffer
int mp2BuffSize; // mp2 buffer size
int snd_Flags; // effects flag
int skip_n; // video frames to skip
UINT64 delay; // in nanosec - h264 has a two frame delay that must be compensated
int outbuf_size; //size of output buffer
struct lavcAData* lavc_data; //libavcodec data
__MUTEX_TYPE mutex;
//PORTAUDIO SUPPORT
void *stream;
//PULSE SUPPORT
#ifdef PULSEAUDIO
__THREAD_TYPE pulse_read_th;
/*The main loop context*/
//GMainContext *maincontext;
#endif
};
int
record_sound ( const void *inputBuffer, unsigned long numSamples, void *userData );
int
fill_audio_buffer(struct paRecordData *pdata, UINT64 ts);
void
set_sound (struct GLOBAL *global, struct paRecordData* data);
int
init_sound(struct paRecordData* data);
int
close_sound (struct paRecordData *data);
void
SampleConverter (struct paRecordData* data);
#endif
|
#ifndef FTRL_MODELUNIT_H
#define FTRL_MODELUNIT_H
#include <string>
#include <mutex>
#include <atomic>
/*struct ModelUnit{
std::atomic<double> w;
std::atomic<double> g;
std::atomic<double> s;
std::atomic<double> z;
std::atomic<double> n;
std::mutex mtx;
ModelUnit(double w_i,double g_i,double s_i,double z_i,double n_i){w.store(w_i);g.store(g_i);s.store(s_i);z.store(z_i);n.store(n_i);};
ModelUnit(){w.store(0.0);g.store(0.0);s.store(0.0);z.store(0.0);n.store(0.0);}
};*/
struct ModelUnit{
double w;
double g;
double s;
double z;
double n;
std::mutex mtx;
ModelUnit(double w_i,double g_i,double s_i,double z_i,double n_i){w=w_i;g=g_i;s=s_i;z=z_i;n=n_i;};
ModelUnit(){w=0.0;g=0.0;s=0.0;z=0.0;n=0.0;}
//ModelUnit(){ModelUnit(0.0,0.0,0.0,0.0,0.0);}
};
#endif //FTRL_MODELUNIT_H
|
/* fmemopen tests for BZ#1930 and BZ#20005.
Copyright (C) 2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
/* Check if fflush does not reset the file position. */
static int
do_test (void)
{
char buffer[500] = "x";
FILE *stream = fmemopen (buffer, sizeof (buffer), "r+");
if (stream == NULL)
{
printf ("error: fmemopen could not open stream\n");
return 1;
}
const char test[] = "test";
size_t r = fwrite (test, sizeof (char), sizeof (test), stream);
if (r != sizeof (test))
{
printf ("error: fwrite returned %zu, expected %zu\n", r, sizeof(test));
return 1;
}
r = ftell (stream);
if (r != sizeof (test))
{
printf ("error: ftell return %zu, expected %zu\n", r, sizeof(test));
return 1;
}
if (fflush (stream) != 0)
{
printf ("error: fflush failed\n");
return 1;
}
r = ftell (stream);
if (r != sizeof (test))
{
printf ("error: ftell return %zu, expected %zu\n", r, sizeof(test));
return 1;
}
return 0;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
|
#ifndef STCARETVIEW_H
#define STCARETVIEW_H
#include <QGraphicsObject>
class STCaretView : public QGraphicsObject
{
Q_OBJECT
QSizeF m_size;
float m_oldFadeOpacity;
float m_newFadeOpacity;
unsigned int m_fadeDuration;
quint64 m_fadeStartTime;
int m_timer;
quint64 m_blankStartTime;
bool m_isCaretVisible;
bool shouldAnimate();
float fadeOpacity();
float blankOpacity();
void startAnimate();
public:
explicit STCaretView(QGraphicsItem *parent = 0);
void setSize(const QSizeF&);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
virtual QRectF boundingRect() const;
virtual void timerEvent(QTimerEvent *);
void blankCaret();
void showCaret();
void hideCaret();
bool isCaretVisible() const{return m_isCaretVisible;}
signals:
public slots:
};
#endif // STCARETVIEW_H
|
// Copyright 2010 Jan Anlauff <jan at 23t.de>
//
// This file is part of Soldering Skaters Nokia Push Project.
//
// Soldering Skaters Nokia Push Project is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Soldering Skaters Nokia Push Project 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 Soldering Skaters Nokia Push Project. If not, see <http://www.gnu.org/licenses/>.
/*
* fifo.h
* from: http://www.rn-wissen.de/index.php/FIFO_mit_avr-gcc
*/
#ifndef _FIFO_H_
#define _FIFO_H_
#include <avr/io.h>
#include <avr/interrupt.h>
typedef struct {
uint8_t volatile count; // # Zeichen im Puffer
uint8_t size; // Puffer-Größe
uint8_t *pread; // Lesezeiger
uint8_t *pwrite; // Schreibzeiger
uint8_t read2end, write2end; // # Zeichen bis zum Überlauf Lese-/Schreibzeiger
} fifo_t;
extern void fifo_init (fifo_t*, uint8_t* buf, const uint8_t size);
extern uint8_t fifo_put (fifo_t*, const uint8_t data);
extern uint8_t fifo_get_wait (fifo_t*);
extern int fifo_get_nowait (fifo_t*);
static inline uint8_t _inline_fifo_put (fifo_t *f, const uint8_t data) {
if (f->count >= f->size)
return 0;
uint8_t * pwrite = f->pwrite;
*(pwrite++) = data;
uint8_t write2end = f->write2end;
if (--write2end == 0)
{
write2end = f->size;
pwrite -= write2end;
}
f->write2end = write2end;
f->pwrite = pwrite;
uint8_t sreg = SREG;
cli();
f->count++;
SREG = sreg;
return 1;
}
static inline uint8_t _inline_fifo_get (fifo_t *f) {
uint8_t *pread = f->pread;
uint8_t data = *(pread++);
uint8_t read2end = f->read2end;
if (--read2end == 0)
{
read2end = f->size;
pread -= read2end;
}
f->pread = pread;
f->read2end = read2end;
uint8_t sreg = SREG;
cli();
f->count--;
SREG = sreg;
return data;
}
#endif /* _FIFO_H_ */
|
/**
* Copyright (C) 2011 Eric Huang
*
* This file is part of rectpack.
*
* rectpack is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* rectpack 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 rectpack. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef METAFRAME_H
#define METAFRAME_H
#include <map>
#include <vector>
#include "APSP.h"
#include "MetaDomain.h"
#include "MetaVarDesc.h"
#include "MetaVariable.h"
#include "Solution.h"
class MetaFrame;
class MetaFrame {
public:
typedef std::map<const MetaVarDesc*, MetaVariable>::iterator VarIter;
typedef std::map<const MetaVarDesc*, MetaVariable>::const_iterator ConstVarIter;
MetaFrame();
MetaFrame(const MetaFrame& src);
virtual ~MetaFrame();
void initialize(const std::vector<std::vector<MetaVarDesc> >& vVars);
/**
* Makes the requested assignment, moving the appropriate meta
* variable into its set.
*/
MetaVariable* assign(const MetaVarDesc* pDesc,
MetaDomain::ValueT nValue);
/**
* Performs forward checking on all unassigned variables, removing
* invalid domain values.
*
* @return true if all tests passed and false if we found an empty
* domain after all.
*/
bool forwardChecking();
bool forwardCheckBounds(const Solution& s);
/**
* Checks the APSP matrices for consistency with the current best
* solution. Check to see if the APSP matrix requires a bounding box
* of greater area than our best solution so far.
*/
bool checkBoxBounds(const Solution& s) const;
/**
* Increases the minimum width and height, if necessary, to the
* given tighter values, and given a maximum area.
*
* @return true if bounds are still valid, or false if the bounds
* imply no solutions.
*/
bool updateMinimumBounds(UInt nWidth, UInt nHeight, UInt nArea);
/**
* Make all assignments regarding subsumed variables. We go through
* all unassigned variables and check to see if non-overlap is
* already required per the APSP matrices. If so, we make immediate
* assignments. This captures transitive assignments.
*/
void subsumeVariables();
/**
* Provided for debugging purposes.
*/
void print() const;
/**
* Represents the set of variables which have been assigned
* particular values.
*/
std::map<const MetaVarDesc*, MetaVariable> m_Assigned;
/**
* Represents the set of unassigned variables.
*/
std::map<const MetaVarDesc*, MetaVariable> m_Unassigned;
APSP m_vXMatrix;
APSP m_vYMatrix;
UInt m_nMinWidth;
UInt m_nMinHeight;
UInt m_nMaxWidth;
UInt m_nMaxHeight;
};
#endif // METAFRAME_H
|
/* newwordlexicon.hh
* author: Johan Carlberger
* last change: 2000-05-15
* comments: NewWordLexicon class
*/
#ifndef _newwordlexicon_hh
#define _newwordlexicon_hh
#include "newword.h"
#include "hashtable.h"
class NewWordLexicon : public HashTable<NewWord> {
public:
NewWordLexicon();
~NewWordLexicon();
NewWord *AddWord(const char*, const Tag* = NULL);
WordTag *AddWordTag(NewWord*, const Tag*);
WordTag *AddWordTagUnsafe(NewWord*, const Tag*);
void Reset();
DecObj();
};
#endif
|
/*
Copyright 2010-2012 Mark Boots, David Chevrier, and Darren Hunter.
Copyright 2013-2014 David Chevrier and Darren Hunter.
This file is part of the Acquaman Data Acquisition and Management framework ("Acquaman").
Acquaman is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Acquaman 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 Acquaman. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AMSAMPLECAMERABROWSER_H
#define AMSAMPLECAMERABROWSER_H
#include <QObject>
class QString;
class QColor;
class QPointF;
class QStringList;
class AMSampleCamera;
class AMSampleCameraView;
class AMSamplePlate;
#include "dataman/database/AMDbObject.h"
class AMSampleCameraURL : public AMDbObject
{
Q_OBJECT
Q_PROPERTY(QString urlString READ urlString WRITE setURLString)
public:
Q_INVOKABLE AMSampleCameraURL(const QString &urlString = QString(), QObject *parent = 0);
QString urlString() const;
public slots:
void setURLString(const QString &urlString);
protected:
QString urlString_;
};
class AMSampleCameraBrowser : public QObject
{
Q_OBJECT
public:
AMSampleCameraBrowser(QObject *parent = 0);
/// Accessors
QString currentURL();
AMSampleCamera *shapeDataSet();
/// Mutators
void setCurrentURL(QString currentURL);
void addURL(const QString &urlString);
void removeURL(const QString &urlString);
QList<AMSampleCameraURL*> urls();
protected slots:
void onSamplePlateChanged(AMSamplePlate *samplePlate);
void onCameraShapesChanged();
protected:
AMSampleCamera *shapeDataSet_;
AMSamplePlate *currentSamplePlate_;
QString currentURL_;
QList<AMSampleCameraURL*> urls_;
};
#endif // AMSAMPLECAMERABROWSER_H
|
/*
* linux/fs/nfs/iostat.h
*
* Declarations for NFS client per-mount statistics
*
* Copyright (C) 2005, 2006 Chuck Lever <cel@netapp.com>
*
*/
#ifndef _NFS_IOSTAT
#define _NFS_IOSTAT
#include <linux/percpu.h>
#include <linux/cache.h>
#include <linux/nfs_iostat.h>
struct nfs_iostats
{
unsigned long long bytes[__NFSIOS_BYTESMAX];
#ifdef CONFIG_NFS_FSCACHE
unsigned long long fscache[__NFSIOS_FSCACHEMAX];
#endif
unsigned long events[__NFSIOS_COUNTSMAX];
} ____cacheline_aligned;
static inline void nfs_inc_server_stats(const struct nfs_server *server,
enum nfs_stat_eventcounters stat)
{
this_cpu_inc(server->io_stats->events[stat]);
}
static inline void nfs_inc_stats(const struct inode *inode,
enum nfs_stat_eventcounters stat)
{
nfs_inc_server_stats(NFS_SERVER(inode), stat);
}
static inline void nfs_add_server_stats(const struct nfs_server *server,
enum nfs_stat_bytecounters stat,
long addend)
{
this_cpu_add(server->io_stats->bytes[stat], addend);
}
static inline void nfs_add_stats(const struct inode *inode,
enum nfs_stat_bytecounters stat,
long addend)
{
nfs_add_server_stats(NFS_SERVER(inode), stat, addend);
}
#ifdef CONFIG_NFS_FSCACHE
static inline void nfs_add_fscache_stats(struct inode *inode,
enum nfs_stat_fscachecounters stat,
long addend)
{
this_cpu_add(NFS_SERVER(inode)->io_stats->fscache[stat], addend);
}
static inline void nfs_inc_fscache_stats(struct inode *inode,
enum nfs_stat_fscachecounters stat)
{
this_cpu_inc(NFS_SERVER(inode)->io_stats->fscache[stat]);
}
#endif
static inline struct nfs_iostats __percpu *nfs_alloc_iostats(void)
{
return alloc_percpu(struct nfs_iostats);
}
static inline void nfs_free_iostats(struct nfs_iostats __percpu *stats)
{
if (stats != NULL)
{
free_percpu(stats);
}
}
#endif /* _NFS_IOSTAT */
|
//
// XmlParser.h
// JasperReportiOS
//
// Created by Martin Krasnočka on 5/11/13.
// Copyright (c) 2013 Digireport. All rights reserved.
//
#import <Foundation/Foundation.h>
#include "org/oss/pdfreporter/xml/parsers/AbstractXmlParser.h"
@interface XmlParser : OrgOssPdfreporterXmlParsersAbstractXmlParser <NSXMLParserDelegate>
@end
|
/*
* Copyright (C) 2006-2009 Daniel Prevost <dprevost@photonsoftware.org>
*
* This file is part of Photon (photonsoftware.org).
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 or version 3 as published by the
* Free Software Foundation and appearing in the file COPYING.GPL2 and
* COPYING.GPL3 included in the packaging of this software.
*
* Licensees holding a valid Photon Commercial license can use this file
* in accordance with the terms of their license.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
#ifndef QSR_LOGMSG_H
#define QSR_LOGMSG_H
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
#include "Common/Common.h"
#if ! defined ( WIN32 )
#include <syslog.h>
#endif
BEGIN_C_DECLS
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
#define PSO_MAX_MSG_LOG 1024
enum qsrMsgSeverity
{
#if defined ( WIN32 )
QSR_INFO = EVENTLOG_INFORMATION_TYPE,
QSR_WARNING = EVENTLOG_WARNING_TYPE,
QSR_ERROR = EVENTLOG_ERROR_TYPE
#else
QSR_INFO = LOG_INFO,
QSR_WARNING = LOG_WARNING,
QSR_ERROR = LOG_ERR
#endif
};
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
/**
* The qsrLogMsg class is a wrapper for the differences between different
* platform-specific event-logging mechanisms (well... so far this means
* EventLog on Windows and syslog on Unix/linux).
*
* Note that this is not considered a critical part of the work of the
* daemon. Which means that we do not want a failure (to log a message,
* for example) to disturb a production environment.
*/
struct qsrLogMsg
{
/// True if we are a daemon or an NT service, false otherwise
bool useLog;
#if defined ( WIN32 )
HANDLE handle;
#endif
char * name;
};
typedef struct qsrLogMsg qsrLogMsg;
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
int qsrLogMsgInit( qsrLogMsg * pLog,
const char * progName );
void qsrLogMsgFini( qsrLogMsg * pLog );
void qsrStartUsingLogger( qsrLogMsg * pLog );
void qsrSendMessage( qsrLogMsg * pLog,
enum qsrMsgSeverity severity,
const char * format,
... );
#if defined ( WIN32 )
/**
* Install the necessary stuff (registry keys, message file, etc.).
* This is not mandatory but it makes it easier to examine events
* using EventViewer.
*/
int qsrLogMsgInstall( qsrLogMsg * pLog,
const char * progName,
const char * msgPathName,
int dwNum );
int qsrLogMsgUninstall( qsrLogMsg * pLog,
const char * progName );
#endif
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
END_C_DECLS
#endif /* QSR_LOGMSG_H */
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
|
/*
* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
*
* This file is part of CasparCG (www.casparcg.com).
*
* CasparCG is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CasparCG 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 CasparCG. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Robert Nagy, ronag89@gmail.com
*/
#pragma once
#ifdef __cplusplus
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include "../common/compiler/vs/disable_silly_warnings.h"
#if defined _DEBUG && defined _MSC_VER
#include <crtdbg.h>
#endif
#include <algorithm>
#include <array>
#include <assert.h>
#include <deque>
#include <functional>
#include <math.h>
#include <memory>
#include <queue>
#include <string>
#include <vector>
#include <tbb/concurrent_queue.h>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/regex.hpp>
#include "../common/memory.h"
#include "../common/utf.h"
#include "../common/except.h"
#include "../common/log.h"
#endif
#include <rpc.h>
#include <rpcndr.h>
|
/*
* Sample program from
* Compiler Design in C
* Allen I. Holub
*
* Based on program: p. 21 - An improved parser
*/
/**============================================================================
** TEST = t11_cdiC_2_improved_parser.c
** SOURCE = file
** TESTSUITE = cdiC_programs
** TEST 1 = check
** TEST 2 = check_pedantic
** TEST 3 = compile
**============================================================================
**/
/* Private headers */
#include "t11_cdiC_2__lexer.h"
/*------------------------------------------------------------------------------
* Variable _Lookahead
*
* Lookahead token
*/
int _Lookahead = -1;
/*-<EOF>-*/
|
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
_Static_assert( (sizeof(size_t) == 8 ) , "Invalid `size_t` type size");
_Static_assert( (sizeof(long) == 8 ) , "Invalid `long` type size");
#define NOL 0UL
#define ONE 1UL
#define TEN 10UL
#define SIZE_T_MAX (~(size_t)0)
#define BSI 8UL
char *readline (size_t *len, _Bool *is_eof, _Bool (*func)(char *) )
{
size_t cbs = BSI;
char *buf = malloc( cbs );
char c;
size_t r, i = NOL;
while ( 1 )
{
r = read( 0, &c, ONE );
if ( r == SIZE_T_MAX ) // r == -1
{
free( buf );
return NULL;
}
if ( r == NOL || c == '\n' )
{
if ( is_eof )
*is_eof = (r == NOL);
break;
}
if ( func && !func( &c ) )
{
free( buf );
while( (r = read(0, &c, ONE)) == ONE && c != '\n' ); //Drain
return NULL;
}
buf[i++] = c;
if ( i == cbs )
{
cbs += BSI;
buf = realloc ( buf, cbs );
}
}
buf[i] = '\0';
if ( len != NULL )
*len = i;
return buf;
}
#define IS_ASCIIP(c) (c > 31 && c < 127)
_Bool accept (char *c)
{
return IS_ASCIIP( *c );
}
int main (void)
{
size_t len;
_Bool is_eof;
char *str = readline( &len, &is_eof, accept );
if (str != NULL)
{
if ( is_eof )
puts( "" );
printf( "[%s] => %lu chars\n", str, len );
for( size_t i = NOL; i<len; i++ )
printf( "- char #%-3lu: %c\n", i, str[i] );
free(str);
}
else
puts( "NULL" );
return 0;
}
/*
@see also:
- fgets <= stdio.h
- getline <= posix - stdio.h
- readline <= GNU Readline - readline/readline.h
*/
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* categories.h
* Copyright (C) Thura Hlaing 2010 <trhura@gmail.com>
*
* rookie is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* rookie is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CATEGORIES_H_
#define _CATEGORIES_H_
#include <glib.h>
#include "rookie-misc.h"
typedef struct _Category Category;
void categories_init ();
void categories_finalize ();
gint categories_get_category_count ();
void categories_foreach_category (GFunc func, gpointer data);
void categories_remove_category (Category *category);
Category* categories_append_category ();
Category* categories_get_category_by_url (const gchar *url);
Category* categories_get_category_by_name (const gchar *name);
Category* categories_get_category_by_id (gint id);
gint category_get_id (Category *category);
gint category_get_priority (Category *category);
gint category_get_finish_action (Category *category);
gboolean category_get_visible (Category *category);
const gchar* category_get_name (Category *category);
const gchar* category_get_pattern (Category *category);
const gchar* category_get_backend (Category *category);
const gchar* category_get_path (Category *category);
void category_set_name (Category *category, const gchar *name);
void category_set_path (Category *category, const gchar *path);
void category_set_priority (Category *category, gint priority);
void category_set_visible (Category *category, gboolean visible);
void category_set_backend (Category *category, const gchar *backend);
void category_set_pattern (Category *category, const gchar *pattern);
void category_set_finish_action (Category *category, gint finish_action);
void category_add_finish_action (Category *category, int action);
void category_remove_finish_action (Category *category, int action);
#endif
|
/* Locale-specific memory comparison.
Copyright (C) 2002-2004, 2006, 2009-2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Contributed by Paul Eggert <eggert@twinsun.com>. */
#include <config.h>
#include <errno.h>
#include <stdlib.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "error.h"
#include "exitfail.h"
#include "memcoll.h"
#include "quotearg.h"
#include "xmemcoll.h"
static void
collate_error (int collation_errno,
char const *s1, size_t s1len,
char const *s2, size_t s2len)
{
error (0, collation_errno, _("string comparison failed"));
error (0, 0, _("Set LC_ALL='C' to work around the problem."));
error (exit_failure, 0,
_("The strings compared were %s and %s."),
quotearg_n_style_mem (0, locale_quoting_style, s1, s1len),
quotearg_n_style_mem (1, locale_quoting_style, s2, s2len));
}
/* Compare S1 (with length S1LEN) and S2 (with length S2LEN) according
to the LC_COLLATE locale. S1 and S2 do not overlap, and are not
adjacent. Temporarily modify the bytes after S1 and S2, but
restore their original contents before returning. Report an error
and exit if there is an error. */
int
xmemcoll (char *s1, size_t s1len, char *s2, size_t s2len)
{
int diff = memcoll (s1, s1len, s2, s2len);
int collation_errno = errno;
if (collation_errno)
collate_error (collation_errno, s1, s1len, s2, s2len);
return diff;
}
/* Compare S1 (a memory block of size S1SIZE, with a NUL as last byte)
and S2 (a memory block of size S2SIZE, with a NUL as last byte)
according to the LC_COLLATE locale. S1SIZE and S2SIZE must be > 0.
Report an error and exit if there is an error. */
int
xmemcoll0 (char const *s1, size_t s1size, char const *s2, size_t s2size)
{
int diff = memcoll0 (s1, s1size, s2, s2size);
int collation_errno = errno;
if (collation_errno)
collate_error (collation_errno, s1, s1size - 1, s2, s2size - 1);
return diff;
}
|
#ifndef __dovo_searchStatus__
#define __dovo_searchStatus__
/**
@file
Subclass of searchStatus, which is generated by wxFormBuilder.
*/
#include "gui.h"
//// end generated include
#include "dicomscanner.h"
#include <wx/timer.h>
/** Implementing searchStatus */
class dovo_searchStatus : public searchStatus
{
protected:
// Handlers for searchStatus events.
void OnStop( wxCommandEvent& event );
public:
/** Constructor */
dovo_searchStatus( wxWindow* parent );
//// end generated class members
~dovo_searchStatus();
wxTimer timer;
void OnTimer( wxTimerEvent& event );
DICOMFileScanner *m_scanner;
};
#endif // __dovo_searchStatus__
|
// XtraBYtes - The Proof of Signature Blocktech Superchain - http://xtrabytes.global
// Copyright (c) 2017, Zoltan Szabo. All rights reserved.
// Copyright (c) 2017, XtraBYtes Founders and Developers ( see AUTHORS )
// Licensed under GNU General Public License Version 3 or later (the "GPL")
// REDFAT Database - REdundant Distributed FAult Tolerant Database
#ifndef XBY_REDFAT_H
#define XBY_REDFAT_H
class REDFAT {
public:
REDFAT();
};
extern REDFAT redfat;
#endif // XBY_REDFAT_H
|
/*
* Copyright (C) 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef RenderMultiColumnBlock_h
#define RenderMultiColumnBlock_h
#include "RenderBlock.h"
namespace WebCore {
class RenderMultiColumnBlock : public RenderBlock {
public:
RenderMultiColumnBlock(Node*);
private:
virtual const char* renderName() const;
virtual bool recomputeLogicalWidth();
void computeColumnCountAndWidth();
private:
unsigned m_columnCount; // The default column count/width that are based off our containing block width. These values represent only the default,
LayoutUnit m_columnWidth; // since a multi-column block that is split across variable width pages or regions will have different column counts and widths in each.
// These values will be cached (eventually) for multi-column blocks.
};
} // namespace WebCore
#endif // RenderMultiColumnBlock_h
|
#pragma once
#include "DrawCommon.h"
#include "CPlayerUIBase.h"
class CPlayerUI : public CPlayerUIBase
{
public:
CPlayerUI(UIData& ui_data, CWnd* pMainWnd);
~CPlayerUI();
//virtual void RButtonUp(CPoint point) override;
virtual void MouseMove(CPoint point) override;
//virtual void OnSizeRedraw(int cx, int cy) override;
//virtual CRect GetThumbnailClipArea() override;
private:
virtual void _DrawInfo(CRect draw_rect, bool reset = false) override; //绘制信息
virtual int GetClassId() override;
void DrawLyricsArea(CRect lyric_rect); //普通模式下绘制歌词区域
CSize SpectralSize();
};
|
/* src/config.h. CHORDII config.h for Microsoft Windows. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
/* #undef CRAY_STACKSEG_END */
/* Define to 1 if using `alloca.c'. */
/* #undef C_ALLOCA */
/* Define to 1 if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#define PACKAGE "chordii"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "jvromans@users.sourceforge.net"
/* Define to the full name of this package. */
#define PACKAGE_NAME "Chordii"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "Chordii 4.3"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "chordii"
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.3"
/* Define to the minor version (aka patch level) of this package. */
#define PATCH_LEVEL "0"
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
/* #undef STACK_DIRECTION */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "4.3"
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
|
/*
* 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.
*
* Copyright © 2011-2012
* @author Francisco Aisa Garcia
*/
#ifndef __GUI_CONVERSIONS_H__
#define __GUI_CONVERSIONS_H__
#include "GUIEventArgs.h"
/**
* This file contains all the conversions needed to fully abstract the GUI project.
*/
namespace GUI {
inline GUIEventArgs CEGUIEventArgsToGUIEventArgs() {
return GUIEventArgs();
}
};
#endif |
#pragma once
#include "core/Common.h"
#include "geometry/Mesh.h"
#include <filesystem/path.h>
#include <ostream>
#include <istream>
#include <memory>
namespace pbs {
class Cache {
public:
Cache(const filesystem::path &dir);
void clear();
void commit();
bool valid() const { return _valid; }
int frame() const { return _frame; }
void setFrame(int frame);
int frameCount() const { return _frameCount; }
void setFrameCount(int frameCount);
void writeParticles(const std::vector<Vector3f> &particles);
bool readParticles(std::vector<Vector3f> &particles);
void writeMesh(const Mesh &mesh);
bool readMesh(Mesh &mesh);
private:
void writeMeta();
bool readMeta();
filesystem::path pathFor(const std::string &type, int frame) const;
std::unique_ptr<std::ostream> ostreamFor(const std::string &type, int frame) const;
std::unique_ptr<std::istream> istreamFor(const std::string &type, int frame) const;
filesystem::path _dir;
bool _valid;
int _frame;
int _frameCount;
};
} // namespace pbs
|
/* Grapheme cluster break property function.
Copyright (C) 2010-2014 Free Software Foundation, Inc.
Written by Ben Pfaff <blp@cs.stanford.edu>, 2010.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "unigbrk.h"
#include "gbrkprop.h"
int
uc_graphemeclusterbreak_property (ucs4_t uc)
{
unsigned int index1 = uc >> gbrkprop_header_0;
if (index1 < gbrkprop_header_1)
{
int lookup1 = unigbrkprop.level1[index1];
if (lookup1 >= 0)
{
unsigned int index2 = (uc >> gbrkprop_header_2) & gbrkprop_header_3;
int lookup2 = unigbrkprop.level2[lookup1 + index2];
if (lookup2 >= 0)
{
unsigned int index3 = uc & gbrkprop_header_4;
unsigned char lookup3 = unigbrkprop.level3[lookup2 + index3 / 2];
return (lookup3 >> ((uc & 1) << 2)) & 0x0f;
}
}
}
return GBP_OTHER;
}
|
#include <stdio.h>
#include "RngStream.h"
// random generator state
typedef struct {
struct rng_state g;
double prev_normal;
} RndState;
typedef struct {
struct rng_jump j;
int e;
} RndJump;
int randomise_from(FILE *p, RndState *S);
int spawn_gen(RndState *S0, RndState *S1);
void InitRndState(RndState *S);
double Raw(RndState *);
double Uniform(RndState *);
double Normal(RndState *);
double Exponential(RndState *);
double Gamma(RndState *,double a);
long Poisson(RndState *,double a);
int Dirichlet(RndState *,long n, double *a, double *x);
double Beta(RndState *,double a, double b);
long Zeta(RndState *,double a);
int Binomial(RndState *,double p, int n);
double Stable(RndState *,int param,double a, double b);
long Discrete(RndState *, long n, double *p, double tot);
double pdf_Normal(double x);
double pdf_Beta(double a, double b, double x);
double pdf_Gamma(double a, double x);
double pdf_Exponential(double x);
double pdf_Zeta(double s, long x);
double pdf_Poisson(double m, long x);
double pdf_Binomial(double p, long n, long int x);
double pdf_Dirichlet(long n, double *a, double *x);
double pdf_Discrete(long n, double *p, double tot, long x);
double pdf_Uniform(double x);
double logpdf_Dirichlet(long n, double *a, double *x);
double logpdf_Dirichlet_log(long n, double *a, double *lx);
double lngamma(double x);
double psi(double x);
int vector_psi(long n, double *a, double *x);
double vector_betaln(long n, double *a);
void initialise();
|
/*
* This file is part of Cleanflight.
*
* Cleanflight is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Cleanflight 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define TARGET_BOARD_IDENTIFIER "CPM1" // CrazePony MINI
#define BRUSHED_MOTORS
#define LED0 PA11
#define LED1 PA8
#define LED2 PB1
#define USE_ACC
#define USE_ACC_MPU6050
#define USE_GYRO
#define USE_GYRO_MPU6050
#define USE_BARO
#define USE_BARO_MS5611
//#define USE_MAG
//#define USE_MAG_HMC5883
#define USE_UART1
#define SERIAL_PORT_COUNT 1
#define USE_ADC
#define ADC_CHANNEL_1_PIN PB0
#define VBAT_ADC_CHANNEL ADC_CHN_1
#define USE_I2C
#define USE_I2C_DEVICE_1
#define USE_SPI
#define USE_SPI_DEVICE_1
#define USE_RX_SPI
#define RX_SPI_INSTANCE SPI1
#define USE_RX_NRF24
//#define USE_RX_CX10
//#define USE_RX_H8_3D
//#define USE_RX_SYMA
#define USE_RX_V202
#define NRF24_DEFAULT_PROTOCOL NRF24RX_V202_1M
// Nordic Semiconductor uses 'CSN', STM uses 'NSS'
#define RX_CE_PIN PA12
#define RX_CE_GPIO_CLK_PERIPHERAL RCC_APB2Periph_GPIOA
#define RX_NSS_PIN PA4
#define RX_NSS_GPIO_CLK_PERIPHERAL RCC_APB2Periph_GPIOA
#define RX_IRQ_PIN PA15
#define RX_IRQ_GPIO_CLK_PERIPHERAL RCC_APB2Periph_GPIOA
#undef USE_RX_MSP
#define SKIP_INFLIGHT_ADJUSTMENTS
#undef USE_SERIAL_PASSTHROUGH
#undef USE_RX_PWM
#undef USE_RX_PPM
#undef USE_SERIAL_RX
#undef USE_BLACKBOX
#define DEFAULT_RX_TYPE RX_TYPE_SPI
// Since the CrazePony MINI PCB has holes for 4 motors in each corner we can save same flash space by disabling support for other mixers.
#undef USE_SERVOS
#define USE_QUAD_MIXER_ONLY
// Number of available PWM outputs
#define MAX_PWM_OUTPUT_PORTS 4
// IO - assuming all IOs on 48pin package TODO
#define TARGET_IO_PORTA 0xffff
#define TARGET_IO_PORTB 0xffff
#define USABLE_TIMER_CHANNEL_COUNT 14
#define USED_TIMERS TIM_N(2)
|
/* Optimized string comparison.
Copyright (C) 2001-2002, 2007, 2009-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>. */
#ifndef _GL_STREQ_H
#define _GL_STREQ_H
#include <string.h>
/* STREQ_OPT allows to optimize string comparison with a small literal string.
STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
is semantically equivalent to
strcmp (s, "EUC-KR") == 0
just faster. */
/* Help GCC to generate good code for string comparisons with
immediate strings. */
#if defined (__GNUC__) && defined (__OPTIMIZE__)
static inline int
streq9 (const char *s1, const char *s2)
{
return strcmp (s1 + 9, s2 + 9) == 0;
}
static inline int
streq8 (const char *s1, const char *s2, char s28)
{
if (s1[8] == s28)
{
if (s28 == 0)
return 1;
else
return streq9 (s1, s2);
}
else
return 0;
}
static inline int
streq7 (const char *s1, const char *s2, char s27, char s28)
{
if (s1[7] == s27)
{
if (s27 == 0)
return 1;
else
return streq8 (s1, s2, s28);
}
else
return 0;
}
static inline int
streq6 (const char *s1, const char *s2, char s26, char s27, char s28)
{
if (s1[6] == s26)
{
if (s26 == 0)
return 1;
else
return streq7 (s1, s2, s27, s28);
}
else
return 0;
}
static inline int
streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28)
{
if (s1[5] == s25)
{
if (s25 == 0)
return 1;
else
return streq6 (s1, s2, s26, s27, s28);
}
else
return 0;
}
static inline int
streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28)
{
if (s1[4] == s24)
{
if (s24 == 0)
return 1;
else
return streq5 (s1, s2, s25, s26, s27, s28);
}
else
return 0;
}
static inline int
streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28)
{
if (s1[3] == s23)
{
if (s23 == 0)
return 1;
else
return streq4 (s1, s2, s24, s25, s26, s27, s28);
}
else
return 0;
}
static inline int
streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
{
if (s1[2] == s22)
{
if (s22 == 0)
return 1;
else
return streq3 (s1, s2, s23, s24, s25, s26, s27, s28);
}
else
return 0;
}
static inline int
streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
{
if (s1[1] == s21)
{
if (s21 == 0)
return 1;
else
return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28);
}
else
return 0;
}
static inline int
streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
{
if (s1[0] == s20)
{
if (s20 == 0)
return 1;
else
return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28);
}
else
return 0;
}
#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
#else
#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
(strcmp (s1, s2) == 0)
#endif
#endif /* _GL_STREQ_H */
|
/*
MzScheme
Copyright (c) 2004-2007 PLT Scheme Inc.
Copyright (c) 1995-2001 Matthew Flatt
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA.
libscheme
Copyright (c) 1994 Brent Benson
All rights reserved.
*/
/* Images are long since unsupported, so all that's left is this
little trampoline. */
#include "schpriv.h"
MZ_DLLSPEC int (*scheme_actual_main)(int argc, char **argv);
void scheme_set_actual_main(int (*m)(int argc, char **argv))
{
scheme_actual_main = m;
}
int scheme_image_main(int argc, char **argv)
{
return scheme_actual_main(argc, argv);
}
void scheme_no_dumps(char *why)
{
}
|
/*
Copyright (C) 2016-18 Diego Darriba, Alexey Kozlov
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Diego Darriba <Diego.Darriba@h-its.org>,
Exelixis Lab, Heidelberg Instutute for Theoretical Studies
Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
*/
#ifndef PLLMOD_COMMON_H_
#define PLLMOD_COMMON_H_
#define PLLMOD_COMMON_BRLEN_LINKED 0
#define PLLMOD_COMMON_BRLEN_SCALED 1
#define PLLMOD_COMMON_BRLEN_UNLINKED 2
#define PLLMOD_COMMON_REDUCE_SUM 0
#define PLLMOD_COMMON_REDUCE_MAX 1
#define PLLMOD_COMMON_REDUCE_MIN 2
#define PLLMOD_UNUSED(expr) do { (void)(expr); } while (0)
#define PLLMOD_ERRMSG_LEN 200
/* common error codes for all libpll modules (1001-2000)*/
#define PLLMOD_ERROR_INVALID_RANGE 1001
#define PLLMOD_ERROR_INVALID_NODE_TYPE 1002
#define PLLMOD_ERROR_INVALID_INDEX 1003
#define PLLMOD_ERROR_NOT_IMPLEMENTED 1004
void pllmod_set_error(int errno, const char* errmsg_fmt, ...);
void pllmod_reset_error();
#endif
|
/*
This file is part of Desperion.
Copyright 2010, 2011 LittleScaraby, Nekkro
Desperion is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Desperion 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 Desperion. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __OBJECT_EFFECTS__
#define __OBJECT_EFFECTS__
class ObjectEffects : public DofusModel
{
public:
int16 powerRate;
bool overMax;
std::vector<ObjectEffectPtr> effects;
uint16 GetProtocol() const
{ return OBJECT_EFFECTS; }
ObjectEffects()
{
}
ObjectEffects(int16 powerRate, bool overMax, std::vector<ObjectEffectPtr>& effects) : powerRate(powerRate), overMax(overMax), effects(effects)
{
}
void Serialize(ByteBuffer& data) const
{
data<<powerRate<<overMax;
uint16 size = effects.size();
data<<size;
for(uint16 a = 0; a < size; ++a)
{
data<<effects[a]->GetProtocol();
effects[a]->Serialize(data);
}
}
void Deserialize(ByteBuffer& data)
{
data>>powerRate>>overMax;
effects.clear();
uint16 size;
data>>size;
for(uint16 a = 0; a < size; ++a)
{
uint16 protocol;
data>>protocol;
ObjectEffectPtr model(Desperion::ProtocolTypeManager::GetObjectEffect(protocol));
model->Deserialize(data);
effects.push_back(model);
}
}
};
typedef boost::shared_ptr<ObjectEffects> ObjectEffectsPtr;
#endif |
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @author Ratnadip Choudhury
* @copyright Copyright (c) 2011, Robert Bosch Engineering and Business Solutions. All rights reserved.
*/
#pragma once
/* Project includes */
#include "SignalWatch_resource.h" // main symbols
class CSignalWatchApp : public CWinApp
{
public:
virtual BOOL InitInstance();
virtual INT ExitInstance();
};
|
/* log.c - Messaging routines.
*
* Copyright (C) 2017 Daniele Cattaneo
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdarg.h>
#include "log.h"
void log_msg(int level, const char *msg, ...)
{
va_list ap;
#ifdef DEBUG
int minlev = LOG_LEVEL_DEBUG;
#else
int minlev = LOG_LEVEL_CRITICAL;
#endif
if (level >= minlev) {
va_start(ap, msg);
vfprintf(stderr, msg, ap);
va_end(ap);
}
}
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#pragma once
#include <cstdint>
#include <map>
#include <memory>
#include "nl_l3_interfaces.h"
extern "C" {
struct nl_addr;
struct rtnl_link;
struct rtnl_neigh;
}
namespace basebox {
class cnetlink;
class nl_l3;
class nl_bridge;
class switch_interface;
struct tunnel_nh;
class nl_vxlan : public net_reachable, nh_reachable {
public:
nl_vxlan(std::shared_ptr<nl_l3> l3, cnetlink *nl);
~nl_vxlan() {}
int init();
void net_reachable_notification(struct net_params) noexcept override;
void nh_reachable_notification(struct nh_params) noexcept override;
int create_vni(rtnl_link *link);
int remove_vni(rtnl_link *link);
void register_switch_interface(switch_interface *sw);
void register_bridge(nl_bridge *bridge);
int add_l2_neigh(rtnl_neigh *neigh, rtnl_link *vxlan_link,
rtnl_link *br_link);
int delete_l2_neigh(rtnl_neigh *neigh, rtnl_link *vxlan_link,
rtnl_link *br_link);
int get_tunnel_id(rtnl_link *vxlan_link, uint32_t *vni,
uint32_t *tunnel_id) noexcept;
int get_tunnel_id(uint32_t vni, uint32_t *tunnel_id) noexcept;
int create_access_port(rtnl_link *br_link, uint32_t tunnel_id,
const std::string &access_port_name, uint32_t pport_no,
uint16_t vid, bool untagged, uint32_t *lport);
int delete_access_port(rtnl_link *br_link, uint32_t pport_no, uint16_t vid,
bool wipe_l2_addresses);
int create_endpoint(rtnl_link *vxlan_link);
int delete_endpoint(rtnl_link *vxlan_link);
private:
int create_endpoint(rtnl_link *vxlan_link, rtnl_link *br_link,
nl_addr *group);
int create_endpoint(rtnl_link *vxlan_link, nl_addr *local_, nl_addr *group_,
uint32_t _next_hop_id, uint32_t *_port_id);
int delete_endpoint(rtnl_link *vxlan_link, nl_addr *local_, nl_addr *group_);
int create_next_hop(rtnl_link *vxlan_link, nl_addr *remote,
uint32_t *next_hop_id);
int create_next_hop(rtnl_neigh *neigh, uint32_t *_next_hop_id);
int delete_next_hop(rtnl_neigh *neigh);
int delete_next_hop(uint32_t nh_id);
int delete_next_hop(const struct tunnel_nh &);
int enable_flooding(uint32_t tunnel_id, uint32_t lport_id);
int disable_flooding(uint32_t tunnel_id, uint32_t lport_id);
int add_l2_neigh(rtnl_neigh *neigh, uint32_t lport, uint32_t tunnel_id);
int delete_l2_neigh_access(rtnl_link *link, uint16_t vlan,
nl_addr *neigh_mac);
int delete_l2_neigh_endpoint(rtnl_link *vxlan_link, nl_addr *local,
nl_addr *remote, nl_addr *neigh_mac);
int delete_l2_neigh(uint32_t tunnel_id, nl_addr *neigh_mac);
// XXX TODO handle these better and prevent id overflow
uint32_t next_hop_id_cnt = 1;
uint32_t port_id_cnt = 1 << 16 | 1;
uint32_t tunnel_id_cnt = 10;
std::map<uint32_t, int> vni2tunnel;
switch_interface *sw;
nl_bridge *bridge;
std::shared_ptr<nl_l3> l3;
cnetlink *nl;
};
} // namespace basebox
|
#pragma once
#include "../software_global.h"
#include "Color.h"
namespace paysages {
namespace software {
/**
* Abstract class for all cloud models (cirrus, cumulus...).
*/
class SOFTWARESHARED_EXPORT BaseCloudsModel {
public:
BaseCloudsModel(CloudLayerDefinition *layer);
virtual ~BaseCloudsModel();
virtual void update();
virtual void getAltitudeRange(double *min_altitude, double *max_altitude) const;
virtual void getDetailRange(double *min_step, double *max_step) const;
virtual double getProbability(const Vector3 &location, double radius) const;
virtual double getDensity(const Vector3 &location, double precision) const;
virtual Color filterLight(const Color &light, double length, double density) const;
virtual Color applyLightExit(const Color &light, const Vector3 &light_direction,
const Vector3 &direction_to_eye) const;
inline CloudLayerDefinition *getLayer() const {
return layer;
}
protected:
CloudLayerDefinition *layer;
};
}
}
|
//
// Aspia Project
// Copyright (C) 2021 Dmitry Chapyshev <dmitry@aspia.ru>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef CLIENT__UI__SYS_INFO_DRIVERS_H
#define CLIENT__UI__SYS_INFO_DRIVERS_H
#include "client/ui/sys_info_widget.h"
#include "ui_sys_info_widget_drivers.h"
namespace client {
class SysInfoWidgetDrivers : public SysInfoWidget
{
Q_OBJECT
public:
SysInfoWidgetDrivers(QWidget* parent = nullptr);
~SysInfoWidgetDrivers();
// SysInfo implementation.
std::string category() const override;
void setSystemInfo(const proto::SystemInfo& system_info) override;
QTreeWidget* treeWidget() override;
private slots:
void onContextMenu(const QPoint& point);
private:
static QString statusToString(proto::system_info::Drivers::Driver::Status status);
static QString startupTypeToString(
proto::system_info::Drivers::Driver::StartupType startup_type);
Ui::SysInfoDrivers ui;
int current_column_ = 0;
};
} // namespace client
#endif // CLIENT__UI__SYS_INFO_DRIVERS_H
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_MessagePortChild_h
#define mozilla_dom_MessagePortChild_h
#include "mozilla/Assertions.h"
#include "mozilla/dom/PMessagePortChild.h"
#include "nsISupportsImpl.h"
namespace mozilla {
namespace dom {
class MessagePort;
class MessagePortChild final : public PMessagePortChild
{
public:
NS_INLINE_DECL_REFCOUNTING(MessagePortChild)
MessagePortChild() : mPort(nullptr) {}
void SetPort(MessagePort* aPort)
{
mPort = aPort;
}
private:
~MessagePortChild()
{
MOZ_ASSERT(!mPort);
}
virtual mozilla::ipc::IPCResult
RecvEntangled(nsTArray<ClonedMessageData>&& aMessages) override;
virtual mozilla::ipc::IPCResult
RecvReceiveData(nsTArray<ClonedMessageData>&& aMessages) override;
virtual mozilla::ipc::IPCResult RecvStopSendingDataConfirmed() override;
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
// This is a raw pointer because this child is owned by this MessagePort.
MessagePort* mPort;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_MessagePortChild_h
|
#ifndef SYSTEM_DYNALIB_DEFINE_H_
#define SYSTEM_DYNALIB_DEFINE_H_
// #define USER_FIRMWARE_IMAGE_SIZE 0x40000
// #define USER_FIRMWARE_IMAGE_LOCATION 0x80C0000
// #define MODULAR_FIRMWARE 1
// #define MODULE_VERSION 2
// #define MODULE_FUNCTION 5
// #define MODULE_INDEX 1
// #define MODULE_DEPENDENCY {4,2,3}
// #define RELEASE_BUILD
// #define SPARK 1
// #define START_DFU_FLASHER_SERIAL_SPEED 14400
// #define START_YMODEM_FLASHER_SERIAL_SPEED 28800
#endif
|
#ifndef ORZ_BASE_CONTROL_H_INCLUDED
#define ORZ_BASE_CONTROL_H_INCLUDED
#include "orz_base_math.h"
#include "orz_base_ui.h"
#define WRITER_DISTANCE 1000.0f
#define SPRITE_DISTANCE 500.0f
namespace Orz
{
//const long SHORT_SIGN_DELTA_TIME = 150;
//const long DOUBLE_CLICK_DELTA_TIME = 150;
// »ù´¡¿Ø¼þÀà - ´¿ÐéÀà
class BaseControl: public BaseUi
{
public:
// ¹¹Ô캯Êý
BaseControl(ElementType Type);
// ÐÞ¸ÄÊôÐÔ
BaseControl& ChangeBackgroundColor(const Color &BackGroundColor);
// »ñÈ¡ÊôÐÔ
const Color& GetBackgroundColor(void);
ControlMessage GetControlMessage(void);
ControlState GetControlState(void);
// DoContact º¯ÊýÖÐ--------------------------------------------------------------- |
// ÁùÖÖÀíÏëÐźÅ: |
// 1.¶ÌÐźŠ2.³¤ÐźŠ|
// 3.¶Ì,¶ÌÐͺŠ3.³¤,³¤ÐźŠ|
// 2.¶Ì,³¤ÐźŠ4.³¤,¶ÌÐźŠ|
// |
// ÆäËûÐźÅ: Ðźŷ¢Ëͼä¸ôµÈ |
// |
// |
// ________ |
//_________| |______________________________ µ¥»÷ |
// |
// _____________________________ |
//_________| |_________ ³¤°´ |
// |
// _______ _______ |
//_________| |_________| |_____________ Á½´Îµ¥»÷ |
// |
// _______ _______ |
//_________| |_____| |_________________ Ë«»÷ |
// |
// |_____| |
// | |
// | __DOUBLE_CLICK_DELTA_TIME |
// |
// __________________¶ÌÐźÅʱ¼ä SHORT_SIGN_TIME |
// ___|___ |
// | | |
// _______ |
//_________| |_________________________ ¶ÌÐźŠ|
// |
// _____________________________ |
//_________| |___ ³¤ÐźŠ(ʱ¼ä³¬¹ý¶ÌÐźŵľÍÊdz¤ÐźÅ) |
// |
// _______ |
//_________| |_________________________ ¶ÌÐźŠ|
// ________________________________________________________________________________ |
void DoContactReset(void); // ×¢ÒâʹÓñ¾º¯Êý!
void DoContact(void);
private:
// ±³¾°ÑÕÉ«
Color control_background_color;
// ÏûÏ¢ and ״̬
ControlMessage control_message;
ControlState control_state;
// DoContact ¼Ç¼ÓÃÏûÏ¢
unsigned long sign_start_time, sign_end_time;
bool is_last_down, is_last_short_sign;
bool is_mouse_over;
};
}
#endif // ORZ_CONTROL_H_INCLUDED
|
#ifndef VersionInfoIdeInteractionH
#define VersionInfoIdeInteractionH
extern void PACKAGE __fastcall EnableVersionInfoInIDE(void);
#endif
|
{#-
# Jinja2 template for generating server header. for Legato APIs.
#
# Copyright (C) Sierra Wireless Inc.
#}
{% extends "TEMPLATE_header.h" %}
{%- block InterfaceHeader %}
{%- if args.async %}
//--------------------------------------------------------------------------------------------------
/**
* Command reference for async server-side function support. The interface function receives the
* reference, and must pass it to the corresponding respond function.
*/
//--------------------------------------------------------------------------------------------------
typedef struct {{apiName}}_ServerCmd* {{apiName}}_ServerCmdRef_t;
{%- endif %}{% if imports %}
// Interface specific includes
{%- for import in imports %}
#include "{{import}}_server.h"
{%- endfor %}
{%- endif %}
{%- endblock %}
{% block GenericFunctions -%}
{% if functions or handlers -%}
//--------------------------------------------------------------------------------------------------
/**
* Get the server service reference
*/
//--------------------------------------------------------------------------------------------------
le_msg_ServiceRef_t {{apiName}}_GetServiceRef
(
void
);
//--------------------------------------------------------------------------------------------------
/**
* Get the client session reference for the current message
*/
//--------------------------------------------------------------------------------------------------
le_msg_SessionRef_t {{apiName}}_GetClientSessionRef
(
void
);
//--------------------------------------------------------------------------------------------------
/**
* Initialize the server and advertise the service.
*/
//--------------------------------------------------------------------------------------------------
void {{apiName}}_AdvertiseService
(
void
);
{%- endif %}
{%- endblock %}
{% block FunctionDeclaration %}
{%- if not args.async %}
{{ super() }}
{%- else %}
{%- if function is EventFunction or function is HasCallbackFunction %}
{{ super() }}
{%- else %}
//--------------------------------------------------------------------------------------------------
/**
* Server-side respond function for {{apiName}}_{{function.name}}
*/
//--------------------------------------------------------------------------------------------------
void {{apiName}}_{{function.name}}Respond
(
{{apiName}}_ServerCmdRef_t _cmdRef
{%- if function.returnType %},
{{function.returnType|FormatType}} _result
{%- endif %}
{%- for parameter in function|CAPIParameters if parameter is OutParameter %},
{{parameter|FormatParameter(forceInput=True)}}
{%- endfor %}
);
//--------------------------------------------------------------------------------------------------
/**
* Prototype for server-side async interface function
*/
//--------------------------------------------------------------------------------------------------
void {{apiName}}_{{function.name}}
(
{{apiName}}_ServerCmdRef_t _cmdRef
{%- for parameter in function|CAPIParameters if parameter is InParameter %},
{{parameter|FormatParameter(forceInput=True)}}
{%- endfor %}
);
{%- endif %}
{%- endif %}
{% endblock %}
|
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2008-2015 MonetDB B.V.
*/
#ifndef _SEEN_GLOB_H
#define _SEEN_GLOB_H 1
char glob(const char *expr, const char *haystack);
#endif
/* vim:set ts=4 sw=4 noexpandtab: */
|
/* This file is part of VoltDB.
* Copyright (C) 2008-2018 VoltDB Inc.
*
* This file contains original code and/or modifications of original code.
* Any modifications made by VoltDB Inc. are licensed under the following
* terms and conditions:
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with VoltDB. If not, see <http://www.gnu.org/licenses/>.
*/
/* Copyright (C) 2008 by H-Store Project
* Brown University
* Massachusetts Institute of Technology
* Yale University
*
* 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 BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef HSTORESCALARVALUEEXPRESSION_H
#define HSTORESCALARVALUEEXPRESSION_H
#include "expressions/abstractexpression.h"
#include <string>
namespace voltdb {
class ScalarValueExpression : public AbstractExpression {
public:
ScalarValueExpression(AbstractExpression *lc)
: AbstractExpression(EXPRESSION_TYPE_VALUE_SCALAR, lc, NULL)
{};
voltdb::NValue eval(const TableTuple *tuple1, const TableTuple *tuple2) const;
std::string debugInfo(const std::string &spacer) const;
};
}
#endif
|
#ifndef _CHARCODER_H_
#define _CHARCODER_H_
#include <string>
namespace restonce{
// encode every char to 16-step number's string
std::string encoder(const std::string& );
// decode from a 16-step number's string,
// if not hex, return front covert out
std::string decoder(const std::string& );
}
#endif // _CHARCODER_H_
|
/*SPEL virtual machine
Copyright (C) 2016 Logan Streondj
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
contact: streondj at gmail dot com
*/
#ifndef PROGRAMMER_H
#define PROGRAMMER_H
#include "../seed/seed.h"
/* requires including seed.h */
void composition_program(const uint8_t activity_atom_size,
const v16us *activity_atom,
const uint16_t program_size, uint64_t *random_seed,
v16us *program);
void quiz_program(const uint16_t quiz_independentClause_size,
const v16us *quiz_independentClause_list,
const uint16_t program_size, const v16us *program,
uint16_t *program_worth);
void composition_population(const uint8_t activity_atom_size,
const v16us *activity_atom,
const uint16_t program_size,
const uint8_t population_size,
uint64_t *random_seed, v16us *population);
void quiz_population(const uint16_t quiz_independentClause_size,
const v16us *quiz_independentClause_list,
const uint16_t program_size, const uint8_t population_size,
const v16us *population, uint8_t *champion,
uint16_t *champion_worth);
#endif
|
/* symbol: Constants and prototypes for symbol functions. */
#define T new_symbol("T")
#define NIL NULL
symbol *new_symbol (char *);
symbol *symbolic_equality (symbol *, symbol *);
symbol *symbol_p (value *);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.