text
stringlengths
4
6.14k
#import <Foundation/Foundation.h> #import "SFTableViewSection.h" @protocol SFMediaItem; @interface SFAbstractMediaItemSection : NSObject <SFTableViewSection> - (id)initWithMediaItem:(NSObject<SFMediaItem> *)theMediaItem; @property (nonatomic, assign) BOOL showAlbumName; @property (nonatomic, assign) BOOL showArtistName; @property (nonatomic, readonly) NSObject<SFMediaItem> *mediaItem; //Pure vitual: - (UITableViewCell *)cellForChildItem:(id<SFMediaItem>)childItem atRow:(NSUInteger)row inTableView:(UITableView *)tableView; @end
// // BOXEventsRequest.h // BoxContentSDK // #import "BOXRequest_Private.h" typedef NS_ENUM(NSUInteger, BOXEventsStreamType) { BOXEventsStreamTypeAll = 0, BOXEventsStreamTypeChanges, BOXEventsStreamTypeSync }; @interface BOXEventsRequest : BOXRequest @property (nonatomic, readwrite, strong) NSString *streamPosition; @property (nonatomic, readwrite, assign) BOXEventsStreamType streamType; @property (nonatomic, readwrite, assign) NSInteger limit; //Perform API request and any cache update only if refreshBlock is not nil - (void)performRequestWithCompletion:(BOXEventsBlock)completionBlock; @end
/** * SS5PlayerPlatform.h */ #ifndef SS5PlayerPlatform_h #define SS5PlayerPlatform_h #include "SS5Player.h" #include "common/loader/sstypes.h" #include <stdio.h> #include <string> namespace ss { struct State; struct UserData; class Player; extern unsigned char* SSFileOpen(const char* pszFileName, const char* pszMode, unsigned long * pSize); extern long SSTextureLoad(const char* pszFileName, SsTexWrapMode::_enum wrapmode, SsTexFilterMode::_enum filtermode); extern bool SSTextureRelese(long handle); extern bool isAbsolutePath(const std::string& strPath); extern void SSDrawSprite(State state); extern bool SSGetTextureSize(long handle, int &w, int &h); extern void SSonUserData(Player *player, UserData *userData); extern void SSPlayEnd(Player *player); }; // namespace ss #endif
/* $NetBSD: makebuf.c,v 1.19 2018/12/14 03:29:54 uwe Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/cdefs.h> #include <sys/types.h> #include <sys/stat.h> #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <inttypes.h> #include <ctype.h> #include "reentrant.h" #include "local.h" /* * Override the file buffering based on the environment setting STDBUF%d * (for the specific file descriptor) and STDBUF (for all descriptors). * the setting is ULF<num> standing for "Unbuffered", "Linebuffered", * and Fullybuffered", and <num> is a value from 0 to 1M. */ static int __senvbuf(FILE *fp, size_t *size, int *couldbetty) { char evb[64], *evp; int flags, e; intmax_t s; flags = 0; if (snprintf(evb, sizeof(evb), "STDBUF%d", fp->_file) < 0) return flags; if ((evp = getenv(evb)) == NULL && (evp = getenv("STDBUF")) == NULL) return flags; switch (*evp) { case 'u': case 'U': evp++; flags |= __SNBF; break; case 'l': case 'L': evp++; flags |= __SLBF; break; case 'f': case 'F': evp++; *couldbetty = 0; break; } if (!isdigit((unsigned char)*evp)) return flags; s = strtoi(evp, NULL, 0, 0, 1024 * 1024, &e); if (e != 0) return flags; *size = (size_t)s; if (*size == 0) return __SNBF; return flags; } /* * Allocate a file buffer, or switch to unbuffered I/O. * Per the ANSI C standard, ALL tty devices default to line buffered. * * As a side effect, we set __SOPT or __SNPT (en/dis-able fseek * optimisation) right after the fstat() that finds the buffer size. */ void __smakebuf(FILE *fp) { void *p; int flags; size_t size; int couldbetty; _DIAGASSERT(fp != NULL); if (fp->_flags & __SNBF) goto unbuf; flags = __swhatbuf(fp, &size, &couldbetty); if ((fp->_flags & (__SLBF | __SNBF | __SMBF)) == 0 && fp->_cookie == fp && fp->_file >= 0) { flags |= __senvbuf(fp, &size, &couldbetty); if (flags & __SNBF) goto unbuf; } if ((p = malloc(size)) == NULL) goto unbuf; __cleanup = _cleanup; flags |= __SMBF; fp->_bf._base = fp->_p = p; _DIAGASSERT(__type_fit(int, size)); fp->_bf._size = (int)size; if (couldbetty && isatty(__sfileno(fp))) flags |= __SLBF; fp->_flags |= flags; return; unbuf: fp->_flags |= __SNBF; fp->_bf._base = fp->_p = fp->_nbuf; fp->_bf._size = 1; } /* * Internal routine to determine `proper' buffering for a file. */ int __swhatbuf(FILE *fp, size_t *bufsize, int *couldbetty) { struct stat st; _DIAGASSERT(fp != NULL); _DIAGASSERT(bufsize != NULL); _DIAGASSERT(couldbetty != NULL); if (__sfileno(fp) == -1 || fstat(__sfileno(fp), &st) < 0) { *couldbetty = 0; *bufsize = BUFSIZ; return __SNPT; } /* could be a tty iff it is a character device */ *couldbetty = S_ISCHR(st.st_mode); if (st.st_blksize == 0) { *bufsize = BUFSIZ; return __SNPT; } /* * Optimise fseek() only if it is a regular file. (The test for * __sseek is mainly paranoia.) It is safe to set _blksize * unconditionally; it will only be used if __SOPT is also set. */ *bufsize = st.st_blksize; fp->_blksize = st.st_blksize; return (st.st_mode & S_IFMT) == S_IFREG && fp->_seek == __sseek ? __SOPT : __SNPT; }
/* syshdrs.h * * Copyright (c) 1992-1999 by Mike Gleason. * All rights reserved. * */ #if defined(HAVE_CONFIG_H) # include <config.h> #endif #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) # pragma once # define _CRT_SECURE_NO_WARNINGS 1 # pragma warning(disable : 4127) // warning C4127: conditional expression is constant # pragma warning(disable : 4100) // warning C4100: 'lpReserved' : unreferenced formal parameter # pragma warning(disable : 4514) // warning C4514: unreferenced inline function has been removed # pragma warning(disable : 4115) // warning C4115: '_RPC_ASYNC_STATE' : named type definition in parentheses # pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union # pragma warning(disable : 4214) // warning C4214: nonstandard extension used : bit field types other than int # pragma warning(disable : 4115) // warning C4115: 'IRpcStubBuffer' : named type definition in parentheses # pragma warning(disable : 4711) // warning C4711: function selected for automatic inline expansion # ifndef WINVER # define WINVER 0x0400 # endif # ifndef _WIN32_WINNT # define _WIN32_WINNT 0x0400 # endif # include <windows.h> /* includes <winsock2.h> if _WIN32_WINNT >= 0x400 */ # include <process.h> # include <direct.h> # include <io.h> # include <stdio.h> # include <string.h> # include <stddef.h> # include <stdlib.h> # include <ctype.h> # include <stdarg.h> # include <time.h> # include <io.h> # include <sys/types.h> # include <sys/stat.h> # include <fcntl.h> # include <errno.h> # define strcasecmp _stricmp # define strncasecmp _strnicmp # define sleep(a) Sleep(a * 1000) # ifndef FOPEN_READ_TEXT # define FOPEN_READ_TEXT "rt" # define FOPEN_WRITE_TEXT "wt" # define FOPEN_APPEND_TEXT "at" # endif # ifndef S_ISREG # define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) # define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) # endif # define uid_t int # define HAVE_SNPRINTF 1 # define HAVE_VSNPRINTF 1 # ifndef vsnprintf # define vsnprintf _vsnprintf # endif # ifndef snprintf # define snprintf _snprintf # endif # ifndef FOPEN_READ_TEXT # define FOPEN_READ_TEXT "rt" # define FOPEN_WRITE_TEXT "wt" # define FOPEN_APPEND_TEXT "at" # endif # ifndef FOPEN_READ_BINARY # define FOPEN_READ_BINARY "rb" # define FOPEN_WRITE_BINARY "wb" # define FOPEN_APPEND_BINARY "ab" # endif #elif defined(__CYGWIN__) # error "This version is for native Windows only." #else /* UNIX */ # error "This version is for Windows only." #endif /* UNIX */ #include <Strn.h> /* Library header. */
/* +--------------------------------------------------------------------------+ | CHStone : a suite of benchmark programs for C-based High-Level Synthesis | | ======================================================================== | | | | * Collected and Modified : Y. Hara, H. Tomiyama, S. Honda, | | H. Takada and K. Ishii | | Nagoya University, Japan | | | | * Remark : | | 1. This source code is modified to unify the formats of the benchmark | | programs in CHStone. | | 2. Test vectors are added for CHStone. | | 3. If "main_result" is 0 at the end of the program, the program is | | correctly executed. | | 4. Please follow the copyright of each benchmark program. | +--------------------------------------------------------------------------+ */ /* NIST Secure Hash Algorithm */ /* heavily modified by Uwe Hollerbach uh@alumni.caltech edu */ /* from Peter C. Gutmann's implementation as found in */ /* Applied Cryptography by Bruce Schneier */ /* NIST's proposed modification to SHA of 7/11/94 may be */ /* activated by defining USE_MODIFIED_SHA */ /* SHA f()-functions */ #define f1(x,y,z) ((x & y) | (~x & z)) #define f2(x,y,z) (x ^ y ^ z) #define f3(x,y,z) ((x & y) | (x & z) | (y & z)) #define f4(x,y,z) (x ^ y ^ z) /* SHA constants */ #define CONST1 0x5a827999L #define CONST2 0x6ed9eba1L #define CONST3 0x8f1bbcdcL #define CONST4 0xca62c1d6L /* 32-bit rotate */ #define ROT32(x,n) ((x << n) | (x >> (32 - n))) #define FUNC(n,i) \ temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \ E = D; D = C; C = ROT32(B,30); B = A; A = temp void local_memset (INT32 * s, int c, int n, int e) { INT32 uc; INT32 *p; int m; m = n / 4; uc = c; p = (INT32 *) s; while (e-- > 0) { p++; } while (m-- > 0) { *p++ = uc; } } void local_memcpy (INT32 * s1, const BYTE * s2, int n) { INT32 *p1; BYTE *p2; INT32 tmp; int m; m = n / 4; p1 = (INT32 *) s1; p2 = (BYTE *) s2; while (m-- > 0) { tmp = 0; tmp |= 0xFF & *p2++; tmp |= (0xFF & *p2++) << 8; tmp |= (0xFF & *p2++) << 16; tmp |= (0xFF & *p2++) << 24; *p1 = tmp; p1++; } } /* do SHA transformation */ static void sha_transform () { int i; INT32 temp, A, B, C, D, E, W[80]; for (i = 0; i < 16; ++i) { W[i] = sha_info_data[i]; } for (i = 16; i < 80; ++i) { W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; } A = sha_info_digest[0]; B = sha_info_digest[1]; C = sha_info_digest[2]; D = sha_info_digest[3]; E = sha_info_digest[4]; for (i = 0; i < 20; ++i) { FUNC (1, i); } for (i = 20; i < 40; ++i) { FUNC (2, i); } for (i = 40; i < 60; ++i) { FUNC (3, i); } for (i = 60; i < 80; ++i) { FUNC (4, i); } sha_info_digest[0] += A; sha_info_digest[1] += B; sha_info_digest[2] += C; sha_info_digest[3] += D; sha_info_digest[4] += E; } /* initialize the SHA digest */ void sha_init () { sha_info_digest[0] = 0x67452301L; sha_info_digest[1] = 0xefcdab89L; sha_info_digest[2] = 0x98badcfeL; sha_info_digest[3] = 0x10325476L; sha_info_digest[4] = 0xc3d2e1f0L; sha_info_count_lo = 0L; sha_info_count_hi = 0L; } /* update the SHA digest */ void sha_update (const BYTE * buffer, int count) { if ((sha_info_count_lo + ((INT32) count << 3)) < sha_info_count_lo) { ++sha_info_count_hi; } sha_info_count_lo += (INT32) count << 3; sha_info_count_hi += (INT32) count >> 29; while (count >= SHA_BLOCKSIZE) { local_memcpy (sha_info_data, buffer, SHA_BLOCKSIZE); sha_transform (); buffer += SHA_BLOCKSIZE; count -= SHA_BLOCKSIZE; } local_memcpy (sha_info_data, buffer, count); } /* finish computing the SHA digest */ void sha_final () { int count; INT32 lo_bit_count; INT32 hi_bit_count; lo_bit_count = sha_info_count_lo; hi_bit_count = sha_info_count_hi; count = (int) ((lo_bit_count >> 3) & 0x3f); sha_info_data[count++] = 0x80; if (count > 56) { local_memset (sha_info_data, 0, 64 - count, count); sha_transform (); local_memset (sha_info_data, 0, 56, 0); } else { local_memset (sha_info_data, 0, 56 - count, count); } sha_info_data[14] = hi_bit_count; sha_info_data[15] = lo_bit_count; sha_transform (); } /* compute the SHA digest of a FILE stream */ void sha_stream () { int i, j; const BYTE *p; sha_init (); for (j = 0; j < VSIZE; j++) { i = in_i[j]; p = &indata[j][0]; sha_update (p, i); } sha_final (); }
#include <stdarg.h> tp_obj tp_string_t(TP, int n) { tp_obj r = tp_string_n(0,n); r.string.info = (_tp_string*)tp_malloc(sizeof(_tp_string)+n); r.string.val = r.string.info->s; return r; } tp_obj tp_printf(TP, char const *fmt,...) { int l; tp_obj r; char tmp[2000]; char *s; va_list arg; va_start(arg, fmt); l = vsnprintf(tmp, sizeof(tmp), fmt,arg); r = tp_string_t(tp,l); s = r.string.info->s; va_end(arg); va_start(arg, fmt); vsprintf(s,fmt,arg); va_end(arg); return tp_track(tp,r); } int _tp_str_index(tp_obj s, tp_obj k) { int i=0; while ((s.string.len - i) >= k.string.len) { if (memcmp(s.string.val+i,k.string.val,k.string.len) == 0) { return i; } i += 1; } return -1; } tp_obj tp_join(TP) { tp_obj delim = TP_OBJ(); tp_obj val = TP_OBJ(); int l=0,i; tp_obj r; char *s; for (i=0; i<val.list.val->len; i++) { if (i!=0) { l += delim.string.len; } l += tp_str(tp,val.list.val->items[i]).string.len; } r = tp_string_t(tp,l); s = r.string.info->s; l = 0; for (i=0; i<val.list.val->len; i++) { tp_obj e; if (i!=0) { memcpy(s+l,delim.string.val,delim.string.len); l += delim.string.len; } e = tp_str(tp,val.list.val->items[i]); memcpy(s+l,e.string.val,e.string.len); l += e.string.len; } return tp_track(tp,r); } tp_obj tp_string_slice(TP,tp_obj s, int a, int b) { tp_obj r = tp_string_t(tp,b-a); char *m = r.string.info->s; memcpy(m,s.string.val+a,b-a); return tp_track(tp,r); } tp_obj tp_split(TP) { tp_obj v = TP_OBJ(); tp_obj d = TP_OBJ(); tp_obj r = tp_list(tp); int i; while ((i=_tp_str_index(v,d))!=-1) { _tp_list_append(tp,r.list.val,tp_string_slice(tp,v,0,i)); v.string.val += i + d.string.len; v.string.len -= i + d.string.len; /* tp_grey(tp,r); // should stop gc or something instead*/ } _tp_list_append(tp,r.list.val,tp_string_slice(tp,v,0,v.string.len)); /* tp_grey(tp,r); // should stop gc or something instead*/ return r; } tp_obj tp_find(TP) { tp_obj s = TP_OBJ(); tp_obj v = TP_OBJ(); return tp_number(_tp_str_index(s,v)); } tp_obj tp_str_index(TP) { tp_obj s = TP_OBJ(); tp_obj v = TP_OBJ(); int n = _tp_str_index(s,v); if (n >= 0) { return tp_number(n); } tp_raise(tp_None,"tp_str_index(%s,%s)",s,v); } tp_obj tp_str2(TP) { tp_obj v = TP_OBJ(); return tp_str(tp,v); } tp_obj tp_chr(TP) { int v = TP_NUM(); return tp_string_n(tp->chars[(unsigned char)v],1); } tp_obj tp_ord(TP) { char const *s = TP_STR(); return tp_number((unsigned char)s[0]); } tp_obj tp_strip(TP) { char const *v = TP_STR(); int i, l = strlen(v); int a = l, b = 0; tp_obj r; char *s; for (i=0; i<l; i++) { if (v[i] != ' ' && v[i] != '\n' && v[i] != '\t' && v[i] != '\r') { a = _tp_min(a,i); b = _tp_max(b,i+1); } } if ((b-a) < 0) { return tp_string(""); } r = tp_string_t(tp,b-a); s = r.string.info->s; memcpy(s,v+a,b-a); return tp_track(tp,r); } tp_obj tp_replace(TP) { tp_obj s = TP_OBJ(); tp_obj k = TP_OBJ(); tp_obj v = TP_OBJ(); tp_obj p = s; int i,n = 0; int c; int l; tp_obj rr; char *r; char *d; tp_obj z; while ((i = _tp_str_index(p,k)) != -1) { n += 1; p.string.val += i + k.string.len; p.string.len -= i + k.string.len; } /* fprintf(stderr,"ns: %d\n",n); */ l = s.string.len + n * (v.string.len-k.string.len); rr = tp_string_t(tp,l); r = rr.string.info->s; d = r; z = p = s; while ((i = _tp_str_index(p,k)) != -1) { p.string.val += i; p.string.len -= i; memcpy(d,z.string.val,c=(p.string.val-z.string.val)); d += c; p.string.val += k.string.len; p.string.len -= k.string.len; memcpy(d,v.string.val,v.string.len); d += v.string.len; z = p; } memcpy(d,z.string.val,(s.string.val + s.string.len) - z.string.val); return tp_track(tp,rr); }
#ifndef PLUGIN_H #define PLUGIN_H #include <gmodule.h> #include <gtk/gtk.h> #include <gdk/gdk.h> #include <stdio.h> #include "panel.h" struct _plugin_instance *stam; typedef struct { /* common */ char *fname; int count; GModule *gmodule; int dynamic : 1; int invisible : 1; /* these fields are pointers to the data within loaded dll */ char *type; char *name; char *version; char *description; int priv_size; int (*constructor)(struct _plugin_instance *this); void (*destructor)(struct _plugin_instance *this); void (*save_config)(struct _plugin_instance *this, FILE *fp); GtkWidget *(*edit_config)(struct _plugin_instance *this); } plugin_class; #define PLUGIN_CLASS(class) ((plugin_class *) class) typedef struct _plugin_instance{ plugin_class *class; panel *panel; xconf *xc; GtkWidget *pwid; int expand; int padding; int border; } plugin_instance; void class_put(char *name); gpointer class_get(char *name); /* if plugin_instance is external it will load its dll */ plugin_instance * plugin_load(char *type); void plugin_put(plugin_instance *this); int plugin_start(plugin_instance *this); void plugin_stop(plugin_instance *this); GtkWidget *default_plugin_instance_edit_config(plugin_instance *pl); void class_register(plugin_class *p); void class_unregister(plugin_class *p); #ifdef PLUGIN static plugin_class *class_ptr; static void ctor(void) __attribute__ ((constructor)); static void ctor(void) { class_register(class_ptr); } static void dtor(void) __attribute__ ((destructor)); static void dtor(void) { class_unregister(class_ptr); } #endif #endif
#import <UIKit/UIKit.h> /** Provides extensions for `UIView`. */ @interface UIView (XHAdd) /** Create a snapshot image of the complete view hierarchy. */ - (UIImage *)xh_snapshotImage; /** Create a snapshot image of the complete view hierarchy. @discussion It's faster than "snapshotImage", but may cause screen updates. See -[UIView drawViewHierarchyInRect:afterScreenUpdates:] for more information. */ - (UIImage *)xh_snapshotImageAfterScreenUpdates:(BOOL)afterUpdates; /** Remove all subviews. @warning Never call this method inside your view's drawRect: method. */ - (void)xh_removeAllSubviews; /** Returns the view's view controller (may be nil). */ @property (nonatomic, readonly) UIViewController *xh_viewController; @property (nonatomic) CGFloat xh_left; ///< Shortcut for frame.origin.x. @property (nonatomic) CGFloat xh_top; ///< Shortcut for frame.origin.y @property (nonatomic) CGFloat xh_right; ///< Shortcut for frame.origin.x + frame.size.width @property (nonatomic) CGFloat xh_bottom; ///< Shortcut for frame.origin.y + frame.size.height @property (nonatomic) CGFloat xh_width; ///< Shortcut for frame.size.width. @property (nonatomic) CGFloat xh_height; ///< Shortcut for frame.size.height. @property (nonatomic) CGFloat xh_centerX; ///< Shortcut for center.x @property (nonatomic) CGFloat xh_centerY; ///< Shortcut for center.y @property (nonatomic) CGPoint xh_origin; ///< Shortcut for frame.origin. @property (nonatomic) CGSize xh_size; ///< Shortcut for frame.size. @end
#pragma once #include "Capture.h" class GDICapture : public Capture { public: void init(UINT monitorID, RECT screen) { this->screen = screen; hdc = GetDC(NULL); // get the desktop device context hDest = CreateCompatibleDC(hdc); // create a device context to use yourself // get the height and width of the screen height = screen.bottom - screen.top; width = screen.right - screen.left; int virtualScreenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); int virtualScreenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); // create a bitmap hbDesktop = CreateCompatibleBitmap( hdc, virtualScreenWidth, virtualScreenHeight); // use the previously created device context with the bitmap SelectObject(hDest, hbDesktop); bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); bmi.bmiHeader.biWidth = width; bmi.bmiHeader.biHeight = -height; bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biBitCount = 32; bmi.bmiHeader.biCompression = BI_RGB; pPixels = new RGBQUAD[width * height]; } int getNextFrame(RGBQUAD** data) { // copy from the desktop device context to the bitmap device context BitBlt( hDest, 0,0, width, height, hdc, screen.left, screen.top, SRCCOPY); GetDIBits( hDest, hbDesktop, 0, height, pPixels, &bmi, DIB_RGB_COLORS ); *data = pPixels; return 0; } void doneNextFrame() { } private: HDC hdc, hDest; int width, height; RECT screen; RGBQUAD *pPixels; HBITMAP hbDesktop; BITMAPINFO bmi; };
/** ****************************************************************************** * @file usb_prop.h * @author MCD Application Team * @version V4.0.0 * @date 21-January-2013 * @brief All processing related to Joystick Mouse demo ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 * * 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. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __USB_PROP_H #define __USB_PROP_H /* Includes ------------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/ typedef enum _HID_REQUESTS { GET_REPORT = 1, GET_IDLE, GET_PROTOCOL, SET_REPORT = 9, SET_IDLE, SET_PROTOCOL } HID_REQUESTS; /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void Joystick_init(void); void Joystick_Reset(void); void Joystick_SetConfiguration(void); void Joystick_SetDeviceAddress (void); void Joystick_Status_In (void); void Joystick_Status_Out (void); RESULT Joystick_Data_Setup(uint8_t); RESULT Joystick_NoData_Setup(uint8_t); RESULT Joystick_Get_Interface_Setting(uint8_t Interface, uint8_t AlternateSetting); uint8_t *Joystick_GetDeviceDescriptor(uint16_t ); uint8_t *Joystick_GetConfigDescriptor(uint16_t); uint8_t *Joystick_GetStringDescriptor(uint16_t); RESULT Joystick_SetProtocol(void); uint8_t *Joystick_GetProtocolValue(uint16_t Length); RESULT Joystick_SetProtocol(void); uint8_t *Joystick_GetReportDescriptor(uint16_t Length); uint8_t *Joystick_GetHIDDescriptor(uint16_t Length); /* Exported define -----------------------------------------------------------*/ #define Joystick_GetConfiguration NOP_Process //#define Joystick_SetConfiguration NOP_Process #define Joystick_GetInterface NOP_Process #define Joystick_SetInterface NOP_Process #define Joystick_GetStatus NOP_Process #define Joystick_ClearFeature NOP_Process #define Joystick_SetEndPointFeature NOP_Process #define Joystick_SetDeviceFeature NOP_Process //#define Joystick_SetDeviceAddress NOP_Process #define REPORT_DESCRIPTOR 0x22 #endif /* __USB_PROP_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#ifndef SENDCOINSDIALOG_H #define SENDCOINSDIALOG_H #include <QDialog> namespace Ui { class SendCoinsDialog; } class WalletModel; class SendCoinsEntry; class SendCoinsRecipient; QT_BEGIN_NAMESPACE class QUrl; QT_END_NAMESPACE /** Dialog for sending landcoins */ class SendCoinsDialog : public QDialog { Q_OBJECT public: explicit SendCoinsDialog(QWidget *parent = 0); ~SendCoinsDialog(); void setModel(WalletModel *model); /** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907). */ QWidget *setupTabChain(QWidget *prev); void setAddress(const QString &address); void pasteEntry(const SendCoinsRecipient &rv); bool handleURI(const QString &uri); public slots: void clear(); void reject(); void accept(); SendCoinsEntry *addEntry(); void updateRemoveEnabled(); void setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance); private: Ui::SendCoinsDialog *ui; WalletModel *model; bool fNewRecipientAllowed; private slots: void on_sendButton_clicked(); void removeEntry(SendCoinsEntry* entry); void updateDisplayUnit(); }; #endif // SENDCOINSDIALOG_H
/** * \addtogroup rime * @{ */ /** * \defgroup rimepoliteannouncement * @{ * * The polite announcement module implements a periodic explicit * announcement. THe module announces the announcements that have been * registered with the \ref rimeannouncement "announcement module". * * \section channels Channels * * The polite announcement module uses 1 channel. * */ /* * Copyright (c) 2006, Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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. * * This file is part of the Contiki operating system. * */ /** * \file * Neighbor discovery header file * \author * Adam Dunkels <adam@sics.se> */ #ifndef __POLITE_ANNOUNCEMENT_H__ #define __POLITE_ANNOUNCEMENT_H__ void polite_announcement_init(uint16_t channel, clock_time_t min, clock_time_t max); #endif /* __POLITE_ANNOUNCEMENT_H__ */ /** @} */ /** @} */
/* * BMKShape.h * BMapKit * * Copyright 2011 Baidu Inc. All rights reserved. * */ #import <Foundation/Foundation.h> #import"BMKAnnotation.h" /// 该类为一个抽象类,定义了基于BMKAnnotation的BMKShape类的基本属性和行为,不能直接使用,必须子类化之后才能使用 @interface BMKShape : NSObject <BMKAnnotation> { @package NSString *_title; NSString *_subtitle; } /// 要显示的标题 @property (copy) NSString *title; /// 要显示的副标题 @property (copy) NSString *subtitle; @end
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #define MAX 5 struct Vertex { char label; bool visited; }; //stack variables int stack[MAX]; int top = -1; //graph variables //array of vertices struct Vertex* lstVertices[MAX]; //adjacency matrix int adjMatrix[MAX][MAX]; //vertex count int vertexCount = 0; //stack functions void push(int item) { stack[++top] = item; } int pop() { return stack[top--]; } int peek() { return stack[top]; } bool isStackEmpty() { return top == -1; } //graph functions //add vertex to the vertex list void addVertex(char label) { struct Vertex* vertex = (struct Vertex*) malloc(sizeof(struct Vertex)); vertex->label = label; vertex->visited = false; lstVertices[vertexCount++] = vertex; } //add edge to edge array void addEdge(int start,int end) { adjMatrix[start][end] = 1; adjMatrix[end][start] = 1; } //display the vertex void displayVertex(int vertexIndex) { printf("%c ",lstVertices[vertexIndex]->label); } //get the adjacent unvisited vertex int getAdjUnvisitedVertex(int vertexIndex) { int i; for(i = 0; i<vertexCount; i++) { if(adjMatrix[vertexIndex][i] == 1 && lstVertices[i]->visited == false) { return i; } } return -1; } void depthFirstSearch() { int i; //mark first node as visited lstVertices[0]->visited = true; //display the vertex displayVertex(0); //push vertex index in stack push(0); while(!isStackEmpty()) { //get the unvisited vertex of vertex which is at top of the stack int unvisitedVertex = getAdjUnvisitedVertex(peek()); //no adjacent vertex found if(unvisitedVertex == -1) { pop(); } else { lstVertices[unvisitedVertex]->visited = true; displayVertex(unvisitedVertex); push(unvisitedVertex); } } //stack is empty, search is complete, reset the visited flag for(i = 0;i < vertexCount;i++) { lstVertices[i]->visited = false; } } int main() { int i, j; for(i = 0; i<MAX; i++) // set adjacency { for(j = 0; j<MAX; j++) // matrix to 0 adjMatrix[i][j] = 0; addVertex('S'); // 0 addVertex('A'); // 1 addVertex('B'); // 2 addVertex('C'); // 3 addVertex('D'); // 4 addEdge(0, 1); // S - A addEdge(0, 2); // S - B addEdge(0, 3); // S - C addEdge(1, 4); // A - D addEdge(2, 4); // B - D addEdge(3, 4); // C - D printf("Depth First Search: "); depthFirstSearch(); return 0; }
/**************************************************************************** ** ** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team. ** All rights reserved. ** ** Portion Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** All rights reserved. ** ** 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. ** ****************************************************************************/ #ifndef QFilter_P_H #define QFilter_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of the help generator tools. This header file may change from version // to version without notice, or even be removed. // // We mean it. // #include "qclucene_global_p.h" #include <QtCore/QSharedData> #include <QtCore/QSharedDataPointer> CL_NS_DEF(search) class Filter; CL_NS_END CL_NS_USE(search) QT_BEGIN_NAMESPACE class QCLuceneHits; class QCLuceneSearcher; class QHELP_EXPORT QCLuceneFilterPrivate : public QSharedData { public: QCLuceneFilterPrivate(); QCLuceneFilterPrivate(const QCLuceneFilterPrivate &other); ~QCLuceneFilterPrivate (); Filter *filter; bool deleteCLuceneFilter; private: QCLuceneFilterPrivate &operator=(const QCLuceneFilterPrivate &other); }; class QHELP_EXPORT QCLuceneFilter { QCLuceneFilter(); virtual ~QCLuceneFilter(); protected: friend class QCLuceneHits; friend class QCLuceneSearcher; QSharedDataPointer<QCLuceneFilterPrivate> d; }; QT_END_NAMESPACE #endif // QFilter_P_H
/* * Description: * History: yang@haipo.me, 2016/03/29, create */ # include "ut_crc32.h" #define CRC32C(c,d) (c=(c>>8)^crc_c[(c^(d))&0xFF]) static const unsigned int crc_c[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, }; uint32_t generate_crc32c(const char *buffer, size_t length) { size_t i; uint32_t crc32 = ~0L; for (i = 0; i < length; i++){ CRC32C(crc32, (unsigned char)buffer[i]); } return ~crc32; }
// // AppDelegate.h // tcxly // // Created by Terry on 13-5-4. // Copyright (c) 2013年 Terry. All rights reserved. // #import <UIKit/UIKit.h> #import "MainViewController.h" @interface AppDelegate : UIResponder <UIApplicationDelegate> { MainViewController *mvc; } @property (strong, nonatomic) UIWindow *window; @end
// // KTPermission.h // keytechFoundation // // Created by Thorsten Claus on 30.07.13. // Copyright (c) 2017 Claus-Software. All rights reserved. // #import <Foundation/Foundation.h> /** A class that has a single permission information */ @interface KTPermission : NSObject /** Provides the object Mapping for this class and given objectManager @param manager A shared RKObjectmanager that contains the connection data to the API */ +(RKObjectMapping*)mappingWithManager:(RKObjectManager*)manager; /** Returns or sets the user visible displayname */ @property (nonatomic,copy)NSString* displayname; /** Returns or gets the scope for this permission. */ @property (nonatomic,copy)NSString* permissionContext; /** The unique identifier */ @property (nonatomic,copy)NSString* permissionKey; /** The permissiontype is the kind of right this permission represents */ @property (nonatomic,copy)NSString* permissionType; /** If YES the permission is not directly assigend to the user but assigned by group membership. In case this permission is assign to a group this value has no meaning. */ @property (nonatomic) BOOL isPermissionSetByMembership; @end
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_UI_INTERFACE_H #define BITCOIN_UI_INTERFACE_H #include <boost/signals2/last_value.hpp> #include <boost/signals2/signal.hpp> #include <string> #include <stdint.h> class CBasicKeyStore; class CWallet; class uint256; /** General change type (added, updated, removed). */ enum ChangeType { CT_NEW, CT_UPDATED, CT_DELETED }; /** Signals for UI communication. */ class CClientUIInterface { public: /** Flags for CClientUIInterface::ThreadSafeMessageBox */ enum MessageBoxFlags { YES = 0x00000002, OK = 0x00000004, NO = 0x00000008, YES_NO = (YES|NO), CANCEL = 0x00000010, APPLY = 0x00000020, CLOSE = 0x00000040, OK_DEFAULT = 0x00000000, YES_DEFAULT = 0x00000000, NO_DEFAULT = 0x00000080, CANCEL_DEFAULT = 0x80000000, ICON_EXCLAMATION = 0x00000100, ICON_HAND = 0x00000200, ICON_WARNING = ICON_EXCLAMATION, ICON_ERROR = ICON_HAND, ICON_QUESTION = 0x00000400, ICON_INFORMATION = 0x00000800, ICON_STOP = ICON_HAND, ICON_ASTERISK = ICON_INFORMATION, ICON_MASK = (0x00000100|0x00000200|0x00000400|0x00000800), FORWARD = 0x00001000, BACKWARD = 0x00002000, RESET = 0x00004000, HELP = 0x00008000, MORE = 0x00010000, SETUP = 0x00020000, // Force blocking, modal message box dialog (not just OS notification) MODAL = 0x00040000 }; /** Show message box. */ boost::signals2::signal<void (const std::string& message, const std::string& caption, int style)> ThreadSafeMessageBox; /** Ask the user whether they want to pay a fee or not. */ boost::signals2::signal<bool (int64_t nFeeRequired, int nColor, const std::string& strCaption), boost::signals2::last_value<bool> > ThreadSafeAskFee; /** Handle a URL passed at the command line. */ boost::signals2::signal<void (const std::string& strURI)> ThreadSafeHandleURI; /** Progress message during initialization. */ boost::signals2::signal<void (const std::string &message)> InitMessage; /** Initiate client shutdown. */ boost::signals2::signal<void ()> QueueShutdown; /** Translate a message to the native language of the user. */ boost::signals2::signal<std::string (const char* psz)> Translate; /** Block chain changed. */ boost::signals2::signal<void ()> NotifyBlocksChanged; /** Number of network connections changed. */ boost::signals2::signal<void (int newNumConnections)> NotifyNumConnectionsChanged; /** * New, updated or cancelled alert. * @note called with lock cs_mapAlerts held. */ boost::signals2::signal<void (const uint256 &hash, ChangeType status)> NotifyAlertChanged; boost::signals2::signal<void (const uint256 &hash, ChangeType status)> NotifyPumpInfoChanged; }; extern CClientUIInterface uiInterface; /** * Translation function: Call Translate signal on UI interface, which returns a boost::optional result. * If no translation slot is registered, nothing is returned, and simply return the input. */ inline std::string _(const char* psz) { boost::optional<std::string> rv = uiInterface.Translate(psz); return rv ? (*rv) : psz; } #endif
/* minGeneInfo.h was originally generated by the autoSql program, which also * generated minGeneInfo.c and minGeneInfo.sql. This header links the database and * the RAM representation of objects. */ /* Copyright (C) 2005 The Regents of the University of California * See README in this or parent directory for licensing information. */ #ifndef MINGENEINFO_H #define MINGENEINFO_H #define MINGENEINFO_NUM_COLS 8 struct minGeneInfo /* Auxilliary info about a gene (less than the knownInfo) */ { struct minGeneInfo *next; /* Next in singly linked list. */ char *name; /* gene accession */ char *gene; /* gene name */ char *product; /* gene product */ char *note; /* gene note */ char *protein; /* gene protein */ char *gi; /* gene genbank id */ char *ec; /* ec number */ char *entrezGene; /* entrez gene id */ }; void minGeneInfoStaticLoad(char **row, struct minGeneInfo *ret); /* Load a row from minGeneInfo table into ret. The contents of ret will * be replaced at the next call to this function. */ struct minGeneInfo *minGeneInfoLoad(char **row); /* Load a minGeneInfo from row fetched with select * from minGeneInfo * from database. Dispose of this with minGeneInfoFree(). */ struct minGeneInfo *minGeneInfoLoadAll(char *fileName); /* Load all minGeneInfo from whitespace-separated file. * Dispose of this with minGeneInfoFreeList(). */ struct minGeneInfo *minGeneInfoLoadAllByChar(char *fileName, char chopper); /* Load all minGeneInfo from chopper separated file. * Dispose of this with minGeneInfoFreeList(). */ #define minGeneInfoLoadAllByTab(a) minGeneInfoLoadAllByChar(a, '\t'); /* Load all minGeneInfo from tab separated file. * Dispose of this with minGeneInfoFreeList(). */ struct minGeneInfo *minGeneInfoCommaIn(char **pS, struct minGeneInfo *ret); /* Create a minGeneInfo out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new minGeneInfo */ void minGeneInfoFree(struct minGeneInfo **pEl); /* Free a single dynamically allocated minGeneInfo such as created * with minGeneInfoLoad(). */ void minGeneInfoFreeList(struct minGeneInfo **pList); /* Free a list of dynamically allocated minGeneInfo's */ void minGeneInfoOutput(struct minGeneInfo *el, FILE *f, char sep, char lastSep); /* Print out minGeneInfo. Separate fields with sep. Follow last field with lastSep. */ #define minGeneInfoTabOut(el,f) minGeneInfoOutput(el,f,'\t','\n'); /* Print out minGeneInfo as a line in a tab-separated file. */ #define minGeneInfoCommaOut(el,f) minGeneInfoOutput(el,f,',',','); /* Print out minGeneInfo as a comma separated list including final comma. */ /* -------------------------------- End autoSql Generated Code -------------------------------- */ #endif /* MINGENEINFO_H */
/*----------------------------------------------------------------------------- // $Date: 2011/05/17 04:37:50 $ // $RCSfile: sbrk.c,v $ //----------------------------------------------------------------------------- // // Copyright (c) 2004 Xilinx, Inc. All rights reserved. // // Xilinx, Inc. // XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A // COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS // ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR // STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION // IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE // FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. // XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO // THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO // ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE // FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY // AND FITNESS FOR A PARTICULAR PURPOSE. // //---------------------------------------------------------------------------*/ #include <errno.h> extern char _heap_start[]; extern char _heap_end[]; static char *heap_ptr; char *sbrk (int nbytes) { char *base; if (!heap_ptr) heap_ptr = (char *)&_heap_start; base = heap_ptr; heap_ptr += nbytes; if (heap_ptr <= ((char *)&_heap_end + 1)) return base; else { errno = ENOMEM; return ((char *)-1); } }
/* * linux/fs/proc/root.c * * Copyright (C) 1991, 1992 Linus Torvalds * * proc root directory handling functions */ #include <asm/uaccess.h> #include <linux/errno.h> #include <linux/time.h> #include <linux/proc_fs.h> #include <linux/stat.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/module.h> #include <linux/bitops.h> #include <linux/mount.h> #include <linux/pid_namespace.h> #include <linux/parser.h> #include "internal.h" static int proc_test_super(struct super_block *sb, void *data) { return sb->s_fs_info == data; } static int proc_set_super(struct super_block *sb, void *data) { int err = set_anon_super(sb, NULL); if (!err) { struct pid_namespace *ns = (struct pid_namespace *)data; sb->s_fs_info = get_pid_ns(ns); } return err; } enum { Opt_gid, Opt_hidepid, Opt_err, }; static const match_table_t tokens = { {Opt_hidepid, "hidepid=%u"}, {Opt_gid, "gid=%u"}, {Opt_err, NULL}, }; static int proc_parse_options(char *options, struct pid_namespace *pid) { char *p; substring_t args[MAX_OPT_ARGS]; int option; if (!options) return 1; while ((p = strsep(&options, ",")) != NULL) { int token; if (!*p) continue; args[0].to = args[0].from = NULL; token = match_token(p, tokens, args); switch (token) { case Opt_gid: if (match_int(&args[0], &option)) return 0; pid->pid_gid = option; break; case Opt_hidepid: if (match_int(&args[0], &option)) return 0; if (option < 0 || option > 2) { pr_err("proc: hidepid value must be between 0 and 2.\n"); return 0; } pid->hide_pid = option; break; default: pr_err("proc: unrecognized mount option \"%s\" " "or missing value\n", p); return 0; } } return 1; } int proc_remount(struct super_block *sb, int *flags, char *data) { struct pid_namespace *pid = sb->s_fs_info; sync_filesystem(sb); return !proc_parse_options(data, pid); } static struct dentry *proc_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) { int err; struct super_block *sb; struct pid_namespace *ns; char *options; if (flags & MS_KERNMOUNT) { ns = (struct pid_namespace *)data; options = NULL; } else { ns = task_active_pid_ns(current); options = data; } sb = sget(fs_type, proc_test_super, proc_set_super, flags, ns); if (IS_ERR(sb)) return ERR_CAST(sb); if (!proc_parse_options(options, ns)) { deactivate_locked_super(sb); return ERR_PTR(-EINVAL); } if (!sb->s_root) { err = proc_fill_super(sb); if (err) { deactivate_locked_super(sb); return ERR_PTR(err); } sb->s_flags |= MS_ACTIVE; } return dget(sb->s_root); } static void proc_kill_sb(struct super_block *sb) { struct pid_namespace *ns; ns = (struct pid_namespace *)sb->s_fs_info; if (ns->proc_self) dput(ns->proc_self); kill_anon_super(sb); put_pid_ns(ns); } static struct file_system_type proc_fs_type = { .name = "proc", .mount = proc_mount, .kill_sb = proc_kill_sb, .fs_flags = FS_USERNS_MOUNT, }; void __init proc_root_init(void) { int err; proc_init_inodecache(); err = register_filesystem(&proc_fs_type); if (err) return; err = pid_ns_prepare_proc(&init_pid_ns); if (err) { unregister_filesystem(&proc_fs_type); return; } proc_self_init(); proc_symlink("mounts", NULL, "self/mounts"); proc_net_init(); #ifdef CONFIG_SYSVIPC proc_mkdir("sysvipc", NULL); #endif proc_mkdir("fs", NULL); proc_mkdir("driver", NULL); proc_mkdir("fs/nfsd", NULL); /* somewhere for the nfsd filesystem to be mounted */ #if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE) /* just give it a mountpoint */ proc_mkdir("openprom", NULL); #endif proc_tty_init(); #ifdef CONFIG_PROC_DEVICETREE proc_device_tree_init(); #endif proc_mkdir("bus", NULL); proc_sys_init(); } static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat ) { generic_fillattr(dentry->d_inode, stat); stat->nlink = proc_root.nlink + nr_processes(); return 0; } static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry, unsigned int flags) { if (!proc_lookup(dir, dentry, flags)) return NULL; return proc_pid_lookup(dir, dentry, flags); } static int proc_root_readdir(struct file * filp, void * dirent, filldir_t filldir) { unsigned int nr = filp->f_pos; int ret; if (nr < FIRST_PROCESS_ENTRY) { int error = proc_readdir(filp, dirent, filldir); if (error <= 0) return error; filp->f_pos = FIRST_PROCESS_ENTRY; } ret = proc_pid_readdir(filp, dirent, filldir); return ret; } /* * The root /proc directory is special, as it has the * <pid> directories. Thus we don't use the generic * directory handling functions for that.. */ static const struct file_operations proc_root_operations = { .read = generic_read_dir, .readdir = proc_root_readdir, .llseek = default_llseek, }; /* * proc root can do almost nothing.. */ static const struct inode_operations proc_root_inode_operations = { .lookup = proc_root_lookup, .getattr = proc_root_getattr, }; /* * This is the root "inode" in the /proc tree.. */ struct proc_dir_entry proc_root = { .low_ino = PROC_ROOT_INO, .namelen = 5, .mode = S_IFDIR | S_IRUGO | S_IXUGO, .nlink = 2, .count = ATOMIC_INIT(1), .proc_iops = &proc_root_inode_operations, .proc_fops = &proc_root_operations, .parent = &proc_root, .name = "/proc", }; int pid_ns_prepare_proc(struct pid_namespace *ns) { struct vfsmount *mnt; mnt = kern_mount_data(&proc_fs_type, ns); if (IS_ERR(mnt)) return PTR_ERR(mnt); ns->proc_mnt = mnt; return 0; } void pid_ns_release_proc(struct pid_namespace *ns) { kern_unmount(ns->proc_mnt); }
/***************************************************************************** * Copyright Statement: * -------------------- * This software is protected by Copyright and the information contained * herein is confidential. The software may not be copied and the information * contained herein may not be used or disclosed except with the written * permission of MediaTek Inc. (C) 2008 * * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. * * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). * *****************************************************************************/ /***************************************************************************** *------------------------------------------------------------------------------ * Upper this line, this part is controlled by CC/CQ. DO NOT MODIFY!! *============================================================================ ****************************************************************************/ /* SENSOR FULL SIZE */ #ifndef __SENSOR_H #define __SENSOR_H typedef enum group_enum { PRE_GAIN = 0, CMMCLK_CURRENT, FRAME_RATE_LIMITATION, REGISTER_EDITOR, GROUP_TOTAL_NUMS } FACTORY_GROUP_ENUM; #define ENGINEER_START_ADDR 10 #define FACTORY_START_ADDR 0 typedef enum engineer_index { CMMCLK_CURRENT_INDEX = ENGINEER_START_ADDR, ENGINEER_END } FACTORY_ENGINEER_INDEX; typedef enum register_index { PRE_GAIN_INDEX = FACTORY_START_ADDR, GLOBAL_GAIN_INDEX, FACTORY_END_ADDR } FACTORY_REGISTER_INDEX; typedef struct { SENSOR_REG_STRUCT Reg[ENGINEER_END]; SENSOR_REG_STRUCT CCT[FACTORY_END_ADDR]; } SENSOR_DATA_STRUCT, *PSENSOR_DATA_STRUCT; #define CURRENT_MAIN_SENSOR T4K28_OMNIVISION /* SENSOR VGA SIZE */ #define T4K28_IMAGE_SENSOR_PV_WIDTH (800) #define T4K28_IMAGE_SENSOR_PV_HEIGHT (600) /* SENSOR 2M SIZE */ #define T4K28_IMAGE_SENSOR_FULL_WIDTH (1600-16) #define T4K28_IMAGE_SENSOR_FULL_HEIGHT (1200-14) #define T4K28_IMAGE_SENSOR_PV_STARTX 4 #define T4K28_IMAGE_SENSOR_PV_STARTY 3 #define T4K28_FULL_PERIOD_PIXEL_NUMS (3628) #define T4K28_FULL_PERIOD_LINE_NUMS (1536) #define T4K28_PV_PERIOD_PIXEL_NUMS (3628) #define T4K28_PV_PERIOD_LINE_NUMS (704) typedef enum { SENSOR_MODE_INIT = 0, SENSOR_MODE_PREVIEW, SENSOR_MODE_CAPTURE, SENSOR_MODE_VIDEO, SENSOR_MODE_ZSD } T4K28YUV_SENSOR_MODE; /* SENSOR PIXEL/LINE NUMBERS IN ONE PERIOD */ //#define T4K28_FULL_PERIOD_PIXEL_NUMS (1600) // 2M mode's pixel # in one HSYNC w/o dummy pixels //#define T4K28_FULL_PERIOD_LINE_NUMS (1200) // 2M mode's HSYNC # in one HSYNC w/o dummy lines //#define T4K28_PV_PERIOD_PIXEL_NUMS (800) // VGA mode's pixel # in one HSYNC w/o dummy pixels //#define T4K28_PV_PERIOD_LINE_NUMS (600) // VGAmode's HSYNC # in one HSYNC w/o dummy lines #define T4K28_FULL_PERIOD_PIXEL_NUMS_HTS (1302) #define T4K28_FULL_PERIOD_LINE_NUMS_VTS (768) #define T4K28_PV_PERIOD_PIXEL_NUMS_HTS (1043) #define T4K28_PV_PERIOD_LINE_NUMS_VTS (511) #define T4K28_IMAGE_SENSOR_2M_PIXELS_LINE T4K28_FULL_PERIOD_PIXEL_NUMS_HTS #define T4K28_IMAGE_SENSOR_720P_PIXELS_LINE T4K28_PV_PERIOD_PIXEL_NUMS_HTS //#define MAX_FRAME_RATE (15) //#define MIN_FRAME_RATE (12) /* SENSOR EXPOSURE LINE LIMITATION */ #define T4K28_FULL_EXPOSURE_LIMITATION (1944-4) // 5M mode #define T4K28_PV_EXPOSURE_LIMITATION (T4K28_PV_PERIOD_LINE_NUMS-4) // # of lines in one 720P frame // SENSOR VGA SIZE //For 2x Platform camera_para.c used #define IMAGE_SENSOR_PV_WIDTH T4K28_IMAGE_SENSOR_PV_WIDTH #define IMAGE_SENSOR_PV_HEIGHT T4K28_IMAGE_SENSOR_PV_HEIGHT #define IMAGE_SENSOR_FULL_WIDTH T4K28_IMAGE_SENSOR_FULL_WIDTH #define IMAGE_SENSOR_FULL_HEIGHT T4K28_IMAGE_SENSOR_FULL_HEIGHT #define T4K28_SHUTTER_LINES_GAP 0 #define T4K28_WRITE_ID (0x78) #define T4K28_READ_ID (0x79) // SENSOR CHIP VERSION #define T4K28_SENSOR_ID 0x0840 typedef struct _SENSOR_INIT_INFO { kal_uint16 address; kal_uint8 data; }t4k28_short_t; //export functions UINT32 T4K28YUVOpen(void); UINT32 T4K28YUVGetResolution(MSDK_SENSOR_RESOLUTION_INFO_STRUCT *pSensorResolution); UINT32 T4K28YUVGetInfo(MSDK_SCENARIO_ID_ENUM ScenarioId, MSDK_SENSOR_INFO_STRUCT *pSensorInfo, MSDK_SENSOR_CONFIG_STRUCT *pSensorConfigData); UINT32 T4K28YUVControl(MSDK_SCENARIO_ID_ENUM ScenarioId, MSDK_SENSOR_EXPOSURE_WINDOW_STRUCT *pImageWindow, MSDK_SENSOR_CONFIG_STRUCT *pSensorConfigData); UINT32 T4K28YUVFeatureControl(MSDK_SENSOR_FEATURE_ENUM FeatureId, UINT8 *pFeaturePara,UINT32 *pFeatureParaLen); UINT32 T4K28YUVClose(void); #endif /* __SENSOR_H */
/*-------------------------------------------------------------------------------------------------------*\ | Adium, Copyright (C) 2001-2004, Adam Iser (adamiser@mac.com | http://www.adiumx.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. \------------------------------------------------------------------------------------------------------ */ @class AIColoredBoxView, AIMiniToolbarItem; @interface AIMiniToolbar : NSView { IBOutlet NSMenu *menu_contextualMenu; //Configuration / Arrangement NSString *identifier; //The string identifier of this toolbar NSDictionary *representedObjects; //The objects we're configured for NSArray *itemIdentifierArray; //Array of item identifiers (NSString) NSMutableArray *itemArray; //Array of items (AIMiniToolbarItem) BOOL itemsRearranging; //YES if our views are currently animating/rearranging NSImage *toolbarBackground; //Drag tracking and receiving BOOL focusedForDrag; //YES if we are being dragged onto NSSize hoverSize; //The size of that object int hoverIndex; //The index it's hovering at //Dragging source NSSize draggedSize; //The item's size NSSize draggedOffset; int draggedIndex; // AIMiniToolbarItem *draggedItem; //nil if we aren't dragging } - (id)initWithFrame:(NSRect)frameRect; - (void)setIdentifier:(NSString *)inIdentifier; - (NSString *)identifier; - (void)configureForObjects:(NSDictionary *)inObjects; - (NSDictionary *)configurationObjects; - (void)insertItemWithIdentifier:(NSString *)itemIdentifier atIndex:(int)index; - (void)insertItemWithIdentifier:(NSString *)itemIdentifier atIndex:(int)index allowDuplicates:(BOOL)allowDuplicates; - (void)removeItemAtIndex:(int)index; - (void)initiateDragWithEvent:(NSEvent *)theEvent; - (IBAction)customize:(id)sender; - (NSMenu *)menuForEvent:(NSEvent *)event; @end
/*********************************************************************************** * * * Voreen - The Volume Rendering Engine * * * * Copyright (C) 2005-2013 University of Muenster, Germany. * * Visualization and Computer Graphics Group <http://viscg.uni-muenster.de> * * For a list of authors please refer to the file "CREDITS.txt". * * * * This file is part of the Voreen software package. Voreen 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. * * * * Voreen 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 in the file * * "LICENSE.txt" along with this file. If not, see <http://www.gnu.org/licenses/>. * * * * For non-commercial academic use see the license exception specified in the file * * "LICENSE-academic.txt". To get information about commercial licensing please * * contact the authors. * * * ***********************************************************************************/ #ifndef VRN_MHDVOLUMEREADER_H #define VRN_MHDVOLUMEREADER_H #include "voreen/core/io/volumereader.h" namespace voreen { class VRN_CORE_API MhdVolumeReader : public VolumeReader { public: MhdVolumeReader(ProgressBar* progress = 0); virtual VolumeReader* create(ProgressBar* progress = 0) const; virtual std::string getClassName() const { return "MhdVolumeReader"; } virtual std::string getFormatDescription() const { return "Meta IO Reader (Simple, not using ITK)"; } virtual VolumeList* read(const std::string& url) throw (tgt::FileException, std::bad_alloc); std::string convertVoxelTypeString(std::string voxelType, int numChannels); private: static const std::string loggerCat_; }; } // namespace voreen #endif
#ifndef FILESYSTEM_H #define FILESYSTEM_H #include <string.h> #include <functional> #include "bufferio.h" #ifndef _WIN32 #include <dirent.h> #include <sys/stat.h> #include <vector> #include <algorithm> #endif #ifdef _WIN32 #include <Windows.h> class FileSystem { public: static bool IsFileExists(const wchar_t* wfile) { DWORD attr = GetFileAttributesW(wfile); return attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY); } static bool IsFileExists(const char* file) { wchar_t wfile[1024]; BufferIO::DecodeUTF8(file, wfile); return IsFileExists(wfile); } static bool IsDirExists(const wchar_t* wdir) { DWORD attr = GetFileAttributesW(wdir); return attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY); } static bool IsDirExists(const char* dir) { wchar_t wdir[1024]; BufferIO::DecodeUTF8(dir, wdir); return IsDirExists(wdir); } static bool MakeDir(const wchar_t* wdir) { return CreateDirectoryW(wdir, NULL); } static bool MakeDir(const char* dir) { wchar_t wdir[1024]; BufferIO::DecodeUTF8(dir, wdir); return MakeDir(wdir); } static void TraversalDir(const wchar_t* wpath, const std::function<void(const wchar_t*, bool)>& cb) { wchar_t findstr[1024]; wcscpy(findstr, wpath); wcscat(findstr, L"/*"); WIN32_FIND_DATAW fdataw; HANDLE fh = FindFirstFileW(findstr, &fdataw); if(fh == INVALID_HANDLE_VALUE) return; do { cb(fdataw.cFileName, (fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)); } while(FindNextFileW(fh, &fdataw)); FindClose(fh); } static void TraversalDir(const char* path, const std::function<void(const char*, bool)>& cb) { wchar_t wpath[1024]; BufferIO::DecodeUTF8(path, wpath); TraversalDir(wpath, [&cb](const wchar_t* wname, bool isdir) { char name[1024]; BufferIO::EncodeUTF8(wname, name); cb(name, isdir); }); } }; #else class FileSystem { public: static bool IsFileExists(const char* file) { struct stat fileStat; return (stat(file, &fileStat) == 0) && !S_ISDIR(fileStat.st_mode); } static bool IsFileExists(const wchar_t* wfile) { char file[1024]; BufferIO::EncodeUTF8(wfile, file); return IsFileExists(file); } static bool IsDirExists(const char* dir) { struct stat fileStat; return (stat(dir, &fileStat) == 0) && S_ISDIR(fileStat.st_mode); } static bool IsDirExists(const wchar_t* wdir) { char dir[1024]; BufferIO::EncodeUTF8(wdir, dir); return IsDirExists(dir); } static bool MakeDir(const char* dir) { return mkdir(dir, 0775) == 0; } static bool MakeDir(const wchar_t* wdir) { char dir[1024]; BufferIO::EncodeUTF8(wdir, dir); return MakeDir(dir); } struct file_unit { std::string filename; bool is_dir; }; static void TraversalDir(const char* path, const std::function<void(const char*, bool)>& cb) { DIR* dir = nullptr; struct dirent* dirp = nullptr; if((dir = opendir(path)) == nullptr) return; struct stat fileStat; std::vector<file_unit> file_list; while((dirp = readdir(dir)) != nullptr) { file_unit funit; char fname[1024]; strcpy(fname, path); strcat(fname, "/"); strcat(fname, dirp->d_name); stat(fname, &fileStat); funit.filename = std::string(dirp->d_name); funit.is_dir = S_ISDIR(fileStat.st_mode); file_list.push_back(funit); } closedir(dir); std::sort(file_list.begin(), file_list.end(), TraversalDirSort); for (file_unit funit : file_list) cb(funit.filename.c_str(), funit.is_dir); } static bool TraversalDirSort(file_unit file1, file_unit file2) { if(file1.is_dir != file2.is_dir) { return file2.is_dir; } else { return file1.filename < file2.filename; } } static void TraversalDir(const wchar_t* wpath, const std::function<void(const wchar_t*, bool)>& cb) { char path[1024]; BufferIO::EncodeUTF8(wpath, path); TraversalDir(path, [&cb](const char* name, bool isdir) { wchar_t wname[1024]; BufferIO::DecodeUTF8(name, wname); cb(wname, isdir); }); } }; #endif // _WIN32 #endif //FILESYSTEM_H
/* Aseprite * Copyright (C) 2001-2013 David Capello * * 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 APP_UNDOERS_ADD_LAYER_H_INCLUDED #define APP_UNDOERS_ADD_LAYER_H_INCLUDED #pragma once #include "app/undoers/undoer_base.h" #include "undo/object_id.h" namespace raster { class Layer; } namespace app { class Document; namespace undoers { using namespace raster; using namespace undo; class AddLayer : public UndoerBase { public: AddLayer(ObjectsContainer* objects, Document* document, Layer* layer); void dispose() override; size_t getMemSize() const override { return sizeof(*this); } void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: ObjectId m_documentId; ObjectId m_layerId; }; } // namespace undoers } // namespace app #endif // UNDOERS_ADD_LAYER_H_INCLUDED
/* Copyright (C) 2003-2006, Advanced Micro Devices, Inc. * * 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 _GEODE_AES_H_ #define _GEODE_AES_H_ /* driver logic flags */ #define AES_MODE_ECB 0 #define AES_MODE_CBC 1 #define AES_DIR_DECRYPT 0 #define AES_DIR_ENCRYPT 1 #define AES_FLAGS_HIDDENKEY (1 << 0) /* Register definitions */ #define AES_CTRLA_REG 0x0000 #define AES_CTRL_START 0x01 #define AES_CTRL_DECRYPT 0x00 #define AES_CTRL_ENCRYPT 0x02 #define AES_CTRL_WRKEY 0x04 #define AES_CTRL_DCA 0x08 #define AES_CTRL_SCA 0x10 #define AES_CTRL_CBC 0x20 #define AES_INTR_REG 0x0008 #define AES_INTRA_PENDING (1 << 16) #define AES_INTRB_PENDING (1 << 17) #define AES_INTR_PENDING (AES_INTRA_PENDING | AES_INTRB_PENDING) #define AES_INTR_MASK 0x07 #define AES_SOURCEA_REG 0x0010 #define AES_DSTA_REG 0x0014 #define AES_LENA_REG 0x0018 #define AES_WRITEKEY0_REG 0x0030 #define AES_WRITEIV0_REG 0x0040 /* A very large counter that is used to gracefully bail out of an * operation in case of trouble */ #define AES_OP_TIMEOUT 0x50000 struct geode_aes_op { void *src; void *dst; u32 mode; u32 dir; u32 flags; int len; u8 key[AES_KEYSIZE_128]; u8 *iv; union { struct crypto_skcipher *blk; struct crypto_cipher *cip; } fallback; u32 keylen; }; #endif
/* * leds-msm-pmic.c - MSM PMIC LEDs driver. * * Copyright (c) 2009, Code Aurora Forum. 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 and * only 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. */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/leds.h> #include <mach/pmic.h> #if defined (CONFIG_LGE_UNIFIED_LED) #include <mach/board_lge.h> struct msm_pmic_leds_pdata *leds_pdata = 0; #endif /*LED has 15 steps (10mA per step). LED's max power capacity is 150mA. (0~255 level)*/ #define MAX_KEYPAD_BL_LEVEL 16 // 150mA #define TUNED_MAX_KEYPAD_BL_LEVEL 127 // 60mA static void msm_keypad_bl_led_set(struct led_classdev *led_cdev, enum led_brightness value) { int ret; #if defined (CONFIG_LGE_UNIFIED_LED) ret = leds_pdata->msm_keypad_led_set(value / TUNED_MAX_KEYPAD_BL_LEVEL); #else /* origin */ #ifdef CONFIG_MACH_MSM7X27_THUNDERA /* jinkyu.choi@lge.com * P505, use the android led interface values, 255,127,0 * LED current is controlled by arm9 AMSS with the given values. */ ret = pmic_set_led_intensity(LED_KEYPAD, value); #else ret = pmic_set_led_intensity(LED_KEYPAD, value / TUNED_MAX_KEYPAD_BL_LEVEL); #endif /* end of CONFIG_MACH_MSM7X27_THUNDERA */ #endif if (ret) dev_err(led_cdev->dev, "can't set keypad backlight\n"); } static struct led_classdev msm_kp_bl_led = { .name = "keyboard-backlight", .brightness_set = msm_keypad_bl_led_set, .brightness = LED_OFF, }; static int msm_pmic_led_probe(struct platform_device *pdev) { int rc; #if defined (CONFIG_LGE_UNIFIED_LED) leds_pdata = pdev->dev.platform_data; #endif #ifndef CONFIG_LGE_UNIFIED_LED if (pdev->dev.platform_data) msm_kp_bl_led.name = pdev->dev.platform_data; #endif rc = led_classdev_register(&pdev->dev, &msm_kp_bl_led); if (rc) { dev_err(&pdev->dev, "unable to register led class driver\n"); return rc; } msm_keypad_bl_led_set(&msm_kp_bl_led, LED_OFF); #if defined (CONFIG_LGE_UNIFIED_LED) leds_pdata->register_custom_leds(pdev); #endif return rc; } static int __devexit msm_pmic_led_remove(struct platform_device *pdev) { led_classdev_unregister(&msm_kp_bl_led); #if defined (CONFIG_LGE_UNIFIED_LED) leds_pdata->unregister_custom_leds(); #endif return 0; } #ifdef CONFIG_PM static int msm_pmic_led_suspend(struct platform_device *dev, pm_message_t state) { led_classdev_suspend(&msm_kp_bl_led); #if defined (CONFIG_LGE_UNIFIED_LED) leds_pdata->suspend_custom_leds(); #endif return 0; } static int msm_pmic_led_resume(struct platform_device *dev) { led_classdev_resume(&msm_kp_bl_led); #if defined (CONFIG_LGE_UNIFIED_LED) leds_pdata->resume_custom_leds(); #endif return 0; } #else #define msm_pmic_led_suspend NULL #define msm_pmic_led_resume NULL #endif #ifdef CONFIG_MACH_LGE /* * 2011-03-08, jinkyu.choi@lge.com * if using the VBAT power, * we should turn off the leds when reboot or power down. */ static void msm_pmic_led_shutdown(struct platform_device *dev) { msm_keypad_bl_led_set(&msm_kp_bl_led, LED_OFF); //printk("%s is done!\n", __func__); } #endif static struct platform_driver msm_pmic_led_driver = { .probe = msm_pmic_led_probe, .remove = __devexit_p(msm_pmic_led_remove), .suspend = msm_pmic_led_suspend, .resume = msm_pmic_led_resume, #ifdef CONFIG_MACH_LGE .shutdown = msm_pmic_led_shutdown, #endif .driver = { .name = "pmic-leds", .owner = THIS_MODULE, }, }; static int __init msm_pmic_led_init(void) { return platform_driver_register(&msm_pmic_led_driver); } module_init(msm_pmic_led_init); static void __exit msm_pmic_led_exit(void) { platform_driver_unregister(&msm_pmic_led_driver); } module_exit(msm_pmic_led_exit); MODULE_DESCRIPTION("MSM PMIC LEDs driver"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:pmic-leds");
/* arch/arm/mach-s3c2410/include/mach/hardware.h * * Copyright (c) 2003 Simtec Electronics * Ben Dooks <ben@simtec.co.uk> * * S3C2410 - hardware * * 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 __ASM_ARCH_HARDWARE_H #define __ASM_ARCH_HARDWARE_H #ifndef __ASSEMBLY__ extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg); #ifdef CONFIG_CPU_S3C2440 extern int s3c2440_set_dsc(unsigned int pin, unsigned int value); #endif /* CONFIG_CPU_S3C2440 */ #ifdef CONFIG_CPU_S3C2412 extern int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state); #endif /* CONFIG_CPU_S3C2412 */ #endif /* __ASSEMBLY__ */ #include <asm/sizes.h> #include <mach/map.h> /* machine specific hardware definitions should go after this */ /* currently here until moved into config (todo) */ #define CONFIG_NO_MULTIWORD_IO #endif /* __ASM_ARCH_HARDWARE_H */
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM e:/xr19rel/WINNT_5.2_Depend/mozilla/modules/plugin/base/public/nsIEventHandler.idl */ #ifndef __gen_nsIEventHandler_h__ #define __gen_nsIEventHandler_h__ #ifndef __gen_nsISupports_h__ #include "nsISupports.h" #endif #ifndef __gen_nspluginroot_h__ #include "nspluginroot.h" #endif /* For IDL files that don't want to include root IDL files. */ #ifndef NS_NO_VTABLE #define NS_NO_VTABLE #endif #include "nsplugindefs.h" /* starting interface: nsIEventHandler */ #define NS_IEVENTHANDLER_IID_STR "a447ddf0-1a99-11d2-815f-006008119d7a" #define NS_IEVENTHANDLER_IID \ {0xa447ddf0, 0x1a99, 0x11d2, \ { 0x81, 0x5f, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a }} class NS_NO_VTABLE nsIEventHandler : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEVENTHANDLER_IID) /** * Handles an event. An nsIEventHandler can also get registered with with * nsIPluginManager2::RegisterWindow and will be called whenever an event * comes in for that window. * * Note that for Unix and Mac the nsPluginEvent structure is different * from the old NPEvent structure -- it's no longer the native event * record, but is instead a struct. This was done for future extensibility, * and so that the Mac could receive the window argument too. For Windows * and OS2, it's always been a struct, so there's no change for them. * * (Corresponds to NPP_HandleEvent.) * * @param aEvent - the event to be handled * @param aHandled - set to PR_TRUE if event was handled * @result - NS_OK if this operation was successful */ /* void handleEvent (in nsPluginEventPtr aEvent, out boolean aHandled); */ NS_IMETHOD HandleEvent(nsPluginEvent * aEvent, PRBool *aHandled) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIEventHandler, NS_IEVENTHANDLER_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSIEVENTHANDLER \ NS_IMETHOD HandleEvent(nsPluginEvent * aEvent, PRBool *aHandled); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSIEVENTHANDLER(_to) \ NS_IMETHOD HandleEvent(nsPluginEvent * aEvent, PRBool *aHandled) { return _to HandleEvent(aEvent, aHandled); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSIEVENTHANDLER(_to) \ NS_IMETHOD HandleEvent(nsPluginEvent * aEvent, PRBool *aHandled) { return !_to ? NS_ERROR_NULL_POINTER : _to->HandleEvent(aEvent, aHandled); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsEventHandler : public nsIEventHandler { public: NS_DECL_ISUPPORTS NS_DECL_NSIEVENTHANDLER nsEventHandler(); private: ~nsEventHandler(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsEventHandler, nsIEventHandler) nsEventHandler::nsEventHandler() { /* member initializers and constructor code */ } nsEventHandler::~nsEventHandler() { /* destructor code */ } /* void handleEvent (in nsPluginEventPtr aEvent, out boolean aHandled); */ NS_IMETHODIMP nsEventHandler::HandleEvent(nsPluginEvent * aEvent, PRBool *aHandled) { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif #endif /* __gen_nsIEventHandler_h__ */
/* sd2iec - SD/MMC to Commodore serial bus interface/controller Copyright (C) 2007-2014 Ingo Korb <ingo@akana.de> Inspired by MMC2IEC by Lars Pontoppidan et al. FAT filesystem access based on code from ChaN and Jim Brain, see ff.c|h. 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 only. 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 iec.h: Definitions for the IEC handling code */ #ifndef IEC_H #define IEC_H #include "bus.h" /** * struct iecflags_t - Bitfield of various flags, mostly IEC-related * @eoi_recvd : Received EOI with the last byte read * @command_recvd : Command or filename received * @jiffy_active : JiffyDOS-capable master detected * @jiffy_load : JiffyDOS LOAD operation detected * @dolphin_active : DolphinDOS parallel mode active * * NOTE: This was converted from a struct with bitfields to * a single variable with macros because the struct * version created worse code on AVR. * * This is a bitfield for a number of boolean variables used * (FIXME: This seems to be truncated) */ #define EOI_RECVD (1<<0) #define COMMAND_RECVD (1<<1) #define JIFFY_ACTIVE (1<<2) #define JIFFY_LOAD (1<<3) #ifdef CONFIG_PARALLEL_DOLPHIN # define DOLPHIN_ACTIVE (1<<4) #else # define DOLPHIN_ACTIVE 0 #endif typedef struct { uint8_t iecflags; enum { BUS_IDLE = 0, BUS_ATNACTIVE, BUS_FOUNDATN, BUS_FORME, BUS_NOTFORME, BUS_ATNFINISH, BUS_ATNPROCESS, BUS_CLEANUP, BUS_SLEEP } bus_state; enum { DEVICE_IDLE = 0, DEVICE_LISTEN, DEVICE_TALK } device_state; uint8_t secondary_address; } iec_data_t; extern iec_data_t iec_data; uint8_t iec_check_atn(void); void iec_init(void); void __attribute__ ((noreturn)) iec_mainloop(void); #endif
/* libxnm * xnm-parse-and-query.c: * * Copyright (C) 2007 Dov Grobgeld * * 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; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #include "xnm.h" static void die(const char *fmt, ...) { va_list ap; va_start(ap,fmt); vfprintf(stderr, fmt, ap); exit(-1); } void print_xnm_value(XnmValue *xnm_value) { char *exp_string = xnm_value_export_to_string(xnm_value); printf("%s\n", exp_string); g_free(exp_string); } #define CASE(s) if (!strcmp(s, S_)) int main(int argc, char **argv) { const char s[] = "oranges => 3\n" "bananas => 5\n" "reco => {\n" " peach => 42\n" " array => [1 2 3 \"hello there\"]\n" "}\n" "array=[3 23 5]\n" "deep=[[[[[[[[[[{a=>42}]]]]]]]]]]\n" ; int argp = 1; gchar *filename; XnmValue *root; GError *error = NULL; gchar *key = NULL; gboolean do_get_len = FALSE; while(argp < argc && argv[argp][0] == '-') { char *S_ = argv[argp++]; CASE("-help") { printf("xnm-parse-and-query - Parse and query xnm strings\n\n" "Syntax:\n" " xnm-parse-and-query [-key key] [-len] [file]\n" "\n" "Options:\n" " -key key Foo\n" " -len Get len of arrays\n" ); exit(0); } CASE("-key") { key = argv[argp++]; continue; } CASE("-len") { do_get_len++; continue; } die("Unknown option %s!\n", S_); } if (argp < argc) { filename = argv[argp++]; xnm_parse_file(filename, // output &root, &error); } else xnm_parse_string(s, // output &root, &error); if (error) { fprintf(stderr, "parse error: %s\n", error->message); g_error_free(error); exit(-1); } if (do_get_len) { gchar *k = key; if (k == NULL) k = ""; // Root int len = xnm_value_get_array_length(root, k); printf("len = %d\n", len); } else if (key) { XnmValue *val; xnm_value_get(root, key, // output &val); print_xnm_value(val); xnm_value_unref(val); } else { print_xnm_value(root); } xnm_value_unref(root); exit(0); return(0); }
/* SPDX-License-Identifier: GPL-2.0-only */ #include <acpi/acpi.h> #include <bootstate.h> #include <cbmem.h> #include <console/console.h> #include <device/device.h> #include <device/pci_def.h> #include <dimm_info_util.h> #include <memory_info.h> #include <lib.h> #include <string.h> #include <amdblocks/agesawrapper.h> #include <amdblocks/agesawrapper_call.h> /** * Populate dimm_info using AGESA TYPE17_DMI_INFO. */ static void transfer_memory_info(TYPE17_DMI_INFO *dmi17, struct dimm_info *dimm) { hexstrtobin(dmi17->SerialNumber, dimm->serial, sizeof(dimm->serial)); dimm->dimm_size = smbios_memory_size_to_mib(dmi17->MemorySize, dmi17->ExtSize); dimm->ddr_type = dmi17->MemoryType; /* * dimm_info uses ddr_frequency for setting both config speed and max * speed. Lets use config speed so we don't get the false impression * that the RAM is running faster than it actually is. */ dimm->ddr_frequency = dmi17->ConfigSpeed; dimm->rank_per_dimm = dmi17->Attributes; dimm->mod_type = smbios_form_factor_to_spd_mod_type(dmi17->MemoryType, dmi17->FormFactor); dimm->bus_width = smbios_bus_width_to_spd_width(dmi17->MemoryType, dmi17->TotalWidth, dmi17->DataWidth); dimm->mod_id = dmi17->ManufacturerIdCode; dimm->bank_locator = 0; strncpy((char *)dimm->module_part_number, dmi17->PartNumber, sizeof(dimm->module_part_number) - 1); } static void print_dimm_info(const struct dimm_info *dimm) { printk(RAM_SPEW, "CBMEM_ID_MEMINFO:\n" " dimm_size: %u\n" " ddr_type: 0x%hx\n" " ddr_frequency: %hu\n" " rank_per_dimm: %hhu\n" " channel_num: %hhu\n" " dimm_num: %hhu\n" " bank_locator: %hhu\n" " mod_id: %hu\n" " mod_type: 0x%hhx\n" " bus_width: %hhu\n" " serial: %02hhx%02hhx%02hhx%02hhx\n" " module_part_number(%zu): %s\n", dimm->dimm_size, dimm->ddr_type, dimm->ddr_frequency, dimm->rank_per_dimm, dimm->channel_num, dimm->dimm_num, dimm->bank_locator, dimm->mod_id, dimm->mod_type, dimm->bus_width, dimm->serial[0], dimm->serial[1], dimm->serial[2], dimm->serial[3], strlen((char *) dimm->module_part_number), (char *) dimm->module_part_number ); } static void print_dmi_info(const TYPE17_DMI_INFO *dmi17) { printk(RAM_SPEW, "AGESA TYPE 17 DMI INFO:\n" " Handle: %hu\n" " TotalWidth: %hu\n" " DataWidth: %hu\n" " MemorySize: %hu\n" " DeviceSet: %hhu\n" " Speed: %hu\n" " ManufacturerIdCode: %llu\n" " Attributes: %hhu\n" " ExtSize: %u\n" " ConfigSpeed: %hu\n" " MemoryType: 0x%x\n" " FormFactor: 0x%x\n" " DeviceLocator: %8s\n" " BankLocator: %10s\n" " SerialNumber(%zu): %9s\n" " PartNumber(%zu): %19s\n", dmi17->Handle, dmi17->TotalWidth, dmi17->DataWidth, dmi17->MemorySize, dmi17->DeviceSet, dmi17->Speed, dmi17->ManufacturerIdCode, dmi17->Attributes, dmi17->ExtSize, dmi17->ConfigSpeed, dmi17->MemoryType, dmi17->FormFactor, dmi17->DeviceLocator, dmi17->BankLocator, strlen((char *) dmi17->SerialNumber), dmi17->SerialNumber, strlen((char *) dmi17->PartNumber), dmi17->PartNumber ); } static void prepare_dmi_17(void *unused) { DMI_INFO *DmiTable; TYPE17_DMI_INFO *address; struct memory_info *mem_info; struct dimm_info *dimm; int i, j, dimm_cnt = 0; mem_info = cbmem_add(CBMEM_ID_MEMINFO, sizeof(struct memory_info)); if (!mem_info) { printk(BIOS_NOTICE, "Failed to add memory info to CBMEM.\n"); return; } memset(mem_info, 0, sizeof(struct memory_info)); DmiTable = agesawrapper_getlateinitptr(PICK_DMI); for (i = 0; i < MAX_CHANNELS_PER_SOCKET; i++) { for (j = 0; j < MAX_DIMMS_PER_CHANNEL; j++) { address = &DmiTable->T17[0][i][j]; if (address->Handle > 0) { dimm = &mem_info->dimm[dimm_cnt]; dimm->channel_num = i; dimm->dimm_num = j; transfer_memory_info(address, dimm); print_dmi_info(address); print_dimm_info(dimm); dimm_cnt++; } } } mem_info->dimm_cnt = dimm_cnt; } BOOT_STATE_INIT_ENTRY(BS_WRITE_TABLES, BS_ON_ENTRY, prepare_dmi_17, NULL); static void agesawrapper_post_device(void *unused) { if (acpi_is_wakeup_s3()) return; do_agesawrapper(AMD_INIT_LATE, "amdinitlate"); if (!acpi_s3_resume_allowed()) return; do_agesawrapper(AMD_INIT_RTB, "amdinitrtb"); } BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_EXIT, agesawrapper_post_device, NULL);
#ifndef __NR_FILTER_IMAGE_H__ #define __NR_FILTER_IMAGE_H__ /* * feImage filter primitive renderer * * Authors: * Niko Kiirala <niko@kiirala.com> * * Copyright (C) 2007 authors * * Released under GNU GPL, read the file 'COPYING' for more information */ #include <gdkmm/pixbuf.h> #include "display/nr-filter-primitive.h" #include <glibmm/refptr.h> class SPDocument; class SPItem; namespace Inkscape { namespace Filters { class FilterSlot; class FilterImage : public FilterPrimitive { public: FilterImage(); static FilterPrimitive *create(); virtual ~FilterImage(); virtual void render_cairo(FilterSlot &slot); virtual bool can_handle_affine(Geom::Affine const &); virtual double complexity(Geom::Affine const &ctm); void set_document( SPDocument *document ); void set_href(const gchar *href); void set_align( unsigned int align ); void set_clip( unsigned int clip ); bool from_element; SPItem* SVGElem; private: SPDocument *document; gchar *feImageHref; Glib::RefPtr<Gdk::Pixbuf> image; cairo_surface_t *image_surface; float feImageX, feImageY, feImageWidth, feImageHeight; unsigned int aspect_align, aspect_clip; bool broken_ref; }; } /* namespace Filters */ } /* namespace Inkscape */ #endif /* __NR_FILTER_IMAGE_H__ */ /* Local Variables: mode:c++ c-file-style:"stroustrup" c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
/* * desktop-app-info: A GDesktopAppInfo like object for garcon menu * items implementing and supporting GAppInfo * * Copyright 2012-2021 Stephan Haller <nomad@froevel.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., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * */ #ifndef __LIBXFDASHBOARD_DESKTOP_APP_INFO__ #define __LIBXFDASHBOARD_DESKTOP_APP_INFO__ #if !defined(__LIBXFDASHBOARD_H_INSIDE__) && !defined(LIBXFDASHBOARD_COMPILATION) #error "Only <libxfdashboard/libxfdashboard.h> can be included directly." #endif #include <libxfdashboard/desktop-app-info-action.h> #include <garcon/garcon.h> G_BEGIN_DECLS #define XFDASHBOARD_TYPE_DESKTOP_APP_INFO (xfdashboard_desktop_app_info_get_type()) #define XFDASHBOARD_DESKTOP_APP_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFDASHBOARD_TYPE_DESKTOP_APP_INFO, XfdashboardDesktopAppInfo)) #define XFDASHBOARD_IS_DESKTOP_APP_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFDASHBOARD_TYPE_DESKTOP_APP_INFO)) #define XFDASHBOARD_DESKTOP_APP_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XFDASHBOARD_TYPE_DESKTOP_APP_INFO, XfdashboardDesktopAppInfoClass)) #define XFDASHBOARD_IS_DESKTOP_APP_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XFDASHBOARD_TYPE_DESKTOP_APP_INFO)) #define XFDASHBOARD_DESKTOP_APP_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XFDASHBOARD_TYPE_DESKTOP_APP_INFO, XfdashboardDesktopAppInfoClass)) typedef struct _XfdashboardDesktopAppInfo XfdashboardDesktopAppInfo; typedef struct _XfdashboardDesktopAppInfoClass XfdashboardDesktopAppInfoClass; typedef struct _XfdashboardDesktopAppInfoPrivate XfdashboardDesktopAppInfoPrivate; struct _XfdashboardDesktopAppInfo { /*< private >*/ /* Parent instance */ GObject parent_instance; /* Private structure */ XfdashboardDesktopAppInfoPrivate *priv; }; struct _XfdashboardDesktopAppInfoClass { /*< private >*/ /* Parent class */ GObjectClass parent_class; /*< public >*/ /* Virtual functions */ void (*changed)(XfdashboardDesktopAppInfo *self); }; /* Public API */ GType xfdashboard_desktop_app_info_get_type(void) G_GNUC_CONST; GAppInfo* xfdashboard_desktop_app_info_new_from_desktop_id(const gchar *inDesktopID); GAppInfo* xfdashboard_desktop_app_info_new_from_path(const gchar *inPath); GAppInfo* xfdashboard_desktop_app_info_new_from_file(GFile *inFile); GAppInfo* xfdashboard_desktop_app_info_new_from_menu_item(GarconMenuItem *inMenuItem); gboolean xfdashboard_desktop_app_info_is_valid(XfdashboardDesktopAppInfo *self); GFile* xfdashboard_desktop_app_info_get_file(XfdashboardDesktopAppInfo *self); gboolean xfdashboard_desktop_app_info_reload(XfdashboardDesktopAppInfo *self); const GList* xfdashboard_desktop_app_info_get_actions(XfdashboardDesktopAppInfo *self); gboolean xfdashboard_desktop_app_info_launch_action(XfdashboardDesktopAppInfo *self, XfdashboardDesktopAppInfoAction *inAction, GAppLaunchContext *inContext, GError **outError); gboolean xfdashboard_desktop_app_info_launch_action_by_name(XfdashboardDesktopAppInfo *self, const gchar *inActionName, GAppLaunchContext *inContext, GError **outError); const GList* xfdashboard_desktop_app_info_get_keywords(XfdashboardDesktopAppInfo *self); gboolean xfdashboard_desktop_app_info_has_key(XfdashboardDesktopAppInfo *self, const gchar *inKey); gchar* xfdashboard_desktop_app_info_get_string(XfdashboardDesktopAppInfo *self, const gchar *inKey); gchar* xfdashboard_desktop_app_info_get_locale_string(XfdashboardDesktopAppInfo *self, const gchar *inKey); gchar** xfdashboard_desktop_app_info_get_string_list(XfdashboardDesktopAppInfo *self, const gchar *inKey); gchar** xfdashboard_desktop_app_info_get_locale_string_list(XfdashboardDesktopAppInfo *self, const gchar *inKey); gboolean xfdashboard_desktop_app_info_get_bool(XfdashboardDesktopAppInfo *self, const gchar *inKey); G_END_DECLS #endif /* __LIBXFDASHBOARD_DESKTOP_APP_INFO__ */
#include <Python.h> #include "config.h" #include "internal.h" /** * \internal */ #define debug(x) printf(x) /** \defgroup config Config * \brief Layman library configuration module */ /** \addtogroup config * @{ */ /** * \internal */ struct BareConfig { PyObject *object; }; /** * \internal * Returns the internal Python object. */ PyObject *_bareConfigObject(BareConfig *c) { if (c && c->object) return c->object; else Py_RETURN_NONE; } /** * Creates a bare config object with default values. * * \param outFd where information must be written to * \param inFd where information must be read from * \param errFd where errors must be written to * * \return a new instance of a BareConfig object. It must be freed with bareConfigFree() */ BareConfig *bareConfigCreate(Message *m, FILE* outFd, FILE* inFd, FILE* errFd) { if (!outFd || fileno(outFd) <= 0) outFd = stdout; if (!inFd || fileno(inFd) <= 0) inFd = stdin; if (!errFd || fileno(errFd) <= 0) errFd = stderr; PyObject *pyout = PyFile_FromFile(outFd, "", "w", 0); PyObject *pyin = PyFile_FromFile(inFd, "", "r", 0); PyObject *pyerr = PyFile_FromFile(errFd, "", "w", 0); PyObject *obj = executeFunction("layman.config", "BareConfig", "OOOO", _messageObject(m), pyout, pyin, pyerr); Py_DECREF(pyout); Py_DECREF(pyin); Py_DECREF(pyerr); if (!obj) { debug("The execution failed, Are you sure app-portage/layman-8888 is properly installed ?\n"); return NULL; } BareConfig *ret = malloc(sizeof(BareConfig)); ret->object = obj; return ret; } /** * Frees a BareConfig object. */ void bareConfigFree(BareConfig* cfg) { if (cfg && cfg->object) { Py_DECREF(cfg->object); } if (cfg) free(cfg); } /** * Get an option's default value. * * \param opt the name of the option * * \return the value or NULL on failure. */ const char* bareConfigGetDefaultValue(BareConfig* cfg, const char* opt) { PyObject *obj = PyObject_CallMethod(cfg->object, "get_defaults", NULL); if (!obj) return NULL; if (PyDict_Contains(obj, PyString_FromString(opt))) { PyObject *pyopt = PyString_FromString(opt); char *tmp = PyString_AsString(PyDict_GetItem(obj, pyopt)); Py_DECREF(pyopt); char *ret = malloc(sizeof(char) * strlen(tmp)); strcpy(ret, tmp); Py_DECREF(obj); return ret; } else return ""; } /* * Get an option's current value. * * \param opt the name of the option * * \return the value or NULL on failure */ const char* bareConfigGetOptionValue(BareConfig* cfg, const char* opt) { PyObject *obj = PyObject_CallMethod(cfg->object, "get_option", "(z)", opt); char *tmp = PyString_AsString(obj); char *ret = malloc(sizeof(char) * (strlen(tmp) + 1)); strcpy(ret, tmp); Py_DECREF(obj); return ret; } /* * Modifies an option's value * * \param opt the name of the option * \param val the new value for this option * * \return True on success, 0 on failure */ int bareConfigSetOptionValue(BareConfig* cfg, const char* opt, const char* val) { PyObject *obj = PyObject_CallMethod(cfg->object, "set_option", "(zz)", opt, val); int ret; if (obj) ret = 1; else ret = 0; Py_DECREF(obj); return ret; } /** @} */
#include <nptl/sysdeps/unix/sysv/linux/smp.h>
/* * COPYRIGHT (c) 1989-2008. * 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: semaphore.c,v 1.19 2009/02/03 10:10:56 ralf Exp $ */ #if HAVE_CONFIG_H #include "config.h" #endif #include <stdarg.h> #include <errno.h> #include <fcntl.h> #include <pthread.h> #include <semaphore.h> #include <limits.h> #include <rtems/system.h> #include <rtems/config.h> #include <rtems/score/object.h> #include <rtems/posix/semaphore.h> #include <rtems/posix/time.h> #include <rtems/seterr.h> /*PAGE * * _POSIX_Semaphore_Manager_initialization * * This routine initializes all semaphore manager related data structures. * * Input parameters: NONE * * Output parameters: NONE */ void _POSIX_Semaphore_Manager_initialization(void) { _Objects_Initialize_information( &_POSIX_Semaphore_Information, /* object information table */ OBJECTS_POSIX_API, /* object API */ OBJECTS_POSIX_SEMAPHORES, /* object class */ Configuration_POSIX_API.maximum_semaphores, /* maximum objects of this class */ sizeof( POSIX_Semaphore_Control ), /* size of this object's control block */ true, /* true if names for this object are strings */ _POSIX_PATH_MAX /* maximum length of each object's name */ #if defined(RTEMS_MULTIPROCESSING) , false, /* true if this is a global object class */ NULL /* Proxy extraction support callout */ #endif ); }
/* * Copyright (c) 2005, Bull S.A.. All rights reserved. * Created by: Sebastien Decugis * Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz> * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * You should have received a copy of the GNU General Public License along * with this program; if not, write the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This sample test aims to check the following assertions: * * If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, * sa_sigaction is used as the signal handling function. * * The steps are: * -> test for RTS extension * -> register a handler for SIGVTALRM with SA_SIGINFO, and a known function * as sa_sigaction * -> raise SIGVTALRM, and check the function has been called. * * The test fails if the function is not called */ #include <pthread.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <signal.h> #include <errno.h> #include "posixtest.h" static volatile sig_atomic_t called = 0; static void handler(int sig, siginfo_t *info, void *context) { (void) sig; (void) context; if (info->si_signo != SIGVTALRM) { PTS_WRITE_MSG("Wrong signal generated?\n"); _exit(PTS_FAIL); } called = 1; } int main(void) { int ret; long rts; struct sigaction sa; /* Test the RTS extension */ rts = sysconf(_SC_REALTIME_SIGNALS); if (rts < 0L) { fprintf(stderr, "This test needs the RTS extension"); return PTS_UNTESTED; } /* Set the signal handler */ sa.sa_flags = SA_SIGINFO; sa.sa_sigaction = handler; ret = sigemptyset(&sa.sa_mask); if (ret != 0) { perror("Failed to empty signal set"); return PTS_UNRESOLVED; } /* Install the signal handler for SIGVTALRM */ ret = sigaction(SIGVTALRM, &sa, 0); if (ret != 0) { perror("Failed to set signal handler"); return PTS_UNTESTED; } if (called) { fprintf(stderr, "The signal handler has been called before signal was raised"); return PTS_FAIL; } ret = raise(SIGVTALRM); if (ret != 0) { perror("Failed to raise SIGVTALRM"); return PTS_UNRESOLVED; } if (!called) { fprintf(stderr, "The sa_handler was not called"); return PTS_FAIL; } printf("Test PASSED\n"); return PTS_PASS; }
/*************************************************************************** qgsogrconnpool.h --------------------- begin : May 2015 copyright : (C) 2015 by Sandro Mani email : smani at sourcepole dot ch *************************************************************************** * * * 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 QGSOGRCONNPOOL_H #define QGSOGRCONNPOOL_H #include "qgsconnectionpool.h" #include "qgsogrprovider.h" #include <ogr_api.h> struct QgsOgrConn { QString path; OGRDataSourceH ds; bool valid; }; inline QString qgsConnectionPool_ConnectionToName( QgsOgrConn* c ) { return c->path; } inline void qgsConnectionPool_ConnectionCreate( QString connInfo, QgsOgrConn*& c ) { c = new QgsOgrConn; QString filePath = connInfo.left( connInfo.indexOf( "|" ) ); c->ds = OGROpen( filePath.toUtf8().constData(), false, nullptr ); c->path = connInfo; c->valid = true; } inline void qgsConnectionPool_ConnectionDestroy( QgsOgrConn* c ) { QgsOgrProviderUtils::OGRDestroyWrapper( c->ds ); delete c; } inline void qgsConnectionPool_InvalidateConnection( QgsOgrConn* c ) { c->valid = false; } inline bool qgsConnectionPool_ConnectionIsValid( QgsOgrConn* c ) { return c->valid; } class QgsOgrConnPoolGroup : public QObject, public QgsConnectionPoolGroup<QgsOgrConn*> { Q_OBJECT public: explicit QgsOgrConnPoolGroup( QString name ) : QgsConnectionPoolGroup<QgsOgrConn*>( name ) , mRefCount( 0 ) { initTimer( this ); } void ref() { ++mRefCount; } bool unref() { Q_ASSERT( mRefCount > 0 ); return --mRefCount == 0; } protected slots: void handleConnectionExpired() { onConnectionExpired(); } void startExpirationTimer() { expirationTimer->start(); } void stopExpirationTimer() { expirationTimer->stop(); } protected: Q_DISABLE_COPY( QgsOgrConnPoolGroup ) private: int mRefCount; }; /** Ogr connection pool - singleton */ class QgsOgrConnPool : public QgsConnectionPool<QgsOgrConn*, QgsOgrConnPoolGroup> { public: // NOTE: first call to this function initializes the // singleton. // WARNING: concurrent call from multiple threads may result // in multiple instances being created, and memory // leaking at exit. // static QgsOgrConnPool* instance(); // Singleton cleanup // // Make sure nobody is using the instance before calling // this function. // // WARNING: concurrent call from multiple threads may result // in double-free of the instance. // static void cleanupInstance(); /** * @brief Increases the reference count on the connection pool for the specified connection. * @param connInfo The connection string. * @note * Any user of the connection pool needs to increase the reference count * before it acquires any connections and decrease the reference count after * releasing all acquired connections to ensure that all open OGR handles * are freed when and only when no one is using the pool anymore. */ void ref( const QString& connInfo ) { mMutex.lock(); T_Groups::const_iterator it = mGroups.constFind( connInfo ); if ( it == mGroups.constEnd() ) it = mGroups.insert( connInfo, new QgsOgrConnPoolGroup( connInfo ) ); it.value()->ref(); mMutex.unlock(); } /** * @brief Decrease the reference count on the connection pool for the specified connection. * @param connInfo The connection string. */ void unref( const QString& connInfo ) { mMutex.lock(); T_Groups::iterator it = mGroups.find( connInfo ); if ( it == mGroups.end() ) { mMutex.unlock(); return; } if ( it.value()->unref() ) { delete it.value(); mGroups.erase( it ); } mMutex.unlock(); } protected: Q_DISABLE_COPY( QgsOgrConnPool ) private: QgsOgrConnPool(); ~QgsOgrConnPool(); static QgsOgrConnPool *mInstance; }; #endif // QGSOGRCONNPOOL_H
/* Vocoder.h - Vocoder Effect Author: Ryam Billing & Josep Andreu Adapted effect structure of ZynAddSubFX - a software synthesizer Author: Nasca Octavian Paul This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License (version 2) for more details. You should have received a copy of the GNU General Public License (version 2) along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef VOCODER_H #define VOCODER_H #include "global.h" #include "AnalogFilter.h" #include "Resample.h" class Vocoder { public: Vocoder (float * efxoutl_, float * efxoutr_, float *auxresampled_,int bands, int DS, int uq, int dq, double sample_rate, uint32_t intermediate_bufsize); ~Vocoder (); void out (float * smpsl, float * smpr, uint32_t period); void setpreset (int npreset); void changepar (int npar, int value); int getpar (int npar); void cleanup (); void adjust(int DS, double sample_rate); int Ppreset; float outvolume; float vulevel; float *efxoutl; float *efxoutr; float *auxresampled; private: void setvolume (int Pvolume); void setpanning (int Ppanning); void init_filters(); void adjustq(float q); void setbands(int numbands, float startfreq, float endfreq); int VOC_BANDS; //Parametrii int Pvolume; //This is master wet/dry mix like other FX...but I am finding it is not useful int Ppanning; //Panning int Plrcross; // L/R Mixing // This is a mono effect, so lrcross and panning are pointless int Plevel; //This should only adjust the level of the IR effect, and not wet/dry mix int Pinput; int Pband; int Pmuffle; int Pqq; int Pring; int DS_state; int nPERIOD; int nSAMPLE_RATE; float nRATIO; float ncSAMPLE_RATE; float nfSAMPLE_RATE; double u_up; double u_down; float ringworm; float lpanning, rpanning, input,level; float alpha,beta,prls,gate; float compeak, compg, compenv, oldcompenv, calpha, cbeta, cthresh, cratio, cpthresh; float *tmpl, *tmpr; float *tsmpsl, *tsmpsr; float *tmpaux; struct fbank { float sfreq, sq,speak,gain,oldgain; AnalogFilter *l, *r, *aux; } *filterbank; AnalogFilter *vhp, *vlp; float* interpbuf; //buffer for filters Resample *U_Resample; Resample *D_Resample; Resample *A_Resample; class FPreset *Fpre; }; #endif
#include <linux/module.h> #include <net/xia_fib.h> #include <net/xia_route.h> #include <net/xia_dag.h> #include <net/xia_u4id.h> #include <net/xia_vxidty.h> /* United 4ID Principal */ #define XIDTYPE_UNI4ID (__cpu_to_be32(0x14)) /* United 4ID context */ struct xip_uni4id_ctx { struct xip_ppal_ctx ctx; /* No extra field. */ }; static inline struct xip_uni4id_ctx *ctx_uni4id(struct xip_ppal_ctx *ctx) { return likely(ctx) ? container_of(ctx, struct xip_uni4id_ctx, ctx) : NULL; } static int my_vxt __read_mostly = -1; /* Network namespace */ static struct xip_uni4id_ctx *create_uni4id_ctx(void) { struct xip_uni4id_ctx *uni4id_ctx = kmalloc( sizeof(*uni4id_ctx), GFP_KERNEL); if (!uni4id_ctx) return NULL; xip_init_ppal_ctx(&uni4id_ctx->ctx, XIDTYPE_UNI4ID); return uni4id_ctx; } /* IMPORTANT! Caller must RCU synch before calling this function. */ static void free_uni4id_ctx(struct xip_uni4id_ctx *uni4id_ctx) { xip_release_ppal_ctx(&uni4id_ctx->ctx); kfree(uni4id_ctx); } static int __net_init uni4id_net_init(struct net *net) { struct xip_uni4id_ctx *uni4id_ctx; int rc; uni4id_ctx = create_uni4id_ctx(); if (!uni4id_ctx) { rc = -ENOMEM; goto out; } rc = xip_add_ppal_ctx(net, &uni4id_ctx->ctx); if (rc) goto uni4id_ctx; goto out; uni4id_ctx: free_uni4id_ctx(uni4id_ctx); out: return rc; } static void __net_exit uni4id_net_exit(struct net *net) { struct xip_uni4id_ctx *uni4id_ctx = ctx_uni4id(xip_del_ppal_ctx(net, XIDTYPE_UNI4ID)); free_uni4id_ctx(uni4id_ctx); } static struct pernet_operations uni4id_net_ops __read_mostly = { .init = uni4id_net_init, .exit = uni4id_net_exit, }; /* United 4ID Routing */ /* XXX The following XID type should come from its * principal's header file once it is available. */ /* IP 4ID: XIP over IP. */ #define XIDTYPE_I4ID (__cpu_to_be32(0x15)) static const u8 uni_xid_prefix[] = { /* 0 1 2 3 4 5 6 7 */ 0x45, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, /* 8 9 10 11 12 13 14 15 */ 0xfa, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; static int uni4id_deliver(struct xip_route_proc *rproc, struct net *net, const u8 *xid, struct xia_xid *next_xid, int anchor_index, struct xip_dst *xdst) { BUILD_BUG_ON(sizeof(uni_xid_prefix) != 16); BUILD_BUG_ON(XIA_XID_MAX != 20); if (memcmp(xid, uni_xid_prefix, sizeof(uni_xid_prefix))) { struct xip_ppal_ctx *ctx; /* Get rid of misformed XIDs. */ xdst->passthrough_action = XDA_ERROR; xdst->sink_action = XDA_ERROR; rcu_read_lock(); ctx = xip_find_ppal_ctx_vxt_rcu(net, my_vxt); xdst_attach_to_anchor(xdst, anchor_index, &ctx->negdep); rcu_read_unlock(); return XRP_ACT_FORWARD; } /* Calculate next XID. */ next_xid->xid_type = XIDTYPE_U4ID; next_xid->xid_id[0] = xid[16]; next_xid->xid_id[1] = xid[17]; next_xid->xid_id[2] = xid[18]; next_xid->xid_id[3] = xid[19]; next_xid->xid_id[4] = 0x35; next_xid->xid_id[5] = 0xd5; next_xid->xid_id[6] = 0x00; next_xid->xid_id[7] = 0x00; next_xid->xid_id[8] = 0x00; next_xid->xid_id[9] = 0x00; next_xid->xid_id[10] = 0x00; next_xid->xid_id[11] = 0x00; next_xid->xid_id[12] = 0x00; next_xid->xid_id[13] = 0x00; next_xid->xid_id[14] = 0x00; next_xid->xid_id[15] = 0x00; next_xid->xid_id[16] = 0x00; next_xid->xid_id[17] = 0x00; next_xid->xid_id[18] = 0x00; next_xid->xid_id[19] = 0x00; return XRP_ACT_REDIRECT; } static struct xip_route_proc uni4id_rt_proc __read_mostly = { .xrp_ppal_type = XIDTYPE_UNI4ID, .deliver = uni4id_deliver, }; /* xia_uni4id_init - this function is called when the module is loaded. * Returns zero if successfully loaded, nonzero otherwise. */ static int __init xia_uni4id_init(void) { int rc; rc = vxt_register_xidty(XIDTYPE_UNI4ID); if (rc < 0) { pr_err("Can't obtain a virtual XID type for United 4ID\n"); goto out; } my_vxt = rc; rc = xia_register_pernet_subsys(&uni4id_net_ops); if (rc) goto vxt; rc = xip_add_router(&uni4id_rt_proc); if (rc) goto net; rc = ppal_add_map("uni4id", XIDTYPE_UNI4ID); if (rc) goto route; pr_alert("XIA Principal United 4ID loaded\n"); goto out; route: xip_del_router(&uni4id_rt_proc); net: xia_unregister_pernet_subsys(&uni4id_net_ops); vxt: BUG_ON(vxt_unregister_xidty(XIDTYPE_UNI4ID)); out: return rc; } /* xia_uni4id_exit - this function is called when the modlule is removed. */ static void __exit xia_uni4id_exit(void) { ppal_del_map(XIDTYPE_UNI4ID); xip_del_router(&uni4id_rt_proc); xia_unregister_pernet_subsys(&uni4id_net_ops); BUG_ON(vxt_unregister_xidty(XIDTYPE_UNI4ID)); rcu_barrier(); pr_alert("XIA Principal United 4ID UNloaded\n"); } module_init(xia_uni4id_init); module_exit(xia_uni4id_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Michel Machado <michel@digirati.com.br>"); MODULE_DESCRIPTION("XIA United 4ID Principal");
/* helplist.c -- very simple linked list of help sections * $Id: helplist.c,v 1.2 2005/05/28 03:17:45 bitman Exp $ * Copyright (C) 2001 Ryan Phillips <bitman@users.sourceforge.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., 59 Temple Place Suite 330; Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include "helplist.h" #include "structures/svector.h" #include <stdlib.h> #include <string.h> /* inithelpsection() - returns an empty help section */ void inithelpsection(helpsection* section) { section->title = NULL; initstringvector(&section->sv); section->next = NULL; } /* deletesectionlist() - free()s everything but the section itself */ void deletesectionlist(helpsection* section) { if (section == NULL) return; /* Destroy next and soforth */ if (section->next != NULL) { deletesectionlist(section->next); free(section->next); section->next = NULL; } /* Destroy title */ if (section->title != NULL) { free(section->title); section->title = NULL; } /* Destroy sv */ deletestringvector(&section->sv); } /* appendsection() - appends src to the end of dest */ void appendsection(helpsection* dest, helpsection* src) { if (dest == NULL || src == NULL) return; /* Advance to last node */ while (dest->next != NULL) dest = dest->next; dest->next = src; } /* findsection() - locates a section with given title in a section list */ helpsection* findsection(helpsection* sectionlist, char* title) { /* Keep looping until we hit either the end of the list or the title */ while (sectionlist != NULL && (sectionlist->title == NULL || !str_equ(sectionlist->title, title, STREQU_UNCASE))) sectionlist = sectionlist->next; /* Return whatever we ended up with */ return sectionlist; } /* loadhelpmetafile() - loads a help meta into the given help section list. * the original meta is destroyed in the process. true on * error */ int loadhelpmeta(helpsection* section, stringvector* meta) { helpsection* newsection; meta->cur = meta->first; newsection = (helpsection*) malloc(sizeof(helpsection)); inithelpsection(newsection); newsection->title = str_dup("index"); do { /* Steal strings from meta until we reach an '@@' or the end of meta */ while (!(meta->first == NULL || (meta->first->s[0] == '@' && meta->first->s[1] == '@'))) { char* transfer = removestring(meta); pushstring(&newsection->sv, transfer); } if (newsection->sv.first != NULL) { /* If newsection actually recieved some content, add it to the list */ appendsection(section, newsection); /* Advance section to newsection to speed up future appends */ section = newsection; } else { /* No content, erase newsection */ deletesectionlist(newsection); free(newsection); newsection = NULL; } /* Prepare another newsection if we've not yet reached the end */ if (meta->first != NULL) { int i; newsection = (helpsection*) malloc(sizeof(helpsection)); inithelpsection(newsection); /* meta->first->s starts with @@, so pull out the title */ newsection->title = str_dup(meta->first->s + 2); deletestring(meta); /* Remove any extension from title */ i = strlen(newsection->title) - 1; while (i > 0 && newsection->title[i] != '.') i--; if (newsection->title[i] == '.') newsection->title[i] = '\0'; } } while (meta->first != NULL); return 0; }
/* Kopete Yahoo Protocol Handles logging into to the Yahoo service Copyright (c) 2004 Duncan Mac-Vicar P. <duncan@kde.org> Copyright (c) 2005 André Duffeck <duffeck@kde.org> Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org> ************************************************************************* * * * 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. * * * ************************************************************************* */ #ifndef YMSG_TRANSFER_H #define YMSG_TRANSFER_H #include "transfer.h" #include "yahootypes.h" #include <qpair.h> #include <qvaluelist.h> class YMSGTransferPrivate; typedef QPair< int, QCString > Param; typedef QValueList< Param > ParamList; /** @author Duncan Mac-Vicar Prett */ class YMSGTransfer : public Transfer { public: YMSGTransfer(Yahoo::Service service); YMSGTransfer(Yahoo::Service service, Yahoo::Status status); YMSGTransfer(); ~YMSGTransfer(); TransferType type(); //! Get the validity of the transfer object bool isValid() const; Yahoo::Service service() const; void setService(Yahoo::Service service); Yahoo::Status status() const; void setStatus(Yahoo::Status status); unsigned int id() const; void setId(unsigned int id); int packetLength() const; void setPacketLength(int len); ParamList paramList() const; QCString firstParam( int index ) const; QCString nthParam( int index, int occurrence ) const; QCString nthParamSeparated( int index, int occurrence, int separator ) const; int paramCount( int index ) const; void setParam(int index, const QCString &data); void setParam(int index, int data); QByteArray serialize() const; int length() const; private: YMSGTransferPrivate* d; }; #endif
/* Kernel module help for i386. Copyright (C) 2001 Rusty Russell. 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/moduleloader.h> #include <linux/elf.h> #include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> #include <linux/kernel.h> #if 0 #define DEBUGP printk #else #define DEBUGP(fmt...) #endif void *module_alloc(unsigned long size) { if (size == 0) return NULL; return vmalloc(size); } /* Free memory returned from module_alloc */ void module_free(struct module *mod, void *module_region) { vfree(module_region); /* FIXME: If module_region == mod->init_region, trim exception table entries. */ } /* We don't need anything special. */ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, char *secstrings, struct module *mod) { return 0; } int apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, unsigned int relsec, struct module *me) { unsigned int i; Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr; Elf32_Sym *sym; uint32_t *location; DEBUGP("Applying relocate section %u to %u\n", relsec, sechdrs[relsec].sh_info); for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { /* This is where to make the change */ location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr + rel[i].r_offset; /* This is the symbol it is referring to. Note that all undefined symbols have been resolved. */ sym = (Elf32_Sym *)sechdrs[symindex].sh_addr + ELF32_R_SYM(rel[i].r_info); switch (ELF32_R_TYPE(rel[i].r_info)) { case R_386_32: /* We add the value into the location given */ *location += sym->st_value; break; case R_386_PC32: /* Add the value, subtract its postition */ *location += sym->st_value - (uint32_t)location; break; default: printk(KERN_ERR "module %s: Unknown relocation: %u\n", me->name, ELF32_R_TYPE(rel[i].r_info)); return -ENOEXEC; } } return 0; } int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, unsigned int relsec, struct module *me) { printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name); return -ENOEXEC; } extern void apply_alternatives(void *start, void *end); int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *me) { const Elf_Shdr *s; char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; /* look for .altinstructions to patch */ for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) { void *seg; if (strcmp(".altinstructions", secstrings + s->sh_name)) continue; seg = (void *)s->sh_addr; apply_alternatives(seg, seg + s->sh_size); } return 0; } void module_arch_cleanup(struct module *mod) { }
/* SPDX-License-Identifier: GPL-2.0-only */ #include <assert.h> #include <console/console.h> #include <soc/mt6366.h> #include <soc/regulator.h> #define REGULATOR_NOT_SUPPORT -1 static const int regulator_id[] = { [MTK_REGULATOR_VDD1] = REGULATOR_NOT_SUPPORT, [MTK_REGULATOR_VDD2] = REGULATOR_NOT_SUPPORT, [MTK_REGULATOR_VDDQ] = MT6366_VDDQ, [MTK_REGULATOR_VMDDR] = REGULATOR_NOT_SUPPORT, [MTK_REGULATOR_VCORE] = MT6366_VCORE, [MTK_REGULATOR_VCC] = REGULATOR_NOT_SUPPORT, [MTK_REGULATOR_VCCQ] = REGULATOR_NOT_SUPPORT, [MTK_REGULATOR_VDRAM1] = MT6366_VDRAM1, [MTK_REGULATOR_VMCH] = MT6366_VMCH, [MTK_REGULATOR_VMC] = MT6366_VMC, [MTK_REGULATOR_VPROC12] = MT6366_VPROC12, [MTK_REGULATOR_VSRAM_PROC12] = MT6366_VSRAM_PROC12, [MTK_REGULATOR_VRF12] = MT6366_VRF12, [MTK_REGULATOR_VCN33] = MT6366_VCN33, }; _Static_assert(ARRAY_SIZE(regulator_id) == MTK_REGULATOR_NUM, "regulator_id size error"); void mainboard_set_regulator_vol(enum mtk_regulator regulator, uint32_t voltage_uv) { assert(regulator < MTK_REGULATOR_NUM); if (regulator_id[regulator] < 0) { printk(BIOS_ERR, "Invalid regulator ID: %d\n", regulator); return; } mt6366_set_voltage(regulator_id[regulator], voltage_uv); } uint32_t mainboard_get_regulator_vol(enum mtk_regulator regulator) { assert(regulator < MTK_REGULATOR_NUM); if (regulator_id[regulator] < 0) { printk(BIOS_ERR, "Invalid regulator ID: %d\n", regulator); return 0; } return mt6366_get_voltage(regulator_id[regulator]); }
/* Copyright 2013 David Axmark Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /*! \addtogroup NotificationLib * @{ */ /** * @defgroup NotificationLib Notification Library * @{ */ /** * @file LocalNotificationListener.h * @author Emma Tresanszki and Bogdan Iusco * @date 1 Nov 2011 * * @brief Listener for local notification events. * @platform Android, iOS. */ #ifndef NOTIFICATION_LOCAL_NOTIFICATION_LISTENER_H_ #define NOTIFICATION_LOCAL_NOTIFICATION_LISTENER_H_ /** * \brief MoSync Notification API classes. */ namespace Notification { // Forward declaration. class LocalNotification; /** * \brief Listener for local notification events. */ class LocalNotificationListener { public: /** * Called when the application receives a local notification. * Note: this event will be received only if the application * was not stopped in the interval from when the notification * is scheduled until it's actually triggered. * @param localNotification The received local notification. */ virtual void didReceiveLocalNotification( LocalNotification& localNotification) = 0; }; } // namespace Notification #endif /* NOTIFICATION_LOCAL_NOTIFICATION_LISTENER_H_ */ /*! @} */
#ifndef __CASTLE_VERSIONS_H__ #define __CASTLE_VERSIONS_H__ int castle_version_is_ancestor (c_ver_t candidate, c_ver_t version); int castle_version_compare (c_ver_t version1, c_ver_t version2); int castle_version_attach (c_ver_t version); void castle_version_detach (c_ver_t version); int castle_version_read (c_ver_t version, c_da_t *da, c_ver_t *parent, c_ver_t *live_parent, c_byte_off_t *size, int *leaf); struct timeval castle_version_creation_timestamp_get (c_ver_t version); c_da_t castle_version_da_id_get (c_ver_t version); /** * Castle version health. */ typedef enum castle_version_health { CVH_LIVE = 0, /**< Live versions. */ CVH_DEAD, /**< Deleted versions. */ CVH_DELETED, /**< Dead versions (no further keys in DA). */ CVH_TOTAL, /**< Total versions (sum of above). */ } cv_health_t; int castle_versions_count_adjust (c_da_t da_id, cv_health_t health, int add); int castle_versions_count_get (c_da_t da_id, cv_health_t health); inline void castle_version_states_hash_add (cv_states_t *states, cv_state_t *state); inline cv_state_t* castle_version_states_hash_get_alloc (cv_states_t *states, c_ver_t version); void castle_version_states_commit (cv_states_t *states); int castle_version_states_free (cv_states_t *states); int castle_version_states_alloc (cv_states_t *states, int max_versions); void castle_version_live_stats_adjust (c_ver_t version, cv_nonatomic_stats_t adjust); void castle_version_consistent_stats_adjust (c_ver_t version, cv_nonatomic_stats_t adjust); void castle_version_private_stats_adjust (c_ver_t version, cv_nonatomic_stats_t adjust, cv_states_t *private); cv_nonatomic_stats_t castle_version_consistent_stats_get (c_ver_t version); cv_nonatomic_stats_t castle_version_live_stats_get (c_ver_t version); int castle_versions_zero_init (void); c_ver_t castle_version_new (int snap_or_clone, c_ver_t parent, c_da_t da, c_byte_off_t size); int castle_version_free (c_ver_t version); int castle_version_tree_delete (c_ver_t version); int castle_version_delete (c_ver_t version); int castle_version_deleted (c_ver_t version); int castle_version_attached (c_ver_t version); int castle_version_is_deletable (struct castle_version_delete_state *state, c_ver_t version); int castle_version_is_leaf (c_ver_t version); int castle_versions_read (void); int castle_versions_init (void); void castle_versions_fini (void); c_ver_t castle_version_max_get (void); int castle_versions_writeback (int is_fini); #endif /*__CASTLE_VERSIONS_H__ */
/* * Copyright (C) 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS) #include "ScrollingStateScrollingNode.h" namespace WebCore { class ScrollingStateOverflowScrollingNode : public ScrollingStateScrollingNode { public: static Ref<ScrollingStateOverflowScrollingNode> create(ScrollingStateTree&, ScrollingNodeID); Ref<ScrollingStateNode> clone(ScrollingStateTree&) override; virtual ~ScrollingStateOverflowScrollingNode(); enum ChangedProperty { ScrolledContentsLayer = NumScrollingStateNodeBits }; // This is a layer with the contents that move. const LayerRepresentation& scrolledContentsLayer() const { return m_scrolledContentsLayer; } WEBCORE_EXPORT void setScrolledContentsLayer(const LayerRepresentation&); void dumpProperties(TextStream&, int indent, ScrollingStateTreeAsTextBehavior) const override; private: ScrollingStateOverflowScrollingNode(ScrollingStateTree&, ScrollingNodeID); ScrollingStateOverflowScrollingNode(const ScrollingStateOverflowScrollingNode&, ScrollingStateTree&); LayerRepresentation m_scrolledContentsLayer; }; } // namespace WebCore SPECIALIZE_TYPE_TRAITS_SCROLLING_STATE_NODE(ScrollingStateOverflowScrollingNode, isOverflowScrollingNode()) #endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)
/** * 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_FILTERED_PROJECT_GROUP_H_ #define _U2_FILTERED_PROJECT_GROUP_H_ #include <QObject> namespace U2 { class FilteredProjectGroup; class GObject; ////////////////////////////////////////////////////////////////////////// /// WrappedObject ////////////////////////////////////////////////////////////////////////// class WrappedObject : public QObject { Q_OBJECT public: WrappedObject(GObject *obj, FilteredProjectGroup *parentGroup); GObject * getObject() const; FilteredProjectGroup * getParentGroup() const; static bool objectLessThan(const WrappedObject *first, const WrappedObject *second); private: GObject *obj; FilteredProjectGroup *parentGroup; }; ////////////////////////////////////////////////////////////////////////// /// FilteredProjectGroup ////////////////////////////////////////////////////////////////////////// class FilteredProjectGroup : public QObject { Q_OBJECT Q_DISABLE_COPY(FilteredProjectGroup) public: explicit FilteredProjectGroup(const QString &name); ~FilteredProjectGroup(); const QString & getGroupName() const; void addObject(GObject *obj, int objNumber); void removeAt(int objNumber); bool contains(GObject *obj) const; WrappedObject * getWrappedObject(GObject *obj) const; WrappedObject * getWrappedObject(int position) const; int getWrappedObjectNumber(WrappedObject *obj) const; int getObjectsCount() const; int getNewObjectNumber(GObject *obj) const; static bool groupLessThan(FilteredProjectGroup *first, FilteredProjectGroup *second); private: const QString name; QList<WrappedObject *> filteredObjs; }; } // namespace U2 #endif // _U2_FILTERED_PROJECT_GROUP_H_
/************************************************************************** * * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA. * 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, sub license, 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 (including the * next paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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. * * **************************************************************************/ /* * Generic simple memory manager implementation. Intended to be used as a base * class implementation for more advanced memory managers. * * Note that the algorithm used is quite simple and there might be substantial * performance gains if a smarter free list is implemented. Currently it is just an * unordered stack of free regions. This could easily be improved if an RB-tree * is used instead. At least if we expect heavy fragmentation. * * Aligned allocations can also see improvement. * * Authors: * Thomas Hellström <thomas-at-tungstengraphics-dot-com> */ #include "drmP.h" drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent, unsigned long size, unsigned alignment) { drm_mm_node_t *child; if (alignment) size += alignment - 1; if (parent->size == size) { list_del_init(&parent->fl_entry); parent->free = 0; return parent; } else { child = (drm_mm_node_t *) drm_alloc(sizeof(*child), DRM_MEM_MM); if (!child) return NULL; INIT_LIST_HEAD(&child->ml_entry); INIT_LIST_HEAD(&child->fl_entry); child->free = 0; child->size = size; child->start = parent->start; list_add_tail(&child->ml_entry, &parent->ml_entry); parent->size -= size; parent->start += size; } return child; } /* * Put a block. Merge with the previous and / or next block if they are free. * Otherwise add to the free stack. */ void drm_mm_put_block(drm_mm_t * mm, drm_mm_node_t * cur) { drm_mm_node_t *list_root = &mm->root_node; struct list_head *cur_head = &cur->ml_entry; struct list_head *root_head = &list_root->ml_entry; drm_mm_node_t *prev_node = NULL; drm_mm_node_t *next_node; int merged = 0; if (cur_head->prev != root_head) { prev_node = list_entry(cur_head->prev, drm_mm_node_t, ml_entry); if (prev_node->free) { prev_node->size += cur->size; merged = 1; } } if (cur_head->next != root_head) { next_node = list_entry(cur_head->next, drm_mm_node_t, ml_entry); if (next_node->free) { if (merged) { prev_node->size += next_node->size; list_del(&next_node->ml_entry); list_del(&next_node->fl_entry); drm_free(next_node, sizeof(*next_node), DRM_MEM_MM); } else { next_node->size += cur->size; next_node->start = cur->start; merged = 1; } } } if (!merged) { cur->free = 1; list_add(&cur->fl_entry, &list_root->fl_entry); } else { list_del(&cur->ml_entry); drm_free(cur, sizeof(*cur), DRM_MEM_MM); } } drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm, unsigned long size, unsigned alignment, int best_match) { struct list_head *list; const struct list_head *free_stack = &mm->root_node.fl_entry; drm_mm_node_t *entry; drm_mm_node_t *best; unsigned long best_size; best = NULL; best_size = ~0UL; if (alignment) size += alignment - 1; list_for_each(list, free_stack) { entry = list_entry(list, drm_mm_node_t, fl_entry); if (entry->size >= size) { if (!best_match) return entry; if (size < best_size) { best = entry; best_size = entry->size; } } } return best; } int drm_mm_init(drm_mm_t * mm, unsigned long start, unsigned long size) { drm_mm_node_t *child; INIT_LIST_HEAD(&mm->root_node.ml_entry); INIT_LIST_HEAD(&mm->root_node.fl_entry); child = (drm_mm_node_t *) drm_alloc(sizeof(*child), DRM_MEM_MM); if (!child) return -ENOMEM; INIT_LIST_HEAD(&child->ml_entry); INIT_LIST_HEAD(&child->fl_entry); child->start = start; child->size = size; child->free = 1; list_add(&child->fl_entry, &mm->root_node.fl_entry); list_add(&child->ml_entry, &mm->root_node.ml_entry); return 0; } EXPORT_SYMBOL(drm_mm_init); void drm_mm_takedown(drm_mm_t * mm) { struct list_head *bnode = mm->root_node.fl_entry.next; drm_mm_node_t *entry; entry = list_entry(bnode, drm_mm_node_t, fl_entry); if (entry->ml_entry.next != &mm->root_node.ml_entry || entry->fl_entry.next != &mm->root_node.fl_entry) { DRM_ERROR("Memory manager not clean. Delaying takedown\n"); return; } list_del(&entry->fl_entry); list_del(&entry->ml_entry); drm_free(entry, sizeof(*entry), DRM_MEM_MM); } EXPORT_SYMBOL(drm_mm_takedown);
/* * pscan functionality */ #include "../newsearch/newsearch.h" #include "proxyscan.h" #include <stdlib.h> void *pscan_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput); void pscan_free(searchCtx *ctx, struct searchNode *thenode); struct searchNode *pscan_parse(searchCtx *ctx, int argc, char **argv) { struct searchNode *thenode; if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) { parseError = "malloc: could not allocate memory for this search."; return NULL; } thenode->returntype = RETURNTYPE_BOOL; thenode->exe = pscan_exe; thenode->free = pscan_free; thenode->localdata = (void *)0; return thenode; } void *pscan_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) { startnickscan((nick *)theinput); thenode->localdata = (void *)((int)thenode->localdata + 1); return (void *)1; } void pscan_free(searchCtx *ctx, struct searchNode *thenode) { ctx->reply(senderNSExtern, "proxyscan now scanning: %d nick(s).", (int)thenode->localdata); free(thenode); }
/* * * Copyright (C) International Business Machines Corp., 2007 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * NAME * Tspi_TPM_SetStatus_TempDeactivated01.c * * DESCRIPTION * This test will use Tspi_TPM_SetStatus to temporarily * deactivate the TPM (requires reboot to re-activate). * * ALGORITHM * Setup: * Create Context * Connect Context * Get TPM Object * Create Operator Policy Object * Set Policy Secret * Test: * Call Tspi_TPM_SetStatus * Print results * * Cleanup: * Print errno log and/or timing stats if options given * * USAGE * First parameter is --options * -v or --version * Second parameter is the version of the test case to be run * This test case is currently only implemented for v1.1 * * HISTORY * Megan Schneider, mschnei@us.ibm.com, 6/04. * * RESTRICTIONS * None. */ #include <stdio.h> #include "common.h" int main( int argc, char **argv ) { char version; version = parseArgs( argc, argv ); if ( version == TESTSUITE_TEST_TSS_1_1 ) main_v1_1( ); else if ( version >= TESTSUITE_TEST_TSS_1_2 ) main_v1_2( version ); else print_wrongVersion( ); } int main_setstatus( char version ) { char *function = "Tspi_TPM_SetStatus_TempDeactivated01"; TSS_HCONTEXT hContext; TSS_HKEY hSRK; TSS_HTPM hTPM; TSS_HPOLICY hOwnerPolicy, hOperatorPolicy; TSS_RESULT result; TSS_BOOL state; print_begin_test( function ); result = connect_load_all( &hContext, &hSRK, &hTPM ); if ( result != TSS_SUCCESS ) { print_error( "Tspi_Context_Create", result ); print_error_exit( function, err_string(result) ); exit( result ); } result = Tspi_Context_CreateObject( hContext, TSS_OBJECT_TYPE_POLICY, TSS_POLICY_USAGE, &hOwnerPolicy ); if ( result != TSS_SUCCESS ) { print_error( "Tspi_Context_CreateObject", result ); print_error_exit( function, err_string(result) ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( result ); } result = Tspi_Policy_SetSecret( hOwnerPolicy, TESTSUITE_OWNER_SECRET_MODE, TESTSUITE_OWNER_SECRET_LEN, TESTSUITE_OWNER_SECRET ); if ( result != TSS_SUCCESS ) { print_error( "Tspi_Policy_SetSecret", result ); print_error_exit( function, err_string(result) ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( result ); } result = Tspi_Policy_AssignToObject( hOwnerPolicy, hTPM ); if ( result != TSS_SUCCESS ) { print_error( "Tspi_Policy_SetSecret", result ); print_error_exit( function, err_string(result) ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( result ); } if ( version >= TESTSUITE_TEST_TSS_1_2 ) { // Use Operator Authorization for 1.2 or higher result = Tspi_Context_CreateObject( hContext, TSS_OBJECT_TYPE_POLICY, TSS_POLICY_OPERATOR, &hOperatorPolicy ); if ( result != TSS_SUCCESS ) { print_error( "Tspi_Context_CreateObject", result ); print_error_exit( function, err_string(result) ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( result ); } result = Tspi_Policy_SetSecret( hOperatorPolicy, TESTSUITE_OPERATOR_SECRET_MODE, TESTSUITE_OPERATOR_SECRET_LEN, TESTSUITE_OPERATOR_SECRET ); if ( result != TSS_SUCCESS ) { print_error( "Tspi_Policy_SetSecret", result ); print_error_exit( function, err_string(result) ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( result ); } result = Tspi_Policy_AssignToObject( hOperatorPolicy, hTPM ); if ( result != TSS_SUCCESS ) { print_error( "Tspi_Policy_SetSecret", result ); print_error_exit( function, err_string(result) ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( result ); } } // SetTempDeactivated result = Tspi_TPM_SetStatus( hTPM, TSS_TPMSTATUS_SETTEMPDEACTIVATED, TRUE ); if ( result != TSS_SUCCESS ) { print_error( "Tspi_TPM_SetStatus", result ); print_error_exit( function, err_string(result) ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( result ); } print_success( function, result); print_end_test( function ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( 0 ); } int main_v1_1( ) { return main_setstatus(TESTSUITE_TEST_TSS_1_1); } int main_v1_2( char version ) { return main_setstatus(TESTSUITE_TEST_TSS_1_2); }
/* * Copyright (C) 2007 Eric Seidel <eric@webkit.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef RenderSVGHiddenContainer_h #define RenderSVGHiddenContainer_h #include "RenderSVGContainer.h" namespace WebCore { class SVGElement; // This class is for containers which are never drawn, but do need to support style // <defs>, <linearGradient>, <radialGradient> are all good examples class RenderSVGHiddenContainer : public RenderSVGContainer { public: RenderSVGHiddenContainer(SVGElement&, Ref<RenderStyle>&&); protected: virtual void layout() override; private: virtual bool isSVGHiddenContainer() const override final { return true; } virtual const char* renderName() const override { return "RenderSVGHiddenContainer"; } virtual void paint(PaintInfo&, const LayoutPoint&) override final; virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject*) const override final { return LayoutRect(); } virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override final; virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction) override final; }; } #endif // RenderSVGHiddenContainer_h
// // BaseViewController.h // PUER // // Created by admin on 14-8-13. // Copyright (c) 2014年 com.dieshang.PUER. All rights reserved. // #import <UIKit/UIKit.h> @interface BaseViewController : UIViewController <UIAlertViewDelegate> @property (nonatomic,retain) UIButton *menuButton; @property (nonatomic,retain) UIAlertView *loginAgain_AlterView;//重新登陆提示框 @property (nonatomic,retain) UIAlertView *requestError_AlterView;//请求发生错位的提示框 @property (nonatomic,retain) UILabel *titleLable; - (void)setNavTitle:(NSString *)navigationTitle; - (void)menuButton:(NSString *)navigationTitle; - (void)navTitle; - (BOOL)isConnectionAvailable; - (NSString *)ASCIIString:(NSString *)unicodeStr; - (void)sessionToRemove:(NSString *)code info:(NSString *)info; - (void)setDataBackVCTitile:(NSString *)mainTitle viceTitle:(NSString *)viceTitle; @end
/* * (C) Copyright 2001 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this * project. * * 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 */ /* * RTC, Date & Time support: get and set date & time */ #include <common.h> #include <command.h> #include <rtc.h> #include <i2c.h> #ifndef CONFIG_S5PC100 DECLARE_GLOBAL_DATA_PTR; const char *weekdays[] = { "Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur", }; #define RELOC(a) ((typeof(a))((unsigned long)(a) + gd->reloc_off)) int mk_date (char *, struct rtc_time *); int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { struct rtc_time tm; int rcode = 0; int old_bus; /* switch to correct I2C bus */ old_bus = I2C_GET_BUS(); I2C_SET_BUS(CFG_RTC_BUS_NUM); switch (argc) { case 2: /* set date & time */ if (strcmp(argv[1],"reset") == 0) { puts ("Reset RTC...\n"); rtc_reset (); } else { /* initialize tm with current time */ rtc_get (&tm); /* insert new date & time */ if (mk_date (argv[1], &tm) != 0) { puts ("## Bad date format\n"); break; } /* and write to RTC */ rtc_set (&tm); } /* FALL TROUGH */ case 1: /* get date & time */ rtc_get (&tm); printf ("Date: %4d-%02d-%02d (%sday) Time: %2d:%02d:%02d\n", tm.tm_year, tm.tm_mon, tm.tm_mday, (tm.tm_wday<0 || tm.tm_wday>6) ? "unknown " : RELOC(weekdays[tm.tm_wday]), tm.tm_hour, tm.tm_min, tm.tm_sec); break; default: printf ("Usage:\n%s\n", cmdtp->usage); rcode = 1; } /* switch back to original I2C bus */ I2C_SET_BUS(old_bus); return rcode; } /* * simple conversion of two-digit string with error checking */ static int cnvrt2 (char *str, int *valp) { int val; if ((*str < '0') || (*str > '9')) return (-1); val = *str - '0'; ++str; if ((*str < '0') || (*str > '9')) return (-1); *valp = 10 * val + (*str - '0'); return (0); } /* * Convert date string: MMDDhhmm[[CC]YY][.ss] * * Some basic checking for valid values is done, but this will not catch * all possible error conditions. */ int mk_date (char *datestr, struct rtc_time *tmp) { int len, val; char *ptr; ptr = strchr (datestr,'.'); len = strlen (datestr); /* Set seconds */ if (ptr) { int sec; *ptr++ = '\0'; if ((len - (ptr - datestr)) != 2) return (-1); len = strlen (datestr); if (cnvrt2 (ptr, &sec)) return (-1); tmp->tm_sec = sec; } else { tmp->tm_sec = 0; } if (len == 12) { /* MMDDhhmmCCYY */ int year, century; if (cnvrt2 (datestr+ 8, &century) || cnvrt2 (datestr+10, &year) ) { return (-1); } tmp->tm_year = 100 * century + year; } else if (len == 10) { /* MMDDhhmmYY */ int year, century; century = tmp->tm_year / 100; if (cnvrt2 (datestr+ 8, &year)) return (-1); tmp->tm_year = 100 * century + year; } switch (len) { case 8: /* MMDDhhmm */ /* fall thru */ case 10: /* MMDDhhmmYY */ /* fall thru */ case 12: /* MMDDhhmmCCYY */ if (cnvrt2 (datestr+0, &val) || val > 12) { break; } tmp->tm_mon = val; if (cnvrt2 (datestr+2, &val) || val > ((tmp->tm_mon==2) ? 29 : 31)) { break; } tmp->tm_mday = val; if (cnvrt2 (datestr+4, &val) || val > 23) { break; } tmp->tm_hour = val; if (cnvrt2 (datestr+6, &val) || val > 59) { break; } tmp->tm_min = val; /* calculate day of week */ GregorianDay (tmp); return (0); default: break; } return (-1); } /***************************************************/ U_BOOT_CMD( date, 2, 1, do_date, "date - get/set/reset date & time\n", "[MMDDhhmm[[CC]YY][.ss]]\ndate reset\n" " - without arguments: print date & time\n" " - with numeric argument: set the system date & time\n" " - with 'reset' argument: reset the RTC\n" ); #endif
/******************************************************************************* * Repository for C modules. * Copyright (C) 2012 Sandeep Prakash * * 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. ******************************************************************************/ /******************************************************************************* * Copyright (c) 2012, Sandeep Prakash <123sandy@gmail.com> * * \file exp_msgq.h * * \author sandeepprakash * * \date 25-Sep-2012 * * \brief * ******************************************************************************/ #ifndef __EXP_MSGQ_H__ #define __EXP_MSGQ_H__ #ifdef __cplusplus extern "C" { #endif /********************************* CONSTANTS **********************************/ /*********************************** MACROS ***********************************/ #define MSGQ_MAX_MSGQ_SIZE (PAL_SEM_VALUE_MAX) /******************************** ENUMERATIONS ********************************/ typedef enum _MSGQ_RET_E { eMSGQ_RET_SUCCESS = 0x00000000, eMSGQ_RET_FAILURE, eMSGQ_RET_INVALID_ARGS, eMSGQ_RET_INVALID_HANDLE, eMSGQ_RET_RESOURCE_FAILURE, eMSGQ_RET_OP_TIMEDOUT, eMSGQ_RET_Q_FULL, eMSGQ_RET_Q_EMPTY, eMSGQ_RET_MAX } MSGQ_RET_E; /*********************** CLASS/STRUCTURE/UNION DATA TYPES *********************/ typedef struct MSGQ_CTXT_X *MSGQ_HDL; typedef struct _MSGQ_INIT_PARAMS_X { uint32_t ui_msgq_size; } MSGQ_INIT_PARAMS_X; typedef struct _MSGQ_DATA_X { void *p_data; uint32_t ui_data_size; } MSGQ_DATA_X; /***************************** FUNCTION PROTOTYPES ****************************/ MSGQ_RET_E msgq_init ( MSGQ_HDL *phl_msgq_hdl, MSGQ_INIT_PARAMS_X *px_init_params); MSGQ_RET_E msgq_deinit ( MSGQ_HDL hl_msgq_hdl); MSGQ_RET_E msgq_add_msg ( MSGQ_HDL hl_msgq_hdl, MSGQ_DATA_X *px_data, uint32_t ui_timeout); MSGQ_RET_E msgq_get_msg ( MSGQ_HDL hl_msgq_hdl, MSGQ_DATA_X *px_data, uint32_t ui_timeout); MSGQ_RET_E msgq_get_filled_q_size ( MSGQ_HDL hl_msgq_hdl, uint32_t *pui_filled_q_size); #ifdef __cplusplus } #endif #endif /* __EXP_MSGQ_H__ */
/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2015-2018 Intel Corporation */ #ifndef _QAT_LOGS_H_ #define _QAT_LOGS_H_ extern int qat_gen_logtype; extern int qat_dp_logtype; #define QAT_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, qat_gen_logtype, \ "%s(): " fmt "\n", __func__, ## args) #define QAT_DP_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, qat_dp_logtype, \ "%s(): " fmt "\n", __func__, ## args) #define QAT_DP_HEXDUMP_LOG(level, title, buf, len) \ qat_hexdump_log(RTE_LOG_ ## level, qat_dp_logtype, title, buf, len) /** * qat_hexdump_log - Dump out memory in a special hex dump format. * * Dump out the message buffer in a special hex dump output format with * characters printed for each line of 16 hex values. The message will be sent * to the stream defined by rte_logs.file or to stderr in case of rte_logs.file * is undefined. */ int qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title, const void *buf, unsigned int len); #endif /* _QAT_LOGS_H_ */
/* * Copyright (C) 2015, Ondrej Mosnacek <omosnacek@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, see <http://www.gnu.org/licenses/>. */ #ifndef LIBCOMMANDLINE_COMMANDLINEOPTION_H #define LIBCOMMANDLINE_COMMANDLINEOPTION_H #include <string> #include <ostream> #include <sstream> #include <functional> #include <exception> #include <stdexcept> namespace libcommandline { class ArgumentFormatException : public std::runtime_error { private: std::string message; public: const std::string &getMessage() const { return message; } ArgumentFormatException(const std::string &message) : std::runtime_error(message), message(message) { } const char *what() const noexcept override { return message.c_str(); } }; template<class TState> class CommandLineOption { private: std::string longName; char shortName; std::string helpText; bool takesArgument; std::string metavar; public: const std::string &getLongName() const { return longName; } char getShortName() const { return shortName; } const std::string &getHelpText() const { return helpText; } bool doesTakeArgument() const { return takesArgument; } CommandLineOption( const std::string &longName, char shortName = '\0', const std::string &helpText = std::string(), bool takesArgument = false, const std::string &metavar = std::string()) : longName(longName), shortName(shortName), helpText(helpText), takesArgument(takesArgument), metavar(metavar) { } virtual ~CommandLineOption() { } virtual void processOption(TState &state, const std::string &argument) const = 0; std::string formatOptionName() const { std::ostringstream res {}; if (shortName == '\0') { res << " "; } else { res << "-" << shortName << ", "; } res << "--" << longName; if (takesArgument && !metavar.empty()) { res << "=" << metavar; } return res.str(); } }; template<class TState> class FlagOption : public CommandLineOption<TState> { public: typedef void Callback(TState &state); private: std::function<Callback> callback; public: FlagOption( std::function<Callback> callback, const std::string &longName, char shortName = '\0', const std::string &helpText = std::string()) : CommandLineOption<TState>(longName, shortName, helpText), callback(callback) { } void processOption(TState &state, const std::string &) const override { callback(state); } }; template<class TState> class ArgumentOption : public CommandLineOption<TState> { public: typedef void Callback(TState &state, const std::string &argument); private: std::function<Callback> callback; static std::string formatHelpText(std::string helpText, std::string defaultValue) { if (helpText.empty()) { return std::string(); } if (defaultValue.empty()) { return helpText; } return helpText + " [default: " + defaultValue + "]"; } public: ArgumentOption( std::function<Callback> callback, const std::string &longName, char shortName = '\0', const std::string &helpText = std::string(), const std::string &defaultValue = std::string(), const std::string &metavar = "ARG") : CommandLineOption<TState>( longName, shortName, formatHelpText(helpText, defaultValue), true, metavar), callback(callback) { } void processOption(TState &state, const std::string &argument) const override { callback(state, argument); } }; template<class TState> class PositionalArgumentHandler { public: typedef void Callback(TState &state, const std::string &argument); private: std::string name; std::string helpText; std::function<Callback> callback; public: const std::string &getName() const { return name; } const std::string &getHelpText() const { return helpText; } PositionalArgumentHandler( std::function<Callback> callback, const std::string &name = std::string(), const std::string &helpText = std::string()) : name(name), helpText(), callback(callback) { if (!helpText.empty()) { this->helpText = name + " " + helpText; } } void processArgument(TState &state, const std::string &argument) const { callback(state, argument); } }; } // namespace libcommandline #endif // LIBCOMMANDLINE_COMMANDLINEOPTION_H
/* Based up Neutrino-GUI - Tuxbox-Project Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. Copyright (C) 2012, 2013, Thilo Graf 'dbt' License: GPL 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 __CC_DETAIL_LINE_H__ #define __CC_DETAIL_LINE_H__ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include "cc_base.h" //! Sub class of CComponents. Shows a connectline with given dimensions and color on screen. /*! Not usable as CCItem! */ class CComponentsDetailsLine : public CComponents { private: ///property: line width int dl_w; ///property: lowest y position int y_down; ///property: height of top marker int h_mark_top; ///property: height of bottom marker int h_mark_down; ///initialize all internal attributes void initVarDline( const int& x_pos, const int& y_pos_top, const int& y_pos_down, const int& h_mark_top_, const int& h_mark_down_, fb_pixel_t color_line, fb_pixel_t color_shadow); public: CComponentsDetailsLine( const int& x_pos = 1,const int& y_pos_top = 1, const int& y_pos_down = 1, const int& h_mark_top_ = CC_HEIGHT_MIN , const int& h_mark_down_ = CC_HEIGHT_MIN, fb_pixel_t color_line = COL_FRAME_PLUS_0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); ~CComponentsDetailsLine(); ///set colors void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; ///set colors with system settings void syncSysColors(); ///set property: lowest y position void setYPosDown(const int& y_pos_down){y_down = y_pos_down;}; ///set property: height of top marker void setHMarkTop(const int& h_mark_top_){h_mark_top = h_mark_top_ - 2*shadow_w;}; ///property: height of bottom marker void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_ - 2*shadow_w;}; ///set all positions and dimensions of details line at once void setDimensionsAll(const int& x_pos,const int& y_pos, const int& y_pos_down, const int& h_mark_top_ , const int& h_mark_down_) {setXPos(x_pos); setYPos(y_pos); setYPosDown(y_pos_down); setHMarkTop(h_mark_top_); setHMarkDown(h_mark_down_);} ///property: set line thickness void setLineWidth(const int& w){dl_w = w;} ///paint all to screen void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; #endif
/*************************************************************************** modifyconstraintbasiccompulsoryspaceform.h - description ------------------- begin : Feb 10, 2005 copyright : (C) 2005 by Lalescu Liviu email : Please see http://lalescu.ro/liviu/ for details about contacting Liviu Lalescu (in particular, you can find here the e-mail address) ***************************************************************************/ /*************************************************************************** * * * 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 MODIFYCONSTRAINTBASICCOMPULSORYSPACEFORM_H #define MODIFYCONSTRAINTBASICCOMPULSORYSPACEFORM_H #include "ui_modifyconstraintbasiccompulsoryspaceform_template.h" #include "timetable_defs.h" #include "timetable.h" #include "fet.h" class ModifyConstraintBasicCompulsorySpaceForm : public QDialog, Ui::ModifyConstraintBasicCompulsorySpaceForm_template { Q_OBJECT public: ConstraintBasicCompulsorySpace* _ctr; ModifyConstraintBasicCompulsorySpaceForm(QWidget* parent, ConstraintBasicCompulsorySpace* ctr); ~ModifyConstraintBasicCompulsorySpaceForm(); public slots: void constraintChanged(); void ok(); void cancel(); }; #endif
#include <linux/kernel.h> #include <linux/err.h> #include <crypto/public_key.h> #include <crypto/hash.h> #include <keys/asymmetric-type.h> #include <keys/system_keyring.h> #include "module-internal.h" /* * Module signature information block. * * The constituents of the signature section are, in order: * * - Signer's name * - Key identifier * - Signature data * - Information block */ struct module_signature { u8 algo; /* Public-key crypto algorithm [enum pkey_algo] */ u8 hash; /* Digest algorithm [enum hash_algo] */ u8 id_type; /* Key identifier type [enum pkey_id_type] */ u8 signer_len; /* Length of signer's name */ u8 key_id_len; /* Length of key identifier */ u8 __pad[3]; __be32 sig_len; /* Length of signature data */ }; /* * Digest the module contents. */ static struct public_key_signature *mod_make_digest(enum hash_algo hash, const void *mod, unsigned long modlen) { struct public_key_signature *pks; struct crypto_shash *tfm; struct shash_desc *desc; size_t digest_size, desc_size; int ret; pr_devel("==>%s()\n", __func__); /* Allocate the hashing algorithm we're going to need and find out how * big the hash operational data will be. */ tfm = crypto_alloc_shash(hash_algo_name[hash], 0, 0); if (IS_ERR(tfm)) return (PTR_ERR(tfm) == -ENOENT) ? ERR_PTR(-ENOPKG) : ERR_CAST(tfm); desc_size = crypto_shash_descsize(tfm) + sizeof(*desc); digest_size = crypto_shash_digestsize(tfm); /* We allocate the hash operational data storage on the end of our * context data and the digest output buffer on the end of that. */ ret = -ENOMEM; pks = kzalloc(digest_size + sizeof(*pks) + desc_size, GFP_KERNEL); if (!pks) goto error_no_pks; pks->pkey_hash_algo = hash; pks->digest = (u8 *)pks + sizeof(*pks) + desc_size; pks->digest_size = digest_size; desc = (void *)pks + sizeof(*pks); desc->tfm = tfm; desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP; ret = crypto_shash_init(desc); if (ret < 0) goto error; ret = crypto_shash_finup(desc, mod, modlen, pks->digest); if (ret < 0) goto error; crypto_free_shash(tfm); pr_devel("<==%s() = ok\n", __func__); return pks; error: kfree(pks); error_no_pks: crypto_free_shash(tfm); pr_devel("<==%s() = %d\n", __func__, ret); return ERR_PTR(ret); } /* * Extract an MPI array from the signature data. This represents the actual * signature. Each raw MPI is prefaced by a BE 2-byte value indicating the * size of the MPI in bytes. * * RSA signatures only have one MPI, so currently we only read one. */ static int mod_extract_mpi_array(struct public_key_signature *pks, const void *data, size_t len) { size_t nbytes; MPI mpi; if (len < 3) return -EBADMSG; nbytes = ((const u8 *)data)[0] << 8 | ((const u8 *)data)[1]; data += 2; len -= 2; if (len != nbytes) return -EBADMSG; mpi = mpi_read_raw_data(data, nbytes); if (!mpi) return -ENOMEM; pks->mpi[0] = mpi; pks->nr_mpi = 1; return 0; } /* * Request an asymmetric key. */ static struct key *request_asymmetric_key(const char *signer, size_t signer_len, const u8 *key_id, size_t key_id_len) { key_ref_t key; size_t i; char *id, *q; pr_devel("==>%s(,%zu,,%zu)\n", __func__, signer_len, key_id_len); /* Construct an identifier. */ id = kmalloc(signer_len + 2 + key_id_len * 2 + 1, GFP_KERNEL); if (!id) return ERR_PTR(-ENOKEY); memcpy(id, signer, signer_len); q = id + signer_len; *q++ = ':'; *q++ = ' '; for (i = 0; i < key_id_len; i++) { *q++ = hex_asc[*key_id >> 4]; *q++ = hex_asc[*key_id++ & 0x0f]; } *q = 0; pr_debug("Look up: \"%s\"\n", id); key = keyring_search(make_key_ref(system_trusted_keyring, 1), &key_type_asymmetric, id); if (IS_ERR(key)) pr_warn("Request for unknown module key '%s' err %ld\n", id, PTR_ERR(key)); kfree(id); if (IS_ERR(key)) { switch (PTR_ERR(key)) { /* Hide some search errors */ case -EACCES: case -ENOTDIR: case -EAGAIN: return ERR_PTR(-ENOKEY); default: return ERR_CAST(key); } } pr_devel("<==%s() = 0 [%x]\n", __func__, key_serial(key_ref_to_ptr(key))); return key_ref_to_ptr(key); } /* * Verify the signature on a module. */ int mod_verify_sig(const void *mod, unsigned long *_modlen) { struct public_key_signature *pks; struct module_signature ms; struct key *key; const void *sig; size_t modlen = *_modlen, sig_len; int ret; pr_devel("==>%s(,%zu)\n", __func__, modlen); if (modlen <= sizeof(ms)) return -EBADMSG; memcpy(&ms, mod + (modlen - sizeof(ms)), sizeof(ms)); modlen -= sizeof(ms); sig_len = be32_to_cpu(ms.sig_len); if (sig_len >= modlen) return -EBADMSG; modlen -= sig_len; if ((size_t)ms.signer_len + ms.key_id_len >= modlen) return -EBADMSG; modlen -= (size_t)ms.signer_len + ms.key_id_len; *_modlen = modlen; sig = mod + modlen; /* For the moment, only support RSA and X.509 identifiers */ if (ms.algo != PKEY_ALGO_RSA || ms.id_type != PKEY_ID_X509) return -ENOPKG; if (ms.hash >= PKEY_HASH__LAST || !hash_algo_name[ms.hash]) return -ENOPKG; key = request_asymmetric_key(sig, ms.signer_len, sig + ms.signer_len, ms.key_id_len); if (IS_ERR(key)) return PTR_ERR(key); pks = mod_make_digest(ms.hash, mod, modlen); if (IS_ERR(pks)) { ret = PTR_ERR(pks); goto error_put_key; } ret = mod_extract_mpi_array(pks, sig + ms.signer_len + ms.key_id_len, sig_len); if (ret < 0) goto error_free_pks; ret = verify_signature(key, pks); pr_devel("verify_signature() = %d\n", ret); error_free_pks: mpi_free(pks->rsa.s); kfree(pks); error_put_key: key_put(key); pr_devel("<==%s() = %d\n", __func__, ret); return ret; }
/* * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2021-05-07 Meco Man first Version */ #include <rtthread.h> #include <rthw.h> void msleep(unsigned int msecs) { rt_thread_mdelay(msecs); } RTM_EXPORT(msleep); void ssleep(unsigned int seconds) { msleep(seconds * 1000); } RTM_EXPORT(ssleep); void mdelay(unsigned long msecs) { rt_hw_us_delay(msecs * 1000); } RTM_EXPORT(mdelay); void udelay(unsigned long usecs) { rt_hw_us_delay(usecs); } RTM_EXPORT(udelay); void ndelay(unsigned long nsecs) { rt_hw_us_delay(1); } RTM_EXPORT(ndelay);
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> // System.Collections.ArrayList struct ArrayList_t399; #include "mscorlib_System_Object.h" // System.Runtime.Remoting.Contexts.DynamicPropertyCollection struct DynamicPropertyCollection_t1077 : public Object_t { // System.Collections.ArrayList System.Runtime.Remoting.Contexts.DynamicPropertyCollection::_properties ArrayList_t399 * ____properties_0; };
/* include/config.h.in. Generated from configure.in by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define if including the assassin in compile */ //#define ASSASSIN /* Define if building for the 4 level shareware wad files only */ //#define DEMO_VERSION /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define if want to run fullscreen by default instead of windowed */ #define FULLSCREEN_DEFAULT /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `m' library (-lm). */ #define HAVE_LIBM /* Define to 1 if you have the <linux/cdrom.h> header file. */ #undef HAVE_LINUX_CDROM_H /* Define to 1 if you have the <linux/soundcard.h> header file. */ #undef HAVE_LINUX_SOUNDCARD_H /* Define to 1 if you have the <machine/soundcard.h> header file. */ #undef HAVE_MACHINE_SOUNDCARD_H /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H /* Define to 1 if you have the <soundcard.h> header file. */ #undef HAVE_SOUNDCARD_H /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H /* Define to 1 if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H /* Define this if C symbols are prefixed with an underscore */ #undef HAVE_SYM_PREFIX_UNDERSCORE /* Define to 1 if you have the <sys/cdio.h> header file. */ #undef HAVE_SYS_CDIO_H /* Define to 1 if you have the <sys/soundcard.h> header file. */ #undef HAVE_SYS_SOUNDCARD_H /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H /* Define this if the GCC __builtin_expect keyword is available */ #undef HAVE___BUILTIN_EXPECT #ifndef HAVE___BUILTIN_EXPECT # define __builtin_expect(x,c) x #endif /* Define to not compile most parameter validation debugging code */ #undef NORANGECHECKING /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define if building with OpenGL support */ #undef RENDER3D /* Define this to the shared game directory root */ #undef SHARED_DATAPATH /* The size of `char', as computed by sizeof. */ #define SIZEOF_CHAR sizeof(char) /* The size of `double', as computed by sizeof. */ #define SIZEOF_DOUBLE sizeof(double) /* The size of `float', as computed by sizeof. */ #define SIZEOF_FLOAT sizeof(float) /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT sizeof(int) /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG sizeof(long int) /* The size of `long double', as computed by sizeof. */ #undef SIZEOF_LONG_DOUBLE /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `short', as computed by sizeof. */ #define SIZEOF_SHORT sizeof(short) /* The size of `size_t', as computed by sizeof. */ #define SIZEOF_SIZE_T 4 /* The size of `void *', as computed by sizeof. */ #define SIZEOF_VOID_P sizeof(void *) /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ #undef STAT_MACROS_BROKEN /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if building for version 1.0 (4-player) wadfiles only */ #undef VERSION10_WAD /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif # define WORDS_BIGENDIAN 1 /* Define if not want to use assembly language */ #undef _DISABLE_ASM /* Define for saved game compatibility with DOS-Hexen (experimental) */ #undef _DOSSAVE_COMPAT /* Define if want to disable user directories */ #undef _NO_USERDIRS /* For pthread support in OSS audio code. */ #ifndef _REENTRANT # undef _REENTRANT #endif /* For pthread support in OSS audio code. */ #ifndef _THREAD_SAFE # undef _THREAD_SAFE #endif /* Define to 1 if type `char' is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ # undef __CHAR_UNSIGNED__ #endif /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtSensors module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QAMBIENTLIGHTSENSOR_P_H #define QAMBIENTLIGHTSENSOR_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // QT_BEGIN_NAMESPACE class QAmbientLightReadingPrivate { public: QAmbientLightReadingPrivate() : lightLevel(0) { } int lightLevel; }; QT_END_NAMESPACE #endif
/*************************************************************************** cmapfilefilterbase.h ------------------- begin : Mon May 27 2002 copyright : (C) 2002 by Kmud Developer Team email : kmud-devel@kmud.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 CMAPFILEFILTERBASE_H #define CMAPFILEFILTERBASE_H #include <qfile.h> #include <kurl.h> class CMapManager; /**This class is used as a base calls for all save/load filters *@author Kmud Developer Team */ class CMapFileFilterBase { public: CMapFileFilterBase(CMapManager *manager); virtual ~CMapFileFilterBase(); /** This returns name of the import/export filter. This should be kept small * @return The Name of the filter */ virtual QString getName(void)=0; /** This returns a discription of the import/export filter * @return The discription */ virtual QString getDescription(void)=0; /** This returns the extension of the filename that will be loaded,created * @return The exstension */ virtual QString getExtension(void)=0; /** This returns the pattern extension of the filename that will be loaded,created * @return The exstension */ virtual QString getPatternExtension(void)=0; /** This method will return true or false depending on if it's a export filter * @return True if this is a export filter, otherwise false */ virtual bool supportSave(void)=0; /** This method will return true or false depending on if it's a import filter * @return True if this is a import filter, otherwise false */ virtual bool supportLoad(void)=0; /** Is this the native format? */ virtual bool isNative() = 0; /** This method is called by the map manager to save map data. */ virtual int saveData(const QString &) { return 0; } /** This method is called by the map manager to load map data. */ virtual int loadData(const QString &) { return 0; } protected: /** A pointer to the map manager */ CMapManager *m_mapManager; }; #endif
/* * Copyright (c) 2003, 2007-11 Matteo Frigo * Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology * * 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 * */ /* This file was automatically generated --- DO NOT EDIT */ /* Generated on Wed Jul 27 06:15:48 EDT 2011 */ #include "codelet-dft.h" #ifdef HAVE_FMA /* Generated by: ../../../genfft/gen_twiddle_c.native -fma -reorder-insns -schedule-for-pipeline -simd -compact -variables 4 -pipeline-latency 8 -n 4 -name t2bv_4 -include t2b.h -sign 1 */ /* * This function contains 11 FP additions, 8 FP multiplications, * (or, 9 additions, 6 multiplications, 2 fused multiply/add), * 13 stack variables, 0 constants, and 8 memory accesses */ #include "t2b.h" static void t2bv_4(R *ri, R *ii, const R *W, stride rs, INT mb, INT me, INT ms) { { INT m; R *x; x = ii; for (m = mb, W = W + (mb * ((TWVL / VL) * 6)); m < me; m = m + VL, x = x + (VL * ms), W = W + (TWVL * 6), MAKE_VOLATILE_STRIDE(rs)) { V T1, T7, T2, T5, T8, T3, T6; T1 = LD(&(x[0]), ms, &(x[0])); T7 = LD(&(x[WS(rs, 3)]), ms, &(x[WS(rs, 1)])); T2 = LD(&(x[WS(rs, 2)]), ms, &(x[0])); T5 = LD(&(x[WS(rs, 1)]), ms, &(x[WS(rs, 1)])); T8 = BYTW(&(W[TWVL * 4]), T7); T3 = BYTW(&(W[TWVL * 2]), T2); T6 = BYTW(&(W[0]), T5); { V Ta, T4, Tb, T9; Ta = VADD(T1, T3); T4 = VSUB(T1, T3); Tb = VADD(T6, T8); T9 = VSUB(T6, T8); ST(&(x[0]), VADD(Ta, Tb), ms, &(x[0])); ST(&(x[WS(rs, 2)]), VSUB(Ta, Tb), ms, &(x[0])); ST(&(x[WS(rs, 1)]), VFMAI(T9, T4), ms, &(x[WS(rs, 1)])); ST(&(x[WS(rs, 3)]), VFNMSI(T9, T4), ms, &(x[WS(rs, 1)])); } } } VLEAVE(); } static const tw_instr twinstr[] = { VTW(0, 1), VTW(0, 2), VTW(0, 3), {TW_NEXT, VL, 0} }; static const ct_desc desc = { 4, XSIMD_STRING("t2bv_4"), twinstr, &GENUS, {9, 6, 2, 0}, 0, 0, 0 }; void XSIMD(codelet_t2bv_4) (planner *p) { X(kdft_dit_register) (p, t2bv_4, &desc); } #else /* HAVE_FMA */ /* Generated by: ../../../genfft/gen_twiddle_c.native -simd -compact -variables 4 -pipeline-latency 8 -n 4 -name t2bv_4 -include t2b.h -sign 1 */ /* * This function contains 11 FP additions, 6 FP multiplications, * (or, 11 additions, 6 multiplications, 0 fused multiply/add), * 13 stack variables, 0 constants, and 8 memory accesses */ #include "t2b.h" static void t2bv_4(R *ri, R *ii, const R *W, stride rs, INT mb, INT me, INT ms) { { INT m; R *x; x = ii; for (m = mb, W = W + (mb * ((TWVL / VL) * 6)); m < me; m = m + VL, x = x + (VL * ms), W = W + (TWVL * 6), MAKE_VOLATILE_STRIDE(rs)) { V T1, T8, T3, T6, T7, T2, T5; T1 = LD(&(x[0]), ms, &(x[0])); T7 = LD(&(x[WS(rs, 3)]), ms, &(x[WS(rs, 1)])); T8 = BYTW(&(W[TWVL * 4]), T7); T2 = LD(&(x[WS(rs, 2)]), ms, &(x[0])); T3 = BYTW(&(W[TWVL * 2]), T2); T5 = LD(&(x[WS(rs, 1)]), ms, &(x[WS(rs, 1)])); T6 = BYTW(&(W[0]), T5); { V T4, T9, Ta, Tb; T4 = VSUB(T1, T3); T9 = VBYI(VSUB(T6, T8)); ST(&(x[WS(rs, 3)]), VSUB(T4, T9), ms, &(x[WS(rs, 1)])); ST(&(x[WS(rs, 1)]), VADD(T4, T9), ms, &(x[WS(rs, 1)])); Ta = VADD(T1, T3); Tb = VADD(T6, T8); ST(&(x[WS(rs, 2)]), VSUB(Ta, Tb), ms, &(x[0])); ST(&(x[0]), VADD(Ta, Tb), ms, &(x[0])); } } } VLEAVE(); } static const tw_instr twinstr[] = { VTW(0, 1), VTW(0, 2), VTW(0, 3), {TW_NEXT, VL, 0} }; static const ct_desc desc = { 4, XSIMD_STRING("t2bv_4"), twinstr, &GENUS, {11, 6, 0, 0}, 0, 0, 0 }; void XSIMD(codelet_t2bv_4) (planner *p) { X(kdft_dit_register) (p, t2bv_4, &desc); } #endif /* HAVE_FMA */
#ifndef _TYPES_H_ #define _TYPES_H_ #ifndef FAR #define FAR #endif #ifndef VOID #define VOID void #endif #ifndef CALLBACK #define CALLBACK _stdcall #endif #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif typedef unsigned char BYTE, *PBYTE, *PUCHAR, FAR *LPBYTE, BOOL; typedef unsigned short WORD, *PWORD, FAR *LPWORD; typedef unsigned long DWORD, *PDWORD, FAR * LPDWORD; typedef unsigned int UINT; typedef unsigned long ULONG; typedef long int LONG; typedef unsigned long long ULONGLONG; typedef char *PSTR, FAR *LPSTR; typedef const char *PCSTR, FAR *LPCSTR; typedef void *PVOID, FAR *LPVOID; typedef int BOOLEAN; #ifndef __cplusplus typedef int bool_t; #else typedef bool bool_t; #endif #ifndef MAX #define MAX(a,b) (((a)>(b))?(a):(b)) #endif #ifndef MIN #define MIN(a,b) (((a)>(b))?(b):(a)) #endif #ifndef offsetof #define offsetof(typ,id) (unsigned)&(((typ*)0)->id) #endif #undef ST_STATUS #undef SUCCESS #undef FAILURE #endif
/* Copyright (C) 1994, 1995 Aladdin Enterprises. All rights reserved. This file is part of GNU Ghostscript. GNU Ghostscript is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Refer to the GNU General Public License for full details. Everyone is granted permission to copy, modify and redistribute GNU Ghostscript, but only under the conditions described in the GNU General Public License. A copy of this license is supposed to have been given to you along with GNU Ghostscript so you can know your rights and responsibilities. It should be in a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. Aladdin Enterprises is not affiliated with the Free Software Foundation or the GNU Project. GNU Ghostscript, as distributed by Aladdin Enterprises, does not depend on any other GNU software. */ /* gxdda.h */ /* DDA definitions for Ghostscript line drawing */ /* Requires gxfixed.h */ /* * We use the familiar Bresenham DDA algorithm for several purposes: * - tracking the edges when filling trapezoids; * - tracking the current pixel corner coordinates when rasterizing * skewed or rotated images; * - converting curves to sequences of lines (this is a 3rd-order * DDA, the others are 1st-order); * - perhaps someday for drawing single-pixel lines. * In the case of trapezoids, lines, and curves, we need to use * the DDA to find the integer X values at integer+0.5 values of Y; * in the case of images, we use DDAs to compute the (fixed) * X and Y values at (integer) source pixel corners. * * The purpose of the DDA is to compute the exact values Q(i) = floor(i*D/N) * for increasing integers i, 0 <= i <= N. D is considered to be an * integer, although it may actually be a fixed. For the algorithm, * we maintain i*D/N as Q + R/N where Q and R are integers, 0 <= R < N, * with the following auxiliary values: * dQ = floor(D/N) * dR = D mod N * NdR = N - dR * Then at each iteration we do: * Q += dQ; * if ( R < dR ) ++Q, R += NdR; else R -= dR; * These formulas work regardless of the sign of D, and never let R go * out of range. */ #define dda_state_struct(sname, dtype, ntype)\ struct sname { dtype Q; ntype R; } #define dda_step_struct(sname, dtype, ntype)\ struct sname { dtype dQ; ntype dR, NdR; } /* DDA with fixed Q and (unsigned) integer N */ typedef dda_state_struct(_a, fixed, uint) gx_dda_state_fixed; typedef dda_step_struct(_e, fixed, uint) gx_dda_step_fixed; typedef struct gx_dda_fixed_s { gx_dda_state_fixed state; gx_dda_step_fixed step; } gx_dda_fixed; /* * Initialize a DDA. The sign test is needed only because C doesn't * provide reliable definitions of / and % for integers (!!!). */ #define dda_init_state(dstate, init, N)\ (dstate).Q = (init), (dstate).R = (N) #define dda_init_step(dstep, D, N)\ if ( (N) == 0 )\ (dstep).dQ = 0, (dstep).dR = 0;\ else if ( (D) < 0 )\ { (dstep).dQ = -(-(D) / (N));\ if ( ((dstep).dR = -(D) % (N)) != 0 )\ --(dstep).dQ, (dstep).dR = (N) - (dstep).dR;\ }\ else\ { (dstep).dQ = (D) / (N); (dstep).dR = (D) % (N); }\ (dstep).NdR = (N) - (dstep).dR #define dda_init(dda, init, D, N)\ dda_init_state((dda).state, init, N);\ dda_init_step((dda).step, D, N) /* * Compute the sum of two DDA steps with the same D and N. */ #define dda_step_add(tostep, fromstep)\ (tostep).dQ +=\ ((tostep).dR < (fromstep).NdR ?\ ((tostep).dR += (fromstep).dR, (fromstep).dQ) :\ ((tostep).dR -= (fromstep).NdR, (fromstep).dQ + 1)) /* * Return the current value in a DDA. */ #define dda_state_current(dstate) (dstate).Q #define dda_current(dda) dda_state_current((dda).state) /* * Increment a DDA to the next point. * Returns the updated current value. */ #define dda_state_next(dstate, dstep)\ (dstate).Q +=\ ((dstate).R >= (dstep).dR ?\ ((dstate).R -= (dstep).dR, (dstep).dQ) :\ ((dstate).R += (dstep).NdR, (dstep).dQ + 1)) #define dda_next(dda) dda_state_next((dda).state, (dda).step) /* * Back up a DDA to the previous point. * Returns the updated current value. */ #define dda_state_previous(dstate, dstep)\ (dstate).Q -=\ ((dstate).R < (dstep).NdR ?\ ((dstate).R += (dstep).dR, (dstep).dQ) :\ ((dstate).R -= (dstep).NdR, (dstep).dQ + 1)) #define dda_previous(dda) dda_state_previous((dda).state, (dda).step)
/* * Copyright (c) 2006 MontaVista Software, Inc. * Copyright (c) 2006-2007 Red Hat, Inc. * * All rights reserved. * * Author: Steven Dake (sdake@redhat.com) * * This software licensed under BSD license, the text of which follows: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - Neither the name of the MontaVista Software, 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 OBJDB_H_DEFINED #define OBJDB_H_DEFINED #define OBJECT_PARENT_HANDLE 0 struct object_valid { char *object_name; int object_len; }; struct object_key_valid { char *key_name; int key_len; int (*validate_callback) (void *key, int key_len, void *value, int value_len); }; struct objdb_iface_ver0 { int (*objdb_init) (void); int (*object_create) ( unsigned int parent_object_handle, unsigned int *object_handle, void *object_name, unsigned int object_name_len); int (*object_priv_set) ( unsigned int object_handle, void *priv); int (*object_key_create) ( unsigned int object_handle, void *key_name, int key_len, void *value, int value_len); int (*object_destroy) ( unsigned int object_handle); int (*object_valid_set) ( unsigned int object_handle, struct object_valid *object_valid_list, unsigned int object_valid_list_entries); int (*object_key_valid_set) ( unsigned int object_handle, struct object_key_valid *object_key_valid_list, unsigned int object_key_valid_list_entries); int (*object_find_reset) ( unsigned int parent_object_handle); int (*object_find) ( unsigned int parent_object_handle, void *object_name, int object_name_len, unsigned int *object_handle); int (*object_key_get) ( unsigned int object_handle, void *key_name, int key_len, void **value, int *value_len); int (*object_priv_get) ( unsigned int jobject_handle, void **priv); }; #endif /* OBJDB_H_DEFINED */
/*************************************************************************** * Copyright (C) 2006 by Zi Ree * * Zi Ree @ SecondLife * * * * 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 TIMELINE_H #define TIMELINE_H #include <QFrame> #include "keyframelist.h" #define KEY_WIDTH 10 #define KEY_HEIGHT 10 #define LINE_HEIGHT 11 #define LEFT_STRUT 55 // FIXME: find out at runtime #define NUM_PARTS 25 /** @author Zi Ree */ class Animation; class Timeline : public QFrame { Q_OBJECT public: Timeline(QWidget* parent=0,Qt::WindowFlags f=0); ~Timeline(); void setAnimation(Animation* anim); void selectTrack(int track); signals: void positionCenter(int pos); void trackClicked(int track); void resized(const QSize& newSize); void animationChanged(Animation* anim); void deleteFrame(int track,int frame); void insertFrame(int track,int frame); public slots: void setCurrentFrame(int frame); protected slots: void redrawTrack(int track); void redrawTrackImmediately(int track); // does an immediate repaint() void setNumberOfFrames(int frames); protected: virtual void paintEvent(QPaintEvent* event); virtual void mousePressEvent(QMouseEvent* e); virtual void mouseReleaseEvent(QMouseEvent* e); virtual void mouseMoveEvent(QMouseEvent* e); virtual void wheelEvent(QWheelEvent* e); virtual void keyPressEvent(QKeyEvent* event); virtual void keyReleaseEvent(QKeyEvent* event); void drawKeyframe(int track,int frame); void drawTrack(int track); bool isDirty(int frame); // returns true if frame is inside "dirty" redraw region Animation* animation; int numOfFrames; int currentFrame; // keyframe drawing clip area int firstVisibleKeyX; int visibleKeysX; bool drawn; bool leftMouseButton; bool shift; bool fullRepaint; QPixmap* offscreen; int trackSelected; int frameSelected; int dragging; // contains the current animation frame where dragging occurs }; #endif
#ifndef __ORG_XMLVM_IPHONE_NSNETSERVICEBROWSERDELEGATE_WRAPPER__ #define __ORG_XMLVM_IPHONE_NSNETSERVICEBROWSERDELEGATE_WRAPPER__ #include "xmlvm.h" // Preprocessor constants for interfaces: // Implemented interfaces: // Super Class: #include "org_xmlvm_iphone_NSObject.h" // Circular references: #ifndef XMLVM_FORWARD_DECL_org_xmlvm_iphone_NSNetServiceBrowserDelegate #define XMLVM_FORWARD_DECL_org_xmlvm_iphone_NSNetServiceBrowserDelegate XMLVM_FORWARD_DECL(org_xmlvm_iphone_NSNetServiceBrowserDelegate) #endif // Class declarations for org.xmlvm.iphone.NSNetServiceBrowserDelegate$Wrapper XMLVM_DEFINE_CLASS(org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper, 7, XMLVM_ITABLE_SIZE_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper) extern JAVA_OBJECT __CLASS_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper; extern JAVA_OBJECT __CLASS_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper_1ARRAY; extern JAVA_OBJECT __CLASS_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper_2ARRAY; extern JAVA_OBJECT __CLASS_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper_3ARRAY; //XMLVM_BEGIN_DECLARATIONS #define __ADDITIONAL_INSTANCE_FIELDS_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper @interface NSNetServiceBrowserDelegateWrapper : DelegateWrapper <NSNetServiceBrowserDelegate> { @public JAVA_OBJECT delegate_; } - (id) initWithDelegate: (JAVA_OBJECT) d_; - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindDomain:(NSString *)domainName moreComing:(BOOL)moreDomainsComing; - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindService:(NSNetService *)netService moreComing:(BOOL)moreServicesComing; - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didNotSearch:(NSDictionary *)errorInfo; - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didRemoveDomain:(NSString *)domainName moreComing:(BOOL)moreDomainsComing; - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didRemoveService:(NSNetService *)netService moreComing:(BOOL)moreServicesComing; - (void)netServiceBrowserDidStopSearch:(NSNetServiceBrowser *)netServiceBrowser; - (void)netServiceBrowserWillSearch:(NSNetServiceBrowser *)netServiceBrowser; @end //XMLVM_END_DECLARATIONS #define __INSTANCE_FIELDS_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper \ __INSTANCE_FIELDS_org_xmlvm_iphone_NSObject; \ struct { \ JAVA_OBJECT delegate_; \ __ADDITIONAL_INSTANCE_FIELDS_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper \ } org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper struct org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper { __TIB_DEFINITION_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper* tib; struct { __INSTANCE_FIELDS_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper; } fields; }; #ifndef XMLVM_FORWARD_DECL_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper #define XMLVM_FORWARD_DECL_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper typedef struct org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper; #endif #define XMLVM_VTABLE_SIZE_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper 7 void __INIT_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper(); void __INIT_IMPL_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper(); void __DELETE_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper(void* me, void* client_data); void __INIT_INSTANCE_MEMBERS_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper(JAVA_OBJECT me, int derivedClassWillRegisterFinalizer); JAVA_OBJECT __NEW_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper(); JAVA_OBJECT __NEW_INSTANCE_org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper(); void org_xmlvm_iphone_NSNetServiceBrowserDelegate_Wrapper___INIT____org_xmlvm_iphone_NSNetServiceBrowserDelegate(JAVA_OBJECT me, JAVA_OBJECT n1); #endif
/* * For each focus/selection change, it prints the (name, role, [state-set]) * for the object getting the focus/selection. * * You can specify if you want to filter by application. Use --help * for more information. */ #include <atspi/atspi.h> #include <stdlib.h> #include <unistd.h> #include <string.h> gchar *filter_name = NULL; const static gchar* atspi_state_get_name (gint state) { GTypeClass *type_class; GEnumValue *value; type_class = g_type_class_ref (ATSPI_TYPE_STATE_TYPE); g_return_val_if_fail (G_IS_ENUM_CLASS (type_class), ""); value = g_enum_get_value (G_ENUM_CLASS (type_class), state); return value->value_nick; } static gchar* get_state_set (AtspiAccessible *accessible) { AtspiStateSet *state_set = atspi_accessible_get_state_set (accessible); GArray *states = atspi_state_set_get_states (state_set); gchar *result = g_strdup_printf ("["); gchar *aux = NULL; gint i; AtspiStateType state; for (i = 0; i < states->len; i++) { state = g_array_index (states, gint, i); aux = result; if (i < states->len -1) result = g_strdup_printf ("%s%s,", aux, atspi_state_get_name(state)); else result = g_strdup_printf ("%s%s", aux, atspi_state_get_name(state)); g_free (aux); } aux = result; result = g_strconcat (aux, "]", NULL); g_free (aux); g_array_free (states, TRUE); g_object_unref (state_set); return result; } static gchar* get_label (AtspiAccessible *accessible) { GArray *relations; AtspiRelation *relation; gint i; gchar *result = ""; relations = atspi_accessible_get_relation_set (accessible, NULL); if (relations == NULL) { return ""; } for (i = 0; i < relations->len; i++) { relation = g_array_index (relations, AtspiRelation*, i); if (atspi_relation_get_relation_type (relation) == ATSPI_RELATION_LABELLED_BY) { result = atspi_accessible_get_name (atspi_relation_get_target (relation, 0), NULL); } } if (relations != NULL) g_array_free (relations, TRUE); return result; } static void print_info (AtspiAccessible *accessible, gchar *app_name) { gchar *name = "NULL"; gchar *role_name = "NULL"; gchar *state_set = NULL; if (accessible != NULL) { name = atspi_accessible_get_name (accessible, NULL); if ((name == NULL) || (g_strcmp0 (name, "") == 0)) name = get_label (accessible); role_name = atspi_accessible_get_role_name (accessible, NULL); } state_set = get_state_set (accessible); g_print ("(%s, %s, %s, %s)\n", app_name, name, role_name, state_set); g_free (state_set); } static void on_event (const AtspiEvent *event, void *data) { AtspiAccessible *application = NULL; gchar *app_name = NULL; if (event->source == NULL) return; /* We only care about focus/selection gain */ if (!event->detail1) return; application = atspi_accessible_get_application (event->source, NULL); if (application == NULL) return; app_name = atspi_accessible_get_name (application, NULL); if ((filter_name != NULL) && (g_strcmp0 (app_name, filter_name) != 0)) goto clean; print_info (event->source, app_name); clean: g_free (app_name); } static gchar* parse_args (int *argc, char ***argv) { GError *error = NULL; GOptionContext *context; static gchar *name = NULL; static GOptionEntry entries [] = { {"application", 'a', 0, G_OPTION_ARG_STRING, &name, "Application name", NULL}, {NULL,}, }; context = g_option_context_new (""); g_option_context_add_main_entries (context, entries, NULL); if (!g_option_context_parse (context, argc, argv, &error)) { g_print ("%s\n", error->message); g_print ("Use --help for more information.\n"); exit (0); } return name; } int main(int argc, gchar **argv) { AtspiEventListener *listener; filter_name = parse_args (&argc, &argv); if (!filter_name) { g_print ("NOTE: Application name to filter not specified. Showing " "focus/selection changes for any application.\n"); } atspi_init (); listener = atspi_event_listener_new (on_event, NULL, NULL); atspi_event_listener_register (listener, "object:state-changed:focused", NULL); atspi_event_listener_register (listener, "object:state-changed:selected", NULL); atspi_event_main (); return 0; }
/* * linux/include/asm-arm/proc-armo/ptrace.h * * Copyright (C) 1996 Russell King */ #ifndef __ASM_PROC_PTRACE_H #define __ASM_PROC_PTRACE_H /* this struct defines the way the registers are stored on the stack during a system call. */ struct pt_regs { long uregs[17]; }; #define ARM_pc uregs[15] #define ARM_lr uregs[14] #define ARM_sp uregs[13] #define ARM_ip uregs[12] #define ARM_fp uregs[11] #define ARM_r10 uregs[10] #define ARM_r9 uregs[9] #define ARM_r8 uregs[8] #define ARM_r7 uregs[7] #define ARM_r6 uregs[6] #define ARM_r5 uregs[5] #define ARM_r4 uregs[4] #define ARM_r3 uregs[3] #define ARM_r2 uregs[2] #define ARM_r1 uregs[1] #define ARM_r0 uregs[0] #define ARM_ORIG_r0 uregs[16] /* -1 */ #define USR26_MODE 0x00 #define FIQ26_MODE 0x01 #define IRQ26_MODE 0x02 #define SVC26_MODE 0x03 #define MODE_MASK 0x03 #define F_BIT (1 << 26) #define I_BIT (1 << 27) #define CC_V_BIT (1 << 28) #define CC_C_BIT (1 << 29) #define CC_Z_BIT (1 << 30) #define CC_N_BIT (1 << 31) #define processor_mode(regs) \ ((regs)->ARM_pc & MODE_MASK) #define user_mode(regs) \ (processor_mode(regs) == USR26_MODE) #define interrupts_enabled(regs) \ (!((regs)->ARM_pc & I_BIT)) #define fast_interrupts_enabled(regs) \ (!((regs)->ARM_pc & F_BIT)) #define condition_codes(regs) \ ((regs)->ARM_pc & (CC_V_BIT|CC_C_BIT|CC_Z_BIT|CC_N_BIT)) #define pc_pointer(v) \ ((v) & 0x03fffffc) #define instruction_pointer(regs) \ (pc_pointer((regs)->ARM_pc)) /* Are the current registers suitable for user mode? * (used to maintain security in signal handlers) */ #define valid_user_regs(regs) \ (user_mode(regs) && ((regs)->ARM_sp & 3) == 0) #endif
/* * ParserAction.h * * Created on: Dec 10, 2014 * Author: julian * * This class parser an action from a string written in JSON */ #ifndef SRC_PARSERS_PARSERACTION_H_ #define SRC_PARSERS_PARSERACTION_H_ #include "../json/json/json.h" //To verify the actions parameters #include "../ActionDescription/SimpleActionDescription.h" #include "../ActionDescription/CompositeActionDescription.h" //To generate the context tree #include "../ContextDescription/SimpleContextDescription.h" #include "../ContextDescription/CompositeContextDescription.h" //Simple actions description #include "../ActionDescription/SimpleActions/SimpleActionDoNothing.h" #include "../ActionDescription/SimpleActions/SimpleActionMoveBody.h" #include "../ActionDescription/SimpleActions/SimpleActionMoveShoulder.h" #include "../ActionDescription/SimpleActions/SimpleActionMoveTorso.h" #include "../ActionDescription/SimpleActions/SimpleActionOscillateBody.h" #include "../ActionDescription/SimpleActions/SimpleActionOscillateShoulder.h" #include "../ActionDescription/SimpleActions/SimpleActionOscillateTorso.h" #include "../ActionDescription/SimpleActions/SimpleActionSpeak.h" //composite action description #include "../ActionDescription/CompositeActions/CompositeActionWalk.h" class ParserAction { public: ParserAction(); virtual ~ParserAction(); AbstractContextDescription * parser(std::string message); void setActionsAvailable(std::map <std::string,AbstractActionDescription *> * actions_available); private: AbstractContextDescription * parser(Json::Value root, AbstractContextDescription * predecessor); AbstractContextDescription * parserAction(Json::Value action, AbstractContextDescription * predecessor); void parserContext(Json::Value context, CompositeContextDescription * predecessor,bool is_sequential); AbstractContextDescription * parserParallelContext(Json::Value context, AbstractContextDescription * predecessor); AbstractContextDescription * parserSequentialContext(Json::Value context, AbstractContextDescription * predecessor); std::map <std::string,AbstractActionDescription *> * actions_available; }; #endif /* SRC_PARSERS_PARSERACTION_H_ */
/* * * 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 */ /* * Test Name: fchmod03 * * Test Description: * Verify that, fchmod(2) will succeed to change the mode of a file * and set the sticky bit on it if invoked by non-root (uid != 0) * process with the following constraints, * - the process is the owner of the file. * - the effective group ID or one of the supplementary group ID's of the * process is equal to the group ID of the file. * * Expected Result: * fchmod() should return value 0 on success and succeeds to change * the mode of specified file, sets sticky bit on it. * * Algorithm: * Setup: * Setup signal handling. * Create temporary directory. * Pause for SIGUSR1 if option specified. * * Test: * Loop if the proper options are given. * Execute system call * Check return code, if system call failed (return=-1) * Log the errno and Issue a FAIL message. * Otherwise, * Verify the Functionality of system call * if successful, * Issue Functionality-Pass message. * Otherwise, * Issue Functionality-Fail message. * Cleanup: * Print errno log and/or timing stats if options given * Delete the temporary directory created. * * Usage: <for command-line> * fchmod03 [-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: * This test should be run by 'non-super-user' only. * */ #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/fcntl.h> #include <errno.h> #include <string.h> #include <signal.h> #include <pwd.h> #include "test.h" #include "usctest.h" #define FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) #define PERMS 01777 #define TESTFILE "testfile" int fd; /* file descriptor for test file */ char *TCID = "fchmod03"; int TST_TOTAL = 1; char nobody_uid[] = "nobody"; struct passwd *ltpuser; void setup(); /* Main setup function for the test */ void cleanup(); /* Main cleanup function for the test */ int main(int ac, char **av) { struct stat stat_buf; /* stat struct. */ int lc; const char *msg; mode_t file_mode; /* mode permissions set on testfile */ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { tst_count = 0; TEST(fchmod(fd, PERMS)); if (TEST_RETURN == -1) { tst_resm(TFAIL | TTERRNO, "fchmod failed"); continue; } /* * Get the file information using * fstat(2). */ if (fstat(fd, &stat_buf) == -1) tst_brkm(TFAIL | TERRNO, cleanup, "fstat failed"); file_mode = stat_buf.st_mode; /* Verify STICKY BIT set on testfile */ if ((file_mode & PERMS) != PERMS) tst_resm(TFAIL, "%s: Incorrect modes 0%3o, " "Expected 0777", TESTFILE, file_mode); else tst_resm(TPASS, "Functionality of fchmod(%d, " "%#o) successful", fd, PERMS); } cleanup(); tst_exit(); } void setup(void) { tst_sig(NOFORK, DEF_HANDLER, cleanup); tst_require_root(NULL); ltpuser = getpwnam(nobody_uid); if (ltpuser == NULL) tst_brkm(TBROK | TERRNO, NULL, "getpwnam failed"); if (seteuid(ltpuser->pw_uid) == -1) tst_brkm(TBROK | TERRNO, NULL, "seteuid failed"); TEST_PAUSE; tst_tmpdir(); /* * Create a test file under temporary directory with specified * mode permissios and set the ownership of the test file to the * uid/gid of guest user. */ if ((fd = open(TESTFILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) tst_brkm(TBROK | TERRNO, cleanup, "open failed"); } void cleanup(void) { TEST_CLEANUP; if (close(fd) == -1) tst_resm(TWARN | TERRNO, "close failed"); tst_rmdir(); }
#include "lolevel.h" #include "platform.h" #include "core.h" // NOTE auto in P mode doesn't seem to ever enable dark frame, even if you override > 1.3 sec static long *nrflag = (long*)(0xE4F0+4); // FF3634B8, 4th arg to sub_FF2A49C4 #define PAUSE_FOR_FILE_COUNTER 100 // sometimes the file counter isn't updated when hook starts #include "../../../generic/capt_seq.c"
/** * @file * ANSI Colours * * @authors * Copyright (C) 2021 Richard Russon <rich@flatcap.org> * * @copyright * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MUTT_COLOR_ANSI_H #define MUTT_COLOR_ANSI_H #include <stdbool.h> struct AttrColorList; /** * struct AnsiColor - An ANSI escape sequence */ struct AnsiColor { struct AttrColor *attr_color; ///< Curses colour of text int attrs; ///< Attributes, e.g. A_BOLD int fg; ///< Foreground colour int bg; ///< Background colour }; int ansi_color_parse (const char *str, struct AnsiColor *ansi, struct AttrColorList *acl, bool dry_run); int ansi_color_seq_length(const char *str); #endif /* MUTT_COLOR_ANSI_H */
/* $Id: ebus.h,v 1.1.1.1 2007-05-25 06:50:13 bruce Exp $ * ebus.h: PCI to Ebus pseudo driver software state. * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) * * Adopted for sparc by V. Roganov and G. Raiko. */ #ifndef __SPARC_EBUS_H #define __SPARC_EBUS_H #ifndef _LINUX_IOPORT_H #include <linux/ioport.h> #endif #include <asm/oplib.h> #include <asm/prom.h> #include <asm/of_device.h> struct linux_ebus_child { struct linux_ebus_child *next; struct linux_ebus_device *parent; struct linux_ebus *bus; struct device_node *prom_node; struct resource resource[PROMREG_MAX]; int num_addrs; unsigned int irqs[PROMINTR_MAX]; int num_irqs; }; struct linux_ebus_device { struct of_device ofdev; struct linux_ebus_device *next; struct linux_ebus_child *children; struct linux_ebus *bus; struct device_node *prom_node; struct resource resource[PROMREG_MAX]; int num_addrs; unsigned int irqs[PROMINTR_MAX]; int num_irqs; }; #define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev) struct linux_ebus { struct of_device ofdev; struct linux_ebus *next; struct linux_ebus_device *devices; struct linux_pbm_info *parent; struct pci_dev *self; struct device_node *prom_node; }; #define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev) struct linux_ebus_dma { unsigned int dcsr; unsigned int dacr; unsigned int dbcr; }; #define EBUS_DCSR_INT_PEND 0x00000001 #define EBUS_DCSR_ERR_PEND 0x00000002 #define EBUS_DCSR_DRAIN 0x00000004 #define EBUS_DCSR_INT_EN 0x00000010 #define EBUS_DCSR_RESET 0x00000080 #define EBUS_DCSR_WRITE 0x00000100 #define EBUS_DCSR_EN_DMA 0x00000200 #define EBUS_DCSR_CYC_PEND 0x00000400 #define EBUS_DCSR_DIAG_RD_DONE 0x00000800 #define EBUS_DCSR_DIAG_WR_DONE 0x00001000 #define EBUS_DCSR_EN_CNT 0x00002000 #define EBUS_DCSR_TC 0x00004000 #define EBUS_DCSR_DIS_CSR_DRN 0x00010000 #define EBUS_DCSR_BURST_SZ_MASK 0x000c0000 #define EBUS_DCSR_BURST_SZ_1 0x00080000 #define EBUS_DCSR_BURST_SZ_4 0x00000000 #define EBUS_DCSR_BURST_SZ_8 0x00040000 #define EBUS_DCSR_BURST_SZ_16 0x000c0000 #define EBUS_DCSR_DIAG_EN 0x00100000 #define EBUS_DCSR_DIS_ERR_PEND 0x00400000 #define EBUS_DCSR_TCI_DIS 0x00800000 #define EBUS_DCSR_EN_NEXT 0x01000000 #define EBUS_DCSR_DMA_ON 0x02000000 #define EBUS_DCSR_A_LOADED 0x04000000 #define EBUS_DCSR_NA_LOADED 0x08000000 #define EBUS_DCSR_DEV_ID_MASK 0xf0000000 extern struct linux_ebus *ebus_chain; extern void ebus_init(void); #define for_each_ebus(bus) \ for((bus) = ebus_chain; (bus); (bus) = (bus)->next) #define for_each_ebusdev(dev, bus) \ for((dev) = (bus)->devices; (dev); (dev) = (dev)->next) #define for_each_edevchild(dev, child) \ for((child) = (dev)->children; (child); (child) = (child)->next) #endif /* !(__SPARC_EBUS_H) */
/* * Program: Operating-system dependent routines -- SCO Unix version * * Author: Mark Crispin * Networks and Distributed Computing * Computing & Communications * University of Washington * Administration Building, AG-44 * Seattle, WA 98195 * Internet: MRC@CAC.Washington.EDU * * Date: 1 August 1988 * Last Edited: 10 April 2001 * * The IMAP toolkit provided in this Distribution is * Copyright 2001 University of Washington. * The full text of our legal notices is contained in the file called * CPYRIGHT, included with this Distribution. */ #include "tcp_unix.h" /* must be before osdep includes tcp.h */ #include <sys/time.h> /* must be before osdep.h */ #include "mail.h" #include <stdio.h> #include "osdep.h" #include <sys/stat.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <ctype.h> #include <errno.h> #include "misc.h" #define SecureWare /* protected subsystem */ #include <sys/security.h> #include <sys/audit.h> #include <prot.h> #include <pwd.h> char *bigcrypt (char *key,char *salt); #define DIR_SIZE(d) d->d_reclen #include "fs_unix.c" #include "ftl_unix.c" #include "nl_unix.c" #include "env_unix.c" #include "tcp_unix.c" #include "gr_waitp.c" #include "flocksim.c" #include "scandir.c" #include "tz_sv4.c" #include "gethstid.c" #include "fsync.c" #undef setpgrp #include "setpgrp.c" #include "rename.c" #include "utime.c"
/* * Copyright (C) 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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 SecurityOriginHash_h #define SecurityOriginHash_h #include "URL.h" #include "SecurityOrigin.h" #include <wtf/RefPtr.h> namespace WebCore { struct SecurityOriginHash { static unsigned hash(SecurityOrigin* origin) { unsigned hashCodes[3] = { origin->protocol().impl() ? origin->protocol().impl()->hash() : 0, origin->host().impl() ? origin->host().impl()->hash() : 0, origin->port() }; return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes); } static unsigned hash(const RefPtr<SecurityOrigin>& origin) { return hash(origin.get()); } static bool equal(SecurityOrigin* a, SecurityOrigin* b) { if (!a || !b) return a == b; return a->isSameSchemeHostPort(b); } static bool equal(SecurityOrigin* a, const RefPtr<SecurityOrigin>& b) { return equal(a, b.get()); } static bool equal(const RefPtr<SecurityOrigin>& a, SecurityOrigin* b) { return equal(a.get(), b); } static bool equal(const RefPtr<SecurityOrigin>& a, const RefPtr<SecurityOrigin>& b) { return equal(a.get(), b.get()); } static const bool safeToCompareToEmptyOrDeleted = false; }; } // namespace WebCore namespace WTF { template<typename> struct DefaultHash; template<> struct DefaultHash<RefPtr<WebCore::SecurityOrigin>> { typedef WebCore::SecurityOriginHash Hash; }; } // namespace WTF #endif // SecurityOriginHash_h
/* * Author: MontaVista Software, Inc. <source@mvista.com> * * 2007 (c) MontaVista Software, Inc. This file is licensed under * the terms of the GNU General Public License version 2. This program * is licensed "as is" without any warranty of any kind, whether express * or implied. */ #include <linux/init.h> #include <linux/mvl_patch.h> static __init int regpatch(void) { return mvl_register_patch(1251); } module_init(regpatch);
/****************************************************************************/ /* * mcfuart.h -- Texas Instruments UART support defines. * * (C) Copyright 2012 Max Nekludov <macscomp@gmail.com> */ /****************************************************************************/ #ifndef MACH_LM3S_UART_H #define MACH_LM3S_UART_H /****************************************************************************/ #include <linux/serial_core.h> #include <linux/platform_device.h> struct lm3s_platform_uart { unsigned long mapbase; /* Physical address base */ void __iomem *membase; /* Virtual address if mapped */ unsigned int irq; /* Interrupt vector */ uint32_t rcgc1_mask; /* Mask to enable/disable clock gate */ #ifdef CONFIG_LM3S_DMA uint32_t dma_rx_channel; uint32_t dma_tx_channel; void *dma_tx_buffer; void *dma_rx_buffer; uint32_t dma_buffer_size; #endif }; #endif /* MACH_LM3S_UART_H */
/* * QNX4 file system, Linux implementation. * * Version : 0.1 * * Using parts of the xiafs filesystem. * * History : * * 28-05-1998 by Richard Frowijn : first release. * 20-06-1998 by Frank Denis : basic optimisations. * 25-06-1998 by Frank Denis : qnx4_is_free, qnx4_set_bitmap, qnx4_bmap . * 28-06-1998 by Frank Denis : qnx4_free_inode (to be fixed) . */ #include <linux/config.h> #include <linux/sched.h> #include <linux/qnx4_fs.h> #include <linux/stat.h> #include <linux/kernel.h> #include <linux/string.h> #include <asm/bitops.h> int qnx4_new_block(struct super_block *sb) { return 0; } void count_bits(const register char *bmPart, register int size, int *const tf) { char b; int tot = *tf; if (size > QNX4_BLOCK_SIZE) { size = QNX4_BLOCK_SIZE; } do { b = *bmPart++; if ((b & 1) == 0) tot++; if ((b & 2) == 0) tot++; if ((b & 4) == 0) tot++; if ((b & 8) == 0) tot++; if ((b & 16) == 0) tot++; if ((b & 32) == 0) tot++; if ((b & 64) == 0) tot++; if ((b & 128) == 0) tot++; size--; } while (size != 0); *tf = tot; } unsigned long qnx4_count_free_blocks(struct super_block *sb) { int start = sb->u.qnx4_sb.BitMap->di_first_xtnt.xtnt_blk - 1; int total = 0; int total_free = 0; int offset = 0; int size = sb->u.qnx4_sb.BitMap->di_size; struct buffer_head *bh; while (total < size) { if ((bh = bread(sb->s_dev, start + offset, QNX4_BLOCK_SIZE)) == NULL) { printk("qnx4: I/O error in counting free blocks\n"); break; } count_bits(bh->b_data, size - total, &total_free); brelse(bh); total += QNX4_BLOCK_SIZE; } return total_free; } unsigned long qnx4_count_free_inodes(struct super_block *sb) { return qnx4_count_free_blocks(sb) * QNX4_INODES_PER_BLOCK; /* FIXME */ } int qnx4_is_free(struct super_block *sb, int block) { int start = sb->u.qnx4_sb.BitMap->di_first_xtnt.xtnt_blk - 1; int size = sb->u.qnx4_sb.BitMap->di_size; struct buffer_head *bh; const char *g; int ret = -EIO; start += block / (QNX4_BLOCK_SIZE * 8); QNX4DEBUG(("qnx4: is_free requesting block [%lu], bitmap in block [%lu]\n", (unsigned long) block, (unsigned long) start)); (void) size; /* CHECKME */ bh = bread(sb->s_dev, start, QNX4_BLOCK_SIZE); if (bh == NULL) { return -EIO; } g = bh->b_data + (block % QNX4_BLOCK_SIZE); if (((*g) & (1 << (block % 8))) == 0) { QNX4DEBUG(("qnx4: is_free -> block is free\n")); ret = 1; } else { QNX4DEBUG(("qnx4: is_free -> block is busy\n")); ret = 0; } brelse(bh); return ret; } int qnx4_bmap(struct inode *inode, int block) { QNX4DEBUG(("qnx4: bmap on block [%d]\n", block)); if (block < 0) { return 0; } return !qnx4_is_free(inode->i_sb, block); } #ifdef CONFIG_QNX4FS_RW int qnx4_set_bitmap(struct super_block *sb, int block, int busy) { int start = sb->u.qnx4_sb.BitMap->di_first_xtnt.xtnt_blk - 1; int size = sb->u.qnx4_sb.BitMap->di_size; struct buffer_head *bh; char *g; start += block / (QNX4_BLOCK_SIZE * 8); QNX4DEBUG(("qnx4: set_bitmap requesting block [%lu], bitmap in block [%lu]\n", (unsigned long) block, (unsigned long) start)); (void) size; /* CHECKME */ bh = bread(sb->s_dev, start, QNX4_BLOCK_SIZE); if (bh == NULL) { return -EIO; } g = bh->b_data + (block % QNX4_BLOCK_SIZE); if (busy == 0) { (*g) &= ~(1 << (block % 8)); } else { (*g) |= (1 << (block % 8)); } mark_buffer_dirty(bh, 1); brelse(bh); return 0; } static void qnx4_clear_inode(struct inode *inode) { struct qnx4_inode_info *qnx4_ino = &inode->u.qnx4_i; memset(qnx4_ino->i_reserved, 0, sizeof qnx4_ino->i_reserved); qnx4_ino->i_size = 0; qnx4_ino->i_num_xtnts = 0; qnx4_ino->i_mode = 0; qnx4_ino->i_status = 0; } void qnx4_free_inode(struct inode *inode) { if (!inode) { return; } if (!inode->i_dev) { printk("free_inode: inode has no device\n"); return; } if (inode->i_count > 1) { printk("free_inode: inode has count=%d\n", inode->i_count); return; } if (inode->i_nlink) { printk("free_inode: inode has nlink=%d\n", inode->i_nlink); return; } if (!inode->i_sb) { printk("free_inode: inode on nonexistent device\n"); return; } if (inode->i_ino < 1) { printk("free_inode: inode 0 or nonexistent inode\n"); return; } qnx4_clear_inode(inode); clear_inode(inode); } #endif
#ifdef HAVE_CONFIG_H #include <config.h> #endif #include "stubs.h" #ifdef __SUNPRO_C #pragma weak init_fs_handlers #endif weak int init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) { return Successful; }
/* * This file is part of the UCB release of Plan 9. It is subject to the license * terms in the LICENSE file found in the top-level directory of this * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No * part of the UCB release of Plan 9, including this file, may be copied, * modified, propagated, or distributed except according to the terms contained * in the LICENSE file. */ typedef struct Rawimage Rawimage; struct Rawimage { Rectangle r; uchar *cmap; int cmaplen; int nchans; uchar *chans[4]; int chandesc; int chanlen; int fields; /* defined by format */ int gifflags; /* gif only; graphics control extension flag word */ int gifdelay; /* gif only; graphics control extension delay in cs */ int giftrindex; /* gif only; graphics control extension transparency index */ int gifloopcount; /* number of times to loop in animation; 0 means forever */ }; enum { /* Channel descriptors */ CRGB = 0, /* three channels, no map */ CYCbCr = 1, /* three channels, no map, level-shifted 601 color space */ CY = 2, /* one channel, luminance */ CRGB1 = 3, /* one channel, map present */ CRGBV = 4, /* one channel, map is RGBV, understood */ CRGB24 = 5, /* one channel in correct data order for loadimage(RGB24) */ CRGBA32 = 6, /* one channel in correct data order for loadimage(RGBA32) */ CYA16 = 7, /* one channel in correct data order for loadimage(Grey8+Alpha8) */ CRGBVA16= 8, /* one channel in correct data order for loadimage(CMAP8+Alpha8) */ /* GIF flags */ TRANSP = 1, INPUT = 2, DISPMASK = 7<<2 }; enum{ /* PNG flags */ II_GAMMA = 1 << 0, II_COMMENT = 1 << 1, }; typedef struct ImageInfo { ulong fields_set; double gamma; char *comment; } ImageInfo; Rawimage** readjpg(int, int); Rawimage** Breadjpg(Biobuf *b, int); Rawimage** readpng(int, int); Rawimage** Breadpng(Biobuf *b, int); Rawimage** readgif(int, int); Rawimage** readpixmap(int, int); Rawimage* torgbv(Rawimage*, int); Rawimage* totruecolor(Rawimage*, int); int writerawimage(int, Rawimage*); void* _remaperror(char*, ...); typedef struct Memimage Memimage; /* avoid necessity to include memdraw.h */ char* startgif(Biobuf*, Image*, int); char* writegif(Biobuf*, Image*, char*, int, int); void endgif(Biobuf*); char* memstartgif(Biobuf*, Memimage*, int); char* memwritegif(Biobuf*, Memimage*, char*, int, int); void memendgif(Biobuf*); Image* onechan(Image*); Memimage* memonechan(Memimage*); char* writeppm(Biobuf*, Image*, char*); char* memwriteppm(Biobuf*, Memimage*, char*); Image* multichan(Image*); Memimage* memmultichan(Memimage*); char* memwritepng(Biobuf*, Memimage*, ImageInfo*);
/* * linux/arch/arm/mach-omap2/io.c * * OMAP2 I/O mapping code * * Copyright (C) 2005 Nokia Corporation * Author: Juha Yrjölä <juha.yrjola@nokia.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. */ #include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <asm/tlb.h> #include <asm/io.h> #include <asm/mach/map.h> #include <asm/arch/mux.h> #include <asm/arch/omapfb.h> extern void omap_sram_init(void); extern int omap2_clk_init(void); extern void omap2_check_revision(void); /* * The machine specific code may provide the extra mapping besides the * default mapping provided here. */ static struct map_desc omap2_io_desc[] __initdata = { { .virtual = L3_24XX_VIRT, .pfn = __phys_to_pfn(L3_24XX_PHYS), .length = L3_24XX_SIZE, .type = MT_DEVICE }, { .virtual = L4_24XX_VIRT, .pfn = __phys_to_pfn(L4_24XX_PHYS), .length = L4_24XX_SIZE, .type = MT_DEVICE } }; void __init omap2_map_common_io(void) { iotable_init(omap2_io_desc, ARRAY_SIZE(omap2_io_desc)); /* Normally devicemaps_init() would flush caches and tlb after * mdesc->map_io(), but we must also do it here because of the CPU * revision check below. */ local_flush_tlb_all(); flush_cache_all(); omap2_check_revision(); omap_sram_init(); omapfb_reserve_mem(); } void __init omap2_init_common_hw(void) { omap2_mux_init(); omap2_clk_init(); }
/* * $Id: case_prio.h,v 1.1 2003/08/05 11:13:01 bogdan Exp $ * * Priority Header Field Name Parsing Macros * * Copyright (C) 2001-2003 Fhg Fokus * * This file is part of ser, a free SIP server. * * ser 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 * * For a license to use the ser software under conditions * other than those described here, or to purchase support for this * software, please contact iptel.org by e-mail at the following addresses: * info@iptel.org * * ser 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 CASE_PRIO_H #define CASE_PRIO_H #define rity_CASE \ if (LOWER_DWORD(val) == _rity_) { \ hdr->type = HDR_PRIORITY; \ p += 4; \ goto dc_end; \ } \ #define prio_CASE \ p += 4; \ val = READ(p); \ rity_CASE; \ goto other; #endif /* CASE_PRIO_H */
/* * Definitions for ADB (Apple Desktop Bus) support. */ #ifndef __ADB_H #define __ADB_H /* ADB commands */ #define ADB_BUSRESET 0 #define ADB_FLUSH(id) (0x01 | ((id) << 4)) #define ADB_WRITEREG(id, reg) (0x08 | (reg) | ((id) << 4)) #define ADB_READREG(id, reg) (0x0C | (reg) | ((id) << 4)) /* ADB default device IDs (upper 4 bits of ADB command byte) */ #define ADB_DONGLE 1 /* "software execution control" devices */ #define ADB_KEYBOARD 2 #define ADB_MOUSE 3 #define ADB_TABLET 4 #define ADB_MODEM 5 #define ADB_MISC 7 /* maybe a monitor */ #define ADB_RET_OK 0 #define ADB_RET_TIMEOUT 3 /* The kind of ADB request. The controller may emulate some or all of those CUDA/PMU packet kinds */ #define ADB_PACKET 0 #define CUDA_PACKET 1 #define ERROR_PACKET 2 #define TIMER_PACKET 3 #define POWER_PACKET 4 #define MACIIC_PACKET 5 #define PMU_PACKET 6 #define ADB_QUERY 7 /* ADB queries */ /* ADB_QUERY_GETDEVINFO * Query ADB slot for device presence * data[2] = id, rep[0] = orig addr, rep[1] = handler_id */ #define ADB_QUERY_GETDEVINFO 1 #endif /* __ADB_H */
/* * upsat-comms-software: Communication Subsystem Software for UPSat satellite * * Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef INC_STATUS_H_ #define INC_STATUS_H_ enum { COMMS_STATUS_DMA_ERROR = -9, COMMS_STATUS_RF_OFF = -8, COMMS_STATUS_RF_SWITCH_CMD = -7, COMMS_STATUS_RXFIFO_ERROR = -6, COMMS_STATUS_INVALID_FRAME = -5, COMMS_STATUS_TIMEOUT = -4, COMMS_STATUS_NO_DATA = -3, COMMS_STATUS_BUFFER_OVERFLOW = -2, COMMS_STATUS_BUFFER_UNDERFLOW = -1, COMMS_STATUS_OK = 0, }; #endif /* INC_STATUS_H_ */
/* file device */ #include "fb.h" static FB_FILE_HOOKS hooks_dev_cons = { fb_DevFileEof, fb_DevStdIoClose, NULL, NULL, fb_DevFileRead, fb_DevFileReadWstr, fb_DevFileWrite, fb_DevFileWriteWstr, NULL, NULL, fb_DevFileReadLine, fb_DevFileReadLineWstr }; int fb_DevConsOpen( FB_FILE *handle, const char *filename, size_t filename_len ) { switch ( handle->mode ) { case FB_FILE_MODE_INPUT: case FB_FILE_MODE_OUTPUT: case FB_FILE_MODE_APPEND: break; default: return fb_ErrorSetNum( FB_RTERROR_ILLEGALFUNCTIONCALL ); } FB_LOCK(); handle->hooks = &hooks_dev_cons; if ( handle->access == FB_FILE_ACCESS_ANY) handle->access = FB_FILE_ACCESS_WRITE; handle->opaque = (handle->mode == FB_FILE_MODE_INPUT? stdin : stdout); handle->type = FB_FILE_TYPE_PIPE; FB_UNLOCK(); return fb_ErrorSetNum( FB_RTERROR_OK ); }
/* * utils.h * * Created on: Jul 31, 2016 * Author: chris */ #ifndef INCLUDE_UTILS_H_ #define INCLUDE_UTILS_H_ #include <int.h> #include <string.h> #include <memory.h> using namespace feta; inline void cli() { asm("cli"); } inline void sti() { asm("sti"); } inline void hlt() { asm("hlt"); } int array_length_char(char a[]); void* memcpy(uint8* dst, const uint8* src, size len); String dynamicString(String string); // Write len copies of val into dest. void memset(uint8* dest, uint8 val, size len); int memcmp(const void* s1, const void* s2, size len); uint8 setBit(uint8 number, uint8 pos); uint8 clearBit(uint8 number, uint8 pos); uint8 toggleBit(uint8 number, uint8 pos); uint8 getBit(uint8 number, uint8 pos); uint8 changeBit(uint8 number, uint8 pos, uint8 value); uint64 merge(uint32 mostSignificant, uint32 leastSignificant); int rand(); int random(int min, int max); #endif /* INCLUDE_UTILS_H_ */
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #pragma once #include <QtGlobal> #if defined(FLAMEGRAPH_LIBRARY) # define FLAMEGRAPH_EXPORT Q_DECL_EXPORT #else # define FLAMEGRAPH_EXPORT Q_DECL_IMPORT #endif
#ifndef MI_INCLUDE_RISEN_H_INCLUDED #define MI_INCLUDE_RISEN_H_INCLUDED #include "mi_include_map.h" #include "mi_include_streams.h" #include "mi_risenname.h" #include "mi_risendoc.h" #include "mi_risendocparser.h" #endif
/* Copyright 2009-2014 Barrett Technology <support@barrett.com> This file is part of libbarrett. This version of libbarrett is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This version of libbarrett 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 version of libbarrett. If not, see <http://www.gnu.org/licenses/>. */ /** Includes all members of the barrett::math namespace. * * @file math.h * @date Dec 23, 2009 * @author Dan Cody * @see barrett::math */ /** @namespace barrett::math * * Provides an interface to linear-algebra libraries and implementations of * basic robot control algorithms. */ #ifndef BARRETT_MATH_H_ #define BARRETT_MATH_H_ #include <barrett/math/matrix.h> #include <barrett/math/utils.h> #include <barrett/math/first_order_filter.h> #include <barrett/math/spline.h> #include <barrett/math/trapezoidal_velocity_profile.h> #include <barrett/math/kinematics.h> #include <barrett/math/dynamics.h> #endif /* BARRETT_MATH_H_ */
/* * Matrix.h * * Created on: 31 Mar 2015 * Author: David */ #ifndef MATRIX_H_ #define MATRIX_H_ #include <cstddef> // for size_t // Base class for matrices, allows us to write functions that work with any size matrix template<class T> class MathMatrix { public: virtual size_t rows() const = 0; virtual size_t cols() const = 0; virtual T& operator() (size_t r, size_t c) = 0; virtual const T& operator() (size_t r, size_t c) const = 0; virtual ~MathMatrix() { } // to keep Eclipse code analysis happy }; // Fixed size matrix class template<class T, size_t ROWS, size_t COLS> class FixedMatrix : public MathMatrix<T> { public: size_t rows() const override { return ROWS; } size_t cols() const override { return COLS; } // Indexing operator, non-const version T& operator() (size_t r, size_t c) override pre(r < ROWS; c < COLS) { return data[r * COLS + c]; } // Indexing operator, const version const T& operator() (size_t r, size_t c) const override pre(r < ROWS; c < COLS) { return data[r * COLS + c]; } void SwapRows(size_t i, size_t j, size_t numCols = COLS) pre(i < ROWS; j < ROWS) ; void GaussJordan(T *solution, size_t numRows) pre(numRows <= ROWS; numRows + 1 <= COLS) ; // Return a pointer to a specified row, non-const version T* GetRow(size_t r) pre(r < ROWS) { return data + (r * COLS); } // Return a pointer to a specified row, const version const T* GetRow(size_t r) const pre(r < ROWS) { return data + (r * COLS); } private: T data[ROWS * COLS]; }; // Swap 2 rows of a matrix template<class T, size_t ROWS, size_t COLS> inline void FixedMatrix<T, ROWS, COLS>::SwapRows(size_t i, size_t j, size_t numCols) { if (i != j) { for (size_t k = i; k < numCols; ++k) { T temp = (*this)(i, k); (*this)(i, k) = (*this)(j, k); (*this)(j, k) = temp; } } } // Perform Gauss-Jordan elimination on a N x (N+1) matrix. // Returns a pointer to the solution vector. template<class T, size_t ROWS, size_t COLS> void FixedMatrix<T, ROWS, COLS>::GaussJordan(T *solution, size_t numRows) { for (size_t i = 0; i < numRows; ++i) { // Swap the rows around for stable Gauss-Jordan elimination float vmax = fabsf((*this)(i, i)); for (size_t j = i + 1; j < numRows; ++j) { const float rmax = fabsf((*this)(j, i)); if (rmax > vmax) { SwapRows(i, j); vmax = rmax; } } // Use row i to eliminate the ith element from previous and subsequent rows T v = (*this)(i, i); for (size_t j = 0; j < i; ++j) { T factor = (*this)(j, i)/v; (*this)(j, i) = 0.0; for (size_t k = i + 1; k <= numRows; ++k) { (*this)(j, k) -= (*this)(i, k) * factor; } } for (size_t j = i + 1; j < numRows; ++j) { T factor = (*this)(j, i)/v; (*this)(j, i) = 0.0; for (size_t k = i + 1; k <= numRows; ++k) { (*this)(j, k) -= (*this)(i, k) * factor; } } } for (size_t i = 0; i < numRows; ++i) { solution[i] = (*this)(i, numRows) / (*this)(i, i); } } #endif /* MATRIX_H_ */
/* * @brief LPC17xx/40xx RTC chip driver * * @note * Copyright(C) NXP Semiconductors, 2012 * All rights reserved. * * @par * Software that is described herein is for illustrative purposes only * which provides customers with programming information regarding the * LPC products. This software is supplied "AS IS" without any warranties of * any kind, and NXP Semiconductors and its licensor disclaim any and * all warranties, express or implied, including all implied warranties of * merchantability, fitness for a particular purpose and non-infringement of * intellectual property rights. NXP Semiconductors assumes no responsibility * or liability for the use of the software, conveys no license or rights under any * patent, copyright, mask work right, or any other intellectual property rights in * or to any products. NXP Semiconductors reserves the right to make changes * in the software without notification. NXP Semiconductors also makes no * representation or warranty that such application will be suitable for the * specified use without further testing or modification. * * @par * Permission to use, copy, modify, and distribute this software and its * documentation is hereby granted, under NXP Semiconductors' and its * licensor's relevant copyrights 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. */ #include "chip.h" /***************************************************************************** * Private types/enumerations/variables ****************************************************************************/ /***************************************************************************** * Public types/enumerations/variables ****************************************************************************/ /***************************************************************************** * Private functions ****************************************************************************/ /***************************************************************************** * Public functions ****************************************************************************/ /* Initialize the RTC peripheral */ void Chip_RTC_Init(LPC_RTC_T *pRTC) { Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_RTC); IP_RTC_Init(pRTC); } /** * @brief De-initialize the RTC peripheral * @return None */ void Chip_RTC_DeInit(LPC_RTC_T *pRTC) { IP_RTC_DeInit(pRTC); Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_RTC); }