text
stringlengths
4
6.14k
#ifndef _NP2_KEYSTAT_H_ #define _NP2_KEYSTAT_H_ #if 0 enum { NKEY_ESC = 0x00, NKEY_1 = 0x01, NKEY_2 = 0x02, NKEY_3 = 0x03, NKEY_4 = 0x04, NKEY_5 = 0x05, NKEY_6 = 0x06, NKEY_7 = 0x07, NKEY_8 = 0x08, NKEY_9 = 0x09, NKEY_0 = 0x0a, NKEY_MINUS = 0x0b, NKEY_CIRCUMFLEX = 0x0c, NKEY_YEN = 0x0d, NKEY_BACKSPACE = 0x0e, NKEY_TAB = 0x0f, NKEY_Q = 0x10, NKEY_W = 0x11, NKEY_E = 0x12, NKEY_R = 0x13, NKEY_T = 0x14, NKEY_Y = 0x15, NKEY_U = 0x16, NKEY_I = 0x17, NKEY_O = 0x18, NKEY_P = 0x19, NKEY_ATMARK = 0x1a, NKEY_LEFTSBRACKET = 0x1b, NKEY_RETURN = 0x1c, NKEY_A = 0x1d, NKEY_S = 0x1e, NKEY_D = 0x1f, NKEY_F = 0x20, NKEY_G = 0x21, NKEY_H = 0x22, NKEY_J = 0x23, NKEY_K = 0x24, NKEY_L = 0x25, NKEY_SEMICOLON = 0x26, NKEY_COLON = 0x27, NKEY_RIGHTSBRACKET = 0x28, NKEY_Z = 0x29, NKEY_X = 0x2a, NKEY_C = 0x2b, NKEY_V = 0x2c, NKEY_B = 0x2d, NKEY_N = 0x2e, NKEY_M = 0x2f, NKEY_COMMA = 0x30, NKEY_DOT = 0x31, NKEY_SLASH = 0x32, NKEY_UNDERSCORE = 0x33, NKEY_SPACE = 0x34, NKEY_XFER = 0x35, NKEY_ROLLUP = 0x36, NKEY_ROLLDOWN = 0x37, NKEY_INS = 0x38, NKEY_DEL = 0x39, NKEY_UP = 0x3a, NKEY_LEFT = 0x3b, NKEY_RIGHT = 0x3c, NKEY_DOWN = 0x3d, NKEY_HOMECLR = 0x3e, NKEY_HELP = 0x3f, NKEY_KP_MINUS = 0x40, NKEY_KP_SLASH = 0x41, NKEY_KP_7 = 0x42, NKEY_KP_8 = 0x43, NKEY_KP_9 = 0x44, NKEY_KP_ASTERISK = 0x45, NKEY_KP_4 = 0x46, NKEY_KP_5 = 0x47, NKEY_KP_6 = 0x48, NKEY_KP_PLUS = 0x49, NKEY_KP_1 = 0x4a, NKEY_KP_2 = 0x4b, NKEY_KP_3 = 0x4c, NKEY_KP_EQUAL = 0x4d, NKEY_KP_0 = 0x4e, NKEY_KP_COMMA = 0x4f, NKEY_KP_DOT = 0x50, NKEY_NFER = 0x51, NKEY_VF1 = 0x52, NKEY_VF2 = 0x53, NKEY_VF3 = 0x54, NKEY_VF4 = 0x55, NKEY_VF5 = 0x56, NKEY_STOP = 0x60, NKEY_COPY = 0x61, NKEY_F1 = 0x62, NKEY_F2 = 0x63, NKEY_F3 = 0x64, NKEY_F4 = 0x65, NKEY_F5 = 0x66, NKEY_F6 = 0x67, NKEY_F7 = 0x68, NKEY_F8 = 0x69, NKEY_F9 = 0x6a, NKEY_F10 = 0x6b, NKEY_SHIFT = 0x70, NKEY_CAPS = 0x71, NKEY_KANA = 0x72, NKEY_GRPH = 0x73, NKEY_CTRL = 0x74 }; #endif enum { NKEY_SYSTEM = 0x90, NKEY_USER = 0x90, NKEY_USERKEYS = 2, NKEYREF_uPD8255 = 0xf7, NKEYREF_USER = 0xf8, NKEYREF_SOFTKBD = 0xf9, NKEYREF_NC = 0xff }; typedef struct { UINT8 keys; UINT8 key[1]; } NKEYM; typedef struct { UINT8 keys; UINT8 key[3]; } NKEYM3; typedef struct { UINT8 keys; UINT8 key[15]; } NKEYM15; typedef struct { NKEYM3 key[NKEY_SYSTEM]; NKEYM15 user[NKEY_USERKEYS]; } NKEYTBL; typedef struct { UINT8 reqparam; UINT8 mode; UINT8 kbdtype; UINT8 keyrep; UINT8 capsref; UINT8 kanaref; } KEYCTRL; typedef struct { UINT8 ref[0x80]; UINT8 extkey; UINT8 mouselast; UINT8 padding; UINT8 d_up; UINT8 d_dn; UINT8 d_lt; UINT8 d_rt; } KEYSTAT; #ifdef __cplusplus extern "C" { #endif extern NKEYTBL nkeytbl; extern KEYCTRL keyctrl; extern KEYSTAT keystat; void keystat_initialize(void); void keystat_tblreset(void); void keystat_tblset(REG8 ref, const UINT8 *key, UINT cnt); void keystat_tblload(const OEMCHAR *filename); void keystat_ctrlreset(void); void keystat_ctrlsend(REG8 dat); void keystat_keydown(REG8 ref); void keystat_keyup(REG8 ref); void keystat_allrelease(void); void keystat_releaseref(REG8 ref); void keystat_releasekey(REG8 key); void keystat_resetjoykey(void); // ---- I/O void keystat_down(const UINT8 *key, REG8 keys, REG8 ref); void keystat_up(const UINT8 *key, REG8 keys, REG8 ref); void keystat_resendstat(void); REG8 keystat_getjoy(void); REG8 keystat_getmouse(SINT16 *x, SINT16 *y); // keyrepeat // keyrepeat interval processing void keyrepeat_proc(); // ---- 廃止関数 void keystat_senddata(REG8 data); void keystat_forcerelease(REG8 data); #ifdef __cplusplus } #endif #endif /* _NP2_KEYSTAT_H_ */
#pragma once #include <GL/glew.h> #include <GLFW/glfw3.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <ft2build.h> #include FT_FREETYPE_H #include "Shader.h" #include <map> #include <iostream> #include <string> namespace cge { struct Character { GLuint TextureID; glm::ivec2 Size; glm::ivec2 Bearing; GLuint Advance; }; class Text; class TextManager { public: bool init(GLuint width, GLuint height); void renderText(std::string & text, GLfloat x, GLfloat y, GLfloat scale, glm::vec3 & color); Text newText(char* text, GLfloat x = 0, GLfloat y = 0, GLfloat scale = 1, glm::vec3 color = glm::vec3(1, 1, 1)); static TextManager * getInstance(); private: TextManager(); static TextManager * instance; std::map<GLchar, Character> characters; GLuint VAO, VBO; Shader shader; }; class Text { public: Text(char* text, TextManager * manager, GLfloat x = 0, GLfloat y = 0, GLfloat scale = 1, glm::vec3 color = glm::vec3(1, 1, 1)); void render(); void setString(char * text); glm::vec2 position; GLfloat scale; glm::vec3 color; std::string string; private: TextManager * manager; }; }
#include "more_functions.h" #include <stdio.h> void another_function() { printf("You have caled another_function\n"); } void yet_another_function() { printf("You have called yet_another_function\n"); }
#pragma once #include <cfc/base.h> CFC_NAMESPACE2(cfc, profiling) class CFC_API scopedtime { public: scopedtime(cfc::context& ctx, const char* scope); ~scopedtime(); protected: cfc::context& m_ctx; const char* m_scope; double m_time; }; CFC_END_NAMESPACE2(cfc, profiling)
typedef enum { PAPHomeTabBarItemIndex = 0, PAPEmptyTabBarItemIndex = 1, PAPActivityTabBarItemIndex = 2 } PAPTabBarControllerViewControllerIndex; #define kPAPParseEmployeeAccounts [NSArray array] #pragma mark - NSUserDefaults extern NSString *const kPAPUserDefaultsActivityFeedViewControllerLastRefreshKey; extern NSString *const kPAPUserDefaultsCacheFacebookFriendsKey; #pragma mark - Launch URLs extern NSString *const kPAPLaunchURLHostTakePicture; #pragma mark - NSNotification extern NSString *const PAPAppDelegateApplicationDidReceiveRemoteNotification; extern NSString *const PAPUtilityUserFollowingChangedNotification; extern NSString *const PAPUtilityUserLikedUnlikedPhotoCallbackFinishedNotification; extern NSString *const PAPUtilityDidFinishProcessingProfilePictureNotification; extern NSString *const PAPTabBarControllerDidFinishEditingPhotoNotification; extern NSString *const PAPTabBarControllerDidFinishImageFileUploadNotification; extern NSString *const PAPPhotoDetailsViewControllerUserDeletedPhotoNotification; extern NSString *const PAPPhotoDetailsViewControllerUserLikedUnlikedPhotoNotification; extern NSString *const PAPPhotoDetailsViewControllerUserCommentedOnPhotoNotification; #pragma mark - User Info Keys extern NSString *const PAPPhotoDetailsViewControllerUserLikedUnlikedPhotoNotificationUserInfoLikedKey; extern NSString *const kPAPEditPhotoViewControllerUserInfoCommentKey; #pragma mark - Installation Class // Field keys extern NSString *const kPAPInstallationUserKey; extern NSString *const kPAPInstallationChannelsKey; #pragma mark - PFObject Activity Class // Class key extern NSString *const kPAPActivityClassKey; // Field keys extern NSString *const kPAPActivityTypeKey; extern NSString *const kPAPActivityFromUserKey; extern NSString *const kPAPActivityToUserKey; extern NSString *const kPAPActivityContentKey; extern NSString *const kPAPActivityPhotoKey; // Type values extern NSString *const kPAPActivityTypeLike; extern NSString *const kPAPActivityTypeFollow; extern NSString *const kPAPActivityTypeComment; extern NSString *const kPAPActivityTypeJoined; #pragma mark - PFObject User Class // Field keys extern NSString *const kPAPUserDisplayNameKey; extern NSString *const kPAPUserFacebookIDKey; extern NSString *const kPAPUserPhotoIDKey; extern NSString *const kPAPUserProfilePicSmallKey; extern NSString *const kPAPUserProfilePicMediumKey; extern NSString *const kPAPUserFacebookFriendsKey; extern NSString *const kPAPUserAlreadyAutoFollowedFacebookFriendsKey; extern NSString *const kPAPUserPrivateChannelKey; #pragma mark - PFObject Photo Class // Class key extern NSString *const kPAPPhotoClassKey; // Field keys extern NSString *const kPAPPhotoPictureKey; extern NSString *const kPAPPhotoThumbnailKey; extern NSString *const kPAPPhotoUserKey; extern NSString *const kPAPPhotoOpenGraphIDKey; extern NSString *const kPAPPhotoCoordinates; extern NSString *const kPAPPhotoTitle; #pragma mark - Cached Photo Attributes // keys extern NSString *const kPAPPhotoAttributesIsLikedByCurrentUserKey; extern NSString *const kPAPPhotoAttributesLikeCountKey; extern NSString *const kPAPPhotoAttributesLikersKey; extern NSString *const kPAPPhotoAttributesCommentCountKey; extern NSString *const kPAPPhotoAttributesCommentersKey; #pragma mark - Cached User Attributes // keys extern NSString *const kPAPUserAttributesPhotoCountKey; extern NSString *const kPAPUserAttributesIsFollowedByCurrentUserKey; #pragma mark - PFPush Notification Payload Keys extern NSString *const kAPNSAlertKey; extern NSString *const kAPNSBadgeKey; extern NSString *const kAPNSSoundKey; extern NSString *const kPAPPushPayloadPayloadTypeKey; extern NSString *const kPAPPushPayloadPayloadTypeActivityKey; extern NSString *const kPAPPushPayloadActivityTypeKey; extern NSString *const kPAPPushPayloadActivityLikeKey; extern NSString *const kPAPPushPayloadActivityCommentKey; extern NSString *const kPAPPushPayloadActivityFollowKey; extern NSString *const kPAPPushPayloadFromUserObjectIdKey; extern NSString *const kPAPPushPayloadToUserObjectIdKey; extern NSString *const kPAPPushPayloadPhotoObjectIdKey;
// ---------------------------------------------------------------------------- /* * Copyright (c) 2007 Fabian Greif, Roboterclub Aachen e.V. * 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 THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id: at90can_private.h 6910 2008-11-30 21:13:14Z fabian $ */ // ---------------------------------------------------------------------------- #ifndef AT90CAN_PRIVATE_H #define AT90CAN_PRIVATE_H // ---------------------------------------------------------------------------- #include <avr/io.h> #include <avr/interrupt.h> #include <stdlib.h> #include "can_private.h" #include "can.h" #include "can_buffer.h" #include "utils.h" // ---------------------------------------------------------------------------- #if (defined (__AVR_AT90CAN32__) || \ defined (__AVR_AT90CAN64__) || \ defined (__AVR_AT90CAN128__)) && \ BUILD_FOR_AT90CAN == 1 #if F_CPU != 16000000UL #error only 16 MHz for F_CPU supported! #endif #define SUPPORT_FOR_AT90CAN__ 1 // ---------------------------------------------------------------------------- #if CAN_RX_BUFFER_SIZE > 0 extern can_buffer_t can_rx_buffer; #else // Indicates the number of MObs which have currently one received // message stored in them. extern volatile uint8_t _messages_waiting; #endif #if CAN_TX_BUFFER_SIZE > 0 extern can_buffer_t can_tx_buffer; #else extern volatile uint8_t _free_buffer; #endif #if CAN_FORCE_TX_ORDER extern volatile uint8_t _transmission_in_progress ; #endif // ---------------------------------------------------------------------------- extern uint8_t _find_free_mob(void); // ---------------------------------------------------------------------------- extern void _disable_mob_interrupt(uint8_t mob); // ---------------------------------------------------------------------------- extern void _enable_mob_interrupt(uint8_t mob); // ---------------------------------------------------------------------------- extern uint8_t at90can_send_message(const can_t *msg); // ---------------------------------------------------------------------------- extern uint8_t at90can_get_message(can_t *msg); // ---------------------------------------------------------------------------- /** * Copy data form a message in RAM to the actual registers. * * \warning this function assumes CANPAGE to be set properly */ extern void at90can_copy_message_to_mob(const can_t *msg); // ---------------------------------------------------------------------------- /** * Copy data form a message the registers to RAM. * * \return true if the message should be retrieved, * false if no valid message was available (only for * SUPPORT_EXTENDED_CANID = 0) * * \warning this function assumes CANPAGE to be set properly */ extern bool at90can_copy_mob_to_message(can_t *msg); // ---------------------------------------------------------------------------- // enter standby mode => messages are not transmitted nor received extern __attribute__ ((gnu_inline)) inline void _enter_standby_mode(void) { // request abort CANGCON = (1 << ABRQ); // wait until receiver is not busy while (CANGSTA & (1 << RXBSY)) ; // request standby mode CANGCON = 0; // wait until the CAN Controller has entered standby mode while (CANGSTA & (1 << ENFG)) ; } // ---------------------------------------------------------------------------- // leave standby mode => CAN Controller is connected to CAN Bus extern __attribute__ ((gnu_inline)) inline void _leave_standby_mode(void) { // save CANPAGE register uint8_t canpage = CANPAGE; // reenable all MObs for (uint8_t i=0;i<15;i++) { CANPAGE = i << 4; CANCDMOB = CANCDMOB; } // restore CANPAGE CANPAGE = canpage; // request normal mode CANGCON = (1 << ENASTB); // wait until the CAN Controller has left standby mode while ((CANGSTA & (1 << ENFG)) == 0) ; } #endif // ---------------------------------------------------------------------------- #endif // AT90CAN_PRIVATE_H
#include "include/chunk.h" //allocate storage and init default values for a chunk chunk* createChunk() { chunk* ch = calloc(1, sizeof(chunk)); ch->action = INIT; ch->data = NULL; ch->data_size = 0; return ch; } inline void destroyChunk(chunk* chunk) { if(chunk != NULL) { pdebug("Freeing chunk of size %lu\n", chunk->data_size); free(chunk->data); free(chunk); } }
#pragma once #ifndef OXYGINE_FRAMEWORK #define OXYGINE_FRAMEWORK //oxygine single include // #include "oxygine_include.h" #include "Actor.h" #include "AnimationFrame.h" #include "blocking.h" #include "Box9Sprite.h" #include "Button.h" #include "ClipRectActor.h" #include "Clock.h" #include "ColorRectSprite.h" #include "DebugActor.h" #include "Draggable.h" #include "Event.h" #include "EventDispatcher.h" #include "Font.h" #include "initActor.h" #include "Input.h" #include "InputText.h" #include "MemoryTexture.h" #include "Multithreading.h" #include "PointerState.h" #include "ProgressBar.h" #include "RenderState.h" #include "RootActor.h" #include "SlidingActor.h" #include "Sprite.h" #include "MaskedSprite.h" #include "TextField.h" #include "TextActor.h"//deprecated #include "TextStyle.h" #include "Tweener.h" #include "UpdateState.h" #include "VisualStyle.h" #include "Serialize.h" //closure/ #include "closure/closure.h" //#include "closure/closure_impl.h" //core/ #include "core/coroutines.h" #include "core/file.h" #include "core/ImageData.h" #include "core/ImageDataOperations.h" #include "core/intrusive_ptr.h" #include "core/log.h" #include "core/Mem2Native.h" #include "core/memory_pool.h" #include "core/Mutex.h" #include "core/NativeTexture.h" #include "core/Object.h" #include "core/oxygine.h" #include "core/ox_debug.h" #include "core/pixel.h" #include "core/ref_counter.h" #include "core/Renderer.h" #include "core/ShaderProgram.h" #include "core/Texture.h" #include "core/vertex.h" #include "core/VertexDeclaration.h" #include "core/VideoDriver.h" //core/gl/ //#include "core/gl/NativeTextureGLES.h" //#include "core/gl/oxgl.h" //#include "core/gl/VertexDeclarationGL.h" //#include "core/gl/VideoDriverGL.h" //#include "core/gl/VideoDriverGLES11.h" //#include "core/gl/VideoDriverGLES20.h" //core/stage3d/ /* #include "core/stage3d/NativeTextureStage3D.h" #include "core/stage3d/VideoDriverStage3D.h" */ //dev_tools/ //#include "dev_tools/DeveloperMenu.h" //#include "dev_tools/TexturesInspector.h" //#include "dev_tools/TreeInspector.h" //#include "dev_tools/TreeInspectorLine.h" //#include "dev_tools/TreeInspectorPage.h" //#include "dev_tools/TreeInspectorPreview.h" //math/ #include "math/AffineTransform.h" #include "math/Color.h" #include "math/matrix.h" #include "math/Rect.h" #include "math/ScalarMath.h" #include "math/vector2.h" #include "math/vector3.h" #include "math/vector4.h" //pugixml/ //#include "pugixml/pugiconfig.hpp" #include "pugixml/pugixml.hpp" //res/ #include "res/CreateResourceContext.h" #include "res/ResAnim.h" #include "res/ResAtlas.h" #include "res/ResBuffer.h" #include "res/ResFont.h" #include "res/ResFontBM.h" #include "res/Resource.h" #include "res/Resources.h" #include "res/ResStarlingAtlas.h" //text_utils/ #include "text_utils/Aligner.h" #include "text_utils/Node.h" #include "text_utils/TextBuilder.h" //tree_inspector/ //tree_inspector/internal/ //utils/ #include "utils/AtlasTool.h" #include "utils/ImageUtils.h" #include "utils/intrusive_list.h" #include "utils/stringUtils.h" //winnie_alloc/ //#include "winnie_alloc/system_alloc.h" //#include "winnie_alloc/winnie_alloc.h" //#include "winnie_alloc/winnie_alloc_config.h" #endif
typedef struct _recv{ void *IOBASE; int pci_index; } t_recv; typedef struct _gps{ void *IOBASE; int pci_index; } t_gps; typedef struct _dio{ void *IOBASE; int pci_index; } t_dio; typedef struct _dds{ void *IOBASE; int pci_index; int state_time_usec; } t_dds; typedef struct _timing{ void *IOBASE; int pci_index; int state_time_usec; } t_timing; typedef struct _tcp{ int port_number; char addr[80]; } t_tcp; typedef union _info { t_recv recv; t_gps gps; t_dds dds; t_dio dio; t_timing timing; } t_info; typedef struct _driver { t_info info; t_tcp tcp; char type[80]; int max_seq_length; int max_seqs; int max_pulses; } t_driver;
#ifndef _JPETTRB_H_ #define _JPETTRB_H_ #include "TNamed.h" #include <TRef.h> /** * @brief Parametric class representing database information on parameters of a TRB board. * */ class JPetTRB: public TNamed { public: JPetTRB(); JPetTRB(int id, int type, int channel); ~JPetTRB(); inline int getID() const { return fID; } inline int getType() const { return fType; } inline int getChannel() const { return fChannel; } inline void setID(int id) { fID = id; } inline void setType(int type) { fType = type; } inline void setChannel(int ch) { fChannel = ch; } inline bool operator==(const JPetTRB& trb) { return getID() == trb.getID(); } inline bool operator!=(const JPetTRB& trb) { return getID() != trb.getID(); } private: int fID; int fType; int fChannel; /// @todo do implementacji //JPetFEB* KBId; //KBType; //KBChan; // ClassDef(JPetTRB, 2); protected: friend class JPetParamManager; }; #endif
// // TCStructs.h // NeuralNetwork // // Created by theo on 4/12/13. // Copyright (c) 2013 Theodore Calmes. All rights reserved. // #define tci(l,i,j) TCIndexMake(l,i,j) typedef struct TCRange { float low; float high; } TCRange; static TCRange TCRangeMake(float low, float high) { TCRange range; range.low = low; range.high = high; return range; } typedef struct TCDimension { NSInteger rows; NSInteger cols; } TCDimension; static TCDimension TCDimensionMake(int rows, int cols) { TCDimension dim; dim.rows = rows; dim.cols = cols; return dim; } typedef struct TCIndex { NSInteger l; NSInteger i; NSInteger j; } TCIndex; static TCIndex TCIndexMake(NSInteger l, NSInteger i, NSInteger j) { TCIndex index; index.l = l; index.i = i; index.j = j; return index; }
#include "libsbook.h" #include <stdio.h> #include <sys/types.h> #include <regex.h> static char *strdup_len(const char *buf,int len) { char *b = (char *)malloc(len+1); memcpy(b,buf,len); b[len] = '\000'; return b; } void find_cityStateZip(const char *buf,char **city_,char **state_,char **zip_) { regmatch_t pmatch[6]; static int init=0; static regex_t cszreg; if(init==0){ if(regcomp(&cszreg, "([^,]{2,})(,? +)([A-Za-z]{2,}\\.?)( +)([0-9]{5}(-[0-9]{4})?)", REG_EXTENDED|REG_ICASE)){ perror("regcomp"); } init = 1; } memset(pmatch,0,sizeof(pmatch)); if(regexec(&cszreg,buf,6,pmatch,0)){ return; /* no match */ } char *city = strdup_len(buf+pmatch[1].rm_so,pmatch[1].rm_eo-pmatch[1].rm_so); int spaces1 = pmatch[2].rm_eo-pmatch[2].rm_so; char *state = strdup_len(buf+pmatch[3].rm_so,pmatch[3].rm_eo-pmatch[3].rm_so); int spaces2 = pmatch[4].rm_eo-pmatch[4].rm_so; char *zip = strdup_len(buf+pmatch[5].rm_so,pmatch[5].rm_eo-pmatch[5].rm_so); /* Now, if length of city, state and zip is "significantly" less than * the length of the original, declare this experiment a failure. * (we should also validate state with the state parser, alas). */ int missed_chars = strlen(buf) - (strlen(city)+strlen(state)+strlen(zip)+spaces1+spaces2); if(missed_chars > 2){ free(city);city = 0; free(state);state = 0; free(zip);zip = 0; return; } if(strlen(city)){ if(city_) *city_ = city; else free(city); } if(strlen(state)){ if(state_) *state_ = state; else free(state); } if(strlen(zip)){ if(zip_) *zip_ = zip; else free(zip); } } const char *find_zip(const char *buf,int *len) { regmatch_t pmatch[1]; static regex_t zipreg; static int init =0; if(init==0){ if(regcomp(&zipreg,"[0-9][0-9][0-9][0-9][0-9](-[0-9][0-9][0-9][0-9])?",REG_EXTENDED)){ perror("regcomp"); } init = 1; } if(regexec(&zipreg,buf,1,pmatch,0)){ return 0; /* no match */ } if(len) *len = pmatch[0].rm_eo - pmatch[0].rm_so; return(buf+pmatch[0].rm_so); }
#ifndef __STATE_BASE_H__ #define __STATE_BASE_H__ #include "State.h" RDPS_BEGIN PDCT_BEGIN class Collaborator; class StateBase : public State<Collaborator> { public: virtual ~StateBase() {}; virtual void Enter(const Collaborator &c) {} virtual void Execute(const Collaborator &c) {}; virtual void Exit(const Collaborator &c) {}; }; PDCT_END RDPS_END #endif//__STATE_BASE_H__
/*---------------------------------------------------------*\ $Id$ \*---------------------------------------------------------*/ #include <stdio.h> #include "typesf2c.h" void c_print_sparsemat( int, int, int *, int *, int, double * ); #if defined(EXT_INT) long onbitmask_( long *len ) { unsigned long mask; mask = ~((~0) << *len); return ((long)mask); } #else #if (defined(WIN32)) &&!defined(__MINGW32__) int FATR ONBITMASK( int *len ) #else int FATR onbitmask_( int *len ) #endif { unsigned int mask; mask = ~((~0) << *len); return ((int)mask); } #endif #ifdef NOCOMPILE void print_sparsemat_( int *nc, int *nr, int *cpi, int *ir, int *nnz, double *v ) { c_print_sparsemat( *nc, *nr, cpi, ir, *nnz, v ); } void c_print_sparsemat( int nc, int nr, int *cpi, int *ir, int nnz, double *v ) { int ic, colmax, cvlo, cvhi, ncv; int npr, hasprint, ii2r, iiv, iir, mask16bit; int ilab; colmax = nc < 6 ? nc : 6; mask16bit = ~((~0) << 16); /* printf("\n"); for (ic=0; ic<colmax; ++ic) { printf(" %3d %3d ", cpi[2*ic], cpi[2*ic+1] ); } printf("\n"); */ ii2r = sizeof(int)/2; /* num of labels packed per int - 16 bits per label */ npr = 1; hasprint = 1; while (hasprint) { hasprint = 0; for (ic=0; ic<colmax; ++ic) { cvlo = cpi[2*ic]; cvhi = cpi[2*ic+1]; ncv = cvhi - cvlo + 1; if ((cvlo>0)&&(ncv>=npr)) { iiv = cvlo + npr - 1; iir = iiv/ii2r + ((iiv%ii2r) ? 1 : 0); ilab = (ir[iir-1] >> (16*(iiv%ii2r))) & mask16bit; printf(" %2d %8.4f", ilab, v[iiv-1] ); ++hasprint; } else { printf(" "); } } printf("\n"); ++npr; } } #endif
// // UIViewController+HUD.h // CocoaCategory // // Created by Mac on 2017/10/16. // Copyright © 2017年 Mac. All rights reserved. // #import <UIKit/UIKit.h> #import <MBProgressHUD/MBProgressHUD.h> @interface UIViewController (HUD) @property (nonatomic, assign, readonly) BOOL isLoadingHUD; - (void)showHUDDefaultLoadingText; /*! * @brief 展示HUD 不会自动的消失 默认为MBProgressHUDModeIndeterminate类型 * * @param text 显示的Text */ - (void)showHUDText:(NSString *)text; /*! * @brief 1.5秒会自动消失 MBProgressHUDModeText类型 * * @param text 显示的Text */ - (void)showHUDTextAfterDealy:(NSString *)text; /*! * @brief 多少秒后会自动的消失 * * @param text 显示的Text * @param afterDealy 显示多少秒 */ - (void)showHUDText:(NSString *)text afterDealy:(NSTimeInterval)afterDealy; /*! * @brief 设置为Mode类型 不会自动的消失 * * @param text 显示的Text * @param mode MBProgressHUDMode */ - (void)showHUDText:(NSString *)text mode:(MBProgressHUDMode)mode; /*! * @brief 立刻消失 */ - (void)hideHUD; /*! * @brief 先提示文本 之后1.5秒消失 * * @param text 显示的Text */ - (void)hideHUDTextAfterDealy:(NSString *)text; /*! * @brief 多少秒后消失 * * @param text text 显示的Text * @param afterDealy 多少秒 */ - (void)hideHUDText:(NSString *)text afterDealy:(NSTimeInterval )afterDealy; @end
#import "MOBProjection.h" @interface MOBProjectionEPSG32233 : MOBProjection @end
#ifndef MDSEARCH_OCTREE_H #define MDSEARCH_OCTREE_H #include "IndexStructure.h" namespace mdsearch { class Octree; typedef std::vector<Octree*> OctreeNodeList; /* Specifically, this is a Bucket PR Octree. */ class Octree : public IndexStructure { public: // Constant that determines the bucket size // That is, how many points can be stored in a single leaf node static const unsigned int MAX_POINTS_PER_NODE = 8; // An Octree must be initialised with its dimensionality and the // region of space is covers. A pointer to the node's parent (if // the node is not the parent) must also be provided for efficient // removal and updating. Octree(int numDimensions, const Region& boundary); virtual ~Octree(); // Return number of children each non-leaf node has // (fixed number based on dimensionality) unsigned int childrenPerNode() const; // Read-only accessors const PointList& storedPoints() const; const OctreeNodeList& nodeChildren() const; const Region& regionCovered() const; // Return true if node is a leaf bool isLeaf() const; // Checks if node (including all of its children) are empty bool empty() const; void clear(); // Dynamic operations bool insert(const Point& p); bool remove(const Point& p); bool update(const Point& oldPoint, const Point& newPoint); // Queries bool pointExists(const Point& p); private: // Sub-divide octree into four sub-regions (nodes) void subdivide(); // Return true if this node stores the given point, false otherwise bool storesPoint(const Point& p) const; // Remove all child nodes from this Octree node void removeAllChildren(); Region boundary; unsigned int numChildrenPerNode; // A count of the total number of points stored in this node, // including the points stored by all of its children unsigned int totalPointsInsideNode; PointList points; OctreeNodeList children; }; } #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_ncat_65a.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE805.string.label.xml Template File: sources-sink-65a.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Allocate using malloc() and set data pointer to a small buffer * GoodSource: Allocate using malloc() and set data pointer to a large buffer * Sinks: ncat * BadSink : Copy string to data using strncat * Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD /* bad function declaration */ void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_ncat_65b_badSink(char * data); void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_ncat_65_bad() { char * data; /* define a function pointer */ void (*funcPtr) (char *) = CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_ncat_65b_badSink; data = NULL; /* FLAW: Allocate and point data to a small buffer that is smaller than the large buffer used in the sinks */ data = (char *)malloc(50*sizeof(char)); data[0] = '\0'; /* null terminate */ /* use the function pointer */ funcPtr(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_ncat_65b_goodG2BSink(char * data); static void goodG2B() { char * data; void (*funcPtr) (char *) = CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_ncat_65b_goodG2BSink; data = NULL; /* FIX: Allocate and point data to a large buffer that is at least as large as the large buffer used in the sink */ data = (char *)malloc(100*sizeof(char)); data[0] = '\0'; /* null terminate */ funcPtr(data); } void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_ncat_65_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_ncat_65_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_ncat_65_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// // SpecHelpers.h // CocoaSpecsApp // // Created by Stanislaw Pankevich on 7/31/13. // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. // #import <Kiwi/Kiwi.h> #import "Database.h" #import "NSManagedObject+Helpers.h" #import "Exceptions.h"
// // MHzComment.h // 百思不得姐 // // Created by Minghe on 10/18/15. // Copyright © 2015 project. All rights reserved. // #import <Foundation/Foundation.h> @class MHzUser; @interface MHzComment : NSObject @property (copy, nonatomic) NSString *content;/**< 评论内容 */ @property (strong, nonatomic) MHzUser *user;/**< 发表评论的用户 */ @property (copy, nonatomic) NSString *id;/**< id */ @property (assign, nonatomic) NSInteger like_count;/**< 点赞数量 */ @end
#import <UIKit/UIKit.h> #import "MLMiliService.h" @interface DetailController : UITableViewController <UIAlertViewDelegate, UIActionSheetDelegate> @property (nonatomic, strong) MLMiliService *service; @end
// // CalendarDate.h // // Created by Kevin Conley on 6/25/2013. // #import <Foundation/Foundation.h> #import "FMDatabase.h" @interface CalendarDate : NSObject @property (nonatomic, strong) NSString * serviceId; @property (nonatomic, strong) NSString * date; @property (nonatomic, strong) NSString * exceptionType; - (id)initWithDB:(FMDatabase *)fmdb; - (void)addCalendarDate:(CalendarDate *)calendarDate; - (void)cleanupAndCreate; - (void)receiveRecord:(NSDictionary *)aRecord; @end
/** * The MIT License (MIT) * Copyright (c) 2016 Chaabane Jalal * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "spi/opcode/cpu.h" void spi_clc(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { SPI_DISABLE_FLAG(cpu->flags, CARRY); } void spi_cld(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { SPI_DISABLE_FLAG(cpu->flags, DECIMAL); } void spi_cli(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { SPI_DISABLE_FLAG(cpu->flags, DISABLE_INTERRUPTS); } void spi_clv(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { SPI_DISABLE_FLAG(cpu->flags, OVERFLOW); } void spi_nop(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) {} void spi_sec(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { SPI_ENABLE_FLAG(cpu->flags, CARRY); } void spi_sed(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { SPI_ENABLE_FLAG(cpu->flags, DECIMAL); } void spi_sei(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { SPI_ENABLE_FLAG(cpu->flags, DISABLE_INTERRUPTS); } void spi_tax(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { cpu->registers[X] = cpu->registers[A]; SPI_SET_FLAGS(cpu->flags, NEGATIVE, SPI_GET_BIT(cpu->registers[X], 7)); SPI_SET_FLAGS(cpu->flags, ZERO, cpu->registers[X] == 0); } void spi_tay(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { cpu->registers[Y] = cpu->registers[A]; SPI_SET_FLAGS(cpu->flags, NEGATIVE, SPI_GET_BIT(cpu->registers[Y], 7)); SPI_SET_FLAGS(cpu->flags, ZERO, cpu->registers[Y] == 0); } void spi_tsx(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { cpu->registers[X] = cpu->sp; } void spi_txa(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { cpu->registers[A] = cpu->registers[X]; SPI_SET_FLAGS(cpu->flags, NEGATIVE, SPI_GET_BIT(cpu->registers[A], 7)); SPI_SET_FLAGS(cpu->flags, ZERO, cpu->registers[A] == 0); } void spi_txs(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { cpu->sp = cpu->registers[X]; } void spi_tya(spi_cpu_t *cpu, spi_address_mode_t mode, spi_byte_t *mem) { cpu->registers[A] = cpu->registers[Y]; SPI_SET_FLAGS(cpu->flags, NEGATIVE, SPI_GET_BIT(cpu->registers[A], 7)); SPI_SET_FLAGS(cpu->flags, ZERO, cpu->registers[A] == 0); } SPI_INSTRUCTION_ALIAS(spi_clc, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_cld, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_cli, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_clv, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_nop, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_sec, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_sed, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_sei, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_tax, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_tay, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_tsx, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_txa, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_txs, IMPLIED, 1, 2); SPI_INSTRUCTION_ALIAS(spi_tya, IMPLIED, 1, 2); void spi_register_cpu_opcodes(spi_cpu_t *cpu) { cpu->opcode_table[0x18] = &SPI_GET_INSTRUCTION_ALIAS(spi_clc, IMPLIED); cpu->opcode_table[0xD8] = &SPI_GET_INSTRUCTION_ALIAS(spi_cld, IMPLIED); cpu->opcode_table[0x58] = &SPI_GET_INSTRUCTION_ALIAS(spi_cli, IMPLIED); cpu->opcode_table[0xB8] = &SPI_GET_INSTRUCTION_ALIAS(spi_clv, IMPLIED); cpu->opcode_table[0xEA] = &SPI_GET_INSTRUCTION_ALIAS(spi_nop, IMPLIED); cpu->opcode_table[0x38] = &SPI_GET_INSTRUCTION_ALIAS(spi_sec, IMPLIED); cpu->opcode_table[0xF8] = &SPI_GET_INSTRUCTION_ALIAS(spi_sed, IMPLIED); cpu->opcode_table[0x78] = &SPI_GET_INSTRUCTION_ALIAS(spi_sei, IMPLIED); cpu->opcode_table[0xAA] = &SPI_GET_INSTRUCTION_ALIAS(spi_tax, IMPLIED); cpu->opcode_table[0xA8] = &SPI_GET_INSTRUCTION_ALIAS(spi_tay, IMPLIED); cpu->opcode_table[0xBA] = &SPI_GET_INSTRUCTION_ALIAS(spi_tsx, IMPLIED); cpu->opcode_table[0x8A] = &SPI_GET_INSTRUCTION_ALIAS(spi_txa, IMPLIED); cpu->opcode_table[0x9A] = &SPI_GET_INSTRUCTION_ALIAS(spi_txs, IMPLIED); cpu->opcode_table[0x98] = &SPI_GET_INSTRUCTION_ALIAS(spi_tya, IMPLIED); }
// // AVLStoreAssociate.h // Pods // // Created by SMIT V SHAH on 11/13/15. // // #import <Foundation/Foundation.h> /*! Enum for `StoreAssociate` access level for the application */ typedef NS_ENUM(NSInteger, AccessLevel) { /*! Access level - None */ AccessLevelNone = -1, /*! Access level - All. User can delete an order */ AccessLevelAllAccess = 0, /*! Access level - Restricted. User cannot delete order */ AccessLevelRestricted = 10 }; /*! This Singelton class was designed and implemented to store associate details and always fetch single instance of it using `sharedModel` method */ @interface AVLStoreAssociate : NSObject @property (copy, nonatomic) NSString *firstName; @property (copy, nonatomic) NSString *lastName; @property (copy, nonatomic) NSString *userId; @property (copy, nonatomic) NSString *storeNo; @property (copy, nonatomic) NSString *email; @property (assign, nonatomic) AccessLevel accessLevel; /*! @abstract Singelton @discussion Class method which returns the single instance of `StoreAssociate` class. If the instance does not exists then it creates a new instance and returns it @return `StoreAssociate` instance */ + (AVLStoreAssociate *) sharedModel; @end
// // XPSettingCell.h // PhotoSecurity // // Created by nhope on 2017/3/21. // Copyright © 2017年 xiaopin. All rights reserved. // #import <UIKit/UIKit.h> @interface XPSettingCell : UITableViewCell @property (weak, nonatomic) IBOutlet UILabel *titleLabel; @property (weak, nonatomic) IBOutlet UISwitch *stateSwitch; @end
/*+--------------------------------------------- | 寒冰剑法 ( 主动技能 ) | 以一道寒冰剑气隔空伤敌,同时带有减速效果 | 发动几率:100% | 技能消耗:(140-Lv*10) 内息 | 攻击力 +(25+Lv*7) | 技能命中后造成对方【减速】 | ( 持续 15 秒 ) | 攻击速度 -20 +---------------------------------------------*/ #ifndef INCLUDE_ABILITY_HANBINGJIANFA #define INCLUDE_ABILITY_HANBINGJIANFA void HanBingJianFa_bind(); #endif
// // HNCommentsViewController.h // HNReader // // Created by Andrew Shepard on 9/29/11. // Copyright 2011 Andrew Shepard. All rights reserved. // @class HNEntry; @interface HNCommentsViewController : UIViewController <UITableViewDelegate> @property (nonatomic, weak) IBOutlet UITableView *tableView; @property (nonatomic, weak) IBOutlet UIBarButtonItem *refreshButton; @property (nonatomic, strong) HNEntry *entry; @end
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSOperation.h" @interface _XCOQOperation : NSOperation { id <_XCOQOperationDelegate> _delegate; } @property(retain) id <_XCOQOperationDelegate> delegate; // @synthesize delegate=_delegate; - (void)main; - (void)dealloc; @end
#ifndef INTERRUPT_H_ #define INTERRUPT_H_ class Interrupt { public: Interrupt(); private: }; #endif
#pragma once #include "../../src/bytecode/bytecodeparser.h"
/** * @file minSize13.c Defines MinSize set of 13 * @brief * Done in this way to be able to assemble various alternative sorting * arrangements staticly, rather than requiring one to recompile an * application as part of running a test suite. In this regard, we traded * off the low-overhead of having lots of very small functions that do * very little with the benefit of writing easy Makefiles that select * which minimum size to use at static linking time. * * @author George Heineman * @date 6/15/08 */ int minSize = 13;
// // SafeAreaSpacerViewManager.h // RNCommon // // Created by Reza on 3/19/18. // Copyright © 2018 kajoo. All rights reserved. // #import <React/RCTViewManager.h> #ifndef SafeAreaSpacerViewManager_h #define SafeAreaSpacerViewManager_h @interface SafeAreaSpacerViewManager : RCTViewManager @end #endif /* SafeAreaSpacerViewManager_h */
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * vdpa device management interface * Copyright (c) 2020 Mellanox Technologies Ltd. All rights reserved. */ #ifndef _LINUX_VDPA_H_ #define _LINUX_VDPA_H_ #define VDPA_GENL_NAME "vdpa" #define VDPA_GENL_VERSION 0x1 enum vdpa_command { VDPA_CMD_UNSPEC, VDPA_CMD_MGMTDEV_NEW, VDPA_CMD_MGMTDEV_GET, /* can dump */ VDPA_CMD_DEV_NEW, VDPA_CMD_DEV_DEL, VDPA_CMD_DEV_GET, /* can dump */ VDPA_CMD_DEV_CONFIG_GET, /* can dump */ }; enum vdpa_attr { VDPA_ATTR_UNSPEC, /* bus name (optional) + dev name together make the parent device handle */ VDPA_ATTR_MGMTDEV_BUS_NAME, /* string */ VDPA_ATTR_MGMTDEV_DEV_NAME, /* string */ VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES, /* u64 */ VDPA_ATTR_DEV_NAME, /* string */ VDPA_ATTR_DEV_ID, /* u32 */ VDPA_ATTR_DEV_VENDOR_ID, /* u32 */ VDPA_ATTR_DEV_MAX_VQS, /* u32 */ VDPA_ATTR_DEV_MAX_VQ_SIZE, /* u16 */ VDPA_ATTR_DEV_MIN_VQ_SIZE, /* u16 */ VDPA_ATTR_DEV_NET_CFG_MACADDR, /* binary */ VDPA_ATTR_DEV_NET_STATUS, /* u8 */ VDPA_ATTR_DEV_NET_CFG_MAX_VQP, /* u16 */ VDPA_ATTR_DEV_NET_CFG_MTU, /* u16 */ /* new attributes must be added above here */ VDPA_ATTR_MAX, }; #endif
/*! @file @author Albert Semenov @date 09/2008 */ #ifndef __DIALOG_H__ #define __DIALOG_H__ #include <MyGUI.h> #include "BaseLayout.h" namespace tools { class MYGUI_EXPORT Dialog : public wraps::BaseLayout { public: typedef MyGUI::delegates::CDelegate2<Dialog*, bool> EventHandle_Result; public: Dialog(); Dialog(const std::string& _layout); virtual ~Dialog(); void doModal(); void endModal(); EventHandle_Result eventEndDialog; protected: virtual void onDoModal() { } virtual void onEndModal() { } private: bool mModal; }; } // namespace tools #endif // __DIALOG_H__
#ifndef SCREEN_H #define SCREEN_H #define VGA_CRTC_INDEX 0x3D4 #define VGA_CRTC_DATA 0x3D5 #define VGA_COLOR_BLACK 0 #define VGA_COLOR_BLUE 1 #define VGA_COLOR_GREEN 2 #define VGA_COLOR_AQUA 3 #define VGA_COLOR_RED 4 #define VGA_COLOR_PURPLE 5 #define VGA_COLOR_YELLOW 6 #define VGA_COLOR_WHITE 7 #define VGA_COLOR_GRAY 8 #define VGA_COLOR_LTBLUE 9 #define VGA_COLOR_LTGREEN 10 #define VGA_COLOR_LTAQUA 11 #define VGA_COLOR_LTRED 12 #define VGA_COLOR_LTPURPLE 13 #define VGA_COLOR_LTYELLOW 14 #define VGA_COLOR_LTWHITE 15 void showCursor(); void hideCursor(); void updateCursor(); void _cls(unsigned char ch); unsigned char _putch(unsigned char ch); void putsnocr(const char *text, ...); void _puts(char *text); void _setTextColor(char foreground, char background); void goToxy(int x, int y); void drawProgressBar(); #endif
#ifndef JOKEPROVIDER_H #define JOKEPROVIDER_H #include "Joke.h" #include <memory> #include <ctime> class JokesDelegate { public: enum Error { NetworkError, ParseError }; virtual void onJokesRecieved(const Jokes&) {} virtual void onJokesError(const Error error, const std::string& error_description) { error; error_description; } virtual ~JokesDelegate() {} JokesDelegate() {} private: JokesDelegate(const JokesDelegate&); JokesDelegate& operator=(const JokesDelegate&); }; typedef std::auto_ptr<JokesDelegate> JokesDelegatePtr; typedef std::string JokeProviderID; class JokeProvider { public: JokeProvider() {} void getJokes(JokesDelegatePtr delegate) { _last_request = time(NULL); do_getJokes(delegate); } const time_t getLastRequestTime() const { return _last_request; } const JokeProviderID getProviderID() const { return do_getProviderID(); } virtual ~JokeProvider() {} private: virtual void do_getJokes(JokesDelegatePtr) = 0; virtual JokeProviderID do_getProviderID() const = 0; time_t _last_request; JokeProvider(const JokeProvider&); JokeProvider& operator=(const JokeProvider&); }; typedef std::auto_ptr<JokeProvider> JokeProviderPtr; #endif // JOKEPROVIDER_H
// // RYDownloader.h // RYUtils // // Created by Ryan on 13-4-17. // Copyright (c) 2013年 Ryan. All rights reserved. // #import <Foundation/Foundation.h> typedef enum { kDownloadWaiting = 0, //等待下载 kDownloading = 1, //正在下载 kDownloadingHandling = 2, //下载已返回,处于回调处理中 kDownloadSucceed = 3, //下载成功 kDownloadFailed = 4, //下载失败 kDownloadCanceled = 5 //下载取消 }DownloaderStatus; @protocol RYDownloaderDelegate; @interface RYDownloader : NSObject @property (nonatomic, copy) NSString* purpose; //downloader的标识 @property (nonatomic, assign) DownloaderStatus status; //设置下载状态,默认为等待下载 #if ! __has_feature(objc_arc) @property (nonatomic, retain) NSURLRequest *urlRequest; @property (nonatomic, retain) NSURLConnection *theConnection; @property (nonatomic, retain) NSMutableData *responseData; @property (nonatomic, assign) id<RYDownloaderDelegate> delegate; #else @property (nonatomic, strong) NSURLRequest *urlRequest; @property (nonatomic, strong) NSURLConnection *theConnection; @property (nonatomic, strong) NSMutableData *responseData; @property (nonatomic, weak) id<RYDownloaderDelegate> delegate; #endif - (void)startDownloadWithRequest:(NSURLRequest *)request callback:(id<RYDownloaderDelegate>)receiver purpose:(NSString *)pur; - (void)cancelDownload; @end @protocol RYDownloaderDelegate<NSObject> - (void)downloader:(RYDownloader*)downloader completeWithNSData:(NSData*)data; - (void)downloader:(RYDownloader*)downloader didFinishWithError:(NSString*)message; @end
#ifndef ANIMATOR_H #define ANIMATOR_H #include "vector" #include "map" #include "QString" #include "graphicsstateitem.h" #include "parameter.h" #include <QHash> class Animator { public: Animator(); /** * @brief addParameter * @param name * @param p * @return */ void addParameter(QString name, Parameter &p); /** * @brief addState * @param s * @return */ void addState(GraphicsStateItem &s); /** * @brief saveToXml * @param filename */ void saveToXml(const QString &filename); private: QHash<QString, Parameter> parameters; }; #endif // ANIMATOR_H
/* * nghttp2 - HTTP/2 C Library * * Copyright (c) 2014 Tatsuhiro Tsujikawa * * 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 BUFFER_H #define BUFFER_H #include "nghttp2_config.h" #include <cstring> #include <algorithm> #include <array> namespace nghttp2 { template <size_t N> struct Buffer { Buffer() : pos(std::begin(buf)), last(pos) {} // Returns the number of bytes to read. size_t rleft() const { return last - pos; } // Returns the number of bytes this buffer can store. size_t wleft() const { return std::end(buf) - last; } // Writes up to min(wleft(), |count|) bytes from buffer pointed by // |src|. Returns number of bytes written. size_t write(const void *src, size_t count) { count = std::min(count, wleft()); auto p = static_cast<const uint8_t *>(src); last = std::copy_n(p, count, last); return count; } size_t write(size_t count) { count = std::min(count, wleft()); last += count; return count; } // Drains min(rleft(), |count|) bytes from start of the buffer. size_t drain(size_t count) { count = std::min(count, rleft()); pos += count; return count; } void reset() { pos = last = std::begin(buf); } std::array<uint8_t, N> buf; uint8_t *pos, *last; }; } // namespace nghttp2 #endif // BUFFER_H
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE124_Buffer_Underwrite__malloc_char_memcpy_31.c Label Definition File: CWE124_Buffer_Underwrite__malloc.label.xml Template File: sources-sink-31.tmpl.c */ /* * @description * CWE: 124 Buffer Underwrite * BadSource: Set data pointer to before the allocated memory buffer * GoodSource: Set data pointer to the allocated memory buffer * Sinks: memcpy * BadSink : Copy string to data using memcpy * Flow Variant: 31 Data flow using a copy of data within the same function * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE124_Buffer_Underwrite__malloc_char_memcpy_31_bad() { char * data; data = NULL; { char * dataBuffer = (char *)malloc(100*sizeof(char)); memset(dataBuffer, 'A', 100-1); dataBuffer[100-1] = '\0'; /* FLAW: Set data pointer to before the allocated memory buffer */ data = dataBuffer - 8; } { char * dataCopy = data; char * data = dataCopy; { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */ memcpy(data, source, 100*sizeof(char)); /* Ensure the destination buffer is null terminated */ data[100-1] = '\0'; printLine(data); /* INCIDENTAL CWE-401: Memory Leak - data may not point to location * returned by malloc() so can't safely call free() on it */ } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2B() { char * data; data = NULL; { char * dataBuffer = (char *)malloc(100*sizeof(char)); memset(dataBuffer, 'A', 100-1); dataBuffer[100-1] = '\0'; /* FIX: Set data pointer to the allocated memory buffer */ data = dataBuffer; } { char * dataCopy = data; char * data = dataCopy; { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */ memcpy(data, source, 100*sizeof(char)); /* Ensure the destination buffer is null terminated */ data[100-1] = '\0'; printLine(data); /* INCIDENTAL CWE-401: Memory Leak - data may not point to location * returned by malloc() so can't safely call free() on it */ } } } void CWE124_Buffer_Underwrite__malloc_char_memcpy_31_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE124_Buffer_Underwrite__malloc_char_memcpy_31_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE124_Buffer_Underwrite__malloc_char_memcpy_31_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// // MHTableDataController.h // MVVM // // Created by Marko Hlebar on 25/10/2014. // Copyright (c) 2014 Marko Hlebar. All rights reserved. // #import <Foundation/Foundation.h> #import "MHNameViewModel.h" #import "MHColorViewModel.h" #import <BIND/BNDDataController.h> @class MHPerson; @class MHPersonFetcher; @interface MHPersonDataController : NSObject <BNDDataController> @property (nonatomic, strong) MHPersonFetcher *dataFetcher; @end
// // DHResolvingDoorRenderer.h // DHAnimation // // Created by Huang Hongsen on 3/24/16. // Copyright © 2016 cn.daniel. All rights reserved. // #import "DHTransitionRenderer.h" @interface DHResolvingDoorTransitionRenderer : DHTransitionRenderer @end
#pragma once //------------------------------------------------------------------------------ /** @class Tools::CoreGameState A basic game state (C) 2013-2014 Individual contributors, see AUTHORS file */ #include "statehandlers/gamestatehandler.h" //------------------------------------------------------------------------------ namespace Tools { class MenuState : public BaseGameFeature::GameStateHandler { __DeclareClass(MenuState); public: /// constructor MenuState(); /// destructor virtual ~MenuState(); /// called when the state represented by this state handler is entered void OnStateEnter(const Util::String& prevState) override; /// called when the state represented by this state handler is left void OnStateLeave(const Util::String& nextState) override; /// called each frame as long as state is current, return new state Util::String OnFrame() override; /// called after Db is opened, and before entities are loaded void OnLoadBefore() override; /// called after entities are loaded void OnLoadAfter() override; // handle all user input; called @ LevelEditorState::OnFrame() void HandleInput(); private: }; } // namespace Tools //------------------------------------------------------------------------------
// The ROCCC Compiler Infrastructure // This file is distributed under the University of California Open Source // License. See ROCCCLICENSE.TXT for details. /* --*- C++ -*-- File: VHDLOutputPass.h This contains the declarations of the VHDLOutputPass class as well as the helper classes of LibraryEntry and Port for definitions of all the things located in the library. */ #ifndef __VHDL_OUTPUT_PASS_DOT_H__ #define __VHDL_OUTPUT_PASS_DOT_H__ #include "llvm/Pass.h" #include "rocccLibrary/DFFunction.h" #include "rocccLibrary/VHDLInterface.h" #include "rocccLibrary/StreamVariable.h" namespace llvm { // Our pass should work on a function by function basis. The function // will consist of many data flow nodes, but they all should fit // within the same common framework as vanilla llvm. // // Also, since ROCCC hi-cirrf only supports one function definition per // translation unit we don't have to worry about the random ordering // a function pass provides. class VHDLOutputPass : public FunctionPass { std::vector<StreamVariable> streams; public: VHDLInterface::Entity* entity; std::vector<StreamVariable>::iterator streamBegin(); std::vector<StreamVariable>::iterator streamEnd(); private: //the vhdl interface void setupVHDLInterface(DFFunction* f); void finalizeVHDLInterface(DFFunction* f); VHDLInterface::ComponentDefinition* loopComponent; VHDLInterface::ComponentDefinition* inputComponent; VHDLInterface::ComponentDefinition* outputComponent; // These are the main entry points for outputting all VHDL void OutputBlock(DFFunction* f) ; void OutputModule(DFFunction* f) ; public: // Used for registration in llvm's pass manager static char ID ; VHDLOutputPass() ; ~VHDLOutputPass() ; virtual bool runOnFunction(Function& F) ; virtual void getAnalysisUsage(AnalysisUsage &AU) const; }; } #endif
// // Strawberry.h // CutCutCut // // Created by Allen Benson G Tan on 5/16/12. // Copyright 2012 WhiteWidget Inc. All rights reserved. // #import <Foundation/Foundation.h> #import "cocos2d.h" #import "PolygonSprite.h" @interface Strawberry : PolygonSprite { } @end
/* $Id: gvplugin_lasi.c,v 1.6 2011/01/25 16:30:51 ellson Exp $ $Revision: 1.6 $ */ /* vim:set shiftwidth=4 ts=8: */ /************************************************************************* * Copyright (c) 2011 AT&T Intellectual Property * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ #include "gvplugin.h" extern gvplugin_installed_t gvdevice_lasi_types[]; extern gvplugin_installed_t gvrender_lasi_types[]; static gvplugin_api_t apis[] = { {API_device, gvdevice_lasi_types}, {API_render, gvrender_lasi_types}, {(api_t)0, 0}, }; gvplugin_library_t gvplugin_lasi_LTX_library = { "lasi", apis };
/** ****************************************************************************** * @file system_stm32l0xx.h * @author MCD Application Team * @version V1.2.0 * @date 06-February-2015 * @brief CMSIS Cortex-M0+ Device Peripheral Access Layer System Header File. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /** @addtogroup CMSIS * @{ */ /** @addtogroup stm32l0xx_system * @{ */ /** * @brief Define to prevent recursive inclusion */ #ifndef __SYSTEM_STM32L0XX_H #define __SYSTEM_STM32L0XX_H #ifdef __cplusplus extern "C" { #endif /** @addtogroup STM32L0xx_System_Includes * @{ */ /** * @} */ /** @addtogroup STM32L0xx_System_Exported_types * @{ */ /* This variable is updated in three ways: 1) by calling CMSIS function SystemCoreClockUpdate() 2) by calling HAL API function HAL_RCC_GetSysClockFreq() 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency Note: If you use this function to configure the system clock; then there is no need to call the 2 first functions listed above, since SystemCoreClock variable is updated automatically. */ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ /** * @} */ /** @addtogroup STM32L0xx_System_Exported_Constants * @{ */ /** * @} */ /** @addtogroup STM32L0xx_System_Exported_Macros * @{ */ /** * @} */ /** @addtogroup STM32L0xx_System_Exported_Functions * @{ */ extern void SystemInit(void); extern void SystemCoreClockUpdate(void); extern void SetSysClock(void); /** * @} */ #ifdef __cplusplus } #endif #endif /*__SYSTEM_STM32L0XX_H */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* * UAE - The Un*x Amiga Emulator * * Support for SDL sound * * Copyright 1997 Bernd Schmidt */ #define SOUNDSTUFF 1 #define AUDIO_NAME "sdl" extern uint16_t paula_sndbuffer[]; extern uint16_t *paula_sndbufpt; extern int32_t paula_sndbufsize; void finish_sound_buffer (void); void restart_sound_buffer (void); int32_t init_sound (void); void close_sound (void); int32_t setup_sound (void); void resume_sound (void); void pause_sound (void); void reset_sound (void); void sound_setadjust (double); int32_t enumerate_sound_devices (void); int32_t drivesound_init (void); void drivesound_free (void); void sound_mute (int32_t); void sound_volume (int32_t); void set_volume (int32_t, int32_t); void master_sound_volume (int32_t); struct sound_dp; struct sound_data { int32_t waiting_for_buffer; int32_t devicetype; int32_t obtainedfreq; int32_t paused; int32_t mute; int32_t channels; int32_t freq; int32_t samplesize; int32_t sndbufsize; struct sound_dp *data; }; void send_sound (struct sound_data *sd, uint16_t *sndbuffer); int32_t open_sound_device (struct sound_data *sd, int32_t index, int32_t exclusive, int32_t bufsize, int32_t freq, int32_t channels); void close_sound_device (struct sound_data *sd); void pause_sound_device (struct sound_data *sd); void resume_sound_device (struct sound_data *sd); void set_volume_sound_device (struct sound_data *sd, int32_t volume, int32_t mute); int32_t get_offset_sound_device (struct sound_data *sd); int32_t blocking_sound_device (struct sound_data *sd); void audio_default_options (struct uae_prefs *p); void audio_save_options (FILE *f, const struct uae_prefs *p); int32_t audio_parse_option (struct uae_prefs *p, const char *option, const char *value); #if SOUNDSTUFF > 0 extern int outputsample, doublesample; #endif #if SOUNDSTUFF > 1 static uint16_t *paula_sndbufpt_prev, *paula_sndbufpt_start; #endif // SOUNDSTUFF STATIC_INLINE void set_sound_buffers (void) { #if SOUNDSTUFF > 1 paula_sndbufpt_prev = paula_sndbufpt_start; paula_sndbufpt_start = paula_sndbufpt; #endif } STATIC_INLINE void check_sound_buffers (void) { #if SOUNDSTUFF > 1 int32_t len; #endif if (currprefs.sound_stereo == SND_4CH_CLONEDSTEREO) { ((uint16_t*)paula_sndbufpt)[0] = ((uint16_t*)paula_sndbufpt)[-2]; ((uint16_t*)paula_sndbufpt)[1] = ((uint16_t*)paula_sndbufpt)[-1]; paula_sndbufpt = (uint16_t *)(((uint8_t *)paula_sndbufpt) + 2 * 2); } else if (currprefs.sound_stereo == SND_6CH_CLONEDSTEREO) { int16_t *p = ((int16_t*)paula_sndbufpt); int32_t sum; p[2] = p[-2]; p[3] = p[-1]; sum = (int32_t)(p[-2]) + (int32_t)(p[-1]) + (int32_t)(p[2]) + (int32_t)(p[3]); p[0] = sum / 8; p[1] = sum / 8; paula_sndbufpt = (uint16_t *)(((uint8_t *)paula_sndbufpt) + 4 * 2); } #if SOUNDSTUFF > 1 if (outputsample == 0) return; len = paula_sndbufpt - paula_sndbufpt_start; if (outputsample < 0) { int32_t i; int16_t *p1 = (int16_t*)paula_sndbufpt_prev; int16_t *p2 = (int16_t*)paula_sndbufpt_start; for (i = 0; i < len; i++) { *p1 = (*p1 + *p2) / 2; } paula_sndbufpt = paula_sndbufpt_start; } #endif if ((uint8_t*)paula_sndbufpt - (uint8_t*)paula_sndbuffer >= paula_sndbufsize) { finish_sound_buffer (); paula_sndbufpt = paula_sndbuffer; } #if SOUNDSTUFF > 1 while (doublesample-- > 0) { memcpy (paula_sndbufpt, paula_sndbufpt_start, len * 2); paula_sndbufpt += len; if ((uint8_t*)paula_sndbufpt - (uint8_t*)paula_sndbuffer >= paula_sndbufsize) { finish_sound_buffer (); paula_sndbufpt = paula_sndbuffer; } } #endif } STATIC_INLINE void clear_sound_buffers (void) { memset (paula_sndbuffer, 0, paula_sndbufsize); paula_sndbufpt = paula_sndbuffer; } #define PUT_SOUND_WORD(b) do { *(uint16_t *)paula_sndbufpt = b; paula_sndbufpt = (uint16_t *)(((uint8_t *)paula_sndbufpt) + 2); } while (0) #define PUT_SOUND_WORD_LEFT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[0]); PUT_SOUND_WORD(b); } while (0) #define PUT_SOUND_WORD_RIGHT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[1]); PUT_SOUND_WORD(b); } while (0) #define PUT_SOUND_WORD_LEFT2(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[2]); PUT_SOUND_WORD(b); } while (0) #define PUT_SOUND_WORD_RIGHT2(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[3]); PUT_SOUND_WORD(b); } while (0) #define PUT_SOUND_WORD_MONO(b) PUT_SOUND_WORD_LEFT(b) #define SOUND16_BASE_VAL 0 #define SOUND8_BASE_VAL 128 #define DEFAULT_SOUND_MAXB 16384 #define DEFAULT_SOUND_MINB 16384 #define DEFAULT_SOUND_BITS 16 #define DEFAULT_SOUND_FREQ 44100 #define HAVE_STEREO_SUPPORT #define FILTER_SOUND_OFF 0 #define FILTER_SOUND_EMUL 1 #define FILTER_SOUND_ON 2 #define FILTER_SOUND_TYPE_A500 0 #define FILTER_SOUND_TYPE_A1200 1
/* * \brief Provide a processor object for every available processor * \author Martin Stein * \author Stefan Kalkowski * \date 2014-01-14 */ /* * Copyright (C) 2014 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ #ifndef _KERNEL__PROCESSOR_POOL_H_ #define _KERNEL__PROCESSOR_POOL_H_ /* base includes */ #include <unmanaged_singleton.h> /* core includes */ #include <kernel/kernel.h> #include <kernel/thread.h> namespace Kernel { /** * Thread that consumes processor time if no other thread is available */ class Idle_thread; /** * Provides a processor object for every available processor */ class Processor_pool; /** * Return Processor_pool singleton */ Processor_pool * processor_pool(); } class Kernel::Idle_thread : public Thread { private: enum { STACK_SIZE = sizeof(addr_t) * 32, STACK_ALIGNM = Processor_driver::DATA_ACCESS_ALIGNM, }; char _stack[STACK_SIZE] __attribute__((aligned(STACK_ALIGNM))); /** * Main function of all idle threads */ static void _main() { while (1) { Processor_driver::wait_for_interrupt(); } } public: /** * Constructor * * \param processor kernel object of targeted processor */ Idle_thread(Processor * const processor) : Thread(Priority::MAX, "idle") { ip = (addr_t)&_main; sp = (addr_t)&_stack[STACK_SIZE]; init(processor, core_pd(), 0, 0); } }; class Kernel::Processor_pool { private: char _processors[PROCESSORS][sizeof(Processor)]; char _idle_threads[PROCESSORS][sizeof(Idle_thread)]; /** * Return idle thread of a specific processor * * \param processor_id kernel name of the targeted processor */ Idle_thread * _idle_thread(unsigned const processor_id) const { char * const p = const_cast<char *>(_idle_threads[processor_id]); return reinterpret_cast<Idle_thread *>(p); } public: /** * Constructor */ Processor_pool() { for (unsigned i = 0; i < PROCESSORS; i++) { new (_idle_threads[i]) Idle_thread(processor(i)); new (_processors[i]) Processor(i, _idle_thread(i)); } } /** * Return the object of a specific processor * * \param id kernel name of the targeted processor */ Processor * processor(unsigned const id) const { assert(id < PROCESSORS); char * const p = const_cast<char *>(_processors[id]); return reinterpret_cast<Processor *>(p); } /** * Return the object of the primary processor */ Processor * primary_processor() const { return processor(Processor::primary_id()); } }; #endif /* _KERNEL__PROCESSOR_POOL_H_ */
/* Scheme/Guile language support routines for GDB, the GNU debugger. Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003, 2005, 2008, 2009 Free Software Foundation, Inc. This file is part of GDB. 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/>. */ #define SICP #include "scm-tags.h" #undef SCM_NCELLP #define SCM_NCELLP(x) ((SCM_SIZE-1) & (int)(x)) #define SCM_ITAG8_DATA(X) ((X)>>8) #define SCM_ICHR(x) ((unsigned char)SCM_ITAG8_DATA(x)) #define SCM_ICHRP(x) (SCM_ITAG8(x) == scm_tc8_char) #define scm_tc8_char 0xf4 #define SCM_IFLAGP(n) ((0x87 & (int)(n))==4) #define SCM_ISYMNUM(n) ((int)((n)>>9)) #define SCM_ISYMCHARS(n) (scm_isymnames[SCM_ISYMNUM(n)]) #define SCM_ILOCP(n) ((0xff & (int)(n))==0xfc) #define SCM_ITAG8(X) ((int)(X) & 0xff) #define SCM_TYP7(x) (0x7f & (int)SCM_CAR(x)) #define SCM_LENGTH(x) (((unsigned long)SCM_CAR(x))>>8) #define SCM_NCONSP(x) (1 & (int)SCM_CAR(x)) #define SCM_NECONSP(x) (SCM_NCONSP(x) && (1 != SCM_TYP3(x))) #define SCM_CAR(x) scm_get_field (x, 0, SCM_SIZE) #define SCM_CDR(x) scm_get_field (x, 1, SCM_SIZE) #define SCM_VELTS(x) ((SCM *)SCM_CDR(x)) #define SCM_CLOSCAR(x) (SCM_CAR(x)-scm_tc3_closure) #define SCM_CODE(x) SCM_CAR(SCM_CLOSCAR (x)) #define SCM_MAKINUM(x) (((x)<<2)+2L) /* Forward decls for prototypes */ struct value; extern int scm_value_print (struct value *, struct ui_file *, const struct value_print_options *); extern int scm_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, struct ui_file *, int, const struct value_print_options *); extern LONGEST scm_get_field (LONGEST, int, int); extern int is_scmvalue_type (struct type *); extern void scm_printchar (int, struct type *, struct ui_file *); extern struct value *scm_evaluate_string (char *, int); extern int scm_parse (void); extern LONGEST scm_unpack (struct type *, const gdb_byte *, enum type_code); /* Scheme types */ struct builtin_scm_type { struct type *builtin_scm; }; /* Return the Scheme type table for the specified architecture. */ extern const struct builtin_scm_type *builtin_scm_type (struct gdbarch *gdbarch);
/* * hyperion: freenode ircd * ircd-ratbox: A slightly useful ircd. * supported.h: Header for 005 numeric etc... * * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center * Copyright (C) 1996-2002 Hybrid Development Team * Copyright (C) 2002-2005 ircd-ratbox development team * Copyright (C) 2005 Jilles Tjoelker * * 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 * * From ratbox Id: supported.h,v 7.11 2005/03/21 23:26:55 androsyn Exp */ #ifndef INCLUDED_supported_h #define INCLUDED_supported_h #ifdef INVITE_CHANNEL_FORWARDING #define ISM_f "f" #else #define ISM_f "" #endif #ifdef JUPE_CHANNEL #define ISM_j "j" #else #define ISM_j "" #endif #define FEATURES "IRCD=dancer" \ " CAPAB" \ " CHANTYPES=#" \ " EXCEPTS" \ " INVEX" \ " CHANMODES=bdeIq,k,l" ISM_f "JD,cgi" ISM_j "LmnPQrRstz" \ " CHANLIMIT=#:%i" \ " PREFIX=(ov)@+" \ " MAXLIST=bdeI:%i" \ " MODES=%i" \ " STATUSMSG=@" \ " KNOCK" \ " NICKLEN=%i" #define FEATURESVALUES \ MAXCHANNELSPERUSER, \ MAXBANS, /* let's just show the value for -L chans -- jilles */ \ MAXMODEPARAMS, NICKLEN #ifdef SANE_CASE_CONVERSION /* I don't necessarily consider this "sane", but ok -- jilles */ #define IS_CASEMAPPING "ascii" #else #define IS_CASEMAPPING "rfc1459" #endif #define FEATURES2 "SAFELIST CALLERID" \ " CASEMAPPING=" IS_CASEMAPPING \ " CHANNELLEN=%i" \ " TOPICLEN=%i" \ " KICKLEN=%i" \ " KEYLEN=%i" \ " USERLEN=%i" \ " HOSTLEN=%i" \ " SILENCE=%i" \ " NETWORK=%s" \ "%s%c" #define FEATURES2VALUES \ CHANNELLEN, TOPICLEN, TOPICLEN, KEYLEN, USERLEN, HOSTLEN, \ MAXSILES, NETWORK_REALNAME, GlobalSetOptions.nickprefix ? " NOIDPREFIX=" : "", \ GlobalSetOptions.nickprefix /* * - from mirc's versions.txt * * mIRC now supports the numeric 005 tokens: CHANTYPES=# and * PREFIX=(ohv)@%+ and can handle a dynamic set of channel and * nick prefixes. * * mIRC assumes that @ is supported on all networks, any mode * left of @ is assumed to have at least equal power to @, and * any mode right of @ has less power. * * mIRC has internal support for @%+ modes. * * $nick() can now handle all mode letters listed in PREFIX. * * Also added support for CHANMODES=A,B,C,D token (not currently * supported by any servers), which lists all modes supported * by a channel, where: * * A = modes that take a parameter, and add or remove nicks * or addresses to a list, such as +bIe for the ban, * invite, and exception lists. * * B = modes that change channel settings, but which take * a parameter when they are set and unset, such as * +k key, and -k key. * * C = modes that change channel settings, but which take * a parameter only when they are set, such as +l N, * and -l. * * D = modes that change channel settings, such as +imnpst * and take no parameters. * * All unknown/unlisted modes are treated as type D. */ /* ELIST=[tokens]: * * M = mask search * N = !mask search * U = user count search (< >) * C = creation time search (C> C<) * T = topic search (T> T<) */ #endif /* INCLUDED_supported_h */
/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef MSM_EEPROM_H #define MSM_EEPROM_H #include <linux/i2c.h> #include <linux/gpio.h> #include <soc/qcom/camera2.h> #include <media/v4l2-subdev.h> #include <media/msmb_camera.h> #include "msm_camera_i2c.h" #include "msm_camera_spi.h" #include "msm_camera_io_util.h" #include "msm_camera_dt_util.h" struct msm_eeprom_ctrl_t; #define DEFINE_MSM_MUTEX(mutexname) \ static struct mutex mutexname = __MUTEX_INITIALIZER(mutexname) #define PROPERTY_MAXSIZE 32 #define OTP_CAMERA_BUFF_SIZE 0x400 struct msm_eeprom_ctrl_t { struct platform_device *pdev; struct mutex *eeprom_mutex; struct v4l2_subdev sdev; struct v4l2_subdev_ops *eeprom_v4l2_subdev_ops; enum msm_camera_device_type_t eeprom_device_type; struct msm_sd_subdev msm_sd; enum cci_i2c_master_t cci_master; struct msm_camera_i2c_client i2c_client; struct msm_eeprom_memory_block_t cal_data; uint8_t is_supported; struct msm_eeprom_board_info *eboard_info; uint32_t subdev_id; uint32_t read_eeprom; }; typedef int (*msm_otp_func)(uint8_t*, uint32_t, uint16_t); struct msm_otp_data { uint8_t data_type; msm_otp_func otp_data_func; }; struct msm_otp_type { uint32_t otp_camera_num; uint8_t module_id; uint8_t eeprom_name[19]; uint8_t otp_camera_buf[OTP_CAMERA_BUFF_SIZE]; struct msm_otp_data *otp_data_tbl; } msm_front_otp_type_str, msm_rear_otp_type_str; static int msm_get_otp_front_camera_id(uint8_t*, uint32_t, uint16_t); static int msm_get_otp_front_camera_awb(uint8_t*, uint32_t, uint16_t); static int msm_get_otp_front_camera_module_id(uint8_t*, uint32_t, uint16_t); static int msm_get_otp_rear_camera_id(uint8_t*, uint32_t, uint16_t); static int msm_get_otp_rear_camera_awb(uint8_t*, uint32_t, uint16_t); static int msm_get_otp_rear_camera_af(uint8_t*, uint32_t, uint16_t); static int msm_get_otp_rear_camera_ois(uint8_t*, uint32_t, uint16_t); static int msm_get_otp_rear_camera_pdaf(uint8_t*, uint32_t, uint16_t); static int msm_get_otp_rear_camera_module_id(uint8_t*, uint32_t, uint16_t); static int msm_get_otp_front_camera_all(uint8_t*, uint32_t, uint16_t); static int msm_get_otp_rear_camera_all(uint8_t*, uint32_t, uint16_t); #endif
/* * @(#) $Id$ * Copyright (C) 2003 David Necas (Yeti), Petr Klapetek. * E-mail: yeti@gwyddion.net, klapetek@gwyddion.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 __GWY_MODULE_BROSWER_H__ #define __GWY_MODULE_BROSWER_H__ #ifndef GWY_MODULE_ABI_VERSION #include <libgwymodule/gwymodule.h> #endif G_BEGIN_DECLS void gwy_module_browser (void); G_END_DECLS #endif /* __GWY_MODULE_BROWSER_H__ */ /* vim: set cin et ts=4 sw=4 cino=>1s,e0,n0,f0,{0,}0,^0,\:1s,=0,g1s,h0,t0,+1s,c3,(0,u0 : */
// -*- C++ -*- /*! \file ads/indexedPriorityQueue/IndexedPriorityQueueActive.h \brief Indexed priority queue that partitions the active and inactive elements. */ #if !defined(__ads_indexedPriorityQueue_IndexedPriorityQueueActive_h__) #define __ads_indexedPriorityQueue_IndexedPriorityQueueActive_h__ #include "IndexedPriorityQueueBase.h" BEGIN_NAMESPACE_ADS //! Indexed priority queue that partitions the active and inactive elements. /*! \param Key is the key type. */ template<typename _Key = double> class IndexedPriorityQueueActive : public IndexedPriorityQueueBase<_Key> { // // Public types. // public: //! The key type. typedef _Key Key; // // Private types. // private: typedef IndexedPriorityQueueBase<Key> Base; typedef typename Base::Iterator Iterator; // // Member data. // protected: using Base::_keys; using Base::_indices; using Base::_queue; using Base::_compare; //! The end of the active elements. typename ads::Array<1, Iterator>::iterator _activeEnd; //-------------------------------------------------------------------------- //! \name Constructors etc. //@{ public: //! Construct from the size. IndexedPriorityQueueActive(const int size) : Base(size), _activeEnd(_queue.begin()) { } //@} //-------------------------------------------------------------------------- //! \name Accessors. //@{ public: //! Return the key of the specified element. using Base::get; //! Return the beginning of the queue. using Base::getQueueBeginning; //! Return the end of the queue. typename ads::Array<1, Iterator>::const_iterator getQueueEnd() const { return _activeEnd; } //@} //-------------------------------------------------------------------------- //! \name Manipulators. //@{ public: //! Return the end of the queue. typename ads::Array<1, Iterator>::iterator getQueueEnd() { return _activeEnd; } //! Swap the two elements' positions in the queue. using Base::swap; //! Recompute the indices after the queue has changed. using Base::recomputeIndices; //! Pop the top element off the queue. void popTop() { #ifdef DEBUG_ads assert(_keys[Base::_topIndex] != std::numeric_limits<Key>::max()); #endif Base::popTop(); moveToInactive(Base::_topIndex); } //! Pop the element off the queue. void pop(const int index) { // If it is currently in the active queue. if (_keys[index] != std::numeric_limits<Key>::max()) { _keys[index] = std::numeric_limits<Key>::max(); moveToInactive(index); } } //! Push the top value into the queue. using Base::pushTop; //! Push the value into the queue. void push(const int index, const Key key) { if (_keys[index] == std::numeric_limits<Key>::max()) { #ifdef DEBUG_ads assert(key != std::numeric_limits<Key>::max()); #endif moveToActive(index); } _keys[index] = key; } //! Change the value in the queue. void set(const int index, const Key key) { #ifdef DEBUG_ads assert(_keys[index] != std::numeric_limits<Key>::max() && key != std::numeric_limits<Key>::max()); #endif _keys[index] = key; } //! Clear the queue. void clear() { Base::clear(); _activeEnd = _queue.begin(); } //! Recompute the indices after the queue has changed. void recomputeIndices() { Base::recomputeIndices(getQueueBeginning(), getQueueEnd()); } private: //! Move the element into the inactive partition. /*! \pre The element must be in the active partition. */ void moveToInactive(const int index) { #ifdef DEBUG_ads assert(_indices[index] < _activeEnd - _queue.begin()); #endif --_activeEnd; Base::swap(_queue.begin() + _indices[index], _activeEnd); } //! Move the element into the active partition. /*! \pre The element must be in the inactive partition. */ void moveToActive(const int index) { #ifdef DEBUG_ads assert(_indices[index] >= _activeEnd - _queue.begin()); #endif Base::swap(_queue.begin() + _indices[index], _activeEnd); ++_activeEnd; } //@} }; END_NAMESPACE_ADS #endif
#if !defined(_ECP_R_SMB1_H) #define _ECP_R_SMB1_H /*! * @file * @brief File contains ecp robot class declaration for SwarmItFix mobile base * @author twiniars <twiniars@ia.pw.edu.pl>, Warsaw University of Technology * * @ingroup smb */ #include "const_smb1.h" #include "ecp_r_smb.h" namespace mrrocpp { namespace ecp { namespace smb1 { /*! * @brief SwarmItFix Parallel Kinematic Machine gripper ecp robot class * * @author twiniars <twiniars@ia.pw.edu.pl>, Warsaw University of Technology * @ingroup smb */ class robot : public smb::robot { public: /** * @brief constructor called from UI * @param _config configuration object reference * @param _sr_ecp sr_ecp communication object reference */ robot(lib::configurator &_config, lib::sr_ecp &_sr_ecp); /** * @brief constructor called from ECP * @param _ecp_object ecp tak object reference */ robot(common::task::task_base& _ecp_object); }; } // namespace smb } // namespace ecp } // namespace mrrocpp #endif
/*************************************************************************** icq.h - description ------------------- begin : Sun Mar 17 2002 copyright : (C) 2002 by Vladimir Shutoff email : vovan@shutoff.ru ***************************************************************************/ /*************************************************************************** * * * 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 _ICQ_H #define _ICQ_H #include "contacts.h" #include "contacts/client.h" #include "contacts/imstatus.h" #include "icqstatus.h" //class CorePlugin; //const unsigned IcqCmdBase = 0x00040000; //#include "icq_events.h" //const unsigned long CmdVisibleList = IcqCmdBase; //const unsigned long CmdInvisibleList = IcqCmdBase + 1; //const unsigned long CmdGroups = IcqCmdBase + 2; //const unsigned long CmdIcqSendMessage = IcqCmdBase + 5; //const unsigned long CmdShowWarning = IcqCmdBase + 6; //const unsigned long CmdPasswordFail = IcqCmdBase + 7; //const unsigned long CmdPasswordSuccess = IcqCmdBase + 8; //const unsigned long MenuSearchResult = IcqCmdBase; //const unsigned long MenuIcqGroups = IcqCmdBase + 2; class ICQProtocol : public SIM::Protocol { public: ICQProtocol(SIM::Plugin *plugin); ~ICQProtocol(); virtual QString name(); virtual QString iconId(); virtual SIM::ClientPtr createClient(const QString& name); private: void initStatuses(); void addStatus(ICQStatusPtr status); QList<ICQStatusPtr> m_states; }; //class AIMProtocol : public SIM::Protocol //{ //public: // AIMProtocol(SIM::Plugin *plugin); // ~AIMProtocol(); // virtual SIM::ClientPtr createClient(Buffer *cfg); // virtual SIM::ClientPtr createClient(const QString& name); // virtual SIM::IMContact* createIMContact(const QSharedPointer<SIM::Client>& client); // virtual QStringList states(); // virtual SIM::IMStatusPtr status(const QString& id); //}; class ICQPlugin : public SIM::Plugin { public: ICQPlugin(); virtual ~ICQPlugin(); unsigned OscarPacket; unsigned ICQDirectPacket; unsigned AIMDirectPacket; unsigned RetrySendDND; unsigned RetrySendOccupied; SIM::ProtocolPtr m_icq; SIM::ProtocolPtr m_aim; static ICQPlugin *icq_plugin; void registerMessages(); void unregisterMessages(); }; #endif
/****************************************************************************** * Icinga 2 * * Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ #ifndef STATUSDATAWRITER_H #define STATUSDATAWRITER_H #include "compat/statusdatawriter.th" #include "icinga/host.h" #include "icinga/service.h" #include "icinga/command.h" #include "icinga/compatutility.h" #include "base/objectlock.h" #include "base/timer.h" #include "base/utility.h" #include <boost/thread/thread.hpp> #include <iostream> namespace icinga { /** * @ingroup compat */ class StatusDataWriter : public ObjectImpl<StatusDataWriter> { public: DECLARE_PTR_TYPEDEFS(StatusDataWriter); DECLARE_TYPENAME(StatusDataWriter); static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata); protected: virtual void Start(void); private: Timer::Ptr m_StatusTimer; void DumpCommand(std::ostream& fp, const Command::Ptr& command); void DumpTimePeriod(std::ostream& fp, const TimePeriod::Ptr& tp); void DumpDowntimes(std::ostream& fp, const Checkable::Ptr& owner); void DumpComments(std::ostream& fp, const Checkable::Ptr& owner); void DumpHostStatus(std::ostream& fp, const Host::Ptr& host); void DumpHostObject(std::ostream& fp, const Host::Ptr& host); void DumpCheckableStatusAttrs(std::ostream& fp, const Checkable::Ptr& checkable); template<typename T> void DumpNameList(std::ostream& fp, const T& list) { typename T::const_iterator it; bool first = true; for (it = list.begin(); it != list.end(); it++) { if (!first) fp << ","; else first = false; ObjectLock olock(*it); fp << (*it)->GetName(); } } template<typename T> void DumpStringList(std::ostream& fp, const T& list) { typename T::const_iterator it; bool first = true; for (it = list.begin(); it != list.end(); it++) { if (!first) fp << ","; else first = false; fp << *it; } } void DumpServiceStatus(std::ostream& fp, const Service::Ptr& service); void DumpServiceObject(std::ostream& fp, const Service::Ptr& service); void DumpCustomAttributes(std::ostream& fp, const DynamicObject::Ptr& object); void UpdateObjectsCache(void); void StatusTimerHandler(void); }; } #endif /* STATUSDATAWRITER_H */
/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id$ * * Copyright (C) 2007 by Dave Chapman * * 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #ifndef _BUTTON_TARGET_H_ #define _BUTTON_TARGET_H_ #define HAS_BUTTON_HOLD /* Main unit's buttons */ #define BUTTON_MENU 0x00000001 #define BUTTON_VOLUP 0x00000002 #define BUTTON_VOLDOWN 0x00000004 #define BUTTON_PLAYPAUSE 0x00000008 #define BUTTON_REPEATAB 0x00000010 #define BUTTON_LEFT 0x00000020 #define BUTTON_RIGHT 0x00000040 #define BUTTON_SELECT 0x00000080 #define BUTTON_MAIN (BUTTON_MENU|BUTTON_VOLUP|BUTTON_VOLDOWN\ |BUTTON_PLAYPAUSE|BUTTON_REPEATAB|BUTTON_LEFT\ |BUTTON_RIGHT|BUTTON_SELECT) /* Software power-off */ #define POWEROFF_BUTTON BUTTON_MENU #define POWEROFF_COUNT 40 #endif /* _BUTTON_TARGET_H_ */
/* * This source code is part of the Eutelescope package of Marlin. * You are free to use this source files for your own development as * long as it stays in a public research context. You are not * allowed to use it for commercial purpose. You must put this * header with author names in all development based on this file. * */ #ifndef EUTELEVENTIMPL_H #define EUTELEVENTIMPL_H // personal includes ".h" #include "EUTELESCOPE.h" // marlin includes ".h" // lcio includes <.h> #include <lcio.h> #include <IMPL/LCEventImpl.h> // system includes <> namespace eutelescope { //! Implementation of the LCEvent for the EUDET telescope. /*! This is a very trivial re-implementation of the LCEvent for the * EUDET telescope and it offers the some (honestly very few for * the time being) convenience methods to get useful things. * * A typical example comes from the need during the analysis * procedure to know how many events are contained into the file, * or at least to know whether the current event is the last * one. Being the LCIO data model based on the SIO data format, * featuring a pure serial I/O access to the data on disk, it is * not possible to know in advance how many events are stored into * a file and if there will be another event after the current. To * workaround this limitation we are adopting the so called * <b>BORE</b> (Beginning Of Run Event) and <b>EORE</b> (End Of Run * Event) events used also in the Bonn DAQ software. Those events * are saved into the file just with a flag identifying them among * the real events. Actually there is no need to have a BORE since * the first event is very well identified being the one following * the RunHeader. * All EUDET processors, as soon as they get the current event, * they will check if this is a EORE, and if so, they simply call * the <i>Finalize</i> method (if exists), otherwise it has to * return immediately. * * @author Antonio Bulgheroni, INFN <mailto:antonio.bulgheroni@gmail.com> * @version $Id$ * */ class EUTelEventImpl : public IMPL::LCEventImpl { public: //! Default constructor EUTelEventImpl (); //! Destructor virtual ~ EUTelEventImpl() { /* NO-OP */ ; } //! Set the event type /*! This method is used to set the type of this * EUTelEventImpl. For this purpose the EventType enumeration. * * @param type The event type in the form of a EventType enum * object */ virtual void setEventType(EventType type); //! Set the event type /*! This overloaded method is provided only for convenience and it * can be used to set the event type using the integer number * corresponding to the event type defined in the EventType enum. * * @param type The event type as integer number */ virtual void setEventType(int type); //! Return the event type /*! This method returns the event type as EventType enumeration * object. * * @return The event type according to the EventType enum */ inline EventType getEventType() const { EventType type = static_cast<EventType>(_params.getIntVal(EUTELESCOPE::EVENTTYPE)); return type; } }; // end of EUTelEventImpl } // eutelescope namespace #endif // EUTELEVENTIMPL
/* * u_ether.h -- interface to USB gadget "ethernet link" utilities * * Copyright (C) 2003-2005,2008 David Brownell * Copyright (C) 2003-2004 Robert Schwebel, Benedikt Spranger * Copyright (C) 2008 Nokia Corporation * * 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 __U_ETHER_H #define __U_ETHER_H #include <linux/err.h> #include <linux/if_ether.h> #include <linux/usb/composite.h> #include <linux/usb/cdc.h> #include "gadget_chips.h" /* * This represents the USB side of an "ethernet" link, managed by a USB * function which provides control and (maybe) framing. Two functions * in different configurations could share the same ethernet link/netdev, * using different host interaction models. * * There is a current limitation that only one instance of this link may * be present in any given configuration. When that's a problem, network * layer facilities can be used to package multiple logical links on this * single "physical" one. */ struct gether { struct usb_function func; /* updated by gether_{connect,disconnect} */ struct eth_dev *ioport; /* endpoints handle full and/or high speeds */ struct usb_ep *in_ep; struct usb_ep *out_ep; /* descriptors match device speed at gether_connect() time */ struct usb_endpoint_descriptor *in; struct usb_endpoint_descriptor *out; bool is_zlp_ok; u16 cdc_filter; /* hooks for added framing, as needed for RNDIS and EEM. * we currently don't support multiple frames per SKB. */ u32 header_len; struct sk_buff *(*wrap)(struct sk_buff *skb); int (*unwrap)(struct sk_buff *skb); /* called on network open/close */ void (*open)(struct gether *); void (*close)(struct gether *); }; #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ |USB_CDC_PACKET_TYPE_ALL_MULTICAST \ |USB_CDC_PACKET_TYPE_PROMISCUOUS \ |USB_CDC_PACKET_TYPE_DIRECTED) /* netdev setup/teardown as directed by the gadget driver */ int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]); void gether_cleanup(void); /* connect/disconnect is handled by individual functions */ struct net_device *gether_connect(struct gether *); void gether_disconnect(struct gether *); /* Some controllers can't support CDC Ethernet (ECM) ... */ static inline bool can_support_ecm(struct usb_gadget *gadget) { if (!gadget_supports_altsettings(gadget)) return false; /* SA1100 can do ECM, *without* status endpoint ... but we'll * only use it in non-ECM mode for backwards compatibility * (and since we currently require a status endpoint) */ if (gadget_is_sa1100(gadget)) return false; /* Everything else is *presumably* fine ... but this is a bit * chancy, so be **CERTAIN** there are no hardware issues with * your controller. Add it above if it can't handle CDC. */ return true; } /* each configuration may bind one instance of an ethernet link */ int geth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); int ecm_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); void rndis_function_enable(int enable); void ecm_function_enable(int enable); void geth_function_enable(int enable); #ifdef CONFIG_USB_ETH_RNDIS inline int rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]) { return 0; } #else inline int rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); #endif #endif /* __U_ETHER_H */
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* Sonic Visualiser An audio file viewer and annotation editor. Centre for Digital Music, Queen Mary, University of London. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file COPYING included with this distribution for more information. */ #ifndef _SURVEYER_H_ #define _SURVEYER_H_ #include <QStringList> #include <QString> #include <QObject> #include <QNetworkReply> class QNetworkAccessManager; class Surveyer : public QObject { Q_OBJECT public: Surveyer(QString hostname, QString testPath, QString surveyPath); virtual ~Surveyer(); protected slots: void finished(); void error(QNetworkReply::NetworkError); private: bool m_httpFailed; QString m_hostname; QString m_testPath; QString m_surveyPath; QNetworkReply *m_reply; QNetworkAccessManager *m_nm; }; #endif
/* * ipmi_smi.h * * MontaVista IPMI system management interface * * Author: MontaVista Software, Inc. * Corey Minyard <minyard@mvista.com> * source@mvista.com * * Copyright 2002 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __LINUX_IPMI_SMI_H #define __LINUX_IPMI_SMI_H #include <linux/ipmi_msgdefs.h> #include <linux/proc_fs.h> #include <linux/module.h> #include <linux/device.h> #include <linux/platform_device.h> #include <linux/ipmi_smi.h> typedef struct ipmi_smi *ipmi_smi_t; struct ipmi_smi_msg { struct list_head link; long msgid; void *user_data; int data_size; unsigned char data[IPMI_MAX_MSG_LENGTH]; int rsp_size; unsigned char rsp[IPMI_MAX_MSG_LENGTH]; void (*done)(struct ipmi_smi_msg *msg); }; struct ipmi_smi_handlers { struct module *owner; int (*start_processing)(void *send_info, ipmi_smi_t new_intf); void (*sender)(void *send_info, struct ipmi_smi_msg *msg, int priority); void (*request_events)(void *send_info); void (*set_run_to_completion)(void *send_info, int run_to_completion); void (*poll)(void *send_info); int (*inc_usecount)(void *send_info); void (*dec_usecount)(void *send_info); }; struct ipmi_device_id { unsigned char device_id; unsigned char device_revision; unsigned char firmware_revision_1; unsigned char firmware_revision_2; unsigned char ipmi_version; unsigned char additional_device_support; unsigned int manufacturer_id; unsigned int product_id; unsigned char aux_firmware_revision[4]; unsigned int aux_firmware_revision_set : 1; }; #define ipmi_version_major(v) ((v)->ipmi_version & 0xf) #define ipmi_version_minor(v) ((v)->ipmi_version >> 4) static inline void ipmi_demangle_device_id(unsigned char *data, unsigned int data_len, struct ipmi_device_id *id) { id->device_id = data[0]; id->device_revision = data[1]; id->firmware_revision_1 = data[2]; id->firmware_revision_2 = data[3]; id->ipmi_version = data[4]; id->additional_device_support = data[5]; id->manufacturer_id = data[6] | (data[7] << 8) | (data[8] << 16); id->product_id = data[9] | (data[10] << 8); if (data_len >= 15) { memcpy(id->aux_firmware_revision, data+11, 4); id->aux_firmware_revision_set = 1; } else id->aux_firmware_revision_set = 0; } int ipmi_register_smi(struct ipmi_smi_handlers *handlers, void *send_info, struct ipmi_device_id *device_id, struct device *dev, unsigned char slave_addr); int ipmi_unregister_smi(ipmi_smi_t intf); void ipmi_smi_msg_received(ipmi_smi_t intf, struct ipmi_smi_msg *msg); void ipmi_smi_watchdog_pretimeout(ipmi_smi_t intf); struct ipmi_smi_msg *ipmi_alloc_smi_msg(void); static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg) { msg->done(msg); } int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, read_proc_t *read_proc, write_proc_t *write_proc, void *data, struct module *owner); #endif
/* * linux/arch/arm/mm/copypage-v6.c * * Copyright (C) 2002 Deep Blue Solutions Ltd, All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/init.h> #include <linux/spinlock.h> #include <linux/mm.h> #include <linux/highmem.h> #include <asm/pgtable.h> #include <asm/shmparam.h> #include <asm/tlbflush.h> #include <asm/cacheflush.h> #include <asm/cachetype.h> #include "mm.h" #if SHMLBA > 16384 #error FIX ME #endif #define from_address (0xffff8000) #define to_address (0xffffc000) static DEFINE_SPINLOCK(v6_lock); /* * Copy the user page. No aliasing to deal with so we can just * attack the kernel's existing mapping of these pages. */ static void v6_copy_user_highpage_nonaliasing(struct page *to, struct page *from, unsigned long vaddr, struct vm_area_struct *vma) { void *kto, *kfrom; kfrom = kmap_atomic(from, KM_USER0); kto = kmap_atomic(to, KM_USER1); copy_page(kto, kfrom); __cpuc_flush_dcache_area(kto, PAGE_SIZE); kunmap_atomic(kto, KM_USER1); kunmap_atomic(kfrom, KM_USER0); } /* * Clear the user page. No aliasing to deal with so we can just * attack the kernel's existing mapping of this page. */ static void v6_clear_user_highpage_nonaliasing(struct page *page, unsigned long vaddr) { void *kaddr = kmap_atomic(page, KM_USER0); clear_page(kaddr); kunmap_atomic(kaddr, KM_USER0); } /* * Discard data in the kernel mapping for the new page. * FIXME: needs this MCRR to be supported. */ static void discard_old_kernel_data(void *kto) { __asm__("mcrr p15, 0, %1, %0, c6 @ 0xec401f06" : : "r" (kto), "r" ((unsigned long)kto + PAGE_SIZE - L1_CACHE_BYTES) : "cc"); } /* * Copy the page, taking account of the cache colour. */ static void v6_copy_user_highpage_aliasing(struct page *to, struct page *from, unsigned long vaddr, struct vm_area_struct *vma) { unsigned int offset = CACHE_COLOUR(vaddr); unsigned long kfrom, kto; if (!test_and_set_bit(PG_dcache_clean, &from->flags)) __flush_dcache_page(page_mapping(from), from); /* FIXME: not highmem safe */ discard_old_kernel_data(page_address(to)); /* * Now copy the page using the same cache colour as the * pages ultimate destination. */ spin_lock(&v6_lock); set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0); set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0); kfrom = from_address + (offset << PAGE_SHIFT); kto = to_address + (offset << PAGE_SHIFT); flush_tlb_kernel_page(kfrom); flush_tlb_kernel_page(kto); copy_page((void *)kto, (void *)kfrom); spin_unlock(&v6_lock); } /* * Clear the user page. We need to deal with the aliasing issues, * so remap the kernel page into the same cache colour as the user * page. */ static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vaddr) { unsigned int offset = CACHE_COLOUR(vaddr); unsigned long to = to_address + (offset << PAGE_SHIFT); /* FIXME: not highmem safe */ discard_old_kernel_data(page_address(page)); /* * Now clear the page using the same cache colour as * the pages ultimate destination. */ spin_lock(&v6_lock); set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0); flush_tlb_kernel_page(to); clear_page((void *)to); spin_unlock(&v6_lock); } struct cpu_user_fns v6_user_fns __initdata = { .cpu_clear_user_highpage = v6_clear_user_highpage_nonaliasing, .cpu_copy_user_highpage = v6_copy_user_highpage_nonaliasing, }; static int __init v6_userpage_init(void) { if (cache_is_vipt_aliasing()) { cpu_user.cpu_clear_user_highpage = v6_clear_user_highpage_aliasing; cpu_user.cpu_copy_user_highpage = v6_copy_user_highpage_aliasing; } return 0; } #ifndef CONFIG_KEXEC_MODULE core_initcall(v6_userpage_init); #endif
#include <stdlib.h> #include "lua.h" #include "lauxlib.h" #include "headers_lua.c" #include "mbox_lua.c" #include "socket_lua.c" #include "ftp_lua.c" #include "http_lua.c" #include "smtp_lua.c" #include "tp_lua.c" #include "url_lua.c" #include "ltn12_lua.c" #include "mime_lua.c" #define TEST(A) do { if (A) { \ fprintf(stderr,"FATAL error while preloading lua module " #A); \ exit(1); \ } \ } while (0) void luatex_socketlua_open (lua_State *L) { TEST(luatex_mbox_lua_open(L)); TEST(luatex_headers_lua_open(L)); TEST(luatex_socket_lua_open(L)); TEST(luatex_ltn12_lua_open(L)); TEST(luatex_mime_lua_open(L)); TEST(luatex_url_lua_open(L)); TEST(luatex_tp_lua_open(L)); TEST(luatex_smtp_lua_open(L)); TEST(luatex_http_lua_open(L)); TEST(luatex_ftp_lua_open(L)); }
/*************************************************************************** * This file is part of KDevelop * * Copyright 2007 Andreas Pakulat <apaku@gmx.de> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This 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 Library 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 KDEVPLATFORM_PLUGIN_SVNCLIENT_H #define KDEVPLATFORM_PLUGIN_SVNCLIENT_H #include <QString> #include <QObject> #include "kdevsvncpp/path.hpp" #include "kdevsvncpp/revision.hpp" #include "kdevsvncpp/client.hpp" #include <vcs/vcsevent.h> namespace KDevelop { class VcsAnnotationLine; } class SvnClient : public QObject, public svn::Client { Q_OBJECT public: explicit SvnClient( svn::Context* = 0 ); QString diff( const svn::Path& src, const svn::Revision& srcRev, const svn::Path& dst, const svn::Revision& dstRev, const bool recurse, const bool ignoreAncestry, const bool noDiffDeleted, const bool ignoreContentType ) throw (svn::ClientException); QString diff( const svn::Path& src, const svn::Revision& pegRev, const svn::Revision& srcRev, const svn::Revision& dstRev, const bool recurse, const bool ignoreAncestry, const bool noDiffDeleted, const bool ignoreContentType ) throw (svn::ClientException); void log( const char* path, const svn::Revision& start, const svn::Revision& end, int limit, bool discoverChangedPaths = false, bool strictNodeHistory = true ) throw (svn::ClientException); void emitLogEventReceived( const KDevelop::VcsEvent& ); signals: void logEventReceived( const KDevelop::VcsEvent& ); private: svn::Context* m_ctxt; }; #endif
/*------------------------------------------------------------------------ * Jastram-Test-Model for Adaptive FD-Grid * * Daniel Koehn * last update 23.10.2004 * * ---------------------------------------------------------------------*/ #include "fd.h" void model_elastic(float ** rho, float ** pi, float ** u){ /*--------------------------------------------------------------------------*/ FILE *FP1; /* extern variables */ extern float DH; extern int NX, NY, NXG, NYG, POS[3], MYID; /* local variables */ float Rho, Vp, Vs, Vpnm1, x, y, undf, r; float aund, ampund, FW, shiftx; int i, j, ii, jj; char modfile[STRING_SIZE]; /* parameters for background */ const float vp2=2000.0, vs2=vp2/sqrt(3.0), rho2=1000.0*0.31*pow(vp2,(1.0/4.0)); /* parameters for sphere 1 and 2 */ const float vp3=1500.0, vs3=vp3/sqrt(3.0), rho3=1000.0*0.31*pow(vp3,(1.0/4.0)); /* location of the spheres */ const float X01 = 80.0; const float Y01 = 130.0; /* radii of spheres */ float A0, A1, A3, A4, lambda0, lambda1, lambda3, lambda4; float y0, y1, y2, y3, y4, y5, undy0, undy1, undy3, undy4; lambda0=1600.0; A0=50.0; y0=1200.0; lambda1=lambda0/2.0; A1=100.0; y1=1000.0; y2=800.0; lambda3=lambda0/2.0; A3=150.0; y3=600.0; lambda4=lambda0/2.0; A4=50.0; y4=410.0; y5=100.0; /*FP1=fopen("/stripe1/koehn/projects/fullwaveform/full_waveform/test_forward/par/model/vp.bin","rb");*/ /* loop over global grid */ for (i=1;i<=NXG;i++){ for (j=1;j<=NYG;j++){ x=(float)i*DH; y=(float)j*DH; if(y<=NXG*DH){ Vp = 2178.0; Vs = Vp/sqrt(3.0); Rho = 1000.0*0.31*pow(Vp,(1.0/4.0));} undy0 = A0*sin(2.0*PI*x/lambda0); if(y<=(y0+undy0)){ Vp = 1980.0; Vs = Vp/sqrt(3.0); Rho = 1000.0*0.31*pow(Vp,(1.0/4.0));} undy1 = A1*cos(2.0*PI*x/lambda1); if(y<=(y1+undy1)){ Vp = 1980.0; Vs = Vp/sqrt(3.0); Rho = 1000.0*0.31*pow(Vp,(1.0/4.0));} if(y<=y2){ Vp = 1980.0; Vs = Vp/sqrt(3.0); Rho = 1000.0*0.31*pow(Vp,(1.0/4.0));} undy3 = A3*sin(2.0*PI*x/lambda3); if(y<=(y3+undy3)){ Vp = 1800.0; Vs = Vp/sqrt(3.0); Rho = 1000.0*0.31*pow(Vp,(1.0/4.0));} undy4 = A4*sin(2.0*PI*x/lambda4); if(y<=(y4+undy4)){ Vp = 1800.0; Vs = Vp/sqrt(3.0); Rho = 1000.0*0.31*pow(Vp,(1.0/4.0));} if(y<=y5){ Vp = 0.0; Vs = 1e-6; Rho = 1.25;} if ((POS[1]==((i-1)/NX)) && (POS[2]==((j-1)/NY))){ ii=i-POS[1]*NX; jj=j-POS[2]*NY; u[jj][ii]=Vs*Vs*Rho; rho[jj][ii]=Rho; pi[jj][ii] = Vp*Vp*Rho - 2.0 * u[jj][ii]; } } } /* each PE writes his model to disk */ sprintf(modfile,"model/waveform_test_model_u.bin"); writemod(modfile,u,3); MPI_Barrier(MPI_COMM_WORLD); if (MYID==0) mergemod(modfile,3); sprintf(modfile,"model/waveform_test_model_pi.bin"); writemod(modfile,pi,3); MPI_Barrier(MPI_COMM_WORLD); if (MYID==0) mergemod(modfile,3); sprintf(modfile,"model/waveform_test_model_rho.bin"); writemod(modfile,rho,3); MPI_Barrier(MPI_COMM_WORLD); if (MYID==0) mergemod(modfile,3); /*fclose(FP1);*/ }
// Copyleft 2008 Chris Korda // 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 any later version. /* chris korda revision history: rev date comments 00 14feb08 initial version 01 17dec09 replace strip job bool with strip mode fractal rendering engine with strip support */ #ifndef CSTRIPENGINE_INCLUDED #define CSTRIPENGINE_INCLUDED #include "DibEngine.h" class CStripEngine : public CDibEngine { public: // Construction CStripEngine(); // Constants enum { // strip modes SM_NORMAL_RENDER, SM_STRIP_RENDER, SM_STRIP_COLORMAP, }; // Attributes int GetStripMode() const; bool IsStripJob() const; // Operations void RenderFrame(const RENDER_INFO& Info, const BigRect& Bounds); void BeginStripJob(const RENDER_INFO& Info, const BigRect& Bounds); void RenderStrip(UINT ThreadIdx, UINT y1, UINT y2, ESCTIME *FrameBuf); protected: // Member data int m_StripMode; // strip mode; see enum above // Overrides void OnRenderDone(CRenderer& Render); }; inline int CStripEngine::GetStripMode() const { return(m_StripMode); } inline bool CStripEngine::IsStripJob() const { return(m_StripMode != SM_NORMAL_RENDER); } inline void CStripEngine::RenderFrame(const RENDER_INFO& Info, const BigRect& Bounds) { m_StripMode = SM_NORMAL_RENDER; CDibEngine::RenderFrame(Info, Bounds); // do base class behavior } #endif
typedef struct unk_ramdac_t { int state; uint8_t ctrl; } unk_ramdac_t; void unk_ramdac_out(uint16_t addr, uint8_t val, unk_ramdac_t *ramdac, svga_t *svga); uint8_t unk_ramdac_in(uint16_t addr, unk_ramdac_t *ramdac, svga_t *svga);
/* * Copyright (C) 2011-2012 WCloudEMU <http://www.WCloud.com/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _MODELINSTANCE_H_ #define _MODELINSTANCE_H_ #include <G3D/Matrix3.h> #include <G3D/Vector3.h> #include <G3D/AABox.h> #include <G3D/Ray.h> #include "Define.h" namespace VMAP { class WorldModel; struct AreaInfo; struct LocationInfo; enum ModelFlags { MOD_M2 = 1, MOD_WORLDSPAWN = 1<<1, MOD_HAS_BOUND = 1<<2 }; class ModelSpawn { public: //mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name uint32 flags; uint16 adtId; uint32 ID; G3D::Vector3 iPos; G3D::Vector3 iRot; float iScale; G3D::AABox iBound; std::string name; bool operator==(const ModelSpawn &other) const { return ID == other.ID; } //uint32 hashCode() const { return ID; } // temp? const G3D::AABox& getBounds() const { return iBound; } static bool readFromFile(FILE* rf, ModelSpawn &spawn); static bool writeToFile(FILE* rw, const ModelSpawn &spawn); }; class ModelInstance: public ModelSpawn { public: ModelInstance(): iModel(0) {} ModelInstance(const ModelSpawn &spawn, WorldModel* model); void setUnloaded() { iModel = 0; } bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const; void intersectPoint(const G3D::Vector3& p, AreaInfo &info) const; bool GetLocationInfo(const G3D::Vector3& p, LocationInfo &info) const; bool GetLiquidLevel(const G3D::Vector3& p, LocationInfo &info, float &liqHeight) const; protected: G3D::Matrix3 iInvRot; float iInvScale; WorldModel* iModel; }; } // namespace VMAP #endif // _MODELINSTANCE
/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. * Test that pthread_mutexattr_setpshared() * * It MAY fail if: * * [EINVAL] - the new value pshared value is outside the range of legal values for that * attribute. * * Steps: * * 1. Pass to pthread_mutexattr_setpshared() a negative value in the 'pshared' parameter.. * 2. It may return the value of EINVAL. * */ #include <pthread.h> #include <stdio.h> #include <errno.h> #include "posixtest.h" #define INVALID_PSHARED_VALUE -1 int main() { /* Make sure there is process-shared capability. */ #ifndef PTHREAD_PROCESS_SHARED fprintf(stderr,"process-shared attribute is not available for testing\n"); return PTS_UNRESOLVED; #endif pthread_mutexattr_t mta; int ret; /* Set the attribute to INVALID_PSHARED_VALUE. */ ret=pthread_mutexattr_setpshared(&mta, INVALID_PSHARED_VALUE); if (ret != 0) { if (ret == EINVAL) { printf("Test PASSED\n"); return PTS_PASS; } printf("Test FAILED: Expected return code 0 or EINVAL, got: %d", ret); return PTS_FAIL; } printf("Test PASSED: NOTE*: Returned 0 on error, though standard states 'may' fail.\n"); return PTS_PASS; }
/* This file is part of the KDE project Copyright (C) 2004-2007 Jarosław Staniek <staniek@kde.org> This program is free software; you can redistribute it and,or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KEXICELLEDITORFACTORY_H #define KEXICELLEDITORFACTORY_H #include <QVariant> #include <QWidget> #include <kexi_global.h> #include <db/field.h> class KexiCellEditorFactoryItem; class KexiTableEdit; class KexiTableViewColumn; //! A singleton class providing access to cell editor factories class KEXIDATATABLE_EXPORT KexiCellEditorFactory { public: KexiCellEditorFactory(); virtual ~KexiCellEditorFactory(); /*! Registers factory item for \a type and (optional) \a subType. \a subType is usually obtained (e.g. in KexiTableView) from KexiDB::Field::subType(). Passing KexiDB::Field::Invalid as type will set default item, i.e. the one that will be used when no other item is defined for given data type. You can register the same \a item many times for different types and subtypes. Once registered, \a item object will be owned by the factory, so you shouldn't care about deleting it. */ static void registerItem(KexiCellEditorFactoryItem& item, uint type, const QString& subType = QString()); /*! \return item for \a type and (optional) \a subType. If no item found, the one with empty subtype is tried. If still no item found, the default is tried. Eventually, may return NULL. */ static KexiCellEditorFactoryItem* item(uint type, const QString& subType = QString()); /*! Creates a new editor for \a column. If \a parent is of QScrollArea, the new editor will be created inside parent->viewport() instead. */ static KexiTableEdit* createEditor(KexiTableViewColumn &column, QWidget* parent = 0); protected: static void init(); }; //! A base class for implementing cell editor factories class KEXIDATATABLE_EXPORT KexiCellEditorFactoryItem { public: KexiCellEditorFactoryItem(); virtual ~KexiCellEditorFactoryItem(); QString className() const { return m_className; } protected: virtual KexiTableEdit* createEditor(KexiTableViewColumn &column, QWidget* parent = 0) = 0; QString m_className; friend class KexiCellEditorFactory; }; #endif
/* * Copyright 2006, Shanghai Huateng Software Systems Co., Ltd. * All right reserved. * * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SHANGHAI HUATENG * SOFTWARE SYSTEMS CO., LTD. THE CONTENTS OF THIS FILE MAY NOT * BE DISCLOSED TO THIRD PARTIES, COPIED OR DUPLICATED IN ANY FORM, * IN WHOLE OR IN PART, WITHOUT THE PRIOR WRITTEN PERMISSION OF * SHANGHAI HUATENG SOFTWARE SYSTEMS CO., LTD. * * function:db.h * * Edit History: * * 2011/07/18 -gendb */ #ifndef _TBL_MONTH_CLEAN_SUM_DEF_H #define _TBL_MONTH_CLEAN_SUM_DEF_H /* Default values for table tbl_txn_algo_rule. */ #define mcht_cd_DEF " " #define settle_date1_DEF " " #define settle_date2_DEF " " #define trans_type_DEF " " #define clear_amt_DEF 0.0 #define mcht_flag " " #endif
/**************************************************************************** ** ** ** Definition of QMakeProject class. ** ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. ** ** This file is part of qmake. ** ** This file may be distributed under the terms of the Q Public License ** as defined by Trolltech AS of Norway and appearing in the file ** LICENSE.QPL included in the packaging of this file. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** Licensees holding valid Qt Enterprise Edition licenses may use this ** file in accordance with the Qt Commercial License Agreement provided ** with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for ** information about Qt Commercial License Agreements. ** See http://www.trolltech.com/qpl/ for QPL licensing information. ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef __PROJECT_H__ #define __PROJECT_H__ #include <qstringlist.h> #include <qstring.h> #include <qmap.h> class QMakeProperty; class QMakeProject { enum TestStatus { TestNone, TestFound, TestSeek } test_status; int scope_block, scope_flag; QString pfile, cfile; QMakeProperty *prop; void reset(); QMap<QString, QStringList> vars, base_vars, cache; bool parse(const QString &text, QMap<QString, QStringList> &place); bool doProjectTest(const QString &func, const QString &params, QMap<QString, QStringList> &place); bool doProjectTest(const QString &func, QStringList args, QMap<QString, QStringList> &place); bool doProjectCheckReqs(const QStringList &deps, QMap<QString, QStringList> &place); QString doVariableReplace(QString &str, const QMap<QString, QStringList> &place); public: QMakeProject(); QMakeProject(QMakeProperty *); enum { ReadCache=0x01, ReadConf=0x02, ReadCmdLine=0x04, ReadProFile=0x08, ReadPostFiles=0x10, ReadAll=0xFF }; bool read(const QString &project, const QString &pwd, uchar cmd=ReadAll); bool read(uchar cmd=ReadAll); QString projectFile(); QString configFile(); bool isEmpty(const QString &v); QStringList &values(const QString &v); QString first(const QString &v); QMap<QString, QStringList> &variables(); bool isActiveConfig(const QString &x, bool regex=FALSE, QMap<QString, QStringList> *place=NULL); protected: friend class MakefileGenerator; bool read(const QString &file, QMap<QString, QStringList> &place); }; inline QString QMakeProject::projectFile() { #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP) // workaround for Sun WorkShop 5.0 bug fixed in Forte 6 if (pfile == "-") return QString("(stdin)"); else return pfile; #else return pfile == "-" ? QString("(stdin)") : pfile; #endif } inline QString QMakeProject::configFile() { return cfile; } inline bool QMakeProject::isEmpty(const QString &v) { return !vars.contains(v) || vars[v].isEmpty(); } inline QStringList &QMakeProject::values(const QString &v) { return vars[v]; } inline QString QMakeProject::first(const QString &v) { #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP) // workaround for Sun WorkShop 5.0 bug fixed in Forte 6 if (isEmpty(v)) return QString(""); else return vars[v].first(); #else return isEmpty(v) ? QString("") : vars[v].first(); #endif } inline QMap<QString, QStringList> &QMakeProject::variables() { return vars; } #endif /* __PROJECT_H__ */
#ifndef SIMBACREATIVEIDSDELETEDGETRESPONSE_H #define SIMBACREATIVEIDSDELETEDGETRESPONSE_H #include <TaoApiCpp/TaoResponse.h> #include <QList> /** * @brief TOP RESPONSE API: 获取删除的创意ID * * @author sd44 <sd44sdd44@yeah.net> */ class SimbaCreativeidsDeletedGetResponse : public TaoResponse { public: virtual ~SimbaCreativeidsDeletedGetResponse() { } QList<qlonglong> getDeletedCreativeIds() const; void setDeletedCreativeIds (QList<qlonglong> deletedCreativeIds); virtual void parseNormalResponse(); private: /** * @brief 创意ID列表 **/ QList<qlonglong> deletedCreativeIds; }; #endif
/* $Id$ */ /* * This file is part of OpenTTD. * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. */ /** @file viewport_type.h Types related to viewports. */ #ifndef VIEWPORT_TYPE_H #define VIEWPORT_TYPE_H #include "zoom_type.h" #include "strings_type.h" #include "table/strings.h" class LinkGraphOverlay; /** * Data structure for viewport, display of a part of the world */ struct ViewPort { int left; ///< Screen coordinate left egde of the viewport int top; ///< Screen coordinate top edge of the viewport int width; ///< Screen width of the viewport int height; ///< Screen height of the viewport int virtual_left; ///< Virtual left coordinate int virtual_top; ///< Virtual top coordinate int virtual_width; ///< width << zoom int virtual_height; ///< height << zoom ZoomLevel zoom; ///< The zoom level of the viewport. LinkGraphOverlay *overlay; }; /** Margins for the viewport sign */ enum ViewportSignMargin { VPSM_LEFT = 1, ///< Left margin VPSM_RIGHT = 1, ///< Right margin VPSM_TOP = 1, ///< Top margin VPSM_BOTTOM = 1, ///< Bottom margin }; /** Location information about a sign as seen on the viewport */ struct ViewportSign { int32 center; ///< The center position of the sign int32 top; ///< The top of the sign uint16 width_normal; ///< The width when not zoomed out (normal font) uint16 width_small; ///< The width when zoomed out (small font) void UpdatePosition(int center, int top, StringID str, StringID str_small = STR_NULL); void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const; }; /** * Directions of zooming. * @see DoZoomInOutWindow */ enum ZoomStateChange { ZOOM_IN = 0, ///< Zoom in (get more detailed view). ZOOM_OUT = 1, ///< Zoom out (get helicopter view). ZOOM_NONE = 2, ///< Hack, used to update the button status. }; /** * Some values for constructing bounding boxes (BB). The Z positions under bridges are: * z=0..5 Everything that can be built under low bridges. * z=6 reserved, currently unused. * z=7 Z separator between bridge/tunnel and the things under/above it. */ static const uint BB_HEIGHT_UNDER_BRIDGE = 6; ///< Everything that can be built under low bridges, must not exceed this Z height. static const uint BB_Z_SEPARATOR = 7; ///< Separates the bridge/tunnel from the things under/above it. /** Viewport place method (type of highlighted area and placed objects) */ enum ViewportPlaceMethod { VPM_X_OR_Y = 0, ///< drag in X or Y direction VPM_FIX_X = 1, ///< drag only in X axis VPM_FIX_Y = 2, ///< drag only in Y axis VPM_X_AND_Y = 3, ///< area of land in X and Y directions VPM_X_AND_Y_LIMITED = 4, ///< area of land of limited size VPM_FIX_HORIZONTAL = 5, ///< drag only in horizontal direction VPM_FIX_VERTICAL = 6, ///< drag only in vertical direction VPM_X_LIMITED = 7, ///< Drag only in X axis with limited size VPM_Y_LIMITED = 8, ///< Drag only in Y axis with limited size VPM_RAILDIRS = 0x40, ///< all rail directions VPM_SIGNALDIRS = 0x80, ///< similar to VMP_RAILDIRS, but with different cursor }; DECLARE_ENUM_AS_BIT_SET(ViewportPlaceMethod) /** * Drag and drop selection process, or, what to do with an area of land when * you've selected it. */ enum ViewportDragDropSelectionProcess { DDSP_DEMOLISH_AREA, ///< Clear area DDSP_RAISE_AND_LEVEL_AREA, ///< Raise / level area DDSP_LOWER_AND_LEVEL_AREA, ///< Lower / level area DDSP_LEVEL_AREA, ///< Level area DDSP_CREATE_DESERT, ///< Fill area with desert DDSP_CREATE_ROCKS, ///< Fill area with rocks DDSP_CREATE_WATER, ///< Create a canal DDSP_CREATE_RIVER, ///< Create rivers DDSP_PLANT_TREES, ///< Plant trees DDSP_BUILD_BRIDGE, ///< Bridge placement /* Rail specific actions */ DDSP_PLACE_RAIL, ///< Rail placement DDSP_BUILD_SIGNALS, ///< Signal placement DDSP_BUILD_STATION, ///< Station placement DDSP_REMOVE_STATION, ///< Station removal DDSP_CONVERT_RAIL, ///< Rail conversion /* Road specific actions */ DDSP_PLACE_ROAD_X_DIR, ///< Road placement (X axis) DDSP_PLACE_ROAD_Y_DIR, ///< Road placement (Y axis) DDSP_PLACE_AUTOROAD, ///< Road placement (auto) DDSP_BUILD_BUSSTOP, ///< Road stop placement (buses) DDSP_BUILD_TRUCKSTOP, ///< Road stop placement (trucks) DDSP_REMOVE_BUSSTOP, ///< Road stop removal (buses) DDSP_REMOVE_TRUCKSTOP, ///< Road stop removal (trucks) /* Clipboard */ DDSP_COPY_TO_CLIPBOARD, ///< Copy area to clipboard }; /** * Target of the viewport scrolling GS method */ enum ViewportScrollTarget { VST_EVERYONE, ///< All players VST_COMPANY, ///< All players in specific company VST_CLIENT, ///< Single player }; #endif /* VIEWPORT_TYPE_H */
#include <stdio.h> typedef enum { false, true } bool; bool IsPrime(int number) { int i; for (i = 2; number % i != 0; i += 1) {} if (number == i) { return true; } return false; } int main() { int i; int foundCombinations = 0; int previousPrime = 0; for (i = 3; foundCombinations < 10; i += 1) //i starts at 3 because it counts (0, 2) as a twin prime if i starts at 2 { if (IsPrime(i)) { if (previousPrime == i - 2) { printf("(%d, %d)\n", previousPrime, i); foundCombinations++; } previousPrime = i; } } return 0; }
#include <stdio.h> #include <cpglock.h> #include <errno.h> #include <string.h> int main(int argc, char **argv) { cpg_lock_handle_t h; struct cpg_lock l; if (argc < 2) { cpg_lock_dump(stdout); return 0; } if (cpg_lock_init(&h) < 0) { perror("cpg_lock_init"); return 1; } printf("Acquiring lock on %s...", argv[1]); fflush(stdout); if (cpg_lock(h, argv[1], 0, &l) < 0) { perror("cpg_lock"); return 1; } printf("OK, local id %d\npress <enter> to unlock\n", l.local_id); getc(stdin); memset(l.resource, 0, sizeof(l.resource)); if (cpg_unlock(h, &l) < 0) { perror("cpg_unlock"); return 1; } cpg_lock_fin(h); return 0; }
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:40 2014 */ /* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/config/b43legacy/pio.h */
#ifndef __ASM_GENERIC_DMA_H #define __ASM_GENERIC_DMA_H /* * This file traditionally describes the i8237 PC style DMA controller. * Most architectures don't have these any more and can get the minimal * implementation from kernel/dma.c by not defining MAX_DMA_CHANNELS. * * Some code relies on seeing MAX_DMA_ADDRESS though. */ #define MAX_DMA_ADDRESS PAGE_OFFSET extern int isa_dma_bridge_buggy; extern int request_dma(unsigned int dmanr, const char *device_id); extern void free_dma(unsigned int dmanr); #endif /* __ASM_GENERIC_DMA_H */
#ifndef LIST_H #define LIST_H #include <stdexcept> #include <cstring> #include <ostream> struct base_list { struct node { char* data; node* next; } *head, *tail; int size; }; base_list::node* init_base_list_node(char* data, base_list::node* n); // initialization of a node base_list init_base_list(char* data); // initialization of list with head base_list init_base_list(); // initialization of empty list base_list init_base_list_by_array(char** a, int size); // initialization of list by array base_list init_base_list_by_file(const char* filename); // initialization of list by file void push_front(base_list& t, char* data); // push new head to list void insert_after(base_list& t, char* data, int index); // insert new element after existing element char* get_element(base_list& t, int index); // get element by index void erase_element(base_list& t, int index); // delete element from list void list_dump(base_list& t, std::ostream& s); // output all elements in list void clear(base_list& t); // delete all elements in list #endif
/* * arch/arm/mach-s3c3410/include/mach/dma.h * * Copyright (C) 2003 Hyok S. Choi <hyok.choi@samsung.com> */ #include <asm/hardware.h> #include <linux/wait.h> #ifndef __ASM_S3C3410_ARCH_DMA_H #define __ASM_S3C3410_ARCH_DMA_H /* * This is the maximum DMA address(physical address) that can be DMAd to. * */ #define MAX_DMA_ADDRESS 0x03000000 /* * The S3C3410 has 2 internal DMA channels. */ #define MAX_DMA_CHANNELS 2 #define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */ #endif /* _ASM_S3C3410_ARCH_DMA_H */
/*************************************************************************** infantrysprite.h - description ------------------- begin : copyright : (C) 2003-2007 by Gael de Chalendar email : kleag@free.fr ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA ***************************************************************************/ #ifndef KSIRKINFANTRYSPRITE_H #define KSIRKINFANTRYSPRITE_H #include "armysprite.h" namespace Ksirk { namespace GameLogic { class Country; } /** * An InfantrySprite is an army sprite that represents 1 army * @author Gaël de Chalendar */ class InfantrySprite : public ArmySprite { public: /** * This simplified constructor allows to create a new @ref InfantrySprite with * default values for svg pool id and skin elements names * @param zoom The current zoom factor * @param aBackGnd The background giving info about the world geometry and * access to the underlying QGraphicsScene * @param visibility Measures how much this sprite is visible. It gives its * Z value on the graphics scene. */ InfantrySprite(double zoom, BackGnd* aBackGnd, unsigned int visibility = 200); /** * This constructor allows to create a new @ref AnimSprite whose images are * taken from the given file name with the given number of frames and * number of look directions * @param svgid The id of the SVG element from which to load images * @param aBackGnd The background giving info about the world geometry and * access to the underlying QGraphicsScene * @param nbFrames The number of different frames in this sprite animation, * thus the number of columns in the sprite image * @param nbDirs The number of different views on the sprite, * thus the number of rows in the sprite image * @param visibility Measures how much this sprite is visible. It gives its * Z value on the graphics scene. */ InfantrySprite(const QString &svgid, unsigned int width, unsigned int height, unsigned int nbFrames, unsigned int nbDirs, double zoom, BackGnd* aBackGnd, unsigned int visibility=200); /** The default destructor */ virtual ~InfantrySprite() {} /** * This function chooses the approach mode of an infantry sprite towards its * destination: * if the distance between the origin and the destination is higher than half * the size of the map and if the origin and destination countries comunicate, * then the sprite should choose an approach by left or right, through the * edge of the map. */ void setupTravel(GameLogic::Country* src, GameLogic::Country* dest, const QPointF* dpi=0); /** * Gets the number of armies represented by an infantry: 1 * @return the number of armies represented by an infantry: 1 */ inline virtual unsigned int nbArmies() const {return m_nbArmies;} private: static const unsigned int m_nbArmies = 1; }; } #endif
// // ExifContainer.h // Pods // // Created by Nikita Tuk on 02/02/15. // // #import <Foundation/Foundation.h> @class CLLocation; @interface ExifContainer : NSObject @property (nonatomic, strong, readonly) NSMutableDictionary *exifDictionary; @property (nonatomic, strong, readonly) NSMutableDictionary *tiffDictionary; @property (nonatomic, strong, readonly) NSMutableDictionary *gpsDictionary; - (void)addLocation:(CLLocation *)currentLocation; - (void)addUserComment:(NSString *)comment; - (void)addCreationDate:(NSDate *)date; - (void)addDescription:(NSString *)description; - (void)addProjection:(NSString *)projection; - (void)addCameraMake:(NSString *)make; - (void)addCameraModel:(NSString *)model; - (void)addArtist:(NSString *)artist; - (void)setValue:(NSString *)key forExifKey:(NSString *)value; @end
// qmidinetAlsaMidiDevice.h // /**************************************************************************** Copyright (C) 2010-2019, rncbc aka Rui Nuno Capela. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *****************************************************************************/ #ifndef __qmidinetAlsaMidiDevice_h #define __qmidinetAlsaMidiDevice_h #include "qmidinetAbout.h" #ifdef CONFIG_ALSA_MIDI #include <stdio.h> #include <stdlib.h> #include <alsa/asoundlib.h> #include <QObject> #include <QString> //---------------------------------------------------------------------------- // qmidinetAlsaMidiDevice -- MIDI interface object. class qmidinetAlsaMidiDevice : public QObject { Q_OBJECT public: // Constructor. qmidinetAlsaMidiDevice(QObject *pParent = nullptr); // Destructor. ~qmidinetAlsaMidiDevice(); // Kind of singleton reference. static qmidinetAlsaMidiDevice *getInstance(); // Device initialization method. bool open(const QString& sClientName, int iNumPorts = 1); // Device termination method. void close(); // MIDI event capture method. void capture(snd_seq_event_t *pEv); // Data transmission methods. bool sendData(unsigned char *data, unsigned short len, int port = 0) const; void recvData(unsigned char *data, unsigned short len, int port = 0); signals: // Received data signal. void received(QByteArray data, int port); public slots: // Receive data slot. void receive(QByteArray data, int port); private: // Instance variables, int m_nports; // Instance variables. snd_seq_t *m_pAlsaSeq; int m_iAlsaClient; int *m_piAlsaPort; snd_midi_event_t **m_ppAlsaEncoder; snd_midi_event_t *m_pAlsaDecoder; // Network receiver thread. class qmidinetAlsaMidiThread *m_pRecvThread; // Kind-of singleton reference. static qmidinetAlsaMidiDevice *g_pDevice; }; #endif // CONFIG_ALSA_MIDI #endif // __qmidinetAlsaMidiDevice_h // end of qmidinetAlsaMidiDevice.h
/* * Copyright (C) 2017-2018 AshamaneProject <https://github.com/AshamaneProject> * Copyright (C) 2016 Firestorm Servers <https://firestorm-servers.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef STORMSTOUT_BREWERY_H_ #define STORMSTOUT_BREWERY_H_ #include "SpellScript.h" #include "Map.h" #include "Creature.h" #include "CreatureAIImpl.h" #define SBScriptName "instance_stormstout_brewery" enum DataTypes { DATA_OOK_OOK = 1, DATA_HOPTALLUS = 2, DATA_YAN_ZHU = 3 }; enum CreaturesIds { NPC_OOK_OOK = 56637, NPC_HOPTALLUS = 56717, NPC_YAN_ZHU = 59479 }; #endif // STORMSTOUT_BREWERY_H_
/** * @file result_list.h * Defines the structures for storing results in a linked list. */ #ifndef RESULT_LIST_H #define RESULT_LIST_H // By storing results as a list inside the result item, we can reduce copy operations tremendously. typedef struct result_loc{ int line_num; int col_num; struct result_loc *next; } RESULT_LOC; // Store the name of the file and a list of the results in that file. typedef struct result_file{ // At this point, we don't need to store search string, // as we have that stored in settings RESULT_LOC *locations; RESULT_LOC *locations_last; char *file_path; struct result_file *next; } RESULT_ITEM; struct result_list { RESULT_ITEM *first; RESULT_ITEM *last; } results; /** Functions to operate on the result list */ void init_results(); void add_result(int line, int col, const char *file); void clear_results(); #endif
/* * wxPutFTPTextDialog.h * wxCURL * * Created by Casey O'Donnell on Fri Jul 23 2004. * Copyright (c) 2004 Casey O'Donnell. All rights reserved. * */ // wxPutFTPTextDialog.h: interface for the wxPutFTPTextDialog class. // ////////////////////////////////////////////////////////////////////// #ifndef _WXPUTFTPTEXTDIALOG_H__INCLUDED_ #define _WXPUTFTPTEXTDIALOG_H__INCLUDED_ #include <wx/dialog.h> #include <wx/textctrl.h> class wxPutFTPTextDialog : public wxDialog { public: wxPutFTPTextDialog(wxWindow* pParent); virtual ~wxPutFTPTextDialog(); // Event Handlers (These Functions Should NOT be Virtual) void OnPut(wxCommandEvent& event); protected: wxTextCtrl* m_pDestCtrl; wxTextCtrl* m_pUserCtrl; wxTextCtrl* m_pPassCtrl; wxTextCtrl* m_pDataCtrl; wxTextCtrl* m_pRespCtrl; wxString m_szDefaultDest; wxString m_szDefaultUser; wxString m_szDefaultPass; private: DECLARE_CLASS(wxPutFTPTextDialog) // any class wishing to process wxWindows events must use this macro DECLARE_EVENT_TABLE() }; #endif // _WXPUTFTPTEXTDIALOG_H__INCLUDED_
/*************************************************************************** * Project TUPI: Magia 2D * * Project Contact: info@maefloresta.com * * Project Website: http://www.maefloresta.com * * Project Leader: Gustav Gonzalez <info@maefloresta.com> * * * * Developers: * * 2010: * * Gustavo Gonzalez / xtingray * * * * KTooN's versions: * * * * 2006: * * David Cuadrado * * Jorge Cuadrado * * 2003: * * Fernado Roldan * * Simena Dinas * * * * Copyright (C) 2010 Gustav Gonzalez - http://www.maefloresta.com * * License: * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************/ #ifndef STEPSVIEWER_H #define STEPSVIEWER_H #include "tglobal.h" #include "tuptweenerstep.h" #include "spinboxdelegate.h" #include "tpushbutton.h" #include <QTableWidget> #include <cmath> #include <QGraphicsPathItem> #include <QDebug> #include <QBoxLayout> #include <QHeaderView> #include <QPainter> // class QGraphicsPathItem; // class TupTweenerStep; /** * @author Jorge Cuadrado */ class TUPI_EXPORT StepsViewer : public QTableWidget { Q_OBJECT // friend class TupExposureVerticalHeader; public: StepsViewer(QWidget *parent = 0); ~StepsViewer(); void setPath(const QGraphicsPathItem *path); QVector<TupTweenerStep *> steps(); int totalSteps(); void cleanRows(); virtual QSize sizeHint() const; private slots: void updatePath(int column, int row); private: QList<QPointF> calculateDots(QPointF dot1, QPointF dot2, int total); struct Private; Private *const k; signals: void updateTable(); }; #endif
/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. * A destroyed 'attr' attributes object can be reinitialized using * pthread_attr_init(); the results of otherwise referencing the object * after it has been destroyed are undefined. * * Steps: * 1. Initialize a pthread_attr_t object using pthread_attr_init() * 2. Destroy that initialized attribute using pthread_attr_destroy() * 3. Initialize the pthread_attr_t object again. This should not result * in an error. * */ #include <pthread.h> #include <stdio.h> #include <errno.h> #include "posixtest.h" int main() { pthread_attr_t new_attr; /* Initialize attribute */ if (pthread_attr_init(&new_attr) != 0) { perror("Cannot initialize attribute object\n"); return PTS_UNRESOLVED; } /* Destroy attribute */ if (pthread_attr_destroy(&new_attr) != 0) { perror("Cannot destroy the attribute object\n"); return PTS_UNRESOLVED; } /* Initialize attribute. This shouldn't result in an error. */ if (pthread_attr_init(&new_attr) != 0) { printf("Test FAILED\n"); return PTS_FAIL; } else { printf("Test PASSED\n"); return PTS_PASS; } }
/* Cronos II - The GNOME mail client * Copyright (C) 2000-2001 Pablo Fernández López * * 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 __WIDGET_HTML_H__ #define __WIDGET_HTML_H__ #ifdef __cplusplus extern "C" { #endif #if defined (HAVE_CONFIG_H) && defined (BUILDING_C2) # include <config.h> #else # include <cronosII.h> #endif #ifdef BUILDING_C2 # ifdef USE_GTKHTML # include "widget-HTML-gtkhtml.h" # elif defined (USE_GTKXMHTML) # include "widget-HTML-gtkxmhtml.h" # else # include "widget-HTML-text.h" # endif #endif #include <gtk/gtk.h> #include <gtk/gtkwidget.h> #include <pthread.h> #if defined (HAVE_CONFIG_H) && defined (BUILDING_C2) # include <libcronosII/mime.h> # include <libcronosII/utils.h> # include <libcronosII/utils-mutex.h> # include "widget-application.h" #else # include <cronosII.h> #endif #define C2_TYPE_HTML (c2_html_get_type ()) #define C2_HTML(obj) (GTK_CHECK_CAST (obj, c2_html_get_type (), C2HTML)) #define C2_HTML_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, c2_html_get_type, C2HTMLClass)) #define C2_IS_HTML(obj) (GTK_CHECK_TYPE (obj, c2_html_get_type ())) typedef struct _C2HTML C2HTML; typedef struct _C2HTMLClass C2HTMLClass; typedef enum _C2HTMLProxyType C2HTMLProxyType; #ifdef USE_GTKHTML typedef void (*C2HTMLLinkManager) (C2HTML *html, const gchar *url, GtkHTMLStream *stream); #elif defined (USE_GTKXMHTML) typedef void (*C2HTMLLinkManager) (C2HTML *html, const gchar *url, C2Pthread2 *data); #else typedef void (*C2HTMLLinkManager) (C2HTML *html, const gchar *url); #endif enum _C2HTMLProxyType { C2_HTML_PROXY_HTTP, C2_HTML_PROXY_FTP, C2_HTML_PROXY_LAST }; struct _C2HTML { #ifdef USE_GTKHTML GtkHTML parent; #elif defined (USE_GTKXMHTML) GtkXmHTML parent; #else GtkText parent; #endif C2Mutex lock; GData *link_manager_data; GdkColor *fore; GdkFont *font; struct { gchar *host; guint port; } proxy[C2_HTML_PROXY_LAST]; C2Application *application; GtkWidget *appbar; C2Mutex *appbar_lock; }; struct _C2HTMLClass { #ifdef USE_GTKHTML GtkHTMLClass parent_class; #elif defined (USE_GTKXMHTML) GtkXmHTMLClass parent_class; #else GtkTextClass parent_class; #endif }; GtkType c2_html_get_type (void); GtkWidget * c2_html_new (C2Application *application); void c2_html_set_editable (C2HTML *html); void c2_html_set_link_manager (C2HTML *html, const gchar *prefix, C2HTMLLinkManager lm); void c2_html_freeze (C2HTML *html); void c2_html_thaw (C2HTML *html); void c2_html_clear (C2HTML *html); /* Configuration */ void c2_html_set_proxy (C2HTML *html, C2HTMLProxyType type, const gchar *proxy, guint port); void c2_html_set_font_default (C2HTML *html, GdkFont *font, gchar *strfont, gchar *sizes); /* Data source */ void c2_html_set_content_from_url (C2HTML *html, const gchar *url); void c2_html_set_content_from_string (C2HTML *html, const gchar *string); gchar * c2_html_get_content (C2HTML *html); /* Misc */ void c2_html_set_line (C2HTML *html, guint line); guint c2_html_get_line (C2HTML *html); void c2_html_install_hints (C2HTML *html, GtkWidget *appbar, C2Mutex *lock); #ifdef __cplusplus } #endif #endif
#ifndef MEDIUM_API_H #define MEDIUM_API_H /* ! \file \brief Api for media access functions. Medium is set of functions and settings describing the method how and from where to read or write logs; Medium state is dependent on type (file, memory, socket reader). Medium uses formatters to parse logs @see formatter-api.h */ /* Copyright (C) 2007, 2008 Jiri Zouhar This file is part of Syplog. Syplog 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. Syplog 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 Syplog; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA; or download it from http://www.gnu.org/licenses/gpl.html */ #include "formatters/formatter-api.h" #include "medium.h" #define PARAM_MEDIUM_FMT_LONG "formatter" #define PARAM_MEDIUM_FMT_CHAR 'f' #define PARAM_MEDIUM_TYPE_LONG "medium" #define PARAM_MEDIUM_TYPE_CHAR 'm' #define PARAM_MEDIUM_OP_LONG "operation" #define PARAM_MEDIUM_OP_CHAR 'o' #define PARAM_MEDIUM_SIZE_LONG "log_size" #define PARAM_MEDIUM_SIZE_CHAR 's' #define OPERATION_NAME_LEN 6 #define OPERATION_READ_NAME "read" #define OPERATION_WRITE_NAME "write" /* ! Initializes medium according to parameters. @param argv the same format as in "main", but parses only medium specific options @param argc argv item count @param target non NULL pointer to medium structure to initialize @return std errors. When error is returned, structure is in undefined state but internal pointers are freed */ syp_error open_medium(struct medium_def *target, int argc, const char **argv); /* ! Check if argument is recognized by some medium @param arg command line argument (in format --argument_name=value) @return TRUE in case of recognition, FALSE otherwise */ bool_t is_medium_arg(const char *arg); /* ! Close reader and free internal pointers. @param target non NULL pointer to initialized medium @return std errors. When error is returned, structure is in undefined state but most likeli internal pointers are freed */ syp_error close_medium(struct medium_def *target); /* ! Access Medium. Depends on kind of access this means read log or write log the type of operation depends on initializing values of medium @param target initialized medium (non NULL) @param log message to fill or write (non NULL) @return std errors. On error, message may not be written. */ syp_error access_medium(struct medium_def *target, log_struct log); /* ! prints media options help to fd. @param fd file descriptor to which to write help @param tabs how much tabs prepend to help */ void print_media_help(int fd, int tabs); #endif /* MEDIUM_API_H */
/* * mate-keyring * * Copyright (C) 2010 Stefan Walter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General License as * published by the Free Software Foundation; either version 2.1 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 * Lesser General License for more details. * * You should have received a copy of the GNU Lesser General * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301, USA. */ #include "config.h" #include "gkm-attributes.h" #include "gkm-test.h" #include "gkm-util.h" #include "pkcs11/pkcs11.h" #include "pkcs11/pkcs11i.h" #include <glib.h> #include <string.h> void gkm_assertion_message_cmprv (const gchar *domain, const gchar *file, gint line, const gchar *func, const gchar *expr, CK_RV arg1, const gchar *cmp, CK_RV arg2) { gchar *a1, *a2, *s; a1 = gkm_util_rv_to_string (arg1); a2 = gkm_util_rv_to_string (arg2); s = g_strdup_printf ("assertion failed (%s): (%s %s %s)", expr, a1, cmp, a2); g_free (a1); g_free (a2); g_assertion_message (domain, file, line, func, s); g_free (s); } void gkm_assertion_message_cmpulong (const gchar *domain, const gchar *file, gint line, const gchar *func, const gchar *expr, CK_ULONG arg1, const gchar *cmp, CK_ULONG arg2) { char *s = NULL; s = g_strdup_printf ("assertion failed (%s): (0x%08llx %s 0x%08llx)", expr, (long long unsigned)arg1, cmp, (long long unsigned)arg2); g_assertion_message (domain, file, line, func, s); g_free (s); }
#include <vector> #include <cstdio> #ifndef SyntheticDivision_H #define SyntheticDivision_H #endif using namespace std; vector<double> synthDiv(vector<double> , double );
//------------------------------------------------------------------------- /* Copyright (C) 2010 EDuke32 developers and contributors This file is part of EDuke32. EDuke32 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- #ifndef android_h_ #define android_h_ #ifdef __ANDROID__ #include "compat.h" #include "control.h" #include "android/in_android.h" //extern int android_sample_rate; //extern int android_audio_buffer_size; extern void CONTROL_Android_ClearButton(int32_t whichbutton); extern void CONTROL_Android_PollDevices(ControlInfo *info); extern void CONTROL_Android_SetLastWeapon(int w); extern void CONTROL_Android_ScrollMap(int32_t *angle,int32_t *x, int32_t *y, uint16_t *zoom ); #endif #endif
#ifndef _SPARC64_PGALLOC_H #define _SPARC64_PGALLOC_H #include <linux/kernel.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/slab.h> #include <asm/spitfire.h> #include <asm/cpudata.h> #include <asm/cacheflush.h> #include <asm/page.h> /* Page table allocation/freeing. */ extern struct kmem_cache *pgtable_cache; static inline pgd_t *pgd_alloc(struct mm_struct *mm) { return kmem_cache_alloc(pgtable_cache, GFP_KERNEL); } static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { kmem_cache_free(pgtable_cache, pgd); } #define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD) #define pud_populate_kernel(MM, PUD, PMD) pud_populate((MM), (PUD), (PMD)) static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) { return kmem_cache_alloc(pgtable_cache, GFP_KERNEL|__GFP_REPEAT); } static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) { kmem_cache_free(pgtable_cache, pmd); } pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address); pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address); void pte_free_kernel(struct mm_struct *mm, pte_t *pte); void pte_free(struct mm_struct *mm, pgtable_t ptepage); #define pmd_populate_kernel(MM, PMD, PTE) pmd_set(MM, PMD, PTE) #define pmd_populate(MM, PMD, PTE) pmd_set(MM, PMD, PTE) #define pmd_pgtable(PMD) ((pte_t *)__pmd_page(PMD)) #define check_pgt_cache() do { } while (0) void pgtable_free(void *table, bool is_page); #ifdef CONFIG_SMP struct mmu_gather; void tlb_remove_table(struct mmu_gather *, void *); static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page) { unsigned long pgf = (unsigned long)table; if (is_page) pgf |= 0x1UL; tlb_remove_table(tlb, (void *)pgf); } static inline void __tlb_remove_table(void *_table) { void *table = (void *)((unsigned long)_table & ~0x1UL); bool is_page = false; if ((unsigned long)_table & 0x1UL) is_page = true; pgtable_free(table, is_page); } #else /* CONFIG_SMP */ static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page) { pgtable_free(table, is_page); } #endif /* !CONFIG_SMP */ static inline void __pte_free_tlb(struct mmu_gather *tlb, pte_t *pte, unsigned long address) { pgtable_free_tlb(tlb, pte, true); } #define __pmd_free_tlb(tlb, pmd, addr) \ pgtable_free_tlb(tlb, pmd, false) #endif /* _SPARC64_PGALLOC_H */
/** Module rsb2_socket - Interface. * @file rsb2_socket.h * @author jp.tranvouez@navilab.com * @defgroup rsb2_socket Socket API Wrapper * @ingroup rsb2_libos * @{ */ #ifndef RSB2_SOCKET_H #define RSB2_SOCKET_H #ifdef __cplusplus extern "C" { #endif /** Close a socket. * @param sock socket file descriptor */ void rsb2_socket_close(int sock); /** Diagnose a socket. * @param sock socket file descriptor * @retval 0 no error was detected on the socket * @retval -1 an error was detected on the socket */ int rsb2_socket_diag(int sock); /** Wait for 'input ready' condition on a socket. * @param sock socket file descriptor * @param maxms maximum wait time (ms) * @retval 0 timeout * @retval 1 data available for reading * @retval -1 error */ int rsb2_socket_rdwait(int sock, int maxms); /** Wait for 'output ready' condition on a socket. * @param sock socket file descriptor * @param maxms maximum wait time (ms) * @retval 0 timeout * @retval 1 socket available for writing * @retval -1 error */ int rsb2_socket_wrwait(int sock, int maxms); /** Read data from a service socket. * @param sock service socket file descriptor * @param buf buffer address * @param bufsz buffer size * @return number of bytes read * @retval -1 error */ int rsb2_socket_recv(int sock, char *buf, int bufsz); /** Write data to a service socket. * @param sock service socket file descriptor * @param msg data address * @param msglen data length * @return number of bytes written * @retval -1 error */ int rsb2_socket_send(int sock, const char *msg, int msglen); #ifdef __cplusplus } #endif #endif /*@} RSB2_SOCKET_H */
/* * LK8000 Tactical Flight Computer - WWW.LK8000.IT * Released under GNU/GPL License v.2 or later * See CREDITS.TXT file for authors and copyrights * * File: IOIOUartPort.h * Author: Bruno de Lacheisserie */ #ifndef ANDROID_USBSERIALPORT_H #define ANDROID_USBSERIALPORT_H #include "AndroidPort.h" class UsbSerialPort : public AndroidPort { public: UsbSerialPort(int idx, const char* szName, unsigned baud, BitIndex_t BitSize) : AndroidPort(idx, szName), _baud(baud), _bit(BitSize) { } bool CreateBridge() override; protected: const unsigned _baud; BitIndex_t _bit; }; #endif //ANDROID_USBSERIALPORT_H
/* Omnispeak: A Commander Keen Reimplementation Copyright (C) 2020 Omnispeak Authors 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 ID_FS_H #define ID_FS_H // This is the "Filesystem Manager", which handles all file I/O, and determines // which paths are used for which data files. #include "id_mm.h" #include <stdbool.h> #include <stdio.h> typedef FILE *FS_File; bool FS_IsFileValid(FS_File file); size_t FS_GetFileSize(FS_File file); size_t FS_Read(void *ptr, size_t size, size_t nmemb, FS_File file); size_t FS_Write(const void *ptr, size_t size, size_t nmemb, FS_File file); size_t FS_SeekTo(FS_File file, size_t offset); void FS_CloseFile(FS_File file); // Omnispeak has three search paths, for three different kinds of data files: // - Keen Data (The original data files shipped with Keen) // - Omnispeak Data (The datafiles shipped with omnispeak: headers, huffman dictionaries, and scripts) // - User Data (Configs, Savegames, etc) // // These search paths may all point to the same directory, or they may // each be independent. The defaults can be configured at runtime. FS_File FS_OpenKeenFile(const char *fileName); FS_File FS_OpenOmniFile(const char *fileName); FS_File FS_OpenUserFile(const char *fileName); FS_File FS_CreateUserFile(const char *fileName); char *FS_AdjustExtension(const char *filename); bool FS_IsKeenFilePresent(const char *filename); bool FS_IsOmniFilePresent(const char *filename); bool FS_IsUserFilePresent(const char *filename); void FS_Startup(); // Used for reading buffers of a specific type, assuming Little-Endian // byte order in the file's data itself. It gets converted to native order. size_t FS_ReadInt8LE(void *ptr, size_t count, FS_File stream); size_t FS_ReadInt16LE(void *ptr, size_t count, FS_File stream); size_t FS_ReadInt32LE(void *ptr, size_t count, FS_File stream); // Used for writing buffers of a specific type, converting // native byte order to Little-Endian order within the file. size_t FS_WriteInt8LE(const void *ptr, size_t count, FS_File stream); size_t FS_WriteInt16LE(const void *ptr, size_t count, FS_File stream); size_t FS_WriteInt32LE(const void *ptr, size_t count, FS_File stream); // Similar methods for reading/writing bools from/to int16_t // (0 as false, 1 as true and any nonzero as true for reading.) // TODO: Maybe int16_t's should be used internally? (Same as vanilla Keen.) size_t FS_ReadBoolFrom16LE(void *ptr, size_t count, FS_File stream); size_t FS_WriteBoolTo16LE(const void *ptr, size_t count, FS_File stream); // fprintf() wrapper. int FS_PrintF(FS_File stream, const char *fmt, ...); // Load an entire file into memory. bool FS_LoadUserFile(const char *filename, mm_ptr_t *ptr, int *memsize); #endif
/* $Id: dlts.c,v 1.4 2006/11/22 15:26:50 bertl Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdlib.h> #include "messages.h" #include "dlts.h" #include <stdio.h> #ifdef USE_ZLIB #include <zlib.h> #endif #include <string.h> #include "data_io.h" /* #include <sys/types.h> #include <sys/stat.h> */ #define BUFFER_SIZE (1024 * 1024) dlts_t dlts_create(){ dlts_t lts; lts=(dlts_t)malloc(sizeof(struct dlts)); if (!lts) Fatal(1,1,"out of memory in dlts_create"); lts->dirname=NULL; lts->segment_count=0; return lts; } void dlts_free(dlts_t lts){ int i,j; for (i=0;i<lts->label_count;i++) free(lts->label_string[i]); for(i=0;i<lts->segment_count;i++){ free(lts->transition_count[i]); for(j=0;j<lts->segment_count;j++){ if (lts->src[i][j]) free(lts->src[i][j]); if (lts->label[i][j]) free(lts->label[i][j]); if (lts->dest[i][j]) free(lts->dest[i][j]); } free(lts->src[i]); free(lts->label[i]); free(lts->dest[i]); } free(lts->transition_count); free(lts->label_string); free(lts->src); free(lts->label); free(lts->dest); free(lts); } void dlts_getinfo(dlts_t lts){ FILE* info; char name[1024],buf[BUFFER_SIZE]; int i,j,version,len,dummy; sprintf(name,"%s/info",lts->dirname); info=fopen(name,"r"); setvbuf(info,buf,_IOFBF,BUFFER_SIZE); fread32(info,&version); if (version!=31) Fatal(1,1,"wrong file version: %d",version); fread16(info,&len); lts->info=(char*)malloc(len+1); freadN(info,lts->info,len); lts->info[len]=0; fread32(info,&(lts->segment_count)); fread32(info,&(lts->root_seg)); fread32(info,&(lts->root_ofs)); fread32(info,&(lts->label_count)); fread32(info,&(lts->tau)); fread32(info,&dummy); lts->state_count=(int*)malloc(lts->segment_count*sizeof(int)); for(i=0;i<lts->segment_count;i++){ fread32(info,(lts->state_count)+i); } lts->transition_count=(int**)malloc(lts->segment_count*sizeof(int*)); for(i=0;i<lts->segment_count;i++){ lts->transition_count[i]=(int*)malloc(lts->segment_count*sizeof(int)); for(j=0;j<lts->segment_count;j++){ fread32(info,&(lts->transition_count[i][j])); } } lts->src=(int***)malloc(lts->segment_count*sizeof(int**)); lts->label=(int***)malloc(lts->segment_count*sizeof(int**)); lts->dest=(int***)malloc(lts->segment_count*sizeof(int**)); for(i=0;i<lts->segment_count;i++){ lts->src[i]=(int**)malloc(lts->segment_count*sizeof(int*)); lts->label[i]=(int**)malloc(lts->segment_count*sizeof(int*)); lts->dest[i]=(int**)malloc(lts->segment_count*sizeof(int*)); for(j=0;j<lts->segment_count;j++){ lts->src[i][j]=NULL; lts->label[i][j]=NULL; lts->dest[i][j]=NULL; } } } #ifdef USE_ZLIB void dlts_getTermDB(dlts_t lts){ char buf[MAX_TERM_LEN+2]; char name[1024]; gzFile f; int i; int len; sprintf(name,"%s/TermDB",lts->dirname); f=gzopen(name,"r"); lts->label_string=(char**)malloc(lts->label_count*sizeof(char*)); for(i=0;i<lts->label_count;i++){ gzgets(f,buf,MAX_TERM_LEN+1); len=strlen(buf); len--; buf[len]=0; lts->label_string[i]=strdup(buf); } gzclose(f); } #else void dlts_getTermDB(dlts_t lts){ char name[1024]; FILE *f; char *ptr; int i, len; char *termdata; sprintf(name,"%s/TermDB",lts->dirname); // fd=open(name,O_RDONLY); f = fopen(name, "r"); len = FileLen(f); lts->label_string=(char**)malloc(lts->label_count*sizeof(char*)); termdata=(char*)malloc(len); fread(termdata, sizeof(char), len, f); ptr=termdata; for(i=0;i<lts->label_count;i++){ lts->label_string[i]=ptr; while(*ptr!='\n') ptr++; *ptr=0; lts->label_string[i]=strdup(lts->label_string[i]); ptr++; } fclose(f); free(termdata); } #endif void dlts_load_src(dlts_t lts,int from,int to){ int i; char name[1024],buf[BUFFER_SIZE]; FILE* file; int *data; sprintf(name,"%s/src-%d-%d",lts->dirname,from,to); file=fopen(name,"r"); setvbuf(file,buf,_IOFBF,BUFFER_SIZE); data=(int*)malloc((lts->transition_count[from][to])*sizeof(int)); for(i=0;i<lts->transition_count[from][to];i++){ fread32(file,data+i); } lts->src[from][to]=data; fclose(file); } void dlts_load_label(dlts_t lts,int from,int to){ int i; char name[1024],buf[BUFFER_SIZE]; FILE* file; int *data; sprintf(name,"%s/label-%d-%d",lts->dirname,from,to); file=fopen(name,"r"); setvbuf(file,buf,_IOFBF,BUFFER_SIZE); data=(int*)malloc(lts->transition_count[from][to]*sizeof(int)); for(i=0;i<lts->transition_count[from][to];i++){ fread32(file,data+i); } lts->label[from][to]=data; fclose(file); } void dlts_free_dest(dlts_t lts,int from,int to){ free(lts->dest[from][to]); lts->dest[from][to]=NULL; } void dlts_free_src(dlts_t lts,int from,int to){ free(lts->src[from][to]); lts->src[from][to]=NULL; } void dlts_free_label(dlts_t lts,int from,int to){ free(lts->label[from][to]); lts->label[from][to]=NULL; } void dlts_load_dest(dlts_t lts,int from,int to){ int i; char name[1024],buf[BUFFER_SIZE]; FILE* file; int *data; sprintf(name,"%s/dest-%d-%d",lts->dirname,from,to); file=fopen(name,"r"); setvbuf(file,buf,_IOFBF,BUFFER_SIZE); data=(int*)malloc(lts->transition_count[from][to]*sizeof(int)); for(i=0;i<lts->transition_count[from][to];i++){ fread32(file,data+i); } lts->dest[from][to]=data; fclose(file); }
/*//////////////////////////////////////////////////////////////////////// Copyright (c) 1992 Electrotechnical Laboratry (ETL) Permission to use, copy, modify, and distribute this material for any purpose and without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies, and that the name of ETL not be used in advertising or publicity pertaining to this material without the specific, prior written permission of an authorized representative of ETL. ETL MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. ///////////////////////////////////////////////////////////////////////// ontent-Type: program/C; charset=US-ASCII Program: codess.h Author: Yutaka Sato <ysato@etl.go.jp> Description: This program redirects the file I/O of codes.c from/to strings on memory. History: 92.05.18 created //////////////////////////////////////////////////////////////////////#*/ #include <stdio.h> #include "mime.h" /* main(ac,av) char *av[]; { CStr(in,0x10000); CStr(out,0x10000); int size; size = fread(in,1,sizeof(in),stdin); in[size] = 0; if( strcmp(av[1],"eb") == 0 ) str_to64(in,strlen(in),out,sizeof(out),0); if( strcmp(av[1],"ub") == 0 ) str_from64(in,strlen(in),out,sizeof(out),0); if( strcmp(av[1],"eq") == 0 ) str_toqp(in,strlen(in),out,sizeof(out)); if( strcmp(av[1],"uq") == 0 ) str_fromqp(in,strlen(in),out,sizeof(out)); syslog_ERROR("%s",out); } */ void _to64(FILE *in,FILE *out); void _from64(FILE *in,FILE *out); void _toqp(FILE *in,FILE *out); void _fromqp(FILE *in,FILE *out); static int str_callfunc(iFUNCP func,PCStr(in),int isize,PVStr(out),int osize,int arg3,int arg4) { FILE *In,*Out; int rcode; int len; In = str_fopen((char*)in,isize,"r"); Out = str_fopen((char*)out,osize,"w"); setVStrEnd(out,0); rcode = (*func)(In,Out,arg3,arg4); len = str_ftell(Out); setVStrEnd(out,len); str_fflush(Out); str_fclose(In); str_fclose(Out); return len; } int str_to64(PCStr(in),int isize,PVStr(out),int osize,int pnl) { int len; len = str_callfunc((iFUNCP)_to64,in,isize,AVStr(out),osize,pnl,0); return len; } int str_from64(PCStr(in),int isize,PVStr(out),int osize) { int len; return str_callfunc((iFUNCP)_from64,in,isize,AVStr(out),osize,0,0); } int str_toqp(PCStr(in),int isize,PVStr(out),int osize) { int len; len = str_callfunc((iFUNCP)_toqp,in,isize,AVStr(out),osize,0,0); if( 2 < len && out[len-2] == '=' && out[len-1] == '\n' ){ setVStrEnd(out,len-2); len -= 2; } return len; } int str_fromqp(PCStr(in),int isize,PVStr(out),int osize) { return str_callfunc((iFUNCP)_fromqp,in,isize,AVStr(out),osize,0,0); } /**************************************/ void to64(FILE *in,FILE *out) { MIME_to64(in,out); } void from64(FILE *in,FILE *out) { MIME_from64(in,out); } void toqp(FILE *in,FILE *out) { MIME_toQP(in,out); } void fromqp(FILE *in,FILE *out) { MIME_fromQP(in,out); } /**************************************/ #include "str_stdio.h" #define MIME_to64 _to64 #define MIME_to64X _to64X #define MIME_from64 _from64 #define MIME_toQP _toqp #define MIME_fromQP _fromqp #define MIME_setQP str_setqp #include "mimecodes.c" int qpputc(FILE *out,PCStr(escs),int ch){ if( ch < ' ' || ch == '=' || 0x7F <= ch || strchr(escs,ch) ){ fprintf(out,"=%02X",ch); return 3; }else{ putc(ch,out); return 1; } } int qpputs(FILE *out,PCStr(escs),PCStr(str)){ const char *sp; int ch; int occ = 0; for( sp = str; ch = *sp; sp++ ){ occ += qpputc(out,escs,ch); } return occ; } int QPfprintf(FILE *out,PCStr(escs),PCStr(fmt),...){ const char *fp; int ch; int ai = 0; int occ = 0; VARGS(16,fmt); for( fp = fmt; ch = *fp; fp++ ){ if( ch != '%' ){ occ += qpputc(out,escs,ch); continue; } if( (ch = *++fp) == 0 ){ break; } switch( ch ){ case '%': occ += qpputc(out,escs,ch); break; case 's': occ += qpputs(out,escs,va[ai++]); break; } } return occ; }