text
stringlengths
4
6.14k
// 编写程序确定计算机执行的是算术右移还是逻辑右移 #include <stdio.h> int main(void){ signed int w1 = -1 % 32; signed int flag; printf("%x\n", w1); w1 >>= 1; printf("%x\n", w1); flag = w1 >> 31; if(flag == -1) printf("SAR\n"); // 算术右移 else printf("SHR\n"); // 逻辑右移 return 0; }
// // WXZLouPanInformationControllerCell_0_1.h // rufangrongke // // Created by 儒房融科 on 15/11/9. // Copyright © 2015年 王晓植. All rights reserved. // #import <UIKit/UIKit.h> #import "WXZLouPanInformationControllerModel.h" @interface WXZLouPanInformationControllerCell_0_1 : UITableViewCell /* model */ @property (nonatomic , strong) WXZLouPanInformationControllerModel *model_0_1; @end
/** * \file Transformation.h * \brief A transformation node to be used to appy a transformation to the sub-tree (composite node). * * \author Volker Ahlers\n * volker.ahlers@hs-hannover.de */ /* * Copyright 2014-2019 Volker Ahlers * * 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 TRANSFORMATION_H_ #define TRANSFORMATION_H_ #include "scg_glew.h" #include "Composite.h" #include "scg_glm.h" #include "scg_internals.h" namespace scg { class Traverser; /** * \brief A transformation node to be used to appy a transformation to the sub-tree (composite node). */ class Transformation: public Composite { public: /** * Constructor. */ Transformation(); /** * Destructor. */ virtual ~Transformation(); /** * Create shared pointer. */ static TransformationSP create(); /** * Get transformation matrix. */ const glm::mat4& getMatrix() const; /** * Set transformation matrix. * \return this pointer for method chaining */ virtual Transformation* setMatrix(const glm::mat4& matrix); /** * Translate subsequent geometry. * \param translation tranlation vector * \return this pointer for method chaining */ virtual Transformation* translate(glm::vec3 translation); /** * Rotate subsequent geometry. * \param angleDeg rotation angle (radians) * \param axis rotaton axis * \return this pointer for method chaining */ virtual Transformation* rotateRad(GLfloat angleRad, glm::vec3 axis); /** * Rotate subsequent geometry. * \param angleDeg rotation angle (degrees) * \param axis rotaton axis * \return this pointer for method chaining */ virtual Transformation* rotate(GLfloat angleDeg, glm::vec3 axis) { return rotateRad(glm::radians(angleDeg), axis); } /** * Scale subsequent geometry. * \param scaling scale factors in xyz directions * \return this pointer for method chaining */ virtual Transformation* scale(glm::vec3 scaling); /** * Accept traverser (visitor pattern). */ virtual void accept(Traverser* traverser); /** * Accept traverser after traversing sub-tree (visitor pattern). */ virtual void acceptPost(Traverser* traverser); /** * Render transformation, i.e., post-multiply current model-view matrix by * local matrix. */ virtual void render(RenderState* renderState); /** * Render transformaton after traversing sub-tree, i.e., restore model-view matrix. */ virtual void renderPost(RenderState* renderState); protected: glm::mat4 matrix_; }; } /* namespace scg */ #endif /* TRANSFORMATION_H_ */
// // This is a sample General preference pane // #import "MASPreferencesViewController.h" #import "BrowserHelper.h" #import "NSAlert+SynchronousSheet.h" @interface AdvancedPreferencesViewController : NSViewController <MASPreferencesViewController> { } @property (unsafe_unretained) IBOutlet NSButton *ignoreEarlyHighlightsCheckbox; @property (strong) IBOutlet NSButton *proResCheckbox; @property (strong) IBOutlet NSButton *proGlyphButton; - (IBAction)proResCheckChanged:(id)sender; - (IBAction)ignoreEarlyHighlightsStateChanged:(id)sender; - (IBAction)openProInfo:(id)sender; @end
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #include "argv.h" #include "client.h" #include "common/clipboard.h" #include "kubernetes.h" #include "settings.h" #include "user.h" #include <guacamole/argv.h> #include <guacamole/client.h> #include <libwebsockets.h> #include <langinfo.h> #include <locale.h> #include <pthread.h> #include <stdlib.h> #include <string.h> guac_client* guac_kubernetes_lws_current_client = NULL; /** * Logging callback invoked by libwebsockets to log a single line of logging * output. As libwebsockets messages are all generally low-level, the log * level provided by libwebsockets is ignored here, with all messages logged * instead at guacd's debug level. * * @param level * The libwebsockets log level associated with the log message. This value * is ignored by this implementation of the logging callback. * * @param line * The line of logging output to log. */ static void guac_kubernetes_log(int level, const char* line) { char buffer[1024]; /* Drop log message if there's nowhere to log yet */ if (guac_kubernetes_lws_current_client == NULL) return; /* Trim length of line to fit buffer (plus null terminator) */ int length = strlen(line); if (length > sizeof(buffer) - 1) length = sizeof(buffer) - 1; /* Copy as much of the received line as will fit in the buffer */ memcpy(buffer, line, length); /* If the line ends with a newline character, trim the character */ if (length > 0 && buffer[length - 1] == '\n') length--; /* Null-terminate the trimmed string */ buffer[length] = '\0'; /* Log using guacd's own log facilities */ guac_client_log(guac_kubernetes_lws_current_client, GUAC_LOG_DEBUG, "libwebsockets: %s", buffer); } int guac_client_init(guac_client* client) { /* Ensure reference to main guac_client remains available in all * libwebsockets contexts */ guac_kubernetes_lws_current_client = client; /* Redirect libwebsockets logging */ lws_set_log_level(LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_INFO, guac_kubernetes_log); /* Set client args */ client->args = GUAC_KUBERNETES_CLIENT_ARGS; /* Allocate client instance data */ guac_kubernetes_client* kubernetes_client = calloc(1, sizeof(guac_kubernetes_client)); client->data = kubernetes_client; /* Init clipboard */ kubernetes_client->clipboard = guac_common_clipboard_alloc(GUAC_KUBERNETES_CLIPBOARD_MAX_LENGTH); /* Set handlers */ client->join_handler = guac_kubernetes_user_join_handler; client->free_handler = guac_kubernetes_client_free_handler; client->leave_handler = guac_kubernetes_user_leave_handler; /* Register handlers for argument values that may be sent after the handshake */ guac_argv_register(GUAC_KUBERNETES_ARGV_COLOR_SCHEME, guac_kubernetes_argv_callback, NULL, GUAC_ARGV_OPTION_ECHO); guac_argv_register(GUAC_KUBERNETES_ARGV_FONT_NAME, guac_kubernetes_argv_callback, NULL, GUAC_ARGV_OPTION_ECHO); guac_argv_register(GUAC_KUBERNETES_ARGV_FONT_SIZE, guac_kubernetes_argv_callback, NULL, GUAC_ARGV_OPTION_ECHO); /* Set locale and warn if not UTF-8 */ setlocale(LC_CTYPE, ""); if (strcmp(nl_langinfo(CODESET), "UTF-8") != 0) { guac_client_log(client, GUAC_LOG_INFO, "Current locale does not use UTF-8. Some characters may " "not render correctly."); } /* Success */ return 0; } int guac_kubernetes_client_free_handler(guac_client* client) { guac_kubernetes_client* kubernetes_client = (guac_kubernetes_client*) client->data; /* Wait client thread to terminate */ pthread_join(kubernetes_client->client_thread, NULL); /* Free settings */ if (kubernetes_client->settings != NULL) guac_kubernetes_settings_free(kubernetes_client->settings); guac_common_clipboard_free(kubernetes_client->clipboard); free(kubernetes_client); return 0; }
/* * File: IAS-QSystemLib/src/qs/lang/ec/ModuleProxy.h * * Copyright (C) 2015, Albert Krzymowski * * 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 _IAS_QS_Lang_EC_ModuleProxy_H_ #define _IAS_QS_Lang_EC_ModuleProxy_H_ #include <lang/interpreter/extern/ModuleProxy.h> namespace IAS { namespace QS { namespace Lang { namespace EC { /*************************************************************************/ /** The ModuleProxy class. * */ class ModuleProxy : public ::IAS::Lang::Interpreter::Extern::ModuleProxy { public: virtual ~ModuleProxy() throw(); static ModuleProxy* Create(); protected: ModuleProxy(); virtual void setupImpl(); virtual void cleanUpImpl(); friend class ::IAS::Factory<ModuleProxy>; }; /*************************************************************************/ } } } } /*************************************************************************/ extern "C"{ void* ias_qs_lang_ec_proxy(); } /*************************************************************************/ #endif /* _IAS_Lang_Interpreter_Extern_Std_ModuleProxy_H_ */
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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. */ #pragma once #include <aws/cloudfront/CloudFront_EXPORTS.h> #include <aws/cloudfront/CloudFrontRequest.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace CloudFront { namespace Model { /** * <p>The request to get an origin access identity's information.</p><p><h3>See * Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/cloudfront-2019-03-26/GetCloudFrontOriginAccessIdentityRequest">AWS * API Reference</a></p> */ class AWS_CLOUDFRONT_API GetCloudFrontOriginAccessIdentity2019_03_26Request : public CloudFrontRequest { public: GetCloudFrontOriginAccessIdentity2019_03_26Request(); // Service request name is the Operation name which will send this request out, // each operation should has unique request name, so that we can get operation's name from this request. // Note: this is not true for response, multiple operations may have the same response name, // so we can not get operation's name from response. inline virtual const char* GetServiceRequestName() const override { return "GetCloudFrontOriginAccessIdentity"; } Aws::String SerializePayload() const override; /** * <p>The identity's ID.</p> */ inline const Aws::String& GetId() const{ return m_id; } /** * <p>The identity's ID.</p> */ inline bool IdHasBeenSet() const { return m_idHasBeenSet; } /** * <p>The identity's ID.</p> */ inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } /** * <p>The identity's ID.</p> */ inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } /** * <p>The identity's ID.</p> */ inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } /** * <p>The identity's ID.</p> */ inline GetCloudFrontOriginAccessIdentity2019_03_26Request& WithId(const Aws::String& value) { SetId(value); return *this;} /** * <p>The identity's ID.</p> */ inline GetCloudFrontOriginAccessIdentity2019_03_26Request& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} /** * <p>The identity's ID.</p> */ inline GetCloudFrontOriginAccessIdentity2019_03_26Request& WithId(const char* value) { SetId(value); return *this;} private: Aws::String m_id; bool m_idHasBeenSet; }; } // namespace Model } // namespace CloudFront } // namespace Aws
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXCHAR 1000 #define max(a,b) ((a)>(b)?(a):(b)) int strStr(char* mother ,char* son){ int n=strlen(mother); int m=strlen(son); int cnt=0; for(int i=0;i<=n-m;i++){ for(int j=0;j<m-1;j++){ if(mother[i+j]!=son[j]) { cnt=0; break; }else cnt++; } if(cnt==m-1){ printf("Is son str!\n"); return 1; }else{ cnt=0; } } printf("No son str!\n"); return 0; } int main (int argc,char **argv){ char *mother=(char*)malloc(sizeof(char)*MAXCHAR); char *son=(char*)malloc(sizeof(char)*MAXCHAR); if(NULL==mother||NULL==son) return 0; printf("Please input the mother string:\nInput:"); fflush(stdin); fgets(mother,MAXCHAR,stdin); printf("Please input the son string:\nInput:"); fflush(stdin); fgets(son,MAXCHAR,stdin); /*the realise of the strStr()*/ strStr(mother,son); free(mother); mother=NULL; free(son); son=NULL; return 0; }
// // DCBeautyMessageViewController.h // CDDStoreDemo // // Created by 陈甸甸 on 2017/12/21. //Copyright © 2017年 RocketsChen. All rights reserved. // #import <UIKit/UIKit.h> @interface DCBeautyMessageViewController : UIViewController @end
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: /Volumes/Personal/Documents/raspi-config/client-framework/build/j2oSources/com/google/common/collect/RegularImmutableBiMap.java // #include "J2ObjC_header.h" #pragma push_macro("INCLUDE_ALL_ComGoogleCommonCollectRegularImmutableBiMap") #ifdef RESTRICT_ComGoogleCommonCollectRegularImmutableBiMap #define INCLUDE_ALL_ComGoogleCommonCollectRegularImmutableBiMap 0 #else #define INCLUDE_ALL_ComGoogleCommonCollectRegularImmutableBiMap 1 #endif #undef RESTRICT_ComGoogleCommonCollectRegularImmutableBiMap #if __has_feature(nullability) #pragma clang diagnostic push #pragma GCC diagnostic ignored "-Wnullability-completeness" #endif #if !defined (ComGoogleCommonCollectRegularImmutableBiMap_) && (INCLUDE_ALL_ComGoogleCommonCollectRegularImmutableBiMap || defined(INCLUDE_ComGoogleCommonCollectRegularImmutableBiMap)) #define ComGoogleCommonCollectRegularImmutableBiMap_ #define RESTRICT_ComGoogleCommonCollectImmutableBiMap 1 #define INCLUDE_ComGoogleCommonCollectImmutableBiMap 1 #include "com/google/common/collect/ImmutableBiMap.h" @class ComGoogleCommonCollectImmutableSet; @class IOSObjectArray; @protocol JavaUtilFunctionBiConsumer; @interface ComGoogleCommonCollectRegularImmutableBiMap : ComGoogleCommonCollectImmutableBiMap #pragma mark Public - (ComGoogleCommonCollectImmutableSet *)entrySet; - (void)forEachWithJavaUtilFunctionBiConsumer:(id<JavaUtilFunctionBiConsumer>)action; - (id)getWithId:(id)key; - (NSUInteger)hash; - (ComGoogleCommonCollectImmutableBiMap *)inverse; - (ComGoogleCommonCollectImmutableSet *)keySet; - (jint)size; #pragma mark Package-Private - (ComGoogleCommonCollectImmutableSet *)createEntrySet; - (ComGoogleCommonCollectImmutableSet *)createKeySet; + (ComGoogleCommonCollectRegularImmutableBiMap *)fromEntriesWithJavaUtilMap_EntryArray:(IOSObjectArray *)entries; + (ComGoogleCommonCollectRegularImmutableBiMap *)fromEntryArrayWithInt:(jint)n withJavaUtilMap_EntryArray:(IOSObjectArray *)entryArray; - (jboolean)isHashCodeFast; - (jboolean)isPartialView; @end J2OBJC_STATIC_INIT(ComGoogleCommonCollectRegularImmutableBiMap) inline ComGoogleCommonCollectRegularImmutableBiMap *ComGoogleCommonCollectRegularImmutableBiMap_get_EMPTY(); /*! INTERNAL ONLY - Use accessor function from above. */ FOUNDATION_EXPORT ComGoogleCommonCollectRegularImmutableBiMap *ComGoogleCommonCollectRegularImmutableBiMap_EMPTY; J2OBJC_STATIC_FIELD_OBJ_FINAL(ComGoogleCommonCollectRegularImmutableBiMap, EMPTY, ComGoogleCommonCollectRegularImmutableBiMap *) inline jdouble ComGoogleCommonCollectRegularImmutableBiMap_get_MAX_LOAD_FACTOR(); #define ComGoogleCommonCollectRegularImmutableBiMap_MAX_LOAD_FACTOR 1.2 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonCollectRegularImmutableBiMap, MAX_LOAD_FACTOR, jdouble) FOUNDATION_EXPORT ComGoogleCommonCollectRegularImmutableBiMap *ComGoogleCommonCollectRegularImmutableBiMap_fromEntriesWithJavaUtilMap_EntryArray_(IOSObjectArray *entries); FOUNDATION_EXPORT ComGoogleCommonCollectRegularImmutableBiMap *ComGoogleCommonCollectRegularImmutableBiMap_fromEntryArrayWithInt_withJavaUtilMap_EntryArray_(jint n, IOSObjectArray *entryArray); J2OBJC_TYPE_LITERAL_HEADER(ComGoogleCommonCollectRegularImmutableBiMap) #endif #if __has_feature(nullability) #pragma clang diagnostic pop #endif #pragma pop_macro("INCLUDE_ALL_ComGoogleCommonCollectRegularImmutableBiMap")
#ifndef _PRNTUTLS_H_ #define _PRNTUTLS_H_ #include "errs.h" /** * Print a string and append a new line */ static void printn(char *msg) { printf("%s\n", msg); } /** * Show an error for no memory (redirects to cnative_err_no_memory and * returns 1 */ static int8_t nomemory() { cnative_err_no_memory(); return 1; } #endif // _PRNTUTLS_H_
/*========================================================================= Program: GDCM (Grassroots DICOM). A DICOM library Copyright (c) 2006-2011 Mathieu Malaterre All rights reserved. See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html 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. =========================================================================*/ #ifndef GDCMJPEG16CODEC_H #define GDCMJPEG16CODEC_H #include "gdcmJPEGCodec.h" namespace gdcm { class JPEGInternals; class ByteValue; /** * \brief Class to do JPEG 16bits (lossless) * \note internal class */ class JPEG16Codec : public JPEGCodec { public: JPEG16Codec(); ~JPEG16Codec(); bool DecodeByStreams(std::istream &is, std::ostream &os); bool InternalCode(const char *input, unsigned long len, std::ostream &os); bool GetHeaderInfo(std::istream &is, TransferSyntax &ts); protected: bool IsStateSuspension() const; private: JPEGInternals *Internals; }; } // end namespace gdcm #endif //GDCMJPEG16CODEC_H
/* * POK header * * The following file is a part of the POK project. Any modification should * made according to the POK licence. You CANNOT use this file or a part of * this file is this part of a file for your own project * * For more information on the POK licence, please see our LICENCE FILE * * Please follow the coding guidelines described in doc/CODING_GUIDELINES * * Copyright (c) 2007-2009 POK team * * Created by julien on Thu Jan 15 23:34:13 2009 */ #include <types.h> #include <libc/stdio.h> void handle_wave2 (int* t) { static int toto = 20; *t = toto; printf ("I send the value %d\n", toto); toto++; }
/** * Copyright (c) 2016, Codrin-Victor Poienaru <cvpoienaru@gmail.com>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * This software is provided by the copyright holders and contributors "as is" * and any express or implied warranties, including, but not limited to, the * implied warranties of merchantability and fitness for a particular purpose * are disclaimed. In no event shall the copyright 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 C_DEV_PACK_LIST_LIST_METADATA_H_ #define C_DEV_PACK_LIST_LIST_METADATA_H_ #include <defs.h> struct cdp_list_metadata { cdp_size_t items_used; cdp_size_t items_allocated; }; struct cdp_list_metadata* cdp_create_list_metadata(void); struct cdp_list_metadata* cdp_create_list_metadata_copy( struct cdp_list_metadata *metadata); void cdp_destroy_list_metadata(struct cdp_list_metadata **metadata); const int cdp_validate_list_metadata(struct cdp_list_metadata *metadata); const cdp_size_t cdp_get_list_metadata_items_used( struct cdp_list_metadata *metadata); const cdp_size_t cdp_get_list_metadata_items_allocated( struct cdp_list_metadata *metadata); const int cdp_set_list_metadata_items_used( struct cdp_list_metadata *metadata, cdp_size_t items_used); const int cdp_set_list_metadata_items_allocated( struct cdp_list_metadata *metadata, cdp_size_t items_allocated); #endif /* C_DEV_PACK_LIST_LIST_METADATA_H_ */
////////////////////////////////////////////////////////////////////////////// // NOTICE: // // ADLib, Prop and their related set of tools and documentation are in the // public domain. The author(s) of this software reserve no copyrights on // the source code and any code generated using the tools. You are encouraged // to use ADLib and Prop to develop software, in both academic and commercial // settings, and are free to incorporate any part of ADLib and Prop into // your programs. // // Although you are under no obligation to do so, we strongly recommend that // you give away all software developed using our tools. // // We also ask that credit be given to us when ADLib and/or Prop are used in // your programs, and that this notice be preserved intact in all the source // code. // // This software is still under development and we welcome any suggestions // and help from the users. // // Allen Leung // 1994 ////////////////////////////////////////////////////////////////////////////// #ifndef ordered_hashing_based_set_h #define ordered_hashing_based_set_h #include <AD/contain/hashset.h> #include <AD/hash/ohash.h> ///////////////////////////////////////////////////////////////////////// // Class OHSet ///////////////////////////////////////////////////////////////////////// template <class T> class OHSet : public HashSet<T, OHashTable <T,int> > { public: ////////////////////////////////////////////////////////////////// // Constructors and destructor ////////////////////////////////////////////////////////////////// OHSet(int size = 64) : HashSet<T, OHashTable<T,int> >(size) {} ~OHSet() {} ////////////////////////////////////////////////////////////////// // Everything else is inherited from HashSet ////////////////////////////////////////////////////////////////// typedef HashSet<T, OHashTable<T, int> > Super; typedef Super::Element Element; }; #endif
// // U13ActionQueue.h // U13Actions // // Created by Brane on 13-03-19. // Copyright (c) 2013 Universe 13. All rights reserved. // #import <Foundation/Foundation.h> @class U13Action; @interface U13ActionQueue : NSObject { NSOperationQueue *queue_; NSMutableDictionary *throttles_; } @property (readonly) BOOL loggedIn; /** number of seconds an action can not be re-fired after being fired, 0 == no throttle */ - (NSTimeInterval)throttleSeconds:(U13Action *)action; - (void)updateThrottle:(U13Action *)action; - (void)resetThrottles; - (void)resetThrottle:(U13Action *)action; - (void)enqueue:(U13Action *)action; - (void)enqueueWithoutValidation:(U13Action *)action; - (void)validate:(U13Action *)action; - (void)perform:(U13Action *)action; @end
/*------------------------------------------------------------------------- * * standby.h * Definitions for hot standby mode. * * * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/standby.h * *------------------------------------------------------------------------- */ #ifndef STANDBY_H #define STANDBY_H #include "access/xlog.h" #include "storage/lock.h" #include "storage/procsignal.h" #include "storage/relfilenode.h" /* User-settable GUC parameters */ extern int vacuum_defer_cleanup_age; extern int max_standby_archive_delay; extern int max_standby_streaming_delay; extern void InitRecoveryTransactionEnvironment(void); extern void ShutdownRecoveryTransactionEnvironment(void); extern void ResolveRecoveryConflictWithSnapshot(TransactionId latestRemovedXid, RelFileNode node); extern void ResolveRecoveryConflictWithRemovedTransactionId(void); extern void ResolveRecoveryConflictWithTablespace(Oid tsid); extern void ResolveRecoveryConflictWithDatabase(Oid dbid); extern void ResolveRecoveryConflictWithBufferPin(void); extern void SendRecoveryConflictWithBufferPin(ProcSignalReason reason); extern void CheckRecoveryConflictDeadlock(void); /* * Standby Rmgr (RM_STANDBY_ID) * * Standby recovery manager exists to perform actions that are required * to make hot standby work. That includes logging AccessExclusiveLocks taken * by transactions and running-xacts snapshots. */ extern void StandbyAcquireAccessExclusiveLock(TransactionId xid, Oid dbOid, Oid relOid); extern void StandbyReleaseLockTree(TransactionId xid, int nsubxids, TransactionId *subxids); extern void StandbyReleaseAllLocks(void); extern void StandbyReleaseOldLocks(int nxids, TransactionId *xids); /* * XLOG message types */ #define XLOG_STANDBY_LOCK 0x00 #define XLOG_RUNNING_XACTS 0x10 typedef struct xl_standby_locks { int nlocks; /* number of entries in locks array */ xl_standby_lock locks[1]; /* VARIABLE LENGTH ARRAY */ } xl_standby_locks; /* * When we write running xact data to WAL, we use this structure. */ typedef struct xl_running_xacts { int xcnt; /* # of xact ids in xids[] */ bool subxid_overflow; /* snapshot overflowed, subxids missing */ TransactionId nextXid; /* copy of ShmemVariableCache->nextXid */ TransactionId oldestRunningXid; /* *not* oldestXmin */ TransactionId latestCompletedXid; /* so we can set xmax */ TransactionId xids[1]; /* VARIABLE LENGTH ARRAY */ } xl_running_xacts; #define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids) /* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */ extern void standby_redo(XLogRecPtr lsn, XLogRecord *record); extern void standby_desc(StringInfo buf, uint8 xl_info, char *rec); /* * Declarations for GetRunningTransactionData(). Similar to Snapshots, but * not quite. This has nothing at all to do with visibility on this server, * so this is completely separate from snapmgr.c and snapmgr.h. * This data is important for creating the initial snapshot state on a * standby server. We need lots more information than a normal snapshot, * hence we use a specific data structure for our needs. This data * is written to WAL as a separate record immediately after each * checkpoint. That means that wherever we start a standby from we will * almost immediately see the data we need to begin executing queries. */ typedef struct RunningTransactionsData { int xcnt; /* # of xact ids in xids[] */ bool subxid_overflow; /* snapshot overflowed, subxids missing */ TransactionId nextXid; /* copy of ShmemVariableCache->nextXid */ TransactionId oldestRunningXid; /* *not* oldestXmin */ TransactionId latestCompletedXid; /* so we can set xmax */ TransactionId *xids; /* array of (sub)xids still running */ } RunningTransactionsData; typedef RunningTransactionsData *RunningTransactions; extern void LogAccessExclusiveLock(Oid dbOid, Oid relOid); extern void LogAccessExclusiveLockPrepare(void); extern void LogStandbySnapshot(TransactionId *nextXid); #endif /* STANDBY_H */
#ifndef __MONO_NATIVE_MSCORLIB_SYSTEM_THREADING_LAZYTHREADSAFETYMODE_H #define __MONO_NATIVE_MSCORLIB_SYSTEM_THREADING_LAZYTHREADSAFETYMODE_H namespace mscorlib { namespace System { namespace Threading { class LazyThreadSafetyMode { public: enum __ENUM__ { None = 0, PublicationOnly = 1, ExecutionAndPublication = 2, }; }; } } } #endif
#ifndef CONFIGFILE_H // -*- c++ -*- #define CONFIGFILE_H /// // Copyright (C) 2002 - 2004, Fredrik Arnerup & Rasmus Kaj, See COPYING /// #include <string> #include <vector> #include <iostream> namespace Config { struct Var { std::string name; Var(std::string name_): name(name_) {} virtual ~Var() {} virtual void print(std::ostream &out) const = 0; virtual void parse(const std::string &input) = 0; }; typedef std::vector<bool> Bools; struct BoolVar: public Var { Bools values; BoolVar(std::string name_): Var(name_) {} virtual ~BoolVar() {} void print(std::ostream &out) const; void parse(const std::string &input); }; typedef std::vector<std::string> Strings; struct StringVar: public Var { Strings values; StringVar(std::string name_): Var(name_) {} virtual ~StringVar() {} void print(std::ostream &out) const; void parse(const std::string &input); }; typedef std::vector<float> Floats; struct FloatVar: public Var { Floats values; FloatVar(std::string name_): Var(name_) {} virtual ~FloatVar() {} void print(std::ostream &out) const; void parse(const std::string &input); }; typedef std::vector<Var*> Vars; /** * A configuration file parser. Each statement can only be one line * of the format: name = value The variable name may contain any * character except '=' and newline. All variables must be declared, * so that the parser knows what format to expect the value to be * in. Actually, the parsing of the value is handled by the declared * variable object itself, making it easy to add new types. * * Existing types are lists of booleans, strings and floats. The * values in a list are separated by whitespace. Strings may be quoted * with '"'. The '"' character may be escaped (in strings only) with * '\"'. * * Comments start with '#' and may only appear on lines of their own.*/ class File { public: File(): ignore_unknown(false) {} virtual ~File() {} void set_filename(std::string filename); void declare_var(Var *var); void read(const std::string &filename); virtual void write(const std::string &filename); protected: bool ignore_unknown; // don't complain about unknown variables /** Report error. Feel free to override this method. */ virtual void error(const std::string &message) { std::cerr << message << std::endl; } Vars vars; }; } #endif
/* * File: jobject.h * Author: igel * * Created on 01 Май 2010 г., 22:44 */ #ifndef _JOBJECT_H #define _JOBJECT_H #include "jcore.h" #include "jmemory.h" #include "jstream.h" #include "jclass.h" #include "jutils.h" JClass jo_get_class( JObject o ) { return (JClass) o->class; } JObjectField jo_find_field( JObject o, const char *name, const char *type ) { // printf( "FFLD %s.%s:%s\n", jc_get_name( jo_get_class( o ) ), name, type ); // printf( "FCNT:%i\n", o->fields_count ); for ( int i = 0; i < o->fields_count; i++ ) { JObjectField f = o->fields[i]; // printf( "F %s:%s\n", jf_get_name( f->field ), jf_get_type( f->field ) ); if ( strcmp( name, jf_get_name( f->field ) ) == 0 ) // if ( strcmp( type, jf_get_type( f->field ) ) == 0 ) return f; } return NULL; } JObject jo_new( JClass c, bool stat ) { JObject r = jmm_alloc( sizeof (_JObject) ); r->class = c; r->fields_count = 0; // printf( "NEW CFC:%i\n", c->fields_count ); for ( int i = 0; i < c->fields_count; i++ ) { bool s = c->fields[i]->attributes_flags & JFAF_STATIC; if ( (s && stat) || (!s && !stat) ) r->fields_count++; } r->fields = jmm_alloc( sizeof (void*) * r->fields_count ); int f_idx = 0; for ( int i = 0; i < c->fields_count; i++ ) { bool s = c->fields[i]->attributes_flags & JFAF_STATIC; if ( (s && stat) || (!s && !stat) ) { JObjectField f = jmm_alloc( sizeof (_JObjectField) ); f->field = c->fields[i]; f->val.type = jf_get_rtype( f->field ); r->fields[f_idx] = f; f_idx++; } } return r; } #endif /* _JOBJECT_H */
/*++ Copyright (C) 2019 3MF Consortium All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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. Abstract: NMR_ModelReaderNode100_Tex2Coord.h defines the Model Reader Tex2Coord Node Class. --*/ #ifndef __NMR_MODELREADERNODE100_TEX2COORD #define __NMR_MODELREADERNODE100_TEX2COORD #include "Model/Reader/NMR_ModelReaderNode.h" #include "Model/Classes/NMR_ModelComponent.h" #include "Model/Classes/NMR_ModelComponentsObject.h" #include "Model/Classes/NMR_ModelObject.h" namespace NMR { class CModelReaderNode100_Tex2Coord : public CModelReaderNode { private: CModel * m_pModel; nfBool m_bHasU; nfBool m_bHasV; MODELTEXTURE2DCOORDINATE m_sUVCoordinate; protected: virtual void OnAttribute(_In_z_ const nfChar * pAttributeName, _In_z_ const nfChar * pAttributeValue); public: CModelReaderNode100_Tex2Coord() = delete; CModelReaderNode100_Tex2Coord(_In_ CModel * pModel, _In_ PModelWarnings pWarnings); virtual void parseXML(_In_ CXmlReader * pXMLReader); nfBool hasU(); nfBool hasV(); MODELTEXTURE2DCOORDINATE getUV(); }; typedef std::shared_ptr <CModelReaderNode100_Tex2Coord> PModelReaderNode100_Tex2Coord; } #endif // __NMR_MODELREADERNODE100_TEX2COORD
#ifndef LINEAR_IP_IMPL_H #define LINEAR_IP_IMPL_H /** * @file lp_impl.h * @brief The implementation class of an interior point linear programming solver. * * @author Chris Jordan-Squire * @date 03/02/2013 */ #include "lp.h" #include <iostream> #include <sstream> #include <cmath> #include <cassert> namespace linear_ip{ typedef Eigen::ColPivHouseholderQR<Matrix> cph_qr; typedef cph_qr::PermutationType cph_qr_perm; typedef Eigen::TriangularView<const Matrix, Eigen::Upper> uc_triang; typedef Eigen::TriangularView<Matrix, Eigen::Upper> u_triang; /** @brief POD Container for residuals used to determine the * update directions */ struct residuals{ /**@brief Ax-b */ Matrix b; /**@brief A^T*lam + s-c*/ Matrix c; /**@brief XSe */ Matrix xs;}; /** @brief POD Container for the update directions for the Newton * step. */ struct directions{ Matrix lam; Matrix s; Matrix x;}; /** @relates lp_impl * Compute the stepsize for the corrector direction * in the predictor-corrector method. * @param v The vector to be updated. * @param dv The direction to take a step in. * @param eta Damping parameter so v + stepsize*dv stays off the * boundary. Assumed between 0 and 1. * @return The stepsize.*/ double corrector_stepsize(const Matrix &v, const Matrix &dv, double eta); /** @relates lp_impl * Compute the maximum stepsize in the direction dx which maintains* x>=0. * @param x The current solution. * @param dx Direction to update x. * @return Largest stepsize which mainstains x>=0.*/ double min_ratio(const Vector &x, const Vector &dx); class lp_impl{ public: /** @brief The cost vector */ const Vector c_; /** @brief The constraint matrix*/ const Matrix A_; /** @brief The constraint vector*/ const Vector b_; /** @brief The current estimated primal solution.*/ Vector x_; /** @brief The current estimated dual solution for * the constraints Ax=b.*/ Vector lam_; /** @brief The current estimated dual solution for the * constraints x>=0.*/ Vector s_; /** @brief Has the problem been solved.*/ bool is_solved_; /** @brief The number of rows of A; the dual dimension.*/ int rows_; /** @brief The number of columns of A; the primal dimension.*/ int cols_; /** @brief The tolerance used to test convergence. * By default the tolerance is set to 1e-6. */ double tol_; /** @brief The maximum number of iterations in the interior * point method. * By default this is set to 10. */ int max_itr_; /** @brief The (only) constructor. * @param c The cost vector * @param A The constraint matrix * @param b The constraint vector */ lp_impl(Vector c, Matrix A, Vector b); /** @brief Initializes the primal and dual solutions. * This initializes the primal and dual solutions using * the method described in Section 14.2 of Nocedal/Wright * 2nd edition. */ void init(); /** Use the Mehrota predictor-corrector interior point * solver to solver the LP instance.*/ void solve(); /** @brief Prints the problem information * Mainly used for debugging. * @return A string containing the vectors and matrix * used to construct the instance. */ std::string print_prob(); /** In the interior point solver, test at the end of * each iteration of the predictor-corrector method if * the solution is optimal. */ bool test_convergence(); /** Compute the residuals, i.e. the vector solved for * in the Newton method each iteration. * @param r The residuals for the current primal and * dual variables*/ void compute_residuals(residuals &r); /** Compute the lambda direction for a given set of residuals, * i.e. the update direction for the constraints Ax=b. * @param r The residuals for the current primal and dual * variables. * @param M_LDL The Cholesky factorization of a AXS^(-1)A^T. * @return The update direction for lambda. */ Matrix compute_dlam(const residuals &r, const Eigen::LDLT<Matrix> &M_LDL); /** Compute the Newton direction for a given * residual vector. * @param d The new direction vectors are placed in this. * @param r The residual vectors. * @param M_LDL The Cholesky factorization of AXS^(-1)A^T.*/ void compute_dir(directions &d, const residuals &r, const Eigen::LDLT<Matrix> &M_LDL); }; } #endif
/************************************************************************ * * Flood Project © (2008-201x) * Licensed under the simplified BSD license. All rights reserved. * ************************************************************************/ #pragma once #include "Core/API.h" #include "Core/Event.h" #include "Core/String.h" #include "Core/Timer.h" #include "Core/Concurrency.h" NAMESPACE_CORE_BEGIN //-----------------------------------// enum class LogLevel { Info, Warn, Error, Debug, Assert }; struct API_CORE LogEntry { float time; String message; LogLevel level; }; typedef void (*LogFunction)(LogEntry*); class Timer; struct Allocator; struct API_CORE Log { Log(); ~Log(); Timer timer; Mutex mutex; Event1<LogEntry*> handlers; }; API_CORE Log* LogCreate(Allocator*); API_CORE void LogDestroy(Log*); API_CORE void LogAddHandler(Log*, LogFunction); API_CORE void LogRemoveHandler(Log*, LogFunction); API_CORE void LogWrite(Log*, LogEntry* entry); API_CORE Log* LogGetDefault(); API_CORE void LogSetDefault(Log*); API_CORE void LogInfo(const char* msg, ...); API_CORE void LogWarn(const char* msg, ...); API_CORE void LogError(const char* msg, ...); API_CORE void LogDebug(const char* msg, ...); API_CORE void LogAssert(const char* msg, ...); //-----------------------------------// NAMESPACE_CORE_END
// Copyright (c) 2009-2011 Ignacio Castano <castano@gmail.com> // Copyright (c) 2007-2009 NVIDIA Corporation -- Ignacio Castano <icastano@nvidia.com> // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, // copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. #ifndef NV_TT_COMPRESSIONOPTIONS_H #define NV_TT_COMPRESSIONOPTIONS_H #include "nvtt.h" #include "nvmath/Vector.h" #include "nvcore/StrLib.h" namespace nvtt { struct CompressionOptions::Private { Format format; Quality quality; nv::Vector4 colorWeight; // Pixel format description. uint bitcount; uint rmask; uint gmask; uint bmask; uint amask; uint8 rsize; uint8 gsize; uint8 bsize; uint8 asize; PixelType pixelType; uint pitchAlignment; nv::String externalCompressor; // Quantization. bool enableColorDithering; bool enableAlphaDithering; bool binaryAlpha; int alphaThreshold; // reference value used for binary alpha quantization. Decoder decoder; uint getBitCount() const { if (format == Format_RGBA) { if (bitcount != 0) return bitcount; else return rsize + gsize + bsize + asize; } return 0; } }; } // nvtt namespace #endif // NV_TT_COMPRESSIONOPTIONS_H
/* ** Bit manipulation library. ** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h */ #define lib_bit_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" #include "lualib.h" #include "lj_obj.h" #include "lj_err.h" #include "lj_buf.h" #include "lj_strscan.h" #include "lj_strfmt.h" #if LJ_HASFFI #include "lj_ctype.h" #include "lj_cdata.h" #include "lj_cconv.h" #include "lj_carith.h" #endif #include "lj_ff.h" #include "lj_lib.h" /* ------------------------------------------------------------------------ */ #define LJLIB_MODULE_bit #if LJ_HASFFI static int bit_result64(lua_State *L, CTypeID id, uint64_t x) { GCcdata *cd = lj_cdata_new_(L, id, 8); *(uint64_t *)cdataptr(cd) = x; setcdataV(L, L->base-1, cd); return FFH_RES(1); } #else static int32_t bit_checkbit(lua_State *L, int narg) { TValue *o = L->base + narg-1; if (!(o < L->top && lj_strscan_numberobj(o))) lj_err_argt(L, narg, LUA_TNUMBER); if (LJ_LIKELY(tvisint(o))) { return intV(o); } else { int32_t i = lj_num2bit(numV(o)); if (LJ_DUALNUM) setintV(o, i); return i; } } #endif LJLIB_ASM(bit_tobit) LJLIB_REC(bit_tobit) { #if LJ_HASFFI CTypeID id = 0; setintV(L->base-1, (int32_t)lj_carith_check64(L, 1, &id)); return FFH_RES(1); #else lj_lib_checknumber(L, 1); return FFH_RETRY; #endif } LJLIB_ASM(bit_bnot) LJLIB_REC(bit_unary IR_BNOT) { #if LJ_HASFFI CTypeID id = 0; uint64_t x = lj_carith_check64(L, 1, &id); return id ? bit_result64(L, id, ~x) : FFH_RETRY; #else lj_lib_checknumber(L, 1); return FFH_RETRY; #endif } LJLIB_ASM(bit_bswap) LJLIB_REC(bit_unary IR_BSWAP) { #if LJ_HASFFI CTypeID id = 0; uint64_t x = lj_carith_check64(L, 1, &id); return id ? bit_result64(L, id, lj_bswap64(x)) : FFH_RETRY; #else lj_lib_checknumber(L, 1); return FFH_RETRY; #endif } LJLIB_ASM(bit_lshift) LJLIB_REC(bit_shift IR_BSHL) { #if LJ_HASFFI CTypeID id = 0, id2 = 0; uint64_t x = lj_carith_check64(L, 1, &id); int32_t sh = (int32_t)lj_carith_check64(L, 2, &id2); if (id) { x = lj_carith_shift64(x, sh, curr_func(L)->c.ffid - (int)FF_bit_lshift); return bit_result64(L, id, x); } if (id2) setintV(L->base+1, sh); return FFH_RETRY; #else lj_lib_checknumber(L, 1); bit_checkbit(L, 2); return FFH_RETRY; #endif } LJLIB_ASM_(bit_rshift) LJLIB_REC(bit_shift IR_BSHR) LJLIB_ASM_(bit_arshift) LJLIB_REC(bit_shift IR_BSAR) LJLIB_ASM_(bit_rol) LJLIB_REC(bit_shift IR_BROL) LJLIB_ASM_(bit_ror) LJLIB_REC(bit_shift IR_BROR) LJLIB_ASM(bit_band) LJLIB_REC(bit_nary IR_BAND) { #if LJ_HASFFI CTypeID id = 0; TValue *o = L->base, *top = L->top; int i = 0; do { lj_carith_check64(L, ++i, &id); } while (++o < top); if (id) { CTState *cts = ctype_cts(L); CType *ct = ctype_get(cts, id); int op = curr_func(L)->c.ffid - (int)FF_bit_bor; uint64_t x, y = op >= 0 ? 0 : ~(uint64_t)0; o = L->base; do { lj_cconv_ct_tv(cts, ct, (uint8_t *)&x, o, 0); if (op < 0) y &= x; else if (op == 0) y |= x; else y ^= x; } while (++o < top); return bit_result64(L, id, y); } return FFH_RETRY; #else int i = 0; do { lj_lib_checknumber(L, ++i); } while (L->base+i < L->top); return FFH_RETRY; #endif } LJLIB_ASM_(bit_bor) LJLIB_REC(bit_nary IR_BOR) LJLIB_ASM_(bit_bxor) LJLIB_REC(bit_nary IR_BXOR) /* ------------------------------------------------------------------------ */ LJLIB_CF(bit_tohex) LJLIB_REC(.) { #if LJ_HASFFI CTypeID id = 0, id2 = 0; uint64_t b = lj_carith_check64(L, 1, &id); int32_t n = L->base+1>=L->top ? (id ? 16 : 8) : (int32_t)lj_carith_check64(L, 2, &id2); #else uint32_t b = (uint32_t)bit_checkbit(L, 1); int32_t n = L->base+1>=L->top ? 8 : bit_checkbit(L, 2); #endif SBuf *sb = lj_buf_tmp_(L); SFormat sf = (STRFMT_UINT|STRFMT_T_HEX); if (n < 0) { n = -n; sf |= STRFMT_F_UPPER; } sf |= ((SFormat)((n+1)&255) << STRFMT_SH_PREC); #if LJ_HASFFI if (n < 16) b &= ((uint64_t)1 << 4*n)-1; #else if (n < 8) b &= (1u << 4*n)-1; #endif sb = lj_strfmt_putfxint(sb, sf, b); setstrV(L, L->top-1, lj_buf_str(L, sb)); lj_gc_check(L); return 1; } /* ------------------------------------------------------------------------ */ #include "lj_libdef.h" LUALIB_API int luaopen_bit(lua_State *L) { LJ_LIB_REG(L, LUA_BITLIBNAME, bit); return 1; }
/* src/include/port/nextstep.h */ #include "libc.h" #include <sys/ioctl.h> #if defined(__STRICT_ANSI__) #define isascii(c) ((unsigned)(c)<=0177) #endif extern char *strdup(const char *string); #ifndef _POSIX_SOURCE typedef unsigned short mode_t; typedef int sigset_t; #define SIG_BLOCK 00 #define SIG_UNBLOCK 01 #define SIG_SETMASK 02 #endif #define NO_WAITPID
/////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2004, Industrial Light & Magic, a division of Lucas // Digital Ltd. LLC // // 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 Industrial Light & Magic 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 INCLUDED_MAKE_CUBE_MAP_H #define INCLUDED_MAKE_CUBE_MAP_H //----------------------------------------------------------------------------- // // function makeCubeMap() -- makes cube-face environment maps // //----------------------------------------------------------------------------- #include <ImfTileDescription.h> #include <ImfCompression.h> #include <readInputImage.h> void makeCubeMap (EnvmapImage &image, Imf::Header &header, Imf::RgbaChannels channels, const char outFileName[], int tileWidth, int tileHeight, Imf::LevelMode levelMode, Imf::LevelRoundingMode roundingMode, Imf::Compression compression, int mapWidth, float filterRadius, int numSamples, bool verbose); #endif
//================================================================================================= /*! // \file blaze/util/mpl/PtrdiffT.h // \brief Header file for the PtrdiffT class template // // Copyright (C) 2012-2017 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. 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 names of the Blaze development group 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 _BLAZE_UTIL_MPL_PTRDIFFT_H_ #define _BLAZE_UTIL_MPL_PTRDIFFT_H_ //************************************************************************************************* // Includes //************************************************************************************************* #include <blaze/util/IntegralConstant.h> #include <blaze/util/Types.h> namespace blaze { //================================================================================================= // // CLASS DEFINITION // //================================================================================================= //************************************************************************************************* /*!\brief Compile time integral constant wrapper for \a ptrdiff_t. // \ingroup mpl // // The PtrdiffT class template represents an integral wrapper for a compile time constant // expression of type \a ptrdiff_t. The value of an PtrdiffT can be accessed via the nested // \a value (which is guaranteed to be of type \a ptrdiff_t), the type can be accessed via // the nested type definition \a ValueType. \code using namespace blaze; PtrdiffT<3>::value // Evaluates to 3 PtrdiffT<5>::ValueType // Results in ptrdiff_t \endcode */ template< ptrdiff_t N > struct PtrdiffT : public IntegralConstant<ptrdiff_t,N> {}; //************************************************************************************************* } // namespace blaze #endif
/* * Copyright (C) 2015, 2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #if ENABLE(APPLE_PAY) #include "PaymentRequest.h" namespace WebCore { class DOMWindow; class PaymentRequestValidator { public: explicit PaymentRequestValidator(DOMWindow&); ~PaymentRequestValidator(); bool validate(const PaymentRequest&) const; bool validateTotal(const PaymentRequest::LineItem&) const; private: bool validateCountryCode(const String&) const; bool validateCurrencyCode(const String&) const; bool validateMerchantCapabilities(const PaymentRequest::MerchantCapabilities&) const; bool validateSupportedNetworks(const Vector<String>&) const; bool validateShippingMethods(const Vector<PaymentRequest::ShippingMethod>&) const; bool validateShippingMethod(const PaymentRequest::ShippingMethod&) const; DOMWindow& m_window; }; } #endif
#ifndef SCENE_H #define SCENE_H #include "object.h" #include "config.h" typedef bool (*input_handler)(void *scene_input); struct scene { struct object super; void *in; input_handler input; }; #define GRID_SIZE 8 #define MAP_HEIGHT BASE_HEIGHT/GRID_SIZE #define MAP_WIDTH BASE_WIDTH/GRID_SIZE struct scene_menu { struct scene super; struct object_ball *ball; struct object_text *fps; struct object_text *txt; char map[MAP_HEIGHT][MAP_WIDTH]; bool init; }; struct scene *scene_get_current(); void scene_set_current(struct scene *scene); #endif /* SCENE_H */
/* * Copyright 2014 Nutiteq Llc. All rights reserved. * Copying and using this code is allowed only according * to license terms, as given in https://www.nutiteq.com/license/ */ #ifndef _NUTI_MAPNIKVT_FEATURECOLLECTION_H_ #define _NUTI_MAPNIKVT_FEATURECOLLECTION_H_ #include "Value.h" #include "Geometry.h" #include "FeatureData.h" #include <memory> #include <list> #include <vector> #include <map> #include <cglib/vec.h> namespace Nuti { namespace MapnikVT { class FeatureCollection { public: FeatureCollection() = default; void clear() { _ids.clear(); _geometries.clear(); } void append(long long id, std::shared_ptr<Geometry> geometry) { _ids.push_back(id); _geometries.push_back(std::move(geometry)); } void setFeatureData(std::shared_ptr<FeatureData> featureData) { _featureData = std::move(featureData); } std::size_t getSize() const { return _ids.size(); } long long getId(std::size_t index) const { return _ids.at(index); } const std::shared_ptr<Geometry>& getGeometry(std::size_t index) const { return _geometries.at(index); } const std::shared_ptr<FeatureData>& getFeatureData() const { return _featureData; } private: std::vector<long long> _ids; std::vector<std::shared_ptr<Geometry>> _geometries; std::shared_ptr<FeatureData> _featureData; }; } } #endif
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <DevToolsCore/XCDependencyCommand.h> @class NSMutableArray, NSString; @interface XCFixLinkageCommand : XCDependencyCommand { NSMutableArray *_additionalArguments; NSString *_compiledCodeFilePath; NSString *_outputFilePath; } - (void)addAdditionalArgument:(id)arg1; - (id)additionalArguments; - (id)arguments; - (id)commandPath; - (id)commandToolPath; - (id)compiledCodeFilePath; - (void)dealloc; - (id)description; - (id)descriptionForWorkQueueLog; - (id)directoryPathToCreateBeforeProcessing; - (id)initWithCommandPath:(id)arg1 compiledCodeFilePath:(id)arg2 outputFilePath:(id)arg3; - (id)instantiatedCommandOutputParserWithLogSectionRecorder:(id)arg1; - (BOOL)isReadyForProcessing; - (id)name; - (id)outputFilePath; - (id)ruleInfo; - (id)subprocessCommandLineForProcessing; @end
/************************************************************************************ * configs/ne64badge/src/m9s12_boot.c * * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * ************************************************************************************/ /************************************************************************************ * Included Files ************************************************************************************/ #include <nuttx/config.h> #include <debug.h> #include <nuttx/board.h> #include <arch/board/board.h> #include "ne64badge_internal.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ /************************************************************************************ * Private Functions ************************************************************************************/ /************************************************************************************ * Public Functions ************************************************************************************/ /************************************************************************************ * Name: hcs12_boardinitialize * * Description: * All HCS12 architectures must provide the following entry point. This entry point * is called early in the initialization -- after all memory has been configured * and mapped but before any devices have been initialized. * ************************************************************************************/ void hcs12_boardinitialize(void) { /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function * hcs12_spiinitialize() has been brought into the link. */ #if defined(CONFIG_INCLUDE_HCS12_ARCH_SPI) if (hcs12_spiinitialize) { hcs12_spiinitialize(); } #endif /* Configure on-board LEDs if LED support has been selected. */ #ifdef CONFIG_ARCH_LEDS board_led_initialize(); #endif }
//------------------------------------------------------------------------------ // Filename: InvalidSaveCommand.h // // Group: 13741, study assistant: Pascal Nasahl // // Authors: Klaus Fabian Frühwirth (1131523) // Samuel Sommer (1430080) // Anika Jaindl (1431420) //------------------------------------------------------------------------------ #ifndef INVALID_SAVE_COMMAND_H #define INVALID_SAVE_COMMAND_H #include "SaveCommand.h" //------------------------------------------------------------------------------ // InvalidSaveCommand Class // This class is necessary for compliance with [1] // Basically it stores the information that an error (invalid filename) was // detected and we want to throw an exception later in the "Command que", in // order to let other commands finish first. // However, instead of throwing an exception witch would prevent all following // Commands frome execution we just print a extremely generic err. msg. // // [1] https://palme.iicm.tugraz.at/wiki/SEP/Basic_SS16#Command_Line_Argumente // class InvalidSaveCommand : public Command { public: //-------------------------------------------------------------------------- // Constructor // InvalidSaveCommand(); //-------------------------------------------------------------------------- // Clone method // Method to clone the current InvalidSaveCommand // @return Returns a new InvalidSaveCommand that is a copy of the current // one // virtual InvalidSaveCommand* clone(); //-------------------------------------------------------------------------- // Destructor // virtual ~InvalidSaveCommand() = default; //-------------------------------------------------------------------------- // Execute method // Executes the InvalidSave command // virtual void execute(); }; #endif
--- pyopenchange/mapistore/folder.c.orig 2014-04-20 17:56:09.831788036 -0500 +++ pyopenchange/mapistore/folder.c 2014-04-20 17:57:08.797782670 -0500 @@ -108,7 +108,7 @@ value = PyObject_GetAttrString(datetime, "second"); tm->tm_sec = PyInt_AS_LONG(value); -#ifdef __USE_BSD +#if defined(__USE_BSD) || defined(__FreeBSD__) value = PyObject_CallMethod(datetime, "utcoffset", NULL); if (value && value != Py_None) { tm->tm_gmtoff = PyInt_AS_LONG(value);
/*****************************************************************************/ /* */ /* ÖìËɵÄͼÏñ´¦ÀíÆ½Ì¨ */ /* */ /* FileName: ImageRoadDetection.h */ /* */ /* Author: zhusong */ /* */ /* Version: 1.01 */ /* */ /* Date: 2014/12/29 */ /* */ /* Description: Â·Ãæ¼ì²â */ /* */ /* Others: */ /* */ /* History: */ /* */ /*****************************************************************************/ #ifndef _IMAGE_ROAD_DETECTION_H_ #define _IMAGE_ROAD_DETECTION_H_ #ifdef __cplusplus extern "C"{ #endif /* end of __cplusplus */ #include "BaseConstDef.h" #include "BaseTypeDef.h" #include "BaseFuncDef.h" #include <string.h> #include "ImageMatchPostprocess.h" #include "ImageIer.h" #include "ImageMatchEadp.h" #include "ImageMatchSgm.h" #include "ImageRegionFeature.h" #include "ImageRegionClassify.h" typedef struct tagImageRdInfo { IMAGE_S src[2]; int dlength; int dispcal; int dispshow; int segshow; PIXEL *dispimg; PIXEL *segimg; PIXEL *lblimg; IerInfo ier; ImEadpInfo eadp; ImSgmInfo sgm; IrfFeaInfo feainfo; int *feature; int *label; }ImageRdInfo; extern void ImageRdPara(OUT ImageRdInfo *rd); extern void ImageRdInfoset(OUT ImageRdInfo *rd, IN IMAGE_S *imageL, IN IMAGE_S *imageR, IN int dlength); extern void ImageRdInit(OUT ImageRdInfo *rd); extern void ImageRdDestroy(OUT ImageRdInfo *rd); extern void ImageRdProc(OUT ImageRdInfo *rd); extern void TestMyData(); #ifdef __cplusplus } #endif /* end of __cplusplus */ #endif
#pragma once #include "Engine/Core/ConfigValue/IConfigValue.h" class ConfigValueFloat : public IConfigValue { public: ConfigValueFloat(const char* pName, const char* pDescription, float initValue, float minValue = -FLT_MAX, float maxValue = FLT_MAX); ConfigValueFloat& operator =(float newValue); operator float() const { return m_value; } const float m_minValue; const float m_maxValue; private: float m_value; };
//===-- serialbox/core/FieldMetainfoImplSerializer.h --------------------------------*- C++ -*-===// // // S E R I A L B O X // // This file is distributed under terms of BSD license. // See LICENSE.txt for more information // //===------------------------------------------------------------------------------------------===// // /// \file /// Enable json <-> FieldMetainfoImpl conversions via ADL /// //===------------------------------------------------------------------------------------------===// #ifndef SERIALBOX_CORE_FIELDMAPMETAINFOIMPLSERIALIZER_H #define SERIALBOX_CORE_FIELDMAPMETAINFOIMPLSERIALIZER_H #include "serialbox/core/FieldMetainfoImpl.h" #include "serialbox/core/Json.h" #include <memory> namespace serialbox { /// \addtogroup core /// @{ void to_json(json::json& j, FieldMetainfoImpl const& f); void from_json(json::json const& j, FieldMetainfoImpl& f); /// @} } // namespace serialbox #endif
// // AppDelegate.h // FSStarRatingView_Example // // Created by Farzad Sharbafian on 2015-07-20. // Copyright (c) 2015 Farzad Sharbafian. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/** @file Defines and prototypes for common EFI utility error and debug messages. Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef _EFI_UTILITY_MSGS_H_ #define _EFI_UTILITY_MSGS_H_ #include <Common/UefiBaseTypes.h> // // Log message print Level // #define VERBOSE_LOG_LEVEL 15 #define WARNING_LOG_LEVEL 15 #define INFO_LOG_LEVEL 20 #define KEY_LOG_LEVEL 40 #define ERROR_LOG_LEVLE 50 // // Status codes returned by EFI utility programs and functions // #define STATUS_SUCCESS 0 #define STATUS_WARNING 1 #define STATUS_ERROR 2 #define VOID void typedef int STATUS; #define MAX_LINE_LEN 0x200 #define MAXIMUM_INPUT_FILE_NUM 10 #ifdef __cplusplus extern "C" { #endif // // When we call Error() or Warning(), the module keeps track of the worst // case reported. GetUtilityStatus() will get the worst-case results, which // can be used as the return value from the app. // STATUS GetUtilityStatus ( VOID ); // // If someone prints an error message and didn't specify a source file name, // then we print the utility name instead. However they must tell us the // utility name early on via this function. // VOID SetUtilityName ( CHAR8 *ProgramName ) ; VOID PrintMessage ( CHAR8 *Type, CHAR8 *FileName, UINT32 LineNumber, UINT32 MessageCode, CHAR8 *Text, CHAR8 *MsgFmt, va_list List ); VOID Error ( CHAR8 *FileName, UINT32 LineNumber, UINT32 ErrorCode, CHAR8 *OffendingText, CHAR8 *MsgFmt, ... ) ; VOID Warning ( CHAR8 *FileName, UINT32 LineNumber, UINT32 WarningCode, CHAR8 *OffendingText, CHAR8 *MsgFmt, ... ) ; VOID DebugMsg ( CHAR8 *FileName, UINT32 LineNumber, UINT64 MsgLevel, CHAR8 *OffendingText, CHAR8 *MsgFmt, ... ) ; VOID VerboseMsg ( CHAR8 *MsgFmt, ... ); VOID NormalMsg ( CHAR8 *MsgFmt, ... ); VOID KeyMsg ( CHAR8 *MsgFmt, ... ); VOID SetPrintLevel ( UINT64 LogLevel ); VOID ParserSetPosition ( CHAR8 *SourceFileName, UINT32 LineNum ) ; VOID ParserError ( UINT32 ErrorCode, CHAR8 *OffendingText, CHAR8 *MsgFmt, ... ) ; VOID ParserWarning ( UINT32 ErrorCode, CHAR8 *OffendingText, CHAR8 *MsgFmt, ... ) ; VOID SetPrintLimits ( UINT32 NumErrors, UINT32 NumWarnings, UINT32 NumWarningsPlusErrors ) ; #ifdef __cplusplus } #endif #endif // #ifndef _EFI_UTILITY_MSGS_H_
/** @file Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "MiscSubclassDriver.h" /** This function makes boot time changes to the contents of the MiscOemString (Type 11). @param RecordData Pointer to copy of RecordData from the Data Table. @retval EFI_SUCCESS All parameters were valid. @retval EFI_UNSUPPORTED Unexpected RecordType value. @retval EFI_INVALID_PARAMETER Invalid parameter was found. **/ MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString) { EFI_STATUS Status; EFI_SMBIOS_HANDLE SmbiosHandle; SMBIOS_TABLE_TYPE13 *SmbiosRecord; UINTN StrLeng; CHAR8 *OptionalStrStart; EFI_STRING Str; STRING_REF TokenToGet; // // First check for invalid parameters. // if (RecordData == NULL) { return EFI_INVALID_PARAMETER; } TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_LANGUAGE_STRING); Str = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL); StrLeng = StrLen(Str); if (StrLeng > SMBIOS_STRING_MAX_LENGTH) { return EFI_UNSUPPORTED; } // // Two zeros following the last string. // SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1); ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13); // // Make handle chosen by smbios protocol.add automatically. // SmbiosRecord->Hdr.Handle = 0; SmbiosRecord->InstallableLanguages = 1; SmbiosRecord->Flags = 1; SmbiosRecord->CurrentLanguages = 1; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); UnicodeStrToAsciiStr(Str, OptionalStrStart); // // Now we have got the full smbios record, call smbios protocol to add this record. // Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); FreePool(SmbiosRecord); return Status; }
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import <ABI40_0_0React/ABI40_0_0RCTComponent.h> #import <UIKit/UIKit.h> /** * Contains any methods related to scrolling. Any `ABI40_0_0RCTView` that has scrolling * features should implement these methods. */ @protocol ABI40_0_0RCTScrollableProtocol @property (nonatomic, readonly) CGSize contentSize; - (void)scrollToOffset:(CGPoint)offset; - (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated; /** * If this is a vertical scroll view, scrolls to the bottom. * If this is a horizontal scroll view, scrolls to the right. */ - (void)scrollToEnd:(BOOL)animated; - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated; - (void)addScrollListener:(NSObject<UIScrollViewDelegate> *)scrollListener; - (void)removeScrollListener:(NSObject<UIScrollViewDelegate> *)scrollListener; @end /** * Denotes a view which implements custom pull to refresh functionality. */ @protocol ABI40_0_0RCTCustomRefreshContolProtocol @property (nonatomic, copy) ABI40_0_0RCTDirectEventBlock onRefresh; @property (nonatomic, readonly, getter=isRefreshing) BOOL refreshing; @end
#ifndef _ENG_TYPE_VEC3_H_ #define _ENG_TYPE_VEC3_H_ #include "sclr.h" #define TYPE Vec3 #define SUBTYPES \ FIELD(x, Sclr) \ FIELD(y, Sclr) \ FIELD(z, Sclr) #include "type.h" inline Vec3 vec3(double x, double y, double z) { Vec3 output; output.x = (Sclr)(x * BASIS); output.y = (Sclr)(y * BASIS); output.z = (Sclr)(z * BASIS); return output; } #endif
/*- * Copyright (c) 2015 Stephan Arts. 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY [LICENSOR] "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. */ int parse_command (const char *cmd, int len, int *argc, char ***args); int run_command (const char *name, int argc, char **args); int register_command (const char *name, int (*cmd)(int argc, char **args)); void register_commands (void);
// Copyright 2019-present 650 Industries. All rights reserved. #import <UMCore/UMInternalModule.h> #import <UMImageLoaderInterface/UMImageLoaderInterface.h> #import <React/RCTBridgeModule.h> #import <UIKit/UIKit.h> @interface EXImageLoader : NSObject <RCTBridgeModule, UMInternalModule, UMImageLoaderInterface> @end
/* FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. *************************************************************************** * * * FreeRTOS provides completely free yet professionally developed, * * robust, strictly quality controlled, supported, and cross * * platform software that has become a de facto standard. * * * * Help yourself get started quickly and support the FreeRTOS * * project by purchasing a FreeRTOS tutorial book, reference * * manual, or both from: http://www.FreeRTOS.org/Documentation * * * * Thank you! * * * *************************************************************************** This file is part of the FreeRTOS distribution. FreeRTOS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (version 2) as published by the Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. >>! NOTE: The modification to the GPL is included to allow you to distribute >>! a combined work that includes FreeRTOS without being obliged to provide >>! the source code for proprietary components outside of the FreeRTOS >>! kernel. FreeRTOS 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. Full license text is available from the following link: http://www.freertos.org/a00114.html 1 tab == 4 spaces! *************************************************************************** * * * Having a problem? Start by reading the FAQ "My application does * * not run, what could be wrong?" * * * * http://www.FreeRTOS.org/FAQHelp.html * * * *************************************************************************** http://www.FreeRTOS.org - Documentation, books, training, latest versions, license and Real Time Engineers Ltd. contact details. http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, including FreeRTOS+Trace - an indispensable productivity tool, a DOS compatible FAT file system, and our tiny thread aware UDP/IP stack. http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS licenses offer ticketed support, indemnification and middleware. http://www.SafeRTOS.com - High Integrity Systems also provide a safety engineered and independently SIL3 certified version for use in safety and mission critical applications that require provable dependability. 1 tab == 4 spaces! */ #ifndef BASIC_WEB_SERVER_H #define BASIC_WEB_SERVER_H /* The function that implements the WEB server task. */ void vBasicWEBServer( void *pvParameters ); /* Initialisation required by lwIP. */ void vlwIPInit( void ); #endif
/*! \file 3D border extraction. Extract 3D border voxels from a binary raster image. A border voxel is a foreground voxel that is 6-connected to a background voxel. \par Author: Gabriele Lohmann, MPI-CBS */ /* From the Vista library: */ #include <viaio/Vlib.h> #include <viaio/VImage.h> #include <stdio.h> #include <math.h> /*! \fn VImage VBorderImage3d (VImage src,VImage dest) \param src input image (bit repn) \param dest output image (bit repn) */ VImage VBorderImage3d (VImage src,VImage dest) { int nbands,nrows,ncols,b,r,c; if (VPixelRepn(src) != VBitRepn) VError("VBorderImage3d: input pixel repn must be bit"); nbands = VImageNBands (src); nrows = VImageNRows (src); ncols = VImageNColumns (src); dest = VSelectDestImage("VBorderImage3d",dest,nbands,nrows,ncols,VBitRepn); if (! dest) VError(" err creating dest image"); VFillImage(dest,VAllBands,0); for (b=1; b<nbands-1; b++) { for (r=1; r<nrows-1; r++) { for (c=1; c<ncols-1; c++) { if (VPixel(src,b,r,c,VBit) == 0) continue; if (VPixel(src,b-1,r,c,VBit) == 0) { VPixel(dest,b,r,c,VBit) = 1; continue; } if (VPixel(src,b,r-1,c,VBit) == 0) { VPixel(dest,b,r,c,VBit) = 1; continue; } if (VPixel(src,b,r,c-1,VBit) == 0) { VPixel(dest,b,r,c,VBit) = 1; continue; } if (VPixel(src,b+1,r,c,VBit) == 0) { VPixel(dest,b,r,c,VBit) = 1; continue; } if (VPixel(src,b,r+1,c,VBit) == 0) { VPixel(dest,b,r,c,VBit) = 1; continue; } if (VPixel(src,b,r,c+1,VBit) == 0) { VPixel(dest,b,r,c,VBit) = 1; continue; } } } } VCopyImageAttrs (src, dest); return dest; }
// // CoreActionSheetPicker.h // CoreActionSheetPicker // // Created by Petr Korolev on 17/04/15. // Copyright (c) 2015 Petr Korolev. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for CoreActionSheetPicker. FOUNDATION_EXPORT double CoreActionSheetPickerVersionNumber; //! Project version string for CoreActionSheetPicker. FOUNDATION_EXPORT const unsigned char CoreActionSheetPickerVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <CoreActionSheetPicker/PublicHeader.h> #import <CoreActionSheetPicker/AbstractActionSheetPicker.h> #import <CoreActionSheetPicker/ActionSheetCustomPicker.h> #import <CoreActionSheetPicker/ActionSheetDatePicker.h> #import <CoreActionSheetPicker/ActionSheetDistancePicker.h> #import <CoreActionSheetPicker/ActionSheetLocalePicker.h> #import <CoreActionSheetPicker/ActionSheetStringPicker.h> #import <CoreActionSheetPicker/DistancePickerView.h> #import <CoreActionSheetPicker/ActionSheetPicker.h>
/******************************************************************************** * * weyl.h, weyl.cpp * * These files are for generating the weyl tableaux systematically. * * JDWhitfield * Dartmouth 2017 * ********************************************************************************/ //start of header guard #ifndef WEYL #define WEYL #include<libint2.hpp> int nchoosek(int , int); int num_weyl(int M, int N, int ms); int get_next_tableau(const int M, const std::vector<int> frame, std::vector<int>& tableau); int get_init_tableau(const int M, const std::vector<int> frame, std::vector<int>&tableau); int tableau_pos(int row, int col, std::vector<int> frame_rows); bool row_col_to_pos(int& pos, const std::vector<int> frame, const int row, const int col); void pos_to_row_col(const int pos,const std::vector<int> frame, int& row, int& col); void print_tableau(const std::vector<int> tableau, const std::vector<int> frame); int tableau_pos(int row, int col, std::vector<int> frame_rows); // /// fac[k] = k! static constexpr std::array<int64_t,21> fac = {{1L, 1L, 2L, 6L, 24L, 120L, 720L, 5040L, 40320L, 362880L, 3628800L, 39916800L, 479001600L, 6227020800L, 87178291200L, 1307674368000L, 20922789888000L, 355687428096000L, 6402373705728000L, 121645100408832000L, 2432902008176640000L}}; #endif
#ifndef EPERF_SQLITE_H #define EPERF_SQLITE_H #include <sqlite3.h> #include <string> #include <vector> #include <stdexcept> #include <iostream> #include <sstream> #include <inttypes.h> namespace ENHANCE { class IEPerfSQLite { public: virtual std::vector<std::string> createSQLInsertObj() const = 0; virtual ~IEPerfSQLite() { } }; class EPerfSQLite { private: std::string db_file; sqlite3 *db; void initializeDBIfNeeded() { sqlite3_stmt *stmt; std::string sql = "SELECT COUNT(*) FROM devices"; int ret = sqlite3_prepare_v2(db, sql.c_str(), sql.size(), &stmt, NULL); if (ret != SQLITE_OK) { // DB seems to be empty, so initialize it sql = "CREATE TABLE devices ( \ id INTEGER PRIMARY KEY, \ name VARCHAR(255) \ )"; executeInsertQuery(sql); sql = "CREATE TABLE subdevices ( \ id_left INTEGER, \ id_right INTEGER, \ PRIMARY KEY(id_left, id_right) \ )"; executeInsertQuery(sql); sql = "CREATE TABLE kernels ( \ id INTEGER PRIMARY KEY, \ name VARCHAR(255) \ )"; executeInsertQuery(sql); sql = "CREATE TABLE experiments ( \ id INTEGER PRIMARY KEY, \ date INTEGER, \ name VARCHAR(255), \ start_s INTEGER, \ start_ns INTEGER \ )"; executeInsertQuery(sql); /* sql = "CREATE TABLE kernelHasConfigurations ( \ id_kernel INTEGER, \ hash VARCHAR(64), \ PRIMARY KEY(id_kernel, hash) \ )"; executeInsertQuery(sql); */ /* sql = "CREATE TABLE kernelConfigurations ( \ hash VARCHAR(64), \ key VARCHAR(255), \ value VARCHAR(255), \ PRIMARY KEY(hash, key, value) \ )"; executeInsertQuery(sql); */ sql = "CREATE TABLE data ( \ id_kernel INTEGER, \ id_device INTEGER, \ ts_start INTEGER, \ ts_stop INTEGER, \ cpuclock_start INTEGER, \ cpuclock_stop INTEGER, \ tid INTEGER, \ data_in INTEGER, \ data_out INTEGER, \ id_experiment INTEGER, \ PRIMARY KEY( \ id_kernel, id_device, tid, ts_start \ ) \ )"; executeInsertQuery(sql); } } protected: public: EPerfSQLite(std::string _db_file = "") : db_file(_db_file) { if (_db_file == "") { db_file = std::string("eperf.db"); } int ret = sqlite3_open(db_file.c_str(), &db); if (ret != SQLITE_OK) { std::stringstream err; err << "Could not open SQLite DB. Reason: " << sqlite3_errmsg(db); err << " Path was: " << db_file; throw std::runtime_error(err.str()); } initializeDBIfNeeded(); } virtual ~EPerfSQLite() { sqlite3_close(db); } uint64_t getLastExperimentID() const; void executeInsertQuery(const std::string &q) { // std::cout << q << "\n"; sqlite3_stmt *stmt; int ret = sqlite3_prepare_v2(db, q.c_str(), q.size(), &stmt, NULL); if (ret != SQLITE_OK) { std::stringstream err; err << "Could not SELECT from SQLite DB. Reason: " << sqlite3_errmsg(db); throw std::runtime_error(err.str()); } ret = sqlite3_step(stmt); if (ret != SQLITE_DONE) { std::stringstream err; err << "Could not execute: " << q << "\nError: " << sqlite3_errmsg(db); throw std::runtime_error(err.str()); } sqlite3_finalize(stmt); } void executeInsertQuery(const std::vector<std::string> &vq) { std::vector<std::string>::const_iterator it; for (it = vq.begin(); it != vq.end(); ++it) { executeInsertQuery(*it); } } void beginTransaction() { sqlite3_exec(db, "BEGIN", 0, 0, 0); } void endTransaction() { sqlite3_exec(db, "COMMIT", 0, 0, 0); } }; } #endif /* EPERF_SQLITE_H */
/* Physics Effects Copyright(C) 2010 Sony Computer Entertainment Inc. All rights reserved. Physics Effects is open software; you can redistribute it and/or modify it under the terms of the BSD License. Physics Effects 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 BSD License for more details. A copy of the BSD License is distributed with Physics Effects under the filename: physics_effects_license.txt */ #ifndef _SCE_PFX_CONTACT_BOX_CAPSULE_H #define _SCE_PFX_CONTACT_BOX_CAPSULE_H #include "../../../include/physics_effects/base_level/base/pfx_common.h" namespace sce { namespace PhysicsEffects { PfxFloat pfxContactBoxCapsule( PfxVector3 &normal,PfxPoint3 &pointA,PfxPoint3 &pointB, void *shapeA,const PfxTransform3 &transformA, void *shapeB,const PfxTransform3 &transformB, PfxFloat distanceThreshold = SCE_PFX_FLT_MAX); } //namespace PhysicsEffects } //namespace sce #endif // _SCE_PFX_CONTACT_BOX_CAPSULE_H
/* * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef SharedWorkerThread_h #define SharedWorkerThread_h #include "core/CoreExport.h" #include "core/frame/csp/ContentSecurityPolicy.h" #include "core/workers/WorkerThread.h" namespace blink { class WorkerThreadStartupData; class CORE_EXPORT SharedWorkerThread : public WorkerThread { public: static PassRefPtr<SharedWorkerThread> create(const String& name, PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPtr<WorkerThreadStartupData>); virtual ~SharedWorkerThread(); protected: PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override; WebThreadSupportingGC& backingThread() override; private: SharedWorkerThread(const String& name, PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPtr<WorkerThreadStartupData>); String m_name; OwnPtr<WebThreadSupportingGC> m_thread; }; } // namespace blink #endif // SharedWorkerThread_h
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_file_w32_spawnv_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: file Read input from a file * GoodSource: Fixed string * Sink: w32_spawnv * BadSink : execute command with spawnv * 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 #define FILENAME "C:\\temp\\file.txt" #else #define FILENAME "/tmp/file.txt" #endif #include <process.h> /* 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_file_w32_spawnv_04_bad() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; if(STATIC_CONST_TRUE) { { /* Read input from a file */ size_t dataLen = strlen(data); FILE * pFile; /* if there is room in data, attempt to read the input from a file */ if (100-dataLen > 1) { pFile = fopen(FILENAME, "r"); if (pFile != NULL) { /* POTENTIAL FLAW: Read data from a file */ if (fgets(data+dataLen, (int)(100-dataLen), pFile) == NULL) { printLine("fgets() failed"); /* Restore NUL terminator if fgets fails */ data[dataLen] = '\0'; } fclose(pFile); } } } } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL}; /* spawnv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _spawnv(_P_WAIT, COMMAND_INT_PATH, args); } } #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, "*.*"); } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL}; /* spawnv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _spawnv(_P_WAIT, COMMAND_INT_PATH, args); } } /* 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, "*.*"); } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL}; /* spawnv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _spawnv(_P_WAIT, COMMAND_INT_PATH, args); } } void CWE78_OS_Command_Injection__char_file_w32_spawnv_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_file_w32_spawnv_04_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__char_file_w32_spawnv_04_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#ifndef _sdl_ptrlist_h #define _sdl_ptrlist_h #include <SDL.h> struct PtrNode { PtrNode* previous; PtrNode* next; void* data; }; struct PtrList { int count; PtrNode* head; PtrNode* tail; void Init() { PtrNode* node = (PtrNode*)SDL_calloc(1, sizeof(PtrNode)); node->previous = NULL; node->next = NULL; head = node; tail = node; count = 0; } void Add(void* data) { PtrNode* node = (PtrNode*)SDL_calloc(1, sizeof(PtrNode)); node->data = data; node->previous = tail; node->next = NULL; tail->next = node; tail = node; count++; } PtrNode* Find(void* data) { PtrNode* node = head; while (node->data != data) { node = node->next; if (!node) return NULL; } return node; } void Delete(void* data) { PtrNode* node = Find(data); if (!node || node == head) return; PtrNode* next = node->next; PtrNode* previous = node->previous; if (next) next->next = previous; if (previous) previous->previous = next; if (head == node) head = next; if (tail == node) tail = previous; free(node); count--; } } PtrList_t; #endif // _sdl_ptrlist_h
/* * Copyright (c) 2017, SingularityWare, LLC. All rights reserved. * * Copyright (c) 2015-2017, Gregory M. Kurtzer. All rights reserved. * * Copyright (c) 2016-2017, The Regents of the University of California, * through Lawrence Berkeley National Laboratory (subject to receipt of any * required approvals from the U.S. Dept. of Energy). All rights reserved. * * This software is licensed under a customized 3-clause BSD license. Please * consult LICENSE file distributed with the sources of this project regarding * your rights to use or distribute this software. * * NOTICE. This Software was developed under funding from the U.S. Department of * Energy and the U.S. Government consequently retains certain rights. As such, * the U.S. Government has been granted for itself and others acting on its * behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software * to reproduce, distribute copies to the public, prepare derivative works, and * perform publicly and display publicly, and to permit other to do so. * */ #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <string.h> #include <sys/stat.h> #include <unistd.h> #include <stdlib.h> #include "util/file.h" #include "util/util.h" #include "util/message.h" #include "util/privilege.h" #include "./passwd/passwd.h" #include "./group/group.h" #include "./resolvconf/resolvconf.h" #include "./libs/libs.h" int _singularity_runtime_files(void) { int retval = 0; singularity_message(VERBOSE, "Running file components\n"); retval += _singularity_runtime_files_passwd(); retval += _singularity_runtime_files_group(); retval += _singularity_runtime_files_resolvconf(); retval += _singularity_runtime_files_libs(); return(retval); }
/*********************************************************************************************************************** ** ** Copyright (c) 2011, 2014 ETH Zurich ** 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 ETH Zurich 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. ** **********************************************************************************************************************/ #pragma once #include "../modelbase_api.h" #include "composite/CompositeNode.h" #include "Text.h" #include "nodeMacros.h" DECLARE_TYPED_LIST(MODELBASE_API, Model, UsedLibrary) namespace Model { class MODELBASE_API UsedLibrary : public Super<CompositeNode> { COMPOSITENODE_DECLARE_STANDARD_METHODS(UsedLibrary) ATTRIBUTE_VALUE_CUSTOM_RETURN(Text, name, setName, QString, const QString&) public: UsedLibrary(const QString& name); virtual QList<const UsedLibrary*> usedLibraries() const override; Node* libraryRoot() const; Model* libraryModel() const; void loadLibraryModel(PersistentStore* store) const; }; inline Node* UsedLibrary::libraryRoot() const { if (auto m = libraryModel()) return m->root(); else return nullptr;} } /* namespace Model */
/* 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 "blis.h" void bli_subd_check( obj_t* x, obj_t* y ) { err_t e_val; // Check object datatypes. e_val = bli_check_floating_object( x ); bli_check_error_code( e_val ); e_val = bli_check_floating_object( y ); bli_check_error_code( e_val ); // Check object dimensions. e_val = bli_check_matrix_object( x ); bli_check_error_code( e_val ); e_val = bli_check_matrix_object( y ); bli_check_error_code( e_val ); e_val = bli_check_conformal_dims( x, y ); bli_check_error_code( e_val ); }
/** ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** * Copyright 2013 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ #ifndef XENIA_CPU_PROCESSOR_H_ #define XENIA_CPU_PROCESSOR_H_ #include <alloy/runtime/register_access.h> #include <xenia/core.h> #include <xenia/debug/debug_target.h> #include <vector> XEDECLARECLASS2(alloy, runtime, Breakpoint); XEDECLARECLASS1(xe, Emulator); XEDECLARECLASS1(xe, ExportResolver); XEDECLARECLASS2(xe, cpu, XenonMemory); XEDECLARECLASS2(xe, cpu, XenonRuntime); XEDECLARECLASS2(xe, cpu, XenonThreadState); XEDECLARECLASS2(xe, cpu, XexModule); namespace xe { namespace cpu { using RegisterAccessCallbacks = alloy::runtime::RegisterAccessCallbacks; using RegisterHandlesCallback = alloy::runtime::RegisterHandlesCallback; using RegisterReadCallback = alloy::runtime::RegisterReadCallback; using RegisterWriteCallback = alloy::runtime::RegisterWriteCallback; class Processor : public debug::DebugTarget { public: Processor(Emulator* emulator); ~Processor(); ExportResolver* export_resolver() const { return export_resolver_; } XenonRuntime* runtime() const { return runtime_; } Memory* memory() const { return memory_; } int Setup(); void AddRegisterAccessCallbacks(RegisterAccessCallbacks callbacks); int Execute( XenonThreadState* thread_state, uint64_t address); uint64_t Execute( XenonThreadState* thread_state, uint64_t address, uint64_t arg0); uint64_t Execute( XenonThreadState* thread_state, uint64_t address, uint64_t arg0, uint64_t arg1); uint64_t ExecuteInterrupt( uint32_t cpu, uint64_t address, uint64_t arg0, uint64_t arg1); virtual void OnDebugClientConnected(uint32_t client_id); virtual void OnDebugClientDisconnected(uint32_t client_id); virtual json_t* OnDebugRequest( uint32_t client_id, const char* command, json_t* request, bool& succeeded); private: json_t* DumpModule(XexModule* module, bool& succeeded); json_t* DumpFunction(uint64_t address, bool& succeeded); json_t* DumpThreadState(XenonThreadState* thread_state); private: Emulator* emulator_; ExportResolver* export_resolver_; XenonRuntime* runtime_; Memory* memory_; xe_mutex_t* interrupt_thread_lock_; XenonThreadState* interrupt_thread_state_; uint64_t interrupt_thread_block_; class DebugClientState { public: DebugClientState(XenonRuntime* runtime); ~DebugClientState(); int AddBreakpoint(const char* breakpoint_id, alloy::runtime::Breakpoint* breakpoint); int RemoveBreakpoint(const char* breakpoint_id); int RemoveAllBreakpoints(); private: XenonRuntime* runtime_; xe_mutex_t* breakpoints_lock_; typedef std::unordered_map<std::string, alloy::runtime::Breakpoint*> BreakpointMap; BreakpointMap breakpoints_; }; xe_mutex_t* debug_client_states_lock_; typedef std::unordered_map<uint32_t, DebugClientState*> DebugClientStateMap; DebugClientStateMap debug_client_states_; }; } // namespace cpu } // namespace xe #endif // XENIA_CPU_PROCESSOR_H_
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import <UIKit/UIKit.h> #import <ABI39_0_0React/ABI39_0_0RCTView.h> @interface ABI39_0_0RCTScrollContentView : ABI39_0_0RCTView @end
/** * @file leafref.c * @author Radek Krejci <rkrejci@cesnet.cz> * @brief Built-in leafref type plugin. * * Copyright (c) 2019-2021 CESNET, z.s.p.o. * * This source code is licensed under BSD 3-Clause License (the "License"). * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://opensource.org/licenses/BSD-3-Clause */ #define _GNU_SOURCE /* strdup */ #include "plugins_types.h" #include <assert.h> #include <stdint.h> #include <stdlib.h> #include "libyang.h" /* additional internal headers for some useful simple macros */ #include "common.h" #include "compat.h" #include "plugins_internal.h" /* LY_TYPE_*_STR */ /** * @page howtoDataLYB LYB Binary Format * @subsection howtoDataLYBTypesLeafref leafref (built-in) * * | Size (B) | Mandatory | Type | Meaning | * | :------: | :-------: | :--: | :-----: | * | exact same format as the leafref target |||| */ API LY_ERR lyplg_type_store_leafref(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len, uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node, struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err) { LY_ERR ret = LY_SUCCESS; struct lysc_type_leafref *type_lr = (struct lysc_type_leafref *)type; assert(type_lr->realtype); /* store the value as the real type of the leafref target */ ret = type_lr->realtype->plugin->store(ctx, type_lr->realtype, value, value_len, options, format, prefix_data, hints, ctx_node, storage, unres, err); if (ret == LY_EINCOMPLETE) { /* it is irrelevant whether the target type needs some resolving */ ret = LY_SUCCESS; } LY_CHECK_RET(ret); if (type_lr->require_instance) { /* needs to be resolved */ return LY_EINCOMPLETE; } else { return LY_SUCCESS; } } API LY_ERR lyplg_type_validate_leafref(const struct ly_ctx *UNUSED(ctx), const struct lysc_type *type, const struct lyd_node *ctx_node, const struct lyd_node *tree, struct lyd_value *storage, struct ly_err_item **err) { LY_ERR ret; struct lysc_type_leafref *type_lr = (struct lysc_type_leafref *)type; char *errmsg = NULL, *path; *err = NULL; if (!type_lr->require_instance) { /* redundant to resolve */ return LY_SUCCESS; } /* check leafref target existence */ if (lyplg_type_resolve_leafref(type_lr, ctx_node, storage, tree, NULL, &errmsg)) { path = lyd_path(ctx_node, LYD_PATH_STD, NULL, 0); ret = ly_err_new(err, LY_EVALID, LYVE_DATA, path, strdup("instance-required"), "%s", errmsg); free(errmsg); return ret; } return LY_SUCCESS; } API LY_ERR lyplg_type_compare_leafref(const struct lyd_value *val1, const struct lyd_value *val2) { return val1->realtype->plugin->compare(val1, val2); } API const void * lyplg_type_print_leafref(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic, size_t *value_len) { return value->realtype->plugin->print(ctx, value, format, prefix_data, dynamic, value_len); } API LY_ERR lyplg_type_dup_leafref(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup) { return original->realtype->plugin->duplicate(ctx, original, dup); } API void lyplg_type_free_leafref(const struct ly_ctx *ctx, struct lyd_value *value) { value->realtype->plugin->free(ctx, value); } /** * @brief Plugin information for leafref type implementation. * * Note that external plugins are supposed to use: * * LYPLG_TYPES = { */ const struct lyplg_type_record plugins_leafref[] = { { .module = "", .revision = NULL, .name = LY_TYPE_LEAFREF_STR, .plugin.id = "libyang 2 - leafref, version 1", .plugin.store = lyplg_type_store_leafref, .plugin.validate = lyplg_type_validate_leafref, .plugin.compare = lyplg_type_compare_leafref, .plugin.sort = NULL, .plugin.print = lyplg_type_print_leafref, .plugin.duplicate = lyplg_type_dup_leafref, .plugin.free = lyplg_type_free_leafref, .plugin.lyb_data_len = -1, }, {0} };
// 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 THIRD_PARTY_BLINK_RENDERER_PLATFORM_AUDIO_SIMPLE_FFT_CONVOLVER_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_AUDIO_SIMPLE_FFT_CONVOLVER_H_ #include <memory> #include "base/macros.h" #include "third_party/blink/renderer/platform/audio/audio_array.h" #include "third_party/blink/renderer/platform/audio/fft_frame.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" namespace blink { // The SimpleFFTConvolver does an FFT convolution. It differs from // the FFTConvolver in that it restricts the maximum size of // |convolution_kernel| to |input_block_size|. This restriction allows it to do // an FFT on every Process call. Therefore, the processing delay of // the SimpleFFTConvolver is the same as that of the DirectConvolver and thus // smaller than that of the FFTConvolver. class PLATFORM_EXPORT SimpleFFTConvolver { USING_FAST_MALLOC(SimpleFFTConvolver); public: SimpleFFTConvolver( size_t input_block_size, const std::unique_ptr<AudioFloatArray>& convolution_kernel); void Process(const float* source_p, float* dest_p, uint32_t frames_to_process); void Reset(); size_t ConvolutionKernelSize() const { return convolution_kernel_size_; } private: size_t FftSize() const { return frame_.FftSize(); } size_t convolution_kernel_size_; FFTFrame fft_kernel_; FFTFrame frame_; // Buffer input until we get fftSize / 2 samples then do an FFT AudioFloatArray input_buffer_; // Stores output which we read a little at a time AudioFloatArray output_buffer_; // Saves the 2nd half of the FFT buffer, so we can do an overlap-add with the // 1st half of the next one AudioFloatArray last_overlap_buffer_; DISALLOW_COPY_AND_ASSIGN(SimpleFFTConvolver); }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_AUDIO_SIMPLE_FFT_CONVOLVER_H_
// This file is part of MANTIS OS, Operating System // See http://mantis.cs.colorado.edu/ // // Copyright (C) 2003,2004,2005 University of Colorado, Boulder // // This program is free software; you can redistribute it and/or // modify it under the terms of the mos license (see file LICENSE) #include <inttypes.h> #include "led.h" #include "com.h" #include "msched.h" #include "clock.h" #include "adc.h" #include "led.h" #include "printf.h" #include "sem.h" #include "dev.h" #include "uart.h" #include "mica2-sounder.h" mos_sem_t do_send; #define PACKET_COUNT 4 comBuf send_pkt[PACKET_COUNT]; uint8_t sending[PACKET_COUNT]; uint8_t read_sample; uint8_t skip1; #define SKIP 1 /* * 0 - 7400 * 1 - 7900 * 2 - 6000 * 3 - 5653 * 4 - 5242 * 5 - 4900 * * 10 - 3820 * * * 15 - 3090 */ /* No skip, tuning 4 - 8000 5 - 6600 6 - 4800 7 - 3100 */ void reading_init() { read_sample=0; int a; for(a=0;a<PACKET_COUNT;a++) { send_pkt[a].size=64; sending[a] = 0; } } uint8_t which_sending, which_reading; uint16_t i=0, count=0,sample; static uint16_t adc_val; //port definitions /** @brief Mic directional port. */ #define MIC_PORT_DIRE DDRC /** @brief Mic primary port. */ #define MIC_PORT PORTC /** @brief Mic pin mask port. */ #define MIC_PIN_MASK 0x08 //static mos_sem_t adc_sem; void adc_start_channel8(uint8_t ch) { // grab the conversion value // while (ADCSRA & (1 << ADSC)); MIC_PORT_DIRE |= MIC_PIN_MASK; MIC_PORT &= ~MIC_PIN_MASK; MIC_PORT |= MIC_PIN_MASK; mos_thread_sleep(5); // SFIOR |= (1 << ADHSM); ADMUX = ch /*| (1 << REFS0) | (1 << REFS1) */; //set the channel ADMUX |= (1 << ADLAR); // ADCSRA |= (1 << ADIF); //clear any old conversions... ADCSRA = (1 << ADSC) | (1 << ADFR) | (1 << ADEN) | ( 1 << ADIE) | 5; } #define adc_off() ADCSRA &= ~(1 << ADEN) uint8_t read_channel8() { //mos_sem_wait(&adc_sem); return adc_val; } SIGNAL(SIG_ADC) { /* if(++skip1>SKIP) { skip1=0;*/ if(sending[which_reading]==0) { adc_val = ADCH; // adc_val |= (ADCH << 8); send_pkt[which_reading].data[read_sample] = adc_val; read_sample++; if(read_sample>63) { mos_led_toggle(0); read_sample=0; which_reading=(which_reading+1)&(PACKET_COUNT - 1); mos_sem_post(&do_send); } } else mos_led_toggle(1); // } } void sense_thread() { //sleep to let the initialization on the reader finish mos_thread_sleep(1000); #if defined(ARCH_AVR) // dev_mode(DEV_MICA2_MIC, DEV_MODE_ON); adc_start_channel8(AVR_ADC_CH_2); #endif while(1) { #if defined(ARCH_AVR) mos_led_toggle(2); // send_pkt.data[count]=read_channel8(); /*#elif defined(PLATFORM_TELOSB) sample = adc_get_conversion16(4); // the other light chanel is sample >>=2; send_pkt.data[count]=sample;*/ #endif count++; if(count>63) { mos_led_toggle(0); count=0; //mos_sem_post(&do_send); } } } static void uart_set_baud(uint8_t uart_num, uint16_t baud_rate) { if(uart_num == UART0) { UBRR0H = (uint8_t)(baud_rate >> 8); UBRR0L = (uint8_t)(baud_rate); } else { UBRR1H = (uint8_t)(baud_rate >> 8); UBRR1L = (uint8_t)(baud_rate); } } void send_thread() { //sleep to let the initialization on the reader finish mos_thread_sleep(1000); reading_init(); #if defined(ARCH_AVR) // dev_mode(DEV_MICA2_MIC, DEV_MODE_ON); adc_start_channel8(AVR_ADC_CH_2); uint8_t a = 0; dev_write(DEV_MICA2_SOUNDER,&a,1); // mica2_souunder_on(); #endif uart_set_baud( UART0, B115200); printf("starting\n"); while(1) { mos_sem_wait(&do_send); which_sending=(which_sending+1)&(PACKET_COUNT - 1); sending[which_sending]=1; mos_led_toggle(2); #if defined(PLATFORM_TELOSB) com_send(IFACE_SERIAL2,&send_pkt[which_sending]); #else com_send(IFACE_SERIAL,&send_pkt[which_sending]); #endif sending[which_reading]=0; } } void start (void) { mos_led_toggle(0); adc_off(); // mos_sem_init(&adc_sem, 0); mos_sem_init(&do_send,0); // mos_thread_new (sense_thread, 128, PRIORITY_NORMAL); mos_thread_new (send_thread, 128, PRIORITY_NORMAL); }
// 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 CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGE_PROFILE_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGE_PROFILE_HANDLER_H_ #include <string> #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/ui/webui/options/options_ui.h" #include "components/prefs/pref_change_registrar.h" #include "components/sync_driver/sync_service_observer.h" namespace base { class StringValue; } namespace options { // Chrome personal stuff profiles manage overlay UI handler. class ManageProfileHandler : public OptionsPageUIHandler, public ProfileAttributesStorage::Observer, public sync_driver::SyncServiceObserver { public: ManageProfileHandler(); ~ManageProfileHandler() override; // OptionsPageUIHandler: void GetLocalizedValues(base::DictionaryValue* localized_strings) override; void InitializeHandler() override; void InitializePage() override; void Uninitialize() override; // WebUIMessageHandler: void RegisterMessages() override; // ProfileAttributesStorage::Observer: void OnProfileAdded(const base::FilePath& profile_path) override; void OnProfileWasRemoved(const base::FilePath& profile_path, const base::string16& profile_name) override; void OnProfileNameChanged(const base::FilePath& profile_path, const base::string16& old_profile_name) override; void OnProfileAvatarChanged(const base::FilePath& profile_path) override; // sync_driver::SyncServiceObserver: void OnStateChanged() override; private: // This function creates signed in user specific strings in loadTimeData. void GenerateSignedinUserSpecificStrings(base::DictionaryValue* dictionary); // Callback for the "requestDefaultProfileIcons" message. // Sends the array of default profile icon URLs and profile names to WebUI. // First item of |args| is the dialog mode, i.e. "create" or "manage". void RequestDefaultProfileIcons(const base::ListValue* args); // Callback for the "requestNewProfileDefaults" message. // Sends an object to WebUI of the form: // { "name": profileName, "iconURL": iconURL } void RequestNewProfileDefaults(const base::ListValue* args); // Send all profile icons and their default names to the overlay. // |mode| is the dialog mode, i.e. "create" or "manage". void SendProfileIconsAndNames(const base::StringValue& mode); // Sends an object to WebUI of the form: // profileNames = { // "Profile Name 1": true, // "Profile Name 2": true, // ... // }; // This is used to detect duplicate profile names. void SendExistingProfileNames(); // Show disconnect managed profile dialog after generating domain and user // specific strings. void ShowDisconnectManagedProfileDialog(const base::ListValue* args); // Callback for the "setProfileIconAndName" message. Sets the name and icon // of a given profile. // |args| is of the form: [ // /*string*/ profileFilePath, // /*string*/ newProfileIconURL // /*string*/ newProfileName, // ] void SetProfileIconAndName(const base::ListValue* args); // Callback for the 'profileIconSelectionChanged' message. Used to update the // name in the manager profile dialog based on the selected icon. void ProfileIconSelectionChanged(const base::ListValue* args); // Callback for the "requestHasProfileShortcuts" message, which is called // when editing an existing profile. Asks the profile shortcut manager whether // the profile has shortcuts and gets the result in |OnHasProfileShortcuts()|. // |args| is of the form: [ {string} profileFilePath ] void RequestHasProfileShortcuts(const base::ListValue* args); // Callback for the "RequestCreateProfileUpdate" message. // Sends the email address of the signed-in user, or an empty string if the // user is not signed in. Also sends information about whether supervised // users may be created. void RequestCreateProfileUpdate(const base::ListValue* args); // When the pref allowing supervised-user creation changes, sends the new // value to the UI. void OnCreateSupervisedUserPrefChange(); // Callback invoked from the profile manager indicating whether the profile // being edited has any desktop shortcuts. void OnHasProfileShortcuts(bool has_shortcuts); // Callback for the "addProfileShortcut" message, which is called when editing // an existing profile and the user clicks the "Add desktop shortcut" button. // Adds a desktop shortcut for the profile. void AddProfileShortcut(const base::ListValue* args); // Callback for the "removeProfileShortcut" message, which is called when // editing an existing profile and the user clicks the "Remove desktop // shortcut" button. Removes the desktop shortcut for the profile. void RemoveProfileShortcut(const base::ListValue* args); // Callback for the "refreshGaiaPicture" message, which is called when the // user is editing an existing profile. void RefreshGaiaPicture(const base::ListValue* args); // URL for the current profile's GAIA picture. std::string gaia_picture_url_; // Used to observe the preference that allows creating supervised users, which // can be changed by policy. PrefChangeRegistrar pref_change_registrar_; // For generating weak pointers to itself for callbacks. base::WeakPtrFactory<ManageProfileHandler> weak_factory_; DISALLOW_COPY_AND_ASSIGN(ManageProfileHandler); }; } // namespace options #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGE_PROFILE_HANDLER_H_
/* BSD 3-Clause License Copyright (c) 2020, The Regents of the University of Minnesota All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder 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 __IRSOLVER_IRSOLVER_ #define __IRSOLVER_IRSOLVER_ #include "gmat.h" #include "odb/db.h" #include "utl/Logger.h" namespace psm { //! Class for IR solver /* * Builds the equations GV=J and uses SuperLU * to solve the matrix equations */ class IRSolver { public: //! Constructor for IRSolver class /* * This constructor creates an instance of the class using * the given inputs. */ IRSolver(odb::dbDatabase* t_db, sta::dbSta* t_sta, utl::Logger* t_logger, std::string vsrc_loc, std::string power_net, std::string out_file, std::string em_out_file, std::string spice_out_file, int em_analyze, int bump_pitch_x, int bump_pitch_y, std::map<std::string, float> net_voltage_map) { m_db = t_db; m_sta = t_sta; m_logger = t_logger; m_vsrc_file = vsrc_loc; m_power_net = power_net; m_out_file = out_file; m_em_out_file = em_out_file; m_em_flag = em_analyze; m_spice_out_file = spice_out_file; m_bump_pitch_x = bump_pitch_x; m_bump_pitch_y = bump_pitch_y; m_net_voltage_map = net_voltage_map; } //! IRSolver destructor ~IRSolver() { delete m_Gmat; } //! Worst case voltage at the lowest layer nodes double wc_voltage; //! Worst case current at the lowest layer nodes double max_cur; //! Average current at the lowest layer nodes double avg_cur; //! number of resistances int num_res; //! Average voltage at lowest layer nodes double avg_voltage; //! Vector of worstcase voltages in the lowest layers std::vector<double> wc_volt_layer; //! Returns the created G matrix for the design GMat* GetGMat(); //! Returns current map represented as a 1D vector std::vector<double> GetJ(); //! Function to solve for IR drop void SolveIR(); //! Function to get the power value from OpenSTA std::vector<std::pair<std::string, double>> GetPower(); std::pair<double, double> GetSupplyVoltage(); bool CheckConnectivity(); bool CheckValidR(double R); int GetConnectionTest(); bool GetResult(); int GetMinimumResolution(); int PrintSpice(); bool Build(); bool BuildConnection(); float supply_voltage_src; private: //! Pointer to the Db odb::dbDatabase* m_db; //! Pointer to STA sta::dbSta* m_sta; //! Pointer to Logger utl::Logger* m_logger; //! Voltage source file std::string m_vsrc_file; std::string m_power_net; //! Resistance configuration file std::string m_out_file; std::string m_em_out_file; int m_em_flag; std::string m_spice_out_file; //! G matrix for voltage GMat* m_Gmat; //! Node density in the lower most layer to append the current sources int m_node_density{5400}; // TODO get from somewhere //! Routing Level of the top layer int m_top_layer{0}; int m_bump_pitch_x{0}; int m_bump_pitch_y{0}; int m_bump_pitch_default{140}; int m_bump_size{10}; int m_bottom_layer{10}; bool m_result{false}; bool m_connection{false}; //! Direction of the top layer odb::dbTechLayerDir::Value m_top_layer_dir; odb::dbTechLayerDir::Value m_bottom_layer_dir; odb::dbSigType m_power_net_type; std::map<std::string, float> m_net_voltage_map; //! Current vector 1D std::vector<double> m_J; //! C4 bump locations and values std::vector<std::tuple<int, int, int, double>> m_C4Bumps; //! Per unit R and via R for each routing layer std::vector<std::tuple<int, double, double>> m_layer_res; //! Locations of the C4 bumps in the G matrix std::map<NodeIdx, double> m_C4Nodes; //! Function to add C4 bumps to the G matrix bool AddC4Bump(); //! Function that parses the Vsrc file void ReadC4Data(); // void ReadResData(); //! Function to create a J vector from the current map bool CreateJ(); //! Function to create a G matrix using the nodes bool CreateGmat(bool connection_only = false); }; } // namespace psm #endif
/* * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef WebKitTransitionEvent_h #define WebKitTransitionEvent_h #include "Event.h" namespace WebCore { struct WebKitTransitionEventInit : public EventInit { WebKitTransitionEventInit(); String propertyName; double elapsedTime; String pseudoElement; }; class WebKitTransitionEvent : public Event { public: static PassRefPtr<WebKitTransitionEvent> create() { return adoptRef(new WebKitTransitionEvent); } static PassRefPtr<WebKitTransitionEvent> create(const AtomicString& type, const String& propertyName, double elapsedTime, const String& pseudoElement) { return adoptRef(new WebKitTransitionEvent(type, propertyName, elapsedTime, pseudoElement)); } static PassRefPtr<WebKitTransitionEvent> create(const AtomicString& type, const WebKitTransitionEventInit& initializer) { return adoptRef(new WebKitTransitionEvent(type, initializer)); } virtual ~WebKitTransitionEvent(); const String& propertyName() const; double elapsedTime() const; const String& pseudoElement() const; virtual EventInterface eventInterface() const; private: WebKitTransitionEvent(); WebKitTransitionEvent(const AtomicString& type, const String& propertyName, double elapsedTime, const String& pseudoElement); WebKitTransitionEvent(const AtomicString& type, const WebKitTransitionEventInit& initializer); String m_propertyName; double m_elapsedTime; String m_pseudoElement; }; } // namespace WebCore #endif // WebKitTransitionEvent_h
/** * Copyright (c) 2014, 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. */ #pragma once /** * Operation and ReplyType Specializations for McRequest/McReply. */ #include <type_traits> #include "mcrouter/lib/mc/msg.h" #include "mcrouter/lib/Operation.h" namespace facebook { namespace memcache { /** * For existing memcache operations, we use a template trick: * Each operation is McOperation<N> where N is one of the mc_op_* constants. */ template <int op> struct McOperation { static const mc_op_t mc_op = (mc_op_t)op; }; struct McRequest; template <typename Ctx> struct McRequestWithContext; /** * For now, any Operation + McRequest = McReply */ template <typename Operation> struct ReplyType<Operation, McRequest> { typedef class McReply type; }; /** * We explicitly leave it to the user to define a reply type */ template <typename Operation, typename Ctx> struct ReplyType<Operation, McRequestWithContext<Ctx>> { }; }}
/* * FreeRTOS Kernel V10.1.1 * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ typedef void TCB_t; extern volatile TCB_t * volatile pxCurrentTCB; extern void vTaskSwitchContext( void ); /* * Saves the stack pointer for one task into its TCB, calls * vTaskSwitchContext() to update the TCB being used, then restores the stack * from the new TCB read to run the task. */ void portSWITCH_CONTEXT( void ); /* * Load the stack pointer from the TCB of the task which is going to be first * to execute. Then force an IRET so the registers and IP are popped off the * stack. */ void portFIRST_CONTEXT( void ); /* There are slightly different versions depending on whether you are building to include debugger information. If debugger information is used then there are a couple of extra bytes left of the ISR stack (presumably for use by the debugger). The true stack pointer is then stored in the bp register. We add 2 to the stack pointer to remove the extra bytes before we restore our context. */ #ifdef DEBUG_BUILD #pragma aux portSWITCH_CONTEXT = "mov ax, seg pxCurrentTCB" \ "mov ds, ax" \ "les bx, pxCurrentTCB" /* Save the stack pointer into the TCB. */ \ "mov es:0x2[ bx ], ss" \ "mov es:[ bx ], sp" \ "call vTaskSwitchContext" /* Perform the switch. */ \ "mov ax, seg pxCurrentTCB" /* Restore the stack pointer from the TCB. */ \ "mov ds, ax" \ "les bx, dword ptr pxCurrentTCB" \ "mov ss, es:[ bx + 2 ]" \ "mov sp, es:[ bx ]" \ "mov bp, sp" /* Prepair the bp register for the restoration of the SP in the compiler generated portion of the ISR */ \ "add bp, 0x0002" #pragma aux portFIRST_CONTEXT = "mov ax, seg pxCurrentTCB" \ "mov ds, ax" \ "les bx, dword ptr pxCurrentTCB" \ "mov ss, es:[ bx + 2 ]" \ "mov sp, es:[ bx ]" \ "add sp, 0x0002" /* Remove the extra bytes that exist in debug builds before restoring the context. */ \ "pop ax" \ "pop ax" \ "pop es" \ "pop ds" \ "popa" \ "iret" #else #pragma aux portSWITCH_CONTEXT = "mov ax, seg pxCurrentTCB" \ "mov ds, ax" \ "les bx, pxCurrentTCB" /* Save the stack pointer into the TCB. */ \ "mov es:0x2[ bx ], ss" \ "mov es:[ bx ], sp" \ "call vTaskSwitchContext" /* Perform the switch. */ \ "mov ax, seg pxCurrentTCB" /* Restore the stack pointer from the TCB. */ \ "mov ds, ax" \ "les bx, dword ptr pxCurrentTCB" \ "mov ss, es:[ bx + 2 ]" \ "mov sp, es:[ bx ]" #pragma aux portFIRST_CONTEXT = "mov ax, seg pxCurrentTCB" \ "mov ds, ax" \ "les bx, dword ptr pxCurrentTCB" \ "mov ss, es:[ bx + 2 ]" \ "mov sp, es:[ bx ]" \ "pop ax" \ "pop ax" \ "pop es" \ "pop ds" \ "popa" \ "iret" #endif
/* $NetBSD: openpicreg.h,v 1.3 2001/08/30 03:08:52 briggs Exp $ */ /*- * Copyright (c) 2000 Tsubai Masanari. 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * 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. */ /* * GLOBAL/TIMER register (IDU base + 0x1000) */ /* feature reporting reg 0 */ #define OPENPIC_FEATURE 0x1000 /* global config reg 0 */ #define OPENPIC_CONFIG 0x1020 #define OPENPIC_CONFIG_RESET 0x80000000 #define OPENPIC_CONFIG_8259_PASSTHRU_DISABLE 0x20000000 /* interrupt configuration mode (direct or serial) */ #define OPENPIC_ICR 0x1030 #define OPENPIC_ICR_SERIAL_MODE (1 << 27) #define OPENPIC_ICR_SERIAL_RATIO_MASK (0x7 << 28) #define OPENPIC_ICR_SERIAL_RATIO_SHIFT 28 /* vendor ID */ #define OPENPIC_VENDOR_ID 0x1080 /* processor initialization reg */ #define OPENPIC_PROC_INIT 0x1090 /* IPI vector/priority reg */ #define OPENPIC_IPI_VECTOR(ipi) (0x10a0 + (ipi) * 0x10) /* spurious intr. vector */ #define OPENPIC_SPURIOUS_VECTOR 0x10e0 /* * INTERRUPT SOURCE register (IDU base + 0x10000) */ /* interrupt vector/priority reg */ #ifndef OPENPIC_SRC_VECTOR #define OPENPIC_SRC_VECTOR(irq) (0x10000 + (irq) * 0x20) #endif #define OPENPIC_SENSE_LEVEL 0x00400000 #define OPENPIC_SENSE_EDGE 0x00000000 #define OPENPIC_POLARITY_POSITIVE 0x00800000 #define OPENPIC_POLARITY_NEGATIVE 0x00000000 #define OPENPIC_IMASK 0x80000000 #define OPENPIC_ACTIVITY 0x40000000 #define OPENPIC_PRIORITY_MASK 0x000f0000 #define OPENPIC_PRIORITY_SHIFT 16 #define OPENPIC_VECTOR_MASK 0x000000ff /* interrupt destination cpu */ #ifndef OPENPIC_IDEST #define OPENPIC_IDEST(irq) (0x10010 + (irq) * 0x20) #endif /* * PROCESSOR register (IDU base + 0x20000) */ /* IPI command reg */ #define OPENPIC_IPI(cpu, ipi) (0x20040 + (cpu) * 0x1000 + (ipi)) /* current task priority reg */ #define OPENPIC_CPU_PRIORITY(cpu) (0x20080 + (cpu) * 0x1000) #define OPENPIC_CPU_PRIORITY_MASK 0x0000000f /* interrupt acknowledge reg */ #define OPENPIC_IACK(cpu) (0x200a0 + (cpu) * 0x1000) /* end of interrupt reg */ #define OPENPIC_EOI(cpu) (0x200b0 + (cpu) * 0x1000)
#ifndef NOTIFICATION_H #define NOTIFICATION_H /// COMPONENT #include <csapex/utility/uuid.h> #include <csapex/model/error_state.h> #include <csapex/serialization/serializable.h> /// SYSTEM #include <sstream> namespace csapex { class Notification : public Serializable { protected: CLONABLE_IMPLEMENTATION(Notification); public: AUUID auuid; std::stringstream message; ErrorState::ErrorLevel error; Notification() = default; Notification(const Notification& copy); void operator=(const Notification& copy); Notification(const std::string& message); Notification(AUUID uuid, const std::string& message); Notification(AUUID uuid, const std::string& message, ErrorState::ErrorLevel error); template <typename T> Notification& operator<<(const T& val) { message << val; msg_dirty_ = true; return *this; } bool operator==(const Notification& other) const; std::string getMessage() const; void serialize(SerializationBuffer& data, SemanticVersion& version) const override; void deserialize(const SerializationBuffer& data, const SemanticVersion& version) override; private: mutable bool msg_dirty_; mutable std::string msg_cache_; }; } // namespace csapex #endif // NOTIFICATION_H
#ifndef KLAMPT_SIMULATION_SETTINGS_H #define KLAMPT_SIMULATION_SETTINGS_H namespace Klampt { //Set these values to 0 to get all warnings const static double gTorqueLimitWarningThreshold = Inf; const static double gJointLimitWarningThreshold = Inf; //const static double gTorqueLimitWarningThreshold = 0; //const static double gJointLimitWarningThreshold = 0; //turn this to 0 to allow joints to go through their stops #define USE_JOINT_STOPS 1 //Change the default padding settings. //More settings can be found in the ODESimulatorSettings constructor in //ODESimulator.cpp const static double gDefaultRobotPadding = 0.0025; const static double gDefaultRigidObjectPadding = 0.0025; const static double gDefaultEnvPadding = 0.0; //Change the default collision testing settings. const static bool gBoundaryLayerCollisionsEnabled = true; const static bool gRigidObjectCollisionsEnabled = true; const static bool gRobotSelfCollisionsEnabled = false; const static bool gRobotRobotCollisionsEnabled = true; const static bool gAdaptiveTimeStepping = true; } //namespace Klampt #endif
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ #include <stddef.h> #include <stdint.h> #include <map> #include <string> #include <vector> #include "base/time/time.h" #include "chrome/browser/ui/input_method/input_method_engine_base.h" #include "ui/base/ime/chromeos/input_method_descriptor.h" #include "ui/base/ime/chromeos/input_method_manager.h" #include "ui/base/ime/ime_engine_handler_interface.h" #include "url/gurl.h" class Profile; namespace ui { class CandidateWindow; struct CompositionText; class IMEEngineHandlerInterface; class KeyEvent; namespace ime { struct InputMethodMenuItem; } // namespace ime } // namespace ui namespace input_method { class InputMethodEngineBase; } namespace chromeos { class InputMethodEngine : public ::input_method::InputMethodEngineBase { public: enum { MENU_ITEM_MODIFIED_LABEL = 0x0001, MENU_ITEM_MODIFIED_STYLE = 0x0002, MENU_ITEM_MODIFIED_VISIBLE = 0x0004, MENU_ITEM_MODIFIED_ENABLED = 0x0008, MENU_ITEM_MODIFIED_CHECKED = 0x0010, MENU_ITEM_MODIFIED_ICON = 0x0020, }; enum CandidateWindowPosition { WINDOW_POS_CURSOR, WINDOW_POS_COMPOSITTION, }; struct UsageEntry { std::string title; std::string body; }; struct Candidate { Candidate(); virtual ~Candidate(); std::string value; int id; std::string label; std::string annotation; UsageEntry usage; std::vector<Candidate> candidates; }; struct CandidateWindowProperty { CandidateWindowProperty(); virtual ~CandidateWindowProperty(); int page_size; bool is_cursor_visible; bool is_vertical; bool show_window_at_composition; // Auxiliary text is typically displayed in the footer of the candidate // window. std::string auxiliary_text; bool is_auxiliary_text_visible; }; InputMethodEngine(); ~InputMethodEngine() override; // IMEEngineHandlerInterface overrides. bool SendKeyEvents(int context_id, const std::vector<KeyboardEvent>& events) override; bool SetCandidateWindowVisible(bool visible, std::string* error) override; bool SetCursorPosition(int context_id, int candidate_id, std::string* error) override; bool IsActive() const override; void Enable(const std::string& component_id) override; void PropertyActivate(const std::string& property_name) override; void CandidateClicked(uint32_t index) override; void HideInputView() override; // This function returns the current property of the candidate window. // The caller can use the returned value as the default property and // modify some of specified items. const CandidateWindowProperty& GetCandidateWindowProperty() const; // Change the property of the candidate window and repaint the candidate // window widget. void SetCandidateWindowProperty(const CandidateWindowProperty& property); // Set the list of entries displayed in the candidate window. bool SetCandidates(int context_id, const std::vector<Candidate>& candidates, std::string* error); // Set the list of items that appears in the language menu when this IME is // active. bool SetMenuItems( const std::vector<input_method::InputMethodManager::MenuItem>& items); // Update the state of the menu items. bool UpdateMenuItems( const std::vector<input_method::InputMethodManager::MenuItem>& items); private: // Converts MenuItem to InputMethodMenuItem. void MenuItemToProperty( const input_method::InputMethodManager::MenuItem& item, ui::ime::InputMethodMenuItem* property); // Enables overriding input view page to Virtual Keyboard window. void EnableInputView(); // input_method::InputMethodEngineBase: void UpdateComposition(const ui::CompositionText& composition_text, uint32_t cursor_pos, bool is_visible) override; void CommitTextToInputContext(int context_id, const std::string& text) override; // The current candidate window. scoped_ptr<ui::CandidateWindow> candidate_window_; // The current candidate window property. CandidateWindowProperty candidate_window_property_; // Indicates whether the candidate window is visible. bool window_visible_; // Mapping of candidate index to candidate id. std::vector<int> candidate_ids_; // Mapping of candidate id to index. std::map<int, int> candidate_indexes_; }; } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_
#ifndef SEMI_H #define SEMI_H #include "Connector.h" #include "Base.h" #include <string> using namespace std; class Cmd; class Semi : public Connector { public: Semi (); Semi (Cmd*); ~Semi (); bool execute (bool); string getExecutable () { return ""; }; }; #endif
/* $NetBSD: frodoreg.h,v 1.1 1997/05/12 08:03:49 thorpej Exp $ */ /* * Copyright (c) 1997 Michael Smith. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ /* Base address of the Frodo part */ #define FRODO_BASE (INTIOBASE + 0x1c000) /* * Where we find the 8250-like APCI ports, and how far apart they are. */ #define FRODO_APCIBASE 0x0 #define FRODO_APCISPACE 0x20 #define FRODO_APCI_OFFSET(x) (FRODO_APCIBASE + ((x) * FRODO_APCISPACE)) /* * Other items in the Frodo part */ /* An mc146818-like calendar, but no battery... lame */ #define FRODO_CALENDAR 0x80 #define FRODO_TIMER 0xa0 /* 8254-like timer */ #define FRODO_T1_CTR 0xa0 /* counter 1 */ #define FRODO_T2_CTR 0xa4 /* counter 2 */ #define FRODO_T3_CTR 0xa8 /* counter 3 */ #define FRODO_T_CTRL 0xac /* control register */ #define FRODO_T_PSCALE 0xb0 /* prescaler */ #define FRODO_T_PCOUNT 0xb4 /* precounter ? */ #define FRODO_T_OVCOUNT 0xb8 /* overflow counter (0, 1, 2) */ #define FRODO_PIO 0xc0 /* programmable i/o registers start here */ #define FRODO_IISR 0xc0 /* ISA Interrupt Status Register (also PIR) */ #define FRODO_IISR_SERVICE (1<<0) /* service switch "on" if 0 */ #define FRODO_IISR_ILOW (1<<1) /* IRQ 3,4,5 or 6 on ISA if 1 */ #define FRODO_IISR_IMID (1<<2) /* IRQ 7,9,10 or 11 on ISA if 1 */ #define FRODO_IISR_IHI (1<<3) /* IRQ 12,13,14 or 15 on ISA if 1 */ /* bits 4 and 5 are DN2500 SCSI interrupts */ /* bit 6 is unused */ #define FRODO_IISR_IOCHK (1<<7) /* ISA board asserted IOCHK if low */ #define FRODO_PIO_IPR 0xc4 /* input polarity register (ints 7->0) */ #define FRODO_PIO_IELR 0xc8 /* input edge/level register */ /* This is probably not used on the 4xx */ #define FRODO_DIAGCTL 0xd0 /* Diagnostic Control Register */ #define FRODO_PIC_MU 0xe0 /* upper Interrupt Mask register */ #define FRODO_PIC_ML 0xe4 /* lower Interrupt Mask register */ #define FRODO_PIC_PU 0xe8 /* upper Interrupt Pending register */ #define FRODO_PIC_PL 0xec /* lower Interrupt Pending register */ #define FRODO_PIC_IVR 0xf8 /* Interrupt Vector register */ #define FRODO_PIC_ACK 0xf8 /* Interrupt Acknowledge */ /* Shorthand for register access. */ #define FRODO_READ(sc, reg) ((sc)->sc_regs[(reg)]) #define FRODO_WRITE(sc, reg, val) (sc)->sc_regs[(reg)] = (val) /* manipulate interrupt registers */ #define FRODO_GETMASK(sc) \ ((FRODO_READ((sc), FRODO_PIC_MU) << 8) | \ FRODO_READ((sc), FRODO_PIC_ML)) #define FRODO_SETMASK(sc, val) do { \ FRODO_WRITE((sc), FRODO_PIC_MU, ((val) >> 8) & 0xff); \ FRODO_WRITE((sc), FRODO_PIC_ML, (val) & 0xff); } while (0) #define FRODO_GETPEND(sc) \ ((FRODO_READ((sc), FRODO_PIC_PU) << 8) | \ FRODO_READ((sc), FRODO_PIC_PL)) #define FRODO_IPEND(sc) \ (FRODO_READ((sc), FRODO_PIC_ACK) & 0x0f) /* * Interrupt lines. Use FRODO_INTR_BIT() below to get a bit * suitable for one of the interrupt mask registers. Yes, line * 0 is unused. */ #define FRODO_INTR_ILOW 1 #define FRODO_INTR_IMID 2 #define FRODO_INTR_IHI 3 #define FRODO_INTR_SCSIDMA 4 /* DN2500 only */ #define FRODO_INTR_SCSI 5 /* DN2500 only */ #define FRODO_INTR_HORIZ 6 #define FRODO_INTR_IOCHK 7 #define FRODO_INTR_CALENDAR 8 #define FRODO_INTR_TIMER0 9 #define FRODO_INTR_TIMER1 10 #define FRODO_INTR_TIMER2 11 #define FRODO_INTR_APCI0 12 #define FRODO_INTR_APCI1 13 #define FRODO_INTR_APCI2 14 #define FRODO_INTR_APCI3 15 #define FRODO_NINTR 16 #define FRODO_INTR_BIT(line) (1 << (line))
/* * Copyright (c) 2017 Immo Software * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * o 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. * * o Neither the name of the copyright holder 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. */ #if !defined(_BUTTON_H_) #define _BUTTON_H_ #include "argon/argon.h" #include "ui_events.h" //------------------------------------------------------------------------------ // Definitions //------------------------------------------------------------------------------ namespace slab { /*! * @brief */ class Button { public: Button(PORT_Type * port, GPIO_Type * gpio, uint32_t pin, UIEventSource source, bool isInverted); ~Button()=default; void init(); //! @brief Returns true if the button is pressed. bool read(); protected: UIEventSource _source; PORT_Type * _port; GPIO_Type * _gpio; uint32_t _pin; bool _isInverted; bool _state; Ar::TimerWithMemberCallback<Button> _timer; uint32_t _timeoutCount; void handle_irq(); void handle_timer(Ar::Timer * timer); static void irq_handler_stub(PORT_Type * port, uint32_t pin, void * userData); }; } // namespace slab #endif // _BUTTON_H_ //------------------------------------------------------------------------------ // EOF //------------------------------------------------------------------------------
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_ncpy_42.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE806.label.xml Template File: sources-sink-42.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sink: ncpy * BadSink : Copy data to string using strncpy * Flow Variant: 42 Data flow: data returned from one function to another in the same source file * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD static char * badSource(char * data) { /* FLAW: Initialize data as a large buffer that is larger than the small buffer used in the sink */ memset(data, 'A', 100-1); /* fill with 'A's */ data[100-1] = '\0'; /* null terminate */ return data; } void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_ncpy_42_bad() { char * data; data = (char *)malloc(100*sizeof(char)); if (data == NULL) {exit(-1);} data = badSource(data); { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ strncpy(dest, data, strlen(data)); dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); free(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD static char * goodG2BSource(char * data) { /* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */ memset(data, 'A', 50-1); /* fill with 'A's */ data[50-1] = '\0'; /* null terminate */ return data; } /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { char * data; data = (char *)malloc(100*sizeof(char)); if (data == NULL) {exit(-1);} data = goodG2BSource(data); { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ strncpy(dest, data, strlen(data)); dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); free(data); } } void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_ncpy_42_good() { goodG2B(); } #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()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_ncpy_42_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_ncpy_42_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#include <ncurses.h> main() { int c,i; initscr(); cbreak(); noecho(); #if 1 wtimeout(stdscr,1000); #endif scrollok(stdscr,TRUE); for (c='A';c<='Z';c++) for (i=0;i<25;i++) { move(i,i); addch(c); refresh(); } move (0,0); while ((c=wgetch(stdscr))!='A') { if (c == EOF) printw(">>wait for keypress<<"); else printw(">>%c<<\n",c); refresh(); } endwin(); }
/* * 2007 – 2013 Copyright Northwestern University * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/annotation-and-image-markup/LICENSE.txt for details. */ #ifndef _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CQSI_TS_DateTime #define _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CQSI_TS_DateTime #include "type_iso.CQSET_TS_DateTime.h" namespace AIMXML { namespace iso { class CQSI_TS_DateTime : public ::AIMXML::iso::CQSET_TS_DateTime { public: AIMXML_EXPORT CQSI_TS_DateTime(xercesc::DOMNode* const& init); AIMXML_EXPORT CQSI_TS_DateTime(CQSI_TS_DateTime const& init); void operator=(CQSI_TS_DateTime const& other) { m_node = other.m_node; } static altova::meta::ComplexType StaticInfo() { return altova::meta::ComplexType(types + _altova_ti_iso_altova_CQSI_TS_DateTime); } MemberElement<iso::CQSET_TS_DateTime, _altova_mi_iso_altova_CQSI_TS_DateTime_altova_term> term; struct term { typedef Iterator<iso::CQSET_TS_DateTime> iterator; }; AIMXML_EXPORT void SetXsiType(); }; } // namespace iso } // namespace AIMXML #endif // _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CQSI_TS_DateTime
// 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_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_IN_MEMORY_DOWNLOAD_DRIVER_H_ #define COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_IN_MEMORY_DOWNLOAD_DRIVER_H_ #include "components/download/internal/background_service/download_driver.h" #include <map> #include <memory> #include "base/task/single_thread_task_runner.h" #include "components/download/internal/background_service/in_memory_download.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" namespace download { class InMemoryDownload; // Factory to create in memory download object. class InMemoryDownloadFactory : public InMemoryDownload::Factory { public: InMemoryDownloadFactory( network::mojom::URLLoaderFactory* url_loader_factory, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); InMemoryDownloadFactory(const InMemoryDownloadFactory&) = delete; InMemoryDownloadFactory& operator=(const InMemoryDownloadFactory&) = delete; ~InMemoryDownloadFactory() override; private: // InMemoryDownload::Factory implementation. std::unique_ptr<InMemoryDownload> Create( const std::string& guid, const RequestParams& request_params, scoped_refptr<network::ResourceRequestBody> request_body, const net::NetworkTrafficAnnotationTag& traffic_annotation, InMemoryDownload::Delegate* delegate) override; network::mojom::URLLoaderFactory* url_loader_factory_; scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; }; // Download backend that owns the list of in memory downloads and propagate // notification to its client. class InMemoryDownloadDriver : public DownloadDriver, public InMemoryDownload::Delegate { public: InMemoryDownloadDriver( std::unique_ptr<InMemoryDownload::Factory> download_factory, BlobContextGetterFactoryPtr blob_context_getter_factory); InMemoryDownloadDriver(const InMemoryDownloadDriver&) = delete; InMemoryDownloadDriver& operator=(const InMemoryDownloadDriver&) = delete; ~InMemoryDownloadDriver() override; private: // DownloadDriver implementation. void Initialize(DownloadDriver::Client* client) override; void HardRecover() override; bool IsReady() const override; void Start( const RequestParams& request_params, const std::string& guid, const base::FilePath& file_path, scoped_refptr<network::ResourceRequestBody> post_body, const net::NetworkTrafficAnnotationTag& traffic_annotation) override; void Remove(const std::string& guid, bool remove_file) override; void Pause(const std::string& guid) override; void Resume(const std::string& guid) override; absl::optional<DriverEntry> Find(const std::string& guid) override; std::set<std::string> GetActiveDownloads() override; size_t EstimateMemoryUsage() const override; // InMemoryDownload::Delegate implementation. void OnDownloadStarted(InMemoryDownload* download) override; void OnDownloadProgress(InMemoryDownload* download) override; void OnDownloadComplete(InMemoryDownload* download) override; void OnUploadProgress(InMemoryDownload* download) override; void RetrieveBlobContextGetter(BlobContextGetterCallback callback) override; // The client that receives updates from low level download logic. DownloadDriver::Client* client_; // The factory used to create in memory download objects. std::unique_ptr<InMemoryDownload::Factory> download_factory_; // Used to retrieve BlobStorageContextGetter. BlobContextGetterFactoryPtr blob_context_getter_factory_; // A map of GUID and in memory download, which holds download data. std::map<std::string, std::unique_ptr<InMemoryDownload>> downloads_; }; } // namespace download #endif // COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_IN_MEMORY_DOWNLOAD_DRIVER_H_
#if !defined(CURVE_H) #define CURVE_H #include "OpenGLinc.h" #include <vector> #define vector std::vector #include <math.h> #include "Point.h" #include "Transform.h" typedef vector <Point> point_t; class Curve { protected: point_t::iterator activePoint; bool isactive; public: point_t points; Point lastActive; Curve(); Curve( vector <Point> pts ); virtual ~Curve(); void EditHandle(); void addPoint(Point a); void deleteActivePoint(); void moveActivePoint(float dx, float dy, float dz); void moveActivePointTo(Point a); void updateActivePoint(float x, float y, float z); static void printCurve(point_t p); void printPoints(); void printCurve(); void axis(); point_t Bezier(int levelOfDetail); point_t Bspline(int levelOfDetail); point_t Bezier2(int levelOfDetail); void noInterpolation(); point_t translate(float x, float y, float z); point_t rotate(float degrees,float x, float y, float z); point_t rt(float theta, float x, float y, float z, float tx, float ty, float tz, float cenX, float cenY, float cenZ); void rtMod(float theta, float x, float y, float z, float tx, float ty, float tz, float cenX, float cenY, float cenZ); Curve * curveM(mat4 matM); }; #endif
/* * This file is part of libeh <http://github.com/amery/libeh> * * Copyright (c) 2011, Alejandro Mery <amery@geeks.cl> * 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 author 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 <COPYRIGHT HOLDER> 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 <stdlib.h> #include "eh.h" #include "eh_fmt.h" #define hexa "0123456789abcdef" #define CEC "abtnvfr" static inline size_t eh_fmt_cstr_len(unsigned char c) { if (c > 0x1f && c < 0x7f) { /* ASCII printable characters */ switch (c) { case '"': case '\\': return 2; default: return 1; } } else if (c >= '\a' && c <= '\r') { /* C Character Escape Codes */ return 2; } else if (c == 0) { return 2; } else { /* not printable, hexa encoded */ return 4; } } ssize_t eh_fmt_cstr(char *buf, size_t buf_size, const char *data, size_t data_size) { size_t len = 0; while(data_size-- > 0) { unsigned char c = *data++; size_t l = eh_fmt_cstr_len(c); if (unlikely(l > buf_size)) break; switch (l) { case 1: *buf = c; break; case 2: buf[0] = '\\'; if (c >= '\a' && c <= '\r') c = CEC[c - '\a']; else if (c == 0) c = '0'; buf[1] = c; break; case 4: buf[0] = '\\'; buf[1] = 'x'; buf[2] = hexa[(c & (0x0f << 4)) >> 4]; buf[3] = hexa[c & 0x0f]; } buf_size -= l; buf += l; len += l; } return len; }
/* LazyDeclaration.h -- * * Copyright (c) 2014, Lex Chou <lex at chou dot it> * 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 Swallow 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 LAZY_DECLARATION_H #define LAZY_DECLARATION_H #include <vector> #include "Symbol.h" SWALLOW_NS_BEGIN class SymbolScope; class SymbolRegistry; typedef std::shared_ptr<class Declaration> DeclarationPtr; class LazyDeclaration { public: struct DeclarationEntry { SymbolScope* currentScope; SymbolScope* fileScope; DeclarationPtr node; DeclarationEntry(SymbolScope* currentScope, SymbolScope* fileScope, const DeclarationPtr& node); }; public: void addDeclaration(SymbolRegistry* registry, const DeclarationPtr& node); void clear(); public: size_t size() const { return decls.size();} std::vector<DeclarationEntry>::iterator begin() { return decls.begin(); } std::vector<DeclarationEntry>::iterator end() { return decls.end(); } private: std::vector<DeclarationEntry> decls; }; SWALLOW_NS_END #endif//LAZY_DECLARATION_H
/// @file /// @author Boris Mikic /// @version 3.06 /// /// @section LICENSE /// /// This program is free software; you can redistribute it and/or modify it under /// the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php /// /// @section DESCRIPTION /// /// Defines a horizontal scroll bar. #ifndef APRILUI_SCROLL_BAR_H_H #define APRILUI_SCROLL_BAR_H_H #include <gtypes/Rectangle.h> #include <hltypes/hstring.h> #include "apriluiExport.h" #include "ObjectScrollBar.h" namespace aprilui { class apriluiExport ScrollBarH : public ScrollBar { public: ScrollBarH(chstr name, grect rect); ~ScrollBarH(); static Object* createInstance(chstr name, grect rect); void notifyEvent(chstr name, void* params); void addScrollValue(float value); static hstr SkinNameLeftNormal; static hstr SkinNameLeftHover; static hstr SkinNameLeftPushed; static hstr SkinNameRightNormal; static hstr SkinNameRightHover; static hstr SkinNameRightPushed; static hstr SkinNameBackgroundH; static hstr SkinNameBarHNormal; static hstr SkinNameBarHHover; static hstr SkinNameBarHPushed; protected: hstr _getSkinNameBeginNormal() { return SkinNameLeftNormal; } hstr _getSkinNameBeginHover() { return SkinNameLeftHover; } hstr _getSkinNameBeginPushed() { return SkinNameLeftPushed; } hstr _getSkinNameEndNormal() { return SkinNameRightNormal; } hstr _getSkinNameEndHover() { return SkinNameRightHover; } hstr _getSkinNameEndPushed() { return SkinNameRightPushed; } hstr _getSkinNameBackground() { return SkinNameBackgroundH; } hstr _getSkinNameBarNormal() { return SkinNameBarHNormal; } hstr _getSkinNameBarHover() { return SkinNameBarHHover; } hstr _getSkinNameBarPushed() { return SkinNameBarHPushed; } grect _getBarDrawRect(); float _calcScrollJump(float x, float y); float _calcScrollMove(float x, float y); void _updateChildren(); void _moveScrollBar(float x, float y); void _updateBar(); void _adjustDragSpeed(); bool _checkAreaSize(); }; } #endif
// CVSDrawingModel.h // CVSDrawingModel // Created by justin carlson on 10/17/13. // Copyright (c) 2013 Canvas. All rights reserved. // master library forward header for libCVSDrawingModel @class CVSDMAlignedMemory; @class CVSDMEditorBitmapStore; @class CVSDMEditorBitmapStoreReference; @class CVSDMFileSystemIOQueue; @class CVSDMImageSnapshotQueue; @class CVSDMImmutableDataReference; @class CVSDMMutableBitmap; @class CVSDMReadWriteLock; @class CVSDMTemporaryFile; @class CVSDMTemporaryDirectory; @class CVSDMTemporaryFileSystemResource; @protocol CVSDMFileExportDestination; @protocol CVSDMReadWriteLocking;
// Copyright (c) 2012 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. // // A database can be configured with a custom FilterPolicy object. // This object is responsible for creating a small filter from a set // of keys. These filters are stored in leveldb and are consulted // automatically by leveldb to decide whether or not to read some // information from disk. In many cases, a filter can cut down the // number of disk seeks form a handful to a single disk seek per // DB::Get() call. // // Most people will want to use the builtin bloom filter support (see // NewBloomFilterPolicy() below). #ifndef STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ #define STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ #include <string> #include "leveldb/export.h" namespace leveldb { class Slice; class LEVELDB_EXPORT FilterPolicy { public: virtual ~FilterPolicy(); // Return the name of this policy. Note that if the filter encoding // changes in an incompatible way, the name returned by this method // must be changed. Otherwise, old incompatible filters may be // passed to methods of this type. virtual const char* Name() const = 0; // keys[0,n-1] contains a list of keys (potentially with duplicates) // that are ordered according to the user supplied comparator. // Append a filter that summarizes keys[0,n-1] to *dst. // // Warning: do not change the initial contents of *dst. Instead, // append the newly constructed filter to *dst. virtual void CreateFilter(const Slice* keys, int n, std::string* dst) const = 0; // "filter" contains the data appended by a preceding call to // CreateFilter() on this class. This method must return true if // the key was in the list of keys passed to CreateFilter(). // This method may return true or false if the key was not on the // list, but it should aim to return false with a high probability. virtual bool KeyMayMatch(const Slice& key, const Slice& filter) const = 0; }; // Return a new filter policy that uses a bloom filter with approximately // the specified number of bits per key. A good value for bits_per_key // is 10, which yields a filter with ~ 1% false positive rate. // // Callers must delete the result after any database that is using the // result has been closed. // // Note: if you are using a custom comparator that ignores some parts // of the keys being compared, you must not use NewBloomFilterPolicy() // and must provide your own FilterPolicy that also ignores the // corresponding parts of the keys. For example, if the comparator // ignores trailing spaces, it would be incorrect to use a // FilterPolicy (like NewBloomFilterPolicy) that does not ignore // trailing spaces in keys. LEVELDB_EXPORT const FilterPolicy* NewBloomFilterPolicy(int bits_per_key); } #endif // STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_
#ifndef FILEBASE_H #define FILEBASE_H #include <cassert> #include <cstring> #include <iomanip> #include <sstream> #include <sys/stat.h> #include "filepage.h" constexpr char defaultStorageDir[] = "data"; class Filebase { const char *name_prefix; const char *dir; unsigned int counter = 0; std::map<unsigned int, Filepage *> filepages; const std::string dbname(const char *dir) { std::stringstream ss; ss << std::string(dir); ss << "/"; ss << name_prefix; ss << std::setw(4) << std::setfill('0') << counter++; ss << "dxdb"; return ss.str(); } /* Substract counter from file */ unsigned int pagecounter(std::string path) { std::string _dbname = path.substr(path.find_last_of("/") + 1); return atoi(_dbname.substr(3, 4).c_str()); } unsigned int acquirePage(const std::string& file) { unsigned int pageNum = pagecounter(file); filepages[pageNum] = new Filepage(file); return pageNum; } unsigned int applicablePage() { for (auto const& v : filepages) { if (v.second->isFull()) continue; return v.first; } return acquirePage(dbname(dir)); } public: Filebase(unsigned int cnt = 0, const char *storagedir = defaultStorageDir) : name_prefix("lfb"), dir(storagedir) { mkdir(storagedir, 0700); assert(strlen(name_prefix) == 3); /* At least one page */ acquirePage(dbname(dir)); /* Initialize all pages */ for (unsigned int i = 1; i < cnt; ++i) acquirePage(dbname(dir)); } unsigned int put(std::string name, std::string data) { unsigned int pageNum = applicablePage(); filepages[pageNum]->storeItem(name, data); return pageNum; } std::vector<uint8_t> *get(unsigned int pageNum, std::string name) { return filepages[pageNum]->retrieveItem(name); } void remove(unsigned int pageNum, std::string name) { filepages[pageNum]->removeItem(name); } inline unsigned int dbcount() const { return counter; } ~Filebase() { //TODO release pages } }; #endif // FILEBASE_H
// iMoteConsoleDlg.h : header file // #include "SerialPort.h" #include "USBDevice.h" #include "SymTable.h" #include "RichEditExt.h" #include "IMoteTerminal.h" #if !defined(AFX_IMOTECONSOLEDLG_H__CADB84BB_FA86_4487_9E9B_023D2C7975AE__INCLUDED_) #define AFX_IMOTECONSOLEDLG_H__CADB84BB_FA86_4487_9E9B_023D2C7975AE__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 ///////////////////////////////////////////////////////////////////////////// // CIMoteConsoleDlg dialog #include "DataFormatPage.h" #include "PlotInfo.h" #include <fstream> #include "IMoteCartesianPlot.h" #include "IMoteListDisp.h" #include "afxwin.h" #include "afxcmn.h" #include "dynarray.h" extern CIMoteConsoleApp theApp; #define NUMCHANNELS (20) using namespace std; class CIMoteConsoleDlg : public CDialog { // Construction public: CIMoteConsoleDlg(CWnd* pParent = NULL); // standard constructor virtual ~CIMoteConsoleDlg(); // standard constructor void LoadProfileInfo(void); void SaveProfileInfo(void); // Dialog Data //{{AFX_DATA(CIMoteConsoleDlg) enum { IDD = IDD_IMOTECONSOLE_DIALOG }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CIMoteConsoleDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: HICON m_hIcon; // Generated message map functions //{{AFX_MSG(CIMoteConsoleDlg) virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnClose(); //}}AFX_MSG DECLARE_MESSAGE_MAP() private: CToolBar m_wndConnectionToolBar; int CreateConnectionToolBar(void); CSymTable *m_terminalList; SDataFormatSettings *m_pDataFormatSettings; CObArray m_WindowArray; BOOL DoRegisterDeviceInterface(GUID InterfaceClassGuid, HDEVNOTIFY *hDevNotify); HDEVNOTIFY m_devNotificationHandle; public: CString m_strPortName; COMMCONFIG *m_pCommConfig; void BufferAppend(char x); void BufferAppend(CIMoteTerminal *out, char x); void BufferAppend(CIMoteTerminal *out, CString x); void BufferAppend(CIMoteTerminal *out, char * y); afx_msg void OnEditOptions(); afx_msg void OnEditNewwin(); afx_msg void OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu); CIMoteCartesianPlot *CreateNewView(UINT ID, UINT iMoteID, UINT channelID); CIMoteListDisp *CreateNewList(UINT ID, UINT iMoteID, UINT channelID, bool bcreatenew=false, CIMoteListDisp *oldframe=NULL, CString headerX="",CString headerY="",CString headerZ=""); void PopulateUSBDevices(); CPlotInfo plotinfo[NUMCHANNELS]; int MoteIDs[NUMCHANNELS]; ofstream logfile; void AddPoint(POINT newpoint, int channelID); CPoint Filter(POINT newpoint, int channelID); bool smooth; bool rawdata; bool bAppClosing; void SaveLogEntry(CString *str); void SaveLogEntryToScreen(CString *str); afx_msg LRESULT OnReceiveData(WPARAM wParam, LPARAM lParam); void BuildJPG(unsigned char *jpeg_data, int length, unsigned char *whole_jpg, int *whole_jpg_len); protected: virtual void OnCancel(); public: afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnEditTest(); afx_msg void OnViewSmooth(); afx_msg void OnUpdateViewSmooth(CCmdUI *pCmdUI); afx_msg void OnEditTestnewlist(); afx_msg void OnDisplayChange(); int AddMote(void); CComboBox m_displayedMoteComboControl; CString m_displayedMoteComboValue; CStatic m_comNumStatic; CStatic m_detachedStatic; afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData); afx_msg void OnBnClickedButtonWindowBuffer(); afx_msg void OnHelpAbout(); }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_IMOTECONSOLEDLG_H__CADB84BB_FA86_4487_9E9B_023D2C7975AE__INCLUDED_)
namespace CGAL { /*! \ingroup PkgPeriodic3Triangulation3MainClasses The class `Periodic_3_triangulation_hierarchy_3` implements a triangulation augmented with a data structure which allows fast point location queries. \cgalHeading{Template Parameters} It is templated by a parameter which must be instantiated by one of the \cgal periodic triangulation classes. <I>In the current implementation, only `Periodic_3_Delaunay_triangulation_3` is supported for `PTr`.</I> `PTr::Vertex` has to be a model of the concept `Periodic_3TriangulationHierarchyVertexBase_3`. `PTr::Geom_traits` has to be a model of the concept `Periodic_3DelaunayTriangulationTraits_3`. `Periodic_3_triangulation_hierarchy_3` offers exactly the same functionalities as `PTr`. Most of them (point location, insertion, removal \f$ \ldots\f$ ) are overloaded to improve their efficiency by using the hierarchic structure. Note that, since the algorithms that are provided are randomized, the running time of constructing a triangulation with a hierarchy may be improved when shuffling the data points. However, the I/O operations are not overloaded. So, writing a hierarchy into a file will lose the hierarchic structure and reading it from the file will result in an ordinary triangulation whose efficiency will be the same as `PTr`. \cgalHeading{Implementation} The data structure is a hierarchy of triangulations. The triangulation at the lowest level is the original triangulation where operations and point location are to be performed. Then at each succeeding level, the data structure stores a triangulation of a small random sample of the vertices of the triangulation at the preceding level. Point location is done through a top-down nearest neighbor query. The nearest neighbor query is first performed naively in the top level triangulation. Then, at each following level, the nearest neighbor at that level is found through a linear walk performed from the nearest neighbor found at the preceding level. Because the number of vertices in each triangulation is only a small fraction of the number of vertices of the preceding triangulation the data structure remains small and achieves fast point location queries on real data. \sa `CGAL::Periodic_3_Delaunay_triangulation_3` */ template< typename PTr > class Periodic_3_triangulation_hierarchy_3 : public PTr { public: /// @} }; /* end Periodic_3_triangulation_hierarchy_3 */ } /* end namespace CGAL */
/* $NetBSD: hp.c,v 1.2 1999/04/01 20:40:07 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. * 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. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed at Ludd, University of Lule}. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * 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. */ /* All bugs are subject to removal without further notice */ #include "sys/param.h" #include "sys/disklabel.h" #include "lib/libsa/stand.h" #include "../include/pte.h" /*#include "../include/macros.h"*/ #include "../mba/mbareg.h" #include "../mba/hpreg.h" #include "vaxstand.h" /* * These routines for HP disk standalone boot is wery simple, * assuming a lots of thing like that we only working at one hp disk * a time, no separate routines for mba driver etc.. * But it works :) */ struct hp_softc { int adapt; int ctlr; int unit; int part; }; struct disklabel hplabel; struct hp_softc hp_softc; char io_buf[MAXBSIZE]; daddr_t part_offset; hpopen(f, adapt, ctlr, unit, part) struct open_file *f; int ctlr, unit, part; { struct disklabel *lp; struct hp_softc *hs; volatile struct mba_regs *mr; volatile struct hp_drv *hd; char *msg; int i,err; lp = &hplabel; hs = &hp_softc; mr = (void *)mbaaddr[ctlr]; hd = (void *)&mr->mba_md[unit]; if (adapt > nsbi) return(EADAPT); if (ctlr > nmba) return(ECTLR); if (unit > MAXMBAU) return(EUNIT); bzero(lp, sizeof(struct disklabel)); lp->d_secpercyl = 32; lp->d_nsectors = 32; hs->adapt = adapt; hs->ctlr = ctlr; hs->unit = unit; hs->part = part; /* Set volume valid and 16 bit format; only done once */ mr->mba_cr = MBACR_INIT; hd->hp_cs1 = HPCS_PA; hd->hp_of = HPOF_FMT; err = hpstrategy(hs, F_READ, LABELSECTOR, DEV_BSIZE, io_buf, &i); if (err) { printf("reading disklabel: %s\n", strerror(err)); return 0; } msg = getdisklabel(io_buf + LABELOFFSET, lp); if (msg) printf("getdisklabel: %s\n", msg); f->f_devdata = (void *)hs; return 0; } hpstrategy(hs, func, dblk, size, buf, rsize) struct hp_softc *hs; daddr_t dblk; u_int size, *rsize; char *buf; int func; { volatile struct mba_regs *mr; volatile struct hp_drv *hd; struct disklabel *lp; unsigned int i, pfnum, mapnr, nsize, bn, cn, sn, tn; mr = (void *)mbaaddr[hs->ctlr]; hd = (void *)&mr->mba_md[hs->unit]; lp = &hplabel; pfnum = (u_int)buf >> VAX_PGSHIFT; for(mapnr = 0, nsize = size; (nsize + VAX_NBPG) > 0; nsize -= VAX_NBPG) *(int *)&mr->mba_map[mapnr++] = PG_V | pfnum++; mr->mba_var = ((u_int)buf & VAX_PGOFSET); mr->mba_bc = (~size) + 1; bn = dblk + lp->d_partitions[hs->part].p_offset; if (bn) { cn = bn / lp->d_secpercyl; sn = bn % lp->d_secpercyl; tn = sn / lp->d_nsectors; sn = sn % lp->d_nsectors; } else cn = sn = tn = 0; hd->hp_dc = cn; hd->hp_da = (tn << 8) | sn; if (func == F_WRITE) hd->hp_cs1 = HPCS_WRITE; else hd->hp_cs1 = HPCS_READ; while (mr->mba_sr & MBASR_DTBUSY) ; if (mr->mba_sr & MBACR_ABORT) return 1; *rsize = size; return 0; }
/***************************************************************************** Copyright (c) 2011, Intel Corp. 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 Intel Corporation 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. ***************************************************************************** * Contents: Native high-level C interface to LAPACK function zpocon * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #include "lapacke.h" #include "lapacke_utils.h" lapack_int LAPACKE_zpocon( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, double anorm, double* rcond ) { lapack_int info = 0; double* rwork = NULL; lapack_complex_double* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_zpocon", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_zpo_nancheck( matrix_order, uplo, n, a, lda ) ) { return -4; } if( LAPACKE_d_nancheck( 1, &anorm, 1 ) ) { return -6; } #endif /* Allocate memory for working array(s) */ rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,n) ); if( rwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (lapack_complex_double*) LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,2*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_zpocon_work( matrix_order, uplo, n, a, lda, anorm, rcond, work, rwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( rwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_zpocon", info ); } return info; }
/* * gauge.c * * progress indicator for libdialog * * * Copyright (c) 1995, Marc van Kempen * * All rights reserved. * * This software may be used, modified, copied, distributed, and * sold, in both source and binary form provided that the above * copyright and these terms are retained, verbatim, as the first * lines of this file. Under no circumstances is the author * responsible for the proper functioning of this software, nor does * the author assume any responsibility for damages incurred with * its use. */ #include "dialog.h" void dialog_gauge(char *title, char *prompt, int y, int x, int height, int width, int perc) /* * Desc: display a progress bar, progress indicated by <perc> */ { WINDOW *gw; int glen, i; char percs[5]; gw = newwin(height, width, y, x); if (!gw) { fprintf(stderr, "dialog_gauge: Error creating window (%d, %d, %d, %d)", height, width, y, x); exit(-1); } draw_box(gw, 0, 0, height, width, dialog_attr, border_attr); draw_shadow(stdscr, y, x, height, width); wattrset(gw, title_attr); if (title) { wmove(gw, 0, (width - strlen(title))/2 - 1); waddstr(gw, "[ "); waddstr(gw, title); waddstr(gw, " ]"); } wattrset(gw, dialog_attr); if (prompt) { wmove(gw, 1, (width - strlen(prompt))/2 - 1); waddstr(gw, prompt); } draw_box(gw, 2, 2, 3, width-4, dialog_attr, border_attr); glen = (int) ((float) perc/100 * (width-6)); wattrset(gw, dialog_attr); sprintf(percs, "%3d%%", perc); wmove(gw, 5, width/2 - 2); waddstr(gw, percs); wattrset(gw, A_BOLD); wmove(gw, 3, 3); for (i=0; i<glen; i++) waddch(gw, ' '); wrefresh(gw); return; } /* dialog_gauge() */
// 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_RUNTIME_BROWSER_GEOLOCATION_XWALK_ACCESS_TOKEN_STORE_H_ #define XWALK_RUNTIME_BROWSER_GEOLOCATION_XWALK_ACCESS_TOKEN_STORE_H_ #include "content/public/browser/access_token_store.h" class XWalkAccessTokenStore : public content::AccessTokenStore { public: explicit XWalkAccessTokenStore(net::URLRequestContextGetter* request_context); private: virtual ~XWalkAccessTokenStore(); // AccessTokenStore void LoadAccessTokens( const LoadAccessTokensCallbackType& callback) override; void SaveAccessToken( const GURL& server_url, const base::string16& access_token) override; static void DidLoadAccessTokens( net::URLRequestContextGetter* request_context, const LoadAccessTokensCallbackType& callback); net::URLRequestContextGetter* request_context_; DISALLOW_COPY_AND_ASSIGN(XWalkAccessTokenStore); }; #endif // XWALK_RUNTIME_BROWSER_GEOLOCATION_XWALK_ACCESS_TOKEN_STORE_H_
namespace CGAL { /*! \ingroup PkgVoronoiDiagramAdaptor2Points The class `Regular_triangulation_adaptation_traits_2` provides a model for the `AdaptationTraits_2` concept. The template parameter of the `Regular_triangulation_adaptation_traits_2` class must be a model of the `DelaunayGraph_2` concept, and in particular it has the semantics of a 2D regular triangulation. \cgalModels `AdaptationTraits_2` \sa `AdaptationTraits_2` \sa `DelaunayGraph_2` \sa `Voronoi_diagram_2<DG,AT,AP>` \sa `CGAL::Regular_triangulation_2<Traits,Tds>` */ template< typename RT2 > class Regular_triangulation_adaptation_traits_2 { public: /// \name Types /// @{ /*! */ typedef CGAL::Tag_true Has_nearest_site_2; /// @} }; /* end Regular_triangulation_adaptation_traits_2 */ } /* end namespace CGAL */
// 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 ASH_SYSTEM_TRAY_ACTIONABLE_VIEW_H_ #define ASH_SYSTEM_TRAY_ACTIONABLE_VIEW_H_ #include "ash/ash_export.h" #include "ash/system/tray/tray_popup_ink_drop_style.h" #include "base/macros.h" #include "ui/gfx/geometry/rect.h" #include "ui/views/controls/button/button.h" namespace ash { // A focusable view that performs an action when user clicks on it, or presses // enter or space when focused. Note that the action is triggered on mouse-up, // instead of on mouse-down. So if user presses the mouse on the view, then // moves the mouse out of the view and then releases, then the action will not // be performed. // Exported for SystemTray. // // TODO(bruthig): Consider removing ActionableView and make clients use // Buttons instead. (See crbug.com/614453) class ASH_EXPORT ActionableView : public views::ButtonListener, public views::Button { public: static const char kViewClassName[]; explicit ActionableView(TrayPopupInkDropStyle ink_drop_style); ~ActionableView() override; protected: // Performs an action when user clicks on the view (on mouse-press event), or // presses a key when this view is in focus. Returns true if the event has // been handled and an action was performed. Returns false otherwise. virtual bool PerformAction(const ui::Event& event) = 0; // Called after PerformAction() to act upon its result, including showing // appropriate ink drop ripple. This will not get called if the view is // destroyed during PerformAction(). Default implementation shows triggered // ripple if action is performed or hides existing ripple if no action is // performed. Subclasses can override to change the default behavior. virtual void HandlePerformActionResult(bool action_performed, const ui::Event& event); // Overridden from views::Button. const char* GetClassName() const override; bool OnKeyPressed(const ui::KeyEvent& event) override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; std::unique_ptr<views::InkDrop> CreateInkDrop() override; std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() const override; // Overridden from views::ButtonListener. void ButtonPressed(Button* sender, const ui::Event& event) override; private: // Used by ButtonPressed() to determine whether |this| has been destroyed as a // result of performing the associated action. This is necessary because in // the not-destroyed case ButtonPressed() uses member variables. bool* destroyed_; // Defines the flavor of ink drop ripple/highlight that should be constructed. const TrayPopupInkDropStyle ink_drop_style_; DISALLOW_COPY_AND_ASSIGN(ActionableView); }; } // namespace ash #endif // ASH_SYSTEM_TRAY_ACTIONABLE_VIEW_H_
/* $OpenBSD: ssl_algs.c,v 1.18 2014/06/12 15:49:31 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * 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 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 cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #include <stdio.h> #include <openssl/objects.h> #include <openssl/lhash.h> #include "ssl_locl.h" int SSL_library_init(void) { #ifndef OPENSSL_NO_DES EVP_add_cipher(EVP_des_cbc()); EVP_add_cipher(EVP_des_ede3_cbc()); #endif #ifndef OPENSSL_NO_IDEA EVP_add_cipher(EVP_idea_cbc()); #endif #ifndef OPENSSL_NO_RC4 EVP_add_cipher(EVP_rc4()); #if !defined(OPENSSL_NO_MD5) && (defined(__x86_64) || defined(__x86_64__)) EVP_add_cipher(EVP_rc4_hmac_md5()); #endif #endif #ifndef OPENSSL_NO_RC2 EVP_add_cipher(EVP_rc2_cbc()); /* Not actually used for SSL/TLS but this makes PKCS#12 work * if an application only calls SSL_library_init(). */ EVP_add_cipher(EVP_rc2_40_cbc()); #endif EVP_add_cipher(EVP_aes_128_cbc()); EVP_add_cipher(EVP_aes_192_cbc()); EVP_add_cipher(EVP_aes_256_cbc()); EVP_add_cipher(EVP_aes_128_gcm()); EVP_add_cipher(EVP_aes_256_gcm()); EVP_add_cipher(EVP_aes_128_cbc_hmac_sha1()); EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1()); #ifndef OPENSSL_NO_CAMELLIA EVP_add_cipher(EVP_camellia_128_cbc()); EVP_add_cipher(EVP_camellia_256_cbc()); #endif EVP_add_digest(EVP_md5()); EVP_add_digest_alias(SN_md5, "ssl2-md5"); EVP_add_digest_alias(SN_md5, "ssl3-md5"); EVP_add_digest(EVP_sha1()); /* RSA with sha1 */ EVP_add_digest_alias(SN_sha1, "ssl3-sha1"); EVP_add_digest_alias(SN_sha1WithRSAEncryption, SN_sha1WithRSA); EVP_add_digest(EVP_sha224()); EVP_add_digest(EVP_sha256()); EVP_add_digest(EVP_sha384()); EVP_add_digest(EVP_sha512()); EVP_add_digest(EVP_dss1()); /* DSA with sha1 */ EVP_add_digest_alias(SN_dsaWithSHA1, SN_dsaWithSHA1_2); EVP_add_digest_alias(SN_dsaWithSHA1, "DSS1"); EVP_add_digest_alias(SN_dsaWithSHA1, "dss1"); EVP_add_digest(EVP_ecdsa()); /* initialize cipher/digest methods table */ ssl_load_ciphers(); return (1); }
/* +---------------------------------------------------------------------------+ | The Mobile Robot Programming Toolkit (MRPT) | | | | http://www.mrpt.org/ | | | | Copyright (c) 2005-2013, Individual contributors, see AUTHORS file | | Copyright (c) 2005-2013, MAPIR group, University of Malaga | | Copyright (c) 2012-2013, University of Almeria | | All rights reserved. | | | | Redistribution and use in source and binary forms, with or without | | modification, are permitted provided that the following conditions are | | met: | | * Redistributions of source code must retain the above copyright | | notice, this list of conditions and the following disclaimer. | | * Redistributions in binary form must reproduce the above copyright | | notice, this list of conditions and the following disclaimer in the | | documentation and/or other materials provided with the distribution. | | * Neither the name of the copyright holders 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 HOLDERS 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 CPTG4_H #define CPTG4_H #include <mrpt/reactivenav/CParameterizedTrajectoryGenerator.h> namespace mrpt { namespace reactivenav { /** A PTG for optimal paths of type "C|C" , as named in PTG papers. * See also "Obstacle Distance for Car-Like Robots", IEEE Trans. Rob. And Autom, 1999. * \ingroup mrpt_reactivenav_grp */ class REACTIVENAV_IMPEXP CPTG4 : public CParameterizedTrajectoryGenerator { public: /** Constructor: possible values in "params", those of CParameterizedTrajectoryGenerator plus: * - K: Direction, +1 or -1 */ CPTG4(const TParameters<double> &params ); /** The lambda function. */ void lambdaFunction( float x, float y, int &out_k, float &out_d ); /** Gets a short textual description of the PTG and its parameters. */ std::string getDescription() const; bool PTG_IsIntoDomain( float x, float y ); void PTG_Generator( float alpha, float t,float x, float y, float phi, float &v, float &w ); protected: float R,K; }; } } #endif
/* * Copyright (C) 2015, Nils Moehrle * TU Darmstadt - Graphics, Capture and Massively Parallel Computing * All rights reserved. * * This software may be modified and distributed under the terms * of the BSD 3-Clause license. See the LICENSE.txt file for details. */ #ifndef TEX_TEXTUREPATCH_HEADER #define TEX_TEXTUREPATCH_HEADER #include <vector> #include <math/vector.h> #include <mve/mesh.h> #include "tri.h" #include "poisson_blending.h" int const texture_patch_border = 1; /** * Class representing a texture patch. * Contains additionaly to the rectangular part of the TextureView * the faces which it textures and their relative texture coordinates. */ class TexturePatch { public: typedef std::shared_ptr<TexturePatch> Ptr; typedef std::shared_ptr<const TexturePatch> ConstPtr; typedef std::vector<std::size_t> Faces; typedef std::vector<math::Vec2f> Texcoords; private: int label; Faces faces; Texcoords texcoords; mve::FloatImage::Ptr image; mve::ByteImage::Ptr validity_mask; mve::ByteImage::Ptr blending_mask; public: /** Constructs a texture patch. */ TexturePatch(int _label, std::vector<std::size_t> const & _faces, std::vector<math::Vec2f> const & _texcoords, mve::ByteImage::Ptr _image); TexturePatch(TexturePatch const & texture_patch); static TexturePatch::Ptr create(TexturePatch::ConstPtr texture_patch); static TexturePatch::Ptr create(int label, std::vector<std::size_t> const & faces, std::vector<math::Vec2f> const & texcoords, mve::ByteImage::Ptr image); TexturePatch::Ptr duplicate(void); /** Adjust the image colors and update validity mask. */ void adjust_colors(std::vector<math::Vec3f> const & adjust_values); math::Vec3f get_pixel_value(math::Vec2f pixel) const; void set_pixel_value(math::Vec2i pixel, math::Vec3f color); bool valid_pixel(math::Vec2i pixel) const; bool valid_pixel(math::Vec2f pixel) const; std::vector<std::size_t> & get_faces(void); std::vector<std::size_t> const & get_faces(void) const; std::vector<math::Vec2f> & get_texcoords(void); std::vector<math::Vec2f> const & get_texcoords(void) const; mve::FloatImage::ConstPtr get_image(void) const; mve::ByteImage::ConstPtr get_validity_mask(void) const; mve::ByteImage::ConstPtr get_blending_mask(void) const; std::pair<float, float> get_min_max(void) const; void release_blending_mask(void); void prepare_blending_mask(std::size_t strip_width); void erode_validity_mask(void); void blend(mve::FloatImage::ConstPtr orig); int get_label(void) const; int get_width(void) const; int get_height(void) const; int get_size(void) const; }; inline TexturePatch::Ptr TexturePatch::create(TexturePatch::ConstPtr texture_patch) { return Ptr(new TexturePatch(*texture_patch)); } inline TexturePatch::Ptr TexturePatch::create(int label, std::vector<std::size_t> const & faces, std::vector<math::Vec2f> const & texcoords, mve::ByteImage::Ptr image) { return Ptr(new TexturePatch(label, faces, texcoords, image)); } inline TexturePatch::Ptr TexturePatch::duplicate(void) { return Ptr(new TexturePatch(*this)); } inline int TexturePatch::get_label(void) const { return label; } inline int TexturePatch::get_width(void) const { return image->width(); } inline int TexturePatch::get_height(void) const { return image->height(); } inline mve::FloatImage::ConstPtr TexturePatch::get_image(void) const { return image; } inline mve::ByteImage::ConstPtr TexturePatch::get_validity_mask(void) const { return validity_mask; } inline mve::ByteImage::ConstPtr TexturePatch::get_blending_mask(void) const { assert(blending_mask != NULL); return blending_mask; } inline void TexturePatch::release_blending_mask(void) { assert(blending_mask != NULL); blending_mask.reset(); } inline std::vector<math::Vec2f> & TexturePatch::get_texcoords(void) { return texcoords; } inline std::vector<std::size_t> & TexturePatch::get_faces(void) { return faces; } inline std::vector<math::Vec2f> const & TexturePatch::get_texcoords(void) const { return texcoords; } inline std::vector<std::size_t> const & TexturePatch::get_faces(void) const { return faces; } inline int TexturePatch::get_size(void) const { return get_width() * get_height(); } #endif /* TEX_TEXTUREPATCH_HEADER */
// 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 CHROMECAST_GRAPHICS_GESTURES_SIDE_SWIPE_DETECTOR_H_ #define CHROMECAST_GRAPHICS_GESTURES_SIDE_SWIPE_DETECTOR_H_ #include <deque> #include "base/timer/elapsed_timer.h" #include "chromecast/graphics/gestures/cast_gesture_handler.h" #include "ui/events/event_rewriter.h" namespace aura { class Window; } // namespace aura namespace chromecast { // An event rewriter for detecting system-wide gestures performed on the margins // of the root window. // Recognizes swipe gestures that originate from the top, left, bottom, and // right of the root window. Stashes copies of touch events that occur during // the side swipe, and replays them if the finger releases before leaving the // margin area. class SideSwipeDetector : public ui::EventRewriter { public: SideSwipeDetector(CastGestureHandler* gesture_handler, aura::Window* root_window); ~SideSwipeDetector() override; CastSideSwipeOrigin GetDragPosition(const gfx::Point& point, const gfx::Rect& screen_bounds) const; // Overridden from ui::EventRewriter ui::EventDispatchDetails RewriteEvent( const ui::Event& event, const Continuation continuation) override; private: void StashEvent(const ui::TouchEvent& event); const int gesture_start_width_; const int gesture_start_height_; const int bottom_gesture_start_height_; CastGestureHandler* gesture_handler_; aura::Window* root_window_; CastSideSwipeOrigin current_swipe_; ui::PointerId current_pointer_id_; base::ElapsedTimer current_swipe_time_; std::deque<ui::TouchEvent> stashed_events_; DISALLOW_COPY_AND_ASSIGN(SideSwipeDetector); }; } // namespace chromecast #endif // CHROMECAST_GRAPHICS_GESTURES_SIDE_SWIPE_DETECTOR_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_GCM_DRIVER_FEATURES_H #define COMPONENTS_GCM_DRIVER_FEATURES_H #include "base/feature_list.h" namespace gcm { namespace features { extern const base::Feature kInvalidateTokenFeature; extern const char kParamNameTokenInvalidationPeriodDays[]; // The period after which the GCM token becomes stale. base::TimeDelta GetTokenInvalidationInterval(); } // namespace features } // namespace gcm #endif // COMPONENTS_GCM_DRIVER_FEATURES_H
/* * Copyright (c) 1995, Mike Mitchell * Copyright (c) 1984, 1985, 1986, 1987, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. 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. * * @(#)ipx_pcb.h * * $FreeBSD: src/sys/netipx/ipx_pcb.h,v 1.17 2002/03/20 02:39:13 alfred Exp $ */ #ifndef _NETIPX_IPX_PCB_H_ #define _NETIPX_IPX_PCB_H_ /* * IPX protocol interface control block. */ struct ipxpcb { struct ipxpcb *ipxp_next; /* doubly linked list */ struct ipxpcb *ipxp_prev; struct ipxpcb *ipxp_head; struct socket *ipxp_socket; /* back pointer to socket */ struct ipx_addr ipxp_faddr; /* destination address */ struct ipx_addr ipxp_laddr; /* socket's address */ caddr_t ipxp_pcb; /* protocol specific stuff */ struct route ipxp_route; /* routing information */ struct ipx_addr ipxp_lastdst; /* validate cached route for dg socks*/ long ipxp_notify_param; /* extra info passed via ipx_pcbnotify*/ short ipxp_flags; u_char ipxp_dpt; /* default packet type for ipx_output */ u_char ipxp_rpt; /* last received packet type by ipx_input() */ }; /* possible flags */ #define IPXP_IN_ABORT 0x1 /* calling abort through socket */ #define IPXP_RAWIN 0x2 /* show headers on input */ #define IPXP_RAWOUT 0x4 /* show header on output */ #define IPXP_ALL_PACKETS 0x8 /* Turn off higher proto processing */ #define IPXP_CHECKSUM 0x10 /* use checksum on this socket */ #define IPX_WILDCARD 1 #define ipxp_lport ipxp_laddr.x_port #define ipxp_fport ipxp_faddr.x_port #define sotoipxpcb(so) ((struct ipxpcb *)((so)->so_pcb)) /* * Nominal space allocated to a IPX socket. */ #define IPXSNDQ 16384 #define IPXRCVQ 40960 #ifdef _KERNEL extern struct ipxpcb ipxpcb; /* head of list */ int ipx_pcballoc(struct socket *so, struct ipxpcb *head, struct thread *p); int ipx_pcbbind(struct ipxpcb *ipxp, struct sockaddr *nam, struct thread *p); int ipx_pcbconnect(struct ipxpcb *ipxp, struct sockaddr *nam, struct thread *p); void ipx_pcbdetach(struct ipxpcb *ipxp); void ipx_pcbdisconnect(struct ipxpcb *ipxp); struct ipxpcb * ipx_pcblookup(struct ipx_addr *faddr, int lport, int wildp); void ipx_pcbnotify(struct ipx_addr *dst, int errno, void (*notify)(struct ipxpcb *), long param); void ipx_setpeeraddr(struct ipxpcb *ipxp, struct sockaddr **nam); void ipx_setsockaddr(struct ipxpcb *ipxp, struct sockaddr **nam); #endif /* _KERNEL */ #endif /* !_NETIPX_IPX_PCB_H_ */
/* * Copyright (C) 2010 Google Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_EVENT_QUEUE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_EVENT_QUEUE_H_ #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" #include "third_party/blink/renderer/platform/wtf/linked_hash_set.h" namespace blink { class Event; class ExecutionContext; class CORE_EXPORT EventQueue final : public GarbageCollected<EventQueue>, public ExecutionContextLifecycleObserver { USING_GARBAGE_COLLECTED_MIXIN(EventQueue); public: EventQueue(ExecutionContext*, TaskType); ~EventQueue(); void Trace(Visitor*) override; bool EnqueueEvent(const base::Location&, Event&); void CancelAllEvents(); bool HasPendingEvents() const; private: bool RemoveEvent(Event&); void DispatchEvent(Event*); void ContextDestroyed() override; void Close(ExecutionContext*); void DoCancelAllEvents(ExecutionContext*); const TaskType task_type_; HeapLinkedHashSet<Member<Event>> queued_events_; bool is_closed_; }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_EVENT_QUEUE_H_