hexsha
stringlengths
40
40
size
int64
5
2.72M
ext
stringclasses
5 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
976
max_stars_repo_name
stringlengths
5
113
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringdate
2015-01-01 00:01:43
2022-03-31 23:59:48
max_stars_repo_stars_event_max_datetime
stringdate
2015-01-01 00:06:24
2022-03-31 23:59:53
max_issues_repo_path
stringlengths
3
976
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
float64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
976
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringdate
2015-01-01 00:01:19
2022-03-31 23:59:49
max_forks_repo_forks_event_max_datetime
stringdate
2015-01-03 12:00:57
2022-03-31 23:59:49
content
stringlengths
5
2.72M
avg_line_length
float64
1.38
573k
max_line_length
int64
2
1.01M
alphanum_fraction
float64
0
1
084c83a6f88b65afbe543249bfee5789a6043c7f
9,144
h
C
SDBlockDevice.h
ARMmbed/sd-driver
eb9d8869f7bf9000ab87fa2dfb7b1be63444e790
[ "Apache-2.0" ]
28
2017-03-21T19:50:43.000Z
2020-10-29T13:48:49.000Z
SDBlockDevice.h
PelionIoT/sd-driver
eb9d8869f7bf9000ab87fa2dfb7b1be63444e790
[ "Apache-2.0" ]
96
2017-03-20T13:20:19.000Z
2018-11-06T17:35:03.000Z
SDBlockDevice.h
ARMmbed/sd-driver
eb9d8869f7bf9000ab87fa2dfb7b1be63444e790
[ "Apache-2.0" ]
28
2017-03-09T13:37:19.000Z
2020-08-31T08:16:08.000Z
/* mbed Microcontroller Library * Copyright (c) 2006-2013 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MBED_SD_BLOCK_DEVICE_H #define MBED_SD_BLOCK_DEVICE_H /* If the target has no SPI support then SDCard is not supported */ #ifdef DEVICE_SPI #include "BlockDevice.h" #include "mbed.h" #include "platform/PlatformMutex.h" /** Access an SD Card using SPI * * @code * #include "mbed.h" * #include "SDBlockDevice.h" * * SDBlockDevice sd(p5, p6, p7, p12); // mosi, miso, sclk, cs * uint8_t block[512] = "Hello World!\n"; * * int main() { * sd.init(); * sd.write(block, 0, 512); * sd.read(block, 0, 512); * printf("%s", block); * sd.deinit(); * } */ class SDBlockDevice : public BlockDevice { public: /** Lifetime of an SD card */ SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName cs, uint64_t hz = 1000000, bool crc_on = 0); virtual ~SDBlockDevice(); /** Initialize a block device * * @return 0 on success or a negative error code on failure */ virtual int init(); /** Deinitialize a block device * * @return 0 on success or a negative error code on failure */ virtual int deinit(); /** Read blocks from a block device * * @param buffer Buffer to write blocks to * @param addr Address of block to begin reading from * @param size Size to read in bytes, must be a multiple of read block size * @return 0 on success, negative error code on failure */ virtual int read(void *buffer, bd_addr_t addr, bd_size_t size); /** Program blocks to a block device * * The blocks must have been erased prior to being programmed * * @param buffer Buffer of data to write to blocks * @param addr Address of block to begin writing to * @param size Size to write in bytes, must be a multiple of program block size * @return 0 on success, negative error code on failure */ virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size); /** Mark blocks as no longer in use * * This function provides a hint to the underlying block device that a region of blocks * is no longer in use and may be erased without side effects. Erase must still be called * before programming, but trimming allows flash-translation-layers to schedule erases when * the device is not busy. * * @param addr Address of block to mark as unused * @param size Size to mark as unused in bytes, must be a multiple of erase block size * @return 0 on success, negative error code on failure */ virtual int trim(bd_addr_t addr, bd_size_t size); /** Get the size of a readable block * * @return Size of a readable block in bytes */ virtual bd_size_t get_read_size() const; /** Get the size of a programable block * * @return Size of a programable block in bytes * @note Must be a multiple of the read size */ virtual bd_size_t get_program_size() const; /** Get the total size of the underlying device * * @return Size of the underlying device in bytes */ virtual bd_size_t size() const; /** Enable or disable debugging * * @param State of debugging */ virtual void debug(bool dbg); /** Set the transfer frequency * * @param Transfer frequency * @note Max frequency supported is 25MHZ */ virtual int frequency(uint64_t freq); /** Get the BlockDevice class type. * * @return A string represent the BlockDevice class type. */ virtual const char *get_type() const; private: /* Commands : Listed below are commands supported * in SPI mode for SD card : Only Mandatory ones */ enum cmdSupported { CMD_NOT_SUPPORTED = -1, /**< Command not supported error */ CMD0_GO_IDLE_STATE = 0, /**< Resets the SD Memory Card */ CMD1_SEND_OP_COND = 1, /**< Sends host capacity support */ CMD6_SWITCH_FUNC = 6, /**< Check and Switches card function */ CMD8_SEND_IF_COND = 8, /**< Supply voltage info */ CMD9_SEND_CSD = 9, /**< Provides Card Specific data */ CMD10_SEND_CID = 10, /**< Provides Card Identification */ CMD12_STOP_TRANSMISSION = 12, /**< Forces the card to stop transmission */ CMD13_SEND_STATUS = 13, /**< Card responds with status */ CMD16_SET_BLOCKLEN = 16, /**< Length for SC card is set */ CMD17_READ_SINGLE_BLOCK = 17, /**< Read single block of data */ CMD18_READ_MULTIPLE_BLOCK = 18, /**< Card transfers data blocks to host until interrupted by a STOP_TRANSMISSION command */ CMD24_WRITE_BLOCK = 24, /**< Write single block of data */ CMD25_WRITE_MULTIPLE_BLOCK = 25, /**< Continuously writes blocks of data until 'Stop Tran' token is sent */ CMD27_PROGRAM_CSD = 27, /**< Programming bits of CSD */ CMD32_ERASE_WR_BLK_START_ADDR = 32, /**< Sets the address of the first write block to be erased. */ CMD33_ERASE_WR_BLK_END_ADDR = 33, /**< Sets the address of the last write block of the continuous range to be erased.*/ CMD38_ERASE = 38, /**< Erases all previously selected write blocks */ CMD55_APP_CMD = 55, /**< Extend to Applications specific commands */ CMD56_GEN_CMD = 56, /**< General Purpose Command */ CMD58_READ_OCR = 58, /**< Read OCR register of card */ CMD59_CRC_ON_OFF = 59, /**< Turns the CRC option on or off*/ // App Commands ACMD6_SET_BUS_WIDTH = 6, ACMD13_SD_STATUS = 13, ACMD22_SEND_NUM_WR_BLOCKS = 22, ACMD23_SET_WR_BLK_ERASE_COUNT = 23, ACMD41_SD_SEND_OP_COND = 41, ACMD42_SET_CLR_CARD_DETECT = 42, ACMD51_SEND_SCR = 51, }; uint8_t _card_type; int _cmd(SDBlockDevice::cmdSupported cmd, uint32_t arg, bool isAcmd = 0, uint32_t *resp = NULL); int _cmd8(); /* Move the SDCard into the SPI Mode idle state * * The card is transitioned from SDCard mode to SPI mode by sending the * CMD0 (GO_IDLE_STATE) command with CS asserted. See the notes in the * "SPI Startup" section of the comments at the head of the * implementation file for further details and specification references. * * @return Response form the card. R1_IDLE_STATE (0x1), the successful * response from CMD0. R1_XXX_XXX for more response */ uint32_t _go_idle_state(); int _initialise_card(); bd_size_t _sectors; bd_size_t _sd_sectors(); bool _is_valid_trim(bd_addr_t addr, bd_size_t size); /* SPI functions */ Timer _spi_timer; /**< Timer Class object used for busy wait */ uint32_t _init_sck; /**< Intial SPI frequency */ uint32_t _transfer_sck; /**< SPI frequency during data transfer/after initialization */ SPI _spi; /**< SPI Class object */ /* SPI initialization function */ void _spi_init(); uint8_t _cmd_spi(SDBlockDevice::cmdSupported cmd, uint32_t arg); void _spi_wait(uint8_t count); bool _wait_token(uint8_t token); /**< Wait for token */ bool _wait_ready(uint16_t ms = 300); /**< 300ms default wait for card to be ready */ int _read(uint8_t *buffer, uint32_t length); int _read_bytes(uint8_t *buffer, uint32_t length); uint8_t _write(const uint8_t *buffer, uint8_t token, uint32_t length); int _freq(void); /* Chip Select and SPI mode select */ DigitalOut _cs; void _select(); void _deselect(); virtual void lock() { _mutex.lock(); } virtual void unlock() { _mutex.unlock(); } PlatformMutex _mutex; bd_size_t _block_size; bd_size_t _erase_size; bool _is_initialized; bool _dbg; bool _crc_on; uint32_t _init_ref_count; MbedCRC<POLY_7BIT_SD, 7> _crc7; MbedCRC<POLY_16BIT_CCITT, 16> _crc16; }; #endif /* DEVICE_SPI */ #endif /* MBED_SD_BLOCK_DEVICE_H */
37.322449
112
0.612533
084dcbfbcae8651d18bba6f7a464b4fc8022b96a
665
h
C
src/include/xbusiness_intf.h
willenchou/xservers
0f8b262571ed7c0465d90ef807a9a540e97de379
[ "Apache-2.0" ]
11
2016-12-11T02:17:58.000Z
2021-11-24T03:27:01.000Z
src/include/xbusiness_intf.h
willenchou/xservers
0f8b262571ed7c0465d90ef807a9a540e97de379
[ "Apache-2.0" ]
null
null
null
src/include/xbusiness_intf.h
willenchou/xservers
0f8b262571ed7c0465d90ef807a9a540e97de379
[ "Apache-2.0" ]
2
2016-12-11T10:48:00.000Z
2021-07-10T07:10:55.000Z
#ifndef X_PLUGIN_XBUSINESS_XBUSINESS_INTF_H_ #define X_PLUGIN_XBUSINESS_XBUSINESS_INTF_H_ #include <xbase/os_common.h> #include <include/xservice_intf.h> #include <include/xmessage_intf.h> namespace x { #define PLUGIN_BUSINESS "xbusiness" #define SID_BUSINESS "x.business" struct IBusinessContext; typedef int (* PFBusinessFunc)(IBusinessContext* context, IPack* in, IPack* out); struct BusinessFuncEntry{ uint32_t funcID; PFBusinessFunc funcEntry; }; struct IBusinessContext { //IMessage* NewMessage() = 0; //IPack* NewPack() = 0; }; struct IBusinessService : public IMsgService{ }; }//namespace x #endif//X_PLUGIN_XBUSINESS_XBUSINESS_INTF_H_
19.558824
81
0.777444
0850389bc7ceaf33585eabaa669092003e82e22e
128
h
C
src/dll/modify.h
ii64/spotify-adblock
da60e3d41354c50a4a2c179930f7699186592ac3
[ "MIT" ]
1
2021-11-02T18:12:04.000Z
2021-11-02T18:12:04.000Z
src/dll/modify.h
ii64/spotify-adblock
da60e3d41354c50a4a2c179930f7699186592ac3
[ "MIT" ]
null
null
null
src/dll/modify.h
ii64/spotify-adblock
da60e3d41354c50a4a2c179930f7699186592ac3
[ "MIT" ]
null
null
null
#ifndef _MODIFY_H #define _MODIFY_H #include <Windows.h> DWORD WINAPI modifier_thread(LPVOID); void modifier_detach(); #endif
14.222222
37
0.789063
08515d7cac7ce945746f29d0f33ce9ceded213ef
359
h
C
C Files hacked for bigness carbon/Header/CPUState.h
alanswx/c64
3a858e0801509c10c1754bc2f8b4a96eac2156d5
[ "MIT" ]
1
2017-06-10T16:12:11.000Z
2017-06-10T16:12:11.000Z
C Files hacked for bigness carbon/Header/CPUState.h
alanswx/c64
3a858e0801509c10c1754bc2f8b4a96eac2156d5
[ "MIT" ]
null
null
null
C Files hacked for bigness carbon/Header/CPUState.h
alanswx/c64
3a858e0801509c10c1754bc2f8b4a96eac2156d5
[ "MIT" ]
null
null
null
/*-------------------------------------------------------------------------------*\ | | File: CPUState.h | | Description: | | | | | | Copyright � 1994, Alan Steremberg and Ed Wynne | \*-------------------------------------------------------------------------------*/ #ifndef _CPUSTATE_ #define _CPUSTATE_ void ResetCPUState(void); #endif //_CPUSTATE_
359
359
0.359331
0852168ebde4dbb6d233f4d77583415d669771ee
1,462
h
C
bsp/nuvoton/nk-n9h30/applications/lvgl/lv_gpu_n9h30_ge2d.h
BreederBai/rt-thread
53ed0314982556dfa9c5db75d4f3e02485d16ab5
[ "Apache-2.0" ]
null
null
null
bsp/nuvoton/nk-n9h30/applications/lvgl/lv_gpu_n9h30_ge2d.h
BreederBai/rt-thread
53ed0314982556dfa9c5db75d4f3e02485d16ab5
[ "Apache-2.0" ]
null
null
null
bsp/nuvoton/nk-n9h30/applications/lvgl/lv_gpu_n9h30_ge2d.h
BreederBai/rt-thread
53ed0314982556dfa9c5db75d4f3e02485d16ab5
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2006-2022, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2022-3-29 Wayne The first version */ #ifndef LV_GPU_N9H_GE2D_H #define LV_GPU_N9H_GE2D_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "../../misc/lv_color.h" #include "../../hal/lv_hal_disp.h" #include "../sw/lv_draw_sw.h" #if LV_USE_GPU_N9H30_GE2D && LV_VERSION_CHECK(8, 2, 0) /********************* * DEFINES *********************/ /********************** * TYPEDEFS **********************/ struct _lv_disp_drv_t; typedef lv_draw_sw_ctx_t lv_draw_n9h30_ge2d_ctx_t; /********************** * GLOBAL PROTOTYPES **********************/ /** * Turn on the peripheral and set output color mode, this only needs to be done once */ void lv_draw_n9h30_ge2d_init(void); void lv_draw_n9h30_ge2d_ctx_init(struct _lv_disp_drv_t *drv, lv_draw_ctx_t *draw_ctx); void lv_draw_n9h30_ge2d_ctx_deinit(struct _lv_disp_drv_t *drv, lv_draw_ctx_t *draw_ctx); void lv_draw_n9h30_ge2d_blend(lv_draw_ctx_t *draw_ctx, const lv_draw_sw_blend_dsc_t *dsc); void lv_gpu_n9h30_ge2d_wait_cb(lv_draw_ctx_t *draw_ctx); /********************** * MACROS **********************/ #endif /*#if LV_USE_GPU_N9H30_GE2D && LV_VERSION_CHECK(8, 2, 0)*/ #ifdef __cplusplus } /*extern "C"*/ #endif #endif /*LV_GPU_N9H_GE2D_H*/
22.492308
90
0.606019
08536bd1dda32067d715dd4e43213c7a8af26ade
1,849
c
C
srcs/lem_in_create_path.c
dracoeric/Lemon
f63e333a579c4d4b2acc858ff413af6ebc8d8270
[ "MIT" ]
null
null
null
srcs/lem_in_create_path.c
dracoeric/Lemon
f63e333a579c4d4b2acc858ff413af6ebc8d8270
[ "MIT" ]
null
null
null
srcs/lem_in_create_path.c
dracoeric/Lemon
f63e333a579c4d4b2acc858ff413af6ebc8d8270
[ "MIT" ]
null
null
null
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* lem_in_create_path.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: erli <erli@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/01/29 15:44:10 by erli #+# #+# */ /* Updated: 2019/02/10 17:38:45 by erli ### ########.fr */ /* */ /* ************************************************************************** */ #include "lem_in.h" static t_path *lem_in_free_then_abort(t_path *path) { free(path); return (ft_msg_ptr(2, "Abort, failed malloc\n", 0)); } static void lem_in_dup_path(int *dest, int *src, int steps) { int i; i = 0; while (i < steps) { dest[i] = src[i]; i++; } } t_path *lem_in_create_path(t_lem_in_data *data, int room_id, int *n_path, t_path *dup) { t_path *elem; int *tab; if (data == 0) return (ft_msg_ptr(2, "lem_in_data is null.\n", 0)); if (!(elem = (t_path *)malloc(sizeof(t_path)))) return (ft_msg_ptr(2, "Abort, failed malloc\n", 0)); elem->path_id = *n_path; elem->steps = 1; elem->previous = NULL; elem->next = NULL; if (!(tab = (int *)malloc(sizeof(int) * data->n_room))) return (lem_in_free_then_abort(elem)); if (dup != NULL) { elem->steps = dup->steps; lem_in_dup_path(tab, dup->path, dup->steps); } elem->path = tab; *n_path += 1; (elem->path)[elem->steps - 1] = room_id; return (elem); }
31.338983
80
0.376961
0855841f9b4571e490ced0415c02e3c8dae74492
570
h
C
server/server/request_executor.h
dima1997/PORTAL_2D_copy
7618d970feded3fc05fda0c422a5d76a1d3056c7
[ "MIT" ]
null
null
null
server/server/request_executor.h
dima1997/PORTAL_2D_copy
7618d970feded3fc05fda0c422a5d76a1d3056c7
[ "MIT" ]
null
null
null
server/server/request_executor.h
dima1997/PORTAL_2D_copy
7618d970feded3fc05fda0c422a5d76a1d3056c7
[ "MIT" ]
null
null
null
// // Created by franciscosicardi on 09/05/19. // #ifndef PORTAL_REQUEST_EXECUTOR_H #define PORTAL_REQUEST_EXECUTOR_H #include <thread> #include <blocking_queue.h> #include <connector/connector.h> #include "../game/game_manager.h" class RequestExecutor { private: BlockingQueue<Connector> &queue; std::thread thread; void execute(); GameManager &gameManager; public: RequestExecutor(BlockingQueue<Connector> &queue, GameManager &gameManager); ~RequestExecutor(); void operator()(); void join(); }; #endif //PORTAL_REQUEST_EXECUTOR_H
20.357143
79
0.731579
08568a1f4ab76967a8adbb56190fd4b47d34db7c
27,813
h
C
cvt/math/Matrix4.h
tuxmike/cvt
c6a5df38af4653345e795883b8babd67433746e9
[ "MIT" ]
11
2017-04-04T16:38:31.000Z
2021-08-04T11:31:26.000Z
cvt/math/Matrix4.h
tuxmike/cvt
c6a5df38af4653345e795883b8babd67433746e9
[ "MIT" ]
null
null
null
cvt/math/Matrix4.h
tuxmike/cvt
c6a5df38af4653345e795883b8babd67433746e9
[ "MIT" ]
8
2016-04-11T00:58:27.000Z
2022-02-22T07:35:40.000Z
/* The MIT License (MIT) Copyright (c) 2011 - 2013, Philipp Heise and Sebastian Klose 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. */ #ifdef CVT_MATRIX_H namespace cvt { template<typename T> class Matrix3; template<typename T> class Matrix4; template<typename T> std::ostream& operator<<( std::ostream& out, const Matrix4<T>& m ); /** \ingroup Math */ template<typename T> class Matrix4 { public: typedef T TYPE; enum { DIMENSION = 4 }; Matrix4<T>( void ); Matrix4<T>( const Matrix4<T>& mat4 ); explicit Matrix4<T>( const Vector4<T>& x, const Vector4<T>& y, const Vector4<T>& z, const Vector4<T>& w ); explicit Matrix4<T>( const T a, const T b, const T c, const T d, const T e, const T f, const T g, const T h, const T i, const T j, const T k, const T l, const T m, const T n, const T o, const T p ); explicit Matrix4<T>( const T src[ 4 ][ 4 ] ); explicit Matrix4<T>( const Matrix3<T>& mat3 ); const Vector4<T>& operator[]( int index ) const; Vector4<T>& operator[]( int index ); const T& operator()( int r, int c ) const; T& operator()( int r, int c ); Matrix4<T> operator-() const; Matrix4<T> operator*( const T c ) const; Matrix4<T> operator+( const T c ) const; Matrix4<T> operator-( const T c ) const; Vector3<T> operator*( const Vector3<T> &vec ) const; Vector4<T> operator*( const Vector4<T> &vec ) const; Matrix4<T> operator*( const Matrix4<T>& m ) const; Matrix4<T> operator+( const Matrix4<T>& m ) const; Matrix4<T> operator-( const Matrix4<T>& m ) const; Matrix4<T>& operator*=( const T c ); Matrix4<T>& operator+=( const T c ); Matrix4<T>& operator-=( const T c ); Matrix4<T>& operator*=( const Matrix4<T>& m ); Matrix4<T>& operator+=( const Matrix4<T>& m ); Matrix4<T>& operator-=( const Matrix4<T>& m ); template <typename T2> operator Matrix4<T2>() const; bool operator==( const Matrix4<T> &m ) const; bool operator!=( const Matrix4<T> &m ) const; Vector4<T> row( size_t r ) const; Vector4<T> col( size_t c ) const; void setZero( void ); void setIdentity( void ); bool isIdentity( ) const; bool isSymmetric( ) const; bool isDiagonal( ) const; bool isEqual( const Matrix4<T> & other, T epsilon ) const; void setDiagonal( const Vector4<T>& diag ); void setRotationX( T rad ); void setRotationY( T rad ); void setRotationZ( T rad ); void setRotationXYZ( T angleX, T angleY, T angleZ ); void setRotation( const Vector3<T>& axis, T rad ); void setTranslation( T x, T y, T z ); T trace( void ) const; T determinant( void ) const; Matrix4<T> transpose( void ) const; Matrix4<T>& transposeSelf( void ); Matrix4<T> inverse( void ) const; bool inverseSelf( void ); void svd( Matrix4<T>& u, Matrix4<T>& d, Matrix4<T>& vt ) const; Matrix4<T> pseudoInverse() const; Matrix3<T> toMatrix3( void ) const; int dimension( void ) const; const T* ptr( void ) const; T* ptr( void ); String toString( void ) const; static Matrix4<T> fromString( const String & s ); friend std::ostream& operator<< <>( std::ostream& out, const Matrix4<T>& m ); private: Vector4<T> mat[ 4 ]; }; template<typename T> inline Matrix4<T>::Matrix4() { } template<typename T> inline Matrix4<T>::Matrix4( const Matrix4<T>& m ) { memcpy( ( uint8_t* ) this->ptr(), ( const uint8_t* ) m.ptr(), sizeof( T ) * 16 ); } template<typename T> inline Matrix4<T>::Matrix4( const Matrix3<T>& m ) { mat[ 0 ].x = m[ 0 ].x; mat[ 0 ].y = m[ 0 ].y; mat[ 0 ].z = m[ 0 ].z; mat[ 0 ].w = 0; mat[ 1 ].x = m[ 1 ].x; mat[ 1 ].y = m[ 1 ].y; mat[ 1 ].z = m[ 1 ].z; mat[ 1 ].w = 0; mat[ 2 ].x = m[ 2 ].x; mat[ 2 ].y = m[ 2 ].y; mat[ 2 ].z = m[ 2 ].z; mat[ 2 ].w = 0; mat[ 3 ].x = 0; mat[ 3 ].y = 0; mat[ 3 ].z = 0; mat[ 3 ].w = 1; } template<typename T> inline Matrix4<T>::Matrix4( const Vector4<T>& x, const Vector4<T>& y, const Vector4<T>& z, const Vector4<T>& w ) { mat[ 0 ] = x; mat[ 1 ] = y; mat[ 2 ] = z; mat[ 3 ] = w; } template<typename T> inline Matrix4<T>::Matrix4( const T a, const T b, const T c, const T d, const T e, const T f, const T g, const T h, const T i, const T j, const T k, const T l, const T m, const T n, const T o, const T p ) { mat[ 0 ].x = a; mat[ 0 ].y = b; mat[ 0 ].z = c; mat[ 0 ].w = d; mat[ 1 ].x = e; mat[ 1 ].y = f; mat[ 1 ].z = g; mat[ 1 ].w = h; mat[ 2 ].x = i; mat[ 2 ].y = j; mat[ 2 ].z = k; mat[ 2 ].w = l; mat[ 3 ].x = m; mat[ 3 ].y = n; mat[ 3 ].z = o; mat[ 3 ].w = p; } template<typename T> inline Matrix4<T>::Matrix4( const T src[ 4 ][ 4 ] ) { memcpy( this->ptr(), src, sizeof( T ) * 16 ); } template<typename T> inline const Vector4<T>& Matrix4<T>::operator[]( int index ) const { return mat[ index ]; } template<typename T> inline Vector4<T>& Matrix4<T>::operator[]( int index ) { return mat[ index ]; } template<typename T> inline const T& Matrix4<T>::operator()( int r, int c ) const { return mat[ r ][ c ]; } template<typename T> inline T& Matrix4<T>::operator()( int r, int c ) { return mat[ r ][ c ]; } template<typename T> inline Matrix4<T> Matrix4<T>::operator-( ) const { return Matrix4<T>( -mat[ 0 ], -mat[ 1 ], -mat[ 2 ], -mat[ 3 ] ); } template<typename T> inline Matrix4<T> Matrix4<T>::operator*( const T c ) const { return Matrix4<T>( mat[ 0 ] * c, mat[ 1 ] * c, mat[ 2 ] * c, mat[ 3 ] * c ); } template<typename T> inline Matrix4<T> Matrix4<T>::operator+( const T c ) const { return Matrix4<T>( mat[ 0 ] + c, mat[ 1 ] + c, mat[ 2 ] + c, mat[ 3 ] + c ); } template<typename T> inline Matrix4<T> Matrix4<T>::operator-( const T c ) const { return Matrix4<T>( mat[ 0 ] - c, mat[ 1 ] - c, mat[ 2 ] - c, mat[ 3 ] - c ); } template<typename T> inline Vector3<T> Matrix4<T>::operator*( const Vector3<T> &vec ) const { Vector3<T> ret( mat[ 0 ].x * vec.x + mat[ 0 ].y * vec.y + mat[ 0 ].z * vec.z + mat[ 0 ].w, mat[ 1 ].x * vec.x + mat[ 1 ].y * vec.y + mat[ 1 ].z * vec.z + mat[ 1 ].w, mat[ 2 ].x * vec.x + mat[ 2 ].y * vec.y + mat[ 2 ].z * vec.z + mat[ 2 ].w ); ret /= mat[ 3 ].x * vec.x + mat[ 3 ].y * vec.y + mat[ 3 ].z * vec.z + mat[ 3 ].w; return ret; } template<typename T> inline Vector4<T> Matrix4<T>::operator*( const Vector4<T>& vec ) const { return Vector4<T>( mat[ 0 ].x * vec.x + mat[ 0 ].y * vec.y + mat[ 0 ].z * vec.z + mat[ 0 ].w * vec.w, mat[ 1 ].x * vec.x + mat[ 1 ].y * vec.y + mat[ 1 ].z * vec.z + mat[ 1 ].w * vec.w, mat[ 2 ].x * vec.x + mat[ 2 ].y * vec.y + mat[ 2 ].z * vec.z + mat[ 2 ].w * vec.w, mat[ 3 ].x * vec.x + mat[ 3 ].y * vec.y + mat[ 3 ].z * vec.z + mat[ 3 ].w * vec.w ); } template<typename T> inline Matrix4<T> Matrix4<T>::operator*( const Matrix4<T>& m ) const { return Matrix4<T>( mat[ 0 ][ 0 ] * m[ 0 ][ 0 ] + mat[ 0 ][ 1 ] * m[ 1 ][ 0 ] + mat[ 0 ][ 2 ] * m[ 2 ][ 0 ] + mat[ 0 ][ 3 ] * m[ 3 ][ 0 ], mat[ 0 ][ 0 ] * m[ 0 ][ 1 ] + mat[ 0 ][ 1 ] * m[ 1 ][ 1 ] + mat[ 0 ][ 2 ] * m[ 2 ][ 1 ] + mat[ 0 ][ 3 ] * m[ 3 ][ 1 ], mat[ 0 ][ 0 ] * m[ 0 ][ 2 ] + mat[ 0 ][ 1 ] * m[ 1 ][ 2 ] + mat[ 0 ][ 2 ] * m[ 2 ][ 2 ] + mat[ 0 ][ 3 ] * m[ 3 ][ 2 ], mat[ 0 ][ 0 ] * m[ 0 ][ 3 ] + mat[ 0 ][ 1 ] * m[ 1 ][ 3 ] + mat[ 0 ][ 2 ] * m[ 2 ][ 3 ] + mat[ 0 ][ 3 ] * m[ 3 ][ 3 ], mat[ 1 ][ 0 ] * m[ 0 ][ 0 ] + mat[ 1 ][ 1 ] * m[ 1 ][ 0 ] + mat[ 1 ][ 2 ] * m[ 2 ][ 0 ] + mat[ 1 ][ 3 ] * m[ 3 ][ 0 ], mat[ 1 ][ 0 ] * m[ 0 ][ 1 ] + mat[ 1 ][ 1 ] * m[ 1 ][ 1 ] + mat[ 1 ][ 2 ] * m[ 2 ][ 1 ] + mat[ 1 ][ 3 ] * m[ 3 ][ 1 ], mat[ 1 ][ 0 ] * m[ 0 ][ 2 ] + mat[ 1 ][ 1 ] * m[ 1 ][ 2 ] + mat[ 1 ][ 2 ] * m[ 2 ][ 2 ] + mat[ 1 ][ 3 ] * m[ 3 ][ 2 ], mat[ 1 ][ 0 ] * m[ 0 ][ 3 ] + mat[ 1 ][ 1 ] * m[ 1 ][ 3 ] + mat[ 1 ][ 2 ] * m[ 2 ][ 3 ] + mat[ 1 ][ 3 ] * m[ 3 ][ 3 ], mat[ 2 ][ 0 ] * m[ 0 ][ 0 ] + mat[ 2 ][ 1 ] * m[ 1 ][ 0 ] + mat[ 2 ][ 2 ] * m[ 2 ][ 0 ] + mat[ 2 ][ 3 ] * m[ 3 ][ 0 ], mat[ 2 ][ 0 ] * m[ 0 ][ 1 ] + mat[ 2 ][ 1 ] * m[ 1 ][ 1 ] + mat[ 2 ][ 2 ] * m[ 2 ][ 1 ] + mat[ 2 ][ 3 ] * m[ 3 ][ 1 ], mat[ 2 ][ 0 ] * m[ 0 ][ 2 ] + mat[ 2 ][ 1 ] * m[ 1 ][ 2 ] + mat[ 2 ][ 2 ] * m[ 2 ][ 2 ] + mat[ 2 ][ 3 ] * m[ 3 ][ 2 ], mat[ 2 ][ 0 ] * m[ 0 ][ 3 ] + mat[ 2 ][ 1 ] * m[ 1 ][ 3 ] + mat[ 2 ][ 2 ] * m[ 2 ][ 3 ] + mat[ 2 ][ 3 ] * m[ 3 ][ 3 ], mat[ 3 ][ 0 ] * m[ 0 ][ 0 ] + mat[ 3 ][ 1 ] * m[ 1 ][ 0 ] + mat[ 3 ][ 2 ] * m[ 2 ][ 0 ] + mat[ 3 ][ 3 ] * m[ 3 ][ 0 ], mat[ 3 ][ 0 ] * m[ 0 ][ 1 ] + mat[ 3 ][ 1 ] * m[ 1 ][ 1 ] + mat[ 3 ][ 2 ] * m[ 2 ][ 1 ] + mat[ 3 ][ 3 ] * m[ 3 ][ 1 ], mat[ 3 ][ 0 ] * m[ 0 ][ 2 ] + mat[ 3 ][ 1 ] * m[ 1 ][ 2 ] + mat[ 3 ][ 2 ] * m[ 2 ][ 2 ] + mat[ 3 ][ 3 ] * m[ 3 ][ 2 ], mat[ 3 ][ 0 ] * m[ 0 ][ 3 ] + mat[ 3 ][ 1 ] * m[ 1 ][ 3 ] + mat[ 3 ][ 2 ] * m[ 2 ][ 3 ] + mat[ 3 ][ 3 ] * m[ 3 ][ 3 ] ); } template<typename T> inline Matrix4<T> Matrix4<T>::operator+( const Matrix4<T>& m ) const { return Matrix4<T>( mat[ 0 ] + m[ 0 ], mat[ 1 ] + m[ 1 ], mat[ 2 ] + m[ 2 ], mat[ 3 ] + m[ 3 ] ); } template<typename T> inline Matrix4<T> Matrix4<T>::operator-( const Matrix4<T>& m ) const { return Matrix4<T>( mat[ 0 ] - m[ 0 ], mat[ 1 ] - m[ 1 ], mat[ 2 ] - m[ 2 ], mat[ 3 ] - m[ 3 ] ); } template<typename T> inline Matrix4<T>& Matrix4<T>::operator*=( const T c ) { mat[ 0 ] *= c; mat[ 1 ] *= c; mat[ 2 ] *= c; mat[ 3 ] *= c; return *this; } template<typename T> inline Matrix4<T>& Matrix4<T>::operator+=( const T c ) { mat[ 0 ] += c; mat[ 1 ] += c; mat[ 2 ] += c; mat[ 3 ] += c; return *this; } template<typename T> inline Matrix4<T>& Matrix4<T>::operator-=( const T c ) { mat[ 0 ] -= c; mat[ 1 ] -= c; mat[ 2 ] -= c; mat[ 3 ] -= c; return *this; } template<typename T> inline Matrix4<T>& Matrix4<T>::operator+=( const Matrix4<T>& m ) { mat[ 0 ] += m[ 0 ]; mat[ 1 ] += m[ 1 ]; mat[ 2 ] += m[ 2 ]; mat[ 3 ] += m[ 3 ]; return *this; } template<typename T> inline Matrix4<T>& Matrix4<T>::operator-=( const Matrix4<T>& m ) { mat[ 0 ] -= m[ 0 ]; mat[ 1 ] -= m[ 1 ]; mat[ 2 ] -= m[ 2 ]; mat[ 3 ] -= m[ 3 ]; return *this; } template<typename T> inline Matrix4<T>& Matrix4<T>::operator*=( const Matrix4<T>& m ) { *this = (*this) * m; return *this; } template<typename T> inline bool Matrix4<T>::operator==( const Matrix4<T> &m ) const { return mat[ 0 ] == m[ 0 ] && mat[ 1 ] == m[ 1 ] && mat[ 2 ] == m[ 2 ] && mat[ 3 ] == m[ 3 ]; } template<typename T> inline bool Matrix4<T>::operator!=( const Matrix4<T> &m ) const { return mat[ 0 ] != m[ 0 ] || mat[ 1 ] != m[ 1 ] || mat[ 2 ] != m[ 2 ] || mat[ 3 ] != m[ 3 ]; } template <typename T> template <typename T2> inline Matrix4<T>::operator Matrix4<T2>() const { return Matrix4<T2>( ( T2 ) mat[ 0 ][ 0 ], ( T2 ) mat[ 0 ][ 1 ], ( T2 ) mat[ 0 ][ 2 ], ( T2 ) mat[ 0 ][ 3 ], ( T2 ) mat[ 1 ][ 0 ], ( T2 ) mat[ 1 ][ 1 ], ( T2 ) mat[ 1 ][ 2 ], ( T2 ) mat[ 1 ][ 3 ], ( T2 ) mat[ 2 ][ 0 ], ( T2 ) mat[ 2 ][ 1 ], ( T2 ) mat[ 2 ][ 2 ], ( T2 ) mat[ 2 ][ 3 ], ( T2 ) mat[ 3 ][ 0 ], ( T2 ) mat[ 3 ][ 1 ], ( T2 ) mat[ 3 ][ 2 ], ( T2 ) mat[ 3 ][ 3 ] ); } template<typename T> inline Vector4<T> Matrix4<T>::row( size_t r ) const { return Vector4<T>( mat[ r ][ 0 ], mat[ r ][ 1 ], mat[ r ][ 2 ], mat[ r ][ 3 ] ); } template<typename T> inline Vector4<T> Matrix4<T>::col( size_t c ) const { return Vector4<T>( mat[ 0 ][ c ], mat[ 1 ][ c ], mat[ 2 ][ c ], mat[ 3 ][ c ] ); } template<typename T> inline void Matrix4<T>::setZero() { mat[ 0 ].setZero(); mat[ 1 ].setZero(); mat[ 2 ].setZero(); mat[ 3 ].setZero(); } template<typename T> inline void Matrix4<T>::setIdentity() { mat[ 0 ].x = 1; mat[ 0 ].y = 0; mat[ 0 ].z = 0; mat[ 0 ].w = 0; mat[ 1 ].x = 0; mat[ 1 ].y = 1; mat[ 1 ].z = 0; mat[ 1 ].w = 0; mat[ 2 ].x = 0; mat[ 2 ].y = 0; mat[ 2 ].z = 1; mat[ 2 ].w = 0; mat[ 3 ].x = 0; mat[ 3 ].y = 0; mat[ 3 ].z = 0; mat[ 3 ].w = 1; } template<typename T> inline void Matrix4<T>::setDiagonal( const Vector4<T>& diag ) { mat[ 0 ].x = diag.x; mat[ 0 ].y = 0; mat[ 0 ].z = 0; mat[ 0 ].w = 0; mat[ 1 ].x = 0; mat[ 1 ].y = diag.y; mat[ 1 ].z = 0; mat[ 1 ].w = 0; mat[ 2 ].x = 0; mat[ 2 ].y = 0; mat[ 2 ].z = diag.z; mat[ 2 ].w = 0; mat[ 3 ].x = 0; mat[ 3 ].y = 0; mat[ 3 ].z = 0; mat[ 3 ].w = diag.w; } template<typename T> inline void Matrix4<T>::setRotationX( T rad ) { T s = Math::sin( rad ); T c = Math::cos( rad ); mat[ 0 ].x = 1; mat[ 0 ].y = 0; mat[ 0 ].z = 0; mat[ 0 ].w = 0; mat[ 1 ].x = 0; mat[ 1 ].y = c; mat[ 1 ].z = -s; mat[ 1 ].w = 0; mat[ 2 ].x = 0; mat[ 2 ].y = s; mat[ 2 ].z = c; mat[ 2 ].w = 0; mat[ 3 ].x = 0; mat[ 3 ].y = 0; mat[ 3 ].z = 0; mat[ 3 ].w = 1; } template<typename T> inline void Matrix4<T>::setRotationY( T rad ) { T s = Math::sin( rad ); T c = Math::cos( rad ); mat[ 0 ].x = c; mat[ 0 ].y = 0; mat[ 0 ].z = s; mat[ 0 ].w = 0; mat[ 1 ].x = 0; mat[ 1 ].y = 1; mat[ 1 ].z = 0; mat[ 1 ].w = 0; mat[ 2 ].x = -s; mat[ 2 ].y = 0; mat[ 2 ].z = c; mat[ 1 ].w = 0; mat[ 3 ].x = 0; mat[ 3 ].y = 0; mat[ 3 ].z = 0; mat[ 3 ].w = 1; } template<typename T> inline void Matrix4<T>::setRotationZ( T rad ) { T s = Math::sin( rad ); T c = Math::cos( rad ); mat[ 0 ].x = c; mat[ 0 ].y = -s; mat[ 0 ].z = 0; mat[ 0 ].w = 0; mat[ 1 ].x = s; mat[ 1 ].y = c; mat[ 1 ].z = 0; mat[ 1 ].w = 0; mat[ 2 ].x = 0; mat[ 2 ].y = 0; mat[ 2 ].z = 1; mat[ 2 ].w = 0; mat[ 3 ].x = 0; mat[ 3 ].y = 0; mat[ 3 ].z = 0; mat[ 3 ].w = 1; } template<typename T> inline void Matrix4<T>::setRotationXYZ( T angleX, T angleY, T angleZ ) { T cx = Math::cos( angleX ); T cy = Math::cos( angleY ); T cz = Math::cos( angleZ ); T sx = Math::sin( angleX ); T sy = Math::sin( angleY ); T sz = Math::sin( angleZ ); mat[ 0 ][ 0 ] = cy * cz; mat[ 0 ][ 1 ] = -cy * sz; mat[ 0 ][ 2 ] = sy; mat[ 0 ][ 3 ] = 0; mat[ 1 ][ 0 ] = cx * sz + cz * sx * sy; mat[ 1 ][ 1 ] = cx * cz - sx * sy * sz; mat[ 1 ][ 2 ] = -cy * sx; mat[ 1 ][ 3 ] = 0; mat[ 2 ][ 0 ] = sx * sz - cx * cz * sy; mat[ 2 ][ 1 ] = cx * sy * sz + cz * sx; mat[ 2 ][ 2 ] = cx * cy; mat[ 2 ][ 3 ] = 0; mat[ 3 ][ 0 ] = 0; mat[ 3 ][ 1 ] = 0; mat[ 3 ][ 2 ] = 0; mat[ 3 ][ 3 ] = 1; } template<typename T> inline void Matrix4<T>::setRotation( const Vector3<T>& _axis, T rad ) { Vector3<T> axis( _axis ); axis.normalize(); T x, y, z, c, s; T wx, wy, wz; T xx, yy, yz; T xy, xz, zz; T x2, y2, z2; c = Math::cos( rad * ( T ) 0.5 ); s = Math::sin( rad * ( T ) 0.5 ); x = axis.x * s; y = axis.y * s; z = axis.z * s; x2 = x + x; y2 = y + y; z2 = z + z; xx = x * x2; xy = x * y2; xz = x * z2; yy = y * y2; yz = y * z2; zz = z * z2; wx = c * x2; wy = c * y2; wz = c * z2; mat[ 0 ][ 0 ] = ( T ) 1 - ( yy + zz ); mat[ 0 ][ 1 ] = xy - wz; mat[ 0 ][ 2 ] = xz + wy; mat[ 0 ][ 3 ] = 0; mat[ 1 ][ 0 ] = xy + wz; mat[ 1 ][ 1 ] = ( T ) 1 - ( xx + zz ); mat[ 1 ][ 2 ] = yz - wx; mat[ 1 ][ 3 ] = 0; mat[ 2 ][ 0 ] = xz - wy; mat[ 2 ][ 1 ] = yz + wx; mat[ 2 ][ 2 ] = ( T ) 1 - ( xx + yy ); mat[ 3 ][ 3 ] = ( T ) 1; mat[ 3 ][ 0 ] = 0; mat[ 3 ][ 1 ] = 0; mat[ 3 ][ 2 ] = 0; mat[ 3 ][ 3 ] = ( T ) 1; } template<typename T> inline void Matrix4<T>::setTranslation( T x, T y, T z ) { mat[ 0 ][ 3 ] = x; mat[ 1 ][ 3 ] = y; mat[ 2 ][ 3 ] = z; } template<> inline bool Matrix4<double>::isIdentity() const { return mat[ 0 ] == Vector4<double>( 1.0, 0.0, 0.0, 0.0 ) && mat[ 1 ] == Vector4<double>( 0.0, 1.0, 0.0, 0.0 ) && mat[ 2 ] == Vector4<double>( 0.0, 0.0, 1.0, 0.0 ) && mat[ 3 ] == Vector4<double>( 0.0, 0.0, 0.0, 1.0 ); } template<> inline bool Matrix4<float>::isIdentity() const { return mat[ 0 ] == Vector4<float>( 1.0f, 0.0f, 0.0f, 0.0f ) && mat[ 1 ] == Vector4<float>( 0.0f, 1.0f, 0.0f, 0.0f ) && mat[ 2 ] == Vector4<float>( 0.0f, 0.0f, 1.0f, 0.0f ) && mat[ 3 ] == Vector4<float>( 0.0f, 0.0f, 0.0f, 1.0f ); } template<> inline bool Matrix4<float>::isSymmetric() const { return Math::abs( mat[ 0 ][ 1 ] - mat[ 1 ][ 0 ] ) < Math::EPSILONF && Math::abs( mat[ 0 ][ 2 ] - mat[ 2 ][ 0 ] ) < Math::EPSILONF && Math::abs( mat[ 0 ][ 3 ] - mat[ 3 ][ 0 ] ) < Math::EPSILONF && Math::abs( mat[ 1 ][ 2 ] - mat[ 2 ][ 1 ] ) < Math::EPSILONF && Math::abs( mat[ 1 ][ 3 ] - mat[ 3 ][ 1 ] ) < Math::EPSILONF && Math::abs( mat[ 2 ][ 3 ] - mat[ 3 ][ 2 ] ) < Math::EPSILONF; } template<> inline bool Matrix4<float>::isDiagonal() const { return Math::abs( mat[ 0 ][ 1 ] ) < Math::EPSILONF && Math::abs( mat[ 0 ][ 2 ] ) < Math::EPSILONF && Math::abs( mat[ 0 ][ 3 ] ) < Math::EPSILONF && Math::abs( mat[ 1 ][ 0 ] ) < Math::EPSILONF && Math::abs( mat[ 1 ][ 2 ] ) < Math::EPSILONF && Math::abs( mat[ 1 ][ 3 ] ) < Math::EPSILONF && Math::abs( mat[ 2 ][ 0 ] ) < Math::EPSILONF && Math::abs( mat[ 2 ][ 1 ] ) < Math::EPSILONF && Math::abs( mat[ 2 ][ 3 ] ) < Math::EPSILONF && Math::abs( mat[ 3 ][ 0 ] ) < Math::EPSILONF && Math::abs( mat[ 3 ][ 1 ] ) < Math::EPSILONF && Math::abs( mat[ 3 ][ 2 ] ) < Math::EPSILONF; } template<> inline bool Matrix4<double>::isDiagonal() const { return Math::abs( mat[ 0 ][ 1 ] ) < Math::EPSILOND && Math::abs( mat[ 0 ][ 2 ] ) < Math::EPSILOND && Math::abs( mat[ 0 ][ 3 ] ) < Math::EPSILOND && Math::abs( mat[ 1 ][ 0 ] ) < Math::EPSILOND && Math::abs( mat[ 1 ][ 2 ] ) < Math::EPSILOND && Math::abs( mat[ 1 ][ 3 ] ) < Math::EPSILOND && Math::abs( mat[ 2 ][ 0 ] ) < Math::EPSILOND && Math::abs( mat[ 2 ][ 1 ] ) < Math::EPSILOND && Math::abs( mat[ 2 ][ 3 ] ) < Math::EPSILOND && Math::abs( mat[ 3 ][ 0 ] ) < Math::EPSILOND && Math::abs( mat[ 3 ][ 1 ] ) < Math::EPSILOND && Math::abs( mat[ 3 ][ 2 ] ) < Math::EPSILOND; } template<typename T> inline bool Matrix4<T>::isEqual(const Matrix4<T>& other, T epsilon) const { for( size_t i = 0; i < 4; i++ ){ for( size_t k = 0; k < 4; k++ ){ if( Math::abs( mat[ i ][ k ] - other[ i ][ k ] ) > epsilon ) return false; } } return true; } template<typename T> inline T Matrix4<T>::trace() const { return mat[ 0 ].x + mat[ 1 ].y + mat[ 2 ].z + mat[ 3 ].w; } template<typename T> inline T Matrix4<T>::determinant() const { T det2_23_01, det2_23_02, det2_23_03, det2_23_12, det2_23_13, det2_23_23; T det3_123_123, det3_123_023, det3_123_013, det3_123_012; det2_23_01 = mat[ 2 ][ 0 ] * mat[ 3 ][ 1 ] - mat[ 3 ][ 0 ] * mat[ 2 ][ 1 ]; det2_23_02 = mat[ 2 ][ 0 ] * mat[ 3 ][ 2 ] - mat[ 3 ][ 0 ] * mat[ 2 ][ 2 ]; det2_23_03 = mat[ 2 ][ 0 ] * mat[ 3 ][ 3 ] - mat[ 3 ][ 0 ] * mat[ 2 ][ 3 ]; det2_23_12 = mat[ 2 ][ 1 ] * mat[ 3 ][ 2 ] - mat[ 3 ][ 1 ] * mat[ 2 ][ 2 ]; det2_23_13 = mat[ 2 ][ 1 ] * mat[ 3 ][ 3 ] - mat[ 3 ][ 1 ] * mat[ 2 ][ 3 ]; det2_23_23 = mat[ 2 ][ 2 ] * mat[ 3 ][ 3 ] - mat[ 3 ][ 2 ] * mat[ 2 ][ 3 ]; det3_123_123 = mat[ 1 ][ 1 ] * det2_23_23 - mat[ 1 ][ 2 ] * det2_23_13 + mat[ 1 ][ 3 ] * det2_23_12; det3_123_023 = mat[ 1 ][ 0 ] * det2_23_23 - mat[ 1 ][ 2 ] * det2_23_03 + mat[ 1 ][ 3 ] * det2_23_02; det3_123_013 = mat[ 1 ][ 0 ] * det2_23_13 - mat[ 1 ][ 1 ] * det2_23_03 + mat[ 1 ][ 3 ] * det2_23_01; det3_123_012 = mat[ 1 ][ 0 ] * det2_23_12 - mat[ 1 ][ 1 ] * det2_23_02 + mat[ 1 ][ 2 ] * det2_23_01; return mat[ 0 ][ 0 ] * det3_123_123 - mat[ 0 ][ 1 ] * det3_123_023 + mat[ 0 ][ 2 ] * det3_123_013 - mat[ 0 ][ 3 ] * det3_123_012; } template<typename T> inline Matrix4<T> Matrix4<T>::transpose() const { return Matrix4<T>( mat[ 0 ][ 0 ], mat[ 1 ][ 0 ], mat[ 2 ][ 0 ], mat[ 3 ][ 0 ], mat[ 0 ][ 1 ], mat[ 1 ][ 1 ], mat[ 2 ][ 1 ], mat[ 3 ][ 1 ], mat[ 0 ][ 2 ], mat[ 1 ][ 2 ], mat[ 2 ][ 2 ], mat[ 3 ][ 2 ], mat[ 0 ][ 3 ], mat[ 1 ][ 3 ], mat[ 2 ][ 3 ], mat[ 3 ][ 3 ] ); } template<typename T> inline Matrix4<T>& Matrix4<T>::transposeSelf() { float tmp; tmp = mat[ 0 ][ 1 ]; mat[ 0 ][ 1 ] = mat[ 1 ][ 0 ]; mat[ 1 ][ 0 ] = tmp; tmp = mat[ 0 ][ 2 ]; mat[ 0 ][ 2 ] = mat[ 2 ][ 0 ]; mat[ 2 ][ 0 ] = tmp; tmp = mat[ 0 ][ 3 ]; mat[ 0 ][ 3 ] = mat[ 3 ][ 0 ]; mat[ 3 ][ 0 ] = tmp; tmp = mat[ 1 ][ 2 ]; mat[ 1 ][ 2 ] = mat[ 2 ][ 1 ]; mat[ 2 ][ 1 ] = tmp; tmp = mat[ 1 ][ 3 ]; mat[ 1 ][ 3 ] = mat[ 3 ][ 1 ]; mat[ 3 ][ 1 ] = tmp; tmp = mat[ 2 ][ 3 ]; mat[ 2 ][ 3 ] = mat[ 3 ][ 2 ]; mat[ 3 ][ 2 ] = tmp; return *this; } template<typename T> inline Matrix4<T> Matrix4<T>::inverse( void ) const { Matrix4<T> inv; inv = *this; inv.inverseSelf(); return inv; } template<typename T> inline Matrix4<T> Matrix4<T>::pseudoInverse() const { Matrix4<T> U, E, V; svd( U, E, V ); for( int i = 0; i < 4; i++ ) { if( Math::abs( E[ i ][ i ] ) > Math::epsilon<T>() ) E[ i ][ i ] = ( T ) 1 / E[ i ][ i ]; } return V * E * U.transpose(); } template<typename T> inline Matrix3<T> Matrix4<T>::toMatrix3() const { return Matrix3<T>( mat[ 0 ][ 0 ], mat[ 0 ][ 1 ], mat[ 0 ][ 2 ], mat[ 1 ][ 0 ], mat[ 1 ][ 1 ], mat[ 1 ][ 2 ], mat[ 2 ][ 0 ], mat[ 2 ][ 1 ], mat[ 2 ][ 2 ] ); } template<typename T> inline int Matrix4<T>::dimension( void ) const { return 4; } template<typename T> inline const T* Matrix4<T>::ptr( void ) const { return mat[ 0 ].ptr(); } template<typename T> inline T* Matrix4<T>::ptr( void ) { return mat[ 0 ].ptr(); } template<typename T> String Matrix4<T>::toString( void ) const { String s; s.sprintf( "%0.10f %0.10f %0.10f %0.10f\n" "%0.10f %0.10f %0.10f %0.10f\n" "%0.10f %0.10f %0.10f %0.10f\n" "%0.10f %0.10f %0.10f %0.10f", mat[ 0 ][ 0 ], mat[ 0 ][ 1 ], mat[ 0 ][ 2 ], mat[ 0 ][ 3 ], mat[ 1 ][ 0 ], mat[ 1 ][ 1 ], mat[ 1 ][ 2 ], mat[ 1 ][ 3 ], mat[ 2 ][ 0 ], mat[ 2 ][ 1 ], mat[ 2 ][ 2 ], mat[ 2 ][ 3 ], mat[ 3 ][ 0 ], mat[ 3 ][ 1 ], mat[ 3 ][ 2 ], mat[ 3 ][ 3 ] ); return s; } template<typename T> inline std::ostream& operator<<( std::ostream& out, const Matrix4<T>& m ) { out << m[ 0 ] << std::endl; out << m[ 1 ] << std::endl; out << m[ 2 ] << std::endl; out << m[ 3 ]; return out; } } #endif
32.378347
147
0.413332
0856a61b996df0d304a056150162c23d99030ce5
923
h
C
Pods/Headers/Public/mob_smssdk/SMS_SDK/SMSSDK+ContactFriends.h
lixinlot/BuDeJie
b100ca647d56e407b0fa1387fdb94407383c6a99
[ "Apache-2.0" ]
333
2018-05-20T11:40:25.000Z
2022-03-30T09:04:31.000Z
Pods/Headers/Public/mob_smssdk/SMS_SDK/SMSSDK+ContactFriends.h
lixinlot/BuDeJie
b100ca647d56e407b0fa1387fdb94407383c6a99
[ "Apache-2.0" ]
4
2018-08-10T02:31:54.000Z
2018-11-14T06:35:37.000Z
Pods/Headers/Public/mob_smssdk/SMS_SDK/SMSSDK+ContactFriends.h
lixinlot/BuDeJie
b100ca647d56e407b0fa1387fdb94407383c6a99
[ "Apache-2.0" ]
88
2018-06-14T10:05:28.000Z
2022-03-17T13:58:46.000Z
// // SMSSDK+ContactFriends.h // SMS_SDK // // Created by 李愿生 on 15/8/25. // Copyright (c) 2015年 掌淘科技. All rights reserved. // #import <SMS_SDK/SMSSDK.h> @interface SMSSDK (ContactFriends) #pragma mark - 是否启用通讯录好友功能、提交用户资料、请求通讯好友信息 /** * @brief 是否允许访问通讯录好友(is Allowed to access to address book) * @param state YES 代表启用 NO 代表不启用 默认为启用(YES,by default,means allow to access to address book) */ + (void) enableAppContactFriends:(BOOL)state; /** 提交用户资料(Submit the user information data) @param userInfo 用户信息(User information) @param result 请求结果回调(Results of the request) */ + (void) submitUserInfo:(SMSSDKUserInfo *)userInfo result:(SMSSubmitUserInfoResultHandler)result; /** 向服务端请求获取通讯录好友信息(Get the data of address book which save in the server) @param result 请求结果回调(Results of the request) */ + (void) getAllContactFriends:(SMSGetContactsFriendsResultHandler)result; @end
23.666667
96
0.72156
0856af9a0e8f2567a9d3b6fe64c952c0cc51709e
1,881
h
C
ui.h
LarryTheKing/G8
36f4d90769359b6d5e28b67700957b3e79a457c3
[ "Apache-2.0" ]
null
null
null
ui.h
LarryTheKing/G8
36f4d90769359b6d5e28b67700957b3e79a457c3
[ "Apache-2.0" ]
6
2015-03-03T05:37:21.000Z
2015-03-30T01:07:38.000Z
ui.h
LarryTheKing/G8
36f4d90769359b6d5e28b67700957b3e79a457c3
[ "Apache-2.0" ]
null
null
null
#ifndef G8_UI_H #define G8_UI_H #include <stdlib.h> #include <FEHUtility.h> #include <FEHLCD.h> #include <FEHIO.h> #include <FEHBuzzer.h> #define BUTTON_NONE 0x00 #define BUTTON_LEFT 0x01 #define BUTTON_CENTER 0x02 #define BUTTON_RIGHT 0x04 namespace G8 { namespace UI { typedef size_t BUTTON; /** * @brief Displays a menu on the screen. Prompts for a selection * @param pTitle The title to display at the top * @param ppNames The names to display in the menu * @param nItems The number of items * @return returns the index of the selected name * @requires pTitle and the elements of ppNames are valid c-strings */ size_t MenuSelect(char const * const pTitle, char const * const * const ppNames, size_t const nItems); /** * @brief Prompts for an integer * @param pTitle The title to display at the top * @param old The old value to display on the screen * @return Returns an __INT32_MIN <= integer <= __INT32_MAX */ int GetInt(char const * const pTitle = NULL, int old = 0); /** * @brief Prompts for an unsigned integer * @param pTitle The title to display at the top * @param old The old value to display on the screen * @return Returns an 0 <= integer <= __UINT32_MAX */ unsigned int GetIntU(char const * const pTitle = NULL, unsigned int old = 0); /** * @brief Prompts for float * @param pTitle The title to display at the top * @param old The old value to display on the screen * @return Returns a floating point value */ float GetFloat(char const * const pTitle = NULL, float old = 0); } } #endif // G8_UI_H
31.35
110
0.593833
0857f3af50ce4931cd66f42b27716c2e21b96c08
579
h
C
HKAdsController/Pods/Headers/Public/Google-Mobile-Ads-SDK/GoogleMobileAds/DFPCustomRenderedBannerViewDelegate.h
Harley-xk/HKAdsController
51307b9ca85f320ac6c08ee40cc918c9350a5502
[ "MIT" ]
1
2016-04-28T06:34:30.000Z
2016-04-28T06:34:30.000Z
HKAdsController/Pods/Headers/Public/Google-Mobile-Ads-SDK/GoogleMobileAds/DFPCustomRenderedBannerViewDelegate.h
Harley-xk/HKAdsController
51307b9ca85f320ac6c08ee40cc918c9350a5502
[ "MIT" ]
null
null
null
HKAdsController/Pods/Headers/Public/Google-Mobile-Ads-SDK/GoogleMobileAds/DFPCustomRenderedBannerViewDelegate.h
Harley-xk/HKAdsController
51307b9ca85f320ac6c08ee40cc918c9350a5502
[ "MIT" ]
null
null
null
// // DFPCustomRenderedBannerViewDelegate.h // Google Mobile Ads SDK // // Copyright 2014 Google Inc. All rights reserved. // #import <UIKit/UIKit.h> @class DFPBannerView; @class DFPCustomRenderedAd; @protocol DFPCustomRenderedBannerViewDelegate<NSObject> /// Called after ad data has been received. You must construct a banner from |customRenderedAd| and /// call the |customRenderedAd| object's finishedRenderingAdView: when the ad is rendered. - (void)bannerView:(DFPBannerView *)bannerView didReceiveCustomRenderedAd:(DFPCustomRenderedAd *)customRenderedAd; @end
27.571429
99
0.784111
0859238d7c46f65ede08f14632f785c01c9371ab
4,534
c
C
src/validation_tests/papi_sp_ops.c
cothan/PAPI_ARMv8_Cortex_A72
2f9d855f1d202b744984f8f24ab5f3f18e15988d
[ "BSD-3-Clause" ]
4
2020-09-18T05:38:40.000Z
2021-07-16T06:21:51.000Z
src/validation_tests/papi_sp_ops.c
cothan/PAPI_ARMv8_Cortex_A72
2f9d855f1d202b744984f8f24ab5f3f18e15988d
[ "BSD-3-Clause" ]
1
2021-07-03T08:05:50.000Z
2021-07-03T09:03:38.000Z
src/validation_tests/papi_sp_ops.c
cothan/PAPI_ARMv8_Cortex_A72
2f9d855f1d202b744984f8f24ab5f3f18e15988d
[ "BSD-3-Clause" ]
1
2022-02-04T05:58:23.000Z
2022-02-04T05:58:23.000Z
/* This file attempts to test the single-precision floating point */ /* performance counter PAPI_SP_OPS */ /* by Vince Weaver, <vincent.weaver@maine.edu> */ /* Note! There are many many many things that can go wrong */ /* when trying to get a sane floating point measurement. */ #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include "papi.h" #include "papi_test.h" #include "display_error.h" #include "testcode.h" int main(int argc, char **argv) { int num_runs=100,i; long long high=0,low=0,average=0,expected=1500000; double error,double_result; long long count,total=0; int quiet=0,retval,ins_result; int eventset=PAPI_NULL; quiet=tests_quiet(argc,argv); if (!quiet) { printf("\nTesting the PAPI_SP_OPS event.\n\n"); } /* Init the PAPI library */ retval = PAPI_library_init( PAPI_VER_CURRENT ); if ( retval != PAPI_VER_CURRENT ) { test_fail( __FILE__, __LINE__, "PAPI_library_init", retval ); } /* Create the eventset */ retval=PAPI_create_eventset(&eventset); if (retval!=PAPI_OK) { test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval ); } /* Add FP_OPS event */ retval=PAPI_add_named_event(eventset,"PAPI_SP_OPS"); if (retval!=PAPI_OK) { if (!quiet) fprintf(stderr,"PAPI_SP_OPS not available!\n"); test_skip( __FILE__, __LINE__, "adding PAPI_SP_OPS", retval ); } /**************************************/ /* Test a loop with no floating point */ /**************************************/ total=0; expected=0; if (!quiet) { printf("Testing a loop with %lld floating point (%d times):\n", expected,num_runs); } for(i=0;i<num_runs;i++) { PAPI_reset(eventset); PAPI_start(eventset); ins_result=branches_testcode(); retval=PAPI_stop(eventset,&count); if (ins_result==CODE_UNIMPLEMENTED) { fprintf(stderr,"\tCode unimplemented\n"); test_skip( __FILE__, __LINE__, "unimplemented", 0); } if (retval!=PAPI_OK) { test_fail( __FILE__, __LINE__, "reading PAPI_TOT_INS", retval ); } if (count>high) high=count; if ((low==0) || (count<low)) low=count; total+=count; } average=(total/num_runs); error=display_error(average,high,low,expected,quiet); if (average>10) { if (!quiet) printf("Unexpected FP event value\n"); test_fail( __FILE__, __LINE__, "Unexpected FP event", 1 ); } if (!quiet) printf("\n"); /*******************************************/ /* Test a single-precision matrix multiply */ /*******************************************/ total=0; high=0; low=0; expected=flops_float_init_matrix(); num_runs=3; if (!quiet) { printf("Testing a matrix multiply with %lld single-precision FP operations (%d times)\n", expected,num_runs); } for(i=0;i<num_runs;i++) { PAPI_reset(eventset); PAPI_start(eventset); double_result=flops_float_matrix_matrix_multiply(); retval=PAPI_stop(eventset,&count); if (retval!=PAPI_OK) { test_fail( __FILE__, __LINE__, "reading PAPI_TOT_INS", retval ); } if (count>high) high=count; if ((low==0) || (count<low)) low=count; total+=count; } if (!quiet) printf("Result %lf\n",double_result); average=(total/num_runs); error=display_error(average,high,low,expected,quiet); if ((error > 1.0) || (error<-1.0)) { if (!quiet) printf("Instruction count off by more than 1%%\n"); test_fail( __FILE__, __LINE__, "Error too high", 1 ); } if (!quiet) printf("\n"); /*******************************************/ /* Test a double-precision matrix multiply */ /*******************************************/ total=0; high=0; low=0; expected=flops_double_init_matrix(); expected=expected*0; num_runs=3; if (!quiet) { printf("Testing a matrix multiply with %lld double-precision FP operations (%d times)\n", expected,num_runs); } for(i=0;i<num_runs;i++) { PAPI_reset(eventset); PAPI_start(eventset); double_result=flops_double_matrix_matrix_multiply(); retval=PAPI_stop(eventset,&count); if (retval!=PAPI_OK) { test_fail( __FILE__, __LINE__, "reading PAPI_TOT_INS", retval ); } if (count>high) high=count; if ((low==0) || (count<low)) low=count; total+=count; } if (!quiet) printf("Result %lf\n",double_result); average=(total/num_runs); error=display_error(average,high,low,expected,quiet); if ((error > 1.0) || (error<-1.0)) { if (!quiet) printf("Instruction count off by more than 1%%\n"); test_fail( __FILE__, __LINE__, "Error too high", 1 ); } if (!quiet) printf("\n"); test_pass( __FILE__ ); PAPI_shutdown(); return 0; }
22.557214
91
0.639612
085ac26d9e88321a353d52f31a621dd0f36628fd
14,563
h
C
src/libpython.h
Laurae2/tensorflow
bdf78f679cce84ce1b67755fc0a2fbee350baeca
[ "Apache-2.0" ]
null
null
null
src/libpython.h
Laurae2/tensorflow
bdf78f679cce84ce1b67755fc0a2fbee350baeca
[ "Apache-2.0" ]
null
null
null
src/libpython.h
Laurae2/tensorflow
bdf78f679cce84ce1b67755fc0a2fbee350baeca
[ "Apache-2.0" ]
1
2018-09-10T12:31:58.000Z
2018-09-10T12:31:58.000Z
#ifndef __LIBPYTHON_HPP__ #define __LIBPYTHON_HPP__ #include <string> #include <stdint.h> #ifndef LIBPYTHON_CPP #define LIBPYTHON_EXTERN extern #else #define LIBPYTHON_EXTERN #endif #define _PYTHON_API_VERSION 1013 #define _PYTHON3_ABI_VERSION 3 namespace libpython { #if _WIN32 || _WIN64 #if _WIN64 typedef __int64 Py_ssize_t; #else typedef int Py_ssize_t; #endif #else typedef long Py_ssize_t; #endif #define METH_VARARGS 0x0001 #define METH_KEYWORDS 0x0002 #define Py_file_input 257 #define _PyObject_HEAD_EXTRA #define _PyObject_EXTRA_INIT #define PyObject_HEAD \ _PyObject_HEAD_EXTRA \ Py_ssize_t ob_refcnt; \ struct _typeobject *ob_type; #define PyObject_VAR_HEAD \ PyObject_HEAD \ Py_ssize_t ob_size; typedef struct _typeobject { PyObject_VAR_HEAD const char *tp_name; Py_ssize_t tp_basicsize, tp_itemsize; } PyTypeObject; typedef struct _object { PyObject_HEAD } PyObject; typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); struct PyMethodDef { const char *ml_name; PyCFunction ml_meth; int ml_flags; const char *ml_doc; }; typedef struct PyMethodDef PyMethodDef; #define PyObject_HEAD3 PyObject ob_base; #define PyObject_HEAD_INIT(type) \ { _PyObject_EXTRA_INIT \ 1, type }, #define PyModuleDef_HEAD_INIT { \ PyObject_HEAD_INIT(NULL) \ NULL, \ 0, \ NULL, \ } typedef int (*inquiry)(PyObject *); typedef int (*visitproc)(PyObject *, void *); typedef int (*traverseproc)(PyObject *, visitproc, void *); typedef void (*freefunc)(void *); typedef struct PyModuleDef_Base { PyObject_HEAD3 PyObject* (*m_init)(void); Py_ssize_t m_index; PyObject* m_copy; } PyModuleDef_Base; typedef struct PyModuleDef{ PyModuleDef_Base m_base; const char* m_name; const char* m_doc; Py_ssize_t m_size; PyMethodDef *m_methods; inquiry m_reload; traverseproc m_traverse; inquiry m_clear; freefunc m_free; } PyModuleDef; LIBPYTHON_EXTERN PyTypeObject* PyFunction_Type; LIBPYTHON_EXTERN PyTypeObject* PyModule_Type; LIBPYTHON_EXTERN PyTypeObject* PyType_Type; LIBPYTHON_EXTERN PyObject* Py_None; LIBPYTHON_EXTERN PyObject* Py_Unicode; LIBPYTHON_EXTERN PyObject* Py_String; LIBPYTHON_EXTERN PyObject* Py_Int; LIBPYTHON_EXTERN PyObject* Py_Long; LIBPYTHON_EXTERN PyObject* Py_Bool; LIBPYTHON_EXTERN PyObject* Py_True; LIBPYTHON_EXTERN PyObject* Py_False; LIBPYTHON_EXTERN PyObject* Py_Dict; LIBPYTHON_EXTERN PyObject* Py_Float; LIBPYTHON_EXTERN PyObject* Py_List; LIBPYTHON_EXTERN PyObject* Py_Tuple; LIBPYTHON_EXTERN PyObject* Py_Complex; void initialize_type_objects(bool python3); #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define PyUnicode_Check(o) (Py_TYPE(o) == Py_TYPE(Py_Unicode)) #define PyString_Check(o) (Py_TYPE(o) == Py_TYPE(Py_String)) #define PyInt_Check(o) (Py_TYPE(o) == Py_TYPE(Py_Int)) #define PyLong_Check(o) (Py_TYPE(o) == Py_TYPE(Py_Long)) #define PyBool_Check(o) ((o == Py_False) | (o == Py_True)) #define PyDict_Check(o) (Py_TYPE(o) == Py_TYPE(Py_Dict)) #define PyFloat_Check(o) (Py_TYPE(o) == Py_TYPE(Py_Float)) #define PyFunction_Check(op) ((PyTypeObject*)(Py_TYPE(op)) == PyFunction_Type) #define PyTuple_Check(o) (Py_TYPE(o) == Py_TYPE(Py_Tuple)) #define PyList_Check(o) (Py_TYPE(o) == Py_TYPE(Py_List)) #define PyComplex_Check(o) (Py_TYPE(o) == Py_TYPE(Py_Complex)) LIBPYTHON_EXTERN void (*Py_Initialize)(); LIBPYTHON_EXTERN PyObject* (*Py_InitModule4)(const char *name, PyMethodDef *methods, const char *doc, PyObject *self, int apiver); LIBPYTHON_EXTERN PyObject* (*PyImport_ImportModule)(const char *name); LIBPYTHON_EXTERN PyObject* (*PyImport_GetModuleDict)(); LIBPYTHON_EXTERN PyObject* (*PyModule_Create2)(PyModuleDef *def, int); LIBPYTHON_EXTERN int (*PyImport_AppendInittab)(const char *name, PyObject* (*initfunc)()); LIBPYTHON_EXTERN PyObject* (*Py_BuildValue)(const char *format, ...); LIBPYTHON_EXTERN void (*Py_IncRef)(PyObject *); LIBPYTHON_EXTERN void (*Py_DecRef)(PyObject *); LIBPYTHON_EXTERN PyObject* (*PyObject_Str)(PyObject *); LIBPYTHON_EXTERN int (*PyObject_IsInstance)(PyObject *object, PyObject *typeorclass); LIBPYTHON_EXTERN PyObject* (*PyObject_Dir)(PyObject *); LIBPYTHON_EXTERN PyObject* (*PyObject_Call)(PyObject *callable_object, PyObject *args, PyObject *kw); LIBPYTHON_EXTERN PyObject* (*PyObject_CallFunctionObjArgs)(PyObject *callable, ...); LIBPYTHON_EXTERN PyObject* (*PyObject_GetAttrString)(PyObject*, const char *); LIBPYTHON_EXTERN int (*PyObject_HasAttrString)(PyObject*, const char *); LIBPYTHON_EXTERN Py_ssize_t (*PyTuple_Size)(PyObject *); LIBPYTHON_EXTERN PyObject* (*PyTuple_GetItem)(PyObject *, Py_ssize_t); LIBPYTHON_EXTERN PyObject* (*PyTuple_New)(Py_ssize_t size); LIBPYTHON_EXTERN int (*PyTuple_SetItem)(PyObject *, Py_ssize_t, PyObject *); LIBPYTHON_EXTERN PyObject* (*PyTuple_GetSlice)(PyObject *, Py_ssize_t, Py_ssize_t); LIBPYTHON_EXTERN PyObject* (*PyList_New)(Py_ssize_t size); LIBPYTHON_EXTERN Py_ssize_t (*PyList_Size)(PyObject *); LIBPYTHON_EXTERN PyObject* (*PyList_GetItem)(PyObject *, Py_ssize_t); LIBPYTHON_EXTERN int (*PyList_SetItem)(PyObject *, Py_ssize_t, PyObject *); LIBPYTHON_EXTERN int (*PyString_AsStringAndSize)( register PyObject *obj, /* string or Unicode object */ register char **s, /* pointer to buffer variable */ register Py_ssize_t *len /* pointer to length variable or NULL (only possible for 0-terminated strings) */ ); LIBPYTHON_EXTERN PyObject* (*PyString_FromString)(const char *); LIBPYTHON_EXTERN PyObject* (*PyString_FromStringAndSize)(const char *, Py_ssize_t); LIBPYTHON_EXTERN PyObject* (*PyUnicode_EncodeLocale)(PyObject *unicode, const char *errors); LIBPYTHON_EXTERN int (*PyBytes_AsStringAndSize)( PyObject *obj, /* string or Unicode object */ char **s, /* pointer to buffer variable */ Py_ssize_t *len /* pointer to length variable or NULL (only possible for 0-terminated strings) */ ); LIBPYTHON_EXTERN PyObject* (*PyBytes_FromStringAndSize)(const char *, Py_ssize_t); LIBPYTHON_EXTERN PyObject* (*PyUnicode_FromString)(const char *u); LIBPYTHON_EXTERN void (*PyErr_Fetch)(PyObject **, PyObject **, PyObject **); LIBPYTHON_EXTERN PyObject* (*PyErr_Occurred)(void); LIBPYTHON_EXTERN void (*PyErr_NormalizeException)(PyObject**, PyObject**, PyObject**); LIBPYTHON_EXTERN int (*PyCallable_Check)(PyObject *); LIBPYTHON_EXTERN PyObject* (*PyModule_GetDict)(PyObject *); LIBPYTHON_EXTERN PyObject* (*PyImport_AddModule)(const char *); LIBPYTHON_EXTERN PyObject* (*PyRun_StringFlags)(const char *, int, PyObject*, PyObject*, void*); LIBPYTHON_EXTERN int (*PyRun_SimpleFileExFlags)(FILE *, const char *, int, void *); LIBPYTHON_EXTERN PyObject* (*PyObject_GetIter)(PyObject *); LIBPYTHON_EXTERN PyObject* (*PyIter_Next)(PyObject *); typedef void (*PyCapsule_Destructor)(PyObject *); LIBPYTHON_EXTERN PyObject* (*PyCapsule_New)(void *pointer, const char *name, PyCapsule_Destructor destructor); LIBPYTHON_EXTERN void* (*PyCapsule_GetPointer)(PyObject *capsule, const char *name); LIBPYTHON_EXTERN PyObject* (*PyDict_New)(void); LIBPYTHON_EXTERN int (*PyDict_SetItem)(PyObject *mp, PyObject *key, PyObject *item); LIBPYTHON_EXTERN int (*PyDict_SetItemString)(PyObject *dp, const char *key, PyObject *item); LIBPYTHON_EXTERN int (*PyDict_Next)( PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); LIBPYTHON_EXTERN PyObject* (*PyInt_FromLong)(long); LIBPYTHON_EXTERN long (*PyInt_AsLong)(PyObject *); LIBPYTHON_EXTERN PyObject* (*PyLong_FromLong)(long); LIBPYTHON_EXTERN long (*PyLong_AsLong)(PyObject *); LIBPYTHON_EXTERN PyObject* (*PyBool_FromLong)(long); LIBPYTHON_EXTERN PyObject* (*PyFloat_FromDouble)(double); LIBPYTHON_EXTERN double (*PyFloat_AsDouble)(PyObject *); LIBPYTHON_EXTERN PyObject* (*PyComplex_FromDoubles)(double real, double imag); LIBPYTHON_EXTERN double (*PyComplex_RealAsDouble)(PyObject *op); LIBPYTHON_EXTERN double (*PyComplex_ImagAsDouble)(PyObject *op); LIBPYTHON_EXTERN void* (*PyCObject_AsVoidPtr)(PyObject *); LIBPYTHON_EXTERN int (*PyType_IsSubtype)(PyTypeObject *, PyTypeObject *); LIBPYTHON_EXTERN void (*Py_SetProgramName)(char *); LIBPYTHON_EXTERN void (*Py_SetProgramName_v3)(wchar_t *); LIBPYTHON_EXTERN void (*Py_SetPythonHome)(char *); LIBPYTHON_EXTERN void (*Py_SetPythonHome_v3)(wchar_t *); LIBPYTHON_EXTERN void (*PySys_SetArgv)(int, char **); LIBPYTHON_EXTERN void (*PySys_SetArgv_v3)(int, wchar_t **); #define PyObject_TypeCheck(o, tp) ((PyTypeObject*)Py_TYPE(o) == (tp)) || PyType_IsSubtype((PyTypeObject*)Py_TYPE(o), (tp)) #define PyType_Check(o) PyObject_TypeCheck(o, PyType_Type) enum NPY_TYPES { NPY_BOOL=0, NPY_BYTE, NPY_UBYTE, NPY_SHORT, NPY_USHORT, NPY_INT, NPY_UINT, NPY_LONG, NPY_ULONG, NPY_LONGLONG, NPY_ULONGLONG, NPY_FLOAT, NPY_DOUBLE, NPY_LONGDOUBLE, NPY_CFLOAT, NPY_CDOUBLE, NPY_CLONGDOUBLE, NPY_OBJECT=17, NPY_STRING, NPY_UNICODE, NPY_VOID, NPY_DATETIME, NPY_TIMEDELTA, NPY_HALF, NPY_NTYPES, NPY_NOTYPE, NPY_CHAR, NPY_USERDEF=256, NPY_NTYPES_ABI_COMPATIBLE=21 }; // PyArray_Descr is opaque to our code so we just get the header typedef struct { PyObject_HEAD PyTypeObject *typeobj; char kind; char type; char byteorder; char flags; int type_num; int elsize; int alignment; // ...more fields here we don't capture... } PyArray_Descr; typedef struct tagPyArrayObject { PyObject_HEAD } PyArrayObject; typedef unsigned char npy_bool; typedef long npy_long; typedef double npy_double; typedef struct { double real, imag; } npy_cdouble; typedef npy_cdouble npy_complex128; typedef intptr_t npy_intp; typedef struct tagPyArrayObject_fields { PyObject_HEAD /* Pointer to the raw data buffer */ char *data; /* The number of dimensions, also called 'ndim' */ int nd; /* The size in each dimension, also called 'shape' */ npy_intp *dimensions; /* * Number of bytes to jump to get to the * next element in each dimension */ npy_intp *strides; /* * This object is decref'd upon * deletion of array. Except in the * case of UPDATEIFCOPY which has * special handling. * * For views it points to the original * array, collapsed so no chains of * views occur. * * For creation from buffer object it * points to an object that should be * decref'd on deletion * * For UPDATEIFCOPY flag this is an * array to-be-updated upon deletion * of this one */ PyObject *base; /* Pointer to type structure */ PyArray_Descr *descr; /* Flags describing array -- see below */ int flags; /* For weak references */ PyObject *weakreflist; } PyArrayObject_fields; LIBPYTHON_EXTERN void **PyArray_API; #define PyArray_Type (*(PyTypeObject *)PyArray_API[2]) #define PyGenericArrType_Type (*(PyTypeObject *)PyArray_API[10]) #define PyArray_CastToType \ (*(PyObject * (*)(PyArrayObject *, PyArray_Descr *, int)) \ PyArray_API[49]) #define PyArray_SetBaseObject \ (*(int (*)(PyArrayObject *, PyObject *)) \ PyArray_API[282]) #define PyArray_MultiplyList \ (*(npy_intp (*)(npy_intp *, int)) \ PyArray_API[158]) \ #define PyArray_DescrFromType \ (*(PyArray_Descr * (*)(int)) \ PyArray_API[45]) #define PyArray_DescrFromScalar \ (*(PyArray_Descr * (*)(PyObject *)) \ PyArray_API[57]) \ #define PyArray_CastScalarToCtype \ (*(int (*)(PyObject *, void *, PyArray_Descr *)) \ PyArray_API[63]) #define PyArray_New \ (*(PyObject * (*)(PyTypeObject *, int, npy_intp *, int, npy_intp *, void *, int, int, PyObject *)) \ PyArray_API[93]) inline void* PyArray_DATA(PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->data; } inline npy_intp* PyArray_DIMS(PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->dimensions; } inline int PyArray_TYPE(const PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->descr->type_num; } inline int PyArray_NDIM(const PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->nd; } #define PyArray_SIZE(m) PyArray_MultiplyList(PyArray_DIMS(m), PyArray_NDIM(m)) #define PyArray_Check(o) PyObject_TypeCheck(o, &PyArray_Type) #define PyArray_IsZeroDim(op) ((PyArray_Check(op)) && \ (PyArray_NDIM((PyArrayObject *)op) == 0)) #define PyArray_IsScalar(obj, cls) \ (PyObject_TypeCheck(obj, &Py##cls##ArrType_Type)) #define PyArray_CheckScalar(m) (PyArray_IsScalar(m, Generic) || \ (PyArray_IsZeroDim(m))) \ inline bool import_numpy_api(bool python3, std::string* pError) { PyObject* numpy = PyImport_ImportModule("numpy.core.multiarray"); if (numpy == NULL) { *pError = "numpy.core.multiarray failed to import"; return false; } PyObject* c_api = PyObject_GetAttrString(numpy, "_ARRAY_API"); Py_DecRef(numpy); if (c_api == NULL) { *pError = "numpy.core.multiarray _ARRAY_API not found"; return false; } // get api pointer if (python3) PyArray_API = (void **)PyCapsule_GetPointer(c_api, NULL); else PyArray_API = (void **)PyCObject_AsVoidPtr(c_api); Py_DecRef(c_api); if (PyArray_API == NULL) { *pError = "_ARRAY_API is NULL pointer"; return false; } return true; } #define NPY_ARRAY_F_CONTIGUOUS 0x0002 #define NPY_ARRAY_ALIGNED 0x0100 #define NPY_ARRAY_FARRAY_RO (NPY_ARRAY_F_CONTIGUOUS | NPY_ARRAY_ALIGNED) #define NPY_ARRAY_WRITEABLE 0x0400 #define NPY_ARRAY_BEHAVED (NPY_ARRAY_ALIGNED | NPY_ARRAY_WRITEABLE) #define NPY_ARRAY_FARRAY (NPY_ARRAY_F_CONTIGUOUS | NPY_ARRAY_BEHAVED) class SharedLibrary { public: bool load(const std::string& libPath, bool python3, std::string* pError); bool unload(std::string* pError); virtual ~SharedLibrary() {} private: virtual bool loadSymbols(bool python3, std::string* pError) = 0; protected: SharedLibrary() : pLib_(NULL) {} private: SharedLibrary(const SharedLibrary&); protected: void* pLib_; }; class LibPython : public SharedLibrary { private: LibPython() : SharedLibrary() {} friend SharedLibrary& libPython(); virtual bool loadSymbols(bool python3, std::string* pError); }; inline SharedLibrary& libPython() { static LibPython instance; return instance; } } // namespace libpython #endif
29.720408
122
0.722928
085c563c5e11bb7c59f9bf40bde56c6da11533d0
1,337
h
C
header.h
grailbio/recordio
515b85dc29abb8abcd6d02c887b3ff3013f52445
[ "Apache-2.0" ]
null
null
null
header.h
grailbio/recordio
515b85dc29abb8abcd6d02c887b3ff3013f52445
[ "Apache-2.0" ]
null
null
null
header.h
grailbio/recordio
515b85dc29abb8abcd6d02c887b3ff3013f52445
[ "Apache-2.0" ]
1
2020-12-17T10:09:39.000Z
2020-12-17T10:09:39.000Z
#ifndef LIB_RECORDIO_HEADER_H_ #define LIB_RECORDIO_HEADER_H_ #include <cstdint> #include <string> #include <vector> namespace grail { namespace recordio { // HeaderEntry is a result of parsing the header block. The header block stores // key-value pairs, and HeaderEntry represents a single key and value pair. struct HeaderValue { enum Type { INVALID = 0, BOOL = 1, INT = 2, UINT = 3, STRING = 4 }; Type type; bool b; // Valid iff type==BOOL int64_t i; // Valid iff type==INT uint64_t u; // Valid iff type==UINT std::string s; // Valid iff type==STRING }; struct HeaderEntry { std::string key; HeaderValue value; }; // Key "trailer". Indicates whether a trailer block is present. The value is // BOOL. extern const char* const kKeyTrailer; // Key "transformer". Sets the list of transformers for each block. extern const char* const kKeyTransformer; namespace internal { class ErrorReporter; // Decode the contents of a header item. std::vector<HeaderEntry> DecodeHeader(const uint8_t* data, int size, ErrorReporter* err); // See if the header has entry {"trailer", true}. std::string HasTrailer(const std::vector<HeaderEntry>& header, bool* v); } // namespace internal } // namespace recordio } // namespace grail #endif // LIB_RECORDIO_HEADER_H_
27.854167
79
0.696335
085d0436bfa68621121a7b407148adead2cf3cbd
2,022
h
C
tf2_src/game/server/tf/bot/behavior/spy/tf_bot_spy_attack.h
d3fc0n6/TeamFortress2
1b81dded673d49adebf4d0958e52236ecc28a956
[ "MIT" ]
4
2021-10-03T05:16:55.000Z
2021-12-28T16:49:27.000Z
tf2_src/game/server/tf/bot/behavior/spy/tf_bot_spy_attack.h
Counter2828/TeamFortress2
1b81dded673d49adebf4d0958e52236ecc28a956
[ "MIT" ]
null
null
null
tf2_src/game/server/tf/bot/behavior/spy/tf_bot_spy_attack.h
Counter2828/TeamFortress2
1b81dded673d49adebf4d0958e52236ecc28a956
[ "MIT" ]
3
2022-02-02T18:09:58.000Z
2022-03-06T18:54:39.000Z
//========= Copyright Valve Corporation, All rights reserved. ============// // tf_bot_spy_attack.h // Backstab or pistol, as appropriate // Michael Booth, June 2010 #ifndef TF_BOT_SPY_ATTACK_H #define TF_BOT_SPY_ATTACK_H #include "Path/NextBotChasePath.h" //------------------------------------------------------------------------------- class CTFBotSpyAttack : public Action< CTFBot > { public: CTFBotSpyAttack( CTFPlayer *victim ); virtual ~CTFBotSpyAttack() { } virtual ActionResult< CTFBot > OnStart( CTFBot *me, Action< CTFBot > *priorAction ); virtual ActionResult< CTFBot > Update( CTFBot *me, float interval ); virtual ActionResult< CTFBot > OnResume( CTFBot *me, Action< CTFBot > *interruptingAction ); virtual EventDesiredResult< CTFBot > OnStuck( CTFBot *me ); virtual EventDesiredResult< CTFBot > OnInjured( CTFBot *me, const CTakeDamageInfo &info ); virtual EventDesiredResult< CTFBot > OnContact( CTFBot *me, CBaseEntity *other, CGameTrace *result = NULL ); virtual QueryResultType ShouldRetreat( const INextBot *me ) const; // is it time to retreat? virtual QueryResultType ShouldHurry( const INextBot *me ) const; // are we in a hurry? virtual QueryResultType ShouldAttack( const INextBot *meBot, const CKnownEntity *them ) const; virtual QueryResultType IsHindrance( const INextBot *me, CBaseEntity *blocker ) const; // use this to signal the enemy we are focusing on, so we dont avoid them virtual const CKnownEntity * SelectMoreDangerousThreat( const INextBot *me, const CBaseCombatCharacter *subject, const CKnownEntity *threat1, const CKnownEntity *threat2 ) const; // return the more dangerous of the two threats to 'subject', or NULL if we have no opinion virtual const char *GetName( void ) const { return "SpyAttack"; }; private: CHandle< CTFPlayer > m_victim; ChasePath m_path; bool m_isCoverBlown; CountdownTimer m_chuckleTimer; CountdownTimer m_decloakTimer; }; #endif // TF_BOT_SPY_ATTACK_H
40.44
162
0.703264
085d9687613a342761a262fbb40894911b2a5ef2
614
h
C
DuRuiYvWaShop/YuWaShop/YuWaShop/Person/SubVC/YWPersonVC.h
daidi-double/_new_DuRuiYvWaShop
45cfc39ca3ce2c3e646e6d5f3eeb7c71c06dd5ed
[ "MIT" ]
1
2018-05-28T03:46:29.000Z
2018-05-28T03:46:29.000Z
DuRuiYvWaShop/YuWaShop/YuWaShop/Person/SubVC/YWPersonVC.h
daidi-double/_new_DuRuiYvWaShop
45cfc39ca3ce2c3e646e6d5f3eeb7c71c06dd5ed
[ "MIT" ]
null
null
null
DuRuiYvWaShop/YuWaShop/YuWaShop/Person/SubVC/YWPersonVC.h
daidi-double/_new_DuRuiYvWaShop
45cfc39ca3ce2c3e646e6d5f3eeb7c71c06dd5ed
[ "MIT" ]
null
null
null
// // YWPersonVC.h // YuWaShop // // Created by Tian Wei You on 16/11/23. // Copyright © 2016年 Shanghai DuRui Information Technology Company. All rights reserved. // #import <Foundation/Foundation.h> #import "YWPersonShopViewController.h" #import "YWPersonNewsViewController.h" #import "YWBankViewController.h" #import "YWPersonWeekCountViewController.h" #import "YWPersonSuperVipViewController.h" #import "YWPersonCooperaViewController.h" #import "YWPersonHelpViewController.h" // #import "YWPersonSuggestViewController.h" #import "YWPersonSettingViewController.h" @interface YWPersonVC : NSObject @end
22.740741
89
0.788274
085e9ee820614a825b8e3fe2e1faf27ed7a89a92
328
c
C
06-08-2020/q_2.c
suehtamCruz/FUP_2020
450d2cd8f5c5f0fc2715c504a699403180f3a7b1
[ "MIT" ]
null
null
null
06-08-2020/q_2.c
suehtamCruz/FUP_2020
450d2cd8f5c5f0fc2715c504a699403180f3a7b1
[ "MIT" ]
null
null
null
06-08-2020/q_2.c
suehtamCruz/FUP_2020
450d2cd8f5c5f0fc2715c504a699403180f3a7b1
[ "MIT" ]
null
null
null
#include<stdio.h> int main(void) { int num=0; scanf("%d", &num); if (num%num==0 && num%1==0) { if(num == 1 || num == 2 || num == 3 || num == 5){ printf("\n'Primo"); }else{ (num%2!=0 && num%3!=0 && num%5!=0)?printf("\nPrimo"):printf("\nNao primo"); } } return 0; }
23.428571
87
0.417683
085efdd98f516c60324ff79a592f66927f3b2d6a
23
c
C
cores/PTX/temp/t266.cudafe2.c
tinochinamora/iw_imdb
89964024bee7f8eaaa25530a8d40155251345be0
[ "MIT" ]
3
2021-09-10T08:14:45.000Z
2022-02-25T04:53:12.000Z
cores/PTX/temp/t266.cudafe2.c
PrincetonUniversity/ILA-Modeling-Verification
88964aad8c465c9da82f1ec66425da9f16fc8d29
[ "MIT" ]
1
2018-06-25T08:49:22.000Z
2018-06-25T08:49:22.000Z
cores/PTX/temp/t266.cudafe2.c
PrincetonUniversity/ILA-Modeling-Verification
88964aad8c465c9da82f1ec66425da9f16fc8d29
[ "MIT" ]
3
2018-06-26T11:31:40.000Z
2021-12-01T20:16:21.000Z
# 1 "t266.cudafe1.gpu"
11.5
22
0.652174
085fa32e57acec01c30be4fd80ac11fbd5c4d556
3,561
h
C
Script/blmvm.h
accurat-toolkit/maxent_DFKI_v3
a4e72f88dd318a40d108af06f52640d8064e39c5
[ "BSD-2-Clause" ]
1
2017-10-26T20:23:29.000Z
2017-10-26T20:23:29.000Z
Script/blmvm.h
accurat-toolkit/maxent_DFKI_v3
a4e72f88dd318a40d108af06f52640d8064e39c5
[ "BSD-2-Clause" ]
null
null
null
Script/blmvm.h
accurat-toolkit/maxent_DFKI_v3
a4e72f88dd318a40d108af06f52640d8064e39c5
[ "BSD-2-Clause" ]
null
null
null
/* COPYRIGHT NOTIFICATION (C) COPYRIGHT 2004 UNIVERSITY OF CHICAGO This program discloses material protectable under copyright laws of the United States. Permission to copy and modify this software and its documentation is hereby granted, provided that this notice is retained thereon and on all copies or modifications. The University of Chicago makes no representations as to the suitability and operability of this software for any purpose. It is provided "as is"; without express or implied warranty. Permission is hereby granted to use, reproduce, prepare derivative works, and to redistribute to others, so long as this original copyright notice is retained. Any publication resulting from research that made use of this software should cite the document: Steven J. Benson and Jorge Mor\'{e}, "A Limited-Memory Variable-Metric Algorithm for Bound-Constrained Minimization", Mathematics and Computer Science Division, Argonne National Laboratory, ANL/MCS-P909-0901, 2001. Argonne National Laboratory with facilities in the states of Illinois and Idaho, is owned by The United States Government, and operated by the University of Chicago under provision of a contract with the Department of Energy. DISCLAIMER THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY OF THE UNITED STATES GOVERNMENT. NEITHER THE UNITED STATES GOVERNMENT NOR ANY AGENCY THEREOF, NOR THE UNIVERSITY OF CHICAGO, NOR ANY OF THEIR EMPLOYEES OR OFFICERS, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. REFERENCE HEREIN TO ANY SPECIFIC COMMERCIAL PRODUCT, PROCESS, OR SERVICE BY TRADE NAME, TRADEMARK, MANUFACTURER, OR OTHERWISE, DOES NOT NECESSARILY CONSTITUTE OR IMPLY ITS ENDORSEMENT, RECOMMENDATION, OR FAVORING BY THE UNITED STATES GOVERNMENT OR ANY AGENCY THEREOF. THE VIEW AND OPINIONS OF AUTHORS EXPRESSED HEREIN DO NOT NECESSARILY STATE OR REFLECT THOSE OF THE UNITED STATES GOVERNMENT OR ANY AGENCY THEREOF. */ /* Applications of the BLMVM solver for bound constrained minimization must implement 2 routines: BLMVMFunctionGradient(), BLMVMConverge(). In addition, they must call the routine BLMVMSolveIt() with the number of variables, and initial solution, lower and upper bounds, and a parameter. To solve applications other than the following example, replace the two routines with other routines and call BLMVMSolveIt() with the appropriate arguments. */ /* * $Id: blmvm.h,v 1.2 2005/04/27 10:30:44 tsuruoka Exp $ */ #ifndef __BLMVM_H_ #define __BLMVM_H_ struct _P_BLMVMVec{ int dim; double *val; }; typedef struct _P_BLMVMVec *BLMVMVec; struct _P_LMVMMat{ int lm; int lmnow; int iter; int rejects; double eps; BLMVMVec *S; BLMVMVec *Y; BLMVMVec Gprev; BLMVMVec Xprev; double y0normsquared; double *rho; double *beta; }; typedef struct _P_LMVMMat *LMVMMat; struct P_BLMVM{ LMVMMat M; BLMVMVec DX; BLMVMVec GP; BLMVMVec G; BLMVMVec XL; BLMVMVec XU; BLMVMVec Xold; int pgits; }; typedef struct P_BLMVM *BLMVM; #endif /* * $Log: blmvm.h,v $ * Revision 1.2 2005/04/27 10:30:44 tsuruoka * add copyright * * Revision 1.1 2004/07/26 13:10:55 tsuruoka * add files * * Revision 1.1 2004/07/02 09:15:36 tsuruoka * add LMVM * */
30.698276
103
0.750351
0860298b722fd3306e51ee5f171e81718834645e
3,106
h
C
ModelingProject1/SourceCode/Game Physics/Collisions/Collider.h
OscarRPR/samurai-reborn
9354e18942c220f687bf1b54649e19541b19157b
[ "MIT" ]
1
2015-10-11T01:26:08.000Z
2015-10-11T01:26:08.000Z
ModelingProject1/SourceCode/Game Physics/Collisions/Collider.h
OscarRPR/samurai-reborn
9354e18942c220f687bf1b54649e19541b19157b
[ "MIT" ]
null
null
null
ModelingProject1/SourceCode/Game Physics/Collisions/Collider.h
OscarRPR/samurai-reborn
9354e18942c220f687bf1b54649e19541b19157b
[ "MIT" ]
null
null
null
#pragma once #include "CollisionBox.h" #include <Tilemap.h> #include "Enemy.h" #include "Player.h" #include "Tile.h" class Collider { public: static Collider* getInstance(); void addLayerTilemap(std::vector< std::vector < Tile > > layer); void setGameMode(int mode) { gameMode = mode; } void setLevelLength(int length) { levelLength = length; } void cleanUpResources(); bool checkCollision(CollisionSystem::CollisionBox& A, CollisionSystem::CollisionBox& B); void checkTileCollisionX(CollisionSystem::CollisionBox& A, GLfloat* speedX, int directionX, CollisionSystem::DirectionsMove& directionsMove); void checkTileCollisionY(CollisionSystem::CollisionBox& A, GLfloat* speedY, int directionY, CollisionSystem::DirectionsMove& directionsMove); int positionCollisionBoxAxisX(CollisionSystem::CollisionBox& A, int directionX, GLfloat newSpeed, int rightCondition); int positionCollisionBoxAxisY(CollisionSystem::CollisionBox& A, int directionY, GLfloat newSpeed, int rightCondition); void checkTopBoxCollision( CollisionSystem::DirectionsMove& directionsMove, int topY, int directionY, int currentPositionY ); void checkBodyBoxCollision( CollisionSystem::CollisionBox& A, CollisionSystem::DirectionsMove& directionsMove, int directionX, int currentPositionY ); void checkBottomBoxCollision( CollisionSystem::CollisionBox& A, CollisionSystem::DirectionsMove& directionsMove, int directionX, int currentPositionX, int currentPositionY); bool checkBottomBoxMovementY( CollisionSystem::DirectionsMove& directionsMove, int newRightDirection, int currentY, int boxXtreme, bool tileIsWalkable ); void checkStateCollisionPlayer( Sprite& playerSprite ); void checkStateCollisionXAxis( Sprite& playerSprite ); void checkStatePhysicsModes( Sprite& playerSprite ); void checkAttackCollisions( boost::ptr_vector< Characters::Enemy >& enemiesList, boost::ptr_vector< Characters::Player >& playersList, int indexPlayer ); void checkArenaCollisions( boost::ptr_vector< Characters::Player >& playersList, int indexPlayer ); void checkEnemiesCollisions( boost::ptr_vector< Characters::Enemy >& enemiesList, CollisionSystem::CollisionBox& A ); void checkCollisionsObjects( Characters::Player& player, Tilemap& tilemap ); bool onTheGround(CollisionSystem::CollisionBox& A); bool checkPositionWithinLevelLength(CollisionSystem::CollisionBox& A, CollisionSystem::DirectionsMove& directionsMove, Vector2f speed, int directionX); int getLevelLength() { return levelLength; } protected: Collider(); private: static bool instanceFlag; static Collider* collider; int levelLength; int gameMode; std::vector< std::vector< std::vector < Tile > > > layers; int numberOfCollisionLayers; bool hasObjectLayerChange; };
44.371429
134
0.703799
086226e9dba640f173110da556cffb69784d1d81
1,215
c
C
drivers/clk/meson/clk-input.c
fergy/aplit_linux-5
a6ef4cb0e17e1eec9743c064e65f730c49765711
[ "MIT" ]
1
2022-01-30T20:01:25.000Z
2022-01-30T20:01:25.000Z
drivers/clk/meson/clk-input.c
fergy/aplit_linux-5
a6ef4cb0e17e1eec9743c064e65f730c49765711
[ "MIT" ]
null
null
null
drivers/clk/meson/clk-input.c
fergy/aplit_linux-5
a6ef4cb0e17e1eec9743c064e65f730c49765711
[ "MIT" ]
1
2019-10-11T07:35:58.000Z
2019-10-11T07:35:58.000Z
// SPDX-License-Identifier: (GPL-2.0 OR MIT) /* * Copyright (c) 2018 BayLibre, SAS. * Author: Jerome Brunet <jbrunet@baylibre.com> */ #include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/device.h> #include <linux/module.h> #include "clk-input.h" static const struct clk_ops meson_clk_no_ops = {}; struct clk_hw *meson_clk_hw_register_input(struct device *dev, const char *of_name, const char *clk_name, unsigned long flags) { struct clk *parent_clk = devm_clk_get(dev, of_name); struct clk_init_data init; const char *parent_name; struct clk_hw *hw; int ret; if (IS_ERR(parent_clk)) return (struct clk_hw *)parent_clk; hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL); if (!hw) return ERR_PTR(-ENOMEM); parent_name = __clk_get_name(parent_clk); init.name = clk_name; init.ops = &meson_clk_no_ops; init.flags = flags; init.parent_names = &parent_name; init.num_parents = 1; hw->init = &init; ret = devm_clk_hw_register(dev, hw); return ret ? ERR_PTR(ret) : hw; } EXPORT_SYMBOL_GPL(meson_clk_hw_register_input); MODULE_DESCRIPTION("Amlogic clock input helper"); MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>"); MODULE_LICENSE("GPL v2");
24.3
62
0.720165
086470c9dabde71b03bd14fcdd693dbf890fc940
23,988
c
C
src/weno_gauss_radau006005.c
alexfikl/PyWENO
224fe7459f00578728b151531367c67c62f57c2b
[ "BSD-3-Clause" ]
26
2015-07-09T13:32:39.000Z
2021-10-13T06:55:07.000Z
src/weno_gauss_radau006005.c
alexfikl/PyWENO
224fe7459f00578728b151531367c67c62f57c2b
[ "BSD-3-Clause" ]
4
2015-03-16T16:11:31.000Z
2021-03-08T17:33:41.000Z
src/weno_gauss_radau006005.c
alexfikl/PyWENO
224fe7459f00578728b151531367c67c62f57c2b
[ "BSD-3-Clause" ]
12
2015-08-14T12:44:37.000Z
2022-01-09T12:03:13.000Z
#include <Python.h> #include <numpy/ndarrayobject.h> void weights_gauss_radau006005 (const double *restrict sigma, int n, int ssi, int ssr, double *restrict omega, int wsi, int wsl, int wsr) { int i; double acc, sigma0, sigma1, sigma2, sigma3, sigma4, sigma5, omega9, omega18, omega15p, omega16m, omega14p, omega3, omega24, omega8, omega16p, omega19, omega21, omega28, omega15m, omega11, omega12m, omega4, omega29, omega25, omega12p, omega20, omega0, omega17p, omega10, omega17m, omega5, omega26, omega6, omega23, omega1, omega13p, omega14m, omega13m, omega7, omega27, omega22, omega2; for (i = 6; i < n - 6; i++) { sigma0 = sigma[i * ssi + 0 * ssr]; sigma1 = sigma[i * ssi + 1 * ssr]; sigma2 = sigma[i * ssi + 2 * ssr]; sigma3 = sigma[i * ssi + 3 * ssr]; sigma4 = sigma[i * ssi + 4 * ssr]; sigma5 = sigma[i * ssi + 5 * ssr]; acc = 0.0; omega0 = (+0.00216450216450216) / ((sigma0 + 1.0e-6) * (sigma0 + 1.0e-6)); acc = acc + omega0; omega1 = (+0.0649350649350649) / ((sigma1 + 1.0e-6) * (sigma1 + 1.0e-6)); acc = acc + omega1; omega2 = (+0.324675324675325) / ((sigma2 + 1.0e-6) * (sigma2 + 1.0e-6)); acc = acc + omega2; omega3 = (+0.432900432900433) / ((sigma3 + 1.0e-6) * (sigma3 + 1.0e-6)); acc = acc + omega3; omega4 = (+0.162337662337662) / ((sigma4 + 1.0e-6) * (sigma4 + 1.0e-6)); acc = acc + omega4; omega5 = (+0.012987012987013) / ((sigma5 + 1.0e-6) * (sigma5 + 1.0e-6)); acc = acc + omega5; omega0 = (omega0) / (acc); omega1 = (omega1) / (acc); omega2 = (omega2) / (acc); omega3 = (omega3) / (acc); omega4 = (omega4) / (acc); omega5 = (omega5) / (acc); acc = 0.0; omega6 = (+0.00426824262664219) / ((sigma0 + 1.0e-6) * (sigma0 + 1.0e-6)); acc = acc + omega6; omega7 = (+0.0891765249448771) / ((sigma1 + 1.0e-6) * (sigma1 + 1.0e-6)); acc = acc + omega7; omega8 = (+0.361654578424202) / ((sigma2 + 1.0e-6) * (sigma2 + 1.0e-6)); acc = acc + omega8; omega9 = (+0.407020388815206) / ((sigma3 + 1.0e-6) * (sigma3 + 1.0e-6)); acc = acc + omega9; omega10 = (+0.129362676595996) / ((sigma4 + 1.0e-6) * (sigma4 + 1.0e-6)); acc = acc + omega10; omega11 = (+0.00851758859307624) / ((sigma5 + 1.0e-6) * (sigma5 + 1.0e-6)); acc = acc + omega11; omega6 = (omega6) / (acc); omega7 = (omega7) / (acc); omega8 = (omega8) / (acc); omega9 = (omega9) / (acc); omega10 = (omega10) / (acc); omega11 = (omega11) / (acc); acc = 0.0; omega12p = ((+0.00606922515724062) / (+3.24868642929383)) / ((sigma0 + 1.0e-6) * (sigma0 + 1.0e-6)); acc = acc + omega12p; omega13p = ((+2.34878176944526) / (+3.24868642929383)) / ((sigma1 + 1.0e-6) * (sigma1 + 1.0e-6)); acc = acc + omega13p; omega14p = ((+0.410159584607371) / (+3.24868642929383)) / ((sigma2 + 1.0e-6) * (sigma2 + 1.0e-6)); acc = acc + omega14p; omega15p = ((+0.392736766003681) / (+3.24868642929383)) / ((sigma3 + 1.0e-6) * (sigma3 + 1.0e-6)); acc = acc + omega15p; omega16p = ((+0.087262024268935) / (+3.24868642929383)) / ((sigma4 + 1.0e-6) * (sigma4 + 1.0e-6)); acc = acc + omega16p; omega17p = ((+0.00367705981134819) / (+3.24868642929383)) / ((sigma5 + 1.0e-6) * (sigma5 + 1.0e-6)); acc = acc + omega17p; omega12p = (omega12p) / (acc); omega13p = (omega13p) / (acc); omega14p = (omega14p) / (acc); omega15p = (omega15p) / (acc); omega16p = (omega16p) / (acc); omega17p = (omega17p) / (acc); acc = 0.0; omega12m = ((+0.0121384503144812) / (+2.24868642929383)) / ((sigma0 + 1.0e-6) * (sigma0 + 1.0e-6)); acc = acc + omega12m; omega13m = ((+1.17439088472263) / (+2.24868642929383)) / ((sigma1 + 1.0e-6) * (sigma1 + 1.0e-6)); acc = acc + omega13m; omega14m = ((+0.820319169214742) / (+2.24868642929383)) / ((sigma2 + 1.0e-6) * (sigma2 + 1.0e-6)); acc = acc + omega14m; omega15m = ((+0.19636838300184) / (+2.24868642929383)) / ((sigma3 + 1.0e-6) * (sigma3 + 1.0e-6)); acc = acc + omega15m; omega16m = ((+0.0436310121344675) / (+2.24868642929383)) / ((sigma4 + 1.0e-6) * (sigma4 + 1.0e-6)); acc = acc + omega16m; omega17m = ((+0.0018385299056741) / (+2.24868642929383)) / ((sigma5 + 1.0e-6) * (sigma5 + 1.0e-6)); acc = acc + omega17m; omega12m = (omega12m) / (acc); omega13m = (omega13m) / (acc); omega14m = (omega14m) / (acc); omega15m = (omega15m) / (acc); omega16m = (omega16m) / (acc); omega17m = (omega17m) / (acc); acc = 0.0; omega18 = (+0.00509752056089433) / ((sigma0 + 1.0e-6) * (sigma0 + 1.0e-6)); acc = acc + omega18; omega19 = (+0.0953592272030808) / ((sigma1 + 1.0e-6) * (sigma1 + 1.0e-6)); acc = acc + omega19; omega20 = (+0.361443965126561) / ((sigma2 + 1.0e-6) * (sigma2 + 1.0e-6)); acc = acc + omega20; omega21 = (+0.39505934648208) / ((sigma3 + 1.0e-6) * (sigma3 + 1.0e-6)); acc = acc + omega21; omega22 = (+0.129722568471249) / ((sigma4 + 1.0e-6) * (sigma4 + 1.0e-6)); acc = acc + omega22; omega23 = (+0.0133173721561354) / ((sigma5 + 1.0e-6) * (sigma5 + 1.0e-6)); acc = acc + omega23; omega18 = (omega18) / (acc); omega19 = (omega19) / (acc); omega20 = (omega20) / (acc); omega21 = (omega21) / (acc); omega22 = (omega22) / (acc); omega23 = (omega23) / (acc); acc = 0.0; omega24 = (+0.0109882663243742) / ((sigma0 + 1.0e-6) * (sigma0 + 1.0e-6)); acc = acc + omega24; omega25 = (+0.148687067908692) / ((sigma1 + 1.0e-6) * (sigma1 + 1.0e-6)); acc = acc + omega25; omega26 = (+0.423804109061958) / ((sigma2 + 1.0e-6) * (sigma2 + 1.0e-6)); acc = acc + omega26; omega27 = (+0.339947422860076) / ((sigma3 + 1.0e-6) * (sigma3 + 1.0e-6)); acc = acc + omega27; omega28 = (+0.0737548471045655) / ((sigma4 + 1.0e-6) * (sigma4 + 1.0e-6)); acc = acc + omega28; omega29 = (+0.00281828674034706) / ((sigma5 + 1.0e-6) * (sigma5 + 1.0e-6)); acc = acc + omega29; omega24 = (omega24) / (acc); omega25 = (omega25) / (acc); omega26 = (omega26) / (acc); omega27 = (omega27) / (acc); omega28 = (omega28) / (acc); omega29 = (omega29) / (acc); omega[i * wsi + 0 * wsl + 0 * wsr + 0] = omega0; omega[i * wsi + 0 * wsl + 1 * wsr + 0] = omega1; omega[i * wsi + 0 * wsl + 2 * wsr + 0] = omega2; omega[i * wsi + 0 * wsl + 3 * wsr + 0] = omega3; omega[i * wsi + 0 * wsl + 4 * wsr + 0] = omega4; omega[i * wsi + 0 * wsl + 5 * wsr + 0] = omega5; omega[i * wsi + 1 * wsl + 0 * wsr + 0] = omega6; omega[i * wsi + 1 * wsl + 1 * wsr + 0] = omega7; omega[i * wsi + 1 * wsl + 2 * wsr + 0] = omega8; omega[i * wsi + 1 * wsl + 3 * wsr + 0] = omega9; omega[i * wsi + 1 * wsl + 4 * wsr + 0] = omega10; omega[i * wsi + 1 * wsl + 5 * wsr + 0] = omega11; omega[i * wsi + 2 * wsl + 0 * wsr + 0] = omega12p; omega[i * wsi + 2 * wsl + 0 * wsr + 1] = omega12m; omega[i * wsi + 2 * wsl + 1 * wsr + 0] = omega13p; omega[i * wsi + 2 * wsl + 1 * wsr + 1] = omega13m; omega[i * wsi + 2 * wsl + 2 * wsr + 0] = omega14p; omega[i * wsi + 2 * wsl + 2 * wsr + 1] = omega14m; omega[i * wsi + 2 * wsl + 3 * wsr + 0] = omega15p; omega[i * wsi + 2 * wsl + 3 * wsr + 1] = omega15m; omega[i * wsi + 2 * wsl + 4 * wsr + 0] = omega16p; omega[i * wsi + 2 * wsl + 4 * wsr + 1] = omega16m; omega[i * wsi + 2 * wsl + 5 * wsr + 0] = omega17p; omega[i * wsi + 2 * wsl + 5 * wsr + 1] = omega17m; omega[i * wsi + 3 * wsl + 0 * wsr + 0] = omega18; omega[i * wsi + 3 * wsl + 1 * wsr + 0] = omega19; omega[i * wsi + 3 * wsl + 2 * wsr + 0] = omega20; omega[i * wsi + 3 * wsl + 3 * wsr + 0] = omega21; omega[i * wsi + 3 * wsl + 4 * wsr + 0] = omega22; omega[i * wsi + 3 * wsl + 5 * wsr + 0] = omega23; omega[i * wsi + 4 * wsl + 0 * wsr + 0] = omega24; omega[i * wsi + 4 * wsl + 1 * wsr + 0] = omega25; omega[i * wsi + 4 * wsl + 2 * wsr + 0] = omega26; omega[i * wsi + 4 * wsl + 3 * wsr + 0] = omega27; omega[i * wsi + 4 * wsl + 4 * wsr + 0] = omega28; omega[i * wsi + 4 * wsl + 5 * wsr + 0] = omega29; } } PyObject * py_weights_gauss_radau006005 (PyObject * self, PyObject * args) { double *sigma, *omega; PyArrayObject *sigma_py, *omega_py; long int n; int ssi, ssr, wsi, wsl, wsr; /* parse options */ if (!PyArg_ParseTuple (args, "OO", &sigma_py, &omega_py)) return NULL; if (sigma_py->nd != 2 || sigma_py->descr->type_num != PyArray_DOUBLE) { PyErr_SetString (PyExc_ValueError, "sigma must be two-dimensional and of type float"); return NULL; } if (omega_py->descr->type_num != PyArray_DOUBLE) { PyErr_SetString (PyExc_ValueError, "omega must be of type float"); return NULL; } if (!(omega_py->nd >= 2 && omega_py->nd <= 4)) { PyErr_SetString (PyExc_ValueError, "omega must be two, three, or four dimensional"); return NULL; } /* get data, n, strides */ sigma = (double *) PyArray_DATA (sigma_py); omega = (double *) PyArray_DATA (omega_py); n = PyArray_DIM (omega_py, 0); ssi = sigma_py->strides[0] / sizeof (double); ssr = sigma_py->strides[1] / sizeof (double); wsi = omega_py->strides[0] / sizeof (double); if (omega_py->nd == 3) { wsl = omega_py->strides[1] / sizeof (double); wsr = omega_py->strides[2] / sizeof (double); } else { wsl = 0; wsr = omega_py->strides[1] / sizeof (double); } weights_gauss_radau006005 (sigma, n, ssi, ssr, omega, wsi, wsl, wsr); Py_INCREF (Py_None); return Py_None; } void reconstruct_gauss_radau006005 (const double *restrict f, int n, int fsi, const double *restrict omega, int wsi, int wsl, int wsr, double *restrict fr, int frsi, int frsl) { int i; double omega9, omega18, omega15p, omega16m, omega14p, omega3, omega24, omega8, omega16p, omega19, omega21, omega28, omega15m, omega11, omega12m, omega4, omega29, omega25, omega12p, omega20, omega0, omega17p, omega10, omega17m, omega5, omega26, omega6, omega23, omega1, omega13p, omega14m, omega13m, omega7, omega27, omega22, omega2, fs0, fs1, fs2, fs3, fs4, fr9, fr18, fr13, fr17, fr3, fr24, fr8, fr21, fr28, fr11, fr14, fr25, fr7, fr20, fr0, fr29, fr4, fr10, fr5, fr26, fr6, fr23, fr1, fr19, fr2, fr12, fr27, fr15, fr22, fr16; for (i = 6; i < n - 6; i++) { omega0 = omega[i * wsi + 0 * wsl + 0 * wsr + 0]; omega1 = omega[i * wsi + 0 * wsl + 1 * wsr + 0]; omega2 = omega[i * wsi + 0 * wsl + 2 * wsr + 0]; omega3 = omega[i * wsi + 0 * wsl + 3 * wsr + 0]; omega4 = omega[i * wsi + 0 * wsl + 4 * wsr + 0]; omega5 = omega[i * wsi + 0 * wsl + 5 * wsr + 0]; omega6 = omega[i * wsi + 1 * wsl + 0 * wsr + 0]; omega7 = omega[i * wsi + 1 * wsl + 1 * wsr + 0]; omega8 = omega[i * wsi + 1 * wsl + 2 * wsr + 0]; omega9 = omega[i * wsi + 1 * wsl + 3 * wsr + 0]; omega10 = omega[i * wsi + 1 * wsl + 4 * wsr + 0]; omega11 = omega[i * wsi + 1 * wsl + 5 * wsr + 0]; omega12p = omega[i * wsi + 2 * wsl + 0 * wsr + 0]; omega12m = omega[i * wsi + 2 * wsl + 0 * wsr + 1]; omega13p = omega[i * wsi + 2 * wsl + 1 * wsr + 0]; omega13m = omega[i * wsi + 2 * wsl + 1 * wsr + 1]; omega14p = omega[i * wsi + 2 * wsl + 2 * wsr + 0]; omega14m = omega[i * wsi + 2 * wsl + 2 * wsr + 1]; omega15p = omega[i * wsi + 2 * wsl + 3 * wsr + 0]; omega15m = omega[i * wsi + 2 * wsl + 3 * wsr + 1]; omega16p = omega[i * wsi + 2 * wsl + 4 * wsr + 0]; omega16m = omega[i * wsi + 2 * wsl + 4 * wsr + 1]; omega17p = omega[i * wsi + 2 * wsl + 5 * wsr + 0]; omega17m = omega[i * wsi + 2 * wsl + 5 * wsr + 1]; omega18 = omega[i * wsi + 3 * wsl + 0 * wsr + 0]; omega19 = omega[i * wsi + 3 * wsl + 1 * wsr + 0]; omega20 = omega[i * wsi + 3 * wsl + 2 * wsr + 0]; omega21 = omega[i * wsi + 3 * wsl + 3 * wsr + 0]; omega22 = omega[i * wsi + 3 * wsl + 4 * wsr + 0]; omega23 = omega[i * wsi + 3 * wsl + 5 * wsr + 0]; omega24 = omega[i * wsi + 4 * wsl + 0 * wsr + 0]; omega25 = omega[i * wsi + 4 * wsl + 1 * wsr + 0]; omega26 = omega[i * wsi + 4 * wsl + 2 * wsr + 0]; omega27 = omega[i * wsi + 4 * wsl + 3 * wsr + 0]; omega28 = omega[i * wsi + 4 * wsl + 4 * wsr + 0]; omega29 = omega[i * wsi + 4 * wsl + 5 * wsr + 0]; fr0 = (+2.45) * (f[(i + 0) * fsi]) + (-3.55) * (f[(i + 1) * fsi]) + (+3.95) * (f[(i + 2) * fsi]) + (-2.71666666666667) * (f[(i + 3) * fsi]) + (+1.03333333333333) * (f[(i + 4) * fsi]) + (-0.166666666666667) * (f[(i + 5) * fsi]); fr1 = (+0.166666666666667) * (f[(i - 1) * fsi]) + (+1.45) * (f[(i + 0) * fsi]) + (-1.05) * (f[(i + 1) * fsi]) + (+0.616666666666667) * (f[(i + 2) * fsi]) + (-0.216666666666667) * (f[(i + 3) * fsi]) + (+0.0333333333333333) * (f[(i + 4) * fsi]); fr2 = (-0.0333333333333333) * (f[(i - 2) * fsi]) + (+0.366666666666667) * (f[(i - 1) * fsi]) + (+0.95) * (f[(i + 0) * fsi]) + (-0.383333333333333) * (f[(i + 1) * fsi]) + (+0.116666666666667) * (f[(i + 2) * fsi]) + (-0.0166666666666667) * (f[(i + 3) * fsi]); fr3 = (+0.0166666666666667) * (f[(i - 3) * fsi]) + (-0.133333333333333) * (f[(i - 2) * fsi]) + (+0.616666666666667) * (f[(i - 1) * fsi]) + (+0.616666666666667) * (f[(i + 0) * fsi]) + (-0.133333333333333) * (f[(i + 1) * fsi]) + (+0.0166666666666667) * (f[(i + 2) * fsi]); fr4 = (-0.0166666666666667) * (f[(i - 4) * fsi]) + (+0.116666666666667) * (f[(i - 3) * fsi]) + (-0.383333333333333) * (f[(i - 2) * fsi]) + (+0.95) * (f[(i - 1) * fsi]) + (+0.366666666666667) * (f[(i + 0) * fsi]) + (-0.0333333333333333) * (f[(i + 1) * fsi]); fr5 = (+0.0333333333333333) * (f[(i - 5) * fsi]) + (-0.216666666666667) * (f[(i - 4) * fsi]) + (+0.616666666666667) * (f[(i - 3) * fsi]) + (-1.05) * (f[(i - 2) * fsi]) + (+1.45) * (f[(i - 1) * fsi]) + (+0.166666666666667) * (f[(i + 0) * fsi]); fr6 = (+1.87674810537772) * (f[(i + 0) * fsi]) + (-1.96086691163882) * (f[(i + 1) * fsi]) + (+1.98352846494727) * (f[(i + 2) * fsi]) + (-1.30856455733092) * (f[(i + 3) * fsi]) + (+0.48651097514296) * (f[(i + 4) * fsi]) + (-0.0773560764982009) * (f[(i + 5) * fsi]); fr7 = (+0.0773560764982009) * (f[(i - 1) * fsi]) + (+1.41261164638851) * (f[(i + 0) * fsi]) + (-0.800525764165805) * (f[(i + 1) * fsi]) + (+0.436406934983249) * (f[(i + 2) * fsi]) + (-0.14822340985791) * (f[(i + 3) * fsi]) + (+0.022374516153755) * (f[(i + 4) * fsi]); fr8 = (-0.022374516153755) * (f[(i - 2) * fsi]) + (+0.211603173420731) * (f[(i - 1) * fsi]) + (+1.07699390408219) * (f[(i + 0) * fsi]) + (-0.353035441090705) * (f[(i + 1) * fsi]) + (+0.100789192676924) * (f[(i + 2) * fsi]) + (-0.0139763129353804) * (f[(i + 3) * fsi]); fr9 = (+0.0139763129353804) * (f[(i - 3) * fsi]) + (-0.106232393766037) * (f[(i - 2) * fsi]) + (+0.421247867451436) * (f[(i - 1) * fsi]) + (+0.797467645374579) * (f[(i + 0) * fsi]) + (-0.14339074706) * (f[(i + 1) * fsi]) + (+0.0169313150646417) * (f[(i + 2) * fsi]); fr10 = (-0.0169313150646417) * (f[(i - 4) * fsi]) + (+0.115564203323231) * (f[(i - 3) * fsi]) + (-0.360202119735663) * (f[(i - 2) * fsi]) + (+0.759874168744271) * (f[(i - 1) * fsi]) + (+0.543497919404953) * (f[(i + 0) * fsi]) + (-0.0418028566721494) * (f[(i + 1) * fsi]); fr11 = (+0.0418028566721494) * (f[(i - 5) * fsi]) + (-0.267748455097538) * (f[(i - 4) * fsi]) + (+0.742607053405472) * (f[(i - 3) * fsi]) + (-1.19625925317865) * (f[(i - 2) * fsi]) + (+1.38691701882651) * (f[(i - 1) * fsi]) + (+0.292680779372056) * (f[(i + 0) * fsi]); fr12 = (+1.03664015946106) * (f[(i + 0) * fsi]) + (+0.116536489045991) * (f[(i + 1) * fsi]) + (-0.333833365073552) * (f[(i + 2) * fsi]) + (+0.273863525519408) * (f[(i + 3) * fsi]) + (-0.111983276938492) * (f[(i + 4) * fsi]) + (+0.0187764679855883) * (f[(i + 5) * fsi]); fr13 = (-0.0187764679855884) * (f[(i - 1) * fsi]) + (+1.14929896737459) * (f[(i + 0) * fsi]) + (-0.165110530737835) * (f[(i + 1) * fsi]) + (+0.0416959946382148) * (f[(i + 2) * fsi]) + (-0.00778349426441781) * (f[(i + 3) * fsi]) + (+0.000675530975038341) * (f[(i + 4) * fsi]); fr14 = (-0.000675530975038339) * (f[(i - 2) * fsi]) + (-0.0147232821353584) * (f[(i - 1) * fsi]) + (+1.13916600274901) * (f[(i + 0) * fsi]) + (-0.151599911237068) * (f[(i + 1) * fsi]) + (+0.0315630300126396) * (f[(i + 2) * fsi]) + (-0.00373030841418776) * (f[(i + 3) * fsi]); fr15 = (+0.00373030841418776) * (f[(i - 3) * fsi]) + (-0.0230573814601649) * (f[(i - 2) * fsi]) + (+0.041231344077458) * (f[(i - 1) * fsi]) + (+1.06455983446526) * (f[(i + 0) * fsi]) + (-0.0956452850242515) * (f[(i + 1) * fsi]) + (+0.00918117952751308) * (f[(i + 2) * fsi]); fr16 = (-0.00918117952751308) * (f[(i - 4) * fsi]) + (+0.0588173855792662) * (f[(i - 3) * fsi]) + (-0.160775074372861) * (f[(i - 2) * fsi]) + (+0.22485493462772) * (f[(i - 1) * fsi]) + (+0.926842141552561) * (f[(i + 0) * fsi]) + (-0.040558207859173) * (f[(i + 1) * fsi]); fr17 = (+0.040558207859173) * (f[(i - 5) * fsi]) + (-0.252530426682551) * (f[(i - 4) * fsi]) + (+0.667190503466861) * (f[(i - 3) * fsi]) + (-0.971939231556321) * (f[(i - 2) * fsi]) + (+0.833228052515315) * (f[(i - 1) * fsi]) + (+0.683492894397523) * (f[(i + 0) * fsi]); fr18 = (+0.459871837949955) * (f[(i + 0) * fsi]) + (+1.19585346871647) * (f[(i + 1) * fsi]) + (-1.18981785928007) * (f[(i + 2) * fsi]) + (+0.774640801027807) * (f[(i + 3) * fsi]) + (-0.285758075192918) * (f[(i + 4) * fsi]) + (+0.0452098267787614) * (f[(i + 5) * fsi]); fr19 = (-0.0452098267787614) * (f[(i - 1) * fsi]) + (+0.731130798622524) * (f[(i + 0) * fsi]) + (+0.517706067035047) * (f[(i + 1) * fsi]) + (-0.285621323704844) * (f[(i + 2) * fsi]) + (+0.0964933993463848) * (f[(i + 3) * fsi]) + (-0.0144991145203493) * (f[(i + 4) * fsi]); fr20 = (+0.0144991145203493) * (f[(i - 2) * fsi]) + (-0.132204513900857) * (f[(i - 1) * fsi]) + (+0.948617516427763) * (f[(i + 0) * fsi]) + (+0.22772377662806) * (f[(i + 1) * fsi]) + (-0.0681346058996048) * (f[(i + 2) * fsi]) + (+0.0094987122242889) * (f[(i + 3) * fsi]); fr21 = (-0.0094987122242889) * (f[(i - 3) * fsi]) + (+0.0714913878660827) * (f[(i - 2) * fsi]) + (-0.274685197265191) * (f[(i - 1) * fsi]) + (+1.13859176091354) * (f[(i + 0) * fsi]) + (+0.0852430932637269) * (f[(i + 1) * fsi]) + (-0.0111423325538714) * (f[(i + 2) * fsi]); fr22 = (+0.0111423325538714) * (f[(i - 4) * fsi]) + (-0.0763527075475172) * (f[(i - 3) * fsi]) + (+0.238626376174153) * (f[(i - 2) * fsi]) + (-0.497531848342618) * (f[(i - 1) * fsi]) + (+1.30572674922161) * (f[(i + 0) * fsi]) + (+0.0183890979404986) * (f[(i + 1) * fsi]); fr23 = (-0.0183890979404986) * (f[(i - 5) * fsi]) + (+0.121476920196863) * (f[(i - 4) * fsi]) + (-0.352189176654996) * (f[(i - 3) * fsi]) + (+0.606408334984125) * (f[(i - 2) * fsi]) + (-0.773368317450097) * (f[(i - 1) * fsi]) + (+1.4160613368646) * (f[(i + 0) * fsi]); fr24 = (+0.213275433880172) * (f[(i + 0) * fsi]) + (+1.43811983722828) * (f[(i + 1) * fsi]) + (-1.12496293617011) * (f[(i + 2) * fsi]) + (+0.67679600873729) * (f[(i + 3) * fsi]) + (-0.240455531163699) * (f[(i + 4) * fsi]) + (+0.0372271874880712) * (f[(i + 5) * fsi]); fr25 = (-0.0372271874880712) * (f[(i - 1) * fsi]) + (+0.436638558808599) * (f[(i + 0) * fsi]) + (+0.879712024907211) * (f[(i + 1) * fsi]) + (-0.380419186408689) * (f[(i + 2) * fsi]) + (+0.11838819641622) * (f[(i + 3) * fsi]) + (-0.0170924062352705) * (f[(i + 4) * fsi]); fr26 = (+0.0170924062352705) * (f[(i - 2) * fsi]) + (-0.139781624899694) * (f[(i - 1) * fsi]) + (+0.693024652337657) * (f[(i + 0) * fsi]) + (+0.537863900201801) * (f[(i + 1) * fsi]) + (-0.124033092879631) * (f[(i + 2) * fsi]) + (+0.0158337590045966) * (f[(i + 3) * fsi]); fr27 = (-0.0158337590045966) * (f[(i - 3) * fsi]) + (+0.11209496026285) * (f[(i - 2) * fsi]) + (-0.377288009968643) * (f[(i - 1) * fsi]) + (+1.00969983242959) * (f[(i + 0) * fsi]) + (+0.300357515132853) * (f[(i + 1) * fsi]) + (-0.0290305388520515) * (f[(i + 2) * fsi]); fr28 = (+0.0290305388520515) * (f[(i - 4) * fsi]) + (-0.190016992116906) * (f[(i - 3) * fsi]) + (+0.547553043043622) * (f[(i - 2) * fsi]) + (-0.957898787009673) * (f[(i - 1) * fsi]) + (+1.44515791521036) * (f[(i + 0) * fsi]) + (+0.126174282020544) * (f[(i + 1) * fsi]); fr29 = (-0.126174282020544) * (f[(i - 5) * fsi]) + (+0.786076230975313) * (f[(i - 4) * fsi]) + (-2.08263122242506) * (f[(i - 3) * fsi]) + (+3.0710386834545) * (f[(i - 2) * fsi]) + (-2.85051301731783) * (f[(i - 1) * fsi]) + (+2.20220360733362) * (f[(i + 0) * fsi]); fs0 = (omega0) * (fr0) + (omega1) * (fr1) + (omega2) * (fr2) + (omega3) * (fr3) + (omega4) * (fr4) + (omega5) * (fr5); fs1 = (omega6) * (fr6) + (omega7) * (fr7) + (omega8) * (fr8) + (omega9) * (fr9) + (omega10) * (fr10) + (omega11) * (fr11); fs2 = ((+3.24868642929383) * ((omega12p) * (fr12) + (omega13p) * (fr13) + (omega14p) * (fr14) + (omega15p) * (fr15) + (omega16p) * (fr16) + (omega17p) * (fr17))) - ((+2.24868642929383) * ((omega12m) * (fr12) + (omega13m) * (fr13) + (omega14m) * (fr14) + (omega15m) * (fr15) + (omega16m) * (fr16) + (omega17m) * (fr17))); fs3 = (omega18) * (fr18) + (omega19) * (fr19) + (omega20) * (fr20) + (omega21) * (fr21) + (omega22) * (fr22) + (omega23) * (fr23); fs4 = (omega24) * (fr24) + (omega25) * (fr25) + (omega26) * (fr26) + (omega27) * (fr27) + (omega28) * (fr28) + (omega29) * (fr29); fr[i * frsi + 0 * frsl] = fs0; fr[i * frsi + 1 * frsl] = fs1; fr[i * frsi + 2 * frsl] = fs2; fr[i * frsi + 3 * frsl] = fs3; fr[i * frsi + 4 * frsl] = fs4; } } PyObject * py_reconstruct_gauss_radau006005 (PyObject * self, PyObject * args) { double *f, *omega, *fr; PyArrayObject *f_py, *omega_py, *fr_py; long int n; int fsi, frsi, frsl, wsi, wsl, wsr; /* parse options */ if (!PyArg_ParseTuple (args, "OOO", &f_py, &omega_py, &fr_py)) return NULL; if (f_py->nd != 1 || f_py->descr->type_num != PyArray_DOUBLE) { PyErr_SetString (PyExc_ValueError, "f must be one-dimensional and of type float"); return NULL; } if (fr_py->descr->type_num != PyArray_DOUBLE) { PyErr_SetString (PyExc_ValueError, "fr must be of type float"); return NULL; } if (!(fr_py->nd == 1 || fr_py->nd == 2)) { PyErr_SetString (PyExc_ValueError, "fr must be one or two dimensional"); return NULL; } if (omega_py->descr->type_num != PyArray_DOUBLE) { PyErr_SetString (PyExc_ValueError, "omega must be of type float"); return NULL; } if (!(omega_py->nd >= 2 && omega_py->nd <= 4)) { PyErr_SetString (PyExc_ValueError, "omega must be two, three, or four dimensional"); return NULL; } /* get data, n, strides */ f = (double *) PyArray_DATA (f_py); fr = (double *) PyArray_DATA (fr_py); omega = (double *) PyArray_DATA (omega_py); n = PyArray_DIM (omega_py, 0); fsi = f_py->strides[0] / sizeof (double); frsi = fr_py->strides[0] / sizeof (double); if (n == 1) { frsl = 0; } else { frsl = fr_py->strides[1] / sizeof (double); } wsi = omega_py->strides[0] / sizeof (double); if (omega_py->nd == 3) { wsl = omega_py->strides[1] / sizeof (double); wsr = omega_py->strides[2] / sizeof (double); } else { wsl = 0; wsr = omega_py->strides[1] / sizeof (double); } reconstruct_gauss_radau006005 (f, n, fsi, omega, wsi, wsl, wsr, fr, frsi, frsl); Py_INCREF (Py_None); return Py_None; }
45.866157
99
0.513173
08659616e70bff7f7ce54d7c19b8e3ecb6d78f28
592
c
C
gcc-gcc-7_3_0-release/gcc/testsuite/gcc.dg/format/ms_cast-1.c
best08618/asylo
5a520a9f5c461ede0f32acc284017b737a43898c
[ "Apache-2.0" ]
7
2020-05-02T17:34:05.000Z
2021-10-17T10:15:18.000Z
gcc-gcc-7_3_0-release/gcc/testsuite/gcc.dg/format/ms_cast-1.c
best08618/asylo
5a520a9f5c461ede0f32acc284017b737a43898c
[ "Apache-2.0" ]
null
null
null
gcc-gcc-7_3_0-release/gcc/testsuite/gcc.dg/format/ms_cast-1.c
best08618/asylo
5a520a9f5c461ede0f32acc284017b737a43898c
[ "Apache-2.0" ]
2
2020-07-27T00:22:36.000Z
2021-04-01T09:41:02.000Z
/* Test for strings cast through integer types: should not be treated as format strings unless the types are of the same width as pointers (intptr_t or similar). */ /* Origin: Joseph Myers <joseph@codesourcery.com> */ /* { dg-do compile { target { *-*-mingw* } } } */ /* { dg-options "-Wformat" } */ #define USE_SYSTEM_FORMATS #include "format.h" void f (int x) { printf("%s", x); /* { dg-warning "format" } */ printf((char *)(size_t)"%s", x); /* { dg-warning "format" } */ printf((char *)(char)"%s", x); /* { dg-warning "cast from pointer to integer of different size" } */ }
32.888889
102
0.626689
08673d465e5b39fbfac7f7c6da44d9568e878377
25,006
c
C
src/gallium/drivers/softpipe/sp_image.c
PWN-Hunter/mesa3d
be12e189989e3476d7c9d40e1c0c3a35143ee51a
[ "MIT" ]
null
null
null
src/gallium/drivers/softpipe/sp_image.c
PWN-Hunter/mesa3d
be12e189989e3476d7c9d40e1c0c3a35143ee51a
[ "MIT" ]
null
null
null
src/gallium/drivers/softpipe/sp_image.c
PWN-Hunter/mesa3d
be12e189989e3476d7c9d40e1c0c3a35143ee51a
[ "MIT" ]
null
null
null
/* * Copyright 2016 Red Hat. * * 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 * on the rights to use, copy, modify, merge, publish, distribute, sub * license, and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "sp_context.h" #include "sp_image.h" #include "sp_texture.h" #include "util/format/u_format.h" /* * Get the offset into the base image * first element for a buffer or layer/level for texture. */ static uint32_t get_image_offset(const struct softpipe_resource *spr, const struct pipe_image_view *iview, enum pipe_format format, unsigned r_coord) { int base_layer = 0; if (spr->base.target == PIPE_BUFFER) return iview->u.buf.offset; if (spr->base.target == PIPE_TEXTURE_1D_ARRAY || spr->base.target == PIPE_TEXTURE_2D_ARRAY || spr->base.target == PIPE_TEXTURE_CUBE_ARRAY || spr->base.target == PIPE_TEXTURE_CUBE || spr->base.target == PIPE_TEXTURE_3D) base_layer = r_coord + iview->u.tex.first_layer; return softpipe_get_tex_image_offset(spr, iview->u.tex.level, base_layer); } /* * Does this texture instruction have a layer or depth parameter. */ static inline bool has_layer_or_depth(unsigned tgsi_tex_instr) { return (tgsi_tex_instr == TGSI_TEXTURE_3D || tgsi_tex_instr == TGSI_TEXTURE_CUBE || tgsi_tex_instr == TGSI_TEXTURE_1D_ARRAY || tgsi_tex_instr == TGSI_TEXTURE_2D_ARRAY || tgsi_tex_instr == TGSI_TEXTURE_CUBE_ARRAY || tgsi_tex_instr == TGSI_TEXTURE_2D_ARRAY_MSAA); } /* * Is this texture instruction a single non-array coordinate. */ static inline bool has_1coord(unsigned tgsi_tex_instr) { return (tgsi_tex_instr == TGSI_TEXTURE_BUFFER || tgsi_tex_instr == TGSI_TEXTURE_1D || tgsi_tex_instr == TGSI_TEXTURE_1D_ARRAY); } /* * check the bounds vs w/h/d */ static inline bool bounds_check(int width, int height, int depth, int s, int t, int r) { if (s < 0 || s >= width) return false; if (t < 0 || t >= height) return false; if (r < 0 || r >= depth) return false; return true; } /* * Checks if the texture target compatible with the image resource * pipe target. */ static inline bool has_compat_target(unsigned pipe_target, unsigned tgsi_target) { switch (pipe_target) { case PIPE_TEXTURE_1D: if (tgsi_target == TGSI_TEXTURE_1D) return true; break; case PIPE_TEXTURE_2D: if (tgsi_target == TGSI_TEXTURE_2D) return true; break; case PIPE_TEXTURE_RECT: if (tgsi_target == TGSI_TEXTURE_RECT) return true; break; case PIPE_TEXTURE_3D: if (tgsi_target == TGSI_TEXTURE_3D || tgsi_target == TGSI_TEXTURE_2D) return true; break; case PIPE_TEXTURE_CUBE: if (tgsi_target == TGSI_TEXTURE_CUBE || tgsi_target == TGSI_TEXTURE_2D) return true; break; case PIPE_TEXTURE_1D_ARRAY: if (tgsi_target == TGSI_TEXTURE_1D || tgsi_target == TGSI_TEXTURE_1D_ARRAY) return true; break; case PIPE_TEXTURE_2D_ARRAY: if (tgsi_target == TGSI_TEXTURE_2D || tgsi_target == TGSI_TEXTURE_2D_ARRAY) return true; break; case PIPE_TEXTURE_CUBE_ARRAY: if (tgsi_target == TGSI_TEXTURE_CUBE || tgsi_target == TGSI_TEXTURE_CUBE_ARRAY || tgsi_target == TGSI_TEXTURE_2D) return true; break; case PIPE_BUFFER: return (tgsi_target == TGSI_TEXTURE_BUFFER); } return false; } static bool get_dimensions(const struct pipe_image_view *iview, const struct softpipe_resource *spr, unsigned tgsi_tex_instr, enum pipe_format pformat, unsigned *width, unsigned *height, unsigned *depth) { if (tgsi_tex_instr == TGSI_TEXTURE_BUFFER) { *width = iview->u.buf.size / util_format_get_blocksize(pformat); *height = 1; *depth = 1; /* * Bounds check the buffer size from the view * and the buffer size from the underlying buffer. */ if (util_format_get_stride(pformat, *width) > util_format_get_stride(spr->base.format, spr->base.width0)) return false; } else { unsigned level; level = spr->base.target == PIPE_BUFFER ? 0 : iview->u.tex.level; *width = u_minify(spr->base.width0, level); *height = u_minify(spr->base.height0, level); if (spr->base.target == PIPE_TEXTURE_3D) *depth = u_minify(spr->base.depth0, level); else *depth = spr->base.array_size; /* Make sure the resource and view have compatiable formats */ if (util_format_get_blocksize(pformat) > util_format_get_blocksize(spr->base.format)) return false; } return true; } static void fill_coords(const struct tgsi_image_params *params, unsigned index, const int s[TGSI_QUAD_SIZE], const int t[TGSI_QUAD_SIZE], const int r[TGSI_QUAD_SIZE], int *s_coord, int *t_coord, int *r_coord) { *s_coord = s[index]; *t_coord = has_1coord(params->tgsi_tex_instr) ? 0 : t[index]; *r_coord = has_layer_or_depth(params->tgsi_tex_instr) ? (params->tgsi_tex_instr == TGSI_TEXTURE_1D_ARRAY ? t[index] : r[index]) : 0; } /* * Implement the image LOAD operation. */ static void sp_tgsi_load(const struct tgsi_image *image, const struct tgsi_image_params *params, const int s[TGSI_QUAD_SIZE], const int t[TGSI_QUAD_SIZE], const int r[TGSI_QUAD_SIZE], const int sample[TGSI_QUAD_SIZE], float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]) { struct sp_tgsi_image *sp_img = (struct sp_tgsi_image *)image; struct pipe_image_view *iview; struct softpipe_resource *spr; unsigned width, height, depth; unsigned stride; int c, j; char *data_ptr; unsigned offset = 0; if (params->unit >= PIPE_MAX_SHADER_IMAGES) goto fail_write_all_zero; iview = &sp_img->sp_iview[params->unit]; spr = (struct softpipe_resource *)iview->resource; if (!spr) goto fail_write_all_zero; if (!has_compat_target(spr->base.target, params->tgsi_tex_instr)) goto fail_write_all_zero; if (!get_dimensions(iview, spr, params->tgsi_tex_instr, params->format, &width, &height, &depth)) return; stride = util_format_get_stride(params->format, width); for (j = 0; j < TGSI_QUAD_SIZE; j++) { int s_coord, t_coord, r_coord; bool fill_zero = false; if (!(params->execmask & (1 << j))) fill_zero = true; fill_coords(params, j, s, t, r, &s_coord, &t_coord, &r_coord); if (!bounds_check(width, height, depth, s_coord, t_coord, r_coord)) fill_zero = true; if (fill_zero) { int nc = util_format_get_nr_components(params->format); int ival = util_format_is_pure_integer(params->format); for (c = 0; c < 4; c++) { rgba[c][j] = 0; if (c == 3 && nc < 4) { if (ival) ((int32_t *)rgba[c])[j] = 1; else rgba[c][j] = 1.0; } } continue; } offset = get_image_offset(spr, iview, params->format, r_coord); data_ptr = (char *)spr->data + offset; if (util_format_is_pure_sint(params->format)) { int32_t sdata[4]; util_format_read_4i(params->format, sdata, 0, data_ptr, stride, s_coord, t_coord, 1, 1); for (c = 0; c < 4; c++) ((int32_t *)rgba[c])[j] = sdata[c]; } else if (util_format_is_pure_uint(params->format)) { uint32_t sdata[4]; util_format_read_4ui(params->format, sdata, 0, data_ptr, stride, s_coord, t_coord, 1, 1); for (c = 0; c < 4; c++) ((uint32_t *)rgba[c])[j] = sdata[c]; } else { float sdata[4]; util_format_read_4f(params->format, sdata, 0, data_ptr, stride, s_coord, t_coord, 1, 1); for (c = 0; c < 4; c++) rgba[c][j] = sdata[c]; } } return; fail_write_all_zero: for (j = 0; j < TGSI_QUAD_SIZE; j++) { for (c = 0; c < 4; c++) rgba[c][j] = 0; } return; } /* * Implement the image STORE operation. */ static void sp_tgsi_store(const struct tgsi_image *image, const struct tgsi_image_params *params, const int s[TGSI_QUAD_SIZE], const int t[TGSI_QUAD_SIZE], const int r[TGSI_QUAD_SIZE], const int sample[TGSI_QUAD_SIZE], float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]) { struct sp_tgsi_image *sp_img = (struct sp_tgsi_image *)image; struct pipe_image_view *iview; struct softpipe_resource *spr; unsigned width, height, depth; unsigned stride; char *data_ptr; int j, c; unsigned offset = 0; unsigned pformat = params->format; if (params->unit >= PIPE_MAX_SHADER_IMAGES) return; iview = &sp_img->sp_iview[params->unit]; spr = (struct softpipe_resource *)iview->resource; if (!spr) return; if (!has_compat_target(spr->base.target, params->tgsi_tex_instr)) return; if (params->format == PIPE_FORMAT_NONE) pformat = spr->base.format; if (!get_dimensions(iview, spr, params->tgsi_tex_instr, pformat, &width, &height, &depth)) return; stride = util_format_get_stride(pformat, width); for (j = 0; j < TGSI_QUAD_SIZE; j++) { int s_coord, t_coord, r_coord; if (!(params->execmask & (1 << j))) continue; fill_coords(params, j, s, t, r, &s_coord, &t_coord, &r_coord); if (!bounds_check(width, height, depth, s_coord, t_coord, r_coord)) continue; offset = get_image_offset(spr, iview, pformat, r_coord); data_ptr = (char *)spr->data + offset; if (util_format_is_pure_sint(pformat)) { int32_t sdata[4]; for (c = 0; c < 4; c++) sdata[c] = ((int32_t *)rgba[c])[j]; util_format_write_4i(pformat, sdata, 0, data_ptr, stride, s_coord, t_coord, 1, 1); } else if (util_format_is_pure_uint(pformat)) { uint32_t sdata[4]; for (c = 0; c < 4; c++) sdata[c] = ((uint32_t *)rgba[c])[j]; util_format_write_4ui(pformat, sdata, 0, data_ptr, stride, s_coord, t_coord, 1, 1); } else { float sdata[4]; for (c = 0; c < 4; c++) sdata[c] = rgba[c][j]; util_format_write_4f(pformat, sdata, 0, data_ptr, stride, s_coord, t_coord, 1, 1); } } } /* * Implement atomic operations on unsigned integers. */ static void handle_op_uint(const struct pipe_image_view *iview, const struct tgsi_image_params *params, bool just_read, char *data_ptr, uint qi, unsigned stride, enum tgsi_opcode opcode, int s, int t, float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE], float rgba2[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]) { uint c; int nc = util_format_get_nr_components(params->format); unsigned sdata[4]; util_format_read_4ui(params->format, sdata, 0, data_ptr, stride, s, t, 1, 1); if (just_read) { for (c = 0; c < nc; c++) { ((uint32_t *)rgba[c])[qi] = sdata[c]; } return; } switch (opcode) { case TGSI_OPCODE_ATOMUADD: for (c = 0; c < nc; c++) { unsigned temp = sdata[c]; sdata[c] += ((uint32_t *)rgba[c])[qi]; ((uint32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMXCHG: for (c = 0; c < nc; c++) { unsigned temp = sdata[c]; sdata[c] = ((uint32_t *)rgba[c])[qi]; ((uint32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMCAS: for (c = 0; c < nc; c++) { unsigned dst_x = sdata[c]; unsigned cmp_x = ((uint32_t *)rgba[c])[qi]; unsigned src_x = ((uint32_t *)rgba2[c])[qi]; unsigned temp = sdata[c]; sdata[c] = (dst_x == cmp_x) ? src_x : dst_x; ((uint32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMAND: for (c = 0; c < nc; c++) { unsigned temp = sdata[c]; sdata[c] &= ((uint32_t *)rgba[c])[qi]; ((uint32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMOR: for (c = 0; c < nc; c++) { unsigned temp = sdata[c]; sdata[c] |= ((uint32_t *)rgba[c])[qi]; ((uint32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMXOR: for (c = 0; c < nc; c++) { unsigned temp = sdata[c]; sdata[c] ^= ((uint32_t *)rgba[c])[qi]; ((uint32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMUMIN: for (c = 0; c < nc; c++) { unsigned dst_x = sdata[c]; unsigned src_x = ((uint32_t *)rgba[c])[qi]; sdata[c] = MIN2(dst_x, src_x); ((uint32_t *)rgba[c])[qi] = dst_x; } break; case TGSI_OPCODE_ATOMUMAX: for (c = 0; c < nc; c++) { unsigned dst_x = sdata[c]; unsigned src_x = ((uint32_t *)rgba[c])[qi]; sdata[c] = MAX2(dst_x, src_x); ((uint32_t *)rgba[c])[qi] = dst_x; } break; case TGSI_OPCODE_ATOMIMIN: for (c = 0; c < nc; c++) { int dst_x = sdata[c]; int src_x = ((uint32_t *)rgba[c])[qi]; sdata[c] = MIN2(dst_x, src_x); ((uint32_t *)rgba[c])[qi] = dst_x; } break; case TGSI_OPCODE_ATOMIMAX: for (c = 0; c < nc; c++) { int dst_x = sdata[c]; int src_x = ((uint32_t *)rgba[c])[qi]; sdata[c] = MAX2(dst_x, src_x); ((uint32_t *)rgba[c])[qi] = dst_x; } break; default: assert(!"Unexpected TGSI opcode in sp_tgsi_op"); break; } util_format_write_4ui(params->format, sdata, 0, data_ptr, stride, s, t, 1, 1); } /* * Implement atomic operations on signed integers. */ static void handle_op_int(const struct pipe_image_view *iview, const struct tgsi_image_params *params, bool just_read, char *data_ptr, uint qi, unsigned stride, enum tgsi_opcode opcode, int s, int t, float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE], float rgba2[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]) { uint c; int nc = util_format_get_nr_components(params->format); int sdata[4]; util_format_read_4i(params->format, sdata, 0, data_ptr, stride, s, t, 1, 1); if (just_read) { for (c = 0; c < nc; c++) { ((int32_t *)rgba[c])[qi] = sdata[c]; } return; } switch (opcode) { case TGSI_OPCODE_ATOMUADD: for (c = 0; c < nc; c++) { int temp = sdata[c]; sdata[c] += ((int32_t *)rgba[c])[qi]; ((int32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMXCHG: for (c = 0; c < nc; c++) { int temp = sdata[c]; sdata[c] = ((int32_t *)rgba[c])[qi]; ((int32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMCAS: for (c = 0; c < nc; c++) { int dst_x = sdata[c]; int cmp_x = ((int32_t *)rgba[c])[qi]; int src_x = ((int32_t *)rgba2[c])[qi]; int temp = sdata[c]; sdata[c] = (dst_x == cmp_x) ? src_x : dst_x; ((int32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMAND: for (c = 0; c < nc; c++) { int temp = sdata[c]; sdata[c] &= ((int32_t *)rgba[c])[qi]; ((int32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMOR: for (c = 0; c < nc; c++) { int temp = sdata[c]; sdata[c] |= ((int32_t *)rgba[c])[qi]; ((int32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMXOR: for (c = 0; c < nc; c++) { int temp = sdata[c]; sdata[c] ^= ((int32_t *)rgba[c])[qi]; ((int32_t *)rgba[c])[qi] = temp; } break; case TGSI_OPCODE_ATOMUMIN: for (c = 0; c < nc; c++) { int dst_x = sdata[c]; int src_x = ((int32_t *)rgba[c])[qi]; sdata[c] = MIN2(dst_x, src_x); ((int32_t *)rgba[c])[qi] = dst_x; } break; case TGSI_OPCODE_ATOMUMAX: for (c = 0; c < nc; c++) { int dst_x = sdata[c]; int src_x = ((int32_t *)rgba[c])[qi]; sdata[c] = MAX2(dst_x, src_x); ((int32_t *)rgba[c])[qi] = dst_x; } break; case TGSI_OPCODE_ATOMIMIN: for (c = 0; c < nc; c++) { int dst_x = sdata[c]; int src_x = ((int32_t *)rgba[c])[qi]; sdata[c] = MIN2(dst_x, src_x); ((int32_t *)rgba[c])[qi] = dst_x; } break; case TGSI_OPCODE_ATOMIMAX: for (c = 0; c < nc; c++) { int dst_x = sdata[c]; int src_x = ((int32_t *)rgba[c])[qi]; sdata[c] = MAX2(dst_x, src_x); ((int32_t *)rgba[c])[qi] = dst_x; } break; default: assert(!"Unexpected TGSI opcode in sp_tgsi_op"); break; } util_format_write_4i(params->format, sdata, 0, data_ptr, stride, s, t, 1, 1); } /* GLES OES_shader_image_atomic.txt allows XCHG on R32F */ static void handle_op_r32f_xchg(const struct pipe_image_view *iview, const struct tgsi_image_params *params, bool just_read, char *data_ptr, uint qi, unsigned stride, enum tgsi_opcode opcode, int s, int t, float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]) { float sdata[4]; uint c; int nc = 1; util_format_read_4f(params->format, sdata, 0, data_ptr, stride, s, t, 1, 1); if (just_read) { for (c = 0; c < nc; c++) { ((int32_t *)rgba[c])[qi] = sdata[c]; } return; } for (c = 0; c < nc; c++) { int temp = sdata[c]; sdata[c] = ((float *)rgba[c])[qi]; ((float *)rgba[c])[qi] = temp; } util_format_write_4f(params->format, sdata, 0, data_ptr, stride, s, t, 1, 1); } /* * Implement atomic image operations. */ static void sp_tgsi_op(const struct tgsi_image *image, const struct tgsi_image_params *params, enum tgsi_opcode opcode, const int s[TGSI_QUAD_SIZE], const int t[TGSI_QUAD_SIZE], const int r[TGSI_QUAD_SIZE], const int sample[TGSI_QUAD_SIZE], float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE], float rgba2[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]) { struct sp_tgsi_image *sp_img = (struct sp_tgsi_image *)image; struct pipe_image_view *iview; struct softpipe_resource *spr; unsigned width, height, depth; unsigned stride; int j, c; unsigned offset; char *data_ptr; if (params->unit >= PIPE_MAX_SHADER_IMAGES) return; iview = &sp_img->sp_iview[params->unit]; spr = (struct softpipe_resource *)iview->resource; if (!spr) goto fail_write_all_zero; if (!has_compat_target(spr->base.target, params->tgsi_tex_instr)) goto fail_write_all_zero; if (!get_dimensions(iview, spr, params->tgsi_tex_instr, params->format, &width, &height, &depth)) goto fail_write_all_zero; stride = util_format_get_stride(spr->base.format, width); for (j = 0; j < TGSI_QUAD_SIZE; j++) { int s_coord, t_coord, r_coord; bool just_read = false; fill_coords(params, j, s, t, r, &s_coord, &t_coord, &r_coord); if (!bounds_check(width, height, depth, s_coord, t_coord, r_coord)) { int nc = util_format_get_nr_components(params->format); int ival = util_format_is_pure_integer(params->format); int c; for (c = 0; c < 4; c++) { rgba[c][j] = 0; if (c == 3 && nc < 4) { if (ival) ((int32_t *)rgba[c])[j] = 1; else rgba[c][j] = 1.0; } } continue; } /* just readback the value for atomic if execmask isn't set */ if (!(params->execmask & (1 << j))) { just_read = true; } offset = get_image_offset(spr, iview, params->format, r_coord); data_ptr = (char *)spr->data + offset; /* we should see atomic operations on r32 formats */ if (util_format_is_pure_uint(params->format)) handle_op_uint(iview, params, just_read, data_ptr, j, stride, opcode, s_coord, t_coord, rgba, rgba2); else if (util_format_is_pure_sint(params->format)) handle_op_int(iview, params, just_read, data_ptr, j, stride, opcode, s_coord, t_coord, rgba, rgba2); else if (params->format == PIPE_FORMAT_R32_FLOAT && opcode == TGSI_OPCODE_ATOMXCHG) handle_op_r32f_xchg(iview, params, just_read, data_ptr, j, stride, opcode, s_coord, t_coord, rgba); else assert(0); } return; fail_write_all_zero: for (j = 0; j < TGSI_QUAD_SIZE; j++) { for (c = 0; c < 4; c++) rgba[c][j] = 0; } return; } static void sp_tgsi_get_dims(const struct tgsi_image *image, const struct tgsi_image_params *params, int dims[4]) { struct sp_tgsi_image *sp_img = (struct sp_tgsi_image *)image; struct pipe_image_view *iview; struct softpipe_resource *spr; int level; if (params->unit >= PIPE_MAX_SHADER_IMAGES) return; iview = &sp_img->sp_iview[params->unit]; spr = (struct softpipe_resource *)iview->resource; if (!spr) return; if (params->tgsi_tex_instr == TGSI_TEXTURE_BUFFER) { dims[0] = iview->u.buf.size / util_format_get_blocksize(iview->format); dims[1] = dims[2] = dims[3] = 0; return; } level = iview->u.tex.level; dims[0] = u_minify(spr->base.width0, level); switch (params->tgsi_tex_instr) { case TGSI_TEXTURE_1D_ARRAY: dims[1] = iview->u.tex.last_layer - iview->u.tex.first_layer + 1; /* fallthrough */ case TGSI_TEXTURE_1D: return; case TGSI_TEXTURE_2D_ARRAY: dims[2] = iview->u.tex.last_layer - iview->u.tex.first_layer + 1; /* fallthrough */ case TGSI_TEXTURE_2D: case TGSI_TEXTURE_CUBE: case TGSI_TEXTURE_RECT: dims[1] = u_minify(spr->base.height0, level); return; case TGSI_TEXTURE_3D: dims[1] = u_minify(spr->base.height0, level); dims[2] = u_minify(spr->base.depth0, level); return; case TGSI_TEXTURE_CUBE_ARRAY: dims[1] = u_minify(spr->base.height0, level); dims[2] = (iview->u.tex.last_layer - iview->u.tex.first_layer + 1) / 6; break; default: assert(!"unexpected texture target in sp_get_dims()"); return; } } struct sp_tgsi_image * sp_create_tgsi_image(void) { struct sp_tgsi_image *img = CALLOC_STRUCT(sp_tgsi_image); if (!img) return NULL; img->base.load = sp_tgsi_load; img->base.store = sp_tgsi_store; img->base.op = sp_tgsi_op; img->base.get_dims = sp_tgsi_get_dims; return img; };
31.140722
82
0.564984
08675c5a959ed8182ba4442d53c03d994f4a3c12
971
c
C
startup.c
catphish/allwinner-bare-metal
f61214f281ef84da9626674df005d8267f0ed6b2
[ "MIT" ]
11
2018-12-19T16:56:36.000Z
2021-04-28T19:51:32.000Z
startup.c
catphish/allwinner-bare-metal
f61214f281ef84da9626674df005d8267f0ed6b2
[ "MIT" ]
2
2020-08-16T19:13:19.000Z
2021-01-07T13:18:16.000Z
startup.c
catphish/allwinner-bare-metal
f61214f281ef84da9626674df005d8267f0ed6b2
[ "MIT" ]
5
2019-03-01T14:35:10.000Z
2020-10-13T10:36:16.000Z
#include "ports.h" #include "uart.h" #include "mmu.h" #include "system.h" #include "display.h" #include "interrupts.h" #include "ccu.h" #include "usb.h" uint32_t tick_counter; void game_tick(uint32_t tick_counter); void game_start(); void startup() { init_bss(); // Reboot in n seconds using watchdog reboot(2); // 0x8 == 10 second reset timer // Enble all GPIO gpio_init(); // Configure the UART for debugging uart_init(); uart_print("Booting!\r\n"); // Set up MMU and paging configuration mmu_init(); // Illuminate the power LED set_pin_mode(PORTL, 10, 1); // PORT L10 output set_pin_data(PORTL, 10, 1); // PORT L10 high // Configure display display_init((volatile uint32_t*)(0x60000000-VIDEO_RAM_BYTES)); // USB usb_init(); uart_print("Ready!\r\n"); game_start(); install_ivt(); // Go back to sleep while(1) asm("wfi"); } void game_tick_next() { buffer_swap(); game_tick(tick_counter); tick_counter++; }
17.654545
65
0.672503
08686d00c54fbc3400320e6ef4097cf4d48e8a35
11,600
c
C
sdk-6.5.20/src/soc/cprimod/cprimod_enums.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
sdk-6.5.20/src/soc/cprimod/cprimod_enums.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
sdk-6.5.20/src/soc/cprimod/cprimod_enums.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
/* * * * * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. * * Copyright 2007-2020 Broadcom Inc. All rights reserved. * * * DO NOT EDIT THIS FILE! */ #include <soc/types.h> #include <soc/error.h> #include <soc/cprimod/cprimod_internal.h> #include <soc/cprimod/cprimod.h> #include <soc/cprimod/cprimod_dispatch.h> #ifdef CPRIMOD_DIAG enum_mapping_t cprimod_dispatch_type_t_mapping[] = { #ifdef CPRIMOD_CPRI_FALCON_SUPPORT {"Cprif", cprimodDispatchTypeCprif}, #endif /*CPRIMOD_CPRI_FALCON_SUPPORT */ {NULL, 0} }; enum_mapping_t cprimod_basic_frame_table_id_t_mapping[] = { {"0", cprimod_basic_frame_table_0}, {"1", cprimod_basic_frame_table_1}, {NULL, 0} }; enum_mapping_t cprimod_cpri_frame_map_method_t_mapping[] = { {"1", cprimod_cpri_frame_map_method_1}, {"2", cprimod_cpri_frame_map_method_2}, {"3", cprimod_cpri_frame_map_method_3}, {NULL, 0} }; enum_mapping_t cprimod_compression_type_t_mapping[] = { {"compress", cprimod_compress}, {"decompress", cprimod_decompress}, {"no_compress", cprimod_no_compress}, {NULL, 0} }; enum_mapping_t cprimod_truncation_type_t_mapping[] = { {"15_to_16", cprimod_truncation_type_15_to_16}, {"add_0", cprimod_truncation_type_add_0}, {"16_to_15", cprimod_truncation_type_16_to_15}, {"add_1", cprimod_truncation_type_add_1}, {NULL, 0} }; enum_mapping_t cprimod_hdr_encap_type_t_mapping[] = { {"roe", cprimod_hdr_encap_type_roe}, {"encap_none", cprimod_hdr_encap_type_encap_none}, {NULL, 0} }; enum_mapping_t cprimod_hdr_vlan_type_t_mapping[] = { {"Untagged", cprimodHdrVlanTypeUntagged}, {"TaggedVlan0", cprimodHdrVlanTypeTaggedVlan0}, {"QinQ", cprimodHdrVlanTypeQinQ}, {"TaggedVlan1", cprimodHdrVlanTypeTaggedVlan1}, {NULL, 0} }; enum_mapping_t cprimod_ordering_info_type_t_mapping[] = { {"roe_sequence", cprimod_ordering_info_type_roe_sequence}, {"bfn_for_qcnt", cprimod_ordering_info_type_bfn_for_qcnt}, {"use_pinfo", cprimod_ordering_info_type_use_pinfo}, {NULL, 0} }; enum_mapping_t cprimod_ordering_info_prop_t_mapping[] = { {"no_increment", cprimod_ordering_info_prop_no_increment}, {"increment_by_constant", cprimod_ordering_info_prop_increment_by_constant}, {"increment_by_payload", cprimod_ordering_info_prop_increment_by_payload}, {NULL, 0} }; enum_mapping_t cprimod_vlan_table_id_t_mapping[] = { {"0", cprimodVlanTable0}, {"1", cprimodVlanTable1}, {NULL, 0} }; enum_mapping_t cprimod_ethertype_t_mapping[] = { {"Roe", cprimodEthertypeRoe}, {"Fast", cprimodEthertypeFast}, {"Vlan", cprimodEthertypeVlan}, {"QinQ", cprimodEthertypeQinQ}, {"Roe1", cprimodEthertypeRoe1}, {NULL, 0} }; enum_mapping_t cprimod_cls_option_t_mapping[] = { {"UseQueueNum", cprimodClsOptionUseQueueNum}, {"UseFlowIdToQueue", cprimodClsOptionUseFlowIdToQueue}, {"UseOpcodeToQueue", cprimodClsOptionUseOpcodeToQueue}, {NULL, 0} }; enum_mapping_t cprimod_cls_flow_type_t_mapping[] = { {"Data", cprimodClsFlowTypeData}, {"DataWithExt", cprimodClsFlowTypeDataWithExt}, {"CtrlWithOpcode", cprimodClsFlowTypeCtrlWithOpcode}, {"Ctrl", cprimodClsFlowTypeCtrl}, {NULL, 0} }; enum_mapping_t cprimod_tgen_counter_select_t_mapping[] = { {"Bfn", cprimodTgenCounterSelectBfn}, {"Hfn", cprimodTgenCounterSelectHfn}, {NULL, 0} }; enum_mapping_t cprimod_flow_type_t_mapping[] = { {"Data", cprimodFlowTypeData}, {"Ctrl", cprimodFlowTypeCtrl}, {NULL, 0} }; enum_mapping_t cprimod_transmission_rule_type_t_mapping[] = { {"Data", cprimodTxRuleTypeData}, {"Ctrl", cprimodTxRuleTypeCtrl}, {NULL, 0} }; enum_mapping_t cprimod_modulo_rule_mod_t_mapping[] = { {"1", cprimodModuloRuleMod1}, {"2", cprimodModuloRuleMod2}, {"4", cprimodModuloRuleMod4}, {"8", cprimodModuloRuleMod8}, {"16", cprimodModuloRuleMod16}, {"32", cprimodModuloRuleMod32}, {"64", cprimodModuloRuleMod64}, {NULL, 0} }; enum_mapping_t cprimod_dbm_rule_pos_index_t_mapping[] = { {"Start0", cprimodDbmRulePosIndexStart0}, {"Start10", cprimodDbmRulePosIndexStart10}, {"Start20", cprimodDbmRulePosIndexStart20}, {"Start30", cprimodDbmRulePosIndexStart30}, {"Start40", cprimodDbmRulePosIndexStart40}, {"Start50", cprimodDbmRulePosIndexStart50}, {"Start60", cprimodDbmRulePosIndexStart60}, {"Start70", cprimodDbmRulePosIndexStart70}, {NULL, 0} }; enum_mapping_t cprimod_dbm_rule_pos_grp_size_t_mapping[] = { {"10", cprimodDbmRulePosGrpSize10}, {"20", cprimodDbmRulePosGrpSize20}, {"40", cprimodDbmRulePosGrpSize40}, {"80", cprimodDbmRulePosGrpSize80}, {NULL, 0} }; enum_mapping_t cprimod_cpri_pcs_mode_t_mapping[] = { {"8b10b", cprimodCpriPcsMode8b10b}, {"64b66b", cprimodCpriPcsMode64b66b}, {NULL, 0} }; enum_mapping_t cprimod_port_speed_t_mapping[] = { {"614p4", cprimodSpd614p4}, {"1228p8", cprimodSpd1228p8}, {"2457p6", cprimodSpd2457p6}, {"3072p0", cprimodSpd3072p0}, {"4915p2", cprimodSpd4915p2}, {"6144p0", cprimodSpd6144p0}, {"8110p08", cprimodSpd8110p08}, {"9830p4", cprimodSpd9830p4}, {"10137p6", cprimodSpd10137p6}, {"12165p12", cprimodSpd12165p12}, {"24330p24", cprimodSpd24330p24}, {NULL, 0} }; enum_mapping_t cprimod_pll_num_in_use_t_mapping[] = { {"Default", cprimodInUseDefault}, {"Pll0", cprimodInUsePll0}, {"Pll1", cprimodInUsePll1}, {"Pll0_1", cprimodInUsePll0_1}, {NULL, 0} }; enum_mapping_t cprimod_port_interface_type_t_mapping[] = { {"Cpri", cprimodCpri}, {"Rsvd4", cprimodRsvd4}, {"Tunnel", cprimodTunnel}, {NULL, 0} }; enum_mapping_t cprimod_port_encap_type_t_mapping[] = { {"Cpri", cprimodPortEncapCpri}, {"Rsvd4", cprimodPortEncapRsvd4}, {NULL, 0} }; enum_mapping_t cprimod_port_rsvd4_speed_mult_t_mapping[] = { {"4X", cprimodRsvd4SpdMult4X}, {"8X", cprimodRsvd4SpdMult8X}, {NULL, 0} }; enum_mapping_t cprimod_rx_config_field_t_mapping[] = { {"8b10bAllowSeedChange", cprimodRxConfig8b10bAllowSeedChange}, {"8b10bDescrHw", cprimodRxConfig8b10bDescrHw}, {"8b10bDescrEn", cprimodRxConfig8b10bDescrEn}, {"linkAcqSwMode", cprimodRxConfiglinkAcqSwMode}, {"64b66bLosOption", cprimodRxConfig64b66bLosOption}, {"8b10bForceCommaAlignEn", cprimodRxConfig8b10bForceCommaAlignEn}, {"64b66bBerWindowLimit", cprimodRxConfig64b66bBerWindowLimit}, {"64b66bBerLimit", cprimodRxConfig64b66bBerLimit}, {"testMode", cprimodRxConfigtestMode}, {"64b66bInvalidShCnt", cprimodRxConfig64b66bInvalidShCnt}, {"64b66bValidShCnt", cprimodRxConfig64b66bValidShCnt}, {NULL, 0} }; enum_mapping_t cprimod_rsvd4_rx_fsm_state_t_mapping[] = { {"Unsync", cprimodRsvd4RxFsmStateUnsync}, {"WaitForSeed", cprimodRsvd4RxFsmStateWaitForSeed}, {"WaitForAck", cprimodRsvd4RxFsmStateWaitForAck}, {"WaitForK28p7Idles", cprimodRsvd4RxFsmStateWaitForK28p7Idles}, {"WaitForFrameSync", cprimodRsvd4RxFsmStateWaitForFrameSync}, {"FrameSync", cprimodRsvd4RxFsmStateFrameSync}, {NULL, 0} }; enum_mapping_t cprimod_rsvd4_rx_overide_t_mapping[] = { {"FrameUnsyncTInvldMgRecvd", cprimodRsvd4RxOverideFrameUnsyncTInvldMgRecvd}, {"FrameSyncTVldMgRecvd", cprimodRsvd4RxOverideFrameSyncTVldMgRecvd}, {"KMgIdlesRecvd", cprimodRsvd4RxOverideKMgIdlesRecvd}, {"IdleReqRecvd", cprimodRsvd4RxOverideIdleReqRecvd}, {"IdleAckRecvd", cprimodRsvd4RxOverideIdleAckRecvd}, {"SeedCapAndVerifyDone", cprimodRsvd4RxOverideSeedCapAndVerifyDone}, {NULL, 0} }; enum_mapping_t cprimod_tx_config_field_t_mapping[] = { {"agnosticMode", cprimodTxConfigagnosticMode}, {"txpmdDisableOverrideVal", cprimodTxConfigtxpmdDisableOverrideVal}, {"txpmdDisableOverrideEn", cprimodTxConfigtxpmdDisableOverrideEn}, {"seed8B10B", cprimodTxConfigseed8B10B}, {"scrambleBypass", cprimodTxConfigscrambleBypass}, {"seed8b10b", cprimodTxConfigseed8b10b}, {"cwaScrEn8b10b", cprimodTxConfigcwaScrEn8b10b}, {NULL, 0} }; enum_mapping_t cprimod_rsvd4_tx_fsm_state_t_mapping[] = { {"Off", cprimodRsvd4TxFsmStateOff}, {"Idle", cprimodRsvd4TxFsmStateIdle}, {"IdleReq", cprimodRsvd4TxFsmStateIdleReq}, {"IdleAck", cprimodRsvd4TxFsmStateIdleAck}, {"FrameTx", cprimodRsvd4TxFsmStateFrameTx}, {NULL, 0} }; enum_mapping_t cprimod_rsvd4_tx_overide_t_mapping[] = { {"StartTx", cprimodRsvd4TxOverideStartTx}, {"RxPcsAckCap", cprimodRsvd4TxOverideRxPcsAckCap}, {"RxPcsIdleReq", cprimodRsvd4TxOverideRxPcsIdleReq}, {"RxPcsScrLock", cprimodRsvd4TxOverideRxPcsScrLock}, {"LosStauts", cprimodRsvd4TxOverideLosStauts}, {NULL, 0} }; enum_mapping_t cprimod_rx_pcs_status_t_mapping[] = { {"LinkStatusLive", cprimodRxPcsStatusLinkStatusLive}, {"SeedLocked", cprimodRxPcsStatusSeedLocked}, {"SeedVector", cprimodRxPcsStatusSeedVector}, {"LosLive", cprimodRxPcsStatusLosLive}, {"64b66bHiBerLive", cprimodRxPcsStatus64b66bHiBerLive}, {"64b66bBlockLockLive", cprimodRxPcsStatus64b66bBlockLockLive}, {NULL, 0} }; enum_mapping_t cprimod_firmware_load_force_t_mapping[] = { {"Skip", cprimodFirmwareLoadSkip}, {"Force", cprimodFirmwareLoadForce}, {"Auto", cprimodFirmwareLoadAuto}, {NULL, 0} }; enum_mapping_t cprimod_firmware_load_method_t_mapping[] = { {"None", cprimodFirmwareLoadMethodNone}, {"Internal", cprimodFirmwareLoadMethodInternal}, {"External", cprimodFirmwareLoadMethodExternal}, {"ProgEEPROM", cprimodFirmwareLoadMethodProgEEPROM}, {NULL, 0} }; enum_mapping_t cprimod_tx_input_voltage_t_mapping[] = { {"Default", cprimodTxInputVoltageDefault}, {"1p00", cprimodTxInputVoltage1p00}, {"1p25", cprimodTxInputVoltage1p25}, {NULL, 0} }; enum_mapping_t cprimod_hdlc_crc_byte_order_t_mapping[] = { {"None", cprimodHdlcCrcByteOrderNone}, {"Swap", cprimodHdlcCrcByteOrderSwap}, {NULL, 0} }; enum_mapping_t cprimod_hdlc_fcs_err_check_t_mapping[] = { {"Check", cprimodHdlcFcsErrCheck}, {"NoCheck", cprimodHdlcFcsErrNoCheck}, {NULL, 0} }; enum_mapping_t cprimod_cw_filter_mode_t_mapping[] = { {"Disable", cprimodCwFilterDisable}, {"NonZero", cprimodCwFilterNonZero}, {"Periodic", cprimodCwFilterPeriodic}, {"Change", cprimodCwFilterChange}, {"PatternMatch", cprimodCwFilterPatternMatch}, {NULL, 0} }; enum_mapping_t cprimod_vsd_raw_map_mode_t_mapping[] = { {"Periodic", cprimodVsdRawMapModePeriodic}, {"RoeFrame", cprimodVsdRawMapModeRoeFrame}, {NULL, 0} }; enum_mapping_t cprimod_gcw_mask_t_mapping[] = { {"None", cprimodGcwMaskNone}, {"LSB", cprimodGcwMaskLSB}, {"MSB", cprimodGcwMaskMSB}, {"BOTH", cprimodGcwMaskBOTH}, {NULL, 0} }; enum_mapping_t cprimod_1588_capture_mode_t_mapping[] = { {"BFN_AND_HFN", cprimod_1588_MATCH_BFN_AND_HFN}, {"HFN_ONLY", cprimod_1588_MATCH_HFN_ONLY}, {NULL, 0} }; enum_mapping_t cprimod_agnostic_mode_type_t_mapping[] = { {"cpri", cprimod_agnostic_mode_cpri}, {"rsvd4", cprimod_agnostic_mode_rsvd4}, {"tunnel", cprimod_agnostic_mode_tunnel}, {NULL, 0} }; enum_mapping_t cprimod_pmd_port_status_t_mapping[] = { {"TxClockValid", cprimodPmdPortStatusTxClockValid}, {"RxClockValid", cprimodPmdPortStatusRxClockValid}, {"RxLock", cprimodPmdPortStatusRxLock}, {"EnergyDetected", cprimodPmdPortStatusEnergyDetected}, {"SignalDetected", cprimodPmdPortStatusSignalDetected}, {NULL, 0} }; #endif /*CPRIMOD_DIAG*/
31.780822
134
0.733448
0868f9d3e4c7415bb7eb48eeb576a4d8db5b4296
967
c
C
lis/surfacemodels/land/vic.4.1.1/vic411_fsvp.c
KathyNie/LISF
5c3e8b94494fac5ff76a1a441a237e32af420d06
[ "Apache-2.0" ]
67
2018-11-13T21:40:54.000Z
2022-02-23T08:11:56.000Z
lis/surfacemodels/land/vic.4.1.1/vic411_fsvp.c
dmocko/LISF
08d024d6d5fe66db311e43e78740842d653749f4
[ "Apache-2.0" ]
679
2018-11-13T20:10:29.000Z
2022-03-30T19:55:25.000Z
lis/surfacemodels/land/vic.4.1.1/vic411_fsvp.c
dmocko/LISF
08d024d6d5fe66db311e43e78740842d653749f4
[ "Apache-2.0" ]
119
2018-11-08T15:53:35.000Z
2022-03-28T10:16:01.000Z
//-----------------------BEGIN NOTICE -- DO NOT EDIT----------------------- // NASA Goddard Space Flight Center // Land Information System Framework (LISF) // Version 7.3 // // Copyright (c) 2020 United States Government as represented by the // Administrator of the National Aeronautics and Space Administration. // All Rights Reserved. //-------------------------END NOTICE -- DO NOT EDIT----------------------- #include "ftn.h" double vic411_svp(double); //BOP // // !ROUTINE: fsvp // \label{fsvp411} // // !REVISION HISTORY: // 12 Dec 2011 James Geiger; Initial implementation // // !INTERFACE: double FTN(vic411_fsvp)(double * temp) // // !DESCRIPTION: // This routine returns the saturated vapor pressure (vic411\_svp) corresponding to // the given temperature by calling VIC's vic411\_svp routine. // // The arguments are: // \begin{description} // \item[temp] temperature, in Celcius // \end{description} // //EOP { return vic411_svp(*temp); }
26.861111
84
0.638056
086ab987333c3dcad87fb56dbe61fafbd650843c
5,263
h
C
src/bgp/bgp_update_queue.h
safchain/contrail-controller
ccf736b96e4372132cb27a37d47f43373e56b320
[ "Apache-2.0" ]
5
2015-01-08T17:34:41.000Z
2017-09-28T16:00:25.000Z
src/bgp/bgp_update_queue.h
sysbot/contrail-controller
893de3e41aa7b8e40092fba4a5da34284f5ee00f
[ "Apache-2.0" ]
null
null
null
src/bgp/bgp_update_queue.h
sysbot/contrail-controller
893de3e41aa7b8e40092fba4a5da34284f5ee00f
[ "Apache-2.0" ]
2
2016-06-24T20:16:45.000Z
2020-02-05T10:47:43.000Z
/* * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. */ #ifndef ctrlplane_bgp_update_queue_h #define ctrlplane_bgp_update_queue_h #include <tbb/mutex.h> #include "bgp/bgp_update.h" // // Comparator used to order UpdateInfos in the UpdateQueue set container. // Looks at the BgpAttr, Timestamp and the associated RouteUpdate but not // the Label, in order to achieve optimal packing of BGP updates. // struct UpdateByAttrCmp { bool operator()(const UpdateInfo &lhs, const UpdateInfo &rhs) const { if (lhs.roattr.attr() < rhs.roattr.attr()) { return true; } if (lhs.roattr.attr() > rhs.roattr.attr()) { return false; } if (lhs.update->tstamp() < rhs.update->tstamp()) { return true; } if (lhs.update->tstamp() > rhs.update->tstamp()) { return false; } return (lhs.update < rhs.update); } }; // // This class implements an update queue for a RibOut. A RibUpdateMonitor // contains a vector of pointers to UpdateQueue. The UpdateQueue instances // are created and the corresponding pointers added to the vector from the // RibOutUpdates constructor. The following relationships are relevant: // // RibOut -> RibOutUpdates (1:1) // RibOutUpdates -> RibUpdateMonitor (1:1) // RibUpdateMonitor -> UpdateQueue (1:N) // // Each UpdateQueue has an id which indicates whether it's a BULK queue or // an UPDATE queue. A BULK queue is used for route refresh and also when // a new peer comes up. // // An UpdateQueue contains an intrusive doubly linked list of UpdateEntry // base elements, which could be either be UpdateMarker or RouteUpdate. // This list is maintained in temporal order i.e. it's a FIFO. // // An UpdateQueue also has a intrusive set of UpdateInfo elements. These // are ordered by attribute, timestamp and the corresponding prefix. This // container is used when building updates since it allows us to traverse // prefixes grouped by attributes. The relationship between a RouteUpdate // and UpdateInfo is described elsewhere. // // All access to an UpdateQueue is controlled via a mutex. This seems to // be unnecessary at first glance since an UpdateQueue is accessed via the // RibUpdateMonitor which has it's own mutex. However, the subtlety is // that any UpdateMarkers on the queue are NOT accessed via the monitor. // Additionally, using a mutex for the UpdateQueue is a generally good // design principle to follow, given that there should be no contention for // the mutex most of the time. All the methods use a scoped lock to lock // the mutex. // // An UpdateQueue also maintains a mapping from a peer's bit position to // it's UpdateMarker. Note that it's possible for multiple peers to point // to the same marker. // // A special UpdateMarker called the tail marker is used as an easy way to // keep track of whether the list is empty. The tail marker is always the // last marker in the list. Another way to think about this is that all // the RouteUpdates after the tail marker have not been seen by any peer. // This property is maintained by making sure that when the update marker // for a peer (or set of peers) reaches the tail marker, it's merged into // the tail marker. // class UpdateQueue { public: // Typedefs for the intrusive list. typedef boost::intrusive::member_hook< UpdateEntry, boost::intrusive::list_member_hook<>, &UpdateEntry::list_node > UpdateEntryNode; typedef boost::intrusive::list<UpdateEntry, UpdateEntryNode> UpdatesByOrder; // Typedefs for the intrusive set. typedef boost::intrusive::member_hook<UpdateInfo, boost::intrusive::set_member_hook<>, &UpdateInfo::update_node > UpdateSetNode; typedef boost::intrusive::set<UpdateInfo, UpdateSetNode, boost::intrusive::compare<UpdateByAttrCmp> > UpdatesByAttr; typedef std::map<int, UpdateMarker *> MarkerMap; explicit UpdateQueue(int queue_id); ~UpdateQueue(); bool Enqueue(RouteUpdate *rt_update); void Dequeue(RouteUpdate *rt_update); RouteUpdate *NextUpdate(UpdateEntry *upentry); UpdateEntry *NextEntry(UpdateEntry *upentry); void AttrDequeue(UpdateInfo *current_uinfo); UpdateInfo *AttrNext(UpdateInfo *current_uinfo); void AddMarker(UpdateMarker *marker, RouteUpdate *rt_update); void MoveMarker(UpdateMarker *marker, RouteUpdate *rt_update); void MarkerSplit(UpdateMarker *marker, const RibPeerSet &msplit); void MarkerMerge(UpdateMarker *dst_marker, UpdateMarker *src_marker, const RibPeerSet &bitset); UpdateMarker *GetMarker(int bit); void Join(int bit); void Leave(int bit); bool CheckInvariants() const; UpdateMarker *tail_marker() { return &tail_marker_; } bool empty() const; size_t size() const; size_t marker_count() const; private: friend class BgpExportTest; friend class RibOutUpdatesTest; mutable tbb::mutex mutex_; int queue_id_; size_t marker_count_; UpdatesByOrder queue_; UpdatesByAttr attr_set_; MarkerMap markers_; UpdateMarker tail_marker_; DISALLOW_COPY_AND_ASSIGN(UpdateQueue); }; #endif
35.560811
80
0.710431
086ae5762e274a05dd7aed56b6a7333b0caf82cd
6,734
h
C
ash/public/cpp/login_screen_client.h
mghgroup/Glide-Browser
6a4c1eaa6632ec55014fee87781c6bbbb92a2af5
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
ash/public/cpp/login_screen_client.h
mghgroup/Glide-Browser
6a4c1eaa6632ec55014fee87781c6bbbb92a2af5
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
ash/public/cpp/login_screen_client.h
mghgroup/Glide-Browser
6a4c1eaa6632ec55014fee87781c6bbbb92a2af5
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
2
2021-01-05T23:43:46.000Z
2021-01-07T23:36:34.000Z
// Copyright 2019 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 ASH_PUBLIC_CPP_LOGIN_SCREEN_CLIENT_H_ #define ASH_PUBLIC_CPP_LOGIN_SCREEN_CLIENT_H_ #include <string> #include "ash/public/cpp/ash_public_export.h" #include "ash/public/cpp/login_accelerators.h" #include "base/callback_forward.h" #include "base/time/time.h" #include "ui/gfx/native_widget_types.h" class AccountId; namespace ash { // An interface allows Ash to trigger certain login steps that Chrome is // responsible for. class ASH_PUBLIC_EXPORT LoginScreenClient { public: // Attempt to authenticate a user with a password or PIN. // // If auth succeeds: // chrome will hide the lock screen and clear any displayed error messages. // If auth fails: // chrome will request lock screen to show error messages. // |account_id|: The AccountId to authenticate against. // |password|: The submitted password. // |authenticated_by_pin|: True if we are using pin to authenticate. // // The result will be set to true if auth was successful, false if not. // // TODO(jdufault): Extract authenticated_by_pin into a separate method, // similar to the other Authenticate* methods virtual void AuthenticateUserWithPasswordOrPin( const AccountId& account_id, const std::string& password, bool authenticated_by_pin, base::OnceCallback<void(bool)> callback) = 0; // Try to authenticate |account_id| using easy unlock. This can be used on the // login or lock screen. // |account_id|: The account id of the user we are authenticating. // // TODO(jdufault): Refactor this method to return an auth_success, similar to // the other auth methods above. virtual void AuthenticateUserWithEasyUnlock(const AccountId& account_id) = 0; // Try to authenticate |account_id| using the challenge-response protocol // against a security token. // |account_id|: The account id of the user we are authenticating. virtual void AuthenticateUserWithChallengeResponse( const AccountId& account_id, base::OnceCallback<void(bool)> callback) = 0; // Validates parent access code for the user identified by |account_id|. When // |account_id| is empty it tries to validate the access code for any child // that is signed in the device. Returns validation result. |validation_time| // is the time that will be used to validate the code, validation will succeed // if the code was valid this given time. Note: This should only be used for // child user, it will always return false when a non-child id is used. // TODO(crbug.com/965479): move this to a more appropriate place. virtual bool ValidateParentAccessCode(const AccountId& account_id, const std::string& access_code, base::Time validation_time) = 0; // Request to hard lock the user pod. // |account_id|: The account id of the user in the user pod. virtual void HardlockPod(const AccountId& account_id) = 0; // Focus user pod of user with |account_id|. virtual void OnFocusPod(const AccountId& account_id) = 0; // Notify that no user pod is focused. virtual void OnNoPodFocused() = 0; // Load wallpaper of user with |account_id|. virtual void LoadWallpaper(const AccountId& account_id) = 0; // Sign out current user. virtual void SignOutUser() = 0; // Close add user screen. virtual void CancelAddUser() = 0; // Launches guest mode. virtual void LoginAsGuest() = 0; // User with |account_id| has reached maximum incorrect password attempts. virtual void OnMaxIncorrectPasswordAttempted(const AccountId& account_id) = 0; // Should pass the focus to the active lock screen app window, if there is // one. This is called when a lock screen app is reported to be active (using // tray_action mojo interface), and is next in the tab order. // |HandleFocusLeavingLockScreenApps| should be called to return focus to the // lock screen. // |reverse|: Whether the tab order is reversed. virtual void FocusLockScreenApps(bool reverse) = 0; // Passes focus to the OOBE dialog if it is showing. No-op otherwise. virtual void FocusOobeDialog() = 0; // Show the gaia sign-in dialog. // The value in |prefilled_account| will be used to prefill the sign-in dialog // so the user does not need to type the account email. virtual void ShowGaiaSignin(const AccountId& prefilled_account) = 0; // Notification that the remove user warning was shown. virtual void OnRemoveUserWarningShown() = 0; // Try to remove |account_id|. virtual void RemoveUser(const AccountId& account_id) = 0; // Launch a public session for user with |account_id|. // |locale|: Locale for this user. // The value is language code like "en-US", "zh-CN" // |input_method|: Input method for this user. // This is the id of InputMethodDescriptor like // "t:latn-post", "pinyin". virtual void LaunchPublicSession(const AccountId& account_id, const std::string& locale, const std::string& input_method) = 0; // Request public session keyboard layouts for user with |account_id|. // This function send a request to chrome and the result will be returned by // SetPublicSessionKeyboardLayouts. // |locale|: Request a list of keyboard layouts that can be used by this // locale. virtual void RequestPublicSessionKeyboardLayouts( const AccountId& account_id, const std::string& locale) = 0; // Request to handle a login-specific accelerator action. virtual void HandleAccelerator(ash::LoginAcceleratorAction action) = 0; // Show the help app for when users have trouble signing in to their account. virtual void ShowAccountAccessHelpApp(gfx::NativeWindow parent_window) = 0; // Shows help app for users that have trouble using parent access code. virtual void ShowParentAccessHelpApp(gfx::NativeWindow parent_window) = 0; // Show the lockscreen notification settings page. virtual void ShowLockScreenNotificationSettings() = 0; // Called when the keyboard focus is about to leave from the system tray in // the login screen / OOBE. |reverse| is true when the focus moves in the // reversed direction. virtual void OnFocusLeavingSystemTray(bool reverse) = 0; // Used by Ash to signal that user activity occurred on the login screen. virtual void OnUserActivity() = 0; protected: virtual ~LoginScreenClient() = default; }; } // namespace ash #endif // ASH_PUBLIC_CPP_LOGIN_SCREEN_CLIENT_H_
41.312883
80
0.714731
086afbefb8748d17b6fdc5a575c5ef6e339562ff
580
h
C
tcp_server_and_ client/tcp_client_with_audio/include/pthread_define.h
sophie820318/TCP_server_and_client_linux
85914fd96a93dfa059ddb5f0dcb090b25a5d7b91
[ "MIT" ]
1
2020-07-26T05:49:25.000Z
2020-07-26T05:49:25.000Z
tcp_server_and_ client/tcp_client_with_audio/include/pthread_define.h
sophie820318/TCP_server_and_client_linux
85914fd96a93dfa059ddb5f0dcb090b25a5d7b91
[ "MIT" ]
null
null
null
tcp_server_and_ client/tcp_client_with_audio/include/pthread_define.h
sophie820318/TCP_server_and_client_linux
85914fd96a93dfa059ddb5f0dcb090b25a5d7b91
[ "MIT" ]
null
null
null
/************************************************************************** * @ file : pthread_define.h * @ author : syc * @ version : 1.0 * @ date : 2020.7.16 * @ brief :线程调用_功能函数封装 ***************************************************************************/ #ifndef _PTHREAD_DEFINE_H_ #define _PTHREAD_DEFINE_H_ #include <pthread.h> #include <stdio.h> #ifdef __cplusplus extern "C" { #endif int detachThreadCreate(pthread_t *thread, void * start_routine, void *arg); #ifdef __cplusplus } #endif #endif // _PTHREAD_DEFINE_H_
20.714286
77
0.468966
086c74ed4d7d6e2e0a499f2a65327f367ec1dcf8
4,492
c
C
netbsd/sys/arch/mac68k/dev/ite_compat.c
shisa/kame-shisa
25dfcf220c0cd8192e475a602501206ccbd9263e
[ "BSD-3-Clause" ]
1
2019-10-15T06:29:32.000Z
2019-10-15T06:29:32.000Z
netbsd/sys/arch/mac68k/dev/ite_compat.c
shisa/kame-shisa
25dfcf220c0cd8192e475a602501206ccbd9263e
[ "BSD-3-Clause" ]
null
null
null
netbsd/sys/arch/mac68k/dev/ite_compat.c
shisa/kame-shisa
25dfcf220c0cd8192e475a602501206ccbd9263e
[ "BSD-3-Clause" ]
3
2017-01-09T02:15:36.000Z
2019-10-15T06:30:25.000Z
/* $NetBSD: ite_compat.c,v 1.4 2001/05/14 09:27:06 scw Exp $ */ /* * Copyright (C) 2000 Scott Reynolds * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * The main thing to realize about this emulator is that the old console * emulator was largely compatible with the DEC VT-220. Since the * wsdiplay driver has a more complete emulation of that terminal, it's * reasonable to pass virtually everything up to that driver without * modification. */ #include "ite.h" #include "wsdisplay.h" #include <sys/param.h> #include <sys/systm.h> #include <sys/conf.h> #include <sys/device.h> #include <sys/ioctl.h> #include <sys/ttycom.h> #include <dev/cons.h> #include <machine/cpu.h> #include <machine/iteioctl.h> cdev_decl(ite); cdev_decl(wsdisplay); void iteattach __P((int)); static int ite_initted = 0; static int ite_bell_freq = 1880; static int ite_bell_length = 10; static int ite_bell_volume = 100; /*ARGSUSED*/ void iteattach(n) int n; { #if NWSDISPLAY > 0 int maj; for (maj = 0; maj < nchrdev; maj++) if (cdevsw[maj].d_open == wsdisplayopen) break; KASSERT(maj < nchrdev); if (maj != major(cn_tab->cn_dev)) return; ite_initted = 1; #endif } /* * Tty handling functions */ /*ARGSUSED*/ int iteopen(dev, mode, devtype, p) dev_t dev; int mode; int devtype; struct proc *p; { return ite_initted ? (0) : (ENXIO); } /*ARGSUSED*/ int iteclose(dev, flag, mode, p) dev_t dev; int flag; int mode; struct proc *p; { return ite_initted ? (0) : (ENXIO); } /*ARGSUSED*/ int iteread(dev, uio, flag) dev_t dev; struct uio *uio; int flag; { return ite_initted ? wsdisplayread(cn_tab->cn_dev, uio, flag) : (ENXIO); } /*ARGSUSED*/ int itewrite(dev, uio, flag) dev_t dev; struct uio *uio; int flag; { return ite_initted ? wsdisplaywrite(cn_tab->cn_dev, uio, flag) : (ENXIO); } /*ARGSUSED*/ struct tty * itetty(dev) dev_t dev; { return ite_initted ? wsdisplaytty(cn_tab->cn_dev) : (NULL); } /*ARGSUSED*/ void itestop(struct tty *tp, int flag) { } /*ARGSUSED*/ int iteioctl(dev, cmd, addr, flag, p) dev_t dev; u_long cmd; caddr_t addr; int flag; struct proc *p; { if (!ite_initted) return (ENXIO); switch (cmd) { case ITEIOC_RINGBELL: return mac68k_ring_bell(ite_bell_freq, ite_bell_length, ite_bell_volume); case ITEIOC_SETBELL: { struct bellparams *bp = (void *)addr; /* Do some sanity checks. */ if (bp->freq < 10 || bp->freq > 40000) return (EINVAL); if (bp->len < 0 || bp->len > 3600) return (EINVAL); if (bp->vol < 0 || bp->vol > 100) return (EINVAL); ite_bell_freq = bp->freq; ite_bell_length = bp->len; ite_bell_volume = bp->vol; return (0); } case ITEIOC_GETBELL: { struct bellparams *bp = (void *)addr; ite_bell_freq = bp->freq; ite_bell_length = bp->len; ite_bell_volume = bp->vol; return (0); } default: return wsdisplayioctl(cn_tab->cn_dev, cmd, addr, flag, p); } return (ENOTTY); } /*ARGSUSED*/ int itepoll(dev, events, p) dev_t dev; int events; struct proc *p; { return ite_initted ? wsdisplaypoll(cn_tab->cn_dev, events, p) : (ENXIO); }
22.019608
76
0.695013
086d792d09c83d91efed1424d2f508c99a173d0f
5,033
h
C
usr/eclipseclp/Kernel/src/external.h
lambdaxymox/barrelfish
06a9f54721a8d96874a8939d8973178a562c342f
[ "MIT" ]
111
2015-02-03T02:57:27.000Z
2022-03-01T23:57:09.000Z
usr/eclipseclp/Kernel/src/external.h
lambdaxymox/barrelfish
06a9f54721a8d96874a8939d8973178a562c342f
[ "MIT" ]
12
2016-03-22T14:44:32.000Z
2020-03-18T13:30:29.000Z
usr/eclipseclp/Kernel/src/external.h
lambdaxymox/barrelfish
06a9f54721a8d96874a8939d8973178a562c342f
[ "MIT" ]
55
2015-02-03T05:28:12.000Z
2022-03-31T05:00:03.000Z
/* BEGIN LICENSE BLOCK * Version: CMPL 1.1 * * The contents of this file are subject to the Cisco-style Mozilla Public * License Version 1.1 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License * at www.eclipse-clp.org/license. * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is The ECLiPSe Constraint Logic Programming System. * The Initial Developer of the Original Code is Cisco Systems, Inc. * Portions created by the Initial Developer are * Copyright (C) 1989-2006 Cisco Systems, Inc. All Rights Reserved. * * Contributor(s): * * END LICENSE BLOCK */ /* * SEPIA INCLUDE FILE * * VERSION $Id: external.h,v 1.2 2012/02/25 13:36:44 jschimpf Exp $ */ /* * IDENTIFICATION external.h * * DESCRIPTION Contains Macros for externals * * CONTENTS: * Current_Error * Current_Input * Current_Output * Debug_Input * Debug_Output * Delay * Dereference(x) * Did(string, arity) * Error(code) * Fail * Fprintf * Get_Array_Address(adid, address) * Get_Visible_Array_Address(adid, module,mod_tag,address) * Get_Array_Header(adid, address) * Get_Visible_Array_Header(adid, module, mod_tag,address) * Get_Stream(stream_val, stream_tag, type, stream) * Mark_Suspending_Variable(var) * Mark_Suspending_Variable_Inst(var) * Prolog_Call(goal_val, goal_tag, mod_val, mod_tag) * Prolog_Call_Nobind(goal_val, goal_tag, mod_val, mod_tag) * Succeed * Toplevel_Input * Toplevel_Output * User * Write(val, tag, stream) * Writeq(val, tag, stream) * * */ #define EC_EXTERNAL /* * INCLUDES */ #include "config.h" #include "sepia.h" #include "types.h" #include "error.h" #include "embed.h" /* * DEFINES: */ #define Succeed Succeed_ #define Fail Fail_ #define Error(code) Bip_Error(code) #define Delay return PDELAY; #define Dereference(x) Dereference_(x) #define Fprintf p_fprintf #define Write(val, tag, stream) \ { \ int res; \ res = ec_pwrite(2, stream, val, tag, 1200, PrintDepth, \ d_.default_module, tdict, 0); \ if (res != PSUCCEED) \ { Bip_Error(res);} \ } #define Writeq(val, tag, stream) \ { \ int res; \ res = ec_pwrite(3, stream, val, tag, 1200, PrintDepth, \ d_.default_module, tdict, 0); \ if (res != PSUCCEED) \ { Bip_Error(res);} \ } #define Get_Array_Address(adid, address) \ Get_Array_Header(adid, address) \ if (DidArity(adid) != 0) \ { \ address = address->val.ptr; \ address = (pword *) ((uword *) address + 1 + DidArity(adid));\ } #define Get_Visible_Array_Address(adid, module, mod_tag, address) \ Get_Visible_Array_Header(adid, module, mod_tag, address) \ if (DidArity(adid) != 0) \ { \ address = address->val.ptr; \ address = (pword *) ((uword *) address + 1 + DidArity(adid));\ } #define Get_Array_Header(adid, address) \ address = get_array_header(adid); \ if (address == 0) \ { \ Error(NOGLOBAL); \ } #define Get_Visible_Array_Header(adid, module, mod_tag, address) \ { \ int res; \ address = get_visible_array_header(adid, module, mod_tag, &res);\ if (address == 0) \ { \ Error(res); \ } \ } #define Mark_Suspending_Variable(vptr) { \ register pword *pw = TG; \ TG += 2; \ Check_Gc; \ pw[0].val.ptr = vptr; \ pw[0].tag.kernel = TREF; \ if (SV) { \ pw[1].val.ptr = SV; \ pw[1].tag.kernel = TLIST; \ } else \ pw[1].tag.kernel = TNIL; \ SV = pw; \ } #define Mark_Suspending_Variable_Inst(var) \ Mark_Suspending_Variable(var) #define Check_Gc \ if (TG >= TG_LIM) global_ov(); #define Prolog_Call(goal_val, goal_tag, mod_val, mod_tag) \ sub_emulc(goal_val, goal_tag, mod_val, mod_tag) #define Prolog_Call_Nobind(goal_val, goal_tag, mod_val, mod_tag) \ query_emulc(goal_val, goal_tag, mod_val, mod_tag) /* * EXTERNAL FUNCTION DECLARATIONS: */ Extern dident bitfield_did(Dots); Extern pword *get_array_header(Dots), *get_visible_array_header(Dots); Extern int ec_pwrite(Dots), sub_emulc(Dots), query_emulc(Dots); Extern stream_id get_stream_id(); #define INPUT 0x0001 #define OUTPUT 0x0002 #define Get_Stream(vs, ts, typ, nst) \ { \ int res; \ nst = get_stream_id(vs, ts, typ, &res); \ if (nst == 0) \ { Error(res); } \ }
26.771277
74
0.597655
086e3236c722838e2c76e6b243bf9c50d80c8fe3
9,741
h
C
code/RePlAce/src/opt.h
gessfred/Parallel-RePlAce
e2fdc6a585976daee21991b4fbec96a04cc62d5a
[ "BSD-3-Clause" ]
null
null
null
code/RePlAce/src/opt.h
gessfred/Parallel-RePlAce
e2fdc6a585976daee21991b4fbec96a04cc62d5a
[ "BSD-3-Clause" ]
null
null
null
code/RePlAce/src/opt.h
gessfred/Parallel-RePlAce
e2fdc6a585976daee21991b4fbec96a04cc62d5a
[ "BSD-3-Clause" ]
null
null
null
/////////////////////////////////////////////////////////////////////////////// // Authors: Ilgweon Kang and Lutong Wang // (respective Ph.D. advisors: Chung-Kuan Cheng, Andrew B. Kahng), // based on Dr. Jingwei Lu with ePlace and ePlace-MS // // Many subsequent improvements were made by Mingyu Woo // leading up to the initial release. // // BSD 3-Clause License // // Copyright (c) 2018, The Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * Neither the name of 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. /////////////////////////////////////////////////////////////////////////////// #ifndef __PL_OPT__ #define __PL_OPT__ #include <vector> #include "global.h" extern int FILLER_PLACE; extern int NUM_ITER_FILLER_PLACE; // fast filler pre-place, need tuning extern prec opt_phi_cof; extern prec opt_phi_cof_local; extern prec gsum_pcnt; extern prec gsum_area; extern prec avg80p_cell_area; extern prec ref_dwl0; extern prec LOWER_PCOF, UPPER_PCOF; extern prec INIT_LAMBDA_COF_GP; extern prec MIN_PRE; extern FPOS avg80p_cell_dim; struct DST { int idx; prec dxy; }; struct ABC { int idx; prec val; struct FPOS p; }; struct ITER { struct FPOS wlen; struct FPOS hpwl; struct FPOS lc_dim; struct FPOS wcof; prec grad; prec tot_wlen; prec tot_hpwl; prec tot_stnwl; // lutong prec tot_wwl; // lutong prec potn; prec ovfl; prec pcof; int idx; prec beta; prec dis00; prec alpha00; prec lc; prec lc_w; prec lc_p; double cpu_curr, cpu_cost, wlcost, gradcost, dencost; struct FPOS alpha_dim; }; // routability void routability(); void routability_init(); void FLUTE_init(); // lutong void get_intermediate_pl_sol(char *dir, int tier); void evaluate_RC_by_official_script(char *dir); void est_congest_global_router(char *dir); void run_global_router(char *dir); void clean_routing_tracks_in_net(); void restore_cells_info(); void bloating(); void bloat_prep(); void adjust_inflation(); void cell_calc_new_area_per_Cell(struct CELLx *cell, struct TILE *bp); void shrink_filler_cells(prec); void calc_Total_inflate_ratio(); void calc_Total_inflated_cell_area(); void congEstimation(struct FPOS *st); void buildRSMT_FLUTE(struct FPOS *st); // lutong void buildRSMT_FLUTE_PerNet(struct FPOS *st, struct NET *net); // lutong void buildRMST(struct FPOS *st); void buildRMST2(struct FPOS *st); void buildRMSTPerNet(struct FPOS *st, struct NET *net); void buildRMSTPerNet_genTwoPinNets(struct FPOS *st, struct NET *net); void buildRMSTPerNet_genRMST(struct NET *net); void buildRMSTPerNet_printRMST(struct FPOS *st, struct NET *net); void clearTwoPinNets(); void calcCong_print(); void calcCong_print_detail(); void calcCongPerNet_prob_based(struct FPOS *st, struct NET *net); void calcCongPerNet_grouter_based(struct NET *net); void calcCong(struct FPOS *st, int est_method); void CalcPinDensity(struct FPOS *st); void MergePinDen2Route(); void MergeBlkg2Route(); void CalcPinDensityPerCell(struct CELLx *cell); void calcInflationRatio_foreachTile(); void gen_sort_InflationList(); bool inflationList_comp(std::pair< int, prec > a, std::pair< int, prec > b); void dynamicInflationAdjustment(); void printInflationRatio(); void cell_inflation_per_Cell(struct CELLx *cell, struct TILE *bp); void cell_den_scal_update_forNewGrad_inNSopt(struct CELLx *cell); void print_inflation_list(); // PIN void backup_org_PIN_info(struct PIN *pin); void prepare_bloat_PIN_info(); void restore_org_PIN_info(); // MODULE void backup_org_MODULE_info(struct MODULE *module); void prepare_bloat_MODULE_info(); void restore_org_MODULE_info(); // CELLx void backup_org_CELLx_info(struct CELLx *cell); void prepare_bloat_CELLx_info(); void restore_org_CELLx_info(struct CELLx *cell); // TERM void backup_org_TERM_info(struct TERM *term); void prepare_bloat_TERM_info(); void restore_org_TERM_info(); prec get_norm(struct FPOS *st, int n, prec num); void setup_before_opt(void); int setup_before_opt_mGP2D(void); int setup_before_opt_cGP2D(void); inline bool isPOTNuphill(void); int definePOTNphase(prec); void stepSizeAdaptation_by2ndOrderEPs(prec); void stepSizeAdaptation_by1stOrderEPs(prec); void msh_init(); int post_mGP2D_delete(void); void post_opt(void); void cell_init(void); void calc_average_module_width(); void cell_filler_init(); void update_cell_den(); void whitespace_init(void); void cell_update(struct FPOS *st, int n); void cell_delete(void); void input_sol(struct FPOS *st, int N, char *fn); void modu_copy(void); void cell_copy(void); int min_sort(const void *a, const void *b); prec get_dis(struct FPOS *a, struct FPOS *b, int N); struct FPOS get_dis2(struct FPOS *a, struct FPOS *b, int N, prec num); prec dmax(prec a, prec b); prec dmin(prec a, prec b); prec get_beta(struct FPOS *dx_st, struct FPOS *ldx_st, struct FPOS *ls_st, int N, int flg, int iter); prec get_phi_cof(prec x); prec get_phi_cof1(prec x); void iter_update(struct FPOS *lx_st, struct FPOS *x_st, struct FPOS *dx_st, int N, struct FPOS max_mov_L2, struct FPOS stop_mov_L2, int iter, struct ITER *it, int lab); void cg_input(struct FPOS *x_st, int N, int input); int area_sort(const void *a, const void *b); enum { NONE_INPUT, QWL_ISOL, ISOL_INPUT, WL_SOL_INPUT, IP_CEN_SQR, RANDOM_INPUT }; enum { NONE_OUTPUT, QWL_OUTPUT, ISOL_OUTPUT, WL_SOL_OUTPUT, IP_CEN_SQR_OUTPUT }; #define OPT_INPUT QWL_ISOL /* IP_CEN_SQR */ /* RANDOM_INPUT */ #define WLEN_SCALE_FACTOR 0.25 #define MAX_WL_ITER 10 int abc_sort(const void *a, const void *b); void getCostFuncGradient3(FPOS *dst, FPOS *wdst, FPOS *pdst, FPOS *pdstl, int n, prec *cellLambdaArr); void getCostFuncGradient2(FPOS *dst, FPOS *wdst, FPOS *pdst, FPOS *pdstl, int n, prec *cellLambdaArr, bool onlyPreCon, bool filler); void get_lc(struct FPOS *y_st, struct FPOS *y_dst, struct FPOS *z_st, struct FPOS *z_dst, struct ITER *iter, int N); void get_lc3(struct FPOS *y_st, struct FPOS *y_dst, struct FPOS *z_st, struct FPOS *z_dst, struct ITER *iter, int N); void get_lc3_filler(struct FPOS *y_st, struct FPOS *y_dst, struct FPOS *z_st, struct FPOS *z_dst, struct ITER *iter, int N); void init_iter(struct ITER *it, int idx); void shrink_gp_to_one(void); void expand_gp_from_one(void); void cell_macro_copy(void); void gp_opt(void); void filler_adj(void); void filler_adj_mGP2D(void); void filler_adj_cGP2D(void); void smart_filler_adj(void); void rand_filler_adj(int idx); void sa_pl_shift(struct FPOS *x_st, int N); void setup_before_opt(void); void tier_delete_mGP2D(void); void tier_init_2D(int); void cell_init_2D(void); //#define LC_REF_DIS #define ref_yz_dis 50.0 // empirical from adaptec1, need deep tuning #define z_ref_alpha /* 0.0001 */ \ 0.01 /* 100.0 */ // empirical from adaptec1, need tuning #define BACKTRACK #define ratioVarPl 1.0 #define PRECON //#define DEN_ONLY_PRECON // prevents fillers from spreading // only SB uses //DEN_ONLY_PRECON // too fast in 3D-IC placement #define MAX_BKTRK_CNT 10 #define tot_num_iter_var_pl 0 //#define INIT_LAMBDA_COF_GP 0.0001 // LW temp change // inline prec fastPow(prec a, prec b) { // // should be much more precise with large b // // calculate approximation with fraction of the exponent // int e = (int) b; // union { // prec d; // int x[2]; // } u = { a }; // u.x[1] = (int)((b - e) * (u.x[1] - 1072632447) + 1072632447); // u.x[0] = 0; // // // exponentiation by squaring with the exponent's integer part // // prec r = u.d makes everything much slower, not sure why // prec r = 1.0; // while (e) { // if (e & 1) { // r *= a; // } // a *= a; // e >>= 1; // } // return r * u.d; //} inline prec fastPow(prec a, prec b) { union { prec d; int x[2]; } u = {a}; u.x[1] = (int)(b * (u.x[1] - 1072632447) + 1072632447); u.x[0] = 0; return u.d; } inline prec fastExp(prec a) { a = 1.0 + a / 1024.0; a *= a; a *= a; a *= a; a *= a; a *= a; a *= a; a *= a; a *= a; a *= a; a *= a; return a; } #endif
29.607903
81
0.700236
086e3325ca6272ff5c5dde1711261559273f0083
2,575
h
C
build/ImageMagick-7.1.0-2/IMDelegates/ghostscript-9.54.0/base/gxclthrd.h
roMummy/imagemagick_lib_ios
0e0e6fa77e06b471f5019d5b1b28caabd08d5e6a
[ "ImageMagick" ]
null
null
null
build/ImageMagick-7.1.0-2/IMDelegates/ghostscript-9.54.0/base/gxclthrd.h
roMummy/imagemagick_lib_ios
0e0e6fa77e06b471f5019d5b1b28caabd08d5e6a
[ "ImageMagick" ]
null
null
null
build/ImageMagick-7.1.0-2/IMDelegates/ghostscript-9.54.0/base/gxclthrd.h
roMummy/imagemagick_lib_ios
0e0e6fa77e06b471f5019d5b1b28caabd08d5e6a
[ "ImageMagick" ]
null
null
null
/* Copyright (C) 2001-2021 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of the license contained in the file LICENSE in this distribution. Refer to licensing information at http://www.artifex.com or contact Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, CA 94945, U.S.A., +1(415)492-9861, for further information. */ /* Command list multiple rendering threads */ /* Requires gxsync.h */ #ifndef gxclthrd_INCLUDED # define gxclthrd_INCLUDED #include "gscms.h" #include "gxdevcli.h" #include "gxclist.h" /* clone a device and set params and its chunk memory */ /* The chunk_base_mem MUST be thread safe */ /* Return NULL on error, or the cloned device with the dev->memory set */ /* to the chunk allocator. */ /* Exported for use by background printing. */ /* When called to setup for background printing, bg_print is true */ gx_device * setup_device_and_mem_for_thread(gs_memory_t *chunk_base_mem, gx_device *dev, bool bg_print, gsicc_link_cache_t **cachep); /* Close and free the thread's device, finish the thread, free up the */ /* thread's memory and its chunk allocator and close the clist files */ /* if 'unlink' is true, also delete the clist files (for bg printing) */ /* Exported for use by background printing. */ void teardown_device_and_mem_for_thread(gx_device *dev, gp_thread_id thread_id, bool bg_print); /* Following is used for clist background printing and multi-threaded rendering */ typedef enum { THREAD_ERROR = -1, THREAD_IDLE = 0, THREAD_DONE = 1, THREAD_BUSY = 2 } thread_status; struct clist_render_thread_control_s { thread_status status; /* 0: not started, 1: done, 2: busy, < 0: error */ /* values allow waiting until status < 2 */ gs_memory_t *memory; /* thread's 'chunk' memory allocator */ gx_semaphore_t *sema_this; gx_semaphore_t *sema_group; gx_device *cdev; /* clist device copy */ gx_device *bdev; /* this thread's buffer device */ int band; gp_thread_id thread; /* For process_page mode */ gx_process_page_options_t *options; void *buffer; #ifdef DEBUG ulong cputime; #endif }; #endif /* gxclthrd_INCLUDED */
37.318841
133
0.67068
086e8105d99d904ee8c64d870559da7642bbb7cb
1,777
h
C
inc/bodypartdamage.h
int-ua/Dwarf-Therapist
5ee946be9e3a8bb486eaa6180da5b0bce83b432c
[ "MIT" ]
364
2015-01-04T18:59:23.000Z
2022-03-26T10:58:14.000Z
inc/bodypartdamage.h
int-ua/Dwarf-Therapist
5ee946be9e3a8bb486eaa6180da5b0bce83b432c
[ "MIT" ]
95
2015-01-04T18:01:02.000Z
2021-12-29T07:26:27.000Z
inc/bodypartdamage.h
int-ua/Dwarf-Therapist
5ee946be9e3a8bb486eaa6180da5b0bce83b432c
[ "MIT" ]
80
2015-01-04T15:58:21.000Z
2020-05-26T21:14:27.000Z
#ifndef BODYPARTDAMAGE_H #define BODYPARTDAMAGE_H #include "truncatingfilelogger.h" class BodyPart; class BodyPartDamage { public: BodyPartDamage() : m_bp(0x0) , m_bp_status(0) , m_bp_req(0) , m_bone_dmg(false) , m_muscle_dmg(false) , m_skin_dmg(false) { m_has_rot = false; m_is_missing = false; } BodyPartDamage(BodyPart *bp, quint32 bp_status, quint32 bp_req) : m_bp(bp) , m_bp_status(bp_status) , m_bp_req(bp_req) , m_bone_dmg(false) , m_muscle_dmg(false) , m_skin_dmg(false) { m_muscle_dmg = bp_status & 0x30; m_bone_dmg = bp_status & 0xc0; m_skin_dmg = bp_status & 0x100; m_has_rot = m_bp_req & 0x80; m_is_missing = m_bp_status & 0x2; } virtual ~BodyPartDamage(){ m_bp = 0; } inline bool has_skin_dmg() {return m_skin_dmg;} inline bool has_muscle_dmg() {return m_muscle_dmg;} inline bool has_bone_dmg() {return m_bone_dmg;} inline bool has_rot() {return m_has_rot;} inline bool is_missing() {return m_is_missing;} inline bool old_motor_nerve_dmg(){return m_bp_status & 0x200;} inline bool old_sensory_nerve_dmg(){return m_bp_status & 0x400;} inline BodyPart *body_part() {return m_bp;} private: BodyPart *m_bp; quint32 m_bp_status; quint32 m_bp_req; //holds flags for treatments (immobilize, suture, etc. but is also the only place we can check for rot) bool m_bone_dmg; bool m_muscle_dmg; bool m_skin_dmg; bool m_has_rot; bool m_is_missing; // bool m_needs_cleaning; // bool m_needs_sutures; }; #endif // BODYPARTDAMAGE_H
24.342466
126
0.621272
087647ab95a953affe31eaa247f0a468ae8c7dc7
265
h
C
MLN-iOS/MLNDevTool/Classes/Conn/IO/Read/LNReaderFactory.h
jackwiy/MLN
0b4dd2438cb2f0c87a18a8e4766f996e728ac1d8
[ "MIT" ]
1,615
2019-09-19T09:36:39.000Z
2022-03-31T13:05:47.000Z
MLN-iOS/MLNDevTool/Classes/Conn/IO/Read/LNReaderFactory.h
jackwiy/MLN
0b4dd2438cb2f0c87a18a8e4766f996e728ac1d8
[ "MIT" ]
193
2019-09-19T09:10:03.000Z
2022-02-23T02:48:02.000Z
MLN-iOS/MLNDevTool/Classes/Conn/IO/Read/LNReaderFactory.h
jackwiy/MLN
0b4dd2438cb2f0c87a18a8e4766f996e728ac1d8
[ "MIT" ]
203
2019-09-19T09:39:22.000Z
2022-03-27T12:18:44.000Z
// // MLNREaderFactory.h // MLNDebugger // // Created by MoMo on 2019/7/2. // #import <UIKit/UIKit.h> #import "LNReaderProtocol.h" NS_ASSUME_NONNULL_BEGIN @interface LNReaderFactory : NSObject; + (id<LNReaderProtocol>)getReader; @end NS_ASSUME_NONNULL_END
13.25
38
0.735849
08778170d4053fb098115c5b0a8fa35894789424
2,237
h
C
一个渣渣一样的项目框架/HaiTao/AFNetworking/MyUtil.h
FreddyZeng/The-Demo-Of-Common-Study
e5d3e0a77ce13129ad7451c32523be67e712e94b
[ "Apache-2.0" ]
71
2015-09-18T00:06:21.000Z
2017-01-16T06:47:57.000Z
一个渣渣一样的项目框架/HaiTao/AFNetworking/MyUtil.h
FreddyZeng/The-Demo-Of-Common-Study
e5d3e0a77ce13129ad7451c32523be67e712e94b
[ "Apache-2.0" ]
null
null
null
一个渣渣一样的项目框架/HaiTao/AFNetworking/MyUtil.h
FreddyZeng/The-Demo-Of-Common-Study
e5d3e0a77ce13129ad7451c32523be67e712e94b
[ "Apache-2.0" ]
54
2015-09-24T07:47:02.000Z
2016-11-30T05:10:42.000Z
// // MyUtil.h // gatako // // Created by 光速达 on 15-2-3. // Copyright (c) 2015年 光速达. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import <CommonCrypto/CommonDigest.h> @interface MyUtil : NSObject +(MyUtil *)shareUtil; //判断字符串是否为空 + (BOOL) isEmptyString:(NSString *)string; //对象转换成utf8json + (NSString *) toJsonUTF8String:(id)obj; //将图片压缩 保存至本地沙盒 + (void) saveImage:(UIImage *)currentImage withName:(NSString *)imageName andCompressionQuality:(CGFloat) quality ; //颜色值转化 #ffffff 转化成10进制 +(int)colorStringToInt:(NSString *)colorStrig colorNo:(int)colorNo; //验证手机号码格式 + (BOOL)isValidateTelephone:(NSString *)str; //利用正则表达式验证邮箱 +(BOOL)isValidateEmail:(NSString *)email; /** * 利用正则表达式验证邮编 */ + (BOOL)validateZipcode:(NSString *)zipcode; +(NSString *)getFormatDate:(NSDate *)date; +(NSString *)trim:(NSString *)string; + (NSString *)md5HexDigest:(NSString*)input; + (BOOL) validateIdentityCard: (NSString *)identityCard; /** * 将站内信中的『&nbsp;』字符转为空格字符 */ + (NSString *)specialCharactersToSpaceCharacters:(NSString *)specialCharacters; /** * 将手机号或身份证号的中间数字转为*字符 */ + (NSString *)encryptTelephoneOrIDCard:(NSString *)number; // 判断是否要在『选择商品属性和数量』界面 显示尺码说明的提示文字 + (BOOL)isNeedSizeAdvice:(NSString *)categoryID; // 创建Label的方法 + (UILabel *)createLabelWithFrame:(CGRect)frame title:(NSString *)title textColor:(UIColor *)color font:(UIFont *)font textAlignment:(NSTextAlignment)textAlignment numberOfLines:(NSInteger)numberOfLines; // 创建Label的另外一个方法 + (UILabel *)createLabelWithFrame:(CGRect)frame title:(NSString *)title font:(UIFont *)font; // 创建按钮的方法 + (UIButton *)createButtonWithFrame:(CGRect)frame title:(NSString *)title backgroundImageName:(NSString *)bgImageName selectImageName:(NSString *)selectImageName target:(id)target action:(SEL)action; // 创建图片视图的方法 + (UIImageView *)createImageViewWithFrame:(CGRect)frame imageName:(NSString *)imageName; // 创建文字输入框的方法 + (UITextField *)createTextField:(CGRect)frame placeHolder:(NSString *)placeHolder; // 创建 TableView 的方法 + (UITableView *)createTableViewWithFrame:(CGRect)frame style:(UITableViewStyle)style delegate:(id<UITableViewDelegate> _Nullable)delegate dataSource:(id<UITableViewDataSource> _Nullable)dataSource; @end
28.679487
203
0.75637
087ac5d97217b1d077f4c921f7267d5c2d85c1e2
490
h
C
src/AliceUI/AUIWidgetStyle.h
DevHwan/aliceui
9ee7d9424c06d4e063e55b486e9a78dfcebf8f86
[ "MIT" ]
1
2020-12-16T13:42:14.000Z
2020-12-16T13:42:14.000Z
src/AliceUI/AUIWidgetStyle.h
DevHwan/aliceui
9ee7d9424c06d4e063e55b486e9a78dfcebf8f86
[ "MIT" ]
null
null
null
src/AliceUI/AUIWidgetStyle.h
DevHwan/aliceui
9ee7d9424c06d4e063e55b486e9a78dfcebf8f86
[ "MIT" ]
null
null
null
#pragma once #include "AUIStateFeature.h" #include "AUIStyleNotion.h" class ALICEUI_API AUIWidgetStyle : public AUIStateFeature<AUIStyleNotion> { public: AUIWidgetStyle() = default; virtual ~AUIWidgetStyle() = default; }; class ALICEUI_API AUIStyleUpdator : public AUIStateFeatureUpdator<AUIStyleNotion> { public: AUIStyleUpdator(std::shared_ptr<const AUIWidgetStyle> pStyle) : AUIStateFeatureUpdator<AUIStyleNotion>(pStyle) {} virtual ~AUIStyleUpdator() = default; };
24.5
117
0.771429
087b792b17f0105cc9a634cbee808a5c9398e7ce
954
h
C
LSAuthorizationFramework-0.1.9/ios/LSAuthorizationFramework.framework/Versions/A/Headers/LSAuthorizationService.h
leshiguang/LSAuthorization
ccfc2a2e8a9979c97bb8200c00da71d567cfc4ea
[ "MIT" ]
null
null
null
LSAuthorizationFramework-0.1.9/ios/LSAuthorizationFramework.framework/Versions/A/Headers/LSAuthorizationService.h
leshiguang/LSAuthorization
ccfc2a2e8a9979c97bb8200c00da71d567cfc4ea
[ "MIT" ]
null
null
null
LSAuthorizationFramework-0.1.9/ios/LSAuthorizationFramework.framework/Versions/A/Headers/LSAuthorizationService.h
leshiguang/LSAuthorization
ccfc2a2e8a9979c97bb8200c00da71d567cfc4ea
[ "MIT" ]
null
null
null
// // LSAuthorizationService.h // LSAuthorizationService // // Created by alex.wu on 2020/3/3. // #import <Foundation/Foundation.h> #import "LSAuthorizationDelegate.h" NS_ASSUME_NONNULL_BEGIN @interface LSAuthorizationService : NSObject @property id<LSAuthorizationDelegate> delegate; +(instancetype) sharedInstance; -(void) addDelagate:(id<LSAuthorizationDelegate>) delegate; /// 设备鉴权服务 /// @param serviceId 服务ID,由服务中心指定 /// @param serviceVersion 服务版本,由服务中心指定 /// @param mac 设备mac地址 /// @param complete 回调 -(void) authorizeDevice:(NSString *)serviceId andVersion:(NSString *)serviceVersion andMac:(NSString *)mac andModel:(NSString *)model withBlock:(void (^)(NSInteger)) complete; /// 通用服务鉴权接口,针对算法、SDK等 /// @param serviceId 服务ID,由服务中心指定 /// @param serviceVersion 服务版本 /// @param complete 回调 -(void) authorize:(NSString *)serviceId andVersion:(NSString *)serviceVersion withBlock:(void (^)(NSInteger)) complete; @end NS_ASSUME_NONNULL_END
26.5
176
0.75891
087c384a6d5129cf22ef23d7a1e6700034986cb1
496
c
C
Homework/Homework 2/Problem8.c
MSimmons7/CMSI-387
a2e4db41e13f2b4854689c71f51bc6bf33d38a6f
[ "MIT" ]
null
null
null
Homework/Homework 2/Problem8.c
MSimmons7/CMSI-387
a2e4db41e13f2b4854689c71f51bc6bf33d38a6f
[ "MIT" ]
null
null
null
Homework/Homework 2/Problem8.c
MSimmons7/CMSI-387
a2e4db41e13f2b4854689c71f51bc6bf33d38a6f
[ "MIT" ]
null
null
null
#include <unistd.h> #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <time.h> int main(int argc, char *argv[]){ clock_t start, end; start = clock(); char *ptr = malloc(1000000); for (int i = 0; i < 1000000; i++) { ptr[i] = i; } for (int i = 0; i < 1000000; i++) { if ((i+1) % 4096) { printf(""); } } end = clock(); double time_taken = ((double)start)/CLOCKS_PER_SEC; // in seconds printf("took %f seconds to execute \n", time_taken); }
21.565217
68
0.570565
08814ea5b4ac4a874f623111948ecd0d68e2da59
707
h
C
jni/lzma/un7zip/un7zApi.h
balazsurban/android-luajit-launcher
2f95519c7c491874b9f7356400d51780d1013956
[ "MIT" ]
331
2015-01-09T02:33:39.000Z
2022-03-22T09:21:08.000Z
jni/lzma/un7zip/un7zApi.h
balazsurban/android-luajit-launcher
2f95519c7c491874b9f7356400d51780d1013956
[ "MIT" ]
172
2015-02-10T20:28:10.000Z
2022-03-02T03:46:47.000Z
jni/lzma/un7zip/un7zApi.h
balazsurban/android-luajit-launcher
2f95519c7c491874b9f7356400d51780d1013956
[ "MIT" ]
111
2015-02-28T10:18:02.000Z
2022-03-29T08:16:23.000Z
// // Created by huzongyao on 2019/12/30. // #ifndef ANDROIDUN7ZIP_UN7ZAPI_H #define ANDROIDUN7ZIP_UN7ZAPI_H #define FUNC(f) Java_com_hzy_lib7z_Z7Extractor_##f #ifdef __cplusplus extern "C" { #endif JNIEXPORT jstring JNICALL FUNC(nGetLzmaVersion)(JNIEnv *env, jclass type); JNIEXPORT jint JNICALL FUNC(nExtractFile)(JNIEnv *env, jclass type, jstring filePath_, jstring outPath_, jobject callback, jlong inBufSize); JNIEXPORT jint JNICALL FUNC(nExtractAsset)(JNIEnv *env, jclass type, jobject assetManager, jstring fileName_, jstring outPath_, jobject callback, jlong inBufSize); #ifdef __cplusplus } #endif #endif //ANDROIDUN7ZIP_UN7ZAPI_H
22.806452
74
0.731259
0881dc7f137ed321db43ce8d6316e608258cf6d3
343
h
C
src/Engine/ImGUI/GUIModule.h
danimtz/VulkanEngine
a7c566d7f8627b9f4a33ba93bbf102f1ba0a8892
[ "MIT" ]
null
null
null
src/Engine/ImGUI/GUIModule.h
danimtz/VulkanEngine
a7c566d7f8627b9f4a33ba93bbf102f1ba0a8892
[ "MIT" ]
null
null
null
src/Engine/ImGUI/GUIModule.h
danimtz/VulkanEngine
a7c566d7f8627b9f4a33ba93bbf102f1ba0a8892
[ "MIT" ]
null
null
null
#pragma once #include "Engine/Renderer/RenderModule.h" #include "imgui.h" #include "imgui_impl_vulkan.h" #include "imgui_impl_glfw.h" class GUIModule { public: static void init(RenderBackend* render_backend); static void shutdown(); static void beginFrame(); static void endFrame(); private: static void setDarkThemeColors(); };
13.72
49
0.749271
08824a4cc6f2288da3e0f611e0d0808135c6becc
3,787
h
C
include/Shapes.h
106598065/2017POSD_hw01
699c39b5db6ab589391e91a9fad63b3f8bbe35f1
[ "MIT" ]
null
null
null
include/Shapes.h
106598065/2017POSD_hw01
699c39b5db6ab589391e91a9fad63b3f8bbe35f1
[ "MIT" ]
null
null
null
include/Shapes.h
106598065/2017POSD_hw01
699c39b5db6ab589391e91a9fad63b3f8bbe35f1
[ "MIT" ]
null
null
null
#ifndef SHAPES_H_INCLUDED #define SHAPES_H_INCLUDED #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #include <vector> #include <string> #include <sstream> #include <math.h> #include <iostream> using namespace std; typedef struct Coordinate { double x; double y; }vertex; double distanceOfVertexs(const vertex vertex_1, const vertex vertex_2); /*{ double distance=sqrt(pow((vertex_1.x - vertex_2.x),2)+pow((vertex_1.y - vertex_2.y),2)); return distance; }*/ class Shape { public: std::string name = "Shape"; Shape(std::string shapeName):name(shapeName){} std::string getShapeName(){ return name; } void setShapeName(std::string shapeName){ name = shapeName; } virtual double area() const = 0; virtual double perimeter() const = 0; virtual std::string toString() const = 0; }; class Rectangle : public Shape { private: double x,y,l,w; public: Rectangle(double ulcx, double ulcy, double length, double width, std::string name = "r"): Shape(name), x(ulcx), y(ulcy), l(length), w(width){} double area() const {return l*w;} double perimeter() const {return (2*l)+(2*w);} std::string toString() const { std::stringstream ss; ss << name << "(" << x << " " << y << " " << l << " " << w << ")"; return ss.str(); } }; class Circle : public Shape{ private: double cx,cy,r; public: Circle(double centerX, double centerY, double radius, std::string name = "c"): Shape(name), cx(centerX), cy(centerY), r(radius){} double area() const {return M_PI*r*r;} double perimeter() const {return M_PI*r*2;} std::string toString() const { std::stringstream ss; ss << name << "(" << cx << " " << cy << " " << r << ")"; return ss.str(); } }; class Triangle : public Shape { private: vertex v1; vertex v2; vertex v3; public: Triangle(vertex vertex_A, vertex vertex_B, vertex vertex_C, std::string name = "t"): Shape(name), v1(vertex_A), v2(vertex_B), v3(vertex_C) { if(isTriangle(vertex_A, vertex_B, vertex_C) == false)cout<<"It's not a triangle."; //throw std::string("It's not a triangle."); } static bool isTriangle(vertex vertex_A, vertex vertex_B, vertex vertex_C){ double a = distanceOfVertexs(vertex_A, vertex_B); double b = distanceOfVertexs(vertex_A, vertex_C); double c = distanceOfVertexs(vertex_B, vertex_C); //cout << "distance a = "<< a <<endl; //cout << "distance b = "<< b <<endl; //cout << "distance c = "<< c <<endl; if((a+b)>c && (a+c)>b && (b+c)>a) return true; return false; } double area() const { double area; double a,b,c,s; a = distanceOfVertexs(v1, v2); b = distanceOfVertexs(v2, v3); c = distanceOfVertexs(v1, v3); s = (a + b + c)/(double)2; area = sqrt(s * (s-a) * (s-b) * (s-c)); //cout <<"t.area() = "<< area << endl; return area; } double perimeter() const { double sumOfLenghts; sumOfLenghts = distanceOfVertexs(v1, v2) + distanceOfVertexs(v2, v3) + distanceOfVertexs(v1, v3); return sumOfLenghts; } std::string toString() const { std::stringstream ss; ss << name << "(" << v1.x << " " << v1.y << " " << v2.x << " " << v2.y << " " << v3.x << " " << v3.y << ")"; return ss.str(); } }; double sumOfArea(const std::vector<Shape *> & shapes); double sumOfPerimeter(const std::vector<Shape *> & shapes); Shape* theLargestArea(const std::vector<Shape *> & shapes); void sortByDecreasingPerimeter(std::vector<Shape *> & shapes); #endif // SHAPES_H_INCLUDED
22.146199
116
0.576182
088454ee2088f21151ecfda799c2670f65768167
1,265
h
C
1.0/src/transc/pktprc/tcpktiorx.h
concurrentlabs/laguna
d8036889885217881da686eb54bf8419e06d8ce4
[ "Apache-2.0" ]
31
2015-10-09T16:04:10.000Z
2020-12-28T12:18:26.000Z
1.0/src/transc/pktprc/tcpktiorx.h
concurrentlabs/laguna
d8036889885217881da686eb54bf8419e06d8ce4
[ "Apache-2.0" ]
1
2015-11-04T16:23:22.000Z
2015-11-04T16:23:22.000Z
1.0/src/transc/pktprc/tcpktiorx.h
concurrentlabs/laguna
d8036889885217881da686eb54bf8419e06d8ce4
[ "Apache-2.0" ]
11
2015-11-09T21:33:30.000Z
2019-09-04T14:41:28.000Z
/* Copyright 2015 Concurrent Computer Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #ifndef TCPKTIORX_H #define TCPKTIORX_H #ifdef __cplusplus extern "C" { #endif CCUR_PROTECTED(tresult_t) tcPktIORxMonIntfOpen( tc_pktprc_thread_ctxt_t* pCntx); CCUR_PROTECTED(void) tcPktIORxMonIntfClose( tc_pktprc_thread_ctxt_t* pCntx); CCUR_PROTECTED(CHAR*) tcPktIORxMonIntfGetStat( tc_pktprc_thread_ctxt_t* pCntx, CHAR* strBuff, U32 nstrBuff); CCUR_PROTECTED(tresult_t) tcPktIORxMonIntfFromWire( tc_pktprc_thread_ctxt_t* pCntx); CCUR_PROTECTED(BOOL) tcPktIORxMonIntfIsLinkUp( tc_pktprc_thread_ctxt_t * pCntx); #ifdef __cplusplus } #endif #endif
25.3
74
0.727273
0884741c5c73f64238434d325abb354b87c09f68
85
c
C
glibc-2.21/sysdeps/m68k/m680x0/fpu/e_coshf.c
LinuxUser404/smack-glibc
75137ec47348317a8dbb431774b74dbb7bd2ec4f
[ "MIT" ]
47
2015-03-10T23:21:52.000Z
2022-02-17T01:04:14.000Z
include/sysdeps/m68k/m680x0/fpu/e_coshf.c
DalavanCloud/libucresolv
04a4827aa44c47556f425a4eed5e0ab4a5c0d25a
[ "Apache-2.0" ]
3
2019-07-12T00:44:18.000Z
2020-12-07T17:32:23.000Z
include/sysdeps/m68k/m680x0/fpu/e_coshf.c
DalavanCloud/libucresolv
04a4827aa44c47556f425a4eed5e0ab4a5c0d25a
[ "Apache-2.0" ]
19
2015-02-25T19:50:05.000Z
2021-10-05T14:35:54.000Z
#define FUNC __ieee754_coshf #define FUNC_FINITE __coshf_finite #include <e_acosf.c>
21.25
34
0.835294
0884fe8c1343395abb8a043f0ab316246f0a1fd7
4,050
h
C
ports/nrf/common-hal/_bleio/bonding.h
Neradoc/circuitpython
932131b4ff4b95066a872b5b299a84e80b7c45d3
[ "MIT", "BSD-3-Clause", "MIT-0", "Unlicense" ]
5
2019-02-09T05:20:23.000Z
2021-08-09T04:46:44.000Z
ports/nrf/common-hal/_bleio/bonding.h
Neradoc/circuitpython
932131b4ff4b95066a872b5b299a84e80b7c45d3
[ "MIT", "BSD-3-Clause", "MIT-0", "Unlicense" ]
2
2020-11-10T19:09:03.000Z
2021-08-24T07:41:50.000Z
ports/nrf/common-hal/_bleio/bonding.h
Neradoc/circuitpython
932131b4ff4b95066a872b5b299a84e80b7c45d3
[ "MIT", "BSD-3-Clause", "MIT-0", "Unlicense" ]
2
2019-12-09T11:34:05.000Z
2020-01-11T13:06:27.000Z
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2019 Dan Halbert for Adafruit Industries * * 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 MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_BONDING_H #define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_BONDING_H #include <stdint.h> #include <stdio.h> #include <string.h> #include "ble.h" #include "ble_drv.h" #include "common-hal/_bleio/__init__.h" #define EDIV_INVALID (0xffff) #define BONDING_DEBUG (1) #if BONDING_DEBUG #define BONDING_DEBUG_PRINTF(...) printf(__VA_ARGS__) #define BONDING_DEBUG_PRINT_BLOCK(block) bonding_print_block(block) #define BONDING_DEBUG_PRINT_KEYS(keys) bonding_print_keys(keys) #else #define BONDING_DEBUG_PRINTF(...) #define BONDING_DEBUG_PRINT_BLOCK(block) #define BONDING_DEBUG_PRINT_KEYS(keys) #endif // Bonding data is stored in variable-length blocks consecutively in // erased flash (all 1's). The blocks are 32-bit aligned, though the // data may be any number of bytes. We hop through the blocks using // the size field to find the next block. When we hit a word that is // all 1's, we have reached the end of the blocks. We can write a new // block there. typedef enum { BLOCK_INVALID = 0, // Ignore this block BLOCK_KEYS = 1, // Block contains bonding keys. BLOCK_SYS_ATTR = 2, // Block contains sys_attr values (CCCD settings, etc.). BLOCK_UNUSED = 0xff, // Initial erased value. } bonding_block_type_t; typedef struct { bool is_central : 1; // 1 if data is for a central role. uint16_t reserved : 7; // Not currently used bonding_block_type_t type : 8; // What kind of data is stored in. uint16_t ediv; // ediv value; used as a lookup key. uint16_t conn_handle; // Connection handle: used when a BLOCK_SYS_ATTR is queued to write. // Not used as a key, etc. uint16_t data_length; // Length of data in bytes, including ediv, not including padding. // End of block header. 32-bit boundary here. uint8_t data[]; // Rest of data in the block. Needs to be 32-bit aligned. // Block is padded to 32-bit alignment. } bonding_block_t; void bonding_background(void); void bonding_erase_storage(void); void bonding_reset(void); void bonding_clear_keys(bonding_keys_t *bonding_keys); bool bonding_load_cccd_info(bool is_central, uint16_t conn_handle, uint16_t ediv); bool bonding_load_keys(bool is_central, uint16_t ediv, bonding_keys_t *bonding_keys); const ble_gap_enc_key_t *bonding_load_peer_encryption_key(bool is_central, const ble_gap_addr_t *peer); size_t bonding_load_identities(bool is_central, const ble_gap_id_key_t **keys, size_t max_length); size_t bonding_peripheral_bond_count(void); #if BONDING_DEBUG void bonding_print_block(bonding_block_t *); void bonding_print_keys(bonding_keys_t *); #endif #endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_BONDING_H
43.085106
103
0.742469
08850dbdf3eb5c610baebae7c177221be0e3af41
1,066
h
C
simulation/halsim_gui/src/main/native/include/GuiUtil.h
retrodaredevil/allwpilib
fac4e3fcfc03fee2749d1e929038abd2f51b5c04
[ "BSD-3-Clause" ]
2
2019-07-17T16:54:19.000Z
2020-10-27T14:45:24.000Z
simulation/halsim_gui/src/main/native/include/GuiUtil.h
retrodaredevil/allwpilib
fac4e3fcfc03fee2749d1e929038abd2f51b5c04
[ "BSD-3-Clause" ]
40
2018-09-01T22:49:33.000Z
2020-09-17T21:19:43.000Z
simulation/halsim_gui/src/main/native/include/GuiUtil.h
retrodaredevil/allwpilib
fac4e3fcfc03fee2749d1e929038abd2f51b5c04
[ "BSD-3-Clause" ]
2
2020-12-16T13:33:03.000Z
2020-12-18T13:39:11.000Z
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #pragma once #include <GL/gl3w.h> #include <imgui.h> #include <wpi/Twine.h> namespace halsimgui { bool LoadTextureFromFile(const wpi::Twine& filename, GLuint* out_texture, int* out_width, int* out_height); // get distance^2 between two ImVec's inline float GetDistSquared(const ImVec2& a, const ImVec2& b) { float deltaX = b.x - a.x; float deltaY = b.y - a.y; return deltaX * deltaX + deltaY * deltaY; } // maximize fit while preserving aspect ratio void MaxFit(ImVec2* min, ImVec2* max, float width, float height); } // namespace halsimgui
35.533333
80
0.527205
08852d591a0865ce46cdcb0235d1695999706bcc
4,065
h
C
RecoTauTag/RecoTau/interface/PFRecoTauClusterVariables.h
trackerpro/cmssw
3e05774a180a5f4cdc70b713bd711c23f9364765
[ "Apache-2.0" ]
1
2019-03-09T19:47:49.000Z
2019-03-09T19:47:49.000Z
RecoTauTag/RecoTau/interface/PFRecoTauClusterVariables.h
trackerpro/cmssw
3e05774a180a5f4cdc70b713bd711c23f9364765
[ "Apache-2.0" ]
null
null
null
RecoTauTag/RecoTau/interface/PFRecoTauClusterVariables.h
trackerpro/cmssw
3e05774a180a5f4cdc70b713bd711c23f9364765
[ "Apache-2.0" ]
1
2019-04-03T19:23:27.000Z
2019-04-03T19:23:27.000Z
#ifndef RecoTauTag_RecoTau_PFRecoTauClusterVariables_h #define RecoTauTag_RecoTau_PFRecoTauClusterVariables_h /** \class PFRecoTauClusterVariables * * A bunch of functions to return cluster variables used for the MVA based tau ID discrimation. * To allow the MVA based tau discrimination to be aplicable on miniAOD in addition to AOD * several of these functions need to be overloaded. * * \author Aruna Nayak, DESY * */ #include "DataFormats/TauReco/interface/PFTau.h" #include "DataFormats/PatCandidates/interface/Tau.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" namespace reco { namespace tau { /// return chi2 of the leading track ==> deprecated? <== float lead_track_chi2(const reco::PFTau& tau); /// return ratio of energy in ECAL over sum of energy in ECAL and HCAL float eratio(const reco::PFTau& tau); float eratio(const pat::Tau& tau); /// return sum of pt weighted values of distance to tau candidate for all pf photon candidates, /// which are associated to signal; depending on var the distance is in 0=:dr, 1=:deta, 2=:dphi float pt_weighted_dx(const reco::PFTau& tau, int mode = 0, int var = 0, int decaymode = -1); float pt_weighted_dx(const pat::Tau& tau, int mode = 0, int var = 0, int decaymode = -1); /// return sum of pt weighted values of dr relative to tau candidate for all pf photon candidates, /// which are associated to signal inline float pt_weighted_dr_signal(const reco::PFTau& tau, int dm) { return pt_weighted_dx(tau, 0, 0, dm); } inline float pt_weighted_dr_signal(const pat::Tau& tau, int dm) { return pt_weighted_dx(tau, 0, 0, dm); } /// return sum of pt weighted values of deta relative to tau candidate for all pf photon candidates, /// which are associated to signal inline float pt_weighted_deta_strip(const reco::PFTau& tau, int dm) { return pt_weighted_dx(tau, dm==10 ? 2 : 1, 1, dm); } inline float pt_weighted_deta_strip(const pat::Tau& tau, int dm) { return pt_weighted_dx(tau, dm==10 ? 2 : 1, 1, dm); } /// return sum of pt weighted values of dphi relative to tau candidate for all pf photon candidates, /// which are associated to signal inline float pt_weighted_dphi_strip(const reco::PFTau& tau, int dm) { return pt_weighted_dx(tau, dm==10 ? 2 : 1, 2, dm); } inline float pt_weighted_dphi_strip(const pat::Tau& tau, int dm) { return pt_weighted_dx(tau, dm==10 ? 2 : 1, 2, dm); } /// return sum of pt weighted values of dr relative to tau candidate for all pf photon candidates, /// which are inside an isolation conde but not associated to signal inline float pt_weighted_dr_iso(const reco::PFTau& tau, int dm) { return pt_weighted_dx(tau, 2, 0, dm); } inline float pt_weighted_dr_iso(const pat::Tau& tau, int dm) { return pt_weighted_dx(tau, 2, 0, dm); } /// return total number of pf photon candidates with pT>500 MeV, which are associated to signal unsigned int n_photons_total(const reco::PFTau& tau); unsigned int n_photons_total(const pat::Tau& tau); enum {kOldDMwoLT, kOldDMwLT, kNewDMwoLT, kNewDMwLT, kDBoldDMwLT, kDBnewDMwLT, kPWoldDMwLT, kPWnewDMwLT, kDBoldDMwLTwGJ, kDBnewDMwLTwGJ}; bool fillIsoMVARun2Inputs(float* mvaInput, const pat::Tau& tau, int mvaOpt, const std::string& nameCharged, const std::string& nameNeutral, const std::string& namePu, const std::string& nameOutside, const std::string& nameFootprint); }} // namespaces #endif
55.684932
181
0.622386
08859361d625101536fdd82ca50b1be2a9344d1a
1,280
h
C
System/Library/Frameworks/PhotosUI.framework/PUDoubleHeightHorizontalAlbumListGadgetLayout.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
1
2020-11-04T15:43:01.000Z
2020-11-04T15:43:01.000Z
System/Library/Frameworks/PhotosUI.framework/PUDoubleHeightHorizontalAlbumListGadgetLayout.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
System/Library/Frameworks/PhotosUI.framework/PUDoubleHeightHorizontalAlbumListGadgetLayout.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
/* * This header is generated by classdump-dyld 1.0 * on Monday, September 28, 2020 at 5:54:50 PM Mountain Standard Time * Operating System: Version 14.0 (Build 18A373) * Image Source: /System/Library/Frameworks/PhotosUI.framework/PhotosUI * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ #import <PhotosUI/PhotosUI-Structs.h> #import <PhotosUI/PUHorizontalAlbumListGadgetLayout.h> @class NSMutableDictionary; @interface PUDoubleHeightHorizontalAlbumListGadgetLayout : PUHorizontalAlbumListGadgetLayout { NSMutableDictionary* _layoutAttributesByIndexPath; } @property (nonatomic,readonly) NSMutableDictionary * layoutAttributesByIndexPath; //@synthesize layoutAttributesByIndexPath=_layoutAttributesByIndexPath - In the implementation block -(id)layoutAttributesForItemAtIndexPath:(id)arg1 ; -(void)invalidateLayout; -(id)layoutAttributesForElementsInRect:(CGRect)arg1 ; -(CGSize)collectionViewContentSize; -(BOOL)prefersPagingEnabled; -(id)initWithHorizontalLayoutDelegate:(id)arg1 ; -(NSMutableDictionary *)layoutAttributesByIndexPath; -(void)_adjustLayoutAttributes:(id)arg1 ; @end
41.290323
195
0.725781
0886aeb025594072f583cf14d27a637baba06439
1,118
h
C
YJOTC/View/XRP/communitySearch/XPBossActivityCheckedCell.h
XYGDeveloper/XRP
bd427020c66c1f2bfbc9a96b6f4926b1f83e5862
[ "MIT" ]
1
2019-04-24T07:42:23.000Z
2019-04-24T07:42:23.000Z
YJOTC/View/XRP/communitySearch/XPBossActivityCheckedCell.h
XYGDeveloper/XRP
bd427020c66c1f2bfbc9a96b6f4926b1f83e5862
[ "MIT" ]
null
null
null
YJOTC/View/XRP/communitySearch/XPBossActivityCheckedCell.h
XYGDeveloper/XRP
bd427020c66c1f2bfbc9a96b6f4926b1f83e5862
[ "MIT" ]
1
2020-05-21T22:04:33.000Z
2020-05-21T22:04:33.000Z
// // XPBossActivityCheckedCell.h // YJOTC // // Created by 周勇 on 2019/1/11. // Copyright © 2019年 前海. All rights reserved. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface XPBossActivityCheckedCell : UITableViewCell @property (weak, nonatomic) IBOutlet UIView *bgView; @property (weak, nonatomic) IBOutlet UIImageView *avatar; @property (weak, nonatomic) IBOutlet UILabel *nameLabel; @property (weak, nonatomic) IBOutlet UILabel *accountLabel; @property (weak, nonatomic) IBOutlet UILabel *idLabel; @property (weak, nonatomic) IBOutlet UILabel *statusLabel; @property (weak, nonatomic) IBOutlet UILabel *codeLabel; @property (weak, nonatomic) IBOutlet UILabel *votesLabel; @property (weak, nonatomic) IBOutlet UILabel *checkAccoutLabel; @property (weak, nonatomic) IBOutlet UILabel *checkerLabe; @property (weak, nonatomic) IBOutlet UILabel *levelLabel; /** 激活记录dic */ @property(nonatomic,strong)NSDictionary *dataDic; /** 我的社员共用此cell */ @property(nonatomic,assign)BOOL isMyMember; /** 我的社员dic */ @property(nonatomic,strong)NSDictionary *memberDic; @end NS_ASSUME_NONNULL_END
22.816327
63
0.761181
08883a9ac7acb8931001dc55d122bb3cb424d8f1
1,660
h
C
common/math/simplex.h
dfk789/CodenameInfinite
aeb88b954b65f6beca3fb221fe49459b75e7c15f
[ "BSD-4-Clause" ]
2
2015-01-02T13:11:04.000Z
2015-01-20T02:46:15.000Z
common/math/simplex.h
dfk789/CodenameInfinite
aeb88b954b65f6beca3fb221fe49459b75e7c15f
[ "BSD-4-Clause" ]
null
null
null
common/math/simplex.h
dfk789/CodenameInfinite
aeb88b954b65f6beca3fb221fe49459b75e7c15f
[ "BSD-4-Clause" ]
null
null
null
#ifndef _SIMPLEX_H #define _SIMPLEX_H #include <mtrand.h> class CSimplexNoise { public: CSimplexNoise(size_t iSeed); public: float Noise(float x, float y); private: inline float Grad(int hash, float x, float y) { int h = hash&7; float u = h<4?x:y; float v = h<4?y:x; return ((h&1)?-u:u) + ((h&2)? -2.0f*v : 2.0f*v); } inline float Fade(float t) { return t*t*t*(t*(t*6-15)+10); } inline int Floor(float x) { if (x >= 0) return (int)x; else return (int)x-1; } inline float Lerp(float t, float a, float b) { return a + t*(b-a); } private: unsigned char m_aiRand[512]; }; inline CSimplexNoise::CSimplexNoise(size_t iSeed) { mtsrand(iSeed); for (size_t i = 0; i < 256; i++) m_aiRand[i] = (unsigned char)(mtrand()%255); memcpy(&m_aiRand[256], &m_aiRand[0], 256); } inline float CSimplexNoise::Noise(float x, float y) { int ix0, iy0, ix1, iy1; float fx0, fy0, fx1, fy1; float s, t, nx0, nx1, n0, n1; ix0 = Floor(x); iy0 = Floor(y); fx0 = x - ix0; fy0 = y - iy0; fx1 = fx0 - 1.0f; fy1 = fy0 - 1.0f; ix1 = (ix0 + 1) & 0xff; iy1 = (iy0 + 1) & 0xff; ix0 = ix0 & 0xff; iy0 = iy0 & 0xff; t = Fade( fy0 ); s = Fade( fx0 ); nx0 = Grad(m_aiRand[ix0 + m_aiRand[iy0]], fx0, fy0); nx1 = Grad(m_aiRand[ix0 + m_aiRand[iy1]], fx0, fy1); n0 = Lerp( t, nx0, nx1 ); nx0 = Grad(m_aiRand[ix1 + m_aiRand[iy0]], fx1, fy0); nx1 = Grad(m_aiRand[ix1 + m_aiRand[iy1]], fx1, fy1); n1 = Lerp(t, nx0, nx1); return 0.507f * ( Lerp( s, n0, n1 ) ); } #endif
19.529412
57
0.536145
0888861e8c7b422e8ebe26bd457e5df0443961be
507
h
C
Example/M7AutoTracker/Models/M7ItemModel.h
DeveloperMan7/M7AutoTracker-iOS
d98f1c575a7ac6ad36032f6800680c71d5027139
[ "MIT" ]
2
2019-05-28T06:40:48.000Z
2019-07-05T07:31:19.000Z
Example/M7AutoTracker/Models/M7ItemModel.h
DeveloperMan7/M7AutoTracker-iOS
d98f1c575a7ac6ad36032f6800680c71d5027139
[ "MIT" ]
null
null
null
Example/M7AutoTracker/Models/M7ItemModel.h
DeveloperMan7/M7AutoTracker-iOS
d98f1c575a7ac6ad36032f6800680c71d5027139
[ "MIT" ]
null
null
null
// // M7ItemModel.h // M7AutoTracker_Example // // Created by DevMan7 on 2018/12/14. // Copyright © 2018年 yusipeng. All rights reserved. // #import <Foundation/Foundation.h> @interface M7ItemModel : NSObject @property (nonatomic, strong, readonly) NSString *title; @property (nonatomic, strong, readonly) NSString *intro; - (instancetype)initWithTitle:(NSString *)title intro:(NSString *)intro; - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; @end
22.043478
56
0.708087
088b1efab3da47aac3827e66204c20a7bf9cec1d
3,394
h
C
include/wlr/render/interface.h
apreiml/wlroots
fa477c77c47ea638626d4dcd52f4a3bedbda3fd2
[ "MIT" ]
1
2020-04-22T20:01:26.000Z
2020-04-22T20:01:26.000Z
include/wlr/render/interface.h
apreiml/wlroots
fa477c77c47ea638626d4dcd52f4a3bedbda3fd2
[ "MIT" ]
1
2020-04-22T20:02:43.000Z
2020-04-22T20:06:13.000Z
include/wlr/render/interface.h
apreiml/wlroots
fa477c77c47ea638626d4dcd52f4a3bedbda3fd2
[ "MIT" ]
null
null
null
/* * This an unstable interface of wlroots. No guarantees are made regarding the * future consistency of this API. */ #ifndef WLR_USE_UNSTABLE #error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" #endif #ifndef WLR_RENDER_INTERFACE_H #define WLR_RENDER_INTERFACE_H #include <wlr/config.h> #if !WLR_HAS_X11_BACKEND && !WLR_HAS_XWAYLAND && !defined MESA_EGL_NO_X11_HEADERS #define MESA_EGL_NO_X11_HEADERS #endif #include <EGL/egl.h> #include <EGL/eglext.h> #include <stdbool.h> #include <wayland-server-protocol.h> #include <wlr/render/wlr_renderer.h> #include <wlr/render/wlr_texture.h> #include <wlr/types/wlr_box.h> #include <wlr/types/wlr_output.h> #include <wlr/render/dmabuf.h> struct wlr_renderer_impl { void (*begin)(struct wlr_renderer *renderer, uint32_t width, uint32_t height); void (*end)(struct wlr_renderer *renderer); void (*clear)(struct wlr_renderer *renderer, const float color[static 4]); void (*scissor)(struct wlr_renderer *renderer, struct wlr_box *box); bool (*render_texture_with_matrix)(struct wlr_renderer *renderer, struct wlr_texture *texture, const float matrix[static 9], float alpha); void (*render_quad_with_matrix)(struct wlr_renderer *renderer, const float color[static 4], const float matrix[static 9]); void (*render_ellipse_with_matrix)(struct wlr_renderer *renderer, const float color[static 4], const float matrix[static 9]); const enum wl_shm_format *(*formats)( struct wlr_renderer *renderer, size_t *len); bool (*format_supported)(struct wlr_renderer *renderer, enum wl_shm_format fmt); bool (*resource_is_wl_drm_buffer)(struct wlr_renderer *renderer, struct wl_resource *resource); void (*wl_drm_buffer_get_size)(struct wlr_renderer *renderer, struct wl_resource *buffer, int *width, int *height); const struct wlr_drm_format_set *(*get_dmabuf_formats)( struct wlr_renderer *renderer); enum wl_shm_format (*preferred_read_format)(struct wlr_renderer *renderer); bool (*read_pixels)(struct wlr_renderer *renderer, enum wl_shm_format fmt, uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, void *data); struct wlr_texture *(*texture_from_pixels)(struct wlr_renderer *renderer, enum wl_shm_format fmt, uint32_t stride, uint32_t width, uint32_t height, const void *data); struct wlr_texture *(*texture_from_wl_drm)(struct wlr_renderer *renderer, struct wl_resource *data); struct wlr_texture *(*texture_from_dmabuf)(struct wlr_renderer *renderer, struct wlr_dmabuf_attributes *attribs); void (*destroy)(struct wlr_renderer *renderer); void (*init_wl_display)(struct wlr_renderer *renderer, struct wl_display *wl_display); }; void wlr_renderer_init(struct wlr_renderer *renderer, const struct wlr_renderer_impl *impl); struct wlr_texture_impl { void (*get_size)(struct wlr_texture *texture, int *width, int *height); bool (*is_opaque)(struct wlr_texture *texture); bool (*write_pixels)(struct wlr_texture *texture, uint32_t stride, uint32_t width, uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, const void *data); bool (*to_dmabuf)(struct wlr_texture *texture, struct wlr_dmabuf_attributes *attribs); void (*destroy)(struct wlr_texture *texture); }; void wlr_texture_init(struct wlr_texture *texture, const struct wlr_texture_impl *impl); #endif
39.011494
81
0.78079
088b34a699efe5d6d3aefb158229e9fb83d9a586
11,868
h
C
Class/include/hydrogen.h
amoradinejad/limHaloPT
302c139809ffa95a6e154a4268e4d48e4082cdf3
[ "MIT" ]
null
null
null
Class/include/hydrogen.h
amoradinejad/limHaloPT
302c139809ffa95a6e154a4268e4d48e4082cdf3
[ "MIT" ]
11
2022-02-17T14:55:17.000Z
2022-03-24T17:35:55.000Z
Class/include/hydrogen.h
amoradinejad/limHaloPT
302c139809ffa95a6e154a4268e4d48e4082cdf3
[ "MIT" ]
null
null
null
/*******************************************************************************************************/ /* HYREC-2: Hydrogen and Helium Recombination Code */ /* Written by Yacine Ali-Haimoud and Chris Hirata (2010-17) */ /* with contributions from Nanoom Lee (2020) */ /* */ /* hydrogen.h: all functions related to Hydrogen recombination */ /* */ /* Units used: cgs + eV (all temperatures in eV) */ /* */ /* Revision history: */ /* - January 2020 : - Added new mode, SWIFT */ /* - Two timestep parameters for FULL mode and other modes. */ /* - December 2014: - Accounts for additional energy injection */ /* - May 2012: - Using the photon distortion instead of absolute value of radiation field */ /* - Accounting for explicit dependence on alpha and m_e */ /* - Some definitions moved to header file history.h */ /* - January 2011: updated value of 2s--1s decay rate, */ /* changed temperature range for effective rates */ /* - Written November 2010. */ /********************************************************************************************************/ /* !!!!! Do NOT change any numbers below (except DLNA). They are not accuracy parameters !!!!! */ /* !!!!! If needed, only DLNA_HYREC or DLNA_SWIFT can be set to be a lower value for better accuracy !!!!! */ #ifndef __HYDROGEN__ #define __HYDROGEN__ #include "energy_injection.h" /* Definition of different recombination models */ #define PEEBLES 0 /* Peebles's effective three-level atom */ #define RECFAST 1 /* Effective three-level atom for hydrogen with fudge factor F = 1.14 */ #define EMLA2s2p 2 /* Correct EMLA model, with standard decay rates from 2s and 2p only (accounts for nmax = infinity, l-resolved) */ #define FULL 3 /* All radiative transfer effects included. Additional switches in header file hydrogen.h */ #define SWIFT 4 /* Fast calculation with fitting function which is calculated based on FULL mode */ /* When the probability of being ionized from n=2 becomes lower than PION_MAX, switch off radiative transfer calculation as it becomes irrelevant */ #define PION_MAX 1e-2 /****** CONSTANTS IN CGS + EV UNIT SYSTEM *******/ #define EI 13.598286071938324 /* Hydrogen ionization energy in eV, reduced mass, no relativistic corrections */ /* Energy differences between excited levels of hydrogen -- used often */ #define E21 10.198714553953742 #define E31 12.087365397278509 #define E41 12.748393192442178 #define E32 1.8886508433247664 #define E42 2.5496786384884356 #define hPc 1.239841874331e-04 /* hc in eV cm */ #define mH 0.93878299831e9 /* Hydrogen atom mass in eV/c^2 */ #define kBoltz 8.617343e-5 /* Boltzmann constant in eV/K */ #define L2s1s 8.2206 /* 2s -> 1s two-photon decay rate in s^{-1} (Labzowsky et al 2005) */ /************* EFFECTIVE MULTI LEVEL ATOM *******************/ /*** Effective rate tables and associated parameters ***/ #define ALPHA_FILE "Alpha_inf.dat" /* Effective recombination coefficients to 2s and 2p */ #define RR_FILE "R_inf.dat" /* Effective transfer rate R_{2p,2s} */ #define TR_MIN 0.004 /* Minimum Tr in eV */ #define TR_MAX 0.4 /* Maximum Tr in eV */ #define NTR 100 /* Number of Tr values */ #define T_RATIO_MIN 0.1 /* T_RATIO is min(Tm/Tr, Tr/Tm) */ #define T_RATIO_MAX 1.0 #define NTM 40 /************* CORRECTION FUNCTION AND ITS FIRST DERIVATIVE FOR SWIFT MODE *****/ #define FIT_FILE "fit_swift.dat" /* Correction function and first derivative for SWIFT mode */ #define DKK_SIZE 265 /*** Tables and parameters for radiative transfer calculation ***/ #define TWOG_FILE "two_photon_tables.dat" #define NSUBLYA 140 #define NSUBLYB 271 #define NVIRT 311 #define NDIFF 80 #define DLNA_HYREC 8.49e-5 /* Timestep for FULL mode. Maximum compatible with these tables is 8.49e-5 */ //#define DLNA_HYREC 2.e-6 /* Timestep used in FULL mode for SWIFT correction function calculation*/ #define DLNA_SWIFT 4.e-3 /* Timestep for any other mode.*/ #define SIZE_ErrorM 2048 #define SIZE_InputFile 512 /* Higher-resolution tables */ /* #define TWOG_FILE_CLASS "two_photon_tables_hires.dat" #define NSUBLYA 408 #define NSUBLYB 1323 #define NVIRT 1493 #define NDIFF 300 #define DLNA 1.e-7 */ /**** Structure containing all atomic data for hydrogen ****/ typedef struct { /* Tables of effective rates */ double logTR_tab[NTR]; double T_RATIO_tab[NTM]; double **logAlpha_tab[4]; double logR2p2s_tab[NTR]; double DlogTR, DT_RATIO; /* Tables of 2-photon rates */ double Eb_tab[NVIRT]; /* Energies of the virtual levels in eV */ double A1s_tab[NVIRT]; /* 3*A2p1s*phi(E)*DE */ double A2s_tab[NVIRT]; /* dLambda_2s/dE * DeltaE if E < Elya dK2s/dE * Delta E if E > Elya */ double A3s3d_tab[NVIRT]; /* (dLambda_3s/dE + 5*dLambda_3d/dE) * Delta E for E < ELyb, Raman scattering rate for E > ELyb */ double A4s4d_tab[NVIRT]; /* (dLambda_4s/dE + 5*dLambda_4d/dE) * Delta E */ } HYREC_ATOMIC; typedef struct { double *swift_func[5]; } FIT_FUNC; /**** Structure containing all radiative transfer tables ****/ typedef struct { double z0; // first redshift at which radiation fields are stored long iz_rad_0; double **Dfminus_hist; double **Dfnu_hist; double **Dfminus_Ly_hist; } RADIATION; /* Structure for HYREC-2 internal parameters */ typedef struct { double h; /* Hubble constant */ double T0; /* CMB temperature today in K*/ double obh2, ocbh2, odeh2, okh2, orh2, onuh2; /* density parameters */ double w0, wa; /* Dark energy equation of state parameters */ double Neff; /* total effective number of neutrinos (massive + massless) */ double Nur; /* number of massless neutrinos */ double Nmnu; /* number of massive neutrinos */ double mnu[3]; /* neutrino masses */ double fHe; /* Helium fraction by number */ double nH0; /* density of hydrogen today in cm^{-3} [Changed from m^{-3} in February 2015] */ double YHe; /* Helium fraction */ double fsR, meR; /* fine-structure constant alpha/alpha(today) and me/me(today) (Added April 2012)*/ double dlna, nz; INJ_PARAMS *inj_params; /* Structure containing all Energy-injection parameters */ } REC_COSMOPARAMS; /* Structure for HYREC-2 data */ typedef struct{ HYREC_ATOMIC *atomic; REC_COSMOPARAMS *cosmo; double zmax; double zmin; long int Nz; double *xe_output; double *Tm_output; int error; int quasi_eq; int loop_after_quasi; int Tm_evolve_implicit; char *error_message; char *path_to_hyrec; RADIATION *rad; FIT_FUNC *fit; } HYREC_DATA; /*********** EFFECTIVE 3-LEVEL A LA PEEBLES ***************/ double SAHA_FACT(double fsR, double meR); double LYA_FACT(double fsR, double meR); double L2s_rescaled(double fsR, double meR); void rescale_T(double *T, double fsR, double meR); double alphaB_PPB(double TM, double fsR, double meR); double rec_TLA_dxHIIdlna(REC_COSMOPARAMS *cosmo, double xe, double xHII, double nH, double H, double TM, double TR, double Fudge); void allocate_radiation(RADIATION *rad, long int Nz, int *error, char error_message[SIZE_ErrorM]); void free_radiation(RADIATION *rad); void allocate_and_read_atomic(HYREC_ATOMIC *atomic, int *error, char *path_to_hyrec, char error_message[SIZE_ErrorM]); void free_atomic(HYREC_ATOMIC *atomic); void allocate_and_read_fit(FIT_FUNC *fit, int *error, char *path_to_hyrec, char error_message[SIZE_ErrorM]); void free_fit(FIT_FUNC *fit); void interpolate_rates(double Alpha[2], double DAlpha[2], double Beta[2], double *R2p2s, double TR, double TM_TR, HYREC_ATOMIC *atomic, double fsR, double meR, int *error, char error_message[SIZE_ErrorM]); double rec_swift_hyrec_dxHIIdlna(HYREC_DATA *data, double xe, double xHII, double nH, double Hubble, double TM, double TR, double z); double rec_HMLA_dxHIIdlna(HYREC_DATA *data, double xe, double xHII, double nH, double H, double TM, double TR); void populate_Diffusion(double *Aup, double *Adn, double *A2p_up, double *A2p_dn, double TM, double Eb_tab[NVIRT], double A1s_tab[NVIRT]); void populateTS_2photon(double Trr[2][2], double *Trv[2], double *Tvr[2], double *Tvv[3], double sr[2], double sv[NVIRT], double Dtau[NVIRT], double xe, double xHII, double TM, double TR, double nH, double H, HYREC_ATOMIC *atomic, double Dfplus[NVIRT], double Dfplus_Ly[], double Alpha[2], double DAlpha[2], double Beta[2], double fsR, double meR, double exclya, int *error, char error_message[SIZE_ErrorM]); void solveTXeqB(double *diag, double *updiag, double *dndiag, double *X, double *B, unsigned N, int *error, char error_message[SIZE_ErrorM]); void solve_real_virt(double xr[2], double xv[NVIRT], double Trr[2][2], double *Trv[2], double *Tvr[2], double *Tvv[3], double sr[2], double sv[NVIRT], int *error, char error_message[SIZE_ErrorM]); double interp_Dfnu(double x0, double dx, double *ytab, unsigned int Nx, double x); void fplus_from_fminus(double fplus[NVIRT], double fplus_Ly[], double **Dfminus_hist, double **Dfminus_Ly_hist, double TR, double zstart, unsigned iz, double z, double Eb_tab[NVIRT]); double rec_HMLA_2photon_dxedlna(HYREC_DATA *data, double xe, double nH, double H, double TM, double TR, unsigned iz, double z); double rec_dxHIIdlna(HYREC_DATA *data, int model, double xe, double xHII, double nH, double H, double TM, double TR, unsigned iz, double z); /************ SWITCHES FOR RADIATIVE TRANSFER. ALL SWITCHES SET TO 1 ARE THE DEFAULT MODEL ************/ #define EFFECT_A 1 /* 2s-->1s stimulated two-photon decays and non-thermal absorptions */ #define EFFECT_B 1 /* Sub-Lyman alpha two-photon transitions 3s/3d<--> 1s and 4s/4d<-->1s */ #define EFFECT_C 1 /* Super-Lyman alpha two-photon transitions 3s/3d<--> 1s and 4s/4d<-->1s */ #define EFFECT_D 1 /* Raman scattering from 2s and 3s/3d */ #define DIFFUSION 1 /* Lyman alpha frequency diffusion */ #endif
50.935622
141
0.577688
088f5c91f1167df46daa900dd2db02c6ee08dfe6
468
c
C
nitan/quest/job/obj/jinduan.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
1
2019-03-27T07:25:16.000Z
2019-03-27T07:25:16.000Z
nitan/quest/job/obj/jinduan.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
null
null
null
nitan/quest/job/obj/jinduan.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
null
null
null
// jinduan.c #include <armor.h> #include <ansi.h> inherit CLOTH; void create() { set_name(HIY "錦緞" NOR, ({ "jinduan", "jin" })); set("long", "這是一件裝飾秀麗的錦緞。\n"); set_weight(10); if (clonep()) set_default_object(__FILE__); else { set("material", "cloth"); set("unit", "件"); set("armor_prop/armor", 1); set("value", 1); } setup(); }
20.347826
55
0.442308
08931b115b04d28bb74a0feca38902ba8ab64567
2,459
c
C
src/dt/idt.c
UmbertoSavoia/Kernel-from-scratch
7bd1a60ae9a9b4720935618a3d8b064355564b6c
[ "MIT" ]
null
null
null
src/dt/idt.c
UmbertoSavoia/Kernel-from-scratch
7bd1a60ae9a9b4720935618a3d8b064355564b6c
[ "MIT" ]
null
null
null
src/dt/idt.c
UmbertoSavoia/Kernel-from-scratch
7bd1a60ae9a9b4720935618a3d8b064355564b6c
[ "MIT" ]
null
null
null
#include "../../include/kernel.h" #include "../../include/libc.h" void schedule() {} void init_idt_desc(uint16 select, uint32 offset, uint16 type, struct idtdesc *desc) { desc->offset0_15 = (offset & 0xffff); desc->select = select; desc->type = type; desc->offset16_31 = (offset & 0xffff0000) >> 16; return; } void init_idt(void) { uint32 f[] = { (uint32)&_asm_exception_0, (uint32)&_asm_exception_1, (uint32)&_asm_exception_2, (uint32)&_asm_exception_3, (uint32)&_asm_exception_4, (uint32)&_asm_exception_5, (uint32)&_asm_exception_6, (uint32)&_asm_exception_7, (uint32)&_asm_exception_8, (uint32)&_asm_exception_9, (uint32)&_asm_exception_10, (uint32)&_asm_exception_11, (uint32)&_asm_exception_12, (uint32)&_asm_exception_13, (uint32)&_asm_exception_14, (uint32)&_asm_exception_15, (uint32)&_asm_exception_16, (uint32)&_asm_exception_17, (uint32)&_asm_exception_18, (uint32)&_asm_exception_19, }; /* Init IRD */ for (uint32 i = 0; i < IDTSIZE; ++i) init_idt_desc(0x08, (uint32)_asm_schedule, INTGATE, &kidt[i]); // Numeri 0 -> 31 sono per le eccezioni for (uint32 i = 0; i < 20; ++i) init_idt_desc(0x08, f[i], INTGATE, &kidt[i]); // Numeri 32 -> 47 per IRQ init_idt_desc(0x08, (uint32) _asm_schedule, INTGATE, &kidt[32]); init_idt_desc(0x08, (uint32) _asm_irq_1, INTGATE, &kidt[33]); // Tastiera // Numeri 48 -> 255 per Syscall for (int i = 48; i < IDTSIZE; ++i) init_idt_desc(0x08, (uint32) _asm_syscalls, TRAPGATE, &kidt[i]); kidtr.limite = IDTSIZE * 8; kidtr.base = IDTBASE; // Sposto IDT memcpy((char *) kidtr.base, (char *) kidt, kidtr.limite); // Carico IDTR nella CPU asm("lidtl (kidtr)"); printf("[ #2OK#15 ] #14IDT#15 : Inizializzato\n"); } void init_pic(void) { /* Inizializzazione del ICW1 */ outb(0x20, 0x11); outb(0xA0, 0x11); /* Inizializzazione del ICW2 */ outb(0x21, 0x20); /* Inizio vettore = 32 */ outb(0xA1, 0x70); /* Inizio vettore = 96 */ /* Inizializzazione del ICW3 */ outb(0x21, 0x04); outb(0xA1, 0x02); /* Inizializzazione del ICW4 */ outb(0x21, 0x01); outb(0xA1, 0x01); /* Maschera gli Interrupt */ outb(0x21, 0x0); outb(0xA1, 0x0); printf("[ #2OK#15 ] #14PIC#15 : Inizializzato\n"); }
31.935065
124
0.607564
08932853fc08afaa2c7b6b39b7a13aa2b77a8130
6,046
c
C
base-usage/systemcall/farword_port.c
sczzq/symmetrical-spoon
aa0c27bb40a482789c7c6a7088307320a007b49b
[ "Unlicense" ]
null
null
null
base-usage/systemcall/farword_port.c
sczzq/symmetrical-spoon
aa0c27bb40a482789c7c6a7088307320a007b49b
[ "Unlicense" ]
null
null
null
base-usage/systemcall/farword_port.c
sczzq/symmetrical-spoon
aa0c27bb40a482789c7c6a7088307320a007b49b
[ "Unlicense" ]
null
null
null
/************************************************************************* > File Name: farword_port.c > Author: ziqiang > Mail: ziqiang_free@163.com > Created Time: Wed 24 May 2017 05:57:51 PM CST ************************************************************************/ #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <sys/time.h> #include <sys/types.h> #include <string.h> #include <signal.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> static int forward_port; #undef max #define max(x,y) ((x) > (y) ? (x) : (y)) static int listen_socket(int listen_port) { struct sockaddr_in addr; int lfd; int yes; lfd = socket(AF_INET, SOCK_STREAM, 0); if (lfd == -1) { perror("socket"); return -1; } yes = 1; if (setsockopt(lfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) == -1) { perror("setsockopt"); close(lfd); return -1; } memset(&addr, 0, sizeof(addr)); addr.sin_port = htons(listen_port); addr.sin_family = AF_INET; if (bind(lfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) { perror("bind"); close(lfd); return -1; } printf("accepting connections on port %d\n", listen_port); listen(lfd, 10); return lfd; } static int connect_socket(int connect_port, char *address) { struct sockaddr_in addr; int cfd; cfd = socket(AF_INET, SOCK_STREAM, 0); if (cfd == -1) { perror("socket"); return -1; } memset(&addr, 0, sizeof(addr)); addr.sin_port = htons(connect_port); addr.sin_family = AF_INET; if (!inet_aton(address, (struct in_addr *) &addr.sin_addr.s_addr)) { perror("bad IP address format"); close(cfd); return -1; } if (connect(cfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) { perror("connect()"); shutdown(cfd, SHUT_RDWR); close(cfd); return -1; } return cfd; } #define SHUT_FD1 do { \ if (fd1 >= 0) { \ shutdown(fd1, SHUT_RDWR); \ close(fd1); \ fd1 = -1; \ } \ } while (0) #define SHUT_FD2 do { \ if (fd2 >= 0) { \ shutdown(fd2, SHUT_RDWR); \ close(fd2); \ fd2 = -1; \ } \ } while (0) #define BUF_SIZE 1024 int main(int argc, char *argv[]) { int h; int fd1 = -1, fd2 = -1; char buf1[BUF_SIZE], buf2[BUF_SIZE]; int buf1_avail = 0, buf1_written = 0; int buf2_avail = 0, buf2_written = 0; if (argc != 4) { fprintf(stderr, "Usage\n\tfwd <listen-port> " "<forward-to-port> <forward-to-ip-address>\n"); exit(EXIT_FAILURE); } // ignore SIGPIPE. signal(SIGPIPE, SIG_IGN); forward_port = atoi(argv[2]); h = listen_socket(atoi(argv[1])); if (h == -1) exit(EXIT_FAILURE); for (;;) { int ready, nfds = 0; ssize_t nbytes; fd_set readfds, writefds, exceptfds; FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds); FD_SET(h, &readfds); nfds = max(nfds, h); if (fd1 > 0 && buf1_avail < BUF_SIZE) FD_SET(fd1, &readfds); /* Note: nfds is updated below, when fd1 is added to exceptfds. */ if (fd2 > 0 && buf2_avail < BUF_SIZE) FD_SET(fd2, &readfds); if (fd1 > 0 && buf2_avail - buf2_written > 0) FD_SET(fd1, &writefds); if (fd2 > 0 && buf1_avail - buf1_written > 0) FD_SET(fd2, &writefds); if (fd1 > 0) { FD_SET(fd1, &exceptfds); nfds = max(nfds, fd1); } if (fd2 > 0) { FD_SET(fd2, &exceptfds); nfds = max(nfds, fd2); } ready = select(nfds + 1, &readfds, &writefds, &exceptfds, NULL); if (ready == -1 && errno == EINTR) continue; if (ready == -1) { perror("select()"); exit(EXIT_FAILURE); } printf("FD_ISSET(%d, readfds)=%d\n", h, FD_ISSET(h, &readfds)); if (FD_ISSET(h, &readfds)) { socklen_t addrlen; struct sockaddr_in client_addr; int fd; addrlen = sizeof(client_addr); memset(&client_addr, 0, addrlen); fd = accept(h, (struct sockaddr *) &client_addr, &addrlen); if (fd == -1) { perror("accept()"); } else { SHUT_FD1; SHUT_FD2; buf1_avail = buf1_written = 0; buf2_avail = buf2_written = 0; fd1 = fd; fd2 = connect_socket(forward_port, argv[3]); if (fd2 == -1) SHUT_FD1; else printf("connect from %s\n", inet_ntoa(client_addr.sin_addr)); /* Skip any events on the old, closed file descriptors. */ continue; } } /* NB: read OOB data before normal reads */ if (fd1 > 0 && FD_ISSET(fd1, &exceptfds)) { char c; nbytes = recv(fd1, &c, 1, MSG_OOB); if (nbytes < 1) SHUT_FD1; else send(fd2, &c, 1, MSG_OOB); } if (fd2 > 0 && FD_ISSET(fd2, &exceptfds)) { char c; nbytes = recv(fd2, &c, 1, MSG_OOB); if (nbytes < 1) SHUT_FD2; else send(fd1, &c, 1, MSG_OOB); } if (fd1 > 0 && FD_ISSET(fd1, &readfds)) { nbytes = read(fd1, buf1 + buf1_avail, BUF_SIZE - buf1_avail); if (nbytes < 1) SHUT_FD1; else buf1_avail += nbytes; } if (fd2 > 0 && FD_ISSET(fd2, &readfds)) { nbytes = read(fd2, buf2 + buf2_avail, BUF_SIZE - buf2_avail); if (nbytes < 1) SHUT_FD2; else buf2_avail += nbytes; } if (fd1 > 0 && FD_ISSET(fd1, &writefds) && buf2_avail > 0) { nbytes = write(fd1, buf2 + buf2_written, buf2_avail - buf2_written); if (nbytes < 1) SHUT_FD1; else buf2_written += nbytes; } if (fd2 > 0 && FD_ISSET(fd2, &writefds) && buf1_avail > 0) { nbytes = write(fd2, buf1 + buf1_written, buf1_avail - buf1_written); if (nbytes < 1) SHUT_FD2; else buf1_written += nbytes; } /* Check if write data has caught read data */ if (buf1_written == buf1_avail) buf1_written = buf1_avail = 0; if (buf2_written == buf2_avail) buf2_written = buf2_avail = 0; /* One side has closed the connection, keep writing to the other side until empty */ if (fd1 < 0 && buf1_avail - buf1_written == 0) SHUT_FD2; if (fd2 < 0 && buf2_avail - buf2_written == 0) SHUT_FD1; } exit(EXIT_SUCCESS); }
21.985455
74
0.571121
ec4eb49c16938a28b438282353e5194bc2592688
9,189
c
C
linux-lts-quantal-3.5.0/arch/arm/mach-shmobile/setup-r8a7740.c
huhong789/shortcut
bce8a64c4d99b3dca72ffa0a04c9f3485cbab13a
[ "BSD-2-Clause" ]
47
2015-03-10T23:21:52.000Z
2022-02-17T01:04:14.000Z
linux-lts-quantal-3.5.0/arch/arm/mach-shmobile/setup-r8a7740.c
shortcut-sosp19/shortcut
f0ff3d9170dbc6de38e0d8c200db056aa26b9c48
[ "BSD-2-Clause" ]
1
2020-06-30T18:01:37.000Z
2020-06-30T18:01:37.000Z
linux-lts-quantal-3.5.0/arch/arm/mach-shmobile/setup-r8a7740.c
shortcut-sosp19/shortcut
f0ff3d9170dbc6de38e0d8c200db056aa26b9c48
[ "BSD-2-Clause" ]
19
2015-02-25T19:50:05.000Z
2021-10-05T14:35:54.000Z
/* * R8A7740 processor support * * Copyright (C) 2011 Renesas Solutions Corp. * Copyright (C) 2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.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 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <linux/delay.h> #include <linux/dma-mapping.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> #include <linux/platform_device.h> #include <linux/serial_sci.h> #include <linux/sh_timer.h> #include <mach/r8a7740.h> #include <mach/common.h> #include <mach/irqs.h> #include <asm/mach-types.h> #include <asm/mach/map.h> #include <asm/mach/arch.h> #include <asm/mach/time.h> static struct map_desc r8a7740_io_desc[] __initdata = { /* * for CPGA/INTC/PFC * 0xe6000000-0xefffffff -> 0xe6000000-0xefffffff */ { .virtual = 0xe6000000, .pfn = __phys_to_pfn(0xe6000000), .length = 160 << 20, .type = MT_DEVICE_NONSHARED }, #ifdef CONFIG_CACHE_L2X0 /* * for l2x0_init() * 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000 */ { .virtual = 0xf0002000, .pfn = __phys_to_pfn(0xf0100000), .length = PAGE_SIZE, .type = MT_DEVICE_NONSHARED }, #endif }; void __init r8a7740_map_io(void) { iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc)); /* * DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't * enough to allocate the frame buffer memory. */ init_consistent_dma_size(12 << 20); } /* SCIFA0 */ static struct plat_sci_port scif0_platform_data = { .mapbase = 0xe6c40000, .flags = UPF_BOOT_AUTOCONF, .scscr = SCSCR_RE | SCSCR_TE, .scbrr_algo_id = SCBRR_ALGO_4, .type = PORT_SCIFA, .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c00)), }; static struct platform_device scif0_device = { .name = "sh-sci", .id = 0, .dev = { .platform_data = &scif0_platform_data, }, }; /* SCIFA1 */ static struct plat_sci_port scif1_platform_data = { .mapbase = 0xe6c50000, .flags = UPF_BOOT_AUTOCONF, .scscr = SCSCR_RE | SCSCR_TE, .scbrr_algo_id = SCBRR_ALGO_4, .type = PORT_SCIFA, .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c20)), }; static struct platform_device scif1_device = { .name = "sh-sci", .id = 1, .dev = { .platform_data = &scif1_platform_data, }, }; /* SCIFA2 */ static struct plat_sci_port scif2_platform_data = { .mapbase = 0xe6c60000, .flags = UPF_BOOT_AUTOCONF, .scscr = SCSCR_RE | SCSCR_TE, .scbrr_algo_id = SCBRR_ALGO_4, .type = PORT_SCIFA, .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c40)), }; static struct platform_device scif2_device = { .name = "sh-sci", .id = 2, .dev = { .platform_data = &scif2_platform_data, }, }; /* SCIFA3 */ static struct plat_sci_port scif3_platform_data = { .mapbase = 0xe6c70000, .flags = UPF_BOOT_AUTOCONF, .scscr = SCSCR_RE | SCSCR_TE, .scbrr_algo_id = SCBRR_ALGO_4, .type = PORT_SCIFA, .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c60)), }; static struct platform_device scif3_device = { .name = "sh-sci", .id = 3, .dev = { .platform_data = &scif3_platform_data, }, }; /* SCIFA4 */ static struct plat_sci_port scif4_platform_data = { .mapbase = 0xe6c80000, .flags = UPF_BOOT_AUTOCONF, .scscr = SCSCR_RE | SCSCR_TE, .scbrr_algo_id = SCBRR_ALGO_4, .type = PORT_SCIFA, .irqs = SCIx_IRQ_MUXED(evt2irq(0x0d20)), }; static struct platform_device scif4_device = { .name = "sh-sci", .id = 4, .dev = { .platform_data = &scif4_platform_data, }, }; /* SCIFA5 */ static struct plat_sci_port scif5_platform_data = { .mapbase = 0xe6cb0000, .flags = UPF_BOOT_AUTOCONF, .scscr = SCSCR_RE | SCSCR_TE, .scbrr_algo_id = SCBRR_ALGO_4, .type = PORT_SCIFA, .irqs = SCIx_IRQ_MUXED(evt2irq(0x0d40)), }; static struct platform_device scif5_device = { .name = "sh-sci", .id = 5, .dev = { .platform_data = &scif5_platform_data, }, }; /* SCIFA6 */ static struct plat_sci_port scif6_platform_data = { .mapbase = 0xe6cc0000, .flags = UPF_BOOT_AUTOCONF, .scscr = SCSCR_RE | SCSCR_TE, .scbrr_algo_id = SCBRR_ALGO_4, .type = PORT_SCIFA, .irqs = SCIx_IRQ_MUXED(evt2irq(0x04c0)), }; static struct platform_device scif6_device = { .name = "sh-sci", .id = 6, .dev = { .platform_data = &scif6_platform_data, }, }; /* SCIFA7 */ static struct plat_sci_port scif7_platform_data = { .mapbase = 0xe6cd0000, .flags = UPF_BOOT_AUTOCONF, .scscr = SCSCR_RE | SCSCR_TE, .scbrr_algo_id = SCBRR_ALGO_4, .type = PORT_SCIFA, .irqs = SCIx_IRQ_MUXED(evt2irq(0x04e0)), }; static struct platform_device scif7_device = { .name = "sh-sci", .id = 7, .dev = { .platform_data = &scif7_platform_data, }, }; /* SCIFB */ static struct plat_sci_port scifb_platform_data = { .mapbase = 0xe6c30000, .flags = UPF_BOOT_AUTOCONF, .scscr = SCSCR_RE | SCSCR_TE, .scbrr_algo_id = SCBRR_ALGO_4, .type = PORT_SCIFB, .irqs = SCIx_IRQ_MUXED(evt2irq(0x0d60)), }; static struct platform_device scifb_device = { .name = "sh-sci", .id = 8, .dev = { .platform_data = &scifb_platform_data, }, }; /* CMT */ static struct sh_timer_config cmt10_platform_data = { .name = "CMT10", .channel_offset = 0x10, .timer_bit = 0, .clockevent_rating = 125, .clocksource_rating = 125, }; static struct resource cmt10_resources[] = { [0] = { .name = "CMT10", .start = 0xe6138010, .end = 0xe613801b, .flags = IORESOURCE_MEM, }, [1] = { .start = evt2irq(0x0b00), .flags = IORESOURCE_IRQ, }, }; static struct platform_device cmt10_device = { .name = "sh_cmt", .id = 10, .dev = { .platform_data = &cmt10_platform_data, }, .resource = cmt10_resources, .num_resources = ARRAY_SIZE(cmt10_resources), }; static struct platform_device *r8a7740_early_devices[] __initdata = { &scif0_device, &scif1_device, &scif2_device, &scif3_device, &scif4_device, &scif5_device, &scif6_device, &scif7_device, &scifb_device, &cmt10_device, }; /* I2C */ static struct resource i2c0_resources[] = { [0] = { .name = "IIC0", .start = 0xfff20000, .end = 0xfff20425 - 1, .flags = IORESOURCE_MEM, }, [1] = { .start = intcs_evt2irq(0xe00), .end = intcs_evt2irq(0xe60), .flags = IORESOURCE_IRQ, }, }; static struct resource i2c1_resources[] = { [0] = { .name = "IIC1", .start = 0xe6c20000, .end = 0xe6c20425 - 1, .flags = IORESOURCE_MEM, }, [1] = { .start = evt2irq(0x780), /* IIC1_ALI1 */ .end = evt2irq(0x7e0), /* IIC1_DTEI1 */ .flags = IORESOURCE_IRQ, }, }; static struct platform_device i2c0_device = { .name = "i2c-sh_mobile", .id = 0, .resource = i2c0_resources, .num_resources = ARRAY_SIZE(i2c0_resources), }; static struct platform_device i2c1_device = { .name = "i2c-sh_mobile", .id = 1, .resource = i2c1_resources, .num_resources = ARRAY_SIZE(i2c1_resources), }; static struct platform_device *r8a7740_late_devices[] __initdata = { &i2c0_device, &i2c1_device, }; #define ICCR 0x0004 #define ICSTART 0x0070 #define i2c_read(reg, offset) ioread8(reg + offset) #define i2c_write(reg, offset, data) iowrite8(data, reg + offset) /* * r8a7740 chip has lasting errata on I2C I/O pad reset. * this is work-around for it. */ static void r8a7740_i2c_workaround(struct platform_device *pdev) { struct resource *res; void __iomem *reg; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (unlikely(!res)) { pr_err("r8a7740 i2c workaround fail (cannot find resource)\n"); return; } reg = ioremap(res->start, resource_size(res)); if (unlikely(!reg)) { pr_err("r8a7740 i2c workaround fail (cannot map IO)\n"); return; } i2c_write(reg, ICCR, i2c_read(reg, ICCR) | 0x80); i2c_read(reg, ICCR); /* dummy read */ i2c_write(reg, ICSTART, i2c_read(reg, ICSTART) | 0x10); i2c_read(reg, ICSTART); /* dummy read */ udelay(10); i2c_write(reg, ICCR, 0x01); i2c_write(reg, ICSTART, 0x00); udelay(10); i2c_write(reg, ICCR, 0x10); udelay(10); i2c_write(reg, ICCR, 0x00); udelay(10); i2c_write(reg, ICCR, 0x10); udelay(10); iounmap(reg); } void __init r8a7740_add_standard_devices(void) { /* I2C work-around */ r8a7740_i2c_workaround(&i2c0_device); r8a7740_i2c_workaround(&i2c1_device); platform_add_devices(r8a7740_early_devices, ARRAY_SIZE(r8a7740_early_devices)); platform_add_devices(r8a7740_late_devices, ARRAY_SIZE(r8a7740_late_devices)); } static void __init r8a7740_earlytimer_init(void) { r8a7740_clock_init(0); shmobile_earlytimer_init(); } void __init r8a7740_add_early_devices(void) { early_platform_add_devices(r8a7740_early_devices, ARRAY_SIZE(r8a7740_early_devices)); /* setup early console here as well */ shmobile_setup_console(); /* override timer setup with soc-specific code */ shmobile_timer.init = r8a7740_earlytimer_init; }
22.633005
77
0.697029
ec4f064d8d7c993c9420204aa8febc438b144e6c
269
h
C
Example/QCUtility/QCAppDelegate.h
qichen0401/QCUtility
f04f3c6bdb9e2721db33dbd8d791efaf09f0e91f
[ "MIT" ]
null
null
null
Example/QCUtility/QCAppDelegate.h
qichen0401/QCUtility
f04f3c6bdb9e2721db33dbd8d791efaf09f0e91f
[ "MIT" ]
null
null
null
Example/QCUtility/QCAppDelegate.h
qichen0401/QCUtility
f04f3c6bdb9e2721db33dbd8d791efaf09f0e91f
[ "MIT" ]
null
null
null
// // QCAppDelegate.h // QCUtility // // Created by Qi Chen on 11/29/2016. // Copyright (c) 2016 Qi Chen. All rights reserved. // @import UIKit; @interface QCAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
16.8125
62
0.70632
ec50d1f06eb266d8a9c61b4faeba23ec33f21254
5,541
h
C
core-6.31/reorder.h
bauman/clips-rules-rebuild
427a44b7c9641e5c24ca516034c942375bdf2a74
[ "BSD-3-Clause" ]
2
2020-06-02T23:43:22.000Z
2021-12-30T21:00:00.000Z
core-6.31/reorder.h
bauman/clips-rules-rebuild
427a44b7c9641e5c24ca516034c942375bdf2a74
[ "BSD-3-Clause" ]
null
null
null
core-6.31/reorder.h
bauman/clips-rules-rebuild
427a44b7c9641e5c24ca516034c942375bdf2a74
[ "BSD-3-Clause" ]
1
2020-06-02T23:43:25.000Z
2020-06-02T23:43:25.000Z
/*******************************************************/ /* "C" Language Integrated Production System */ /* */ /* CLIPS Version 6.31 07/09/15 */ /* */ /* REORDER HEADER FILE */ /*******************************************************/ /*************************************************************/ /* Purpose: Provides routines necessary for converting the */ /* the LHS of a rule into an appropriate form suitable for */ /* the KB Rete topology. This includes transforming the */ /* LHS so there is at most one "or" CE (and this is the */ /* first CE of the LHS if it is used), adding initial */ /* patterns to the LHS (if no LHS is specified or a "test" */ /* or "not" CE is the first pattern within an "and" CE), */ /* removing redundant CEs, and determining appropriate */ /* information on nesting for implementing joins from the */ /* right. */ /* */ /* Principal Programmer(s): */ /* Gary D. Riley */ /* */ /* Contributing Programmer(s): */ /* */ /* Revision History: */ /* */ /* 6.30: Support for join network changes. */ /* */ /* Changes to the algorithm for processing */ /* not/and CE groups. */ /* */ /* Additional optimizations for combining */ /* conditional elements. */ /* */ /* Added support for hashed alpha memories. */ /* */ /* 6.31: Removed the marked flag used for not/and */ /* unification. */ /* */ /*************************************************************/ #ifndef _H_reorder #define _H_reorder struct lhsParseNode; #ifndef _H_expressn #include "expressn.h" #endif #ifndef _H_ruledef #include "ruledef.h" #endif #ifndef _H_pattern #include "pattern.h" #endif #ifdef LOCALE #undef LOCALE #endif #ifdef _REORDER_SOURCE_ #define LOCALE #else #define LOCALE extern #endif /***********************************************************************/ /* lhsParseNode structure: Stores information about the intermediate */ /* parsed representation of the lhs of a rule. */ /***********************************************************************/ struct lhsParseNode { unsigned short type; void *value; unsigned int negated : 1; unsigned int exists : 1; unsigned int existsNand : 1; unsigned int logical : 1; unsigned int multifieldSlot : 1; unsigned int bindingVariable : 1; unsigned int derivedConstraints : 1; unsigned int userCE : 1; unsigned int whichCE : 7; //unsigned int marked : 1; unsigned int withinMultifieldSlot : 1; unsigned short multiFieldsBefore; unsigned short multiFieldsAfter; unsigned short singleFieldsBefore; unsigned short singleFieldsAfter; struct constraintRecord *constraints; struct lhsParseNode *referringNode; struct patternParser *patternType; short pattern; short index; struct symbolHashNode *slot; short slotNumber; int beginNandDepth; int endNandDepth; int joinDepth; struct expr *networkTest; struct expr *externalNetworkTest; struct expr *secondaryNetworkTest; struct expr *externalLeftHash; struct expr *externalRightHash; struct expr *constantSelector; struct expr *constantValue; struct expr *leftHash; struct expr *rightHash; struct expr *betaHash; struct lhsParseNode *expression; struct lhsParseNode *secondaryExpression; void *userData; struct lhsParseNode *right; struct lhsParseNode *bottom; }; LOCALE struct lhsParseNode *ReorderPatterns(void *,struct lhsParseNode *,int *); LOCALE struct lhsParseNode *CopyLHSParseNodes(void *,struct lhsParseNode *); LOCALE void CopyLHSParseNode(void *,struct lhsParseNode *,struct lhsParseNode *,int); LOCALE struct lhsParseNode *GetLHSParseNode(void *); LOCALE void ReturnLHSParseNodes(void *,struct lhsParseNode *); LOCALE struct lhsParseNode *ExpressionToLHSParseNodes(void *,struct expr *); LOCALE struct expr *LHSParseNodesToExpression(void *,struct lhsParseNode *); LOCALE void AddInitialPatterns(void *,struct lhsParseNode *); LOCALE int IsExistsSubjoin(struct lhsParseNode *,int); LOCALE struct lhsParseNode *CombineLHSParseNodes(void *,struct lhsParseNode *,struct lhsParseNode *); //LOCALE void AssignPatternMarkedFlag(struct lhsParseNode *,short); #endif /* _H_reorder */
40.742647
114
0.490886
ec52b6abd94b5f381e18d72602671037c6c16747
1,444
h
C
PrivateFrameworks/RemoteManagement/RMCloudApp.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
17
2018-11-13T04:02:58.000Z
2022-01-20T09:27:13.000Z
PrivateFrameworks/RemoteManagement/RMCloudApp.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
3
2018-04-06T02:02:27.000Z
2018-10-02T01:12:10.000Z
PrivateFrameworks/RemoteManagement/RMCloudApp.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
1
2018-09-28T13:54:23.000Z
2018-09-28T13:54:23.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import <RemoteManagement/RMUniquedManagedObject.h> #import "RMReconcilableObject.h" @class NSData, NSDate, NSSet, NSString, NSURL, NSUUID, RMCloudCategory; @interface RMCloudApp : RMUniquedManagedObject <RMReconcilableObject> { } + (BOOL)reconcileWithManagedObjectContext:(id)arg1 andUpdateLosers:(id)arg2 error:(id *)arg3; + (id)createOrReturnAppWithBundleIdentifier:(id)arg1 inContext:(id)arg2 error:(id *)arg3; + (id)fetchRequest; - (id)computeUniqueIdentifier; @property(copy, nonatomic) NSString *bundleIdentifier; // @dynamic bundleIdentifier; // Remaining properties @property(copy, nonatomic) NSURL *artworkURL60; // @dynamic artworkURL60; @property(retain, nonatomic) RMCloudCategory *category; // @dynamic category; @property(copy, nonatomic) NSString *ckRecordID; // @dynamic ckRecordID; @property(retain, nonatomic) NSData *ckRecordSystemFields; // @dynamic ckRecordSystemFields; @property(copy, nonatomic) NSDate *currentVersionReleaseDate; // @dynamic currentVersionReleaseDate; @property(retain, nonatomic) NSSet *installedOnDevices; // @dynamic installedOnDevices; @property(copy, nonatomic) NSString *name; // @dynamic name; @property(copy, nonatomic) NSString *nameLanguageCode; // @dynamic nameLanguageCode; @property(copy, nonatomic) NSUUID *sortKey; // @dynamic sortKey; @end
40.111111
100
0.771468
ec5687d8bc87cff4cdefbed65f01cb0929bc7dd2
6,218
c
C
src/decode.c
zkingston/chiasm
f53bc46a1d9f2a80d46c6c0d869e01ad55943edb
[ "MIT" ]
null
null
null
src/decode.c
zkingston/chiasm
f53bc46a1d9f2a80d46c6c0d869e01ad55943edb
[ "MIT" ]
null
null
null
src/decode.c
zkingston/chiasm
f53bc46a1d9f2a80d46c6c0d869e01ad55943edb
[ "MIT" ]
null
null
null
#include <stdint.h> #include <stddef.h> #include <string.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <libavcodec/avcodec.h> #include <libavformat/avformat.h> #include <libswscale/swscale.h> #include <linux/videodev2.h> #include <chiasm.h> bool ch_codec_registered = false; inline uint32_t ch_calc_stride(struct ch_dl_cx *cx, uint32_t width, uint32_t alignment) { cx->b_per_pix = avpicture_get_size(cx->out_pixfmt, 1, 1); uint32_t stride = width * cx->b_per_pix; if ((stride % alignment) != 0) stride += alignment - (stride % alignment); return (stride); } int ch_init_plugin_out(struct ch_device *device, struct ch_dl_cx *cx) { cx->b_per_pix = avpicture_get_size(cx->out_pixfmt, 1, 1); // If the output stride was uninitialized by the plugin, use the width. if (cx->out_stride == 0) cx->out_stride = device->framesize.width * cx->b_per_pix; uint32_t length = cx->out_stride * device->framesize.height; size_t idx; for (idx = 0; idx < CH_DL_NUMBUF; idx++) { // Get size needed for output buffer. cx->out_buffer[idx].length = length; // Allocate output buffer. cx->out_buffer[idx].start = (uint8_t *) ch_calloc(length, sizeof(uint8_t)); if (cx->out_buffer[idx].start == NULL) goto clean; } if (device->calib) { device->calib->temp1 = (uint8_t *) ch_calloc(length, sizeof(uint8_t)); if (device->calib->temp1 == NULL) goto clean; device->calib->temp2 = (uint8_t *) ch_calloc(length, sizeof(uint8_t)); if (device->calib->temp2 == NULL) goto clean; } cx->frame_out = av_frame_alloc(); if (cx->frame_out == NULL) { ch_error("Failed to allocated output frame."); goto clean; } return (0); clean: ch_destroy_plugin_out(cx); return (-1); } void ch_destroy_plugin_out(struct ch_dl_cx *cx) { size_t idx; for (idx = 0; idx < CH_DL_NUMBUF; idx++) if (cx->out_buffer[idx].start) free(cx->out_buffer[idx].start); if (cx->frame_out) av_frame_free(&cx->frame_out); if (cx->sws_cx) sws_freeContext(cx->sws_cx); } int ch_init_decode_cx(struct ch_device *device, struct ch_decode_cx *cx) { // Register codecs so they can be found. if (!ch_codec_registered) { av_register_all(); ch_codec_registered = true; } AVCodec *codec = NULL; enum AVCodecID codec_id = AV_CODEC_ID_NONE; cx->codec_cx = NULL; // Setup I/O frames. cx->frame_in = av_frame_alloc(); if (cx->frame_in == NULL) goto clean; // Find codec ID based on input pixel format. switch (device->in_pixfmt) { case V4L2_PIX_FMT_YUYV: return (0); case V4L2_PIX_FMT_MJPEG: codec_id = AV_CODEC_ID_MJPEG; break; case V4L2_PIX_FMT_H264: codec_id = AV_CODEC_ID_H264; break; default: ch_error("Unsupported format."); return (-1); } // Find and allocate codec context. codec = avcodec_find_decoder(codec_id); if (codec == NULL) { ch_error("Failed to find requested codec."); return (-1); } cx->codec_cx = avcodec_alloc_context3(codec); if (cx->codec_cx == NULL) { ch_error("Failed to allocate codec context."); return (-1); } // For streaming codecs, specify that we might not be sending complete frames. if (codec->capabilities & CODEC_CAP_TRUNCATED) cx->codec_cx->flags |= CODEC_FLAG_TRUNCATED; cx->codec_cx->width = device->framesize.width; cx->codec_cx->height = device->framesize.height; if (avcodec_open2(cx->codec_cx, codec, NULL) < 0) { ch_error("Failed to open codec."); goto clean; } return (0); clean: ch_destroy_decode_cx(cx); return (-1); } void ch_destroy_decode_cx(struct ch_decode_cx *cx) { if (cx->frame_in) av_frame_free(&cx->frame_in); if (cx->codec_cx != NULL) { avcodec_close(cx->codec_cx); av_free(cx->codec_cx); } } int ch_decode(struct ch_device *device, struct ch_frmbuf *in_buf, struct ch_decode_cx *cx) { int finish = 0; // Uncompressed stream. if (device->in_pixfmt == V4L2_PIX_FMT_YUYV) { if (avpicture_fill((AVPicture *) cx->frame_in, in_buf->start, AV_PIX_FMT_YUYV422, device->framesize.width, device->framesize.height) < 0) { ch_error("Failed to setup output frame fields."); return (-1); } finish = 1; cx->in_pixfmt = AV_PIX_FMT_YUYV422; } else { // Initialize packet to use input buffer. AVPacket packet; av_init_packet(&packet); packet.data = in_buf->start; packet.size = in_buf->length; if (avcodec_decode_video2(cx->codec_cx, cx->frame_in, &finish, &packet) < 0) { ch_error("Failed decoding video."); av_free_packet(&packet); return (-1); } av_free_packet(&packet); cx->in_pixfmt = cx->codec_cx->pix_fmt; } return (finish); } int ch_output(struct ch_device *device, struct ch_decode_cx *decode, struct ch_dl_cx *cx) { uint32_t idx = (cx->select + 1) % CH_DL_NUMBUF; if (0 > avpicture_fill((AVPicture *) cx->frame_out, cx->out_buffer[idx].start, cx->out_pixfmt, cx->out_stride / cx->b_per_pix, device->framesize.height)) { ch_error("Failed to setup output frame fields."); return (-1); } if (cx->sws_cx == NULL) { cx->sws_cx = sws_getContext( device->framesize.width, device->framesize.height, decode->in_pixfmt, device->framesize.width, device->framesize.height, cx->out_pixfmt, SWS_BILINEAR, NULL, NULL, NULL ); if (cx->sws_cx == NULL) { ch_error("Failed to initialize SWS context."); return (-1); } } sws_scale( cx->sws_cx, (uint8_t const * const *) decode->frame_in->data, decode->frame_in->linesize, 0, device->framesize.height, cx->frame_out->data, cx->frame_out->linesize ); cx->nonce[idx] = cx->nonce[cx->select] + 1; return (0); }
23.915385
82
0.612416
ec57ce53e1d7d6fcf5704db9d3c48b360dde0536
1,643
h
C
JDScanDemo/Pods/Headers/Public/JDScan/JDScanViewController.h
CoderJasons/JDScan
87e497849cb0259c74b046368255f0ff2089db75
[ "MIT" ]
15
2019-07-19T06:14:15.000Z
2022-03-31T10:30:57.000Z
JDScanDemo/Pods/Headers/Public/JDScan/JDScanViewController.h
CoderJasons/JDScan
87e497849cb0259c74b046368255f0ff2089db75
[ "MIT" ]
null
null
null
JDScanDemo/Pods/Headers/Public/JDScan/JDScanViewController.h
CoderJasons/JDScan
87e497849cb0259c74b046368255f0ff2089db75
[ "MIT" ]
4
2020-01-06T02:32:26.000Z
2021-11-16T02:00:34.000Z
// // JDScanViewController.h // JDScanner // // Created by WJD on 19/4/3. // Copyright © 2019 年 WJD. All rights reserved. // #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "JDScanResult.h" #import "JDScanView.h" #import "JDScanner.h" /** 扫码结果delegate,也可通过继承本控制器,override方法scanResultWithArray即可 */ @protocol JDScanViewControllerDelegate <NSObject> @optional - (void)scanResultWithArray:(NSArray<JDScanResult*>*)array; @end @interface JDScanViewController : UIViewController<UIImagePickerControllerDelegate,UINavigationControllerDelegate> #pragma mark ---- 需要初始化参数 ------ //扫码结果委托,另外一种方案是通过继承本控制器,override方法scanResultWithArray即可 @property (nonatomic, weak) id<JDScanViewControllerDelegate> delegate; /** @brief 是否需要扫码图像 */ @property (nonatomic, assign) BOOL isNeedScanImage; /** @brief 启动区域识别功能,只扫描中间区域 */ @property(nonatomic, assign) BOOL onlyScanCenterRect; /** 相机启动提示,如 相机启动中... */ @property (nonatomic, copy) NSString *cameraWakeMessage; /** * 界面效果参数 */ @property (nonatomic, strong) JDScanViewStyle *style; #pragma mark ----- 扫码使用的库对象 ------- /** ZXing扫码对象 */ @property (nonatomic, strong, readonly) JDScanner *zxing; #pragma mark ---- 扫码界面效果及提示等 ------ /** @brief 扫码区域视图,二维码一般都是框 */ @property (nonatomic, strong, readonly) JDScanView *qRScanView; /** 隐藏灯光按钮 */ @property (nonatomic, assign) BOOL hiddenLightButton; @property (nonatomic, assign) BOOL fullWidthScan; /** 打开灯光按钮 */ @property (nonatomic, strong) UIButton *lightButton; //打开相册 - (void)openLocalPhoto:(BOOL)allowsEditing; //开启灯光 - (void)openOrClose:(UIButton *)btn; //启动扫描 - (void)start; //关闭扫描 - (void)stop; @end
18.885057
114
0.724893
ec5b0a0deb7120ea4d471431d7c105991d198c02
4,060
h
C
teleop_and_haptics/sss/Source/s_MyRendererTFEditor_TFE.h
atp42/jks-ros-pkg
367fc00f2a9699f33d05c7957d319a80337f1ed4
[ "FTL" ]
3
2017-02-02T13:27:45.000Z
2018-06-17T11:52:13.000Z
teleop_and_haptics/sss/Source/s_MyRendererTFEditor_TFE.h
salisbury-robotics/jks-ros-pkg
367fc00f2a9699f33d05c7957d319a80337f1ed4
[ "FTL" ]
null
null
null
teleop_and_haptics/sss/Source/s_MyRendererTFEditor_TFE.h
salisbury-robotics/jks-ros-pkg
367fc00f2a9699f33d05c7957d319a80337f1ed4
[ "FTL" ]
null
null
null
// -------------------------------------------------------------------------- // // Sonny Chan, Department of Computer Science, Stanford University // // Joseph Lee, Department of Otolaryngology, Stanford University // // -------------------------------------------------------------------------- // #ifndef MyRendererTFEditor_TFE_H #define MyRendererTFEditor_TFE_H // -------------------------------------------------------------------------- // #include <math.h> #include <vector> #include <algorithm> #include <QWidget> #include "Graphics/TransferFunction.h" // -------------------------------------------------------------------------- // struct TFEMarker { TFEMarker() { x = 0.0; color_left = QColor( 0, 0, 0, 0 ); color_right = QColor( 0, 0, 0, 0 ); b_iso = false; iso_index = 0; } TFEMarker( float x_value, QColor c_l, QColor c_r, bool iso, int ind ) { x = x_value; color_left = c_l; color_right = c_r; b_iso = iso; iso_index = ind; }; float x; bool b_iso; int iso_index; QColor color_left; QColor color_right; }; // data stream insertion and extraction operators for saving state of TFEMarker QDataStream & operator<< ( QDataStream &stream, const TFEMarker &marker ); QDataStream & operator>> ( QDataStream &stream, TFEMarker &marker ); // -------------------------------------------------------------------------- // class TFEMarkers { public: std::vector <TFEMarker> markers; TFEMarker * at( int ind ) { return & markers.at( ind ); } void addMarker( float x, QColor c_l, QColor c_r, bool iso = false, int ind = 0 ) { bool b_done = false; for( std::vector <TFEMarker>::iterator it = markers.begin(); !b_done; ) { if( x <= 0.0 || x >= 1.0 ) b_done = true; else if( it->x > x ) { markers.insert( it, TFEMarker( x, c_l, c_r, iso, ind ) ); b_done = true; } else it++; } } void delMarker( int index ) { markers.erase( markers.begin() + index ); } void initMarker( float x, QColor c_l, QColor c_r, bool iso = false, int ind = 0 ) { markers.push_back( TFEMarker( x, c_l, c_r, iso, ind ) ); } }; // data stream insertion and extraction operators for saving state of TFEMarkers QDataStream & operator<< ( QDataStream &stream, const TFEMarkers &markers ); QDataStream & operator>> ( QDataStream &stream, TFEMarkers &markers ); // -------------------------------------------------------------------------- // class MyRendererTFEditor_TFE : public QWidget { Q_OBJECT // TODO: NUM_VOLUMES should probably be defined elsewhere static const int NUM_VOLUMES = 1; public: MyRendererTFEditor_TFE( QWidget * parent = 0 ); // MessageLog * m_log; float m_isosurface_threshold[NUM_VOLUMES]; QColor m_isosurface_color[NUM_VOLUMES]; float m_display_min; float m_display_max; Qt::MouseButton m_mouse_button; unsigned char * m_transfer_function; TFEMarkers m_tfe_markers; int m_tfe_marker_selected; int m_tfe_marker_side; void initialize( void ); // functions to save and restore the marker set from a data stream void writeMarkers(QDataStream &stream) { stream << m_tfe_markers; } void readMarkers(QDataStream &stream); private: QColor m_color_selected[2]; void updateIsosurface( void ); void updateTF( void ); float rescale( float x_old_min, float x_old_max, float x_old_pos, float x_new_min, float x_new_max ); protected: void mouseMoveEvent( QMouseEvent * event ); void mousePressEvent( QMouseEvent * event ); void mouseReleaseEvent( QMouseEvent * event ); void paintEvent( QPaintEvent * event ); void wheelEvent( QWheelEvent * event ); private slots: void receiveColors( QColor color_L, QColor color_R ); void receiveDisplayRange( float min, float max ); signals: void transferFunctionChanged( TransferFunction tf ); void isosurfaceChanged( float threshold, const QColor &color ); }; #endif
27.432432
103
0.5867
ec5caa239f26df868cc8525eabd94842eedf8e6f
11,218
h
C
src/HDRImage.h
ikrima/hdrview
8436cf9dc8973b13347c187dfa7152d15d5cfc45
[ "MIT" ]
3
2019-02-11T01:15:54.000Z
2020-07-21T02:22:46.000Z
src/HDRImage.h
ikrima/hdrview
8436cf9dc8973b13347c187dfa7152d15d5cfc45
[ "MIT" ]
null
null
null
src/HDRImage.h
ikrima/hdrview
8436cf9dc8973b13347c187dfa7152d15d5cfc45
[ "MIT" ]
null
null
null
// // Copyright (C) Wojciech Jarosz <wjarosz@gmail.com>. All rights reserved. // Use of this source code is governed by a BSD-style license that can // be found in the LICENSE.txt file. // #pragma once #include <Eigen/Core> // for Array, CwiseUnaryOp, Dynamic, DenseC... #include <functional> // for function #include <vector> // for vector #include <string> // for string #include "Color.h" // for Color4, max, min #include "Progress.h" //! Floating point image class HDRImage : public Eigen::Array<Color4,Eigen::Dynamic,Eigen::Dynamic> { using Base = Eigen::Array<Color4,Eigen::Dynamic,Eigen::Dynamic>; public: //----------------------------------------------------------------------- //@{ \name Constructors, destructors, etc. //----------------------------------------------------------------------- HDRImage(void) : Base() {} HDRImage(int w, int h) : Base(w, h) {} HDRImage(const Base & other) : Base(other) {} //! This constructor allows you to construct a HDRImage from Eigen expressions template <typename OtherDerived> HDRImage(const Eigen::ArrayBase<OtherDerived>& other) : Base(other) { } //! This method allows you to assign Eigen expressions to a HDRImage template <typename OtherDerived> HDRImage& operator=(const Eigen::ArrayBase <OtherDerived>& other) { this->Base::operator=(other); return *this; } //@} int width() const { return (int)rows(); } int height() const { return (int)cols(); } bool isNull() const { return rows() == 0 || cols() == 0; } void setAlpha(float a) { *this = unaryExpr([a](const Color4 & c){return Color4(c.r,c.g,c.b,a);}); } void setChannelFrom(int c, const HDRImage & other) { *this = binaryExpr(other, [c](const Color4 & a, const Color4 & b){Color4 ret = a; ret[c] = b[c]; return ret;}); } Color4 min() const { Color4 m = (*this)(0,0); for (int y = 0; y < height(); ++y) for (int x = 0; x < width(); ++x) m = ::min(m, (*this)(x,y)); return m; } Color4 max() const { Color4 m = (*this)(0,0); for (int y = 0; y < height(); ++y) for (int x = 0; x < width(); ++x) m = ::max(m, (*this)(x,y)); return m; } //----------------------------------------------------------------------- //@{ \name Pixel accessors. //----------------------------------------------------------------------- enum BorderMode : int { BLACK = 0, EDGE, REPEAT, MIRROR }; static const std::vector<std::string> & borderModeNames(); Color4 & pixel(int x, int y, BorderMode mX = EDGE, BorderMode mY = EDGE); const Color4 & pixel(int x, int y, BorderMode mX = EDGE, BorderMode mY = EDGE) const; //@} //----------------------------------------------------------------------- //@{ \name Pixel samplers. //----------------------------------------------------------------------- enum Sampler : int { NEAREST = 0, BILINEAR, BICUBIC }; static const std::vector<std::string> & samplerNames(); Color4 sample(float sx, float sy, Sampler s, BorderMode mX = EDGE, BorderMode mY = EDGE) const; Color4 bilinear(float sx, float sy, BorderMode mX = EDGE, BorderMode mY = EDGE) const; Color4 bicubic(float sx, float sy, BorderMode mX = EDGE, BorderMode mY = EDGE) const; Color4 nearest(float sx, float sy, BorderMode mX = EDGE, BorderMode mY = EDGE) const; //@} //----------------------------------------------------------------------- //@{ \name Resizing. //----------------------------------------------------------------------- enum CanvasAnchor : int { TOP_LEFT = 0, TOP_CENTER, TOP_RIGHT, MIDDLE_LEFT, MIDDLE_CENTER, MIDDLE_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, NUM_CANVAS_ANCHORS }; HDRImage resizedCanvas(int width, int height, CanvasAnchor anchor, const Color4 & bgColor) const; HDRImage resized(int width, int height) const; HDRImage resampled(int width, int height, AtomicProgress progress = AtomicProgress(), std::function<Eigen::Vector2f(const Eigen::Vector2f &)> warpFn = [](const Eigen::Vector2f &uv) { return uv; }, int superSample = 1, Sampler s = NEAREST, BorderMode mX = REPEAT, BorderMode mY = REPEAT) const; //@} //----------------------------------------------------------------------- //@{ \name Transformations. //----------------------------------------------------------------------- HDRImage flippedVertical() const {return rowwise().reverse().eval();} HDRImage flippedHorizontal() const {return colwise().reverse().eval();} HDRImage rotated90CW() const {return transpose().colwise().reverse().eval();} HDRImage rotated90CCW() const {return transpose().rowwise().reverse().eval();} //@} //----------------------------------------------------------------------- //@{ \name Bayer demosaicing. //----------------------------------------------------------------------- void bayerMosaic(const Eigen::Vector2i &redOffset); void demosaicLinear(const Eigen::Vector2i &redOffset) { demosaicGreenLinear(redOffset); demosaicRedBlueLinear(redOffset); } void demosaicGreenGuidedLinear(const Eigen::Vector2i &redOffset) { demosaicGreenLinear(redOffset); demosaicRedBlueGreenGuidedLinear(redOffset); } void demosaicMalvar(const Eigen::Vector2i &redOffset) { demosaicGreenMalvar(redOffset); demosaicRedBlueMalvar(redOffset); } void demosaicAHD(const Eigen::Vector2i &redOffset, const Eigen::Matrix3f &cameraToXYZ); // green channel void demosaicGreenLinear(const Eigen::Vector2i &redOffset); void demosaicGreenHorizontal(const HDRImage &raw, const Eigen::Vector2i &redOffset); void demosaicGreenVertical(const HDRImage &raw, const Eigen::Vector2i &redOffset); void demosaicGreenMalvar(const Eigen::Vector2i &redOffset); void demosaicGreenPhelippeau(const Eigen::Vector2i &redOffset); // red/blue channels void demosaicRedBlueLinear(const Eigen::Vector2i &redOffset); void demosaicRedBlueGreenGuidedLinear(const Eigen::Vector2i &redOffset); void demosaicRedBlueMalvar(const Eigen::Vector2i &redOffset); void demosaicBorder(size_t border); HDRImage medianFilterBayerArtifacts() const; //@} //----------------------------------------------------------------------- //@{ \name Image filters. //----------------------------------------------------------------------- HDRImage inverted() const; HDRImage brightnessContrast(float brightness, float contrast, bool linear, EChannel c) const; HDRImage convolved(const Eigen::ArrayXXf &kernel, AtomicProgress progress, BorderMode mX = EDGE, BorderMode mY = EDGE) const; HDRImage GaussianBlurred(float sigmaX, float sigmaY, AtomicProgress progress, BorderMode mX = EDGE, BorderMode mY = EDGE, float truncateX = 6.0f, float truncateY = 6.0f) const; HDRImage GaussianBlurredX(float sigmaX, AtomicProgress progress, BorderMode mode = EDGE, float truncateX = 6.0f) const; HDRImage GaussianBlurredY(float sigmaY, AtomicProgress progress, BorderMode mode = EDGE, float truncateY = 6.0f) const; HDRImage iteratedBoxBlurred(float sigma, int iterations = 6, AtomicProgress progress = AtomicProgress(), BorderMode mX = EDGE, BorderMode mY = EDGE) const; HDRImage fastGaussianBlurred(float sigmaX, float sigmaY, AtomicProgress progress, BorderMode mX = EDGE, BorderMode mY = EDGE) const; HDRImage boxBlurred(int w, AtomicProgress progress, BorderMode mX = EDGE, BorderMode mY = EDGE) const { return boxBlurred(w, w, progress, mX, mY); } HDRImage boxBlurred(int hw, int hh, AtomicProgress progress, BorderMode mX = EDGE, BorderMode mY = EDGE) const { return boxBlurredX(hw, AtomicProgress(progress, 0.5f), mX).boxBlurredY(hh, AtomicProgress(progress, 0.5f), mY); } HDRImage boxBlurredX(int leftSize, int rightSize, AtomicProgress progress, BorderMode mode = EDGE) const; HDRImage boxBlurredX(int halfSize, AtomicProgress progress, BorderMode mode = EDGE) const {return boxBlurredX(halfSize, halfSize, progress, mode);} HDRImage boxBlurredY(int upSize, int downSize, AtomicProgress progress, BorderMode mode = EDGE) const; HDRImage boxBlurredY(int halfSize, AtomicProgress progress, BorderMode mode = EDGE) const {return boxBlurredY(halfSize, halfSize, progress, mode);} HDRImage unsharpMasked(float sigma, float strength, AtomicProgress progress, BorderMode mX = EDGE, BorderMode mY = EDGE) const; HDRImage medianFiltered(float radius, int channel, AtomicProgress progress, BorderMode mX = EDGE, BorderMode mY = EDGE, bool round = false) const; HDRImage medianFiltered(float r, AtomicProgress progress, BorderMode mX = EDGE, BorderMode mY = EDGE, bool round = false) const { return medianFiltered(r, 0, AtomicProgress(progress, 0.25f), mX, mY, round) .medianFiltered(r, 1, AtomicProgress(progress, 0.25f), mX, mY, round) .medianFiltered(r, 2, AtomicProgress(progress, 0.25f), mX, mY, round) .medianFiltered(r, 3, AtomicProgress(progress, 0.25f), mX, mY, round); } HDRImage bilateralFiltered(float sigmaRange/* = 0.1f*/, float sigmaDomain/* = 1.0f*/, AtomicProgress progress, BorderMode mX = EDGE, BorderMode mY = EDGE, float truncateDomain = 6.0f) const; //@} bool load(const std::string & filename); /*! * @brief Write the file to disk. * * The output image format is deduced from the filename extension. * * @param filename Filename to save to on disk * @param gain Multiply all pixel values by gain before saving * @param sRGB If not saving to an HDR format, tonemap the image to sRGB * @param gamma If not saving to an HDR format, tonemap the image using this gamma value * @param dither If not saving to an HDR format, dither when tonemapping down to 8-bit * @return True if writing was successful */ bool save(const std::string & filename, float gain, float gamma, bool sRGB, bool dither) const; public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW }; std::shared_ptr<HDRImage> loadImage(const std::string & filename);
43.312741
159
0.560706
ec612e72e0ab97a92d9b2a926b7073556c8d52bf
22,589
h
C
test/e2e/test_input/ObjectArxHeaders/AcDbAssocDimDependencyBodyBase.h
BlueCannonBall/cppparser
9ae5f0c21268be6696532cf5b90c0384d6eb4940
[ "MIT" ]
50
2018-01-12T14:32:26.000Z
2022-03-30T10:36:30.000Z
test/e2e/test_input/ObjectArxHeaders/AcDbAssocDimDependencyBodyBase.h
BlueCannonBall/cppparser
9ae5f0c21268be6696532cf5b90c0384d6eb4940
[ "MIT" ]
8
2021-02-18T14:52:08.000Z
2022-03-09T08:51:39.000Z
test/e2e/test_input/ObjectArxHeaders/AcDbAssocDimDependencyBodyBase.h
BlueCannonBall/cppparser
9ae5f0c21268be6696532cf5b90c0384d6eb4940
[ "MIT" ]
12
2019-04-02T11:51:47.000Z
2022-03-07T11:07:39.000Z
////////////////////////////////////////////////////////////////////////////// // // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // ////////////////////////////////////////////////////////////////////////////// // // CREATED BY: Jiri Kripac October 2007 // // DESCRIPTION: // // AcDbAssocDimDependencyBodyBase class. // ////////////////////////////////////////////////////////////////////////////// #pragma once #include "AcDbAssocGlobal.h" #include "AcString.h" #include "AcArray.h" #include "AcConstrainedGeometry.h" #include "AcDbAssocDependencyBody.h" #pragma pack (push, 8) /// <summary> <para> /// AcDbAssocDimDependencyBodyBase ties together the following objects that /// define a dimensional constraint: /// /// AcDbAssocVariable Keeps dimensional constraint name and expression. /// AcDbAssoc2dConstraintGroup Keeps AcExplicitConstraint. /// AcDbEntity (such as AcDbDimension) Graphical representation of the dimensional constraint. /// /// AcDbAssocDimDependencyBodyBase class represents a dependency of an AcExplicitConstraint /// owned by an AcDbAssoc2dConstraintGroup, on an AcDbEntity that is the graphical /// representation of the dimensional constraint. AcDbAssocDimDependencyBodyBase /// is an abstract base class, there are concrete derived classes (such as /// AcDbAssocDimDependencyBody) that deal with concrete entity types (such as AcDbDimension) /// that are used as graphical representations of dimensional constraints. /// </para> <para> /// The AcDbAssocDimDependencyBodyBase does all the work of managing the graphical /// entity, receiving notifications about entity text changes, updating the entity /// text and entity positioning, keeping the entity text in sync with the /// AcDbAssocVariable, and keeping it in sync with the corresponding /// AcExplicitConstraint in AcDbAssoc2dConstraintGroup. /// </para> <para> /// There always is a corresponding AcDbAssocVariable that keeps the name, expression /// and value of the dimensional constraint and is also referenced by the /// AcExplicitConstraint via AcDbAssocValueDependency. The AcDbAssocDimDependencyBodyBase /// obtains the corresponding AcDbAssocVariable by going up to the /// AcDbAssoc2dConstraintGroup that owns the AcDbAssocDimDependencyBody, finds /// the AcExplicitConstraint that references this dependency, obtains the /// AcDbAssocValueDependency and obtains the object it depends on, which is the /// corresponding AcDbAssocVariable. /// </para> </summary> /// class ACDB_PORT AcDbAssocDimDependencyBodyBase : public AcDbAssocDependencyBody { public: ACRX_DECLARE_MEMBERS(AcDbAssocDimDependencyBodyBase); /// <summary> Default constructor. </summary> explicit AcDbAssocDimDependencyBodyBase(AcDbAssocCreateImpObject createImpObject = kAcDbAssocCreateImpObject); /// <summary> Destructor. </summary> virtual ~AcDbAssocDimDependencyBodyBase(); /// <summary> /// Derived classes needs to override this pure virtual method. This is how /// they provide the text of the entity they manage. /// </summary> /// <returns> The entity text. </returns> /// virtual AcString getEntityTextOverride() const = 0; /// <summary> /// Derived classes need to override this pure virtual method to set the /// text of the entity they manage. /// </summary> /// <param name="newText"> New text to set to the entity. </param> /// <returns> Acad::eOk if successful. </returns> /// virtual Acad::ErrorStatus setEntityTextOverride(const AcString& newText) = 0; /// <summary> /// Derived classes needs to override this pure virtual method to provide the /// current measurement of the entity they manage. /// </summary> /// <returns> The entity measurement. </returns> /// virtual double getEntityMeasurementOverride() const = 0; /// <summary> /// Derived classes need to override this pure virtual method to inform /// whether the attachment of the entity they manage changed, such as whether /// the entity has been repositioned. /// </summary> /// <returns> True if the entity attachment changed, false otherwise. </returns> /// virtual bool isEntityAttachmentChangedOverride() const = 0; /// <summary> This method needs to be overriden and implemented by derived /// classes. It updates the controlled entity position, size and orientation. /// The base class impplementation just handles reference dimensions that are /// not dimensional constraints. This method updates the corresponding /// AcDbAssocVariable with the current measured value of the dimension and /// updates the entity text with the current measurement. </summary> /// <returns> Acad::eOk if successful. </returns> /// virtual Acad::ErrorStatus updateDependentOnObjectOverride() override; /// <summary> Returns the corresponding dimensional constraint node. </summary> /// <returns> The dimensional constraint node. </returns> /// class AcExplicitConstraint* constraint() const; /// <summary> Returns object id of the corresponding AcDbAssocVariable. </summary> /// <returns> Object id of the AcDbAssocVariable. </returns> /// AcDbObjectId variable() const; // of AcDbAssocVariable /// <summary> Returns all AcConstrainedGeometries constrained by this /// dimensional constraint. </summary> /// <param name="geoms"> All AcConstrainedGeometries constrained by this /// dimensional constraint. </param> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus getConstrainedGeoms(AcArray<AcConstrainedGeometry*>& geoms) const; /// <summary> Returns all constrained subentities of AcDbEntities constrained /// by this dimensional constraint. </summary> /// <param name="geoms"> All constrained subentities of AcDbEntities /// constrained by this dimensional constraint. </param> /// <returns> Returns Acad::eOk if successful. </returns> /// Acad::ErrorStatus getConstrainedGeoms(AcArray<AcDbFullSubentPath>& geoms) const; /// <summary> Returns all constrained subentities of AcDbEntities constrained /// by this dimensional constraint. </summary> /// <param name="geoms"> All constrained subentities of AcDbEntities /// constrained by this dimensional constraint. </param> /// <param name="distanceDirection"> Direction of the distance constraint. </param> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus getConstrainedGeoms(AcArray<AcDbSubentGeometry>& geoms, AcGeVector3d& distanceDirection) const; /// <summary> Returns name, expression and current value of the AcDbAssocVariable /// that corresponds to this dimensional constraint. </summary> /// <param name="name"> Variable name. </param> /// <param name="expression"> Variable expression. </param> /// <param name="value"> Variable value. </param> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus getVariableNameAndExpression(AcString& name, AcString& expression, AcString& value) const; /// <summary> Returns name and expression from the text that the managed /// entity is displaying. </summary> /// <param name="name"> Name from the managed entity display text. </param> /// <param name="expression"> Expression from the managed entity display text. </param> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus getEntityNameAndExpression(AcString& name, AcString& expression) const; /// <summary> Sets new name and expression of the AcDbAssocVariable that /// corresponds to this dimensional constraint. Either name or expression /// may be empty strings which indicates not to change them. </summary> /// <param name="name"> New name of the AcDbAssocVariable. </param> /// <param name="expression"> New expression of the AcDbAssocVariable. </param> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus setVariableNameAndExpression(const AcString& name, const AcString& expression); /// <summary> Sets name and expression that the managed entity should display. /// Either name or expression may be empty strings which indicates not /// to change them. </summary> /// <param name="name"> New name the managed entity should display. </param> /// <param name="expression"> New expression the managed entity should display. </param> /// <param name="value"> New value the managed entity should display. </param> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus setEntityNameAndExpression(const AcString& name, const AcString& expression, const AcString& value); /// <summary> Sets name and expression on both the AcDbAssocVariable that /// corresponds to this dimensional constraint and on the managed entity /// that serves as graphical representation of this dimensional constraint. /// Either name or expression may be empty strings which indicates not to /// change them. </summary> /// <param name="name"> New name to be set. </param> /// <param name="expression"> New expression to be set. </param> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus setNameAndExpression(const AcString& name, const AcString& expression); // Both variable and entity /// <summary> Checks if the given entityTextToValidate can be used as the /// text the managed entity displays. Either the name or the expression part /// of the entityTextToValidate text may be empty which means that the /// current name/expression should be used. </summary> /// <param name="entityTextToValidate"> The entity text to check. </param> /// <param name="errorMessage"> The error message if any errors. </param> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus validateEntityText(const AcString& entityTextToValidate, AcString& errorMessage) const; /// <summary> /// If needed, opens itself for write and updates the text in the managed entity. /// If no changes are needed, does nothing. Notice that this AcDbAssocDimDependencyBodyBase /// may be open just for read when this method is called. This is to avoid the overhead /// with opening the object for write in case it does not need to be modified. /// </summary> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus updateEntityText(); /// <summary> Composes the text that the managed entity should display. The /// text is composed from the corresponding AcDbAssocVariable name, expression /// and/or value. The text formatting follows requiredNameFormat. </summary> /// <param name="requiredNameFormat"> /// The constraint name format display, deafault value if -1. /// If requiredNameFormat == -1, CONSTRAINTNAMEFORMAT sysvar is used for /// choosing the text format. </param> /// <returns> The composed entity text. </returns> /// AcString composeEntityText(int requiredNameFormat = -1) const; /// <summary> Measures the current dimensional constraint based on /// the current positions and sizes of the constrained geometries and sets /// the corresponding AcDbAssocVariable to this measured value. If the /// dimensional constraint is satisfied, the AcDbAssocVariable value will /// already be equal to the measured value and no setting is needed and it /// does not happen. Notice that if AcDbAssocVariable contained an expression, /// it will be erased and the variable will just contain a numerical value, /// not expression. </summary> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus setVariableValueToMeasuredValue() const; /// <summary> Deactivates the constraint. Deactivating a constraint means /// still keeping the AcExplicitConstraint in the AcDbAssoc2dConstraintGroup /// but removing its d_node or r_node from the DCM dimension system. </summary> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus deactivateConstraint() const; /// <summary> Reactivates the constraint. Reactivating a constraint means /// creating a d_node or r_node for this AcExplicitConstraint and adding it /// to the DCM dimension system. </summary> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus reactivateConstraint() const; /// <summary> Returns whether the constraint is active. </summary> /// <returns> True if the constraint is active, false otherwise. </returns> /// bool isConstraintActive() const; // Has DCM d_node or r_node /// <summary> Measures the current dimensional constraint based on the /// current positions and sizes of the constrained geometries. If the /// dimensional constraint is satisfied, the AcDbAssocVariable value will /// already be equal to the measured value. </summary> /// <param name="measurement"> The returned measured value. </param> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus getMeasuredValue(double& measurement) const; /// <summary> Sets whether the constraint is reference only. /// A reference "constraint" keeps updating its AcDbAssocVariable and the /// dimension text with the measured value of the dimension, but it does /// not function as a dimensional constraint. </summary> /// <param name="yesNo"> /// Bool value indicating whether the constraint is reference only. </param> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus setIsReferenceOnly(bool yesNo); /// <summary> Parses the given entityText string and extracts name and /// expression components from it. It is mainly for internal use. </summary> /// <param name="entityText"> The string to extract name and expression from. </param> /// <param name="useMeasurementIfNoText"> /// Indicates whether to use measurement value if no text is given. </param> /// <param name="measurement"> The provided entity measurement. </param> /// <param name="isAngular"> Indicates that the constraint is angular. </param> /// <param name="name"> Name component extracted from entityText. </param> /// <param name="expression"> Expression component extracted from entityText. </param> /// <returns> Acad::eOk if successful. </returns> /// static Acad::ErrorStatus getNameAndExpressionFromEntityText(const AcString& entityText, bool useMeasurementIfNoText, double measurement, bool isAngular, AcString& name, AcString& expression); /// <summary> Returns the format that is used to display the entity name /// and expression by looking at the currently displayed entity text. /// See CONSTRAINTNAMEFORMAT sysvar for the possible format values. </summary> /// <returns> The currently used constraint display format. </returns> /// int getCurrentlyUsedEntityNameFormat() const; /// <summary> /// This function should be called when dependent object grips are dragged. /// </summary> /// <param name="status"> The current AcDb::DragStat. </param> /// void dragStatus(const AcDb::DragStat status); /// <summary> Gets the AcDbAssocDimDependencyBodyBase from the dependent-on /// AcDbEntity, such as from the AcDbDimension it controls. If the entity /// does not have an AcDbAssocDimDependencyBodyBase attached, AcDbObjectId::kNull /// is returned. </summary> /// <param name="entityId"> The entity id of the dependent-on AcDbEntity, /// such as of an AcDbDimension. </param> /// <param name="dimDepBodyId"> The returned AcDbObjectId of the /// AcDbAssocDimDependencyBodyBase, or AcDbObjectId::kNull if none found. </param> /// <returns> Acad::eOk if successful. </returns> /// static Acad::ErrorStatus getFromEntity(const AcDbObjectId& entityId, AcDbObjectId& dimDepBodyId); /// <summary> <para> Updates the constraint geometry when dimension grip /// points are moved. Any move made through triangular grip should move the /// constraint geometry by the same amount and update the constraint variable /// value. Clients of this function need to pass new positions of the dimension /// attachment in AcDbSubentGeometry array, and new dimension measurement. /// </para> <para> /// This API performs the following operations: /// </para> <para> /// 1. Moves the constraint geometry sub entity by the same /// amount the dimension grip point has been moved. /// </para> <para> /// 2. Moves the constrained geometry at the opposite end of /// the dimensional constraint by identity transform. This is a hint to DCM /// not to move the opposite end of the dimensional constraint. /// </para> <para> /// 3. Updates the constraint variable value with new measurement. /// </para> </summary> /// <param name="newAttachedGeometries"> /// The new attached geometries to be updated. </param> /// <param name="measurement"> New measurement, default value is 0.0. </param> /// <returns> Acad::eOk if successful. </returns> /// Acad::ErrorStatus entityAttachmentPointMoved(const AcArray<AcDbSubentGeometry>& newAttachedGeometries, double measurement = 0.0); /// <summary> Overridden method from AcDbAssocDependencyBody base class. </summary> /// <param name="isRelevChange"> /// Returns true if one of the following has happened: /// <para> Entity text changed in any way, </para> /// <para> Name or expression of the corresponding AcDbAssocVariable are /// different from name or expression in the controlled entity, </para> /// <para> Entity attachment changed. </para> /// </param> /// <returns> Acad::eOk if successful. </returns> /// virtual Acad::ErrorStatus isRelevantChangeOverride(bool& isRelevChange) const override; /// <summary> This function sets the name and expression in the controlled /// entity text to be the same as the name and expression of the corresponding /// AcDbAssocVariable. </summary> /// virtual void evaluateOverride() override; /// <summary> If the controlled entity text changed, this function sets the /// name and expression of the AcDbAssocVariable to be the same as the name /// and expression in the entity text. </summary> /// <param name="pDbObj"> The controlled entity. </param> /// virtual void modifiedOverride(const AcDbObject* pDbObj) override; /// <summary> When the dependent-on object (such as an AcDbDimension) is /// erased, the corresponding AcDbAssocVariable is also erased.</summary> /// <param name="pDbObj"> The controlled entity. </param> /// <param name="isErasing"> Boolean isErasing. </param> /// virtual void erasedOverride(const AcDbObject* pDbObj, Adesk::Boolean isErasing) override; /// <summary> Overridden method from the AcDbObject base class. /// It erases the controlled entity, such as the AcDbDimension. </summary> /// <param name="erasing"> Boolean erasing. </param> /// <returns> Acad::eOk if successful. </returns> /// virtual Acad::ErrorStatus subErase(Adesk::Boolean erasing) override; /// <summary> Formats the given expression to current precision. </summary> /// <param name="expression"> The expression to be formatted. </param> /// <param name="isAngular"> Indicates it is an angular constraint. </param> /// <returns> The formatted expression. </returns> /// static AcString formatToCurrentPrecision(const AcString& expression, bool isAngular); /// <summary> Under normal circumstances the controlled AcDbDimension object /// is erased if the AcDbAssocDimDependencyBodyBase is erased. This static /// method allows to control if this behavior is to be surpressed, i.e. /// not erasing the AcDbDimension if the AcDbAssocDimDependencyBodyBase is /// erased. This can be useful for the creation of reference constraints /// since the same dimension should be retained and used for a reference /// constraint later on. </summary> /// <param name="yesNo"> Indicates to surpress the erase behavior or not. </param> /// <returns> Returns whether the behavior is surpressed or not. </returns> /// static bool setEraseDimensionIfDependencyIsErased(bool yesNo); /// <summary> Under normal circumstances an associated AcDbDimension object /// is erased if the AcDbAssocDimDependencyBodyBase is erased. This static /// method returns true iff this behavior is surpressed , i.e. not erasing /// the AcDbDimension if the AcDbAssocDimDependencyBodyBase is erased. </summary> /// <returns> Returns whether the behavior is surpressed or not. </returns> /// static bool getEraseDimensionIfDependencyIsErased(); /// <summary> This class is for internal use only. It disables notifications /// when the dependency is not yet fully setup and these notifications would /// complain about the data being in inconsistent state. </summary> /// class ACDB_PORT NotificationIgnorer { public: /// <summary> Default constructor. </summary> NotificationIgnorer(); /// <summary> Destructor. </summary> ~NotificationIgnorer(); /// <summary> Returns true iff notifications are ignored. </summary> /// <returns> Returns whether notifications are ignored. </returns> /// static bool isIgnoringNotifications(); private: const bool mPrevIsIgnoringNotifications; static bool smIsIgnoringNotifications; }; }; #pragma pack (pop)
51.222222
122
0.68436
ec61312a782363a1dfef0c40089b2ffc3a19d26d
193
h
C
Example/Pods/Target Support Files/Pods-HostSetting_Example/Pods-HostSetting_Example-umbrella.h
09jianfeng/HostSetting
166ee1dbc1c9c848647e6b28622d6cd7b06de0c6
[ "MIT" ]
null
null
null
Example/Pods/Target Support Files/Pods-HostSetting_Example/Pods-HostSetting_Example-umbrella.h
09jianfeng/HostSetting
166ee1dbc1c9c848647e6b28622d6cd7b06de0c6
[ "MIT" ]
null
null
null
Example/Pods/Target Support Files/Pods-HostSetting_Example/Pods-HostSetting_Example-umbrella.h
09jianfeng/HostSetting
166ee1dbc1c9c848647e6b28622d6cd7b06de0c6
[ "MIT" ]
null
null
null
#ifdef __OBJC__ #import <UIKit/UIKit.h> #endif FOUNDATION_EXPORT double Pods_HostSetting_ExampleVersionNumber; FOUNDATION_EXPORT const unsigned char Pods_HostSetting_ExampleVersionString[];
21.444444
78
0.860104
ec613a4ffb4e2b9e5285175652851e8587cc284e
835
h
C
02-Sourcecode/02-Mobile/01-iOS/EasyWayLyrics/GracenoteMusicID.framework/Headers/GNSearchResultReady.h
LDCAgency/easywaylyrics_public
529344b743a2d2a6b04ebc9ff823b33a36818512
[ "MIT" ]
2
2017-01-04T20:05:58.000Z
2022-03-06T06:56:08.000Z
02-Sourcecode/02-Mobile/01-iOS/EasyWayLyrics/GracenoteMusicID.framework/Headers/GNSearchResultReady.h
LDCAgency/easywaylyrics_public
529344b743a2d2a6b04ebc9ff823b33a36818512
[ "MIT" ]
null
null
null
02-Sourcecode/02-Mobile/01-iOS/EasyWayLyrics/GracenoteMusicID.framework/Headers/GNSearchResultReady.h
LDCAgency/easywaylyrics_public
529344b743a2d2a6b04ebc9ff823b33a36818512
[ "MIT" ]
null
null
null
// // iOSMobileSDK // Copyright Gracenote Inc. 2010. All rights reserved. // #import <Foundation/Foundation.h> @class GNSearchResult; /** * Interface that enables delivery of * results to an application. * Applications using recognition or search operations * need to create an object that implements this interface and provide an instance * of that object when invoking the operation. * Mobile Client delivers the result of the operation by calling interface * method GNResultReady. */ @protocol GNSearchResultReady /** * Method called by Mobile Client to deliver the result of a recognition or * search operation. * The application can process the result in the body of this function. * @param result Object containing the associated operation's result */ - (void) GNResultReady:(GNSearchResult*)result; @end
26.935484
82
0.760479
ec61bb01b87d8024d5dd8919b54cf99bb77df2ea
130
h
C
dependencies/physx-4.1/source/physx/src/buffering/ScbBody.h
realtehcman/-UnderwaterSceneProject
72cbd375ef5e175bed8f4e8a4d117f5340f239a4
[ "MIT" ]
null
null
null
dependencies/physx-4.1/source/physx/src/buffering/ScbBody.h
realtehcman/-UnderwaterSceneProject
72cbd375ef5e175bed8f4e8a4d117f5340f239a4
[ "MIT" ]
null
null
null
dependencies/physx-4.1/source/physx/src/buffering/ScbBody.h
realtehcman/-UnderwaterSceneProject
72cbd375ef5e175bed8f4e8a4d117f5340f239a4
[ "MIT" ]
null
null
null
version https://git-lfs.github.com/spec/v1 oid sha256:f6c93dfd499b3a53bd9094d222563f8ae05b4dee33f7c22ee1e19ad26e6e3952 size 43020
32.5
75
0.884615
ec6468c7bb601a629591d52452f7bec4994d6f98
25,029
c
C
main_win.c
0x0203/schack_poc
9361b1aecda3449199ad4927da82c00b8fb6bc53
[ "Unlicense" ]
4
2018-10-22T08:49:55.000Z
2018-10-23T01:46:44.000Z
main_win.c
0x0203/schack_poc
9361b1aecda3449199ad4927da82c00b8fb6bc53
[ "Unlicense" ]
null
null
null
main_win.c
0x0203/schack_poc
9361b1aecda3449199ad4927da82c00b8fb6bc53
[ "Unlicense" ]
null
null
null
/* SC Hack PoC - Based on nuklear x11 demo - public domain This is a proof-of-concept demo only. It is throw-away code. It is bad. Don't use it for anything you care about. Or better yet, at all. Otherwise I reserve the right to mock you publicly for doing so. */ #define COBJMACROS #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <d3d9.h> #include <stdio.h> #include <string.h> #include <limits.h> #include <time.h> #define WINDOW_WIDTH 1280 #define WINDOW_HEIGHT 1024 #define NK_INCLUDE_FIXED_TYPES #define NK_INCLUDE_STANDARD_IO #define NK_INCLUDE_STANDARD_VARARGS #define NK_INCLUDE_DEFAULT_ALLOCATOR #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT #define NK_INCLUDE_FONT_BAKING #define NK_INCLUDE_DEFAULT_FONT #define NK_IMPLEMENTATION #define NK_D3D9_IMPLEMENTATION #include "nuklear.h" #include "nuklear_d3d9.h" #define NKWINDOW "MainWindow" #include "packet.h" #include "style.c" #include "calculator.c" #include "ascii.c" typedef enum { AEGS, ANVL, AOPO, BANU, CNOU, CRUS, DRAK, ESPR, KRIG, MISC, RSI_, MOBI, MANUFACTURE_COUNT } manufacturer; static const char *manufacturer_names[] = { "Aegis Dynamics", "Anvil Aerospace", "AopoA", "Banu Souli", "Consolidated Outland", "Crusader Industries", "Drake Interplanetary", "Esperia Inc", "Kruger Intergalactic", "Musashi Industrial and Starflight Concern", "Roberts Space Industries", "MobiGlas by microTech" }; static const char *exploit_names[] = { "SAN Bus Buffer overflow", "Read Memory", "data intercept", "remote code execution", "data poison" }; static const char *payload_names[] = { "data intercept", "download firmware", "scan SANBus and chain exploit", "remote station console", "turret controller", "engine controller", "Door/lock managment", "data downloader" }; static char *cap_strings[] = {"Capture", "End Capture"}; enum {NOCAPTURE, CAPTURE}; static IDirect3DDevice9 *device; static IDirect3DDevice9Ex *deviceEx; static D3DPRESENT_PARAMETERS present; static LRESULT CALLBACK WindowProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch (msg) { case WM_DESTROY: PostQuitMessage(0); return 0; case WM_SIZE: if (device) { UINT width = LOWORD(lparam); UINT height = HIWORD(lparam); if (width != 0 && height != 0 && (width != present.BackBufferWidth || height != present.BackBufferHeight)) { nk_d3d9_release(); present.BackBufferWidth = width; present.BackBufferHeight = height; HRESULT hr = IDirect3DDevice9_Reset(device, &present); NK_ASSERT(SUCCEEDED(hr)); nk_d3d9_resize(width, height); } } break; } if (nk_d3d9_handle_event(wnd, msg, wparam, lparam)) return 0; return DefWindowProcW(wnd, msg, wparam, lparam); } static void create_d3d9_device(HWND wnd) { HRESULT hr; present.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; present.BackBufferWidth = WINDOW_WIDTH; present.BackBufferHeight = WINDOW_HEIGHT; present.BackBufferFormat = D3DFMT_X8R8G8B8; present.BackBufferCount = 1; present.MultiSampleType = D3DMULTISAMPLE_NONE; present.SwapEffect = D3DSWAPEFFECT_DISCARD; present.hDeviceWindow = wnd; present.EnableAutoDepthStencil = TRUE; present.AutoDepthStencilFormat = D3DFMT_D24S8; present.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL; present.Windowed = TRUE; {/* first try to create Direct3D9Ex device if possible (on Windows 7+) */ typedef HRESULT WINAPI Direct3DCreate9ExPtr(UINT, IDirect3D9Ex**); Direct3DCreate9ExPtr *Direct3DCreate9Ex = (void *)GetProcAddress(GetModuleHandleA("d3d9.dll"), "Direct3DCreate9Ex"); if (Direct3DCreate9Ex) { IDirect3D9Ex *d3d9ex; if (SUCCEEDED(Direct3DCreate9Ex(D3D_SDK_VERSION, &d3d9ex))) { hr = IDirect3D9Ex_CreateDeviceEx(d3d9ex, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE | D3DCREATE_FPU_PRESERVE, &present, NULL, &deviceEx); if (SUCCEEDED(hr)) { device = (IDirect3DDevice9 *)deviceEx; } else { /* hardware vertex processing not supported, no big deal retry with software vertex processing */ hr = IDirect3D9Ex_CreateDeviceEx(d3d9ex, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE | D3DCREATE_FPU_PRESERVE, &present, NULL, &deviceEx); if (SUCCEEDED(hr)) { device = (IDirect3DDevice9 *)deviceEx; } } IDirect3D9Ex_Release(d3d9ex); } } } if (!device) { /* otherwise do regular D3D9 setup */ IDirect3D9 *d3d9 = Direct3DCreate9(D3D_SDK_VERSION); hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE | D3DCREATE_FPU_PRESERVE, &present, &device); if (FAILED(hr)) { /* hardware vertex processing not supported, no big deal retry with software vertex processing */ hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE | D3DCREATE_FPU_PRESERVE, &present, &device); NK_ASSERT(SUCCEEDED(hr)); } IDirect3D9_Release(d3d9); } } /* creates a string padded out to the appropriate size. caller's responsibility to free ret */ static int shuffle_packet(char *packet, int packet_len, uint8_t **ret, int bph, uint8_t *hop_list, int hops, int start_offset) { int len; int pad; int i; int hop_index = 0; if (!ret || !packet || !hop_list || !bph || !hops) return 0; //len = strlen(packet); len = (bph * hops); len = len * ((packet_len + len - 1 - start_offset) / len); (*ret) = malloc(len); if (!*ret) return 0; memset(*ret, 0, len); for (i=0; i<len; i++) { hop_index = (i / bph) % hops; (*ret)[i] = (uint8_t)packet[i+start_offset] ^ (uint8_t)hop_list[hop_index]; } return len; } static int pretty_print_clear(uint8_t *data, char *save, int data_len, int save_offset) { int i, count = 0; char *special_out = NULL; for (i=0; i < data_len; i++) { if (data[i] == 0x01 && data[i+1] == 0x02) { count += sprintf(&save[count+save_offset], "%s", "---Start Transmission---\nSTX\n"); i++; } else if (data[i] == 0x03 && data[i+1] == 0x04) { count += sprintf(&save[count+save_offset], "%s", "\nETX\n---End Transmission--\n"); i++; } else if (data[i] == '\n') count += sprintf(&save[count+save_offset], "%c", '\n'); else if (data[i] < 0x20 || data[i] > 0x7e) count += sprintf(&save[count+save_offset], "%s", "_."); else count += sprintf(&save[count+save_offset], "%c", (char)data[i]); } return count; } static int pretty_print_raw(uint8_t *data, char *save, int data_len, int save_offset) { int i, count = 0; count += sprintf(&save[count+save_offset], "0x%4.4X ", 0); for (i=0; i < data_len; i++) { count += sprintf(&save[count+save_offset], "%2.2X ", data[i]); if (((i+1) % 16) == 0) { count += sprintf(&save[count+save_offset], "\n0x%4.4X ", i+1); continue; } if (((i+1) % 8) == 0) count += sprintf(&save[count+save_offset], " "); if (((i+1) % 4) == 0) count += sprintf(&save[count+save_offset], " "); } return count; } int main(void) { long dt; long started; int running = 1; e_theme sel_theme = THEME_DARK; int raw_mode = 1; int packets_captured = 1; int show_calc = 0; int show_ascii = 0; struct nk_context *ctx; struct nk_colorf bg; int num_hops = 1; int bytesphop = 6; int i, j; int offset = 0; int freqs[6]; uint8_t dfreqs[6]; int selected_manufacturer = 0; int selected_exploit = 0; int selected_payload = 0; int capture_state = NOCAPTURE; int first_packet_offset = 0; char *capbut_text = cap_strings[capture_state]; int raw_text_len; int clear_text_len; char raw_text[1<<16]; char clear_text[1<<16]; char total_crypt_string[1<<16]; int total_crypt_len; int popup_error = 0; int first_loop = 1; //HACK!!! int frequency_locked = 0; struct nk_style_button inactive_button_style; struct nk_style_button active_button_style; struct { manufacturer id; const char *sig; const char *name; int num_hops; int bph; uint8_t key[6]; } manufacturers[] = { {AEGS, "AEGS", manufacturer_names[AEGS], 0, 0, {0,0,0,0,0,0}}, {ANVL, "ANVL", manufacturer_names[ANVL], 0, 0, {0,0,0,0,0,0}}, {AOPO, "AOPO", manufacturer_names[AOPO], 0, 0, {0,0,0,0,0,0}}, {BANU, "BANU", manufacturer_names[BANU], 0, 0, {0,0,0,0,0,0}}, {CNOU, "CNOU", manufacturer_names[CNOU], 0, 0, {0,0,0,0,0,0}}, {CRUS, "CRUS", manufacturer_names[CRUS], 0, 0, {0,0,0,0,0,0}}, {DRAK, "DRAK", manufacturer_names[DRAK], 0, 0, {0,0,0,0,0,0}}, {ESPR, "ESPR", manufacturer_names[ESPR], 0, 0, {0,0,0,0,0,0}}, {KRIG, "KRIG", manufacturer_names[KRIG], 0, 0, {0,0,0,0,0,0}}, {MISC, "MISC", manufacturer_names[MISC], 0, 0, {0,0,0,0,0,0}}, {RSI_, "RSI_", manufacturer_names[RSI_], 0, 0, {0,0,0,0,0,0}}, {MOBI, "MOBI", manufacturer_names[MOBI], 0, 0, {0,0,0,0,0,0}}, }; freqs[0] = freqs[1] = freqs[2] = freqs[3] = freqs[4] = freqs[5] = 0; dfreqs[0] = dfreqs[1] = dfreqs[2] = dfreqs[3] = dfreqs[4] = dfreqs[5] = 0; memset(clear_text, 0, sizeof(clear_text)); WNDCLASSW wc; RECT rect = { 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT }; DWORD style = WS_OVERLAPPEDWINDOW; DWORD exstyle = WS_EX_APPWINDOW; HWND wnd; /* Win32 */ memset(&wc, 0, sizeof(wc)); wc.style = CS_DBLCLKS; wc.lpfnWndProc = WindowProc; wc.hInstance = GetModuleHandleW(0); wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.lpszClassName = L"NuklearWindowClass"; RegisterClassW(&wc); AdjustWindowRectEx(&rect, style, FALSE, exstyle); wnd = CreateWindowExW(exstyle, wc.lpszClassName, L"Nuklear Demo", style | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, wc.hInstance, NULL); create_d3d9_device(wnd); /* GUI */ ctx = nk_d3d9_init(device, WINDOW_WIDTH, WINDOW_HEIGHT); /* Load Fonts: if none of these are loaded a default font will be used */ /* Load Cursor: if you uncomment cursor loading please hide the cursor */ { struct nk_font_atlas *atlas; nk_d3d9_font_stash_begin(&atlas); nk_d3d9_font_stash_end(); } inactive_button_style = ctx->style.button; inactive_button_style.normal = nk_style_item_color(nk_rgb(90,90,90)); inactive_button_style.hover = nk_style_item_color(nk_rgb(90,90,90)); inactive_button_style.active = nk_style_item_color(nk_rgb(90,90,90)); inactive_button_style.border_color = nk_rgb(110,110,110); inactive_button_style.text_background = nk_rgb(60,60,60); inactive_button_style.text_normal = nk_rgb(60,60,60); inactive_button_style.text_hover = nk_rgb(60,60,60); inactive_button_style.text_active = nk_rgb(60,60,60); bg.r = 0.0f, bg.g = 0.0, bg.b = 0.0f, bg.a = 1.0f; /* Init ship packet formatting data */ srand(time(NULL)); for (i=0; i< NK_LEN(manufacturers); i++) { int j; int bph = 4 + (2*(rand() % 3)); int n = 1 + (rand() % 6); manufacturers[i].bph = bph; manufacturers[i].num_hops = n; printf("%d %d - ", bph, n); for (j=0; j < n; j++) { manufacturers[i].key[j] = rand() % 256; printf("%d ", manufacturers[i].key[j]); } printf("\n"); } while (running) { /* Input */ MSG msg; nk_input_begin(ctx); while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) running = 0; TranslateMessage(&msg); DispatchMessageW(&msg); } if (ctx->input.keyboard.keys[NK_KEY_TEXT_RESET_MODE].down) break; nk_input_end(ctx); /* GUI */ /* my code here */ if (nk_begin(ctx, NKWINDOW, nk_rect(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT), 0)) { /* Theme Selection Menu */ nk_menubar_begin(ctx); nk_layout_row_begin(ctx, NK_STATIC, 25, 2); nk_layout_row_push(ctx, 45); if (nk_menu_begin_label(ctx, "Theme", NK_TEXT_LEFT, nk_vec2(80,200))) { nk_layout_row_dynamic(ctx, 15, 1); if (nk_option_label(ctx, "Black", sel_theme == THEME_BLACK)) sel_theme = THEME_BLACK; nk_layout_row_dynamic(ctx, 15, 1); if (nk_option_label(ctx, "White", sel_theme == THEME_WHITE)) sel_theme = THEME_WHITE; nk_layout_row_dynamic(ctx, 15, 1); if (nk_option_label(ctx, "Red", sel_theme == THEME_RED)) sel_theme = THEME_RED; nk_layout_row_dynamic(ctx, 15, 1); if (nk_option_label(ctx, "Blue", sel_theme == THEME_BLUE)) sel_theme = THEME_BLUE; nk_layout_row_dynamic(ctx, 25, 1); if (nk_option_label(ctx, "Dark", sel_theme == THEME_DARK)) sel_theme = THEME_DARK; nk_menu_end(ctx); } set_style(ctx, sel_theme); active_button_style = ctx->style.button; nk_layout_row_push(ctx, 45); if (nk_menu_begin_label(ctx, "Tools", NK_TEXT_LEFT, nk_vec2(80,200))) { nk_layout_row_dynamic(ctx, 25, 1); if (nk_menu_item_label(ctx, "Calculator", NK_TEXT_LEFT)) show_calc = nk_true; nk_layout_row_dynamic(ctx, 25, 1); if (nk_menu_item_label(ctx, "ASCII Chart", NK_TEXT_LEFT)) show_ascii = nk_true; nk_menu_end(ctx); } nk_layout_row_dynamic(ctx, 35, 2); nk_button_label(ctx, "Load Profile"); nk_button_label(ctx, "Save Profile"); /* Load Manufacturer dycrypter key */ nk_layout_row_begin(ctx, NK_STATIC, 25, 3); { int n = 0; nk_layout_row_push(ctx, 200); nk_label(ctx, "Load Manufacturer Dycryption Key", NK_TEXT_RIGHT); nk_layout_row_push(ctx, 300); if (first_loop || selected_manufacturer != (n = nk_combo(ctx, manufacturer_names, NK_LEN(manufacturer_names), selected_manufacturer, 25, nk_vec2(300,300)))) { uint8_t *crypt_string; int cp_len; if (capture_state == CAPTURE) { popup_error = 1; goto popup; } total_crypt_len = 0; selected_manufacturer = n; first_packet_offset = (rand() % (strlen((data_packets[n].packets)[0])/2)); printf("first packet offset: %d\n", first_packet_offset); memset(total_crypt_string, 0, sizeof(total_crypt_string)); for (i=0; i < data_packets[n].count; i++) { cp_len = shuffle_packet((char *)((data_packets[n].packets)[i]), strlen((data_packets[n].packets)[i]), &crypt_string, manufacturers[n].bph, manufacturers[n].key, manufacturers[n].num_hops, 0); memcpy(&(total_crypt_string[total_crypt_len]), crypt_string, cp_len); total_crypt_len += cp_len; free(crypt_string); } } popup: if (popup_error) { static struct nk_rect s = {200, 100, 400, 120}; if (nk_popup_begin(ctx, NK_POPUP_STATIC, "Error", NK_WINDOW_CLOSABLE|NK_WINDOW_TITLE, s)) { nk_window_set_focus(ctx, "Error"); nk_layout_row_dynamic(ctx, 25, 1); nk_label(ctx, "Cannot switch decryption modules while " "capture is active", NK_TEXT_CENTERED); nk_layout_row_dynamic(ctx, 25, 1); if (nk_button_label(ctx, "OK")) { popup_error = 0; nk_popup_close(ctx); } nk_popup_end(ctx); } } nk_button_label(ctx, "Load from Firmware"); } nk_layout_row_end(ctx); nk_layout_row_dynamic(ctx, 50, 1); nk_label(ctx, "Frequency Hop Settings", NK_TEXT_CENTERED); nk_layout_row_dynamic(ctx, 25, 3); nk_label(ctx, "", NK_TEXT_CENTERED); nk_property_int(ctx, "Number of Frequency Hops:", 1, &num_hops, 6, 1, 0.5f); nk_label(ctx, "", NK_TEXT_CENTERED); nk_layout_row_dynamic(ctx, 25, 3); nk_label(ctx, "", NK_TEXT_CENTERED); nk_property_int(ctx, "Bytes per Hop:", 4, &bytesphop, 8, 2, 2); nk_label(ctx, "", NK_TEXT_CENTERED); for (i=0; i < num_hops; i++) { nk_layout_row_begin(ctx, NK_DYNAMIC, 25, 2); nk_layout_row_push(ctx, 0.10f); nk_labelf(ctx, NK_TEXT_LEFT, "Frequency %d :", i); nk_layout_row_push(ctx, 0.85f); nk_slider_int(ctx, 0, &freqs[i], 255, 1); dfreqs[i] = (uint8_t)freqs[i]; nk_layout_row_push(ctx, 0.05f); nk_labelf(ctx, NK_TEXT_LEFT, "%d.%d MHz", 110 + selected_manufacturer, freqs[i]); } nk_layout_row_dynamic(ctx, 40, 1); if (nk_button_label(ctx, capbut_text)) { capture_state = (capture_state == NOCAPTURE) ? CAPTURE : NOCAPTURE; capbut_text = cap_strings[capture_state]; if (capture_state == CAPTURE) packets_captured = 1; } nk_layout_row_begin(ctx, NK_DYNAMIC, 25, 3); nk_layout_row_push(ctx, 0.25f); if (nk_option_label(ctx, "Raw Data", raw_mode == 1)) raw_mode = 1; nk_layout_row_push(ctx, 0.25f); if (nk_option_label(ctx, "Frequency Chart", raw_mode == 0)) raw_mode = 0; nk_layout_row_push(ctx, 0.5f); nk_label(ctx, "Demangled Data", NK_TEXT_CENTERED); nk_layout_row_end(ctx); nk_layout_row_dynamic(ctx, 400, 2); memset(raw_text, 0, sizeof(raw_text)); memset(clear_text, 0, sizeof(clear_text)); raw_text_len = clear_text_len = 0; if (capture_state == CAPTURE) { uint8_t *decrypt_string = NULL; int decrypt_len; int show_len = 0; int len, packet_len; if (rand() % 800 == 0) packets_captured++; for (i=0; i < packets_captured && i<data_packets[selected_manufacturer].count; i++) { packet_len = strlen(data_packets[selected_manufacturer].packets[i]); len = (manufacturers[selected_manufacturer].bph * manufacturers[selected_manufacturer].num_hops); show_len += len * ((packet_len + len - 1) / len); if (i==0) show_len -= first_packet_offset; } raw_text_len = pretty_print_raw((uint8_t *)(total_crypt_string + first_packet_offset), raw_text, show_len, 0); decrypt_len = shuffle_packet((char *)(&total_crypt_string[offset + first_packet_offset]), total_crypt_len, &decrypt_string, bytesphop, dfreqs, num_hops, 0); if (decrypt_len == 0) goto cleanup; clear_text_len = pretty_print_clear(decrypt_string, clear_text, show_len - offset, 0); free(decrypt_string); } if (raw_mode) { nk_edit_string(ctx, NK_EDIT_EDITOR, raw_text, &raw_text_len, sizeof(raw_text), nk_filter_ascii); } else { nk_flags result; struct nk_rect bounds; bounds = nk_widget_bounds(ctx); if (nk_chart_begin(ctx, NK_CHART_LINES, 256, 0.0f, 1.0f)) { const float real_factor = 0.1f; const float select_factor = 0.6f; float range = 0.0, floor = 0.0; float res = 0; float boost_factor; int dist, max; int n = manufacturers[selected_manufacturer].num_hops; for (i=0; i<256; i++) { res = dist = 0; for (j=0; j<n; j++) { dist += j>num_hops ? 255 : NK_ABS(freqs[j] - manufacturers[selected_manufacturer].key[j]); } max = 255 * n; boost_factor = (1.0f - ((float)dist / (float)max)) * select_factor; for (j=0; j<n; j++) { dist = NK_ABS(manufacturers[selected_manufacturer].key[j] - i); if (dist) { res += (real_factor + boost_factor) / (float)dist; res = NK_MIN(res, real_factor + boost_factor); } else res = real_factor + boost_factor; } floor = (1.0f - (real_factor + select_factor))/2.0f; range = ((float)rand()/((float)RAND_MAX/(floor*2.0))) - floor; if (capture_state == CAPTURE) result = nk_chart_push(ctx, res + range + floor); } nk_chart_end(ctx); /* mouse over char */ if (capture_state == CAPTURE && nk_input_is_mouse_hovering_rect(&(ctx->input), bounds)) { float x, y; float hover_freq; struct nk_color c = {8,24,158,128}; x = ctx->input.mouse.pos.x - bounds.x; hover_freq = (255.0 * x) / bounds.w; nk_stroke_line(&ctx->current->buffer, ctx->input.mouse.pos.x, bounds.y, ctx->input.mouse.pos.x, bounds.y + bounds.h, 1, c); nk_tooltipf(ctx, "%d.%d", 110 + selected_manufacturer, (int)hover_freq); } } } nk_edit_string(ctx, NK_EDIT_EDITOR, clear_text, &clear_text_len, sizeof(clear_text), nk_filter_ascii); /* Offset slider */ nk_layout_row_begin(ctx, NK_DYNAMIC, 25, 3); nk_layout_row_push(ctx, 0.10f); nk_label(ctx, "Starting offset:", NK_TEXT_LEFT); nk_layout_row_push(ctx, 0.85f); offset = NK_MIN(offset, strlen((data_packets[selected_manufacturer]).packets[0])); nk_slider_int(ctx, 0, &offset, strlen((data_packets[selected_manufacturer]).packets[0]), 1); nk_layout_row_push(ctx, 0.05f); nk_labelf(ctx, NK_TEXT_LEFT, "%d", offset); frequency_locked = 1; if (num_hops == (j = manufacturers[selected_manufacturer].num_hops) && bytesphop == manufacturers[selected_manufacturer].bph && capture_state == CAPTURE) { for (i = 0; i < j; i++) { if (dfreqs[i] != manufacturers[selected_manufacturer].key[i]) { frequency_locked = 0; break; } } } else frequency_locked = 0; /* Exploits and Payloads */ /* Load Manufacturer dycrypter key */ nk_layout_row_dynamic(ctx, 30, 4); nk_label(ctx, "Select Exploit(s)", NK_TEXT_RIGHT); selected_exploit = nk_combo(ctx, exploit_names, NK_LEN(exploit_names), selected_exploit, 25, nk_vec2(300,300)); nk_label(ctx, "Attach Payload(s)", NK_TEXT_RIGHT); selected_payload = nk_combo(ctx, payload_names, NK_LEN(payload_names), 0, 25, nk_vec2(300,300)); nk_layout_row_dynamic(ctx, 35, 1); ctx->style.button = frequency_locked ? active_button_style : inactive_button_style; static int foo = 0; if (nk_button_label(ctx, "Launch Attack") && frequency_locked) { foo = 1; } ctx->style.button = active_button_style; if (foo) { struct nk_rect bounds; bounds = nk_widget_bounds(ctx); bounds.y -= 300; bounds.h += 300; if (nk_popup_begin(ctx, NK_POPUP_DYNAMIC, "pwnd", NK_WINDOW_TITLE, bounds)) { nk_window_set_focus(ctx, "pwnd"); nk_layout_row_dynamic(ctx, 40, 1); nk_label(ctx, "Attack Successful! (The appropriate payload would now run for as long as the target is in range and we stay tuned to the correct frequencies).", NK_TEXT_CENTERED); nk_layout_row_dynamic(ctx, 40, 1); if (nk_button_label(ctx, "OK")) { foo = 0; nk_popup_close(ctx); } nk_popup_end(ctx); } } } nk_end(ctx); show_calc = calculator(ctx, show_calc); show_ascii = ascii(ctx, show_ascii); if (nk_window_is_hidden(ctx, NKWINDOW)) break; /* ************ */ /* Draw */ { HRESULT hr; hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, D3DCOLOR_COLORVALUE(bg.a, bg.r, bg.g, bg.b), 0.0f, 0); NK_ASSERT(SUCCEEDED(hr)); hr = IDirect3DDevice9_BeginScene(device); NK_ASSERT(SUCCEEDED(hr)); nk_d3d9_render(NK_ANTI_ALIASING_ON); hr = IDirect3DDevice9_EndScene(device); NK_ASSERT(SUCCEEDED(hr)); if (deviceEx) { hr = IDirect3DDevice9Ex_PresentEx(deviceEx, NULL, NULL, NULL, NULL, 0); } else { hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); } if (hr == D3DERR_DEVICELOST || hr == D3DERR_DEVICEHUNG || hr == D3DERR_DEVICEREMOVED) { /* to recover from this, you'll need to recreate device and all the resources */ MessageBoxW(NULL, L"D3D9 device is lost or removed!", L"Error", 0); break; } else if (hr == S_PRESENT_OCCLUDED) { /* window is not visible, so vsync won't work. Let's sleep a bit to reduce CPU usage */ Sleep(10); } NK_ASSERT(SUCCEEDED(hr)); } first_loop = 0; } cleanup: nk_d3d9_shutdown(); if (deviceEx)IDirect3DDevice9Ex_Release(deviceEx); else IDirect3DDevice9_Release(device); UnregisterClassW(wc.lpszClassName, wc.hInstance); return 0; }
30.976485
184
0.625714
ec64817bc98a6e8f99febfd8cf4333e382e36829
4,209
h
C
src/easyIO.h
WilsonGroupOxford/Triangle-Raft
6d8e30699c96111c392e194f4c7aafc055c583c9
[ "MIT" ]
1
2020-06-04T21:25:04.000Z
2020-06-04T21:25:04.000Z
src/easyIO.h
WilsonGroupOxford/Triangle-Raft
6d8e30699c96111c392e194f4c7aafc055c583c9
[ "MIT" ]
1
2020-06-06T11:13:39.000Z
2020-06-15T06:10:03.000Z
src/easyIO.h
WilsonGroupOxford/Triangle-Raft
6d8e30699c96111c392e194f4c7aafc055c583c9
[ "MIT" ]
null
null
null
//Easier writing to console and reading/writing to files #ifndef MX2_EASYIO_H #define MX2_EASYIO_H #include <iostream> #include <vector> #include <fstream> #include <string> #include <iomanip> #include <sstream> #include "col_vector.h" using namespace std; //#### writing to console #### template <typename T> void consoleValue(T value){ //write single value to console cout<<value<<endl; } template <typename T> void consoleVector(vector<T> values){ //write vector of values to console for(int i=0; i<values.size(); ++i) cout<<values[i]<<" "; cout<<endl; } template <typename T> void consoleMatrix(vector< vector<T> > values){ //write matrix of values to console for(int i=0; i<values.size(); ++i){ for(int j=0; j<values[i].size(); ++j) cout<<values[i][j]<<" "; cout<<endl; } } template <typename T> void consoleArray(T values, int n){ //write array of values to console for(int i=0; i<n; ++i) cout<<values[i]<<" "; cout<<endl; } //#### writing to file #### void writeFileDashedLine(ofstream &file, int n=70); void writeFileIndent(ofstream &file, int w=4); template <typename T> void writeFileValue(ofstream &file, T value, bool endLine, int width=10){ //write single value to file file<<setw(width)<<left<<value; if(endLine) file<<endl; } template <typename S, typename T> void writeFileValue(ofstream &file, S value0, T value1, int width=20){ //write two values to file file<<setw(width)<<left<<value0<<setw(width)<<left<<value1<<endl; } template <typename S, typename T, typename U> void writeFileValue(ofstream &file, S value0, T value1, U value2, int width=20){ //write three values to file file<<setw(width)<<left<<value0<<setw(width)<<left<<value1<<setw(width)<<left<<value2<<endl; } template <typename S, typename T, typename U, typename V> void writeFileValue(ofstream &file, S value0, T value1, U value2, V value3, int width=20){ //write four values to file file<<setw(width)<<left<<value0<<setw(width)<<left<<value1<<setw(width)<<left<<value2<<setw(width)<<left<<value3<<endl; } template <typename T> void writeFileVector(ofstream &file, vector<T> values, int width=10){ //write vector of values to file for(int i=0; i<values.size(); ++i){ file<<setw(width)<<left<<values[i]; } file<<endl; } template <typename T> void writeFileVector(ofstream &file, col_vector<T> values, int width=10){ //write vector of values to file for(int i=0; i<values.n; ++i){ file<<setw(width)<<left<<values[i]; } file<<endl; } template <typename T> void writeFileVectorTranspose(ofstream &file, vector<T> values, int width=10){ //write vector of values to file for(int i=0; i<values.size(); ++i){ file<<setw(width)<<left<<values[i]<<endl; } } template <typename T> void writeFileVectorTranspose(ofstream &file, col_vector<T> values, int width=10){ //write vector of values to file for(int i=0; i<values.n; ++i){ file<<setw(width)<<left<<values[i]<<endl; } } template <typename T> void writeFileArray(ofstream &file, T values, int n, bool endLine, int width=10){ //write array of values to file for(int i=0; i<n; ++i){ file<<setw(width)<<left<<values[i]; } if(endLine) file<<endl; } //#### reading from file #### void readFileSkipLines(ifstream &file, int nLines=1); template <typename T> void readFileValue(ifstream &file, T &value){ //read value from first column string line; getline(file,line); istringstream ss(line); ss >> value; } template <typename T> void readFileRowVector(ifstream &file, vector<T> &vec, int nCols){ //read in vector of n columns vec.clear(); string line; getline(file,line); istringstream ss(line); T val; for (int i=0; i<nCols; ++i){ ss >> val; vec.push_back(val); } } template <typename T> void readFileAll(ifstream &file, vector< vector<T> > &all){ all.clear(); string line; T value; vector<T> row; while(getline(file, line)){ istringstream ss(line); row.clear(); while(ss>>value) row.push_back(value); all.push_back(row); } } #endif //MX2_EASYIO_H
28.828767
123
0.652887
ec656ca552c0bdfcd5b35d0d1c4fe737ea3dbb53
2,948
c
C
2019/04-wpi/pwn-secureshell/decompile.c
wani-hackase/wani-writeup
dd4ad0607d2f2193ad94c1ce65359294aa591681
[ "MIT" ]
25
2019-03-06T11:55:56.000Z
2021-05-21T22:07:14.000Z
2019/04-wpi/pwn-secureshell/decompile.c
wani-hackase/wani-writeup
dd4ad0607d2f2193ad94c1ce65359294aa591681
[ "MIT" ]
1
2020-06-25T07:27:15.000Z
2020-06-25T07:27:15.000Z
2019/04-wpi/pwn-secureshell/decompile.c
wani-hackase/wani-writeup
dd4ad0607d2f2193ad94c1ce65359294aa591681
[ "MIT" ]
1
2019-02-14T00:42:28.000Z
2019-02-14T00:42:28.000Z
ulong checkpw(void) { int iVar1; int iVar2; ulong uVar3; char *__s2; char buf [104]; char *local_18; ulong local_10; iVar1 = rand(); iVar2 = rand(); uVar3 = (long)iVar2 ^ (long)iVar1 << 0x20; local_10 = uVar3; puts("Enter the password"); fgets(buf,0x100,stdin); local_18 = strchr(buf,10); if (local_18 != (char *)0x0) { *local_18 = 0; } __s2 = getenv("SECUREPASSWORD"); iVar1 = strcmp(buf, __s2); if (iVar1 != 0) { stakcheck(uVar3,local_10); } else { stakcheck(uVar3,local_10); } return (ulong)(iVar1 == 0); } /* WARNING: Removing unreachable block (ram,0x0040119d) */ /* WARNING: Removing unreachable block (ram,0x004011a9) */ void deregister_tm_clones(void) { return; } void FUN_00401020(void) { /* WARNING: Treating indirect jump as call */ (*(code *)(undefined *)0x0)(); return; } int init(EVP_PKEY_CTX *ctx) { int extraout_EAX; int local_18 [2]; int local_10; gettimeofday((timeval *)local_18,(__timezone_ptr_t)0x0); srand(local_18[0] * 1000000 + local_10); return extraout_EAX; } void logit(void) { FILE *__stream; char *pcVar1; int local_ac; char local_a8 [48]; undefined8 local_78; undefined8 local_70; MD5_CTX local_68; local_ac = rand(); MD5_Init(&local_68); MD5_Update(&local_68,&local_ac,4); MD5_Final((uchar *)&local_78,&local_68); sprintf(local_a8,"%lx%lx",local_78,local_70); puts("You.dumbass is not in the sudoers file. This incident will be reported."); printf("Incident UUID: %s\n",local_a8); __stream = fopen("/dev/null","w"); if (__stream != (FILE *)0x0) { if (times == 0) { pcVar1 = ""; }else{ pcVar1 = "(Again)"; } fprintf(__stream,"Incident %s: That dumbass forgot his password %s\n",local_a8,pcVar1); fclose(__stream); times = times + 1; } return; } void main(EVP_PKEY_CTX *pEParm1) { int iVar1; int count; init(pEParm1); puts("Welcome to the Super dooper securer shell! Now with dynamic stack canaries and incidentreporting!"); count = 0; do { if (count > 2){ LAB_00401487: puts("\nToo many wrong attempts, try again later"); return; } if (count != 0) { printf("\nattempt #%i\n",(ulong)(count + 1)); } iVar1 = checkpw(); if (iVar1 != 0) { shell(); goto LAB_00401487; } logit(); count = count + 1; } while( true ); } /* WARNING: Removing unreachable block (ram,0x004011df) */ /* WARNING: Removing unreachable block (ram,0x004011eb) */ void register_tm_clones(void) { return; } void shell(void) { execve("/bin/bash",(char **)0x0,(char **)0x0); /* WARNING: Subroutine does not return */ exit(0); } void stakcheck(long lParm1,long lParm2) { if (lParm1 == lParm2) { return; } puts("LARRY THE CANARY IS DEAD"); /* WARNING: Subroutine does not return */ exit(1); }
17.97561
108
0.609566
ec67163019d78ccb11483be83e44076225ab7618
9,145
h
C
01_article/00_camera_model/camera_model.h
iwatake2222/opencv_sample
5b817adaf3faf109da01ed307a7dc4553bfb7dbc
[ "Apache-2.0" ]
35
2021-09-02T12:30:49.000Z
2022-03-15T13:44:07.000Z
01_article/00_camera_model/camera_model.h
iwatake2222/opencv_sample
5b817adaf3faf109da01ed307a7dc4553bfb7dbc
[ "Apache-2.0" ]
3
2021-11-17T11:03:42.000Z
2022-02-22T19:16:09.000Z
01_article/00_camera_model/camera_model.h
iwatake2222/opencv_sample
5b817adaf3faf109da01ed307a7dc4553bfb7dbc
[ "Apache-2.0" ]
6
2021-09-03T04:25:25.000Z
2022-03-18T22:31:24.000Z
/* Copyright 2021 iwatake2222 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef CAMERA_MODEL_ #define CAMERA_MODEL_ /*** Include ***/ #include <cstdio> #include <cstdlib> #include <cstring> #define _USE_MATH_DEFINES #include <cmath> #include <string> #include <vector> #include <array> #include <opencv2/opencv.hpp> static inline float Deg2Rad(float deg) { return static_cast<float>(deg * M_PI / 180.0); } static inline float Rad2Deg(float rad) { return static_cast<float>(rad * 180.0 / M_PI); } static inline float FocalLength(int32_t image_size, float fov) { /* (w/2) / f = tan(fov/2) */ return (image_size / 2) / std::tan(Deg2Rad(fov / 2)); } class CameraModel { /*** * s[x, y, 1] = K * [R t] * [Mw, 1] * K: カメラの内部パラメータ * [R t]: カメラの外部パラメータ * R: ワールド座標上でのカメラの回転行列 (カメラの姿勢) * t: カメラ座標上での、カメラ位置(Oc)からワールド座標原点(Ow)へのベクトル= Ow - Oc * = -RT (T = ワールド座標上でのOwからOcへのベクトル) * Mw: ワールド座標上での対象物体の座標 (Xw, Yw, Zw) * s[x, y, 1] = K * Mc * Mc: カメラ座標上での対象物体の座標 (Xc, Yc, Zc) * = [R t] * [Mw, 1] * * 理由: Mc = R(Mw - T) = RMw - RT = RMw + t (t = -RT) * * 注意1: tはカメラ座標上でのベクトルである。そのため、Rを変更した場合はtを再計算する必要がある * * 注意2: 座標系は右手系。X+ = 右、Y+ = 下、Z+ = 奥 (例. カメラから見て物体が上にある場合、Ycは負値) ***/ public: /*** Intrinsic parameters ***/ /* float, 3 x 3 */ cv::Mat K; int32_t width; int32_t height; /*** Extrinsic parameters ***/ /* float, 3 x 1, pitch(rx), yaw(ry), roll(rz) [rad] */ cv::Mat rvec; /* float, 3 x 1, (tx, ty, tz): horizontal, vertical, depth (Camera location: Ow - Oc in camera coordinate) */ cv::Mat tvec; public: CameraModel() { /* Default Parameters */ SetIntrinsic(1280, 720, 500.0f); SetExtrinsic({ 0, 0, 0 }, { 0, 0, 0 }); } /*** Accessor for camera parameters ***/ float& rx() { return rvec.at<float>(0); } /* pitch */ float& ry() { return rvec.at<float>(1); } /* yaw */ float& rz() { return rvec.at<float>(2); } /* roll */ float& tx() { return tvec.at<float>(0); } float& ty() { return tvec.at<float>(1); } float& tz() { return tvec.at<float>(2); } float& fx() { return K.at<float>(0); } float& cx() { return K.at<float>(2); } float& fy() { return K.at<float>(4); } float& cy() { return K.at<float>(5); } /*** Methods for camera parameters ***/ void SetIntrinsic(int32_t width, int32_t height, float focal_length) { this->width = width; this->height = height; this->K = (cv::Mat_<float>(3, 3) << focal_length, 0, width / 2.f, 0, focal_length, height / 2.f, 0, 0, 1); } void SetExtrinsic(const std::array<float, 3>& rvec_deg, const std::array<float, 3>& tvec, bool is_t_on_world = true) { this->rvec = (cv::Mat_<float>(3, 1) << Deg2Rad(rvec_deg[0]), Deg2Rad(rvec_deg[1]), Deg2Rad(rvec_deg[2])); this->tvec = (cv::Mat_<float>(3, 1) << tvec[0], tvec[1], tvec[2]); /* is_t_on_world == true: tvec = T (Oc - Ow in world coordinate) is_t_on_world == false: tvec = tvec (Ow - Oc in camera coordinate) */ if (is_t_on_world) { cv::Mat R = MakeRotationMat(Rad2Deg(rx()), Rad2Deg(ry()), Rad2Deg(rz())); this->tvec = -R * this->tvec; /* t = -RT */ } } void GetExtrinsic(std::array<float, 3>& rvec_deg, std::array<float, 3>& tvec) { rvec_deg = { Rad2Deg(this->rvec.at<float>(0)), Rad2Deg(this->rvec.at<float>(1)) , Rad2Deg(this->rvec.at<float>(2)) }; tvec = { this->tvec.at<float>(0), this->tvec.at<float>(1), this->tvec.at<float>(2) }; } void SetCameraPos(float tx, float ty, float tz, bool is_on_world = true) /* Oc - Ow */ { this->tvec = (cv::Mat_<float>(3, 1) << tx, ty, tz); if (is_on_world) { cv::Mat R = MakeRotationMat(Rad2Deg(rx()), Rad2Deg(ry()), Rad2Deg(rz())); this->tvec = -R * this->tvec; /* t = -RT */ } else { /* Oc - Ow -> Ow - Oc */ this->tvec *= -1; } } void MoveCameraPos(float dtx, float dty, float dtz, bool is_on_world = true) /* Oc - Ow */ { cv::Mat tvec_delta = (cv::Mat_<float>(3, 1) << dtx, dty, dtz); if (is_on_world) { cv::Mat R = MakeRotationMat(Rad2Deg(rx()), Rad2Deg(ry()), Rad2Deg(rz())); tvec_delta = -R * tvec_delta; } else { /* Oc - Ow -> Ow - Oc */ tvec_delta *= -1; } this->tvec += tvec_delta; } void SetCameraAngle(float pitch_deg, float yaw_deg, float roll_deg) { /* t vec is vector in camera coordinate, so need to re-calculate it when rvec is updated */ cv::Mat R_old = MakeRotationMat(Rad2Deg(rx()), Rad2Deg(ry()), Rad2Deg(rz())); cv::Mat T = -R_old.inv() * this->tvec; /* T is tvec in world coordinate. t = -RT */ this->rvec = (cv::Mat_<float>(3, 1) << Deg2Rad(pitch_deg), Deg2Rad(yaw_deg), Deg2Rad(roll_deg)); cv::Mat R_new = MakeRotationMat(Rad2Deg(rx()), Rad2Deg(ry()), Rad2Deg(rz())); this->tvec = -R_new * T; /* t = -RT */ } void RotateCameraAngle(float dpitch_deg, float dyaw_deg, float droll_deg) { /* t vec is vector in camera coordinate, so need to re-calculate it when rvec is updated */ cv::Mat R_old = MakeRotationMat(Rad2Deg(rx()), Rad2Deg(ry()), Rad2Deg(rz())); cv::Mat T = -R_old.inv() * this->tvec; /* T is tvec in world coordinate. t = -RT */ cv::Mat R_delta = MakeRotationMat(dpitch_deg, dyaw_deg, droll_deg); cv::Mat R_new = R_delta * R_old; this->tvec = -R_new * T; /* t = -RT */ cv::Rodrigues(R_new, this->rvec); /* Rotation matrix -> rvec */ } /*** Methods for projection ***/ void ConvertWorld2Image(const std::vector<cv::Point3f>& object_point_list, std::vector<cv::Point2f>& image_point_list) { /* the followings get exactly the same result */ #if 1 /*** Projection ***/ /* s[x, y, 1] = K * [R t] * [M, 1] = K * M_from_cam */ cv::Mat K = this->K; cv::Mat R = MakeRotationMat(Rad2Deg(this->rx()), Rad2Deg(this->ry()), Rad2Deg(this->rz())); cv::Mat Rt = (cv::Mat_<float>(3, 4) << R.at<float>(0), R.at<float>(1), R.at<float>(2), this->tx(), R.at<float>(3), R.at<float>(4), R.at<float>(5), this->ty(), R.at<float>(6), R.at<float>(7), R.at<float>(8), this->tz()); image_point_list.resize(object_point_list.size()); for (int32_t i = 0; i < object_point_list.size(); i++) { const auto& object_point = object_point_list[i]; auto& image_point = image_point_list[i]; cv::Mat Mw = (cv::Mat_<float>(4, 1) << object_point.x, object_point.y, object_point.z, 1); cv::Mat Mc = Rt * Mw; float Zc = Mc.at<float>(2); if (Zc <= 0) { /* Do not project points behind the camera */ image_point = cv::Point2f(-1, -1); continue; } cv::Mat XY = K * Mc; float x = XY.at<float>(0); float y = XY.at<float>(1); float s = XY.at<float>(2); x /= s; y /= s; image_point.x = x; image_point.y = y; } #else cv::projectPoints(object_point_list, this->rvec, this->tvec, this->K, cv::Mat(), image_point_list); #endif } /*** Other methods ***/ template <typename T = float> static cv::Mat MakeRotationMat(T x_deg, T y_deg, T z_deg) { T x_rad = Deg2Rad(x_deg); T y_rad = Deg2Rad(y_deg); T z_rad = Deg2Rad(z_deg); #if 0 /* Rotation Matrix with Euler Angle */ cv::Mat R_x = (cv::Mat_<T>(3, 3) << 1, 0, 0, 0, std::cos(x_rad), -std::sin(x_rad), 0, std::sin(x_rad), std::cos(x_rad)); cv::Mat R_y = (cv::Mat_<T>(3, 3) << std::cos(y_rad), 0, std::sin(y_rad), 0, 1, 0, -std::sin(y_rad), 0, std::cos(y_rad)); cv::Mat R_z = (cv::Mat_<T>(3, 3) << std::cos(z_rad), -std::sin(z_rad), 0, std::sin(z_rad), std::cos(z_rad), 0, 0, 0, 1); cv::Mat R = R_z * R_x * R_y; #else /* Rodrigues */ cv::Mat rvec = (cv::Mat_<T>(3, 1) << x_rad, y_rad, z_rad); cv::Mat R; cv::Rodrigues(rvec, R); #endif return R; } }; #endif
36.726908
125
0.534062
ec6734a3b2b0991e25766a40bd22adbd73d6d49b
2,672
h
C
src/crypto/pem.h
Jerryxia32/CCF
2514a92ff96ca22aff37994d211ace2e1c918097
[ "Apache-2.0" ]
530
2019-05-07T03:07:15.000Z
2022-03-29T16:33:06.000Z
src/crypto/pem.h
Jerryxia32/CCF
2514a92ff96ca22aff37994d211ace2e1c918097
[ "Apache-2.0" ]
3,393
2019-05-07T08:33:32.000Z
2022-03-31T14:57:14.000Z
src/crypto/pem.h
beejones/CCF
335fc3613c2dd4a3bda38e10e8e8196dba52465e
[ "Apache-2.0" ]
158
2019-05-07T09:17:56.000Z
2022-03-25T16:45:04.000Z
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the Apache 2.0 License. #pragma once #include "ds/buffer.h" #include "ds/json.h" #include <cstring> #include <exception> #include <memory> #include <string_view> #include <vector> namespace crypto { // Convenience class ensuring null termination of PEM-encoded certificates as // required by mbedTLS class Pem { std::string s; public: Pem() = default; Pem(const std::string& s_) : s(s_) {} Pem(size_t size) : s(size, '0') {} Pem(const uint8_t* data, size_t size) { if (size == 0) throw std::logic_error("Got PEM of size 0."); // If it's already null-terminated, don't suffix again const auto null_terminated = *(data + size - 1) == 0; if (null_terminated) size -= 1; s.assign(reinterpret_cast<const char*>(data), size); } Pem(const CBuffer& b) : Pem(b.p, b.n) {} Pem(const std::vector<uint8_t>& v) : Pem(v.data(), v.size()) {} bool operator==(const Pem& rhs) const { return s == rhs.s; } bool operator!=(const Pem& rhs) const { return !(*this == rhs); } bool operator<(const Pem& rhs) const { return s < rhs.s; } const std::string& str() const { return s; } uint8_t* data() { return reinterpret_cast<uint8_t*>(s.data()); } const uint8_t* data() const { return reinterpret_cast<const uint8_t*>(s.data()); } size_t size() const { // +1 for null termination return s.size() + 1; } bool empty() const { return s.empty(); } std::vector<uint8_t> raw() const { return {data(), data() + size()}; } // Not null-terminated std::vector<uint8_t> contents() const { return {data(), data() + s.size()}; } }; inline void to_json(nlohmann::json& j, const Pem& p) { j = p.str(); } inline void from_json(const nlohmann::json& j, Pem& p) { if (j.is_string()) { p = Pem(j.get<std::string>()); } else if (j.is_array()) { p = Pem(j.get<std::vector<uint8_t>>()); } else { throw std::runtime_error( fmt::format("Unable to parse pem from this JSON: {}", j.dump())); } } inline std::string schema_name(const Pem&) { return "Pem"; } inline void fill_json_schema(nlohmann::json& schema, const Pem&) { schema["type"] = "string"; } } namespace std { template <> struct hash<crypto::Pem> { size_t operator()(const crypto::Pem& pem) const { return std::hash<std::string>()(pem.str()); } }; }
18.816901
79
0.55988
ec697830bec5d9832361c494390ff71a8138819f
12,512
c
C
new/libr/anal/reflines.c
benbenwt/lisa_docker
0b851223dbaecef9b27c418eae05890fea752d49
[ "Apache-2.0" ]
null
null
null
new/libr/anal/reflines.c
benbenwt/lisa_docker
0b851223dbaecef9b27c418eae05890fea752d49
[ "Apache-2.0" ]
1
2021-12-17T00:14:27.000Z
2021-12-17T00:14:27.000Z
new/libr/anal/reflines.c
benbenwt/lisa_docker
0b851223dbaecef9b27c418eae05890fea752d49
[ "Apache-2.0" ]
null
null
null
/* radare - LGPL - Copyright 2009-2020 - pancake, nibble */ #include <r_core.h> #include <r_util.h> #include <r_cons.h> #define mid_down_refline(a, r) ((r)->from > (r)->to && (a) < (r)->from && (a) > (r)->to) #define mid_up_refline(a, r) ((r)->from < (r)->to && (a) > (r)->from && (a) < (r)->to) #define mid_refline(a, r) (mid_down_refline (a, r) || mid_up_refline (a, r)) #define in_refline(a, r) (mid_refline (a, r) || (a) == (r)->from || (a) == (r)->to) typedef struct refline_end { int val; bool is_from; RAnalRefline *r; } ReflineEnd; static int cmp_asc(const struct refline_end *a, const struct refline_end *b) { return (a->val > b->val) - (a->val < b->val); } static int cmp_by_ref_lvl(const RAnalRefline *a, const RAnalRefline *b) { return (a->level < b->level) - (a->level > b->level); } static ReflineEnd *refline_end_new(ut64 val, bool is_from, RAnalRefline *ref) { ReflineEnd *re = R_NEW0 (struct refline_end); if (!re) { return NULL; } re->val = val; re->is_from = is_from; re->r = ref; return re; } static bool add_refline(RList *list, RList *sten, ut64 addr, ut64 to, int *idx) { ReflineEnd *re1, *re2; RAnalRefline *item = R_NEW0 (RAnalRefline); if (!item) { return false; } item->from = addr; item->to = to; item->index = *idx; item->level = -1; item->direction = (to > addr)? 1: -1; *idx += 1; r_list_append (list, item); re1 = refline_end_new (item->from, true, item); if (!re1) { free (item); return false; } r_list_add_sorted (sten, re1, (RListComparator)cmp_asc); re2 = refline_end_new (item->to, false, item); if (!re2) { free (re1); free (item); return false; } r_list_add_sorted (sten, re2, (RListComparator)cmp_asc); return true; } R_API void r_anal_reflines_free (RAnalRefline *rl) { free (rl); } /* returns a list of RAnalRefline for the code present in the buffer buf, of * length len. A RAnalRefline exists from address A to address B if a jmp, * conditional jmp or call instruction exists at address A and it targets * address B. * * nlines - max number of lines of code to consider * linesout - true if you want to display lines that go outside of the scope [addr;addr+len) * linescall - true if you want to display call lines */ R_API RList *r_anal_reflines_get(RAnal *anal, ut64 addr, const ut8 *buf, ut64 len, int nlines, int linesout, int linescall) { RList *list, *sten; RListIter *iter; RAnalOp op; struct refline_end *el; const ut8 *ptr = buf; const ut8 *end = buf + len; ut8 *free_levels; int sz = 0, count = 0; ut64 opc = addr; memset (&op, 0, sizeof (op)); /* * 1) find all reflines * 2) sort "from"s and "to"s in a list * 3) traverse the list to find the minimum available level for each refline * * create a sorted list with available levels. * * when we encounter a previously unseen "from" or "to" of a * refline, we occupy the lowest level available for it. * * when we encounter the "from" or "to" of an already seen * refline, we free that level. */ list = r_list_newf (free); if (!list) { return NULL; } sten = r_list_newf ((RListFree)free); if (!sten) { goto list_err; } r_cons_break_push (NULL, NULL); /* analyze code block */ while (ptr < end && !r_cons_is_breaked ()) { if (nlines != -1) { if (!nlines) { break; } nlines--; } if (anal->maxreflines && count > anal->maxreflines) { break; } addr += sz; { RPVector *metas = r_meta_get_all_at (anal, addr); if (metas) { void **it; ut64 skip = 0; r_pvector_foreach (metas, it) { RIntervalNode *node = *it; RAnalMetaItem *meta = node->data; switch (meta->type) { case R_META_TYPE_DATA: case R_META_TYPE_STRING: case R_META_TYPE_HIDE: case R_META_TYPE_FORMAT: case R_META_TYPE_MAGIC: skip = r_meta_node_size (node); goto do_skip; default: break; } } do_skip: r_pvector_free (metas); if (skip) { ptr += skip; addr += skip; goto __next; } } } if (!anal->iob.is_valid_offset (anal->iob.io, addr, 1)) { const int size = 4; ptr += size; addr += size; goto __next; } // This can segfault if opcode length and buffer check fails r_anal_op_fini (&op); int rc = r_anal_op (anal, &op, addr, ptr, (int)(end - ptr), R_ANAL_OP_MASK_BASIC | R_ANAL_OP_MASK_HINT); if (rc <= 0) { sz = 1; goto __next; } sz = op.size; if (sz <= 0) { sz = 1; goto __next; } /* store data */ switch (op.type) { case R_ANAL_OP_TYPE_CALL: if (!linescall) { break; } case R_ANAL_OP_TYPE_CJMP: case R_ANAL_OP_TYPE_JMP: if ((!linesout && (op.jump > opc + len || op.jump < opc)) || !op.jump) { break; } if (!add_refline (list, sten, addr, op.jump, &count)) { r_anal_op_fini (&op); goto sten_err; } // add false branch in case its set and its not a call, useful for bf, maybe others if (!op.delay && op.fail != UT64_MAX && op.fail != addr + op.size) { if (!add_refline (list, sten, addr, op.fail, &count)) { r_anal_op_fini (&op); goto sten_err; } } break; case R_ANAL_OP_TYPE_SWITCH: { RAnalCaseOp *caseop; RListIter *iter; // add caseops if (!op.switch_op) { break; } r_list_foreach (op.switch_op->cases, iter, caseop) { if (!linesout && (op.jump > opc + len || op.jump < opc)) { goto __next; } if (!add_refline (list, sten, op.switch_op->addr, caseop->jump, &count)) { r_anal_op_fini (&op); goto sten_err; } } break; } } __next: ptr += sz; } r_anal_op_fini (&op); r_cons_break_pop (); free_levels = R_NEWS0 (ut8, r_list_length (list) + 1); if (!free_levels) { goto sten_err; } int min = 0; r_list_foreach (sten, iter, el) { if ((el->is_from && el->r->level == -1) || (!el->is_from && el->r->level == -1)) { el->r->level = min + 1; free_levels[min] = 1; if (min < 0) { min = 0; } while (free_levels[++min] == 1) { ; } } else { free_levels[el->r->level - 1] = 0; if (min > el->r->level - 1) { min = el->r->level - 1; } } } /* XXX: the algorithm can be improved. We can calculate the set of * reflines used in each interval of addresses and store them. * Considering r_anal_reflines_str is always called with increasing * addresses, we can just traverse linearly the list of intervals to * know which reflines need to be drawn for each address. In this way, * we don't need to traverse again and again the reflines for each call * to r_anal_reflines_str, but we can reuse the data already * calculated. Those data will be quickly available because the * intervals will be sorted and the addresses to consider are always * increasing. */ free (free_levels); r_list_free (sten); return list; sten_err: list_err: r_list_free (sten); r_list_free (list); return NULL; } R_API int r_anal_reflines_middle(RAnal *a, RList* /*<RAnalRefline>*/ list, ut64 addr, int len) { if (a && list) { RAnalRefline *ref; RListIter *iter; r_list_foreach (list, iter, ref) { if ((ref->to > addr) && (ref->to < addr + len)) { return true; } } } return false; } static const char* get_corner_char(RAnalRefline *ref, ut64 addr, bool is_middle_before) { if (ref->from == ref->to) { return "@"; } if (addr == ref->to) { if (is_middle_before) { return (ref->from > ref->to) ? " " : "|"; } return (ref->from > ref->to) ? "." : "`"; } if (addr == ref->from) { if (is_middle_before) { return (ref->from > ref->to) ? "|" : " "; } return (ref->from > ref->to) ? "`" : ","; } return ""; } static void add_spaces(RBuffer *b, int level, int pos, bool wide) { if (pos != -1) { if (wide) { pos *= 2; level *= 2; } if (pos > level + 1) { const char *pd = r_str_pad (' ', pos - level - 1); r_buf_append_string (b, pd); } } } static void fill_level(RBuffer *b, int pos, char ch, RAnalRefline *r, bool wide) { int sz = r->level; if (wide) { sz *= 2; } const char *pd = r_str_pad (ch, sz - 1); if (pos == -1) { r_buf_append_string (b, pd); } else { int pdlen = strlen (pd); if (pdlen > 0) { r_buf_write_at (b, pos, (const ut8 *)pd, pdlen); } } } static inline bool refline_kept(RAnalRefline *ref, bool middle_after, ut64 addr) { if (middle_after) { if (ref->direction < 0) { if (ref->from == addr) { return false; } } else { if (ref->to == addr) { return false; } } } return true; } // TODO: move into another file // TODO: this is TOO SLOW. do not iterate over all reflines or gtfo R_API RAnalRefStr *r_anal_reflines_str(void *_core, ut64 addr, int opts) { RCore *core = _core; RCons *cons = core->cons; RAnal *anal = core->anal; RBuffer *b; RBuffer *c; RListIter *iter; RAnalRefline *ref; int l; bool wide = opts & R_ANAL_REFLINE_TYPE_WIDE; int dir = 0, pos = -1, max_level = -1; bool middle_before = opts & R_ANAL_REFLINE_TYPE_MIDDLE_BEFORE; bool middle_after = opts & R_ANAL_REFLINE_TYPE_MIDDLE_AFTER; char *str = NULL; char *col_str = NULL; r_return_val_if_fail (cons && anal && anal->reflines, NULL); RList *lvls = r_list_new (); if (!lvls) { return NULL; } r_list_foreach (anal->reflines, iter, ref) { if (cons->context && cons->context->breaked) { r_list_free (lvls); return NULL; } if (in_refline (addr, ref) && refline_kept (ref, middle_after, addr)) { r_list_add_sorted (lvls, (void *)ref, (RListComparator)cmp_by_ref_lvl); } } b = r_buf_new (); c = r_buf_new (); r_buf_append_string (c, " "); r_buf_append_string (b, " "); r_list_foreach (lvls, iter, ref) { if (cons->context && cons->context->breaked) { r_list_free (lvls); r_buf_free (b); r_buf_free (c); return NULL; } if ((ref->from == addr || ref->to == addr) && !middle_after) { const char *corner = get_corner_char (ref, addr, middle_before); const char ch = ref->from == addr ? '=' : '-'; const char ch_col = ref->from >= ref->to ? 't': 'd'; const char *col = (ref->from >= ref->to) ? "t" : "d"; if (!pos) { int ch_pos = max_level + 1 - ref->level; if (wide) { ch_pos = ch_pos * 2 - 1; } r_buf_write_at (b, ch_pos, (ut8 *)corner, 1); r_buf_write_at (c, ch_pos, (ut8 *)col, 1); fill_level (b, ch_pos + 1, ch, ref, wide); fill_level (c, ch_pos + 1, ch_col, ref, wide); } else { add_spaces (b, ref->level, pos, wide); add_spaces (c, ref->level, pos, wide); r_buf_append_string (b, corner); r_buf_append_string (c, col); if (!middle_before) { fill_level (b, -1, ch, ref, wide); fill_level (c, -1, ch_col, ref, wide); } } if (!middle_before) { dir = ref->to == addr ? 1 : 2; } pos = middle_before ? ref->level : 0; } else { if (!pos) { continue; } add_spaces (b, ref->level, pos, wide); add_spaces (c, ref->level, pos, wide); if (ref->from >= ref->to) { r_buf_append_string (b, ":"); r_buf_append_string (c, "t"); } else { r_buf_append_string (b, "|"); r_buf_append_string (c, "d"); } pos = ref->level; } if (max_level == -1) { max_level = ref->level; } } add_spaces (c, 0, pos, wide); add_spaces (b, 0, pos, wide); str = r_buf_to_string (b); col_str = r_buf_to_string (c); r_buf_free (b); r_buf_free (c); b = NULL; c = NULL; if (!str || !col_str) { r_list_free (lvls); //r_buf_free_to_string already free b and if that is the case //b will be NULL and r_buf_free will return but if there was //an error we free b here so in other words is safe r_buf_free (b); r_buf_free (c); return NULL; } if (core->anal->lineswidth > 0) { int lw = core->anal->lineswidth; l = strlen (str); if (l > lw) { r_str_cpy (str, str + l - lw); r_str_cpy (col_str, col_str + l - lw); } else { char pfx[128]; lw -= l; memset (pfx, ' ', sizeof (pfx)); if (lw >= sizeof (pfx)) { lw = sizeof (pfx)-1; } if (lw > 0) { pfx[lw] = 0; str = r_str_prepend (str, pfx); col_str = r_str_prepend (col_str, pfx); } } } const char prev_col = col_str[strlen (col_str) - 1]; const char *arr_col = prev_col == 't' ? "tt ": "dd "; str = r_str_append (str, (dir == 1) ? "-> " : (dir == 2) ? "=< " : " "); col_str = r_str_append (col_str, arr_col); r_list_free (lvls); RAnalRefStr *out = R_NEW0 (RAnalRefStr); out->str = str; out->cols = col_str; return out; } R_API void r_anal_reflines_str_free(RAnalRefStr *refstr) { free (refstr->str); free (refstr->cols); free (refstr); }
25.534694
125
0.610374
ec69c9a7e9db93c77b4638bf8c4174915573fe68
597
c
C
samples/dlltest/loaddll.c
davidwed/cegcc-mingw
10c0dd68c5acab870d52a6fe0f887d635f2d1604
[ "LPPL-1.3c" ]
6
2016-03-15T14:58:59.000Z
2021-01-31T03:15:59.000Z
samples/dlltest/loaddll.c
davidwed/cegcc-mingw
10c0dd68c5acab870d52a6fe0f887d635f2d1604
[ "LPPL-1.3c" ]
null
null
null
samples/dlltest/loaddll.c
davidwed/cegcc-mingw
10c0dd68c5acab870d52a6fe0f887d635f2d1604
[ "LPPL-1.3c" ]
7
2017-04-19T01:34:23.000Z
2022-01-21T14:50:23.000Z
/* * This version attempts to load dll.dll dynamically, get the address of the * Add function, and then call it. */ #include <stdio.h> #include <windows.h> int (*Add)(int x, int y); int main() { HINSTANCE hDll; int i, j, k; hDll = LoadLibrary ("dll.dll"); if (!hDll) { printf ("Error %d loading dll.\n", GetLastError()); exit (-1); } if (!(Add = GetProcAddress (hDll, "Add"))) { printf ("Error %d getting Add function.\n", GetLastError()); exit (-1); } i = 10; j = 13; k = Add(i, j); printf ("i %d, j %d, k %d\n", i, j, k); FreeLibrary (hDll); return 0; }
14.560976
76
0.574539
ec69ddc8e67c325bfec8844e3e6c72d18d358152
6,097
h
C
plat/mediatek/mt8183/include/mt_gic_v3.h
kennyliang-mtk/arm-trusted-firmware
8828941020176503d980142d4643564046c63fd0
[ "BSD-3-Clause" ]
null
null
null
plat/mediatek/mt8183/include/mt_gic_v3.h
kennyliang-mtk/arm-trusted-firmware
8828941020176503d980142d4643564046c63fd0
[ "BSD-3-Clause" ]
null
null
null
plat/mediatek/mt8183/include/mt_gic_v3.h
kennyliang-mtk/arm-trusted-firmware
8828941020176503d980142d4643564046c63fd0
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef MT_GIC_V3_H #define MT_GIC_V3_H #include <lib/mmio.h> enum irq_schedule_mode { SW_MODE, HW_MODE, }; #define GIC_INT_MASK (MCUCFG_BASE + 0x5e8) #define GIC500_ACTIVE_SEL_SHIFT 3 #define GIC500_ACTIVE_SEL_MASK (0x7 << GIC500_ACTIVE_SEL_SHIFT) #define GIC500_ACTIVE_CPU_SHIFT 16 #define GIC500_ACTIVE_CPU_MASK (0xff << GIC500_ACTIVE_CPU_SHIFT) #define SGI_MASK 0xffff void setup_int_schedule_mode(enum irq_schedule_mode mode, unsigned int active_cpu); void int_schedule_mode_save(void); void int_schedule_mode_restore(void); void gic_rdist_save(void); void gic_rdist_restore(void); void gic_rdist_restore_all(void); void gic_sgi_save_all(void); void gic_sgi_restore_all(void); void gic_cpuif_deactivate(unsigned int gicc_base); void gic_dist_save(void); void gic_dist_restore(void); void gic_setup(void); /* distributor registers & their field definitions, in secure world */ #define GICD_V3_CTLR 0x0000 #define GICD_V3_TYPER 0x0004 #define GICD_V3_IIDR 0x0008 #define GICD_V3_STATUSR 0x0010 #define GICD_V3_SETSPI_NSR 0x0040 #define GICD_V3_CLRSPI_NSR 0x0048 #define GICD_V3_SETSPI_SR 0x0050 #define GICD_V3_CLRSPI_SR 0x0058 #define GICD_V3_SEIR 0x0068 #define GICD_V3_ISENABLER 0x0100 #define GICD_V3_ICENABLER 0x0180 #define GICD_V3_ISPENDR 0x0200 #define GICD_V3_ICPENDR 0x0280 #define GICD_V3_ISACTIVER 0x0300 #define GICD_V3_ICACTIVER 0x0380 #define GICD_V3_IPRIORITYR 0x0400 #define GICD_V3_ICFGR 0x0C00 #define GICD_V3_IROUTER 0x6000 #define GICD_V3_PIDR2 0xFFE8 #define GICD_V3_CTLR_RWP (1U << 31) #define GICD_V3_CTLR_E1NWF (1U << 7) #define GICD_V3_CTLR_DS (1U << 6) #define GICD_V3_CTLR_ARE_NS (1U << 5) #define GICD_V3_CTLR_ARE_S (1U << 4) #define GICD_V3_CTLR_ENABLE_G1S (1U << 2) #define GICD_V3_CTLR_ENABLE_G1NS (1U << 1) #define GICD_V3_CTLR_ENABLE_G0 (1U << 0) #define GICD_V3_TYPER_ID_BITS(typer) ((((typer) >> 19) & 0x1f) + 1) #define GICD_V3_TYPER_IRQS(typer) ((((typer) & 0x1f) + 1) * 32) #define GICD_V3_TYPER_LPIS (1U << 17) #define GICD_V3_IROUTER_SPI_MODE_ONE (0U << 31) #define GICD_V3_IROUTER_SPI_MODE_ANY (1U << 31) #define GIC_V3_PIDR2_ARCH_MASK 0xf0 #define GIC_V3_PIDR2_ARCH_GICv3 0x30 #define GIC_V3_PIDR2_ARCH_GICv4 0x40 /* * Re-Distributor registers, offsets from RD_base */ #define GICR_V3_CTLR GICD_V3_CTLR #define GICR_V3_IIDR 0x0004 #define GICR_V3_TYPER 0x0008 #define GICR_V3_STATUSR GICD_V3_STATUSR #define GICR_V3_WAKER 0x0014 #define GICR_V3_SETLPIR 0x0040 #define GICR_V3_CLRLPIR 0x0048 #define GICR_V3_SEIR GICD_V3_SEIR #define GICR_V3_PROPBASER 0x0070 #define GICR_V3_PENDBASER 0x0078 #define GICE_V3_IGROUP0 0x0080 #define GICR_V3_INVLPIR 0x00A0 #define GICR_V3_INVALLR 0x00B0 #define GICR_V3_SYNCR 0x00C0 #define GICR_V3_MOVLPIR 0x0100 #define GICR_V3_MOVALLR 0x0110 #define GICE_V3_IGRPMOD0 0x0d00 #define GICR_V3_PIDR2 GICD_V3_PIDR2 #define GICR_V3_CTLR_ENABLE_LPIS (1UL << 0) #define GICR_V3_TYPER_CPU_NUMBER(r) (((r) >> 8) & 0xffff) #define GICR_V3_WAKER_ProcessorSleep (1U << 1) #define GICR_V3_WAKER_ChildrenAsleep (1U << 2) #define GICR_V3_PROPBASER_NonShareable (0U << 10) #define GICR_V3_PROPBASER_InnerShareable (1U << 10) #define GICR_V3_PROPBASER_OuterShareable (2U << 10) #define GICR_V3_PROPBASER_SHAREABILITY_MASK (3UL << 10) #define GICR_V3_PROPBASER_nCnB (0U << 7) #define GICR_V3_PROPBASER_nC (1U << 7) #define GICR_V3_PROPBASER_RaWt (2U << 7) #define GICR_V3_PROPBASER_RaWb (3U << 7) #define GICR_V3_PROPBASER_WaWt (4U << 7) #define GICR_V3_PROPBASER_WaWb (5U << 7) #define GICR_V3_PROPBASER_RaWaWt (6U << 7) #define GICR_V3_PROPBASER_RaWaWb (7U << 7) #define GICR_V3_PROPBASER_IDBITS_MASK (0x1f) /* * Re-Distributor registers, offsets from SGI_base */ #define GICR_V3_ISENABLER0 GICD_V3_ISENABLER #define GICR_V3_ICENABLER0 GICD_V3_ICENABLER #define GICR_V3_ISPENDR0 GICD_V3_ISPENDR #define GICR_V3_ICPENDR0 GICD_V3_ICPENDR #define GICR_V3_ISACTIVER0 GICD_V3_ISACTIVER #define GICR_V3_ICACTIVER0 GICD_V3_ICACTIVER #define GICR_V3_IPRIORITYR0 GICD_V3_IPRIORITYR #define GICR_V3_ICFGR0 GICD_V3_ICFGR #define GICR_V3_TYPER_PLPIS (1U << 0) #define GICR_V3_TYPER_VLPIS (1U << 1) #define GICR_V3_TYPER_LAST (1U << 4) static inline unsigned int gicd_v3_read_ctlr(unsigned int base) { return mmio_read_32(base + GICD_V3_CTLR); } static inline void gicd_v3_write_ctlr(unsigned int base, unsigned int val) { mmio_write_32(base + GICD_V3_CTLR, val); } static inline unsigned int gicd_v3_read_pidr2(unsigned int base) { return mmio_read_32(base + GICD_V3_PIDR2); } static inline void gicd_v3_set_irouter(unsigned int base, unsigned int id, uint64_t aff) { unsigned int reg = base + GICD_V3_IROUTER + (id*8); mmio_write_64(reg, aff); } #endif /* MT_GIC_V3_H */
39.335484
88
0.63277
ec6a88f5ec4b5d735a09e717077ae872bad0617f
7,538
h
C
n_array/include/satyr/n_array/n_array.h
rnburn/satyr
07f336dfd75a73d63d0573245847f03b7700304c
[ "MIT" ]
8
2017-07-03T09:24:36.000Z
2021-07-21T07:36:58.000Z
n_array/include/satyr/n_array/n_array.h
rnburn/satyr
07f336dfd75a73d63d0573245847f03b7700304c
[ "MIT" ]
4
2020-01-10T21:06:07.000Z
2020-09-26T13:24:58.000Z
n_array/include/satyr/n_array/n_array.h
rnburn/satyr
07f336dfd75a73d63d0573245847f03b7700304c
[ "MIT" ]
3
2018-12-08T17:31:37.000Z
2021-04-28T15:22:06.000Z
#pragma once #include <satyr/n_array/structure.h> #include <satyr/n_array/n_array_accessor.h> #include <satyr/n_array/n_array_assignment.h> #include <satyr/n_array/n_array_expression.h> #include <satyr/n_array/n_array_evaluator.h> #include <satyr/n_array/n_array_view.h> #include <satyr/n_array/n_array_subview.h> #include <satyr/n_array/utility.h> #include <satyr/k_array.h> #include <stdexcept> namespace satyr { //------------------------------------------------------------------------------ // n_array //------------------------------------------------------------------------------ namespace detail { template <class, class T, size_t K, class Structure> class n_array_impl; template <size_t... Indexes, class T, size_t K, class Structure> class n_array_impl<std::index_sequence<Indexes...>, T, K, Structure> : public n_array_cview<T, K, Structure>, public n_array_accessor< n_array_impl<std::index_sequence<Indexes...>, T, K, Structure>, K, Structure> { using base = n_array_cview<T, K, Structure>; public: using structure = Structure; // constructors n_array_impl() = default; n_array_impl(n_array_impl&& other) noexcept { move_assign(other); } explicit n_array_impl(const satyr::shape<K>& shape) { if constexpr (is_equal_dimensional_v<Structure>) { if (!is_equal_dimensional(shape)) { std::cerr << "shape must be equal dimensional\n"; std::terminate(); } } T* data; if (get_num_elements(shape)) data = scalar_allocate<T>(get_num_elements(shape)); else data = nullptr; static_cast<base&>(*this) = {data, shape}; } explicit n_array_impl(std::enable_if_t<(Indexes, true), index_t>... extents) requires !is_equal_dimensional_v<Structure> : n_array_impl{satyr::shape<K>{extents...}} {} explicit n_array_impl(index_t extent) requires is_equal_dimensional_v<Structure> : n_array_impl{satyr::shape<K>{((void)Indexes, extent)...}} {} n_array_impl(initializer_multilist<T, K> values) : n_array_impl{shape<K>{detail::get_extents<T, K>(values)}} { auto array = this->as_k_array(); detail::initialize<T, K>(values, [array](auto... indexes) -> auto& { return array(indexes...); }); } // destructor ~n_array_impl() { if (this->data()) scalar_deallocate(this->data()); } // operator= n_array_impl& operator=(n_array_impl&& other) noexcept { move_assign(other); return *this; } n_array_impl& operator=(const n_array_impl& other) { if (data() == other.data()) return *this; copy_assign(other.data(), other.shape()); return *this; } template <class OtherT> n_array_impl& operator=(const n_array_impl<std::index_sequence<Indexes...>, OtherT, K, Structure>& other) { if constexpr (std::is_same_v<T, OtherT>) { if (data() == other.data()) return *this; } copy_assign(other.data(), other.shape()); return *this; } template <class OtherT> n_array_impl& operator=(const n_array_view<OtherT, K, Structure>& other) { copy_assign(other.data(), other.shape()); return *this; } n_array_impl& operator=(detail::initializer_multilist<T, K> values) { auto extents_new = detail::get_extents<T, K>(values); reshape(extents_new); auto k_array = this->as_k_array(); detail::initialize<T, K>(values, [=](auto... indexes) -> T& { return k_array(indexes...); }); return *this; } // accessors using base::data; T* data() { return const_cast<T*>(base::data()); } using base::as_k_array; const k_array_view<T, K>& as_k_array() { return reinterpret_cast<const k_array_view<T, K>&>( *static_cast<base*>(this)); } // reshape void reshape(const shape<K>& shape_new) { if constexpr (is_equal_dimensional_v<Structure>) { if (!is_equal_dimensional(shape_new)) { std::cerr << "shape must be equal dimensional\n"; std::terminate(); } } auto num_elements = get_num_elements(this->shape()); auto num_elements_new = get_num_elements(shape_new); if (num_elements == num_elements_new) return; T* data_new; if (num_elements_new == 0) { scalar_deallocate(this->data()); data_new = nullptr; } else if (num_elements) { data_new = scalar_reallocate(this->data(), num_elements_new); } else { data_new = scalar_allocate<T>(num_elements_new); } static_cast<base&>(*this) = {data_new, shape_new}; } // operator() using n_array_accessor<n_array_impl, K, Structure>::operator(); // conversion operator n_array_subview<T, K, Structure>() { return {data(), subshape<K>{this->shape()}}; } operator n_array_view<T, K, Structure>() { return {data(), this->shape()}; } // iteration using base::begin; using base::end; T* begin() const requires std::is_same_v<Structure, general_structure> { return const_cast<T*>(base::begin()); } T* end() const requires std::is_same_v<Structure, general_structure> { return const_cast<T*>(base::end()); } private: void move_assign(n_array_impl& other) noexcept { if (data() == other.data()) return; static_cast<base&>(*this) = static_cast<base&>(other); static_cast<base&>(other) = {nullptr, shape<K>{}}; } template <class OtherT, class OtherShape> void copy_assign(const OtherT* other_data, const OtherShape& other_shape) { reshape(other_shape); auto lhs = make_expression( make_n_array_view<Structure>(this->data(), this->shape())); auto rhs = make_expression(make_n_array_view<Structure>(other_data, other_shape)); apply(equals_functor{}, lhs, rhs); } }; } template <Scalar T, size_t K, Structure Structure> class n_array : public detail::n_array_impl<std::make_index_sequence<K>, T, K, Structure>, public n_array_assignment< n_array<T, K, Structure>, n_array_expression<K, Structure, flat_n_array_evaluator<T>, no_policy>> { using base = detail::n_array_impl<std::make_index_sequence<K>, T, K, Structure>; public: using base::base; using base::operator=; using n_array_assignment< n_array, n_array_expression<K, Structure, flat_n_array_evaluator<T>, no_policy>>::operator=; // constructors n_array(const n_array& other) : n_array{static_cast<const n_array_cview<T, K, Structure>&>(other)} {} template <Scalar OtherT, class OtherStructure> requires detail::have_common_structure_v< n_array, n_array_view<OtherT, K, OtherStructure>> n_array(const n_array_view<OtherT, K, OtherStructure>& other) { this->reshape(other.shape()); *this = make_expression(other); } template <Scalar OtherT, class OtherStructure> requires detail::have_common_structure_v< n_array, n_array_view<OtherT, K, OtherStructure>> n_array(const n_array_subview<OtherT, K, OtherStructure>& other) { this->reshape(other.shape()); *this = make_expression(other); } n_array(n_array&& other) noexcept : base{static_cast<base&&>(std::move(other))} {} // assignment n_array& operator=(n_array&& other) noexcept { *this = static_cast<base&&>(std::move(other)); return *this; } n_array& operator=(const n_array& other) { this->reshape(other.shape()); *this = make_expression(other); return *this; } }; } // namespace satyr
30.273092
80
0.638764
ec6a8ed83ad82401812a13d0d709853fde8d6c51
1,465
h
C
src/third_party/angle/src/compiler/preprocessor/Tokenizer.h
rhencke/engine
1016db292c4e73374a0a11536b18303c9522a224
[ "BSD-3-Clause" ]
20
2019-04-18T07:37:34.000Z
2022-02-02T21:43:47.000Z
src/third_party/angle/src/compiler/preprocessor/Tokenizer.h
rhencke/engine
1016db292c4e73374a0a11536b18303c9522a224
[ "BSD-3-Clause" ]
11
2019-10-21T13:39:41.000Z
2021-11-05T08:11:54.000Z
src/third_party/angle/src/compiler/preprocessor/Tokenizer.h
rhencke/engine
1016db292c4e73374a0a11536b18303c9522a224
[ "BSD-3-Clause" ]
1
2021-12-03T18:11:36.000Z
2021-12-03T18:11:36.000Z
// // Copyright 2012 The ANGLE Project 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 COMPILER_PREPROCESSOR_TOKENIZER_H_ #define COMPILER_PREPROCESSOR_TOKENIZER_H_ #include "common/angleutils.h" #include "compiler/preprocessor/Input.h" #include "compiler/preprocessor/Lexer.h" namespace angle { namespace pp { class Diagnostics; class Tokenizer : public Lexer { public: struct Context { Diagnostics *diagnostics; Input input; // The location where yytext points to. Token location should track // scanLoc instead of Input::mReadLoc because they may not be the same // if text is buffered up in the scanner input buffer. Input::Location scanLoc; bool leadingSpace; bool lineStart; }; Tokenizer(Diagnostics *diagnostics); ~Tokenizer() override; bool init(size_t count, const char *const string[], const int length[]); void setFileNumber(int file); void setLineNumber(int line); void setMaxTokenSize(size_t maxTokenSize); void lex(Token *token) override; private: bool initScanner(); void destroyScanner(); void *mHandle; // Scanner handle. Context mContext; // Scanner extra. size_t mMaxTokenSize; // Maximum token size }; } // namespace pp } // namespace angle #endif // COMPILER_PREPROCESSOR_TOKENIZER_H_
22.890625
78
0.693515
ec6be97038816caf72d79424dc333abd38aa681e
155
h
C
input_src/digit_reg512/operators/update_knn18.h
icgrp/pld2022
11d226ec0f8f1a10ab85318d815f400c42cf48fb
[ "MIT" ]
6
2022-01-09T23:08:14.000Z
2022-03-17T20:30:45.000Z
input_src/digit_reg512/operators/update_knn18.h
icgrp/pld2022
11d226ec0f8f1a10ab85318d815f400c42cf48fb
[ "MIT" ]
null
null
null
input_src/digit_reg512/operators/update_knn18.h
icgrp/pld2022
11d226ec0f8f1a10ab85318d815f400c42cf48fb
[ "MIT" ]
null
null
null
void update_knn18(hls::stream<ap_uint<32> > & Input_1, hls::stream<ap_uint<32> > & Output_1); #pragma map_target = HW page_num = 19 inst_mem_size = 65526
38.75
93
0.729032
ec6c291528dab396b22ccb41eb5f50de2f2292bd
518
c
C
lib/newlib/newlib/libc/stdlib/btowc.c
mslovy/barrelfish
780bc02cfbc3594b0ae46ca3a921d183557839be
[ "MIT" ]
81
2015-01-02T23:53:38.000Z
2021-12-26T23:04:47.000Z
lib/newlib/newlib/libc/stdlib/btowc.c
salivarick/barrelfish
252246b89117b0a23f6caa48a8b166c7bf12f885
[ "MIT" ]
1
2016-09-21T06:27:06.000Z
2016-10-05T07:16:28.000Z
lib/newlib/newlib/libc/stdlib/btowc.c
salivarick/barrelfish
252246b89117b0a23f6caa48a8b166c7bf12f885
[ "MIT" ]
7
2015-03-11T14:27:15.000Z
2017-11-08T23:03:45.000Z
#include <wchar.h> #include <stdlib.h> #include <stdio.h> #include <reent.h> #include <string.h> #include "local.h" wint_t btowc (int c) { mbstate_t mbs; int retval = 0; wchar_t pwc; unsigned char b; if (c == EOF) return WEOF; b = (unsigned char)c; /* Put mbs in initial state. */ memset (&mbs, '\0', sizeof (mbs)); _REENT_CHECK_MISC(_REENT); retval = __mbtowc (_REENT, &pwc, &b, 1, __locale_charset (), &mbs); if (retval != 0 && retval != 1) return WEOF; return (wint_t)pwc; }
15.69697
69
0.611969
ec6ed7598d05de8b8971056f6ddb3782b403e204
1,580
c
C
45/beef/cw/user/menu2.c
minblock/msdos
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
[ "Apache-2.0" ]
null
null
null
45/beef/cw/user/menu2.c
minblock/msdos
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
[ "Apache-2.0" ]
null
null
null
45/beef/cw/user/menu2.c
minblock/msdos
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
[ "Apache-2.0" ]
null
null
null
/* COW : Character Oriented Windows menu2.c : menu extras */ #define COW #include <cow.h> #include <umenu.h> #include <uwindow.h> #include <uevent.h> #include "menu.h" #include "_menu.h" STATIC PMENU FindMenu(WORD); PUBLIC VOID FARPUBLIC EnableMenu(id, fEnable) /* -- Enable/Disable a particular menu */ WORD id; BOOL fEnable; { StartPublic(); REGISTER PMENU pmenu; if ((pmenu = FindMenu(id)) != NULL) pmenu->fEnabled = (fEnable != 0); StopPublic(); } PUBLIC VOID FARPUBLIC EnableMenuItem(id, fEnable) /* -- Enable/Disable a particular menu item */ WORD id; BOOL fEnable; { StartPublic(); REGISTER PMENUITEM pmenuitem; if ((pmenuitem = FindMenuItem(id)) != NULL) pmenuitem->fEnabled = (fEnable != 0); StopPublic(); } PUBLIC VOID FARPUBLIC CheckMenuItem(id, fChecked) /* -- check specified menu item */ WORD id; BOOL fChecked; { StartPublic(); REGISTER PMENUITEM pmenuitem; if ((pmenuitem = FindMenuItem(id)) != NULL) pmenuitem->fChecked = (fChecked != 0); StopPublic(); } PUBLIC BOOL FARPUBLIC FMenuItemChecked(id) /* -- return state of menu item check flag */ WORD id; { StartPublic(); REGISTER PMENUITEM pmenuitem; if ((pmenuitem = FindMenuItem(id)) != NULL) { ReturnPublic(pmenuitem->fChecked, BOOL); } else { ReturnPublic(FALSE, BOOL); } } STATIC PMENU FindMenu(id) WORD id; /* FindMenu - Find specified menu */ { StartPublic(); PMENU pmenu = pmenubarCur->rgmenu; WORD cmenu = pmenubarCur->cmenu; while (cmenu--) { if (pmenu->idMenu == id) return(pmenu); pmenu++; } return(NULL); }
14.234234
44
0.668354
ec6f2415a905fe6662d0b6f2e1fc75be74082361
1,817
h
C
src/kits/debug/DebugEventStream.h
stasinek/BHAPI
5d9aa61665ae2cc5c6e34415957d49a769325b2b
[ "BSD-3-Clause", "MIT" ]
3
2018-05-21T15:32:32.000Z
2019-03-21T13:34:55.000Z
src/kits/debug/DebugEventStream.h
stasinek/BHAPI
5d9aa61665ae2cc5c6e34415957d49a769325b2b
[ "BSD-3-Clause", "MIT" ]
null
null
null
src/kits/debug/DebugEventStream.h
stasinek/BHAPI
5d9aa61665ae2cc5c6e34415957d49a769325b2b
[ "BSD-3-Clause", "MIT" ]
null
null
null
/* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #ifndef _DEBUG_EVENT_STREAM_H #define _DEBUG_EVENT_STREAM_H #include <Haiku.h> class BDataIO; struct debug_event_stream_header { char signature[32]; uint32 version; uint32 flags; uint32 event_mask; uint32 reserved; }; // signature and version #define B_DEBUG_EVENT_STREAM_SIGNATURE "Haiku debug events" #define B_DEBUG_EVENT_STREAM_VERSION 1 // flags enum { B_DEBUG_EVENT_STREAM_FLAG_HOST_ENDIAN = 0x00000001, B_DEBUG_EVENT_STREAM_FLAG_SWAPPED_ENDIAN = 0x01000000, B_DEBUG_EVENT_STREAM_FLAG_ZIPPED = 0x00000002 }; class BDebugEventInputStream { public: BDebugEventInputStream(); ~BDebugEventInputStream(); status_t SetTo(BDataIO* stream); status_t SetTo(const void* data, size_t size, bool takeOverOwnership); void Unset(); status_t Seek(off_t streamOffset); ssize_t ReadNextEvent(uint32* _event, uint32* _cpu, const void** _buffer, off_t* _streamOffset = NULL); private: status_t _Init(); ssize_t _Read(void* buffer, size_t size); status_t _GetData(size_t size); private: BDataIO* fStream; uint32 fFlags; uint32 fEventMask; uint8* fBuffer; size_t fBufferCapacity; size_t fBufferSize; size_t fBufferPosition; off_t fStreamPosition; bool fOwnsBuffer; }; class BDebugEventOutputStream { public: BDebugEventOutputStream(); ~BDebugEventOutputStream(); status_t SetTo(BDataIO* stream, uint32 flags, uint32 eventMask); void Unset(); status_t Write(const void* buffer, size_t size); status_t Flush(); private: BDataIO* fStream; uint32 fFlags; }; #endif // _DEBUG_EVENT_STREAM_H
20.188889
59
0.702807
ec6fbc358d0e7092ff15a29bcb46f921341eecde
2,473
c
C
usr.bin/checkpt/checkpt.c
masami256/dfly-3.0.2-bhyve
6f6c18db6fa90734135a2044769035eb82b821c1
[ "BSD-3-Clause" ]
3
2017-03-06T14:12:57.000Z
2019-11-23T09:35:10.000Z
usr.bin/checkpt/checkpt.c
masami256/dfly-3.0.2-bhyve
6f6c18db6fa90734135a2044769035eb82b821c1
[ "BSD-3-Clause" ]
null
null
null
usr.bin/checkpt/checkpt.c
masami256/dfly-3.0.2-bhyve
6f6c18db6fa90734135a2044769035eb82b821c1
[ "BSD-3-Clause" ]
null
null
null
/*- * Copyright (c) 2003 Kip Macy All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. * * $DragonFly: src/usr.bin/checkpt/checkpt.c,v 1.5 2007/07/24 19:44:18 dillon Exp $ */ #include <sys/signal.h> #include <sys/syscall.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/module.h> #include <sys/checkpoint.h> #include <fcntl.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <string.h> #include <errno.h> static void usage(const char *prg) { fprintf(stderr, "%s -r file.ckpt\n", prg); exit(1); } int main(int ac, char **av) { int fd; int error; char ch; const char *filename = NULL; while ((ch = getopt(ac, av, "r:")) != -1) { switch(ch) { case 'r': filename = optarg; break; default: usage(av[0]); } } if (filename == NULL) usage(av[0]); fd = open(filename, O_RDONLY); if (fd < 0) { fprintf(stderr, "unable to open %s\n", filename); exit(1); } error = sys_checkpoint(CKPT_THAW, fd, -1, 1); if (error) fprintf(stderr, "thaw failed error %d %s\n", errno, strerror(errno)); else fprintf(stderr, "Unknown error restoring checkpoint\n"); return(5); }
29.440476
83
0.695107
ec7144ea81479be868b3a8dca1b8354f8266d761
1,198
c
C
d/common/mounts/pony.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-07-19T05:24:44.000Z
2021-11-18T04:08:19.000Z
d/common/mounts/pony.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
4
2021-03-15T18:56:39.000Z
2021-08-17T17:08:22.000Z
d/common/mounts/pony.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-09-12T06:22:38.000Z
2022-01-31T01:15:12.000Z
#include <std.h> inherit "/std/riding_animal"; // changed race to pony & took out horse in ids for less confusion *Styx* 12/21/04 void create() { ::create(); set_name("mountain pony"); set_short("A shaggy mountain pony"); set_id(({"pony","mountain pony","shaggy pony","shaggy mountain pony"})); set_long( "This is a rather shaggy mountain pony. He looks as though he's"+ " in need of a grooming, but his coat is furry due to the cold"+ " mountain climate to which he is accustomed. He is a dark brown"+ " color with black mane and tail. Mountain ponies are known for"+ " their sure footedness along rocky trails, but they are too"+ " small for anyone larger than a child to ride and are mostly"+ " used as pack animals." ); set_gender("male"); set_race("pony"); set_body_type("equine"); set_size(1); set_hd(4,3); set_max_hp(80); set_hp(query_max_hp()); set_value(80); set_max_distance(500); set_enter_room(" trots in on a sure footed mountain pony."); set_exit_room("trots out on a sure footed mountain pony."); set_vehicle_short("Pony"); set_attack_limbs(({"right forehoof","left forehoof"})); set_attacks_num(1); set_damage(1,4); set_riding_level(8); }
31.526316
82
0.705342
ec742df530ef8fb67a3ccd0ff195ce41831902e1
1,473
h
C
src/include/optimizer/stats/table_stats_collector.h
aaron-tian/peloton
2406b763b91d9cee2a5d9f4dee01c761b476cef6
[ "Apache-2.0" ]
3
2018-01-08T01:06:17.000Z
2019-06-17T23:14:36.000Z
src/include/optimizer/stats/table_stats_collector.h
aaron-tian/peloton
2406b763b91d9cee2a5d9f4dee01c761b476cef6
[ "Apache-2.0" ]
5
2017-04-23T17:16:14.000Z
2017-04-25T03:14:16.000Z
src/include/optimizer/stats/table_stats_collector.h
aaron-tian/peloton
2406b763b91d9cee2a5d9f4dee01c761b476cef6
[ "Apache-2.0" ]
3
2018-02-25T23:30:33.000Z
2018-04-08T10:11:42.000Z
//===----------------------------------------------------------------------===// // // Peloton // // table_stats_collector.h // // Identification: src/include/optimizer/stats/table_stats_collector.h // // Copyright (c) 2015-16, Carnegie Mellon University Database Group // //===----------------------------------------------------------------------===// #pragma once #include <vector> #include "optimizer/stats/column_stats_collector.h" #include "catalog/schema.h" #include "storage/data_table.h" namespace peloton { namespace optimizer { //===--------------------------------------------------------------------===// // TableStatsCollector //===--------------------------------------------------------------------===// class TableStatsCollector { public: TableStatsCollector(storage::DataTable* table); ~TableStatsCollector(); void CollectColumnStats(); inline size_t GetActiveTupleCount() { return active_tuple_count_; } inline size_t GetColumnCount() { return column_count_; } ColumnStatsCollector* GetColumnStats(oid_t column_id); private: storage::DataTable* table_; catalog::Schema* schema_; std::vector<std::unique_ptr<ColumnStatsCollector>> column_stats_collectors_; size_t active_tuple_count_; size_t column_count_; TableStatsCollector(const TableStatsCollector&); void operator=(const TableStatsCollector&); void InitColumnStatsCollectors(); }; } // namespace optimizer } // namespace peloton
26.303571
80
0.589952
ec7615430474eae78987f6896ea4c622390e412d
229
h
C
iphone/CoreApi/CoreApi/PlacePageData/Catalog/CatalogPromoData+Core.h
vicpopov/omim
664b458998fb0f2405f68ae830c2798e027b2dcc
[ "Apache-2.0" ]
4,879
2015-09-30T10:56:36.000Z
2022-03-31T18:43:03.000Z
iphone/CoreApi/CoreApi/PlacePageData/Catalog/CatalogPromoData+Core.h
mbrukman/omim
d22fe2b6e0beee697f096e931df97a64f9db9dc1
[ "Apache-2.0" ]
7,549
2015-09-30T10:52:53.000Z
2022-03-31T22:04:22.000Z
iphone/CoreApi/CoreApi/PlacePageData/Catalog/CatalogPromoData+Core.h
mbrukman/omim
d22fe2b6e0beee697f096e931df97a64f9db9dc1
[ "Apache-2.0" ]
1,493
2015-09-30T10:43:06.000Z
2022-03-21T09:16:49.000Z
#import "CatalogPromoData.h" #include <CoreApi/Framework.h> NS_ASSUME_NONNULL_BEGIN @interface CatalogPromoData (Core) - (instancetype)initWithCityGallery:(promo::CityGallery const &)cityGallery; @end NS_ASSUME_NONNULL_END
16.357143
76
0.812227
ec778fd32685b794d5d0f30006b39ac3cd96828f
1,436
h
C
qqtw/qqheaders7.2/LTAvatarEngine.h
onezens/QQTweak
04b9efd1d93eba8ef8fec5cf9a20276637765777
[ "MIT" ]
5
2018-02-20T14:24:17.000Z
2020-08-06T09:31:21.000Z
qqtw/qqheaders7.2/LTAvatarEngine.h
onezens/QQTweak
04b9efd1d93eba8ef8fec5cf9a20276637765777
[ "MIT" ]
1
2020-06-10T07:49:16.000Z
2020-06-12T02:08:35.000Z
qqtw/qqheaders7.2/LTAvatarEngine.h
onezens/SmartQQ
04b9efd1d93eba8ef8fec5cf9a20276637765777
[ "MIT" ]
null
null
null
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" #import "AvatarServiceDelegate.h" #import "LTAvatarEngineDelegate.h" @class NSMutableDictionary, NSString; @interface LTAvatarEngine : NSObject <AvatarServiceDelegate, LTAvatarEngineDelegate> { NSMutableDictionary *_delegates; struct _opaque_pthread_rwlock_t _delegateLock; } + (id)shareEngine; - (void)dealloc; - (void)didLoadImage:(id)arg1 identity:(id)arg2 type:(int)arg3 size:(int)arg4 shape:(int)arg5 avatarInfo:(id)arg6; - (void)imageDidLoad:(id)arg1 key:(id)arg2; - (id)init; - (id)loadWithDicussKey:(id)arg1 localIgnored:(_Bool)arg2; - (id)loadWithDiscussUin:(id)arg1 phones:(id)arg2 key:(id *)arg3 delegate:(id)arg4; - (id)loadWithEncounterUin:(id)arg1 key:(id *)arg2 delegate:(id)arg3; - (id)loadWithLtUin:(id)arg1 key:(id *)arg2 delegate:(id)arg3; - (id)loadWithPhone:(id)arg1 key:(id *)arg2 delegate:(id)arg3; - (id)loadWithQQUin:(id)arg1 key:(id *)arg2 delegate:(id)arg3; - (id)loadWithUrl:(id)arg1 key:(id *)arg2 delegate:(id)arg3; - (void)registDelegate:(id)arg1 forKey:(id)arg2; - (void)unregistDelegate:(id)arg1 forKey:(id)arg2; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
33.395349
114
0.738162
ec78c771a833278d3a0fdea75a472dd1d0102463
26,399
h
C
include/qt5/QtWaylandClient/5.4.0/QtWaylandClient/private/wayland-xdg-shell-client-protocol.h
croc-code/aurora-rust-gui
67736d7c662f30519ba3157873cdd89aa87db91b
[ "MIT" ]
2
2022-01-30T03:10:58.000Z
2022-03-27T09:03:32.000Z
include/qt5/QtWaylandClient/5.4.0/QtWaylandClient/private/wayland-xdg-shell-client-protocol.h
crocinc/aurora-rust-gui
67736d7c662f30519ba3157873cdd89aa87db91b
[ "MIT" ]
null
null
null
include/qt5/QtWaylandClient/5.4.0/QtWaylandClient/private/wayland-xdg-shell-client-protocol.h
crocinc/aurora-rust-gui
67736d7c662f30519ba3157873cdd89aa87db91b
[ "MIT" ]
null
null
null
/* Generated by wayland-scanner 1.17.0 */ #ifndef XDG_SHELL_CLIENT_PROTOCOL_H #define XDG_SHELL_CLIENT_PROTOCOL_H #include <stdint.h> #include <stddef.h> #include "wayland-client.h" #ifdef __cplusplus extern "C" { #endif /** * @page page_xdg_shell The xdg_shell protocol * @section page_ifaces_xdg_shell Interfaces * - @subpage page_iface_xdg_shell - create desktop-style surfaces * - @subpage page_iface_xdg_surface - desktop-style metadata interface * - @subpage page_iface_xdg_popup - desktop-style metadata interface * @section page_copyright_xdg_shell Copyright * <pre> * * Copyright © 2008-2013 Kristian Høgsberg * Copyright © 2013 Rafael Antognolli * Copyright © 2013 Jasper St. Pierre * Copyright © 2010-2013 Intel Corporation * * Permission to use, copy, modify, distribute, and sell this * software and its documentation for any purpose is hereby granted * without fee, provided that the above copyright notice appear in * all copies and that both that copyright notice and this permission * notice appear in supporting documentation, and that the name of * the copyright holders not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. * </pre> */ struct wl_output; struct wl_seat; struct wl_surface; struct xdg_popup; struct xdg_shell; struct xdg_surface; /** * @page page_iface_xdg_shell xdg_shell * @section page_iface_xdg_shell_desc Description * * This interface is implemented by servers that provide * desktop-style user interfaces. * * It allows clients to associate a xdg_surface with * a basic surface. * @section page_iface_xdg_shell_api API * See @ref iface_xdg_shell. */ /** * @defgroup iface_xdg_shell The xdg_shell interface * * This interface is implemented by servers that provide * desktop-style user interfaces. * * It allows clients to associate a xdg_surface with * a basic surface. */ extern const struct wl_interface xdg_shell_interface; /** * @page page_iface_xdg_surface xdg_surface * @section page_iface_xdg_surface_desc Description * * An interface that may be implemented by a wl_surface, for * implementations that provide a desktop-style user interface. * * It provides requests to treat surfaces like windows, allowing to set * properties like maximized, fullscreen, minimized, and to move and resize * them, and associate metadata like title and app id. * * On the server side the object is automatically destroyed when * the related wl_surface is destroyed. On client side, * xdg_surface.destroy() must be called before destroying * the wl_surface object. * @section page_iface_xdg_surface_api API * See @ref iface_xdg_surface. */ /** * @defgroup iface_xdg_surface The xdg_surface interface * * An interface that may be implemented by a wl_surface, for * implementations that provide a desktop-style user interface. * * It provides requests to treat surfaces like windows, allowing to set * properties like maximized, fullscreen, minimized, and to move and resize * them, and associate metadata like title and app id. * * On the server side the object is automatically destroyed when * the related wl_surface is destroyed. On client side, * xdg_surface.destroy() must be called before destroying * the wl_surface object. */ extern const struct wl_interface xdg_surface_interface; /** * @page page_iface_xdg_popup xdg_popup * @section page_iface_xdg_popup_desc Description * * An interface that may be implemented by a wl_surface, for * implementations that provide a desktop-style popups/menus. A popup * surface is a transient surface with an added pointer grab. * * An existing implicit grab will be changed to owner-events mode, * and the popup grab will continue after the implicit grab ends * (i.e. releasing the mouse button does not cause the popup to be * unmapped). * * The popup grab continues until the window is destroyed or a mouse * button is pressed in any other clients window. A click in any of * the clients surfaces is reported as normal, however, clicks in * other clients surfaces will be discarded and trigger the callback. * * The x and y arguments specify the locations of the upper left * corner of the surface relative to the upper left corner of the * parent surface, in surface local coordinates. * * xdg_popup surfaces are always transient for another surface. * @section page_iface_xdg_popup_api API * See @ref iface_xdg_popup. */ /** * @defgroup iface_xdg_popup The xdg_popup interface * * An interface that may be implemented by a wl_surface, for * implementations that provide a desktop-style popups/menus. A popup * surface is a transient surface with an added pointer grab. * * An existing implicit grab will be changed to owner-events mode, * and the popup grab will continue after the implicit grab ends * (i.e. releasing the mouse button does not cause the popup to be * unmapped). * * The popup grab continues until the window is destroyed or a mouse * button is pressed in any other clients window. A click in any of * the clients surfaces is reported as normal, however, clicks in * other clients surfaces will be discarded and trigger the callback. * * The x and y arguments specify the locations of the upper left * corner of the surface relative to the upper left corner of the * parent surface, in surface local coordinates. * * xdg_popup surfaces are always transient for another surface. */ extern const struct wl_interface xdg_popup_interface; #ifndef XDG_SHELL_VERSION_ENUM #define XDG_SHELL_VERSION_ENUM /** * @ingroup iface_xdg_shell * latest protocol version * * The 'current' member of this enum gives the version of the * protocol. Implementations can compare this to the version * they implement using static_assert to ensure the protocol and * implementation versions match. */ enum xdg_shell_version { /** * Always the latest version */ XDG_SHELL_VERSION_CURRENT = 3, }; #endif /* XDG_SHELL_VERSION_ENUM */ /** * @ingroup iface_xdg_shell * @struct xdg_shell_listener */ struct xdg_shell_listener { /** * check if the client is alive * * The ping event asks the client if it's still alive. Pass the * serial specified in the event back to the compositor by sending * a "pong" request back with the specified serial. * * Compositors can use this to determine if the client is still * alive. It's unspecified what will happen if the client doesn't * respond to the ping request, or in what timeframe. Clients * should try to respond in a reasonable amount of time. * @param serial pass this to the callback */ void (*ping)(void *data, struct xdg_shell *xdg_shell, uint32_t serial); }; /** * @ingroup iface_xdg_shell */ static inline int xdg_shell_add_listener(struct xdg_shell *xdg_shell, const struct xdg_shell_listener *listener, void *data) { return wl_proxy_add_listener((struct wl_proxy *) xdg_shell, (void (**)(void)) listener, data); } #define XDG_SHELL_USE_UNSTABLE_VERSION 0 #define XDG_SHELL_GET_XDG_SURFACE 1 #define XDG_SHELL_GET_XDG_POPUP 2 #define XDG_SHELL_PONG 3 /** * @ingroup iface_xdg_shell */ #define XDG_SHELL_PING_SINCE_VERSION 1 /** * @ingroup iface_xdg_shell */ #define XDG_SHELL_USE_UNSTABLE_VERSION_SINCE_VERSION 1 /** * @ingroup iface_xdg_shell */ #define XDG_SHELL_GET_XDG_SURFACE_SINCE_VERSION 1 /** * @ingroup iface_xdg_shell */ #define XDG_SHELL_GET_XDG_POPUP_SINCE_VERSION 1 /** * @ingroup iface_xdg_shell */ #define XDG_SHELL_PONG_SINCE_VERSION 1 /** @ingroup iface_xdg_shell */ static inline void xdg_shell_set_user_data(struct xdg_shell *xdg_shell, void *user_data) { wl_proxy_set_user_data((struct wl_proxy *) xdg_shell, user_data); } /** @ingroup iface_xdg_shell */ static inline void * xdg_shell_get_user_data(struct xdg_shell *xdg_shell) { return wl_proxy_get_user_data((struct wl_proxy *) xdg_shell); } static inline uint32_t xdg_shell_get_version(struct xdg_shell *xdg_shell) { return wl_proxy_get_version((struct wl_proxy *) xdg_shell); } /** @ingroup iface_xdg_shell */ static inline void xdg_shell_destroy(struct xdg_shell *xdg_shell) { wl_proxy_destroy((struct wl_proxy *) xdg_shell); } /** * @ingroup iface_xdg_shell * * Negotiate the unstable version of the interface. This * mechanism is in place to ensure client and server agree on the * unstable versions of the protocol that they speak or exit * cleanly if they don't agree. This request will go away once * the xdg-shell protocol is stable. */ static inline void xdg_shell_use_unstable_version(struct xdg_shell *xdg_shell, int32_t version) { wl_proxy_marshal((struct wl_proxy *) xdg_shell, XDG_SHELL_USE_UNSTABLE_VERSION, version); } /** * @ingroup iface_xdg_shell * * Create a shell surface for an existing surface. * * Only one shell or popup surface can be associated with a given * surface. */ static inline struct xdg_surface * xdg_shell_get_xdg_surface(struct xdg_shell *xdg_shell, struct wl_surface *surface) { struct wl_proxy *id; id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell, XDG_SHELL_GET_XDG_SURFACE, &xdg_surface_interface, NULL, surface); return (struct xdg_surface *) id; } /** * @ingroup iface_xdg_shell * * Create a popup surface for an existing surface. * * Only one shell or popup surface can be associated with a given * surface. */ static inline struct xdg_popup * xdg_shell_get_xdg_popup(struct xdg_shell *xdg_shell, struct wl_surface *surface, struct wl_surface *parent, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y, uint32_t flags) { struct wl_proxy *id; id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell, XDG_SHELL_GET_XDG_POPUP, &xdg_popup_interface, NULL, surface, parent, seat, serial, x, y, flags); return (struct xdg_popup *) id; } /** * @ingroup iface_xdg_shell * * A client must respond to a ping event with a pong request or * the client may be deemed unresponsive. */ static inline void xdg_shell_pong(struct xdg_shell *xdg_shell, uint32_t serial) { wl_proxy_marshal((struct wl_proxy *) xdg_shell, XDG_SHELL_PONG, serial); } #ifndef XDG_SURFACE_RESIZE_EDGE_ENUM #define XDG_SURFACE_RESIZE_EDGE_ENUM /** * @ingroup iface_xdg_surface * edge values for resizing * * These values are used to indicate which edge of a surface * is being dragged in a resize operation. The server may * use this information to adapt its behavior, e.g. choose * an appropriate cursor image. */ enum xdg_surface_resize_edge { XDG_SURFACE_RESIZE_EDGE_NONE = 0, XDG_SURFACE_RESIZE_EDGE_TOP = 1, XDG_SURFACE_RESIZE_EDGE_BOTTOM = 2, XDG_SURFACE_RESIZE_EDGE_LEFT = 4, XDG_SURFACE_RESIZE_EDGE_TOP_LEFT = 5, XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT = 6, XDG_SURFACE_RESIZE_EDGE_RIGHT = 8, XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT = 9, XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT = 10, }; #endif /* XDG_SURFACE_RESIZE_EDGE_ENUM */ #ifndef XDG_SURFACE_STATE_ENUM #define XDG_SURFACE_STATE_ENUM /** * @ingroup iface_xdg_surface * types of state on the surface * * The different state values used on the surface. This is designed for * state values like maximized, fullscreen. It is paired with the * request_change_state event to ensure that both the client and the * compositor setting the state can be synchronized. * * States set in this way are double-buffered. They will get applied on * the next commit. * * Desktop environments may extend this enum by taking up a range of * values and documenting the range they chose in this description. * They are not required to document the values for the range that they * chose. Ideally, any good extensions from a desktop environment should * make its way into standardization into this enum. * * The current reserved ranges are: * * 0x0000 - 0x0FFF: xdg-shell core values, documented below. * 0x1000 - 0x1FFF: GNOME */ enum xdg_surface_state { /** * the surface is maximized */ XDG_SURFACE_STATE_MAXIMIZED = 1, /** * the surface is fullscreen */ XDG_SURFACE_STATE_FULLSCREEN = 2, }; #endif /* XDG_SURFACE_STATE_ENUM */ /** * @ingroup iface_xdg_surface * @struct xdg_surface_listener */ struct xdg_surface_listener { /** * suggest resize * * The configure event asks the client to resize its surface. * * The size is a hint, in the sense that the client is free to * ignore it if it doesn't resize, pick a smaller size (to satisfy * aspect ratio or resize in steps of NxM pixels). * * The client is free to dismiss all but the last configure event * it received. * * The width and height arguments specify the size of the window in * surface local coordinates. */ void (*configure)(void *data, struct xdg_surface *xdg_surface, int32_t width, int32_t height); /** * compositor wants to change a surface's state * * This event tells the client to change a surface's state. The * client should respond with an ack_change_state request to the * compositor to guarantee that the compositor knows that the * client has seen it. * @param state_type the state to set * @param value the value to change the state to * @param serial a serial for the compositor's own tracking */ void (*change_state)(void *data, struct xdg_surface *xdg_surface, uint32_t state_type, uint32_t value, uint32_t serial); /** * surface was activated * * The activated_set event is sent when this surface has been * activated, which means that the surface has user attention. * Window decorations should be updated accordingly. You should not * use this event for anything but the style of decorations you * display, use wl_keyboard.enter and wl_keyboard.leave for * determining keyboard focus. */ void (*activated)(void *data, struct xdg_surface *xdg_surface); /** * surface was deactivated * * The deactivate event is sent when this surface has been * deactivated, which means that the surface lost user attention. * Window decorations should be updated accordingly. You should not * use this event for anything but the style of decorations you * display, use wl_keyboard.enter and wl_keyboard.leave for * determining keyboard focus. */ void (*deactivated)(void *data, struct xdg_surface *xdg_surface); /** * surface wants to be closed * * The close event is sent by the compositor when the user wants * the surface to be closed. This should be equivalent to the user * clicking the close button in client-side decorations, if your * application has any... * * This is only a request that the user intends to close your * window. The client may choose to ignore this request, or show a * dialog to ask the user to save their data... */ void (*close)(void *data, struct xdg_surface *xdg_surface); }; /** * @ingroup iface_xdg_surface */ static inline int xdg_surface_add_listener(struct xdg_surface *xdg_surface, const struct xdg_surface_listener *listener, void *data) { return wl_proxy_add_listener((struct wl_proxy *) xdg_surface, (void (**)(void)) listener, data); } #define XDG_SURFACE_DESTROY 0 #define XDG_SURFACE_SET_TRANSIENT_FOR 1 #define XDG_SURFACE_SET_MARGIN 2 #define XDG_SURFACE_SET_TITLE 3 #define XDG_SURFACE_SET_APP_ID 4 #define XDG_SURFACE_MOVE 5 #define XDG_SURFACE_RESIZE 6 #define XDG_SURFACE_SET_OUTPUT 7 #define XDG_SURFACE_REQUEST_CHANGE_STATE 8 #define XDG_SURFACE_ACK_CHANGE_STATE 9 #define XDG_SURFACE_SET_MINIMIZED 10 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_CHANGE_STATE_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_ACTIVATED_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_DEACTIVATED_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_CLOSE_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_DESTROY_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_SET_TRANSIENT_FOR_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_SET_MARGIN_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_SET_TITLE_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_SET_APP_ID_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_MOVE_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_RESIZE_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_SET_OUTPUT_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_REQUEST_CHANGE_STATE_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_ACK_CHANGE_STATE_SINCE_VERSION 1 /** * @ingroup iface_xdg_surface */ #define XDG_SURFACE_SET_MINIMIZED_SINCE_VERSION 1 /** @ingroup iface_xdg_surface */ static inline void xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data) { wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data); } /** @ingroup iface_xdg_surface */ static inline void * xdg_surface_get_user_data(struct xdg_surface *xdg_surface) { return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface); } static inline uint32_t xdg_surface_get_version(struct xdg_surface *xdg_surface) { return wl_proxy_get_version((struct wl_proxy *) xdg_surface); } /** * @ingroup iface_xdg_surface * * The xdg_surface interface is removed from the wl_surface object * that was turned into a xdg_surface with * xdg_shell.get_xdg_surface request. The xdg_surface properties, * like maximized and fullscreen, are lost. The wl_surface loses * its role as a xdg_surface. The wl_surface is unmapped. */ static inline void xdg_surface_destroy(struct xdg_surface *xdg_surface) { wl_proxy_marshal((struct wl_proxy *) xdg_surface, XDG_SURFACE_DESTROY); wl_proxy_destroy((struct wl_proxy *) xdg_surface); } /** * @ingroup iface_xdg_surface * * Setting a surface as transient of another means that it is child * of another surface. * * Child surfaces are stacked above their parents, and will be * unmapped if the parent is unmapped too. They should not appear * on task bars and alt+tab. */ static inline void xdg_surface_set_transient_for(struct xdg_surface *xdg_surface, struct wl_surface *parent) { wl_proxy_marshal((struct wl_proxy *) xdg_surface, XDG_SURFACE_SET_TRANSIENT_FOR, parent); } /** * @ingroup iface_xdg_surface * * This tells the compositor what the visible size of the window * should be, so it can use it to determine what borders to use for * constrainment and alignment. * * CSD often has invisible areas for decoration purposes, like drop * shadows. These "shadow" drawings need to be subtracted out of the * normal boundaries of the window when computing where to place * windows (e.g. to set this window so it's centered on top of another, * or to put it to the left or right of the screen.) * * This value should change as little as possible at runtime, to * prevent flicker. * * This value is also ignored when the window is maximized or * fullscreen, and assumed to be 0. * * If never called, this value is assumed to be 0. */ static inline void xdg_surface_set_margin(struct xdg_surface *xdg_surface, int32_t left_margin, int32_t right_margin, int32_t top_margin, int32_t bottom_margin) { wl_proxy_marshal((struct wl_proxy *) xdg_surface, XDG_SURFACE_SET_MARGIN, left_margin, right_margin, top_margin, bottom_margin); } /** * @ingroup iface_xdg_surface * * Set a short title for the surface. * * This string may be used to identify the surface in a task bar, * window list, or other user interface elements provided by the * compositor. * * The string must be encoded in UTF-8. */ static inline void xdg_surface_set_title(struct xdg_surface *xdg_surface, const char *title) { wl_proxy_marshal((struct wl_proxy *) xdg_surface, XDG_SURFACE_SET_TITLE, title); } /** * @ingroup iface_xdg_surface * * Set an id for the surface. * * The app id identifies the general class of applications to which * the surface belongs. * * It should be the ID that appears in the new desktop entry * specification, the interface name. */ static inline void xdg_surface_set_app_id(struct xdg_surface *xdg_surface, const char *app_id) { wl_proxy_marshal((struct wl_proxy *) xdg_surface, XDG_SURFACE_SET_APP_ID, app_id); } /** * @ingroup iface_xdg_surface * * Start a pointer-driven move of the surface. * * This request must be used in response to a button press event. * The server may ignore move requests depending on the state of * the surface (e.g. fullscreen or maximized). */ static inline void xdg_surface_move(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial) { wl_proxy_marshal((struct wl_proxy *) xdg_surface, XDG_SURFACE_MOVE, seat, serial); } /** * @ingroup iface_xdg_surface * * Start a pointer-driven resizing of the surface. * * This request must be used in response to a button press event. * The server may ignore resize requests depending on the state of * the surface (e.g. fullscreen or maximized). */ static inline void xdg_surface_resize(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges) { wl_proxy_marshal((struct wl_proxy *) xdg_surface, XDG_SURFACE_RESIZE, seat, serial, edges); } /** * @ingroup iface_xdg_surface * * Set the default output used by this surface when it is first mapped. * * If this value is NULL (default), it's up to the compositor to choose * which display will be used to map this surface. * * When fullscreen or maximized state are set on this surface, and it * wasn't mapped yet, the output set with this method will be used. * Otherwise, the output where the surface is currently mapped will be * used. */ static inline void xdg_surface_set_output(struct xdg_surface *xdg_surface, struct wl_output *output) { wl_proxy_marshal((struct wl_proxy *) xdg_surface, XDG_SURFACE_SET_OUTPUT, output); } /** * @ingroup iface_xdg_surface * * This asks the compositor to change the state. If the compositor wants * to change the state, it will send a change_state event with the same * state_type, value, and serial, and the event flow continues as if it * it was initiated by the compositor. * * If the compositor does not want to change the state, it will send a * change_state to the client with the old value of the state. */ static inline void xdg_surface_request_change_state(struct xdg_surface *xdg_surface, uint32_t state_type, uint32_t value, uint32_t serial) { wl_proxy_marshal((struct wl_proxy *) xdg_surface, XDG_SURFACE_REQUEST_CHANGE_STATE, state_type, value, serial); } /** * @ingroup iface_xdg_surface * * When a change_state event is received, a client should then ack it * using the ack_change_state request to ensure that the compositor * knows the client has seen the event. * * By this point, the state is confirmed, and the next attach should * contain the buffer drawn for the new state value. * * The values here need to be the same as the values in the cooresponding * change_state event. */ static inline void xdg_surface_ack_change_state(struct xdg_surface *xdg_surface, uint32_t state_type, uint32_t value, uint32_t serial) { wl_proxy_marshal((struct wl_proxy *) xdg_surface, XDG_SURFACE_ACK_CHANGE_STATE, state_type, value, serial); } /** * @ingroup iface_xdg_surface * * Minimize the surface. */ static inline void xdg_surface_set_minimized(struct xdg_surface *xdg_surface) { wl_proxy_marshal((struct wl_proxy *) xdg_surface, XDG_SURFACE_SET_MINIMIZED); } /** * @ingroup iface_xdg_popup * @struct xdg_popup_listener */ struct xdg_popup_listener { /** * popup interaction is done * * The popup_done event is sent out when a popup grab is broken, * that is, when the users clicks a surface that doesn't belong to * the client owning the popup surface. * @param serial serial of the implicit grab on the pointer */ void (*popup_done)(void *data, struct xdg_popup *xdg_popup, uint32_t serial); }; /** * @ingroup iface_xdg_popup */ static inline int xdg_popup_add_listener(struct xdg_popup *xdg_popup, const struct xdg_popup_listener *listener, void *data) { return wl_proxy_add_listener((struct wl_proxy *) xdg_popup, (void (**)(void)) listener, data); } #define XDG_POPUP_DESTROY 0 /** * @ingroup iface_xdg_popup */ #define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1 /** * @ingroup iface_xdg_popup */ #define XDG_POPUP_DESTROY_SINCE_VERSION 1 /** @ingroup iface_xdg_popup */ static inline void xdg_popup_set_user_data(struct xdg_popup *xdg_popup, void *user_data) { wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data); } /** @ingroup iface_xdg_popup */ static inline void * xdg_popup_get_user_data(struct xdg_popup *xdg_popup) { return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup); } static inline uint32_t xdg_popup_get_version(struct xdg_popup *xdg_popup) { return wl_proxy_get_version((struct wl_proxy *) xdg_popup); } /** * @ingroup iface_xdg_popup * * The xdg_surface interface is removed from the wl_surface object * that was turned into a xdg_surface with * xdg_shell.get_xdg_surface request. The xdg_surface properties, * like maximized and fullscreen, are lost. The wl_surface loses * its role as a xdg_surface. The wl_surface is unmapped. */ static inline void xdg_popup_destroy(struct xdg_popup *xdg_popup) { wl_proxy_marshal((struct wl_proxy *) xdg_popup, XDG_POPUP_DESTROY); wl_proxy_destroy((struct wl_proxy *) xdg_popup); } #ifdef __cplusplus } #endif #endif
30.239404
184
0.759688
ec78cb33702de87d87291f934493431dee036c48
242
h
C
Bin/z3_version.h
Pigrecos/Z34Delphi
c162e01084c23cca2f962fa7369eb9ac920e6fd9
[ "MIT" ]
8
2019-01-17T18:34:35.000Z
2020-12-25T07:59:18.000Z
Bin/z3_version.h
Pigrecos/Z34Delphi
c162e01084c23cca2f962fa7369eb9ac920e6fd9
[ "MIT" ]
null
null
null
Bin/z3_version.h
Pigrecos/Z34Delphi
c162e01084c23cca2f962fa7369eb9ac920e6fd9
[ "MIT" ]
3
2019-01-18T11:37:32.000Z
2021-12-29T07:46:41.000Z
// automatically generated file. #define Z3_MAJOR_VERSION 4 #define Z3_MINOR_VERSION 8 #define Z3_BUILD_NUMBER 5 #define Z3_REVISION_NUMBER 10519 #define Z3_FULL_VERSION "Z3 4.8.5.10519 7fb2c6a908d5 master z3-4.8.3-435-g7fb2c6a90"
30.25
87
0.785124
ec78ebd993026be5aad0cfb32ab7592f8b2fa585
6,788
h
C
dependencies/include/cgal/CGAL/Kernel_d/Ray_d.h
rosecodym/space-boundary-tool
300db4084cd19b092bdf2e8432da065daeaa7c55
[ "FSFAP" ]
6
2016-11-01T11:09:00.000Z
2022-02-15T06:31:58.000Z
dependencies/include/cgal/CGAL/Kernel_d/Ray_d.h
rosecodym/space-boundary-tool
300db4084cd19b092bdf2e8432da065daeaa7c55
[ "FSFAP" ]
null
null
null
dependencies/include/cgal/CGAL/Kernel_d/Ray_d.h
rosecodym/space-boundary-tool
300db4084cd19b092bdf2e8432da065daeaa7c55
[ "FSFAP" ]
null
null
null
// Copyright (c) 2000,2001 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; either version 3 of the License, // or (at your option) any later version. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/releases/CGAL-4.1-branch/Kernel_d/include/CGAL/Kernel_d/Ray_d.h $ // $Id: Ray_d.h 67093 2012-01-13 11:22:39Z lrineau $ // // // Author(s) : Michael Seel #ifndef CGAL_RAY_D_H #define CGAL_RAY_D_H #include <CGAL/Kernel_d/Pair_d.h> #include <CGAL/Kernel_d/Segment_d.h> #include <CGAL/Kernel_d/Line_d.h> #include <CGAL/Dimension.h> namespace CGAL { template <class R> std::istream& operator>>(std::istream&, Ray_d<R>&); template <class R> std::ostream& operator<<(std::ostream&, const Ray_d<R>&); /*{\Manpage {Ray_d}{R}{Rays in d-space}{r}}*/ template <class p_R> class Ray_d : public Handle_for< Pair_d<p_R> > { typedef Pair_d<p_R> Pair; typedef Handle_for<Pair> Base; typedef Ray_d<p_R> Self; using Base::ptr; /*{\Mdefinition An instance of data type |Ray_d| is a ray in $d$-dimensional Euclidian space. It starts in a point called the source of |\Mvar| and it goes to infinity.}*/ public: typedef CGAL::Dynamic_dimension_tag Ambient_dimension; typedef CGAL::Dimension_tag<1> Feature_dimension; /*{\Mtypes 4}*/ typedef p_R R; /*{\Mtypemember the representation type.}*/ typedef typename p_R::RT RT; /*{\Mtypemember the ring type.}*/ typedef typename p_R::FT FT; /*{\Mtypemember the field type.}*/ typedef typename p_R::LA LA; /*{\Mtypemember the linear algebra layer.}*/ typedef typename Vector_d<R>::Base_vector Base_vector; friend class Line_d<R>; friend class Segment_d<R>; private: Ray_d(const Base& b) : Base(b) {} public: /*{\Mcreation 3}*/ Ray_d() : Base( Pair() ) {} /*{\Mcreate introduces some ray in $d$-dimensional space }*/ Ray_d(const Point_d<R>& p, const Point_d<R>& q) /*{\Mcreate introduces a ray through |p| and |q| and starting at |p|. \precond $p$ and $q$ are distinct and have the same dimension. }*/ : Base( Pair(p,q) ) { CGAL_assertion_msg(!ptr()->is_degenerate(), "Ray_d::constructor: the two points must be different." ); CGAL_assertion_msg((p.dimension()==q.dimension()), "Ray_d::constructor: the two points must have the same dimension." ); } Ray_d(const Point_d<R>& p, const Direction_d<R>& dir) /*{\Mcreate introduces a ray starting in |p| with direction |dir|. \precond |p| and |dir| have the same dimension and |dir| is not trivial.}*/ : Base( Pair(p,p+dir.vector()) ) { CGAL_assertion_msg((p.dimension()==dir.dimension()), "Ray_d::constructor: the p and dir must have the same dimension." ); CGAL_assertion_msg(!dir.is_degenerate(), "Ray_d::constructor: dir must be non-degenerate." ); } Ray_d(const Segment_d<R>& s) /*{\Mcreate introduces a ray through |s.source()| and |s.target()| and starting at |s.source()|. \precond $s$ is not trivial. }*/ : Base( s ) { CGAL_assertion_msg(!s.is_degenerate(), "Ray_d::constructor: segment is trivial."); } Ray_d(const Ray_d<R>& r) : Base(r) {} /*{\Moperations 3 3}*/ int dimension() const { return (ptr()->_p[0].dimension()); } /*{\Mop returns the dimension of the underlying space.}*/ Point_d<R> source() const { return (ptr()->_p[0]); } /*{\Mop returns the source point of |\Mvar|. }*/ Point_d<R> point(int i) const /*{\Mop returns a point on |\Mvar|. |point(0)| is the source. |point(i)|, with $i>0$, is different from the source. \precond $i \geq 0$.}*/ { return (ptr()->_p[i%2]); } Direction_d<R> direction() const /*{\Mop returns the direction of |\Mvar|. }*/ { return ptr()->direction(); } inline Line_d<R> supporting_line() const; /*{\Mop returns the supporting line of |\Mvar|.}*/ Ray_d<R> opposite() const /*{\Mop returns the ray with direction opposite to |\Mvar| and starting in |source|.}*/ { return Ray_d<R>(source(),-direction()); } Ray_d<R> transform(const Aff_transformation_d<R>& t) const /*{\Mop returns $t(l)$. }*/ { return Ray_d<R>(point(0).transform(t),point(1).transform(t)); } Ray_d<R> operator+(const Vector_d<R>& v) const /*{\Mbinop returns |\Mvar+v|, i.e., |\Mvar| translated by vector $v$.}*/ { return Ray_d<R>(point(0)+v, point(1)+v); } bool has_on(const Point_d<R>& p) const /*{\Mop A point is on |r|, iff it is equal to the source of |r|, or if it is in the interior of |r|.}*/ { typename R::Position_on_line_d pos; FT l; if (pos(p,point(0),point(1),l)) return (FT(0)<=l); return false; } /*{\Mtext \headerline{Non-Member Functions}}*/ bool operator==(const Ray_d<R>& r1) const { if ( this->identical(r1) ) return true; if ( dimension() != r1.dimension() ) return false; return source() == r1.source() && direction() == r1.direction(); } bool operator!=(const Ray_d<R>& r1) { return !operator==(r1); } friend std::istream& operator>> <> (std::istream&, Ray_d<R>&); friend std::ostream& operator<< <> (std::ostream&, const Ray_d<R>&); }; // end of class template <class R> bool parallel(const Ray_d<R>& r1, const Ray_d<R>& r2) /*{\Mfunc returns true if the unoriented supporting lines of |r1| and |r2| are parallel and false otherwise. }*/ { return (r1.direction() == r2.direction()) || (r1.direction() == -(r2.direction())); } template <class R> std::istream& operator>>(std::istream& I, Ray_d<R>& r) { r.copy_on_write(); r.ptr()->read(I); CGAL_assertion_msg(r.point(0)!=r.point(1), "Line_d::operator>>: trivial ray."); CGAL_assertion_msg(r.point(0).dimension()==r.point(1).dimension(), "Ray_d::operator>>: dimensions disagree."); return I; } template <class R> std::ostream& operator<<(std::ostream& O, const Ray_d<R>& r) { r.ptr()->print(O,"Ray_d"); return O; } /*{\Mimplementation Rays are implemented by a pair of points as an item type. All operations like creation, initialization, tests, direction calculation, input and output on a ray $r$ take time $O(|r.dimension()|)$. |dimension()|, coordinate and point access, and identity test take constant time. The space requirement is $O(|r.dimension()|)$.}*/ } //namespace CGAL #endif // CGAL_RAYHD_H //----------------------- end of file ----------------------------------
32.32381
122
0.671774
ec795b5cbd9f3780fac6ff227235d5f1772e8d7d
650
c
C
zircon/system/utest/trace/no_optimization.c
zhangpf/fuchsia-rs
903568f28ddf45f09157ead36d61b50322c9cf49
[ "BSD-3-Clause" ]
1
2019-04-21T18:02:26.000Z
2019-04-21T18:02:26.000Z
zircon/system/utest/trace/no_optimization.c
zhangpf/fuchsia-rs
903568f28ddf45f09157ead36d61b50322c9cf49
[ "BSD-3-Clause" ]
16
2020-09-04T19:01:11.000Z
2021-05-28T03:23:09.000Z
zircon/system/utest/trace/no_optimization.c
ZVNexus/fuchsia
c5610ad15208208c98693618a79c705af935270c
[ "BSD-3-Clause" ]
null
null
null
// Copyright 2018 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This testcase is mainly a compilation test: Do we get undefined symbols // when we link C code compiled with -O0? The semantics of inline functions // are different between C and C++, and with C at -O0 we need to verify a // real copy of the functions exist (unless they get marked __ALWAYS_INLINE). #if defined(__GNUC__) && !defined(__clang__) #pragma GCC optimize("O0") #endif #ifdef __clang__ #pragma clang optimize off #endif #define NO_OPTIM #include "event_tests_common.h"
32.5
77
0.755385
ec7b1ca41144bb94ca13ebcff896d701b853736c
2,171
h
C
Samples/NodeEditor/nsNodeProperties.h
gamekit-developers/gamekit
74c896af5826ebe8fb72f2911015738f38ab7bb2
[ "Zlib", "MIT" ]
241
2015-01-04T00:36:58.000Z
2022-01-06T19:19:23.000Z
Samples/NodeEditor/nsNodeProperties.h
slagusev/gamekit
a6e97fcf2a9c3b9b9799bc12c3643818503ffc7d
[ "MIT" ]
10
2015-07-10T18:27:17.000Z
2019-06-26T20:59:59.000Z
Samples/NodeEditor/nsNodeProperties.h
slagusev/gamekit
a6e97fcf2a9c3b9b9799bc12c3643818503ffc7d
[ "MIT" ]
82
2015-01-25T18:02:35.000Z
2022-03-05T12:28:17.000Z
/* ------------------------------------------------------------------------------- This file is part of OgreKit. http://gamekit.googlecode.com/ Copyright (c) 2006-2010 Charlie C. Contributor(s): none yet. ------------------------------------------------------------------------------- This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. ------------------------------------------------------------------------------- */ #ifndef _nsNodePropertyPage_h_ #define _nsNodePropertyPage_h_ #include "nsCommon.h" #include "nsSingleton.h" #include "nsEventHandler.h" #include "nsNodeTypeInfo.h" #include <wx/panel.h> #include <wx/propgrid/manager.h> class nsNodePropertyPage : public wxPropertyGridPage { protected: nsPropertyManager* m_manager; nsNode* m_node; wxPropertyCategory* m_type, *m_data; wxStringProperty* m_typename; wxStringProperty* m_groupname; wxStringProperty* m_id; wxStringProperty* m_object; virtual bool propertyChanged(wxPGProperty* prop) {return false;} public: nsNodePropertyPage(nsPropertyManager* manager); virtual ~nsNodePropertyPage() {} void createProperties(void); void selectRoot(void); // events void propertyChangeEvent(wxPropertyGridEvent& evt); // current node this page will operate on void setNode(nsNode* node); DECLARE_EVENT_TABLE(); }; #endif//_nsNodePropertyPage_h_
29.337838
79
0.67158
ec7c7371c66e8967b747a0f8d71639fd3eb5f2d0
9,742
h
C
chrome/common/net/gaia/gaia_authenticator.h
1065672644894730302/Chromium
239dd49e906be4909e293d8991e998c9816eaa35
[ "BSD-3-Clause" ]
1
2019-04-23T15:57:04.000Z
2019-04-23T15:57:04.000Z
chrome/common/net/gaia/gaia_authenticator.h
1065672644894730302/Chromium
239dd49e906be4909e293d8991e998c9816eaa35
[ "BSD-3-Clause" ]
null
null
null
chrome/common/net/gaia/gaia_authenticator.h
1065672644894730302/Chromium
239dd49e906be4909e293d8991e998c9816eaa35
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 2011 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. // // Use this class to authenticate users with Gaia and access cookies sent // by the Gaia servers. This class cannot be used on its own becaue it relies // on a subclass to provide the virtual Post and GetBackoffDelaySeconds methods. // // Sample usage: // class ActualGaiaAuthenticator : public gaia::GaiaAuthenticator { // Provides actual implementation of Post and GetBackoffDelaySeconds. // }; // ActualGaiaAuthenticator gaia_auth("User-Agent", SERVICE_NAME, kGaiaUrl); // if (gaia_auth.Authenticate("email", "passwd", SAVE_IN_MEMORY_ONLY, // true)) { // Synchronous // // Do something with: gaia_auth.auth_token(), or gaia_auth.sid(), // // or gaia_auth.lsid() // } // // Credentials can also be preserved for subsequent requests, though these are // saved in plain-text in memory, and not very secure on client systems. The // email address associated with the Gaia account can be read; the password is // write-only. // TODO(sanjeevr): This class has been moved here from the bookmarks sync code. // While it is a generic class that handles GAIA authentication, there are some // artifacts of the sync code which needs to be cleaned up. #ifndef CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR_H_ #define CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR_H_ #pragma once #include <string> #include "base/basictypes.h" #include "base/gtest_prod_util.h" #include "base/message_loop.h" #include "googleurl/src/gurl.h" namespace gaia { // Error codes from Gaia. These will be set correctly for both Gaia V1 // (/ClientAuth) and V2 (/ClientLogin) enum AuthenticationError { None = 0, BadAuthentication = 1, NotVerified = 2, TermsNotAgreed = 3, Unknown = 4, AccountDeleted = 5, AccountDisabled = 6, CaptchaRequired = 7, ServiceUnavailable = 8, // Errors generated by this class not Gaia. CredentialsNotSet = 9, ConnectionUnavailable = 10 }; class GaiaAuthenticator; // GaiaAuthenticator can be used to pass user credentials to Gaia and obtain // cookies set by the Gaia servers. class GaiaAuthenticator { FRIEND_TEST_ALL_PREFIXES(GaiaAuthenticatorTest, TestNewlineAtEndOfAuthTokenRemoved); public: // Since GaiaAuthenticator can be used for any service, or by any client, you // must include a user-agent and a service-id when creating one. The // user_agent is a short string used for simple log analysis. gaia_url is used // to choose the server to authenticate with (e.g. // http://accounts.google.com/ClientLogin). GaiaAuthenticator(const std::string& user_agent, const std::string& service_id, const std::string& gaia_url); virtual ~GaiaAuthenticator(); // This object should only be invoked from the AuthWatcherThread message // loop, which is injected here. void set_message_loop(const MessageLoop* loop) { message_loop_ = loop; } // Pass credentials to authenticate with, or use saved credentials via an // overload. If authentication succeeds, you can retrieve the authentication // token via the respective accessors. Returns a boolean indicating whether // authentication succeeded or not. bool Authenticate(const std::string& user_name, const std::string& password, const std::string& captcha_token, const std::string& captcha_value); bool Authenticate(const std::string& user_name, const std::string& password); // Pass the LSID to authenticate with. If the authentication succeeds, you can // retrieve the authetication token via the respective accessors. Returns a // boolean indicating whether authentication succeeded or not. // Always returns a long lived token. bool AuthenticateWithLsid(const std::string& lsid); // Resets all stored cookies to their default values. void ResetCredentials(); void SetUsernamePassword(const std::string& username, const std::string& password); void SetUsername(const std::string& username); // Virtual for testing virtual void RenewAuthToken(const std::string& auth_token); void SetAuthToken(const std::string& auth_token); struct AuthResults { AuthResults(); ~AuthResults(); std::string email; std::string password; // Fields that store various cookies. std::string sid; std::string lsid; std::string auth_token; std::string primary_email; // Fields for items returned when authentication fails. std::string error_msg; enum AuthenticationError auth_error; std::string auth_error_url; std::string captcha_token; std::string captcha_url; }; protected: struct AuthParams { AuthParams(); ~AuthParams(); GaiaAuthenticator* authenticator; uint32 request_id; std::string email; std::string password; std::string captcha_token; std::string captcha_value; }; // mutex_ must be entered before calling this function. AuthParams MakeParams(const std::string& user_name, const std::string& password, const std::string& captcha_token, const std::string& captcha_value); // The real Authenticate implementations. bool AuthenticateImpl(const AuthParams& params); bool AuthenticateImpl(const AuthParams& params, AuthResults* results); // virtual for testing purposes. virtual bool PerformGaiaRequest(const AuthParams& params, AuthResults* results); virtual bool Post(const GURL& url, const std::string& post_body, unsigned long* response_code, std::string* response_body); // Caller should fill in results->LSID before calling. Result in // results->primary_email. virtual bool LookupEmail(AuthResults* results); // Subclasses must override to provide a backoff delay. It is virtual instead // of pure virtual for testing purposes. // TODO(sanjeevr): This should be made pure virtual. But this class is // currently directly being used in sync/engine/authenticator.cc, which is // wrong. virtual int GetBackoffDelaySeconds(int current_backoff_delay); public: // Retrieve email. inline std::string email() const { DCHECK_EQ(MessageLoop::current(), message_loop_); return auth_results_.email; } // Retrieve password. inline std::string password() const { DCHECK_EQ(MessageLoop::current(), message_loop_); return auth_results_.password; } // Retrieve AuthToken, if previously authenticated; otherwise returns "". inline std::string auth_token() const { DCHECK_EQ(MessageLoop::current(), message_loop_); return auth_results_.auth_token; } // Retrieve SID cookie. For details, see the Google Accounts documentation. inline std::string sid() const { DCHECK_EQ(MessageLoop::current(), message_loop_); return auth_results_.sid; } // Retrieve LSID cookie. For details, see the Google Accounts documentation. inline std::string lsid() const { DCHECK_EQ(MessageLoop::current(), message_loop_); return auth_results_.lsid; } // Get last authentication error. inline enum AuthenticationError auth_error() const { DCHECK_EQ(MessageLoop::current(), message_loop_); return auth_results_.auth_error; } inline std::string auth_error_url() const { DCHECK_EQ(MessageLoop::current(), message_loop_); return auth_results_.auth_error_url; } inline std::string captcha_token() const { DCHECK_EQ(MessageLoop::current(), message_loop_); return auth_results_.captcha_token; } inline std::string captcha_url() const { DCHECK_EQ(MessageLoop::current(), message_loop_); return auth_results_.captcha_url; } inline AuthResults results() const { DCHECK_EQ(MessageLoop::current(), message_loop_); return auth_results_; } private: bool IssueAuthToken(AuthResults* results, const std::string& service_id); // Helper method to parse response when authentication succeeds. void ExtractTokensFrom(const std::string& response, AuthResults* results); // Helper method to parse response when authentication fails. void ExtractAuthErrorFrom(const std::string& response, AuthResults* results); // Fields for the obvious data items. const std::string user_agent_; const std::string service_id_; const std::string gaia_url_; AuthResults auth_results_; // When multiple async requests are running, only the one that started most // recently updates the values. // // Note that even though this code was written to handle multiple requests // simultaneously, the sync code issues auth requests one at a time. uint32 request_count_; // Used to compute backoff time for next allowed authentication. int delay_; // In seconds. // On Windows, time_t is 64-bit by default. Even though we have defined the // _USE_32BIT_TIME_T preprocessor flag, other libraries including this header // may not have that preprocessor flag defined resulting in mismatched class // sizes. So we explicitly define it as 32-bit on Windows. // TODO(sanjeevr): Change this to to use base::Time #if defined(OS_WIN) __time32_t next_allowed_auth_attempt_time_; #else // defined(OS_WIN) time_t next_allowed_auth_attempt_time_; #endif // defined(OS_WIN) int early_auth_attempt_count_; // The message loop all our methods are invoked on. const MessageLoop* message_loop_; }; } // namespace gaia #endif // CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR_H_
35.554745
80
0.714843
ec7e128ce571c4899893f36d6d1bd8a0ad232404
510
h
C
PrivateFrameworks/WorkflowKit/ICCreateDayOneEntryAction.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
17
2018-11-13T04:02:58.000Z
2022-01-20T09:27:13.000Z
PrivateFrameworks/WorkflowKit/ICCreateDayOneEntryAction.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
3
2018-04-06T02:02:27.000Z
2018-10-02T01:12:10.000Z
PrivateFrameworks/WorkflowKit/ICCreateDayOneEntryAction.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
1
2018-09-28T13:54:23.000Z
2018-09-28T13:54:23.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import <WorkflowKit/ICSchemeAction.h> @interface ICCreateDayOneEntryAction : ICSchemeAction { } - (void)getImagesFromInput:(id)arg1 completionHandler:(CDUnknownBlockType)arg2; - (void)performActionWithInput:(id)arg1 parameters:(id)arg2 userInterface:(id)arg3 successHandler:(CDUnknownBlockType)arg4 errorHandler:(CDUnknownBlockType)arg5; - (BOOL)inputRequired; @end
26.842105
161
0.762745
ec7f2e10d2e60a12c04613003426b5442c6a8cc6
625
h
C
tests/iface/trace_test.h
pjknowles/libtensor
f18e0e33c6c4512e4ea1dde31ed8d74fe536ed24
[ "BSL-1.0" ]
33
2016-02-08T06:05:17.000Z
2021-11-17T01:23:11.000Z
tests/iface/trace_test.h
pjknowles/libtensor
f18e0e33c6c4512e4ea1dde31ed8d74fe536ed24
[ "BSL-1.0" ]
5
2016-06-14T15:54:11.000Z
2020-12-07T08:27:20.000Z
tests/iface/trace_test.h
pjknowles/libtensor
f18e0e33c6c4512e4ea1dde31ed8d74fe536ed24
[ "BSL-1.0" ]
12
2016-05-19T18:09:38.000Z
2021-02-24T17:35:21.000Z
#ifndef LIBTENSOR_TRACE_TEST_H #define LIBTENSOR_TRACE_TEST_H #include <libtest/unit_test.h> namespace libtensor { /** \brief Tests the libtensor::trace function \ingroup libtensor_tests_iface **/ class trace_test : public libtest::unit_test { public: virtual void perform() throw(libtest::test_exception); private: void test_t_1(); void test_t_2(); void test_t_3(); void test_e_1(); void test_e_2(); void test_e_3(); void check_ref(const char *testname, double d, double d_ref) throw(libtest::test_exception); }; } // namespace libtensor #endif // LIBTENSOR_TRACE_TEST_H
20.16129
64
0.7136
ec7f3eba3640a0d020b289006b8b7d95a614e24b
7,974
h
C
Configurations/Configuration.h
lvgl/lv_port_aurix
b50cba7ad4d3a033ea8eba83b40dc262d1b0ebb6
[ "MIT" ]
2
2021-03-18T12:04:50.000Z
2021-04-28T10:52:46.000Z
Configurations/Configuration.h
lvgl/lv_port_aurix
b50cba7ad4d3a033ea8eba83b40dc262d1b0ebb6
[ "MIT" ]
null
null
null
Configurations/Configuration.h
lvgl/lv_port_aurix
b50cba7ad4d3a033ea8eba83b40dc262d1b0ebb6
[ "MIT" ]
2
2020-12-13T16:00:45.000Z
2021-05-21T08:23:26.000Z
/** * \file Configuration.h * \brief Global configuration * * \version iLLD_Demos_0_1_0_11 * \copyright Copyright (c) 2014 Infineon Technologies AG. All rights reserved. * * * IMPORTANT NOTICE * * * Infineon Technologies AG (Infineon) is supplying this file for use * exclusively with Infineon's microcontroller products. This file can be freely * distributed within development tools that are supporting such microcontroller * products. * * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. * * \defgroup IfxLld_Demo_QspiDmaDemo_SrcDoc_Config Application configuration * \ingroup IfxLld_Demo_QspiDmaDemo_SrcDoc * * */ #ifndef CONFIGURATION_H #define CONFIGURATION_H /******************************************************************************/ /*----------------------------------Includes----------------------------------*/ /******************************************************************************/ #include "Ifx_Cfg.h" #include <_PinMap/IfxQspi_PinMap.h> #include <_PinMap/IfxPort_PinMap.h> #include <_PinMap/IfxScu_PinMap.h> #include <_PinMap/IfxGtm_PinMap.h> #include "Qspi0.h" #include "Qspi1.h" #include "Qspi2.h" #include "Qspi3.h" #include "Qspi4.h" #include "ConfigurationIsr.h" /******************************************************************************/ /*-----------------------------------Macros-----------------------------------*/ /******************************************************************************/ /* set here the used pins for QSPI4 not used on board */ #define QSPI4_MAX_BAUDRATE 50000000 // maximum baudrate which is possible to get a small time quantum #define QSPI4_SCLK_PIN IfxQspi4_SCLK_P22_3_OUT #define QSPI4_MTSR_PIN IfxQspi4_MTSR_P22_0_OUT #define QSPI4_MRST_PIN IfxQspi4_MRSTB_P22_1_IN //#define QSPI4_USE_DMA // uncomment line for using DMA /* set here the used pins for QSPI3 not used on board */ #define QSPI3_MAX_BAUDRATE 50000000 // maximum baudrate which is possible to get a small time quantum #define QSPI3_SCLK_PIN IfxQspi3_SCLK_P02_7_OUT #define QSPI3_MTSR_PIN IfxQspi3_MTSR_P02_6_OUT #define QSPI3_MRST_PIN IfxQspi3_MRSTA_P02_5_IN //#define QSPI3_USE_DMA // uncomment line for using DMA /* next values are used for TC23X/TC22X, because TC23X/TC22X don't has I2C */ //#define DMA_CH_QSPI3_TX RTC_DMA_CH_TXBUFF_TO_TXFIFO //#define DMA_CH_QSPI3_RX RTC_DMA_CH_RXBUFF_FROM_RXFIFO //#define RTC_QSPI_INIT qspi3_init //#define RTC_USE_CHIPSELECT IfxQspi3_SLSO13_P23_1_OUT /* next values are not used for TC23X/TC22X, because TC23X/TC22X don't has I2C */ #define RTC_SCL_PIN IfxI2c0_SCL_P15_4_INOUT #define RTC_SDA_PIN IfxI2c0_SDA_P15_5_INOUT #define RTC_ALARM_PIN_INPUT IfxScu_REQ8_P33_7_IN #define RTC_ALARM_SRC &MODULE_SRC.SCU.SCU.ERU[0] /* set here the used pins for QSPI2 */ #define QSPI2_MAX_BAUDRATE 50000000 // maximum baudrate which is possible to get a small time quantum #define QSPI2_SCLK_PIN IfxQspi2_SCLK_P15_3_OUT //#define QSPI2_MTSR_PIN IfxQspi2_MTSR_P15_5_OUT // for Application Kit TC234L #define QSPI2_MTSR_PIN IfxQspi2_MTSR_P15_6_OUT // for Application Kit TC2X7 #define QSPI2_MRST_PIN IfxQspi2_MRSTB_P15_7_IN //#define QSPI2_USE_DMA // uncomment line for using DMA //#define DMA_CH_QSPI2_TX TLF_DMA_CH_TXBUFF_TO_TXFIFO //#define DMA_CH_QSPI2_RX TLF_DMA_CH_RXBUFF_FROM_RXFIFO #define TLF_QSPI_INIT qspi2_init #define TLF_USE_CHIPSELECT IfxQspi2_SLSO1_P14_2_OUT /* set here the used pins for QSPI1 */ #define QSPI1_MAX_BAUDRATE 50000000 // maximum baudrate which is possible to get a small time quantum #define QSPI1_SCLK_PIN IfxQspi1_SCLK_P10_2_OUT #define QSPI1_MTSR_PIN IfxQspi1_MTSR_P10_3_OUT #define QSPI1_MRST_PIN IfxQspi1_MRSTA_P10_1_IN #define QSPI1_USE_DMA // comment line for not using DMA #define DMA_CH_QSPI1_TX SDCARD_DMA_CH_TXBUFF_TO_TXFIFO #define DMA_CH_QSPI1_RX SDCARD_DMA_CH_RXBUFF_FROM_RXFIFO #define SDCARD_QSPI_INIT qspi1_init #define SDCARD_USE_CHIPSELECT IfxQspi1_SLSO9_P10_5_OUT #define SDCARD_USE_CD IfxPort_P15_8 /* ECON for 25MHz (A=3, B=3, C=0, TQ=2) with 300MHz fbaud2 */ #define SDCARD_FCLK_FAST_VALUE 0x0381 /* set here the used pins for QSPI0 */ #define QSPI0_MAX_BAUDRATE 50000000 // maximum baudrate which is possible to get a small time quantum #define QSPI0_SCLK_PIN IfxQspi0_SCLK_P20_11_OUT #define QSPI0_MTSR_PIN IfxQspi0_MTSR_P20_14_OUT #define QSPI0_MRST_PIN IfxQspi0_MRSTA_P20_12_IN #define QSPI0_USE_DMA // comment line for not using DMA #define DMA_CH_QSPI0_TX TFT_DMA_CH_TXBUFF_TO_TXFIFO #define DMA_CH_QSPI0_RX TFT_DMA_CH_RXBUFF_FROM_RXFIFO #define QSPI0_TRANSMIT_CALLBACK tft_transmit_callback #define TFT_QSPI_INIT qspi0_init #define TFT_USE_CHIPSELECT IfxQspi0_SLSO8_P20_6_OUT #define TFT_USE_SCLK QSPI0_SCLK_PIN #define TFT_UPDATE_IRQ MODULE_SRC.GPSR.GPSR[0].SR0 #define TOUCH_QSPI_INIT qspi0_init #define TOUCH_USE_CHIPSELECT IfxQspi0_SLSO9_P20_3_OUT #define TOUCH_USE_INT IfxPort_P20_0 #define BACKGROUND_LIGHT IfxGtm_TOM1_1_TOUT69_P20_13_OUT #define BEEPER IfxGtm_TOM0_4_TOUT22_P33_0_OUT #define PERFORMANCE_MEASURE IfxGtm_TOM0_0_TOUT76_P15_5_OUT // we can use P15.5 because no output needed and P15.5 maybe used by I2C #define CAN_TXD_USE IfxPort_P20_8 #define CAN_RXD_USE IfxPort_P20_7 #define LIN_TXD_USE IfxPort_P15_0 #define LIN_RXD_USE IfxPort_P15_1 #define ASC_TXD_USE IfxPort_P14_0 #define ASC_RXD_USE IfxPort_P14_1 #define LED0_PORT IfxPort_P13_0 #define LED1_PORT IfxPort_P13_1 #define LED2_PORT IfxPort_P13_2 #define LED3_PORT IfxPort_P13_3 #define LIFEHOLD_LED LED3_PORT /* we define here the pins for ethernet phy RMII connection */ #define ETH_CRSDIV_PIN IfxEth_CRSDVA_P11_11_IN #define ETH_REFCLK_PIN IfxEth_REFCLK_P11_12_IN #define ETH_RXD0_PIN IfxEth_RXD0_P11_10_IN #define ETH_RXD1_PIN IfxEth_RXD1_P11_9_IN #define ETH_MDC_PIN IfxEth_MDC_P21_2_OUT #define ETH_MDIO_PIN IfxEth_MDIOD_P21_3_INOUT #define ETH_TXD0_PIN IfxEth_TXD0_P11_3_OUT #define ETH_TXD1_PIN IfxEth_TXD1_P11_2_OUT #define ETH_TXEN_PIN IfxEth_TXEN_P11_6_OUT /* set the values for systemtimer */ #define IFX_CFG_STM_TICKS_PER_MS (100000) /**< \brief Number of STM ticks per millisecond */ /* define the CPU which holds the variable for different parts */ #define TFT_DISPLAY_VAR_LOCATION 2 #define TOUCH_VAR_LOCATION 2 #define SDCARD_VAR_LOCATION 0 #define RTC_VAR_LOCATION 1 #define TLF_VAR_LOCATION 0 #define LWIP_VAR_LOCATION 0 #define USE_TFT //#define TFT_OVER_DAS #define REFRESH_TFT 50 // Refresh rate [ms]; 1x refresh ~0,8 % CPU load; for graphic-out: 4 colors ~ 1.2 % CPU load, 16 colors ~ 0.8 % CPU load // Max refresh rate ~ 40 ms due to QSPI-load #define REFRESH_MEASUREMENT 50 // Refresh rate [ms] for temperature and voltage measurement #define VERSION_TEXT "Application Kit TC297TF SW V1.1..." #endif
44.797753
144
0.674944
ec7f7ec2cce5bd112a7c6c6d97eef6a39e114c58
5,409
h
C
openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_proto.h
t0930198/OAI_nb_IoT
45212d3b2fd22fdeec8e0062844eaff8de3039a0
[ "Apache-2.0" ]
2
2018-01-08T06:59:34.000Z
2019-04-07T13:56:25.000Z
openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_proto.h
t0930198/OAI_nb_IoT
45212d3b2fd22fdeec8e0062844eaff8de3039a0
[ "Apache-2.0" ]
1
2021-05-28T09:06:21.000Z
2021-05-28T14:49:39.000Z
openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_proto.h
t0930198/OAI_nb_IoT
45212d3b2fd22fdeec8e0062844eaff8de3039a0
[ "Apache-2.0" ]
5
2019-02-14T16:06:26.000Z
2022-01-05T03:52:29.000Z
/* * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The OpenAirInterface Software Alliance licenses this file to You under * the OAI Public License, Version 1.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.openairinterface.org/?page_id=698 * * 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. *------------------------------------------------------------------------------- * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ /*! \file nasmt_proto.h * \brief Function prototypes for OpenAirInterface CELLULAR version - MT * \author michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier * \company Eurecom * \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr, lionel.gauthier@eurecom.fr */ /*******************************************************************************/ #ifndef _NASMTD_PROTO_H #define _NASMTD_PROTO_H #include <linux/if_arp.h> #include <linux/types.h> #include <linux/spinlock.h> #include <linux/netdevice.h> #include <linux/skbuff.h> #include <linux/ipv6.h> #include <linux/ip.h> #include <linux/sysctl.h> #include <linux/timer.h> #include <asm/param.h> //#include <sys/sysctl.h> #include <linux/udp.h> #include <linux/tcp.h> #include <linux/icmp.h> #include <linux/icmpv6.h> #include <linux/in.h> #include <net/ndisc.h> //#include "rrc_nas_primitives.h" //#include "protocol_vars_extern.h" //#include "as_sap.h" //#include "rrc_qos.h" //#include "rrc_sap.h" // nasmt_netlink.c void nasmt_netlink_release(void); int nasmt_netlink_init(void); int nasmt_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination); // nasmt_common.c //void nasmt_COMMON_receive(uint16_t hlen, uint16_t dlength, int sap); void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap); void nasmt_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc); void nasmt_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc); #ifndef PDCP_USE_NETLINK void nasmt_COMMON_QOS_receive(struct cx_entity *cx); #else void nasmt_COMMON_QOS_receive(struct nlmsghdr *nlh); #endif struct rb_entity *nasmt_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rabi, nasQoSTrafficClass_t qos); struct rb_entity *nasmt_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rabi); struct cx_entity *nasmt_COMMON_search_cx(nasLocalConnectionRef_t lcr); void nasmt_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp); void nasmt_COMMON_flush_rb(struct cx_entity *cx); //nasmt_ascontrol.c void nasmt_ASCTL_init(void); void nasmt_ASCTL_timer(unsigned long data); int nasmt_ASCTL_DC_receive(struct cx_entity *cx, char *buffer); int nasmt_ASCTL_GC_receive(char *buffer); int nasmt_ASCTL_DC_send_cx_establish_request(struct cx_entity *cx); int nasmt_ASCTL_DC_send_cx_release_request(struct cx_entity *cx); void nasmt_ASCTL_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc); void nasmt_ASCTL_DC_send_peer_sig_data_request(struct cx_entity *cx, uint8_t sig_category); int nasmt_ASCTL_leave_sleep_mode(struct cx_entity *cx); int nasmt_ASCTL_enter_sleep_mode(struct cx_entity *cx); // nasmt_iocontrol.c void nasmt_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc); int nasmt_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); // nasmt_classifier.c void nasmt_CLASS_send(struct sk_buff *skb); struct classifier_entity *nasmt_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref); struct classifier_entity *nasmt_CLASS_add_rclassifier(uint8_t dscp, uint16_t classref); void nasmt_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref); void nasmt_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref); void nasmt_CLASS_flush_sclassifier(struct cx_entity *cx); void nasmt_CLASS_flush_rclassifier(void); // nasmt_tool.c uint8_t nasmt_TOOL_invfct(struct classifier_entity *gc); void nasmt_TOOL_fct(struct classifier_entity *gc, uint8_t fct); void nasmt_TOOL_imei2iid(uint8_t *imei, uint8_t *iid); void nasmt_TOOL_eth_imei2iid(unsigned char *imei, unsigned char *addr ,unsigned char *iid, unsigned char len); uint8_t nasmt_TOOL_get_dscp6(struct ipv6hdr *iph); uint8_t nasmt_TOOL_get_dscp4(struct iphdr *iph); uint8_t *nasmt_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol); uint8_t *nasmt_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol); void nasmt_TOOL_pk_icmp6(struct icmp6hdr *icmph); void nasmt_TOOL_print_state(uint8_t state); void nasmt_TOOL_print_buffer(unsigned char * buffer,int length); void nasmt_TOOL_print_rb_entity(struct rb_entity *rb); void nasmt_TOOL_print_classifier(struct classifier_entity *gc); #endif
43.97561
121
0.780736
ec7ffdec0fa99ee8fd929b302f0c944301d78148
1,840
c
C
riscv32_virt/liteos_m/board/riscv_hal.c
openharmony-gitee-mirror/device_qemu
25da41cf4dc328f19cf6687bed5b89bebe30b74d
[ "Apache-2.0" ]
null
null
null
riscv32_virt/liteos_m/board/riscv_hal.c
openharmony-gitee-mirror/device_qemu
25da41cf4dc328f19cf6687bed5b89bebe30b74d
[ "Apache-2.0" ]
null
null
null
riscv32_virt/liteos_m/board/riscv_hal.c
openharmony-gitee-mirror/device_qemu
25da41cf4dc328f19cf6687bed5b89bebe30b74d
[ "Apache-2.0" ]
1
2021-09-13T11:15:22.000Z
2021-09-13T11:15:22.000Z
/* * Copyright (c) 2020-2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "riscv_hal.h" #include "los_debug.h" #include "soc.h" #include "plic.h" #include "mtimer.h" #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif VOID HalIrqDisable(UINT32 vector) { if (vector <= RISCV_SYS_MAX_IRQ) { CLEAR_CSR(mie, 1 << vector); } else { PlicIrqDisable(vector); } } VOID HalIrqEnable(UINT32 vector) { if (vector <= RISCV_SYS_MAX_IRQ) { SET_CSR(mie, 1 << vector); } else { PlicIrqEnable(vector); } } VOID HalSetLocalInterPri(UINT32 interPriNum, UINT16 prior) { PlicIrqSetPrio(interPriNum, prior); } BOOL HalBackTraceFpCheck(UINT32 value) { if (value >= (UINT32)(UINTPTR)(&__bss_end)) { return TRUE; } if ((value >= (UINT32)(UINTPTR)(&__start_and_irq_stack_top)) && (value < (UINT32)(UINTPTR)(&__except_stack_top))) { return TRUE; } return FALSE; } VOID HalClockInit(OS_TICK_HANDLER handler, UINT32 period) { UINT32 ret; ret = MTimerTickInit(handler, period); if (ret != LOS_OK) { PRINT_ERR("Creat Mtimer failed! ret : 0x%x \n", ret); return; } PlicIrqInit(); HalIrqEnable(RISCV_MACH_EXT_IRQ); } #ifdef __cplusplus #if __cplusplus } #endif #endif
22.168675
119
0.671739
ec8378034433d6fd8b74d9e5172b47588c989672
593
c
C
src/moba/moba.c
Mon-ius/bart
3a27e78d3a11283067a4df368356fcb398a9f707
[ "BSD-3-Clause" ]
null
null
null
src/moba/moba.c
Mon-ius/bart
3a27e78d3a11283067a4df368356fcb398a9f707
[ "BSD-3-Clause" ]
null
null
null
src/moba/moba.c
Mon-ius/bart
3a27e78d3a11283067a4df368356fcb398a9f707
[ "BSD-3-Clause" ]
null
null
null
/* Copyright 2019-2020. Uecker Lab, University Medical Center Goettingen. * All rights reserved. Use of this source code is governed by * a BSD-style license which can be found in the LICENSE file. **/ #include <stdbool.h> #include "moba.h" struct moba_conf moba_defaults = { .iter = 8, .opt_reg = 1., .alpha = 1., .alpha_min = 0., .redu = 2., .step = 0.9, .lower_bound = 0., .tolerance = 0.01, .damping = 0.9, .inner_iter = 250, .noncartesian = false, .sms = false, .k_filter = false, .auto_norm_off = false, .algo = 3, .rho = 0.01, .stack_frames = false, };
19.129032
73
0.639123