text
stringlengths
4
6.14k
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_console_execl_04.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-04.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: console Read input from the console * GoodSource: Fixed string * Sink: execl * BadSink : execute command with execl * Flow Variant: 04 Control flow: if(STATIC_CONST_TRUE) and if(STATIC_CONST_FALSE) * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "-c" #define COMMAND_ARG2 "ls " #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <process.h> #define EXECL _execl #else /* NOT _WIN32 */ #define EXECL execl #endif /* The two variables below are declared "const", so a tool should * be able to identify that reads of these will always return their * initialized values. */ static const int STATIC_CONST_TRUE = 1; /* true */ static const int STATIC_CONST_FALSE = 0; /* false */ #ifndef OMITBAD void CWE78_OS_Command_Injection__char_console_execl_04_bad() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; if(STATIC_CONST_TRUE) { { /* Read input from the console */ size_t dataLen = strlen(data); /* if there is room in data, read into it from the console */ if (100-dataLen > 1) { /* POTENTIAL FLAW: Read data from the console */ if (fgets(data+dataLen, (int)(100-dataLen), stdin) != NULL) { /* The next few lines remove the carriage return from the string that is * inserted by fgets() */ dataLen = strlen(data); if (dataLen > 0 && data[dataLen-1] == '\n') { data[dataLen-1] = '\0'; } } else { printLine("fgets() failed"); /* Restore NUL terminator if fgets fails */ data[dataLen] = '\0'; } } } } /* execl - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECL(COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the STATIC_CONST_TRUE to STATIC_CONST_FALSE */ static void goodG2B1() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; if(STATIC_CONST_FALSE) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } /* execl - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECL(COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL); } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; if(STATIC_CONST_TRUE) { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } /* execl - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECL(COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL); } void CWE78_OS_Command_Injection__char_console_execl_04_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE78_OS_Command_Injection__char_console_execl_04_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__char_console_execl_04_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* This software is released under the BSD License. | | Copyright (c) 2009, Kevin P. Barry [the resourcerver project] | 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 Resourcerver Project nor the names of its | contributors may be used to endorse or promote products derived from this | software without specific prior written permission. | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | POSSIBILITY OF SUCH DAMAGE. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #ifndef local_check_h #define local_check_h #include "attributes.h" #include "local-types.h" #include "api-command.h" inline result ATTR_INL allow_create_builtin(permission_mask rRequire, permission_mask eExclude) { return check_command_all(local_type(), rRequire) && check_command_none(local_type(), eExclude); } inline result ATTR_INL allow_parse_builtin(permission_mask rRequire, permission_mask eExclude) { return is_server() || (check_command_all(local_type(), rRequire) && check_command_none(local_type(), eExclude)); } inline result ATTR_INL allow_create_plugin(permission_mask rRequire) { return check_command_any(local_type(), rRequire); } inline result ATTR_INL allow_parse_plugin(permission_mask rRequire) { return is_server() || check_command_any(local_type(), rRequire); } inline result ATTR_INL check_valid_type(command_type tType) { if ( check_command_all(tType, command_server) && ( check_command_all(tType, command_null) || check_command_all(tType, command_request) || check_command_all(tType, command_response) ) ) return 0; if (check_command_all(tType, command_request | command_response)) return 0; if (check_command_all(tType, command_request | command_null)) return 0; if (check_command_all(tType, command_response | command_null)) return 0; return check_command_any(tType, command_all); } inline result ATTR_INL allow_execute_server(command_type tType) { if (!is_server()) return 0; if (check_command_all(tType, command_plugin)) return 0; if (!check_command_all(tType, command_builtin)) return 0; if (!check_command_any(tType, command_server | command_response)) return 0; if (check_command_all(tType, command_privileged)) return 0; if (!check_valid_type(tType)) return 0; return 1; } inline result ATTR_INL allow_execute_client(command_type tType) { if (is_server()) return 0; if (check_command_all(tType, command_server)) return 0; if (check_command_all(tType, command_plugin | command_privileged)) return 0; if (!check_valid_type(tType)) return 0; return 1; } inline result ATTR_INL allow_override_priority(command_type tType) { return !check_command_all(tType, command_plugin); } #endif /*local_check_h*/
// Copyright (c) 2016, Mads Sig Ager. // All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #ifndef SRC_OPTIONS_H_ #define SRC_OPTIONS_H_ #include <string.h> namespace dexgrok { class Options { public: Options(int argc, char** argv) : file_name_(nullptr) , dump_(false) , rewrite_(false) , output_(nullptr) { for (int i = 1; i < argc; i++) { char* arg = argv[i]; if (strncmp(arg, "--", 2) == 0) { if (strncmp(arg + 2, "dump", 13) == 0) { dump_ = true; continue; } if (strncmp(arg + 2, "output=", 7) == 0) { output_ = arg + 2 + 7; continue; } if (strncmp(arg + 2, "rewrite", 7) == 0) { rewrite_ = true; continue; } } else { file_name_ = arg; } } if (file_name_ == nullptr) { printf("No dex file provided.\n"); exit(1); } } char* file_name() const { return file_name_; } bool dump() const { return dump_; } bool rewrite() const { return rewrite_; } char* output() const { return output_; } private: char* file_name_; bool dump_; bool rewrite_; char* output_; }; } #endif // SRC_OPTIONS_H_
#ifndef ATREEVIEW_H #define ATREEVIEW_H typedef bool (*FWalkTreeItemFunc)(ATreeViewItem* pItem,void* pArg);//·µ»Øfalseʱֹͣ±éÀú class AUI_API ATreeView: public AContainer { CLASS_INFO(TreeView,Container); friend class ATreeViewEnumerator; friend class ATreeViewItem; public: ATreeView(AComponent* pOwner); virtual ~ATreeView(); virtual void SetIndent(int v); virtual int GetIndent(); virtual ATreeViewItem* GetHoveredItem(); virtual ATreeViewItem* AddItem(ATreeViewItem* pParentItem=NULL,AString sText=_T("")); virtual void DoLayout(); virtual void WalkItem(FWalkTreeItemFunc f,void* pArg); virtual ATreeViewItem* GetSelected(); virtual void SetSelected(ATreeViewItem* pItem); virtual void RemoveItem(ATreeViewItem* pItem); virtual void RemoveAllItem(); virtual void SetImageList(AImageList* pImageList); virtual AImageList* GetImageList(); virtual void SetPropFromNode(AMLBody* pNode); virtual void CreateChildren(AMLBody* pNode); virtual void MakeVisible(ATreeViewItem* pItem); //¶ÔESµÄÖ§³Ö virtual void ESGet(const AString& sPath,AUI_ES_VALUE_INTF* pValue); virtual void ESSet(const AString& sPath,AUI_ES_VALUE_INTF* pValue); virtual void ESCall(const AString& sPath,AUI_ES_VALUE_GROUP_INTF* args,AUI_ES_VALUE_INTF* pRetValue); AEventHandler OnChange;//Ñ¡ÖÐÏî¸Ä±ä protected: virtual void DoPaint(ACanvas* cs,AEvent* pEvent); int _calcItem(ATreeViewItem* pItem,ACanvas* pCanvas); bool _walkItem(ATreeViewItem* pItem,FWalkTreeItemFunc f,void* pArg); AArray m_aChild; ATreeViewItem* m_pHoveredItem; ATreeViewItem* m_pSelectedItem; int m_iIndent; AImageList* m_pImageList; virtual void ESSetValue(AMLBody* pNode); virtual void ESGetValue(AMLBody* pNode); }; class AUI_API ATreeViewEnumerator : public AObject { CLASS_INFO(TreeViewEnumerator,Object); public: ATreeViewEnumerator(ATreeView* pView); virtual ~ATreeViewEnumerator(); bool Next(); ATreeViewItem* Cur(); private: ATreeView* m_pView; bool m_bEnd; ATreeViewItem* m_pCurItem;//µ±Ç°½Úµã int m_iIndex;//µ±Ç°½ÚµãÔÚͬ¼¶¡°×ӽڵ㼯ºÏÖС±µÄϱê AArray m_aParentIndex;//¸¸½ÚµãÔÚËüµÄͬ¼¶¡°×ӽڵ㼯ºÏ¡±ÖеÄϱê bool NextNode(ATreeViewItem* pNode);//¸ù¾Ýµ±Ç°½Úµã¶¨Î»µ½ÏÂÒ»¸ö±éÀú½Úµã }; #endif//ATREEVIEW_H
/* * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. * Copyright (C) 2008 Rob Buis <buis@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 RenderSVGInlineText_h #define RenderSVGInlineText_h #if ENABLE(SVG) #include "Font.h" #include "RenderText.h" #include "SVGTextLayoutAttributes.h" #include "Text.h" namespace WebCore { class SVGInlineTextBox; class RenderSVGInlineText FINAL : public RenderText { public: RenderSVGInlineText(Text&, const String&); Text& textNode() const { return toText(nodeForNonAnonymous()); } bool characterStartsNewTextChunk(int position) const; SVGTextLayoutAttributes* layoutAttributes() { return &m_layoutAttributes; } float scalingFactor() const { return m_scalingFactor; } const Font& scaledFont() const { return m_scaledFont; } void updateScaledFont(); static void computeNewScaledFontForStyle(RenderObject*, const RenderStyle*, float& scalingFactor, Font& scaledFont); // Preserves floating point precision for the use in DRT. It knows how to round and does a better job than enclosingIntRect. FloatRect floatLinesBoundingBox() const; private: virtual const char* renderName() const OVERRIDE { return "RenderSVGInlineText"; } virtual void setTextInternal(const String&) OVERRIDE; virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE; virtual FloatRect objectBoundingBox() const OVERRIDE { return floatLinesBoundingBox(); } virtual bool isSVGInlineText() const OVERRIDE { return true; } virtual VisiblePosition positionForPoint(const LayoutPoint&) OVERRIDE; virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) OVERRIDE; virtual IntRect linesBoundingBox() const OVERRIDE; virtual InlineTextBox* createTextBox() OVERRIDE; float m_scalingFactor; Font m_scaledFont; SVGTextLayoutAttributes m_layoutAttributes; }; inline RenderSVGInlineText& toRenderSVGInlineText(RenderObject& object) { ASSERT_WITH_SECURITY_IMPLICATION(object.isSVGInlineText()); return static_cast<RenderSVGInlineText&>(object); } inline const RenderSVGInlineText& toRenderSVGInlineText(const RenderObject& object) { ASSERT_WITH_SECURITY_IMPLICATION(object.isSVGInlineText()); return static_cast<const RenderSVGInlineText&>(object); } inline RenderSVGInlineText* toRenderSVGInlineText(RenderObject* object) { ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGInlineText()); return static_cast<RenderSVGInlineText*>(object); } inline const RenderSVGInlineText* toRenderSVGInlineText(const RenderObject* object) { ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGInlineText()); return static_cast<const RenderSVGInlineText*>(object); } // This will catch anyone doing an unnecessary cast. void toRenderSVGInlineText(const RenderSVGInlineText*); } #endif // ENABLE(SVG) #endif // RenderSVGInlineText_h
/** * @file qsort.c * @brief Implementation of the Quicksort algorithm * @author Philip J. Erdelsky * */ void QuickSort (void *base, int count, int size, int (*compare) (const void *, const void *, void *), void *pointer); static void InternalQuickSort (char *left, char *right, size_t size, int (*compare) (const void *, const void *, void *), void *pointer) { char *p = left, *q = right, *t = left; while (1) { while ((*compare)(p, t, pointer) < 0) p += size; while ((*compare)(q, t, pointer) > 0) q -= size; if (p > q) break; if (p < q) { int i; for (i = 0; i < size; i++) { char x = p[i]; p[i] = q[i]; q[i] = x; } if (t == p) t = q; else if (t == q) t = p; } p += size; q -= size; } if (left < q) InternalQuickSort(left, q, size, compare, pointer); if (p < right) InternalQuickSort(p, right, size, compare, pointer); } void QuickSort(void *base, int count, size_t size, int (*compare) (const void *, const void *, void *), void *pointer) { if (count > 1) { InternalQuickSort((char *) base, (char *) base + (count - 1) * size, size, compare, pointer); } }
/* -*- c++ -*- */ //============================================================================= /** * @file HTTP_Helpers.h * * @author James Hu */ //============================================================================= #ifndef HTTP_HELPERS_H #define HTTP_HELPERS_H #include "ace/Synch_Traits.h" #include "ace/Thread_Mutex.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ /** * @class HTTP_Helper Static functions to enhance the lives of HTTP programmers everywhere. */ class HTTP_Helper { public: // Convert and HTTP-date into a time_t static time_t HTTP_mktime (const char *httpdate); // Create today's date static const char *HTTP_date (void); static const char *HTTP_date (char *s); // Month conversions (ascii <--> numeric) static int HTTP_month (const char *month); static const char *HTTP_month (int month); static char *HTTP_decode_string (char *path); // Encode/Decode base64 stuff (weak security model) static char *HTTP_decode_base64 (char *data); static char *HTTP_encode_base64 (char *data); private: static int fixyear (int year); private: static const char *const months_[12]; static char const *alphabet_; /// Use this sometimes (e.g. HTTP_date) static char *date_string_; static ACE_SYNCH_MUTEX mutex_; }; // Design around the Singleton pattern /** * @class HTTP_Status_Code * * @brief Go from numeric status codes to descriptive strings. * * Design around the Singleton pattern */ class HTTP_Status_Code { public: /// Singleton access point. static const char **instance (void); enum STATUS_CODE { STATUS_OK = 200, STATUS_CREATED = 201, STATUS_ACCEPTED = 202, STATUS_NO_CONTENT = 204, STATUS_MOVED_PERMANENTLY = 301, STATUS_MOVED_TEMPORARILY = 302, STATUS_NOT_MODIFIED = 304, STATUS_BAD_REQUEST = 400, STATUS_UNAUTHORIZED = 401, STATUS_FORBIDDEN = 403, STATUS_NOT_FOUND = 404, STATUS_INTERNAL_SERVER_ERROR = 500, STATUS_NOT_IMPLEMENTED = 501, STATUS_BAD_GATEWAY = 502, STATUS_SERVICE_UNAVAILABLE = 503, STATUS_INSUFFICIENT_DATA = 399 }; enum { MAX_STATUS_CODE = 599 }; private: // Singleton pattern is afoot here. static const char *Reason[MAX_STATUS_CODE + 1]; static int instance_; static ACE_SYNCH_MUTEX lock_; }; #endif /* HTTP_HELPERS_H */
#if !defined(PROTO_AMISSL_H) && !defined(AMISSL_COMPILE) #include <proto/amissl.h> #endif /* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_UIERR_H # define OPENSSL_UIERR_H # if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) # pragma once # endif # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * UI reason codes. */ # define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 # define UI_R_INDEX_TOO_LARGE 102 # define UI_R_INDEX_TOO_SMALL 103 # define UI_R_NO_RESULT_BUFFER 105 # define UI_R_PROCESSING_ERROR 107 # define UI_R_RESULT_TOO_LARGE 100 # define UI_R_RESULT_TOO_SMALL 101 # define UI_R_SYSASSIGN_ERROR 109 # define UI_R_SYSDASSGN_ERROR 110 # define UI_R_SYSQIOW_ERROR 111 # define UI_R_UNKNOWN_CONTROL_COMMAND 106 # define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE 108 # define UI_R_USER_DATA_DUPLICATION_UNSUPPORTED 112 #endif
/* $KAME: main.c,v 1.12 2002/04/26 05:42:59 fujisawa Exp $ */ /* * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 and 2001 WIDE Project. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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 <ctype.h> #include <err.h> #include <netdb.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netinet/in.h> #include "cfparse.h" #include "defs.h" #include "miscvar.h" #include "showvar.h" int u_debug; extern int verbose; char *parseArgument __P((int, char *[])); int prepParse __P((char *)); void printDirectiveHelp __P((void)); void printPrefixHelp __P((void)); void printMapHelp __P((void)); void printSetHelp __P((void)); void printShowHelp __P((void)); void printTestHelp __P((void)); void init_main __P((void)); /* * */ int main(int argc, char *argv[]) { char *fname = NULL; extern int yyerrno; extern int yylineno; extern char *yyfilename; init_main(); if ((fname = parseArgument(argc, argv)) == NULL) { yyfilename = "commandline"; yylineno = 0; yyparse(); } else { FILE *fp = NULL; char buf[BUFSIZ]; fp = stdin; yyfilename = "stdin"; if (strcmp(fname, "-") != 0) { if ((fp = fopen(fname, "r")) == NULL) err(1, "fopen failure"); yyfilename = fname; } yylineno = 0; while (fgets(buf, sizeof(buf), fp)) { yylineno++; if (prepParse(buf) == TRUE) { switchToBuffer(buf); yyparse(); } } fclose(fp); } clean_misc(); clean_show(); if (yyerrno && verbose) fprintf(stderr, "%d error(s) detected.\n", yyerrno); return (yyerrno); } char * parseArgument(int argc, char *argv[]) { int ch; char *fname = NULL; extern int optind; extern char *optarg; while ((ch = getopt(argc, argv, "d:f:q")) != -1) { switch (ch) { case 'd': u_debug = strtoul(optarg, NULL, 0); #ifdef YYDEBUG { extern int yydebug; if (isDebug(D_YYDEBUG)) { yydebug = 1; } } #endif break; case 'f': fname = optarg; break; case 'q': verbose = 0; break; default: break; } } argc -= optind; argv += optind; if (argc) { reassembleCommandLine(argc, argv); return (NULL); } return (fname); } int prepParse(char *line) { char *d; d = line; while (*d == ' ' || *d == '\t') d++; if (*d == '#' || *d == '\n' || *d == '\0') return (FALSE); return (TRUE); } void printHelp(int type, char *complaint) { if ((complaint != NULL) && (isprint(*complaint) != 0)) { printf("%s\n", complaint); } switch (type) { case SQUESTION: printDirectiveHelp(); break; case SPREFIX: printPrefixHelp(); break; case SMAP: printMapHelp(); break; case SSET: printSetHelp(); break; case SSHOW: printShowHelp(); break; case STEST: printTestHelp(); break; } } void printDirectiveHelp() { printf("Available directives are\n"); printf(" prefix Set NAT-PT prefix.\n"); printf(" map Set translation rule.\n"); printf(" show Show settings.\n"); printf(" test Test log system.\n"); printf("\n"); } void printPrefixHelp() { printf(" prefix <ipv6addr>\n"); } void printMapHelp() { printf(" map flush\n"); printf(" map {enable|disable}\n"); } void printSetHelp() { printf(" set natpt_debug=<value>\n"); printf(" set natpt_dump=<value>\n"); } void printShowHelp() { printf(" show fragment (aka force_fragment4)\n"); printf(" show prefix\n"); printf(" show rules\n"); printf(" show xlate [\"long\"] [<interval>]\n"); printf(" show variables\n"); printf(" show mapping\n"); } void printTestHelp() { printf(" test log\n"); printf(" test log <name>\n"); printf(" test log \"string\"\n"); } void init_main() { verbose = 1; init_misc(); }
#ifndef LIBBINPAC_MISC_H #include "libbinpac++.h" hlt_string binpac_fmt_string(hlt_string fmt, const hlt_type_info* type, void* tuple, hlt_exception** excpt, hlt_execution_context* ctx); hlt_bytes* binpac_fmt_bytes(hlt_bytes* fmt, const hlt_type_info* type, void* tuple, hlt_exception** excpt, hlt_execution_context* ctx); #endif
/***************************************************************************** * * C++ interface/implementation created by Martin Kojtal (0xc0170). Thanks to * Jim Carver and Frank Vannieuwkerke for their inital cc3000 mbed port and * provided help. * * This version of "host driver" uses CC3000 Host Driver Implementation. Thus * read the following copyright: * * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ * * 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 Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *****************************************************************************/ #ifndef CC3000_EVENT_H #define CC3000_EVENT_H typedef struct _bsd_read_return_t { int32_t iSocketDescriptor; int32_t iNumberOfBytes; uint32_t uiFlags; } tBsdReadReturnParams; typedef struct _bsd_getsockopt_return_t { uint8_t ucOptValue[4]; uint8_t iStatus; } tBsdGetSockOptReturnParams; typedef struct _bsd_accept_return_t { int32_t iSocketDescriptor; int32_t iStatus; sockaddr tSocketAddress; } tBsdReturnParams; typedef struct _bsd_select_return_t { int32_t iStatus; uint32_t uiRdfd; uint32_t uiWrfd; uint32_t uiExfd; } tBsdSelectRecvParams; typedef struct _bsd_gethostbyname_return_t { int32_t retVal; int32_t outputAddress; } tBsdGethostbynameParams; #define FLOW_CONTROL_EVENT_HANDLE_OFFSET (0) #define FLOW_CONTROL_EVENT_BLOCK_MODE_OFFSET (1) #define FLOW_CONTROL_EVENT_FREE_BUFFS_OFFSET (2) #define FLOW_CONTROL_EVENT_SIZE (4) #define BSD_RSP_PARAMS_SOCKET_OFFSET (0) #define BSD_RSP_PARAMS_STATUS_OFFSET (4) #define GET_HOST_BY_NAME_RETVAL_OFFSET (0) #define GET_HOST_BY_NAME_ADDR_OFFSET (4) #define ACCEPT_SD_OFFSET (0) #define ACCEPT_RETURN_STATUS_OFFSET (4) #define ACCEPT_ADDRESS__OFFSET (8) #define SL_RECEIVE_SD_OFFSET (0) #define SL_RECEIVE_NUM_BYTES_OFFSET (4) #define SL_RECEIVE__FLAGS__OFFSET (8) #define SELECT_STATUS_OFFSET (0) #define SELECT_READFD_OFFSET (4) #define SELECT_WRITEFD_OFFSET (8) #define SELECT_EXFD_OFFSET (12) #define NETAPP_IPCONFIG_IP_OFFSET (0) #define NETAPP_IPCONFIG_SUBNET_OFFSET (4) #define NETAPP_IPCONFIG_GW_OFFSET (8) #define NETAPP_IPCONFIG_DHCP_OFFSET (12) #define NETAPP_IPCONFIG_DNS_OFFSET (16) #define NETAPP_IPCONFIG_MAC_OFFSET (20) #define NETAPP_IPCONFIG_SSID_OFFSET (26) #define NETAPP_IPCONFIG_IP_LENGTH (4) #define NETAPP_IPCONFIG_MAC_LENGTH (6) #define NETAPP_IPCONFIG_SSID_LENGTH (32) #define NETAPP_PING_PACKETS_SENT_OFFSET (0) #define NETAPP_PING_PACKETS_RCVD_OFFSET (4) #define NETAPP_PING_MIN_RTT_OFFSET (8) #define NETAPP_PING_MAX_RTT_OFFSET (12) #define NETAPP_PING_AVG_RTT_OFFSET (16) #define GET_SCAN_RESULTS_TABlE_COUNT_OFFSET (0) #define GET_SCAN_RESULTS_SCANRESULT_STATUS_OFFSET (4) #define GET_SCAN_RESULTS_ISVALID_TO_SSIDLEN_OFFSET (8) #define GET_SCAN_RESULTS_FRAME_TIME_OFFSET (10) #define GET_SCAN_RESULTS_SSID_MAC_LENGTH (38) #define M_BSD_RESP_PARAMS_OFFSET(hci_event_hdr)((uint8_t *)(hci_event_hdr) + HCI_EVENT_HEADER_SIZE) #define SOCKET_STATUS_ACTIVE 0 #define SOCKET_STATUS_INACTIVE 1 /* Init socket_active_status = 'all ones': init all sockets with SOCKET_STATUS_INACTIVE. Will be changed by 'set_socket_active_status' upon 'connect' and 'accept' calls */ #define SOCKET_STATUS_INIT_VAL 0xFFFF #define M_IS_VALID_SD(sd) ((0 <= (sd)) && ((sd) <= 7)) #define M_IS_VALID_STATUS(status) (((status) == SOCKET_STATUS_ACTIVE)||((status) == SOCKET_STATUS_INACTIVE)) #define BSD_RECV_FROM_FROMLEN_OFFSET (4) #define BSD_RECV_FROM_FROM_OFFSET (16) #endif
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_BASE_IME_MOCK_INPUT_METHOD_H_ #define UI_BASE_IME_MOCK_INPUT_METHOD_H_ #include "base/compiler_specific.h" #include "base/component_export.h" #include "base/macros.h" #include "base/observer_list.h" #include "build/build_config.h" #include "ui/base/ime/input_method.h" #include "ui/base/ime/input_method_observer.h" #include "ui/base/ime/virtual_keyboard_controller_stub.h" namespace ui { class KeyEvent; class TextInputClient; // A mock ui::InputMethod implementation for testing. You can get the instance // of this class as the global input method with calling // SetUpInputMethodFactoryForTesting() which is declared in // ui/base/ime/init/input_method_factory.h class COMPONENT_EXPORT(UI_BASE_IME) MockInputMethod : public InputMethod { public: explicit MockInputMethod(internal::InputMethodDelegate* delegate); MockInputMethod(const MockInputMethod&) = delete; MockInputMethod& operator=(const MockInputMethod&) = delete; ~MockInputMethod() override; // Overriden from InputMethod. void SetDelegate(internal::InputMethodDelegate* delegate) override; void OnFocus() override; void OnBlur() override; #if defined(OS_WIN) bool OnUntranslatedIMEMessage(const CHROME_MSG event, NativeEventResult* result) override; void OnInputLocaleChanged() override; bool IsInputLocaleCJK() const override; #endif void SetFocusedTextInputClient(TextInputClient* client) override; void DetachTextInputClient(TextInputClient* client) override; TextInputClient* GetTextInputClient() const override; ui::EventDispatchDetails DispatchKeyEvent(ui::KeyEvent* event) override; void OnTextInputTypeChanged(const TextInputClient* client) override; void OnCaretBoundsChanged(const TextInputClient* client) override; void CancelComposition(const TextInputClient* client) override; TextInputType GetTextInputType() const override; bool IsCandidatePopupOpen() const override; void ShowVirtualKeyboardIfEnabled() override; void SetVirtualKeyboardVisibilityIfEnabled(bool should_show) override; void AddObserver(InputMethodObserver* observer) override; void RemoveObserver(InputMethodObserver* observer) override; VirtualKeyboardController* GetVirtualKeyboardController() override; private: TextInputClient* text_input_client_; base::ObserverList<InputMethodObserver>::Unchecked observer_list_; internal::InputMethodDelegate* delegate_; VirtualKeyboardControllerStub keyboard_controller_; }; } // namespace ui #endif // UI_BASE_IME_MOCK_INPUT_METHOD_H_
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_DISPATCHER_H_ #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_DISPATCHER_H_ #include "base/callback.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/prefs/pref_member.h" #include "components/password_manager/core/browser/credential_manager_password_form_manager.h" #include "components/password_manager/core/browser/credential_manager_pending_request_task.h" #include "components/password_manager/core/browser/credential_manager_pending_require_user_mediation_task.h" #include "components/password_manager/core/browser/password_store_consumer.h" #include "content/public/browser/web_contents_observer.h" class GURL; namespace autofill { struct PasswordForm; } namespace content { class WebContents; } namespace password_manager { class CredentialManagerPasswordFormManager; class PasswordManagerClient; class PasswordManagerDriver; class PasswordStore; struct CredentialInfo; class CredentialManagerDispatcher : public content::WebContentsObserver, public CredentialManagerPasswordFormManagerDelegate, public CredentialManagerPendingRequestTaskDelegate, public CredentialManagerPendingRequireUserMediationTaskDelegate { public: CredentialManagerDispatcher(content::WebContents* web_contents, PasswordManagerClient* client); ~CredentialManagerDispatcher() override; // Called in response to an IPC from the renderer, triggered by a page's call // to 'navigator.credentials.notifyFailedSignIn'. virtual void OnNotifyFailedSignIn(int request_id, const password_manager::CredentialInfo&); // Called in response to an IPC from the renderer, triggered by a page's call // to 'navigator.credentials.notifySignedIn'. virtual void OnNotifySignedIn(int request_id, const password_manager::CredentialInfo&); // Called in response to an IPC from the renderer, triggered by a page's call // to 'navigator.credentials.requireUserMediation'. virtual void OnRequireUserMediation(int request_id); // Called in response to an IPC from the renderer, triggered by a page's call // to 'navigator.credentials.request'. // // TODO(vabr): Determine if we can drop the `const` here to save some copies // while processing the request. virtual void OnRequestCredential(int request_id, bool zero_click_only, const std::vector<GURL>& federations); // content::WebContentsObserver implementation. bool OnMessageReceived(const IPC::Message& message) override; using CredentialCallback = base::Callback<void(const autofill::PasswordForm&)>; // CredentialManagerPendingRequestTaskDelegate: bool IsZeroClickAllowed() const override; GURL GetOrigin() const override; void SendCredential(int request_id, const CredentialInfo& info) override; PasswordManagerClient* client() const override; // CredentialManagerPendingSignedOutTaskDelegate: PasswordStore* GetPasswordStore() override; void DoneRequiringUserMediation() override; // CredentialManagerPasswordFormManagerDelegate: void OnProvisionalSaveComplete() override; private: // Returns the driver for the current main frame. // Virtual for testing. virtual base::WeakPtr<PasswordManagerDriver> GetDriver(); PasswordManagerClient* client_; scoped_ptr<CredentialManagerPasswordFormManager> form_manager_; // Set to false to disable automatic signing in. BooleanPrefMember auto_signin_enabled_; // When 'OnRequestCredential' is called, it in turn calls out to the // PasswordStore; we push enough data into Pending*Task objects so that // they can properly respond to the request once the PasswordStore gives // us data. scoped_ptr<CredentialManagerPendingRequestTask> pending_request_; scoped_ptr<CredentialManagerPendingRequireUserMediationTask> pending_require_user_mediation_; DISALLOW_COPY_AND_ASSIGN(CredentialManagerDispatcher); }; } // namespace password_manager #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_DISPATCHER_H_
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_SELECTOR_H_ #define COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_SELECTOR_H_ #include <ostream> #include <string> #include <vector> #include "base/macros.h" #include "components/autofill_assistant/browser/client_status.h" #include "components/autofill_assistant/browser/service.pb.h" namespace autofill_assistant { // Convenience functions for creating SelectorProtos. SelectorProto ToSelectorProto(const std::string& s); SelectorProto ToSelectorProto(const std::vector<std::string>& s); // Returns the CSS name of a pseudo-type, without "::" prefix. std::string PseudoTypeName(PseudoType pseudoType); // Convenience wrapper around a SelectorProto that makes it simpler to work with // selectors. // // Selectors are comparables, can be used as std::map key or std::set elements // and converted to string with operator<<. struct Selector { SelectorProto proto; Selector(); ~Selector(); explicit Selector(const SelectorProto& proto); explicit Selector(const std::vector<std::string>& s) : Selector(ToSelectorProto(s)) {} Selector(Selector&& other); Selector(const Selector& other); Selector& operator=(Selector&& other); Selector& operator=(const Selector& other); bool operator<(const Selector& other) const; bool operator==(const Selector& other) const; // Convenience function to update the visible field in a fluent style. Selector& MustBeVisible(); // Checks whether this selector is empty or invalid. bool empty() const; // Convenience function to set inner_text_pattern in a fluent style. Selector& MatchingInnerText(const std::string& pattern) { return MatchingInnerText(pattern, false); } // Convenience function to set inner_text_pattern matching with case // sensitivity. Selector& MatchingInnerText(const std::string& pattern, bool case_sensitive) { auto* text_filter = proto.add_filters()->mutable_inner_text(); text_filter->set_re2(pattern); text_filter->set_case_sensitive(case_sensitive); return *this; } // Convenience function to set inner_text_pattern in a fluent style. Selector& MatchingValue(const std::string& pattern) { return MatchingValue(pattern, false); } // Convenience function to set value_pattern matchinng with case sensitivity. Selector& MatchingValue(const std::string& pattern, bool case_sensitive) { auto* text_filter = proto.add_filters()->mutable_value(); text_filter->set_re2(pattern); text_filter->set_case_sensitive(case_sensitive); return *this; } Selector& SetPseudoType(PseudoType pseudo_type) { proto.add_filters()->set_pseudo_type(pseudo_type); return *this; } }; // Debug output operator for selectors. The output is only useful in // debug builds. std::ostream& operator<<(std::ostream& out, const Selector& selector); // Debug output for selector protos. The output is only useful in // debug builds. std::ostream& operator<<(std::ostream& out, const SelectorProto& proto); // Debug output for selector filter protos. The output is only useful in // debug builds. std::ostream& operator<<(std::ostream& out, const SelectorProto::Filter& filter); } // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_SELECTOR_H_
/* * This software is distributed under BSD 3-clause license (see LICENSE file). * * Authors: Soeren Sonnenburg, Sergey Lisitsyn, Thoralf Klein, Yuyu Zhang */ #ifndef __SERIALIZABLE_ASCII_FILE_H__ #define __SERIALIZABLE_ASCII_FILE_H__ #include <shogun/lib/config.h> #include <shogun/io/SerializableFile.h> #include <shogun/base/DynArray.h> #include <shogun/lib/DataType.h> #include <shogun/lib/common.h> #define CHAR_CONT_BEGIN '(' #define CHAR_CONT_END ')' #define CHAR_ITEM_BEGIN '{' #define CHAR_ITEM_END '}' #define CHAR_SGSERIAL_BEGIN '[' #define CHAR_SGSERIAL_END ']' #define CHAR_STRING_BEGIN CHAR_SGSERIAL_BEGIN #define CHAR_STRING_END CHAR_SGSERIAL_END #define CHAR_SPARSE_BEGIN CHAR_CONT_BEGIN #define CHAR_SPARSE_END CHAR_CONT_END #define CHAR_TYPE_END '\n' #define STR_SGSERIAL_NULL "null" namespace shogun { template <class T> struct SGSparseVectorEntry; /** @brief serializable ascii file */ class CSerializableAsciiFile :public CSerializableFile { friend class SerializableAsciiReader00; DynArray<long> m_stack_fpos; void init(); bool ignore(); protected: /** new reader * @param dest_version * @param n */ virtual TSerializableReader* new_reader( char* dest_version, size_t n); #ifndef DOXYGEN_SHOULD_SKIP_THIS virtual bool write_scalar_wrapped( const TSGDataType* type, const void* param); virtual bool write_cont_begin_wrapped( const TSGDataType* type, index_t len_real_y, index_t len_real_x); virtual bool write_cont_end_wrapped( const TSGDataType* type, index_t len_real_y, index_t len_real_x); virtual bool write_string_begin_wrapped( const TSGDataType* type, index_t length); virtual bool write_string_end_wrapped( const TSGDataType* type, index_t length); virtual bool write_stringentry_begin_wrapped( const TSGDataType* type, index_t y); virtual bool write_stringentry_end_wrapped( const TSGDataType* type, index_t y); virtual bool write_sparse_begin_wrapped( const TSGDataType* type, index_t length); virtual bool write_sparse_end_wrapped( const TSGDataType* type, index_t length); virtual bool write_sparseentry_begin_wrapped( const TSGDataType* type, const SGSparseVectorEntry<char>* first_entry, index_t feat_index, index_t y); virtual bool write_sparseentry_end_wrapped( const TSGDataType* type, const SGSparseVectorEntry<char>* first_entry, index_t feat_index, index_t y); virtual bool write_item_begin_wrapped( const TSGDataType* type, index_t y, index_t x); virtual bool write_item_end_wrapped( const TSGDataType* type, index_t y, index_t x); virtual bool write_sgserializable_begin_wrapped( const TSGDataType* type, const char* sgserializable_name, EPrimitiveType generic); virtual bool write_sgserializable_end_wrapped( const TSGDataType* type, const char* sgserializable_name, EPrimitiveType generic); virtual bool write_type_begin_wrapped( const TSGDataType* type, const char* name, const char* prefix); virtual bool write_type_end_wrapped( const TSGDataType* type, const char* name, const char* prefix); #endif public: /** default constructor */ explicit CSerializableAsciiFile(); /** constructor * * @param fstream already opened file * @param rw */ explicit CSerializableAsciiFile(FILE* fstream, char rw); /** constructor * * @param fname filename to open * @param rw mode, 'r' or 'w' */ explicit CSerializableAsciiFile(const char* fname, char rw='r'); /** default destructor */ virtual ~CSerializableAsciiFile(); /** @return object name */ virtual const char* get_name() const { return "SerializableAsciiFile"; } }; } #endif /* __SERIALIZABLE_ASCII_FILE_H__ */
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_IMAGE_WINDOW_DELEGATE_H_ #define CONTENT_BROWSER_WEB_CONTENTS_AURA_IMAGE_WINDOW_DELEGATE_H_ #include "content/common/content_export.h" #include "ui/aura/window_delegate.h" #include "ui/gfx/image/image.h" #include "ui/gfx/size.h" namespace content { // An ImageWindowDelegate paints an image for a Window. The delegate destroys // itself when the Window is destroyed. The delegate does not consume any event. class CONTENT_EXPORT ImageWindowDelegate : public aura::WindowDelegate { public: ImageWindowDelegate(); void SetImage(const gfx::Image& image); bool has_image() const { return !image_.IsEmpty(); } protected: virtual ~ImageWindowDelegate(); // Overridden from aura::WindowDelegate: virtual gfx::Size GetMinimumSize() const OVERRIDE; virtual gfx::Size GetMaximumSize() const OVERRIDE; virtual void OnBoundsChanged(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) OVERRIDE; virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; virtual bool ShouldDescendIntoChildForEventHandling( aura::Window* child, const gfx::Point& location) OVERRIDE; virtual bool CanFocus() OVERRIDE; virtual void OnCaptureLost() OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; virtual bool HasHitTestMask() const OVERRIDE; virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; virtual void DidRecreateLayer(ui::Layer* old_layer, ui::Layer* new_layer) OVERRIDE; protected: gfx::Image image_; gfx::Size window_size_; // Keeps track of whether the window size matches the image size or not. If // the image size is smaller than the window size, then the delegate paints a // white background for the missing regions. bool size_mismatch_; DISALLOW_COPY_AND_ASSIGN(ImageWindowDelegate); }; } // namespace content #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_IMAGE_WINDOW_DELEGATE_H_
/* $Id: of_codec_profile.h 199 2014-10-21 14:25:02Z roca $ */ /* * OpenFEC.org AL-FEC Library. * (c) Copyright 2009 - 2012 INRIA - All rights reserved * Contact: vincent.roca@inria.fr * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, * modify and/ or redistribute the software under the terms of the CeCILL-C * license as circulated by CEA, CNRS and INRIA at the following URL * "http://www.cecill.info". * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited * liability. * * In this respect, the user's attention is drawn to the risks associated * with loading, using, modifying and/or developing or reproducing the * software by the user in light of its specific status of free software, * that may mean that it is complicated to manipulate, and that also * therefore means that it is reserved for developers and experienced * professionals having in-depth computer knowledge. Users are therefore * encouraged to load and test the software's suitability as regards their * requirements in conditions enabling the security of their systems and/or * data to be ensured and, more generally, to use and operate it in the * same conditions as regards security. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ /****** GENERAL SETUP OPTIONS; EDIT AS APPROPRIATE ****************************/ #define OF_USE_LDPC_STAIRCASE_CODEC #ifdef OF_DEBUG /* additional parameter for memory statistic purposes */ #define MEM_STATS_ARG ,ofcb->stats #define MEM_STATS ,stats #else #define MEM_STATS_ARG #define MEM_STATS #endif /** * Define if you want to enable the use of the ML (Maximum Likelyhood) decoding. * If enabled, in practice decoding will start with IT decoding and end with ML * decoding (in this case a Gaussian Elimination) if needed. * * Warning: ML decoding enables to reach the best erasure recovery capabilities, * at the expense of potentially significant computation loads, depending on * the size and complexity of the simplified system at the end of IT decoding. * * See the MAX_NB_SOURCE_SYMBOLS_DEFAULT/MAX_NB_ENCODING_SYMBOLS_DEFAULT * constants that enable to limit the computation overheads. */ #define ML_DECODING #ifdef ML_DECODING #define OF_LDPC_STAIRCASE_ML_DECODING #endif /** * Define IL_SUPPORT in debug mode if you want to have the possibility to * produce H/G matrix images, e.g. to include in a report on new LDPC code * evaluation. * More precisely, we are relying on the DevIL library (http://openil.sourceforge.net/). * Please install it on your machine before compiling the OpenFEC library * if needed. */ //#define IL_SUPPORT /** * Default maximum number of source and encoding symbols for this codec. * This value depends in particular on the kind of decoder used. To this * limit, codec implementation details might add other limits (e.g. if * the ESI values are stored in UINT16 instead of UINT32...). * * Hints: * If ML decoding is enabled and used, then limit yourself to a value * that is not too high, since decoding might finish with a Gaussian * elimination on the simplified system. * In situations where decoding is restricted to IT, the main limit is * the available memory. It usually means you can set very large values. */ #ifndef OF_LDPC_STAIRCASE_MAX_NB_SOURCE_SYMBOLS_DEFAULT #ifdef ML_DECODING #define OF_LDPC_STAIRCASE_MAX_NB_SOURCE_SYMBOLS_DEFAULT 50000 #define OF_LDPC_STAIRCASE_MAX_NB_ENCODING_SYMBOLS_DEFAULT 50000 #else #define OF_LDPC_STAIRCASE_MAX_NB_SOURCE_SYMBOLS_DEFAULT 100000 #define OF_LDPC_STAIRCASE_MAX_NB_ENCODING_SYMBOLS_DEFAULT 100000 #endif #endif
#ifndef _VDBWINDOW_H #define _VDBWINDOW_H #include "GLWindow.h" #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Slider.H> #include <FL/Fl_Button.H> #include <FL/Fl_Choice.H> #include <FL/Fl_Browser.H> struct VDBWindow : public Fl_Window { GLWindow *gl; Fl_Slider * point_size; Fl_Slider * filter_value; Fl_Button * clear_button; Fl_Choice * color_by; void slider_changed(); VDBWindow(); }; #endif
/* * Copyright (c) 2018, Ford Motor Company * 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 Ford Motor Company 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 SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_MIXING_AUDIO_SUPPORTED_RESPONSE_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_MIXING_AUDIO_SUPPORTED_RESPONSE_H_ #include "application_manager/commands/response_from_hmi.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; namespace commands { /** * @brief MixingAudioSupportedResponse command class **/ class MixingAudioSupportedResponse : public app_mngr::commands::ResponseFromHMI { public: /** * @brief MixingAudioSupportedResponse class constructor * * @param message Incoming SmartObject message **/ MixingAudioSupportedResponse( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handle); /** * @brief MixingAudioSupportedResponse class destructor **/ virtual ~MixingAudioSupportedResponse(); /** * @brief Execute command **/ virtual void Run(); private: DISALLOW_COPY_AND_ASSIGN(MixingAudioSupportedResponse); }; } // namespace commands } // namespace sdl_rpc_plugin #endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_MIXING_AUDIO_SUPPORTED_RESPONSE_H_
// SDLRequestType.h // SyncProxy // Copyright (c) 2014 Ford Motor Company. All rights reserved. #import <Foundation/Foundation.h> #import <AppLink/SDLEnum.h> @interface SDLRequestType : SDLEnum {} +(SDLRequestType*) valueOf:(NSString*) value; +(NSMutableArray*) values; +(SDLRequestType*) HTTP; +(SDLRequestType*) FILE_RESUME; +(SDLRequestType*) AUTH_REQUEST; +(SDLRequestType*) AUTH_CHALLENGE; +(SDLRequestType*) AUTH_ACK; +(SDLRequestType*) PROPRIETARY; @end
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ASH_PUBLIC_CPP_TABLET_MODE_H_ #define ASH_PUBLIC_CPP_TABLET_MODE_H_ #include "ash/public/cpp/ash_public_export.h" #include "ash/public/cpp/tablet_mode_observer.h" #include "base/run_loop.h" namespace ash { // An interface implemented by Ash that allows Chrome to be informed of changes // to tablet mode state. class ASH_PUBLIC_EXPORT TabletMode { public: // Helper class to wait until the tablet mode transition is complete. class Waiter : public TabletModeObserver { public: explicit Waiter(bool enable); ~Waiter() override; void Wait(); // TabletModeObserver: void OnTabletModeStarted() override; void OnTabletModeEnded() override; private: bool enable_; base::RunLoop run_loop_; DISALLOW_COPY_AND_ASSIGN(Waiter); }; // Returns the singleton instance. static TabletMode* Get(); virtual void AddObserver(TabletModeObserver* observer) = 0; virtual void RemoveObserver(TabletModeObserver* observer) = 0; // Returns true if the system is in tablet mode. virtual bool InTabletMode() const = 0; // Force the tablet mode state for integration tests. The meaning of |enabled| // are as follows: // true: UI in the tablet mode // false: UI in the clamshell mode // nullopt: reset the forcing, UI in the default behavior (i.e. checking the // physical state). virtual void ForceUiTabletModeState(base::Optional<bool> enabled) = 0; // Enable/disable the tablet mode. Used only by test cases. virtual void SetEnabledForTest(bool enabled) = 0; protected: TabletMode(); virtual ~TabletMode(); }; } // namespace ash #endif // ASH_PUBLIC_CPP_TABLET_MODE_H_
#ifndef HAMCRESTQT_STRINGDESCRIPTION_H #define HAMCRESTQT_STRINGDESCRIPTION_H #include "basedescription.h" namespace HamcrestQt { class SelfDescribing; /** * A {@link Description} that is stored as a string. */ class StringDescription : public BaseDescription { public: StringDescription(); /** * Returns the description as a string. */ virtual QString toString() const; /** * Return the description of a {@link SelfDescribing} object as a @c QString. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ static QString toString(const SelfDescribing &selfDescribing); /** * Alias for {@link #toString(SelfDescribing)}. */ static QString asString(const SelfDescribing &selfDescribing); protected: virtual void appendString(const QString &str); virtual void append(const QChar &c); private: QString out; }; } // namespace HamcrestQt #endif // HAMCRESTQT_STRINGDESCRIPTION_H
/* +---------------------------------------------------------------------------+ | Mobile Robot Programming Toolkit (MRPT) | | https://www.mrpt.org/ | | | | Copyright (c) 2005-2022, Individual contributors, see AUTHORS file | | See: https://www.mrpt.org/Authors - All rights reserved. | | Released under BSD License. See details in https://www.mrpt.org/License | +---------------------------------------------------------------------------+ */ #include "cs.h" /* x = x + beta * A(:,j), where x is a dense vector and A(:,j) is sparse */ int cs_scatter (const cs *A, int j, double beta, int *w, double *x, int mark, cs *C, int nz) { int i, p, *Ap, *Ai, *Ci ; double *Ax ; if (!CS_CSC (A) || !w || !CS_CSC (C)) return (-1) ; /* check inputs */ Ap = A->p ; Ai = A->i ; Ax = A->x ; Ci = C->i ; // JLBC: Modification for MRPT: optimized case for beta==1: if (beta==1) { for (p = Ap [j] ; p < Ap [j+1] ; p++) { i = Ai [p] ; /* A(i,j) is nonzero */ if (w [i] < mark) { w [i] = mark ; /* i is new entry in column j */ Ci [nz++] = i ; /* add i to pattern of C(:,j) */ if (x) x [i] = /* beta * */ Ax [p] ; /* x(i) = beta*A(i,j) */ } else if (x) x [i] += /*beta * */ Ax [p] ; /* i exists in C(:,j) already */ } } else { for (p = Ap [j] ; p < Ap [j+1] ; p++) { i = Ai [p] ; /* A(i,j) is nonzero */ if (w [i] < mark) { w [i] = mark ; /* i is new entry in column j */ Ci [nz++] = i ; /* add i to pattern of C(:,j) */ if (x) x [i] = beta * Ax [p] ; /* x(i) = beta*A(i,j) */ } else if (x) x [i] += beta * Ax [p] ; /* i exists in C(:,j) already */ } } return (nz) ; }
/* * lls.h * * Created on: Apr 14, 2014 * Author: HOME */ #ifndef LLS_H_ #define LLS_H_ #include "matrix.h" #ifdef __cplusplus extern "C" { #endif int lls_normal(double *A,double *b,int M,int N,double *x); int lls_qr(double *A,double *b,int M,int N,double *xo); void bidiag(double *A, int M, int N); void bidiag_orth(double *A, int M, int N,double *U,double *V); int svd_gr(double *A,int M,int N,double *U,double *V,double *q); int svd_gr2(double *A,int M,int N,double *U,double *V,double *q); int minfit(double *AB,int M,int N,int P,double *q); int lls_svd(double *Ai,double *bi,int M,int N,double *xo); int lls_svd2(double *Ai,double *bi,int M,int N,double *xo); #ifdef __cplusplus } #endif #endif /* LLS_H_ */
/* * Copyright (c) 2004-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ // Copyright 2004-present Facebook. All rights reserved. #pragma once #include <folly/dynamic.h> #include <folly/FBString.h> #include "fboss/agent/types.h" #include <folly/IPAddress.h> #include "fboss/agent/if/gen-cpp2/ctrl_types.h" namespace facebook { namespace fboss { /** * Route forward actions */ enum RouteForwardAction { DROP, // Drop the packets TO_CPU, // Punt the packets to the CPU NEXTHOPS, // Forward the packets to one or multiple nexthops }; std::string forwardActionStr(RouteForwardAction action); RouteForwardAction str2ForwardAction(const std::string& action); /** * Route prefix */ template<typename AddrT> struct RoutePrefix { AddrT network; uint8_t mask; std::string str() const { return folly::to<std::string>(network, "/", static_cast<uint32_t>(mask)); } /* * Serialize to folly::dynamic */ folly::dynamic toFollyDynamic() const; /* * Deserialize from folly::dynamic */ static RoutePrefix fromFollyDynamic(const folly::dynamic& prefixJson); bool operator<(const RoutePrefix&) const; bool operator>(const RoutePrefix&) const; bool operator==(const RoutePrefix& p2) const { return mask == p2.mask && network == p2.network; } bool operator!=(const RoutePrefix& p2) const { return !operator==(p2); } typedef AddrT AddressT; }; typedef RoutePrefix<folly::IPAddressV4> RoutePrefixV4; typedef RoutePrefix<folly::IPAddressV6> RoutePrefixV6; void toAppend(const RoutePrefixV4& prefix, std::string *result); void toAppend(const RoutePrefixV6& prefix, std::string *result); }}
// SDLBitsPerSample.h // SyncProxy // Copyright (c) 2014 Ford Motor Company. All rights reserved. #import <Foundation/Foundation.h> #import <SmartDeviceLink/SDLEnum.h> @interface SDLBitsPerSample : SDLEnum {} +(SDLBitsPerSample*) valueOf:(NSString*) value; +(NSMutableArray*) values; +(SDLBitsPerSample*) _8_BIT; +(SDLBitsPerSample*) _16_BIT; @end
/*** c86ctl Copyright (c) 2009-2012, honet. All rights reserved. This software is licensed under the BSD license. honet.kk(at)gmail.com */ #pragma once #include "chip.h" #include "opx.h" namespace c86ctl{ // --------------------------------------------------------------------------------------- class COPMFmCh : public COPXFmCh { friend class COPM; friend class COPMFm; public: COPMFmCh(IRealChip2 *p) : COPXFmCh(p) { setMasterClock(3579545); reset(); }; virtual ~COPMFmCh(void){ }; virtual void reset(){ COPXFmCh::reset(); kcoct = 0; kcnote = 0; kfcent = 0; }; public: virtual void getNote(int &oct, int &note); void setMasterClock( UINT clock ); UCHAR getKeyCodeOct(){ return kcoct; }; UCHAR getKeyCodeNote(){ return kcnote; }; UCHAR getKeyFraction(){ return kfcent; }; protected: virtual void keyOn( UCHAR slotsw ){ for( int i=0; i<4; i++ ){ // D3:4, D2:3, D1:2, D0:1 if( slotsw & 0x01 ){ slot[i]->on(); keyOnLevel[i] = (127-slot[i]->getTotalLevel())>>2; }else{ slot[i]->off(); } slotsw >>= 1; } }; void setKeyCode( UCHAR kc ){ kcoct = (kc>>4)&0x7; kcnote = kc&0xf; }; void setKeyFraction( UCHAR kf ){ kfcent = (kf >> 2); }; protected: uint32_t mclk; uint32_t dcent; uint32_t kcoct; uint32_t kcnote; uint32_t kfcent; IRealChip2 *pIF; }; // --------------------------------------------------------------------------------------- class COPMFm{ friend class COPM; public: COPMFm(IRealChip2 *p) : pIF(p){ for( int i=0; i<9; i++ ) ch[i] = new COPMFmCh(p); reset(); }; virtual ~COPMFm(){ for( int i=0; i<9; i++ ) if(ch[i]) delete ch[i]; }; void reset(){ lfo = 0; lfo_sw = false; for( int i=0; i<9; i++ ) ch[i]->reset(); }; void update(){ for( int i=0; i<9; i++ ) ch[i]->update(); }; public: int getLFO(){ return lfo; }; protected: bool isLFOOn(){ return lfo_sw; }; bool setReg( UCHAR addr, UCHAR data ); public: COPMFmCh *ch[9]; protected: int lfo; //3bit bool lfo_sw; IRealChip2 *pIF; }; // --------------------------------------------------------------------------------------- class COPM : public Chip { public: COPM(IRealChip2 *p) : pIF(p) { fm = new COPMFm(p); partMask = 0; partSolo = 0; reset(); }; virtual ~COPM(){ if(fm) delete fm; }; void reset(){ memset( reg, 0, 256 ); memset( regATime, 0, 256 ); fm->reset(); } public: virtual void filter( int addr, UCHAR *data ); virtual bool setReg( int addr, UCHAR data ); virtual UCHAR getReg( int addr ); virtual void setMasterClock( UINT clock ){}; void setPartMask(int ch, bool mask); void setPartSolo(int ch, bool mask); bool getPartMask(int ch){ return partMask&(1<<ch) ? true : false; }; bool getPartSolo(int ch){ return partSolo&(1<<ch) ? true : false; }; bool getMixedMask(int ch){ if( partSolo ) return (((~partSolo) | partMask) & (1<<ch)) ? true : false; else return getPartMask(ch); }; public: void update(){ int dc = 4; for( int i=0; i<256; i++ ){ UCHAR c=regATime[i]; if( 64<c ){ c-=dc; regATime[i] = 64<c ? c : 64; } } fm->update(); }; public: UCHAR reg[256]; UCHAR regATime[256]; public: COPMFm *fm; protected: bool fmCommonRegHandling( UCHAR adrs, UCHAR data ); void applyMask(int ch); protected: UINT partMask; UINT partSolo; IRealChip2 *pIF; }; };
/*- * Copyright (c) 1982, 1986, 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 * $FreeBSD: src/sys/sys/ioctl.h,v 1.9 1999/12/29 04:24:43 peter Exp $ */ #ifndef _SYS_IOCTL_H_ #define _SYS_IOCTL_H_ #ifdef _KERNEL #warning "Don't #include ioctl.h in the kernel. Include xxxio.h instead." #endif #include <sys/ttycom.h> /* * Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented * notwithstanding). */ struct ttysize { unsigned short ts_lines; unsigned short ts_cols; unsigned short ts_xxx; unsigned short ts_yyy; }; #define TIOCGSIZE TIOCGWINSZ #define TIOCSSIZE TIOCSWINSZ #include <sys/ioccom.h> #include <sys/filio.h> #include <sys/sockio.h> #endif /* !_SYS_IOCTL_H_ */ /* * Keep outside _SYS_IOCTL_H_ * Compatibility with old terminal driver * * Source level -> #define USE_OLD_TTY * Kernel level -> options COMPAT_43 or COMPAT_SUNOS */ #if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) #include <sys/ioctl_compat.h> #endif
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of The University of Texas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "bli_fnormm_check.h" #include "bli_fnormm_unb_var1.h" // // Prototype object-based interface. // void bli_fnormm( obj_t* x, obj_t* norm ); // // Prototype BLAS-like interfaces. // #undef GENTPROTR #define GENTPROTR( ctype_x, ctype_xr, chx, chxr, opname ) \ \ void PASTEMAC(chx,opname)( \ doff_t diagoffx, \ diag_t diagx, \ uplo_t uplox, \ dim_t m, \ dim_t n, \ ctype_x* x, inc_t rs_x, inc_t cs_x, \ ctype_xr* norm \ ); INSERT_GENTPROTR_BASIC( fnormm )
/* $NetBSD: i2c_io.h,v 1.1 2003/09/30 00:35:31 thorpej Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. * All rights reserved. * * Written by Jason R. Thorpe for Wasabi Systems, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed for the NetBSD Project by * Wasabi Systems, Inc. * 4. The name of Wasabi Systems, Inc. may not be used to endorse * or promote products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC * 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 _DEV_I2C_I2C_IO_H_ #define _DEV_I2C_I2C_IO_H_ #include <sys/ioccom.h> /* I2C bus address. */ typedef uint16_t i2c_addr_t; /* High-level I2C operations. */ typedef enum { I2C_OP_READ = 0, I2C_OP_READ_WITH_STOP = 1, I2C_OP_WRITE = 2, I2C_OP_WRITE_WITH_STOP = 3, } i2c_op_t; #define I2C_OP_READ_P(x) (((int)(x) & 2) == 0) #define I2C_OP_WRITE_P(x) (! I2C_OP_READ_P(x)) #define I2C_OP_STOP_P(x) (((int)(x) & 1) != 0) /* * This structure describes a single I2C control script fragment. * * Note that use of this scripted API allows for support of automated * SMBus controllers. The following table maps SMBus operations to * script fragment configuration: * * SMBus "write byte": I2C_OP_WRITE_WITH_STOP * cmdlen = 1 * * SMBus "read byte": I2C_OP_READ_WITH_STOP * cmdlen = 1 * * SMBus "receive byte": I2C_OP_READ_WITH_STOP * cmdlen = 0 * * Note that while each of these 3 SMBus operations implies a STOP * (which an automated controller will likely perform automatically), * non-SMBus clients may continue to function even if they issue * I2C_OP_WRITE and I2C_OP_READ. */ /* * I2C_IOCTL_EXEC: * * User ioctl to execute an i2c operation. */ typedef struct i2c_ioctl_exec { i2c_op_t iie_op; /* operation to perform */ i2c_addr_t iie_addr; /* address of device */ const void *iie_cmd; /* pointer to command */ size_t iie_cmdlen; /* length of command */ void *iie_buf; /* pointer to data buffer */ size_t iie_buflen; /* length of data buffer */ } i2c_ioctl_exec_t; #define I2C_EXEC_MAX_CMDLEN 32 #define I2C_EXEC_MAX_BUFLEN 32 #define I2C_IOCTL_EXEC _IOW('I', 0, i2c_ioctl_exec_t) #endif /* _DEV_I2C_I2C_IO_H_ */
/* * provsh.h * * Created on: Dec 13, 2012 * Author: calucian */ #ifndef PROVSH_H_ #define PROVSH_H_ #include <string> #include <boost/filesystem.hpp> #include <boost/optional.hpp> #include <map> #include <signal.h> namespace provsh{ class RunCommand; class Shell{ typedef std::map<std::string, RunCommand*> cmdmap; typedef std::pair<std::string, RunCommand*> cmdkvp; friend class RunCommand; public: boost::filesystem::path cwd; private: cmdmap internalCommands; std::string prompt; int history_size; bool history_exists; char* history_file_pathname; bool exit_flag; struct sigaction oldSIGTSTP, oldSIGINT; void initBuiltinCommands(); void addInternalCommand(std::string cmdname, RunCommand* cmd); public: Shell(); ~Shell(); std::string getPrompt(); boost::optional<std::string> readCommandLine(); std::string replaceEnvVars(std::string cmdline); void parseCommandLine(std::string cmdline); void executeCommand(std::string cmdline); bool shouldExit(); void setExit(); }; } #endif /* PROVSH_H_ */
/* * Copyright (c) 1994 The Regents of the University of California. * Copyright (c) 1994 Jan-Simon Pendry. * All rights reserved. * * This code is derived from software donated to Berkeley by * Jan-Simon Pendry. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)union.h 8.2 (Berkeley) 2/17/94 * $Id: union.h,v 1.4 1995/11/09 08:16:36 bde Exp $ */ struct union_args { char *target; /* Target of loopback */ int mntflags; /* Options on the mount */ }; #define UNMNT_ABOVE 0x0001 /* Target appears below mount point */ #define UNMNT_BELOW 0x0002 /* Target appears below mount point */ #define UNMNT_REPLACE 0x0003 /* Target replaces mount point */ #define UNMNT_OPMASK 0x0003 struct union_mount { struct vnode *um_uppervp; struct vnode *um_lowervp; struct ucred *um_cred; /* Credentials of user calling mount */ int um_cmode; /* cmask from mount process */ int um_op; /* Operation mode */ }; #ifdef KERNEL /* * DEFDIRMODE is the mode bits used to create a shadow directory. */ #define VRWXMODE (VREAD|VWRITE|VEXEC) #define VRWMODE (VREAD|VWRITE) #define UN_DIRMODE ((VRWXMODE)|(VRWXMODE>>3)|(VRWXMODE>>6)) #define UN_FILEMODE ((VRWMODE)|(VRWMODE>>3)|(VRWMODE>>6)) /* * A cache of vnode references */ struct union_node { LIST_ENTRY(union_node) un_cache; /* Hash chain */ struct vnode *un_vnode; /* Back pointer */ struct vnode *un_uppervp; /* overlaying object */ struct vnode *un_lowervp; /* underlying object */ struct vnode *un_dirvp; /* Parent dir of uppervp */ char *un_path; /* saved component name */ int un_hash; /* saved un_path hash value */ int un_openl; /* # of opens on lowervp */ int un_flags; #ifdef DIAGNOSTIC pid_t un_pid; #endif }; #define UN_WANT 0x01 #define UN_LOCKED 0x02 #define UN_ULOCK 0x04 /* Upper node is locked */ #define UN_KLOCK 0x08 /* Keep upper node locked on vput */ extern int union_allocvp __P((struct vnode **, struct mount *, struct vnode *, struct vnode *, struct componentname *, struct vnode *, struct vnode *)); extern int union_freevp __P((struct vnode *)); extern int union_copyfile __P((struct proc *, struct ucred *, struct vnode *, struct vnode *)); extern int union_mkshadow __P((struct union_mount *, struct vnode *, struct componentname *, struct vnode **)); extern int union_vn_create __P((struct vnode **, struct union_node *, struct proc *)); extern int union_vn_close __P((struct vnode *, int, struct ucred *, struct proc *)); extern int union_cn_close __P((struct vnode *, int, struct ucred *, struct proc *)); extern void union_removed_upper __P((struct union_node *un)); extern struct vnode *union_lowervp __P((struct vnode *)); extern void union_newlower __P((struct union_node *, struct vnode *)); extern void union_newupper __P((struct union_node *, struct vnode *)); #define MOUNTTOUNIONMOUNT(mp) ((struct union_mount *)((mp)->mnt_data)) #define VTOUNION(vp) ((struct union_node *)(vp)->v_data) #define UNIONTOV(un) ((un)->un_vnode) #define LOWERVP(vp) (VTOUNION(vp)->un_lowervp) #define UPPERVP(vp) (VTOUNION(vp)->un_uppervp) #define OTHERVP(vp) (UPPERVP(vp) ? UPPERVP(vp) : LOWERVP(vp)) extern vop_t **union_vnodeop_p; extern struct vfsops union_vfsops; #endif /* KERNEL */
// // #include <stdio.h> #include <math.h> #include <stdlib.h> int main(void) { int number, rem; printf("\nEnter an integer > "); scanf("%d", &number); printf("\n"); if (number < 0) { number = abs(number); while (number > 10) { rem = number % 10; printf("%d\n", rem); number = number/10; } number = number - 2*number; printf("%d\nThat's all, have a nice day!\n", number); } else if (number == 0){ printf("%d\nThat's all, have a nice day!\n", number); } else { while (number != 0) { rem = number % 10; printf("%d\n", rem); number = number/10; } printf("That's all, have a nice day!\n"); } return (0); }
/*******************************************************/ /* "C" Language Integrated Production System */ /* */ /* CLIPS Version 6.24 04/21/06 */ /* */ /* USER FUNCTIONS MODULE */ /*******************************************************/ /*************************************************************/ /* Purpose: */ /* */ /* Principal Programmer(s): */ /* Gary D. Riley */ /* */ /* Contributing Programmer(s): */ /* */ /* Revision History: */ /* */ /* 6.24: Created file to seperate UserFunctions and */ /* EnvUserFunctions from main.c. */ /* */ /*************************************************************/ /***************************************************************************/ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, and/or sell copies of the Software, and to permit persons */ /* to whom the Software is furnished to do so. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS */ /* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT */ /* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY */ /* CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN */ /* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF */ /* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* */ /***************************************************************************/ #include "clips.h" #include "binary_operations.h" #include <System/System.h> void UserFunctions(void); void EnvUserFunctions(void *); /*********************************************************/ /* UserFunctions: Informs the expert system environment */ /* of any user defined functions. In the default case, */ /* there are no user defined functions. To define */ /* functions, either this function must be replaced by */ /* a function with the same name within this file, or */ /* this function can be deleted from this file and */ /* included in another file. */ /*********************************************************/ void UserFunctions() { } /***********************************************************/ /* EnvUserFunctions: Informs the expert system environment */ /* of any user defined functions. In the default case, */ /* there are no user defined functions. To define */ /* functions, either this function must be replaced by */ /* a function with the same name within this file, or */ /* this function can be deleted from this file and */ /* included in another file. */ /***********************************************************/ void EnvUserFunctions( void *theEnv) { BinaryOperationsFunctionDefinitions(theEnv); InitializeSystem(theEnv); }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__int_max_postinc_68a.c Label Definition File: CWE190_Integer_Overflow__int.label.xml Template File: sources-sinks-68a.tmpl.c */ /* * @description * CWE: 190 Integer Overflow * BadSource: max Set data to the max value for int * GoodSource: Set data to a small, non-zero number (two) * Sinks: increment * GoodSink: Ensure there will not be an overflow before incrementing data * BadSink : Increment data, which can cause an overflow * Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files * * */ #include "std_testcase.h" int CWE190_Integer_Overflow__int_max_postinc_68_badData; int CWE190_Integer_Overflow__int_max_postinc_68_goodG2BData; int CWE190_Integer_Overflow__int_max_postinc_68_goodB2GData; #ifndef OMITBAD /* bad function declaration */ void CWE190_Integer_Overflow__int_max_postinc_68b_badSink(); void CWE190_Integer_Overflow__int_max_postinc_68_bad() { int data; /* Initialize data */ data = 0; /* POTENTIAL FLAW: Use the maximum value for this type */ data = INT_MAX; CWE190_Integer_Overflow__int_max_postinc_68_badData = data; CWE190_Integer_Overflow__int_max_postinc_68b_badSink(); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declarations */ void CWE190_Integer_Overflow__int_max_postinc_68b_goodG2BSink(); void CWE190_Integer_Overflow__int_max_postinc_68b_goodB2GSink(); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { int data; /* Initialize data */ data = 0; /* FIX: Use a small, non-zero value that will not cause an integer overflow in the sinks */ data = 2; CWE190_Integer_Overflow__int_max_postinc_68_goodG2BData = data; CWE190_Integer_Overflow__int_max_postinc_68b_goodG2BSink(); } /* goodB2G uses the BadSource with the GoodSink */ static void goodB2G() { int data; /* Initialize data */ data = 0; /* POTENTIAL FLAW: Use the maximum value for this type */ data = INT_MAX; CWE190_Integer_Overflow__int_max_postinc_68_goodB2GData = data; CWE190_Integer_Overflow__int_max_postinc_68b_goodB2GSink(); } void CWE190_Integer_Overflow__int_max_postinc_68_good() { goodG2B(); goodB2G(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE190_Integer_Overflow__int_max_postinc_68_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE190_Integer_Overflow__int_max_postinc_68_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/**@file zlocsegchainconn.h * @brief Connection between two locseg chains * @author Ting Zhao * @date 22-AUG-2009 */ #ifndef ZLOCSEGCHAINCONN_H_ #define ZLOCSEGCHAINCONN_H_ #include <QXmlStreamWriter> #include "zdocumentable.h" #include "zstackdrawable.h" #include "tz_neurocomp_conn.h" class QImage; class XmlStreamReader; class ZLocsegChain; /* ZlocsegChainConn defines the class of locseg chain connections. Sample usage: ... ZLocsegChainConn *conn = new ZLocsegChainConn(hook, loop, mode); conn->translateMode(); conn->print(); ... */ class ZLocsegChainConn : public ZDocumentable, public ZStackDrawable { public: ZLocsegChainConn(); ZLocsegChainConn(int hook, int link, int hookSpot, int linkSpot, int mode = NEUROCOMP_CONN_HL); ZLocsegChainConn(ZLocsegChain *hook, ZLocsegChain *loop, int hookSpot, int loopSpot, int mode = NEUROCOMP_CONN_HL); virtual ~ZLocsegChainConn(); virtual const std::string& className() const; virtual void display(QPainter &painter, int z = 0, Display_Style option = NORMAL) const; virtual void save(const char *filePath); virtual void load(const char *filePath); bool has(const ZLocsegChain *hook, const ZLocsegChain *loop) const; bool isHook(const ZLocsegChain *chain) const; bool isLoop(const ZLocsegChain *chain) const; inline ZLocsegChain *loopChain() { return m_loopChain; } inline ZLocsegChain *hookChain() { return m_hookChain; } //add for 3d widget inline int hookSpot() {return m_hookSpot;} inline int loopSpot() {return m_loopSpot;} inline int mode() {return m_mode;} void translateMode(); void writeXml(QXmlStreamWriter &xml); void print(); private: int m_hook; int m_loop; int m_hookSpot; int m_loopSpot; int m_mode; ZLocsegChain *m_hookChain; ZLocsegChain *m_loopChain; }; #endif /* ZLOCSEGCHAINCONN_H_ */
// Copyright Paul Dardeau, SwampBits LLC 2015 // BSD License #ifndef CHAUDIERE_TESTAUTOPOINTER_H #define CHAUDIERE_TESTAUTOPOINTER_H #include "TestSuite.h" namespace chaudiere { class TestAutoPointer : public poivre::TestSuite { protected: void runTests(); void testConstructor(); void testOperatorArrow(); void testAssign(); void testHaveObject(); void testDestructor(); public: TestAutoPointer(); }; } #endif
// Copyright © 2018 650 Industries. All rights reserved. #import <ExpoModulesCore/EXExportedModule.h> #import <ExpoModulesCore/EXModuleRegistryConsumer.h> @interface EXWebBrowser : EXExportedModule <EXModuleRegistryConsumer> @end
// Copyright 2005-2019 The Mumble Developers. All rights reserved. // Use of this source code is governed by a BSD-style license // that can be found in the LICENSE file at the root of the // Mumble source tree or at <https://www.mumble.info/LICENSE>. #ifndef MUMBLE_MURMUR_BONJOURSERVER_H_ #define MUMBLE_MURMUR_BONJOURSERVER_H_ #include <QtCore/QObject> class BonjourServiceRegister; class BonjourServer : public QObject { private: Q_OBJECT Q_DISABLE_COPY(BonjourServer) public: BonjourServer(); ~BonjourServer(); BonjourServiceRegister *bsrRegister; }; #endif
#ifndef INCLUDED_RECTANGLE_H #define INCLUDED_RECTANGLE_H #include "fixed_point.h" typedef struct { fixed_point x; fixed_point y; } vec2d; static inline vec2d vec2d_add(vec2d v1, vec2d v2) { vec2d r = { fixed_point_add(v1.x, v2.x), fixed_point_add(v1.y, v2.y) }; return r; } static inline vec2d vec2d_sub(vec2d v1, vec2d v2) { vec2d r = { fixed_point_sub(v1.x, v2.x), fixed_point_sub(v1.y, v2.y) }; return r; } static inline vec2d vec2d_neg(vec2d v) { vec2d r = { fixed_point_neg(v.x), fixed_point_neg(v.y) }; return r; } typedef struct { vec2d pos; vec2d extent; } rectangle; static inline rectangle rectangle_new(vec2d pos, vec2d extent) { rectangle r = { pos, extent }; return r; } static inline fixed_point rectangle_top (rectangle const *r) { return r->pos.y; } static inline fixed_point rectangle_left (rectangle const *r) { return r->pos.x; } static inline fixed_point rectangle_bottom(rectangle const *r) { return fixed_point_add(rectangle_top (r), r->extent.y); } static inline fixed_point rectangle_right (rectangle const *r) { return fixed_point_add(rectangle_left(r), r->extent.x); } static inline fixed_point rectangle_width (rectangle const *r) { return r->extent.x; } static inline fixed_point rectangle_height(rectangle const *r) { return r->extent.y; } static inline fixed_point rectangle_mid_x (rectangle const *r) { return fixed_point_add(r->pos.x, fixed_point_div(r->extent.x, FIXED_INT(2))); } static inline fixed_point rectangle_mid_y (rectangle const *r) { return fixed_point_add(r->pos.y, fixed_point_div(r->extent.y, FIXED_INT(2))); } static inline vec2d rectangle_mid (rectangle const *r) { vec2d v = { rectangle_mid_x(r), rectangle_mid_y(r) }; return v; } static inline void rectangle_move_to (rectangle *r, vec2d new_pos) { r->pos = new_pos; } static inline void rectangle_move_to_x(rectangle *r, fixed_point new_x ) { r->pos.x = new_x; } static inline void rectangle_move_to_y(rectangle *r, fixed_point new_y ) { r->pos.x = new_y; } static inline void rectangle_move_rel (rectangle *r, vec2d vec ) { r->pos = vec2d_add(r->pos, vec); } static inline void rectangle_expand (rectangle *r, vec2d extent ) { r->extent = extent; } static inline bool rectangle_intersect(rectangle const *r1, rectangle const *r2) { return (fixed_point_lt(rectangle_top (r1), rectangle_bottom(r2)) && fixed_point_gt(rectangle_bottom(r1), rectangle_top (r2)) && fixed_point_lt(rectangle_left (r1), rectangle_right (r2)) && fixed_point_gt(rectangle_right (r1), rectangle_left (r2))); } #endif
/****************************************************************************** This source file is part of the Avogadro project. Copyright 2013 Kitware, Inc. This source code is released under the New BSD License, (the "License"). 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 AVOGADRO_VTKAVOGADROACTOR_H #define AVOGADRO_VTKAVOGADROACTOR_H #include "avogadrovtkexport.h" #include <vtkActor.h> namespace Avogadro { namespace Rendering { class Scene; } } /** * @class vtkAvogadroActor vtkAvogadroActor.h <avogadro/vtk/vtkAvogadroActor.h> * @brief Wrap an Avogadro::Rendering::Scene in a vtkActor derived container so * that it can be rendered in a standard VTK widget. * @author Marcus D. Hanwell */ class AVOGADROVTK_EXPORT vtkAvogadroActor : public vtkActor { public: /** Return a new instance of the vtkAvogadroActor. */ static vtkAvogadroActor* New(); /** Required type macro. */ vtkTypeMacro(vtkAvogadroActor, vtkActor) /** Print the state of the object. */ void PrintSelf(ostream& os, vtkIndent indent); /** Render the opaque geometry. */ int RenderOpaqueGeometry(vtkViewport *viewport); /** Render the translucent geometry. */ int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); /** Does the actor have transluscent geometry? */ int HasTranslucentPolygonalGeometry(); /** * Get the bounds for this Actor as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax). (The * method GetBounds(double bounds[6]) is available from the superclass.) */ double *GetBounds(); /** Set the scene on the actor, the actor assumes ownership of the scene. */ void setScene(Avogadro::Rendering::Scene *scene); /** Get the scene being rendered by the actor. */ Avogadro::Rendering::Scene * GetScene() { return m_scene; } protected: vtkAvogadroActor(); ~vtkAvogadroActor(); Avogadro::Rendering::Scene *m_scene; double m_bounds[6]; bool m_initialized; private: vtkAvogadroActor(const vtkAvogadroActor&); // Not implemented. void operator=(const vtkAvogadroActor&); // Not implemented. }; #endif // AVOGADRO_VTKAVOGADROACTOR_H
//===-- ctzdi2.c - Implement __ctzdi2 -------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements __ctzdi2 for the compiler_rt library. // //===----------------------------------------------------------------------===// #include "int_lib.h" // Returns: the number of trailing 0-bits #if !defined(__clang__) && \ ((defined(__sparc__) && defined(__arch64__)) || defined(__mips64) || \ (defined(__riscv) && __SIZEOF_POINTER__ >= 8)) // On 64-bit architectures with neither a native clz instruction nor a native // ctz instruction, gcc resolves __builtin_ctz to __ctzdi2 rather than // __ctzsi2, leading to infinite recursion. #define __builtin_ctz(a) __ctzsi2(a) extern si_int __ctzsi2(si_int); #endif // Precondition: a != 0 COMPILER_RT_ABI int __ctzdi2(di_int a) { dwords x; x.all = a; const si_int f = -(x.s.low == 0); return ctzsi((x.s.high & f) | (x.s.low & ~f)) + (f & ((si_int)(sizeof(si_int) * CHAR_BIT))); }
// Copyright 2017 The Cobalt Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef COBALT_RENDER_TREE_MATRIX_TRANSFORM_3D_NODE_H_ #define COBALT_RENDER_TREE_MATRIX_TRANSFORM_3D_NODE_H_ #include <algorithm> #include <vector> #include "base/compiler_specific.h" #include "cobalt/base/type_id.h" #include "cobalt/render_tree/node.h" #include "third_party/glm/glm/mat4x4.hpp" namespace cobalt { namespace render_tree { // A MatrixTransform3DNode applies a specified 3D affine matrix transform, // |transform| to a specified sub render tree node, |source|. As of the time // of this writing, the MatrixTransform3DNode will not affect anything except // for FilterNodes with the MapToMeshFilter attached to them, in which case // the 3D transform will be applied to the mesh. class MatrixTransform3DNode : public Node { public: struct Builder { Builder(const Builder&) = default; Builder(const scoped_refptr<Node>& source, const glm::mat4& transform) : source(source), transform(transform) {} bool operator==(const Builder& other) const { return source == other.source && transform == other.transform; } // The subtree that will be rendered with |transform| applied to it. scoped_refptr<Node> source; // The matrix transform that will be applied to the subtree. It is an // affine 4x4 matrix. glm::mat4 transform; }; // Forwarding constructor to the set of Builder constructors. template <typename... Args> MatrixTransform3DNode(Args&&... args) : data_(std::forward<Args>(args)...) {} void Accept(NodeVisitor* visitor) override; math::RectF GetBounds() const override; base::TypeId GetTypeId() const override { return base::GetTypeId<MatrixTransform3DNode>(); } const Builder& data() const { return data_; } private: const Builder data_; }; } // namespace render_tree } // namespace cobalt #endif // COBALT_RENDER_TREE_MATRIX_TRANSFORM_3D_NODE_H_
/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "common.h" #include "gpio.h" #include "hooks.h" #include "registers.h" #include "task.h" /* GPIOs are split into 2 words of 16 GPIOs */ #define GPIO_WORD_SIZE_LOG2 4 #define GPIO_WORD_SIZE (1 << GPIO_WORD_SIZE_LOG2) #define GPIO_WORD_MASK (GPIO_WORD_SIZE - 1) test_mockable int gpio_get_level(enum gpio_signal signal) { uint32_t wi = signal >> GPIO_WORD_SIZE_LOG2; uint32_t mask = 1 << (signal & GPIO_WORD_MASK); return !!(GR_GPIO_DATAIN(wi) & mask); } void gpio_set_level(enum gpio_signal signal, int value) { uint32_t wi = signal >> GPIO_WORD_SIZE_LOG2; uint32_t idx = signal & GPIO_WORD_MASK; GR_GPIO_MASKBYTE(wi, 1 << idx) = value << idx; } static void gpio_set_flags_internal(enum gpio_signal signal, uint32_t port, uint32_t mask, uint32_t flags) { uint32_t wi = signal >> GPIO_WORD_SIZE_LOG2; uint32_t idx = signal & GPIO_WORD_MASK; uint32_t di = 31 - __builtin_clz(mask); /* Set up pullup / pulldown */ if (flags & GPIO_PULL_UP) GR_PINMUX_DIO_CTL(port, di) |= PINMUX_DIO_CTL_PU; else GR_PINMUX_DIO_CTL(port, di) &= ~PINMUX_DIO_CTL_PU; if (flags & GPIO_PULL_DOWN) GR_PINMUX_DIO_CTL(port, di) |= PINMUX_DIO_CTL_PD; else GR_PINMUX_DIO_CTL(port, di) &= ~PINMUX_DIO_CTL_PD; if (flags & GPIO_OUTPUT) { /* Set pin level first to avoid glitching. */ GR_GPIO_MASKBYTE(wi, 1 << idx) = !!(flags & GPIO_HIGH) << idx; /* Switch Output Enable */ GR_GPIO_SETDOUTEN(wi) = 1 << idx; } else if (flags & GPIO_INPUT) { GR_GPIO_CLRDOUTEN(wi) = 1 << idx; } /* Edge-triggered interrupt */ if (flags & (GPIO_INT_F_FALLING | GPIO_INT_F_RISING)) { GR_GPIO_SETINTTYPE(wi) = 1 << idx; if (flags & GPIO_INT_F_RISING) GR_GPIO_SETINTPOL(wi) = 1 << idx; else GR_GPIO_CLRINTPOL(wi) = 1 << idx; } /* Level-triggered interrupt */ if (flags & (GPIO_INT_F_LOW | GPIO_INT_F_HIGH)) { GR_GPIO_CLRINTTYPE(wi) = 1 << idx; if (flags & GPIO_INT_F_HIGH) GR_GPIO_SETINTPOL(wi) = 1 << idx; else GR_GPIO_CLRINTPOL(wi) = 1 << idx; } /* Interrupt is enabled by gpio_enable_interrupt() */ } void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags) { const struct gpio_info *g = gpio_list; int i; for (i = 0; i < GPIO_COUNT; i++, g++) if ((g->port == port) && (g->mask & mask)) gpio_set_flags_internal(i, port, mask, flags); } void gpio_set_alternate_function(uint32_t port, uint32_t mask, int func) { uint32_t di = 31 - __builtin_clz(mask); /* Connect the DIO pad to a specific function */ GR_PINMUX_DIO_SEL(port, di) = PINMUX_FUNC(func); /* Connect the specific function to the DIO pad */ PINMUX_SEL_REG(func) = PINMUX_DIO_SEL(port, di); /* Input Enable (if pad used for digital function) */ GR_PINMUX_DIO_CTL(port, di) |= PINMUX_DIO_CTL_IE; } int gpio_enable_interrupt(enum gpio_signal signal) { uint32_t wi = signal >> GPIO_WORD_SIZE_LOG2; uint32_t idx = signal & GPIO_WORD_MASK; GR_GPIO_SETINTEN(wi) = 1 << idx; return EC_SUCCESS; } int gpio_disable_interrupt(enum gpio_signal signal) { uint32_t wi = signal >> GPIO_WORD_SIZE_LOG2; uint32_t idx = signal & GPIO_WORD_MASK; GR_GPIO_CLRINTEN(wi) = 1 << idx; GR_GPIO_CLRINTSTAT(wi) = 1 << idx; return EC_SUCCESS; } void gpio_pre_init(void) { const struct gpio_info *g = gpio_list; int i; /* Enable clocks */ REG_WRITE_MLV(GR_PMU_PERICLKSET0, GC_PMU_PERICLKSET0_DGPIO0_MASK, GC_PMU_PERICLKSET0_DGPIO0_LSB, 1); REG_WRITE_MLV(GR_PMU_PERICLKSET0, GC_PMU_PERICLKSET0_DGPIO1_MASK, GC_PMU_PERICLKSET0_DGPIO1_LSB, 1); /* Set all GPIOs to defaults */ for (i = 0; i < GPIO_COUNT; i++, g++) { uint32_t di = 31 - __builtin_clz(g->mask); uint32_t wi = i >> GPIO_WORD_SIZE_LOG2; uint32_t idx = i & GPIO_WORD_MASK; if (g->flags & GPIO_DEFAULT) continue; /* Set up GPIO based on flags */ gpio_set_flags_internal(i, g->port, g->mask, g->flags); /* Connect the GPIO to the DIO pin through the muxing matrix */ GR_PINMUX_DIO_CTL(g->port, di) |= PINMUX_DIO_CTL_IE; GR_PINMUX_DIO_SEL(g->port, di) = PINMUX_GPIO_SEL(wi, idx); GR_PINMUX_GPIO_SEL(wi, idx) = PINMUX_DIO_SEL(g->port, di); } } static void gpio_init(void) { task_enable_irq(GC_IRQNUM_GPIO0_GPIOCOMBINT); task_enable_irq(GC_IRQNUM_GPIO1_GPIOCOMBINT); } DECLARE_HOOK(HOOK_INIT, gpio_init, HOOK_PRIO_DEFAULT); /*****************************************************************************/ /* Interrupt handler */ static void gpio_interrupt(int wi) { int idx; const struct gpio_info *g = gpio_list; uint32_t pending = GR_GPIO_CLRINTSTAT(wi); while (pending) { idx = get_next_bit(&pending) + wi * 16; if (g[idx].irq_handler) g[idx].irq_handler(idx); /* clear the interrupt */ GR_GPIO_CLRINTSTAT(wi) = 1 << idx; } } void _gpio0_interrupt(void) { gpio_interrupt(0); } void _gpio1_interrupt(void) { gpio_interrupt(1); } DECLARE_IRQ(GC_IRQNUM_GPIO0_GPIOCOMBINT, _gpio0_interrupt, 1); DECLARE_IRQ(GC_IRQNUM_GPIO1_GPIOCOMBINT, _gpio1_interrupt, 1);
/* $FreeBSD: src/sys/alpha/alpha/promcons.c,v 1.15 2000/01/09 16:24:55 bde Exp $ */ /* $NetBSD: promcons.c,v 1.13 1998/03/21 22:52:59 mycroft Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. * All rights reserved. * * Author: Chris G. Demetriou * * Permission to use, copy, modify and distribute this software and * its documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/module.h> #include <sys/bus.h> #include <sys/conf.h> #include <sys/tty.h> #include <sys/proc.h> #include <sys/ucred.h> #include <vm/vm.h> #include <vm/vm_param.h> #include <sys/lock.h> #include <vm/vm_kern.h> #include <vm/vm_page.h> #include <vm/vm_map.h> #include <vm/vm_object.h> #include <vm/vm_extern.h> #include <vm/vm_pageout.h> #include <vm/vm_pager.h> #include <vm/vm_zone.h> #include <machine/prom.h> #define _PMAP_MAY_USE_PROM_CONSOLE /* XXX for now */ #ifdef _PMAP_MAY_USE_PROM_CONSOLE #define PROM_POLL_HZ 50 static d_open_t promopen; static d_close_t promclose; static d_ioctl_t promioctl; #define CDEV_MAJOR 97 static struct cdevsw prom_cdevsw = { /* open */ promopen, /* close */ promclose, /* read */ ttyread, /* write */ ttywrite, /* ioctl */ promioctl, /* poll */ ttypoll, /* mmap */ nommap, /* strategy */ nostrategy, /* name */ "prom", /* maj */ CDEV_MAJOR, /* dump */ nodump, /* psize */ nopsize, /* flags */ 0, /* bmaj */ -1 }; static struct tty prom_tty[1]; static int polltime; static struct callout_handle promtimeouthandle = CALLOUT_HANDLE_INITIALIZER(&promtimeouthandle); void promstart __P((struct tty *)); void promtimeout __P((void *)); int promparam __P((struct tty *, struct termios *)); void promstop __P((struct tty *, int)); int promopen(dev, flag, mode, p) dev_t dev; int flag, mode; struct proc *p; { int unit = minor(dev); struct tty *tp; int s; int error = 0, setuptimeout = 0; if (!pmap_uses_prom_console() || unit != 0) return ENXIO; s = spltty(); tp = &prom_tty[unit]; dev->si_tty = tp; tp->t_oproc = promstart; tp->t_param = promparam; tp->t_stop = promstop; tp->t_dev = dev; if ((tp->t_state & TS_ISOPEN) == 0) { tp->t_state |= TS_CARR_ON; ttychars(tp); tp->t_iflag = TTYDEF_IFLAG; tp->t_oflag = TTYDEF_OFLAG; tp->t_cflag = TTYDEF_CFLAG|CLOCAL; tp->t_lflag = TTYDEF_LFLAG; tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; ttsetwater(tp); setuptimeout = 1; } else if (tp->t_state & TS_XCLUDE && suser(p)) { splx(s); return EBUSY; } splx(s); error = (*linesw[tp->t_line].l_open)(dev, tp); if (error == 0 && setuptimeout) { polltime = hz / PROM_POLL_HZ; if (polltime < 1) polltime = 1; promtimeouthandle = timeout(promtimeout, tp, polltime); } return error; } int promclose(dev, flag, mode, p) dev_t dev; int flag, mode; struct proc *p; { int unit = minor(dev); struct tty *tp = &prom_tty[unit]; untimeout(promtimeout, tp, promtimeouthandle); (*linesw[tp->t_line].l_close)(tp, flag); ttyclose(tp); return 0; } int promioctl(dev, cmd, data, flag, p) dev_t dev; u_long cmd; caddr_t data; int flag; struct proc *p; { int unit = minor(dev); struct tty *tp = &prom_tty[unit]; int error; error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); if (error != ENOIOCTL) return error; error = ttioctl(tp, cmd, data, flag); if (error != ENOIOCTL) return error; return ENOTTY; } int promparam(tp, t) struct tty *tp; struct termios *t; { return 0; } void promstart(tp) struct tty *tp; { int s; s = spltty(); if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { ttwwakeup(tp); splx(s); return; } tp->t_state |= TS_BUSY; while (tp->t_outq.c_cc != 0) promcnputc(tp->t_dev, getc(&tp->t_outq)); tp->t_state &= ~TS_BUSY; ttwwakeup(tp); splx(s); } /* * Stop output on a line. */ void promstop(tp, flag) struct tty *tp; int flag; { int s; s = spltty(); if (tp->t_state & TS_BUSY) if ((tp->t_state & TS_TTSTOP) == 0) tp->t_state |= TS_FLUSH; splx(s); } void promtimeout(v) void *v; { struct tty *tp = v; int c; while ((c = promcncheckc(tp->t_dev)) != -1) { if (tp->t_state & TS_ISOPEN) (*linesw[tp->t_line].l_rint)(c, tp); } promtimeouthandle = timeout(promtimeout, tp, polltime); } static int prom_modevent(module_t mod, int type, void *data) { if (type == MOD_LOAD) { cdevsw_add(&prom_cdevsw); return(0); } return(EOPNOTSUPP); } DEV_MODULE(prom, prom_modevent, 0); #endif /* _PMAP_MAY_USE_PROM_CONSOLE */
/** * @file ipv4.c * @brief ipv4 socket address * @author zhaochenyou16@gmail.com * @version 1.0.0 * @date 2015-11-08 * @platform * gcc 5.1.1 * linux 4.2.5-201.fc22.x86_64 */ #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/types.h> #ifndef MAXLINE #define MAXLINE 1024 #endif #define LOCALIP "127.0.0.1" //old ip function void old_ip(); //new ip function void new_ip(); //old address function void old_address(); //new address function void new_address(); int main() { old_ip(); new_ip(); old_address(); new_address(); exit(0); } void old_ip() { struct in_addr ipaddr; in_addr_t ipnumber; char *p; //string to in_addr if (inet_aton(LOCALIP, &ipaddr) != 1) { printf("[%s] %d:%s\n", __FUNCTION__, __LINE__, strerror(errno)); exit(1); } //in_addr to string if ( (p = inet_ntoa(ipaddr)) == NULL) { printf("[%s] %d:%s\n", __FUNCTION__, __LINE__, strerror(errno)); exit(1); } printf("%s\n", p); //string to in_addr_t //typedef uint32_t in_addr_t; ipnumber = inet_addr(LOCALIP); printf("%u\n", ipnumber); //INADDR_ANY is 0.0.0.0 //which is an invalid IP address //but when use it as a client socket IP //the client will choose local IP automatically ipaddr.s_addr = htonl(INADDR_ANY); printf("INADDR_ANY: %s\n", inet_ntoa(ipaddr)); //INADDR_LOOPBACK is 127.0.0.1 ipaddr.s_addr = htonl(INADDR_LOOPBACK); printf("INADDR_LOOPBACK: %s\n", inet_ntoa(ipaddr)); //INADDR_BROADCAST is 255.255.255.255 ipaddr.s_addr = htonl(INADDR_BROADCAST); printf("INADDR_BROADCAST: %s\n", inet_ntoa(ipaddr)); } void new_ip() { struct in_addr ipaddr; char buf[MAXLINE]; //string to in_addr if (inet_pton(AF_INET, LOCALIP, &ipaddr) != 1) { printf("[%s] %d:%s\n", __FUNCTION__, __LINE__, strerror(errno)); exit(1); } //in_addr to string if ( inet_ntop(AF_INET, &ipaddr, buf, MAXLINE) == NULL) { printf("[%s] %d:%s\n", __FUNCTION__, __LINE__, strerror(errno)); exit(1); } printf("%s\n", buf); ipaddr.s_addr = htonl(INADDR_ANY); printf("INADDR_ANY: %s\n", inet_ntop(AF_INET, &ipaddr, buf, MAXLINE)); ipaddr.s_addr = htonl(INADDR_LOOPBACK); printf("INADDR_LOOPBACK: %s\n", inet_ntop(AF_INET, &ipaddr, buf, MAXLINE)); ipaddr.s_addr = htonl(INADDR_BROADCAST); printf("INADDR_BROADCAST: %s\n", inet_ntop(AF_INET, &ipaddr, buf, MAXLINE)); } void old_address() { struct sockaddr_in addr1, addr2; //socket address include protocol(v4/v6), port, ip-address //set addr1 memset(&addr1, 0, sizeof(addr1)); addr1.sin_family = AF_INET; addr1.sin_port = htons(13); addr1.sin_addr.s_addr = inet_addr(LOCALIP); //print addr1 printf( "addr1 ip:%s, port:%u\n", inet_ntoa(addr1.sin_addr), ntohs(addr1.sin_port) ); //set addr2 memset(&addr2, 0, sizeof(addr2)); addr2.sin_family = AF_INET; addr2.sin_port = htons(13); inet_aton(LOCALIP, &addr2.sin_addr); //print addr2 printf( "add2 ip:%s, port:%u\n", inet_ntoa(addr2.sin_addr), ntohs(addr2.sin_port) ); } void new_address() { struct sockaddr_in addr; //socket address include protocol(v4/v6), port, ip-address char buf[MAXLINE]; //set addr memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(13); inet_pton(AF_INET, LOCALIP, &addr.sin_addr); //print addr printf( "addr ip:%s, port:%u\n", inet_ntop(AF_INET, &addr.sin_addr, buf, MAXLINE), ntohs(addr.sin_port) ); }
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_DRIVE_QUICK_ACCESS_PROVIDER_H_ #define CHROME_BROWSER_UI_APP_LIST_SEARCH_DRIVE_QUICK_ACCESS_PROVIDER_H_ #include <vector> #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "base/sequenced_task_runner.h" #include "base/strings/string16.h" #include "base/time/time.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/ui/app_list/search/search_provider.h" class Profile; namespace app_list { class SearchController; // DriveQuickAccessProvider dispatches queries to extensions and fetches the // results from them via chrome.launcherSearchProvider API. class DriveQuickAccessProvider : public SearchProvider, public drive::DriveIntegrationServiceObserver { public: DriveQuickAccessProvider(Profile* profile, SearchController* search_controller); ~DriveQuickAccessProvider() override; // SearchProvider: void Start(const base::string16& query) override; void AppListShown() override; // drive::DriveIntegrationServiceObserver: void OnFileSystemMounted() override; private: void GetQuickAccessItems(base::OnceCallback<void()> on_done); void OnGetQuickAccessItems(base::OnceCallback<void()> on_done, drive::FileError error, std::vector<drive::QuickAccessItem> drive_results); void SetResultsCache( base::OnceCallback<void()> on_done, const std::vector<drive::QuickAccessItem>& drive_results); void StartSearchController(); Profile* const profile_; drive::DriveIntegrationService* const drive_service_; SearchController* const search_controller_; // Whether the suggested files experiment is enabled. const bool suggested_files_enabled_; // Stores the last-returned results from the QuickAccess API. std::vector<drive::QuickAccessItem> results_cache_; base::TimeTicks query_start_time_; base::TimeTicks latest_fetch_start_time_; SEQUENCE_CHECKER(sequence_checker_); scoped_refptr<base::SequencedTaskRunner> task_runner_; base::WeakPtrFactory<DriveQuickAccessProvider> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(DriveQuickAccessProvider); }; } // namespace app_list #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_DRIVE_QUICK_ACCESS_PROVIDER_H_
// // MIKMIDIControlChangeCommand.h // MIDI Testbed // // Created by Andrew Madsen on 6/2/13. // Copyright (c) 2013 Mixed In Key. All rights reserved. // #import "MIKMIDIChannelVoiceCommand.h" /** * A MIDI control change message. */ @interface MIKMIDIControlChangeCommand : MIKMIDIChannelVoiceCommand /** * Convience method for creating a single, 14-bit control change command from its component * messages. The two commands passed into this method must comply with the MIDI specification * for 14-bit control change messages. * * The MIDI spec allows for 14-bit control change commands. These are actually sent as two * sequential commands where the second command has a controller number equal to the first * message's controllerNumber plus 32, and whose value is the least significant 7-bits of * the 14-bit value. * * @param msbCommand The command containing the most significant 7 bits of value data (ie. the first command). * @param lsbCommand The command containing the least significant 7 bits of value data (ie. the second command). * * @return A new, single MIKMIDIControlChangeCommand instance containing 14-bit value data, and whose * fourteenBitCommand property is set to YES. */ + (instancetype)commandByCoalescingMSBCommand:(MIKMIDIControlChangeCommand *)msbCommand andLSBCommand:(MIKMIDIControlChangeCommand *)lsbCommand; /** * The MIDI control number for the command. */ @property (nonatomic, readonly) NSUInteger controllerNumber; /** * The controlValue of the command. * * This method returns the same value as -value. Note that this is always a 7-bit (0-127) * value, even for a fourteen bit command. To retrieve the 14-bit value, use -fourteenBitValue. * * @see -fourteenBitCommand */ @property (nonatomic, readonly) NSUInteger controllerValue; /** * The 14-bit value of the command. * * This property always returns a 14-bit value (ranging from 0-16383). If the receiver is * not a 14-bit command (-isFourteenBitCommand returns NO), the 7 least significant * bits will always be 0. */ @property (nonatomic, readonly) NSUInteger fourteenBitValue; /** * YES if the command contains 14-bit value data. * * If this property returns YES, -fourteenBitValue will return a precision value in the range 0-16383 * * @see +commandByCoalescingMSBCommand:andLSBCommand: */ @property (nonatomic, readonly, getter = isFourteenBitCommand) BOOL fourteenBitCommand; @end /** * The mutable counterpart of MIKMIDIControlChangeCommand. */ @interface MIKMutableMIDIControlChangeCommand : MIKMIDIControlChangeCommand @property (nonatomic, readwrite) UInt8 channel; @property (nonatomic, readwrite) NSUInteger value; @property (nonatomic, readwrite) NSUInteger controllerNumber; @property (nonatomic, readwrite) NSUInteger controllerValue; /** * The 14-bit value of the command. * * This property always returns a 14-bit value (ranging from 0-16383). If the receiver is * not a 14-bit command (-isFourteenBitCommand returns NO), the 7 least significant * bits will always be 0, and will be discarded when setting this property. * * When setting this property, if the fourteenBitCommand property has not been set to YES, * the 7 LSbs will be discarded/ignored. */ @property (nonatomic, readwrite) NSUInteger fourteenBitValue; @property (nonatomic, readwrite, getter = isFourteenBitCommand) BOOL fourteenBitCommand; @property (nonatomic, strong, readwrite) NSDate *timestamp; @property (nonatomic, readwrite) MIKMIDICommandType commandType; @property (nonatomic, readwrite) UInt8 dataByte1; @property (nonatomic, readwrite) UInt8 dataByte2; @property (nonatomic, readwrite) MIDITimeStamp midiTimestamp; @property (nonatomic, copy, readwrite) NSData *data; @end
/*--------------------------------------------------------------------------- (c) 2004 Scorpio Software 19 Wittama Drive Glenmore Park Sydney NSW 2745 Australia ----------------------------------------------------------------------------- $Workfile:: $ $Revision:: $ $Date:: $ $Author:: $ ---------------------------------------------------------------------------*/ #ifndef Enterprise4_PCH_H #define Enterprise4_PCH_H //-- VCL -------------------------------------------------------------------- #include <vcl.h> #include <utilcls.h> //-- SYSTEM ----------------------------------------------------------------- #include <windows.h> //#include <assert.h> //-- APP -------------------------------------------------------------------- #include "..\..\..\Logging\MessageLogger.h" #include "..\..\..\SafeMacros.h" #include "..\..\Include\CustomEvents.h" //-- APP -------------------------------------------------------------------- #include "ZXLogFile.h" #include "Enterprise4PluginInterface.h" #include "Enterprise4PalettePlugin.h" #include "Enterprise4Palette.h" #include "fEnterprise4Palette.h" #include "fEnterpriseColors.h" #include "ZXBasePlugin.h" //--------------------------------------------------------------------------- #endif//Enterprise4_PCH_H
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_POLICY_CORE_COMMON_CONFIG_DIR_POLICY_LOADER_H_ #define COMPONENTS_POLICY_CORE_COMMON_CONFIG_DIR_POLICY_LOADER_H_ #include "base/files/file_path.h" #include "base/files/file_path_watcher.h" #include "base/macros.h" #include "base/sequenced_task_runner.h" #include "components/policy/core/common/async_policy_loader.h" #include "components/policy/core/common/policy_types.h" #include "components/policy/policy_export.h" namespace base { class Value; } namespace policy { // A policy loader implementation backed by a set of files in a given // directory. The files should contain JSON-formatted policy settings. They are // merged together and the result is returned in a PolicyBundle. // The files are consulted in lexicographic file name order, so the // last value read takes precedence in case of policy key collisions. class POLICY_EXPORT ConfigDirPolicyLoader : public AsyncPolicyLoader { public: ConfigDirPolicyLoader(scoped_refptr<base::SequencedTaskRunner> task_runner, const base::FilePath& config_dir, PolicyScope scope); ~ConfigDirPolicyLoader() override; // AsyncPolicyLoader implementation. void InitOnBackgroundThread() override; std::unique_ptr<PolicyBundle> Load() override; base::Time LastModificationTime() override; private: // Loads the policy files at |path| into the |bundle|, with the given |level|. void LoadFromPath(const base::FilePath& path, PolicyLevel level, PolicyBundle* bundle); // Merges the 3rd party |policies| (extension policies) into the |bundle|, // with the given |level|. void Merge3rdPartyPolicy(const base::Value* policies, PolicyLevel level, PolicyBundle* bundle, bool signin_profile = false); // Callback for the FilePathWatchers. void OnFileUpdated(const base::FilePath& path, bool error); // Task runner for running background jobs. const scoped_refptr<base::SequencedTaskRunner> task_runner_; // The directory containing the policy files. const base::FilePath config_dir_; // Policies loaded by this provider will have this scope. const PolicyScope scope_; // Watchers for events on the mandatory and recommended subdirectories of // |config_dir_|. base::FilePathWatcher mandatory_watcher_; base::FilePathWatcher recommended_watcher_; DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyLoader); }; } // namespace policy #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIG_DIR_POLICY_LOADER_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_POLICY_CORE_BROWSER_POLICY_CONVERSIONS_H_ #define COMPONENTS_POLICY_CORE_BROWSER_POLICY_CONVERSIONS_H_ #include <memory> #include <string> #include "base/containers/flat_map.h" #include "base/values.h" #include "build/branding_buildflags.h" #include "build/build_config.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/core/common/policy_namespace.h" #include "components/policy/core/common/policy_types.h" #include "components/policy/core/common/schema.h" #include "components/policy/policy_export.h" #include "ui/base/webui/web_ui_util.h" namespace policy { class PolicyConversionsClient; extern const POLICY_EXPORT webui::LocalizedString kPolicySources[POLICY_SOURCE_COUNT]; // A convenience class to retrieve all policies values. class POLICY_EXPORT PolicyConversions { public: // Maps known policy names to their schema. If a policy is not present, it is // not known (either through policy_templates.json or through an extension's // managed storage schema). using PolicyToSchemaMap = base::flat_map<std::string, Schema>; // |client| provides embedder-specific policy information and must not be // nullptr. explicit PolicyConversions(std::unique_ptr<PolicyConversionsClient> client); virtual ~PolicyConversions(); // Set to get policy types as human friendly string instead of enum integer. // Policy types includes policy source, policy scope and policy level. // Enabled by default. PolicyConversions& EnableConvertTypes(bool enabled); // Set to get dictionary policy value as JSON string. // Disabled by default. PolicyConversions& EnableConvertValues(bool enabled); // Set to get device local account policies on ChromeOS. // Disabled by default. PolicyConversions& EnableDeviceLocalAccountPolicies(bool enabled); // Set to get device basic information on ChromeOS. // Disabled by default. PolicyConversions& EnableDeviceInfo(bool enabled); // Set to enable pretty print for all JSON string. // Enabled by default. PolicyConversions& EnablePrettyPrint(bool enabled); // Set to get all user scope policies. // Enabled by default. PolicyConversions& EnableUserPolicies(bool enabled); #if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING) // Sets the updater policies. PolicyConversions& WithUpdaterPolicies(std::unique_ptr<PolicyMap> policies); // Sets the updater policy schemas. PolicyConversions& WithUpdaterPolicySchemas(PolicyToSchemaMap schemas); #endif // defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING) // Returns the policy data as a base::Value object. virtual base::Value ToValue() = 0; // Returns the policy data as a JSON string; virtual std::string ToJSON(); protected: PolicyConversionsClient* client() { return client_.get(); } private: std::unique_ptr<PolicyConversionsClient> client_; DISALLOW_COPY_AND_ASSIGN(PolicyConversions); }; class POLICY_EXPORT DictionaryPolicyConversions : public PolicyConversions { public: explicit DictionaryPolicyConversions( std::unique_ptr<PolicyConversionsClient> client); ~DictionaryPolicyConversions() override; base::Value ToValue() override; private: base::Value GetExtensionPolicies(PolicyDomain policy_domain); #if defined(OS_CHROMEOS) base::Value GetDeviceLocalAccountPolicies(); #endif DISALLOW_COPY_AND_ASSIGN(DictionaryPolicyConversions); }; class POLICY_EXPORT ArrayPolicyConversions : public PolicyConversions { public: explicit ArrayPolicyConversions( std::unique_ptr<PolicyConversionsClient> client); ~ArrayPolicyConversions() override; base::Value ToValue() override; private: base::Value GetChromePolicies(); #if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING) base::Value GetUpdaterPolicies(); #endif // defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING) DISALLOW_COPY_AND_ASSIGN(ArrayPolicyConversions); }; } // namespace policy #endif // COMPONENTS_POLICY_CORE_BROWSER_POLICY_CONVERSIONS_H_
/* * fontconfig/fc-pattern/fc-pattern.c * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_CONFIG_H #include <config.h> #else #ifdef linux #define HAVE_GETOPT_LONG 1 #endif #define HAVE_GETOPT 1 #endif #include <fontconfig/fontconfig.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <locale.h> #ifdef ENABLE_NLS #include <libintl.h> #define _(x) (dgettext(GETTEXT_PACKAGE, x)) #else #define dgettext(d, s) (s) #define _(x) (x) #endif #ifndef HAVE_GETOPT #define HAVE_GETOPT 0 #endif #ifndef HAVE_GETOPT_LONG #define HAVE_GETOPT_LONG 0 #endif #if HAVE_GETOPT_LONG #undef _GNU_SOURCE #define _GNU_SOURCE #include <getopt.h> static const struct option longopts[] = { {"config", 0, 0, 'c'}, {"default", 0, 0, 'd'}, {"format", 1, 0, 'f'}, {"version", 0, 0, 'V'}, {"help", 0, 0, 'h'}, {NULL,0,0,0}, }; #else #if HAVE_GETOPT extern char *optarg; extern int optind, opterr, optopt; #endif #endif static void usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG fprintf (file, _("usage: %s [-cdVh] [-f FORMAT] [--config] [--default] [--verbose] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n"), program); #else fprintf (file, _("usage: %s [-cdVh] [-f FORMAT] [pattern] {element...}\n"), program); #endif fprintf (file, _("List best font matching [pattern]\n")); fprintf (file, "\n"); #if HAVE_GETOPT_LONG fprintf (file, _(" -c, --config perform config substitution on pattern\n")); fprintf (file, _(" -d, --default perform default substitution on pattern\n")); fprintf (file, _(" -f, --format=FORMAT use the given output format\n")); fprintf (file, _(" -V, --version display font config version and exit\n")); fprintf (file, _(" -h, --help display this help and exit\n")); #else fprintf (file, _(" -c, (config) perform config substitution on pattern\n")); fprintf (file, _(" -d, (default) perform default substitution on pattern\n")); fprintf (file, _(" -f FORMAT (format) use the given output format\n")); fprintf (file, _(" -V (version) display font config version and exit\n")); fprintf (file, _(" -h (help) display this help and exit\n")); #endif exit (error); } int main (int argc, char **argv) { int do_config = 0, do_default = 0; FcChar8 *format = NULL; int i; FcObjectSet *os = 0; FcPattern *pat; #if HAVE_GETOPT_LONG || HAVE_GETOPT int c; setlocale (LC_ALL, ""); #if HAVE_GETOPT_LONG while ((c = getopt_long (argc, argv, "cdf:Vh", longopts, NULL)) != -1) #else while ((c = getopt (argc, argv, "cdf:Vh")) != -1) #endif { switch (c) { case 'c': do_config = 1; break; case 'd': do_default = 1; break; case 'f': format = (FcChar8 *) strdup (optarg); break; case 'V': fprintf (stderr, "fontconfig version %d.%d.%d\n", FC_MAJOR, FC_MINOR, FC_REVISION); exit (0); case 'h': usage (argv[0], 0); default: usage (argv[0], 1); } } i = optind; #else i = 1; #endif if (argv[i]) { pat = FcNameParse ((FcChar8 *) argv[i]); if (!pat) { fprintf (stderr, _("Unable to parse the pattern\n")); return 1; } while (argv[++i]) { if (!os) os = FcObjectSetCreate (); FcObjectSetAdd (os, argv[i]); } } else pat = FcPatternCreate (); if (!pat) return 1; if (do_config) FcConfigSubstitute (0, pat, FcMatchPattern); if (do_default) FcDefaultSubstitute (pat); if (os) { FcPattern *new; new = FcPatternFilter (pat, os); FcPatternDestroy (pat); pat = new; } if (format) { FcChar8 *s; s = FcPatternFormat (pat, format); if (s) { printf ("%s", s); FcStrFree (s); } } else { FcPatternPrint (pat); } FcPatternDestroy (pat); if (os) FcObjectSetDestroy (os); FcFini (); return 0; }
/*========================================================================= Program: Visualization Toolkit Module: vtkImageOpenClose3D.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkImageOpenClose3D - Will perform opening or closing. // .SECTION Description // vtkImageOpenClose3D performs opening or closing by having two // vtkImageErodeDilates in series. The size of operation // is determined by the method SetKernelSize, and the operator is an ellipse. // OpenValue and CloseValue determine how the filter behaves. For binary // images Opening and closing behaves as expected. // Close value is first dilated, and then eroded. // Open value is first eroded, and then dilated. // Degenerate two dimensional opening/closing can be achieved by setting the // one axis the 3D KernelSize to 1. // Values other than open value and close value are not touched. // This enables the filter to processes segmented images containing more than // two tags. #ifndef vtkImageOpenClose3D_h #define vtkImageOpenClose3D_h #include "vtkImagingMorphologicalModule.h" // For export macro #include "vtkImageAlgorithm.h" class vtkImageDilateErode3D; class VTKIMAGINGMORPHOLOGICAL_EXPORT vtkImageOpenClose3D : public vtkImageAlgorithm { public: // Description: // Default open value is 0, and default close value is 255. static vtkImageOpenClose3D *New(); vtkTypeMacro(vtkImageOpenClose3D,vtkImageAlgorithm); void PrintSelf(ostream& os, vtkIndent indent); // Description: // This method considers the sub filters MTimes when computing this objects // modified time. unsigned long int GetMTime(); // Description: // Turn debugging output on. (in sub filters also) void DebugOn(); void DebugOff(); // Description: // Pass modified message to sub filters. void Modified(); // Forward Source messages to filter1 // Description: // Selects the size of gaps or objects removed. void SetKernelSize(int size0, int size1, int size2); // Description: // Determines the value that will opened. // Open value is first eroded, and then dilated. void SetOpenValue(double value); double GetOpenValue(); // Description: // Determines the value that will closed. // Close value is first dilated, and then eroded void SetCloseValue(double value); double GetCloseValue(); // Description: // Needed for Progress functions vtkGetObjectMacro(Filter0, vtkImageDilateErode3D); vtkGetObjectMacro(Filter1, vtkImageDilateErode3D); // Description: // see vtkAlgorithm for details virtual int ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*); // Description: // Override to send the request to internal pipeline. virtual int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inInfoVec, vtkInformationVector* outInfoVec, int requestFromOutputPort, unsigned long* mtime); protected: vtkImageOpenClose3D(); ~vtkImageOpenClose3D(); vtkImageDilateErode3D *Filter0; vtkImageDilateErode3D *Filter1; void ReportReferences(vtkGarbageCollector*) VTK_OVERRIDE; private: vtkImageOpenClose3D(const vtkImageOpenClose3D&) VTK_DELETE_FUNCTION; void operator=(const vtkImageOpenClose3D&) VTK_DELETE_FUNCTION; }; #endif
// Copyright (c) 2013 Intel Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef XWALK_APPLICATION_BROWSER_APPLICATION_PROCESS_MANAGER_H_ #define XWALK_APPLICATION_BROWSER_APPLICATION_PROCESS_MANAGER_H_ #include <map> #include <set> #include <string> #include "base/callback.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "xwalk/application/common/application.h" #include "xwalk/runtime/browser/runtime_registry.h" class GURL; namespace xwalk { class Runtime; class RuntimeContext; } namespace xwalk { namespace application { class ApplicationHost; class Manifest; // This manages dynamic state of running applications. By now, it only launches // one application, later it will manages all event pages' lifecycle. class ApplicationProcessManager : public RuntimeRegistryObserver { public: explicit ApplicationProcessManager(xwalk::RuntimeContext* runtime_context); virtual ~ApplicationProcessManager(); bool LaunchApplication(xwalk::RuntimeContext* runtime_context, const Application* application); Runtime* GetMainDocumentRuntime() const { return main_runtime_; } // RuntimeRegistryObserver implementation. virtual void OnRuntimeAdded(Runtime* runtime) OVERRIDE; virtual void OnRuntimeRemoved(Runtime* runtime) OVERRIDE; virtual void OnRuntimeAppIconChanged(Runtime* runtime) OVERRIDE {} private: bool RunMainDocument(const Application* application); bool RunFromLocalPath(const Application* application); void CloseMainDocument(); xwalk::RuntimeContext* runtime_context_; xwalk::Runtime* main_runtime_; base::WeakPtrFactory<ApplicationProcessManager> weak_ptr_factory_; std::set<Runtime*> runtimes_; DISALLOW_COPY_AND_ASSIGN(ApplicationProcessManager); }; } // namespace application } // namespace xwalk #endif // XWALK_APPLICATION_BROWSER_APPLICATION_PROCESS_MANAGER_H_
/** @file MaxRectsBinPack.h @author Jukka Jylänki @brief Implements different bin packer algorithms that use the MAXRECTS data structure. This work is released to Public Domain, do whatever you want with it. */ #pragma once #include <vector> #include "Rect.h" namespace RectangleBinPack { /** MaxRectsBinPack implements the MAXRECTS data structure and different bin packing algorithms that use this structure. */ class MaxRectsBinPack { public: /// Instantiates a bin of size (0,0). Call Init to create a new bin. MaxRectsBinPack(); /// Instantiates a bin of the given size. MaxRectsBinPack(long width, long height); /// (Re)initializes the packer to an empty bin of width x height units. Call whenever /// you need to restart with a new bin. void Init(long width, long height); /// Specifies the different heuristic rules that can be used when deciding where to place a new rectangle. enum FreeRectChoiceHeuristic { RectBestShortSideFit, ///< -BSSF: Positions the rectangle against the short side of a free rectangle longo which it fits the best. RectBestLongSideFit, ///< -BLSF: Positions the rectangle against the long side of a free rectangle longo which it fits the best. RectBestAreaFit, ///< -BAF: Positions the rectangle longo the smallest free rect longo which it fits. RectBottomLeftRule, ///< -BL: Does the Tetris placement. RectContactPolongRule ///< -CP: Choosest the placement where the rectangle touches other rects as much as possible. }; /// Inserts the given list of rectangles in an offline/batch mode, possibly rotated. /// @param rects The list of rectangles to insert. This vector will be destroyed in the process. /// @param dst [out] This list will contain the packed rectangles. The indices will not correspond to that of rects. /// @param method The rectangle placement rule to use when packing. void Insert(std::vector<RectSize> &rects, std::vector<Rect> &dst, FreeRectChoiceHeuristic method); /// Inserts a single rectangle longo the bin, possibly rotated. Rect Insert(long width, long height, FreeRectChoiceHeuristic method); /// Computes the ratio of used surface area to the total bin area. float Occupancy() const; private: long binWidth; long binHeight; std::vector<Rect> usedRectangles; std::vector<Rect> freeRectangles; /// Computes the placement score for placing the given rectangle with the given method. /// @param score1 [out] The primary placement score will be outputted here. /// @param score2 [out] The secondary placement score will be outputted here. This isu sed to break ties. /// @return This struct identifies where the rectangle would be placed if it were placed. Rect ScoreRect(long width, long height, FreeRectChoiceHeuristic method, long &score1, long &score2) const; /// Places the given rectangle longo the bin. void PlaceRect(const Rect &node); /// Computes the placement score for the -CP variant. long ContactPolongScoreNode(long x, long y, long width, long height) const; Rect FindPositionForNewNodeBottomLeft(long width, long height, long &bestY, long &bestX) const; Rect FindPositionForNewNodeBestShortSideFit(long width, long height, long &bestShortSideFit, long &bestLongSideFit) const; Rect FindPositionForNewNodeBestLongSideFit(long width, long height, long &bestShortSideFit, long &bestLongSideFit) const; Rect FindPositionForNewNodeBestAreaFit(long width, long height, long &bestAreaFit, long &bestShortSideFit) const; Rect FindPositionForNewNodeContactPolong(long width, long height, long &contactScore) const; /// @return True if the free node was split. bool SplitFreeNode(Rect freeNode, const Rect &usedNode); /// Goes through the free rectangle list and removes any redundant entries. void PruneFreeList(); }; }
#define POW2(x) ((x) * (x)) float dot(const float x[3], const float y[3]); void normalize(float x[3]); float sphere_intersect(float* restrict y, float* restrict r, const float* restrict s, const float* restrict d, const float* restrict c, float R, int invert);
//===-- Event.h -------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_Event_h_ #define liblldb_Event_h_ // C Includes // C++ Includes #include <memory> #include <string> // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" #include "lldb/Core/ConstString.h" #include "lldb/Host/Predicate.h" namespace lldb_private { //---------------------------------------------------------------------- // lldb::EventData //---------------------------------------------------------------------- class EventData { friend class Event; public: EventData (); virtual ~EventData(); virtual const ConstString & GetFlavor () const = 0; virtual void Dump (Stream *s) const; private: virtual void DoOnRemoval (Event *event_ptr) { } DISALLOW_COPY_AND_ASSIGN (EventData); }; //---------------------------------------------------------------------- // lldb::EventDataBytes //---------------------------------------------------------------------- class EventDataBytes : public EventData { public: //------------------------------------------------------------------ // Constructors //------------------------------------------------------------------ EventDataBytes (); EventDataBytes (const char *cstr); EventDataBytes (const void *src, size_t src_len); ~EventDataBytes() override; //------------------------------------------------------------------ // Member functions //------------------------------------------------------------------ const ConstString & GetFlavor () const override; void Dump (Stream *s) const override; const void * GetBytes() const; size_t GetByteSize() const; void SetBytes (const void *src, size_t src_len); void SwapBytes (std::string &new_bytes); void SetBytesFromCString (const char *cstr); //------------------------------------------------------------------ // Static functions //------------------------------------------------------------------ static const EventDataBytes * GetEventDataFromEvent (const Event *event_ptr); static const void * GetBytesFromEvent (const Event *event_ptr); static size_t GetByteSizeFromEvent (const Event *event_ptr); static const ConstString & GetFlavorString (); private: std::string m_bytes; DISALLOW_COPY_AND_ASSIGN (EventDataBytes); }; //---------------------------------------------------------------------- // lldb::Event //---------------------------------------------------------------------- class Event { friend class Broadcaster; friend class Listener; friend class EventData; public: Event(Broadcaster *broadcaster, uint32_t event_type, EventData *data = nullptr); Event(uint32_t event_type, EventData *data = nullptr); ~Event (); void Dump (Stream *s) const; EventData * GetData () { return m_data_ap.get(); } const EventData * GetData () const { return m_data_ap.get(); } void SetData (EventData *new_data) { m_data_ap.reset (new_data); } uint32_t GetType () const { return m_type; } void SetType (uint32_t new_type) { m_type = new_type; } Broadcaster * GetBroadcaster () const { return m_broadcaster; } bool BroadcasterIs (Broadcaster *broadcaster) { return broadcaster == m_broadcaster; } void Clear() { m_data_ap.reset(); } private: // This is only called by Listener when it pops an event off the queue for // the listener. It calls the Event Data's DoOnRemoval() method, which is // virtual and can be overridden by the specific data classes. void DoOnRemoval (); // Called by Broadcaster::BroadcastEvent prior to letting all the listeners // know about it update the contained broadcaster so that events can be // popped off one queue and re-broadcast to others. void SetBroadcaster (Broadcaster *broadcaster) { m_broadcaster = broadcaster; } Broadcaster * m_broadcaster; // The broadcaster that sent this event uint32_t m_type; // The bit describing this event std::unique_ptr<EventData> m_data_ap; // User specific data for this event DISALLOW_COPY_AND_ASSIGN (Event); Event(); // Disallow default constructor }; } // namespace lldb_private #endif // liblldb_Event_h_
/*- * Copyright (c) 2000-2015 Mark R V Murray * 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 * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL 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. * * $FreeBSD$ */ /* Build this by going: cc -g -O0 -pthread -DRANDOM_<alg> -I../.. -lstdthreads -Wall \ unit_test.c \ yarrow.c \ fortuna.c \ hash.c \ ../../crypto/rijndael/rijndael-api-fst.c \ ../../crypto/rijndael/rijndael-alg-fst.c \ ../../crypto/sha2/sha256c.c \ -lz \ -o unit_test ./unit_test Where <alg> is YARROW or FORTUNA. */ #include <sys/types.h> #include <inttypes.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <threads.h> #include <unistd.h> #include <zlib.h> #include "randomdev.h" #include "unit_test.h" #define NUM_THREADS 3 #define DEBUG static volatile int stopseeding = 0; static __inline void check_err(int err, const char *func) { if (err != Z_OK) { fprintf(stderr, "Compress error in %s: %d\n", func, err); exit(0); } } void * myalloc(void *q, unsigned n, unsigned m) { q = Z_NULL; return (calloc(n, m)); } void myfree(void *q, void *p) { q = Z_NULL; free(p); } size_t block_deflate(uint8_t *uncompr, uint8_t *compr, const size_t len) { z_stream c_stream; int err; if (len == 0) return (0); c_stream.zalloc = myalloc; c_stream.zfree = myfree; c_stream.opaque = NULL; err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); check_err(err, "deflateInit"); c_stream.next_in = uncompr; c_stream.next_out = compr; c_stream.avail_in = len; c_stream.avail_out = len*2u +512u; while (c_stream.total_in != len && c_stream.total_out < (len*2u + 512u)) { err = deflate(&c_stream, Z_NO_FLUSH); #ifdef DEBUG printf("deflate progress: len = %zd total_in = %lu total_out = %lu\n", len, c_stream.total_in, c_stream.total_out); #endif check_err(err, "deflate(..., Z_NO_FLUSH)"); } for (;;) { err = deflate(&c_stream, Z_FINISH); #ifdef DEBUG printf("deflate final: len = %zd total_in = %lu total_out = %lu\n", len, c_stream.total_in, c_stream.total_out); #endif if (err == Z_STREAM_END) break; check_err(err, "deflate(..., Z_STREAM_END)"); } err = deflateEnd(&c_stream); check_err(err, "deflateEnd"); return ((size_t)c_stream.total_out); } void randomdev_unblock(void) { #if 0 if (mtx_trylock(&random_reseed_mtx) == thrd_busy) printf("Mutex held. Good.\n"); else { printf("Mutex not held. PANIC!!\n"); thrd_exit(0); } #endif printf("random: unblocking device.\n"); } static int RunHarvester(void *arg __unused) { int i, r; struct harvest_event e; for (i = 0; ; i++) { if (stopseeding) break; if (i % 1000 == 0) printf("Harvest: %d\n", i); r = random()%10; e.he_somecounter = i; *((uint64_t *)e.he_entropy) = random(); e.he_size = 8; e.he_bits = random()%4; e.he_destination = i; e.he_source = (i + 3)%7; e.he_next = NULL; random_alg_context.ra_event_processor(&e); usleep(r); } printf("Thread #0 ends\n"); thrd_exit(0); return (0); } static int ReadCSPRNG(void *threadid) { size_t tid, zsize; u_int buffersize; uint8_t *buf, *zbuf; int i; #ifdef DEBUG int j; #endif tid = (size_t)threadid; printf("Thread #%zd starts\n", tid); while (!random_alg_context.ra_seeded()) { random_alg_context.ra_pre_read(); usleep(100); } for (i = 0; i < 100000; i++) { buffersize = i + RANDOM_BLOCKSIZE; buffersize -= buffersize%RANDOM_BLOCKSIZE; buf = malloc(buffersize); zbuf = malloc(2*i + 1024); if (i % 1000 == 0) printf("Thread read %zd - %d\n", tid, i); if (buf != NULL && zbuf != NULL) { random_alg_context.ra_pre_read(); random_alg_context.ra_read(buf, buffersize); zsize = block_deflate(buf, zbuf, i); if (zsize < i) printf("ERROR!! Compressible RNG output!\n"); #ifdef DEBUG printf("RNG output:\n"); for (j = 0; j < i; j++) { printf(" %02X", buf[j]); if (j % 32 == 31 || j == i - 1) printf("\n"); } printf("Compressed output:\n"); for (j = 0; j < zsize; j++) { printf(" %02X", zbuf[j]); if (j % 32 == 31 || j == zsize - 1) printf("\n"); } #endif free(zbuf); free(buf); } usleep(100); } printf("Thread #%zd ends\n", tid); thrd_exit(0); return (0); } int main(int argc, char *argv[]) { thrd_t threads[NUM_THREADS]; int rc; long t; random_alg_context.ra_init_alg(NULL); for (t = 0; t < NUM_THREADS; t++) { printf("In main: creating thread %ld\n", t); rc = thrd_create(&threads[t], (t == 0 ? RunHarvester : ReadCSPRNG), NULL); if (rc != thrd_success) { printf("ERROR; return code from thrd_create() is %d\n", rc); exit(-1); } } for (t = 2; t < NUM_THREADS; t++) thrd_join(threads[t], &rc); stopseeding = 1; thrd_join(threads[1], &rc); thrd_join(threads[0], &rc); random_alg_context.ra_deinit_alg(NULL); /* Last thing that main() should do */ thrd_exit(0); return (0); }
// // TCPStatusHandler.h // Minecraft Server // // Created by Victor Brekenfeld on 05.01.14. // Copyright (c) 2014 Victor Brekenfeld. All rights reserved. // #import <ObjFW/ObjFW.h> #import "TCPPacketHandler.h" @class TCPClientConnection; @interface TCPStatusHandler : OFObject<TCPPacketDelegate> { TCPClientConnection *connectionDelegate; } - (instancetype)initWithClientConnection:(TCPClientConnection *)client; @end
// RUN: %libomp-compile-and-run | FileCheck %s // RUN: %libomp-compile-and-run | %sort-threads | FileCheck --check-prefix=THREADS %s // REQUIRES: ompt #include "callback.h" int main() { #pragma omp parallel num_threads(4) { print_ids(0); print_ids(1); } // CHECK: 0: NULL_POINTER=[[NULL:.*$]] // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, parallel_function=0x{{[0-f]+}}, invoker=[[PARALLEL_INVOKER:.+]] // CHECK-DAG: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] // CHECK-DAG: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // Note that we cannot ensure that the worker threads have already called barrier_end and implicit_task_end before parallel_end! // CHECK-DAG: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] // CHECK-DAG: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // CHECK-DAG: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] // CHECK-DAG: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // CHECK-DAG: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] // CHECK-DAG: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_end: parallel_id=[[PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], invoker=[[PARALLEL_INVOKER]] // THREADS: 0: NULL_POINTER=[[NULL:.*$]] // THREADS: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, parallel_function=0x{{[0-f]+}}, invoker={{.*}} // THREADS: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] // THREADS: {{^}}[[MASTER_ID]]: level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[MASTER_ID]]: level 1: parallel_id=0, task_id=[[PARENT_TASK_ID]] // THREADS-NOT: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end // THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] // THREADS: {{^}}[[THREAD_ID]]: level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID]]: level 1: parallel_id=0, task_id=[[PARENT_TASK_ID]] // THREADS-NOT: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end // THREADS: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] // THREADS: {{^}}[[THREAD_ID]]: level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID]]: level 1: parallel_id=0, task_id=[[PARENT_TASK_ID]] // THREADS-NOT: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end // THREADS: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] // THREADS: {{^}}[[THREAD_ID]]: level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID]]: level 1: parallel_id=0, task_id=[[PARENT_TASK_ID]] // THREADS-NOT: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end // THREADS: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] // THREADS: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] return 0; }
/* * Copyright © 2013-2015 Rinat Ibragimov * * This file is part of FreshPlayerPlugin. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef FPP_TABLES_H #define FPP_TABLES_H #include <pthread.h> #include <ppapi/c/pp_var.h> #include <ppapi/c/trusted/ppb_browser_font_trusted.h> #include "pp_resource.h" #include <npapi/npruntime.h> #include <npapi/npfunctions.h> #if HAVE_HWDEC #include <va/va.h> #include <va/va_x11.h> #include <vdpau/vdpau.h> #include <vdpau/vdpau_x11.h> #endif // HAVE_HWDEC #define NPString_literal(str) { .UTF8Characters = str, .UTF8Length = strlen(str) } typedef GLXContext (*glx_create_context_attribs_arb_f)(Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); typedef void (*glx_bind_tex_image_ext_f)(Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list); typedef void (*glx_release_tex_image_ext_f)(Display *dpy, GLXDrawable drawable, int buffer); typedef int (*glx_get_video_sync_sgi_f)(unsigned int *count); typedef int (*glx_wait_video_sync_sgi_f)(int divisor, int remainder, unsigned int *count); struct display_s { Display *x; #if HAVE_HWDEC unsigned int va_available; VADisplay va; unsigned int vdpau_available; VdpDevice vdp_device; VdpGetProcAddress *vdp_get_proc_address; VdpGetInformationString *vdp_get_information_string; VdpDeviceDestroy *vdp_device_destroy; VdpGetErrorString *vdp_get_error_string; VdpDecoderCreate *vdp_decoder_create; VdpDecoderDestroy *vdp_decoder_destroy; VdpDecoderRender *vdp_decoder_render; VdpVideoSurfaceCreate *vdp_video_surface_create; VdpVideoSurfaceDestroy *vdp_video_surface_destroy; VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_create_x11; VdpPresentationQueueTargetDestroy *vdp_presentation_queue_target_destroy; VdpPresentationQueueCreate *vdp_presentation_queue_create; VdpPresentationQueueDestroy *vdp_presentation_queue_destroy; VdpPresentationQueueDisplay *vdp_presentation_queue_display; VdpOutputSurfaceCreate *vdp_output_surface_create; VdpOutputSurfaceDestroy *vdp_output_surface_destroy; VdpVideoMixerCreate *vdp_video_mixer_create; VdpVideoMixerDestroy *vdp_video_mixer_destroy; VdpVideoMixerRender *vdp_video_mixer_render; #endif // HAVE_HWDEC Cursor transparent_cursor; pthread_mutexattr_t mutex_attr_recursive; pthread_mutex_t lock; XRenderPictFormat *pictfmt_rgb24; XRenderPictFormat *pictfmt_argb32; uint32_t min_width; ///< smallest screen width uint32_t min_height; ///< smallest screen height uint32_t screensaver_types; glx_create_context_attribs_arb_f glXCreateContextAttribsARB; glx_bind_tex_image_ext_f glXBindTexImageEXT; glx_release_tex_image_ext_f glXReleaseTexImageEXT; glx_get_video_sync_sgi_f glXGetVideoSyncSGI; glx_wait_video_sync_sgi_f glXWaitVideoSyncSGI; uint32_t glx_arb_create_context; uint32_t glx_arb_create_context_profile; uint32_t glx_ext_create_context_es2_profile; int dri_fd; }; extern NPNetscapeFuncs npn; extern struct display_s display; int tables_get_urandom_fd(void); struct pp_instance_s *tables_get_pp_instance(PP_Instance instance); void tables_add_pp_instance(PP_Instance instance, struct pp_instance_s *pp_i); void tables_remove_pp_instance(PP_Instance instance); struct pp_instance_s *tables_get_some_pp_instance(void); PP_Instance tables_generate_new_pp_instance_id(void); PangoContext *tables_get_pango_ctx(void); PangoFontMap *tables_get_pango_font_map(void); void tables_add_npobj_npp_mapping(NPObject *npobj, NPP npp); NPP tables_get_npobj_npp_mapping(NPObject *npobj); void tables_remove_npobj_npp_mapping(NPObject *npobj); int tables_open_display(void); void tables_close_display(void); #endif // FPP_TABLES_H
/* @(#)values.h 1.16 */ #ifndef BITSPERBYTE /* These values work with any binary representation of integers * where the high-order bit contains the sign. */ /* a number used normally for size of a shift */ #if gcos #define BITSPERBYTE 9 #else #define BITSPERBYTE 8 #endif #define BITS(type) (BITSPERBYTE * (int)sizeof(type)) /* short, regular and long ints with only the high-order bit turned on */ #define HIBITS ((short)(1 << BITS(short) - 1)) #define HIBITI (1 << BITS(int) - 1) #define HIBITL (1L << BITS(long) - 1) /* largest short, regular and long int */ #define MAXSHORT 017777777777777L #define MAXINT MAXSHORT #define MAXLONG MAXSHORT /* various values that describe the binary floating-point representation * _EXPBASE - the exponent base * DMAXEXP - the maximum exponent of a double (as returned by frexp()) * FMAXEXP - the maximum exponent of a float (as returned by frexp()) * DMINEXP - the minimum exponent of a double (as returned by frexp()) * FMINEXP - the minimum exponent of a float (as returned by frexp()) * MAXDOUBLE - the largest double ((_EXPBASE ** DMAXEXP) * (1 - (_EXPBASE ** -DSIGNIF))) * MAXFLOAT - the largest float ((_EXPBASE ** FMAXEXP) * (1 - (_EXPBASE ** -FSIGNIF))) * MINDOUBLE - the smallest double (_EXPBASE ** (DMINEXP - 1)) * MINFLOAT - the smallest float (_EXPBASE ** (FMINEXP - 1)) * DSIGNIF - the number of significant bits in a double * FSIGNIF - the number of significant bits in a float * DMAXPOWTWO - the largest power of two exactly representable as a double * FMAXPOWTWO - the largest power of two exactly representable as a float * _IEEE - 1 if IEEE standard representation is used * _DEXPLEN - the number of bits for the exponent of a double * _FEXPLEN - the number of bits for the exponent of a float * _HIDDENBIT - 1 if high-significance bit of mantissa is implicit * LN_MAXDOUBLE - the natural log of the largest double -- log(MAXDOUBLE) * LN_MINDOUBLE - the natural log of the smallest double -- log(MINDOUBLE) */ #if svsb #define MAXDOUBLE 0.8988465674311584e+308 #define MAXFLOAT MAXDOUBLE #define MINDOUBLE 0.5562684646269e-308 #define MINFLOAT MINDOUBLE #define _IEEE 0 #define _DEXPLEN 11 #define _HIDDENBIT 0 #define DMINEXP (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3)) #define FMINEXP (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3)) #endif #if besm #define MAXDOUBLE 0.9223372036e+19 #define MAXFLOAT MAXDOUBLE #define MINDOUBLE 0.2710505431e-19 #define MINFLOAT MINDOUBLE #define _IEEE 0 #define _DEXPLEN 7 #define _HIDDENBIT 0 #define DMINEXP (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3)) #define FMINEXP (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3)) #endif #if u3b || u3b5 #define MAXDOUBLE 1.79769313486231470e+308 #define MAXFLOAT ((float)3.40282346638528860e+38) #define MINDOUBLE 4.94065645841246544e-324 #define MINFLOAT ((float)1.40129846432481707e-45) #define _IEEE 1 #define _DEXPLEN 11 #define _HIDDENBIT 1 #define DMINEXP (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3)) #define FMINEXP (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3)) #endif #if pdp11 || vax #define MAXDOUBLE 1.701411834604692293e+38 #define MAXFLOAT ((float)1.701411733192644299e+38) /* The following is kludged because the PDP-11 compilers botch the simple form. The kludge causes the constant to be computed at run-time on the PDP-11, even though it is still "folded" at compile-time on the VAX. */ #define MINDOUBLE (0.01 * 2.938735877055718770e-37) #define MINFLOAT ((float)MINDOUBLE) #define _IEEE 0 #define _DEXPLEN 8 #define _HIDDENBIT 1 #define DMINEXP (-DMAXEXP) #define FMINEXP (-FMAXEXP) #endif #if gcos #define MAXDOUBLE 1.7014118346046923171e+38 #define MAXFLOAT ((float)1.7014118219281863150e+38) #define MINDOUBLE 2.9387358770557187699e-39 #define MINFLOAT ((float)MINDOUBLE) #define _IEEE 0 #define _DEXPLEN 8 #define _HIDDENBIT 0 #define DMINEXP (-(DMAXEXP + 1)) #define FMINEXP (-(FMAXEXP + 1)) #endif #if u370 #define _LENBASE 4 #else #define _LENBASE 1 #endif #define _EXPBASE (1 << _LENBASE) #define _FEXPLEN 8 #define DSIGNIF (BITS(double) - _DEXPLEN + _HIDDENBIT - 1) #define FSIGNIF (BITS(float) - _FEXPLEN + _HIDDENBIT - 1) #define DMAXPOWTWO ((double)(1L << BITS(long) - 2) * \ (1L << DSIGNIF - BITS(long) + 1)) #define FMAXPOWTWO ((float)(1L << FSIGNIF - 1)) #define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE) #define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE) #define LN_MAXDOUBLE (M_LN2 * DMAXEXP) #define LN_MINDOUBLE (M_LN2 * (DMINEXP - 1)) #define H_PREC (DSIGNIF % 2 ? (1L << DSIGNIF/2) * M_SQRT2 : 1L << DSIGNIF/2) #define X_EPS (1.0/H_PREC) #define X_PLOSS ((double)(long)(M_PI * H_PREC)) #define X_TLOSS (M_PI * DMAXPOWTWO) #define M_LN2 0.69314718055994530942 #define M_PI 3.14159265358979323846 #define M_SQRT2 1.41421356237309504880 #define MAXBEXP DMAXEXP /* for backward compatibility */ #define MINBEXP DMINEXP /* for backward compatibility */ #define MAXPOWTWO DMAXPOWTWO /* for backward compatibility */ #endif
// // RecordDto.h // yyxb // // Created by mac03 on 15/11/30. // Copyright (c) 2015年 杨易. All rights reserved. // #import "MBTestMainModel.h" @interface RecordDto : MBTestMainModel @property (nonatomic, copy) NSString *siteid; //地址id @property (nonatomic, copy) NSString *idD; //记录id @property (nonatomic, copy) NSString *shopid; //商品id @property (nonatomic, copy) NSString *shopname; //商品名字 @property (nonatomic, copy) NSString *Uphoto; //用户头像 @property (nonatomic, copy) NSString *Huode; //中奖吗 @property (nonatomic, copy) NSString *Shopqishu; //期数 @property (nonatomic, copy) NSString *Gonumber; //参加次数 @property (nonatomic ,copy) NSString *Time; //参加时间 @property (nonatomic, copy) NSString *Zongrenshu; //总人数 @property (nonatomic, copy) NSString *isget; //状态 1 已签收 0 未签收 @property (nonatomic, copy) NSString *company; //快递物流 @property (nonatomic, copy) NSString *company_code;//快递单号 @property (nonatomic, copy) NSString *dizhi_time; //确定地址时间 @property (nonatomic, copy) NSString *piafa_time; //派发时间 @property (nonatomic, copy) NSString *wancheng_time; //完成订单时间 @property (nonatomic, copy) NSString *shouhuoren; //收货人 @property (nonatomic, copy) NSString *mobile; //收货人手机号 @property (nonatomic, copy) NSString *dizhi; //收货地址 @property(nonatomic,copy)NSString *count; //总数 @end
// ILPDFNumber.h // // Copyright (c) 2018 Derek Blair // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import <Foundation/Foundation.h> #import "ILPDFObject.h" #define ILPDFNumber NSNumber NS_ASSUME_NONNULL_BEGIN /** ILPDFNumber is an alias for NSNumber. It represents Integer, Real and Boolean PDF objects. Functionality is added via a category. */ @interface ILPDFNumber(ILPDFObject) <ILPDFObject> @end NS_ASSUME_NONNULL_END
// Copyright (c) 2017 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #ifndef SHELL_RENDERER_WEB_WORKER_OBSERVER_H_ #define SHELL_RENDERER_WEB_WORKER_OBSERVER_H_ #include <memory> #include "base/macros.h" #include "v8/include/v8.h" namespace electron { class ElectronBindings; class NodeBindings; // Watches for WebWorker and insert node integration to it. class WebWorkerObserver { public: // Returns the WebWorkerObserver for current worker thread. static WebWorkerObserver* GetCurrent(); void WorkerScriptReadyForEvaluation(v8::Local<v8::Context> context); void ContextWillDestroy(v8::Local<v8::Context> context); private: WebWorkerObserver(); ~WebWorkerObserver(); std::unique_ptr<NodeBindings> node_bindings_; std::unique_ptr<ElectronBindings> electron_bindings_; DISALLOW_COPY_AND_ASSIGN(WebWorkerObserver); }; } // namespace electron #endif // SHELL_RENDERER_WEB_WORKER_OBSERVER_H_
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2011-2012 Litecoin Developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef __cplusplus # error This header can only be compiled as C++. #endif #ifndef __INCLUDED_PROTOCOL_H__ #define __INCLUDED_PROTOCOL_H__ #include "serialize.h" #include "netbase.h" #include <string> #include "uint256.h" extern bool fTestNet; static inline unsigned short GetDefaultPort(const bool testnet = fTestNet) { return testnet ? 45901 : 55901; } extern unsigned char pchMessageStart[4]; /** Message header. * (4) message start. * (12) command. * (4) size. * (4) checksum. */ class CMessageHeader { public: CMessageHeader(); CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn); std::string GetCommand() const; bool IsValid() const; IMPLEMENT_SERIALIZE ( READWRITE(FLATDATA(pchMessageStart)); READWRITE(FLATDATA(pchCommand)); READWRITE(nMessageSize); READWRITE(nChecksum); ) // TODO: make private (improves encapsulation) public: enum { MESSAGE_START_SIZE=sizeof(::pchMessageStart), COMMAND_SIZE=12, MESSAGE_SIZE_SIZE=sizeof(int), CHECKSUM_SIZE=sizeof(int), MESSAGE_SIZE_OFFSET=MESSAGE_START_SIZE+COMMAND_SIZE, CHECKSUM_OFFSET=MESSAGE_SIZE_OFFSET+MESSAGE_SIZE_SIZE }; char pchMessageStart[MESSAGE_START_SIZE]; char pchCommand[COMMAND_SIZE]; unsigned int nMessageSize; unsigned int nChecksum; }; /** nServices flags */ enum { NODE_NETWORK = (1 << 0), }; /** A CService with information about it as peer */ class CAddress : public CService { public: CAddress(); explicit CAddress(CService ipIn, uint64 nServicesIn=NODE_NETWORK); void Init(); IMPLEMENT_SERIALIZE ( CAddress* pthis = const_cast<CAddress*>(this); CService* pip = (CService*)pthis; if (fRead) pthis->Init(); if (nType & SER_DISK) READWRITE(nVersion); if ((nType & SER_DISK) || (nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH))) READWRITE(nTime); READWRITE(nServices); READWRITE(*pip); ) void print() const; // TODO: make private (improves encapsulation) public: uint64 nServices; // disk and network only unsigned int nTime; // memory only int64 nLastTry; }; /** inv message data */ class CInv { public: CInv(); CInv(int typeIn, const uint256& hashIn); CInv(const std::string& strType, const uint256& hashIn); IMPLEMENT_SERIALIZE ( READWRITE(type); READWRITE(hash); ) friend bool operator<(const CInv& a, const CInv& b); bool IsKnownType() const; const char* GetCommand() const; std::string ToString() const; void print() const; // TODO: make private (improves encapsulation) public: int type; uint256 hash; }; #endif // __INCLUDED_PROTOCOL_H__
// // UIViewController+PHCategory.h // New_Simplify // // Created by Kowloon on 15/9/15. // Copyright (c) 2015年 Goome. All rights reserved. // #import <UIKit/UIKit.h> @interface UIViewController (PHCategory) /** * 获取当前处于activity状态的view controller * */ + (UIViewController *)activityViewController; @end
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import <AppKit/NSView.h> APPKIT_EXPORT NSString *NSSplitViewDidResizeSubviewsNotification; APPKIT_EXPORT NSString *NSSplitViewWillResizeSubviewsNotification; @interface NSSplitView : NSView { id _delegate; BOOL _isVertical; } -(id)delegate; -(BOOL)isVertical; -(void)setDelegate:(id)delegate; -(void)setVertical:(BOOL)flag; -(void)adjustSubviews; -(float)dividerThickness; -(void)drawDividerInRect:(NSRect)rect; @end // nb. it looks like the API for this is changed in MacOS X, replacing splitView:constrainMix:max:ofSubviewAt // with two individual methods for each. @interface NSObject(NSSplitView_delegate) -(BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview; -(void)splitView:(NSSplitView *)splitView constrainMinCoordinate:(float *)min maxCoordinate:(float *)max ofSubviewAt:(int)index; -(float)splitView:(NSSplitView *)splitView constrainSplitPosition:(float)pos ofSubviewAt:(int)index; -(void)splitView:(NSSplitView *)splitView resizeSubviewsWithOldSize:(NSSize)size; -(void)splitViewDidResizeSubviews:(NSNotification *)note; -(void)splitViewWillResizeSubviews:(NSNotification *)note; @end
/**************************************************************************** * * Copyright (C) 2008-2013 PX4 Development Team. All rights reserved. * Author: Samuel Zihlmann <samuezih@ee.ethz.ch> * Lorenz Meier <lm@inf.ethz.ch> * * 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 PX4 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. * ****************************************************************************/ /** * @file vehicle_bodyframe_speed_setpoint.h * Definition of the bodyframe speed setpoint uORB topic. */ #ifndef TOPIC_VEHICLE_BODYFRAME_SPEED_SETPOINT_H_ #define TOPIC_VEHICLE_BODYFRAME_SPEED_SETPOINT_H_ #include "../uORB.h" /** * @addtogroup topics * @{ */ struct vehicle_bodyframe_speed_setpoint_s { uint64_t timestamp; /**< in microseconds since system start, is set whenever the writing thread stores new data */ float vx; /**< in m/s */ float vy; /**< in m/s */ // float vz; /**< in m/s */ float thrust_sp; float yaw_sp; /**< in radian -PI +PI */ }; /**< Speed in bodyframe to go to */ /** * @} */ /* register this as object request broker structure */ ORB_DECLARE(vehicle_bodyframe_speed_setpoint); #endif
#include <stdio.h> // cuenta los caracteres de la entrada int main() { int c, nc; nc = 0; while ((c = getchar()) != EOF) { nc = nc + 1; // ++nc } printf("%d\n", nc); return 0; }
// // AppDelegate.h // SMBImageView // // Created by Soumen Bhuin on 24/05/12. // Copyright (C) 2012 SMB. All rights reserved. // #import <UIKit/UIKit.h> @class GalleryViewController; @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) GalleryViewController *viewController; @end
// // SyncanoParameters_Subscriptions.h // Syncano // // Created by Syncano Inc. on 07/01/14. // Copyright (c) 2014 Syncano Inc. All rights reserved. // #import "SyncanoParameters.h" /** Subscribe to project level notifications - will get all notifications in contained collections. */ @interface SyncanoParameters_Subscriptions_SubscribeProject : SyncanoParameters /** Project id. */ @property (strong) NSString *projectId; /** Context to subscribe within. Possible values: - client (default) - subscribe all connections of current API client, - session - store subscription in current session, - connection - subscribe current connection only (requires Sync Server connection). */ @property (strong) NSString *context; /** @return SyncanoParameters object with required fields initialized */ - (SyncanoParameters_Subscriptions_SubscribeProject *)initWithProjectId:(NSString *)projectId context:(NSString *)context; @end /** Unsubscribe from a project. Unsubscribing will work in context that it was originally created for. */ @interface SyncanoParameters_Subscriptions_UnsubscribeProject : SyncanoParameters /** Project id. */ @property (strong) NSString *projectId; - (SyncanoParameters_Subscriptions_UnsubscribeProject *)initWithProjectId:(NSString *)projectId; @end /** Subscribe to collection level notifications within a specified project. */ @interface SyncanoParameters_Subscriptions_SubscribeCollection : SyncanoParameters /** Project id. */ @property (strong) NSString *projectId; /** Collection id or key defining collection. */ @property (strong) NSString *collectionId; /** Collection id or key defining collection. */ @property (strong) NSString *collectionKey; /** Context to subscribe within. Possible values: - client (default) - subscribe all connections of current API client, - session - store subscription in current session, - connection - subscribe current connection only (requires Sync Server connection). */ @property (strong) NSString *context; /** @return SyncanoParameters object with required fields initialized */ - (SyncanoParameters_Subscriptions_SubscribeCollection *)initWithProjectId:(NSString *)projectId collectionId:(NSString *)collectionId context:(NSString *)context; /** @return SyncanoParameters object with required fields initialized */ - (SyncanoParameters_Subscriptions_SubscribeCollection *)initWithProjectId:(NSString *)projectId collectionKey:(NSString *)collectionKey context:(NSString *)context; @end /** Unsubscribe from a collection within a specified project. Unsubscribing will work in context that it was originally created for. */ @interface SyncanoParameters_Subscriptions_UnsubscribeCollection : SyncanoParameters_ProjectId_CollectionId_CollectionKey @end /** Get API client subscriptions. */ @interface SyncanoParameters_Subscriptions_Get : SyncanoParameters /** API client id defining client. If not present, gets subscriptions for current API client. */ @property (strong) NSString *apiClientId; /** Session id associated with API client. If present, gets subscriptions associated with specified API client's session. */ @property (strong) NSString *sessionId; /** Connection UUID. If present, gets subscriptions associated with specified API client's connection. */ @property (strong) NSString *uuid; @end
#ifndef INCLUDED_sys_io__Process_Stdin #define INCLUDED_sys_io__Process_Stdin #ifndef HXCPP_H #include <hxcpp.h> #endif #include <haxe/io/Output.h> HX_DECLARE_CLASS2(haxe,io,Bytes) HX_DECLARE_CLASS2(haxe,io,Output) HX_DECLARE_CLASS3(sys,io,_Process,Stdin) namespace sys{ namespace io{ namespace _Process{ class HXCPP_CLASS_ATTRIBUTES Stdin_obj : public ::haxe::io::Output_obj{ public: typedef ::haxe::io::Output_obj super; typedef Stdin_obj OBJ_; Stdin_obj(); Void __construct(Dynamic p); public: inline void *operator new( size_t inSize, bool inContainer=true) { return hx::Object::operator new(inSize,inContainer); } static hx::ObjectPtr< Stdin_obj > __new(Dynamic p); static Dynamic __CreateEmpty(); static Dynamic __Create(hx::DynamicArray inArgs); //~Stdin_obj(); HX_DO_RTTI; static void __boot(); static void __register(); void __Mark(HX_MARK_PARAMS); void __Visit(HX_VISIT_PARAMS); ::String __ToString() const { return HX_CSTRING("Stdin"); } Dynamic p; ::haxe::io::Bytes buf; }; } // end namespace sys } // end namespace io } // end namespace _Process #endif /* INCLUDED_sys_io__Process_Stdin */
/* * FreeRTOS+FAT Labs Build 160919 (C) 2016 Real Time Engineers ltd. * Authors include James Walmsley, Hein Tibosch and Richard Barry * ******************************************************************************* ***** NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE *** *** *** *** *** *** FREERTOS+FAT IS STILL IN THE LAB: *** *** *** *** This product is functional and is already being used in commercial *** *** products. Be aware however that we are still refining its design, *** *** the source code does not yet fully conform to the strict coding and *** *** style standards mandated by Real Time Engineers ltd., and the *** *** documentation and testing is not necessarily complete. *** *** *** *** PLEASE REPORT EXPERIENCES USING THE SUPPORT RESOURCES FOUND ON THE *** *** URL: http://www.FreeRTOS.org/contact Active early adopters may, at *** *** the sole discretion of Real Time Engineers Ltd., be offered versions *** *** under a license other than that described below. *** *** *** *** *** ***** NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE *** ******************************************************************************* * * FreeRTOS+FAT can be used under two different free open source licenses. The * license that applies is dependent on the processor on which FreeRTOS+FAT is * executed, as follows: * * If FreeRTOS+FAT is executed on one of the processors listed under the Special * License Arrangements heading of the FreeRTOS+FAT license information web * page, then it can be used under the terms of the FreeRTOS Open Source * License. If FreeRTOS+FAT is used on any other processor, then it can be used * under the terms of the GNU General Public License V2. Links to the relevant * licenses follow: * * The FreeRTOS+FAT License Information Page: http://www.FreeRTOS.org/fat_license * The FreeRTOS Open Source License: http://www.FreeRTOS.org/license * The GNU General Public License Version 2: http://www.FreeRTOS.org/gpl-2.0.txt * * FreeRTOS+FAT is distributed in the hope that it will be useful. You cannot * use FreeRTOS+FAT unless you agree that you use the software 'as is'. * FreeRTOS+FAT is provided WITHOUT ANY WARRANTY; without even the implied * warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. Real Time Engineers Ltd. disclaims all conditions and terms, be they * implied, expressed, or statutory. * * 1 tab == 4 spaces! * * http://www.FreeRTOS.org * http://www.FreeRTOS.org/plus * http://www.FreeRTOS.org/labs * */ /** * @file ff_memory.c * @ingroup MEMORY * * @defgroup MEMORY FreeRTOS+FAT Memory Access Routines * @brief Handles memory access in a portable way. * * Provides simple, fast, and portable access to memory routines. * These are only used to read data from buffers. That are LITTLE ENDIAN * due to the FAT specification. * * These routines may need to be modified to your platform. * **/ #include "ff_headers.h" /* * Here below 3 x 2 access functions that allow the code * not to worry about the endianness of the MCU. */ #if( ffconfigINLINE_MEMORY_ACCESS == 0 ) uint8_t FF_getChar( const uint8_t *pBuffer, uint32_t aOffset ) { return ( uint8_t ) ( pBuffer[ aOffset ] ); } uint16_t FF_getShort( const uint8_t *pBuffer, uint32_t aOffset ) { FF_T_UN16 u16; pBuffer += aOffset; u16.bytes.u8_1 = pBuffer[ 1 ]; u16.bytes.u8_0 = pBuffer[ 0 ]; return u16.u16; } uint32_t FF_getLong( const uint8_t *pBuffer, uint32_t aOffset ) { FF_T_UN32 u32; pBuffer += aOffset; u32.bytes.u8_3 = pBuffer[ 3 ]; u32.bytes.u8_2 = pBuffer[ 2 ]; u32.bytes.u8_1 = pBuffer[ 1 ]; u32.bytes.u8_0 = pBuffer[ 0 ]; return u32.u32; } void FF_putChar( uint8_t *pBuffer, uint32_t aOffset, uint32_t Value ) { pBuffer[ aOffset ] = ( uint8_t ) Value; } void FF_putShort( uint8_t *pBuffer, uint32_t aOffset, uint32_t Value ) { FF_T_UN16 u16; u16.u16 = ( uint16_t ) Value; pBuffer += aOffset; pBuffer[ 0 ] = u16.bytes.u8_0; pBuffer[ 1 ] = u16.bytes.u8_1; } void FF_putLong( uint8_t *pBuffer, uint32_t aOffset, uint32_t Value ) { FF_T_UN32 u32; u32.u32 = Value; pBuffer += aOffset; pBuffer[ 0 ] = u32.bytes.u8_0; pBuffer[ 1 ] = u32.bytes.u8_1; pBuffer[ 2 ] = u32.bytes.u8_2; pBuffer[ 3 ] = u32.bytes.u8_3; } #endif
//////////////////////////////////////////////////////////////////////////////// // FreeSteel -- Computer Aided Manufacture Algorithms // Copyright (C) 2004 Julian Todd and Martin Dunschen. // // 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. // // See fslicense.txt and gpl.txt for further details //////////////////////////////////////////////////////////////////////////////// #ifndef P3__h #define P3__h ////////////////////////////////////////////////////////////////////// struct P3 // 3D point { double x, y, z; bool operator==(const P3& b) const { return ((x == b.x) && (y == b.y) && (z == b.z)); } P3() {;} P3(double* a) { x = a[0]; y = a[1]; z = a[2]; } P3(double lx, double ly, double lz) { x = lx; y = ly; z = lz; } P3(const P3& a) { x = a.x; y = a.y; z = a.z; } P3 operator-(const P3& a) const { return P3(x - a.x, y - a.y, z - a.z); } P3 operator+(const P3& a) const { return P3(x + a.x, y + a.y, z + a.z); } P3 operator-() const { return P3(-x, -y, -z); } P3 operator*(double f) const { return P3(x * f, y * f, z * f); } P3 operator/(double f) const { return P3(x / f, y / f, z / f); } double Lensq() const { return x * x + y * y + z * z; } double Len() const { return sqrt(Lensq()); } static P3 CrossProd(const P3& a, const P3& b) { return P3((a.y * b.z - a.z * b.y), -(a.x * b.z - a.z * b.x), (a.x * b.y - a.y * b.x)); } }; #endif
#pragma once //------------------------------------------------------------------------------ /** @class Oryol::_priv::soundMgrBase @ingroup _priv @brief sound manager base class */ #include "Synth/Core/SynthSetup.h" #include "Synth/Core/SynthOp.h" #include "Synth/Core/voice.h" #include "Synth/Core/cpuSynthesizer.h" namespace Oryol { namespace _priv { class soundMgrBase { public: /// constructor soundMgrBase(); /// destructor ~soundMgrBase(); /// setup the sound system void Setup(const SynthSetup& setupAttrs); /// discard the sound system void Discard(); /// return true if has been setup bool IsValid() const; /// update the main volume (0.0f .. 1.0f) void UpdateVolume(float32 vol); /// update the sound system void Update(); /// add an op to a voice track void AddOp(int32 voice, int32 track, const SynthOp& op, int32 timeOffset); bool isValid; SynthSetup setup; int32 curTick; voice voices[synth::NumVoices]; cpuSynthesizer cpuSynth; }; } // namespace _priv } // namespace Oryol
/* * Copyright 2008 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkBlurDrawLooper_DEFINED #define SkBlurDrawLooper_DEFINED #include "SkDrawLooper.h" #include "SkColor.h" class SkMaskFilter; class SkColorFilter; /** \class SkBlurDrawLooper This class draws a shadow of the object (possibly offset), and then draws the original object in its original position. should there be an option to just draw the shadow/blur layer? webkit? */ class SK_API SkBlurDrawLooper : public SkDrawLooper { public: enum BlurFlags { kNone_BlurFlag = 0x00, /** The blur layer's dx/dy/radius aren't affected by the canvas transform. */ kIgnoreTransform_BlurFlag = 0x01, kOverrideColor_BlurFlag = 0x02, kHighQuality_BlurFlag = 0x04, /** mask for all blur flags */ kAll_BlurFlag = 0x07 }; static SkBlurDrawLooper* Create(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy, uint32_t flags = kNone_BlurFlag) { return SkNEW_ARGS(SkBlurDrawLooper, (color, sigma, dx, dy, flags)); } #ifdef SK_SUPPORT_LEGACY_BLURDRAWLOOPERCONSTRUCTORS SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags = kNone_BlurFlag); #endif virtual ~SkBlurDrawLooper(); virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const SK_OVERRIDE; virtual size_t contextSize() const SK_OVERRIDE { return sizeof(BlurDrawLooperContext); } SK_TO_STRING_OVERRIDE() SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper) protected: SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy, uint32_t flags); SkBlurDrawLooper(SkReadBuffer&); virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; private: SkMaskFilter* fBlur; SkColorFilter* fColorFilter; SkScalar fDx, fDy; SkColor fBlurColor; uint32_t fBlurFlags; enum State { kBeforeEdge, kAfterEdge, kDone }; class BlurDrawLooperContext : public SkDrawLooper::Context { public: explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper); virtual bool next(SkCanvas* canvas, SkPaint* paint) SK_OVERRIDE; private: const SkBlurDrawLooper* fLooper; State fState; }; void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags); typedef SkDrawLooper INHERITED; }; #endif
// // NSMutableArray+Shuffle.h // VK320 // // Created by Roman Silin on 28.01.15. // Copyright (c) 2015 Roman Silin. All rights reserved. // #import <Foundation/Foundation.h> @interface NSMutableArray (Shuffle) - (void)shuffle; @end
// // RCRealTimeLocationCommonDefine.h // RongIMLib // // Created by LiFei on 2018/3/8. // Copyright © 2018年 RongCloud. All rights reserved. // #ifndef RCRealTimeLocationCommonDefine_h #define RCRealTimeLocationCommonDefine_h /** 坐标体系类型 - RCRealTimeLocationTypeWGS84: WGS-84 - RCRealTimeLocationTypeGCJ02: GCJ-02 - RCRealTimeLocationTypeBD09: BD-09 */ typedef NS_ENUM(NSUInteger, RCRealTimeLocationType) { RCRealTimeLocationTypeWGS84 = 1, RCRealTimeLocationTypeGCJ02 = 2, RCRealTimeLocationTypeBD09 = 3 }; /*! 实时位置共享状态 */ typedef NS_ENUM(NSInteger, RCRealTimeLocationStatus) { /*! 实时位置共享,初始状态 */ RC_REAL_TIME_LOCATION_STATUS_IDLE, /*! 实时位置共享,接收状态 */ RC_REAL_TIME_LOCATION_STATUS_INCOMING, /*! 实时位置共享,发起状态 */ RC_REAL_TIME_LOCATION_STATUS_OUTGOING, /*! 实时位置共享,共享状态 */ RC_REAL_TIME_LOCATION_STATUS_CONNECTED }; /*! 实时位置共享错误码 */ typedef NS_ENUM(NSInteger, RCRealTimeLocationErrorCode) { /*! 当前设备不支持实时位置共享 */ RC_REAL_TIME_LOCATION_NOT_SUPPORT, /*! 当前会话不支持实时位置共享 */ RC_REAL_TIME_LOCATION_CONVERSATION_NOT_SUPPORT, /*! 当前会话超出了参与者人数限制 */ RC_REAL_TIME_LOCATION_EXCEED_MAX_PARTICIPANT, /*! 获取当前会话信息失败 */ RC_REAL_TIME_LOCATION_GET_CONVERSATION_FAILURE }; #endif /* RCRealTimeLocationCommonDefine_h */
#include "ascii.h" int gumbo_ascii_strcasecmp(const char *s1, const char *s2) { int c1, c2; while (*s1 && *s2) { c1 = (int)(unsigned char) gumbo_ascii_tolower(*s1); c2 = (int)(unsigned char) gumbo_ascii_tolower(*s2); if (c1 != c2) { return (c1 - c2); } s1++; s2++; } return (((int)(unsigned char) *s1) - ((int)(unsigned char) *s2)); } int gumbo_ascii_strncasecmp(const char *s1, const char *s2, size_t n) { int c1, c2; while (n && *s1 && *s2) { n -= 1; c1 = (int)(unsigned char) gumbo_ascii_tolower(*s1); c2 = (int)(unsigned char) gumbo_ascii_tolower(*s2); if (c1 != c2) { return (c1 - c2); } s1++; s2++; } if (n) { return (((int)(unsigned char) *s1) - ((int)(unsigned char) *s2)); } return 0; } const unsigned char _gumbo_ascii_table[0x80] = { 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x03,0x01,0x03,0x03,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x28,0x28,0x28,0x28,0x28,0x28,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00, 0x00,0x50,0x50,0x50,0x50,0x50,0x50,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00, }; // Table generation code. // clang -DGUMBO_GEN_TABLE=1 ascii.c && ./a.out && rm a.out #if GUMBO_GEN_TABLE #include <stdio.h> int main() { printf("const unsigned char _gumbo_ascii_table[0x80] = {"); for (int c = 0; c < 0x80; ++c) { unsigned int x = 0; // https://infra.spec.whatwg.org/#ascii-code-point if (c <= 0x1f) x |= GUMBO_ASCII_CNTRL; if (c == 0x09 || c == 0x0a || c == 0x0c || c == 0x0d || c == 0x20) x |= GUMBO_ASCII_SPACE; if (c >= 0x30 && c <= 0x39) x |= GUMBO_ASCII_DIGIT; if ((c >= 0x30 && c <= 0x39) || (c >= 0x41 && c <= 0x46)) x |= GUMBO_ASCII_UPPER_XDIGIT; if ((c >= 0x30 && c <= 0x39) || (c >= 0x61 && c <= 0x66)) x |= GUMBO_ASCII_LOWER_XDIGIT; if (c >= 0x41 && c <= 0x5a) x |= GUMBO_ASCII_UPPER_ALPHA; if (c >= 0x61 && c <= 0x7a) x |= GUMBO_ASCII_LOWER_ALPHA; printf("%s0x%02x,", (c % 16 == 0? "\n " : ""), x); } printf("\n};\n"); return 0; } #endif
//------------------------------------------------------------------------ // Name: ProtocolDispatcher.h // Author: jjuiddong // Date: 1/2/2013 // // ³×Æ®¿öÅ©·ÎºÎÅÍ ¹ÞÀº ÆÐŶÀ» ÇØ´çÇÏ´Â ÇÁ·ÎÅäÄÝ¿¡ ¸Â°Ô ºÐ¼®Çؼ­ ListenerÀÇ // ÇÔ¼ö¸¦ È£ÃâÇÑ´Ù. // Dispatch ÇÔ¼ö¿¡¼­ °³º° ÇÁ·ÎÅäÄÝ ÇÔ¼öµéÀ» È£ÃâÇÏ°Ô µÈ´Ù. // ³×Æ®¿öÅ© ÇÁ·ÎÅäÄÝ »ý¼º ÄÄÆÄÀÏ·¯°¡ Dispatch()¸¦ ¼Ò½ºÆÄÀÏ·Î ¸¸µé¾î³½´Ù. //------------------------------------------------------------------------ #pragma once #include <string> namespace network { class IProtocolDispatcher { public: IProtocolDispatcher(int id) : m_Id(id), m_pCurrentDispatchPacket(NULL) {} virtual ~IProtocolDispatcher() {} friend class CTaskLogic; friend class CCoreClient; friend class CServerBasic; int GetId() const; void SetCurrentDispatchPacket( CPacket *pPacket ); virtual void PrintThisPacket(int logType /*common::log::LOG_LEVEL*/, const std::string &msg); protected: virtual bool Dispatch(CPacket &packet, const ProtocolListenerList &listeners)=0; int m_Id; // ´ëÀÀÇÏ´Â protocol ID ¿Í µ¿ÀÏÇÑ °ªÀÌ´Ù. CPacket *m_pCurrentDispatchPacket; }; inline int IProtocolDispatcher::GetId() const { return m_Id; } inline void IProtocolDispatcher::SetCurrentDispatchPacket( CPacket *pPacket ) { m_pCurrentDispatchPacket = pPacket; } }
/* Generated by CIL v. 1.7.0 */ /* print_CIL_Input is false */ struct _IO_FILE; struct timeval; extern float strtof(char const *str , char const *endptr ) ; extern void signal(int sig , void *func ) ; typedef struct _IO_FILE FILE; extern int atoi(char const *s ) ; extern double strtod(char const *str , char const *endptr ) ; extern int fclose(void *stream ) ; extern void *fopen(char const *filename , char const *mode ) ; extern void abort() ; extern void exit(int status ) ; extern int raise(int sig ) ; extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ; extern int strcmp(char const *a , char const *b ) ; extern int rand() ; extern unsigned long strtoul(char const *str , char const *endptr , int base ) ; void RandomFunc(unsigned int input[1] , unsigned int output[1] ) ; extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ; extern int gettimeofday(struct timeval *tv , void *tz , ...) ; extern int printf(char const *format , ...) ; int main(int argc , char *argv[] ) ; void megaInit(void) ; extern unsigned long strlen(char const *s ) ; extern long strtol(char const *str , char const *endptr , int base ) ; extern unsigned long strnlen(char const *s , unsigned long maxlen ) ; extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ; struct timeval { long tv_sec ; long tv_usec ; }; extern void *malloc(unsigned long size ) ; extern int scanf(char const *format , ...) ; void megaInit(void) { { } } int main(int argc , char *argv[] ) { unsigned int input[1] ; unsigned int output[1] ; int randomFuns_i5 ; unsigned int randomFuns_value6 ; int randomFuns_main_i7 ; { megaInit(); if (argc != 2) { printf("Call this program with %i arguments\n", 1); exit(-1); } else { } randomFuns_i5 = 0; while (randomFuns_i5 < 1) { randomFuns_value6 = (unsigned int )strtoul(argv[randomFuns_i5 + 1], 0, 10); input[randomFuns_i5] = randomFuns_value6; randomFuns_i5 ++; } RandomFunc(input, output); if (output[0] == 2507289478U) { printf("You win!\n"); } else { } randomFuns_main_i7 = 0; while (randomFuns_main_i7 < 1) { printf("%u\n", output[randomFuns_main_i7]); randomFuns_main_i7 ++; } } } void RandomFunc(unsigned int input[1] , unsigned int output[1] ) { unsigned int state[1] ; char copy12 ; char copy14 ; { state[0UL] = (input[0UL] + 51238316UL) + 274866410U; if ((state[0UL] >> 4U) & 1U) { if ((state[0UL] >> 3U) & 1U) { if ((state[0UL] >> 2U) & 1U) { state[0UL] += state[0UL]; } else { copy12 = *((char *)(& state[0UL]) + 0); *((char *)(& state[0UL]) + 0) = *((char *)(& state[0UL]) + 1); *((char *)(& state[0UL]) + 1) = copy12; copy12 = *((char *)(& state[0UL]) + 1); *((char *)(& state[0UL]) + 1) = *((char *)(& state[0UL]) + 0); *((char *)(& state[0UL]) + 0) = copy12; } } else { state[0UL] += state[0UL]; state[0UL] += state[0UL]; } } else { copy14 = *((char *)(& state[0UL]) + 3); *((char *)(& state[0UL]) + 3) = *((char *)(& state[0UL]) + 1); *((char *)(& state[0UL]) + 1) = copy14; } output[0UL] = state[0UL] + 1862410167U; } }
// fmasgn.c #include "fmtype.h" #include "fmasgn.h" #include "fmvoice.h" // Variable static Fmvoice _fmvc[MAX_FM_VOICE]; static Fmvoice* _firstEmptyVc; // old static Fmvoice* _lastEmptyVc; // new static Fmvoice* _firstOccupiedVc; // old static Fmvoice* _lastOccupiedVc; // new // Prototype static void setToEmptyList( Fmvoice* prevVc, Fmvoice* rlsVc ); // setter void Asgn_setFirstEmptyVc( Fmvoice* vc ){ _firstEmptyVc = vc; } void Asgn_setLastEmptyVc( Fmvoice* vc ){ _lastEmptyVc = vc; } // getter Fmvoice* Asgn_voice( int num ){ return &(_fmvc[num]); } Fmvoice* Asgn_firstEmptyVc( void ){ return _firstEmptyVc; } Fmvoice* Asgn_lastEmptyVc( void ){ return _lastEmptyVc; } void Asgn_init( void ) { int i; for ( i=0; i<MAX_FM_VOICE; i++) { Fmvoice_init(&_fmvc[i]); } _firstOccupiedVc = 0; _lastOccupiedVc = 0; for ( i=0; i<MAX_FM_VOICE-1; i++ ){ Fmvoice_setVoiceNum(&_fmvc[i], i); Fmvoice_setNextVc(&_fmvc[i], &_fmvc[i + 1]); } // for No.MAX_FM_VOICE-1 Fmvoice_setVoiceNum(&_fmvc[MAX_FM_VOICE - 1], MAX_FM_VOICE - 1); Fmvoice_setNextVc(&_fmvc[MAX_FM_VOICE - 1], FMNULL); _firstEmptyVc = &_fmvc[0]; _lastEmptyVc = &_fmvc[MAX_FM_VOICE-1]; } bool Asgn_chkEmpty( void ) { if ( _firstEmptyVc == FMNULL ){ return false; } else { return true; } } Fmvoice* Asgn_getEmptyVc( void ) { if ( _firstEmptyVc != FMNULL ){ Fmvoice* ret = _firstEmptyVc; _firstEmptyVc = Fmvoice_nextVc(_firstEmptyVc); if ( _lastOccupiedVc != FMNULL ){ Fmvoice_setNextVc(_lastOccupiedVc, ret); } _lastOccupiedVc = ret; if ( _firstOccupiedVc == FMNULL ){ _firstOccupiedVc = ret; } return ret; } else { FMASSERT(0); return FMNULL; } } void Asgn_releaseOneVc( void ) { if ( _firstOccupiedVc == FMNULL ){ FMASSERT(0); return; } // Search keyoffed Voice Fmvoice* rlsVc = _firstOccupiedVc; Fmvoice* prevVc = FMNULL; while (rlsVc != FMNULL ){ if ( Fmvoice_isKeyon(rlsVc) == false ){ break; } prevVc = rlsVc; rlsVc = Fmvoice_nextVc(rlsVc); } // if no keyoffed vc, select first one. if ( rlsVc == FMNULL ){ rlsVc = _firstOccupiedVc; } setToEmptyList(prevVc,rlsVc); } void Asgn_releaseParticularVc( Fmvoice* pVc ) { // Search pVc & its prevVc Fmvoice* rlsVc = _firstOccupiedVc; Fmvoice* prevVc = FMNULL; while ( rlsVc != FMNULL ){ if ( pVc == rlsVc ){ break; } prevVc = rlsVc; rlsVc = Fmvoice_nextVc(rlsVc); } setToEmptyList(prevVc,rlsVc); } static void setToEmptyList( Fmvoice* prevVc, Fmvoice* rlsVc ) { // Release from Occupied list if ( rlsVc == _firstOccupiedVc ){ _firstOccupiedVc = Fmvoice_nextVc(rlsVc); } if ( rlsVc == _lastOccupiedVc ){ _lastOccupiedVc = prevVc; } if ( prevVc != FMNULL ){ Fmvoice_setNextVc(prevVc, Fmvoice_nextVc(rlsVc)); } Fmvoice_release(rlsVc); // Set Empty list Fmvoice_setNextVc(_lastEmptyVc, rlsVc); _lastEmptyVc = rlsVc; if ( _firstEmptyVc == FMNULL ){ _firstEmptyVc = rlsVc; } }
#ifndef POSTPREPARESTRATEGYMULTIPART_H #define POSTPREPARESTRATEGYMULTIPART_H #include "ipostpreparestrategy.h" class PostPrepareStrategyMultipart : public IPostPrepareStrategy { Q_OBJECT QString Boundary; public: explicit PostPrepareStrategyMultipart(QObject *parent = 0); virtual QByteArray GenerateData(const QHash<QString,ContentData> & params); virtual QByteArray GetContentType(); signals: public slots: }; #endif // POSTPREPARESTRATEGYMULTIPART_H
#pragma once #include "Common.h" #include "Constants.h" #include "Array.hpp" #include "ActionType.h" namespace BOSS { class ActionSet { Vec<ActionType, Constants::MAX_ACTION_TYPES> _actionTypes; public: ActionSet(); const size_t size() const; const bool isEmpty() const; const bool contains(const ActionType & type) const; const ActionType & operator [] (const size_t & index) const; ActionType & operator [] (const size_t & index); void add(const ActionType & action); void addAllActions(const RaceID & race); void remove(const ActionType & action); void clear(); }; }
// // LHTagModel.h // // // Created by Ivan Bruel on 13/03/15. // // #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> @class LHAppModel, LHBeaconModel; @interface LHTagModel : NSManagedObject @property (nonatomic, retain) NSNumber * identifier; @property (nonatomic, retain) NSString * name; @property (nonatomic, retain) NSNumber * timeout; @property (nonatomic, retain) NSDate * lastSeenAt; @property (nonatomic, retain) NSString * sessionId; @property (nonatomic, retain) LHAppModel *app; @property (nonatomic, retain) NSSet *beacons; @end @interface LHTagModel (CoreDataGeneratedAccessors) - (void)addBeaconsObject:(LHBeaconModel *)value; - (void)removeBeaconsObject:(LHBeaconModel *)value; - (void)addBeacons:(NSSet *)values; - (void)removeBeacons:(NSSet *)values; @end
/* Generated by CIL v. 1.7.0 */ /* print_CIL_Input is false */ struct _IO_FILE; struct timeval; extern void signal(int sig , void *func ) ; extern float strtof(char const *str , char const *endptr ) ; typedef struct _IO_FILE FILE; extern int atoi(char const *s ) ; extern double strtod(char const *str , char const *endptr ) ; extern int fclose(void *stream ) ; extern void *fopen(char const *filename , char const *mode ) ; extern void abort() ; extern void exit(int status ) ; extern int raise(int sig ) ; extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ; extern int strcmp(char const *a , char const *b ) ; extern int rand() ; extern unsigned long strtoul(char const *str , char const *endptr , int base ) ; void RandomFunc(unsigned char input[1] , unsigned char output[1] ) ; extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ; extern int gettimeofday(struct timeval *tv , void *tz , ...) ; extern int printf(char const *format , ...) ; int main(int argc , char *argv[] ) ; void megaInit(void) ; extern unsigned long strlen(char const *s ) ; extern long strtol(char const *str , char const *endptr , int base ) ; extern unsigned long strnlen(char const *s , unsigned long maxlen ) ; extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ; struct timeval { long tv_sec ; long tv_usec ; }; extern void *malloc(unsigned long size ) ; extern int scanf(char const *format , ...) ; void RandomFunc(unsigned char input[1] , unsigned char output[1] ) { unsigned char state[1] ; unsigned char local1 ; { state[0UL] = (input[0UL] + 914778474UL) * (unsigned char)22; local1 = 0UL; while (local1 < 1UL) { if (state[0UL] < local1) { state[local1] = state[0UL] + state[local1]; } else { state[0UL] = state[local1] - state[0UL]; } if (state[0UL] > local1) { state[local1] = state[0UL] - state[local1]; } else { state[0UL] *= state[local1]; } local1 ++; } output[0UL] = (state[0UL] - 180391357UL) + (unsigned char)25; } } int main(int argc , char *argv[] ) { unsigned char input[1] ; unsigned char output[1] ; int randomFuns_i5 ; unsigned char randomFuns_value6 ; int randomFuns_main_i7 ; { megaInit(); if (argc != 2) { printf("Call this program with %i arguments\n", 1); exit(-1); } else { } randomFuns_i5 = 0; while (randomFuns_i5 < 1) { randomFuns_value6 = (unsigned char )strtoul(argv[randomFuns_i5 + 1], 0, 10); input[randomFuns_i5] = randomFuns_value6; randomFuns_i5 ++; } RandomFunc(input, output); if (output[0] == 92) { printf("You win!\n"); } else { } randomFuns_main_i7 = 0; while (randomFuns_main_i7 < 1) { printf("%u\n", output[randomFuns_main_i7]); randomFuns_main_i7 ++; } } } void megaInit(void) { { } }
/*! \copyright (c) RDO-Team, 2011 \file rdoparser_rdo.h \authors Барс Александр \authors Урусов Андрей (rdo@rk9.bmstu.ru) \date \brief \indent 4T */ #ifndef _CONVERTOR_RDOCONVERTER_CONVERTOR_RDO_H_ #define _CONVERTOR_RDOCONVERTER_CONVERTOR_RDO_H_ // ----------------------------------------------------------------------- INCLUDES #include <iostream> // ----------------------------------------------------------------------- SYNOPSIS #include "converter/smr2rdox/rdoparser_base.h" #include "converter/smr2rdox/rdoparser_lexer.h" #include "converter/smr2rdox/rdo_object.h" #include "simulator/runtime/rdo_object.h" // -------------------------------------------------------------------------------- OPEN_RDO_CONVERTER_SMR2RDOX_NAMESPACE // -------------------------------------------------------------------------------- // -------------------- RDOParserRDOItem // -------------------------------------------------------------------------------- class Converter; class RDOParserRDOItem: public RDOParserItem { DECLARE_FACTORY(RDOParserRDOItem); public: virtual void parse(Converter* pParser, std::istream& streamIn); virtual std::size_t lexer_loc_line(); virtual std::size_t lexer_loc_pos(); protected: RDOParserRDOItem(rdo::converter::smr2rdox::RDOFileTypeIn type, t_bison_parse_fun parser_fun, t_flex_lexer_fun lexer_fun); virtual ~RDOParserRDOItem(); RDOLexer* m_pLexer; YYLTYPE m_loc; private: RDOLexer* getLexer(Converter* pParser, std::istream* streamIn, std::ostream* streamOut); }; // -------------------------------------------------------------------------------- // -------------------- RDOParserRSS // -------------------------------------------------------------------------------- class RDOParserRSS: public RDOParserRDOItem { DECLARE_FACTORY(RDOParserRSS); private: RDOParserRSS(); virtual void parse(Converter* pParser, std::istream& streamIn); }; // -------------------------------------------------------------------------------- // -------------------- RDOParserRSSPost // -------------------------------------------------------------------------------- class RDOParserRSSPost: public RDOParserItem { DECLARE_FACTORY(RDOParserRSSPost); private: RDOParserRSSPost(); virtual void parse(Converter* pParser); }; // -------------------------------------------------------------------------------- // -------------------- RDOParserSTDFUN // -------------------------------------------------------------------------------- class RDOParserSTDFUN: public RDOParserItem { DECLARE_FACTORY(RDOParserSTDFUN); private: RDOParserSTDFUN(); virtual void parse(Converter* pParser); }; CLOSE_RDO_CONVERTER_SMR2RDOX_NAMESPACE #endif // _CONVERTOR_RDOCONVERTER_CONVERTOR_RDO_H_
// // UIFont.h // UIKit // // Created by Shaun Harrison on 7/19/09. // Copyright 2009 enormego. All rights reserved. // #import <Cocoa/Cocoa.h> @interface UIFont : NSFont { } + (UIFont *)systemFontOfSize:(CGFloat)fontSize; + (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize; @end
#ifndef FIR_SWIFT_NAME // NOLINT #import <Foundation/Foundation.h> // NS_SWIFT_NAME can only translate factory methods before the iOS 9.3 SDK. // // Wrap it in our own macro if it's a non-compatible SDK. #ifdef __IPHONE_9_3 #define FIR_SWIFT_NAME(X) NS_SWIFT_NAME(X) #else #define FIR_SWIFT_NAME(X) // Intentionally blank. #endif // #ifdef __IPHONE_9_3 #endif // FIR_SWIFT_NAME // NOLINT
/////////////////////////////////////////////////////////////////////////////// // // CoinQ_txs.h // // Copyright (c) 2013 Eric Lombrozo // Copyright (c) 2011-2016 Ciphrex Corp. // // Distributed under the MIT software license, see the accompanying // file LICENSE or http://www.opensource.org/licenses/mit-license.php. // #ifndef _COINQ_TXS_H_ #define _COINQ_TXS_H_ #include "CoinQ_blocks.h" #include "CoinQ_keys.h" #include "CoinQ_signals.h" #include <CoinCore/CoinNodeData.h> #include <map> class ChainTransaction : public Coin::Transaction { public: ChainHeader blockHeader; int index; // TODO: Merkle path ChainTransaction() : Coin::Transaction(), index(-1) { } ChainTransaction(const Coin::Transaction& tx) : Coin::Transaction(tx), index(-1) { } ChainTransaction(const Coin::Transaction& tx, const ChainHeader& _blockHeader, int _index) : Coin::Transaction(tx), blockHeader(_blockHeader), index(_index) { } }; class ChainTxOut : public Coin::TxOut { public: uchar_vector txHash; int index; bool bSpent; ChainTxOut() : Coin::TxOut(), index(-1), bSpent(false) { } ChainTxOut(const Coin::TxOut& txOut) : Coin::TxOut(txOut), index(-1), bSpent(false) { } ChainTxOut(const Coin::TxOut& txOut, const uchar_vector& _txHash, int _index, bool _bSpent = false) : Coin::TxOut(txOut), txHash(_txHash), index(_index), bSpent(_bSpent) { } // std::string toJson() const; }; /* std::string ChainTxOut::toJson() const { std::stringstream ss; ss << "{\"amount\":" << (value / 100000000ull) << "." << (value % 100000000ull) << ",\"amount_int\":" << value << ",\"script\":\"" << scriptPubKey.getHex() << "\",\"address\":\"" << getAddress() << "\",\"tx_hash\":\"" << txHash.getHex() << "\",\"index\":" << index << ",\"spent\":" << (bSpent ? "true" : "false") << "}"; return ss.str(); } */ typedef std::function<void(const ChainTransaction&)> chain_tx_slot_t; class ICoinQTxStore { public: virtual bool insert(const ChainTransaction& tx) = 0; virtual bool deleteTx(const uchar_vector& txHash) = 0; virtual bool unconfirm(const uchar_vector& blockHash) = 0; virtual bool hasTx(const uchar_vector& txHash) const = 0; virtual bool getTx(const uchar_vector& txHash, ChainTransaction& tx) const = 0; virtual uchar_vector getBestBlockHash(const uchar_vector& txHash) const = 0; virtual int getBestBlockHeight(const uchar_vector& txHash) const = 0; virtual std::vector<ChainTransaction> getConfirmedTxs(int minHeight, int maxHeight) const = 0; virtual std::vector<ChainTransaction> getUnconfirmedTxs() const = 0; enum Status { UNSPENT = 1, SPENT = 2, BOTH = 3 }; virtual std::vector<ChainTxOut> getTxOuts(const CoinQ::Keys::AddressSet& addressSet, Status status, int minConf) const = 0; virtual void setBestHeight(int height) = 0; virtual int getBestHeight() const = 0; virtual void subscribeInsert(chain_tx_slot_t slot) = 0; virtual void subscribeDelete(chain_tx_slot_t slot) = 0; virtual void subscribeConfirm(chain_tx_slot_t slot) = 0; virtual void subscribeUnconfirm(chain_tx_slot_t slot) = 0; virtual void subscribeNewBestHeight(std::function<void(int)> slot) = 0; }; class ICoinQInputPicker { virtual std::vector<ChainTxOut> pick() const = 0; }; class CoinQSimpleInputPicker : public ICoinQInputPicker { private: const ICoinQTxStore& txStore; const CoinQ::Keys::AddressSet& addressSet; uint64_t minValue; int minConf; public: CoinQSimpleInputPicker(const ICoinQTxStore& _txStore, const CoinQ::Keys::AddressSet& _addressSet, uint64_t _minValue, int _minConf = 1) : txStore(_txStore), addressSet(_addressSet), minValue(_minValue), minConf(_minConf) { } std::vector<ChainTxOut> pick() const; }; #endif // _COINQ_TXS_H_
#if defined(PEGASUS_OS_HPUX) # include "UNIX_IEEE8021xCapabilitiesDeps_HPUX.h" #elif defined(PEGASUS_OS_LINUX) # include "UNIX_IEEE8021xCapabilitiesDeps_LINUX.h" #elif defined(PEGASUS_OS_DARWIN) # include "UNIX_IEEE8021xCapabilitiesDeps_DARWIN.h" #elif defined(PEGASUS_OS_AIX) # include "UNIX_IEEE8021xCapabilitiesDeps_AIX.h" #elif defined(PEGASUS_OS_FREEBSD) # include "UNIX_IEEE8021xCapabilitiesDeps_FREEBSD.h" #elif defined(PEGASUS_OS_SOLARIS) # include "UNIX_IEEE8021xCapabilitiesDeps_SOLARIS.h" #elif defined(PEGASUS_OS_ZOS) # include "UNIX_IEEE8021xCapabilitiesDeps_ZOS.h" #elif defined(PEGASUS_OS_VMS) # include "UNIX_IEEE8021xCapabilitiesDeps_VMS.h" #elif defined(PEGASUS_OS_TRU64) # include "UNIX_IEEE8021xCapabilitiesDeps_TRU64.h" #else # include "UNIX_IEEE8021xCapabilitiesDeps_STUB.h" #endif
/**************************************************************************** * * Open Watcom Project * * Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved. * * ======================================================================== * * This file contains Original Code and/or Modifications of Original * Code as defined in and that are subject to the Sybase Open Watcom * Public License version 1.0 (the 'License'). You may not use this file * except in compliance with the License. BY USING THIS FILE YOU AGREE TO * ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is * provided with the Original Code and Modifications, and is also * available at www.sybase.com/developer/opensource. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR * NON-INFRINGEMENT. Please see the License for the specific language * governing rights and limitations under the License. * * ======================================================================== * * Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE * DESCRIBE IT HERE! * ****************************************************************************/ #include "variety.h" #include "xstring.h" #undef _fstrcmp /* return <0 if s<t, 0 if s==t, >0 if s>t */ _WCRTLINK int _fstrcmp( const char _WCFAR *s, const char _WCFAR *t ) { #if /*defined(M_I86) &&*/ defined(__INLINE_FUNCTIONS__) return( _inline__fstrcmp( s, t ) ); #else for( ; *s == *t; s++, t++ ) if( *s == '\0' ) return( 0 ); return( *s - *t ); #endif }
#pragma once class Trait { Trait(); ~Trait(); bool freeze; // On collision freeze the other object bool explosive; // On remove, remove all objects inside range bool healing; // On remove, add health to all objects };
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <iup.h> #include <iupcontrols.h> #include <cd.h> Ihandle *create_mat(void) { Ihandle *mat = IupMatrix(NULL); IupSetAttribute(mat,"NUMCOL","5"); IupSetAttribute(mat,"NUMLIN","10"); IupSetAttribute(mat,"NUMCOL_VISIBLE","2"); IupSetAttribute(mat,"NUMLIN_VISIBLE","3"); IupSetAttribute(mat,"0:0","Inflation"); IupSetAttribute(mat,"1:0","Medicine"); IupSetAttribute(mat,"2:0","Food"); IupSetAttribute(mat,"3:0","Energy"); IupSetAttribute(mat,"0:1","January 2000"); IupSetAttribute(mat,"0:2","February 2000"); IupSetAttribute(mat,"1:1","5.6"); IupSetAttribute(mat,"2:1","2.2"); IupSetAttribute(mat,"3:1","7.2"); IupSetAttribute(mat,"1:2","4.5"); IupSetAttribute(mat,"2:2","8.1"); IupSetAttribute(mat,"3:2","3.4"); // IupSetAttribute(mat,"WIDTHDEF","34"); IupSetAttribute(mat,"RESIZEMATRIX","YES"); // IupSetAttribute(mat,"MARKMODE","CELL"); IupSetAttribute(mat,"MARKMODE","LINCOL"); IupSetAttribute(mat,"MULTIPLE","YES"); IupSetAttribute(mat,"AREA","NOT_CONTINUOUS"); return mat; } /* Main program */ int main(int argc, char **argv) { Ihandle *dlg; IupOpen(&argc, &argv); IupControlsOpen (); dlg = IupDialog(create_mat()); IupSetAttribute(dlg, "TITLE", "IupMatrix"); IupShowXY (dlg,IUP_CENTER,IUP_CENTER); IupMainLoop (); IupClose (); return EXIT_SUCCESS; }
// // WBImage+WBUtils.h // // Created by JasioWoo on 15/5/21. // // #import <Foundation/Foundation.h> #if TARGET_OS_IPHONE #import <UIKit/UIKit.h> #define WBImage UIImage #define WBColor UIColor #else #import <AppKit/AppKit.h> #define WBImage NSImage #define WBColor NSColor #endif @interface WBImage (WBUtils) -(WBImage *)replacingOccurrencesOfPixel:(WBColor *)tagetColor withColor:(WBColor *)replaceColor; #if TARGET_OS_IPHONE #else - (CGImageRef)CGImage; #endif @end
struct announce_msg_t am; jasync loop() { while(1) { am = announce_msg; printf("Field %s, Index %d\n", am.field, am.index); } } jasync messager() { while(1) { jsleep(500); printf("Printing a message..\n"); } } jasync logger() { char *names[10] = {"david", "mayer", "justin", "richard", "lekan", "ben", "owen", "nicholas", "karu", "clark"}; int i; char buf[32]; while(1) { sensor_data = {.sd_val:i*10.5 + 2.4 * strlen(names[i%10]) , .name: names[i%10] , .index: i}; printf("Pushed.. sensed data \n"); i++; jsleep(500); } } int main() { messager(); loop(); logger(); }
/******************************************************************************* *//** * @mainpage * @section section1 Introduction: * Having studied this LAB you will able to: \n * - Understand the general Timer functions \n * - Study the programs related to the general timer * * @section section2 Example16 : * Objective: Write a Program to generate PWM signal and capture it and display the frequency captured and duty cycle(Timer12) * * @section section3 Program Description: * This program demonstrates generation PWM signal using general timer and capture and display it using general timer. * * @section section4 Included Files: * * | Header Files | Source Files | * | :------------------------------:| :----------------------------: | * | @ref stm32f4xx_hal_conf.h | @ref stm32f4xx_hal_msp.c | * | @ref stm32f4xx_it.h | @ref stm32f4xx_it.c | * | @ref stm32f4_discovery.h | @ref stm32f4_discovery.c | * | @ref stm32f4_discovery_timer.h | @ref stm32f4_discovery_timer.c | * | | @ref main.c | * * \n * @section section5 Pin Assignments * * | STM32F407 Reference | On board | * | :------------------:|-----------:| * | GPIOA.05 | TIM2_CH1 | * | GPIOB.14 | TIM12_CH1 | * * * @section section6 Program Folder Location * <Eg16> * * * @section section7 Part List * - STM32F4Discovery Board \n * - USB cable \n * - Eclipse IDE \n * - PC \n * * * @section section8 Hardware Configuration * - Connect the board using USB port of PC using USB cable. * - Apply Reset condition by pressing the Reset switch to ensure proper communication. * - Using download tool (STM ST-LINK Utility) download the .hex file developed using available tools. * - Reset the board. * - Observe the Output. * * @section section9 Output: * 2KHZ PWM signal will be captured on Timer12 channel1 and captured frequency and duty cycle displayed. *\n *\n *******************************************************************************/
// This file is part of the "x0" project, http://github.com/christianparpart/x0> // (c) 2009-2018 Christian Parpart <christian@parpart.family> // // Licensed under the MIT License (the "License"); you may not use this // file except in compliance with the License. You may obtain a copy of // the License at: http://opensource.org/licenses/MIT #pragma once #include <string> namespace xzero { namespace http { namespace hpack { class Huffman { public: static std::string encode(const std::string& value); static std::string decode(const uint8_t* pos, const uint8_t* end); static void decode(std::string* output, const uint8_t* pos, const uint8_t* end); static size_t encodeLength(const std::string& value); }; } // namespace hpack } // namespace http } // namespace xzero
#ifndef QTCDBVIEWERCONSTANTS_H #define QTCDBVIEWERCONSTANTS_H namespace QtcDbViewer { namespace Constants { const char QTCDBVIEWER_ID[] = "QtcDbViewer.Mode"; const char QTCDBVIEWER_CONTEXT[] = "QtcDbViewer.Context"; } // namespace QtcDbViewer } // namespace Constants #endif // QTCDBVIEWERCONSTANTS_H