text
stringlengths
4
6.14k
#ifndef MAINMENU_H #define MAINMENU_H #include "StdAfx.h" class MainMenu : public wxMenuBar { DECLARE_CLASS(MainMenu) DECLARE_EVENT_TABLE() public: /// <summary>Êîíñòðóêòîð êëàññà.</summary> MainMenu(void); /// <summary>Äåñòðóêòîð êëàññà.</summary> ~MainMenu(void); protected: void OnNewProject(wxCommandEvent& event); void OnOpenProject(wxCommandEvent& event); void OnSaveProject(wxCommandEvent& event); void OnSaveAsProject(wxCommandEvent& event); void OnExit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); private: }; #endif
#ifndef PBM_H #define PBM_H #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef struct { int width; int height; uint8_t *data; } pbm_image; pbm_image *load_pbm(char *path); void free_pbm(pbm_image *img); #endif
cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( G_4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G_4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D5 ,0.25,hCodec); cosOut( D5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( G_4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G_4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D5 ,0.25,hCodec); cosOut( D5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G_4 ,0.25,hCodec); cosOut( G_4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( C5 ,0.25,hCodec); cosOut( D5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D5 ,0.25,hCodec); cosOut( D5 ,0.25,hCodec); cosOut( C5 ,0.25,hCodec); cosOut( C5 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( G_4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( C5 ,0.25,hCodec); cosOut( C5 ,0.25,hCodec); cosOut( C5 ,0.25,hCodec); cosOut( C5 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( A_4 ,0.25,hCodec); cosOut( G_4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( G4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( F4 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_5 ,0.25,hCodec); cosOut( D_4 ,0.25,hCodec);
// // ContactEditorController.h // nexuspad // // Created by Ren Liu on 7/6/12. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #import "EntryEditorTableViewController.h" #import "PhotoHelper.h" @interface ContactEditorViewController : EntryEditorTableViewController <PhotoHelperDelegate> @property (nonatomic, strong) NPPerson *person; // EntryEditorUpdateDelegate method - (void)updateContactAddress:(NPPerson*)person; - (IBAction)saveContact:(id)sender; @end
// // MasterViewController.h // TestBadge // // Created by Eric Miller on 5/21/14. // Copyright (c) 2014 Frozen Panda. All rights reserved. // #import <UIKit/UIKit.h> @interface MasterViewController : UITableViewController @end
/* Up to 20% marks will be allotted for good programming practice. These include - Comments: for nontrivial code - Indentation: align your code properly - Function use and modular programming - Do not include anything in the header other than what is already given in the template. -------------------------------------------------------------------------------------------------------------- We say that a matrix is good if it has got a sub-matrix which is a symmetric matrix. If a matrix is not good, then we say its goodness is 0. However, if it is good, we define goodness to be the dimension of largest symmetric sub-matrix of the given matrix (i.e. if the largest symmetric sub-matrix is n x n, then the goodness is n). For example, 0 1 1 0 1 0 0 1 1 0 2 3 This matrix is good since 1 0 0 1 is its sub-matrix and is symmetric. 0 1 1 1 0 0 1 0 2 is also a symmetric sub-matrix of the given matrix. Since the dimension of the largest sub-matrix of the given matrix is 3, the goodness is 3. Your task: Given a matrix, print its goodness value and the location of the top left corner of the largest symetric sub-matrix. For the example given above, goodness value is 3 and location of the top left corner of the symmetric sub-matrix is (1,1) i.e. first row first column. If goodness is 0, then top left corner location may be taken as (-1,-1) since it is actually not defined. Assume all numbers to be integer. If their are two or more largest symmetric sub-matrix with the location of top-left corner at (i1,j1) and (i2,j2), then output (i1,j1) if (i1 < i2) or (i1 == i2 and j1 < j2) , otherwise output (i2,j2). Input: m,n //denoting the number of rows and columns of the input matrix followed by m x n matrix with m rows (each in a new line) and n columns e.g. 3 4 0 1 1 0 1 0 0 1 1 0 2 3 Output: g i j // if g is your goodness value and (i,j) is the location of the top left corner of the symmetric sub-matrix. e.g. answer for the above input will be 3 1 1 */ #include <stdio.h> int min(int a, int b) { return (a<b) ? a : b; } int main() { int m,n,i,j,k,l,ans_i=-1,ans_j=-1,flag; int max_goodness = 0,curr_goodness, max_gp; scanf("%d%d",&m,&n); int M[m][n]; for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&M[i][j]); } } for(i=0;i<m;i++) { for(j=0;j<n;j++) { //checking whether an symmetric sub matrix begin at (i,j) i.e. at i+1th row and j+1th column curr_goodness = 0; flag = 0; max_gp = min(m-i,n-j); for(k=0;k<max_gp;k++) { for(l=k;l>=0;l--) { if(l==0) { continue; } else { if(M[i+k][j+k-l] != M[i+k-l][j+k]) { curr_goodness = k; flag = 1; break; } } } if(flag == 1) break; } if (k == max_gp) curr_goodness = max_gp; if(curr_goodness > max_goodness) { max_goodness = curr_goodness; ans_i = i+1; ans_j = j+1; // printf("%d %d %d\n",ans_i,ans_j,max_goodness ); } } } printf("%d %d %d\n", max_goodness, ans_i,ans_j ); }
/************************************************************************************************** * Program name : Switch_Relay_Control.c * Description : This file declares that how to control the switches and relais on the switch * : matrix board and relay matrix board. * : * : Switches : ON / OFF, CLOSE / OPEN * : Relais : CONNECTED / DISCONNECTED * Author : XU ZAN * Date : Fri. July 27, 2012 * Copyright(C) 2010 --- 2012 Hella (Shanghai) Electronics Co., Ltd. * All rights reserved. * **************************************************************************************************/ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include "Switch_Relay_Control.h" #include "..\bus.h" #define FIX_ISSUE_DATABUS_INPUT_OUTPUT_MODE_CONFUSION_WITH_ADC void Control_Single_Switch(PST_Access_Ctrl_SwitchRelayMatrix pSingleSwitchCHn) { DWORD iCHn = pSingleSwitchCHn->dwSwitch_Relay_CHn; E_SWITCH_STATE eLEVEL = pSingleSwitchCHn->eOpen_Close_State; // Step 1 : /* * Shielding the influence on ADC and DAC circuit. */ ENAD = LOW; ENDA = HIGH; CS0 = LOW; // Step 2 : Write_Address_Bus(pSingleSwitchCHn->byteBoardID); // Step 3 : #if defined (FIX_ISSUE_DATABUS_INPUT_OUTPUT_MODE_CONFUSION_WITH_ADC) /* Issue : */ #if 0 Write_DataBus_Single_CHn(iCHn-1, eLEVEL); #else Write_DataBus_Output_Port_Mode(pSingleSwitchCHn->byteBoardID, iCHn-1, eLEVEL); #endif #endif /* End FIX_ISSUE */ /* A short delay should be inserted here. * * At last, must remember to disable chip 74ALS520. * Because it could influence other card. */ CS0 = HIGH; } void Control_Multi_Switch(PST_Access_Ctrl_SwitchRelayMatrix pSwitchCHi, ...) { va_list ap; PST_Access_Ctrl_SwitchRelayMatrix next = pSwitchCHi; va_start(ap, pSwitchCHi); while (next != NULL) { Control_Single_Switch(next); // This statement must be executed firstly here next = va_arg(ap, PST_Access_Ctrl_SwitchRelayMatrix); } va_end(ap); return; } void Control_Batch_Switch(BYTE byteBoardID, PSTSwitch_CHn_State pCHn_State, ...) { va_list marker; PSTSwitch_CHn_State next = pCHn_State; /* * Shielding the influence on ADC and DAC circuit. */ ENAD = LOW; ENDA = HIGH; CS0 = LOW; Write_Address_Bus(byteBoardID); va_start(marker, pCHn_State); while (next != NULL) { Write_DataBus_Single_CHn((next->dwSwitcch_Relay_CHn)-1, (next->eOpen_Close_State)); next = va_arg(marker, PSTSwitch_CHn_State); } va_end(marker); CS0 = HIGH; return; } void Uniformly_Control_One_Switch_Board(BYTE iBoardID, E_SWITCH_STATE eUniformState) { DWORD iCHn = 0; /* * Shielding the influence on ADC and DAC circuit. */ ENAD = LOW; ENDA = HIGH; CS0 = LOW; Write_Address_Bus(iBoardID); for (iCHn=1; iCHn<=24; iCHn++) { Write_DataBus_Single_CHn(iCHn-1, eUniformState); } CS0 = HIGH; return; }
/* * Copyright (c) 2012 Bartlomiej Siwek All rights reserved. */ #ifndef ELG_UTILITIES_FILESYSTEM_OSPATH_H_ #define ELG_UTILITIES_FILESYSTEM_OSPATH_H_ // Forward declarations namespace Elg { namespace Utilities { namespace Filesystem { class Path; } } } namespace Elg { namespace Utilities { namespace Filesystem { Path GetWorkingDirectoryPath(); Path GetExecutablePath(); bool IsPathAFile(const Path& path); bool IsPathADirectory(const Path& path); } // Filesystem } // Utilities } // Elg #endif // ELG_UTILITIES_FILESYSTEM_OSPATH_H_
// virusone/services/virus_timestamp.h // Copyright (C) 2015 Rob Colbert <rob.isConnected@gmail.com> // License: MIT #pragma once #include <string> #include <sys/time.h> namespace VirusOne { namespace Services { class Timestamp { public: Timestamp(); Timestamp(const Timestamp& timestamp); virtual ~Timestamp(); void update(); float secondsFrom(const Timestamp& timestamp) const; float secondsTo(const Timestamp& timestamp) const; std::string toString() const; static std::string now(); protected: struct timeval m_tv; }; } /* Services */ } /* VirusOne */
// // DDAViewController.h // BlickingLabel // // Created by David White on 09/02/2015. // Copyright (c) 2015 David White. All rights reserved. // @import UIKit; @import BlickingLabel; @interface DDAViewController : UIViewController @property (weak, nonatomic) IBOutlet BlinkingLabel *blinkingLabel; - (IBAction)toggleButton:(id)sender; @end
/* * Copyright (C) 2009 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> * * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with DOUBANGO. * */ #ifndef TINYROHC_CONFIG_H #define TINYROHC_CONFIG_H #ifdef __SYMBIAN32__ #undef _WIN32 /* Because of WINSCW */ #endif /* Windows (XP/Vista/7/CE and Windows Mobile) macro definition. */ #if defined(WIN32)|| defined(_WIN32) || defined(_WIN32_WCE) # define TROHC_UNDER_WINDOWS 1 #endif #if !defined(__GNUC__) && defined(TINYROHC_EXPORTS) # define TINYROHC_API __declspec(dllexport) # define TINYROHC_GEXTERN __declspec(dllexport) #elif !defined(__GNUC__) /*&& defined(TINYROHC_IMPORTS)*/ # define TINYROHC_API __declspec(dllimport) # define TINYROHC_GEXTERN __declspec(dllimport) #else # define TINYROHC_API # define TINYROHC_GEXTERN extern #endif /* Guards against C++ name mangling */ #ifdef __cplusplus # define TROHC_BEGIN_DECLS extern "C" { # define TROHC_END_DECLS } #else # define TROHC_BEGIN_DECLS # define TROHC_END_DECLS #endif /* Disable some well-known warnings */ #ifdef _MSC_VER # define _CRT_SECURE_NO_WARNINGS #endif /* Detecting C99 compilers */ #if (__STDC_VERSION__ == 199901L) && !defined(__C99__) # define __C99__ #endif #include <stdint.h> #ifdef __SYMBIAN32__ #include <stdlib.h> #endif #if HAVE_CONFIG_H #include "../config.h" #endif #endif // TINYROHC_CONFIG_H
// // MovieDetailCell.h // FreshRedGrapes // // Created by Adam Tait on 1/20/14. // Copyright (c) 2014 Adam Tait. All rights reserved. // #import <UIKit/UIKit.h> #import "Movie.h" @interface MovieDetailCell : UITableViewCell @property (weak, nonatomic) IBOutlet UILabel *titleLabel; @property (weak, nonatomic) IBOutlet UIImageView *imageView; - (id)initWithMovie:(Movie *)movie; @end
/** @file shader_dispatcher.h @brief receives the concrete class from virtual function of Node. @author HRYKY @version $Id: shader_dispatcher.h 381 2015-03-14 00:09:09Z hryky.private@gmail.com $ */ #ifndef SHADER_DISPATCHER_H_20140819115033160 #define SHADER_DISPATCHER_H_20140819115033160 #include "hryky/dispatcher.h" #include "hryky/retention/retention_value.h" #include "hryky/literal_string.h" //------------------------------------------------------------------------------ // defines macros //------------------------------------------------------------------------------ #define hryky_dispatcher \ hryky::Dispatcher12<\ Arguments,\ Assign,\ Function,\ Functions,\ Inputs,\ Literal<float>,\ Matrix<4,4>,\ Multiply,\ Outputs,\ type::Base,\ Uniforms,\ Vector<float,4>\ > #define hryky_const_dispatcher \ hryky::Dispatcher12<\ Arguments const,\ Assign const,\ Function const,\ Functions const,\ Inputs const,\ Literal<float> const,\ Matrix<4,4> const,\ Multiply const,\ Outputs const,\ type::Base const,\ Uniforms const,\ Vector<float,4> const\ > #define hryky_dispatcher_impl \ hryky::DispatcherImpl12<\ DerivedT,\ Dispatcher\ > #define hryky_const_dispatcher_impl \ hryky::DispatcherImpl12<\ DerivedT,\ ImmutableDispatcher\ > #define hryky_template_param \ typename DerivedT #define hryky_template_arg \ DerivedT //------------------------------------------------------------------------------ // declares types //------------------------------------------------------------------------------ namespace hryky { namespace shader { template < size_t Rows, size_t Columns > class Matrix; template < typename TypeT, size_t Dimension > class Vector; template < typename ValueT > class Literal; class Arguments; class Assign; class Function; class Functions; class Multiply; class Inputs; class Outputs; class Uniforms; /// receives the concrete class from virtual function of Node. class Dispatcher; /// receives the immutable concrete class from virtual function of Node. class ImmutableDispatcher; /// implements Dispatcher template <hryky_template_param> class DispatcherImpl; /// implements ImmutableDispatcher template <hryky_template_param> class ImmutableDispatcherImpl; namespace type { class Base; } // namespace type } // namespace shader } // namespace hryky //------------------------------------------------------------------------------ // declares classes //------------------------------------------------------------------------------ /** @brief receives the concrete class from virtual function of Node. */ class hryky::shader::Dispatcher : public hryky_dispatcher { public : typedef hryky_dispatcher base_type; typedef Dispatcher this_type; }; /** @brief receives the immutable concrete class from virtual function of Node. */ class hryky::shader::ImmutableDispatcher : public hryky_const_dispatcher { public : typedef hryky_const_dispatcher base_type; typedef ImmutableDispatcher this_type; }; /** @brief implements Dispatcher */ template <hryky_template_param> class hryky::shader::DispatcherImpl : public hryky_dispatcher_impl { public : typedef hryky_dispatcher_impl base_type; typedef DispatcherImpl<hryky_template_arg> this_type; }; /** @brief implements ImmutableDispatcher */ template <hryky_template_param> class hryky::shader::ImmutableDispatcherImpl : public hryky_const_dispatcher_impl { public : typedef hryky_const_dispatcher_impl base_type; typedef ImmutableDispatcherImpl<hryky_template_arg> this_type; }; //------------------------------------------------------------------------------ // specializes classes //------------------------------------------------------------------------------ namespace hryky { namespace shader { } // namespace shader } // namespace hryky //------------------------------------------------------------------------------ // defines public member functions //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // defines protected member functions //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // defines private member functions //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // declares global functions //------------------------------------------------------------------------------ namespace hryky { namespace shader { } // namespace shader } // namespace hryky //------------------------------------------------------------------------------ // defines global functions //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // revokes the temporary macros //------------------------------------------------------------------------------ #undef hryky_dispatcher #undef hryky_const_dispatcher #undef hryky_dispatcher_impl #undef hryky_const_dispatcher_impl #undef hryky_template_param #undef hryky_template_arg #endif // SHADER_DISPATCHER_H_20140819115033160 // end of file
// // TBBuildsListRowView.h // TravisBoard // // Created by Sergii Kryvoblotskyi on 6/1/15. // Copyright (c) 2015 Alterplay. All rights reserved. // #import <Cocoa/Cocoa.h> #import "TBHexToColorTransformer.h" #import "TBBackgroundColorView.h" #import "TBRoundedImageView.h" @interface TBBuildsListRowView : NSTableCellView @property (weak, nonatomic) IBOutlet NSTextField *buildColorLabel; @property (weak, nonatomic) IBOutlet TBBackgroundColorView *backgroundColorView; @property (weak, nonatomic) IBOutlet TBRoundedImageView *contributorImageView; @end
// // OGViewController.h // OGRSAEncryption // // Created by Jesper on 05/09/2015. // Copyright (c) 2014 Jesper. All rights reserved. // #import <UIKit/UIKit.h> @interface OGViewController : UIViewController @end
#pragma once #include <map> #include <string> #include <cuda_runtime_api.h> #include <pga/core/Core.h> #include <pga/core/Grid.cuh> using namespace PGA; using namespace PGA::Operators; using namespace PGA::Shapes; using namespace PGA::Parameters; namespace Scene { const std::map<size_t, size_t> GenFuncCounters = <genFuncCounters>; const unsigned int NumEdges = <numEdges>; const unsigned int NumSubgraphs = <numSubgraphs>; const bool Instrumented = <instrumented>; const size_t Idx = <idx>; const std::string Uid = "<uid>"; const unsigned int QueueSize = <queueSize>; const PGA::GPU::Technique Technique = <technique>; <code> template <unsigned int AxiomIdT> struct AxiomTraits : Grid::DefaultAxiomTraits < Box, <operatorCode> > { __host__ __device__ __inline__ static int getEntryIndex() { return <entryIdx>; } }; typedef Grid::Dynamic<AxiomTraits, 1> AxiomGenerator; struct Controller : SceneUtils::GriddedSceneController< <gridY>, <gridX> > { static const bool IsInitializable = false; static const bool HasAttributes = false; }; struct Configurator { static const bool IsFile = true; static std::string value() { return "configuration.xml"; } }; std::string testName() { return std::string("partition_<idx>_") + std::to_string(Grid::GlobalVars::getNumElements()) + ("_o" + std::to_string(<optimization>)) + ((Instrumented) ? "_i" : ""); } std::string sceneName() { return std::string("partition_<idx>") + ("_o" + std::to_string(<optimization>)) + ((Instrumented) ? "_i" : ""); } }
#import "FDRequestClientTask.h" #pragma mark - Type Definitions /** This block is called when the all the tasks in the group have finished loading. */ typedef void (^FDRequestClientTaskGroupCompletionBlock)(void); #pragma mark - Class Interface /** FDRequestClientTaskGroup allows you to group a bunch of request client tasks together and be notified when all the tasks have finished loading. */ @interface FDRequestClientTaskGroup : NSObject #pragma mark - Properties /** Adds the specified task to the group. The task is immediately suspended to ensure no tasks are running until the group is started. @param requestClientTask The task to add to the group. */ - (void)addRequestClientTask: (FDRequestClientTask *)requestClientTask; /** Adds the completion block to the list of blocks to be called when all the tasks in the group have finished loading. @param completionBlock The completion block to add. */ - (void)addCompletionBlock: (FDRequestClientTaskGroupCompletionBlock)completionBlock; /** Resumes all the tasks in the group. */ - (void)start; @end
// // Role+helper.h // Mubaloo // // Created by Rob Nash on 02/07/2014. // Copyright (c) 2014 robertnash. All rights reserved. // #import "Role.h" @interface Role (helper) +(Role*)createInContext:(NSManagedObjectContext*)context; +(Role*)createOrFetchWithName:(NSString*)name withLeadStatus:(NSNumber*)isLead inContext:(NSManagedObjectContext*)context; @end
// // Statmonitor.h // GemStone // // Created by James Foster on 7/12/12. // Copyright (c) 2012-2013 GemTalk Systems LLC. All rights reserved. // #import "DatabaseTask.h" @interface Statmonitor : DatabaseTask @end
// This file was generated based on 'C:\ProgramData\Uno\Packages\UnoCore\0.13.2\Source\Uno\Compiler\ExportTargetInterop\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #ifndef __APP_UNO_COMPILER_EXPORT_TARGET_INTEROP_TARGET_SPECIFIC_IMPLEMENTATION_ATTRIBUTE_H__ #define __APP_UNO_COMPILER_EXPORT_TARGET_INTEROP_TARGET_SPECIFIC_IMPLEMENTATION_ATTRIBUTE_H__ #include <app/Uno.Attribute.h> #include <Uno.h> namespace app { namespace Uno { namespace Compiler { namespace ExportTargetInterop { struct TargetSpecificImplementationAttribute; struct TargetSpecificImplementationAttribute__uType : ::app::Uno::Attribute__uType { }; TargetSpecificImplementationAttribute__uType* TargetSpecificImplementationAttribute__typeof(); void TargetSpecificImplementationAttribute___ObjInit_1(TargetSpecificImplementationAttribute* __this); TargetSpecificImplementationAttribute* TargetSpecificImplementationAttribute__New_1(::uStatic* __this); struct TargetSpecificImplementationAttribute : ::app::Uno::Attribute { void _ObjInit_1() { TargetSpecificImplementationAttribute___ObjInit_1(this); } }; }}}} #endif
// // EBAudioCache.h // EBAudioKit // // Created by Tyrone Trevorrow on 7/01/14. // Copyright (c) 2014 Sudeium. All rights reserved. // #import <Foundation/Foundation.h> @interface EBAudioCachedItem : NSObject <NSCoding> @property (nonatomic, copy) NSString *key; @property (nonatomic, assign) uint64_t byteSize; @property (nonatomic, readonly) NSIndexSet *cachedIndexes; // By default, we set this to key when you set key. @property (nonatomic, copy) NSString *remoteURL; // You definitely don't want to call this before setting byteSize. - (void) cacheData: (NSData*) data representingRangeInFile: (NSRange) range; - (void) close; // You definitely don't want to call this unless you're sure these bytes are available. // You definitely don't want to call this after you've called close. - (const uint8_t*) getBytesLength: (NSUInteger) maxLen fromOffset: (NSUInteger) offset; @end @interface EBAudioCache : NSObject @property (nonatomic, strong) NSURL *cacheURL; // The default cache lives at <sandbox>/Library/Caches/com.sudeium.EBAudioKit.EBAudioCache/ + (instancetype) defaultCache; + (void) setDefaultCache: (EBAudioCache*) defaultCache; - (NSURL*) cachePathForKey: (NSString*) key; // Returns a new cached item if it doesn't exist - (EBAudioCachedItem*) cachedItemForKey: (NSString*) key; - (BOOL) hasItemForKey: (NSString*) key; - (void) synchronize; - (void) cleanup; @end
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "UIView.h" @class NSMutableArray, UIButton, UILabel; // Not exported @interface SLMicroBlogActiveAccountView : UIView { NSMutableArray *_constraints; UIView *_grayPerforationView; UILabel *_fromLabel; UIButton *_activeAccountButton; } @property(retain, nonatomic) UIButton *activeAccountButton; // @synthesize activeAccountButton=_activeAccountButton; @property(retain, nonatomic) UILabel *fromLabel; // @synthesize fromLabel=_fromLabel; - (void).cxx_destruct; - (struct CGSize)intrinsicContentSize; - (void)_setupConstraints; - (void)observeValueForKeyPath:(id)arg1 ofObject:(id)arg2 change:(id)arg3 context:(void *)arg4; - (void)dealloc; - (id)initWithFrame:(struct CGRect)arg1; @end
#ifndef INPUT_PROCESSOR_H #define INPUT_PROCESSOR_H #include <iostream> #include <functional> using namespace std; namespace fe { class InputProcessor { private: string m_QuestionPrefix; string m_QuestionSuffix; public: InputProcessor(); InputProcessor(const InputProcessor& toCopy); InputProcessor& operator=(const InputProcessor& toCopy); virtual ~InputProcessor(); void setQuestionPrefix(const string& prefix); void setQuestionSuffix(const string& suffix); template<typename T> void read(const string& question, T& toSave, const function<bool(const T&)>& isRejected = nullptr) { T input; do { cout << m_QuestionPrefix << question << m_QuestionSuffix; cin >> input; if(isRejected == nullptr) { toSave = input; return; } } while(isRejected(input)); toSave = input; } }; } #endif
// // AppDelegate.h // BAAlert // // Created by boai on 2017/5/8. // Copyright © 2017年 boai. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
#ifndef __INFO_H_ #define __INFO_H_ #include "osapi.h" #if defined(DEBUG_ON) #define INFO( format, ... ) os_printf( format, ## __VA_ARGS__ ) #else #define INFO( format, ... ) #endif #endif
#ifndef __SAVEPROMPTDLG_H__ #define __SAVEPROMPTDLG_H__ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // SavePromptDlg.h : header file // ///////////////////////////////////////////////////////////////////////////// // CSavePromptDlg dialog class CSavePromptDlg : public CDialog { // Construction public: CSavePromptDlg(CWnd* pParent = NULL); // standard constructor enum enumSaveDocType { enumSaveDevDoc, enumSaveSubDoc }; class CItemInfo { public: CItemInfo(enumSaveDocType type, DWORD dwData) { m_type = type; m_dwData = dwData; } enumSaveDocType m_type; DWORD m_dwData; }; // Dialog Data //{{AFX_DATA(CSavePromptDlg) enum { IDD = IDD_SAVEPROMPT }; CListBox m_ctlListBox; //}}AFX_DATA // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CSavePromptDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(CSavePromptDlg) virtual BOOL OnInitDialog(); afx_msg void OnYes(); afx_msg void OnNo(); afx_msg void OnDestroy(); afx_msg void OnSelchangeList(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(__SAVEPROMPTDLG_H__)
#ifndef VTUI_H #define VTUI_H /* ***************************************************************************** * ___ _ _ _ _ * / _ \ __ _| |_| |__(_) |_ ___ * | (_) / _` | / / '_ \ | _(_-< * \___/\__,_|_\_\_.__/_|\__/__/ * Copyright (c) 2009 * * 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. *****************************************************************************/ /** * @file VtUi.h * @author R. Picard * @date 21/12/2009 * *****************************************************************************/ #include <Application.h> #include <String.h> #include "VtUploader.h" /** Base ui class.*/ class VtUi { public: VtUi(void); virtual ~VtUi(void); virtual status_t Start(void); virtual status_t Stop(void); virtual BHandler *GetHandler(void) = 0; status_t SetUploader(VtUploader *pc_NewUploader); protected: VtUploader *pc_Uploader; }; #endif /* VTUI_H */
// Copyright (c) 2017-2021 offa // Copyright 2011 Ciaran McHale. // // 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. #pragma once #include "danek/SchemaType.h" namespace danek { class SchemaTypeBoolean : public SchemaType { public: SchemaTypeBoolean() : SchemaType("boolean", "danek::SchemaTypeBoolan", ConfType::String) { } virtual ~SchemaTypeBoolean() { } protected: virtual void checkRule(const SchemaValidator* sv, const Configuration* cfg, const char* typeName, const StringVector& typeArgs, const char* rule) const; virtual bool isA(const SchemaValidator* sv, const Configuration* cfg, const char* value, const char* typeName, const StringVector& typeArgs, int indentLevel, StringBuffer& errSuffix) const; }; }
// CCTextScroller.h // Created by Justin Godesky on 3/11/14. #ifndef __CCTextScroller__ #define __CCTextScroller__ #include "cocos2d.h" using namespace cocos2d; class CCTextScroller : public CCNode { public: CREATE_FUNC(CCTextScroller); CCTextScroller(); virtual ~CCTextScroller(); static CCTextScroller* const create(CCLabelBMFont* const newLabel, const bool startNow = true); virtual void onExit(); /** * Starts scheduling updates to trigger showing characters. */ virtual void start(); /** * Hides all characters, keeping the same label. Sets current character to 0. */ virtual void reset(); /** * Uses current configuration to print string, taking care of the "magic". * Optional callback to be called when it's done printing. */ const bool print(const std::string string, CCAction* const extraCallback = NULL); // Getters and setters /** * Gets the label whose characters need to be shown. */ CCLabelBMFont* const getLabel() const; /** * Sets the label whose characters need to be shown. */ void setLabel(CCLabelBMFont* const newLabel); /** * Sets how long it takes for a character to trigger showing. */ void setNormalUpdateInterval(const float newUpdateInterval); /** * Sets how long it takes for a space to trigger showing. */ void setBreakUpdateInterval(const float newBreakUpdateInterval); /** * Sets how long it takes for a character to show once it's been triggered. */ void setCharacterRevealInterval(const float newCharacterRevealInterval); /** * Sets an action to be run on the label when all the letters are done triggering. */ void setOnDoneAction(CCAction* const newOnDoneAction); protected: int currentCharacter; float normalUpdateInterval; float breakUpdateInterval; float characterRevealInterval; CCLabelBMFont *label; CCAction *onDone; virtual void showNextCharacter(); }; #endif /* defined(__CCTextScroller__) */
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSCopying-Protocol.h" #import "NSObject-Protocol.h" @protocol IDEIndexable <NSObject, NSCopying> - (id)buildSettingsForMainFile:(id)arg1; - (id)localizedIndexableDescription; - (void)languageOfMainFile:(id)arg1 completionBlock:(id)arg2; - (BOOL)requiresMainThread; - (BOOL)writeProductHeaders:(id)arg1 toFile:(id)arg2 error:(id *)arg3; - (void)productHeadersInWorkspace:(id)arg1 withCompletionBlock:(id)arg2; - (id)containerForIndexables:(id)arg1 rootPaths:(id)arg2; - (id)indexableFiles; - (id)indexName; - (id)identifier; @optional @property(nonatomic) __weak id <IDEIndexable> proxy; - (id)copyWithZone:(struct _NSZone *)arg1; - (void)clearCachedBuildSettings; - (id)settingsForFile:(id)arg1; - (void)settingsForFilesInWorkspace:(id)arg1 withCompletionBlock:(id)arg2; @end
// PKMultipartInputStream.h // py.kerembellec@gmail.com @interface PKMultipartInputStream : NSInputStream - (void)addPartWithName:(NSString *)name string:(NSString *)string; - (void)addPartWithName:(NSString *)name data:(NSData *)data; - (void)addPartWithName:(NSString *)name data:(NSData *)data contentType:(NSString *)type; - (void)addPartWithName:(NSString *)name filename:(NSString*)filename data:(NSData *)data contentType:(NSString *)type; - (void)addPartWithName:(NSString *)name path:(NSString *)path; - (void)addPartWithName:(NSString *)name filename:(NSString *)filename path:(NSString *)path; - (void)addPartWithName:(NSString *)name filename:(NSString *)filename stream:(NSInputStream *)stream streamLength:(NSUInteger)streamLength; @property (nonatomic, readonly) NSString *boundary; @property (nonatomic, readonly) NSUInteger length; @end
// // RNVectorIconsManager.h // RNVectorIconsManager // // Created by Joel Arvidsson on 2015-05-29. // Copyright (c) 2015 Joel Arvidsson. All rights reserved. // #if __has_include(<React/RCTBridgeModule.h>) #import <React/RCTBridgeModule.h> #else // Compatibility for RN version < 0.40 #import "RCTBridgeModule.h" #endif #if __has_include(<React/RCTLog.h>) #import <React/RCTLog.h> #else // Compatibility for RN version < 0.40 #import "RCTLog.h" #endif FOUNDATION_EXPORT NSString *const RNVIErrorDomain; enum { RNVIGenericError = 1000, }; @interface RNVectorIconsManager : NSObject <RCTBridgeModule> - (NSString *)hexStringFromColor:(UIColor *)color; - (NSString *)generateFilePath:(NSString *)glyph withFontName:(NSString *)fontName withFontSize:(CGFloat)fontSize withColor:(UIColor *)color withExtraIdentifier:(NSString *)identifier; - (BOOL)createAndSaveGlyphImage:(NSString *)glyph withFont:(UIFont *)font withFilePath:(NSString *)filePath withColor:(UIColor *)color; @end
@import Foundation; #import "FDObjectDescriptor.h" #import "FDObjectTransformerAdapter.h" #pragma mark - Class Interface /** FDObjectTransformer allows developers to convert an instance of class A into an instance of class B as long as a transformation is defined. FDObjectTransformer has a number of transformations that it comes with out of the box: Anything to NSString NSString to NSNumber NSString to NSDate NSString to NSURL NSNumber to a UIColor or NSColor NSString to a UIColor or NSColor Anything to NSDictionary An NSArray to anything. This is a edge case scenario where the array itself is not transformed but every element in the array is instead. */ @interface FDObjectTransformer : NSObject #pragma mark - Properties /** The date formatter to use whenever transforming to or from an NSDate. */ @property (nonatomic, strong) NSDateFormatter *dateFormatter; #pragma mark - Constructors #pragma mark - Instance Methods /** Attempt to convert from into an instance of the specified objectClass. @param objectClass The class that from should be transformed into. @param from The object to transform. @return An instance of objectClass if a transformation from the class of from to the object class exists. */ - (id)objectOfClass: (Class)objectClass from: (id)from; - (id)jsonObjectFrom: (id)from; - (void)registerAdapter: (id<FDObjectTransformerAdapter>)adapter fromClass: (Class)fromClass toClass: (Class)toClass; - (void)registerDescriptor: (FDObjectDescriptor *)descriptor forClass: (Class)objectClass; - (NSArray *)descriptorsForClass: (Class)objectClass; @end
#ifndef __DEBUG_H__ #define __DEBUG_H__ #define debug(args...) printf(args) #endif
// // EMHorizontalPagingView.h // Coll // // Created by Samuel on 15/4/16. // Copyright (c) 2015年 Samuel. All rights reserved. // #import <UIKit/UIKit.h> @class MSCollectionDataSource; @protocol MSCollectionCellModel; typedef NS_ENUM(NSUInteger, MSHorizontalPagingControlAlignment) { MSHorizontalPagingControlAlignmentLeft, MSHorizontalPagingControlAlignmentCenter, MSHorizontalPagingControlAlignmentRight, }; @class MSHorizontalCollectionView; @protocol MSHorizontalCollectionViewDelegate <NSObject> - (void)MSHorizontalCollectionView:(MSHorizontalCollectionView *)collectionView didTapModel:(id<MSCollectionCellModel>)model atIndexPath:(NSIndexPath *)indexPath; @end @interface MSHorizontalCollectionView : UIView <UICollectionViewDelegate, UIScrollViewDelegate>{ UICollectionView *_collectionView; UIPageControl *_pageControl; MSCollectionDataSource *_dataSource; MSHorizontalPagingControlAlignment _alignment; UIEdgeInsets _pageControlEdgeInsets; __unsafe_unretained id<MSHorizontalCollectionViewDelegate> _delegate; } @property (nonatomic, strong, readonly) UICollectionView *collectionView; @property (nonatomic, strong, readonly) UIPageControl *pageControl; @property (nonatomic, assign) BOOL enablePageControl; @property (nonatomic, strong) MSCollectionDataSource *dataSource; @property (nonatomic, assign) MSHorizontalPagingControlAlignment alignment; @property (nonatomic, assign) UIEdgeInsets pageControlEdgeInsets; @property (nonatomic, assign) id<MSHorizontalCollectionViewDelegate> delegate; - (instancetype)initWithFrame:(CGRect)frame; @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 "apr.h" #include "apr_atomic.h" #include "apr_thread_mutex.h" APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p) { return APR_SUCCESS; } /* * Remapping function pointer type to accept apr_uint32_t's type-safely * as the arguments for as our apr_atomic_foo32 Functions */ typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_fn) (apr_uint32_t volatile *); typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_fn) (apr_uint32_t volatile *, apr_uint32_t); typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_val_fn) (apr_uint32_t volatile *, apr_uint32_t, apr_uint32_t); typedef WINBASEAPI void * (WINAPI * apr_atomic_win32_ptr_ptr_ptr_fn) (volatile void **, void *, const void *); typedef WINBASEAPI void * (WINAPI * apr_atomic_win32_ptr_ptr_fn) (volatile void **, void *); APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) { #if (defined(_M_IA64) || defined(_M_AMD64)) return InterlockedExchangeAdd(mem, val); #elif defined(__MINGW32__) return InterlockedExchangeAdd((long *)mem, val); #else return ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, val); #endif } /* Of course we want the 2's compliment of the unsigned value, val */ #pragma warning(disable: 4146) APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) { #if (defined(_M_IA64) || defined(_M_AMD64)) InterlockedExchangeAdd(mem, -val); #elif defined(__MINGW32__) InterlockedExchangeAdd((long *)mem, -val); #else ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, -val); #endif } APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem) { /* we return old value, win32 returns new value :( */ #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) return InterlockedIncrement(mem) - 1; #elif defined(__MINGW32__) return InterlockedIncrement((long *)mem) - 1; #else return ((apr_atomic_win32_ptr_fn)InterlockedIncrement)(mem) - 1; #endif } APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem) { #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) return InterlockedDecrement(mem); #elif defined(__MINGW32__) return InterlockedDecrement((long *)mem); #else return ((apr_atomic_win32_ptr_fn)InterlockedDecrement)(mem); #endif } APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) { #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) InterlockedExchange(mem, val); #elif defined(__MINGW32__) InterlockedExchange((long*)mem, val); #else ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val); #endif } APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem) { return *mem; } APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with, apr_uint32_t cmp) { #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) return InterlockedCompareExchange(mem, with, cmp); #elif defined(__MINGW32__) return InterlockedCompareExchange((long*)mem, with, cmp); #else return ((apr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem, with, cmp); #endif } APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp) { #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) return InterlockedCompareExchangePointer((void* volatile*)mem, with, (void*)cmp); #elif defined(__MINGW32__) return InterlockedCompareExchangePointer((void**)mem, with, (void*)cmp); #else /* Too many VC6 users have stale win32 API files, stub this */ return ((apr_atomic_win32_ptr_ptr_ptr_fn)InterlockedCompareExchange)(mem, with, cmp); #endif } APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) { #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) return InterlockedExchange(mem, val); #elif defined(__MINGW32__) return InterlockedExchange((long *)mem, val); #else return ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val); #endif } APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with) { #if (defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(RC_INVOKED) return InterlockedExchangePointer((void**)mem, with); #else /* Too many VC6 users have stale win32 API files, stub this */ return ((apr_atomic_win32_ptr_ptr_fn)InterlockedExchange)(mem, with); #endif }
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_KEYSTORE_H #define BITCOIN_KEYSTORE_H #include "key.h" #include "pubkey.h" #include "script/script.h" #include "script/standard.h" #include "sync.h" #include "serialize.h" #include <boost/signals2/signal.hpp> #include <boost/variant.hpp> class CBonusinfo{ private: uint160 hash; //the hash of the object int nVout; //number of output; void genHash(){ std::string temp(hashTx.ToString()+key+std::to_string(nVout)); std::vector<unsigned char> vchHash(temp.begin(),temp.end()); hash=Hash160(vchHash); } public: uint256 hashTx; //the hash of transaction; std::string key; //the users sicret key; /* The number is stored 1 unit more, * this is done so that there is no situation when the number is zero, * which leads to the inability to determine whether the code is used on this wallet or not. */ explicit CBonusinfo(std::string Key="",uint256 HashTx=uint256(), int NVout=0,bool isUsed=false){ hashTx=HashTx; key=Key; nVout=NVout+1; if(isUsed){ nVout=0-nVout; } genHash(); } int getnVout()const{ return abs(nVout)-1;} // number of vout; bool isUsed()const{return nVout<0;} // if nVout<0 then the bonus key is used else false uint160 getHash()const{return hash;} CBonusinfo& operator=(const CBonusinfo& right){ this->hash=right.hash; this->key=right.key; this->nVout=right.nVout; this->hashTx=right.hashTx; return *this; } bool operator==(const CBonusinfo& right)const{ return this->hash==right.hash; } bool operator>(const CBonusinfo& right)const{ return !(this->hash<right.hash); } bool operator<(const CBonusinfo& right)const{ return this->hash<right.hash; } template <typename Stream> void Serialize(Stream& s, int , int )const{ s<<hashTx; s<<nVout; s<<key; } template <typename Stream> void Unserialize(Stream& s, int , int ){ s>>hashTx; s>>nVout; s>>key; genHash(); } }; /** A virtual base class for key stores */ class CKeyStore { protected: mutable CCriticalSection cs_KeyStore; public: virtual ~CKeyStore() {} //! Add a key to the store. virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) =0; virtual bool AddKey(const CKey &key); //! Check whether a key corresponding to a given address is present in the store. virtual bool HaveKey(const CKeyID &address) const =0; virtual bool GetKey(const CKeyID &address, CKey& keyOut) const =0; virtual void GetKeys(std::set<CKeyID> &setAddress) const =0; virtual bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const =0; //! Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki virtual bool AddCScript(const CScript& redeemScript) =0; virtual bool HaveCScript(const CScriptID &hash) const =0; virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const =0; // Same as the methods of working with CScript but for bonus codes, add to a separate map virtual bool AddBonus(const CBonusinfo& Bonusinfo) =0; //! Support for Watch-only addresses virtual bool AddWatchOnly(const CScript &dest) =0; virtual bool RemoveWatchOnly(const CScript &dest) =0; virtual bool HaveWatchOnly(const CScript &dest) const =0; virtual bool HaveWatchOnly() const =0; }; typedef std::map<CKeyID, CKey> KeyMap; typedef std::map<CKeyID, CPubKey> WatchKeyMap; typedef std::map<CScriptID, CScript > ScriptMap; typedef std::set<CScript> WatchOnlySet; typedef std::set<CBonusinfo> Bonusinfoset; /** Basic key store, that keeps keys in an address->secret map */ class CBasicKeyStore : public CKeyStore { protected: KeyMap mapKeys; WatchKeyMap mapWatchKeys; ScriptMap mapScripts,mapBonus; WatchOnlySet setWatchOnly; Bonusinfoset setBonusinfo; public: bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey); bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const; bool HaveKey(const CKeyID &address) const { bool result; { LOCK(cs_KeyStore); result = (mapKeys.count(address) > 0); } return result; } void GetKeys(std::set<CKeyID> &setAddress) const { setAddress.clear(); { LOCK(cs_KeyStore); KeyMap::const_iterator mi = mapKeys.begin(); while (mi != mapKeys.end()) { setAddress.insert((*mi).first); mi++; } } } bool GetKey(const CKeyID &address, CKey &keyOut) const { { LOCK(cs_KeyStore); KeyMap::const_iterator mi = mapKeys.find(address); if (mi != mapKeys.end()) { keyOut = mi->second; return true; } } return false; } virtual bool AddCScript(const CScript& redeemScript); virtual bool HaveCScript(const CScriptID &hash) const; virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const; virtual bool AddBonus(const CBonusinfo& Bonusinfo); virtual bool AddWatchOnly(const CScript &dest); virtual bool RemoveWatchOnly(const CScript &dest); virtual bool HaveWatchOnly(const CScript &dest) const; virtual bool HaveWatchOnly() const; }; typedef std::vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial; typedef std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char> > > CryptedKeyMap; #endif // BITCOIN_KEYSTORE_H
/* * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004-2011, the olsr.org team - see HISTORY file * 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 olsr.org, olsrd 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. * * Visit http://www.olsr.org for more information. * * If you find this software useful feel free to make a donation * to the project. For more information see the website or contact * the copyright holders. * */ #include <fcntl.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include "common/common_types.h" #include "common/daemonize.h" #ifndef WIN32 /** * Prepare the start of a daemon. Fork into background, * but keep stdin/out/err open and a pipe connected to * the parent. Parent will wait for the exit_code * send by the child. * @return filedescriptor of pipe, -1 if an error happened */ int daemonize_prepare(void) { int fork_pipe[2]; int ret; int exit_code = -1; if (pipe(fork_pipe)) { /* error during pipe creation */ return -1; } ret = fork(); if (ret == -1) { /* first fork() failed */ return -1; } if (ret != 0) { /* parent of first fork() */ /* wait for exit_code from daemonized part */ if (read(fork_pipe[0], &exit_code, sizeof(exit_code)) != sizeof(exit_code)) { exit_code = -1; } close (fork_pipe[1]); close (fork_pipe[0]); exit(exit_code); } /* child of first fork() */ ret = fork(); if (ret == -1) { /* second fork() failed */ exit_code = -1; if (write(fork_pipe[1], &exit_code, sizeof(exit_code)) != sizeof(exit_code)) { /* there is nothing we can do here */ } exit(0); } if (ret != 0) { /* parent of second fork(), exit to detach child */ exit(0); } /* child is up, but keep pipe alive to transmit exit code later */ return fork_pipe[1]; } /** * Finalize the fork of the daemon, call the parent and * tell it to exit. * @param pipe_fd returned file desriptor of daemonize_prepare * @param exit_code exit code for parent */ void daemonize_finish(int pipe_fd, int exit_code) { if (pipe_fd == 0) { /* ignore call if pipe not set */ return; } /* tell parent to shut down with defined exit_code */ if (write(pipe_fd, &exit_code, sizeof(exit_code)) != sizeof(exit_code)) { /* there is nothing we can do here */ } /* shut down stdin/out/err */ close (STDIN_FILENO); close (STDOUT_FILENO); close (STDERR_FILENO); } #endif
// // DataMocker.h // MealRider // // Created by Jeff Ligon on 1/13/15. // Copyright (c) 2015 Visceral Origami LLC. All rights reserved. // #import <Foundation/Foundation.h> @interface DataMocker : NSObject +(NSArray*)listOfRestaurant; +(NSDictionary*)locOfRestaurant; +(NSDictionary*)imgNameForRestaurant; @end
// // LBAddressBookVC.h // iSoccer // // Created by pfg on 16/2/16. // Copyright © 2016年 iSoccer. All rights reserved. // #import <UIKit/UIKit.h> @interface LBAddressBookVC : UIViewController<UITableViewDelegate,UITableViewDataSource> @property (nonatomic, copy) NSMutableArray *personArray; @property (nonatomic, copy) NSString *jekAddressBookMessage; @end
/** * Copyright 2009 * * 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. */ // // Ported from http://github.com/whomwah/rqrcode // by Bill Jacobs. // #import "QRCorrectionLevel.h" @class QRMatrix; //////////////////////////////////////////////////////////////////////////////////////////////////// @interface QREncoder : NSObject { NSString* _str; QRCorrectionLevel _correctionLevel; int _size; int _pattern; QRMatrix* _matrix; } + (NSImage *)encode:(NSString *)str; + (NSImage *)encode:(NSString *)str size:(int)size correctionLevel:(QRCorrectionLevel)level; @end
// // YNMapKit.h // YNCommonProject // // Created by 王阳 on 2016/12/6. // Copyright © 2016年 王阳. All rights reserved. // #ifndef YNMapKit_h #define YNMapKit_h #import "MKMapView+YNBetterMaps.h" #import "MKMapView+YNMoveLogo.h" #import "MKMapView+YNZoomLevel.h" #endif /* YNMapKit_h */
/* ヘッダファイルのインクルード */ /* 既定のヘッダファイル */ #include <stdio.h> /* 標準入出力 */ #include <stdlib.h> /* 標準ユーティリティ */ #include <jpeglib.h> /* libjpeg */ /* 独自のヘッダファイル */ #include "bitmap.h" /* ビットマップ */ /* main関数の定義 */ int main(void){ /* 変数の宣言 */ FILE *fp = NULL; /* ファイルポインタfp */ bitmap_t bitmap = {0}; /* bitmap_t型bitmapを0で初期化. */ struct jpeg_decompress_struct cinfo; /* Jpeg解凍情報cinfo. */ struct jpeg_error_mgr jerr; /* Jpegエラー処理jerr. */ JSAMPARRAY line_buffer; /* 行出力バッファ */ int row_stride; /* 1行のサイズ.(幅 * 色数) */ int image_width; /* 幅 */ int image_height; /* 高さ */ int padding; /* パディング */ int bitmap_row_bytes; /* 行のバイト数.(パディング含む.) */ int bitmap_image_size; /* イメージサイズ */ unsigned char *p; /* Jpegエラー処理の初期化 */ cinfo.err = jpeg_std_error(&jerr); /* jpeg_std_errorでjerrを初期化して, 戻り値はcinfo.errに格納. */ /* Jpegファイルを開く */ fp = fopen("test.jpg", "rb"); /* fopenで"test.jpg"をバイナリ読み込みで開く. */ if (fp != NULL){ /* fpがNULLでなければ. */ /* 構造体の初期設定 */ jpeg_create_decompress(&cinfo); /* jpeg_create_decompressでcinfoを生成&初期化. */ /* ファイル入力ハンドルの設定 */ jpeg_stdio_src(&cinfo, fp); /* jpeg_stdio_srcで入力元をfpにする. */ /* ファイル情報ヘッダの読み込み */ jpeg_read_header(&cinfo, TRUE); /* jpeg_read_headerでJpeg情報ヘッダの読み込み. */ /* 解凍の開始 */ jpeg_start_decompress(&cinfo); /* jpeg_start_decompressで解凍開始. */ /* 1行のサイズ */ row_stride = cinfo.output_width * cinfo.output_components; /* 幅 * 色数 */ /* 行出力バッファの準備 */ line_buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr)&cinfo, JPOOL_IMAGE, row_stride, 1); /* line_bufferの準備. */ /* 幅, 高さ */ image_width = cinfo.image_width; image_height = cinfo.image_height; /* ピクセルビットサイズ */ padding = (image_width * 3) % 4; /* 幅 * 色数を4で割った余り. */ if (padding == 0){ padding = 4; } bitmap_row_bytes = (image_width * 3) + 4 - padding; /* 24ビットなら幅の3倍に4 - paddingを足す. */ bitmap_image_size = bitmap_row_bytes * image_height; /* ピクセルビットサイズ */ /* ビットマップファイルヘッダ */ bitmap.file_header.type = 0x4d42; /* "BM" */ bitmap.file_header.size = sizeof(bitmap_file_header_t) + sizeof(bitmap_info_header_t) + bitmap_image_size; /*FHとIHとT. */ bitmap.file_header.reserved1 = 0; bitmap.file_header.reserved2 = 0; bitmap.file_header.off_bits = sizeof(bitmap_file_header_t) + sizeof(bitmap_info_header_t); /* FHとIH. */ /* ビットマップ情報ヘッダ */ bitmap.info_header.size = sizeof(bitmap_info_header_t); bitmap.info_header.width = image_width; bitmap.info_header.height = image_height; bitmap.info_header.planes = 1; bitmap.info_header.bit_count = 24; bitmap.info_header.compression = 0; bitmap.info_header.size_image = bitmap_image_size; bitmap.info_header.x_pels_per_meter = 0; bitmap.info_header.y_pels_per_meter = 1; bitmap.info_header.clr_used = 0; bitmap.info_header.clr_important = 0; /* ピクセルビット */ bitmap.buf = (unsigned char *)malloc(sizeof(unsigned char) * bitmap_image_size); /* バッファの受け渡し */ int j = image_height - 1; while (cinfo.output_scanline < cinfo.output_height){ jpeg_read_scanlines(&cinfo, line_buffer, 1); int i; unsigned char *s = line_buffer[0]; p = &(bitmap.buf[bitmap_row_bytes * j]); for (i = 0; i < row_stride; i = i + 3){ *p++ = s[i + 2]; *p++ = s[i + 1]; *p++ = s[i]; } for (i = 0; i < 4 - padding; i++){ *p++ = 0; } j--; } /* 保存 */ save_bitmap("test.bmp", &bitmap, bitmap_image_size); /* 終了 */ jpeg_finish_decompress(&cinfo); /* 破棄 */ jpeg_destroy_decompress(&cinfo); destroy_bitmap(&bitmap); fclose(fp); } /* プログラムの終了 */ return 0; }
// Copyright (c) 2011-2013 The Bitcoin developers // Copyright (c) 2016-2019 The NPCcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_WALLETFRAME_H #define BITCOIN_QT_WALLETFRAME_H #include "askpassphrasedialog.h" #include <QFrame> #include <QMap> class BitcoinGUI; class ClientModel; class SendCoinsRecipient; class WalletModel; class WalletView; class BlockExplorer; QT_BEGIN_NAMESPACE class QStackedWidget; QT_END_NAMESPACE class WalletFrame : public QFrame { Q_OBJECT public: explicit WalletFrame(BitcoinGUI* _gui = 0); ~WalletFrame(); void setClientModel(ClientModel* clientModel); bool addWallet(const QString& name, WalletModel* walletModel); bool setCurrentWallet(const QString& name); bool removeWallet(const QString& name); void removeAllWallets(); bool handlePaymentRequest(const SendCoinsRecipient& recipient); void showOutOfSyncWarning(bool fShow); private: QStackedWidget* walletStack; BitcoinGUI* gui; ClientModel* clientModel; QMap<QString, WalletView*> mapWalletViews; bool bOutOfSync; WalletView* currentWalletView(); public slots: /** Switch to overview (home) page */ void gotoOverviewPage(); /** Switch to history (transactions) page */ void gotoHistoryPage(); /** Switch to governance page */ void gotoGovernancePage(); /** Switch to masternode page */ void gotoMasternodePage(); /** Switch to receive coins page */ void gotoReceiveCoinsPage(); /** Switch to privacy page */ void gotoPrivacyPage(); /** Switch to send coins page */ void gotoSendCoinsPage(QString addr = ""); /** Switch to explorer page */ void gotoBlockExplorerPage(); /** Show Sign/Verify Message dialog and switch to sign message tab */ void gotoSignMessageTab(QString addr = ""); /** Show Sign/Verify Message dialog and switch to verify message tab */ void gotoVerifyMessageTab(QString addr = ""); /** Show MultiSend Dialog **/ void gotoMultiSendDialog(); /** show a multisig tab **/ void gotoMultisigDialog(int index); /** Show BIP 38 tool - default to Encryption tab */ void gotoBip38Tool(); /** Encrypt the wallet */ void encryptWallet(bool status); /** Backup the wallet */ void backupWallet(); /** Change encrypted wallet passphrase */ void changePassphrase(); /** Ask for passphrase to unlock wallet temporarily */ void unlockWallet(AskPassphraseDialog::Context context); void unlockWallet(bool setContext); /** Lock wallet */ void lockWallet(); /** Toggle Wallet Lock State */ void toggleLockWallet(); /** Show used sending addresses */ void usedSendingAddresses(); /** Show used receiving addresses */ void usedReceivingAddresses(); }; #endif // BITCOIN_QT_WALLETFRAME_H
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_console_w32_spawnlp_42.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-42.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: console Read input from the console * GoodSource: Fixed string * Sink: w32_spawnlp * BadSink : execute command with spawnlp * Flow Variant: 42 Data flow: data returned from one function to another in the same source file * * */ #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 "ls" #define COMMAND_ARG2 "-la" #define COMMAND_ARG3 data #endif #include <process.h> #ifndef OMITBAD static char * badSource(char * data) { { /* Read input from the console */ size_t dataLen = strlen(data); /* if there is room in data, read into it from the console */ if (100-dataLen > 1) { /* POTENTIAL FLAW: Read data from the console */ if (fgets(data+dataLen, (int)(100-dataLen), stdin) != NULL) { /* The next few lines remove the carriage return from the string that is * inserted by fgets() */ dataLen = strlen(data); if (dataLen > 0 && data[dataLen-1] == '\n') { data[dataLen-1] = '\0'; } } else { printLine("fgets() failed"); /* Restore NUL terminator if fgets fails */ data[dataLen] = '\0'; } } } return data; } void CWE78_OS_Command_Injection__char_console_w32_spawnlp_42_bad() { char * data; char dataBuffer[100] = ""; data = dataBuffer; data = badSource(data); /* spawnlp - searches for the location of the command among * the directories specified by the PATH environment variable */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _spawnlp(_P_WAIT, COMMAND_INT, COMMAND_INT, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL); } #endif /* OMITBAD */ #ifndef OMITGOOD static char * goodG2BSource(char * data) { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); return data; } /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { char * data; char dataBuffer[100] = ""; data = dataBuffer; data = goodG2BSource(data); /* spawnlp - searches for the location of the command among * the directories specified by the PATH environment variable */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _spawnlp(_P_WAIT, COMMAND_INT, COMMAND_INT, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL); } void CWE78_OS_Command_Injection__char_console_w32_spawnlp_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()..."); CWE78_OS_Command_Injection__char_console_w32_spawnlp_42_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__char_console_w32_spawnlp_42_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* * Freescale i.MX28 USB Host driver * * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com> * on behalf of DENX Software Engineering GmbH * * SPDX-License-Identifier: GPL-2.0+ */ #include <common.h> #include <asm/io.h> #include <asm/arch/imx-regs.h> #include <errno.h> #include "ehci.h" /* This DIGCTL register ungates clock to USB */ #define HW_DIGCTL_CTRL 0x8001c000 #define HW_DIGCTL_CTRL_USB0_CLKGATE (1 << 2) #define HW_DIGCTL_CTRL_USB1_CLKGATE (1 << 16) struct ehci_mxs_port { uint32_t usb_regs; struct mxs_usbphy_regs *phy_regs; struct mxs_register_32 *pll; uint32_t pll_en_bits; uint32_t pll_dis_bits; uint32_t gate_bits; }; static const struct ehci_mxs_port mxs_port[] = { #ifdef CONFIG_EHCI_MXS_PORT0 { MXS_USBCTRL0_BASE, (struct mxs_usbphy_regs *)MXS_USBPHY0_BASE, (struct mxs_register_32 *)(MXS_CLKCTRL_BASE + offsetof(struct mxs_clkctrl_regs, hw_clkctrl_pll0ctrl0_reg)), CLKCTRL_PLL0CTRL0_EN_USB_CLKS | CLKCTRL_PLL0CTRL0_POWER, CLKCTRL_PLL0CTRL0_EN_USB_CLKS, HW_DIGCTL_CTRL_USB0_CLKGATE, }, #endif #ifdef CONFIG_EHCI_MXS_PORT1 { MXS_USBCTRL1_BASE, (struct mxs_usbphy_regs *)MXS_USBPHY1_BASE, (struct mxs_register_32 *)(MXS_CLKCTRL_BASE + offsetof(struct mxs_clkctrl_regs, hw_clkctrl_pll1ctrl0_reg)), CLKCTRL_PLL1CTRL0_EN_USB_CLKS | CLKCTRL_PLL1CTRL0_POWER, CLKCTRL_PLL1CTRL0_EN_USB_CLKS, HW_DIGCTL_CTRL_USB1_CLKGATE, }, #endif }; static int ehci_mxs_toggle_clock(const struct ehci_mxs_port *port, int enable) { struct mxs_register_32 *digctl_ctrl = (struct mxs_register_32 *)HW_DIGCTL_CTRL; int pll_offset, dig_offset; if (enable) { pll_offset = offsetof(struct mxs_register_32, reg_set); dig_offset = offsetof(struct mxs_register_32, reg_clr); writel(port->gate_bits, (u32)&digctl_ctrl->reg + dig_offset); writel(port->pll_en_bits, (u32)port->pll + pll_offset); } else { pll_offset = offsetof(struct mxs_register_32, reg_clr); dig_offset = offsetof(struct mxs_register_32, reg_set); writel(port->pll_dis_bits, (u32)port->pll + pll_offset); writel(port->gate_bits, (u32)&digctl_ctrl->reg + dig_offset); } return 0; } int __weak board_ehci_hcd_init(int port) { return 0; } int __weak board_ehci_hcd_exit(int port) { return 0; } int ehci_hcd_init(int index, enum usb_init_type init, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { int ret; uint32_t usb_base, cap_base; const struct ehci_mxs_port *port; if ((index < 0) || (index >= ARRAY_SIZE(mxs_port))) { printf("Invalid port index (index = %d)!\n", index); return -EINVAL; } ret = board_ehci_hcd_init(index); if (ret) return ret; port = &mxs_port[index]; /* Reset the PHY block */ writel(USBPHY_CTRL_SFTRST, &port->phy_regs->hw_usbphy_ctrl_set); udelay(10); writel(USBPHY_CTRL_SFTRST | USBPHY_CTRL_CLKGATE, &port->phy_regs->hw_usbphy_ctrl_clr); /* Enable USB clock */ ret = ehci_mxs_toggle_clock(port, 1); if (ret) return ret; /* Start USB PHY */ writel(0, &port->phy_regs->hw_usbphy_pwd); /* Enable UTMI+ Level 2 and Level 3 compatibility */ writel(USBPHY_CTRL_ENUTMILEVEL3 | USBPHY_CTRL_ENUTMILEVEL2 | 1, &port->phy_regs->hw_usbphy_ctrl_set); usb_base = port->usb_regs + 0x100; *hccr = (struct ehci_hccr *)usb_base; cap_base = ehci_readl(&(*hccr)->cr_capbase); *hcor = (struct ehci_hcor *)(usb_base + HC_LENGTH(cap_base)); return 0; } int ehci_hcd_stop(int index) { int ret; uint32_t usb_base, cap_base, tmp; struct ehci_hccr *hccr; struct ehci_hcor *hcor; const struct ehci_mxs_port *port; if ((index < 0) || (index >= ARRAY_SIZE(mxs_port))) { printf("Invalid port index (index = %d)!\n", index); return -EINVAL; } port = &mxs_port[index]; /* Stop the USB port */ usb_base = port->usb_regs + 0x100; hccr = (struct ehci_hccr *)usb_base; cap_base = ehci_readl(&hccr->cr_capbase); hcor = (struct ehci_hcor *)(usb_base + HC_LENGTH(cap_base)); tmp = ehci_readl(&hcor->or_usbcmd); tmp &= ~CMD_RUN; ehci_writel(&hcor->or_usbcmd, tmp); /* Disable the PHY */ tmp = USBPHY_PWD_RXPWDRX | USBPHY_PWD_RXPWDDIFF | USBPHY_PWD_RXPWD1PT1 | USBPHY_PWD_RXPWDENV | USBPHY_PWD_TXPWDV2I | USBPHY_PWD_TXPWDIBIAS | USBPHY_PWD_TXPWDFS; writel(tmp, &port->phy_regs->hw_usbphy_pwd); /* Disable USB clock */ ret = ehci_mxs_toggle_clock(port, 0); board_ehci_hcd_exit(index); return ret; }
/* The MIT License (MIT) Copyright (c) 2015 Douglas J. Bakkum 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. */ #include <btc/random.h> //#include "libbtc-config.h" #include <assert.h> #include <stdio.h> #include <string.h> #include <time.h> #ifdef WIN32 #include <windows.h> #include <wincrypt.h> #endif void btc_random_init_internal(void); btc_bool btc_random_bytes_internal(uint8_t* buf, uint32_t len, const uint8_t update_seed); static const btc_rnd_mapper default_rnd_mapper = {btc_random_init_internal, btc_random_bytes_internal}; static btc_rnd_mapper current_rnd_mapper = {btc_random_init_internal, btc_random_bytes_internal}; void btc_rnd_set_mapper_default() { current_rnd_mapper = default_rnd_mapper; } void btc_rnd_set_mapper(const btc_rnd_mapper mapper) { current_rnd_mapper = mapper; } void btc_random_init(void) { current_rnd_mapper.btc_random_init(); } btc_bool btc_random_bytes(uint8_t* buf, uint32_t len, const uint8_t update_seed) { return current_rnd_mapper.btc_random_bytes(buf, len, update_seed); } #ifdef TESTING void btc_random_init_internal(void) { srand(time(NULL)); } btc_bool btc_random_bytes_internal(uint8_t* buf, uint32_t len, uint8_t update_seed) { (void)update_seed; for (uint32_t i = 0; i < len; i++) { buf[i] = rand(); } return true; } #else void btc_random_init_internal(void) {} btc_bool btc_random_bytes_internal(uint8_t* buf, uint32_t len, const uint8_t update_seed) { #ifdef WIN32 HCRYPTPROV hProvider; int ret = CryptAcquireContextW(&hProvider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); assert(ret); ret = CryptGenRandom(hProvider, len, buf); assert(ret); CryptReleaseContext(hProvider, 0); #else (void)update_seed; //unused FILE* frand = fopen(RANDOM_DEVICE, "r"); if (!frand) { return false; } size_t len_read = fread(buf, 1, len, frand); assert(len_read == len); fclose(frand); return true; #endif } #endif
// // CollectionViewTest.h // MGSwipeDemo // // Created by Chee Han Lim on 9/1/15. // Copyright (c) 2015 Imanol Fernandez Gorostizaga. All rights reserved. // #import <UIKit/UIKit.h> @interface CollectionViewTest : UIViewController @end
#ifndef FIX50SP1_ORDERCANCELREJECT_H #define FIX50SP1_ORDERCANCELREJECT_H #include "Message.h" namespace FIX50SP1 { class OrderCancelReject : public Message { public: OrderCancelReject() : Message(MsgType()) {} OrderCancelReject(const FIX::Message& m) : Message(m) {} OrderCancelReject(const Message& m) : Message(m) {} OrderCancelReject(const OrderCancelReject& m) : Message(m) {} static FIX::MsgType MsgType() { return FIX::MsgType("9"); } OrderCancelReject( const FIX::OrderID& aOrderID, const FIX::ClOrdID& aClOrdID, const FIX::OrdStatus& aOrdStatus, const FIX::CxlRejResponseTo& aCxlRejResponseTo ) : Message(MsgType()) { set(aOrderID); set(aClOrdID); set(aOrdStatus); set(aCxlRejResponseTo); } FIELD_SET(*this, FIX::OrderID); FIELD_SET(*this, FIX::SecondaryOrderID); FIELD_SET(*this, FIX::SecondaryClOrdID); FIELD_SET(*this, FIX::ClOrdID); FIELD_SET(*this, FIX::ClOrdLinkID); FIELD_SET(*this, FIX::OrigClOrdID); FIELD_SET(*this, FIX::OrdStatus); FIELD_SET(*this, FIX::WorkingIndicator); FIELD_SET(*this, FIX::OrigOrdModTime); FIELD_SET(*this, FIX::ListID); FIELD_SET(*this, FIX::Account); FIELD_SET(*this, FIX::AcctIDSource); FIELD_SET(*this, FIX::AccountType); FIELD_SET(*this, FIX::TradeOriginationDate); FIELD_SET(*this, FIX::TradeDate); FIELD_SET(*this, FIX::TransactTime); FIELD_SET(*this, FIX::CxlRejResponseTo); FIELD_SET(*this, FIX::CxlRejReason); FIELD_SET(*this, FIX::Text); FIELD_SET(*this, FIX::EncodedTextLen); FIELD_SET(*this, FIX::EncodedText); }; } #endif
/* * Copyright(c) Sophist Solutions, Inc. 1990-2022. All rights reserved */ #include "../../StroikaPreComp.h" #include <set> #include "../Set.h" #ifndef _Stroika_Foundation_Containers_Concrete_Set_stdset_h_ #define _Stroika_Foundation_Containers_Concrete_Set_stdset_h_ /** * \file * * \version <a href="Code-Status.md#Beta">Beta</a> * * TODO: */ namespace Stroika::Foundation::Containers::Concrete { /** * \brief Set_stdset<KEY_TYPE, VALUE_TYPE, TRAITS> is an std::set-based concrete implementation of the Set<T> container pattern. * * \note Performance Notes: * Set_stdset<T> is a compact, and reasonable implementation of Set<>, and scales well. * * o size () is constant complexity * o Uses Memory::BlockAllocatorOrStdAllocatorAsAppropriate * o Additions and Removals are generally O(ln(N)) * * \note \em Thread-Safety <a href="Thread-Safety.md#C++-Standard-Thread-Safety">C++-Standard-Thread-Safety</a> * */ template <typename T> class Set_stdset : public Set<T> { private: using inherited = Set<T>; public: template <typename POTENTIALLY_ADDABLE_T> static constexpr bool IsAddable_v = inherited::template IsAddable_v<POTENTIALLY_ADDABLE_T>; using ElementEqualityComparerType = typename inherited::ElementEqualityComparerType; using value_type = typename inherited::value_type; public: /** */ template <typename INORDER_COMPARER> using STDSET = set<value_type, INORDER_COMPARER, Memory::BlockAllocatorOrStdAllocatorAsAppropriate<value_type, sizeof (value_type) <= 1024>>; public: /** * \see docs on Set<> constructor, but repalce EQUALS_COMPARER with INORDER_COMPARER */ Set_stdset (); template <typename INORDER_COMPARER, enable_if_t<Common::IsStrictInOrderComparer<INORDER_COMPARER, T> ()>* = nullptr> explicit Set_stdset (INORDER_COMPARER&& inorderComparer); Set_stdset (Set_stdset&& src) noexcept = default; Set_stdset (const Set_stdset& src) noexcept = default; Set_stdset (const initializer_list<value_type>& src); template <typename INORDER_COMPARER, enable_if_t<Common::IsStrictInOrderComparer<INORDER_COMPARER, T> ()>* = nullptr> Set_stdset (INORDER_COMPARER&& inorderComparer, const initializer_list<value_type>& src); template <typename ITERABLE_OF_ADDABLE, enable_if_t<Configuration::IsIterable_v<ITERABLE_OF_ADDABLE> and not is_base_of_v<Set_stdset<T>, decay_t<ITERABLE_OF_ADDABLE>>>* = nullptr> explicit Set_stdset (ITERABLE_OF_ADDABLE&& src); template <typename INORDER_COMPARER, typename ITERABLE_OF_ADDABLE, enable_if_t<Common::IsStrictInOrderComparer<INORDER_COMPARER, T> () and Configuration::IsIterable_v<ITERABLE_OF_ADDABLE>>* = nullptr> Set_stdset (INORDER_COMPARER&& inorderComparer, ITERABLE_OF_ADDABLE&& src); template <typename ITERATOR_OF_ADDABLE, enable_if_t<Configuration::IsIterator_v<ITERATOR_OF_ADDABLE>>* = nullptr> Set_stdset (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end); template <typename INORDER_COMPARER, typename ITERATOR_OF_ADDABLE, enable_if_t<Common::IsStrictInOrderComparer<INORDER_COMPARER, T> () and Configuration::IsIterator_v<ITERATOR_OF_ADDABLE>>* = nullptr> Set_stdset (INORDER_COMPARER&& inorderComparer, ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end); public: /** */ nonvirtual Set_stdset& operator= (Set_stdset&& rhs) noexcept = default; nonvirtual Set_stdset& operator= (const Set_stdset& rhs) = default; protected: using _IterableRepSharedPtr = typename inherited::_IterableRepSharedPtr; using _SetRepSharedPtr = typename inherited::_IRepSharedPtr; private: class IImplRepBase_; template <typename INORDER_COMPARER> class Rep_; private: nonvirtual void AssertRepValidType_ () const; }; } /* ******************************************************************************** ******************************* Implementation Details ************************* ******************************************************************************** */ #include "Set_stdset.inl" #endif /*_Stroika_Foundation_Containers_Concrete_Set_stdset_h_ */
#include "stdafx.h" #ifndef ENCRYPTED_DATA_H_ #define ENCRYPTED_DATA_H_ template <typename DataType> class EncryptedData { public: static const uint32_t DATASIZE = sizeof(DataType); typedef void (*DataProcessCallback)(DataType* data, void* arg); template <typename DataType> static void SetDataCallback(DataType* data, DataType* src) { memcpy_s(data, sizeof(DataType), src, sizeof(DataType)); } template <typename DataType> static void GetDataCallback(DataType* data, DataType* dst) { memcpy_s(dst, sizeof(DataType), data, sizeof(DataType)); } EncryptedData() { this->data_ = new BYTE[DATASIZE]; } ~EncryptedData() { delete [] this->data_; } INLINE void SetData(DataType* in) { this->Process((DataProcessCallback)EncryptedData<DataType>::SetDataCallback<DataType>, (void*)in); } INLINE void GetData(DataType* out) { this->Process((DataProcessCallback)EncryptedData<DataType>::GetDataCallback<DataType>, (void*)out); } INLINE void Process(DataProcessCallback callback, void* arg) { DataType data; this->Decode(&data); callback(&data, arg); this->Encode(&data); } private: void XOR(BYTE* in, uint32_t size, BYTE* out) { uint32_t key = (uint32_t)this ^ 0x88888888; uint32_t r = 4 - (size % 4); uint32_t r_data = 0; for (uint32_t i = 0; i < size - r; i += 4) *(uint32_t*)(out + i) = (*(uint32_t*)(in + i)) ^ key; if (r) { memcpy_s(&r_data, 4, in + size - r, r); r_data ^= key; memcpy_s(out + size - r, r, &r_data, r); } } void Decode(DataType* out) { this->XOR((BYTE*)this->data_, DATASIZE, (BYTE*)out); } void Encode(DataType* in) { this->XOR((BYTE*)in, DATASIZE, (BYTE*)this->data_); } BYTE* data_; DISALLOW_COPY_AND_ASSIGN(EncryptedData); }; #endif
#include "linkedlist.h" #include <stdio.h> #include <string.h> void cleanData(void *data) { printf("Clean %d\n", *(int*)data); } void showData(void *data) { printf("%d", *(int*)data); } void test_1() { int key_len = 2; LinkedList *list = initList(key_len); uint8_t key[2]; key[0] = 0; key[1] = 3; int data1 = 3; addNodeToList(list, makeNode((void *)&data1, key, key_len)); key[0] = 0; key[1] = 1; int data2 = 1; addNodeToList(list, makeNode((void *)&data2, key, key_len)); key[0] = 0; key[1] = 2; int data3 = 2; addNodeToList(list, makeNode((void *)&data3, key, key_len)); dumpList(list, showData); key[1] = 2; printf("Status: %d\n", deleteNode(list, key, cleanData)); dumpList(list, showData); printf("findNode: %d\n", findNode(list, key)->data); } void test_deep_copy() { int key_len = 2; LinkedList *list = initList(key_len); uint8_t key[2]; key[0] = 0; key[1] = 1; int data1 = 1; addNodeToList(list, makeNode((void *)&data1, key, key_len)); key[0] = 0; key[1] = 2; int data2 = 2; addNodeToList(list, makeNode((void *)&data2, key, key_len)); dumpList(list, showData); LinkedList *new = deepCopyList(list, sizeof(int)); dumpList(new, showData); } int main() { test_deep_copy(); return 0; }
#ifndef BONUSCODETAB_H #define BONUSCODETAB_H #include "platformstyle.h" #include <QWidget> #include "walletmodel.h" #include "clientmodel.h" #include "../txmempool.h" #include "transactionfilterproxy.h" #include <QStandardItemModel> namespace Ui { class BonusCodeTab; } class QTableView; class CBonusinfo; class BonusCodeTab : public QWidget { Q_OBJECT public: explicit BonusCodeTab (WalletModel *wmodel, const PlatformStyle *platformStyle, QWidget *parent = 0); void setWalletModel(WalletModel *wmodel); void setClientModel(ClientModel *clientModel); ~BonusCodeTab(); public Q_SLOTS: void updateBonusList(); private: void resizeEvent(QResizeEvent*); void confirmation(const CBonusinfo &info, const CTransaction &prevtx); void tableInit(QTableView*); Ui::BonusCodeTab *ui; ClientModel *clientModel; WalletModel *wmodel; const PlatformStyle *platformStyle; CWalletTx* findTx(const CScript& script); private Q_SLOTS: void Clicked(QModelIndex); void getBonusClick(bool); void CreateClick(bool); }; #endif // BONUSCODETAB_H
#ifndef SHADERRUNNER_RENDERTOFILE_DLG_H #define SHADERRUNNER_RENDERTOFILE_DLG_H // MIT License // // Copyright(c) 2017 Piotr 'utak3r' Borys // // 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. #include <QDialog> namespace Ui { class RenderToFileDialog; } class RenderToFileDialog : public QDialog { Q_OBJECT Q_PROPERTY(QString filename READ filename WRITE setFilename) Q_PROPERTY(QSize size READ size WRITE setSize) Q_PROPERTY(double aspectRatio READ aspectRatio WRITE setAspectRatio) public: explicit RenderToFileDialog(QWidget *aParent = Q_NULLPTR, Qt::WindowFlags aFlags = Qt::WindowFlags()); ~RenderToFileDialog(); void setTitle(const QString& aTitle); QString filename() const; void setFilename(const QString& aFilename); QSize size() const; void setSize(const QSize& aSize); double aspectRatio() const { return theAspectRatio; } void setAspectRatio(const double anAspect); void setVideoOptionsVisible(bool aVisible); double framerate() const; void setFramerate(double aFramerate); double duration() const; void setDuration(double aDuration); QString ffmpegPath() const; void setFfmpegPath(const QString& aPath); double oversampling() const; void setOversampling(double aValue); protected slots: void sizeValueChanged(int aValue); void keepAspectRatioToggled(bool aChecked); void browseForFile(); void browseForFfmpeg(); private: Ui::RenderToFileDialog *ui; double theAspectRatio; }; #endif // SHADERRUNNER_RENDERTOFILE_DLG_H
#ifndef XSSYNCSETTINGARRAY_H #define XSSYNCSETTINGARRAY_H #include <xsens/xsarray.h> #ifdef __cplusplus #include "xssyncsetting.h" extern "C" { #endif extern XsArrayDescriptor const XDA_DLL_API g_xsSyncSettingArrayDescriptor; #ifndef __cplusplus #define XSSYNCSETTINGSARRAY_INITIALIZER XSARRAY_INITIALIZER(&g_xsSyncSettingArrayDescriptor) struct XsSyncSetting; XSARRAY_STRUCT(XsSyncSettingArray, struct XsSyncSetting); typedef struct XsSyncSettingArray XsSyncSettingArray; XDA_DLL_API void XsSyncSettingArray_construct(XsSyncSettingArray* thisPtr, XsSize count, struct XsSyncSetting const* src); #else } // extern "C" #endif #ifdef __cplusplus struct XsSyncSettingArray : public XsArrayImpl<XsSyncSetting, g_xsSyncSettingArrayDescriptor, XsSyncSettingArray> { //! \brief Constructs an XsSyncSettingArray inline XsSyncSettingArray(XsSize sz = 0, XsSyncSetting const* src = 0) : ArrayImpl(sz, src) { } //! \brief Constructs an XsSyncSettingArray as a copy of \a other inline XsSyncSettingArray(XsSyncSettingArray const& other) : ArrayImpl(other) { } //! \brief Constructs an XsSyncSettingArray that references the data supplied in \a ref inline explicit XsSyncSettingArray(XsSyncSetting* ref, XsSize sz, XsDataFlags flags = XSDF_None) : ArrayImpl(ref, sz, flags) { } //! \brief Constructs an XsSyncSettingArray with the array bound by the supplied iterators \a beginIt and \a endIt template <typename Iterator> inline XsSyncSettingArray(Iterator beginIt, Iterator endIt) : ArrayImpl(beginIt, endIt) { } }; #endif #endif // file guard
// // PhoneDialer.h // Created by Justin McNally on 11/17/11. // Copyright (c) 2011 Kohactive. All rights reserved. // https://github.com/j-mcnally/PhoneGap-ios-PhoneDialer // // MIT Licensed // // Modified and imported by Ozgur Susoy (Social Justice Builders I.T. Services) // 2014 // #import <Cordova/CDVPlugin.h> @interface SJBDialer : CDVPlugin - (void)dial:(CDVInvokedUrlCommand*)command; - (void)hasPhone:(CDVInvokedUrlCommand*)command; @end
// // IRCommand.h // iRobotlegs // // Created by Pedr Browne on 19/09/2011. // Copyright (c) 2011 the original author or authors // Based on the Robotlegs Framework for Actionscript 3: http://www.robotlegs.org // Permission is hereby granted to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // #import <Foundation/Foundation.h> #import "IRMediatorMap.h" #import "IRCommandMapProtocol.h" @interface IRCommand : NSObject<IRCommand> { @private id<IRCommandMap> commandMap_; NSNotificationCenter *notificationCenter_; id<IRMediatorMap> mediatorMap_; id<IRInjector> injector_; } //------------------------------------------------------------------------------ // Getter / Setter //------------------------------------------------------------------------------ @property (retain, nonatomic) id<IRCommandMap> commandMap; @property (retain, nonatomic) NSNotificationCenter *notificationCenter; @property (retain, nonatomic) id<IRMediatorMap> mediatorMap; @property (retain, nonatomic) id<IRInjector> injector; //------------------------------------------------------------------------------ // API //------------------------------------------------------------------------------ -(void)execute; -(void)post:(NSNotification *)notification; @end
/* sort.c * Test program to sort a large number of integers. * * Intention is to stress virtual memory system. * * Ideally, we could read the unsorted array off of the file system, * and store the result back to the file system! */ #include "syscall.h" int A[1024]; /* size of physical memory; with code, we'll run out of space!*/ int main() { int i, j, tmp; /* first initialize the array, in reverse sorted order */ for (i = 0; i < 1024; i++) A[i] = 1024 - i; /* then sort! */ for (i = 0; i < 1023; i++) for (j = i; j < (1023 - i); j++) if (A[j] > A[j + 1]) { /* out of order -> need to swap ! */ tmp = A[j]; A[j] = A[j + 1]; A[j + 1] = tmp; } Exit(A[0]); /* and then we're done -- should be 0! */ }
/* *********************************************************************************************************************** * * Copyright (c) 2019-2022 Advanced Micro Devices, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, 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. * **********************************************************************************************************************/ /** *********************************************************************************************************************** * @file ConfigBuilderBase.h * @brief LLPC header file: contains declaration of class lgc::ConfigBuilderBase. *********************************************************************************************************************** */ #pragma once #include "lgc/CommonDefs.h" #include "lgc/state/AbiMetadata.h" #include "lgc/state/TargetInfo.h" #include "llvm/BinaryFormat/MsgPackDocument.h" namespace llvm { class LLVMContext; class Module; } // namespace llvm namespace lgc { class PipelineState; // Invalid metadata key and value which shouldn't be exported to ELF. constexpr unsigned InvalidMetadataKey = 0xFFFFFFFF; constexpr unsigned InvalidMetadataValue = 0xBAADBEEF; struct PalMetadataNoteEntry { unsigned key; unsigned value; }; // ===================================================================================================================== // Register configuration builder base class. class ConfigBuilderBase { public: ConfigBuilderBase(llvm::Module *module, PipelineState *pipelineState); ~ConfigBuilderBase(); void writePalMetadata(); protected: void addApiHwShaderMapping(ShaderStage apiStage, unsigned hwStages); unsigned setShaderHash(ShaderStage apiStage); void setNumAvailSgprs(Util::Abi::HardwareStage hwStage, unsigned value); void setNumAvailVgprs(Util::Abi::HardwareStage hwStage, unsigned value); void setUsesViewportArrayIndex(bool useViewportIndex); void setPsUsesUavs(bool value); void setPsWritesUavs(bool value); void setPsWritesDepth(bool value); void setEsGsLdsByteSize(unsigned value); void setWaveFrontSize(Util::Abi::HardwareStage hwStage, unsigned value); void setApiName(const char *value); void setPipelineType(Util::Abi::PipelineType value); void setLdsSizeByteSize(Util::Abi::HardwareStage hwStage, unsigned value); void setEsGsLdsSize(unsigned value); void setNggSubgroupSize(unsigned value); unsigned setupFloatingPointMode(ShaderStage shaderStage); void appendConfig(llvm::ArrayRef<PalMetadataNoteEntry> config); void appendConfig(unsigned key, unsigned value); bool usesViewportArrayIndex(); template <typename T> void appendConfig(const T &config) { static_assert(T::ContainsPalAbiMetadataOnly, "may only be used with structs that are fully metadata notes"); static_assert(sizeof(T) % sizeof(PalMetadataNoteEntry) == 0, "T claims to be isPalAbiMetadataOnly, but sizeof contradicts that"); appendConfig({reinterpret_cast<const PalMetadataNoteEntry *>(&config), sizeof(T) / sizeof(PalMetadataNoteEntry)}); } llvm::Module *m_module; // LLVM module being processed llvm::LLVMContext *m_context; // LLVM context PipelineState *m_pipelineState; // Pipeline state GfxIpVersion m_gfxIp; // Graphics IP version info bool m_hasVs; // Whether the pipeline has vertex shader bool m_hasTcs; // Whether the pipeline has tessellation control shader bool m_hasTes; // Whether the pipeline has tessellation evaluation shader bool m_hasGs; // Whether the pipeline has geometry shader private: // Get the MsgPack map node for the specified API shader in the ".shaders" map llvm::msgpack::MapDocNode getApiShaderNode(unsigned apiStage); // Get the MsgPack map node for the specified HW shader in the ".hardware_stages" map llvm::msgpack::MapDocNode getHwShaderNode(Util::Abi::HardwareStage hwStage); llvm::msgpack::Document *m_document; // The MsgPack document llvm::msgpack::MapDocNode m_pipelineNode; // MsgPack map node for amdpal.pipelines[0] llvm::msgpack::MapDocNode m_apiShaderNodes[ShaderStageNativeStageCount]; // MsgPack map node for each API shader's node in // ".shaders" llvm::msgpack::MapDocNode m_hwShaderNodes[unsigned(Util::Abi::HardwareStage::Count)]; // MsgPack map node for each HW shader's node in // ".hardware_stages" llvm::SmallVector<PalMetadataNoteEntry, 128> m_config; // Register/metadata configuration }; } // namespace lgc
// // PMAppDelegate.h // ProjectileMotion // // Created by Max Luzuriaga on 4/20/13. // Copyright (c) 2013 Max Luzuriaga. All rights reserved. // #import <UIKit/UIKit.h> @class PMViewController; @interface PMAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) PMViewController *viewController; @end
// // ReceiptCheck.h // Newsstand // // Created by Carlo Vigiani on 29/Oct/11. // Copyright (c) 2011 viggiosoft. All rights reserved. // #import <Foundation/Foundation.h> @protocol ReceiptCheckDelegate; @interface ReceiptCheck : NSObject<NSURLConnectionDelegate> -(void)validateSubscriptionReceipt; -(void)checkReceiptWithProductionMode:(BOOL)useProduction; @property (nonatomic,retain) NSData *receiptData; @property (nonatomic, assign) id<ReceiptCheckDelegate> delegate; @property (nonatomic, strong) NSMutableData *receivedData; @end @protocol ReceiptCheckDelegate <NSObject> -(void)receiptValidated:(BOOL)success; @end
// // BarViewController.h // DTiseChart // // Created by 徐进 on 2016/12/8. // Copyright © 2016年 studio.joshin. All rights reserved. // #import <UIKit/UIKit.h> @interface BarViewController : UIViewController @end
// // BLKBaseRequest.h // BLKNetworkDemo // // Created by HangqiLiu on 2016/10/17. // Copyright © 2016年 bianlike. All rights reserved. // #import <Foundation/Foundation.h> @class BLKBaseRequest; @protocol AFMultipartFormData; typedef NS_ENUM(NSUInteger, BLKRequestMethod) { BLKRequestMethodGET = 0, BLKRequestMethodPOST, BLKRequestMethodHEAD, BLKRequestMethodPUT, BLKRequestMethodDELETE, BLKRequestMethodPATCH }; typedef NS_ENUM(NSUInteger, BLKRequestSerializerType) { BLKRequestSerializerTypeHTTP = 0, BLKRequestSerializerTypeJSON }; typedef NS_ENUM(NSUInteger, BLKResponseSerializerType) { BLKResponseSerializerTypeHTTP = 0, BLKResponseSerializerTypeJSON }; typedef NS_ENUM(NSUInteger, BLKRequestPriority) { BLKRequestPriorityLow = -4L, BLKRequestPriorityDefault = 0, BLKRequestPriorityHigh = 4, }; typedef void (^BLKConstructingBlock)(id<AFMultipartFormData> formData); //typedef void (^BLKURLSessionTaskProgressBlock)(NSProgress *progress); @class BLKBaseRequest; typedef void (^BLKRequestCompletionBlock)(__kindof BLKBaseRequest *request); @interface BLKBaseRequest : NSObject #pragma mark - Request and Response Information @property (nonatomic, strong) NSURLSessionTask *requestTask; @property (nonatomic, strong) NSURLRequest *originalRequest; @property (nonatomic, strong) NSURLRequest *currentRequest; @property (nonatomic, strong) NSHTTPURLResponse *response; @property (nonatomic, assign) NSInteger responseStatusCode; @property (nonatomic, strong) NSDictionary *responseHeaders; @property (nonatomic, strong) NSData *responseData; @property (nonatomic, strong) NSString *responseString; @property (nonatomic, strong) NSError *error; @property (nonatomic, strong) id responseObject; @property (nonatomic, strong) id responseJSONObject; @property (nonatomic, getter=isCancelled) BOOL cancelled; @property (nonatomic, getter=isExecuting) BOOL executiong; #pragma mark - RequestConfiguration @property (nonatomic, strong) NSDictionary *userInfo; @property (nonatomic, copy) BLKRequestCompletionBlock successCompletionBlock; @property (nonatomic, copy) BLKRequestCompletionBlock failureCompletionBlock; @property (nonatomic, copy) BLKConstructingBlock constructingBodyBlock; @property (nonatomic, assign) BLKRequestPriority requestPriority; - (void)setCompletionBlockWithSuccess:(BLKRequestCompletionBlock)success failure:(BLKRequestCompletionBlock)failure; - (void)clearCompletionBlock; #pragma mark - Request Action - (void)start; - (void)stop; - (void)startWithCompletionBlockWithSuccess:(BLKRequestCompletionBlock)success failure:(BLKRequestCompletionBlock)failure; #pragma mark - Subclass Override - (void)requestSuccessPreprocessor; - (void)requestSuccessFilter; - (void)requestFaildPreprocessor; - (void)requestFaildFilter; - (NSString*)baseUrl; - (NSString*)requestUrl; - (BLKRequestMethod)requestMethod; - (NSDictionary*)requestHeaderFieldValueDictionary; - (NSURLRequest *)buildCustomRequest; - (id)requestParameters; - (NSInteger)requestTimeoutInterval; - (BLKRequestSerializerType)requestSerializer; - (BLKResponseSerializerType)responseSerializer; - (BLKRequestPriority)requestPriority; @end
/***************************************************************************** * * A simple implementation of John Conway's "Game of life" * using MPI with a one-dimensional domain decomposition * (NDIMS=1) in the x-direction. * * The system is im x jm cells and runs for nsteps iterations * Boundary conditions may be periodic or 'closed'. * *****************************************************************************/ #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <mpi.h> #define NDIMS 1 int main(int argc, char * argv[]) { const int imtot = 16; const int jmtot = 16; const int nsteps = 12; const int periodic = 1; int im, jm; int imp1, jmp1; int imp2, jmp2; int i, j, n; int i0; int live, lcount, ncount; int ** state_old; int ** state_new; /* MPI variables for communicator, and halo communication */ MPI_Comm comm; int rank, size; int dims[NDIMS]; int periods[NDIMS]; int mycoords[NDIMS]; int my_left, my_right; const int my_tagl = 9999; const int my_tagr = 9998; MPI_Request req[4]; MPI_Status status[4]; /* Message buffers */ int * sxl; /* Send in x-direction to left */ int * sxr; /* Send in x-direction to right */ int * rxl; int * rxr; /* Initialise */ MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); /* Check a regular 1-d decomposition is possible */ if (imtot % size != 0) { printf("Number of points not exactly divisible by number of MPI tasks\n"); MPI_Abort(MPI_COMM_WORLD, -1); } /* Create the one-dimensional Cartesian communicator */ /* Set the local system size */ periods[0] = periodic; dims[0]= 0; MPI_Dims_create(size, NDIMS, dims); MPI_Cart_create(MPI_COMM_WORLD, NDIMS, dims, periods, 1, &comm); MPI_Comm_rank(comm, &rank); MPI_Cart_shift(comm, 0, 1, &my_left, &my_right); MPI_Cart_coords(comm, rank, NDIMS, mycoords); im = imtot / dims[0]; jm = jmtot; imp1 = im + 1; jmp1 = jm + 1; imp2 = jm + 2; jmp2 = jm + 2; /* Allocate a two-dimensional array for both old and new state */ /* We use calloc() to provide default initialisation to zero. */ /* The 'real' system will be indexed 1 .. im, 1 .. jm */ state_old = calloc(imp2, sizeof(int *)); state_new = calloc(imp2, sizeof(int *)); assert(state_old); assert(state_new); for (i = 0; i < imp2; i++) { state_old[i] = calloc(jmp2, sizeof(int)); state_new[i] = calloc(jmp2, sizeof(int)); assert(state_old[i]); assert(state_new[i]); } /* Allocate the message buffers; for simplicity these are all of * extent jmp2 */ sxl = calloc(jmp2, sizeof(int)); sxr = calloc(jmp2, sizeof(int)); rxl = calloc(jmp2, sizeof(int)); rxr = calloc(jmp2, sizeof(int)); assert(sxl); assert(sxr); assert(rxl); assert(rxr); /* Initialize state, for example live cells marked 'X' ... * * i=i0 * * j-2 X * j-1 X X * j XX XX */ /* Every rank must test to see if the relevant points are local... * so the local x-coordinate for indexing the array should be * offset by the starting position in the global system. */ i0 = imtot/2 - mycoords[0]*im; j = jmtot/2; i = i0 - 2; if (i >= 1 && i <= im) state_old[i][j] = 1; i = i0 - 1; if (i >= 1 && i <= im) { state_old[i][j-1] = 1; state_old[i][j ] = 1; } i = i0; if (i >= 1 && i <= im) state_old[i][j-2] = 1; i = i0 + 1; if (i >= 1 && i <= im) { state_old[i][j-1] = 1; state_old[i][j ] = 1; } i = i0 + 2; if (i >= 1 && i <= im) state_old[i][j] =1; /* Time step loop (counting from 1...) */ for (n = 1; n <= nsteps; n++) { /* Pack the x-direction buffers, exchange, and unpack */ for (j = 0; j <= jmp1; j++) { sxl[j] = state_old[1][j]; sxr[j] = state_old[im][j]; } MPI_Irecv(rxr, jmp2, MPI_INT, my_right, my_tagl, comm, req); MPI_Irecv(rxl, jmp2, MPI_INT, my_left, my_tagr, comm, req + 1); MPI_Issend(sxl, jmp2, MPI_INT, my_left, my_tagl, comm, req + 2); MPI_Issend(sxr, jmp2, MPI_INT, my_right, my_tagr, comm, req + 3); MPI_Waitall(4, req, status); for (j = 1; j <= jm; j++) { state_old[0][j] = rxl[j]; state_old[imp1][j] = rxr[j]; } /* y-direction */ for (i = 0; i <= imp1; i++) { state_old[i][0] = state_old[i][jm]; state_old[i][jmp1] = state_old[i][1]; } /* Update, and keep a count of the number of live cells */ lcount = 0; for (i = 1; i <= im; i++) { for (j = 1; j <= jm; j++) { state_new[i][j] = 0; if (state_old[i][j]) lcount += 1; live = state_old[i-1][j-1] + state_old[i][j-1] + state_old[i+1][j-1] + state_old[i-1][j ] + state_old[i+1][j ] + state_old[i-1][j+1] + state_old[i][j+1] + state_old[i+1][j+1]; if (state_old[i][j]) { if (live == 2 || live == 3) { /* remains alive */ state_new[i][j] = 1; } else { /* dies */ state_new[i][j] = 0; } } else { /* currently dead */ if (live == 3) { /* new cell */ state_new[i][j] = 1; } } } } /* output */ /* for (j = 1; j <= jm; j++) { for (i = 1; i <= im; i++) { printf("%1d ", state_old[i][j]); } printf("\n"); } */ MPI_Reduce(&lcount, &ncount, 1, MPI_INT, MPI_SUM, 0, comm); if (rank == 0) { printf("Step, count %2d %2d\n", n, ncount); } /* update time levels */ for (i = 0; i < imp2; i++) { for (j = 0; j < jmp2; j++) { state_old[i][j] = state_new[i][j]; } } /* Next time step */ } /* Release resources and finish */ free(rxr); free(rxl); free(sxr); free(sxl); for (i = 0; i < imp2; i++) { free(state_new[i]); free(state_old[i]); } free(state_new); free(state_old); MPI_Comm_free(&comm); MPI_Finalize(); return 0; }
//{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by 01Menu.rc // #define IDD_ABOUTBOX 100 #define IDR_MAINFRAME 128 #define IDR_MY01METYPE 129 #define IDB_BITMAP1 130 #define IDR_MENU1 131 #define IDM_SHOW 32771 #define IDM_EXIT 32772 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 132 #define _APS_NEXT_COMMAND_VALUE 32773 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif
/* * Copyright 2010-2013 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. */ #import <Foundation/Foundation.h> #import <objc/runtime.h> #import "S3Constants.h" #import "S3Request.h" #ifdef AWS_MULTI_FRAMEWORK #import <AWSRuntime/AmazonServiceResponse.h> #else #import "../AmazonServiceResponse.h" #endif /** response headers that are common to Amazon S3 responses. * */ @interface S3Response:AmazonServiceResponse { int64_t contentLength; NSString *connectionState; NSDate *date; NSString *etag; NSString *server; bool deleteMarker; NSString *id2; NSString *versionId; NSString *serverSideEncryption; NSMutableDictionary *headers; } /** Specfies whether the connection to the server is open or closed. */ @property (nonatomic, retain) NSString *connectionState; /** The entity tag is an MD5 hash of the object that you can use to do conditional * <code>GET</code> operations using the <code>If-Modified</code> request tag with the <code>GET</code> request operation. * Amazon S3 checks the object against the provided MD5 value. If they do not match, Amazon S3 returns an error. * The ETag only reflects changes to the contents of an object, not its metadata.*/ @property (nonatomic, retain) NSString *etag; /** The name of the server that created the response. */ @property (nonatomic, retain) NSString *server; /** A special token that helps AWS troubleshoot problems. */ @property (nonatomic, retain) NSString *id2; /** The version of the object. * When you enable versioning, Amazon S3 generates a random number for objects added to a bucket. * The value is UTF-8 encoded and URL ready. * When you PUT an object in a bucket where versioning has been suspended, the version ID is always <code>null</code>. */ @property (nonatomic, retain) NSString *versionId; /** * Algorithm used for optional server side encryption. */ @property (nonatomic, retain) NSString *serverSideEncryption; /** The date and time Amazon S3 responded. */ @property (nonatomic, retain) NSDate *date; /** Specifies whether the object returned was (<code>true</code>) or was not (<code>false</code>) a Delete Marker. */ @property (nonatomic) bool deleteMarker; /** The length in bytes of the body in the response. */ @property (nonatomic) int64_t contentLength; /** Sets the value in the response corresponding to the HTTP header */ -(void)setValue:(id)value forHTTPHeaderField:(NSString *)header; /** Gets the value in the response corresponding to the HTTP header */ -(id)valueForHTTPHeaderField:(NSString *)header; /** Determines the type of a property in a response. */ -(NSString *)getTypeOfPropertyNamed:(NSString *)propertyName; @end
/* This file is part of the YAZ toolkit. * Copyright (C) 1995-2012 Index Data. * 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 Index Data 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 AND CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * \file xmalloc.h * \brief Header for memory handling functions. * * This is a set of wrapper functions for the memory allocation routines * from stdlib.h.. Such as malloc, free, realloc etc. * These functions calls exit if memory allocation fails. */ #ifndef XMALLOC_H #define XMALLOC_H #include <stddef.h> #include <yaz/yconfig.h> YAZ_BEGIN_CDECL /** \brief utility macro which calls xrealloc_f */ #define xrealloc(o, x) xrealloc_f(o, x, __FILE__, __LINE__) /** \brief utility macro which calls malloc_f */ #define xmalloc(x) xmalloc_f(x, __FILE__, __LINE__) /** \brief utility macro which calls xcalloc_f */ #define xcalloc(x,y) xcalloc_f(x,y, __FILE__, __LINE__) /** \brief utility macro which calls xfree_f */ #define xfree(x) xfree_f(x, __FILE__, __LINE__) /** \brief utility macro which calls xstrdup_f */ #define xstrdup(s) xstrdup_f(s, __FILE__, __LINE__) /** \brief utility macro which calls xstrndup_f */ #define xstrndup(s, n) xstrndup_f(s, n, __FILE__, __LINE__) /** \brief utility macro which calls malloc_trav_f */ #define xmalloc_trav(s) xmalloc_trav_f(s, __FILE__, __LINE__) /** \brief realloc \param o buffer to be reallocated \param size size of buffer to be allocated \param file fname location of use \param line line location of use \returns buffer This function is invoked via macro xrealloc in which file and line are set automatically. */ YAZ_EXPORT void *xrealloc_f(void *o, size_t size, const char *file, int line); /** \brief malloc \param size size of buffer to be allocated \param file fname location of use \param line line location of use \returns buffer This function is invoked via macro xmalloc in which file and line are set automatically. */ YAZ_EXPORT void *xmalloc_f(size_t size, const char *file, int line); /** \brief calloc \param nmemb number of members \param size size of member \param file fname location of use \param line line location of use \returns buffer This function is invoked via macro xcalloc in which file and line are set automatically. */ YAZ_EXPORT void *xcalloc_f(size_t nmemb, size_t size, const char *file, int line); /** \brief strdup \param p string to be cloned \param file fname location of use \param line line location of use \returns resulting string This function is invoked via macro xstrdup in which file and line are set automatically. */ YAZ_EXPORT char *xstrdup_f(const char *p, const char *file, int line); /** \brief strndup \param p string to be cloned \param n max size of resulting string (excluding 0) \param file fname location of use \param line line location of use \returns resulting string This function is invoked via macro xstrndup in which file and line are set automatically. */ YAZ_EXPORT char *xstrndup_f(const char *p, size_t n, const char *file, int line); /** \brief free \param p string to be freed (might be NULL) \param file fname location of use \param line line location of use This function is invoked via macro xfree in which file and line are set automatically. */ YAZ_EXPORT void xfree_f(void *p, const char *file, int line); /** \brief logs all xmalloc buffers \param s not used \param file fname location of use \param line line location of use This function is invoked via macro xmalloc_trav in which file and line are set automatically. Only if TRACE_XMALLOC > 1 this function does any real work! */ YAZ_EXPORT void xmalloc_trav_f(const char *s, const char *file, int line); YAZ_END_CDECL #endif /* * Local variables: * c-basic-offset: 4 * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab */
// // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005-2014 Simon Howard // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // DESCRIPTION: // #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "doomtype.h" #include "i_system.h" #include "m_misc.h" #include "m_argv.h" // haleyjd 20110212: warning fix int myargc; char** myargv; // // M_CheckParm // Checks for the given parameter // in the program's command line arguments. // Returns the argument number (1 to argc-1) // or 0 if not present // int M_CheckParmWithArgs(const char *check, int num_args) { int i; for (i = 1; i < myargc - num_args; i++) { if (!strcasecmp(check, myargv[i])) return i; } return 0; } // // M_ParmExists // // Returns true if the given parameter exists in the program's command // line arguments, false if not. // boolean M_ParmExists(const char *check) { return M_CheckParm(check) != 0; } int M_CheckParm(const char *check) { return M_CheckParmWithArgs(check, 0); } #define MAXARGVS 100 static void LoadResponseFile(int argv_index) { FILE *handle; int size; char *infile; char *file; char *response_filename; char **newargv; int newargc; int i, k; response_filename = myargv[argv_index] + 1; // Read the response file into memory handle = fopen(response_filename, "rb"); if (handle == NULL) { printf ("\nNo such response file!"); exit(1); } printf("Found response file %s!\n", response_filename); size = M_FileLength(handle); // Read in the entire file // Allocate one byte extra - this is in case there is an argument // at the end of the response file, in which case a '\0' will be // needed. file = malloc(size + 1); i = 0; while (i < size) { k = fread(file + i, 1, size - i, handle); if (k < 0) { I_Error("Failed to read full contents of '%s'", response_filename); } i += k; } fclose(handle); // Create new arguments list array newargv = malloc(sizeof(char *) * MAXARGVS); newargc = 0; memset(newargv, 0, sizeof(char *) * MAXARGVS); // Copy all the arguments in the list up to the response file for (i=0; i<argv_index; ++i) { newargv[i] = myargv[i]; ++newargc; } infile = file; k = 0; while(k < size) { // Skip past space characters to the next argument while(k < size && isspace(infile[k])) { ++k; } if (k >= size) { break; } // If the next argument is enclosed in quote marks, treat // the contents as a single argument. This allows long filenames // to be specified. if (infile[k] == '\"') { // Skip the first character(") ++k; newargv[newargc++] = &infile[k]; // Read all characters between quotes while (k < size && infile[k] != '\"' && infile[k] != '\n') { ++k; } if (k >= size || infile[k] == '\n') { I_Error("Quotes unclosed in response file '%s'", response_filename); } // Cut off the string at the closing quote infile[k] = '\0'; ++k; } else { // Read in the next argument until a space is reached newargv[newargc++] = &infile[k]; while(k < size && !isspace(infile[k])) { ++k; } // Cut off the end of the argument at the first space infile[k] = '\0'; ++k; } } // Add arguments following the response file argument for (i=argv_index + 1; i<myargc; ++i) { newargv[newargc] = myargv[i]; ++newargc; } myargv = newargv; myargc = newargc; #if 0 // Disabled - Vanilla Doom does not do this. // Display arguments printf("%d command-line args:\n", myargc); for (k=1; k<myargc; k++) { printf("'%s'\n", myargv[k]); } #endif } // // Find a Response File // void M_FindResponseFile(void) { int i; for (i = 1; i < myargc; i++) { if (myargv[i][0] == '@') { LoadResponseFile(i); } } } // Return the name of the executable used to start the program: char *M_GetExecutableName(void) { char *sep; sep = strrchr(myargv[0], DIR_SEPARATOR); if (sep == NULL) { return myargv[0]; } else { return sep + 1; } }
// // ZoomiFictionController.h // ZoomCocoa // // Created by Andrew Hunter on Thu Jan 22 2004. // Copyright (c) 2004 Andrew Hunter. All rights reserved. // #import <AppKit/AppKit.h> #import <WebKit/WebKit.h> #import "ZoomiFButton.h" #import "ZoomStory.h" #import "ZoomCollapsableView.h" #import "ZoomSavePreviewView.h" #import "ZoomCollapsingSplitView.h" #import "ZoomResourceDrop.h" #import "ZoomStoryTableView.h" #import "ZoomMetadata.h" #import "ZoomFlipView.h" #import "ZoomDownloadView.h" #import "ZoomDownload.h" #import "ZoomJSError.h" #import "ZoomSignPost.h" @interface ZoomiFictionController : NSWindowController { IBOutlet ZoomiFButton* addButton; IBOutlet ZoomiFButton* newgameButton; IBOutlet ZoomiFButton* continueButton; // IBOutlet ZoomiFButton* drawerButton; IBOutlet ZoomiFButton* infoButton; //IBOutlet ZoomCollapsableView* collapseView; IBOutlet ZoomFlipView* flipView; IBOutlet NSView* topPanelView; IBOutlet NSView* filterView; IBOutlet NSView* infoView; IBOutlet NSView* saveGameView; IBOutlet NSMatrix* flipButtonMatrix; IBOutlet NSView* mainView; IBOutlet NSView* browserView; IBOutlet WebView* ifdbView; IBOutlet NSTextField* currentUrl; IBOutlet NSButton* playButton; IBOutlet NSButton* forwardButton; IBOutlet NSButton* backButton; IBOutlet NSButton* homeButton; NSWindow* downloadWindow; ZoomDownloadView* downloadView; IBOutlet NSWindow* picturePreview; IBOutlet NSImageView* picturePreviewView; IBOutlet NSProgressIndicator* progressIndicator; int indicatorCount; IBOutlet NSTextView* gameDetailView; IBOutlet NSImageView* gameImageView; IBOutlet ZoomCollapsingSplitView* splitView; float splitViewPercentage; BOOL splitViewCollapsed; IBOutlet ZoomStoryTableView* mainTableView; IBOutlet NSTableView* filterTable1; IBOutlet NSTableView* filterTable2; IBOutlet NSTextField* searchField; IBOutlet NSMenu* storyMenu; IBOutlet NSMenu* saveMenu; BOOL showDrawer; BOOL needsUpdating; BOOL queuedUpdate; BOOL isFiltered; BOOL saveGamesAvailable; // Save game previews IBOutlet ZoomSavePreviewView* previewView; // Resource drop zone ZoomResourceDrop* resourceDrop; // Data source information NSMutableArray* filterSet1; NSMutableArray* filterSet2; NSMutableArray* storyList; NSString* sortColumn; // The browser BOOL usedBrowser; // YES if the browser has been used BOOL browserOn; // YES if the browser is being displayed BOOL smallBrowser; // YES if we've turned on small fonts in the browser ZoomDownload* activeDownload; // The currently active download NSTimer* downloadFadeTimer; // The fade in/out timer for the download window NSDate* downloadFadeStart; // The time the current fade operation started double initialDownloadOpacity; // The opacity when the last fade operation started ZoomStoryID* signpostId; // Story to open after the download has completed NSString* installPlugin; // The name of the plugin to install ZoomSignPost* activeSignpost; // The active signpost file BOOL downloadUpdateList; // YES if we're trying to download an update list BOOL downloadPlugin; // YES if we're trying to download a .zoomplugin file ZoomJSError* lastError; // The last error to occur } + (ZoomiFictionController*) sharediFictionController; - (IBAction) addButtonPressed: (id) sender; - (IBAction) startNewGame: (id) sender; - (IBAction) restoreAutosave: (id) sender; - (IBAction) searchFieldChanged: (id) sender; - (IBAction) changeFilter1: (id) sender; - (IBAction) changeFilter2: (id) sender; - (IBAction) deleteSavegame: (id) sender; - (IBAction) flipToFilter: (id) sender; - (IBAction) flipToInfo: (id) sender; - (IBAction) flipToSaves: (id) sender; - (IBAction) showIfDb: (id) sender; - (IBAction) showLocalGames: (id) sender; - (IBAction) goBack: (id) sender; - (IBAction) goForward: (id) sender; - (IBAction) goHome: (id) sender; - (IBAction) playIfdbGame: (id) sender; - (ZoomStory*) storyForID: (ZoomStoryID*) ident; - (void) configureFromMainTableSelection; - (void) reloadTableData; - (void) mergeiFictionFromFile: (NSString*) filename; - (NSArray*) mergeiFictionFromMetabase: (ZoomMetadata*) newData; - (void) addFiles: (NSArray *)filenames; - (void) setupSplitView; - (void) collapseSplitView; - (void) openSignPost: (NSData*) signpostFile forceDownload: (BOOL) download; @end
/* $Id: VBoxUsbCmn.h 56293 2015-06-09 14:23:56Z vboxsync $ */ /** @file * VBoxUsmCmn.h - USB device. Common defs */ /* * Copyright (C) 2011-2015 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. */ #ifndef ___VBoxUsbCmn_h___ #define ___VBoxUsbCmn_h___ #include "../cmn/VBoxDrvTool.h" #include "../cmn/VBoxUsbTool.h" #include <iprt/cdefs.h> #include <iprt/asm.h> #include <VBox/usblib-win.h> #define VBOXUSB_CFG_IDLE_TIME_MS 5000 typedef struct VBOXUSBDEV_EXT *PVBOXUSBDEV_EXT; RT_C_DECLS_BEGIN #ifdef _WIN64 #define DECLSPEC_USBIMPORT DECLSPEC_IMPORT #else #define DECLSPEC_USBIMPORT #define USBD_ParseDescriptors _USBD_ParseDescriptors #define USBD_ParseConfigurationDescriptorEx _USBD_ParseConfigurationDescriptorEx #define USBD_CreateConfigurationRequestEx _USBD_CreateConfigurationRequestEx #endif DECLSPEC_USBIMPORT PUSB_COMMON_DESCRIPTOR USBD_ParseDescriptors( IN PVOID DescriptorBuffer, IN ULONG TotalLength, IN PVOID StartPosition, IN LONG DescriptorType ); DECLSPEC_USBIMPORT PUSB_INTERFACE_DESCRIPTOR USBD_ParseConfigurationDescriptorEx( IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, IN PVOID StartPosition, IN LONG InterfaceNumber, IN LONG AlternateSetting, IN LONG InterfaceClass, IN LONG InterfaceSubClass, IN LONG InterfaceProtocol ); DECLSPEC_USBIMPORT PURB USBD_CreateConfigurationRequestEx( IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, IN PUSBD_INTERFACE_LIST_ENTRY InterfaceList ); RT_C_DECLS_END DECLHIDDEN(PVOID) vboxUsbMemAlloc(SIZE_T cbBytes); DECLHIDDEN(PVOID) vboxUsbMemAllocZ(SIZE_T cbBytes); DECLHIDDEN(VOID) vboxUsbMemFree(PVOID pvMem); #include "VBoxUsbRt.h" #include "VBoxUsbPnP.h" #include "VBoxUsbPwr.h" #include "VBoxUsbDev.h" #endif /* #ifndef ___VBoxUsbCmn_h___ */
/* * Set Instance Output Routine * by Tom Epperly * Created: 2/15/90 * Version: $Revision: 1.7 $ * Version control file: $RCSfile: setinst_io.c,v $ * Date last modified: $Date: 1997/10/28 19:20:43 $ * Last modified by: $Author: mthomas $ * * This file is part of the Ascend Language Interpreter. * * Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly * * The Ascend Language Interpreter is free software; you can redistribute * it and/or modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * The Ascend Language Interpreter is distributed in hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include<stdio.h> #include <ascend/general/platform.h> #include "setinstval.h" #include "setinst_io.h" void WriteInstSet(FILE *f, CONST struct set_t *s) { unsigned long c,len; switch(SetKind(s)){ case empty_set: FPRINTF(f,"[]"); break; case integer_set: PUTC('[',f); len = Cardinality(s); for(c=1;c<=len;c++) FPRINTF(f,(c<len) ? "%ld,": "%ld",FetchIntMember(s,c)); FPRINTF(f,"]"); break; case string_set: PUTC('[',f); len = Cardinality(s); for(c=1;c<=len;c++) { FPRINTF(f, (c<len) ? "'%s'," : "'%s'" , SCP( FetchStrMember(s,c) ) ); } FPRINTF(f,"]"); break; } }
/* * Copyright (c) 2008 Simtec Electronics * http://armlinux.simtec.co.uk/ * Ben Dooks <ben@simtec.co.uk> * * S3C2410 - GPIO lib support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ /* some boards require extra gpio capacity to support external * devices that need GPIO. */ #ifndef GPIO_SAMSUNG_S3C24XX_H #define GPIO_SAMSUNG_S3C24XX_H /* * GPIO sizes for various SoCs: * * 2410 2412 2440 2443 2416 * 2442 * ---- ---- ---- ---- ---- * A 23 22 25 16 27 * B 11 11 11 11 11 * C 16 16 16 16 16 * D 16 16 16 16 16 * E 16 16 16 16 16 * F 8 8 8 8 8 * G 16 16 16 16 8 * H 11 11 11 15 15 * J -- -- 13 16 -- * K -- -- -- -- 16 * L -- -- -- 15 14 * M -- -- -- 2 2 */ /* GPIO bank sizes */ #define S3C2410_GPIO_A_NR (32) #define S3C2410_GPIO_B_NR (32) #define S3C2410_GPIO_C_NR (32) #define S3C2410_GPIO_D_NR (32) #define S3C2410_GPIO_E_NR (32) #define S3C2410_GPIO_F_NR (32) #define S3C2410_GPIO_G_NR (32) #define S3C2410_GPIO_H_NR (32) #define S3C2410_GPIO_J_NR (32) /* technically 16. */ #define S3C2410_GPIO_K_NR (32) /* technically 16. */ #define S3C2410_GPIO_L_NR (32) /* technically 15. */ #define S3C2410_GPIO_M_NR (32) /* technically 2. */ #if CONFIG_S3C_GPIO_SPACE != 0 #error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment #endif #define S3C2410_GPIO_NEXT(__gpio) \ ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 0) #ifndef __ASSEMBLY__ enum s3c_gpio_number { S3C2410_GPIO_A_START = 0, S3C2410_GPIO_B_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_A), S3C2410_GPIO_C_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_B), S3C2410_GPIO_D_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_C), S3C2410_GPIO_E_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_D), S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E), S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F), S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G), S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H), S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J), S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K), S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L), }; #endif /* __ASSEMBLY__ */ /* S3C2410 GPIO number definitions. */ #define S3C2410_GPA(_nr) (S3C2410_GPIO_A_START + (_nr)) #define S3C2410_GPB(_nr) (S3C2410_GPIO_B_START + (_nr)) #define S3C2410_GPC(_nr) (S3C2410_GPIO_C_START + (_nr)) #define S3C2410_GPD(_nr) (S3C2410_GPIO_D_START + (_nr)) #define S3C2410_GPE(_nr) (S3C2410_GPIO_E_START + (_nr)) #define S3C2410_GPF(_nr) (S3C2410_GPIO_F_START + (_nr)) #define S3C2410_GPG(_nr) (S3C2410_GPIO_G_START + (_nr)) #define S3C2410_GPH(_nr) (S3C2410_GPIO_H_START + (_nr)) #define S3C2410_GPJ(_nr) (S3C2410_GPIO_J_START + (_nr)) #define S3C2410_GPK(_nr) (S3C2410_GPIO_K_START + (_nr)) #define S3C2410_GPL(_nr) (S3C2410_GPIO_L_START + (_nr)) #define S3C2410_GPM(_nr) (S3C2410_GPIO_M_START + (_nr)) #include <plat/gpio-cfg.h> #ifdef CONFIG_CPU_S3C244X #define S3C_GPIO_END (S3C2410_GPJ(0) + 32) #elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416) #define S3C_GPIO_END (S3C2410_GPM(0) + 32) #else #define S3C_GPIO_END (S3C2410_GPH(0) + 32) #endif #endif /* GPIO_SAMSUNG_S3C24XX_H */
#ifndef LAYOUTCONFIGWIDGET_H #define LAYOUTCONFIGWIDGET_H #include <QWidget> class LayoutConfigWidget : public QWidget { Q_OBJECT public: explicit LayoutConfigWidget(QWidget *parent = 0); signals: public slots: bool appDirChanged(const QString &path); private: QString q_appDir; }; #endif // LAYOUTCONFIGWIDGET_H
/* $NetBSD: dirent.h,v 1.35 2012/07/30 23:11:13 yamt Exp $ */ /*- * Copyright (c) 1989, 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. 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. * * @(#)dirent.h 8.2 (Berkeley) 7/28/94 */ #ifndef _DIRENT_H_ #define _DIRENT_H_ #include <sys/featuretest.h> #include <sys/types.h> /* * The kernel defines the format of directory entries returned by * the getdents(2) system call. */ #include <sys/dirent.h> #ifndef __minix #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) #define d_ino d_fileno /* backward compatibility */ #endif #endif /* !__minix */ typedef struct _dirdesc DIR; #if defined(_NETBSD_SOURCE) /* definitions for library routines operating on directories. */ #define DIRBLKSIZ 1024 /* structure describing an open directory. */ struct _dirdesc { /* * dd_fd should be kept intact to preserve ABI compat. see dirfd(). */ int dd_fd; /* file descriptor associated with directory */ /* * the rest is hidden from user. */ long dd_loc; /* offset in current buffer */ long dd_size; /* amount of data returned by getdents */ char *dd_buf; /* data buffer */ int dd_len; /* size of data buffer */ off_t dd_seek; /* magic cookie returned by getdents */ void *dd_internal; /* state for seekdir/telldir */ int dd_flags; /* flags for readdir */ void *dd_lock; /* lock for concurrent access */ }; #define dirfd(dirp) ((dirp)->dd_fd) /* flags for __opendir2() */ #define DTF_HIDEW 0x0001 /* hide whiteout entries */ #define DTF_NODUP 0x0002 /* don't return duplicate names */ #define DTF_REWIND 0x0004 /* rewind after reading union stack */ #define __DTF_READALL 0x0008 /* everything has been read */ #define __DTF_RETRY_ON_BADCOOKIE 0x0001 /* retry on EINVAL (only valid with __DTF_READALL) */ #include <sys/null.h> #endif #ifndef _KERNEL #include <sys/cdefs.h> __BEGIN_DECLS int closedir(DIR *); void rewinddir(DIR *); #ifndef __LIBC12_SOURCE__ DIR *opendir(const char *) __RENAME(__opendir30); struct dirent *readdir(DIR *) __RENAME(__readdir30); int readdir_r(DIR * __restrict, struct dirent * __restrict, struct dirent ** __restrict) __RENAME(__readdir_r30); #endif #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) void seekdir(DIR *, long); long telldir(DIR *); #endif /* defined(_NETBSD_SOURCE) || defined(_XOPEN_SOURCE) */ #if defined(_NETBSD_SOURCE) #ifndef __LIBC12_SOURCE__ DIR *fdopendir(int); DIR *__opendir2(const char *, int) __RENAME(__opendir230); int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const void *, const void *)) __RENAME(__scandir30); ssize_t getdents(int, char *, size_t) __RENAME(__getdents30); int alphasort(const void *, const void *) __RENAME(__alphasort30); #endif #endif /* defined(_NETBSD_SOURCE) */ __END_DECLS #endif /* !_KERNEL */ #endif /* !_DIRENT_H_ */
/* util.c ....... error message utilities. * C. Scott Ananian <cananian@alumni.princeton.edu> * * $Id: util.c,v 1.10 2005/03/10 01:18:20 quozl Exp $ */ #include <stdio.h> #include <stdarg.h> #include <syslog.h> #include <unistd.h> #include <stdlib.h> #include "util.h" #ifdef CODE_IN_USE //Winster Chan added 05/16/2006 #ifndef PROGRAM_NAME #define PROGRAM_NAME "pptp" #endif #endif //CODE_IN_USE Winster Chan added 05/16/2006 /* implementation of log_string, defined as extern in util.h */ char *log_string = "anon"; #ifdef CODE_IN_USE //Winster Chan added 05/16/2006 static void open_log(void) __attribute__ ((constructor)); static void close_log(void) __attribute__ ((destructor)); #endif //CODE_IN_USE Winster Chan added 05/16/2006 #define MAKE_STRING(label) \ va_list ap; \ char buf[256], string[256]; \ va_start(ap, format); \ vsnprintf(buf, sizeof(buf), format, ap); \ snprintf(string, sizeof(string), "%s %s[%s:%s:%d]: %s", \ log_string, label, func, file, line, buf); \ va_end(ap) #ifdef CODE_IN_USE //Winster Chan added 05/16/2006 /*** open log *****************************************************************/ static void open_log(void) { openlog(PROGRAM_NAME, LOG_PID, LOG_DAEMON); } /*** close log ****************************************************************/ static void close_log(void) { closelog(); } #endif //CODE_IN_USE Winster Chan added 05/16/2006 #ifdef nostrip //Modified by Silver to shrink code /*** print a message to syslog ************************************************/ void _log(const char *func, const char *file, int line, const char *format, ...) { MAKE_STRING("log"); #if defined(USE_SYSLOG) /* foxconn wklin added, 08/13/2007 */ syslog(LOG_NOTICE, "%s", string); #endif } /*** print a warning to syslog ************************************************/ void _warn(const char *func, const char *file, int line, const char *format, ...) { MAKE_STRING("warn"); fprintf(stderr, "%s\n", string); #if defined(USE_SYSLOG) /* foxconn wklin added, 08/13/2007 */ syslog(LOG_WARNING, "%s", string); #endif } /*** print a fatal warning to syslog and exit *********************************/ void _fatal(const char *func, const char *file, int line, const char *format, ...) { MAKE_STRING("fatal"); fprintf(stderr, "%s\n", string); #if defined(USE_SYSLOG) /* foxconn wklin added, 08/13/2007 */ syslog(LOG_CRIT, "%s", string); #endif exit(1); } #endif /*** connect a file to a file descriptor **************************************/ int file2fd(const char *path, const char *mode, int fd) { int ok = 0; FILE *file = NULL; file = fopen(path, mode); if (file != NULL && dup2(fileno(file), fd) != -1) ok = 1; if (file) fclose(file); return ok; } /* signal to pipe delivery implementation */ #include <unistd.h> #include <fcntl.h> #include <signal.h> #include <string.h> /* pipe private to process */ static int sigpipe[2]; /* create a signal pipe, returns 0 for success, -1 with errno for failure */ int sigpipe_create() { int rc; rc = pipe(sigpipe); if (rc < 0) return rc; fcntl(sigpipe[0], F_SETFD, FD_CLOEXEC); fcntl(sigpipe[1], F_SETFD, FD_CLOEXEC); #ifdef O_NONBLOCK #define FLAG_TO_SET O_NONBLOCK #else #ifdef SYSV #define FLAG_TO_SET O_NDELAY #else /* BSD */ #define FLAG_TO_SET FNDELAY #endif #endif rc = fcntl(sigpipe[1], F_GETFL); if (rc != -1) rc = fcntl(sigpipe[1], F_SETFL, rc | FLAG_TO_SET); if (rc < 0) return rc; return 0; #undef FLAG_TO_SET } /* generic handler for signals, writes signal number to pipe */ void sigpipe_handler(int signum) { write(sigpipe[1], &signum, sizeof(signum)); signal(signum, sigpipe_handler); } /* assign a signal number to the pipe */ void sigpipe_assign(int signum) { sigset_t sigset; struct sigaction sa; sigemptyset(&sigset); sigaddset(&sigset, signum); memset(&sa, 0, sizeof(sa)); sa.sa_handler = sigpipe_handler; sigaction(signum, &sa, NULL); } /* return the signal pipe read file descriptor for select(2) */ int sigpipe_fd() { return sigpipe[0]; } /* read and return the pending signal from the pipe */ int sigpipe_read() { int signum; read(sigpipe[0], &signum, sizeof(signum)); return signum; } void sigpipe_close() { close(sigpipe[0]); close(sigpipe[1]); }
/* * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software and related documentation * and any modifications thereto. Any use, reproduction, disclosure or * distribution of this software and related documentation without an express * license agreement from NVIDIA CORPORATION is strictly prohibited. */ #include "nvos.h" #include "nvapputil.h" #include "nv3p.h" #include "nvflash_configfile.h" #include "nvflash_commands.h" NvU32 nvflash_create_filesystem_image(void); NvU32 nvflash_create_kernel_image(void);
#ifndef SIM_PROFILE_H #define SIM_PROFILE_H #include <QSharedPointer> #include <QString> #include <QStringList> #include "cfg.h" #include "plugins.h" namespace SIM { class EXPORT Profile { public: Profile(const QString& name = ""); Profile(const ConfigPtr& conf, const QString& name = ""); virtual ~Profile(); ConfigPtr config(); void setConfig(const ConfigPtr& conf); QString name(); QStringList enabledPlugins(); void enablePlugin(const QString& name); void disablePlugin(const QString& name); void loadPlugins(); protected: void addPlugin(const QString& name); void removePlugin(const QString& name); private: QString m_name; ConfigPtr m_config; QList<PluginPtr> m_plugins; }; typedef QSharedPointer<Profile> ProfilePtr; } #endif // vim: set expandtab:
/* salsa20-core-internal.c * * Internal interface to the Salsa20 core function. */ /* nettle, low-level cryptographics library * * Copyright (C) 2012 Simon Josefsson, Niels Möller * * The nettle library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at your * option) any later version. * * The nettle library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the nettle library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02111-1301, USA. */ /* Based on: salsa20-ref.c version 20051118 D. J. Bernstein Public domain. */ #if HAVE_CONFIG_H # include "config.h" #endif #include <assert.h> #include <string.h> #include "salsa20.h" #include "macros.h" #ifdef WORDS_BIGENDIAN #define LE_SWAP32(v) \ ((ROTL32(8, v) & 0x00FF00FFUL) | \ (ROTL32(24, v) & 0xFF00FF00UL)) #else #define LE_SWAP32(v) (v) #endif #define QROUND(x0, x1, x2, x3) do { \ x1 ^= ROTL32(7, x0 + x3); \ x2 ^= ROTL32(9, x1 + x0); \ x3 ^= ROTL32(13, x2 + x1); \ x0 ^= ROTL32(18, x3 + x2); \ } while(0) void _salsa20_core(uint32_t *dst, const uint32_t *src, unsigned rounds) { uint32_t x[_SALSA20_INPUT_LENGTH]; unsigned i; assert ( (rounds & 1) == 0); memcpy (x, src, sizeof(x)); for (i = 0; i < rounds;i += 2) { QROUND(x[0], x[4], x[8], x[12]); QROUND(x[5], x[9], x[13], x[1]); QROUND(x[10], x[14], x[2], x[6]); QROUND(x[15], x[3], x[7], x[11]); QROUND(x[0], x[1], x[2], x[3]); QROUND(x[5], x[6], x[7], x[4]); QROUND(x[10], x[11], x[8], x[9]); QROUND(x[15], x[12], x[13], x[14]); } for (i = 0; i < _SALSA20_INPUT_LENGTH; i++) { uint32_t t = x[i] + src[i]; dst[i] = LE_SWAP32 (t); } }
#ifndef LINUX_MMC_IOCTL_H #define LINUX_MMC_IOCTL_H #if 0 /* Not use at PremiaV */ // [[[[[[[[[ added by P10458, 2012-04-05 #include "card.h" // ]]]]]]]]] added by P10458, 2012-04-05 #endif struct mmc_ioc_cmd { /* Implies direction of data. true = write, false = read */ int write_flag; /* Application-specific command. true = precede with CMD55 */ int is_acmd; __u32 opcode; __u32 arg; __u32 response[4]; /* CMD response */ unsigned int flags; unsigned int blksz; unsigned int blocks; /* * Sleep at least postsleep_min_us useconds, and at most * postsleep_max_us useconds *after* issuing command. Needed for * some read commands for which cards have no other way of indicating * they're ready for the next command (i.e. there is no equivalent of * a "busy" indicator for read operations). */ unsigned int postsleep_min_us; unsigned int postsleep_max_us; /* * Override driver-computed timeouts. Note the difference in units! */ unsigned int data_timeout_ns; unsigned int cmd_timeout_ms; /* * For 64-bit machines, the next member, ``__u64 data_ptr``, wants to * be 8-byte aligned. Make sure this struct is the same size when * built for 32-bit. */ __u32 __pad; /* DAT buffer */ __u64 data_ptr; }; #define mmc_ioc_cmd_set_data(ic, ptr) ic.data_ptr = (__u64)(unsigned long) ptr #define MMC_IOC_CMD _IOWR(MMC_BLOCK_MAJOR, 0, struct mmc_ioc_cmd) #if 0 /* Not use at PremiaV */ // [[[[[[[[[[[[[[[ added by P10458, 2012-04-05 struct mmc_ioc_cmd_extend { struct sd_ssr ssr; /* SD_STATUS */ u32 ccs; /* if ccs = 0, SDSC, otherwise if ccs = 1, SDHC or SDXC */ u32 capacity_of_protected_area_in_byte; /* the capacity of procted area, see the "struct sd_ssr" */ u32 card_status; /* card status */ u32 capacity; /* user data area capacity (not include the protected area) KB unit */ }; #define MMC_IOC_CMD_EXTEND _IOR(MMC_BLOCK_MAJOR, 1, struct mmc_ioc_cmd_extend) // ]]]]]]]]]]]]]]] added by P10458, 2012-04-05 #endif /* * Since this ioctl is only meant to enhance (and not replace) normal access * to the mmc bus device, an upper data transfer limit of MMC_IOC_MAX_BYTES * is enforced per ioctl call. For larger data transfers, use the normal * block device operations. */ #define MMC_IOC_MAX_BYTES (512L * 256) #endif /* LINUX_MMC_IOCTL_H */
// // MyAlerView.h // LearnEnglish // // Created by zhixu jia on 12-3-31. // Copyright (c) 2012年 xuling. All rights reserved. // #import <UIKit/UIKit.h> @interface MyAlerView : UIView { NSTimeInterval _delay; } + (id) sharedAler; - (void) ViewShow:(NSString *)info; @end
/* $Id$ */ /* * Some of the X headers are not very friendly in terms of namespace. * For example, X.h typedef's Mask but we use Mask in the core of pcb * and this causes problem. To avoid this, pull in the X headers in * this file where we can add workarounds as needed. */ #define Mask X_Mask #include <X11/Intrinsic.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/cursorfont.h> #include <X11/keysym.h> #include <Xm/CascadeB.h> #include <Xm/DrawingA.h> #include <Xm/FileSB.h> #include <Xm/Form.h> #include <Xm/Frame.h> #include <Xm/Label.h> #include <Xm/List.h> #include <Xm/MainW.h> #include <Xm/MenuShell.h> #include <Xm/MessageB.h> #include <Xm/Protocols.h> #include <Xm/PushB.h> #include <Xm/RowColumn.h> #include <Xm/Scale.h> #include <Xm/ScrollBar.h> #include <Xm/ScrolledW.h> #include <Xm/Separator.h> #include <Xm/Text.h> #include <Xm/TextF.h> #include <Xm/ToggleB.h> #include <Xm/Xm.h> #ifdef HAVE_XRENDER #include <X11/extensions/Xrender.h> #endif /* HAVE_XRENDER */ #ifdef HAVE_XINERAMA #include <X11/extensions/Xinerama.h> #endif /* HAVE_XINERAMA */ #undef Mask
/* gEDA - GPL Electronic Design Automation * libgeda - gEDA's library * Copyright (C) 1998-2010 Ales Hvezda * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <config.h> #include <stdio.h> #include <sys/types.h> #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_STRING_H #include <string.h> #endif #include "libgeda_priv.h" #define MAX_ATTRIBS 128 /*! \brief */ struct st_attrib_names { char *attrib_name; }; /*! \brief */ static int attrib_index=0; /*! \brief */ /* and eventually make this unlimited */ /* hack hack */ static struct st_attrib_names attrib[MAX_ATTRIBS]; /*! \todo Finish function documentation!!! * \brief * \par Function Description * */ int s_attrib_add_entry(char *new_attrib) { if (new_attrib == NULL) { return(-1); } if (attrib_index >= MAX_ATTRIBS) { return(-1); } attrib[attrib_index].attrib_name = g_strdup (new_attrib); attrib_index++; return(attrib_index); } /*! \todo Finish function documentation!!! * \brief * \par Function Description * */ void s_attrib_print() { int i; for (i = 0; i < attrib_index; i++) { printf("%s\n", attrib[i].attrib_name); } } /*! \todo Finish function documentation!!! * \brief * \par Function Description * */ /* true for uniqueness, zero for duplication */ int s_attrib_uniq(char *name) { int i; for (i = 0; i < attrib_index; i++) { if (strcmp(attrib[i].attrib_name, name) == 0) { return(0); } } return(1); } /*! \todo Finish function documentation!!! * \brief * \par Function Description * */ void s_attrib_free() { int i; for (i = 0; i < attrib_index; i++) { g_free(attrib[i].attrib_name); } attrib_index=0; } /*! \todo Finish function documentation!!! * \brief * \par Function Description * */ void s_attrib_init() { int i; for (i = 0; i < MAX_ATTRIBS; i++) { attrib[i].attrib_name = NULL; } } /*! \todo Finish function documentation!!! * \brief * \par Function Description * */ char *s_attrib_get(int counter) { if (counter < attrib_index) { return(attrib[counter].attrib_name); } return(NULL); }
/* * Copyright (C) 2004-2007 Imendio AB * Copyright (C) 2007-2010 Collabora Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA * * Authors: Xavier Claessens <xclaesse@gmail.com> * Martyn Russell <martyn@imendio.com> */ #ifndef __EMPATHY_CHATROOM_MANAGER_H__ #define __EMPATHY_CHATROOM_MANAGER_H__ #include <glib-object.h> #include <telepathy-glib/telepathy-glib.h> #include "empathy-chatroom.h" G_BEGIN_DECLS #define EMPATHY_TYPE_CHATROOM_MANAGER (empathy_chatroom_manager_get_type ()) #define EMPATHY_CHATROOM_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManager)) #define EMPATHY_CHATROOM_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManagerClass)) #define EMPATHY_IS_CHATROOM_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CHATROOM_MANAGER)) #define EMPATHY_IS_CHATROOM_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CHATROOM_MANAGER)) #define EMPATHY_CHATROOM_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManagerClass)) typedef struct _EmpathyChatroomManager EmpathyChatroomManager; typedef struct _EmpathyChatroomManagerClass EmpathyChatroomManagerClass; struct _EmpathyChatroomManager { GObject parent; gpointer priv; }; struct _EmpathyChatroomManagerClass { GObjectClass parent_class; }; GType empathy_chatroom_manager_get_type (void) G_GNUC_CONST; EmpathyChatroomManager * empathy_chatroom_manager_dup_singleton ( const gchar *file); gboolean empathy_chatroom_manager_add (EmpathyChatroomManager *manager, EmpathyChatroom *chatroom); void empathy_chatroom_manager_remove (EmpathyChatroomManager *manager, EmpathyChatroom *chatroom); EmpathyChatroom * empathy_chatroom_manager_find ( EmpathyChatroomManager *manager, TpAccount *account, const gchar *room); EmpathyChatroom * empathy_chatroom_manager_ensure_chatroom ( EmpathyChatroomManager *manager, TpAccount *account, const gchar *room, const gchar *name); GList * empathy_chatroom_manager_get_chatrooms (EmpathyChatroomManager *manager, TpAccount *account); G_END_DECLS #endif /* __EMPATHY_CHATROOM_MANAGER_H__ */
/*************************************************************************** * * Copyright (c) 2000-2015 BalaBit IT Ltd, Budapest, Hungary * Copyright (c) 2015-2018 BalaSys IT Ltd, Budapest, Hungary * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ #ifndef ZORP_MODULES_TELNET_TELNETPROTOCOL_H_INCLUDED #define ZORP_MODULES_TELNET_TELNETPROTOCOL_H_INCLUDED #include <zorp/zorp.h> #include <zorpll/packetbuf.h> typedef enum _TelnetProtocolState { PROTO_STATE_DATA, PROTO_STATE_ESCAPED, PROTO_STATE_OPNEG, PROTO_STATE_SUBNEG, PROTO_STATE_SUBNEG_ESCAPED, PROTO_STATE_QUIT, } TelnetProtocolState; typedef gboolean (*TelnetProtocolReceivedCallback)(ZPktBuf *data, gpointer user_data); typedef gboolean (*TelnetProtocolCommandReceivedCallback)(guint8 command, gpointer user_data); typedef gboolean (*TelnetProtocolOpnegReceivedCallback)(guint8 command, guint8 option, gpointer user_data); typedef struct _TelnetProtocol { gchar *session_id; TelnetProtocolState state; /* buffers */ ZPktBuf *data_buffer; ZPktBuf *subneg_buffer; guint8 command; /* callbacks */ TelnetProtocolReceivedCallback data_received; gpointer data_received_user_data; TelnetProtocolReceivedCallback subneg_received; gpointer subneg_received_user_data; TelnetProtocolCommandReceivedCallback command_received; gpointer command_received_user_data; TelnetProtocolOpnegReceivedCallback opneg_received; gpointer opneg_received_user_data; } TelnetProtocol; void telnet_protocol_init(TelnetProtocol *self, const gchar *session_id); void telnet_protocol_destroy(TelnetProtocol *self); void telnet_protocol_set_data_received(TelnetProtocol *self, TelnetProtocolReceivedCallback callback, gpointer user_data); void telnet_protocol_set_subneg_received(TelnetProtocol *self, TelnetProtocolReceivedCallback callback, gpointer user_data); void telnet_protocol_set_command_received(TelnetProtocol *self, TelnetProtocolCommandReceivedCallback callback, gpointer user_data); void telnet_protocol_set_opneg_received(TelnetProtocol *self, TelnetProtocolOpnegReceivedCallback callback, gpointer user_data); void telnet_protocol_process_data(TelnetProtocol *self, ZPktBuf *data); gboolean telnet_protocol_is_running(TelnetProtocol *self); void telnet_protocol_escape_data(ZPktBuf *data); #endif /* # Local Variables: # indent-tabs-mode: nil # End: */
/* * * Copyright (c) International Business Machines Corp., 2001 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * NAME * msgrcv03.c * * DESCRIPTION * msgrcv03 - test for EINVAL error * * ALGORITHM * create a message queue with read/write permissions * loop if that option was specified * call msgrcv() using two different invalid cases * check the errno value * issue a PASS message if we get EINVAL * otherwise, the tests fails * issue a FAIL message * call cleanup * * USAGE: <for command-line> * msgrcv03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] * where, -c n : Run n copies concurrently. * -e : Turn on errno logging. * -i n : Execute test n times. * -I x : Execute test for x seconds. * -P x : Pause for x seconds between iterations. * -t : Turn on syscall timing. * * HISTORY * 03/2001 - Written by Wayne Boyer * * RESTRICTIONS * none */ #include "test.h" #include "usctest.h" #include "ipcmsg.h" void cleanup(void); void setup(void); char *TCID = "msgrcv03"; int TST_TOTAL = 2; int exp_enos[] = { EINVAL, 0 }; /* 0 terminated list of expected errnos */ int msg_q_1 = -1; /* The message queue id created in setup */ int bad_q = -1; /* a value to use as a bad queue ID */ MSGBUF rcv_buf; struct test_case_t { int *queue_id; int msize; int error; } TC[] = { /* EINVAL - the queue ID is invalid */ { &bad_q, MSGSIZE, EINVAL}, /* EINVAL - the message size is less than 0 */ { &msg_q_1, -1, EINVAL} }; int main(int ac, char **av) { int lc; /* loop counter */ char *msg; /* message returned from parse_opts */ int i; /* parse standard options */ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) { tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); } setup(); /* global setup */ /* The following loop checks looping state if -i option given */ for (lc = 0; TEST_LOOPING(lc); lc++) { /* reset Tst_count in case we are looping */ Tst_count = 0; for (i = 0; i < TST_TOTAL; i++) { /* * Use the TEST macro to make the call */ TEST(msgrcv(*(TC[i].queue_id), &rcv_buf, TC[i].msize, 1, 0)); if (TEST_RETURN != -1) { tst_resm(TFAIL, "call succeeded unexpectedly"); continue; } TEST_ERROR_LOG(TEST_ERRNO); if (TEST_ERRNO == TC[i].error) { tst_resm(TPASS, "expected failure - errno = " "%d : %s", TEST_ERRNO, strerror(TEST_ERRNO)); } else { tst_resm(TFAIL, "call failed with an " "unexpected error - %d : %s", TEST_ERRNO, strerror(TEST_ERRNO)); } } } cleanup(); tst_exit(); } /* * setup() - performs all the ONE TIME setup for this test. */ void setup(void) { tst_sig(NOFORK, DEF_HANDLER, cleanup); /* Set up the expected error numbers for -e option */ TEST_EXP_ENOS(exp_enos); TEST_PAUSE; /* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. * See ../lib/libipc.c for more information. */ tst_tmpdir(); msgkey = getipckey(); /* create a message queue with read/write permission */ if ((msg_q_1 = msgget(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW)) == -1) { tst_brkm(TBROK, cleanup, "Can't create message queue"); } } /* * cleanup() - performs all the ONE TIME cleanup for this test at completion * or premature exit. */ void cleanup(void) { /* if it exists, remove the message queue that was created */ rm_queue(msg_q_1); tst_rmdir(); /* * print timing stats if that option was specified. * print errno log if that option was specified. */ TEST_CLEANUP; }
/* * * (C) COPYRIGHT 2011-2013 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * * A copy of the licence is included with the program, and can also be obtained * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ /** * @file mali_kbase_security.c * Base kernel security capability API */ #include <kbase/src/common/mali_kbase.h> static inline mali_bool kbasep_am_i_root(void) { #if KBASE_HWCNT_DUMP_BYPASS_ROOT return MALI_TRUE; #else /* Check if root */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0) if (uid_eq(current_euid(), GLOBAL_ROOT_UID)) return MALI_TRUE; #else if (current_euid() == 0) return MALI_TRUE; #endif /*LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)*/ return MALI_FALSE; #endif /*KBASE_HWCNT_DUMP_BYPASS_ROOT*/ } /** * kbase_security_has_capability - see mali_kbase_caps.h for description. */ mali_bool kbase_security_has_capability(kbase_context *kctx, kbase_security_capability cap, u32 flags) { /* Assume failure */ mali_bool access_allowed = MALI_FALSE; mali_bool audit = (KBASE_SEC_FLAG_AUDIT & flags) ? MALI_TRUE : MALI_FALSE; KBASE_DEBUG_ASSERT(NULL != kctx); CSTD_UNUSED(kctx); /* Detect unsupported flags */ KBASE_DEBUG_ASSERT(((~KBASE_SEC_FLAG_MASK) & flags) == 0); /* Determine if access is allowed for the given cap */ switch (cap) { case KBASE_SEC_MODIFY_PRIORITY: case KBASE_SEC_INSTR_HW_COUNTERS_COLLECT: /* Access is granted only if the caller is privileged */ access_allowed = kbasep_am_i_root(); break; } /* Report problem if requested */ if (MALI_FALSE == access_allowed) { if (MALI_FALSE != audit) KBASE_DEBUG_PRINT_WARN(KBASE_CORE, "Security capability failure: %d, %p", cap, (void *)kctx); } return access_allowed; } KBASE_EXPORT_TEST_API(kbase_security_has_capability)
/* * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_INTERFACE_AUDIO_ENCODER_ILBC_H_ #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_INTERFACE_AUDIO_ENCODER_ILBC_H_ #include "webrtc/base/scoped_ptr.h" #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" #include "webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h" #include "webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h" namespace webrtc { class AudioEncoderIlbc final : public AudioEncoder { public: struct Config { Config() : payload_type(102), frame_size_ms(30) {} bool IsOk() const; int payload_type; int frame_size_ms; // Valid values are 20, 30, 40, and 60 ms. // Note that frame size 40 ms produces encodings with two 20 ms frames in // them, and frame size 60 ms consists of two 30 ms frames. }; explicit AudioEncoderIlbc(const Config& config); ~AudioEncoderIlbc() override; int SampleRateHz() const override; int NumChannels() const override; size_t MaxEncodedBytes() const override; int Num10MsFramesInNextPacket() const override; int Max10MsFramesInAPacket() const override; int GetTargetBitrate() const override; EncodedInfo EncodeInternal(uint32_t rtp_timestamp, const int16_t* audio, size_t max_encoded_bytes, uint8_t* encoded) override; private: size_t RequiredOutputSizeBytes() const; static const int kMaxSamplesPerPacket = 480; const int payload_type_; const int num_10ms_frames_per_packet_; int num_10ms_frames_buffered_; uint32_t first_timestamp_in_buffer_; int16_t input_buffer_[kMaxSamplesPerPacket]; IlbcEncoderInstance* encoder_; }; struct CodecInst; class AudioEncoderMutableIlbc : public AudioEncoderMutableImpl<AudioEncoderIlbc> { public: explicit AudioEncoderMutableIlbc(const CodecInst& codec_inst); }; } // namespace webrtc #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_INTERFACE_AUDIO_ENCODER_ILBC_H_
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "emu.h" #include "memory.h" /* Notes: * 1. leavedos() needs a real parameter */ /* * The point of these procedures is going to be to create a map of the * available memory to facilitate: * * 1. check for memory conflicts (hardware page/ems page frame/etc.) * 2. facilitate searching for frames (EMS frame, UMB blocks, etc.) */ #define GRAN_SIZE 1024 /* Size of granularity in KB */ #define MEM_SIZE (1024*1024) /* Size of memory in KB */ #define MAX_PAGE (MEM_SIZE/GRAN_SIZE) /* Number of 'pages' in memory */ static unsigned char mem_map[MAX_PAGE]; /* Map of memory contents */ static char *mem_names[256]; /* List of id. strings */ struct system_memory_map { Bit32u base, hibase, length, hilength, type; }; struct system_memory_map *system_memory_map; size_t system_memory_map_size; static inline void round_addr(size_t *addr) { *addr = (*addr + GRAN_SIZE - 1) / GRAN_SIZE; *addr *= GRAN_SIZE; } int memcheck_addtype(unsigned char map_char, char *name) { if (mem_names[map_char] != NULL) { if (strcmp(mem_names[map_char], name) != 0) { c_printf("CONF: memcheck, conflicting map type '%c' defined for '%s' \ & '%s'\n", map_char, mem_names[map_char], name); config.exitearly = 1; } else c_printf("CONF: memcheck, map type '%c' re-defined for '%s'\n", map_char, name); } else { mem_names[map_char] = name; } return(0); } void memcheck_reserve(unsigned char map_char, size_t addr_start, size_t size) { int cntr; size_t addr_end; struct system_memory_map *entry; c_printf("CONF: reserving %zuKb at 0x%5.5zX for '%c' (%s)\n", size/1024, addr_start, map_char, mem_names[map_char]); round_addr(&addr_start); addr_end = addr_start + size; round_addr(&addr_end); for (cntr = addr_start / GRAN_SIZE; cntr < addr_end / GRAN_SIZE && cntr < MAX_PAGE; cntr++) { if (mem_map[cntr]) { if (mem_map[cntr] == map_char) { c_printf("CONF: Possible error. The memory type '%s' has\ been mapped twice to the same location (0x%4.4XF:0x0000)\n", mem_names[map_char], (cntr * GRAN_SIZE) / 16); } else { fprintf(stderr, "CONF: memcheck - Fatal error. Memory conflict!\n"); fprintf(stderr, " Memory at 0x%4.4X:0x0000 is mapped to both:\n", (cntr * GRAN_SIZE) / 16); fprintf(stderr, " '%s' & '%s'\n", mem_names[map_char], mem_names[mem_map[cntr]]); memcheck_dump(); config.exitearly = 1; } } else mem_map[cntr] = map_char; } if (config.exitearly) return; system_memory_map_size += sizeof(*system_memory_map); system_memory_map = realloc(system_memory_map, system_memory_map_size); entry = system_memory_map + system_memory_map_size / sizeof(*system_memory_map) - 1; entry->base = addr_start; entry->hibase = 0; entry->length = size; entry->hilength = 0; entry->type = 2 - (map_char == 'd' || map_char == 'U' || map_char == 'x'); } void memcheck_type_init(void) { static int once = 0; if (once) return; once = 1; memcheck_addtype('d', "Base DOS memory (first 640K)"); memcheck_addtype('r', "Dosemu reserved area"); memcheck_addtype('h', "Direct-mapped hardware page frame"); memcheck_addtype('v', "Video memory"); } void memcheck_init(void) { memcheck_type_init(); memcheck_reserve('d', 0x00000, config.mem_size*1024); /* dos memory */ if (config.umb_f0) memcheck_reserve('r', 0xF4000, 0xC000); /* dosemu bios */ else memcheck_reserve('r', 0xF0000, 0x10000); } int memcheck_isfree(size_t addr_start, size_t size) { int cntr; size_t addr_end; round_addr(&addr_start); addr_end = addr_start + size; round_addr(&addr_end); for (cntr = addr_start / GRAN_SIZE; cntr < addr_end / GRAN_SIZE; cntr++) { if (mem_map[cntr]) return FALSE; } return TRUE; } int memcheck_is_reserved(size_t addr_start, size_t size, unsigned char map_char) { int cntr; size_t addr_end; round_addr(&addr_start); addr_end = addr_start + size; round_addr(&addr_end); for (cntr = addr_start / GRAN_SIZE; cntr < addr_end / GRAN_SIZE; cntr++) { if (mem_map[cntr] != map_char) { error("memcheck type mismatch at 0x%x: %c %c\n", cntr * GRAN_SIZE, mem_map[cntr], map_char); return FALSE; } } return TRUE; } int memcheck_findhole(size_t *start_addr, size_t min_size, size_t max_size) { int cntr; round_addr(start_addr); for (cntr = *start_addr/GRAN_SIZE; cntr < MAX_PAGE; cntr++) { int cntr2, end_page; /* any chance of finding anything? */ if ((MAX_PAGE - cntr) * GRAN_SIZE < min_size) return 0; /* if something's already there, no go */ if (mem_map[cntr]) continue; end_page = cntr + (max_size / GRAN_SIZE); if (end_page > MAX_PAGE) end_page = MAX_PAGE; for (cntr2 = cntr+1; cntr2 < end_page; cntr2++) { if (mem_map[cntr2]) { if ((cntr2 - cntr) * GRAN_SIZE >= min_size) { *start_addr = cntr * GRAN_SIZE; return ((cntr2 - cntr) * GRAN_SIZE); } else { /* hole isn't big enough, skip to the next one */ cntr = cntr2; break; } } } } return 0; } void memcheck_dump(void) { int cntr; c_printf("CONF: Memory map dump:\n"); for (cntr = 0; cntr < MAX_PAGE; cntr++) { if (cntr % 64 == 0) c_printf("0x%5.5X: ", cntr * GRAN_SIZE); c_printf("%c", (mem_map[cntr]) ? mem_map[cntr] : '.'); if (cntr % 64 == 63) c_printf("\n"); } c_printf("\nKey:\n"); for (cntr = 0; cntr < 256; cntr++) { if (mem_names[cntr]) c_printf("%c: %s\n", cntr, mem_names[cntr]); } c_printf(".: (unused)\n"); c_printf("CONF: End dump\n"); } #if 0 void *lowmemp(const unsigned char *ptr) { dosaddr_t addr = DOSADDR_REL(ptr); #ifdef __x86_64__ if (addr > 0xffffffff) return (void *)ptr; #endif return dosaddr_to_unixaddr(addr); } #endif
/* * This is a small extension to the libxml API. * The reason is that we don't convert the structs properly, * which prevents some very basic actions */ #include <libxml/xmlerror.h> #include <libxml/tree.h> #include <libxml/HTMLparser.h> #include <libxml/xpath.h> #include <stdlib.h> /* * helper functions for tree */ //returns cur->next xmlNodePtr xmlNextSibling(const xmlNodePtr cur); //returns cur->prev xmlNodePtr xmlPrevSibling(const xmlNodePtr cur); //returns cur->children xmlNodePtr xmlGetFirstChild(const xmlNodePtr cur); //returns cur->parent xmlNodePtr xmlGetParent(const xmlNodePtr cur); //returns cur->name const char * xmlNodeGetName(const xmlNodePtr cur); //returns cur->type int xmlGetNodeType(const xmlNodePtr cur); //returns cur->content //(Different from xmlNodeGetContent) const char * xmlNodeGetContentPointer(const xmlNodePtr cur); // removes first property with name name, if it exists void xmlRemovePropertyWithName(const xmlNodePtr cur, const char *name); /* * helper functions for xpath */ ///returns val->nodesetval->nodeNr int xmlXPathObjectNumberOfNodes(const xmlXPathObjectPtr val); ///returns val->nodesetval->nodeTab[index] xmlNodePtr xmlXPathObjectGetNode(const xmlXPathObjectPtr val, size_t index); ///frees the memory of an xmlXPathObject void xmlFreeXPathObject(xmlXPathObjectPtr val); /* * helper functions for parser */ /// Returns well-formed check field of html parser context struct int htmlWellFormed(const htmlParserCtxtPtr ctxt); /* * helper functions for error handling */ void setWellFormednessHandler(const htmlParserCtxtPtr ctxt);
/******************************************************************************\ CAMotics is an Open-Source simulation and CAM software. Copyright (C) 2011-2019 Joseph Coffland <joseph@cauldrondevelopment.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. \******************************************************************************/ #pragma once #include "Entity.h" namespace DXF { class Arc : public Entity { cb::Vector3D center; double radius; double startAngle; double endAngle; bool clockwise; public: Arc(const cb::Vector3D &center, double radius, double startAngle, double endAngle, bool clockwise) : center(center), radius(radius), startAngle(startAngle), endAngle(endAngle), clockwise(clockwise) {} const cb::Vector3D &getCenter() const {return center;} double getRadius() const {return radius;} double getStartAngle() const {return startAngle;} double getEndAngle() const {return endAngle;} bool getClockwise() const {return clockwise;} // From Entity type_t getType() const {return DXF_ARC;} }; }
#include "cab202_timers.h" #include <assert.h> #include <stdlib.h> #ifdef WIN32 #include <windows.h> #else #include <time.h> #include <unistd.h> #endif #ifdef __MACH__ #include <mach/clock.h> #include <mach/mach.h> #endif /* * create_timer: * * Creates a new timer and sets it up with the required interval. * * Input: * - milliseconds: the length of the desired interval between reset and expiry. * * Output: * Returns a non-negative ID number that can be used to check the status * of the timer if fewer than TIMER_MAX timers have been created. Otherwise, * returns TIMER_ERROR. */ timer_id create_timer( long milliseconds ) { assert( milliseconds > 0 ); timer_id timer = malloc( sizeof(cab202_timer_t) ); timer->milliseconds = milliseconds; reset_timer( timer ); return timer; } /* * reset_timer: * * Reset a timer to start a new interval. * * Input: * - timer: the address of a timer which is to be reset. * * Output: void. */ void reset_timer( timer_id timer ) { assert( timer != NULL ); timer->reset_time = get_current_time(); } /* * timer_expired: * * Checks a timer to see if the associated interval has passed. If the interval has * elapsed, the timer is reset automatically, ready to start again. * * Input: * - id: The ID of a timer to check and update. * * Output: * Returns TRUE if and only if the interval had elapsed. */ int timer_expired( timer_id timer ) { assert( timer != NULL ); double current_time = get_current_time(); double time_diff = current_time - timer->reset_time; int expired = time_diff * MILLISECONDS >= timer->milliseconds; if ( expired ) { reset_timer( timer ); } return expired; } void timer_pause( long milliseconds ) { #ifdef WIN32 Sleep( milliseconds ); #else /* usleep requires input in microseconds rather than milliseconds. */ usleep( milliseconds * MILLISECONDS ); #endif } #ifdef WIN32 /* Implementation of clock_gettime sourced from StackOverflow: http://stackoverflow.com/questions/5404277/porting-clock-gettime-to-windows */ LARGE_INTEGER getFILETIMEoffset() { SYSTEMTIME s; FILETIME f; LARGE_INTEGER t; s.wYear = 1970; s.wMonth = 1; s.wDay = 1; s.wHour = 0; s.wMinute = 0; s.wSecond = 0; s.wMilliseconds = 0; SystemTimeToFileTime( &s, &f ); t.QuadPart = f.dwHighDateTime; t.QuadPart <<= 32; t.QuadPart |= f.dwLowDateTime; return ( t ); } #pragma warning( disable: 4100 ) int clock_gettime( int X, struct timeval *tv ) { LARGE_INTEGER t; FILETIME f; double microseconds; static LARGE_INTEGER offset; static double frequencyToMicroseconds; static int initialized = 0; static BOOL usePerformanceCounter = 0; if ( !initialized ) { LARGE_INTEGER performanceFrequency; initialized = 1; usePerformanceCounter = QueryPerformanceFrequency( &performanceFrequency ); if ( usePerformanceCounter ) { QueryPerformanceCounter( &offset ); frequencyToMicroseconds = (double) performanceFrequency.QuadPart / 1000000.; } else { offset = getFILETIMEoffset(); frequencyToMicroseconds = 10.; } } if ( usePerformanceCounter ) QueryPerformanceCounter( &t ); else { GetSystemTimeAsFileTime( &f ); t.QuadPart = f.dwHighDateTime; t.QuadPart <<= 32; t.QuadPart |= f.dwLowDateTime; } t.QuadPart -= offset.QuadPart; microseconds = (double) t.QuadPart / frequencyToMicroseconds; t.QuadPart = (LONGLONG) microseconds; tv->tv_sec = (long) ( t.QuadPart / 1000000 ); tv->tv_usec = t.QuadPart % 1000000; return ( 0 ); } double get_current_time() { struct timeval timeval; clock_gettime( 0, &timeval ); return timeval.tv_sec + timeval.tv_usec / 1.0e+6; } #else double get_current_time () { struct timespec timeval; #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); timeval.tv_sec = mts.tv_sec; timeval.tv_nsec = mts.tv_nsec; #else /* http://linux.die.net/man/3/clock_gettime */ clock_gettime( CLOCK_REALTIME, &timeval ); #endif return timeval.tv_sec + timeval.tv_nsec / 1.0e+9; } #endif
/*============================================================================* * * (c) 1995-2002 RealNetworks, Inc. Patents pending. All rights reserved. * *============================================================================*/ // -*-c++-*- #ifndef HX_URLREP_H__ #define HX_URLREP_H__ #include "hxstring.h" // generic URI syntax (see rfc 2396) URI parser class HXURLRep { public: // flags indicating status of parse attempt enum ParseFlags { PF_INVALID_SCHEME = 0x0001, PF_INVALID_PORT = 0x0002, PF_INVALID_PATH_SEGMENTS = 0x0004, // not a generic abs path PF_INVALID_HOST = 0x0008, PF_INVALID_IPV6 = 0x0010, PF_INVALID_QUERY = 0x0020, PF_INVALID_OPAQUE_PART = 0x0040, PF_ABORTED = 0x1000 }; // type indicates which of several general URL form types enum Type { TYPE_OPAQUE, // [<scheme>:]<opaque part> TYPE_NETPATH, // [<scheme>:]// TYPE_ABSPATH, // [<scheme>:]/ TYPE_RELPATH // <path>?<query><frag> }; HXURLRep(const CHXString& url = ""); HXURLRep(Type type, const CHXString& scheme, const CHXString& host, INT32 port, // -1 = no port const CHXString& path); HXURLRep(Type type, const CHXString& scheme, const CHXString& userInfo, const CHXString& host, INT32 port, // -1 = no port const CHXString& path, const CHXString& query, const CHXString& fragment); // set/alter methods (implicit update) bool ApplyRelative(const HXURLRep& other); void Normalize(); // Update() must be called after set operations void SetType(Type type); void SetScheme(const char* pScheme); void SetUserInfo(const char* pUserInfo); void SetHost(const char* pHost); void SetPort(INT32 port); void SetPath(const char* pPath); void SetQuery(const char* pQuery); void SetFragment(const char* pFragment); bool Update(); // get/query methods UINT32 GetParseFlags() const; Type GetType() const; bool HasIPv6Host() const; bool HasPort() const; bool IsFullyParsed() const; bool IsValid() const; // url components const CHXString& String() const; const CHXString& Scheme() const; const CHXString& Host() const; const CHXString& UserInfo() const; UINT32 Port() const; const CHXString& Path() const; const CHXString& Query() const; const CHXString& Fragment() const; CHXString GetSchemeAuthorityString(); UINT32 GetPathOffset() const; private: int operator==(const HXURLRep&) const; int operator!=(const HXURLRep&) const; // parse helpers bool Parse(const CHXString& url); bool ParseAbsoluteBody(const char*& pch, CHXString& token); bool ParseGenericBody(const char*& pch, CHXString& token); bool ParseAuthority(const char*& pch, CHXString& token); bool ParsePathQueryFragment(const char*& pch, CHXString& token); CHXString m_string; Type m_type; CHXString m_scheme; CHXString m_userInfo; CHXString m_host; bool m_hasIPv6Host; INT32 m_port; CHXString m_path; UINT32 m_idxPath; CHXString m_query; CHXString m_fragment; UINT32 m_parseFlags; }; inline void HXURLRep::SetType(Type type) { m_type = type; } inline void HXURLRep::SetScheme(const char* pScheme) { m_scheme = pScheme; } inline void HXURLRep::SetUserInfo(const char* pUserInfo) { m_userInfo = pUserInfo; } inline void HXURLRep::SetHost(const char* pHost) { m_host = pHost; } inline void HXURLRep::SetPort(INT32 port) { m_port = port; } inline void HXURLRep::SetPath(const char* pPath) { m_path = pPath; } inline void HXURLRep::SetQuery(const char* pQuery) { m_query = pQuery; } inline void HXURLRep::SetFragment(const char* pFragment) { m_fragment = pFragment; } inline const CHXString& HXURLRep::String() const { return m_string; } inline const CHXString& HXURLRep::Scheme() const { return m_scheme; } inline const CHXString& HXURLRep::Host() const { return m_host; } inline const CHXString& HXURLRep::UserInfo() const { return m_userInfo; } inline UINT32 HXURLRep::Port() const { return (m_port >= 0) ? m_port : 0; } inline const CHXString& HXURLRep::Path() const { return m_path; } inline const CHXString& HXURLRep::Query() const { return m_query; } inline const CHXString& HXURLRep::Fragment() const { return m_fragment; } // return true if last build-and-parse // resulted in a full parse inline bool HXURLRep::IsFullyParsed() const { return !(PF_ABORTED & m_parseFlags); } // return true if all components are correct per rfc; // NB: url may still be useable even if invalid // (e.g., path component in Window path format) inline bool HXURLRep::IsValid() const { return (0 == m_parseFlags); } inline bool HXURLRep::HasIPv6Host() const { return m_hasIPv6Host; } inline bool HXURLRep::HasPort() const { return (m_port >= 0); } inline HXURLRep::Type HXURLRep::GetType() const { return m_type; } inline UINT32 HXURLRep::GetParseFlags() const { return m_parseFlags; } // TYPE_ABSPATH, TYPE_NETPATH: // offset to character just past abs-path delimeter ('/'); points to path // TYPE_OPAQUE: // offset to character just past scheme delimiter (':') points to data // TYPE_RELPATH: // offset to path (always 0 by definition) inline UINT32 HXURLRep::GetPathOffset() const { HX_ASSERT(IsFullyParsed()); return m_idxPath; } #endif // HX_URLREP_H__
/* $Id$ */ /* * This file is part of OpenTTD. * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. */ /** @file engine_type.h Types related to engines. */ #ifndef ENGINE_TYPE_H #define ENGINE_TYPE_H #include "economy_type.h" #include "rail_type.h" #include "cargo_type.h" #include "date_type.h" #include "sound_type.h" #include "strings_type.h" typedef uint16 EngineID; struct Engine; enum RailVehicleTypes { RAILVEH_SINGLEHEAD, ///< indicates a "standalone" locomotive RAILVEH_MULTIHEAD, ///< indicates a combination of two locomotives RAILVEH_WAGON, ///< simple wagon, not motorized }; enum EngineClass { EC_STEAM, EC_DIESEL, EC_ELECTRIC, EC_MONORAIL, EC_MAGLEV, }; struct RailVehicleInfo { byte image_index; RailVehicleTypes railveh_type; byte cost_factor; ///< Purchase cost factor; For multiheaded engines the sum of both engine prices. RailTypeByte railtype; uint16 max_speed; ///< Maximum speed (1 unit = 1/1.6 mph = 1 km-ish/h) uint16 power; ///< Power of engine (hp); For multiheaded engines the sum of both engine powers. uint16 weight; ///< Weight of vehicle (tons); For multiheaded engines the weight of each single engine. byte running_cost; ///< Running cost of engine; For multiheaded engines the sum of both running costs. Price running_cost_class; EngineClass engclass; ///< Class of engine for this vehicle byte capacity; ///< Cargo capacity of vehicle; For multiheaded engines the capacity of each single engine. byte ai_passenger_only; ///< Bit value to tell AI that this engine is for passenger use only uint16 pow_wag_power; ///< Extra power applied to consist if wagon should be powered byte pow_wag_weight; ///< Extra weight applied to consist if wagon should be powered byte visual_effect; ///< Bitstuffed NewGRF visual effect data byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor byte tractive_effort; ///< Tractive effort coefficient byte air_drag; ///< Coefficient of air drag byte user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles }; struct ShipVehicleInfo { byte image_index; byte cost_factor; uint16 max_speed; ///< Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h) uint16 capacity; byte running_cost; SoundID sfx; bool old_refittable; ///< Is ship refittable; only used during initialisation. Later use EngineInfo::refit_mask. byte visual_effect; ///< Bitstuffed NewGRF visual effect data }; /* AircraftVehicleInfo subtypes, bitmask type. * If bit 0 is 0 then it is a helicopter, otherwise it is a plane * in which case bit 1 tells us whether it's a big(fast) plane or not */ enum AircraftSubTypeBits { AIR_HELI = 0, AIR_CTOL = 1, ///< Conventional Take Off and Landing, i.e. planes AIR_FAST = 2 }; struct AircraftVehicleInfo { byte image_index; byte cost_factor; byte running_cost; byte subtype; SoundID sfx; byte acceleration; uint16 max_speed; ///< Maximum speed (1 unit = 8 mph = 12.8 km-ish/h) byte mail_capacity; uint16 passenger_capacity; }; struct RoadVehicleInfo { byte image_index; byte cost_factor; byte running_cost; Price running_cost_class; SoundID sfx; uint16 max_speed; ///< Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h) byte capacity; uint8 weight; ///< Weight in 1/4t units uint8 power; ///< Power in 10hp units uint8 tractive_effort; ///< Coefficient of tractive effort uint8 air_drag; ///< Coefficient of air drag byte visual_effect; ///< Bitstuffed NewGRF visual effect data }; /** * Information about a vehicle * @see table/engines.h */ struct EngineInfo { Date base_intro; Year lifelength; ///< Lifetime of a single vehicle Year base_life; ///< Basic duration of engine availability (without random parts) byte decay_speed; byte load_amount; byte climates; CargoID cargo_type; uint32 refit_mask; byte refit_cost; byte misc_flags; byte callback_mask; ///< Bitmask of vehicle callbacks that have to be called int8 retire_early; ///< Number of years early to retire vehicle StringID string_id; ///< Default name of engine }; /** * EngineInfo.misc_flags is a bitmask, with the following values */ enum EngineMiscFlags { EF_RAIL_TILTS = 0, ///< Rail vehicle tilts in curves EF_ROAD_TRAM = 0, ///< Road vehicle is a tram/light rail vehicle EF_USES_2CC = 1, ///< Vehicle uses two company colours EF_RAIL_IS_MU = 2, ///< Rail vehicle is a multiple-unit (DMU/EMU) EF_RAIL_FLIPS = 3, ///< Rail vehicle can be flipped in the depot }; /** * Engine.flags is a bitmask, with the following values. */ enum EngineFlags { ENGINE_AVAILABLE = 1, ///< This vehicle is available to everyone. ENGINE_EXCLUSIVE_PREVIEW = 2, ///< This vehicle is in the exclusive preview stage, either being used or being offered to a company. ENGINE_OFFER_WINDOW_OPEN = 4, ///< The exclusive offer window is currently open for a company. }; static const uint NUM_VEHICLE_TYPES = 6; static const uint MAX_LENGTH_ENGINE_NAME_CHARS = 32; ///< The maximum length of an engine name in characters including '\0' static const uint MAX_LENGTH_ENGINE_NAME_PIXELS = 160; ///< The maximum length of an engine name in pixels static const EngineID INVALID_ENGINE = 0xFFFF; #endif /* ENGINE_TYPE_H */
#import <AppKit/NSToolbarItem.h> @interface JVToolbarItem : NSToolbarItem @property (nonatomic, retain) id representedObject; @end
/* * Purple Plugin Pack * Copyright (C) 2003-2008 * See ../AUTHORS for a list of all authors * * listhandler: Provides importing, exporting, and copying functions * for accounts' buddy lists. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. */ /* If you can't figure out what this line is for, DON'T TOUCH IT. */ #include "../common/pp_internal.h" #include <string.h> /* Purple headers */ #include <account.h> #include <blist.h> #include <debug.h> #include <plugin.h> #include <request.h> #include <xmlnode.h> #include "lh_util.h" /* we send this to the request API so it is probably a good idea to make sure * the other files that need it have it */ extern PurplePlugin *listhandler;
// // SKBSummaryViewController.h // SKCore // // Created by Pete Cole on 29/09/2014. // Copyright (c) 2014 SamKnows. All rights reserved. // #import <UIKit/UIKit.h> @class SKBSummaryViewMgr; @interface SKBSummaryViewController : UIViewController @property (weak, nonatomic) IBOutlet SKBSummaryViewMgr *summaryManagerView; @end
// Copyright (c) 2013 The Silk Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Written by qingfeng.wang, some source code form snort,nginx. // http://www.selinuxplus.com frank.wqf@gmail.com // Thanks to China Standard software Co.,Ltd ; #include "sk_config.h" #include "sk_core.h" #include <sys/mman.h> sk_ptr_t sk_shm_alloc(sk_shm_t *shm) { shm->addr = (u_char *)mmap(NULL,shm->size,PROT_READ|PROT_WRITE,MAP_ANON|MAP_SHARED,-1,0); if(shm->addr == MAP_FAILED){ return SK_ERR; } return SK_OK; } sk_ptr_t sk_shmtx_create(sk_shmtx_t *mtx,void *addr,u_char *name) { mtx->lock = addr; if(mtx->spin == (sk_uptr_t) -1){ return SK_OK; } mtx->spin = 2048; return SK_OK; } sk_uptr_t sk_shmtx_trylock(sk_shmtx_t *mtx) { sk_atomic_uint_t val; val = *mtx->lock; return ((val & 0x80000000) ==0 && sk_atomic_cmp_set(mtx->lock,val,val|0x80000000)); } sk_uptr_t sk_shmtx_lock(sk_shmtx_t *mtx) { sk_uptr_t i,n; sk_atomic_uint_t val; for(;;){ val = *mtx->lock; if((val & 0x80000000) == 0 && sk_atomic_cmp_set(mtx->lock,val,val|0x80000000)){ return SK_OK; } if(sk_ncpu>1){ for(n = 1; n < mtx->spin; n<<=1){ for(i = 0; i < n;i++){ sk_cpu_pause(); } val= *mtx->lock; if((val &0x80000000)==0 && sk_atomic_cmp_set(mtx->lock,val,val|0x80000000)){ return SK_OK; } } } sk_sched_yield(); } } void sk_shmtx_unlock(sk_shmtx_t *mtx) { sk_atomic_uint_t val,old,wait; if(mtx->spin != (sk_uptr_t) -1){ //log } for(;;){ old = *mtx->lock; wait = old & 0x7fffffff; val = wait ? wait-1 :0; if(sk_atomic_cmp_set (mtx->lock,old,val)){ break; } } }
#if !defined(_TIMER_H_) #define _TIMER_H_ #include <string> class timer { public: timer(); void start(); time_t mark(bool _diff=true); time_t restart(bool _diff=true); static std::string format_time(time_t _time); protected: time_t m_time; }; #endif
/** * \file version.h * * \brief Run-time version information * * Copyright (C) 2006-2013, Brainspark B.V. * * This file is part of PolarSSL (http://www.polarssl.org) * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* * This set of compile-time defines and run-time variables can be used to * determine the version number of the PolarSSL library used. */ #ifndef POLARSSL_VERSION_H #define POLARSSL_VERSION_H #include "config.h" /** * The version number x.y.z is split into three parts. * Major, Minor, Patchlevel */ #define POLARSSL_VERSION_MAJOR 1 #define POLARSSL_VERSION_MINOR 3 #define POLARSSL_VERSION_PATCH 2 /** * The single version number has the following structure: * MMNNPP00 * Major version | Minor version | Patch version */ #define POLARSSL_VERSION_NUMBER 0x01030200 #define POLARSSL_VERSION_STRING "1.3.2" #define POLARSSL_VERSION_STRING_FULL "PolarSSL 1.3.2" #if defined(POLARSSL_VERSION_C) #ifdef __cplusplus extern "C" { #endif /** * Get the version number. * * \return The constructed version number in the format * MMNNPP00 (Major, Minor, Patch). */ unsigned int version_get_number( void ); /** * Get the version string ("x.y.z"). * * \param string The string that will receive the value. * (Should be at least 9 bytes in size) */ void version_get_string( char *string ); /** * Get the full version string ("PolarSSL x.y.z"). * * \param string The string that will receive the value. * (Should be at least 18 bytes in size) */ void version_get_string_full( char *string ); #ifdef __cplusplus } #endif #endif /* POLARSSL_VERSION_C */ #endif /* version.h */
#include <string.h> int main(int argc, char **argv) { void *p; (void)argc; (void)argv; p=(void*)(strstr); return 0; }