text
stringlengths
4
6.14k
/* * This file has been modified for the cdrkit suite. * * The behaviour and appearence of the program code below can differ to a major * extent from the version distributed by the original author(s). * * For details, see Changelog file distributed with the cdrkit package. If you * received this file from another source then ask the distributing person for * a log of modifications. * */ /* @(#)rmtio.h 1.5 03/06/15 Copyright 1995,2000 J. Schilling */ /* * Definition for enhanced remote tape IO * * Copyright (c) 1995,2000-2002 J. Schilling */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * This program is distributed 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _RMTIO_H #define _RMTIO_H #ifndef _MCONFIG_H #include <mconfig.h> #endif #ifndef _UTYPES_H #include <utypes.h> #endif /* * values for mt_op */ #define RMTWEOF 0 /* write an end-of-file record */ #define RMTFSF 1 /* forward space over file mark */ #define RMTBSF 2 /* backward space over file mark (1/2" only ) */ #define RMTFSR 3 /* forward space to inter-record gap */ #define RMTBSR 4 /* backward space to inter-record gap */ #define RMTREW 5 /* rewind */ #define RMTOFFL 6 /* rewind and put the drive offline */ #define RMTNOP 7 /* no operation, sets status only */ #ifdef __needed__ #define MTRETEN 8 /* retension the tape (cartridge tape only) */ #define MTERASE 9 /* erase the entire tape */ #define MTEOM 10 /* position to end of media */ #define MTNBSF 11 /* backward space file to BOF */ #define MTSRSZ 12 /* set record size */ #define MTGRSZ 13 /* get record size */ #define MTLOAD 14 /* for loading a tape (use o_delay to open */ /* the tape device) */ #endif /* * Definitions for the new RMT Protocol version 1 * * The new Protocol version tries to make the use * of rmtioctl() more portable between different platforms. */ #define RMTIVERSION -1 /* Opcode to request version */ #define RMT_NOVERSION -1 /* Old version code */ #define RMT_VERSION 1 /* New (current) version code */ /* * Support for commands bejond MTWEOF..MTNOP (0..7) */ #define RMTICACHE 0 /* enable controller cache */ #define RMTINOCACHE 1 /* disable controller cache */ #define RMTIRETEN 2 /* retension the tape (cartridge tape only) */ #define RMTIERASE 3 /* erase the entire tape */ #define RMTIEOM 4 /* position to end of media */ #define RMTINBSF 5 /* backward space file to BOF */ /* * Old MTIOCGET copies a binary version of struct mtget back * over the wire. This is highly non portable. * MTS_* retrieves ascii versions (%d format) of a single * field in the struct mtget. * NOTE: MTS_ERREG may only be valid on the first call and * must be retrived first. */ #define MTS_TYPE 'T' /* mtget.mt_type */ #define MTS_DSREG 'D' /* mtget.mt_dsreg */ #define MTS_ERREG 'E' /* mtget.mt_erreg */ #define MTS_RESID 'R' /* mtget.mt_resid */ #define MTS_FILENO 'F' /* mtget.mt_fileno */ #define MTS_BLKNO 'B' /* mtget.mt_blkno */ #define MTS_FLAGS 'f' /* mtget.mt_flags */ #define MTS_BF 'b' /* mtget.mt_bf */ /* * structure for remote MTIOCGET - mag tape get status command */ struct rmtget { Llong mt_type; /* type of magtape device */ /* the following two registers are grossly device dependent */ Llong mt_dsreg; /* ``drive status'' register */ Int32_t mt_dsreg1; /* ``drive status'' register */ Int32_t mt_dsreg2; /* ``drive status'' register */ Llong mt_gstat; /* ``generic status'' register */ Llong mt_erreg; /* ``error'' register */ /* optional error info. */ Llong mt_resid; /* residual count */ Llong mt_fileno; /* file number of current position */ Llong mt_blkno; /* block number of current position */ Llong mt_flags; Llong mt_gflags; /* generic flags */ long mt_bf; /* optimum blocking factor */ int mt_xflags; /* eXistence flags for struct members */ }; /* * Values for mt_xflags */ #define RMT_TYPE 0x0001 /* mt_type/mt_model present */ #define RMT_DSREG 0x0002 /* mt_dsreg present */ #define RMT_DSREG1 0x0004 /* mt_dsreg1 present */ #define RMT_DSREG2 0x0008 /* mt_dsreg2 present */ #define RMT_GSTAT 0x0010 /* mt_gstat present */ #define RMT_ERREG 0x0020 /* mt_erreg present */ #define RMT_RESID 0x0040 /* mt_resid present */ #define RMT_FILENO 0x0080 /* mt_fileno present */ #define RMT_BLKNO 0x0100 /* mt_blkno present */ #define RMT_FLAGS 0x0200 /* mt_flags present */ #define RMT_BF 0x0400 /* mt_bf present */ #define RMT_COMPAT 0x0800 /* Created from old compat data */ /* * values for mt_flags */ #define RMTF_SCSI 0x01 #define RMTF_REEL 0x02 #define RMTF_ASF 0x04 #define RMTF_TAPE_HEAD_DIRTY 0x08 #define RMTF_TAPE_CLN_SUPPORTED 0x10 /* * these are recommended */ #ifdef __needed__ #define MT_ISQIC 0x32 /* generic QIC tape drive */ #define MT_ISREEL 0x33 /* generic reel tape drive */ #define MT_ISDAT 0x34 /* generic DAT tape drive */ #define MT_IS8MM 0x35 /* generic 8mm tape drive */ #define MT_ISOTHER 0x36 /* generic other type of tape drive */ /* more Sun devices */ #define MT_ISTAND25G 0x37 /* sun: SCSI Tandberg 2.5 Gig QIC */ #define MT_ISDLT 0x38 /* sun: SCSI DLT tape drive */ #define MT_ISSTK9840 0x39 /* sun: STK 9840 (Ironsides) */ #endif #endif /* _RMTIO_H */
/* This class maps the ZRTP C++ callback methods to C callback methods. Copyright (C) 2010 Werner Dittmann 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 ZRTPCALLBACKWRAPPER_H #define ZRTPCALLBACKWRAPPER_H #include <stdlib.h> #include <libzrtpcpp/ZrtpCallback.h> #include <libzrtpcpp/ZrtpConfigure.h> #include <libzrtpcpp/ZrtpCWrapper.h> /** * * @file ZrtpCallbackWrapper.h * @brief C-Wrapper helper * * This is a helper class for for the C wrapper and implements * the GNU ZRTP callback interface.For detailed documentation about * the callback method refer to file ZrtpCallback * @ingroup GNU_ZRTP * @{ * * @see ZrtpCallback */ class __EXPORT ZrtpCallbackWrapper : public ZrtpCallback { public: /** * Construct a class that implements ZrtpCallback and uses a C structure * to call C functions that implement the callbacks. * * @param cb * The C callback structure that hold the addresses of the C methods * that implement the actual callback functions. */ ZrtpCallbackWrapper(zrtp_Callbacks* cb, ZrtpContext* ctx); int32_t sendDataZRTP ( const unsigned char* data, int32_t length ); int32_t activateTimer ( int32_t time ); int32_t cancelTimer(); void sendInfo ( GnuZrtpCodes::MessageSeverity severity, int32_t subCode ); bool srtpSecretsReady ( SrtpSecret_t* secrets, EnableSecurity part ); void srtpSecretsOff ( EnableSecurity part ); void srtpSecretsOn ( std::string c, std::string s, bool verified ); void handleGoClear(); void zrtpNegotiationFailed ( GnuZrtpCodes::MessageSeverity severity, int32_t subCode ); void zrtpNotSuppOther(); void synchEnter(); void synchLeave(); void zrtpAskEnrollment (GnuZrtpCodes::InfoEnrollment info ); void zrtpInformEnrollment (GnuZrtpCodes::InfoEnrollment info ); void signSAS ( std::string sas ); bool checkSASSignature ( std::string sas ); private: void init(); zrtp_Callbacks *c_callbacks; ZrtpContext* zrtpCtx; }; /** * @} */ #endif // ZRTPCALLBACKWRAPPER_H
/* SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef SUPERIO_ITE_IT8718F_H #define SUPERIO_ITE_IT8718F_H #include <device/pnp_type.h> /* Datasheet: http://www.ite.com.tw/product_info/PC/Brief-IT8718_2.asp */ #define IT8718F_FDC 0x00 /* Floppy */ #define IT8718F_SP1 0x01 /* Com1 */ #define IT8718F_SP2 0x02 /* Com2 */ #define IT8718F_PP 0x03 /* Parallel port */ #define IT8718F_EC 0x04 /* Environment controller */ #define IT8718F_KBCK 0x05 /* PS/2 keyboard */ #define IT8718F_KBCM 0x06 /* PS/2 mouse */ #define IT8718F_GPIO 0x07 /* GPIO */ #define IT8718F_IR 0x0a /* Consumer IR */ void it8718f_disable_reboot(pnp_devfn_t dev); #endif /* SUPERIO_ITE_IT8718F_H */
// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com> * * Trivial Extended Berkeley Packet Filter (eBPF) test. * * Sanity check loading and running bytecode. * * Test flow: * 1. Create array map * 2. Load eBPF program * 3. Attach program to socket * 4. Send packet on socket * 5. This should trigger eBPF program which writes to array map * 6. Verify array map was written to */ /* * If test is executed in a loop and limit for locked memory (ulimit -l) is * too low bpf() call can fail with EPERM due to deffered freeing. */ #include <limits.h> #include <string.h> #include <stdio.h> #include "config.h" #include "tst_test.h" #include "bpf_common.h" const char MSG[] = "Ahoj!"; static char *msg; static char *log; static union bpf_attr *attr; int load_prog(int fd) { /* * The following is a byte code template. We copy it to a guarded buffer and * substitute the runtime value of our map file descriptor. * * r0 - r10 = registers 0 to 10 * r0 = return code * r1 - r5 = scratch registers, used for function arguments * r6 - r9 = registers preserved across function calls * fp/r10 = stack frame pointer */ struct bpf_insn PROG[] = { /* Load the map FD into r1 (place holder) */ BPF_LD_MAP_FD(BPF_REG_1, fd), /* Put (key = 0) on stack and key ptr into r2 */ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), /* r2 = fp */ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), /* r2 = r2 - 8 */ BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0), /* *r2 = 0 */ /* r0 = bpf_map_lookup_elem(r1, r2) */ BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem), /* if r0 == 0 goto exit */ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 3), /* Set map[0] = 1 */ BPF_MOV64_REG(BPF_REG_1, BPF_REG_0), /* r1 = r0 */ BPF_ST_MEM(BPF_DW, BPF_REG_1, 0, 1), /* *r1 = 1 */ BPF_MOV64_IMM(BPF_REG_0, 0), /* r0 = 0 */ BPF_EXIT_INSN(), /* return r0 */ }; bpf_init_prog_attr(attr, PROG, sizeof(PROG), log, BUFSIZ); return bpf_load_prog(attr, log); } void setup(void) { rlimit_bump_memlock(); memcpy(msg, MSG, sizeof(MSG)); } void run(void) { int map_fd, prog_fd; uint32_t key = 0; uint64_t val; map_fd = bpf_map_array_create(1); prog_fd = load_prog(map_fd); bpf_run_prog(prog_fd, msg, sizeof(MSG)); SAFE_CLOSE(prog_fd); bpf_map_array_get(map_fd, &key, &val); if (val != 1) { tst_res(TFAIL, "val = %lu, but should be val = 1", val); } else { tst_res(TPASS, "val = 1"); } SAFE_CLOSE(map_fd); } static struct tst_test test = { .setup = setup, .test_all = run, .min_kver = "3.19", .bufs = (struct tst_buffers []) { {&log, .size = BUFSIZ}, {&attr, .size = sizeof(*attr)}, {&msg, .size = sizeof(MSG)}, {}, } };
#include "builtin.h" static void flush_current_id(int patchlen, unsigned char *id, unsigned char *result) { char name[50]; if (!patchlen) return; memcpy(name, sha1_to_hex(id), 41); printf("%s %s\n", sha1_to_hex(result), name); } static int remove_space(char *line) { char *src = line; char *dst = line; unsigned char c; while ((c = *src++) != '\0') { if (!isspace(c)) *dst++ = c; } return dst - line; } static int scan_hunk_header(const char *p, int *p_before, int *p_after) { static const char digits[] = "0123456789"; const char *q, *r; int n; q = p + 4; n = strspn(q, digits); if (q[n] == ',') { q += n + 1; n = strspn(q, digits); } if (n == 0 || q[n] != ' ' || q[n+1] != '+') return 0; r = q + n + 2; n = strspn(r, digits); if (r[n] == ',') { r += n + 1; n = strspn(r, digits); } if (n == 0) return 0; *p_before = atoi(q); *p_after = atoi(r); return 1; } static void flush_one_hunk(unsigned char *result, git_SHA_CTX *ctx) { unsigned char hash[20]; unsigned short carry = 0; int i; git_SHA1_Final(hash, ctx); git_SHA1_Init(ctx); /* 20-byte sum, with carry */ for (i = 0; i < 20; ++i) { carry += result[i] + hash[i]; result[i] = carry; carry >>= 8; } } static int get_one_patchid(unsigned char *next_sha1, unsigned char *result, struct strbuf *line_buf, int stable) { int patchlen = 0, found_next = 0; int before = -1, after = -1; git_SHA_CTX ctx; git_SHA1_Init(&ctx); hashclr(result); while (strbuf_getwholeline(line_buf, stdin, '\n') != EOF) { char *line = line_buf->buf; char *p = line; int len; if (!memcmp(line, "diff-tree ", 10)) p += 10; else if (!memcmp(line, "commit ", 7)) p += 7; else if (!memcmp(line, "From ", 5)) p += 5; else if (!memcmp(line, "\\ ", 2) && 12 < strlen(line)) continue; if (!get_sha1_hex(p, next_sha1)) { found_next = 1; break; } /* Ignore commit comments */ if (!patchlen && memcmp(line, "diff ", 5)) continue; /* Parsing diff header? */ if (before == -1) { if (!memcmp(line, "index ", 6)) continue; else if (!memcmp(line, "--- ", 4)) before = after = 1; else if (!isalpha(line[0])) break; } /* Looking for a valid hunk header? */ if (before == 0 && after == 0) { if (!memcmp(line, "@@ -", 4)) { /* Parse next hunk, but ignore line numbers. */ scan_hunk_header(line, &before, &after); continue; } /* Split at the end of the patch. */ if (memcmp(line, "diff ", 5)) break; /* Else we're parsing another header. */ if (stable) flush_one_hunk(result, &ctx); before = after = -1; } /* If we get here, we're inside a hunk. */ if (line[0] == '-' || line[0] == ' ') before--; if (line[0] == '+' || line[0] == ' ') after--; /* Compute the sha without whitespace */ len = remove_space(line); patchlen += len; git_SHA1_Update(&ctx, line, len); } if (!found_next) hashclr(next_sha1); flush_one_hunk(result, &ctx); return patchlen; } static void generate_id_list(int stable) { unsigned char sha1[20], n[20], result[20]; int patchlen; struct strbuf line_buf = STRBUF_INIT; hashclr(sha1); while (!feof(stdin)) { patchlen = get_one_patchid(n, result, &line_buf, stable); flush_current_id(patchlen, sha1, result); hashcpy(sha1, n); } strbuf_release(&line_buf); } static const char patch_id_usage[] = "git patch-id [--stable | --unstable] < patch"; static int git_patch_id_config(const char *var, const char *value, void *cb) { int *stable = cb; if (!strcmp(var, "patchid.stable")) { *stable = git_config_bool(var, value); return 0; } return git_default_config(var, value, cb); } int cmd_patch_id(int argc, const char **argv, const char *prefix) { int stable = -1; git_config(git_patch_id_config, &stable); /* If nothing is set, default to stable. */ if (stable < 0) stable = 1; if (argc == 2 && !strcmp(argv[1], "--stable")) stable = 1; else if (argc == 2 && !strcmp(argv[1], "--unstable")) stable = 0; else if (argc != 1) usage(patch_id_usage); generate_id_list(stable); return 0; }
#ifndef CLTABHISTORY_H #define CLTABHISTORY_H #include "codelite_exports.h" #include <vector> #include <wx/sharedptr.h> #include <wx/window.h> #include <algorithm> class WXDLLIMPEXP_SDK clTabHistory { std::vector<wxWindow*> m_history; public: typedef wxSharedPtr<clTabHistory> Ptr_t; public: clTabHistory() {} virtual ~clTabHistory() {} void Push(wxWindow* page) { if(page == NULL) return; Pop(page); m_history.insert(m_history.begin(), page); } void Pop(wxWindow* page) { if(!page) return; std::vector<wxWindow*>::iterator iter = std::find_if(m_history.begin(), m_history.end(), [&](wxWindow* w) { return w == page; }); if(iter != m_history.end()) { m_history.erase(iter); } } wxWindow* PrevPage() { if(m_history.empty()) { return NULL; } // return the top of the heap return m_history[0]; } /** * @brief clear the history */ void Clear() { m_history.clear(); } /** * @brief return the tabbing history * @return */ const std::vector<wxWindow*>& GetHistory() const { return m_history; } }; #endif // CLTABHISTORY_H
#ifndef PHPDOCVAR_H #define PHPDOCVAR_H #include "codelite_exports.h" #include <wx/string.h> #include "PHPSourceFile.h" #include "smart_ptr.h" #include <list> #include <map> #include "wx/wxsqlite3.h" class WXDLLIMPEXP_CL PHPDocVar { bool m_isOk; wxString m_name; wxString m_type; wxLongLong m_dbId; wxLongLong m_parentDbId; wxFileName m_filename; int m_lineNumber; public: typedef SmartPtr<PHPDocVar> Ptr_t; typedef std::list<PHPDocVar::Ptr_t> List_t; typedef std::map<wxString, PHPDocVar::Ptr_t> Map_t; public: PHPDocVar(PHPSourceFile& sourceFile, const wxString& doc); PHPDocVar(); virtual ~PHPDocVar(); bool IsOk() const { return m_isOk; } void SetName(const wxString& name) { this->m_name = name; } void SetType(const wxString& type) { this->m_type = type; } const wxString& GetName() const { return m_name; } const wxString& GetType() const { return m_type; } void SetDbId(const wxLongLong& dbId) { this->m_dbId = dbId; } const wxLongLong& GetDbId() const { return m_dbId; } void SetParentDbId(const wxLongLong& parentDbId) { this->m_parentDbId = parentDbId; } const wxLongLong& GetParentDbId() const { return m_parentDbId; } void SetFilename(const wxFileName& filename) { this->m_filename = filename; } void SetIsOk(bool isOk) { this->m_isOk = isOk; } void SetLineNumber(int lineNumber) { this->m_lineNumber = lineNumber; } const wxFileName& GetFilename() const { return m_filename; } int GetLineNumber() const { return m_lineNumber; } // Database API void Store(wxSQLite3Database& db, wxLongLong parentDdId); void FromResultSet(wxSQLite3ResultSet& res); }; #endif // PHPDOCVAR_H
/* Linear search functions. Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include <search.h> #include <string.h> void * lsearch (const void *key, void *base, size_t *nmemb, size_t size, __compar_fn_t compar) { void *result; /* Try to find it. */ result = lfind (key, base, nmemb, size, compar); if (result == NULL) { /* Not available. Insert at the end. */ result = memcpy (base + (*nmemb) * size, key, size); ++(*nmemb); } return result; } void * lfind (const void *key, const void *base, size_t *nmemb, size_t size, __compar_fn_t compar) { const void *result = base; size_t cnt = 0; while (cnt < *nmemb && (*compar) (key, result) != 0) { result += size; ++cnt; } return cnt < *nmemb ? (void *) result : NULL; }
/* SPDX-License-Identifier: GPL-2.0-only */ #ifndef __I2C_GENERIC_CHIP_H__ #define __I2C_GENERIC_CHIP_H__ #include <acpi/acpi_device.h> #include <device/i2c_simple.h> #define MAX_GENERIC_PROPERTY_LIST 10 struct drivers_i2c_generic_config { const char *hid; /* ACPI _HID (required) */ const char *cid; /* ACPI _CID */ const char *name; /* ACPI Device Name */ const char *desc; /* Device Description */ unsigned int uid; /* ACPI _UID */ enum i2c_speed speed; /* Bus speed in Hz, default is I2C_SPEED_FAST */ const char *compat_string; /* Compatible string for _HID=PRP0001 */ unsigned int wake; /* Wake GPE */ struct acpi_irq irq; /* Interrupt */ /* Use GPIO based interrupt instead of PIRQ */ struct acpi_gpio irq_gpio; /* * This flag will add a device property which will indicate * to the OS that it should probe this device before adding it. * * This can be used to declare a device that may not exist on * the board, for example to support multiple trackpad vendors. */ int probed; /* GPIO used to indicate if this device is present */ unsigned int device_present_gpio; unsigned int device_present_gpio_invert; /* Disable reset and enable GPIO export in _CRS */ bool disable_gpio_export_in_crs; /* Does the device have a power resource? */ bool has_power_resource; /* GPIO used to take device out of reset or to put it into reset. */ struct acpi_gpio reset_gpio; /* Delay to be inserted after device is taken out of reset. */ unsigned int reset_delay_ms; /* Delay to be inserted after device is put into reset. */ unsigned int reset_off_delay_ms; /* GPIO used to enable device. */ struct acpi_gpio enable_gpio; /* Delay to be inserted after device is enabled. */ unsigned int enable_delay_ms; /* Delay to be inserted after device is disabled. */ unsigned int enable_off_delay_ms; /* GPIO used to stop operation of device. */ struct acpi_gpio stop_gpio; /* Delay to be inserted after disabling stop. */ unsigned int stop_delay_ms; /* Delay to be inserted after enabling stop. */ unsigned int stop_off_delay_ms; /* Generic properties for exporting device-specific data to the OS */ struct acpi_dp property_list[MAX_GENERIC_PROPERTY_LIST]; int property_count; }; /* * Fills in generic information about i2c device from device-tree * properties. Callback can be provided to fill in any * device-specific information in SSDT. * * Parameters: * dev: Device requesting i2c generic information to be filled * callback: Callback to fill in device-specific information * config: Pointer to drivers_i2c_generic_config structure */ void i2c_generic_fill_ssdt(const struct device *dev, void (*callback)(const struct device *dev), struct drivers_i2c_generic_config *config); #endif /* __I2C_GENERIC_CHIP_H__ */
/* -*- Mode: C; c-set-style: gnu indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include <config.h> #include <string.h> #include <unistd.h> #include <mate-desktop-item.h> #include <locale.h> #include <stdlib.h> static void test_ditem (const char *file) { MateDesktopItem *ditem; MateDesktopItemType type; const gchar *text; char *uri; char path[256]; ditem = mate_desktop_item_new_from_file (file, MATE_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS, NULL); if (ditem == NULL) { g_print ("File %s is not an existing ditem\n", file); return; } text = mate_desktop_item_get_location (ditem); g_print ("LOCATION: |%s|\n", text); type = mate_desktop_item_get_entry_type (ditem); g_print ("TYPE: |%u|\n", type); text = mate_desktop_item_get_string (ditem, MATE_DESKTOP_ITEM_TYPE); g_print ("TYPE(string): |%s|\n", text); text = mate_desktop_item_get_string (ditem, MATE_DESKTOP_ITEM_EXEC); g_print ("EXEC: |%s|\n", text); text = mate_desktop_item_get_string (ditem, MATE_DESKTOP_ITEM_ICON); g_print ("ICON: |%s|\n", text); text = mate_desktop_item_get_localestring (ditem, MATE_DESKTOP_ITEM_NAME); g_print ("NAME: |%s|\n", text); text = mate_desktop_item_get_localestring_lang (ditem, MATE_DESKTOP_ITEM_NAME, "cs_CZ"); g_print ("NAME(lang=cs_CZ): |%s|\n", text); text = mate_desktop_item_get_localestring_lang (ditem, MATE_DESKTOP_ITEM_NAME, "de"); g_print ("NAME(lang=de): |%s|\n", text); text = mate_desktop_item_get_localestring_lang (ditem, MATE_DESKTOP_ITEM_NAME, NULL); g_print ("NAME(lang=null): |%s|\n", text); text = mate_desktop_item_get_localestring (ditem, MATE_DESKTOP_ITEM_COMMENT); g_print ("COMMENT: |%s|\n", text); g_print ("Setting Name[de]=Neu gestzt! (I have no idea what that means)\n"); mate_desktop_item_set_localestring (ditem, MATE_DESKTOP_ITEM_NAME, "Neu gesetzt!"); getcwd (path, 255 - strlen ("/foo.desktop")); strcat (path, "/foo.desktop"); g_print ("Saving to foo.desktop\n"); uri = g_filename_to_uri (path, NULL, NULL); g_print ("URI: %s\n", uri); mate_desktop_item_save (ditem, uri, FALSE, NULL); g_free (uri); } static void launch_item (const char *file) { MateDesktopItem *ditem; GList *file_list = NULL; int ret; ditem = mate_desktop_item_new_from_file (file, MATE_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS, NULL); if (ditem == NULL) { g_print ("File %s is not an existing ditem\n", file); return; } #if 0 file_list = g_list_append (NULL, "file:///bin/sh"); file_list = g_list_append (file_list, "foo"); file_list = g_list_append (file_list, "bar"); file_list = g_list_append (file_list, "http://slashdot.org"); #endif ret = mate_desktop_item_launch (ditem, file_list, 0, NULL); g_print ("launch returned: %d\n", ret); } int main (int argc, char **argv) { char *file; gboolean launch = FALSE; if (argc < 2 || argc > 3) { fprintf (stderr, "Usage: test-ditem path [LAUNCH]\n"); exit (1); } if (argc == 3 && strcmp (argv[2], "LAUNCH") == 0) launch = TRUE; file = g_strdup (argv[1]); gtk_init (&argc, &argv); if (launch) launch_item (file); else test_ditem (file); /* test_ditem_edit (file); */ return 0; }
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include "buffer.h" #include "exit.h" #include "cdb_make.h" #include "open.h" #include "stralloc.h" #include "getln.h" #include "strerr.h" #include "byte.h" #include "scan.h" #include "fmt.h" #include "ip4.h" #define FATAL "rbldns-data: fatal: " void nomem(void) { strerr_die2x(111,FATAL,"out of memory"); } int fd; buffer b; char bspace[1024]; int fdcdb; struct cdb_make cdb; static stralloc tmp; static stralloc line; int match = 1; unsigned long linenum = 0; char strnum[FMT_ULONG]; void syntaxerror(const char *why) { strnum[fmt_ulong(strnum,linenum)] = 0; strerr_die4x(111,FATAL,"unable to parse data line ",strnum,why); } void die_datatmp(void) { strerr_die2sys(111,FATAL,"unable to create data.tmp: "); } int main() { char ip[4]; unsigned long u; unsigned int j; unsigned int k; char ch; umask(022); fd = open_read("data"); if (fd == -1) strerr_die2sys(111,FATAL,"unable to open data: "); buffer_init(&b,buffer_unixread,fd,bspace,sizeof bspace); fdcdb = open_trunc("data.tmp"); if (fdcdb == -1) die_datatmp(); if (cdb_make_start(&cdb,fdcdb) == -1) die_datatmp(); while (match) { ++linenum; if (getln(&b,&line,&match,'\n') == -1) strerr_die2sys(111,FATAL,"unable to read line: "); while (line.len) { ch = line.s[line.len - 1]; if ((ch != ' ') && (ch != '\t') && (ch != '\n')) break; --line.len; } if (!line.len) continue; switch(line.s[0]) { default: syntaxerror(": unrecognized leading character"); case '#': break; case ':': j = byte_chr(line.s + 1,line.len - 1,':'); if (j >= line.len - 1) syntaxerror(": missing colon"); if (ip4_scan(line.s + 1,ip) != j) syntaxerror(": malformed IP address"); if (!stralloc_copyb(&tmp,ip,4)) nomem(); if (!stralloc_catb(&tmp,line.s + j + 2,line.len - j - 2)) nomem(); if (cdb_make_add(&cdb,"",0,tmp.s,tmp.len) == -1) die_datatmp(); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (!stralloc_0(&line)) nomem(); j = 0; if (!stralloc_copys(&tmp,"")) nomem(); for (;;) { k = scan_ulong(line.s + j,&u); if (!k) break; ch = u; if (!stralloc_catb(&tmp,&ch,1)) nomem(); j += k; if (line.s[j] != '.') break; ++j; } if (!stralloc_catb(&tmp,"\0\0\0\0",4)) nomem(); tmp.len = 4; if (line.s[j] == '/') scan_ulong(line.s + j + 1,&u); else u = 32; if (u > 32) u = 32; ch = u; if (!stralloc_catb(&tmp,&ch,1)) nomem(); if (cdb_make_add(&cdb,tmp.s,tmp.len,"",0) == -1) die_datatmp(); break; } } if (cdb_make_finish(&cdb) == -1) die_datatmp(); if (fsync(fdcdb) == -1) die_datatmp(); if (close(fdcdb) == -1) die_datatmp(); /* NFS stupidity */ if (rename("data.tmp","data.cdb") == -1) strerr_die2sys(111,FATAL,"unable to move data.tmp to data.cdb: "); _exit(0); }
/* This file is part of the KDE libraries Copyright (C) 2012 Bernd Buschinski <b.buschinski@googlemail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef PROPERTYDESCRIPTOR_H #define PROPERTYDESCRIPTOR_H #include "global.h" #include "ustring.h" namespace KJS { class JSObject; class ExecState; class KJS_EXPORT PropertyDescriptor { public: PropertyDescriptor(); bool isAccessorDescriptor() const; bool isDataDescriptor() const; bool isGenericDescriptor() const; JSObject* fromPropertyDescriptor(ExecState* exec); // Set the PropertyDescriptor given Javascript Object containing any of // value, get, set, enumerable, configurable, writeable bool setPropertyDescriptorFromObject(ExecState* exec, JSValue* obj); // Set the PropertyDescriptor from internal Object, given the value, which can be // a GetterSetterImpl and set attributes bool setPropertyDescriptorValues(ExecState* exec, JSValue *value, unsigned int attributes); bool enumerable() const; bool writable() const; bool configurable() const; // enumerableSet & co, true if setPropertyDescriptorFromObject contained // enumerable, configurable or writeable, if not false. bool enumerableSet() const; bool writableSet() const; bool configureSet() const; JSValue* value() const; JSValue* getter() const; JSValue* setter() const; void setEnumerable(bool enumerable); void setConfigureable(bool configureable); void setValue(JSValue* value); void setWritable(bool writable); void setGetter(JSValue* getter); void setSetter(JSValue* setter); unsigned int attributes() const; bool isEmpty() const; // Comapred PropertyDescriptor in terms of its value. It compared the Attributes // but not if these values are explicitly set. Also the check is difference // in comparing the getter/setter. They are compared if they need to be updated, // not only if they have the same value. bool equalTo(ExecState* exec, PropertyDescriptor& other) const; // This function gives new Attributes calculation from current and other // PropertyDescriptor. New Attributes are set depending if Descriptor has // enumerable/writeable/configurableSet, if absent default is used. // NOTE: As interval have enumerable/writable/configurable always set and // javascript object dont, the order matters here. // In this case the correct order is: current.attributesWithOverride(new) // where new is the javascript object that might not have all attributes set. unsigned int attributesWithOverride(PropertyDescriptor& other) const; private: // Check if PropertyDescriptor really is the same. This is private for // internal use only, so that it will not easily be confussed with equalTo. // This function does compared set Attributes. bool operator==(PropertyDescriptor& other) const; unsigned int m_attributes; unsigned int m_setAttributes; enum { WritableSet = 1 << 0, EnumerableSet = 1 << 1, ConfigurableSet = 1 << 2 }; JSValue* m_value; JSValue* m_getter; JSValue* m_setter; }; } #endif // PROPERTYDESCRIPTOR_H
int main () { f('XYZ',ab); f('X\nY',ab); f('\n',ab); }
// SPDX-License-Identifier: GPL-2.0 #ifndef TAGWIDGET_H #define TAGWIDGET_H #include "groupedlineedit.h" #include <QPair> class QCompleter; class TagWidget : public GroupedLineEdit { Q_OBJECT public: explicit TagWidget(QWidget *parent = 0); void setCompleter(QCompleter *completer); QPair<int, int> getCursorTagPosition(); void highlight(); void setText(const QString &text); void clear(); void setCursorPosition(int position); void wheelEvent(QWheelEvent *event); public slots: void reparse(); void completionSelected(const QString &text); void completionHighlighted(const QString &text); protected: void keyPressEvent(QKeyEvent *e) override; void dragEnterEvent(QDragEnterEvent *e) override; void dragLeaveEvent(QDragLeaveEvent *e) override; void dragMoveEvent(QDragMoveEvent *e) override; void dropEvent(QDropEvent *e) override; private: void focusOutEvent(QFocusEvent *ev) override; QCompleter *m_completer; bool lastFinishedTag; }; #endif // TAGWIDGET_H
// rdwebresult.h // // Container class for Rivendel Web Service result messages. // // (C) Copyright 2011 Fred Gleason <fredg@paravelsystems.com> // // $Id: rdwebresult.h,v 1.1 2011/12/23 23:07:00 cvs Exp $ // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. // // This program is distributed 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 <rdaudioconvert.h> #ifndef RDWEBRESULT_H #define RDWEBRESULT_H class RDWebResult { public: RDWebResult(const QString &str,int resp_code, RDAudioConvert::ErrorCode conv_code); RDWebResult(); QString text() const; void setText(const QString &str); int responseCode() const; void setResponseCode(int code); RDAudioConvert::ErrorCode converterErrorCode() const; void setConverterErrorCode(RDAudioConvert::ErrorCode code); QString xml() const; bool readXml(const QString &xml); bool readXmlFromFile(const QString &filename); private: QString web_text; int web_response_code; RDAudioConvert::ErrorCode web_converter_code; }; #endif // RDWEBRESULT_H
/* * usbserial.c - usb serial gadget command * * Copyright (c) 2011 Eric Bénard <eric@eukrea.com>, Eukréa Electromatique * based on dfu.c which is : * Copyright (c) 2009 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * This program is distributed 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. * */ #include <common.h> #include <command.h> #include <errno.h> #include <malloc.h> #include <getopt.h> #include <fs.h> #include <xfuncs.h> #include <usb/usbserial.h> static int do_usbserial(int argc, char *argv[]) { int opt; struct usb_serial_pdata pdata; char *argstr; char *manufacturer = "barebox"; char *productname = CONFIG_BOARDINFO; u16 idVendor = 0, idProduct = 0; int mode = 0; while ((opt = getopt(argc, argv, "m:p:V:P:asd")) > 0) { switch (opt) { case 'm': manufacturer = optarg; break; case 'p': productname = optarg; break; case 'V': idVendor = simple_strtoul(optarg, NULL, 0); break; case 'P': idProduct = simple_strtoul(optarg, NULL, 0); break; case 'a': mode = 0; break; #ifdef HAVE_OBEX case 'o': mode = 1; break; #endif case 's': mode = 2; break; case 'd': usb_serial_unregister(); return 0; } } argstr = argv[optind]; pdata.manufacturer = manufacturer; pdata.productname = productname; pdata.idVendor = idVendor; pdata.idProduct = idProduct; pdata.mode = mode; return usb_serial_register(&pdata); } BAREBOX_CMD_HELP_START(usbserial) BAREBOX_CMD_HELP_USAGE("usbserial [OPTIONS] <description>\n") BAREBOX_CMD_HELP_SHORT("Enable/disable a serial gadget on the USB device interface.\n") BAREBOX_CMD_HELP_OPT ("-m <str>", "Manufacturer string (barebox)\n") BAREBOX_CMD_HELP_OPT ("-p <str>", "product string (" CONFIG_BOARDINFO ")\n") BAREBOX_CMD_HELP_OPT ("-V <id>", "vendor id\n") BAREBOX_CMD_HELP_OPT ("-P <id>", "product id\n") BAREBOX_CMD_HELP_OPT ("-a", "CDC ACM (default)\n") #ifdef HAVE_OBEX BAREBOX_CMD_HELP_OPT ("-o", "CDC OBEX\n") #endif BAREBOX_CMD_HELP_OPT ("-s", "Generic Serial\n") BAREBOX_CMD_HELP_OPT ("-d", "Disable the serial gadget\n") BAREBOX_CMD_HELP_END /** * @page usbserial_command */ BAREBOX_CMD_START(usbserial) .cmd = do_usbserial, .usage = "Serial gadget enable/disable", BAREBOX_CMD_HELP(cmd_usbserial_help) BAREBOX_CMD_END
/*************************************************************************** * Copyright (C) 2006-2012 by Thomas Schweitzer * * thomas-schweitzer(at)arcor.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License version 2.0 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 in the file LICENSE.GPL; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef UIGUIINDENTSERVER_H #define UIGUIINDENTSERVER_H #include <QObject> class QTcpServer; class QTcpSocket; class UiGuiIndentServer : public QObject { Q_OBJECT public: UiGuiIndentServer(void); ~UiGuiIndentServer(void); public slots: void startServer(); void stopServer(); private slots: void handleNewConnection(); void handleReceivedData(); void sendMessage(const QString &message); void checkIfReadyForHandleRequest(); private: QTcpServer *_tcpServer; QByteArray _dataToSend; bool _readyForHandleRequest; QTcpSocket *_currentClientConnection; quint32 _blockSize; }; #endif // UIGUIINDENTSERVER_H
/* * Copyright (C) 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef OpaqueRootSet_h #define OpaqueRootSet_h #include <wtf/HashSet.h> namespace JSC { class OpaqueRootSet { WTF_MAKE_NONCOPYABLE(OpaqueRootSet); public: OpaqueRootSet() : m_lastQueriedRoot(nullptr) , m_containsLastQueriedRoot(false) { } bool contains(void* root) const { if (root != m_lastQueriedRoot) { m_lastQueriedRoot = root; m_containsLastQueriedRoot = m_roots.contains(root); } return m_containsLastQueriedRoot; } bool isEmpty() const { return m_roots.isEmpty(); } void clear() { m_roots.clear(); m_lastQueriedRoot = nullptr; m_containsLastQueriedRoot = false; } void add(void* root) { if (root == m_lastQueriedRoot) m_containsLastQueriedRoot = true; m_roots.add(root); } int size() const { return m_roots.size(); } HashSet<void*>::const_iterator begin() const { return m_roots.begin(); } HashSet<void*>::const_iterator end() const { return m_roots.end(); } private: HashSet<void*> m_roots; mutable void* m_lastQueriedRoot; mutable bool m_containsLastQueriedRoot; }; } // namespace JSC #endif // OpaqueRootSet_h
/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #ifdef COMPUTE_CLASS ComputeStyle(property/atom,ComputePropertyAtom) #else #ifndef LMP_COMPUTE_PROPERTY_ATOM_H #define LMP_COMPUTE_PROPERTY_ATOM_H #include "compute.h" namespace LAMMPS_NS { class ComputePropertyAtom : public Compute { public: ComputePropertyAtom(class LAMMPS *, int, char **); ~ComputePropertyAtom(); void init(); void compute_peratom(); double memory_usage(); private: int nvalues; int nmax; int *index; double *buf; class AtomVecEllipsoid *avec_ellipsoid; class AtomVecLine *avec_line; class AtomVecTri *avec_tri; class AtomVecBody *avec_body; typedef void (ComputePropertyAtom::*FnPtrPack)(int); FnPtrPack *pack_choice; // ptrs to pack functions void pack_id(int); void pack_molecule(int); void pack_proc(int); void pack_type(int); void pack_mass(int); void pack_x(int); void pack_y(int); void pack_z(int); void pack_xs(int); void pack_ys(int); void pack_zs(int); void pack_xs_triclinic(int); void pack_ys_triclinic(int); void pack_zs_triclinic(int); void pack_xu(int); void pack_yu(int); void pack_zu(int); void pack_xu_triclinic(int); void pack_yu_triclinic(int); void pack_zu_triclinic(int); void pack_ix(int); void pack_iy(int); void pack_iz(int); void pack_vx(int); void pack_vy(int); void pack_vz(int); void pack_fx(int); void pack_fy(int); void pack_fz(int); void pack_q(int); void pack_mux(int); void pack_muy(int); void pack_muz(int); void pack_mu(int); void pack_radius(int); void pack_diameter(int); void pack_spx(int); // pack magnetic variables void pack_spy(int); void pack_spz(int); void pack_sp(int); void pack_fmx(int); void pack_fmy(int); void pack_fmz(int); void pack_omegax(int); void pack_omegay(int); void pack_omegaz(int); void pack_angmomx(int); void pack_angmomy(int); void pack_angmomz(int); void pack_shapex(int); void pack_shapey(int); void pack_shapez(int); void pack_quatw(int); void pack_quati(int); void pack_quatj(int); void pack_quatk(int); void pack_tqx(int); void pack_tqy(int); void pack_tqz(int); void pack_end1x(int); void pack_end1y(int); void pack_end1z(int); void pack_end2x(int); void pack_end2y(int); void pack_end2z(int); void pack_corner1x(int); void pack_corner1y(int); void pack_corner1z(int); void pack_corner2x(int); void pack_corner2y(int); void pack_corner2z(int); void pack_corner3x(int); void pack_corner3y(int); void pack_corner3z(int); void pack_nbonds(int); void pack_iname(int); void pack_dname(int); void pack_property_atom(int); }; } #endif #endif /* ERROR/WARNING messages: E: Illegal ... command Self-explanatory. Check the input script syntax and compare to the documentation for the command. You can use -echo screen as a command-line option when running LAMMPS to see the offending line. E: Compute property/atom for atom property that isn't allocated Self-explanatory. E: Compute property/atom integer vector does not exist The command is accessing a vector added by the fix property/atom command, that does not exist. E: Compute property/atom floating point vector does not exist The command is accessing a vector added by the fix property/atom command, that does not exist. E: Invalid keyword in compute property/atom command Self-explanatory. */
/* * * Copyright (C) 1994-2005, OFFIS * * This software and supporting documentation were developed by * * Kuratorium OFFIS e.V. * Healthcare Information and Communication Systems * Escherweg 2 * D-26121 Oldenburg, Germany * * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. * * Module: dcmdata * * Author: Gerd Ehlers * * Purpose: Print debug information * * Last Update: $Author: meichel $ * Update Date: $Date: 2005/12/08 16:28:04 $ * CVS/RCS Revision: $Revision: 1.13 $ * Status: $State: Exp $ * * CVS/RCS Log at end of file * */ #ifndef DCDEBUG_H #define DCDEBUG_H #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ #include "dcmtk/ofstd/ofstream.h" #include "dcmtk/ofstd/ofglobal.h" extern OFGlobal<int> DcmDebugLevel; /* default 0 */ #ifdef DEBUG void DCM_dcmdata_debug_print(const char* text, ... ); // Set the debug level #define SetDebugLevel(level) DcmDebugLevel.set(level); // debug prints a debug message in param if lev <= DcmDebugLevel. param has the // format of the printf parameters (with round brackets)! #define DCM_dcmdataDebug(lev, param) \ { \ if ((lev) <= DcmDebugLevel.get()) \ { \ ofConsole.lockCerr() << __FILE__ << ", LINE " << __LINE__ << ":"; \ DCM_dcmdata_debug_print param ; \ ofConsole.unlockCerr(); \ } \ } // Cdebug does the same as debug but only if a condition cond is OFTrue #define DCM_dcmdataCDebug(lev, cond, param) \ { \ if ((lev) <= DcmDebugLevel.get() && (cond)) \ { \ ofConsole.lockCerr() << __FILE__ << ", LINE " << __LINE__ << ":"; \ DCM_dcmdata_debug_print param ; \ ofConsole.unlockCerr(); \ } \ } #else // DEBUG #define SetDebugLevel(param) #define DCM_dcmdataDebug(lev, param) #define DCM_dcmdataCDebug(lev, cond, param) #endif // DEBUG #endif // DCDEBUG_H /* * CVS/RCS Log: * $Log: dcdebug.h,v $ * Revision 1.13 2005/12/08 16:28:04 meichel * Changed include path schema for all DCMTK header files * * Revision 1.12 2005/11/28 15:53:16 meichel * Renamed macros in dcdebug.h * * Revision 1.11 2004/01/16 14:06:32 joergr * Removed acknowledgements with e-mail addresses from CVS log. * * Revision 1.10 2002/04/16 13:41:43 joergr * Added configurable support for C++ ANSI standard includes (e.g. streams). * * Revision 1.9 2001/06/01 15:48:35 meichel * Updated copyright header * * Revision 1.8 2000/04/14 15:45:30 meichel * Dcmdata debug facility now uses ofConsole for output. * * Revision 1.7 2000/03/08 16:26:12 meichel * Updated copyright header. * * Revision 1.6 2000/03/03 14:05:22 meichel * Implemented library support for redirecting error messages into memory * instead of printing them to stdout/stderr for GUI applications. * * Revision 1.5 1999/03/31 09:24:33 meichel * Updated copyright header in module dcmdata * * */
/* * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * You should have received a copy of the GNU General Public License along * with this program; if not, write the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ /************************************************************************** * * TEST IDENTIFIER : munlock02 * * EXECUTED BY : root / superuser * * TEST TITLE : Test for checking basic error conditions for * munlock(2) * * TEST CASE TOTAL : 2 * * AUTHOR : Nirmala Devi Dhanasekar <nirmala.devi@wipro.com> * * SIGNALS * Uses SIGUSR1 to pause before test if option set. * (See the parse_opts(3) man page). * * DESCRIPTION * Check for basic errors returned by munlock(2) system call. * * Verify that munlock(2) returns -1 and sets errno to * * 1) ENOMEM - Some of the specified address range does not correspond to * mapped pages in the address space of the process. * * Setup: * Setup signal handling. * Pause for SIGUSR1 if option specified. * * Test: * Loop if the proper options are given. * Do necessary setup for each test. * Execute system call * Check return code, if system call failed (return=-1) * Log the errno and Issue a FAIL message. * Otherwise, Issue a PASS message. * * Cleanup: * Print errno log and/or timing stats if options given * * USAGE: <for command-line> * munlock02 [-c n] [-e] [-i n] [-I x] [-p x] [-t] * where, -c n : Run n copies concurrently * -e : Turn on errno logging. * -h : Show this help screen * -i n : Execute test n times. * -I x : Execute test for x seconds. * -p : Pause for SIGUSR1 before starting * -P x : Pause for x seconds between iterations. * -t : Turn on syscall timing. * * RESTRICTIONS * Test must run as root. *****************************************************************************/ #include <errno.h> #include <unistd.h> #include <sys/mman.h> #include <pwd.h> #include "test.h" #include "usctest.h" void setup(); void cleanup(); char *TCID = "munlock02"; int TST_TOTAL = 1; int exp_enos[] = { ENOMEM, 0 }; #define LEN 1024 void *addr1; struct test_case_t { void *addr; int len; int error; char *edesc; } TC[] = { { NULL, 0, ENOMEM, "address range out of address space"},}; #if !defined(UCLINUX) int main(int ac, char **av) { int lc, i; char *msg; if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) { tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); tst_exit(); } setup(); /* check looping state */ for (lc = 0; TEST_LOOPING(lc); lc++) { tst_count = 0; for (i = 0; i < TST_TOTAL; i++) { #ifdef __ia64__ TC[0].len = 8 * getpagesize(); #endif TEST(munlock(TC[i].addr, TC[i].len)); /* check return code */ if (TEST_RETURN == -1) { TEST_ERROR_LOG(TEST_ERRNO); if (TEST_ERRNO != TC[i].error) tst_brkm(TFAIL, cleanup, "munlock() Failed with wrong " "errno, expected errno=%s, " "got errno=%d : %s", TC[i].edesc, TEST_ERRNO, strerror(TEST_ERRNO)); else tst_resm(TPASS, "expected failure - errno " "= %d : %s", TEST_ERRNO, strerror(TEST_ERRNO)); } else { tst_brkm(TFAIL, cleanup, "munlock() Failed, expected " "return value=-1, got %ld", TEST_RETURN); } } } /* cleanup and exit */ cleanup(); tst_exit(); } /* setup() - performs all ONE TIME setup for this test. */ void setup() { char *address; tst_sig(FORK, DEF_HANDLER, cleanup); /* set the expected errnos... */ TEST_EXP_ENOS(exp_enos); TC[0].len = 8 * getpagesize(); address = mmap(0, TC[0].len, PROT_READ | PROT_WRITE, MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0); if (address == MAP_FAILED) tst_brkm(TFAIL, cleanup, "mmap_failed"); memset(address, 0x20, TC[0].len); TEST(mlock(address, TC[0].len)); /* check return code */ if (TEST_RETURN == -1) { tst_brkm(TFAIL | TTERRNO, cleanup, "mlock(%p, %d) Failed with return=%ld", address, TC[0].len, TEST_RETURN); } TC[0].addr = address; /* * unmap part of the area, to create the condition for ENOMEM */ address += 2 * getpagesize(); munmap(address, 4 * getpagesize()); TEST_PAUSE; return; } #else int main() { tst_resm(TINFO, "test is not available on uClinux"); tst_exit(); } #endif /* if !defined(UCLINUX) */ /* * cleanup() - performs all ONE TIME cleanup for this test at * completion or premature exit. */ void cleanup() { TEST_CLEANUP; return; }
/* Binutils emulation layer. Copyright 2002, 2003, 2006, 2007, 2008 Free Software Foundation, Inc. Written by Tom Rix, Red Hat Inc. This file is part of GNU Binutils. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "binemul.h" #include "bfdlink.h" #include "coff/internal.h" #include "coff/xcoff.h" #include "libcoff.h" #include "libxcoff.h" /* Default to <bigaf>. */ static bfd_boolean big_archive = TRUE; /* Whether to include 32 bit objects. */ static bfd_boolean X32 = TRUE; /* Whether to include 64 bit objects. */ static bfd_boolean X64 = FALSE; static void ar_emul_aix_usage (FILE *fp) { AR_EMUL_USAGE_PRINT_OPTION_HEADER (fp); /* xgettext:c-format */ fprintf (fp, _(" [-g] - 32 bit small archive\n")); fprintf (fp, _(" [-X32] - ignores 64 bit objects\n")); fprintf (fp, _(" [-X64] - ignores 32 bit objects\n")); fprintf (fp, _(" [-X32_64] - accepts 32 and 64 bit objects\n")); } static bfd_boolean ar_emul_aix_internal (bfd ** after_bfd, char * file_name, bfd_boolean verbose, const char * target_name, bfd_boolean is_append, bfd_boolean flatten ATTRIBUTE_UNUSED) { bfd *temp; bfd *try_bfd; temp = *after_bfd; /* Try 64 bit. */ try_bfd = bfd_openr (file_name, target_name); /* Failed or the object is possibly 32 bit. */ if (NULL == try_bfd || ! bfd_check_format (try_bfd, bfd_object)) try_bfd = bfd_openr (file_name, "aixcoff-rs6000"); AR_EMUL_ELEMENT_CHECK (try_bfd, file_name); if (bfd_xcoff_is_xcoff64 (try_bfd) && (! X64)) return FALSE; if (bfd_xcoff_is_xcoff32 (try_bfd) && bfd_check_format (try_bfd, bfd_object) && (! X32)) return FALSE; if (is_append) { AR_EMUL_APPEND_PRINT_VERBOSE (verbose, file_name); } else { AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name); } *after_bfd = try_bfd; (*after_bfd)->archive_next = temp; return TRUE; } static bfd_boolean ar_emul_aix_append (bfd **after_bfd, char *file_name, bfd_boolean verbose, bfd_boolean flatten) { return ar_emul_aix_internal (after_bfd, file_name, verbose, "aixcoff64-rs6000", TRUE, flatten); } static bfd_boolean ar_emul_aix5_append (bfd **after_bfd, char *file_name, bfd_boolean verbose, bfd_boolean flatten) { return ar_emul_aix_internal (after_bfd, file_name, verbose, "aix5coff64-rs6000", TRUE, flatten); } static bfd_boolean ar_emul_aix_replace (bfd **after_bfd, char *file_name, bfd_boolean verbose) { return ar_emul_aix_internal (after_bfd, file_name, verbose, "aixcoff64-rs6000", FALSE, FALSE); } static bfd_boolean ar_emul_aix5_replace (bfd **after_bfd, char *file_name, bfd_boolean verbose) { return ar_emul_aix_internal (after_bfd, file_name, verbose, "aix5coff64-rs6000", FALSE, FALSE); } static bfd_boolean ar_emul_aix_parse_arg (char *arg) { if (CONST_STRNEQ (arg, "-X32_64")) { big_archive = TRUE; X32 = TRUE; X64 = TRUE; } else if (CONST_STRNEQ (arg, "-X32")) { big_archive = TRUE; X32 = TRUE; X64 = FALSE; } else if (CONST_STRNEQ (arg, "-X64")) { big_archive = TRUE; X32 = FALSE; X64 = TRUE; } else if (CONST_STRNEQ (arg, "-g")) { big_archive = FALSE; X32 = TRUE; X64 = FALSE; } else return FALSE; return TRUE; } struct bin_emulation_xfer_struct bin_aix_emulation = { ar_emul_aix_usage, ar_emul_aix_append, ar_emul_aix_replace, ar_emul_aix_parse_arg, }; struct bin_emulation_xfer_struct bin_aix5_emulation = { ar_emul_aix_usage, ar_emul_aix5_append, ar_emul_aix5_replace, ar_emul_aix_parse_arg, };
#include <uwsgi.h> /* this plugin, allows remote spooling of jobs */ extern struct uwsgi_server uwsgi; int uwsgi_request_spooler(struct wsgi_request *wsgi_req) { struct uwsgi_header uh; // TODO get the spooler from the modifier2 if (uwsgi.spoolers == NULL) { uwsgi_log("the spooler is inactive !!!...skip\n"); uh.modifier1 = 255; uh.pktsize = 0; uh.modifier2 = 0; uwsgi_response_write_body_do(wsgi_req, (char *) &uh, 4); return -1; } char *filename = uwsgi_spool_request(NULL, wsgi_req->buffer, wsgi_req->uh->pktsize, NULL, 0); uh.modifier1 = 255; uh.pktsize = 0; if (filename) { uh.modifier2 = 1; if (uwsgi_response_write_body_do(wsgi_req, (char *) &uh, 4)) { uwsgi_log("disconnected client, remove spool file.\n"); /* client disconnect, remove spool file */ if (unlink(filename)) { uwsgi_error("uwsgi_request_spooler()/unlink()"); uwsgi_log("something horrible happened !!! check your spooler ASAP !!!\n"); exit(1); } } free(filename); return 0; } else { /* announce a failed spool request */ uh.modifier2 = 0; uwsgi_response_write_body_do(wsgi_req, (char *) &uh, 4); } return -1; } struct uwsgi_plugin spooler_plugin = { .name = "spooler", .modifier1 = 17, .request = uwsgi_request_spooler, };
/* * Copyright (C) 2014 BlueKitchen GmbH * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * 4. Any redistribution, use, or modification is done solely for * personal benefit and not for any commercial purpose or for * monetary gain. * * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH 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 MATTHIAS * RINGWALD 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. * * Please inquire about commercial licensing options at * contact@bluekitchen-gmbh.com * */ /* * bt_control_em9301.c * * Adapter to use em9301-based chipsets with BTstack * * Allows to set public BD ADDR */ #include "btstack-config.h" #include "bt_control_em9301.h" #include <stddef.h> /* NULL */ #include <stdio.h> #include <string.h> /* memcpy */ #include "hci.h" // should go to some common place #define OPCODE(ogf, ocf) (ocf | ogf << 10) static int em9301_set_bd_addr_cmd(void * config, bd_addr_t addr, uint8_t *hci_cmd_buffer){ bt_store_16(hci_cmd_buffer, 0, OPCODE(OGF_VENDOR, 0x02)); hci_cmd_buffer[2] = 0x06; bt_flip_addr(&hci_cmd_buffer[3], addr); return 0; } // MARK: const structs static const bt_control_t bt_control_em9301 = { NULL, // on NULL, // off NULL, // sleep NULL, // wake NULL, // valid NULL, // name NULL, // baudrate_cmd NULL, // next_cmd NULL, // register_for_power_notifications NULL, // hw_error em9301_set_bd_addr_cmd, // set_bd_addr_cmd }; // MARK: public API bt_control_t *bt_control_em9301_instance(void){ return (bt_control_t*) &bt_control_em9301; }
/*============================================================================= // // This software has been released under the terms of the GNU General Public // license. See http://www.gnu.org/copyleft/gpl.html for details. // // Copyright 2001 Anders Johansson ajh@atri.curtin.edu.au // //============================================================================= */ #if !defined DSP_H # error "Never use <filter.h> directly; include <dsp.h> instead" #endif #ifndef FILTER_H #define FILTER_H // Design and implementation of different types of digital filters // Flags used for filter design // Filter characteristics #define LP 0x00010000 // Low pass #define HP 0x00020000 // High pass #define BP 0x00040000 // Band pass #define BS 0x00080000 // Band stop #define TYPE_MASK 0x000F0000 // Window types #define BOXCAR 0x00000001 #define TRIANG 0x00000002 #define HAMMING 0x00000004 #define HANNING 0x00000008 #define BLACKMAN 0x00000010 #define FLATTOP 0x00000011 #define KAISER 0x00000012 #define WINDOW_MASK 0x0000001F // Parallel filter design #define FWD 0x00000001 // Forward indexing of polyphase filter #define REW 0x00000002 // Reverse indexing of polyphase filter #define ODD 0x00000010 // Make filter HP // Exported functions extern _ftype_t af_filter_fir(unsigned int n, _ftype_t* w, _ftype_t* x); extern _ftype_t* af_filter_pfir(unsigned int n, unsigned int k, unsigned int xi, _ftype_t** w, _ftype_t** x, _ftype_t* y, unsigned int s); //extern int af_filter_updateq(unsigned int n, unsigned int xi, _ftype_t* xq, _ftype_t* in); extern int af_filter_updatepq(unsigned int n, unsigned int k, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s); extern int af_filter_design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _ftype_t opt); extern int af_filter_design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _ftype_t g, unsigned int flags); extern int af_filter_szxform(_ftype_t* a, _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _ftype_t *k, _ftype_t *coef); /* Add new data to circular queue designed to be used with a FIR filter. xq is the circular queue, in pointing at the new sample, xi current index for xq and n the length of the filter. xq must be n*2 long. */ #define af_filter_updateq(n,xi,xq,in)\ xq[xi]=(xq)[(xi)+(n)]=*(in);\ xi=(++(xi))&((n)-1); #endif
/* * Copyright (C) 2005 Junio C Hamano */ #ifndef DIFFCORE_H #define DIFFCORE_H /* This header file is internal between diff.c and its diff transformers * (e.g. diffcore-rename, diffcore-pickaxe). Never include this header * in anything else. */ /* We internally use unsigned short as the score value, * and rely on an int capable to hold 32-bits. -B can take * -Bmerge_score/break_score format and the two scores are * passed around in one int (high 16-bit for merge and low 16-bit * for break). */ #define MAX_SCORE 60000.0 #define DEFAULT_RENAME_SCORE 30000 /* rename/copy similarity minimum (50%) */ #define DEFAULT_BREAK_SCORE 30000 /* minimum for break to happen (50%) */ #define DEFAULT_MERGE_SCORE 36000 /* maximum for break-merge to happen (60%) */ #define MINIMUM_BREAK_SIZE 400 /* do not break a file smaller than this */ struct userdiff_driver; struct diff_filespec { struct object_id oid; char *path; void *data; void *cnt_data; unsigned long size; int count; /* Reference count */ int rename_used; /* Count of rename users */ unsigned short mode; /* file mode */ unsigned oid_valid : 1; /* if true, use oid and trust mode; * if false, use the name and read from * the filesystem. */ #define DIFF_FILE_VALID(spec) (((spec)->mode) != 0) unsigned should_free : 1; /* data should be free()'ed */ unsigned should_munmap : 1; /* data should be munmap()'ed */ unsigned dirty_submodule : 2; /* For submodules: its work tree is dirty */ #define DIRTY_SUBMODULE_UNTRACKED 1 #define DIRTY_SUBMODULE_MODIFIED 2 unsigned is_stdin : 1; unsigned has_more_entries : 1; /* only appear in combined diff */ /* data should be considered "binary"; -1 means "don't know yet" */ signed int is_binary : 2; struct userdiff_driver *driver; }; extern struct diff_filespec *alloc_filespec(const char *); extern void free_filespec(struct diff_filespec *); extern void fill_filespec(struct diff_filespec *, const unsigned char *, int, unsigned short); #define CHECK_SIZE_ONLY 1 #define CHECK_BINARY 2 extern int diff_populate_filespec(struct diff_filespec *, unsigned int); extern void diff_free_filespec_data(struct diff_filespec *); extern void diff_free_filespec_blob(struct diff_filespec *); extern int diff_filespec_is_binary(struct diff_filespec *); struct diff_filepair { struct diff_filespec *one; struct diff_filespec *two; unsigned short int score; char status; /* M C R A D U etc. (see Documentation/diff-format.txt or DIFF_STATUS_* in diff.h) */ unsigned broken_pair : 1; unsigned renamed_pair : 1; unsigned is_unmerged : 1; unsigned done_skip_stat_unmatch : 1; unsigned skip_stat_unmatch_result : 1; }; #define DIFF_PAIR_UNMERGED(p) ((p)->is_unmerged) #define DIFF_PAIR_RENAME(p) ((p)->renamed_pair) #define DIFF_PAIR_BROKEN(p) \ ( (!DIFF_FILE_VALID((p)->one) != !DIFF_FILE_VALID((p)->two)) && \ ((p)->broken_pair != 0) ) #define DIFF_PAIR_TYPE_CHANGED(p) \ ((S_IFMT & (p)->one->mode) != (S_IFMT & (p)->two->mode)) #define DIFF_PAIR_MODE_CHANGED(p) ((p)->one->mode != (p)->two->mode) extern void diff_free_filepair(struct diff_filepair *); extern int diff_unmodified_pair(struct diff_filepair *); struct diff_queue_struct { struct diff_filepair **queue; int alloc; int nr; }; #define DIFF_QUEUE_CLEAR(q) \ do { \ (q)->queue = NULL; \ (q)->nr = (q)->alloc = 0; \ } while (0) extern struct diff_queue_struct diff_queued_diff; extern struct diff_filepair *diff_queue(struct diff_queue_struct *, struct diff_filespec *, struct diff_filespec *); extern void diff_q(struct diff_queue_struct *, struct diff_filepair *); extern void diffcore_break(int); extern void diffcore_rename(struct diff_options *); extern void diffcore_merge_broken(void); extern void diffcore_pickaxe(struct diff_options *); extern void diffcore_order(const char *orderfile); /* low-level interface to diffcore_order */ struct obj_order { void *obj; /* setup by caller */ /* setup/used by order_objects() */ int orig_order; int order; }; typedef const char *(*obj_path_fn_t)(void *obj); void order_objects(const char *orderfile, obj_path_fn_t obj_path, struct obj_order *objs, int nr); #define DIFF_DEBUG 0 #if DIFF_DEBUG void diff_debug_filespec(struct diff_filespec *, int, const char *); void diff_debug_filepair(const struct diff_filepair *, int); void diff_debug_queue(const char *, struct diff_queue_struct *); #else #define diff_debug_filespec(a,b,c) do { /* nothing */ } while (0) #define diff_debug_filepair(a,b) do { /* nothing */ } while (0) #define diff_debug_queue(a,b) do { /* nothing */ } while (0) #endif extern int diffcore_count_changes(struct diff_filespec *src, struct diff_filespec *dst, void **src_count_p, void **dst_count_p, unsigned long delta_limit, unsigned long *src_copied, unsigned long *literal_added); #endif
/* * This file is part of OGS Engine * Copyright (C) 2016-2017 OGS Dev Team * * OGS Engine 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. * * OGS Engine 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 OGS Engine. If not, see <http://www.gnu.org/licenses/>. * * In addition, as a special exception, the author gives permission to * link the code of OGS Engine with the Half-Life Game Engine ("GoldSrc/GS * Engine") and Modified Game Libraries ("MODs") developed by Valve, * L.L.C ("Valve"). You must obey the GNU General Public License in all * respects for all of the code used other than the GoldSrc Engine and MODs * from Valve. If you modify this file, you may extend this exception * to your version of the file, but you are not obligated to do so. If * you do not wish to do so, delete this exception statement from your * version. */ /// @file #pragma once #include "vgui2/IInputInternal.h" namespace vgui { class CInputInternal : public IInputInternal { public: void RunFrame(); void UpdateMouseFocus(int x, int y); void PanelDeleted(VPANEL panel); bool InternalCursorMoved(int x, int y); bool InternalMousePressed(MouseCode code); bool InternalMouseDoublePressed(MouseCode code); bool InternalMouseReleased(MouseCode code); bool InternalMouseWheeled(int delta); bool InternalKeyCodePressed(KeyCode code); void InternalKeyCodeTyped(KeyCode code); void InternalKeyTyped(wchar_t unichar); bool InternalKeyCodeReleased(KeyCode code); HInputContext CreateInputContext(); void DestroyInputContext(HInputContext context); void AssociatePanelWithInputContext(HInputContext context, VPANEL pRoot); void ActivateInputContext(HInputContext context); VPANEL GetMouseCapture(); bool IsChildOfModalPanel(VPANEL panel); void ResetInputContext(HInputContext context); }; }; // namespace vgui
// // MyGLView.h // OpenGLShaderBasic // // Created by Zenny Chen on 10/4/10. // Copyright 2010 GreenGames Studio. All rights reserved. // #import <Cocoa/Cocoa.h> @interface MyGLView : NSOpenGLView - (void)setTag:(NSInteger)tag; - (void)destroyBuffers; @end
/* shutdown.c --- wrappers for Windows shutdown function Copyright (C) 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ #include <config.h> #define WIN32_LEAN_AND_MEAN /* Get winsock2.h. */ #include <sys/socket.h> /* Get set_winsock_errno, FD_TO_SOCKET etc. */ #include "w32sock.h" #undef shutdown int rpl_shutdown (int fd, int how) { SOCKET sock = FD_TO_SOCKET (fd); if (sock == INVALID_SOCKET) { errno = EBADF; return -1; } else { int r = shutdown (sock, how); if (r < 0) set_winsock_errno (); return r; } }
#ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdio.h> #include <string.h> #include <math.h> #include "feat.h" #include "ckd_alloc.h" #include "test_macros.h" const mfcc_t data[6][13] = { { FLOAT2MFCC(15.114), FLOAT2MFCC(-1.424), FLOAT2MFCC(-0.953), FLOAT2MFCC(0.186), FLOAT2MFCC(-0.656), FLOAT2MFCC(-0.226), FLOAT2MFCC(-0.105), FLOAT2MFCC(-0.412), FLOAT2MFCC(-0.024), FLOAT2MFCC(-0.091), FLOAT2MFCC(-0.124), FLOAT2MFCC(-0.158), FLOAT2MFCC(-0.197)}, { FLOAT2MFCC(14.729), FLOAT2MFCC(-1.313), FLOAT2MFCC(-0.892), FLOAT2MFCC(0.140), FLOAT2MFCC(-0.676), FLOAT2MFCC(-0.089), FLOAT2MFCC(-0.313), FLOAT2MFCC(-0.422), FLOAT2MFCC(-0.058), FLOAT2MFCC(-0.101), FLOAT2MFCC(-0.100), FLOAT2MFCC(-0.128), FLOAT2MFCC(-0.123)}, { FLOAT2MFCC(14.502), FLOAT2MFCC(-1.351), FLOAT2MFCC(-1.028), FLOAT2MFCC(-0.189), FLOAT2MFCC(-0.718), FLOAT2MFCC(-0.139), FLOAT2MFCC(-0.121), FLOAT2MFCC(-0.365), FLOAT2MFCC(-0.139), FLOAT2MFCC(-0.154), FLOAT2MFCC(0.041), FLOAT2MFCC(0.009), FLOAT2MFCC(-0.073)}, { FLOAT2MFCC(14.557), FLOAT2MFCC(-1.676), FLOAT2MFCC(-0.864), FLOAT2MFCC(0.118), FLOAT2MFCC(-0.445), FLOAT2MFCC(-0.168), FLOAT2MFCC(-0.069), FLOAT2MFCC(-0.503), FLOAT2MFCC(-0.013), FLOAT2MFCC(0.007), FLOAT2MFCC(-0.056), FLOAT2MFCC(-0.075), FLOAT2MFCC(-0.237)}, { FLOAT2MFCC(14.665), FLOAT2MFCC(-1.498), FLOAT2MFCC(-0.582), FLOAT2MFCC(0.209), FLOAT2MFCC(-0.487), FLOAT2MFCC(-0.247), FLOAT2MFCC(-0.142), FLOAT2MFCC(-0.439), FLOAT2MFCC(0.059), FLOAT2MFCC(-0.058), FLOAT2MFCC(-0.265), FLOAT2MFCC(-0.109), FLOAT2MFCC(-0.196)}, { FLOAT2MFCC(15.025), FLOAT2MFCC(-1.199), FLOAT2MFCC(-0.607), FLOAT2MFCC(0.235), FLOAT2MFCC(-0.499), FLOAT2MFCC(-0.080), FLOAT2MFCC(-0.062), FLOAT2MFCC(-0.554), FLOAT2MFCC(-0.209), FLOAT2MFCC(-0.124), FLOAT2MFCC(-0.445), FLOAT2MFCC(-0.352), FLOAT2MFCC(-0.400)}, }; int main(int argc, char *argv[]) { feat_t *fcb; mfcc_t **in_feats, ***out_feats, ***out_feats2, ***optr; int32 i, j, ncep, nfr, nfr1, nfr2; in_feats = (mfcc_t **)ckd_alloc_2d_ptr(6, 13, data, sizeof(mfcc_t)); out_feats = (mfcc_t ***)ckd_calloc_3d(8, 1, 39, sizeof(mfcc_t)); /* Test 1s_c_d_dd features */ fcb = feat_init("1s_c_d_dd", CMN_NONE, 0, AGC_NONE, 1, 13); ncep = 6; nfr1 = feat_s2mfc2feat_live(fcb, in_feats, &ncep, 1, 1, out_feats); printf("Processed %d input %d output frames\n", ncep, nfr1); for (i = 0; i < nfr1; ++i) { printf("%d: ", i); for (j = 0; j < 39; ++j) { printf("%.3f ", MFCC2FLOAT(out_feats[i][0][j])); } printf("\n"); } feat_free(fcb); /* Test in "live" mode. */ fcb = feat_init("1s_c_d_dd", CMN_NONE, 0, AGC_NONE, 1, 13); optr = out_feats2 = (mfcc_t ***)ckd_calloc_3d(8, 1, 39, sizeof(mfcc_t)); nfr2 = 0; ncep = 2; nfr = feat_s2mfc2feat_live(fcb, in_feats, &ncep, TRUE, FALSE, optr); printf("Processed %d input %d output frames\n", ncep, nfr); nfr2 += nfr; for (i = 0; i < nfr; ++i) { printf("%d: ", i); for (j = 0; j < 39; ++j) { printf("%.3f ", MFCC2FLOAT(optr[i][0][j])); } printf("\n"); } optr += nfr; ncep = 2; nfr = feat_s2mfc2feat_live(fcb, in_feats + 2, &ncep, FALSE, FALSE, optr); nfr2 += nfr; printf("Processed %d input %d output frames\n", ncep, nfr); for (i = 0; i < nfr; ++i) { printf("%d: ", i); for (j = 0; j < 39; ++j) { printf("%.3f ", MFCC2FLOAT(optr[i][0][j])); } printf("\n"); } optr += nfr; ncep = 2; nfr = feat_s2mfc2feat_live(fcb, in_feats + 4, &ncep, FALSE, TRUE, optr); nfr2 += nfr; printf("Processed %d input %d output frames\n", ncep, nfr); for (i = 0; i < nfr; ++i) { printf("%d: ", i); for (j = 0; j < 39; ++j) { printf("%.3f ", MFCC2FLOAT(optr[i][0][j])); } printf("\n"); } optr += nfr; feat_free(fcb); TEST_EQUAL(nfr1, nfr2); for (i = 0; i < nfr1; ++i) { for (j = 0; j < 39; ++j) { TEST_EQUAL(out_feats[i][0][j], out_feats2[i][0][j]); } } ckd_free_3d(out_feats2); ckd_free_3d(out_feats); ckd_free(in_feats); return 0; }
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_HWUI_PROGRAM_CACHE_H #define ANDROID_HWUI_PROGRAM_CACHE_H #include <utils/KeyedVector.h> #include <utils/Log.h> #include <utils/String8.h> #include <GLES2/gl2.h> #include "Debug.h" #include "Program.h" #include "Properties.h" namespace android { namespace uirenderer { /////////////////////////////////////////////////////////////////////////////// // Cache /////////////////////////////////////////////////////////////////////////////// /** * Generates and caches program. Programs are generated based on * ProgramDescriptions. */ class ProgramCache { public: ProgramCache(); ~ProgramCache(); Program* get(const ProgramDescription& description); void clear(); private: Program* generateProgram(const ProgramDescription& description, programid key); String8 generateVertexShader(const ProgramDescription& description); String8 generateFragmentShader(const ProgramDescription& description); void generateBlend(String8& shader, const char* name, SkXfermode::Mode mode); void generateTextureWrap(String8& shader, GLenum wrapS, GLenum wrapT); void printLongString(const String8& shader) const; KeyedVector<programid, Program*> mCache; const bool mHasES3; }; // class ProgramCache }; // namespace uirenderer }; // namespace android #endif // ANDROID_HWUI_PROGRAM_CACHE_H
#ifndef _W32API_H #define _W32API_H #define _W32API_H_ #if __GNUC__ >=3 #pragma GCC system_header #endif #define __W32API_VERSION 3.13 #define __W32API_MAJOR_VERSION 3 #define __W32API_MINOR_VERSION 13 /* The following defines are for documentation purposes. The following defines * identify the versions of Windows and Internet Explorer. They are not to be * used in the w32api library but may be used by a user to set the _WIN32_WINNT * or _WIN32_WINDOWS and the WINVER values to their minimum level of support. * * Similarly the user can use the Internet Explorer values to set the _WIN32_IE * value to their minimum level of support. */ /* Use these values to set _WIN32_WINDOWS and WINVER to your minimum support * level */ #define Windows95 0x0400 #define Windows98 0x0410 #define WindowsME 0x0500 /* Use these values to set _WIN32_WINNT and WINVER to your mimimum support * level. */ #define WindowsNT4 0x0400 #define Windows2000 0x0500 #define WindowsXP 0x0501 #define Windows2003 0x0502 #define WindowsVista 0x0600 /* Use these values to set _WIN32_IE to your minimum support level */ #define IE3 0x0300 #define IE301 0x0300 #define IE302 0x0300 #define IE4 0x0400 #define IE401 0x0401 #define IE5 0x0500 #define IE5a 0x0500 #define IE5b 0x0500 #define IE501 0x0501 #define IE55 0x0501 #define IE56 0x0560 #define IE6 0x0600 #define IE601 0x0601 #define IE602 0x0603 #define IE7 0x0700 #endif /* ndef _W32API_H */
/* movstat/movmedian.c * * Routines related to a moving window median * * Copyright (C) 2018 Patrick Alken * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <config.h> #include <stdlib.h> #include <gsl/gsl_math.h> #include <gsl/gsl_errno.h> #include <gsl/gsl_movstat.h> /* gsl_movstat_median() Apply median filter to input vector Inputs: endtype - end point handling criteria x - input vector, size n y - output vector, size n w - workspace */ int gsl_movstat_median(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w) { int status = gsl_movstat_apply_accum(endtype, x, gsl_movstat_accum_median, NULL, y, NULL, w); return status; }
/* Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public License as published by the Free Software Foundation. This program is distributed in the hope that it would be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, this software is distributed without any warranty that it is free of the rightful claim of any third person regarding infringement or the like. Any license provided herein, whether implied or otherwise, applies only to this software file. Patent licenses, if any, provided herein do not apply to combinations of this program with other software, or any other product whatsoever. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, Mountain View, CA 94043, or: http://www.sgi.com For further information regarding this notice, see: http://oss.sgi.com/projects/GenInfo/NoticeExplan */ #pragma ident "@(#) libu/clib/sbrk.c 92.1 07/01/99 13:42:20" long SBRK(incr) long *incr; { char *sbrk(); return((long)sbrk(*incr)); }
/* Get a list of all group IDs associated with a specified user ID. Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/types.h> int mgetgroups (const char *username, gid_t gid, gid_t **groups); #if GNULIB_XGETGROUPS int xgetgroups (const char *username, gid_t gid, gid_t **groups); #endif
/* * Copyright 2004 PathScale, Inc. All Rights Reserved. */ /* Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public License as published by the Free Software Foundation. This program is distributed in the hope that it would be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, this software is distributed without any warranty that it is free of the rightful claim of any third person regarding infringement or the like. Any license provided herein, whether implied or otherwise, applies only to this software file. Patent licenses, if any, provided herein do not apply to combinations of this program with other software, or any other product whatsoever. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, Mountain View, CA 94043, or: http://www.sgi.com For further information regarding this notice, see: http://oss.sgi.com/projects/GenInfo/NoticeExplan */ /* $Header: /proj/osprey/CVS/open64/osprey1.0/libF77/s_rnge.c,v 1.1.1.1 2005/10/21 19:00:00 marcel Exp $ */ #include <stdio.h> /* called when a subscript is out of range */ /* Changed this routine so that it can handle procedure names of upto * 32 characters and also to be able to print correctly names with '_' * in it *---ravi---1/13/92 */ #include "cmplrs/host.h" extern void s_abort(int32); static int32 varlen(char *); void s_rnge(char *varn, int32 offset, char *procn, int32 line) { register int32 i; int32 len; len=varlen(procn); fprintf(stderr, "Subscript out of range on file line %d, procedure ", line); /*for(i = 0 ; i < 2 && (*procn!='_' && *(procn+1) != '\0'); ++i)*/ for(i = 0 ; i < len ; ++i) putc(*procn++, stderr); fprintf(stderr, ".\nAttempt to access the %d-th element of variable ", offset+1); #ifdef sgi for(i = 0; i < 32 && *varn!=' '; ++i) putc(*varn++, stderr); #else for(i = 0 ; i < 6 && *varn!=' ' ; ++i) putc(*varn++, stderr); #endif fprintf(stderr, ".\n"); s_abort(99); } static int32 varlen(char *s) { register int32 i; /* char name[34]; */ for(i=0; i<34 && *s!=' ' && *s!='\0' ; ++i, s++); return( i-1 ); }
/* * MUSCLE SmartCard Development ( http://pcsclite.alioth.debian.org/pcsclite.html ) * * Copyright (C) 1999-2004 * David Corcoran <corcoran@musclecard.com> * Copyright (C) 1999-2011 * Ludovic Rousseau <ludovic.rousseau@free.fr> * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. Changes to this license can be made only by the copyright author with explicit written consent. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $Id: debuglog.h 6851 2014-02-14 15:43:32Z rousseau $ */ /** * @file * @brief This handles debugging. * * @note log message is sent to syslog or stderr depending on --foreground * command line argument * * @code * Log1(priority, "text"); * log "text" with priority level priority * Log2(priority, "text: %d", 1234); * log "text: 1234" * the format string can be anything printf() can understand * Log3(priority, "text: %d %d", 1234, 5678); * log "text: 1234 5678" * the format string can be anything printf() can understand * LogXxd(priority, msg, buffer, size); * log "msg" + a hex dump of size bytes of buffer[] * @endcode */ #ifndef __debuglog_h__ #define __debuglog_h__ #ifndef PCSC_API #define PCSC_API #endif enum { DEBUGLOG_NO_DEBUG = 0, DEBUGLOG_SYSLOG_DEBUG, DEBUGLOG_STDOUT_DEBUG, DEBUGLOG_STDOUT_COLOR_DEBUG }; #define DEBUG_CATEGORY_NOTHING 0 #define DEBUG_CATEGORY_APDU 1 #define DEBUG_CATEGORY_SW 2 enum { PCSC_LOG_DEBUG = 0, PCSC_LOG_INFO, PCSC_LOG_ERROR, PCSC_LOG_CRITICAL }; /* You can't do #ifndef __FUNCTION__ */ #if !defined(__GNUC__) && !defined(__IBMC__) #define __FUNCTION__ "" #endif #ifndef __GNUC__ #define __attribute__(x) /*nothing*/ #endif #ifdef NO_LOG #define Log0(priority) do { } while(0) #define Log1(priority, fmt) do { } while(0) #define Log2(priority, fmt, data) do { } while(0) #define Log3(priority, fmt, data1, data2) do { } while(0) #define Log4(priority, fmt, data1, data2, data3) do { } while(0) #define Log5(priority, fmt, data1, data2, data3, data4) do { } while(0) #define Log9(priority, fmt, data1, data2, data3, data4, data5, data6, data7, data8) do { } while(0) #define LogXxd(priority, msg, buffer, size) do { } while(0) #define DebugLogA(a) #define DebugLogB(a, b) #define DebugLogC(a, b,c) #else #define Log0(priority) log_msg(priority, "%s:%d:%s()", __FILE__, __LINE__, __FUNCTION__) #define Log1(priority, fmt) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__) #define Log2(priority, fmt, data) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data) #define Log3(priority, fmt, data1, data2) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2) #define Log4(priority, fmt, data1, data2, data3) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3) #define Log5(priority, fmt, data1, data2, data3, data4) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3, data4) #define Log9(priority, fmt, data1, data2, data3, data4, data5, data6, data7, data8) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3, data4, data5, data6, data7, data8) #define LogXxd(priority, msg, buffer, size) log_xxd(priority, msg, buffer, size) #define DebugLogA(a) Log1(PCSC_LOG_INFO, a) #define DebugLogB(a, b) Log2(PCSC_LOG_INFO, a, b) #define DebugLogC(a, b,c) Log3(PCSC_LOG_INFO, a, b, c) #endif /* NO_LOG */ PCSC_API void log_msg(const int priority, const char *fmt, ...) __attribute__((format(printf, 2, 3))); PCSC_API void log_xxd(const int priority, const char *msg, const unsigned char *buffer, const int size); void DebugLogSuppress(const int); void DebugLogSetLogType(const int); int DebugLogSetCategory(const int); void DebugLogCategory(const int, const unsigned char *, const int); PCSC_API void DebugLogSetLevel(const int level); #endif /* __debuglog_h__ */
// // Copyright (C) 2001,2002,2003,2004 Jorge Daza Garcia-Blanes // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA // #ifndef _DRQM_JOBS_PIXIE_H_ #define _DRQM_JOBS_PIXIE_H_ #include <gtk/gtk.h> #define KOJ_PIXIE_DFLT_VIEWCMD "display image.$DRQUEUE_FRAME.jpg" struct drqmj_koji_pixie { GtkWidget *escene; GtkWidget *fsscene; /* File selector for the scene */ GtkWidget *eviewcmd; GtkWidget *escript; /* Entry script location */ GtkWidget *fsscript; /* File selectot for the script directory */ }; struct drqm_jobs_info; GtkWidget *dnj_koj_frame_pixie (struct drqm_jobs_info *info); GtkWidget *jdd_koj_pixie_widgets (struct drqm_jobs_info *info); #endif /* _DRQM_JOBS_PIXIE_H_ */
#ifndef HW_USBPHY_H #define HW_USBPHY_H #define USB_PHY 0x3C400000 // Registers #define OPHYPWR 0 #define OPHYCLK 0x4 #define ORSTCON 0x8 #define OPHYUNK1 0x1C #define OPHYUNK2 0x44 #define OPHYCHARGER 0x48 // Values #define OPHYPWR_FORCESUSPEND 0x1 #define OPHYPWR_PLLPOWERDOWN 0x2 #define OPHYPWR_XOPOWERDOWN 0x4 #define OPHYPWR_ANALOGPOWERDOWN 0x8 #define OPHYPWR_UNKNOWNPOWERDOWN 0x10 #define OPHYPWR_POWERON 0x0 // all the previous flags are off #define OPHYCLK_CLKSEL_MASK 0x3 #define OPHYCLK_SPEED_48MHZ 48000000 #define OPHYCLK_SPEED_12MHZ 12000000 #define OPHYCLK_SPEED_24MHZ 24000000 #define OPHYCLK_CLKSEL_12MHZ 0x0 #define OPHYCLK_CLKSEL_24MHZ 0x1 #define OPHYCLK_CLKSEL_48MHZ 0x2 #define OPHYCLK_CLKSEL_OTHER 0x3 #define ORSTCON_PHYSWRESET 0x1 #define ORSTCON_LINKSWRESET 0x2 #define ORSTCON_PHYLINKSWRESET 0x4 #define OPHYUNK1_START 0x6 #define OPHYUNK1_STOP_MASK 0x2 #define OPHYUNK2_START 0xE3F #define OPHYCHARGER_DN (1 << 2) #define OPHYCHARGER_DP (1 << 1) #define OPHYCHARGER_NONE 0 #define OPHYCHARGER_MASK 0x6 #define USB_PHYPWRPOWERON_DELAYUS 10 #define USB_RESET2_DELAYUS 20 #define USB_RESET_DELAYUS 1000 #endif
/** * @file config.h * @brief Library configuration file * @author Daniel Szot */ #ifndef _LIBRARY_CONFIG_H_ #define _LIBRARY_CONFIG_H_ //#define NDEBUG #if !defined(NDEBUG) #define LOG_ENABLED //#define LOG_DEBUG #define ASSERT_LOGING #endif #define DEFAULT_USER_TASK_PRIORITY 1 // You always should provide any console interface // We need to implement just 4 functions: // 1. retcode consoleStart(); // 2. void consoleStop(); // 3. struct consoleCmdHandler * // consoleRegisterCmd(char *pCommand, void (*pHandler)(UINT8 argc, const char* argv[])); // 4. void consoleUnregisterCmd(struct consoleCmdHandler *pHandler); #define USE_SERIAL_CONSOLE // Use one channel audio output #define USE_ONE_CHANNEL_AUDIO // Size of input events queue #define INPUT_QUEUE_SIZE 200 // Default messages queue size for messages listener #define DEF_MSG_QUEUE_SIZE 200 #endif
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "InformationElements" * found in "../asn/InformationElements.asn" * `asn1c -fcompound-names -fnative-types` */ #include "UE-RadioAccessCapability-va40ext.h" static asn_TYPE_member_t asn_MBR_UE_RadioAccessCapability_va40ext_1[] = { { ATF_NOFLAGS, 0, offsetof(struct UE_RadioAccessCapability_va40ext, ue_RadioAccessCapabBandFDDList4), (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_UE_RadioAccessCapabBandFDDList4, 0, /* Defer constraints checking to the member type */ 0, /* No PER visible constraints */ 0, "ue-RadioAccessCapabBandFDDList4" }, }; static ber_tlv_tag_t asn_DEF_UE_RadioAccessCapability_va40ext_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_TYPE_tag2member_t asn_MAP_UE_RadioAccessCapability_va40ext_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* ue-RadioAccessCapabBandFDDList4 at 2921 */ }; static asn_SEQUENCE_specifics_t asn_SPC_UE_RadioAccessCapability_va40ext_specs_1 = { sizeof(struct UE_RadioAccessCapability_va40ext), offsetof(struct UE_RadioAccessCapability_va40ext, _asn_ctx), asn_MAP_UE_RadioAccessCapability_va40ext_tag2el_1, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_UE_RadioAccessCapability_va40ext = { "UE-RadioAccessCapability-va40ext", "UE-RadioAccessCapability-va40ext", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_UE_RadioAccessCapability_va40ext_tags_1, sizeof(asn_DEF_UE_RadioAccessCapability_va40ext_tags_1) /sizeof(asn_DEF_UE_RadioAccessCapability_va40ext_tags_1[0]), /* 1 */ asn_DEF_UE_RadioAccessCapability_va40ext_tags_1, /* Same as above */ sizeof(asn_DEF_UE_RadioAccessCapability_va40ext_tags_1) /sizeof(asn_DEF_UE_RadioAccessCapability_va40ext_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_UE_RadioAccessCapability_va40ext_1, 1, /* Elements count */ &asn_SPC_UE_RadioAccessCapability_va40ext_specs_1 /* Additional specs */ };
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "InformationElements" * found in "../asn/InformationElements.asn" * `asn1c -fcompound-names -fnative-types` */ #include "E-DPDCH-Reference-E-TFCIList-r7.h" static asn_per_constraints_t asn_PER_type_E_DPDCH_Reference_E_TFCIList_r7_constr_1 = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */, 0, 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_E_DPDCH_Reference_E_TFCIList_r7_1[] = { { ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, &asn_DEF_E_DPDCH_Reference_E_TFCI_r7, 0, /* Defer constraints checking to the member type */ 0, /* No PER visible constraints */ 0, "" }, }; static ber_tlv_tag_t asn_DEF_E_DPDCH_Reference_E_TFCIList_r7_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_E_DPDCH_Reference_E_TFCIList_r7_specs_1 = { sizeof(struct E_DPDCH_Reference_E_TFCIList_r7), offsetof(struct E_DPDCH_Reference_E_TFCIList_r7, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_E_DPDCH_Reference_E_TFCIList_r7 = { "E-DPDCH-Reference-E-TFCIList-r7", "E-DPDCH-Reference-E-TFCIList-r7", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_E_DPDCH_Reference_E_TFCIList_r7_tags_1, sizeof(asn_DEF_E_DPDCH_Reference_E_TFCIList_r7_tags_1) /sizeof(asn_DEF_E_DPDCH_Reference_E_TFCIList_r7_tags_1[0]), /* 1 */ asn_DEF_E_DPDCH_Reference_E_TFCIList_r7_tags_1, /* Same as above */ sizeof(asn_DEF_E_DPDCH_Reference_E_TFCIList_r7_tags_1) /sizeof(asn_DEF_E_DPDCH_Reference_E_TFCIList_r7_tags_1[0]), /* 1 */ &asn_PER_type_E_DPDCH_Reference_E_TFCIList_r7_constr_1, asn_MBR_E_DPDCH_Reference_E_TFCIList_r7_1, 1, /* Single element */ &asn_SPC_E_DPDCH_Reference_E_TFCIList_r7_specs_1 /* Additional specs */ };
#ifndef LINUX_ISSETUGID_H #define LINUX_ISSETUGID_H long sys_issetugid(void); #endif
#ifndef HEADER_H #define HEADER_H #include<stdio.h> #include<stdlib.h> #include<string.h> #define MAX 10 #define limit 5 void push(int); void pop(void); void display(); int top; int stack[limit]; #endif
#pragma once #include <cstring> #include <cassert> #include <type_traits> #include <vector> #include <string> #ifdef __INTEL_COMPILER #pragma warning(disable:597) // will not be called for implicit or explicit conversions #endif namespace dev { /** * A modifiable reference to an existing object or vector in memory. */ template <class _T> class vector_ref { public: using value_type = _T; using element_type = _T; using mutable_value_type = typename std::conditional<std::is_const<_T>::value, typename std::remove_const<_T>::type, _T>::type; using string_type = typename std::conditional<std::is_const<_T>::value, std::string const, std::string>::type; using vector_type = typename std::conditional<std::is_const<_T>::value, std::vector<typename std::remove_const<_T>::type> const, std::vector<_T>>::type; static_assert(std::is_pod<value_type>::value, "vector_ref can only be used with PODs due to its low-level treatment of data."); vector_ref(): m_data(nullptr), m_count(0) {} /// Creates a new vector_ref to point to @a _count elements starting at @a _data. vector_ref(_T* _data, size_t _count): m_data(_data), m_count(_count) {} /// Creates a new vector_ref pointing to the data part of a string (given as pointer). vector_ref(string_type* _data): m_data(reinterpret_cast<_T*>(_data->data())), m_count(_data->size() / sizeof(_T)) {} /// Creates a new vector_ref pointing to the data part of a string (given as reference). vector_ref(string_type& _data): vector_ref(&_data) {} /// Creates a new vector_ref pointing to the data part of a vector (given as pointer). vector_ref(vector_type* _data): m_data(_data->data()), m_count(_data->size()) {} explicit operator bool() const { return m_data && m_count; } std::vector<unsigned char> toBytes() const { return std::vector<unsigned char>(reinterpret_cast<unsigned char const*>(m_data), reinterpret_cast<unsigned char const*>(m_data) + m_count * sizeof(_T)); } std::string toString() const { return std::string((char const*)m_data, ((char const*)m_data) + m_count * sizeof(_T)); } template <class _T2> explicit operator vector_ref<_T2>() const { assert(m_count * sizeof(_T) / sizeof(_T2) * sizeof(_T2) / sizeof(_T) == m_count); return vector_ref<_T2>(reinterpret_cast<_T2*>(m_data), m_count * sizeof(_T) / sizeof(_T2)); } operator vector_ref<_T const>() const { return vector_ref<_T const>(m_data, m_count); } _T* data() const { return m_data; } /// @returns the number of elements referenced (not necessarily number of bytes). size_t size() const { return m_count; } bool empty() const { return !m_count; } /// @returns a new vector_ref which is a shifted and shortened view of the original data. /// If this goes out of bounds in any way, returns an empty vector_ref. /// If @a _count is ~size_t(0), extends the view to the end of the data. vector_ref<_T> cropped(size_t _begin, size_t _count) const { if (m_data && _begin <= m_count && _count <= m_count && _begin + _count <= m_count) return vector_ref<_T>(m_data + _begin, _count == ~size_t(0) ? m_count - _begin : _count); else return vector_ref<_T>(); } /// @returns a new vector_ref which is a shifted view of the original data (not going beyond it). vector_ref<_T> cropped(size_t _begin) const { if (m_data && _begin <= m_count) return vector_ref<_T>(m_data + _begin, m_count - _begin); else return vector_ref<_T>(); } _T* begin() { return m_data; } _T* end() { return m_data + m_count; } _T const* begin() const { return m_data; } _T const* end() const { return m_data + m_count; } _T& operator[](size_t _i) { assert(m_data); assert(_i < m_count); return m_data[_i]; } _T const& operator[](size_t _i) const { assert(m_data); assert(_i < m_count); return m_data[_i]; } bool operator==(vector_ref<_T> const& _cmp) const { return m_data == _cmp.m_data && m_count == _cmp.m_count; } bool operator!=(vector_ref<_T> const& _cmp) const { return !operator==(_cmp); } void reset() { m_data = nullptr; m_count = 0; } private: _T* m_data = nullptr; size_t m_count = 0; }; }
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. // All rights not expressly granted are reserved. // // This software is distributed under the terms of the GNU General Public // License v3 (GPL Version 3), copied verbatim in the file "COPYING". // // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. /// \file ClusterFinderGEMSpec.h /// \brief Definition of a data processor to run the GEM MLEM cluster finder /// /// \author Philippe Pillot, Subatech #ifndef O2_MCH_CLUSTERFINDERGEMSPEC_H_ #define O2_MCH_CLUSTERFINDERGEMSPEC_H_ #include "Framework/DataProcessorSpec.h" namespace o2 { namespace mch { o2::framework::DataProcessorSpec getClusterFinderGEMSpec(const char* specName = "mch-cluster-finder-GEM"); } // end namespace mch } // end namespace o2 #endif // O2_MCH_CLUSTERFINDERGEMSPEC_H_
/* Copyright (c) 2009 Andras Mantia <amantia@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIMAP_CREATEJOB_H #define KIMAP_CREATEJOB_H #include "kimap_export.h" #include "job.h" namespace KIMAP { class Session; struct Message; class CreateJobPrivate; class KIMAP_EXPORT CreateJob : public Job { Q_OBJECT Q_DECLARE_PRIVATE(CreateJob) friend class SessionPrivate; public: explicit CreateJob( Session *session ); virtual ~CreateJob(); void setMailBox( const QString &mailBox ); QString mailBox() const; protected: virtual void doStart(); }; } #endif
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "InformationElements" * found in "../asn/InformationElements.asn" * `asn1c -fcompound-names -fnative-types` */ #include "SysInfoType13-v3a0ext-IEs.h" static asn_TYPE_member_t asn_MBR_SysInfoType13_v3a0ext_IEs_1[] = { { ATF_NOFLAGS, 0, offsetof(struct SysInfoType13_v3a0ext_IEs, ue_IdleTimersAndConstants_v3a0ext), (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_UE_IdleTimersAndConstants_v3a0ext, 0, /* Defer constraints checking to the member type */ 0, /* No PER visible constraints */ 0, "ue-IdleTimersAndConstants-v3a0ext" }, }; static ber_tlv_tag_t asn_DEF_SysInfoType13_v3a0ext_IEs_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_TYPE_tag2member_t asn_MAP_SysInfoType13_v3a0ext_IEs_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* ue-IdleTimersAndConstants-v3a0ext at 21403 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SysInfoType13_v3a0ext_IEs_specs_1 = { sizeof(struct SysInfoType13_v3a0ext_IEs), offsetof(struct SysInfoType13_v3a0ext_IEs, _asn_ctx), asn_MAP_SysInfoType13_v3a0ext_IEs_tag2el_1, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SysInfoType13_v3a0ext_IEs = { "SysInfoType13-v3a0ext-IEs", "SysInfoType13-v3a0ext-IEs", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_SysInfoType13_v3a0ext_IEs_tags_1, sizeof(asn_DEF_SysInfoType13_v3a0ext_IEs_tags_1) /sizeof(asn_DEF_SysInfoType13_v3a0ext_IEs_tags_1[0]), /* 1 */ asn_DEF_SysInfoType13_v3a0ext_IEs_tags_1, /* Same as above */ sizeof(asn_DEF_SysInfoType13_v3a0ext_IEs_tags_1) /sizeof(asn_DEF_SysInfoType13_v3a0ext_IEs_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SysInfoType13_v3a0ext_IEs_1, 1, /* Elements count */ &asn_SPC_SysInfoType13_v3a0ext_IEs_specs_1 /* Additional specs */ };
// Copyright (C) 2004-2021 Artifex Software, Inc. // // This file is part of MuPDF. // // MuPDF is free software: you can redistribute it and/or modify it under the // terms of the GNU Affero General Public License as published by the Free // Software Foundation, either version 3 of the License, or (at your option) // any later version. // // MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more // details. // // You should have received a copy of the GNU Affero General Public License // along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html> // // Alternative licensing terms are available from the licensor. // For commercial licensing, see <https://www.artifex.com/> or contact // Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, // CA 94945, U.S.A., +1(415)492-9861, for further information. #ifndef MUPDF_PDF_CRYPT_H #define MUPDF_PDF_CRYPT_H enum { PDF_ENCRYPT_KEEP, PDF_ENCRYPT_NONE, PDF_ENCRYPT_RC4_40, PDF_ENCRYPT_RC4_128, PDF_ENCRYPT_AES_128, PDF_ENCRYPT_AES_256, PDF_ENCRYPT_UNKNOWN }; /* Create crypt object for decrypting strings and streams given the Encryption and ID objects. */ pdf_crypt *pdf_new_crypt(fz_context *ctx, pdf_obj *enc, pdf_obj *id); pdf_crypt *pdf_new_encrypt(fz_context *ctx, const char *opwd_utf8, const char *upwd_utf8, pdf_obj *id, int permissions, int algorithm); void pdf_drop_crypt(fz_context *ctx, pdf_crypt *crypt); void pdf_crypt_obj(fz_context *ctx, pdf_crypt *crypt, pdf_obj *obj, int num, int gen); fz_stream *pdf_open_crypt(fz_context *ctx, fz_stream *chain, pdf_crypt *crypt, int num, int gen); fz_stream *pdf_open_crypt_with_filter(fz_context *ctx, fz_stream *chain, pdf_crypt *crypt, pdf_obj *name, int num, int gen); int pdf_crypt_version(fz_context *ctx, pdf_crypt *crypt); int pdf_crypt_revision(fz_context *ctx, pdf_crypt *crypt); char *pdf_crypt_method(fz_context *ctx, pdf_crypt *crypt); int pdf_crypt_length(fz_context *ctx, pdf_crypt *crypt); int pdf_crypt_permissions(fz_context *ctx, pdf_crypt *crypt); int pdf_crypt_encrypt_metadata(fz_context *ctx, pdf_crypt *crypt); unsigned char *pdf_crypt_owner_password(fz_context *ctx, pdf_crypt *crypt); unsigned char *pdf_crypt_user_password(fz_context *ctx, pdf_crypt *crypt); unsigned char *pdf_crypt_owner_encryption(fz_context *ctx, pdf_crypt *crypt); unsigned char *pdf_crypt_user_encryption(fz_context *ctx, pdf_crypt *crypt); unsigned char *pdf_crypt_permissions_encryption(fz_context *ctx, pdf_crypt *crypt); unsigned char *pdf_crypt_key(fz_context *ctx, pdf_crypt *crypt); void pdf_print_crypt(fz_context *ctx, fz_output *out, pdf_crypt *crypt); void pdf_write_digest(fz_context *ctx, fz_output *out, pdf_obj *byte_range, pdf_obj *field, size_t digest_offset, size_t digest_length, pdf_pkcs7_signer *signer); /* User access permissions from PDF reference. */ enum { PDF_PERM_PRINT = 1 << 2, PDF_PERM_MODIFY = 1 << 3, PDF_PERM_COPY = 1 << 4, PDF_PERM_ANNOTATE = 1 << 5, PDF_PERM_FORM = 1 << 8, PDF_PERM_ACCESSIBILITY = 1 << 9, /* deprecated in pdf 2.0 (this permission is always granted) */ PDF_PERM_ASSEMBLE = 1 << 10, PDF_PERM_PRINT_HQ = 1 << 11, }; int pdf_document_permissions(fz_context *ctx, pdf_document *doc); int pdf_signature_byte_range(fz_context *ctx, pdf_document *doc, pdf_obj *signature, fz_range *byte_range); /* retrieve an fz_stream to read the bytes hashed for the signature */ fz_stream *pdf_signature_hash_bytes(fz_context *ctx, pdf_document *doc, pdf_obj *signature); int pdf_signature_incremental_change_since_signing(fz_context *ctx, pdf_document *doc, pdf_obj *signature); /* Retrieve the contents of a signature as a counted allocated block that must be freed by the caller. */ size_t pdf_signature_contents(fz_context *ctx, pdf_document *doc, pdf_obj *signature, char **contents); void pdf_encrypt_data(fz_context *ctx, pdf_crypt *crypt, int num, int gen, void (*fmt_str_out)(fz_context *, void *, const unsigned char *, size_t), void *arg, const unsigned char *s, size_t n); size_t pdf_encrypted_len(fz_context *ctx, pdf_crypt *crypt, int num, int gen, size_t len); #endif
/*************************************************************************** addconstraintteachermaxbuildingchangesperweekform.h - description ------------------- begin : Feb 10, 2005 copyright : (C) 2005 by Lalescu Liviu email : Please see http://lalescu.ro/liviu/ for details about contacting Liviu Lalescu (in particular, you can find here the e-mail address) ***************************************************************************/ /*************************************************************************** * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU Affero General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * ***************************************************************************/ #ifndef ADDCONSTRAINTTEACHERMAXBUILDINGCHANGESPERWEEKFORM_H #define ADDCONSTRAINTTEACHERMAXBUILDINGCHANGESPERWEEKFORM_H #include "ui_addconstraintteachermaxbuildingchangesperweekform_template.h" #include "timetable_defs.h" #include "timetable.h" #include "fet.h" class AddConstraintTeacherMaxBuildingChangesPerWeekForm : public QDialog, Ui::AddConstraintTeacherMaxBuildingChangesPerWeekForm_template { Q_OBJECT public: AddConstraintTeacherMaxBuildingChangesPerWeekForm(QWidget* parent); ~AddConstraintTeacherMaxBuildingChangesPerWeekForm(); void updateTeachersComboBox(); public slots: void constraintChanged(); void addCurrentConstraint(); }; #endif
/* * This file is part of Cockpit. * * Copyright (C) 2015 Red Hat, Inc. * * Cockpit 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. * * Cockpit 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 Cockpit; If not, see <http://www.gnu.org/licenses/>. */ #ifndef __COCKPIT_SSH_AGENT_H__ #define __COCKPIT_SSH_AGENT_H__ #include <glib.h> #include <glib-object.h> #include "common/cockpittransport.h" G_BEGIN_DECLS #define COCKPIT_TYPE_SSH_AGENT (cockpit_ssh_agent_get_type ()) typedef struct _CockpitSshAgent CockpitSshAgent; typedef struct _CockpitSshAgentClass CockpitSshAgentClass; GType cockpit_ssh_agent_get_type (void) G_GNUC_CONST; CockpitSshAgent * cockpit_ssh_agent_new (CockpitTransport *transport, const gchar *logname, const gchar *channel_id); void cockpit_ssh_agent_close (CockpitSshAgent *agent); int cockpit_ssh_agent_steal_fd (CockpitSshAgent *agent); G_END_DECLS #endif
/* OpenLieroX input (keyboard, mouse, ...) events and related stuff code under LGPL created 01-05-2007 by Albert Zeyer and Dark Charlie */ #ifndef __INPUTEVENTS_H__ #define __INPUTEVENTS_H__ #include <vector> #include <SDL.h> #include "Unicode.h" #include "Event.h" #include "EventQueue.h" // application has focus // These vars are like events, they got true once in a frame when the specific event occured. // TODO: remove them extern bool bActivated; extern bool bDeactivated; #define MAX_KEYQUEUE 256 #define MAX_MOUSEBUTTONS 8 // SDL_GetMouseState returns UInt8 bitmask // State of modifier keys (ctrl, alt and shift) struct ModifiersState { ModifiersState() { clear(); } void clear() { bShift = bCtrl = bAlt = bGui = false; } bool bShift; bool bCtrl; bool bAlt; bool bGui; }; struct KeyboardEvent { SDL_Keycode sym; UnicodeChar ch; bool down; ModifiersState state; KeyboardEvent() : sym(0), ch(0), down(false) {} }; // Keyboard structure struct keyboard_t { int queueLength; KeyboardEvent keyQueue[MAX_KEYQUEUE]; }; // Mouse structure struct mouse_t { int X,Y; int deltaX,deltaY; int Button; // HINT: the following three variables cannot be bool // because they contain info about the pressed button (left, right, ...) // as well // TODO: change this immediatly int Up; int Down; int FirstDown; bool WheelScrollUp; bool WheelScrollDown; }; enum MouseButton { mbLeft, mbRight, mbMiddle, mbExtra1, mbExtra2 }; MouseButton SDLButtonToMouseButton(int sdlbut); MouseButton SDLButtonStateToMouseButton(int sdlbut); typedef Event<SDL_Event*> SDLEvent; // All main SDL events. You can add your own global handlers here. Though that should // not be needed in most cases. // If you want to add a user event, DON'T add the handler here. Use SendSDLUserEvent() // and your event will get called automatically. extern std::map<SDL_EventType, SDLEvent> sdlEvents; extern bool processedEvent; void InitEventSystem(); void ShutdownEventSystem(); void ProcessEvents(); // returns false if no new event bool EventSystemInited(); bool IsWaitingForEvent(); void WakeupIfNeeded(); keyboard_t *GetKeyboard(); mouse_t *GetMouse(); SDL_Event *GetEvent(); ModifiersState *GetCurrentModstate(); bool WasKeyboardEventHappening(SDL_Keycode key, bool down = true); class CInput; void RegisterCInput(CInput* input); void UnregisterCInput(CInput* input); bool ApplicationHasFocus(); extern Event<> onDummyEvent; #endif
/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** ** ** GNU Lesser General Public License Usage ** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this file. ** Please review the following information to ensure the GNU Lesser General ** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** Other Usage ** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** **************************************************************************/ #ifndef TASKFILEFACTORY_H #define TASKFILEFACTORY_H #include <coreplugin/ifilefactory.h> #include <coreplugin/ifile.h> #include <QtCore/QStringList> namespace ProjectExplorer { class Project; } // namespace ProjectExplorer namespace TaskList { namespace Internal { class TaskFileFactory : public Core::IFileFactory { Q_OBJECT public: TaskFileFactory(QObject *parent = 0); ~TaskFileFactory(); QStringList mimeTypes() const; QString id() const; QString displayName() const; Core::IFile *open(const QString &fileName); Core::IFile *open(ProjectExplorer::Project *context, const QString &fileName); void closeAllFiles(); private: QStringList m_mimeTypes; QList<Core::IFile *> m_openFiles; }; } // namespace Internal } // namespace TaskList #endif // TASKFILEFACTORY_H
/* KNode, the KDE newsreader Copyright (c) 1999-2005 the KNode authors. See file AUTHORS for details 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. 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, US */ #ifndef KNHDRVIEWITEM_H #define KNHDRVIEWITEM_H #include <k3listview.h> #include "headerview.h" class KNArticle; class KNHeaderView; /** Header view item. */ class KNHdrViewItem : public K3ListViewItem { public: KNHdrViewItem( KNHeaderView *ref, KNArticle *a = 0 ); KNHdrViewItem( KNHdrViewItem *ref, KNArticle *a = 0 ); ~KNHdrViewItem(); virtual int compare(Q3ListViewItem *i, int col, bool ascending) const; void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment); int width(const QFontMetrics &fm, const Q3ListView *lv, int column) const; virtual QString text( int col ) const; void expandChildren(); void setActive( bool b ) { mActive = b; } bool isActive() const { return mActive; } // DND Q3DragObject* dragObject(); KNArticle *art; int countUnreadInThread(); bool showToolTip( int column ) const { return mShowToolTip[column]; } private: void init( KNArticle *a ); bool greyOut(); bool firstColBold(); QColor normalColor(); QColor greyColor(); bool mActive; bool mShowToolTip[5]; // ### hardcoded column count :-( }; #endif
/* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * RpcHeader.h * The header for the RPC messages. * Copyright (C) 2005 Simon Newton */ #ifndef COMMON_RPC_RPCHEADER_H_ #define COMMON_RPC_RPCHEADER_H_ #include <stdint.h> namespace ola { namespace rpc { class RpcHeader { /* * The first 4 bytes are the header which contains the RPC protocol version * (this is separate from the protobuf version) and the size of the protobuf. */ public: /** * Encode a header */ static void EncodeHeader(uint32_t *header, unsigned int version, unsigned int size) { *header = (version << 28) & VERSION_MASK; *header |= size & SIZE_MASK; } /** * Decode a header */ static void DecodeHeader(uint32_t header, unsigned int *version, unsigned int *size) { *version = (header & VERSION_MASK) >> 28; *size = header & SIZE_MASK; } private: static const unsigned int VERSION_MASK = 0xf0000000; static const unsigned int SIZE_MASK = 0x0fffffff; }; } // namespace rpc } // namespace ola #endif // COMMON_RPC_RPCHEADER_H_
/* GStreamer * Copyright (C) <2007> Thijs Vermeir <thijsvermeir@gmail.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __GST_RTP_MPV_PAY_H__ #define __GST_RTP_MPV_PAY_H__ #include <gst/gst.h> #include <gst/rtp/gstrtpbasepayload.h> #include <gst/base/gstadapter.h> G_BEGIN_DECLS typedef struct _GstRTPMPVPay GstRTPMPVPay; typedef struct _GstRTPMPVPayClass GstRTPMPVPayClass; #define GST_TYPE_RTP_MPV_PAY \ (gst_rtp_mpv_pay_get_type()) #define GST_RTP_MPV_PAY(obj) \ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MPV_PAY,GstRTPMPVPay)) #define GST_RTP_MPV_PAY_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MPV_PAY,GstRTPMPVPayClass)) #define GST_IS_RTP_MPV_PAY(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MPV_PAY)) #define GST_IS_RTP_MPV_PAY_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MPV_PAY)) struct _GstRTPMPVPay { GstRTPBasePayload payload; GstAdapter *adapter; GstClockTime first_ts; GstClockTime duration; }; struct _GstRTPMPVPayClass { GstRTPBasePayloadClass parent_class; }; GType gst_rtp_mpv_pay_get_type (void); gboolean gst_rtp_mpv_pay_plugin_init (GstPlugin * plugin); G_END_DECLS #endif /* __GST_RTP_MPV_PAY_H__ */
/****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * * (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the Free * * Software Foundation; either version 2 of the License, or (at your option) * * any later version. * * * * This program is distributed in the hope that it will be useful, but WITHOUT * * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * * more details. * * * * You should have received a copy of the GNU General Public License along * * with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************* * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ #ifndef SOFA_GUI_SOFAGUI_H #define SOFA_GUI_SOFAGUI_H #include <sofa/helper/system/config.h> #ifdef SOFA_BUILD_SOFAGUI # define SOFA_SOFAGUI_API SOFA_EXPORT_DYNAMIC_LIBRARY #else # define SOFA_SOFAGUI_API SOFA_IMPORT_DYNAMIC_LIBRARY #endif #endif
//* This file is part of the MOOSE framework //* https://www.mooseframework.org //* //* All rights reserved, see COPYRIGHT for full restrictions //* https://github.com/idaholab/moose/blob/master/COPYRIGHT //* //* Licensed under LGPL 2.1, please see LICENSE for details //* https://www.gnu.org/licenses/lgpl-2.1.html #pragma once #include "InitialCondition.h" // Forward Declarations /** * MultiBoundingBoxIC allows setting the initial condition of a value of a field inside and outside * multiple bounding boxes. Each box is axis-aligned and is specified by passing in the x,y,z * coordinates of opposite corners. Separate values for each box may be supplied. */ class MultiBoundingBoxIC : public InitialCondition { public: static InputParameters validParams(); MultiBoundingBoxIC(const InputParameters & parameters); virtual Real value(const Point & p) override; protected: ///@{ lists of opposite corners const std::vector<Point> _c1; const std::vector<Point> _c2; ///@} /// number of boxes const unsigned int _nbox; /// dimensionality of the mesh const unsigned int _dim; /// values inside the boxes const std::vector<Real> _inside; /// values outside the boxes const Real _outside; };
/* radare - LGPL - Copyright 2015 - pancake, nibble */ #include <r_anal.h> typedef void (*RAnalEsilPin)(RAnal *a); #if 0 // TODO: those hardcoded functions should go /* default pins from libc */ static void pin_strlen(RAnal *a) { // get a0 register // read memory and interpret it as a string // set a0 to the result of strlen; eprintf ("esilpin: strlen\n"); } static void pin_write(RAnal *a) { // get a0 register for fd // get a1 register for data // get a2 register for len // read len bytes from data and print them to screen + fd // set a0 to the result of write; eprintf ("esilpin: write\n"); } #endif /* pin api */ #define DB a->sdb_pins R_API void r_anal_pin_init(RAnal *a) { sdb_free (DB); DB = sdb_new0(); // sdb_ptr_set (DB, "strlen", pin_strlen, 0); // sdb_ptr_set (DB, "write", pin_write, 0); } R_API void r_anal_pin_fini(RAnal *a) { if (sdb_free (DB)) { DB = NULL; } } R_API void r_anal_pin(RAnal *a, ut64 addr, const char *name) { char buf[64]; const char *key = sdb_itoa (addr, buf, 16); sdb_set (DB, key, name, 0); } R_API void r_anal_pin_unset(RAnal *a, ut64 addr) { char buf[64]; const char *key = sdb_itoa (addr, buf, 16); sdb_unset (DB, key, 0); } R_API const char *r_anal_pin_call(RAnal *a, ut64 addr) { char buf[64]; const char *key = sdb_itoa (addr, buf, 16); if (key) { return sdb_const_get (DB, key, NULL); #if 0 const char *name; if (name) { RAnalEsilPin fcnptr = (RAnalEsilPin) sdb_ptr_get (DB, name, NULL); if (fcnptr) { fcnptr (a); return true; } } #endif } return NULL; } static bool cb_list(void *user, const char *k, const char *v) { RAnal *a = (RAnal*)user; if (*k == '0') { // bind a->cb_printf ("%s = %s\n", k, v); } else { // ptr a->cb_printf ("PIN %s\n", k); } return true; } R_API void r_anal_pin_list(RAnal *a) { sdb_foreach (DB, cb_list, a); }
/* This file is an image processing operation for GEGL * * GEGL is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * GEGL 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 GEGL; if not, see <http://www.gnu.org/licenses/>. * * Copyright 2010 Michael Muré <batolettre@gmail.com> * */ #ifdef GEGL_PROPERTIES property_enum (sampler_type, _("Resampling method"), GeglSamplerType, gegl_sampler_type, GEGL_SAMPLER_CUBIC) #else #define GEGL_OP_COMPOSER #define GEGL_OP_C_SOURCE map-absolute.c #include "config.h" #include <glib/gi18n-lib.h> #include "gegl-op.h" static void prepare (GeglOperation *operation) { const Babl *format = babl_format ("RGBA float"); gegl_operation_set_format (operation, "input", format); gegl_operation_set_format (operation, "aux", babl_format_n (babl_type ("float"), 2)); gegl_operation_set_format (operation, "output", format); } static GeglRectangle get_required_for_output (GeglOperation *operation, const gchar *input_pad, const GeglRectangle *region) { GeglRectangle result = *gegl_operation_source_get_bounding_box (operation, "input"); return result; } static gboolean process (GeglOperation *operation, GeglBuffer *input, GeglBuffer *aux, GeglBuffer *output, const GeglRectangle *result, gint level) { GeglProperties *o = GEGL_PROPERTIES (operation); const Babl *format_io, *format_coords; GeglSampler *sampler; GeglBufferIterator *it; gint index_in, index_out, index_coords; format_io = babl_format ("RGBA float"); format_coords = babl_format_n (babl_type ("float"), 2); sampler = gegl_buffer_sampler_new_at_level (input, format_io, o->sampler_type, level); if (aux != NULL) { it = gegl_buffer_iterator_new (output, result, level, format_io, GEGL_ACCESS_WRITE, GEGL_ABYSS_NONE); index_out = 0; index_coords = gegl_buffer_iterator_add (it, aux, result, level, format_coords, GEGL_ACCESS_READ, GEGL_ABYSS_NONE); index_in = gegl_buffer_iterator_add (it, input, result, level, format_io, GEGL_ACCESS_READ, GEGL_ABYSS_NONE); while (gegl_buffer_iterator_next (it)) { gint i; gint n_pixels = it->length; gint x = it->roi->x; /* initial x */ gint y = it->roi->y; /* and y coordinates */ gfloat *in = it->data[index_in]; gfloat *out = it->data[index_out]; gfloat *coords = it->data[index_coords]; for (i=0; i<n_pixels; i++) { /* if the coordinate asked is an exact pixel, we fetch it directly, to avoid the blur of sampling */ if (coords[0] == x && coords[1] == y) { out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; out[3] = in[3]; } else { gegl_sampler_get (sampler, coords[0], coords[1], NULL, out, GEGL_ABYSS_NONE); } coords += 2; in += 4; out += 4; /* update x and y coordinates */ x++; if (x >= (it->roi->x + it->roi->width)) { x = it->roi->x; y++; } } } } else { gegl_buffer_copy (input, result, GEGL_ABYSS_NONE, output, result); } g_object_unref (sampler); return TRUE; } static void gegl_op_class_init (GeglOpClass *klass) { GeglOperationClass *operation_class; GeglOperationComposerClass *composer_class; operation_class = GEGL_OPERATION_CLASS (klass); composer_class = GEGL_OPERATION_COMPOSER_CLASS (klass); composer_class->process = process; operation_class->prepare = prepare; operation_class->get_required_for_output = get_required_for_output; gegl_operation_class_set_keys (operation_class, "name", "gegl:map-absolute", "title", _("Map Absolute"), "categories", "map", "position-dependent", "true", "description", _("sample input with an auxiliary buffer that contain absolute source coordinates"), NULL); } #endif
#ifndef CVPOINT3D64F_NAME #include "opencv2/opencv.hpp" #include "opencv2/legacy/legacy.hpp" #include "opencv2/legacy/compat.hpp" #include "luacvaux.h" #define CVPOINT3D64F_NAME "CvPoint3D64f" #define checkCvPoint3D64f(L,i) luacv_checkObject<CvPoint3D64f>(L,i,CVPOINT3D64F_NAME) #define pushCvPoint3D64f(L,data) luacv_pushObject<CvPoint3D64f>(L,data,CVPOINT3D64F_NAME,true) extern const struct luaL_Reg CvPoint3D64f_m[]; #endif
/* wiring_private.h - Internal header file. Part of Arduino - http://www.arduino.cc/ Copyright (c) 2005-2006 David A. Mellis This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $ */ #ifndef WiringPrivate_h #define WiringPrivate_h #include <avr/io.h> #include <avr/interrupt.h> #include <util/delay.h> #include <stdio.h> #include <stdarg.h> #ifdef __cplusplus extern "C"{ #endif #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) #endif #ifndef sbi #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) #endif #define EXTERNAL_INT_0 0 #define EXTERNAL_INT_1 1 #define EXTERNAL_NUM_INTERRUPTS 2 typedef void (*voidFuncPtr)(void); #ifdef __cplusplus } // extern "C" #endif #endif
/***************************************************************************//** * @file em_cryotimer.c * @brief Ultra Low Energy Timer/Counter (CRYOTIMER) peripheral API * @version 5.6.0 ******************************************************************************* * # License * <b>Copyright 2016 Silicon Laboratories, Inc. www.silabs.com</b> ******************************************************************************* * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software.@n * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software.@n * 3. This notice may not be removed or altered from any source distribution. * * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no * obligation to support this Software. Silicon Labs is providing the * Software "AS IS", with no express or implied warranties of any kind, * including, but not limited to, any implied warranties of merchantability * or fitness for any particular purpose or warranties against infringement * of any proprietary rights of a third party. * * Silicon Labs will not be liable for any consequential, incidental, or * special damages, or any other relief, or for any claim by any third party, * arising from your use of this Software. * ******************************************************************************/ #include "em_cryotimer.h" #include "em_bus.h" #if defined(CRYOTIMER_PRESENT) && (CRYOTIMER_COUNT == 1) /***************************************************************************//** * @brief * Initialize the CRYOTIMER. * * @details * Use this function to initialize the CRYOTIMER. * Select a prescaler setting and select a low-frequency oscillator. * See the configuration structure @ref CRYOTIMER_Init_TypeDef for more * details. * * @param[in] init * A pointer to the initialization structure. ******************************************************************************/ void CRYOTIMER_Init(const CRYOTIMER_Init_TypeDef *init) { CRYOTIMER->PERIODSEL = (uint32_t)init->period & _CRYOTIMER_PERIODSEL_MASK; CRYOTIMER->CTRL = ((init->enable ? 1UL : 0UL) << _CRYOTIMER_CTRL_EN_SHIFT) | ((init->debugRun ? 1UL : 0UL) << _CRYOTIMER_CTRL_DEBUGRUN_SHIFT) | ((uint32_t)init->osc << _CRYOTIMER_CTRL_OSCSEL_SHIFT) | ((uint32_t)init->presc << _CRYOTIMER_CTRL_PRESC_SHIFT); CRYOTIMER_EM4WakeupEnable(init->em4Wakeup); } #endif /* defined(CRYOTIMER_PRESENT) && (CRYOTIMER_COUNT > 0) */
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/alexaforbusiness/AlexaForBusiness_EXPORTS.h> #include <aws/core/AmazonSerializableWebServiceRequest.h> #include <aws/core/utils/UnreferencedParam.h> #include <aws/core/http/HttpRequest.h> namespace Aws { namespace AlexaForBusiness { class AWS_ALEXAFORBUSINESS_API AlexaForBusinessRequest : public Aws::AmazonSerializableWebServiceRequest { public: virtual ~AlexaForBusinessRequest () {} void AddParametersToRequest(Aws::Http::HttpRequest& httpRequest) const { AWS_UNREFERENCED_PARAM(httpRequest); } inline Aws::Http::HeaderValueCollection GetHeaders() const override { auto headers = GetRequestSpecificHeaders(); if(headers.size() == 0 || (headers.size() > 0 && headers.count(Aws::Http::CONTENT_TYPE_HEADER) == 0)) { headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, Aws::AMZN_JSON_CONTENT_TYPE_1_1 )); } headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::API_VERSION_HEADER, "2017-11-09")); return headers; } protected: virtual Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const { return Aws::Http::HeaderValueCollection(); } }; } // namespace AlexaForBusiness } // namespace Aws
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/worklink/WorkLink_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/core/utils/DateTime.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace WorkLink { namespace Model { /** * <p>The summary of the certificate authority (CA).</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/worklink-2018-09-25/WebsiteCaSummary">AWS * API Reference</a></p> */ class AWS_WORKLINK_API WebsiteCaSummary { public: WebsiteCaSummary(); WebsiteCaSummary(Aws::Utils::Json::JsonView jsonValue); WebsiteCaSummary& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>A unique identifier for the CA.</p> */ inline const Aws::String& GetWebsiteCaId() const{ return m_websiteCaId; } /** * <p>A unique identifier for the CA.</p> */ inline bool WebsiteCaIdHasBeenSet() const { return m_websiteCaIdHasBeenSet; } /** * <p>A unique identifier for the CA.</p> */ inline void SetWebsiteCaId(const Aws::String& value) { m_websiteCaIdHasBeenSet = true; m_websiteCaId = value; } /** * <p>A unique identifier for the CA.</p> */ inline void SetWebsiteCaId(Aws::String&& value) { m_websiteCaIdHasBeenSet = true; m_websiteCaId = std::move(value); } /** * <p>A unique identifier for the CA.</p> */ inline void SetWebsiteCaId(const char* value) { m_websiteCaIdHasBeenSet = true; m_websiteCaId.assign(value); } /** * <p>A unique identifier for the CA.</p> */ inline WebsiteCaSummary& WithWebsiteCaId(const Aws::String& value) { SetWebsiteCaId(value); return *this;} /** * <p>A unique identifier for the CA.</p> */ inline WebsiteCaSummary& WithWebsiteCaId(Aws::String&& value) { SetWebsiteCaId(std::move(value)); return *this;} /** * <p>A unique identifier for the CA.</p> */ inline WebsiteCaSummary& WithWebsiteCaId(const char* value) { SetWebsiteCaId(value); return *this;} /** * <p>The time when the CA was added.</p> */ inline const Aws::Utils::DateTime& GetCreatedTime() const{ return m_createdTime; } /** * <p>The time when the CA was added.</p> */ inline bool CreatedTimeHasBeenSet() const { return m_createdTimeHasBeenSet; } /** * <p>The time when the CA was added.</p> */ inline void SetCreatedTime(const Aws::Utils::DateTime& value) { m_createdTimeHasBeenSet = true; m_createdTime = value; } /** * <p>The time when the CA was added.</p> */ inline void SetCreatedTime(Aws::Utils::DateTime&& value) { m_createdTimeHasBeenSet = true; m_createdTime = std::move(value); } /** * <p>The time when the CA was added.</p> */ inline WebsiteCaSummary& WithCreatedTime(const Aws::Utils::DateTime& value) { SetCreatedTime(value); return *this;} /** * <p>The time when the CA was added.</p> */ inline WebsiteCaSummary& WithCreatedTime(Aws::Utils::DateTime&& value) { SetCreatedTime(std::move(value)); return *this;} /** * <p>The name to display.</p> */ inline const Aws::String& GetDisplayName() const{ return m_displayName; } /** * <p>The name to display.</p> */ inline bool DisplayNameHasBeenSet() const { return m_displayNameHasBeenSet; } /** * <p>The name to display.</p> */ inline void SetDisplayName(const Aws::String& value) { m_displayNameHasBeenSet = true; m_displayName = value; } /** * <p>The name to display.</p> */ inline void SetDisplayName(Aws::String&& value) { m_displayNameHasBeenSet = true; m_displayName = std::move(value); } /** * <p>The name to display.</p> */ inline void SetDisplayName(const char* value) { m_displayNameHasBeenSet = true; m_displayName.assign(value); } /** * <p>The name to display.</p> */ inline WebsiteCaSummary& WithDisplayName(const Aws::String& value) { SetDisplayName(value); return *this;} /** * <p>The name to display.</p> */ inline WebsiteCaSummary& WithDisplayName(Aws::String&& value) { SetDisplayName(std::move(value)); return *this;} /** * <p>The name to display.</p> */ inline WebsiteCaSummary& WithDisplayName(const char* value) { SetDisplayName(value); return *this;} private: Aws::String m_websiteCaId; bool m_websiteCaIdHasBeenSet; Aws::Utils::DateTime m_createdTime; bool m_createdTimeHasBeenSet; Aws::String m_displayName; bool m_displayNameHasBeenSet; }; } // namespace Model } // namespace WorkLink } // namespace Aws
/*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef itkPointSetFunction_h #define itkPointSetFunction_h #include "itkFunctionBase.h" #include "itkPoint.h" namespace itk { /** \class PointSetFunction * \brief Evaluates a function of an image at specified position. * * FIXME: Documentation was copy-pasted from ImageFunction. * * PointSetFunction is a baseclass for all objects that evaluates * a function of an image at index, continuous index or point. * This class is templated over the input image type, the type * of the function output and the coordinate representation type * (e.g. float or double). * * The input image is set via method SetInputPointSet(). * Methods Evaluate, EvaluateAtIndex and EvaluateAtContinuousIndex * respectively evaluates the function at an geometric point, * image index and continuous image index. * * \warning Image BufferedRegion information is cached during * in SetInputPointSet( image ). If the image BufferedRegion has changed * one must call SetInputPointSet( image ) again to update the cache * to the current values. * * \sa Point * \sa Index * \sa ContinuousIndex * * \ingroup ITKMetricsv4 */ template < typename TInputPointSet, typename TOutput, typename TCoordRep = float > class ITK_TEMPLATE_EXPORT PointSetFunction : public FunctionBase<typename TInputPointSet::PointType, TOutput> { public: ITK_DISALLOW_COPY_AND_ASSIGN(PointSetFunction); /** Dimension underlying input point set. */ static constexpr unsigned int Dimension = TInputPointSet::PointDimension; /** Standard class type aliases. */ using Self = PointSetFunction; using Superclass = FunctionBase <typename TInputPointSet::PointType, TOutput>; using Pointer = SmartPointer<Self>; using ConstPointer = SmartPointer<const Self>; /** Run-time type information (and related methods). */ itkTypeMacro( PointSetFunction, FunctionBase ); /** InputPointSetType type alias support */ using InputPointSetType = TInputPointSet; /** InputPixel type alias support */ using InputPointType = typename InputPointSetType::PointType; using InputPixelType = typename InputPointSetType::PixelType; /** InputPointSetPointer type alias support */ using InputPointSetConstPointer = typename InputPointSetType::ConstPointer; /** OutputType type alias support */ using OutputType = TOutput; /** CoordRepType type alias support */ using CoordRepType = TCoordRep; /** Set the input point set. * \warning this method caches BufferedRegion information. * If the BufferedRegion has changed, user must call * SetInputPointSet again to update cached values. */ virtual void SetInputPointSet( const InputPointSetType * ptr ); /** Get the input image. */ const InputPointSetType * GetInputPointSet() const { return m_PointSet.GetPointer(); } /** Evaluate the function at specified Point position. * Subclasses must provide this method. */ TOutput Evaluate( const InputPointType& point ) const override = 0; protected: PointSetFunction(); ~PointSetFunction() override; void PrintSelf(std::ostream& os, Indent indent) const override; /** Const pointer to the input image. */ InputPointSetConstPointer m_PointSet; }; } // end namespace itk // Define instantiation macro for this template. #define ITK_TEMPLATE_PointSetFunction(_, EXPORT, x, y) namespace itk { \ _(3(class EXPORT PointSetFunction< ITK_TEMPLATE_3 x >)) \ namespace Templates { using PointSetFunction##y = PointSetFunction< ITK_TEMPLATE_3 x >; } \ } #ifndef ITK_MANUAL_INSTANTIATION # include "itkPointSetFunction.hxx" #endif #endif
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/resource-groups/ResourceGroups_EXPORTS.h> #include <aws/resource-groups/model/Group.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace ResourceGroups { namespace Model { class AWS_RESOURCEGROUPS_API UpdateGroupResult { public: UpdateGroupResult(); UpdateGroupResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); UpdateGroupResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>The update description of the resource group.</p> */ inline const Group& GetGroup() const{ return m_group; } /** * <p>The update description of the resource group.</p> */ inline void SetGroup(const Group& value) { m_group = value; } /** * <p>The update description of the resource group.</p> */ inline void SetGroup(Group&& value) { m_group = std::move(value); } /** * <p>The update description of the resource group.</p> */ inline UpdateGroupResult& WithGroup(const Group& value) { SetGroup(value); return *this;} /** * <p>The update description of the resource group.</p> */ inline UpdateGroupResult& WithGroup(Group&& value) { SetGroup(std::move(value)); return *this;} private: Group m_group; }; } // namespace Model } // namespace ResourceGroups } // namespace Aws
/* -------------------------------------------------------------------------- */ /* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); you may */ /* not use this file except in compliance with the License. You may obtain */ /* a copy of the License at */ /* */ /* http://www.apache.org/licenses/LICENSE-2.0 */ /* */ /* Unless required by applicable law or agreed to in writing, software */ /* distributed under the License is distributed on an "AS IS" BASIS, */ /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ /* See the License for the specific language governing permissions and */ /* limitations under the License. */ /* -------------------------------------------------------------------------- */ #ifndef POOL_OBJECT_AUTH_H_ #define POOL_OBJECT_AUTH_H_ #include "PoolObjectSQL.h" class AclRule; /** * This class abstracts the authorization attributes of a PoolObject. It is * used to check permissions and access rights of requests */ class PoolObjectAuth { public: /* ------------------- Constructor and Methods -------------------------- */ PoolObjectAuth(): oid(-1), uid(-1), gid(-1), owner_u(1), owner_m(1), owner_a(0), group_u(0), group_m(0), group_a(0), other_u(0), other_m(0), other_a(0) {}; void get_acl_rules(AclRule& owner_rule, AclRule& group_rule, AclRule& other_rule) const; string type_to_str() const { return PoolObjectSQL::type_to_str(obj_type); }; /* --------------------------- Attributes ------------------------------- */ PoolObjectSQL::ObjectType obj_type; int oid; int uid; int gid; int owner_u; int owner_m; int owner_a; int group_u; int group_m; int group_a; int other_u; int other_m; int other_a; }; #endif /*POOL_OBJECT_AUTH_H_*/
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/medialive/MediaLive_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> namespace Aws { namespace MediaLive { namespace Model { enum class Mpeg2ColorSpace { NOT_SET, AUTO, PASSTHROUGH }; namespace Mpeg2ColorSpaceMapper { AWS_MEDIALIVE_API Mpeg2ColorSpace GetMpeg2ColorSpaceForName(const Aws::String& name); AWS_MEDIALIVE_API Aws::String GetNameForMpeg2ColorSpace(Mpeg2ColorSpace value); } // namespace Mpeg2ColorSpaceMapper } // namespace Model } // namespace MediaLive } // namespace Aws
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/glue/Glue_EXPORTS.h> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace Glue { namespace Model { class AWS_GLUE_API CreateClassifierResult { public: CreateClassifierResult(); CreateClassifierResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); CreateClassifierResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); }; } // namespace Model } // namespace Glue } // namespace Aws
#include <stdio.h> #include "grib2.h" #define MAPSEC1LEN 13 g2int g2_create(unsigned char *cgrib,g2int *listsec0,g2int *listsec1) //$$$ SUBPROGRAM DOCUMENTATION BLOCK // . . . . // SUBPROGRAM: g2_create // PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-10-31 // // ABSTRACT: This routine initializes a new GRIB2 message and packs // GRIB2 sections 0 (Indicator Section) and 1 (Identification Section). // This routine is used with routines "g2_addlocal", "g2_addgrid", // "g2_addfield", and "g2_gribend" to create a complete GRIB2 message. // g2_create must be called first to initialize a new GRIB2 message. // Also, a call to g2_gribend is required to complete GRIB2 message // after all fields have been added. // // PROGRAM HISTORY LOG: // 2002-10-31 Gilbert // // USAGE: int g2_create(unsigned char *cgrib,g2int *listsec0,g2int *listsec1) // INPUT ARGUMENTS: // cgrib - Character array to contain the GRIB2 message // listsec0 - Contains information needed for GRIB Indicator Section 0. // Must be dimensioned >= 2. // listsec0[0]=Discipline-GRIB Master Table Number // (see Code Table 0.0) // listsec0[1]=GRIB Edition Number (currently 2) // listsec1 - Contains information needed for GRIB Identification Section 1. // Must be dimensioned >= 13. // listsec1[0]=Id of originating centre (Common Code Table C-1) // listsec1[1]=Id of originating sub-centre (local table) // listsec1[2]=GRIB Master Tables Version Number (Code Table 1.0) // listsec1[3]=GRIB Local Tables Version Number (Code Table 1.1) // listsec1[4]=Significance of Reference Time (Code Table 1.2) // listsec1[5]=Reference Time - Year (4 digits) // listsec1[6]=Reference Time - Month // listsec1[7]=Reference Time - Day // listsec1[8]=Reference Time - Hour // listsec1[9]=Reference Time - Minute // listsec1[10]=Reference Time - Second // listsec1[11]=Production status of data (Code Table 1.3) // listsec1[12]=Type of processed data (Code Table 1.4) // // OUTPUT ARGUMENTS: // cgrib - Char array to contain the new GRIB2 message. // Must be allocated large enough to store the entire // GRIB2 message. // // RETURN VALUES: // ierr - return code. // > 0 = Current size of new GRIB2 message // -1 = Tried to use for version other than GRIB Edition 2 // // REMARKS: This routine is intended for use with routines "g2_addlocal", // "g2_addgrid", "g2_addfield", and "g2_gribend" to create a complete // GRIB2 message. // // ATTRIBUTES: // LANGUAGE: C // MACHINE: // //$$$ { g2int zero=0,one=1; g2int mapsec1len=MAPSEC1LEN; g2int mapsec1[MAPSEC1LEN]={ 2,2,1,1,1,2,1,1,1,1,1,1,1 }; g2int i,lensec0,lensec1,iofst,ibeg,nbits,len; // // Currently handles only GRIB Edition 2. // if (listsec0[1] != 2) { printf("g2_create: can only code GRIB edition 2."); return (-1); } // // Pack Section 0 - Indicator Section // ( except for total length of GRIB message ) // cgrib[0]=0x47; // 'G' // Beginning of GRIB message cgrib[1]=0x52; // 'R' cgrib[2]=0x49; // 'I' cgrib[3]=0x42; // 'B' sbit(cgrib,&zero,32,16); // reserved for future use sbit(cgrib,listsec0+0,48,8); // Discipline sbit(cgrib,listsec0+1,56,8); // GRIB edition number lensec0=16; // bytes (octets) // // Pack Section 1 - Identification Section // ibeg=lensec0*8; // Calculate offset for beginning of section 1 iofst=ibeg+32; // leave space for length of section sbit(cgrib,&one,iofst,8); // Store section number ( 1 ) iofst=iofst+8; // // Pack up each input value in array listsec1 into the // the appropriate number of octets, which are specified in // corresponding entries in array mapsec1. // for (i=0;i<mapsec1len;i++) { nbits=mapsec1[i]*8; sbit(cgrib,listsec1+i,iofst,nbits); iofst=iofst+nbits; } // // Calculate length of section 1 and store it in octets // 1-4 of section 1. // lensec1=(iofst-ibeg)/8; sbit(cgrib,&lensec1,ibeg,32); // // Put current byte total of message into Section 0 // sbit(cgrib,&zero,64,32); len=lensec0+lensec1; sbit(cgrib,&len,96,32); return (len); }
/*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef itkImageShapeModelEstimatorBase_h #define itkImageShapeModelEstimatorBase_h #include "itkImageToImageFilter.h" namespace itk { /** \class ImageShapeModelEstimatorBase * \brief Base class for statistical shape model estimation. * * itkImageShapeModelEstimatorBase is the base class for the * ImageShapeModelEstimator objects. It provides the basic function * definitions that are inherent to a ImageShapeModelEstimator objects. * * This is the Superclass for the ImageShapeModelEstimator * framework. This is an abstract class defining an interface for all * such objects available through the ImageShapeModelEstimator * framework in the ITK toolkit. * * The basic functionality of the ImageShapeModelEstimator framework * base class is to generate the ShapeModels. It requires input image * to be provided by the user. EstimateShapeModels() is a pure virtual * function making this an abstract class. Classes deriving from this * class are required to implement the EstimateShapeModels function. * * \ingroup ImageFeatureExtraction * \ingroup ITKImageStatistics */ template< typename TInputImage, typename TOutputImage = Image< double, TInputImage::ImageDimension > > class ITK_TEMPLATE_EXPORT ImageShapeModelEstimatorBase: public ImageToImageFilter< TInputImage, TOutputImage > { public: ITK_DISALLOW_COPY_AND_ASSIGN(ImageShapeModelEstimatorBase); /** Standard class type aliases. */ using Self = ImageShapeModelEstimatorBase; using Superclass = ImageToImageFilter< TInputImage, TOutputImage >; using Pointer = SmartPointer< Self >; using ConstPointer = SmartPointer< const Self >; /** Run-time type information (and related methods). */ itkTypeMacro(ImageShapeModelEstimatorBase, ImageToImageFilter); /** Type definitions for the training image. */ using InputImageType = TInputImage; using InputImagePointer = typename TInputImage::Pointer; protected: ImageShapeModelEstimatorBase(); ~ImageShapeModelEstimatorBase() override; void PrintSelf(std::ostream & os, Indent indent) const override; void GenerateData() override; private: /**Container for holding the training image */ InputImagePointer m_InputImage; /** The core virtual function to perform ShapeModelling of the input data */ virtual void EstimateShapeModels() = 0; }; // class ImageShapeModelEstimator } // namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkImageShapeModelEstimatorBase.hxx" #endif #endif
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/mediaconvert/MediaConvert_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> namespace Aws { namespace MediaConvert { namespace Model { enum class CmafWriteDASHManifest { NOT_SET, DISABLED, ENABLED }; namespace CmafWriteDASHManifestMapper { AWS_MEDIACONVERT_API CmafWriteDASHManifest GetCmafWriteDASHManifestForName(const Aws::String& name); AWS_MEDIACONVERT_API Aws::String GetNameForCmafWriteDASHManifest(CmafWriteDASHManifest value); } // namespace CmafWriteDASHManifestMapper } // namespace Model } // namespace MediaConvert } // namespace Aws
// Copyright 2011 Software Freedom Conservancy // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef WEBDRIVER_IE_NEWSESSIONCOMMANDHANDLER_H_ #define WEBDRIVER_IE_NEWSESSIONCOMMANDHANDLER_H_ #include "../Alert.h" #include "../Browser.h" #include "../IECommandHandler.h" #include "../IECommandExecutor.h" #define IGNORE_PROTECTED_MODE_CAPABILITY "ignoreProtectedModeSettings" #define IGNORE_ZOOM_SETTING_CAPABILITY "ignoreZoomSetting" #define NATIVE_EVENTS_CAPABILITY "nativeEvents" #define INITIAL_BROWSER_URL_CAPABILITY "initialBrowserUrl" #define ELEMENT_SCROLL_BEHAVIOR_CAPABILITY "elementScrollBehavior" #define UNEXPECTED_ALERT_BEHAVIOR_CAPABILITY "unexpectedAlertBehaviour" #define ENABLE_PERSISTENT_HOVER_CAPABILITY "enablePersistentHover" #define ENABLE_ELEMENT_CACHE_CLEANUP_CAPABILITY "enableElementCacheCleanup" #define REQUIRE_WINDOW_FOCUS_CAPABILITY "requireWindowFocus" namespace webdriver { class NewSessionCommandHandler : public IECommandHandler { public: NewSessionCommandHandler(void) { } virtual ~NewSessionCommandHandler(void) { } protected: void ExecuteInternal(const IECommandExecutor& executor, const LocatorMap& locator_parameters, const ParametersMap& command_parameters, Response* response) { IECommandExecutor& mutable_executor = const_cast<IECommandExecutor&>(executor); ParametersMap::const_iterator it = command_parameters.find("desiredCapabilities"); if (it != command_parameters.end()) { Json::Value ignore_protected_mode_settings = it->second.get(IGNORE_PROTECTED_MODE_CAPABILITY, false); mutable_executor.set_ignore_protected_mode_settings(ignore_protected_mode_settings.asBool()); Json::Value ignore_zoom_setting = it->second.get(IGNORE_ZOOM_SETTING_CAPABILITY, false); mutable_executor.set_ignore_zoom_setting(ignore_zoom_setting.asBool()); Json::Value enable_native_events = it->second.get(NATIVE_EVENTS_CAPABILITY, true); mutable_executor.input_manager()->set_enable_native_events(enable_native_events.asBool()); Json::Value initial_url = it->second.get(INITIAL_BROWSER_URL_CAPABILITY, ""); mutable_executor.set_initial_browser_url(initial_url.asString()); Json::Value scroll_behavior = it->second.get(ELEMENT_SCROLL_BEHAVIOR_CAPABILITY, 0); mutable_executor.input_manager()->set_scroll_behavior(static_cast<ELEMENT_SCROLL_BEHAVIOR>(scroll_behavior.asInt())); Json::Value unexpected_alert_behavior = it->second.get(UNEXPECTED_ALERT_BEHAVIOR_CAPABILITY, DISMISS_UNEXPECTED_ALERTS); mutable_executor.set_unexpected_alert_behavior(unexpected_alert_behavior.asString()); Json::Value enable_element_cache_cleanup = it->second.get(ENABLE_ELEMENT_CACHE_CLEANUP_CAPABILITY, true); mutable_executor.set_enable_element_cache_cleanup(enable_element_cache_cleanup.asBool()); Json::Value require_window_focus = it->second.get(REQUIRE_WINDOW_FOCUS_CAPABILITY, false); mutable_executor.input_manager()->set_require_window_focus(require_window_focus.asBool()); Json::Value enable_persistent_hover = it->second.get(ENABLE_PERSISTENT_HOVER_CAPABILITY, true); if (require_window_focus.asBool() || !enable_native_events.asBool()) { // Setting "require_window_focus" implies SendInput() API, and does not therefore require // persistent hover. Likewise, not using native events requires no persistent hover either. mutable_executor.set_enable_persistent_hover(false); } else { mutable_executor.set_enable_persistent_hover(enable_persistent_hover.asBool()); } } std::string create_browser_error_message = ""; int result_code = mutable_executor.CreateNewBrowser(&create_browser_error_message); if (result_code != SUCCESS) { // The browser was not created successfully, therefore the // session must be marked as invalid so the server can // properly shut it down. mutable_executor.set_is_valid(false); response->SetErrorResponse(result_code, "Unexpected error launching Internet Explorer. " + create_browser_error_message); return; } std::string id = executor.session_id(); response->SetResponse(303, "/session/" + id); } }; } // namespace webdriver #endif // WEBDRIVER_IE_NEWSESSIONCOMMANDHANDLER_H_
// // Licensed to Green Energy Corp (www.greenenergycorp.com) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Green Enery Corp licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // #ifndef __QUALITY_CONVERTER_H_ #define __QUALITY_CONVERTER_H_ #include "QualityMasks.h" #include "Types.h" #include <string> #include <sstream> namespace apl { template <class T, size_t N> struct QualityInfo { const static size_t NUM = N; const static boost::uint8_t masks[N]; const static std::string names[N]; const static char symbols[N]; }; typedef QualityInfo<BinaryQuality, 6> BinaryQualInfo; typedef QualityInfo<AnalogQuality, 7> AnalogQualInfo; typedef QualityInfo<CounterQuality, 7> CounterQualInfo; typedef QualityInfo<ControlQuality, 5> ControlQualInfo; typedef QualityInfo<SetpointQuality, 4> SetpointQualInfo; typedef QualityInfo<VtoQuality, 4> VtoQualInfo; /* TODO - what is the proper N value? */ template <class T> class QualityConverter { public: static char GetSymbol(boost::uint8_t aMask) { for (size_t i = 0; i < T::NUM; ++i) if(T::masks[i] == aMask) return T::symbols[i]; return '.'; } static std::string GetName(boost::uint8_t aMask) { for (size_t i = 0; i < T::NUM; ++i) if(T::masks[i] == aMask) return T::names[i]; return "Reserved"; } static boost::uint8_t GetMask(char aSymbol) { for (size_t i = 0; i < T::NUM; ++i) if(T::symbols[i] == aSymbol) return T::masks[i]; return 0; } static std::string GetSymbolString(boost::uint8_t aQual) { std::ostringstream oss; oss << "{"; for (size_t i = 0; i < 8; ++i) { if(i < T::NUM && (aQual & T::masks[i])) oss << T::symbols[i]; else oss << ' '; } oss << "}"; return oss.str(); } static std::string GetNameString(boost::uint8_t aQual) { std::ostringstream oss; for (size_t i = 0; i < T::NUM; ++i) if(aQual & T::masks[i]) oss << " " << T::names[i]; return oss.str(); } static std::string GetAllSymbols() { return GetSymbolString(~0); } }; } #endif
/* Microsoft Reference Implementation for TPM 2.0 * * The copyright in this software is being made available under the BSD License, * included below. This software may be subject to other third party and * contributor rights, including patent rights, and no such rights are granted * under this license. * * Copyright (c) Microsoft Corporation * * All rights reserved. * * BSD License * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * 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. */ /*(Auto-generated) * Created by TpmStructures; Version 4.4 Mar 26, 2019 * Date: Mar 28, 2019 Time: 08:25:17PM */ #if CC_SetAlgorithmSet // Command must be enabled #ifndef _Set_Algorithm_Set_FP_H_ #define _Set_Algorithm_Set_FP_H_ // Input structure definition typedef struct { TPMI_RH_PLATFORM authHandle; UINT32 algorithmSet; } SetAlgorithmSet_In; // Response code modifiers #define RC_SetAlgorithmSet_authHandle (TPM_RC_H + TPM_RC_1) #define RC_SetAlgorithmSet_algorithmSet (TPM_RC_P + TPM_RC_1) // Function prototype TPM_RC TPM2_SetAlgorithmSet( SetAlgorithmSet_In *in ); #endif // _Set_Algorithm_Set_FP_H_ #endif // CC_SetAlgorithmSet
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/eventbridge/EventBridge_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/eventbridge/model/ReplayState.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace EventBridge { namespace Model { class AWS_EVENTBRIDGE_API CancelReplayResult { public: CancelReplayResult(); CancelReplayResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); CancelReplayResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>The ARN of the replay to cancel.</p> */ inline const Aws::String& GetReplayArn() const{ return m_replayArn; } /** * <p>The ARN of the replay to cancel.</p> */ inline void SetReplayArn(const Aws::String& value) { m_replayArn = value; } /** * <p>The ARN of the replay to cancel.</p> */ inline void SetReplayArn(Aws::String&& value) { m_replayArn = std::move(value); } /** * <p>The ARN of the replay to cancel.</p> */ inline void SetReplayArn(const char* value) { m_replayArn.assign(value); } /** * <p>The ARN of the replay to cancel.</p> */ inline CancelReplayResult& WithReplayArn(const Aws::String& value) { SetReplayArn(value); return *this;} /** * <p>The ARN of the replay to cancel.</p> */ inline CancelReplayResult& WithReplayArn(Aws::String&& value) { SetReplayArn(std::move(value)); return *this;} /** * <p>The ARN of the replay to cancel.</p> */ inline CancelReplayResult& WithReplayArn(const char* value) { SetReplayArn(value); return *this;} /** * <p>The current state of the replay.</p> */ inline const ReplayState& GetState() const{ return m_state; } /** * <p>The current state of the replay.</p> */ inline void SetState(const ReplayState& value) { m_state = value; } /** * <p>The current state of the replay.</p> */ inline void SetState(ReplayState&& value) { m_state = std::move(value); } /** * <p>The current state of the replay.</p> */ inline CancelReplayResult& WithState(const ReplayState& value) { SetState(value); return *this;} /** * <p>The current state of the replay.</p> */ inline CancelReplayResult& WithState(ReplayState&& value) { SetState(std::move(value)); return *this;} /** * <p>The reason that the replay is in the current state.</p> */ inline const Aws::String& GetStateReason() const{ return m_stateReason; } /** * <p>The reason that the replay is in the current state.</p> */ inline void SetStateReason(const Aws::String& value) { m_stateReason = value; } /** * <p>The reason that the replay is in the current state.</p> */ inline void SetStateReason(Aws::String&& value) { m_stateReason = std::move(value); } /** * <p>The reason that the replay is in the current state.</p> */ inline void SetStateReason(const char* value) { m_stateReason.assign(value); } /** * <p>The reason that the replay is in the current state.</p> */ inline CancelReplayResult& WithStateReason(const Aws::String& value) { SetStateReason(value); return *this;} /** * <p>The reason that the replay is in the current state.</p> */ inline CancelReplayResult& WithStateReason(Aws::String&& value) { SetStateReason(std::move(value)); return *this;} /** * <p>The reason that the replay is in the current state.</p> */ inline CancelReplayResult& WithStateReason(const char* value) { SetStateReason(value); return *this;} private: Aws::String m_replayArn; ReplayState m_state; Aws::String m_stateReason; }; } // namespace Model } // namespace EventBridge } // namespace Aws
/* -------------------------------------------------------------------------- */ /* Copyright 2002-2017, OpenNebula Project, OpenNebula Systems */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); you may */ /* not use this file except in compliance with the License. You may obtain */ /* a copy of the License at */ /* */ /* http://www.apache.org/licenses/LICENSE-2.0 */ /* */ /* Unless required by applicable law or agreed to in writing, software */ /* distributed under the License is distributed on an "AS IS" BASIS, */ /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ /* See the License for the specific language governing permissions and */ /* limitations under the License. */ /* -------------------------------------------------------------------------- */ #ifdef __APPLE__ #include <util.h> #else #include <pty.h> #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> int expect_char(int pty, char * expected, int seconds) { fd_set rfds; struct timeval tv; int rc; char c; do { if (seconds != 0) { FD_ZERO(&rfds); FD_SET(pty, &rfds); tv.tv_sec = seconds; tv.tv_usec = 0; rc = select(pty+1,&rfds,0,0, &tv); if ( rc <= 0 ) // timeout { return -1; } } rc = read(pty, (void *) &c, sizeof(char)); if ( rc > 0 ) { if(expected == 0) { write(1,&c,sizeof(char)); } if (expected != 0 && c == *expected) { return 0; } } } while ( rc > 0 ); return -1; } void write_answer(int pty, const char * answer) { int len, i; len = strlen(answer); for (i=0; i<len; i++) { write(pty,(void *) &(answer[i]),sizeof(char)); } write(pty,(void *)"\n",sizeof(char)); } static const char * myexpect_usage = "\n myexpect [-h] <-p password> <-u username> <command>\n\n" "SYNOPSIS\n" " Wraps the execution of a command and sends username & password\n\n" "OPTIONS\n" "\t-h\tprints this help.\n" "\t-p\tthe password\n" "\t-u\tthe username\n" "\t<virsh command>\tcomplete virsh command\n"; int main (int argc, char **argv) { char * password = 0; char * username = 0; char expect = ':'; int opt, pty, pid, rc; int times = 1; while((opt = getopt(argc,argv,"+hrp:u:")) != -1) switch(opt) { case 'h': printf("%s",myexpect_usage); exit(0); break; case 'p': password = strdup(optarg); break; case 'u': username = strdup(optarg); break; case 'r': times = 2; break; default: fprintf(stderr,"Wrong option. Check usage\n"); fprintf(stderr,"%s",myexpect_usage); exit(-1); break; } if (password == 0 || username == 0 || optind >= argc ) { fprintf(stderr,"Wrong number of arguments. Check usage\n"); fprintf(stderr,"%s",myexpect_usage); exit(-1); } pid = forkpty(&pty,0,0,0); if(pid == 0) { struct termios tios; tcgetattr(pty, &tios); tios.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL); tios.c_oflag &= ~(ONLCR); tcsetattr(pty, TCSANOW, &tios); execvp(argv[optind],&(argv[optind])); exit(-1); } else if (pid == -1) { perror("fork\n"); } while ( times > 0 ) { if (expect_char(pty,&expect,1) == -1) { return -1; } sleep(1); write_answer(pty,username); if (expect_char(pty,&expect,1) == -1) { return -1; } sleep(1); write_answer(pty,password); times = times - 1; } expect_char(pty,0,0); wait(&rc); return WEXITSTATUS(rc); }
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/workmail/WorkMail_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/workmail/model/Group.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace WorkMail { namespace Model { class AWS_WORKMAIL_API ListGroupsResult { public: ListGroupsResult(); ListGroupsResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); ListGroupsResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>The overview of groups for an organization.</p> */ inline const Aws::Vector<Group>& GetGroups() const{ return m_groups; } /** * <p>The overview of groups for an organization.</p> */ inline void SetGroups(const Aws::Vector<Group>& value) { m_groups = value; } /** * <p>The overview of groups for an organization.</p> */ inline void SetGroups(Aws::Vector<Group>&& value) { m_groups = std::move(value); } /** * <p>The overview of groups for an organization.</p> */ inline ListGroupsResult& WithGroups(const Aws::Vector<Group>& value) { SetGroups(value); return *this;} /** * <p>The overview of groups for an organization.</p> */ inline ListGroupsResult& WithGroups(Aws::Vector<Group>&& value) { SetGroups(std::move(value)); return *this;} /** * <p>The overview of groups for an organization.</p> */ inline ListGroupsResult& AddGroups(const Group& value) { m_groups.push_back(value); return *this; } /** * <p>The overview of groups for an organization.</p> */ inline ListGroupsResult& AddGroups(Group&& value) { m_groups.push_back(std::move(value)); return *this; } /** * <p>The token to use to retrieve the next page of results. The value is "null" * when there are no more results to return.</p> */ inline const Aws::String& GetNextToken() const{ return m_nextToken; } /** * <p>The token to use to retrieve the next page of results. The value is "null" * when there are no more results to return.</p> */ inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } /** * <p>The token to use to retrieve the next page of results. The value is "null" * when there are no more results to return.</p> */ inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } /** * <p>The token to use to retrieve the next page of results. The value is "null" * when there are no more results to return.</p> */ inline void SetNextToken(const char* value) { m_nextToken.assign(value); } /** * <p>The token to use to retrieve the next page of results. The value is "null" * when there are no more results to return.</p> */ inline ListGroupsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} /** * <p>The token to use to retrieve the next page of results. The value is "null" * when there are no more results to return.</p> */ inline ListGroupsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} /** * <p>The token to use to retrieve the next page of results. The value is "null" * when there are no more results to return.</p> */ inline ListGroupsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} private: Aws::Vector<Group> m_groups; Aws::String m_nextToken; }; } // namespace Model } // namespace WorkMail } // namespace Aws
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/mobile/Mobile_EXPORTS.h> #include <aws/core/client/AWSErrorMarshaller.h> namespace Aws { namespace Client { class AWS_MOBILE_API MobileErrorMarshaller : public Aws::Client::JsonErrorMarshaller { public: Aws::Client::AWSError<Aws::Client::CoreErrors> FindErrorByName(const char* exceptionName) const override; }; } // namespace Client } // namespace Aws
/* * Copyright 2018-2020 Couchbase, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SRC_SCRAM_SHA_SCRAM_UILS_H_ #define SRC_SCRAM_SHA_SCRAM_UILS_H_ #include <stddef.h> #include "cbsasl/cbsasl.h" #ifdef __cplusplus extern "C" { #endif /** * Ensures the seed for OpenSSL's RAND_bytes function is correctly filled. * Please note: as we use it only for the generation of the client nonce, * we don't need a strong entropy. */ void seed_rand(void); /** * Generates a binary nonce of 'buffer_length' bytes at the given buffer address. * The buffer must be already allocated with enough space in it. */ void generate_nonce(char *buffer, int buffer_length); /** * Computes the number of comma (',') and equal ('=') characters in the input string * for further substitution. * If return value is negative, it means the buffer contains an invalid (control) character. */ int compute_special_chars(const char *buffer, int buffer_length); /** * Copies 'n' bytes from 'src' to 'dest', replacing comma and equal characters by their * substitution strings in the destination. */ void usernmcpy(char *dest, const char *src, size_t n); /** * Parses the server's first reply to extract the nonce, the salt and the iteration count. */ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serverinlen, const char **nonce, unsigned int *noncelength, const char **salt, unsigned int *saltlength, unsigned int *itcount); /** * Generates the salted password. */ cbsasl_error_t generate_salted_password(cbsasl_auth_mechanism_t auth_mech, const cbsasl_secret_t *passwd, const char *salt, unsigned int saltlen, unsigned int itcount, unsigned char *outbuffer, unsigned int *outlength); /** * Computes the client proof. It is computed as: * * ClientKey := HMAC(SaltedPassword, "Client Key") * StoredKey := H(ClientKey) * AuthMessage := client-first-message-bare + "," + * server-first-message + "," + * client-final-message-without-proof * ClientSignature := HMAC(StoredKey, AuthMessage) * ClientProof := ClientKey XOR ClientSignature */ cbsasl_error_t compute_client_proof(cbsasl_auth_mechanism_t auth_mech, const unsigned char *saltedpassword, unsigned int saltedpasslen, const char *clientfirstbare, unsigned int cfblen, const char *serverfirstmess, unsigned int sfmlen, const char *clientfinalwithoutproof, unsigned int cfwplen, char **authmessage, char *outclientproof, unsigned int outprooflen); /** * Computes the Server Signature. It is computed as: * * SaltedPassword := Hi(Normalize(password), salt, i) * ServerKey := HMAC(SaltedPassword, "Server Key") * ServerSignature := HMAC(ServerKey, AuthMessage) */ cbsasl_error_t compute_server_signature(cbsasl_auth_mechanism_t auth_mech, const unsigned char *saltedpassword, unsigned int saltedpasslen, const char *authmessage, char *outserversign, unsigned int outsignlen); #ifdef __cplusplus } #endif #endif /* SRC_SCRAM_SHA_SCRAM_UILS_H_ */
/*------------------------------------------------------------------------- * * pg_am.h * definition of the system "access method" relation (pg_am) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_am.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_AM_H #define PG_AM_H #include "catalog/genbki.h" /* ---------------- * pg_am definition. cpp turns this into * typedef struct FormData_pg_am * ---------------- */ #define AccessMethodRelationId 2601 CATALOG(pg_am,2601) { NameData amname; /* access method name */ int16 amstrategies; /* total number of strategies (operators) by * which we can traverse/search this AM. Zero * if AM does not have a fixed set of strategy * assignments. */ int16 amsupport; /* total number of support functions that this * AM uses */ bool amcanorder; /* does AM support order by column value? */ bool amcanorderbyop; /* does AM support order by operator result? */ bool amcanbackward; /* does AM support backward scan? */ bool amcanunique; /* does AM support UNIQUE indexes? */ bool amcanmulticol; /* does AM support multi-column indexes? */ bool amoptionalkey; /* can query omit key for the first column? */ bool amsearcharray; /* can AM handle ScalarArrayOpExpr quals? */ bool amsearchnulls; /* can AM search for NULL/NOT NULL entries? */ bool amstorage; /* can storage type differ from column type? */ bool amclusterable; /* does AM support cluster command? */ bool ampredlocks; /* does AM handle predicate locks? */ Oid amkeytype; /* type of data in index, or InvalidOid */ regproc aminsert; /* "insert this tuple" function */ regproc ambeginscan; /* "prepare for index scan" function */ regproc amgettuple; /* "next valid tuple" function, or 0 */ regproc amgetbitmap; /* "fetch all valid tuples" function, or 0 */ regproc amrescan; /* "(re)start index scan" function */ regproc amendscan; /* "end index scan" function */ regproc ammarkpos; /* "mark current scan position" function */ regproc amrestrpos; /* "restore marked scan position" function */ regproc ambuild; /* "build new index" function */ regproc ambuildempty; /* "build empty index" function */ regproc ambulkdelete; /* bulk-delete function */ regproc amvacuumcleanup; /* post-VACUUM cleanup function */ regproc amcanreturn; /* can indexscan return IndexTuples? */ regproc amcostestimate; /* estimate cost of an indexscan */ regproc amoptions; /* parse AM-specific parameters */ } FormData_pg_am; /* ---------------- * Form_pg_am corresponds to a pointer to a tuple with * the format of pg_am relation. * ---------------- */ typedef FormData_pg_am *Form_pg_am; /* ---------------- * compiler constants for pg_am * ---------------- */ #define Natts_pg_am 30 #define Anum_pg_am_amname 1 #define Anum_pg_am_amstrategies 2 #define Anum_pg_am_amsupport 3 #define Anum_pg_am_amcanorder 4 #define Anum_pg_am_amcanorderbyop 5 #define Anum_pg_am_amcanbackward 6 #define Anum_pg_am_amcanunique 7 #define Anum_pg_am_amcanmulticol 8 #define Anum_pg_am_amoptionalkey 9 #define Anum_pg_am_amsearcharray 10 #define Anum_pg_am_amsearchnulls 11 #define Anum_pg_am_amstorage 12 #define Anum_pg_am_amclusterable 13 #define Anum_pg_am_ampredlocks 14 #define Anum_pg_am_amkeytype 15 #define Anum_pg_am_aminsert 16 #define Anum_pg_am_ambeginscan 17 #define Anum_pg_am_amgettuple 18 #define Anum_pg_am_amgetbitmap 19 #define Anum_pg_am_amrescan 20 #define Anum_pg_am_amendscan 21 #define Anum_pg_am_ammarkpos 22 #define Anum_pg_am_amrestrpos 23 #define Anum_pg_am_ambuild 24 #define Anum_pg_am_ambuildempty 25 #define Anum_pg_am_ambulkdelete 26 #define Anum_pg_am_amvacuumcleanup 27 #define Anum_pg_am_amcanreturn 28 #define Anum_pg_am_amcostestimate 29 #define Anum_pg_am_amoptions 30 /* ---------------- * initial contents of pg_am * ---------------- */ DATA(insert OID = 403 ( btree 5 2 t f t t t t t t f t t 0 btinsert btbeginscan btgettuple btgetbitmap btrescan btendscan btmarkpos btrestrpos btbuild btbuildempty btbulkdelete btvacuumcleanup btcanreturn btcostestimate btoptions )); DESCR("b-tree index access method"); #define BTREE_AM_OID 403 DATA(insert OID = 405 ( hash 1 1 f f t f f f f f f f f 23 hashinsert hashbeginscan hashgettuple hashgetbitmap hashrescan hashendscan hashmarkpos hashrestrpos hashbuild hashbuildempty hashbulkdelete hashvacuumcleanup - hashcostestimate hashoptions )); DESCR("hash index access method"); #define HASH_AM_OID 405 DATA(insert OID = 783 ( gist 0 8 f t f f t t f t t t f 0 gistinsert gistbeginscan gistgettuple gistgetbitmap gistrescan gistendscan gistmarkpos gistrestrpos gistbuild gistbuildempty gistbulkdelete gistvacuumcleanup - gistcostestimate gistoptions )); DESCR("GiST index access method"); #define GIST_AM_OID 783 DATA(insert OID = 2742 ( gin 0 6 f f f f t t f f t f f 0 gininsert ginbeginscan - gingetbitmap ginrescan ginendscan ginmarkpos ginrestrpos ginbuild ginbuildempty ginbulkdelete ginvacuumcleanup - gincostestimate ginoptions )); DESCR("GIN index access method"); #define GIN_AM_OID 2742 DATA(insert OID = 4000 ( spgist 0 5 f f f f f t f t f f f 0 spginsert spgbeginscan spggettuple spggetbitmap spgrescan spgendscan spgmarkpos spgrestrpos spgbuild spgbuildempty spgbulkdelete spgvacuumcleanup spgcanreturn spgcostestimate spgoptions )); DESCR("SP-GiST index access method"); #define SPGIST_AM_OID 4000 #endif /* PG_AM_H */
// This is core/vnl/vnl_int_3.h #ifndef vnl_int_3_h_ #define vnl_int_3_h_ //: // \file // \brief alias for vnl_vector_fixed<int,3> // \author Andrew W. Fitzgibbon, Oxford RRG // \date 31 Aug 96 // // \verbatim // Modifications // Peter Vanroose, 21 Oct 1999: vnl_vector_fixed<int,3> already instantiated // \endverbatim #include <vnl/vnl_T_n.h> //: class vnl_int_3 : a vnl_vector of 3 ints. vnl_T_n_impl(int,3); #endif // vnl_int_3_h_
/* * * Copyright 2016 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include "src/core/lib/iomgr/port.h" #if GRPC_UV #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/timer.h" #include <uv.h> grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false); grpc_tracer_flag grpc_timer_check_trace = GRPC_TRACER_INITIALIZER(false); static void timer_close_callback(uv_handle_t *handle) { gpr_free(handle); } static void stop_uv_timer(uv_timer_t *handle) { uv_timer_stop(handle); uv_unref((uv_handle_t *)handle); uv_close((uv_handle_t *)handle, timer_close_callback); } void run_expired_timer(uv_timer_t *handle) { grpc_timer *timer = (grpc_timer *)handle->data; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GPR_ASSERT(timer->pending); timer->pending = 0; GRPC_CLOSURE_SCHED(&exec_ctx, timer->closure, GRPC_ERROR_NONE); stop_uv_timer(handle); grpc_exec_ctx_finish(&exec_ctx); } void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer, gpr_timespec deadline, grpc_closure *closure, gpr_timespec now) { uint64_t timeout; uv_timer_t *uv_timer; timer->closure = closure; if (gpr_time_cmp(deadline, now) <= 0) { timer->pending = 0; GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_NONE); return; } timer->pending = 1; timeout = (uint64_t)gpr_time_to_millis(gpr_time_sub(deadline, now)); uv_timer = gpr_malloc(sizeof(uv_timer_t)); uv_timer_init(uv_default_loop(), uv_timer); uv_timer->data = timer; timer->uv_timer = uv_timer; uv_timer_start(uv_timer, run_expired_timer, timeout, 0); /* We assume that gRPC timers are only used alongside other active gRPC objects, and that there will therefore always be something else keeping the uv loop alive whenever there is a timer */ uv_unref((uv_handle_t *)uv_timer); } void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer) { if (timer->pending) { timer->pending = 0; GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_CANCELLED); stop_uv_timer((uv_timer_t *)timer->uv_timer); } } grpc_timer_check_result grpc_timer_check(grpc_exec_ctx *exec_ctx, gpr_timespec now, gpr_timespec *next) { return GRPC_TIMERS_NOT_CHECKED; } void grpc_timer_list_init(gpr_timespec now) {} void grpc_timer_list_shutdown(grpc_exec_ctx *exec_ctx) {} void grpc_timer_consume_kick(void) {} #endif /* GRPC_UV */
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // Use MockGaiaAuthenticator to test your application by faking a login session. // This mock object should be initialized with the response you expect it to // return for multiple users, and then can be used in exactly the same way // as the real GaiaAuthenticator. // // Sample usage: // MockGaiaAuthenticator mock_gaia_auth("User-Agent", SYNC_SERVICE_NAME, // "any random string"); // mock_gaia_auth.AddMockUser("email", "password", "authtoken", "lsid", "sid", // AuthenticationError); // mock_gaia_auth.AddMockUser("email2", "password2", "authtoken2", "lsid2", // "sid2", AuthenticationError, error_url, // "captcha_token", "captcha_url"); // if (gaia_auth.Authenticate("email", "passwd")) { // // Do something with: gaia_auth.auth_token(), or gaia_auth.sid(), // // or gaia_auth.lsid() // } #ifndef CHROME_TEST_SYNC_ENGINE_MOCK_GAIA_AUTHENTICATOR_H_ #define CHROME_TEST_SYNC_ENGINE_MOCK_GAIA_AUTHENTICATOR_H_ #pragma once #include <map> #include <string> #include "base/port.h" #include "base/basictypes.h" #include "chrome/common/net/gaia/gaia_authenticator.h" namespace browser_sync { // A struct used internally for storing a user's credentials. You can either // create one yourself, or use the convenience methods to have the // MockGaiaAuthenticator create one for you. typedef struct { std::string email; std::string passwd; std::string auth_token; std::string sid; std::string lsid; gaia::AuthenticationError auth_error; std::string captcha_token; std::string captcha_url; std::string error_url; } MockUser; // MockGaiaAuthenticator can be used to fake Gaia authentication without // actually making a network connection. For details about the methods shared // with GaiaAuthenticator, see GaiaAuthenticator in gaia_auth.h. Only methods // that are unique to MockGaiaAuthenticator are documented in this file. class MockGaiaAuthenticator { public: MockGaiaAuthenticator(const char* user_agent, const char* service_id, const char* gaia_url); ~MockGaiaAuthenticator(); // Add a mock user; takes a struct. You can populate any or all fields when // adding a user. The email field is required, all others optional. void AddMockUser(MockUser mock_user); // A convenience method that makes it easy to create new mock users in a // single method call. Includes all parameters. void AddMockUser(std::string email, std::string passwd, std::string auth_token, std::string lsid, std::string sid, gaia::AuthenticationError auth_error, std::string error_url, std::string captcha_token, std::string captcha_url); // A convenience method that makes it easy to create new mock users in a // single method call. Includes only the most common parameters. See overload // if you want to pass all parameters. void AddMockUser(std::string email, std::string passwd, std::string auth_token, std::string lsid, std::string sid, enum gaia::AuthenticationError auth_error); // Removes a mock user from the current list of added users. void RemoveMockUser(const char* email); // Removes all mock users from the current list of added users. void RemoveAllMockUsers(); // See GaiaAuthenticator::Authenticate() bool Authenticate(); // See GaiaAuthenticator::Authenticate(...) bool Authenticate(const char* user_name, const char* password, bool should_save_credentials = false); // See GaiaAuthenticator::Authenticate(...) void ResetCredentials(); // Accessors follow. std::string email(); std::string auth_token(); std::string sid(); std::string lsid(); gaia::AuthenticationError auth_error(); std::string auth_error_url(); std::string captcha_token(); std::string captcha_url(); private: bool should_save_credentials_; std::map<std::string, MockUser> mock_credentials_; std::string current_user_; }; } // namespace browser_sync #endif // CHROME_TEST_SYNC_ENGINE_MOCK_GAIA_AUTHENTICATOR_H_
/* * Software License Agreement (BSD License) * * Point Cloud Library (PCL) - www.pointclouds.org * Copyright (c) 2012-, Open Perception, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of Willow Garage, Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * */ #include <pcl/pcl_config.h> #ifdef HAVE_OPENNI #ifndef _PCL_OPENNI_OPENNI_H_ #define _PCL_OPENNI_OPENNI_H_ #if defined __GNUC__ # pragma GCC system_header #endif #include <XnOS.h> #include <XnCppWrapper.h> #include <XnVersion.h> #endif #endif // _PCL_OPENNI_OPENNI_H_
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_CERTIFICATE_VIEWER_H_ #define CONTENT_BROWSER_CERTIFICATE_VIEWER_H_ #pragma once #include "ui/gfx/native_widget_types.h" namespace net { class X509Certificate; } // namespace net // Opens a certificate viewer under |parent| to display the certificate from // the |CertStore| with id |cert_id|. void ShowCertificateViewerByID(gfx::NativeWindow parent, int cert_id); // Opens a certificate viewer under |parent| to display |cert|. void ShowCertificateViewer(gfx::NativeWindow parent, net::X509Certificate* cert); #endif // CONTENT_BROWSER_CERTIFICATE_VIEWER_H_
// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. namespace flutter { namespace math { // e constexpr float kE = 2.7182818284590452354; // log_2 e constexpr float kLog2_E = 1.4426950408889634074; // log_10 e constexpr float kLog10_E = 0.43429448190325182765; // log_e 2 constexpr float klogE_2 = 0.69314718055994530942; // log_e 10 constexpr float klogE_10 = 2.30258509299404568402; // pi constexpr float kPi = 3.14159265358979323846; // pi/2 constexpr float kPiOver2 = 1.57079632679489661923; // pi/4 constexpr float kPiOver4 = 0.78539816339744830962; // 1/pi constexpr float k1OverPi = 0.31830988618379067154; // 2/pi constexpr float k2OverPi = 0.63661977236758134308; // 2/sqrt(pi) constexpr float k2OverSqrtPi = 1.12837916709551257390; // sqrt(2) constexpr float kSqrt2 = 1.41421356237309504880; // 1/sqrt(2) constexpr float k1OverSqrt2 = 0.70710678118654752440; } // namespace math } // namespace flutter
// Filename: KrylovLinearSolverManager.h // Created on 13 Aug 2012 by Boyce Griffith // // Copyright (c) 2002-2014, Boyce Griffith // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // * Neither the name of The University of North Carolina nor the names of // its contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #ifndef included_KrylovLinearSolverManager #define included_KrylovLinearSolverManager /////////////////////////////// INCLUDES ///////////////////////////////////// #include <map> #include <string> #include "ibtk/KrylovLinearSolver.h" #include "tbox/Database.h" #include "tbox/Pointer.h" /////////////////////////////// CLASS DEFINITION ///////////////////////////// namespace IBTK { /*! * \brief Class KrylovLinearSolverManager is a singleton manager class to * provide access to generic KrylovLinearSolver implementations. */ class KrylovLinearSolverManager { public: /*! * Key to use for "undefined" solver types. */ static const std::string UNDEFINED; /*! * Default Krylov solver types automatically provided by the manager class. */ static const std::string DEFAULT; static const std::string PETSC; /*! * Return a pointer to the instance of the solver manager. Access to * KrylovLinearSolverManager objects is mediated by the getManager() * function. * * \return A pointer to the solver manager instance. */ static KrylovLinearSolverManager* getManager(); /*! * Deallocate the KrylovLinearSolverManager instance. * * It is not necessary to call this function at program termination since it * is automatically called by the ShutdownRegistry class. */ static void freeManager(); /*! * Allocate a new KrylovLinearSolver object of the specified type. */ SAMRAI::tbox::Pointer<KrylovLinearSolver> allocateSolver(const std::string& solver_type, const std::string& solver_object_name, SAMRAI::tbox::Pointer<SAMRAI::tbox::Database> solver_input_db, const std::string& solver_default_options_prefix) const; /*! * Typedef for functions to construct KrylovLinearSolvers. */ typedef SAMRAI::tbox::Pointer<KrylovLinearSolver>(*SolverMaker)( const std::string& solver_object_name, SAMRAI::tbox::Pointer<SAMRAI::tbox::Database> solver_input_db, const std::string& solver_default_options_prefix); /*! * Register a solver factory function with the solver manager class. */ void registerSolverFactoryFunction(const std::string& solver_type, SolverMaker solver_maker); protected: /*! * \brief Default constructor. */ KrylovLinearSolverManager(); /*! * \brief Destructor. */ ~KrylovLinearSolverManager(); private: /*! * \brief Copy constructor. * * \note This constructor is not implemented and should not be used. * * \param from The value to copy to this object. */ KrylovLinearSolverManager(const KrylovLinearSolverManager& from); /*! * \brief Assignment operator. * * \note This operator is not implemented and should not be used. * * \param that The value to assign to this object. * * \return A reference to this object. */ KrylovLinearSolverManager& operator=(const KrylovLinearSolverManager& that); /*! * Static data members used to control access to and destruction of * singleton data manager instance. */ static KrylovLinearSolverManager* s_solver_manager_instance; static bool s_registered_callback; static unsigned char s_shutdown_priority; /*! * Mapping from solver type names to solver maker functions. */ std::map<std::string, SolverMaker> d_solver_maker_map; }; } // namespace IBTK ////////////////////////////////////////////////////////////////////////////// #endif //#ifndef included_KrylovLinearSolverManager
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_GAMEPAD_GAMEPAD_BUTTON_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_GAMEPAD_GAMEPAD_BUTTON_H_ #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/heap_allocator.h" #include "third_party/blink/renderer/platform/heap/member.h" namespace device { class GamepadButton; } namespace blink { class GamepadButton final : public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); public: GamepadButton(); double value() const { return value_; } void SetValue(double val) { value_ = val; } bool pressed() const { return pressed_; } void SetPressed(bool val) { pressed_ = val; } bool touched() const { return touched_; } void SetTouched(bool val) { touched_ = val; } bool IsEqual(const device::GamepadButton&) const; void UpdateValuesFrom(const device::GamepadButton&); private: double value_; bool pressed_; bool touched_; }; typedef HeapVector<Member<GamepadButton>> GamepadButtonVector; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_GAMEPAD_GAMEPAD_BUTTON_H_
#ifndef THC_GENERIC_FILE #error "You must define THC_GENERIC_FILE before including THGenerateAllTypes.h" #endif #include "THCHalf.h" #define THCTypeIdxByte 1 #define THCTypeIdxChar 2 #define THCTypeIdxShort 3 #define THCTypeIdxInt 4 #define THCTypeIdxLong 5 #define THCTypeIdxFloat 6 #define THCTypeIdxDouble 7 #define THCTypeIdxHalf 8 #define THCTypeIdx_(T) TH_CONCAT_2(THCTypeIdx,T) #define real unsigned char #define accreal long #define Real Byte #define CReal CudaByte #define THC_REAL_IS_BYTE #line 1 THC_GENERIC_FILE /*#line 1 "THByteStorage.h"*/ #include THC_GENERIC_FILE #undef real #undef accreal #undef Real #undef CReal #undef THC_REAL_IS_BYTE #define real char #define accreal long #define Real Char #define CReal CudaChar #define THC_REAL_IS_CHAR #line 1 THC_GENERIC_FILE #include THC_GENERIC_FILE #undef real #undef accreal #undef Real #undef CReal #undef THC_REAL_IS_CHAR #define real short #define accreal long #define Real Short #define CReal CudaShort #define THC_REAL_IS_SHORT #line 1 THC_GENERIC_FILE #include THC_GENERIC_FILE #undef real #undef accreal #undef Real #undef CReal #undef THC_REAL_IS_SHORT #define real int #define accreal long #define Real Int #define CReal CudaInt #define THC_REAL_IS_INT #line 1 THC_GENERIC_FILE #include THC_GENERIC_FILE #undef real #undef accreal #undef Real #undef CReal #undef THC_REAL_IS_INT #define real long #define accreal long #define Real Long #define CReal CudaLong #define THC_REAL_IS_LONG #line 1 THC_GENERIC_FILE #include THC_GENERIC_FILE #undef real #undef accreal #undef Real #undef CReal #undef THC_REAL_IS_LONG #define real float #define accreal double #define Real Float #define CReal Cuda #define THC_REAL_IS_FLOAT #line 1 THC_GENERIC_FILE #include THC_GENERIC_FILE #undef real #undef accreal #undef Real #undef CReal #undef THC_REAL_IS_FLOAT #define real double #define accreal double #define Real Double #define CReal CudaDouble #define THC_REAL_IS_DOUBLE #line 1 THC_GENERIC_FILE #include THC_GENERIC_FILE #undef real #undef accreal #undef Real #undef CReal #undef THC_REAL_IS_DOUBLE #ifdef CUDA_HALF_TENSOR #define real half #define accreal half #define Real Half #define CReal CudaHalf #define THC_REAL_IS_HALF #line 1 THC_GENERIC_FILE #include THC_GENERIC_FILE #undef real #undef accreal #undef Real #undef CReal #undef THC_REAL_IS_HALF #endif // CUDA_HALF_TENSOR #undef THCTypeIdxByte #undef THCTypeIdxChar #undef THCTypeIdxShort #undef THCTypeIdxInt #undef THCTypeIdxLong #undef THCTypeIdxFloat #undef THCTypeIdxDouble #undef THCTypeIdxHalf #undef THC_GENERIC_FILE
/** * @file recvtime.c * @provides recvtime. * * $Id: recvtime.c 2070 2009-09-18 22:36:02Z brylow $ */ /* Embedded Xinu, Copyright (C) 2009. All rights reserved. */ #include <conf.h> #include <stddef.h> #include <thread.h> #include <clock.h> /** * wait to receive a message or timeout and return result * @param maxwait ticks to wait before timeout * @return msg if becomes available, TIMEOUT if no message */ message recvtime(int maxwait) { register struct thrent *thrptr; irqmask im; message msg; if (maxwait < 0) { return SYSERR; } im = disable(); thrptr = &thrtab[thrcurrent]; if (FALSE == thrptr->hasmsg) { #if RTCLOCK if (SYSERR == insertd(thrcurrent, sleepq, maxwait)) { restore(im); return SYSERR; } thrtab[thrcurrent].state = THRTMOUT; resched(); #else restore(im); return SYSERR; #endif } if (thrptr->hasmsg) { msg = thrptr->msg; /* retrieve message */ thrptr->hasmsg = FALSE; /* reset message flag */ } else { msg = TIMEOUT; } restore(im); return msg; }
/** \file G3D/Image4.h \maintainer Morgan McGuire, http://graphics.cs.williams.edu \created 2007-01-31 \edited 2011-08-11 */ #ifndef G3D_Image4_h #define G3D_Image4_h #include "G3D/platform.h" #include "G3D/Map2D.h" #include "G3D/Color4.h" namespace G3D { typedef shared_ptr<class Image4> Image4Ref; /** RGBA image with 32-bit floating point storage for each channel. Whenever a method needs to convert from RGB to RGBA, A=1 is assumed. Bilinear interpolation on Image4 is about 8x faster than on Image4unorm8 due to the large cost of converting int->float on modern machines. @sa G3D::Image4unorm8, G3D::GImage. */ class Image4 : public Map2D<Color4, Color4> { public: typedef Image4 Type; typedef shared_ptr<class Image4> Ref; protected: Image4(int w, int h, WrapMode wrap); void copyArray(const Color1* src, int w, int h); void copyArray(const Color3* src, int w, int h); void copyArray(const Color4* src, int w, int h); void copyArray(const Color1unorm8* src, int w, int h); void copyArray(const Color3unorm8* src, int w, int h); void copyArray(const Color4unorm8* src, int w, int h); public: const class ImageFormat* format() const; /** Creates an all-zero width x height image. */ static Ref createEmpty(int width, int height, WrapMode wrap = WrapMode::ERROR); /** Creates a 0 x 0 image. */ static Ref createEmpty(WrapMode wrap = WrapMode::ERROR); static Ref fromFile(const std::string& filename, WrapMode wrap = WrapMode::ERROR); static Ref fromArray(const class Color1unorm8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); static Ref fromArray(const class Color3unorm8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); static Ref fromArray(const class Color4unorm8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); static Ref fromArray(const class Color1* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); static Ref fromArray(const class Color3* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); static Ref fromArray(const class Color4* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); static Ref fromImage4unorm8(const shared_ptr<class Image4unorm8>& im); /** Loads from any of the file formats supported by G3D::GImage. */ void load(const std::string& filename); /** Saves in any of the formats supported by G3D::GImage. */ void save(const std::string& filename); }; } // G3D #endif
#ifndef _NF_CONNTRACK_EXTEND_H #define _NF_CONNTRACK_EXTEND_H #include <net/netfilter/nf_conntrack.h> enum nf_ct_ext_id { NF_CT_EXT_HELPER, NF_CT_EXT_NAT, NF_CT_EXT_ACCT, NF_CT_EXT_ECACHE, NF_CT_EXT_NUM, }; #define NF_CT_EXT_HELPER_TYPE struct nf_conn_help #define NF_CT_EXT_NAT_TYPE struct nf_conn_nat #define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache /* Extensions: optional stuff which isn't permanently in struct. */ struct nf_ct_ext { struct rcu_head rcu; u8 offset[NF_CT_EXT_NUM]; u8 len; char data[0]; }; static inline int nf_ct_ext_exist(const struct nf_conn *ct, u8 id) { return (ct->ext && ct->ext->offset[id]); } static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id) { if (!nf_ct_ext_exist(ct, id)) return NULL; return (void *)ct->ext + ct->ext->offset[id]; } #define nf_ct_ext_find(ext, id) \ ((id##_TYPE *)__nf_ct_ext_find((ext), (id))) /* Destroy all relationships */ extern void __nf_ct_ext_destroy(struct nf_conn *ct); static inline void nf_ct_ext_destroy(struct nf_conn *ct) { if (ct->ext) __nf_ct_ext_destroy(ct); } /* Free operation. If you want to free a object referred from private area, * please implement __nf_ct_ext_free() and call it. */ static inline void nf_ct_ext_free(struct nf_conn *ct) { if (ct->ext) kfree(ct->ext); } /* Add this type, returns pointer to data or NULL. */ void * __nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp); #define nf_ct_ext_add(ct, id, gfp) \ ((id##_TYPE *)__nf_ct_ext_add((ct), (id), (gfp))) #define NF_CT_EXT_F_PREALLOC 0x0001 struct nf_ct_ext_type { /* Destroys relationships (can be NULL). */ void (*destroy)(struct nf_conn *ct); /* Called when realloacted (can be NULL). Contents has already been moved. */ void (*move)(void *new, void *old); enum nf_ct_ext_id id; unsigned int flags; /* Length and min alignment. */ u8 len; u8 align; /* initial size of nf_ct_ext. */ u8 alloc_size; }; int nf_ct_extend_register(struct nf_ct_ext_type *type); void nf_ct_extend_unregister(struct nf_ct_ext_type *type); #endif /* _NF_CONNTRACK_EXTEND_H */
int cs_init(SCR *, VCS *); int cs_next(SCR *, VCS *); int cs_fspace(SCR *, VCS *); int cs_fblank(SCR *, VCS *); int cs_prev(SCR *, VCS *); int cs_bblank(SCR *, VCS *); int v_at(SCR *, VICMD *); int v_chrepeat(SCR *, VICMD *); int v_chrrepeat(SCR *, VICMD *); int v_cht(SCR *, VICMD *); int v_chf(SCR *, VICMD *); int v_chT(SCR *, VICMD *); int v_chF(SCR *, VICMD *); int v_delete(SCR *, VICMD *); int v_again(SCR *, VICMD *); int v_exmode(SCR *, VICMD *); int v_join(SCR *, VICMD *); int v_shiftl(SCR *, VICMD *); int v_shiftr(SCR *, VICMD *); int v_suspend(SCR *, VICMD *); int v_switch(SCR *, VICMD *); int v_tagpush(SCR *, VICMD *); int v_tagpop(SCR *, VICMD *); int v_filter(SCR *, VICMD *); int v_ex(SCR *, VICMD *); int v_ecl_exec(SCR *); int v_increment(SCR *, VICMD *); int v_screen_copy(SCR *, SCR *); int v_screen_end(SCR *); int v_optchange(SCR *, int, char *, u_long *); int v_iA(SCR *, VICMD *); int v_ia(SCR *, VICMD *); int v_iI(SCR *, VICMD *); int v_ii(SCR *, VICMD *); int v_iO(SCR *, VICMD *); int v_io(SCR *, VICMD *); int v_change(SCR *, VICMD *); int v_Replace(SCR *, VICMD *); int v_subst(SCR *, VICMD *); int v_left(SCR *, VICMD *); int v_cfirst(SCR *, VICMD *); int v_first(SCR *, VICMD *); int v_ncol(SCR *, VICMD *); int v_zero(SCR *, VICMD *); int v_mark(SCR *, VICMD *); int v_bmark(SCR *, VICMD *); int v_fmark(SCR *, VICMD *); int v_emark(SCR *, VICMD *); int v_match(SCR *, VICMD *); int v_buildmcs(SCR *, char *); int v_paragraphf(SCR *, VICMD *); int v_paragraphb(SCR *, VICMD *); int v_buildps(SCR *, char *, char *); int v_Put(SCR *, VICMD *); int v_put(SCR *, VICMD *); int v_redraw(SCR *, VICMD *); int v_replace(SCR *, VICMD *); int v_right(SCR *, VICMD *); int v_dollar(SCR *, VICMD *); int v_screen(SCR *, VICMD *); int v_lgoto(SCR *, VICMD *); int v_home(SCR *, VICMD *); int v_middle(SCR *, VICMD *); int v_bottom(SCR *, VICMD *); int v_up(SCR *, VICMD *); int v_cr(SCR *, VICMD *); int v_down(SCR *, VICMD *); int v_hpageup(SCR *, VICMD *); int v_hpagedown(SCR *, VICMD *); int v_pagedown(SCR *, VICMD *); int v_pageup(SCR *, VICMD *); int v_lineup(SCR *, VICMD *); int v_linedown(SCR *, VICMD *); int v_searchb(SCR *, VICMD *); int v_searchf(SCR *, VICMD *); int v_searchN(SCR *, VICMD *); int v_searchn(SCR *, VICMD *); int v_searchw(SCR *, VICMD *); int v_correct(SCR *, VICMD *, int); int v_sectionf(SCR *, VICMD *); int v_sectionb(SCR *, VICMD *); int v_sentencef(SCR *, VICMD *); int v_sentenceb(SCR *, VICMD *); int v_status(SCR *, VICMD *); int v_tcmd(SCR *, VICMD *, ARG_CHAR_T, u_int); int v_txt(SCR *, VICMD *, MARK *, const CHAR_T *, size_t, ARG_CHAR_T, recno_t, u_long, u_int32_t); int v_txt_auto(SCR *, recno_t, TEXT *, size_t, TEXT *); int v_ulcase(SCR *, VICMD *); int v_mulcase(SCR *, VICMD *); int v_Undo(SCR *, VICMD *); int v_undo(SCR *, VICMD *); void v_eof(SCR *, MARK *); void v_eol(SCR *, MARK *); void v_nomove(SCR *); void v_sof(SCR *, MARK *); void v_sol(SCR *); int v_isempty(CHAR_T *, size_t); void v_emsg(SCR *, char *, vim_t); int v_wordW(SCR *, VICMD *); int v_wordw(SCR *, VICMD *); int v_wordE(SCR *, VICMD *); int v_worde(SCR *, VICMD *); int v_wordB(SCR *, VICMD *); int v_wordb(SCR *, VICMD *); int v_xchar(SCR *, VICMD *); int v_Xchar(SCR *, VICMD *); int v_yank(SCR *, VICMD *); int v_z(SCR *, VICMD *); int vs_crel(SCR *, long); int v_zexit(SCR *, VICMD *); int vi(SCR **); int v_curword(SCR *); int vs_line(SCR *, SMAP *, size_t *, size_t *); int vs_number(SCR *); void vs_busy(SCR *, const char *, busy_t); void vs_home(SCR *); void vs_update(SCR *, const char *, const CHAR_T *); void vs_msg(SCR *, mtype_t, char *, size_t); int vs_ex_resolve(SCR *, int *); int vs_resolve(SCR *, SCR *, int); int vs_repaint(SCR *, EVENT *); int vs_refresh(SCR *, int); int vs_column(SCR *, size_t *); size_t vs_screens(SCR *, recno_t, size_t *); size_t vs_columns(SCR *, CHAR_T *, recno_t, size_t *, size_t *); size_t vs_rcm(SCR *, recno_t, int); size_t vs_colpos(SCR *, recno_t, size_t); int vs_change(SCR *, recno_t, lnop_t); int vs_sm_fill(SCR *, recno_t, pos_t); int vs_sm_scroll(SCR *, MARK *, recno_t, scroll_t); int vs_sm_1up(SCR *); int vs_sm_1down(SCR *); int vs_sm_next(SCR *, SMAP *, SMAP *); int vs_sm_prev(SCR *, SMAP *, SMAP *); int vs_sm_cursor(SCR *, SMAP **); int vs_sm_position(SCR *, MARK *, u_long, pos_t); recno_t vs_sm_nlines(SCR *, SMAP *, recno_t, size_t); int vs_split(SCR *, SCR *, int); int vs_vsplit(SCR *, SCR *); int vs_discard(SCR *, SCR **); int vs_fg(SCR *, SCR **, CHAR_T *, int); int vs_bg(SCR *); int vs_swap(SCR *, SCR **, char *); int vs_resize(SCR *, long, adj_t);
/* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) #error "Only <gtk/gtk.h> can be included directly." #endif #ifndef __GTK_MISC_H__ #define __GTK_MISC_H__ #include <gtk/gtkwidget.h> G_BEGIN_DECLS #define GTK_TYPE_MISC (gtk_misc_get_type ()) #define GTK_MISC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MISC, GtkMisc)) #define GTK_MISC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MISC, GtkMiscClass)) #define GTK_IS_MISC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MISC)) #define GTK_IS_MISC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MISC)) #define GTK_MISC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MISC, GtkMiscClass)) typedef struct _GtkMisc GtkMisc; typedef struct _GtkMiscPrivate GtkMiscPrivate; typedef struct _GtkMiscClass GtkMiscClass; struct _GtkMisc { GtkWidget widget; /*< private >*/ GtkMiscPrivate *priv; }; struct _GtkMiscClass { GtkWidgetClass parent_class; /* Padding for future expansion */ void (*_gtk_reserved1) (void); void (*_gtk_reserved2) (void); void (*_gtk_reserved3) (void); void (*_gtk_reserved4) (void); }; GType gtk_misc_get_type (void) G_GNUC_CONST; void gtk_misc_set_alignment (GtkMisc *misc, gfloat xalign, gfloat yalign); void gtk_misc_get_alignment (GtkMisc *misc, gfloat *xalign, gfloat *yalign); void gtk_misc_set_padding (GtkMisc *misc, gint xpad, gint ypad); void gtk_misc_get_padding (GtkMisc *misc, gint *xpad, gint *ypad); void _gtk_misc_get_padding_and_border (GtkMisc *misc, GtkBorder *border); G_END_DECLS #endif /* __GTK_MISC_H__ */
// // XXDogeView.h // XXInterfaceBuilderBridgeDemo // // Created by sunnyxx on 14-7-2. // Copyright (c) 2014年 sunnyxx. All rights reserved. // #import <UIKit/UIKit.h> @interface XXDogeView : UIView @end
/*--------------------------------------------------------------------------- // // 3 Band EQ :) // // EQ.H - Header file for 3 band EQ // // (c) Neil C / Etanza Systems / 2K6 // // Shouts / Loves / Moans = etanza at lycos dot co dot uk // // This work is hereby placed in the public domain for all purposes, including // use in commercial applications. // // The author assumes NO RESPONSIBILITY for any problems caused by the use of // this software. // //----------------------------------------------------------------------------*/ #ifndef __EQ3BAND__ #define __EQ3BAND__ /* ------------ //| Structures | // ------------*/ typedef struct { /* Filter #1 (Low band) */ double lf; /* Frequency */ double f1p0; /* Poles ... */ double f1p1; double f1p2; double f1p3; /* Filter #2 (High band) */ double hf; /* Frequency */ double f2p0; /* Poles ... */ double f2p1; double f2p2; double f2p3; /* Sample history buffer */ double sdm1; /* Sample data minus 1 */ double sdm2; /* 2 */ double sdm3; /* 3 */ /* Gain Controls */ double lg; /* low gain */ double mg; /* mid gain */ double hg; /* high gain */ } EQSTATE; /* --------- //| Exports | // ---------*/ extern void init_3band_state(EQSTATE * es, int lowfreq, int highfreq, int mixfreq); extern double do_3band(EQSTATE * es, int sample); #endif /* #ifndef __EQ3BAND__ */
/*version.h =========*/ #define MAJOR_VERSION "1" #define MINOR_VERSION "16"
#include "stdint.h" #include "string.h" #include "stdio.h" static char *_val_for_vid(uint32_t *nodes, uint32_t *kids, uint32_t vid, char *rval) { char *curr = rval; uint32_t node = nodes[vid]; uint32_t kid_offset = (uint32_t )0x00ffffff & node; uint32_t parent = kids[kid_offset++]; if (parent) { curr = _val_for_vid(nodes, kids, parent, rval); } uint16_t *radix = (uint16_t *)&kids[kid_offset]; char *radix_chars = (char *)(radix + 1); memcpy(curr, radix_chars, *radix); curr += *radix; return curr; } int value_for_vid(uint32_t *nodes, uint32_t *kids, uint32_t vid, char *result, size_t *rlen) { char *end = _val_for_vid(nodes, kids, vid, result); *rlen = end - result; return 0; } static uint32_t _find_binary(uint32_t *knodes, uint8_t kid_len, unsigned char selector) { int lower = 0; int upper = kid_len - 1; while (lower <= upper) { int mid = lower + ((upper - lower) / 2); // unpack the node - the high order byte is the selector for those children uint32_t knode = knodes[mid]; unsigned char rselect = (unsigned char) (knode >> 24); uint32_t node = ((uint32_t)0x00ffffff) & knode; if (rselect == selector) { return node; } else if (rselect < selector) { lower = mid + 1; } else{ upper = mid - 1; } } return 0; } static uint32_t _vid_for_value(uint32_t *nodes, uint32_t *kids, uint32_t vid, char *key, uint16_t key_len) { if (!key_len) { return vid; } uint32_t node = nodes[vid]; uint8_t kid_len = (uint8_t)(node >> 24); uint32_t kid_offset = ((uint32_t )0x00ffffff & node) + 1; uint16_t *radix = (uint16_t *)&kids[kid_offset]; uint16_t radix_len = *radix; uint16_t i; // we need to compare the radix to the key if (radix_len <= key_len) { char *radix_chars = (char *)(radix + 1); for (i = 0; i < radix_len; i++) { if (radix_chars[i] != key[i]) { return 0; } } // did we find the VID? if (radix_len == key_len) { return vid; } // we have a matching radix, take the 'rest' of the key and match with it's children char *selector = key + radix_len; uint16_t selector_len = key_len - radix_len; uint16_t width = 2 + radix_len; kid_offset += width / 4; if (width % 4) { kid_offset++; } uint32_t *knodes = kids + kid_offset; uint32_t knode = _find_binary(knodes, kid_len, (unsigned char)(*selector)); if (knode) { return _vid_for_value(nodes, kids, knode, selector, selector_len); } } return 0; } int vid_for_value(uint32_t *nodes, uint32_t *kids, char *key, uint16_t key_len, uint32_t *vid) { uint32_t node = _vid_for_value(nodes, kids, 0, key, key_len); if (node) { *vid = node; return 0; } return -1; } static void _print_it(uint32_t *nodes, uint32_t *kids, uint32_t curr_node, unsigned char selector, int depth) { int i; uint32_t node = nodes[curr_node]; uint8_t kid_len = (uint8_t)(node >> 24); uint32_t kid_offset = (uint32_t )0x00ffffff & node; uint32_t *kid = kids + kid_offset; uint32_t parent = kid[0]; uint16_t radix_len = ((uint16_t *)kid)[2]; for(i = 0; i < depth; ++i) { printf(" "); } if(radix_len > 0) { char *radix = ((char *)kid) + 6; printf("%d '%.*s' ", radix_len, radix_len, radix); } else { printf("<none> "); } printf("%d(%d) '%c'(0x%x) - %d\n", curr_node, parent, selector, selector, kid_len); // pad uint32_t child_offset = 6 + radix_len; child_offset += (4 - (child_offset % 4)) % 4; child_offset /= 4; // process kids uint32_t *children = kid + child_offset; for(i = 0; i < kid_len; ++i) { uint32_t child = children[i]; unsigned char sel = (unsigned char)(child >> 24); uint32_t new_node = child & 0x00ffffff; _print_it(nodes, kids, new_node, sel, depth + 1); } } void print_it(uint32_t *nodes, uint32_t *kids) { _print_it(nodes, kids, 0, '\0', 0); } void summarize(uint32_t *nodes, uint32_t *kids, int num_nodes) { int i; printf("Summarize nodes=%p kids=%p num_nodes=%d\n", nodes, kids, num_nodes); for(i = 0; i < num_nodes; ++i) { uint32_t node = nodes[i]; uint8_t kid_len = (uint8_t)(node >> 24); uint32_t kid_offset = (uint32_t )0x00ffffff & node; uint32_t *kid = kids + kid_offset; uint32_t parent = kid[0]; uint16_t radix_len = ((uint16_t *)kid)[2]; printf("%d %d | %d ", kid_len, kid_offset, parent); if(radix_len > 0) { char *radix = ((char *)kid) + 6; printf("%d '%.*s'\n", radix_len, radix_len, radix); } else { printf("0 ''\n"); } //printf("%d %d(%d) - %d, %d\n", i, node, parent, kid_len, kid_offset); } }