text
stringlengths
4
6.14k
/***********************************************************************/ /* */ /* Objective Caml */ /* */ /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ /* */ /* Copyright 1996 Institut National de Recherche en Informatique et */ /* en Automatique. All rights reserved. This file is distributed */ /* under the terms of the GNU Library General Public License, with */ /* the special exception on linking described in file ../LICENSE. */ /* */ /***********************************************************************/ /* $Id: str.c 9547 2010-01-22 12:48:24Z doligez $ */ /* Operations on strings */ #include <string.h> #include <ctype.h> #include "alloc.h" #include "fail.h" #include "mlvalues.h" #include "misc.h" #ifdef HAS_LOCALE #include <locale.h> #endif CAMLexport mlsize_t caml_string_length(value s) { mlsize_t temp; temp = Bosize_val(s) - 1; Assert (Byte (s, temp - Byte (s, temp)) == 0); return temp - Byte (s, temp); } CAMLprim value caml_ml_string_length(value s) { mlsize_t temp; temp = Bosize_val(s) - 1; Assert (Byte (s, temp - Byte (s, temp)) == 0); return Val_long(temp - Byte (s, temp)); } CAMLprim value caml_create_string(value len) { mlsize_t size = Long_val(len); if (size > Bsize_wsize (Max_wosize) - 1){ caml_invalid_argument("String.create"); } return caml_alloc_string(size); } CAMLprim value caml_string_get(value str, value index) { intnat idx = Long_val(index); if (idx < 0 || idx >= caml_string_length(str)) caml_array_bound_error(); return Val_int(Byte_u(str, idx)); } CAMLprim value caml_string_set(value str, value index, value newval) { intnat idx = Long_val(index); if (idx < 0 || idx >= caml_string_length(str)) caml_array_bound_error(); Byte_u(str, idx) = Int_val(newval); return Val_unit; } CAMLprim value caml_string_equal(value s1, value s2) { mlsize_t sz1, sz2; value * p1, * p2; if (s1 == s2) return Val_true; sz1 = Wosize_val(s1); sz2 = Wosize_val(s2); if (sz1 != sz2) return Val_false; for(p1 = Op_val(s1), p2 = Op_val(s2); sz1 > 0; sz1--, p1++, p2++) if (*p1 != *p2) return Val_false; return Val_true; } CAMLprim value caml_string_notequal(value s1, value s2) { return Val_not(caml_string_equal(s1, s2)); } CAMLprim value caml_string_compare(value s1, value s2) { mlsize_t len1, len2; int res; if (s1 == s2) return Val_int(0); len1 = caml_string_length(s1); len2 = caml_string_length(s2); res = memcmp(String_val(s1), String_val(s2), len1 <= len2 ? len1 : len2); if (res < 0) return Val_int(-1); if (res > 0) return Val_int(1); if (len1 < len2) return Val_int(-1); if (len1 > len2) return Val_int(1); return Val_int(0); } CAMLprim value caml_string_lessthan(value s1, value s2) { return caml_string_compare(s1, s2) < Val_int(0) ? Val_true : Val_false; } CAMLprim value caml_string_lessequal(value s1, value s2) { return caml_string_compare(s1, s2) <= Val_int(0) ? Val_true : Val_false; } CAMLprim value caml_string_greaterthan(value s1, value s2) { return caml_string_compare(s1, s2) > Val_int(0) ? Val_true : Val_false; } CAMLprim value caml_string_greaterequal(value s1, value s2) { return caml_string_compare(s1, s2) >= Val_int(0) ? Val_true : Val_false; } CAMLprim value caml_blit_string(value s1, value ofs1, value s2, value ofs2, value n) { memmove(&Byte(s2, Long_val(ofs2)), &Byte(s1, Long_val(ofs1)), Int_val(n)); return Val_unit; } CAMLprim value caml_fill_string(value s, value offset, value len, value init) { memset(&Byte(s, Long_val(offset)), Int_val(init), Long_val(len)); return Val_unit; } CAMLprim value caml_is_printable(value chr) { int c; #ifdef HAS_LOCALE static int locale_is_set = 0; if (! locale_is_set) { setlocale(LC_CTYPE, ""); locale_is_set = 1; } #endif c = Int_val(chr); return Val_bool(isprint(c)); } CAMLprim value caml_bitvect_test(value bv, value n) { int pos = Int_val(n); return Val_int(Byte_u(bv, pos >> 3) & (1 << (pos & 7))); }
/* * Copyright 2006, Haiku. * Distributed under the terms of the MIT License. * * Authors: * Stephan Aßmus <superstippi@gmx.de> */ #ifndef VOLUME_SLIDER_H #define VOLUME_SLIDER_H #include <Control.h> class VolumeSlider : public BControl { public: VolumeSlider(BRect frame, const char* name, int32 minValue, int32 maxValue, BMessage* message = NULL, BHandler* target = NULL); virtual ~VolumeSlider(); // BControl virtual void AttachedToWindow(); virtual void SetValue(int32 value); void SetValueNoInvoke(int32 value); virtual void SetEnabled(bool enable); virtual void Draw(BRect updateRect); virtual void MouseDown(BPoint where); virtual void MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage); virtual void MouseUp(BPoint where); // VolumeSlider bool IsValid() const; void SetMuted(bool mute); bool IsMuted() const { return fMuted; } private: void _MakeBitmaps(); void _DimBitmap(BBitmap* bitmap); int32 _ValueFor(float xPos) const; BBitmap* fLeftSideBits; BBitmap* fRightSideBits; BBitmap* fKnobBits; bool fTracking; bool fMuted; int32 fMinValue; int32 fMaxValue; }; #endif // VOLUME_SLIDER_H
/* * Copyright (C) 2011 Samsung Electronics Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS CORPORATION AND ITS * CONTRIBUTORS "AS IS", AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG * ELECTRONICS CORPORATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS, OR BUSINESS INTERRUPTION), HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING * NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef WebCLFinishCallback_h #define WebCLFinishCallback_h #ifndef THIRD_PARTY_WEBKIT_MODULES_WEBCL // ScalableVision to avoid conflict between TraceEvent.h and trace_event.h #define THIRD_PARTY_WEBKIT_MODULES_WEBCL #endif #if ENABLE(WEBCL) #include <wtf/ThreadSafeRefCounted.h> namespace WebCore { class WebCL; class WebCLFinishCallback : public ThreadSafeRefCounted<WebCLFinishCallback> { public: virtual ~WebCLFinishCallback() { } //virtual bool handleEvent(WebCL*) = 0; virtual bool handleEvent(int) = 0; }; } // namespace WebCore #endif // WebCLFinishCallback_H #endif
/***********************************************************************/ /* */ /* Objective Caml */ /* */ /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ /* */ /* Copyright 1996 Institut National de Recherche en Informatique et */ /* en Automatique. All rights reserved. This file is distributed */ /* under the terms of the GNU Library General Public License, with */ /* the special exception on linking described in file ../../LICENSE. */ /* */ /***********************************************************************/ /* $Id: channels.c 9547 2010-01-22 12:48:24Z doligez $ */ #include <mlvalues.h> #include <alloc.h> #include <io.h> #include <memory.h> #include "unixsupport.h" #include <fcntl.h> extern long _get_osfhandle(int); extern int _open_osfhandle(long, int); int win_CRT_fd_of_filedescr(value handle) { if (CRT_fd_val(handle) != NO_CRT_FD) { return CRT_fd_val(handle); } else { int fd = _open_osfhandle((long) Handle_val(handle), O_BINARY); if (fd == -1) uerror("channel_of_descr", Nothing); return fd; } } CAMLprim value win_inchannel_of_filedescr(value handle) { CAMLparam1(handle); CAMLlocal1(vchan); struct channel * chan; chan = caml_open_descriptor_in(win_CRT_fd_of_filedescr(handle)); if (Descr_kind_val(handle) == KIND_SOCKET) chan->flags |= CHANNEL_FLAG_FROM_SOCKET; vchan = caml_alloc_channel(chan); CAMLreturn(vchan); } CAMLprim value win_outchannel_of_filedescr(value handle) { CAMLparam1(handle); CAMLlocal1(vchan); int fd; struct channel * chan; chan = caml_open_descriptor_out(win_CRT_fd_of_filedescr(handle)); if (Descr_kind_val(handle) == KIND_SOCKET) chan->flags |= CHANNEL_FLAG_FROM_SOCKET; vchan = caml_alloc_channel(chan); CAMLreturn(vchan); } CAMLprim value win_filedescr_of_channel(value vchan) { CAMLparam1(vchan); CAMLlocal1(fd); struct channel * chan; HANDLE h; chan = Channel(vchan); if (chan->fd == -1) uerror("descr_of_channel", Nothing); h = (HANDLE) _get_osfhandle(chan->fd); if (chan->flags & CHANNEL_FLAG_FROM_SOCKET) fd = win_alloc_socket((SOCKET) h); else fd = win_alloc_handle(h); CRT_fd_val(fd) = chan->fd; CAMLreturn(fd); } CAMLprim value win_handle_fd(value vfd) { int crt_fd = Int_val(vfd); /* PR#4750: do not use the _or_socket variant as it can cause performance degradation and this function is only used with the standard handles 0, 1, 2, which are not sockets. */ value res = win_alloc_handle((HANDLE) _get_osfhandle(crt_fd)); CRT_fd_val(res) = crt_fd; return res; }
/* Program to cut a sphere out of a gadget snapshot gcc -std=c99 -lm -o a.out whatever.c libgad.o */ #include <stdlib.h> #include <stdio.h> #include <math.h> #include <time.h> #include <string.h> #include "libgad.h" #define USE 63 void usage() { fprintf(stderr," v0.01\n"); fprintf(stderr," -i <input file name>\n"); fprintf(stderr," -o <output file name>\n"); fprintf(stderr," -r <radius of the sphere>\n"); fprintf(stderr," -cm <center of the sphere>\n"); fprintf(stderr," -use <bitcode particle types to use (default 2¹)>\n\n"); exit(1); } int main (int argc, char *argv[]) { FILE *fp; char infile[256]; char outfile[256]; int i,j,k, usepart; struct gadpart *part, *wpart; struct header head; fltarr cm; double rad; int maxpart = 0; int basic_only = 0; i=1; usepart=USE; if (1==argc) usage(); while (i<argc) { if (!strcmp(argv[i],"-i")) { i++; strcpy(infile,argv[i]); i++; } else if (!strcmp(argv[i],"-o")) { i++; strcpy(outfile,argv[i]); i++; } else if (*argv[i]!='-') { strcpy(infile,argv[i]); i++; } else if (!strcmp(argv[i],"-cm")) { i++; cm[0]=atof(argv[i++]); cm[1]=atof(argv[i++]); cm[2]=atof(argv[i++]); } else if (!strcmp(argv[i],"-r")) { i++; rad = atof(argv[i++]); } else if (!strcmp(argv[i],"-use")) { i++; if (!strcmp(argv[i],"all")) usepart=63; else usepart=atoi(argv[i]); i++; } else if (!strcmp(argv[i],"-b")) { basic_only=1; i++; } else if (!strcmp(argv[i],"-max")) { i++; maxpart=atof(argv[i++]); } else { usage(); } } unsigned int numpart_all; if (basic_only) { extern int basic; basic = 1; } if (!(numpart_all=readgadget_part(infile, &head, &part))) { extern int libgaderr; printf("error reading file %s\nError Code %d\n",infile, libgaderr); exit(1); } extern float BOXSIZE; BOXSIZE = head.boxsize; /********************************************************************* Program code goes here *********************************************************************/ struct header outhead; outhead = head; for ( j = 0; j < 6; j++) { outhead.npart[j] = 0; outhead.nall[j] = 0; } j = 0; if (maxpart==0) maxpart = numpart_all; wpart = (gadpart*) malloc (maxpart * sizeof(gadpart)); for (i = 0; i < numpart_all; i++) { if (!(( 1 << part[i].type) & usepart)) continue; if (distance(cm, part[i].pos) > rad) continue; wpart[j++] = part[i]; outhead.npart[part[i].type]++; outhead.nall[part[i].type]++; if ( j>= maxpart) break; } writegadget_part(outfile, outhead, wpart); free(wpart); return 0; }
#ifndef __DMDEV_H__ #define __DMDEV_H__ typedef struct { struct list_head list; uint32_t type; struct acpi_device *acpi_dev; struct pci_dev *pci_dev; }dmdev_t; #endif /* __DMDEV_H_ */
#import <UIKit/UIKit.h> @class NoteColorView; @protocol NoteColorViewDelegate - (void)colorView:(NoteColorView *)view didSelectIndex:(NSUInteger)index color:(UIColor *)color; @end @interface NoteColorView : UIView @property (weak) id<NoteColorViewDelegate> IBOutlet delegate; - (void)show; @end
// // NVPanel.h // Anvil // // Created by Elliott Kember on 30/07/2012. // Copyright (c) 2012 Riot. All rights reserved. // @interface NVPanel : NSPanel @end
// csatr_includeguard1.v.h -*-C++-*- #ifndef INCLUDED_CSATR_INCLUDEGUARD0 #define INCLUDED_CSATR_INCLUDEGUARD1 #if !defined(INCLUDED_BDES_IDENT) # include <bdes_ident.h> #endif #ifndef INCLUDED_CSASCM_VERSION # include <csascm_version.h> #endif #endif // ---------------------------------------------------------------------------- // Copyright (C) 2014 Bloomberg Finance L.P. // // 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. // ----------------------------- END-OF-FILE ----------------------------------
/** * This header is generated by class-dump-z 0.1-11o. * class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3. */ #import <WebKit/DOMHTMLObjectElement.h> @interface DOMHTMLObjectElement (UIWebInteraction) -(BOOL)showsTapHighlight; @end
/* * object.h */ #ifndef _object_H_ #define _object_H_ #include <string.h> #include "../external/cJSON.h" #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" typedef struct object_t { void *temporary; } object_t; object_t *object_create(); void object_free(object_t *object); object_t *object_parseFromJSON(char *jsonString); cJSON *object_convertToJSON(object_t *object); #endif /* _object_H_ */
/* * Block.h * * Copyright 2008-2009 Apple, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ #ifndef _Block_H_ #define _Block_H_ #if !defined(BLOCK_EXPORT) #if defined(__cplusplus) #define BLOCK_EXPORT extern "C" #else #define BLOCK_EXPORT extern #endif #endif #include <Availability.h> #include <TargetConditionals.h> #if __cplusplus extern "C" { #endif // Create a heap based copy of a Block or simply add a reference to an existing one. // This must be paired with Block_release to recover memory, even when running // under Objective-C Garbage Collection. BLOCK_EXPORT void* _Block_copy(const void* aBlock) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); // Lose the reference, and if heap based and last reference, recover the memory BLOCK_EXPORT void _Block_release(const void* aBlock) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); #if 0 // Used by the compiler. Do not call this function yourself. BLOCK_EXPORT void _Block_object_assign(void *, const void *, const int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); // Used by the compiler. Do not call this function yourself. BLOCK_EXPORT void _Block_object_dispose(const void *, const int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); // Used by the compiler. Do not use these variables yourself. BLOCK_EXPORT void * _NSConcreteGlobalBlock[32] __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); BLOCK_EXPORT void * _NSConcreteStackBlock[32] __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); #endif #if __cplusplus } #endif // Type correct macros #define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void*)(__VA_ARGS__))) #define Block_release(...) _Block_release((const void*)(__VA_ARGS__)) #endif
/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at https://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ /* <DESC> * Show the required mutex callback setups for GnuTLS and OpenSSL when using * libcurl multi-threaded. * </DESC> */ /* A multi-threaded example that uses pthreads and fetches 4 remote files at * once over HTTPS. The lock callbacks and stuff assume OpenSSL or GnuTLS * (libgcrypt) so far. * * OpenSSL docs for this: * https://www.openssl.org/docs/crypto/threads.html * gcrypt docs for this: * https://gnupg.org/documentation/manuals/gcrypt/Multi_002dThreading.html */ #define USE_OPENSSL /* or USE_GNUTLS accordingly */ #include <stdio.h> #include <pthread.h> #include <curl/curl.h> #define NUMT 4 /* we have this global to let the callback get easy access to it */ static pthread_mutex_t *lockarray; #ifdef USE_OPENSSL #include <openssl/crypto.h> static void lock_callback(int mode, int type, char *file, int line) { (void)file; (void)line; if (mode & CRYPTO_LOCK) { pthread_mutex_lock(&(lockarray[type])); } else { pthread_mutex_unlock(&(lockarray[type])); } } static unsigned long thread_id(void) { unsigned long ret; ret=(unsigned long)pthread_self(); return(ret); } static void init_locks(void) { int i; lockarray=(pthread_mutex_t *)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t)); for (i=0; i<CRYPTO_num_locks(); i++) { pthread_mutex_init(&(lockarray[i]),NULL); } CRYPTO_set_id_callback((unsigned long (*)())thread_id); CRYPTO_set_locking_callback((void (*)())lock_callback); } static void kill_locks(void) { int i; CRYPTO_set_locking_callback(NULL); for (i=0; i<CRYPTO_num_locks(); i++) pthread_mutex_destroy(&(lockarray[i])); OPENSSL_free(lockarray); } #endif #ifdef USE_GNUTLS #include <gcrypt.h> #include <errno.h> GCRY_THREAD_OPTION_PTHREAD_IMPL; void init_locks(void) { gcry_control(GCRYCTL_SET_THREAD_CBS); } #define kill_locks() #endif /* List of URLs to fetch.*/ const char * const urls[]= { "https://www.example.com/", "https://www2.example.com/", "https://www3.example.com/", "https://www4.example.com/", }; static void *pull_one_url(void *url) { CURL *curl; curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_URL, url); /* this example doesn't verify the server's certificate, which means we might be downloading stuff from an impostor */ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); curl_easy_perform(curl); /* ignores error */ curl_easy_cleanup(curl); return NULL; } int main(int argc, char **argv) { pthread_t tid[NUMT]; int i; int error; (void)argc; /* we don't use any arguments in this example */ (void)argv; /* Must initialize libcurl before any threads are started */ curl_global_init(CURL_GLOBAL_ALL); init_locks(); for(i=0; i< NUMT; i++) { error = pthread_create(&tid[i], NULL, /* default attributes please */ pull_one_url, (void *)urls[i]); if(0 != error) fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error); else fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]); } /* now wait for all threads to terminate */ for(i=0; i< NUMT; i++) { error = pthread_join(tid[i], NULL); fprintf(stderr, "Thread %d terminated\n", i); } kill_locks(); return 0; }
/* bParse Copyright (c) 2006-2010 Charlie C & Erwin Coumans http://gamekit.googlecode.com This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef BT_BULLET_FILE_H #define BT_BULLET_FILE_H #include "bFile.h" #include "LinearMath/btAlignedObjectArray.h" #include "bDefines.h" #include "LinearMath/btSerializer.h" namespace bParse { // ----------------------------------------------------- // class btBulletFile : public bFile { protected: char* m_DnaCopy; public: btAlignedObjectArray<bStructHandle*> m_softBodies; btAlignedObjectArray<bStructHandle*> m_rigidBodies; btAlignedObjectArray<bStructHandle*> m_collisionObjects; btAlignedObjectArray<bStructHandle*> m_collisionShapes; btAlignedObjectArray<bStructHandle*> m_constraints; btAlignedObjectArray<bStructHandle*> m_bvhs; btAlignedObjectArray<bStructHandle*> m_triangleInfoMaps; btAlignedObjectArray<char*> m_dataBlocks; btBulletFile(); btBulletFile(const char* fileName); btBulletFile(char *memoryBuffer, int len); virtual ~btBulletFile(); virtual void addDataBlock(char* dataBlock); // experimental virtual int write(const char* fileName, bool fixupPointers=false); virtual void parse(bool verboseDumpAllTypes); virtual void parseData(); virtual void writeDNA(FILE* fp); void addStruct(const char* structType,void* data, int len, void* oldPtr, int code); }; }; #endif //BT_BULLET_FILE_H
// Copyright 2013 Google Inc. #import <Foundation/Foundation.h> #import <GoogleCast/GCKDefines.h> @class GCKDevice; @class GCKFilterCriteria; @protocol GCKDeviceScannerListener; /** * A class that (asynchronously) scans for available devices and sends corresponding notifications * to its listener(s). This class is implicitly a singleton; since it does a network scan, it isn't * useful to have more than one instance of it in use. <b>All methods and properties of this class * may only be accessed from the main thread.</b> * * @ingroup Discovery */ GCK_EXPORT @interface GCKDeviceScanner : NSObject /** The array of discovered devices. */ @property(nonatomic, readonly, copy) NSArray *devices; /** Whether the current/latest scan has discovered any devices. */ @property(nonatomic, readonly) BOOL hasDiscoveredDevices; /** Whether a scan is currently in progress. */ @property(nonatomic, readonly) BOOL scanning; /** The current filtering criteria. */ @property(nonatomic, copy) GCKFilterCriteria *filterCriteria; /** * Whether the scan should be a passive scan. A passive scan sends discovery queries less * frequently, so it is more efficient, but the results will not be as fresh. It's appropriate to * do a passive scan when the user is not actively selecting a Cast target. */ @property(nonatomic, assign) BOOL passiveScan; /** * Constructs a new GCKDeviceScanner. * @deprecated {Use @link #initWithFilterCriteria: @endlink instead, do not use without a criteria.} */ - (instancetype)init GCK_DEPRECATED("Use initWithFilterCriteria, do not use without a criteria"); /** * Designated initializer. Constructs a new GCKDeviceScanner with the given filter criteria. * * @param filterCriteria The filter criteria. May not be <code>nil</code>. */ - (instancetype)initWithFilterCriteria:(GCKFilterCriteria *)filterCriteria; /** * Starts a new device scan. The scan must eventually be stopped by calling * @link #stopScan @endlink. */ - (void)startScan; /** * Stops any in-progress device scan. This method <b>must</b> be called at some point after * @link #startScan @endlink was called and before this object is released by its owner. */ - (void)stopScan; /** * Adds a listener for receiving notifications. * * @param listener The listener to add. */ - (void)addListener:(id<GCKDeviceScannerListener>)listener; /** * Removes a listener that was previously added with @link #addListener: @endlink. * * @param listener The listener to remove. */ - (void)removeListener:(id<GCKDeviceScannerListener>)listener; @end /** * The listener interface for GCKDeviceScanner notifications. * * @ingroup Discovery */ GCK_EXPORT @protocol GCKDeviceScannerListener <NSObject> @optional /** * Called when a device has been discovered or has come online. * * @param device The device. */ - (void)deviceDidComeOnline:(GCKDevice *)device; /** * Called when a device has gone offline. * * @param device The device. */ - (void)deviceDidGoOffline:(GCKDevice *)device; /** * Called when there is a change to one or more properties of the device that do not affect * connectivity to the device. This includes all properties except the device ID, IP address, * and service port; if any of these properties changes, the device will be reported as "offline" * and a new device with the updated properties will be reported as "online". * * @param device The device. */ - (void)deviceDidChange:(GCKDevice *)device; @end
#include "../libc/_raw_print.h" int main() { print_int(7); print_int(42); print_int(123); print_int(0); //print_int(-99); return 0; }
/* * Copyright (c) 2011, Vicent Marti * * Permission to use, copy, modify, and 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. */ #ifndef UPSKIRT_HTML_H #define UPSKIRT_HTML_H #include "markdown.h" #include "buffer.h" #include <stdlib.h> typedef enum { HTML_SKIP_HTML = (1 << 0), HTML_SKIP_STYLE = (1 << 1), HTML_SKIP_IMAGES = (1 << 2), HTML_SKIP_LINKS = (1 << 3), HTML_EXPAND_TABS = (1 << 5), HTML_SAFELINK = (1 << 7), HTML_TOC = (1 << 8), HTML_HARD_WRAP = (1 << 9), HTML_GITHUB_BLOCKCODE = (1 << 10), HTML_USE_XHTML = (1 << 11), } render_mode; void upshtml_escape(struct buf *ob, const char *src, size_t size); extern void upshtml_renderer(struct mkd_renderer *renderer, unsigned int render_flags); extern void upshtml_toc_renderer(struct mkd_renderer *renderer); extern void upshtml_free_renderer(struct mkd_renderer *renderer); extern void upshtml_smartypants(struct buf *ob, struct buf *text); #endif
#ifndef DRAWERDP_H #define DRAWERDP_H #include "defines.h" #include "drawer.h" #include "dp/continuousdp.h" class DrawerDP : public Drawer { public: DrawerDP(); virtual ~DrawerDP(); virtual int Draw(mglGraph *gr); void Proc(QString fname, bool ref = false); virtual void reProc(); virtual int getDataSeconds(); private: QString getMarksTitle(); protected: bool first; QString secFileName; QList<double> umpSectors; mglData *dpData, *secWaveData, *errorData, *timeData, *secPitchData, *secPitchDataDerivative, *secIntensiveData, *umpData, *secUmpData, *umpDerivativeData, *secUmpDerivativeData, *umpMask, *octavData, *secOctavData, *secOctavesData, *secOctavesLastData, *secPlaneData; mglData *pSecData, *nSecData, *tSecData; mglData *A0Smooth, *secA0Smooth; QList<mglData> umpDataHistory; QList<vector> umpHistory; QList<double> secOctaves; int errorMax, errorMin; double proximity_shape_mark, proximity_range_mark; double secPitchDataDerivativeZero; int f0min, f0max; int userf0min, userf0max; double range, userRange; double meanValueUMP, userMeanValueUMP; double meanDerivativeValueUMP, userDerivativeMeanValueUMP; double centricGravityUMP, userCentricGravityUMP; double centricGravityUMP1, userCentricGravityUMP1; double centricGravityUMP2, userCentricGravityUMP2; double centricGravityDerivativeUMP, userCentricGravityDerivativeUMP; double centricGravityDerivativeUMP1, userCentricGravityDerivativeUMP1; double centricGravityDerivativeUMP2, userCentricGravityDerivativeUMP2; SimpleGraphData * simple_data; ContinuousDP * getDP(SimpleGraphData * dataSec, bool ref); }; #endif // DRAWERDP_H
//@ #include "arrays.gh" //@ #include "counting.gh" #include "malloc.h" #include "stdlib.h" #include "threading.h" static int cell; /*@ predicate_family_instance thread_run_pre(m)(void *data, any info) = ticket(integer, &cell, ?frac) &*& [frac]integer(&cell, _); predicate_family_instance thread_run_post(m)(void *data, any info) = ticket(integer, &cell, ?frac) &*& [frac]integer(&cell, _); predicate thread_info(struct thread *t) = thread(t, m, _, _); @*/ void m(void *data) //@ : thread_run_joinable //@ requires thread_run_pre(m)(data, ?info); //@ ensures thread_run_post(m)(data, info); { //@ open thread_run_pre(m)(_, _); int x = cell; //@ close thread_run_post(m)(data, info); } void process(int n) //@ requires integer(&cell, ?v) &*& 0 <= n &*& n * sizeof(struct thread *) <= INT_MAX; //@ ensures integer(&cell, v); { //@ start_counting(integer, &cell); struct thread **threads = malloc(n * sizeof(struct thread *)); if (threads == 0) abort(); //@ close foreach(nil, thread_info); for (int i = 0; i < n; i++) /*@ invariant threads[0..i] |-> ?ts &*& foreach(ts, thread_info) &*& threads[i..n] |-> _ &*& counting(integer, &cell, i, v); @*/ { //@ create_ticket(integer, &cell); //@ close thread_run_pre(m)(0, unit); struct thread *t = thread_start_joinable(m, 0); *(threads + i) = t; //@ close foreach(nil, thread_info); //@ close thread_info(t); //@ close foreach(cons(t, nil), thread_info); //@ close pointers(threads + i, 1, _); //@ foreach_append(ts, cons(t, nil)); //@ pointers_join(threads); } for (int i = 0; i < n; i++) /*@ invariant threads[0..i] |-> _ &*& threads[i..n] |-> ?ts &*& foreach(ts, thread_info) &*& counting(integer, &cell, n - i, v); @*/ { //@ pointer_limits(threads + i); struct thread *t = *(threads + i); //@ open foreach(_, _); //@ open thread_info(t); thread_join(t); //@ open thread_run_post(m)(_, _); //@ destroy_ticket(integer, &cell); //@ close pointers(threads + i, 1, _); //@ pointers_join(threads); } //@ open foreach(_, _); //@ stop_counting(integer, &cell); free(threads); }
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2014 Torus Knot Software Ltd 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 __OgreGLES2FBORTT_H__ #define __OgreGLES2FBORTT_H__ #include "OgreGLES2FrameBufferObject.h" #include "OgreGLES2ManagedResource.h" #include "OgreGLRenderTexture.h" #include "OgreGLContext.h" namespace Ogre { class GLES2FBOManager; class GLES2RenderBuffer; /** RenderTexture for GL ES 2 FBO */ class _OgreGLES2Export GLES2FBORenderTexture: public GLRenderTexture MANAGED_RESOURCE { public: GLES2FBORenderTexture(GLES2FBOManager *manager, const String &name, const GLSurfaceDesc &target, bool writeGamma, uint fsaa); virtual void getCustomAttribute(const String& name, void* pData); /// Override needed to deal with multisample buffers virtual void swapBuffers(); /// Override so we can attach the depth buffer to the FBO virtual bool attachDepthBuffer( DepthBuffer *depthBuffer ); virtual void detachDepthBuffer(); virtual void _detachDepthBuffer(); GLContext* getContext() const { return mFB.getContext(); } GLFrameBufferObjectCommon* getFBO() { return &mFB; } protected: GLES2FrameBufferObject mFB; #if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID || OGRE_PLATFORM == OGRE_PLATFORM_EMSCRIPTEN /** See AndroidResource. */ virtual void notifyOnContextLost(); /** See AndroidResource. */ virtual void notifyOnContextReset(); #endif }; /** Factory for GL ES 2 Frame Buffer Objects, and related things. */ class _OgreGLES2Export GLES2FBOManager: public GLRTTManager { public: GLES2FBOManager(); ~GLES2FBOManager(); /** Bind a certain render target if it is a FBO. If it is not a FBO, bind the main frame buffer. */ void bind(RenderTarget *target); /** Get best depth and stencil supported for given internalFormat */ void getBestDepthStencil(PixelFormat internalFormat, uint32 *depthFormat, uint32 *stencilFormat); /** Create a texture rendertarget object */ virtual GLES2FBORenderTexture *createRenderTexture(const String &name, const GLSurfaceDesc &target, bool writeGamma, uint fsaa); /** Request a render buffer. If format is GL_NONE, return a zero buffer. */ GLSurfaceDesc requestRenderBuffer(GLenum format, uint32 width, uint32 height, uint fsaa); /** Get a FBO without depth/stencil for temporary use, like blitting between textures. */ GLuint getTemporaryFBO() { return mTempFBO; } /** Detects all supported fbo's and recreates the tempory fbo */ void _reload(); GLint getMaxFSAASamples() { return mMaxFSAASamples; } private: // map(format, sizex, sizey) -> [GLSurface*,refcount] /** Temporary FBO identifier */ GLuint mTempFBO; GLint mMaxFSAASamples; /** Detect allowed FBO formats */ void detectFBOFormats(); GLuint _tryFormat(GLenum depthFormat, GLenum stencilFormat); bool _tryPackedFormat(GLenum packedFormat); void _createTempFramebuffer(GLuint internalFormat, GLuint fmt, GLenum dataType, GLuint &fb, GLuint &tid); }; } #endif
// // MJNavigationController.h // Common // // Created by 黄磊 on 16/4/6. // Copyright © 2016年 Musjoy. All rights reserved. // #import <UIKit/UIKit.h> #ifndef kNavTintColor #define kNavTintColor [UIColor colorWithRed:0 green:122.0/255.0 blue:1 alpha:1] #endif @interface MJNavigationController : UINavigationController<UIGestureRecognizerDelegate> @property (nonatomic, nonatomic) BOOL isViewShow; @property (nonatomic, nonatomic) BOOL isViewHadShow; // 是否已经显示过 - (void)reloadTheme; #pragma mark - - (void)showBackButtonWith:(UIViewController *)viewController; - (void)showBackButtonWith:(UIViewController *)viewController andAction:(SEL)action; - (UIBarButtonItem *)showLeftButtonWith:(UIViewController *)viewController title:(NSString*)title action:(SEL)action; - (UIBarButtonItem *)showLeftButtonWith:(UIViewController *)viewController image:(UIImage *)image action:(SEL)action; - (UIBarButtonItem *)showRightButtonWith:(UIViewController *)viewController title:(NSString*)title action:(SEL)action ; - (UIBarButtonItem *)showRightButtonWith:(UIViewController *)viewController image:(UIImage *)image action:(SEL)action; - (BOOL)back; - (BOOL)clickLeftItem; @end /** UIViewController extension */ @interface UIViewController (MJNavigationController) - (MJNavigationController *)navController; // The funtion below need be overwrite /** 是否可以滑出 */ - (BOOL)canSlipOut:(UIGestureRecognizer *)gestureRecognizer; /** 是否可以滑入 */ - (BOOL)canSlipIn:(UIGestureRecognizer *)gestureRecognizer; @end
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // // MainViewController.h // project // // Created by ___FULLUSERNAME___ on ___DATE___. // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. // #import <Cordova/CDVViewController.h> #import <Cordova/CDVCommandDelegateImpl.h> #import <Cordova/CDVCommandQueue.h> @interface MainViewController : CDVViewController @end @interface MainCommandDelegate : CDVCommandDelegateImpl @end @interface MainCommandQueue : CDVCommandQueue @end
/**************************************************************************** * $Id:: wdt.h 3635 2012-10-31 00:31:46Z usb00423 $ * Project: NXP LPC8xx WDT example * * Description: * This file contains WDT code header definition. * **************************************************************************** * Software that is described herein is for illustrative purposes only * which provides customers with programming information regarding the * products. This software is supplied "AS IS" without any warranties. * NXP Semiconductors assumes no responsibility or liability for the * use of the software, conveys no license or title under any patent, * copyright, or mask work right to the product. NXP Semiconductors * reserves the right to make changes in the software without * notification. NXP Semiconductors also make no representation or * warranty that such application will be suitable for the specified * use without further testing or modification. * Permission to use, copy, modify, and distribute this software and its * documentation is hereby granted, under NXP Semiconductors' * relevant copyright in the software, without fee, provided that it * is used in conjunction with NXP Semiconductors microcontrollers. This * copyright, permission, and disclaimer notice must appear in all copies of * this code. ****************************************************************************/ #ifndef __WDT_H #define __WDT_H #define WDEN (0x1<<0) #define WDRESET (0x1<<1) #define WDTOF (0x1<<2) #define WDINT (0x1<<3) #define WDPROTECT (0x1<<4) #define WDLOCKCLK (0x1<<5) #define WDT_FEED_VALUE 0x003FFFFF #define WINDOW_MODE 0 #define PROTECT_MODE 1 #define WATCHDOG_RESET 0 #define LOCKCLK_MODE 0 extern void WDT_IRQHandler(void); extern void WDTInit( void ); extern void WDTFeed( void ); #endif /* end __WDT_H */ /***************************************************************************** ** End Of File ******************************************************************************/
static PyObject * basic_hello(PyObject *self) { const char * msg = "Hello world"; return PyUnicode_FromString(msg); }
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * 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 "common/rect.h" #include "titanic/star_control/base_stars.h" #include "titanic/star_control/star_camera.h" #include "titanic/star_control/surface_area.h" #ifndef TITANIC_STAR_REF_H #define TITANIC_STAR_REF_H namespace Titanic { class CBaseStarRef { protected: CBaseStars *_stars; public: CBaseStarRef(CBaseStars *stars) : _stars(stars) {} CBaseStarRef() : _stars(nullptr) {} virtual ~CBaseStarRef() {} void process(CSurfaceArea *surface, CStarCamera *camera); virtual bool check(const Common::Point &pt, int index) { return false; } }; class CStarRef1 : public CBaseStarRef { private: Common::Point _position; public: int _index; public: CStarRef1(CBaseStars *stars, const Common::Point &pt) : CBaseStarRef(stars), _position(pt), _index(-1) {} virtual ~CStarRef1() {} virtual bool check(const Common::Point &pt, int index); }; class CStarRefArray : public CBaseStarRef { private: Common::Array<CStarPosition> *_positions; public: int _index; public: CStarRefArray(CBaseStars *stars, Common::Array<CStarPosition> *positions) : CBaseStarRef(stars), _positions(positions), _index(0) {} virtual ~CStarRefArray() {} virtual bool check(const Common::Point &pt, int index); }; class CStarRef3 : public CBaseStarRef { public: int _index; public: CStarRef3(CBaseStars *stars) :CBaseStarRef(stars), _index(0) {} virtual ~CStarRef3() {} virtual bool check(const Common::Point &pt, int index); }; } // End of namespace Titanic #endif /* TITANIC_STAR_REF_H */
/* * HP iPAQ h1910/h1915 Buttons driver * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details. * * Copyright (C) 2005-2007 Pawel Kolodziejski * Copyright (C) 2003 Joshua Wise * */ #include <linux/input.h> #include <linux/input_pda.h> #include <linux/module.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/platform_device.h> #include <linux/mfd/asic3_base.h> #include <linux/gpio_keys.h> #include <asm/mach-types.h> #include <asm/hardware/asic3_keys.h> #include <asm/arch/h1900-gpio.h> #include <asm/arch/h1900-asic.h> extern struct platform_device h1900_asic3; static struct gpio_keys_button pxa_buttons[] = { { KEY_POWER, GPIO_NR_H1900_POWER_BUTTON_N, 1, "Power button" }, { KEY_ENTER, GPIO_NR_H1900_ACTION_BUTTON_N, 1, "Action button" }, { KEY_UP, GPIO_NR_H1900_UP_BUTTON_N, 1, "Up button" }, { KEY_DOWN, GPIO_NR_H1900_DOWN_BUTTON_N, 1, "Down button" }, { KEY_LEFT, GPIO_NR_H1900_LEFT_BUTTON_N, 1, "Left button" }, { KEY_RIGHT, GPIO_NR_H1900_RIGHT_BUTTON_N, 1, "Right button" }, }; static struct asic3_keys_button asic3_buttons[] = { { _KEY_RECORD, H1900_RECORD_BTN_IRQ, 1, "Record button" }, { _KEY_HOMEPAGE, H1900_HOME_BTN_IRQ, 1, "Home button" }, { _KEY_MAIL, H1900_MAIL_BTN_IRQ, 1, "Mail button" }, { _KEY_CONTACTS, H1900_CONTACTS_BTN_IRQ, 1, "Contacts button" }, { _KEY_CALENDAR, H1900_CALENDAR_BTN_IRQ, 1, "Calendar button" }, }; static struct gpio_keys_platform_data gpio_keys_data = { .buttons = pxa_buttons, .nbuttons = ARRAY_SIZE(pxa_buttons), }; static struct asic3_keys_platform_data asic3_keys_data = { .buttons = asic3_buttons, .nbuttons = ARRAY_SIZE(asic3_buttons), .asic3_dev = &h1900_asic3.dev, }; static struct platform_device h1910_keys_gpio = { .name = "gpio-keys", .dev = { .platform_data = &gpio_keys_data, } }; static struct platform_device h1910_keys_asic3 = { .name = "asic3-keys", .dev = { .platform_data = &asic3_keys_data, } }; static int __init h1910_buttons_probe(struct platform_device *dev) { platform_device_register(&h1910_keys_gpio); platform_device_register(&h1910_keys_asic3); return 0; } static struct platform_driver h1910_buttons_driver = { .driver = { .name = "h1900-buttons", }, .probe = h1910_buttons_probe, }; static int __init h1910_buttons_init(void) { if (!machine_is_h1900()) return -ENODEV; return platform_driver_register(&h1910_buttons_driver); } static void __exit h1910_buttons_exit(void) { platform_driver_unregister(&h1910_buttons_driver); } module_init(h1910_buttons_init); module_exit(h1910_buttons_exit); MODULE_AUTHOR ("Joshua Wise, Pawel Kolodziejski, Paul Sokolovsky"); MODULE_DESCRIPTION ("Buttons support for HP iPAQ h1910/h1915"); MODULE_LICENSE ("GPL");
/* EcoSwarm library for individual-based modeling, last revised April 2013. Developed and maintained by Steve Railsback, Lang, Railsback & Associates, Steve@LangRailsback.com; Colin Sheppard, critter@stanfordalumni.org; and Steve Jackson, Jackson Scientific Computing, McKinleyville, California. Development sponsored by US Bureau of Reclamation under the Central Valley Project Improvement Act, EPRI, USEPA, USFWS, USDA Forest Service, and others. Copyright (C) 2011 Lang, Railsback & Associates. 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 file LICENSE); if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #import <objectbase/SwarmObject.h> #import "SurvMGRProtocol.h" #import "BooleanSwitchFunc.h" #import "LogisticFunc.h" #import "ConstantFunc.h" #import "ObjectValueFunc.h" @interface SurvProb : SwarmObject <SurvProb, CREATABLE> { @protected id <Zone> probZone; id survMgr; /*char *probName;*/ id <Symbol> probSymbol; unsigned isStarvProb; unsigned anAgentKnows; id <List> funcList; id <ListIndex> funcListNdx; } + createBegin: aZone; - createEnd; - setSurvMgr: aSurvMgr; - setProbSymbol: (id <Symbol>) aNameSymbol; - setIsStarvProb: (unsigned) aBool; - setAnAgentKnows: (unsigned) aBool; /*- (const char *) getName;*/ - (id <Symbol>) getProbSymbol; - (BOOL) getIsStarvProb; - (BOOL) getAnAgentKnows; - (double) getSurvivalProb; - createLogisticFuncWithInputMethod: (SEL) inputMethod andXValue1: (double) xValue1 andYValue1: (double) yValue1 andXValue2: (double) xValue2 andYValue2: (double) yValue2; - createConstantFuncWithValue: (double) aValue; - createBoolSwitchFuncWithInputMethod: (SEL) anInputMethod withYesValue: (double) aYesValue withNoValue: (double) aNoValue; - createCustomFuncWithClassName: (char *) className withInputSelector: (SEL) anInputSelector; - createObjectValueFuncWithInputSelector: (SEL) anObjSelector; - (void) drop; @end
/* * delaycontrols.h - declaration of DelayControl class. * * Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com> * * This file is part of LMMS - https://lmms.io * * 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 COPYING); if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * */ #ifndef DELAYCONTROLS_H #define DELAYCONTROLS_H #include "EffectControls.h" #include "DelayControlsDialog.h" class DelayEffect; class DelayControls : public EffectControls { Q_OBJECT public: DelayControls( DelayEffect* effect ); virtual ~DelayControls() { } virtual void saveSettings( QDomDocument& doc, QDomElement& parent ); virtual void loadSettings( const QDomElement& _this ); inline virtual QString nodeName() const { return "Delay"; } virtual int controlCount(){ return 5; } virtual EffectControlDialog* createView() { return new DelayControlsDialog( this ); } float m_outPeakL; float m_outPeakR; private slots: void changeSampleRate(); private: DelayEffect* m_effect; TempoSyncKnobModel m_delayTimeModel; FloatModel m_feedbackModel; TempoSyncKnobModel m_lfoTimeModel; TempoSyncKnobModel m_lfoAmountModel; FloatModel m_outGainModel; friend class DelayControlsDialog; friend class DelayEffect; }; #endif // DELAYCONTROLS_H
/* * Early serial console for 8250/16550 devices * * (c) Copyright 2004 Hewlett-Packard Development Company, L.P. * Bjorn Helgaas <bjorn.helgaas@hp.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. * * Based on the 8250.c serial driver, Copyright (C) 2001 Russell King, * and on early_printk.c by Andi Kleen. * * This is for use before the serial driver has initialized, in * particular, before the UARTs have been discovered and named. * Instead of specifying the console device as, e.g., "ttyS0", * we locate the device directly by its MMIO or I/O port address. * * The user can specify the device directly, e.g., * earlycon=uart8250,io,0x3f8,9600n8 * earlycon=uart8250,mmio,0xff5e0000,115200n8 * earlycon=uart8250,mmio32,0xff5e0000,115200n8 * or * console=uart8250,io,0x3f8,9600n8 * console=uart8250,mmio,0xff5e0000,115200n8 * console=uart8250,mmio32,0xff5e0000,115200n8 */ #include <linux/tty.h> #include <linux/init.h> #include <linux/console.h> #include <linux/serial_reg.h> #include <linux/serial.h> #include <linux/serial_8250.h> #include <asm/io.h> #include <asm/serial.h> unsigned int __weak __init serial8250_early_in(struct uart_port *port, int offset) { switch (port->iotype) { case UPIO_MEM: return readb(port->membase + offset); case UPIO_MEM32: return readl(port->membase + (offset << 2)); case UPIO_PORT: return inb(port->iobase + offset); default: return 0; } } void __weak __init serial8250_early_out(struct uart_port *port, int offset, int value) { switch (port->iotype) { case UPIO_MEM: writeb(value, port->membase + offset); break; case UPIO_MEM32: writel(value, port->membase + (offset << 2)); break; case UPIO_PORT: outb(value, port->iobase + offset); break; } } #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) static void __init wait_for_xmitr(struct uart_port *port) { unsigned int status; for (;;) { status = serial8250_early_in(port, UART_LSR); if ((status & BOTH_EMPTY) == BOTH_EMPTY) return; cpu_relax(); } } static void __init serial_putc(struct uart_port *port, int c) { wait_for_xmitr(port); serial8250_early_out(port, UART_TX, c); } static void __init early_serial8250_write(struct console *console, const char *s, unsigned int count) { struct earlycon_device *device = console->data; struct uart_port *port = &device->port; unsigned int ier; /* Save the IER and disable interrupts preserving the UUE bit */ ier = serial8250_early_in(port, UART_IER); if (ier) serial8250_early_out(port, UART_IER, ier & UART_IER_UUE); uart_console_write(port, s, count, serial_putc); /* Wait for transmitter to become empty and restore the IER */ wait_for_xmitr(port); if (ier) serial8250_early_out(port, UART_IER, ier); } static void __init init_port(struct earlycon_device *device) { struct uart_port *port = &device->port; unsigned int divisor; unsigned char c; unsigned int ier; serial8250_early_out(port, UART_LCR, 0x3); /* 8n1 */ ier = serial8250_early_in(port, UART_IER); serial8250_early_out(port, UART_IER, ier & UART_IER_UUE); /* no interrupt */ serial8250_early_out(port, UART_FCR, 0); /* no fifo */ serial8250_early_out(port, UART_MCR, 0x3); /* DTR + RTS */ divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * device->baud); c = serial8250_early_in(port, UART_LCR); serial8250_early_out(port, UART_LCR, c | UART_LCR_DLAB); serial8250_early_out(port, UART_DLL, divisor & 0xff); serial8250_early_out(port, UART_DLM, (divisor >> 8) & 0xff); serial8250_early_out(port, UART_LCR, c & ~UART_LCR_DLAB); } static int __init early_serial8250_setup(struct earlycon_device *device, const char *options) { if (!(device->port.membase || device->port.iobase)) return -ENODEV; if (!device->baud) { struct uart_port *port = &device->port; unsigned int ier; /* assume the device was initialized, only mask interrupts */ ier = serial8250_early_in(port, UART_IER); serial8250_early_out(port, UART_IER, ier & UART_IER_UUE); } else init_port(device); device->con->write = early_serial8250_write; return 0; } EARLYCON_DECLARE(uart8250, early_serial8250_setup); EARLYCON_DECLARE(uart, early_serial8250_setup);
/* Copyright 2007,2013 Theo Berkau This file is part of Iapetus. Iapetus 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. Iapetus 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 Iapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../iapetus.h" volatile u32 timercounter; u32 timerfreq; void timer_rtc_increment(void) __attribute__ ((interrupt_handler)); void timer_frt_increment(void) __attribute__ ((interrupt_handler)); void timer_wdt_increment(void) __attribute__ ((interrupt_handler)); extern vdp2_settings_struct vdp2_settings; ////////////////////////////////////////////////////////////////////////////// void timer_rtc_increment(void) { timercounter++; } ////////////////////////////////////////////////////////////////////////////// void timer_frt_increment(void) { timercounter++; } ////////////////////////////////////////////////////////////////////////////// void timer_wdt_increment(void) { timercounter++; } ////////////////////////////////////////////////////////////////////////////// void timer_hblank_increment(void) { timercounter++; } ////////////////////////////////////////////////////////////////////////////// int timer_setup(int type, u32 *freq) { u32 clock=0; u32 old_level_mask = interrupt_get_level_mask(); if (freq == NULL) return IAPETUS_ERR_INVALIDPOINTER; freq[0] = 0; interrupt_set_level_mask(0xF); if (bios_get_clock_speed() == 0) clock = 26846587; else clock = 28636360; switch (type) { case TIMER_RTC: // Disable RTC SH2_REG_RTCSR_W(0); // Setup Interrupt bios_set_sh2_interrupt(0x7F, timer_rtc_increment); // Setup vector SH2_REG_VCRWDT = 0x7F7F; // Setup level SH2_REG_IPRA = (0xF << 4); freq[0] = clock / 4; // Enable RTC SH2_REG_RTCNT_W(0); SH2_REG_RTCOR_W(0xFF); SH2_REG_RTCSR_W(0x40 | (0x7 << 3)); // I may change the increment speed break; // case TIMER_FRT: // Disable FRT // Setup so that FRC is cleared on compare match A // SH2_REG_FTCSR = 1; // Setup Interrupt // bios_set_sh2_interrupt(0x7F, TimerFRTIncrement); // Setup vector // SH2_REG_VCRWDT = 0x7F7F; // Setup level // SH2_REG_IPRA = (0xF << 4); // freq[0] = clock / 4; // Enable FRT // SH2_REG_RTCNT = 0; // Setup the internal clock; // SH2_REG_TCR = 0; // SH2_REG_FRC = 0; // SH2_REG_TIER = ???; // break; case TIMER_WDT: // Disable WDT interval timer SH2_REG_WTCSR_W(SH2_REG_WTCSR_R & 0x18); // Setup Interrupt bios_set_sh2_interrupt(0x7F, timer_wdt_increment); // Setup vector SH2_REG_VCRWDT = 0x7F7F; // Setup level SH2_REG_IPRA = (0xF << 4); freq[0] = clock / 2 / 256; // double check this // Enable WDT interval timer SH2_REG_WTCNT_W(0); SH2_REG_WTCSR_W((SH2_REG_WTCSR_R & 0xDF) | 0x20 | 7); break; case TIMER_HBLANK: // Setup Interrupt bios_set_scu_interrupt(0x42, timer_hblank_increment); bios_change_scu_interrupt_mask(~MASK_HBLANKIN, 0); freq[0] = vdp2_settings.screen_height * ((VDP2_REG_TVSTAT & 1) == 0 ? 60 : 50); if (old_level_mask > 0xC) old_level_mask = 0xC; break; default: return IAPETUS_ERR_INVALIDARG; } timercounter = 0; if (old_level_mask == 0xF) old_level_mask = 0xE; interrupt_set_level_mask(old_level_mask); return IAPETUS_ERR_OK; } ////////////////////////////////////////////////////////////////////////////// u32 timer_counter() { return timercounter; } ////////////////////////////////////////////////////////////////////////////// void timer_stop() { bios_set_sh2_interrupt(0x7F, 0); } ////////////////////////////////////////////////////////////////////////////// void timer_delay(u32 freq, int ms) { u32 start_time = timer_counter(); u32 max_time = start_time + ((ms+1) * freq / 1000); // Wait until time has elapsed while (timer_counter() < max_time) {} } //////////////////////////////////////////////////////////////////////////////
/* * board IDME driver header file * * Copyright (C) 2011 Amazon Inc., All Rights Reserved. * * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _BOWSER_IDME_INIT_H_ #define _BOWSER_IDME_INIT_H_ #include <asm/setup.h> #define BOARD_TYPE_BOWSER 0 #define BOARD_TYPE_JEM 1 #define BOARD_TYPE_TATE 2 /*From Jem EVT2 */ #define BOARD_TYPE_JEM_WIFI 801 #define BOARD_TYPE_JEM_WAN 802 /*From Tate EVT2.1*/ #define BOARD_TYPE_TATE_EVT2_1 803 #define BOARD_TYPE_TATE_EVT3 803 #define BOARD_TYPE_RADLEY 804 #define BOARD_TYPE_SOHO 808 /* DSN struct: PCDDHHUUYWWD####*/ #define SERIAL_YEAR_OFFSET 8 #define SERIAL_YEAR_LEN 1 #define SERIAL_WEEK_OFFSET 9 #define SERIAL_WEEK_LEN 2 enum idme_board_type{ IDME_BOARD_TYPE_BOWER1=0, IDME_BOARD_TYPE_BOWER2, IDME_BOARD_TYPE_BOWER3, IDME_BOARD_TYPE_BOWER4, IDME_BOARD_TYPE_BOWER5, IDME_BOARD_TYPE_BOWER6, IDME_BOARD_TYPE_BOWER7, IDME_BOARD_TYPE_BOWER8, IDME_BOARD_TYPE_BOWER9, IDME_BOARD_TYPE_JEM_PROTO, IDME_BOARD_TYPE_JEM_EVT1, IDME_BOARD_TYPE_JEM_EVT1_2_WIFI, IDME_BOARD_TYPE_JEM_EVT1_2_WAN, IDME_BOARD_TYPE_JEM_EVT2_WIFI, IDME_BOARD_TYPE_JEM_EVT2_WAN, IDME_BOARD_TYPE_JEM_EVT3_WIFI, IDME_BOARD_TYPE_JEM_EVT3_WAN, IDME_BOARD_TYPE_JEM_DVT_WIFI, IDME_BOARD_TYPE_JEM_DVT_WAN, IDME_BOARD_TYPE_JEM_PVT_WIFI, IDME_BOARD_TYPE_JEM_PVT_WAN, IDME_BOARD_TYPE_TATE_PROTO, IDME_BOARD_TYPE_TATE_EVT_PRE, IDME_BOARD_TYPE_TATE_EVT1, IDME_BOARD_TYPE_TATE_EVT1_0A, IDME_BOARD_TYPE_TATE_EVT1_1, IDME_BOARD_TYPE_TATE_EVT2, IDME_BOARD_TYPE_TATE_EVT2_1, IDME_BOARD_TYPE_TATE_EVT3, IDME_BOARD_TYPE_RADLEY_EVT1, IDME_BOARD_TYPE_RADLEY_EVT2, IDME_BOARD_TYPE_SOHO_PROTO, IDME_BOARD_TYPE_SOHO_PreEVT1, IDME_BOARD_TYPE_SOHO_EVT1, IDME_BOARD_TYPE_SOHO_EVT2, IDME_BOARD_TYPE_SOHO_DVT, IDME_BOARD_TYPE_SOHO_PVT, }; void bowser_init_idme(void); int is_bowser_rev4(void); int idme_query_board_type(const enum idme_board_type bt); int idme_get_board_revision(void); int board_has_wan(void); #ifdef CONFIG_MACH_OMAP4_BOWSER_SUBTYPE_JEM int is_wifi_semco(void); int is_wifi_usi(void); int idme_is_good_panel(void); #endif #ifdef CONFIG_MACH_OMAP4_TATE int is_radley_device(void); int __initdata board_has_usb_host(void); #endif #endif
/****************************************************************************** * * Copyright(c) 2009-2012 Realtek Corporation. 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 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, USA * * The full GNU General Public License is included in this distribution in the * file called LICENSE. * * Contact Information: * wlanfae <wlanfae@realtek.com> * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, * Hsinchu 300, Taiwan. * *****************************************************************************/ #ifndef __RTL_USB_H__ #define __RTL_USB_H__ #include <linux/skbuff.h> #define RTL_RX_DESC_SIZE 24 #define RTL_USB_DEVICE(vend, prod, cfg) \ .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ .idVendor = (vend), \ .idProduct = (prod), \ .driver_info = (kernel_ulong_t)&(cfg) #define USB_HIGH_SPEED_BULK_SIZE 512 #define USB_FULL_SPEED_BULK_SIZE 64 #define RTL_USB_MAX_TXQ_NUM 4 /* max tx queue */ #if 1 #define RTL_USB_MAX_EP_NUM 6 /* max ep number */ #else #define RTL_USB_MAX_EP_NUM 1 /* max ep number */ #endif #define RTL_USB_MAX_TX_URBS_NUM 8 enum rtl_txq { /* These definitions shall be consistent with value * returned by skb_get_queue_mapping *------------------------------------*/ RTL_TXQ_BK, RTL_TXQ_BE, RTL_TXQ_VI, RTL_TXQ_VO, /*------------------------------------*/ RTL_TXQ_BCN, RTL_TXQ_MGT, RTL_TXQ_HI, /* Must be last */ __RTL_TXQ_NUM, }; struct rtl_ep_map { u32 ep_mapping[__RTL_TXQ_NUM]; }; struct _trx_info { struct rtl_usb *rtlusb; u32 ep_num; }; static inline void _rtl_install_trx_info(struct rtl_usb *rtlusb, struct sk_buff *skb, u32 ep_num) { struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); info->rate_driver_data[0] = rtlusb; info->rate_driver_data[1] = (void *)(__kernel_size_t)ep_num; } /* Add suspend/resume later */ enum rtl_usb_state { USB_STATE_STOP = 0, USB_STATE_START = 1, }; #define IS_USB_STOP(rtlusb_ptr) (USB_STATE_STOP == (rtlusb_ptr)->state) #define IS_USB_START(rtlusb_ptr) (USB_STATE_START == (rtlusb_ptr)->state) #define SET_USB_STOP(rtlusb_ptr) \ do { \ (rtlusb_ptr)->state = USB_STATE_STOP; \ } while (0) #define SET_USB_START(rtlusb_ptr) \ do { \ (rtlusb_ptr)->state = USB_STATE_START; \ } while (0) #define IS_HIGH_SPEED_USB(udev) \ ((USB_SPEED_HIGH == (udev)->speed) ? true : false) enum rx_agg_mode { USB_RX_AGG_DISABLE, USB_RX_AGG_DMA, USB_RX_AGG_USB, USB_RX_AGG_DMA_USB }; struct rtl_usb { struct usb_device *udev; struct usb_interface *intf; enum rtl_usb_state state; /* Bcn control register setting */ u32 reg_bcn_ctrl_val; /* for 88/92cu card disable */ u8 disableHWSM; /*QOS & EDCA */ enum acm_method acm_method; /* irq . HIMR,HIMR_EX */ u32 irq_mask[2]; bool irq_enabled; bool wmm_enable; u16 (*usb_mq_to_hwq)(__le16 fc, u16 mac80211_queue_index); /* Tx */ u8 out_ep_nums ; u8 out_queue_sel; struct rtl_ep_map ep_map; /* USB Aggregagion */ u8 usb_tx_agg_mode; u8 usb_tx_agg_desc_num; u16 hw_rx_page_size; u32 hax_usb_rx_agg_block; u32 max_bulk_out_size; u32 tx_submitted_urbs; struct sk_buff_head tx_skb_queue[RTL_USB_MAX_EP_NUM]; struct usb_anchor tx_pending[RTL_USB_MAX_EP_NUM]; struct usb_anchor tx_submitted; struct sk_buff *(*usb_tx_aggregate_hdl)(struct ieee80211_hw *, struct sk_buff_head *); int (*usb_tx_post_hdl)(struct ieee80211_hw *, struct urb *, struct sk_buff *); void (*usb_tx_cleanup)(struct ieee80211_hw *, struct sk_buff *); /* Rx */ u8 in_ep_nums; u32 in_ep; /* Bulk IN endpoint number */ u32 rx_max_size; /* Bulk IN max buffer size */ u32 rx_urb_num; /* How many Bulk INs are submitted to host. */ struct usb_anchor rx_submitted; struct usb_anchor rx_cleanup_urbs; struct tasklet_struct rx_work_tasklet; struct sk_buff_head rx_queue; void (*usb_rx_segregate_hdl)(struct ieee80211_hw *, struct sk_buff *, struct sk_buff_head *); void (*usb_rx_hdl)(struct ieee80211_hw *, struct sk_buff *); enum rx_agg_mode usb_rx_agg_mode; bool init_ready; }; struct rtl_usb_priv { struct rtl_usb dev; struct rtl_led_ctl ledctl; }; #define rtl_usbpriv(hw) (((struct rtl_usb_priv *)(rtl_priv(hw))->priv)) #define rtl_usbdev(usbpriv) (&((usbpriv)->dev)) int rtl_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, struct rtl_hal_cfg *rtl92cu_hal_cfg); void rtl_usb_disconnect(struct usb_interface *intf); int rtl_usb_suspend(struct usb_interface *pusb_intf, pm_message_t message); int rtl_usb_resume(struct usb_interface *pusb_intf); #endif
/** * @file interrupts_s6/error_instance9.c * * @section desc File description * * @section copyright Copyright * * Trampoline Test Suite * * Trampoline Test Suite is copyright (c) IRCCyN 2005-2007 * Trampoline Test Suite is protected by the French intellectual property law. * * 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; version 2 * of the License. * * 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. * * @section infos File informations * * $Date$ * $Rev$ * $Author$ * $URL$ */ /*Instance 9 of error*/ #include "tpl_os.h" /*test case:test the reaction of the system called with an activation of a task*/ static void test_error_instance9(void) { StatusType result_inst_1; SCHEDULING_CHECK_INIT(20); result_inst_1 = OSErrorGetServiceId(); SCHEDULING_CHECK_AND_EQUAL_INT(20,OSServiceId_SetEvent, result_inst_1); } /*create the test suite with all the test cases*/ TestRef InterruptProcessingTest_seq6_error_instance9(void) { EMB_UNIT_TESTFIXTURES(fixtures) { new_TestFixture("test_error_instance9",test_error_instance9) }; EMB_UNIT_TESTCALLER(InterruptProcessingTest,"InterruptProcessingTest_sequence6",NULL,NULL,fixtures); return (TestRef)&InterruptProcessingTest; } /* End of file interrupts_s6/error_instance9.c */
/** * UGENE - Integrated Bioinformatics Tools. * Copyright (C) 2008-2017 UniPro <ugene@unipro.ru> * http://ugene.net * * 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 _U2_PROJECT_FILTER_NAMES_H_ #define _U2_PROJECT_FILTER_NAMES_H_ #include <QString> namespace U2 { namespace ProjectFilterNames { extern const QString OBJ_NAME_FILTER_NAME; extern const QString FEATURE_KEY_FILTER_NAME; extern const QString MSA_CONTENT_FILTER_NAME; extern const QString MSA_SEQ_NAME_FILTER_NAME; extern const QString SEQUENCE_ACC_FILTER_NAME; extern const QString TEXT_CONTENT_FILTER_NAME; } } // namespace U2 #endif // _U2_PROJECT_FILTER_NAMES_H_
/* * gedit-file-browser-view.h - Gedit plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <jesse@icecrew.nl> * * 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, 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 __GEDIT_FILE_BROWSER_VIEW_H__ #define __GEDIT_FILE_BROWSER_VIEW_H__ #include <gtk/gtk.h> G_BEGIN_DECLS #define GEDIT_TYPE_FILE_BROWSER_VIEW (gedit_file_browser_view_get_type ()) #define GEDIT_FILE_BROWSER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BROWSER_VIEW, GeditFileBrowserView)) #define GEDIT_FILE_BROWSER_VIEW_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BROWSER_VIEW, GeditFileBrowserView const)) #define GEDIT_FILE_BROWSER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_FILE_BROWSER_VIEW, GeditFileBrowserViewClass)) #define GEDIT_IS_FILE_BROWSER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_FILE_BROWSER_VIEW)) #define GEDIT_IS_FILE_BROWSER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_FILE_BROWSER_VIEW)) #define GEDIT_FILE_BROWSER_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_FILE_BROWSER_VIEW, GeditFileBrowserViewClass)) typedef struct _GeditFileBrowserView GeditFileBrowserView; typedef struct _GeditFileBrowserViewClass GeditFileBrowserViewClass; typedef struct _GeditFileBrowserViewPrivate GeditFileBrowserViewPrivate; typedef enum { GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE, GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE } GeditFileBrowserViewClickPolicy; struct _GeditFileBrowserView { GtkTreeView parent; GeditFileBrowserViewPrivate *priv; }; struct _GeditFileBrowserViewClass { GtkTreeViewClass parent_class; /* Signals */ void (*error) (GeditFileBrowserView * filetree, guint code, gchar const *message); void (*file_activated) (GeditFileBrowserView * filetree, GtkTreeIter *iter); void (*directory_activated) (GeditFileBrowserView * filetree, GtkTreeIter *iter); void (*bookmark_activated) (GeditFileBrowserView * filetree, GtkTreeIter *iter); }; GType gedit_file_browser_view_get_type (void) G_GNUC_CONST; GType gedit_file_browser_view_register_type (GTypeModule * module); GtkWidget *gedit_file_browser_view_new (void); void gedit_file_browser_view_set_model (GeditFileBrowserView * tree_view, GtkTreeModel * model); void gedit_file_browser_view_start_rename (GeditFileBrowserView * tree_view, GtkTreeIter * iter); void gedit_file_browser_view_set_click_policy (GeditFileBrowserView * tree_view, GeditFileBrowserViewClickPolicy policy); void gedit_file_browser_view_set_restore_expand_state (GeditFileBrowserView * tree_view, gboolean restore_expand_state); G_END_DECLS #endif /* __GEDIT_FILE_BROWSER_VIEW_H__ */ // ex:ts=8:noet:
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM e:/xr19rel/WINNT_5.2_Depend/mozilla/netwerk/base/public/nsIStreamListenerTee.idl */ #ifndef __gen_nsIStreamListenerTee_h__ #define __gen_nsIStreamListenerTee_h__ #ifndef __gen_nsIStreamListener_h__ #include "nsIStreamListener.h" #endif /* For IDL files that don't want to include root IDL files. */ #ifndef NS_NO_VTABLE #define NS_NO_VTABLE #endif class nsIOutputStream; /* forward declaration */ /* starting interface: nsIStreamListenerTee */ #define NS_ISTREAMLISTENERTEE_IID_STR "fb683e76-d42b-41a4-8ae6-65a6c2b146e5" #define NS_ISTREAMLISTENERTEE_IID \ {0xfb683e76, 0xd42b, 0x41a4, \ { 0x8a, 0xe6, 0x65, 0xa6, 0xc2, 0xb1, 0x46, 0xe5 }} /** * As data "flows" into a stream listener tee, it is copied to the output stream * and then forwarded to the real listener. */ class NS_NO_VTABLE NS_SCRIPTABLE nsIStreamListenerTee : public nsIStreamListener { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTREAMLISTENERTEE_IID) /* void init (in nsIStreamListener listener, in nsIOutputStream sink); */ NS_SCRIPTABLE NS_IMETHOD Init(nsIStreamListener *listener, nsIOutputStream *sink) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIStreamListenerTee, NS_ISTREAMLISTENERTEE_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSISTREAMLISTENERTEE \ NS_SCRIPTABLE NS_IMETHOD Init(nsIStreamListener *listener, nsIOutputStream *sink); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSISTREAMLISTENERTEE(_to) \ NS_SCRIPTABLE NS_IMETHOD Init(nsIStreamListener *listener, nsIOutputStream *sink) { return _to Init(listener, sink); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSISTREAMLISTENERTEE(_to) \ NS_SCRIPTABLE NS_IMETHOD Init(nsIStreamListener *listener, nsIOutputStream *sink) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(listener, sink); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsStreamListenerTee : public nsIStreamListenerTee { public: NS_DECL_ISUPPORTS NS_DECL_NSISTREAMLISTENERTEE nsStreamListenerTee(); private: ~nsStreamListenerTee(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsStreamListenerTee, nsIStreamListenerTee) nsStreamListenerTee::nsStreamListenerTee() { /* member initializers and constructor code */ } nsStreamListenerTee::~nsStreamListenerTee() { /* destructor code */ } /* void init (in nsIStreamListener listener, in nsIOutputStream sink); */ NS_IMETHODIMP nsStreamListenerTee::Init(nsIStreamListener *listener, nsIOutputStream *sink) { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif #endif /* __gen_nsIStreamListenerTee_h__ */
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 Systems and Networking, University of Augsburg, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Ciprian Radu <radu@informatik.uni-augsburg.de> */ #ifndef FOURWAYROUTER_H_ #define FOURWAYROUTER_H_ #include "ns3/noc-router.h" #include "ns3/noc-net-device.h" namespace ns3 { class FourWayRouter : public NocRouter { public: enum Direction {NONE, NORTH, EAST, SOUTH, WEST}; static TypeId GetTypeId(); FourWayRouter(); virtual ~FourWayRouter(); virtual Ptr<NocNetDevice> GetInjectionNetDevice (Ptr<Packet> packet, Ptr<NocNode> destination); virtual std::vector<Ptr<NocNetDevice> > GetInjectionNetDevices (); virtual Ptr<NocNetDevice> GetReceiveNetDevice (); /** * Retrieves all the possible output net devices for a packet sent by the specified net device. * * \param packet the packet * \param sender the net device which sent the packet * * \return an array with the output net devices */ std::vector<Ptr<NocNetDevice> > GetOutputNetDevices (Ptr<Packet> packet, Ptr<NocNetDevice> sender); virtual void SetNocNode (Ptr<NocNode> nocNode); /** * \return how many input ports the router has */ virtual uint32_t GetNumberOfInputPorts (); /** * \return how many output ports the router has */ virtual uint32_t GetNumberOfOutputPorts (); /** * \return how many virtual channels the router has */ virtual uint32_t GetNumberOfVirtualChannels (); protected: FourWayRouter (std::string name); Ptr<NocNetDevice> GetInputNetDevice(Ptr<NocNetDevice> sender, const int routingDirection, const int routingDimension); Ptr<NocNetDevice> GetOutputNetDevice(Ptr<NocNetDevice> sender, const int routingDirection, const int routingDimension); private: /** * Initialize the router */ void Init (); Ptr<NocNetDevice> m_internalInputDevice; Ptr<NocNetDevice> m_internalOutputDevice; }; } // namespace ns3 #endif /* FOURWAYROUTER_H_ */
// -*- mode: cpp; mode: fold -*- // Description /*{{{*/ // $Id: sha1.h,v 1.3 2001/05/07 05:05:47 jgg Exp $ /* ###################################################################### SHA1SumValue - Storage for a SHA-1 hash. SHA1Summation - SHA-1 Secure Hash Algorithm. This is a C++ interface to a set of SHA1Sum functions, that mirrors the equivalent MD5 classes. ##################################################################### */ /*}}}*/ #ifndef APTPKG_SHA1_H #define APTPKG_SHA1_H #include "hashsum_template.h" #ifndef APT_10_CLEANER_HEADERS #include <string> #include <cstring> #include <algorithm> #endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::min; #endif typedef HashSumValue<160> SHA1SumValue; class SHA1Summation : public SummationImplementation { /* assumes 64-bit alignment just in case */ unsigned char Buffer[64] __attribute__((aligned(8))); unsigned char State[5*4] __attribute__((aligned(8))); unsigned char Count[2*4] __attribute__((aligned(8))); bool Done; public: bool Add(const unsigned char *inbuf, unsigned long long inlen); using SummationImplementation::Add; SHA1SumValue Result(); SHA1Summation(); }; #endif
#ifndef _TIMGFILTERDGBOB_H_ #define _TIMGFILTERDGBOB_H_ #include "TimgFilter.h" DECLARE_FILTER(TimgFilterDGbob, public, TimgFilter) private: struct TtempPict { void done(void) { buf.clear(); } TffPict p; Tbuffer buf; } *picts0[5], **picts; enum { PRVPRV = -2, PRV = -1, SRC = 0, NXT = 1, NXTNXT = 2 }; int n, order; int do_deinterlace; protected: virtual uint64_t getSupportedInputColorspaces(const TfilterSettingsVideo *cfg) const { return FF_CSP_420P | FF_CSP_YUY2 | FF_CSP_RGB32; } virtual void onSizeChange(void); public: TimgFilterDGbob(IffdshowBase *Ideci, Tfilters *Iparent); ~TimgFilterDGbob(); virtual void done(void); virtual HRESULT process(TfilterQueue::iterator it, TffPict &pict, const TfilterSettingsVideo *cfg0); virtual void onSeek(void); }; #endif
/* * Tiny Code Generator for QEMU * * Copyright (c) 2008 Fabrice Bellard * * 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. */ #define TCG_TARGET_PPC 1 #define TCG_TARGET_REG_BITS 32 #define TCG_TARGET_WORDS_BIGENDIAN #define TCG_TARGET_NB_REGS 32 enum { TCG_REG_R0 = 0, TCG_REG_R1, TCG_REG_R2, TCG_REG_R3, TCG_REG_R4, TCG_REG_R5, TCG_REG_R6, TCG_REG_R7, TCG_REG_R8, TCG_REG_R9, TCG_REG_R10, TCG_REG_R11, TCG_REG_R12, TCG_REG_R13, TCG_REG_R14, TCG_REG_R15, TCG_REG_R16, TCG_REG_R17, TCG_REG_R18, TCG_REG_R19, TCG_REG_R20, TCG_REG_R21, TCG_REG_R22, TCG_REG_R23, TCG_REG_R24, TCG_REG_R25, TCG_REG_R26, TCG_REG_R27, TCG_REG_R28, TCG_REG_R29, TCG_REG_R30, TCG_REG_R31 }; /* used for function call generation */ #define TCG_REG_CALL_STACK TCG_REG_R1 #define TCG_TARGET_STACK_ALIGN 16 #ifdef __APPLE__ #define TCG_TARGET_CALL_STACK_OFFSET 24 #else #define TCG_TARGET_CALL_ALIGN_ARGS 1 #define TCG_TARGET_CALL_STACK_OFFSET 8 #endif /* optional instructions */ #define TCG_TARGET_HAS_neg_i32 #define TCG_TARGET_HAS_div_i32 #define TCG_TARGET_HAS_ext8s_i32 #define TCG_TARGET_HAS_ext16s_i32 #define TCG_AREG0 TCG_REG_R27 #define TCG_AREG1 TCG_REG_R24 #define TCG_AREG2 TCG_REG_R25 #define TCG_AREG3 TCG_REG_R26 /* taken directly from tcg-dyngen.c */ #define MIN_CACHE_LINE_SIZE 8 /* conservative value */ static inline void flush_icache_range(unsigned long start, unsigned long stop) { unsigned long p; start &= ~(MIN_CACHE_LINE_SIZE - 1); stop = (stop + MIN_CACHE_LINE_SIZE - 1) & ~(MIN_CACHE_LINE_SIZE - 1); for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) { asm volatile ("dcbst 0,%0" : : "r"(p) : "memory"); } asm volatile ("sync" : : : "memory"); for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) { asm volatile ("icbi 0,%0" : : "r"(p) : "memory"); } asm volatile ("sync" : : : "memory"); asm volatile ("isync" : : : "memory"); }
/* SPDX-License-Identifier: LGPL-2.1+ */ #include <errno.h> #include <netinet/in.h> #include <stdbool.h> #include <stddef.h> #include <string.h> #include <sys/un.h> #include <unistd.h> #include "alloc-util.h" #include "fd-util.h" #include "fs-util.h" #include "log.h" #include "macro.h" #include "missing_socket.h" #include "mkdir.h" #include "selinux-util.h" #include "socket-util.h" #include "umask-util.h" int socket_address_listen( const SocketAddress *a, int flags, int backlog, SocketAddressBindIPv6Only only, const char *bind_to_device, bool reuse_port, bool free_bind, bool transparent, mode_t directory_mode, mode_t socket_mode, const char *label) { _cleanup_close_ int fd = -1; const char *p; int r; assert(a); r = socket_address_verify(a, true); if (r < 0) return r; if (socket_address_family(a) == AF_INET6 && !socket_ipv6_is_supported()) return -EAFNOSUPPORT; if (label) { r = mac_selinux_create_socket_prepare(label); if (r < 0) return r; } fd = socket(socket_address_family(a), a->type | flags, a->protocol); r = fd < 0 ? -errno : 0; if (label) mac_selinux_create_socket_clear(); if (r < 0) return r; if (socket_address_family(a) == AF_INET6 && only != SOCKET_ADDRESS_DEFAULT) { r = setsockopt_int(fd, IPPROTO_IPV6, IPV6_V6ONLY, only == SOCKET_ADDRESS_IPV6_ONLY); if (r < 0) return r; } if (IN_SET(socket_address_family(a), AF_INET, AF_INET6)) { if (bind_to_device) { r = socket_bind_to_ifname(fd, bind_to_device); if (r < 0) return r; } if (reuse_port) { r = setsockopt_int(fd, SOL_SOCKET, SO_REUSEPORT, true); if (r < 0) log_warning_errno(r, "SO_REUSEPORT failed: %m"); } if (free_bind) { r = socket_set_freebind(fd, socket_address_family(a), true); if (r < 0) log_warning_errno(r, "IP_FREEBIND/IPV6_FREEBIND failed: %m"); } if (transparent) { r = socket_set_transparent(fd, socket_address_family(a), true); if (r < 0) log_warning_errno(r, "IP_TRANSPARENT/IPV6_TRANSPARENT failed: %m"); } } r = setsockopt_int(fd, SOL_SOCKET, SO_REUSEADDR, true); if (r < 0) return r; p = socket_address_get_path(a); if (p) { /* Create parents */ (void) mkdir_parents_label(p, directory_mode); /* Enforce the right access mode for the socket */ RUN_WITH_UMASK(~socket_mode) { r = mac_selinux_bind(fd, &a->sockaddr.sa, a->size); if (r == -EADDRINUSE) { /* Unlink and try again */ if (unlink(p) < 0) return r; /* didn't work, return original error */ r = mac_selinux_bind(fd, &a->sockaddr.sa, a->size); } if (r < 0) return r; } } else { if (bind(fd, &a->sockaddr.sa, a->size) < 0) return -errno; } if (socket_address_can_accept(a)) if (listen(fd, backlog) < 0) return -errno; /* Let's trigger an inotify event on the socket node, so that anyone waiting for this socket to be connectable * gets notified */ if (p) (void) touch(p); r = fd; fd = -1; return r; }
/*--------------------------------------------------------------------*/ /*--- The thread state. pub_tool_threadstate.h ---*/ /*--------------------------------------------------------------------*/ /* This file is part of Valgrind, a dynamic binary instrumentation framework. Copyright (C) 2000-2011 Julian Seward jseward@acm.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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. The GNU General Public License is contained in the file COPYING. */ #ifndef __PUB_TOOL_THREADSTATE_H #define __PUB_TOOL_THREADSTATE_H /* The maximum number of pthreads that we support. This is deliberately not very high since our implementation of some of the scheduler algorithms is surely O(N) in the number of threads, since that's simple, at least. And (in practice) we hope that most programs do not need many threads. */ #if defined(VGO_darwin) || defined(ANDROID) #define VG_N_THREADS 500 #else #define VG_N_THREADS 10000 #endif /* Special magic value for an invalid ThreadId. It corresponds to LinuxThreads using zero as the initial value for pthread_mutex_t.__m_owner and pthread_cond_t.__c_waiting. */ #define VG_INVALID_THREADID ((ThreadId)(0)) /* Get the TID of the thread which currently has the CPU. */ extern ThreadId VG_(get_running_tid) ( void ); #endif // __PUB_TOOL_THREADSTATE_H /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/
#include <stdio.h> int main(int argv,char* argc[]) { printf("hello world \n"); return 0; }
/************************************************************************ * RSTP library - Rapid Spanning Tree (802.1D-2004) * Copyright (C) 2001-2003 Optical Access * Author: Alex Rozin * * This file is part of RSTP library. * * RSTP 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; version 2.1 * * RSTP 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 RSTP library; see the file COPYING. If not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. **********************************************************************/ /* Path Cost monitoring state machine */ #include "base.h" #include "stpm.h" #include "stp_to.h" /* for STP_OUT_get_port_oper_speed */ #define STATES { \ CHOOSE(AUTO), \ CHOOSE(FORCE), \ CHOOSE(STABLE), \ } #define GET_STATE_NAME STP_pcost_get_state_name #include "choose.h" static long computeAutoPCost(STATE_MACH_T *this) { long lret; register PORT_T *port = this->owner.port; if (port->usedSpeed < 10L) { /* < 10Mb/s */ lret = 20000000; } else if (port->usedSpeed <= 10L) { /* 10 Mb/s */ lret = 2000000; } else if (port->usedSpeed <= 100L) { /* 100 Mb/s */ lret = 200000; } else if (port->usedSpeed <= 1000L) { /* 1 Gb/s */ lret = 20000; } else if (port->usedSpeed <= 10000L) { /* 10 Gb/s */ lret = 2000; } else if (port->usedSpeed <= 100000L) { /* 100 Gb/s */ lret = 200; } else if (port->usedSpeed <= 1000000L) { /* 1 GTb/s */ lret = 20; } else if (port->usedSpeed <= 10000000L) { /* 10 Tb/s */ lret = 2; } else /* ??? */{ /* > Tb/s */ lret = 1; } #ifdef STP_DBG if (port->pcost->debug) { stp_trace("usedSpeed=%lu lret=%ld", port->usedSpeed, lret); } #endif return lret; } static void updPortPathCost(PORT_T *port) { port->reselect = True; port->selected = False; } void STP_pcost_enter_state(STATE_MACH_T *this) { register PORT_T *port = this->owner.port; switch (this->State) { case BEGIN: break; case AUTO: port->operSpeed = STP_OUT_get_port_oper_speed(port->port_index); #ifdef STP_DBG if (port->pcost->debug) { stp_trace("AUTO:operSpeed=%lu", port->operSpeed); } #endif port->usedSpeed = port->operSpeed; port->operPCost = computeAutoPCost (this); break; case FORCE: port->operPCost = port->adminPCost; port->usedSpeed = -1; break; case STABLE: updPortPathCost (port); break; } } Bool STP_pcost_check_conditions(STATE_MACH_T *this) { register PORT_T *port = this->owner.port; switch (this->State) { case BEGIN: return STP_hop_2_state(this, AUTO); case AUTO: return STP_hop_2_state(this, STABLE); case FORCE: return STP_hop_2_state(this, STABLE); case STABLE: if (ADMIN_PORT_PATH_COST_AUTO == port->adminPCost && port->operSpeed != port->usedSpeed) { return STP_hop_2_state(this, AUTO); } if (ADMIN_PORT_PATH_COST_AUTO != port->adminPCost && port->operPCost != port->adminPCost) { return STP_hop_2_state(this, FORCE); } break; } return False; }
/* */ #ifndef SQUID_IPC_KID_H #define SQUID_IPC_KID_H #include "SquidString.h" /// Squid child, including current forked process info and /// info persistent across restarts class Kid { public: #if _SQUID_NEXT_ typedef union wait status_type; #else typedef int status_type; #endif /// keep restarting until the number of bad failures exceed this limit enum { badFailureLimit = 4 }; /// slower start failures are not "frequent enough" to be counted as "bad" enum { fastFailureTimeLimit = 10 }; // seconds public: Kid(); Kid(const String& kid_name); /// called when this kid got started, records PID void start(pid_t cpid); /// called when kid terminates, sets exiting status void stop(status_type exitStatus); /// returns true if tracking of kid is stopped bool running() const; /// returns true if master should restart this kid bool shouldRestart() const; /// returns current pid for a running kid and last pid for a stopped kid pid_t getPid() const; /// whether the failures are "repeated and frequent" bool hopeless() const; /// returns true if the process terminated normally bool calledExit() const; /// returns the exit status of the process int exitStatus() const; /// whether the process exited with a given exit status code bool calledExit(int code) const; /// whether the process exited with code 0 bool exitedHappy() const; /// returns true if the kid was terminated by a signal bool signaled() const; /// returns the number of the signal that caused the kid to terminate int termSignal() const; /// whether the process was terminated by a given signal bool signaled(int sgnl) const; /// returns kid name const String& name() const; private: // Information preserved across restarts String theName; ///< process name int badFailures; ///< number of "repeated frequent" failures // Information specific to a running or stopped kid pid_t pid; ///< current (for a running kid) or last (for stopped kid) PID time_t startTime; ///< last start time bool isRunning; ///< whether the kid is assumed to be alive status_type status; ///< exit status of a stopped kid }; // TODO: processes may not be kids; is there a better place to put this? /// process kinds typedef enum { pkOther = 0, ///< we do not know or do not care pkCoordinator = 1, ///< manages all other kids pkWorker = 2, ///< general-purpose worker bee pkDisker = 4, ///< cache_dir manager } ProcessKind; /// ProcessKind for the current process extern int TheProcessKind; #endif /* SQUID_IPC_KID_H */
/* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2010-12-15 * Description : white balance color correction settings container * * Copyright (C) 2007-2014 by Gilles Caulier <caulier dot gilles at gmail dot com> * Copyright (C) 2008 by Guillaume Castagnino <casta at xwing dot info> * Copyright (C) 2010 by Martin Klapetek <martin dot klapetek at gmail dot 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, 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. * * ============================================================ */ #ifndef WBCONTAINER_H #define WBCONTAINER_H // Qt includes #include <QString> // Local includes #include "digikam_export.h" namespace Digikam { class FilterAction; class DIGIKAM_EXPORT WBContainer { public: WBContainer(); bool isDefault() const; bool operator==(const WBContainer& other) const; void writeToFilterAction(FilterAction& action, const QString& prefix = QString()) const; static WBContainer fromFilterAction(const FilterAction& action, const QString& prefix = QString()); public: double black; double expositionMain; double expositionFine; double temperature; double green; double dark; double gamma; double saturation; /** These values are not settings and are computed from original image which can be different * for image to process in case of preview. If all values are -1 (default), there are compute on image to process * on filter workflow, else there are used as well. * See bug #259223 for details. */ int maxr; int maxg; int maxb; }; } // namespace Digikam #endif /* WBCONTAINER_H*/
/* Copyright (C) 2003 MySQL AB 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; version 2 of the License. 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 <sys/types.h> #include <sys/stat.h> #include <my_dir.h> #include "transparent_file.h" #define DEFAULT_CHAIN_LENGTH 512 /* Version for file format. 1 - Initial Version. That is, the version when the metafile was introduced. */ #define TINA_VERSION 1 typedef struct st_tina_share { char *table_name; char data_file_name[FN_REFLEN]; uint table_name_length, use_count; /* Below flag is needed to make log tables work with concurrent insert. For more details see comment to ha_tina::update_status. */ my_bool is_log_table; /* Here we save the length of the file for readers. This is updated by inserts, updates and deletes. The var is initialized along with the share initialization. */ my_off_t saved_data_file_length; pthread_mutex_t mutex; THR_LOCK lock; bool update_file_opened; bool tina_write_opened; File meta_file; /* Meta file we use */ File tina_write_filedes; /* File handler for readers */ bool crashed; /* Meta file is crashed */ ha_rows rows_recorded; /* Number of rows in tables */ uint data_file_version; /* Version of the data file used */ } TINA_SHARE; struct tina_set { my_off_t begin; my_off_t end; }; class ha_tina: public handler { THR_LOCK_DATA lock; /* MySQL lock */ TINA_SHARE *share; /* Shared lock info */ my_off_t current_position; /* Current position in the file during a file scan */ my_off_t next_position; /* Next position in the file scan */ my_off_t local_saved_data_file_length; /* save position for reads */ my_off_t temp_file_length; uchar byte_buffer[IO_SIZE]; Transparent_file *file_buff; File data_file; /* File handler for readers */ File update_temp_file; String buffer; /* The chain contains "holes" in the file, occured because of deletes/updates. It is used in rnd_end() to get rid of them in the end of the query. */ tina_set chain_buffer[DEFAULT_CHAIN_LENGTH]; tina_set *chain; tina_set *chain_ptr; uchar chain_alloced; uint32 chain_size; uint local_data_file_version; /* Saved version of the data file used */ bool records_is_known; MEM_ROOT blobroot; private: bool get_write_pos(my_off_t *end_pos, tina_set *closest_hole); int open_update_temp_file_if_needed(); int init_tina_writer(); int init_data_file(); public: ha_tina(handlerton *hton, TABLE_SHARE *table_arg); ~ha_tina() { if (chain_alloced) my_free(chain, 0); if (file_buff) delete file_buff; } const char *table_type() const { return "CSV"; } const char *index_type(uint inx) { return "NONE"; } const char **bas_ext() const; ulonglong table_flags() const { return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT | HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE); } ulong index_flags(uint idx, uint part, bool all_parts) const { /* We will never have indexes so this will never be called(AKA we return zero) */ return 0; } uint max_record_length() const { return HA_MAX_REC_LENGTH; } uint max_keys() const { return 0; } uint max_key_parts() const { return 0; } uint max_key_length() const { return 0; } /* Called in test_quick_select to determine if indexes should be used. */ virtual double scan_time() { return (double) (stats.records+stats.deleted) / 20.0+10; } /* The next method will never be called */ virtual bool fast_key_read() { return 1;} /* TODO: return actual upper bound of number of records in the table. (e.g. save number of records seen on full table scan and/or use file size as upper bound) */ ha_rows estimate_rows_upper_bound() { return HA_POS_ERROR; } int open(const char *name, int mode, uint open_options); int close(void); int write_row(uchar * buf); int update_row(const uchar * old_data, uchar * new_data); int delete_row(const uchar * buf); int rnd_init(bool scan=1); int rnd_next(uchar *buf); int rnd_pos(uchar * buf, uchar *pos); bool check_and_repair(THD *thd); int check(THD* thd, HA_CHECK_OPT* check_opt); bool is_crashed() const; int rnd_end(); int repair(THD* thd, HA_CHECK_OPT* check_opt); /* This is required for SQL layer to know that we support autorepair */ bool auto_repair() const { return 1; } void position(const uchar *record); int info(uint); int extra(enum ha_extra_function operation); int delete_all_rows(void); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); /* These functions used to get/update status of the handler. Needed to enable concurrent inserts. */ void get_status(); void update_status(); /* The following methods were added just for TINA */ int encode_quote(uchar *buf); int find_current_row(uchar *buf); int chain_append(); };
/* gtkmenuitempeer.c -- Native implementation of GtkMenuItemPeer Copyright (C) 1999 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath 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. GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ #include "gtkpeer.h" #include "gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.h" JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create (JNIEnv *env, jobject obj, jstring label) { GtkWidget *widget; const char *str; NSA_SET_GLOBAL_REF (env, obj); str = (*env)->GetStringUTFChars (env, label, NULL); gdk_threads_enter (); widget = gtk_check_menu_item_new_with_label (str); gtk_widget_show (widget); gdk_threads_leave (); (*env)->ReleaseStringUTFChars (env, label, str); NSA_SET_PTR (env, obj, widget); } JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_setState (JNIEnv *env, jobject obj, jboolean state) { void *ptr; ptr = NSA_GET_PTR (env, obj); gdk_threads_enter (); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (ptr), state); gdk_threads_leave (); }
/* $Id: SUPSvcInternal.h $ */ /** @file * VirtualBox Support Service - Internal header. */ /* * Copyright (C) 2008-2015 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. * * The contents of this file may alternatively be used under the terms * of the Common Development and Distribution License Version 1.0 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the * VirtualBox OSE distribution, in which case the provisions of the * CDDL are applicable instead of those of the GPL. * * You may elect to license modified versions of this file under the * terms and conditions of either the GPL or the CDDL or both. */ #ifndef ___SUPSvcInternal_h___ #define ___SUPSvcInternal_h___ #include <VBox/cdefs.h> #include <VBox/types.h> #include <iprt/stdarg.h> #include <iprt/getopt.h> RT_C_DECLS_BEGIN /** @name Common Helpers * @{ */ void supSvcLogErrorStr(const char *pszMsg); void supSvcLogErrorV(const char *pszFormat, va_list va); void supSvcLogError(const char *pszFormat, ...); int supSvcLogGetOptError(const char *pszAction, int rc, int argc, char **argv, int iArg, PCRTOPTIONUNION pValue); int supSvcLogTooManyArgsError(const char *pszAction, int argc, char **argv, int iArg); void supSvcDisplayErrorV(const char *pszFormat, va_list va); void supSvcDisplayError(const char *pszFormat, ...); int supSvcDisplayGetOptError(const char *pszAction, int rc, int argc, char **argv, int iArg, PCRTOPTIONUNION pValue); int supSvcDisplayTooManyArgsError(const char *pszAction, int argc, char **argv, int iArg); /** @} */ /** @name OS Backend * @{ */ /** * Logs the message to the appropriate system log. * * @param psMsg The log string. */ void supSvcOsLogErrorStr(const char *pszMsg); /** @} */ /** @name The Service Manager * @{ */ void supSvcStopAndDestroyServices(void); int supSvcTryStopServices(void); int supSvcCreateAndStartServices(void); /** @} */ /** @name The Grant Service * @{ */ #define SUPSVC_GRANT_SERVICE_NAME "VirtualBoxGrantSvc" DECLCALLBACK(int) supSvcGrantCreate(void **ppvInstance); DECLCALLBACK(void) supSvcGrantStart(void *pvInstance); DECLCALLBACK(int) supSvcGrantTryStop(void *pvInstance); DECLCALLBACK(void) supSvcGrantStopAndDestroy(void *pvInstance, bool fRunning); /** @} */ /** @name The Global Service * @{ */ DECLCALLBACK(int) supSvcGlobalCreate(void **ppvInstance); DECLCALLBACK(void) supSvcGlobalStart(void *pvInstance); DECLCALLBACK(int) supSvcGlobalTryStop(void *pvInstance); DECLCALLBACK(void) supSvcGlobalStopAndDestroy(void *pvInstance, bool fRunning); /** @} */ RT_C_DECLS_END #endif
/********************************************************************* * * Filename: irmod.c * Version: 0.9 * Description: IrDA stack main entry points * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Mon Dec 15 13:55:39 1997 * Modified at: Wed Jan 5 15:12:41 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997, 1999-2000 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2004 Jean Tourrilhes <jt@hpl.hp.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. * * Neither Dag Brattli nor University of Tromsø admit liability nor * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ /* * This file contains the main entry points of the IrDA stack. * They are in this file and not af_irda.c because some developpers * are using the IrDA stack without the socket API (compiling out * af_irda.c). * Jean II */ #include <linux/module.h> #include <linux/moduleparam.h> #include <net/irda/irda.h> #include <net/irda/irmod.h> /* notify_t */ #include <net/irda/irlap.h> /* irlap_init */ #include <net/irda/irlmp.h> /* irlmp_init */ #include <net/irda/iriap.h> /* iriap_init */ #include <net/irda/irttp.h> /* irttp_init */ #include <net/irda/irda_device.h> /* irda_device_init */ /* * Module parameters */ #ifdef CONFIG_IRDA_DEBUG unsigned int irda_debug = IRDA_DEBUG_LEVEL; module_param_named(debug, irda_debug, uint, 0); MODULE_PARM_DESC(debug, "IRDA debugging level"); EXPORT_SYMBOL(irda_debug); #endif /* Packet type handler. * Tell the kernel how IrDA packets should be handled. */ static struct packet_type irda_packet_type __read_mostly = { .type = cpu_to_be16(ETH_P_IRDA), .func = irlap_driver_rcv, /* Packet type handler irlap_frame.c */ }; /* * Function irda_notify_init (notify) * * Used for initializing the notify structure * */ void irda_notify_init(notify_t *notify) { notify->data_indication = NULL; notify->udata_indication = NULL; notify->connect_confirm = NULL; notify->connect_indication = NULL; notify->disconnect_indication = NULL; notify->flow_indication = NULL; notify->status_indication = NULL; notify->instance = NULL; strlcpy(notify->name, "Unknown", sizeof(notify->name)); } EXPORT_SYMBOL(irda_notify_init); /* * Function irda_init (void) * * Protocol stack initialisation entry point. * Initialise the various components of the IrDA stack */ static int __init irda_init(void) { int ret = 0; IRDA_DEBUG(0, "%s()\n", __func__); /* Lower layer of the stack */ irlmp_init(); irlap_init(); /* Driver/dongle support */ irda_device_init(); /* Higher layers of the stack */ iriap_init(); irttp_init(); ret = irsock_init(); if (ret < 0) goto out_err_1; /* Add IrDA packet type (Start receiving packets) */ dev_add_pack(&irda_packet_type); /* External APIs */ #ifdef CONFIG_PROC_FS irda_proc_register(); #endif #ifdef CONFIG_SYSCTL ret = irda_sysctl_register(); if (ret < 0) goto out_err_2; #endif ret = irda_nl_register(); if (ret < 0) goto out_err_3; return 0; out_err_3: #ifdef CONFIG_SYSCTL irda_sysctl_unregister(); out_err_2: #endif #ifdef CONFIG_PROC_FS irda_proc_unregister(); #endif /* Remove IrDA packet type (stop receiving packets) */ dev_remove_pack(&irda_packet_type); /* Remove higher layers */ irsock_cleanup(); out_err_1: irttp_cleanup(); iriap_cleanup(); /* Remove lower layers */ irda_device_cleanup(); irlap_cleanup(); /* Must be done before irlmp_cleanup()! DB */ /* Remove middle layer */ irlmp_cleanup(); return ret; } /* * Function irda_cleanup (void) * * Protocol stack cleanup/removal entry point. * Cleanup the various components of the IrDA stack */ static void __exit irda_cleanup(void) { /* Remove External APIs */ irda_nl_unregister(); #ifdef CONFIG_SYSCTL irda_sysctl_unregister(); #endif #ifdef CONFIG_PROC_FS irda_proc_unregister(); #endif /* Remove IrDA packet type (stop receiving packets) */ dev_remove_pack(&irda_packet_type); /* Remove higher layers */ irsock_cleanup(); irttp_cleanup(); iriap_cleanup(); /* Remove lower layers */ irda_device_cleanup(); irlap_cleanup(); /* Must be done before irlmp_cleanup()! DB */ /* Remove middle layer */ irlmp_cleanup(); } /* * The IrDA stack must be initialised *before* drivers get initialised, * and *before* higher protocols (IrLAN/IrCOMM/IrNET) get initialised, * otherwise bad things will happen (hashbins will be NULL for example). * Those modules are at module_init()/device_initcall() level. * * On the other hand, it needs to be initialised *after* the basic * networking, the /proc/net filesystem and sysctl module. Those are * currently initialised in .../init/main.c (before initcalls). * Also, IrDA drivers needs to be initialised *after* the random number * generator (main stack and higher layer init don't need it anymore). * * Jean II */ subsys_initcall(irda_init); module_exit(irda_cleanup); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> & Jean Tourrilhes <jt@hpl.hp.com>"); MODULE_DESCRIPTION("The Linux IrDA Protocol Stack"); MODULE_LICENSE("GPL"); MODULE_ALIAS_NETPROTO(PF_IRDA);
#include "testutils.h" #include "memxor.h" #define MAX_SIZE 256 static uint8_t * set_align(uint8_t *buf, unsigned align) { unsigned offset; /* An extra redzon char at the beginning */ buf++; offset = (uintptr_t) (buf) % sizeof(unsigned long); if (offset < align) buf += (align - offset); else if (offset > align) buf += (align + sizeof(unsigned long) - offset); return buf; } static void test_memxor (const uint8_t *a, const uint8_t *b, const uint8_t *c, size_t size, unsigned align_dst, unsigned align_src) { uint8_t dst_buf[MAX_SIZE + sizeof(unsigned long) + 1]; uint8_t src_buf[MAX_SIZE + sizeof(unsigned long) + 1]; uint8_t *dst = set_align (dst_buf, align_dst); uint8_t *src = set_align (src_buf, align_src); if (verbose) fprintf(stderr, "size = %d, align_dst = %d, align_src = %d\n", (int) size, align_dst, align_src); memcpy (dst, a, size); dst[-1] = 17; dst[size] = 17; memcpy (src, b, size); memxor (dst, src, size); ASSERT (MEMEQ (size, dst, c)); ASSERT (dst[-1] == 17); ASSERT (dst[size] == 17); } static void test_memxor3 (const uint8_t *ain, const uint8_t *bin, const uint8_t *c, size_t size, unsigned align_dst, unsigned align_a, unsigned align_b) { uint8_t dst_buf[MAX_SIZE + sizeof(unsigned long) + 1]; uint8_t a_buf[MAX_SIZE + sizeof(unsigned long) + 1]; uint8_t b_buf[MAX_SIZE + sizeof(unsigned long) + 1]; uint8_t *dst = set_align (dst_buf, align_dst); uint8_t *a = set_align (a_buf, align_a); uint8_t *b = set_align (b_buf, align_b); if (verbose) fprintf(stderr, "size = %d, align_dst = %d, align_a = %d, align_b = %d\n", (int) size, align_dst, align_a, align_b); memset (dst, 0, size); dst[-1] = 17; dst[size] = 17; memcpy (a, ain, size); memcpy (b, bin, size); memxor3 (dst, a, b, size); ASSERT (MEMEQ (size, dst, c)); ASSERT (dst[-1] == 17); ASSERT (dst[size] == 17); } int test_main(void) { const uint8_t *a = H("ecc8737f 38f2f9e8 86b9d84c 42a9c7ef" "27a50860 49c6be97 c5cc6c35 3981b367" "f8b4397b 951e3b2f 35749fe1 25884fa6" "9361c97a ab1c6cce 494efb5a 1f108411" "21dc6386 e81b2410 2f04c29d e0ca1135" "c9f96f2e bb5b2e2d 8cb45df9 50c4755a" "362b7ead 4b930010 cbc69834 66221ba8" "c0b8d7ac 7ec3b700 6bdb1a3b 599f3e76" "a7e66a29 ee1fb98c 60a66c9e 0a1d9c49" "6367afc7 362d6ae1 f8799443 17e2b1a1" "ff1cc03c 9e2728ca a1f6598f 5a61bd56" "0826effc f3499da7 119249b6 fd643cd4" "2e7c74b0 f775fda4 a5617138 1e8520bf" "f17de57a decc36b6 9eceee6e d448f592" "be77a67a 1b91a5b3 62fab868 dcb046f6" "394b5335 b2eaa351 fc4456e4 35bb9c54"); const uint8_t *b = H("cac458ad fe87e226 6cb0ce3d cfa5cb3b" "963d0034 5811bb9e acf4675b 7464f800" "4b1bcff2 b2fa5dd0 0576aea6 888b8150" "bcba48f1 49bc33d2 e138b0d0 a29b486e" "f7e143c6 f9959596 6aaa4493 b0bea6f8" "1d778513 a3bfec7e 70cfe6a7 e31ad041" "5fe3371b 63aba991 dab9a3db 66310ebc" "24c2765d a722a131 2fc4d366 1f2e3388" "7e5b26d5 7b34bf4c 655d19da d1335362" "2fbc0d5d cc68c811 ef735c20 352986ef" "f47ac5c9 afa77f5a 20da6dd3 eb9dfb34" "0cdbf792 caf0d633 61d908da a4c0f2a9" "be7a573e 3b8d161c 47fc19be e47d7edc" "e5f00dae f64cbbb4 a081e1f0 381833d8" "30d302ff eed61887 3390d6b2 0048ac32" "9c6b2981 a224dcc1 6b1feebe 15834b1a"); const uint8_t *c = H("260c2bd2 c6751bce ea091671 8d0c0cd4" "b1980854 11d70509 69380b6e 4de54b67" "b3aff689 27e466ff 30023147 ad03cef6" "2fdb818b e2a05f1c a8764b8a bd8bcc7f" "d63d2040 118eb186 45ae860e 5074b7cd" "d48eea3d 18e4c253 fc7bbb5e b3dea51b" "69c849b6 2838a981 117f3bef 00131514" "e47aa1f1 d9e11631 441fc95d 46b10dfe" "d9bd4cfc 952b06c0 05fb7544 db2ecf2b" "4cdba29a fa45a2f0 170ac863 22cb374e" "0b6605f5 31805790 812c345c b1fc4662" "04fd186e 39b94b94 704b416c 59a4ce7d" "9006238e ccf8ebb8 e29d6886 faf85e63" "148de8d4 28808d02 3e4f0f9e ec50c64a" "8ea4a485 f547bd34 516a6eda dcf8eac4" "a5207ab4 10ce7f90 975bb85a 2038d74e"); const int size[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 23, 24, 25, 30, 31, 32, 33, 34, 35, 36, 37, 250, 251, 252, 253,254, 255, 256, -1 }; unsigned i, align_dst, align_a, align_b; for (i = 0; size[i] >= 0; i++) for (align_dst = 0; align_dst < sizeof(unsigned long); align_dst++) for (align_a = 0; align_a < sizeof(unsigned long); align_a++) { test_memxor (a, b, c, size[i], align_dst, align_a); for (align_b = 0; align_b < sizeof(unsigned long); align_b++) test_memxor3 (a, b, c, size[i], align_dst, align_a, align_b); } SUCCESS(); }
/* $NoKeywords:$ */ /** * @file * * PCIe family specific services. * * * * @xrefitem bom "File Content Label" "Release Content" * @e project: AGESA * @e sub-project: GNB * @e \$Revision: 34897 $ @e \$Date: 2010-07-13 19:07:10 -0700 (Tue, 13 Jul 2010) $ * */ /* ***************************************************************************** * * Copyright (c) 2011, Advanced Micro Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Advanced Micro Devices, Inc. nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * *************************************************************************** * */ #ifndef _GNBGFXFAMSERVICES_H_ #define _GNBGFXFAMSERVICES_H_ AGESA_STATUS GfxFmMapEngineToDisplayPath ( IN PCIe_ENGINE_CONFIG *Engine, OUT EXT_DISPLAY_PATH *DisplayPathList, IN GFX_PLATFORM_CONFIG *Gfx ); AGESA_STATUS GfxFmCalculateClock ( IN UINT8 Did, IN AMD_CONFIG_PARAMS *StdHeader ); #endif
/* * Copyright (c) 2012 Deng Hengyi. * * This test case is to test atomic store operation. * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "system.h" #include <stdlib.h> #include <rtems/rtems/atomic.h> #define TEST_REPEAT 200000 #define ATOMIC_STORE_NO_BARRIER(NAME, TYPE, cpuid, mem_bar) \ { \ Atomic_##TYPE t = (Atomic_##TYPE)-1, a = 0; \ unsigned int i; \ _Atomic_Store_##NAME(&a, t, mem_bar); \ rtems_test_assert(a == t); \ for (i = 0; i < TEST_REPEAT; i++){ \ t = (Atomic_##TYPE)rand(); \ _Atomic_Store_##NAME(&a, t, mem_bar); \ rtems_test_assert(a == t); \ } \ locked_printf("\nCPU%d _Atomic_Store_" #NAME ": SUCCESS\n", cpuid); \ } rtems_task Test_task( rtems_task_argument argument ) { int cpu_num; char name[5]; char *p; /* Get the task name */ p = rtems_object_get_name( RTEMS_SELF, 5, name ); rtems_test_assert( p != NULL ); /* Get the CPU Number */ cpu_num = bsp_smp_processor_id(); /* Print that the task is up and running. */ /* test relaxed barrier */ ATOMIC_STORE_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELAXED_BARRIER); ATOMIC_STORE_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELAXED_BARRIER); ATOMIC_STORE_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELAXED_BARRIER); ATOMIC_STORE_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELAXED_BARRIER); /* test release barrier */ ATOMIC_STORE_NO_BARRIER(int, Int, cpu_num, ATOMIC_RELEASE_BARRIER); ATOMIC_STORE_NO_BARRIER(long, Long, cpu_num, ATOMIC_RELEASE_BARRIER); ATOMIC_STORE_NO_BARRIER(ptr, Pointer, cpu_num, ATOMIC_RELEASE_BARRIER); ATOMIC_STORE_NO_BARRIER(32, Int32, cpu_num, ATOMIC_RELEASE_BARRIER); // ATOMIC_STORE_NO_BARRIER(64, cpu_num); /* Set the flag that the task is up and running */ TaskRan[cpu_num] = true; /* Drop into a loop which will keep this task on * running on the cpu. */ while(1); }
/*************************************************************************** kvncview.h - widget that shows the vnc client ------------------- begin : Thu Dec 20 15:11:42 CET 2001 copyright : (C) 2001-2003 by Tim Jansen email : tim@tjansen.de ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef KVNCVIEW_H #define KVNCVIEW_H #include "kremoteview.h" #include <qcursor.h> #include <qmap.h> #include "pointerlatencyometer.h" #include "hostpreferences.h" #include "vnctypes.h" #include "threads.h" class QClipBoard; class KVncView : public KRemoteView { Q_OBJECT private: ControllerThread m_cthread; WriterThread m_wthread; volatile bool m_quitFlag; // if set: all threads should die ASAP QMutex m_framebufferLock; bool m_enableFramebufferLocking; bool m_enableClientCursor; QSize m_framebufferSize; bool m_scaling; bool m_remoteMouseTracking; bool m_viewOnly; int m_buttonMask; QMap<unsigned int,bool> m_mods; QString m_host; int m_port; QClipboard *m_cb; bool m_dontSendCb; QCursor m_cursor; DotCursorState m_cursorState; PointerLatencyOMeter m_plom; void mouseEvent(QMouseEvent*); unsigned long toKeySym(QKeyEvent *k); bool checkLocalKRfb(); void paintMessage(const QString &msg); void showDotCursorInternal(); void unpressModifiers(); protected: void paintEvent(QPaintEvent*); void customEvent(QCustomEvent*); void mousePressEvent(QMouseEvent*); void mouseDoubleClickEvent(QMouseEvent*); void mouseReleaseEvent(QMouseEvent*); void mouseMoveEvent(QMouseEvent*); void wheelEvent(QWheelEvent *); void focusOutEvent(QFocusEvent *); bool x11Event(XEvent*); public: KVncView(QWidget* parent=0, const char *name=0, const QString &host = QString(""), int port = 5900, const QString &password = QString::null, Quality quality = QUALITY_UNKNOWN, DotCursorState dotCursorState = DOT_CURSOR_AUTO, const QString &encodings = QString::null); ~KVncView(); QSize sizeHint(); void drawRegion(int x, int y, int w, int h); void lockFramebuffer(); void unlockFramebuffer(); void enableClientCursor(bool enable); virtual bool scaling() const; virtual bool supportsScaling() const; virtual bool supportsLocalCursor() const; virtual QSize framebufferSize(); void setRemoteMouseTracking(bool s); bool remoteMouseTracking(); void configureApp(Quality q, const QString specialEncodings = QString::null); void showDotCursor(DotCursorState state); DotCursorState dotCursorState() const; virtual void startQuitting(); virtual bool isQuitting(); virtual QString host(); virtual int port(); virtual bool start(); virtual bool viewOnly(); static bool editPreferences( HostPrefPtr ); public slots: virtual void enableScaling(bool s); virtual void setViewOnly(bool s); virtual void pressKey(XEvent *k); private slots: void clipboardChanged(); void selectionChanged(); }; #endif
/* * Copyright (C) International Business Machines Corp., 2000-2002 * Portions Copyright (C) Christoph Hellwig, 2001-2002 * * 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 <linux/fs.h> #include "jfs_incore.h" #include "jfs_inode.h" #include "jfs_dmap.h" #include "jfs_txnmgr.h" #include "jfs_xattr.h" #include "jfs_acl.h" #include "jfs_debug.h" int jfs_fsync(struct file *file, struct dentry *dentry, int datasync) { struct inode *inode = dentry->d_inode; int rc = 0; if (!(inode->i_state & I_DIRTY_ALL) || (datasync && !(inode->i_state & I_DIRTY_DATASYNC))) { /* Make sure committed changes hit the disk */ jfs_flush_journal(JFS_SBI(inode->i_sb)->log, 1); return rc; } rc |= jfs_commit_inode(inode, 1); return rc ? -EIO : 0; } static int jfs_open(struct inode *inode, struct file *file) { int rc; if ((rc = generic_file_open(inode, file))) return rc; /* * We attempt to allow only one "active" file open per aggregate * group. Otherwise, appending to files in parallel can cause * fragmentation within the files. * * If the file is empty, it was probably just created and going * to be written to. If it has a size, we'll hold off until the * file is actually grown. */ if (S_ISREG(inode->i_mode) && file->f_mode & FMODE_WRITE && (inode->i_size == 0)) { struct jfs_inode_info *ji = JFS_IP(inode); spin_lock_irq(&ji->ag_lock); if (ji->active_ag == -1) { ji->active_ag = ji->agno; atomic_inc( &JFS_SBI(inode->i_sb)->bmap->db_active[ji->agno]); } spin_unlock_irq(&ji->ag_lock); } return 0; } static int jfs_release(struct inode *inode, struct file *file) { struct jfs_inode_info *ji = JFS_IP(inode); spin_lock_irq(&ji->ag_lock); if (ji->active_ag != -1) { struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap; atomic_dec(&bmap->db_active[ji->active_ag]); ji->active_ag = -1; } spin_unlock_irq(&ji->ag_lock); return 0; } const struct inode_operations jfs_file_inode_operations = { .truncate = jfs_truncate, .setxattr = jfs_setxattr, .getxattr = jfs_getxattr, .listxattr = jfs_listxattr, .removexattr = jfs_removexattr, #ifdef CONFIG_JFS_POSIX_ACL .setattr = jfs_setattr, .check_acl = jfs_check_acl, #endif }; const struct file_operations jfs_file_operations = { .open = jfs_open, .llseek = generic_file_llseek, .write = do_sync_write, .read = do_sync_read, .aio_read = generic_file_aio_read, .aio_write = generic_file_aio_write, .mmap = generic_file_mmap, .splice_read = generic_file_splice_read, .splice_write = generic_file_splice_write, .fsync = jfs_fsync, .release = jfs_release, .unlocked_ioctl = jfs_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = jfs_compat_ioctl, #endif };
/* * * Copyright (c) International Business Machines Corp., 2001 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* * NAME * pipe11.c * * DESCRIPTION * Check if many children can read what is written to a pipe by the * parent. * * ALGORITHM * 1. Open a pipe and write to it * 2. Fork a large number of children * 3. Have the children read the pipe and check how many characters * each got * * USAGE: <for command-line> * pipe11 [-c n] [-f] [-i n] [-I x] [-P x] [-t] * where, -c n : Run n copies concurrently. * -f : Turn off functionality Testing. * -i n : Execute test n times. * -I x : Execute test for x seconds. * -P x : Pause for x seconds between iterations. * -t : Turn on syscall timing. * * HISTORY * 07/2001 Ported by Wayne Boyer * * RESTRICTIONS * None */ #include <sys/types.h> #include <sys/wait.h> #include <errno.h> #include <stdio.h> #include <limits.h> #include "test.h" #include "usctest.h" char *TCID = "pipe11"; int TST_TOTAL = 1; void do_child(void); void do_child_uclinux(void); void setup(void); void cleanup(void); #define NUMCHILD 50 #define NCPERCHILD 50 char rawchars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; int kidid; int numchild; /* no of children to fork */ int ncperchild; /* no of chars child should read */ int szcharbuf; /* size of char buf */ int pipewrcnt; /* chars written to pipe */ char *wrbuf, *rdbuf; int fd[2]; /* fds for pipe read/write */ ssize_t safe_read(int fd, void *buf, size_t count) { ssize_t n; do { n = read(fd, buf, count); } while (n < 0 && errno == EINTR); return n; } int main(int ac, char **av) { int lc; const char *msg; int i; int fork_ret, status; int written; /* no of chars read and written */ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) { tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); } #ifdef UCLINUX maybe_run_child(&do_child_uclinux, "ddddd", &fd[0], &fd[1], &kidid, &ncperchild, &szcharbuf); #endif setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { /* reset tst_count in case we are looping */ tst_count = 0; TEST(pipe(fd)); if (TEST_RETURN != 0) { tst_resm(TFAIL, "pipe creation failed"); continue; } written = write(fd[1], wrbuf, szcharbuf); if (written != szcharbuf) { tst_brkm(TBROK, cleanup, "write to pipe failed"); } refork: ++kidid; fork_ret = FORK_OR_VFORK(); if (fork_ret < 0) { tst_brkm(TBROK, cleanup, "fork() failed"); } if ((fork_ret != 0) && (fork_ret != -1) && (kidid < numchild)) { goto refork; } if (fork_ret == 0) { /* child */ #ifdef UCLINUX if (self_exec(av[0], "ddddd", fd[0], fd[1], kidid, ncperchild, szcharbuf) < 0) { tst_brkm(TBROK, cleanup, "self_exec failed"); } #else do_child(); #endif } /* parent */ sleep(5); tst_resm(TINFO, "There are %d children to wait for", kidid); for (i = 1; i <= kidid; ++i) { wait(&status); if (status == 0) { tst_resm(TPASS, "child %d exitted successfully", i); } else { tst_resm(TFAIL, "child %d exitted with bad " "status", i); } } } cleanup(); tst_exit(); } /* * do_child() */ void do_child(void) { int nread; if (close(fd[1])) { tst_resm(TINFO, "child %d " "could not close pipe", kidid); exit(0); } nread = safe_read(fd[0], rdbuf, ncperchild); if (nread == ncperchild) { tst_resm(TINFO, "child %d " "got %d chars", kidid, nread); exit(0); } else { tst_resm(TFAIL, "child %d did not receive expected no of " "characters, got %d characters", kidid, nread); exit(1); } } /* * do_child_uclinux() - as above, but mallocs rdbuf first */ void do_child_uclinux(void) { if ((rdbuf = malloc(szcharbuf)) == NULL) { tst_brkm(TBROK, cleanup, "malloc of rdbuf failed"); } do_child(); } /* * setup() - performs all ONE TIME setup for this test. */ void setup(void) { int i, j; tst_sig(FORK, DEF_HANDLER, cleanup); TEST_PAUSE; numchild = NUMCHILD; ncperchild = NCPERCHILD; kidid = 0; /* allocate read and write buffers */ szcharbuf = numchild * ncperchild; /* make sure pipe write doesn't block */ if (szcharbuf == PIPE_BUF) { /* adjust number of characters per child */ ncperchild = szcharbuf / numchild; } if ((wrbuf = malloc(szcharbuf)) == NULL) { tst_brkm(TBROK, cleanup, "malloc failed"); } if ((rdbuf = malloc(szcharbuf)) == NULL) { tst_brkm(TBROK, cleanup, "malloc of rdbuf failed"); } /* initialize wrbuf */ j = 0; for (i = 0; i < szcharbuf;) { wrbuf[i++] = rawchars[j++]; if (j >= sizeof(rawchars)) { j = 0; } } } /* * cleanup() - performs all ONE TIME cleanup for this test at * completion or premature exit. */ void cleanup(void) { /* * print timing stats if that option was specified. * print errno log if that option was specified. */ TEST_CLEANUP; }
#ifndef COMPILER_H_ #define COMPILER_H_ #include <compiler/LogicalFactory.h> #include <compiler/ConstantFactory.h> #include <compiler/MixtureFactory.h> #include <compiler/CounterTab.h> #include <compiler/ObsFuncTab.h> #include <distribution/DistTab.h> #include <function/FuncTab.h> #include <model/BUGSModel.h> #include <graph/Graph.h> #include <map> #include <string> #include <utility> #include <list> class ParseTree; class SymTab; class FuncTab; class DistTab; class NodeAlias; class Compiler; typedef void (Compiler::*CompilerMemFn) (ParseTree const *); /** * @short Creates a BUGSModel from a ParseTree */ class Compiler { BUGSModel &_model; CounterTab _countertab; std::map<std::string, SArray> const &_data_table; std::map<std::string, std::vector<bool> > _constant_mask; unsigned int _n_resolved, _n_relations; bool *_is_resolved; bool _strict_resolution; int _index_expression; std::vector<Node*> _index_nodes; ConstantFactory _constantfactory; LogicalFactory _logicalfactory; MixtureFactory _mixfactory1; MixtureFactory _mixfactory2; std::map<std::string, std::vector<std::vector<int> > > _node_array_ranges; Node *getArraySubset(ParseTree const *t); Range VariableSubsetRange(ParseTree const *var); Range CounterRange(ParseTree const *var); Node* VarGetNode(ParseTree const *var); Range getRange(ParseTree const *var, Range const &default_range); void traverseTree(ParseTree const *relations, CompilerMemFn fun, bool resetcounter=true); void allocate(ParseTree const *rel); Node * allocateStochastic(ParseTree const *stoch_rel); Node * allocateLogical(ParseTree const *dtrm_rel); void setConstantMask(ParseTree const *rel); void writeConstantData(ParseTree const *rel); Node *getLength(ParseTree const *p, SymTab const &symtab); Node *getDim(ParseTree const *p, SymTab const &symtab); void getArrayDim(ParseTree const *p); bool getParameterVector(ParseTree const *t, std::vector<Node const *> &parents); Node * constFromTable(ParseTree const *p); void addDevianceNode(); public: bool indexExpression(ParseTree const *t, int &value); BUGSModel &model() const; Node * getParameter(ParseTree const *t); /** * @param model Model to be created by the compiler. * * @param datatab Data table, mapping a variable name onto a * multi-dimensional array of values. This is required since some * constant expressions in the BUGS language may depend on data * values. */ Compiler(BUGSModel &model, std::map<std::string, SArray> const &data_table); /** * Adds variables to the symbol table. * * @param pvariables vector of ParseTree pointers, each one corresponding * to a parsed variable declaration. */ void declareVariables(std::vector<ParseTree*> const &pvariables); /** * Adds variables without an explicit declaration to the symbol * table. Variables supplied in the data table are added, then * any variables that appear on the left hand side of a relation * * @param prelations ParseTree corresponding to a parsed model block */ void undeclaredVariables(ParseTree const *prelations); /** * Traverses the ParseTree creating nodes. * * @param prelations ParseTree corresponding to a parsed model block */ void writeRelations(ParseTree const *prelations); /** * The function table used by the compiler to look up functions by * name. It is shared by all Compiler objects. * * @see Module */ static FuncTab &funcTab(); /** * The distribution table used by the compiler to look up * distributions by name. It is shared by all Compiler objects. * * @see Module */ static DistTab &distTab(); /** * The table for observable functions used by the compiler to substitute * a logical node for a stochastic node when required */ static ObsFuncTab &obsFuncTab(); MixtureFactory &mixtureFactory1(); MixtureFactory &mixtureFactory2(); }; #endif /* COMPILER_H_ */
#ifndef _X_NODE_H_ #define _X_NODE_H_ #include <ev.h> #include <stddef.h> #include "list.h" #include "hash.h" #include "xltop.h" enum { X_HOST, X_JOB, X_CLUS, X_U, X_SERV, X_FS, X_V, NR_X_TYPES, }; #define X_U_NAME "ALL" #define X_V_NAME "ALL" #define K_TICK 10.0 #define K_WINDOW 600.0 extern double k_tick, k_window; struct x_type { struct hash_table x_hash_table; const char *x_type_name; size_t x_nr, x_nr_hint; int x_type, x_which; }; struct x_node { struct x_type *x_type; struct x_node *x_parent; struct list_head x_parent_link; size_t x_nr_child; struct list_head x_child_list; struct list_head x_sub_list; size_t x_hash; struct hlist_node x_hash_node; char x_name[]; }; extern struct x_type x_types[]; extern struct x_node *x_all[2]; struct k_node { struct hlist_node k_hash_node; struct x_node *k_x[2]; struct list_head k_sub_list; double k_t; /* Timestamp. */ double k_pending[NR_STATS]; double k_rate[NR_STATS]; /* EWMA bytes (or reqs) per second. */ double k_sum[NR_STATS]; }; extern size_t nr_k; extern struct hash_table k_hash_table; int x_types_init(void); void x_init(struct x_node *x, int type, struct x_node *parent, size_t hash, struct hlist_head *hash_head, const char *name); void x_set_parent(struct x_node *x, struct x_node *p); /* p is only used if L_CREATE is set in flags. */ struct x_node * x_lookup(int type, const char *name, struct x_node *p, int flags); /* No create. */ struct x_node *x_lookup_hash(int type, const char *name, size_t *hash_ref, struct hlist_head **head_ref); /* No create. */ struct x_node *x_lookup_str(const char *str); void x_update(EV_P_ struct x_node *x0, struct x_node *x1, double *d); void x_destroy(EV_P_ struct x_node *x); static inline int x_which(struct x_node *x) { return x->x_type->x_which; } static inline int x_is_type(struct x_node *x, int type) { return x->x_type == &x_types[type]; } static inline const char *x_type_name(int type) { switch (type) { case X_HOST: return "host"; case X_JOB: return "job"; case X_CLUS: return "clus"; case X_U: return "u"; case X_SERV: return "serv"; case X_FS: return "fs"; case X_V: return "v"; default: return NULL; } } static inline int x_str_type(const char *s) { if (strcmp(s, "host") == 0) return X_HOST; else if (strcmp(s, "job") == 0) return X_JOB; else if (strcmp(s, "clus") == 0) return X_CLUS; else if (strcmp(s, "u") == 0) return X_U; else if (strcmp(s, "serv") == 0) return X_SERV; else if (strcmp(s, "fs") == 0) return X_FS; else if (strcmp(s, "v") == 0) return X_V; else return -1; } #define x_for_each_child(c, x) \ list_for_each_entry(c, &((x)->x_child_list), x_parent_link) #define x_for_each_child_safe(c, t, x) \ list_for_each_entry_safe(c, t, &((x)->x_child_list), x_parent_link) struct k_node *k_lookup(struct x_node *x0, struct x_node *x1, int flags); void k_freshen(struct k_node *k, double now); void k_update(EV_P_ struct k_node *k, struct x_node *x0, struct x_node *x1, double *d); void k_destroy(EV_P_ struct x_node *x0, struct x_node *x1, int which); #endif
/* * iSCSI over TCP/IP Data-Path lib * * Copyright (C) 2008 Mike Christie * Copyright (C) 2008 Red Hat, Inc. All rights reserved. * maintained by open-iscsi@googlegroups.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. * * See the file COPYING included with this distribution for more details. */ #ifndef LIBISCSI_TCP_H #define LIBISCSI_TCP_H #include <scsi/libiscsi.h> struct iscsi_tcp_conn; struct iscsi_segment; struct sk_buff; struct ahash_request; typedef int iscsi_segment_done_fn_t(struct iscsi_tcp_conn *, struct iscsi_segment *); struct iscsi_segment { unsigned char *data; unsigned int size; unsigned int copied; unsigned int total_size; unsigned int total_copied; struct ahash_request *hash; unsigned char padbuf[ISCSI_PAD_LEN]; unsigned char recv_digest[ISCSI_DIGEST_SIZE]; unsigned char digest[ISCSI_DIGEST_SIZE]; unsigned int digest_len; struct scatterlist *sg; void *sg_mapped; unsigned int sg_offset; bool atomic_mapped; iscsi_segment_done_fn_t *done; }; /* Socket connection receive helper */ struct iscsi_tcp_recv { struct iscsi_hdr *hdr; struct iscsi_segment segment; /* Allocate buffer for BHS + AHS */ uint32_t hdr_buf[64]; /* copied and flipped values */ int datalen; }; struct iscsi_tcp_conn { struct iscsi_conn *iscsi_conn; void *dd_data; int stop_stage; /* conn_stop() flag: * * stop to recover, * * stop to terminate */ /* control data */ struct iscsi_tcp_recv in; /* TCP receive context */ /* CRC32C (Rx) LLD should set this is they do not offload */ struct ahash_request *rx_hash; }; struct iscsi_tcp_task { uint32_t exp_datasn; /* expected target's R2TSN/DataSN */ int data_offset; struct iscsi_r2t_info *r2t; /* in progress solict R2T */ struct iscsi_pool r2tpool; struct kfifo r2tqueue; void *dd_data; }; enum { ISCSI_TCP_SEGMENT_DONE, /* curr seg has been processed */ ISCSI_TCP_SKB_DONE, /* skb is out of data */ ISCSI_TCP_CONN_ERR, /* iscsi layer has fired a conn err */ ISCSI_TCP_SUSPENDED, /* conn is suspended */ }; extern void iscsi_tcp_hdr_recv_prep(struct iscsi_tcp_conn *tcp_conn); extern int iscsi_tcp_recv_skb(struct iscsi_conn *conn, struct sk_buff *skb, unsigned int offset, bool offloaded, int *status); extern void iscsi_tcp_cleanup_task(struct iscsi_task *task); extern int iscsi_tcp_task_init(struct iscsi_task *task); extern int iscsi_tcp_task_xmit(struct iscsi_task *task); /* segment helpers */ extern int iscsi_tcp_recv_segment_is_hdr(struct iscsi_tcp_conn *tcp_conn); extern int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn, struct iscsi_segment *segment, int recv, unsigned copied); extern void iscsi_tcp_segment_unmap(struct iscsi_segment *segment); extern void iscsi_segment_init_linear(struct iscsi_segment *segment, void *data, size_t size, iscsi_segment_done_fn_t *done, struct ahash_request *hash); extern int iscsi_segment_seek_sg(struct iscsi_segment *segment, struct scatterlist *sg_list, unsigned int sg_count, unsigned int offset, size_t size, iscsi_segment_done_fn_t *done, struct ahash_request *hash); /* digest helpers */ extern void iscsi_tcp_dgst_header(struct ahash_request *hash, const void *hdr, size_t hdrlen, unsigned char digest[ISCSI_DIGEST_SIZE]); extern struct iscsi_cls_conn * iscsi_tcp_conn_setup(struct iscsi_cls_session *cls_session, int dd_data_size, uint32_t conn_idx); extern void iscsi_tcp_conn_teardown(struct iscsi_cls_conn *cls_conn); /* misc helpers */ extern int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session); extern void iscsi_tcp_r2tpool_free(struct iscsi_session *session); extern int iscsi_tcp_set_max_r2t(struct iscsi_conn *conn, char *buf); extern void iscsi_tcp_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats); #endif /* LIBISCSI_TCP_H */
void S_Init( void ); void S_Shutdown( void ); // if origin is NULL, the sound will be dynamically sourced from the entity void S_MuteSound(int entityNum, int entchannel); void S_StartSound( vec3_t origin, int entnum, int entchannel, sfxHandle_t sfx ); void S_StartLocalSound( sfxHandle_t sfx, int channelNum ); void S_StartBackgroundTrack( const char *intro, const char *loop, qboolean bReturnWithoutStarting ); void S_StopBackgroundTrack( void ); // cinematics and voice-over-network will send raw samples // 1.0 volume will be direct output of source samples void S_RawSamples (int samples, int rate, int width, int channels, const byte *data, float volume); // stop all sounds and the background track void S_StopAllSounds( void ); // all continuous looping sounds must be added before calling S_Update void S_ClearLoopingSounds( qboolean killall ); void S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx ); void S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx ); void S_StopLoopingSound(int entityNum ); // recompute the reletive volumes for all running sounds // reletive to the given entityNum / orientation void S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater ); // let the sound system know where an entity currently is void S_UpdateEntityPosition( int entityNum, const vec3_t origin ); void S_Update( void ); void S_DisableSounds( void ); void S_BeginRegistration( void ); // RegisterSound will allways return a valid sample, even if it // has to create a placeholder. This prevents continuous filesystem // checks for missing files sfxHandle_t S_RegisterSound( const char *name ); void S_DisplayFreeMemory(void); void S_ClearSoundBuffer( void ); void SNDDMA_Activate( void );
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * 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. * * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/tags/release-1-1-1/engines/scumm/file_nes.h $ * $Id: file_nes.h 43223 2009-08-10 19:31:08Z sev $ * */ #ifndef SCUMM_FILE_NES_H #define SCUMM_FILE_NES_H #include "common/file.h" #include "scumm/file.h" namespace Scumm { class ScummNESFile : public BaseScummFile { public: enum ROMset { kROMsetUSA, kROMsetEurope, kROMsetSweden, kROMsetFrance, kROMsetGermany, kROMsetSpain, kROMsetItaly, kROMsetNum }; struct Resource; struct ResourceGroup; struct LFLEntry; struct LFL; enum ResType { NES_UNKNOWN, NES_GLOBDATA, NES_ROOM, NES_SCRIPT, NES_SOUND, NES_COSTUME, NES_ROOMGFX, NES_COSTUMEGFX, NES_SPRPALS, NES_SPRDESC, NES_SPRLENS, NES_SPROFFS, NES_SPRDATA, NES_CHARSET, NES_PREPLIST }; private: Common::MemoryReadStream *_stream; ROMset _ROMset; byte *_buf; bool generateIndex(); bool generateResource(int res); uint16 extractResource(Common::WriteStream *out, const Resource *res, ResType type); byte fileReadByte(); uint16 fileReadUint16LE(); public: ScummNESFile(); void setEnc(byte value); bool open(const Common::String &filename); bool openSubFile(const Common::String &filename); void close(); bool eos() const { return _stream->eos(); } int32 pos() const { return _stream->pos(); } int32 size() const { return _stream->size(); } bool seek(int32 offs, int whence = SEEK_SET) { return _stream->seek(offs, whence); } uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); } }; } // End of namespace Scumm #endif
/* init/start/stop/exit stream functions Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> Copyright (C) 2005-2007 Hans Verkuil <hverkuil@xs4all.nl> 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 IVTV_STREAMS_H #define IVTV_STREAMS_H int ivtv_streams_setup(struct ivtv *itv); int ivtv_streams_register(struct ivtv *itv); void ivtv_streams_cleanup(struct ivtv *itv, int unregister); /* Capture related */ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s); int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end); int ivtv_start_v4l2_decode_stream(struct ivtv_stream *s, int gop_offset); int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts); void ivtv_stop_all_captures(struct ivtv *itv); int ivtv_passthrough_mode(struct ivtv *itv, int enable); #endif
/* * @file fluid_render_util.h * @Brief class FluidRenderUtil * @author Wei Chen * * This file is part of Physika, a versatile physics simulation library. * Copyright (C) 2013- Physika Group. * * This Source Code Form is subject to the terms of the GNU General Public License v2.0. * If a copy of the GPL was not distributed with this file, you can obtain one at: * http://www.gnu.org/licenses/gpl-2.0.html * */ #pragma once namespace Physika{ struct FluidParticleBuffer { unsigned int position_VBO_ = 0; //4*n unsigned int density_VBO_ = 0; //n unsigned int anisotropy_VBO_[3] = { 0, 0, 0 }; //{4*n, 4*n, 4*n} unsigned int indices_EBO_ = 0; unsigned int fluid_particle_num = 0; }; struct DiffuseParticleBuffer { unsigned int diffuse_position_VBO_ = 0; //4*n unsigned int diffuse_velocity_VBO_ = 0; //4*n unsigned int diffuse_indices_EBO_ = 0; unsigned int diffuse_particle_num = 0; }; class FluidRenderUtil { public: FluidRenderUtil(unsigned int fluid_particle_num, unsigned int diffuse_particle_num); ~FluidRenderUtil(); FluidRenderUtil(const FluidRenderUtil &) = delete; FluidRenderUtil & operator = (const FluidRenderUtil &) = delete; //need further consideration void updateFluidParticleBuffer(float * position_buffer, float * density_buffer, float * anisotropy_buffer_0, float * anisotropy_buffer_1, float * anisotropy_buffer_2, unsigned int * indices_buffer, unsigned int indices_num); void updateDiffuseParticleBuffer(float * diffuse_position_buffer, float * diffuse_velocity_buffer, unsigned int * diffuse_indices_buffer); void drawByPoint(); //need further consideration unsigned int fluidParticleNum() const { return this->fluid_particle_buffer_.fluid_particle_num; } unsigned int fluidParticlePositionVBO() const { return this->fluid_particle_buffer_.position_VBO_; } unsigned int fluidParticleAnisotropyVBO(int index) const { return this->fluid_particle_buffer_.anisotropy_VBO_[index]; } //need further consideration unsigned int diffuseParticleNum() const { return this->diffuse_particle_buffer_.diffuse_particle_num; } unsigned int diffuseParticlePositionVBO() const { return this->diffuse_particle_buffer_.diffuse_position_VBO_; } unsigned int diffuseParticleVelocityVBO() const { return this->diffuse_particle_buffer_.diffuse_velocity_VBO_; } unsigned int diffuseParticleEBO() const { return this->diffuse_particle_buffer_.diffuse_indices_EBO_; } private: void initFluidParticleBuffer(unsigned int fluid_particle_num); void initDiffuseParticleBuffer(unsigned int diffuse_partcle_num); void initFluidPointRenderVAO(); void destroyFluidParticleBuffer(); void destroyDiffusePartcileBuffer(); void destroyFluidPointRenderVAO(); private: FluidParticleBuffer fluid_particle_buffer_; DiffuseParticleBuffer diffuse_particle_buffer_; unsigned int fluid_point_render_VAO_; }; }//end of namespace Physika
/* * spectrumMngmntMgr.h * * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name Texas Instruments nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** \file spectrumMngmntMgr.h * \brief dot11h spectrum Management Meneger module interface header file * * \see spectrumMngmntMgr.c */ /***************************************************************************/ /* */ /* MODULE: spectrumMngmntMgr.h */ /* PURPOSE: dot11h spectrum Management Meneger module interface */ /* header file */ /* */ /***************************************************************************/ #ifndef __SPECTRUMMNGMNTMGR_H__ #define __SPECTRUMMNGMNTMGR_H__ #include "paramOut.h" #include "measurementMgr.h" #include "requestHandler.h" TI_STATUS measurementMgr_receiveQuietIE(TI_HANDLE hMeasurementMgr, TI_UINT8 quietCount, TI_UINT8 quietPeriod, TI_UINT16 quietDuration, TI_UINT16 quietOffset); TI_STATUS measurementMgr_receiveTPCRequest(TI_HANDLE hMeasurementMgr, TI_UINT8 dataLen, TI_UINT8 * pData); TI_STATUS measurementMgr_dot11hParseFrameReq(TI_HANDLE hMeasurementMgr, TI_UINT8 * pData, TI_INT32 dataLen, TMeasurementFrameRequest * frameReq); TI_STATUS measurementMgr_dot11hParseRequestIEHdr(TI_UINT8 * pData, TI_UINT16 * reqestHdrLen, TI_UINT16 * measurementToken); TI_BOOL measurementMgr_dot11hIsTypeValid(TI_HANDLE hMeasurementMgr, EMeasurementType type, EMeasurementScanMode scanMode); TI_STATUS measurementMgr_dot11hBuildReport(TI_HANDLE hMeasurementMgr, MeasurementRequest_t request, TMeasurementTypeReply * reply); TI_STATUS measurementMgr_dot11hSendReportAndCleanObject(TI_HANDLE hMeasurementMgr); TI_STATUS measurementMgr_dot11hBuildRejectReport(TI_HANDLE hMeasurementMgr, MeasurementRequest_t * pRequestArr[], TI_UINT8 numOfRequestsInParallel, EMeasurementRejectReason rejectReason); /* The following function uses features from the old Measurement module. */ /* It will have to be adapted to using the new Measurement Manager. */ #if 0 TI_STATUS measurementMgr_getBasicMeasurementParam(TI_HANDLE hMeasurementMgr, acxStatisitcs_t * pAcxStatisitics, mediumOccupancy_t * pMediumOccupancy); #endif /* 0 */ #endif /* __SPECTRUMMNGMNTMGR_H__ */
/* EIBD eib bus access and management daemon Copyright (C) 2005-2011 Martin Koegler <mkoegler@auto.tuwien.ac.at> 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. */ /** * @file * @ingroup KNX_03_03_07 * Application Layer * @{ */ #ifndef CONNECTION_H #define CONNECTION_H #include "client.h" #include "layer4.h" class A__Base { public: TracePtr t; A__Base(ClientConnPtr cc) { t = TracePtr(new Trace(*(cc->t), cc->t->name+'@'+FormatEIBAddr(cc->addr))); con = cc; on_error.set<A__Base,&A__Base::error_cb>(this); } virtual ~A__Base() = default; ClientConnPtr con; LinkConnectSinglePtr lc; InfoCallback on_error; void error_cb() {} virtual void recv_Data(uint8_t *buf, size_t len) = 0; // to socket virtual bool setup (uint8_t *buf,size_t len) = 0; virtual void start() { } virtual void stop(bool err) { } }; template<class TC> class A_Base : public A__Base { public: A_Base(ClientConnPtr cc) : A__Base(cc) { t->setAuxName("Base"); } virtual ~A_Base(); protected: TC c = nullptr; }; /** implements client interface to a broadcast connection */ class A_Broadcast : public T_Reader<BroadcastComm>, public A_Base<T_BroadcastPtr> { public: A_Broadcast (ClientConnPtr cc); virtual ~A_Broadcast (); virtual bool setup (uint8_t *buf,size_t len) override; virtual void recv_Data(uint8_t *buf, size_t len) override; // to socket void send(BroadcastComm &); // from socket private: const char *Name() const { return "broadcast"; } }; /** implements client interface to a group connection */ class A_Group : public T_Reader<GroupComm>, public A_Base<T_GroupPtr> { public: A_Group (ClientConnPtr cc); virtual ~A_Group (); virtual bool setup (uint8_t *buf,size_t len) override; virtual void recv_Data(uint8_t *buf, size_t len) override; // to socket void send(GroupComm &); // from socket private: const char *Name() const { return "group"; } }; /** implements client interface to a raw connection */ class A_TPDU : public T_Reader<TpduComm>, public A_Base<T_TPDUPtr> { public: A_TPDU (ClientConnPtr cc); virtual ~A_TPDU (); virtual bool setup (uint8_t *buf,size_t len) override; virtual void recv_Data(uint8_t *buf, size_t len) override; // to socket void send(TpduComm &); // from socket private: const char *Name() const { return "tpdu"; } }; /** implements client interface to a T_Indivdual connection */ class A_Individual : public T_Reader<CArray>, public A_Base<T_IndividualPtr> { public: A_Individual (ClientConnPtr cc); virtual ~A_Individual (); virtual bool setup (uint8_t *buf,size_t len) override; virtual void recv_Data(uint8_t *buf, size_t len) override; // to socket void send(CArray &); // from socket private: const char *Name() const { return "individual"; } }; /** implements client interface to a T_Connection connection */ class A_Connection : public T_Reader<CArray>, public A_Base<T_ConnectionPtr> { public: A_Connection (ClientConnPtr cc); virtual ~A_Connection (); virtual bool setup(uint8_t *buf,size_t len) override; virtual void recv_Data(uint8_t *buf, size_t len) override; // to socket void send(CArray &); // from socket private: const char *Name() const { return "connection"; } }; /** implements client interface to a group socket */ class A_GroupSocket : public T_Reader<GroupAPDU>, public A_Base<GroupSocketPtr> { public: A_GroupSocket (ClientConnPtr cc); virtual ~A_GroupSocket (); virtual bool setup(uint8_t *buf,size_t len) override; virtual void recv_Data(uint8_t *buf, size_t len) override; /** start processing */ void send(GroupAPDU &); private: const char *Name() const { return "groupsocket"; } }; #endif /** @} */
/* * Driver for Xceive XC4000 "QAM/8VSB single chip tuner" * * Copyright (c) 2007 Steven Toth <stoth@linuxtv.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; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __XC4000_H__ #define __XC4000_H__ #include <linux/firmware.h> struct dvb_frontend; struct i2c_adapter; struct xc4000_config { u8 i2c_address; /* if non-zero, power management is enabled by default */ u8 default_pm; /* value to be written to XREG_AMPLITUDE in DVB-T mode (0: no write) */ u8 dvb_amplitude; /* if non-zero, register 0x0E is set to filter analog TV video output */ u8 set_smoothedcvbs; /* IF for DVB-T */ u32 if_khz; }; /* xc4000 callback command */ #define XC4000_TUNER_RESET 0 /* For each bridge framework, when it attaches either analog or digital, * it has to store a reference back to its _core equivalent structure, * so that it can service the hardware by steering gpio's etc. * Each bridge implementation is different so cast devptr accordingly. * The xc4000 driver cares not for this value, other than ensuring * it's passed back to a bridge during tuner_callback(). */ #if IS_REACHABLE(CONFIG_BACKPORT_MEDIA_TUNER_XC4000) extern struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct xc4000_config *cfg); #else static inline struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct xc4000_config *cfg) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); return NULL; } #endif #endif
/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. */ /* * return codes */ #define PTS_PASS 0 #define PTS_FAIL 1 #define PTS_UNRESOLVED 2 #define PTS_UNSUPPORTED 4 #define PTS_UNTESTED 5 #ifndef ARRAY_SIZE #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) #endif #define LTP_ATTRIBUTE_NORETURN __attribute__((noreturn)) #define LTP_ATTRIBUTE_UNUSED __attribute__((unused)) #define LTP_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result))
/* * COM1 NS16550 support */ #include <linux/config.h> #include <linux/serialP.h> #include <linux/serial_reg.h> #include <asm/serial.h> #define SERIAL_BAUD 9600 extern void outb(int port, unsigned char val); extern unsigned char inb(int port); extern unsigned long ISA_io; static struct serial_state rs_table[RS_TABLE_SIZE] = { SERIAL_PORT_DFNS /* Defined in <asm/serial.h> */ }; static int shift; unsigned long serial_init(int chan, void *ignored) { unsigned long com_port; unsigned char lcr, dlm; /* We need to find out which type io we're expecting. If it's * 'SERIAL_IO_PORT', we get an offset from the isa_io_base. * If it's 'SERIAL_IO_MEM', we can the exact location. -- Tom */ switch (rs_table[chan].io_type) { case SERIAL_IO_PORT: com_port = rs_table[chan].port; break; case SERIAL_IO_MEM: com_port = (unsigned long)rs_table[chan].iomem_base; break; default: /* We can't deal with it. */ return -1; } /* How far apart the registers are. */ shift = rs_table[chan].iomem_reg_shift; /* save the LCR */ lcr = inb(com_port + (UART_LCR << shift)); /* Access baud rate */ outb(com_port + (UART_LCR << shift), 0x80); dlm = inb(com_port + (UART_DLM << shift)); /* * Test if serial port is unconfigured. * We assume that no-one uses less than 110 baud or * less than 7 bits per character these days. * -- paulus. */ if ((dlm <= 4) && (lcr & 2)) /* port is configured, put the old LCR back */ outb(com_port + (UART_LCR << shift), lcr); else { /* Input clock. */ outb(com_port + (UART_DLL << shift), (BASE_BAUD / SERIAL_BAUD) & 0xFF); outb(com_port + (UART_DLM << shift), (BASE_BAUD / SERIAL_BAUD) >> 8); /* 8 data, 1 stop, no parity */ outb(com_port + (UART_LCR << shift), 0x03); /* RTS/DTR */ outb(com_port + (UART_MCR << shift), 0x03); } /* Clear & enable FIFOs */ outb(com_port + (UART_FCR << shift), 0x07); return (com_port); } void serial_putc(unsigned long com_port, unsigned char c) { while ((inb(com_port + (UART_LSR << shift)) & UART_LSR_THRE) == 0) ; outb(com_port, c); } unsigned char serial_getc(unsigned long com_port) { while ((inb(com_port + (UART_LSR << shift)) & UART_LSR_DR) == 0) ; return inb(com_port); } int serial_tstc(unsigned long com_port) { return ((inb(com_port + (UART_LSR << shift)) & UART_LSR_DR) != 0); }
/**************************************************************************** ** ** Copyright (C) Qxt Foundation. Some rights reserved. ** ** This file is part of the QxtCore module of the Qxt library. ** ** This library is free software; you can redistribute it and/or modify it ** under the terms of the Common Public License, version 1.0, as published ** by IBM, and/or under the terms of the GNU Lesser General Public License, ** version 2.1, as published by the Free Software Foundation. ** ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR ** FITNESS FOR A PARTICULAR PURPOSE. ** ** You should have received a copy of the CPL and the LGPL along with this ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files ** included with the source distribution for more information. ** If you did not receive a copy of the licenses, contact the Qxt Foundation. ** ** <http://libqxt.org> <foundation@libqxt.org> ** ****************************************************************************/ #ifndef QXTRPCSERVICE_P_H #define QXTRPCSERVICE_P_H #include "qxtrpcservice.h" #include <QPointer> #include <QHash> #include <QByteArray> #include <QString> #include <QPair> class QxtRPCServiceIntrospector; class QxtRPCServicePrivate : public QObject, public QxtPrivate<QxtRPCService> { Q_OBJECT public: QxtRPCServicePrivate(); QXT_DECLARE_PUBLIC(QxtRPCService); QxtRPCServiceIntrospector* introspector; QxtAbstractConnectionManager* manager; QxtAbstractSignalSerializer* serializer; QPointer<QIODevice> device; QByteArray serverBuffer; QHash<quint64, QByteArray> buffers; struct SlotDef { QObject* recv; QByteArray slot; Qt::ConnectionType type; inline bool operator==(const SlotDef& other) const { return (recv == other.recv) && (slot == other.slot) && (type == other.type); } }; QHash<QString, QList<SlotDef> > connectedSlots; QHash<QPair<const QMetaObject*, QByteArray>, QList<QByteArray> > slotParameters; void dispatchFromServer(const QString& fn, const QVariant& p0 = QVariant(), const QVariant& p1 = QVariant(), const QVariant& p2 = QVariant(), const QVariant& p3 = QVariant(), const QVariant& p4 = QVariant(), const QVariant& p5 = QVariant(), const QVariant& p6 = QVariant(), const QVariant& p7 = QVariant()) const; void dispatchFromClient(quint64 id, const QString& fn, const QVariant& p0 = QVariant(), const QVariant& p1 = QVariant(), const QVariant& p2 = QVariant(), const QVariant& p3 = QVariant(), const QVariant& p4 = QVariant(), const QVariant& p5 = QVariant(), const QVariant& p6 = QVariant(), const QVariant& p7 = QVariant()) const; public Q_SLOTS: void clientConnected(QIODevice* dev, quint64 id); void clientDisconnected(QIODevice* dev, quint64 id); void clientData(quint64 id); void serverData(); }; #endif
/* * $Id: config.h,v 1.3 2003/09/02 01:17:19 pauli Exp $ * * AUTHOR: Duane Wessels * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- * * Squid is the result of efforts by numerous individuals from * the Internet community; see the CONTRIBUTORS file for full * details. Many organizations have provided support for Squid's * development; see the SPONSORS file for full details. Squid is * Copyrighted (C) 2001 by the Regents of the University of * California; see the COPYRIGHT file for full details. Squid * incorporates software developed and/or copyrighted by other * sources; see the CREDITS file for full details. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ #ifndef SQUID_CONFIG_H #define SQUID_CONFIG_H #include "autoconf.h" /* For GNU autoconf variables */ #include "version.h" /**************************************************************************** *--------------------------------------------------------------------------* * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...* *--------------------------------------------------------------------------* ****************************************************************************/ #ifdef USE_POSIX_REGEX #ifndef USE_RE_SYNTAX #define USE_RE_SYNTAX REG_EXTENDED /* default Syntax */ #endif #endif /* define the _SQUID_TYPE_ based on a guess of the OS */ #if defined(__sun__) || defined(__sun) /* SUN */ #define _SQUID_SUN_ #if defined(__SVR4) /* SOLARIS */ #define _SQUID_SOLARIS_ #else /* SUNOS */ #define _SQUID_SUNOS_ #endif #elif defined(__hpux) /* HP-UX - SysV-like? */ #define _SQUID_HPUX_ #define _SQUID_SYSV_ #elif defined(__osf__) /* OSF/1 */ #define _SQUID_OSF_ #elif defined(__ultrix) /* Ultrix */ #define _SQUID_ULTRIX_ #elif defined(_AIX) /* AIX */ #define _SQUID_AIX_ #elif defined(__linux__) /* Linux */ #define _SQUID_LINUX_ #if USE_ASYNC_IO #define _SQUID_LINUX_THREADS_ #endif #elif defined(__FreeBSD__) /* FreeBSD */ #define _SQUID_FREEBSD_ #if USE_ASYNC_IO && defined(LINUXTHREADS) #define _SQUID_LINUX_THREADS_ #endif #elif defined(__sgi__) || defined(sgi) || defined(__sgi) /* SGI */ #define _SQUID_SGI_ #if !defined(_SVR4_SOURCE) #define _SVR4_SOURCE /* for tempnam(3) */ #endif #if USE_ASYNC_IO #define _ABI_SOURCE #endif /* USE_ASYNC_IO */ #elif defined(__NeXT__) #define _SQUID_NEXT_ #elif defined(__bsdi__) #define _SQUID_BSDI_ /* BSD/OS */ #elif defined(__NetBSD__) #define _SQUID_NETBSD_ #elif defined(__CYGWIN32__) || defined(__CYGWIN__) #define _SQUID_CYGWIN_ #elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32) #define _SQUID_MSWIN_ #elif defined(__APPLE__) #define _SQUID_APPLE_ #elif defined(sony_news) && defined(__svr4) #define _SQUID_NEWSOS6_ #elif defined(__EMX__) || defined(OS2) || defined(__OS2__) #define _SQUID_OS2_ /* * FIXME: the os2 port of bash seems to have problems checking * the return codes of programs in if statements. These options * need to be overridden. */ #ifndef socklen_t #define socklen_t int #endif #ifndef fd_mask #define fd_mask unsigned long #endif #endif #if !defined(CACHEMGR_HOSTNAME) #define CACHEMGR_HOSTNAME "" #endif #if SQUID_UDP_SO_SNDBUF > 16384 #undef SQUID_UDP_SO_SNDBUF #define SQUID_UDP_SO_SNDBUF 16384 #endif #if SQUID_UDP_SO_RCVBUF > 16384 #undef SQUID_UDP_SO_RCVBUF #define SQUID_UDP_SO_RCVBUF 16384 #endif #ifdef HAVE_MEMCPY #define xmemcpy(d,s,n) memcpy((d),(s),(n)) #elif HAVE_BCOPY #define xmemcpy(d,s,n) bcopy((s),(d),(n)) #elif HAVE_MEMMOVE #define xmemcpy(d,s,n) memmove((d),(s),(n)) #endif #ifdef HAVE_MEMMOVE #define xmemmove(d,s,n) memmove((d),(s),(n)) #elif HAVE_BCOPY #define xmemmove(d,s,n) bcopy((s),(d),(n)) #endif #define xisspace(x) isspace((unsigned char)x) #define xtoupper(x) toupper((unsigned char)x) #define xtolower(x) tolower((unsigned char)x) #define xisdigit(x) isdigit((unsigned char)x) #define xisascii(x) isascii((unsigned char)x) #define xislower(x) islower((unsigned char)x) #define xisalpha(x) isalpha((unsigned char)x) #if HAVE_RANDOM #define squid_random random #define squid_srandom srandom #elif HAVE_LRAND48 #define squid_random lrand48 #define squid_srandom srand48 #else #define squid_random rand #define squid_srandom srand #endif #if __GNUC__ #define PRINTF_FORMAT_ARG1 __attribute__ ((format (printf, 1, 2))) #define PRINTF_FORMAT_ARG2 __attribute__ ((format (printf, 2, 3))) #define PRINTF_FORMAT_ARG3 __attribute__ ((format (printf, 3, 4))) #else #define PRINTF_FORMAT_ARG1 #define PRINTF_FORMAT_ARG2 #define PRINTF_FORMAT_ARG3 #endif #endif /* SQUID_CONFIG_H */
/*************************************************************************** * Copyright (C) 2008-2010 by Andrzej Rybczak * * electricityispower@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 St, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef _SERVER_INFO #define _SERVER_INFO #include "screen.h" class ServerInfo : public Screen<Scrollpad> { public: virtual void SwitchTo(); virtual void Resize(); virtual std::basic_string<my_char_t> Title(); virtual void Update(); virtual void EnterPressed() { } virtual void SpacePressed() { } virtual bool allowsSelection() { return false; } virtual List *GetList() { return 0; } protected: virtual void Init(); private: void SetDimensions(); MPD::TagList itsURLHandlers; MPD::TagList itsTagTypes; size_t itsWidth; size_t itsHeight; }; extern ServerInfo *myServerInfo; #endif
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include "../common/define.h" #include "../common/lot.h" #include "../common/lotlist.h" int main (int argc, char *argv[]) { int i; int lotNr; int count; FILE *newudfilefp; struct udfileFormat udpost; if (argc <= 2) { printf("Usage: zcat udfile.gz | ./recoverUrlForLot newudfile lot [lot ...]\n"); printf("OR\n"); printf("Usage: zcat udfile.gz | ./recoverUrlForLot -s server newudfile\n"); exit(1); } char *optServer = NULL; extern char *optarg; extern int optind, opterr, optopt; char c; while ((c=getopt(argc,argv,"s:"))!=-1) { switch (c) { case 's': optServer = optarg; break; default: exit(1); } } --optind; char *newudfile = argv[1 +optind]; //tester at den ikke finnes. Viktig at vi ikke overskriver noe ved en feil if ((newudfilefp = fopen(newudfile,"rb")) != NULL) { printf("newudfile exist. It shuldent. Delete it of you don't need it\n"); exit(1); } if ((newudfilefp = fopen(newudfile,"wb")) == NULL) { perror(newudfile); exit(1); } count = 0; if (optServer != NULL) { printf("will recover lot for server \"%s\"\n",optServer); lotlistLoad(); lotlistMarkLocals(optServer); while (fread(&udpost,sizeof(udpost),1,stdin) == 1) { lotNr = rLotForDOCid(udpost.DocID); if (lotlistIsLocal(lotNr)) { //printf("funnet: url %s, DocID %u-%i\n",udpost.url,udpost.DocID,lotNr); fwrite(&udpost,sizeof(udpost),1,newudfilefp); ++count; continue; } else { //printf("no match: url %s, DocID %u-%i\n",udpost.url,udpost.DocID,lotNr); } } } else { int nrOfsfLots = (argc - 2); int sflot[nrOfsfLots]; printf("newudfile %s. nrOfsfLots %i\n",newudfile,nrOfsfLots); for (i=0;i<nrOfsfLots;i++) { sflot[i] = atoi(argv[i +2]); printf("aa %s, %i\n",argv[i +2],sflot[i]); } while (fread(&udpost,sizeof(udpost),1,stdin) == 1) { lotNr = rLotForDOCid(udpost.DocID); for (i=0;i<nrOfsfLots;i++) { if (sflot[i] == lotNr) { //printf("funnet: url %s, DocID %u-%i\n",udpost.url,udpost.DocID,lotNr); fwrite(&udpost,sizeof(udpost),1,newudfilefp); ++count; continue; } else { printf("no match: url %s, DocID %u-%i\n",udpost.url,udpost.DocID,lotNr); } } } if (!feof(stdin)) { perror("stdin"); } } printf("found %i.\n",count); return EXIT_SUCCESS; }
/* * Phusion Passenger - http://www.modrails.com/ * Copyright (C) 2008 Phusion * * Phusion Passenger is a trademark of Hongli Lai & Ninh Bui. * * 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; version 2 of the License. * * 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 _PASSENGER_LOGGING_H_ #define _PASSENGER_LOGGING_H_ #include <sys/types.h> #include <sys/time.h> #include <unistd.h> #include <ostream> #include <ctime> namespace Passenger { using namespace std; extern unsigned int _logLevel; extern ostream *_logStream; extern ostream *_debugStream; unsigned int getLogLevel(); void setLogLevel(unsigned int value); void setDebugFile(const char *logFile = NULL); /** * Write the given expression to the log stream. */ #define P_LOG(expr) \ do { \ if (Passenger::_logStream != 0) { \ time_t the_time = time(NULL); \ struct tm *the_tm = localtime(&the_time); \ char datetime_buf[60]; \ struct timeval tv; \ strftime(datetime_buf, sizeof(datetime_buf), "%x %H:%M:%S", the_tm); \ gettimeofday(&tv, NULL); \ *Passenger::_logStream << \ "[ pid=" << getpid() << " file=" << __FILE__ << ":" << __LINE__ << \ " time=" << datetime_buf << "." << (tv.tv_usec / 1000) << " ]:" << \ "\n " << expr << std::endl; \ } \ } while (false) /** * Write the given expression, which represents a warning, * to the log stream. */ #define P_WARN(expr) P_LOG(expr) /** * Write the given expression, which represents an error, * to the log stream. */ #define P_ERROR(expr) P_LOG(expr) /** * Write the given expression, which represents a debugging message, * to the log stream. */ #define P_DEBUG(expr) P_TRACE(1, expr) #ifdef PASSENGER_DEBUG #define P_TRACE(level, expr) \ do { \ if (Passenger::_logLevel >= level) { \ if (Passenger::_debugStream != 0) { \ time_t the_time = time(NULL); \ struct tm *the_tm = localtime(&the_time); \ char datetime_buf[60]; \ struct timeval tv; \ strftime(datetime_buf, sizeof(datetime_buf), "%x %H:%M:%S", the_tm); \ gettimeofday(&tv, NULL); \ *Passenger::_debugStream << \ "[ pid=" << getpid() << " file=" << __FILE__ << ":" << __LINE__ << \ " time=" << datetime_buf << "." << (tv.tv_usec / 1000) << " ]:" << \ "\n " << expr << std::endl; \ } \ } \ } while (false) #define P_ASSERT(expr, result_if_failed, message) \ do { \ if (!(expr)) { \ P_ERROR("Assertion failed: " << message); \ return result_if_failed; \ } \ } while (false) #else #define P_TRACE(level, expr) do { /* nothing */ } while (false) #define P_ASSERT(expr, result_if_failed, message) do { /* nothing */ } while (false) #endif } // namespace Passenger #endif /* _PASSENGER_LOGGING_H_ */
/* Copyright (C) 2006 - 2011 ScriptDev2 <http://www.scriptdev2.com/> * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ #ifndef DEF_BLOOD_FURNACE_H #define DEF_BLOOD_FURNACE_H enum { MAX_ENCOUNTER = 3, MAX_ORC_WAVES = 4, TYPE_THE_MAKER_EVENT = 0, TYPE_BROGGOK_EVENT = 1, TYPE_KELIDAN_EVENT = 2, // NPC_THE_MAKER = 17381, NPC_BROGGOK = 17380, NPC_KELIDAN_THE_BREAKER = 17377, NPC_NASCENT_FEL_ORC = 17398, // Used in the Broggok event NPC_MAGTHERIDON = 21174, NPC_SHADOWMOON_CHANNELER = 17653, GO_DOOR_FINAL_EXIT = 181766, GO_DOOR_MAKER_FRONT = 181811, GO_DOOR_MAKER_REAR = 181812, GO_DOOR_BROGGOK_FRONT = 181822, GO_DOOR_BROGGOK_REAR = 181819, GO_DOOR_KELIDAN_EXIT = 181823, // GO_PRISON_CELL_MAKER1 = 181813, // The maker cell front right // GO_PRISON_CELL_MAKER2 = 181814, // The maker cell back right // GO_PRISON_CELL_MAKER3 = 181816, // The maker cell front left // GO_PRISON_CELL_MAKER4 = 181815, // The maker cell back left GO_PRISON_CELL_BROGGOK_1 = 181817, // Broggok cell back left (NE) GO_PRISON_CELL_BROGGOK_2 = 181818, // Broggok cell back right (SE) GO_PRISON_CELL_BROGGOK_3 = 181820, // Broggok cell front left (NW) GO_PRISON_CELL_BROGGOK_4 = 181821, // Broggok cell front right (SW) SAY_BROGGOK_INTRO = -1542015, }; struct BroggokEventInfo { BroggokEventInfo() : m_bIsCellOpened(false), m_uiKilledOrcCount(0) {} ObjectGuid m_cellGuid; bool m_bIsCellOpened; uint8 m_uiKilledOrcCount; GUIDSet m_sSortedOrcGuids; }; class MANGOS_DLL_DECL instance_blood_furnace : public ScriptedInstance { public: instance_blood_furnace(Map* pMap); void Initialize(); void OnCreatureCreate(Creature* pCreature); void OnObjectCreate(GameObject* pGo); void OnCreatureDeath(Creature* pCreature); void OnCreatureEvade(Creature* pCreature); void SetData(uint32 uiType, uint32 uiData); uint32 GetData(uint32 uiType); void Update(uint32 uiDiff); void Load(const char* chrIn); const char* Save() { return m_strInstData.c_str(); } void GetMovementDistanceForIndex(uint32 uiIndex, float& dx, float& dy); void GetKelidanAddList(GUIDList& lList) { lList = m_lChannelersGuids; m_lChannelersGuids.clear(); } private: void DoSortBroggokOrcs(); void DoNextBroggokEventPhase(); uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string m_strInstData; BroggokEventInfo m_aBroggokEvent[MAX_ORC_WAVES]; uint32 m_uiBroggokEventTimer; // Timer for opening the event cages; only on heroic mode = 30 secs uint32 m_uiBroggokEventPhase; GUIDList m_luiNascentOrcGuids; GUIDList m_lChannelersGuids; }; #endif
/* * This file is part of the coreboot project. * * Copyright (c) 2011 Sven Schnelle <svens@stackframe.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; version 2 of * the License. * * 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 <device/device.h> #include <device/pci.h> #include <console/console.h> #include <arch/smp/mpspec.h> #include <arch/ioapic.h> #include <string.h> #include <stdint.h> static void *smp_write_config_table(void *v) { struct mp_config_table *mc; int isa_bus; mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN); mptable_init(mc, LOCAL_APIC_ADDR); smp_write_processors(mc); mptable_write_buses(mc, NULL, &isa_bus); /* I/O APICs: APIC ID Version State Address */ smp_write_ioapic(mc, 2, 0x20, IO_APIC_ADDR); /* Legacy Interrupts */ mptable_add_isa_interrupts(mc, isa_bus, 0x2, 0); smp_write_intsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, isa_bus, 0x00, MP_APIC_ALL, 0x00); smp_write_intsrc(mc, mp_NMI, MP_IRQ_TRIGGER_DEFAULT|MP_IRQ_POLARITY_DEFAULT, isa_bus, 0x00, MP_APIC_ALL, 0x01); smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x01 << 2), 0x02, 0x10); /* PCIe root 0.02.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x02 << 2), 0x02, 0x10); /* VGA 0.02.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1b << 2), 0x02, 0x16); /* HD Audio 0:1b.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1c << 2), 0x02, 0x11); /* PCIe 0:1c.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1c << 2) | 0x01, 0x02, 0x10); /* PCIe 0:1c.1 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1c << 2) | 0x02, 0x02, 0x12); /* PCIe 0:1c.2 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1c << 2) | 0x03, 0x02, 0x13); /* PCIe 0:1c.3 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1d << 2) , 0x02, 0x15); /* USB 0:1d.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1d << 2) | 0x01, 0x02, 0x13); /* USB 0:1d.1 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1d << 2) | 0x02, 0x02, 0x12); /* USB 0:1d.2 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1d << 2) | 0x03, 0x02, 0x10); /* USB 0:1d.3 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1f << 2) , 0x02, 0x12); /* LPC 0:1f.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1f << 2) | 0x01, 0x02, 0x13); /* IDE 0:1f.1 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1f << 2) | 0x03, 0x02, 0x10); /* SATA 0:1f.3 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x03, (0x03 << 2) , 0x02, 0x13); /* Firewire 3:03.0 */ mptable_lintsrc(mc, isa_bus); return mptable_finalize(mc); } unsigned long write_smp_table(unsigned long addr) { void *v; v = smp_write_floating_table(addr, 0); return (unsigned long)smp_write_config_table(v); }
//---------------------------------------------------------------------------------------------------------------------- // // GALGAS Command Line Interface Options // // This file is part of libpm library // // Copyright (C) 2015, ..., 2015 Pierre Molinaro. // // e-mail : pierre@pcmolinaro.name // // This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General // Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) // any later version. // // This program is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY; without even the implied // warranty of MERCHANDIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for // more details. // //---------------------------------------------------------------------------------------------------------------------- #ifndef GALGAS_VERBOSE_OPTION_DEFINED #define GALGAS_VERBOSE_OPTION_DEFINED //---------------------------------------------------------------------------------------------------------------------- #include "command_line_interface/C_BoolCommandLineOption.h" //---------------------------------------------------------------------------------------------------------------------- extern C_BoolCommandLineOption gOption_galgas_5F_builtin_5F_options_verbose_5F_output ; //---------------------------------------------------------------------------------------------------------------------- #endif
/* * include/asm-microblaze/io.h -- Misc I/O operations * * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> * Copyright (C) 2001,02 NEC Corporation * Copyright (C) 2001,02 Miles Bader <miles@gnu.org> * * This file is subject to the terms and conditions of the GNU General * Public License. See the file COPYING in the main directory of this * archive for more details. * * Written by Miles Bader <miles@gnu.org> * Microblaze port by John Williams */ #ifndef __MICROBLAZE_IO_H__ #define __MICROBLAZE_IO_H__ #define IO_SPACE_LIMIT 0xFFFFFFFF #define readb(addr) \ ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; }) #define readw(addr) \ ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; }) #define readl(addr) \ ({ unsigned long __v = (*(volatile unsigned long *) (addr)); __v; }) #define writeb(b, addr) \ (void)((*(volatile unsigned char *) (addr)) = (b)) #define writew(b, addr) \ (void)((*(volatile unsigned short *) (addr)) = (b)) #define writel(b, addr) \ (void)((*(volatile unsigned int *) (addr)) = (b)) #define memset_io(a,b,c) memset((void *)(a),(b),(c)) #define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) #define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) #define inb(addr) readb (addr) #define inw(addr) readw (addr) #define inl(addr) readl (addr) #define outb(x, addr) ((void) writeb (x, addr)) #define outw(x, addr) ((void) writew (x, addr)) #define outl(x, addr) ((void) writel (x, addr)) /* Some #definitions to keep strange Xilinx code happy */ #define in_8(addr) readb (addr) #define in_be16(addr) readw (addr) #define in_be32(addr) readl (addr) #define out_8(addr,x ) outb (x,addr) #define out_be16(addr,x ) outw (x,addr) #define out_be32(addr,x ) outl (x,addr) #define inb_p(port) inb((port)) #define outb_p(val, port) outb((val), (port)) #define inw_p(port) inw((port)) #define outw_p(val, port) outw((val), (port)) #define inl_p(port) inl((port)) #define outl_p(val, port) outl((val), (port)) /* Some defines to keep the MTD flash drivers happy */ #define __raw_readb readb #define __raw_readw readw #define __raw_readl readl #define __raw_writeb writeb #define __raw_writew writew #define __raw_writel writel static inline void io_insb (unsigned long port, void *dst, unsigned long count) { unsigned char *p = dst; while (count--) *p++ = inb (port); } static inline void io_insw (unsigned long port, void *dst, unsigned long count) { unsigned short *p = dst; while (count--) *p++ = inw (port); } static inline void io_insl (unsigned long port, void *dst, unsigned long count) { unsigned long *p = dst; while (count--) *p++ = inl (port); } static inline void io_outsb (unsigned long port, const void *src, unsigned long count) { const unsigned char *p = src; while (count--) outb (*p++, port); } static inline void io_outsw (unsigned long port, const void *src, unsigned long count) { const unsigned short *p = src; while (count--) outw (*p++, port); } static inline void io_outsl (unsigned long port, const void *src, unsigned long count) { const unsigned long *p = src; while (count--) outl (*p++, port); } #define outsb(a,b,l) io_outsb(a,b,l) #define outsw(a,b,l) io_outsw(a,b,l) #define outsl(a,b,l) io_outsl(a,b,l) #define insb(a,b,l) io_insb(a,b,l) #define insw(a,b,l) io_insw(a,b,l) #define insl(a,b,l) io_insl(a,b,l) #define iounmap(addr) ((void)0) #define ioremap(physaddr, size) (physaddr) #define ioremap_nocache(physaddr, size) (physaddr) #define ioremap_writethrough(physaddr, size) (physaddr) #define ioremap_fullcache(physaddr, size) (physaddr) static inline void sync(void) { } #endif /* __MICROBLAZE_IO_H__ */
#include <stdlib.h> #include <string.h> #include <stdio.h> #include <syslog.h> #include "syslogd.h" #include "syslogd_config.h" #define __LOG_FILE "/var/log/messages" static int syslogd_level(const char *name) { int pri; if (strcmp(name, "none") == 0) { return LOG_NONE; } pri = syslog_name_to_pri(name); if (pri < 0) { debug_printf("Warning: Level %s not found, returning debug", name); pri = LOG_DEBUG; } return pri; } int syslogd_load_config(const char *filename, syslogd_config_t *config) { FILE *fh = fopen(filename, "r"); char buf[512]; /* Initialise the default config */ memset(config, 0, sizeof(*config)); config->local.common.target = SYSLOG_TARGET_LOCAL; config->local.common.level = LOG_DEBUG; config->local.common.priv = 0; config->local.common.next = 0; config->local.maxsize = 16; config->local.logfile = __LOG_FILE; config->local.numfiles = 1; #ifndef EMBED config->local.markinterval = 20 * 60; #endif if (!fh) { return 1; } while (fgets(buf, sizeof(buf), fh)) { syslogd_target_t *target; char *type = strtok(buf, " \t\n"); if (type && *type && *type != '#') { char *token; if (strcmp(type, "global") == 0) { target = 0; } else if (strcmp(type, "local") == 0) { target = &config->local.common; } else if (strcmp(type, "remote") == 0) { syslogd_remote_config_t *remote = malloc(sizeof(*remote)); memset(remote, 0, sizeof(*remote)); target = &remote->common; target->target = SYSLOG_TARGET_REMOTE; target->level = LOG_DEBUG; target->next = config->local.common.next; config->local.common.next = target; remote->port = 514; } else if (strcmp(type, "email") == 0) { syslogd_email_config_t *email = malloc(sizeof(*email)); memset(email, 0, sizeof(*email)); target = &email->common; target->target = SYSLOG_TARGET_EMAIL; target->level = LOG_ERR; target->next = config->local.common.next; config->local.common.next = target; email->delay = 60; } else { debug_printf("Unknown target type: %s", type); continue; } /* Now fill in the parameters */ while ((token = strtok(0, " \t\n")) != 0) { char *value = strchr(token, '='); if (value) { *value++ = 0; /* Now we finally have type, token and value */ if (target == 0) { if (strcmp(token, "iso") == 0) { config->iso = atoi(value); } else if (strcmp(token, "repeat") == 0) { config->repeat = atoi(value); } else { debug_printf("Unknown %s: %s=%s", type, token, value); } continue; } if (strcmp(token, "level") == 0) { target->level = syslogd_level(value); continue; } switch (target->target) { case SYSLOG_TARGET_LOCAL: { syslogd_local_config_t *local = (syslogd_local_config_t *)target; if (strcmp(token, "maxsize") == 0) { local->maxsize = atoi(value); } else if (strcmp(token, "markinterval") == 0) { local->markinterval = atoi(value) * 60; } else if (strcmp(token, "numfiles") == 0) { local->numfiles = atoi(value); } else if (strcmp(token, "logfile") == 0) { local->logfile = strdup(value); } else { debug_printf("Unknown %s: %s=%s", type, token, value); } } break; case SYSLOG_TARGET_REMOTE: { syslogd_remote_config_t *remote = (syslogd_remote_config_t *)target; if (strcmp(token, "host") == 0) { remote->host = strdup(value); } else if (strcmp(token, "port") == 0) { remote->port = atoi(value); } else { debug_printf("Unknown %s: %s=%s", type, token, value); } } break; case SYSLOG_TARGET_EMAIL: { syslogd_email_config_t *email = (syslogd_email_config_t *)target; if (strcmp(token, "server") == 0) { email->server = strdup(value); } else if (strcmp(token, "addr") == 0) { if (!email->addr) { email->addr = strdup(value); } else { /* Append this one */ char *pt = malloc(strlen(email->addr) + strlen(value) + 2); sprintf(pt, "%s %s", email->addr, value); free(email->addr); email->addr = pt; } } else if (strcmp(token, "sender") == 0) { email->sender = strdup(value); } else if (strcmp(token, "fromhost") == 0) { email->fromhost = strdup(value); } else if (strcmp(token, "delay") == 0) { email->delay = atoi(value); } else if (strcmp(token, "freq") == 0) { email->freq = atoi(value); } else { debug_printf("Unknown %s: %s=%s", type, token, value); } } } } } /* REVISIT: Validate that the required fields are set for each type */ } } fclose(fh); return 0; } void syslogd_discard_config(syslogd_config_t *config) { while (config->local.common.next) { syslogd_target_t *target = config->local.common.next; config->local.common.next = target->next; free(target->priv); switch (target->target) { #ifdef CONFIG_FEATURE_REMOTE_LOG case SYSLOG_TARGET_REMOTE: { syslogd_remote_config_t *remote = (syslogd_remote_config_t *)target; free(remote->host); } break; #endif #ifdef CONFIG_USER_SMTP_SMTPCLIENT case SYSLOG_TARGET_EMAIL: { syslogd_email_config_t *email = (syslogd_email_config_t *)target; free(email->server); free(email->addr); free(email->fromhost); free(email->sender); } break; #endif default: break; } free(target); } if (config->local.logfile != __LOG_FILE) free(config->local.logfile); free(config->local.common.priv); }
// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef V8_ZONE_INL_H_ #define V8_ZONE_INL_H_ #include "zone.h" #include "counters.h" #include "isolate.h" #include "utils.h" #include "v8-counters.h" namespace v8 { namespace internal { inline void* Zone::New(int size) { ASSERT(ZoneScope::nesting() > 0); // Round up the requested size to fit the alignment. size = RoundUp(size, kAlignment); // If the allocation size is divisible by 8 then we return an 8-byte aligned // address. if (kPointerSize == 4 && kAlignment == 4) { position_ += ((~size) & 4) & (reinterpret_cast<intptr_t>(position_) & 4); } else { ASSERT(kAlignment >= kPointerSize); } // Check if the requested size is available without expanding. Address result = position_; if (size > limit_ - position_) { result = NewExpand(size); } else { position_ += size; } // Check that the result has the proper alignment and return it. ASSERT(IsAddressAligned(result, kAlignment, 0)); allocation_size_ += size; return reinterpret_cast<void*>(result); } template <typename T> T* Zone::NewArray(int length) { return static_cast<T*>(New(length * sizeof(T))); } bool Zone::excess_allocation() { return segment_bytes_allocated_ > zone_excess_limit_; } void Zone::adjust_segment_bytes_allocated(int delta) { segment_bytes_allocated_ += delta; isolate_->counters()->zone_segment_bytes()->Set(segment_bytes_allocated_); } template <typename Config> ZoneSplayTree<Config>::~ZoneSplayTree() { // Reset the root to avoid unneeded iteration over all tree nodes // in the destructor. For a zone-allocated tree, nodes will be // freed by the Zone. SplayTree<Config, ZoneAllocationPolicy>::ResetRoot(); } void* ZoneObject::operator new(size_t size, Zone* zone) { return zone->New(static_cast<int>(size)); } inline void* ZoneAllocationPolicy::New(size_t size) { ASSERT(zone_); return zone_->New(size); } template <typename T> void* ZoneList<T>::operator new(size_t size, Zone* zone) { return zone->New(static_cast<int>(size)); } ZoneScope::ZoneScope(Isolate* isolate, ZoneScopeMode mode) : isolate_(isolate), mode_(mode) { isolate_->zone()->scope_nesting_++; } bool ZoneScope::ShouldDeleteOnExit() { return isolate_->zone()->scope_nesting_ == 1 && mode_ == DELETE_ON_EXIT; } int ZoneScope::nesting() { return Isolate::Current()->zone()->scope_nesting_; } } } // namespace v8::internal #endif // V8_ZONE_INL_H_
/* SPDX-License-Identifier: GPL-2.0 */ /* * include/configs/porter.h * This file is Porter board configuration. * * Copyright (C) 2015 Renesas Electronics Corporation * Copyright (C) 2015 Cogent Embedded, Inc. */ #ifndef __PORTER_H #define __PORTER_H #include "rcar-gen2-common.h" #define CONFIG_SYS_INIT_SP_ADDR 0x4f000000 #define STACK_AREA_SIZE 0x00100000 #define LOW_LEVEL_MERAM_STACK \ (CONFIG_SYS_INIT_SP_ADDR + STACK_AREA_SIZE - 4) /* MEMORY */ #define RCAR_GEN2_SDRAM_BASE 0x40000000 #define RCAR_GEN2_SDRAM_SIZE (2048u * 1024 * 1024) #define RCAR_GEN2_UBOOT_SDRAM_SIZE (1024u * 1024 * 1024) /* FLASH */ #define CONFIG_SPI_FLASH_QUAD /* SH Ether */ #define CONFIG_SH_ETHER_USE_PORT 0 #define CONFIG_SH_ETHER_PHY_ADDR 0x1 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII #define CONFIG_SH_ETHER_CACHE_WRITEBACK #define CONFIG_SH_ETHER_CACHE_INVALIDATE #define CONFIG_SH_ETHER_ALIGNE_SIZE 64 #define CONFIG_BITBANGMII #define CONFIG_BITBANGMII_MULTI /* Board Clock */ #define RMOBILE_XTAL_CLK 20000000u #define CONFIG_SYS_CLK_FREQ RMOBILE_XTAL_CLK #define CONFIG_SH_TMU_CLK_FREQ (CONFIG_SYS_CLK_FREQ / 2) #define CONFIG_SYS_TMU_CLK_DIV 4 #define CONFIG_EXTRA_ENV_SETTINGS \ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" /* SPL support */ #define CONFIG_SPL_TEXT_BASE 0xe6300000 #define CONFIG_SPL_STACK 0xe6340000 #define CONFIG_SPL_MAX_SIZE 0x4000 #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x140000 #ifdef CONFIG_SPL_BUILD #define CONFIG_CONS_SCIF0 #define CONFIG_SH_SCIF_CLK_FREQ 65000000 #endif #endif /* __PORTER_H */
/* Copyright (C) 2001-2003 KSVG Team This file is part of the KDE project This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SVGPathSegList_H #define SVGPathSegList_H namespace KSVG { class SVGPathSeg; class SVGPathSegListImpl; class SVGPathSegList { public: SVGPathSegList(); SVGPathSegList(const SVGPathSegList &); SVGPathSegList &operator=(const SVGPathSegList &other); SVGPathSegList(SVGPathSegListImpl *); ~SVGPathSegList(); unsigned long numberOfItems() const; void clear(); SVGPathSeg *initialize(SVGPathSeg *newItem); SVGPathSeg *getItem(unsigned long index); SVGPathSeg *insertItemBefore(SVGPathSeg *newItem, unsigned long index); SVGPathSeg *replaceItem(SVGPathSeg *newItem, unsigned long index); SVGPathSeg *removeItem(unsigned long index); SVGPathSeg *appendItem(SVGPathSeg *newItem); // Internal! - NOT PART OF THE SVG SPECIFICATION SVGPathSegListImpl *handle() const { return impl; } private: SVGPathSegListImpl *impl; }; } #endif // vim:ts=4:noet
/**************************************************************************/ /* */ /* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ /* software is allowed according to terms specified in the file LICENSE */ /* which comes in the source distribution. */ /* */ /* Check http://www.nomachine.com/licensing.html for applicability. */ /* */ /* NX and NoMachine are trademarks of Medialogic S.p.A. */ /* */ /* All rights reserved. */ /* */ /**************************************************************************/ #ifndef Types_H #define Types_H using namespace std; #include <vector> #include <list> #include <map> #include <set> #include "MD5.h" // // This is MD5 length. // #define MD5_LENGTH 16 // // Types of repositories. Replace the original // clear() methods from STL in order to actually // free the unused memory. // class Message; class T_data : public vector < unsigned char > { public: unsigned char *begin() { return &*(vector < unsigned char >::begin()); } const unsigned char *begin() const { return &*(vector < unsigned char >::begin()); } // Avoid overriding clear() when using libc++. Fiddling with STL internals // doesn't really seem like a good idea to me anyway. #ifndef _LIBCPP_VECTOR void clear() { #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) #if defined(__GLIBCPP_INTERNAL_VECTOR_H) _Destroy(_M_start, _M_finish); #else /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ destroy(_M_start, _M_finish); #endif /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ _M_deallocate(_M_start, _M_end_of_storage - _M_start); _M_start = _M_finish = _M_end_of_storage = 0; #else /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ #if defined(_GLIBCXX_VECTOR) _Destroy(this->_M_impl._M_start, this->_M_impl._M_finish); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = this->_M_impl._M_finish = this->_M_impl._M_end_of_storage = 0; #else /* #if defined(_GLIBCXX_VECTOR) */ destroy(start, finish); deallocate(); start = finish = end_of_storage = 0; #endif /* #if defined(_GLIBCXX_VECTOR) */ #endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ } #endif /* #ifdef _LIBCPP_VECTOR */ }; class T_messages : public vector < Message * > { public: // Avoid overriding clear() when using libc++. Fiddling with STL internals // doesn't really seem like a good idea to me anyway. #ifndef _LIBCPP_VECTOR void clear() { #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) #if defined(__GLIBCPP_INTERNAL_VECTOR_H) _Destroy(_M_start, _M_finish); #else /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ destroy(_M_start, _M_finish); #endif /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ _M_deallocate(_M_start, _M_end_of_storage - _M_start); _M_start = _M_finish = _M_end_of_storage = 0; #else /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ #if defined(_GLIBCXX_VECTOR) _Destroy(this->_M_impl._M_start, this->_M_impl._M_finish); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = this->_M_impl._M_finish = this->_M_impl._M_end_of_storage = 0; #else /* #if defined(_GLIBCXX_VECTOR) */ destroy(start, finish); deallocate(); start = finish = end_of_storage = 0; #endif /* #if defined(_GLIBCXX_VECTOR) */ #endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ } #endif /* #ifndef _LIBCPP_VECTOR */ }; typedef md5_byte_t * T_checksum; struct T_less { bool operator()(T_checksum a, T_checksum b) const { return (memcmp(a, b, MD5_LENGTH) < 0); } }; typedef map < T_checksum, int, T_less > T_checksums; class Split; typedef list < Split * > T_splits; class File; struct T_older { bool operator()(File *a, File *b) const; }; typedef set < File *, T_older > T_files; typedef list < int > T_list; // // Used to accommodate data to be read and // written to a socket. // typedef struct { T_data data_; int length_; int start_; } T_buffer; // // The message store operation that was // executed for the message. The channels // use these values to determine how to // handle the message after it has been // received at the decoding side. // enum T_store_action { is_hit, is_added, is_discarded, is_removed, is_added_compat = 0, is_hit_compat = 1 }; #define IS_HIT (control -> isProtoStep8() == 1 ? is_hit : is_hit_compat) #define IS_ADDED (control -> isProtoStep8() == 1 ? is_added : is_added_compat) enum T_checksum_action { use_checksum, discard_checksum }; enum T_data_action { use_data, discard_data }; // // Message is going to be weighted for // deletion at insert or cleanup time? // enum T_rating { rating_for_insert, rating_for_clean }; // // How to handle the writes to the X // and proxy connections. // enum T_write { write_immediate, write_delayed }; enum T_flush { flush_if_needed, flush_if_any }; // // This is the value to indicate an // invalid position in the message // store. // static const int nothing = -1; #endif /* Types_H */
/* * Copyright (C) 2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include "Node.h" #include "StyleChange.h" #include "StyleRelations.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/ListHashSet.h> #include <wtf/RefPtr.h> namespace WebCore { class ContainerNode; class Document; class Element; class Node; class RenderStyle; class Text; namespace Style { struct ElementUpdate { ElementUpdate() = default; ElementUpdate(std::unique_ptr<RenderStyle> style, Change change, bool recompositeLayer) : style(WTFMove(style)) , change(change) , recompositeLayer(recompositeLayer) { } std::unique_ptr<RenderStyle> style; Change change { NoChange }; bool recompositeLayer { false }; }; class Update { WTF_MAKE_FAST_ALLOCATED; public: Update(Document&); const ListHashSet<ContainerNode*>& roots() const { return m_roots; } const ElementUpdate* elementUpdate(const Element&) const; ElementUpdate* elementUpdate(const Element&); bool textUpdate(const Text&) const; const RenderStyle* elementStyle(const Element&) const; RenderStyle* elementStyle(const Element&); const Document& document() const { return m_document; } unsigned size() const { return m_elements.size() + m_texts.size(); } void addElement(Element&, Element* parent, ElementUpdate&&); void addText(Text&, Element* parent); void addText(Text&); private: void addPossibleRoot(Element*); Document& m_document; ListHashSet<ContainerNode*> m_roots; HashMap<const Element*, ElementUpdate> m_elements; HashSet<const Text*> m_texts; }; } }
/* * get_file_size.c - Part of AFD, an automatic file distribution program. * Copyright (c) 1996 - 2009 Deutscher Wetterdienst (DWD), * Holger Kiehl <Holger.Kiehl@dwd.de> * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "afddefs.h" DESCR__S_M1 /* ** NAME ** get_file_size - gets the size of a file in bytes ** ** SYNOPSIS ** get_file_size <file-name 1> [<file-name 2> ... <file-name n>] ** ** DESCRIPTION ** ** RETURN VALUES ** SUCCESS on normal exit and INCORRECT when an error has occurred. ** ** AUTHOR ** H.Kiehl ** ** HISTORY ** 27.11.1996 H.Kiehl Created ** */ DESCR__E_M1 #include <stdio.h> /* fprintf() */ #include <string.h> /* strerror() */ #include <stdlib.h> /* exit() */ #include <sys/types.h> #include <sys/stat.h> #include <errno.h> /*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ main() $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/ int main(int argc, char *argv[]) { int i; off_t file_size = 0; struct stat stat_buf; if (argc == 1) { (void)fprintf(stderr, _("Usage: %s <file-name 1> [<file-name 2> ... <file-name n>]\n"), argv[0]); exit(INCORRECT); } for (i = 1; i < argc; i++) { if (stat(argv[i], &stat_buf) < 0) { (void)fprintf(stderr, _("Failed to stat() `%s' : %s\n"), argv[i], strerror(errno)); continue; } file_size += stat_buf.st_size; } #if SIZEOF_OFF_T == 4 (void)fprintf(stdout, "%ld\n", (pri_off_t)file_size); #else (void)fprintf(stdout, "%lld\n", (pri_off_t)file_size); #endif exit(SUCCESS); }
/* * Spinlock Manager -- Translate SuperCore Status * * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. * * $Id: pspinlocktranslatereturncode.c,v 1.3 2007/11/30 20:34:13 humph Exp $ */ #if HAVE_CONFIG_H #include "config.h" #endif #include <pthread.h> #include <errno.h> #include <rtems/system.h> #include <rtems/score/corespinlock.h> /* * _POSIX_Spinlock_Translate_core_spinlock_return_code * * Input parameters: * the_spinlock_status - spinlock status code to translate * * Output parameters: * status code - translated POSIX status code * */ static int _POSIX_Spinlock_Return_codes[CORE_SPINLOCK_STATUS_LAST + 1] = { 0, /* CORE_SPINLOCK_SUCCESSFUL */ EDEADLK, /* CORE_SPINLOCK_HOLDER_RELOCKING */ EPERM, /* CORE_SPINLOCK_NOT_HOLDER */ -1, /* CORE_SPINLOCK_TIMEOUT */ EBUSY, /* CORE_SPINLOCK_IS_BUSY */ EBUSY, /* CORE_SPINLOCK_UNAVAILABLE */ 0 /* CORE_SPINLOCK_NOT_LOCKED */ }; int _POSIX_Spinlock_Translate_core_spinlock_return_code( CORE_spinlock_Status the_spinlock_status ) { /* * Internal consistency check for bad status from SuperCore */ #if defined(RTEMS_DEBUG) if ( the_spinlock_status > CORE_SPINLOCK_STATUS_LAST ) return EINVAL; #endif return _POSIX_Spinlock_Return_codes[the_spinlock_status]; }
/* This file is part of the KDE project Copyright (C) 2010 Colin Guthrie <cguthrie@mandriva.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef PHONON_TESTSPEAKERWIDGET_H #define PHONON_TESTSPEAKERWIDGET_H #include <QPushButton> #include <canberra.h> #include <pulse/pulseaudio.h> class AudioSetup; class TestSpeakerWidget: public QPushButton { Q_OBJECT public: TestSpeakerWidget(const pa_channel_position_t pos, ca_context *canberra, AudioSetup* ss); ~TestSpeakerWidget(); public slots: void onFinish(); private slots: void onToggle(bool); private: QString _positionName(); const char* _positionAsString(); const char* _positionSoundName(); AudioSetup* m_Ss; pa_channel_position_t m_Pos; ca_context* m_Canberra; }; #endif // PHONON_TESTSPEAKERWIDGET_H
/* This file is a part of the NVDA project. URL: http://www.nvda-project.org/ Copyright 2010-2012 World Light Information Limited and Hong Kong Blind Union. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2.0, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This license can be found at: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ #ifndef IME_H #define IME_H void IME_inProcess_initialize(); void IME_inProcess_terminate(); extern HWND curIMEWindow; extern bool disableIMEConversionModeUpdateReporting; void handleIMEConversionModeUpdate(HWND hwnd, bool report); #endif
/* 描述 根据输入的半径值,计算球的体积。 输入 输入数据有多组,每组占一行,每行包括一个实数,表示球的半径。(0<R<100) 输出 输出对应的球的体积,对于每组输入数据,输出一行,计算结果四舍五入为整数 Hint:PI=3.1415926 样例输入 1 1.5 样例输出 4 14 */ #include <stdio.h> //#define PI 3.1415926 int main(int argc, char *argv[]) { double r,s1; int s2; while (~scanf("%lf",&r)){ // s1 =4/3.0*PI*r*r*r;//从左到右算,如果是4/3,则两个都是整数在算,结果会被强制转换为1 s1 = 4/3.0*3.1415926*r*r*r; s2 = (int)(s1+0.5); printf("%d\n\n",s2); } return 0; }
/* $Id$ */ /* * This file is part of OpenTTD. * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. */ /** @file textbuf_type.h Stuff related to text buffers. */ #ifndef TEXTBUF_TYPE_H #define TEXTBUF_TYPE_H #include "string_type.h" #include "strings_type.h" /** Helper/buffer for input fields. */ struct Textbuf { char * const buf; ///< buffer in which text is saved uint16 max_bytes; ///< the maximum size of the buffer in bytes (including terminating '\0') uint16 max_chars; ///< the maximum size of the buffer in characters (including terminating '\0') uint16 bytes; ///< the current size of the string in bytes (including terminating '\0') uint16 chars; ///< the current size of the string in characters (including terminating '\0') uint16 pixels; ///< the current size of the string in pixels bool caret; ///< is the caret ("_") visible or not uint16 caretpos; ///< the current position of the caret in the buffer, in bytes uint16 caretxoffs; ///< the current position of the caret in pixels explicit Textbuf(uint16 max_bytes, uint16 max_chars = UINT16_MAX); ~Textbuf(); void Assign(StringID string); void Assign(const char *text); void CDECL Print(const char *format, ...) WARN_FORMAT(2, 3); void DeleteAll(); bool DeleteChar(int delmode); bool InsertChar(uint32 key); bool InsertClipboard(); bool MovePos(int navmode); bool HandleCaret(); void UpdateSize(); private: bool CanDelChar(bool backspace); WChar GetNextDelChar(bool backspace); void DelChar(bool backspace); bool CanMoveCaretLeft(); WChar MoveCaretLeft(); bool CanMoveCaretRight(); WChar MoveCaretRight(); }; #endif /* TEXTBUF_TYPE_H */
#ifndef _FT1000_USB_H_ #define _FT1000_USB_H_ /*Jim*/ #include "../ft1000.h" #include "ft1000_ioctl.h" #define FT1000_DRV_VER 0x01010403 #define MAX_NUM_APP 6 #define MAX_MSG_LIMIT 200 #define NUM_OF_FREE_BUFFERS 1500 #define PSEUDOSZ 16 #define SUCCESS 0x00 struct app_info_block { u32 nTxMsg; // DPRAM msg sent to DSP with app_id u32 nRxMsg; // DPRAM msg rcv from dsp with app_id u32 nTxMsgReject; // DPRAM msg rejected due to DSP doorbell set u32 nRxMsgMiss; // DPRAM msg dropped due to overflow struct fown_struct *fileobject;// Application's file object u16 app_id; // Application id int DspBCMsgFlag; int NumOfMsg; // number of messages queued up wait_queue_head_t wait_dpram_msg; struct list_head app_sqlist; // link list of msgs for applicaton on slow queue } __attribute__((packed)); /*end of Jim*/ #define DEBUG(args...) printk(KERN_INFO args) #define FALSE 0 #define TRUE 1 #define STATUS_SUCCESS 0 #define STATUS_FAILURE 0x1001 #define FT1000_STATUS_CLOSING 0x01 #define LARGE_TIMEOUT 5000 #define DSPBCMSGID 0x10 /* Electrabuzz specific DPRAM mapping */ /* this is used by ft1000_usb driver - isn't that a bug? */ #undef FT1000_DPRAM_RX_BASE #define FT1000_DPRAM_RX_BASE 0x1800 /* RX AREA (SlowQ) */ // MEMORY MAP FOR MAGNEMITE /* the indexes are swapped comparing to PCMCIA - is it OK or a bug? */ #undef FT1000_MAG_DSP_LED_INDX #define FT1000_MAG_DSP_LED_INDX 0x1 /* dsp led status for PAD device */ #undef FT1000_MAG_DSP_CON_STATE_INDX #define FT1000_MAG_DSP_CON_STATE_INDX 0x0 /* DSP Connection Status Info */ // Maximum times trying to get ASIC out of reset #define MAX_ASIC_RESET_CNT 20 #define MAX_BUF_SIZE 4096 struct ft1000_device { struct usb_device *dev; struct net_device *net; u32 status; struct urb *rx_urb; struct urb *tx_urb; u8 tx_buf[MAX_BUF_SIZE]; u8 rx_buf[MAX_BUF_SIZE]; u8 bulk_in_endpointAddr; u8 bulk_out_endpointAddr; //struct ft1000_ethernet_configuration configuration; // struct net_device_stats stats; //mbelian } __attribute__ ((packed)); struct ft1000_debug_dirs { struct list_head list; struct dentry *dent; struct dentry *file; int int_number; }; struct ft1000_info { struct ft1000_device *pFt1000Dev; struct net_device_stats stats; struct task_struct *pPollThread; unsigned char fcodeldr; unsigned char bootmode; unsigned char usbboot; unsigned short dspalive; u16 ASIC_ID; bool fProvComplete; bool fCondResetPend; bool fAppMsgPend; u16 DrvErrNum; u16 AsicID; int DspAsicReset; int DeviceCreated; int CardReady; int NetDevRegDone; u8 CardNumber; u8 DeviceName[15]; struct ft1000_debug_dirs nodes; int registered; int mediastate; u8 squeseqnum; // sequence number on slow queue spinlock_t dpram_lock; spinlock_t fifo_lock; u16 fifo_cnt; u8 DspVer[DSPVERSZ]; // DSP version number u8 HwSerNum[HWSERNUMSZ]; // Hardware Serial Number u8 Sku[SKUSZ]; // SKU u8 eui64[EUISZ]; // EUI64 time_t ConTm; // Connection Time u8 ProductMode[MODESZ]; u8 RfCalVer[CALVERSZ]; u8 RfCalDate[CALDATESZ]; u16 DSP_TIME[4]; u16 LedStat; //mbelian u16 ConStat; //mbelian u16 ProgConStat; struct list_head prov_list; int appcnt; struct app_info_block app_info[MAX_NUM_APP]; u16 DSPInfoBlklen; u16 DrvMsgPend; int (*ft1000_reset)(struct net_device *dev); u16 DSPInfoBlk[MAX_DSP_SESS_REC]; union { u16 Rec[MAX_DSP_SESS_REC]; u32 MagRec[MAX_DSP_SESS_REC/2]; } DSPSess; unsigned short tempbuf[32]; char netdevname[IFNAMSIZ]; struct proc_dir_entry *ft1000_proc_dir; //mbelian }; struct dpram_blk { struct list_head list; u16 *pbuffer; } __attribute__ ((packed)); int ft1000_read_register(struct ft1000_device *ft1000dev, u16* Data, u16 nRegIndx); int ft1000_write_register(struct ft1000_device *ft1000dev, u16 value, u16 nRegIndx); int ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u16 cnt); int ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u16 cnt); int ft1000_read_dpram16(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u8 highlow); int ft1000_write_dpram16(struct ft1000_device *ft1000dev, u16 indx, u16 value, u8 highlow); int fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer); int fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer); extern void *pFileStart; extern size_t FileLength; extern int numofmsgbuf; int ft1000_close (struct net_device *dev); u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, u32 FileLength); extern struct list_head freercvpool; extern spinlock_t free_buff_lock; // lock to arbitrate free buffer list for receive command data int ft1000_create_dev(struct ft1000_device *dev); void ft1000_destroy_dev(struct net_device *dev); extern void card_send_command(struct ft1000_device *ft1000dev, void *ptempbuffer, int size); struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist); void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist); int dsp_reload(struct ft1000_device *ft1000dev); int init_ft1000_netdev(struct ft1000_device *ft1000dev); struct usb_interface; int reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct usb_interface *intf); int ft1000_poll(void* dev_id); int ft1000_init_proc(struct net_device *dev); void ft1000_cleanup_proc(struct ft1000_info *info); #endif
/* * Copyright (c) 2003 Century Software, Inc. All Rights Reserved. * * This file is part of the PIXIL Operating Environment * * The use, copying and distribution of this file is governed by one * of two licenses, the PIXIL Commercial License, or the GNU General * Public License, version 2. * * Licensees holding a valid PIXIL Commercial License may use this file * in accordance with the PIXIL Commercial License Agreement provided * with the Software. Others are governed under the terms of the GNU * General Public License version 2. * * This file may be distributed and/or modified under the terms of the * GNU General Public License version 2 as published by the Free * Software Foundation and appearing in the file LICENSE.GPL included * in the packaging of this file. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. * * RESTRICTED RIGHTS LEGEND * * Use, duplication, or disclosure by the government is subject to * restriction as set forth in paragraph (b)(3)(b) of the Rights in * Technical Data and Computer Software clause in DAR 7-104.9(a). * * See http://www.pixil.org/gpl/ for GPL licensing * information. * * See http://www.pixil.org/license.html or * email cetsales@centurysoftware.com for information about the PIXIL * Commercial License Agreement, or if any conditions of this licensing * are not clear to you. */ #ifndef NXDB_H #define NXDB_H #ifdef WIN32 #pragma warning(disable:4786) #endif #include <stdio.h> #include <map> #include <string> extern "C" { #include "file.h" } #ifdef WIN32 #ifdef _DEBUG #define DEBUG #endif using namespace std; #endif typedef map < string, int, less < string > >TDatabase; typedef TDatabase::value_type TValue; #define INT_INDEX 7 #define CHAR_INDEX 5 #define TEMP_DB "/tmp/c0bxztemp" class NxDb { private: TDatabase db; int dbNum; int index[255]; fildes * dbDesc[255]; field * dbField[255]; string path; // Register the Database void Register(string _dbName, fildes * _dbDesc, field * _dbField, int var); public:enum t_Flags { NONE = 0x00, DELETED = 0x01, NEW = 0x02, CHANGED = 0x04, ERASED = 0xF0, }; public:NxDb(int argc, char *argv[]); void SetPath(const char *c) { path = c; } char * GetPath() { char * tmp = (char *) path. c_str(); return tmp; } // Basic Database Operations int Open(string _dbName, fildes * _dbDesc, field * _dbField, int var, int path_flag = 0); int Close(string _dbName); // Creates a totally new Database (note: each instace can only have this one table) int Create(string _dbName, fildes * _dbDesc, field * _dbField, int var, int path_flag = 0); // Basic Record Operations // Creates a list of record numbers matching specific criteria // You then use Extract to get specific record numbers int Select(string _dbName, int *ret, int ret_size, bool bDeleteFlag = false, int flags = -1); int Select(string _dbName, char *value, int fieldNo, int *ret, int ret_size, bool bDeleteFlag = false); // Gets all fields or a specific field from a specific record int Extract(string _dbName, int recno, int fieldNo, char *ret_buf); int Extract(string _dbName, int recno, char *ret_buf); // Gets a specific field ONLY from a deleted record. int ExtractDeleted(string _dbName, int recno, int fieldNo, char *ret_buf); // Always inserts a new record by setting the NEW bit flag void Insert(string _dbName, char *record); void Insert(string _dbName, char *record, int &rec); // Makes changes to a record data void Edit(string _dbName, int recno, char *record); // Logically deletes a record void DeleteRec(string _dbName, int recno); // Logically deletes all records in database, if fieldNo == -1 // OR logically deletes any records containing value in fieldNo. void Purge(string _dbName, int fieldNo = -1, char *value = 0); // Perm. deletes a record void EraseRec(string _dbName, int recno); // Sets Record metadata to flags int SetFlags(const string _dbName, const int &recno, const int &flags); int GetFlags(const string _dbName, const int &recno, int &flags); // Returns the number of total records in a database int NumRecs(string _dbName); fildes * GetFilDes(string _dbName); field * GetField(string _dbName); }; void fatal(int n); #endif //NXDB_H
/****************************************************************************** * * * Copyright (C) 2015, 2016, 2017 Xilinx, Inc. * * 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 * ******************************************************************************/ /*****************************************************************************/ /** * * @file xv_hdmirx_sinit.c * * This file contains static initialization method for Xilinx HDMI RX core. * * <pre> * MODIFICATION HISTORY: * * Ver Who Date Changes * ----- ------ -------- -------------------------------------------------- * 1.0 gm, mg 10/07/15 Initial release. * </pre> * ******************************************************************************/ /***************************** Include Files *********************************/ #include "xv_hdmirx.h" /************************** Constant Definitions *****************************/ /***************** Macros (Inline Functions) Definitions *********************/ /**************************** Type Definitions *******************************/ /************************** Function Prototypes ******************************/ /************************** Variable Definitions *****************************/ /************************** Function Definitions *****************************/ /*****************************************************************************/ /** * * This function returns a reference to an XV_HdmiRx_Config structure based * on the core id, <i>DeviceId</i>. The return value will refer to an entry in * the device configuration table defined in the xv_hdmirx_g.c file. * * @param DeviceId is the unique core ID of the HDMI RX core for the * lookup operation. * * @return XV_HdmiRx_LookupConfig returns a reference to a config record * in the configuration table (in xv_hdmirx_g.c) corresponding * to <i>DeviceId</i>, or NULL if no match is found. * * @note None. * ******************************************************************************/ XV_HdmiRx_Config *XV_HdmiRx_LookupConfig(u16 DeviceId) { extern XV_HdmiRx_Config XV_HdmiRx_ConfigTable[XPAR_XV_HDMIRX_NUM_INSTANCES]; XV_HdmiRx_Config *CfgPtr = NULL; u32 Index; /* Checking for device id for which instance it is matching */ for (Index = (u32)0x0; Index < (u32)(XPAR_XV_HDMIRX_NUM_INSTANCES); Index++) { /* Assigning address of config table if both device ids * are matched */ if (XV_HdmiRx_ConfigTable[Index].DeviceId == DeviceId) { CfgPtr = &XV_HdmiRx_ConfigTable[Index]; break; } } return (XV_HdmiRx_Config *)CfgPtr; }
/* Copyright (c) 2010 Samuel Lidén Borell <samuel@kodafritt.se> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "config.h" #include <glib.h> #include <stdlib.h> #include <string.h> #include "irc.h" #include "fish.h" #include "keystore.h" #include "plugin_hexchat.h" static char *keystore_password = NULL; /** * Opens the key store file: ~/.config/hexchat/addon_fishlim.conf */ static GKeyFile *getConfigFile(void) { gchar *filename = get_config_filename(); GKeyFile *keyfile = g_key_file_new(); g_key_file_load_from_file(keyfile, filename, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, NULL); g_free(filename); return keyfile; } /** * Returns the key store password, or the default. */ static const char *get_keystore_password(void) { return (keystore_password != NULL ? keystore_password : /* Silly default value... */ "blowinikey"); } /** * Gets a value for a nick/channel from addon_fishlim.conf. Unlike * g_key_file_get_string, this function is case insensitive. */ static gchar *get_nick_value(GKeyFile *keyfile, const char *nick, const char *item) { gchar **group; gchar **groups = g_key_file_get_groups(keyfile, NULL); gchar *result = NULL; for (group = groups; *group != NULL; group++) { if (!irc_nick_cmp(*group, nick)) { result = g_key_file_get_string(keyfile, *group, item, NULL); break; } } g_strfreev(groups); return result; } /** * Extracts a key from the key store file. */ char *keystore_get_key(const char *nick) { /* Get the key */ GKeyFile *keyfile = getConfigFile(); gchar *value = get_nick_value(keyfile, nick, "key"); g_key_file_free(keyfile); if (!value) return NULL; if (strncmp(value, "+OK ", 4) != 0) { /* Key is stored in plaintext */ return value; } else { /* Key is encrypted */ const char *encrypted = value+4; const char *password = get_keystore_password(); char *decrypted = fish_decrypt(password, strlen(password), encrypted); g_free(value); return decrypted; } } /** * Deletes a nick and the associated key in the key store file. */ static gboolean delete_nick(GKeyFile *keyfile, const char *nick) { gchar **group; gchar **groups = g_key_file_get_groups(keyfile, NULL); gboolean ok = FALSE; for (group = groups; *group != NULL; group++) { if (!irc_nick_cmp(*group, nick)) { ok = g_key_file_remove_group(keyfile, *group, NULL); break; } } g_strfreev(groups); return ok; } #if !GLIB_CHECK_VERSION(2,40,0) /** * Writes the key store file to disk. */ static gboolean keyfile_save_to_file (GKeyFile *keyfile, char *filename) { gboolean ok; /* Serialize */ gsize file_length; gchar *file_data = g_key_file_to_data(keyfile, &file_length, NULL); if (!file_data) return FALSE; /* Write to file */ ok = g_file_set_contents (filename, file_data, file_length, NULL); g_free(file_data); return ok; } #endif /** * Writes the key store file to disk. */ static gboolean save_keystore(GKeyFile *keyfile) { char *filename; gboolean ok; filename = get_config_filename(); #if !GLIB_CHECK_VERSION(2,40,0) ok = keyfile_save_to_file (keyfile, filename); #else ok = g_key_file_save_to_file (keyfile, filename, NULL); #endif g_free (filename); return ok; } /** * Sets a key in the key store file. */ gboolean keystore_store_key(const char *nick, const char *key) { const char *password; char *encrypted; char *wrapped; gboolean ok = FALSE; GKeyFile *keyfile = getConfigFile(); /* Remove old key */ delete_nick(keyfile, nick); /* Add new key */ password = get_keystore_password(); if (password) { /* Encrypt the password */ encrypted = fish_encrypt(password, strlen(password), key); if (!encrypted) goto end; /* Prepend "+OK " */ wrapped = g_strconcat("+OK ", encrypted, NULL); g_free(encrypted); /* Store encrypted in file */ g_key_file_set_string(keyfile, nick, "key", wrapped); g_free(wrapped); } else { /* Store unencrypted in file */ g_key_file_set_string(keyfile, nick, "key", key); } /* Save key store file */ ok = save_keystore(keyfile); end: g_key_file_free(keyfile); return ok; } /** * Deletes a nick from the key store. */ gboolean keystore_delete_nick(const char *nick) { GKeyFile *keyfile = getConfigFile(); /* Delete entry */ gboolean ok = delete_nick(keyfile, nick); /* Save */ if (ok) save_keystore(keyfile); g_key_file_free(keyfile); return ok; }
typedef void (*tgp_func)(running_machine &machine); enum {FIFO_SIZE = 256}; enum {MAT_STACK_SIZE = 32}; class model1_state : public driver_device { public: model1_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) { } struct view *m_view; struct point *m_pointdb; struct point *m_pointpt; struct quad_m1 *m_quaddb; struct quad_m1 *m_quadpt; struct quad_m1 **m_quadind; int m_sound_irq; int m_to_68k[8]; int m_fifo_wptr; int m_fifo_rptr; int m_last_irq; UINT16 *m_mr; UINT16 *m_mr2; int m_dump; UINT16 *m_display_list0; UINT16 *m_display_list1; UINT16 *m_color_xlat; offs_t m_pushpc; int m_fifoin_rpos; int m_fifoin_wpos; UINT32 m_fifoin_data[FIFO_SIZE]; int m_swa; int m_fifoin_cbcount; tgp_func m_fifoin_cb; INT32 m_fifoout_rpos; INT32 m_fifoout_wpos; UINT32 m_fifoout_data[FIFO_SIZE]; UINT32 m_list_length; float m_cmat[12]; float m_mat_stack[MAT_STACK_SIZE][12]; float m_mat_vector[21][12]; INT32 m_mat_stack_pos; float m_acc; float m_tgp_vf_xmin; float m_tgp_vf_xmax; float m_tgp_vf_zmin; float m_tgp_vf_zmax; float m_tgp_vf_ygnd; float m_tgp_vf_yflr; float m_tgp_vf_yjmp; float m_tgp_vr_circx; float m_tgp_vr_circy; float m_tgp_vr_circrad; float m_tgp_vr_cbox[12]; int m_tgp_vr_select; UINT16 m_ram_adr; UINT16 m_ram_latch[2]; UINT16 m_ram_scanadr; UINT32 *m_ram_data; float m_tgp_vr_base[4]; int m_puuu; int m_ccount; UINT32 m_copro_r; UINT32 m_copro_w; int m_copro_fifoout_rpos; int m_copro_fifoout_wpos; UINT32 m_copro_fifoout_data[FIFO_SIZE]; int m_copro_fifoout_num; int m_copro_fifoin_rpos; int m_copro_fifoin_wpos; UINT32 m_copro_fifoin_data[FIFO_SIZE]; int m_copro_fifoin_num; UINT32 m_vr_r; UINT32 m_vr_w; UINT16 m_listctl[2]; UINT16 *m_glist; int m_render_done; UINT16 *m_tgp_ram; UINT16 *m_paletteram16; UINT32 *m_poly_rom; UINT32 *m_poly_ram; }; /*----------- defined in machine/model1.c -----------*/ extern const mb86233_cpu_core model1_vr_tgp_config; READ16_HANDLER( model1_tgp_copro_r ); WRITE16_HANDLER( model1_tgp_copro_w ); READ16_HANDLER( model1_tgp_copro_adr_r ); WRITE16_HANDLER( model1_tgp_copro_adr_w ); READ16_HANDLER( model1_tgp_copro_ram_r ); WRITE16_HANDLER( model1_tgp_copro_ram_w ); READ16_HANDLER( model1_vr_tgp_r ); WRITE16_HANDLER( model1_vr_tgp_w ); READ16_HANDLER( model1_tgp_vr_adr_r ); WRITE16_HANDLER( model1_tgp_vr_adr_w ); READ16_HANDLER( model1_vr_tgp_ram_r ); WRITE16_HANDLER( model1_vr_tgp_ram_w ); ADDRESS_MAP_EXTERN( model1_vr_tgp_map, 32 ); MACHINE_START( model1 ); void model1_vr_tgp_reset( running_machine &machine ); void model1_tgp_reset(running_machine &machine, int swa); /*----------- defined in video/model1.c -----------*/ VIDEO_START(model1); SCREEN_UPDATE(model1); SCREEN_EOF(model1); READ16_HANDLER( model1_listctl_r ); WRITE16_HANDLER( model1_listctl_w );
/* Copyright (C) 1997-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SETJMP_H #define _BITS_SETJMP_H 1 #if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif #include <bits/wordsize.h> #if __WORDSIZE == 64 #ifndef _ASM typedef struct __sparc64_jmp_buf { struct __sparc64_jmp_buf *uc_link; unsigned long uc_flags; unsigned long uc_sigmask; struct __sparc64_jmp_buf_mcontext { unsigned long mc_gregs[19]; unsigned long mc_fp; unsigned long mc_i7; struct __sparc64_jmp_buf_fpu { union { unsigned int sregs[32]; unsigned long dregs[32]; long double qregs[16]; } mcfpu_fpregs; unsigned long mcfpu_fprs; unsigned long mcfpu_gsr; void *mcfpu_fq; unsigned char mcfpu_qcnt; unsigned char mcfpu_qentsz; unsigned char mcfpu_enab; } mc_fpregs; } uc_mcontext; } __jmp_buf[1]; #endif #else #ifndef _ASM typedef int __jmp_buf[3]; #endif #endif #endif /* bits/setjmp.h */
#ifndef SCRIPT_API_H #define SCRIPT_API_H #include "flt.h" // Return values from 'script_run' #define SCRIPT_RUN_ENDED 0 #define SCRIPT_RUN_RUNNING 1 #define SCRIPT_RUN_ERROR -1 enum { SCRIPT_SHOOT_HOOK_PRESHOOT=0, SCRIPT_SHOOT_HOOK_SHOOT, SCRIPT_SHOOT_HOOK_RAW, SCRIPT_NUM_SHOOT_HOOKS, }; // Update version if changes are made to the module interface #define SCRIPT_API_VERSION {3,0} // Module interface for script languages (Lua and uBasic) typedef struct { base_interface_t base; int (*script_start)( char const* script, int is_ptp ); // initialize and load script int (*script_start_file)( char const* filename ); // initialize and load script from file int (*script_run)( void ); // run script timeslice void (*script_reset)(void); void (*set_variable)(char *name, int value, int isBool, int isTable, int labelCount, const char **labels); void (*set_as_ret)(int as_ret); // save 'return' value from action stack code (e.g. motion detect, shoot) int (*run_restore)( void ); // run the "restore" function at the end of a script void (*shoot_hook)(int hook); // run a hook in the shooting process, called from hooked task } libscriptapi_sym; extern libscriptapi_sym* libscriptapi; extern void module_set_script_lang( const char* script_file ); #endif
/**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QFORMLAYOUT_H #define QFORMLAYOUT_H #include <QtGui/QLayout> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QFormLayoutPrivate; class Q_GUI_EXPORT QFormLayout : public QLayout { Q_OBJECT Q_ENUMS(FormStyle FieldGrowthPolicy RowWrapPolicy ItemRole) Q_DECLARE_PRIVATE(QFormLayout) Q_PROPERTY(FieldGrowthPolicy fieldGrowthPolicy READ fieldGrowthPolicy WRITE setFieldGrowthPolicy RESET resetFieldGrowthPolicy) Q_PROPERTY(RowWrapPolicy rowWrapPolicy READ rowWrapPolicy WRITE setRowWrapPolicy RESET resetRowWrapPolicy) Q_PROPERTY(Qt::Alignment labelAlignment READ labelAlignment WRITE setLabelAlignment RESET resetLabelAlignment) Q_PROPERTY(Qt::Alignment formAlignment READ formAlignment WRITE setFormAlignment RESET resetFormAlignment) Q_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing) Q_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing) public: enum FieldGrowthPolicy { FieldsStayAtSizeHint, ExpandingFieldsGrow, AllNonFixedFieldsGrow }; enum RowWrapPolicy { DontWrapRows, WrapLongRows, WrapAllRows }; enum ItemRole { LabelRole = 0, FieldRole = 1, SpanningRole = 2 }; explicit QFormLayout(QWidget *parent = 0); ~QFormLayout(); void setFieldGrowthPolicy(FieldGrowthPolicy policy); FieldGrowthPolicy fieldGrowthPolicy() const; void setRowWrapPolicy(RowWrapPolicy policy); RowWrapPolicy rowWrapPolicy() const; void setLabelAlignment(Qt::Alignment alignment); Qt::Alignment labelAlignment() const; void setFormAlignment(Qt::Alignment alignment); Qt::Alignment formAlignment() const; void setHorizontalSpacing(int spacing); int horizontalSpacing() const; void setVerticalSpacing(int spacing); int verticalSpacing() const; int spacing() const; void setSpacing(int); void addRow(QWidget *label, QWidget *field); void addRow(QWidget *label, QLayout *field); void addRow(const QString &labelText, QWidget *field); void addRow(const QString &labelText, QLayout *field); void addRow(QWidget *widget); void addRow(QLayout *layout); void insertRow(int row, QWidget *label, QWidget *field); void insertRow(int row, QWidget *label, QLayout *field); void insertRow(int row, const QString &labelText, QWidget *field); void insertRow(int row, const QString &labelText, QLayout *field); void insertRow(int row, QWidget *widget); void insertRow(int row, QLayout *layout); void setItem(int row, ItemRole role, QLayoutItem *item); void setWidget(int row, ItemRole role, QWidget *widget); void setLayout(int row, ItemRole role, QLayout *layout); QLayoutItem *itemAt(int row, ItemRole role) const; void getItemPosition(int index, int *rowPtr, ItemRole *rolePtr) const; void getWidgetPosition(QWidget *widget, int *rowPtr, ItemRole *rolePtr) const; void getLayoutPosition(QLayout *layout, int *rowPtr, ItemRole *rolePtr) const; QWidget *labelForField(QWidget *field) const; QWidget *labelForField(QLayout *field) const; // reimplemented from QLayout void addItem(QLayoutItem *item); QLayoutItem *itemAt(int index) const; QLayoutItem *takeAt(int index); void setGeometry(const QRect &rect); QSize minimumSize() const; QSize sizeHint() const; void invalidate(); bool hasHeightForWidth() const; int heightForWidth(int width) const; Qt::Orientations expandingDirections() const; int count() const; int rowCount() const; #if 0 void dump() const; #endif private: void resetFieldGrowthPolicy(); void resetRowWrapPolicy(); void resetLabelAlignment(); void resetFormAlignment(); }; QT_END_NAMESPACE QT_END_HEADER #endif
/* Smiley Smiley * By Henk Poley * * Displays lots of Smileys in a ( = the same) smiley pattern. * * Idea taken from "SmallC4.1 for UsGard"-compiler. * * First ported to Ti8xcc. * Later on ported to the Z88DK. */ #pragma string name Smiley Smiley (picture) #pragma output nostreams #pragma data icon 0x3C,0x42,0xA5,0xA5,0x81,0xA5,0x5A,0x3C; #include <stdio.h> #include <games.h> char smile[] = { 8,8, 0x3C, /* defb @00111100 ; oooo */ 0x42, /* defb @01000010 ; o o */ 0xA5, /* defb @10100101 ;o o o o */ 0xA5, /* defb @10100101 ;o o o o */ 0x81, /* defb @10000001 ;o o */ 0xA5, /* defb @10100101 ;o o o o */ 0x5A, /* defb @01011010 ; o oo o */ 0x3C /* defb @00111100 ; oooo */ }; main() { char x, y, temp; for(y=0 ; y<8 ; y++) { temp = smile[y+2]; for(x=0 ; x<8 ; x++) { if(temp & 1) { putsprite(spr_or, 8 * x, 8 * y, smile); } temp >>= 1; } } getk(); /*pause*/ }
/* * Copyright (C) 2008 Samsung Electronics, Inc. * * 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. * */ #ifndef __ASM_ARCH_SEC_HEADSET_H #define __ASM_ARCH_SEC_HEADSET_H #ifdef __KERNEL__ enum { SEC_JACK_NO_DEVICE = 0x0, SEC_HEADSET_4POLE = 0x01 << 0, SEC_HEADSET_3POLE = 0x01 << 1, SEC_TTY_DEVICE = 0x01 << 2, SEC_FM_HEADSET = 0x01 << 3, SEC_FM_SPEAKER = 0x01 << 4, SEC_TVOUT_DEVICE = 0x01 << 5, SEC_EXTRA_DOCK_SPEAKER = 0x01 << 6, SEC_EXTRA_CAR_DOCK_SPEAKER = 0x01 << 7, SEC_UNKNOWN_DEVICE = 0x01 << 8, }; struct sec_jack_zone { unsigned int adc_high; unsigned int delay_ms; unsigned int check_count; unsigned int jack_type; }; struct sec_jack_buttons_zone { unsigned int code; unsigned int adc_low; unsigned int adc_high; }; struct sec_jack_platform_data { void (*set_micbias_state) (bool); int (*get_adc_value) (void); struct sec_jack_zone *zones; struct sec_jack_buttons_zone *buttons_zones; int num_zones; int num_buttons_zones; int det_gpio; int send_end_gpio; bool det_active_high; bool send_end_active_high; }; //unsigned int get_headset_status(void); unsigned int get_headset_status(int *type, int *check); #endif #endif
/* test_keylister.h This file is part of libkleopatra's test suite. Copyright (c) 2004 Klarälvdalens Datakonsult AB Libkleopatra 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. Libkleopatra 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 In addition, as a special exception, the copyright holders give permission to link the code of this program with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ #ifndef __KLEO_TEST_KEYLISTER_H__ #define __KLEO_TEST_KEYLISTER_H__ #include "libkleo/ui/keylistview.h" namespace GpgME { class Key; class KeyListResult; } class CertListView : public Kleo::KeyListView { Q_OBJECT public: explicit CertListView( QWidget * parent=0, Qt::WindowFlags f=0 ); ~CertListView(); public slots: void slotResult( const GpgME::KeyListResult & result ); void slotStart(); }; #endif // __KLEO_TEST_KEYLISTER_H__