text
stringlengths
4
6.14k
// Copyright (C) 2010 Andrey Gruber (aka lamer) // 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 #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winbase.h> #include <wchar.h> #include <tchar.h> #include <wininet.h> #include "download.h" #include "ineterror.h" DWORD WINAPI DownloadFileFunc(LPVOID lpParam){ HINTERNET hInternet, hRemoteFile; //internet handles HANDLE hLocalFile; //local file handle wchar_t szLengthBuffer[128]; //buffer to get the size of remote file BYTE bytes[4096]; //buffer to read from remote file DWORD bytesRead = 4096; //number of bytes read DWORD bytesWritten; //number of bytes written DWORD sizeReceived = 0; //number of bytes received DWORD sizeTotal; //total number of bytes to receive (size of remote file) DWORD sizeLength = 128; //length of buffer receives the size of remote file BOOL result = FALSE; //result of read operation HWND hwnd = (HWND)lpParam; //window handle for posting messages //get handle to the current Internet session hInternet = InternetOpenW(L"InetURL/1.0", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); if(!hInternet){ //get error information GetInternetErrorDescriptionW(gd_ErrDesc, 0); //post error information PostMessageW(hwnd, DNLM_INETERROR, 0, 0); //exit thread return 1; } //open remote resource hRemoteFile = InternetOpenUrlW(hInternet, gd_URL, NULL, 0, INTERNET_FLAG_NO_CACHE_WRITE, 0); if(!hRemoteFile){ //get error information GetInternetErrorDescriptionW(gd_ErrDesc, 0); //close handle InternetCloseHandle(hInternet); //post error information PostMessageW(hwnd, DNLM_INETERROR, 0, 0); //exit thread return 1; } //get total size of remote file HttpQueryInfoW(hRemoteFile, HTTP_QUERY_CONTENT_LENGTH, szLengthBuffer, &sizeLength, 0); sizeTotal = _wtol(szLengthBuffer); //create local file hLocalFile = CreateFileW(gd_LocalFile, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if(hLocalFile != INVALID_HANDLE_VALUE){ do{ //read remote file result = InternetReadFile(hRemoteFile, bytes, 4096, &bytesRead); if(!result){ //get error information GetInternetErrorDescriptionW(gd_ErrDesc, 0); //post error information PostMessageW(hwnd, DNLM_INETERROR, 0, 0); break; } //write to local file WriteFile(hLocalFile, bytes, bytesRead, &bytesWritten, NULL); //increase number of bytes downloaded sizeReceived += bytesRead; //post progress message with total size as wParam and downloaded size as lParam PostMessageW(hwnd, DNLM_PROGRESS, sizeTotal, sizeReceived); }while(result && bytesRead > 0); //close local file CloseHandle(hLocalFile); if(!result){ //in case of error delete local file DeleteFileW(gd_LocalFile); //exit thread return 1; } //post finish message PostMessageW(hwnd, DNLM_FINISHED, 0, 0); } //close handles InternetCloseHandle(hRemoteFile); InternetCloseHandle(hInternet); //exit thread return 0; }
#pragma once #ifdef _WIN32 #include <QWinTaskbarProgress> #include <QWinTaskbarButton> #include <QWinTHumbnailToolbar> #include <QWinTHumbnailToolbutton> #endif #include <QMainWindow> #include <QPushButton> #include <QIcon> #include "log_frame.h" #include "debugger_frame.h" #include "game_list_frame.h" #include "gui_settings.h" #include <memory> namespace Ui { class main_window; } class main_window : public QMainWindow { Q_OBJECT Ui::main_window *ui; bool m_sys_menu_opened; bool m_save_slider_pos = false; QIcon m_appIcon; QIcon m_icon_play; QIcon m_icon_pause; QIcon m_icon_stop; QIcon m_icon_restart; QIcon m_icon_fullscreen_on; QIcon m_icon_fullscreen_off; #ifdef _WIN32 QIcon m_icon_thumb_play; QIcon m_icon_thumb_pause; QIcon m_icon_thumb_stop; QIcon m_icon_thumb_restart; QWinThumbnailToolBar *m_thumb_bar = nullptr; QWinThumbnailToolButton *m_thumb_playPause = nullptr; QWinThumbnailToolButton *m_thumb_stop = nullptr; QWinThumbnailToolButton *m_thumb_restart = nullptr; QStringList m_vulkan_adapters; #endif #ifdef _MSC_VER QStringList m_d3d12_adapters; #endif enum drop_type { drop_error, drop_pkg, drop_pup, drop_rap, drop_dir, drop_game }; public: explicit main_window(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget *parent = 0); void Init(); ~main_window(); void CreateThumbnailToolbar(); QIcon GetAppIcon(); Q_SIGNALS: void RequestGlobalStylesheetChange(const QString& sheetFilePath); public Q_SLOTS: void OnEmuStop(); void OnEmuRun(); void OnEmuResume(); void OnEmuPause(); void OnEmuReady(); void RepaintGui(); private Q_SLOTS: void Boot(const std::string& path, bool direct = false, bool add_only = false); void BootElf(); void BootGame(); void DecryptSPRXLibraries(); void SaveWindowState(); void ConfigureGuiFromSettings(bool configure_all = false); void SetIconSizeActions(int idx); protected: void closeEvent(QCloseEvent *event) override; void keyPressEvent(QKeyEvent *keyEvent) override; void mouseDoubleClickEvent(QMouseEvent *event) override; void dropEvent(QDropEvent* event) override; void dragEnterEvent(QDragEnterEvent* event) override; void dragMoveEvent(QDragMoveEvent* event) override; void dragLeaveEvent(QDragLeaveEvent* event) override; void SetAppIconFromPath(const std::string& path); private: void RepaintToolbar(); void RepaintToolBarIcons(); void RepaintThumbnailIcons(); void CreateActions(); void CreateConnects(); void CreateDockWindows(); void EnableMenus(bool enabled); void InstallPkg(const QString& dropPath = ""); void InstallPup(const QString& dropPath = ""); int IsValidFile(const QMimeData& md, QStringList* dropPaths = nullptr); void AddGamesFromDir(const QString& path); QAction* CreateRecentAction(const q_string_pair& entry, const uint& sc_idx); void BootRecentAction(const QAction* act); void AddRecentAction(const q_string_pair& entry); q_pair_list m_rg_entries; QList<QAction*> m_recentGameActs; QActionGroup* m_iconSizeActGroup; QActionGroup* m_listModeActGroup; QActionGroup* m_categoryVisibleActGroup; // Dockable widget frames QMainWindow *m_mw; log_frame *m_logFrame; debugger_frame *m_debuggerFrame; game_list_frame *m_gameListFrame; std::shared_ptr<gui_settings> guiSettings; std::shared_ptr<emu_settings> emuSettings; };
/* wdb - weather and water data storage Copyright (C) 2007 met.no Contact information: Norwegian Meteorological Institute Box 43 Blindern 0313 OSLO NORWAY E-mail: wdb@met.no 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 __READMAPFILE_H__ #define __READMAPFILE_H__ #include <iostream> #include <string> #include "Map.h" /** * \addtogroup ts2xml * * @{ */ /** * Reads a DTED geographic file with a height field and returns a Map. * The Map instance assume the data is given as an UTM projection for zone 33. * The size of the field and resolution for the field is read from the file header. * * @param[in] filename The name of the DTED file. * @param[out] error. On error this string give an reason of the erreor. * @return A pointer to a Map instance on success and 0 on failure. The * caller is responsible to delete the Map after use. */ Map* readMapFile(const std::string &filename, std::string &error); /** @} */ #endif
#ifndef GLOBAL_PARENT_HPP #define GLOBAL_PARENT_HPP #include <QMainWindow> extern QMainWindow *g_parent; #endif
#ifndef BOARD_H #define BOARD_H /* Messages boards * * Copyright (C) 2004-2005 Lee Begg and the Thousand Parsec Project * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include <tpserver/common.h> #include <tpserver/message.h> #include <tpserver/protocolobject.h> #include <boost/enable_shared_from_this.hpp> /** * Board for posting messages */ class Board : public ProtocolObject, public boost::enable_shared_from_this<Board> { public: /// typedef for shared pointer typedef boost::shared_ptr< Board > Ptr; /** * Constructor * * Sets modification time to now, and number of messages to zero. */ Board( uint32_t nid, const std::string& nname, const std::string& ndesc ); /** * Adds a message at given position * * Passing -1 as position will result in adding a message on top of * the board. * * If message is succesfully added modification time is updated and * board is updated. */ void addMessage(Message::Ptr msg, int pos); /** * Removes message at given position * * @param pos valid message position * @returns true if message has been successfuly removed, false otherwise */ bool removeMessage(uint32_t pos); /** * Packs board information into a frame. */ void pack(OutputFrame::Ptr frame) const; /** * Packs the requested message into the frame */ void packMessage(OutputFrame::Ptr frame, uint32_t msgnum); /** * Get count of messages on board */ uint32_t getNumMessages() const; /** * Sets the number of messages on board and modification time * * @warning should be used ONLY by the persistence module */ void setPersistenceData( uint32_t nmessage_count, uint64_t nmod_time ); private: /// Count of messages on the board uint32_t message_count; /// List of MessageID's belonging to this board IdList message_ids; /// Retrieves if neccessary message list from persistence void retrieveMessageList(); }; #endif
/**************************************************************** * * * Copyright 2001 Sanchez Computer Associates, Inc. * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * * under a license. If you do not know the terms of * * the license, please stop and do not read further. * * * ****************************************************************/ #include "mdef.h" #include "cmidef.h" #include "eintr_wrappers.h" cmi_status_t cmi_write(struct CLB *lnk) { sigset_t oset; cmi_status_t status; struct NTD *tsk = lnk->ntd; int rc; CMI_DPRINT(("ENTER CMI_WRITE, AST %x\n", lnk->ast)); SIGPROCMASK(SIG_BLOCK, &tsk->mutex_set, &oset, rc); status = cmj_write_start(lnk); if (CMI_ERROR(status)) { SIGPROCMASK(SIG_SETMASK, &oset, NULL, rc); CMI_DPRINT(("EXIT CMI_WRITE ERR\n")); return status; } cmj_housekeeping(); while (lnk->sta == CM_CLB_WRITE && !lnk->ast) { sigsuspend(&oset); cmj_housekeeping(); /* recover status */ if (lnk->sta != CM_CLB_WRITE) status = CMI_CLB_IOSTATUS(lnk); } SIGPROCMASK(SIG_SETMASK, &oset, NULL, rc); CMI_DPRINT(("EXIT CMI_WRITE sta = %d\n", lnk->sta)); return status; }
/* * Copyright (C) 2002-2012 by Dave J. Andruczyk <djandruczyk at yahoo dot com> * * Linux Megasquirt tuning software * * * This software comes under the GPL (GNU Public License) * You may freely copy,distribute etc. this as long as the source code * is made available for FREE. * * No warranty is made or implied. You use this program at your own risk. */ /*! \file src/plugins/pis/pis_plugin.c \ingroup PisPlugin,Plugins \brief PIS Plugin stubs \author David Andruczyk */ #define __PIS_PLUGIN_C__ #include <pis_plugin.h> #include <gtk/gtk.h> #include <stdio.h> gconstpointer *global_data = NULL; /*! \brief initializes the plugin, referencing all needed functions \param data is the pointer to the global data container */ G_MODULE_EXPORT void plugin_init(gconstpointer *data) { global_data = data; *(void **)(&error_msg_f) = (void **)DATA_GET(global_data,"error_msg_f"); g_assert(error_msg_f); *(void **)(&get_symbol_f) = (void **)DATA_GET(global_data,"get_symbol_f"); g_assert(get_symbol_f); get_symbol_f("dbg_func",(void **)&dbg_func_f); ENTER(); /* Initializes function pointers since on Winblows was can NOT call functions within the program that loaded this DLL, so we need to pass pointers over and assign them here. */ register_ecu_enums(); EXIT(); return; } /*! \brief prepares the plugin to be unloaded */ G_MODULE_EXPORT void plugin_shutdown() { ENTER(); deregister_ecu_enums(); EXIT(); return; } /*! \brief registers common enumerations in the global table for this plugin */ void register_ecu_enums(void) { GHashTable *str_2_enum = NULL; ENTER(); str_2_enum = (GHashTable *)DATA_GET (global_data, "str_2_enum"); if (str_2_enum) { } else printf ("COULD NOT FIND global pointer to str_2_enum table\n!"); EXIT(); return; } /*! \brief deregisters common enumerations from the global table for this plugin */ void deregister_ecu_enums(void) { GHashTable *str_2_enum = NULL; ENTER(); str_2_enum = (GHashTable *)DATA_GET (global_data, "str_2_enum"); if (str_2_enum) { } else printf ("COULD NOT FIND global pointer to str_2_enum table\n!"); EXIT(); return; }
#ifndef XCHAT_URL_H #define XCHAT_URL_H extern void *url_tree; #define WORD_URL 1 #define WORD_NICK 2 #define WORD_CHANNEL 3 #define WORD_HOST 4 #define WORD_EMAIL 5 #define WORD_DIALOG -1 void url_clear (void); void url_save (const char *fname, const char *mode, gboolean fullpath); void url_autosave (void); int url_check_word (char *word, size_t len); void url_check_line (char *buf, size_t len); #endif
// // ScreensViewController.h // LocationWidget // // Created by Nivedita on 3/11/15. // Copyright (c) 2015 Nivedita. All rights reserved. // #import <UIKit/UIKit.h> @interface ScreensViewController : UIViewController { UIView *vwScreen; } @end
void test (void){ } ;
/* * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.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, see <http://www.gnu.org/licenses/>. */ #ifndef _LOGINDATABASE_H #define _LOGINDATABASE_H #include "DatabaseWorkerPool.h" #include "MySQLConnection.h" class LoginDatabaseConnection : public MySQLConnection { public: //- Constructors for sync and async connections LoginDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) { } LoginDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } //- Loads database type specific prepared statements void DoPrepareStatements() override; }; typedef DatabaseWorkerPool<LoginDatabaseConnection> LoginDatabaseWorkerPool; enum LoginDatabaseStatements { /* Naming standard for defines: {DB}_{SEL/INS/UPD/DEL/REP}_{Summary of data changed} When updating more than one field, consider looking at the calling function name for a suiting suffix. */ LOGIN_SEL_REALMLIST, LOGIN_DEL_EXPIRED_IP_BANS, LOGIN_UPD_EXPIRED_ACCOUNT_BANS, LOGIN_SEL_IP_BANNED, LOGIN_INS_IP_AUTO_BANNED, LOGIN_SEL_ACCOUNT_BANNED, LOGIN_SEL_ACCOUNT_BANNED_ALL, LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, LOGIN_INS_ACCOUNT_AUTO_BANNED, LOGIN_DEL_ACCOUNT_BANNED, LOGIN_SEL_SESSIONKEY, LOGIN_UPD_VS, LOGIN_UPD_LOGONPROOF, LOGIN_SEL_LOGONCHALLENGE, LOGIN_SEL_LOGON_COUNTRY, LOGIN_UPD_FAILEDLOGINS, LOGIN_SEL_FAILEDLOGINS, LOGIN_SEL_ACCOUNT_ID_BY_NAME, LOGIN_SEL_ACCOUNT_LIST_BY_NAME, LOGIN_SEL_ACCOUNT_INFO_BY_NAME, LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL, LOGIN_SEL_NUM_CHARS_ON_REALM, LOGIN_SEL_ACCOUNT_BY_IP, LOGIN_INS_IP_BANNED, LOGIN_DEL_IP_NOT_BANNED, LOGIN_SEL_IP_BANNED_ALL, LOGIN_SEL_IP_BANNED_BY_IP, LOGIN_SEL_ACCOUNT_BY_ID, LOGIN_INS_ACCOUNT_BANNED, LOGIN_UPD_ACCOUNT_NOT_BANNED, LOGIN_DEL_REALM_CHARACTERS_BY_REALM, LOGIN_DEL_REALM_CHARACTERS, LOGIN_INS_REALM_CHARACTERS, LOGIN_SEL_SUM_REALM_CHARACTERS, LOGIN_INS_ACCOUNT, LOGIN_INS_REALM_CHARACTERS_INIT, LOGIN_UPD_EXPANSION, LOGIN_UPD_ACCOUNT_LOCK, LOGIN_UPD_ACCOUNT_LOCK_CONTRY, LOGIN_INS_LOG, LOGIN_UPD_USERNAME, LOGIN_UPD_PASSWORD, LOGIN_UPD_EMAIL, LOGIN_UPD_REG_EMAIL, LOGIN_UPD_MUTE_TIME, LOGIN_UPD_MUTE_TIME_LOGIN, LOGIN_UPD_LAST_IP, LOGIN_UPD_LAST_ATTEMPT_IP, LOGIN_UPD_ACCOUNT_ONLINE, LOGIN_UPD_UPTIME_PLAYERS, LOGIN_DEL_OLD_LOGS, LOGIN_DEL_ACCOUNT_ACCESS, LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM, LOGIN_INS_ACCOUNT_ACCESS, LOGIN_GET_ACCOUNT_ID_BY_USERNAME, LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL, LOGIN_GET_GMLEVEL_BY_REALMID, LOGIN_GET_USERNAME_BY_ID, LOGIN_SEL_CHECK_PASSWORD, LOGIN_SEL_CHECK_PASSWORD_BY_NAME, LOGIN_SEL_PINFO, LOGIN_SEL_PINFO_BANS, LOGIN_SEL_GM_ACCOUNTS, LOGIN_SEL_ACCOUNT_INFO, LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST, LOGIN_SEL_ACCOUNT_ACCESS, LOGIN_SEL_ACCOUNT_RECRUITER, LOGIN_SEL_BANS, LOGIN_SEL_ACCOUNT_WHOIS, LOGIN_SEL_REALMLIST_SECURITY_LEVEL, LOGIN_DEL_ACCOUNT, LOGIN_SEL_IP2NATION_COUNTRY, LOGIN_SEL_AUTOBROADCAST, LOGIN_SEL_LAST_ATTEMPT_IP, LOGIN_SEL_LAST_IP, LOGIN_GET_EMAIL_BY_ID, LOGIN_INS_ALDL_IP_LOGGING, LOGIN_INS_FACL_IP_LOGGING, LOGIN_INS_CHAR_IP_LOGGING, LOGIN_INS_FALP_IP_LOGGING, LOGIN_SEL_ACCOUNT_ACCESS_BY_ID, LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS, LOGIN_INS_RBAC_ACCOUNT_PERMISSION, LOGIN_DEL_RBAC_ACCOUNT_PERMISSION, LOGIN_INS_ACCOUNT_MUTE, LOGIN_SEL_ACCOUNT_MUTE_INFO, LOGIN_SEL_LEGACY_ITEMS, LOGIN_UPD_LEGACY_ITEM, LOGIN_REP_LEGACY_ITEM, MAX_LOGINDATABASE_STATEMENTS }; #endif
#include <stdio.h> #include <stdint.h> #include <string.h> #include <stdlib.h> #include <wchar.h> #include "../86box.h" #include "../io.h" #include "../device.h" #include "sound.h" #include "snd_resid.h" #include "snd_ssi2001.h" typedef struct ssi2001_t { void *psid; int16_t buffer[SOUNDBUFLEN * 2]; int pos; } ssi2001_t; static void ssi2001_update(ssi2001_t *ssi2001) { if (ssi2001->pos >= sound_pos_global) return; sid_fillbuf(&ssi2001->buffer[ssi2001->pos], sound_pos_global - ssi2001->pos, ssi2001->psid); ssi2001->pos = sound_pos_global; } static void ssi2001_get_buffer(int32_t *buffer, int len, void *p) { ssi2001_t *ssi2001 = (ssi2001_t *)p; int c; ssi2001_update(ssi2001); for (c = 0; c < len * 2; c++) buffer[c] += ssi2001->buffer[c >> 1] / 2; ssi2001->pos = 0; } static uint8_t ssi2001_read(uint16_t addr, void *p) { ssi2001_t *ssi2001 = (ssi2001_t *)p; ssi2001_update(ssi2001); return sid_read(addr, p); } static void ssi2001_write(uint16_t addr, uint8_t val, void *p) { ssi2001_t *ssi2001 = (ssi2001_t *)p; ssi2001_update(ssi2001); sid_write(addr, val, p); } void *ssi2001_init(const device_t *info) { ssi2001_t *ssi2001 = malloc(sizeof(ssi2001_t)); memset(ssi2001, 0, sizeof(ssi2001_t)); pclog("ssi2001_init\n"); ssi2001->psid = sid_init(); sid_reset(ssi2001->psid); io_sethandler(0x0280, 0x0020, ssi2001_read, NULL, NULL, ssi2001_write, NULL, NULL, ssi2001); sound_add_handler(ssi2001_get_buffer, ssi2001); return ssi2001; } void ssi2001_close(void *p) { ssi2001_t *ssi2001 = (ssi2001_t *)p; sid_close(ssi2001->psid); free(ssi2001); } const device_t ssi2001_device = { "Innovation SSI-2001", 0, 0, ssi2001_init, ssi2001_close, NULL, NULL, NULL, NULL, NULL, NULL };
/* * $Id: btopn.c,v 1.12 2010-06-02 10:29:10 mark Exp $ * * btopn: opens existing B tree index * * Parameters: * fid name of file to open * mode if ZERO, index file can be updated * shared set TRUE if index file is to be shared * * Returns zero if no errors, error code otherwise * * Copyright (C) 2003, 2004 Mark Willson. * * This file is part of the B Tree library. * * The B Tree library is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * The B Tree library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with the B Tree library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <stdio.h> #include <string.h> #include "bc.h" #include "bt.h" #include "btree.h" #include "btree_int.h" BTA *btopn(char *fid, int mode, int shared) { int status; bterr("",0,NULL); btact = bnewap(fid); if (btact == NULL) { bterr("BTOPN",QNOACT,NULL); return NULL; } if ((btact->idxunt = fopen(fid,"r+b")) == NULL) { bterr("BTOPN",QOPNIO,fid); return NULL; } strcpy(btact->idxfid,fid); if (bacini(btact) != 0) { fclose(btact->idxunt); goto fin1; } btact->shared = shared; btact->cntxt->super.smod = 0; btact->cntxt->super.scroot = 0; /* always lock file; shared will unlock at routine exit */ if (!block()) { bterr("BTOPN",QBUSY,NULL); goto fin; } /* read in super root */ if (brdsup() != 0) goto fin; /* change to default root */ status = btchgr(btact,"$$default"); if (status != 0) goto fin; btact->cntxt->super.smode = mode; if (btgerr() != 0) goto fin; if (shared) bulock(); return(btact); fin: if (shared) bulock(); fin1: bacfre(btact); return(NULL); }
/** ****************************************************************************** * @file Audio_playback_and_record/Inc/waveplayer.h * @author MCD Application Team * @version V1.1.0 * @date 26-June-2014 * @brief Header for waveplayer.c module. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __WAVEPLAYER_H #define __WAVEPLAYER_H /* Includes ------------------------------------------------------------------*/ #include "main.h" /* Exported types ------------------------------------------------------------*/ typedef enum { BUFFER_OFFSET_NONE = 0, BUFFER_OFFSET_HALF, BUFFER_OFFSET_FULL, }BUFFER_StateTypeDef; typedef struct { uint32_t ChunkID; /* 0 */ uint32_t FileSize; /* 4 */ uint32_t FileFormat; /* 8 */ uint32_t SubChunk1ID; /* 12 */ uint32_t SubChunk1Size; /* 16*/ uint16_t AudioFormat; /* 20 */ uint16_t NbrChannels; /* 22 */ uint32_t SampleRate; /* 24 */ uint32_t ByteRate; /* 28 */ uint16_t BlockAlign; /* 32 */ uint16_t BitPerSample; /* 34 */ uint32_t SubChunk2ID; /* 36 */ uint32_t SubChunk2Size; /* 40 */ }WAVE_FormatTypeDef; /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void WavePlayBack(uint32_t AudioFreq); int WavePlayerInit(uint32_t AudioFreq); void WavePlayerStop(void); void WavePlayerPauseResume(uint32_t state); void WavePlayerStart(void); void WavePlayer_CallBack(void); #endif /* __WAVEPLAYER_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_NATIVE_THEME_NATIVE_THEME_ANDROID_H_ #define UI_NATIVE_THEME_NATIVE_THEME_ANDROID_H_ #include "ui/native_theme/native_theme_base.h" namespace ui { class NativeThemeAndroid : public NativeThemeBase { public: static NativeThemeAndroid* instance(); virtual SkColor GetSystemColor(ColorId color_id) const OVERRIDE; private: NativeThemeAndroid(); virtual ~NativeThemeAndroid(); DISALLOW_COPY_AND_ASSIGN(NativeThemeAndroid); }; } #endif
//---------------------------------------------------------------------------------------- // // This file and all other Easy Bridge source files are copyright (C) 2002 by Steven Han. // Use of this file is governed by the GNU General Public License. // See the files COPYING and COPYRIGHT for details. // //---------------------------------------------------------------------------------------- // #if !defined(AFX_PROGRAMCONFIGWIZARD_H__89D86431_D747_11D2_9096_00609777FAF1__INCLUDED_) #define AFX_PROGRAMCONFIGWIZARD_H__89D86431_D747_11D2_9096_00609777FAF1__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // // ProgramConfigWizard.h : header file // class CObjectWithProperties; class CProgConfigWizardData; class CProgConfigIntroPage; class CProgConfigHelpLevelPage; class CProgConfigViewSettingsPage; class CProgConfigSuitsDisplayPage; class CProgConfigGameMechanicsPage; class CProgConfigPausesPage; class CProgConfigBiddingPage; class CProgConfigFinishPage; ///////////////////////////////////////////////////////////////////////////// // CProgramConfigWizard class AFX_EXT_CLASS CProgramConfigWizard : public CPropertySheet { DECLARE_DYNAMIC(CProgramConfigWizard) // Operations public: CProgConfigWizardData& GetData() { return *m_pData; } void InitOptions(BOOL bFirstTime=TRUE); void SaveOptions(); void OnHelp(); // Data public: private: CProgConfigWizardData* m_pData; // CObjectWithProperties& m_app; CObjectWithProperties& m_doc; CObjectWithProperties& m_frame; CObjectWithProperties& m_view; CObjectWithProperties& m_conventionSet; // CProgConfigIntroPage* m_pIntroPage; CProgConfigHelpLevelPage* m_pHelpLevelPage; CProgConfigViewSettingsPage* m_pViewPage; CProgConfigSuitsDisplayPage* m_pSuitsPage; CProgConfigGameMechanicsPage* m_pMechanicsPage; CProgConfigPausesPage* m_pPausesPage; CProgConfigBiddingPage* m_pBiddingPage; CProgConfigFinishPage* m_pFinishPage; // Construction public: CProgramConfigWizard(CObjectWithProperties* pApp, CObjectWithProperties* pDoc, CObjectWithProperties* pFrame, CObjectWithProperties* pView, CObjectWithProperties* pConventionSet, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CProgramConfigWizard) //}}AFX_VIRTUAL // Implementation public: virtual ~CProgramConfigWizard(); // Generated message map functions protected: //{{AFX_MSG(CProgramConfigWizard) afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_PROGRAMCONFIGWIZARD_H__89D86431_D747_11D2_9096_00609777FAF1__INCLUDED_)
#ifndef __E_ERROR__ #define __E_ERROR__ #include <string> #include <map> #include <new> #include <libsig_comp.h> // to use memleak check change the following in configure.ac // * add -DMEMLEAK_CHECK and -rdynamic to CPP_FLAGS #ifdef MEMLEAK_CHECK #define BACKTRACE_DEPTH 5 #include <map> #include <lib/base/elock.h> #include <execinfo.h> #include <string> #include <new> #include <cxxabi.h> typedef struct { unsigned int address; unsigned int size; const char *file; void *backtrace[BACKTRACE_DEPTH]; unsigned char btcount; unsigned short line; unsigned char type; } ALLOC_INFO; typedef std::map<unsigned int, ALLOC_INFO> AllocList; extern AllocList *allocList; extern pthread_mutex_t memLock; static inline void AddTrack(unsigned int addr, unsigned int asize, const char *fname, unsigned int lnum, unsigned int type) { ALLOC_INFO info; if(!allocList) allocList = new(AllocList); info.address = addr; info.file = fname; info.line = lnum; info.size = asize; info.type = type; info.btcount = 0; //backtrace( info.backtrace, BACKTRACE_DEPTH ); singleLock s(memLock); (*allocList)[addr]=info; }; static inline void RemoveTrack(unsigned int addr, unsigned int type) { if(!allocList) return; AllocList::iterator i; singleLock s(memLock); i = allocList->find(addr); if ( i != allocList->end() ) { if ( i->second.type != type ) i->second.type=3; else allocList->erase(i); } }; inline void * operator new(size_t size, const char *file, int line) { void *ptr = (void *)malloc(size); AddTrack((unsigned int)ptr, size, file, line, 1); return(ptr); }; inline void operator delete(void *p) { RemoveTrack((unsigned int)p,1); free(p); }; inline void * operator new[](size_t size, const char *file, int line) { void *ptr = (void *)malloc(size); AddTrack((unsigned int)ptr, size, file, line, 2); return(ptr); }; inline void operator delete[](void *p) { RemoveTrack((unsigned int)p, 2); free(p); }; void DumpUnfreed(); #define new new(__FILE__, __LINE__) #endif // MEMLEAK_CHECK #ifndef NULL #define NULL 0 #endif #ifdef ASSERT #undef ASSERT #endif #ifndef SWIG #define CHECKFORMAT __attribute__ ((__format__(__printf__, 1, 2))) extern sigc::signal2<void, int, const std::string&> logOutput; extern int logOutputConsole; extern int logOutputColors; void _eFatal(const char *file, int line, const char *function, const char* fmt, ...); #define eFatal(args ...) _eFatal(__FILE__, __LINE__, __FUNCTION__, args) enum { lvlDebug=1, lvlWarning=2, lvlFatal=4 }; #ifdef DEBUG void _eDebug(const char *file, int line, const char *function, const char* fmt, ...); #define eDebug(args ...) _eDebug(__FILE__, __LINE__, __FUNCTION__, args) #define eLog(level, args ...) _eDebug(__FILE__, __LINE__, __FUNCTION__, args) void _eDebugNoNewLineStart(const char *file, int line, const char *function, const char* fmt, ...); #define eDebugNoNewLineStart(args ...) _eDebugNoNewLineStart(__FILE__, __LINE__, __FUNCTION__, args) #define eLogNoNewLineStart(level, args ...) _eDebugNoNewLineStart(__FILE__, __LINE__, __FUNCTION__, args) void CHECKFORMAT eDebugNoNewLine(const char*, ...); #define eLogNoNewLine(level, args ...) eDebugNoNewLine(args) void CHECKFORMAT eDebugNoNewLineEnd(const char*, ...); void eDebugEOL(void); void _eWarning(const char *file, int line, const char *function, const char* fmt, ...); #define eWarning(args ...) _eWarning(__FILE__, __LINE__, __FUNCTION__, args) #define ASSERT(x) { if (!(x)) eFatal("%s:%d ASSERTION %s FAILED!", __FILE__, __LINE__, #x); } #else // DEBUG inline void eDebug(const char* fmt, ...) { } inline void eDebugNoNewLineStart(const char* fmt, ...) { } inline void eDebugNoNewLine(const char* fmt, ...) { } inline void eWarning(const char* fmt, ...) { } inline void eLog(int level, const char* fmt, ...) { } inline void eLogNoNewLineStart(int level, const char* fmt, ...) { } inline void eLogNoNewLine(int level, const char* fmt, ...) { } #define ASSERT(x) do { } while (0) #endif //DEBUG void eWriteCrashdump(); #endif // SWIG void ePythonOutput(const char *file, int line, const char *function, const char *string); #endif // __E_ERROR__
/* Emacs style mode select -*- C++ -*- *----------------------------------------------------------------------------- * * * PrBoom a Doom port merged with LxDoom and LSDLDoom * based on BOOM, a modified and improved DOOM engine * Copyright (C) 1999 by * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman * Copyright (C) 1999-2000 by * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze * * 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. * * DESCRIPTION: * DoomDef - basic defines for DOOM, e.g. Version, game mode * and skill level, and display parameters. * *----------------------------------------------------------------------------- */ #ifdef __GNUG__ #pragma implementation "doomdef.h" #endif #include "doomdef.h" // Location for any defines turned variables. // None. // proff 08/17/98: Changed for high-res int SCREENWIDTH=320; int SCREENHEIGHT=200;
#ifndef _PRINT_H #define _PRINT_H #include "types.h" void putch(char c); void printhex(u32 u); void putstr(const char *s); #endif /* _PRINT_H */
/* * TP-LINK TL-MR3020 board support * * Copyright (C) 2011 dongyuqi <729650915@qq.com> * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. */ #include <linux/gpio.h> #include <asm/mach-ath79/ath79.h> #include <asm/mach-ath79/ar71xx_regs.h> #include "dev-eth.h" #include "dev-gpio-buttons.h" #include "dev-leds-gpio.h" #include "dev-m25p80.h" #include "dev-usb.h" #include "dev-wmac.h" #include "machtypes.h" #include "eeprom.h" #define TL_MR3020_GPIO_LED_3G 27 #define TL_MR3020_GPIO_LED_WLAN 0 #define TL_MR3020_GPIO_LED_LAN 17 #define TL_MR3020_GPIO_LED_WPS 26 #define TL_MR3020_GPIO_BTN_WPS 11 #define TL_MR3020_GPIO_BTN_SW1 18 #define TL_MR3020_GPIO_BTN_SW2 20 #define TL_MR3020_GPIO_USB_POWER 8 #define TL_MR3020_KEYS_POLL_INTERVAL 20 /* msecs */ #define TL_MR3020_KEYS_DEBOUNCE_INTERVAL (3 * TL_MR3020_KEYS_POLL_INTERVAL) static const char *tl_mr3020_part_probes[] = { "tp-link", NULL, }; static struct flash_platform_data tl_mr3020_flash_data = { .part_probes = tl_mr3020_part_probes, }; static struct gpio_led tl_mr3020_leds_gpio[] __initdata = { { .name = "tp-link:green:3g", .gpio = TL_MR3020_GPIO_LED_3G, .active_low = 1, }, { .name = "tp-link:green:wlan", .gpio = TL_MR3020_GPIO_LED_WLAN, .active_low = 0, }, { .name = "tp-link:green:lan", .gpio = TL_MR3020_GPIO_LED_LAN, .active_low = 1, }, { .name = "tp-link:green:wps", .gpio = TL_MR3020_GPIO_LED_WPS, .active_low = 1, }, }; static struct gpio_keys_button tl_mr3020_gpio_keys[] __initdata = { { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, .debounce_interval = TL_MR3020_KEYS_DEBOUNCE_INTERVAL, .gpio = TL_MR3020_GPIO_BTN_WPS, .active_low = 0, }, { .desc = "sw1", .type = EV_KEY, .code = BTN_0, .debounce_interval = TL_MR3020_KEYS_DEBOUNCE_INTERVAL, .gpio = TL_MR3020_GPIO_BTN_SW1, .active_low = 0, }, { .desc = "sw2", .type = EV_KEY, .code = BTN_1, .debounce_interval = TL_MR3020_KEYS_DEBOUNCE_INTERVAL, .gpio = TL_MR3020_GPIO_BTN_SW2, .active_low = 0, } }; static void __init tl_mr3020_setup(void) { u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); u8 *ee = ath79_get_eeprom(); /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ ath79_setup_ar933x_phy4_switch(false, false); ath79_register_m25p80(&tl_mr3020_flash_data); ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr3020_leds_gpio), tl_mr3020_leds_gpio); ath79_register_gpio_keys_polled(-1, TL_MR3020_KEYS_POLL_INTERVAL, ARRAY_SIZE(tl_mr3020_gpio_keys), tl_mr3020_gpio_keys); gpio_request_one(TL_MR3020_GPIO_USB_POWER, GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, "USB power"); ath79_register_usb(); ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); ath79_register_mdio(0, 0x0); ath79_register_eth(0); ath79_register_wmac(ee, mac); } MIPS_MACHINE(ATH79_MACH_TL_MR3020, "TL-MR3020", "TP-LINK TL-MR3020", tl_mr3020_setup);
/* Copyright (C) 2015 Datto Inc. This file is part of dattobd. 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 "../../includes.h" static inline void dummy(void){ bio_endio(NULL); }
/* bot/botenemy.qc Copyright (C) 1997-1999 Robert 'Frog' Field */ // Converted from .qc on 05/02/2016 #ifdef BOT_SUPPORT #include "g_local.h" #include "fb_globals.h" // Removes the look object for the given player void ClearLookObject(gedict_t* player) { player->fb.look_object = NULL; } // Sets the look object for the player void LookEnemy(gedict_t* player, gedict_t* enemy) { player->fb.look_object = enemy; VectorCopy(enemy->s.v.origin, player->fb.predict_origin); self->fb.old_linked_marker = NULL; } // Called when a player inflicts damage on another void BotDamageInflictedEvent(gedict_t* attacker, gedict_t* targ) { targ->fb.last_hurt = g_globalvars.time; if (targ->isBot) { // in dmm4, there's a chance taking damage will reset move direction if (deathmatch >= 4 && g_random() < targ->fb.skill.wiggle_toggle && abs(targ->fb.wiggle_run_dir) > self->fb.skill.wiggle_run_limit / 2) { targ->fb.wiggle_run_dir = targ->fb.wiggle_run_dir < 0 ? 1 : -1; } // if object we're looking at has less firepower than us... if (targ->fb.look_object && targ->fb.look_object->fb.firepower < attacker->fb.firepower) { if (attacker != targ) { // look at the attacker targ->fb.look_object = attacker; VectorCopy(attacker->s.v.origin, targ->fb.predict_origin); if (! SameTeam(attacker, targ)) { if (targ->s.v.goalentity == targ->s.v.enemy) { targ->fb.goal_refresh_time = 0; } targ->fb.enemy_time = g_globalvars.time + 1; targ->s.v.enemy = NUM_FOR_EDICT(attacker); } else { targ->fb.enemy_time = g_globalvars.time + 2.5; } } } } } // Triggered whenever an entity makes a noise void BotsSoundMadeEvent(gedict_t* entity) { if (entity && entity->ct == ctPlayer) { gedict_t* plr; // Find all bots which has this entity as enemy for (plr = world; (plr = find_plr (plr)); ) { if (plr->isBot && !(plr->fb.state & NOTARGET_ENEMY)) { if (NUM_FOR_EDICT(entity) == plr->s.v.enemy && entity != plr->fb.look_object) { vec3_t temp; VectorSubtract(entity->s.v.origin, plr->s.v.origin, temp); // Did the bot hear it? if (VectorLength(temp) < 1000) { if (Visible_360 (plr, entity)) { // Look directly at the player plr->fb.look_object = entity; } else if (isDuel()) { if (entity->fb.touch_marker && Visible_360 (plr, entity->fb.touch_marker)) { plr->fb.look_object = entity->fb.touch_marker; } else { // TODO: Look at the closest possible point // (think of picking up mega on DM4, humans would look at mega exit) // (find route from noise -> player, look at last visible marker?) } } } } } } } } // FIXME: Globals (from_marker, to_marker, etc) // Evaluates a potential enemy (globals: path_normal) static void BestEnemy_apply(gedict_t* test_enemy, float* best_score, gedict_t** enemy_, float* predict_dist) { float enemy_score; path_normal = true; look_marker = SightFromMarkerFunction(from_marker, to_marker); if (look_marker != NULL) { ZoneMarker (from_marker, look_marker, path_normal, test_enemy->fb.canRocketJump); traveltime = SubZoneArrivalTime(zone_time, middle_marker, look_marker, test_enemy->fb.canRocketJump); enemy_score = traveltime + g_random(); } else { look_marker = SightMarker(from_marker, to_marker, 0, 0); enemy_score = look_traveltime + g_random(); } if (enemy_score < *best_score) { vec3_t marker_view; vec3_t to_marker_view; VectorAdd(look_marker->s.v.absmin, look_marker->s.v.view_ofs, marker_view); VectorAdd(to_marker->s.v.absmin, to_marker->s.v.view_ofs, to_marker_view); *best_score = enemy_score; *enemy_ = test_enemy; *predict_dist = VectorDistance(marker_view, to_marker_view); } } // Selects best enemy from all players. // Evaluates based on time from respective last-touched markers // FIXME: evaluates in either direction (ease vs risk? fix) qbool BotsPickBestEnemy(gedict_t* self) { float best_score = 1000000; gedict_t* enemy_ = NULL; float predict_dist = 600; gedict_t* test_enemy; int old_enemy = self->s.v.enemy; qbool team_game = isTeam(); for (test_enemy = world; (test_enemy = find_plr(test_enemy)); ) { if ((!team_game || ISLIVE(test_enemy)) && !SameTeam(self, test_enemy)) { from_marker = test_enemy->fb.touch_marker; if (from_marker) { to_marker = self->fb.touch_marker; BestEnemy_apply(test_enemy, &best_score, &enemy_, &predict_dist); to_marker = from_marker; from_marker = self->fb.touch_marker; BestEnemy_apply(test_enemy, &best_score, &enemy_, &predict_dist); } } } self->fb.enemy_time = g_globalvars.time + 1; self->s.v.enemy = (enemy_ == NULL ? 0 : NUM_FOR_EDICT(enemy_)); self->fb.enemy_dist = predict_dist; return self->s.v.enemy != old_enemy; } #endif
/* * This file is part of xrayutilities. * * xrayutilities 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/>. * * Copyright (C) 2013 Eugen Wintersberger <eugen.wintersberger@desy.de> * Copyright (C) 2013 Dominik Kriegner <dominik.kriegner@gmail.com> * ****************************************************************************** * * created: Jun 8, 2013 * author: Eugen Wintersberger */ #pragma once #include <stdlib.h> #include <stdio.h> #include "xrayutilities.h" /*! \brief find minimum Finds the minimum in an array. \param a input data \param n number of elements \return minimum value */ double get_min(double *a, unsigned int n); /*---------------------------------------------------------------------------*/ /*! \brief find maximum Finds the maximum value in an array. \param a input data \param n number of elements \return return maximum value */ double get_max(double *a, unsigned int n); /*---------------------------------------------------------------------------*/ /*! \brief set array values Set all elements of an array to the same values. \param a input array \param n number of points \param value the new element values */ void set_array(double *a, unsigned int n, double value); /*---------------------------------------------------------------------------*/ /*! \brief compute step width Computes the stepwidth of a grid. \param min minimum value \param max maximum value \param n number of steps \return step width */ double delta(double min, double max, unsigned int n); /*---------------------------------------------------------------------------*/ /*! \brief compute grid index */ unsigned int gindex(double x, double min, double d);
#include <linux/module.h> #include <linux/kernel.h> #include <linux/device.h> #include <linux/list.h> #include <linux/errno.h> #include <linux/delay.h> #include <linux/clk.h> #include <linux/io.h> #include <mach/common.h> #include <mach/clock.h> #include <mach/sram.h> #include "prm.h" #include "clock.h" #include <mach/sdrc.h> #include "sdrc.h" #define M_DDR 1 #define M_LOCK_CTRL (1 << 2) #define M_UNLOCK 0 #define M_LOCK 1 static struct memory_timings mem_timings; static u32 curr_perf_level = CORE_CLK_SRC_DPLL_X2; static u32 omap2xxx_sdrc_get_slow_dll_ctrl(void) { return mem_timings.slow_dll_ctrl; } static u32 omap2xxx_sdrc_get_fast_dll_ctrl(void) { return mem_timings.fast_dll_ctrl; } static u32 omap2xxx_sdrc_get_type(void) { return mem_timings.m_type; } u32 omap2xxx_sdrc_dll_is_unlocked(void) { u32 dll_state = sdrc_read_reg(SDRC_DLLA_CTRL); if ((dll_state & (1 << 2)) == (1 << 2)) return 1; else return 0; } u32 omap2xxx_sdrc_reprogram(u32 level, u32 force) { u32 dll_ctrl, m_type; u32 prev = curr_perf_level; unsigned long flags; if ((curr_perf_level == level) && !force) return prev; if (level == CORE_CLK_SRC_DPLL) dll_ctrl = omap2xxx_sdrc_get_slow_dll_ctrl(); else if (level == CORE_CLK_SRC_DPLL_X2) dll_ctrl = omap2xxx_sdrc_get_fast_dll_ctrl(); else return prev; m_type = omap2xxx_sdrc_get_type(); local_irq_save(flags); if (cpu_is_omap2420()) __raw_writel(0xffff, OMAP2420_PRCM_VOLTSETUP); else __raw_writel(0xffff, OMAP2430_PRCM_VOLTSETUP); omap2_sram_reprogram_sdrc(level, dll_ctrl, m_type); curr_perf_level = level; local_irq_restore(flags); return prev; } void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode) { unsigned long dll_cnt; u32 fast_dll = 0; mem_timings.m_type = !((sdrc_read_reg(SDRC_MR_0) & 0x3) == 0x1); if (cpu_is_omap2422()) mem_timings.base_cs = 1; else mem_timings.base_cs = 0; if (mem_timings.m_type != M_DDR) return; if (((mem_timings.fast_dll_ctrl & (1 << 2)) == M_LOCK_CTRL)) mem_timings.dll_mode = M_UNLOCK; else mem_timings.dll_mode = M_LOCK; if (mem_timings.base_cs == 0) { fast_dll = sdrc_read_reg(SDRC_DLLA_CTRL); dll_cnt = sdrc_read_reg(SDRC_DLLA_STATUS) & 0xff00; } else { fast_dll = sdrc_read_reg(SDRC_DLLB_CTRL); dll_cnt = sdrc_read_reg(SDRC_DLLB_STATUS) & 0xff00; } if (force_lock_to_unlock_mode) { fast_dll &= ~0xff00; fast_dll |= dll_cnt; } mem_timings.fast_dll_ctrl = (fast_dll | (3 << 8)); omap2_sram_ddr_init(&mem_timings.slow_dll_ctrl, mem_timings.fast_dll_ctrl, mem_timings.base_cs, force_lock_to_unlock_mode); mem_timings.slow_dll_ctrl &= 0xff00; mem_timings.slow_dll_ctrl |= ((mem_timings.fast_dll_ctrl & 0xF) | (1 << 2)); mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8)); }
/* ---------------------------------------------------------------------- LIGGGHTS - LAMMPS Improved for General Granular and Granular Heat Transfer Simulations www.liggghts.com | www.cfdem.com Christoph Kloss, christoph.kloss@cfdem.com LIGGGHTS is based on LAMMPS LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #ifdef FIX_CLASS FixStyle(pour/dev,FixPourDev) #else #ifndef LMP_FIX_POUR_DEV_H #define LMP_FIX_POUR_DEV_H #include "fix.h" enum{RAN_STYLE_CONSTANT_FP,RAN_STYLE_UNIFORM_FP,RAN_STYLE_GAUSSIAN_FP}; namespace LAMMPS_NS { class FixPourDev : public Fix { friend class PairGranHertzHistory; friend class PairGranHooke; friend class PairGranHookeHistory; friend class FixPourMultiSphere; friend class MechParamGran; public: FixPourDev(class LAMMPS *, int, char **); ~FixPourDev(); int setmask(); virtual void init(); void pre_exchange(); void reset_dt(); void write_restart(FILE *); void restart(char *); virtual double max_rad(int); protected: class FixParticledistributionDiscrete *fpdd; int ninsert; int nfinal; int nBody; int seed; int ntype_max; int ntype_min; int check_ol_flag; double masstotal; double massflowrate,mass_ins; double volfrac; int maxattempt; int region_style; int vel_rand_style; double rate; double vxlo,vxhi,vylo,vyhi,vy,vz; double xlo,xhi,ylo,yhi,zlo,zhi; double xc,yc,rc; double grav; int iarg; int me,nprocs; int *recvcounts,*displs; double PI; int nfreq,nfirst,ninserted; double nper; double lo_current,hi_current; class FixShearHistory *fix_history; class RanPark *random; //region exempts, int nRegEx; class Region **regExList; int isInExemptRegion(double *); int overlap(int); void xyz_random(double, double *); double rand_pour(double, double, int); virtual int insert_in_xnear(double **xnear,int nnear,double *coord); virtual bool overlaps_xnear_i(double *coord,double **xnear,int i); virtual int particles_per_insertion(); virtual void random_insert_height(double &,double &,double); virtual void calc_insert_velocities(int,double**,double &,double &,double &); virtual double shift_randompos(); virtual bool give_mol_id(); virtual void init_substyle(){} virtual void set_body_props(bool,int, double,double,double,int){} virtual void finalize_insertion(){} }; } #endif #endif
#ifndef __TCS_UTIL__ #define __TCS_UTIL__ // sensors #include <OneWire.h> #include <DallasTemperature.h> // watchdog timer for reset #include <avr/io.h> #include <avr/wdt.h> // my moduels #include "Config.h" // sensors #include "OneWire.h" #include "DallasTemperature.h" typedef struct sensData { OneWire* oneWire_bus1; OneWire* oneWire_bus2; DallasTemperature* sensors_bus1; DallasTemperature* sensors_bus2; //~ DeviceAddress addresses_bus1[3] = { DEVADRR_BUS1_NO0, DEVADRR_BUS1_NO1, DEVADRR_BUS1_NO2 }; //~ DeviceAddress addresses_bus2[3] = { DEVADRR_BUS2_NO0, DEVADRR_BUS2_NO1, DEVADRR_BUS2_NO2 }; } sensData; typedef struct systemState { float actualTemp[ROOMS_NUMBER]; float desiredTemp[ROOMS_NUMBER]; int automaticMode; int radiatorState[ROOMS_NUMBER]; int zoneValve[ZONE_VALVE_NUMBER]; } systemState; #define RESET() do{wdt_enable(WDTO_30MS); while(1) {};}while(0); int radiatorPinByRoom(int room); void printAddress(DeviceAddress deviceAddress); void ttoa(char *a, double f); // converts float to string, side-effect #define OFF 0 #define ON 1 //#define DEBUG #endif
/* * (C) 2007-2010 Alibaba Group Holding Limited. * * 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. * * * Version: $Id: meta_server_service.h 49 2011-08-08 09:58:57Z nayan@taobao.com $ * * Authors: * qixiao <qixiao.zs@alibaba-inc.com> * - initial release * */ #ifndef TFS_LIFECYCLE_ROOTMANAGER_EXPROOTSERVER_HANDLE_TASK_HELPER_H_ #define TFS_LIFECYCLE_ROOTMANAGER_EXPROOTSERVER_HANDLE_TASK_HELPER_H_ #include <set> #include "common/parameter.h" #include "common/base_service.h" #include "common/status_message.h" #include "common/expire_define.h" #include "message/message_factory.h" #include "exp_server_manager.h" namespace tfs { namespace exprootserver { class HandleTaskHelper { public: HandleTaskHelper(ExpServerManager &manager); virtual ~HandleTaskHelper(); int init(); int destroy(); int handle_finish_task(const uint64_t es_id, const common::ExpireTaskInfo&); int handle_fail_servers(const common::VUINT64 &down_servers); int query_task(const uint64_t es_id, std::vector<common::ServerExpireTask>* p_running_tasks); int assign(const uint64_t es_id, const common::ExpireTaskInfo &del_task); void assign_task(void); protected: int32_t lifecycle_area_; private: class AssignTaskThreadHelper : public tbutil::Thread { public: explicit AssignTaskThreadHelper(HandleTaskHelper &handle_task_helper) :handle_task_helper_(handle_task_helper){start();} virtual ~AssignTaskThreadHelper(){} void run(); private: HandleTaskHelper &handle_task_helper_; DISALLOW_COPY_AND_ASSIGN(AssignTaskThreadHelper); }; typedef tbutil::Handle<AssignTaskThreadHelper> AssignTaskThreadHelperPtr; private: AssignTaskThreadHelperPtr assign_task_thread_; tbutil::Mutex mutex_running_; tbutil::Mutex mutex_waitint_; std::map<uint64_t, std::set<common::ExpireTaskInfo> > m_s_running_tasks_; std::deque<common::ExpireTaskInfo> dq_waiting_tasks_; int32_t task_period_; int32_t note_interval_; private: bool destroy_; ExpServerManager &manager_; DISALLOW_COPY_AND_ASSIGN(HandleTaskHelper); }; } } #endif
/* * * Copyright (C) 2009 Gulessoft , Inc. * Written by Guo Hongruan (guo.hongruan@gulessoft.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _ASM_TRIMEDIA_ELF_H #define _ASM_TRIMEDIA_ELF_H #define ELF_CLASS ELFCLASS32 #endif /*_ASM_TRIMEDIA_ELF_H*/
/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. */ #ifndef _SYS_DSL_DIR_H #define _SYS_DSL_DIR_H #include <sys/dmu.h> #include <sys/dsl_pool.h> #include <sys/dsl_synctask.h> #include <sys/refcount.h> #include <sys/zfs_context.h> #ifdef __cplusplus extern "C" { #endif struct dsl_dataset; typedef enum dd_used { DD_USED_HEAD, DD_USED_SNAP, DD_USED_CHILD, DD_USED_CHILD_RSRV, DD_USED_REFRSRV, DD_USED_NUM } dd_used_t; #define DD_FLAG_USED_BREAKDOWN (1<<0) typedef struct dsl_dir_phys { uint64_t dd_creation_time; /* not actually used */ uint64_t dd_head_dataset_obj; uint64_t dd_parent_obj; uint64_t dd_origin_obj; uint64_t dd_child_dir_zapobj; /* * how much space our children are accounting for; for leaf * datasets, == physical space used by fs + snaps */ uint64_t dd_used_bytes; uint64_t dd_compressed_bytes; uint64_t dd_uncompressed_bytes; /* Administrative quota setting */ uint64_t dd_quota; /* Administrative reservation setting */ uint64_t dd_reserved; uint64_t dd_props_zapobj; uint64_t dd_deleg_zapobj; /* dataset delegation permissions */ uint64_t dd_flags; uint64_t dd_used_breakdown[DD_USED_NUM]; uint64_t dd_clones; /* dsl_dir objects */ uint64_t dd_pad[13]; /* pad out to 256 bytes for good measure */ } dsl_dir_phys_t; struct dsl_dir { /* These are immutable; no lock needed: */ uint64_t dd_object; dsl_dir_phys_t *dd_phys; dmu_buf_t *dd_dbuf; dsl_pool_t *dd_pool; /* protected by lock on pool's dp_dirty_dirs list */ txg_node_t dd_dirty_link; /* protected by dp_config_rwlock */ dsl_dir_t *dd_parent; /* Protected by dd_lock */ kmutex_t dd_lock; list_t dd_prop_cbs; /* list of dsl_prop_cb_record_t's */ timestruc_t dd_snap_cmtime; /* last time snapshot namespace changed */ uint64_t dd_origin_txg; /* gross estimate of space used by in-flight tx's */ uint64_t dd_tempreserved[TXG_SIZE]; /* amount of space we expect to write; == amount of dirty data */ int64_t dd_space_towrite[TXG_SIZE]; /* protected by dd_lock; keep at end of struct for better locality */ char dd_myname[MAXNAMELEN]; }; void dsl_dir_rele(dsl_dir_t *dd, void *tag); int dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag, dsl_dir_t **, const char **tail); int dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj, const char *tail, void *tag, dsl_dir_t **); void dsl_dir_name(dsl_dir_t *dd, char *buf); int dsl_dir_namelen(dsl_dir_t *dd); uint64_t dsl_dir_create_sync(dsl_pool_t *dp, dsl_dir_t *pds, const char *name, dmu_tx_t *tx); void dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv); uint64_t dsl_dir_space_available(dsl_dir_t *dd, dsl_dir_t *ancestor, int64_t delta, int ondiskonly); void dsl_dir_dirty(dsl_dir_t *dd, dmu_tx_t *tx); void dsl_dir_sync(dsl_dir_t *dd, dmu_tx_t *tx); int dsl_dir_tempreserve_space(dsl_dir_t *dd, uint64_t mem, uint64_t asize, uint64_t fsize, uint64_t usize, void **tr_cookiep, dmu_tx_t *tx); void dsl_dir_tempreserve_clear(void *tr_cookie, dmu_tx_t *tx); void dsl_dir_willuse_space(dsl_dir_t *dd, int64_t space, dmu_tx_t *tx); void dsl_dir_diduse_space(dsl_dir_t *dd, dd_used_t type, int64_t used, int64_t compressed, int64_t uncompressed, dmu_tx_t *tx); void dsl_dir_transfer_space(dsl_dir_t *dd, int64_t delta, dd_used_t oldtype, dd_used_t newtype, dmu_tx_t *tx); int dsl_dir_set_quota(const char *ddname, zprop_source_t source, uint64_t quota); int dsl_dir_set_reservation(const char *ddname, zprop_source_t source, uint64_t reservation); int dsl_dir_rename(const char *oldname, const char *newname); int dsl_dir_transfer_possible(dsl_dir_t *sdd, dsl_dir_t *tdd, uint64_t space); boolean_t dsl_dir_is_clone(dsl_dir_t *dd); void dsl_dir_new_refreservation(dsl_dir_t *dd, struct dsl_dataset *ds, uint64_t reservation, cred_t *cr, dmu_tx_t *tx); void dsl_dir_snap_cmtime_update(dsl_dir_t *dd); timestruc_t dsl_dir_snap_cmtime(dsl_dir_t *dd); void dsl_dir_set_reservation_sync_impl(dsl_dir_t *dd, uint64_t value, dmu_tx_t *tx); /* internal reserved dir name */ #define MOS_DIR_NAME "$MOS" #define ORIGIN_DIR_NAME "$ORIGIN" #define XLATION_DIR_NAME "$XLATION" #define FREE_DIR_NAME "$FREE" #define LEAK_DIR_NAME "$LEAK" #ifdef ZFS_DEBUG #define dprintf_dd(dd, fmt, ...) do { \ if (zfs_flags & ZFS_DEBUG_DPRINTF) { \ char *__ds_name = kmem_alloc(MAXNAMELEN + strlen(MOS_DIR_NAME) + 1, \ KM_SLEEP); \ dsl_dir_name(dd, __ds_name); \ dprintf("dd=%s " fmt, __ds_name, __VA_ARGS__); \ kmem_free(__ds_name, MAXNAMELEN + strlen(MOS_DIR_NAME) + 1); \ } \ _NOTE(CONSTCOND) } while (0) #else #define dprintf_dd(dd, fmt, ...) #endif #ifdef __cplusplus } #endif #endif /* _SYS_DSL_DIR_H */
/************************************************************************* * MWA - A Multi word alignerc * Copyright (C) 2012-2014 S.Mohammad M. Ziabary <mehran.m@aut.ac.ir> * * 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. *************************************************************************/ /** @author S.Mohammad M. Ziabary <mehran.m@aut.ac.ir> */ #ifndef WORDNETSTEMMER_H #define WORDNETSTEMMER_H #ifdef USE_WN #include "Engine/intfExternalStemmer.hpp" class WordnetStemmer : public intfExternalStemmer { public: static inline WordnetStemmer* instance(){ return Instance ? Instance : (Instance = new WordnetStemmer); } QString getStem(const QString &_word, bool _reverseDir); private: void configure(const QString &_configArgs); private: WordnetStemmer():intfExternalStemmer("wn", "Wordnet"){} static WordnetStemmer* Instance; }; #else #include "NullDicAndStemmer.h" class WordnetStemmer : NullDicAndStemmer{ }; #endif // USE_WN #endif // WORDNETSTEMMER_H
/* * Private includes and definitions for userspace use of XZ Embedded * * Author: Lasse Collin <lasse.collin@tukaani.org> * * This file has been put into the public domain. * You can do whatever you want with this file. */ #ifndef XZ_CONFIG_H #define XZ_CONFIG_H /* Uncomment as needed to enable BCJ filter decoders. */ /* #define XZ_DEC_X86 */ /* #define XZ_DEC_POWERPC */ /* #define XZ_DEC_IA64 */ /* #define XZ_DEC_ARM */ /* #define XZ_DEC_ARMTHUMB */ /* #define XZ_DEC_SPARC */ #include <stdbool.h> #include <stdlib.h> #include <string.h> #include "xz.h" #define kmalloc(size, flags) malloc(size) #define kfree(ptr) free(ptr) #define vmalloc(size) malloc(size) #define vfree(ptr) free(ptr) #define memeq(a, b, size) (memcmp(a, b, size) == 0) #define memzero(buf, size) memset(buf, 0, size) #undef min #undef min_t #define min(x, y) ((x) < (y) ? (x) : (y)) #define min_t(type, x, y) min(x, y) /* * Some functions have been marked with __always_inline to keep the * performance reasonable even when the compiler is optimizing for * small code size. You may be able to save a few bytes by #defining * __always_inline to plain inline, but don't complain if the code * becomes slow. * * NOTE: System headers on GNU/Linux may #define this macro already, * so if you want to change it, you need to #undef it first. */ #ifdef __BIONIC__ #undef __always_inline #endif #ifndef __always_inline # ifdef __GNUC__ # define __always_inline \ inline __attribute__((__always_inline__)) # else # define __always_inline inline # endif #endif /* * Some functions are marked to never be inlined to reduce stack usage. * If you don't care about stack usage, you may want to modify this so * that noinline_for_stack is #defined to be empty even when using GCC. * Doing so may save a few bytes in binary size. */ #ifndef noinline_for_stack # ifdef __GNUC__ # define noinline_for_stack __attribute__((__noinline__)) # else # define noinline_for_stack # endif #endif /* Inline functions to access unaligned unsigned 32-bit integers */ #ifndef get_unaligned_le32 static inline uint32_t XZ_FUNC get_unaligned_le32(const uint8_t *buf) { return (uint32_t)buf[0] | ((uint32_t)buf[1] << 8) | ((uint32_t)buf[2] << 16) | ((uint32_t)buf[3] << 24); } #endif #ifndef get_unaligned_be32 static inline uint32_t XZ_FUNC get_unaligned_be32(const uint8_t *buf) { return (uint32_t)(buf[0] << 24) | ((uint32_t)buf[1] << 16) | ((uint32_t)buf[2] << 8) | (uint32_t)buf[3]; } #endif #ifndef put_unaligned_le32 static inline void XZ_FUNC put_unaligned_le32(uint32_t val, uint8_t *buf) { buf[0] = (uint8_t)val; buf[1] = (uint8_t)(val >> 8); buf[2] = (uint8_t)(val >> 16); buf[3] = (uint8_t)(val >> 24); } #endif #ifndef put_unaligned_be32 static inline void XZ_FUNC put_unaligned_be32(uint32_t val, uint8_t *buf) { buf[0] = (uint8_t)(val >> 24); buf[1] = (uint8_t)(val >> 16); buf[2] = (uint8_t)(val >> 8); buf[3] = (uint8_t)val; } #endif /* * Use get_unaligned_le32() also for aligned access for simplicity. On * little endian systems, #define get_le32(ptr) (*(const uint32_t *)(ptr)) * could save a few bytes in code size. */ #ifndef get_le32 # define get_le32 get_unaligned_le32 #endif #endif
/* * softing common interfaces * * by Kurt Van Dijck, 06-2008 */ #include <linux/interrupt.h> #include <linux/netdevice.h> #include <linux/ktime.h> #include <socketcan/can.h> #include <socketcan/can/dev.h> struct softing; struct sofing_desc; /* softing firmware directory prefix */ #define fw_dir "softing-4.6/" /* special attribute, so we should not rely on the ->priv pointers * before knowing how to interpret these */ struct softing_attribute; struct softing_priv { struct can_priv can; /* must be the first member! */ struct net_device *netdev; struct softing *card; struct { int pending; /* variables wich hold the circular buffer */ int echo_put; int echo_get; } tx; struct can_bittiming_const btr_const; int index; u8 output; u16 chip; struct attribute_group sysfs; }; #define netdev2softing(netdev) ((struct softing_priv *)netdev_priv(netdev)) struct softing_desc { unsigned int manf; unsigned int prod; /* generation * 1st with NEC or SJA1000 * 8bit, exclusive interrupt, ... * 2nd only SJA11000 * 16bit, shared interrupt */ int generation; unsigned int freq; /*crystal in MHz */ unsigned int max_brp; unsigned int max_sjw; unsigned long dpram_size; char name[32]; struct { unsigned long offs; unsigned long addr; char fw[32]; } boot, load, app; }; struct softing { int nbus; struct softing_priv *bus[2]; spinlock_t spin; /* protect this structure & DPRAM access */ ktime_t ts_ref; ktime_t ts_overflow; /* timestamp overflow value, in ktime */ struct { /* indication of firmware status */ int up; int failed; /* firmware has failed */ /* protection of the 'up' variable */ struct mutex lock; } fw; struct { int nr; int requested; struct tasklet_struct bh; int svc_count; } irq; struct { int pending; int last_bus; /* keep the bus that last tx'd a message, * in order to let every netdev queue resume */ } tx; struct { unsigned long phys; unsigned long size; unsigned char *virt; unsigned char *end; struct softing_fct *fct; struct softing_info *info; struct softing_rx *rx; struct softing_tx *tx; struct softing_irq *irq; unsigned short *command; unsigned short *receipt; } dpram; struct { unsigned short manf; unsigned short prod; u32 serial, fw, hw, lic; u16 chip[2]; u32 freq; const char *name; } id; const struct softing_desc *desc; struct { int (*reset) (struct softing *, int); int (*enable_irq)(struct softing *, int); } fn; struct device *dev; /* sysfs */ struct attribute_group sysfs; struct softing_attribute *attr; struct attribute **grp; }; extern int mk_softing(struct softing *); /* fields that must be set already are : * ncan * id.manf * id.prod * fn.reset * fn.enable_irq */ extern void rm_softing(struct softing *); /* usefull functions during operation */ extern int softing_default_output(struct softing *card , struct softing_priv *priv); extern ktime_t softing_raw2ktime(struct softing *card, u32 raw); extern int softing_fct_cmd(struct softing *card , int cmd, int vector, const char *msg); extern int softing_bootloader_command(struct softing *card , int command, const char *msg); /* Load firmware after reset */ extern int softing_load_fw(const char *file, struct softing *card, unsigned char *virt, unsigned int size, int offset); /* Load final application firmware after bootloader */ extern int softing_load_app_fw(const char *file, struct softing *card); extern int softing_reset_chip(struct softing *card); /* enable or disable irq * only called with fw.lock locked */ extern int softing_card_irq(struct softing *card, int enable); /* start/stop 1 bus on cardr*/ extern int softing_cycle( struct softing *card, struct softing_priv *priv, int up); /* netif_rx() */ extern int softing_rx(struct net_device *netdev, const struct can_frame *msg, ktime_t ktime); /* create/remove the per-card associated sysfs entries */ extern int softing_card_sysfs_create(struct softing *card); extern void softing_card_sysfs_remove(struct softing *card); /* create/remove the per-bus associated sysfs entries */ extern int softing_bus_sysfs_create(struct softing_priv *bus); extern void softing_bus_sysfs_remove(struct softing_priv *bus); /* SOFTING DPRAM mappings */ struct softing_rx { u8 fifo[16][32]; u8 dummy1; u16 rd; u16 dummy2; u16 wr; u16 dummy3; u16 lost_msg; } __attribute__((packed)); #define TXMAX 31 struct softing_tx { u8 fifo[32][16]; u8 dummy1; u16 rd; u16 dummy2; u16 wr; u8 dummy3; } __attribute__((packed)); struct softing_irq { u8 to_host; u8 to_card; } __attribute__((packed)); struct softing_fct { s16 param[20]; /* 0 is index */ s16 returned; u8 dummy; u16 host_access; } __attribute__((packed)); struct softing_info { u8 dummy1; u16 bus_state; u16 dummy2; u16 bus_state2; u16 dummy3; u16 error_state; u16 dummy4; u16 error_state2; u16 dummy5; u16 reset; u16 dummy6; u16 clear_rcv_fifo; u16 dummy7; u16 dummyxx; u16 dummy8; u16 time_reset; u8 dummy9; u32 time; u32 time_wrap; u8 wr_start; u8 wr_end; u8 dummy10; u16 dummy12; u16 dummy12x; u16 dummy13; u16 reset_rcv_fifo; u8 dummy14; u8 reset_xmt_fifo; u8 read_fifo_levels; u16 rcv_fifo_level; u16 xmt_fifo_level; } __attribute__((packed)); /* DPRAM return codes */ #define RES_NONE 0 #define RES_OK 1 #define RES_NOK 2 #define RES_UNKNOWN 3 /* DPRAM flags */ #define CMD_TX 0x01 #define CMD_ACK 0x02 #define CMD_XTD 0x04 #define CMD_RTR 0x08 #define CMD_ERR 0x10 #define CMD_BUS2 0x80 /* debug */ extern int softing_debug;
#include "lcd.h" #include "glib.h" #include "buttons.h" #include "s_clock_set.h" #include "s_setup.h" #include "xprintf.h" #include "stm32f4xx_rtc.h" gl_lay_elem root_e, clock, hours, minutes; gl_scr_settings * l_settings; RTC_TimeTypeDef m_time; int digit = 0; void create(gl_scr_settings * settings); void destroy(void); int event(uint32_t event, gl_scr_events * events); gl_screen s_clock_set = { (p_gl_lay_elem)&root_e, create, destroy, event }; void root_draw(void) { lcd_area(24, 0, 9, 54, BLUE); lcd_string("CLOCK SET", 25, 1, 1, WHITE, BLUE); } void clock_draw(void) { lcd_string(":", 20 + 2 * 6 * 2, 25, 2, WHITE, BLACK); } void twice_draw(int number, int x_pos, int begin_index, int *digit) { int i, num; int16_t font, back; for (i = 0; i < 2; i++) { if (!i) num = number / 10; else num = number % 10; if (*digit == i + begin_index) { font = BLACK; back = WHITE; } else { font = WHITE; back = BLACK; } lcd_area(x_pos + 1 + i * 6 * 2, 24, 17, 12, back); lcd_char('0' + num, x_pos + i * 6 * 2, 25, 2, font, back); } } void change_digit(int8_t *dig, int8_t diff, int8_t lim) { if (diff == 1) { if (*dig >= lim) *dig = 0; else (*dig)++; } else { if (*dig <= 0) *dig = lim; else (*dig)--; } } void change_number(int8_t diff) { int8_t dig; switch(digit) { case 0: dig = m_time.RTC_Hours / 10; m_time.RTC_Hours -= dig * 10; change_digit(&dig, diff, 2); m_time.RTC_Hours += dig * 10; break; case 1: dig = m_time.RTC_Hours % 10; m_time.RTC_Hours -= dig; change_digit(&dig, diff, 9); m_time.RTC_Hours += dig; break; case 2: dig = m_time.RTC_Minutes / 10; m_time.RTC_Minutes -= dig * 10; change_digit(&dig, diff, 5); m_time.RTC_Minutes += dig * 10; break; case 3: dig = m_time.RTC_Minutes % 10; m_time.RTC_Minutes -= dig; change_digit(&dig, diff, 9); m_time.RTC_Minutes += dig; break; } if (m_time.RTC_Hours > 23) m_time.RTC_Hours = 23; } void hours_draw(void) { twice_draw(m_time.RTC_Hours, 20, 0, &digit); } void minutes_draw(void) { twice_draw(m_time.RTC_Minutes, 20 + 3 * 6 * 2, 2, &digit); } void create(gl_scr_settings * settings) { l_settings = settings; root_e.draw = root_draw; root_e.child = (p_gl_lay_elem)&clock; root_e.next = 0; clock.draw = clock_draw; clock.child = (p_gl_lay_elem)&hours; clock.next = 0; hours.draw = hours_draw; hours.child = 0; hours.next = (p_gl_lay_elem)&minutes; minutes.draw = minutes_draw; minutes.child = 0; minutes.next = 0; RTC_GetTime(RTC_Format_BIN, &m_time); gl_lay_drawing(&root_e); } void destroy(void) { lcd_clear(BLACK); } int event(uint32_t event, gl_scr_events * events) { int ret = R_OK; switch (event) { case E_BUTTONS: switch(events->buttons) { case E_B_SET: m_time.RTC_Seconds = 0; RTC_SetTime(RTC_Format_BIN, &m_time); l_settings->prev = &s_setup; ret = R_RETURN; break; case E_B_SU: if (digit >= 3) digit = 0; else digit++; gl_lay_drawing_once(&clock); break; case E_B_UP: change_number(1); gl_lay_drawing_once(&clock); break; case E_B_DWN: change_number(-1); gl_lay_drawing_once(&clock); break; } break; } return ret; }
/* * e750-wm9705.c -- SoC audio for e750 * * Copyright 2007 (c) Ian Molton <spyro@f2s.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; version 2 ONLY. * */ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/gpio.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> #include <mach-pxa/audio.h> #include <mach-pxa/eseries-gpio.h> #include <asm/mach-types.h> #include "../codecs/wm9705.h" #include "pxa2xx-ac97.h" static int e750_spk_amp_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { if (event & SND_SOC_DAPM_PRE_PMU) gpio_set_value(GPIO_E750_SPK_AMP_OFF, 0); else if (event & SND_SOC_DAPM_POST_PMD) gpio_set_value(GPIO_E750_SPK_AMP_OFF, 1); return 0; } static int e750_hp_amp_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { if (event & SND_SOC_DAPM_PRE_PMU) gpio_set_value(GPIO_E750_HP_AMP_OFF, 0); else if (event & SND_SOC_DAPM_POST_PMD) gpio_set_value(GPIO_E750_HP_AMP_OFF, 1); return 0; } static const struct snd_soc_dapm_widget e750_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_SPK("Speaker", NULL), SND_SOC_DAPM_MIC("Mic (Internal)", NULL), SND_SOC_DAPM_PGA_E("Headphone Amp", SND_SOC_NOPM, 0, 0, NULL, 0, e750_hp_amp_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_PGA_E("Speaker Amp", SND_SOC_NOPM, 0, 0, NULL, 0, e750_spk_amp_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), }; static const struct snd_soc_dapm_route audio_map[] = { {"Headphone Amp", NULL, "HPOUTL"}, {"Headphone Amp", NULL, "HPOUTR"}, {"Headphone Jack", NULL, "Headphone Amp"}, {"Speaker Amp", NULL, "MONOOUT"}, {"Speaker", NULL, "Speaker Amp"}, {"MIC1", NULL, "Mic (Internal)"}, }; static int e750_ac97_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; snd_soc_dapm_nc_pin(dapm, "LOUT"); snd_soc_dapm_nc_pin(dapm, "ROUT"); snd_soc_dapm_nc_pin(dapm, "PHONE"); snd_soc_dapm_nc_pin(dapm, "LINEINL"); snd_soc_dapm_nc_pin(dapm, "LINEINR"); snd_soc_dapm_nc_pin(dapm, "CDINL"); snd_soc_dapm_nc_pin(dapm, "CDINR"); snd_soc_dapm_nc_pin(dapm, "PCBEEP"); snd_soc_dapm_nc_pin(dapm, "MIC2"); snd_soc_dapm_new_controls(dapm, e750_dapm_widgets, ARRAY_SIZE(e750_dapm_widgets)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); return 0; } static struct snd_soc_dai_link e750_dai[] = { { .name = "AC97", .stream_name = "AC97 HiFi", .cpu_dai_name = "pxa2xx-ac97", .codec_dai_name = "wm9705-hifi", .platform_name = "pxa-pcm-audio", .codec_name = "wm9705-codec", .init = e750_ac97_init, /* use ops to check startup state */ }, { .name = "AC97 Aux", .stream_name = "AC97 Aux", .cpu_dai_name = "pxa2xx-ac97-aux", .codec_dai_name ="wm9705-aux", .platform_name = "pxa-pcm-audio", .codec_name = "wm9705-codec", }, }; static struct snd_soc_card e750 = { .name = "Toshiba e750", .owner = THIS_MODULE, .dai_link = e750_dai, .num_links = ARRAY_SIZE(e750_dai), }; static struct gpio e750_audio_gpios[] = { { GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Headphone amp" }, { GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" }, }; static int __devinit e750_probe(struct platform_device *pdev) { struct snd_soc_card *card = &e750; int ret; ret = gpio_request_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios)); if (ret) return ret; card->dev = &pdev->dev; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios)); } return ret; } static int __devexit e750_remove(struct platform_device *pdev) { struct snd_soc_card *card = platform_get_drvdata(pdev); gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios)); snd_soc_unregister_card(card); return 0; } static struct platform_driver e750_driver = { .driver = { .name = "e750-audio", .owner = THIS_MODULE, }, .probe = e750_probe, .remove = __devexit_p(e750_remove), }; module_platform_driver(e750_driver); /* Module information */ MODULE_AUTHOR("Ian Molton <spyro@f2s.com>"); MODULE_DESCRIPTION("ALSA SoC driver for e750"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:e750-audio");
#include "msm_fb.h" static int __init lcdc_wxga_init(void) { int ret; struct msm_panel_info pinfo; #ifdef CONFIG_FB_MSM_MDDI_AUTO_DETECT if (msm_fb_detect_client("lcdc_wxga")) return 0; #endif pinfo.xres = 1280; pinfo.yres = 720; pinfo.type = LCDC_PANEL; pinfo.pdest = DISPLAY_1; pinfo.wait_cycle = 0; pinfo.bpp = 24; pinfo.fb_num = 2; pinfo.clk_rate = 74250000; pinfo.lcdc.h_back_porch = 124; pinfo.lcdc.h_front_porch = 110; pinfo.lcdc.h_pulse_width = 136; pinfo.lcdc.v_back_porch = 19; pinfo.lcdc.v_front_porch = 5; pinfo.lcdc.v_pulse_width = 6; pinfo.lcdc.border_clr = 0; pinfo.lcdc.underflow_clr = 0xff; pinfo.lcdc.hsync_skew = 0; ret = lcdc_device_register(&pinfo); if (ret) printk(KERN_ERR "%s: failed to register device!\n", __func__); return ret; } module_init(lcdc_wxga_init);
#ifndef LOGGER_H #define LOGGER_H #include <set> #define LOGGER_BUFSIZE 1024*256 class Logger{ public: Logger(const char* filename, bool add = false); ~Logger(); void Flush(); void Write(const char* str, int len); void WriteString(const char* str); void Register(); static void FlushAll(); private: static std::set<Logger*> pointer_set; char fname[256]; char buf[LOGGER_BUFSIZE]; int current; }; #endif
/* * This is a module which is used for rejecting packets. */ /* (C) 1999-2001 Paul `Rusty' Russell * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org> * Copyright (C) 2015 Foxconn International Holdings, 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. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/module.h> #include <linux/skbuff.h> #include <linux/slab.h> #include <linux/ip.h> #include <linux/udp.h> #include <linux/icmp.h> #include <net/icmp.h> #include <net/ip.h> #include <net/tcp.h> #include <net/route.h> #include <net/dst.h> #include <linux/netfilter/x_tables.h> #include <linux/netfilter_ipv4/ip_tables.h> #include <linux/netfilter_ipv4/ipt_REJECT.h> #ifdef CONFIG_BRIDGE_NETFILTER #include <linux/netfilter_bridge.h> #endif MODULE_LICENSE("GPL"); MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>"); MODULE_DESCRIPTION("Xtables: packet \"rejection\" target for IPv4"); /* Send RST reply */ static void send_reset(struct sk_buff *oldskb, int hook) { struct sk_buff *nskb; const struct iphdr *oiph; struct iphdr *niph; const struct tcphdr *oth; struct tcphdr _otcph, *tcph; /* IP header checks: fragment. */ if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET)) return; oth = skb_header_pointer(oldskb, ip_hdrlen(oldskb), sizeof(_otcph), &_otcph); if (oth == NULL) return; /* No RST for RST. */ if (oth->rst) return; if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) return; /* Check checksum */ if (nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), IPPROTO_TCP)) return; oiph = ip_hdr(oldskb); nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct tcphdr) + LL_MAX_HEADER, GFP_ATOMIC); if (!nskb) return; skb_reserve(nskb, LL_MAX_HEADER); skb_reset_network_header(nskb); niph = (struct iphdr *)skb_put(nskb, sizeof(struct iphdr)); niph->version = 4; niph->ihl = sizeof(struct iphdr) / 4; niph->tos = 0; niph->id = 0; niph->frag_off = htons(IP_DF); niph->protocol = IPPROTO_TCP; niph->check = 0; niph->saddr = oiph->daddr; niph->daddr = oiph->saddr; skb_reset_transport_header(nskb); tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); memset(tcph, 0, sizeof(*tcph)); tcph->source = oth->dest; tcph->dest = oth->source; tcph->doff = sizeof(struct tcphdr) / 4; if (oth->ack) tcph->seq = oth->ack_seq; else { tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn + oth->fin + oldskb->len - ip_hdrlen(oldskb) - (oth->doff << 2)); tcph->ack = 1; } tcph->rst = 1; tcph->check = ~tcp_v4_check(sizeof(struct tcphdr), niph->saddr, niph->daddr, 0); nskb->ip_summed = CHECKSUM_PARTIAL; nskb->csum_start = (unsigned char *)tcph - nskb->head; nskb->csum_offset = offsetof(struct tcphdr, check); /* ip_route_me_harder expects skb->dst to be set */ skb_dst_set_noref(nskb, skb_dst(oldskb)); nskb->protocol = htons(ETH_P_IP); if (ip_route_me_harder(nskb, RTN_UNSPEC)) goto free_nskb; niph = (struct iphdr *)skb_network_header(nskb); //CONN-EC-NET-MemoryCorruption-01+ niph->ttl = ip4_dst_hoplimit(skb_dst(nskb)); /* "Never happens" */ if (nskb->len > dst_mtu(skb_dst(nskb))) goto free_nskb; nf_ct_attach(nskb, oldskb); ip_local_out(nskb); return; free_nskb: kfree_skb(nskb); } static inline void send_unreach(struct sk_buff *skb_in, int code) { icmp_send(skb_in, ICMP_DEST_UNREACH, code, 0); #ifdef CONFIG_IP_NF_TARGET_REJECT_SKERR if (skb_in->sk) { skb_in->sk->sk_err = icmp_err_convert[code].errno; skb_in->sk->sk_error_report(skb_in->sk); pr_debug("ipt_REJECT: sk_err=%d for skb=%p sk=%p\n", skb_in->sk->sk_err, skb_in, skb_in->sk); } #endif } static unsigned int reject_tg(struct sk_buff *skb, const struct xt_action_param *par) { const struct ipt_reject_info *reject = par->targinfo; switch (reject->with) { case IPT_ICMP_NET_UNREACHABLE: send_unreach(skb, ICMP_NET_UNREACH); break; case IPT_ICMP_HOST_UNREACHABLE: send_unreach(skb, ICMP_HOST_UNREACH); break; case IPT_ICMP_PROT_UNREACHABLE: send_unreach(skb, ICMP_PROT_UNREACH); break; case IPT_ICMP_PORT_UNREACHABLE: send_unreach(skb, ICMP_PORT_UNREACH); break; case IPT_ICMP_NET_PROHIBITED: send_unreach(skb, ICMP_NET_ANO); break; case IPT_ICMP_HOST_PROHIBITED: send_unreach(skb, ICMP_HOST_ANO); break; case IPT_ICMP_ADMIN_PROHIBITED: send_unreach(skb, ICMP_PKT_FILTERED); break; case IPT_TCP_RESET: send_reset(skb, par->hooknum); case IPT_ICMP_ECHOREPLY: /* Doesn't happen. */ break; } return NF_DROP; } static int reject_tg_check(const struct xt_tgchk_param *par) { const struct ipt_reject_info *rejinfo = par->targinfo; const struct ipt_entry *e = par->entryinfo; if (rejinfo->with == IPT_ICMP_ECHOREPLY) { pr_info("ECHOREPLY no longer supported.\n"); return -EINVAL; } else if (rejinfo->with == IPT_TCP_RESET) { /* Must specify that it's a TCP packet */ if (e->ip.proto != IPPROTO_TCP || (e->ip.invflags & XT_INV_PROTO)) { pr_info("TCP_RESET invalid for non-tcp\n"); return -EINVAL; } } return 0; } static struct xt_target reject_tg_reg __read_mostly = { .name = "REJECT", .family = NFPROTO_IPV4, .target = reject_tg, .targetsize = sizeof(struct ipt_reject_info), .table = "filter", .hooks = (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD) | (1 << NF_INET_LOCAL_OUT), .checkentry = reject_tg_check, .me = THIS_MODULE, }; static int __init reject_tg_init(void) { return xt_register_target(&reject_tg_reg); } static void __exit reject_tg_exit(void) { xt_unregister_target(&reject_tg_reg); } module_init(reject_tg_init); module_exit(reject_tg_exit);
/* * Copyright (C) 1998-2000 by Marco G"otze. * * This code is part of the wmpinboard source package, which is * distributed under the terms of the GNU GPL2. */ #ifndef XMISC_H_INCLUDED #define XMISC_H_INCLUDED #include <X11/Xlib.h> #include "wmpinboard.h" void replace_color(XImage*, int, int, int, int, unsigned long, unsigned long); void merge_masked(XImage*, int, int, int, int, int, int, unsigned long); void get_xpm_with_mask(char**, Pixmap*, Pixmap*); Pixmap get_xpm(char**); void flush_expose(void); void redraw_window(void); void set_mask(int); void init_xlocale(void); Window create_win(void); void cb_copy(const char*, int); void handle_SelectionRequest(XSelectionRequestEvent *rq); void cb_paste(int, int); void cb_paste_external(Window, unsigned, int, int, int, int); void cb_clear(void); void prepare_alarm_anim(); extern XIC InputContext; #endif /* XMISC_H_INCLUDED */
/* * Derived from: * Memory allocator for ELKS. We keep a hole list so we can keep the * malloc arena data in the kernel not scattered into hard to read * user memory. * * Provide memory management for linear address spaces, either systems * with base/limit type functionality (eg Z180) or just plain large address * spaces with no useful bases at all (eg 68000) * * On Z180 we use linear but we still have banking. On 68K binaries just have * to be relocated and you can't swap. * * For Z180 set this up with the memory range present. At the moment we only * support one linear block but the hole manager can manage multiple non linear * chunks if need be. * * We run with common 0 at physical 0x0 holding the vectors (why copy them!) * The bank area then runs from 0x0100 -> PAGE_TOP. The common 1 area is * mapped to the uarea/common of this process. This costs us memory for the * common code copies but saves us doing the uarea copying dance that * UZI180 does */ #include <kernel.h> #include <kdata.h> #include <printf.h> #ifdef CONFIG_BANK_LINEAR /* * Worst case is twice as many as allocations plus 1 I think ? */ #define MAX_SEGMENTS ((PTABSIZE*2) + 1) struct hole { uint16_t base; /* Pages */ uint16_t extent; /* Pages */ struct hole *next; /* Next in list memory order */ __u8 flags; /* So we know if it is free */ #define HOLE_USED 1 #define HOLE_FREE 2 #define HOLE_SPARE 3 #define HOLE_SWAPPED 8 }; static struct hole holes[MAX_SEGMENTS]; struct malloc_head { struct hole *holes; int size; }; struct malloc_head memmap = { holes, MAX_SEGMENTS }; /* * Find a spare hole. */ static struct hole *alloc_hole(struct malloc_head *mh) { struct hole *m = holes; int ct = MAX_SEGMENTS; while (ct--) { if (m->flags == HOLE_SPARE) return m; m++; } return NULL; } /* * Split a hole into two */ static int split_hole(struct malloc_head *mh, struct hole *m, uint16_t len) { struct hole *n; uint16_t spare = m->extent - len; if (!spare) return 0 /* * Split into one allocated one free */ n = alloc_hole(); if (n == NULL) return ENOMEM; m->extent = len; n->base = m->base + len; n->extent = spare; n->next = m->next; m->next = n; n->flags = HOLE_FREE; return 0; } /* * Merge adjacent free holes */ static void sweep_holes(struct malloc_head *mh) { struct hole *m = mh->holes; while (m != NULL && m->next != NULL) { if (m->flags == HOLE_FREE && m->next->flags == HOLE_FREE && m->base + m->extent == m->next->base) { m->extent += m->next->extent; m->next->flags = HOLE_SPARE; m->next = m->next->next; } else m = m->next; } } #if 0 void dmem(struct malloc_head *mh) { struct hole *m; char *status; if (mh) m = mh->holes; else m = memmap.holes; do { switch (m->flags) { case HOLE_SPARE: status = "SPARE"; break; case HOLE_FREE: status = "FREE"; break; case HOLE_USED: status = "USED"; break; default: status = "DODGY"; break; } printk("HOLE %x size %x next start %x is %s\n", m->base, m->extent, m->base + m->extent, status); m = m->next; } while (m); } #endif /* * Find the nearest fitting hole */ static struct hole *best_fit_hole(struct malloc_head *mh, uint16_t size) { struct hole *m = mh->holes; struct hole *best = NULL; while (m) { if (m->flags == HOLE_FREE && m->extent >= size) if (!best || best->extent > m->extent) best = m; m = m->next; } return best; } static struct hole *mm_alloc(uint16_t pages) { /* * Which hole fits best ? */ struct hole *m; m = best_fit_hole(&memmap, pages); if (m == NULL) return NULL; /* * The hole is (probably) too big */ if (split_hole(&memmap, m, pages)) return NULL; m->flags = HOLE_USED; m->refcount = 1; return m; } static int maps_needed(uint16_t size) { uint16_t banks = (size + 255) >> 8 + COMMON_BANKS; /* 3 for uarea + common code copy */ return banks; } /* * Try and swap stuff out if we can. If we run out of holes we will also swap * which should tidy up the space no end. */ static uint16_t pagemap_do_alloc(ptptr p, uint16_t size) { uint16_t hole; #ifdef SWAPDEV while ((hole = mm_alloc(maps_needed(size))) == 0) { if (swapneeded(p, 1) == NULL) return 0; } #else hole = mm_alloc(maps_needed(size)); #endif return hole; } int pagemap_alloc(ptptr p) { uint16_t hole = pagemap_do_alloc(p, udata.u_top); if (hole == 0) return ENOMEM; p->p_page = hole; return 0; } static int pagemap_can_alloc(uint16_t size) { uint16_t hole = pagemap_do_alloc(p, size); if (hole) { mm_free(hole); return 1; } return 0; } /* * Realloc our buffer. Naïve implementation. */ int pagemap_realloc(uint16_t size) { if (size == udata.u_top) return 0; if (size > udata.u_top && pagemap_can_alloc(size)) return ENOMEM; pagemap_free(udata.u_page); pagemap_do_alloc(udata.u_ptab, size); /* Our vectors are below the base/limit ranges so don't get touched and our uarea is above so that's fine too */ /* Propogate the new allocation into our uarea */ udata.u_page = udata.u_ptab->p_page; return 0; } /* * Free a segment. */ void pagemap_free(ptptr p) { struct hole *m = (struct hole *) p->page; if (m->flags != HOLE_USED) panic("double free"); m->flags = HOLE_FREE; sweep_holes(mh); } /* * This is the only spot which cares what size a "block" is. For now its 256 * bytes because that makes shifting it really cheap! */ static unsigned int pagemap_mem_used(void) { struct hole *m; unsigned int ret = 0; while (m != NULL) { if (m->flags == HOLE_USED) ret += m->extent; m = m->next; } return ret << 2; } /* * Initialise the memory manager. Pass the start and end in terms * of blocks. */ void pagemap_setup(uint16_t start, uint16_t end) { struct hole *holep = &holes[MAX_SEGMENTS - 1]; /* * Mark pages free. */ do { holep->flags = HOLE_SPARE; } while (--holep > holes); /* * Single hole containing all user memory. */ holep->flags = HOLE_FREE; holep->base = start; holep->extent = end - start; holep->next = NULL; } #endif
#ifndef RAMFS_H #define RAMFS_H #include "../block/block.h" #include "fs.h" #define FS_RAMFS 0 typedef struct ramfs_file { int id; int offset; int length; int index; } ramfs_file; typedef struct ramfs_file_node { struct ramfs_file_node* next; struct ramfs_file* file; } ramfs_file_node; void ramfs_dir_list(block_dev* dev, void* dir, void* buf); void ramfs_file_list(block_dev* dev, void* dir, void* buf); void ramfs_dir_del(block_dev* dev, void* dir, void* code); void ramfs_dir_add(block_dev* dev, void* dir, void* code); void ramfs_file_del(block_dev* dev, void* dir, void* code); void ramfs_file_add(block_dev* dev, void* dir, void* code); void ramfs_file_open(block_dev* dev, void* dir, void* file); void ramfs_file_close(block_dev* dev, void* file, void* code); void ramfs_file_writeb(block_dev* dev, void* file, void* data, void* code); void ramfs_file_readb(block_dev* dev, void* file, void* data); fsdriver* get_ramfs_driver(void); #endif //RAMFS_H
/* * Driver for Pixcir I2C touchscreen controllers. * * Copyright (C) 2010-2011 Pixcir, Inc. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/delay.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/slab.h> #include <linux/i2c.h> #include <linux/input.h> #include <linux/input/pixcir_ts.h> struct pixcir_i2c_ts_data { struct i2c_client *client; struct input_dev *input; const struct pixcir_ts_platform_data *chip; bool exiting; }; static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data) { struct pixcir_i2c_ts_data *tsdata = data; u8 rdbuf[10], wrbuf[1] = { 0 }; u8 touch; int ret; ret = i2c_master_send(tsdata->client, wrbuf, sizeof(wrbuf)); if (ret != sizeof(wrbuf)) { dev_err(&tsdata->client->dev, "%s: i2c_master_send failed(), ret=%d\n", __func__, ret); return; } ret = i2c_master_recv(tsdata->client, rdbuf, sizeof(rdbuf)); if (ret != sizeof(rdbuf)) { dev_err(&tsdata->client->dev, "%s: i2c_master_recv failed(), ret=%d\n", __func__, ret); return; } touch = rdbuf[0]; if (touch) { u16 posx1 = (rdbuf[3] << 8) | rdbuf[2]; u16 posy1 = (rdbuf[5] << 8) | rdbuf[4]; u16 posx2 = (rdbuf[7] << 8) | rdbuf[6]; u16 posy2 = (rdbuf[9] << 8) | rdbuf[8]; input_report_key(tsdata->input, BTN_TOUCH, 1); input_report_abs(tsdata->input, ABS_X, posx1); input_report_abs(tsdata->input, ABS_Y, posy1); input_report_abs(tsdata->input, ABS_MT_POSITION_X, posx1); input_report_abs(tsdata->input, ABS_MT_POSITION_Y, posy1); input_mt_sync(tsdata->input); if (touch == 2) { input_report_abs(tsdata->input, ABS_MT_POSITION_X, posx2); input_report_abs(tsdata->input, ABS_MT_POSITION_Y, posy2); input_mt_sync(tsdata->input); } } else { input_report_key(tsdata->input, BTN_TOUCH, 0); } input_sync(tsdata->input); } static irqreturn_t pixcir_ts_isr(int irq, void *dev_id) { struct pixcir_i2c_ts_data *tsdata = dev_id; while (!tsdata->exiting) { pixcir_ts_poscheck(tsdata); if (tsdata->chip->attb_read_val()) break; msleep(20); } return IRQ_HANDLED; } #ifdef CONFIG_PM_SLEEP static int pixcir_i2c_ts_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); if (device_may_wakeup(&client->dev)) enable_irq_wake(client->irq); return 0; } static int pixcir_i2c_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); if (device_may_wakeup(&client->dev)) disable_irq_wake(client->irq); return 0; } #endif static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops, pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume); static int pixcir_i2c_ts_probe(struct i2c_client *client, const struct i2c_device_id *id) { const struct pixcir_ts_platform_data *pdata = dev_get_platdata(&client->dev); struct pixcir_i2c_ts_data *tsdata; struct input_dev *input; int error; if (!pdata) { dev_err(&client->dev, "platform data not defined\n"); return -EINVAL; } tsdata = kzalloc(sizeof(*tsdata), GFP_KERNEL); input = input_allocate_device(); if (!tsdata || !input) { dev_err(&client->dev, "Failed to allocate driver data!\n"); error = -ENOMEM; goto err_free_mem; } tsdata->client = client; tsdata->input = input; tsdata->chip = pdata; input->name = client->name; input->id.bustype = BUS_I2C; input->dev.parent = &client->dev; __set_bit(EV_KEY, input->evbit); __set_bit(EV_ABS, input->evbit); __set_bit(BTN_TOUCH, input->keybit); input_set_abs_params(input, ABS_X, 0, pdata->x_max, 0, 0); input_set_abs_params(input, ABS_Y, 0, pdata->y_max, 0, 0); input_set_abs_params(input, ABS_MT_POSITION_X, 0, pdata->x_max, 0, 0); input_set_abs_params(input, ABS_MT_POSITION_Y, 0, pdata->y_max, 0, 0); input_set_drvdata(input, tsdata); error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, client->name, tsdata); if (error) { dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); goto err_free_mem; } error = input_register_device(input); if (error) goto err_free_irq; i2c_set_clientdata(client, tsdata); device_init_wakeup(&client->dev, 1); return 0; err_free_irq: free_irq(client->irq, tsdata); err_free_mem: input_free_device(input); kfree(tsdata); return error; } static int pixcir_i2c_ts_remove(struct i2c_client *client) { struct pixcir_i2c_ts_data *tsdata = i2c_get_clientdata(client); device_init_wakeup(&client->dev, 0); tsdata->exiting = true; mb(); free_irq(client->irq, tsdata); input_unregister_device(tsdata->input); kfree(tsdata); return 0; } static const struct i2c_device_id pixcir_i2c_ts_id[] = { { "pixcir_ts", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, pixcir_i2c_ts_id); static struct i2c_driver pixcir_i2c_ts_driver = { .driver = { .name = "pixcir_ts", .pm = &pixcir_dev_pm_ops, }, .probe = pixcir_i2c_ts_probe, .remove = pixcir_i2c_ts_remove, .id_table = pixcir_i2c_ts_id, }; module_i2c_driver(pixcir_i2c_ts_driver); MODULE_AUTHOR("Jianchun Bian <jcbian@pixcir.com.cn>, Dequan Meng <dqmeng@pixcir.com.cn>"); MODULE_DESCRIPTION("Pixcir I2C Touchscreen Driver"); MODULE_LICENSE("GPL");
#ifndef NEWBUTTONDIALOG_H #define NEWBUTTONDIALOG_H #include <QDialog> #include <QListWidgetItem> #include "theme.h" namespace Ui { class newButtonDialog; } class NewButtonDialog : public QDialog { Q_OBJECT public: explicit NewButtonDialog(const Theme& theme, QWidget *parent = 0); ~NewButtonDialog(); ButtonType selectedButton() const; private: Ui::newButtonDialog *ui; ButtonType selectedButton_; public slots: void chooseButton(QListWidgetItem* selection); }; #endif // NEWBUTTONDIALOG_H
/* * include/asm-arm/arch-davinci/i2c-client.h * * Copyright (C) 2006 Texas Instruments Inc * Copyright (C) 2008 MontaVista Software, Inc. <source@mvista.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* i2c-client.h */ #ifndef _DAVINCI_I2C_CLIENT_H_ #define _DAVINCI_I2C_CLIENT_H_ typedef enum { USB_DRVVBUS = 0, VDDIMX_EN = 1, VLYNQ_ON = 2, CF_RESET = 3, WLAN_RESET = 5, ATA_SEL = 6, CF_SEL = 7, /* DM646X expanders */ ATA_SEL_DM646X = 0, ATA_PWD_DM646X = 1, VSCALE_ON_DM646X = 2, VLYNQ_RESET_DM646X = 3, CIR_DEMOD_DM646X = 4, CIR_MOD_DM646X = 5, I2C_INT_DM646X = 6, USB_FB_DM646X = 7 } u35_expander_ops; /* * The board code will set this to point to its expander pin setup function * to be called upon registering the I2C client. */ extern void (*board_i2c_expander_setup)(void); int davinci_i2c_expander_op (u16 client_addr, u35_expander_ops pin, u8 val); int davinci_i2c_write(u8 size, u8 * val, u16 client_addr); int davinci_i2c_read(u8 size, u8 * val, u16 client_addr); #endif
#include "tmp102d.h" // read data with from i2c address, length is the number of bytes to read // return the data as int, in case of failure return: -1=open failed, // -2=lock failed, -3=bus access failed, -4=i2c slave reading failed // global 'cont' is set to zero in case of more serious failure int I2cReadBytes(int address, int length) { int rdata=0; int fd,rd; int cnt=0; unsigned char buf[10]; char message[200]=""; if( (fd = open(i2cdev, O_RDWR) ) < 0 ) { syslog(LOG_ERR|LOG_DAEMON, "Failed to open i2c port"); return -1; } rd=flock(fd, LOCK_EX|LOCK_NB); cnt = I2LOCK_MAX; while( (rd == 1) && (cnt > 0) ) // try again if port locking failed { sleep(1); rd=flock(fd, LOCK_EX|LOCK_NB); cnt--; } if(rd) { syslog(LOG_ERR|LOG_DAEMON, "Failed to lock i2c port"); close(fd); return -2; } if( ioctl(fd, I2C_SLAVE, address) < 0 ) { syslog(LOG_ERR|LOG_DAEMON, "Unable to get bus access to talk to slave"); close(fd); return -3; } if( length == 1 ) { if( read(fd, buf,1) != 1 ) { syslog(LOG_ERR|LOG_DAEMON, "Unable to read from slave, exit"); cont=0; close(fd); return -4; } else { sprintf(message, "Receive 0x%02x", buf[0]); syslog(LOG_DEBUG, "%s", message); rdata=buf[0]; } } else if( length == 2 ) { if( read(fd, buf,2) != 2 ) { syslog(LOG_ERR|LOG_DAEMON, "Unable to read from slave, exit"); cont=0; close(fd); return -4; } else { sprintf(message, "Receive 0x%02x%02x", buf[0], buf[1]); syslog(LOG_DEBUG, "%s", message); rdata=256*buf[0]+buf[1]; } } else if( length == 4 ) { if( read(fd, buf,4) != 4 ) { syslog(LOG_ERR|LOG_DAEMON, "Unable to read from slave, exit"); cont=0; close(fd); return -4; } else { sprintf(message, "Receive 0x%02x%02x%02x%02x", buf[0], buf[1], buf[2], buf[3]); syslog(LOG_DEBUG, "%s", message); rdata=16777216*buf[0]+65536*buf[1]+256*buf[2]+buf[3]; } } close(fd); return rdata; }
/* * Copyright (c) 2017, 2020, Oracle and/or its affiliates. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials provided * with the distribution. * * 3. Neither the name of the copyright holder 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. */ #include <stdio.h> int main() { char test[15] = "test"; puts(test); return 0; }
/* Copyright (c) 2000-2012, by Zhuo Meng (zxm8@case.edu). All rights reserved. Distributed 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 */ /* For calendar in Encapsulated Postscript form with PS characters */ #ifndef PSMONTH_H #define PSMONTH_H void MonthStartPS(int nstart, char *monstart); /* Input: month, month number with .5 indicating leap month nstart, day of calendar month that starts this lunar month ndays, number of days in this lunar month bYear, whether to be used in yearly or monthly calendar Output: monname, C string containing the PS characters for the month. monname should be allocated at least 21 bytes before the call */ void Number2MonthPS(double month, int nstart, int ndays, bool bYear, char *monname); /* Input: nday, day number (1 - 30) Output: dayname, C string containing the PS characters for the day. dayname should be allocated at least 9 bytes before the call */ void Number2DayPS(int nday, char *dayname); /* Input: titlestr, string to be included in the title, normally either Year XXXX or Month Year bIsSim: true for simplified characters, false for traditional characters bNeedsRun: true if character Run is needed, false otherwise */ void PrintHeaderPS(char *titlestr, bool bIsSim, bool bNeedsRun); /* Inputs: monthhead, string header for the monthly calendar if bSingle is true, don't care otherwise month, month number for the monthly calendar if bSingle is true, don't care otherwise bSingle, true for single month, false for whole year bIsSim: true for simplified characters, false for traditional characters bNeedsRun: true if character Run is needed, false otherwise nWeeks: number of week lines in month */ void PrintHeaderMonthPS(char *monthhead, short int month, bool bSingle, bool bIsSim, bool bNeedsRun, int nWeeks); void PrintClosingPS(); #endif /*PSMONTH_H*/
// // $Id: sphinxexpr.h 2651 2011-01-27 20:59:49Z shodan $ // // // Copyright (c) 2001-2011, Andrew Aksyonoff // Copyright (c) 2008-2011, Sphinx Technologies Inc // All rights reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License. You should have // received a copy of the GPL license along with this program; if you // did not, you can find it at http://www.gnu.org/ // #ifndef _sphinxexpr_ #define _sphinxexpr_ #include "sphinxstd.h" /// forward decls class CSphMatch; struct CSphSchema; struct CSphString; /// known attribute types enum ESphAttr { SPH_ATTR_NONE = 0, ///< not an attribute at all SPH_ATTR_INTEGER = 1, ///< unsigned 32-bit integer SPH_ATTR_TIMESTAMP = 2, ///< this attr is a timestamp SPH_ATTR_ORDINAL = 3, ///< this attr is an ordinal string number (integer at search time, specially handled at indexing time) SPH_ATTR_BOOL = 4, ///< this attr is a boolean bit field SPH_ATTR_FLOAT = 5, ///< floating point number (IEEE 32-bit) SPH_ATTR_BIGINT = 6, ///< signed 64-bit integer SPH_ATTR_STRING = 7, ///< string (binary; in-memory) SPH_ATTR_WORDCOUNT = 8, ///< string word count (integer at search time,tokenized and counted at indexing time) SPH_ATTR_UINT32SET = 0x40000001UL ///< MVA, set of unsigned 32-bit integers }; /// expression evaluator /// can always be evaluated in floats using Eval() /// can sometimes be evaluated in integers using IntEval(), depending on type as returned from sphExprParse() struct ISphExpr : public ISphRefcounted { public: /// evaluate this expression for that match virtual float Eval ( const CSphMatch & tMatch ) const = 0; /// evaluate this expression for that match, using int math virtual int IntEval ( const CSphMatch & tMatch ) const { assert ( 0 ); return (int) Eval ( tMatch ); } /// evaluate this expression for that match, using int64 math virtual int64_t Int64Eval ( const CSphMatch & tMatch ) const { assert ( 0 ); return (int64_t) Eval ( tMatch ); } /// evaluate string attr virtual int StringEval ( const CSphMatch &, const BYTE ** ppStr ) const { *ppStr = NULL; return 0; } /// evaluate MVA attr virtual const DWORD * MvaEval ( const CSphMatch & ) const { assert ( 0 ); return NULL; } /// check for arglist subtype virtual bool IsArglist () const { return false; } /// setup MVA pool virtual void SetMVAPool ( const DWORD * ) {} /// setup sting pool virtual void SetStringPool ( const BYTE * ) {} /// get schema columns index which affect expression virtual void GetDependencyColumns ( CSphVector<int> & ) const {} }; /// parses given expression, builds evaluator /// returns NULL and fills sError on failure /// returns pointer to evaluator on success /// fills pAttrType with result type (for now, can be SPH_ATTR_SINT or SPH_ATTR_FLOAT) ISphExpr * sphExprParse ( const char * sExpr, const CSphSchema & tSchema, ESphAttr * pAttrType, bool * pUsesWeight, CSphString & sError, CSphSchema * pExtra=NULL ); ////////////////////////////////////////////////////////////////////////// /// initialize UDF manager void sphUDFInit ( const char * sUdfDir ); /// load UDF function bool sphUDFCreate ( const char * szLib, const char * szFunc, ESphAttr eRetType, CSphString & sError ); /// unload UDF function bool sphUDFDrop ( const char * szFunc, CSphString & sError ); #endif // _sphinxexpr_ // // $Id: sphinxexpr.h 2651 2011-01-27 20:59:49Z shodan $ //
/* This file is part of Rockon. * * Rockon 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. * * Rockon 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 Rockon. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ROCKON_CONFIG_H #define ROCKON_CONFIG_H #include "lcfg_static.h" typedef struct { char *config_filename; struct lcfg *lcfg_obj; int launch_server; int terminate_server; int auto_reconnect; int reconnect_interval; char *ipc_path; char *edj_data_path; } rockon_config; rockon_config* config_new(); void config_del(rockon_config *config); int config_load(rockon_config *config); int config_save(rockon_config *config); #endif /* ROCKON_CONFIG_H */
/************************************************************************************************************ Copyright (C) Morozov Vladimir Aleksandrovich MorozovVladimir@mail.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. 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 EMAILCLIENT_H #define EMAILCLIENT_H #include <QtCore/QObject> #include "../../SMTPEmail/src/smtpclient.h" class EMailClient : public QObject { Q_OBJECT public: explicit EMailClient(QObject *parent = 0 /*nullptr*/); ~EMailClient(); virtual bool open(); virtual void close(); virtual int sendMail(const QString & host = "localhost", int port = 25/*, SmtpClient::ConnectionType ct = SmtpClient::TcpConnection*/); signals: public slots: private: SmtpClient* smtp; }; Q_DECLARE_INTERFACE(EMailClient, "org.QBalance.EMailClient") #endif // EMAILCLIENT_H
#ifndef PC1600_H #define PC1600_H //#include <stdlib.h> //#include <stdio.h> #include <QMenu> #include "cextension.h" //#include "pcxxxx.h" //#include "Log.h" #include "lh5803.h" #include "lh5810.h" #include "Connect.h" #include "Keyb.h" #include "ce152.h" #include "hd61102.h" #include "lu57813p.h" #include "tc8576p.h" class CZ80; class CbusPc1500; class CLH5810_PC1600:public CLH5810{ Q_OBJECT public: bool init(void); //initialize bool step(void); const char* GetClassName(){ return("CLH5810_PC1600");} CLH5810_PC1600(CPObject *parent=0) : CLH5810(parent) { } ~CLH5810_PC1600() { } }; //typedef struct{ // bool ce_151,ce_155,ce_161,ce_159,ce_150,ce_158; //} TExtension; class Cpc1600:public CpcXXXX{ Q_OBJECT protected slots: void LoadSIO(void); public: const char* GetClassName(){ return("Cpc1600");} void ReadQuarterTape(void); void Hack_CRVA(void); FILE* fp_CRVA; bool LoadConfig(QXmlStreamReader *); bool SaveConfig(QXmlStreamWriter *); bool InitDisplay(void); bool CompleteDisplay(void); virtual void ComputeKey(KEYEVENT ke = KEY_PRESSED,int scancode=0,QMouseEvent *event=0); bool run(void); // emulator main void Set_Port(PORTS Port,BYTE data); BYTE Get_Port(PORTS Port); virtual bool Mem_Mirror(UINT32 *d); void TurnON(void); void TurnOFF(void); void Reset(void); void Regs_Info(UINT8 Type); bool lh5810_write(UINT32 d, UINT32 data); quint8 lh5810_read(UINT32 d); virtual bool Chk_Adr(UINT32 *d,UINT32 data); virtual bool Chk_Adr_R(UINT32 *d, UINT32 *data); UINT8 in(UINT8 address,QString sender=QString()); UINT8 out(UINT8 address,UINT8 value,QString sender=QString()); bool Set_Connector(Cbus *_bus = 0); bool Get_Connector(Cbus *_bus = 0); BYTE getKey(void); CZ80 *pZ80; CLH5803 *pLH5803; bool masterCPU; bool cpuSwitchPending; CLU57813P *pLU57813P; CLH5810_PC1600 *pLH5810; CHD61102 *pHD61102_1; CHD61102 *pHD61102_2; CTC8576P *pTC8576P; Cconnector *pADCONNECTOR; qint64 pADCONNECTOR_value; bool lh5810_Access; bool ce150_connected; bool ce150_Access; UINT8 bank1,bank2,bank3,bank4; void InitCE150(void); void initExtension(void); bool init(void); // initialize void hack(UINT32 pc); Cpc1600(CPObject *parent = 0); virtual ~Cpc1600(); void setPUPVPT(CbusPc1500 *bus, UINT32 adr); protected slots: void contextMenuEvent ( QContextMenuEvent * event ); }; #define S1_EXTENSION_CE151 ext_MemSlot1->ExtArray[ID_CE151] #define S1_EXTENSION_CE155 ext_MemSlot1->ExtArray[ID_CE155] #define S1_EXTENSION_CE159 ext_MemSlot1->ExtArray[ID_CE159] #define S1_EXTENSION_CE160 ext_MemSlot1->ExtArray[ID_CE160] #define S1_EXTENSION_CE161 ext_MemSlot1->ExtArray[ID_CE161] #define S1_EXTENSION_CE1600M ext_MemSlot1->ExtArray[ID_CE1600M] #define S1_EXTENSION_CE1601M ext_MemSlot1->ExtArray[ID_CE1601M] #define S1_EXTENSION_CE151_CHECK S1_EXTENSION_CE151->IsChecked #define S1_EXTENSION_CE155_CHECK S1_EXTENSION_CE155->IsChecked #define S1_EXTENSION_CE159_CHECK S1_EXTENSION_CE159->IsChecked #define S1_EXTENSION_CE160_CHECK S1_EXTENSION_CE160->IsChecked #define S1_EXTENSION_CE161_CHECK S1_EXTENSION_CE161->IsChecked #define S1_EXTENSION_CE1600M_CHECK S1_EXTENSION_CE1600M->IsChecked #define S1_EXTENSION_CE1601M_CHECK S1_EXTENSION_CE1601M->IsChecked #define S2_EXTENSION_CE161 ext_MemSlot2->ExtArray[ID_CE161] #define S2_EXTENSION_CE1600M ext_MemSlot2->ExtArray[ID_CE1600M] #define S2_EXTENSION_CE1601M ext_MemSlot2->ExtArray[ID_CE1601M] #define S2_EXTENSION_CE16096 ext_MemSlot2->ExtArray[ID_CE16096] #define S2_EXTENSION_CE16128 ext_MemSlot2->ExtArray[ID_CE16128] #define S2_EXTENSION_CE16160 ext_MemSlot2->ExtArray[ID_CE16160] #define S2_EXTENSION_CE16192 ext_MemSlot2->ExtArray[ID_CE16192] #define S2_EXTENSION_CE16224 ext_MemSlot2->ExtArray[ID_CE16224] #define S2_EXTENSION_CE16256 ext_MemSlot2->ExtArray[ID_CE16256] #define S2_EXTENSION_CE161_CHECK S2_EXTENSION_CE161->IsChecked #define S2_EXTENSION_CE1600M_CHECK S2_EXTENSION_CE1600M->IsChecked #define S2_EXTENSION_CE1601M_CHECK S2_EXTENSION_CE1601M->IsChecked #define S2_EXTENSION_CE16096_CHECK S2_EXTENSION_CE16096->IsChecked #define S2_EXTENSION_CE16128_CHECK S2_EXTENSION_CE16128->IsChecked #define S2_EXTENSION_CE16160_CHECK S2_EXTENSION_CE16160->IsChecked #define S2_EXTENSION_CE16192_CHECK S2_EXTENSION_CE16192->IsChecked #define S2_EXTENSION_CE16224_CHECK S2_EXTENSION_CE16224->IsChecked #define S2_EXTENSION_CE16256_CHECK S2_EXTENSION_CE16256->IsChecked #endif // PC1600_H
/* * (C) Copyright 2002-2006 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * (C) Copyright 2002 * Sysgo Real-Time Solutions, GmbH <www.elinos.com> * Marius Groeger <mgroeger@sysgo.de> * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ /** * @file * @brief Main entry into the C part of barebox */ #include <common.h> #include <init.h> #include <command.h> #include <malloc.h> #include <debug_ll.h> #include <fs.h> #include <linux/stat.h> #include <envfs.h> #include <asm/sections.h> #include <uncompress.h> extern initcall_t __barebox_initcalls_start[], __barebox_early_initcalls_end[], __barebox_initcalls_end[]; #ifdef CONFIG_DEFAULT_ENVIRONMENT #include "barebox_default_env.h" static int register_default_env(void) { int ret; void *defaultenv; if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED)) { void *tmp = malloc(default_environment_size); if (!tmp) return -ENOMEM; memcpy(tmp, default_environment, default_environment_size); defaultenv = xzalloc(default_environment_uncompress_size); ret = uncompress(tmp, default_environment_size, NULL, NULL, defaultenv, NULL, uncompress_err_stdout); free(tmp); if (ret) { free(defaultenv); return ret; } } else { defaultenv = (void *)default_environment; } add_mem_device("defaultenv", (unsigned long)defaultenv, default_environment_uncompress_size, IORESOURCE_MEM_WRITEABLE); return 0; } device_initcall(register_default_env); #endif #if defined CONFIG_FS_RAMFS && defined CONFIG_FS_DEVFS static int mount_root(void) { mount("none", "ramfs", "/"); mkdir("/dev", 0); mount("none", "devfs", "/dev"); return 0; } fs_initcall(mount_root); #endif int (*barebox_main)(void); void __noreturn start_barebox(void) { initcall_t *initcall; int result; struct stat s; if (!IS_ENABLED(CONFIG_SHELL_NONE)) barebox_main = run_shell; for (initcall = __barebox_initcalls_start; initcall < __barebox_initcalls_end; initcall++) { pr_debug("initcall-> %pS\n", *initcall); result = (*initcall)(); if (result) pr_err("initcall %pS failed: %s\n", *initcall, strerror(-result)); } pr_debug("initcalls done\n"); if (IS_ENABLED(CONFIG_ENV_HANDLING)) { int ret; ret = envfs_load(default_environment_path, "/env", 0); if (ret && IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT)) { pr_err("no valid environment found on %s. " "Using default environment\n", default_environment_path); envfs_load("/dev/defaultenv", "/env", 0); } } if (IS_ENABLED(CONFIG_COMMAND_SUPPORT)) { pr_info("running /env/bin/init...\n"); if (!stat("/env/bin/init", &s)) { run_command("source /env/bin/init", 0); } else { pr_err("/env/bin/init not found\n"); } } if (!barebox_main) { pr_err("No main function! aborting.\n"); hang(); } /* main_loop() can return to retry autoboot, if so just run it again. */ for (;;) barebox_main(); /* NOTREACHED - no way out of command loop except booting */ } void __noreturn hang (void) { puts ("### ERROR ### Please RESET the board ###\n"); for (;;); } /* Everything needed to cleanly shutdown barebox. * Should be called before starting an OS to get * the devices into a clean state */ void shutdown_barebox(void) { devices_shutdown(); #ifdef ARCH_SHUTDOWN arch_shutdown(); #endif }
#if !defined (ALGO_H) #define ALGO_H //------------------------------------ // (c) Reliable Software 1998 //------------------------------------ template<class In, class Out, class Pred> Out copy_if (In first, In last, Out res, Pred p) { while (first != last) { if (p (*first)) { *res = *first; ++res; } ++first; } return res; } #endif
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // // MainViewController.h // moonlight // // Created by ___FULLUSERNAME___ on ___DATE___. // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. // #import <Cordova/CDVViewController.h> #import <Cordova/CDVCommandDelegateImpl.h> #import <Cordova/CDVCommandQueue.h> @interface MainViewController : CDVViewController @end @interface MainCommandDelegate : CDVCommandDelegateImpl @end @interface MainCommandQueue : CDVCommandQueue @end
/* ============================================================================== This file is part of the JUCE library - "Jules' Utility Class Extensions" Copyright 2004-11 by Raw Material Software Ltd. ------------------------------------------------------------------------------ JUCE can be redistributed and/or modified under the terms of the GNU General Public License (Version 2), as published by the Free Software Foundation. A copy of the license is included in the JUCE distribution, or can be found online at www.gnu.org/licenses. JUCE 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. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.rawmaterialsoftware.com/juce for more information. ============================================================================== */ #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__ #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__ #include "juce_ActionListener.h" //============================================================================== /** Manages a list of ActionListeners, and can send them messages. To quickly add methods to your class that can add/remove action listeners and broadcast to them, you can derive from this. @see ActionListener, ChangeListener */ class JUCE_API ActionBroadcaster { public: //============================================================================== /** Creates an ActionBroadcaster. */ ActionBroadcaster(); /** Destructor. */ virtual ~ActionBroadcaster(); //============================================================================== /** Adds a listener to the list. Trying to add a listener that's already on the list will have no effect. */ void addActionListener (ActionListener* listener); /** Removes a listener from the list. If the listener isn't on the list, this won't have any effect. */ void removeActionListener (ActionListener* listener); /** Removes all listeners from the list. */ void removeAllActionListeners(); //============================================================================== /** Broadcasts a message to all the registered listeners. @see ActionListener::actionListenerCallback */ void sendActionMessage (const String& message) const; private: //============================================================================== friend class WeakReference<ActionBroadcaster>; WeakReference<ActionBroadcaster>::Master masterReference; class ActionMessage; friend class ActionMessage; SortedSet <ActionListener*> actionListeners; CriticalSection actionListenerLock; JUCE_DECLARE_NON_COPYABLE (ActionBroadcaster) }; #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
/****************************************************************************** Project : UNDONE Engine File : Scene.h Author : Anurup Dey Copyright (C) 2015 Anurup Dey 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. ******************************************************************************/ /////////////////////////////////////////////////////////////////////////////// #pragma once #ifndef UNDONE_SCENE_H #define UNDONE_SCENE_H namespace UNDONE_ENGINE{ typedef unsigned int OwnerShip; class ObjectBuffer; /*----------------------------------------------------------------------------- The scene represents a segment of the game or application having its own memory space and set of objects.Think of them as separate levels. They can be loaded samultaneousely and freed independent of each other. THis is an abstract interface. The User can create any behavior they want in a scene. -----------------------------------------------------------------------------*/ class Scene { public: virtual void Load(ObjectBuffer* pObjectBuffer) = 0; virtual void UnLoad( ) = 0; virtual void Release( ) = 0; virtual void Update( ) = 0; virtual void Pause( ) = 0; virtual void Resume( ) = 0; OwnerShip GetOwnerShip( ) { return m_ownerShip; } protected: OwnerShip m_ownerShip; }; } #endif
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * e-cell-spin-button.h: Spin button item for e-table. * Copyright 2001, CodeFactory AB * Copyright 2001, Mikael Hallendal <micke@codefactory.se> * * Authors: * Mikael Hallendal <micke@codefactory.se> * * Celltype for drawing a spinbutton in a cell. * * Used ECellPopup by Damon Chaplin <damon@ximian.com> as base for * buttondrawings. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License, version 2, as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ #ifndef __E_CELL_SPIN_BUTTON_H__ #define __E_CELL_SPIN_BUTTON_H__ #include <glib.h> #include <gtk/gtktypeutils.h> #include <table/e-cell.h> #define E_CELL_SPIN_BUTTON_TYPE (e_cell_spin_button_get_type ()) #define E_CELL_SPIN_BUTTON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_SPIN_BUTTON_TYPE, ECellSpinButton)) #define E_CELL_SPIN_BUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_SPIN_BUTTON_TYPE, ECellSpinButtonClass)) #define M_IS_CELL_SPIN_BUTTON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_SPIN_BUTTON_TYPE)) #define M_IS_CELL_SPIN_BUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_SPIN_BUTTON_TYPE)) typedef union { gint i; gfloat f; } ECellSpinButtonData; typedef enum { STEP_UP, STEP_DOWN } ECellSpinButtonStep; typedef struct { ECell parent; ECell *child; ECellSpinButtonData min; ECellSpinButtonData max; ECellSpinButtonData step; gboolean up_pressed; gboolean down_pressed; } ECellSpinButton; typedef struct { ECellClass parent_class; /* Functions */ void (*step) (ECellSpinButton *mcsb, ECellView *ecv, ECellSpinButtonStep direction, gint col, gint row); } ECellSpinButtonClass; GType e_cell_spin_button_get_type (void); ECell * e_cell_spin_button_new (gint min, gint max, gint step, ECell *child_cell); ECell * e_cell_spin_button_new_float (gfloat min, gfloat max, gfloat step, ECell *child_cell); void e_cell_spin_button_step (ECellSpinButton *mcsb, ECellView *ecv, ECellSpinButtonStep direction, gint col, gint row); void e_cell_spin_button_step_float (ECellSpinButton *mcsb, ECellView *ecv, ECellSpinButtonStep direction, gint col, gint row); #endif /* __E_CELL_SPIN_BUTTON__ */
/******************************************************************************* * * "cs4281_wrapper.h" -- Cirrus Logic-Crystal CS4281 linux audio driver. * * Copyright (C) 2000,2001 Cirrus Logic Corp. * -- tom woller (twoller@crystal.cirrus.com) or * (audio@crystal.cirrus.com). * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * 12/22/00 trw - new file. * 04/18/01 trw - rework entire wrapper logic. * *******************************************************************************/ #ifndef __CS4281_WRAPPER_H #define __CS4281_WRAPPER_H /* 2.4.x wrapper */ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,12) static int cs4281_null_suspend(struct pci_dev *pcidev, u32 unused) { return 0; } static int cs4281_null_resume(struct pci_dev *pcidev) { return 0; } #else #define no_llseek cs4281_llseek static loff_t cs4281_llseek(struct file *file, loff_t offset, int origin) { return -ESPIPE; } void cs4281_null_suspend(struct pci_dev *pcidev) { return; } void cs4281_null_resume(struct pci_dev *pcidev) { return; } #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3) /* Some versions of 2.4.2 resolve pci_set_dma_mask and some do not... * but 2.4.0 definitely does not */ #define pci_set_dma_mask(dev,data) 0; #else #endif #define cs4x_mem_map_reserve(page) mem_map_reserve(page) #define cs4x_mem_map_unreserve(page) mem_map_unreserve(page) #endif /* #ifndef __CS4281_WRAPPER_H */
/* gui-nicklist.c : irssi Copyright (C) 2002 Timo Sirainen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "module.h" #include "modules.h" #include "signals.h" #include "channels.h" #include "servers.h" #include "nicklist.h" #include "gui-channel.h" #include "gui-nicklist.h" #include "gui-nicklist-view.h" static gint nicklist_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data) { Nick *nick1, *nick2; gpointer channel_flags; gint r; gtk_tree_model_get(model, a, 0, &nick1, 1, &channel_flags, -1); gtk_tree_model_get(model, b, 0, &nick2, 1, &channel_flags, -1); /* XXX: this isn't the right solution, but it will have to do. */ if (channel_flags == NULL) channel_flags = "~&@%+"; r = nicklist_compare(nick1, nick2, channel_flags); if (r < 0) return -1; if (r > 0) return 1; return 0; } Nicklist *gui_nicklist_new(Channel *channel) { Nicklist *nicklist; GtkListStore *store; nicklist = g_new0(Nicklist, 1); nicklist->channel = channel; nicklist->store = store = gtk_list_store_new(2, G_TYPE_POINTER, G_TYPE_POINTER); gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store), 0, nicklist_sort_func, NULL, NULL); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), 0, GTK_SORT_ASCENDING); signal_emit("gui nicklist created", 1, nicklist); return nicklist; } void gui_nicklist_destroy(Nicklist *nicklist) { signal_emit("gui nicklist destroyed", 1, nicklist); while (nicklist->views != NULL) { NicklistView *view = nicklist->views->data; gui_nicklist_view_set(view, NULL); nicklist->views = g_slist_remove(nicklist->views, view); } g_object_unref(G_OBJECT(nicklist->store)); g_free(nicklist); } static void gui_nicklist_update_label(Nicklist *nicklist) { GSList *tmp; char label[128]; g_snprintf(label, sizeof(label), "%d ops, %d total", nicklist->ops, nicklist->nicks); for (tmp = nicklist->views; tmp != NULL; tmp = tmp->next) { NicklistView *view = tmp->data; gui_nicklist_view_update_label(view, label); } } static void gui_nicklist_add(Channel *channel, Nick *nick, int update_label) { ChannelGui *gui; GtkTreeIter iter; gpointer nick_flags = NULL; gui = CHANNEL_GUI(channel); if (nick->op) gui->nicklist->ops++; else if (nick->halfop) gui->nicklist->halfops++; else if (nick->voice) gui->nicklist->voices++; else gui->nicklist->normal++; gui->nicklist->nicks++; if (channel->server->get_nick_flags != NULL) nick_flags = (gpointer) channel->server->get_nick_flags(channel->server); gtk_list_store_append(gui->nicklist->store, &iter); gtk_list_store_set(gui->nicklist->store, &iter, 0, nick, 1, nick_flags, -1); gui_nicklist_update_label(gui->nicklist); } static void gui_nicklist_remove(Channel *channel, Nick *nick, int update_label) { ChannelGui *gui; GtkTreeModel *model; GtkTreeIter iter; NICK_REC *val_nick; gui = CHANNEL_GUI(channel); if (gui == NULL) return; if (nick->op) gui->nicklist->ops--; else if (nick->halfop) gui->nicklist->halfops--; else if (nick->voice) gui->nicklist->voices--; else gui->nicklist->normal--; gui->nicklist->nicks--; model = GTK_TREE_MODEL(gui->nicklist->store); gtk_tree_model_get_iter_first(model, &iter); do { gtk_tree_model_get(model, &iter, 0, &val_nick, -1); if (val_nick == nick) { gtk_list_store_remove(gui->nicklist->store, &iter); break; } } while (gtk_tree_model_iter_next(model, &iter)); gui_nicklist_update_label(gui->nicklist); } static void gui_nicklist_changed(Channel *channel, Nick *nick) { gui_nicklist_remove(channel, nick, FALSE); gui_nicklist_add(channel, nick, TRUE); } static void gui_nicklist_mode_changed(Channel *channel, Nick *nick) { GSList *nicks, *tmp; ChannelGui *gui; gui_nicklist_remove(channel, nick, FALSE); gui_nicklist_add(channel, nick, FALSE); /* nick counts are messed up now, we have to recalculate them */ gui = CHANNEL_GUI(channel); gui->nicklist->ops = gui->nicklist->halfops = gui->nicklist->voices = gui->nicklist->normal = 0; nicks = nicklist_getnicks(channel); for (tmp = nicks; tmp != NULL; tmp = tmp->next) { Nick *nick = tmp->data; if (nick->op) gui->nicklist->ops++; else if (nick->halfop) gui->nicklist->halfops++; else if (nick->voice) gui->nicklist->voices++; else gui->nicklist->normal++; } g_slist_free(nicks); gui_nicklist_update_label(gui->nicklist); } void gui_nicklists_init(void) { signal_add("nicklist new", (SIGNAL_FUNC) gui_nicklist_add); signal_add("nicklist remove", (SIGNAL_FUNC) gui_nicklist_remove); signal_add("nicklist changed", (SIGNAL_FUNC) gui_nicklist_changed); signal_add("nick mode changed", (SIGNAL_FUNC) gui_nicklist_mode_changed); } void gui_nicklists_deinit(void) { signal_remove("nicklist new", (SIGNAL_FUNC) gui_nicklist_add); signal_remove("nicklist remove", (SIGNAL_FUNC) gui_nicklist_remove); signal_remove("nicklist changed", (SIGNAL_FUNC) gui_nicklist_changed); signal_remove("nick mode changed", (SIGNAL_FUNC) gui_nicklist_mode_changed); }
#ifndef LINUX_MM_INLINE_H #define LINUX_MM_INLINE_H #include <linux/huge_mm.h> /** * page_is_file_cache - should the page be on a file LRU or anon LRU? * @page: the page to test * * Returns 1 if @page is page cache page backed by a regular filesystem, * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. * Used by functions that manipulate the LRU lists, to sort a page * onto the right LRU list. * * We would like to get this info without a page flag, but the state * needs to survive until the page is last deleted from the LRU, which * could be as far down as __page_cache_release. */ static inline int page_is_file_cache(struct page *page) { return !PageSwapBacked(page); } static inline void __add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l, struct list_head *head) { list_add(&page->lru, head); __mod_zone_page_state(zone, NR_LRU_BASE + l, hpage_nr_pages(page)); mem_cgroup_add_lru_list(page, l); } static inline void add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l) { __add_page_to_lru_list(zone, page, l, &zone->lruvec.lists[l]); } static inline void del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l) { list_del(&page->lru); __mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page)); mem_cgroup_del_lru_list(page, l); } /** * page_lru_base_type - which LRU list type should a page be on? * @page: the page to test * * Used for LRU list index arithmetic. * * Returns the base LRU type - file or anon - @page should be on. */ static inline enum lru_list page_lru_base_type(struct page *page) { if (page_is_file_cache(page)) return LRU_INACTIVE_FILE; return LRU_INACTIVE_ANON; } static inline void del_page_from_lru(struct zone *zone, struct page *page) { enum lru_list l; list_del(&page->lru); if (PageUnevictable(page)) { __ClearPageUnevictable(page); l = LRU_UNEVICTABLE; } else { l = page_lru_base_type(page); if (PageActive(page)) { __ClearPageActive(page); l += LRU_ACTIVE; } } __mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page)); mem_cgroup_del_lru_list(page, l); } /** * page_lru - which LRU list should a page be on? * @page: the page to test * * Returns the LRU list a page should be on, as an index * into the array of LRU lists. */ static inline enum lru_list page_lru(struct page *page) { enum lru_list lru; if (PageUnevictable(page)) lru = LRU_UNEVICTABLE; else { lru = page_lru_base_type(page); if (PageActive(page)) lru += LRU_ACTIVE; } return lru; } #endif
#ifndef _HAL_AD_H_3467_ #define _HAL_AD_H_3467_ /****************************************************************************** * @author MaKun on 200612 * @note * for AD transformation * * @history * @modified by zhangwei on 20070101 * revise source code from MaKun * *****************************************************************************/ #include "hal_foundation.h" typedef struct{ uint8 id; //TiFunEventHandler callback; //void * callback_owner; }TiAdConversion; TiAdConversion * ad_construct( uint8 id, char * buf, uint8 size ); void ad_configutre(TiAdConversion * ad); void ad_destroy( TiAdConversion *ad ); void ad_start( TiAdConversion * ad, TiFunEventHandler callback, void * owner ); uint16 ad_read(TiAdConversion * ad, char * buf, uint8 size, uint8 opt ); #endif
#include "mpi.h" #include <stdio.h> int np, rank; int main(int argc, char **argv) { float f; MPI_Status status; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &np); MPI_Comm_rank(MPI_COMM_WORLD, &rank); if(rank==0) { f = (float) rank + 0.2; } MPI_Bcast(&f, 1, MPI_FLOAT, 0, MPI_COMM_WORLD); printf("Node %d received %f.\n", rank, f); MPI_Finalize(); return 0; }
/****************************************************************************** Copyright (C) 2013 by Hugh Bailey <obs.jim@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ******************************************************************************/ #pragma once #include "effect-parser.h" #include "graphics.h" #ifdef __cplusplus extern "C" { #endif /* * Effects introduce a means of bundling together shader text into one * file with shared functions and parameters. This is done because often * shaders must be duplicated when you need to alter minor aspects of the code * that cannot be done via constants. Effects allow developers to easily * switch shaders and set constants that can be used between shaders. * * Effects are built via the effect parser, and shaders are automatically * generated for each technique's pass. */ /* ------------------------------------------------------------------------- */ enum effect_section { EFFECT_PARAM, EFFECT_TECHNIQUE, EFFECT_SAMPLER, EFFECT_PASS }; /* ------------------------------------------------------------------------- */ struct gs_effect_param { char *name; enum effect_section section; enum gs_shader_param_type type; bool changed; DARRAY(uint8_t) cur_val; DARRAY(uint8_t) default_val; gs_effect_t *effect; /*char *full_name; float scroller_min, scroller_max, scroller_inc, scroller_mul;*/ }; static inline void effect_param_init(struct gs_effect_param *param) { memset(param, 0, sizeof(struct gs_effect_param)); } static inline void effect_param_free(struct gs_effect_param *param) { bfree(param->name); //bfree(param->full_name); da_free(param->cur_val); da_free(param->default_val); } EXPORT void effect_param_parse_property(gs_eparam_t *param, const char *property); /* ------------------------------------------------------------------------- */ struct pass_shaderparam { struct gs_effect_param *eparam; gs_sparam_t *sparam; }; struct gs_effect_pass { char *name; enum effect_section section; gs_shader_t *vertshader; gs_shader_t *pixelshader; DARRAY(struct pass_shaderparam) vertshader_params; DARRAY(struct pass_shaderparam) pixelshader_params; }; static inline void effect_pass_init(struct gs_effect_pass *pass) { memset(pass, 0, sizeof(struct gs_effect_pass)); } static inline void effect_pass_free(struct gs_effect_pass *pass) { bfree(pass->name); da_free(pass->vertshader_params); da_free(pass->pixelshader_params); gs_shader_destroy(pass->vertshader); gs_shader_destroy(pass->pixelshader); } /* ------------------------------------------------------------------------- */ struct gs_effect_technique { char *name; enum effect_section section; struct gs_effect *effect; DARRAY(struct gs_effect_pass) passes; }; static inline void effect_technique_init(struct gs_effect_technique *t) { memset(t, 0, sizeof(struct gs_effect_technique)); } static inline void effect_technique_free(struct gs_effect_technique *t) { size_t i; for (i = 0; i < t->passes.num; i++) effect_pass_free(t->passes.array+i); da_free(t->passes); bfree(t->name); } /* ------------------------------------------------------------------------- */ struct gs_effect { bool processing; char *effect_path, *effect_dir; DARRAY(struct gs_effect_param) params; DARRAY(struct gs_effect_technique) techniques; struct gs_effect_technique *cur_technique; struct gs_effect_pass *cur_pass; gs_eparam_t *view_proj, *world, *scale; graphics_t *graphics; struct gs_effect *next; size_t loop_pass; bool looping; }; static inline void effect_init(gs_effect_t *effect) { memset(effect, 0, sizeof(struct gs_effect)); } static inline void effect_free(gs_effect_t *effect) { size_t i; for (i = 0; i < effect->params.num; i++) effect_param_free(effect->params.array+i); for (i = 0; i < effect->techniques.num; i++) effect_technique_free(effect->techniques.array+i); da_free(effect->params); da_free(effect->techniques); bfree(effect->effect_path); bfree(effect->effect_dir); effect->effect_path = NULL; effect->effect_dir = NULL; } EXPORT void effect_upload_params(gs_effect_t *effect, bool changed_only); EXPORT void effect_upload_shader_params(gs_effect_t *effect, gs_shader_t *shader, struct darray *pass_params, bool changed_only); #ifdef __cplusplus } #endif
/* * Interface calls to BIOS * * 2003-06-21 Georg Acher (georg@acher.org) * */ #include "boot.h" #include <stdarg.h> #include "video.h" /*------------------------------------------------------------------------*/ // Output window for USB messages int usb_curs_x=0; int usb_curs_y=0; void zxprintf(char* fmt, ...) { va_list ap; char buffer[1024]; int tmp_x, tmp_y; tmp_x=VIDEO_CURSOR_POSX; tmp_y=VIDEO_CURSOR_POSY; VIDEO_CURSOR_POSX=usb_curs_x; VIDEO_CURSOR_POSY=usb_curs_y; if ((VIDEO_CURSOR_POSY==0) || (VIDEO_CURSOR_POSY > (vmode.height -16))) { BootVideoClearScreen(&jpegBackdrop, 3*vmode.height/4, vmode.height); VIDEO_CURSOR_POSY=3*vmode.height/4; } va_start(ap, fmt); vsprintf(buffer,fmt,ap); //printk(buffer); va_end(ap); usb_curs_x=VIDEO_CURSOR_POSX; usb_curs_y=VIDEO_CURSOR_POSY; VIDEO_CURSOR_POSX=tmp_x; VIDEO_CURSOR_POSY=tmp_y; } /*------------------------------------------------------------------------*/ int zxsnprintf(char *buffer, size_t s, char* fmt, ...) { va_list ap; int x; va_start(ap, fmt); x=vsprintf(buffer,fmt,ap); va_end(ap); return x; } /*------------------------------------------------------------------------*/ int zxsprintf(char *buffer, char* fmt, ...) { va_list ap; int x; va_start(ap, fmt); x=vsprintf(buffer,fmt,ap); va_end(ap); return x; } /*------------------------------------------------------------------------*/
#ifndef QvkCircleWidget_H #define QvkCircleWidget_H #include <QWidget> #include <QLabel> #include <QPainter> #include <QDebug> class QvkCircleWidget: public QWidget { Q_OBJECT public: virtual ~QvkCircleWidget(); QvkCircleWidget( QWidget *parent ); QWidget *parentWidget; public: public slots: void setColor( QColor color ); void setDiameter( int value ); void setOpacity( double value ); void setRadiant( bool value ); QColor getColor(); int getDiameter(); double getOpacity(); bool getRadiant(); private: QColor pointerColor; int diameter; double pointerOpacity; bool radiant; private slots: protected: void paintEvent( QPaintEvent *event ); signals: }; #endif // QvkCircleWidget_H
/* * linux/arch/arm/mach-pxa/pxa27x.c * * Author: Nicolas Pitre * Created: Nov 05, 2002 * Copyright: MontaVista Software Inc. * * Code specific to PXA27x aka Bulverde. * * 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/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/pm.h> #include <linux/platform_device.h> #include <asm/hardware.h> #include <asm/irq.h> #include <asm/arch/pxa-regs.h> #include <asm/arch/ohci.h> #include "generic.h" /* Crystal clock: 13MHz */ #define BASE_CLK 13000000 /* * Get the clock frequency as reflected by CCSR and the turbo flag. * We assume these values have been applied via a fcs. * If info is not 0 we also display the current settings. */ unsigned int get_clk_frequency_khz( int info) { unsigned long ccsr, clkcfg; unsigned int l, L, m, M, n2, N, S; int cccr_a, t, ht, b; ccsr = CCSR; cccr_a = CCCR & (1 << 25); /* Read clkcfg register: it has turbo, b, half-turbo (and f) */ asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (clkcfg) ); t = clkcfg & (1 << 0); ht = clkcfg & (1 << 2); b = clkcfg & (1 << 3); l = ccsr & 0x1f; n2 = (ccsr>>7) & 0xf; m = (l <= 10) ? 1 : (l <= 20) ? 2 : 4; L = l * BASE_CLK; N = (L * n2) / 2; M = (!cccr_a) ? (L/m) : ((b) ? L : (L/2)); S = (b) ? L : (L/2); if (info) { printk( KERN_INFO "Run Mode clock: %d.%02dMHz (*%d)\n", L / 1000000, (L % 1000000) / 10000, l ); printk( KERN_INFO "Turbo Mode clock: %d.%02dMHz (*%d.%d, %sactive)\n", N / 1000000, (N % 1000000)/10000, n2 / 2, (n2 % 2)*5, (t) ? "" : "in" ); printk( KERN_INFO "Memory clock: %d.%02dMHz (/%d)\n", M / 1000000, (M % 1000000) / 10000, m ); printk( KERN_INFO "System bus clock: %d.%02dMHz \n", S / 1000000, (S % 1000000) / 10000 ); } return (t) ? (N/1000) : (L/1000); } /* * Return the current mem clock frequency in units of 10kHz as * reflected by CCCR[A], B, and L */ unsigned int get_memclk_frequency_10khz(void) { unsigned long ccsr, clkcfg; unsigned int l, L, m, M; int cccr_a, b; ccsr = CCSR; cccr_a = CCCR & (1 << 25); /* Read clkcfg register: it has turbo, b, half-turbo (and f) */ asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (clkcfg) ); b = clkcfg & (1 << 3); l = ccsr & 0x1f; m = (l <= 10) ? 1 : (l <= 20) ? 2 : 4; L = l * BASE_CLK; M = (!cccr_a) ? (L/m) : ((b) ? L : (L/2)); return (M / 10000); } /* * Return the current LCD clock frequency in units of 10kHz as */ unsigned int get_lcdclk_frequency_10khz(void) { unsigned long ccsr; unsigned int l, L, k, K; ccsr = CCSR; l = ccsr & 0x1f; k = (l <= 7) ? 1 : (l <= 16) ? 2 : 4; L = l * BASE_CLK; K = L / k; return (K / 10000); } EXPORT_SYMBOL(get_clk_frequency_khz); EXPORT_SYMBOL(get_memclk_frequency_10khz); EXPORT_SYMBOL(get_lcdclk_frequency_10khz); #ifdef CONFIG_PM int pxa_cpu_pm_prepare(suspend_state_t state) { switch (state) { case PM_SUSPEND_MEM: case PM_SUSPEND_STANDBY: return 0; default: return -EINVAL; } } void pxa_cpu_pm_enter(suspend_state_t state) { extern void pxa_cpu_standby(void); extern void pxa_cpu_suspend(unsigned int); if (state == PM_SUSPEND_STANDBY) CKEN = (1 << CKEN_MEMC) | (1 << CKEN_OSTIMER) | (1 << CKEN_LCD) | (1 << CKEN_PWM0); else CKEN = (1 << CKEN_MEMC) | (1 << CKEN_OSTIMER); /* ensure voltage-change sequencer not initiated, which hangs */ PCFR &= ~PCFR_FVC; /* Clear edge-detect status register. */ PEDR = 0xDF12FE1B; switch (state) { case PM_SUSPEND_STANDBY: pxa_cpu_standby(); break; case PM_SUSPEND_MEM: pxa_cpu_suspend(PWRMODE_SLEEP); break; } } #endif /* * device registration specific to PXA27x. */ static u64 pxa27x_dmamask = 0xffffffffUL; static struct resource pxa27x_ohci_resources[] = { [0] = { .start = 0x4C000000, .end = 0x4C00ff6f, .flags = IORESOURCE_MEM, }, [1] = { .start = IRQ_USBH1, .end = IRQ_USBH1, .flags = IORESOURCE_IRQ, }, }; static struct platform_device ohci_device = { .name = "pxa27x-ohci", .id = -1, .dev = { .dma_mask = &pxa27x_dmamask, .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(pxa27x_ohci_resources), .resource = pxa27x_ohci_resources, }; void __init pxa_set_ohci_info(struct pxaohci_platform_data *info) { ohci_device.dev.platform_data = info; } static struct platform_device *devices[] __initdata = { &ohci_device, }; static int __init pxa27x_init(void) { return platform_add_devices(devices, ARRAY_SIZE(devices)); } subsys_initcall(pxa27x_init);
// Snap Websites Server -- handle the server status // Copyright (c) 2016-2019 Made to Order Software Corp. 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 St, Fifth Floor, Boston, MA 02110-1301 USA #pragma once #include "status.h" namespace snap_manager { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" class server_status { public: server_status(QString const & filename); server_status(QString const & cluster_status_path, QString const & server); ~server_status(); // "vector access" void set_field(status_t const & status); QString get_field(QString const & plugin_name, QString const & field_name) const; status_t::state_t get_field_state(QString const & plugin_name, QString const & field_name) const; status_t const & get_field_status(QString const & plugin_name, QString const & field_name) const; int size() const; status_t::map_t const & get_statuses() const; size_t count_warnings() const; size_t count_errors() const; QString to_string() const; bool from_string(QString const & status); QString const & get_filename() const; // whether the read or write generated an error bool has_error() const; // file access (read) bool read_all(); bool read_header(); // file access (write) bool write(); private: void close(); // reading helper functions bool open_for_read(); bool readline(QString & result); bool readvar(QString & name, QString & value); QString f_filename = QString(); status_t::map_t f_statuses = status_t::map_t(); int f_fd = -1; FILE * f_file = nullptr; bool f_has_error = false; }; #pragma GCC diagnostic pop } // snap_manager namespace // vim: ts=4 sw=4 et
#ifndef __TcpSegment_H #define __TcpSegment_H class TcpSegment { public: struct TcpPackageInfo { DWORD mIp; WORD mPort; std::string sData; bool bFinish; DWORD dwTime; TcpPackageInfo() { dwTime = 0; mIp = 0; mPort = 0; sData = ""; bFinish = false; } }; public: void AddPackage(DWORD dwKey,DWORD dwAck,DWORD sIp,WORD wPort,std::string sData,byte cbFlag,bool fisrt = false); bool GetPackage(std::list<TcpSegment::TcpPackageInfo>& packs); protected: private: std::map<DWORD,std::map<DWORD,TcpPackageInfo>> mTcpSegments; }; #endif //__TcpSegment_H
/* ./lib/kliba.asm*/ PUBLIC void out_byte(u16 port, u8 value); PUBLIC u8 in_byte(u16 port); PUBLIC void disp_str(char *str); PUBLIC void disp_color_str(char *str, int color); /* ./kernel/i8258A.c*/ PUBLIC void init_8259A(); PUBLIC void put_irq_handler(int irq, irq_handler handler); PUBLIC void spurious_irq(); /* kernel/clock.c */ PUBLIC void clock_handler(int irq); PUBLIC void milli_delay(int milli_sec); PUBLIC void init_clock(); /* ./kernel/protect.c*/ PUBLIC void init_prot(); /* ./kernel/main.c */ void test_a(); void test_b(); void test_c(); /* ./lib/klib.c */ PUBLIC void delay(int times); /* kernel/kernel.asm */ void restart(); PUBLIC void sys_call(); /* kernel/protect.c */ PUBLIC u32 seg2phys(u16 seg); /* ./lib/string.asm*/ /* kernel/proc.c */ PUBLIC int sys_get_ticks(); /* kernel/keyboard.c */ PUBLIC void init_keyboard(); PUBLIC void keyboard_handler(); PUBLIC void keyboard_read(TTY *p_tty); /* kernel/tty.c */ PUBLIC void task_tty(); PUBLIC void in_process(TTY *p_tty, u32 key); PUBLIC void tty_write(TTY *p_tty, char *buf, int len); PUBLIC int sys_write_system(char *buf, int len, PROCESS *p_proc); int vsprintf(char *buf, const char *fmt, va_list args); PUBLIC void write(char *buf, int len); /* kernel/console.c*/ PUBLIC void out_char(CONSOLE *p_con, char ch); PUBLIC void init_console(TTY *p_tty); PUBLIC void select_console(int nr_console); PUBLIC void scroll_screen(CONSOLE *p_con, int direction); /* kernel/vsprintf.c*/ int vsprintf(char *buf, const char *fmt, va_list args); /* kernel/printf.c*/ int printf(const char *fmt, ...); /* kernel/syscall.asm*/ PUBLIC int get_ticks(); PUBLIC void write(char *buf, int len); PUBLIC int get_ticks(); /* lib/klib.c*/
/* Copyright (c) 2009-2010 Jay Sorg Copyright (c) 2010 Vic Lee 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 __CLIPRDR_MAIN_H #define __CLIPRDR_MAIN_H /* CLIPRDR_HEADER.msgType */ #define CB_MONITOR_READY 1 #define CB_FORMAT_LIST 2 #define CB_FORMAT_LIST_RESPONSE 3 #define CB_FORMAT_DATA_REQUEST 4 #define CB_FORMAT_DATA_RESPONSE 5 #define CB_TEMP_DIRECTORY 6 #define CB_CLIP_CAPS 7 #define CB_FILECONTENTS_REQUEST 8 #define CB_FILECONTENTS_RESPONSE 9 #define CB_LOCK_CLIPDATA 10 #define CB_UNLOCK_CLIPDATA 11 /* CLIPRDR_HEADER.msgFlags */ #define CB_RESPONSE_OK 1 #define CB_RESPONSE_FAIL 2 #define CB_ASCII_NAMES 4 /* CLIPRDR_CAPS_SET.capabilitySetType */ #define CB_CAPSTYPE_GENERAL 1 /* CLIPRDR_GENERAL_CAPABILITY.lengthCapability */ #define CB_CAPSTYPE_GENERAL_LEN 12 /* CLIPRDR_GENERAL_CAPABILITY.version */ #define CB_CAPS_VERSION_1 1 #define CB_CAPS_VERSION_2 2 /* CLIPRDR_GENERAL_CAPABILITY.generalFlags */ #define CB_USE_LONG_FORMAT_NAMES 2 #define CB_STREAM_FILECLIP_ENABLED 4 #define CB_FILECLIP_NO_FILE_PATHS 8 #define CB_CAN_LOCK_CLIPDATA 16 /* Clipboard constants, "borrowed" from GCC system headers in the w32 cross compiler this is the CF_ set when WINVER is 0x0400 */ #define CF_RAW 0 #define CF_FREERDP_HTML 0xd010 #define CF_FREERDP_PNG 0xd011 #define CF_FREERDP_JPEG 0xd012 #define CF_FREERDP_GIF 0xd013 #define CFSTR_HTML "HTML Format" #define CFSTR_PNG "PNG" #define CFSTR_JPEG "JFIF" #define CFSTR_GIF "GIF" #ifndef _WIN32 #ifndef CF_TEXT #define CF_TEXT 1 #define CF_BITMAP 2 #define CF_METAFILEPICT 3 #define CF_SYLK 4 #define CF_DIF 5 #define CF_TIFF 6 #define CF_OEMTEXT 7 #define CF_DIB 8 #define CF_PALETTE 9 #define CF_PENDATA 10 #define CF_RIFF 11 #define CF_WAVE 12 #define CF_UNICODETEXT 13 #define CF_ENHMETAFILE 14 #define CF_HDROP 15 #define CF_LOCALE 16 #define CF_MAX 17 #define CF_OWNERDISPLAY 128 #define CF_DSPTEXT 129 #define CF_DSPBITMAP 130 #define CF_DSPMETAFILEPICT 131 #define CF_DSPENHMETAFILE 142 #define CF_PRIVATEFIRST 512 #define CF_PRIVATELAST 767 #define CF_GDIOBJFIRST 768 #define CF_GDIOBJLAST 1023 #endif #endif typedef struct cliprdr_plugin cliprdrPlugin; int cliprdr_send_packet(cliprdrPlugin * plugin, int type, int flag, char * data, int length); /* implementations are in the hardware file */ void * clipboard_new(cliprdrPlugin * plugin); int clipboard_sync(void * device_data); int clipboard_format_list(void * device_data, int flag, char * data, int length); int clipboard_format_list_response(void * device_data, int flag); int clipboard_request_data(void * device_data, uint32 format); int clipboard_handle_data(void * device_data, int flag, char * data, int length); int clipboard_handle_caps(void * device_data, int flag, char * data, int length); void clipboard_free(void * device_data); #endif
/* UNIX V7 source code: see /COPYRIGHT or www.tuhs.org for details. */ # /* * UNIX shell * * S. R. Bourne * Bell Telephone Laboratories * */ #include "defs.h" /* ======== input output and file copying ======== */ void initf(UFD fd) { register FILE f = standin; f->fdes = fd; f->fsiz = ((flags & (oneflg | ttyflg)) == 0 ? BUFSIZ : 1); f->fnxt = f->fend = f->fbuf; f->feval = 0; f->flin = 1; f->feof = FALSE; } int estabf(register const char *s) { register FILE f; f = standin; f->fdes = -1; f->fend = length(s) + (f->fnxt = (char *)s);/*FIXME review */ f->flin = 1; return (f->feof = (s == 0)); } void push(FILE af) { register FILE f; f = af; f->fstak = standin; f->feof = 0; f->feval = 0; standin = f; } int pop(void) { register FILE f; f = standin; if (f->fstak) { if (f->fdes >= 0) close(f->fdes); standin = f->fstak; return (TRUE); } else return (FALSE); } void chkpipe(int *pv) { if (pipe(pv) < 0 || pv[INPIPE] < 0 || pv[OTPIPE] < 0) error(piperr); } int chkopen(const char *idf) { register int rc; if ((rc = open(idf, 0)) < 0) failed(idf, badopen); else return rc; } void sh_rename(register int f1, register int f2) { if (f1 != f2) { dup2(f1, f2); close(f1); if (f2 == 0) ioset |= 1; } } int create(const char *s) { register int rc; if ((rc = creat(s, 0666)) < 0) failed(s, badcreate); else return rc; } int tmpfil(void) { itos(serial++); movstr(numbuf, tmpnam); return create(tmpout); } /* set by trim */ BOOL nosubst; void copy(IOPTR ioparg) { CHAR c, *ends; register CHAR *cline, *clinep; int fd; register IOPTR iop; if (iop = ioparg) { copy(iop->iolst); ends = mactrim(iop->ioname); if (nosubst) iop->iofile &= ~IODOC; fd = tmpfil(); iop->ioname = cpystak(tmpout); iop->iolst = iotemp; iotemp = iop; cline = locstak(); for (;;) { clinep = cline; chkpr(NL); while ((c = (nosubst ? readc() : nextc(*ends)),!eolchar(c))) { *clinep++ = c; } *clinep = 0; if (eof || eq(cline, ends)) break; *clinep++ = NL; write(fd, cline, clinep - cline); } close(fd); } }
#include <stdio.h> int main() { int a = 10;//4¸ö×Ö½Ú´óС short b = 10; printf("%d\n", sizeof(b)); long c = 10; printf("%d\n", sizeof(c)); long long d = 10; printf("%d\n", sizeof(d)); unsigned int e = 10; printf("%d\n", sizeof(e)); //unsigned short f; //unsigned long g; //unsigned long long i; //int i1; unsigned short abc = 0xffff; abc = abc + 1 + 99; printf("%d\n", abc); abc = 2; abc = abc - 5; printf("%d\n", abc); int i1 = 0x12345678; abc = i1; printf("%x\n", abc); short abc1 = -2; i1 = abc1; printf("%x\n", i1); unsigned short abc2 = 0; abc2 = abc2 - 1; printf("%d\n", abc2); int a1 = 0x12345678; printf("%p\n", &a1); }
/*------------------------------------------------------------------------- * * readfuncs.h * header file for read.c and readfuncs.c. These functions are internal * to the stringToNode interface and should not be used by anyone else. * * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * $PostgreSQL: pgsql/src/include/nodes/readfuncs.h,v 1.21 2004/12/31 22:03:34 pgsql Exp $ * *------------------------------------------------------------------------- */ #ifndef READFUNCS_H #define READFUNCS_H #include "nodes/nodes.h" /* * prototypes for functions in read.c (the lisp token parser) */ extern char *pg_strtok(int *length); extern char *debackslash(char *token, int length); extern void *nodeRead(char *token, int tok_len); /* * prototypes for functions in readfuncs.c */ extern Node *parseNodeString(void); #endif /* READFUNCS_H */
/* amd.h This file is part of a program that implements a Software-Defined Radio. Copyright (C) 2012, 2013 Warren Pratt, NR0V 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. The author can be reached by email at warren@wpratt.com */ #ifndef _amd_h #define _amd_h // ff defines for sbdemod #ifndef STAGES #define STAGES 7 #endif #ifndef OUT_IDX #define OUT_IDX (3 * STAGES) #endif typedef struct _amd { int run; int buff_size; // buffer size double *in_buff; // pointer to input buffer double *out_buff; // pointer to output buffer int mode; // demodulation mode double sample_rate; // sample rate double dc; // dc component in demodulated output double fmin; // pll - minimum carrier freq to lock double fmax; // pll - maximum carrier freq to lock double omega_min; // pll - minimum lock check parameter double omega_max; // pll - maximum lock check parameter double zeta; // pll - damping factor; as coded, must be <=1.0 double omegaN; // pll - natural frequency double phs; // pll - phase accumulator double omega; // pll - locked pll frequency double fil_out; // pll - filter output double g1, g2; // pll - filter gain parameters double tauR; // carrier removal time constant double tauI; // carrier insertion time constant double mtauR; // carrier removal multiplier double onem_mtauR; // 1.0 - carrier_removal_multiplier double mtauI; // carrier insertion multiplier double onem_mtauI; // 1.0 - carrier_insertion_multiplier double a[3 * STAGES + 3]; // Filter a variables double b[3 * STAGES + 3]; // Filter b variables double c[3 * STAGES + 3]; // Filter c variables double d[3 * STAGES + 3]; // Filter d variables double c0[STAGES]; // Filter coefficients - path 0 double c1[STAGES]; // Filter coefficients - path 1 double dsI; // delayed sample, I path double dsQ; // delayed sample, Q path double dc_insert; // dc component to insert in output int sbmode; // sideband mode int levelfade; // Fade Leveler switch }amd, *AMD; extern AMD create_amd ( int run, int buff_size, double *in_buff, double *out_buff, int mode, int levelfade, int sbmode, int sample_rate, double fmin, double fmax, double zeta, double omegaN, double tauR, double tauI ); extern void init_amd (AMD a); extern void destroy_amd (AMD a); extern void flush_amd (AMD a); extern void xamd (AMD a); extern void setBuffers_amd (AMD a, double* in, double* out); extern void setSamplerate_amd (AMD a, int rate); extern void setSize_amd (AMD a, int size); // RXA Properties extern __declspec (dllexport) void SetRXAAMDRun(int channel, int run); extern __declspec (dllexport) void SetRXAAMDSBMode(int channel, int sbmode); extern __declspec (dllexport) void SetRXAAMDFadeLevel(int channel, int levelfade); #endif
#include <pebble.h> #include "skipwin.h" #include "common.h" #include "commonwin.h" #define LEN_DATE 12 static SkipSetCallBack s_set_event; static time_t s_skip_until; static char *s_date; static bool s_show_noskip; static Window *s_window; static GBitmap *s_res_img_upaction; static GBitmap *s_res_img_okaction; static GBitmap *s_res_img_downaction; static GFont s_res_gothic_24; static GFont s_res_gothic_28; static ActionBarLayer *s_actionbarlayer; static Layer *s_info_layer; static void draw_info(Layer *layer, GContext *ctx) { GRect bounds = layer_get_bounds(layer); graphics_context_set_text_color(ctx, GColorWhite); // Draw title graphics_draw_text(ctx, "Skip Until", s_res_gothic_24, GRect(2, (bounds.size.h/2)-55, bounds.size.w-4, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); // Draw date graphics_draw_text(ctx, s_date, s_res_gothic_28, GRect(2, (bounds.size.h/2)-18, bounds.size.w-4, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); // Draw "No Skipping" if (s_show_noskip) graphics_draw_text(ctx, "(No skipping)", s_res_gothic_24, GRect(7, (bounds.size.h/2)+18, bounds.size.w-14, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } static void initialise_ui(void) { s_date = malloc(LEN_DATE); GRect bounds; Layer *root_layer = NULL; s_window = window_create_fullscreen(&root_layer, &bounds); s_res_img_upaction = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_UPACTION2); s_res_img_okaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_OKACTION); s_res_img_downaction = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_DOWNACTION2); s_res_gothic_24 = fonts_get_system_font(FONT_KEY_GOTHIC_24); s_res_gothic_28 = fonts_get_system_font(FONT_KEY_GOTHIC_28); // s_actionbarlayer s_actionbarlayer = actionbar_create(s_window, root_layer, &bounds, s_res_img_upaction, s_res_img_okaction, s_res_img_downaction); // info layer s_info_layer = layer_create_with_proc(root_layer, draw_info, GRect(0, 0, bounds.size.w-ACTION_BAR_WIDTH, bounds.size.h)); } static void destroy_ui(void) { window_destroy(s_window); action_bar_layer_destroy(s_actionbarlayer); layer_destroy(s_info_layer); gbitmap_destroy(s_res_img_upaction); gbitmap_destroy(s_res_img_okaction); gbitmap_destroy(s_res_img_downaction); free(s_date); } static void handle_window_unload(Window* window) { destroy_ui(); } static time_t get_today() { return strip_time(time(NULL) + get_UTC_offset(NULL)); } static void update_date_display() { time_t skip_utc = s_skip_until - get_UTC_offset(NULL); struct tm *t = localtime(&skip_utc); strftime(s_date, LEN_DATE, "%a, %b %d", t); s_show_noskip = (s_skip_until <= get_today()); layer_mark_dirty(s_info_layer); } static void select_click_handler(ClickRecognizerRef recognizer, void *context) { // Close this screen hide_skipwin(); // Pass skip date back (skip date of today or earlier disables skip) s_set_event((s_skip_until <= get_today()) ? 0 : s_skip_until); } static void up_click_handler(ClickRecognizerRef recognizer, void *context) { time_t today = get_today(); if (s_skip_until <= today) // If the skip date was already set to today, wrap around to 4 weeks from now s_skip_until = today + (28 * 24 * 60 * 60); else // Set the date to the previous date s_skip_until -= (24 * 60 * 60); update_date_display(); } static void down_click_handler(ClickRecognizerRef recognizer, void *context) { time_t today = get_today(); if (day_diff(today, s_skip_until) >= 28) // If the skip date is already set to 4 weeks from today, wrap around to today s_skip_until = today; else // Set the date to the next date s_skip_until += (24 * 60 * 60); update_date_display(); } static void click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler); window_single_click_subscribe(BUTTON_ID_UP, up_click_handler); window_single_repeating_click_subscribe(BUTTON_ID_UP, 50, up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 50, down_click_handler); } void show_skipwin(time_t skip_until, SkipSetCallBack set_event) { initialise_ui(); window_set_window_handlers(s_window, (WindowHandlers) { .unload = handle_window_unload, }); // Store pointer to callback function s_set_event = set_event; // Trap action bar clicks window_set_click_config_provider(s_window, click_config_provider); time_t today = get_today(); // Validate and store current skip date if (skip_until == 0) s_skip_until = today; else if (skip_until < today) s_skip_until = today; else s_skip_until = strip_time(skip_until); update_date_display(); window_stack_push(s_window, true); } void hide_skipwin(void) { window_stack_remove(s_window, true); }
/** Account class header. @file Account.h This file belongs to the SYNTHESE project (public transportation specialized software) Copyright (C) 2002 Hugues Romain - RCSmobility <contact@rcsmobility.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SYNTHESE_Account_H__ #define SYNTHESE_Account_H__ #include <string> #include "01_util/UId.h" #include "01_util/Registrable.h" namespace synthese { namespace security { class User; } namespace accounts { class Currency; /** Account. @ingroup m57 The account can be used in several ways : - standard account between two entities : leftUser and rightUser, with or without numbers. - template account handled by an entity : all left variables are null or empty. leftUser will be specified in the transactions. - internal accounts of an entity : leftUser and rightUser points to the entity. */ class Account : public util::RegistrableTemplate< Account> { private: uid _leftUserId; std::string _leftNumber; std::string _leftClassNumber; const Currency* _leftCurrency; uid _rightUserId; std::string _rightNumber; std::string _rightClassNumber; const Currency* _rightCurrency; std::string _name; bool _locked; uid _stockAccountId; double _unitPrice; public: Account(uid id=0); const uid getLeftUserId() const; const std::string& getLeftNumber() const; const std::string& getLeftClassNumber() const; const Currency* getLeftCurrency() const; const uid getRightUserId() const; const std::string& getRightNumber() const; const std::string& getRightClassNumber() const; const Currency* getRightCurrency() const; const std::string& getName() const; bool getLocked() const; uid getStockAccountId() const; double getUnitPrice() const; void setLeftUserId(uid id); void setLeftNumber(const std::string& LeftNumber); void setLeftClassNumber(const std::string& classNumber); void setLeftCurrency(const Currency* currency); void setRightUserId(uid id); void setRightNumber(const std::string& RightNumber); void setRightClassNumber(const std::string& classNumber); void setRightCurrency(const Currency* currency); void setName(const std::string& name); void setLocked(bool value); void setStockAccountId(uid id); void setUnitPrice(double value); }; } } #endif // SYNTHESE_Account_H__
/* * Copyright (C) 2004-2009 Geometer Plus <contact@geometerplus.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ #ifndef __ZLFILE_H__ #define __ZLFILE_H__ #include <string> #include <map> #include <shared_ptr.h> #include <ZLFileInfo.h> class ZLDir; class ZLInputStream; class ZLOutputStream; class ZLFile { private: static std::map<std::string,weak_ptr<ZLInputStream> > ourPlainStreamCache; public: static std::string fileNameToUtf8(const std::string &fileName); public: enum ArchiveType { NONE = 0, GZIP = 0x0001, BZIP2 = 0x0002, COMPRESSED = 0x00ff, ZIP = 0x0100, TAR = 0x0200, ARCHIVE = 0xff00, }; public: ZLFile(const std::string &path); ~ZLFile(); bool exists() const; size_t size() const; void forceArchiveType(ArchiveType type); bool isCompressed() const; bool isDirectory() const; bool isArchive() const; bool remove() const; const std::string &path() const; const std::string &name(bool hideExtension) const; const std::string &extension() const; std::string physicalFilePath() const; std::string resolvedPath() const; shared_ptr<ZLInputStream> inputStream() const; shared_ptr<ZLOutputStream> outputStream() const; shared_ptr<ZLDir> directory(bool createUnexisting = false) const; private: void fillInfo() const; shared_ptr<ZLInputStream> envelopeCompressedStream(shared_ptr<ZLInputStream> &base) const; private: std::string myPath; std::string myNameWithExtension; std::string myNameWithoutExtension; std::string myExtension; ArchiveType myArchiveType; mutable ZLFileInfo myInfo; mutable bool myInfoIsFilled; }; inline ZLFile::~ZLFile() {} inline bool ZLFile::isCompressed() const { return myArchiveType & COMPRESSED; } inline bool ZLFile::isArchive() const { return myArchiveType & ARCHIVE; } inline const std::string &ZLFile::path() const { return myPath; } inline const std::string &ZLFile::name(bool hideExtension) const { return hideExtension ? myNameWithoutExtension : myNameWithExtension; } inline const std::string &ZLFile::extension() const { return myExtension; } #endif /* __ZLFILE_H__ */
#include <stdlib.h> #include <glib.h> #include <lib.h> gint main(gint argc, gchar *argv[]) { hello_world(); return EXIT_SUCCESS; }
#ifndef __RT_HW_SERIAL_H__ #define __RT_HW_SERIAL_H__ #include <rthw.h> #include <rtthread.h> #include "mb9bf506r.h" #define SMR_SOE 0x01U #define SMR_BDS 0x04U #define SMR_SBL 0x08U #define SMR_WUCR 0x10U #define SMR_MD_UART 0x00U #define SMR_MD_UART_MP 0x20U #define SMR_MD_SIO 0x40U #define SMR_MD_LIN 0x60U #define SMR_MD_I2C 0x80U #define SCR_TXE 0x01U #define SCR_RXE 0x02U #define SCR_TBIE 0x04U #define SCR_TIE 0x08U #define SCR_RIE 0x10U #define SCR_UPGL 0x80U #define SSR_TBI 0x01U #define SSR_TDRE 0x02U #define SSR_RDRF 0x04U #define SSR_ORE 0x08U #define SSR_FRE 0x10U #define SSR_PE 0x20U #define SSR_REC 0x80U #define ESCR_P 0x08U #define ESCR_PEN 0x10U #define ESCR_INV 0x20U #define ESCR_ESBL 0x40U #define ESCR_FLWEN 0x80U #define ESCR_DATABITS_8 0x00U #define ESCR_DATABITS_5 0x01U #define ESCR_DATABITS_6 0x02U #define ESCR_DATABITS_7 0x03U #define ESCR_DATABITS_9 0x04U #define BPS 115200 /* serial baudrate */ #define UART_RX_BUFFER_SIZE 64 #define UART_TX_BUFFER_SIZE 64 struct serial_int_rx { rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; rt_uint32_t read_index, save_index; }; struct serial_int_tx { rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE]; rt_uint32_t write_index, save_index; }; /* * Enable/DISABLE Interrupt Controller */ /* deviation from MISRA-C:2004 Rule 19.7 */ #define UART_ENABLE_IRQ(n) NVIC_EnableIRQ((n)) #define UART_DISABLE_IRQ(n) NVIC_DisableIRQ((n)) struct serial_device { FM3_MFS03_UART_TypeDef* uart_device; /* rx structure */ struct serial_int_rx* int_rx; /* tx structure */ struct serial_int_tx* int_tx; }; rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial); void rt_hw_serial_isr(rt_device_t device); #endif
/* * * /arch/arm/mach-msm/include/mach/htc_headset_gpio.h * * HTC GPIO headset driver. * * Copyright (C) 2010 HTC, Inc. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef HTC_HEADSET_GPIO_H #define HTC_HEADSET_GPIO_H struct htc_headset_gpio_platform_data { unsigned int uart_gpio; unsigned int hpin_gpio; unsigned int mic_detect_gpio; unsigned int key_gpio; unsigned int key_enable_gpio; unsigned int mic_select_gpio; void (*config_headset_gpio)(void); unsigned int microp_channel; }; struct htc_headset_gpio_info { struct htc_headset_gpio_platform_data pdata; unsigned int hpin_irq; unsigned int hpin_debounce; unsigned int key_irq; unsigned int key_irq_type; int headset_state; struct wake_lock hs_wake_lock; }; #endif
/**************************************************************************** ** ** FreeSCH - Free SCHematic drawing program for electronic circuits. ** ** Copyright 2012 Warren Free ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of version 2 of the GNU General Public ** License as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, see <http://www.gnu.org/licenses/> ** ****************************************************************************/ #ifndef ALPHANUMERICNAME_H #define ALPHANUMERICNAME_H class AlphaNumericName { public: enum Portion { Normal, NoSuffix }; AlphaNumericName(); AlphaNumericName(const QString &); AlphaNumericName &operator =(const QString &); AlphaNumericName &operator =(const AlphaNumericName &); bool operator ==(const AlphaNumericName &rhs); bool operator < (const AlphaNumericName &rhs); bool operator <=(const AlphaNumericName &rhs) { return operator < (rhs) || operator == (rhs); } bool operator !=(const AlphaNumericName &rhs) { return !operator == (rhs); } bool operator > (const AlphaNumericName &rhs) { return !operator <= (rhs); } bool operator >=(const AlphaNumericName &rhs) { return !operator < (rhs); } QString toString(Portion = Normal) const; private: void split(const QString &); QString fullName; QString alpha; int numeric; QString suffix; }; #endif // ALPHANUMERICNAME_H
#ifndef _G1_GAME_OVER_LAYER_H_ #define _G1_GAME_OVER_LAYER_H_ #include "Common.h" #include "cocos2d.h" NAMESPACE_G1_BEGIN // The layer when game is over. class GameOverLayer : public cc::Layer { public: GameOverLayer(); virtual ~GameOverLayer(); static GameOverLayer* create(); virtual bool init() override; private: void onBack(cc::Ref* sender); bool onTouchBegan(cc::Touch* touch, cc::Event* event); void onTouchMoved(cc::Touch* touch, cc::Event* event); void onTouchEnded(cc::Touch* touch, cc::Event* event); void onTouchCancelled(cc::Touch* touch, cc::Event* event); private: CC_DISALLOW_COPY_AND_ASSIGN(GameOverLayer); }; NAMESPACE_G1_END #endif // _G1_GAME_OVER_LAYER_H_
/* Copyright (c) 2013, 2014 Montel Laurent <montel@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef GRAMMARLOADER_H #define GRAMMARLOADER_H #include <QObject> #include "grammar_export.h" namespace Grammar { class GrammarLoaderPrivate; class GrammarSettings; class GRAMMAR_EXPORT GrammarLoader : public QObject { Q_OBJECT public: static GrammarLoader *openGrammarLoader(); GrammarLoader(); ~GrammarLoader(); QStringList clients() const; QStringList languages() const; GrammarSettings *settings() const; Q_SIGNALS: void configurationChanged(); private: friend class GrammarLoaderPrivate; GrammarLoaderPrivate * const d; }; } #endif // GRAMMARLOADER_H
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* egg-secure-buffer.h - secure memory gtkentry buffer Copyright (C) 2009 Stefan Walter The Gnome Keyring Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The Gnome Keyring Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the Gnome Library; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/>. Author: Stef Walter <stef@memberwebs.com> */ #ifndef __EGG_SECURE_ENTRY_BUFFER_H__ #define __EGG_SECURE_ENTRY_BUFFER_H__ #include <gtk/gtk.h> G_BEGIN_DECLS #define EGG_TYPE_SECURE_ENTRY_BUFFER (egg_secure_entry_buffer_get_type ()) #define EGG_SECURE_ENTRY_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SECURE_ENTRY_BUFFER, EggSecureEntryBuffer)) #define EGG_SECURE_ENTRY_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SECURE_ENTRY_BUFFER, EggSecureEntryBufferClass)) #define EGG_IS_SECURE_ENTRY_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SECURE_ENTRY_BUFFER)) #define EGG_IS_SECURE_ENTRY_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SECURE_ENTRY_BUFFER)) #define EGG_SECURE_ENTRY_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SECURE_ENTRY_BUFFER, EggSecureEntryBufferClass)) typedef struct _EggSecureEntryBuffer EggSecureEntryBuffer; typedef struct _EggSecureEntryBufferClass EggSecureEntryBufferClass; typedef struct _EggSecureEntryBufferPrivate EggSecureEntryBufferPrivate; struct _EggSecureEntryBuffer { GtkEntryBuffer parent; /*< private >*/ EggSecureEntryBufferPrivate *pv; }; struct _EggSecureEntryBufferClass { GtkEntryBufferClass parent_class; }; GType egg_secure_entry_buffer_get_type (void) G_GNUC_CONST; GtkEntryBuffer * egg_secure_entry_buffer_new (void); G_END_DECLS #endif /* __EGG_SECURE_ENTRY_BUFFER_H__ */
#ifndef ICLIPBOARD_H #define ICLIPBOARD_H #include <string> class IClipboard { public: virtual const std::string &GetData() const = 0; virtual void SetData( const std::string &NewData ) = 0; }; #endif
// color.h - Color class declaration /* Copyright (C) 2007 Jeremiah LaRocco 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 RAY_TRACE_COLOR_H #define RAY_TRACE_COLOR_H #include "globaldefs.h" // Color is used to store a color class Color { public: Color(real r=0.0, real g=0.0, real b=0.0, real a=0.0); real &operator[](int idx); real &red(); const real getRed(); real &green(); const real getGreen(); real &blue(); const real getBlue(); real &alpha(); const real getAlpha(); bool operator==(const Color &col); Color operator*(const Color &col); Color operator*(real scale); Color operator*=(real scale); Color operator+=(const Color &col); Color operator+(const Color &col); Color operator-=(const Color &col); Color operator-(const Color &col); Color clamp(); real intensity(); private: static const int RED=0; static const int GREEN=1; static const int BLUE=2; static const int ALPHA=3; static const int NUM_CHANNELS=4; real color[NUM_CHANNELS]; }; #endif
#include <time.h> // Definitions and structures used by getnetworkparams and getadaptersinfo apis #define MAX_ADAPTER_DESCRIPTION_LENGTH 128 // arb. #define MAX_ADAPTER_NAME_LENGTH 256 // arb. #define MAX_ADAPTER_ADDRESS_LENGTH 8 // arb. // // IP_ADDRESS_STRING - store an IP address as a dotted decimal string // typedef struct { char String[4 * 4]; } IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING; // // IP_ADDR_STRING - store an IP address with its corresponding subnet mask, // both as dotted decimal strings // typedef struct _IP_ADDR_STRING { struct _IP_ADDR_STRING* Next; IP_ADDRESS_STRING IpAddress; IP_MASK_STRING IpMask; DWORD Context; } IP_ADDR_STRING, *PIP_ADDR_STRING; // // ADAPTER_INFO - per-adapter information. All IP addresses are stored as // strings // typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO* Next; DWORD ComboIndex; char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]; char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]; UINT AddressLength; BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH]; DWORD Index; UINT Type; UINT DhcpEnabled; PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING IpAddressList; IP_ADDR_STRING GatewayList; IP_ADDR_STRING DhcpServer; BOOL HaveWins; IP_ADDR_STRING PrimaryWinsServer; IP_ADDR_STRING SecondaryWinsServer; // these are officially defined as time_t, but since .NET changed time_t // from 32 to 64 bits, without updating this API, it's safer to use UINT UINT LeaseObtained; UINT LeaseExpires; } IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
// // APPreferencesController.h // AppPolice // // Created by Maksym on 20/11/13. // Copyright (c) 2013 Maksym Stefanchuk. All rights reserved. // #import <Cocoa/Cocoa.h> @class APURLTextField; @interface APAboutWindowController : NSWindowController <NSURLConnectionDelegate, NSURLConnectionDataDelegate> { @private NSURLConnection *_connection; NSMutableData *_receivedData; // used during NSURLConnection NSTextField *_statusTextField; struct { int update_available; } _flags; } - (IBAction)checkUpdates:(id)sender; - (void)interpretReceivedResult:(NSDictionary *)serverInfo; @property (assign) IBOutlet NSTextField *versionTextField; @property (assign) IBOutlet NSView *updateStatusView; @property (assign) IBOutlet NSButton *checkUpdatesButton; @property (assign) IBOutlet NSTextField *copyrightTextField; @property (assign) IBOutlet APURLTextField *homepageTextField; @end
/*************************************************************************** * Copyright (C) 2006 by EP Studios, Inc. * * mannd@epstudiossoftware.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef CATALOGCOMBOBOX_H #define CATALOGCOMBOBOX_H #include "catalog.h" #include <QtGui/QComboBox> #include <map> namespace EpNavigator { /** * Encapsulates specific behavior of the catalog combo box in Navigator. * * @author David Mann <mannd@epstudiossoftware.com> */ class CatalogComboBox : public QComboBox { Q_OBJECT public: CatalogComboBox(bool includeNetworkCatalog, QWidget *parent = 0); ~CatalogComboBox(); void refresh(bool includeNetworkCatalog); void setSource(Catalog::Source source); // return type of catalog ComboBox is pointing too Catalog::Source source(); private slots: void resetOther(); private: void setup(); void setBrowse(bool browse); bool browse_; // puts in blank line in combobox if true bool includeNetworkCatalog_; // if network enabled... typedef std::map<Catalog::Source, int> CatalogMap; CatalogMap sourceMap_; }; } #endif
/* *************************************************************************** * Ralink Tech Inc. * 4F, No. 2 Technology 5th Rd. * Science-based Industrial Park * Hsin-chu, Taiwan, R.O.C. * * (c) Copyright 2002-2004, Ralink Technology, Inc. * * All rights reserved. Ralink's source code is an unpublished work and the * use of a copyright notice does not imply otherwise. This source code * contains confidential trade secret material of Ralink Tech. Any attemp * or participation in deciphering, decoding, reverse engineering or in any * way altering the source code is stricitly prohibited, unless the prior * written consent of Ralink Technology, Inc. is obtained. *************************************************************************** Module Name: rt2880.c Abstract: Specific funcitons and variables for RT2880 Revision History: Who When What -------- ---------- ---------------------------------------------- */ #include "rt_config.h" #ifdef RT2880 /* Default EEPROM value for RT2880 */ UCHAR RT2880_EeBuffer[EEPROM_SIZE] = { 0x80,0x28,0x03,0x01,0x00,0x0C,0x43,0x28,0x60,0x20,0x01,0x08,0x14,0x18,0x01,0x80, 0x00,0x00,0x80,0x28,0x14,0x18,0x00,0x00,0x01,0x00,0x6A,0xFF,0x0C,0x00,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0x23,0x02,0x2C,0x00,0xFF,0xFF,0x1D,0x00,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0x0A,0x10,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x08,0xFF,0xFF, 0xFF,0xFF,0x0F,0x0F,0x0F,0x0F,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E, 0x13,0x13,0x12,0x12,0x11,0x11,0x10,0x10,0x10,0x10,0x0F,0x0F,0x0F,0x0F,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06, 0x06,0x06,0x06,0x06,0x04,0x04,0x04,0x04,0x04,0x04,0x05,0x05,0x05,0x05,0x05,0x05, 0x05,0x05,0x06,0x06,0x06,0x07,0x07,0x07,0x08,0x08,0x08,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x05,0x05,0x05,0x05,0x05,0x05,0x06,0x06,0x06,0x04, 0x05,0x05,0x05,0x05,0x05,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06, 0x06,0x06,0x06,0x06,0x07,0x07,0x08,0x09,0x09,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x66,0x66, 0xCC,0xAA,0x88,0x66,0xCC,0xAA,0x88,0x66,0xCC,0xAA,0x88,0x66,0xCC,0xAA,0x88,0x66, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, }; VOID RT2880_AsicEeBufferInit( IN RTMP_ADAPTER *pAd) { extern UCHAR *EeBuffer; EeBuffer = RT2880_EeBuffer; } #endif // RT2880 //
#ifndef __DRIVER_H_ #define __DRIVER_H_ #include <stdio.h> #include <string> #include <iosfwd> #include "types.h" #include "git.h" #include "file.h" FILE *FCEUD_UTF8fopen(const char *fn, const char *mode); inline FILE *FCEUD_UTF8fopen(const std::string &n, const char *mode) { return FCEUD_UTF8fopen(n.c_str(),mode); } EMUFILE_FILE* FCEUD_UTF8_fstream(const char *n, const char *m); inline EMUFILE_FILE* FCEUD_UTF8_fstream(const std::string &n, const char *m) { return FCEUD_UTF8_fstream(n.c_str(),m); } void FCEU_printf(char *format, ...); // Displays an error. Can block or not. void FCEUD_PrintError(const char *s); #endif
/*************************************************************************** * Copyright (C) 2005 by yunfan * * yunfan_zg@163.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef EVACHATVIEW_H #define EVACHATVIEW_H #include <tdehtmlview.h> #include <tdehtml_part.h> #include <kurl.h> #include <ntqdatetime.h> #include <ntqcolor.h> class TDEPopupMenu; class MenuPrivateData; //class TDEAction; class EvaChatView : public TDEHTMLPart { Q_OBJECT public: EvaChatView(TQWidget* parent = 0, const char* name = 0); virtual ~EvaChatView(); void append(TQString & nick, TQDateTime time, TQColor nameColor, bool isNormal, TQColor msgColor, TQ_UINT8 size, bool underline, bool italic, bool bold, TQString contents ); void updatePicture( const TQString filename , const TQString tmpFileName); void showInfomation(const TQString &info); void showFileNotification(const TQString &who, const TQString &filename, const int size, const unsigned int session, const bool isSend = false); void askResumeMode(const TQString filename, const unsigned int session); void showContents(); signals: void saveAsCustomSmiley(TQString ); // full name with absolute path void fileTransferAcceptRequest(const unsigned int session); void fileTransferSaveAsRequest(const unsigned int session); void fileTransferCancelRequest(const unsigned int session); void fileTransferResume(const unsigned int session, const bool isResume); protected: virtual void startDrag(); private: TQString wrapFontAttributes(TQColor color, TQ_UINT8 size, bool underline, bool italic, bool bold, TQString contents); TQString wrapNickName(TQString &nick, TQDateTime time, TQColor color, bool isNormal); TDEPopupMenu *menu; MenuPrivateData *d; TDEAction *copyAction; TQString buffer; bool m_isScrollAtBottom; void updateContents(const TQString &contents); static const TQString protocolAccept; static const TQString protocolSaveAs; static const TQString protocolCancel; static const TQString protocolResume; static const TQString protocolNewOne; private slots: void slotScrollToBottom(); void slotPopupMenu(const TQString &url, const TQPoint &point); void slotSelectionChanged(); void slotLinkClicked( const KURL & urls, const KParts::URLArgs &); void copy(); void searchProvider(); void openSelection(); void slotCopyLinkLocation(); void slotCopyImage(); void slotSaveImageAs(); void slotSaveAsCustomSmiley(); }; #endif
// // MyModule.h This file is a part of the IKAROS project // // Copyright (C) 2012 <Author Name> // // 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 // // See http://www.ikaros-project.org/ for more information. // #ifndef MimicHead_ #define MimicHead_ #include "IKAROS.h" #include <iostream> #include <cstdio> #include <ctime> class MimicHead: public Module { public: static Module * Create(Parameter * p) { return new MimicHead(p); } MimicHead(Parameter * p) : Module(p) {} virtual ~MimicHead(); void Init(); void Tick(); int t; double movement_timer; std::clock_t start_time; double fipplaTimer; int movement_type; int row; int max_rows; int input_length; //Parameters float baysian_threshold; int max_movements; float outlier_limit_angle; float outlier_limit_rotation; float limit_angle; float limit_rotation; bool load_data; bool movement_in_progress; float * buffer_angle; float * buffer_rotation; float * output_movements_angle; float * output_movements_rotation; float * out_head_angle; float * out_head_rotation; float * input_movement; float * mean_value; float * variance_value; float * head_angle_in; float * head_rotation_in; float * mean_array; float * variance_array; float ** movement_matrix; float * angles_out; }; #endif
#ifndef JC_DATABSEFACTORY_H_ #define JC_DATABSEFACTORY_H_ #include "Common.h" #include "JC_Config.h" #include "MC_MySQL.h" #include "MC_Oracle.h" class JC_DatabseFactory { public: virtual MI_Database * createDB()=0; }; class JC_DatabseFactoryMySQL: public JC_DatabseFactory { public: MI_Database * createDB(){ return new MC_MySQL(); }; }; class JC_DatabseFactoryOracle: public JC_DatabseFactory { public: virtual MI_Database * createDB(){ return new MC_Oracle(); }; }; MI_Database * GetDataBase(JC_Config* config, JI_CgiLogger * logger, JE_Database_Type dbType); enum JE_DataProvider_FieldsType { JE_DataProvider_FieldsTyeText, JE_DataProvider_FieldsTyeNumber, JE_DataProvider_FieldsTyeDateTime, JE_DataProvider_FieldsTyeDate, JE_DataProvider_FieldsTyeIP, JE_DataProvider_FieldsTyeCountry, JE_DataProvider_FieldsTyeApplication, JE_DataProvider_FieldsTyeProtocol, JE_DataProvider_FieldsTyeMAC, JE_DataProvider_FieldsTyeBool, JE_DataProvider_FieldsTyeMAX }; #endif /* JC_DATABSEFACTORY_H_ */
#import <UIKit/UIKit.h> #import "ReaderPost.h" #import "ReaderPostView.h" #import "ReaderCommentTableViewCell.h" @interface ReaderPostDetailViewController : UITableViewController<UITableViewDataSource, UITableViewDelegate, ReaderPostViewDelegate, ReaderCommentTableViewCellDelegate, NSFetchedResultsControllerDelegate> @property (nonatomic, strong) ReaderPost *post; @property (nonatomic, assign) BOOL showInlineActionBar; - (id)initWithPost:(ReaderPost *)post featuredImage:(UIImage *)image avatarImage:(UIImage *)avatarImage; - (id)initWithPost:(ReaderPost *)post avatarImageURL:(NSURL *)avatarImageURL; - (void)updateFeaturedImage:(UIImage *)image; @end
/* * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore) * Copyright(c) 1995-99 Andrew Lister * * All rights reserved * 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 Bellcore not be used in advertising * or publicity pertaining to this material without the specific, * prior written permission of an authorized representative of * Bellcore. * * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX- * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN- * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS. THE * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT- * ING TO THE SOFTWARE. * * $Id: Actions.h,v 1.1 1999-09-11 01:25:36 fnevgeny Exp $ */ /* * Actions.h created by Andrew Lister (6 August, 1995) */ #ifndef _Xbae_Actions_h #define _Xbae_Actions_h #include <Xbae/Macros.h> /* * Actions */ void xbaeEditCellACT P((Widget, XEvent *, String *, Cardinal *)); void xbaeCancelEditACT P((Widget, XEvent *, String *, Cardinal *)); void xbaeCommitEditACT P((Widget, XEvent *, String *, Cardinal *)); void xbaeSelectCellACT P((Widget, XEvent *, String *, Cardinal *)); void xbaeDefaultActionACT P((Widget, XEvent *, String *, Cardinal *)); void xbaeResizeColumnsACT P((Widget, XEvent *, String *, Cardinal *)); void xbaeTraverseNextACT P((Widget, XEvent *, String *, Cardinal *)); void xbaeTraversePrevACT P((Widget, XEvent *, String *, Cardinal *)); void xbaeProcessDragACT P((Widget, XEvent *, String *, Cardinal *)); void xbaeHandleClick P((Widget, XtPointer, XEvent *, Boolean *)); void xbaeHandleMotionACT P((Widget, XEvent *, String *, Cardinal *)); void xbaePageDownACT P((Widget, XEvent *, String *, Cardinal *)); void xbaePageUpACT P((Widget, XEvent *, String *, Cardinal *)); #endif
/* * Test main client */ #include <stdio.h> #include "sika.h" #include "network.h" void on_data_rev(int id, struct connection *p_conn) { printf("ID [%d] receives data", id); printf("Data: [%s]", p_conn->read_buf.data); p_conn->read_buf.len = 0; } void on_closed(int id, struct connection *p_conn) { printf("ID [%d] closed", id); } int main() { initialize(); int id = _connect("localhost", "9090", on_data_rev, NULL, NULL, on_closed, NULL); printf("Connection returns %d\n", id); printf("Wait to close\n"); wait_to_close(); return 0; }
/* * Author: Jiasheng.chen@celestialsemi.com * Version0.1 Inital @2008.02.18 */ #include "spi_func.h" #include "../stdlib/c_stdlib.h" /*#define SPI_FUNC_ENA*/ enum _SPI_CONST_ { SPI_CTRLR0 = 0x10173000, SPI_CTRLR1 = 0x10173004, SPI_SSIENR = 0x10173008, SPI_SER = 0x10173010, SPI_BAUDR = 0x10173014, SPI_SR = 0x10173028, SPI_DR = 0x10173060, SPI_BDINIT = 0x00000038, //@for 55MHz spi internal clock frequency SPI_CR0INI = 0x00000307, SPI_CR1INI = 0x000003ff, SPI_RX_CNT = 0x10173024, SMC_BOOT = 0x10100034, }; #define SPI_REG_WRITE_HALF(addr, data) (*((volatile unsigned short *)(addr)) = (data)) #define SPI_REG_READ_BYTES(addr) (*((volatile unsigned char *)(addr))) unsigned char addr_len = 1; int SPIOpen(void) { #ifdef SPI_FUNC_ENA SPI_REG_WRITE_HALF(SPI_SSIENR,0x0); #if 0 if(SPI_REG_READ_BYTES(SMC_BOOT) & 0x2) SPI_REG_WRITE_HALF(SPI_BAUDR, 0x37); /* 0x4 0xc8(256K)*/ else SPI_REG_WRITE_HALF(SPI_BAUDR, 0x37); /* SPI_BDINIT */ #endif SPI_REG_WRITE_HALF(SPI_BAUDR, 0xc8); SPI_REG_WRITE_HALF(SPI_SER , 0x1); SPI_REG_WRITE_HALF(SPI_CTRLR0, SPI_CR0INI|(((SPI_REG_READ_BYTES(SMC_BOOT)) & 0xc)<<4)); addr_len=SPI_REG_READ_BYTES(SMC_BOOT) >> 5; #else asm_reset_spi(); #endif return 1; } int SPIRead_1K(unsigned int StartAddr, unsigned char *Buf) { #ifdef SPI_FUNC_ENA int i = 0; int j = 0; assert((StartAddr & 0x3ff) == 0); SPI_REG_WRITE_HALF(SPI_SSIENR,0x0); SPI_REG_WRITE_HALF(SPI_CTRLR1, SPI_CR1INI); SPI_REG_WRITE_HALF(SPI_SSIENR,0x1); SPI_REG_WRITE_HALF(SPI_DR,0x3); if(addr_len>=2) SPI_REG_WRITE_HALF(SPI_DR,((StartAddr>>16) & 0xff)); if(addr_len>=1) SPI_REG_WRITE_HALF(SPI_DR,((StartAddr>>8) & 0xff)); SPI_REG_WRITE_HALF(SPI_DR,(StartAddr & 0xff)); while(i<=SPI_CR1INI) { while(!(j=SPI_REG_READ_BYTES(SPI_RX_CNT))); while(j>0) { Buf[i]=SPI_REG_READ_BYTES(SPI_DR); ++i; --j; } } SPI_REG_WRITE_HALF(SPI_SSIENR,0x0); #else asm_spi_read_1k(StartAddr, Buf); #endif return 1024; } int SPIClose(void) { #ifdef SPI_FUNC_ENA SPI_REG_WRITE_HALF(SPI_SSIENR,0x0); SPI_REG_WRITE_HALF(SPI_SER , 0x0); #endif return 1; }
/* $Id: exact.c,v 1.19 2004/03/31 20:25:21 doug Exp $ * * This file is part of EXACT. * * EXACT 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. * * EXACT 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 EXACT; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "config.h" #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <regex.h> #include <assert.h> #include <unistd.h> #include <signal.h> #include <sys/stat.h> #include <string.h> #ifdef HAVE_GETOPT_H #include <getopt.h> #else #include "getopt.h" #endif #include "tail.h" #include "logger.h" #include "match.h" #include "conffile.h" #include "auth.h" #include "daemon.h" #include "errno.h" typedef struct { int foreground; int sleep; int debug; int preserve; int tables; } command_line; command_line cmd; int onepass() { int i; int start=0; match_login *l; tail_read(); for(i=0;i<tail_bufflen;i++) { if(tail_buff[i]=='\n' || tail_buff[i]=='\0') { tail_buff[i]='\0'; l=match_line(tail_buff+start); if(l) auth_add(l->username, l->hostname); start=i+1; } } return 0; } void usage() { fprintf(stderr,"Usage: exact [-h] [-d] [-f] [-p] [-c filename]\n"); fprintf(stderr," -h | --help show this usage information\n"); fprintf(stderr," -d | --debug more than you ever want to know\n"); fprintf(stderr," -f | --foreground don't background\n"); fprintf(stderr," -p | --preserve don't remove the relay file on exit\n"); fprintf(stderr," -c | --config configuration filename\n"); fprintf(stderr," -V | --version print the version of exact and exit\n"); fprintf(stderr," (default %s)\n", conffile_name()); fprintf(stderr,"see the manual page exact(8) for more information\n"); } void version() { fprintf(stderr, "Exact Version 1.40 (c) 2004, Doug Winter\n"); } void cmdline(int argc, char *argv[]) { int c; cmd.foreground=0; cmd.sleep=0; cmd.debug=0; cmd.preserve=0; while(1) { int option_index=0; static struct option long_options[] = { {"help", 0, NULL, 'h'}, {"foreground", 0, NULL, 'f'}, {"sleep", 0, NULL, 's'}, {"debug", 0, NULL, 'd'}, {"preserver", 0, NULL, 'p'}, {"config", 1, NULL, 'c'}, {"version", 0, NULL, 'V'}, {0,0,0,0} }; c=getopt_long(argc,argv,"phsfdc:V",long_options, &option_index); if(c==-1) break; switch(c) { case 'h': usage(); exit(0); case 'V': version(); exit(0); case 'f': cmd.foreground=1; break; case 's': cmd.sleep=1; break; case 'd': cmd.debug=1; break; case 'p': cmd.preserve=1; break; case 'c': conffile_setname(optarg); break; default: fprintf(stderr, "Unknown argument: %c\n",c); usage(); exit(40); break; } } } void checkpid() { FILE *f; f=fopen(conffile_param("pidfile"),"r"); if(f) { int opid=0; fscanf(f,"%d",&opid); fclose(f); if(opid) { int kr=kill(opid,0); if(kr != -1) { logger(LOG_ERR, "Exact is already running, with pid %d\n", opid); exit(41); } } } logger(LOG_DEBUG, "exact is not already running\n"); } void writepid() { FILE *f=fopen(conffile_param("pidfile"),"w"); if(!f) { logger(LOG_ERR, "Cannot write to pid file %s\n", conffile_param("pidfile")); exit(42); } chmod(conffile_param("pidfile"),0640); logger(LOG_DEBUG, "Writing pid to %s\n", conffile_param("pidfile")); fprintf(f,"%d",(int)getpid()); fclose(f); } void exit_handler(int s) { unlink(conffile_param("pidfile")); auth_exit(); if(!cmd.preserve) unlink(conffile_param("authfile")); logger(LOG_ERR, "terminated\n"); exit(0); } int main(int argc, char *argv[]) { int use_syslog=0; cmdline(argc,argv); logger_init(0,cmd.debug,NULL); conffile_read(); conffile_check(); checkpid(); match_init(); daemonize(cmd.foreground, cmd.sleep); auth_init(); if(!strcmp("syslog",conffile_param("logging"))) use_syslog=1; else { if(!strcmp("internal",conffile_param("logging"))) use_syslog=0; else { logger(LOG_ERR, "logging parameter is neither syslog nor internal\n"); exit(100); } } if(cmd.foreground) { logger_init(0,cmd.debug,NULL); // use stderr } else { // never debug using syslog, because you might // get a loop logger_init(use_syslog,!use_syslog && cmd.debug,conffile_param("logfile")); logger(LOG_DEBUG, "Daemonized\n"); } writepid(); signal(1,conffile_reload); signal(10,auth_dump); signal(15,exit_handler); if(!tail_open()) { logger(LOG_ERR,"open of %s failed. Quitting.\n", conffile_param("maillog")); return 2; } logger(LOG_NOTICE, "running\n"); while(1) { onepass(); } assert(0); return 0; }
#pragma once /* * 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 */ /** * $Id$ * * @file lib/server/paircmp.h * @brief Legacy paircomparison function * * @copyright 2000,2006 The FreeRADIUS server project * @copyright 2000 Alan DeKok <aland@ox.org> */ RCSIDH(paircmp_h, "$Id$") #ifdef __cplusplus extern "C" { #endif #include <freeradius-devel/server/request.h> #include <freeradius-devel/util/dict.h> #include <freeradius-devel/util/pair.h> /* for paircmp_register */ typedef int (*RAD_COMPARE_FUNC)(void *instance, REQUEST *,VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR **); int paircmp_pairs(REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp); int paircmp(REQUEST *request, VALUE_PAIR *req_list, VALUE_PAIR *check, VALUE_PAIR **rep_list); int paircmp_find(fr_dict_attr_t const *da); int paircmp_register_by_name(char const *name, fr_dict_attr_t const *from, bool first_only, RAD_COMPARE_FUNC func, void *instance); int paircmp_register(fr_dict_attr_t const *attribute, fr_dict_attr_t const *from, bool first_only, RAD_COMPARE_FUNC func, void *instance); void paircmp_unregister(fr_dict_attr_t const *attr, RAD_COMPARE_FUNC func); void paircmp_unregister_instance(void *instance); int paircmp_init(void); void paircmp_free(void); #ifdef __cplusplus } #endif
/* OpenCP Module Player * copyright (c) '94-'10 Niklas Beisert <nbeisert@physik.tu-muenchen.de> * * GMDPlay time auxiliary routines * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * revision history: (please note changes here) * -nb980510 Niklas Beisert <nbeisert@physik.tu-muenchen.de> * -first release */ #include "config.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "types.h" #include "gmdplay.h" #if 0 static int timerval; static int timerfrac; static int gspeed; static uint8_t currenttick; static uint8_t tempo; static uint16_t currentrow; static uint16_t patternlen; static uint16_t currentpattern; static uint16_t patternnum; static uint16_t looppat; static uint16_t endpat; static struct gmdtrack gtrack; static const struct gmdpattern *patterns; static const struct gmdtrack *tracks; static const uint16_t *orders; static uint16_t speed; static int16_t brkpat; static int16_t brkrow; static uint8_t patlooprow[MP_MAXCHANNELS]; static uint8_t patloopcount[MP_MAXCHANNELS]; static uint8_t globchan; static uint8_t patdelay; static char looped; static int (*calctimer)[2]; static int calcn; static int sync; static void trackmoveto(struct gmdtrack *t, uint8_t row) { while (1) { if (t->ptr>=t->end) break; if (t->ptr[0]>=row) break; t->ptr+=t->ptr[1]+2; } } static void LoadPattern(uint16_t p, uint8_t r) { const struct gmdpattern *pat=&patterns[orders[p]]; patternlen=pat->patlen; if (r>=patternlen) r=0; currenttick=0; currentrow=r; currentpattern=p; gtrack=tracks[pat->gtrack]; trackmoveto(&gtrack, r); } static void PlayGCommand(const uint8_t *cmd, uint8_t len) { const uint8_t *cend=cmd+len; while (cmd<cend) { switch (*cmd++) { case cmdTempo: tempo=*cmd; break; case cmdSpeed: speed=*cmd; gspeed=speed*10; break; case cmdFineSpeed: gspeed=10*speed+*cmd; break; case cmdBreak: if (brkpat==-1) { brkpat=currentpattern+1; if (brkpat==endpat) { brkpat=looppat; looped=1; } } brkrow=*cmd; break; case cmdGoto: brkpat=*cmd; if (brkpat<=currentpattern) looped=1; break; case cmdPatLoop: if (*cmd) if (patloopcount[globchan]++<*cmd) { brkpat=currentpattern; brkrow=patlooprow[globchan]; } else { patloopcount[globchan]=0; patlooprow[globchan]=currentrow+1; } else patlooprow[globchan]=currentrow; break; case cmdPatDelay: if (!patdelay&&*cmd) patdelay=*cmd+1; break; case cmdSetChan: globchan=*cmd; break; } cmd++; } } static int FindTick(void) { int i, p; currenttick++; if (currenttick>=tempo) currenttick=0; if (!currenttick&&patdelay) { brkpat=currentpattern; brkrow=currentrow; } if (!currenttick/*&&!patdelay*/) { currenttick=0; currentrow++; if ((currentrow>=patternlen)&&(brkpat==-1)) { brkpat=currentpattern+1; if (brkpat==endpat) { looped=1; brkpat=looppat; } brkrow=0; } if (brkpat!=-1) { if (currentpattern!=brkpat) { memset(patloopcount, 0, sizeof(patloopcount)); memset(patlooprow, 0, sizeof(patlooprow)); } currentpattern=brkpat; currentrow=brkrow; brkpat=-1; brkrow=0; while ((currentpattern<patternnum)&&(orders[currentpattern]==0xFFFF)) currentpattern++; if ((currentpattern>=patternnum)||(currentpattern==endpat)) { currentpattern=looppat; looped=1; } if (!currentpattern&&!currentrow&&!patdelay) { currentpattern=0; currentrow=0; tempo=6; speed=125; gspeed=1250; } LoadPattern(currentpattern, currentrow); } while (1) { if (gtrack.ptr>=gtrack.end) break; if (gtrack.ptr[0]!=currentrow) break; PlayGCommand(gtrack.ptr+2, gtrack.ptr[1]); gtrack.ptr+=gtrack.ptr[1]+2; } if (patdelay) patdelay--; } p=(currentpattern<<16)|(currentrow<<8)|currenttick; for (i=0; i<calcn; i++) if ((p==calctimer[i][0])&&(calctimer[i][1]<0)) if (!++calctimer[i][1]) calctimer[i][1]=timerval; if (sync!=-1) for (i=0; i<calcn; i++) if ((calctimer[i][0]==(-256-sync))&&(calctimer[i][1]<0)) if (!++calctimer[i][1]) calctimer[i][1]=timerval; sync=-1; if (looped) for (i=0; i<calcn; i++) if ((calctimer[i][0]==-1)&&(calctimer[i][1]<0)) if (!++calctimer[i][1]) calctimer[i][1]=timerval; looped=0; timerfrac+=1638400*1024/gspeed; timerval+=timerfrac>>10; timerfrac&=1023; for (i=0; i<calcn; i++) if (calctimer[i][1]<0) return 0; return 1; } int gmdPrecalcTime(struct gmdmodule *m, int ignore1, int (*calc)[2], int n, int ite) { int i; if (m->orders[0]==0xFFFF) return 0; sync=-1; calcn=n; calctimer=calc; patterns=m->patterns; orders=m->orders; patternnum=m->ordnum; tracks=m->tracks; looppat=(m->loopord<m->ordnum)?m->loopord:0; while (m->orders[looppat]==0xFFFF) looppat--; endpat=m->endord; tempo=6; patdelay=0; patternlen=0; currenttick=tempo; currentrow=0; currentpattern=0; looped=0; brkpat=0; brkrow=0; speed=125; gspeed=1250; timerval=0; timerfrac=0; for (i=0; i<ite; i++) if (FindTick()) return 1; return 0; } #endif