text
stringlengths
4
6.14k
#pragma once #include "Scene.h" #include "Woman.h" #include "ReaZyu.h" #include "Botch.h" #include "Sweats.h" #include "CharaButton.h" #include "Button.h" #include <list> class GameScene : public Scene { public: GameScene(GameModes* gameMode, BasicInput* input); ~GameScene(); void init(); void update(); float time; float timeFromBegin; float beginTime; private: long lastWomanSpawn = 0; std::list<DrawableBase*> Drawables; std::list<Botch> Botchs; std::list<Sweats> Sweats; std::list<CharaButton> CharaButtons; ReaZyu *reaZyu; void drawTimerString(); int backgroundHandle; };
/* * linux/net/sunrpc/sysctl.c * * Sysctl interface to sunrpc module. * * I would prefer to register the sunrpc table below sys/net, but that's * impossible at the moment. */ #include <linux/types.h> #include <linux/linkage.h> #include <linux/ctype.h> #include <linux/fs.h> #include <linux/sysctl.h> #include <linux/module.h> #include <asm/uaccess.h> #include <linux/sunrpc/types.h> #include <linux/sunrpc/sched.h> #include <linux/sunrpc/stats.h> #include <linux/sunrpc/svc_xprt.h> #include "netns.h" /* * Declare the debug flags here */ unsigned int rpc_debug; EXPORT_SYMBOL_GPL(rpc_debug); unsigned int nfs_debug; EXPORT_SYMBOL_GPL(nfs_debug); unsigned int nfsd_debug; EXPORT_SYMBOL_GPL(nfsd_debug); unsigned int nlm_debug; EXPORT_SYMBOL_GPL(nlm_debug); #ifdef RPC_DEBUG static struct ctl_table_header *sunrpc_table_header; static ctl_table sunrpc_table[]; void rpc_register_sysctl(void) { if (!sunrpc_table_header) sunrpc_table_header = register_sysctl_table(sunrpc_table); } void rpc_unregister_sysctl(void) { if (sunrpc_table_header) { unregister_sysctl_table(sunrpc_table_header); sunrpc_table_header = NULL; } } static int proc_do_xprt(ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { char tmpbuf[256]; size_t len; if ((*ppos && !write) || !*lenp) { *lenp = 0; return 0; } len = svc_print_xprts(tmpbuf, sizeof(tmpbuf)); return simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len); } static int proc_dodebug(ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { char tmpbuf[20], c, *s; char __user *p; unsigned int value; size_t left, len; if ((*ppos && !write) || !*lenp) { *lenp = 0; return 0; } left = *lenp; if (write) { if (!access_ok(VERIFY_READ, buffer, left)) return -EFAULT; p = buffer; while (left && __get_user(c, p) >= 0 && isspace(c)) left--, p++; if (!left) goto done; if (left > sizeof(tmpbuf) - 1) return -EINVAL; if (copy_from_user(tmpbuf, p, left)) return -EFAULT; tmpbuf[left] = '\0'; for (s = tmpbuf, value = 0; '0' <= *s && *s <= '9'; s++, left--) value = 10 * value + (*s - '0'); if (*s && !isspace(*s)) return -EINVAL; while (left && isspace(*s)) left--, s++; *(unsigned int *) table->data = value; /* Display the RPC tasks on writing to rpc_debug */ if (strcmp(table->procname, "rpc_debug") == 0) rpc_show_tasks(&init_net); } else { if (!access_ok(VERIFY_WRITE, buffer, left)) return -EFAULT; len = sprintf(tmpbuf, "%d", *(unsigned int *) table->data); if (len > left) len = left; if (__copy_to_user(buffer, tmpbuf, len)) return -EFAULT; if ((left -= len) > 0) { if (put_user('\n', (char __user *)buffer + len)) return -EFAULT; left--; } } done: *lenp -= left; *ppos += *lenp; return 0; } static ctl_table debug_table[] = { { .procname = "rpc_debug", .data = &rpc_debug, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dodebug }, { .procname = "nfs_debug", .data = &nfs_debug, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dodebug }, { .procname = "nfsd_debug", .data = &nfsd_debug, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dodebug }, { .procname = "nlm_debug", .data = &nlm_debug, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dodebug }, { .procname = "transports", .maxlen = 256, .mode = 0444, .proc_handler = proc_do_xprt, }, { } }; static ctl_table sunrpc_table[] = { { .procname = "sunrpc", .mode = 0555, .child = debug_table }, { } }; #endif
/* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * All rights reserved * Versions of malloc and friends that check their results, and never return * failure (they call fatal if they encounter an error). * * As far as I am concerned, the code I have written for this software * can be used freely for any purpose. Any derived versions of this * software must be clearly marked as such, and if the derived work is * incompatible with the protocol description in the RFC file, it must be * called by a name other than "ssh" or "Secure Shell". */ /* xmalloc.c taken from OpenSSH and adapted */ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> #ifndef SIZE_T_MAX #define SIZE_T_MAX UINT_MAX #endif #include <netcore-ng/macros.h> #include <netcore-ng/xmalloc.h> #include <netcore-ng/strlcpy.h> void *xmalloc(size_t size) { void *ptr; if (size == 0) { err("xmalloc: zero size"); exit(EXIT_FAILURE); } ptr = malloc(size); if (ptr == NULL) { err("xmalloc: out of memory (allocating %lu bytes)", (u_long) size); exit(EXIT_FAILURE); } return ptr; } void *xzmalloc(size_t size) { void *ptr; if (size == 0) { err("xmalloc: zero size"); exit(EXIT_FAILURE); } ptr = malloc(size); if (ptr == NULL) { err("xmalloc: out of memory (allocating %lu bytes)", (u_long) size); exit(EXIT_FAILURE); } memset(ptr, 0, size); return ptr; } void *xcalloc(size_t nmemb, size_t size) { void *ptr; if (size == 0 || nmemb == 0) { err("xcalloc: zero size"); exit(EXIT_FAILURE); } if (SIZE_T_MAX / nmemb < size) { err("xcalloc: nmemb * size > SIZE_T_MAX"); exit(EXIT_FAILURE); } ptr = calloc(nmemb, size); if (ptr == NULL) { err("xcalloc: out of memory (allocating %lu bytes)", (u_long)(size * nmemb)); exit(EXIT_FAILURE); } return ptr; } void *xrealloc(void *ptr, size_t nmemb, size_t size) { void *new_ptr; size_t new_size = nmemb * size; if (new_size == 0) { err("xrealloc: zero size"); exit(EXIT_FAILURE); } if (SIZE_T_MAX / nmemb < size) { err("xrealloc: nmemb * size > SIZE_T_MAX"); exit(EXIT_FAILURE); } if (ptr == NULL) { new_ptr = malloc(new_size); } else { new_ptr = realloc(ptr, new_size); } if (new_ptr == NULL) { err("xrealloc: out of memory (new_size %lu bytes)", (u_long) new_size); exit(EXIT_FAILURE); } return new_ptr; } void xfree(void *ptr) { if (ptr == NULL) { err("xfree: NULL pointer given as argument"); exit(EXIT_FAILURE); } free(ptr); } char *xstrdup(const char *str) { size_t len; char *cp; len = strlen(str) + 1; cp = xmalloc(len); strlcpy(cp, str, len); return cp; }
/*************************************************************************** sndhrdw/sblaster.c Soundblaster code ****************************************************************************/ #include "includes/sblaster.h" #include "sound/dac.h" /* operation modes 0x10 output 8 bit direct 0x14 output 8 bit with dma 0x16 output 2 bit compression with dma 0x17 output 2 bit compression with dma and reference byte 0x74 output 4 bit compression with dma 0x75 output 4 bit compression with dma with reference byte 0x76 output 2.6 bit compression with dma 0x77 output 2.7 bit compression with dma and reference byte 0x20 input 8 bit direct 0x24 input 8 bit with dma 0xd1 speaker on 0xd3 speaker off 0xd8 read speaker 0x40 samplerate adjust 0x48 blockgroesse einstellen 0x80 interrupt after xx samples 0xd0 end dma 0xd4 continue dma 0xe1 read version 0x30 midi input 0x31 midi input with irq generation 0x32 midi input with time stamp 0x33 midi input with irq and time stamp 0x34 midi output mode 0x35 midi output with irq 0x37 midi output with time stamp and irq 0x38 midi output direct pro 0x48, 0x91 output 8 bit high speed 8bit with dma 0x48, 0x99 input 8 bit high speed 8bit with dma */ typedef enum { OFF, INPUT, OUTPUT } MODE; static struct { SOUNDBLASTER_CONFIG config; /* int channel; */ MODE mode; int on; int dma; int frequency; int count; int input_state; int output_state; void *timer; } blaster={ {0} } ; void soundblaster_config(const SOUNDBLASTER_CONFIG *config) { blaster.config = *config; } void soundblaster_reset(void) { if (blaster.timer) blaster.timer = NULL; blaster.on=0; blaster.mode=OFF; blaster.input_state=0; blaster.output_state=0; blaster.frequency=0; } #if 0 int soundblaster_start(void) { channel = stream_init("PC speaker", 50, Machine->sample_rate, 0, pc_sh_update); return 0; } void soundblaster_stop(void) {} void soundblaster_update(void) {} #endif READ8_HANDLER( soundblaster_r ) { int data=0; switch (offset) { case 0xa: /*data input */ switch (blaster.input_state) { case 0: data=0xaa; break; case 1: /* version high */ data=blaster.config.version.major; blaster.input_state++; break; case 2: /* version low */ data=blaster.config.version.minor; blaster.input_state=0; break; case 3: /* speaker state */ data=blaster.on?0xff:0; blaster.input_state=0; break; } break; case 0xc: /*status */ break; case 0xe: /* busy */ data=0x80; break; } return data; } static int soundblaster_operation(int data) { switch (data) { case 0x10: /*play*/ return 1; case 0x40: /* set samplerate */ return 1; case 0xd0: /* dma break */ break; case 0xd4: /* dma continue */ break; case 0xd1: blaster.on=1; break; case 0xd3: blaster.on=0; break; case 0xd8: /* read speaker */ blaster.input_state=3; break; case 0xe1: /* read version */ blaster.input_state=1; break; } return 0; } WRITE8_HANDLER( soundblaster_w ) { switch (offset) { case 6: if (data!=0) { /*reset */ } else { /* reset off */ } break; case 0xc: /*operation, data */ switch (blaster.output_state) { case 0: blaster.output_state=soundblaster_operation(data); break; case 1: blaster.frequency=(int)(1000000.0/(256-data)); blaster.output_state=0; break; case 10: DAC_data_w(0, data); blaster.output_state=0; break; } break; } } #if 0 struct CustomSound_interface soundblaster_interface = { soundblaster_start, soundblaster_stop, soundblaster_update }; #endif
/* * A simple reboot and halt */ #include <stdio.h> #include <string.h> #include <unistd.h> int main(int argc, char *argv[]) { char *p = strchr(argv[0], '/'); if (p) p++; else p = argv[0]; if (strcmp(p, "halt") == 0) uadmin(A_SHUTDOWN,0,0); else uadmin(A_REBOOT,0,0); /* If we get here there was an error! */ perror(argv[0]); }
/********************************************************************* * * Abstracts generic network device operation, and provide dummy * stub here if required. Each driver implementation hooks to * this interface * *********************************************************************/ #include "net_dev.h" static net_dev_drv_t net_device_driver; static net_dev_drv_t *net_device_driver_p = &net_device_driver; static rt_err_t default_init (rt_device_t dev) { return RT_EOK; } static rt_err_t default_open (rt_device_t dev, rt_uint16_t oflag) { return RT_EOK; } static rt_err_t default_close (rt_device_t dev) { return RT_EOK; } static rt_size_t default_read (rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) { rt_set_errno(-RT_ENOSYS); return RT_EOK; } static rt_size_t default_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) { rt_set_errno(-RT_ENOSYS); return RT_EOK; } static rt_err_t default_control(rt_device_t dev, rt_uint8_t cmd, void *args) { switch (cmd) { case NIOCTL_GADDR: /* get mac address */ if (args) rt_memcpy(args, net_device_driver_p->dev_addr, ETH_ALEN); else return -RT_ERROR; break; default : break; } return RT_EOK; } /* * Initialize file operations by specific driver implementation * Parameters set to NULL means use the default defined in net_dev.c */ rt_err_t net_dev_drv_register_handler (net_dev_drv_init_func init, net_dev_drv_open_func open, net_dev_drv_close_func close, net_dev_drv_read_func read, net_dev_drv_write_func write, net_dev_drv_control_func control, net_dev_drv_rx_func rx, net_dev_drv_tx_func tx) { /* do not allow multiple registry */ if (net_device_driver_p->parent.eth_rx || net_device_driver_p->parent.eth_tx || rx == NULL || tx == NULL) { return -RT_ERROR; } /* dummy initialization */ net_device_driver_p->parent.parent.init = init ? init : default_init; net_device_driver_p->parent.parent.open = open ? open : default_open; net_device_driver_p->parent.parent.close = close ? close : default_close; net_device_driver_p->parent.parent.read = read ? read : default_read; net_device_driver_p->parent.parent.write = write ? write : default_write; net_device_driver_p->parent.parent.control = control ? control : default_control; net_device_driver_p->parent.eth_rx = rx; net_device_driver_p->parent.eth_tx = tx; return RT_EOK; } /* * Initialize device MAC address by device driver implementation */ void net_dev_drv_set_dev_addr (rt_uint8_t *device_address) { rt_memcpy(net_device_driver_p->dev_addr, device_address, ETH_ALEN); } /* * Hook this driver into lwIP */ rt_err_t net_dev_drv_init (void) { if (net_device_driver_p->parent.eth_rx == NULL || net_device_driver_p->parent.eth_tx == NULL) { return -RT_ERROR; } /* Update MAC address */ if (1) { net_device_driver_p->dev_addr[0] = 0x00; net_device_driver_p->dev_addr[1] = 0x0B; net_device_driver_p->dev_addr[2] = 0x6C; net_device_driver_p->dev_addr[3] = 0x89; net_device_driver_p->dev_addr[4] = 0xBD; net_device_driver_p->dev_addr[5] = 0x60; } else { net_device_driver_p->dev_addr[0] = 0x00; net_device_driver_p->dev_addr[1] = 0x0B; net_device_driver_p->dev_addr[2] = 0x6C; net_device_driver_p->dev_addr[3] = 0x89; net_device_driver_p->dev_addr[4] = 0x5B; net_device_driver_p->dev_addr[5] = 0x1E; } rt_sem_init(&net_device_driver_p->net_dev_sem, "net_dev_sem", 1, RT_IPC_FLAG_FIFO); net_device_driver_p->rx_pkt_pending = 0; /* add device to rt_device list */ return eth_device_init(&(net_device_driver_p->parent), "e0"); } rt_err_t net_dev_drv_notify_rx (void) { return eth_device_ready(&net_device_driver_p->parent); } /* * Lock/unlock protecting against simultanous read and write */ rt_err_t net_dev_drv_lock (void) { return rt_sem_take(&net_device_driver_p->net_dev_sem, RT_WAITING_FOREVER); } void net_dev_drv_unlock (void) { rt_sem_release(&net_device_driver_p->net_dev_sem); }
/** Native Code Examples Copyright (C) 2014 Bassel Bakr 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 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. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. {signature of Ty Coon}, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. **/ #include "shuffle.h" void myCallback(char *cc) { usleep(2500); printf("%s\n", cc); }; int main() { IResultListener *listener = calloc(1, sizeof(IResultListener)); listener->newResult = myCallback; shuffle("10", 20, listener); }
/* * display_gen.c * Pi4U * * Created by Panagiotis Hadjidoukas on 1/1/14. * Copyright 2014 ETH Zurich. All rights reserved. * */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "gnuplot_i.h" int display = 1; gnuplot_ctrl * g = NULL; char *BASENAME; // "curgen" // "samples" // "seeds" void display_onegen_db_dim(int Gen, int Dim) { FILE *fp; char fname[256]; static int once = 0; sprintf(fname, "%s_%03d.txt", BASENAME, Gen); fp = fopen(fname, "r"); if (fp == NULL) { printf("No file %s\n", fname); return; } fclose(fp); // if (g != NULL) { // gnuplot_close(g); // } // g = gnuplot_init(); if (!once) { gnuplot_cmd(g, "set view map"); gnuplot_cmd(g, "set size ratio 1"); gnuplot_cmd(g, "set palette rgbformulae 22,13,-31"); gnuplot_cmd(g, "unset key"); //gnuplot_cmd(g, "set pointsize 2"); once = 1; } // set terminal x11 [reset] <n> [[no]enhanced] [font <fontspec>] [title "<string>"] [[no]persist] [[no]raise] [close] if (!display) { gnuplot_cmd(g, "set terminal png"); gnuplot_cmd(g, "set output \"%s.png\"", fname); } int i, j; // gnuplot_cmd(g, "splot [-10:10][-10:10] \"%s\" using 2:3:4 with points pt 7 palette", fname); // gnuplot_cmd(g, "splot \"%s\" using 3:2:4 with points pt 7 palette", fname); for (i = 1; i <= Dim; i++) { for (j = i+1; j <=Dim; j++) { char using_str[64], title_str[64]; sprintf(using_str, "using %d:%d:%d ", i,j,Dim+1); sprintf(title_str, "\"%d_%d_%d\"", Gen,i,j); gnuplot_cmd(g, "set term x11 %d persist title %s", i*Dim+j, title_str); #if 0 if ((i == 1)&&(j==2)) gnuplot_cmd(g, "splot [-20:0][-15:0] \"%s\" %s with points pt 7 palette", fname, using_str); if ((i == 1)&&(j==3)) gnuplot_cmd(g, "splot [-20:0][-15:5] \"%s\" %s with points pt 7 palette", fname, using_str); if ((i == 2)&&(j==3)) gnuplot_cmd(g, "splot [-15:0][-15:5] \"%s\" %s with points pt 7 palette", fname, using_str); #else gnuplot_cmd(g, "splot \"%s\" %s with points pt 7 palette", fname, using_str); #endif // gnuplot_cmd(g, "splot [-6:6][-6:6] \"%s\" %s with points pt 7 palette", fname, using_str); // usleep(1000*500); sleep(2); } } // sleep(5); } void display_curgen_db(int Gen, int NGens) { FILE *fp; char fname[256]; static int once = 0; sprintf(fname, "%s_%03d.txt", BASENAME, Gen); fp = fopen(fname, "r"); if (fp == NULL) { printf("No file %s\n", fname); return; } fclose(fp); // if (g != NULL) { // gnuplot_close(g); // } // g = gnuplot_init(); if (!once) { gnuplot_cmd(g, "set view map"); gnuplot_cmd(g, "set size ratio 1"); gnuplot_cmd(g, "set palette rgbformulae 22,13,-31"); gnuplot_cmd(g, "unset key"); gnuplot_cmd(g, "set pointsize 1"); once = 1; } // set terminal x11 [reset] <n> [[no]enhanced] [font <fontspec>] [title "<string>"] [[no]persist] [[no]raise] [close] /* if ((Gen == 1) || (Gen == NGens)) gnuplot_cmd(g, "set term x11 %d persist", Gen); else gnuplot_cmd(g, "set term x11 %d", Gen); if ((Gen > 2) gnuplot_cmd(g, "set term x11 %d close", Gen-1); gnuplot_cmd(g, "splot [-10:10][-10:10] \"%s\" with points pt 7 palette", fname); usleep(1000*500); */ if (!display) { gnuplot_cmd(g, "set terminal png"); gnuplot_cmd(g, "set output \"%s.png\"", fname); } if (Gen == 0) { if (display) gnuplot_cmd(g, "set term x11 %d persist", Gen); gnuplot_cmd(g, "splot [-10:10][-10:10] \"%s\" with points pt 7 palette", fname); } else if (Gen == 1) { //if (display) gnuplot_cmd(g, "set term x11 %d persist", Gen); gnuplot_cmd(g, "splot [-10:10][-10:10] \"%s\" with points pt 7 palette", fname); } else { gnuplot_cmd(g, "splot [-10:10][-10:10] \"%s\" with points pt 7 palette", fname); } usleep(1000*500); // sleep(5); } void display_curgen_db_single(int Gen, int p1, int p2, int Dim, int NGens) { FILE *fp; char fname[256]; static int once = 0; sprintf(fname, "%s_%03d.txt", BASENAME, Gen); fp = fopen(fname, "r"); if (fp == NULL) { printf("No file %s\n", fname); return; } fclose(fp); if (!once) { gnuplot_cmd(g, "set view map"); gnuplot_cmd(g, "set size ratio 1"); gnuplot_cmd(g, "set palette rgbformulae 22,13,-31"); gnuplot_cmd(g, "unset key"); gnuplot_cmd(g, "set pointsize 1"); once = 1; // gnuplot_cmd(g, "set logscale y"); } if (!display) { gnuplot_cmd(g, "set terminal png"); gnuplot_cmd(g, "set output \"%s.png\"", fname); } int i = p1; int j = p2; { char using_str[64], title_str[64]; sprintf(using_str, "using %d:%d:%d ", i,j,Dim+1); sprintf(title_str, "\"%d_%d_%d\"", Gen,i,j); #if 1 gnuplot_cmd(g, "set term x11 %d persist title %s", i*Dim+j, title_str); #else gnuplot_cmd(g, "set term x11 %d persist title %s", Gen, title_str); #endif // gnuplot_cmd(g, "splot [1e2:1e6][1e-6:1e-3]\"%s\" %s with points pt 7 palette", fname, using_str); gnuplot_cmd(g, "splot \"%s\" %s with points pt 7 palette", fname, using_str); // gnuplot_cmd(g, "splot [-6:6][-6:6]\"%s\" %s with points pt 7 palette", fname, using_str); } sleep(1); } int main(int argc, char *argv[]) { int ngen = 0; int dim = 2; int p1 = 1, p2 = 2; if (argc == 1) { printf("usage: %s <basefilename> <ngen> <dim> [index i] [index j]\n", argv[0]); exit(1); } BASENAME = argv[1]; if (argc >= 3) ngen = atoi(argv[2]); if (argc >= 4) dim = atoi(argv[3]); if (argc == 6) { p1 = atoi(argv[4]); p2 = atoi(argv[5]); } g = gnuplot_init(); #if 0 int i; for (i = 0; i <= ngen; i++) { // for (i = ngen; i <= ngen; i++) { // display_curgen_db(i, ngen); display_curgen_db_single(i, p1, p2, dim, ngen); //sleep(5); } #else display_onegen_db_dim(ngen, dim); #endif //sleep(100); gnuplot_close(g); return 0; }
#ifndef __CONFIGURE_H__ #define __CONFIGURE_H__ #include <string> #include <libconfig.h++> using namespace libconfig; std::map<std::string,std::string> getConfiguration(); #endif
// printf関数、及びscanf関数を使用するために必要 #include <stdio.h> // int型を返すmain関数の宣言 int main() { // 変数の宣言 // 配列の宣言は name[size] で行う。添字は0〜(size-1)まで占有している。 int i; int a[11]; float tmp; // 入力 for (i = 0; i <= 10; i++) { // scanf関数。標準入力から入力を取得する。 // scanfには変数のアドレスを渡すため、& を語頭に付与する。 // scanf(フォーマット指定子, 変数) scanf("%d", &a[i]); } // 計算 tmp = a[10]; for (i = 10; i >= 1; i--) { tmp = a[i-1] + (1 / tmp); } // printf関数。フォーマット指定子に従って標準出力に出力する。 // printf(フォーマット指定子, 変数) printf("%f\n", tmp); // main関数の正常終了 return 0; }
// // Created by 欧阳建华 on 2017/8/11. // #ifndef SE_THREAD_POOL_H #define SE_THREAD_POOL_H #include <se/thread/thread.h> #include <se/thread/mutex.h> #include <se/thread/condition.h> #include <vector> #include <queue> #include <functional> namespace se { namespace thread { typedef std::function<void()> Task; class ThreadPool: public Runnable { public: explicit ThreadPool(int max_thread_count = 4); void push(const Task task); void shutdown(); ~ThreadPool(); protected: virtual void run(); private: void createNewWorkThread(); private: bool running; int maxThreadCount; int freeThreadCount; int currentThreadCount; std::vector<Thread *> threadList; std::queue<Task> taskList; Mutex mutex; Condition notEmpty; }; } } #endif //SE_THREAD_POOL_H
/********************************************************************************* Copyright MCQ TECH GmbH 2012 $Autor:$ Dipl.-Ing. Steffen Kutsche $Id:$ $Date:$ 15.02.2012 Description: MODBUS-Configuration for mct_spi_aio-Driver Tracen der MODBUS-Kommandos erfolgt mit: #define/#undef CONFIG_MODBUS_CMD_TRACE MODBUS-Adressen:TCP RTU ----------------- 0 220 Geräte-Object mct_if.01.3-2-SLOT.0 [mct] = MC Technology [if] = Interface [.01] = 1 Gerät [.3-2] = MODBUS, Treiberkennung mct_spi_aio SLOT = z.Zeit immer 0 .0 = Instanz Input : 4xKanal 32bit float (0-1 = Spannung/Widerstand, 2-3 = Strom) Output: 4xKanal 16bit (0-1 = Spannung, 2-3 = Strom) Register: *********************************************************************************/ #ifndef __MCT_MODBUS_SPI_AIO_CFG_H_ #define __MCT_MODBUS_SPI_AIO_CFG_H_ #define MODBUS_DEVICE_INTERFACE "mct_" DRIVER_INTERFACE ".01." BUS_MODBUS "-" DRIVER_SPI_AIO_IDENT "-" //#define CONFIG_MODBUS_CMD_TRACE // AN: Schalter - tracen der Kommandos #undef CONFIG_MODBUS_CMD_TRACE // AUS: Schalter - tracen der Kommandos #define MODBUS_SLVS 1 // Anzahl MOD-Bus Geräte #define MODBUS_SLV_0 0 // Index MOD-Bus Gerät 4 analoge Eingänge // 4 analoge Ausgänge #endif
#include <unistd.h> #include <stdio.h> #include <arpa/inet.h> #include <pthread.h> #include <semaphore.h> #include <stdlib.h> #define ADAPT_FLAG(x) (x[7] & 0x20) #define ADAPT_LEN_OK(x) (x[8] >= 7) #define PCR_FLAG(x) (x[9] & 0x10) struct meta { int num; uint64_t diff, pcr; }; #define BACKLOG_SIZE 64 #define PACKETS_PER_BUFFER 2000 static unsigned char *data[BACKLOG_SIZE]; static struct meta meta[BACKLOG_SIZE]; sem_t pcr_sem, data_sem; int done = 0; static void* writer() { int num, i; unsigned int total = 0; double pcr, diff; unsigned char *buffer; int backlog = 0; int semvalue; sem_wait(&pcr_sem); for (;;) { if (done && (done + 1) % BACKLOG_SIZE == backlog && sem_getvalue(&pcr_sem, &semvalue) == 0 && semvalue == 0) break; else sem_wait(&pcr_sem); pcr = (double)meta[backlog].pcr; num = meta[backlog].num; diff = (double)meta[backlog].diff / (double)num; buffer = data[backlog]; for (i = 0 ; i < num; ++i, buffer += 192) { pcr += diff; *(uint32_t*)buffer = htonl(((uint32_t)pcr) & 0x3fffffff); if (write(1, buffer, 192) != 192) { perror("write"); exit(1); } } total += num; fprintf(stderr, "\r%.1f MB", total*192.0f/1024.0f/1024.0f); sem_post(&data_sem); backlog = (backlog + 1) % BACKLOG_SIZE; } fprintf(stderr, "\n"); return NULL; } void reader() { int num = 0; int backlog = 0; uint64_t pcr, oldpcr = 0; unsigned char *buffer = data[backlog]; while (read(0, buffer+4, 188) == 188) { ++num; if (ADAPT_FLAG(buffer) && ADAPT_LEN_OK(buffer) && PCR_FLAG(buffer)) { pcr = (buffer[10] << 25) | (buffer[11] << 17) | (buffer[12] << 9) | (buffer[13] << 1) | (buffer[14] >> 7); pcr *= 300; pcr += ((buffer[14] & 1) << 8) | buffer[15]; meta[backlog].num = num; if (oldpcr == 0) { meta[backlog].diff = 0; meta[backlog].pcr = pcr; } else { meta[backlog].diff = pcr - oldpcr; meta[backlog].pcr = oldpcr; } sem_post(&pcr_sem); oldpcr = pcr; backlog = (backlog + 1) % BACKLOG_SIZE; num = 0; sem_wait(&data_sem); buffer = data[backlog]; } else { buffer += 192; } if (num >= PACKETS_PER_BUFFER) { fprintf(stderr, "Buffer :("); exit(1); } } if (num > 0) { meta[backlog].num = num; meta[backlog].diff = meta[(backlog == 0 ? BACKLOG_SIZE : backlog) - 1].diff; meta[backlog].pcr = oldpcr; done = backlog; sem_post(&pcr_sem); sem_post(&pcr_sem); } } int main() { int i; pthread_t thread; for (i = 0; i < BACKLOG_SIZE; ++i) { if (!(data[i] = malloc(PACKETS_PER_BUFFER*192))) { perror("malloc"); return -1; } } if (sem_init(&pcr_sem, 0, 0)) { perror("sem_init 1"); return -2; } if (sem_init(&data_sem, 0, BACKLOG_SIZE - 1)) { perror("sem_init 2"); return -3; } if (pthread_create(&thread, NULL, writer, NULL) != 0) return -4; reader(); if (pthread_join(thread, NULL) != 0) return -5; sem_destroy(&pcr_sem); sem_destroy(&data_sem); return 0; }
#ifndef DOCK_SOURCE_BUTTON_H // :) #define DOCK_SOURCE_BUTTON_H #include "tintedbuttonbase.h" class SourceButton : public TintedButtonBase { Q_OBJECT public: SourceButton(const QModelIndex& index, QWidget* parent = NULL); virtual ~SourceButton(); protected: virtual void indexChanged(); }; #endif
#ifndef KBS_STRING_H #define KBS_STRING_H #include "kbs_Alphabet.h" #include "kbs_Types.h" typedef struct kbs_ustring{ Kbs_Ulong strLength; /** length of the string */ Kbs_Uchar *str; /** character array of length strLength plus terminating 0 */ Kbs_Alphabet *alphabet; /** the alphabet of the string, if it is determined previously */ }Kbs_Ustring; #define KBS_STRING_EXTENSION_SIZE 32 /*----------------------------------------------------------------------------*/ /** * Gets the Kbs_Ustring from a given file without the alphabet * @param filename - file containing the string. * @return Kbs_Ustring located in filename * @see kbs_getUstringWithAlphabet_FromFile */ Kbs_Ustring* kbs_getUstring_FromFile(const Kbs_Char *const filename); /*----------------------------------------------------------------------------*/ /** * Gets the Kbs_Ustring with its alphabet from a given file * @param filename - file containing the string. * @return Kbs_Ustring located in filename * @see kbs_getUstring_FromFile */ Kbs_Ustring* kbs_getUstringWithAlphabet_FromFile(Kbs_Char *filename); /*----------------------------------------------------------------------------*/ /** * frees a Kbs_Ustring * @param oldStr - Kbs_Ustring string to free */ void kbs_delete_Ustring(Kbs_Ustring* oldStr); /** * Shows the contents of Kbs_Ustring on standard out * @param thisString string to be shown * @see Kbs_Ustring */ void kbs_get_AlphabetForUstring(Kbs_Ustring *thisString); #endif
#define IDL4_INTERNAL #include <idl4/test.h> #define dprintf(a...) void pager_thread(void) { int r; l4_threadid_t src; l4_umword_t dw0, dw1; l4_msgdope_t result; unsigned int dummyint; l4_threadid_t mypagerid, dummyid, myid; dprintf("Pager starting up (%X.%d)\n", l4_myself().id.task, l4_myself().id.lthread); // *** find out the threadID of the boss pager (this would be sigma0) myid = l4_myself(); dummyid = mypagerid = L4_INVALID_ID; l4_thread_ex_regs(myid, 0xffffffff, /* invalid eip */ 0xffffffff, /* invalid esp */ &dummyid, &mypagerid, &dummyint, &dummyint, &dummyint); // *** wait for the first pagefault IPC to occur while (1) { r = l4_i386_ipc_wait(&src, (void*)L4_IPC_OPEN_IPC, &dw0, &dw1, L4_IPC_NEVER, &result); while (1) { if (r != 0) panic("error on pagefault IPC"); dprintf("Handling pagefault from %X.%X, dw0=%xh\n", src.lh.high, src.lh.low, dw0); l4_i386_ipc_call(mypagerid,L4_IPC_SHORT_MSG,dw0,dw1,(void*)((L4_WHOLE_ADDRESS_SPACE<<2) + (int)L4_IPC_SHORT_FPAGE), &dw0,&dw1,L4_IPC_NEVER,&result); dprintf("Sigma0 replies: %xh, %xh (dope %xh)\n", dw0, dw1, result.msgdope); // *** apply the mapping and wait for next fault r = l4_i386_ipc_reply_and_wait(src, L4_IPC_SHORT_FPAGE, dw0, dw1, &src, (void*)L4_IPC_OPEN_IPC, &dw0, &dw1, L4_IPC_NEVER, &result); } } }
#ifndef VECTOR_H #define VECTOR_H typedef struct Vector Vector; // Allocates Vector |v| with bytes per element |bs|. int VecNew(Vector **v, size_t bs); // Adds element to end of Vector |v|. int VecPush(Vector *v, void *data); // Removes last element in Vector |v|. int VecPop(Vector *v); // Overwrites element at |index| with |data| in Vector |v|. int VecReplace(Vector *v, size_t index, void *data); // Shifts right elements then overwrites element at |index| with |data| in // Vector |v|. int VecInsert(Vector *v, size_t index, void *data); // Removes element at |index| in Vector |v|. int VecRemove(Vector *v, size_t index); // Copies |get| into Vector |v| at |index|. int VecGet(Vector *v, size_t index, void *get); // Removes all elements in Vector |v|. int VecClear(Vector *v); // Clears and frees Vector |v|. int VecDelete(Vector **v); // Returns the number of elements of Vector |v|. int VecSize(Vector *v); // Returns the element size of Vector |v|. int VecElemSize(Vector *v); // Returns the memory capacity of Vector |v|. int VecCapacity(Vector *v); // Returns an iterator to the first element of Vector |v|. void *VecBegin(Vector *v); // Returns an iterator to the last element of Vector |v|. void *VecEnd(Vector *v); #endif
/* This file is part of the KDE project Copyright ( C ) 2003 Nadeem Hasan <nhasan@kde.org> 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SENSORLOGGERSETTINGS_H #define SENSORLOGGERSETTINGS_H #include <kdialogbase.h> #include <qstring.h> #include <qcolor.h> class SensorLoggerSettingsWidget; class SensorLoggerSettings : public KDialogBase { Q_OBJECT public: SensorLoggerSettings( QWidget *parent=0, const char *name=0 ); QString title(); QColor foregroundColor(); QColor backgroundColor(); QColor alarmColor(); void setTitle( const QString & ); void setForegroundColor( const QColor & ); void setBackgroundColor( const QColor & ); void setAlarmColor( const QColor & ); private: SensorLoggerSettingsWidget *m_settingsWidget; }; #endif // SENSORLOGGERSETTINGS_H /* vim: et sw=2 ts=2 */
/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 only, * as published by the Free Software Foundation. * * This 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 version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * * Copyright (c) 2011, 2014, Intel Corporation. * * Copyright 2015 Cray Inc, all rights reserved. * Author: Ben Evans. * * We assume all nodes are either little-endian or big-endian, and we * always send messages in the sender's native format. The receiver * detects the message format by checking the 'magic' field of the message * (see lustre_msg_swabbed() below). * * Each wire type has corresponding 'lustre_swab_xxxtypexxx()' routines * are implemented in ptlrpc/lustre_swab.c. These 'swabbers' convert the * type from "other" endian, in-place in the message buffer. * * A swabber takes a single pointer argument. The caller must already have * verified that the length of the message buffer >= sizeof (type). * * For variable length types, a second 'lustre_swab_v_xxxtypexxx()' routine * may be defined that swabs just the variable part, after the caller has * verified that the message buffer is large enough. */ #ifndef _LUSTRE_SWAB_H_ #define _LUSTRE_SWAB_H_ #include <lustre/lustre_idl.h> void lustre_swab_orphan_ent(struct lu_orphan_ent *ent); void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); void lustre_swab_connect(struct obd_connect_data *ocd); void lustre_swab_hsm_user_state(struct hsm_user_state *hus); void lustre_swab_hsm_state_set(struct hsm_state_set *hss); void lustre_swab_obd_statfs(struct obd_statfs *os); void lustre_swab_obd_ioobj(struct obd_ioobj *ioo); void lustre_swab_niobuf_remote(struct niobuf_remote *nbr); void lustre_swab_ost_lvb_v1(struct ost_lvb_v1 *lvb); void lustre_swab_ost_lvb(struct ost_lvb *lvb); void lustre_swab_obd_quotactl(struct obd_quotactl *q); void lustre_swab_quota_body(struct quota_body *b); void lustre_swab_lquota_lvb(struct lquota_lvb *lvb); void lustre_swab_generic_32s(__u32 *val); void lustre_swab_mdt_body(struct mdt_body *b); void lustre_swab_mdt_ioepoch(struct mdt_ioepoch *b); void lustre_swab_mdt_remote_perm(struct mdt_remote_perm *p); void lustre_swab_mdt_rec_setattr(struct mdt_rec_setattr *sa); void lustre_swab_mdt_rec_reint(struct mdt_rec_reint *rr); void lustre_swab_lmv_desc(struct lmv_desc *ld); void lustre_swab_lmv_mds_md(union lmv_mds_md *lmm); void lustre_swab_lov_desc(struct lov_desc *ld); void lustre_swab_ldlm_res_id(struct ldlm_res_id *id); void lustre_swab_ldlm_policy_data(union ldlm_wire_policy_data *d); void lustre_swab_gl_desc(union ldlm_gl_desc *); void lustre_swab_ldlm_intent(struct ldlm_intent *i); void lustre_swab_ldlm_resource_desc(struct ldlm_resource_desc *r); void lustre_swab_ldlm_lock_desc(struct ldlm_lock_desc *l); void lustre_swab_ldlm_request(struct ldlm_request *rq); void lustre_swab_ldlm_reply(struct ldlm_reply *r); void lustre_swab_mgs_target_info(struct mgs_target_info *oinfo); void lustre_swab_mgs_nidtbl_entry(struct mgs_nidtbl_entry *oinfo); void lustre_swab_mgs_config_body(struct mgs_config_body *body); void lustre_swab_mgs_config_res(struct mgs_config_res *body); void lustre_swab_lfsck_request(struct lfsck_request *lr); void lustre_swab_lfsck_reply(struct lfsck_reply *lr); void lustre_swab_obdo(struct obdo *o); void lustre_swab_ost_body(struct ost_body *b); void lustre_swab_ost_last_id(__u64 *id); void lustre_swab_fiemap(struct fiemap *fiemap); void lustre_swab_lov_user_md_v1(struct lov_user_md_v1 *lum); void lustre_swab_lov_user_md_v3(struct lov_user_md_v3 *lum); void lustre_swab_lov_user_md_objects(struct lov_user_ost_data *lod, int stripe_count); void lustre_swab_lov_mds_md(struct lov_mds_md *lmm); void lustre_swab_idx_info(struct idx_info *ii); void lustre_swab_lip_header(struct lu_idxpage *lip); void lustre_swab_lustre_capa(struct lustre_capa *c); void lustre_swab_lustre_capa_key(struct lustre_capa_key *k); void lustre_swab_fid2path(struct getinfo_fid2path *gf); void lustre_swab_layout_intent(struct layout_intent *li); void lustre_swab_hsm_user_state(struct hsm_user_state *hus); void lustre_swab_hsm_current_action(struct hsm_current_action *action); void lustre_swab_hsm_progress_kernel(struct hsm_progress_kernel *hpk); void lustre_swab_hsm_user_state(struct hsm_user_state *hus); void lustre_swab_hsm_user_item(struct hsm_user_item *hui); void lustre_swab_hsm_request(struct hsm_request *hr); void lustre_swab_object_update(struct object_update *ou); void lustre_swab_object_update_request(struct object_update_request *our); void lustre_swab_out_update_header(struct out_update_header *ouh); void lustre_swab_out_update_buffer(struct out_update_buffer *oub); void lustre_swab_object_update_result(struct object_update_result *our); void lustre_swab_object_update_reply(struct object_update_reply *our); void lustre_swab_swap_layouts(struct mdc_swap_layouts *msl); void lustre_swab_close_data(struct close_data *data); void lustre_swab_lmv_user_md(struct lmv_user_md *lum); void lustre_swab_ladvise(struct lu_ladvise *ladvise); void lustre_swab_ladvise_hdr(struct ladvise_hdr *ladvise_hdr); #endif
// // BNWorkbenchViewController.h // BNApp // // Created by wujianqiang on 15/1/17. // Copyright (c) 2015年 wujianqiang. All rights reserved. // #import <UIKit/UIKit.h> @interface BNWorkbenchViewController : UITabBarController @end
/* * Copyright (C) 2010, 2012-2014 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. * * A copy of the licence is included with the program, and can also be obtained from Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __UMP_KERNEL_LINUX_H__ #define __UMP_KERNEL_LINUX_H__ int ump_kernel_device_initialize(void); void ump_kernel_device_terminate(void); #endif /* __UMP_KERNEL_H__ */
/* * linux/include/asm-arm/mmu_context.h * * Copyright (C) 1996 Russell King. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Changelog: * 27-06-1996 RMK Created */ #ifndef __ASM_ARM_MMU_CONTEXT_H #define __ASM_ARM_MMU_CONTEXT_H #include <linux/compiler.h> #include <asm/cacheflush.h> #include <asm/proc-fns.h> #include <asm-generic/mm_hooks.h> void __check_kvm_seq(struct mm_struct *mm); #ifdef CONFIG_CPU_HAS_ASID /* * On ARMv6, we have the following structure in the Context ID: * * 31 7 0 * +-------------------------+-----------+ * | process ID | ASID | * +-------------------------+-----------+ * | context ID | * +-------------------------------------+ * * The ASID is used to tag entries in the CPU caches and TLBs. * The context ID is used by debuggers and trace logic, and * should be unique within all running processes. */ #define ASID_BITS 8 #define ASID_MASK ((~0) << ASID_BITS) #define ASID_FIRST_VERSION (1 << ASID_BITS) extern unsigned int cpu_last_asid; void __init_new_context(struct task_struct *tsk, struct mm_struct *mm); void __new_context(struct mm_struct *mm); static inline void check_context(struct mm_struct *mm) { if (unlikely((mm->context.id ^ cpu_last_asid) >> ASID_BITS)) __new_context(mm); if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq)) __check_kvm_seq(mm); } #define init_new_context(tsk,mm) (__init_new_context(tsk,mm),0) #else #ifdef CONFIG_MMU static inline void check_context(struct mm_struct *mm) { if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq)) __check_kvm_seq(mm); } #endif /* CONFIG_MMU */ #define init_new_context(tsk,mm) 0 #endif #define destroy_context(mm) do { } while(0) /* * This is called when "tsk" is about to enter lazy TLB mode. * * mm: describes the currently active mm context * tsk: task which is entering lazy tlb * cpu: cpu number which is entering lazy tlb * * tsk->mm will be NULL */ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) { } /* * This is the actual mm switch as far as the scheduler * is concerned. No registers are touched. We avoid * calling the CPU specific function when the mm hasn't * actually changed. */ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk) { #ifdef CONFIG_MMU unsigned int cpu = smp_processor_id(); if (!cpu_test_and_set(cpu, next->cpu_vm_mask) || prev != next) { check_context(next); cpu_switch_mm(next->pgd, next); if (cache_is_vivt()) cpu_clear(cpu, prev->cpu_vm_mask); } #endif } #define deactivate_mm(tsk,mm) do { } while (0) #define activate_mm(prev,next) switch_mm(prev, next, NULL) #endif
#ifndef RGRAPHICSSCENEQV_H #define RGRAPHICSSCENEQV_H #include <QGraphicsScene> #include <QStack> #include "RGraphicsScene.h" #include "RLine.h" #include "RPoint.h" #include "RCircle.h" #include "RArc.h" class RDocumentInterface; class RGraphicsItem; class RGraphicsViewQV; /** * Graphics scene. This class implements the exporter interface to * export entities into a scene. * \scriptable */ class RGraphicsSceneQV : public QGraphicsScene, public RGraphicsScene { Q_OBJECT public: RGraphicsSceneQV(RDocumentInterface& di, QObject* parent=0); ~RGraphicsSceneQV(); virtual void exportLine(const RVector& p1, const RVector& p2); virtual void exportPoint(const RPoint& point) { } virtual void exportCircle(const RCircle& circle) { } virtual void exportArc(const RArc& arc, double /*offset*/= RNANDOUBLE) { } virtual void exportArcSegment(const RArc& arc) { } void highlightItem(QList<QGraphicsItem*> items); void highlightItem(QGraphicsItem* item); virtual void exportLine(const RLine& line, double offset = RNANDOUBLE); virtual void exportLineSegment(const RLine& line); virtual void exportTriangle(const RTriangle& triangle); virtual void highlightEntity(REntity& entity); virtual void highlightReferencePoint(const RVector& position); signals: void mouseMoved(const QPointF& pos, const QPointF& relPos); protected: virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event); virtual void wheelEvent(QGraphicsSceneWheelEvent* event); virtual void mousePressEvent(QGraphicsSceneMouseEvent* event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); RGraphicsViewQV* getGraphicsView(QGraphicsSceneEvent* event); RGraphicsItem* highlightedItem; }; Q_DECLARE_METATYPE(RGraphicsSceneQV*) #endif
// Copyleft 2013 Chris Korda // 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 any later version. /* chris korda revision history: rev date comments 00 14oct13 initial version 01 23apr14 add tooltip support 02 05aug14 add OnCommandHelp options property page */ #if !defined(AFX_OPTIONSPAGE_H__84776AB1_689B_46EE_84E6_931C1542871D__INCLUDED_) #define AFX_OPTIONSPAGE_H__84776AB1_689B_46EE_84E6_931C1542871D__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // OptionsPage.h : header file // ///////////////////////////////////////////////////////////////////////////// // COptionsPage dialog #include "OptionsInfo.h" class COptionsPage : public CPropertyPage { // Construction public: COptionsPage(COptionsInfo& Info, UINT nIDTemplate, UINT nIDCaption = 0); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(COptionsPage) //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(COptionsPage) virtual BOOL OnInitDialog(); afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam); //}}AFX_MSG afx_msg LRESULT OnKickIdle(WPARAM, LPARAM); afx_msg BOOL OnToolTipNeedText(UINT id, NMHDR* pNMHDR, LRESULT* pResult); DECLARE_MESSAGE_MAP() // Dialog data //{{AFX_DATA(COptionsPage) //}}AFX_DATA // Member data COptionsInfo& m_oi; // reference to parent's options info }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_OPTIONSPAGE_H__84776AB1_689B_46EE_84E6_931C1542871D__INCLUDED_)
#include <stdio.h> #include <wiringPi.h> #include <sys/time.h> int main() { wiringPiSetup(); pinMode(8,OUTPUT); pinMode(9,INPUT); int val; while(1) { digitalWrite(8,LOW); digitalWrite(8,HIGH); delayMicroseconds(10); digitalWrite(8,LOW); struct timeval start,end; while(1) { val=digitalRead(9); if(val == HIGH) { printf("start\n"); break; } else continue; } gettimeofday(&start,NULL); while(1) { val = digitalRead(9); if(val== LOW) { printf("end\n"); break; } else continue; } gettimeofday(&end,NULL); long t1 = start.tv_sec * 1000000 + start.tv_usec; long t2 = end.tv_sec * 1000000 + end.tv_usec; float dis = (float)(t2-t1)/1000000*34000/2; printf("%fcm\n",dis); delay(2000); } return 0; }
/** * Copyright 2010 Dejan Jovanovic. * * This file is part of cutsat. * * Cutsat 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. * * Cutsat 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 cutsat. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vector> #include "parser/parser.h" namespace cutsat { class MpsParser : public Parser { enum BoundType { LowerBound, UpperBound }; void addConstraint(BoundType type, std::vector<Variable>& vars, std::vector<Integer> coeffNumerators, std::vector<Integer> coeffDenominators, Integer& cNumerator, Integer& cDenominator); void addIntegerBound(BoundType type, Variable var, Integer value); public: MpsParser(Solver& solver) : Parser(solver) {} void parse() throw(ParserException); }; }
/* 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[3]; atomic_int atom_1_r1_1; 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:; int v2_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst); atomic_store_explicit(&vars[1], 2, memory_order_seq_cst); int v4_r4 = atomic_load_explicit(&vars[1], memory_order_seq_cst); int v5_r5 = v4_r4 ^ v4_r4; int v8_r6 = atomic_load_explicit(&vars[2+v5_r5], memory_order_seq_cst); int v10_r8 = atomic_load_explicit(&vars[2], memory_order_seq_cst); int v11_r9 = v10_r8 ^ v10_r8; int v12_r9 = v11_r9 + 1; atomic_store_explicit(&vars[0], v12_r9, memory_order_seq_cst); int v20 = (v2_r1 == 1); atomic_store_explicit(&atom_1_r1_1, v20, memory_order_seq_cst); return NULL; } int main(int argc, char *argv[]){ pthread_t thr0; pthread_t thr1; atomic_init(&vars[2], 0); atomic_init(&vars[1], 0); atomic_init(&vars[0], 0); atomic_init(&atom_1_r1_1, 0); pthread_create(&thr0, NULL, t0, NULL); pthread_create(&thr1, NULL, t1, NULL); pthread_join(thr0, NULL); pthread_join(thr1, NULL); int v13 = atomic_load_explicit(&vars[0], memory_order_seq_cst); int v14 = (v13 == 2); int v15 = atomic_load_explicit(&vars[1], memory_order_seq_cst); int v16 = (v15 == 2); int v17 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst); int v18_conj = v16 & v17; int v19_conj = v14 & v18_conj; if (v19_conj == 1) assert(0); return 0; }
/* * Software License Agreement (BSD License) * * Object Pose Estimation (OPE) - www.cse.usf.edu/kkduncan/ope * Copyright (c) 2013, Kester Duncan * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * \file Plane.h * \author Kester Duncan * \note Adapted from ntk's <code>Plane</code> object */ #pragma once #ifndef __PLANE_H__ #define __PLANE_H__ #include <pcl/point_types.h> namespace ope { /** * \brief Defines the properties of a plane */ class Plane { /// Plane parameters double a, b, c, d; public: Plane(double a, double b, double c, double d) : a(a), b(b), c(c), d(d) {} /** * \brief Construct a plane from a normal vector and a point. */ Plane(const pcl::PointXYZ& normal, const pcl::PointXYZ& p); /** * \brief Default Constructor */ Plane() : a(0), b(0), c(0), d(0) {} /** * \brief Determines whether or not this is a valid plane * \return true if it is valid */ bool isValid() const; /** * \brief Gets the normal vector that defines this plane * \returns the x, y, & z values of the plane's normal */ pcl::PointXYZ normal() const; /** * \brief Sets the parameters of the plane */ void set (double a_, double b_, double c_, double d_) { a = a_; b = b_; c = c_; d = d_; } /** * \brief Determines whether this plane intersects with the specified line given by the parameters * \param <p1> the first point that defines the line * \param <p2> the second point that defines the line */ pcl::PointXYZ intersectionWithLine (const pcl::PointXYZ& p1, const pcl::PointXYZ& p2) const; /** * \brief Determines a point's distance from the plane * \return Distance from the plane */ float distanceToPlane(const pcl::PointXYZ& p) const; }; } // ope #endif /* __PLANE_H__ */
/* 9. Um coeficiente binomial, geralmente denotado (n?k), representa o número de possı́veis combinações de n elementos tomados k a k. Um “Triângulo de Pascal”, uma homenagem ao grande matemático Blaise Pascal, é uma tabela de valores de coeficientes combinatoriais para pequenos valores de n e k. Os números que não são mostrados na tabela têm valor zero. Este triângulo pode ser construı́do auto- maticamente usando-se uma propriedade conhecida dos coeficientes binomiais, denominada “fórmula da adição": (r?k) = (r-1 ?k ) + (r-1 ? k-1) ou seja, cada elemento do triângulo é a soma de dois elementos da linha anterior, um da mesma coluna e um da coluna anterior. Veja um exemplo de um triângulo de Pascal com 7 linhas: 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 Faça um programa em que imprima na tela um triângulo de Pascal com 10 linhas. Seu programa deve obrigatoriamente fazer uso de exatamente dois vetores durante o processo de construção. Um deles conterá a última linha ı́mpar gerada, enquanto que o outro conterá a última linha par gerada. */ #include <stdio.h> #include <string.h> #include <stdlib.h> #define ANSI_COLOR_RED "\x1b[31m" #define ANSI_COLOR_GREEN "\x1b[32m" #define ANSI_COLOR_YELLOW "\x1b[33m" #define ANSI_COLOR_BLUE "\x1b[34m" #define ANSI_COLOR_MAGENTA "\x1b[35m" #define ANSI_COLOR_CYAN "\x1b[36m" #define ANSI_COLOR_RESET "\x1b[0m" #define RESET "\033[1;25r" #define DEBUG 0 #define TAMANHO 20 void mostra(int *seq, int tam); void mostrad(int *seq, int destaque, int tam); int main(){ int *bp = NULL, k=0, tam=1; bp = malloc(sizeof(int)*TAMANHO); for (int i=0; i < TAMANHO; i++) bp[i]=0; bp[0]=1; printf("1\n"); do { if (DEBUG){ printf("Loop>> k: %d, t: %d\n",k,tam); } bp[tam++] = 1; mostra(bp,tam); for(int i=(tam-1); i > 0; i--){ bp[i] = bp[i-1] + bp[i]; } k++; } while (k < TAMANHO); return 0; } void mostra(int *seq, int tam){ mostrad(seq,-1,tam); } void mostrad(int *seq, int destaque, int tam){ for(int x=0; x<tam;x++){ if (x==destaque) printf(ANSI_COLOR_RED"%d "ANSI_COLOR_RESET ,seq[x]); else printf("%d ",seq[x]); } printf("\n"); if (DEBUG){ printf("Mostrou com: dest: %d, tam: %d\n",destaque,tam); } }
#include "struct_write.h"
// ****************************************************************************** // // Filename: guiwindow.h // Project: Vogue // Author: Steven Ball // // Purpose: // A window container class, defines basic window functionality. // // Revision History: // Initial Revision - 26/09/06 // // Copyright (c) 2005-2006, Steven Ball // // ****************************************************************************** #pragma once #include "container.h" #include "titlebar.h" // Forward declaration of GUIWindowList class GUIWindow; class OpenGLGUI; typedef std::vector<GUIWindow*> GUIWindowList; class GUIWindow : public Container, public MouseListener { public: /* Public methods */ GUIWindow(Renderer* pRenderer, unsigned int GUIFont, const std::string &title); GUIWindow(Renderer* pRenderer, unsigned int GUIFont, TitleBar* ptitleBar); ~GUIWindow(); void AddEventListeners(); void RemoveEventListeners(); virtual bool IsRootContainer() const; void AddGUIWindow(GUIWindow *window); void RemoveGUIWindow(GUIWindow *window); void RemoveAllGUIWindows(); const GUIWindowList& GetGUIWindows() const; TitleBar* GetTitleBar() const; void SetTitleBarDimensions(int xOffset, int yOffset, int width, int height); void SetTitleOffset(int xOffset, int yOffset); void SetTitlebarBackgroundIcon(RenderRectangle *icon); void SetBackgroundIcon(RenderRectangle *icon); void AddComponent(Component* component); void RemoveComponent(Component *component); void SetDimensions(int x, int y, int width, int height); void SetDimensions(const Dimensions& r); void SetLocation(int x, int y); void SetLocation(const Point& p); void SetTitle(const std::string &title); const std::string GetTitle() const; void SetDebugRender(bool debug); void SetOutlineRender(bool outline); void Show(); void Hide(); bool GetMinimized() const; void SetMinimized(bool minimized); void SetMinimizedDefaultIcon(RenderRectangle *icon); void SetMinimizedSelectedIcon(RenderRectangle *icon); void SetMinimizedHoverIcon(RenderRectangle *icon); void SetMinimizedDisabledIcon(RenderRectangle *icon); void SetCloseDefaultIcon(RenderRectangle *icon); void SetCloseSelectedIcon(RenderRectangle *icon); void SetCloseHoverIcon(RenderRectangle *icon); void SetCloseDisabledIcon(RenderRectangle *icon); void AllowMoving(bool val); void AllowClosing(bool val); void AllowMinimizing(bool val); void AllowScrolling(bool val); void SnapToApplication(bool val); void SetApplicationDimensions(int width, int height); void SetApplicationBorder(int left, int right, int top, int bottom); void SetRenderTitleBar(bool lbRender); void SetRenderWindowBackground(bool lbRender); void DepthSortGUIWindowChildren(); EComponentType GetComponentType() const; void SetGUIParent(OpenGLGUI* pParent); void SetFocusWindow(); void Update(float deltaTime); // < Operator (Used for GUIWindow depth sorting) bool operator<(const GUIWindow &w) const; static bool DepthLessThan(const GUIWindow *lhs, const GUIWindow *rhs); protected: /* Protected methods */ void MousePressed(const MouseEvent& lEvent); void DrawSelf(); void DrawChildrenFirst(); void DrawChildren(); private: /* Private methods */ public: /* Public members */ protected: /* Protected members */ private: /* Private members */ GUIWindowList m_vpGUIWindowList; TitleBar* m_titleBar; unsigned int m_GUIFont; bool m_bMinimized; // Bools to control functionality of window bool m_bAllowMoving; bool m_bAllowClosing; bool m_bAllowMinimizing; bool m_bAllowScrolling; bool m_bSnapToWindow; bool m_bRenderTitleBar; bool m_bRenderWindowBackground; bool mb_ownsTitleBar; int m_applicationWidth; int m_applicationHeight; RenderRectangle *m_pBackgroundIcon; bool m_outlineRender; int m_applicationBorderLeft; int m_applicationBorderRight; int m_applicationBorderTop; int m_applicationBorderBottom; OpenGLGUI* m_pParentGUI; // Friend classes friend class TitleBar; friend class GUIWindowMinimizeButton; friend class GUIWindowCloseButton; };
#ifndef SHAPELOADER_GLOBAL_H #define SHAPELOADER_GLOBAL_H #include <QtCore/qglobal.h> #if defined(SHAPELOADER_LIBRARY) # define SHAPELOADERSHARED_EXPORT Q_DECL_EXPORT #else # define SHAPELOADERSHARED_EXPORT Q_DECL_IMPORT #endif #endif // SHAPELOADER_GLOBAL_H
#ifndef METAIF_H #define METAIF_H #include "astElement.h" #include <map> class astIf : public astElement { public: astIf(); //metaCall branchingBlock; std::map<blocks::itemID, std::vector<astElement*> > branches;//branchPin and the branch itself }; #endif // METAIF_H
//*********************************************************** //* vbat.c //*********************************************************** //*********************************************************** //* Includes //*********************************************************** #include <avr/io.h> #include <stdlib.h> #include <util/delay.h> #include "io_cfg.h" #include "adc.h" //************************************************************ // Prototypes //************************************************************ uint16_t GetVbat(void); //************************************************************ // Code //************************************************************ uint16_t GetVbat(void) // Get battery voltage (VBAT on ADC3) { uint16_t vBat; // Battery voltage read_adc(AIN_VBAT); // Multiplication factor = (Display volts / 1024) / (Vbat / 11 / Vref) vBat = ((ADCW * 21) >> 3); // For Vref = 2.45V, factor = 2.632 (21/8 = 2.625) return vBat; }
#ifndef _MYACTIONGROUP_H_ #define _MYACTIONGROUP_H_ #include <QActionGroup> #include <QWidget> #include "myaction.h" class MyActionGroup : public QActionGroup { Q_OBJECT public: MyActionGroup ( QObject * parent ); void setChecked(int ID); int checked(); void clear(bool remove); void setActionsEnabled(bool); void addTo(QWidget *); void removeFrom(QWidget *); void uncheckAll(); signals: void activated(int); protected slots: void itemTriggered(QAction *); }; #endif
/* 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[3]; atomic_int atom_1_r1_1; atomic_int atom_1_r12_1; 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:; int v2_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst); int v3_r3 = v2_r1 ^ v2_r1; atomic_store_explicit(&vars[2+v3_r3], 1, memory_order_seq_cst); atomic_store_explicit(&vars[2], 2, memory_order_seq_cst); int v5_r7 = atomic_load_explicit(&vars[2], memory_order_seq_cst); int v6_r8 = v5_r7 ^ v5_r7; atomic_store_explicit(&vars[0+v6_r8], 1, memory_order_seq_cst); int v8_r11 = atomic_load_explicit(&vars[0], memory_order_seq_cst); int v10_r12 = atomic_load_explicit(&vars[0], memory_order_seq_cst); int v20 = (v2_r1 == 1); atomic_store_explicit(&atom_1_r1_1, v20, memory_order_seq_cst); int v21 = (v10_r12 == 1); atomic_store_explicit(&atom_1_r12_1, v21, memory_order_seq_cst); return NULL; } int main(int argc, char *argv[]){ pthread_t thr0; pthread_t thr1; atomic_init(&vars[0], 0); atomic_init(&vars[2], 0); atomic_init(&vars[1], 0); atomic_init(&atom_1_r1_1, 0); atomic_init(&atom_1_r12_1, 0); pthread_create(&thr0, NULL, t0, NULL); pthread_create(&thr1, NULL, t1, NULL); pthread_join(thr0, NULL); pthread_join(thr1, NULL); int v11 = atomic_load_explicit(&vars[0], memory_order_seq_cst); int v12 = (v11 == 2); int v13 = atomic_load_explicit(&vars[2], memory_order_seq_cst); int v14 = (v13 == 2); int v15 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst); int v16 = atomic_load_explicit(&atom_1_r12_1, memory_order_seq_cst); int v17_conj = v15 & v16; int v18_conj = v14 & v17_conj; int v19_conj = v12 & v18_conj; if (v19_conj == 1) assert(0); return 0; }
#ifndef ORBITALEQUATION_H #define ORBITALEQUATION_H // Local includes #include <src/includes/defines.h> #include <src/includes/lib.h> #include <src/includes/binaryoperations.h> #include <src/Interaction/interaction.h> #include <src/OneParticleOperator/oneparticleoperator.h> // Libraries #include <libconfig.h++> #include <armadillo> #include <bitset> #include <unordered_map> using namespace libconfig; using namespace std; using namespace arma; class OrbitalEquation { public: OrbitalEquation(Config* cfg, vector<bitset<BITS> > slaterDeterminants, Interaction *V, SingleParticleOperator *h); const cx_mat &computeRightHandSide(const cx_mat &C, const cx_vec &A); double getCorrelation(); const cx_mat &reCalculateRho1(const cx_vec &A); vec getSvdRho1(); protected: void computeProjector(const cx_mat &C); cx_double findRho2(int p,int q, int r, int s); void computeUMatrix(const cx_mat &C); void computeOneParticleReducedDensity(); void computeOneParticleReducedDensityWithSpin(); void computeTwoParticleReducedDensity(); cx_double reducedOneParticleOperator(const int i, const int j); cx_double reducedTwoParticleOperator(const int p, const int q, const int r, const int s); // Class variables Config* cfg; Interaction *V; SingleParticleOperator* h; vector<bitset<BITS> > slaterDeterminants; int nOrbitals; int nGrid; int nSlaterDeterminants; int nParticles; cx_mat invRho; unordered_map<int, cx_double> rho2; const cx_vec* A; const cx_mat* hC; cx_mat U; cx_mat Q; cx_mat rightHandSide; cx_mat rho1; // TMP // MPI imat allRH; int myRank, nNodes; vector<pair<int,int> > myRij; ivec sizeRij; }; #endif // ORBITALEQUATION_H
/* * Copyright (c) The Shogun Machine Learning Toolbox * Written (W) 2015 Wu Lin * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those * of the authors and should not be interpreted as representing official policies, * either expressed or implied, of the Shogun Development Team. * */ #ifdef USE_GPL_SHOGUN #include <shogun/lib/config.h> #ifdef HAVE_NLOPT #ifndef NLOPTMINIMIZER_UNITTEST_H #define NLOPTMINIMIZER_UNITTEST_H #include <shogun/optimization/FirstOrderBoundConstraintsCostFunction.h> #include <shogun/optimization/NLOPTMinimizer.h> using namespace shogun; class CPiecewiseQuadraticObject2; class NLOPTTestCostFunction: public FirstOrderBoundConstraintsCostFunction { public: NLOPTTestCostFunction(); virtual ~NLOPTTestCostFunction(); void set_target(CPiecewiseQuadraticObject2 *obj); virtual float64_t get_cost(); virtual SGVector<float64_t> obtain_variable_reference(); virtual SGVector<float64_t> get_gradient(); virtual SGVector<float64_t> get_lower_bound(); virtual SGVector<float64_t> get_upper_bound(); private: void init(); CPiecewiseQuadraticObject2 *m_obj; }; class CPiecewiseQuadraticObject2: public CSGObject { friend class NLOPTTestCostFunction; public: CPiecewiseQuadraticObject2(); virtual ~CPiecewiseQuadraticObject2(); void set_init_x(SGVector<float64_t> init_x); void set_truth_x(SGVector<float64_t> truth_x); void set_x_lower_bound(float64_t lower_bound){m_x_lower_bound=lower_bound;} void set_x_upper_bound(float64_t upper_bound){m_x_upper_bound=upper_bound;} float64_t get_value(); virtual const char* get_name() const {return "PiecewiseQuadraticObject";} private: SGVector<float64_t> get_gradient(TParameter * param); SGVector<float64_t> get_variable(TParameter * param); SGVector<float64_t> get_upper_bound(TParameter * param); SGVector<float64_t> get_lower_bound(TParameter * param); void init(); SGVector<float64_t> m_init_x; SGVector<float64_t> m_truth_x; float64_t m_x_lower_bound; float64_t m_x_upper_bound; }; #endif /* NLOPTMINIMIZER_UNITTEST_H */ #endif /* HAVE_NLOPT */ #endif //USE_GPL_SHOGUN
/** \file src/cbmimage.c * \brief Generic image handling * * Right now only contains a single function to create either a disk or a tape * image file. */ /* * cbmimage.c - Generic image handling. * * Written by * Andreas Boose <viceteam@t-online.de> * * This file is part of VICE, the Versatile Commodore Emulator. * See README for copyright notice. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. * */ #include "vice.h" #include <stdio.h> #include "diskimage.h" #include "tape.h" #include "cbmimage.h" /** \brief Create a disk or tape image file * * \param[in] name name of/path to image * \param[in] type disk/tape image type enumerator * * \return 0 on success, < 0 on failure */ int cbmimage_create_image(const char *name, unsigned int type) { switch (type) { case DISK_IMAGE_TYPE_TAP: return tape_image_create(name, type); default: break; } return disk_image_fsimage_create(name, type); } /** \brief Create a disk or tape image file * * \param[in] name name of/path to image * \param[in] dname disk name and id * \param[in] type disk/tape image type enumerator * * \return 0 on success, < 0 on failure */ int cbmimage_create_dxm_image(const char *name, const char *dname, unsigned int type) { return disk_image_fsimage_create_dxm(name, dname, type); }
/* test_main.c * * Copyright (C) 2006-2017 wolfSSL Inc. * * This file is part of wolfSSL. * * wolfSSL 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. * * wolfSSL 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-1335, USA */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <wolfssl/wolfcrypt/settings.h> #include <wolfcrypt/test/test.h> #include <stdio.h> typedef struct func_args { int argc; char** argv; int return_code; } func_args; static func_args args = { 0 } ; void main(void) { int test_num = 0; do { printf("\nCrypt Test %d:\n", test_num); wolfcrypt_test(&args); printf("Crypt Test %d: Return code %d\n", test_num, args.return_code); test_num++; } while(args.return_code == 0); } /* SAMPLE OUTPUT: Crypt Test 0: SHA test passed! SHA-256 test passed! SHA-384 test passed! SHA-512 test passed! HMAC-SHA test passed! HMAC-SHA256 test passed! HMAC-SHA384 test passed! HMAC-SHA512 test passed! GMAC test passed! Chacha test passed! POLY1305 test passed! ChaCha20-Poly1305 AEAD test passed! AES test passed! AES-GCM test passed! AES-CCM test passed! RANDOM test passed! RSA test passed! ECC test passed! CURVE25519 test passed! ED25519 test passed! Crypt Test 0: Return code 0 */
/* * 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_RRCContainer_H_ #define _NGAP_RRCContainer_H_ #include <asn_application.h> /* Including external dependencies */ #include <OCTET_STRING.h> #ifdef __cplusplus extern "C" { #endif /* NGAP_RRCContainer */ typedef OCTET_STRING_t NGAP_RRCContainer_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_NGAP_RRCContainer; asn_struct_free_f NGAP_RRCContainer_free; asn_struct_print_f NGAP_RRCContainer_print; asn_constr_check_f NGAP_RRCContainer_constraint; ber_type_decoder_f NGAP_RRCContainer_decode_ber; der_type_encoder_f NGAP_RRCContainer_encode_der; xer_type_decoder_f NGAP_RRCContainer_decode_xer; xer_type_encoder_f NGAP_RRCContainer_encode_xer; oer_type_decoder_f NGAP_RRCContainer_decode_oer; oer_type_encoder_f NGAP_RRCContainer_encode_oer; per_type_decoder_f NGAP_RRCContainer_decode_uper; per_type_encoder_f NGAP_RRCContainer_encode_uper; per_type_decoder_f NGAP_RRCContainer_decode_aper; per_type_encoder_f NGAP_RRCContainer_encode_aper; #ifdef __cplusplus } #endif #endif /* _NGAP_RRCContainer_H_ */ #include <asn_internal.h>
/** DAC.c ** * Authors: Ronald Macmaster and Parth Adhia * Created: September 27th 2016 * Description: Device Driver for our Digital to Analog converter * Runs on a TLV5616 DAC component * 4 pin SSI Interface * Lab: 5 * TA: Dylan Zika * Date: September 27th 2016 *********************************************************************************/ /** hardware connections ** * DAC SSI Interface * Runs on SSI2 TLV5616 connection * PB4 SSI2CLK SClk * PB5 SSI2FSS FS * PB6 SSI2RX nothing * PB7 SSI2TX DIn */ #include <stdint.h> #include "tm4c123gh6pm.h" //DAC hardward initialization static void PortB_Init(void); static void SSI2_Init(void); /** DAC_Init() ** * Activate the DAC for voltage outputs * DAC Converts our digital output to an analog signal. * Outputs: none */ void DAC_Init(void){ PortB_Init(); SSI2_Init(); } /** DAC_Out() ** * Write a digital output to SSI-DAC interface. * Input: amplitude represented as a 12-bit number */ void DAC_Out(uint16_t amplitude){ amplitude &= (0x0FFF); // right mask 12 bits while((SSI2_SR_R & SSI_SR_TNF) == 0){ // wait till SSI TX FIFO is ready } SSI2_DR_R = amplitude; } /** DAC_Test() ** * Test the output of a new DAC * Function is an endless profile that will never finish... */ void DAC_Test(uint16_t precision, uint16_t resolution){ while(1){ for(int out = 0; out < precision; out += resolution){ DAC_Out(out); // output test voltage } } } /** SSI2_Init() ** * Run the SSI Clock at 10MHz * Transition and transmit SSI2Tx on rising clock edge. * Slave reads on the falling clock edge. * Frame select is first set to low, then MSB available at 1st clock edge (falling). * * DAC Ts = 8ns, Th = 5ns. Don't clock the DAC or SSI over 20MHz!\ * DAC Data: [15:12] XMPX mode 0 = slow and 1 = fast power 1 = power down and 0 = normal * [11:0] New DAC value. We should use slow mode and normal power */ static void SSI2_Init(void){ volatile uint32_t delay; SYSCTL_RCGCSSI_R |= 0x04; // 1) activate SSI2 delay = SYSCTL_RCGCSSI_R; // allow time to finish activating SSI2_CR1_R = 0x00000000; //2) Disable SSI, master mode SSI2_CPSR_R = 0x08; //3) 10Mhz SSIClk Fssi = Fbus / (CPSDVSR * (1 + SCR)) SSI2_CR0_R &= ~(0x0000FFFF); //3) SCR = 0, Freescale frame format. SSI2_CR0_R |= 0x4F; //5)) DSS = 16 bit data, SPH = 0 and SP0 = 1 ( use 16 bit data??) SSI2_CR1_R |= SSI_CR1_SSE; //4) enable SSI / set the SSE } /** PortB_Init() ** * Standard port b init * Initialize with AFSEL for SSI2 */ static void PortB_Init(){ volatile uint32_t delay; SYSCTL_RCGCGPIO_R |= 0x02; // 1) turn on port B delay = SYSCTL_RCGCTIMER_R; // allow time to finish activating GPIO_PORTB_AMSEL_R &= ~0xF0; // 2) disable analog on PB4-7 GPIO_PORTB_AFSEL_R |= 0xF0; // 3) Enable alternative functionality on PB4-7 GPIO_PORTB_PCTL_R &= ~0xFFFF0000; GPIO_PORTB_PCTL_R |= 0x22220000;// 4) choose GPIO functionality GPIO_PORTB_DIR_R |= 0xF0; // 5) set PB7-4 to be outputs GPIO_PORTB_DEN_R |= 0xF0; // 6) outputs are digital }
/* * Copyright (C) 2016 Stuart Howarth <showarth@marxoft.co.uk> * * 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 VIMEOVIEW_H #define VIMEOVIEW_H #include <QWidget> class VimeoUser; class VimeoVideo; class VimeoPlaylist; class VimeoNavModel; class ListView; class QModelIndex; class QVBoxLayout; class VimeoView : public QWidget { Q_OBJECT public: explicit VimeoView(QWidget *parent = 0); public Q_SLOTS: void search(const QString &query, const QString &type, const QString &order); void showResource(const QString &type, const QString &id); private: void showAccounts(); void showCategories(); void showFavourites(); void showLatestVideos(); void showPlaylists(); void showSearchDialog(); void showSubscriptions(); void showUploads(); void showWatchLater(); private Q_SLOTS: void onItemActivated(const QModelIndex &index); void onCommentAdded(); void onUserSubscribed(VimeoUser *user); void onUserUnsubscribed(VimeoUser *user); void onVideoFavourited(VimeoVideo *video); void onVideoUnfavourited(VimeoVideo *video); void onVideoWatchLater(VimeoVideo *video); void onVideoAddedToPlaylist(VimeoVideo *video, VimeoPlaylist *playlist); private: VimeoNavModel *m_model; ListView *m_view; QVBoxLayout *m_layout; }; #endif // VIMEOVIEW_H
/****************************************************************************** * * * colours.h * * * * Developed by : * * AquaticEcoDynamics (AED) Group * * School of Earth & Environment * * The University of Western Australia * * * * Copyright 2013, 2014 - The University of Western Australia * * * * This file is part of libplot - a plotting library for GLM * * * * libplot 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. * * * * libplot 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 _COLOURS_H_ #define _COLOURS_H_ #define GRAYSCALE 0 typedef struct _rgb { int r; int g; int b; int col; unsigned long int xcolour; int count; } rgb_val; extern rgb_val _map[256]; #define MAX_COL_VAL 250 extern int black, grey, white, red, green, blue; #define JET 1 void make_colour_map(gdImagePtr im, int style); void ShowColourMapH(gdImagePtr im, int h, int v); void ShowColourMapV(gdImagePtr im, int h, int v); #endif
#pragma once #include "menuscreen.h" #include <cstdint> #include <memory> struct nk_context; typedef uint32_t nk_flags; namespace FARender { class AnimationPlayer; } namespace FAGui { class MenuHandler; class PauseMenuScreen : public MenuScreen { private: using Parent = MenuScreen; public: explicit PauseMenuScreen(FAGui::MenuHandler& menu); static void bigTGoldText(nk_context* ctx, const char* text, nk_flags alignment); static float bigTGoldTextWidth(const char* text); void menuItems(nk_context* ctx); void update(nk_context* ctx) override; private: std::unique_ptr<FARender::AnimationPlayer> mBigPentagram; }; }
#include <assert.h> #include <errno.h> #include <string.h> #include <snt_pool.h> #include <snt_schd.h> #include"snt_utility.h" #include"snt_log.h" SNTPool* sntPoolCreate(unsigned int num, unsigned int itemsize) { SNTPool* alloc; unsigned char* tmp; unsigned int i; const int size = (itemsize + sizeof(SNTPool)); /* Total size of each node. */ /* Allocate pool descriptor. */ alloc = malloc(sizeof(SNTPool)); assert(alloc); /* Allocate number pool nodes. */ alloc->pool = calloc(num, size); alloc->num = num; alloc->itemsize = itemsize; assert(alloc->pool); /* Create pool chain. */ tmp = (unsigned char*)alloc->pool; for (i = 0; i < num; i++) { ((SNTPoolNode*)tmp)->next = (SNTPoolNode*)( tmp + sizeof(SNTPoolNode) + itemsize ); tmp += itemsize + sizeof(SNTPoolNode); } /* Terminator of the pool. */ tmp -= itemsize + sizeof(SNTPoolNode); ((SNTPoolNode*)tmp)->next = NULL; return alloc; } int sntPoolLockMem(SNTPool* poolallocator){ size_t sizeInBytes = (size_t)sntPoolNumNodes(poolallocator) * (size_t)sntPoolItemSize(poolallocator); return sntLockMemory(poolallocator->pool, sizeInBytes); } void* sntPoolObtain(SNTPool* allocator) { SNTPoolNode* tmp; void* block; if (allocator->pool->next == NULL) { return NULL; } /* Get next element and assigned new next element. */ tmp = allocator->pool->next; allocator->pool->next = tmp->next; /* Get data block. */ block = tmp->data; memset(block, 0, allocator->itemsize); return block; } void* sntPoolReturn(SNTPool* allocator, void* data) { SNTPoolNode* tmp; /* Decrement with size of a pointer * to get pointer for the next element.*/ tmp = (SNTPoolNode*)(((char*) data) - sizeof(void*)); /* Update next value. */ tmp->next = allocator->pool->next; allocator->pool->next = tmp; /* Clear the data to prevent sensitive information to retain on the system memory.*/ memset(tmp->data, 0, allocator->itemsize); return tmp; } void* sntPoolResize(SNTPool* pool, unsigned int num, unsigned int itemsize){ sntLogErrorPrintf("Not supported.\n"); return NULL; } unsigned int sntPoolNumNodes(const SNTPool* pool){ return pool->num; } unsigned int sntPoolItemSize(const SNTPool* pool){ return pool->itemsize; } int sntPoolGetIndex(const SNTPool* pool, const void* data){ return ((const char*)data - (const char*)pool->pool) / pool->itemsize; } static void* sntPoolItemByIndex(SNTPool* pool, unsigned int index){ return ((char*)pool->pool) + ( (pool->itemsize + sizeof(void*)) * index + sizeof(void*)); } void sntPoolFree(SNTPool* pool){ /* Zero out each pool item. */ sntPoolZeroFrame(pool); /* Release memory. */ free(pool->pool); free(pool); } void sntPoolZeroFrame(SNTPool* pool){ unsigned int i; for(i = 0; i < sntPoolNumNodes(pool); i++){ sntMemZero(sntPoolItemByIndex(pool, i), sntPoolItemSize(pool)); } }
#ifndef wm_h #define wm_h /* * Sylvain BERTRAND <digital.ragnarok@gmail.com> * code protected by GNU GPL v3 */ extern gboolean wm_replace; extern gboolean wm_debug_xinerama; enum wm_state wm_state(void); void wm_set_state(enum wm_state state); void wm_restart_other(const gchar *path); void wm_restart(void); void wm_exit(gint code); void wm_exit_replace(void); Cursor wm_cursor(enum wm_cursor cursor); #endif
/* * main.c * scard * * Created by Michel Depeige on 22/12/2014. * Copyright (c) 2014 Michel Depeige. * * 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, 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 (see the file COPYING); if not, write to the * Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * */ #define _GNU_SOURCE #define _BSD_SOURCE #define __BSD_VISIBLE 1 #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <event.h> #ifdef HAVE_CONFIG_H #include <stdlib.h> #include <event.h> #include "config.h" #include "conf.h" #include "eca.h" #include "main.h" #include "tools.h" #endif /* globals */ conf_t g_conf; /* prototypes */ void watchdog(evutil_socket_t fd, short what, void *arg); int main(int argc, char *argv[]) { struct event_base *base; struct event *ev; struct timeval timeout; /* init the program, check opt, init some stuff... */ checkopt(argc, argv); if (init(&base) == ERROR) exit(ERROR); /* switch to daemon mode if needed */ if (g_mode & DAEMON) daemonize(); /* watchdog */ timeout.tv_sec = 10; timeout.tv_usec = 0; ev = event_new(base, -1, EV_PERSIST, watchdog, NULL); event_add(ev, &timeout); /* schedule file rotate */ eca_schedule_rotate(base); /* event loop */ event_base_dispatch(base); eca_cleanup(); log_msg("[-] exiting\n"); log_cleanup(); http_cleanup(); conf_erase(&g_conf); return(NOERROR); } void watchdog(evutil_socket_t fd, short what, void *arg) { (void)fd; (void)what; (void)arg; eca_check_status(); }
#include <stdio.h> void sayHelloTo( char who[] ) { printf( "Hello, %s!", who ); }
/* * Beautiful Capi generates beautiful C API wrappers for your C++ classes * Copyright (C) 2015 Petr Petrovich Petrov * * This file is part of Beautiful Capi. * * Beautiful Capi 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. * * Beautiful Capi 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 Beautiful Capi. If not, see <http://www.gnu.org/licenses/>. * */ /* * WARNING: This file was automatically generated by Beautiful Capi! * Do not edit this file! Please edit the source API description. */ #ifndef UNITTEST_NAME_DEFINITION_INCLUDED #define UNITTEST_NAME_DEFINITION_INCLUDED #include "UnitTest/NameDecl.h" #ifdef __cplusplus inline UnitTest::Name::Name(const char* FirstName, const char* MiddleName, const char* LastName) { SetObject(unit_test_name_full_name(FirstName, MiddleName, LastName)); } inline const char* UnitTest::Name::GetFullName() { return unit_test_name_get_full_name(GetRawPointer()); } inline const char* UnitTest::Name::GetFirstName() const { return unit_test_name_get_first_name_const(GetRawPointer()); } inline void UnitTest::Name::SetFirstName(const char* first_name) { unit_test_name_set_first_name(GetRawPointer(), first_name); } inline const char* UnitTest::Name::GetMiddleName() const { return unit_test_name_get_middle_name_const(GetRawPointer()); } inline void UnitTest::Name::SetMiddleName(const char* middle_name) { unit_test_name_set_middle_name(GetRawPointer(), middle_name); } inline const char* UnitTest::Name::GetLastName() const { return unit_test_name_get_last_name_const(GetRawPointer()); } inline void UnitTest::Name::SetLastName(const char* last_name) { unit_test_name_set_last_name(GetRawPointer(), last_name); } inline UnitTest::Name::Name(const Name& other) { if (other.GetRawPointer()) { SetObject(unit_test_name_copy(other.GetRawPointer())); } else { SetObject(0); } } #ifdef UNITTEST_CPP_COMPILER_HAS_RVALUE_REFERENCES inline UnitTest::Name::Name(Name&& other) { mObject = other.mObject; other.mObject = 0; } #endif /* UNITTEST_CPP_COMPILER_HAS_RVALUE_REFERENCES */ inline UnitTest::Name::Name(UnitTest::Name::ECreateFromRawPointer, void *object_pointer, bool copy_object) { if (object_pointer && copy_object) { SetObject(unit_test_name_copy(object_pointer)); } else { SetObject(object_pointer); } } inline UnitTest::Name::~Name() { if (GetRawPointer()) { unit_test_name_delete(GetRawPointer()); SetObject(0); } } inline UnitTest::Name& UnitTest::Name::operator=(const UnitTest::Name& other) { if (this != &other) { if (GetRawPointer()) { unit_test_name_delete(GetRawPointer()); SetObject(0); } if (other.GetRawPointer()) { SetObject(unit_test_name_copy(other.mObject)); } else { SetObject(0); } } return *this; } #ifdef UNITTEST_CPP_COMPILER_HAS_RVALUE_REFERENCES inline UnitTest::Name& UnitTest::Name::operator=(UnitTest::Name&& other) { if (this != &other) { if (GetRawPointer()) { unit_test_name_delete(GetRawPointer()); SetObject(0); } mObject = other.mObject; other.mObject = 0; } return *this; } #endif /* UNITTEST_CPP_COMPILER_HAS_RVALUE_REFERENCES */ inline UnitTest::Name UnitTest::Name::Null() { return UnitTest::Name(UnitTest::Name::force_creating_from_raw_pointer, 0, false); } inline bool UnitTest::Name::IsNull() const { return !GetRawPointer(); } inline bool UnitTest::Name::IsNotNull() const { return GetRawPointer() != 0; } inline bool UnitTest::Name::operator!() const { return !GetRawPointer(); } inline void* UnitTest::Name::Detach() { void* result = GetRawPointer(); SetObject(0); return result; } inline void* UnitTest::Name::GetRawPointer() const { return UnitTest::Name::mObject ? mObject: 0; } inline void UnitTest::Name::SetObject(void* object_pointer) { mObject = object_pointer; } #endif /* __cplusplus */ #endif /* UNITTEST_NAME_DEFINITION_INCLUDED */
/* * Unfuddle Tracker is a time tracking tool for Unfuddle service. * Copyright (C) 2012 Vadim Zakondyrin <thekondr@crystalnix.com> * * This file is part of Unfuddle Tracker. * * Unfuddle Tracker 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. * * Unfuddle Tracker 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 Unfuddle Tracker. If not, see <http://www.gnu.org/licenses/>. */ #ifndef WINAUTORUN_H #define WINAUTORUN_H #include "autorunimp.h" #include <QSettings> #include <QCoreApplication> class WinAutoRun : public AutoRunImp { public: WinAutoRun(); virtual ~WinAutoRun(); virtual bool autoRunOn(); virtual bool autoRunOff(); virtual bool isAutoRunning() const; private: QSettings loginsettings; QString getRunString() const; }; const QString loginSettingsPath = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"; #endif // WINAUTORUN_H
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import <Foundation/Foundation.h> @class NSDictionary; __attribute__((visibility("hidden"))) @interface WAPhoneNumberGeocoder : NSObject { NSDictionary *_maps; } + (id)sharedGeocoder; - (void)collectAvailableMaps; - (void)renameGeocodingFiles; - (id)locationTextForPhoneNumber:(id)arg1; - (id)init; @end
/* File: draaugmentrequest.c Project: dragonfly Author: Douwe Vos Date: Dec 27, 2016 e-mail: dmvos2000(at)yahoo.com Copyright (C) 2016 Douwe Vos. 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 "draaugmentrequest.h" #include <logging/catlogdefs.h> #define CAT_LOG_LEVEL CAT_LOG_WARN #define CAT_LOG_CLAZZ "DraAugmentRequest" #include <logging/catlog.h> struct _DraAugmentRequestPrivate { ChaDocument *document; ChaRevisionWo *a_revision; CatStringWo *slot_key; DraSpellHelper *spell_helper; }; static void l_stringable_iface_init(CatIStringableInterface *iface); G_DEFINE_TYPE_WITH_CODE(DraAugmentRequest, dra_augment_request, WOR_TYPE_REQUEST, G_ADD_PRIVATE(DraAugmentRequest) G_IMPLEMENT_INTERFACE(CAT_TYPE_ISTRINGABLE, l_stringable_iface_init) ); static void l_dispose(GObject *object); static void l_finalize(GObject *object); static void l_run_request(WorRequest *request); static void dra_augment_request_class_init(DraAugmentRequestClass *clazz) { GObjectClass *object_class = G_OBJECT_CLASS(clazz); object_class->dispose = l_dispose; object_class->finalize = l_finalize; WorRequestClass *wor_class = WOR_REQUEST_CLASS(clazz); wor_class->runRequest = l_run_request; } static void dra_augment_request_init(DraAugmentRequest *instance) { } static void l_dispose(GObject *object) { cat_log_detail("dispose:%p", object); DraAugmentRequest *instance = DRA_AUGMENT_REQUEST(object); DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(instance); cat_unref_ptr(priv->a_revision); cat_unref_ptr(priv->document); cat_unref_ptr(priv->slot_key); cat_unref_ptr(priv->spell_helper); G_OBJECT_CLASS(dra_augment_request_parent_class)->dispose(object); cat_log_detail("disposed:%p", object); } static void l_finalize(GObject *object) { cat_log_detail("finalize:%p", object); cat_ref_denounce(object); G_OBJECT_CLASS(dra_augment_request_parent_class)->finalize(object); cat_log_detail("finalized:%p", object); } void dra_augment_request_construct(DraAugmentRequest *request, ChaDocument *document, ChaRevisionWo *a_revision, CatStringWo *slot_key) { DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(request); priv->document = cat_ref_ptr(document); priv->a_revision = cat_ref_ptr(a_revision); priv->slot_key = cat_ref_ptr(slot_key); priv->spell_helper = NULL; wor_request_construct((WorRequest *) request); wor_request_set_time_out((WorRequest *) request, cat_date_current_time()+120); } CatStringWo *dra_augment_request_get_slot_key(DraAugmentRequest *request) { DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(request); return priv->slot_key; } void dra_augment_request_set_spell_helper(DraAugmentRequest *request, DraSpellHelper *spell_helper) { DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(request); cat_ref_swap(priv->spell_helper, spell_helper); } DraSpellHelper *dra_augment_request_get_spell_helper(DraAugmentRequest *request) { DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(request); return priv->spell_helper; } static gboolean l_idle_cb(DraAugmentRequest *request) { DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(request); cha_document_post_enrichment_slot_notify(priv->document, priv->a_revision, (GObject *) priv->slot_key, NULL); cat_unref_ptr(request); return FALSE; } static void l_run_request(WorRequest *request) { DraAugmentRequest *augment_request = DRA_AUGMENT_REQUEST(request); DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(augment_request); ChaRevisionWo *cur_revision = cha_document_get_current_revision_ref(priv->document); int cur_pl_version = cha_revision_wo_get_page_list_version(cur_revision); cat_unref_ptr(cur_revision); int rev_pl_version = cha_revision_wo_get_page_list_version(priv->a_revision); if (rev_pl_version<cur_pl_version) { return; } int slot_key_index = cha_revision_wo_get_slot_index(priv->a_revision, (GObject *) priv->slot_key, -1); if (slot_key_index<0) { return; } augment_request->slot_index = slot_key_index; DraKeywordPrinter *keyword_printer = dra_keyword_printer_new(priv->a_revision, priv->slot_key, slot_key_index); DraKeywordPrinter *line_tag_printer = dra_keyword_printer_new(priv->a_revision, priv->slot_key, slot_key_index); DraAugmentRequestClass *aug_class = DRA_AUGMENT_REQUEST_GET_CLASS(request); gboolean do_notify = aug_class->runAugment((DraAugmentRequest *) request, priv->a_revision, keyword_printer, line_tag_printer); dra_keyword_printer_flush_line_tags(line_tag_printer); dra_keyword_printer_flush(keyword_printer); cat_unref_ptr(line_tag_printer); cat_unref_ptr(keyword_printer); if (do_notify) { cat_ref_ptr(request); g_idle_add((GSourceFunc) l_idle_cb, request); } } /********************* start CatIStringable implementation *********************/ static void l_stringable_print(CatIStringable *self, struct _CatStringWo *append_to) { const char *iname = g_type_name_from_instance((GTypeInstance *) self); cat_string_wo_format(append_to, "%s[%p]", iname, self); } static void l_stringable_iface_init(CatIStringableInterface *iface) { iface->print = l_stringable_print; } /********************* end CatIStringable implementation *********************/
/* * pata_opti.c - ATI PATA for new ATA layer * (C) 2005 Red Hat Inc * * Based on * linux/drivers/ide/pci/opti621.c Version 0.7 Sept 10, 2002 * * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) * * Authors: * Jaromir Koutek <miri@punknet.cz>, * Jan Harkes <jaharkes@cwi.nl>, * Mark Lord <mlord@pobox.com> * Some parts of code are from ali14xx.c and from rz1000.c. * * Also consulted the FreeBSD prototype driver by Kevin Day to try * and resolve some confusions. Further documentation can be found in * Ralf Brown's interrupt list * * If you have other variants of the Opti range (Viper/Vendetta) please * try this driver with those PCI idents and report back. For the later * chips see the pata_optidma driver * */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/init.h> #include <linux/blkdev.h> #include <linux/delay.h> #include <scsi/scsi_host.h> #include <linux/libata.h> #define DRV_NAME "pata_opti" #define DRV_VERSION "0.2.9" enum { READ_REG = 0, /* index of Read cycle timing register */ WRITE_REG = 1, /* index of Write cycle timing register */ CNTRL_REG = 3, /* index of Control register */ STRAP_REG = 5, /* index of Strap register */ MISC_REG = 6 /* index of Miscellaneous register */ }; /** * opti_pre_reset - probe begin * @link: ATA link * @deadline: deadline jiffies for the operation * * Set up cable type and use generic probe init */ static int opti_pre_reset(struct ata_link *link, unsigned long deadline) { struct ata_port *ap = link->ap; struct pci_dev *pdev = to_pci_dev(ap->host->dev); static const struct pci_bits opti_enable_bits[] = { { 0x45, 1, 0x80, 0x00 }, { 0x40, 1, 0x08, 0x00 } }; if (!pci_test_config_bits(pdev, &opti_enable_bits[ap->port_no])) return -ENOENT; return ata_sff_prereset(link, deadline); } /** * opti_write_reg - control register setup * @ap: ATA port * @value: value * @reg: control register number * * The Opti uses magic 'trapdoor' register accesses to do configuration * rather than using PCI space as other controllers do. The double inw * on the error register activates configuration mode. We can then write * the control register */ static void opti_write_reg(struct ata_port *ap, u8 val, int reg) { void __iomem *regio = ap->ioaddr.cmd_addr; /* These 3 unlock the control register access */ ioread16(regio + 1); ioread16(regio + 1); iowrite8(3, regio + 2); /* Do the I/O */ iowrite8(val, regio + reg); /* Relock */ iowrite8(0x83, regio + 2); } /** * opti_set_piomode - set initial PIO mode data * @ap: ATA interface * @adev: ATA device * * Called to do the PIO mode setup. Timing numbers are taken from * the FreeBSD driver then pre computed to keep the code clean. There * are two tables depending on the hardware clock speed. */ static void opti_set_piomode(struct ata_port *ap, struct ata_device *adev) { struct ata_device *pair = ata_dev_pair(adev); int clock; int pio = adev->pio_mode - XFER_PIO_0; void __iomem *regio = ap->ioaddr.cmd_addr; u8 addr; /* Address table precomputed with prefetch off and a DCLK of 2 */ static const u8 addr_timing[2][5] = { { 0x30, 0x20, 0x20, 0x10, 0x10 }, { 0x20, 0x20, 0x10, 0x10, 0x10 } }; static const u8 data_rec_timing[2][5] = { { 0x6B, 0x56, 0x42, 0x32, 0x31 }, { 0x58, 0x44, 0x32, 0x22, 0x21 } }; iowrite8(0xff, regio + 5); clock = ioread16(regio + 5) & 1; /* * As with many controllers the address setup time is shared * and must suit both devices if present. */ addr = addr_timing[clock][pio]; if (pair) { /* Hardware constraint */ u8 pair_addr = addr_timing[clock][pair->pio_mode - XFER_PIO_0]; if (pair_addr > addr) addr = pair_addr; } /* Commence primary programming sequence */ opti_write_reg(ap, adev->devno, MISC_REG); opti_write_reg(ap, data_rec_timing[clock][pio], READ_REG); opti_write_reg(ap, data_rec_timing[clock][pio], WRITE_REG); opti_write_reg(ap, addr, MISC_REG); /* Programming sequence complete, override strapping */ opti_write_reg(ap, 0x85, CNTRL_REG); } static struct scsi_host_template opti_sht = { ATA_PIO_SHT(DRV_NAME), }; static const struct ata_port_operations opti_port_ops = { .inherits = &ata_sff_port_ops, .cable_detect = ata_cable_40wire, .set_piomode = opti_set_piomode, .prereset = opti_pre_reset, }; static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id) { static const struct ata_port_info info = { .flags = ATA_FLAG_SLAVE_POSS, .pio_mask = ATA_PIO4, .port_ops = &opti_port_ops }; const struct ata_port_info *ppi[] = { &info, NULL }; static int printed_version; if (!printed_version++) dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); return ata_pci_sff_init_one(dev, ppi, &opti_sht, NULL); } static const struct pci_device_id opti[] = { { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C621), 0 }, { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C825), 1 }, { }, }; static struct pci_driver opti_pci_driver = { .name = DRV_NAME, .id_table = opti, .probe = opti_init_one, .remove = ata_pci_remove_one, #ifdef CONFIG_PM .suspend = ata_pci_device_suspend, .resume = ata_pci_device_resume, #endif }; static int __init opti_init(void) { return pci_register_driver(&opti_pci_driver); } static void __exit opti_exit(void) { pci_unregister_driver(&opti_pci_driver); } MODULE_AUTHOR("Alan Cox"); MODULE_DESCRIPTION("low-level driver for Opti 621/621X"); MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(pci, opti); MODULE_VERSION(DRV_VERSION); module_init(opti_init); module_exit(opti_exit);
/* * This file is part of the continuous space language and translation model toolkit * for statistical machine translation and large vocabulary speech recognition. * * Copyright 2015, Holger Schwenk, LIUM, University of Le Mans, France * * The CSLM toolkit is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * * * * softmax machine: a_i = exp(a_i) / sum_k a_k * The stable version remove the max of a_i to all a_i before exp. * This lower numerical precision problem * with a_k is the kth output of a linear machine */ #ifndef _MachSoftmaxStable_h #define _MachSoftmaxStable_h #include "MachLin.h" #undef BLAS_CUDA_NPPS_SUM // thsi should be faster, but I can't get it working class MachSoftmaxStable : public MachLin { private: Timer tmn; // cumulated time used for softmax normalization #if defined(BLAS_CUDA) && defined(BLAS_CUDA_NPPS_SUM) Npp8u *gpu_sum_buf; // temporary buffer for fast sum with nppsSum_32f() #endif protected: MachSoftmaxStable(const MachSoftmaxStable &); // create a copy of the machine public: MachSoftmaxStable(const int=0, const int=0, const int=128, const ulong=0, const ulong=0, const int shareid=-1, const bool xdata=false); virtual ~MachSoftmaxStable(); virtual MachSoftmaxStable *Clone() {return new MachSoftmaxStable(*this);} // create a copy of the machine virtual int GetMType() {return file_header_mtype_softmax_stable;}; // get type of machine virtual void Info(bool=false, char *txt=(char*)""); // display (detailed) information on machine virtual void Forw(int=0, bool=false); // calculate outputs for current inputs // backprop gradients from output to input and update all weights virtual void Backw (const float lrate, const float wdecay, int=0); }; #endif
/* =========================================================================== Copyright (c) 2010-2012 Darkstar Dev Teams 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/ This file is part of DarkStar-server source code. =========================================================================== */ #ifndef _CFISHINGPACKET_H #define _CFISHINGPACKET_H #include "../../common/cbasetypes.h" #include "basic.h" /************************************************************************ * * * * * * ************************************************************************/ class CFishingPacket : public CBasicPacket { public: CFishingPacket(); }; #endif
/********************************************************************* Fits - View and manipulate FITS extensions and/or headers. Fits is part of GNU Astronomy Utilities (Gnuastro) package. Original author: Mohammad Akhlaghi <akhlaghi@gnu.org> Contributing author(s): Copyright (C) 2017, Free Software Foundation, Inc. Gnuastro 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. Gnuastro 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 Gnuastro. If not, see <http://www.gnu.org/licenses/>. **********************************************************************/ #ifndef EXTENSION_H #define EXTENSION_H int extension(struct fitsparams *p); #endif
/******************************************************************************* moPostEffectDebug.h **************************************************************************** * * * This source 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 code is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * General Public License for more details. * * * * A copy of the GNU General Public License is available on the World * * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also * * obtain it by writing to the Free Software Foundation, * * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * * **************************************************************************** Copyright(C) 2006 Fabricio Costa Authors: Fabricio Costa Andrés Colubri *******************************************************************************/ #ifndef __MO_POST_EFFECT_DEBUG_H__ #define __MO_POST_EFFECT_DEBUG_H__ #include "moPostPlugin.h" enum moDebugParamIndex { DEBUG_ALPHA, DEBUG_COLOR, DEBUG_SYNC, DEBUG_PHASE, DEBUG_FONT, DEBUG_INLET, DEBUG_OUTLET }; class moPostEffectDebug : public moPostEffect { public: //config MOint color; MOint font; moTextArray textevents; MOuint ticks, ticksprevious, tickselapsed; MOdouble fps_current, fps_mean; MOint fps_count; moText fps_text; moPostEffectDebug(); virtual ~moPostEffectDebug(); MOboolean Init(); void Draw( moTempo*, moEffectState* parentstate = NULL); void Update( moEventList* p_EventList ); MOboolean Finish(); moConfigDefinition *GetDefinition( moConfigDefinition *p_configdefinition ); }; class moPostEffectDebugFactory : public moPostEffectFactory { public: moPostEffectDebugFactory() {} virtual ~moPostEffectDebugFactory() {} moPostEffect* Create(); void Destroy(moPostEffect* fx); }; extern "C" { MO_PLG_API moPostEffectFactory* CreatePostEffectFactory(); MO_PLG_API void DestroyPostEffectFactory(); } #endif
#pragma once #include "../GUIFactory.h" class GfxAssetCombiner : public Texturizable { public: GfxAssetCombiner(GUIFactory* factory); virtual ~GfxAssetCombiner(); //unique_ptr<GraphicsAsset> combine(GraphicsAsset* asset1, GraphicsAsset* asset2); unique_ptr<GraphicsAsset> combine(Sprite* sprite1, Sprite* sprite2); /* Not used */ virtual unique_ptr<GraphicsAsset> texturize() override; virtual void textureDraw(SpriteBatch* batch, ComPtr<ID3D11Device> device = NULL) override; virtual void setPosition(const Vector2 & position) override; virtual const Vector2& getPosition() const override; virtual const int getWidth() const override; virtual const int getHeight() const override; private: GUIFactory* guiFactory; Sprite* sprite1; Sprite* sprite2; Vector2 origin; int width, height; };
/* * Copyright (c) 2013 Mark Travis <mtravis15432+src@gmail.com> * All rights reserved. No warranty, explicit or implicit, provided. * * This file is part of InfiniSQL(tm). * InfiniSQL 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. * * InfiniSQL 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 InfiniSQL. If not, see <http://www.gnu.org/licenses/>. */ /** * @file larx.h * @author Mark Travis <mtravis15432+src@gmail.com> * @date Tue Dec 17 13:26:16 2013 * * @brief Function declarations so flex and bison can work together. */ #ifndef INFINISQLLARX_H #define INFINISQLLARX_H #include <stdint.h> #include "parser.h" #include <string.h> #include <stdio.h> class Larxer; /** * @brief data for flex and bison to cooperate * */ struct perlarxer { void *scaninfo; class Larxer *larxerPtr; }; /** * @brief parser function declaration * * * @return some bison result */ int yyparse(struct perlarxer *); /** * @brief probably initializes state object for reentrent tokenizer * */ void flexinit(struct perlarxer *); /** * @brief or this could intialize state object for reentrant tokenizer * * does anybody actually know what flex and bison do? * */ void flexbuffer(char *, size_t, void *); /** * @brief destroy state object for reentrant tokenizer * */ void flexdestroy(void *); #endif /* INFINISQLLARX_H */
/******************************************************************************* * * Copyright (C) 2014-2018 Greg McGarragh <mcgarragh@atm.ox.ac.uk> * * This source code is licensed under the GNU General Public License (GPL), * Version 3. See the file COPYING for more details. * ******************************************************************************/ #ifndef READ_WRITE_NAT_H #define READ_WRITE_NAT_H #include "external.h" #include "read_write.h" #ifdef __cplusplus extern "C" { #endif int seviri_get_dimens_nat(const char *filename, uint *i_line, uint *i_column, uint *n_lines, uint *n_columns, enum seviri_bounds bounds, uint line0, uint line1, uint column0, uint column1, double lat0, double lat1, double lon0, double lon1); int seviri_read_nat(const char *filename, struct seviri_data *d, uint n_bands, const uint *band_ids, enum seviri_bounds bounds, uint line0, uint line1, uint column0, uint column1, double lat0, double lat1, double lon0, double lon1); int seviri_write_nat(const char *filename, const struct seviri_data *d); #ifdef __cplusplus } #endif #endif /* READ_WRITE_NAT_H */
#pragma once /*************************************************************** * This source files comes from the xLights project * https://www.xlights.org * https://github.com/smeighan/xLights * See the github commit history for a record of contributing * developers. * Copyright claimed based on commit dates recorded in Github * License: https://github.com/smeighan/xLights/blob/master/License.txt **************************************************************/ #include "DmxModel.h" #include "DmxColorAbility.h" #include "DmxPanTiltAbility.h" #include "DmxShutterAbility.h" class DmxMovingHead : public DmxModel, public DmxColorAbility, public DmxPanTiltAbility, public DmxShutterAbility { public: DmxMovingHead(wxXmlNode *node, const ModelManager &manager, bool zeroBased = false); virtual ~DmxMovingHead(); virtual bool HasColorAbility() override { return true; } virtual void AddTypeProperties(wxPropertyGridInterface *grid) override; virtual int OnPropertyGridChange(wxPropertyGridInterface *grid, wxPropertyGridEvent& event) override; protected: virtual void InitModel() override; virtual void ExportXlightsModel() override; virtual void ImportXlightsModel(std::string filename, xLightsFrame* xlights, float& min_x, float& max_x, float& min_y, float& max_y) override; void DrawModel(ModelPreview* preview, DrawGLUtils::xlAccumulator& va2, DrawGLUtils::xl3Accumulator& va3, const xlColor* c, float& sx, float& sy, float& sz, bool active, bool is_3d); virtual void DrawModelOnWindow(ModelPreview* preview, DrawGLUtils::xlAccumulator &va, const xlColor *c, float &sx, float &sy, bool active) override; virtual void DrawModelOnWindow(ModelPreview* preview, DrawGLUtils::xl3Accumulator &va, const xlColor *c, float &sx, float &sy, float &sz, bool active) override; virtual float GetDefaultBeamWidth() const { return 30; } void Draw3DDMXBaseLeft(DrawGLUtils::xlAccumulator& va, const xlColor& c, float& sx, float& sy, float& scale, float& pan_angle, float& rot_angle); void Draw3DDMXBaseRight(DrawGLUtils::xlAccumulator& va, const xlColor& c, float& sx, float& sy, float& scale, float& pan_angle, float& rot_angle); void Draw3DDMXHead(DrawGLUtils::xlAccumulator& va, const xlColor& c, float& sx, float& sy, float& scale, float& pan_angle, float& tilt_angle); bool hide_body = false; bool style_changed; std::string dmx_style; int dmx_style_val; float beam_length; float beam_width; private: };
/* * emu_tran_file.h * * 11/09/14 DJG Added new function prototypes for emulator file * buffering and structure changes for buffering and other new * command line options * Created on: Jan 25, 2014 * Author: djg */ #ifndef EMU_TRAN_FILE_H_ #define EMU_TRAN_FILE_H_ // Information on disk image file for emulator typedef struct emu_file_info { // File version information uint32_t version; // The size of this data in the file header int file_header_size_bytes; // Header and data size of track. All tracks are the same size int track_header_size_bytes; int track_data_size_bytes; // File contains num_cyl*num_head tracks int num_cyl; int num_head; // Rate in Hz int sample_rate_hz; // Delay from index to first data in nanoseconds uint32_t start_time_ns; // The command line used to generate the file char *decode_cmdline; // And description of file char *note; } EMU_FILE_INFO; // Information on transition data file typedef struct tran_file_info { // File version information uint32_t version; int file_header_size_bytes; int track_header_size_bytes; // File contains num_cyl*num_head tracks int num_cyl; int num_head; // Rate in Hz int sample_rate_hz; // Delay from index to first data in nanoseconds uint32_t start_time_ns; // The command line used to generate the file char *decode_cmdline; // And description of file char *note; } TRAN_FILE_INFO; int emu_file_write_header(char *fn, int num_cyl, int num_head, char *cmdline, char *note, uint32_t sample_rate, uint32_t start_time_ns, uint32_t track_bytes); int emu_file_read_header(char *fn, EMU_FILE_INFO *emu_file_info_out, int rewrite); void emu_file_write_track_bits(int fd, uint32_t *words, int num_words, int cyl, int head, uint32_t track_bytes); int emu_file_read_track_bits(int fd, EMU_FILE_INFO *emu_file_info, uint32_t *words, int num_bytes, int *cyl, int *head); void emu_file_close(int fd, int write_eof); int emu_file_seek_track(int fd, int seek_cyl, int seek_head, EMU_FILE_INFO *emu_file_info); int emu_file_read_track_deltas(int fd, EMU_FILE_INFO *emu_file_info, uint16_t deltas[], int max_deltas, int *cyl, int *head); void emu_file_read_cyl(int fd, EMU_FILE_INFO *emu_file_info, int cyl, void *buf, int buf_size); void emu_file_write_cyl(int fd, EMU_FILE_INFO *emu_file_info, int cyl, void *buf, int buf_size); void emu_file_rewrite_track(int fd, EMU_FILE_INFO *emu_file_info, int cyl, int head, void *buf, int buf_size); int tran_file_write_header(char *fn, int num_cyl, int num_head, char *cmdline, char *note, uint32_t start_time_ns); int tran_file_read_header(char *fn, TRAN_FILE_INFO *tran_file_info); int tran_file_seek_track(int fd, int seek_cyl, int seek_head, TRAN_FILE_INFO *tran_file_info); int tran_file_read_track_deltas(int fd,uint16_t deltas[], int max_deltas, int *cyl, int *head); void tran_file_write_track_deltas(int fd,uint16_t *deltas, int num_words, int cyl, int head); void tran_file_close(int fd, int write_eof); float emu_rps(int sample_rate_hz); #endif /* EMU_TRAN_FILE_H_ */
/************************************************************************** * * Copyright 2009 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ #include "util/u_format.h" #include "lp_bld_type.h" #include "lp_bld_const.h" #include "lp_bld_conv.h" #include "lp_bld_format.h" static LLVMValueRef lp_build_format_swizzle_chan_soa(struct lp_type type, const LLVMValueRef *unswizzled, enum util_format_swizzle swizzle) { switch (swizzle) { case UTIL_FORMAT_SWIZZLE_X: case UTIL_FORMAT_SWIZZLE_Y: case UTIL_FORMAT_SWIZZLE_Z: case UTIL_FORMAT_SWIZZLE_W: return unswizzled[swizzle]; case UTIL_FORMAT_SWIZZLE_0: return lp_build_zero(type); case UTIL_FORMAT_SWIZZLE_1: return lp_build_one(type); case UTIL_FORMAT_SWIZZLE_NONE: return lp_build_undef(type); default: assert(0); return lp_build_undef(type); } } void lp_build_format_swizzle_soa(const struct util_format_description *format_desc, struct lp_type type, const LLVMValueRef *unswizzled, LLVMValueRef *swizzled) { if(format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { enum util_format_swizzle swizzle = format_desc->swizzle[0]; LLVMValueRef depth = lp_build_format_swizzle_chan_soa(type, unswizzled, swizzle); swizzled[2] = swizzled[1] = swizzled[0] = depth; swizzled[3] = lp_build_one(type); } else { unsigned chan; for (chan = 0; chan < 4; ++chan) { enum util_format_swizzle swizzle = format_desc->swizzle[chan]; swizzled[chan] = lp_build_format_swizzle_chan_soa(type, unswizzled, swizzle); } } } void lp_build_unpack_rgba_soa(LLVMBuilderRef builder, const struct util_format_description *format_desc, struct lp_type type, LLVMValueRef packed, LLVMValueRef *rgba) { LLVMValueRef inputs[4]; unsigned start; unsigned chan; /* FIXME: Support more formats */ assert(format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN); assert(format_desc->block.width == 1); assert(format_desc->block.height == 1); assert(format_desc->block.bits <= 32); /* Decode the input vector components */ start = 0; for (chan = 0; chan < 4; ++chan) { unsigned width = format_desc->channel[chan].size; unsigned stop = start + width; LLVMValueRef input; input = packed; switch(format_desc->channel[chan].type) { case UTIL_FORMAT_TYPE_VOID: input = NULL; break; case UTIL_FORMAT_TYPE_UNSIGNED: if(type.floating) { if(start) input = LLVMBuildLShr(builder, input, lp_build_int_const_scalar(type, start), ""); if(stop < format_desc->block.bits) { unsigned mask = ((unsigned long long)1 << width) - 1; input = LLVMBuildAnd(builder, input, lp_build_int_const_scalar(type, mask), ""); } if(format_desc->channel[chan].normalized) input = lp_build_unsigned_norm_to_float(builder, width, type, input); else input = LLVMBuildFPToSI(builder, input, lp_build_vec_type(type), ""); } else { /* FIXME */ assert(0); input = lp_build_undef(type); } break; default: /* fall through */ input = lp_build_undef(type); break; } inputs[chan] = input; start = stop; } lp_build_format_swizzle_soa(format_desc, type, inputs, rgba); }
/* * Copyright 2011-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GR_EXTRAS_ADD_H #define INCLUDED_GR_EXTRAS_ADD_H #include <gnuradio/extras/api.h> #include <gnuradio/block.h> namespace gnuradio{ namespace extras{ class GR_EXTRAS_API add : virtual public block{ public: typedef boost::shared_ptr<add> sptr; static sptr make_fc32_fc32(const size_t num_inputs, const size_t vlen = 1); static sptr make_sc32_sc32(const size_t num_inputs, const size_t vlen = 1); static sptr make_sc16_sc16(const size_t num_inputs, const size_t vlen = 1); static sptr make_sc8_sc8(const size_t num_inputs, const size_t vlen = 1); static sptr make_f32_f32(const size_t num_inputs, const size_t vlen = 1); static sptr make_s32_s32(const size_t num_inputs, const size_t vlen = 1); static sptr make_s16_s16(const size_t num_inputs, const size_t vlen = 1); static sptr make_s8_s8(const size_t num_inputs, const size_t vlen = 1); }; }} #endif /* INCLUDED_GR_EXTRAS_ADD_H */
#ifndef COMPMODELSTATICSERIAL_H #define COMPMODELSTATICSERIAL_H #include "../CompSerialize.h" #include "../../../ModelLayer/ObjData/SPos.h" namespace SerialCompModelStatic{ /** Identifiers for each serializable type */ enum Enum{ /** Dummy entry for serialization of incomplete types */ Invalid = 0, ObjEnter = 1, ObjExit = 2, }; } struct SerialObjEnter : public SerialComp{ SerialObjEnter(OBJID objId, SPos* pos, uint32_t modelId): SerialComp(objId, COMPID::modelStatic, (uint32_t)SerialCompModelStatic::ObjEnter, sizeof(SerialObjEnter)){ this->modelId = modelId; this->pos = *pos; } SPos pos; uint32_t modelId; }; struct SerialObjExit : public SerialComp{ SerialObjExit(OBJID objId, SPos* pos, uint32_t fadetime): SerialComp(objId, COMPID::modelStatic, (uint32_t)SerialCompModelStatic::ObjExit, sizeof(SerialObjExit)){ this->fadetime = fadetime; this->pos = *pos; } SPos pos; uint32_t fadetime; }; #endif /* COMPMODELSTATICSERIAL_H */
/* * Copyright (C) 2014 Roland Dobai * * This file is part of ZyEHW. * * ZyEHW 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. * * ZyEHW 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 ZyEHW. If not, see <http://www.gnu.org/licenses/>. */ #include "dpr.h" #include <stdlib.h> #include <string.h> #include "bitstream.h" #include "xdevcfg.h" #if 0 #define DPR_DEBUG #endif #if 0 #define DPR_BITSTREAM_OUT #endif static XDcfg_Config *devc = NULL; static XDcfg dev; #ifdef DPR_BITSTREAM_OUT static inline void print_bitstream(const u32 *stream, int size) { int i; for (i = 0; i < size; ++i) xil_printf("0x%X\n\r", stream[i]); } #endif void dpr_reconfigure() { volatile u32 reg; if (!devc) { devc = XDcfg_LookupConfig(XPAR_XDCFG_0_DEVICE_ID); if (XDcfg_CfgInitialize(&dev, devc, devc->BaseAddr) != XST_SUCCESS) { print("DevC initialization failed\n"); exit(-1); } XDcfg_Unlock(&dev); if (XDcfg_SelfTest(&dev) != XST_SUCCESS) print("DevC self-test failed\n\r"); XDcfg_EnablePCAP(&dev); XDcfg_SetControlRegister(&dev, XDCFG_CTRL_PCAP_PR_MASK); } XDcfg_IntrClear(&dev, (XDCFG_IXR_DMA_DONE_MASK | XDCFG_IXR_D_P_DONE_MASK)); #ifdef DPR_DEBUG print("Starting the DMA transfer\n\r"); #endif /* Download bitstream in non secure mode */ if (XDcfg_Transfer(&dev, lut_stream, size_of_lut_stream(), (void *) XDCFG_DMA_INVALID_ADDRESS, 0, XDCFG_NON_SECURE_PCAP_WRITE) != XST_SUCCESS) { print("DMA transfer failed\n\r"); exit(-1); } #ifdef DPR_DEBUG else print("DMA transfer OK\n\r"); #endif for (reg = 0; (reg & XDCFG_IXR_DMA_DONE_MASK) != XDCFG_IXR_DMA_DONE_MASK; reg = XDcfg_IntrGetStatus(&dev)); for (reg = 0; (reg & XDCFG_IXR_D_P_DONE_MASK) != XDCFG_IXR_D_P_DONE_MASK; reg = XDcfg_IntrGetStatus(&dev)); #ifdef DPR_DEBUG print("DPR complete :-)\n\r"); #endif #ifdef DPR_BITSTREAM_OUT print("Bitstream:\n\r"); print_bitstream(lut_stream, size_of_lut_stream()); #endif }
/* * Copyright (C) 2015-2021 Marco Bortolin * * This file is part of IBMulator. * * IBMulator 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. * * IBMulator 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 IBMulator. If not, see <http://www.gnu.org/licenses/>. */ #ifndef IBMULATOR_GUI_INTERFACE_H #define IBMULATOR_GUI_INTERFACE_H #include "gui/window.h" #include "gui/guifx.h" #include "screen_renderer.h" #include "fileselect.h" #include "state_save.h" #include "state_save_info.h" #include "state_load.h" #include "hardware/devices/vga.h" #include "hardware/devices/floppy.h" #include <RmlUi/Core/EventListener.h> class Machine; class GUI; class Mixer; class FloppyCtrl; class StorageCtrl; class InterfaceFX : public GUIFX { private: enum SampleType { FLOPPY_INSERT, FLOPPY_EJECT }; std::vector<AudioBuffer> m_buffers; const static SoundFX::samples_t ms_samples; std::atomic<int> m_event; public: InterfaceFX() : GUIFX() {} void init(Mixer *); void use_floppy(bool _insert); bool create_sound_samples(uint64_t _time_span_us, bool, bool); }; class InterfaceScreen { protected: std::unique_ptr<ScreenRenderer> m_renderer; GUI *m_gui; public: struct { VGADisplay display; // GUI-Machine interface vec2i size; // size in pixels of the vga image inside the interface mat4f mvmat; // position and size of the vga image inside the interface mat4f pmat; // projection matrix float brightness; float contrast; float saturation; } vga; public: InterfaceScreen(GUI *_gui); virtual ~InterfaceScreen(); ScreenRenderer * renderer() { return m_renderer.get(); } virtual void render(); protected: void sync_with_device(); }; class Interface : public Window { protected: std::unique_ptr<InterfaceScreen> m_screen; vec2i m_size = 0; // current size of the interface struct { Rml::Element *power; Rml::Element *fdd_select; } m_buttons; struct { Rml::Element *fdd_led, *hdd_led; Rml::Element *fdd_disk; } m_status; struct { bool power, fdd, hdd; } m_leds; Rml::Element *m_speed = nullptr, *m_speed_value = nullptr; Rml::Element *m_message = nullptr; uint m_curr_drive = 0; bool m_floppy_present = false; bool m_floppy_changed = false; Machine *m_machine; Mixer *m_mixer; std::unique_ptr<FileSelect> m_fs; std::unique_ptr<StateSave> m_state_save; std::unique_ptr<StateSaveInfo> m_state_save_info; std::unique_ptr<StateLoad> m_state_load; FloppyCtrl *m_floppy = nullptr; StorageCtrl *m_hdd = nullptr; bool m_audio_enabled = false; InterfaceFX m_audio; public: Interface(Machine *_machine, GUI * _gui, Mixer *_mixer, const char *_rml); virtual ~Interface(); virtual void create(); virtual void update(); virtual void close(); virtual void config_changed(); virtual void container_size_changed(int /*_width*/, int /*_height*/) {} vec2i get_size() { return m_size; } void show_message(const char* _mex); void save_state(StateRecord::Info _info); void on_power(Rml::Event &); void on_fdd_select(Rml::Event &); void on_fdd_eject(Rml::Event &); void on_fdd_mount(Rml::Event &); void on_floppy_mount(std::string _img_path, bool _write_protect); void on_save_state(Rml::Event &); void on_load_state(Rml::Event &); void on_dblclick(Rml::Event &); VGADisplay * vga_display() { return & m_screen->vga.display; } void render_screen(); virtual void action(int) {} virtual void switch_power(); virtual void set_audio_volume(float); virtual void set_video_brightness(float); virtual void set_video_contrast(float); virtual void set_video_saturation(float); virtual bool is_system_visible() const { return true; } void save_framebuffer(std::string _screenfile, std::string _palfile); SDL_Surface * copy_framebuffer(); virtual void sig_state_restored() {} protected: virtual void set_hdd_active(bool _active); virtual void set_floppy_string(std::string _filename); virtual void set_floppy_config(bool _b_present); virtual void set_floppy_active(bool _active); std::vector<uint64_t> get_floppy_sizes(unsigned _floppy_drive); void show_state_dialog(bool _save); void show_state_info_dialog(StateRecord::Info _info); static std::string get_filesel_info(std::string); std::string create_new_floppy_image(std::string _dir, std::string _file, FloppyDiskType _type, bool _formatted); void reset_savestate_dialogs(std::string _dir); }; #endif
/* * Copyright (C) 1993,1994 Bernd Feige * This file is part of avg_q and released under the GPL v3 (see avg_q/COPYING). */ /* * complex.c routines for handling of complex numbers * -- Bernd Feige 4.05.1993 */ #include <math.h> #include "transform.h" #include "bf.h" GLOBAL double c_phase(complex cmpl) { return atan2(cmpl.Im, cmpl.Re); } GLOBAL double c_power(complex cmpl) { return cmpl.Re*cmpl.Re+cmpl.Im*cmpl.Im; } GLOBAL double c_abs(complex cmpl) { return sqrt(c_power(cmpl)); } GLOBAL complex c_add(complex cmpl1, complex cmpl2) { complex result; result.Re=cmpl1.Re+cmpl2.Re; result.Im=cmpl1.Im+cmpl2.Im; return result; } GLOBAL complex c_mult(complex cmpl1, complex cmpl2) { complex result; result.Re=cmpl1.Re*cmpl2.Re-cmpl1.Im*cmpl2.Im; result.Im=cmpl1.Re*cmpl2.Im+cmpl1.Im*cmpl2.Re; return result; } GLOBAL complex c_smult(complex cmpl, DATATYPE factor) { complex result; result.Re=cmpl.Re*factor; result.Im=cmpl.Im*factor; return result; } GLOBAL complex c_konj(complex cmpl) { complex result; result.Re= cmpl.Re; result.Im= -cmpl.Im; return result; } GLOBAL complex c_inv(complex cmpl) { return c_smult(c_konj(cmpl), 1.0/c_power(cmpl)); }
@interface SBUIControlCenterVisualEffect : UIVisualEffect { NSInteger _style; } +(id)effectWithStyle:(NSInteger)arg1 ; -(id)copyWithZone:(NSZone*)arg1 ; -(id)effectConfig; @end
/* * Copyright © 2011 magical * * This file is part of spriterip; it is licensed under the GNU GPLv3 * and comes with NO WARRANTY. See rip.c for details. */ #ifndef NARC_H #define NARC_H #include "nitro.h" /* struct format_info */ #include "common.h" /* u32 */ struct NARC; extern struct format_info NARC_format; extern void *narc_load_file(struct NARC *self, int index); extern u32 narc_get_file_size(struct NARC *self, int index); extern u32 narc_get_file_count(struct NARC *self); #endif /* NARC_H */
/* This file is part of QToyunda software Copyright (C) 2013 Sylvain "Skarsnik" Colinet <scolinet@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. 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 NEWTIMEDIALOG_H #define NEWTIMEDIALOG_H #include <QDialog> namespace Ui { class NewTimeDialog; } class NewTimeDialog : public QDialog { Q_OBJECT public: explicit NewTimeDialog(QWidget *parent = 0); ~NewTimeDialog(); QString lyrFile; QString frmFile; QString iniFile; QString videoFile; QString subFile; QString baseDir; private slots: void on_titleEdit_textEdited(const QString &arg1); void on_prefixEdit_textEdited(const QString &arg1); void on_videoChooseButton_clicked(); void on_lyrChooseButton_clicked(); void on_frmChooseButton_clicked(); void on_buttonBox_accepted(); private: Ui::NewTimeDialog *ui; bool m_lyrChoosed; bool m_frmChoosed; bool m_iniChoosed; void setBaseDir(QString file); }; #endif // NEWTIMEDIALOG_H
/* * Copyright (C) 2011-2012 Matias Valdenegro <matias.valdenegro@gmail.com> * This file is part of KResearch. * * kesearch 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 of the License. * * kresearch 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 KResearch. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ATTACHMENTELEMENT_H_ #define ATTACHMENTELEMENT_H_ #include <QWidget> class AttachmentElement : QWidget { public: AttachmentElement(); virtual ~AttachmentElement(); }; #endif /* ATTACHMENTELEMENT_H_ */
#ifndef ACTIONPOOL_H #define ACTIONPOOL_H #include <QObject> #include "action.h" class Action; class ActionPool : public QObject { Q_OBJECT public: explicit ActionPool(QObject *parent = 0); virtual ~ActionPool(); QList<Action*> actions() const; void addAction(Action*); bool removeAction(Action*); bool contains(Action*) const; Action* actionFromParent(GameObject*) const; int size() const; signals: void destroyed(ActionPool*); private slots: void onActionDestroyed(QObject*); private: QList<Action*> mActions; }; #endif // ACTIONPOOL_H
#include "stm32f10x.h" #include "clock_hal.h" #include "main.h" volatile uint32_t ms_ticks; volatile uint32_t uwTimingDelay; RCC_ClocksTypeDef RCC_Clocks; /** * @brief Decrements the TimingDelay variable. * @param None * @retval None */ void TimingDelay_Decrement(void) { if (uwTimingDelay != 0x00) { uwTimingDelay--; } } /** * @brief This function handles SysTick Handler. * @param None * @retval None */ void SysTick_Handler(void) { ms_ticks++; TimingDelay_Decrement(); millisecond_interval_timer(); } void clock_init_hal(void){ RCC_GetClocksFreq(&RCC_Clocks); SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000); }
/* $License: Copyright (C) 2011 InvenSense Corporation, All Rights Reserved. See included License.txt for License information. $ */ /******************************************************************************* * * $Id: mlmath.c 5629 2011-06-11 03:13:08Z mcaramello $ * *******************************************************************************/ #include <math.h> double ml_asin (double x) { return asin (x); } double ml_atan (double x) { return atan (x); } double ml_atan2 (double x, double y) { return atan2 (x, y); } double ml_log (double x) { return log (x); } double ml_sqrt (double x) { return sqrt (x); } double ml_ceil (double x) { return ceil (x); } double ml_floor (double x) { return floor (x); } double ml_cos (double x) { return cos (x); } double ml_sin (double x) { return sin (x); } double ml_acos (double x) { return acos (x); } double ml_pow (double x, double y) { return pow (x, y); }
/* HHKfun.h - Auxiliary function definitions for H-H K channels. */ /* S. Engblom 2019-12-03 */ #ifndef HHKFUN_H #define HHKFUN_H /* forward declarations */ double HHK_alpha1(const double v); double HHK_beta1(const double v); #endif /* HHKFUN_H */
/* * stack_guard.c is a piece of uCon 2009 Capture The Flag code * Copyright (C) 2002 Marcos Alvares <marcos.alvares@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, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define STACK_PROTECTION typedef unsigned int uint; unsigned int safe_eip = 0; void __smash_the_stack (char *params); unsigned long __get_ebp(void); int main (int argc, char *argv[]) { if (argc != 2) { printf("\n::. Test smashing the stack .::\n"); printf(" usage: %s <params>\n", argv[0]); exit(1); } __smash_the_stack (argv[1]); return 0; } void __smash_the_stack (char *params) { #ifdef STACK_PROTECTION unsigned long canary[1]; canary[0] = 0x11111111; #endif char buffer[20]; strcpy(buffer, params); #ifdef STACK_PROTECTION printf("%#x\n\n", canary); if (*canary != 0x11111111) { printf("the base stack has been modified\n"); exit(0); } #endif // exit(0); } int check_canary (unsigned long *address, unsigned long value) { } unsigned long __get_ebp(void) { __asm__("movl %ebp, %eax"); }
/* io.h --- * * Filename: io.h * Author: Jules <archjules> * Created: Sun Dec 11 23:20:25 2016 (+0100) * Last-Updated: Sun Dec 11 23:21:06 2016 (+0100) * By: Jules <archjules> */ #ifndef IO_H #define IO_H uint8_t io_handle_read(struct CPU *, uint8_t port); void io_handle_write(struct CPU *, uint8_t port, uint8_t value); #endif /* IO_H */
#pragma once #include "stdafx.h" using namespace irr; using namespace video; using namespace System; namespace IrrlichtLime { namespace Video { [Flags] /// <summary> /// Enumeration values for enabling/disabling color planes for rendering. /// </summary> public enum class ColorPlane { /// <summary> /// No color enabled. /// </summary> None = ECP_NONE, /// <summary> /// Alpha enabled. /// </summary> Alpha = ECP_ALPHA, /// <summary> /// Red enabled. /// </summary> Red = ECP_RED, /// <summary> /// Green enabled. /// </summary> Green = ECP_GREEN, /// <summary> /// Blue enabled. /// </summary> Blue = ECP_BLUE, /// <summary> /// All colors, no alpha. /// </summary> RGB = ECP_RGB, /// <summary> /// All planes enabled. /// </summary> All = ECP_ALL }; } // end namespace Video } // end namespace IrrlichtLime
/* Copyright (C) 2014 Sergey Lamzin, https://github.com/sergeylamzin/stark This file is part of the StarK genome assembler. StarK 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. StarK 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 Foobar. If not, see <http://www.gnu.org/licenses/>. */ #ifndef STARK_STATUS_H #define STARK_STATUS_H #include <pthread.h> #include <stdlib.h> #include <stdio.h> #include <stdint.h> #include <sys/syscall.h> struct stark_status_s { pthread_mutex_t mutex; // thread_pool_t threadpool; struct distributor_s * distributor; volatile struct stark_thread_status_s * stark_thread_status; struct stark_hierarchical_assembler_s * hierarchical_assembler; // stark_t * stark; size_t reads_total; }; struct stark_thread_status_s { volatile struct stark_thread_status_s * next; pthread_t thread_id; size_t reads_inserted; // const char* current_action; struct { char * seq4; size_t length; size_t maxk; } current_insert; size_t total_insert_mis; size_t total_insertions; int last_cpu; pid_t linux_tid; struct stark_coverage_mytoken_s * mytoken; struct stark_hierarchical_assembler_test_and_merge_groups_dispatch_s * volatile dispatch; char current_action[128]; }; int stark_status_init(uintptr_t port); void stark_status_kill(); void stark_status_register_thread(); // const char stark_status_action_waiting_for_jobs[] = "Waiting for Jobs."; // const char stark_status_action_waiting_for_barrier[] = "Waiting on Barrier Job."; extern const char stark_status_action_inserting_read[]; extern volatile struct stark_status_s stark_status; // #ifndef __MACH__ #define get_stark_thread_status() stark_thread_status // #else // static inline volatile struct stark_thread_status_s * get_stark_thread_status() { // volatile struct stark_thread_status_s * next; // for (next = stark_status.stark_thread_status; next; next = next->next) { // if (next->thread_id == pthread_self()) // return next; // } // return NULL; // } // #endif // #ifdef SYS_getcpu // static inline int getcpu() { // int cpu, status; // status = syscall(SYS_getcpu, &cpu, NULL, NULL); // return (status == -1) ? status : cpu; // } // // static inline void stark_status_update_last_cpu() { // if (get_stark_thread_status()) // get_stark_thread_status()->last_cpu = getcpu(); // } // #else // #define stark_status_update_last_cpu() // #endif // #define stark_set_status_action(...) if (get_stark_thread_status()) // snprintf((char *)(get_stark_thread_status()->current_action), sizeof(get_stark_thread_status()->current_action), __VA_ARGS__) #ifndef STARK_MAIN_STATUS_C #define STARK_MAIN_STATUS_C extern #endif STARK_MAIN_STATUS_C struct stark_thread_status_s * stark_thread_status; #pragma omp threadprivate(stark_thread_status) #include <stdarg.h> static inline void stark_set_status_action(const char *fmt, ...) { if (get_stark_thread_status()) { va_list args; va_start(args, fmt); vsnprintf((char *)(get_stark_thread_status()->current_action), sizeof(get_stark_thread_status()->current_action), fmt, args); va_end(args); } } // #endif // static inline void stark_set_status_action(const char * status) { // if (get_stark_thread_status()) { // // } // get_stark_thread_status()->current_action = status; // } #endif
#include <Sensoria.h> #include <SensoriaCore/Communicator.h> #include <SensoriaCore/common.h> #include <SensoriaCore/utils.h> #include <SensoriaCore/debug.h> class ByteAddress: public SensoriaAddress { public: byte addr; // 0 = Broadcast, 1-255 = Valid client addresses boolean inUse; char* toString (char* buf, byte size) const override { if (size >= 4) utoa ((unsigned int) addr, buf, 10); else buf[0] = '\0'; return buf; } protected: virtual bool equalTo (const SensoriaAddress& otherBase) const override { const ByteAddress& other = static_cast<const ByteAddress&> (otherBase); return addr == other.addr; } virtual void clone (const SensoriaAddress& otherBase) override { const ByteAddress& other = static_cast<const ByteAddress&> (otherBase); addr = other.addr; } // Default copy/assignment operators should be fine }; /******************************************************************************/ class SensoriaSerialCommunicator: public SensoriaCommunicator { private: static const byte N_ADDRESSES = 6; ByteAddress addressPool[N_ADDRESSES]; static const byte BUF_SIZE = 64; Stream *serial; byte myAddr; static const byte BROADCAST_ADDRESS = 0; char *readSerialString () { static char buf[BUF_SIZE]; static int i = 0; char *ret = NULL; while (serial -> available ()) { char c = serial -> read (); switch (c) { case '\r': // Ignore break; case '\n': // End of string, process buf[i] = '\0'; // This will always be possible ret = buf; i = 0; break; case -1: // No char available to read break; default: // Got new char, append if (i < BUF_SIZE - 1) buf[i++] = c; break; } } return ret; } boolean receiveGeneric (char*& str, byte& senderAddr, byte& destAddr) { // Assume we'll receive nothing boolean ret = false; if ((str = readSerialString ())) { char *p[3]; if (splitString (str, p, 3) == 3) { int n = atoi (p[0]); if (n > 0 && n <= 255) { // Sender cannot be broadcast address senderAddr = n; n = atoi (p[1]); if (n >= 0 && n <= 255) { destAddr = n; str = p[2]; #if 0 DPRINT (F("Received packet of size ")); DPRINT (packetSize); DPRINT (F(" from ")); DPRINT (senderAddr); DPRINT (F(" to ")); DPRINT (destAddr); DPRINT (F(": \"")); DPRINT (str); DPRINTLN (F("\"")); #endif ret = true; } else { DPRINTLN (F("Invalid destination address")); } } else { DPRINTLN (F("Invalid source address")); } } else { DPRINTLN (F("Received malformed message")); } } return ret; } boolean sendGeneric (const char *str, byte destAddr) { return serial -> print (myAddr) && serial -> print (' ') && serial -> print (destAddr) && serial -> print (' ') && serial -> print (str); } public: SensoriaSerialCommunicator () { } bool begin (Stream& _serial, byte addr) { serial = &_serial; myAddr = addr; return myAddr != BROADCAST_ADDRESS; } virtual SensoriaAddress* getAddress () override { SensoriaAddress* ret = NULL; #if 0 byte cnt = 0; for (byte i = 0; i < N_ADDRESSES && !ret; i++) { if (!addressPool[i].inUse) ++cnt; } DPRINT (F("Addresses not in use: ")); DPRINTLN (cnt); #endif for (byte i = 0; i < N_ADDRESSES && !ret; i++) { if (!addressPool[i].inUse) { addressPool[i].inUse = true; ret = &(addressPool[i]); } } return ret; } virtual void releaseAddress (SensoriaAddress* addr) override { for (byte i = 0; i < N_ADDRESSES; i++) { if (&(addressPool[i]) == addr) { addressPool[i].inUse = false; } } } #ifdef ENABLE_NOTIFICATIONS virtual SensoriaAddress* getNotificationAddress (const SensoriaAddress* client) { ByteAddress* bAddr = reinterpret_cast<ByteAddress*> (getAddress ()); if (bAddr) { const ByteAddress& clientBAddr = *reinterpret_cast<const ByteAddress*> (client); bAddr -> addr = clientBAddr.addr; } return bAddr; } #endif virtual boolean receiveCmd (char*& cmd, SensoriaAddress* client) override { ByteAddress& bAddr = *const_cast<ByteAddress*> (reinterpret_cast<const ByteAddress*> (client)); byte destAddr; return receiveGeneric (cmd, bAddr.addr, destAddr) && bAddr.addr != myAddr && (destAddr == myAddr || destAddr == BROADCAST_ADDRESS); } virtual SendResult reply (const char* reply, const SensoriaAddress* client) override { ByteAddress& bAddr = *const_cast<ByteAddress*> (reinterpret_cast<const ByteAddress*> (client)); return sendGeneric (reply, bAddr.addr) ? SEND_OK : SEND_ERR; } virtual boolean notify (const char* notification, const SensoriaAddress* client) override { ByteAddress& bAddr = *const_cast<ByteAddress*> (reinterpret_cast<const ByteAddress*> (client)); return sendGeneric (notification, bAddr.addr) ? SEND_OK : SEND_ERR; } SendResult sendCmd (const char* cmd, const SensoriaAddress* server, char*& reply) override { ByteAddress& bAddr = *const_cast<ByteAddress*> (reinterpret_cast<const ByteAddress*> (server)); SendResult res = sendGeneric (cmd, bAddr.addr) ? SEND_OK : SEND_ERR; if (res > 0) { unsigned long start = millis (); while (millis () - start < CLIENT_TIMEOUT) { byte srcAddr, destAddr; if (receiveGeneric (reply, srcAddr, destAddr) && srcAddr == bAddr.addr && destAddr == myAddr) { // Got something break; } } if (millis () - start >= CLIENT_TIMEOUT) res = SEND_TIMEOUT; } return res; } virtual SendResult broadcast (const char* cmd) override { (void) cmd; return SEND_ERR; } virtual boolean receiveBroadcastReply (char*& reply, SensoriaAddress*& sender, unsigned int timeout) override { (void) reply; (void) sender; (void) timeout; return false; } #ifdef ENABLE_NOTIFICATIONS virtual boolean receiveNotification (char*& notification) override { (void) notification; return false; } #endif };
// // HYCarouselViewCell.h // iOSAppFrame // // Created by chyrain on 2017/7/1. // Copyright © 2017年 Chyrain. All rights reserved. // #import <UIKit/UIKit.h> @interface HYCarouselViewCell : UICollectionViewCell @property (nonatomic, weak) UIImageView *iconView; @end
/******************************************************************** ** Copyright (c) 2018-2020 Guan Wenliang ** This file is part of the Berry default interpreter. ** skiars@qq.com, https://github.com/Skiars/berry ** See Copyright Notice in the LICENSE file or at ** https://github.com/Skiars/berry/blob/master/LICENSE ********************************************************************/ #ifndef BE_MAP_H #define BE_MAP_H #include "be_object.h" typedef struct bmapkey { union bvaldata v; uint32_t type:8; uint32_t next:24; } bmapkey; typedef struct bmapnode { bmapkey key; bvalue value; } bmapnode; struct bmap { bcommon_header; bgcobject *gray; /* for gc gray list */ bmapnode *slots; bmapnode *lastfree; int size; int count; #ifdef __cplusplus BE_CONSTEXPR bmap(bmapnode *s, int n) : next(0), type(BE_MAP), marked(GC_CONST), gray(0), slots(s), lastfree(0), size(n), count(n) {} #endif }; typedef bmapnode *bmapiter; #define be_map_iter() NULL #define be_map_count(map) ((map)->count) #define be_map_size(map) (map->size) #define be_map_key2value(dst, node) do { \ (dst)->type = (node)->key.type; \ (dst)->v = (node)->key.v; \ } while (0); bmap* be_map_new(bvm *vm); void be_map_delete(bvm *vm, bmap *map); bvalue* be_map_find(bvm *vm, bmap *map, bvalue *key); bvalue* be_map_insert(bvm *vm, bmap *map, bvalue *key, bvalue *value); int be_map_remove(bvm *vm, bmap *map, bvalue *key); bvalue* be_map_findstr(bvm *vm, bmap *map, bstring *key); bvalue* be_map_insertstr(bvm *vm, bmap *map, bstring *key, bvalue *value); void be_map_removestr(bvm *vm, bmap *map, bstring *key); bmapnode* be_map_next(bmap *map, bmapiter *iter); bmapnode* be_map_val2node(bvalue *value); void be_map_compact(bvm *vm, bmap *map); #endif
#include <stdio.h> /* * Copied from include/linux/... */ #undef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) /** * container_of - cast a member of a structure out to the containing structure * @ptr: the pointer to the member. * @type: the type of the container struct this is embedded in. * @member: the name of the member within the struct. * */ #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) int main(int argc, char* argv[]){ /* statement, the x result is 5*/ int x = ({1; 2;}) + 3; printf("%d\n", x); x = 5; typeof(x) y = 6; printf("%d %d\n", x, y); struct s { char j1; char j2; }s_t; char *m1, *m2; m1 = &(s_t.j1); m2 = &(s_t.j2); /* This will print 1 */ printf("m1 %d\n", &((struct s*)0)->j1); printf("m2 %d\n", &((struct s*)0)->j2); printf("s addr:0x%08x\n", &s_t); printf("m1 addr:0x%08x\n", m1); printf("m2 addr:0x%08x\n", m2); printf("m1 addr:0x%08x\n", container_of(m1, struct s, j1)); printf("m2 addr:0x%08x\n", container_of(m2, struct s, j2)); return 0; }
/*! * \file * * Copyright (c) 2010 Johann A. Briffa * * This file is part of SimCommSys. * * SimCommSys 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. * * SimCommSys 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 SimCommSys. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __repacc_h #define __repacc_h #include "config.h" #include "codec_softout.h" #include "memoryless.h" #include "fsm.h" #include "interleaver.h" #include "safe_bcjr.h" namespace libcomm { /*! * \brief Repeat-Accumulate (RA) codes. * \author Johann Briffa * * These codes are decoded using the MAP decoder, rather than the * sum-product algorithm. * * \todo Avoid divisions when computing extrinsic information * * \todo Implement accumulator as mapcc * * \todo Generalize repeater and accumulator */ template <class real, class dbl = double> class repacc : public codec_softout<libbase::vector, dbl> { private: // Shorthand for class hierarchy typedef repacc<real, dbl> This; public: /*! \name Type definitions */ typedef libbase::vector<int> array1i_t; typedef libbase::vector<dbl> array1d_t; typedef libbase::matrix<dbl> array2d_t; typedef libbase::vector<array1d_t> array1vd_t; // @} private: /*! \name User-defined parameters */ //! Interleaver between repeater and accumulator boost::shared_ptr<interleaver<dbl> > inter; //! Memoryless codec representation of repetition code memoryless<dbl> rep; boost::shared_ptr<fsm> acc; //!< Encoder representation of accumulator int iter; //!< Number of iterations to perform bool endatzero; //!< Flag to indicate that trellises are terminated dbl limitlo; //!< Lower clipping threshold // @} protected: /*! \name Internal object representation */ safe_bcjr<real, dbl> BCJR; //!< BCJR algorithm implementation bool initialised; //!< Flag to indicate when memory is initialised array1vd_t rp; //!< Intrinsic source statistics (natural) array2d_t ra; //!< Extrinsic accumulator-input statistics (natural) array2d_t R; //!< Intrinsic accumulator-output statistics (interleaved) // @} protected: /*! \name Internal functions */ void init(); void reset(); //! Memory allocator (for internal use only) void allocate(); //! Determine the number of timesteps for the accumulator int acc_timesteps() const { // Inherit sizes const int Nr = rep.output_block_size(); const int k = acc->num_inputs(); const int nu = endatzero ? acc->mem_order() : 0; return Nr / k + nu; } // @} // Internal codec operations void resetpriors(); void setpriors(const array1vd_t& ptable); void setreceiver(const array1vd_t& ptable); // Interface with derived classes void advance() const { // Advance interleaver to the next block inter->advance(); } void do_encode(const array1i_t& source, array1i_t& encoded); void do_init_decoder(const array1vd_t& ptable) { setreceiver(ptable); resetpriors(); } void do_init_decoder(const array1vd_t& ptable, const array1vd_t& app) { setreceiver(ptable); setpriors(app); } public: /*! \name Constructors / Destructors */ repacc() { } ~repacc() { } // @} // Codec operations void seedfrom(libbase::random& r) { // Call base method first codec_softout<libbase::vector, dbl>::seedfrom(r); // Seed interleaver inter->seedfrom(r); } void softdecode(array1vd_t& ri); void softdecode(array1vd_t& ri, array1vd_t& ro); // Codec information functions - fundamental libbase::size_type<libbase::vector> input_block_size() const { // Inherit sizes const int N = rep.input_block_size(); return libbase::size_type<libbase::vector>(N); } libbase::size_type<libbase::vector> output_block_size() const { // Inherit sizes const int k = acc->num_inputs(); const int n = acc->num_outputs(); const int tau = acc_timesteps(); // Calculate internal sizes const int p = n - k; return libbase::size_type<libbase::vector>(tau * p); } int num_inputs() const { return acc->num_symbols(); } int num_outputs() const { return acc->num_symbols(); } int num_iter() const { return iter; } /*! \name Codec information functions - internal */ int num_repeats() const { return int(round(log(rep.num_outputs()) / log(rep.num_inputs()))); } const boost::shared_ptr<interleaver<dbl> > get_inter() const { return inter; } // @} // Description std::string description() const; // Serialization Support DECLARE_SERIALIZER(repacc) }; } // end namespace #endif
// // DHHBannerView.h // AntiqueCatalog // // Created by Cangmin on 16/1/4. // Copyright © 2016年 Cangmin. All rights reserved. // #import <UIKit/UIKit.h> @class DHHBannerView; @protocol DHHBannerViewDelegate <NSObject> @optional - (void)bannerView:(DHHBannerView *)bannerView didClickedImageIndex:(NSInteger)index; @end @interface DHHBannerView : UIView #pragma mark - Class methods /** * init a LCBannerView object from local * * @param frame frame * @param delegate delegate * @param imageName image name. eg: `banner_01@2x.png`, `banner_02@2x.png`... you should set it `banner` * @param count images count * @param timeInterval time interval * @param currentPageIndicatorTintColor current page indicator tint color * @param pageIndicatorTintColor other page indicator tint color * * @return a LCBannerView object */ + (instancetype)bannerViewWithFrame:(CGRect)frame delegate:(id<DHHBannerViewDelegate>)delegate imageName:(NSString *)imageName count:(NSInteger)count timerInterval:(NSInteger)timeInterval currentPageIndicatorTintColor:(UIColor *)currentPageIndicatorTintColor pageIndicatorTintColor:(UIColor *)pageIndicatorTintColor; /** * init a LCBannerView object from internet * * @param frame frame * @param delegate delegate * @param imageURLs image's URLs * @param placeholderImage placeholder image * @param timeInterval time interval * @param currentPageIndicatorTintColor current page indicator tint color * @param pageIndicatorTintColor other page indicator tint color * * @return a LCBannerView object */ + (instancetype)bannerViewWithFrame:(CGRect)frame delegate:(id<DHHBannerViewDelegate>)delegate imageURLs:(NSArray *)imageURLs placeholderImage:(NSString *)placeholderImage timerInterval:(NSInteger)timeInterval currentPageIndicatorTintColor:(UIColor *)currentPageIndicatorTintColor pageIndicatorTintColor:(UIColor *)pageIndicatorTintColor; #pragma mark - Instance methods /** * init a LCBannerView object from local * * @param frame frame * @param delegate delegate * @param imageName image name. eg: `banner_01@2x.png`, `banner_02@2x.png`... you should set it `banner` * @param count images count * @param timeInterval time interval * @param currentPageIndicatorTintColor current page indicator tint color * @param pageIndicatorTintColor other page indicator tint color * * @return a LCBannerView object */ - (instancetype)initWithFrame:(CGRect)frame delegate:(id<DHHBannerViewDelegate>)delegate imageName:(NSString *)imageName count:(NSInteger)count timerInterval:(NSInteger)timeInterval currentPageIndicatorTintColor:(UIColor *)currentPageIndicatorTintColor pageIndicatorTintColor:(UIColor *)pageIndicatorTintColor; /** * init a LCBannerView object from internet * * @param frame frame * @param delegate delegate * @param imageURLs image's URLs * @param placeholderImage placeholder image * @param timeInterval time interval * @param currentPageIndicatorTintColor current page indicator tint color * @param pageIndicatorTintColor other page indicator tint color * * @return a LCBannerView object */ - (instancetype)initWithFrame:(CGRect)frame delegate:(id<DHHBannerViewDelegate>)delegate imageURLs:(NSArray *)imageURLs placeholderImage:(NSString *)placeholderImage timerInterval:(NSInteger)timeInterval currentPageIndicatorTintColor:(UIColor *)currentPageIndicatorTintColor pageIndicatorTintColor:(UIColor *)pageIndicatorTintColor; @end
#include "contacts.h" #include <malloc.h> int main() { contPtr info = (contPtr)malloc(sizeof(struct contacts)); info->name = "1"; vertexPtr rear = initVertex(info); rear = addVertexRelationOnName(rear, "1", "4"); rear = addVertexRelationOnName(rear, "4", "2"); rear = addVertexRelationOnName(rear, "2", "1"); rear = addVertexRelationOnName(rear, "5", "1"); rear = addVertexRelationOnName(rear, "2", "3"); vertexPtr target = getVertexBasedOnName(rear, "4"); vertexPtr src = getVertexBasedOnName(rear, "2"); bool e = DFS(src, target); e = 0; e = BFS(src, target); return 0; }
/* Copyright (c) 2012-2015 Todd Freed <todd.freed@gmail.com> This file is part of fab. fab 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. fab 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 fab. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _LOGGER_FILTER_INTERNAL_H #define _LOGGER_FILTER_INTERNAL_H #include "xapi.h" #include "filter.h" struct narrator; struct list; typedef struct filter { uint64_t v; // tag char u; // unknown, whether the tag text has any unrecognized components char o; // operation, '+' or '-' } filter; xapi filter_clone(filter * const restrict A, filter ** const restrict B) __attribute__((nonnull)); /// filter_free // // SUMMARY // free a filter with free semantics // void filter_free(filter * filterp); /// filter_ifree // // SUMMARY // free a filter with iwfree semantics // void filter_ifree(filter ** const restrict filterp) __attribute__((nonnull)); /// filter_say // // SUMMARY // // xapi filter_say(filter * filterp, struct narrator * N) __attribute__((nonnull)); /// filter_would // // SUMMARY // returns a boolean value indicating whether a log is passed by the filter // // PARAMETERS // filters - // ids - category ids // int filters_would(const struct list * const restrict filters, const uint64_t ids) __attribute__((nonnull)); #endif
/* * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) * From ASN.1 module "PMCPDLCAPDUsVersion1" * found in "../../../dumpvdl2.asn1/atn-b1_cpdlc-v1.asn1" * `asn1c -fcompound-names -fincludes-quoted -gen-PER` */ #include "CPDLCMessage.h" int CPDLCMessage_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_BIT_STRING.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using BIT_STRING, * so here we adjust the DEF accordingly. */ static void CPDLCMessage_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_BIT_STRING.free_struct; td->print_struct = asn_DEF_BIT_STRING.print_struct; td->check_constraints = asn_DEF_BIT_STRING.check_constraints; td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; td->der_encoder = asn_DEF_BIT_STRING.der_encoder; td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_BIT_STRING.per_constraints; td->elements = asn_DEF_BIT_STRING.elements; td->elements_count = asn_DEF_BIT_STRING.elements_count; td->specifics = asn_DEF_BIT_STRING.specifics; } void CPDLCMessage_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CPDLCMessage_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CPDLCMessage_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CPDLCMessage_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CPDLCMessage_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CPDLCMessage_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CPDLCMessage_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CPDLCMessage_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CPDLCMessage_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CPDLCMessage_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CPDLCMessage_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CPDLCMessage_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t CPDLCMessage_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { CPDLCMessage_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t CPDLCMessage_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { CPDLCMessage_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static const ber_tlv_tag_t asn_DEF_CPDLCMessage_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CPDLCMessage = { "CPDLCMessage", "CPDLCMessage", CPDLCMessage_free, CPDLCMessage_print, CPDLCMessage_constraint, CPDLCMessage_decode_ber, CPDLCMessage_encode_der, CPDLCMessage_decode_xer, CPDLCMessage_encode_xer, CPDLCMessage_decode_uper, CPDLCMessage_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CPDLCMessage_tags_1, sizeof(asn_DEF_CPDLCMessage_tags_1) /sizeof(asn_DEF_CPDLCMessage_tags_1[0]), /* 1 */ asn_DEF_CPDLCMessage_tags_1, /* Same as above */ sizeof(asn_DEF_CPDLCMessage_tags_1) /sizeof(asn_DEF_CPDLCMessage_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ };
/* *************************************************************************** * * Author: Teunis van Beelen * * Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Teunis van Beelen * * Email: teuniz@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. * * 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 PRINT_SCREEN_TO_EDF_H #define PRINT_SCREEN_TO_EDF_H #include <QtGlobal> #include <QApplication> #include <QFileDialog> #include <QMessageBox> #include <QString> #include <QCursor> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "global.h" #include "mainwindow.h" #include "filter.h" #include "utc_date_time.h" #include "edf_helper.h" #include "edf_annot_list.h" #include "third_party/fidlib/fidlib.h" class UI_Mainwindow; void print_screen_to_edf(UI_Mainwindow *); #endif // PRINT_SCREEN_TO_EDF_H
#include <stdio.h> int main () { int arr[1000] = {0}, p, i, j, count; for (i = 2; i * i < 1000; i++) if (!arr[i]) for (j = i * 2; j < 1000; j += i) arr[j] = 1; printf ("The prime numbers between 1 and 999 are:\n"); for (i = 2, count = 0; i < 1000; i++) if (!arr[i]) { printf ("%d", i); count++; if (count % 5) printf ("\t"); else printf ("\n"); } return 0; }
/* * Process Hacker - * Process properties: Token page * * Copyright (C) 2009-2016 wj32 * * This file is part of Process Hacker. * * Process Hacker is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Process Hacker is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Process Hacker. If not, see <http://www.gnu.org/licenses/>. */ #include <phapp.h> #include <procprp.h> #include <procprpp.h> NTSTATUS NTAPI PhpOpenProcessTokenForPage( _Out_ PHANDLE Handle, _In_ ACCESS_MASK DesiredAccess, _In_opt_ PVOID Context ) { NTSTATUS status; HANDLE processHandle; if (!NT_SUCCESS(status = PhOpenProcess( &processHandle, ProcessQueryAccess, (HANDLE)Context ))) return status; status = PhOpenProcessToken(processHandle, DesiredAccess, Handle); NtClose(processHandle); return status; } INT_PTR CALLBACK PhpProcessTokenHookProc( _In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam ) { switch (uMsg) { case WM_DESTROY: { RemoveProp(hwndDlg, PhMakeContextAtom()); } break; case WM_SHOWWINDOW: { if (!GetProp(hwndDlg, PhMakeContextAtom())) // LayoutInitialized { PPH_LAYOUT_ITEM dialogItem; HWND groupsLv; HWND privilegesLv; // This is a big violation of abstraction... dialogItem = PhAddPropPageLayoutItem(hwndDlg, hwndDlg, PH_PROP_PAGE_TAB_CONTROL_PARENT, PH_ANCHOR_ALL); PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_USER), dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT); PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_USERSID), dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT); PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_VIRTUALIZED), dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT); PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_APPCONTAINERSID), dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT); PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_GROUPS), dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT); PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_PRIVILEGES), dialogItem, PH_ANCHOR_ALL); PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_INSTRUCTION), dialogItem, PH_ANCHOR_LEFT | PH_ANCHOR_BOTTOM); PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_INTEGRITY), dialogItem, PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM); PhAddPropPageLayoutItem(hwndDlg, GetDlgItem(hwndDlg, IDC_ADVANCED), dialogItem, PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM); PhDoPropPageLayout(hwndDlg); groupsLv = GetDlgItem(hwndDlg, IDC_GROUPS); privilegesLv = GetDlgItem(hwndDlg, IDC_PRIVILEGES); if (ListView_GetItemCount(groupsLv) != 0) { ListView_SetColumnWidth(groupsLv, 0, LVSCW_AUTOSIZE); ExtendedListView_SetColumnWidth(groupsLv, 1, ELVSCW_AUTOSIZE_REMAININGSPACE); } if (ListView_GetItemCount(privilegesLv) != 0) { ListView_SetColumnWidth(privilegesLv, 0, LVSCW_AUTOSIZE); ListView_SetColumnWidth(privilegesLv, 1, LVSCW_AUTOSIZE); ExtendedListView_SetColumnWidth(privilegesLv, 2, ELVSCW_AUTOSIZE_REMAININGSPACE); } SetProp(hwndDlg, PhMakeContextAtom(), (HANDLE)TRUE); } } break; } return FALSE; }
/* Copyright (C) 2014 Andrew Pratt View the README */ #pragma once #include "quadcore.h" void clear_correction(struct quad_state *curr); void accel_correction(struct quad_state *curr, struct quad_state *past, struct quad_static *stat); void mag_correction(struct quad_state *curr, struct quad_state *past, struct quad_static *stat);
/** ****************************************************************************** * @file Examples_MIX/DMA/DMA_FLASHToRAM/Inc/stm32f0xx_it.h * @author MCD Application Team * @brief This file contains the headers of the interrupt handlers. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F0xx_IT_H #define __STM32F0xx_IT_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "main.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NMI_Handler(void); void HardFault_Handler(void); void SVC_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); void DMA_INSTANCE_IRQHANDLER(void); #ifdef __cplusplus } #endif #endif /* __STM32F0xx_IT_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* Minetest Copyright (C) 2013 sapier, <sapier AT gmx DOT net> 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 2.1 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef CPP_API_ASYNC_EVENTS_HEADER #define CPP_API_ASYNC_EVENTS_HEADER #include <vector> #include <deque> #include <map> #include "threading/thread.h" #include "threading/mutex.h" #include "threading/semaphore.h" #include "debug.h" #include "lua.h" #include "cpp_api/s_base.h" // Forward declarations class AsyncEngine; // Declarations // Data required to queue a job struct LuaJobInfo { // Function to be called in async environment std::string serializedFunction; // Parameter to be passed to function std::string serializedParams; // Result of function call std::string serializedResult; // JobID used to identify a job and match it to callback unsigned int id; bool valid; }; // Asynchronous working environment class AsyncWorkerThread : public Thread, public ScriptApiBase { public: AsyncWorkerThread(AsyncEngine* jobDispatcher, const std::string &name); virtual ~AsyncWorkerThread(); void *run(); private: AsyncEngine *jobDispatcher; }; // Asynchornous thread and job management class AsyncEngine { friend class AsyncWorkerThread; public: AsyncEngine(); ~AsyncEngine(); /** * Register function to be used within engine * @param name Function name to be used within Lua environment * @param func C function to be called */ bool registerFunction(const char* name, lua_CFunction func); /** * Create async engine tasks and lock function registration * @param numEngines Number of async threads to be started */ void initialize(unsigned int numEngines); /** * Queue an async job * @param func Serialized lua function * @param params Serialized parameters * @return jobid The job is queued */ unsigned int queueAsyncJob(std::string func, std::string params); /** * Engine step to process finished jobs * the engine step is one way to pass events back, PushFinishedJobs another * @param L The Lua stack */ void step(lua_State *L); /** * Push a list of finished jobs onto the stack * @param L The Lua stack */ void pushFinishedJobs(lua_State *L); protected: /** * Get a Job from queue to be processed * this function blocks until a job is ready * @return a job to be processed */ LuaJobInfo getJob(); /** * Put a Job result back to result queue * @param result result of completed job */ void putJobResult(LuaJobInfo result); /** * Initialize environment with current registred functions * this function adds all functions registred by registerFunction to the * passed lua stack * @param L Lua stack to initialize * @param top Stack position */ void prepareEnvironment(lua_State* L, int top); private: // Variable locking the engine against further modification bool initDone; // Internal store for registred functions UNORDERED_MAP<std::string, lua_CFunction> functionList; // Internal counter to create job IDs unsigned int jobIdCounter; // Mutex to protect job queue Mutex jobQueueMutex; // Job queue std::deque<LuaJobInfo> jobQueue; // Mutex to protect result queue Mutex resultQueueMutex; // Result queue std::deque<LuaJobInfo> resultQueue; // List of current worker threads std::vector<AsyncWorkerThread*> workerThreads; // Counter semaphore for job dispatching Semaphore jobQueueCounter; }; #endif // CPP_API_ASYNC_EVENTS_HEADER
/*! \brief The view controller for the crossword entry table. */ #pragma once #include <QModelIndex> #include <QTableView> namespace ui { class CrosswordEntryTableViewController : public QTableView { Q_OBJECT public: explicit CrosswordEntryTableViewController(QWidget* parent = 0); void sortEntriesByIdentifierAscending(); void sortByAlphabeticalOrderOfClue(); public slots: void conflictingWordError(); void reportGuessAccepted(QString guess); void reportGuessAmended(QString removedLetters); void reportGuessErased(); void reportGuessAmendationRejected(); signals: void guessSubmitted(QString guess, QModelIndex index); void guessAmendationRequested(QString guess, QModelIndex index); void guessErasureRequested(QModelIndex index); void modelIndexChanged(const QModelIndex& selected, const QModelIndex& deselected); protected: void keyPressEvent(QKeyEvent* event); void currentChanged(const QModelIndex& current, const QModelIndex& previous); int sizeHintForColumn(int column) const; void keyboardSearch(const QString& search); private: bool enterGuess(); bool amendGuess(); bool eraseGuess(); bool validateInput(QString guess, unsigned int requiredLength); void readCurrentIdentifier(); void readCurrentEntryNumber(); void readCurrentGuess(); void readCurrentClue(); void readWordLengths(); void sortEntries(); }; }
/* File: expreval.c Auth: Brian Allen Vanderburg II Date: Wednesday, April 30, 2003 Desc: Evaluation routines for the ExprEval library This file is part of ExprEval. */ /* Includes */ #include "exprincl.h" #include "exprpriv.h" /* Defines for error checking */ #include <errno.h> #if (EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK) #define EXPR_RESET_ERR() errno = 0 #define EXPR_CHECK_ERR() if (errno) return EXPR_ERROR_OUTOFRANGE #else #define EXPR_RESET_ERR() #define EXPR_CHECK_ERR() #endif /* This routine will evaluate an expression */ int exprEval(exprObj * obj, EXPRTYPE * val) { EXPRTYPE dummy; if (val == NULL) val = &dummy; /* Make sure it was parsed successfully */ if (!obj->parsedbad && obj->parsedgood && obj->headnode) { /* Do NOT reset the break count. Let is accumulate between calls until breaker function is called */ return exprEvalNode(obj, obj->headnode, 0, val); } else return EXPR_ERROR_BADEXPR; } /* Evaluate a node */ int exprEvalNode(exprObj * obj, exprNode * nodes, int curnode, EXPRTYPE * val) { int err; int pos; EXPRTYPE d1, d2; if (obj == NULL || nodes == NULL) return EXPR_ERROR_NULLPOINTER; /* Update n to point to correct node */ nodes += curnode; /* Check breaker count */ if (obj->breakcur-- <= 0) { /* Reset count before returning */ obj->breakcur = obj->breakcount; if (exprGetBreakResult(obj)) { return EXPR_ERROR_BREAK; } } switch (nodes->type) { case EXPR_NODETYPE_MULTI: { /* Multi for multiple expressions in one string */ for (pos = 0; pos < nodes->data.oper.nodecount; pos++) { err = exprEvalNode(obj, nodes->data.oper.nodes, pos, val); if (err) return err; } break; } case EXPR_NODETYPE_ADD: { /* Addition */ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1); if (!err) err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2); if (!err) *val = d1 + d2; else return err; break; } case EXPR_NODETYPE_SUBTRACT: { /* Subtraction */ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1); if (!err) err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2); if (!err) *val = d1 - d2; else return err; break; } case EXPR_NODETYPE_MULTIPLY: { /* Multiplication */ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1); if (!err) err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2); if (!err) *val = d1 * d2; else return err; break; } case EXPR_NODETYPE_DIVIDE: { /* Division */ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1); if (!err) err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2); if (!err) { if (d2 != 0.0) *val = d1 / d2; else { #if (EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK) return EXPR_ERROR_DIVBYZERO; #else *val = 0.0; return EXPR_ERROR_NOERROR; #endif } } else return err; break; } case EXPR_NODETYPE_EXPONENT: { /* Exponent */ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1); if (!err) err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2); if (!err) { EXPR_RESET_ERR(); *val = pow(d1, d2); EXPR_CHECK_ERR(); } else return err; break; } case EXPR_NODETYPE_NEGATE: { /* Negative value */ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1); if (!err) *val = -d1; else return err; break; } case EXPR_NODETYPE_VALUE: { /* Directly access the value */ *val = nodes->data.value.value; break; } case EXPR_NODETYPE_VARIABLE: { /* Directly access the variable or constant */ *val = *(nodes->data.variable.vaddr); break; } case EXPR_NODETYPE_ASSIGN: { /* Evaluate assignment subnode */ err = exprEvalNode(obj, nodes->data.assign.node, 0, val); if (!err) { /* Directly assign the variable */ *(nodes->data.assign.vaddr) = *val; } else return err; break; } case EXPR_NODETYPE_FUNCTION: { /* Evaluate the function */ if (nodes->data.function.fptr == NULL) { /* No function pointer means we are not using function solvers. See if the function has a type to solve directly. */ switch (nodes->data.function.type) { /* This is to keep the file from being too crowded. See exprilfs.h for the definitions. */ #include "exprilfs.h" default: { return EXPR_ERROR_UNKNOWN; } } } else { /* Call the correct function */ return (*(nodes->data.function.fptr)) (obj, nodes->data.function.nodes, nodes->data.function.nodecount, nodes->data.function.refs, nodes->data.function.refcount, val); } break; } default: { /* Unknown node type */ return EXPR_ERROR_UNKNOWN; } } return EXPR_ERROR_NOERROR; }
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit_blanks.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jdaufin <jdaufin@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/06/27 19:38:16 by jdaufin #+# #+# */ /* Updated: 2020/12/10 17:03:41 by jdaufin ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include "libft.h" static size_t ft_wordcount_blanks(char *s) { ssize_t i; size_t ret; _Bool inword; if (!s) return (0); i = -1; ret = 0; inword = 0; while (s[++i]) { if (ft_isspace(s[i])) inword = 0; else if (!inword) { inword = 1; ret++; } } return (ret); } static unsigned int nextwd(char *s, unsigned int start) { unsigned int ret; _Bool inword; ret = start; if (!s || (start >= ft_strlen(s)) || (!ret && !ft_isspace(s[ret]))) return (0); inword = ft_isspace(s[ret]) ? 0 : 1; while (s[ret]) { if (inword) while (s[ret] && !ft_isspace(s[ret])) ret++; while (ft_isspace(s[ret])) ret++; if (s[ret]) return (ret); else return (0); } return (0); } static size_t ft_wdlen(char *cur) { size_t ret; if (!cur || ft_isspace(*cur)) return (0); ret = 0; while (*cur && !ft_isspace(*cur)) { ret++; cur++; } return (ret); } char **ft_strsplit_blanks(char *s) { char **ret; size_t retsize; size_t i; unsigned int pos; retsize = ft_wordcount_blanks(s); if (!s || !(ret = (char **)ft_memalloc((retsize + 1) * sizeof(char *)))) return (NULL); i = 0; pos = 0; while (i < retsize) { pos = i ? nextwd(s, (unsigned int)ft_wdlen(&s[pos]) + pos) \ : nextwd(s, 0); if (i && !pos) return (NULL); else ret[i++] = ft_strsub(s, pos, ft_wdlen(&s[pos])); } ret[i] = NULL; return (ret); }
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_io.c,v 3.11 2003/02/17 15:12:00 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993 by David Dawes <dawes@xfree86.org> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Thomas Roell and David Dawes * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. Thomas Roell and * David Dawes makes no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ /* $XConsortium: sysv_io.c /main/8 1996/10/19 18:08:06 kaleb $ */ #include "X.h" #include "compiler.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" void xf86SoundKbdBell(int loudness, int pitch, int duration) { if (loudness && pitch) { #ifdef KDMKTONE /* * If we have KDMKTONE use it to avoid putting the server * to sleep */ ioctl(xf86Info.consoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff) | (((unsigned long)duration * loudness / 50) << 16)); #else ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch); usleep(xf86Info.bell_duration * loudness * 20); ioctl(xf86Info.consoleFd, KIOCSOUND, 0); #endif } } void xf86SetKbdLeds(int leds) { #ifdef KBIO_SETMODE ioctl(xf86Info.consoleFd, KBIO_SETMODE, KBM_AT); ioctl(xf86Info.consoleFd, KDSETLED, leds); ioctl(xf86Info.consoleFd, KBIO_SETMODE, KBM_XT); #endif } #include "xf86OSKbd.h" Bool xf86OSKbdPreInit(InputInfoPtr pInfo) { return FALSE; }