text
stringlengths
4
6.14k
///////////////////////////////////////////////////////////////////////////// // Name: splash.h // Purpose: Splash screen class // Author: Julian Smart // Modified by: // Created: 28/6/2000 // RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SPLASH_H_ #define _WX_SPLASH_H_ #include "wx/bitmap.h" #include "wx/timer.h" #include "wx/frame.h" /* * A window for displaying a splash screen */ #define wxSPLASH_CENTRE_ON_PARENT 0x01 #define wxSPLASH_CENTRE_ON_SCREEN 0x02 #define wxSPLASH_NO_CENTRE 0x00 #define wxSPLASH_TIMEOUT 0x04 #define wxSPLASH_NO_TIMEOUT 0x00 class WXDLLIMPEXP_FWD_ADV wxSplashScreenWindow; /* * wxSplashScreen */ class WXDLLIMPEXP_ADV wxSplashScreen: public wxFrame { public: // for RTTI macros only wxSplashScreen() {} wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP); virtual ~wxSplashScreen(); void OnCloseWindow(wxCloseEvent& event); void OnNotify(wxTimerEvent& event); long GetSplashStyle() const { return m_splashStyle; } wxSplashScreenWindow* GetSplashWindow() const { return m_window; } int GetTimeout() const { return m_milliseconds; } protected: wxSplashScreenWindow* m_window; long m_splashStyle; int m_milliseconds; wxTimer m_timer; DECLARE_DYNAMIC_CLASS(wxSplashScreen) DECLARE_EVENT_TABLE() wxDECLARE_NO_COPY_CLASS(wxSplashScreen); }; /* * wxSplashScreenWindow */ class WXDLLIMPEXP_ADV wxSplashScreenWindow: public wxWindow { public: wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER); void OnPaint(wxPaintEvent& event); void OnEraseBackground(wxEraseEvent& event); void OnMouseEvent(wxMouseEvent& event); void OnChar(wxKeyEvent& event); void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } wxBitmap& GetBitmap() { return m_bitmap; } protected: wxBitmap m_bitmap; DECLARE_EVENT_TABLE() wxDECLARE_NO_COPY_CLASS(wxSplashScreenWindow); }; #endif // _WX_SPLASH_H_
typedef NS_ENUM(NSInteger, ARFavoritesDisplayMode) { ARFavoritesDisplayModeArtworks, ARFavoritesDisplayModeArtists, ARFavoritesDisplayModeGenes }; @interface ARFavoritesViewController : UIViewController @property (nonatomic, assign, readwrite) ARFavoritesDisplayMode displayMode; @end
#ifndef PSTR_HELPER_H #define PSTR_HELPER_H #include <avr/pgmspace.h> // Modified PSTR that pushes string into a char* buffer for easy use. // // There is only one buffer so this will cause problems if you need to pass two // strings to one function. #define PSTR2(x) PSTRtoBuffer_P(PSTR(x)) #define PSTR2_BUFFER_SIZE 48 // May need adjusted depending on your needs. char *PSTRtoBuffer_P(PGM_P str); #endif
/* Arlo Calibrate.c Calibrate the Arlo's motors and encoders */ #include "simpletools.h" #include "arlocalibrate.h" int main() { high(26); high(27); cal_arlo(); low(26); low(27); }
#ifndef GRAPH_H #define GRAPH_H #include <QMap> #include <QPixmap> #include <QVector> #include <QWidget> class QToolButton; class Graph : public QWidget { Q_OBJECT public: Graph(QWidget *parent = 0); protected: void paintEvent(QPaintEvent* event); private: void refreshPixmap(); void drawGrid(QPainter* painter); void drawCurves(QPainter* painter); enum { Margin = 30 }; QPixmap pixmap; QVector<QPoint> pointStorage_0; QVector<QPoint> pointStorage_1; bool rubberBandIsShown; QRect rubberBandRect; QTimer* timer; //mapper variable int axsTime_0, axsTime_1, axsValue_0, axsValue_1; private slots: void startCount(); void curveMapper(); }; #endif // GRAPH_H
/** * \file * \brief XDR implementation using LWIP PBuf structures * * Uses standard XDR structure. Private fields in XDR are used as follows: * * x_private points to the first struct pbuf in a pbuf chain * * x_base points to the current struct pbuf in a pbuf chain * * x_handy is the position (offset) _within the current pbuf_ */ /* * Copyright (c) 2008, ETH Zurich. * All rights reserved. * * This file is distributed under the terms in the attached LICENSE file. * If you do not find this file, copies can be found by writing to: * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. */ #include <assert.h> #include <nfs/xdr.h> #include "xdr_pbuf.h" #include <net_sockets/net_sockets.h> /* make space within the buffer, returns NULL if it won't fit */ static inline int32_t *make_space(XDR *xdr, size_t size) { if (xdr->x_handy + size > xdr->size) { fprintf(stderr, "xdr_pbuf: make_space(%zu) failing (%zu available)\n", size, xdr->size - (size_t)xdr->x_handy); return NULL; } else { int32_t *ret = (int32_t *)((char *)xdr->x_base + xdr->x_handy); xdr->x_handy += size; return ret; } } /* get a word from underlying stream */ static bool xdr_pbuf_getint32(XDR *xdr, int32_t *ret) { int32_t *buf = make_space(xdr, sizeof(int32_t)); if (buf) { *ret = ntohl((uint32_t)*buf); return true; } else { return false; } } /* put a word to underlying stream */ static bool xdr_pbuf_putint32(XDR *xdr, const int32_t *val) { int32_t *buf = make_space(xdr, sizeof(int32_t)); if (buf) { *buf = htonl((uint32_t)(*val)); return true; } else { return false; } } /* common implementation of getbytes and putbytes */ static bool movebytes(bool copyin, XDR *xdr, char *callerbuf, size_t nbytes) { while (nbytes > 0) { size_t space = xdr->size - xdr->x_handy; if (space > nbytes) { space = nbytes; } int32_t *buf = make_space(xdr, space); assert(buf != NULL); if (copyin) { memcpy(buf, callerbuf, space); } else { memcpy(callerbuf, buf, space); } nbytes -= space; callerbuf += space; } return true; } /* get some bytes from underlying stream */ static bool xdr_pbuf_getbytes(XDR *xdr, char *retbuf, size_t nbytes) { return movebytes(false, xdr, retbuf, nbytes); } /* put some bytes to underlying stream */ static bool xdr_pbuf_putbytes(XDR *xdr, const char *inbuf, size_t nbytes) { return movebytes(true, xdr, (char *)inbuf, nbytes); } /* returns bytes off from beginning */ static size_t xdr_pbuf_getpostn(XDR *xdr) { return xdr->x_handy; } /* lets you reposition the stream */ static bool xdr_pbuf_setpostn(XDR *xdr, size_t pos) { if (pos > xdr->size) { return false; } else { xdr->x_base = xdr->x_private; xdr->x_handy = pos; return true; } } /* buf quick ptr to buffered data */ static int32_t *xdr_pbuf_inline(XDR *xdr, size_t nbytes) { assert(nbytes % BYTES_PER_XDR_UNIT == 0); return make_space(xdr, nbytes); } /* free privates of this xdr_stream */ static void xdr_pbuf_destroy(XDR *xdr) { net_free(xdr->x_private); } /// XDR operations table static struct xdr_ops xdr_pbuf_ops = { .x_getint32 = xdr_pbuf_getint32, .x_putint32 = xdr_pbuf_putint32, .x_getbytes = xdr_pbuf_getbytes, .x_putbytes = xdr_pbuf_putbytes, .x_getpostn = xdr_pbuf_getpostn, .x_setpostn = xdr_pbuf_setpostn, .x_inline = xdr_pbuf_inline, .x_destroy = xdr_pbuf_destroy, }; /** * \brief Create XDR and allocate PBUF for serialising data * * \param xdr Memory for XDR struct, to be initialised * \param size Size of pbuf buffers to allocate * * \returns True on success, false on error */ bool xdr_create_send(XDR *xdr, size_t size) { assert(xdr != NULL); assert(size % BYTES_PER_XDR_UNIT == 0); xdr->x_base = xdr->x_private = net_alloc(size); xdr->size = size; assert(xdr->x_private); xdr->x_op = XDR_ENCODE; xdr->x_ops = &xdr_pbuf_ops; xdr->x_handy = 0; return true; } /** * \brief Create XDR for deserialising data in given PBUF * * \param xdr Memory for XDR struct, to be initialised * \param pbuf LWIP packet buffer pointer * * \returns True on success, false on error */ void xdr_create_recv(XDR *xdr, void *data, size_t size) { assert(xdr != NULL); assert(size % BYTES_PER_XDR_UNIT == 0); xdr->x_base = xdr->x_private = data; xdr->size = size; assert(xdr->x_private); memcpy(xdr->x_private, data, size); xdr->x_op = XDR_DECODE; xdr->x_ops = &xdr_pbuf_ops; xdr->x_handy = 0; }
// // TweetSendTextCell.h // Coding_iOS // // Created by 王 原闯 on 14-9-9. // Copyright (c) 2014年 Coding. All rights reserved. // #import <UIKit/UIKit.h> #import "UIPlaceHolderTextView.h" #import "Users.h" #import "AGEmojiKeyBoardView.h" @interface TweetSendTextCell : UITableViewCell<UITextViewDelegate> @property (strong, nonatomic) UIPlaceHolderTextView *tweetContentView; @property (nonatomic,copy) void(^textValueChangedBlock)(NSString*); @property (nonatomic,copy) void(^atSomeoneBlock)(UITextView *tweetContentView); + (CGFloat)cellHeight; @end
/* This file is part of Mitsuba, a physically based rendering system. Copyright (c) 2007-2014 by Wenzel Jakob and others. Mitsuba is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation. Mitsuba is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #if !defined(__MITSUBA_RENDER_UTIL_H_) #define __MITSUBA_RENDER_UTIL_H_ #include <mitsuba/render/scene.h> MTS_NAMESPACE_BEGIN /** \brief Abstract utility class -- can be used to implement * loadable utility plugins that perform various actions. They * can be started using the 'mtsutil' launcher. * \ingroup librender */ class MTS_EXPORT_RENDER Utility : public Object { public: /** * Run the utility. The supplied <tt>argc</tt> * and <tt>argv</tt> parameters contain any * extra arguments passed to mtsutil. The value * returned here will be used as the return value of the * 'mtsutil' process. */ virtual int run(int argc, char **argv) = 0; MTS_DECLARE_CLASS() protected: typedef std::map<std::string, std::string, SimpleStringOrdering> ParameterMap; /// Virtual destructor virtual ~Utility() { } /// Load a scene from an external file ref<Scene> loadScene(const fs::path &fname, const ParameterMap &params= ParameterMap()); /// Load a scene from a string ref<Scene> loadSceneFromString(const std::string &content, const ParameterMap &params= ParameterMap()); }; #define MTS_DECLARE_UTILITY() \ MTS_DECLARE_CLASS() #define MTS_EXPORT_UTILITY(name, descr) \ MTS_IMPLEMENT_CLASS(name, false, Utility) \ extern "C" { \ void MTS_EXPORT *CreateUtility() { \ return new name(); \ } \ const char MTS_EXPORT *GetDescription() { \ return descr; \ } \ } MTS_NAMESPACE_END #endif /* __MITSUBA_RENDER_UTIL_H_ */
// // KSDate.c // // Copyright 2016 Karl Stenerud. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall remain in place // in this source code. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #include "KSDate.h" #include <stdio.h> #include <time.h> void ksdate_utcStringFromTimestamp(time_t timestamp, char* buffer21Chars) { struct tm result = {0}; gmtime_r(&timestamp, &result); snprintf(buffer21Chars, 21, "%04d-%02d-%02dT%02d:%02d:%02dZ", result.tm_year + 1900, result.tm_mon+1, result.tm_mday, result.tm_hour, result.tm_min, result.tm_sec); }
#pragma once #include <string> #include <list> #include <include/dll_export.h> #include <include/glm.h> #include <include/gl_defines.h> #ifdef OPENGL_ES class GLESContext; #endif class ObjectInput; class DLLExport WindowProperties { public: struct GLContext { int major = 3; int minor = 3; }; public: WindowProperties(bool shareContext = true); bool IsSharedContext() const; public: std::string name; glm::ivec2 resolution; glm::ivec2 position; glm::ivec2 cursorPos; float aspectRatio; bool resizable; bool visible; bool fullScreen; bool centered; bool hideOnClose; bool vSync; GLContext glContext; private: const bool sharedContext; }; /* * Class WindowObject */ class DLLExport WindowObject { friend class WindowManager; friend class InputSystem; friend class ObjectInput; public: WindowObject(WindowProperties properties); ~WindowObject(); void Show(); void Hide(); void Close(); int ShouldClose() const; void ShowPointer(); void CenterPointer(); void SetPointerPosition(int mousePosX, int mousePosY); void HidePointer(); void DisablePointer(); void SetWindowPosition(glm::ivec2 position); void CenterWindow(); void SwapBuffers() const; void SetVSync(bool state); bool ToggleVSync(); void MakeCurrentContext() const; void UseNativeHandles(bool value); // Window Information void SetSize(int width, int height); glm::ivec2 GetResolution() const; // OpenGL State GLFWwindow* GetGLFWWindow() const; // Window Event void PollEvents() const; // Get Input State bool KeyHold(int keyCode) const; bool MouseHold(int button) const; int GetSpecialKeyState() const; // Event Dispatch - TODO - should be protected void UpdateObservers(); protected: // Frame time void ComputeFrameTime(); // Window Creation void InitWindow(); void FullScreen(); void WindowMode(); // Subscribe to receive input events void Subscribe(ObjectInput * IC); // Input Processing void KeyCallback(int key, int scanCode, int action, int mods); void MouseButtonCallback(int button, int action, int mods); void MouseMove(int posX, int posY); void MouseScroll(double offsetX, double offsetY); private: void SetWindowCallbacks(); public: WindowProperties props; GLFWwindow* window; // Native handles void *openglHandle; void *nativeRenderingContext; private: // Frame Time unsigned int frameID; double elapsedTime; double deltaFrameTime; bool useNativeHandles; #ifdef OPENGL_ES GLESContext *eglContext; #endif bool allowedControl; bool hiddenPointer; bool cursorClip; // Mouse button callback int mouseButtonCallback; // Bit field for button callback int mouseButtonAction; // Bit field for button state int mouseButtonStates; // Bit field for mouse button state // Mouse move event bool mouseMoved; int mouseDeltaX; int mouseDeltaY; bool scrollEvent; double scrollOffsetX; double scrollOffsetY; // States for keyboard buttons - PRESSED(true) / RELEASED(false) int registeredKeyEvents; int keyEvents[128]; bool keyStates[384]; // Platform specific key codes - PRESSED(true) / RELEASED(false) bool keyScanCode[512]; // Special keys (ALT, CTRL, SHIFT, CAPS LOOK, OS KEY) active alongside with normal key or mouse input int keyMods; // Input Observers std::list<ObjectInput*> observers; };
/* * Copyright © 2006 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (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 NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: * Xiang Haihao <haihao.xiang@intel.com> * */ #ifndef _I965_RENDER_H_ #define _I965_RENDER_H_ #define MAX_SAMPLERS 16 #define MAX_RENDER_SURFACES (MAX_SAMPLERS + 1) #define NUM_RENDER_KERNEL 3 #include "i965_post_processing.h" struct i965_kernel; struct i965_render_state { struct { dri_bo *vertex_buffer; } vb; struct { dri_bo *state; } vs; struct { dri_bo *state; } sf; struct { int sampler_count; dri_bo *sampler; dri_bo *state; dri_bo *surface_state_binding_table_bo; } wm; struct { dri_bo *state; dri_bo *viewport; dri_bo *blend; dri_bo *depth_stencil; } cc; struct { dri_bo *bo; } curbe; unsigned short interleaved_uv; unsigned short inited; struct intel_region *draw_region; int pp_flag; /* 0: disable, 1: enable */ struct i965_kernel render_kernels[3]; int max_wm_threads; }; Bool i965_render_init(VADriverContextP ctx); Bool i965_render_terminate(VADriverContextP ctx); void intel_render_put_surface( VADriverContextP ctx, VASurfaceID surface, const VARectangle *src_rect, const VARectangle *dst_rect, unsigned int flags ); void intel_render_put_subpicture( VADriverContextP ctx, VASurfaceID surface, const VARectangle *src_rect, const VARectangle *dst_rect ); struct gen7_surface_state; void gen7_render_set_surface_scs(struct gen7_surface_state *ss); #endif /* _I965_RENDER_H_ */
#ifndef URG_SERIAL_UTILS_H #define URG_SERIAL_UTILS_H /*! \file \brief ƒVƒŠƒAƒ‹—p‚̕⏕ŠÖ” \author Satofumi KAMIMURA $Id: urg_serial_utils.h,v acb362e60f78 2014/09/10 05:36:24 jun $ */ #ifdef __cplusplus extern "C" { #endif //! ƒVƒŠƒAƒ‹ƒ|[ƒg‚ðŒŸõ‚·‚é extern int urg_serial_find_port(void); //! ŒŸõ‚µ‚½ƒVƒŠƒAƒ‹ƒ|[ƒg–¼‚ð•Ô‚· extern const char *urg_serial_port_name(int index); /*! \brief ƒ|[ƒg‚ª URG ‚©‚Ç‚¤‚© \retval 1 URG ‚̃|[ƒg \retval 0 •s–¾ \retval <0 ƒGƒ‰[ */ extern int urg_serial_is_urg_port(int index); #ifdef __cplusplus } #endif #endif /* !URG_SERIAL_UTILS_H */
#include "jtest.h" #include "basic_math_test_data.h" #include "arr_desc.h" #include "arm_math.h" /* FUTs */ #include "ref.h" /* Reference Functions */ #include "test_templates.h" #include "basic_math_templates.h" #include "type_abbrev.h" #define JTEST_ARM_DOT_PROD_TEST(suffix) \ BASIC_MATH_DEFINE_TEST_TEMPLATE_BUF2_BLK( \ dot_prod, \ suffix, \ TYPE_FROM_ABBREV(suffix), \ TYPE_FROM_ABBREV(suffix), \ BASIC_MATH_SNR_ELT1_COMPARE_INTERFACE) JTEST_ARM_DOT_PROD_TEST(f32); JTEST_ARM_DOT_PROD_TEST(q31); JTEST_ARM_DOT_PROD_TEST(q15); JTEST_ARM_DOT_PROD_TEST(q7); /*--------------------------------------------------------------------------------*/ /* Collect all tests in a group. */ /*--------------------------------------------------------------------------------*/ JTEST_DEFINE_GROUP(dot_prod_tests) { JTEST_TEST_CALL(arm_dot_prod_f32_test); JTEST_TEST_CALL(arm_dot_prod_q31_test); JTEST_TEST_CALL(arm_dot_prod_q15_test); JTEST_TEST_CALL(arm_dot_prod_q7_test); }
// To check if a library is compiled with CocoaPods you // can use the `COCOAPODS` macro definition which is // defined in the xcconfigs so it is available in // headers also when they are imported in the client // project. // WSURLBuilder #define COCOAPODS_POD_AVAILABLE_WSURLBuilder #define COCOAPODS_VERSION_MAJOR_WSURLBuilder 0 #define COCOAPODS_VERSION_MINOR_WSURLBuilder 1 #define COCOAPODS_VERSION_PATCH_WSURLBuilder 0
/* * Copyright © 2015 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (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 NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** @file kms_vblank.c * * This is a test of performance of drmWaitVblank. */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> #include <time.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/wait.h> #include <drm.h> #include <xf86drm.h> #include "drmtest.h" static double elapsed(const struct timespec *start, const struct timespec *end, int loop) { return (1e6*(end->tv_sec - start->tv_sec) + (end->tv_nsec - start->tv_nsec)/1000)/loop; } static int crtc0_active(int fd) { union drm_wait_vblank vbl; memset(&vbl, 0, sizeof(vbl)); vbl.request.type = DRM_VBLANK_RELATIVE; return drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl) == 0; } static void vblank_query(int fd, int busy) { union drm_wait_vblank vbl; struct timespec start, end; unsigned long seq, count = 0; struct drm_event_vblank event; memset(&vbl, 0, sizeof(vbl)); if (busy) { vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT; vbl.request.sequence = 120 + 12; drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl); } vbl.request.type = DRM_VBLANK_RELATIVE; vbl.request.sequence = 0; drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl); seq = vbl.reply.sequence; clock_gettime(CLOCK_MONOTONIC, &start); do { vbl.request.type = DRM_VBLANK_RELATIVE; vbl.request.sequence = 0; drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl); count++; } while ((vbl.reply.sequence - seq) <= 120); clock_gettime(CLOCK_MONOTONIC, &end); printf("%f\n", 1e6/elapsed(&start, &end, count)); if (busy) read(fd, &event, sizeof(event)); } static void vblank_event(int fd, int busy) { union drm_wait_vblank vbl; struct timespec start, end; unsigned long seq, count = 0; struct drm_event_vblank event; memset(&vbl, 0, sizeof(vbl)); if (busy) { vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT; vbl.request.sequence = 120 + 12; drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl); } vbl.request.type = DRM_VBLANK_RELATIVE; vbl.request.sequence = 0; drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl); seq = vbl.reply.sequence; clock_gettime(CLOCK_MONOTONIC, &start); do { vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT; vbl.request.sequence = 0; drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl); read(fd, &event, sizeof(event)); count++; } while ((event.sequence - seq) <= 120); clock_gettime(CLOCK_MONOTONIC, &end); printf("%f\n", 1e6/elapsed(&start, &end, count)); if (busy) read(fd, &event, sizeof(event)); } int main(int argc, char **argv) { int fd, c; int busy = 0, loops = 5; enum what { EVENTS, QUERIES } what = EVENTS; while ((c = getopt (argc, argv, "b:w:r:")) != -1) { switch (c) { case 'b': if (strcmp(optarg, "busy") == 0) busy = 1; else if (strcmp(optarg, "idle") == 0) busy = 0; else abort(); break; case 'w': if (strcmp(optarg, "event") == 0) what = EVENTS; else if (strcmp(optarg, "query") == 0) what = QUERIES; else abort(); break; case 'r': loops = atoi(optarg); if (loops < 1) loops = 1; } } fd = drm_open_any(); if (!crtc0_active(fd)) { fprintf(stderr, "CRTC/pipe 0 not active\n"); return 77; } while (loops--) { switch (what) { case EVENTS: vblank_event(fd, busy); break; case QUERIES: vblank_query(fd, busy); break; } } return 0; }
// // CGCardMatchingGame.h // Matchismo // // Created by Jobert Sá on 4/9/14. // Copyright (c) 2014 http://codespark.co <*> codespark. All rights reserved. // #import <Foundation/Foundation.h> #import "CGDeck.h" #import "CGCard.h" @interface CGCardMatchingGame : NSObject // designated initializer - (instancetype)initWithCardCount:(NSUInteger)count usingDeck:(CGDeck *)deck; - (void)chooseCardAtIndex:(NSUInteger)index; - (CGCard *)cardAtIndex:(NSUInteger)index; @property (nonatomic, readonly) NSInteger pointsForCurrentMove; @property (nonatomic, readonly) NSInteger score; //@property (nonatomic, readonly) NSString * result /* * 2 for 2-card match * 3 for 3-card match * Other values will be ignored */ @property (nonatomic) NSUInteger matchMode; @end
/******************************************************************************* * Project: libopencad * Purpose: OpenSource CAD formats support library * Author: Alexandr Borzykh, mush3d at gmail.com * Author: Dmitry Baryshnikov, bishop.dev@gmail.com * Language: C++ ******************************************************************************* * The MIT License (MIT) * * Copyright (c) 2016 Alexandr Borzykh * Copyright (c) 2016 NextGIS, <info@nextgis.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. *******************************************************************************/ #ifndef CADCLASSES_H #define CADCLASSES_H #include "opencad.h" #include <vector> #include <string> using namespace std; typedef struct _class { _class() : sCppClassName(""), sApplicationName(""), sDXFRecordName(""), dProxyCapFlag(0), dInstanceCount(0), bWasZombie(false), bIsEntity(false), dClassNum(0), dClassVersion(0) { } string sCppClassName; /**< TV, C++ class name */ string sApplicationName; /**< TV, Application name */ string sDXFRecordName; /**< TV, Class DXF record name */ int dProxyCapFlag; /**< BITSHORT, Proxy capabilities flag, 90 */ unsigned short dInstanceCount; /**< BITSHORT, Instance count for a custom class, 91 */ bool bWasZombie; /**< BIT, Was-a-proxy flag, 280*/ bool bIsEntity; /**< BITSHORT, Is-an-entity flag, 281 */ short dClassNum; // BITSHORT short dClassVersion; // BITSHORT } CADClass; class OCAD_EXTERN CADClasses { public: CADClasses(); public: void addClass(CADClass stClass); CADClass getClassByNum(short num) const; void print() const; protected: vector<CADClass> classes; }; #endif // CADCLASSES_H
// // JJTabBarView.h // JJTabBarController // // Created by João Jesus on 05/03/2014. // Copyright (c) 2014 João Jesus. All rights reserved. // #import <UIKit/UIKit.h> #import "JJBarView.h" #import "UIButton+JJButton.h" #import "JJButtonMatrix.h" /** * A tabbar build over the JJBarView. * Will use the JJBarView#childViews of type UIButton's as tabbar items. */ @interface JJTabBarView : JJBarView /** * The UIButton representing as a tabbar item that is selected * Setting this to nil will deselect the button. * Default: nil */ @property(nonatomic,weak) UIButton *selectedTabBar; /** * The UIButton representing as a tabbar item that is selected * Setting this to nil will deselect the button. * * @param selectedTabBar UIButton to be selected * @param animated is animating */ - (void)setSelectedTabBar:(UIButton *)selectedTabBar animated:(BOOL)animated; /** * The UIButton#selectedIndex that is currently selected. * Setting this to NSNotFound will deselect the button. * Default: NSNotFound */ @property(nonatomic,assign) NSInteger selectedIndex; /** * The UIButton#selectedIndex that is currently selected. * Setting this to NSNotFound will deselect the button. * * @param selectedIndex index of the UIButton to be selected * @param animated is animating */ - (void)setSelectedIndex:(NSInteger)selectedIndex animated:(BOOL)animated; /** * If YES the tabbar will become scrollable and when a tabbar item is selected will be centered, except on the borders. * Default: NO */ @property(nonatomic,assign) BOOL centerTabBarOnSelect; /** * The same behaviour then centerTabBarOnSelect except that it will grow the scrollbar to able to always center items. * Default: NO */ @property(nonatomic,assign) BOOL alwaysCenterTabBarOnSelect; /** * Access to the underline JButtonMatrix used by the tabbar. */ @property(nonatomic,readonly) JJButtonMatrix *matrix; @end
// // SonyCameraPreview.h // dConnectDeviceSonyCamera // // Copyright (c) 2017 NTT DOCOMO, INC. // Released under the MIT license // http://opensource.org/licenses/mit-license.php // #import <Foundation/Foundation.h> @class SonyCameraRemoteApiUtil; /*! @brief Sonyカメラからのプレビューを制御するためのクラス. */ @interface SonyCameraPreview : NSObject - (instancetype)initWithRemoteApi:(SonyCameraRemoteApiUtil *)remoteApi; /*! @brief プレビューを開始します. @retval YES プレビューの開始に成功 @retval NO プレビューの開始に失敗 */ - (BOOL) startPreviewWithTimeSlice:(NSNumber *)timeSlice; /*! @brief プレビューを停止します. */ - (void) stopPreview; /*! @brief プレビュー再生中フラグを取得します. @retval YSE プレビュー再生中 @retval NO プレビュー停止中 */ - (BOOL) isRunning; /*! @brief プレビュー画像を配信するサーバへのURLを取得します. @retval プレビュー画像を配信するサーバへのURL @retval サーバが起動していない場合にはnil */ - (NSString *)getUrl; @end
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtTest module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** 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 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, 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. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTESTCOREELEMENT_H #define QTESTCOREELEMENT_H #include <QtTest/qtestcorelist.h> #include <QtTest/qtestelementattribute.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Test) template <class ElementType> class QTestCoreElement: public QTestCoreList<ElementType> { public: QTestCoreElement( int type = -1 ); virtual ~QTestCoreElement(); void addAttribute(const QTest::AttributeIndex index, const char *value); QTestElementAttribute *attributes() const; const char *attributeValue(QTest::AttributeIndex index) const; const char *attributeName(QTest::AttributeIndex index) const; const QTestElementAttribute *attribute(QTest::AttributeIndex index) const; const char *elementName() const; QTest::LogElementType elementType() const; private: QTestElementAttribute *listOfAttributes; QTest::LogElementType type; }; template<class ElementType> QTestCoreElement<ElementType>::QTestCoreElement(int t) :listOfAttributes(0), type(QTest::LogElementType(t)) { } template<class ElementType> QTestCoreElement<ElementType>::~QTestCoreElement() { delete listOfAttributes; } template <class ElementType> void QTestCoreElement<ElementType>::addAttribute(const QTest::AttributeIndex attributeIndex, const char *value) { if(attributeIndex == -1) return; if (attribute(attributeIndex)) return; QTestElementAttribute *testAttribute = new QTestElementAttribute; testAttribute->setPair(attributeIndex, value); testAttribute->addToList(&listOfAttributes); } template <class ElementType> QTestElementAttribute *QTestCoreElement<ElementType>::attributes() const { return listOfAttributes; } template <class ElementType> const char *QTestCoreElement<ElementType>::attributeValue(QTest::AttributeIndex index) const { const QTestElementAttribute *attrb = attribute(index); if(attrb) return attrb->value(); return 0; } template <class ElementType> const char *QTestCoreElement<ElementType>::attributeName(QTest::AttributeIndex index) const { const QTestElementAttribute *attrb = attribute(index); if(attrb) return attrb->name(); return 0; } template <class ElementType> const char *QTestCoreElement<ElementType>::elementName() const { const char *xmlElementNames[] = { "property", "properties", "failure", "error", "testcase", "testsuite", "benchmark", "system-err" }; if(type != QTest::LET_Undefined) return xmlElementNames[type]; return 0; } template <class ElementType> QTest::LogElementType QTestCoreElement<ElementType>::elementType() const { return type; } template <class ElementType> const QTestElementAttribute *QTestCoreElement<ElementType>::attribute(QTest::AttributeIndex index) const { QTestElementAttribute *iterator = listOfAttributes; while(iterator){ if(iterator->index() == index) return iterator; iterator = iterator->nextElement(); } return 0; } QT_END_NAMESPACE QT_END_HEADER #endif
#ifndef MCLIB_CORE_CLIENT_H #define MCLIB_CORE_CLIENT_H #include <mclib/mclib.h> #include <mclib/core/AuthToken.h> #include <mclib/core/Connection.h> #include <mclib/core/PlayerManager.h> #include <mclib/entity/EntityManager.h> #include <mclib/inventory/Inventory.h> #include <mclib/inventory/Hotbar.h> #include <mclib/network/Network.h> #include <mclib/protocol/packets/PacketDispatcher.h> #include <mclib/util/ObserverSubject.h> #include <mclib/world/World.h> #include <thread> namespace mc { namespace util { class PlayerController; } // ns util namespace core { class ClientListener { public: virtual void OnTick() = 0; }; enum class UpdateMethod { Block, Threaded, Manual }; class Client : public util::ObserverSubject<ClientListener>, public core::ConnectionListener { private: protocol::packets::PacketDispatcher* m_Dispatcher; core::Connection m_Connection; entity::EntityManager m_EntityManager; core::PlayerManager m_PlayerManager; std::unique_ptr<inventory::InventoryManager> m_InventoryManager; inventory::Hotbar m_Hotbar; std::unique_ptr<util::PlayerController> m_PlayerController; world::World m_World; s64 m_LastUpdate; bool m_Connected; std::thread m_UpdateThread; public: MCLIB_API Client(protocol::packets::PacketDispatcher* dispatcher, protocol::Version version = protocol::Version::Minecraft_1_11_2); MCLIB_API ~Client(); Client(const Client& rhs) = delete; Client& operator=(const Client& rhs) = delete; Client(Client&& rhs) = delete; Client& operator=(Client&& rhs) = delete; void MCLIB_API OnSocketStateChange(network::Socket::Status newState); void MCLIB_API UpdateThread(); void MCLIB_API Update(); bool MCLIB_API Login(const std::string& host, unsigned short port, const std::string& user, const std::string& password, UpdateMethod method = UpdateMethod::Block); bool MCLIB_API Login(const std::string& host, unsigned short port, const std::string& user, AuthToken token, UpdateMethod method = UpdateMethod::Block); void MCLIB_API Ping(const std::string& host, unsigned short port, UpdateMethod method = UpdateMethod::Block); protocol::packets::PacketDispatcher* GetDispatcher() { return m_Dispatcher; } core::Connection* GetConnection() { return &m_Connection; } core::PlayerManager* GetPlayerManager() { return &m_PlayerManager; } entity::EntityManager* GetEntityManager() { return &m_EntityManager; } inventory::InventoryManager* GetInventoryManager() { return m_InventoryManager.get(); } inventory::Hotbar& GetHotbar() { return m_Hotbar; } util::PlayerController* GetPlayerController() { return m_PlayerController.get(); } world::World* GetWorld() { return &m_World; } }; } // ns core } // ns mc #endif // CLIENT_H
/** ****************************************************************************** * File Name : stm32l4xx_hal_msp.c * Description : This file provides code for the MSP Initialization * and de-Initialization codes. ****************************************************************************** * * COPYRIGHT(c) 2016 STMicroelectronics * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32l4xx_hal.h" extern void Error_Handler(void); /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ /** * Initializes the Global MSP. */ void HAL_MspInit(void) { /* USER CODE BEGIN MspInit 0 */ /* USER CODE END MspInit 0 */ __HAL_RCC_SYSCFG_CLK_ENABLE(); HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); /* System interrupt init*/ /* MemoryManagement_IRQn interrupt configuration */ HAL_NVIC_SetPriority(MemoryManagement_IRQn, 0, 0); /* BusFault_IRQn interrupt configuration */ HAL_NVIC_SetPriority(BusFault_IRQn, 0, 0); /* UsageFault_IRQn interrupt configuration */ HAL_NVIC_SetPriority(UsageFault_IRQn, 0, 0); /* SVCall_IRQn interrupt configuration */ HAL_NVIC_SetPriority(SVCall_IRQn, 0, 0); /* DebugMonitor_IRQn interrupt configuration */ HAL_NVIC_SetPriority(DebugMonitor_IRQn, 0, 0); /* PendSV_IRQn interrupt configuration */ HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0); /* SysTick_IRQn interrupt configuration */ HAL_NVIC_SetPriority(SysTick_IRQn, 15, 0); /* USER CODE BEGIN MspInit 1 */ /* USER CODE END MspInit 1 */ } /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
// Copyright (c) 2014 Antony Arciuolo. See License.txt regarding use. #pragma once #ifndef oBuildTool_h #define oBuildTool_h #include <oConcurrency/event.h> #include <oBase/types.h> #include <oString/fixed_string.h> #include <oBasis/oRTTI.h> struct oBUILD_TOOL_TESTING_SETTINGS { bool ReSync; uint TimeoutSeconds; ouro::path_string CommandLine; ouro::path_string FailedImageCompares; }; oRTTI_COMPOUND_DECLARATION(oRTTI_CAPS_NONE, oBUILD_TOOL_TESTING_SETTINGS) struct oBUILD_TOOL_PACKAGING_SETTINGS { uint TimeoutSeconds; std::vector<ouro::path_string> CommandLines; }; oRTTI_COMPOUND_DECLARATION(oRTTI_CAPS_NONE, oBUILD_TOOL_PACKAGING_SETTINGS) struct oUnitTestResults { float TimePassedSeconds; bool HasTimedOut; bool ParseLogfileSucceeded; bool TestingSucceeded; ouro::uri_string StdoutLogfile; ouro::uri_string StderrLogfile; ouro::uri_string FailedImagePath; struct TestItem { ouro::sstring Name; ouro::sstring Status; ouro::lstring Message; }; std::vector<TestItem> FailedTests; }; struct oPackagingResults { float PackagingTimeSeconds; }; bool oRunTestingStage(const oBUILD_TOOL_TESTING_SETTINGS& _TestSettings, const char* _BuildRoot, const ouro::event& _CancelEvent, oUnitTestResults* _pResults); bool oRunPackagingStage(const oBUILD_TOOL_PACKAGING_SETTINGS& _Settings, oPackagingResults* _pResults); #endif //oBuildTool_h
#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages. #include "../drivers/hitechnic-sensormux.h" #include "../drivers/lego-ultrasound.h" #include "../drivers/hitechnic-irseeker-v2.h" #include "../drivers/hitechnic-gyro.h" #include "../drivers/hitechnic-accelerometer.h" #include "../drivers/hitechnic-colour-v2.h" #include "../drivers/lego-light.h" #include "../drivers/hitechnic-superpro.h"
// // Created by everettjf // Copyright © 2017 everettjf. All rights reserved. // #ifndef MOEXMACHHEADER_H #define MOEXMACHHEADER_H #include "Node.h" #include "LoadCommand.h" #include "Magic.h" #include "MachSection.h" MOEX_NAMESPACE_BEGIN // Wrapper for qv_mach_header // Derived from NodeData because some data should be swapped class MachHeaderInternal : public NodeData<qv_mach_header>{ public: void Init(void *offset,NodeContextPtr&ctx) override; }; using MachHeaderInternalPtr = std::shared_ptr<MachHeaderInternal>; // Wrapper for qv_mach_header // Derived from NodeData because some data should be swapped class MachHeader64Internal : public NodeData<qv_mach_header_64>{ public: void Init(void *offset,NodeContextPtr&ctx) override; }; using MachHeader64InternalPtr = std::shared_ptr<MachHeader64Internal>; class LoadCommand_LC_SEGMENT; class LoadCommand_LC_SEGMENT_64; // Cache info when parsing struct ParsingCacheInfo{ uint64_t base_addr=0LL; std::vector<LoadCommand_LC_SEGMENT*> segments; std::vector<LoadCommand_LC_SEGMENT_64*> segments64; }; // Wrapper class class MachHeader : public Node{ private: // Whether it is 64bit bool is64_; // Pointing to qv_mach_header and qv_mach_header_64 (swapped) qv_mach_header * header_; // Load commands std::vector<LoadCommandPtr> loadcmds_; MachHeaderInternalPtr mh_; MachHeader64InternalPtr mh64_; Magic magic_; NodeContextPtr ctx_; // Offset of the beginning header void *header_start_; ParsingCacheInfo cache_; private: // Internal parse void Parse(void *offset,NodeContextPtr& ctx); public: // Whether it is 64bit bool Is64()const{return is64_;} // Pointing to swapped header qv_mach_header * data_ptr(){return header_;} // Get all load commands std::vector<LoadCommandPtr> &loadcmds_ref(){return loadcmds_;} // Get context NodeContextPtr & ctx(){return ctx_;} // Getter for the offset of the begining header char * header_start(){return (char*)header_start_;} // Get offset from the beginning of the file uint64_t GetRAW(const void * addr) override ; // Get current header size in bytes std::size_t DATA_SIZE(); // Init function from the begining of MachO header void Init(void *offset,NodeContextPtr&ctx); // Getter mach header MachHeaderInternalPtr & mh(){return mh_;} // Getter mach header 64 MachHeader64InternalPtr & mh64(){return mh64_;} // Getter arch in string std::string GetArch(); // Get file type in string std::string GetFileTypeString(); // Get flags in string array std::vector<std::tuple<uint32_t,std::string>> GetFlagsArray(); // Get magic in string std::string GetMagicString(); // Get cpu type in string std::string GetCpuTypeString(); // Get cpu sub type in string std::string GetCpuSubTypeString(); // Get cpu sub type detailed array std::vector<std::tuple<qv_cpu_type_t,qv_cpu_subtype_t,std::string>> GetCpuSubTypeArray(); // Get base address uint64_t GetBaseAddress(); // Get segment array std::vector<LoadCommand_LC_SEGMENT*> & GetSegments(); std::vector<LoadCommand_LC_SEGMENT_64*> & GetSegments64(); // Find either command type , all cmdtypes corresponding to same return type template<typename T> T * FindLoadCommand(std::initializer_list<uint32_t> cmdtypes){ for(auto & cmd : loadcmds_ref()){ for(auto cmdtype : cmdtypes){ if(cmd->offset()->cmd == cmdtype) { return static_cast<T*>(cmd.get()); } } } return nullptr; } bool ExistLoadCommand(std::initializer_list<uint32_t> cmdtypes){ for(auto & cmd : loadcmds_ref()){ for(auto cmdtype : cmdtypes){ if(cmd->offset()->cmd == cmdtype) { return true; } } } return false; } template<typename T> void ForEachLoadCommand(std::initializer_list<uint32_t> cmdtypes, std::function<void(T*,bool&)> callback){ for(auto & cmd : loadcmds_ref()){ for(auto cmdtype : cmdtypes){ if(cmd->offset()->cmd == cmdtype) { bool stop = false; callback(static_cast<T*>(cmd.get()),stop); if(stop) return; } } } } }; using MachHeaderPtr = std::shared_ptr<MachHeader>; MOEX_NAMESPACE_END #endif // MOEXMACHHEADER_H
#import <Foundation/Foundation.h> @interface CollectionWithChildrenAddChildrenHelper : NSObject @end
// Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. // // Simple hash function used for internal data structures #ifndef STORAGE_LEVELDB_UTIL_HASH_H_ #define STORAGE_LEVELDB_UTIL_HASH_H_ #include <stddef.h> #include <stdint.h> namespace leveldb { extern uint32_t Hash(const char* data, size_t n, uint32_t seed); } #endif // STORAGE_LEVELDB_UTIL_HASH_H_
/* rnaFold.c was originally generated by the autoSql program, which also * generated rnaFold.h and rnaFold.sql. This module links the database and * the RAM representation of objects. */ /* Copyright (C) 2014 The Regents of the University of California * See README in this or parent directory for licensing information. */ #include "common.h" #include "linefile.h" #include "dystring.h" #include "jksql.h" #include "rnaFold.h" void rnaFoldStaticLoad(char **row, struct rnaFold *ret) /* Load a row from rnaFold table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->name = row[0]; ret->seq = row[1]; ret->fold = row[2]; ret->energy = atof(row[3]); } struct rnaFold *rnaFoldLoad(char **row) /* Load a rnaFold from row fetched with select * from rnaFold * from database. Dispose of this with rnaFoldFree(). */ { struct rnaFold *ret; AllocVar(ret); ret->name = cloneString(row[0]); ret->seq = cloneString(row[1]); ret->fold = cloneString(row[2]); ret->energy = atof(row[3]); return ret; } struct rnaFold *rnaFoldLoadAll(char *fileName) /* Load all rnaFold from a whitespace-separated file. * Dispose of this with rnaFoldFreeList(). */ { struct rnaFold *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[4]; while (lineFileRow(lf, row)) { el = rnaFoldLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct rnaFold *rnaFoldLoadAllByChar(char *fileName, char chopper) /* Load all rnaFold from a chopper separated file. * Dispose of this with rnaFoldFreeList(). */ { struct rnaFold *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[4]; while (lineFileNextCharRow(lf, chopper, row, ArraySize(row))) { el = rnaFoldLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct rnaFold *rnaFoldCommaIn(char **pS, struct rnaFold *ret) /* Create a rnaFold out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new rnaFold */ { char *s = *pS; if (ret == NULL) AllocVar(ret); ret->name = sqlStringComma(&s); ret->seq = sqlStringComma(&s); ret->fold = sqlStringComma(&s); ret->energy = sqlFloatComma(&s); *pS = s; return ret; } void rnaFoldFree(struct rnaFold **pEl) /* Free a single dynamically allocated rnaFold such as created * with rnaFoldLoad(). */ { struct rnaFold *el; if ((el = *pEl) == NULL) return; freeMem(el->name); freeMem(el->seq); freeMem(el->fold); freez(pEl); } void rnaFoldFreeList(struct rnaFold **pList) /* Free a list of dynamically allocated rnaFold's */ { struct rnaFold *el, *next; for (el = *pList; el != NULL; el = next) { next = el->next; rnaFoldFree(&el); } *pList = NULL; } void rnaFoldOutput(struct rnaFold *el, FILE *f, char sep, char lastSep) /* Print out rnaFold. Separate fields with sep. Follow last field with lastSep. */ { if (sep == ',') fputc('"',f); fprintf(f, "%s", el->name); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->seq); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->fold); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%f", el->energy); fputc(lastSep,f); } /* -------------------------------- End autoSql Generated Code -------------------------------- */
#include <stdio.h> //#include <stdbool.h> #define TRUE 1 #define FALSE 0 #define printf_debug printf int main(void) { #define ROWS 4 #define COLUMNS 4 int matrix[ROWS][COLUMNS] = { {1, 2, 8, 9}, {2, 4, 9, 12}, {4, 7, 10, 13}, {6, 8, 11, 15} }; if( exam_03(matrix, ROWS, COLUMNS, 7) ) printf("FOUND\n"); else printf("NONE\n"); } int exam_03(int* matrix, int rows, int columns, int number) { if( (matrix == NULL) || (rows < 1) || (columns < 1) ){ return FALSE; } int r = 0; int c = columns -1; printf_debug("r:%d, c:%d\n", r, c); while( (r < rows) && (c >= 0) ){ int find_value = matrix[r*columns+c]; printf_debug("target:%d, now:%d\n", number, find_value); if( number < find_value ){ c--; } else if( number > find_value ){ r++; } else{ return TRUE; } printf_debug("r:%d, c:%d\n", r, c); } return FALSE; }
/* tooltipeditdialog.cpp - Kopete Tooltip Editor Copyright (c) 2004 by Stefan Gehn <metz AT gehn.net> Kopete (c) 2004 by the Kopete developers <kopete-devel@kde.org> ************************************************************************* * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ************************************************************************* */ #ifndef TOOLTIPEDITDIALOG_H #define TOOLTIPEDITDIALOG_H #include <kdebug.h> #include <qhbox.h> #include <kdialogbase.h> class TooltipEditWidget; class TooltipEditDialog : public KDialogBase { Q_OBJECT public: TooltipEditDialog(QWidget *parent=0, const char* name="ToolTipEditDialog"); private slots: void slotUnusedSelected(QListViewItem *); void slotUsedSelected(QListViewItem *); void slotUpButton(); void slotDownButton(); void slotAddButton(); void slotRemoveButton(); void slotOkClicked(); signals: void changed(bool); private: TooltipEditWidget *mMainWidget; }; #endif // vim: set noet ts=4 sts=4 sw=4:
/* * cyttsp5_mt.h * Cypress TrueTouch(TM) Standard Product V5 Multi-touch module. * For use with Cypress Txx5xx parts. * Supported parts include: * TMA5XX * * Copyright (C) 2012-2013 Cypress Semiconductor * Copyright (C) 2011 Sony Ericsson Mobile Communications AB. * * 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. * * Contact Cypress Semiconductor at www.cypress.com <ttdrivers@cypress.com> * */ #ifndef _LINUX_CYTTSP5_MT_H #define _LINUX_CYTTSP5_MT_H #define CYTTSP5_MT_NAME "cyttsp5_mt" /* abs settings */ #define CY_IGNORE_VALUE 0xFFFF /* abs signal capabilities offsets in the frameworks array */ enum cyttsp5_sig_caps { CY_SIGNAL_OST, CY_MIN_OST, CY_MAX_OST, CY_FUZZ_OST, CY_FLAT_OST, CY_NUM_ABS_SET /* number of signal capability fields */ }; /* abs axis signal offsets in the framworks array */ enum cyttsp5_sig_ost { CY_ABS_X_OST, CY_ABS_Y_OST, CY_ABS_P_OST, CY_ABS_W_OST, CY_ABS_ID_OST, CY_ABS_MAJ_OST, CY_ABS_MIN_OST, CY_ABS_OR_OST, CY_ABS_TOOL_OST, CY_NUM_ABS_OST /* number of abs signals */ }; enum cyttsp5_mt_platform_flags { CY_MT_FLAG_NONE, CY_MT_FLAG_HOVER = 0x04, CY_MT_FLAG_FLIP = 0x08, CY_MT_FLAG_INV_X = 0x10, CY_MT_FLAG_INV_Y = 0x20, CY_MT_FLAG_VKEYS = 0x40, CY_MT_FLAG_NO_TOUCH_ON_LO = 0x80, }; struct touch_framework { const uint16_t *abs; uint8_t size; uint8_t enable_vkeys; } __packed; struct cyttsp5_mt_platform_data { struct touch_framework *frmwrk; unsigned short flags; char const *inp_dev_name; int vkeys_x; int vkeys_y; }; #endif /* _LINUX_CYTTSP5_MT_H */
/** * @file autosar_sp_s1/autosar_sp_s1.c * * @section desc File description * * @section copyright Copyright * * Trampoline Test Suite * * Trampoline Test Suite is copyright (c) IRCCyN 2005-2007 * Trampoline Test Suite is protected by the French intellectual property law. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 * of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * @section infos File informations * * $Date$ * $Rev$ * $Author$ * $URL$ */ #include "Os.h" TestRef AutosarSPTest_seq1_t1_instance(void); TestRef AutosarSPTest_seq1_t2_instance(void); TestRef AutosarSPTest_seq1_isr1_instance(void); TestRef AutosarSPTest_seq1_isr2_instance(void); TestRef AutosarSPTest_seq1_error_instance1(void); TestRef AutosarSPTest_seq1_error_instance2(void); TestRef AutosarSPTest_seq1_error_instance3(void); TestRef AutosarSPTest_seq1_posttask_instance1(void); StatusType instance_error = 0; StatusType instance_post = 0; StatusType error_status; int main(void) { StartOS(OSDEFAULTAPPMODE); return 0; } void ErrorHook(StatusType error) { instance_error++; switch (instance_error) { case 1 : { TestRunner_runTest(AutosarSPTest_seq1_error_instance1()); break; } case 2 : { TestRunner_runTest(AutosarSPTest_seq1_error_instance2()); break; } case 3 : { error_status = error; TestRunner_runTest(AutosarSPTest_seq1_error_instance3()); break; } default: { addFailure("Instance error", __LINE__, __FILE__); break; } } } void PostTaskHook(void) { instance_post++; switch (instance_post) { case 1: { TestRunner_runTest(AutosarSPTest_seq1_posttask_instance1()); break; } default: { break; } } } void ShutdownHook(StatusType error) { TestRunner_end(); } TASK(t1) { TestRunner_start(); TestRunner_runTest(AutosarSPTest_seq1_t1_instance()); } TASK(t2) { TestRunner_runTest(AutosarSPTest_seq1_t2_instance()); ShutdownOS(E_OK); } ISR(softwareInterruptHandler0) { TestRunner_runTest(AutosarSPTest_seq1_isr1_instance()); } ISR(softwareInterruptHandler1) { TestRunner_runTest(AutosarSPTest_seq1_isr2_instance()); } UNUSED_ISR(softwareInterruptHandler2) /* End of file autosar_sp_s1/autosar_sp_s1.c */
/* $Id$ */ /* Copyright (C) 2004 Alexander Chernov */ /* This file is derived from `float.h' of the GNU C Compiler, version 3.2.3. The original copyright follows. */ /* float.h for target with IEEE 32/64 bit and Intel 386 style 80 bit floating point formats */ #ifndef __RCC_FLOAT_H__ #define __RCC_FLOAT_H__ /* Produced by enquire version 4.3, CWI, Amsterdam */ #include <features.h> /* Radix of exponent representation */ int enum { #defconst FLT_RADIX 2 }; /* Number of base-FLT_RADIX digits in the significand of a float */ int enum { #defconst FLT_MANT_DIG 24 }; /* Number of decimal digits of precision in a float */ int enum { #defconst FLT_DIG 6 }; /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */ int enum { #defconst FLT_ROUNDS 1 }; /* Difference between 1.0 and the minimum float greater than 1.0 */ float enum { #defconst FLT_EPSILON 1.19209290e-07F }; /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ int enum { #defconst FLT_MIN_EXP (-125) }; /* Minimum normalised float */ float enum { #defconst FLT_MIN 1.17549435e-38F }; /* Minimum int x such that 10**x is a normalised float */ int enum { #defconst FLT_MIN_10_EXP (-37) }; /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ int enum { #defconst FLT_MAX_EXP 128 }; /* Maximum float */ float enum { #defconst FLT_MAX 3.40282347e+38F }; /* Maximum int x such that 10**x is a representable float */ int enum { #defconst FLT_MAX_10_EXP 38 }; /* Number of base-FLT_RADIX digits in the significand of a double */ int enum { #defconst DBL_MANT_DIG 53 }; /* Number of decimal digits of precision in a double */ int enum { #defconst DBL_DIG 15 }; /* Difference between 1.0 and the minimum double greater than 1.0 */ double enum { #defconst DBL_EPSILON 2.2204460492503131e-16 }; /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ int enum { #defconst DBL_MIN_EXP (-1021) }; /* Minimum normalised double */ double enum { #defconst DBL_MIN 2.2250738585072014e-308 }; /* Minimum int x such that 10**x is a normalised double */ int enum { #defconst DBL_MIN_10_EXP (-307) }; /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ int enum { #defconst DBL_MAX_EXP 1024 }; /* Maximum double */ double enum { #defconst DBL_MAX 1.7976931348623157e+308 }; /* Maximum int x such that 10**x is a representable double */ int enum { #defconst DBL_MAX_10_EXP 308 }; /* Number of base-FLT_RADIX digits in the significand of a long double */ int enum { #defconst LDBL_MANT_DIG 64 }; /* Number of decimal digits of precision in a long double */ int enum { #defconst LDBL_DIG 18 }; /* Difference between 1.0 and the minimum long double greater than 1.0 */ long double enum { #defconst LDBL_EPSILON 1.08420217248550443401e-19L }; /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ int enum { #defconst LDBL_MIN_EXP (-16381) }; /* Minimum normalised long double */ long double enum { #defconst LDBL_MIN 3.36210314311209350626e-4932L }; /* Minimum int x such that 10**x is a normalised long double */ int enum { #defconst LDBL_MIN_10_EXP (-4931) }; /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ int enum { #defconst LDBL_MAX_EXP 16384 }; /* Maximum long double */ long double enum { #defconst LDBL_MAX 1.18973149535723176502e+4932L }; /* Maximum int x such that 10**x is a representable long double */ int enum { #defconst LDBL_MAX_10_EXP 4932 }; /* The floating-point expression evaluation method. -1 indeterminate 0 evaluate all operations and constants just to the range and precision of the type 1 evaluate operations and constants of type float and double to the range and precision of the double type, evaluate long double operations and constants to the range and precision of the long double type 2 evaluate all operations and constants to the range and precision of the long double type */ int enum { #defconst FLT_EVAL_METHOD 2 }; /* Number of decimal digits to enable rounding to the given number of decimal digits without loss of precision. if FLT_RADIX == 10^n: #mantissa * log10 (FLT_RADIX) else : ceil (1 + #mantissa * log10 (FLT_RADIX)) where #mantissa is the number of bits in the mantissa of the widest supported floating-point type. */ int enum { #defconst DECIMAL_DIG 21 }; #endif /* __RCC_FLOAT_H__ */
/* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 2007, Digium, Inc. * * Joshua Colp <jcolp@digium.com> * * See http://www.asterisk.org for more information about * the Asterisk project. Please do not directly contact * any of the maintainers of this project for assistance; * the project provides a web site, mailing lists and IRC * channels for your use. * * This program is free software, distributed under the terms of * the GNU General Public License Version 2. See the LICENSE file * at the top of the source tree. */ /*! \file * * \brief Simple two channel bridging module * * \author Joshua Colp <jcolp@digium.com> * * \ingroup bridges */ /*** MODULEINFO <support_level>core</support_level> ***/ #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include "asterisk/module.h" #include "asterisk/channel.h" #include "asterisk/bridging.h" #include "asterisk/bridging_technology.h" #include "asterisk/frame.h" static int simple_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) { struct ast_channel *c0 = AST_LIST_FIRST(&bridge->channels)->chan, *c1 = AST_LIST_LAST(&bridge->channels)->chan; /* If this is the first channel we can't make it compatible... unless we make it compatible with itself O.o */ if (AST_LIST_FIRST(&bridge->channels) == AST_LIST_LAST(&bridge->channels)) { return 0; } /* See if we need to make these compatible */ if ((ast_format_cmp(ast_channel_writeformat(c0), ast_channel_readformat(c1)) == AST_FORMAT_CMP_EQUAL) && (ast_format_cmp(ast_channel_readformat(c0), ast_channel_writeformat(c1)) == AST_FORMAT_CMP_EQUAL) && (ast_format_cap_identical(ast_channel_nativeformats(c0), ast_channel_nativeformats(c1)))) { return 0; } /* BOOM! We do. */ return ast_channel_make_compatible(c0, c1); } static enum ast_bridge_write_result simple_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) { struct ast_bridge_channel *other = NULL; /* If this is the only channel in this bridge then immediately exit */ if (AST_LIST_FIRST(&bridge->channels) == AST_LIST_LAST(&bridge->channels)) { return AST_BRIDGE_WRITE_FAILED; } /* Find the channel we actually want to write to */ if (!(other = (AST_LIST_FIRST(&bridge->channels) == bridge_channel ? AST_LIST_LAST(&bridge->channels) : AST_LIST_FIRST(&bridge->channels)))) { return AST_BRIDGE_WRITE_FAILED; } /* Write the frame out if they are in the waiting state... don't worry about freeing it, the bridging core will take care of it */ if (other->state == AST_BRIDGE_CHANNEL_STATE_WAIT) { ast_write(other->chan, frame); } return AST_BRIDGE_WRITE_SUCCESS; } static struct ast_bridge_technology simple_bridge = { .name = "simple_bridge", .capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_THREAD, .preference = AST_BRIDGE_PREFERENCE_MEDIUM, .join = simple_bridge_join, .write = simple_bridge_write, }; static int unload_module(void) { ast_format_cap_destroy(simple_bridge.format_capabilities); return ast_bridge_technology_unregister(&simple_bridge); } static int load_module(void) { if (!(simple_bridge.format_capabilities = ast_format_cap_alloc())) { return AST_MODULE_LOAD_DECLINE; } ast_format_cap_add_all_by_type(simple_bridge.format_capabilities, AST_FORMAT_TYPE_AUDIO); ast_format_cap_add_all_by_type(simple_bridge.format_capabilities, AST_FORMAT_TYPE_VIDEO); ast_format_cap_add_all_by_type(simple_bridge.format_capabilities, AST_FORMAT_TYPE_TEXT); return ast_bridge_technology_register(&simple_bridge); } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Simple two channel bridging module");
/* * Copyright (C) 2002-2007 Auriga * * This file is part of Auriga. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "malloc.h" #include "nullpo.h" #include "msg.h" #include "battle.h" #include "clif.h" #define MSG_NUMBER 256 static char *msg_table[MSG_NUMBER]; /* Server messages */ static char *motd = NULL; /*========================================== * Return the message string of the specified number *------------------------------------------ */ const char * msg_txt(int msg_number) { if (msg_number < 0 || msg_number >= MSG_NUMBER) { if (battle_config.error_log) printf("Message text error: Invalid message number: %d.\n", msg_number); } else if (msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0') { return msg_table[msg_number]; } return "<no message>"; } /*========================================== * ƒtƒH[ƒ}ƒbƒg•t‚«ƒƒbƒZ[ƒWo—Í *------------------------------------------ */ void msg_output(const int fd, const char *format, ...) { char output[256]; va_list ap; va_start(ap, format); vsnprintf(output, sizeof(output), format, ap); va_end(ap); clif_displaymessage(fd, output); return; } /*========================================== * Message of the Day‚Ì‘—M *------------------------------------------ */ void msg_send_motd(struct map_session_data *sd) { char *p = motd; nullpo_retv(sd); if(p) { do { clif_displaymessage(sd->fd, p); p += strlen(p) + 1; } while(*p); } return; } /*========================================== * Read Message Data *------------------------------------------ */ int msg_config_read(const char *cfgName) { static int msg_config_read_done = 0; /* for multiple configuration reading */ int msg_number; char line[1024], w1[1024], w2[1024]; FILE *fp; // init table if (msg_config_read_done == 0) { memset(&msg_table[0], 0, sizeof(msg_table[0]) * MSG_NUMBER); msg_config_read_done = 1; } fp = fopen(cfgName, "r"); if (fp == NULL) { printf("msg_config_read: open [%s] failed !\n", cfgName); return 1; } line[sizeof(line)-1] = '\0'; while (fgets(line, sizeof(line)-1, fp)) { if ((line[0] == '/' && line[1] == '/') || line[0] == '\0' || line[0] == '\n' || line[0] == '\r') continue; if (sscanf(line,"%d: %1023[^\r\n]",&msg_number,w2) != 2) { if (sscanf(line,"%1023[^:]: %1023[^\r\n]",w1,w2) != 2) continue; if (strcmpi(w1,"import") == 0) { msg_config_read(w2); } continue; } if (msg_number >= 0 && msg_number < MSG_NUMBER) { if (msg_table[msg_number]) { aFree(msg_table[msg_number]); } msg_table[msg_number] = (char *)aStrdup(w2); } else if (battle_config.error_log) { printf("file [%s]: Invalid message number: %d.\n", cfgName, msg_number); } } fclose(fp); return 0; } /*========================================== * Message of the Day‚̓ǂݍž‚Ý *------------------------------------------ */ int msg_read_motd(void) { int i; size_t len, size = 0, pos = 0; char buf[256]; FILE *fp; if(motd) { aFree(motd); motd = NULL; } if((fp = fopen(motd_txt, "r")) == NULL) { // not error return 0; } while(fgets(buf, sizeof(buf)-1, fp) != NULL) { for(i = 0; buf[i]; i++) { if(buf[i] == '\r' || buf[i] == '\n') { if(i == 0) { buf[i++] = ' '; } buf[i] = '\0'; break; } } len = strlen(buf) + 1; if(pos + len >= size) { size += sizeof(buf); motd = (char *)aRealloc(motd, size); } memcpy(motd + pos, buf, len); pos += len; } if(size > 0) { motd = (char *)aRealloc(motd, pos + 1); // k¬ˆ— motd[pos] = '\0'; // ––”ö‚É \0 ‚ð2‚‘±‚¯‚é } fclose(fp); return 0; } /*========================================== * I—¹ *------------------------------------------ */ void do_final_msg(void) { int msg_number; for (msg_number = 0; msg_number < MSG_NUMBER; msg_number++) { if (msg_table[msg_number]) { aFree(msg_table[msg_number]); } } if (motd) { aFree(motd); motd = NULL; } return; } /*========================================== * ‰Šú‰» *------------------------------------------ */ int do_init_msg(void) { msg_read_motd(); return 0; }
#include <string.h> #include <x86.h> /* * * strlen - calculate the length of the string @s, not including * the terminating '\0' character. * @s: the input string * * The strlen() function returns the length of string @s. * */ size_t strlen(const char *s) { size_t cnt = 0; while (*s ++ != '\0') { cnt ++; } return cnt; } /* * * strnlen - calculate the length of the string @s, not including * the terminating '\0' char acter, but at most @len. * @s: the input string * @len: the max-length that function will scan * * Note that, this function looks only at the first @len characters * at @s, and never beyond @s + @len. * * The return value is strlen(s), if that is less than @len, or * @len if there is no '\0' character among the first @len characters * pointed by @s. * */ size_t strnlen(const char *s, size_t len) { size_t cnt = 0; while (cnt < len && *s ++ != '\0') { cnt ++; } return cnt; } /* * * memset - sets the first @n bytes of the memory area pointed by @s * to the specified value @c. * @s: pointer the the memory area to fill * @c: value to set * @n: number of bytes to be set to the value * * The memset() function returns @s. * */ void * memset(void *s, char c, size_t n) { #ifdef __HAVE_ARCH_MEM_OPTS return __memset(s, c, n); #else char *p = s; while (n -- > 0) { *p ++ = c; } return s; #endif /* __HAVE_ARCH_MEM_OPTS */ } /* * * memcpy - copies the value of @n bytes from the location pointed by @src to * the memory area pointed by @dst. * @dst pointer to the destination array where the content is to be copied * @src pointer to the source of data to by copied * @n: number of bytes to copy * * The memcpy() returns @dst. * * Note that, the function does not check any terminating null character in @src, * it always copies exactly @n bytes. To avoid overflows, the size of arrays pointed * by both @src and @dst, should be at least @n bytes, and should not overlap * (for overlapping memory area, memmove is a safer approach). * */ void * memcpy(void *dst, const void *src, size_t n) { #ifdef __HAVE_ARCH_MEM_OPTS return __memcpy(dst, src, n); #else const char *s = src; char *d = dst; while (n -- > 0) { *d ++ = *s ++; } return dst; #endif /* __HAVE_ARCH_MEM_OPTS */ } /* * * memmove - copies the values of @n bytes from the location pointed by @src to * the memory area pointed by @dst. @src and @dst are allowed to overlap. * @dst pointer to the destination array where the content is to be copied * @src pointer to the source of data to by copied * @n: number of bytes to copy * * The memmove() function returns @dst. * */ void * memmove(void *dst, const void *src, size_t n) { #ifdef __HAVE_ARCH_MEM_OPTS return __memmove(dst, src, n); #else const char *s = src; char *d = dst; if (s < d && s + n > d) { s += n, d += n; while (n -- > 0) { *-- d = *-- s; } } else { while (n -- > 0) { *d ++ = *s ++; } } return dst; #endif /* __HAVE_ARCH_MEM_OPTS */ }
/*************************************************************************** am_modulator.h ---------------- begin : Sat Feb 25 2006 copyright : (C) 2006 by Michael Margraf email : michael.margraf@alumni.tu-berlin.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 AM_MODULATOR_H #define AM_MODULATOR_H #include "component.h" class AM_Modulator : public Component { public: AM_Modulator(); ~AM_Modulator(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); }; #endif
/* Copyright Statement: * * This software/firmware and related documentation ("MediaTek Software") are * protected under relevant copyright laws. The information contained herein * is confidential and proprietary to MediaTek Inc. and/or its licensors. * Without the prior written permission of MediaTek inc. and/or its licensors, * any reproduction, modification, use or disclosure of MediaTek Software, * and information contained herein, in whole or in part, shall be strictly prohibited. */ /* MediaTek Inc. (C) 2010. All rights reserved. * * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER 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 RECEIVER AGREES TO LOOK ONLY TO SUCH * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR * STANDARD OR OPEN FORUM. RECEIVER'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 RECEIVER TO * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * The following software/firmware and/or related documentation ("MediaTek Software") * have been modified by MediaTek Inc. All revisions are subject to any receiver's * applicable license agreements with MediaTek Inc. */ #ifndef _MMC_MTK_H #define _MMC_MTK_H #define MMC_DRV_NAME "mtk-sd" #define MSDC_CD_PIN_EN (1 << 0) /* card detection pin is wired */ #define MSDC_WP_PIN_EN (1 << 1) /* write protection pin is wired */ #define MSDC_RST_PIN_EN (1 << 2) /* emmc reset pin is wired */ #define MSDC_SDIO_IRQ (1 << 3) /* use internal sdio irq (bus) */ #define MSDC_EXT_SDIO_IRQ (1 << 4) /* use external sdio irq */ #define MSDC_REMOVABLE (1 << 5) /* removable slot */ #define MSDC_SYS_SUSPEND (1 << 6) /* suspended by system */ #define MSDC_HIGHSPEED (1 << 7) /* high-speed mode support */ #define MSDC_UHS1 (1 << 8) /* uhs-1 mode support */ #define MSDC_DDR (1 << 9) /* ddr mode support */ #define MSDC_SMPL_RISING (0) #define MSDC_SMPL_FALLING (1) #define MSDC_CMD_PIN (0) #define MSDC_DAT_PIN (1) #define MSDC_CD_PIN (2) #define MSDC_WP_PIN (3) #define MSDC_RST_PIN (4) typedef void (*sdio_irq_handler_t)(void*); /* external irq handler */ typedef void (*pm_callback_t)(pm_message_t state, void *data); struct msdc_hw { unsigned char clk_src; /* host clock source */ unsigned char cmd_edge; /* command latch edge */ unsigned char data_edge; /* data latch edge */ unsigned char crc_edge; /* sample crc latch edge */ unsigned char clk_drv; /* clock pad driving */ unsigned char cmd_drv; /* command pad driving */ unsigned char dat_drv; /* data pad driving */ unsigned char data_pins; /* data pins */ unsigned int flags; /* hardware capability flags */ /* config gpio pull mode */ void (*config_gpio_pin)(int type, int pull); /* external power control for card */ void (*ext_power_on)(void); void (*ext_power_off)(void); /* external sdio irq operations */ void (*request_sdio_eirq)(sdio_irq_handler_t sdio_irq_handler, void *data); void (*enable_sdio_eirq)(void); void (*disable_sdio_eirq)(void); /* external cd irq operations */ void (*request_cd_eirq)(sdio_irq_handler_t cd_irq_handler, void *data); void (*enable_cd_eirq)(void); void (*disable_cd_eirq)(void); int (*get_cd_status)(void); /* power management callback for external module */ void (*register_pm)(pm_callback_t pm_cb, void *data); }; #endif /* _MMC_MTK_H */
/* * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 * Robert Lougher <rob@jamvm.org.uk>. * * This file is part of JamVM. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <string.h> #include <stdlib.h> #include "jam.h" #include "hash.h" #define HASH(ptr) utf8Hash(ptr) #define COMPARE(ptr1, ptr2, hash1, hash2) (ptr1 == ptr2) || \ ((hash1 == hash2) && utf8Comp(ptr1, ptr2)) #define PREPARE(ptr) ptr #define SCAVENGE(ptr) FALSE #define FOUND(ptr1, ptr2) ptr2 static HashTable hash_table; /*XXX NVM VARIABLES - UTF8.C */ static int is_persistent = FALSE; #define GET_UTF8_CHAR(ptr, c) \ { \ int x = *ptr++; \ if(x & 0x80) { \ int y = *ptr++; \ if(x & 0x20) { \ int z = *ptr++; \ c = ((x&0xf)<<12)+((y&0x3f)<<6)+(z&0x3f); \ } else \ c = ((x&0x1f)<<6)+(y&0x3f); \ } else \ c = x; \ } int utf8Len(char *utf8) { int count; for(count = 0; *utf8; count++) { int x = *utf8; utf8 += (x & 0x80) ? ((x & 0x20) ? 3 : 2) : 1; } return count; } void convertUtf8(char *utf8, unsigned short *buff) { while(*utf8) GET_UTF8_CHAR(utf8, *buff++); } int utf8Hash(char *utf8) { int hash = 0; while(*utf8) { unsigned short c; GET_UTF8_CHAR(utf8, c); hash = hash * 37 + c; } return hash; } int utf8Comp(char *ptr, char *ptr2) { while(*ptr && *ptr2) { unsigned short c, c2; GET_UTF8_CHAR(ptr, c); GET_UTF8_CHAR(ptr2, c2); if(c != c2) return FALSE; } if(*ptr || *ptr2) return FALSE; return TRUE; } char *findHashedUtf8(char *string, int add_if_absent) { char *interned = NULL; /* Add if absent, no scavenge, locked */ /* XXX NVM CHANGE 006.003.008 */ findHashEntry(hash_table, string, interned, add_if_absent, FALSE, TRUE, HT_NAME_UTF8, TRUE); return interned; } char *copyUtf8(char *string) { /*XXX NVM CHANGE 004.001.030 */ char *buff = strcpy(sysMalloc_persistent(strlen(string) + 1), string); char *found = findHashedUtf8(buff, TRUE); if(found != buff) /*XXX NVM CHANGE 004.003.003 */ sysFree_persistent(buff); return found; } char *slash2dots(char *utf8) { int len = strlen(utf8); char *conv = sysMalloc(len+1); int i; for(i = 0; i <= len; i++) if(utf8[i] == '/') conv[i] = '.'; else conv[i] = utf8[i]; return conv; } char *slash2dots2buff(char *utf8, char *buff, int buff_len) { char *pntr = buff; while(*utf8 != '\0' && --buff_len) { char c = *utf8++; *pntr++ = c == '/' ? '.' : c; } *pntr = '\0'; return buff; } void initialiseUtf8(InitArgs *args) { if(args->persistent_heap == TRUE) { is_persistent = TRUE; } /* Init hash table, and create lock */ /* XXX NVM CHANGE 005.001.009 - UTF8 HT - Y*/ initHashTable(hash_table, UTF8_HT_ENTRY_COUNT, TRUE, HT_NAME_UTF8, TRUE); /* XXX DOC CHANGE */ if(is_persistent) { OPC *ph_value = get_opc_ptr(); hash_table.hash_count = ph_value->utf8_hash_count; } } #ifndef NO_JNI /* Functions used by JNI */ int utf8CharLen(unsigned short *unicode, int len) { int count = 0; for(; len > 0; len--) { unsigned short c = *unicode++; count += c == 0 || c > 0x7f ? (c > 0x7ff ? 3 : 2) : 1; } return count; } char *unicode2Utf8(unsigned short *unicode, int len, char *utf8) { char *ptr = utf8; for(; len > 0; len--) { unsigned short c = *unicode++; if((c == 0) || (c > 0x7f)) { if(c > 0x7ff) { *ptr++ = (c >> 12) | 0xe0; *ptr++ = ((c >> 6) & 0x3f) | 0x80; } else *ptr++ = (c >> 6) | 0xc0; *ptr++ = (c&0x3f) | 0x80; } else *ptr++ = c; } *ptr = '\0'; return utf8; } #endif /* XXX NVM CHANGE 009.004.001 */ int get_utf8_HC() { return hash_table.hash_count; }
/* Z80Sim - A simulator/debugger for the Zilog Z80 processor Copyright (C) 2003 Lorenzo J. Lucchini 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 "watch.h" #include "parser.h" #include "sizes.h" #include <assert.h> #define MAX_WATCHPOINTS 256 typedef struct { watchpoint Elements[MAX_WATCHPOINTS]; short Count; } watchpoints; watchpoints Watchpoints; void InitWatchpoints() { Watchpoints.Count=1; } short AddWatchpoint(operation* Watchpoint, logic Enabled) { assert(Watchpoint!=NULL); Watchpoints.Elements[Watchpoints.Count].Trigger=Watchpoint; Watchpoints.Elements[Watchpoints.Count].StableValue=EvaluateExpression(Watchpoint); Watchpoints.Elements[Watchpoints.Count].Active=Enabled; return Watchpoints.Count++; } void WatchpointActivation(short Number, logic Enabled) { assert(Number<Watchpoints.Count); Watchpoints.Elements[Number].Active=Enabled; } void ListWatchpoints(FILE* Handle) { if(Watchpoints.Count<=1) { fprintf(Handle, "No breakpoints or watchpoints.\n"); } else { char Expression[MAX_STRING]; short i; fprintf(Handle, "Num Type Disp Enb What\n"); for(i=1; i<Watchpoints.Count; i++) { StringifyExpression(Watchpoints.Elements[i].Trigger, Expression); fprintf(Handle, "%-3d watchpoint keep %c %s\n", i, Watchpoints.Elements[i].Active?'y':'n', Expression); } } } watchpoint* CheckWatchpoints() { short i; for(i=1; i<Watchpoints.Count; i++) { word CurrentValue; if(Watchpoints.Elements[i].Active) { CurrentValue=EvaluateExpression(Watchpoints.Elements[i].Trigger); if(CurrentValue!=Watchpoints.Elements[i].StableValue) return &(Watchpoints.Elements[i]); } } return NULL; } logic ExistsWatchpoint(short Number) { if(Number<Watchpoints.Count) return TRUE; else return FALSE; }
#include <stdio.h> //Standard c library for IO #include <stdlib.h> //Standard c library #include <xc.h> //XC compiler library #include <pic18f47j53.h> //pic microcontroller library #include "config.h" #include "functions.h" //library used for the sensors #include "lcd.h" //library used for the lcd control #include "motorEncoder.h" //library used for the motor and encoder control #include "userInterface.h" //library used for implementing the userinterface //this function is used to display the distance on the lcd display void showDistance(void) { char buffer [10]; lcdClear(); lcdSetPos(0, 0); lcdWriteStrC("Distance: [cm/uS]"); lcdSetPos(0, 1); sprintf(buffer, "%3.3f", readDistance()); lcdWriteStrC(buffer); } //this function is used to display the temprature and the light intensity in the room void showTempLight(void) { char buffer [10]; lcdClear(); lcdSetPos(0, 0); sprintf(buffer, "temp: %1.3f", readTempF()); lcdWriteStrC(buffer); lcdSetPos(0, 1); sprintf(buffer, "light: %d", readLight()); lcdWriteStrC(buffer); } //this function is used to display the acceleration on the lcd display void showAccelerometerVal(void) { char buffer [10]; lcdClear(); lcdWriteStrC("Aclmtr values:"); lcdSetPos(0, 1); sprintf(buffer, "%1.2f", single_axis_measure(X_AXIS, iteration_point)); lcdWriteStrC(buffer); lcdWriteChar(' '); sprintf(buffer, "%1.2f", single_axis_measure(Y_AXIS, iteration_point)); lcdWriteStrC(buffer); lcdWriteChar(' '); sprintf(buffer, "%1.2f", single_axis_measure(Z_AXIS, iteration_point)); lcdWriteStrC(buffer); }
/* This file is part of OpenMalaria. * * Copyright (C) 2005,2006,2007,2008 Swiss Tropical Institute and Liverpool School Of Tropical Medicine * * OpenMalaria 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. */ #define PUSH_NORMAL(X1,X0,Y1,Y0) \ normals.push_back(-((vertices[X1] - vertices[X0]).cross(vertices[Y1] - vertices[Y0])).direction()) #define RENDER_DEPTH(V) \ dist = (V - origin).length(); \ glColor4f(0,0,0, 0); \ glVertex3f(V.x, V.y, V.z); #define RENDER_FRONT(V) \ dist = (V - origin).length(); \ if (dist > 0.99f) dist = 0.99f; \ glColor4f(0,0,0, (dist - dMin)/dSpan); \ glVertex3f(V.x, V.y, V.z); #define RENDER_BACK(V) \ dist = (V - origin).length(); \ if (dist < 0.01f) dist = 0.01f; \ glColor4f(0,0,0, (dist - dMin)/dSpan); \ glVertex3f(V.x, V.y, V.z); #define RENDER_DEPTH_DEBUG(V) \ dist = (V - origin).length(); \ glColor4f(dist*calib,dist*calib,dist*calib, dist*calib); \ glVertex3f(V.x, V.y, V.z); #define RENDER_SPECULAR(V, N) \ in = V - origin; \ out = in - 2.0f*(N*in)*N; \ out /= out.length(); \ facing = out*sun; \ fresnel = 1.0f + in*N/in.length(); \ fresnel = 0.2f + 0.8f * fresnel; \ fresnel = fresnel*fresnel; \ if (N*sun < 0.0f) fresnel = 0.0f; \ if (facing < 0.0001f) \ { \ fresnel = 0.0f; \ facing = 0.6f/0.0001f; \ texCoord.x = 0.5f - facing*lightX*out; \ texCoord.y = 0.5f - facing*lightY*out; \ } \ else \ { \ texCoord.x = 0.5f + 0.6f*lightX*out; \ texCoord.y = 0.5f + 0.6f*lightY*out; \ } \ glColor4f(fresnel*specularColor.r, fresnel*specularColor.g, fresnel*specularColor.b, 1.0f); \ glTexCoord2f(texCoord.x, texCoord.y); \ glVertex3f(V.x, V.y, V.z); #define RENDER_ENVIRONMENT(V, N) \ in = V - origin; \ out = in - 2.0f*(N*in)*N; \ fresnel = 1.0f + in*N/in.length(); \ /*fresnel = 0.2f + 0.8f * fresnel;*/ \ fresnel = 0.3f + 0.7f * fresnel; \ glColor4f(ambientColor.r, ambientColor.g, ambientColor.b, fresnel); \ /*glColor4f(0.0f, 0.25f, 0.6f, fresnel);*/ \ glTexCoord3f(out.x, z_scale*out.y, out.z); \ glVertex3f(V.x, V.y, V.z); #define RENDER_DIFFUSE(V, N) \ /*glTexCoord2f(0.5f, 0.333f - V.y/3.0f);*/ \ glVertex3f(V.x, V.y, V.z);
/* This file is part of the KOffice project * Copyright (c) 2008 Dag Andersen <kplato@kde.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 SCRIPTING_RESOURCE_H #define SCRIPTING_RESOURCE_H #include <QObject> #include <QVariant> namespace KPlato { class Resource; } namespace Scripting { class Project; class Resource; /** * The Resource class represents a resource in a project. */ class Resource : public QObject { Q_OBJECT public: /// Create a resource Resource( Project *project, KPlato::Resource *resource, QObject *parent ); /// Destructor virtual ~Resource() {} KPlato::Resource *kplatoResource() const { return m_resource; } public Q_SLOTS: /// Return type of resource QVariant type(); /// Return type of resource QString id() const; /// Add external appointments void addExternalAppointment( const KPlato::Resource */*resource*/, const QString &/*start*/, const QString &/*end*/, int /*load */) {} /** * Return all internal appointments the resource has */ QVariantList appointmentIntervals( qlonglong schedule ) const; /** * Return all external appointments the resource has */ QVariantList externalAppointments() const; /// Add an external appointment void addExternalAppointment( const QVariant &id, const QString &name, const QVariantList &lst ); /// Clear appointments with identity @p id void clearExternalAppointments( const QString &id ); /// Number of child resources. Child resources is not supported. Always returns 0. int childCount() const; /// Return resource at @index. Child resources is not supported. Always returns 0. QObject *childAt( int index ) const; private: Project *m_project; KPlato::Resource *m_resource; }; } #endif
/* $Id$ */ /* * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <pj/except.h> #include <pj/rand.h> #include <stdio.h> #include <stdlib.h> /** * \page page_pjlib_samples_except_c Example: Exception Handling * * Below is sample program to demonstrate how to use exception handling. * * \includelineno pjlib-samples/except.c */ static pj_exception_id_t NO_MEMORY, OTHER_EXCEPTION; static void randomly_throw_exception() { if (pj_rand() % 2) PJ_THROW(OTHER_EXCEPTION); } static void *my_malloc(size_t size) { void *ptr = malloc(size); if (!ptr) PJ_THROW(NO_MEMORY); return ptr; } static int test_exception() { PJ_USE_EXCEPTION; PJ_TRY { void *data = my_malloc(200); free(data); randomly_throw_exception(); } PJ_CATCH_ANY { pj_exception_id_t x_id; x_id = PJ_GET_EXCEPTION(); printf("Caught exception %d (%s)\n", x_id, pj_exception_id_name(x_id)); } PJ_END return 1; } int main() { pj_status_t rc; // Error handling is omited for clarity. rc = pj_init(); rc = pj_exception_id_alloc("No Memory", &NO_MEMORY); rc = pj_exception_id_alloc("Other Exception", &OTHER_EXCEPTION); return test_exception(); }
/* Ekiga -- A VoIP and Video-Conferencing application * Copyright (C) 2000-2009 Damien Sandras <dsandras@seconix.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * * Ekiga is licensed under the GPL license and as a special exception, * you have permission to link or otherwise combine this program with the * programs OPAL, OpenH323 and PWLIB, and distribute the combination, * without applying the requirements of the GNU GPL to the OPAL, OpenH323 * and PWLIB programs, as long as you do follow the requirements of the * GNU GPL for all the rest of the software thus combined. */ /* * book-view-gtk.h - description * ------------------------------------------ * begin : written in 2007 by Julien Puydt * copyright : (c) 2007 by Julien Puydt * description : declaration of the widget representing a book * */ #ifndef __BOOK_VIEW_GTK_H__ #define __BOOK_VIEW_GTK_H__ #include <gtk/gtk.h> #include "book.h" typedef struct _BookViewGtk BookViewGtk; typedef struct _BookViewGtkPrivate BookViewGtkPrivate; typedef struct _BookViewGtkClass BookViewGtkClass; /* public api */ GtkWidget *book_view_gtk_new (Ekiga::BookPtr book); void book_view_gtk_populate_menu (BookViewGtk *, GtkWidget *); /* GObject thingies */ struct _BookViewGtk { GtkFrame parent; BookViewGtkPrivate *priv; }; struct _BookViewGtkClass { GtkFrameClass parent; }; #define BOOK_VIEW_GTK_TYPE (book_view_gtk_get_type ()) #define BOOK_VIEW_GTK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOOK_VIEW_GTK_TYPE, BookViewGtk)) #define IS_BOOK_VIEW_GTK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOOK_VIEW_GTK_TYPE)) #define BOOK_VIEW_GTK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOOK_VIEW_GTK_TYPE, BookViewGtkClass)) #define IS_BOOK_VIEW_GTK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOOK_VIEW_GTK_TYPE)) #define BOOK_VIEW_GTK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOOK_VIEW_GTK_TYPE, BookViewGtkClass)) GType book_view_gtk_get_type (); #endif
/* * Cypress Touchkey firmware list * * Copyright (C) 2011 Samsung Electronics * * 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. * */ #if defined(CONFIG_MACH_GOGH) #define BIN_FW_VERSION 0x03 #ifdef _CYPRESS_TKEY_FW_H #include "gogh_tkey_fw.h" #endif #elif defined(CONFIG_MACH_APEXQ) #define BIN_FW_VERSION 0x01 #ifdef _CYPRESS_TKEY_FW_H #include "apexq_tkey_fw.h" #endif #elif defined(CONFIG_MACH_AEGIS2) #define BIN_FW_VERSION 0x08 #ifdef _CYPRESS_TKEY_FW_H #include "aegis2_tkey_fw.h" #endif #else #define BIN_FW_VERSION 0x00 #ifdef _CYPRESS_TKEY_FW_H unsigned char firmware_data[8192]; #endif #endif
#include "stipulation/help_play/adapter.h" #include "stipulation/branch.h" #include "stipulation/help_play/branch.h" #include "debugging/trace.h" #include "debugging/assert.h" /* Allocate a STHelpAdapter slice. * @param length maximum number of half-moves of slice (+ slack) * @param min_length minimum number of half-moves of slice (+ slack) * @return index of allocated slice */ slice_index alloc_help_adapter_slice(stip_length_type length, stip_length_type min_length) { slice_index result; TraceFunctionEntry(__func__); TraceFunctionParam("%u",length); TraceFunctionParam("%u",min_length); TraceFunctionParamListEnd(); result = alloc_branch(STHelpAdapter,length,min_length); TraceFunctionExit(__func__); TraceFunctionResult("%u",result); TraceFunctionResultEnd(); return result; } /* Wrap the slices representing the initial moves of the solution with * slices of appropriately equipped slice types * @param adapter identifies slice where to start * @param st address of structure holding the traversal state */ void help_adapter_make_root(slice_index adapter, stip_structure_traversal *st) { spin_off_state_type * const state = st->param; TraceFunctionEntry(__func__); TraceFunctionParam("%u",adapter); TraceFunctionParamListEnd(); help_make_root(adapter,state); TraceFunctionExit(__func__); TraceFunctionResultEnd(); } static void count_move_slice(slice_index si, stip_structure_traversal *st) { unsigned int * const result = st->param; TraceFunctionEntry(__func__); TraceFunctionParam("%u",si); TraceFunctionParamListEnd(); ++*result; stip_traverse_structure_children_pipe(si,st); TraceFunctionExit(__func__); TraceFunctionResultEnd(); } static unsigned int count_move_slices_in_normal_path(slice_index si, stip_structure_traversal *st) { unsigned int result = 0; stip_structure_traversal st_nested; TraceFunctionEntry(__func__); TraceFunctionParam("%u",si); TraceFunctionParamListEnd(); stip_structure_traversal_init_nested(&st_nested,st,&result); branch_instrument_traversal_for_normal_path(&st_nested); stip_structure_traversal_override_single(&st_nested,STMove,&count_move_slice); stip_traverse_structure(si,&st_nested); TraceFunctionExit(__func__); TraceFunctionResult("%u",result); TraceFunctionResultEnd(); return result; } /* Attempt to add set play to an solve stipulation (battle play, not * postkey only) * @param si identifies the root from which to apply set play * @param st address of structure representing traversal */ void help_adapter_apply_setplay(slice_index si, stip_structure_traversal *st) { spin_off_state_type * const state = st->param; TraceFunctionEntry(__func__); TraceFunctionParam("%u",si); TraceFunctionParamListEnd(); if (count_move_slices_in_normal_path(si,st)==3) help_branch_make_setplay(si,state); else series_branch_make_setplay(si,state); TraceFunctionExit(__func__); TraceFunctionResultEnd(); }
#if !defined(CONDITIONS_CIRCE_REBIRTH_SQUARE_OCCUPIED_H) #define CONDITIONS_CIRCE_REBIRTH_SQUARE_OCCUPIED_H /* This module supports dealing with the situation when a Circe rebirth square * is occupied */ #include "stipulation/stipulation.h" struct circe_variant_type; typedef enum { circe_on_occupied_rebirth_square_default, circe_on_occupied_rebirth_square_relaxed, circe_on_occupied_rebirth_square_strict, circe_on_occupied_rebirth_square_assassinate, circe_on_occupied_rebirth_square_volcanic, circe_on_occupied_rebirth_square_parachute } circe_behaviour_on_occupied_rebirth_square_type; /* Retrieve the behaviour of a Circe variant if the rebirth square is occupied * @param variant address of the structure holding the variant * @return the enumerator identifying the behaviour */ circe_behaviour_on_occupied_rebirth_square_type circe_get_on_occupied_rebirth_square(struct circe_variant_type const *variant); /* Deal with the situation where a rebirth is to occur on an occupied square * @param si identifies entry slice into solving machinery * @param variant identifies address of structure holding the Circe variant * @param interval_start type of slice that starts the sequence of slices * implementing that variant */ void circe_solving_instrument_rebirth_on_occupied_square(slice_index si, struct circe_variant_type const *variant, slice_type interval_start); /* Try to solve in solve_nr_remaining half-moves. * @param si slice index * @note assigns solve_result the length of solution found and written, i.e.: * previous_move_is_illegal the move just played is illegal * this_move_is_illegal the move being played is illegal * immobility_on_next_move the moves just played led to an * unintended immobility on the next move * <=n+1 length of shortest solution found (n+1 only if in next * branch) * n+2 no solution found in this branch * n+3 no solution found in next branch * (with n denominating solve_nr_remaining) */ void circe_test_rebirth_square_empty_solve(slice_index si); #endif
/* * Copyright (C) 2010-2017 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. * * A copy of the licence is included with the program, and can also be obtained from Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @file mali_osk_mali.h * Defines the OS abstraction layer which is specific for the Mali kernel device driver (OSK) */ #ifndef __MALI_OSK_MALI_H__ #define __MALI_OSK_MALI_H__ #include <linux/mali/mali_utgard.h> #include <mali_osk.h> #ifdef __cplusplus extern "C" { #endif #ifdef CONFIG_MALI_DEVFREQ struct mali_device { struct device *dev; #ifdef CONFIG_HAVE_CLK struct clk *clock; #endif #ifdef CONFIG_REGULATOR struct regulator *regulator; #endif #ifdef CONFIG_PM_DEVFREQ struct devfreq_dev_profile devfreq_profile; struct devfreq *devfreq; unsigned long current_freq; unsigned long current_voltage; #ifdef CONFIG_DEVFREQ_THERMAL struct thermal_cooling_device *devfreq_cooling; #endif #endif struct mali_pm_metrics_data mali_metrics; }; #endif /** @addtogroup _mali_osk_miscellaneous * @{ */ /** @brief Struct with device specific configuration data */ typedef struct mali_gpu_device_data _mali_osk_device_data; #ifdef CONFIG_MALI_DT /** @brief Initialize those device resources when we use device tree * * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ _mali_osk_errcode_t _mali_osk_resource_initialize(void); #endif /** @brief Find Mali GPU HW resource * * @param addr Address of Mali GPU resource to find * @param res Storage for resource information if resource is found. * @return _MALI_OSK_ERR_OK on success, _MALI_OSK_ERR_ITEM_NOT_FOUND if resource is not found */ _mali_osk_errcode_t _mali_osk_resource_find(u32 addr, _mali_osk_resource_t *res); /** @brief Find Mali GPU HW base address * * @return 0 if resources are found, otherwise the Mali GPU component with lowest address. */ uintptr_t _mali_osk_resource_base_address(void); /** @brief Find the specific GPU resource. * * @return value * 0x400 if Mali 400 specific GPU resource identified * 0x450 if Mali 450 specific GPU resource identified * 0x470 if Mali 470 specific GPU resource identified * */ u32 _mali_osk_identify_gpu_resource(void); /** @brief Retrieve the Mali GPU specific data * * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ _mali_osk_errcode_t _mali_osk_device_data_get(_mali_osk_device_data *data); /** @brief Find the pmu domain config from device data. * * @param domain_config_array used to store pmu domain config found in device data. * @param array_size is the size of array domain_config_array. */ void _mali_osk_device_data_pmu_config_get(u16 *domain_config_array, int array_size); /** @brief Get Mali PMU switch delay * *@return pmu switch delay if it is configured */ u32 _mali_osk_get_pmu_switch_delay(void); /** @brief Determines if Mali GPU has been configured with shared interrupts. * * @return MALI_TRUE if shared interrupts, MALI_FALSE if not. */ mali_bool _mali_osk_shared_interrupts(void); /** @brief Initialize the gpu secure mode. * The gpu secure mode will initially be in a disabled state. * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ _mali_osk_errcode_t _mali_osk_gpu_secure_mode_init(void); /** @brief Deinitialize the gpu secure mode. * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ _mali_osk_errcode_t _mali_osk_gpu_secure_mode_deinit(void); /** @brief Reset GPU and enable the gpu secure mode. * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ _mali_osk_errcode_t _mali_osk_gpu_reset_and_secure_mode_enable(void); /** @brief Reset GPU and disable the gpu secure mode. * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ _mali_osk_errcode_t _mali_osk_gpu_reset_and_secure_mode_disable(void); /** @brief Check if the gpu secure mode has been enabled. * @return MALI_TRUE if enabled, otherwise MALI_FALSE. */ mali_bool _mali_osk_gpu_secure_mode_is_enabled(void); /** @brief Check if the gpu secure mode is supported. * @return MALI_TRUE if supported, otherwise MALI_FALSE. */ mali_bool _mali_osk_gpu_secure_mode_is_supported(void); /** @} */ /* end group _mali_osk_miscellaneous */ #ifdef __cplusplus } #endif #endif /* __MALI_OSK_MALI_H__ */
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Prototypes of actor functions */ #ifndef TINSEL_ACTOR_H // prevent multiple includes #define TINSEL_ACTOR_H #include "tinsel/dw.h" // for SCNHANDLE #include "tinsel/events.h" // for TINSEL_EVENT #include "tinsel/palette.h" // for COLORREF namespace Tinsel { struct FREEL; struct INT_CONTEXT; struct MOVER; struct OBJECT; #define ACTORTAG_KEY 0x1000000 #define OTH_RELATEDACTOR 0x00000fff #define OTH_RELATIVE 0x00001000 #define OTH_ABSOLUTE 0x00002000 /*----------------------------------------------------------------------*/ void RegisterActors(int num); void FreeActors(); void SetLeadId(int rid); int GetLeadId(); bool ActorIsGhost(int actor); void StartTaggedActors(SCNHANDLE ah, int numActors, bool bRunScript); void DropActors(); // No actor reels running void DisableActor(int actor); void EnableActor(int actor); void Tag_Actor(int ano, SCNHANDLE tagtext, int tp); void UnTagActor(int ano); void ReTagActor(int ano); int TagType(int ano); bool actorAlive(int ano); int32 actorMaskType(int ano); void GetActorPos(int ano, int *x, int *y); void SetActorPos(int ano, int x, int y); void GetActorMidTop(int ano, int *x, int *y); int GetActorLeft(int ano); int GetActorRight(int ano); int GetActorTop(int ano); int GetActorBottom(int ano); void ShowActor(CORO_PARAM, int ano); void HideActor(CORO_PARAM, int ano); bool ActorHidden(int ano); bool HideMovingActor(int id, int sf); void unHideMovingActor(int id); void restoreMovement(int id); void storeActorReel(int ano, const FREEL *reel, SCNHANDLE hFilm, OBJECT *pobj, int reelnum, int x, int y); const FREEL *actorReel(int ano); SCNHANDLE actorFilm(int ano); void SetActorPlayFilm(int ano, SCNHANDLE hFilm); SCNHANDLE GetActorPlayFilm(int ano); void SetActorTalkFilm(int ano, SCNHANDLE hFilm); SCNHANDLE GetActorTalkFilm(int ano); void SetActorTalking(int ano, bool tf); bool ActorIsTalking(int ano); void SetActorLatestFilm(int ano, SCNHANDLE hFilm); SCNHANDLE GetActorLatestFilm(int ano); void UpdateActorEsc(int ano, bool escOn, int escEvent); void UpdateActorEsc(int ano, int escEvent); bool ActorEsc(int ano); int ActorEev(int ano); void StoreActorPos(int ano, int x, int y); void StoreActorSteps(int ano, int steps); int GetActorSteps(int ano); void StoreActorZpos(int ano, int z, int column = -1); int GetActorZpos(int ano, int column); void IncLoopCount(int ano); int GetLoopCount(int ano); SCNHANDLE GetActorTag(int ano); void FirstTaggedActor(); int NextTaggedActor(); int NextTaggedActor(int previous); int AsetZPos(OBJECT *pObj, int y, int32 zFactor); void SetMoverZ(MOVER *pMover, int y, int32 zFactor); void ActorEvent(int ano, TINSEL_EVENT event, PLR_EVENT be); void storeActorAttr(int ano, int r1, int g1, int b1); COLORREF GetActorRGB(int ano); void SetActorRGB(int ano, COLORREF color); void SetActorZfactor(int ano, uint32 zFactor); uint32 GetActorZfactor(int ano); void setactorson(); void ActorsLife(int id, bool bAlive); void dwEndActor(int ano); void ActorEvent(CORO_PARAM, int ano, TINSEL_EVENT tEvent, bool bWait, int myEscape, bool *result = NULL); void GetActorTagPortion(int ano, unsigned *top, unsigned *bottom, unsigned *left, unsigned *right); SCNHANDLE GetActorTagHandle(int ano); void SetActorPointedTo(int actor, bool bPointedTo); bool ActorIsPointedTo(int actor); void SetActorTagWanted(int actor, bool bTagWanted, bool bCursor, SCNHANDLE hOverrideTag); bool ActorTagIsWanted(int actor); bool InHotSpot(int ano, int curX, int curY); int FrontTaggedActor(); void GetActorTagPos(int actor, int *pTagX, int *pTagY, bool bAbsolute); bool IsTaggedActor(int actor); void StoreActorPresFilm(int ano, SCNHANDLE hFilm, int x, int y); SCNHANDLE GetActorPresFilm(int ano); int GetActorFilmNumber(int ano); void StoreActorReel(int actor, int column, OBJECT *pObj); void NotPlayingReel(int actor, int filmNumber, int column); bool ActorReelPlaying(int actor, int column); /*----------------------------------------------------------------------*/ struct SAVED_ACTOR { short actorID; short zFactor; bool bAlive; bool bHidden; SCNHANDLE presFilm; ///< the film that reel belongs to short presRnum; ///< the present reel number short presPlayX, presPlayY; }; typedef SAVED_ACTOR *PSAVED_ACTOR; #define NUM_ZPOSITIONS 200 // Reasonable-sounding number struct Z_POSITIONS { short actor; short column; int z; }; void RestoreActorProcess(int id, INT_CONTEXT *pic); int SaveActors(PSAVED_ACTOR sActorInfo); void RestoreActors(int numActors, PSAVED_ACTOR sActorInfo); void SaveZpositions(void *zpp); void RestoreZpositions(void *zpp); void SaveActorZ(byte *saveActorZ); void RestoreActorZ(byte *saveActorZ); /*----------------------------------------------------------------------*/ } // End of namespace Tinsel #endif /* TINSEL_ACTOR_H */
#ifndef BUFIO_H #define BUFIO_H #include "def.h" #include <sys/types.h> #ifdef WINDOWS #include <Winsock2.h> #endif #define BUFIO_DEF_SIZ 256 #define BUFIO_INC_SIZ 256 class BufIo { private: char *m_buf; // buffer size_t m_len; // amount of data in the buffer size_t m_size; // buffer size size_t m_max; // max buffer size unsigned char m_valid:1; unsigned char m_socket_remote_closed:1; unsigned char m_reserved:6; ssize_t _realloc_buffer(); ssize_t _SEND(SOCKET socket, const char *buf, size_t len); ssize_t _RECV(SOCKET socket, char *buf, size_t len); public: BufIo(); ~BufIo(){ Close(); } void MaxSize(size_t len); ssize_t SetSize(size_t len); void Reset(){ m_len = 0; m_socket_remote_closed = 0; m_valid = 1; } void Close(){ if( m_buf ){ delete []m_buf; m_buf = (char *)0; } m_len = m_size = 0; } size_t Count() const { return m_len; } size_t LeftSize() const { return (m_size - m_len); } ssize_t PickUp(size_t len); ssize_t FeedIn(SOCKET sk) { return FeedIn(sk, m_size - m_len); } ssize_t FeedIn(SOCKET sk, size_t limit); ssize_t FlushOut(SOCKET sk); ssize_t Put(SOCKET sk, const char *buf, size_t len); ssize_t PutFlush(SOCKET sk, const char *buf, size_t len); const char *BasePointer() const { return m_buf; } const char *CurrentPointer() const { return (m_buf + m_len); } }; #endif // BUFIO_H
/* -*- Mode: C; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- */ /* vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 */ /* MDAnalysis --- http://www.mdanalysis.org Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors (see the file AUTHORS for the full list of names) Released under the GNU Public Licence, v2 or any higher version Please cite your use of MDAnalysis in published work: R. J. Gowers, M. Linke, J. Barnoud, T. J. E. Reddy, M. N. Melo, S. L. Seyler, D. L. Dotson, J. Domanski, S. Buchoux, I. M. Kenney, and O. Beckstein. MDAnalysis: A Python package for the rapid analysis of molecular dynamics simulations. In S. Benthall and S. Rostrup editors, Proceedings of the 15th Python in Science Conference, pages 102-109, Austin, TX, 2016. SciPy. N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein. MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 */ #include "xdrfile.h" #include "xdrfile_xtc.h" #include "xtc_seek.h" #include <stdio.h> #include <stdlib.h> enum { FALSE, TRUE }; int read_xtc_n_frames(char *fn, int *n_frames, int *est_nframes, int64_t **offsets) { XDRFILE *xd; int framebytes, natoms, step; float time; int64_t filesize; if ((xd = xdrfile_open(fn, "r")) == NULL) return exdrFILENOTFOUND; if (xtc_header(xd, &natoms, &step, &time, TRUE) != exdrOK) { xdrfile_close(xd); return exdrHEADER; } if (xdr_seek(xd, 0L, SEEK_END) != exdrOK) { xdrfile_close(xd); return exdrNR; } filesize = xdr_tell(xd); /* Case of fewer than 10 atoms. Framesize known. */ if (natoms < 10) { int i; xdrfile_close(xd); framebytes = XTC_SHORTHEADER_SIZE + XTC_SHORT_BYTESPERATOM * natoms; *n_frames = filesize / framebytes; /* Should we complain if framesize doesn't divide filesize? */ /* Allocate memory for the frame index array */ if ((*offsets = malloc(sizeof(int64_t) * (*n_frames))) == NULL) return exdrNOMEM; for (i = 0; i < *n_frames; i++) { (*offsets)[i] = i * framebytes; } *est_nframes = *n_frames; return exdrOK; } else /* No easy way out. We must iterate. */ { /* Estimation of number of frames, with 20% allowance for error. */ if (xdr_seek(xd, (int64_t)XTC_HEADER_SIZE, SEEK_SET) != exdrOK) { xdrfile_close(xd); return exdrNR; } if (xdrfile_read_int(&framebytes, 1, xd) == 0) { xdrfile_close(xd); return exdrENDOFFILE; } framebytes = (framebytes + 3) & ~0x03; // Rounding to the next 32-bit boundary *est_nframes = (int)(filesize / ((int64_t)(framebytes + XTC_HEADER_SIZE)) + 1); // add one because it'd be easy to underestimate low // frame numbers. *est_nframes += *est_nframes / 5; /* Allocate memory for the frame index array */ if ((*offsets = malloc(sizeof(int64_t) * *est_nframes)) == NULL) { xdrfile_close(xd); return exdrNOMEM; } (*offsets)[0] = 0L; *n_frames = 1; while (1) { if (xdr_seek(xd, (int64_t)(framebytes + XTC_HEADER_SIZE), SEEK_CUR) != exdrOK) { free(*offsets); xdrfile_close(xd); return exdrNR; } if (xdrfile_read_int(&framebytes, 1, xd) == 0) break; /* Read was successful; this is another frame */ /* Check if we need to enlarge array */ if (*n_frames == *est_nframes) { *est_nframes += *est_nframes / 5 + 1; // Increase in 20% stretches if ((*offsets = realloc(*offsets, sizeof(int64_t) * *est_nframes)) == NULL) { free(*offsets); xdrfile_close(xd); return exdrNOMEM; } } (*offsets)[*n_frames] = xdr_tell(xd) - 4L - (int64_t)(XTC_HEADER_SIZE); // Account for the // header and the // nbytes bytes we // read. (*n_frames)++; framebytes = (framebytes + 3) & ~0x03; // Rounding to the next 32-bit boundary } xdrfile_close(xd); return exdrOK; } }
/* * uistatusbar.h - GTK only, Statusbar implementation * * Written by * groepaz <groepaz@gmx.net> * * This file is part of VICE, the Versatile Commodore Emulator. * See README for copyright notice. * * 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 UISTATUSBAR_H_ #define UISTATUSBAR_H_ #include "uiarch.h" extern GtkWidget *ui_create_status_bar(GtkWidget *pane); extern void ui_init_checkbox_style(void); extern int statusbar_get_height(video_canvas_t *canvas); #endif
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/tags/release-1-1-1/engines/tinsel/actors.h $ * $Id: actors.h 45616 2009-11-02 21:54:57Z fingolfin $ * * Prototypes of actor functions */ #ifndef TINSEL_ACTOR_H // prevent multiple includes #define TINSEL_ACTOR_H #include "tinsel/dw.h" // for SCNHANDLE #include "tinsel/events.h" // for TINSEL_EVENT #include "tinsel/palette.h" // for COLORREF namespace Tinsel { struct FREEL; struct INT_CONTEXT; struct MOVER; struct OBJECT; #define ACTORTAG_KEY 0x1000000 #define OTH_RELATEDACTOR 0x00000fff #define OTH_RELATIVE 0x00001000 #define OTH_ABSOLUTE 0x00002000 /*----------------------------------------------------------------------*/ void RegisterActors(int num); void FreeActors(); void SetLeadId(int rid); int GetLeadId(); bool ActorIsGhost(int actor); void StartTaggedActors(SCNHANDLE ah, int numActors, bool bRunScript); void DropActors(); // No actor reels running void DisableActor(int actor); void EnableActor(int actor); void Tag_Actor(int ano, SCNHANDLE tagtext, int tp); void UnTagActor(int ano); void ReTagActor(int ano); int TagType(int ano); bool actorAlive(int ano); int32 actorMaskType(int ano); void GetActorPos(int ano, int *x, int *y); void SetActorPos(int ano, int x, int y); void GetActorMidTop(int ano, int *x, int *y); int GetActorLeft(int ano); int GetActorRight(int ano); int GetActorTop(int ano); int GetActorBottom(int ano); void ShowActor(CORO_PARAM, int ano); void HideActor(CORO_PARAM, int ano); bool ActorHidden(int ano); bool HideMovingActor(int id, int sf); void unHideMovingActor(int id); void restoreMovement(int id); void storeActorReel(int ano, const FREEL *reel, SCNHANDLE hFilm, OBJECT *pobj, int reelnum, int x, int y); const FREEL *actorReel(int ano); SCNHANDLE actorFilm(int ano); void SetActorPlayFilm(int ano, SCNHANDLE hFilm); SCNHANDLE GetActorPlayFilm(int ano); void SetActorTalkFilm(int ano, SCNHANDLE hFilm); SCNHANDLE GetActorTalkFilm(int ano); void SetActorTalking(int ano, bool tf); bool ActorIsTalking(int ano); void SetActorLatestFilm(int ano, SCNHANDLE hFilm); SCNHANDLE GetActorLatestFilm(int ano); void UpdateActorEsc(int ano, bool escOn, int escEvent); void UpdateActorEsc(int ano, int escEvent); bool ActorEsc(int ano); int ActorEev(int ano); void StoreActorPos(int ano, int x, int y); void StoreActorSteps(int ano, int steps); int GetActorSteps(int ano); void StoreActorZpos(int ano, int z, int column = -1); int GetActorZpos(int ano, int column); void IncLoopCount(int ano); int GetLoopCount(int ano); SCNHANDLE GetActorTag(int ano); void FirstTaggedActor(); int NextTaggedActor(); int NextTaggedActor(int previous); int AsetZPos(OBJECT *pObj, int y, int32 zFactor); void SetMoverZ(MOVER *pMover, int y, int32 zFactor); void ActorEvent(int ano, TINSEL_EVENT event, PLR_EVENT be); void storeActorAttr(int ano, int r1, int g1, int b1); COLORREF GetActorRGB(int ano); void SetActorRGB(int ano, COLORREF colour); void SetActorZfactor(int ano, uint32 zFactor); uint32 GetActorZfactor(int ano); void setactorson(); void ActorsLife(int id, bool bAlive); void dwEndActor(int ano); void ActorEvent(CORO_PARAM, int ano, TINSEL_EVENT tEvent, bool bWait, int myEscape, bool *result = NULL); void GetActorTagPortion(int ano, unsigned *top, unsigned *bottom, unsigned *left, unsigned *right); SCNHANDLE GetActorTagHandle(int ano); void SetActorPointedTo(int actor, bool bPointedTo); bool ActorIsPointedTo(int actor); void SetActorTagWanted(int actor, bool bTagWanted, bool bCursor, SCNHANDLE hOverrideTag); bool ActorTagIsWanted(int actor); bool InHotSpot(int ano, int curX, int curY); int FrontTaggedActor(); void GetActorTagPos(int actor, int *pTagX, int *pTagY, bool bAbsolute); bool IsTaggedActor(int actor); void StoreActorPresFilm(int ano, SCNHANDLE hFilm, int x, int y); SCNHANDLE GetActorPresFilm(int ano); int GetActorFilmNumber(int ano); void StoreActorReel(int actor, int column, OBJECT *pObj); void NotPlayingReel(int actor, int filmNumber, int column); bool ActorReelPlaying(int actor, int column); /*----------------------------------------------------------------------*/ struct SAVED_ACTOR { short actorID; short zFactor; bool bAlive; bool bHidden; SCNHANDLE presFilm; ///< the film that reel belongs to short presRnum; ///< the present reel number short presPlayX, presPlayY; }; typedef SAVED_ACTOR *PSAVED_ACTOR; #define NUM_ZPOSITIONS 200 // Reasonable-sounding number struct Z_POSITIONS { short actor; short column; int z; }; void RestoreActorProcess(int id, INT_CONTEXT *pic); int SaveActors(PSAVED_ACTOR sActorInfo); void RestoreActors(int numActors, PSAVED_ACTOR sActorInfo); void SaveZpositions(void *zpp); void RestoreZpositions(void *zpp); void SaveActorZ(byte *saveActorZ); void RestoreActorZ(byte *saveActorZ); /*----------------------------------------------------------------------*/ } // End of namespace Tinsel #endif /* TINSEL_ACTOR_H */
/** * Copyright (C) 2007-2008 Felipe Contreras * * Purple is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * source distribution. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef PECAN_UTIL_H #define PECAN_UTIL_H #include <glib.h> /** * Parses the MSN message formatting into a format compatible with Purple. * * @param mime The mime header with the formatting. * @param pre_ret The returned prefix string. * @param post_ret The returned postfix string. * * @return The new message. */ void msn_parse_format(const char *mime, char **pre_ret, char **post_ret); /** * Parses the Purple message formatting (html) into the MSN format. * * @param html The html message to format. * @param attributes The returned attributes string. * @param message The returned message string. * * @return The new message. */ void msn_import_html(const char *html, char **attributes, char **message); void pecan_handle_challenge (const gchar *input, const gchar *product_id, gchar *output); void msn_parse_socket(const char *str, char **ret_host, int *ret_port); char *msn_rand_guid(void); gchar *pecan_normalize (const gchar *str); #if !GLIB_CHECK_VERSION(2,12,0) void g_hash_table_remove_all (GHashTable *hash_table); #endif /* !GLIB_CHECK_VERSION(2,12,0) */ gpointer g_hash_table_peek_first (GHashTable *hash_table); gboolean g_ascii_strcase_equal (gconstpointer v1, gconstpointer v2); guint g_ascii_strcase_hash (gconstpointer v); #endif /* PECAN_UTIL_H */
/******************************************************************************* * Open Settlers - A Game Engine to run the Settlers 1-4 * Copyright (C) 2016 Gary The Brown * * 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; ONLY version 2 * of the License. *******************************************************************************/ #ifndef OSDATAFILE_FILETYPES_LAYOUT_MENULAYOUT_H #define OSDATAFILE_FILETYPES_LAYOUT_MENULAYOUT_H #include <string> #include <vector> #include <utility> #include <algorithm> #include <libxml/tree.h> #include "../../../Functions/Image/RGBA.h" #include "../../../Functions/File/DataReader.h" #include "../../../Functions/To.h" #include "../../../Log.h" #include "../../APILEVELS.h" #include "../FileTypes.h" #include "GUIItems/GUIImageData.h" #include "GUIItems/GUIButtonData.h" #include "GUIItems/GUITextData.h" #include "GUIItems/GUIBoxData.h" #include "GUIItems/GUIItemNew.h" namespace OSData{ class MenuLayout : public FileTypes { private: unsigned int APIVersion = APILEVEL::MENULAYOUT; unsigned int menuID = 0; std::string title; RGBA backgroundColour; std::vector<GUIItemData*>* itemData = NULL; void CheckValues(std::string name, std::string value); public: MenuLayout(unsigned int menuID,std::string title,RGBA backgroundColour,std::vector<GUIItemData*>* itemData); explicit MenuLayout(Functions::DataReader* reader); explicit MenuLayout(xmlNode* node); virtual ~MenuLayout(); const unsigned int MenuID(){return menuID;} const std::string Title(){return title;} const RGBA BackgroundColour(){return backgroundColour;} std::vector<GUIItemData*>* ItemData(){return this->itemData;}; bool ToSaveToData(std::vector<char>* data = NULL); bool ImageToNumbers(std::vector<Functions::RGBImage*>* images, std::vector<std::string>* imageLocations = NULL); bool LinkNumbers(std::vector<Functions::RGBImage*>* images); std::string ToString(); //Search and sort functions bool operator < (const MenuLayout& str) const {return (this->menuID < str.menuID);}; }; } #endif
#include <linux/mm.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/init.h> #include <linux/init_task.h> #include <linux/fs.h> #include <linux/mqueue.h> #include <asm/uaccess.h> static struct fs_struct init_fs = INIT_FS; static struct files_struct init_files = INIT_FILES; #include <linux/init_signals.h> static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); struct mm_struct init_mm = INIT_MM(init_mm); EXPORT_SYMBOL(init_mm); /* * Initial thread structure. * * We need to make sure that this is 16384-byte aligned due to the * way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ union thread_union init_thread_union __attribute__((__section__(".data.init_task"))) = { INIT_THREAD_INFO(init_task) }; /* * Initial task structure. * * All other task structs will be allocated on slabs in fork.c */ struct task_struct init_task = INIT_TASK(init_task); EXPORT_SYMBOL(init_task);
/* * Old U-boot compatibility for Taishan * * Author: Hugh Blemings <hugh@au.ibm.com> * * Copyright 2007 Hugh Blemings, IBM Corporation. * Based on cuboot-ebony.c which is: * Copyright 2007 David Gibson, IBM Corporation. * Based on cuboot-83xx.c, which is: * Copyright (c) 2007 Freescale Semiconductor, Inc. * * 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 "ops.h" #include "stdio.h" #include "cuboot.h" #include "reg.h" #include "dcr.h" #include "4xx.h" #define TARGET_4xx #define TARGET_44x #define TARGET_440GX #include "ppcboot.h" static bd_t bd; BSS_STACK(4096); static void taishan_fixups(void) { /* FIXME: sysclk should be derived by reading the FPGA registers */ unsigned long sysclk = 33000000; ibm440gx_fixup_clocks(sysclk, 6 * 1843200, 25000000); ibm4xx_sdram_fixup_memsize(); dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr); dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr); ibm4xx_fixup_ebc_ranges("/plb/opb/ebc"); } void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) { CUBOOT_INIT(); platform_ops.fixups = taishan_fixups; fdt_init(_dtb_start); serial_console_init(); }
/*****************************************************************************\ * $Id: cerebro_config_module.h,v 1.9 2010-02-02 01:01:20 chu11 Exp $ ***************************************************************************** * Copyright (C) 2007-2018 Lawrence Livermore National Security, LLC. * Copyright (C) 2005-2007 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Albert Chu <chu11@llnl.gov>. * UCRL-CODE-155989 All rights reserved. * * This file is part of Cerebro, a collection of cluster monitoring * tools and libraries. For details, see * <http://www.llnl.gov/linux/cerebro/>. * * Cerebro 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. * * Cerebro 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 Cerebro. If not, see <http://www.gnu.org/licenses/>. \*****************************************************************************/ #ifndef _CEREBRO_CONFIG_MODULE_H #define _CEREBRO_CONFIG_MODULE_H #include <cerebro/cerebro_config.h> #define CEREBRO_CONFIG_INTERFACE_VERSION 1 /* * Cerebro_config_interface_version * * function prototype for config module function to return the * current config interface version. Should always return * current value of macro CEREBRO_CONFIG_INTERFACE_VERSION. * * Returns version number on success, -1 one error */ typedef int (*Cerebro_config_interface_version)(void); /* * Cerebro_config_setup * * function prototype for config module function to setup the * module. Required to be defined by each config module. * * Returns 0 on success, -1 on error */ typedef int (*Cerebro_config_setup)(void); /* * Cerebro_config_cleanup * * function prototype for config module function to cleanup. Required * to be defined by each config module. * * Returns 0 on success, -1 on error */ typedef int (*Cerebro_config_cleanup)(void); /* * Cerebro_config_load_config * * function prototype for config module function to alter default * cerebro configuration values. Required to be defined by each * config module. * * Returns 0 on success, -1 on error */ typedef int (*Cerebro_config_load_config)(struct cerebro_config *conf); /* * struct cerebro_config_module_info * * contains config module information and operations. Required to be * defined in each config module. */ struct cerebro_config_module_info { char *config_module_name; Cerebro_config_interface_version interface_version; Cerebro_config_setup setup; Cerebro_config_cleanup cleanup; Cerebro_config_load_config load_config; }; #endif /* _CEREBRO_CONFIG_MODULE_H */
/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. Contributed by Norbert Podhorszki (Oak Ridge National Laboratory) ------------------------------------------------------------------------- */ #ifdef READER_CLASS ReaderStyle(adios, ReaderADIOS) #else #ifndef LMP_READER_ADIOS_H #define LMP_READER_ADIOS_H #include "reader.h" #include <map> #include <string> #include <vector> namespace LAMMPS_NS { class ReadADIOSInternal; class ReaderADIOS : public Reader { public: ReaderADIOS(class LAMMPS *); virtual ~ReaderADIOS(); virtual void settings(int, char **); virtual int read_time(bigint &); virtual void skip(); virtual bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, int &, int &, int &); virtual void read_atoms(int, int, double **); virtual void open_file(const char *); virtual void close_file(); private: int *fieldindex; // mapping of input fields to dump uint64_t nAtomsTotal; // current number of atoms in entire dump step uint64_t nAtoms; // current number of atoms for this process // (Sum(nAtoms)=nAtomsTotal) uint64_t atomOffset; // starting atom position for this process to read bigint nstep; // current (time) step number bigint nid; // current atom id. int me; ReadADIOSInternal *internal; int find_label(const std::string &label, const std::map<std::string, int> &labels); }; } // namespace LAMMPS_NS #endif #endif
#include <signal.h> /* * Calling signal() is a non-portable, as it varies in meaning between * platforms and depending on feature macros, and has stupid semantics * at least some of the time. * * This function provides the same interface as the libc function, but * provides consistent semantics. It assumes POSIX semantics for * sigaction() (so you might need to do some more work if you port to * something ancient like SunOS 4) */ void (*putty_signal(int sig, void (*func)(int)))(int) { struct sigaction sa; struct sigaction old; sa.sa_handler = func; if(sigemptyset(&sa.sa_mask) < 0) return SIG_ERR; sa.sa_flags = SA_RESTART; if(sigaction(sig, &sa, &old) < 0) return SIG_ERR; return old.sa_handler; } /* Local Variables: c-basic-offset:4 comment-column:40 End: */
/* * DNxHD/VC-3 parser * Copyright (c) 2008 Baptiste Coudurier <baptiste.coudurier@free.fr> * * This file is part of Libav. * * Libav is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * Libav is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * DNxHD/VC-3 parser */ #include "parser.h" #define DNXHD_HEADER_PREFIX 0x0000028001 static int dnxhd_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) { uint64_t state = pc->state64; int pic_found = pc->frame_start_found; int i = 0; if (!pic_found) { for (i = 0; i < buf_size; i++) { state = (state<<8) | buf[i]; if ((state & 0xffffffffffLL) == DNXHD_HEADER_PREFIX) { i++; pic_found = 1; break; } } } if (pic_found) { if (!buf_size) /* EOF considered as end of frame */ return 0; for (; i < buf_size; i++) { state = (state<<8) | buf[i]; if ((state & 0xffffffffffLL) == DNXHD_HEADER_PREFIX) { pc->frame_start_found = 0; pc->state64 = -1; return i-4; } } } pc->frame_start_found = pic_found; pc->state64 = state; return END_NOT_FOUND; } static int dnxhd_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { ParseContext *pc = s->priv_data; int next; if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { next = buf_size; } else { next = dnxhd_find_frame_end(pc, buf, buf_size); if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; *poutbuf_size = 0; return buf_size; } } *poutbuf = buf; *poutbuf_size = buf_size; return next; } AVCodecParser ff_dnxhd_parser = { { CODEC_ID_DNXHD }, sizeof(ParseContext), NULL, dnxhd_parse, ff_parse_close, };
/* * Copyright (C) 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include "CSSValue.h" #include <wtf/RefPtr.h> namespace WebCore { class CSSPrimitiveValue; enum LineBoxContainFlags { LineBoxContainNone = 0x0, LineBoxContainBlock = 0x1, LineBoxContainInline = 0x2, LineBoxContainFont = 0x4, LineBoxContainGlyphs = 0x8, LineBoxContainReplaced = 0x10, LineBoxContainInlineBox = 0x20, LineBoxContainInitialLetter = 0x40 }; typedef unsigned LineBoxContain; // Used for text-CSSLineBoxContain and box-CSSLineBoxContain class CSSLineBoxContainValue final : public CSSValue { public: static Ref<CSSLineBoxContainValue> create(LineBoxContain value) { return adoptRef(*new CSSLineBoxContainValue(value)); } String customCSSText() const; bool equals(const CSSLineBoxContainValue& other) const { return m_value == other.m_value; } LineBoxContain value() const { return m_value; } private: explicit CSSLineBoxContainValue(LineBoxContain); LineBoxContain m_value; }; } // namespace WebCore SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSLineBoxContainValue, isLineBoxContainValue())
/**************************************************************************** * (C) Copyright 2008 Samsung Electronics Co., Ltd., All rights reserved * * [File Name] :s3c-otg-roothub.h * [Description] : The Header file defines the external and internal functions of RootHub. * [Department] : System LSI Division/Embedded S/W Platform * [Created Date]: 2008/06/13 * [Revision History] * - Created this file and defines functions of RootHub * ****************************************************************************/ /**************************************************************************** * 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 _ROOTHUB_H_ #define _ROOTHUB_H_ #ifdef __cplusplus extern "C" { #endif #include "s3c-otg-common-errorcode.h" #include "s3c-otg-common-regdef.h" #include "s3c-otg-common-datastruct.h" #include "s3c-otg-hcdi-kal.h" #include "s3c-otg-hcdi-memory.h" #include "s3c-otg-oci.h" typedef union _port_flags_t { /** raw register data */ u32 d32; /** register bits */ struct { unsigned port_connect_status_change : 1; unsigned port_connect_status : 1; unsigned port_reset_change : 1; unsigned port_enable_change : 1; unsigned port_suspend_change : 1; unsigned port_over_current_change : 1; unsigned reserved : 27; } b; }port_flags_t; __inline__ int root_hub_feature(const u8 port, const u16 typeReq, const u16 feature, void *buf ); __inline__ int get_otg_port_status(const u8 port, char *status); int reset_and_enable_port(const u8 port); void bus_suspend(void); int bus_resume(void); #ifdef __cplusplus } #endif #endif /* _ROOTHUB_H_ */
/* * Copyright (c) 2013-2014 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * BSD license below: * * 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. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef _FI_PSM_VERSION_H_ #define _FI_PSM_VERSION_H_ #define PSMX_VERSION 2 #include "rename.h" #endif
/* * CPPC (Collaborative Processor Performance Control) driver for * interfacing with the CPUfreq layer and governors. See * cppc_acpi.c for CPPC specific methods. * * (C) Copyright 2014, 2015 Linaro Ltd. * Author: Ashwin Chaugule <ashwin.chaugule@linaro.org> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 * of the License. */ #define pr_fmt(fmt) "CPPC Cpufreq:" fmt #include <linux/kernel.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/cpu.h> #include <linux/cpufreq.h> #include <linux/vmalloc.h> #include <acpi/cppc_acpi.h> /* * These structs contain information parsed from per CPU * ACPI _CPC structures. * e.g. For each CPU the highest, lowest supported * performance capabilities, desired performance level * requested etc. */ static struct cppc_cpudata **all_cpu_data; static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation) { struct cppc_cpudata *cpu; struct cpufreq_freqs freqs; int ret = 0; cpu = all_cpu_data[policy->cpu]; cpu->perf_ctrls.desired_perf = target_freq; freqs.old = policy->cur; freqs.new = target_freq; cpufreq_freq_transition_begin(policy, &freqs); ret = cppc_set_perf(cpu->cpu, &cpu->perf_ctrls); cpufreq_freq_transition_end(policy, &freqs, ret != 0); if (ret) pr_debug("Failed to set target on CPU:%d. ret:%d\n", cpu->cpu, ret); return ret; } static int cppc_verify_policy(struct cpufreq_policy *policy) { cpufreq_verify_within_cpu_limits(policy); return 0; } static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy) { int cpu_num = policy->cpu; struct cppc_cpudata *cpu = all_cpu_data[cpu_num]; int ret; cpu->perf_ctrls.desired_perf = cpu->perf_caps.lowest_perf; ret = cppc_set_perf(cpu_num, &cpu->perf_ctrls); if (ret) pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n", cpu->perf_caps.lowest_perf, cpu_num, ret); } static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) { struct cppc_cpudata *cpu; unsigned int cpu_num = policy->cpu; int ret = 0; cpu = all_cpu_data[policy->cpu]; cpu->cpu = cpu_num; ret = cppc_get_perf_caps(policy->cpu, &cpu->perf_caps); if (ret) { pr_debug("Err reading CPU%d perf capabilities. ret:%d\n", cpu_num, ret); return ret; } policy->min = cpu->perf_caps.lowest_perf; policy->max = cpu->perf_caps.highest_perf; policy->cpuinfo.min_freq = policy->min; policy->cpuinfo.max_freq = policy->max; policy->cpuinfo.transition_latency = cppc_get_transition_latency(cpu_num); policy->shared_type = cpu->shared_type; if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) cpumask_copy(policy->cpus, cpu->shared_cpu_map); else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) { /* Support only SW_ANY for now. */ pr_debug("Unsupported CPU co-ord type\n"); return -EFAULT; } cpumask_set_cpu(policy->cpu, policy->cpus); cpu->cur_policy = policy; /* Set policy->cur to max now. The governors will adjust later. */ policy->cur = cpu->perf_ctrls.desired_perf = cpu->perf_caps.highest_perf; ret = cppc_set_perf(cpu_num, &cpu->perf_ctrls); if (ret) pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n", cpu->perf_caps.highest_perf, cpu_num, ret); return ret; } static struct cpufreq_driver cppc_cpufreq_driver = { .flags = CPUFREQ_CONST_LOOPS, .verify = cppc_verify_policy, .target = cppc_cpufreq_set_target, .init = cppc_cpufreq_cpu_init, .stop_cpu = cppc_cpufreq_stop_cpu, .name = "cppc_cpufreq", }; static int __init cppc_cpufreq_init(void) { int i, ret = 0; struct cppc_cpudata *cpu; if (acpi_disabled) return -ENODEV; all_cpu_data = kzalloc(sizeof(void *) * num_possible_cpus(), GFP_KERNEL); if (!all_cpu_data) return -ENOMEM; for_each_possible_cpu(i) { all_cpu_data[i] = kzalloc(sizeof(struct cppc_cpudata), GFP_KERNEL); if (!all_cpu_data[i]) goto out; cpu = all_cpu_data[i]; if (!zalloc_cpumask_var(&cpu->shared_cpu_map, GFP_KERNEL)) goto out; } ret = acpi_get_psd_map(all_cpu_data); if (ret) { pr_debug("Error parsing PSD data. Aborting cpufreq registration.\n"); goto out; } ret = cpufreq_register_driver(&cppc_cpufreq_driver); if (ret) goto out; return ret; out: for_each_possible_cpu(i) kfree(all_cpu_data[i]); kfree(all_cpu_data); return -ENODEV; } static void __exit cppc_cpufreq_exit(void) { struct cppc_cpudata *cpu; int i; cpufreq_unregister_driver(&cppc_cpufreq_driver); for_each_possible_cpu(i) { cpu = all_cpu_data[i]; free_cpumask_var(cpu->shared_cpu_map); kfree(cpu); } kfree(all_cpu_data); } module_exit(cppc_cpufreq_exit); MODULE_AUTHOR("Ashwin Chaugule"); MODULE_DESCRIPTION("CPUFreq driver based on the ACPI CPPC v5.0+ spec"); MODULE_LICENSE("GPL"); late_initcall(cppc_cpufreq_init);
#ifndef __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H #include <mach/hardware.h> /* * Physical DRAM offset. */ #define PLAT_PHYS_OFFSET UL(0x00000000) #ifndef __ASSEMBLY__ #if defined(CONFIG_ARCH_IOP13XX) #define IOP13XX_PMMR_V_START (IOP13XX_PMMR_VIRT_MEM_BASE) #define IOP13XX_PMMR_V_END (IOP13XX_PMMR_VIRT_MEM_BASE + IOP13XX_PMMR_SIZE) #define IOP13XX_PMMR_P_START (IOP13XX_PMMR_PHYS_MEM_BASE) #define IOP13XX_PMMR_P_END (IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_SIZE) static inline dma_addr_t __virt_to_lbus(unsigned long x) { return x + IOP13XX_PMMR_PHYS_MEM_BASE - IOP13XX_PMMR_VIRT_MEM_BASE; } static inline unsigned long __lbus_to_virt(dma_addr_t x) { return x + IOP13XX_PMMR_VIRT_MEM_BASE - IOP13XX_PMMR_PHYS_MEM_BASE; } #define __is_lbus_dma(a) \ ((a) >= IOP13XX_PMMR_P_START && (a) < IOP13XX_PMMR_P_END) #define __is_lbus_virt(a) \ ((a) >= IOP13XX_PMMR_V_START && (a) < IOP13XX_PMMR_V_END) /* Device is an lbus device if it is on the platform bus of the IOP13XX */ #define is_lbus_device(dev) \ (dev && strncmp(dev->bus->name, "platform", 8) == 0) #define __arch_dma_to_virt(dev, addr) \ ({ \ unsigned long __virt; \ dma_addr_t __dma = addr; \ if (is_lbus_device(dev) && __is_lbus_dma(__dma)) \ __virt = __lbus_to_virt(__dma); \ else \ __virt = __phys_to_virt(__dma); \ (void *)__virt; \ }) #define __arch_virt_to_dma(dev, addr) \ ({ \ unsigned long __virt = (unsigned long)addr; \ dma_addr_t __dma; \ if (is_lbus_device(dev) && __is_lbus_virt(__virt)) \ __dma = __virt_to_lbus(__virt); \ else \ __dma = __virt_to_phys(__virt); \ __dma; \ }) #define __arch_pfn_to_dma(dev, pfn) \ ({ \ /* __is_lbus_virt() can never be true for RAM pages */ \ (dma_addr_t)__pfn_to_phys(pfn); \ }) #define __arch_dma_to_pfn(dev, addr) __phys_to_pfn(addr) #endif /* CONFIG_ARCH_IOP13XX */ #endif /* !ASSEMBLY */ #endif
/*************************************************************************** * * Author: "Jasenko Zivanov" * MRC Laboratory of Molecular Biology * * 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. * * This complete copyright notice must be included in any revised version of the * source code. Additional authorship citations may be added, but existing * author citations must be preserved. ***************************************************************************/ #ifndef SPECTRAL_HELPER_H #define SPECTRAL_HELPER_H #include <src/image.h> class SpectralHelper { public: static void computePhase(const Image<Complex>& src, Image<RFLOAT>& dest); static void computeAbs(const Image<Complex>& src, Image<RFLOAT>& dest); }; #endif
/**** ** Platform-dependent file ****/ /* io.h - Virtual disk input/output Copyright (C) 1993 Werner Almesberger <werner.almesberger@lrc.di.epfl.ch> Copyright (C) 1998 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> Copyright (C) 2008-2014 Daniel Baumann <mail@daniel-baumann.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 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/>. The complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-3 file. */ /* FAT32, VFAT, Atari format support, and various fixes additions May 1998 * by Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> */ #ifndef _IO_H #define _IO_H //#include <sys/types.h> /* for loff_t */ // #include <fcntl.h> /* for off_t */ void fs_open(PUNICODE_STRING DriveRoot, int read_write); /* Opens the file system PATH. If RW is zero, the file system is opened read-only, otherwise, it is opened read-write. */ BOOLEAN fs_isdirty(void); /* Checks if filesystem is dirty */ void fs_read(off_t pos, int size, void *data); /* Reads SIZE bytes starting at POS into DATA. Performs all applicable changes. */ int fs_test(off_t pos, int size); /* Returns a non-zero integer if SIZE bytes starting at POS can be read without errors. Otherwise, it returns zero. */ void fs_write(off_t pos, int size, void *data); /* If write_immed is non-zero, SIZE bytes are written from DATA to the disk, starting at POS. If write_immed is zero, the change is added to a list in memory. */ int fs_close(int write); /* Closes the filesystem, performs all pending changes if WRITE is non-zero and removes the list of changes. Returns a non-zero integer if the file system has been changed since the last fs_open, zero otherwise. */ int fs_changed(void); /* Determines whether the filesystem has changed. See fs_close. */ NTSTATUS fs_lock(BOOLEAN LockVolume); /* Lock or unlocks the volume */ void fs_dismount(void); /* Dismounts the volume */ #endif
// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. */ #include <common.h> /* * CPU test * Ternary instructions instr rA,rS,UIMM * * Logic instructions: ori, oris, xori, xoris * * The test contains a pre-built table of instructions, operands and * expected results. For each table entry, the test will cyclically use * different sets of operand registers and result registers. */ #include <post.h> #include "cpu_asm.h" #if CONFIG_POST & CONFIG_SYS_POST_CPU extern void cpu_post_exec_21 (ulong *code, ulong *cr, ulong *res, ulong op); extern ulong cpu_post_makecr (long v); static struct cpu_post_threei_s { ulong cmd; ulong op1; ushort op2; ulong res; } cpu_post_threei_table[] = { { OP_ORI, 0x80000000, 0xffff, 0x8000ffff }, { OP_ORIS, 0x00008000, 0xffff, 0xffff8000 }, { OP_XORI, 0x8000ffff, 0xffff, 0x80000000 }, { OP_XORIS, 0x00008000, 0xffff, 0xffff8000 }, }; static unsigned int cpu_post_threei_size = ARRAY_SIZE(cpu_post_threei_table); int cpu_post_test_threei (void) { int ret = 0; unsigned int i, reg; int flag = disable_interrupts(); for (i = 0; i < cpu_post_threei_size && ret == 0; i++) { struct cpu_post_threei_s *test = cpu_post_threei_table + i; for (reg = 0; reg < 32 && ret == 0; reg++) { unsigned int reg0 = (reg + 0) % 32; unsigned int reg1 = (reg + 1) % 32; unsigned int stk = reg < 16 ? 31 : 15; unsigned long code[] = { ASM_STW(stk, 1, -4), ASM_ADDI(stk, 1, -16), ASM_STW(3, stk, 8), ASM_STW(reg0, stk, 4), ASM_STW(reg1, stk, 0), ASM_LWZ(reg0, stk, 8), ASM_11IX(test->cmd, reg1, reg0, test->op2), ASM_STW(reg1, stk, 8), ASM_LWZ(reg1, stk, 0), ASM_LWZ(reg0, stk, 4), ASM_LWZ(3, stk, 8), ASM_ADDI(1, stk, 16), ASM_LWZ(stk, 1, -4), ASM_BLR, }; ulong res; ulong cr; cr = 0; cpu_post_exec_21 (code, & cr, & res, test->op1); ret = res == test->res && cr == 0 ? 0 : -1; if (ret != 0) { post_log ("Error at threei test %d !\n", i); } } } if (flag) enable_interrupts(); return ret; } #endif
/* * videobuf2-memops.h - generic memory handling routines for videobuf2 * * Copyright (C) 2010 Samsung Electronics * * Author: Pawel Osciak <pawel@osciak.com> * Marek Szyprowski <m.szyprowski@samsung.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. */ #ifndef _MEDIA_VIDEOBUF2_MEMOPS_H #define _MEDIA_VIDEOBUF2_MEMOPS_H #include <media/videobuf2-core.h> /** * vb2_vmarea_handler - common vma refcount tracking handler * @refcount: pointer to refcount entry in the buffer * @put: callback to function that decreases buffer refcount * @arg: argument for @put callback */ struct vb2_vmarea_handler { atomic_t *refcount; void (*put)(void *arg); void *arg; }; extern const struct vm_operations_struct vb2_common_vm_ops; int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size, struct vm_area_struct **res_vma, dma_addr_t *res_pa); int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr, unsigned long size, const struct vm_operations_struct *vm_ops, void *priv); struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma); void vb2_put_vma(struct vm_area_struct *vma); #endif
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include "mscorlib_System_Enum.h" #include "mscorlib_System_IO_SeekOrigin.h" // System.IO.SeekOrigin struct SeekOrigin_t938 { // System.Int32 System.IO.SeekOrigin::value__ int32_t ___value___1; };
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> // UnityEngine.SocialPlatforms.IScore[] struct IScoreU5BU5D_t237; // System.IAsyncResult struct IAsyncResult_t47; // System.AsyncCallback struct AsyncCallback_t48; // System.Object struct Object_t; #include "mscorlib_System_MulticastDelegate.h" #include "mscorlib_System_Void.h" // System.Action`1<UnityEngine.SocialPlatforms.IScore[]> struct Action_1_t21 : public MulticastDelegate_t46 { };
/** * @addtogroup pilote_arm_timer * @{ */ /** * @file timer_parametres_possibles.h * * @brief D�finition des constantes utilisables pour param�trer les timers du microcontr�leur OKI ML675001 * * $Author$ * $Date$ * * @version 2.0 * $Revision$ */ #ifndef H_TIMER_PARAMETRES_POSSIBLES #define H_TIMER_PARAMETRES_POSSIBLES /** * @name Modes de fonctionnement des timers * @{ */ /** @brief Timer configur� en comptage d'intervalle */ #define TIMER_INTERVAL 0 /** @brief Timer configur� en mode "one-shot" */ #define TIMER_ONE_SHOT 1 /** @} */ /** * @name D�marrage/arr�t d'un timer * @{ */ /** @brief Commande de d�marrage d'un timer */ #define TIMER_DEMARRER 1 /** @brief Commande d'arr�t d'un timer */ #define TIMER_ARRETER 0 /** @} */ /** * @name Gestion des �v�nements * @{ */ /** @brief Commande d'activation des demandes d'interruptions */ #define TIMER_ACTIVER_INTERRUPTIONS 1 /** @brief Commande de d�sactivation des demandes d'interruptions */ #define TIMER_DESACTIVER_INTERRUPTIONS 0 /** @brief Commande d'acquittement des demandes d'interruptions */ #define TIMER_ACQUITTER_INTERRUPTION 1 /** @brief Indicateur de d�bordement d'un timer */ #define TIMER_DEBORDEMENT 1 /** @} */ /** * @name R�glage des pr�diviseurs * @{ */ /** @brief Pas de pr�division */ #define TIMER_PREDIVISEUR_1 0 /** @brief Pr�division par 2 */ #define TIMER_PREDIVISEUR_2 1 /** @brief Pr�division par 4 */ #define TIMER_PREDIVISEUR_4 2 /** @brief Pr�division par 8 */ #define TIMER_PREDIVISEUR_8 3 /** @brief Pr�division par 16 */ #define TIMER_PREDIVISEUR_16 4 /** @brief Pr�division par 32 */ #define TIMER_PREDIVISEUR_32 5 /** @} */ /** * @name Autres constantes * @{ */ /** @brief Nombre de timers utilisables */ #define TIMER_NOMBRE 6 /** @brief nom du premier timer */ #define TIMER_0 0 /** @brief nom du deuxieme timer */ #define TIMER_1 1 /** @brief nom du troisieme timer */ #define TIMER_2 2 /** @brief nom du quatrieme timer */ #define TIMER_3 3 /** @brief nom du cinquieme timer */ #define TIMER_4 4 /** @brief nom du sixieme timer */ #define TIMER_5 5 /** @} */ #endif /** @} */
// WSAHeader.h // 1.0 // This file is part of OpenRedAlert. // // OpenRedAlert 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. // // OpenRedAlert 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 OpenRedAlert. If not, see <http://www.gnu.org/licenses/>. #ifndef WSAHEADER_H #define WSAHEADER_H #include "SDL/SDL_types.h" /** * Header of the WSA Movie * * WSA files contain short animations and can be found in the GENERAL.MIX files. * They are basically a series of Format40 images, that are then compressed with * Format80. * * The header is : * Header : record * NumFrames : word; {Number of frames} * X,Y : word; {Position on screen of the upper left corner} * W,H : word; {Width and height of the images} * Delta : longint; {Frames/Sec = Delta/(2^10)} * end; * * Following that there's an array of offsets : * * Offsets : array [0..NumFrames+1] of longint; * * The obtain the actual offset, you have to add 300h. * That is the size of the palette that follows the Offsets array. * As for .SHP files the two last offsets have a special meaning. * If the last offset is 0 then the one before it points to the end of file * (after you added 300h of course). * If the last one is <>0 then it points to the end of the file, and the * one before it points to a special frame that gives you the difference * between the last and the first frame. This is used when you have to loop * the animation. * * @see WSAMovie */ class WSAHeader { public: /** Number of frames in the movie */ Uint16 NumFrames; /** Position on screen of the upper left corner (absciss X) */ Uint16 xpos; /** Position on screen of the upper left corner (absciss Y) */ Uint16 ypos; /** Width of frames in the movie */ Uint16 width; /** Height of frames in the movie */ Uint16 height; /** Frames/Sec = Delta/(2^10) */ Uint32 delta; /** Offsets of images in the file */ Uint32* offsets; }; #endif //WSAHEADER_H
#ifndef MICROP_NOTIFIER_CONTROLLER_H #define MICROP_NOTIFIER_CONTROLLER_H extern int notify_register_microp_notifier(struct notifier_block *nb, char* driver_name); extern int notify_unregister_microp_notifier(struct notifier_block *nb, char* driver_name); #endif
////////////////////////////////////////////////////////////////////// // OpenTibia - an opensource roleplaying game ////////////////////////////////////////////////////////////////////// // Exception Handler class ////////////////////////////////////////////////////////////////////// // 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. ////////////////////////////////////////////////////////////////////// #if defined __EXCEPTION_TRACER__ #ifndef __OTSERV_EXCEPTION_H__ #define __OTSERV_EXCEPTION_H__ class ExceptionHandler { public: ExceptionHandler(); ~ExceptionHandler(); bool InstallHandler(); bool RemoveHandler(); static void dumpStack(); private: #if defined WIN32 || defined __WINDOWS__ #if defined _MSC_VER || defined __USE_MINIDUMP__ static long __stdcall MiniDumpExceptionHandler(struct _EXCEPTION_POINTERS *pExceptionInfo); static int ref_counter; #elif __GNUC__ struct SEHChain{ SEHChain *prev; void *SEHfunction; }; SEHChain chain; bool LoadMap(); static bool isMapLoaded; #endif #endif bool isInstalled; }; #endif #endif
#include "nps_autopilot_rotorcraft.h" #include "firmwares/rotorcraft/main.h" #include "nps_sensors.h" #include "nps_radio_control.h" #include "subsystems/radio_control.h" #include "subsystems/imu.h" #include "subsystems/sensors/baro.h" #include "baro_board.h" #include "subsystems/electrical.h" #include "mcu_periph/sys_time.h" #include "actuators/supervision.h" struct NpsAutopilot autopilot; bool_t nps_bypass_ahrs; void nps_autopilot_init(enum NpsRadioControlType type_rc, int num_rc_script, char* rc_dev) { nps_radio_control_init(type_rc, num_rc_script, rc_dev); nps_bypass_ahrs = TRUE; // nps_bypass_ahrs = FALSE; main_init(); #ifdef MAX_BAT_LEVEL electrical.vsupply = MAX_BAT_LEVEL * 10; #else electrical.vsupply = 111; #endif } void nps_autopilot_run_systime_step( void ) { sys_tick_handler(); } #include <stdio.h> #include "subsystems/gps.h" void nps_autopilot_run_step(double time __attribute__ ((unused))) { if (nps_radio_control_available(time)) { radio_control_feed(); main_event(); } if (nps_sensors_gyro_available()) { imu_feed_gyro_accel(); main_event(); } if (nps_sensors_mag_available()) { imu_feed_mag(); main_event(); } if (nps_sensors_baro_available()) { baro_feed_value(sensors.baro.value); main_event(); } if (nps_sensors_gps_available()) { gps_feed_value(); main_event(); } if (nps_bypass_ahrs) { sim_overwrite_ahrs(); } handle_periodic_tasks(); if (time < 8) { /* start with a little bit of hovering */ int32_t init_cmd[4]; init_cmd[COMMAND_THRUST] = 0.253*SUPERVISION_MAX_MOTOR; init_cmd[COMMAND_ROLL] = 0; init_cmd[COMMAND_PITCH] = 0; init_cmd[COMMAND_YAW] = 0; supervision_run(TRUE, FALSE, init_cmd); } for (uint8_t i=0; i<ACTUATORS_MKK_NB; i++) autopilot.commands[i] = (double)supervision.commands[i] / SUPERVISION_MAX_MOTOR; } #include "nps_fdm.h" #include "subsystems/ahrs.h" #include "math/pprz_algebra.h" void sim_overwrite_ahrs(void) { EULERS_BFP_OF_REAL(ahrs.ltp_to_body_euler, fdm.ltp_to_body_eulers); QUAT_BFP_OF_REAL(ahrs.ltp_to_body_quat, fdm.ltp_to_body_quat); RATES_BFP_OF_REAL(ahrs.body_rate, fdm.body_ecef_rotvel); INT32_RMAT_OF_QUAT(ahrs.ltp_to_body_rmat, ahrs.ltp_to_body_quat); }
/* ** Header file for inclusion with kword_xml2latex.c ** ** Copyright (C) 2002 Robert JACOLIN ** ** 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. ** ** To receive a copy of the GNU Library General Public License, write to the ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ** */ #ifndef __KWORD_LATEX_EXPORT_KEY_H__ #define __KWORD_LATEX_EXPORT_KEY_H__ #include <QString> //Added by qt3to4: #include <QTextStream> #include "xmlparser.h" /***********************************************************************/ /* Class: Key */ /***********************************************************************/ /** * This class hold a real paragraph. It tells about the text in this * paragraph, its format, etc. The complete text is a list of Key instances. * A footnote is a list of paragraph instances (now but not in the "futur"). */ class Key: public XmlParser { public: enum eKeyType { PIXMAP, PICTURE }; private: /* MARKUP DATA */ QString _filename; QString _name; int _hour; int _minute; int _second; int _msec; int _day; int _month; int _year; eKeyType _type; public: /** * Constructors * * Creates a new instance of Key. */ explicit Key(eKeyType); /* * Destructor * * The destructor must remove the list of little zones. */ virtual ~Key(); /** * Accessors */ /** * @return the paragraph's name. */ QString getName() const { return _name; } QString getFilename() const { return _filename; } int getHour() const { return _hour; } int getMSec() const { return _msec; } int getDay() const { return _day; } int getMinute() const { return _minute; } int getSecond() const { return _second; } int getMonth() const { return _month; } int getYear() const { return _year; } //bool notEmpty() const { return (_lines == 0) ? false : (_lines->count() != 0); } /** * Modifiers */ void setName(QString name) { _name = name; } void setFilename(QString filename) { _filename = filename; } void setHour(int hour) { _hour = hour; } void setMSec(int msec) { _msec = msec; } void setDay(int day) { _day = day; } void setMinute(int minute) { _minute = minute; } void setSecond(int second) { _second = second; } void setMonth(int month) { _month = month; } void setYear(int year) { _year = year; } /** * Helpful functions */ /** * Get information from a markup tree. */ void analyze(const QDomNode); /** * Write the paragraph in a file. */ void generate(QTextStream&); private: }; #endif /* __KWORD_LATEX_EXPORT_KEY_H__ */
/* * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. * Copyright (C) 2007 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Brian Behlendorf <behlendorf1@llnl.gov>. * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * The SPL 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 the SPL. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _SPL_MOUNT_H #define _SPL_MOUNT_H #endif /* SPL_MOUNT_H */
/* * Testing shim and API examples for the new CLI backend. * * Minimal main() to run grammar_sandbox standalone. * [split off grammar_sandbox.c 2017-01-23] * -- * Copyright (C) 2016 Cumulus Networks, Inc. * Copyright (C) 2017 David Lamparter for NetDEF, Inc. * * This file is part of FreeRangeRouting (FRR). * * FRR is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2, or (at your option) any later version. * * FRR 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 FRR; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "command.h" #include "memory_vty.h" static void vty_do_exit(void) { printf ("\nend.\n"); exit (0); } struct thread_master *master; int main(int argc, char **argv) { struct thread thread; master = thread_master_create (); zlog_default = openzlog ("grammar_sandbox", ZLOG_NONE, 0, LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON); zlog_set_level (NULL, ZLOG_DEST_SYSLOG, ZLOG_DISABLED); zlog_set_level (NULL, ZLOG_DEST_STDOUT, LOG_DEBUG); zlog_set_level (NULL, ZLOG_DEST_MONITOR, ZLOG_DISABLED); /* Library inits. */ cmd_init (1); host.name = strdup ("test"); vty_init (master); memory_init (); vty_stdio (vty_do_exit); /* Fetch next active thread. */ while (thread_fetch (master, &thread)) thread_call (&thread); /* Not reached. */ exit (0); }
/* * 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. */ #include <u.h> #include <libc.h> #include <bio.h> #include <mach.h> #define Extern extern #include "power.h" void icacheinit(void) { } void updateicache(ulong addr) { USED(addr); }
/* * SPDX-License-Identifier: GPL-2.0-or-later * * vim: set tabstop=4 syntax=c : * * Copyright (C) 2014-2020, Peter Haemmerlein (peterpawn@yourfritz.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, please look for the file LICENSE. */ // display usage help void decompose_usage(const bool help, UNUSED const bool version) { FILE * out = (help || version ? stdout : stderr); showUsageHeader(out, help, version); if (version) { fprintf(out, "\n"); return; } showPurposeHeader(out); fprintf(out, "This program splits a single export file into the settings files contained therein.\n" ); showFormatHeader(out); addSpace(); addOption("options"); showFormatEnd(out); showOptionsHeader("options"); addOptionsEntry("-o, --output " __undl("directory"), "specifies the " __undl("directory") ", where the files will be stored; this option is mandatory (and therefore not really an option)", 8); addOptionsEntry("-d, --dictionary", "create a dictionary file and store header data separately", 0); addOptionsEntryVerbose(); addOptionsEntryQuiet(); addOptionsEntryStrict(); addOptionsEntryHelp(); addOptionsEntryVersion(); showOptionsEnd(out); fprintf(out, "\nThe file with exported FRITZ!OS settings is expected on STDIN. Execution will be aborted, if STDIN\n" "is a terminal device.\n" ); fprintf(out, "\nThe output directory has to exist. Any data file therein may be overwritten without further warning.\n" "\nIf you want to create a new file to be imported from the decomposed export file, you may specify the\n" "'--dictionary' (or '-d') option to store the original header lines and a list of all contained files,\n" "preserving their order.\n" ); showUsageFinalize(out, help, version); } char * decompose_shortdesc(void) { return "split an export file, with optional decryption"; }
#ifndef _INCLUDE_CSR_DIS_H_ #define _INCLUDE_CSR_DIS_H_ #include "../../main.h" #ifndef __CYGWIN__ typedef unsigned short uint16_t ; typedef unsigned int uint32_t ; #endif #define __packed __attribute__((__packed__)) struct instruction { uint16_t in_mode:2, in_reg:2, in_opcode:4, in_operand:8; #if __sun #warning XXX related to sunstudio :O }; #else } __packed; #endif struct directive { struct instruction d_inst; int d_operand; int d_prefix; unsigned int d_off; char d_asm[128]; struct directive *d_next; }; struct label { char l_name[128]; unsigned int l_off; struct directive *l_refs[666]; int l_refc; struct label *l_next; }; struct state { int s_prefix; unsigned int s_prefix_val; FILE *s_in; unsigned int s_off; char *s_fname; int s_u; unsigned int s_labelno; const unsigned char * s_buf; struct directive s_dirs; struct label s_labels; FILE *s_out; int s_format; int s_nop; struct directive *s_nopd; int s_ff_quirk; } _state; int arch_csr_disasm(char *str, const unsigned char *b, ut64 seek); #define MODE_MASK 3 #define REG_SHIFT 2 #define REG_MASK 3 #define OPCODE_SHIFT 4 #define OPCODE_MASK 0xF #define OPERAND_SHIFT 8 #define INST_NOP 0x0000 #define INST_BRK 0x0004 #define INST_SLEEP 0x0008 #define INST_U 0x0009 #define INST_SIF 0x000C #define INST_RTS 0x00E2 #define INST_BRXL 0xfe09 #define INST_BC 0xff09 #define REG_AH 0 #define REG_AL 1 #define REG_X 2 #define REG_Y 3 #define DATA_MODE_IMMEDIATE 0 #define DATA_MODE_DIRECT 1 #define DATA_MODE_INDEXED_X 2 #define DATA_MODE_INDEXED_Y 3 #define ADDR_MODE_RELATIVE 0 #define ADDR_MODE_X_RELATIVE 2 void csr_decode(struct state *s, struct directive *d); #endif
/** * 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_HR_CONTANTS_H_ #define _U2_HR_CONTANTS_H_ #include <U2Core/global.h> #undef NO_ERROR namespace U2 { namespace WorkflowSerialize { class U2LANG_EXPORT Constants { public: static const QString BLOCK_START; static const QString BLOCK_END; static const QString SERVICE_SYM; static const QString QUOTE; static const QString NEW_LINE; static const QString UNKNOWN_ERROR; static const QString NO_ERROR; static const QString HEADER_LINE; static const QString DEPRECATED_HEADER_LINE; static const QString OLD_XML_HEADER; static const QString INCLUDE; static const QString INCLUDE_AS; static const QString BODY_START; static const QString META_START; static const QString DOT_ITERATION_START; static const QString ITERATION_START; static const QString DATAFLOW_SIGN; static const QString EQUALS_SIGN; static const QString UNDEFINED_CONSTRUCT; static const QString TYPE_ATTR; static const QString SCRIPT_ATTR; static const QString NAME_ATTR; static const QString ELEM_ID_ATTR; static const QString DOT; static const QString DASH; static const QString ITERATION_ID; static const QString PARAM_ALIASES_START; static const QString PORT_ALIASES_START; static const QString PATH_THROUGH; // -------------- backward compatibility -------------- static const QString ALIASES_HELP_START; static const QString OLD_ALIASES_START; // ---------------------------------------------------- static const QString VISUAL_START; static const QString UNDEFINED_META_BLOCK; static const QString TAB; static const QString NO_NAME; static const QString COLON; static const QString SEMICOLON; static const QString INPUT_START; static const QString OUTPUT_START; static const QString ATTRIBUTES_START; static const QString TYPE_PORT; static const QString FORMAT_PORT; static const QString CMDLINE; static const QString DESCRIPTION; static const QString PROMPTER; static const QString COMMA; static const QString MARKER; static const QString QUAL_NAME; static const QString ANN_NAME; static const QString ACTOR_BINDINGS; static const QString SOURCE_PORT; static const QString ALIAS; static const QString IN_SLOT; static const QString ACTION; static const QString OUT_SLOT_ATTR; static const QString DATASET_NAME; static const QString DB_SELECT; static const QString DB_URL; static const QString DB_OBJECT_TYPE; static const QString DB_OBJECT_ID; static const QString DB_OBJ_CACHED_NAME; static const QString DB_OBJ_NAME_FILTER; static const QString DB_SEQ_ACC_FILTER; static const QString DIRECTORY_URL; static const QString FILE_URL; static const QString PATH; static const QString EXC_FILTER; static const QString INC_FILTER; static const QString RECURSIVE; static const QString ESTIMATIONS; static const QString VALIDATOR; static const QString V_TYPE; static const QString V_SCRIPT; }; } // WorkflowSerialize } // U2 #endif // _U2_HR_CONTANTS_H_
#ifndef __COM_ERROR_H__ #define __COM_ERROR_H__ #define ERR_GENERIC 2 #define ERR_RAID 50 #define ERR_CORE 100 #define ERR_API 150 #define ERR_NONE 0 #define ERR_FAIL 1 /* generic error */ #define ERR_UNKNOWN (ERR_GENERIC + 1) #define ERR_NO_RESOURCE (ERR_GENERIC + 2) #define ERR_REQ_OUT_OF_RANGE (ERR_GENERIC + 3) #define ERR_INVALID_REQUEST (ERR_GENERIC + 4) #define ERR_INVALID_PARAMETER (ERR_GENERIC + 5) #define ERR_INVALID_LD_ID (ERR_GENERIC + 6) #define ERR_INVALID_HD_ID (ERR_GENERIC + 7) #define ERR_INVALID_EXP_ID (ERR_GENERIC + 8) #define ERR_INVALID_PM_ID (ERR_GENERIC + 9) #define ERR_INVALID_BLOCK_ID (ERR_GENERIC + 10) #define ERR_INVALID_ADAPTER_ID (ERR_GENERIC + 11) #define ERR_INVALID_RAID_MODE (ERR_GENERIC + 12) /* RAID errors */ #define ERR_TARGET_IN_LD_FUNCTIONAL (ERR_RAID + 1) #define ERR_TARGET_NO_ENOUGH_SPACE (ERR_RAID + 2) #define ERR_HD_IS_NOT_SPARE (ERR_RAID + 3) #define ERR_HD_IS_SPARE (ERR_RAID + 4) #define ERR_HD_NOT_EXIST (ERR_RAID + 5) #define ERR_HD_IS_ASSIGNED_ALREADY (ERR_RAID + 6) #define ERR_INVALID_HD_COUNT (ERR_RAID + 7) #define ERR_LD_NOT_READY (ERR_RAID + 8) #define ERR_LD_NOT_EXIST (ERR_RAID + 9) #define ERR_LD_IS_FUNCTIONAL (ERR_RAID + 10) #define ERR_HAS_BGA_ACTIVITY (ERR_RAID + 11) #define ERR_NO_BGA_ACTIVITY (ERR_RAID + 12) #define ERR_BGA_RUNNING (ERR_RAID + 13) #define ERR_RAID_NO_AVAILABLE_ID (ERR_RAID + 14) #define ERR_LD_NO_ATAPI (ERR_RAID + 15) #define ERR_INVALID_RAID6_PARITY_DISK_COUNT (ERR_RAID + 16) #define ERR_INVALID_BLOCK_SIZE (ERR_RAID + 17) #define ERR_MIGRATION_NOT_NEED (ERR_RAID + 18) #define ERR_STRIPE_BLOCK_SIZE_MISMATCH (ERR_RAID + 19) #define ERR_MIGRATION_NOT_SUPPORT (ERR_RAID + 20) #define ERR_LD_NOT_FULLY_INITED (ERR_RAID + 21) #define ERR_LD_NAME_INVALID (ERR_RAID + 22) /* API errors */ #define ERR_INVALID_MATCH_ID (ERR_API + 1) #define ERR_INVALID_HDCOUNT (ERR_API + 2) #define ERR_INVALID_BGA_ACTION (ERR_API + 3) #define ERR_HD_IN_DIFF_CARD (ERR_API + 4) #define ERR_INVALID_FLASH_TYPE (ERR_API + 5) #define ERR_INVALID_FLASH_ACTION (ERR_API + 6) #define ERR_TOO_FEW_EVENT (ERR_API + 7) #define ERR_VD_HAS_RUNNING_OS (ERR_API + 8) #define ERR_DISK_HAS_RUNNING_OS (ERR_API + 9) #define ERR_COMMAND_NOT_SUPPURT (ERR_API + 10) #define ERR_MIGRATION_LIMIT (ERR_API + 11) #endif /* __COM_ERROR_H__ */
#include"bio.h" #include"errno.h" #include"err.h" #include"cryptlib.h" #include"bio_lcl.h" #define MS_CALLBACK //samyang modify ////////////////BIO_read/////////////////////////ok int BIO_read(BIO *b, void *out, int outl) { int i; long (*cb)(BIO *,int,const char *,int,long,long); if ((b == NULL) || (b->method == NULL) || (b->method->bread == NULL)) { BIOerr(BIO_F_BIO_READ,BIO_R_UNSUPPORTED_METHOD); return(-2); } cb=b->callback; if ((cb != NULL) && ((i=(int)cb(b,BIO_CB_READ,out,outl,0L,1L)) <= 0)) return(i); if (!b->init) { BIOerr(BIO_F_BIO_READ,BIO_R_UNINITIALIZED); return(-2); } i=b->method->bread(b,out,outl); if (i > 0) b->num_read+=(unsigned long)i; if (cb != NULL) i=(int)cb(b,BIO_CB_READ|BIO_CB_RETURN,out,outl, 0L,(long)i); return(i); }
#include <PA_BgStruct.h> extern const char splashbottom_Tiles[]; extern const char splashbottom_Map[]; extern const char splashbottom_Pal[]; const PA_BgStruct splashbottom = { PA_BgNormal, 256, 192, splashbottom_Tiles, splashbottom_Map, {splashbottom_Pal}, 22528, {1536} };
/* * * * Copyright (C) 2005 Mike Isely <isely@pobox.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 * * 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 __PVRUSB2_SYSFS_H #define __PVRUSB2_SYSFS_H #include <linux/list.h> #include <linux/sysfs.h> #include "pvrusb2-context.h" struct pvr2_sysfs; struct pvr2_sysfs_class; struct pvr2_sysfs_class *pvr2_sysfs_class_create(void); void pvr2_sysfs_class_destroy(struct pvr2_sysfs_class *); struct pvr2_sysfs *pvr2_sysfs_create(struct pvr2_context *, struct pvr2_sysfs_class *); #endif /* __PVRUSB2_SYSFS_H */ /* Stuff for Emacs to see, in order to encourage consistent editing style: *** Local Variables: *** *** mode: c *** *** fill-column: 75 *** *** tab-width: 8 *** *** c-basic-offset: 8 *** *** End: *** */
/* * pgtable.h * * PowerPC memory management structures * * It is a stripped down version of linux ppc file... * * Copyright (C) 1999 Eric Valette (valette@crf.canon.fr) * Canon Centre Recherche France. * * The license and distribution terms for this file may be * found in found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. * * $Id: pgtable.h,v 1.3 2005/02/13 05:00:15 ralf Exp $ */ #ifndef _LIBCPU_PGTABLE_H #define _LIBCPU_PGTABLE_H /* * The PowerPC MMU uses a hash table containing PTEs, together with * a set of 16 segment registers (on 32-bit implementations), to define * the virtual to physical address mapping. * * We use the hash table as an extended TLB, i.e. a cache of currently * active mappings. We maintain a two-level page table tree, much like * that used by the i386, for the sake of the Linux memory management code. * Low-level assembler code in head.S (procedure hash_page) is responsible * for extracting ptes from the tree and putting them into the hash table * when necessary, and updating the accessed and modified bits in the * page table tree. * * The PowerPC MPC8xx uses a TLB with hardware assisted, software tablewalk. * We also use the two level tables, but we can put the real bits in them * needed for the TLB and tablewalk. These definitions require Mx_CTR.PPM = 0, * Mx_CTR.PPCS = 0, and MD_CTR.TWAM = 1. The level 2 descriptor has * additional page protection (when Mx_CTR.PPCS = 1) that allows TLB hit * based upon user/super access. The TLB does not have accessed nor write * protect. We assume that if the TLB get loaded with an entry it is * accessed, and overload the changed bit for write protect. We use * two bits in the software pte that are supposed to be set to zero in * the TLB entry (24 and 25) for these indicators. Although the level 1 * descriptor contains the guarded and writethrough/copyback bits, we can * set these at the page level since they get copied from the Mx_TWC * register when the TLB entry is loaded. We will use bit 27 for guard, since * that is where it exists in the MD_TWC, and bit 26 for writethrough. * These will get masked from the level 2 descriptor at TLB load time, and * copied to the MD_TWC before it gets loaded. */ /* PMD_SHIFT determines the size of the area mapped by the second-level page tables */ #define PMD_SHIFT 22 #define PMD_SIZE (1UL << PMD_SHIFT) #define PMD_MASK (~(PMD_SIZE-1)) /* PGDIR_SHIFT determines what a third-level page table entry can map */ #define PGDIR_SHIFT 22 #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) /* * entries per page directory level: our page-table tree is two-level, so * we don't really have any PMD directory. */ #define PTRS_PER_PTE 1024 #define PTRS_PER_PMD 1 #define PTRS_PER_PGD 1024 #define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) /* Just any arbitrary offset to the start of the vmalloc VM area: the * current 64MB value just means that there will be a 64MB "hole" after the * physical memory until the kernel virtual memory starts. That means that * any out-of-bounds memory accesses will hopefully be caught. * The vmalloc() routines leaves a hole of 4kB between each vmalloced * area for the same reason. ;) * * We no longer map larger than phys RAM with the BATs so we don't have * to worry about the VMALLOC_OFFSET causing problems. We do have to worry * about clashes between our early calls to ioremap() that start growing down * from ioremap_base being run into the VM area allocations (growing upwards * from VMALLOC_START). For this reason we have ioremap_bot to check when * we actually run into our mappings setup in the early boot with the VM * system. This really does become a problem for machines with good amounts * of RAM. -- Cort */ #define VMALLOC_OFFSET (0x4000000) /* 64M */ #define VMALLOC_START ((((long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))) #define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END ioremap_bot /* * Bits in a linux-style PTE. These match the bits in the * (hardware-defined) PowerPC PTE as closely as possible. */ #define _PAGE_PRESENT 0x001 /* software: pte contains a translation */ #define _PAGE_USER 0x002 /* matches one of the PP bits */ #define _PAGE_RW 0x004 /* software: user write access allowed */ #define _PAGE_GUARDED 0x008 #define _PAGE_COHERENT 0x010 /* M: enforce memory coherence (SMP systems) */ #define _PAGE_NO_CACHE 0x020 /* I: cache inhibit */ #define _PAGE_WRITETHRU 0x040 /* W: cache write-through */ #define _PAGE_DIRTY 0x080 /* C: page changed */ #define _PAGE_ACCESSED 0x100 /* R: page referenced */ #define _PAGE_HWWRITE 0x200 /* software: _PAGE_RW & _PAGE_DIRTY */ #define _PAGE_SHARED 0 #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) #define _PAGE_BASE _PAGE_PRESENT | _PAGE_ACCESSED #define _PAGE_WRENABLE _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE #define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) #define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER | \ _PAGE_SHARED) #define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER) #define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER) #define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_SHARED) #define PAGE_KERNEL_CI __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_SHARED | \ _PAGE_NO_CACHE ) /* * The PowerPC can only do execute protection on a segment (256MB) basis, * not on a page basis. So we consider execute permission the same as read. * Also, write permissions imply read permissions. * This is the closest we can get.. */ #define __P000 PAGE_NONE #define __P001 PAGE_READONLY #define __P010 PAGE_COPY #define __P011 PAGE_COPY #define __P100 PAGE_READONLY #define __P101 PAGE_READONLY #define __P110 PAGE_COPY #define __P111 PAGE_COPY #define __S000 PAGE_NONE #define __S001 PAGE_READONLY #define __S010 PAGE_SHARED #define __S011 PAGE_SHARED #define __S100 PAGE_READONLY #define __S101 PAGE_READONLY #define __S110 PAGE_SHARED #define __S111 PAGE_SHARED #endif /* _LIBCPU_PGTABLE_H */
/*************************************************************************** qgswcsdescribecoverage.h ------------------------- begin : January 16 , 2017 copyright : (C) 2013 by René-Luc D'Hont ( parts from qgswcsserver ) (C) 2017 by David Marteau email : rldhont at 3liz dot com david dot marteau at 3liz dot com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef QGSWCSDESCRIBECOVERAGE_H #define QGSWCSDESCRIBECOVERAGE_H #include "qgsrasterlayer.h" #include <QDomDocument> namespace QgsWcs { /** * Create describe coverage document */ QDomDocument createDescribeCoverageDocument( QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request ); /** Output WCS DescribeCoverage response */ void writeDescribeCoverage( QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, QgsServerResponse &response ); } // samespace QgsWcs #endif
#ifndef _FIRMWARE_UPDATE_H_ #define _FIRMWARE_UPDATE_H_ #define LJ_FIRMWARE_UPDATE #ifdef LJ_FIRMWARE_UPDATE #include <linux/types.h> struct firmware_update_struct { int updating; char* binary; size_t binsize; char version; void (*set_sclk)(int set); void (*set_data)(int set); int (*get_data)(void); void (*set_drive)(int clk_data_sel, int drive_mode); //0:clock 1:data, 0: high impedence 1:strong void (*set_vdd)(int set); }; extern int cypress_update(struct firmware_update_struct* fwdata); extern struct firmware_update_struct* g_cypress_fwdata; #endif #endif /* _FIRMWARE_UPDATE_H_ */
/* Dia -- an diagram creation/manipulation program * Copyright (C) 1998 Alexander Larsson * * 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 <config.h> #include "textedit_tool.h" #include "diagram.h" #include "textedit.h" #include "cursor.h" #include "object_ops.h" /** The text edit tool. This tool allows the user to switch to a mode where * clicking on an editable text will start text edit mode. Clicking outside * of editable text will revert to selection tool. Note that clicking this * tool doesn't enter text edit mode immediately, just allows it to be entered * by clicking an object. */ static DiaObject * click_select_object(DDisplay *ddisp, Point *clickedpoint, GdkEventButton *event) { real click_distance = ddisplay_untransform_length(ddisp, 3.0); Diagram *diagram = ddisp->diagram; DiaObject *obj; ddisplay_untransform_coords(ddisp, (int)event->x, (int)event->y, &clickedpoint->x, &clickedpoint->y); obj = diagram_find_clicked_object (diagram, clickedpoint, click_distance); if (obj) { /* Selected an object. */ GList *already; /*printf("Selected object!\n");*/ already = g_list_find(diagram->data->selected, obj); if (already == NULL) { /* Not already selected */ if (!(event->state & GDK_SHIFT_MASK)) { /* Not Multi-select => remove current selection */ diagram_remove_all_selected(diagram, TRUE); } diagram_select(diagram, obj); } ddisplay_do_update_menu_sensitivity(ddisp); object_add_updates_list(diagram->data->selected, diagram); diagram_flush(diagram); return obj; } return obj; } static void textedit_button_press(TexteditTool *tool, GdkEventButton *event, DDisplay *ddisp) { Point clickedpoint; Diagram *diagram = ddisp->diagram; DiaObject *obj = click_select_object (ddisp, &clickedpoint, event); if (obj) { if (obj != tool->object) textedit_deactivate_focus (); /* set cursor position */ if (textedit_activate_object(ddisp, obj, &clickedpoint)) { tool->object = obj; tool->start_at = clickedpoint; tool->state = STATE_TEXT_SELECT; } else { /* Clicked outside of editable object, stop editing */ tool_reset(); } } else { textedit_deactivate_focus (); diagram_remove_all_selected(diagram, TRUE); tool_reset(); } } static void textedit_button_release(TexteditTool *tool, GdkEventButton *event, DDisplay *ddisp) { Point clickedpoint; DiaObject *obj = click_select_object (ddisp, &clickedpoint, event); if (obj) { ddisplay_do_update_menu_sensitivity(ddisp); tool->state = STATE_TEXT_EDIT; /* no selection in the text editing yes */ } else { /* back to modifying if we dont have an object */ textedit_deactivate_focus(); tool_reset (); } } static void textedit_motion(TexteditTool *tool, GdkEventMotion *event, DDisplay *ddisp) { /* if we implement text selection here we could update the visual feedback */ } static void textedit_double_click(TexteditTool *tool, GdkEventButton *event, DDisplay *ddisp) { /* if we implment text selection this should select a word */ } Tool * create_textedit_tool(void) { TexteditTool *tool; DDisplay *ddisp; tool = g_new0(TexteditTool, 1); tool->tool.type = TEXTEDIT_TOOL; tool->tool.button_press_func = (ButtonPressFunc) &textedit_button_press; tool->tool.button_release_func = (ButtonReleaseFunc) &textedit_button_release; tool->tool.motion_func = (MotionFunc) &textedit_motion; tool->tool.double_click_func = (DoubleClickFunc) &textedit_double_click; ddisplay_set_all_cursor(get_cursor(CURSOR_XTERM)); ddisp = ddisplay_active(); if (ddisp) { if (textedit_activate_first (ddisp)) { /* set the focus to the canvas area */ gtk_widget_grab_focus (ddisp->canvas); } ddisplay_flush(ddisp); /* the above may have entered the textedit mode, just update in any case */ ddisplay_do_update_menu_sensitivity(ddisp); } return (Tool *)tool; } void free_textedit_tool (Tool *tool) { DDisplay *ddisp = ddisplay_active(); if (ddisp) { textedit_deactivate_focus (); ddisplay_flush(ddisp); } ddisplay_set_all_cursor(default_cursor); g_free (tool); }
#include <string.h> #include <taskLib.h> #include "../private.h" #define MAX_TASKS 1024 /* * We use global variables to avoid having anything from this * procedure on the stack as we are clearing it!!! * We are task locked so these shouldn't get corrupted */ static int id_list[MAX_TASKS]; static int i,num_tasks; static TASK_DESC info; static char *p; static unsigned delta; /*--------------------------------------------------------- */ void lub_heap_clean_stacks(void) { /* disable task switching */ taskLock(); num_tasks = taskIdListGet(id_list,MAX_TASKS); /* deschedule to ensure that the current task stack details are upto date */ taskDelay(1); /* iterate round the tasks in the system */ for(i = 0; i < num_tasks; i++) { if(OK == taskInfoGet(id_list[i],&info)) { p = info.td_pStackBase - info.td_stackHigh; delta = info.td_stackHigh - info.td_stackCurrent; /* now clean the stack */ for(; delta--; p++) { *p = 0xCC; } } } /* reenable task switching */ taskUnlock(); } /*--------------------------------------------------------- */
/* * synergy -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2004 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "core/IClipboard.h" #include <Carbon/Carbon.h> #include <vector> class IOSXClipboardConverter; //! OS X clipboard implementation class OSXClipboard : public IClipboard { public: OSXClipboard(); virtual ~OSXClipboard(); //! Test if clipboard is owned by synergy static bool isOwnedBySynergy(); // IClipboard overrides virtual bool empty(); virtual void add(EFormat, const String& data); virtual bool open(Time) const; virtual void close() const; virtual Time getTime() const; virtual bool has(EFormat) const; virtual String get(EFormat) const; bool synchronize(); private: void clearConverters(); private: typedef std::vector<IOSXClipboardConverter*> ConverterList; mutable Time m_time; ConverterList m_converters; PasteboardRef m_pboard; }; //! Clipboard format converter interface /*! This interface defines the methods common to all Scrap book format */ class IOSXClipboardConverter : public IInterface { public: //! @name accessors //@{ //! Get clipboard format /*! Return the clipboard format this object converts from/to. */ virtual IClipboard::EFormat getFormat() const = 0; //! returns the scrap flavor type that this object converts from/to virtual CFStringRef getOSXFormat() const = 0; //! Convert from IClipboard format /*! Convert from the IClipboard format to the Carbon scrap format. The input data must be in the IClipboard format returned by getFormat(). The return data will be in the scrap format returned by getOSXFormat(). */ virtual String fromIClipboard(const String&) const = 0; //! Convert to IClipboard format /*! Convert from the carbon scrap format to the IClipboard format (i.e., the reverse of fromIClipboard()). */ virtual String toIClipboard(const String&) const = 0; //@} };
/* main_titlebar.h * Declarations of GTK+-specific UI utility routines * * $Id: main_titlebar.h 48683 2013-04-01 00:21:44Z guy $ * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * 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 __MAIN_TITLEBAR_H__ #define __MAIN_TITLEBAR_H__ /** Construct the main window's title with the current main_window_name optionally appended * with the user-specified title and/or wireshark version. * Display the result in the main window's title bar and in its icon title */ extern void main_titlebar_update(void); /* Set titlebar to reflect the current state of the capture file, if any */ extern void set_titlebar_for_capture_file(capture_file *cf); /* Set titlebar to reflect a capture in progress */ extern void set_titlebar_for_capture_in_progress(capture_file *cf); #endif /* __MAIN_TITLEBAR_H__ */
/* * SPDX-License-Identifier: BSD-3-Clause * * Copyright 2017 NXP * */ #ifndef __DPAA2_EVENTDEV_H__ #define __DPAA2_EVENTDEV_H__ #include <rte_eventdev_pmd.h> #include <rte_eventdev_pmd_vdev.h> #include <rte_atomic.h> #include <mc/fsl_dpcon.h> #include <mc/fsl_mc_sys.h> #define EVENTDEV_NAME_DPAA2_PMD event_dpaa2 #define DPAA2_EVENT_DEFAULT_DPCI_PRIO 0 #define DPAA2_EVENT_MAX_QUEUES 16 #define DPAA2_EVENT_MIN_DEQUEUE_TIMEOUT 1 #define DPAA2_EVENT_MAX_DEQUEUE_TIMEOUT (UINT32_MAX - 1) #define DPAA2_EVENT_MAX_QUEUE_FLOWS 2048 #define DPAA2_EVENT_MAX_QUEUE_PRIORITY_LEVELS 8 #define DPAA2_EVENT_MAX_EVENT_PRIORITY_LEVELS 0 #define DPAA2_EVENT_MAX_PORT_DEQUEUE_DEPTH 8 #define DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH 8 #define DPAA2_EVENT_MAX_NUM_EVENTS (INT32_MAX - 1) #define DPAA2_EVENT_QUEUE_ATOMIC_FLOWS 2048 #define DPAA2_EVENT_QUEUE_ORDER_SEQUENCES 2048 enum { DPAA2_EVENT_DPCI_PARALLEL_QUEUE, DPAA2_EVENT_DPCI_ATOMIC_QUEUE, DPAA2_EVENT_DPCI_MAX_QUEUES }; #define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \ (RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \ RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \ RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) /**< Ethernet Rx adapter cap to return If the packet transfers from * the ethdev to eventdev with DPAA2 devices. */ struct dpaa2_dpcon_dev { TAILQ_ENTRY(dpaa2_dpcon_dev) next; struct fsl_mc_io dpcon; uint16_t token; rte_atomic16_t in_use; uint32_t dpcon_id; uint16_t qbman_ch_id; uint8_t num_priorities; uint8_t channel_index; }; struct evq_info_t { /* DPcon device */ struct dpaa2_dpcon_dev *dpcon; /* Attached DPCI device */ struct dpaa2_dpci_dev *dpci; /* Configuration provided by the user */ uint32_t event_queue_cfg; uint8_t link; }; struct dpaa2_eventdev { struct evq_info_t evq_info[DPAA2_EVENT_MAX_QUEUES]; uint32_t dequeue_timeout_ns; uint8_t max_event_queues; uint8_t nb_event_queues; uint8_t nb_event_ports; uint8_t resvd_1; uint32_t nb_event_queue_flows; uint32_t nb_event_port_dequeue_depth; uint32_t nb_event_port_enqueue_depth; uint32_t event_dev_cfg; }; struct dpaa2_dpcon_dev *rte_dpaa2_alloc_dpcon_dev(void); void rte_dpaa2_free_dpcon_dev(struct dpaa2_dpcon_dev *dpcon); #endif /* __DPAA2_EVENTDEV_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(1356); } module_init(regpatch);
// modified from examples/atmega128_timer/main.c! #include <avr/interrupt.h> volatile int timer2_ticks; ISR(SIG_OUTPUT_COMPARE2) { timer2_ticks++; } int main(void) { volatile int tmp; DDRA = 0x01; PORTA = 0; /* Set up timer and enable interrupts */ TCNT2 = 0; /* Timer 2 by CLK/64 */ OCR2 = 124; /* 2ms on 4MHz, CTC mode */ TCCR2 = 0x0b; TIMSK = _BV(OCIE2); sei(); tmp = timer2_ticks; while(1) { if(tmp != timer2_ticks) { // toggle about every 2ms tmp = timer2_ticks; if((PINA & 0x01) == 0x01) { PORTA &= 0xfe; } else { PORTA |= 0x01; } } } return 0; }
/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2017 Intel Corporation */ #ifndef _SCHEDULER_PMD_PRIVATE_H #define _SCHEDULER_PMD_PRIVATE_H #include "rte_cryptodev_scheduler.h" #define CRYPTODEV_NAME_SCHEDULER_PMD crypto_scheduler /**< Scheduler Crypto PMD device name */ #define PER_SLAVE_BUFF_SIZE (256) extern int scheduler_logtype_driver; #define CR_SCHED_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, scheduler_logtype_driver, \ "%s() line %u: "fmt "\n", __func__, __LINE__, ##args) struct scheduler_slave { uint8_t dev_id; uint16_t qp_id; uint32_t nb_inflight_cops; uint8_t driver_id; }; struct scheduler_ctx { void *private_ctx; /**< private scheduler context pointer */ struct rte_cryptodev_capabilities *capabilities; uint32_t nb_capabilities; uint32_t max_nb_queue_pairs; struct scheduler_slave slaves[RTE_CRYPTODEV_SCHEDULER_MAX_NB_SLAVES]; uint32_t nb_slaves; enum rte_cryptodev_scheduler_mode mode; struct rte_cryptodev_scheduler_ops ops; uint8_t reordering_enabled; char name[RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN]; char description[RTE_CRYPTODEV_SCHEDULER_DESC_MAX_LEN]; uint16_t wc_pool[RTE_MAX_LCORE]; uint16_t nb_wc; char *init_slave_names[RTE_CRYPTODEV_SCHEDULER_MAX_NB_SLAVES]; int nb_init_slaves; } __rte_cache_aligned; struct scheduler_qp_ctx { void *private_qp_ctx; uint32_t max_nb_objs; struct rte_ring *order_ring; uint32_t seqn; } __rte_cache_aligned; extern uint8_t cryptodev_scheduler_driver_id; static __rte_always_inline uint16_t get_max_enqueue_order_count(struct rte_ring *order_ring, uint16_t nb_ops) { uint32_t count = rte_ring_free_count(order_ring); return count > nb_ops ? nb_ops : count; } static __rte_always_inline void scheduler_order_insert(struct rte_ring *order_ring, struct rte_crypto_op **ops, uint16_t nb_ops) { rte_ring_sp_enqueue_burst(order_ring, (void **)ops, nb_ops, NULL); } #define SCHEDULER_GET_RING_OBJ(order_ring, pos, op) do { \ struct rte_crypto_op **ring = (void *)&order_ring[1]; \ op = ring[(order_ring->cons.head + pos) & order_ring->mask]; \ } while (0) static __rte_always_inline uint16_t scheduler_order_drain(struct rte_ring *order_ring, struct rte_crypto_op **ops, uint16_t nb_ops) { struct rte_crypto_op *op; uint32_t nb_objs = rte_ring_count(order_ring); uint32_t nb_ops_to_deq = 0; uint32_t nb_ops_deqd = 0; if (nb_objs > nb_ops) nb_objs = nb_ops; while (nb_ops_to_deq < nb_objs) { SCHEDULER_GET_RING_OBJ(order_ring, nb_ops_to_deq, op); if (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED) break; nb_ops_to_deq++; } if (nb_ops_to_deq) nb_ops_deqd = rte_ring_sc_dequeue_bulk(order_ring, (void **)ops, nb_ops_to_deq, NULL); return nb_ops_deqd; } /** device specific operations function pointer structure */ extern struct rte_cryptodev_ops *rte_crypto_scheduler_pmd_ops; #endif /* _SCHEDULER_PMD_PRIVATE_H */