text
stringlengths
4
6.14k
/****************************************************************************************** * Data Structures in C++ * ISBN: 7-302-33064-6 & 7-302-33065-3 & 7-302-29652-2 & 7-302-26883-3 * Junhui DENG, deng@tsinghua.edu.cn * Computer Science & Technology, Tsinghua University * Copyright (c) 2006-2013. All rights reserved. ******************************************************************************************/ #pragma once ////////////////////////////////////////////////////////////////////////// // Boyer-MooreËã·¨ ////////////////////////////////////////////////////////////////////////// void ShowProgress ( String, String, int, int ); #define CARD_CHAR_SET 256 //Cardinality of charactor set int* BuildBC ( String ); //¹¹ÔìBad Charactor Shift±í int* suffixes ( String ); int* BuildGS ( String ); //¹¹ÔìGood Suffix Shift±í
// // NCMRulerView.h // SNH // // Created by 黄淑妮 on 2017/6/15. // Copyright © 2017年 Mirco. All rights reserved. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface SNHRulerView : UIView @property (assign, nonatomic) CGFloat widthPerSecond; @property (strong, nonatomic) UIColor *themeColor; @property (assign, nonatomic) NSInteger labelInterval; - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER; - (instancetype)initWithFrame:(CGRect)frame widthPerSecond:(CGFloat)width themeColor:(UIColor *)color labelInterval:(NSInteger)interval NS_DESIGNATED_INITIALIZER; @end NS_ASSUME_NONNULL_END
#ifndef __dsquery_h #define __dsquery_h // // query handler ID for dsquery. // DEFINE_GUID(CLSID_DsQuery, 0x8a23e65e, 0x31c2, 0x11d0, 0x89, 0x1c, 0x0, 0xa0, 0x24, 0xab, 0x2d, 0xbb); // // standard forms shipped in dsquery.dll // DEFINE_GUID(CLSID_DsFindObjects, 0x83ee3fe1, 0x57d9, 0x11d0, 0xb9, 0x32, 0x0, 0xa0, 0x24, 0xab, 0x2d, 0xbb); DEFINE_GUID(CLSID_DsFindPeople, 0x83ee3fe2, 0x57d9, 0x11d0, 0xb9, 0x32, 0x0, 0xa0, 0x24, 0xab, 0x2d, 0xbb); DEFINE_GUID(CLSID_DsFindPrinter, 0xb577f070, 0x7ee2, 0x11d0, 0x91, 0x3f, 0x0, 0xaa, 0x0, 0xc1, 0x6e, 0x65); DEFINE_GUID(CLSID_DsFindComputer, 0x16006700, 0x87ad, 0x11d0, 0x91, 0x40, 0x0, 0xaa, 0x0, 0xc1, 0x6e, 0x65); DEFINE_GUID(CLSID_DsFindVolume, 0xc1b3cbf1, 0x886a, 0x11d0, 0x91, 0x40, 0x0, 0xaa, 0x0, 0xc1, 0x6e, 0x65); DEFINE_GUID(CLSID_DsFindContainer, 0xc1b3cbf2, 0x886a, 0x11d0, 0x91, 0x40, 0x0, 0xaa, 0x0, 0xc1, 0x6e, 0x65); DEFINE_GUID(CLSID_DsFindAdvanced, 0x83ee3fe3, 0x57d9, 0x11d0, 0xb9, 0x32, 0x0, 0xa0, 0x24, 0xab, 0x2d, 0xbb); // // admin forms // DEFINE_GUID(CLSID_DsFindDomainController, 0x538c7b7e, 0xd25e, 0x11d0, 0x97, 0x42, 0x0, 0xa0, 0xc9, 0x6, 0xaf, 0x45); DEFINE_GUID(CLSID_DsFindFrsMembers, 0x94ce4b18, 0xb3d3, 0x11d1, 0xb9, 0xb4, 0x0, 0xc0, 0x4f, 0xd8, 0xd5, 0xb0); #ifndef GUID_DEFS_ONLY // // DSQUERYINITPARAMS // ----------------- // This structured is used when creating a new query view. // #define DSQPF_NOSAVE 0x00000001 // = 1 => remove save verb #define DSQPF_SAVELOCATION 0x00000002 // = 1 => pSaveLocation contains directory to save queries into #define DSQPF_SHOWHIDDENOBJECTS 0x00000004 // = 1 => show objects marked as "hidden" in results #define DSQPF_ENABLEADMINFEATURES 0x00000008 // = 1 => show admin verbs, property pages etc #define DSQPF_ENABLEADVANCEDFEATURES 0x00000010 // = 1 => set the advanced flag for the property pages #define DSQPF_HASCREDENTIALS 0x00000020 // = 1 => pServer, pUserName & pPassword are valid #define DSQPF_NOCHOOSECOLUMNS 0x00000040 // = 1 => remove choose columns from view typedef struct { DWORD cbStruct; DWORD dwFlags; LPWSTR pDefaultScope; // -> Active Directory path to use as scope / == NULL for none LPWSTR pDefaultSaveLocation; // -> Directory to save queries into / == NULL default location LPWSTR pUserName; // -> user name to authenticate with LPWSTR pPassword; // -> password for authentication LPWSTR pServer; // -> server to use for obtaining trusts etc } DSQUERYINITPARAMS, * LPDSQUERYINITPARAMS; // // DSQUERYPARAMS // ------------- // The DS query handle takes a packed structure which contains the // columns and query to be issued. // #define CFSTR_DSQUERYPARAMS TEXT("DsQueryParameters") #define DSCOLUMNPROP_ADSPATH ((LONG)(-1)) #define DSCOLUMNPROP_OBJECTCLASS ((LONG)(-2)) typedef struct { DWORD dwFlags; // flags for this column INT fmt; // list view form information INT cx; // default column width INT idsName; // resource ID for the column dispaly name LONG offsetProperty; // offset to BSTR defining column ADs property name DWORD dwReserved; // reserved field } DSCOLUMN, * LPDSCOLUMN; typedef struct { DWORD cbStruct; DWORD dwFlags; HINSTANCE hInstance; // instance handle used for string extraction LONG offsetQuery; // offset to LDAP filter string LONG iColumns; // column count DWORD dwReserved; // reserved field for this query DSCOLUMN aColumns[1]; // array of column descriptions } DSQUERYPARAMS, * LPDSQUERYPARAMS; // // CF_DSQUERYSCOPE // --------------- // A clipboard format the puts a string version of the scope into a // storage medium via GlobalAlloc. // #define CFSTR_DSQUERYSCOPE TEXT("DsQueryScope") // // DSQPM_GETCLASSLIST // ------------------ // This page message is sent to the form pages to retrieve the list of classes // that the pages are going to query from. This is used by the feild selector // and the property well to build its list of display classes. // typedef struct { DWORD cbStruct; LONG cClasses; // number of classes in array DWORD offsetClass[1]; // offset to the class names (UNICODE) } DSQUERYCLASSLIST, * LPDSQUERYCLASSLIST; #define DSQPM_GETCLASSLIST (CQPM_HANDLERSPECIFIC+0) // wParam == flags, lParam = LPLPDSQUERYCLASSLIST // // DSQPM_HELPTOPICS // ---------------- // This page message is sent to the form pages to allow them to handle the // "Help Topics" verb. // #define DSQPM_HELPTOPICS (CQPM_HANDLERSPECIFIC+1) // wParam = 0, lParam = hWnd parent #endif // GUID_DEFS_ONLY #endif
// // This source file is part of appleseed. // Visit http://appleseedhq.net/ for additional information and resources. // // This software is released under the MIT license. // // Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited // Copyright (c) 2014-2017 Francois Beaune, The appleseedhq Organization // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef APPLESEED_RENDERER_MODELING_INPUT_COLORSOURCE_H #define APPLESEED_RENDERER_MODELING_INPUT_COLORSOURCE_H // appleseed.renderer headers. #include "renderer/global/globaltypes.h" #include "renderer/modeling/input/source.h" // appleseed.foundation headers. #include "foundation/image/color.h" #include "foundation/platform/compiler.h" #include "foundation/platform/types.h" // Forward declarations. namespace renderer { class ColorEntity; } namespace renderer { // // Uniform source. // class ColorSource : public Source { public: // Constructor. explicit ColorSource(const ColorEntity& color_entity); // Retrieve the color entity used by this source. const ColorEntity& get_color_entity() const; // Compute a signature unique to this source. foundation::uint64 compute_signature() const override; // Return hints allowing to treat this source as one of another type. Hints get_hints() const override; // Evaluate the source. void evaluate_uniform( float& scalar) const override; void evaluate_uniform( foundation::Color3f& linear_rgb) const override; void evaluate_uniform( Spectrum& spectrum) const override; void evaluate_uniform( Alpha& alpha) const override; void evaluate_uniform( foundation::Color3f& linear_rgb, Alpha& alpha) const override; void evaluate_uniform( Spectrum& spectrum, Alpha& alpha) const override; private: const ColorEntity& m_color_entity; float m_scalar; foundation::Color3f m_linear_rgb; Spectrum m_spectrum; Alpha m_alpha; void initialize_from_spectrum(const ColorEntity& color_entity); void initialize_from_color3(const ColorEntity& color_entity); }; // // ColorSource class implementation. // inline const ColorEntity& ColorSource::get_color_entity() const { return m_color_entity; } inline void ColorSource::evaluate_uniform( float& scalar) const { scalar = m_scalar; } inline void ColorSource::evaluate_uniform( foundation::Color3f& linear_rgb) const { linear_rgb = m_linear_rgb; } inline void ColorSource::evaluate_uniform( Spectrum& spectrum) const { spectrum = m_spectrum; } inline void ColorSource::evaluate_uniform( Alpha& alpha) const { alpha = m_alpha; } inline void ColorSource::evaluate_uniform( foundation::Color3f& linear_rgb, Alpha& alpha) const { linear_rgb = m_linear_rgb; alpha = m_alpha; } inline void ColorSource::evaluate_uniform( Spectrum& spectrum, Alpha& alpha) const { spectrum = m_spectrum; alpha = m_alpha; } } // namespace renderer #endif // !APPLESEED_RENDERER_MODELING_INPUT_COLORSOURCE_H
// // DeviceAssignApi.h // DeviceManagement // // Created by Tabrez on 22/07/14. // Copyright (c) 2014 Tabrez. All rights reserved. // #import "APIBase.h" @class DeviceDetailsApi; @interface DeviceAssignApi : APIBase @property (strong, nonatomic) NSString *hardwareid; @property (strong, nonatomic) NSString *huid; @property (strong, nonatomic) NSString *oldempid; @property (strong, nonatomic) NSString *oldpin; @property (strong, nonatomic) NSString *newempid; @property (strong, nonatomic) NSString *newpin; @property (strong, nonatomic) NSString *email; @property (strong, nonatomic) DeviceDetailsApi *deviceDetails; @end /* "email":"Rahul.Antonyraj@tarento.com", "hardwareid":306, "oldpin":123, "newpin":123 */ /* [24/07/14 12:26:20 pm] sanjay rahul: http://172.17.20.155/hardware_api/assignhardware/format/json/ [24/07/14 12:26:28 pm] sanjay rahul: { "reassign": { "hardware_id": 306, "huid": 389, "old_emp_id": 106, "old_pin": "fw55t81", "new_emp_id": 176, "new_pin": "qa12e34" } } */
/** * * \file os_swi.h * * Author: Karl L. Waters * Copyright (C) 2008 by Karl L. Waters * * History: * 08 JUN 2008 : Created KLW * */ #ifndef OS_SWI_H_ #define OS_SWI_H_ extern uint32_t callSWI(uint32_t arg1, uint32_t arg2, uint32_t arg3, uint32_t arg4); #endif /*OS_SWI_H_*/
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSDateComponents.h" @interface NSDateComponents (EventKit) + (id)dateComponentsFromGregorianDate:(CDStruct_79f9e052)arg1; - (void)clearTimeComponents; - (_Bool)hasTimeComponents; - (CDStruct_79f9e052)gregorianDate; - (id)dateComponentsForEndOfDay; - (id)dateComponentsForDateOnly; - (id)dateComponents:(unsigned long long)arg1 byAddingDays:(int)arg2 calendar:(id)arg3; - (id)dateComponents:(unsigned long long)arg1 byAddingComponents:(id)arg2 calendar:(id)arg3; @end
// // MenubarAppDelegate.h // Menubar // // Created by Orpine on 3/21/14. // Copyright (c) 2014 Orpine. All rights reserved. // #import <Cocoa/Cocoa.h> #import <Carbon/Carbon.h> #import <SystemConfiguration/CaptiveNetwork.h> #import "Sparkle/Sparkle.h" #import "Reachability.h" #import "PreferenceController.h" @interface MenubarAppDelegate : NSObject <NSApplicationDelegate> { Reachability *hostReach; } @property (assign) IBOutlet NSWindow *window; @property (weak) IBOutlet NSMenu *statusMenu; @property (strong, nonatomic) NSStatusItem *statusBar; @property (weak) IBOutlet NSView *preferencePane; @property (nonatomic, retain) NSDictionary *userDefaults; - (IBAction)ConnectZJUWLAN:(id)sender; - (NSString *)setupConnection; - (void)connecting:(BOOL)isClick; - (void)autoLoginOptionChanged:(NSNotification *)note; @end
/* * Copyright (C) 2010 Gil Mendes * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /** * @file * @brief Integer division function. */ #include <stdlib.h> /** Find the quotient and remainder of an integer division. * @param num Numerator. * @param denom Denominator. * @return Structure containing result of division. */ div_t div(int num, int denom) { div_t r; r.quot = num / denom; r.rem = num % denom; if(num >= 0 && r.rem < 0) { r.quot++; r.rem -= denom; } else if(num < 0 && r.rem > 0) { r.quot--; r.rem += denom; } return r; } /** Find the quotient and remainder of an integer division. * @param num Numerator. * @param denom Denominator. * @return Structure containing result of division. */ ldiv_t ldiv(long num, long denom) { ldiv_t r; r.quot = num / denom; r.rem = num % denom; if(num >= 0 && r.rem < 0) { r.quot++; r.rem -= denom; } else if(num < 0 && r.rem > 0) { r.quot--; r.rem += denom; } return r; }
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // @import AppKit; @interface NSNull (NSAccessibility) - (void)accessibilityDidEndScrolling; @end
#include <stdio.h> int main(void) { int x; long int y; printf("size of int: %d\n", sizeof x); // size of short modifier printf("size of short: %d\n", sizeof y); // size of short modifier return 0; }
// ŒvŽZŒn‚֗̕˜ // 2016. 9. 5 ƒvƒƒOƒ‰ƒ€ì¬ // 2016. 9.15 •ǐö‚èˆÊ’u•␳’ljÁ // 2017. 2.20 ƒxƒWƒG‹Èü’ljÁ // Author SyunMizuno #pragma once #include "../../Convert.h" #include "../../Collision/Collision.h" // [min, max]‚͈͓̔à‚Ü‚Ån‚ðƒNƒ‰ƒ“ƒv float Clamp(float val, float min, float max); int Clamp(int val, int min, int max); // 2‚‚̃xƒNƒgƒ‹‚©‚çAB‚̂Ȃ·Šp“xƒÆ‚ð‹‚ß‚é float AngleOf2Vector(Vector3 A, Vector3 B); // •Ç’Þ‚èƒxƒNƒgƒ‹ŽZo Vector3* WallScratchVector( const Vector3& front, const Vector3& normal); /* ƒxƒWƒG‹Èü // p0 : point1 // p1 : point2 // p2 : point3 // p3 : point4 // t : 0.0f ` 1.0f */ Vector2 Bezier( Vector2& p0, Vector2& p1, Vector2& p2, Vector2& p3, float t); /* Catmull-RomƒXƒvƒ‰ƒCƒ“‹Èü // p0 : point1 // p1 : point2 // p2 : point3 // p3 : point4 // t : 0.0f ` 1.0f */ Vector3 CatmullRom( Vector3& p0, Vector3& p1, Vector3& p2, Vector3& p3, float t); // OBB‚Æ•½–ʂ̏Փ˔»’èŠÖ” bool OBBvsPlane(Obb& obb, Vector3& Normal, Vector3& Cross, float* Len = NULL);
/* Copyright 2017 InitialDLab 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 "server_code/protobuf/sampling_api.pb.h" class query_cursor { public: virtual ~query_cursor() { }; // get the settings requested for the cursor // (what to return as part of the returned elements) virtual bool returning_OID() = 0; virtual bool returning_location() = 0; virtual bool returning_payload() = 0; virtual bool returning_time() = 0; // get the ttl for the object virtual int get_ttl() = 0; // return true if this cursor is expired (lived to the end of its ttl) and is ready to be clearned up virtual bool is_expired() = 0; // get the counted number of elements in the requested range for this query virtual long get_total_elements_in_query_range() = 0; virtual long get_elements_analyzed_count() = 0; // return the region this query is going to sample from virtual serverProto::box get_query_region() = 0; // perform the query and return a query response with the requested data virtual void perform_query(int count, serverProto::QueryResponse&) = 0; };
#include <stdio.h> void heapsort(int a[], int array_size); void adjust(int a[], int root, int n); void display(int a[], int array_size); int main(int argc, char *argv[]) { int a[] = {26, 5, 33, 77, 1, 61, 11, 59, 15, 48, 19, 22}; heapsort(a, 11); display(a, 12); return 0; } /* n: the array_size - 1 */ void heapsort(int a[], int n) { int i, tmp; /* build the heap */ for (i = n/2 - 1; i >= 0; i--) adjust(a, i, n); /* swap the last record with root, and adjust the heap */ for (i = n; i >=1; i--) { tmp = a[0]; a[0] = a[i]; a[i] = tmp; adjust(a, 0, i-1); /* display(a, array_size); */ } } /** * Function: ajust the binary tree to establish the heap * Arguments: * - a: the address of array * - n: the array_size - 1 * */ void adjust(int a[], int root, int n) { int maxchild, tmp; /* perform a heap sort on a[0..array_size] */ while ((2 * root + 1) <= n) { maxchild = 2 * root + 1; // left child if (maxchild < n && a[maxchild] < a[maxchild + 1]) // if have left child and right child, and the right is greater than left maxchild++; // right child if (a[root] > a[maxchild]) break; else { tmp = a[root]; a[root] = a[maxchild]; a[maxchild] = tmp; root = maxchild; } } } void display(int a[], int array_size) { int i; for (i = 0; i < array_size; i++) printf("%d ", a[i]); printf("\n"); }
// // ProfileViewController.h // iFirefeed // // Created by Greg Soltis on 4/4/13. // Copyright (c) 2013 Firebase. All rights reserved. // #import <UIKit/UIKit.h> #import "Firefeed.h" #import "MOGlassButton.h" @interface ProfileViewController : UIViewController @property (strong, nonatomic) NSString* userId; @property (weak, nonatomic) IBOutlet UILabel *nameLabel; @property (weak, nonatomic) IBOutlet UIImageView *profileImage; @property (weak, nonatomic) IBOutlet UITableView *tableView; @property (weak, nonatomic) IBOutlet UITextView *bioTextView; @property (weak, nonatomic) IBOutlet UITextView *locationText; @property (weak, nonatomic) IBOutlet MOGlassButton *actionButton; @property (weak, nonatomic) IBOutlet UISegmentedControl *segmentedControl; @end
// // APExtensionsCore.h // APExtensionsCore // // Created by mac-246 on 2/16/18. // Copyright © 2018 Anton Plebanovich. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for APExtensionsCore. FOUNDATION_EXPORT double APExtensionsCoreVersionNumber; //! Project version string for APExtensionsCore. FOUNDATION_EXPORT const unsigned char APExtensionsCoreVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <APExtensionsCore/PublicHeader.h> #import "APExtensionsLoader.h" #import "APUtils.h"
#import <Foundation/Foundation.h> @interface IntroModel : NSObject @property (nonatomic, strong) NSString *titleText; @property (nonatomic, strong) NSString *descriptionText; @property (nonatomic, strong) NSString *imageName; @property (nonatomic, strong) NSString *_type; //@property (nonatomic, strong) UIImage *image; - (id) initWithTitle:(NSString*)title description:(NSString*)desc image:(NSString*)imageText type:(NSString*) type; @end
// // AppDelegate.h // CoreAnimationDemo // // Created by myzj2004 on 16/6/3. // Copyright © 2016年 myzj2004. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // Created by Ryan Davies on 20/05/2013. // Copyright (c) 2013 Ryan Davies. All rights reserved. // #import <Foundation/Foundation.h> @class PSTLaw; @protocol PSTLawMaking <NSObject> - (PSTLaw *)beEqualTo:(id)other; - (PSTLaw *)beIdenticalTo:(id)other; - (PSTLaw *)beZero; - (PSTLaw *)bePositive; - (PSTLaw *)beNegative; - (PSTLaw *)beGreaterThan:(NSNumber *)number; - (PSTLaw *)beLessThan:(NSNumber *)number; - (PSTLaw *)beGreaterThanOrEqualTo:(NSNumber *)number; - (PSTLaw *)beLessThanOrEqualTo:(NSNumber *)number; - (PSTLaw *)beBetween:(NSNumber *)low and:(NSNumber *)high; - (PSTLaw *)beKindOf:(Class)klass; - (PSTLaw *)beMemberOf:(Class)klass; @end
/*! An abstraction for the Space Invaders flying saucer. * * This structure contains all necessary definitions and functionality for the * eventually appearing flying saucer that flies across the top of scene. This * special entity can be destroyed by the player to earn bonus points based on * the player shot count. */ #ifndef SPACE_INVADERS_FLYING_SAUCER_H #define SPACE_INVADERS_FLYING_SAUCER_H #include "animated_entity.h" #include <array> namespace space_invaders { class FlyingSaucer : public AnimatedEntity { public: /** A constant time interval between appending the flying saucer. */ static const auto APPEAR_INTERVAL = 1200; /** A score table used along with player shot count to resolve points. */ static const std::array<int, 15> POINT_TABLE; // =============================== // = forbidden default functions = // =============================== FlyingSaucer() = delete; FlyingSaucer(const FlyingSaucer&) = delete; FlyingSaucer(FlyingSaucer&&) = delete; FlyingSaucer& operator=(const FlyingSaucer&) = delete; FlyingSaucer& operator=(FlyingSaucer&&) = delete; // ===================== // = allowed functions = // ===================== FlyingSaucer(Game& game); ~FlyingSaucer() override = default; void update(unsigned long dt) override; void explode(); void launch(); int getPoints() const; int getAppearingCounter() const { return mAppearingCounter; } private: int mAppearingCounter; }; } #endif
// Copyright (c) 2009-2012 The Cryptographicanomaly developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef CRYPTOGRAPHICANOMALY_NETBASE_H #define CRYPTOGRAPHICANOMALY_NETBASE_H #include <string> #include <vector> #include "serialize.h" #include "compat.h" extern int nConnectTimeout; #ifdef WIN32 // In MSVC, this is defined as a macro, undefine it to prevent a compile and link error #undef SetPort #endif enum Network { NET_UNROUTABLE, NET_IPV4, NET_IPV6, NET_TOR, NET_MAX, }; extern int nConnectTimeout; extern bool fNameLookup; /** IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96)) */ class CNetAddr { protected: unsigned char ip[16]; // in network byte order public: CNetAddr(); CNetAddr(const struct in_addr& ipv4Addr); explicit CNetAddr(const char *pszIp, bool fAllowLookup = false); explicit CNetAddr(const std::string &strIp, bool fAllowLookup = false); void Init(); void SetIP(const CNetAddr& ip); bool SetSpecial(const std::string &strName); // for Tor addresses bool IsIPv4() const; // IPv4 mapped address (::FFFF:0:0/96, 0.0.0.0/0) bool IsIPv6() const; // IPv6 address (not mapped IPv4, not Tor) bool IsRFC1918() const; // IPv4 private networks (10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12) bool IsRFC3849() const; // IPv6 documentation address (2001:0DB8::/32) bool IsRFC3927() const; // IPv4 autoconfig (169.254.0.0/16) bool IsRFC3964() const; // IPv6 6to4 tunnelling (2002::/16) bool IsRFC4193() const; // IPv6 unique local (FC00::/15) bool IsRFC4380() const; // IPv6 Teredo tunnelling (2001::/32) bool IsRFC4843() const; // IPv6 ORCHID (2001:10::/28) bool IsRFC4862() const; // IPv6 autoconfig (FE80::/64) bool IsRFC6052() const; // IPv6 well-known prefix (64:FF9B::/96) bool IsRFC6145() const; // IPv6 IPv4-translated address (::FFFF:0:0:0/96) bool IsTor() const; bool IsLocal() const; bool IsRoutable() const; bool IsValid() const; bool IsMulticast() const; enum Network GetNetwork() const; std::string ToString() const; std::string ToStringIP() const; unsigned int GetByte(int n) const; uint64 GetHash() const; bool GetInAddr(struct in_addr* pipv4Addr) const; std::vector<unsigned char> GetGroup() const; int GetReachabilityFrom(const CNetAddr *paddrPartner = NULL) const; void print() const; #ifdef USE_IPV6 CNetAddr(const struct in6_addr& pipv6Addr); bool GetIn6Addr(struct in6_addr* pipv6Addr) const; #endif friend bool operator==(const CNetAddr& a, const CNetAddr& b); friend bool operator!=(const CNetAddr& a, const CNetAddr& b); friend bool operator<(const CNetAddr& a, const CNetAddr& b); IMPLEMENT_SERIALIZE ( READWRITE(FLATDATA(ip)); ) }; /** A combination of a network address (CNetAddr) and a (TCP) port */ class CService : public CNetAddr { protected: unsigned short port; // host order public: CService(); CService(const CNetAddr& ip, unsigned short port); CService(const struct in_addr& ipv4Addr, unsigned short port); CService(const struct sockaddr_in& addr); explicit CService(const char *pszIpPort, int portDefault, bool fAllowLookup = false); explicit CService(const char *pszIpPort, bool fAllowLookup = false); explicit CService(const std::string& strIpPort, int portDefault, bool fAllowLookup = false); explicit CService(const std::string& strIpPort, bool fAllowLookup = false); void Init(); void SetPort(unsigned short portIn); unsigned short GetPort() const; bool GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const; bool SetSockAddr(const struct sockaddr* paddr); friend bool operator==(const CService& a, const CService& b); friend bool operator!=(const CService& a, const CService& b); friend bool operator<(const CService& a, const CService& b); std::vector<unsigned char> GetKey() const; std::string ToString() const; std::string ToStringPort() const; std::string ToStringIPPort() const; void print() const; #ifdef USE_IPV6 CService(const struct in6_addr& ipv6Addr, unsigned short port); CService(const struct sockaddr_in6& addr); #endif IMPLEMENT_SERIALIZE ( CService* pthis = const_cast<CService*>(this); READWRITE(FLATDATA(ip)); unsigned short portN = htons(port); READWRITE(portN); if (fRead) pthis->port = ntohs(portN); ) }; typedef std::pair<CService, int> proxyType; enum Network ParseNetwork(std::string net); void SplitHostPort(std::string in, int &portOut, std::string &hostOut); bool SetProxy(enum Network net, CService addrProxy, int nSocksVersion = 5); bool GetProxy(enum Network net, proxyType &proxyInfoOut); bool IsProxy(const CNetAddr &addr); bool SetNameProxy(CService addrProxy, int nSocksVersion = 5); bool HaveNameProxy(); bool LookupHost(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions = 0, bool fAllowLookup = true); bool LookupHostNumeric(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions = 0); bool Lookup(const char *pszName, CService& addr, int portDefault = 0, bool fAllowLookup = true); bool Lookup(const char *pszName, std::vector<CService>& vAddr, int portDefault = 0, bool fAllowLookup = true, unsigned int nMaxSolutions = 0); bool LookupNumeric(const char *pszName, CService& addr, int portDefault = 0); bool ConnectSocket(const CService &addr, SOCKET& hSocketRet, int nTimeout = nConnectTimeout); bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest, int portDefault = 0, int nTimeout = nConnectTimeout); #endif
#include "clock.h" #include <stdlib.h> #include <stdbool.h> #include "../../common/io/outputStream.h" #include "../../common/io/printWriter.h" void printClock(OutputStream* outputStream, Clock* clock) { ClockData* clockData = &(clock->clockData); appendHex2(outputStream, clockData->hour); append(outputStream, ':'); appendHex2(outputStream, clockData->minute); append(outputStream, ':'); appendHex2(outputStream, clockData->second); appendSpace(outputStream); appendHex2(outputStream, clockData->day); append(outputStream, '/'); appendHex2(outputStream, clockData->month); append(outputStream, '/'); appendHex2(outputStream, clockData->year); } void initClock(Clock* clock, WriteClockFunction* writeClock, ReadClockFunction* readClock, int* object) { clock->clockData.year = 0; clock->clockData.month = 0; clock->clockData.dayofweek = 0; clock->clockData.day = 0; clock->clockData.hour = 0; clock->clockData.minute = 0; clock->clockData.second = 0; clock->writeClock = writeClock; clock->readClock = readClock; clock->object = object; } bool isClockInitialized(Clock* clock) { if (clock->writeClock == NULL || clock->readClock == NULL) { return false; } return true; }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <iWorkImport/GQDRGradient.h> @interface GQDRGradient (Private) - (int)readAttributesFromReader:(struct _xmlTextReader *)arg1; @end
#ifndef DOUBLE_T_DEF_H_ #define DOUBLE_T_DEF_H_ #include "bits/float.h" #if FLT_EVAL_METHOD == 0 typedef double double_t ; #elif FLT_EVAL_METHOD == 1 typedef double double_t; #elif FLT_EVAL_METHOD == 2 typedef long double double_t; #endif #endif
#pragma once // http://www.w3.org/TR/webaudio/#GainNode #include "AudioNode.h" #include "AudioParam.h" #include <cstddef> class GainNode : public AudioNode { public: GainNode(AudioContext* audioContext) : AudioNode(audioContext), _input(NULL), _output(NULL) {} void connect(AudioNode* destination) override; inline void connect(AudioParamFloat* destination) override {} void disconnect(AudioNode* destination) override; inline void disconnect(AudioParamFloat* destination) override {} void process(int64_t& sample) override; inline int nbr_inputs() override { return 1; } inline int nbr_outputs() override {return 1; } inline int nbr_params() override {return 0; } AudioParam<double> gain; protected: void hook(AudioNode* input) override; void unhook(AudioNode* input) override; AudioNode* _input; //single input AudioNode* _output; //single output };
// // Created by matti on 5.9.2015. // #include <stdio.h> main() { printf("%d\n", EOF); }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSObject.h" @class NSArray, NSDictionary; @interface Xcode3InfoController : NSObject { id <IDEBlueprint> _blueprint; } @property(readonly) id <IDEBlueprint> blueprint; // @synthesize blueprint=_blueprint; - (void).cxx_destruct; - (id)initWithBlueprint:(id)arg1; // Remaining properties @property(copy) NSDictionary *infoDictionary; // @dynamic infoDictionary; @property(readonly) NSArray *slices; // @dynamic slices; @end
#ifndef __NODE_IMGPROC_H #define __NODE_IMGPROC_H #include "OpenCV.h" // Implementation of imgproc.hpp functions class ImgProc: public Nan::ObjectWrap { public: static void Init(Handle<Object> target); static NAN_METHOD(Undistort); static NAN_METHOD(InitUndistortRectifyMap); static NAN_METHOD(Remap); }; #endif
#pragma once #include <UI/Dialogs/Editors/propeditor/ipropeditor.h> #include <core/mapi/cache/mapiObjects.h> namespace dialog::editor { class CPropertyEditor : public IPropEditor { public: CPropertyEditor( _In_ CWnd* pParentWnd, _In_ std::shared_ptr<cache::CMapiObjects> lpMapiObjects, UINT uidTitle, const std::wstring& name, bool bIsAB, bool bMVRow, _In_opt_ LPMAPIPROP lpMAPIProp, ULONG ulPropTag, _In_opt_ const _SPropValue* lpsPropValue); ~CPropertyEditor(); // Get values after we've done the DisplayDialog _Check_return_ LPSPropValue getValue() noexcept; private: BOOL OnInitDialog() override; void InitPropertyControls(); void WriteStringsToSPropValue(); _Check_return_ ULONG HandleChange(UINT nID) override; void OnOK() override; void OpenEntry(_In_ const SBinary& bin); // source variables LPMAPIPROP m_lpMAPIProp{}; // Used only for parsing ULONG m_ulPropTag{}; bool m_bIsAB{}; // whether the tag is from the AB or not const _SPropValue* m_lpsInputValue{}; bool m_bDirty{}; bool m_bMVRow{}; // whether this row came from a multivalued property. Used for smart view parsing. const std::wstring m_name; SPropValue m_sOutputValue{}; std::vector<BYTE> m_bin; // Temp storage for m_sOutputValue GUID m_guid{}; // Temp storage for m_sOutputValue std::shared_ptr<cache::CMapiObjects> m_lpMapiObjects{}; }; } // namespace dialog::editor
// $Header$ /* ---------------------------------------------------------------------------- array2.h mbwall 25feb95 Copyright (c) 1995 Massachusetts Institute of Technology all rights reserved DESCRIPTION: This header defines the interface for the 2D array genome. See comments in 1D array file. ---------------------------------------------------------------------------- */ #ifndef _ga_array2_h_ #define _ga_array2_h_ #include <ga-mpi/GAArray.h> #include <ga-mpi/GAGenome.h> #include <ga-mpi/GAAllele.h> /* ---------------------------------------------------------------------------- 2DArrayGenome ---------------------------------------------------------------------------- */ template <class T> class GA2DArrayGenome : public GAArray<T>, public GAGenome { public: GADeclareIdentity(); static int SwapMutator(GAGenome&, float); static float ElementComparator(const GAGenome&, const GAGenome&); static int UniformCrossover(const GAGenome&, const GAGenome&, GAGenome*, GAGenome*); static int EvenOddCrossover(const GAGenome&, const GAGenome&, GAGenome*, GAGenome*); static int OnePointCrossover(const GAGenome&, const GAGenome&, GAGenome*, GAGenome*); public: GA2DArrayGenome(unsigned int x, unsigned int y, GAGenome::Evaluator f=(GAGenome::Evaluator)0, void * u=(void *)0); GA2DArrayGenome(const GA2DArrayGenome<T> & orig); GA2DArrayGenome<T>& operator=(const GAGenome& orig) {copy(orig); return *this;} GA2DArrayGenome<T>& operator=(const T array []){ for(unsigned int i=0; i<nx; i++) for(unsigned int j=0; j<ny; j++) gene(i,j,*(array+j*nx+i)); return *this; } virtual ~GA2DArrayGenome(); virtual GAGenome * clone(GAGenome::CloneMethod flag=CONTENTS) const; virtual void copy(const GAGenome & chrom); #ifdef GALIB_USE_STREAMS virtual int read(STD_ISTREAM & is); virtual int write (STD_OSTREAM & os) const; #endif virtual int equal(const GAGenome & c) const; const T & gene(unsigned int x, unsigned int y) const { return this->a[y*nx+x]; } T & gene(unsigned int x, unsigned int y, const T & value) { if(this->a[y*nx+x] != value) { this->a[y*nx+x] = value; _evaluated = gaFalse; } return this->a[y*nx+x]; } int width() const {return nx;} int width(int w){resize(w, ny); return nx;} int height() const {return ny;} int height(int h){resize(nx, h); return ny;} virtual int resize(int x, int y); int resizeBehaviour(Dimension which) const; int resizeBehaviour(Dimension which, unsigned int lower, unsigned int upper); int resizeBehaviour(unsigned int lowerX, unsigned int upperX, unsigned int lowerY, unsigned int upperY){ return(resizeBehaviour(WIDTH, lowerX, upperX) * resizeBehaviour(HEIGHT, lowerY, upperY)); } void copy(const GA2DArrayGenome &, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); void swap(unsigned int a, unsigned int b, unsigned int c, unsigned int d){ GAArray<T>::swap(b*nx+a, d*nx+c); _evaluated = gaFalse; } protected: GAAlleleSet<T> * as; // the allele set unsigned int nx, ny, minX, minY, maxX, maxY; }; /* ---------------------------------------------------------------------------- 2DArrayAlleleGenome ---------------------------------------------------------------------------- */ template <class T> class GA2DArrayAlleleGenome : public GA2DArrayGenome<T> { public: GADeclareIdentity(); static void UniformInitializer(GAGenome&); static int FlipMutator(GAGenome&, float); public: GA2DArrayAlleleGenome(unsigned int x, unsigned int y, const GAAlleleSet<T> & a, GAGenome::Evaluator f=(GAGenome::Evaluator)0, void * u=(void *)0); GA2DArrayAlleleGenome(unsigned int x, unsigned int y, const GAAlleleSetArray<T> & a, GAGenome::Evaluator f=(GAGenome::Evaluator)0, void * u=(void *)0); GA2DArrayAlleleGenome(const GA2DArrayAlleleGenome<T> & orig); GA2DArrayAlleleGenome<T>& operator=(const GAGenome& orig) {copy(orig); return *this;} GA2DArrayAlleleGenome<T>& operator=(const T array []) { GA2DArrayGenome<T>::operator=(array); return *this; } virtual ~GA2DArrayAlleleGenome(); virtual GAGenome * clone(GAGenome::CloneMethod flag=GAGenome::CONTENTS) const; virtual void copy(const GAGenome &); #ifdef GALIB_USE_STREAMS virtual int read(STD_ISTREAM & is); virtual int write (STD_OSTREAM & os) const ; #endif int equal(const GAGenome & c) const ; virtual int resize(int x, int y); const GAAlleleSet<T>& alleleset(unsigned int i=0) const {return aset[i%naset];} protected: int naset; GAAlleleSet<T> * aset; }; #ifdef GALIB_USE_BORLAND_INST #include <ga-mpi/GA2DArrayGenome.C> #endif #endif
#include "include/includes.h" #include "commands.h"
#ifndef _AVALANCHE_LOGIN_MULTITOKENGENERATOR_H_ #define _AVALANCHE_LOGIN_MULTITOKENGENERATOR_H_ #include "AuthGenerator.h" #include <string> namespace avalanche { class MultiTokenGenerator : public AuthGenerator { private: struct UserToken { std::string username; mc::core::AuthToken token; UserToken(const std::string& username, mc::core::AuthToken token) : username(username), token(token) { } }; std::vector<UserToken> m_Users; std::size_t m_Index; public: MultiTokenGenerator(); bool Initialize(const std::string& filename); Authenticator Generate() override; std::size_t GetIndex() const { return m_Index; } bool ReadJSON(const Json::Value& node) override; static const char *s_Name; }; } // ns avalanche #endif
#pragma once #include "DxEnums.h" #include "CoreHeader.h" class DX12Base; class CommandAllocator { public: CommandAllocator(); ~CommandAllocator(); void Initialize(D3D12_COMMAND_LIST_TYPE type, DX12Base * pDxBase); HRESULT Reset(); //owns this ID3D12CommandAllocator * pDxAllocator_; D3D12_COMMAND_LIST_TYPE mAllocatorType_; //queue used with this allocator };
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_cpy_15.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE193.label.xml Template File: sources-sink-15.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Allocate memory for a string, but do not allocate space for NULL terminator * GoodSource: Allocate enough memory for a string and the NULL terminator * Sink: cpy * BadSink : Copy string to data using wcscpy() * Flow Variant: 15 Control flow: switch(6) * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif /* MAINTENANCE NOTE: The length of this string should equal the 10 */ #define SRC_STRING L"AAAAAAAAAA" #ifndef OMITBAD void CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_cpy_15_bad() { wchar_t * data; data = NULL; switch(6) { case 6: /* FLAW: Did not leave space for a null terminator */ data = (wchar_t *)malloc(10*sizeof(wchar_t)); break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; } { wchar_t source[10+1] = SRC_STRING; /* POTENTIAL FLAW: data may not have enough space to hold source */ wcscpy(data, source); printWLine(data); free(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the switch to switch(5) */ static void goodG2B1() { wchar_t * data; data = NULL; switch(5) { case 6: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; default: /* FIX: Allocate space for a null terminator */ data = (wchar_t *)malloc((10+1)*sizeof(wchar_t)); break; } { wchar_t source[10+1] = SRC_STRING; /* POTENTIAL FLAW: data may not have enough space to hold source */ wcscpy(data, source); printWLine(data); free(data); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the switch */ static void goodG2B2() { wchar_t * data; data = NULL; switch(6) { case 6: /* FIX: Allocate space for a null terminator */ data = (wchar_t *)malloc((10+1)*sizeof(wchar_t)); break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; } { wchar_t source[10+1] = SRC_STRING; /* POTENTIAL FLAW: data may not have enough space to hold source */ wcscpy(data, source); printWLine(data); free(data); } } void CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_cpy_15_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_cpy_15_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_cpy_15_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#include <stdio.h> int main(int argc, char* argv[]) { FILE *arquivo; int c; // variável inteira para receber o arquivo int cl = 0; // contador de linhas int cb = 0; // contador de bytes int cp = 0; // contador de palavras int iniciop = 0; // demarcar o inicio da palavra /* char nomearquivo [30]; printf("Digite o nome do arquivo: \n"); // conversação com o usuário scanf("%s", nomearquivo); // recebe o nome do arquivo */ arquivo = fopen(argv[1], "r"); // abre o arquivo c = getc(arquivo); while ( c != -1 ) { cb++; // contando os bytes if (c == '\n') cl = cl + 1; // contando as linhas if ( (c != ' ') && (c !='\n') && (!iniciop) ) iniciop = 1; // não tem palavras if ( (c == ' ') || (c == '\n') && (iniciop) ) { iniciop = 0; // iniciou-se a primeira palavras cp++; // contando as palavras } printf("%i %c %x\n", c, c, c); // mostrando o arquivo em inteiro, literal e hexadecimal c = getc(arquivo); // 1 reptição e meia } printf("L=%i, P= %i, B=%i\n", cl, cp - 1, cb); // cp - 1 : contador de palavras conta uma palavra a mais fclose(arquivo); return 0; }
/* * SpeedBoost.h * * Created on: Feb 27, 2016 * Author: Edward */ #ifndef SRC_COMMANDS_TURNBOOST_H_ #define SRC_COMMANDS_TURNBOOST_H_ #include "Subsystems/OI.h" namespace commands { class TurnBoost: public Command { public: using OI_t = subsystems::OI; public: TurnBoost(OI_t *oi, double boost_power): oi_(oi), power_(boost_power) { SetRunWhenDisabled(true); } virtual ~TurnBoost() = default; public: /// Sets the turn to power_ void Initialize() override; /// Nada void Execute() override {} /// Always returns false bool IsFinished() override {return false;} /// Sets the multipliers back to what they were void End() override; /// Calls End void Interrupted() override; private: OI_t *oi_; double power_; }; } #endif /* SRC_COMMANDS_TURNBOOST_H_ */
// This library is distributed in the hope that it will be useful but without // any warranty; without even the implied warranty of merchantability or // fitness for a particular purpose. // The use and distribution terms for this software are covered by the Eclipse // Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which // can be found in the file epl-v10.html at the root of this distribution. // By using this software in any fashion, you are agreeing to be bound by the // terms of this license. You must not remove this notice, or any other, from // this software. // Copyright (c) 2013-2016, Kenneth Leung. All rights reserved. #pragma once ////////////////////////////////////////////////////////////////////////////// #include "ecs/Engine.h" #include "n/C.h" NS_BEGIN(tetris) ////////////////////////////////////////////////////////////////////////////// // struct CC_DLL GEngine : public ecs::Engine { virtual void initEntities(); virtual void initSystems(); }; NS_END
/* * Copyright (c) 2012-2013 NEC Corporation * All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html */ /* * ipc.c - IPC framework utilities. */ #include <pfc/ipc_pfcd.h> #include <pfc/conf.h> #include "pfc_control.h" #include "ipc.h" /* * IPC channel name of the PFC daemon. */ static const char *pfcd_channel; /* * IPC channel address specified by command line option. */ static const char *pfcd_channel_addr; /* * True if user and group was switched. */ static pfc_bool_t cred_switched = PFC_FALSE; /* * void * ipc_init(const char *chaddr) * Initialize IPC client which connects to the PFC daemon. */ void ipc_init(const char *chaddr) { pfc_cfblk_t cfblk; int err; if (chaddr == NULL) { /* Determine IPC channel name of the PFC daemon. */ cfblk = pfc_sysconf_get_block("ipc_server"); chaddr = pfc_conf_get_string(cfblk, "channel_name", daemon_name); if (PFC_EXPECT_FALSE(*chaddr == '\0')) { /* IPC server is disabled. */ return; } } else { pfcd_channel_addr = chaddr; } /* Change IPC channel address of the default connection. */ err = pfc_ipcclnt_setdefault(chaddr); if (PFC_EXPECT_FALSE(err != 0)) { fatal("Failed to set IPC channel address to \"%s\": %s", chaddr, strerror(err)); /* NOTREACHED */ } debug_printf(1, "IPC channel = %s", chaddr); pfcd_channel = chaddr; } /* * int * ipc_sess_create_pfcd(pfc_ipcsess_t **PFC_RESTRICT sessp, pfc_ipcid_t service) * Create an IPC client session which connects to the PFC daemon. * * Calling/Exit State: * Upon successful completion, a pointer to IPC client session is set * to the buffer pointed by `sessp', and zero is returned. * Otherwise error number which indicates the cause of error is returned. * * Remarks: * This function changes user and group ID of the calling process if * user and group is defined in pfcd.conf. */ int ipc_sess_create_pfcd(pfc_ipcsess_t **PFC_RESTRICT sessp, pfc_ipcid_t service) { pfc_ipcsess_t *sess; pfc_timespec_t ts; int err; if (PFC_EXPECT_FALSE(pfcd_channel == NULL)) { error("IPC service on %s is disabled.", daemon_name); return ENOSYS; } if (!cred_switched) { /* * Switch user and group as per pfcd.conf. * pfccmd_switchuser() never returns on error because it will * call fatal(). */ PFC_ASSERT_INT(pfccmd_switchuser(pfcd_options, PFC_FALSE, fatal), 0); if (ctrl_debug > 0) { debug_printf(1, "uid=%d, gid=%d", getuid(), getgid()); } cred_switched = PFC_TRUE; } debug_printf(1, "IPC service = %u, timeout = %u", service, ctrl_timeout); err = pfc_ipcclnt_sess_create(&sess, PFCD_IPC_SERVICE, service); if (PFC_EXPECT_FALSE(err != 0)) { error("Failed to create IPC client session: %s", strerror(err)); return err; } ts.tv_sec = ctrl_timeout; ts.tv_nsec = 0; err = pfc_ipcclnt_sess_settimeout(sess, &ts); if (PFC_EXPECT_FALSE(err != 0)) { error("Failed to set IPC session timeout: %s", strerror(err)); PFC_ASSERT_INT(pfc_ipcclnt_sess_destroy(sess), 0); return err; } *sessp = sess; return 0; } /* * void * ipc_invocation_error(int err) * Print an error message that represents the cause of IPC service * invocation error. * * `err' must be an error number returned by the call of * pfc_ipcsess_invoke(). */ void ipc_invocation_error(int err) { if (err == ECONNREFUSED) { not_running_ipc(pfcd_channel_addr); } else if (err == EPERM || err == EACCES) { not_allowed(); } else { const char *msg = "Failed to invoke IPC service"; const char *chaddr = pfcd_channel_addr; const char *errmsg = strerror(err); if (chaddr == NULL) { error("%s: %s", msg, errmsg); } else { error("%s at \"%s\": %s", msg, chaddr, errmsg); } } }
#include <linux/module.h> #include <linux/vermagic.h> #include <linux/compiler.h> MODULE_INFO(vermagic, VERMAGIC_STRING); __visible struct module __this_module __attribute__((section(".gnu.linkonce.this_module"))) = { .name = KBUILD_MODNAME, .init = init_module, #ifdef CONFIG_MODULE_UNLOAD .exit = cleanup_module, #endif .arch = MODULE_ARCH_INIT, }; MODULE_INFO(intree, "Y"); static const struct modversion_info ____versions[] __used __attribute__((section("__versions"))) = { { 0xb95b937f, __VMLINUX_SYMBOL_STR(module_layout) }, { 0x6bb32e6b, __VMLINUX_SYMBOL_STR(rc_map_unregister) }, { 0x2e5810c6, __VMLINUX_SYMBOL_STR(__aeabi_unwind_cpp_pr1) }, { 0x444b8c81, __VMLINUX_SYMBOL_STR(rc_map_register) }, }; static const char __module_depends[] __used __attribute__((section(".modinfo"))) = "depends=rc-core"; MODULE_INFO(srcversion, "6570662A5B20E29BED57F76");
/* * \brief Stop-watch base * \author Martin Stein * \date 2012-11-10 */ /* * Copyright (C) 2012 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ #ifndef _INCLUDE__UTIL__VEA9X4__WATCH_BASE_H_ #define _INCLUDE__UTIL__VEA9X4__WATCH_BASE_H_ /* Genode includes */ #include <drivers/board_base.h> #include <io_mem_session/connection.h> #include <drivers/timer/sp804_base.h> namespace Genode { struct Watch_base : Io_mem_connection, Sp804_base<Board_base::SP804_CLOCK> { typedef Io_mem_connection Io_mem; typedef Sp804_base<Board_base::SP804_CLOCK> Timer; static addr_t io_mem_base(unsigned const id) { switch (id) { case 0: return Board_base::SP804_0_1_MMIO_BASE; case 1: return Board_base::SP804_2_3_MMIO_BASE; } PDBG("Invalid watch ID"); return 0; } Watch_base(unsigned const id) : Io_mem(io_mem_base(id), Board_base::SP804_MMIO_SIZE), Timer((addr_t)env()->rm_session()->attach(Io_mem::dataspace())) { } }; } #endif /* _INCLUDE__UTIL__VEA9X4__WATCH_BASE_H_ */
#include <functional> #include "../renderer/renderer.h" #define BUFFER_OFFSET(i) ((char *)NULL + (i)) //Main engine instance. class Engine { Renderer renderer; Storage storage; SDL_GLContext glContext; SDL_Window* mainWindow; std::map<const char*,GLuint> gpuLocations; glm::mat4 camera; glm::mat4 projection; int active = 1; //60 fps (in milliseconds) //(techincally 16.667, but //we need to stick with ints //because SDL //(using constant dT to //prevent explosions) const int deltaT = 16; //In seconds const float physT = 0.06; int timeStepsToProcess = 0; public: Engine(); //Initializes the engine, renderer, and storage bool init( std::string name, int argc, const char* argv[] ); void quit(void); //Starts the main update loop. void start(int lastFrame); //Add a custom function to our update loop. //This is for integrating your own program //with the engine's update loop. bool registerCallback(std::function<void(float)> function); Renderer* getRenderer(void) { return &renderer; }; Storage* getStorage(void) { return &storage; }; //Returns the main SDL window the engine has created SDL_Window* getWindow(void) { return mainWindow; }; void setActiveScene( Scene toSet ); Scene* getActiveScene( void ); private: //The window name/name of this instance std::string name; //The currently active scene Scene activeScene; //Outside functions to be appended //to our main update loop. These //functions will be passed a //deltaT value (in seconds) std::vector< std::function<void(float)> > functions; //Timer for the program std::chrono::steady_clock::time_point beg, end; //Render the objects in objs void render(void); //TODO void processEvents(void); //Initialize SDL functions and the main window bool initSDL(void); };
/* * Bael'Zharon's Respite * Copyright (C) 2014 Daniel Skorupski * * 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 BZR_OBJECTID_H #define BZR_OBJECTID_H class ObjectId { public: ObjectId(); explicit ObjectId(uint32_t val); uint32_t value() const; bool operator==(ObjectId other) const; bool operator!=(ObjectId other) const; private: uint32_t value_; }; namespace std { template<> struct hash<ObjectId> { size_t operator()(ObjectId id) const { return id.value(); } }; } #endif
// // NSString+Shaping.h // FarsiPoemBook // // Created by Ali Nadalizadeh on 4/16/90. // Copyright 2011 Turned on Ventures. All rights reserved. // #import <Foundation/Foundation.h> @interface NSString (Shaping) - shapedString; @end
// Copyright 2008 Google Inc. All rights reserved. // * Redistributions of source code must retain the above copyright // copyright notice, this list of conditions and the following disclaimer // this software without specific prior written permission. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_SERVICE_H__ #define GOOGLE_PROTOBUF_COMPILER_CPP_SERVICE_H__ #include <map> #include <string> #include <google/protobuf/stubs/common.h> #include <google/protobuf/compiler/cpp/cpp_options.h> #include <google/protobuf/descriptor.h> namespace google { namespace protobuf { namespace io { class Printer; } } namespace protobuf { namespace compiler { namespace cpp { class ServiceGenerator { public: explicit ServiceGenerator(const ServiceDescriptor* descriptor, const Options& options); ~ServiceGenerator(); void GenerateDeclarations(io::Printer* printer); void GenerateDescriptorInitializer(io::Printer* printer, int index); void GenerateImplementation(io::Printer* printer); private: enum RequestOrResponse { REQUEST, RESPONSE }; enum VirtualOrNon { VIRTUAL, NON_VIRTUAL }; void GenerateInterface(io::Printer* printer); void GenerateStubDefinition(io::Printer* printer); void GenerateMethodSignatures(VirtualOrNon virtual_or_non, io::Printer* printer); void GenerateNotImplementedMethods(io::Printer* printer); void GenerateCallMethod(io::Printer* printer); void GenerateGetPrototype(RequestOrResponse which, io::Printer* printer); void GenerateStubMethods(io::Printer* printer); const ServiceDescriptor* descriptor_; map<string, string> vars_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceGenerator); }; } } } } #endif
/* * PCIe host controller driver for Hisilicon Hip05 SoCs * * Copyright (C) 2015 Hisilicon Co., Ltd. http://www.hisilicon.com * * Author: Dongdong Liu <liudongdong3@huawei.com> * * 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. */ #ifndef _PCIE_PHY_HISI_H #define _PCIE_PHY_HISI_H struct hisi_pcie { u8 __iomem *subctrl_base; u8 __iomem *reg_base; u8 __iomem *phy_base; u8 __iomem *serdes_base; struct msi_controller *msi; u32 port_id; struct pcie_port pp; }; void hisi_pcie_establish_link(struct hisi_pcie *pcie); #endif /* _PCIE_PHY_HISI_H */
/* (c) 1993 Roger Binns These tools were produced by Roger Binns for a fourth year project as part of a computer science degree, for the Computer Science department, Brunel University, Uxbridge, Middlesex UB8 3PH, United Kingdom. This software is provided in good faith, having been developed by Brunel University students as part of their normal course work. It should not be assumed that Brunel has any rights of ownership, and the University cannot accept any liability for its subsequent use. It is a condition of any such use that the user idemnifies the University against any claim (including third party claims) arising therefrom. */ #ifdef __cplusplus extern "C" { #endif char *my_strndup(char *, int); char *getfunc(char *, int); char *getarg(char *, int, char *); char *getlabel(char *, int); #ifdef __cplusplus } #endif
/* * libxl_domain.h: libxl domain object private state * * Copyright (C) 2011-2014 SUSE LINUX Products GmbH, Nuernberg, Germany. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. * * Authors: * Jim Fehlig <jfehlig@suse.com> */ #ifndef LIBXL_DOMAIN_H # define LIBXL_DOMAIN_H # include <libxl.h> # include "domain_conf.h" # include "libxl_conf.h" # include "virchrdev.h" # define JOB_MASK(job) (1 << (job - 1)) # define DEFAULT_JOB_MASK \ (JOB_MASK(LIBXL_JOB_DESTROY) | \ JOB_MASK(LIBXL_JOB_ABORT)) /* Only 1 job is allowed at any time * A job includes *all* libxl.so api, even those just querying * information, not merely actions */ enum libxlDomainJob { LIBXL_JOB_NONE = 0, /* Always set to 0 for easy if (jobActive) conditions */ LIBXL_JOB_QUERY, /* Doesn't change any state */ LIBXL_JOB_DESTROY, /* Destroys the domain (cannot be masked out) */ LIBXL_JOB_MODIFY, /* May change state */ LIBXL_JOB_LAST }; VIR_ENUM_DECL(libxlDomainJob) struct libxlDomainJobObj { virCond cond; /* Use to coordinate jobs */ enum libxlDomainJob active; /* Currently running job */ int owner; /* Thread which set current job */ unsigned long long started; /* When the job started */ virDomainJobInfoPtr current; /* Statistics for the current job */ }; typedef struct _libxlDomainObjPrivate libxlDomainObjPrivate; typedef libxlDomainObjPrivate *libxlDomainObjPrivatePtr; struct _libxlDomainObjPrivate { virObjectLockable parent; /* console */ virChrdevsPtr devs; libxl_evgen_domain_death *deathW; unsigned short migrationPort; char *lockState; struct libxlDomainJobObj job; }; extern virDomainXMLPrivateDataCallbacks libxlDomainXMLPrivateDataCallbacks; extern virDomainDefParserConfig libxlDomainDefParserConfig; extern const struct libxl_event_hooks ev_hooks; int libxlDomainObjPrivateInitCtx(virDomainObjPtr vm); int libxlDomainObjBeginJob(libxlDriverPrivatePtr driver, virDomainObjPtr obj, enum libxlDomainJob job) ATTRIBUTE_RETURN_CHECK; void libxlDomainObjEndJob(libxlDriverPrivatePtr driver, virDomainObjPtr obj); int libxlDomainJobUpdateTime(struct libxlDomainJobObj *job) ATTRIBUTE_RETURN_CHECK; void libxlDomainEventQueue(libxlDriverPrivatePtr driver, virObjectEventPtr event); char * libxlDomainManagedSavePath(libxlDriverPrivatePtr driver, virDomainObjPtr vm); int libxlDomainSaveImageOpen(libxlDriverPrivatePtr driver, libxlDriverConfigPtr cfg, const char *from, virDomainDefPtr *ret_def, libxlSavefileHeaderPtr ret_hdr) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5); int libxlDomainDestroyInternal(libxlDriverPrivatePtr driver, virDomainObjPtr vm); void libxlDomainCleanup(libxlDriverPrivatePtr driver, virDomainObjPtr vm); /* * Note: Xen 4.3 removed the const from the event handler signature. * Detect which signature to use based on * LIBXL_HAVE_NONCONST_EVENT_OCCURS_EVENT_ARG. */ # ifdef LIBXL_HAVE_NONCONST_EVENT_OCCURS_EVENT_ARG # define VIR_LIBXL_EVENT_CONST /* empty */ # else # define VIR_LIBXL_EVENT_CONST const # endif void libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event); int libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver, virDomainObjPtr vm); int libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm); int libxlDomainStartNew(libxlDriverPrivatePtr driver, virDomainObjPtr vm, bool start_paused); int libxlDomainStartRestore(libxlDriverPrivatePtr driver, virDomainObjPtr vm, bool start_paused, int restore_fd, uint32_t restore_ver); bool libxlDomainDefCheckABIStability(libxlDriverPrivatePtr driver, virDomainDefPtr src, virDomainDefPtr dst); #endif /* LIBXL_DOMAIN_H */
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* Rosegarden A sequencer and musical notation editor. Copyright 2000-2014 the Rosegarden development team. See the AUTHORS file for more 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. See the file COPYING included with this distribution for more information. */ /** * Miscellaneous constants */ #ifndef RG_CONFIG_GROUPS_H #define RG_CONFIG_GROUPS_H namespace Rosegarden { extern const char* const GeneralOptionsConfigGroup; extern const char* const LatencyOptionsConfigGroup; extern const char* const SequencerOptionsConfigGroup; extern const char* const NotationViewConfigGroup; extern const char* const PitchTrackerConfigGroup; extern const char* const AudioManagerDialogConfigGroup; extern const char* const SynthPluginManagerConfigGroup; extern const char* const BankEditorConfigGroup; extern const char* const ColoursConfigGroup; extern const char* const ControlEditorConfigGroup; extern const char* const DeviceManagerConfigGroup; extern const char* const EventFilterDialogConfigGroup; extern const char* const EventViewLayoutConfigGroupName; extern const char* const EventViewConfigGroup; extern const char* const MarkerEditorConfigGroup; extern const char* const MatrixViewConfigGroup; extern const char* const PlayListConfigGroup; extern const char* const MainWindowConfigGroup; extern const char* const TransportDialogConfigGroup; extern const char* const TempoViewLayoutConfigGroupName; extern const char* const TempoViewConfigGroup; extern const char* const TriggerManagerConfigGroup; extern const char* const EditViewConfigGroup; extern const char* const PresetDialogConfigGroup; extern const char* const ExternalApplicationsConfigGroup; extern const char* const LilyPondExportConfigGroup; extern const char* const MusicXMLExportConfigGroup; extern const char* const LastUsedPathsConfigGroup; extern const char* const WindowGeometryConfigGroup; extern const char* const TempDirectoryConfigGroup; extern const char* const NotationOptionsConfigGroup; extern const char* const DialogSuppressorConfigGroup; extern const char* const RecentDirsConfigGroup; extern const char* const CollapsingFrameConfigGroup; extern const char* const PitchBendSequenceConfigGroup; extern const char* const CheckButtonConfigGroup; extern const char* const SelectDialogConfigGroup; } #endif
/* * Copyright (c) 2002-2009 BalaBit 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 version 2 as published * by the Free Software Foundation. * * Note that this permission is granted for only version 2 of the GPL. * * As an additional exemption you are allowed to compile & link against the * OpenSSL libraries as published by the OpenSSL project. See the file * COPYING for details. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef SDFILE_H_INCLUDED #define SDFILE_H_INCLUDED #include "driver.h" #include "logreader.h" #include "logwriter.h" #define AFFILE_PIPE 0x00000001 #define AFFILE_NO_EXPAND 0x00000002 #define AFFILE_TMPL_ESCAPE 0x00000004 #define AFFILE_CREATE_DIRS 0x00000008 #define AFFILE_FSYNC 0x00000010 #define AFFILE_PRIVILEGED 0x00000020 typedef struct _AFFileSourceDriver { LogDriver super; GString *filename; /* FIXME: the code assumes that reader is a LogReader at a lot of places, so this should be changed to LogReader */ LogPipe *reader; LogReaderOptions reader_options; guint32 flags; /* state information to follow a set of files using a wildcard expression */ } AFFileSourceDriver; LogDriver *affile_sd_new(gchar *filename, guint32 flags); void affile_sd_set_recursion(LogDriver *s, const gint recursion); void affile_sd_set_pri_level(LogDriver *s, const gint16 severity); void affile_sd_set_pri_facility(LogDriver *s, const gint16 facility); typedef struct _AFFileDestWriter AFFileDestWriter; typedef struct _AFFileDestDriver { LogDriver super; LogTemplate *filename_template; AFFileDestWriter *single_writer; guint32 flags; gint file_uid; gint file_gid; gint file_perm; gint dir_uid; gint dir_gid; gint dir_perm; gchar *local_time_zone; TimeZoneInfo *local_time_zone_info; LogWriterOptions writer_options; GHashTable *writer_hash; gint overwrite_if_older; gboolean use_time_recvd; gint time_reap; guint reap_timer; } AFFileDestDriver; LogDriver *affile_dd_new(gchar *filename, guint32 flags); void affile_dd_set_compress(LogDriver *s, gboolean compress); void affile_dd_set_encrypt(LogDriver *s, gboolean enable); void affile_dd_set_file_uid(LogDriver *s, const gchar *file_uid); void affile_dd_set_file_gid(LogDriver *s, const gchar *file_gid); void affile_dd_set_file_perm(LogDriver *s, mode_t file_perm); void affile_dd_set_dir_uid(LogDriver *s, const gchar *dir_uid); void affile_dd_set_dir_gid(LogDriver *s, const gchar *dir_gid); void affile_dd_set_dir_perm(LogDriver *s, mode_t dir_perm); void affile_dd_set_create_dirs(LogDriver *s, gboolean create_dirs); void affile_dd_set_fsync(LogDriver *s, gboolean enable); void affile_dd_set_overwrite_if_older(LogDriver *s, gint overwrite_if_older); void affile_dd_set_local_time_zone(LogDriver *s, const gchar *local_time_zone); #endif
#include "font.h" #include "TFT_LCD.h" const uint8_t * font; FONT_HEADER_T * font_header; GLYPH_INDEX_T * glyph_index; COLOR_T fg, bg; uint8_t G_TFT_char_width, G_TFT_char_height; const uint8_t * fonts[] = {Lucida_Console8x13, Lucida_Console12x19}; // Lucida_Console20x31}; const uint8_t char_widths[] = {8, 12, 20}; const uint8_t char_heights[] = {13, 19, 31}; void TFT_Text_Set_Colors(COLOR_T * foreground, COLOR_T * background) { fg.R = foreground->R; fg.G = foreground->G; fg.B = foreground->B; bg.R = background->R; bg.G = background->G; bg.B = background->B; } void TFT_Erase(void) { TFT_Fill_Buffer(&bg); } void TFT_Text_Init(uint8_t font_num) { #if 0 // Code for multiple fonts not working yet font = fonts[font_num]; G_TFT_char_width = char_widths[font_num]; G_TFT_char_height = char_heights[font_num]; #else // This code is working font = Lucida_Console12x19; G_TFT_char_width = 12; G_TFT_char_height = 19; #endif font_header = (FONT_HEADER_T *) font; glyph_index = (GLYPH_INDEX_T *) (font + sizeof(FONT_HEADER_T)); // Set default FG and BG colors fg.R = 255; fg.G = 255; fg.B = 0; bg.R = 0; bg.G = 0; bg.B = 0; } void TFT_Text_PrintChar(PT_T * pos, char ch) { uint8_t glyph_index_entry; const uint8_t * glyph_data; // start of the data PT_T end_pos; COLOR_T * pixel_color; uint8_t bitmap_byte; uint8_t glyph_width, x_bm; uint32_t offset; uint32_t row, col, num_pixels; glyph_index_entry = ch - font_header->FirstChar; glyph_width = glyph_index[glyph_index_entry].Width; offset = glyph_index[glyph_index_entry].Offset; glyph_data = &(font[offset]); end_pos.X = pos->X+CHAR_WIDTH-1; end_pos.Y = pos->Y+CHAR_HEIGHT-1; TFT_Start_Rectangle(pos, &end_pos); for (row = 0; row < CHAR_HEIGHT; row++) { x_bm = 0; do { bitmap_byte = *glyph_data; if (bitmap_byte == 0x00) { num_pixels = MIN(8,glyph_width - x_bm); TFT_Write_Rectangle_Pixel(&bg, num_pixels); x_bm += num_pixels; } else if (bitmap_byte == 0xff) { num_pixels = MIN(8,glyph_width - x_bm); TFT_Write_Rectangle_Pixel(&fg, num_pixels); x_bm += num_pixels; } else { col = 0; num_pixels = 0; if ((bitmap_byte & 0x7f) == 0) { num_pixels = MIN(7,glyph_width - x_bm); TFT_Write_Rectangle_Pixel(&bg, num_pixels); } else if ((bitmap_byte & 0x7f) == 0x7f) { num_pixels = MIN(7,glyph_width - x_bm); TFT_Write_Rectangle_Pixel(&fg, num_pixels); } else if ((bitmap_byte & 0x3f) == 0) { num_pixels = MIN(6,glyph_width - x_bm); TFT_Write_Rectangle_Pixel(&bg, num_pixels); } else if ((bitmap_byte & 0x3f) == 0x3f) { num_pixels = MIN(6,glyph_width - x_bm); TFT_Write_Rectangle_Pixel(&fg, num_pixels); } else if ((bitmap_byte & 0x1f) == 0) { num_pixels = MIN(5,glyph_width - x_bm); TFT_Write_Rectangle_Pixel(&bg, num_pixels); } else if ((bitmap_byte & 0x1f) == 0x1f) { num_pixels = MIN(5,glyph_width - x_bm); TFT_Write_Rectangle_Pixel(&fg, num_pixels); } else if ((bitmap_byte & 0x0f) == 0) { num_pixels = MIN(4,glyph_width - x_bm); TFT_Write_Rectangle_Pixel(&bg, num_pixels); } else if ((bitmap_byte & 0x0f) == 0x0f) { num_pixels = MIN(4,glyph_width - x_bm); TFT_Write_Rectangle_Pixel(&fg, num_pixels); } if (num_pixels > 0) { x_bm += num_pixels; col += num_pixels; bitmap_byte >>= num_pixels; } for (; col < 8; col++) { if (bitmap_byte & 0x01) // if pixel is to be set pixel_color = &fg; else pixel_color = &bg; TFT_Write_Rectangle_Pixel(pixel_color, 1); bitmap_byte >>= 1; x_bm++; if (x_bm >= glyph_width) break; } } glyph_data++; } while (x_bm < glyph_width); if (x_bm < CHAR_WIDTH) { // fill in rest of cell with background color for narrow glyphs TFT_Write_Rectangle_Pixel(&bg, CHAR_WIDTH - x_bm); } } } void TFT_Text_PrintStr(PT_T * pos, char * str) { while (*str) { TFT_Text_PrintChar(pos, *str); str++; pos->X += CHAR_WIDTH; // forces monospacing for fonts } } void TFT_Text_PrintStr_RC( uint8_t row, uint8_t col, char *str ) { PT_T pos; pos.X = COL_TO_X( col ); pos.Y = ROW_TO_Y( row ); while( *str ) { TFT_Text_PrintChar( &pos, *str ); str++; pos.X += CHAR_WIDTH; /* forces monospacing for fonts */ } }
/* * File : serial.h * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes * 2012-05-15 lgnq first version. * 2012-05-28 bernard chage interfaces */ #ifndef __SERIAL_H__ #define __SERIAL_H__ #include <rtthread.h> #define BAUD_RATE_9600 9600 #define BAUD_RATE_115200 115200 #define DATA_BITS_5 5 #define DATA_BITS_6 6 #define DATA_BITS_7 7 #define DATA_BITS_8 8 #define DATA_BITS_9 9 #define STOP_BITS_1 0 #define STOP_BITS_2 1 #define STOP_BITS_3 2 #define STOP_BITS_4 3 #define PARITY_NONE 0 #define PARITY_ODD 1 #define PARITY_EVEN 2 #define BIT_ORDER_LSB 0 #define BIT_ORDER_MSB 1 #define NRZ_NORMAL 0 /* Non Return to Zero : normal mode */ #define NRZ_INVERTED 1 /* Non Return to Zero : inverted mode */ #define UART_RX_BUFFER_SIZE 64 #define UART_TX_BUFFER_SIZE 64 #define SERIAL_RBUFFER_SIZE 64 #define RT_DEVICE_CTRL_CONFIG 0x03 /* configure device */ #define RT_DEVICE_CTRL_SET_INT 0x10 /* enable receive irq */ #define RT_DEVICE_CTRL_CLR_INT 0x11 /* disable receive irq */ #define RT_DEVICE_CTRL_GET_INT 0x12 #define RT_SERIAL_RX_INT 0x01 #define RT_SERIAL_TX_INT 0x02 #define RT_SERIAL_ERR_OVERRUN 0x01 #define RT_SERIAL_ERR_FRAMING 0x02 #define RT_SERIAL_ERR_PARITY 0x03 struct serial_ringbuffer { rt_uint8_t buffer[SERIAL_RBUFFER_SIZE]; rt_uint16_t put_index, get_index; }; struct serial_configure { rt_uint32_t baud_rate; rt_uint32_t data_bits :4; rt_uint32_t stop_bits :2; rt_uint32_t parity :2; rt_uint32_t bit_order :1; rt_uint32_t invert :1; rt_uint32_t reserved :20; }; struct rt_serial_device { struct rt_device parent; const struct rt_uart_ops *ops; struct serial_configure config; /* rx structure */ struct serial_ringbuffer *int_rx; /* tx structure */ struct serial_ringbuffer *int_tx; }; typedef struct rt_serial_device rt_serial_t; /** * uart operators */ struct rt_uart_ops { rt_err_t (*configure)(struct rt_serial_device *serial, struct serial_configure *cfg); rt_err_t (*control)(struct rt_serial_device *serial, int cmd, void *arg); int (*putc)(struct rt_serial_device *serial, char c); int (*getc)(struct rt_serial_device *serial); }; void rt_hw_serial_isr(struct rt_serial_device *serial); rt_err_t rt_hw_serial_register(struct rt_serial_device *serial, const char *name, rt_uint32_t flag, void *data); #endif
#include <stdio.h> #include <glib.h> #include <json-glib/json-glib.h> #include "mfp_dsp.h" int api_rpcid = -1; static void api_create_callback(JsonNode * response, void * data) { if (JSON_NODE_TYPE(response) == JSON_NODE_ARRAY) { JsonArray * arry = json_node_get_array(response); JsonNode * val = json_array_get_element(arry, 1); if (JSON_NODE_TYPE(val) == JSON_NODE_VALUE) { api_rpcid = (int)json_node_get_double(val); return; } } } void mfp_api_init(void) { const char method[] = "create"; const char params[] = "{ \"type\": \"MFPCommand\" }"; char * msgbuf = mfp_comm_get_buffer(); int msglen = 0; int request_id = mfp_rpc_request(method, params, api_create_callback, NULL, msgbuf, &msglen); mfp_comm_submit_buffer(msgbuf, msglen); mfp_rpc_wait(request_id); return; } static void api_load_callback(JsonNode * response, void * data) { int patch_objid; mfp_context * context = (mfp_context *)data; if (JSON_NODE_TYPE(response) == JSON_NODE_ARRAY) { JsonArray * arry = json_node_get_array(response); JsonNode * val = json_array_get_element(arry, 1); if (JSON_NODE_TYPE(val) == JSON_NODE_VALUE) { patch_objid = (int)json_node_get_double(val); mfp_context_default_io(context, patch_objid); } } } int mfp_api_send_to_inlet(mfp_context * context, int port, float value, char * msgbuf, int * msglen) { const char method[] = "call"; const char params[] = "{\"func\": \"send\", \"rpcid\": %d, \"args\": " "[ %d, %d, %f ], \"kwargs\": {} }"; char tbuf[MFP_MAX_MSGSIZE]; snprintf(tbuf, MFP_MAX_MSGSIZE-1, params, api_rpcid, context->default_obj_id, port, value); int request_id = mfp_rpc_request(method, tbuf, NULL, NULL, msgbuf, msglen); return request_id; } int mfp_api_send_to_outlet(mfp_context * context, int port, float value, char * msgbuf, int * msglen) { const char method[] = "call"; const char params[] = "{\"func\": \"send_to_outlet\", \"rpcid\": %d, \"args\": " "[ %d, %d, %f ], \"kwargs\": {} }"; char tbuf[MFP_MAX_MSGSIZE]; snprintf(tbuf, MFP_MAX_MSGSIZE-1, params, api_rpcid, context->default_obj_id, port, value); int request_id = mfp_rpc_request(method, tbuf, NULL, NULL, msgbuf, msglen); return request_id; } int mfp_api_show_editor(mfp_context * context, int show, char * msgbuf, int * msglen) { const char method[] = "call"; const char params[] = "{\"func\": \"show_editor\", \"rpcid\": %d, \"args\": " "[ %d, %d ], \"kwargs\": {} }"; char tbuf[MFP_MAX_MSGSIZE]; snprintf(tbuf, MFP_MAX_MSGSIZE-1, params, api_rpcid, context->default_obj_id, show); int request_id = mfp_rpc_request(method, tbuf, NULL, NULL, msgbuf, msglen); return request_id; } int mfp_api_open_context(mfp_context * context, char * msgbuf, int * msglen) { const char method[] = "call"; const char params[] = "{\"func\": \"open_context\", \"rpcid\": %d, \"args\": " "[%d, %d, %d, %d ], \"kwargs\": {} }"; char tbuf[MFP_MAX_MSGSIZE]; snprintf(tbuf, MFP_MAX_MSGSIZE-1, params, api_rpcid, mfp_comm_nodeid, context->id, context->owner, context->samplerate); int request_id = mfp_rpc_request(method, tbuf, NULL, NULL, msgbuf, msglen); return request_id; } int mfp_api_load_context(mfp_context * context, char * patchfile, char * msgbuf, int * msglen) { const char method[] = "call"; const char params[] = "{\"func\": \"load_context\", \"rpcid\": %d, \"args\": " "[\"%s\", %d, %d ], \"kwargs\": {} }"; char tbuf[MFP_MAX_MSGSIZE]; snprintf(tbuf, MFP_MAX_MSGSIZE-1, params, api_rpcid, patchfile, mfp_comm_nodeid, context->id); int request_id = mfp_rpc_request(method, tbuf, api_load_callback, (void *)context, msgbuf, msglen); return request_id; } int mfp_api_dsp_response(int proc_id, char * resp, int resp_type, char * msgbuf, int * msglen) { const char method[] = "call"; const char params[] = "{ \"func\": \"dsp_response\", \"rpcid\": %d, " "\"args\": [ %d, %d, %s ], \"kwargs\": {} }"; char outbuf[MFP_MAX_MSGSIZE]; snprintf(outbuf, MFP_MAX_MSGSIZE, params, api_rpcid, proc_id, resp_type, resp); int request_id = mfp_rpc_request(method, outbuf, NULL, NULL, msgbuf, msglen); return request_id; } /* FIXME make mfp_api_close_context nonblocking */ int mfp_api_close_context(mfp_context * context) { const char method[] = "call"; const char params[] = "{\"func\": \"close_context\", \"rpcid\": %d, " "\"args\": [ %d, %d ], \"kwargs\": {} }"; char tbuf[MFP_MAX_MSGSIZE]; char * msgbuf = mfp_comm_get_buffer(); int msglen=0; int request_id; snprintf(tbuf, MFP_MAX_MSGSIZE-1, params, api_rpcid, mfp_comm_nodeid, context->id); request_id = mfp_rpc_request(method, tbuf, NULL, NULL, msgbuf, &msglen); mfp_comm_submit_buffer(msgbuf, msglen); mfp_rpc_wait(request_id); /* handle any DSP config requests */ mfp_dsp_handle_requests(); } /* FIXME make mfp_api_exit_notify nonblocking */ int mfp_api_exit_notify(void) { const char method[] = "exit_notify"; const char params[] = "{}"; char * msgbuf = mfp_comm_get_buffer(); int msglen=0; int request_id = mfp_rpc_request(method, params, NULL, NULL, msgbuf, &msglen); mfp_comm_submit_buffer(msgbuf, msglen); //mfp_rpc_wait(request_id); }
#pragma once #include <initializer_list> #include <vector> #include <algorithm> #include <string> using std::string; namespace PlainTextToDatabase { // Represent a region on positional file. struct Region { // Construct simple region // where field name, start position and length are defined. Region (string name, size_t position, size_t length) : name(name), position(position), length(length) {} // Construct simple region // where field name and length are defined. Region (string name, size_t length) : name(name), position(0), length(length) {} // Construct simple region // where field name and delimiter are defined. Region (string name, string delimiter) : name(name), position(0), length(0), end_delimiter(delimiter) {} // Construct simple region // where field name and delimiter are defined. Region (string name, size_t position, string delimiter) : name(name), position(position), length(0), end_delimiter(delimiter) {} // Construct a root region. // This region haven't a name and by assumption starts at begin. Region (const std::initializer_list<Region> regions, string delimiter = "") : Region("", regions, delimiter) {} // Construct a root region. // This region haven't a name and by assumption starts at begin. Region (string name, const std::initializer_list<Region> regions, string delimiter = "") : Region(name, 0, regions, delimiter) {} // Construct a region defined by subregions. // This region have subregions that define his structure. Region (string name, unsigned position, const std::initializer_list<Region> regions, string delimiter) : name(name), position(position), regions(regions) { this->CalculateFixedLength(); this->CalculatePositions(); std::sort(this->regions.begin(), this->regions.end()); this->end_delimiter = delimiter; } static const size_t kUndefined = 0; void CalculatePositions() { if (this->regions.front().position == kUndefined) this->regions.front().position = 1; for (std::vector<Region>::iterator it = this->regions.begin() + 1; it != this->regions.end(); ++it) { if (it->position == kUndefined) it->position = (it - 1)->position + (it - 1)->length; } } void CalculateFixedLength() { if (this->length > kUndefined) return; for (Region& sub_region : this->regions) { sub_region.CalculateFixedLength(); if (sub_region.length == kUndefined) { this->length = kUndefined; break; } this->length += sub_region.length; } } string name; size_t position, length = 0; std::vector<Region> regions; string end_delimiter; bool operator<(Region region) const { return this->position < region.position; } }; } /* PlainTextToDatabase */
/* * cTabBox.h * Avida * * Copyright 1999-2011 Michigan State University. All rights reserved. * * * This file is part of Avida. * * Avida is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * * Avida 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 Avida. * If not, see <http://www.gnu.org/licenses/>. * */ #ifndef cTabBox_h #define cTabBox_h #include "cStringList.h" #include "cTextWindow.h" class cTabBox { private: cTextWindow * window; int y; int x; int rows; int cols; Apto::Array<cString> tabname_array; Apto::Array<char> optkey_array; int active_tab; // Find the position of the option character in a string. int FindOption(const cString & option) { const int found_pos = option.Find('['); if (found_pos == -1) return -1; return found_pos + 1; } public: cTabBox(cTextWindow * _window, int _y, int _x, int _rows, int _cols) : window(_window), y(_y), x(_x), rows(_rows), cols(_cols) , active_tab(0) { assert(rows > 4); // Need 4 rows to fit box and tabs; more for body! } ~cTabBox() { ; } int GetNumTabs() const { return tabname_array.GetSize(); } int GetActiveTab() const { return active_tab; } void AddTab(const cString & name) { // Save the name of the tab. tabname_array.Push(name); // Determine if we have a keypress associated with the tab. const int opt_pos = FindOption(name); char opt_char = 0; // Default key char to zero. if (opt_pos > 0) { // Determine the character and convert it to lowercase. opt_char = name[opt_pos]; if (opt_char >= 'A' && opt_char <= 'Z') opt_char = opt_char - 'A' + 'a'; } optkey_array.Push(opt_char); } void SetActiveTab(int tab_id) { assert(tab_id >= 0 && tab_id < tabname_array.GetSize()); active_tab = tab_id; } void NextTab() { ++active_tab %= tabname_array.GetSize(); } void PrevTab() { if (--active_tab < 0) active_tab = GetNumTabs()-1; } int DoKeypress(int keypress) { // Loop through all tabs to see if this keypress matches one of them. for (int tab_id = 0; tab_id < optkey_array.GetSize(); tab_id++) { if (keypress == optkey_array[tab_id]) { SetActiveTab(tab_id); return tab_id; } } return -1; } void Draw() { window->SetColor(COLOR_WHITE); // Draw the main box... for (int i = 2; i < rows-2; i++) { window->Move(y+i, 0); window->ClearToEOL(); } window->Box(y+2, x, rows-2, cols, true); // Draw tabs... int offset = 2; int active_offset = 0; for (int tab_id = 0; tab_id < tabname_array.GetSize(); tab_id++) { const cString & cur_name = tabname_array[tab_id]; const int tab_width = cur_name.GetSize() + 4; window->Box(y, x+offset, 3, tab_width, true); if (tab_id == active_tab) active_offset = offset; //(come back to this!) else { window->Print(y+1, x+offset+2, cur_name); window->SetColor(COLOR_YELLOW); const int opt_pos = FindOption(cur_name); window->Print(y+1, x+offset+2+opt_pos, cur_name[opt_pos]); window->SetColor(COLOR_WHITE); } window->Print(y+2, x+offset, CHAR_BTEE); offset += tab_width; window->Print(y+2, x+offset-1, CHAR_BTEE); } // Draw in the active window. const cString & active_name = tabname_array[active_tab]; const int active_width = active_name.GetSize() + 4; window->Box(y, x+active_offset, 3, active_width, true); window->SetBoldColor(COLOR_YELLOW); window->Print(y+1, x+active_offset+2, active_name); window->SetColor(COLOR_WHITE); window->Print(y+2, x+active_offset, CHAR_LRCORNER); window->Print(y+2, x+active_offset+active_width-1, CHAR_LLCORNER); for (int i = 1; i < active_width - 1; i++) { window->Print(y+2, x+active_offset+i, ' '); } window->Move(3, window->Width()-1); } }; #endif
// Copyright 2008 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include <string> #include "VideoBackends/OGL/GLInterfaceBase.h" class cInterfaceWGL : public cInterfaceBase { public: void SwapInterval(int Interval); void Swap(); void* GetFuncAddress(const std::string& name); bool Create(void *window_handle, bool core); bool MakeCurrent(); bool ClearCurrent(); void Shutdown(); void Update(); bool PeekMessages(); HWND m_window_handle; };
/* ----------------------------------------------------------------- "@(#) parser.h (Yale) version 4.5 9/7/90" FILE: parser.h DESCRIPTION:definitions for parsing. CONTENTS: DATE: Dec 8, 1989 REVISIONS: ----------------------------------------------------------------- */ #ifndef PARSER_H #define PARSER_H #ifdef PARSER_VARS #define EXTERN #else #define EXTERN extern #endif /* cell types */ #define STDCELLTYPE 1 #define EXCEPTTYPE 2 #define PADTYPE 3 #define PORTTYPE 4 #define EXTRATYPE 5 #define PADGROUPTYPE 6 #define HARDCELLTYPE 7 /* pin types */ #define PINTYPE 1 #define PASS_THRU 2 #define SWAP_PASS 3 EXTERN SWAPBOX *swap_group_listG ; EXTERN BOOL one_pin_feedthruG ; EXTERN INT maxCellOG ; EXTERN INT case_unequiv_pinG ; EXTERN INT celllenG ; EXTERN INT cells_per_clusterG ; EXTERN INT cluster_widthG ; EXTERN INT extra_cellsG ; EXTERN INT *fixLRBTG ; EXTERN INT last_pin_numberG ; EXTERN INT num_clustersG ; EXTERN BOOL swappable_gates_existG ; EXTERN INT swap_netG ; EXTERN INT totallenG ; EXTERN DOUBLE *padspaceG ; #undef EXTERN #endif /* PARSER_H */
/* * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. * You may freely copy it for use as a template for your own field types. * If you develop a field type that might be of general use, please send * it back to the ncurses maintainers for inclusion in the next version. */ /*************************************************************************** * * * Author : Juergen Pfeifer, juergen.pfeifer@gmx.net * * * ***************************************************************************/ #include "form.priv.h" MODULE_ID("$Id: fty_alpha.c,v 1.1.1.1 2004/03/24 19:53:06 sure Exp $") typedef struct { int width; } alphaARG; /*--------------------------------------------------------------------------- | Facility : libnform | Function : static void *Make_Alpha_Type(va_list *ap) | | Description : Allocate structure for alpha type argument. | | Return Values : Pointer to argument structure or NULL on error +--------------------------------------------------------------------------*/ static void *Make_Alpha_Type(va_list * ap) { alphaARG *argp = (alphaARG *)malloc(sizeof(alphaARG)); if (argp) { argp->width = va_arg(*ap,int); } return ((void *)argp); } /*--------------------------------------------------------------------------- | Facility : libnform | Function : static void *Copy_Alpha_Type(const void * argp) | | Description : Copy structure for alpha type argument. | | Return Values : Pointer to argument structure or NULL on error. +--------------------------------------------------------------------------*/ static void *Copy_Alpha_Type(const void * argp) { const alphaARG *ap = (const alphaARG *)argp; alphaARG *result = (alphaARG *)malloc(sizeof(alphaARG)); if (result) { *result = *ap; } return ((void *)result); } /*--------------------------------------------------------------------------- | Facility : libnform | Function : static void Free_Alpha_Type( void * argp ) | | Description : Free structure for alpha type argument. | | Return Values : - +--------------------------------------------------------------------------*/ static void Free_Alpha_Type(void * argp) { if (argp) free(argp); } /*--------------------------------------------------------------------------- | Facility : libnform | Function : static bool Check_Alpha_Field( | FIELD * field, | const void * argp) | | Description : Validate buffer content to be a valid alpha value | | Return Values : TRUE - field is valid | FALSE - field is invalid +--------------------------------------------------------------------------*/ static bool Check_Alpha_Field(FIELD * field, const void * argp) { int width = ((const alphaARG *)argp)->width; unsigned char *bp = (unsigned char *)field_buffer(field,0); int l = -1; unsigned char *s; while(*bp && *bp==' ') bp++; if (*bp) { s = bp; while(*bp && isalpha(*bp)) bp++; l = (int)(bp-s); while(*bp && *bp==' ') bp++; } return ((*bp || (l < width)) ? FALSE : TRUE); } /*--------------------------------------------------------------------------- | Facility : libnform | Function : static bool Check_Alpha_Character( | int c, | const void * argp) | | Description : Check a character for the alpha type. | | Return Values : TRUE - character is valid | FALSE - character is invalid +--------------------------------------------------------------------------*/ static bool Check_Alpha_Character(int c, const void * argp GCC_UNUSED) { return (isalpha(c) ? TRUE : FALSE); } static FIELDTYPE typeALPHA = { _HAS_ARGS | _RESIDENT, 1, /* this is mutable, so we can't be const */ (FIELDTYPE *)0, (FIELDTYPE *)0, Make_Alpha_Type, Copy_Alpha_Type, Free_Alpha_Type, Check_Alpha_Field, Check_Alpha_Character, NULL, NULL }; FIELDTYPE* TYPE_ALPHA = &typeALPHA; /* fty_alpha.c ends here */
// Emacs style mode select -*- C++ -*- //--------------------------------------------------------------------------- // // $Id$ // // Copyright(C) 1984-2000 David L. Clark // Copyright(C) 2001-2005 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. You should have // received a copy of the GNU General Public License along with this // program; if not, write to the Free Software Foundation, Inc., 59 Temple // Place - Suite 330, Boston, MA 02111-1307, USA. // //--------------------------------------------------------------------------- #ifndef __SWAUTO_H__ #define __SWAUTO_H__ #include "sw.h" extern void swauto(OBJECTS *ob); extern int gohome(OBJECTS *obpt); extern int aim(OBJECTS *obo, int ax, int ay, OBJECTS *obt, BOOL longway); extern int range(int x, int y, int ax, int ay); #endif //--------------------------------------------------------------------------- // // $Log$ // Revision 1.3 2005/04/29 19:25:28 fraggle // Update copyright to 2005 // // Revision 1.2 2003/04/05 22:44:04 fraggle // Remove some useless functions from headers, make them static if they // are not used by other files // // Revision 1.1.1.1 2003/02/14 19:03:29 fraggle // Initial Sourceforge CVS import // // // sdh 14/2/2003: change license header to GPL // sdh 21/10/2001: added cvs tags // sdh 19/10/2001: added header // //---------------------------------------------------------------------------
/* * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) * From ASN.1 module "CryptographicMessageSyntax2004" * found in "lpa2.asn1" * `asn1c -S/skeletons` */ #ifndef _AuthAttributes_H_ #define _AuthAttributes_H_ #include <asn_application.h> /* Including external dependencies */ #include <asn_SET_OF.h> #include <constr_SET_OF.h> #ifdef __cplusplus extern "C" { #endif /* Forward declarations */ struct CMSAttribute; /* AuthAttributes */ typedef struct AuthAttributes { A_SET_OF(struct CMSAttribute) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } AuthAttributes_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_AuthAttributes; #ifdef __cplusplus } #endif /* Referred external types */ #include "CMSAttribute.h" #endif /* _AuthAttributes_H_ */
/* picture.h - 2004/11/21 */ /* * EasyTAG - Tag editor for MP3 and Ogg Vorbis files * Copyright (C) 2000-2003 Jerome Couderc <easytag@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 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 __PICTURE_H__ #define __PICTURE_H__ #include "et_core.h" /*************** * Declaration * ***************/ /* Defined in et_core.h typedef struct _Picture Picture; struct _Picture { gint type; gchar *description; gint width; // Original width of the picture gint height; // Original height of the picture gulong size; // Picture size in bits guchar *data; Picture *next; };*/ typedef enum // Picture types { // Same values for FLAC, see: http://flac.sourceforge.net/api/group__flac__format.html#ga113 ET_PICTURE_TYPE_OTHER = 0, ET_PICTURE_TYPE_FILE_ICON, ET_PICTURE_TYPE_OTHER_FILE_ICON, ET_PICTURE_TYPE_FRONT_COVER, ET_PICTURE_TYPE_BACK_COVER, ET_PICTURE_TYPE_LEAFLET_PAGE, ET_PICTURE_TYPE_MEDIA, ET_PICTURE_TYPE_LEAD_ARTIST_LEAD_PERFORMER_SOLOIST, ET_PICTURE_TYPE_ARTIST_PERFORMER, ET_PICTURE_TYPE_CONDUCTOR, ET_PICTURE_TYPE_BAND_ORCHESTRA, ET_PICTURE_TYPE_COMPOSER, ET_PICTURE_TYPE_LYRICIST_TEXT_WRITER, ET_PICTURE_TYPE_RECORDING_LOCATION, ET_PICTURE_TYPE_DURING_RECORDING, ET_PICTURE_TYPE_DURING_PERFORMANCE, ET_PICTURE_TYPE_MOVIDE_VIDEO_SCREEN_CAPTURE, ET_PICTURE_TYPE_A_BRIGHT_COLOURED_FISH, ET_PICTURE_TYPE_ILLUSTRATION, ET_PICTURE_TYPE_BAND_ARTIST_LOGOTYPE, ET_PICTURE_TYPE_PUBLISHER_STUDIO_LOGOTYPE, ET_PICTURE_TYPE_UNDEFINED } EtPictureType; typedef enum { PICTURE_FORMAT_JPEG, PICTURE_FORMAT_PNG, PICTURE_FORMAT_UNKNOWN } Picture_Format; enum // Columns for PictureEntryView { PICTURE_COLUMN_PIC, // Column 0 PICTURE_COLUMN_TEXT, PICTURE_COLUMN_DATA, PICTURE_COLUMN_COUNT }; enum // Columns for list in properties window { PICTURE_TYPE_COLUMN_TEXT, // Column 0 PICTURE_TYPE_COLUMN_TYPE_CODE, PICTURE_TYPE_COLUMN_COUNT }; enum { TARGET_URI_LIST }; /************** * Prototypes * **************/ void Tag_Area_Picture_Drag_Data (GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *selection_data, guint info, guint t, gpointer data); void Picture_Selection_Changed_cb (GtkTreeSelection *selection, gpointer data); void Picture_Add_Button_Clicked (GObject *object); void Picture_Properties_Button_Clicked (GObject *object); void Picture_Save_Button_Clicked (GObject *object); void Picture_Clear_Button_Clicked (GObject *object); void PictureEntry_Clear (void); void PictureEntry_Update (Picture *pic, gboolean select_it); Picture *Picture_Allocate (void); Picture *Picture_Copy_One (const Picture *pic); Picture *Picture_Copy (const Picture *pic); void Picture_Free (Picture *pic); Picture_Format Picture_Format_From_Data (Picture *pic); const gchar *Picture_Mime_Type_String (Picture_Format format); gboolean Picture_Entry_View_Button_Pressed (GtkTreeView *treeview, GdkEventButton *event, gpointer data); gboolean Picture_Entry_View_Key_Pressed (GtkTreeView *treeview, GdkEvent *event, gpointer data); #endif /* __PICTURE_H__ */
// // PathUtil.h // Template // // Created by work on 9/3/14. // Copyright (c) 2014 Kai Zhang. All rights reserved. // #import <Foundation/Foundation.h> @interface PathUtil : NSObject /** * 获取documents路径 */ + (NSString *)documentsDirectory; /** * 获取caches路径 */ + (NSString *)cachesDirectory; @end
/* * Copyright (C) 2007 Google, Inc. * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved. * Author: Brian Swetland <swetland@google.com> * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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. * * * The MSM peripherals are spread all over across 768MB of physical * space, which makes just having a simple IO_ADDRESS macro to slide * them into the right virtual location rough. Instead, we will * provide a master phys->virt mapping for peripherals here. * */ #ifndef __ASM_ARCH_MSM_IOMAP_8960_H #define __ASM_ARCH_MSM_IOMAP_8960_H /* Physical base address and size of peripherals. * Ordered by the virtual base addresses they will be mapped at. * * If you add or remove entries here, you'll want to edit the * msm_io_desc array in arch/arm/mach-msm/io.c to reflect your * changes. * */ #define MSM8960_TMR_PHYS 0x0200A000 #define MSM8960_TMR_SIZE SZ_4K #define MSM8960_TMR0_PHYS 0x0208A000 #define MSM8960_TMR0_SIZE SZ_4K #define MSM8960_RPM_PHYS 0x00108000 #define MSM8960_RPM_SIZE SZ_4K #define MSM8960_RPM_MPM_PHYS 0x00200000 #define MSM8960_RPM_MPM_SIZE SZ_4K #define MSM8960_TCSR_PHYS 0x1A400000 #define MSM8960_TCSR_SIZE SZ_4K #define MSM8960_APCS_GCC_PHYS 0x02011000 #define MSM8960_APCS_GCC_SIZE SZ_4K #define MSM8960_SAW_L2_PHYS 0x02012000 #define MSM8960_SAW_L2_SIZE SZ_4K #define MSM8960_SAW0_PHYS 0x02089000 #define MSM8960_SAW0_SIZE SZ_4K #define MSM8960_SAW1_PHYS 0x02099000 #define MSM8960_SAW1_SIZE SZ_4K #define MSM8960_IMEM_PHYS 0x2A03F000 #define MSM8960_IMEM_SIZE SZ_4K #define MSM8960_ACC0_PHYS 0x02088000 #define MSM8960_ACC0_SIZE SZ_4K #define MSM8960_ACC1_PHYS 0x02098000 #define MSM8960_ACC1_SIZE SZ_4K #define MSM8960_QGIC_DIST_PHYS 0x02000000 #define MSM8960_QGIC_DIST_SIZE SZ_4K #define MSM8960_QGIC_CPU_PHYS 0x02002000 #define MSM8960_QGIC_CPU_SIZE SZ_4K #define MSM8960_CLK_CTL_PHYS 0x00900000 #define MSM8960_CLK_CTL_SIZE SZ_16K #define MSM8960_MMSS_CLK_CTL_PHYS 0x04000000 #define MSM8960_MMSS_CLK_CTL_SIZE SZ_4K #define MSM8960_LPASS_CLK_CTL_PHYS 0x28000000 #define MSM8960_LPASS_CLK_CTL_SIZE SZ_4K #define MSM8960_HFPLL_PHYS 0x00903000 #define MSM8960_HFPLL_SIZE SZ_4K #define MSM8960_TLMM_PHYS 0x00800000 #define MSM8960_TLMM_SIZE SZ_16K #define MSM8960_SIC_NON_SECURE_PHYS 0x12100000 #define MSM8960_SIC_NON_SECURE_SIZE SZ_64K #define MSM_GPT_BASE (MSM_TMR_BASE + 0x4) #define MSM_DGT_BASE (MSM_TMR_BASE + 0x24) #define MSM8960_HDMI_PHYS 0x04A00000 #define MSM8960_HDMI_SIZE SZ_4K #ifdef CONFIG_DEBUG_MSM8960_UART #define MSM_DEBUG_UART_BASE IOMEM(0xFA740000) #define MSM_DEBUG_UART_PHYS 0x16440000 #endif #define MSM8960_QFPROM_PHYS 0x00700000 #define MSM8960_QFPROM_SIZE SZ_4K #ifdef CONFIG_DEBUG_MSM8960_UART #define MSM_DEBUG_UART_BASE 0xE1040000 #define MSM_DEBUG_UART_PHYS 0x16440000 #endif #ifndef __ASSEMBLY__ extern void msm_map_msm8960_io(void); #endif #endif
// license:GPL-2.0+ // copyright-holders:Couriersud /* * nld_opamps.h * */ //#pragma once #ifndef NLD_OPAMPS_H_ #define NLD_OPAMPS_H_ #include "nl_base.h" #include "nl_setup.h" #include "nld_twoterm.h" #include "nld_fourterm.h" // ---------------------------------------------------------------------------------------- // Macros // ---------------------------------------------------------------------------------------- #define OPAMP(name, model) \ NET_REGISTER_DEV(OPAMP, name) \ NETDEV_PARAMI(name, MODEL, model) #define LM3900(name) \ SUBMODEL(opamp_lm3900, name) // ---------------------------------------------------------------------------------------- // Devices ... // ---------------------------------------------------------------------------------------- NETLIST_EXTERNAL(opamp_lm3900) namespace netlist { namespace devices { NETLIB_OBJECT(OPAMP) { NETLIB_CONSTRUCTOR(OPAMP) , m_RP(*this, "RP1") , m_G1(*this, "G1") , m_VCC(*this, "VCC") , m_GND(*this, "GND") , m_model(*this, "MODEL", "LM324") , m_VH(*this, "VH") , m_VL(*this, "VL") , m_VREF(*this, "VREF") { m_type = m_model.model_value("TYPE"); if (m_type == 1) { register_subalias("PLUS", "G1.IP"); register_subalias("MINUS", "G1.IN"); register_subalias("OUT", "G1.OP"); connect_late("G1.ON", "VREF"); connect_late("RP1.2", "VREF"); connect_late("RP1.1", "G1.OP"); } else if (m_type == 3) { register_sub("CP1", m_CP); register_sub("EBUF", m_EBUF); register_sub("DN", m_DN); register_sub("DP", m_DP); register_subalias("PLUS", "G1.IP"); register_subalias("MINUS", "G1.IN"); register_subalias("OUT", "EBUF.OP"); connect_late("EBUF.ON", "VREF"); connect_late("G1.ON", "VREF"); connect_late("RP1.2", "VREF"); connect_late("CP1.2", "VREF"); connect_late("EBUF.IN", "VREF"); connect_late("RP1.1", "G1.OP"); connect_late("CP1.1", "RP1.1"); connect_late("DP.K", "VH"); connect_late("VL", "DN.A"); connect_late("DP.A", "DN.K"); connect_late("DN.K", "RP1.1"); connect_late("EBUF.IP", "RP1.1"); } else netlist().log().fatal("Unknown opamp type: {1}", m_type); } NETLIB_UPDATEI(); NETLIB_RESETI(); NETLIB_UPDATE_PARAMI() { } private: NETLIB_SUB(R) m_RP; NETLIB_SUB(VCCS) m_G1; NETLIB_SUBXX(C) m_CP; NETLIB_SUBXX(VCVS) m_EBUF; NETLIB_SUBXX(D) m_DP; NETLIB_SUBXX(D) m_DN; analog_input_t m_VCC; analog_input_t m_GND; param_model_t m_model; analog_output_t m_VH; analog_output_t m_VL; analog_output_t m_VREF; /* state */ unsigned m_type; }; } //namespace devices } // namespace netlist #endif /* NLD_OPAMPS_H_ */
#ifndef LOGICCALCULATOR_H #define LOGICCALCULATOR_H #include <QDialog> #include <QRegExp> #include <QRegExpValidator> namespace Ui { class LogicCalculator; } class LogicCalculator : public QDialog { Q_OBJECT public: explicit LogicCalculator(QWidget *parent = 0); ~LogicCalculator(); void toggleBin(int); void toggleDec(int); void toggleHex(int); private slots: void on_inputLineEdit_1_textChanged(const QString &arg1); void on_inputLineEdit_2_textChanged(const QString &arg1); void on_radioButton_bin_1_toggled(bool checked); void on_radioButton_dec_1_toggled(bool checked); void on_radioButton_hex_1_toggled(bool checked); void on_radioButton_bin_2_toggled(bool checked); void on_radioButton_dec_2_toggled(bool checked); void on_radioButton_hex_2_toggled(bool checked); void on_radioButton_bin_3_toggled(bool checked); void on_radioButton_dec_3_toggled(bool checked); void on_radioButton_hex_3_toggled(bool checked); void on_button_not_1_clicked(); void on_button_not_2_clicked(); void on_button_neg_1_clicked(); void on_button_neg_2_clicked(); void on_button_sll_clicked(); void on_button_srl_clicked(); void on_button_and_clicked(); void on_button_or_clicked(); void on_button_xor_clicked(); private: Ui::LogicCalculator *ui; QRegExp decRegex, binRegex, hexRegex; QRegExpValidator *decRegexValidator, *binRegexValidator, *hexRegexValidator; }; #endif // LOGICCALCULATOR_H
/** * \file common_kerl.h * \brief Common definitions * \author Thomas Lorentsen, Sten Gruener * * This file contains common definitions and functions needed for kerl. * * Error numbers start from severl ranges depending on where * they were caused, this makes debugging easier as we can * tell if it is a player problem, ei problem or a kerl problem. * * Errors caused in kerl code start from -64 * Errors returned from the player server start from -128 * Errors returned from ei start from -192 */ /** * \def DBUG(x, args...) * Issue a debug message if debugging is enabled. */ #ifdef DEBUG #define DBUG(x, args...) fprintf(stderr, x, ##args) #else #define DBUG(x, args...) #endif /** * \def BENCH(x, args...) * Issue a benchmark message is benchmarking is enabled. */ #ifdef BENCHMARKING #define BENCH(x, args...) fprintf(stderr, x, ##args) #else #define BENCH(x, args...) #endif /** * \struct ClientQuery * Player client query */ typedef struct { /*! Robot identifier */ char *robotID; /*! Internal stage identifier */ int index; /*! Connection address */ char* address; /*! Connection port */ int port; /*! Devices to query */ int devices; } ClientQuery; /** * \def ECASE * Error case definition - on error return message. */ #define ECASE(error, message) case error : return message // Configuration /** * \def FNLENGTH * Maximum length of a funciton name in driver_kerl */ #define FNLENGTH 20 /** * \def IDLENGTH * Maximum length of the robot id */ #define IDLENGTH 50 /** * \def DOMAINLENGTH * Maximum length of the domainname of player */ #define DOMAINLENGTH 50 // Append error messages // general return values /** * \def SUCCESS * Success return value */ #define SUCCESS 0 /** * \def GENERICFAIL * Generic failure return value */ #define GENERICFAIL -1 /** * \def BROKENCODE * Broken code - see code for details */ #define BROKENCODE -2 // general player kerl errors start from -64 /** * \def NAMEINUSE * Error: Name in use */ #define NAMEINUSE -64 /** * \def NOSUCHCLIENT * Error: No such client */ #define NOSUCHCLIENT -65 /** * \def NOTSTORED * Error: Not stored */ #define NOTSTORED -66 /** * \def DEVICENOTINITIALISED * Error: Device not initialised */ #define DEVICENOTINITIALISED -67 /** * \def NOSUCHDEVICE * Error: No such device */ #define NOSUCHDEVICE -68 /** * \def ERRORQUERYINGDEVICES * Error: Error querying devices */ #define ERRORQUERYINGDEVICES -69 /** * \def INVALIDINDEX * Error: Invalid index specified */ #define INVALIDINDEX -70 // errors from player start from -128 /** * \def ERRORCONNECTING * Player error: Error connecting */ #define ERRORCONNECTING -128 /** * \def PLAYERFAIL * Player error: Player failure */ #define PLAYERFAIL -127 /** * \def NOSOCKET * Player error: No socket */ #define NOSOCKET -126 // errors from erlang interface start from -192 /** * \def UNDEFINEDFUNCTION * Erlang interface error: Undefined function */ #define UNDEFINEDFUNCTION -192 /** * \def UNDEFINEDOPTION * Erlang interface error: Undefined option */ #define UNDEFINEDOPTION -193 // This is a list of devices we can support /** * \def SUPPOSITION * Supported device: Position sensor */ #define SUPPOSITION 0x1 /** * \def SUPLASERS * Supported device: Laser range finder */ #define SUPLASERS 0x2 /** * \def SUPSONAR * Supported device: Sonar range finder */ #define SUPSONAR 0x4 /** * \def SUPFIDUCIAL * Supported device: Fiducial sensors */ #define SUPFIDUCIAL 0x8 //add to this list must be in power of twos //for example, gps might be 0x16 and then camera might be 0x32 //This allows device to be represented as a binary on or off /** * \fn errorToString(int) * \param errorno the error value passed * \return the string representation of the error * Converts a error defined in common_kerl.h * into a human readable form * All spaces must be replaced with underscores to be * passed as erlang atoms * If the error is not found it should return the number * as a string. * You can also pass SUCCESS to get a string representation * that will work in Erlang, just dont pass it back as * an error {error, ok} otherwise it will seem rather silly */ char* errorToString(int errorno);
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:40 2014 */ /* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/config/iwlwifi/rfkill.h */
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:34 2014 */ /* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/asm-generic/poll.h */ #ifndef __ASM_GENERIC_POLL_H #if defined(__cplusplus) && !CLICK_CXX_PROTECTED # error "missing #include <click/cxxprotect.h>" #endif #define __ASM_GENERIC_POLL_H /* These are specified by iBCS2 */ #define POLLIN 0x0001 #define POLLPRI 0x0002 #define POLLOUT 0x0004 #define POLLERR 0x0008 #define POLLHUP 0x0010 #define POLLNVAL 0x0020 /* The rest seem to be more-or-less nonstandard. Check them! */ #define POLLRDNORM 0x0040 #define POLLRDBAND 0x0080 #ifndef POLLWRNORM #define POLLWRNORM 0x0100 #endif #ifndef POLLWRBAND #define POLLWRBAND 0x0200 #endif #ifndef POLLMSG #define POLLMSG 0x0400 #endif #ifndef POLLREMOVE #define POLLREMOVE 0x1000 #endif #ifndef POLLRDHUP #define POLLRDHUP 0x2000 #endif struct pollfd { int fd; short events; short revents; }; #endif /* __ASM_GENERIC_POLL_H */
/*************************************************************************** * Copyright 2016 by Davide Bettio <davide@uninstall.it> * * * * 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 "eventloop.h" #include "unitmanager.h" #include "target.h" #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv, char **envp) { printf("\n\ninit 0.1 - Starting system...\n\n"); EventLoop *loop = event_loop_create_main_loop(); UnitManager *unitman = unitmanager_init(); if (!unitman) { fprintf(stderr, "init: failed to initialize unit manager.\n"); return EXIT_FAILURE; } unitmanager_loadunit(unitman, SYSTEM_TARGETS_PATH DEFAULT_BOOT_TARGET); unitmanager_start_all(unitmanager_build_dependencies_list(unitman)); return event_loop_run(loop); }
/* * OMAP2 clock function prototypes and macros * * Copyright (C) 2005-2010 Texas Instruments, Inc. * Copyright (C) 2004-2010 Nokia Corporation */ #ifndef __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H #define __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H unsigned long omap2_table_mpu_recalc(struct clk *clk); int omap2_select_table_rate(struct clk *clk, unsigned long rate); long omap2_round_to_table_rate(struct clk *clk, unsigned long rate); unsigned long omap2xxx_sys_clk_recalc(struct clk *clk); unsigned long omap2_osc_clk_recalc(struct clk *clk); unsigned long omap2_dpllcore_recalc(struct clk *clk); int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate); unsigned long omap2xxx_clk_get_core_rate(struct clk *clk); u32 omap2xxx_get_apll_clkin(void); u32 omap2xxx_get_sysclkdiv(void); void omap2xxx_clk_prepare_for_reboot(void); <<<<<<< HEAD #ifdef CONFIG_SOC_OMAP2420 int omap2420_clk_init(void); #else #define omap2420_clk_init() do { } while(0) #endif #ifdef CONFIG_SOC_OMAP2430 int omap2430_clk_init(void); #else #define omap2430_clk_init() do { } while(0) ======= #ifdef CONFIG_ARCH_OMAP2420 int omap2420_clk_init(void); #else #define omap2420_clk_init() 0 #endif #ifdef CONFIG_ARCH_OMAP2430 int omap2430_clk_init(void); #else #define omap2430_clk_init() 0 >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a #endif extern void __iomem *prcm_clksrc_ctrl, *cm_idlest_pll; extern struct clk *dclk; extern const struct clkops clkops_omap2430_i2chs_wait; extern const struct clkops clkops_oscck; extern const struct clkops clkops_apll96; extern const struct clkops clkops_apll54; #endif
/* * Copyright 2000-2015 Rochus Keller <mailto:rkeller@nmr.ch> * * This file is part of the CARA (Computer Aided Resonance Assignment, * see <http://cara.nmr.ch/>) NMR Application Framework (NAF) library. * * The following is the license that applies to this copy of the * library. For a license to use the library under conditions * other than those described here, please email to rkeller@nmr.ch. * * GNU General Public License Usage * This file may be used under the terms of the GNU General Public * License (GPL) versions 2.0 or 3.0 as published by the Free Software * Foundation and appearing in the file LICENSE.GPL included in * the packaging of this file. Please review the following information * to ensure GNU General Public Licensing requirements will be met: * http://www.fsf.org/licensing/licenses/info/GPLv2.html and * http://www.gnu.org/copyleft/gpl.html. */ #if !defined(_QTL_DATE) #define _QTL_DATE //#include <Root/Units.h> typedef struct lua_State lua_State; namespace Qtl { class Date { public: // Static Members static int currentDate(lua_State * L); // () : QDate static int fromJulianDay(lua_State * L); // ( int ) : QDate // static int fromString(lua_State * L); // ( const QString &, Qt::DateFormat ) : QDate static int fromString(lua_State * L); // ( const QString &, const QString & ) : QDate // static int isValid(lua_State * L); // ( int, int, int ) : bool static int isLeapYear(lua_State * L); // ( int ) : bool static int longDayName(lua_State * L); // ( int ) : QString static int longMonthName(lua_State * L); // ( int ) : QString static int shortDayName(lua_State * L); // ( int ) : QString static int shortMonthName(lua_State * L); // ( int ) : QString // Instance Members static int addDays(lua_State * L); // ( int ) const : QDate static int addMonths(lua_State * L); // ( int ) const : QDate static int addYears(lua_State * L); // ( int ) const : QDate static int day(lua_State * L); // () const : int static int dayOfWeek(lua_State * L); // () const : int static int dayOfYear(lua_State * L); // () const : int static int daysInMonth(lua_State * L); // () const : int static int daysInYear(lua_State * L); // () const : int static int daysTo(lua_State * L); // ( const QDate & ) const : int static int isNull(lua_State * L); // () const : bool static int isValid(lua_State * L); // () const : bool static int month(lua_State * L); // () const : int static int setYMD(lua_State * L); // ( int, int, int ) : bool static int toJulianDay(lua_State * L); // () const : int // static int toString(lua_State * L); // ( const QString & ) const : QString static int toString(lua_State * L); // ( Qt::DateFormat ) const : QString static int weekNumber(lua_State * L); // ( int * ) const : int static int year(lua_State * L); // () const : int static int init(lua_State * L); static int __eq(lua_State * L); static int __lt(lua_State * L); static void install(lua_State * L); }; } #endif // !defined(_QTL_DATE)
// _________ __ __ // / _____// |_____________ _/ |______ ____ __ __ ______ // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ | // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > // \/ \/ \//_____/ \/ // ______________________ ______________________ // T H E W A R B E G I N S // Stratagus - A free fantasy real time strategy game engine // // (c) Copyright 2019-2020 by Andrettin // // 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 namespace wyrmgus::container { template <typename T, typename U> inline bool intersects_with(const T &container, const U &other_container) { for (const typename T::value_type &element : container) { for (const typename U::value_type &other_element : other_container) { if (element == other_element) { return true; } } } return false; } template <typename T> inline QVariantList to_qvariant_list(const T &container) { QVariantList list; for (const typename T::value_type &element : container) { if constexpr (std::is_same_v<typename T::value_type, std::filesystem::path>) { list.append(QVariant::fromValue(QString::fromStdString(element.string()))); } else if constexpr (std::is_same_v<typename T::value_type, std::string>) { list.append(QVariant::fromValue(QString::fromStdString(element))); } else { list.append(QVariant::fromValue(element)); } } return list; } template <typename T> QStringList to_qstring_list(const T &string_container) { static_assert(std::is_same_v<typename T::value_type, std::string>); QStringList qstring_list; for (const std::string &str : string_container) { qstring_list.push_back(QString::fromStdString(str)); } return qstring_list; } template <typename T> inline std::set<typename T::value_type> to_set(const T &container) { std::set<typename T::value_type> set; for (const typename T::value_type &element : container) { set.insert(element); } return set; } template <typename T> inline std::queue<typename T::value_type> to_queue(const T &container) { std::queue<typename T::value_type> queue; for (const typename T::value_type &element : container) { queue.push(element); } return queue; } template <typename T> inline std::vector<typename T::value_type> to_vector(const T &container) { std::vector<typename T::value_type> vector; vector.reserve(container.size()); for (const typename T::value_type &element : container) { vector.push_back(element); } return vector; } }
/* KNode, the KDE newsreader Copyright (c) 1999-2005 the KNode authors. See file AUTHORS for details This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US */ #ifndef KNFILTERCONFIGWIDGET_H #define KNFILTERCONFIGWIDGET_H #include <QTabWidget> namespace KNode { class RangeFilterWidget; class SearchDialog; class StatusFilterWidget; class StringFilterWidget; } /** Filter configuration widget. */ class KNFilterConfigWidget : public QTabWidget { Q_OBJECT friend class KNFilterDialog; friend class KNode::SearchDialog; public: explicit KNFilterConfigWidget( QWidget *parent = 0 ); ~KNFilterConfigWidget(); void reset(); /// useablity hack for the search dialog void setStartFocus(); protected: KNode::StatusFilterWidget *status; KNode::StringFilterWidget *subject; KNode::StringFilterWidget *from; KNode::StringFilterWidget *messageId; KNode::StringFilterWidget *references; KNode::RangeFilterWidget *age; KNode::RangeFilterWidget *lines; KNode::RangeFilterWidget *score; }; #endif
#ifndef _TitleScene_ #define _TitleScene_ #include "cocos2d.h" class TitleScene : public cocos2d::CCScene { public: TitleScene(); ~TitleScene(); virtual bool init(); CREATE_FUNC(TitleScene); protected: private: }; #endif
/* Copyright 2003 Kjetil S. Matheussen 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. */ extern LANGSPEC void posix_EndPlayer(void); extern LANGSPEC bool posix_InitPlayer(void);
#include <stdio.h> #include <stdlib.h> #include <time.h> #include "simMat2.h" #define MTROW 4 #define MTCOL 4 void setDat(double *dat,int num,double max,double min); double randomVal(double max,double min); void setRandomDat(mat2 *obj,int numLoop,int numEle,double max,double min); int main(int argc,char **argv) { srand(time(NULL)); struct mat2Ele *m2El =NULL; double *dV=NULL; double *dV2=NULL; int index=0; int index2=0; void **arrMt =NULL; mat2 *oM1 =NULL; mat2 *oM2 =NULL; oM1 = newMt2(MTROW,MTCOL,sizeof(double),2); printf("size mt : %u %d \n",calSizeMt2(oM1),sizeof(*oM1)); arrMt = getDatMt2(oM1); setRandomDat(oM1,MTROW,MTCOL,503.9,-7.45); printf("---- ok\n"); if(arrMt !=NULL) { oM2 = oM1; for(index2=0;index2<MTROW;index2++) { m2El = (struct mat2Ele*)getDatNextMt2(oM2); if(m2El !=NULL) { dV2 = (double*)(m2El->m_startP); printf("&m2El:%p, &mPoin:%p Val(%p), &len:%p val(%u) &Str:%p ",m2El,&(m2El->m_pointRef),m2El->m_pointRef,&(m2El->m_length),m2El->m_length,m2El->m_startP); for(index=0;index<MTCOL;index++) { printf("%f ",dV2[index]); } printf("\n"); } else { /* do nothing */ } } printf("random --- \n"); swapRandomMt2(oM2); arrMt = getDatMt2(oM2); for(index2=0;index2<MTROW;index2++) { m2El = (struct mat2Ele*)arrMt[index2]; dV2 = (double*)(m2El->m_startP); printf("&m2El:%p, &mPoin:%p Val(%p), &len:%p val(%u) &Str:%p ",m2El,&(m2El->m_pointRef),m2El->m_pointRef,&(m2El->m_length),m2El->m_length,&(m2El->m_startP)); for(index=0;index<MTCOL;index++) { printf("%f ",dV2[index]); } printf("\n"); } printf("End of random --- \n"); } rmEleMt2(oM2,arrMt[1]); setRandomDat(oM1,1,MTCOL,503.9,-7.45); printMt24Double(oM2); clearMt2(&oM2); return 0; } double randomVal(double max,double min) { return min + rand()%(int)(max-min); } void setDat(double *dat,int num,double max,double min) { int index=0; for(index=0;index<num;index++) { dat[index] = randomVal(max,min); printf("%f ",dat[index]); } } void setRandomDat(mat2 *obj,int numLoop,int numEle,double max,double min) { int index=0; int index2=0; double *dV=NULL; struct mat2Ele *m2El =NULL; void **arrMt =NULL; if(obj !=NULL) { arrMt = getDatMt2(obj); m2El = (struct mat2Ele*)arrMt[0]; printf("arrMt:%p m2El:%p\n",arrMt,m2El); for(index2=0;index2<numLoop;index2++) { m2El = (struct mat2Ele*)getDatNextMt2(obj); if(m2El!=NULL) { dV = (double*)(m2El->m_startP); printf("&m2El:%p, &mPoin:%p Val(%p), &len:%p val(%u) &Str:%p ",m2El,&(m2El->m_pointRef),m2El->m_pointRef,&(m2El->m_length),m2El->m_length,m2El->m_startP); setDat(dV,numEle,max,min); printf("\n"); } else { /* do nothing */ } } } else { /* do nothing */ } }
/* catmuzzle - A cat muzzle detector Copyright (C) 2015 Bob Mottram <bob@robotics.uk.to> 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 MUZZLE_H #define MUZZLE_H #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <ctype.h> #include <math.h> #include <assert.h> #include <time.h> #include <omp.h> void muzzle_profile(unsigned char * img, int image_width, int image_height, int bytesperpixel, int samples, float profile[]); void muzzle_csv(unsigned char * img, int image_width, int image_height, int bytesperpixel, int positive); #endif
/* Copyright (C) 2003-2010 Jesper K. Pedersen <blackie@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef IMAGEDATE_H #define IMAGEDATE_H #include <qstring.h> #include <qdatetime.h> #include <qstringlist.h> namespace DB { class ImageDate { public: ImageDate(); ImageDate( const QDateTime& start, const QDateTime& end ); ImageDate( int yearFrom, int monthFrom, int dayFrom, int yearTo, int monthTo, int dayTo, int hourFrom, int minuteFrom, int secondFrom ); explicit ImageDate( const QDate& ); explicit ImageDate( const QDateTime& ); ImageDate( const QDate& start, QDate end, const QTime& time ); QDateTime start() const; QDateTime end() const; static QDate parseDate( const QString& date, bool startDate ); bool operator<( const ImageDate& other ) const; bool operator<=( const ImageDate& other ) const; bool operator==( const ImageDate& other ) const; bool operator!=( const ImageDate& other ) const; bool isValid() const { return !isNull(); } bool isNull() const; QString toString( bool withTime = true ) const; bool hasValidTime() const; enum MatchType { DontMatch, ExactMatch, RangeMatch }; MatchType isIncludedIn( const ImageDate& searchRange ) const; bool includes( const QDateTime& date ) const; protected: static QStringList monthNames(); static QString formatRegexp(); private: QDateTime _start, _end; }; } #endif /* IMAGEDATE_H */ // vi:expandtab:tabstop=4 shiftwidth=4:
/* * ProFTPD - FTP server API testsuite * Copyright (c) 2008-2015 The ProFTPD Project team * * 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, Suite 500, Boston, MA 02110-1335, USA. * * As a special exemption, The ProFTPD Project team and other respective * copyright holders give permission to link this program with OpenSSL, and * distribute the resulting executable, without including the source code for * OpenSSL in the source distribution. */ #include "tests.h" struct testsuite_info { const char *name; Suite *(*get_suite)(void); }; static struct testsuite_info suites[] = { { "pool", tests_get_pool_suite }, { "array", tests_get_array_suite }, { "str", tests_get_str_suite }, { "sets", tests_get_sets_suite }, { "timers", tests_get_timers_suite }, { "table", tests_get_table_suite }, { "var", tests_get_var_suite }, { "event", tests_get_event_suite }, { "env", tests_get_env_suite }, { "version", tests_get_version_suite }, { "feat", tests_get_feat_suite }, { "netaddr", tests_get_netaddr_suite }, { "netacl", tests_get_netacl_suite }, { "class", tests_get_class_suite }, { "regexp", tests_get_regexp_suite }, { "expr", tests_get_expr_suite }, { "scoreboard", tests_get_scoreboard_suite }, { "stash", tests_get_stash_suite }, { "modules", tests_get_modules_suite }, { "cmd", tests_get_cmd_suite }, { "response", tests_get_response_suite }, { "fsio", tests_get_fsio_suite }, { "netio", tests_get_netio_suite }, { "trace", tests_get_trace_suite }, { "parser", tests_get_parser_suite }, { "pidfile", tests_get_pidfile_suite }, { "config", tests_get_config_suite }, { "auth", tests_get_auth_suite }, { "filter", tests_get_filter_suite }, { "inet", tests_get_inet_suite }, { "data", tests_get_data_suite }, { "ascii", tests_get_ascii_suite }, { "help", tests_get_help_suite }, { "rlimit", tests_get_rlimit_suite }, { "encode", tests_get_encode_suite }, { "privs", tests_get_privs_suite }, { "display", tests_get_display_suite }, { "misc", tests_get_misc_suite }, { NULL, NULL } }; static Suite *tests_get_suite(const char *suite) { register unsigned int i; for (i = 0; suites[i].name != NULL; i++) { if (strcmp(suite, suites[i].name) == 0) { return (*suites[i].get_suite)(); } } return NULL; } int main(int argc, char *argv[]) { const char *log_file = "api-tests.log"; int nfailed = 0; SRunner *runner = NULL; char *requested = NULL; runner = srunner_create(NULL); /* XXX This log name should be set outside this code, e.g. via environment * variable or command-line option. */ srunner_set_log(runner, log_file); requested = getenv("PR_TEST_SUITE"); if (requested) { Suite *suite; suite = tests_get_suite(requested); if (suite) { srunner_add_suite(runner, suite); } else { fprintf(stderr, "No such test suite ('%s') requested via PR_TEST_SUITE\n", requested); return EXIT_FAILURE; } } else { register unsigned int i; for (i = 0; suites[i].name; i++) { Suite *suite; suite = (suites[i].get_suite)(); if (suite) { srunner_add_suite(runner, suite); } } } /* Configure the Trace API to write to stderr. */ pr_trace_use_stderr(TRUE); requested = getenv("PR_TEST_NOFORK"); if (requested) { srunner_set_fork_status(runner, CK_NOFORK); } else { requested = getenv("CK_DEFAULT_TIMEOUT"); if (requested == NULL) { setenv("CK_DEFAULT_TIMEOUT", "60", 1); } } srunner_run_all(runner, CK_NORMAL); nfailed = srunner_ntests_failed(runner); if (runner) srunner_free(runner); if (nfailed != 0) { fprintf(stderr, "-------------------------------------------------\n"); fprintf(stderr, " FAILED %d %s\n\n", nfailed, nfailed != 1 ? "tests" : "test"); fprintf(stderr, " Please send email to:\n\n"); fprintf(stderr, " proftp-devel@lists.sourceforge.net\n\n"); fprintf(stderr, " containing the `%s' file (in the tests/ directory)\n", log_file); fprintf(stderr, " and the output from running `proftpd -V'\n"); fprintf(stderr, "-------------------------------------------------\n"); return EXIT_FAILURE; } return EXIT_SUCCESS; }
/* * Copyright (c) 2008, 2010 Lukáš Tvrdý <lukast.dev@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 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 _DEFORM_BRUSH_H_ #define _DEFORM_BRUSH_H_ #include <kis_paint_device.h> #include <kis_paint_information.h> #include <kis_brush_size_option.h> #include <time.h> #if defined(_WIN32) || defined(_WIN64) #define srand48 srand inline double drand48() { return double(rand()) / RAND_MAX; } #endif enum DeformModes {GROW, SHRINK, SWIRL_CW, SWIRL_CCW, MOVE, LENS_IN, LENS_OUT, DEFORM_COLOR}; class DeformProperties { public: int action; qreal deformAmount; bool useBilinear; bool useCounter; bool useOldData; }; class DeformBase{ public: DeformBase(){} virtual ~DeformBase(){} virtual void transform(qreal * x, qreal * y, qreal distance){ Q_UNUSED(x); Q_UNUSED(y); Q_UNUSED(distance); } }; /// Inverse weighted inverse scaling - grow&shrink class DeformScale : public DeformBase { public: void setFactor(qreal factor){ m_factor = factor; } qreal factor(){ return m_factor; } virtual void transform(qreal* x, qreal* y, qreal distance){ qreal scaleFactor = (1.0 - distance) * m_factor + distance; *x = *x / scaleFactor; *y = *y / scaleFactor; } private: qreal m_factor; }; /// Inverse weighted rotation - swirlCW&&swirlCWW class DeformRotation : public DeformBase { public: void setAlpha(qreal alpha){ m_alpha = alpha; } virtual void transform(qreal* maskX, qreal* maskY, qreal distance){ distance = 1.0 - distance; qreal rotX = cos(-m_alpha * distance) * (*maskX) - sin(-m_alpha * distance) * (*maskY); qreal rotY = sin(-m_alpha * distance) * (*maskX) + cos(-m_alpha * distance) * (*maskY); *maskX = rotX; *maskY = rotY; } private: qreal m_alpha; }; /// Inverse move class DeformMove : public DeformBase { public: void setFactor(qreal factor){ m_factor = factor; } void setDistance(qreal dx, qreal dy){ m_dx = dx; m_dy = dy; } virtual void transform(qreal* maskX, qreal* maskY, qreal distance){ *maskX -= m_dx * m_factor * (1.0 - distance); *maskY -= m_dy * m_factor * (1.0 - distance); } private: qreal m_dx; qreal m_dy; qreal m_factor; }; /// Inverse lens distortion class DeformLens : public DeformBase { public: void setLensFactor(qreal k1, qreal k2){ m_k1 = k1; m_k2 = k2; } void setMaxDistance(qreal maxX, qreal maxY){ m_maxX = maxX; m_maxY = maxY;} void setMode(bool out){ m_out = out; } virtual void transform(qreal* maskX, qreal* maskY, qreal distance){ Q_UNUSED(distance); //normalize qreal normX = *maskX / m_maxX; qreal normY = *maskY / m_maxY; qreal radius_2 = normX * normX + normY * normY; qreal radius_4 = radius_2 * radius_2; if (m_out) { *maskX = normX * (1.0 + m_k1 * radius_2 + m_k2 * radius_4); *maskY = normY * (1.0 + m_k1 * radius_2 + m_k2 * radius_4); } else { *maskX = normX / (1.0 + m_k1 * radius_2 + m_k2 * radius_4); *maskY = normY / (1.0 + m_k1 * radius_2 + m_k2 * radius_4); } *maskX = m_maxX * (*maskX); *maskY = m_maxY * (*maskY); } private: qreal m_k1,m_k2; qreal m_maxX, m_maxY; bool m_out; }; /// Randomly disturb the pixels class DeformColor : public DeformBase { public: DeformColor(){ srand48(time(0)); } void setFactor(qreal factor){ m_factor = factor; } virtual void transform(qreal* x, qreal* y, qreal distance){ Q_UNUSED(distance); qreal randomX = m_factor * ((drand48() * 2.0) - 1.0); qreal randomY = m_factor * ((drand48() * 2.0) - 1.0); *x += randomX; *y += randomY; } private: qreal m_factor; }; class DeformBrush { public: DeformBrush(); ~DeformBrush(); KisFixedPaintDeviceSP paintMask(KisFixedPaintDeviceSP dab, KisPaintDeviceSP layer, qreal scale,qreal rotation,QPointF pos, qreal subPixelX,qreal subPixelY, int dabX, int dabY); void setSizeProperties(KisBrushSizeProperties * properties){ m_sizeProperties = properties; } void setProperties(DeformProperties * properties){ m_properties = properties; } void initDeformAction(); QPointF hotSpot(qreal scale, qreal rotation); private: // return true if can paint bool setupAction(DeformModes mode,const QPointF &pos); void debugColor(const quint8* data, KoColorSpace * cs); qreal maskWidth(qreal scale){ return m_sizeProperties->diameter * scale; } qreal maskHeight(qreal scale){ return m_sizeProperties->diameter * m_sizeProperties->aspect * scale; } inline qreal norme(qreal x,qreal y){ return x*x + y*y; } private: KisRandomSubAccessorSP m_srcAcc; bool m_firstPaint; qreal m_prevX, m_prevY; int m_counter; qreal m_centerX; qreal m_centerY; qreal m_majorAxis; qreal m_minorAxis; qreal m_inverseScale; qreal m_maskRadius; QRectF m_maskRect; DeformBase * m_deformAction; DeformProperties * m_properties; KisBrushSizeProperties * m_sizeProperties; }; #endif
/** @file hci_wrapper.h * @brief This file contains HCI related definitions * * Copyright (C) 2011-2015, Marvell International Ltd. * * This software file (the "File") is distributed by Marvell International * Ltd. under the terms of the GNU General Public License Version 2, June 1991 * (the "License"). You may use, redistribute and/or modify this File in * accordance with the terms and conditions of the License, a copy of which * is available along with the File in the gpl.txt file or by writing to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 or on the worldwide web at http://www.gnu.org/licenses/gpl.txt. * * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE * ARE EXPRESSLY DISCLAIMED. The License provides additional details about * this warranty disclaimer. * */ #ifndef _HCI_WRAPPER_H_ #define _HCI_WRAPPER_H_ #include <linux/module.h> #include <net/bluetooth/bluetooth.h> #include <net/bluetooth/hci_core.h> /** Define Seq num */ #define BT_SEQ 0 #define FM_SEQ 1 #define NFC_SEQ 2 /** Define dev type */ #define BT_TYPE 1 #define BT_AMP_TYPE 2 #define FM_TYPE 3 #define NFC_TYPE 4 /** Define spec type */ #define BLUEZ_SPEC 1 #define IANYWHERE_SPEC 2 #define GENERIC_SPEC 3 /** Define lock/unlock wrapper */ #define mdev_req_lock(d) down(&d->req_lock) #define mdev_req_unlock(d) up(&d->req_lock) /** Length of device name */ #define DEV_NAME_LEN 32 /** Define struct m_dev */ struct m_dev { char name[DEV_NAME_LEN]; int index; unsigned long flags; spinlock_t lock; struct semaphore req_lock; struct sk_buff_head rx_q; wait_queue_head_t req_wait_q; struct hci_dev_stats stat; struct module *owner; void *dev_pointer; int dev_type; int spec_type; void *driver_data; int read_continue_flag; int wait_rx_complete; int rx_complete_flag; wait_queue_head_t rx_wait_q; int (*open) (struct m_dev * m_dev); int (*close) (struct m_dev * m_dev); int (*flush) (struct m_dev * m_dev); int (*send) (struct m_dev * m_dev, struct sk_buff * skb); void (*destruct) (struct m_dev * m_dev); void (*notify) (struct m_dev * m_dev, unsigned int evt); int (*ioctl) (struct m_dev * m_dev, unsigned int cmd, void *arg); void (*query) (struct m_dev * m_dev, void *arg); }; /** Define struct mbt_dev */ struct mbt_dev { /** maybe could add some private member later */ char name[DEV_NAME_LEN]; unsigned long flags; __u8 type; __u16 pkt_type; __u16 esco_type; __u16 link_policy; __u16 link_mode; __u32 idle_timeout; __u16 sniff_min_interval; __u16 sniff_max_interval; struct sk_buff *reassembly[3]; atomic_t promisc; }; /** Define 'fm' interface specific struct fm_dev */ struct fm_dev { /** maybe could add some private member later */ char name[DEV_NAME_LEN]; unsigned long flags; }; /** Define 'nfc' interface specific struct fm_dev */ struct nfc_dev { /** maybe could add some private member later */ char name[DEV_NAME_LEN]; unsigned long flags; }; /** This function frees m_dev allocation */ void free_m_dev(struct m_dev *m_dev); /** * @brief This function receives frames * * @param skb A pointer to struct sk_buff * @return 0--success otherwise error code */ static inline int mdev_recv_frame(struct sk_buff *skb) { struct m_dev *m_dev = (struct m_dev *)skb->dev; if (!m_dev || (!test_bit(HCI_UP, &m_dev->flags) && !test_bit(HCI_INIT, &m_dev->flags))) { kfree_skb(skb); return -ENXIO; } /* Incomming skb */ bt_cb(skb)->incoming = 1; /* Time stamp */ __net_timestamp(skb); /* Queue frame for rx task */ skb_queue_tail(&m_dev->rx_q, skb); /* Wakeup rx thread */ wake_up_interruptible(&m_dev->req_wait_q); return 0; } /** * @brief mbt dev suspend handler * * @param m_dev A pointer to struct m_dev * @return 0 */ static inline int mbt_hci_suspend_dev(struct m_dev *m_dev) { return 0; } /** * @brief mbt dev resume handler * * @param m_dev A pointer to struct m_dev * @return 0 */ static inline int mbt_hci_resume_dev(struct m_dev *m_dev) { return 0; } #endif /* _HCI_WRAPPER_H_ */
#define NUM_OF_DOTS 32768 #define _eps 1.0e-6 #define qFabs(x) fabs(x) #define qExp(x) exp(x) #define MDE_SCALE_EXTERN 0 #define MDE_AUTO_SCALE 1 #define MDE_AUTO_ONLY_EXPANDING 2 typedef struct _Range { double MaxY; double MinY; double MaxX; double MinX; }XYRange; typedef struct _Curve { double *XValues; double *YValues; int PointsDrawn; int Points; int Size; XYRange Range; }XYCurve;
// // Copyright (c) 2008 by CodeSourcery // Copyright (c) 2013 Stefan Seefeld // All rights reserved. // // This file is made available under the GPL. // See the accompanying file LICENSE.GPL for details. #ifndef output_h_ #define output_h_ void voutput_f(vsip_vview_f const *v) { size_t i; for (i = 0; i != vsip_vgetlength_f(v); ++i) printf("%f ", vsip_vget_f(v, i)); } void voutput_d(vsip_vview_d const *v) { size_t i; for (i = 0; i != vsip_vgetlength_d(v); ++i) printf("%f ", vsip_vget_d(v, i)); } void cvoutput_f(vsip_cvview_f const *v) { size_t i; for (i = 0; i != vsip_cvgetlength_f(v); ++i) { vsip_cscalar_f value = vsip_cvget_f(v, i); printf("(%f %f) ", value.r, value.i); } } void cvoutput_d(vsip_cvview_d const *v) { size_t i; for (i = 0; i != vsip_cvgetlength_d(v); ++i) { vsip_cscalar_d value = vsip_cvget_d(v, i); printf("(%f %f) ", value.r, value.i); } } void moutput_f(vsip_mview_f const *m) { size_t i, j; for (i = 0; i != vsip_mgetcollength_f(m); ++i) { for (j = 0; j != vsip_mgetrowlength_f(m); ++j) printf("%f ", vsip_mget_f(m, i, j)); printf("\n"); } } void moutput_d(vsip_mview_d const *m) { size_t i, j; for (i = 0; i != vsip_mgetcollength_d(m); ++i) { for (j = 0; j != vsip_mgetrowlength_d(m); ++j) printf("%f ", vsip_mget_d(m, i, j)); printf("\n"); } } void cmoutput_f(vsip_cmview_f const *m) { size_t i, j; for (i = 0; i != vsip_cmgetcollength_f(m); ++i) { for (j = 0; j != vsip_cmgetrowlength_f(m); ++j) { vsip_cscalar_f tmp = vsip_cmget_f(m, i, j); printf("(%f %f) ", tmp.r, tmp.i); } printf("\n"); } } void cmoutput_d(vsip_cmview_d const *m) { size_t i, j; for (i = 0; i != vsip_cmgetcollength_d(m); ++i) { for (j = 0; j != vsip_cmgetrowlength_d(m); ++j) { vsip_cscalar_d tmp = vsip_cmget_d(m, i, j); printf("(%f %f) ", tmp.r, tmp.i); } printf("\n"); } } void toutput_f(vsip_tview_f const *t) { size_t h, i, j; for (h = 0; h != vsip_tgetzlength_f(t); ++h) { printf("plane %d :\n", (int)h); for (i = 0; i != vsip_tgetylength_f(t); ++i) { for (j = 0; j != vsip_tgetxlength_f(t); ++j) printf("%f ", vsip_tget_f(t, h, i, j)); printf("\n"); } } } void toutput_d(vsip_tview_d const *t) { size_t h, i, j; for (h = 0; h != vsip_tgetzlength_d(t); ++h) { printf("plane %d :\n", (int)h); for (i = 0; i != vsip_tgetylength_d(t); ++i) { for (j = 0; j != vsip_tgetxlength_d(t); ++j) printf("%f ", vsip_tget_d(t, h, i, j)); printf("\n"); } } } void ctoutput_f(vsip_ctview_f const *t) { size_t h, i, j; for (h = 0; h != vsip_ctgetzlength_f(t); ++h) { printf("plane %d :\n", (int)h); for (i = 0; i != vsip_ctgetylength_f(t); ++i) { for (j = 0; j != vsip_ctgetxlength_f(t); ++j) { vsip_cscalar_f tmp = vsip_ctget_f(t, h, i, j); printf("(%f %f) ", tmp.r, tmp.i); } printf("\n"); } } } void ctoutput_d(vsip_ctview_d const *t) { size_t h, i, j; for (h = 0; h != vsip_ctgetzlength_d(t); ++h) { printf("plane %d :\n", (int)h); for (i = 0; i != vsip_ctgetylength_d(t); ++i) { for (j = 0; j != vsip_ctgetxlength_d(t); ++j) { vsip_cscalar_d tmp = vsip_ctget_d(t, h, i, j); printf("(%f %f) ", tmp.r, tmp.i); } printf("\n"); } } } #endif
/* * Definitions etc. for regexp(3) routines. * * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], * not the System V one. * * RCS: @(#) $Id: tcl_regexp.h,v 1.1 2003/02/23 06:37:45 jasonwilkins Exp $ */ #ifndef _TCL_REGEXP #define _TCL_REGEXP 1 /* * NSUBEXP must be at least 10, and no greater than 117 or the parser * will not work properly. */ #define NSUBEXP 20 typedef struct Expect_regexp { char *startp[NSUBEXP]; char *endp[NSUBEXP]; char regstart; /* Internal use only. */ char reganch; /* Internal use only. */ char *regmust; /* Internal use only. */ int regmlen; /* Internal use only. */ char program[1]; /* Unwarranted chumminess with compiler. */ } Expect_regexp; EXTERN Expect_regexp *Expect_TclRegComp _ANSI_ARGS_((char *exp)); EXTERN int Expect_TclRegExec _ANSI_ARGS_((Expect_regexp *prog, char *string, char *start)); EXTERN void Expect_TclRegSub _ANSI_ARGS_((Expect_regexp *prog, char *source, char *dest)); EXTERN void Expect_TclRegError _ANSI_ARGS_((char *msg)); EXTERN char *Expect_TclGetRegError _ANSI_ARGS_((void)); #endif /* TCL_REGEXP */
/* * Copyright (c) Bull S.A. 2007 All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * Further, this software is distributed without any warranty that it is * free of the rightful claim of any third person regarding infringement * or the like. Any license provided herein, whether implied or * otherwise, applies only to this software file. Patent licenses, if * any, provided herein do not apply to combinations of this program with * other software, or any other product whatsoever. * * You should have received a copy of the GNU General Public License along * with this program; if not, write the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * History: * Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net) * */ #include <stdlib.h> #include <stdio.h> #include <rpc/rpc.h> #include <netinet/in.h> #include <rpc/pmap_clnt.h> #include <netdb.h> //Standard define #define PROCNUM 1 #define VERSNUM 1 int main(int argn, char *argc[]) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // other arguments depend on test case //run_mode can switch into stand alone program or program launch by shell script //1 : stand alone, debug mode, more screen information //0 : launch by shell script as test case, only one printf -> result status int run_mode = 0; int test_status = 1; //Default test result set to FAILED int progNum = atoi(argc[2]); struct sockaddr_in sin; //Initialization sin.sin_addr.s_addr = 0; //Call tested routine get_myaddress(&sin); test_status = (sin.sin_addr.s_addr == 0); //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); return test_status; }
#ifndef _RC10_FINAL_H #define _RC10_FINAL_H #include "rc1.0_register.h" class FinalAlphaFunctionStruct { public: void Init(MappedRegisterStruct _g) { g = _g; } void ZeroOut(); MappedRegisterStruct g; }; class FinalRgbFunctionStruct { public: void Init(MappedRegisterStruct _a, MappedRegisterStruct _b, MappedRegisterStruct _c, MappedRegisterStruct _d) { a = _a; b = _b; c = _c; d = _d; } void ZeroOut(); MappedRegisterStruct a; MappedRegisterStruct b; MappedRegisterStruct c; MappedRegisterStruct d; }; class FinalProductStruct { public: void Init(MappedRegisterStruct _e, MappedRegisterStruct _f) { e = _e; f = _f; } void ZeroOut(); MappedRegisterStruct e; MappedRegisterStruct f; }; class FinalCombinerStruct { public: void Init(FinalRgbFunctionStruct _rgb, FinalAlphaFunctionStruct _alpha, int _clamp, FinalProductStruct _product) { rgb = _rgb; alpha = _alpha; clamp = _clamp; product = _product; hasProduct = true;} void Init(FinalRgbFunctionStruct _rgb, FinalAlphaFunctionStruct _alpha, int _clamp) { rgb = _rgb; alpha = _alpha; clamp = _clamp; hasProduct = false; product.ZeroOut();} int hasProduct; FinalProductStruct product; int clamp; FinalRgbFunctionStruct rgb; FinalAlphaFunctionStruct alpha; void Validate(); void Invoke(); }; #endif
/* * ------------------------------------------------------------------- * * Copyright 2004 Anthony Brockwell * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * ------------------------------------------------------------------- */ #ifndef OTHERPLOTS_HPP #define OTHERPLOTS_HPP #include "xyplot.h" #include "gtkmm.h" using namespace Gtk; class TSPlot : public XYPlot { protected: public: TSPlot(TimeSeries& ts); void Update(TimeSeries&); void Update(TimeSeries& ts1, TimeSeries& ts2); protected: }; class QQPlot : public XYPlot { protected: public: QQPlot(TimeSeries& ts); void Update(TimeSeries&); }; class ACFPlot : public XYPlot { protected: Vector localacf, locallag; double gamma0; Adjustment *lagadjust; SpinButton *lagspin; CheckButton *cb1,*cb2; int nlags; bool normalizing, includinglag0; public: ACFPlot(TimeSeries& ts); ACFPlot(TimeSeriesModel& tm); ~ACFPlot(); void Update(TimeSeries&); void Update(TimeSeriesModel&); void RenderStuff(); virtual void InitPropDialog(CenteringDialog& cd); virtual void ClosePropDialog(CenteringDialog& cd); }; class PACFPlot : public XYPlot { protected: Vector localacf, localpacf, locallag; public: PACFPlot(TimeSeries& ts); PACFPlot(TimeSeriesModel& tm); ~PACFPlot(); void Update(TimeSeries&); void Update(TimeSeriesModel&); }; class PatchPlot : public Gtk::DrawingArea { protected: string title; Glib::RefPtr<Gdk::GC> gc; Gdk::Color blue, lightblue, red, green, black, white, grey, darkgrey; Gdk::Color *shades; int n, nshades; Vector *u; Matrix pseudomap, baselinemap; public: PatchPlot(TimeSeries& resids); ~PatchPlot(); void Update(); void SetTitle(string&); virtual void on_realize(); virtual bool on_expose_event(GdkEventExpose* e); void ComputePseudomap(int nr, int nc); double Intensity(double x, double y, double centerx, double centery, double sig); }; #endif
/* ZynAddSubFX - a software synthesizer Reverb.h - Reverberation effect Copyright (C) 2002-2005 Nasca Octavian Paul Author: Nasca Octavian Paul This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License (version 2) for more details. You should have received a copy of the GNU General Public License (version 2) along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef REVERB_H #define REVERB_H #include "../globals.h" #include "../DSP/AnalogFilter.h" #include "Effect.h" #define REV_COMBS 8 #define REV_APS 4 class Reverb:public Effect { public: Reverb(int insertion,REALTYPE *efxoutl_,REALTYPE *efxoutr_); ~Reverb(); void out(REALTYPE *smps_l,REALTYPE *smps_r); void cleanup(); void setpreset(unsigned char npreset); void changepar(int npar,unsigned char value); unsigned char getpar(int npar); private: //Parametrii //Amount of the reverb, unsigned char Pvolume; //LefT/Right Panning unsigned char Ppan; //duration of reverb unsigned char Ptime; //Initial delay unsigned char Pidelay; //Initial delay feedback unsigned char Pidelayfb; //delay between ER/Reverbs unsigned char Prdelay; //EarlyReflections/Reverb Balance unsigned char Perbalance; //HighPassFilter unsigned char Plpf; //LowPassFilter unsigned char Phpf; //Low/HighFrequency Damping unsigned char Plohidamp;// 0..63 lpf,64=off,65..127=hpf(TODO) //Reverb type unsigned char Ptype; //Room Size unsigned char Proomsize; //parameter control void setvolume(unsigned char Pvolume); void setpan(unsigned char Ppan); void settime(unsigned char Ptime); void setlohidamp(unsigned char Plohidamp); void setidelay(unsigned char Pidelay); void setidelayfb(unsigned char Pidelayfb); void sethpf(unsigned char Phpf); void setlpf(unsigned char Plpf); void settype(unsigned char Ptype); void setroomsize(unsigned char Proomsize); REALTYPE pan,erbalance; //Parametrii 2 int lohidamptype;//0=disable,1=highdamp(lowpass),2=lowdamp(highpass) int idelaylen,rdelaylen; int idelayk; REALTYPE lohifb,idelayfb,roomsize,rs;//rs is used to "normalise" the volume according to the roomsize int comblen[REV_COMBS*2]; int aplen[REV_APS*2]; //Valorile interne REALTYPE *comb[REV_COMBS*2]; int combk[REV_COMBS*2]; REALTYPE combfb[REV_COMBS*2];//feedback-ul fiecarui filtru "comb" REALTYPE lpcomb[REV_COMBS*2];//pentru Filtrul LowPass REALTYPE *ap[REV_APS*2]; int apk[REV_APS*2]; REALTYPE *idelay; AnalogFilter *lpf,*hpf;//filters REALTYPE *inputbuf; void processmono(int ch,REALTYPE *output); }; #endif
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SANDBOX_SRC_SYNC_DISPATCHER_H_ #define SANDBOX_SRC_SYNC_DISPATCHER_H_ #include "base/basictypes.h" #include "base/strings/string16.h" #include "sandbox/win/src/crosscall_server.h" #include "sandbox/win/src/sandbox_policy_base.h" namespace sandbox { class SyncDispatcher : public Dispatcher { public: explicit SyncDispatcher(PolicyBase* policy_base); ~SyncDispatcher() {} virtual bool SetupService(InterceptionManager* manager, int service); private: bool CreateEvent(IPCInfo* ipc, base::string16* name, DWORD event_type, DWORD initial_state); bool OpenEvent(IPCInfo* ipc, base::string16* name, DWORD desired_access); PolicyBase* policy_base_; DISALLOW_COPY_AND_ASSIGN(SyncDispatcher); }; } #endif
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_COMMON_CHROME_CONTENT_CLIENT_H_ #define CHROME_COMMON_CHROME_CONTENT_CLIENT_H_ #include <string> #include <vector> #include "base/compiler_specific.h" #include "base/files/file_path.h" #include "content/public/common/content_client.h" class ChromeContentClient : public content::ContentClient { public: static const char* const kPDFPluginName; static const char* const kNaClPluginName; static const char* const kNaClOldPluginName; static const char* const kRemotingViewerPluginPath; virtual void SetActiveURL(const GURL& url) OVERRIDE; virtual void SetGpuInfo(const gpu::GPUInfo& gpu_info) OVERRIDE; virtual void AddPepperPlugins( std::vector<content::PepperPluginInfo>* plugins) OVERRIDE; virtual void AddAdditionalSchemes( std::vector<std::string>* standard_schemes, std::vector<std::string>* saveable_shemes) OVERRIDE; virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE; virtual std::string GetProduct() const OVERRIDE; virtual std::string GetUserAgent() const OVERRIDE; virtual base::string16 GetLocalizedString(int message_id) const OVERRIDE; virtual base::StringPiece GetDataResource( int resource_id, ui::ScaleFactor scale_factor) const OVERRIDE; virtual base::RefCountedStaticMemory* GetDataResourceBytes( int resource_id) const OVERRIDE; virtual gfx::Image& GetNativeImageNamed(int resource_id) const OVERRIDE; virtual std::string GetProcessTypeNameInEnglish(int type) OVERRIDE; #if defined(OS_MACOSX) && !defined(OS_IOS) virtual bool GetSandboxProfileForSandboxType( int sandbox_type, int* sandbox_profile_resource_id) const OVERRIDE; virtual std::string GetCarbonInterposePath() const OVERRIDE; #endif }; #endif
/* * This file is part of the coreboot project. * * Copyright (C) 2000 AG Electronics Ltd. * Copyright (C) 2003-2004 Linux Networx * Copyright (C) 2004 Tyan By LYH change from PC87360 * Copyright (C) 2010 Win Enterprises (anishp@win-ent.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> #include <console/console.h> #include <string.h> #include <bitops.h> #include <uart8250.h> #include <pc80/keyboard.h> #include <pc80/mc146818rtc.h> #include <stdlib.h> #include "chip.h" #include "w83627hf.h" static void pnp_enter_ext_func_mode(device_t dev) { outb(0x87, dev->path.pnp.port); outb(0x87, dev->path.pnp.port); } static void pnp_exit_ext_func_mode(device_t dev) { outb(0xaa, dev->path.pnp.port); } static void pnp_write_index(unsigned long port_base, uint8_t reg, uint8_t value) { outb(reg, port_base); outb(value, port_base + 1); } static uint8_t pnp_read_index(unsigned long port_base, uint8_t reg) { outb(reg, port_base); return inb(port_base + 1); } #if CONFIG_EXPERT static void w83627hf_16_bit_addr_qual(device_t dev) { int port = dev->path.pnp.port >> 8; pnp_enter_ext_func_mode(dev); outb(0x24, port); /* enable 16 bit address qualification */ outb(inb(port + 1) | 0x80, port + 1); pnp_exit_ext_func_mode(dev); } #endif static void enable_hwm_smbus(device_t dev) { /* set the pin 91,92 as I2C bus */ uint8_t reg, value; reg = 0x2b; value = pnp_read_config(dev, reg); value &= 0x3f; pnp_write_config(dev, reg, value); } static void init_acpi(device_t dev) { uint8_t value = 0x20; int power_on = 1; get_option(&power_on, "power_on_after_fail"); pnp_enter_ext_func_mode(dev); pnp_write_index(dev->path.pnp.port,7,0x0a); value = pnp_read_config(dev, 0xE4); value &= ~(3<<5); if(power_on) { value |= (1<<5); } pnp_write_config(dev, 0xE4, value); pnp_exit_ext_func_mode(dev); } static void init_hwm(unsigned long base) { uint8_t reg, value; int i; unsigned hwm_reg_values[] = { /* reg mask data */ 0x40, 0xff, 0x81, /* start HWM */ 0x48, 0xaa, 0x2a, /* set SMBus base to 0x54>>1 */ 0x4a, 0x21, 0x21, /* set T2 SMBus base to 0x92>>1 and T3 SMBus base to 0x94>>1 */ 0x4e, 0x80, 0x00, 0x43, 0x00, 0xff, 0x44, 0x00, 0x3f, 0x4c, 0xbf, 0x18, 0x4d, 0xff, 0x80 /* turn off beep */ }; for(i = 0; i< ARRAY_SIZE(hwm_reg_values); i+=3 ) { reg = hwm_reg_values[i]; value = pnp_read_index(base, reg); value &= 0xff & hwm_reg_values[i+1]; value |= 0xff & hwm_reg_values[i+2]; #if 0 printk(BIOS_DEBUG, "base = 0x%04x, reg = 0x%02x, value = 0x%02x\n", base, reg,value); #endif pnp_write_index(base, reg, value); } } static void w83627hf_init(device_t dev) { struct superio_winbond_w83627hf_config *conf; struct resource *res0, *res1; if (!dev->enabled) { return; } conf = dev->chip_info; switch(dev->path.pnp.device) { case W83627HF_SP1: res0 = find_resource(dev, PNP_IDX_IO0); init_uart8250(res0->base, &conf->com1); break; case W83627HF_SP2: res0 = find_resource(dev, PNP_IDX_IO0); init_uart8250(res0->base, &conf->com2); break; case W83627HF_KBC: res0 = find_resource(dev, PNP_IDX_IO0); res1 = find_resource(dev, PNP_IDX_IO1); pc_keyboard_init(&conf->keyboard); break; case W83627HF_HWM: res0 = find_resource(dev, PNP_IDX_IO0); #define HWM_INDEX_PORT 5 init_hwm(res0->base + HWM_INDEX_PORT); break; case W83627HF_ACPI: init_acpi(dev); break; } } static void w83627hf_pnp_set_resources(device_t dev) { pnp_enter_ext_func_mode(dev); pnp_set_resources(dev); pnp_exit_ext_func_mode(dev); } static void w83627hf_pnp_enable_resources(device_t dev) { pnp_enter_ext_func_mode(dev); pnp_enable_resources(dev); switch(dev->path.pnp.device) { case W83627HF_HWM: printk(BIOS_DEBUG, "w83627hf hwm smbus enabled\n"); enable_hwm_smbus(dev); break; } pnp_exit_ext_func_mode(dev); } static void w83627hf_pnp_enable(device_t dev) { if (!dev->enabled) { pnp_enter_ext_func_mode(dev); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_exit_ext_func_mode(dev); } } static struct device_operations ops = { .read_resources = pnp_read_resources, .set_resources = w83627hf_pnp_set_resources, .enable_resources = w83627hf_pnp_enable_resources, .enable = w83627hf_pnp_enable, .init = w83627hf_init, }; static struct pnp_info pnp_dev_info[] = { { &ops, W83627HF_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, }, { &ops, W83627HF_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, }, { &ops, W83627HF_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, }, { &ops, W83627HF_SP2, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, }, /* No 4 { 0,}, */ { &ops, W83627HF_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, { 0x7ff, 0 }, { 0x7ff, 0x4}, }, { &ops, W83627HF_CIR, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, }, { &ops, W83627HF_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7ff, 0 }, {0x7fe, 0x4}, }, { &ops, W83627HF_GPIO2, }, { &ops, W83627HF_GPIO3, }, { &ops, W83627HF_ACPI, }, { &ops, W83627HF_HWM, PNP_IO0 | PNP_IRQ0, { 0xff8, 0 }, }, }; static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); } struct chip_operations superio_winbond_w83627hf_ops = { CHIP_NAME("Winbond W83627HF Super I/O") .enable_dev = enable_dev, };
/* * Copyright (c) 2013 Goce Boshkovski * * 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. * */ #ifndef SSLSOCKET_H #define SSLSOCKET_H #include <QSSLSocket> #include <QSslCertificate> #include <QDateTime> class SSLSocket : public QSslSocket { Q_OBJECT public: SSLSocket(); enum getCertificateErrorCode {Faild2Connect=-1, CertificateFached, RetriveHasFailed}; private: QString hostName; quint16 portNumber; QSslCertificate SSLCert; public slots: int getCertificate(QString,quint16); void printSSLErrors(); QString getCertCommonName(); QString getCertOrganization(); QString getCertOrganizationUnitName(); QString getCertLocalityName(); QString getCertStateOrProvinceName(); QString getCertCountryName(); QDateTime getCertExpiryDate(); QString getIssuerOrganization(); signals: void getSSLCertFinished(void); }; #endif // SSLSOCKET_H
/*. ******* coding:utf-8 AUTOHEADER START v1.2 ******* *. vim: fileencoding=utf-8 syntax=c sw=4 ts=4 et *. Copyrights: *. *. © 2007-2009 Matt Harrington (Author of LegoNXTRemove @ code.google.com) *. © 2007-2010 Nima Talebi <nima@autonomy.net.au> *. © 2010 Remy "Psycho" Demarest <Psy|@#cocoa@irc.freenode.org> *. *. License: *. *. MIT - The @PKG packages is available under the terms of *. the MIT license. *. *. Homepage: *. *. Original: http://code.google.com/p/legonxtremote/ *. Mutation: http://ai.autonomy.net.au/wiki/Project/Framework/Nimachine *. *. This file is part of the Nimachine Suite. *. *. Nimachine 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. *. *. Nimachine 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 Nimachine. If not, see <http://www.gnu.org/licenses/>. *. *. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED *. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO *. EVENT SHALL THE 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. *. *. ADAPTED M. STONE & T. PARKER DISCLAIMER: THIS SOFTWARE COULD RESULT IN *. INJURY AND/OR DEATH, AND AS SUCH, IT SHOULD NOT BE BUILT, INSTALLED OR USED BY *. ANYONE. *. ******* AUTOHEADER END v1.2 ******* */ //. Created by Nima Talebi on 5/01/10. #import "NXTSensor.h" #import "NXTMessageInit.h" @interface NXTSensorColor:NXTSensor { NXTMessageInit *txData; NXTMessageInit1 *txData1; } @property(readonly) NXTMessageInit *txData; @property(readonly) NXTMessageInit1 *txData1; - (id)initOnPort:(NXTSensorPort)p; @end
/* XRoar - a Dragon/Tandy Coco emulator * Copyright (C) 2003-2008 Ciaran Anscomb * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <nds.h> #include <fat.h> #include <sys/dir.h> #include "types.h" #include "logging.h" #include "module.h" #include "nds/ndsui.h" #include "nds/ndsgfx.h" static struct ndsui_component *component_list = NULL; static struct ndsui_component *current_component = NULL; /* All components have a unique id, but it's not used internally */ static unsigned int next_id = 0; void ndsui_add_component(struct ndsui_component *c) { if (c == NULL) return; /* c->next being set implies component is already on the list */ if (c->next != NULL) return; c->next = component_list; component_list = c; } void ndsui_show_all_components(void) { struct ndsui_component *c; for (c = component_list; c; c = c->next) { ndsui_show_component(c); } } void ndsui_clear_component_list(void) { struct ndsui_component **cp = &component_list; while (*cp) { struct ndsui_component **next = &((*cp)->next); ndsui_hide_component(*cp); *cp = NULL; cp = next; } } void ndsui_pen_down(int x, int y) { struct ndsui_component *c; for (c = component_list; c; c = c->next) { if (c->visible && x >= c->x && x < (c->x+c->w) && y >= c->y && y < (c->y+c->h)) { current_component = c; } } if (current_component) { if (current_component->pen_down) { current_component->pen_down(current_component, x, y); } } } void ndsui_pen_move(int x, int y) { if (current_component) { if (current_component->pen_move) { current_component->pen_move(current_component, x, y); } } } void ndsui_pen_up(void) { if (current_component) { if (current_component->pen_up) { current_component->pen_up(current_component); } current_component = NULL; } } struct ndsui_component *ndsui_new_component(int x, int y, int w, int h) { struct ndsui_component *new; new = malloc(sizeof(struct ndsui_component)); if (new == NULL) return NULL; memset(new, 0, sizeof(struct ndsui_component)); new->id = next_id++; new->x = x; new->y = y; new->w = w; new->h = h; new->visible = 0; return new; } void ndsui_show_component(struct ndsui_component *c) { c->visible = 1; ndsui_draw_component(c); } void ndsui_hide_component(struct ndsui_component *c) { ndsui_undraw_component(c); c->visible = 0; } void ndsui_draw_component(struct ndsui_component *c) { if (c->visible && c->show) c->show(c); } void ndsui_undraw_component(struct ndsui_component *c) { if (c->visible) ndsgfx_fillrect(c->x, c->y, c->w, c->h, NDS_DARKPURPLE); } void ndsui_resize_component(struct ndsui_component *c, int w, int h) { int visible; if (c == NULL) return; visible = c->visible; ndsui_undraw_component(c); c->w = w; c->h = h; if (c->resize) c->resize(c, w, h); ndsui_draw_component(c); }
/** ****************************************************************************** * @file Templates/Src/stm32f4xx_it.c * @author MCD Application Team * @version V1.1.0 * @date 26-June-2014 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and * peripherals interrupt service routine. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ //#include "main.h" #include "stm32f4xx_it.h" /** @addtogroup STM32F4xx_HAL_Examples * @{ */ /** @addtogroup Templates * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************/ /* Cortex-M4 Processor Exceptions Handlers */ /******************************************************************************/ /** * @brief This function handles NMI exception. * @param None * @retval None */ void NMI_Handler(void) { } /** * @brief This function handles Hard Fault exception. * @param None * @retval None */ void HardFault_Handler(void) { /* Go to infinite loop when Hard Fault exception occurs */ while (1) { } } /** * @brief This function handles Memory Manage exception. * @param None * @retval None */ void MemManage_Handler(void) { /* Go to infinite loop when Memory Manage exception occurs */ while (1) { } } /** * @brief This function handles Bus Fault exception. * @param None * @retval None */ void BusFault_Handler(void) { /* Go to infinite loop when Bus Fault exception occurs */ while (1) { } } /** * @brief This function handles Usage Fault exception. * @param None * @retval None */ void UsageFault_Handler(void) { /* Go to infinite loop when Usage Fault exception occurs */ while (1) { } } /** * @brief This function handles SVCall exception. * @param None * @retval None */ void SVC_Handler(void) { } /** * @brief This function handles Debug Monitor exception. * @param None * @retval None */ void DebugMon_Handler(void) { } /** * @brief This function handles PendSVC exception. * @param None * @retval None */ void PendSV_Handler(void) { } /** * @brief This function handles SysTick Handler. * @param None * @retval None */ void SysTick_Handler(void) { //HAL_IncTick(); } /******************************************************************************/ /* STM32F4xx Peripherals Interrupt Handlers */ /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ /* available peripheral interrupt handler's name please refer to the startup */ /* file (startup_stm32f4xx.s). */ /******************************************************************************/ /** * @brief This function handles PPP interrupt request. * @param None * @retval None */ /*void PPP_IRQHandler(void) { }*/ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#ifndef INTEGERTUPLEFIELD_H #define INTEGERTUPLEFIELD_H #include "Field.h" #include "IntegerTuple.h" class IntegerTupleField : public Field { public: IntegerTupleField(string name,IntegerTuple defaultValue); public: virtual ~IntegerTupleField(void); private: IntegerTuple value; public: IntegerTuple GetValue(); public: void SetValue(IntegerTuple value); public: string ToString(); public: void SetStringValue(string value); private: IntegerTuple defaultValue; public: bool IsDefaultValue(); public: Field * GetCopy(); }; #endif
/* History.h -- the names of functions that you can call in history. */ typedef struct _hist_entry { char *line; char *data; } HIST_ENTRY; /* For convenience only. You set this when interpreting history commands. It is the logical offset of the first history element. */ extern int history_base; /* Begin a session in which the history functions might be used. This just initializes the interactive variables. */ extern void using_history (); /* Place STRING at the end of the history list. The associated data field (if any) is set to NULL. */ extern void add_history (); /* Returns the number which says what history element we are now looking at. */ extern int where_history (); /* Set the position in the history list to POS. */ int history_set_pos (); /* Search for STRING in the history list, starting at POS, an absolute index into the list. DIR, if negative, says to search backwards from POS, else forwards. Returns the absolute index of the history element where STRING was found, or -1 otherwise. */ extern int history_search_pos (); /* A reasonably useless function, only here for completeness. WHICH is the magic number that tells us which element to delete. The elements are numbered from 0. */ extern HIST_ENTRY *remove_history (); /* Stifle the history list, remembering only MAX number of entries. */ extern void stifle_history (); /* Stop stifling the history. This returns the previous amount the history was stifled by. The value is positive if the history was stifled, negative if it wasn't. */ extern int unstifle_history (); /* Add the contents of FILENAME to the history list, a line at a time. If FILENAME is NULL, then read from ~/.history. Returns 0 if successful, or errno if not. */ extern int read_history (); /* Read a range of lines from FILENAME, adding them to the history list. Start reading at the FROM'th line and end at the TO'th. If FROM is zero, start at the beginning. If TO is less than FROM, read until the end of the file. If FILENAME is NULL, then read from ~/.history. Returns 0 if successful, or errno if not. */ extern int read_history_range (); /* Append the current history to FILENAME. If FILENAME is NULL, then append the history list to ~/.history. Values returned are as in read_history (). */ extern int write_history (); /* Append NELEMENT entries to FILENAME. The entries appended are from the end of the list minus NELEMENTs up to the end of the list. */ int append_history (); /* Make the history entry at WHICH have LINE and DATA. This returns the old entry so you can dispose of the data. In the case of an invalid WHICH, a NULL pointer is returned. */ extern HIST_ENTRY *replace_history_entry (); /* Return the history entry at the current position, as determined by history_offset. If there is no entry there, return a NULL pointer. */ HIST_ENTRY *current_history (); /* Back up history_offset to the previous history entry, and return a pointer to that entry. If there is no previous entry, return a NULL pointer. */ extern HIST_ENTRY *previous_history (); /* Move history_offset forward to the next item in the input_history, and return the a pointer to that entry. If there is no next entry, return a NULL pointer. */ extern HIST_ENTRY *next_history (); /* Return a NULL terminated array of HIST_ENTRY which is the current input history. Element 0 of this list is the beginning of time. If there is no history, return NULL. */ extern HIST_ENTRY **history_list (); /* Search the history for STRING, starting at history_offset. If DIRECTION < 0, then the search is through previous entries, else through subsequent. If the string is found, then current_history () is the history entry, and the value of this function is the offset in the line of that history entry that the string was found in. Otherwise, nothing is changed, and a -1 is returned. */ extern int history_search (); /* Expand the string STRING, placing the result into OUTPUT, a pointer to a string. Returns: 0) If no expansions took place (or, if the only change in the text was the de-slashifying of the history expansion character) 1) If expansions did take place -1) If there was an error in expansion. If an error ocurred in expansion, then OUTPUT contains a descriptive error message. */ extern int history_expand (); /* Extract a string segment consisting of the FIRST through LAST arguments present in STRING. Arguments are broken up as in the shell. */ extern char *history_arg_extract (); /* Return the number of bytes that the primary history entries are using. This just adds up the lengths of the_history->lines. */ extern int history_total_bytes ();
#ifndef _ASM_X86_STATFS_H #define _ASM_X86_STATFS_H #define ARCH_PACK_COMPAT_STATFS64 __attribute__((packed,aligned(4))) #include <asm-generic/statfs.h> #endif /* _ASM_X86_STATFS_H */
/* * linux/fs/truncate.c * * Copyright (C) 1991, 1992 Linus Torvalds */ #include <linux/errno.h> #include <linux/sched.h> #include <linux/minix_fs.h> #include <linux/stat.h> #include <linux/fcntl.h> /* * Truncate has the most races in the whole filesystem: coding it is * a pain in the a**. Especially as I don't do any locking... * * The code may look a bit weird, but that's just because I've tried to * handle things like file-size changes in a somewhat graceful manner. * Anyway, truncating a file at the same time somebody else writes to it * is likely to result in pretty weird behaviour... * * The new code handles normal truncates (size = 0) as well as the more * general case (size = XXX). I hope. */ static int trunc_direct(struct inode * inode) { unsigned short * p; struct buffer_head * bh; int i, tmp; int retry = 0; #define DIRECT_BLOCK ((inode->i_size + 1023) >> 10) repeat: for (i = DIRECT_BLOCK ; i < 7 ; i++) { p = i + inode->u.minix_i.i_data; if (!(tmp = *p)) continue; bh = get_hash_table(inode->i_dev,tmp,BLOCK_SIZE); if (i < DIRECT_BLOCK) { brelse(bh); goto repeat; } if ((bh && bh->b_count != 1) || tmp != *p) { retry = 1; brelse(bh); continue; } *p = 0; inode->i_dirt = 1; brelse(bh); minix_free_block(inode->i_sb,tmp); } return retry; } static int trunc_indirect(struct inode * inode, int offset, unsigned short * p) { struct buffer_head * bh; int i, tmp; struct buffer_head * ind_bh; unsigned short * ind; int retry = 0; #define INDIRECT_BLOCK (DIRECT_BLOCK-offset) tmp = *p; if (!tmp) return 0; ind_bh = bread(inode->i_dev, tmp, BLOCK_SIZE); if (tmp != *p) { brelse(ind_bh); return 1; } if (!ind_bh) { *p = 0; return 0; } repeat: for (i = INDIRECT_BLOCK ; i < 512 ; i++) { if (i < 0) i = 0; if (i < INDIRECT_BLOCK) goto repeat; ind = i+(unsigned short *) ind_bh->b_data; tmp = *ind; if (!tmp) continue; bh = get_hash_table(inode->i_dev,tmp,BLOCK_SIZE); if (i < INDIRECT_BLOCK) { brelse(bh); goto repeat; } if ((bh && bh->b_count != 1) || tmp != *ind) { retry = 1; brelse(bh); continue; } *ind = 0; mark_buffer_dirty(ind_bh, 1); brelse(bh); minix_free_block(inode->i_sb,tmp); } ind = (unsigned short *) ind_bh->b_data; for (i = 0; i < 512; i++) if (*(ind++)) break; if (i >= 512) if (ind_bh->b_count != 1) retry = 1; else { tmp = *p; *p = 0; minix_free_block(inode->i_sb,tmp); } brelse(ind_bh); return retry; } static int trunc_dindirect(struct inode * inode) { int i, tmp; struct buffer_head * dind_bh; unsigned short * dind, * p; int retry = 0; #define DINDIRECT_BLOCK ((DIRECT_BLOCK-(512+7))>>9) p = 8 + inode->u.minix_i.i_data; if (!(tmp = *p)) return 0; dind_bh = bread(inode->i_dev, tmp, BLOCK_SIZE); if (tmp != *p) { brelse(dind_bh); return 1; } if (!dind_bh) { *p = 0; return 0; } repeat: for (i = DINDIRECT_BLOCK ; i < 512 ; i ++) { if (i < 0) i = 0; if (i < DINDIRECT_BLOCK) goto repeat; dind = i+(unsigned short *) dind_bh->b_data; retry |= trunc_indirect(inode,7+512+(i<<9),dind); mark_buffer_dirty(dind_bh, 1); } dind = (unsigned short *) dind_bh->b_data; for (i = 0; i < 512; i++) if (*(dind++)) break; if (i >= 512) if (dind_bh->b_count != 1) retry = 1; else { tmp = *p; *p = 0; inode->i_dirt = 1; minix_free_block(inode->i_sb,tmp); } brelse(dind_bh); return retry; } void minix_truncate(struct inode * inode) { int retry; if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) return; while (1) { retry = trunc_direct(inode); retry |= trunc_indirect(inode,7,inode->u.minix_i.i_data+7); retry |= trunc_dindirect(inode); if (!retry) break; current->counter = 0; schedule(); } inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_dirt = 1; }
/* testndbm.c - Driver program to test the ndbm interface routines. */ /* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson. Copyright (C) 1990, 1991, 1993 Free Software Foundation, Inc. GDBM is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GDBM 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 GDBM; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. You may contact the author by: e-mail: phil@cs.wwu.edu us-mail: Philip A. Nelson Computer Science Department Western Washington University Bellingham, WA 98226 *************************************************************************/ /* include system configuration before all else. */ #include "autoconf.h" #include <stdio.h> #include <sys/types.h> #if HAVE_FILE_H #include <sys/file.h> #endif #include <sys/stat.h> #if HAVE_FCNTL_H #include <fcntl.h> #endif #ifdef GNU #include "ndbm.h" #else #include <ndbm.h> #endif #define TRUE 1 #define FALSE 0 /* The test program allows one to call all the routines plus the hash function. The commands are single letter commands. The user is prompted for all other information. The commands are q (quit), f (fetch), s (store), d (delete), 1 (firstkey), n (nextkey) and h (hash function). */ int main (argc, argv) int argc; char *argv[]; { char cmd_ch; datum key_data; datum data_data; datum return_data; char key_line[500]; char data_line[1000]; DBM *dbm_file; char done = FALSE; char *file_name; /* Argument checking. */ if (argc > 2) { printf ("Usage: %s [dbm-file] \n",argv[0]); exit (2); } if (argc > 1) { file_name = argv[1]; } else { file_name = "junkndbm"; } /* Initialize. */ data_data.dptr = data_line; dbm_file = dbm_open (file_name, O_RDWR|O_CREAT, 00664); if (dbm_file == NULL) { printf ("dbm_open failed.\n"); exit (2); } /* Welcome message. */ printf ("\nWelcome to the gndbm test program. Type ? for help.\n\n"); while (!done) { printf ("com -> "); cmd_ch = getchar (); while (getchar () != '\n') /* Do nothing. */; switch (cmd_ch) { case 'q': done = TRUE; break; case 'f': printf ("key -> "); gets (key_line); key_data.dptr = key_line; key_data.dsize = strlen (key_line)+1; return_data = dbm_fetch (dbm_file, key_data); if (return_data.dptr != NULL) printf ("data is ->%s\n\n", return_data.dptr); else printf ("No such item found.\n\n"); break; case 's': printf ("key -> "); gets (key_line); key_data.dptr = key_line; key_data.dsize = strlen (key_line)+1; printf ("data -> "); gets (data_line); data_data.dsize = strlen (data_line)+1; if (dbm_store (dbm_file, key_data, data_data, DBM_REPLACE) != 0) printf ("Item not inserted. \n"); printf ("\n"); break; case 'd': printf ("key -> "); gets (key_line); key_data.dptr = key_line; key_data.dsize = strlen (key_line)+1; if (dbm_delete (dbm_file, key_data) != 0) printf ("Item not found or deleted\n"); printf ("\n"); break; case '1': key_data = dbm_firstkey (dbm_file); if (key_data.dptr != NULL) { return_data = dbm_fetch (dbm_file, key_data); printf ("key is ->%s\n", key_data.dptr); printf ("data is ->%s\n\n", return_data.dptr); } else printf ("No such item found.\n\n"); break; case '2': key_data = dbm_nextkey (dbm_file); if (key_data.dptr != NULL) { return_data = dbm_fetch (dbm_file, key_data); printf ("key is ->%s\n", key_data.dptr); printf ("data is ->%s\n\n", return_data.dptr); } else printf ("No such item found.\n\n"); break; case 'c': { int temp; temp = 0; return_data = dbm_firstkey (dbm_file); while (return_data.dptr != NULL) { temp++; return_data = dbm_nextkey (dbm_file); } printf ("There are %d items in the database.\n\n", temp); } break; case '?': printf ("c - count elements\n"); printf ("d - delete\n"); printf ("f - fetch\n"); printf ("q - quit\n"); printf ("s - store\n"); printf ("1 - firstkey\n"); printf ("2 - nextkey on last return value\n\n"); break; default: printf ("What? \n\n"); break; } } /* Quit normally. */ dbm_close (dbm_file); exit (0); }
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define MYPORT 1234 // the port users will be connecting to #define BACKLOG 5 // how many pending connections queue will hold #define BUF_SIZE 1024 int fd_A[BACKLOG]; // accepted connection fd int conn_amount; // current connection amount void showclient() { int i; printf("client amount: %d\n", conn_amount); for (i = 0; i < BACKLOG; i++) { printf("[%d]:%d ", i, fd_A[i]); } printf("\n\n"); } int main(void) { int sock_fd, new_fd; // listen on sock_fd, new connection on new_fd struct sockaddr_in server_addr; // server address information struct sockaddr_in client_addr; // connector's address information socklen_t sin_size; int yes = 1; char buf[BUF_SIZE]; int ret; int i; if ((sock_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { perror("socket"); exit(1); } if (setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) { perror("setsockopt"); exit(1); } server_addr.sin_family = AF_INET; // host byte order server_addr.sin_port = htons(MYPORT); // short, network byte order server_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP memset(server_addr.sin_zero, '\0', sizeof(server_addr.sin_zero)); if (bind(sock_fd, (struct sockaddr *)&server_addr, sizeof(server_addr)) == -1) { perror("bind"); exit(1); } if (listen(sock_fd, BACKLOG) == -1) { perror("listen"); exit(1); } printf("listen port %d\n", MYPORT); fd_set fdsr; int maxsock; struct timeval tv; conn_amount = 0; sin_size = sizeof(client_addr); maxsock = sock_fd; while (1) { // initialize file descriptor set FD_ZERO(&fdsr); FD_SET(sock_fd, &fdsr); // add fd // timeout setting tv.tv_sec = 30; tv.tv_usec = 0; // add active connection to fd set for (i = 0; i < BACKLOG; i++) { if (fd_A[i] != 0) { FD_SET(fd_A[i], &fdsr); } } ret = select(maxsock + 1, &fdsr, NULL, NULL, &tv); if (ret < 0) { // error perror("select"); break; } else if (ret == 0) { // time out printf("timeout\n"); continue; } // check every fd in the set for (i = 0; i < conn_amount; i++) { if (FD_ISSET(fd_A[i], &fdsr)) // check which fd is ready { ret = recv(fd_A[i], buf, sizeof(buf), 0); if (ret <= 0) { // client close printf("ret : %d and client[%d] close\n", ret, i); close(fd_A[i]); FD_CLR(fd_A[i], &fdsr); // delete fd fd_A[i] = 0; conn_amount--; } else { // receive data if (ret < BUF_SIZE) memset(&buf[ret], '\0', 1); // add NULL('\0') printf("client[%d] send:%s\n", i, buf); } } } // check whether a new connection comes if (FD_ISSET(sock_fd, &fdsr)) // accept new connection { new_fd = accept(sock_fd, (struct sockaddr *)&client_addr, &sin_size); if (new_fd <= 0) { perror("accept"); continue; } // add to fd queue if (conn_amount < BACKLOG) { fd_A[conn_amount++] = new_fd; printf("new connection client[%d] %s:%d\n", conn_amount, inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port)); if (new_fd > maxsock) // update the maxsock fd for select function maxsock = new_fd; } else { printf("max connections arrive, exit\n"); send(new_fd, "bye", 4, 0); close(new_fd); break; } } showclient(); } // close other connections for (i = 0; i < BACKLOG; i++) { if (fd_A[i] != 0) { close(fd_A[i]); } } exit(0); }